1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629156301563115632156331563415635156361563715638156391564015641156421564315644156451564615647156481564915650156511565215653156541565515656156571565815659156601566115662156631566415665156661566715668156691567015671156721567315674156751567615677156781567915680156811568215683156841568515686156871568815689156901569115692156931569415695156961569715698156991570015701157021570315704157051570615707157081570915710157111571215713157141571515716157171571815719157201572115722157231572415725157261572715728157291573015731157321573315734157351573615737157381573915740157411574215743157441574515746157471574815749157501575115752157531575415755157561575715758157591576015761157621576315764157651576615767157681576915770157711577215773157741577515776157771577815779157801578115782157831578415785157861578715788157891579015791157921579315794157951579615797157981579915800158011580215803158041580515806158071580815809158101581115812158131581415815158161581715818158191582015821158221582315824158251582615827158281582915830158311583215833158341583515836158371583815839158401584115842158431584415845158461584715848158491585015851158521585315854158551585615857158581585915860158611586215863158641586515866158671586815869158701587115872158731587415875158761587715878158791588015881158821588315884158851588615887158881588915890158911589215893158941589515896158971589815899159001590115902159031590415905159061590715908159091591015911159121591315914159151591615917159181591915920159211592215923159241592515926159271592815929159301593115932159331593415935159361593715938159391594015941159421594315944159451594615947159481594915950159511595215953159541595515956159571595815959159601596115962159631596415965159661596715968159691597015971159721597315974159751597615977159781597915980159811598215983159841598515986159871598815989159901599115992159931599415995159961599715998159991600016001160021600316004160051600616007160081600916010160111601216013160141601516016160171601816019160201602116022160231602416025160261602716028160291603016031160321603316034160351603616037160381603916040160411604216043160441604516046160471604816049160501605116052160531605416055160561605716058160591606016061160621606316064160651606616067160681606916070160711607216073160741607516076160771607816079160801608116082160831608416085160861608716088160891609016091160921609316094160951609616097160981609916100161011610216103161041610516106161071610816109161101611116112161131611416115161161611716118161191612016121161221612316124161251612616127161281612916130161311613216133161341613516136161371613816139161401614116142161431614416145161461614716148161491615016151161521615316154161551615616157161581615916160161611616216163161641616516166161671616816169161701617116172161731617416175161761617716178161791618016181161821618316184161851618616187161881618916190161911619216193161941619516196161971619816199162001620116202162031620416205162061620716208162091621016211162121621316214162151621616217162181621916220162211622216223162241622516226162271622816229162301623116232162331623416235162361623716238162391624016241162421624316244162451624616247162481624916250162511625216253162541625516256162571625816259162601626116262162631626416265162661626716268162691627016271162721627316274162751627616277162781627916280162811628216283162841628516286162871628816289162901629116292162931629416295162961629716298162991630016301163021630316304163051630616307163081630916310163111631216313163141631516316163171631816319163201632116322163231632416325163261632716328163291633016331163321633316334163351633616337163381633916340163411634216343163441634516346163471634816349163501635116352163531635416355163561635716358163591636016361163621636316364163651636616367163681636916370163711637216373163741637516376163771637816379163801638116382163831638416385163861638716388163891639016391163921639316394163951639616397163981639916400164011640216403164041640516406164071640816409164101641116412164131641416415164161641716418164191642016421164221642316424164251642616427164281642916430164311643216433164341643516436164371643816439164401644116442164431644416445164461644716448164491645016451164521645316454164551645616457164581645916460164611646216463164641646516466164671646816469164701647116472164731647416475164761647716478164791648016481164821648316484164851648616487164881648916490164911649216493164941649516496164971649816499165001650116502165031650416505165061650716508165091651016511165121651316514165151651616517165181651916520165211652216523165241652516526165271652816529165301653116532165331653416535165361653716538165391654016541165421654316544165451654616547165481654916550165511655216553165541655516556165571655816559165601656116562165631656416565165661656716568165691657016571165721657316574165751657616577165781657916580165811658216583165841658516586165871658816589165901659116592165931659416595165961659716598165991660016601166021660316604166051660616607166081660916610166111661216613166141661516616166171661816619166201662116622166231662416625166261662716628166291663016631166321663316634166351663616637166381663916640166411664216643166441664516646166471664816649166501665116652166531665416655166561665716658166591666016661166621666316664166651666616667166681666916670166711667216673166741667516676166771667816679166801668116682166831668416685166861668716688166891669016691166921669316694166951669616697166981669916700167011670216703167041670516706167071670816709167101671116712167131671416715167161671716718167191672016721167221672316724167251672616727167281672916730167311673216733167341673516736167371673816739167401674116742167431674416745167461674716748167491675016751167521675316754167551675616757167581675916760167611676216763167641676516766167671676816769167701677116772167731677416775167761677716778167791678016781167821678316784167851678616787167881678916790167911679216793167941679516796167971679816799168001680116802168031680416805168061680716808168091681016811168121681316814168151681616817168181681916820168211682216823168241682516826168271682816829168301683116832168331683416835168361683716838168391684016841168421684316844168451684616847168481684916850168511685216853168541685516856168571685816859168601686116862168631686416865168661686716868168691687016871168721687316874168751687616877168781687916880168811688216883168841688516886168871688816889168901689116892168931689416895168961689716898168991690016901169021690316904169051690616907169081690916910169111691216913169141691516916169171691816919169201692116922169231692416925169261692716928169291693016931169321693316934169351693616937169381693916940169411694216943169441694516946169471694816949169501695116952169531695416955169561695716958169591696016961169621696316964169651696616967169681696916970169711697216973169741697516976169771697816979169801698116982169831698416985169861698716988169891699016991169921699316994169951699616997169981699917000170011700217003170041700517006170071700817009170101701117012170131701417015170161701717018170191702017021170221702317024170251702617027170281702917030170311703217033170341703517036170371703817039170401704117042170431704417045170461704717048170491705017051170521705317054170551705617057170581705917060170611706217063170641706517066170671706817069170701707117072170731707417075170761707717078170791708017081170821708317084170851708617087170881708917090170911709217093170941709517096170971709817099171001710117102171031710417105171061710717108171091711017111171121711317114171151711617117171181711917120171211712217123171241712517126171271712817129171301713117132171331713417135171361713717138171391714017141171421714317144171451714617147171481714917150171511715217153171541715517156171571715817159171601716117162171631716417165171661716717168171691717017171171721717317174171751717617177171781717917180171811718217183171841718517186171871718817189171901719117192171931719417195171961719717198171991720017201172021720317204172051720617207172081720917210172111721217213172141721517216172171721817219172201722117222172231722417225172261722717228172291723017231172321723317234172351723617237172381723917240172411724217243172441724517246172471724817249172501725117252172531725417255172561725717258172591726017261172621726317264172651726617267172681726917270172711727217273172741727517276172771727817279172801728117282172831728417285172861728717288172891729017291172921729317294172951729617297172981729917300173011730217303173041730517306173071730817309173101731117312173131731417315173161731717318173191732017321173221732317324173251732617327173281732917330173311733217333173341733517336173371733817339173401734117342173431734417345173461734717348173491735017351173521735317354173551735617357173581735917360173611736217363173641736517366173671736817369173701737117372173731737417375173761737717378173791738017381173821738317384173851738617387173881738917390173911739217393173941739517396173971739817399174001740117402174031740417405174061740717408174091741017411174121741317414174151741617417174181741917420174211742217423174241742517426174271742817429174301743117432174331743417435174361743717438174391744017441174421744317444174451744617447174481744917450174511745217453174541745517456174571745817459174601746117462174631746417465174661746717468174691747017471174721747317474174751747617477174781747917480174811748217483174841748517486174871748817489174901749117492174931749417495174961749717498174991750017501175021750317504175051750617507175081750917510175111751217513175141751517516175171751817519175201752117522175231752417525175261752717528175291753017531175321753317534175351753617537175381753917540175411754217543175441754517546175471754817549175501755117552175531755417555175561755717558175591756017561175621756317564175651756617567175681756917570175711757217573175741757517576175771757817579175801758117582175831758417585175861758717588175891759017591175921759317594175951759617597175981759917600176011760217603176041760517606176071760817609176101761117612176131761417615176161761717618176191762017621176221762317624176251762617627176281762917630176311763217633176341763517636176371763817639176401764117642176431764417645176461764717648176491765017651176521765317654176551765617657176581765917660176611766217663176641766517666176671766817669176701767117672176731767417675176761767717678176791768017681176821768317684176851768617687176881768917690176911769217693176941769517696176971769817699177001770117702177031770417705177061770717708177091771017711177121771317714177151771617717177181771917720177211772217723177241772517726177271772817729177301773117732177331773417735177361773717738177391774017741177421774317744177451774617747177481774917750177511775217753177541775517756177571775817759177601776117762177631776417765177661776717768177691777017771177721777317774177751777617777177781777917780177811778217783177841778517786177871778817789177901779117792177931779417795177961779717798177991780017801178021780317804178051780617807178081780917810178111781217813178141781517816178171781817819178201782117822178231782417825178261782717828178291783017831178321783317834178351783617837178381783917840178411784217843178441784517846178471784817849178501785117852178531785417855178561785717858178591786017861178621786317864178651786617867178681786917870178711787217873178741787517876178771787817879178801788117882178831788417885178861788717888178891789017891178921789317894178951789617897178981789917900179011790217903179041790517906179071790817909179101791117912179131791417915179161791717918179191792017921179221792317924179251792617927179281792917930179311793217933179341793517936179371793817939179401794117942179431794417945179461794717948179491795017951179521795317954179551795617957179581795917960179611796217963179641796517966179671796817969179701797117972179731797417975179761797717978179791798017981179821798317984179851798617987179881798917990179911799217993179941799517996179971799817999180001800118002180031800418005180061800718008180091801018011180121801318014180151801618017180181801918020180211802218023180241802518026180271802818029180301803118032180331803418035180361803718038180391804018041180421804318044180451804618047180481804918050180511805218053180541805518056180571805818059180601806118062180631806418065180661806718068180691807018071180721807318074180751807618077180781807918080180811808218083180841808518086180871808818089180901809118092180931809418095180961809718098180991810018101181021810318104181051810618107181081810918110181111811218113181141811518116181171811818119181201812118122181231812418125181261812718128181291813018131181321813318134181351813618137181381813918140181411814218143181441814518146181471814818149181501815118152181531815418155181561815718158181591816018161181621816318164181651816618167181681816918170181711817218173181741817518176181771817818179181801818118182181831818418185181861818718188181891819018191181921819318194181951819618197181981819918200182011820218203182041820518206182071820818209182101821118212182131821418215182161821718218182191822018221182221822318224182251822618227182281822918230182311823218233182341823518236182371823818239182401824118242182431824418245182461824718248182491825018251182521825318254182551825618257182581825918260182611826218263182641826518266182671826818269182701827118272182731827418275182761827718278182791828018281182821828318284182851828618287182881828918290182911829218293182941829518296182971829818299183001830118302183031830418305183061830718308183091831018311183121831318314183151831618317183181831918320183211832218323183241832518326183271832818329183301833118332183331833418335183361833718338183391834018341183421834318344183451834618347183481834918350183511835218353183541835518356183571835818359183601836118362183631836418365183661836718368183691837018371183721837318374183751837618377183781837918380183811838218383183841838518386183871838818389183901839118392183931839418395183961839718398183991840018401184021840318404184051840618407184081840918410184111841218413184141841518416184171841818419184201842118422184231842418425184261842718428184291843018431184321843318434184351843618437184381843918440184411844218443184441844518446184471844818449184501845118452184531845418455184561845718458184591846018461184621846318464184651846618467184681846918470184711847218473184741847518476184771847818479184801848118482184831848418485184861848718488184891849018491184921849318494184951849618497184981849918500185011850218503185041850518506185071850818509185101851118512185131851418515185161851718518185191852018521185221852318524185251852618527185281852918530185311853218533185341853518536185371853818539185401854118542185431854418545185461854718548185491855018551185521855318554185551855618557185581855918560185611856218563185641856518566185671856818569185701857118572185731857418575185761857718578185791858018581185821858318584185851858618587185881858918590185911859218593185941859518596185971859818599186001860118602186031860418605186061860718608186091861018611186121861318614186151861618617186181861918620186211862218623186241862518626186271862818629186301863118632186331863418635186361863718638186391864018641186421864318644186451864618647186481864918650186511865218653186541865518656186571865818659186601866118662186631866418665186661866718668186691867018671186721867318674186751867618677186781867918680186811868218683186841868518686186871868818689186901869118692186931869418695186961869718698186991870018701187021870318704187051870618707187081870918710187111871218713187141871518716187171871818719187201872118722187231872418725187261872718728187291873018731187321873318734187351873618737187381873918740187411874218743187441874518746187471874818749187501875118752187531875418755187561875718758187591876018761187621876318764187651876618767187681876918770187711877218773187741877518776187771877818779187801878118782187831878418785187861878718788187891879018791187921879318794187951879618797187981879918800188011880218803188041880518806188071880818809188101881118812188131881418815188161881718818188191882018821188221882318824188251882618827188281882918830188311883218833188341883518836188371883818839188401884118842188431884418845188461884718848188491885018851188521885318854188551885618857188581885918860188611886218863188641886518866188671886818869188701887118872188731887418875188761887718878188791888018881188821888318884188851888618887188881888918890188911889218893188941889518896188971889818899189001890118902189031890418905189061890718908189091891018911189121891318914189151891618917189181891918920189211892218923189241892518926189271892818929189301893118932189331893418935189361893718938189391894018941189421894318944189451894618947189481894918950189511895218953189541895518956189571895818959189601896118962189631896418965189661896718968189691897018971189721897318974189751897618977189781897918980189811898218983189841898518986189871898818989189901899118992189931899418995189961899718998189991900019001190021900319004190051900619007190081900919010190111901219013190141901519016190171901819019190201902119022190231902419025190261902719028190291903019031190321903319034190351903619037190381903919040190411904219043190441904519046190471904819049190501905119052190531905419055190561905719058190591906019061190621906319064190651906619067190681906919070190711907219073190741907519076190771907819079190801908119082190831908419085190861908719088190891909019091190921909319094190951909619097190981909919100191011910219103191041910519106191071910819109191101911119112191131911419115191161911719118191191912019121191221912319124191251912619127191281912919130191311913219133191341913519136191371913819139191401914119142191431914419145191461914719148191491915019151191521915319154191551915619157191581915919160191611916219163191641916519166191671916819169191701917119172191731917419175191761917719178191791918019181191821918319184191851918619187191881918919190191911919219193191941919519196191971919819199192001920119202192031920419205192061920719208192091921019211192121921319214192151921619217192181921919220192211922219223192241922519226192271922819229192301923119232192331923419235192361923719238192391924019241192421924319244192451924619247192481924919250192511925219253192541925519256192571925819259192601926119262192631926419265192661926719268192691927019271192721927319274192751927619277192781927919280192811928219283192841928519286192871928819289192901929119292192931929419295192961929719298192991930019301193021930319304193051930619307193081930919310193111931219313193141931519316193171931819319193201932119322193231932419325193261932719328193291933019331193321933319334193351933619337193381933919340193411934219343193441934519346193471934819349193501935119352193531935419355193561935719358193591936019361193621936319364193651936619367193681936919370193711937219373193741937519376193771937819379193801938119382193831938419385193861938719388193891939019391193921939319394193951939619397193981939919400194011940219403194041940519406194071940819409194101941119412194131941419415194161941719418194191942019421194221942319424194251942619427194281942919430194311943219433194341943519436194371943819439194401944119442194431944419445194461944719448194491945019451194521945319454194551945619457194581945919460194611946219463194641946519466194671946819469194701947119472194731947419475194761947719478194791948019481194821948319484194851948619487194881948919490194911949219493194941949519496194971949819499195001950119502195031950419505195061950719508195091951019511195121951319514195151951619517195181951919520195211952219523195241952519526195271952819529195301953119532195331953419535195361953719538195391954019541195421954319544195451954619547195481954919550195511955219553195541955519556195571955819559195601956119562195631956419565195661956719568195691957019571195721957319574195751957619577195781957919580195811958219583195841958519586195871958819589195901959119592195931959419595195961959719598195991960019601196021960319604196051960619607196081960919610196111961219613196141961519616196171961819619196201962119622196231962419625196261962719628196291963019631196321963319634196351963619637196381963919640196411964219643196441964519646196471964819649196501965119652196531965419655196561965719658196591966019661196621966319664196651966619667196681966919670196711967219673196741967519676196771967819679196801968119682196831968419685196861968719688196891969019691196921969319694196951969619697196981969919700197011970219703197041970519706197071970819709197101971119712197131971419715197161971719718197191972019721197221972319724197251972619727197281972919730197311973219733197341973519736197371973819739197401974119742197431974419745197461974719748197491975019751197521975319754197551975619757197581975919760197611976219763197641976519766197671976819769197701977119772197731977419775197761977719778197791978019781197821978319784197851978619787197881978919790197911979219793197941979519796197971979819799198001980119802198031980419805198061980719808198091981019811198121981319814198151981619817198181981919820198211982219823198241982519826198271982819829198301983119832198331983419835198361983719838198391984019841198421984319844198451984619847198481984919850198511985219853198541985519856198571985819859198601986119862198631986419865198661986719868198691987019871198721987319874198751987619877198781987919880198811988219883198841988519886198871988819889198901989119892198931989419895198961989719898198991990019901199021990319904199051990619907199081990919910199111991219913199141991519916199171991819919199201992119922199231992419925199261992719928199291993019931199321993319934199351993619937199381993919940199411994219943199441994519946199471994819949199501995119952199531995419955199561995719958199591996019961199621996319964199651996619967199681996919970199711997219973199741997519976199771997819979199801998119982199831998419985199861998719988199891999019991199921999319994199951999619997199981999920000200012000220003200042000520006200072000820009200102001120012200132001420015200162001720018200192002020021200222002320024200252002620027200282002920030200312003220033200342003520036200372003820039200402004120042200432004420045200462004720048200492005020051200522005320054200552005620057200582005920060200612006220063200642006520066200672006820069200702007120072200732007420075200762007720078200792008020081200822008320084200852008620087200882008920090200912009220093200942009520096200972009820099201002010120102201032010420105201062010720108201092011020111201122011320114201152011620117201182011920120201212012220123201242012520126201272012820129201302013120132201332013420135201362013720138201392014020141201422014320144201452014620147201482014920150201512015220153201542015520156201572015820159201602016120162201632016420165201662016720168201692017020171201722017320174201752017620177201782017920180201812018220183201842018520186201872018820189201902019120192201932019420195201962019720198201992020020201202022020320204202052020620207202082020920210202112021220213202142021520216202172021820219202202022120222202232022420225202262022720228202292023020231202322023320234202352023620237202382023920240202412024220243202442024520246202472024820249202502025120252202532025420255202562025720258202592026020261202622026320264202652026620267202682026920270202712027220273202742027520276202772027820279202802028120282202832028420285202862028720288202892029020291202922029320294202952029620297202982029920300203012030220303203042030520306203072030820309203102031120312203132031420315203162031720318203192032020321203222032320324203252032620327203282032920330203312033220333203342033520336203372033820339203402034120342203432034420345203462034720348203492035020351203522035320354203552035620357203582035920360203612036220363203642036520366203672036820369203702037120372203732037420375203762037720378203792038020381203822038320384203852038620387203882038920390203912039220393203942039520396203972039820399204002040120402204032040420405204062040720408204092041020411204122041320414204152041620417204182041920420204212042220423204242042520426204272042820429204302043120432204332043420435204362043720438204392044020441204422044320444204452044620447204482044920450204512045220453204542045520456204572045820459204602046120462204632046420465204662046720468204692047020471204722047320474204752047620477204782047920480204812048220483204842048520486204872048820489204902049120492204932049420495204962049720498204992050020501205022050320504205052050620507205082050920510205112051220513205142051520516205172051820519205202052120522205232052420525205262052720528205292053020531205322053320534205352053620537205382053920540205412054220543205442054520546205472054820549205502055120552205532055420555205562055720558205592056020561205622056320564205652056620567205682056920570205712057220573205742057520576205772057820579205802058120582205832058420585205862058720588205892059020591205922059320594205952059620597205982059920600206012060220603206042060520606206072060820609206102061120612206132061420615206162061720618206192062020621206222062320624206252062620627206282062920630206312063220633206342063520636206372063820639206402064120642206432064420645206462064720648206492065020651206522065320654206552065620657206582065920660206612066220663206642066520666206672066820669206702067120672206732067420675206762067720678206792068020681206822068320684206852068620687206882068920690206912069220693206942069520696206972069820699207002070120702207032070420705207062070720708207092071020711207122071320714207152071620717207182071920720207212072220723207242072520726207272072820729207302073120732207332073420735207362073720738207392074020741207422074320744207452074620747207482074920750207512075220753207542075520756207572075820759207602076120762207632076420765207662076720768207692077020771207722077320774207752077620777207782077920780207812078220783207842078520786207872078820789207902079120792207932079420795207962079720798207992080020801208022080320804208052080620807208082080920810208112081220813208142081520816208172081820819208202082120822208232082420825208262082720828208292083020831208322083320834208352083620837208382083920840208412084220843208442084520846208472084820849208502085120852208532085420855208562085720858208592086020861208622086320864208652086620867208682086920870208712087220873208742087520876208772087820879208802088120882208832088420885208862088720888208892089020891208922089320894208952089620897208982089920900209012090220903209042090520906209072090820909209102091120912209132091420915209162091720918209192092020921209222092320924209252092620927209282092920930209312093220933209342093520936209372093820939209402094120942209432094420945209462094720948209492095020951209522095320954209552095620957209582095920960209612096220963209642096520966209672096820969209702097120972209732097420975209762097720978209792098020981209822098320984209852098620987209882098920990209912099220993209942099520996209972099820999210002100121002210032100421005210062100721008210092101021011210122101321014210152101621017210182101921020210212102221023210242102521026210272102821029210302103121032210332103421035210362103721038210392104021041210422104321044210452104621047210482104921050210512105221053210542105521056210572105821059210602106121062210632106421065210662106721068210692107021071210722107321074210752107621077210782107921080210812108221083210842108521086210872108821089210902109121092210932109421095210962109721098210992110021101211022110321104211052110621107211082110921110211112111221113211142111521116211172111821119211202112121122211232112421125211262112721128211292113021131211322113321134211352113621137211382113921140211412114221143211442114521146211472114821149211502115121152211532115421155211562115721158211592116021161211622116321164211652116621167211682116921170211712117221173211742117521176211772117821179211802118121182211832118421185211862118721188211892119021191211922119321194211952119621197211982119921200212012120221203212042120521206212072120821209212102121121212212132121421215212162121721218212192122021221212222122321224212252122621227212282122921230212312123221233212342123521236212372123821239212402124121242212432124421245212462124721248212492125021251212522125321254212552125621257212582125921260212612126221263212642126521266212672126821269212702127121272212732127421275212762127721278212792128021281212822128321284212852128621287212882128921290212912129221293212942129521296212972129821299213002130121302213032130421305213062130721308213092131021311213122131321314213152131621317213182131921320213212132221323213242132521326213272132821329213302133121332213332133421335213362133721338213392134021341213422134321344213452134621347213482134921350213512135221353213542135521356213572135821359213602136121362213632136421365213662136721368213692137021371213722137321374213752137621377213782137921380213812138221383213842138521386213872138821389213902139121392213932139421395213962139721398213992140021401214022140321404214052140621407214082140921410214112141221413214142141521416214172141821419214202142121422214232142421425214262142721428214292143021431214322143321434214352143621437214382143921440214412144221443214442144521446214472144821449214502145121452214532145421455214562145721458214592146021461214622146321464214652146621467214682146921470214712147221473214742147521476214772147821479214802148121482214832148421485214862148721488214892149021491214922149321494214952149621497214982149921500215012150221503215042150521506215072150821509215102151121512215132151421515215162151721518215192152021521215222152321524215252152621527215282152921530215312153221533215342153521536215372153821539215402154121542215432154421545215462154721548215492155021551215522155321554215552155621557215582155921560215612156221563215642156521566215672156821569215702157121572215732157421575215762157721578215792158021581215822158321584215852158621587215882158921590215912159221593215942159521596215972159821599216002160121602216032160421605216062160721608216092161021611216122161321614216152161621617216182161921620216212162221623216242162521626216272162821629216302163121632216332163421635216362163721638216392164021641216422164321644216452164621647216482164921650216512165221653216542165521656216572165821659216602166121662216632166421665216662166721668216692167021671216722167321674216752167621677216782167921680216812168221683216842168521686216872168821689216902169121692216932169421695216962169721698216992170021701217022170321704217052170621707217082170921710217112171221713217142171521716217172171821719217202172121722217232172421725217262172721728217292173021731217322173321734217352173621737217382173921740217412174221743217442174521746217472174821749217502175121752217532175421755217562175721758217592176021761217622176321764217652176621767217682176921770217712177221773217742177521776217772177821779217802178121782217832178421785217862178721788217892179021791217922179321794217952179621797217982179921800218012180221803218042180521806218072180821809218102181121812218132181421815218162181721818218192182021821218222182321824218252182621827218282182921830218312183221833218342183521836218372183821839218402184121842218432184421845218462184721848218492185021851218522185321854218552185621857218582185921860218612186221863218642186521866218672186821869218702187121872218732187421875218762187721878218792188021881218822188321884218852188621887218882188921890218912189221893218942189521896218972189821899219002190121902219032190421905219062190721908219092191021911219122191321914219152191621917219182191921920219212192221923219242192521926219272192821929219302193121932219332193421935219362193721938219392194021941219422194321944219452194621947219482194921950219512195221953219542195521956219572195821959219602196121962219632196421965219662196721968219692197021971219722197321974219752197621977219782197921980219812198221983219842198521986219872198821989219902199121992219932199421995219962199721998219992200022001220022200322004220052200622007220082200922010220112201222013220142201522016220172201822019220202202122022220232202422025220262202722028220292203022031220322203322034220352203622037220382203922040220412204222043220442204522046220472204822049220502205122052220532205422055220562205722058220592206022061220622206322064220652206622067220682206922070220712207222073220742207522076220772207822079220802208122082220832208422085220862208722088220892209022091220922209322094220952209622097220982209922100221012210222103221042210522106221072210822109221102211122112221132211422115221162211722118221192212022121221222212322124221252212622127221282212922130221312213222133221342213522136221372213822139221402214122142221432214422145221462214722148221492215022151221522215322154221552215622157221582215922160221612216222163221642216522166221672216822169221702217122172221732217422175221762217722178221792218022181221822218322184221852218622187221882218922190221912219222193221942219522196221972219822199222002220122202222032220422205222062220722208222092221022211222122221322214222152221622217222182221922220222212222222223222242222522226222272222822229222302223122232222332223422235222362223722238222392224022241222422224322244222452224622247222482224922250222512225222253222542225522256222572225822259222602226122262222632226422265222662226722268222692227022271222722227322274222752227622277222782227922280222812228222283222842228522286222872228822289222902229122292222932229422295222962229722298222992230022301223022230322304223052230622307223082230922310223112231222313223142231522316223172231822319223202232122322223232232422325223262232722328223292233022331223322233322334223352233622337223382233922340223412234222343223442234522346223472234822349223502235122352223532235422355223562235722358223592236022361223622236322364223652236622367223682236922370223712237222373223742237522376223772237822379223802238122382223832238422385223862238722388223892239022391223922239322394223952239622397223982239922400224012240222403224042240522406224072240822409224102241122412224132241422415224162241722418224192242022421224222242322424224252242622427224282242922430224312243222433224342243522436224372243822439224402244122442224432244422445224462244722448224492245022451224522245322454224552245622457224582245922460224612246222463224642246522466224672246822469224702247122472224732247422475224762247722478224792248022481224822248322484224852248622487224882248922490224912249222493224942249522496224972249822499225002250122502225032250422505225062250722508225092251022511225122251322514225152251622517225182251922520225212252222523225242252522526225272252822529225302253122532225332253422535225362253722538225392254022541225422254322544225452254622547225482254922550225512255222553225542255522556225572255822559225602256122562225632256422565225662256722568225692257022571225722257322574225752257622577225782257922580225812258222583225842258522586225872258822589225902259122592225932259422595225962259722598225992260022601226022260322604226052260622607226082260922610226112261222613226142261522616226172261822619226202262122622226232262422625226262262722628226292263022631226322263322634226352263622637226382263922640226412264222643226442264522646226472264822649226502265122652226532265422655226562265722658226592266022661226622266322664226652266622667226682266922670226712267222673226742267522676226772267822679226802268122682226832268422685226862268722688226892269022691226922269322694226952269622697226982269922700227012270222703227042270522706227072270822709227102271122712227132271422715227162271722718227192272022721227222272322724227252272622727227282272922730227312273222733227342273522736227372273822739227402274122742227432274422745227462274722748227492275022751227522275322754227552275622757227582275922760227612276222763227642276522766227672276822769227702277122772227732277422775227762277722778227792278022781227822278322784227852278622787227882278922790227912279222793227942279522796227972279822799228002280122802228032280422805228062280722808228092281022811228122281322814228152281622817228182281922820228212282222823228242282522826228272282822829228302283122832228332283422835228362283722838228392284022841228422284322844228452284622847228482284922850228512285222853228542285522856228572285822859228602286122862228632286422865228662286722868228692287022871228722287322874228752287622877228782287922880228812288222883228842288522886228872288822889228902289122892228932289422895228962289722898228992290022901229022290322904229052290622907229082290922910229112291222913229142291522916229172291822919229202292122922229232292422925229262292722928229292293022931229322293322934229352293622937229382293922940229412294222943229442294522946229472294822949229502295122952229532295422955229562295722958229592296022961229622296322964229652296622967229682296922970229712297222973229742297522976229772297822979229802298122982229832298422985229862298722988229892299022991229922299322994229952299622997229982299923000230012300223003230042300523006230072300823009230102301123012230132301423015230162301723018230192302023021230222302323024230252302623027230282302923030230312303223033230342303523036230372303823039230402304123042230432304423045230462304723048230492305023051230522305323054230552305623057230582305923060230612306223063230642306523066230672306823069230702307123072230732307423075230762307723078230792308023081230822308323084230852308623087230882308923090230912309223093230942309523096230972309823099231002310123102231032310423105231062310723108231092311023111231122311323114231152311623117231182311923120231212312223123231242312523126231272312823129231302313123132231332313423135231362313723138231392314023141231422314323144231452314623147231482314923150231512315223153231542315523156231572315823159231602316123162231632316423165231662316723168231692317023171231722317323174231752317623177231782317923180231812318223183231842318523186231872318823189231902319123192231932319423195231962319723198231992320023201232022320323204232052320623207232082320923210232112321223213232142321523216232172321823219232202322123222232232322423225232262322723228232292323023231232322323323234232352323623237232382323923240232412324223243232442324523246232472324823249232502325123252232532325423255232562325723258232592326023261232622326323264232652326623267232682326923270232712327223273232742327523276232772327823279232802328123282232832328423285232862328723288232892329023291232922329323294232952329623297232982329923300233012330223303233042330523306233072330823309233102331123312233132331423315233162331723318233192332023321233222332323324233252332623327233282332923330233312333223333233342333523336233372333823339233402334123342233432334423345233462334723348233492335023351233522335323354233552335623357233582335923360233612336223363233642336523366233672336823369233702337123372233732337423375233762337723378233792338023381233822338323384233852338623387233882338923390233912339223393233942339523396233972339823399234002340123402234032340423405234062340723408234092341023411234122341323414234152341623417234182341923420234212342223423234242342523426234272342823429234302343123432234332343423435234362343723438234392344023441234422344323444234452344623447234482344923450234512345223453234542345523456234572345823459234602346123462234632346423465234662346723468234692347023471234722347323474234752347623477234782347923480234812348223483234842348523486234872348823489234902349123492234932349423495234962349723498234992350023501235022350323504235052350623507235082350923510235112351223513235142351523516235172351823519235202352123522235232352423525235262352723528235292353023531235322353323534235352353623537235382353923540235412354223543235442354523546235472354823549235502355123552235532355423555235562355723558235592356023561235622356323564235652356623567235682356923570235712357223573235742357523576235772357823579235802358123582235832358423585235862358723588235892359023591235922359323594235952359623597235982359923600236012360223603236042360523606236072360823609236102361123612236132361423615236162361723618236192362023621236222362323624236252362623627236282362923630236312363223633236342363523636236372363823639236402364123642236432364423645236462364723648236492365023651236522365323654236552365623657236582365923660236612366223663236642366523666236672366823669236702367123672236732367423675236762367723678236792368023681236822368323684236852368623687236882368923690236912369223693236942369523696236972369823699237002370123702237032370423705237062370723708237092371023711237122371323714237152371623717237182371923720237212372223723237242372523726237272372823729237302373123732237332373423735237362373723738237392374023741237422374323744237452374623747237482374923750237512375223753237542375523756237572375823759237602376123762237632376423765237662376723768237692377023771237722377323774237752377623777237782377923780237812378223783237842378523786237872378823789237902379123792237932379423795237962379723798237992380023801238022380323804238052380623807238082380923810238112381223813238142381523816238172381823819238202382123822238232382423825238262382723828238292383023831238322383323834238352383623837238382383923840238412384223843238442384523846238472384823849238502385123852238532385423855238562385723858238592386023861238622386323864238652386623867238682386923870238712387223873238742387523876238772387823879238802388123882238832388423885238862388723888238892389023891238922389323894238952389623897238982389923900239012390223903239042390523906239072390823909239102391123912239132391423915239162391723918239192392023921239222392323924239252392623927239282392923930239312393223933239342393523936239372393823939239402394123942239432394423945239462394723948239492395023951239522395323954239552395623957239582395923960239612396223963239642396523966239672396823969239702397123972239732397423975239762397723978239792398023981239822398323984239852398623987239882398923990239912399223993239942399523996239972399823999240002400124002240032400424005240062400724008240092401024011240122401324014240152401624017240182401924020240212402224023240242402524026240272402824029240302403124032240332403424035240362403724038240392404024041240422404324044240452404624047240482404924050240512405224053240542405524056240572405824059240602406124062240632406424065240662406724068240692407024071240722407324074240752407624077240782407924080240812408224083240842408524086240872408824089240902409124092240932409424095240962409724098240992410024101241022410324104241052410624107241082410924110241112411224113241142411524116241172411824119241202412124122241232412424125241262412724128241292413024131241322413324134241352413624137241382413924140241412414224143241442414524146241472414824149241502415124152241532415424155241562415724158241592416024161241622416324164241652416624167241682416924170241712417224173241742417524176241772417824179241802418124182241832418424185241862418724188241892419024191241922419324194241952419624197241982419924200242012420224203242042420524206242072420824209242102421124212242132421424215242162421724218242192422024221242222422324224242252422624227242282422924230242312423224233242342423524236242372423824239242402424124242242432424424245242462424724248242492425024251242522425324254242552425624257242582425924260242612426224263242642426524266242672426824269242702427124272242732427424275242762427724278242792428024281242822428324284242852428624287242882428924290242912429224293242942429524296242972429824299243002430124302243032430424305243062430724308243092431024311243122431324314243152431624317243182431924320243212432224323243242432524326243272432824329243302433124332243332433424335243362433724338243392434024341243422434324344243452434624347243482434924350243512435224353243542435524356243572435824359243602436124362243632436424365243662436724368243692437024371243722437324374243752437624377243782437924380243812438224383243842438524386243872438824389243902439124392243932439424395243962439724398243992440024401244022440324404244052440624407244082440924410244112441224413244142441524416244172441824419244202442124422244232442424425244262442724428244292443024431244322443324434244352443624437244382443924440244412444224443244442444524446244472444824449244502445124452244532445424455244562445724458244592446024461244622446324464244652446624467244682446924470244712447224473244742447524476244772447824479244802448124482244832448424485244862448724488244892449024491244922449324494244952449624497244982449924500245012450224503245042450524506245072450824509245102451124512245132451424515245162451724518245192452024521245222452324524245252452624527245282452924530245312453224533245342453524536245372453824539245402454124542245432454424545245462454724548245492455024551245522455324554245552455624557245582455924560245612456224563245642456524566245672456824569245702457124572245732457424575245762457724578245792458024581245822458324584245852458624587245882458924590245912459224593245942459524596245972459824599246002460124602246032460424605246062460724608246092461024611246122461324614246152461624617246182461924620246212462224623246242462524626246272462824629246302463124632246332463424635246362463724638246392464024641246422464324644246452464624647246482464924650246512465224653246542465524656246572465824659246602466124662246632466424665246662466724668246692467024671246722467324674246752467624677246782467924680246812468224683246842468524686246872468824689246902469124692246932469424695246962469724698246992470024701247022470324704247052470624707247082470924710247112471224713247142471524716247172471824719247202472124722247232472424725247262472724728247292473024731247322473324734247352473624737247382473924740247412474224743247442474524746247472474824749247502475124752247532475424755247562475724758247592476024761247622476324764247652476624767247682476924770247712477224773247742477524776247772477824779247802478124782247832478424785247862478724788247892479024791247922479324794247952479624797247982479924800248012480224803248042480524806248072480824809248102481124812248132481424815248162481724818248192482024821248222482324824248252482624827248282482924830248312483224833248342483524836248372483824839248402484124842248432484424845248462484724848248492485024851248522485324854248552485624857248582485924860248612486224863248642486524866248672486824869248702487124872248732487424875248762487724878248792488024881248822488324884248852488624887248882488924890248912489224893248942489524896248972489824899249002490124902249032490424905249062490724908249092491024911249122491324914249152491624917249182491924920249212492224923249242492524926249272492824929249302493124932249332493424935249362493724938249392494024941249422494324944249452494624947249482494924950249512495224953249542495524956249572495824959249602496124962249632496424965249662496724968249692497024971249722497324974249752497624977249782497924980249812498224983249842498524986249872498824989249902499124992249932499424995249962499724998249992500025001250022500325004250052500625007250082500925010250112501225013250142501525016250172501825019250202502125022250232502425025250262502725028250292503025031250322503325034250352503625037250382503925040250412504225043250442504525046250472504825049250502505125052250532505425055250562505725058250592506025061250622506325064250652506625067250682506925070250712507225073250742507525076250772507825079250802508125082250832508425085250862508725088250892509025091250922509325094250952509625097250982509925100251012510225103251042510525106251072510825109251102511125112251132511425115251162511725118251192512025121251222512325124251252512625127251282512925130251312513225133251342513525136251372513825139251402514125142251432514425145251462514725148251492515025151251522515325154251552515625157251582515925160251612516225163251642516525166251672516825169251702517125172251732517425175251762517725178251792518025181251822518325184251852518625187251882518925190251912519225193251942519525196251972519825199252002520125202252032520425205252062520725208252092521025211252122521325214252152521625217252182521925220252212522225223252242522525226252272522825229252302523125232252332523425235252362523725238252392524025241252422524325244252452524625247252482524925250252512525225253252542525525256252572525825259252602526125262252632526425265252662526725268252692527025271252722527325274252752527625277252782527925280252812528225283252842528525286252872528825289252902529125292252932529425295252962529725298252992530025301253022530325304253052530625307253082530925310253112531225313253142531525316253172531825319253202532125322253232532425325253262532725328253292533025331253322533325334253352533625337253382533925340253412534225343253442534525346253472534825349253502535125352253532535425355253562535725358253592536025361253622536325364253652536625367253682536925370253712537225373253742537525376253772537825379253802538125382253832538425385253862538725388253892539025391253922539325394253952539625397253982539925400254012540225403254042540525406254072540825409254102541125412254132541425415254162541725418254192542025421254222542325424254252542625427254282542925430254312543225433254342543525436254372543825439254402544125442254432544425445254462544725448254492545025451254522545325454254552545625457254582545925460254612546225463254642546525466254672546825469254702547125472254732547425475254762547725478254792548025481254822548325484254852548625487254882548925490254912549225493254942549525496254972549825499255002550125502255032550425505255062550725508255092551025511255122551325514255152551625517255182551925520255212552225523255242552525526255272552825529255302553125532255332553425535255362553725538255392554025541255422554325544255452554625547255482554925550255512555225553255542555525556255572555825559255602556125562255632556425565255662556725568255692557025571255722557325574255752557625577255782557925580255812558225583255842558525586255872558825589255902559125592255932559425595255962559725598255992560025601256022560325604256052560625607256082560925610256112561225613256142561525616256172561825619256202562125622256232562425625256262562725628256292563025631256322563325634256352563625637256382563925640256412564225643256442564525646256472564825649256502565125652256532565425655256562565725658256592566025661256622566325664256652566625667256682566925670256712567225673256742567525676256772567825679256802568125682256832568425685256862568725688256892569025691256922569325694256952569625697256982569925700257012570225703257042570525706257072570825709257102571125712257132571425715257162571725718257192572025721257222572325724257252572625727257282572925730257312573225733257342573525736257372573825739257402574125742257432574425745257462574725748257492575025751257522575325754257552575625757257582575925760257612576225763257642576525766257672576825769257702577125772257732577425775257762577725778257792578025781257822578325784257852578625787257882578925790257912579225793257942579525796257972579825799258002580125802258032580425805258062580725808258092581025811258122581325814258152581625817258182581925820258212582225823258242582525826258272582825829258302583125832258332583425835258362583725838258392584025841258422584325844258452584625847258482584925850258512585225853258542585525856258572585825859258602586125862258632586425865258662586725868258692587025871258722587325874258752587625877258782587925880258812588225883258842588525886258872588825889258902589125892258932589425895258962589725898258992590025901259022590325904259052590625907259082590925910259112591225913259142591525916259172591825919259202592125922259232592425925259262592725928259292593025931259322593325934259352593625937259382593925940259412594225943259442594525946259472594825949259502595125952259532595425955259562595725958259592596025961259622596325964259652596625967259682596925970259712597225973259742597525976259772597825979259802598125982259832598425985259862598725988259892599025991259922599325994259952599625997259982599926000260012600226003260042600526006260072600826009260102601126012260132601426015260162601726018260192602026021260222602326024260252602626027260282602926030260312603226033260342603526036260372603826039260402604126042260432604426045260462604726048260492605026051260522605326054260552605626057260582605926060260612606226063260642606526066260672606826069260702607126072260732607426075260762607726078260792608026081260822608326084260852608626087260882608926090260912609226093260942609526096260972609826099261002610126102261032610426105261062610726108261092611026111261122611326114261152611626117261182611926120261212612226123261242612526126261272612826129261302613126132261332613426135261362613726138261392614026141261422614326144261452614626147261482614926150261512615226153261542615526156261572615826159261602616126162261632616426165261662616726168261692617026171261722617326174261752617626177261782617926180261812618226183261842618526186261872618826189261902619126192261932619426195261962619726198261992620026201262022620326204262052620626207262082620926210262112621226213262142621526216262172621826219262202622126222262232622426225262262622726228262292623026231262322623326234262352623626237262382623926240262412624226243262442624526246262472624826249262502625126252262532625426255262562625726258262592626026261262622626326264262652626626267262682626926270262712627226273262742627526276262772627826279262802628126282262832628426285262862628726288262892629026291262922629326294262952629626297262982629926300263012630226303263042630526306263072630826309263102631126312263132631426315263162631726318263192632026321263222632326324263252632626327263282632926330263312633226333263342633526336263372633826339263402634126342263432634426345263462634726348263492635026351263522635326354263552635626357263582635926360263612636226363263642636526366263672636826369263702637126372263732637426375263762637726378263792638026381263822638326384263852638626387263882638926390263912639226393263942639526396263972639826399264002640126402264032640426405264062640726408264092641026411264122641326414264152641626417264182641926420264212642226423264242642526426264272642826429264302643126432264332643426435264362643726438264392644026441264422644326444264452644626447264482644926450264512645226453264542645526456264572645826459264602646126462264632646426465264662646726468264692647026471264722647326474264752647626477264782647926480264812648226483264842648526486264872648826489264902649126492264932649426495264962649726498264992650026501265022650326504265052650626507265082650926510265112651226513265142651526516265172651826519265202652126522265232652426525265262652726528265292653026531265322653326534265352653626537265382653926540265412654226543265442654526546265472654826549265502655126552265532655426555265562655726558265592656026561265622656326564265652656626567265682656926570265712657226573265742657526576265772657826579265802658126582265832658426585265862658726588265892659026591265922659326594265952659626597265982659926600266012660226603266042660526606266072660826609266102661126612266132661426615266162661726618266192662026621266222662326624266252662626627266282662926630266312663226633266342663526636266372663826639266402664126642266432664426645266462664726648266492665026651266522665326654266552665626657266582665926660266612666226663266642666526666266672666826669266702667126672266732667426675266762667726678266792668026681266822668326684266852668626687266882668926690266912669226693266942669526696266972669826699267002670126702267032670426705267062670726708267092671026711267122671326714267152671626717267182671926720267212672226723267242672526726267272672826729267302673126732267332673426735267362673726738267392674026741267422674326744267452674626747267482674926750267512675226753267542675526756267572675826759267602676126762267632676426765267662676726768267692677026771267722677326774267752677626777267782677926780267812678226783267842678526786267872678826789267902679126792267932679426795267962679726798267992680026801268022680326804268052680626807268082680926810268112681226813268142681526816268172681826819268202682126822268232682426825268262682726828268292683026831268322683326834268352683626837268382683926840268412684226843268442684526846268472684826849268502685126852268532685426855268562685726858268592686026861268622686326864268652686626867268682686926870268712687226873268742687526876268772687826879268802688126882268832688426885268862688726888268892689026891268922689326894268952689626897268982689926900269012690226903269042690526906269072690826909269102691126912269132691426915269162691726918269192692026921269222692326924269252692626927269282692926930269312693226933269342693526936269372693826939269402694126942269432694426945269462694726948269492695026951269522695326954269552695626957269582695926960269612696226963269642696526966269672696826969269702697126972269732697426975269762697726978269792698026981269822698326984269852698626987269882698926990269912699226993269942699526996269972699826999270002700127002270032700427005270062700727008270092701027011270122701327014270152701627017270182701927020270212702227023270242702527026270272702827029270302703127032270332703427035270362703727038270392704027041270422704327044270452704627047270482704927050270512705227053270542705527056270572705827059270602706127062270632706427065270662706727068270692707027071270722707327074270752707627077270782707927080270812708227083270842708527086270872708827089270902709127092270932709427095270962709727098270992710027101271022710327104271052710627107271082710927110271112711227113271142711527116271172711827119271202712127122271232712427125271262712727128271292713027131271322713327134271352713627137271382713927140271412714227143271442714527146271472714827149271502715127152271532715427155271562715727158271592716027161271622716327164271652716627167271682716927170271712717227173271742717527176271772717827179271802718127182271832718427185271862718727188271892719027191271922719327194271952719627197271982719927200272012720227203272042720527206272072720827209272102721127212272132721427215272162721727218272192722027221272222722327224272252722627227272282722927230272312723227233272342723527236272372723827239272402724127242272432724427245272462724727248272492725027251272522725327254272552725627257272582725927260272612726227263272642726527266272672726827269272702727127272272732727427275272762727727278272792728027281272822728327284272852728627287272882728927290272912729227293272942729527296272972729827299273002730127302273032730427305273062730727308273092731027311273122731327314273152731627317273182731927320273212732227323273242732527326273272732827329273302733127332273332733427335273362733727338273392734027341273422734327344273452734627347273482734927350273512735227353273542735527356273572735827359273602736127362273632736427365273662736727368273692737027371273722737327374273752737627377273782737927380273812738227383273842738527386273872738827389273902739127392273932739427395273962739727398273992740027401274022740327404274052740627407274082740927410274112741227413274142741527416274172741827419274202742127422274232742427425274262742727428274292743027431274322743327434274352743627437274382743927440274412744227443274442744527446274472744827449274502745127452274532745427455274562745727458274592746027461274622746327464274652746627467274682746927470274712747227473274742747527476274772747827479274802748127482274832748427485274862748727488274892749027491274922749327494274952749627497274982749927500275012750227503275042750527506275072750827509275102751127512275132751427515275162751727518275192752027521275222752327524275252752627527275282752927530275312753227533275342753527536275372753827539275402754127542275432754427545275462754727548275492755027551275522755327554275552755627557275582755927560275612756227563275642756527566275672756827569275702757127572275732757427575275762757727578275792758027581275822758327584275852758627587275882758927590275912759227593275942759527596275972759827599276002760127602276032760427605276062760727608276092761027611276122761327614276152761627617276182761927620276212762227623276242762527626276272762827629276302763127632276332763427635276362763727638276392764027641276422764327644276452764627647276482764927650276512765227653276542765527656276572765827659276602766127662276632766427665276662766727668276692767027671276722767327674276752767627677276782767927680276812768227683276842768527686276872768827689276902769127692276932769427695276962769727698276992770027701277022770327704277052770627707277082770927710277112771227713277142771527716277172771827719277202772127722277232772427725277262772727728277292773027731277322773327734277352773627737277382773927740277412774227743277442774527746277472774827749277502775127752277532775427755277562775727758277592776027761277622776327764277652776627767277682776927770277712777227773277742777527776277772777827779277802778127782277832778427785277862778727788277892779027791277922779327794277952779627797277982779927800278012780227803278042780527806278072780827809278102781127812278132781427815278162781727818278192782027821278222782327824278252782627827278282782927830278312783227833278342783527836278372783827839278402784127842278432784427845278462784727848278492785027851278522785327854278552785627857278582785927860278612786227863278642786527866278672786827869278702787127872278732787427875278762787727878278792788027881278822788327884278852788627887278882788927890278912789227893278942789527896278972789827899279002790127902279032790427905279062790727908279092791027911279122791327914279152791627917279182791927920279212792227923279242792527926279272792827929279302793127932279332793427935279362793727938279392794027941279422794327944279452794627947279482794927950279512795227953279542795527956279572795827959279602796127962279632796427965279662796727968279692797027971279722797327974279752797627977279782797927980279812798227983279842798527986279872798827989279902799127992279932799427995279962799727998279992800028001280022800328004280052800628007280082800928010280112801228013280142801528016280172801828019280202802128022280232802428025280262802728028280292803028031280322803328034280352803628037280382803928040280412804228043280442804528046280472804828049280502805128052280532805428055280562805728058280592806028061280622806328064280652806628067280682806928070280712807228073280742807528076280772807828079280802808128082280832808428085280862808728088280892809028091280922809328094280952809628097280982809928100281012810228103281042810528106281072810828109281102811128112281132811428115281162811728118281192812028121281222812328124281252812628127281282812928130281312813228133281342813528136281372813828139281402814128142281432814428145281462814728148281492815028151281522815328154281552815628157281582815928160281612816228163281642816528166281672816828169281702817128172281732817428175281762817728178281792818028181281822818328184281852818628187281882818928190281912819228193281942819528196281972819828199282002820128202282032820428205282062820728208282092821028211282122821328214282152821628217282182821928220282212822228223282242822528226282272822828229282302823128232282332823428235282362823728238282392824028241282422824328244282452824628247282482824928250282512825228253282542825528256282572825828259282602826128262282632826428265282662826728268282692827028271282722827328274282752827628277282782827928280282812828228283282842828528286282872828828289282902829128292282932829428295282962829728298282992830028301283022830328304283052830628307283082830928310283112831228313283142831528316283172831828319283202832128322283232832428325283262832728328283292833028331283322833328334283352833628337283382833928340283412834228343283442834528346283472834828349283502835128352283532835428355283562835728358283592836028361283622836328364283652836628367283682836928370283712837228373283742837528376283772837828379283802838128382283832838428385283862838728388283892839028391283922839328394283952839628397283982839928400284012840228403284042840528406284072840828409284102841128412284132841428415284162841728418284192842028421284222842328424284252842628427284282842928430284312843228433284342843528436284372843828439284402844128442284432844428445284462844728448284492845028451284522845328454284552845628457284582845928460284612846228463284642846528466284672846828469284702847128472284732847428475284762847728478284792848028481284822848328484284852848628487284882848928490284912849228493284942849528496284972849828499285002850128502285032850428505285062850728508285092851028511285122851328514285152851628517285182851928520285212852228523285242852528526285272852828529285302853128532285332853428535285362853728538285392854028541285422854328544285452854628547285482854928550285512855228553285542855528556285572855828559285602856128562285632856428565285662856728568285692857028571285722857328574285752857628577285782857928580285812858228583285842858528586285872858828589285902859128592285932859428595285962859728598285992860028601286022860328604286052860628607286082860928610286112861228613286142861528616286172861828619286202862128622286232862428625286262862728628286292863028631286322863328634286352863628637286382863928640286412864228643286442864528646286472864828649286502865128652286532865428655286562865728658286592866028661286622866328664286652866628667286682866928670286712867228673286742867528676286772867828679286802868128682286832868428685286862868728688286892869028691286922869328694286952869628697286982869928700287012870228703287042870528706287072870828709287102871128712287132871428715287162871728718287192872028721287222872328724287252872628727287282872928730287312873228733287342873528736287372873828739287402874128742287432874428745287462874728748287492875028751287522875328754287552875628757287582875928760287612876228763287642876528766287672876828769287702877128772287732877428775287762877728778287792878028781287822878328784287852878628787287882878928790287912879228793287942879528796287972879828799288002880128802288032880428805288062880728808288092881028811288122881328814288152881628817288182881928820288212882228823288242882528826288272882828829288302883128832288332883428835288362883728838288392884028841288422884328844288452884628847288482884928850288512885228853288542885528856288572885828859288602886128862288632886428865288662886728868288692887028871288722887328874288752887628877288782887928880288812888228883288842888528886288872888828889288902889128892288932889428895288962889728898288992890028901289022890328904289052890628907289082890928910289112891228913289142891528916289172891828919289202892128922289232892428925289262892728928289292893028931289322893328934289352893628937289382893928940289412894228943289442894528946289472894828949289502895128952289532895428955289562895728958289592896028961289622896328964289652896628967289682896928970289712897228973289742897528976289772897828979289802898128982289832898428985289862898728988289892899028991289922899328994289952899628997289982899929000290012900229003290042900529006290072900829009290102901129012290132901429015290162901729018290192902029021290222902329024290252902629027290282902929030290312903229033290342903529036290372903829039290402904129042290432904429045290462904729048290492905029051290522905329054290552905629057290582905929060290612906229063290642906529066290672906829069290702907129072290732907429075290762907729078290792908029081290822908329084290852908629087290882908929090290912909229093290942909529096290972909829099291002910129102291032910429105291062910729108291092911029111291122911329114291152911629117291182911929120291212912229123291242912529126291272912829129291302913129132291332913429135291362913729138291392914029141291422914329144291452914629147291482914929150291512915229153291542915529156291572915829159291602916129162291632916429165291662916729168291692917029171291722917329174291752917629177291782917929180291812918229183291842918529186291872918829189291902919129192291932919429195291962919729198291992920029201292022920329204292052920629207292082920929210292112921229213292142921529216292172921829219292202922129222292232922429225292262922729228292292923029231292322923329234292352923629237292382923929240292412924229243292442924529246292472924829249292502925129252292532925429255292562925729258292592926029261292622926329264292652926629267292682926929270292712927229273292742927529276292772927829279292802928129282292832928429285292862928729288292892929029291292922929329294292952929629297292982929929300293012930229303293042930529306293072930829309293102931129312293132931429315293162931729318293192932029321293222932329324293252932629327293282932929330293312933229333293342933529336293372933829339293402934129342293432934429345293462934729348293492935029351293522935329354293552935629357293582935929360293612936229363293642936529366293672936829369293702937129372293732937429375293762937729378293792938029381293822938329384293852938629387293882938929390293912939229393293942939529396293972939829399294002940129402294032940429405294062940729408294092941029411294122941329414294152941629417294182941929420294212942229423294242942529426294272942829429294302943129432294332943429435294362943729438294392944029441294422944329444294452944629447294482944929450294512945229453294542945529456294572945829459294602946129462294632946429465294662946729468294692947029471294722947329474294752947629477294782947929480294812948229483294842948529486294872948829489294902949129492294932949429495294962949729498294992950029501295022950329504295052950629507295082950929510295112951229513295142951529516295172951829519295202952129522295232952429525295262952729528295292953029531295322953329534295352953629537295382953929540295412954229543295442954529546295472954829549295502955129552295532955429555295562955729558295592956029561295622956329564295652956629567295682956929570295712957229573295742957529576295772957829579295802958129582295832958429585295862958729588295892959029591295922959329594295952959629597295982959929600296012960229603296042960529606296072960829609296102961129612296132961429615296162961729618296192962029621296222962329624296252962629627296282962929630296312963229633296342963529636296372963829639296402964129642296432964429645296462964729648296492965029651296522965329654296552965629657296582965929660296612966229663296642966529666296672966829669296702967129672296732967429675296762967729678296792968029681296822968329684296852968629687296882968929690296912969229693296942969529696296972969829699297002970129702297032970429705297062970729708297092971029711297122971329714297152971629717297182971929720297212972229723297242972529726297272972829729297302973129732297332973429735297362973729738297392974029741297422974329744297452974629747297482974929750297512975229753297542975529756297572975829759297602976129762297632976429765297662976729768297692977029771297722977329774297752977629777297782977929780297812978229783297842978529786297872978829789297902979129792297932979429795297962979729798297992980029801298022980329804298052980629807298082980929810298112981229813298142981529816298172981829819298202982129822298232982429825298262982729828298292983029831298322983329834298352983629837298382983929840298412984229843298442984529846298472984829849298502985129852298532985429855298562985729858298592986029861298622986329864298652986629867298682986929870298712987229873298742987529876298772987829879298802988129882298832988429885298862988729888298892989029891298922989329894298952989629897298982989929900299012990229903299042990529906299072990829909299102991129912299132991429915299162991729918299192992029921299222992329924299252992629927299282992929930299312993229933299342993529936299372993829939299402994129942299432994429945299462994729948299492995029951299522995329954299552995629957299582995929960299612996229963299642996529966299672996829969299702997129972299732997429975299762997729978299792998029981299822998329984299852998629987299882998929990299912999229993299942999529996299972999829999300003000130002300033000430005300063000730008300093001030011300123001330014300153001630017300183001930020300213002230023300243002530026300273002830029300303003130032300333003430035300363003730038300393004030041300423004330044300453004630047300483004930050300513005230053300543005530056300573005830059300603006130062300633006430065300663006730068300693007030071300723007330074300753007630077300783007930080300813008230083300843008530086300873008830089300903009130092300933009430095300963009730098300993010030101301023010330104301053010630107301083010930110301113011230113301143011530116301173011830119301203012130122301233012430125301263012730128301293013030131301323013330134301353013630137301383013930140301413014230143301443014530146301473014830149301503015130152301533015430155301563015730158301593016030161301623016330164301653016630167301683016930170301713017230173301743017530176301773017830179301803018130182301833018430185301863018730188301893019030191301923019330194301953019630197301983019930200302013020230203302043020530206302073020830209302103021130212302133021430215302163021730218302193022030221302223022330224302253022630227302283022930230302313023230233302343023530236302373023830239302403024130242302433024430245302463024730248302493025030251302523025330254302553025630257302583025930260302613026230263302643026530266302673026830269302703027130272302733027430275302763027730278302793028030281302823028330284302853028630287302883028930290302913029230293302943029530296302973029830299303003030130302303033030430305303063030730308303093031030311303123031330314303153031630317303183031930320303213032230323303243032530326303273032830329303303033130332303333033430335303363033730338303393034030341303423034330344303453034630347303483034930350303513035230353303543035530356303573035830359303603036130362303633036430365303663036730368303693037030371303723037330374303753037630377303783037930380303813038230383303843038530386303873038830389303903039130392303933039430395303963039730398303993040030401304023040330404304053040630407304083040930410304113041230413304143041530416304173041830419304203042130422304233042430425304263042730428304293043030431304323043330434304353043630437304383043930440304413044230443304443044530446304473044830449304503045130452304533045430455304563045730458304593046030461304623046330464304653046630467304683046930470304713047230473304743047530476304773047830479304803048130482304833048430485304863048730488304893049030491304923049330494304953049630497304983049930500305013050230503305043050530506305073050830509305103051130512305133051430515305163051730518305193052030521305223052330524305253052630527305283052930530305313053230533305343053530536305373053830539305403054130542305433054430545305463054730548305493055030551305523055330554305553055630557305583055930560305613056230563305643056530566305673056830569305703057130572305733057430575305763057730578305793058030581305823058330584305853058630587305883058930590305913059230593305943059530596305973059830599306003060130602306033060430605306063060730608306093061030611306123061330614306153061630617306183061930620306213062230623306243062530626306273062830629306303063130632306333063430635306363063730638306393064030641306423064330644306453064630647306483064930650306513065230653306543065530656306573065830659306603066130662306633066430665306663066730668306693067030671306723067330674306753067630677306783067930680306813068230683306843068530686306873068830689306903069130692306933069430695306963069730698306993070030701307023070330704307053070630707307083070930710307113071230713307143071530716307173071830719307203072130722307233072430725307263072730728307293073030731307323073330734307353073630737307383073930740307413074230743307443074530746307473074830749307503075130752307533075430755307563075730758307593076030761307623076330764307653076630767307683076930770307713077230773307743077530776307773077830779307803078130782307833078430785307863078730788307893079030791307923079330794307953079630797307983079930800308013080230803308043080530806308073080830809308103081130812308133081430815308163081730818308193082030821308223082330824308253082630827308283082930830308313083230833308343083530836308373083830839308403084130842308433084430845308463084730848308493085030851308523085330854308553085630857308583085930860308613086230863308643086530866308673086830869308703087130872308733087430875308763087730878308793088030881308823088330884308853088630887308883088930890308913089230893308943089530896308973089830899309003090130902309033090430905309063090730908309093091030911309123091330914309153091630917309183091930920309213092230923309243092530926309273092830929309303093130932309333093430935309363093730938309393094030941309423094330944309453094630947309483094930950309513095230953309543095530956309573095830959309603096130962309633096430965309663096730968309693097030971309723097330974309753097630977309783097930980309813098230983309843098530986309873098830989309903099130992309933099430995309963099730998309993100031001310023100331004310053100631007310083100931010310113101231013310143101531016310173101831019310203102131022310233102431025310263102731028310293103031031310323103331034310353103631037310383103931040310413104231043310443104531046310473104831049310503105131052310533105431055310563105731058310593106031061310623106331064310653106631067310683106931070310713107231073310743107531076310773107831079310803108131082310833108431085310863108731088310893109031091310923109331094310953109631097310983109931100311013110231103311043110531106311073110831109311103111131112311133111431115311163111731118311193112031121311223112331124311253112631127311283112931130311313113231133311343113531136311373113831139311403114131142311433114431145311463114731148311493115031151311523115331154311553115631157311583115931160311613116231163311643116531166311673116831169311703117131172311733117431175311763117731178311793118031181311823118331184311853118631187311883118931190311913119231193311943119531196311973119831199312003120131202312033120431205312063120731208312093121031211312123121331214312153121631217312183121931220312213122231223312243122531226312273122831229312303123131232312333123431235312363123731238312393124031241312423124331244312453124631247312483124931250312513125231253312543125531256312573125831259312603126131262312633126431265312663126731268312693127031271312723127331274312753127631277312783127931280312813128231283312843128531286312873128831289312903129131292312933129431295312963129731298312993130031301313023130331304313053130631307313083130931310313113131231313313143131531316313173131831319313203132131322313233132431325313263132731328313293133031331313323133331334313353133631337313383133931340313413134231343313443134531346313473134831349313503135131352313533135431355313563135731358313593136031361313623136331364313653136631367313683136931370313713137231373313743137531376313773137831379313803138131382313833138431385313863138731388313893139031391313923139331394313953139631397313983139931400314013140231403314043140531406314073140831409314103141131412314133141431415314163141731418314193142031421314223142331424314253142631427314283142931430314313143231433314343143531436314373143831439314403144131442314433144431445314463144731448314493145031451314523145331454314553145631457314583145931460314613146231463314643146531466314673146831469314703147131472314733147431475314763147731478314793148031481314823148331484314853148631487314883148931490314913149231493314943149531496314973149831499315003150131502315033150431505315063150731508315093151031511315123151331514315153151631517315183151931520315213152231523315243152531526315273152831529315303153131532315333153431535315363153731538315393154031541315423154331544315453154631547315483154931550315513155231553315543155531556315573155831559315603156131562315633156431565315663156731568315693157031571315723157331574315753157631577315783157931580315813158231583315843158531586315873158831589315903159131592315933159431595315963159731598315993160031601316023160331604316053160631607316083160931610316113161231613316143161531616316173161831619316203162131622316233162431625316263162731628316293163031631316323163331634316353163631637316383163931640316413164231643316443164531646316473164831649316503165131652316533165431655316563165731658316593166031661316623166331664316653166631667316683166931670316713167231673316743167531676316773167831679316803168131682316833168431685316863168731688316893169031691316923169331694316953169631697316983169931700317013170231703317043170531706317073170831709317103171131712317133171431715317163171731718317193172031721317223172331724317253172631727317283172931730317313173231733317343173531736317373173831739317403174131742317433174431745317463174731748317493175031751317523175331754317553175631757317583175931760317613176231763317643176531766317673176831769317703177131772317733177431775317763177731778317793178031781317823178331784317853178631787317883178931790317913179231793317943179531796317973179831799318003180131802318033180431805318063180731808318093181031811318123181331814318153181631817318183181931820318213182231823318243182531826318273182831829318303183131832318333183431835318363183731838318393184031841318423184331844318453184631847318483184931850318513185231853318543185531856318573185831859318603186131862318633186431865318663186731868318693187031871318723187331874318753187631877318783187931880318813188231883318843188531886318873188831889318903189131892318933189431895318963189731898318993190031901319023190331904319053190631907319083190931910319113191231913319143191531916319173191831919319203192131922319233192431925319263192731928319293193031931319323193331934319353193631937319383193931940319413194231943319443194531946319473194831949319503195131952319533195431955319563195731958319593196031961319623196331964319653196631967319683196931970319713197231973319743197531976319773197831979319803198131982319833198431985319863198731988319893199031991319923199331994319953199631997319983199932000320013200232003320043200532006320073200832009320103201132012320133201432015320163201732018320193202032021320223202332024320253202632027320283202932030320313203232033320343203532036320373203832039320403204132042320433204432045320463204732048320493205032051320523205332054320553205632057320583205932060320613206232063320643206532066320673206832069320703207132072320733207432075320763207732078320793208032081320823208332084320853208632087320883208932090320913209232093320943209532096320973209832099321003210132102321033210432105321063210732108321093211032111321123211332114321153211632117321183211932120321213212232123321243212532126321273212832129321303213132132321333213432135321363213732138321393214032141321423214332144321453214632147321483214932150321513215232153321543215532156321573215832159321603216132162321633216432165321663216732168321693217032171321723217332174321753217632177321783217932180321813218232183321843218532186321873218832189321903219132192321933219432195321963219732198321993220032201322023220332204322053220632207322083220932210322113221232213322143221532216322173221832219322203222132222322233222432225322263222732228322293223032231322323223332234322353223632237322383223932240322413224232243322443224532246322473224832249322503225132252322533225432255322563225732258322593226032261322623226332264322653226632267322683226932270322713227232273322743227532276322773227832279322803228132282322833228432285322863228732288322893229032291322923229332294322953229632297322983229932300323013230232303323043230532306323073230832309323103231132312323133231432315323163231732318323193232032321323223232332324323253232632327323283232932330323313233232333323343233532336323373233832339323403234132342323433234432345323463234732348323493235032351323523235332354323553235632357323583235932360323613236232363323643236532366323673236832369323703237132372323733237432375323763237732378323793238032381323823238332384323853238632387323883238932390323913239232393323943239532396323973239832399324003240132402324033240432405324063240732408324093241032411324123241332414324153241632417324183241932420324213242232423324243242532426324273242832429324303243132432324333243432435324363243732438324393244032441324423244332444324453244632447324483244932450324513245232453324543245532456324573245832459324603246132462324633246432465324663246732468324693247032471324723247332474324753247632477324783247932480324813248232483324843248532486324873248832489324903249132492324933249432495324963249732498324993250032501325023250332504325053250632507325083250932510325113251232513325143251532516325173251832519325203252132522325233252432525325263252732528325293253032531325323253332534325353253632537325383253932540325413254232543325443254532546325473254832549325503255132552325533255432555325563255732558325593256032561325623256332564325653256632567325683256932570325713257232573325743257532576325773257832579325803258132582325833258432585325863258732588325893259032591325923259332594325953259632597325983259932600326013260232603326043260532606326073260832609326103261132612326133261432615326163261732618326193262032621326223262332624326253262632627326283262932630326313263232633326343263532636326373263832639326403264132642326433264432645326463264732648326493265032651326523265332654326553265632657326583265932660326613266232663326643266532666326673266832669326703267132672326733267432675326763267732678326793268032681326823268332684326853268632687326883268932690326913269232693326943269532696326973269832699327003270132702327033270432705327063270732708327093271032711327123271332714327153271632717327183271932720327213272232723327243272532726327273272832729327303273132732327333273432735327363273732738327393274032741327423274332744327453274632747327483274932750327513275232753327543275532756327573275832759327603276132762327633276432765327663276732768327693277032771327723277332774327753277632777327783277932780327813278232783327843278532786327873278832789327903279132792327933279432795327963279732798327993280032801328023280332804328053280632807328083280932810328113281232813328143281532816328173281832819328203282132822328233282432825328263282732828328293283032831328323283332834328353283632837328383283932840328413284232843328443284532846328473284832849328503285132852328533285432855328563285732858328593286032861328623286332864328653286632867328683286932870328713287232873328743287532876328773287832879328803288132882328833288432885328863288732888328893289032891328923289332894328953289632897328983289932900329013290232903329043290532906329073290832909329103291132912329133291432915329163291732918329193292032921329223292332924329253292632927329283292932930329313293232933329343293532936329373293832939329403294132942329433294432945329463294732948329493295032951329523295332954329553295632957329583295932960329613296232963329643296532966329673296832969329703297132972329733297432975329763297732978329793298032981329823298332984329853298632987329883298932990329913299232993329943299532996329973299832999330003300133002330033300433005330063300733008330093301033011330123301333014330153301633017330183301933020330213302233023330243302533026330273302833029330303303133032330333303433035330363303733038330393304033041330423304333044330453304633047330483304933050330513305233053330543305533056330573305833059330603306133062330633306433065330663306733068330693307033071330723307333074330753307633077330783307933080330813308233083330843308533086330873308833089330903309133092330933309433095330963309733098330993310033101331023310333104331053310633107331083310933110331113311233113331143311533116331173311833119331203312133122331233312433125331263312733128331293313033131331323313333134331353313633137331383313933140331413314233143331443314533146331473314833149331503315133152331533315433155331563315733158331593316033161331623316333164331653316633167331683316933170331713317233173331743317533176331773317833179331803318133182331833318433185331863318733188331893319033191331923319333194331953319633197331983319933200332013320233203332043320533206332073320833209332103321133212332133321433215332163321733218332193322033221332223322333224332253322633227332283322933230332313323233233332343323533236332373323833239332403324133242332433324433245332463324733248332493325033251332523325333254332553325633257332583325933260332613326233263332643326533266332673326833269332703327133272332733327433275332763327733278332793328033281332823328333284332853328633287332883328933290332913329233293332943329533296332973329833299333003330133302333033330433305333063330733308333093331033311333123331333314333153331633317333183331933320333213332233323333243332533326333273332833329333303333133332333333333433335333363333733338333393334033341333423334333344333453334633347333483334933350333513335233353333543335533356333573335833359333603336133362333633336433365333663336733368333693337033371333723337333374333753337633377333783337933380333813338233383333843338533386333873338833389333903339133392333933339433395333963339733398333993340033401334023340333404334053340633407334083340933410334113341233413334143341533416334173341833419334203342133422334233342433425334263342733428334293343033431334323343333434334353343633437334383343933440334413344233443334443344533446334473344833449334503345133452334533345433455334563345733458334593346033461334623346333464334653346633467334683346933470334713347233473334743347533476334773347833479334803348133482334833348433485334863348733488334893349033491334923349333494334953349633497334983349933500335013350233503335043350533506335073350833509335103351133512335133351433515335163351733518335193352033521335223352333524335253352633527335283352933530335313353233533335343353533536335373353833539335403354133542335433354433545335463354733548335493355033551335523355333554335553355633557335583355933560335613356233563335643356533566335673356833569335703357133572335733357433575335763357733578335793358033581335823358333584335853358633587335883358933590335913359233593335943359533596335973359833599336003360133602336033360433605336063360733608336093361033611336123361333614336153361633617336183361933620336213362233623336243362533626336273362833629336303363133632336333363433635336363363733638336393364033641336423364333644336453364633647336483364933650336513365233653336543365533656336573365833659336603366133662336633366433665336663366733668336693367033671336723367333674336753367633677336783367933680336813368233683336843368533686336873368833689336903369133692336933369433695336963369733698336993370033701337023370333704337053370633707337083370933710337113371233713337143371533716337173371833719337203372133722337233372433725337263372733728337293373033731337323373333734337353373633737337383373933740337413374233743337443374533746337473374833749337503375133752337533375433755337563375733758337593376033761337623376333764337653376633767337683376933770337713377233773337743377533776337773377833779337803378133782337833378433785337863378733788337893379033791337923379333794337953379633797337983379933800338013380233803338043380533806338073380833809338103381133812338133381433815338163381733818338193382033821338223382333824338253382633827338283382933830338313383233833338343383533836338373383833839338403384133842338433384433845338463384733848338493385033851338523385333854338553385633857338583385933860338613386233863338643386533866338673386833869338703387133872338733387433875338763387733878338793388033881338823388333884338853388633887338883388933890338913389233893338943389533896338973389833899339003390133902339033390433905339063390733908339093391033911339123391333914339153391633917339183391933920339213392233923339243392533926339273392833929339303393133932339333393433935339363393733938339393394033941339423394333944339453394633947339483394933950339513395233953339543395533956339573395833959339603396133962339633396433965339663396733968339693397033971339723397333974339753397633977339783397933980339813398233983339843398533986339873398833989339903399133992339933399433995339963399733998339993400034001340023400334004340053400634007340083400934010340113401234013340143401534016340173401834019340203402134022340233402434025340263402734028340293403034031340323403334034340353403634037340383403934040340413404234043340443404534046340473404834049340503405134052340533405434055340563405734058340593406034061340623406334064340653406634067340683406934070340713407234073340743407534076340773407834079340803408134082340833408434085340863408734088340893409034091340923409334094340953409634097340983409934100341013410234103341043410534106341073410834109341103411134112341133411434115341163411734118341193412034121341223412334124341253412634127341283412934130341313413234133341343413534136341373413834139341403414134142341433414434145341463414734148341493415034151341523415334154341553415634157341583415934160341613416234163341643416534166341673416834169341703417134172341733417434175341763417734178341793418034181341823418334184341853418634187341883418934190341913419234193341943419534196341973419834199342003420134202342033420434205342063420734208342093421034211342123421334214342153421634217342183421934220342213422234223342243422534226342273422834229342303423134232342333423434235342363423734238342393424034241342423424334244342453424634247342483424934250342513425234253342543425534256342573425834259342603426134262342633426434265342663426734268342693427034271342723427334274342753427634277342783427934280342813428234283342843428534286342873428834289342903429134292342933429434295342963429734298342993430034301343023430334304343053430634307343083430934310343113431234313343143431534316343173431834319343203432134322343233432434325343263432734328343293433034331343323433334334343353433634337343383433934340343413434234343343443434534346343473434834349343503435134352343533435434355343563435734358343593436034361343623436334364343653436634367343683436934370343713437234373343743437534376343773437834379343803438134382343833438434385343863438734388343893439034391343923439334394343953439634397343983439934400344013440234403344043440534406344073440834409344103441134412344133441434415344163441734418344193442034421344223442334424344253442634427344283442934430344313443234433344343443534436344373443834439344403444134442344433444434445344463444734448344493445034451344523445334454344553445634457344583445934460344613446234463344643446534466344673446834469344703447134472344733447434475344763447734478344793448034481344823448334484344853448634487344883448934490344913449234493344943449534496344973449834499345003450134502345033450434505345063450734508345093451034511345123451334514345153451634517345183451934520345213452234523345243452534526345273452834529345303453134532345333453434535345363453734538345393454034541345423454334544345453454634547345483454934550345513455234553345543455534556345573455834559345603456134562345633456434565345663456734568345693457034571345723457334574345753457634577345783457934580345813458234583345843458534586345873458834589345903459134592345933459434595345963459734598345993460034601346023460334604346053460634607346083460934610346113461234613346143461534616346173461834619346203462134622346233462434625346263462734628346293463034631346323463334634346353463634637346383463934640346413464234643346443464534646346473464834649346503465134652346533465434655346563465734658346593466034661346623466334664346653466634667346683466934670346713467234673346743467534676346773467834679346803468134682346833468434685346863468734688346893469034691346923469334694346953469634697346983469934700347013470234703347043470534706347073470834709347103471134712347133471434715347163471734718347193472034721347223472334724347253472634727347283472934730347313473234733347343473534736347373473834739347403474134742347433474434745347463474734748347493475034751347523475334754347553475634757347583475934760347613476234763347643476534766347673476834769347703477134772347733477434775347763477734778347793478034781347823478334784347853478634787347883478934790347913479234793347943479534796347973479834799348003480134802348033480434805348063480734808348093481034811348123481334814348153481634817348183481934820348213482234823348243482534826348273482834829348303483134832348333483434835348363483734838348393484034841348423484334844348453484634847348483484934850348513485234853348543485534856348573485834859348603486134862348633486434865348663486734868348693487034871348723487334874348753487634877348783487934880348813488234883348843488534886348873488834889348903489134892348933489434895348963489734898348993490034901349023490334904349053490634907349083490934910349113491234913349143491534916349173491834919349203492134922349233492434925349263492734928349293493034931349323493334934349353493634937349383493934940349413494234943349443494534946349473494834949349503495134952349533495434955349563495734958349593496034961349623496334964349653496634967349683496934970349713497234973349743497534976349773497834979349803498134982349833498434985349863498734988349893499034991349923499334994349953499634997349983499935000350013500235003350043500535006350073500835009350103501135012350133501435015350163501735018350193502035021350223502335024350253502635027350283502935030350313503235033350343503535036350373503835039350403504135042350433504435045350463504735048350493505035051350523505335054350553505635057350583505935060350613506235063350643506535066350673506835069350703507135072350733507435075350763507735078350793508035081350823508335084350853508635087350883508935090350913509235093350943509535096350973509835099351003510135102351033510435105351063510735108351093511035111351123511335114351153511635117351183511935120351213512235123351243512535126351273512835129351303513135132351333513435135351363513735138351393514035141351423514335144351453514635147351483514935150351513515235153351543515535156351573515835159351603516135162351633516435165351663516735168351693517035171351723517335174351753517635177351783517935180351813518235183351843518535186351873518835189351903519135192351933519435195351963519735198351993520035201352023520335204352053520635207352083520935210352113521235213352143521535216352173521835219352203522135222352233522435225352263522735228352293523035231352323523335234352353523635237352383523935240352413524235243352443524535246352473524835249352503525135252352533525435255352563525735258352593526035261352623526335264352653526635267352683526935270352713527235273352743527535276352773527835279352803528135282352833528435285352863528735288352893529035291352923529335294352953529635297352983529935300353013530235303353043530535306353073530835309353103531135312353133531435315353163531735318353193532035321353223532335324353253532635327353283532935330353313533235333353343533535336353373533835339353403534135342353433534435345353463534735348353493535035351353523535335354353553535635357353583535935360353613536235363353643536535366353673536835369353703537135372353733537435375353763537735378353793538035381353823538335384353853538635387353883538935390353913539235393353943539535396353973539835399354003540135402354033540435405354063540735408354093541035411354123541335414354153541635417354183541935420354213542235423354243542535426354273542835429354303543135432354333543435435354363543735438354393544035441354423544335444354453544635447354483544935450354513545235453354543545535456354573545835459354603546135462354633546435465354663546735468354693547035471354723547335474354753547635477354783547935480354813548235483354843548535486354873548835489354903549135492354933549435495354963549735498354993550035501355023550335504355053550635507355083550935510355113551235513355143551535516355173551835519355203552135522355233552435525355263552735528355293553035531355323553335534355353553635537355383553935540355413554235543355443554535546355473554835549355503555135552355533555435555355563555735558355593556035561355623556335564355653556635567355683556935570355713557235573355743557535576355773557835579355803558135582355833558435585355863558735588355893559035591355923559335594355953559635597355983559935600356013560235603356043560535606356073560835609356103561135612356133561435615356163561735618356193562035621356223562335624356253562635627356283562935630356313563235633356343563535636356373563835639356403564135642356433564435645356463564735648356493565035651356523565335654356553565635657356583565935660356613566235663356643566535666356673566835669356703567135672356733567435675356763567735678356793568035681356823568335684356853568635687356883568935690356913569235693356943569535696356973569835699357003570135702357033570435705357063570735708357093571035711357123571335714357153571635717357183571935720357213572235723357243572535726357273572835729357303573135732357333573435735357363573735738357393574035741357423574335744357453574635747357483574935750357513575235753357543575535756357573575835759357603576135762357633576435765357663576735768357693577035771357723577335774357753577635777357783577935780357813578235783357843578535786357873578835789357903579135792357933579435795357963579735798357993580035801358023580335804358053580635807358083580935810358113581235813358143581535816358173581835819358203582135822358233582435825358263582735828358293583035831358323583335834358353583635837358383583935840358413584235843358443584535846358473584835849358503585135852358533585435855358563585735858358593586035861358623586335864358653586635867358683586935870358713587235873358743587535876358773587835879358803588135882358833588435885358863588735888358893589035891358923589335894358953589635897358983589935900359013590235903359043590535906359073590835909359103591135912359133591435915359163591735918359193592035921359223592335924359253592635927359283592935930359313593235933359343593535936359373593835939359403594135942359433594435945359463594735948359493595035951359523595335954359553595635957359583595935960359613596235963359643596535966359673596835969359703597135972359733597435975359763597735978359793598035981359823598335984359853598635987359883598935990359913599235993359943599535996359973599835999360003600136002360033600436005360063600736008360093601036011360123601336014360153601636017360183601936020360213602236023360243602536026360273602836029360303603136032360333603436035360363603736038360393604036041360423604336044360453604636047360483604936050360513605236053360543605536056360573605836059360603606136062360633606436065360663606736068360693607036071360723607336074360753607636077360783607936080360813608236083360843608536086360873608836089360903609136092360933609436095360963609736098360993610036101361023610336104361053610636107361083610936110361113611236113361143611536116361173611836119361203612136122361233612436125361263612736128361293613036131361323613336134361353613636137361383613936140361413614236143361443614536146361473614836149361503615136152361533615436155361563615736158361593616036161361623616336164361653616636167361683616936170361713617236173361743617536176361773617836179361803618136182361833618436185361863618736188361893619036191361923619336194361953619636197361983619936200362013620236203362043620536206362073620836209362103621136212362133621436215362163621736218362193622036221362223622336224362253622636227362283622936230362313623236233362343623536236362373623836239362403624136242362433624436245362463624736248362493625036251362523625336254362553625636257362583625936260362613626236263362643626536266362673626836269362703627136272362733627436275362763627736278362793628036281362823628336284362853628636287362883628936290362913629236293362943629536296362973629836299363003630136302363033630436305363063630736308363093631036311363123631336314363153631636317363183631936320363213632236323363243632536326363273632836329363303633136332363333633436335363363633736338363393634036341363423634336344363453634636347363483634936350363513635236353363543635536356363573635836359363603636136362363633636436365363663636736368363693637036371363723637336374363753637636377363783637936380363813638236383363843638536386363873638836389363903639136392363933639436395363963639736398363993640036401364023640336404364053640636407364083640936410364113641236413364143641536416364173641836419364203642136422364233642436425364263642736428364293643036431364323643336434364353643636437364383643936440364413644236443364443644536446364473644836449364503645136452364533645436455364563645736458364593646036461364623646336464364653646636467364683646936470364713647236473364743647536476364773647836479364803648136482364833648436485364863648736488364893649036491364923649336494364953649636497364983649936500365013650236503365043650536506365073650836509365103651136512365133651436515365163651736518365193652036521365223652336524365253652636527365283652936530365313653236533365343653536536365373653836539365403654136542365433654436545365463654736548365493655036551365523655336554365553655636557365583655936560365613656236563365643656536566365673656836569365703657136572365733657436575365763657736578365793658036581365823658336584365853658636587365883658936590365913659236593365943659536596365973659836599366003660136602366033660436605366063660736608366093661036611366123661336614366153661636617366183661936620366213662236623366243662536626366273662836629366303663136632366333663436635366363663736638366393664036641366423664336644366453664636647366483664936650366513665236653366543665536656366573665836659366603666136662366633666436665366663666736668366693667036671366723667336674366753667636677366783667936680366813668236683366843668536686366873668836689366903669136692366933669436695366963669736698366993670036701367023670336704367053670636707367083670936710367113671236713367143671536716367173671836719367203672136722367233672436725367263672736728367293673036731367323673336734367353673636737367383673936740367413674236743367443674536746367473674836749367503675136752367533675436755367563675736758367593676036761367623676336764367653676636767367683676936770367713677236773367743677536776367773677836779367803678136782367833678436785367863678736788367893679036791367923679336794367953679636797367983679936800368013680236803368043680536806368073680836809368103681136812368133681436815368163681736818368193682036821368223682336824368253682636827368283682936830368313683236833368343683536836368373683836839368403684136842368433684436845368463684736848368493685036851368523685336854368553685636857368583685936860368613686236863368643686536866368673686836869368703687136872368733687436875368763687736878368793688036881368823688336884368853688636887368883688936890368913689236893368943689536896368973689836899369003690136902369033690436905369063690736908369093691036911369123691336914369153691636917369183691936920369213692236923369243692536926369273692836929369303693136932369333693436935369363693736938369393694036941369423694336944369453694636947369483694936950369513695236953369543695536956369573695836959369603696136962369633696436965369663696736968369693697036971369723697336974369753697636977369783697936980369813698236983369843698536986369873698836989369903699136992369933699436995369963699736998369993700037001370023700337004370053700637007370083700937010370113701237013370143701537016370173701837019370203702137022370233702437025370263702737028370293703037031370323703337034370353703637037370383703937040370413704237043370443704537046370473704837049370503705137052370533705437055370563705737058370593706037061370623706337064370653706637067370683706937070370713707237073370743707537076370773707837079370803708137082370833708437085370863708737088370893709037091370923709337094370953709637097370983709937100371013710237103371043710537106371073710837109371103711137112371133711437115371163711737118371193712037121371223712337124371253712637127371283712937130371313713237133371343713537136371373713837139371403714137142371433714437145371463714737148371493715037151371523715337154371553715637157371583715937160371613716237163371643716537166371673716837169371703717137172371733717437175371763717737178371793718037181371823718337184371853718637187371883718937190371913719237193371943719537196371973719837199372003720137202372033720437205372063720737208372093721037211372123721337214372153721637217372183721937220372213722237223372243722537226372273722837229372303723137232372333723437235372363723737238372393724037241372423724337244372453724637247372483724937250372513725237253372543725537256372573725837259372603726137262372633726437265372663726737268372693727037271372723727337274372753727637277372783727937280372813728237283372843728537286372873728837289372903729137292372933729437295372963729737298372993730037301373023730337304373053730637307373083730937310373113731237313373143731537316373173731837319373203732137322373233732437325373263732737328373293733037331373323733337334373353733637337373383733937340373413734237343373443734537346373473734837349373503735137352373533735437355373563735737358373593736037361373623736337364373653736637367373683736937370373713737237373373743737537376373773737837379373803738137382373833738437385373863738737388373893739037391373923739337394373953739637397373983739937400374013740237403374043740537406374073740837409374103741137412374133741437415374163741737418374193742037421374223742337424374253742637427374283742937430374313743237433374343743537436374373743837439374403744137442374433744437445374463744737448374493745037451374523745337454374553745637457374583745937460374613746237463374643746537466374673746837469374703747137472374733747437475374763747737478374793748037481374823748337484374853748637487374883748937490374913749237493374943749537496374973749837499375003750137502375033750437505375063750737508375093751037511375123751337514375153751637517375183751937520375213752237523375243752537526375273752837529375303753137532375333753437535375363753737538375393754037541375423754337544375453754637547375483754937550375513755237553375543755537556375573755837559375603756137562375633756437565375663756737568375693757037571375723757337574375753757637577375783757937580375813758237583375843758537586375873758837589375903759137592375933759437595375963759737598375993760037601376023760337604376053760637607376083760937610376113761237613376143761537616376173761837619376203762137622376233762437625376263762737628376293763037631376323763337634376353763637637376383763937640376413764237643376443764537646376473764837649376503765137652376533765437655376563765737658376593766037661376623766337664376653766637667376683766937670376713767237673376743767537676376773767837679376803768137682376833768437685376863768737688376893769037691376923769337694376953769637697376983769937700377013770237703377043770537706377073770837709377103771137712377133771437715377163771737718377193772037721377223772337724377253772637727377283772937730377313773237733377343773537736377373773837739377403774137742377433774437745377463774737748377493775037751377523775337754377553775637757377583775937760377613776237763377643776537766377673776837769377703777137772377733777437775377763777737778377793778037781377823778337784377853778637787377883778937790377913779237793377943779537796377973779837799378003780137802378033780437805378063780737808378093781037811378123781337814378153781637817378183781937820378213782237823378243782537826378273782837829378303783137832378333783437835378363783737838378393784037841378423784337844378453784637847378483784937850378513785237853378543785537856378573785837859378603786137862378633786437865378663786737868378693787037871378723787337874378753787637877378783787937880378813788237883378843788537886378873788837889378903789137892378933789437895378963789737898378993790037901379023790337904379053790637907379083790937910379113791237913379143791537916379173791837919379203792137922379233792437925379263792737928379293793037931379323793337934379353793637937379383793937940379413794237943379443794537946379473794837949379503795137952379533795437955379563795737958379593796037961379623796337964379653796637967379683796937970379713797237973379743797537976379773797837979379803798137982379833798437985379863798737988379893799037991379923799337994379953799637997379983799938000380013800238003380043800538006380073800838009380103801138012380133801438015380163801738018380193802038021380223802338024380253802638027380283802938030380313803238033380343803538036380373803838039380403804138042380433804438045380463804738048380493805038051380523805338054380553805638057380583805938060380613806238063380643806538066380673806838069380703807138072380733807438075380763807738078380793808038081380823808338084380853808638087380883808938090380913809238093380943809538096380973809838099381003810138102381033810438105381063810738108381093811038111381123811338114381153811638117381183811938120381213812238123381243812538126381273812838129381303813138132381333813438135381363813738138381393814038141381423814338144381453814638147381483814938150381513815238153381543815538156381573815838159381603816138162381633816438165381663816738168381693817038171381723817338174381753817638177381783817938180381813818238183381843818538186381873818838189381903819138192381933819438195381963819738198381993820038201382023820338204382053820638207382083820938210382113821238213382143821538216382173821838219382203822138222382233822438225382263822738228382293823038231382323823338234382353823638237382383823938240382413824238243382443824538246382473824838249382503825138252382533825438255382563825738258382593826038261382623826338264382653826638267382683826938270382713827238273382743827538276382773827838279382803828138282382833828438285382863828738288382893829038291382923829338294382953829638297382983829938300383013830238303383043830538306383073830838309383103831138312383133831438315383163831738318383193832038321383223832338324383253832638327383283832938330383313833238333383343833538336383373833838339383403834138342383433834438345383463834738348383493835038351383523835338354383553835638357383583835938360383613836238363383643836538366383673836838369383703837138372383733837438375383763837738378383793838038381383823838338384383853838638387383883838938390383913839238393383943839538396383973839838399384003840138402384033840438405384063840738408384093841038411384123841338414384153841638417384183841938420384213842238423384243842538426384273842838429384303843138432384333843438435384363843738438384393844038441384423844338444384453844638447384483844938450384513845238453384543845538456384573845838459384603846138462384633846438465384663846738468384693847038471384723847338474384753847638477384783847938480384813848238483384843848538486384873848838489384903849138492384933849438495384963849738498384993850038501385023850338504385053850638507385083850938510385113851238513385143851538516385173851838519385203852138522385233852438525385263852738528385293853038531385323853338534385353853638537385383853938540385413854238543385443854538546385473854838549385503855138552385533855438555385563855738558385593856038561385623856338564385653856638567385683856938570385713857238573385743857538576385773857838579385803858138582385833858438585385863858738588385893859038591385923859338594385953859638597385983859938600386013860238603386043860538606386073860838609386103861138612386133861438615386163861738618386193862038621386223862338624386253862638627386283862938630386313863238633386343863538636386373863838639386403864138642386433864438645386463864738648386493865038651386523865338654386553865638657386583865938660386613866238663386643866538666386673866838669386703867138672386733867438675386763867738678386793868038681386823868338684386853868638687386883868938690386913869238693386943869538696386973869838699387003870138702387033870438705387063870738708387093871038711387123871338714387153871638717387183871938720387213872238723387243872538726387273872838729387303873138732387333873438735387363873738738387393874038741387423874338744387453874638747387483874938750387513875238753387543875538756387573875838759387603876138762387633876438765387663876738768387693877038771387723877338774387753877638777387783877938780387813878238783387843878538786387873878838789387903879138792387933879438795387963879738798387993880038801388023880338804388053880638807388083880938810388113881238813388143881538816388173881838819388203882138822388233882438825388263882738828388293883038831388323883338834388353883638837388383883938840388413884238843388443884538846388473884838849388503885138852388533885438855388563885738858388593886038861388623886338864388653886638867388683886938870388713887238873388743887538876388773887838879388803888138882388833888438885388863888738888388893889038891388923889338894388953889638897388983889938900389013890238903389043890538906389073890838909389103891138912389133891438915389163891738918389193892038921389223892338924389253892638927389283892938930389313893238933389343893538936389373893838939389403894138942389433894438945389463894738948389493895038951389523895338954389553895638957389583895938960389613896238963389643896538966389673896838969389703897138972389733897438975389763897738978389793898038981389823898338984389853898638987389883898938990389913899238993389943899538996389973899838999390003900139002390033900439005390063900739008390093901039011390123901339014390153901639017390183901939020390213902239023390243902539026390273902839029390303903139032390333903439035390363903739038390393904039041390423904339044390453904639047390483904939050390513905239053390543905539056390573905839059390603906139062390633906439065390663906739068390693907039071390723907339074390753907639077390783907939080390813908239083390843908539086390873908839089390903909139092390933909439095390963909739098390993910039101391023910339104391053910639107391083910939110391113911239113391143911539116391173911839119391203912139122391233912439125391263912739128391293913039131391323913339134391353913639137391383913939140391413914239143391443914539146391473914839149391503915139152391533915439155391563915739158391593916039161391623916339164391653916639167391683916939170391713917239173391743917539176391773917839179391803918139182391833918439185391863918739188391893919039191391923919339194391953919639197391983919939200392013920239203392043920539206392073920839209392103921139212392133921439215392163921739218392193922039221392223922339224392253922639227392283922939230392313923239233392343923539236392373923839239392403924139242392433924439245392463924739248392493925039251392523925339254392553925639257392583925939260392613926239263392643926539266392673926839269392703927139272392733927439275392763927739278392793928039281392823928339284392853928639287392883928939290392913929239293392943929539296392973929839299393003930139302393033930439305393063930739308393093931039311393123931339314393153931639317393183931939320393213932239323393243932539326393273932839329393303933139332393333933439335393363933739338393393934039341393423934339344393453934639347393483934939350393513935239353393543935539356393573935839359393603936139362393633936439365393663936739368393693937039371393723937339374393753937639377393783937939380393813938239383393843938539386393873938839389393903939139392393933939439395393963939739398393993940039401394023940339404394053940639407394083940939410394113941239413394143941539416394173941839419394203942139422394233942439425394263942739428394293943039431394323943339434394353943639437394383943939440394413944239443394443944539446394473944839449394503945139452394533945439455394563945739458394593946039461394623946339464394653946639467394683946939470394713947239473394743947539476394773947839479394803948139482394833948439485394863948739488394893949039491394923949339494394953949639497394983949939500395013950239503395043950539506395073950839509395103951139512395133951439515395163951739518395193952039521395223952339524395253952639527395283952939530395313953239533395343953539536395373953839539395403954139542395433954439545395463954739548395493955039551395523955339554395553955639557395583955939560395613956239563395643956539566395673956839569395703957139572395733957439575395763957739578395793958039581395823958339584395853958639587395883958939590395913959239593395943959539596395973959839599396003960139602396033960439605396063960739608396093961039611396123961339614396153961639617396183961939620396213962239623396243962539626396273962839629396303963139632396333963439635396363963739638396393964039641396423964339644396453964639647396483964939650396513965239653396543965539656396573965839659396603966139662396633966439665396663966739668396693967039671396723967339674396753967639677396783967939680396813968239683396843968539686396873968839689396903969139692396933969439695396963969739698396993970039701397023970339704397053970639707397083970939710397113971239713397143971539716397173971839719397203972139722397233972439725397263972739728397293973039731397323973339734397353973639737397383973939740397413974239743397443974539746397473974839749397503975139752397533975439755397563975739758397593976039761397623976339764397653976639767397683976939770397713977239773397743977539776397773977839779397803978139782397833978439785397863978739788397893979039791397923979339794397953979639797397983979939800398013980239803398043980539806398073980839809398103981139812398133981439815398163981739818398193982039821398223982339824398253982639827398283982939830398313983239833398343983539836398373983839839398403984139842398433984439845398463984739848398493985039851398523985339854398553985639857398583985939860398613986239863398643986539866398673986839869398703987139872398733987439875398763987739878398793988039881398823988339884398853988639887398883988939890398913989239893398943989539896398973989839899399003990139902399033990439905399063990739908399093991039911399123991339914399153991639917399183991939920399213992239923399243992539926399273992839929399303993139932399333993439935399363993739938399393994039941399423994339944399453994639947399483994939950399513995239953399543995539956399573995839959399603996139962399633996439965399663996739968399693997039971399723997339974399753997639977399783997939980399813998239983399843998539986399873998839989399903999139992399933999439995399963999739998399994000040001400024000340004400054000640007400084000940010400114001240013400144001540016400174001840019400204002140022400234002440025400264002740028400294003040031400324003340034400354003640037400384003940040400414004240043400444004540046400474004840049400504005140052400534005440055400564005740058400594006040061400624006340064400654006640067400684006940070400714007240073400744007540076400774007840079400804008140082400834008440085400864008740088400894009040091400924009340094400954009640097400984009940100401014010240103401044010540106401074010840109401104011140112401134011440115401164011740118401194012040121401224012340124401254012640127401284012940130401314013240133401344013540136401374013840139401404014140142401434014440145401464014740148401494015040151401524015340154401554015640157401584015940160401614016240163401644016540166401674016840169401704017140172401734017440175401764017740178401794018040181401824018340184401854018640187401884018940190401914019240193401944019540196401974019840199402004020140202402034020440205402064020740208402094021040211402124021340214402154021640217402184021940220402214022240223402244022540226402274022840229402304023140232402334023440235402364023740238402394024040241402424024340244402454024640247402484024940250402514025240253402544025540256402574025840259402604026140262402634026440265402664026740268402694027040271402724027340274402754027640277402784027940280402814028240283402844028540286402874028840289402904029140292402934029440295402964029740298402994030040301403024030340304403054030640307403084030940310403114031240313403144031540316403174031840319403204032140322403234032440325403264032740328403294033040331403324033340334403354033640337403384033940340403414034240343403444034540346403474034840349403504035140352403534035440355403564035740358403594036040361403624036340364403654036640367403684036940370403714037240373403744037540376403774037840379403804038140382403834038440385403864038740388403894039040391403924039340394403954039640397403984039940400404014040240403404044040540406404074040840409404104041140412404134041440415404164041740418404194042040421404224042340424404254042640427404284042940430404314043240433404344043540436404374043840439404404044140442404434044440445404464044740448404494045040451404524045340454404554045640457404584045940460404614046240463404644046540466404674046840469404704047140472404734047440475404764047740478404794048040481404824048340484404854048640487404884048940490404914049240493404944049540496404974049840499405004050140502405034050440505405064050740508405094051040511405124051340514405154051640517405184051940520405214052240523405244052540526405274052840529405304053140532405334053440535405364053740538405394054040541405424054340544405454054640547405484054940550405514055240553405544055540556405574055840559405604056140562405634056440565405664056740568405694057040571405724057340574405754057640577405784057940580405814058240583405844058540586405874058840589405904059140592405934059440595405964059740598405994060040601406024060340604406054060640607406084060940610406114061240613406144061540616406174061840619406204062140622406234062440625406264062740628406294063040631406324063340634406354063640637406384063940640406414064240643406444064540646406474064840649406504065140652406534065440655406564065740658406594066040661406624066340664406654066640667406684066940670406714067240673406744067540676406774067840679406804068140682406834068440685406864068740688406894069040691406924069340694406954069640697406984069940700407014070240703407044070540706407074070840709407104071140712407134071440715407164071740718407194072040721407224072340724407254072640727407284072940730407314073240733407344073540736407374073840739407404074140742407434074440745407464074740748407494075040751407524075340754407554075640757407584075940760407614076240763407644076540766407674076840769407704077140772407734077440775407764077740778407794078040781407824078340784407854078640787407884078940790407914079240793407944079540796407974079840799408004080140802408034080440805408064080740808408094081040811408124081340814408154081640817408184081940820408214082240823408244082540826408274082840829408304083140832408334083440835408364083740838408394084040841408424084340844408454084640847408484084940850408514085240853408544085540856408574085840859408604086140862408634086440865408664086740868408694087040871408724087340874408754087640877408784087940880408814088240883408844088540886408874088840889408904089140892408934089440895408964089740898408994090040901409024090340904409054090640907409084090940910409114091240913409144091540916409174091840919409204092140922409234092440925409264092740928409294093040931409324093340934409354093640937409384093940940409414094240943409444094540946409474094840949409504095140952409534095440955409564095740958409594096040961409624096340964409654096640967409684096940970409714097240973409744097540976409774097840979409804098140982409834098440985409864098740988409894099040991409924099340994409954099640997409984099941000410014100241003410044100541006410074100841009410104101141012410134101441015410164101741018410194102041021410224102341024410254102641027410284102941030410314103241033410344103541036410374103841039410404104141042410434104441045410464104741048410494105041051410524105341054410554105641057410584105941060410614106241063410644106541066410674106841069410704107141072410734107441075410764107741078410794108041081410824108341084410854108641087410884108941090410914109241093410944109541096410974109841099411004110141102411034110441105411064110741108411094111041111411124111341114411154111641117411184111941120411214112241123411244112541126411274112841129411304113141132411334113441135411364113741138411394114041141411424114341144411454114641147411484114941150411514115241153411544115541156411574115841159411604116141162411634116441165411664116741168411694117041171411724117341174411754117641177411784117941180411814118241183411844118541186411874118841189411904119141192411934119441195411964119741198411994120041201412024120341204412054120641207412084120941210412114121241213412144121541216412174121841219412204122141222412234122441225412264122741228412294123041231412324123341234412354123641237412384123941240412414124241243412444124541246412474124841249412504125141252412534125441255412564125741258412594126041261412624126341264412654126641267412684126941270412714127241273412744127541276412774127841279412804128141282412834128441285412864128741288412894129041291412924129341294412954129641297412984129941300413014130241303413044130541306413074130841309413104131141312413134131441315413164131741318413194132041321413224132341324413254132641327413284132941330413314133241333413344133541336413374133841339413404134141342413434134441345413464134741348413494135041351413524135341354413554135641357413584135941360413614136241363413644136541366413674136841369413704137141372413734137441375413764137741378413794138041381413824138341384413854138641387413884138941390413914139241393413944139541396413974139841399414004140141402414034140441405414064140741408414094141041411414124141341414414154141641417414184141941420414214142241423414244142541426414274142841429414304143141432414334143441435414364143741438414394144041441414424144341444414454144641447414484144941450414514145241453414544145541456414574145841459414604146141462414634146441465414664146741468414694147041471414724147341474414754147641477414784147941480414814148241483414844148541486414874148841489414904149141492414934149441495414964149741498414994150041501415024150341504415054150641507415084150941510415114151241513415144151541516415174151841519415204152141522415234152441525415264152741528415294153041531415324153341534415354153641537415384153941540415414154241543415444154541546415474154841549415504155141552415534155441555415564155741558415594156041561415624156341564415654156641567415684156941570415714157241573415744157541576415774157841579415804158141582415834158441585415864158741588415894159041591415924159341594415954159641597415984159941600416014160241603416044160541606416074160841609416104161141612416134161441615416164161741618416194162041621416224162341624416254162641627416284162941630416314163241633416344163541636416374163841639416404164141642416434164441645416464164741648416494165041651416524165341654416554165641657416584165941660416614166241663416644166541666416674166841669416704167141672416734167441675416764167741678416794168041681416824168341684416854168641687416884168941690416914169241693416944169541696416974169841699417004170141702417034170441705417064170741708417094171041711417124171341714417154171641717417184171941720417214172241723417244172541726417274172841729417304173141732417334173441735417364173741738417394174041741417424174341744417454174641747417484174941750417514175241753417544175541756417574175841759417604176141762417634176441765417664176741768417694177041771417724177341774417754177641777417784177941780417814178241783417844178541786417874178841789417904179141792417934179441795417964179741798417994180041801418024180341804418054180641807418084180941810418114181241813418144181541816418174181841819418204182141822418234182441825418264182741828418294183041831418324183341834418354183641837418384183941840418414184241843418444184541846418474184841849418504185141852418534185441855418564185741858418594186041861418624186341864418654186641867418684186941870418714187241873418744187541876418774187841879418804188141882418834188441885418864188741888418894189041891418924189341894418954189641897418984189941900419014190241903419044190541906419074190841909419104191141912419134191441915419164191741918419194192041921419224192341924419254192641927419284192941930419314193241933419344193541936419374193841939419404194141942419434194441945419464194741948419494195041951419524195341954419554195641957419584195941960419614196241963419644196541966419674196841969419704197141972419734197441975419764197741978419794198041981419824198341984419854198641987419884198941990419914199241993419944199541996419974199841999420004200142002420034200442005420064200742008420094201042011420124201342014420154201642017420184201942020420214202242023420244202542026420274202842029420304203142032420334203442035420364203742038420394204042041420424204342044420454204642047420484204942050420514205242053420544205542056420574205842059420604206142062420634206442065420664206742068420694207042071420724207342074420754207642077420784207942080420814208242083420844208542086420874208842089420904209142092420934209442095420964209742098420994210042101421024210342104421054210642107421084210942110421114211242113421144211542116421174211842119421204212142122421234212442125421264212742128421294213042131421324213342134421354213642137421384213942140421414214242143421444214542146421474214842149421504215142152421534215442155421564215742158421594216042161421624216342164421654216642167421684216942170421714217242173421744217542176421774217842179421804218142182421834218442185421864218742188421894219042191421924219342194421954219642197421984219942200422014220242203422044220542206422074220842209422104221142212422134221442215422164221742218422194222042221422224222342224422254222642227422284222942230422314223242233422344223542236422374223842239422404224142242422434224442245422464224742248422494225042251422524225342254422554225642257422584225942260422614226242263422644226542266422674226842269422704227142272422734227442275422764227742278422794228042281422824228342284422854228642287422884228942290422914229242293422944229542296422974229842299423004230142302423034230442305423064230742308423094231042311423124231342314423154231642317423184231942320423214232242323423244232542326423274232842329423304233142332423334233442335423364233742338423394234042341423424234342344423454234642347423484234942350423514235242353423544235542356423574235842359423604236142362423634236442365423664236742368423694237042371423724237342374423754237642377423784237942380423814238242383423844238542386423874238842389423904239142392423934239442395423964239742398423994240042401424024240342404424054240642407424084240942410424114241242413424144241542416424174241842419424204242142422424234242442425424264242742428424294243042431424324243342434424354243642437424384243942440424414244242443424444244542446424474244842449424504245142452424534245442455424564245742458424594246042461424624246342464424654246642467424684246942470424714247242473424744247542476424774247842479424804248142482424834248442485424864248742488424894249042491424924249342494424954249642497424984249942500425014250242503425044250542506425074250842509425104251142512425134251442515425164251742518425194252042521425224252342524425254252642527425284252942530425314253242533425344253542536425374253842539425404254142542425434254442545425464254742548425494255042551425524255342554425554255642557425584255942560425614256242563425644256542566425674256842569425704257142572425734257442575425764257742578425794258042581425824258342584425854258642587425884258942590425914259242593425944259542596425974259842599426004260142602426034260442605426064260742608426094261042611426124261342614426154261642617426184261942620426214262242623426244262542626426274262842629426304263142632426334263442635426364263742638426394264042641426424264342644426454264642647426484264942650426514265242653426544265542656426574265842659426604266142662426634266442665426664266742668426694267042671426724267342674426754267642677426784267942680426814268242683426844268542686426874268842689426904269142692426934269442695426964269742698426994270042701427024270342704427054270642707427084270942710427114271242713427144271542716427174271842719427204272142722427234272442725427264272742728427294273042731427324273342734427354273642737427384273942740427414274242743427444274542746427474274842749427504275142752427534275442755427564275742758427594276042761427624276342764427654276642767427684276942770427714277242773427744277542776427774277842779427804278142782427834278442785427864278742788427894279042791427924279342794427954279642797427984279942800428014280242803428044280542806428074280842809428104281142812428134281442815428164281742818428194282042821428224282342824428254282642827428284282942830428314283242833428344283542836428374283842839428404284142842428434284442845428464284742848428494285042851428524285342854428554285642857428584285942860428614286242863428644286542866428674286842869428704287142872428734287442875428764287742878428794288042881428824288342884428854288642887428884288942890428914289242893428944289542896428974289842899429004290142902429034290442905429064290742908429094291042911429124291342914429154291642917429184291942920429214292242923429244292542926429274292842929429304293142932429334293442935429364293742938429394294042941429424294342944429454294642947429484294942950429514295242953429544295542956429574295842959429604296142962429634296442965429664296742968429694297042971429724297342974429754297642977429784297942980429814298242983429844298542986429874298842989429904299142992429934299442995429964299742998429994300043001430024300343004430054300643007430084300943010430114301243013430144301543016430174301843019430204302143022430234302443025430264302743028430294303043031430324303343034430354303643037430384303943040430414304243043430444304543046430474304843049430504305143052430534305443055430564305743058430594306043061430624306343064430654306643067430684306943070430714307243073430744307543076430774307843079430804308143082430834308443085430864308743088430894309043091430924309343094430954309643097430984309943100431014310243103431044310543106431074310843109431104311143112431134311443115431164311743118431194312043121431224312343124431254312643127431284312943130431314313243133431344313543136431374313843139431404314143142431434314443145431464314743148431494315043151431524315343154431554315643157431584315943160431614316243163431644316543166431674316843169431704317143172431734317443175431764317743178431794318043181431824318343184431854318643187431884318943190431914319243193431944319543196431974319843199432004320143202432034320443205432064320743208432094321043211432124321343214432154321643217432184321943220432214322243223432244322543226432274322843229432304323143232432334323443235432364323743238432394324043241432424324343244432454324643247432484324943250432514325243253432544325543256432574325843259432604326143262432634326443265432664326743268432694327043271432724327343274432754327643277432784327943280432814328243283432844328543286432874328843289432904329143292432934329443295432964329743298432994330043301433024330343304433054330643307433084330943310433114331243313433144331543316433174331843319433204332143322433234332443325433264332743328433294333043331433324333343334433354333643337433384333943340433414334243343433444334543346433474334843349433504335143352433534335443355433564335743358433594336043361433624336343364433654336643367433684336943370433714337243373433744337543376433774337843379433804338143382433834338443385433864338743388433894339043391433924339343394433954339643397433984339943400434014340243403434044340543406434074340843409434104341143412434134341443415434164341743418434194342043421434224342343424434254342643427434284342943430434314343243433434344343543436434374343843439434404344143442434434344443445434464344743448434494345043451434524345343454434554345643457434584345943460434614346243463434644346543466434674346843469434704347143472434734347443475434764347743478434794348043481434824348343484434854348643487434884348943490434914349243493434944349543496434974349843499435004350143502435034350443505435064350743508435094351043511435124351343514435154351643517435184351943520435214352243523435244352543526435274352843529435304353143532435334353443535435364353743538435394354043541435424354343544435454354643547435484354943550435514355243553435544355543556435574355843559435604356143562435634356443565435664356743568435694357043571435724357343574435754357643577435784357943580435814358243583435844358543586435874358843589435904359143592435934359443595435964359743598435994360043601436024360343604436054360643607436084360943610436114361243613436144361543616436174361843619436204362143622436234362443625436264362743628436294363043631436324363343634436354363643637436384363943640436414364243643436444364543646436474364843649436504365143652436534365443655436564365743658436594366043661436624366343664436654366643667436684366943670436714367243673436744367543676436774367843679436804368143682436834368443685436864368743688436894369043691436924369343694436954369643697436984369943700437014370243703437044370543706437074370843709437104371143712437134371443715437164371743718437194372043721437224372343724437254372643727437284372943730437314373243733437344373543736437374373843739437404374143742437434374443745437464374743748437494375043751437524375343754437554375643757437584375943760437614376243763437644376543766437674376843769437704377143772437734377443775437764377743778437794378043781437824378343784437854378643787437884378943790437914379243793437944379543796437974379843799438004380143802438034380443805438064380743808438094381043811438124381343814438154381643817438184381943820438214382243823438244382543826438274382843829438304383143832438334383443835438364383743838438394384043841438424384343844438454384643847438484384943850438514385243853438544385543856438574385843859438604386143862438634386443865438664386743868438694387043871438724387343874438754387643877438784387943880438814388243883438844388543886438874388843889438904389143892438934389443895438964389743898438994390043901439024390343904439054390643907439084390943910439114391243913439144391543916439174391843919439204392143922439234392443925439264392743928439294393043931439324393343934439354393643937439384393943940439414394243943439444394543946439474394843949439504395143952439534395443955439564395743958439594396043961439624396343964439654396643967439684396943970439714397243973439744397543976439774397843979439804398143982439834398443985439864398743988439894399043991439924399343994439954399643997439984399944000440014400244003440044400544006440074400844009440104401144012440134401444015440164401744018440194402044021440224402344024440254402644027440284402944030440314403244033440344403544036440374403844039440404404144042440434404444045440464404744048440494405044051440524405344054440554405644057440584405944060440614406244063440644406544066440674406844069440704407144072440734407444075440764407744078440794408044081440824408344084440854408644087440884408944090440914409244093440944409544096440974409844099441004410144102441034410444105441064410744108441094411044111441124411344114441154411644117441184411944120441214412244123441244412544126441274412844129441304413144132441334413444135441364413744138441394414044141441424414344144441454414644147441484414944150441514415244153441544415544156441574415844159441604416144162441634416444165441664416744168441694417044171441724417344174441754417644177441784417944180441814418244183441844418544186441874418844189441904419144192441934419444195441964419744198441994420044201442024420344204442054420644207442084420944210442114421244213442144421544216442174421844219442204422144222442234422444225442264422744228442294423044231442324423344234442354423644237442384423944240442414424244243442444424544246442474424844249442504425144252442534425444255442564425744258442594426044261442624426344264442654426644267442684426944270442714427244273442744427544276442774427844279442804428144282442834428444285442864428744288442894429044291442924429344294442954429644297442984429944300443014430244303443044430544306443074430844309443104431144312443134431444315443164431744318443194432044321443224432344324443254432644327443284432944330443314433244333443344433544336443374433844339443404434144342443434434444345443464434744348443494435044351443524435344354443554435644357443584435944360443614436244363443644436544366443674436844369443704437144372443734437444375443764437744378443794438044381443824438344384443854438644387443884438944390443914439244393443944439544396443974439844399444004440144402444034440444405444064440744408444094441044411444124441344414444154441644417444184441944420444214442244423444244442544426444274442844429444304443144432444334443444435444364443744438444394444044441444424444344444444454444644447444484444944450444514445244453444544445544456444574445844459444604446144462444634446444465444664446744468444694447044471444724447344474444754447644477444784447944480444814448244483444844448544486444874448844489444904449144492444934449444495444964449744498444994450044501445024450344504445054450644507445084450944510445114451244513445144451544516445174451844519445204452144522445234452444525445264452744528445294453044531445324453344534445354453644537445384453944540445414454244543445444454544546445474454844549445504455144552445534455444555445564455744558445594456044561445624456344564445654456644567445684456944570445714457244573445744457544576445774457844579445804458144582445834458444585445864458744588445894459044591445924459344594445954459644597445984459944600446014460244603446044460544606446074460844609446104461144612446134461444615446164461744618446194462044621446224462344624446254462644627446284462944630446314463244633446344463544636446374463844639446404464144642446434464444645446464464744648446494465044651446524465344654446554465644657446584465944660446614466244663446644466544666446674466844669446704467144672446734467444675446764467744678446794468044681446824468344684446854468644687446884468944690446914469244693446944469544696446974469844699447004470144702447034470444705447064470744708447094471044711447124471344714447154471644717447184471944720447214472244723447244472544726447274472844729447304473144732447334473444735447364473744738447394474044741447424474344744447454474644747447484474944750447514475244753447544475544756447574475844759447604476144762447634476444765447664476744768447694477044771447724477344774447754477644777447784477944780447814478244783447844478544786447874478844789447904479144792447934479444795447964479744798447994480044801448024480344804448054480644807448084480944810448114481244813448144481544816448174481844819448204482144822448234482444825448264482744828448294483044831448324483344834448354483644837448384483944840448414484244843448444484544846448474484844849448504485144852448534485444855448564485744858448594486044861448624486344864448654486644867448684486944870448714487244873448744487544876448774487844879448804488144882448834488444885448864488744888448894489044891448924489344894448954489644897448984489944900449014490244903449044490544906449074490844909449104491144912449134491444915449164491744918449194492044921449224492344924449254492644927449284492944930449314493244933449344493544936449374493844939449404494144942449434494444945449464494744948449494495044951449524495344954449554495644957449584495944960449614496244963449644496544966449674496844969449704497144972449734497444975449764497744978449794498044981449824498344984449854498644987449884498944990449914499244993449944499544996449974499844999450004500145002450034500445005450064500745008450094501045011450124501345014450154501645017450184501945020450214502245023450244502545026450274502845029450304503145032450334503445035450364503745038450394504045041450424504345044450454504645047450484504945050450514505245053450544505545056450574505845059450604506145062450634506445065450664506745068450694507045071450724507345074450754507645077450784507945080450814508245083450844508545086450874508845089450904509145092450934509445095450964509745098450994510045101451024510345104451054510645107451084510945110451114511245113451144511545116451174511845119451204512145122451234512445125451264512745128451294513045131451324513345134451354513645137451384513945140451414514245143451444514545146451474514845149451504515145152451534515445155451564515745158451594516045161451624516345164451654516645167451684516945170451714517245173451744517545176451774517845179451804518145182451834518445185451864518745188451894519045191451924519345194451954519645197451984519945200452014520245203452044520545206452074520845209452104521145212452134521445215452164521745218452194522045221452224522345224452254522645227452284522945230452314523245233452344523545236452374523845239452404524145242452434524445245452464524745248452494525045251452524525345254452554525645257452584525945260452614526245263452644526545266452674526845269452704527145272452734527445275452764527745278452794528045281452824528345284452854528645287452884528945290452914529245293452944529545296452974529845299453004530145302453034530445305453064530745308453094531045311453124531345314453154531645317453184531945320453214532245323453244532545326453274532845329453304533145332453334533445335453364533745338453394534045341453424534345344453454534645347453484534945350453514535245353453544535545356453574535845359453604536145362453634536445365453664536745368453694537045371453724537345374453754537645377453784537945380453814538245383453844538545386453874538845389453904539145392453934539445395453964539745398453994540045401454024540345404454054540645407454084540945410454114541245413454144541545416454174541845419454204542145422454234542445425454264542745428454294543045431454324543345434454354543645437454384543945440454414544245443454444544545446454474544845449454504545145452454534545445455454564545745458454594546045461454624546345464454654546645467454684546945470454714547245473454744547545476454774547845479454804548145482454834548445485454864548745488454894549045491454924549345494454954549645497454984549945500455014550245503455044550545506455074550845509455104551145512455134551445515455164551745518455194552045521455224552345524455254552645527455284552945530455314553245533455344553545536455374553845539455404554145542455434554445545455464554745548455494555045551455524555345554455554555645557455584555945560455614556245563455644556545566455674556845569455704557145572455734557445575455764557745578455794558045581455824558345584455854558645587455884558945590455914559245593455944559545596455974559845599456004560145602456034560445605456064560745608456094561045611456124561345614456154561645617456184561945620456214562245623456244562545626456274562845629456304563145632456334563445635456364563745638456394564045641456424564345644456454564645647456484564945650456514565245653456544565545656456574565845659456604566145662456634566445665456664566745668456694567045671456724567345674456754567645677456784567945680456814568245683456844568545686456874568845689456904569145692456934569445695456964569745698456994570045701457024570345704457054570645707457084570945710457114571245713457144571545716457174571845719457204572145722457234572445725457264572745728457294573045731457324573345734457354573645737457384573945740457414574245743457444574545746457474574845749457504575145752457534575445755457564575745758457594576045761457624576345764457654576645767457684576945770457714577245773457744577545776457774577845779457804578145782457834578445785457864578745788457894579045791457924579345794457954579645797457984579945800458014580245803458044580545806458074580845809458104581145812458134581445815458164581745818458194582045821458224582345824458254582645827458284582945830458314583245833458344583545836458374583845839458404584145842458434584445845458464584745848458494585045851458524585345854458554585645857458584585945860458614586245863458644586545866458674586845869458704587145872458734587445875458764587745878458794588045881458824588345884458854588645887458884588945890458914589245893458944589545896458974589845899459004590145902459034590445905459064590745908459094591045911459124591345914459154591645917459184591945920459214592245923459244592545926459274592845929459304593145932459334593445935459364593745938459394594045941459424594345944459454594645947459484594945950459514595245953459544595545956459574595845959459604596145962459634596445965459664596745968459694597045971459724597345974459754597645977459784597945980459814598245983459844598545986459874598845989459904599145992459934599445995459964599745998459994600046001460024600346004460054600646007460084600946010460114601246013460144601546016460174601846019460204602146022460234602446025460264602746028460294603046031460324603346034460354603646037460384603946040460414604246043460444604546046460474604846049460504605146052460534605446055460564605746058460594606046061460624606346064460654606646067460684606946070460714607246073460744607546076460774607846079460804608146082460834608446085460864608746088460894609046091460924609346094460954609646097460984609946100461014610246103461044610546106461074610846109461104611146112461134611446115461164611746118461194612046121461224612346124461254612646127461284612946130461314613246133461344613546136461374613846139461404614146142461434614446145461464614746148461494615046151461524615346154461554615646157461584615946160461614616246163461644616546166461674616846169461704617146172461734617446175461764617746178461794618046181461824618346184461854618646187461884618946190461914619246193461944619546196461974619846199462004620146202462034620446205462064620746208462094621046211462124621346214462154621646217462184621946220462214622246223462244622546226462274622846229462304623146232462334623446235462364623746238462394624046241462424624346244462454624646247462484624946250462514625246253462544625546256462574625846259462604626146262462634626446265462664626746268462694627046271462724627346274462754627646277462784627946280462814628246283462844628546286462874628846289462904629146292462934629446295462964629746298462994630046301463024630346304463054630646307463084630946310463114631246313463144631546316463174631846319463204632146322463234632446325463264632746328463294633046331463324633346334463354633646337463384633946340463414634246343463444634546346463474634846349463504635146352463534635446355463564635746358463594636046361463624636346364463654636646367463684636946370463714637246373463744637546376463774637846379463804638146382463834638446385463864638746388463894639046391463924639346394463954639646397463984639946400464014640246403464044640546406464074640846409464104641146412464134641446415464164641746418464194642046421464224642346424464254642646427464284642946430464314643246433464344643546436464374643846439464404644146442464434644446445464464644746448464494645046451464524645346454464554645646457464584645946460464614646246463464644646546466464674646846469464704647146472464734647446475464764647746478464794648046481464824648346484464854648646487464884648946490464914649246493464944649546496464974649846499465004650146502465034650446505465064650746508465094651046511465124651346514465154651646517465184651946520465214652246523465244652546526465274652846529465304653146532465334653446535465364653746538465394654046541465424654346544465454654646547465484654946550465514655246553465544655546556465574655846559465604656146562465634656446565465664656746568465694657046571465724657346574465754657646577465784657946580465814658246583465844658546586465874658846589465904659146592465934659446595465964659746598465994660046601466024660346604466054660646607466084660946610466114661246613466144661546616466174661846619466204662146622466234662446625466264662746628466294663046631466324663346634466354663646637466384663946640466414664246643466444664546646466474664846649466504665146652466534665446655466564665746658466594666046661466624666346664466654666646667466684666946670466714667246673466744667546676466774667846679466804668146682466834668446685466864668746688466894669046691466924669346694466954669646697466984669946700467014670246703467044670546706467074670846709467104671146712467134671446715467164671746718467194672046721467224672346724467254672646727467284672946730467314673246733467344673546736467374673846739467404674146742467434674446745467464674746748467494675046751467524675346754467554675646757467584675946760467614676246763467644676546766467674676846769467704677146772467734677446775467764677746778467794678046781467824678346784467854678646787467884678946790467914679246793467944679546796467974679846799468004680146802468034680446805468064680746808468094681046811468124681346814468154681646817468184681946820468214682246823468244682546826468274682846829468304683146832468334683446835468364683746838468394684046841468424684346844468454684646847468484684946850468514685246853468544685546856468574685846859468604686146862468634686446865468664686746868468694687046871468724687346874468754687646877468784687946880468814688246883468844688546886468874688846889468904689146892468934689446895468964689746898468994690046901469024690346904469054690646907469084690946910469114691246913469144691546916469174691846919469204692146922469234692446925469264692746928469294693046931469324693346934469354693646937469384693946940469414694246943469444694546946469474694846949469504695146952469534695446955469564695746958469594696046961469624696346964469654696646967469684696946970469714697246973469744697546976469774697846979469804698146982469834698446985469864698746988469894699046991469924699346994469954699646997469984699947000470014700247003470044700547006470074700847009470104701147012470134701447015470164701747018470194702047021470224702347024470254702647027470284702947030470314703247033470344703547036470374703847039470404704147042470434704447045470464704747048470494705047051470524705347054470554705647057470584705947060470614706247063470644706547066470674706847069470704707147072470734707447075470764707747078470794708047081470824708347084470854708647087470884708947090470914709247093470944709547096470974709847099471004710147102471034710447105471064710747108471094711047111471124711347114471154711647117471184711947120471214712247123471244712547126471274712847129471304713147132471334713447135471364713747138471394714047141471424714347144471454714647147471484714947150471514715247153471544715547156471574715847159471604716147162471634716447165471664716747168471694717047171471724717347174471754717647177471784717947180471814718247183471844718547186471874718847189471904719147192471934719447195471964719747198471994720047201472024720347204472054720647207472084720947210472114721247213472144721547216472174721847219472204722147222472234722447225472264722747228472294723047231472324723347234472354723647237472384723947240472414724247243472444724547246472474724847249472504725147252472534725447255472564725747258472594726047261472624726347264472654726647267472684726947270472714727247273472744727547276472774727847279472804728147282472834728447285472864728747288472894729047291472924729347294472954729647297472984729947300473014730247303473044730547306473074730847309473104731147312473134731447315473164731747318473194732047321473224732347324473254732647327473284732947330473314733247333473344733547336473374733847339473404734147342473434734447345473464734747348473494735047351473524735347354473554735647357473584735947360473614736247363473644736547366473674736847369473704737147372473734737447375473764737747378473794738047381473824738347384473854738647387473884738947390473914739247393473944739547396473974739847399474004740147402474034740447405474064740747408474094741047411474124741347414474154741647417474184741947420474214742247423474244742547426474274742847429474304743147432474334743447435474364743747438474394744047441474424744347444474454744647447474484744947450474514745247453474544745547456474574745847459474604746147462474634746447465474664746747468474694747047471474724747347474474754747647477474784747947480474814748247483474844748547486474874748847489474904749147492474934749447495474964749747498474994750047501475024750347504475054750647507475084750947510475114751247513475144751547516475174751847519475204752147522475234752447525475264752747528475294753047531475324753347534475354753647537475384753947540475414754247543475444754547546475474754847549475504755147552475534755447555475564755747558475594756047561475624756347564475654756647567475684756947570475714757247573475744757547576475774757847579475804758147582475834758447585475864758747588475894759047591475924759347594475954759647597475984759947600476014760247603476044760547606476074760847609476104761147612476134761447615476164761747618476194762047621476224762347624476254762647627476284762947630476314763247633476344763547636476374763847639476404764147642476434764447645476464764747648476494765047651476524765347654476554765647657476584765947660476614766247663476644766547666476674766847669476704767147672476734767447675476764767747678476794768047681476824768347684476854768647687476884768947690476914769247693476944769547696476974769847699477004770147702477034770447705477064770747708477094771047711477124771347714477154771647717477184771947720477214772247723477244772547726477274772847729477304773147732477334773447735477364773747738477394774047741477424774347744477454774647747477484774947750477514775247753477544775547756477574775847759477604776147762477634776447765477664776747768477694777047771477724777347774477754777647777477784777947780477814778247783477844778547786477874778847789477904779147792477934779447795477964779747798477994780047801478024780347804478054780647807478084780947810478114781247813478144781547816478174781847819478204782147822478234782447825478264782747828478294783047831478324783347834478354783647837478384783947840478414784247843478444784547846478474784847849478504785147852478534785447855478564785747858478594786047861478624786347864478654786647867478684786947870478714787247873478744787547876478774787847879478804788147882478834788447885478864788747888478894789047891478924789347894478954789647897478984789947900479014790247903479044790547906479074790847909479104791147912479134791447915479164791747918479194792047921479224792347924479254792647927479284792947930479314793247933479344793547936479374793847939479404794147942479434794447945479464794747948479494795047951479524795347954479554795647957479584795947960479614796247963479644796547966479674796847969479704797147972479734797447975479764797747978479794798047981479824798347984479854798647987479884798947990479914799247993479944799547996479974799847999480004800148002480034800448005480064800748008480094801048011480124801348014480154801648017480184801948020480214802248023480244802548026480274802848029480304803148032480334803448035480364803748038480394804048041480424804348044480454804648047480484804948050480514805248053480544805548056480574805848059480604806148062480634806448065480664806748068480694807048071480724807348074480754807648077480784807948080480814808248083480844808548086480874808848089480904809148092480934809448095480964809748098480994810048101481024810348104481054810648107481084810948110481114811248113481144811548116481174811848119481204812148122481234812448125481264812748128481294813048131481324813348134481354813648137481384813948140481414814248143481444814548146481474814848149481504815148152481534815448155481564815748158481594816048161481624816348164481654816648167481684816948170481714817248173481744817548176481774817848179481804818148182481834818448185481864818748188481894819048191481924819348194481954819648197481984819948200482014820248203482044820548206482074820848209482104821148212482134821448215482164821748218482194822048221482224822348224482254822648227482284822948230482314823248233482344823548236482374823848239482404824148242482434824448245482464824748248482494825048251482524825348254482554825648257482584825948260482614826248263482644826548266482674826848269482704827148272482734827448275482764827748278482794828048281482824828348284482854828648287482884828948290482914829248293482944829548296482974829848299483004830148302483034830448305483064830748308483094831048311483124831348314483154831648317483184831948320483214832248323483244832548326483274832848329483304833148332483334833448335483364833748338483394834048341483424834348344483454834648347483484834948350483514835248353483544835548356483574835848359483604836148362483634836448365483664836748368483694837048371483724837348374483754837648377483784837948380483814838248383483844838548386483874838848389483904839148392483934839448395483964839748398483994840048401484024840348404484054840648407484084840948410484114841248413484144841548416484174841848419484204842148422484234842448425484264842748428484294843048431484324843348434484354843648437484384843948440484414844248443484444844548446484474844848449484504845148452484534845448455484564845748458484594846048461484624846348464484654846648467484684846948470484714847248473484744847548476484774847848479484804848148482484834848448485484864848748488484894849048491484924849348494484954849648497484984849948500485014850248503485044850548506485074850848509485104851148512485134851448515485164851748518485194852048521485224852348524485254852648527485284852948530485314853248533485344853548536485374853848539485404854148542485434854448545485464854748548485494855048551485524855348554485554855648557485584855948560485614856248563485644856548566485674856848569485704857148572485734857448575485764857748578485794858048581485824858348584485854858648587485884858948590485914859248593485944859548596485974859848599486004860148602486034860448605486064860748608486094861048611486124861348614486154861648617486184861948620486214862248623486244862548626486274862848629486304863148632486334863448635486364863748638486394864048641486424864348644486454864648647486484864948650486514865248653486544865548656486574865848659486604866148662486634866448665486664866748668486694867048671486724867348674486754867648677486784867948680486814868248683486844868548686486874868848689486904869148692486934869448695486964869748698486994870048701487024870348704487054870648707487084870948710487114871248713487144871548716487174871848719487204872148722487234872448725487264872748728487294873048731487324873348734487354873648737487384873948740487414874248743487444874548746487474874848749487504875148752487534875448755487564875748758487594876048761487624876348764487654876648767487684876948770487714877248773487744877548776487774877848779487804878148782487834878448785487864878748788487894879048791487924879348794487954879648797487984879948800488014880248803488044880548806488074880848809488104881148812488134881448815488164881748818488194882048821488224882348824488254882648827488284882948830488314883248833488344883548836488374883848839488404884148842488434884448845488464884748848488494885048851488524885348854488554885648857488584885948860488614886248863488644886548866488674886848869488704887148872488734887448875488764887748878488794888048881488824888348884488854888648887488884888948890488914889248893488944889548896488974889848899489004890148902489034890448905489064890748908489094891048911489124891348914489154891648917489184891948920489214892248923489244892548926489274892848929489304893148932489334893448935489364893748938489394894048941489424894348944489454894648947489484894948950489514895248953489544895548956489574895848959489604896148962489634896448965489664896748968489694897048971489724897348974489754897648977489784897948980489814898248983489844898548986489874898848989489904899148992489934899448995489964899748998489994900049001490024900349004490054900649007490084900949010490114901249013490144901549016490174901849019490204902149022490234902449025490264902749028490294903049031490324903349034490354903649037490384903949040490414904249043490444904549046490474904849049490504905149052490534905449055490564905749058490594906049061490624906349064490654906649067490684906949070490714907249073490744907549076490774907849079490804908149082490834908449085490864908749088490894909049091490924909349094490954909649097490984909949100491014910249103491044910549106491074910849109491104911149112491134911449115491164911749118491194912049121491224912349124491254912649127491284912949130491314913249133491344913549136491374913849139491404914149142491434914449145491464914749148491494915049151491524915349154491554915649157491584915949160491614916249163491644916549166491674916849169491704917149172491734917449175491764917749178491794918049181491824918349184491854918649187491884918949190491914919249193491944919549196491974919849199492004920149202492034920449205492064920749208492094921049211492124921349214492154921649217492184921949220492214922249223492244922549226492274922849229492304923149232492334923449235492364923749238492394924049241492424924349244492454924649247492484924949250492514925249253492544925549256492574925849259492604926149262492634926449265492664926749268492694927049271492724927349274492754927649277492784927949280492814928249283492844928549286492874928849289492904929149292492934929449295492964929749298492994930049301493024930349304493054930649307493084930949310493114931249313493144931549316493174931849319493204932149322493234932449325493264932749328493294933049331493324933349334493354933649337493384933949340493414934249343493444934549346493474934849349493504935149352493534935449355493564935749358493594936049361493624936349364493654936649367493684936949370493714937249373493744937549376493774937849379493804938149382493834938449385493864938749388493894939049391493924939349394493954939649397493984939949400494014940249403494044940549406494074940849409494104941149412494134941449415494164941749418494194942049421494224942349424494254942649427494284942949430494314943249433494344943549436494374943849439494404944149442494434944449445494464944749448494494945049451494524945349454494554945649457494584945949460494614946249463494644946549466494674946849469494704947149472494734947449475494764947749478494794948049481494824948349484494854948649487494884948949490494914949249493494944949549496494974949849499495004950149502495034950449505495064950749508495094951049511495124951349514495154951649517495184951949520495214952249523495244952549526495274952849529495304953149532495334953449535495364953749538495394954049541495424954349544495454954649547495484954949550495514955249553495544955549556495574955849559495604956149562495634956449565495664956749568495694957049571495724957349574495754957649577495784957949580495814958249583495844958549586495874958849589495904959149592495934959449595495964959749598495994960049601496024960349604496054960649607496084960949610496114961249613496144961549616496174961849619496204962149622496234962449625496264962749628496294963049631496324963349634496354963649637496384963949640496414964249643496444964549646496474964849649496504965149652496534965449655496564965749658496594966049661496624966349664496654966649667496684966949670496714967249673496744967549676496774967849679496804968149682496834968449685496864968749688496894969049691496924969349694496954969649697496984969949700497014970249703497044970549706497074970849709497104971149712497134971449715497164971749718497194972049721497224972349724497254972649727497284972949730497314973249733497344973549736497374973849739497404974149742497434974449745497464974749748497494975049751497524975349754497554975649757497584975949760497614976249763497644976549766497674976849769497704977149772497734977449775497764977749778497794978049781497824978349784497854978649787497884978949790497914979249793497944979549796497974979849799498004980149802498034980449805498064980749808498094981049811498124981349814498154981649817498184981949820498214982249823498244982549826498274982849829498304983149832498334983449835498364983749838498394984049841498424984349844498454984649847498484984949850498514985249853498544985549856498574985849859498604986149862498634986449865498664986749868498694987049871498724987349874498754987649877498784987949880498814988249883498844988549886498874988849889498904989149892498934989449895498964989749898498994990049901499024990349904499054990649907499084990949910499114991249913499144991549916499174991849919499204992149922499234992449925499264992749928499294993049931499324993349934499354993649937499384993949940499414994249943499444994549946499474994849949499504995149952499534995449955499564995749958499594996049961499624996349964499654996649967499684996949970499714997249973499744997549976499774997849979499804998149982499834998449985499864998749988499894999049991499924999349994499954999649997499984999950000500015000250003500045000550006500075000850009500105001150012500135001450015500165001750018500195002050021500225002350024500255002650027500285002950030500315003250033500345003550036500375003850039500405004150042500435004450045500465004750048500495005050051500525005350054500555005650057500585005950060500615006250063500645006550066500675006850069500705007150072500735007450075500765007750078500795008050081500825008350084500855008650087500885008950090500915009250093500945009550096500975009850099501005010150102501035010450105501065010750108501095011050111501125011350114501155011650117501185011950120501215012250123501245012550126501275012850129501305013150132501335013450135501365013750138501395014050141501425014350144501455014650147501485014950150501515015250153501545015550156501575015850159501605016150162501635016450165501665016750168501695017050171501725017350174501755017650177501785017950180501815018250183501845018550186501875018850189501905019150192501935019450195501965019750198501995020050201502025020350204502055020650207502085020950210502115021250213502145021550216502175021850219502205022150222502235022450225502265022750228502295023050231502325023350234502355023650237502385023950240502415024250243502445024550246502475024850249502505025150252502535025450255502565025750258502595026050261502625026350264502655026650267502685026950270502715027250273502745027550276502775027850279502805028150282502835028450285502865028750288502895029050291502925029350294502955029650297502985029950300503015030250303503045030550306503075030850309503105031150312503135031450315503165031750318503195032050321503225032350324503255032650327503285032950330503315033250333503345033550336503375033850339503405034150342503435034450345503465034750348503495035050351503525035350354503555035650357503585035950360503615036250363503645036550366503675036850369503705037150372503735037450375503765037750378503795038050381503825038350384503855038650387503885038950390503915039250393503945039550396503975039850399504005040150402504035040450405504065040750408504095041050411504125041350414504155041650417504185041950420504215042250423504245042550426504275042850429504305043150432504335043450435504365043750438504395044050441504425044350444504455044650447504485044950450504515045250453504545045550456504575045850459504605046150462504635046450465504665046750468504695047050471504725047350474504755047650477504785047950480504815048250483504845048550486504875048850489504905049150492504935049450495504965049750498504995050050501505025050350504505055050650507505085050950510505115051250513505145051550516505175051850519505205052150522505235052450525505265052750528505295053050531505325053350534505355053650537505385053950540505415054250543505445054550546505475054850549505505055150552505535055450555505565055750558505595056050561505625056350564505655056650567505685056950570505715057250573505745057550576505775057850579505805058150582505835058450585505865058750588505895059050591505925059350594505955059650597505985059950600506015060250603506045060550606506075060850609506105061150612506135061450615506165061750618506195062050621506225062350624506255062650627506285062950630506315063250633506345063550636506375063850639506405064150642506435064450645506465064750648506495065050651506525065350654506555065650657506585065950660506615066250663506645066550666506675066850669506705067150672506735067450675506765067750678506795068050681506825068350684506855068650687506885068950690506915069250693506945069550696506975069850699507005070150702507035070450705507065070750708507095071050711507125071350714507155071650717507185071950720507215072250723507245072550726507275072850729507305073150732507335073450735507365073750738507395074050741507425074350744507455074650747507485074950750507515075250753507545075550756507575075850759507605076150762507635076450765507665076750768507695077050771507725077350774507755077650777507785077950780507815078250783507845078550786507875078850789507905079150792507935079450795507965079750798507995080050801508025080350804508055080650807508085080950810508115081250813508145081550816508175081850819508205082150822508235082450825508265082750828508295083050831508325083350834508355083650837508385083950840508415084250843508445084550846508475084850849508505085150852508535085450855508565085750858508595086050861508625086350864508655086650867508685086950870508715087250873508745087550876508775087850879508805088150882508835088450885508865088750888508895089050891508925089350894508955089650897508985089950900509015090250903509045090550906509075090850909509105091150912509135091450915509165091750918509195092050921509225092350924509255092650927509285092950930509315093250933509345093550936509375093850939509405094150942509435094450945509465094750948509495095050951509525095350954509555095650957509585095950960509615096250963509645096550966509675096850969509705097150972509735097450975509765097750978509795098050981509825098350984509855098650987509885098950990509915099250993509945099550996509975099850999510005100151002510035100451005510065100751008510095101051011510125101351014510155101651017510185101951020510215102251023510245102551026510275102851029510305103151032510335103451035510365103751038510395104051041510425104351044510455104651047510485104951050510515105251053510545105551056510575105851059510605106151062510635106451065510665106751068510695107051071510725107351074510755107651077510785107951080510815108251083510845108551086510875108851089510905109151092510935109451095510965109751098510995110051101511025110351104511055110651107511085110951110511115111251113511145111551116511175111851119511205112151122511235112451125511265112751128511295113051131511325113351134511355113651137511385113951140511415114251143511445114551146511475114851149511505115151152511535115451155511565115751158511595116051161511625116351164511655116651167511685116951170511715117251173511745117551176511775117851179511805118151182511835118451185511865118751188511895119051191511925119351194511955119651197511985119951200512015120251203512045120551206512075120851209512105121151212512135121451215512165121751218512195122051221512225122351224512255122651227512285122951230512315123251233512345123551236512375123851239512405124151242512435124451245512465124751248512495125051251512525125351254512555125651257512585125951260512615126251263512645126551266512675126851269512705127151272512735127451275512765127751278512795128051281512825128351284512855128651287512885128951290512915129251293512945129551296512975129851299513005130151302513035130451305513065130751308513095131051311513125131351314513155131651317513185131951320513215132251323513245132551326513275132851329513305133151332513335133451335513365133751338513395134051341513425134351344513455134651347513485134951350513515135251353513545135551356513575135851359513605136151362513635136451365513665136751368513695137051371513725137351374513755137651377513785137951380513815138251383513845138551386513875138851389513905139151392513935139451395513965139751398513995140051401514025140351404514055140651407514085140951410514115141251413514145141551416514175141851419514205142151422514235142451425514265142751428514295143051431514325143351434514355143651437514385143951440514415144251443514445144551446514475144851449514505145151452514535145451455514565145751458514595146051461514625146351464514655146651467514685146951470514715147251473514745147551476514775147851479514805148151482514835148451485514865148751488514895149051491514925149351494514955149651497514985149951500515015150251503515045150551506515075150851509515105151151512515135151451515515165151751518515195152051521515225152351524515255152651527515285152951530515315153251533515345153551536515375153851539515405154151542515435154451545515465154751548515495155051551515525155351554515555155651557515585155951560515615156251563515645156551566515675156851569515705157151572515735157451575515765157751578515795158051581515825158351584515855158651587515885158951590515915159251593515945159551596515975159851599516005160151602516035160451605516065160751608516095161051611516125161351614516155161651617516185161951620516215162251623516245162551626516275162851629516305163151632516335163451635516365163751638516395164051641516425164351644516455164651647516485164951650516515165251653516545165551656516575165851659516605166151662516635166451665516665166751668516695167051671516725167351674516755167651677516785167951680516815168251683516845168551686516875168851689516905169151692516935169451695516965169751698516995170051701517025170351704517055170651707517085170951710517115171251713517145171551716517175171851719517205172151722517235172451725517265172751728517295173051731517325173351734517355173651737517385173951740517415174251743517445174551746517475174851749517505175151752517535175451755517565175751758517595176051761517625176351764517655176651767517685176951770517715177251773517745177551776517775177851779517805178151782517835178451785517865178751788517895179051791517925179351794517955179651797517985179951800518015180251803518045180551806518075180851809518105181151812518135181451815518165181751818518195182051821518225182351824518255182651827518285182951830518315183251833518345183551836518375183851839518405184151842518435184451845518465184751848518495185051851518525185351854518555185651857518585185951860518615186251863518645186551866518675186851869518705187151872518735187451875518765187751878518795188051881518825188351884518855188651887518885188951890518915189251893518945189551896518975189851899519005190151902519035190451905519065190751908519095191051911519125191351914519155191651917519185191951920519215192251923519245192551926519275192851929519305193151932519335193451935519365193751938519395194051941519425194351944519455194651947519485194951950519515195251953519545195551956519575195851959519605196151962519635196451965519665196751968519695197051971519725197351974519755197651977519785197951980519815198251983519845198551986519875198851989519905199151992519935199451995519965199751998519995200052001520025200352004520055200652007520085200952010520115201252013520145201552016520175201852019520205202152022520235202452025520265202752028520295203052031520325203352034520355203652037520385203952040520415204252043520445204552046520475204852049520505205152052520535205452055520565205752058520595206052061520625206352064520655206652067520685206952070520715207252073520745207552076520775207852079520805208152082520835208452085520865208752088520895209052091520925209352094520955209652097520985209952100521015210252103521045210552106521075210852109521105211152112521135211452115521165211752118521195212052121521225212352124521255212652127521285212952130521315213252133521345213552136521375213852139521405214152142521435214452145521465214752148521495215052151521525215352154521555215652157521585215952160521615216252163521645216552166521675216852169521705217152172521735217452175521765217752178521795218052181521825218352184521855218652187521885218952190521915219252193521945219552196521975219852199522005220152202522035220452205522065220752208522095221052211522125221352214522155221652217522185221952220522215222252223522245222552226522275222852229522305223152232522335223452235522365223752238522395224052241522425224352244522455224652247522485224952250522515225252253522545225552256522575225852259522605226152262522635226452265522665226752268522695227052271522725227352274522755227652277522785227952280522815228252283522845228552286522875228852289522905229152292522935229452295522965229752298522995230052301523025230352304523055230652307523085230952310523115231252313523145231552316523175231852319523205232152322523235232452325523265232752328523295233052331523325233352334523355233652337523385233952340523415234252343523445234552346523475234852349523505235152352523535235452355523565235752358523595236052361523625236352364523655236652367523685236952370523715237252373523745237552376523775237852379523805238152382523835238452385523865238752388523895239052391523925239352394523955239652397523985239952400524015240252403524045240552406524075240852409524105241152412524135241452415524165241752418524195242052421524225242352424524255242652427524285242952430524315243252433524345243552436524375243852439524405244152442524435244452445524465244752448524495245052451524525245352454524555245652457524585245952460524615246252463524645246552466524675246852469524705247152472524735247452475524765247752478524795248052481524825248352484524855248652487524885248952490524915249252493524945249552496524975249852499525005250152502525035250452505525065250752508525095251052511525125251352514525155251652517525185251952520525215252252523525245252552526525275252852529525305253152532525335253452535525365253752538525395254052541525425254352544525455254652547525485254952550525515255252553525545255552556525575255852559525605256152562525635256452565525665256752568525695257052571525725257352574525755257652577525785257952580525815258252583525845258552586525875258852589525905259152592525935259452595525965259752598525995260052601526025260352604526055260652607526085260952610526115261252613526145261552616526175261852619526205262152622526235262452625526265262752628526295263052631526325263352634526355263652637526385263952640526415264252643526445264552646526475264852649526505265152652526535265452655526565265752658526595266052661526625266352664526655266652667526685266952670526715267252673526745267552676526775267852679526805268152682526835268452685526865268752688526895269052691526925269352694526955269652697526985269952700527015270252703527045270552706527075270852709527105271152712527135271452715527165271752718527195272052721527225272352724527255272652727527285272952730527315273252733527345273552736527375273852739527405274152742527435274452745527465274752748527495275052751527525275352754527555275652757527585275952760527615276252763527645276552766527675276852769527705277152772527735277452775527765277752778527795278052781527825278352784527855278652787527885278952790527915279252793527945279552796527975279852799528005280152802528035280452805528065280752808528095281052811528125281352814528155281652817528185281952820528215282252823528245282552826528275282852829528305283152832528335283452835528365283752838528395284052841528425284352844528455284652847528485284952850528515285252853528545285552856528575285852859528605286152862528635286452865528665286752868528695287052871528725287352874528755287652877528785287952880528815288252883528845288552886528875288852889528905289152892528935289452895528965289752898528995290052901529025290352904529055290652907529085290952910529115291252913529145291552916529175291852919529205292152922529235292452925529265292752928529295293052931529325293352934529355293652937529385293952940529415294252943529445294552946529475294852949529505295152952529535295452955529565295752958529595296052961529625296352964529655296652967529685296952970529715297252973529745297552976529775297852979529805298152982529835298452985529865298752988529895299052991529925299352994529955299652997529985299953000530015300253003530045300553006530075300853009530105301153012530135301453015530165301753018530195302053021530225302353024530255302653027530285302953030530315303253033530345303553036530375303853039530405304153042530435304453045530465304753048530495305053051530525305353054530555305653057530585305953060530615306253063530645306553066530675306853069530705307153072530735307453075530765307753078530795308053081530825308353084530855308653087530885308953090530915309253093530945309553096530975309853099531005310153102531035310453105531065310753108531095311053111531125311353114531155311653117531185311953120531215312253123531245312553126531275312853129531305313153132531335313453135531365313753138531395314053141531425314353144531455314653147531485314953150531515315253153531545315553156531575315853159531605316153162531635316453165531665316753168531695317053171531725317353174531755317653177531785317953180531815318253183531845318553186531875318853189531905319153192531935319453195531965319753198531995320053201532025320353204532055320653207532085320953210532115321253213532145321553216532175321853219532205322153222532235322453225532265322753228532295323053231532325323353234532355323653237532385323953240532415324253243532445324553246532475324853249532505325153252532535325453255532565325753258532595326053261532625326353264532655326653267532685326953270532715327253273532745327553276532775327853279532805328153282532835328453285532865328753288532895329053291532925329353294532955329653297532985329953300533015330253303533045330553306533075330853309533105331153312533135331453315533165331753318533195332053321533225332353324533255332653327533285332953330533315333253333533345333553336533375333853339533405334153342533435334453345533465334753348533495335053351533525335353354533555335653357533585335953360533615336253363533645336553366533675336853369533705337153372533735337453375533765337753378533795338053381533825338353384533855338653387533885338953390533915339253393533945339553396533975339853399534005340153402534035340453405534065340753408534095341053411534125341353414534155341653417534185341953420534215342253423534245342553426534275342853429534305343153432534335343453435534365343753438534395344053441534425344353444534455344653447534485344953450534515345253453534545345553456534575345853459534605346153462534635346453465534665346753468534695347053471534725347353474534755347653477534785347953480534815348253483534845348553486534875348853489534905349153492534935349453495534965349753498534995350053501535025350353504535055350653507535085350953510535115351253513535145351553516535175351853519535205352153522535235352453525535265352753528535295353053531535325353353534535355353653537535385353953540535415354253543535445354553546535475354853549535505355153552535535355453555535565355753558535595356053561535625356353564535655356653567535685356953570535715357253573535745357553576535775357853579535805358153582535835358453585535865358753588535895359053591535925359353594535955359653597535985359953600536015360253603536045360553606536075360853609536105361153612536135361453615536165361753618536195362053621536225362353624536255362653627536285362953630536315363253633536345363553636536375363853639536405364153642536435364453645536465364753648536495365053651536525365353654536555365653657536585365953660536615366253663536645366553666536675366853669536705367153672536735367453675536765367753678536795368053681536825368353684536855368653687536885368953690536915369253693536945369553696536975369853699537005370153702537035370453705537065370753708537095371053711537125371353714537155371653717537185371953720537215372253723537245372553726537275372853729537305373153732537335373453735537365373753738537395374053741537425374353744537455374653747537485374953750537515375253753537545375553756537575375853759537605376153762537635376453765537665376753768537695377053771537725377353774537755377653777537785377953780537815378253783537845378553786537875378853789537905379153792537935379453795537965379753798537995380053801538025380353804538055380653807538085380953810538115381253813538145381553816538175381853819538205382153822538235382453825538265382753828538295383053831538325383353834538355383653837538385383953840538415384253843538445384553846538475384853849538505385153852538535385453855538565385753858538595386053861538625386353864538655386653867538685386953870538715387253873538745387553876538775387853879538805388153882538835388453885538865388753888538895389053891538925389353894538955389653897538985389953900539015390253903539045390553906539075390853909539105391153912539135391453915539165391753918539195392053921539225392353924539255392653927539285392953930539315393253933539345393553936539375393853939539405394153942539435394453945539465394753948539495395053951539525395353954539555395653957539585395953960539615396253963539645396553966539675396853969539705397153972539735397453975539765397753978539795398053981539825398353984539855398653987539885398953990539915399253993539945399553996539975399853999540005400154002540035400454005540065400754008540095401054011540125401354014540155401654017540185401954020540215402254023540245402554026540275402854029540305403154032540335403454035540365403754038540395404054041540425404354044540455404654047540485404954050540515405254053540545405554056540575405854059540605406154062540635406454065540665406754068540695407054071540725407354074540755407654077540785407954080540815408254083540845408554086540875408854089540905409154092540935409454095540965409754098540995410054101541025410354104541055410654107541085410954110541115411254113541145411554116541175411854119541205412154122541235412454125541265412754128541295413054131541325413354134541355413654137541385413954140541415414254143541445414554146541475414854149541505415154152541535415454155541565415754158541595416054161541625416354164541655416654167541685416954170541715417254173541745417554176541775417854179541805418154182541835418454185541865418754188541895419054191541925419354194541955419654197541985419954200542015420254203542045420554206542075420854209542105421154212542135421454215542165421754218542195422054221542225422354224542255422654227542285422954230542315423254233542345423554236542375423854239542405424154242542435424454245542465424754248542495425054251542525425354254542555425654257542585425954260542615426254263542645426554266542675426854269542705427154272542735427454275542765427754278542795428054281542825428354284542855428654287542885428954290542915429254293542945429554296542975429854299543005430154302543035430454305543065430754308543095431054311543125431354314543155431654317543185431954320543215432254323543245432554326543275432854329543305433154332543335433454335543365433754338543395434054341543425434354344543455434654347543485434954350543515435254353543545435554356543575435854359543605436154362543635436454365543665436754368543695437054371543725437354374543755437654377543785437954380543815438254383543845438554386543875438854389543905439154392543935439454395543965439754398543995440054401544025440354404544055440654407544085440954410544115441254413544145441554416544175441854419544205442154422544235442454425544265442754428544295443054431544325443354434544355443654437544385443954440544415444254443544445444554446544475444854449544505445154452544535445454455544565445754458544595446054461544625446354464544655446654467544685446954470544715447254473544745447554476544775447854479544805448154482544835448454485544865448754488544895449054491544925449354494544955449654497544985449954500545015450254503545045450554506545075450854509545105451154512545135451454515545165451754518545195452054521545225452354524545255452654527545285452954530545315453254533545345453554536545375453854539545405454154542545435454454545545465454754548545495455054551545525455354554545555455654557545585455954560545615456254563545645456554566545675456854569545705457154572545735457454575545765457754578545795458054581545825458354584545855458654587545885458954590545915459254593545945459554596545975459854599546005460154602546035460454605546065460754608546095461054611546125461354614546155461654617546185461954620546215462254623546245462554626546275462854629546305463154632546335463454635546365463754638546395464054641546425464354644546455464654647546485464954650546515465254653546545465554656546575465854659546605466154662546635466454665546665466754668546695467054671546725467354674546755467654677546785467954680546815468254683546845468554686546875468854689546905469154692546935469454695546965469754698546995470054701547025470354704547055470654707547085470954710547115471254713547145471554716547175471854719547205472154722547235472454725547265472754728547295473054731547325473354734547355473654737547385473954740547415474254743547445474554746547475474854749547505475154752547535475454755547565475754758547595476054761547625476354764547655476654767547685476954770547715477254773547745477554776547775477854779547805478154782547835478454785547865478754788547895479054791547925479354794547955479654797547985479954800548015480254803548045480554806548075480854809548105481154812548135481454815548165481754818548195482054821548225482354824548255482654827548285482954830548315483254833548345483554836548375483854839548405484154842548435484454845548465484754848548495485054851548525485354854548555485654857548585485954860548615486254863548645486554866548675486854869548705487154872548735487454875548765487754878548795488054881548825488354884548855488654887548885488954890548915489254893548945489554896548975489854899549005490154902549035490454905549065490754908549095491054911549125491354914549155491654917549185491954920549215492254923549245492554926549275492854929549305493154932549335493454935549365493754938549395494054941549425494354944549455494654947549485494954950549515495254953549545495554956549575495854959549605496154962549635496454965549665496754968549695497054971549725497354974549755497654977549785497954980549815498254983549845498554986549875498854989549905499154992549935499454995549965499754998549995500055001550025500355004550055500655007550085500955010550115501255013550145501555016550175501855019550205502155022550235502455025550265502755028550295503055031550325503355034550355503655037550385503955040550415504255043550445504555046550475504855049550505505155052550535505455055550565505755058550595506055061550625506355064550655506655067550685506955070550715507255073550745507555076550775507855079550805508155082550835508455085550865508755088550895509055091550925509355094550955509655097550985509955100551015510255103551045510555106551075510855109551105511155112551135511455115551165511755118551195512055121551225512355124551255512655127551285512955130551315513255133551345513555136551375513855139551405514155142551435514455145551465514755148551495515055151551525515355154551555515655157551585515955160551615516255163551645516555166551675516855169551705517155172551735517455175551765517755178551795518055181551825518355184551855518655187551885518955190551915519255193551945519555196551975519855199552005520155202552035520455205552065520755208552095521055211552125521355214552155521655217552185521955220552215522255223552245522555226552275522855229552305523155232552335523455235552365523755238552395524055241552425524355244552455524655247552485524955250552515525255253552545525555256552575525855259552605526155262552635526455265552665526755268552695527055271552725527355274552755527655277552785527955280552815528255283552845528555286552875528855289552905529155292552935529455295552965529755298552995530055301553025530355304553055530655307553085530955310553115531255313553145531555316553175531855319553205532155322553235532455325553265532755328553295533055331553325533355334553355533655337553385533955340553415534255343553445534555346553475534855349553505535155352553535535455355553565535755358553595536055361553625536355364553655536655367553685536955370553715537255373553745537555376553775537855379553805538155382553835538455385553865538755388553895539055391553925539355394553955539655397553985539955400554015540255403554045540555406554075540855409554105541155412554135541455415554165541755418554195542055421554225542355424554255542655427554285542955430554315543255433554345543555436554375543855439554405544155442554435544455445554465544755448554495545055451554525545355454554555545655457554585545955460554615546255463554645546555466554675546855469554705547155472554735547455475554765547755478554795548055481554825548355484554855548655487554885548955490554915549255493554945549555496554975549855499555005550155502555035550455505555065550755508555095551055511555125551355514555155551655517555185551955520555215552255523555245552555526555275552855529555305553155532555335553455535555365553755538555395554055541555425554355544555455554655547555485554955550555515555255553555545555555556555575555855559555605556155562555635556455565555665556755568555695557055571555725557355574555755557655577555785557955580555815558255583555845558555586555875558855589555905559155592555935559455595555965559755598555995560055601556025560355604556055560655607556085560955610556115561255613556145561555616556175561855619556205562155622556235562455625556265562755628556295563055631556325563355634556355563655637556385563955640556415564255643556445564555646556475564855649556505565155652556535565455655556565565755658556595566055661556625566355664556655566655667556685566955670556715567255673556745567555676556775567855679556805568155682556835568455685556865568755688556895569055691556925569355694556955569655697556985569955700557015570255703557045570555706557075570855709557105571155712557135571455715557165571755718557195572055721557225572355724557255572655727557285572955730557315573255733557345573555736557375573855739557405574155742557435574455745557465574755748557495575055751557525575355754557555575655757557585575955760557615576255763557645576555766557675576855769557705577155772557735577455775557765577755778557795578055781557825578355784557855578655787557885578955790557915579255793557945579555796557975579855799558005580155802558035580455805558065580755808558095581055811558125581355814558155581655817558185581955820558215582255823558245582555826558275582855829558305583155832558335583455835558365583755838558395584055841558425584355844558455584655847558485584955850558515585255853558545585555856558575585855859558605586155862558635586455865558665586755868558695587055871558725587355874558755587655877558785587955880558815588255883558845588555886558875588855889558905589155892558935589455895558965589755898558995590055901559025590355904559055590655907559085590955910559115591255913559145591555916559175591855919559205592155922559235592455925559265592755928559295593055931559325593355934559355593655937559385593955940559415594255943559445594555946559475594855949559505595155952559535595455955559565595755958559595596055961559625596355964559655596655967559685596955970559715597255973559745597555976559775597855979559805598155982559835598455985559865598755988559895599055991559925599355994559955599655997559985599956000560015600256003560045600556006560075600856009560105601156012560135601456015560165601756018560195602056021560225602356024560255602656027560285602956030560315603256033560345603556036560375603856039560405604156042560435604456045560465604756048560495605056051560525605356054560555605656057560585605956060560615606256063560645606556066560675606856069560705607156072560735607456075560765607756078560795608056081560825608356084560855608656087560885608956090560915609256093560945609556096560975609856099561005610156102561035610456105561065610756108561095611056111561125611356114561155611656117561185611956120561215612256123561245612556126561275612856129561305613156132561335613456135561365613756138561395614056141561425614356144561455614656147561485614956150561515615256153561545615556156561575615856159561605616156162561635616456165561665616756168561695617056171561725617356174561755617656177561785617956180561815618256183561845618556186561875618856189561905619156192561935619456195561965619756198561995620056201562025620356204562055620656207562085620956210562115621256213562145621556216562175621856219562205622156222562235622456225562265622756228562295623056231562325623356234562355623656237562385623956240562415624256243562445624556246562475624856249562505625156252562535625456255562565625756258562595626056261562625626356264562655626656267562685626956270562715627256273562745627556276562775627856279562805628156282562835628456285562865628756288562895629056291562925629356294562955629656297562985629956300563015630256303563045630556306563075630856309563105631156312563135631456315563165631756318563195632056321563225632356324563255632656327563285632956330563315633256333563345633556336563375633856339563405634156342563435634456345563465634756348563495635056351563525635356354563555635656357563585635956360563615636256363563645636556366563675636856369563705637156372563735637456375563765637756378563795638056381563825638356384563855638656387563885638956390563915639256393563945639556396563975639856399564005640156402564035640456405564065640756408564095641056411564125641356414564155641656417564185641956420564215642256423564245642556426564275642856429564305643156432564335643456435564365643756438564395644056441564425644356444564455644656447564485644956450564515645256453564545645556456564575645856459564605646156462564635646456465564665646756468564695647056471564725647356474564755647656477564785647956480564815648256483564845648556486564875648856489564905649156492564935649456495564965649756498564995650056501565025650356504565055650656507565085650956510565115651256513565145651556516565175651856519565205652156522565235652456525565265652756528565295653056531565325653356534565355653656537565385653956540565415654256543565445654556546565475654856549565505655156552565535655456555565565655756558565595656056561565625656356564565655656656567565685656956570565715657256573565745657556576565775657856579565805658156582565835658456585565865658756588565895659056591565925659356594565955659656597565985659956600566015660256603566045660556606566075660856609566105661156612566135661456615566165661756618566195662056621566225662356624566255662656627566285662956630566315663256633566345663556636566375663856639566405664156642566435664456645566465664756648566495665056651566525665356654566555665656657566585665956660566615666256663566645666556666566675666856669566705667156672566735667456675566765667756678566795668056681566825668356684566855668656687566885668956690566915669256693566945669556696566975669856699567005670156702567035670456705567065670756708567095671056711567125671356714567155671656717567185671956720567215672256723567245672556726567275672856729567305673156732567335673456735567365673756738567395674056741567425674356744567455674656747567485674956750567515675256753567545675556756567575675856759567605676156762567635676456765567665676756768567695677056771567725677356774567755677656777567785677956780567815678256783567845678556786567875678856789567905679156792567935679456795567965679756798567995680056801568025680356804568055680656807568085680956810568115681256813568145681556816568175681856819568205682156822568235682456825568265682756828568295683056831568325683356834568355683656837568385683956840568415684256843568445684556846568475684856849568505685156852568535685456855568565685756858568595686056861568625686356864568655686656867568685686956870568715687256873568745687556876568775687856879568805688156882568835688456885568865688756888568895689056891568925689356894568955689656897568985689956900569015690256903569045690556906569075690856909569105691156912569135691456915569165691756918569195692056921569225692356924569255692656927569285692956930569315693256933569345693556936569375693856939569405694156942569435694456945569465694756948569495695056951569525695356954569555695656957569585695956960569615696256963569645696556966569675696856969569705697156972569735697456975569765697756978569795698056981569825698356984569855698656987569885698956990569915699256993569945699556996569975699856999570005700157002570035700457005570065700757008570095701057011570125701357014570155701657017570185701957020570215702257023570245702557026570275702857029570305703157032570335703457035570365703757038570395704057041570425704357044570455704657047570485704957050570515705257053570545705557056570575705857059570605706157062570635706457065570665706757068570695707057071570725707357074570755707657077570785707957080570815708257083570845708557086570875708857089570905709157092570935709457095570965709757098570995710057101571025710357104571055710657107571085710957110571115711257113571145711557116571175711857119571205712157122571235712457125571265712757128571295713057131571325713357134571355713657137571385713957140571415714257143571445714557146571475714857149571505715157152571535715457155571565715757158571595716057161571625716357164571655716657167571685716957170571715717257173571745717557176571775717857179571805718157182571835718457185571865718757188571895719057191571925719357194571955719657197571985719957200572015720257203572045720557206572075720857209572105721157212572135721457215572165721757218572195722057221572225722357224572255722657227572285722957230572315723257233572345723557236572375723857239572405724157242572435724457245572465724757248572495725057251572525725357254572555725657257572585725957260572615726257263572645726557266572675726857269572705727157272572735727457275572765727757278572795728057281572825728357284572855728657287572885728957290572915729257293572945729557296572975729857299573005730157302573035730457305573065730757308573095731057311573125731357314573155731657317573185731957320573215732257323573245732557326573275732857329573305733157332573335733457335573365733757338573395734057341573425734357344573455734657347573485734957350573515735257353573545735557356573575735857359573605736157362573635736457365573665736757368573695737057371573725737357374573755737657377573785737957380573815738257383573845738557386573875738857389573905739157392573935739457395573965739757398573995740057401574025740357404574055740657407574085740957410574115741257413574145741557416574175741857419574205742157422574235742457425574265742757428574295743057431574325743357434574355743657437574385743957440574415744257443574445744557446574475744857449574505745157452574535745457455574565745757458574595746057461574625746357464574655746657467574685746957470574715747257473574745747557476574775747857479574805748157482574835748457485574865748757488574895749057491574925749357494574955749657497574985749957500575015750257503575045750557506575075750857509575105751157512575135751457515575165751757518575195752057521575225752357524575255752657527575285752957530575315753257533575345753557536575375753857539575405754157542575435754457545575465754757548575495755057551575525755357554575555755657557575585755957560575615756257563575645756557566575675756857569575705757157572575735757457575575765757757578575795758057581575825758357584575855758657587575885758957590575915759257593575945759557596575975759857599576005760157602576035760457605576065760757608576095761057611576125761357614576155761657617576185761957620576215762257623576245762557626576275762857629576305763157632576335763457635576365763757638576395764057641576425764357644576455764657647576485764957650576515765257653576545765557656576575765857659576605766157662576635766457665576665766757668576695767057671576725767357674576755767657677576785767957680576815768257683576845768557686576875768857689576905769157692576935769457695576965769757698576995770057701577025770357704577055770657707577085770957710577115771257713577145771557716577175771857719577205772157722577235772457725577265772757728577295773057731577325773357734577355773657737577385773957740577415774257743577445774557746577475774857749577505775157752577535775457755577565775757758577595776057761577625776357764577655776657767577685776957770577715777257773577745777557776577775777857779577805778157782577835778457785577865778757788577895779057791577925779357794577955779657797577985779957800578015780257803578045780557806578075780857809578105781157812578135781457815578165781757818578195782057821578225782357824578255782657827578285782957830578315783257833578345783557836578375783857839578405784157842578435784457845578465784757848578495785057851578525785357854578555785657857578585785957860578615786257863578645786557866578675786857869578705787157872578735787457875578765787757878578795788057881578825788357884578855788657887578885788957890578915789257893578945789557896578975789857899579005790157902579035790457905579065790757908579095791057911579125791357914579155791657917579185791957920579215792257923579245792557926579275792857929579305793157932579335793457935579365793757938579395794057941579425794357944579455794657947579485794957950579515795257953579545795557956579575795857959579605796157962579635796457965579665796757968579695797057971579725797357974579755797657977579785797957980579815798257983579845798557986579875798857989579905799157992579935799457995579965799757998579995800058001580025800358004580055800658007580085800958010580115801258013580145801558016580175801858019580205802158022580235802458025580265802758028580295803058031580325803358034580355803658037580385803958040580415804258043580445804558046580475804858049580505805158052580535805458055580565805758058580595806058061580625806358064580655806658067580685806958070580715807258073580745807558076580775807858079580805808158082580835808458085580865808758088580895809058091580925809358094580955809658097580985809958100581015810258103581045810558106581075810858109581105811158112581135811458115581165811758118581195812058121581225812358124581255812658127581285812958130581315813258133581345813558136581375813858139581405814158142581435814458145581465814758148581495815058151581525815358154581555815658157581585815958160581615816258163581645816558166581675816858169581705817158172581735817458175581765817758178581795818058181581825818358184581855818658187581885818958190581915819258193581945819558196581975819858199582005820158202582035820458205582065820758208582095821058211582125821358214582155821658217582185821958220582215822258223582245822558226582275822858229582305823158232582335823458235582365823758238582395824058241582425824358244582455824658247582485824958250582515825258253582545825558256582575825858259582605826158262582635826458265582665826758268582695827058271582725827358274582755827658277582785827958280582815828258283582845828558286582875828858289582905829158292582935829458295582965829758298582995830058301583025830358304583055830658307583085830958310583115831258313583145831558316583175831858319583205832158322583235832458325583265832758328583295833058331583325833358334583355833658337583385833958340583415834258343583445834558346583475834858349583505835158352583535835458355583565835758358583595836058361583625836358364583655836658367583685836958370583715837258373583745837558376583775837858379583805838158382583835838458385583865838758388583895839058391583925839358394583955839658397583985839958400584015840258403584045840558406584075840858409584105841158412584135841458415584165841758418584195842058421584225842358424584255842658427584285842958430584315843258433584345843558436584375843858439584405844158442584435844458445584465844758448584495845058451584525845358454584555845658457584585845958460584615846258463584645846558466584675846858469584705847158472584735847458475584765847758478584795848058481584825848358484584855848658487584885848958490584915849258493584945849558496584975849858499585005850158502585035850458505585065850758508585095851058511585125851358514585155851658517585185851958520585215852258523585245852558526585275852858529585305853158532585335853458535585365853758538585395854058541585425854358544585455854658547585485854958550585515855258553585545855558556585575855858559585605856158562585635856458565585665856758568585695857058571585725857358574585755857658577585785857958580585815858258583585845858558586585875858858589585905859158592585935859458595585965859758598585995860058601586025860358604586055860658607586085860958610586115861258613586145861558616586175861858619586205862158622586235862458625586265862758628586295863058631586325863358634586355863658637586385863958640586415864258643586445864558646586475864858649586505865158652586535865458655586565865758658586595866058661586625866358664586655866658667586685866958670586715867258673586745867558676586775867858679586805868158682586835868458685586865868758688586895869058691586925869358694586955869658697586985869958700587015870258703587045870558706587075870858709587105871158712587135871458715587165871758718587195872058721587225872358724587255872658727587285872958730587315873258733587345873558736587375873858739587405874158742587435874458745587465874758748587495875058751587525875358754587555875658757587585875958760587615876258763587645876558766587675876858769587705877158772587735877458775587765877758778587795878058781587825878358784587855878658787587885878958790587915879258793587945879558796587975879858799588005880158802588035880458805588065880758808588095881058811588125881358814588155881658817588185881958820588215882258823588245882558826588275882858829588305883158832588335883458835588365883758838588395884058841588425884358844588455884658847588485884958850588515885258853588545885558856588575885858859588605886158862588635886458865588665886758868588695887058871588725887358874588755887658877588785887958880588815888258883588845888558886588875888858889588905889158892588935889458895588965889758898588995890058901589025890358904589055890658907589085890958910589115891258913589145891558916589175891858919589205892158922589235892458925589265892758928589295893058931589325893358934589355893658937589385893958940589415894258943589445894558946589475894858949589505895158952589535895458955589565895758958589595896058961589625896358964589655896658967589685896958970589715897258973589745897558976589775897858979589805898158982589835898458985589865898758988589895899058991589925899358994589955899658997589985899959000590015900259003590045900559006590075900859009590105901159012590135901459015590165901759018590195902059021590225902359024590255902659027590285902959030590315903259033590345903559036590375903859039590405904159042590435904459045590465904759048590495905059051590525905359054590555905659057590585905959060590615906259063590645906559066590675906859069590705907159072590735907459075590765907759078590795908059081590825908359084590855908659087590885908959090590915909259093590945909559096590975909859099591005910159102591035910459105591065910759108591095911059111591125911359114591155911659117591185911959120591215912259123591245912559126591275912859129591305913159132591335913459135591365913759138591395914059141591425914359144591455914659147591485914959150591515915259153591545915559156591575915859159591605916159162591635916459165591665916759168591695917059171591725917359174591755917659177591785917959180591815918259183591845918559186591875918859189591905919159192591935919459195591965919759198591995920059201592025920359204592055920659207592085920959210592115921259213592145921559216592175921859219592205922159222592235922459225592265922759228592295923059231592325923359234592355923659237592385923959240592415924259243592445924559246592475924859249592505925159252592535925459255592565925759258592595926059261592625926359264592655926659267592685926959270592715927259273592745927559276592775927859279592805928159282592835928459285592865928759288592895929059291592925929359294592955929659297592985929959300593015930259303593045930559306593075930859309593105931159312593135931459315593165931759318593195932059321593225932359324593255932659327593285932959330593315933259333593345933559336593375933859339593405934159342593435934459345593465934759348593495935059351593525935359354593555935659357593585935959360593615936259363593645936559366593675936859369593705937159372593735937459375593765937759378593795938059381593825938359384593855938659387593885938959390593915939259393593945939559396593975939859399594005940159402594035940459405594065940759408594095941059411594125941359414594155941659417594185941959420594215942259423594245942559426594275942859429594305943159432594335943459435594365943759438594395944059441594425944359444594455944659447594485944959450594515945259453594545945559456594575945859459594605946159462594635946459465594665946759468594695947059471594725947359474594755947659477594785947959480594815948259483594845948559486594875948859489594905949159492594935949459495594965949759498594995950059501595025950359504595055950659507595085950959510595115951259513595145951559516595175951859519595205952159522595235952459525595265952759528595295953059531595325953359534595355953659537595385953959540595415954259543595445954559546595475954859549595505955159552595535955459555595565955759558595595956059561595625956359564595655956659567595685956959570595715957259573595745957559576595775957859579595805958159582595835958459585595865958759588595895959059591595925959359594595955959659597595985959959600596015960259603596045960559606596075960859609596105961159612596135961459615596165961759618596195962059621596225962359624596255962659627596285962959630596315963259633596345963559636596375963859639596405964159642596435964459645596465964759648596495965059651596525965359654596555965659657596585965959660596615966259663596645966559666596675966859669596705967159672596735967459675596765967759678596795968059681596825968359684596855968659687596885968959690596915969259693596945969559696596975969859699597005970159702597035970459705597065970759708597095971059711597125971359714597155971659717597185971959720597215972259723597245972559726597275972859729597305973159732597335973459735597365973759738597395974059741597425974359744597455974659747597485974959750597515975259753597545975559756597575975859759597605976159762597635976459765597665976759768597695977059771597725977359774597755977659777597785977959780597815978259783597845978559786597875978859789597905979159792597935979459795597965979759798597995980059801598025980359804598055980659807598085980959810598115981259813598145981559816598175981859819598205982159822598235982459825598265982759828598295983059831598325983359834598355983659837598385983959840598415984259843598445984559846598475984859849598505985159852598535985459855598565985759858598595986059861598625986359864598655986659867598685986959870598715987259873598745987559876598775987859879598805988159882598835988459885598865988759888598895989059891598925989359894598955989659897598985989959900599015990259903599045990559906599075990859909599105991159912599135991459915599165991759918599195992059921599225992359924599255992659927599285992959930599315993259933599345993559936599375993859939599405994159942599435994459945599465994759948599495995059951599525995359954599555995659957599585995959960599615996259963599645996559966599675996859969599705997159972599735997459975599765997759978599795998059981599825998359984599855998659987599885998959990599915999259993599945999559996599975999859999600006000160002600036000460005600066000760008600096001060011600126001360014600156001660017600186001960020600216002260023600246002560026600276002860029600306003160032600336003460035600366003760038600396004060041600426004360044600456004660047600486004960050600516005260053600546005560056600576005860059600606006160062600636006460065600666006760068600696007060071600726007360074600756007660077600786007960080600816008260083600846008560086600876008860089600906009160092600936009460095600966009760098600996010060101601026010360104601056010660107601086010960110601116011260113601146011560116601176011860119601206012160122601236012460125601266012760128601296013060131601326013360134601356013660137601386013960140601416014260143601446014560146601476014860149601506015160152601536015460155601566015760158601596016060161601626016360164601656016660167601686016960170601716017260173601746017560176601776017860179601806018160182601836018460185601866018760188601896019060191601926019360194601956019660197601986019960200602016020260203602046020560206602076020860209602106021160212602136021460215602166021760218602196022060221602226022360224602256022660227602286022960230602316023260233602346023560236602376023860239602406024160242602436024460245602466024760248602496025060251602526025360254602556025660257602586025960260602616026260263602646026560266602676026860269602706027160272602736027460275602766027760278602796028060281602826028360284602856028660287602886028960290602916029260293602946029560296602976029860299603006030160302603036030460305603066030760308603096031060311603126031360314603156031660317603186031960320603216032260323603246032560326603276032860329603306033160332603336033460335603366033760338603396034060341603426034360344603456034660347603486034960350603516035260353603546035560356603576035860359603606036160362603636036460365603666036760368603696037060371603726037360374603756037660377603786037960380603816038260383603846038560386603876038860389603906039160392603936039460395603966039760398603996040060401604026040360404604056040660407604086040960410604116041260413604146041560416604176041860419604206042160422604236042460425604266042760428604296043060431604326043360434604356043660437604386043960440604416044260443604446044560446604476044860449604506045160452604536045460455604566045760458604596046060461604626046360464604656046660467604686046960470604716047260473604746047560476604776047860479604806048160482604836048460485604866048760488604896049060491604926049360494604956049660497604986049960500605016050260503605046050560506605076050860509605106051160512605136051460515605166051760518605196052060521605226052360524605256052660527605286052960530605316053260533605346053560536605376053860539605406054160542605436054460545605466054760548605496055060551605526055360554605556055660557605586055960560605616056260563605646056560566605676056860569605706057160572605736057460575605766057760578605796058060581605826058360584605856058660587605886058960590605916059260593605946059560596605976059860599606006060160602606036060460605606066060760608606096061060611606126061360614606156061660617606186061960620606216062260623606246062560626606276062860629606306063160632606336063460635606366063760638606396064060641606426064360644606456064660647606486064960650606516065260653606546065560656606576065860659606606066160662606636066460665606666066760668606696067060671606726067360674606756067660677606786067960680606816068260683606846068560686606876068860689606906069160692606936069460695606966069760698606996070060701607026070360704607056070660707607086070960710607116071260713607146071560716607176071860719607206072160722607236072460725607266072760728607296073060731607326073360734607356073660737607386073960740607416074260743607446074560746607476074860749607506075160752607536075460755607566075760758607596076060761607626076360764607656076660767607686076960770607716077260773607746077560776607776077860779607806078160782607836078460785607866078760788607896079060791607926079360794607956079660797607986079960800608016080260803608046080560806608076080860809608106081160812608136081460815608166081760818608196082060821608226082360824608256082660827608286082960830608316083260833608346083560836608376083860839608406084160842608436084460845608466084760848608496085060851608526085360854608556085660857608586085960860608616086260863608646086560866608676086860869608706087160872608736087460875608766087760878608796088060881608826088360884608856088660887608886088960890608916089260893608946089560896608976089860899609006090160902609036090460905609066090760908609096091060911609126091360914609156091660917609186091960920609216092260923609246092560926609276092860929609306093160932609336093460935609366093760938609396094060941609426094360944609456094660947609486094960950609516095260953609546095560956609576095860959609606096160962609636096460965609666096760968609696097060971609726097360974609756097660977609786097960980609816098260983609846098560986609876098860989609906099160992609936099460995609966099760998609996100061001610026100361004610056100661007610086100961010610116101261013610146101561016610176101861019610206102161022610236102461025610266102761028610296103061031610326103361034610356103661037610386103961040610416104261043610446104561046610476104861049610506105161052610536105461055610566105761058610596106061061610626106361064610656106661067610686106961070610716107261073610746107561076610776107861079610806108161082610836108461085610866108761088610896109061091610926109361094610956109661097610986109961100611016110261103611046110561106611076110861109611106111161112611136111461115611166111761118611196112061121611226112361124611256112661127611286112961130611316113261133611346113561136611376113861139611406114161142611436114461145611466114761148611496115061151611526115361154611556115661157611586115961160611616116261163611646116561166611676116861169611706117161172611736117461175611766117761178611796118061181611826118361184611856118661187611886118961190611916119261193611946119561196611976119861199612006120161202612036120461205612066120761208612096121061211612126121361214612156121661217612186121961220612216122261223612246122561226612276122861229612306123161232612336123461235612366123761238612396124061241612426124361244612456124661247612486124961250612516125261253612546125561256612576125861259612606126161262612636126461265612666126761268612696127061271612726127361274612756127661277612786127961280612816128261283612846128561286612876128861289612906129161292612936129461295612966129761298612996130061301613026130361304613056130661307613086130961310613116131261313613146131561316613176131861319613206132161322613236132461325613266132761328613296133061331613326133361334613356133661337613386133961340613416134261343613446134561346613476134861349613506135161352613536135461355613566135761358613596136061361613626136361364613656136661367613686136961370613716137261373613746137561376613776137861379613806138161382613836138461385613866138761388613896139061391613926139361394613956139661397613986139961400614016140261403614046140561406614076140861409614106141161412614136141461415614166141761418614196142061421614226142361424614256142661427614286142961430614316143261433614346143561436614376143861439614406144161442614436144461445614466144761448614496145061451614526145361454614556145661457614586145961460614616146261463614646146561466614676146861469614706147161472614736147461475614766147761478614796148061481614826148361484614856148661487614886148961490614916149261493614946149561496614976149861499615006150161502615036150461505615066150761508615096151061511615126151361514615156151661517615186151961520615216152261523615246152561526615276152861529615306153161532615336153461535615366153761538615396154061541615426154361544615456154661547615486154961550615516155261553615546155561556615576155861559615606156161562615636156461565615666156761568615696157061571615726157361574615756157661577615786157961580615816158261583615846158561586615876158861589615906159161592615936159461595615966159761598615996160061601616026160361604616056160661607616086160961610616116161261613616146161561616616176161861619616206162161622616236162461625616266162761628616296163061631616326163361634616356163661637616386163961640616416164261643616446164561646616476164861649616506165161652616536165461655616566165761658616596166061661616626166361664616656166661667616686166961670616716167261673616746167561676616776167861679616806168161682616836168461685616866168761688616896169061691616926169361694616956169661697616986169961700617016170261703617046170561706617076170861709617106171161712617136171461715617166171761718617196172061721617226172361724617256172661727617286172961730617316173261733617346173561736617376173861739617406174161742617436174461745617466174761748617496175061751617526175361754617556175661757617586175961760617616176261763617646176561766617676176861769617706177161772617736177461775617766177761778617796178061781617826178361784617856178661787617886178961790617916179261793617946179561796617976179861799618006180161802618036180461805618066180761808618096181061811618126181361814618156181661817618186181961820618216182261823618246182561826618276182861829618306183161832618336183461835618366183761838618396184061841618426184361844618456184661847618486184961850618516185261853618546185561856618576185861859618606186161862618636186461865618666186761868618696187061871618726187361874618756187661877618786187961880618816188261883618846188561886618876188861889618906189161892618936189461895618966189761898618996190061901619026190361904619056190661907619086190961910619116191261913619146191561916619176191861919619206192161922619236192461925619266192761928619296193061931619326193361934619356193661937619386193961940619416194261943619446194561946619476194861949619506195161952619536195461955619566195761958619596196061961619626196361964619656196661967619686196961970619716197261973619746197561976619776197861979619806198161982619836198461985619866198761988619896199061991619926199361994619956199661997619986199962000620016200262003620046200562006620076200862009620106201162012620136201462015620166201762018620196202062021620226202362024620256202662027620286202962030620316203262033620346203562036620376203862039620406204162042620436204462045620466204762048620496205062051620526205362054620556205662057620586205962060620616206262063620646206562066620676206862069620706207162072620736207462075620766207762078620796208062081620826208362084620856208662087620886208962090620916209262093620946209562096620976209862099621006210162102621036210462105621066210762108621096211062111621126211362114621156211662117621186211962120621216212262123621246212562126621276212862129621306213162132621336213462135621366213762138621396214062141621426214362144621456214662147621486214962150621516215262153621546215562156621576215862159621606216162162621636216462165621666216762168621696217062171621726217362174621756217662177621786217962180621816218262183621846218562186621876218862189621906219162192621936219462195621966219762198621996220062201622026220362204622056220662207622086220962210622116221262213622146221562216622176221862219622206222162222622236222462225622266222762228622296223062231622326223362234622356223662237622386223962240622416224262243622446224562246622476224862249622506225162252622536225462255622566225762258622596226062261622626226362264622656226662267622686226962270622716227262273622746227562276622776227862279622806228162282622836228462285622866228762288622896229062291622926229362294622956229662297622986229962300623016230262303623046230562306623076230862309623106231162312623136231462315623166231762318623196232062321623226232362324623256232662327623286232962330623316233262333623346233562336623376233862339623406234162342623436234462345623466234762348623496235062351623526235362354623556235662357623586235962360623616236262363623646236562366623676236862369623706237162372623736237462375623766237762378623796238062381623826238362384623856238662387623886238962390623916239262393623946239562396623976239862399624006240162402624036240462405624066240762408624096241062411624126241362414624156241662417624186241962420624216242262423624246242562426624276242862429624306243162432624336243462435624366243762438624396244062441624426244362444624456244662447624486244962450624516245262453624546245562456624576245862459624606246162462624636246462465624666246762468624696247062471624726247362474624756247662477624786247962480624816248262483624846248562486624876248862489624906249162492624936249462495624966249762498624996250062501625026250362504625056250662507625086250962510625116251262513625146251562516625176251862519625206252162522625236252462525625266252762528625296253062531625326253362534625356253662537625386253962540625416254262543625446254562546625476254862549625506255162552625536255462555625566255762558625596256062561625626256362564625656256662567625686256962570625716257262573625746257562576625776257862579625806258162582625836258462585625866258762588625896259062591625926259362594625956259662597625986259962600626016260262603626046260562606626076260862609626106261162612626136261462615626166261762618626196262062621626226262362624626256262662627626286262962630626316263262633626346263562636626376263862639626406264162642626436264462645626466264762648626496265062651626526265362654626556265662657626586265962660626616266262663626646266562666626676266862669626706267162672626736267462675626766267762678626796268062681626826268362684626856268662687626886268962690626916269262693626946269562696626976269862699627006270162702627036270462705627066270762708627096271062711627126271362714627156271662717627186271962720627216272262723627246272562726627276272862729627306273162732627336273462735627366273762738627396274062741627426274362744627456274662747627486274962750627516275262753627546275562756627576275862759627606276162762627636276462765627666276762768627696277062771627726277362774627756277662777627786277962780627816278262783627846278562786627876278862789627906279162792627936279462795627966279762798627996280062801628026280362804628056280662807628086280962810628116281262813628146281562816628176281862819628206282162822628236282462825628266282762828628296283062831628326283362834628356283662837628386283962840628416284262843628446284562846628476284862849628506285162852628536285462855628566285762858628596286062861628626286362864628656286662867628686286962870628716287262873628746287562876628776287862879628806288162882628836288462885628866288762888628896289062891628926289362894628956289662897628986289962900629016290262903629046290562906629076290862909629106291162912629136291462915629166291762918629196292062921629226292362924629256292662927629286292962930629316293262933629346293562936629376293862939629406294162942629436294462945629466294762948629496295062951629526295362954629556295662957629586295962960629616296262963629646296562966629676296862969629706297162972629736297462975629766297762978629796298062981629826298362984629856298662987629886298962990629916299262993629946299562996629976299862999630006300163002630036300463005630066300763008630096301063011630126301363014630156301663017630186301963020630216302263023630246302563026630276302863029630306303163032630336303463035630366303763038630396304063041630426304363044630456304663047630486304963050630516305263053630546305563056630576305863059630606306163062630636306463065630666306763068630696307063071630726307363074630756307663077630786307963080630816308263083630846308563086630876308863089630906309163092630936309463095630966309763098630996310063101631026310363104631056310663107631086310963110631116311263113631146311563116631176311863119631206312163122631236312463125631266312763128631296313063131631326313363134631356313663137631386313963140631416314263143631446314563146631476314863149631506315163152631536315463155631566315763158631596316063161631626316363164631656316663167631686316963170631716317263173631746317563176631776317863179631806318163182631836318463185631866318763188631896319063191631926319363194631956319663197631986319963200632016320263203632046320563206632076320863209632106321163212632136321463215632166321763218632196322063221632226322363224632256322663227632286322963230632316323263233632346323563236632376323863239632406324163242632436324463245632466324763248632496325063251632526325363254632556325663257632586325963260632616326263263632646326563266632676326863269632706327163272632736327463275632766327763278632796328063281632826328363284632856328663287632886328963290632916329263293632946329563296632976329863299633006330163302633036330463305633066330763308633096331063311633126331363314633156331663317633186331963320633216332263323633246332563326633276332863329633306333163332633336333463335633366333763338633396334063341633426334363344633456334663347633486334963350633516335263353633546335563356633576335863359633606336163362633636336463365633666336763368633696337063371633726337363374633756337663377633786337963380633816338263383633846338563386633876338863389633906339163392633936339463395633966339763398633996340063401634026340363404634056340663407634086340963410634116341263413634146341563416634176341863419634206342163422634236342463425634266342763428634296343063431634326343363434634356343663437634386343963440634416344263443634446344563446634476344863449634506345163452634536345463455634566345763458634596346063461634626346363464634656346663467634686346963470634716347263473634746347563476634776347863479634806348163482634836348463485634866348763488634896349063491634926349363494634956349663497634986349963500635016350263503635046350563506635076350863509635106351163512635136351463515635166351763518635196352063521635226352363524635256352663527635286352963530635316353263533635346353563536635376353863539635406354163542635436354463545635466354763548635496355063551635526355363554635556355663557635586355963560635616356263563635646356563566635676356863569635706357163572635736357463575635766357763578635796358063581635826358363584635856358663587635886358963590635916359263593635946359563596635976359863599636006360163602636036360463605636066360763608636096361063611636126361363614636156361663617636186361963620636216362263623636246362563626636276362863629636306363163632636336363463635636366363763638636396364063641636426364363644636456364663647636486364963650636516365263653636546365563656636576365863659636606366163662636636366463665636666366763668636696367063671636726367363674636756367663677636786367963680636816368263683636846368563686636876368863689636906369163692636936369463695636966369763698636996370063701637026370363704637056370663707637086370963710637116371263713637146371563716637176371863719637206372163722637236372463725637266372763728637296373063731637326373363734637356373663737637386373963740637416374263743637446374563746637476374863749637506375163752637536375463755637566375763758637596376063761637626376363764637656376663767637686376963770637716377263773637746377563776637776377863779637806378163782637836378463785637866378763788637896379063791637926379363794637956379663797637986379963800638016380263803638046380563806638076380863809638106381163812638136381463815638166381763818638196382063821638226382363824638256382663827638286382963830638316383263833638346383563836638376383863839638406384163842638436384463845638466384763848638496385063851638526385363854638556385663857638586385963860638616386263863638646386563866638676386863869638706387163872638736387463875638766387763878638796388063881638826388363884638856388663887638886388963890638916389263893638946389563896638976389863899639006390163902639036390463905639066390763908639096391063911639126391363914639156391663917639186391963920639216392263923639246392563926639276392863929639306393163932639336393463935639366393763938639396394063941639426394363944639456394663947639486394963950639516395263953639546395563956639576395863959639606396163962639636396463965639666396763968639696397063971639726397363974639756397663977639786397963980639816398263983639846398563986639876398863989639906399163992639936399463995639966399763998639996400064001640026400364004640056400664007640086400964010640116401264013640146401564016640176401864019640206402164022640236402464025640266402764028640296403064031640326403364034640356403664037640386403964040640416404264043640446404564046640476404864049640506405164052640536405464055640566405764058640596406064061640626406364064640656406664067640686406964070640716407264073640746407564076640776407864079640806408164082640836408464085640866408764088640896409064091640926409364094640956409664097640986409964100641016410264103641046410564106641076410864109641106411164112641136411464115641166411764118641196412064121641226412364124641256412664127641286412964130641316413264133641346413564136641376413864139641406414164142641436414464145641466414764148641496415064151641526415364154641556415664157641586415964160641616416264163641646416564166641676416864169641706417164172641736417464175641766417764178641796418064181641826418364184641856418664187641886418964190641916419264193641946419564196641976419864199642006420164202642036420464205642066420764208642096421064211642126421364214642156421664217642186421964220642216422264223642246422564226642276422864229642306423164232642336423464235642366423764238642396424064241642426424364244642456424664247642486424964250642516425264253642546425564256642576425864259642606426164262642636426464265642666426764268642696427064271642726427364274642756427664277642786427964280642816428264283642846428564286642876428864289642906429164292642936429464295642966429764298642996430064301643026430364304643056430664307643086430964310643116431264313643146431564316643176431864319643206432164322643236432464325643266432764328643296433064331643326433364334643356433664337643386433964340643416434264343643446434564346643476434864349643506435164352643536435464355643566435764358643596436064361643626436364364643656436664367643686436964370643716437264373643746437564376643776437864379643806438164382643836438464385643866438764388643896439064391643926439364394643956439664397643986439964400644016440264403644046440564406644076440864409644106441164412644136441464415644166441764418644196442064421644226442364424644256442664427644286442964430644316443264433644346443564436644376443864439644406444164442644436444464445644466444764448644496445064451644526445364454644556445664457644586445964460644616446264463644646446564466644676446864469644706447164472644736447464475644766447764478644796448064481644826448364484644856448664487644886448964490644916449264493644946449564496644976449864499645006450164502645036450464505645066450764508645096451064511645126451364514645156451664517645186451964520645216452264523645246452564526645276452864529645306453164532645336453464535645366453764538645396454064541645426454364544645456454664547645486454964550645516455264553645546455564556645576455864559645606456164562645636456464565645666456764568645696457064571645726457364574645756457664577645786457964580645816458264583645846458564586645876458864589645906459164592645936459464595645966459764598645996460064601646026460364604646056460664607646086460964610646116461264613646146461564616646176461864619646206462164622646236462464625646266462764628646296463064631646326463364634646356463664637646386463964640646416464264643646446464564646646476464864649646506465164652646536465464655646566465764658646596466064661646626466364664646656466664667646686466964670646716467264673646746467564676646776467864679646806468164682646836468464685646866468764688646896469064691646926469364694646956469664697646986469964700647016470264703647046470564706647076470864709647106471164712647136471464715647166471764718647196472064721647226472364724647256472664727647286472964730647316473264733647346473564736647376473864739647406474164742647436474464745647466474764748647496475064751647526475364754647556475664757647586475964760647616476264763647646476564766647676476864769647706477164772647736477464775647766477764778647796478064781647826478364784647856478664787647886478964790647916479264793647946479564796647976479864799648006480164802648036480464805648066480764808648096481064811648126481364814648156481664817648186481964820648216482264823648246482564826648276482864829648306483164832648336483464835648366483764838648396484064841648426484364844648456484664847648486484964850648516485264853648546485564856648576485864859648606486164862648636486464865648666486764868648696487064871648726487364874648756487664877648786487964880648816488264883648846488564886648876488864889648906489164892648936489464895648966489764898648996490064901649026490364904649056490664907649086490964910649116491264913649146491564916649176491864919649206492164922649236492464925649266492764928649296493064931649326493364934649356493664937649386493964940649416494264943649446494564946649476494864949649506495164952649536495464955649566495764958649596496064961649626496364964649656496664967649686496964970649716497264973649746497564976649776497864979649806498164982649836498464985649866498764988649896499064991649926499364994649956499664997649986499965000650016500265003650046500565006650076500865009650106501165012650136501465015650166501765018650196502065021650226502365024650256502665027650286502965030650316503265033650346503565036650376503865039650406504165042650436504465045650466504765048650496505065051650526505365054650556505665057650586505965060650616506265063650646506565066650676506865069650706507165072650736507465075650766507765078650796508065081650826508365084650856508665087650886508965090650916509265093650946509565096650976509865099651006510165102651036510465105651066510765108651096511065111651126511365114651156511665117651186511965120651216512265123651246512565126651276512865129651306513165132651336513465135651366513765138651396514065141651426514365144651456514665147651486514965150651516515265153651546515565156651576515865159651606516165162651636516465165651666516765168651696517065171651726517365174651756517665177651786517965180651816518265183651846518565186651876518865189651906519165192651936519465195651966519765198651996520065201652026520365204652056520665207652086520965210652116521265213652146521565216652176521865219652206522165222652236522465225652266522765228652296523065231652326523365234652356523665237652386523965240652416524265243652446524565246652476524865249652506525165252652536525465255652566525765258652596526065261652626526365264652656526665267652686526965270652716527265273652746527565276652776527865279652806528165282652836528465285652866528765288652896529065291652926529365294652956529665297652986529965300653016530265303653046530565306653076530865309653106531165312653136531465315653166531765318653196532065321653226532365324653256532665327653286532965330653316533265333653346533565336653376533865339653406534165342653436534465345653466534765348653496535065351653526535365354653556535665357653586535965360653616536265363653646536565366653676536865369653706537165372653736537465375653766537765378653796538065381653826538365384653856538665387653886538965390653916539265393653946539565396653976539865399654006540165402654036540465405654066540765408654096541065411654126541365414654156541665417654186541965420654216542265423654246542565426654276542865429654306543165432654336543465435654366543765438654396544065441654426544365444654456544665447654486544965450654516545265453654546545565456654576545865459654606546165462654636546465465654666546765468654696547065471654726547365474654756547665477654786547965480654816548265483654846548565486654876548865489654906549165492654936549465495654966549765498654996550065501655026550365504655056550665507655086550965510655116551265513655146551565516655176551865519655206552165522655236552465525655266552765528655296553065531655326553365534655356553665537655386553965540655416554265543655446554565546655476554865549655506555165552655536555465555655566555765558655596556065561655626556365564655656556665567655686556965570655716557265573655746557565576655776557865579655806558165582655836558465585655866558765588655896559065591655926559365594655956559665597655986559965600656016560265603656046560565606656076560865609656106561165612656136561465615656166561765618656196562065621656226562365624656256562665627656286562965630656316563265633656346563565636656376563865639656406564165642656436564465645656466564765648656496565065651656526565365654656556565665657656586565965660656616566265663656646566565666656676566865669656706567165672656736567465675656766567765678656796568065681656826568365684656856568665687656886568965690656916569265693656946569565696656976569865699657006570165702657036570465705657066570765708657096571065711657126571365714657156571665717657186571965720657216572265723657246572565726657276572865729657306573165732657336573465735657366573765738657396574065741657426574365744657456574665747657486574965750657516575265753657546575565756657576575865759657606576165762657636576465765657666576765768657696577065771657726577365774657756577665777657786577965780657816578265783657846578565786657876578865789657906579165792657936579465795657966579765798657996580065801658026580365804658056580665807658086580965810658116581265813658146581565816658176581865819658206582165822658236582465825658266582765828658296583065831658326583365834658356583665837658386583965840658416584265843658446584565846658476584865849658506585165852658536585465855658566585765858658596586065861658626586365864658656586665867658686586965870658716587265873658746587565876658776587865879658806588165882658836588465885658866588765888658896589065891658926589365894658956589665897658986589965900659016590265903659046590565906659076590865909659106591165912659136591465915659166591765918659196592065921659226592365924659256592665927659286592965930659316593265933659346593565936659376593865939659406594165942659436594465945659466594765948659496595065951659526595365954659556595665957659586595965960659616596265963659646596565966659676596865969659706597165972659736597465975659766597765978659796598065981659826598365984659856598665987659886598965990659916599265993659946599565996659976599865999660006600166002660036600466005660066600766008660096601066011660126601366014660156601666017660186601966020660216602266023660246602566026660276602866029660306603166032660336603466035660366603766038660396604066041660426604366044660456604666047660486604966050660516605266053660546605566056660576605866059660606606166062660636606466065660666606766068660696607066071660726607366074660756607666077660786607966080660816608266083660846608566086660876608866089660906609166092660936609466095660966609766098660996610066101661026610366104661056610666107661086610966110661116611266113661146611566116661176611866119661206612166122661236612466125661266612766128661296613066131661326613366134661356613666137661386613966140661416614266143661446614566146661476614866149661506615166152661536615466155661566615766158661596616066161661626616366164661656616666167661686616966170661716617266173661746617566176661776617866179661806618166182661836618466185661866618766188661896619066191661926619366194661956619666197661986619966200662016620266203662046620566206662076620866209662106621166212662136621466215662166621766218662196622066221662226622366224662256622666227662286622966230662316623266233662346623566236662376623866239662406624166242662436624466245662466624766248662496625066251662526625366254662556625666257662586625966260662616626266263662646626566266662676626866269662706627166272662736627466275662766627766278662796628066281662826628366284662856628666287662886628966290662916629266293662946629566296662976629866299663006630166302663036630466305663066630766308663096631066311663126631366314663156631666317663186631966320663216632266323663246632566326663276632866329663306633166332663336633466335663366633766338663396634066341663426634366344663456634666347663486634966350663516635266353663546635566356663576635866359663606636166362663636636466365663666636766368663696637066371663726637366374663756637666377663786637966380663816638266383663846638566386663876638866389663906639166392663936639466395663966639766398663996640066401664026640366404664056640666407664086640966410664116641266413664146641566416664176641866419664206642166422664236642466425664266642766428664296643066431664326643366434664356643666437664386643966440664416644266443664446644566446664476644866449664506645166452664536645466455664566645766458664596646066461664626646366464664656646666467664686646966470664716647266473664746647566476664776647866479664806648166482664836648466485664866648766488664896649066491664926649366494664956649666497664986649966500665016650266503665046650566506665076650866509665106651166512665136651466515665166651766518665196652066521665226652366524665256652666527665286652966530665316653266533665346653566536665376653866539665406654166542665436654466545665466654766548665496655066551665526655366554665556655666557665586655966560665616656266563665646656566566665676656866569665706657166572665736657466575665766657766578665796658066581665826658366584665856658666587665886658966590665916659266593665946659566596665976659866599666006660166602666036660466605666066660766608666096661066611666126661366614666156661666617666186661966620666216662266623666246662566626666276662866629666306663166632666336663466635666366663766638666396664066641666426664366644666456664666647666486664966650666516665266653666546665566656666576665866659666606666166662666636666466665666666666766668666696667066671666726667366674666756667666677666786667966680666816668266683666846668566686666876668866689666906669166692666936669466695666966669766698666996670066701667026670366704667056670666707667086670966710667116671266713667146671566716667176671866719667206672166722667236672466725667266672766728667296673066731667326673366734667356673666737667386673966740667416674266743667446674566746667476674866749667506675166752667536675466755667566675766758667596676066761667626676366764667656676666767667686676966770667716677266773667746677566776667776677866779667806678166782667836678466785667866678766788667896679066791667926679366794667956679666797667986679966800668016680266803668046680566806668076680866809668106681166812668136681466815668166681766818668196682066821668226682366824668256682666827668286682966830668316683266833668346683566836668376683866839668406684166842668436684466845668466684766848668496685066851668526685366854668556685666857668586685966860668616686266863668646686566866668676686866869668706687166872668736687466875668766687766878668796688066881668826688366884668856688666887668886688966890668916689266893668946689566896668976689866899669006690166902669036690466905669066690766908669096691066911669126691366914669156691666917669186691966920669216692266923669246692566926669276692866929669306693166932669336693466935669366693766938669396694066941669426694366944669456694666947669486694966950669516695266953669546695566956669576695866959669606696166962669636696466965669666696766968669696697066971669726697366974669756697666977669786697966980669816698266983669846698566986669876698866989669906699166992669936699466995669966699766998669996700067001670026700367004670056700667007670086700967010670116701267013670146701567016670176701867019670206702167022670236702467025670266702767028670296703067031670326703367034670356703667037670386703967040670416704267043670446704567046670476704867049670506705167052670536705467055670566705767058670596706067061670626706367064670656706667067670686706967070670716707267073670746707567076670776707867079670806708167082670836708467085670866708767088670896709067091670926709367094670956709667097670986709967100671016710267103671046710567106671076710867109671106711167112671136711467115671166711767118671196712067121671226712367124671256712667127671286712967130671316713267133671346713567136671376713867139671406714167142671436714467145671466714767148671496715067151671526715367154671556715667157671586715967160671616716267163671646716567166671676716867169671706717167172671736717467175671766717767178671796718067181671826718367184671856718667187671886718967190671916719267193671946719567196671976719867199672006720167202672036720467205672066720767208672096721067211672126721367214672156721667217672186721967220672216722267223672246722567226672276722867229672306723167232672336723467235672366723767238672396724067241672426724367244672456724667247672486724967250672516725267253672546725567256672576725867259672606726167262672636726467265672666726767268672696727067271672726727367274672756727667277672786727967280672816728267283672846728567286672876728867289672906729167292672936729467295672966729767298672996730067301673026730367304673056730667307673086730967310673116731267313673146731567316673176731867319673206732167322673236732467325673266732767328673296733067331673326733367334673356733667337673386733967340673416734267343673446734567346673476734867349673506735167352673536735467355673566735767358673596736067361673626736367364673656736667367673686736967370673716737267373673746737567376673776737867379673806738167382673836738467385673866738767388673896739067391673926739367394673956739667397673986739967400674016740267403674046740567406674076740867409674106741167412674136741467415674166741767418674196742067421674226742367424674256742667427674286742967430674316743267433674346743567436674376743867439674406744167442674436744467445674466744767448674496745067451674526745367454674556745667457674586745967460674616746267463674646746567466674676746867469674706747167472674736747467475674766747767478674796748067481674826748367484674856748667487674886748967490674916749267493674946749567496674976749867499675006750167502675036750467505675066750767508675096751067511675126751367514675156751667517675186751967520675216752267523675246752567526675276752867529675306753167532675336753467535675366753767538675396754067541675426754367544675456754667547675486754967550675516755267553675546755567556675576755867559675606756167562675636756467565675666756767568675696757067571675726757367574675756757667577675786757967580675816758267583675846758567586675876758867589675906759167592675936759467595675966759767598675996760067601676026760367604676056760667607676086760967610676116761267613676146761567616676176761867619676206762167622676236762467625676266762767628676296763067631676326763367634676356763667637676386763967640676416764267643676446764567646676476764867649676506765167652676536765467655676566765767658676596766067661676626766367664676656766667667676686766967670676716767267673676746767567676676776767867679676806768167682676836768467685676866768767688676896769067691676926769367694676956769667697676986769967700677016770267703677046770567706677076770867709677106771167712677136771467715677166771767718677196772067721677226772367724677256772667727677286772967730677316773267733677346773567736677376773867739677406774167742677436774467745677466774767748677496775067751677526775367754677556775667757677586775967760677616776267763677646776567766677676776867769677706777167772677736777467775677766777767778677796778067781677826778367784677856778667787677886778967790677916779267793677946779567796677976779867799678006780167802678036780467805678066780767808678096781067811678126781367814678156781667817678186781967820678216782267823678246782567826678276782867829678306783167832678336783467835678366783767838678396784067841678426784367844678456784667847678486784967850678516785267853678546785567856678576785867859678606786167862678636786467865678666786767868678696787067871678726787367874678756787667877678786787967880678816788267883678846788567886678876788867889678906789167892678936789467895678966789767898678996790067901679026790367904679056790667907679086790967910679116791267913679146791567916679176791867919679206792167922679236792467925679266792767928679296793067931679326793367934679356793667937679386793967940679416794267943679446794567946679476794867949679506795167952679536795467955679566795767958679596796067961679626796367964679656796667967679686796967970679716797267973679746797567976679776797867979679806798167982679836798467985679866798767988679896799067991679926799367994679956799667997679986799968000680016800268003680046800568006680076800868009680106801168012680136801468015680166801768018680196802068021680226802368024680256802668027680286802968030680316803268033680346803568036680376803868039680406804168042680436804468045680466804768048680496805068051680526805368054680556805668057680586805968060680616806268063680646806568066680676806868069680706807168072680736807468075680766807768078680796808068081680826808368084680856808668087680886808968090680916809268093680946809568096680976809868099681006810168102681036810468105681066810768108681096811068111681126811368114681156811668117681186811968120681216812268123681246812568126681276812868129681306813168132681336813468135681366813768138681396814068141681426814368144681456814668147681486814968150681516815268153681546815568156681576815868159681606816168162681636816468165681666816768168681696817068171681726817368174681756817668177681786817968180681816818268183681846818568186681876818868189681906819168192681936819468195681966819768198681996820068201682026820368204682056820668207682086820968210682116821268213682146821568216682176821868219682206822168222682236822468225682266822768228682296823068231682326823368234682356823668237682386823968240682416824268243682446824568246682476824868249682506825168252682536825468255682566825768258682596826068261682626826368264682656826668267682686826968270682716827268273682746827568276682776827868279682806828168282682836828468285682866828768288682896829068291682926829368294682956829668297682986829968300683016830268303683046830568306683076830868309683106831168312683136831468315683166831768318683196832068321683226832368324683256832668327683286832968330683316833268333683346833568336683376833868339683406834168342683436834468345683466834768348683496835068351683526835368354683556835668357683586835968360683616836268363683646836568366683676836868369683706837168372683736837468375683766837768378683796838068381683826838368384683856838668387683886838968390683916839268393683946839568396683976839868399684006840168402684036840468405684066840768408684096841068411684126841368414684156841668417684186841968420684216842268423684246842568426684276842868429684306843168432684336843468435684366843768438684396844068441684426844368444684456844668447684486844968450684516845268453684546845568456684576845868459684606846168462684636846468465684666846768468684696847068471684726847368474684756847668477684786847968480684816848268483684846848568486684876848868489684906849168492684936849468495684966849768498684996850068501685026850368504685056850668507685086850968510685116851268513685146851568516685176851868519685206852168522685236852468525685266852768528685296853068531685326853368534685356853668537685386853968540685416854268543685446854568546685476854868549685506855168552685536855468555685566855768558685596856068561685626856368564685656856668567685686856968570685716857268573685746857568576685776857868579685806858168582685836858468585685866858768588685896859068591685926859368594685956859668597685986859968600686016860268603686046860568606686076860868609686106861168612686136861468615686166861768618686196862068621686226862368624686256862668627686286862968630686316863268633686346863568636686376863868639686406864168642686436864468645686466864768648686496865068651686526865368654686556865668657686586865968660686616866268663686646866568666686676866868669686706867168672686736867468675686766867768678686796868068681686826868368684686856868668687686886868968690686916869268693686946869568696686976869868699687006870168702687036870468705687066870768708687096871068711687126871368714687156871668717687186871968720687216872268723687246872568726687276872868729687306873168732687336873468735687366873768738687396874068741687426874368744687456874668747687486874968750687516875268753687546875568756687576875868759687606876168762687636876468765687666876768768687696877068771687726877368774687756877668777687786877968780687816878268783687846878568786687876878868789687906879168792687936879468795687966879768798687996880068801688026880368804688056880668807688086880968810688116881268813688146881568816688176881868819688206882168822688236882468825688266882768828688296883068831688326883368834688356883668837688386883968840688416884268843688446884568846688476884868849688506885168852688536885468855688566885768858688596886068861688626886368864688656886668867688686886968870688716887268873688746887568876688776887868879688806888168882688836888468885688866888768888688896889068891688926889368894688956889668897688986889968900689016890268903689046890568906689076890868909689106891168912689136891468915689166891768918689196892068921689226892368924689256892668927689286892968930689316893268933689346893568936689376893868939689406894168942689436894468945689466894768948689496895068951689526895368954689556895668957689586895968960689616896268963689646896568966689676896868969689706897168972689736897468975689766897768978689796898068981689826898368984689856898668987689886898968990689916899268993689946899568996689976899868999690006900169002690036900469005690066900769008690096901069011690126901369014690156901669017690186901969020690216902269023690246902569026690276902869029690306903169032690336903469035690366903769038690396904069041690426904369044690456904669047690486904969050690516905269053690546905569056690576905869059690606906169062690636906469065690666906769068690696907069071690726907369074690756907669077690786907969080690816908269083690846908569086690876908869089690906909169092690936909469095690966909769098690996910069101691026910369104691056910669107691086910969110691116911269113691146911569116691176911869119691206912169122691236912469125691266912769128691296913069131691326913369134691356913669137691386913969140691416914269143691446914569146691476914869149691506915169152691536915469155691566915769158691596916069161691626916369164691656916669167691686916969170691716917269173691746917569176691776917869179691806918169182691836918469185691866918769188691896919069191691926919369194691956919669197691986919969200692016920269203692046920569206692076920869209692106921169212692136921469215692166921769218692196922069221692226922369224692256922669227692286922969230692316923269233692346923569236692376923869239692406924169242692436924469245692466924769248692496925069251692526925369254692556925669257692586925969260692616926269263692646926569266692676926869269692706927169272692736927469275692766927769278692796928069281692826928369284692856928669287692886928969290692916929269293692946929569296692976929869299693006930169302693036930469305693066930769308693096931069311693126931369314693156931669317693186931969320693216932269323693246932569326693276932869329693306933169332693336933469335693366933769338693396934069341693426934369344693456934669347693486934969350693516935269353693546935569356693576935869359693606936169362693636936469365693666936769368693696937069371693726937369374693756937669377693786937969380693816938269383693846938569386693876938869389693906939169392693936939469395693966939769398693996940069401694026940369404694056940669407694086940969410694116941269413694146941569416694176941869419694206942169422694236942469425694266942769428694296943069431694326943369434694356943669437694386943969440694416944269443694446944569446694476944869449694506945169452694536945469455694566945769458694596946069461694626946369464694656946669467694686946969470694716947269473694746947569476694776947869479694806948169482694836948469485694866948769488694896949069491694926949369494694956949669497694986949969500695016950269503695046950569506695076950869509695106951169512695136951469515695166951769518695196952069521695226952369524695256952669527695286952969530695316953269533695346953569536695376953869539695406954169542695436954469545695466954769548695496955069551695526955369554695556955669557695586955969560695616956269563695646956569566695676956869569695706957169572695736957469575695766957769578695796958069581695826958369584695856958669587695886958969590695916959269593695946959569596695976959869599696006960169602696036960469605696066960769608696096961069611696126961369614696156961669617696186961969620696216962269623696246962569626696276962869629696306963169632696336963469635696366963769638696396964069641696426964369644696456964669647696486964969650696516965269653696546965569656696576965869659696606966169662696636966469665696666966769668696696967069671696726967369674696756967669677696786967969680696816968269683696846968569686696876968869689696906969169692696936969469695696966969769698696996970069701697026970369704697056970669707697086970969710697116971269713697146971569716697176971869719697206972169722697236972469725697266972769728697296973069731697326973369734697356973669737697386973969740697416974269743697446974569746697476974869749697506975169752697536975469755697566975769758697596976069761697626976369764697656976669767697686976969770697716977269773697746977569776697776977869779697806978169782697836978469785697866978769788697896979069791697926979369794697956979669797697986979969800698016980269803698046980569806698076980869809698106981169812698136981469815698166981769818698196982069821698226982369824698256982669827698286982969830698316983269833698346983569836698376983869839698406984169842698436984469845698466984769848698496985069851698526985369854698556985669857698586985969860698616986269863698646986569866698676986869869698706987169872698736987469875698766987769878698796988069881698826988369884698856988669887698886988969890698916989269893698946989569896698976989869899699006990169902699036990469905699066990769908699096991069911699126991369914699156991669917699186991969920699216992269923699246992569926699276992869929699306993169932699336993469935699366993769938699396994069941699426994369944699456994669947699486994969950699516995269953699546995569956699576995869959699606996169962699636996469965699666996769968699696997069971699726997369974699756997669977699786997969980699816998269983699846998569986699876998869989699906999169992699936999469995699966999769998699997000070001700027000370004700057000670007700087000970010700117001270013700147001570016700177001870019700207002170022700237002470025700267002770028700297003070031700327003370034700357003670037700387003970040700417004270043700447004570046700477004870049700507005170052700537005470055700567005770058700597006070061700627006370064700657006670067700687006970070700717007270073700747007570076700777007870079700807008170082700837008470085700867008770088700897009070091700927009370094700957009670097700987009970100701017010270103701047010570106701077010870109701107011170112701137011470115701167011770118701197012070121701227012370124701257012670127701287012970130701317013270133701347013570136701377013870139701407014170142701437014470145701467014770148701497015070151701527015370154701557015670157701587015970160701617016270163701647016570166701677016870169701707017170172701737017470175701767017770178701797018070181701827018370184701857018670187701887018970190701917019270193701947019570196701977019870199702007020170202702037020470205702067020770208702097021070211702127021370214702157021670217702187021970220702217022270223702247022570226702277022870229702307023170232702337023470235702367023770238702397024070241702427024370244702457024670247702487024970250702517025270253702547025570256702577025870259702607026170262702637026470265702667026770268702697027070271702727027370274702757027670277702787027970280702817028270283702847028570286702877028870289702907029170292702937029470295702967029770298702997030070301703027030370304703057030670307703087030970310703117031270313703147031570316703177031870319703207032170322703237032470325703267032770328703297033070331703327033370334703357033670337703387033970340703417034270343703447034570346703477034870349703507035170352703537035470355703567035770358703597036070361703627036370364703657036670367703687036970370703717037270373703747037570376703777037870379703807038170382703837038470385703867038770388703897039070391703927039370394703957039670397703987039970400704017040270403704047040570406704077040870409704107041170412704137041470415704167041770418704197042070421704227042370424704257042670427704287042970430704317043270433704347043570436704377043870439704407044170442704437044470445704467044770448704497045070451704527045370454704557045670457704587045970460704617046270463704647046570466704677046870469704707047170472704737047470475704767047770478704797048070481704827048370484704857048670487704887048970490704917049270493704947049570496704977049870499705007050170502705037050470505705067050770508705097051070511705127051370514705157051670517705187051970520705217052270523705247052570526705277052870529705307053170532705337053470535705367053770538705397054070541705427054370544705457054670547705487054970550705517055270553705547055570556705577055870559705607056170562705637056470565705667056770568705697057070571705727057370574705757057670577705787057970580705817058270583705847058570586705877058870589705907059170592705937059470595705967059770598705997060070601706027060370604706057060670607706087060970610706117061270613706147061570616706177061870619706207062170622706237062470625706267062770628706297063070631706327063370634706357063670637706387063970640706417064270643706447064570646706477064870649706507065170652706537065470655706567065770658706597066070661706627066370664706657066670667706687066970670706717067270673706747067570676706777067870679706807068170682706837068470685706867068770688706897069070691706927069370694706957069670697706987069970700707017070270703707047070570706707077070870709707107071170712707137071470715707167071770718707197072070721707227072370724707257072670727707287072970730707317073270733707347073570736707377073870739707407074170742707437074470745707467074770748707497075070751707527075370754707557075670757707587075970760707617076270763707647076570766707677076870769707707077170772707737077470775707767077770778707797078070781707827078370784707857078670787707887078970790707917079270793707947079570796707977079870799708007080170802708037080470805708067080770808708097081070811708127081370814708157081670817708187081970820708217082270823708247082570826708277082870829708307083170832708337083470835708367083770838708397084070841708427084370844708457084670847708487084970850708517085270853708547085570856708577085870859708607086170862708637086470865708667086770868708697087070871708727087370874708757087670877708787087970880708817088270883708847088570886708877088870889708907089170892708937089470895708967089770898708997090070901709027090370904709057090670907709087090970910709117091270913709147091570916709177091870919709207092170922709237092470925709267092770928709297093070931709327093370934709357093670937709387093970940709417094270943709447094570946709477094870949709507095170952709537095470955709567095770958709597096070961709627096370964709657096670967709687096970970709717097270973709747097570976709777097870979709807098170982709837098470985709867098770988709897099070991709927099370994709957099670997709987099971000710017100271003710047100571006710077100871009710107101171012710137101471015710167101771018710197102071021710227102371024710257102671027710287102971030710317103271033710347103571036710377103871039710407104171042710437104471045710467104771048710497105071051710527105371054710557105671057710587105971060710617106271063710647106571066710677106871069710707107171072710737107471075710767107771078710797108071081710827108371084710857108671087710887108971090710917109271093710947109571096710977109871099711007110171102711037110471105711067110771108711097111071111711127111371114711157111671117711187111971120711217112271123711247112571126711277112871129711307113171132711337113471135711367113771138711397114071141711427114371144711457114671147711487114971150711517115271153711547115571156711577115871159711607116171162711637116471165711667116771168711697117071171711727117371174711757117671177711787117971180711817118271183711847118571186711877118871189711907119171192711937119471195711967119771198711997120071201712027120371204712057120671207712087120971210712117121271213712147121571216712177121871219712207122171222712237122471225712267122771228712297123071231712327123371234712357123671237712387123971240712417124271243712447124571246712477124871249712507125171252712537125471255712567125771258712597126071261712627126371264712657126671267712687126971270712717127271273712747127571276712777127871279712807128171282712837128471285712867128771288712897129071291712927129371294712957129671297712987129971300713017130271303713047130571306713077130871309713107131171312713137131471315713167131771318713197132071321713227132371324713257132671327713287132971330713317133271333713347133571336713377133871339713407134171342713437134471345713467134771348713497135071351713527135371354713557135671357713587135971360713617136271363713647136571366713677136871369713707137171372713737137471375713767137771378713797138071381713827138371384713857138671387713887138971390713917139271393713947139571396713977139871399714007140171402714037140471405714067140771408714097141071411714127141371414714157141671417714187141971420714217142271423714247142571426714277142871429714307143171432714337143471435714367143771438714397144071441714427144371444714457144671447714487144971450714517145271453714547145571456714577145871459714607146171462714637146471465714667146771468714697147071471714727147371474714757147671477714787147971480714817148271483714847148571486714877148871489714907149171492714937149471495714967149771498714997150071501715027150371504715057150671507715087150971510715117151271513715147151571516715177151871519715207152171522715237152471525715267152771528715297153071531715327153371534715357153671537715387153971540715417154271543715447154571546715477154871549715507155171552715537155471555715567155771558715597156071561715627156371564715657156671567715687156971570715717157271573715747157571576715777157871579715807158171582715837158471585715867158771588715897159071591715927159371594715957159671597715987159971600716017160271603716047160571606716077160871609716107161171612716137161471615716167161771618716197162071621716227162371624716257162671627716287162971630716317163271633716347163571636716377163871639716407164171642716437164471645716467164771648716497165071651716527165371654716557165671657716587165971660716617166271663716647166571666716677166871669716707167171672716737167471675716767167771678716797168071681716827168371684716857168671687716887168971690716917169271693716947169571696716977169871699717007170171702717037170471705717067170771708717097171071711717127171371714717157171671717717187171971720717217172271723717247172571726717277172871729717307173171732717337173471735717367173771738717397174071741717427174371744717457174671747717487174971750717517175271753717547175571756717577175871759717607176171762717637176471765717667176771768717697177071771717727177371774717757177671777717787177971780717817178271783717847178571786717877178871789717907179171792717937179471795717967179771798717997180071801718027180371804718057180671807718087180971810718117181271813718147181571816718177181871819718207182171822718237182471825718267182771828718297183071831718327183371834718357183671837718387183971840718417184271843718447184571846718477184871849718507185171852718537185471855718567185771858718597186071861718627186371864718657186671867718687186971870718717187271873718747187571876718777187871879718807188171882718837188471885718867188771888718897189071891718927189371894718957189671897718987189971900719017190271903719047190571906719077190871909719107191171912719137191471915719167191771918719197192071921719227192371924719257192671927719287192971930719317193271933719347193571936719377193871939719407194171942719437194471945719467194771948719497195071951719527195371954719557195671957719587195971960719617196271963719647196571966719677196871969719707197171972719737197471975719767197771978719797198071981719827198371984719857198671987719887198971990719917199271993719947199571996719977199871999720007200172002720037200472005720067200772008720097201072011720127201372014720157201672017720187201972020720217202272023720247202572026720277202872029720307203172032720337203472035720367203772038720397204072041720427204372044720457204672047720487204972050720517205272053720547205572056720577205872059720607206172062720637206472065720667206772068720697207072071720727207372074720757207672077720787207972080720817208272083720847208572086720877208872089720907209172092720937209472095720967209772098720997210072101721027210372104721057210672107721087210972110721117211272113721147211572116721177211872119721207212172122721237212472125721267212772128721297213072131721327213372134721357213672137721387213972140721417214272143721447214572146721477214872149721507215172152721537215472155721567215772158721597216072161721627216372164721657216672167721687216972170721717217272173721747217572176721777217872179721807218172182721837218472185721867218772188721897219072191721927219372194721957219672197721987219972200722017220272203722047220572206722077220872209722107221172212722137221472215722167221772218722197222072221722227222372224722257222672227722287222972230722317223272233722347223572236722377223872239722407224172242722437224472245722467224772248722497225072251722527225372254722557225672257722587225972260722617226272263722647226572266722677226872269722707227172272722737227472275722767227772278722797228072281722827228372284722857228672287722887228972290722917229272293722947229572296722977229872299723007230172302723037230472305723067230772308723097231072311723127231372314723157231672317723187231972320723217232272323723247232572326723277232872329723307233172332723337233472335723367233772338723397234072341723427234372344723457234672347723487234972350723517235272353723547235572356723577235872359723607236172362723637236472365723667236772368723697237072371723727237372374723757237672377723787237972380723817238272383723847238572386723877238872389723907239172392723937239472395723967239772398723997240072401724027240372404724057240672407724087240972410724117241272413724147241572416724177241872419724207242172422724237242472425724267242772428724297243072431724327243372434724357243672437724387243972440724417244272443724447244572446724477244872449724507245172452724537245472455724567245772458724597246072461724627246372464724657246672467724687246972470724717247272473724747247572476724777247872479724807248172482724837248472485724867248772488724897249072491724927249372494724957249672497724987249972500725017250272503725047250572506725077250872509725107251172512725137251472515725167251772518725197252072521725227252372524725257252672527725287252972530725317253272533725347253572536725377253872539725407254172542725437254472545725467254772548725497255072551725527255372554725557255672557725587255972560725617256272563725647256572566725677256872569725707257172572725737257472575725767257772578725797258072581725827258372584725857258672587725887258972590725917259272593725947259572596725977259872599726007260172602726037260472605726067260772608726097261072611726127261372614726157261672617726187261972620726217262272623726247262572626726277262872629726307263172632726337263472635726367263772638726397264072641726427264372644726457264672647726487264972650726517265272653726547265572656726577265872659726607266172662726637266472665726667266772668726697267072671726727267372674726757267672677726787267972680726817268272683726847268572686726877268872689726907269172692726937269472695726967269772698726997270072701727027270372704727057270672707727087270972710727117271272713727147271572716727177271872719727207272172722727237272472725727267272772728727297273072731727327273372734727357273672737727387273972740727417274272743727447274572746727477274872749727507275172752727537275472755727567275772758727597276072761727627276372764727657276672767727687276972770727717277272773727747277572776727777277872779727807278172782727837278472785727867278772788727897279072791727927279372794727957279672797727987279972800728017280272803728047280572806728077280872809728107281172812728137281472815728167281772818728197282072821728227282372824728257282672827728287282972830728317283272833728347283572836728377283872839728407284172842728437284472845728467284772848728497285072851728527285372854728557285672857728587285972860728617286272863728647286572866728677286872869728707287172872728737287472875728767287772878728797288072881728827288372884728857288672887728887288972890728917289272893728947289572896728977289872899729007290172902729037290472905729067290772908729097291072911729127291372914729157291672917729187291972920729217292272923729247292572926729277292872929729307293172932729337293472935729367293772938729397294072941729427294372944729457294672947729487294972950729517295272953729547295572956729577295872959729607296172962729637296472965729667296772968729697297072971729727297372974729757297672977729787297972980729817298272983729847298572986729877298872989729907299172992729937299472995729967299772998729997300073001730027300373004730057300673007730087300973010730117301273013730147301573016730177301873019730207302173022730237302473025730267302773028730297303073031730327303373034730357303673037730387303973040730417304273043730447304573046730477304873049730507305173052730537305473055730567305773058730597306073061730627306373064730657306673067730687306973070730717307273073730747307573076730777307873079730807308173082730837308473085730867308773088730897309073091730927309373094730957309673097730987309973100731017310273103731047310573106731077310873109731107311173112731137311473115731167311773118731197312073121731227312373124731257312673127731287312973130731317313273133731347313573136731377313873139731407314173142731437314473145731467314773148731497315073151731527315373154731557315673157731587315973160731617316273163731647316573166731677316873169731707317173172731737317473175731767317773178731797318073181731827318373184731857318673187731887318973190731917319273193731947319573196731977319873199732007320173202732037320473205732067320773208732097321073211732127321373214732157321673217732187321973220732217322273223732247322573226732277322873229732307323173232732337323473235732367323773238732397324073241732427324373244732457324673247732487324973250732517325273253732547325573256732577325873259732607326173262732637326473265732667326773268732697327073271732727327373274732757327673277732787327973280732817328273283732847328573286732877328873289732907329173292732937329473295732967329773298732997330073301733027330373304733057330673307733087330973310733117331273313733147331573316733177331873319733207332173322733237332473325733267332773328733297333073331733327333373334733357333673337733387333973340733417334273343733447334573346733477334873349733507335173352733537335473355733567335773358733597336073361733627336373364733657336673367733687336973370733717337273373733747337573376733777337873379733807338173382733837338473385733867338773388733897339073391733927339373394733957339673397733987339973400734017340273403734047340573406734077340873409734107341173412734137341473415734167341773418734197342073421734227342373424734257342673427734287342973430734317343273433734347343573436734377343873439734407344173442734437344473445734467344773448734497345073451734527345373454734557345673457734587345973460734617346273463734647346573466734677346873469734707347173472734737347473475734767347773478734797348073481734827348373484734857348673487734887348973490734917349273493734947349573496734977349873499735007350173502735037350473505735067350773508735097351073511735127351373514735157351673517735187351973520735217352273523735247352573526735277352873529735307353173532735337353473535735367353773538735397354073541735427354373544735457354673547735487354973550735517355273553735547355573556735577355873559735607356173562735637356473565735667356773568735697357073571735727357373574735757357673577735787357973580735817358273583735847358573586735877358873589735907359173592735937359473595735967359773598735997360073601736027360373604736057360673607736087360973610736117361273613736147361573616736177361873619736207362173622736237362473625736267362773628736297363073631736327363373634736357363673637736387363973640736417364273643736447364573646736477364873649736507365173652736537365473655736567365773658736597366073661736627366373664736657366673667736687366973670736717367273673736747367573676736777367873679736807368173682736837368473685736867368773688736897369073691736927369373694736957369673697736987369973700737017370273703737047370573706737077370873709737107371173712737137371473715737167371773718737197372073721737227372373724737257372673727737287372973730737317373273733737347373573736737377373873739737407374173742737437374473745737467374773748737497375073751737527375373754737557375673757737587375973760737617376273763737647376573766737677376873769737707377173772737737377473775737767377773778737797378073781737827378373784737857378673787737887378973790737917379273793737947379573796737977379873799738007380173802738037380473805738067380773808738097381073811738127381373814738157381673817738187381973820738217382273823738247382573826738277382873829738307383173832738337383473835738367383773838738397384073841738427384373844738457384673847738487384973850738517385273853738547385573856738577385873859738607386173862738637386473865738667386773868738697387073871738727387373874738757387673877738787387973880738817388273883738847388573886738877388873889738907389173892738937389473895738967389773898738997390073901739027390373904739057390673907739087390973910739117391273913739147391573916739177391873919739207392173922739237392473925739267392773928739297393073931739327393373934739357393673937739387393973940739417394273943739447394573946739477394873949739507395173952739537395473955739567395773958739597396073961739627396373964739657396673967739687396973970739717397273973739747397573976739777397873979739807398173982739837398473985739867398773988739897399073991739927399373994739957399673997739987399974000740017400274003740047400574006740077400874009740107401174012740137401474015740167401774018740197402074021740227402374024740257402674027740287402974030740317403274033740347403574036740377403874039740407404174042740437404474045740467404774048740497405074051740527405374054740557405674057740587405974060740617406274063740647406574066740677406874069740707407174072740737407474075740767407774078740797408074081740827408374084740857408674087740887408974090740917409274093740947409574096740977409874099741007410174102741037410474105741067410774108741097411074111741127411374114741157411674117741187411974120741217412274123741247412574126741277412874129741307413174132741337413474135741367413774138741397414074141741427414374144741457414674147741487414974150741517415274153741547415574156741577415874159741607416174162741637416474165741667416774168741697417074171741727417374174741757417674177741787417974180741817418274183741847418574186741877418874189741907419174192741937419474195741967419774198741997420074201742027420374204742057420674207742087420974210742117421274213742147421574216742177421874219742207422174222742237422474225742267422774228742297423074231742327423374234742357423674237742387423974240742417424274243742447424574246742477424874249742507425174252742537425474255742567425774258742597426074261742627426374264742657426674267742687426974270742717427274273742747427574276742777427874279742807428174282742837428474285742867428774288742897429074291742927429374294742957429674297742987429974300743017430274303743047430574306743077430874309743107431174312743137431474315743167431774318743197432074321743227432374324743257432674327743287432974330743317433274333743347433574336743377433874339743407434174342743437434474345743467434774348743497435074351743527435374354743557435674357743587435974360743617436274363743647436574366743677436874369743707437174372743737437474375743767437774378743797438074381743827438374384743857438674387743887438974390743917439274393743947439574396743977439874399744007440174402744037440474405744067440774408744097441074411744127441374414744157441674417744187441974420744217442274423744247442574426744277442874429744307443174432744337443474435744367443774438744397444074441744427444374444744457444674447744487444974450744517445274453744547445574456744577445874459744607446174462744637446474465744667446774468744697447074471744727447374474744757447674477744787447974480744817448274483744847448574486744877448874489744907449174492744937449474495744967449774498744997450074501745027450374504745057450674507745087450974510745117451274513745147451574516745177451874519745207452174522745237452474525745267452774528745297453074531745327453374534745357453674537745387453974540745417454274543745447454574546745477454874549745507455174552745537455474555745567455774558745597456074561745627456374564745657456674567745687456974570745717457274573745747457574576745777457874579745807458174582745837458474585745867458774588745897459074591745927459374594745957459674597745987459974600746017460274603746047460574606746077460874609746107461174612746137461474615746167461774618746197462074621746227462374624746257462674627746287462974630746317463274633746347463574636746377463874639746407464174642746437464474645746467464774648746497465074651746527465374654746557465674657746587465974660746617466274663746647466574666746677466874669746707467174672746737467474675746767467774678746797468074681746827468374684746857468674687746887468974690746917469274693746947469574696746977469874699747007470174702747037470474705747067470774708747097471074711747127471374714747157471674717747187471974720747217472274723747247472574726747277472874729747307473174732747337473474735747367473774738747397474074741747427474374744747457474674747747487474974750747517475274753747547475574756747577475874759747607476174762747637476474765747667476774768747697477074771747727477374774747757477674777747787477974780747817478274783747847478574786747877478874789747907479174792747937479474795747967479774798747997480074801748027480374804748057480674807748087480974810748117481274813748147481574816748177481874819748207482174822748237482474825748267482774828748297483074831748327483374834748357483674837748387483974840748417484274843748447484574846748477484874849748507485174852748537485474855748567485774858748597486074861748627486374864748657486674867748687486974870748717487274873748747487574876748777487874879748807488174882748837488474885748867488774888748897489074891748927489374894748957489674897748987489974900749017490274903749047490574906749077490874909749107491174912749137491474915749167491774918749197492074921749227492374924749257492674927749287492974930749317493274933749347493574936749377493874939749407494174942749437494474945749467494774948749497495074951749527495374954749557495674957749587495974960749617496274963749647496574966749677496874969749707497174972749737497474975749767497774978749797498074981749827498374984749857498674987749887498974990749917499274993749947499574996749977499874999750007500175002750037500475005750067500775008750097501075011750127501375014750157501675017750187501975020750217502275023750247502575026750277502875029750307503175032750337503475035750367503775038750397504075041750427504375044750457504675047750487504975050750517505275053750547505575056750577505875059750607506175062750637506475065750667506775068750697507075071750727507375074750757507675077750787507975080750817508275083750847508575086750877508875089750907509175092750937509475095750967509775098750997510075101751027510375104751057510675107751087510975110751117511275113751147511575116751177511875119751207512175122751237512475125751267512775128751297513075131751327513375134751357513675137751387513975140751417514275143751447514575146751477514875149751507515175152751537515475155751567515775158751597516075161751627516375164751657516675167751687516975170751717517275173751747517575176751777517875179 |
- /*! jQuery v3.5.1 | (c) JS Foundation and other contributors | jquery.org/license */
- !function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(C,e){"use strict";var t=[],r=Object.getPrototypeOf,s=t.slice,g=t.flat?function(e){return t.flat.call(e)}:function(e){return t.concat.apply([],e)},u=t.push,i=t.indexOf,n={},o=n.toString,v=n.hasOwnProperty,a=v.toString,l=a.call(Object),y={},m=function(e){return"function"==typeof e&&"number"!=typeof e.nodeType},x=function(e){return null!=e&&e===e.window},E=C.document,c={type:!0,src:!0,nonce:!0,noModule:!0};function b(e,t,n){var r,i,o=(n=n||E).createElement("script");if(o.text=e,t)for(r in c)(i=t[r]||t.getAttribute&&t.getAttribute(r))&&o.setAttribute(r,i);n.head.appendChild(o).parentNode.removeChild(o)}function w(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?n[o.call(e)]||"object":typeof e}var f="3.5.1",S=function(e,t){return new S.fn.init(e,t)};function p(e){var t=!!e&&"length"in e&&e.length,n=w(e);return!m(e)&&!x(e)&&("array"===n||0===t||"number"==typeof t&&0<t&&t-1 in e)}S.fn=S.prototype={jquery:f,constructor:S,length:0,toArray:function(){return s.call(this)},get:function(e){return null==e?s.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=S.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return S.each(this,e)},map:function(n){return this.pushStack(S.map(this,function(e,t){return n.call(e,t,e)}))},slice:function(){return this.pushStack(s.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},even:function(){return this.pushStack(S.grep(this,function(e,t){return(t+1)%2}))},odd:function(){return this.pushStack(S.grep(this,function(e,t){return t%2}))},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(0<=n&&n<t?[this[n]]:[])},end:function(){return this.prevObject||this.constructor()},push:u,sort:t.sort,splice:t.splice},S.extend=S.fn.extend=function(){var e,t,n,r,i,o,a=arguments[0]||{},s=1,u=arguments.length,l=!1;for("boolean"==typeof a&&(l=a,a=arguments[s]||{},s++),"object"==typeof a||m(a)||(a={}),s===u&&(a=this,s--);s<u;s++)if(null!=(e=arguments[s]))for(t in e)r=e[t],"__proto__"!==t&&a!==r&&(l&&r&&(S.isPlainObject(r)||(i=Array.isArray(r)))?(n=a[t],o=i&&!Array.isArray(n)?[]:i||S.isPlainObject(n)?n:{},i=!1,a[t]=S.extend(l,o,r)):void 0!==r&&(a[t]=r));return a},S.extend({expando:"jQuery"+(f+Math.random()).replace(/\D/g,""),isReady:!0,error:function(e){throw new Error(e)},noop:function(){},isPlainObject:function(e){var t,n;return!(!e||"[object Object]"!==o.call(e))&&(!(t=r(e))||"function"==typeof(n=v.call(t,"constructor")&&t.constructor)&&a.call(n)===l)},isEmptyObject:function(e){var t;for(t in e)return!1;return!0},globalEval:function(e,t,n){b(e,{nonce:t&&t.nonce},n)},each:function(e,t){var n,r=0;if(p(e)){for(n=e.length;r<n;r++)if(!1===t.call(e[r],r,e[r]))break}else for(r in e)if(!1===t.call(e[r],r,e[r]))break;return e},makeArray:function(e,t){var n=t||[];return null!=e&&(p(Object(e))?S.merge(n,"string"==typeof e?[e]:e):u.call(n,e)),n},inArray:function(e,t,n){return null==t?-1:i.call(t,e,n)},merge:function(e,t){for(var n=+t.length,r=0,i=e.length;r<n;r++)e[i++]=t[r];return e.length=i,e},grep:function(e,t,n){for(var r=[],i=0,o=e.length,a=!n;i<o;i++)!t(e[i],i)!==a&&r.push(e[i]);return r},map:function(e,t,n){var r,i,o=0,a=[];if(p(e))for(r=e.length;o<r;o++)null!=(i=t(e[o],o,n))&&a.push(i);else for(o in e)null!=(i=t(e[o],o,n))&&a.push(i);return g(a)},guid:1,support:y}),"function"==typeof Symbol&&(S.fn[Symbol.iterator]=t[Symbol.iterator]),S.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(e,t){n["[object "+t+"]"]=t.toLowerCase()});var d=function(n){var e,d,b,o,i,h,f,g,w,u,l,T,C,a,E,v,s,c,y,S="sizzle"+1*new Date,p=n.document,k=0,r=0,m=ue(),x=ue(),A=ue(),N=ue(),D=function(e,t){return e===t&&(l=!0),0},j={}.hasOwnProperty,t=[],q=t.pop,L=t.push,H=t.push,O=t.slice,P=function(e,t){for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1},R="checked|selected|async|autofocus|autoplay|controls|defer|disabled|hidden|ismap|loop|multiple|open|readonly|required|scoped",M="[\\x20\\t\\r\\n\\f]",I="(?:\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\[^\\r\\n\\f]|[\\w-]|[^\0-\\x7f])+",W="\\["+M+"*("+I+")(?:"+M+"*([*^$|!~]?=)"+M+"*(?:'((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\"|("+I+"))|)"+M+"*\\]",F=":("+I+")(?:\\((('((?:\\\\.|[^\\\\'])*)'|\"((?:\\\\.|[^\\\\\"])*)\")|((?:\\\\.|[^\\\\()[\\]]|"+W+")*)|.*)\\)|)",B=new RegExp(M+"+","g"),$=new RegExp("^"+M+"+|((?:^|[^\\\\])(?:\\\\.)*)"+M+"+$","g"),_=new RegExp("^"+M+"*,"+M+"*"),z=new RegExp("^"+M+"*([>+~]|"+M+")"+M+"*"),U=new RegExp(M+"|>"),X=new RegExp(F),V=new RegExp("^"+I+"$"),G={ID:new RegExp("^#("+I+")"),CLASS:new RegExp("^\\.("+I+")"),TAG:new RegExp("^("+I+"|[*])"),ATTR:new RegExp("^"+W),PSEUDO:new RegExp("^"+F),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+R+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},Y=/HTML$/i,Q=/^(?:input|select|textarea|button)$/i,J=/^h\d$/i,K=/^[^{]+\{\s*\[native \w/,Z=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,ee=/[+~]/,te=new RegExp("\\\\[\\da-fA-F]{1,6}"+M+"?|\\\\([^\\r\\n\\f])","g"),ne=function(e,t){var n="0x"+e.slice(1)-65536;return t||(n<0?String.fromCharCode(n+65536):String.fromCharCode(n>>10|55296,1023&n|56320))},re=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ie=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},oe=function(){T()},ae=be(function(e){return!0===e.disabled&&"fieldset"===e.nodeName.toLowerCase()},{dir:"parentNode",next:"legend"});try{H.apply(t=O.call(p.childNodes),p.childNodes),t[p.childNodes.length].nodeType}catch(e){H={apply:t.length?function(e,t){L.apply(e,O.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function se(t,e,n,r){var i,o,a,s,u,l,c,f=e&&e.ownerDocument,p=e?e.nodeType:9;if(n=n||[],"string"!=typeof t||!t||1!==p&&9!==p&&11!==p)return n;if(!r&&(T(e),e=e||C,E)){if(11!==p&&(u=Z.exec(t)))if(i=u[1]){if(9===p){if(!(a=e.getElementById(i)))return n;if(a.id===i)return n.push(a),n}else if(f&&(a=f.getElementById(i))&&y(e,a)&&a.id===i)return n.push(a),n}else{if(u[2])return H.apply(n,e.getElementsByTagName(t)),n;if((i=u[3])&&d.getElementsByClassName&&e.getElementsByClassName)return H.apply(n,e.getElementsByClassName(i)),n}if(d.qsa&&!N[t+" "]&&(!v||!v.test(t))&&(1!==p||"object"!==e.nodeName.toLowerCase())){if(c=t,f=e,1===p&&(U.test(t)||z.test(t))){(f=ee.test(t)&&ye(e.parentNode)||e)===e&&d.scope||((s=e.getAttribute("id"))?s=s.replace(re,ie):e.setAttribute("id",s=S)),o=(l=h(t)).length;while(o--)l[o]=(s?"#"+s:":scope")+" "+xe(l[o]);c=l.join(",")}try{return H.apply(n,f.querySelectorAll(c)),n}catch(e){N(t,!0)}finally{s===S&&e.removeAttribute("id")}}}return g(t.replace($,"$1"),e,n,r)}function ue(){var r=[];return function e(t,n){return r.push(t+" ")>b.cacheLength&&delete e[r.shift()],e[t+" "]=n}}function le(e){return e[S]=!0,e}function ce(e){var t=C.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function fe(e,t){var n=e.split("|"),r=n.length;while(r--)b.attrHandle[n[r]]=t}function pe(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function de(t){return function(e){return"input"===e.nodeName.toLowerCase()&&e.type===t}}function he(n){return function(e){var t=e.nodeName.toLowerCase();return("input"===t||"button"===t)&&e.type===n}}function ge(t){return function(e){return"form"in e?e.parentNode&&!1===e.disabled?"label"in e?"label"in e.parentNode?e.parentNode.disabled===t:e.disabled===t:e.isDisabled===t||e.isDisabled!==!t&&ae(e)===t:e.disabled===t:"label"in e&&e.disabled===t}}function ve(a){return le(function(o){return o=+o,le(function(e,t){var n,r=a([],e.length,o),i=r.length;while(i--)e[n=r[i]]&&(e[n]=!(t[n]=e[n]))})})}function ye(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}for(e in d=se.support={},i=se.isXML=function(e){var t=e.namespaceURI,n=(e.ownerDocument||e).documentElement;return!Y.test(t||n&&n.nodeName||"HTML")},T=se.setDocument=function(e){var t,n,r=e?e.ownerDocument||e:p;return r!=C&&9===r.nodeType&&r.documentElement&&(a=(C=r).documentElement,E=!i(C),p!=C&&(n=C.defaultView)&&n.top!==n&&(n.addEventListener?n.addEventListener("unload",oe,!1):n.attachEvent&&n.attachEvent("onunload",oe)),d.scope=ce(function(e){return a.appendChild(e).appendChild(C.createElement("div")),"undefined"!=typeof e.querySelectorAll&&!e.querySelectorAll(":scope fieldset div").length}),d.attributes=ce(function(e){return e.className="i",!e.getAttribute("className")}),d.getElementsByTagName=ce(function(e){return e.appendChild(C.createComment("")),!e.getElementsByTagName("*").length}),d.getElementsByClassName=K.test(C.getElementsByClassName),d.getById=ce(function(e){return a.appendChild(e).id=S,!C.getElementsByName||!C.getElementsByName(S).length}),d.getById?(b.filter.ID=function(e){var t=e.replace(te,ne);return function(e){return e.getAttribute("id")===t}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n=t.getElementById(e);return n?[n]:[]}}):(b.filter.ID=function(e){var n=e.replace(te,ne);return function(e){var t="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return t&&t.value===n}},b.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&E){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),b.find.TAG=d.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):d.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},b.find.CLASS=d.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&E)return t.getElementsByClassName(e)},s=[],v=[],(d.qsa=K.test(C.querySelectorAll))&&(ce(function(e){var t;a.appendChild(e).innerHTML="<a id='"+S+"'></a><select id='"+S+"-\r\\' msallowcapture=''><option selected=''></option></select>",e.querySelectorAll("[msallowcapture^='']").length&&v.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||v.push("\\["+M+"*(?:value|"+R+")"),e.querySelectorAll("[id~="+S+"-]").length||v.push("~="),(t=C.createElement("input")).setAttribute("name",""),e.appendChild(t),e.querySelectorAll("[name='']").length||v.push("\\["+M+"*name"+M+"*="+M+"*(?:''|\"\")"),e.querySelectorAll(":checked").length||v.push(":checked"),e.querySelectorAll("a#"+S+"+*").length||v.push(".#.+[+~]"),e.querySelectorAll("\\\f"),v.push("[\\r\\n\\f]")}),ce(function(e){e.innerHTML="<a href='' disabled='disabled'></a><select disabled='disabled'><option/></select>";var t=C.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&v.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&v.push(":enabled",":disabled"),a.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&v.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),v.push(",.*:")})),(d.matchesSelector=K.test(c=a.matches||a.webkitMatchesSelector||a.mozMatchesSelector||a.oMatchesSelector||a.msMatchesSelector))&&ce(function(e){d.disconnectedMatch=c.call(e,"*"),c.call(e,"[s!='']:x"),s.push("!=",F)}),v=v.length&&new RegExp(v.join("|")),s=s.length&&new RegExp(s.join("|")),t=K.test(a.compareDocumentPosition),y=t||K.test(a.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return l=!0,0;var n=!e.compareDocumentPosition-!t.compareDocumentPosition;return n||(1&(n=(e.ownerDocument||e)==(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!d.sortDetached&&t.compareDocumentPosition(e)===n?e==C||e.ownerDocument==p&&y(p,e)?-1:t==C||t.ownerDocument==p&&y(p,t)?1:u?P(u,e)-P(u,t):0:4&n?-1:1)}:function(e,t){if(e===t)return l=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e==C?-1:t==C?1:i?-1:o?1:u?P(u,e)-P(u,t):0;if(i===o)return pe(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?pe(a[r],s[r]):a[r]==p?-1:s[r]==p?1:0}),C},se.matches=function(e,t){return se(e,null,null,t)},se.matchesSelector=function(e,t){if(T(e),d.matchesSelector&&E&&!N[t+" "]&&(!s||!s.test(t))&&(!v||!v.test(t)))try{var n=c.call(e,t);if(n||d.disconnectedMatch||e.document&&11!==e.document.nodeType)return n}catch(e){N(t,!0)}return 0<se(t,C,null,[e]).length},se.contains=function(e,t){return(e.ownerDocument||e)!=C&&T(e),y(e,t)},se.attr=function(e,t){(e.ownerDocument||e)!=C&&T(e);var n=b.attrHandle[t.toLowerCase()],r=n&&j.call(b.attrHandle,t.toLowerCase())?n(e,t,!E):void 0;return void 0!==r?r:d.attributes||!E?e.getAttribute(t):(r=e.getAttributeNode(t))&&r.specified?r.value:null},se.escape=function(e){return(e+"").replace(re,ie)},se.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},se.uniqueSort=function(e){var t,n=[],r=0,i=0;if(l=!d.detectDuplicates,u=!d.sortStable&&e.slice(0),e.sort(D),l){while(t=e[i++])t===e[i]&&(r=n.push(i));while(r--)e.splice(n[r],1)}return u=null,e},o=se.getText=function(e){var t,n="",r=0,i=e.nodeType;if(i){if(1===i||9===i||11===i){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=o(e)}else if(3===i||4===i)return e.nodeValue}else while(t=e[r++])n+=o(t);return n},(b=se.selectors={cacheLength:50,createPseudo:le,match:G,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(te,ne),e[3]=(e[3]||e[4]||e[5]||"").replace(te,ne),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||se.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&se.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return G.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=h(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(te,ne).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=m[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&m(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(n,r,i){return function(e){var t=se.attr(e,n);return null==t?"!="===r:!r||(t+="","="===r?t===i:"!="===r?t!==i:"^="===r?i&&0===t.indexOf(i):"*="===r?i&&-1<t.indexOf(i):"$="===r?i&&t.slice(-i.length)===i:"~="===r?-1<(" "+t.replace(B," ")+" ").indexOf(i):"|="===r&&(t===i||t.slice(0,i.length+1)===i+"-"))}},CHILD:function(h,e,t,g,v){var y="nth"!==h.slice(0,3),m="last"!==h.slice(-4),x="of-type"===e;return 1===g&&0===v?function(e){return!!e.parentNode}:function(e,t,n){var r,i,o,a,s,u,l=y!==m?"nextSibling":"previousSibling",c=e.parentNode,f=x&&e.nodeName.toLowerCase(),p=!n&&!x,d=!1;if(c){if(y){while(l){a=e;while(a=a[l])if(x?a.nodeName.toLowerCase()===f:1===a.nodeType)return!1;u=l="only"===h&&!u&&"nextSibling"}return!0}if(u=[m?c.firstChild:c.lastChild],m&&p){d=(s=(r=(i=(o=(a=c)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1])&&r[2],a=s&&c.childNodes[s];while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if(1===a.nodeType&&++d&&a===e){i[h]=[k,s,d];break}}else if(p&&(d=s=(r=(i=(o=(a=e)[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]||[])[0]===k&&r[1]),!1===d)while(a=++s&&a&&a[l]||(d=s=0)||u.pop())if((x?a.nodeName.toLowerCase()===f:1===a.nodeType)&&++d&&(p&&((i=(o=a[S]||(a[S]={}))[a.uniqueID]||(o[a.uniqueID]={}))[h]=[k,d]),a===e))break;return(d-=v)===g||d%g==0&&0<=d/g}}},PSEUDO:function(e,o){var t,a=b.pseudos[e]||b.setFilters[e.toLowerCase()]||se.error("unsupported pseudo: "+e);return a[S]?a(o):1<a.length?(t=[e,e,"",o],b.setFilters.hasOwnProperty(e.toLowerCase())?le(function(e,t){var n,r=a(e,o),i=r.length;while(i--)e[n=P(e,r[i])]=!(t[n]=r[i])}):function(e){return a(e,0,t)}):a}},pseudos:{not:le(function(e){var r=[],i=[],s=f(e.replace($,"$1"));return s[S]?le(function(e,t,n,r){var i,o=s(e,null,r,[]),a=e.length;while(a--)(i=o[a])&&(e[a]=!(t[a]=i))}):function(e,t,n){return r[0]=e,s(r,null,n,i),r[0]=null,!i.pop()}}),has:le(function(t){return function(e){return 0<se(t,e).length}}),contains:le(function(t){return t=t.replace(te,ne),function(e){return-1<(e.textContent||o(e)).indexOf(t)}}),lang:le(function(n){return V.test(n||"")||se.error("unsupported lang: "+n),n=n.replace(te,ne).toLowerCase(),function(e){var t;do{if(t=E?e.lang:e.getAttribute("xml:lang")||e.getAttribute("lang"))return(t=t.toLowerCase())===n||0===t.indexOf(n+"-")}while((e=e.parentNode)&&1===e.nodeType);return!1}}),target:function(e){var t=n.location&&n.location.hash;return t&&t.slice(1)===e.id},root:function(e){return e===a},focus:function(e){return e===C.activeElement&&(!C.hasFocus||C.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:ge(!1),disabled:ge(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!b.pseudos.empty(e)},header:function(e){return J.test(e.nodeName)},input:function(e){return Q.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:ve(function(){return[0]}),last:ve(function(e,t){return[t-1]}),eq:ve(function(e,t,n){return[n<0?n+t:n]}),even:ve(function(e,t){for(var n=0;n<t;n+=2)e.push(n);return e}),odd:ve(function(e,t){for(var n=1;n<t;n+=2)e.push(n);return e}),lt:ve(function(e,t,n){for(var r=n<0?n+t:t<n?t:n;0<=--r;)e.push(r);return e}),gt:ve(function(e,t,n){for(var r=n<0?n+t:n;++r<t;)e.push(r);return e})}}).pseudos.nth=b.pseudos.eq,{radio:!0,checkbox:!0,file:!0,password:!0,image:!0})b.pseudos[e]=de(e);for(e in{submit:!0,reset:!0})b.pseudos[e]=he(e);function me(){}function xe(e){for(var t=0,n=e.length,r="";t<n;t++)r+=e[t].value;return r}function be(s,e,t){var u=e.dir,l=e.next,c=l||u,f=t&&"parentNode"===c,p=r++;return e.first?function(e,t,n){while(e=e[u])if(1===e.nodeType||f)return s(e,t,n);return!1}:function(e,t,n){var r,i,o,a=[k,p];if(n){while(e=e[u])if((1===e.nodeType||f)&&s(e,t,n))return!0}else while(e=e[u])if(1===e.nodeType||f)if(i=(o=e[S]||(e[S]={}))[e.uniqueID]||(o[e.uniqueID]={}),l&&l===e.nodeName.toLowerCase())e=e[u]||e;else{if((r=i[c])&&r[0]===k&&r[1]===p)return a[2]=r[2];if((i[c]=a)[2]=s(e,t,n))return!0}return!1}}function we(i){return 1<i.length?function(e,t,n){var r=i.length;while(r--)if(!i[r](e,t,n))return!1;return!0}:i[0]}function Te(e,t,n,r,i){for(var o,a=[],s=0,u=e.length,l=null!=t;s<u;s++)(o=e[s])&&(n&&!n(o,r,i)||(a.push(o),l&&t.push(s)));return a}function Ce(d,h,g,v,y,e){return v&&!v[S]&&(v=Ce(v)),y&&!y[S]&&(y=Ce(y,e)),le(function(e,t,n,r){var i,o,a,s=[],u=[],l=t.length,c=e||function(e,t,n){for(var r=0,i=t.length;r<i;r++)se(e,t[r],n);return n}(h||"*",n.nodeType?[n]:n,[]),f=!d||!e&&h?c:Te(c,s,d,n,r),p=g?y||(e?d:l||v)?[]:t:f;if(g&&g(f,p,n,r),v){i=Te(p,u),v(i,[],n,r),o=i.length;while(o--)(a=i[o])&&(p[u[o]]=!(f[u[o]]=a))}if(e){if(y||d){if(y){i=[],o=p.length;while(o--)(a=p[o])&&i.push(f[o]=a);y(null,p=[],i,r)}o=p.length;while(o--)(a=p[o])&&-1<(i=y?P(e,a):s[o])&&(e[i]=!(t[i]=a))}}else p=Te(p===t?p.splice(l,p.length):p),y?y(null,t,p,r):H.apply(t,p)})}function Ee(e){for(var i,t,n,r=e.length,o=b.relative[e[0].type],a=o||b.relative[" "],s=o?1:0,u=be(function(e){return e===i},a,!0),l=be(function(e){return-1<P(i,e)},a,!0),c=[function(e,t,n){var r=!o&&(n||t!==w)||((i=t).nodeType?u(e,t,n):l(e,t,n));return i=null,r}];s<r;s++)if(t=b.relative[e[s].type])c=[be(we(c),t)];else{if((t=b.filter[e[s].type].apply(null,e[s].matches))[S]){for(n=++s;n<r;n++)if(b.relative[e[n].type])break;return Ce(1<s&&we(c),1<s&&xe(e.slice(0,s-1).concat({value:" "===e[s-2].type?"*":""})).replace($,"$1"),t,s<n&&Ee(e.slice(s,n)),n<r&&Ee(e=e.slice(n)),n<r&&xe(e))}c.push(t)}return we(c)}return me.prototype=b.filters=b.pseudos,b.setFilters=new me,h=se.tokenize=function(e,t){var n,r,i,o,a,s,u,l=x[e+" "];if(l)return t?0:l.slice(0);a=e,s=[],u=b.preFilter;while(a){for(o in n&&!(r=_.exec(a))||(r&&(a=a.slice(r[0].length)||a),s.push(i=[])),n=!1,(r=z.exec(a))&&(n=r.shift(),i.push({value:n,type:r[0].replace($," ")}),a=a.slice(n.length)),b.filter)!(r=G[o].exec(a))||u[o]&&!(r=u[o](r))||(n=r.shift(),i.push({value:n,type:o,matches:r}),a=a.slice(n.length));if(!n)break}return t?a.length:a?se.error(e):x(e,s).slice(0)},f=se.compile=function(e,t){var n,v,y,m,x,r,i=[],o=[],a=A[e+" "];if(!a){t||(t=h(e)),n=t.length;while(n--)(a=Ee(t[n]))[S]?i.push(a):o.push(a);(a=A(e,(v=o,m=0<(y=i).length,x=0<v.length,r=function(e,t,n,r,i){var o,a,s,u=0,l="0",c=e&&[],f=[],p=w,d=e||x&&b.find.TAG("*",i),h=k+=null==p?1:Math.random()||.1,g=d.length;for(i&&(w=t==C||t||i);l!==g&&null!=(o=d[l]);l++){if(x&&o){a=0,t||o.ownerDocument==C||(T(o),n=!E);while(s=v[a++])if(s(o,t||C,n)){r.push(o);break}i&&(k=h)}m&&((o=!s&&o)&&u--,e&&c.push(o))}if(u+=l,m&&l!==u){a=0;while(s=y[a++])s(c,f,t,n);if(e){if(0<u)while(l--)c[l]||f[l]||(f[l]=q.call(r));f=Te(f)}H.apply(r,f),i&&!e&&0<f.length&&1<u+y.length&&se.uniqueSort(r)}return i&&(k=h,w=p),c},m?le(r):r))).selector=e}return a},g=se.select=function(e,t,n,r){var i,o,a,s,u,l="function"==typeof e&&e,c=!r&&h(e=l.selector||e);if(n=n||[],1===c.length){if(2<(o=c[0]=c[0].slice(0)).length&&"ID"===(a=o[0]).type&&9===t.nodeType&&E&&b.relative[o[1].type]){if(!(t=(b.find.ID(a.matches[0].replace(te,ne),t)||[])[0]))return n;l&&(t=t.parentNode),e=e.slice(o.shift().value.length)}i=G.needsContext.test(e)?0:o.length;while(i--){if(a=o[i],b.relative[s=a.type])break;if((u=b.find[s])&&(r=u(a.matches[0].replace(te,ne),ee.test(o[0].type)&&ye(t.parentNode)||t))){if(o.splice(i,1),!(e=r.length&&xe(o)))return H.apply(n,r),n;break}}}return(l||f(e,c))(r,t,!E,n,!t||ee.test(e)&&ye(t.parentNode)||t),n},d.sortStable=S.split("").sort(D).join("")===S,d.detectDuplicates=!!l,T(),d.sortDetached=ce(function(e){return 1&e.compareDocumentPosition(C.createElement("fieldset"))}),ce(function(e){return e.innerHTML="<a href='#'></a>","#"===e.firstChild.getAttribute("href")})||fe("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),d.attributes&&ce(function(e){return e.innerHTML="<input/>",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||fe("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ce(function(e){return null==e.getAttribute("disabled")})||fe(R,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),se}(C);S.find=d,S.expr=d.selectors,S.expr[":"]=S.expr.pseudos,S.uniqueSort=S.unique=d.uniqueSort,S.text=d.getText,S.isXMLDoc=d.isXML,S.contains=d.contains,S.escapeSelector=d.escape;var h=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&S(e).is(n))break;r.push(e)}return r},T=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},k=S.expr.match.needsContext;function A(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var N=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function D(e,n,r){return m(n)?S.grep(e,function(e,t){return!!n.call(e,t,e)!==r}):n.nodeType?S.grep(e,function(e){return e===n!==r}):"string"!=typeof n?S.grep(e,function(e){return-1<i.call(n,e)!==r}):S.filter(n,e,r)}S.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?S.find.matchesSelector(r,e)?[r]:[]:S.find.matches(e,S.grep(t,function(e){return 1===e.nodeType}))},S.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(S(e).filter(function(){for(t=0;t<r;t++)if(S.contains(i[t],this))return!0}));for(n=this.pushStack([]),t=0;t<r;t++)S.find(e,i[t],n);return 1<r?S.uniqueSort(n):n},filter:function(e){return this.pushStack(D(this,e||[],!1))},not:function(e){return this.pushStack(D(this,e||[],!0))},is:function(e){return!!D(this,"string"==typeof e&&k.test(e)?S(e):e||[],!1).length}});var j,q=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(S.fn.init=function(e,t,n){var r,i;if(!e)return this;if(n=n||j,"string"==typeof e){if(!(r="<"===e[0]&&">"===e[e.length-1]&&3<=e.length?[null,e,null]:q.exec(e))||!r[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(r[1]){if(t=t instanceof S?t[0]:t,S.merge(this,S.parseHTML(r[1],t&&t.nodeType?t.ownerDocument||t:E,!0)),N.test(r[1])&&S.isPlainObject(t))for(r in t)m(this[r])?this[r](t[r]):this.attr(r,t[r]);return this}return(i=E.getElementById(r[2]))&&(this[0]=i,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):m(e)?void 0!==n.ready?n.ready(e):e(S):S.makeArray(e,this)}).prototype=S.fn,j=S(E);var L=/^(?:parents|prev(?:Until|All))/,H={children:!0,contents:!0,next:!0,prev:!0};function O(e,t){while((e=e[t])&&1!==e.nodeType);return e}S.fn.extend({has:function(e){var t=S(e,this),n=t.length;return this.filter(function(){for(var e=0;e<n;e++)if(S.contains(this,t[e]))return!0})},closest:function(e,t){var n,r=0,i=this.length,o=[],a="string"!=typeof e&&S(e);if(!k.test(e))for(;r<i;r++)for(n=this[r];n&&n!==t;n=n.parentNode)if(n.nodeType<11&&(a?-1<a.index(n):1===n.nodeType&&S.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(1<o.length?S.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?i.call(S(e),this[0]):i.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(S.uniqueSort(S.merge(this.get(),S(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}}),S.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return h(e,"parentNode")},parentsUntil:function(e,t,n){return h(e,"parentNode",n)},next:function(e){return O(e,"nextSibling")},prev:function(e){return O(e,"previousSibling")},nextAll:function(e){return h(e,"nextSibling")},prevAll:function(e){return h(e,"previousSibling")},nextUntil:function(e,t,n){return h(e,"nextSibling",n)},prevUntil:function(e,t,n){return h(e,"previousSibling",n)},siblings:function(e){return T((e.parentNode||{}).firstChild,e)},children:function(e){return T(e.firstChild)},contents:function(e){return null!=e.contentDocument&&r(e.contentDocument)?e.contentDocument:(A(e,"template")&&(e=e.content||e),S.merge([],e.childNodes))}},function(r,i){S.fn[r]=function(e,t){var n=S.map(this,i,e);return"Until"!==r.slice(-5)&&(t=e),t&&"string"==typeof t&&(n=S.filter(t,n)),1<this.length&&(H[r]||S.uniqueSort(n),L.test(r)&&n.reverse()),this.pushStack(n)}});var P=/[^\x20\t\r\n\f]+/g;function R(e){return e}function M(e){throw e}function I(e,t,n,r){var i;try{e&&m(i=e.promise)?i.call(e).done(t).fail(n):e&&m(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}S.Callbacks=function(r){var e,n;r="string"==typeof r?(e=r,n={},S.each(e.match(P)||[],function(e,t){n[t]=!0}),n):S.extend({},r);var i,t,o,a,s=[],u=[],l=-1,c=function(){for(a=a||r.once,o=i=!0;u.length;l=-1){t=u.shift();while(++l<s.length)!1===s[l].apply(t[0],t[1])&&r.stopOnFalse&&(l=s.length,t=!1)}r.memory||(t=!1),i=!1,a&&(s=t?[]:"")},f={add:function(){return s&&(t&&!i&&(l=s.length-1,u.push(t)),function n(e){S.each(e,function(e,t){m(t)?r.unique&&f.has(t)||s.push(t):t&&t.length&&"string"!==w(t)&&n(t)})}(arguments),t&&!i&&c()),this},remove:function(){return S.each(arguments,function(e,t){var n;while(-1<(n=S.inArray(t,s,n)))s.splice(n,1),n<=l&&l--}),this},has:function(e){return e?-1<S.inArray(e,s):0<s.length},empty:function(){return s&&(s=[]),this},disable:function(){return a=u=[],s=t="",this},disabled:function(){return!s},lock:function(){return a=u=[],t||i||(s=t=""),this},locked:function(){return!!a},fireWith:function(e,t){return a||(t=[e,(t=t||[]).slice?t.slice():t],u.push(t),i||c()),this},fire:function(){return f.fireWith(this,arguments),this},fired:function(){return!!o}};return f},S.extend({Deferred:function(e){var o=[["notify","progress",S.Callbacks("memory"),S.Callbacks("memory"),2],["resolve","done",S.Callbacks("once memory"),S.Callbacks("once memory"),0,"resolved"],["reject","fail",S.Callbacks("once memory"),S.Callbacks("once memory"),1,"rejected"]],i="pending",a={state:function(){return i},always:function(){return s.done(arguments).fail(arguments),this},"catch":function(e){return a.then(null,e)},pipe:function(){var i=arguments;return S.Deferred(function(r){S.each(o,function(e,t){var n=m(i[t[4]])&&i[t[4]];s[t[1]](function(){var e=n&&n.apply(this,arguments);e&&m(e.promise)?e.promise().progress(r.notify).done(r.resolve).fail(r.reject):r[t[0]+"With"](this,n?[e]:arguments)})}),i=null}).promise()},then:function(t,n,r){var u=0;function l(i,o,a,s){return function(){var n=this,r=arguments,e=function(){var e,t;if(!(i<u)){if((e=a.apply(n,r))===o.promise())throw new TypeError("Thenable self-resolution");t=e&&("object"==typeof e||"function"==typeof e)&&e.then,m(t)?s?t.call(e,l(u,o,R,s),l(u,o,M,s)):(u++,t.call(e,l(u,o,R,s),l(u,o,M,s),l(u,o,R,o.notifyWith))):(a!==R&&(n=void 0,r=[e]),(s||o.resolveWith)(n,r))}},t=s?e:function(){try{e()}catch(e){S.Deferred.exceptionHook&&S.Deferred.exceptionHook(e,t.stackTrace),u<=i+1&&(a!==M&&(n=void 0,r=[e]),o.rejectWith(n,r))}};i?t():(S.Deferred.getStackHook&&(t.stackTrace=S.Deferred.getStackHook()),C.setTimeout(t))}}return S.Deferred(function(e){o[0][3].add(l(0,e,m(r)?r:R,e.notifyWith)),o[1][3].add(l(0,e,m(t)?t:R)),o[2][3].add(l(0,e,m(n)?n:M))}).promise()},promise:function(e){return null!=e?S.extend(e,a):a}},s={};return S.each(o,function(e,t){var n=t[2],r=t[5];a[t[1]]=n.add,r&&n.add(function(){i=r},o[3-e][2].disable,o[3-e][3].disable,o[0][2].lock,o[0][3].lock),n.add(t[3].fire),s[t[0]]=function(){return s[t[0]+"With"](this===s?void 0:this,arguments),this},s[t[0]+"With"]=n.fireWith}),a.promise(s),e&&e.call(s,s),s},when:function(e){var n=arguments.length,t=n,r=Array(t),i=s.call(arguments),o=S.Deferred(),a=function(t){return function(e){r[t]=this,i[t]=1<arguments.length?s.call(arguments):e,--n||o.resolveWith(r,i)}};if(n<=1&&(I(e,o.done(a(t)).resolve,o.reject,!n),"pending"===o.state()||m(i[t]&&i[t].then)))return o.then();while(t--)I(i[t],a(t),o.reject);return o.promise()}});var W=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;S.Deferred.exceptionHook=function(e,t){C.console&&C.console.warn&&e&&W.test(e.name)&&C.console.warn("jQuery.Deferred exception: "+e.message,e.stack,t)},S.readyException=function(e){C.setTimeout(function(){throw e})};var F=S.Deferred();function B(){E.removeEventListener("DOMContentLoaded",B),C.removeEventListener("load",B),S.ready()}S.fn.ready=function(e){return F.then(e)["catch"](function(e){S.readyException(e)}),this},S.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--S.readyWait:S.isReady)||(S.isReady=!0)!==e&&0<--S.readyWait||F.resolveWith(E,[S])}}),S.ready.then=F.then,"complete"===E.readyState||"loading"!==E.readyState&&!E.documentElement.doScroll?C.setTimeout(S.ready):(E.addEventListener("DOMContentLoaded",B),C.addEventListener("load",B));var $=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===w(n))for(s in i=!0,n)$(e,t,s,n[s],!0,o,a);else if(void 0!==r&&(i=!0,m(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(S(e),n)})),t))for(;s<u;s++)t(e[s],n,a?r:r.call(e[s],s,t(e[s],n)));return i?e:l?t.call(e):u?t(e[0],n):o},_=/^-ms-/,z=/-([a-z])/g;function U(e,t){return t.toUpperCase()}function X(e){return e.replace(_,"ms-").replace(z,U)}var V=function(e){return 1===e.nodeType||9===e.nodeType||!+e.nodeType};function G(){this.expando=S.expando+G.uid++}G.uid=1,G.prototype={cache:function(e){var t=e[this.expando];return t||(t={},V(e)&&(e.nodeType?e[this.expando]=t:Object.defineProperty(e,this.expando,{value:t,configurable:!0}))),t},set:function(e,t,n){var r,i=this.cache(e);if("string"==typeof t)i[X(t)]=n;else for(r in t)i[X(r)]=t[r];return i},get:function(e,t){return void 0===t?this.cache(e):e[this.expando]&&e[this.expando][X(t)]},access:function(e,t,n){return void 0===t||t&&"string"==typeof t&&void 0===n?this.get(e,t):(this.set(e,t,n),void 0!==n?n:t)},remove:function(e,t){var n,r=e[this.expando];if(void 0!==r){if(void 0!==t){n=(t=Array.isArray(t)?t.map(X):(t=X(t))in r?[t]:t.match(P)||[]).length;while(n--)delete r[t[n]]}(void 0===t||S.isEmptyObject(r))&&(e.nodeType?e[this.expando]=void 0:delete e[this.expando])}},hasData:function(e){var t=e[this.expando];return void 0!==t&&!S.isEmptyObject(t)}};var Y=new G,Q=new G,J=/^(?:\{[\w\W]*\}|\[[\w\W]*\])$/,K=/[A-Z]/g;function Z(e,t,n){var r,i;if(void 0===n&&1===e.nodeType)if(r="data-"+t.replace(K,"-$&").toLowerCase(),"string"==typeof(n=e.getAttribute(r))){try{n="true"===(i=n)||"false"!==i&&("null"===i?null:i===+i+""?+i:J.test(i)?JSON.parse(i):i)}catch(e){}Q.set(e,t,n)}else n=void 0;return n}S.extend({hasData:function(e){return Q.hasData(e)||Y.hasData(e)},data:function(e,t,n){return Q.access(e,t,n)},removeData:function(e,t){Q.remove(e,t)},_data:function(e,t,n){return Y.access(e,t,n)},_removeData:function(e,t){Y.remove(e,t)}}),S.fn.extend({data:function(n,e){var t,r,i,o=this[0],a=o&&o.attributes;if(void 0===n){if(this.length&&(i=Q.get(o),1===o.nodeType&&!Y.get(o,"hasDataAttrs"))){t=a.length;while(t--)a[t]&&0===(r=a[t].name).indexOf("data-")&&(r=X(r.slice(5)),Z(o,r,i[r]));Y.set(o,"hasDataAttrs",!0)}return i}return"object"==typeof n?this.each(function(){Q.set(this,n)}):$(this,function(e){var t;if(o&&void 0===e)return void 0!==(t=Q.get(o,n))?t:void 0!==(t=Z(o,n))?t:void 0;this.each(function(){Q.set(this,n,e)})},null,e,1<arguments.length,null,!0)},removeData:function(e){return this.each(function(){Q.remove(this,e)})}}),S.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=Y.get(e,t),n&&(!r||Array.isArray(n)?r=Y.access(e,t,S.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=S.queue(e,t),r=n.length,i=n.shift(),o=S._queueHooks(e,t);"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,function(){S.dequeue(e,t)},o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return Y.get(e,n)||Y.access(e,n,{empty:S.Callbacks("once memory").add(function(){Y.remove(e,[t+"queue",n])})})}}),S.fn.extend({queue:function(t,n){var e=2;return"string"!=typeof t&&(n=t,t="fx",e--),arguments.length<e?S.queue(this[0],t):void 0===n?this:this.each(function(){var e=S.queue(this,t,n);S._queueHooks(this,t),"fx"===t&&"inprogress"!==e[0]&&S.dequeue(this,t)})},dequeue:function(e){return this.each(function(){S.dequeue(this,e)})},clearQueue:function(e){return this.queue(e||"fx",[])},promise:function(e,t){var n,r=1,i=S.Deferred(),o=this,a=this.length,s=function(){--r||i.resolveWith(o,[o])};"string"!=typeof e&&(t=e,e=void 0),e=e||"fx";while(a--)(n=Y.get(o[a],e+"queueHooks"))&&n.empty&&(r++,n.empty.add(s));return s(),i.promise(t)}});var ee=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source,te=new RegExp("^(?:([+-])=|)("+ee+")([a-z%]*)$","i"),ne=["Top","Right","Bottom","Left"],re=E.documentElement,ie=function(e){return S.contains(e.ownerDocument,e)},oe={composed:!0};re.getRootNode&&(ie=function(e){return S.contains(e.ownerDocument,e)||e.getRootNode(oe)===e.ownerDocument});var ae=function(e,t){return"none"===(e=t||e).style.display||""===e.style.display&&ie(e)&&"none"===S.css(e,"display")};function se(e,t,n,r){var i,o,a=20,s=r?function(){return r.cur()}:function(){return S.css(e,t,"")},u=s(),l=n&&n[3]||(S.cssNumber[t]?"":"px"),c=e.nodeType&&(S.cssNumber[t]||"px"!==l&&+u)&&te.exec(S.css(e,t));if(c&&c[3]!==l){u/=2,l=l||c[3],c=+u||1;while(a--)S.style(e,t,c+l),(1-o)*(1-(o=s()/u||.5))<=0&&(a=0),c/=o;c*=2,S.style(e,t,c+l),n=n||[]}return n&&(c=+c||+u||0,i=n[1]?c+(n[1]+1)*n[2]:+n[2],r&&(r.unit=l,r.start=c,r.end=i)),i}var ue={};function le(e,t){for(var n,r,i,o,a,s,u,l=[],c=0,f=e.length;c<f;c++)(r=e[c]).style&&(n=r.style.display,t?("none"===n&&(l[c]=Y.get(r,"display")||null,l[c]||(r.style.display="")),""===r.style.display&&ae(r)&&(l[c]=(u=a=o=void 0,a=(i=r).ownerDocument,s=i.nodeName,(u=ue[s])||(o=a.body.appendChild(a.createElement(s)),u=S.css(o,"display"),o.parentNode.removeChild(o),"none"===u&&(u="block"),ue[s]=u)))):"none"!==n&&(l[c]="none",Y.set(r,"display",n)));for(c=0;c<f;c++)null!=l[c]&&(e[c].style.display=l[c]);return e}S.fn.extend({show:function(){return le(this,!0)},hide:function(){return le(this)},toggle:function(e){return"boolean"==typeof e?e?this.show():this.hide():this.each(function(){ae(this)?S(this).show():S(this).hide()})}});var ce,fe,pe=/^(?:checkbox|radio)$/i,de=/<([a-z][^\/\0>\x20\t\r\n\f]*)/i,he=/^$|^module$|\/(?:java|ecma)script/i;ce=E.createDocumentFragment().appendChild(E.createElement("div")),(fe=E.createElement("input")).setAttribute("type","radio"),fe.setAttribute("checked","checked"),fe.setAttribute("name","t"),ce.appendChild(fe),y.checkClone=ce.cloneNode(!0).cloneNode(!0).lastChild.checked,ce.innerHTML="<textarea>x</textarea>",y.noCloneChecked=!!ce.cloneNode(!0).lastChild.defaultValue,ce.innerHTML="<option></option>",y.option=!!ce.lastChild;var ge={thead:[1,"<table>","</table>"],col:[2,"<table><colgroup>","</colgroup></table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],_default:[0,"",""]};function ve(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&A(e,t)?S.merge([e],n):n}function ye(e,t){for(var n=0,r=e.length;n<r;n++)Y.set(e[n],"globalEval",!t||Y.get(t[n],"globalEval"))}ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td,y.option||(ge.optgroup=ge.option=[1,"<select multiple='multiple'>","</select>"]);var me=/<|&#?\w+;/;function xe(e,t,n,r,i){for(var o,a,s,u,l,c,f=t.createDocumentFragment(),p=[],d=0,h=e.length;d<h;d++)if((o=e[d])||0===o)if("object"===w(o))S.merge(p,o.nodeType?[o]:o);else if(me.test(o)){a=a||f.appendChild(t.createElement("div")),s=(de.exec(o)||["",""])[1].toLowerCase(),u=ge[s]||ge._default,a.innerHTML=u[1]+S.htmlPrefilter(o)+u[2],c=u[0];while(c--)a=a.lastChild;S.merge(p,a.childNodes),(a=f.firstChild).textContent=""}else p.push(t.createTextNode(o));f.textContent="",d=0;while(o=p[d++])if(r&&-1<S.inArray(o,r))i&&i.push(o);else if(l=ie(o),a=ve(f.appendChild(o),"script"),l&&ye(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}var be=/^key/,we=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Te=/^([^.]*)(?:\.(.+)|)/;function Ce(){return!0}function Ee(){return!1}function Se(e,t){return e===function(){try{return E.activeElement}catch(e){}}()==("focus"===t)}function ke(e,t,n,r,i,o){var a,s;if("object"==typeof t){for(s in"string"!=typeof n&&(r=r||n,n=void 0),t)ke(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=Ee;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return S().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=S.guid++)),e.each(function(){S.event.add(this,t,i,r,n)})}function Ae(e,i,o){o?(Y.set(e,i,!1),S.event.add(e,i,{namespace:!1,handler:function(e){var t,n,r=Y.get(this,i);if(1&e.isTrigger&&this[i]){if(r.length)(S.event.special[i]||{}).delegateType&&e.stopPropagation();else if(r=s.call(arguments),Y.set(this,i,r),t=o(this,i),this[i](),r!==(n=Y.get(this,i))||t?Y.set(this,i,!1):n={},r!==n)return e.stopImmediatePropagation(),e.preventDefault(),n.value}else r.length&&(Y.set(this,i,{value:S.event.trigger(S.extend(r[0],S.Event.prototype),r.slice(1),this)}),e.stopImmediatePropagation())}})):void 0===Y.get(e,i)&&S.event.add(e,i,Ce)}S.event={global:{},add:function(t,e,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.get(t);if(V(t)){n.handler&&(n=(o=n).handler,i=o.selector),i&&S.find.matchesSelector(re,i),n.guid||(n.guid=S.guid++),(u=v.events)||(u=v.events=Object.create(null)),(a=v.handle)||(a=v.handle=function(e){return"undefined"!=typeof S&&S.event.triggered!==e.type?S.event.dispatch.apply(t,arguments):void 0}),l=(e=(e||"").match(P)||[""]).length;while(l--)d=g=(s=Te.exec(e[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=S.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=S.event.special[d]||{},c=S.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&S.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(t,r,h,a)||t.addEventListener&&t.addEventListener(d,a)),f.add&&(f.add.call(t,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),S.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,v=Y.hasData(e)&&Y.get(e);if(v&&(u=v.events)){l=(t=(t||"").match(P)||[""]).length;while(l--)if(d=g=(s=Te.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d){f=S.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,v.handle)||S.removeEvent(e,d,v.handle),delete u[d])}else for(d in u)S.event.remove(e,d+t[l],n,r,!0);S.isEmptyObject(u)&&Y.remove(e,"handle events")}},dispatch:function(e){var t,n,r,i,o,a,s=new Array(arguments.length),u=S.event.fix(e),l=(Y.get(this,"events")||Object.create(null))[u.type]||[],c=S.event.special[u.type]||{};for(s[0]=u,t=1;t<arguments.length;t++)s[t]=arguments[t];if(u.delegateTarget=this,!c.preDispatch||!1!==c.preDispatch.call(this,u)){a=S.event.handlers.call(this,u,l),t=0;while((i=a[t++])&&!u.isPropagationStopped()){u.currentTarget=i.elem,n=0;while((o=i.handlers[n++])&&!u.isImmediatePropagationStopped())u.rnamespace&&!1!==o.namespace&&!u.rnamespace.test(o.namespace)||(u.handleObj=o,u.data=o.data,void 0!==(r=((S.event.special[o.origType]||{}).handle||o.handler).apply(i.elem,s))&&!1===(u.result=r)&&(u.preventDefault(),u.stopPropagation()))}return c.postDispatch&&c.postDispatch.call(this,u),u.result}},handlers:function(e,t){var n,r,i,o,a,s=[],u=t.delegateCount,l=e.target;if(u&&l.nodeType&&!("click"===e.type&&1<=e.button))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n<u;n++)void 0===a[i=(r=t[n]).selector+" "]&&(a[i]=r.needsContext?-1<S(i,this).index(l):S.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u<t.length&&s.push({elem:l,handlers:t.slice(u)}),s},addProp:function(t,e){Object.defineProperty(S.Event.prototype,t,{enumerable:!0,configurable:!0,get:m(e)?function(){if(this.originalEvent)return e(this.originalEvent)}:function(){if(this.originalEvent)return this.originalEvent[t]},set:function(e){Object.defineProperty(this,t,{enumerable:!0,configurable:!0,writable:!0,value:e})}})},fix:function(e){return e[S.expando]?e:new S.Event(e)},special:{load:{noBubble:!0},click:{setup:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click",Ce),!1},trigger:function(e){var t=this||e;return pe.test(t.type)&&t.click&&A(t,"input")&&Ae(t,"click"),!0},_default:function(e){var t=e.target;return pe.test(t.type)&&t.click&&A(t,"input")&&Y.get(t,"click")||A(t,"a")}},beforeunload:{postDispatch:function(e){void 0!==e.result&&e.originalEvent&&(e.originalEvent.returnValue=e.result)}}}},S.removeEvent=function(e,t,n){e.removeEventListener&&e.removeEventListener(t,n)},S.Event=function(e,t){if(!(this instanceof S.Event))return new S.Event(e,t);e&&e.type?(this.originalEvent=e,this.type=e.type,this.isDefaultPrevented=e.defaultPrevented||void 0===e.defaultPrevented&&!1===e.returnValue?Ce:Ee,this.target=e.target&&3===e.target.nodeType?e.target.parentNode:e.target,this.currentTarget=e.currentTarget,this.relatedTarget=e.relatedTarget):this.type=e,t&&S.extend(this,t),this.timeStamp=e&&e.timeStamp||Date.now(),this[S.expando]=!0},S.Event.prototype={constructor:S.Event,isDefaultPrevented:Ee,isPropagationStopped:Ee,isImmediatePropagationStopped:Ee,isSimulated:!1,preventDefault:function(){var e=this.originalEvent;this.isDefaultPrevented=Ce,e&&!this.isSimulated&&e.preventDefault()},stopPropagation:function(){var e=this.originalEvent;this.isPropagationStopped=Ce,e&&!this.isSimulated&&e.stopPropagation()},stopImmediatePropagation:function(){var e=this.originalEvent;this.isImmediatePropagationStopped=Ce,e&&!this.isSimulated&&e.stopImmediatePropagation(),this.stopPropagation()}},S.each({altKey:!0,bubbles:!0,cancelable:!0,changedTouches:!0,ctrlKey:!0,detail:!0,eventPhase:!0,metaKey:!0,pageX:!0,pageY:!0,shiftKey:!0,view:!0,"char":!0,code:!0,charCode:!0,key:!0,keyCode:!0,button:!0,buttons:!0,clientX:!0,clientY:!0,offsetX:!0,offsetY:!0,pointerId:!0,pointerType:!0,screenX:!0,screenY:!0,targetTouches:!0,toElement:!0,touches:!0,which:function(e){var t=e.button;return null==e.which&&be.test(e.type)?null!=e.charCode?e.charCode:e.keyCode:!e.which&&void 0!==t&&we.test(e.type)?1&t?1:2&t?3:4&t?2:0:e.which}},S.event.addProp),S.each({focus:"focusin",blur:"focusout"},function(e,t){S.event.special[e]={setup:function(){return Ae(this,e,Se),!1},trigger:function(){return Ae(this,e),!0},delegateType:t}}),S.each({mouseenter:"mouseover",mouseleave:"mouseout",pointerenter:"pointerover",pointerleave:"pointerout"},function(e,i){S.event.special[e]={delegateType:i,bindType:i,handle:function(e){var t,n=e.relatedTarget,r=e.handleObj;return n&&(n===this||S.contains(this,n))||(e.type=r.origType,t=r.handler.apply(this,arguments),e.type=i),t}}}),S.fn.extend({on:function(e,t,n,r){return ke(this,e,t,n,r)},one:function(e,t,n,r){return ke(this,e,t,n,r,1)},off:function(e,t,n){var r,i;if(e&&e.preventDefault&&e.handleObj)return r=e.handleObj,S(e.delegateTarget).off(r.namespace?r.origType+"."+r.namespace:r.origType,r.selector,r.handler),this;if("object"==typeof e){for(i in e)this.off(i,t,e[i]);return this}return!1!==t&&"function"!=typeof t||(n=t,t=void 0),!1===n&&(n=Ee),this.each(function(){S.event.remove(this,e,n,t)})}});var Ne=/<script|<style|<link/i,De=/checked\s*(?:[^=]|=\s*.checked.)/i,je=/^\s*<!(?:\[CDATA\[|--)|(?:\]\]|--)>\s*$/g;function qe(e,t){return A(e,"table")&&A(11!==t.nodeType?t:t.firstChild,"tr")&&S(e).children("tbody")[0]||e}function Le(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function He(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Oe(e,t){var n,r,i,o,a,s;if(1===t.nodeType){if(Y.hasData(e)&&(s=Y.get(e).events))for(i in Y.remove(t,"handle events"),s)for(n=0,r=s[i].length;n<r;n++)S.event.add(t,i,s[i][n]);Q.hasData(e)&&(o=Q.access(e),a=S.extend({},o),Q.set(t,a))}}function Pe(n,r,i,o){r=g(r);var e,t,a,s,u,l,c=0,f=n.length,p=f-1,d=r[0],h=m(d);if(h||1<f&&"string"==typeof d&&!y.checkClone&&De.test(d))return n.each(function(e){var t=n.eq(e);h&&(r[0]=d.call(this,e,t.html())),Pe(t,r,i,o)});if(f&&(t=(e=xe(r,n[0].ownerDocument,!1,n,o)).firstChild,1===e.childNodes.length&&(e=t),t||o)){for(s=(a=S.map(ve(e,"script"),Le)).length;c<f;c++)u=e,c!==p&&(u=S.clone(u,!0,!0),s&&S.merge(a,ve(u,"script"))),i.call(n[c],u,c);if(s)for(l=a[a.length-1].ownerDocument,S.map(a,He),c=0;c<s;c++)u=a[c],he.test(u.type||"")&&!Y.access(u,"globalEval")&&S.contains(l,u)&&(u.src&&"module"!==(u.type||"").toLowerCase()?S._evalUrl&&!u.noModule&&S._evalUrl(u.src,{nonce:u.nonce||u.getAttribute("nonce")},l):b(u.textContent.replace(je,""),u,l))}return n}function Re(e,t,n){for(var r,i=t?S.filter(t,e):e,o=0;null!=(r=i[o]);o++)n||1!==r.nodeType||S.cleanData(ve(r)),r.parentNode&&(n&&ie(r)&&ye(ve(r,"script")),r.parentNode.removeChild(r));return e}S.extend({htmlPrefilter:function(e){return e},clone:function(e,t,n){var r,i,o,a,s,u,l,c=e.cloneNode(!0),f=ie(e);if(!(y.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||S.isXMLDoc(e)))for(a=ve(c),r=0,i=(o=ve(e)).length;r<i;r++)s=o[r],u=a[r],void 0,"input"===(l=u.nodeName.toLowerCase())&&pe.test(s.type)?u.checked=s.checked:"input"!==l&&"textarea"!==l||(u.defaultValue=s.defaultValue);if(t)if(n)for(o=o||ve(e),a=a||ve(c),r=0,i=o.length;r<i;r++)Oe(o[r],a[r]);else Oe(e,c);return 0<(a=ve(c,"script")).length&&ye(a,!f&&ve(e,"script")),c},cleanData:function(e){for(var t,n,r,i=S.event.special,o=0;void 0!==(n=e[o]);o++)if(V(n)){if(t=n[Y.expando]){if(t.events)for(r in t.events)i[r]?S.event.remove(n,r):S.removeEvent(n,r,t.handle);n[Y.expando]=void 0}n[Q.expando]&&(n[Q.expando]=void 0)}}}),S.fn.extend({detach:function(e){return Re(this,e,!0)},remove:function(e){return Re(this,e)},text:function(e){return $(this,function(e){return void 0===e?S.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Pe(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||qe(this,e).appendChild(e)})},prepend:function(){return Pe(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=qe(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Pe(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(S.cleanData(ve(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return S.clone(this,e,t)})},html:function(e){return $(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ne.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=S.htmlPrefilter(e);try{for(;n<r;n++)1===(t=this[n]||{}).nodeType&&(S.cleanData(ve(t,!1)),t.innerHTML=e);t=0}catch(e){}}t&&this.empty().append(e)},null,e,arguments.length)},replaceWith:function(){var n=[];return Pe(this,arguments,function(e){var t=this.parentNode;S.inArray(this,n)<0&&(S.cleanData(ve(this)),t&&t.replaceChild(e,this))},n)}}),S.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(e,a){S.fn[e]=function(e){for(var t,n=[],r=S(e),i=r.length-1,o=0;o<=i;o++)t=o===i?this:this.clone(!0),S(r[o])[a](t),u.apply(n,t.get());return this.pushStack(n)}});var Me=new RegExp("^("+ee+")(?!px)[a-z%]+$","i"),Ie=function(e){var t=e.ownerDocument.defaultView;return t&&t.opener||(t=C),t.getComputedStyle(e)},We=function(e,t,n){var r,i,o={};for(i in t)o[i]=e.style[i],e.style[i]=t[i];for(i in r=n.call(e),t)e.style[i]=o[i];return r},Fe=new RegExp(ne.join("|"),"i");function Be(e,t,n){var r,i,o,a,s=e.style;return(n=n||Ie(e))&&(""!==(a=n.getPropertyValue(t)||n[t])||ie(e)||(a=S.style(e,t)),!y.pixelBoxStyles()&&Me.test(a)&&Fe.test(t)&&(r=s.width,i=s.minWidth,o=s.maxWidth,s.minWidth=s.maxWidth=s.width=a,a=n.width,s.width=r,s.minWidth=i,s.maxWidth=o)),void 0!==a?a+"":a}function $e(e,t){return{get:function(){if(!e())return(this.get=t).apply(this,arguments);delete this.get}}}!function(){function e(){if(l){u.style.cssText="position:absolute;left:-11111px;width:60px;margin-top:1px;padding:0;border:0",l.style.cssText="position:relative;display:block;box-sizing:border-box;overflow:scroll;margin:auto;border:1px;padding:1px;width:60%;top:1%",re.appendChild(u).appendChild(l);var e=C.getComputedStyle(l);n="1%"!==e.top,s=12===t(e.marginLeft),l.style.right="60%",o=36===t(e.right),r=36===t(e.width),l.style.position="absolute",i=12===t(l.offsetWidth/3),re.removeChild(u),l=null}}function t(e){return Math.round(parseFloat(e))}var n,r,i,o,a,s,u=E.createElement("div"),l=E.createElement("div");l.style&&(l.style.backgroundClip="content-box",l.cloneNode(!0).style.backgroundClip="",y.clearCloneStyle="content-box"===l.style.backgroundClip,S.extend(y,{boxSizingReliable:function(){return e(),r},pixelBoxStyles:function(){return e(),o},pixelPosition:function(){return e(),n},reliableMarginLeft:function(){return e(),s},scrollboxSize:function(){return e(),i},reliableTrDimensions:function(){var e,t,n,r;return null==a&&(e=E.createElement("table"),t=E.createElement("tr"),n=E.createElement("div"),e.style.cssText="position:absolute;left:-11111px",t.style.height="1px",n.style.height="9px",re.appendChild(e).appendChild(t).appendChild(n),r=C.getComputedStyle(t),a=3<parseInt(r.height),re.removeChild(e)),a}}))}();var _e=["Webkit","Moz","ms"],ze=E.createElement("div").style,Ue={};function Xe(e){var t=S.cssProps[e]||Ue[e];return t||(e in ze?e:Ue[e]=function(e){var t=e[0].toUpperCase()+e.slice(1),n=_e.length;while(n--)if((e=_e[n]+t)in ze)return e}(e)||e)}var Ve=/^(none|table(?!-c[ea]).+)/,Ge=/^--/,Ye={position:"absolute",visibility:"hidden",display:"block"},Qe={letterSpacing:"0",fontWeight:"400"};function Je(e,t,n){var r=te.exec(t);return r?Math.max(0,r[2]-(n||0))+(r[3]||"px"):t}function Ke(e,t,n,r,i,o){var a="width"===t?1:0,s=0,u=0;if(n===(r?"border":"content"))return 0;for(;a<4;a+=2)"margin"===n&&(u+=S.css(e,n+ne[a],!0,i)),r?("content"===n&&(u-=S.css(e,"padding"+ne[a],!0,i)),"margin"!==n&&(u-=S.css(e,"border"+ne[a]+"Width",!0,i))):(u+=S.css(e,"padding"+ne[a],!0,i),"padding"!==n?u+=S.css(e,"border"+ne[a]+"Width",!0,i):s+=S.css(e,"border"+ne[a]+"Width",!0,i));return!r&&0<=o&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))||0),u}function Ze(e,t,n){var r=Ie(e),i=(!y.boxSizingReliable()||n)&&"border-box"===S.css(e,"boxSizing",!1,r),o=i,a=Be(e,t,r),s="offset"+t[0].toUpperCase()+t.slice(1);if(Me.test(a)){if(!n)return a;a="auto"}return(!y.boxSizingReliable()&&i||!y.reliableTrDimensions()&&A(e,"tr")||"auto"===a||!parseFloat(a)&&"inline"===S.css(e,"display",!1,r))&&e.getClientRects().length&&(i="border-box"===S.css(e,"boxSizing",!1,r),(o=s in e)&&(a=e[s])),(a=parseFloat(a)||0)+Ke(e,t,n||(i?"border":"content"),o,r,a)+"px"}function et(e,t,n,r,i){return new et.prototype.init(e,t,n,r,i)}S.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Be(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,gridArea:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnStart:!0,gridRow:!0,gridRowEnd:!0,gridRowStart:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=X(t),u=Ge.test(t),l=e.style;if(u||(t=Xe(s)),a=S.cssHooks[t]||S.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"===(o=typeof n)&&(i=te.exec(n))&&i[1]&&(n=se(e,t,i),o="number"),null!=n&&n==n&&("number"!==o||u||(n+=i&&i[3]||(S.cssNumber[s]?"":"px")),y.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=X(t);return Ge.test(t)||(t=Xe(s)),(a=S.cssHooks[t]||S.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Be(e,t,r)),"normal"===i&&t in Qe&&(i=Qe[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),S.each(["height","width"],function(e,u){S.cssHooks[u]={get:function(e,t,n){if(t)return!Ve.test(S.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?Ze(e,u,n):We(e,Ye,function(){return Ze(e,u,n)})},set:function(e,t,n){var r,i=Ie(e),o=!y.scrollboxSize()&&"absolute"===i.position,a=(o||n)&&"border-box"===S.css(e,"boxSizing",!1,i),s=n?Ke(e,u,n,a,i):0;return a&&o&&(s-=Math.ceil(e["offset"+u[0].toUpperCase()+u.slice(1)]-parseFloat(i[u])-Ke(e,u,"border",!1,i)-.5)),s&&(r=te.exec(t))&&"px"!==(r[3]||"px")&&(e.style[u]=t,t=S.css(e,u)),Je(0,t,s)}}}),S.cssHooks.marginLeft=$e(y.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Be(e,"marginLeft"))||e.getBoundingClientRect().left-We(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),S.each({margin:"",padding:"",border:"Width"},function(i,o){S.cssHooks[i+o]={expand:function(e){for(var t=0,n={},r="string"==typeof e?e.split(" "):[e];t<4;t++)n[i+ne[t]+o]=r[t]||r[t-2]||r[0];return n}},"margin"!==i&&(S.cssHooks[i+o].set=Je)}),S.fn.extend({css:function(e,t){return $(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=Ie(e),i=t.length;a<i;a++)o[t[a]]=S.css(e,t[a],!1,r);return o}return void 0!==n?S.style(e,t,n):S.css(e,t)},e,t,1<arguments.length)}}),((S.Tween=et).prototype={constructor:et,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||S.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(S.cssNumber[n]?"":"px")},cur:function(){var e=et.propHooks[this.prop];return e&&e.get?e.get(this):et.propHooks._default.get(this)},run:function(e){var t,n=et.propHooks[this.prop];return this.options.duration?this.pos=t=S.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):et.propHooks._default.set(this),this}}).init.prototype=et.prototype,(et.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=S.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){S.fx.step[e.prop]?S.fx.step[e.prop](e):1!==e.elem.nodeType||!S.cssHooks[e.prop]&&null==e.elem.style[Xe(e.prop)]?e.elem[e.prop]=e.now:S.style(e.elem,e.prop,e.now+e.unit)}}}).scrollTop=et.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},S.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},S.fx=et.prototype.init,S.fx.step={};var tt,nt,rt,it,ot=/^(?:toggle|show|hide)$/,at=/queueHooks$/;function st(){nt&&(!1===E.hidden&&C.requestAnimationFrame?C.requestAnimationFrame(st):C.setTimeout(st,S.fx.interval),S.fx.tick())}function ut(){return C.setTimeout(function(){tt=void 0}),tt=Date.now()}function lt(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=ne[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function ct(e,t,n){for(var r,i=(ft.tweeners[t]||[]).concat(ft.tweeners["*"]),o=0,a=i.length;o<a;o++)if(r=i[o].call(n,t,e))return r}function ft(o,e,t){var n,a,r=0,i=ft.prefilters.length,s=S.Deferred().always(function(){delete u.elem}),u=function(){if(a)return!1;for(var e=tt||ut(),t=Math.max(0,l.startTime+l.duration-e),n=1-(t/l.duration||0),r=0,i=l.tweens.length;r<i;r++)l.tweens[r].run(n);return s.notifyWith(o,[l,n,t]),n<1&&i?t:(i||s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l]),!1)},l=s.promise({elem:o,props:S.extend({},e),opts:S.extend(!0,{specialEasing:{},easing:S.easing._default},t),originalProperties:e,originalOptions:t,startTime:tt||ut(),duration:t.duration,tweens:[],createTween:function(e,t){var n=S.Tween(o,l.opts,e,t,l.opts.specialEasing[e]||l.opts.easing);return l.tweens.push(n),n},stop:function(e){var t=0,n=e?l.tweens.length:0;if(a)return this;for(a=!0;t<n;t++)l.tweens[t].run(1);return e?(s.notifyWith(o,[l,1,0]),s.resolveWith(o,[l,e])):s.rejectWith(o,[l,e]),this}}),c=l.props;for(!function(e,t){var n,r,i,o,a;for(n in e)if(i=t[r=X(n)],o=e[n],Array.isArray(o)&&(i=o[1],o=e[n]=o[0]),n!==r&&(e[r]=o,delete e[n]),(a=S.cssHooks[r])&&"expand"in a)for(n in o=a.expand(o),delete e[r],o)n in e||(e[n]=o[n],t[n]=i);else t[r]=i}(c,l.opts.specialEasing);r<i;r++)if(n=ft.prefilters[r].call(l,o,c,l.opts))return m(n.stop)&&(S._queueHooks(l.elem,l.opts.queue).stop=n.stop.bind(n)),n;return S.map(c,ct,l),m(l.opts.start)&&l.opts.start.call(o,l),l.progress(l.opts.progress).done(l.opts.done,l.opts.complete).fail(l.opts.fail).always(l.opts.always),S.fx.timer(S.extend(u,{elem:o,anim:l,queue:l.opts.queue})),l}S.Animation=S.extend(ft,{tweeners:{"*":[function(e,t){var n=this.createTween(e,t);return se(n.elem,e,te.exec(t),n),n}]},tweener:function(e,t){m(e)?(t=e,e=["*"]):e=e.match(P);for(var n,r=0,i=e.length;r<i;r++)n=e[r],ft.tweeners[n]=ft.tweeners[n]||[],ft.tweeners[n].unshift(t)},prefilters:[function(e,t,n){var r,i,o,a,s,u,l,c,f="width"in t||"height"in t,p=this,d={},h=e.style,g=e.nodeType&&ae(e),v=Y.get(e,"fxshow");for(r in n.queue||(null==(a=S._queueHooks(e,"fx")).unqueued&&(a.unqueued=0,s=a.empty.fire,a.empty.fire=function(){a.unqueued||s()}),a.unqueued++,p.always(function(){p.always(function(){a.unqueued--,S.queue(e,"fx").length||a.empty.fire()})})),t)if(i=t[r],ot.test(i)){if(delete t[r],o=o||"toggle"===i,i===(g?"hide":"show")){if("show"!==i||!v||void 0===v[r])continue;g=!0}d[r]=v&&v[r]||S.style(e,r)}if((u=!S.isEmptyObject(t))||!S.isEmptyObject(d))for(r in f&&1===e.nodeType&&(n.overflow=[h.overflow,h.overflowX,h.overflowY],null==(l=v&&v.display)&&(l=Y.get(e,"display")),"none"===(c=S.css(e,"display"))&&(l?c=l:(le([e],!0),l=e.style.display||l,c=S.css(e,"display"),le([e]))),("inline"===c||"inline-block"===c&&null!=l)&&"none"===S.css(e,"float")&&(u||(p.done(function(){h.display=l}),null==l&&(c=h.display,l="none"===c?"":c)),h.display="inline-block")),n.overflow&&(h.overflow="hidden",p.always(function(){h.overflow=n.overflow[0],h.overflowX=n.overflow[1],h.overflowY=n.overflow[2]})),u=!1,d)u||(v?"hidden"in v&&(g=v.hidden):v=Y.access(e,"fxshow",{display:l}),o&&(v.hidden=!g),g&&le([e],!0),p.done(function(){for(r in g||le([e]),Y.remove(e,"fxshow"),d)S.style(e,r,d[r])})),u=ct(g?v[r]:0,r,p),r in v||(v[r]=u.start,g&&(u.end=u.start,u.start=0))}],prefilter:function(e,t){t?ft.prefilters.unshift(e):ft.prefilters.push(e)}}),S.speed=function(e,t,n){var r=e&&"object"==typeof e?S.extend({},e):{complete:n||!n&&t||m(e)&&e,duration:e,easing:n&&t||t&&!m(t)&&t};return S.fx.off?r.duration=0:"number"!=typeof r.duration&&(r.duration in S.fx.speeds?r.duration=S.fx.speeds[r.duration]:r.duration=S.fx.speeds._default),null!=r.queue&&!0!==r.queue||(r.queue="fx"),r.old=r.complete,r.complete=function(){m(r.old)&&r.old.call(this),r.queue&&S.dequeue(this,r.queue)},r},S.fn.extend({fadeTo:function(e,t,n,r){return this.filter(ae).css("opacity",0).show().end().animate({opacity:t},e,n,r)},animate:function(t,e,n,r){var i=S.isEmptyObject(t),o=S.speed(e,n,r),a=function(){var e=ft(this,S.extend({},t),o);(i||Y.get(this,"finish"))&&e.stop(!0)};return a.finish=a,i||!1===o.queue?this.each(a):this.queue(o.queue,a)},stop:function(i,e,o){var a=function(e){var t=e.stop;delete e.stop,t(o)};return"string"!=typeof i&&(o=e,e=i,i=void 0),e&&this.queue(i||"fx",[]),this.each(function(){var e=!0,t=null!=i&&i+"queueHooks",n=S.timers,r=Y.get(this);if(t)r[t]&&r[t].stop&&a(r[t]);else for(t in r)r[t]&&r[t].stop&&at.test(t)&&a(r[t]);for(t=n.length;t--;)n[t].elem!==this||null!=i&&n[t].queue!==i||(n[t].anim.stop(o),e=!1,n.splice(t,1));!e&&o||S.dequeue(this,i)})},finish:function(a){return!1!==a&&(a=a||"fx"),this.each(function(){var e,t=Y.get(this),n=t[a+"queue"],r=t[a+"queueHooks"],i=S.timers,o=n?n.length:0;for(t.finish=!0,S.queue(this,a,[]),r&&r.stop&&r.stop.call(this,!0),e=i.length;e--;)i[e].elem===this&&i[e].queue===a&&(i[e].anim.stop(!0),i.splice(e,1));for(e=0;e<o;e++)n[e]&&n[e].finish&&n[e].finish.call(this);delete t.finish})}}),S.each(["toggle","show","hide"],function(e,r){var i=S.fn[r];S.fn[r]=function(e,t,n){return null==e||"boolean"==typeof e?i.apply(this,arguments):this.animate(lt(r,!0),e,t,n)}}),S.each({slideDown:lt("show"),slideUp:lt("hide"),slideToggle:lt("toggle"),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(e,r){S.fn[e]=function(e,t,n){return this.animate(r,e,t,n)}}),S.timers=[],S.fx.tick=function(){var e,t=0,n=S.timers;for(tt=Date.now();t<n.length;t++)(e=n[t])()||n[t]!==e||n.splice(t--,1);n.length||S.fx.stop(),tt=void 0},S.fx.timer=function(e){S.timers.push(e),S.fx.start()},S.fx.interval=13,S.fx.start=function(){nt||(nt=!0,st())},S.fx.stop=function(){nt=null},S.fx.speeds={slow:600,fast:200,_default:400},S.fn.delay=function(r,e){return r=S.fx&&S.fx.speeds[r]||r,e=e||"fx",this.queue(e,function(e,t){var n=C.setTimeout(e,r);t.stop=function(){C.clearTimeout(n)}})},rt=E.createElement("input"),it=E.createElement("select").appendChild(E.createElement("option")),rt.type="checkbox",y.checkOn=""!==rt.value,y.optSelected=it.selected,(rt=E.createElement("input")).value="t",rt.type="radio",y.radioValue="t"===rt.value;var pt,dt=S.expr.attrHandle;S.fn.extend({attr:function(e,t){return $(this,S.attr,e,t,1<arguments.length)},removeAttr:function(e){return this.each(function(){S.removeAttr(this,e)})}}),S.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?S.prop(e,t,n):(1===o&&S.isXMLDoc(e)||(i=S.attrHooks[t.toLowerCase()]||(S.expr.match.bool.test(t)?pt:void 0)),void 0!==n?null===n?void S.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=S.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!y.radioValue&&"radio"===t&&A(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(P);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),pt={set:function(e,t,n){return!1===t?S.removeAttr(e,n):e.setAttribute(n,n),n}},S.each(S.expr.match.bool.source.match(/\w+/g),function(e,t){var a=dt[t]||S.find.attr;dt[t]=function(e,t,n){var r,i,o=t.toLowerCase();return n||(i=dt[o],dt[o]=r,r=null!=a(e,t,n)?o:null,dt[o]=i),r}});var ht=/^(?:input|select|textarea|button)$/i,gt=/^(?:a|area)$/i;function vt(e){return(e.match(P)||[]).join(" ")}function yt(e){return e.getAttribute&&e.getAttribute("class")||""}function mt(e){return Array.isArray(e)?e:"string"==typeof e&&e.match(P)||[]}S.fn.extend({prop:function(e,t){return $(this,S.prop,e,t,1<arguments.length)},removeProp:function(e){return this.each(function(){delete this[S.propFix[e]||e]})}}),S.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&S.isXMLDoc(e)||(t=S.propFix[t]||t,i=S.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=S.find.attr(e,"tabindex");return t?parseInt(t,10):ht.test(e.nodeName)||gt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),y.optSelected||(S.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),S.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){S.propFix[this.toLowerCase()]=this}),S.fn.extend({addClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).addClass(t.call(this,e,yt(this)))});if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(t){var e,n,r,i,o,a,s,u=0;if(m(t))return this.each(function(e){S(this).removeClass(t.call(this,e,yt(this)))});if(!arguments.length)return this.attr("class","");if((e=mt(t)).length)while(n=this[u++])if(i=yt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=e[a++])while(-1<r.indexOf(" "+o+" "))r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(i,t){var o=typeof i,a="string"===o||Array.isArray(i);return"boolean"==typeof t&&a?t?this.addClass(i):this.removeClass(i):m(i)?this.each(function(e){S(this).toggleClass(i.call(this,e,yt(this),t),t)}):this.each(function(){var e,t,n,r;if(a){t=0,n=S(this),r=mt(i);while(e=r[t++])n.hasClass(e)?n.removeClass(e):n.addClass(e)}else void 0!==i&&"boolean"!==o||((e=yt(this))&&Y.set(this,"__className__",e),this.setAttribute&&this.setAttribute("class",e||!1===i?"":Y.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&-1<(" "+vt(yt(n))+" ").indexOf(t))return!0;return!1}});var xt=/\r/g;S.fn.extend({val:function(n){var r,e,i,t=this[0];return arguments.length?(i=m(n),this.each(function(e){var t;1===this.nodeType&&(null==(t=i?n.call(this,e,S(this).val()):n)?t="":"number"==typeof t?t+="":Array.isArray(t)&&(t=S.map(t,function(e){return null==e?"":e+""})),(r=S.valHooks[this.type]||S.valHooks[this.nodeName.toLowerCase()])&&"set"in r&&void 0!==r.set(this,t,"value")||(this.value=t))})):t?(r=S.valHooks[t.type]||S.valHooks[t.nodeName.toLowerCase()])&&"get"in r&&void 0!==(e=r.get(t,"value"))?e:"string"==typeof(e=t.value)?e.replace(xt,""):null==e?"":e:void 0}}),S.extend({valHooks:{option:{get:function(e){var t=S.find.attr(e,"value");return null!=t?t:vt(S.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r<u;r++)if(((n=i[r]).selected||r===o)&&!n.disabled&&(!n.parentNode.disabled||!A(n.parentNode,"optgroup"))){if(t=S(n).val(),a)return t;s.push(t)}return s},set:function(e,t){var n,r,i=e.options,o=S.makeArray(t),a=i.length;while(a--)((r=i[a]).selected=-1<S.inArray(S.valHooks.option.get(r),o))&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),S.each(["radio","checkbox"],function(){S.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=-1<S.inArray(S(e).val(),t)}},y.checkOn||(S.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),y.focusin="onfocusin"in C;var bt=/^(?:focusinfocus|focusoutblur)$/,wt=function(e){e.stopPropagation()};S.extend(S.event,{trigger:function(e,t,n,r){var i,o,a,s,u,l,c,f,p=[n||E],d=v.call(e,"type")?e.type:e,h=v.call(e,"namespace")?e.namespace.split("."):[];if(o=f=a=n=n||E,3!==n.nodeType&&8!==n.nodeType&&!bt.test(d+S.event.triggered)&&(-1<d.indexOf(".")&&(d=(h=d.split(".")).shift(),h.sort()),u=d.indexOf(":")<0&&"on"+d,(e=e[S.expando]?e:new S.Event(d,"object"==typeof e&&e)).isTrigger=r?2:3,e.namespace=h.join("."),e.rnamespace=e.namespace?new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,e.result=void 0,e.target||(e.target=n),t=null==t?[e]:S.makeArray(t,[e]),c=S.event.special[d]||{},r||!c.trigger||!1!==c.trigger.apply(n,t))){if(!r&&!c.noBubble&&!x(n)){for(s=c.delegateType||d,bt.test(s+d)||(o=o.parentNode);o;o=o.parentNode)p.push(o),a=o;a===(n.ownerDocument||E)&&p.push(a.defaultView||a.parentWindow||C)}i=0;while((o=p[i++])&&!e.isPropagationStopped())f=o,e.type=1<i?s:c.bindType||d,(l=(Y.get(o,"events")||Object.create(null))[e.type]&&Y.get(o,"handle"))&&l.apply(o,t),(l=u&&o[u])&&l.apply&&V(o)&&(e.result=l.apply(o,t),!1===e.result&&e.preventDefault());return e.type=d,r||e.isDefaultPrevented()||c._default&&!1!==c._default.apply(p.pop(),t)||!V(n)||u&&m(n[d])&&!x(n)&&((a=n[u])&&(n[u]=null),S.event.triggered=d,e.isPropagationStopped()&&f.addEventListener(d,wt),n[d](),e.isPropagationStopped()&&f.removeEventListener(d,wt),S.event.triggered=void 0,a&&(n[u]=a)),e.result}},simulate:function(e,t,n){var r=S.extend(new S.Event,n,{type:e,isSimulated:!0});S.event.trigger(r,null,t)}}),S.fn.extend({trigger:function(e,t){return this.each(function(){S.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return S.event.trigger(e,t,n,!0)}}),y.focusin||S.each({focus:"focusin",blur:"focusout"},function(n,r){var i=function(e){S.event.simulate(r,e.target,S.event.fix(e))};S.event.special[r]={setup:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r);t||e.addEventListener(n,i,!0),Y.access(e,r,(t||0)+1)},teardown:function(){var e=this.ownerDocument||this.document||this,t=Y.access(e,r)-1;t?Y.access(e,r,t):(e.removeEventListener(n,i,!0),Y.remove(e,r))}}});var Tt=C.location,Ct={guid:Date.now()},Et=/\?/;S.parseXML=function(e){var t;if(!e||"string"!=typeof e)return null;try{t=(new C.DOMParser).parseFromString(e,"text/xml")}catch(e){t=void 0}return t&&!t.getElementsByTagName("parsererror").length||S.error("Invalid XML: "+e),t};var St=/\[\]$/,kt=/\r?\n/g,At=/^(?:submit|button|image|reset|file)$/i,Nt=/^(?:input|select|textarea|keygen)/i;function Dt(n,e,r,i){var t;if(Array.isArray(e))S.each(e,function(e,t){r||St.test(n)?i(n,t):Dt(n+"["+("object"==typeof t&&null!=t?e:"")+"]",t,r,i)});else if(r||"object"!==w(e))i(n,e);else for(t in e)Dt(n+"["+t+"]",e[t],r,i)}S.param=function(e,t){var n,r=[],i=function(e,t){var n=m(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(null==e)return"";if(Array.isArray(e)||e.jquery&&!S.isPlainObject(e))S.each(e,function(){i(this.name,this.value)});else for(n in e)Dt(n,e[n],t,i);return r.join("&")},S.fn.extend({serialize:function(){return S.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=S.prop(this,"elements");return e?S.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!S(this).is(":disabled")&&Nt.test(this.nodeName)&&!At.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=S(this).val();return null==n?null:Array.isArray(n)?S.map(n,function(e){return{name:t.name,value:e.replace(kt,"\r\n")}}):{name:t.name,value:n.replace(kt,"\r\n")}}).get()}});var jt=/%20/g,qt=/#.*$/,Lt=/([?&])_=[^&]*/,Ht=/^(.*?):[ \t]*([^\r\n]*)$/gm,Ot=/^(?:GET|HEAD)$/,Pt=/^\/\//,Rt={},Mt={},It="*/".concat("*"),Wt=E.createElement("a");function Ft(o){return function(e,t){"string"!=typeof e&&(t=e,e="*");var n,r=0,i=e.toLowerCase().match(P)||[];if(m(t))while(n=i[r++])"+"===n[0]?(n=n.slice(1)||"*",(o[n]=o[n]||[]).unshift(t)):(o[n]=o[n]||[]).push(t)}}function Bt(t,i,o,a){var s={},u=t===Mt;function l(e){var r;return s[e]=!0,S.each(t[e]||[],function(e,t){var n=t(i,o,a);return"string"!=typeof n||u||s[n]?u?!(r=n):void 0:(i.dataTypes.unshift(n),l(n),!1)}),r}return l(i.dataTypes[0])||!s["*"]&&l("*")}function $t(e,t){var n,r,i=S.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&S.extend(!0,e,r),e}Wt.href=Tt.href,S.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Tt.href,type:"GET",isLocal:/^(?:about|app|app-storage|.+-extension|file|res|widget):$/.test(Tt.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":It,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":S.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?$t($t(e,S.ajaxSettings),t):$t(S.ajaxSettings,e)},ajaxPrefilter:Ft(Rt),ajaxTransport:Ft(Mt),ajax:function(e,t){"object"==typeof e&&(t=e,e=void 0),t=t||{};var c,f,p,n,d,r,h,g,i,o,v=S.ajaxSetup({},t),y=v.context||v,m=v.context&&(y.nodeType||y.jquery)?S(y):S.event,x=S.Deferred(),b=S.Callbacks("once memory"),w=v.statusCode||{},a={},s={},u="canceled",T={readyState:0,getResponseHeader:function(e){var t;if(h){if(!n){n={};while(t=Ht.exec(p))n[t[1].toLowerCase()+" "]=(n[t[1].toLowerCase()+" "]||[]).concat(t[2])}t=n[e.toLowerCase()+" "]}return null==t?null:t.join(", ")},getAllResponseHeaders:function(){return h?p:null},setRequestHeader:function(e,t){return null==h&&(e=s[e.toLowerCase()]=s[e.toLowerCase()]||e,a[e]=t),this},overrideMimeType:function(e){return null==h&&(v.mimeType=e),this},statusCode:function(e){var t;if(e)if(h)T.always(e[T.status]);else for(t in e)w[t]=[w[t],e[t]];return this},abort:function(e){var t=e||u;return c&&c.abort(t),l(0,t),this}};if(x.promise(T),v.url=((e||v.url||Tt.href)+"").replace(Pt,Tt.protocol+"//"),v.type=t.method||t.type||v.method||v.type,v.dataTypes=(v.dataType||"*").toLowerCase().match(P)||[""],null==v.crossDomain){r=E.createElement("a");try{r.href=v.url,r.href=r.href,v.crossDomain=Wt.protocol+"//"+Wt.host!=r.protocol+"//"+r.host}catch(e){v.crossDomain=!0}}if(v.data&&v.processData&&"string"!=typeof v.data&&(v.data=S.param(v.data,v.traditional)),Bt(Rt,v,t,T),h)return T;for(i in(g=S.event&&v.global)&&0==S.active++&&S.event.trigger("ajaxStart"),v.type=v.type.toUpperCase(),v.hasContent=!Ot.test(v.type),f=v.url.replace(qt,""),v.hasContent?v.data&&v.processData&&0===(v.contentType||"").indexOf("application/x-www-form-urlencoded")&&(v.data=v.data.replace(jt,"+")):(o=v.url.slice(f.length),v.data&&(v.processData||"string"==typeof v.data)&&(f+=(Et.test(f)?"&":"?")+v.data,delete v.data),!1===v.cache&&(f=f.replace(Lt,"$1"),o=(Et.test(f)?"&":"?")+"_="+Ct.guid+++o),v.url=f+o),v.ifModified&&(S.lastModified[f]&&T.setRequestHeader("If-Modified-Since",S.lastModified[f]),S.etag[f]&&T.setRequestHeader("If-None-Match",S.etag[f])),(v.data&&v.hasContent&&!1!==v.contentType||t.contentType)&&T.setRequestHeader("Content-Type",v.contentType),T.setRequestHeader("Accept",v.dataTypes[0]&&v.accepts[v.dataTypes[0]]?v.accepts[v.dataTypes[0]]+("*"!==v.dataTypes[0]?", "+It+"; q=0.01":""):v.accepts["*"]),v.headers)T.setRequestHeader(i,v.headers[i]);if(v.beforeSend&&(!1===v.beforeSend.call(y,T,v)||h))return T.abort();if(u="abort",b.add(v.complete),T.done(v.success),T.fail(v.error),c=Bt(Mt,v,t,T)){if(T.readyState=1,g&&m.trigger("ajaxSend",[T,v]),h)return T;v.async&&0<v.timeout&&(d=C.setTimeout(function(){T.abort("timeout")},v.timeout));try{h=!1,c.send(a,l)}catch(e){if(h)throw e;l(-1,e)}}else l(-1,"No Transport");function l(e,t,n,r){var i,o,a,s,u,l=t;h||(h=!0,d&&C.clearTimeout(d),c=void 0,p=r||"",T.readyState=0<e?4:0,i=200<=e&&e<300||304===e,n&&(s=function(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}(v,T,n)),!i&&-1<S.inArray("script",v.dataTypes)&&(v.converters["text script"]=function(){}),s=function(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}(v,s,T,i),i?(v.ifModified&&((u=T.getResponseHeader("Last-Modified"))&&(S.lastModified[f]=u),(u=T.getResponseHeader("etag"))&&(S.etag[f]=u)),204===e||"HEAD"===v.type?l="nocontent":304===e?l="notmodified":(l=s.state,o=s.data,i=!(a=s.error))):(a=l,!e&&l||(l="error",e<0&&(e=0))),T.status=e,T.statusText=(t||l)+"",i?x.resolveWith(y,[o,l,T]):x.rejectWith(y,[T,l,a]),T.statusCode(w),w=void 0,g&&m.trigger(i?"ajaxSuccess":"ajaxError",[T,v,i?o:a]),b.fireWith(y,[T,l]),g&&(m.trigger("ajaxComplete",[T,v]),--S.active||S.event.trigger("ajaxStop")))}return T},getJSON:function(e,t,n){return S.get(e,t,n,"json")},getScript:function(e,t){return S.get(e,void 0,t,"script")}}),S.each(["get","post"],function(e,i){S[i]=function(e,t,n,r){return m(t)&&(r=r||n,n=t,t=void 0),S.ajax(S.extend({url:e,type:i,dataType:r,data:t,success:n},S.isPlainObject(e)&&e))}}),S.ajaxPrefilter(function(e){var t;for(t in e.headers)"content-type"===t.toLowerCase()&&(e.contentType=e.headers[t]||"")}),S._evalUrl=function(e,t,n){return S.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,converters:{"text script":function(){}},dataFilter:function(e){S.globalEval(e,t,n)}})},S.fn.extend({wrapAll:function(e){var t;return this[0]&&(m(e)&&(e=e.call(this[0])),t=S(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(n){return m(n)?this.each(function(e){S(this).wrapInner(n.call(this,e))}):this.each(function(){var e=S(this),t=e.contents();t.length?t.wrapAll(n):e.append(n)})},wrap:function(t){var n=m(t);return this.each(function(e){S(this).wrapAll(n?t.call(this,e):t)})},unwrap:function(e){return this.parent(e).not("body").each(function(){S(this).replaceWith(this.childNodes)}),this}}),S.expr.pseudos.hidden=function(e){return!S.expr.pseudos.visible(e)},S.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},S.ajaxSettings.xhr=function(){try{return new C.XMLHttpRequest}catch(e){}};var _t={0:200,1223:204},zt=S.ajaxSettings.xhr();y.cors=!!zt&&"withCredentials"in zt,y.ajax=zt=!!zt,S.ajaxTransport(function(i){var o,a;if(y.cors||zt&&!i.crossDomain)return{send:function(e,t){var n,r=i.xhr();if(r.open(i.type,i.url,i.async,i.username,i.password),i.xhrFields)for(n in i.xhrFields)r[n]=i.xhrFields[n];for(n in i.mimeType&&r.overrideMimeType&&r.overrideMimeType(i.mimeType),i.crossDomain||e["X-Requested-With"]||(e["X-Requested-With"]="XMLHttpRequest"),e)r.setRequestHeader(n,e[n]);o=function(e){return function(){o&&(o=a=r.onload=r.onerror=r.onabort=r.ontimeout=r.onreadystatechange=null,"abort"===e?r.abort():"error"===e?"number"!=typeof r.status?t(0,"error"):t(r.status,r.statusText):t(_t[r.status]||r.status,r.statusText,"text"!==(r.responseType||"text")||"string"!=typeof r.responseText?{binary:r.response}:{text:r.responseText},r.getAllResponseHeaders()))}},r.onload=o(),a=r.onerror=r.ontimeout=o("error"),void 0!==r.onabort?r.onabort=a:r.onreadystatechange=function(){4===r.readyState&&C.setTimeout(function(){o&&a()})},o=o("abort");try{r.send(i.hasContent&&i.data||null)}catch(e){if(o)throw e}},abort:function(){o&&o()}}}),S.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),S.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return S.globalEval(e),e}}}),S.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),S.ajaxTransport("script",function(n){var r,i;if(n.crossDomain||n.scriptAttrs)return{send:function(e,t){r=S("<script>").attr(n.scriptAttrs||{}).prop({charset:n.scriptCharset,src:n.url}).on("load error",i=function(e){r.remove(),i=null,e&&t("error"===e.type?404:200,e.type)}),E.head.appendChild(r[0])},abort:function(){i&&i()}}});var Ut,Xt=[],Vt=/(=)\?(?=&|$)|\?\?/;S.ajaxSetup({jsonp:"callback",jsonpCallback:function(){var e=Xt.pop()||S.expando+"_"+Ct.guid++;return this[e]=!0,e}}),S.ajaxPrefilter("json jsonp",function(e,t,n){var r,i,o,a=!1!==e.jsonp&&(Vt.test(e.url)?"url":"string"==typeof e.data&&0===(e.contentType||"").indexOf("application/x-www-form-urlencoded")&&Vt.test(e.data)&&"data");if(a||"jsonp"===e.dataTypes[0])return r=e.jsonpCallback=m(e.jsonpCallback)?e.jsonpCallback():e.jsonpCallback,a?e[a]=e[a].replace(Vt,"$1"+r):!1!==e.jsonp&&(e.url+=(Et.test(e.url)?"&":"?")+e.jsonp+"="+r),e.converters["script json"]=function(){return o||S.error(r+" was not called"),o[0]},e.dataTypes[0]="json",i=C[r],C[r]=function(){o=arguments},n.always(function(){void 0===i?S(C).removeProp(r):C[r]=i,e[r]&&(e.jsonpCallback=t.jsonpCallback,Xt.push(r)),o&&m(i)&&i(o[0]),o=i=void 0}),"script"}),y.createHTMLDocument=((Ut=E.implementation.createHTMLDocument("").body).innerHTML="<form></form><form></form>",2===Ut.childNodes.length),S.parseHTML=function(e,t,n){return"string"!=typeof e?[]:("boolean"==typeof t&&(n=t,t=!1),t||(y.createHTMLDocument?((r=(t=E.implementation.createHTMLDocument("")).createElement("base")).href=E.location.href,t.head.appendChild(r)):t=E),o=!n&&[],(i=N.exec(e))?[t.createElement(i[1])]:(i=xe([e],t,o),o&&o.length&&S(o).remove(),S.merge([],i.childNodes)));var r,i,o},S.fn.load=function(e,t,n){var r,i,o,a=this,s=e.indexOf(" ");return-1<s&&(r=vt(e.slice(s)),e=e.slice(0,s)),m(t)?(n=t,t=void 0):t&&"object"==typeof t&&(i="POST"),0<a.length&&S.ajax({url:e,type:i||"GET",dataType:"html",data:t}).done(function(e){o=arguments,a.html(r?S("<div>").append(S.parseHTML(e)).find(r):e)}).always(n&&function(e,t){a.each(function(){n.apply(this,o||[e.responseText,t,e])})}),this},S.expr.pseudos.animated=function(t){return S.grep(S.timers,function(e){return t===e.elem}).length},S.offset={setOffset:function(e,t,n){var r,i,o,a,s,u,l=S.css(e,"position"),c=S(e),f={};"static"===l&&(e.style.position="relative"),s=c.offset(),o=S.css(e,"top"),u=S.css(e,"left"),("absolute"===l||"fixed"===l)&&-1<(o+u).indexOf("auto")?(a=(r=c.position()).top,i=r.left):(a=parseFloat(o)||0,i=parseFloat(u)||0),m(t)&&(t=t.call(e,n,S.extend({},s))),null!=t.top&&(f.top=t.top-s.top+a),null!=t.left&&(f.left=t.left-s.left+i),"using"in t?t.using.call(e,f):("number"==typeof f.top&&(f.top+="px"),"number"==typeof f.left&&(f.left+="px"),c.css(f))}},S.fn.extend({offset:function(t){if(arguments.length)return void 0===t?this:this.each(function(e){S.offset.setOffset(this,t,e)});var e,n,r=this[0];return r?r.getClientRects().length?(e=r.getBoundingClientRect(),n=r.ownerDocument.defaultView,{top:e.top+n.pageYOffset,left:e.left+n.pageXOffset}):{top:0,left:0}:void 0},position:function(){if(this[0]){var e,t,n,r=this[0],i={top:0,left:0};if("fixed"===S.css(r,"position"))t=r.getBoundingClientRect();else{t=this.offset(),n=r.ownerDocument,e=r.offsetParent||n.documentElement;while(e&&(e===n.body||e===n.documentElement)&&"static"===S.css(e,"position"))e=e.parentNode;e&&e!==r&&1===e.nodeType&&((i=S(e).offset()).top+=S.css(e,"borderTopWidth",!0),i.left+=S.css(e,"borderLeftWidth",!0))}return{top:t.top-i.top-S.css(r,"marginTop",!0),left:t.left-i.left-S.css(r,"marginLeft",!0)}}},offsetParent:function(){return this.map(function(){var e=this.offsetParent;while(e&&"static"===S.css(e,"position"))e=e.offsetParent;return e||re})}}),S.each({scrollLeft:"pageXOffset",scrollTop:"pageYOffset"},function(t,i){var o="pageYOffset"===i;S.fn[t]=function(e){return $(this,function(e,t,n){var r;if(x(e)?r=e:9===e.nodeType&&(r=e.defaultView),void 0===n)return r?r[i]:e[t];r?r.scrollTo(o?r.pageXOffset:n,o?n:r.pageYOffset):e[t]=n},t,e,arguments.length)}}),S.each(["top","left"],function(e,n){S.cssHooks[n]=$e(y.pixelPosition,function(e,t){if(t)return t=Be(e,n),Me.test(t)?S(e).position()[n]+"px":t})}),S.each({Height:"height",Width:"width"},function(a,s){S.each({padding:"inner"+a,content:s,"":"outer"+a},function(r,o){S.fn[o]=function(e,t){var n=arguments.length&&(r||"boolean"!=typeof e),i=r||(!0===e||!0===t?"margin":"border");return $(this,function(e,t,n){var r;return x(e)?0===o.indexOf("outer")?e["inner"+a]:e.document.documentElement["client"+a]:9===e.nodeType?(r=e.documentElement,Math.max(e.body["scroll"+a],r["scroll"+a],e.body["offset"+a],r["offset"+a],r["client"+a])):void 0===n?S.css(e,t,i):S.style(e,t,n,i)},s,n?e:void 0,n)}})}),S.each(["ajaxStart","ajaxStop","ajaxComplete","ajaxError","ajaxSuccess","ajaxSend"],function(e,t){S.fn[t]=function(e){return this.on(t,e)}}),S.fn.extend({bind:function(e,t,n){return this.on(e,null,t,n)},unbind:function(e,t){return this.off(e,null,t)},delegate:function(e,t,n,r){return this.on(t,e,n,r)},undelegate:function(e,t,n){return 1===arguments.length?this.off(e,"**"):this.off(t,e||"**",n)},hover:function(e,t){return this.mouseenter(e).mouseleave(t||e)}}),S.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(e,n){S.fn[n]=function(e,t){return 0<arguments.length?this.on(n,null,e,t):this.trigger(n)}});var Gt=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;S.proxy=function(e,t){var n,r,i;if("string"==typeof t&&(n=e[t],t=e,e=n),m(e))return r=s.call(arguments,2),(i=function(){return e.apply(t||this,r.concat(s.call(arguments)))}).guid=e.guid=e.guid||S.guid++,i},S.holdReady=function(e){e?S.readyWait++:S.ready(!0)},S.isArray=Array.isArray,S.parseJSON=JSON.parse,S.nodeName=A,S.isFunction=m,S.isWindow=x,S.camelCase=X,S.type=w,S.now=Date.now,S.isNumeric=function(e){var t=S.type(e);return("number"===t||"string"===t)&&!isNaN(e-parseFloat(e))},S.trim=function(e){return null==e?"":(e+"").replace(Gt,"")},"function"==typeof define&&define.amd&&define("jquery",[],function(){return S});var Yt=C.jQuery,Qt=C.$;return S.noConflict=function(e){return C.$===S&&(C.$=Qt),e&&C.jQuery===S&&(C.jQuery=Yt),S},"undefined"==typeof e&&(C.jQuery=C.$=S),S});
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- var Jupyter = Jupyter || {};
- var jprop = function(name, module_path){
- Object.defineProperty(Jupyter, name, {
- get: function() {
- console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'")`');
- return requirejs(module_path);
- },
- enumerable: true,
- configurable: false
- });
- }
- var jglobal = function(name, module_path){
- Object.defineProperty(Jupyter, name, {
- get: function() {
- console.warn('accessing `'+name+'` is deprecated. Use `requirejs("'+module_path+'").'+name+'`');
- return requirejs(module_path)[name];
- },
- enumerable: true,
- configurable: false
- });
- }
- define('base/js/namespace',[],function(){
- "use strict";
- // expose modules
-
- jprop('utils','base/js/utils')
- jprop('mathjaxutils','base/js/mathjaxutils');
- //Jupyter.load_extensions = Jupyter.utils.load_extensions;
- //
- jprop('security','base/js/security');
- jprop('keyboard','base/js/keyboard');
- jprop('dialog','base/js/dialog');
- //// exposed constructors
- jglobal('CommManager','services/kernels/comm')
- jglobal('Comm','services/kernels/comm')
- jglobal('NotificationWidget','base/js/notificationwidget');
- jglobal('Kernel','services/kernels/kernel');
- jglobal('Session','services/sessions/session');
- jglobal('LoginWidget','auth/js/loginwidget');
- jglobal('Page','base/js/page');
- // notebook
- jglobal('TextCell','notebook/js/textcell');
- jglobal('OutputArea','notebook/js/outputarea');
- jglobal('KeyboardManager','notebook/js/keyboardmanager');
- jglobal('Completer','notebook/js/completer');
- jglobal('Notebook','notebook/js/notebook');
- jglobal('Tooltip','notebook/js/tooltip');
- jglobal('Toolbar','notebook/js/toolbar');
- jglobal('SaveWidget','notebook/js/savewidget');
- jglobal('Pager','notebook/js/pager');
- jglobal('QuickHelp','notebook/js/quickhelp');
- jglobal('MarkdownCell','notebook/js/textcell');
- jglobal('RawCell','notebook/js/textcell');
- jglobal('Cell','notebook/js/cell');
- jglobal('MainToolBar','notebook/js/maintoolbar');
- jglobal('NotebookNotificationArea','notebook/js/notificationarea');
- jglobal('NotebookTour', 'notebook/js/tour');
- jglobal('MenuBar', 'notebook/js/menubar');
- // tree
- jglobal('SessionList','tree/js/sessionlist');
- Jupyter.version = "1.0.0";
- Jupyter._target = '_blank';
- return Jupyter;
- });
- // deprecated since 4.0, remove in 5+
- var IPython = Jupyter;
- !function(n,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define("underscore",r):(n="undefined"!=typeof globalThis?globalThis:n||self,function(){var t=n._,e=n._=r();e.noConflict=function(){return n._=t,e}}())}(this,(function(){
- // Underscore.js 1.13.6
- // https://underscorejs.org
- // (c) 2009-2022 Jeremy Ashkenas, Julian Gonggrijp, and DocumentCloud and Investigative Reporters & Editors
- // Underscore may be freely distributed under the MIT license.
- var n="1.13.6",r="object"==typeof self&&self.self===self&&self||"object"==typeof global&&global.global===global&&global||Function("return this")()||{},t=Array.prototype,e=Object.prototype,u="undefined"!=typeof Symbol?Symbol.prototype:null,o=t.push,i=t.slice,a=e.toString,f=e.hasOwnProperty,c="undefined"!=typeof ArrayBuffer,l="undefined"!=typeof DataView,s=Array.isArray,p=Object.keys,v=Object.create,h=c&&ArrayBuffer.isView,y=isNaN,d=isFinite,g=!{toString:null}.propertyIsEnumerable("toString"),b=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"],m=Math.pow(2,53)-1;function j(n,r){return r=null==r?n.length-1:+r,function(){for(var t=Math.max(arguments.length-r,0),e=Array(t),u=0;u<t;u++)e[u]=arguments[u+r];switch(r){case 0:return n.call(this,e);case 1:return n.call(this,arguments[0],e);case 2:return n.call(this,arguments[0],arguments[1],e)}var o=Array(r+1);for(u=0;u<r;u++)o[u]=arguments[u];return o[r]=e,n.apply(this,o)}}function _(n){var r=typeof n;return"function"===r||"object"===r&&!!n}function w(n){return void 0===n}function A(n){return!0===n||!1===n||"[object Boolean]"===a.call(n)}function x(n){var r="[object "+n+"]";return function(n){return a.call(n)===r}}var S=x("String"),O=x("Number"),M=x("Date"),E=x("RegExp"),B=x("Error"),N=x("Symbol"),I=x("ArrayBuffer"),T=x("Function"),k=r.document&&r.document.childNodes;"function"!=typeof/./&&"object"!=typeof Int8Array&&"function"!=typeof k&&(T=function(n){return"function"==typeof n||!1});var D=T,R=x("Object"),F=l&&R(new DataView(new ArrayBuffer(8))),V="undefined"!=typeof Map&&R(new Map),P=x("DataView");var q=F?function(n){return null!=n&&D(n.getInt8)&&I(n.buffer)}:P,U=s||x("Array");function W(n,r){return null!=n&&f.call(n,r)}var z=x("Arguments");!function(){z(arguments)||(z=function(n){return W(n,"callee")})}();var L=z;function $(n){return O(n)&&y(n)}function C(n){return function(){return n}}function K(n){return function(r){var t=n(r);return"number"==typeof t&&t>=0&&t<=m}}function J(n){return function(r){return null==r?void 0:r[n]}}var G=J("byteLength"),H=K(G),Q=/\[object ((I|Ui)nt(8|16|32)|Float(32|64)|Uint8Clamped|Big(I|Ui)nt64)Array\]/;var X=c?function(n){return h?h(n)&&!q(n):H(n)&&Q.test(a.call(n))}:C(!1),Y=J("length");function Z(n,r){r=function(n){for(var r={},t=n.length,e=0;e<t;++e)r[n[e]]=!0;return{contains:function(n){return!0===r[n]},push:function(t){return r[t]=!0,n.push(t)}}}(r);var t=b.length,u=n.constructor,o=D(u)&&u.prototype||e,i="constructor";for(W(n,i)&&!r.contains(i)&&r.push(i);t--;)(i=b[t])in n&&n[i]!==o[i]&&!r.contains(i)&&r.push(i)}function nn(n){if(!_(n))return[];if(p)return p(n);var r=[];for(var t in n)W(n,t)&&r.push(t);return g&&Z(n,r),r}function rn(n,r){var t=nn(r),e=t.length;if(null==n)return!e;for(var u=Object(n),o=0;o<e;o++){var i=t[o];if(r[i]!==u[i]||!(i in u))return!1}return!0}function tn(n){return n instanceof tn?n:this instanceof tn?void(this._wrapped=n):new tn(n)}function en(n){return new Uint8Array(n.buffer||n,n.byteOffset||0,G(n))}tn.VERSION=n,tn.prototype.value=function(){return this._wrapped},tn.prototype.valueOf=tn.prototype.toJSON=tn.prototype.value,tn.prototype.toString=function(){return String(this._wrapped)};var un="[object DataView]";function on(n,r,t,e){if(n===r)return 0!==n||1/n==1/r;if(null==n||null==r)return!1;if(n!=n)return r!=r;var o=typeof n;return("function"===o||"object"===o||"object"==typeof r)&&function n(r,t,e,o){r instanceof tn&&(r=r._wrapped);t instanceof tn&&(t=t._wrapped);var i=a.call(r);if(i!==a.call(t))return!1;if(F&&"[object Object]"==i&&q(r)){if(!q(t))return!1;i=un}switch(i){case"[object RegExp]":case"[object String]":return""+r==""+t;case"[object Number]":return+r!=+r?+t!=+t:0==+r?1/+r==1/t:+r==+t;case"[object Date]":case"[object Boolean]":return+r==+t;case"[object Symbol]":return u.valueOf.call(r)===u.valueOf.call(t);case"[object ArrayBuffer]":case un:return n(en(r),en(t),e,o)}var f="[object Array]"===i;if(!f&&X(r)){if(G(r)!==G(t))return!1;if(r.buffer===t.buffer&&r.byteOffset===t.byteOffset)return!0;f=!0}if(!f){if("object"!=typeof r||"object"!=typeof t)return!1;var c=r.constructor,l=t.constructor;if(c!==l&&!(D(c)&&c instanceof c&&D(l)&&l instanceof l)&&"constructor"in r&&"constructor"in t)return!1}o=o||[];var s=(e=e||[]).length;for(;s--;)if(e[s]===r)return o[s]===t;if(e.push(r),o.push(t),f){if((s=r.length)!==t.length)return!1;for(;s--;)if(!on(r[s],t[s],e,o))return!1}else{var p,v=nn(r);if(s=v.length,nn(t).length!==s)return!1;for(;s--;)if(p=v[s],!W(t,p)||!on(r[p],t[p],e,o))return!1}return e.pop(),o.pop(),!0}(n,r,t,e)}function an(n){if(!_(n))return[];var r=[];for(var t in n)r.push(t);return g&&Z(n,r),r}function fn(n){var r=Y(n);return function(t){if(null==t)return!1;var e=an(t);if(Y(e))return!1;for(var u=0;u<r;u++)if(!D(t[n[u]]))return!1;return n!==hn||!D(t[cn])}}var cn="forEach",ln="has",sn=["clear","delete"],pn=["get",ln,"set"],vn=sn.concat(cn,pn),hn=sn.concat(pn),yn=["add"].concat(sn,cn,ln),dn=V?fn(vn):x("Map"),gn=V?fn(hn):x("WeakMap"),bn=V?fn(yn):x("Set"),mn=x("WeakSet");function jn(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=n[r[u]];return e}function _n(n){for(var r={},t=nn(n),e=0,u=t.length;e<u;e++)r[n[t[e]]]=t[e];return r}function wn(n){var r=[];for(var t in n)D(n[t])&&r.push(t);return r.sort()}function An(n,r){return function(t){var e=arguments.length;if(r&&(t=Object(t)),e<2||null==t)return t;for(var u=1;u<e;u++)for(var o=arguments[u],i=n(o),a=i.length,f=0;f<a;f++){var c=i[f];r&&void 0!==t[c]||(t[c]=o[c])}return t}}var xn=An(an),Sn=An(nn),On=An(an,!0);function Mn(n){if(!_(n))return{};if(v)return v(n);var r=function(){};r.prototype=n;var t=new r;return r.prototype=null,t}function En(n){return U(n)?n:[n]}function Bn(n){return tn.toPath(n)}function Nn(n,r){for(var t=r.length,e=0;e<t;e++){if(null==n)return;n=n[r[e]]}return t?n:void 0}function In(n,r,t){var e=Nn(n,Bn(r));return w(e)?t:e}function Tn(n){return n}function kn(n){return n=Sn({},n),function(r){return rn(r,n)}}function Dn(n){return n=Bn(n),function(r){return Nn(r,n)}}function Rn(n,r,t){if(void 0===r)return n;switch(null==t?3:t){case 1:return function(t){return n.call(r,t)};case 3:return function(t,e,u){return n.call(r,t,e,u)};case 4:return function(t,e,u,o){return n.call(r,t,e,u,o)}}return function(){return n.apply(r,arguments)}}function Fn(n,r,t){return null==n?Tn:D(n)?Rn(n,r,t):_(n)&&!U(n)?kn(n):Dn(n)}function Vn(n,r){return Fn(n,r,1/0)}function Pn(n,r,t){return tn.iteratee!==Vn?tn.iteratee(n,r):Fn(n,r,t)}function qn(){}function Un(n,r){return null==r&&(r=n,n=0),n+Math.floor(Math.random()*(r-n+1))}tn.toPath=En,tn.iteratee=Vn;var Wn=Date.now||function(){return(new Date).getTime()};function zn(n){var r=function(r){return n[r]},t="(?:"+nn(n).join("|")+")",e=RegExp(t),u=RegExp(t,"g");return function(n){return n=null==n?"":""+n,e.test(n)?n.replace(u,r):n}}var Ln={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},$n=zn(Ln),Cn=zn(_n(Ln)),Kn=tn.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g},Jn=/(.)^/,Gn={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},Hn=/\\|'|\r|\n|\u2028|\u2029/g;function Qn(n){return"\\"+Gn[n]}var Xn=/^\s*(\w|\$)+\s*$/;var Yn=0;function Zn(n,r,t,e,u){if(!(e instanceof r))return n.apply(t,u);var o=Mn(n.prototype),i=n.apply(o,u);return _(i)?i:o}var nr=j((function(n,r){var t=nr.placeholder,e=function(){for(var u=0,o=r.length,i=Array(o),a=0;a<o;a++)i[a]=r[a]===t?arguments[u++]:r[a];for(;u<arguments.length;)i.push(arguments[u++]);return Zn(n,e,this,this,i)};return e}));nr.placeholder=tn;var rr=j((function(n,r,t){if(!D(n))throw new TypeError("Bind must be called on a function");var e=j((function(u){return Zn(n,e,r,this,t.concat(u))}));return e})),tr=K(Y);function er(n,r,t,e){if(e=e||[],r||0===r){if(r<=0)return e.concat(n)}else r=1/0;for(var u=e.length,o=0,i=Y(n);o<i;o++){var a=n[o];if(tr(a)&&(U(a)||L(a)))if(r>1)er(a,r-1,t,e),u=e.length;else for(var f=0,c=a.length;f<c;)e[u++]=a[f++];else t||(e[u++]=a)}return e}var ur=j((function(n,r){var t=(r=er(r,!1,!1)).length;if(t<1)throw new Error("bindAll must be passed function names");for(;t--;){var e=r[t];n[e]=rr(n[e],n)}return n}));var or=j((function(n,r,t){return setTimeout((function(){return n.apply(null,t)}),r)})),ir=nr(or,tn,1);function ar(n){return function(){return!n.apply(this,arguments)}}function fr(n,r){var t;return function(){return--n>0&&(t=r.apply(this,arguments)),n<=1&&(r=null),t}}var cr=nr(fr,2);function lr(n,r,t){r=Pn(r,t);for(var e,u=nn(n),o=0,i=u.length;o<i;o++)if(r(n[e=u[o]],e,n))return e}function sr(n){return function(r,t,e){t=Pn(t,e);for(var u=Y(r),o=n>0?0:u-1;o>=0&&o<u;o+=n)if(t(r[o],o,r))return o;return-1}}var pr=sr(1),vr=sr(-1);function hr(n,r,t,e){for(var u=(t=Pn(t,e,1))(r),o=0,i=Y(n);o<i;){var a=Math.floor((o+i)/2);t(n[a])<u?o=a+1:i=a}return o}function yr(n,r,t){return function(e,u,o){var a=0,f=Y(e);if("number"==typeof o)n>0?a=o>=0?o:Math.max(o+f,a):f=o>=0?Math.min(o+1,f):o+f+1;else if(t&&o&&f)return e[o=t(e,u)]===u?o:-1;if(u!=u)return(o=r(i.call(e,a,f),$))>=0?o+a:-1;for(o=n>0?a:f-1;o>=0&&o<f;o+=n)if(e[o]===u)return o;return-1}}var dr=yr(1,pr,hr),gr=yr(-1,vr);function br(n,r,t){var e=(tr(n)?pr:lr)(n,r,t);if(void 0!==e&&-1!==e)return n[e]}function mr(n,r,t){var e,u;if(r=Rn(r,t),tr(n))for(e=0,u=n.length;e<u;e++)r(n[e],e,n);else{var o=nn(n);for(e=0,u=o.length;e<u;e++)r(n[o[e]],o[e],n)}return n}function jr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=Array(u),i=0;i<u;i++){var a=e?e[i]:i;o[i]=r(n[a],a,n)}return o}function _r(n){var r=function(r,t,e,u){var o=!tr(r)&&nn(r),i=(o||r).length,a=n>0?0:i-1;for(u||(e=r[o?o[a]:a],a+=n);a>=0&&a<i;a+=n){var f=o?o[a]:a;e=t(e,r[f],f,r)}return e};return function(n,t,e,u){var o=arguments.length>=3;return r(n,Rn(t,u,4),e,o)}}var wr=_r(1),Ar=_r(-1);function xr(n,r,t){var e=[];return r=Pn(r,t),mr(n,(function(n,t,u){r(n,t,u)&&e.push(n)})),e}function Sr(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(!r(n[i],i,n))return!1}return!0}function Or(n,r,t){r=Pn(r,t);for(var e=!tr(n)&&nn(n),u=(e||n).length,o=0;o<u;o++){var i=e?e[o]:o;if(r(n[i],i,n))return!0}return!1}function Mr(n,r,t,e){return tr(n)||(n=jn(n)),("number"!=typeof t||e)&&(t=0),dr(n,r,t)>=0}var Er=j((function(n,r,t){var e,u;return D(r)?u=r:(r=Bn(r),e=r.slice(0,-1),r=r[r.length-1]),jr(n,(function(n){var o=u;if(!o){if(e&&e.length&&(n=Nn(n,e)),null==n)return;o=n[r]}return null==o?o:o.apply(n,t)}))}));function Br(n,r){return jr(n,Dn(r))}function Nr(n,r,t){var e,u,o=-1/0,i=-1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e>o&&(o=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))>i||u===-1/0&&o===-1/0)&&(o=n,i=u)}));return o}var Ir=/[^\ud800-\udfff]|[\ud800-\udbff][\udc00-\udfff]|[\ud800-\udfff]/g;function Tr(n){return n?U(n)?i.call(n):S(n)?n.match(Ir):tr(n)?jr(n,Tn):jn(n):[]}function kr(n,r,t){if(null==r||t)return tr(n)||(n=jn(n)),n[Un(n.length-1)];var e=Tr(n),u=Y(e);r=Math.max(Math.min(r,u),0);for(var o=u-1,i=0;i<r;i++){var a=Un(i,o),f=e[i];e[i]=e[a],e[a]=f}return e.slice(0,r)}function Dr(n,r){return function(t,e,u){var o=r?[[],[]]:{};return e=Pn(e,u),mr(t,(function(r,u){var i=e(r,u,t);n(o,r,i)})),o}}var Rr=Dr((function(n,r,t){W(n,t)?n[t].push(r):n[t]=[r]})),Fr=Dr((function(n,r,t){n[t]=r})),Vr=Dr((function(n,r,t){W(n,t)?n[t]++:n[t]=1})),Pr=Dr((function(n,r,t){n[t?0:1].push(r)}),!0);function qr(n,r,t){return r in t}var Ur=j((function(n,r){var t={},e=r[0];if(null==n)return t;D(e)?(r.length>1&&(e=Rn(e,r[1])),r=an(n)):(e=qr,r=er(r,!1,!1),n=Object(n));for(var u=0,o=r.length;u<o;u++){var i=r[u],a=n[i];e(a,i,n)&&(t[i]=a)}return t})),Wr=j((function(n,r){var t,e=r[0];return D(e)?(e=ar(e),r.length>1&&(t=r[1])):(r=jr(er(r,!1,!1),String),e=function(n,t){return!Mr(r,t)}),Ur(n,e,t)}));function zr(n,r,t){return i.call(n,0,Math.max(0,n.length-(null==r||t?1:r)))}function Lr(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[0]:zr(n,n.length-r)}function $r(n,r,t){return i.call(n,null==r||t?1:r)}var Cr=j((function(n,r){return r=er(r,!0,!0),xr(n,(function(n){return!Mr(r,n)}))})),Kr=j((function(n,r){return Cr(n,r)}));function Jr(n,r,t,e){A(r)||(e=t,t=r,r=!1),null!=t&&(t=Pn(t,e));for(var u=[],o=[],i=0,a=Y(n);i<a;i++){var f=n[i],c=t?t(f,i,n):f;r&&!t?(i&&o===c||u.push(f),o=c):t?Mr(o,c)||(o.push(c),u.push(f)):Mr(u,f)||u.push(f)}return u}var Gr=j((function(n){return Jr(er(n,!0,!0))}));function Hr(n){for(var r=n&&Nr(n,Y).length||0,t=Array(r),e=0;e<r;e++)t[e]=Br(n,e);return t}var Qr=j(Hr);function Xr(n,r){return n._chain?tn(r).chain():r}function Yr(n){return mr(wn(n),(function(r){var t=tn[r]=n[r];tn.prototype[r]=function(){var n=[this._wrapped];return o.apply(n,arguments),Xr(this,t.apply(tn,n))}})),tn}mr(["pop","push","reverse","shift","sort","splice","unshift"],(function(n){var r=t[n];tn.prototype[n]=function(){var t=this._wrapped;return null!=t&&(r.apply(t,arguments),"shift"!==n&&"splice"!==n||0!==t.length||delete t[0]),Xr(this,t)}})),mr(["concat","join","slice"],(function(n){var r=t[n];tn.prototype[n]=function(){var n=this._wrapped;return null!=n&&(n=r.apply(n,arguments)),Xr(this,n)}}));var Zr=Yr({__proto__:null,VERSION:n,restArguments:j,isObject:_,isNull:function(n){return null===n},isUndefined:w,isBoolean:A,isElement:function(n){return!(!n||1!==n.nodeType)},isString:S,isNumber:O,isDate:M,isRegExp:E,isError:B,isSymbol:N,isArrayBuffer:I,isDataView:q,isArray:U,isFunction:D,isArguments:L,isFinite:function(n){return!N(n)&&d(n)&&!isNaN(parseFloat(n))},isNaN:$,isTypedArray:X,isEmpty:function(n){if(null==n)return!0;var r=Y(n);return"number"==typeof r&&(U(n)||S(n)||L(n))?0===r:0===Y(nn(n))},isMatch:rn,isEqual:function(n,r){return on(n,r)},isMap:dn,isWeakMap:gn,isSet:bn,isWeakSet:mn,keys:nn,allKeys:an,values:jn,pairs:function(n){for(var r=nn(n),t=r.length,e=Array(t),u=0;u<t;u++)e[u]=[r[u],n[r[u]]];return e},invert:_n,functions:wn,methods:wn,extend:xn,extendOwn:Sn,assign:Sn,defaults:On,create:function(n,r){var t=Mn(n);return r&&Sn(t,r),t},clone:function(n){return _(n)?U(n)?n.slice():xn({},n):n},tap:function(n,r){return r(n),n},get:In,has:function(n,r){for(var t=(r=Bn(r)).length,e=0;e<t;e++){var u=r[e];if(!W(n,u))return!1;n=n[u]}return!!t},mapObject:function(n,r,t){r=Pn(r,t);for(var e=nn(n),u=e.length,o={},i=0;i<u;i++){var a=e[i];o[a]=r(n[a],a,n)}return o},identity:Tn,constant:C,noop:qn,toPath:En,property:Dn,propertyOf:function(n){return null==n?qn:function(r){return In(n,r)}},matcher:kn,matches:kn,times:function(n,r,t){var e=Array(Math.max(0,n));r=Rn(r,t,1);for(var u=0;u<n;u++)e[u]=r(u);return e},random:Un,now:Wn,escape:$n,unescape:Cn,templateSettings:Kn,template:function(n,r,t){!r&&t&&(r=t),r=On({},r,tn.templateSettings);var e=RegExp([(r.escape||Jn).source,(r.interpolate||Jn).source,(r.evaluate||Jn).source].join("|")+"|$","g"),u=0,o="__p+='";n.replace(e,(function(r,t,e,i,a){return o+=n.slice(u,a).replace(Hn,Qn),u=a+r.length,t?o+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":e?o+="'+\n((__t=("+e+"))==null?'':__t)+\n'":i&&(o+="';\n"+i+"\n__p+='"),r})),o+="';\n";var i,a=r.variable;if(a){if(!Xn.test(a))throw new Error("variable is not a bare identifier: "+a)}else o="with(obj||{}){\n"+o+"}\n",a="obj";o="var __t,__p='',__j=Array.prototype.join,"+"print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=new Function(a,"_",o)}catch(n){throw n.source=o,n}var f=function(n){return i.call(this,n,tn)};return f.source="function("+a+"){\n"+o+"}",f},result:function(n,r,t){var e=(r=Bn(r)).length;if(!e)return D(t)?t.call(n):t;for(var u=0;u<e;u++){var o=null==n?void 0:n[r[u]];void 0===o&&(o=t,u=e),n=D(o)?o.call(n):o}return n},uniqueId:function(n){var r=++Yn+"";return n?n+r:r},chain:function(n){var r=tn(n);return r._chain=!0,r},iteratee:Vn,partial:nr,bind:rr,bindAll:ur,memoize:function(n,r){var t=function(e){var u=t.cache,o=""+(r?r.apply(this,arguments):e);return W(u,o)||(u[o]=n.apply(this,arguments)),u[o]};return t.cache={},t},delay:or,defer:ir,throttle:function(n,r,t){var e,u,o,i,a=0;t||(t={});var f=function(){a=!1===t.leading?0:Wn(),e=null,i=n.apply(u,o),e||(u=o=null)},c=function(){var c=Wn();a||!1!==t.leading||(a=c);var l=r-(c-a);return u=this,o=arguments,l<=0||l>r?(e&&(clearTimeout(e),e=null),a=c,i=n.apply(u,o),e||(u=o=null)):e||!1===t.trailing||(e=setTimeout(f,l)),i};return c.cancel=function(){clearTimeout(e),a=0,e=u=o=null},c},debounce:function(n,r,t){var e,u,o,i,a,f=function(){var c=Wn()-u;r>c?e=setTimeout(f,r-c):(e=null,t||(i=n.apply(a,o)),e||(o=a=null))},c=j((function(c){return a=this,o=c,u=Wn(),e||(e=setTimeout(f,r),t&&(i=n.apply(a,o))),i}));return c.cancel=function(){clearTimeout(e),e=o=a=null},c},wrap:function(n,r){return nr(r,n)},negate:ar,compose:function(){var n=arguments,r=n.length-1;return function(){for(var t=r,e=n[r].apply(this,arguments);t--;)e=n[t].call(this,e);return e}},after:function(n,r){return function(){if(--n<1)return r.apply(this,arguments)}},before:fr,once:cr,findKey:lr,findIndex:pr,findLastIndex:vr,sortedIndex:hr,indexOf:dr,lastIndexOf:gr,find:br,detect:br,findWhere:function(n,r){return br(n,kn(r))},each:mr,forEach:mr,map:jr,collect:jr,reduce:wr,foldl:wr,inject:wr,reduceRight:Ar,foldr:Ar,filter:xr,select:xr,reject:function(n,r,t){return xr(n,ar(Pn(r)),t)},every:Sr,all:Sr,some:Or,any:Or,contains:Mr,includes:Mr,include:Mr,invoke:Er,pluck:Br,where:function(n,r){return xr(n,kn(r))},max:Nr,min:function(n,r,t){var e,u,o=1/0,i=1/0;if(null==r||"number"==typeof r&&"object"!=typeof n[0]&&null!=n)for(var a=0,f=(n=tr(n)?n:jn(n)).length;a<f;a++)null!=(e=n[a])&&e<o&&(o=e);else r=Pn(r,t),mr(n,(function(n,t,e){((u=r(n,t,e))<i||u===1/0&&o===1/0)&&(o=n,i=u)}));return o},shuffle:function(n){return kr(n,1/0)},sample:kr,sortBy:function(n,r,t){var e=0;return r=Pn(r,t),Br(jr(n,(function(n,t,u){return{value:n,index:e++,criteria:r(n,t,u)}})).sort((function(n,r){var t=n.criteria,e=r.criteria;if(t!==e){if(t>e||void 0===t)return 1;if(t<e||void 0===e)return-1}return n.index-r.index})),"value")},groupBy:Rr,indexBy:Fr,countBy:Vr,partition:Pr,toArray:Tr,size:function(n){return null==n?0:tr(n)?n.length:nn(n).length},pick:Ur,omit:Wr,first:Lr,head:Lr,take:Lr,initial:zr,last:function(n,r,t){return null==n||n.length<1?null==r||t?void 0:[]:null==r||t?n[n.length-1]:$r(n,Math.max(0,n.length-r))},rest:$r,tail:$r,drop:$r,compact:function(n){return xr(n,Boolean)},flatten:function(n,r){return er(n,r,!1)},without:Kr,uniq:Jr,unique:Jr,union:Gr,intersection:function(n){for(var r=[],t=arguments.length,e=0,u=Y(n);e<u;e++){var o=n[e];if(!Mr(r,o)){var i;for(i=1;i<t&&Mr(arguments[i],o);i++);i===t&&r.push(o)}}return r},difference:Cr,unzip:Hr,transpose:Hr,zip:Qr,object:function(n,r){for(var t={},e=0,u=Y(n);e<u;e++)r?t[n[e]]=r[e]:t[n[e][0]]=n[e][1];return t},range:function(n,r,t){null==r&&(r=n||0,n=0),t||(t=r<n?-1:1);for(var e=Math.max(Math.ceil((r-n)/t),0),u=Array(e),o=0;o<e;o++,n+=t)u[o]=n;return u},chunk:function(n,r){if(null==r||r<1)return[];for(var t=[],e=0,u=n.length;e<u;)t.push(i.call(n,e,e+=r));return t},mixin:Yr,default:tn});return Zr._=Zr,Zr}));
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- // This is CodeMirror (https://codemirror.net), a code editor
- // implemented in JavaScript on top of the browser's DOM.
- //
- // You can find some technical background for some of the code below
- // at http://marijnhaverbeke.nl/blog/#cm-internals .
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define('codemirror/lib/codemirror',factory) :
- (global = global || self, global.CodeMirror = factory());
- }(this, (function () { 'use strict';
- // Kludges for bugs and behavior differences that can't be feature
- // detected are enabled based on userAgent etc sniffing.
- var userAgent = navigator.userAgent;
- var platform = navigator.platform;
- var gecko = /gecko\/\d/i.test(userAgent);
- var ie_upto10 = /MSIE \d/.test(userAgent);
- var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
- var edge = /Edge\/(\d+)/.exec(userAgent);
- var ie = ie_upto10 || ie_11up || edge;
- var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
- var webkit = !edge && /WebKit\//.test(userAgent);
- var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
- var chrome = !edge && /Chrome\//.test(userAgent);
- var presto = /Opera\//.test(userAgent);
- var safari = /Apple Computer/.test(navigator.vendor);
- var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
- var phantom = /PhantomJS/.test(userAgent);
- var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
- var android = /Android/.test(userAgent);
- // This is woefully incomplete. Suggestions for alternative methods welcome.
- var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
- var mac = ios || /Mac/.test(platform);
- var chromeOS = /\bCrOS\b/.test(userAgent);
- var windows = /win/i.test(platform);
- var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
- if (presto_version) { presto_version = Number(presto_version[1]); }
- if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
- // Some browsers use the wrong event properties to signal cmd/ctrl on OS X
- var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
- var captureRightClick = gecko || (ie && ie_version >= 9);
- function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
- var rmClass = function(node, cls) {
- var current = node.className;
- var match = classTest(cls).exec(current);
- if (match) {
- var after = current.slice(match.index + match[0].length);
- node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
- }
- };
- function removeChildren(e) {
- for (var count = e.childNodes.length; count > 0; --count)
- { e.removeChild(e.firstChild); }
- return e
- }
- function removeChildrenAndAdd(parent, e) {
- return removeChildren(parent).appendChild(e)
- }
- function elt(tag, content, className, style) {
- var e = document.createElement(tag);
- if (className) { e.className = className; }
- if (style) { e.style.cssText = style; }
- if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
- else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
- return e
- }
- // wrapper for elt, which removes the elt from the accessibility tree
- function eltP(tag, content, className, style) {
- var e = elt(tag, content, className, style);
- e.setAttribute("role", "presentation");
- return e
- }
- var range;
- if (document.createRange) { range = function(node, start, end, endNode) {
- var r = document.createRange();
- r.setEnd(endNode || node, end);
- r.setStart(node, start);
- return r
- }; }
- else { range = function(node, start, end) {
- var r = document.body.createTextRange();
- try { r.moveToElementText(node.parentNode); }
- catch(e) { return r }
- r.collapse(true);
- r.moveEnd("character", end);
- r.moveStart("character", start);
- return r
- }; }
- function contains(parent, child) {
- if (child.nodeType == 3) // Android browser always returns false when child is a textnode
- { child = child.parentNode; }
- if (parent.contains)
- { return parent.contains(child) }
- do {
- if (child.nodeType == 11) { child = child.host; }
- if (child == parent) { return true }
- } while (child = child.parentNode)
- }
- function activeElt() {
- // IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
- // IE < 10 will throw when accessed while the page is loading or in an iframe.
- // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
- var activeElement;
- try {
- activeElement = document.activeElement;
- } catch(e) {
- activeElement = document.body || null;
- }
- while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
- { activeElement = activeElement.shadowRoot.activeElement; }
- return activeElement
- }
- function addClass(node, cls) {
- var current = node.className;
- if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
- }
- function joinClasses(a, b) {
- var as = a.split(" ");
- for (var i = 0; i < as.length; i++)
- { if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
- return b
- }
- var selectInput = function(node) { node.select(); };
- if (ios) // Mobile Safari apparently has a bug where select() is broken.
- { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
- else if (ie) // Suppress mysterious IE10 errors
- { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
- function bind(f) {
- var args = Array.prototype.slice.call(arguments, 1);
- return function(){return f.apply(null, args)}
- }
- function copyObj(obj, target, overwrite) {
- if (!target) { target = {}; }
- for (var prop in obj)
- { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
- { target[prop] = obj[prop]; } }
- return target
- }
- // Counts the column offset in a string, taking tabs into account.
- // Used mostly to find indentation.
- function countColumn(string, end, tabSize, startIndex, startValue) {
- if (end == null) {
- end = string.search(/[^\s\u00a0]/);
- if (end == -1) { end = string.length; }
- }
- for (var i = startIndex || 0, n = startValue || 0;;) {
- var nextTab = string.indexOf("\t", i);
- if (nextTab < 0 || nextTab >= end)
- { return n + (end - i) }
- n += nextTab - i;
- n += tabSize - (n % tabSize);
- i = nextTab + 1;
- }
- }
- var Delayed = function() {
- this.id = null;
- this.f = null;
- this.time = 0;
- this.handler = bind(this.onTimeout, this);
- };
- Delayed.prototype.onTimeout = function (self) {
- self.id = 0;
- if (self.time <= +new Date) {
- self.f();
- } else {
- setTimeout(self.handler, self.time - +new Date);
- }
- };
- Delayed.prototype.set = function (ms, f) {
- this.f = f;
- var time = +new Date + ms;
- if (!this.id || time < this.time) {
- clearTimeout(this.id);
- this.id = setTimeout(this.handler, ms);
- this.time = time;
- }
- };
- function indexOf(array, elt) {
- for (var i = 0; i < array.length; ++i)
- { if (array[i] == elt) { return i } }
- return -1
- }
- // Number of pixels added to scroller and sizer to hide scrollbar
- var scrollerGap = 50;
- // Returned or thrown by various protocols to signal 'I'm not
- // handling this'.
- var Pass = {toString: function(){return "CodeMirror.Pass"}};
- // Reused option objects for setSelection & friends
- var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
- // The inverse of countColumn -- find the offset that corresponds to
- // a particular column.
- function findColumn(string, goal, tabSize) {
- for (var pos = 0, col = 0;;) {
- var nextTab = string.indexOf("\t", pos);
- if (nextTab == -1) { nextTab = string.length; }
- var skipped = nextTab - pos;
- if (nextTab == string.length || col + skipped >= goal)
- { return pos + Math.min(skipped, goal - col) }
- col += nextTab - pos;
- col += tabSize - (col % tabSize);
- pos = nextTab + 1;
- if (col >= goal) { return pos }
- }
- }
- var spaceStrs = [""];
- function spaceStr(n) {
- while (spaceStrs.length <= n)
- { spaceStrs.push(lst(spaceStrs) + " "); }
- return spaceStrs[n]
- }
- function lst(arr) { return arr[arr.length-1] }
- function map(array, f) {
- var out = [];
- for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
- return out
- }
- function insertSorted(array, value, score) {
- var pos = 0, priority = score(value);
- while (pos < array.length && score(array[pos]) <= priority) { pos++; }
- array.splice(pos, 0, value);
- }
- function nothing() {}
- function createObj(base, props) {
- var inst;
- if (Object.create) {
- inst = Object.create(base);
- } else {
- nothing.prototype = base;
- inst = new nothing();
- }
- if (props) { copyObj(props, inst); }
- return inst
- }
- var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
- function isWordCharBasic(ch) {
- return /\w/.test(ch) || ch > "\x80" &&
- (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
- }
- function isWordChar(ch, helper) {
- if (!helper) { return isWordCharBasic(ch) }
- if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
- return helper.test(ch)
- }
- function isEmpty(obj) {
- for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
- return true
- }
- // Extending unicode characters. A series of a non-extending char +
- // any number of extending chars is treated as a single unit as far
- // as editing and measuring is concerned. This is not fully correct,
- // since some scripts/fonts/browsers also treat other configurations
- // of code points as a group.
- var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
- function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
- // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
- function skipExtendingChars(str, pos, dir) {
- while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
- return pos
- }
- // Returns the value from the range [`from`; `to`] that satisfies
- // `pred` and is closest to `from`. Assumes that at least `to`
- // satisfies `pred`. Supports `from` being greater than `to`.
- function findFirst(pred, from, to) {
- // At any point we are certain `to` satisfies `pred`, don't know
- // whether `from` does.
- var dir = from > to ? -1 : 1;
- for (;;) {
- if (from == to) { return from }
- var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
- if (mid == from) { return pred(mid) ? from : to }
- if (pred(mid)) { to = mid; }
- else { from = mid + dir; }
- }
- }
- // BIDI HELPERS
- function iterateBidiSections(order, from, to, f) {
- if (!order) { return f(from, to, "ltr", 0) }
- var found = false;
- for (var i = 0; i < order.length; ++i) {
- var part = order[i];
- if (part.from < to && part.to > from || from == to && part.to == from) {
- f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
- found = true;
- }
- }
- if (!found) { f(from, to, "ltr"); }
- }
- var bidiOther = null;
- function getBidiPartAt(order, ch, sticky) {
- var found;
- bidiOther = null;
- for (var i = 0; i < order.length; ++i) {
- var cur = order[i];
- if (cur.from < ch && cur.to > ch) { return i }
- if (cur.to == ch) {
- if (cur.from != cur.to && sticky == "before") { found = i; }
- else { bidiOther = i; }
- }
- if (cur.from == ch) {
- if (cur.from != cur.to && sticky != "before") { found = i; }
- else { bidiOther = i; }
- }
- }
- return found != null ? found : bidiOther
- }
- // Bidirectional ordering algorithm
- // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
- // that this (partially) implements.
- // One-char codes used for character types:
- // L (L): Left-to-Right
- // R (R): Right-to-Left
- // r (AL): Right-to-Left Arabic
- // 1 (EN): European Number
- // + (ES): European Number Separator
- // % (ET): European Number Terminator
- // n (AN): Arabic Number
- // , (CS): Common Number Separator
- // m (NSM): Non-Spacing Mark
- // b (BN): Boundary Neutral
- // s (B): Paragraph Separator
- // t (S): Segment Separator
- // w (WS): Whitespace
- // N (ON): Other Neutrals
- // Returns null if characters are ordered as they appear
- // (left-to-right), or an array of sections ({from, to, level}
- // objects) in the order in which they occur visually.
- var bidiOrdering = (function() {
- // Character types for codepoints 0 to 0xff
- var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
- // Character types for codepoints 0x600 to 0x6f9
- var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
- function charType(code) {
- if (code <= 0xf7) { return lowTypes.charAt(code) }
- else if (0x590 <= code && code <= 0x5f4) { return "R" }
- else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
- else if (0x6ee <= code && code <= 0x8ac) { return "r" }
- else if (0x2000 <= code && code <= 0x200b) { return "w" }
- else if (code == 0x200c) { return "b" }
- else { return "L" }
- }
- var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
- var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
- function BidiSpan(level, from, to) {
- this.level = level;
- this.from = from; this.to = to;
- }
- return function(str, direction) {
- var outerType = direction == "ltr" ? "L" : "R";
- if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
- var len = str.length, types = [];
- for (var i = 0; i < len; ++i)
- { types.push(charType(str.charCodeAt(i))); }
- // W1. Examine each non-spacing mark (NSM) in the level run, and
- // change the type of the NSM to the type of the previous
- // character. If the NSM is at the start of the level run, it will
- // get the type of sor.
- for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
- var type = types[i$1];
- if (type == "m") { types[i$1] = prev; }
- else { prev = type; }
- }
- // W2. Search backwards from each instance of a European number
- // until the first strong type (R, L, AL, or sor) is found. If an
- // AL is found, change the type of the European number to Arabic
- // number.
- // W3. Change all ALs to R.
- for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
- var type$1 = types[i$2];
- if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
- else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
- }
- // W4. A single European separator between two European numbers
- // changes to a European number. A single common separator between
- // two numbers of the same type changes to that type.
- for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
- var type$2 = types[i$3];
- if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
- else if (type$2 == "," && prev$1 == types[i$3+1] &&
- (prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
- prev$1 = type$2;
- }
- // W5. A sequence of European terminators adjacent to European
- // numbers changes to all European numbers.
- // W6. Otherwise, separators and terminators change to Other
- // Neutral.
- for (var i$4 = 0; i$4 < len; ++i$4) {
- var type$3 = types[i$4];
- if (type$3 == ",") { types[i$4] = "N"; }
- else if (type$3 == "%") {
- var end = (void 0);
- for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
- var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
- for (var j = i$4; j < end; ++j) { types[j] = replace; }
- i$4 = end - 1;
- }
- }
- // W7. Search backwards from each instance of a European number
- // until the first strong type (R, L, or sor) is found. If an L is
- // found, then change the type of the European number to L.
- for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
- var type$4 = types[i$5];
- if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
- else if (isStrong.test(type$4)) { cur$1 = type$4; }
- }
- // N1. A sequence of neutrals takes the direction of the
- // surrounding strong text if the text on both sides has the same
- // direction. European and Arabic numbers act as if they were R in
- // terms of their influence on neutrals. Start-of-level-run (sor)
- // and end-of-level-run (eor) are used at level run boundaries.
- // N2. Any remaining neutrals take the embedding direction.
- for (var i$6 = 0; i$6 < len; ++i$6) {
- if (isNeutral.test(types[i$6])) {
- var end$1 = (void 0);
- for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
- var before = (i$6 ? types[i$6-1] : outerType) == "L";
- var after = (end$1 < len ? types[end$1] : outerType) == "L";
- var replace$1 = before == after ? (before ? "L" : "R") : outerType;
- for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
- i$6 = end$1 - 1;
- }
- }
- // Here we depart from the documented algorithm, in order to avoid
- // building up an actual levels array. Since there are only three
- // levels (0, 1, 2) in an implementation that doesn't take
- // explicit embedding into account, we can build up the order on
- // the fly, without following the level-based algorithm.
- var order = [], m;
- for (var i$7 = 0; i$7 < len;) {
- if (countsAsLeft.test(types[i$7])) {
- var start = i$7;
- for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
- order.push(new BidiSpan(0, start, i$7));
- } else {
- var pos = i$7, at = order.length, isRTL = direction == "rtl" ? 1 : 0;
- for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
- for (var j$2 = pos; j$2 < i$7;) {
- if (countsAsNum.test(types[j$2])) {
- if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }
- var nstart = j$2;
- for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
- order.splice(at, 0, new BidiSpan(2, nstart, j$2));
- at += isRTL;
- pos = j$2;
- } else { ++j$2; }
- }
- if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
- }
- }
- if (direction == "ltr") {
- if (order[0].level == 1 && (m = str.match(/^\s+/))) {
- order[0].from = m[0].length;
- order.unshift(new BidiSpan(0, 0, m[0].length));
- }
- if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
- lst(order).to -= m[0].length;
- order.push(new BidiSpan(0, len - m[0].length, len));
- }
- }
- return direction == "rtl" ? order.reverse() : order
- }
- })();
- // Get the bidi ordering for the given line (and cache it). Returns
- // false for lines that are fully left-to-right, and an array of
- // BidiSpan objects otherwise.
- function getOrder(line, direction) {
- var order = line.order;
- if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
- return order
- }
- // EVENT HANDLING
- // Lightweight event framework. on/off also work on DOM nodes,
- // registering native DOM handlers.
- var noHandlers = [];
- var on = function(emitter, type, f) {
- if (emitter.addEventListener) {
- emitter.addEventListener(type, f, false);
- } else if (emitter.attachEvent) {
- emitter.attachEvent("on" + type, f);
- } else {
- var map = emitter._handlers || (emitter._handlers = {});
- map[type] = (map[type] || noHandlers).concat(f);
- }
- };
- function getHandlers(emitter, type) {
- return emitter._handlers && emitter._handlers[type] || noHandlers
- }
- function off(emitter, type, f) {
- if (emitter.removeEventListener) {
- emitter.removeEventListener(type, f, false);
- } else if (emitter.detachEvent) {
- emitter.detachEvent("on" + type, f);
- } else {
- var map = emitter._handlers, arr = map && map[type];
- if (arr) {
- var index = indexOf(arr, f);
- if (index > -1)
- { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
- }
- }
- }
- function signal(emitter, type /*, values...*/) {
- var handlers = getHandlers(emitter, type);
- if (!handlers.length) { return }
- var args = Array.prototype.slice.call(arguments, 2);
- for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
- }
- // The DOM events that CodeMirror handles can be overridden by
- // registering a (non-DOM) handler on the editor for the event name,
- // and preventDefault-ing the event in that handler.
- function signalDOMEvent(cm, e, override) {
- if (typeof e == "string")
- { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
- signal(cm, override || e.type, cm, e);
- return e_defaultPrevented(e) || e.codemirrorIgnore
- }
- function signalCursorActivity(cm) {
- var arr = cm._handlers && cm._handlers.cursorActivity;
- if (!arr) { return }
- var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
- for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
- { set.push(arr[i]); } }
- }
- function hasHandler(emitter, type) {
- return getHandlers(emitter, type).length > 0
- }
- // Add on and off methods to a constructor's prototype, to make
- // registering events on such objects more convenient.
- function eventMixin(ctor) {
- ctor.prototype.on = function(type, f) {on(this, type, f);};
- ctor.prototype.off = function(type, f) {off(this, type, f);};
- }
- // Due to the fact that we still support jurassic IE versions, some
- // compatibility wrappers are needed.
- function e_preventDefault(e) {
- if (e.preventDefault) { e.preventDefault(); }
- else { e.returnValue = false; }
- }
- function e_stopPropagation(e) {
- if (e.stopPropagation) { e.stopPropagation(); }
- else { e.cancelBubble = true; }
- }
- function e_defaultPrevented(e) {
- return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
- }
- function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
- function e_target(e) {return e.target || e.srcElement}
- function e_button(e) {
- var b = e.which;
- if (b == null) {
- if (e.button & 1) { b = 1; }
- else if (e.button & 2) { b = 3; }
- else if (e.button & 4) { b = 2; }
- }
- if (mac && e.ctrlKey && b == 1) { b = 3; }
- return b
- }
- // Detect drag-and-drop
- var dragAndDrop = function() {
- // There is *some* kind of drag-and-drop support in IE6-8, but I
- // couldn't get it to work yet.
- if (ie && ie_version < 9) { return false }
- var div = elt('div');
- return "draggable" in div || "dragDrop" in div
- }();
- var zwspSupported;
- function zeroWidthElement(measure) {
- if (zwspSupported == null) {
- var test = elt("span", "\u200b");
- removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
- if (measure.firstChild.offsetHeight != 0)
- { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
- }
- var node = zwspSupported ? elt("span", "\u200b") :
- elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
- node.setAttribute("cm-text", "");
- return node
- }
- // Feature-detect IE's crummy client rect reporting for bidi text
- var badBidiRects;
- function hasBadBidiRects(measure) {
- if (badBidiRects != null) { return badBidiRects }
- var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
- var r0 = range(txt, 0, 1).getBoundingClientRect();
- var r1 = range(txt, 1, 2).getBoundingClientRect();
- removeChildren(measure);
- if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
- return badBidiRects = (r1.right - r0.right < 3)
- }
- // See if "".split is the broken IE version, if so, provide an
- // alternative way to split lines.
- var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
- var pos = 0, result = [], l = string.length;
- while (pos <= l) {
- var nl = string.indexOf("\n", pos);
- if (nl == -1) { nl = string.length; }
- var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
- var rt = line.indexOf("\r");
- if (rt != -1) {
- result.push(line.slice(0, rt));
- pos += rt + 1;
- } else {
- result.push(line);
- pos = nl + 1;
- }
- }
- return result
- } : function (string) { return string.split(/\r\n?|\n/); };
- var hasSelection = window.getSelection ? function (te) {
- try { return te.selectionStart != te.selectionEnd }
- catch(e) { return false }
- } : function (te) {
- var range;
- try {range = te.ownerDocument.selection.createRange();}
- catch(e) {}
- if (!range || range.parentElement() != te) { return false }
- return range.compareEndPoints("StartToEnd", range) != 0
- };
- var hasCopyEvent = (function () {
- var e = elt("div");
- if ("oncopy" in e) { return true }
- e.setAttribute("oncopy", "return;");
- return typeof e.oncopy == "function"
- })();
- var badZoomedRects = null;
- function hasBadZoomedRects(measure) {
- if (badZoomedRects != null) { return badZoomedRects }
- var node = removeChildrenAndAdd(measure, elt("span", "x"));
- var normal = node.getBoundingClientRect();
- var fromRange = range(node, 0, 1).getBoundingClientRect();
- return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
- }
- // Known modes, by name and by MIME
- var modes = {}, mimeModes = {};
- // Extra arguments are stored as the mode's dependencies, which is
- // used by (legacy) mechanisms like loadmode.js to automatically
- // load a mode. (Preferred mechanism is the require/define calls.)
- function defineMode(name, mode) {
- if (arguments.length > 2)
- { mode.dependencies = Array.prototype.slice.call(arguments, 2); }
- modes[name] = mode;
- }
- function defineMIME(mime, spec) {
- mimeModes[mime] = spec;
- }
- // Given a MIME type, a {name, ...options} config object, or a name
- // string, return a mode config object.
- function resolveMode(spec) {
- if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
- spec = mimeModes[spec];
- } else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
- var found = mimeModes[spec.name];
- if (typeof found == "string") { found = {name: found}; }
- spec = createObj(found, spec);
- spec.name = found.name;
- } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
- return resolveMode("application/xml")
- } else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
- return resolveMode("application/json")
- }
- if (typeof spec == "string") { return {name: spec} }
- else { return spec || {name: "null"} }
- }
- // Given a mode spec (anything that resolveMode accepts), find and
- // initialize an actual mode object.
- function getMode(options, spec) {
- spec = resolveMode(spec);
- var mfactory = modes[spec.name];
- if (!mfactory) { return getMode(options, "text/plain") }
- var modeObj = mfactory(options, spec);
- if (modeExtensions.hasOwnProperty(spec.name)) {
- var exts = modeExtensions[spec.name];
- for (var prop in exts) {
- if (!exts.hasOwnProperty(prop)) { continue }
- if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
- modeObj[prop] = exts[prop];
- }
- }
- modeObj.name = spec.name;
- if (spec.helperType) { modeObj.helperType = spec.helperType; }
- if (spec.modeProps) { for (var prop$1 in spec.modeProps)
- { modeObj[prop$1] = spec.modeProps[prop$1]; } }
- return modeObj
- }
- // This can be used to attach properties to mode objects from
- // outside the actual mode definition.
- var modeExtensions = {};
- function extendMode(mode, properties) {
- var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
- copyObj(properties, exts);
- }
- function copyState(mode, state) {
- if (state === true) { return state }
- if (mode.copyState) { return mode.copyState(state) }
- var nstate = {};
- for (var n in state) {
- var val = state[n];
- if (val instanceof Array) { val = val.concat([]); }
- nstate[n] = val;
- }
- return nstate
- }
- // Given a mode and a state (for that mode), find the inner mode and
- // state at the position that the state refers to.
- function innerMode(mode, state) {
- var info;
- while (mode.innerMode) {
- info = mode.innerMode(state);
- if (!info || info.mode == mode) { break }
- state = info.state;
- mode = info.mode;
- }
- return info || {mode: mode, state: state}
- }
- function startState(mode, a1, a2) {
- return mode.startState ? mode.startState(a1, a2) : true
- }
- // STRING STREAM
- // Fed to the mode parsers, provides helper functions to make
- // parsers more succinct.
- var StringStream = function(string, tabSize, lineOracle) {
- this.pos = this.start = 0;
- this.string = string;
- this.tabSize = tabSize || 8;
- this.lastColumnPos = this.lastColumnValue = 0;
- this.lineStart = 0;
- this.lineOracle = lineOracle;
- };
- StringStream.prototype.eol = function () {return this.pos >= this.string.length};
- StringStream.prototype.sol = function () {return this.pos == this.lineStart};
- StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
- StringStream.prototype.next = function () {
- if (this.pos < this.string.length)
- { return this.string.charAt(this.pos++) }
- };
- StringStream.prototype.eat = function (match) {
- var ch = this.string.charAt(this.pos);
- var ok;
- if (typeof match == "string") { ok = ch == match; }
- else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
- if (ok) {++this.pos; return ch}
- };
- StringStream.prototype.eatWhile = function (match) {
- var start = this.pos;
- while (this.eat(match)){}
- return this.pos > start
- };
- StringStream.prototype.eatSpace = function () {
- var start = this.pos;
- while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }
- return this.pos > start
- };
- StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
- StringStream.prototype.skipTo = function (ch) {
- var found = this.string.indexOf(ch, this.pos);
- if (found > -1) {this.pos = found; return true}
- };
- StringStream.prototype.backUp = function (n) {this.pos -= n;};
- StringStream.prototype.column = function () {
- if (this.lastColumnPos < this.start) {
- this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
- this.lastColumnPos = this.start;
- }
- return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
- };
- StringStream.prototype.indentation = function () {
- return countColumn(this.string, null, this.tabSize) -
- (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
- };
- StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
- if (typeof pattern == "string") {
- var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
- var substr = this.string.substr(this.pos, pattern.length);
- if (cased(substr) == cased(pattern)) {
- if (consume !== false) { this.pos += pattern.length; }
- return true
- }
- } else {
- var match = this.string.slice(this.pos).match(pattern);
- if (match && match.index > 0) { return null }
- if (match && consume !== false) { this.pos += match[0].length; }
- return match
- }
- };
- StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
- StringStream.prototype.hideFirstChars = function (n, inner) {
- this.lineStart += n;
- try { return inner() }
- finally { this.lineStart -= n; }
- };
- StringStream.prototype.lookAhead = function (n) {
- var oracle = this.lineOracle;
- return oracle && oracle.lookAhead(n)
- };
- StringStream.prototype.baseToken = function () {
- var oracle = this.lineOracle;
- return oracle && oracle.baseToken(this.pos)
- };
- // Find the line object corresponding to the given line number.
- function getLine(doc, n) {
- n -= doc.first;
- if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
- var chunk = doc;
- while (!chunk.lines) {
- for (var i = 0;; ++i) {
- var child = chunk.children[i], sz = child.chunkSize();
- if (n < sz) { chunk = child; break }
- n -= sz;
- }
- }
- return chunk.lines[n]
- }
- // Get the part of a document between two positions, as an array of
- // strings.
- function getBetween(doc, start, end) {
- var out = [], n = start.line;
- doc.iter(start.line, end.line + 1, function (line) {
- var text = line.text;
- if (n == end.line) { text = text.slice(0, end.ch); }
- if (n == start.line) { text = text.slice(start.ch); }
- out.push(text);
- ++n;
- });
- return out
- }
- // Get the lines between from and to, as array of strings.
- function getLines(doc, from, to) {
- var out = [];
- doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
- return out
- }
- // Update the height of a line, propagating the height change
- // upwards to parent nodes.
- function updateLineHeight(line, height) {
- var diff = height - line.height;
- if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
- }
- // Given a line object, find its line number by walking up through
- // its parent links.
- function lineNo(line) {
- if (line.parent == null) { return null }
- var cur = line.parent, no = indexOf(cur.lines, line);
- for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
- for (var i = 0;; ++i) {
- if (chunk.children[i] == cur) { break }
- no += chunk.children[i].chunkSize();
- }
- }
- return no + cur.first
- }
- // Find the line at the given vertical position, using the height
- // information in the document tree.
- function lineAtHeight(chunk, h) {
- var n = chunk.first;
- outer: do {
- for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
- var child = chunk.children[i$1], ch = child.height;
- if (h < ch) { chunk = child; continue outer }
- h -= ch;
- n += child.chunkSize();
- }
- return n
- } while (!chunk.lines)
- var i = 0;
- for (; i < chunk.lines.length; ++i) {
- var line = chunk.lines[i], lh = line.height;
- if (h < lh) { break }
- h -= lh;
- }
- return n + i
- }
- function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
- function lineNumberFor(options, i) {
- return String(options.lineNumberFormatter(i + options.firstLineNumber))
- }
- // A Pos instance represents a position within the text.
- function Pos(line, ch, sticky) {
- if ( sticky === void 0 ) sticky = null;
- if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
- this.line = line;
- this.ch = ch;
- this.sticky = sticky;
- }
- // Compare two positions, return 0 if they are the same, a negative
- // number when a is less, and a positive number otherwise.
- function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
- function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
- function copyPos(x) {return Pos(x.line, x.ch)}
- function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
- function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
- // Most of the external API clips given positions to make sure they
- // actually exist within the document.
- function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
- function clipPos(doc, pos) {
- if (pos.line < doc.first) { return Pos(doc.first, 0) }
- var last = doc.first + doc.size - 1;
- if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
- return clipToLen(pos, getLine(doc, pos.line).text.length)
- }
- function clipToLen(pos, linelen) {
- var ch = pos.ch;
- if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
- else if (ch < 0) { return Pos(pos.line, 0) }
- else { return pos }
- }
- function clipPosArray(doc, array) {
- var out = [];
- for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
- return out
- }
- var SavedContext = function(state, lookAhead) {
- this.state = state;
- this.lookAhead = lookAhead;
- };
- var Context = function(doc, state, line, lookAhead) {
- this.state = state;
- this.doc = doc;
- this.line = line;
- this.maxLookAhead = lookAhead || 0;
- this.baseTokens = null;
- this.baseTokenPos = 1;
- };
- Context.prototype.lookAhead = function (n) {
- var line = this.doc.getLine(this.line + n);
- if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
- return line
- };
- Context.prototype.baseToken = function (n) {
- if (!this.baseTokens) { return null }
- while (this.baseTokens[this.baseTokenPos] <= n)
- { this.baseTokenPos += 2; }
- var type = this.baseTokens[this.baseTokenPos + 1];
- return {type: type && type.replace(/( |^)overlay .*/, ""),
- size: this.baseTokens[this.baseTokenPos] - n}
- };
- Context.prototype.nextLine = function () {
- this.line++;
- if (this.maxLookAhead > 0) { this.maxLookAhead--; }
- };
- Context.fromSaved = function (doc, saved, line) {
- if (saved instanceof SavedContext)
- { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
- else
- { return new Context(doc, copyState(doc.mode, saved), line) }
- };
- Context.prototype.save = function (copy) {
- var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
- return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
- };
- // Compute a style array (an array starting with a mode generation
- // -- for invalidation -- followed by pairs of end positions and
- // style strings), which is used to highlight the tokens on the
- // line.
- function highlightLine(cm, line, context, forceToEnd) {
- // A styles array always starts with a number identifying the
- // mode/overlays that it is based on (for easy invalidation).
- var st = [cm.state.modeGen], lineClasses = {};
- // Compute the base array of styles
- runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
- lineClasses, forceToEnd);
- var state = context.state;
- // Run overlays, adjust style array.
- var loop = function ( o ) {
- context.baseTokens = st;
- var overlay = cm.state.overlays[o], i = 1, at = 0;
- context.state = true;
- runMode(cm, line.text, overlay.mode, context, function (end, style) {
- var start = i;
- // Ensure there's a token end at the current position, and that i points at it
- while (at < end) {
- var i_end = st[i];
- if (i_end > end)
- { st.splice(i, 1, end, st[i+1], i_end); }
- i += 2;
- at = Math.min(end, i_end);
- }
- if (!style) { return }
- if (overlay.opaque) {
- st.splice(start, i - start, end, "overlay " + style);
- i = start + 2;
- } else {
- for (; start < i; start += 2) {
- var cur = st[start+1];
- st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
- }
- }
- }, lineClasses);
- context.state = state;
- context.baseTokens = null;
- context.baseTokenPos = 1;
- };
- for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
- return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
- }
- function getLineStyles(cm, line, updateFrontier) {
- if (!line.styles || line.styles[0] != cm.state.modeGen) {
- var context = getContextBefore(cm, lineNo(line));
- var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
- var result = highlightLine(cm, line, context);
- if (resetState) { context.state = resetState; }
- line.stateAfter = context.save(!resetState);
- line.styles = result.styles;
- if (result.classes) { line.styleClasses = result.classes; }
- else if (line.styleClasses) { line.styleClasses = null; }
- if (updateFrontier === cm.doc.highlightFrontier)
- { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
- }
- return line.styles
- }
- function getContextBefore(cm, n, precise) {
- var doc = cm.doc, display = cm.display;
- if (!doc.mode.startState) { return new Context(doc, true, n) }
- var start = findStartLine(cm, n, precise);
- var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
- var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
- doc.iter(start, n, function (line) {
- processLine(cm, line.text, context);
- var pos = context.line;
- line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
- context.nextLine();
- });
- if (precise) { doc.modeFrontier = context.line; }
- return context
- }
- // Lightweight form of highlight -- proceed over this line and
- // update state, but don't save a style array. Used for lines that
- // aren't currently visible.
- function processLine(cm, text, context, startAt) {
- var mode = cm.doc.mode;
- var stream = new StringStream(text, cm.options.tabSize, context);
- stream.start = stream.pos = startAt || 0;
- if (text == "") { callBlankLine(mode, context.state); }
- while (!stream.eol()) {
- readToken(mode, stream, context.state);
- stream.start = stream.pos;
- }
- }
- function callBlankLine(mode, state) {
- if (mode.blankLine) { return mode.blankLine(state) }
- if (!mode.innerMode) { return }
- var inner = innerMode(mode, state);
- if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
- }
- function readToken(mode, stream, state, inner) {
- for (var i = 0; i < 10; i++) {
- if (inner) { inner[0] = innerMode(mode, state).mode; }
- var style = mode.token(stream, state);
- if (stream.pos > stream.start) { return style }
- }
- throw new Error("Mode " + mode.name + " failed to advance stream.")
- }
- var Token = function(stream, type, state) {
- this.start = stream.start; this.end = stream.pos;
- this.string = stream.current();
- this.type = type || null;
- this.state = state;
- };
- // Utility for getTokenAt and getLineTokens
- function takeToken(cm, pos, precise, asArray) {
- var doc = cm.doc, mode = doc.mode, style;
- pos = clipPos(doc, pos);
- var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
- var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
- if (asArray) { tokens = []; }
- while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
- stream.start = stream.pos;
- style = readToken(mode, stream, context.state);
- if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
- }
- return asArray ? tokens : new Token(stream, style, context.state)
- }
- function extractLineClasses(type, output) {
- if (type) { for (;;) {
- var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
- if (!lineClass) { break }
- type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
- var prop = lineClass[1] ? "bgClass" : "textClass";
- if (output[prop] == null)
- { output[prop] = lineClass[2]; }
- else if (!(new RegExp("(?:^|\\s)" + lineClass[2] + "(?:$|\\s)")).test(output[prop]))
- { output[prop] += " " + lineClass[2]; }
- } }
- return type
- }
- // Run the given mode's parser over a line, calling f for each token.
- function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
- var flattenSpans = mode.flattenSpans;
- if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
- var curStart = 0, curStyle = null;
- var stream = new StringStream(text, cm.options.tabSize, context), style;
- var inner = cm.options.addModeClass && [null];
- if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
- while (!stream.eol()) {
- if (stream.pos > cm.options.maxHighlightLength) {
- flattenSpans = false;
- if (forceToEnd) { processLine(cm, text, context, stream.pos); }
- stream.pos = text.length;
- style = null;
- } else {
- style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
- }
- if (inner) {
- var mName = inner[0].name;
- if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
- }
- if (!flattenSpans || curStyle != style) {
- while (curStart < stream.start) {
- curStart = Math.min(stream.start, curStart + 5000);
- f(curStart, curStyle);
- }
- curStyle = style;
- }
- stream.start = stream.pos;
- }
- while (curStart < stream.pos) {
- // Webkit seems to refuse to render text nodes longer than 57444
- // characters, and returns inaccurate measurements in nodes
- // starting around 5000 chars.
- var pos = Math.min(stream.pos, curStart + 5000);
- f(pos, curStyle);
- curStart = pos;
- }
- }
- // Finds the line to start with when starting a parse. Tries to
- // find a line with a stateAfter, so that it can start with a
- // valid state. If that fails, it returns the line with the
- // smallest indentation, which tends to need the least context to
- // parse correctly.
- function findStartLine(cm, n, precise) {
- var minindent, minline, doc = cm.doc;
- var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
- for (var search = n; search > lim; --search) {
- if (search <= doc.first) { return doc.first }
- var line = getLine(doc, search - 1), after = line.stateAfter;
- if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
- { return search }
- var indented = countColumn(line.text, null, cm.options.tabSize);
- if (minline == null || minindent > indented) {
- minline = search - 1;
- minindent = indented;
- }
- }
- return minline
- }
- function retreatFrontier(doc, n) {
- doc.modeFrontier = Math.min(doc.modeFrontier, n);
- if (doc.highlightFrontier < n - 10) { return }
- var start = doc.first;
- for (var line = n - 1; line > start; line--) {
- var saved = getLine(doc, line).stateAfter;
- // change is on 3
- // state on line 1 looked ahead 2 -- so saw 3
- // test 1 + 2 < 3 should cover this
- if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
- start = line + 1;
- break
- }
- }
- doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
- }
- // Optimize some code when these features are not used.
- var sawReadOnlySpans = false, sawCollapsedSpans = false;
- function seeReadOnlySpans() {
- sawReadOnlySpans = true;
- }
- function seeCollapsedSpans() {
- sawCollapsedSpans = true;
- }
- // TEXTMARKER SPANS
- function MarkedSpan(marker, from, to) {
- this.marker = marker;
- this.from = from; this.to = to;
- }
- // Search an array of spans for a span matching the given marker.
- function getMarkedSpanFor(spans, marker) {
- if (spans) { for (var i = 0; i < spans.length; ++i) {
- var span = spans[i];
- if (span.marker == marker) { return span }
- } }
- }
- // Remove a span from an array, returning undefined if no spans are
- // left (we don't store arrays for lines without spans).
- function removeMarkedSpan(spans, span) {
- var r;
- for (var i = 0; i < spans.length; ++i)
- { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
- return r
- }
- // Add a span to a line.
- function addMarkedSpan(line, span) {
- line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
- span.marker.attachLine(line);
- }
- // Used for the algorithm that adjusts markers for a change in the
- // document. These functions cut an array of spans at a given
- // character position, returning an array of remaining chunks (or
- // undefined if nothing remains).
- function markedSpansBefore(old, startCh, isInsert) {
- var nw;
- if (old) { for (var i = 0; i < old.length; ++i) {
- var span = old[i], marker = span.marker;
- var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
- if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
- var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
- ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
- }
- } }
- return nw
- }
- function markedSpansAfter(old, endCh, isInsert) {
- var nw;
- if (old) { for (var i = 0; i < old.length; ++i) {
- var span = old[i], marker = span.marker;
- var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
- if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
- var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
- ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
- span.to == null ? null : span.to - endCh));
- }
- } }
- return nw
- }
- // Given a change object, compute the new set of marker spans that
- // cover the line in which the change took place. Removes spans
- // entirely within the change, reconnects spans belonging to the
- // same marker that appear on both sides of the change, and cuts off
- // spans partially within the change. Returns an array of span
- // arrays with one element for each line in (after) the change.
- function stretchSpansOverChange(doc, change) {
- if (change.full) { return null }
- var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
- var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
- if (!oldFirst && !oldLast) { return null }
- var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
- // Get the spans that 'stick out' on both sides
- var first = markedSpansBefore(oldFirst, startCh, isInsert);
- var last = markedSpansAfter(oldLast, endCh, isInsert);
- // Next, merge those two ends
- var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
- if (first) {
- // Fix up .to properties of first
- for (var i = 0; i < first.length; ++i) {
- var span = first[i];
- if (span.to == null) {
- var found = getMarkedSpanFor(last, span.marker);
- if (!found) { span.to = startCh; }
- else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
- }
- }
- }
- if (last) {
- // Fix up .from in last (or move them into first in case of sameLine)
- for (var i$1 = 0; i$1 < last.length; ++i$1) {
- var span$1 = last[i$1];
- if (span$1.to != null) { span$1.to += offset; }
- if (span$1.from == null) {
- var found$1 = getMarkedSpanFor(first, span$1.marker);
- if (!found$1) {
- span$1.from = offset;
- if (sameLine) { (first || (first = [])).push(span$1); }
- }
- } else {
- span$1.from += offset;
- if (sameLine) { (first || (first = [])).push(span$1); }
- }
- }
- }
- // Make sure we didn't create any zero-length spans
- if (first) { first = clearEmptySpans(first); }
- if (last && last != first) { last = clearEmptySpans(last); }
- var newMarkers = [first];
- if (!sameLine) {
- // Fill gap with whole-line-spans
- var gap = change.text.length - 2, gapMarkers;
- if (gap > 0 && first)
- { for (var i$2 = 0; i$2 < first.length; ++i$2)
- { if (first[i$2].to == null)
- { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
- for (var i$3 = 0; i$3 < gap; ++i$3)
- { newMarkers.push(gapMarkers); }
- newMarkers.push(last);
- }
- return newMarkers
- }
- // Remove spans that are empty and don't have a clearWhenEmpty
- // option of false.
- function clearEmptySpans(spans) {
- for (var i = 0; i < spans.length; ++i) {
- var span = spans[i];
- if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
- { spans.splice(i--, 1); }
- }
- if (!spans.length) { return null }
- return spans
- }
- // Used to 'clip' out readOnly ranges when making a change.
- function removeReadOnlyRanges(doc, from, to) {
- var markers = null;
- doc.iter(from.line, to.line + 1, function (line) {
- if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
- var mark = line.markedSpans[i].marker;
- if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
- { (markers || (markers = [])).push(mark); }
- } }
- });
- if (!markers) { return null }
- var parts = [{from: from, to: to}];
- for (var i = 0; i < markers.length; ++i) {
- var mk = markers[i], m = mk.find(0);
- for (var j = 0; j < parts.length; ++j) {
- var p = parts[j];
- if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
- var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
- if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
- { newParts.push({from: p.from, to: m.from}); }
- if (dto > 0 || !mk.inclusiveRight && !dto)
- { newParts.push({from: m.to, to: p.to}); }
- parts.splice.apply(parts, newParts);
- j += newParts.length - 3;
- }
- }
- return parts
- }
- // Connect or disconnect spans from a line.
- function detachMarkedSpans(line) {
- var spans = line.markedSpans;
- if (!spans) { return }
- for (var i = 0; i < spans.length; ++i)
- { spans[i].marker.detachLine(line); }
- line.markedSpans = null;
- }
- function attachMarkedSpans(line, spans) {
- if (!spans) { return }
- for (var i = 0; i < spans.length; ++i)
- { spans[i].marker.attachLine(line); }
- line.markedSpans = spans;
- }
- // Helpers used when computing which overlapping collapsed span
- // counts as the larger one.
- function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
- function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
- // Returns a number indicating which of two overlapping collapsed
- // spans is larger (and thus includes the other). Falls back to
- // comparing ids when the spans cover exactly the same range.
- function compareCollapsedMarkers(a, b) {
- var lenDiff = a.lines.length - b.lines.length;
- if (lenDiff != 0) { return lenDiff }
- var aPos = a.find(), bPos = b.find();
- var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
- if (fromCmp) { return -fromCmp }
- var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
- if (toCmp) { return toCmp }
- return b.id - a.id
- }
- // Find out whether a line ends or starts in a collapsed span. If
- // so, return the marker for that span.
- function collapsedSpanAtSide(line, start) {
- var sps = sawCollapsedSpans && line.markedSpans, found;
- if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
- sp = sps[i];
- if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
- (!found || compareCollapsedMarkers(found, sp.marker) < 0))
- { found = sp.marker; }
- } }
- return found
- }
- function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
- function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
- function collapsedSpanAround(line, ch) {
- var sps = sawCollapsedSpans && line.markedSpans, found;
- if (sps) { for (var i = 0; i < sps.length; ++i) {
- var sp = sps[i];
- if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
- (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
- } }
- return found
- }
- // Test whether there exists a collapsed span that partially
- // overlaps (covers the start or end, but not both) of a new span.
- // Such overlap is not allowed.
- function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
- var line = getLine(doc, lineNo);
- var sps = sawCollapsedSpans && line.markedSpans;
- if (sps) { for (var i = 0; i < sps.length; ++i) {
- var sp = sps[i];
- if (!sp.marker.collapsed) { continue }
- var found = sp.marker.find(0);
- var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
- var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
- if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
- if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
- fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
- { return true }
- } }
- }
- // A visual line is a line as drawn on the screen. Folding, for
- // example, can cause multiple logical lines to appear on the same
- // visual line. This finds the start of the visual line that the
- // given line is part of (usually that is the line itself).
- function visualLine(line) {
- var merged;
- while (merged = collapsedSpanAtStart(line))
- { line = merged.find(-1, true).line; }
- return line
- }
- function visualLineEnd(line) {
- var merged;
- while (merged = collapsedSpanAtEnd(line))
- { line = merged.find(1, true).line; }
- return line
- }
- // Returns an array of logical lines that continue the visual line
- // started by the argument, or undefined if there are no such lines.
- function visualLineContinued(line) {
- var merged, lines;
- while (merged = collapsedSpanAtEnd(line)) {
- line = merged.find(1, true).line
- ;(lines || (lines = [])).push(line);
- }
- return lines
- }
- // Get the line number of the start of the visual line that the
- // given line number is part of.
- function visualLineNo(doc, lineN) {
- var line = getLine(doc, lineN), vis = visualLine(line);
- if (line == vis) { return lineN }
- return lineNo(vis)
- }
- // Get the line number of the start of the next visual line after
- // the given line.
- function visualLineEndNo(doc, lineN) {
- if (lineN > doc.lastLine()) { return lineN }
- var line = getLine(doc, lineN), merged;
- if (!lineIsHidden(doc, line)) { return lineN }
- while (merged = collapsedSpanAtEnd(line))
- { line = merged.find(1, true).line; }
- return lineNo(line) + 1
- }
- // Compute whether a line is hidden. Lines count as hidden when they
- // are part of a visual line that starts with another line, or when
- // they are entirely covered by collapsed, non-widget span.
- function lineIsHidden(doc, line) {
- var sps = sawCollapsedSpans && line.markedSpans;
- if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
- sp = sps[i];
- if (!sp.marker.collapsed) { continue }
- if (sp.from == null) { return true }
- if (sp.marker.widgetNode) { continue }
- if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
- { return true }
- } }
- }
- function lineIsHiddenInner(doc, line, span) {
- if (span.to == null) {
- var end = span.marker.find(1, true);
- return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
- }
- if (span.marker.inclusiveRight && span.to == line.text.length)
- { return true }
- for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
- sp = line.markedSpans[i];
- if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
- (sp.to == null || sp.to != span.from) &&
- (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
- lineIsHiddenInner(doc, line, sp)) { return true }
- }
- }
- // Find the height above the given line.
- function heightAtLine(lineObj) {
- lineObj = visualLine(lineObj);
- var h = 0, chunk = lineObj.parent;
- for (var i = 0; i < chunk.lines.length; ++i) {
- var line = chunk.lines[i];
- if (line == lineObj) { break }
- else { h += line.height; }
- }
- for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
- for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
- var cur = p.children[i$1];
- if (cur == chunk) { break }
- else { h += cur.height; }
- }
- }
- return h
- }
- // Compute the character length of a line, taking into account
- // collapsed ranges (see markText) that might hide parts, and join
- // other lines onto it.
- function lineLength(line) {
- if (line.height == 0) { return 0 }
- var len = line.text.length, merged, cur = line;
- while (merged = collapsedSpanAtStart(cur)) {
- var found = merged.find(0, true);
- cur = found.from.line;
- len += found.from.ch - found.to.ch;
- }
- cur = line;
- while (merged = collapsedSpanAtEnd(cur)) {
- var found$1 = merged.find(0, true);
- len -= cur.text.length - found$1.from.ch;
- cur = found$1.to.line;
- len += cur.text.length - found$1.to.ch;
- }
- return len
- }
- // Find the longest line in the document.
- function findMaxLine(cm) {
- var d = cm.display, doc = cm.doc;
- d.maxLine = getLine(doc, doc.first);
- d.maxLineLength = lineLength(d.maxLine);
- d.maxLineChanged = true;
- doc.iter(function (line) {
- var len = lineLength(line);
- if (len > d.maxLineLength) {
- d.maxLineLength = len;
- d.maxLine = line;
- }
- });
- }
- // LINE DATA STRUCTURE
- // Line objects. These hold state related to a line, including
- // highlighting info (the styles array).
- var Line = function(text, markedSpans, estimateHeight) {
- this.text = text;
- attachMarkedSpans(this, markedSpans);
- this.height = estimateHeight ? estimateHeight(this) : 1;
- };
- Line.prototype.lineNo = function () { return lineNo(this) };
- eventMixin(Line);
- // Change the content (text, markers) of a line. Automatically
- // invalidates cached information and tries to re-estimate the
- // line's height.
- function updateLine(line, text, markedSpans, estimateHeight) {
- line.text = text;
- if (line.stateAfter) { line.stateAfter = null; }
- if (line.styles) { line.styles = null; }
- if (line.order != null) { line.order = null; }
- detachMarkedSpans(line);
- attachMarkedSpans(line, markedSpans);
- var estHeight = estimateHeight ? estimateHeight(line) : 1;
- if (estHeight != line.height) { updateLineHeight(line, estHeight); }
- }
- // Detach a line from the document tree and its markers.
- function cleanUpLine(line) {
- line.parent = null;
- detachMarkedSpans(line);
- }
- // Convert a style as returned by a mode (either null, or a string
- // containing one or more styles) to a CSS style. This is cached,
- // and also looks for line-wide styles.
- var styleToClassCache = {}, styleToClassCacheWithMode = {};
- function interpretTokenStyle(style, options) {
- if (!style || /^\s*$/.test(style)) { return null }
- var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
- return cache[style] ||
- (cache[style] = style.replace(/\S+/g, "cm-$&"))
- }
- // Render the DOM representation of the text of a line. Also builds
- // up a 'line map', which points at the DOM nodes that represent
- // specific stretches of text, and is used by the measuring code.
- // The returned object contains the DOM node, this map, and
- // information about line-wide styles that were set by the mode.
- function buildLineContent(cm, lineView) {
- // The padding-right forces the element to have a 'border', which
- // is needed on Webkit to be able to get line-level bounding
- // rectangles for it (in measureChar).
- var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
- var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
- col: 0, pos: 0, cm: cm,
- trailingSpace: false,
- splitSpaces: cm.getOption("lineWrapping")};
- lineView.measure = {};
- // Iterate over the logical lines that make up this visual line.
- for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
- var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
- builder.pos = 0;
- builder.addToken = buildToken;
- // Optionally wire in some hacks into the token-rendering
- // algorithm, to deal with browser quirks.
- if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
- { builder.addToken = buildTokenBadBidi(builder.addToken, order); }
- builder.map = [];
- var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
- insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
- if (line.styleClasses) {
- if (line.styleClasses.bgClass)
- { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
- if (line.styleClasses.textClass)
- { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
- }
- // Ensure at least a single node is present, for measuring.
- if (builder.map.length == 0)
- { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
- // Store the map and a cache object for the current logical line
- if (i == 0) {
- lineView.measure.map = builder.map;
- lineView.measure.cache = {};
- } else {
- (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
- ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
- }
- }
- // See issue #2901
- if (webkit) {
- var last = builder.content.lastChild;
- if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
- { builder.content.className = "cm-tab-wrap-hack"; }
- }
- signal(cm, "renderLine", cm, lineView.line, builder.pre);
- if (builder.pre.className)
- { builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
- return builder
- }
- function defaultSpecialCharPlaceholder(ch) {
- var token = elt("span", "\u2022", "cm-invalidchar");
- token.title = "\\u" + ch.charCodeAt(0).toString(16);
- token.setAttribute("aria-label", token.title);
- return token
- }
- // Build up the DOM representation for a single token, and add it to
- // the line map. Takes care to render special characters separately.
- function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
- if (!text) { return }
- var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
- var special = builder.cm.state.specialChars, mustWrap = false;
- var content;
- if (!special.test(text)) {
- builder.col += text.length;
- content = document.createTextNode(displayText);
- builder.map.push(builder.pos, builder.pos + text.length, content);
- if (ie && ie_version < 9) { mustWrap = true; }
- builder.pos += text.length;
- } else {
- content = document.createDocumentFragment();
- var pos = 0;
- while (true) {
- special.lastIndex = pos;
- var m = special.exec(text);
- var skipped = m ? m.index - pos : text.length - pos;
- if (skipped) {
- var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
- if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
- else { content.appendChild(txt); }
- builder.map.push(builder.pos, builder.pos + skipped, txt);
- builder.col += skipped;
- builder.pos += skipped;
- }
- if (!m) { break }
- pos += skipped + 1;
- var txt$1 = (void 0);
- if (m[0] == "\t") {
- var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
- txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
- txt$1.setAttribute("role", "presentation");
- txt$1.setAttribute("cm-text", "\t");
- builder.col += tabWidth;
- } else if (m[0] == "\r" || m[0] == "\n") {
- txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
- txt$1.setAttribute("cm-text", m[0]);
- builder.col += 1;
- } else {
- txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
- txt$1.setAttribute("cm-text", m[0]);
- if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
- else { content.appendChild(txt$1); }
- builder.col += 1;
- }
- builder.map.push(builder.pos, builder.pos + 1, txt$1);
- builder.pos++;
- }
- }
- builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
- if (style || startStyle || endStyle || mustWrap || css || attributes) {
- var fullStyle = style || "";
- if (startStyle) { fullStyle += startStyle; }
- if (endStyle) { fullStyle += endStyle; }
- var token = elt("span", [content], fullStyle, css);
- if (attributes) {
- for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
- { token.setAttribute(attr, attributes[attr]); } }
- }
- return builder.content.appendChild(token)
- }
- builder.content.appendChild(content);
- }
- // Change some spaces to NBSP to prevent the browser from collapsing
- // trailing spaces at the end of a line when rendering text (issue #1362).
- function splitSpaces(text, trailingBefore) {
- if (text.length > 1 && !/ /.test(text)) { return text }
- var spaceBefore = trailingBefore, result = "";
- for (var i = 0; i < text.length; i++) {
- var ch = text.charAt(i);
- if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
- { ch = "\u00a0"; }
- result += ch;
- spaceBefore = ch == " ";
- }
- return result
- }
- // Work around nonsense dimensions being reported for stretches of
- // right-to-left text.
- function buildTokenBadBidi(inner, order) {
- return function (builder, text, style, startStyle, endStyle, css, attributes) {
- style = style ? style + " cm-force-border" : "cm-force-border";
- var start = builder.pos, end = start + text.length;
- for (;;) {
- // Find the part that overlaps with the start of this text
- var part = (void 0);
- for (var i = 0; i < order.length; i++) {
- part = order[i];
- if (part.to > start && part.from <= start) { break }
- }
- if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
- inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
- startStyle = null;
- text = text.slice(part.to - start);
- start = part.to;
- }
- }
- }
- function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
- var widget = !ignoreWidget && marker.widgetNode;
- if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
- if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
- if (!widget)
- { widget = builder.content.appendChild(document.createElement("span")); }
- widget.setAttribute("cm-marker", marker.id);
- }
- if (widget) {
- builder.cm.display.input.setUneditable(widget);
- builder.content.appendChild(widget);
- }
- builder.pos += size;
- builder.trailingSpace = false;
- }
- // Outputs a number of spans to make up a line, taking highlighting
- // and marked text into account.
- function insertLineContent(line, builder, styles) {
- var spans = line.markedSpans, allText = line.text, at = 0;
- if (!spans) {
- for (var i$1 = 1; i$1 < styles.length; i$1+=2)
- { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
- return
- }
- var len = allText.length, pos = 0, i = 1, text = "", style, css;
- var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
- for (;;) {
- if (nextChange == pos) { // Update current marker set
- spanStyle = spanEndStyle = spanStartStyle = css = "";
- attributes = null;
- collapsed = null; nextChange = Infinity;
- var foundBookmarks = [], endStyles = (void 0);
- for (var j = 0; j < spans.length; ++j) {
- var sp = spans[j], m = sp.marker;
- if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
- foundBookmarks.push(m);
- } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
- if (sp.to != null && sp.to != pos && nextChange > sp.to) {
- nextChange = sp.to;
- spanEndStyle = "";
- }
- if (m.className) { spanStyle += " " + m.className; }
- if (m.css) { css = (css ? css + ";" : "") + m.css; }
- if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
- if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
- // support for the old title property
- // https://github.com/codemirror/CodeMirror/pull/5673
- if (m.title) { (attributes || (attributes = {})).title = m.title; }
- if (m.attributes) {
- for (var attr in m.attributes)
- { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
- }
- if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
- { collapsed = sp; }
- } else if (sp.from > pos && nextChange > sp.from) {
- nextChange = sp.from;
- }
- }
- if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
- { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
- if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
- { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
- if (collapsed && (collapsed.from || 0) == pos) {
- buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
- collapsed.marker, collapsed.from == null);
- if (collapsed.to == null) { return }
- if (collapsed.to == pos) { collapsed = false; }
- }
- }
- if (pos >= len) { break }
- var upto = Math.min(len, nextChange);
- while (true) {
- if (text) {
- var end = pos + text.length;
- if (!collapsed) {
- var tokenText = end > upto ? text.slice(0, upto - pos) : text;
- builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
- spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
- }
- if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
- pos = end;
- spanStartStyle = "";
- }
- text = allText.slice(at, at = styles[i++]);
- style = interpretTokenStyle(styles[i++], builder.cm.options);
- }
- }
- }
- // These objects are used to represent the visible (currently drawn)
- // part of the document. A LineView may correspond to multiple
- // logical lines, if those are connected by collapsed ranges.
- function LineView(doc, line, lineN) {
- // The starting line
- this.line = line;
- // Continuing lines, if any
- this.rest = visualLineContinued(line);
- // Number of logical lines in this visual line
- this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
- this.node = this.text = null;
- this.hidden = lineIsHidden(doc, line);
- }
- // Create a range of LineView objects for the given lines.
- function buildViewArray(cm, from, to) {
- var array = [], nextPos;
- for (var pos = from; pos < to; pos = nextPos) {
- var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
- nextPos = pos + view.size;
- array.push(view);
- }
- return array
- }
- var operationGroup = null;
- function pushOperation(op) {
- if (operationGroup) {
- operationGroup.ops.push(op);
- } else {
- op.ownsGroup = operationGroup = {
- ops: [op],
- delayedCallbacks: []
- };
- }
- }
- function fireCallbacksForOps(group) {
- // Calls delayed callbacks and cursorActivity handlers until no
- // new ones appear
- var callbacks = group.delayedCallbacks, i = 0;
- do {
- for (; i < callbacks.length; i++)
- { callbacks[i].call(null); }
- for (var j = 0; j < group.ops.length; j++) {
- var op = group.ops[j];
- if (op.cursorActivityHandlers)
- { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
- { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
- }
- } while (i < callbacks.length)
- }
- function finishOperation(op, endCb) {
- var group = op.ownsGroup;
- if (!group) { return }
- try { fireCallbacksForOps(group); }
- finally {
- operationGroup = null;
- endCb(group);
- }
- }
- var orphanDelayedCallbacks = null;
- // Often, we want to signal events at a point where we are in the
- // middle of some work, but don't want the handler to start calling
- // other methods on the editor, which might be in an inconsistent
- // state or simply not expect any other events to happen.
- // signalLater looks whether there are any handlers, and schedules
- // them to be executed when the last operation ends, or, if no
- // operation is active, when a timeout fires.
- function signalLater(emitter, type /*, values...*/) {
- var arr = getHandlers(emitter, type);
- if (!arr.length) { return }
- var args = Array.prototype.slice.call(arguments, 2), list;
- if (operationGroup) {
- list = operationGroup.delayedCallbacks;
- } else if (orphanDelayedCallbacks) {
- list = orphanDelayedCallbacks;
- } else {
- list = orphanDelayedCallbacks = [];
- setTimeout(fireOrphanDelayed, 0);
- }
- var loop = function ( i ) {
- list.push(function () { return arr[i].apply(null, args); });
- };
- for (var i = 0; i < arr.length; ++i)
- loop( i );
- }
- function fireOrphanDelayed() {
- var delayed = orphanDelayedCallbacks;
- orphanDelayedCallbacks = null;
- for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
- }
- // When an aspect of a line changes, a string is added to
- // lineView.changes. This updates the relevant part of the line's
- // DOM structure.
- function updateLineForChanges(cm, lineView, lineN, dims) {
- for (var j = 0; j < lineView.changes.length; j++) {
- var type = lineView.changes[j];
- if (type == "text") { updateLineText(cm, lineView); }
- else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
- else if (type == "class") { updateLineClasses(cm, lineView); }
- else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
- }
- lineView.changes = null;
- }
- // Lines with gutter elements, widgets or a background class need to
- // be wrapped, and have the extra elements added to the wrapper div
- function ensureLineWrapped(lineView) {
- if (lineView.node == lineView.text) {
- lineView.node = elt("div", null, null, "position: relative");
- if (lineView.text.parentNode)
- { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
- lineView.node.appendChild(lineView.text);
- if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
- }
- return lineView.node
- }
- function updateLineBackground(cm, lineView) {
- var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
- if (cls) { cls += " CodeMirror-linebackground"; }
- if (lineView.background) {
- if (cls) { lineView.background.className = cls; }
- else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
- } else if (cls) {
- var wrap = ensureLineWrapped(lineView);
- lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
- cm.display.input.setUneditable(lineView.background);
- }
- }
- // Wrapper around buildLineContent which will reuse the structure
- // in display.externalMeasured when possible.
- function getLineContent(cm, lineView) {
- var ext = cm.display.externalMeasured;
- if (ext && ext.line == lineView.line) {
- cm.display.externalMeasured = null;
- lineView.measure = ext.measure;
- return ext.built
- }
- return buildLineContent(cm, lineView)
- }
- // Redraw the line's text. Interacts with the background and text
- // classes because the mode may output tokens that influence these
- // classes.
- function updateLineText(cm, lineView) {
- var cls = lineView.text.className;
- var built = getLineContent(cm, lineView);
- if (lineView.text == lineView.node) { lineView.node = built.pre; }
- lineView.text.parentNode.replaceChild(built.pre, lineView.text);
- lineView.text = built.pre;
- if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
- lineView.bgClass = built.bgClass;
- lineView.textClass = built.textClass;
- updateLineClasses(cm, lineView);
- } else if (cls) {
- lineView.text.className = cls;
- }
- }
- function updateLineClasses(cm, lineView) {
- updateLineBackground(cm, lineView);
- if (lineView.line.wrapClass)
- { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
- else if (lineView.node != lineView.text)
- { lineView.node.className = ""; }
- var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
- lineView.text.className = textClass || "";
- }
- function updateLineGutter(cm, lineView, lineN, dims) {
- if (lineView.gutter) {
- lineView.node.removeChild(lineView.gutter);
- lineView.gutter = null;
- }
- if (lineView.gutterBackground) {
- lineView.node.removeChild(lineView.gutterBackground);
- lineView.gutterBackground = null;
- }
- if (lineView.line.gutterClass) {
- var wrap = ensureLineWrapped(lineView);
- lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
- ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
- cm.display.input.setUneditable(lineView.gutterBackground);
- wrap.insertBefore(lineView.gutterBackground, lineView.text);
- }
- var markers = lineView.line.gutterMarkers;
- if (cm.options.lineNumbers || markers) {
- var wrap$1 = ensureLineWrapped(lineView);
- var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
- cm.display.input.setUneditable(gutterWrap);
- wrap$1.insertBefore(gutterWrap, lineView.text);
- if (lineView.line.gutterClass)
- { gutterWrap.className += " " + lineView.line.gutterClass; }
- if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
- { lineView.lineNumber = gutterWrap.appendChild(
- elt("div", lineNumberFor(cm.options, lineN),
- "CodeMirror-linenumber CodeMirror-gutter-elt",
- ("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
- if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {
- var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];
- if (found)
- { gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
- ("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
- } }
- }
- }
- function updateLineWidgets(cm, lineView, dims) {
- if (lineView.alignable) { lineView.alignable = null; }
- var isWidget = classTest("CodeMirror-linewidget");
- for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
- next = node.nextSibling;
- if (isWidget.test(node.className)) { lineView.node.removeChild(node); }
- }
- insertLineWidgets(cm, lineView, dims);
- }
- // Build a line's DOM representation from scratch
- function buildLineElement(cm, lineView, lineN, dims) {
- var built = getLineContent(cm, lineView);
- lineView.text = lineView.node = built.pre;
- if (built.bgClass) { lineView.bgClass = built.bgClass; }
- if (built.textClass) { lineView.textClass = built.textClass; }
- updateLineClasses(cm, lineView);
- updateLineGutter(cm, lineView, lineN, dims);
- insertLineWidgets(cm, lineView, dims);
- return lineView.node
- }
- // A lineView may contain multiple logical lines (when merged by
- // collapsed spans). The widgets for all of them need to be drawn.
- function insertLineWidgets(cm, lineView, dims) {
- insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
- if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
- { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
- }
- function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
- if (!line.widgets) { return }
- var wrap = ensureLineWrapped(lineView);
- for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
- var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget" + (widget.className ? " " + widget.className : ""));
- if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
- positionLineWidget(widget, node, lineView, dims);
- cm.display.input.setUneditable(node);
- if (allowAbove && widget.above)
- { wrap.insertBefore(node, lineView.gutter || lineView.text); }
- else
- { wrap.appendChild(node); }
- signalLater(widget, "redraw");
- }
- }
- function positionLineWidget(widget, node, lineView, dims) {
- if (widget.noHScroll) {
- (lineView.alignable || (lineView.alignable = [])).push(node);
- var width = dims.wrapperWidth;
- node.style.left = dims.fixedPos + "px";
- if (!widget.coverGutter) {
- width -= dims.gutterTotalWidth;
- node.style.paddingLeft = dims.gutterTotalWidth + "px";
- }
- node.style.width = width + "px";
- }
- if (widget.coverGutter) {
- node.style.zIndex = 5;
- node.style.position = "relative";
- if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
- }
- }
- function widgetHeight(widget) {
- if (widget.height != null) { return widget.height }
- var cm = widget.doc.cm;
- if (!cm) { return 0 }
- if (!contains(document.body, widget.node)) {
- var parentStyle = "position: relative;";
- if (widget.coverGutter)
- { parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
- if (widget.noHScroll)
- { parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
- removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
- }
- return widget.height = widget.node.parentNode.offsetHeight
- }
- // Return true when the given mouse event happened in a widget
- function eventInWidget(display, e) {
- for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
- if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
- (n.parentNode == display.sizer && n != display.mover))
- { return true }
- }
- }
- // POSITION MEASUREMENT
- function paddingTop(display) {return display.lineSpace.offsetTop}
- function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
- function paddingH(display) {
- if (display.cachedPaddingH) { return display.cachedPaddingH }
- var e = removeChildrenAndAdd(display.measure, elt("pre", "x", "CodeMirror-line-like"));
- var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
- var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
- if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
- return data
- }
- function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
- function displayWidth(cm) {
- return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
- }
- function displayHeight(cm) {
- return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
- }
- // Ensure the lineView.wrapping.heights array is populated. This is
- // an array of bottom offsets for the lines that make up a drawn
- // line. When lineWrapping is on, there might be more than one
- // height.
- function ensureLineHeights(cm, lineView, rect) {
- var wrapping = cm.options.lineWrapping;
- var curWidth = wrapping && displayWidth(cm);
- if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
- var heights = lineView.measure.heights = [];
- if (wrapping) {
- lineView.measure.width = curWidth;
- var rects = lineView.text.firstChild.getClientRects();
- for (var i = 0; i < rects.length - 1; i++) {
- var cur = rects[i], next = rects[i + 1];
- if (Math.abs(cur.bottom - next.bottom) > 2)
- { heights.push((cur.bottom + next.top) / 2 - rect.top); }
- }
- }
- heights.push(rect.bottom - rect.top);
- }
- }
- // Find a line map (mapping character offsets to text nodes) and a
- // measurement cache for the given line number. (A line view might
- // contain multiple lines when collapsed ranges are present.)
- function mapFromLineView(lineView, line, lineN) {
- if (lineView.line == line)
- { return {map: lineView.measure.map, cache: lineView.measure.cache} }
- for (var i = 0; i < lineView.rest.length; i++)
- { if (lineView.rest[i] == line)
- { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
- for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
- { if (lineNo(lineView.rest[i$1]) > lineN)
- { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
- }
- // Render a line into the hidden node display.externalMeasured. Used
- // when measurement is needed for a line that's not in the viewport.
- function updateExternalMeasurement(cm, line) {
- line = visualLine(line);
- var lineN = lineNo(line);
- var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
- view.lineN = lineN;
- var built = view.built = buildLineContent(cm, view);
- view.text = built.pre;
- removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
- return view
- }
- // Get a {top, bottom, left, right} box (in line-local coordinates)
- // for a given character.
- function measureChar(cm, line, ch, bias) {
- return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
- }
- // Find a line view that corresponds to the given line number.
- function findViewForLine(cm, lineN) {
- if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
- { return cm.display.view[findViewIndex(cm, lineN)] }
- var ext = cm.display.externalMeasured;
- if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
- { return ext }
- }
- // Measurement can be split in two steps, the set-up work that
- // applies to the whole line, and the measurement of the actual
- // character. Functions like coordsChar, that need to do a lot of
- // measurements in a row, can thus ensure that the set-up work is
- // only done once.
- function prepareMeasureForLine(cm, line) {
- var lineN = lineNo(line);
- var view = findViewForLine(cm, lineN);
- if (view && !view.text) {
- view = null;
- } else if (view && view.changes) {
- updateLineForChanges(cm, view, lineN, getDimensions(cm));
- cm.curOp.forceUpdate = true;
- }
- if (!view)
- { view = updateExternalMeasurement(cm, line); }
- var info = mapFromLineView(view, line, lineN);
- return {
- line: line, view: view, rect: null,
- map: info.map, cache: info.cache, before: info.before,
- hasHeights: false
- }
- }
- // Given a prepared measurement object, measures the position of an
- // actual character (or fetches it from the cache).
- function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
- if (prepared.before) { ch = -1; }
- var key = ch + (bias || ""), found;
- if (prepared.cache.hasOwnProperty(key)) {
- found = prepared.cache[key];
- } else {
- if (!prepared.rect)
- { prepared.rect = prepared.view.text.getBoundingClientRect(); }
- if (!prepared.hasHeights) {
- ensureLineHeights(cm, prepared.view, prepared.rect);
- prepared.hasHeights = true;
- }
- found = measureCharInner(cm, prepared, ch, bias);
- if (!found.bogus) { prepared.cache[key] = found; }
- }
- return {left: found.left, right: found.right,
- top: varHeight ? found.rtop : found.top,
- bottom: varHeight ? found.rbottom : found.bottom}
- }
- var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
- function nodeAndOffsetInLineMap(map, ch, bias) {
- var node, start, end, collapse, mStart, mEnd;
- // First, search the line map for the text node corresponding to,
- // or closest to, the target character.
- for (var i = 0; i < map.length; i += 3) {
- mStart = map[i];
- mEnd = map[i + 1];
- if (ch < mStart) {
- start = 0; end = 1;
- collapse = "left";
- } else if (ch < mEnd) {
- start = ch - mStart;
- end = start + 1;
- } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
- end = mEnd - mStart;
- start = end - 1;
- if (ch >= mEnd) { collapse = "right"; }
- }
- if (start != null) {
- node = map[i + 2];
- if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
- { collapse = bias; }
- if (bias == "left" && start == 0)
- { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
- node = map[(i -= 3) + 2];
- collapse = "left";
- } }
- if (bias == "right" && start == mEnd - mStart)
- { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
- node = map[(i += 3) + 2];
- collapse = "right";
- } }
- break
- }
- }
- return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
- }
- function getUsefulRect(rects, bias) {
- var rect = nullRect;
- if (bias == "left") { for (var i = 0; i < rects.length; i++) {
- if ((rect = rects[i]).left != rect.right) { break }
- } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
- if ((rect = rects[i$1]).left != rect.right) { break }
- } }
- return rect
- }
- function measureCharInner(cm, prepared, ch, bias) {
- var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
- var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
- var rect;
- if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
- for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
- while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
- while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
- if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
- { rect = node.parentNode.getBoundingClientRect(); }
- else
- { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
- if (rect.left || rect.right || start == 0) { break }
- end = start;
- start = start - 1;
- collapse = "right";
- }
- if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
- } else { // If it is a widget, simply get the box for the whole widget.
- if (start > 0) { collapse = bias = "right"; }
- var rects;
- if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
- { rect = rects[bias == "right" ? rects.length - 1 : 0]; }
- else
- { rect = node.getBoundingClientRect(); }
- }
- if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
- var rSpan = node.parentNode.getClientRects()[0];
- if (rSpan)
- { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
- else
- { rect = nullRect; }
- }
- var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
- var mid = (rtop + rbot) / 2;
- var heights = prepared.view.measure.heights;
- var i = 0;
- for (; i < heights.length - 1; i++)
- { if (mid < heights[i]) { break } }
- var top = i ? heights[i - 1] : 0, bot = heights[i];
- var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
- right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
- top: top, bottom: bot};
- if (!rect.left && !rect.right) { result.bogus = true; }
- if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
- return result
- }
- // Work around problem with bounding client rects on ranges being
- // returned incorrectly when zoomed on IE10 and below.
- function maybeUpdateRectForZooming(measure, rect) {
- if (!window.screen || screen.logicalXDPI == null ||
- screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
- { return rect }
- var scaleX = screen.logicalXDPI / screen.deviceXDPI;
- var scaleY = screen.logicalYDPI / screen.deviceYDPI;
- return {left: rect.left * scaleX, right: rect.right * scaleX,
- top: rect.top * scaleY, bottom: rect.bottom * scaleY}
- }
- function clearLineMeasurementCacheFor(lineView) {
- if (lineView.measure) {
- lineView.measure.cache = {};
- lineView.measure.heights = null;
- if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
- { lineView.measure.caches[i] = {}; } }
- }
- }
- function clearLineMeasurementCache(cm) {
- cm.display.externalMeasure = null;
- removeChildren(cm.display.lineMeasure);
- for (var i = 0; i < cm.display.view.length; i++)
- { clearLineMeasurementCacheFor(cm.display.view[i]); }
- }
- function clearCaches(cm) {
- clearLineMeasurementCache(cm);
- cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
- if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
- cm.display.lineNumChars = null;
- }
- function pageScrollX() {
- // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
- // which causes page_Offset and bounding client rects to use
- // different reference viewports and invalidate our calculations.
- if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
- return window.pageXOffset || (document.documentElement || document.body).scrollLeft
- }
- function pageScrollY() {
- if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
- return window.pageYOffset || (document.documentElement || document.body).scrollTop
- }
- function widgetTopHeight(lineObj) {
- var height = 0;
- if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
- { height += widgetHeight(lineObj.widgets[i]); } } }
- return height
- }
- // Converts a {top, bottom, left, right} box from line-local
- // coordinates into another coordinate system. Context may be one of
- // "line", "div" (display.lineDiv), "local"./null (editor), "window",
- // or "page".
- function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
- if (!includeWidgets) {
- var height = widgetTopHeight(lineObj);
- rect.top += height; rect.bottom += height;
- }
- if (context == "line") { return rect }
- if (!context) { context = "local"; }
- var yOff = heightAtLine(lineObj);
- if (context == "local") { yOff += paddingTop(cm.display); }
- else { yOff -= cm.display.viewOffset; }
- if (context == "page" || context == "window") {
- var lOff = cm.display.lineSpace.getBoundingClientRect();
- yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
- var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
- rect.left += xOff; rect.right += xOff;
- }
- rect.top += yOff; rect.bottom += yOff;
- return rect
- }
- // Coverts a box from "div" coords to another coordinate system.
- // Context may be "window", "page", "div", or "local"./null.
- function fromCoordSystem(cm, coords, context) {
- if (context == "div") { return coords }
- var left = coords.left, top = coords.top;
- // First move into "page" coordinate system
- if (context == "page") {
- left -= pageScrollX();
- top -= pageScrollY();
- } else if (context == "local" || !context) {
- var localBox = cm.display.sizer.getBoundingClientRect();
- left += localBox.left;
- top += localBox.top;
- }
- var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
- return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
- }
- function charCoords(cm, pos, context, lineObj, bias) {
- if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
- return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
- }
- // Returns a box for a given cursor position, which may have an
- // 'other' property containing the position of the secondary cursor
- // on a bidi boundary.
- // A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
- // and after `char - 1` in writing order of `char - 1`
- // A cursor Pos(line, char, "after") is on the same visual line as `char`
- // and before `char` in writing order of `char`
- // Examples (upper-case letters are RTL, lower-case are LTR):
- // Pos(0, 1, ...)
- // before after
- // ab a|b a|b
- // aB a|B aB|
- // Ab |Ab A|b
- // AB B|A B|A
- // Every position after the last character on a line is considered to stick
- // to the last character on the line.
- function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
- lineObj = lineObj || getLine(cm.doc, pos.line);
- if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
- function get(ch, right) {
- var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
- if (right) { m.left = m.right; } else { m.right = m.left; }
- return intoCoordSystem(cm, lineObj, m, context)
- }
- var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
- if (ch >= lineObj.text.length) {
- ch = lineObj.text.length;
- sticky = "before";
- } else if (ch <= 0) {
- ch = 0;
- sticky = "after";
- }
- if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
- function getBidi(ch, partPos, invert) {
- var part = order[partPos], right = part.level == 1;
- return get(invert ? ch - 1 : ch, right != invert)
- }
- var partPos = getBidiPartAt(order, ch, sticky);
- var other = bidiOther;
- var val = getBidi(ch, partPos, sticky == "before");
- if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
- return val
- }
- // Used to cheaply estimate the coordinates for a position. Used for
- // intermediate scroll updates.
- function estimateCoords(cm, pos) {
- var left = 0;
- pos = clipPos(cm.doc, pos);
- if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
- var lineObj = getLine(cm.doc, pos.line);
- var top = heightAtLine(lineObj) + paddingTop(cm.display);
- return {left: left, right: left, top: top, bottom: top + lineObj.height}
- }
- // Positions returned by coordsChar contain some extra information.
- // xRel is the relative x position of the input coordinates compared
- // to the found position (so xRel > 0 means the coordinates are to
- // the right of the character position, for example). When outside
- // is true, that means the coordinates lie outside the line's
- // vertical range.
- function PosWithInfo(line, ch, sticky, outside, xRel) {
- var pos = Pos(line, ch, sticky);
- pos.xRel = xRel;
- if (outside) { pos.outside = outside; }
- return pos
- }
- // Compute the character position closest to the given coordinates.
- // Input must be lineSpace-local ("div" coordinate system).
- function coordsChar(cm, x, y) {
- var doc = cm.doc;
- y += cm.display.viewOffset;
- if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }
- var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
- if (lineN > last)
- { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }
- if (x < 0) { x = 0; }
- var lineObj = getLine(doc, lineN);
- for (;;) {
- var found = coordsCharInner(cm, lineObj, lineN, x, y);
- var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));
- if (!collapsed) { return found }
- var rangeEnd = collapsed.find(1);
- if (rangeEnd.line == lineN) { return rangeEnd }
- lineObj = getLine(doc, lineN = rangeEnd.line);
- }
- }
- function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
- y -= widgetTopHeight(lineObj);
- var end = lineObj.text.length;
- var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
- end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
- return {begin: begin, end: end}
- }
- function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
- if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
- var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
- return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
- }
- // Returns true if the given side of a box is after the given
- // coordinates, in top-to-bottom, left-to-right order.
- function boxIsAfter(box, x, y, left) {
- return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
- }
- function coordsCharInner(cm, lineObj, lineNo, x, y) {
- // Move y into line-local coordinate space
- y -= heightAtLine(lineObj);
- var preparedMeasure = prepareMeasureForLine(cm, lineObj);
- // When directly calling `measureCharPrepared`, we have to adjust
- // for the widgets at this line.
- var widgetHeight = widgetTopHeight(lineObj);
- var begin = 0, end = lineObj.text.length, ltr = true;
- var order = getOrder(lineObj, cm.doc.direction);
- // If the line isn't plain left-to-right text, first figure out
- // which bidi section the coordinates fall into.
- if (order) {
- var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
- (cm, lineObj, lineNo, preparedMeasure, order, x, y);
- ltr = part.level != 1;
- // The awkward -1 offsets are needed because findFirst (called
- // on these below) will treat its first bound as inclusive,
- // second as exclusive, but we want to actually address the
- // characters in the part's range
- begin = ltr ? part.from : part.to - 1;
- end = ltr ? part.to : part.from - 1;
- }
- // A binary search to find the first character whose bounding box
- // starts after the coordinates. If we run across any whose box wrap
- // the coordinates, store that.
- var chAround = null, boxAround = null;
- var ch = findFirst(function (ch) {
- var box = measureCharPrepared(cm, preparedMeasure, ch);
- box.top += widgetHeight; box.bottom += widgetHeight;
- if (!boxIsAfter(box, x, y, false)) { return false }
- if (box.top <= y && box.left <= x) {
- chAround = ch;
- boxAround = box;
- }
- return true
- }, begin, end);
- var baseX, sticky, outside = false;
- // If a box around the coordinates was found, use that
- if (boxAround) {
- // Distinguish coordinates nearer to the left or right side of the box
- var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
- ch = chAround + (atStart ? 0 : 1);
- sticky = atStart ? "after" : "before";
- baseX = atLeft ? boxAround.left : boxAround.right;
- } else {
- // (Adjust for extended bound, if necessary.)
- if (!ltr && (ch == end || ch == begin)) { ch++; }
- // To determine which side to associate with, get the box to the
- // left of the character and compare it's vertical position to the
- // coordinates
- sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
- (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
- "after" : "before";
- // Now get accurate coordinates for this place, in order to get a
- // base X position
- var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure);
- baseX = coords.left;
- outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;
- }
- ch = skipExtendingChars(lineObj.text, ch, 1);
- return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
- }
- function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
- // Bidi parts are sorted left-to-right, and in a non-line-wrapping
- // situation, we can take this ordering to correspond to the visual
- // ordering. This finds the first part whose end is after the given
- // coordinates.
- var index = findFirst(function (i) {
- var part = order[i], ltr = part.level != 1;
- return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
- "line", lineObj, preparedMeasure), x, y, true)
- }, 0, order.length - 1);
- var part = order[index];
- // If this isn't the first part, the part's start is also after
- // the coordinates, and the coordinates aren't on the same line as
- // that start, move one part back.
- if (index > 0) {
- var ltr = part.level != 1;
- var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
- "line", lineObj, preparedMeasure);
- if (boxIsAfter(start, x, y, true) && start.top > y)
- { part = order[index - 1]; }
- }
- return part
- }
- function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
- // In a wrapped line, rtl text on wrapping boundaries can do things
- // that don't correspond to the ordering in our `order` array at
- // all, so a binary search doesn't work, and we want to return a
- // part that only spans one line so that the binary search in
- // coordsCharInner is safe. As such, we first find the extent of the
- // wrapped line, and then do a flat search in which we discard any
- // spans that aren't on the line.
- var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
- var begin = ref.begin;
- var end = ref.end;
- if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
- var part = null, closestDist = null;
- for (var i = 0; i < order.length; i++) {
- var p = order[i];
- if (p.from >= end || p.to <= begin) { continue }
- var ltr = p.level != 1;
- var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
- // Weigh against spans ending before this, so that they are only
- // picked if nothing ends after
- var dist = endX < x ? x - endX + 1e9 : endX - x;
- if (!part || closestDist > dist) {
- part = p;
- closestDist = dist;
- }
- }
- if (!part) { part = order[order.length - 1]; }
- // Clip the part to the wrapped line.
- if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
- if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
- return part
- }
- var measureText;
- // Compute the default text height.
- function textHeight(display) {
- if (display.cachedTextHeight != null) { return display.cachedTextHeight }
- if (measureText == null) {
- measureText = elt("pre", null, "CodeMirror-line-like");
- // Measure a bunch of lines, for browsers that compute
- // fractional heights.
- for (var i = 0; i < 49; ++i) {
- measureText.appendChild(document.createTextNode("x"));
- measureText.appendChild(elt("br"));
- }
- measureText.appendChild(document.createTextNode("x"));
- }
- removeChildrenAndAdd(display.measure, measureText);
- var height = measureText.offsetHeight / 50;
- if (height > 3) { display.cachedTextHeight = height; }
- removeChildren(display.measure);
- return height || 1
- }
- // Compute the default character width.
- function charWidth(display) {
- if (display.cachedCharWidth != null) { return display.cachedCharWidth }
- var anchor = elt("span", "xxxxxxxxxx");
- var pre = elt("pre", [anchor], "CodeMirror-line-like");
- removeChildrenAndAdd(display.measure, pre);
- var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
- if (width > 2) { display.cachedCharWidth = width; }
- return width || 10
- }
- // Do a bulk-read of the DOM positions and sizes needed to draw the
- // view, so that we don't interleave reading and writing to the DOM.
- function getDimensions(cm) {
- var d = cm.display, left = {}, width = {};
- var gutterLeft = d.gutters.clientLeft;
- for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
- var id = cm.display.gutterSpecs[i].className;
- left[id] = n.offsetLeft + n.clientLeft + gutterLeft;
- width[id] = n.clientWidth;
- }
- return {fixedPos: compensateForHScroll(d),
- gutterTotalWidth: d.gutters.offsetWidth,
- gutterLeft: left,
- gutterWidth: width,
- wrapperWidth: d.wrapper.clientWidth}
- }
- // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
- // but using getBoundingClientRect to get a sub-pixel-accurate
- // result.
- function compensateForHScroll(display) {
- return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
- }
- // Returns a function that estimates the height of a line, to use as
- // first approximation until the line becomes visible (and is thus
- // properly measurable).
- function estimateHeight(cm) {
- var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
- var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
- return function (line) {
- if (lineIsHidden(cm.doc, line)) { return 0 }
- var widgetsHeight = 0;
- if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
- if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
- } }
- if (wrapping)
- { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
- else
- { return widgetsHeight + th }
- }
- }
- function estimateLineHeights(cm) {
- var doc = cm.doc, est = estimateHeight(cm);
- doc.iter(function (line) {
- var estHeight = est(line);
- if (estHeight != line.height) { updateLineHeight(line, estHeight); }
- });
- }
- // Given a mouse event, find the corresponding position. If liberal
- // is false, it checks whether a gutter or scrollbar was clicked,
- // and returns null if it was. forRect is used by rectangular
- // selections, and tries to estimate a character position even for
- // coordinates beyond the right of the text.
- function posFromMouse(cm, e, liberal, forRect) {
- var display = cm.display;
- if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
- var x, y, space = display.lineSpace.getBoundingClientRect();
- // Fails unpredictably on IE[67] when mouse is dragged around quickly.
- try { x = e.clientX - space.left; y = e.clientY - space.top; }
- catch (e$1) { return null }
- var coords = coordsChar(cm, x, y), line;
- if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
- var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
- coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
- }
- return coords
- }
- // Find the view element corresponding to a given line. Return null
- // when the line isn't visible.
- function findViewIndex(cm, n) {
- if (n >= cm.display.viewTo) { return null }
- n -= cm.display.viewFrom;
- if (n < 0) { return null }
- var view = cm.display.view;
- for (var i = 0; i < view.length; i++) {
- n -= view[i].size;
- if (n < 0) { return i }
- }
- }
- // Updates the display.view data structure for a given change to the
- // document. From and to are in pre-change coordinates. Lendiff is
- // the amount of lines added or subtracted by the change. This is
- // used for changes that span multiple lines, or change the way
- // lines are divided into visual lines. regLineChange (below)
- // registers single-line changes.
- function regChange(cm, from, to, lendiff) {
- if (from == null) { from = cm.doc.first; }
- if (to == null) { to = cm.doc.first + cm.doc.size; }
- if (!lendiff) { lendiff = 0; }
- var display = cm.display;
- if (lendiff && to < display.viewTo &&
- (display.updateLineNumbers == null || display.updateLineNumbers > from))
- { display.updateLineNumbers = from; }
- cm.curOp.viewChanged = true;
- if (from >= display.viewTo) { // Change after
- if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
- { resetView(cm); }
- } else if (to <= display.viewFrom) { // Change before
- if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
- resetView(cm);
- } else {
- display.viewFrom += lendiff;
- display.viewTo += lendiff;
- }
- } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
- resetView(cm);
- } else if (from <= display.viewFrom) { // Top overlap
- var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
- if (cut) {
- display.view = display.view.slice(cut.index);
- display.viewFrom = cut.lineN;
- display.viewTo += lendiff;
- } else {
- resetView(cm);
- }
- } else if (to >= display.viewTo) { // Bottom overlap
- var cut$1 = viewCuttingPoint(cm, from, from, -1);
- if (cut$1) {
- display.view = display.view.slice(0, cut$1.index);
- display.viewTo = cut$1.lineN;
- } else {
- resetView(cm);
- }
- } else { // Gap in the middle
- var cutTop = viewCuttingPoint(cm, from, from, -1);
- var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
- if (cutTop && cutBot) {
- display.view = display.view.slice(0, cutTop.index)
- .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
- .concat(display.view.slice(cutBot.index));
- display.viewTo += lendiff;
- } else {
- resetView(cm);
- }
- }
- var ext = display.externalMeasured;
- if (ext) {
- if (to < ext.lineN)
- { ext.lineN += lendiff; }
- else if (from < ext.lineN + ext.size)
- { display.externalMeasured = null; }
- }
- }
- // Register a change to a single line. Type must be one of "text",
- // "gutter", "class", "widget"
- function regLineChange(cm, line, type) {
- cm.curOp.viewChanged = true;
- var display = cm.display, ext = cm.display.externalMeasured;
- if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
- { display.externalMeasured = null; }
- if (line < display.viewFrom || line >= display.viewTo) { return }
- var lineView = display.view[findViewIndex(cm, line)];
- if (lineView.node == null) { return }
- var arr = lineView.changes || (lineView.changes = []);
- if (indexOf(arr, type) == -1) { arr.push(type); }
- }
- // Clear the view.
- function resetView(cm) {
- cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
- cm.display.view = [];
- cm.display.viewOffset = 0;
- }
- function viewCuttingPoint(cm, oldN, newN, dir) {
- var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
- if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
- { return {index: index, lineN: newN} }
- var n = cm.display.viewFrom;
- for (var i = 0; i < index; i++)
- { n += view[i].size; }
- if (n != oldN) {
- if (dir > 0) {
- if (index == view.length - 1) { return null }
- diff = (n + view[index].size) - oldN;
- index++;
- } else {
- diff = n - oldN;
- }
- oldN += diff; newN += diff;
- }
- while (visualLineNo(cm.doc, newN) != newN) {
- if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
- newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
- index += dir;
- }
- return {index: index, lineN: newN}
- }
- // Force the view to cover a given range, adding empty view element
- // or clipping off existing ones as needed.
- function adjustView(cm, from, to) {
- var display = cm.display, view = display.view;
- if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
- display.view = buildViewArray(cm, from, to);
- display.viewFrom = from;
- } else {
- if (display.viewFrom > from)
- { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
- else if (display.viewFrom < from)
- { display.view = display.view.slice(findViewIndex(cm, from)); }
- display.viewFrom = from;
- if (display.viewTo < to)
- { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
- else if (display.viewTo > to)
- { display.view = display.view.slice(0, findViewIndex(cm, to)); }
- }
- display.viewTo = to;
- }
- // Count the number of lines in the view whose DOM representation is
- // out of date (or nonexistent).
- function countDirtyView(cm) {
- var view = cm.display.view, dirty = 0;
- for (var i = 0; i < view.length; i++) {
- var lineView = view[i];
- if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
- }
- return dirty
- }
- function updateSelection(cm) {
- cm.display.input.showSelection(cm.display.input.prepareSelection());
- }
- function prepareSelection(cm, primary) {
- if ( primary === void 0 ) primary = true;
- var doc = cm.doc, result = {};
- var curFragment = result.cursors = document.createDocumentFragment();
- var selFragment = result.selection = document.createDocumentFragment();
- for (var i = 0; i < doc.sel.ranges.length; i++) {
- if (!primary && i == doc.sel.primIndex) { continue }
- var range = doc.sel.ranges[i];
- if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
- var collapsed = range.empty();
- if (collapsed || cm.options.showCursorWhenSelecting)
- { drawSelectionCursor(cm, range.head, curFragment); }
- if (!collapsed)
- { drawSelectionRange(cm, range, selFragment); }
- }
- return result
- }
- // Draws a cursor for the given range
- function drawSelectionCursor(cm, head, output) {
- var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
- var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
- cursor.style.left = pos.left + "px";
- cursor.style.top = pos.top + "px";
- cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
- if (pos.other) {
- // Secondary cursor, shown when on a 'jump' in bi-directional text
- var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
- otherCursor.style.display = "";
- otherCursor.style.left = pos.other.left + "px";
- otherCursor.style.top = pos.other.top + "px";
- otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
- }
- }
- function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
- // Draws the given range as a highlighted selection
- function drawSelectionRange(cm, range, output) {
- var display = cm.display, doc = cm.doc;
- var fragment = document.createDocumentFragment();
- var padding = paddingH(cm.display), leftSide = padding.left;
- var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
- var docLTR = doc.direction == "ltr";
- function add(left, top, width, bottom) {
- if (top < 0) { top = 0; }
- top = Math.round(top);
- bottom = Math.round(bottom);
- fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
- }
- function drawForLine(line, fromArg, toArg) {
- var lineObj = getLine(doc, line);
- var lineLen = lineObj.text.length;
- var start, end;
- function coords(ch, bias) {
- return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
- }
- function wrapX(pos, dir, side) {
- var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
- var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
- var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
- return coords(ch, prop)[prop]
- }
- var order = getOrder(lineObj, doc.direction);
- iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
- var ltr = dir == "ltr";
- var fromPos = coords(from, ltr ? "left" : "right");
- var toPos = coords(to - 1, ltr ? "right" : "left");
- var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
- var first = i == 0, last = !order || i == order.length - 1;
- if (toPos.top - fromPos.top <= 3) { // Single line
- var openLeft = (docLTR ? openStart : openEnd) && first;
- var openRight = (docLTR ? openEnd : openStart) && last;
- var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
- var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
- add(left, fromPos.top, right - left, fromPos.bottom);
- } else { // Multiple lines
- var topLeft, topRight, botLeft, botRight;
- if (ltr) {
- topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
- topRight = docLTR ? rightSide : wrapX(from, dir, "before");
- botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
- botRight = docLTR && openEnd && last ? rightSide : toPos.right;
- } else {
- topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
- topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
- botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
- botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
- }
- add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
- if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
- add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
- }
- if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
- if (cmpCoords(toPos, start) < 0) { start = toPos; }
- if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
- if (cmpCoords(toPos, end) < 0) { end = toPos; }
- });
- return {start: start, end: end}
- }
- var sFrom = range.from(), sTo = range.to();
- if (sFrom.line == sTo.line) {
- drawForLine(sFrom.line, sFrom.ch, sTo.ch);
- } else {
- var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
- var singleVLine = visualLine(fromLine) == visualLine(toLine);
- var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
- var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
- if (singleVLine) {
- if (leftEnd.top < rightStart.top - 2) {
- add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
- add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
- } else {
- add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
- }
- }
- if (leftEnd.bottom < rightStart.top)
- { add(leftSide, leftEnd.bottom, null, rightStart.top); }
- }
- output.appendChild(fragment);
- }
- // Cursor-blinking
- function restartBlink(cm) {
- if (!cm.state.focused) { return }
- var display = cm.display;
- clearInterval(display.blinker);
- var on = true;
- display.cursorDiv.style.visibility = "";
- if (cm.options.cursorBlinkRate > 0)
- { display.blinker = setInterval(function () {
- if (!cm.hasFocus()) { onBlur(cm); }
- display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden";
- }, cm.options.cursorBlinkRate); }
- else if (cm.options.cursorBlinkRate < 0)
- { display.cursorDiv.style.visibility = "hidden"; }
- }
- function ensureFocus(cm) {
- if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
- }
- function delayBlurEvent(cm) {
- cm.state.delayingBlurEvent = true;
- setTimeout(function () { if (cm.state.delayingBlurEvent) {
- cm.state.delayingBlurEvent = false;
- onBlur(cm);
- } }, 100);
- }
- function onFocus(cm, e) {
- if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
- if (cm.options.readOnly == "nocursor") { return }
- if (!cm.state.focused) {
- signal(cm, "focus", cm, e);
- cm.state.focused = true;
- addClass(cm.display.wrapper, "CodeMirror-focused");
- // This test prevents this from firing when a context
- // menu is closed (since the input reset would kill the
- // select-all detection hack)
- if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
- cm.display.input.reset();
- if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
- }
- cm.display.input.receivedFocus();
- }
- restartBlink(cm);
- }
- function onBlur(cm, e) {
- if (cm.state.delayingBlurEvent) { return }
- if (cm.state.focused) {
- signal(cm, "blur", cm, e);
- cm.state.focused = false;
- rmClass(cm.display.wrapper, "CodeMirror-focused");
- }
- clearInterval(cm.display.blinker);
- setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
- }
- // Read the actual heights of the rendered lines, and update their
- // stored heights to match.
- function updateHeightsInViewport(cm) {
- var display = cm.display;
- var prevBottom = display.lineDiv.offsetTop;
- for (var i = 0; i < display.view.length; i++) {
- var cur = display.view[i], wrapping = cm.options.lineWrapping;
- var height = (void 0), width = 0;
- if (cur.hidden) { continue }
- if (ie && ie_version < 8) {
- var bot = cur.node.offsetTop + cur.node.offsetHeight;
- height = bot - prevBottom;
- prevBottom = bot;
- } else {
- var box = cur.node.getBoundingClientRect();
- height = box.bottom - box.top;
- // Check that lines don't extend past the right of the current
- // editor width
- if (!wrapping && cur.text.firstChild)
- { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
- }
- var diff = cur.line.height - height;
- if (diff > .005 || diff < -.005) {
- updateLineHeight(cur.line, height);
- updateWidgetHeight(cur.line);
- if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
- { updateWidgetHeight(cur.rest[j]); } }
- }
- if (width > cm.display.sizerWidth) {
- var chWidth = Math.ceil(width / charWidth(cm.display));
- if (chWidth > cm.display.maxLineLength) {
- cm.display.maxLineLength = chWidth;
- cm.display.maxLine = cur.line;
- cm.display.maxLineChanged = true;
- }
- }
- }
- }
- // Read and store the height of line widgets associated with the
- // given line.
- function updateWidgetHeight(line) {
- if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
- var w = line.widgets[i], parent = w.node.parentNode;
- if (parent) { w.height = parent.offsetHeight; }
- } }
- }
- // Compute the lines that are visible in a given viewport (defaults
- // the the current scroll position). viewport may contain top,
- // height, and ensure (see op.scrollToPos) properties.
- function visibleLines(display, doc, viewport) {
- var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
- top = Math.floor(top - paddingTop(display));
- var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
- var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
- // Ensure is a {from: {line, ch}, to: {line, ch}} object, and
- // forces those lines into the viewport (if possible).
- if (viewport && viewport.ensure) {
- var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
- if (ensureFrom < from) {
- from = ensureFrom;
- to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
- } else if (Math.min(ensureTo, doc.lastLine()) >= to) {
- from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
- to = ensureTo;
- }
- }
- return {from: from, to: Math.max(to, from + 1)}
- }
- // SCROLLING THINGS INTO VIEW
- // If an editor sits on the top or bottom of the window, partially
- // scrolled out of view, this ensures that the cursor is visible.
- function maybeScrollWindow(cm, rect) {
- if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
- var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
- if (rect.top + box.top < 0) { doScroll = true; }
- else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
- if (doScroll != null && !phantom) {
- var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
- cm.display.lineSpace.appendChild(scrollNode);
- scrollNode.scrollIntoView(doScroll);
- cm.display.lineSpace.removeChild(scrollNode);
- }
- }
- // Scroll a given position into view (immediately), verifying that
- // it actually became visible (as line heights are accurately
- // measured, the position of something may 'drift' during drawing).
- function scrollPosIntoView(cm, pos, end, margin) {
- if (margin == null) { margin = 0; }
- var rect;
- if (!cm.options.lineWrapping && pos == end) {
- // Set pos and end to the cursor positions around the character pos sticks to
- // If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
- // If pos == Pos(_, 0, "before"), pos and end are unchanged
- pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
- end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
- }
- for (var limit = 0; limit < 5; limit++) {
- var changed = false;
- var coords = cursorCoords(cm, pos);
- var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
- rect = {left: Math.min(coords.left, endCoords.left),
- top: Math.min(coords.top, endCoords.top) - margin,
- right: Math.max(coords.left, endCoords.left),
- bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
- var scrollPos = calculateScrollPos(cm, rect);
- var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
- if (scrollPos.scrollTop != null) {
- updateScrollTop(cm, scrollPos.scrollTop);
- if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
- }
- if (scrollPos.scrollLeft != null) {
- setScrollLeft(cm, scrollPos.scrollLeft);
- if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
- }
- if (!changed) { break }
- }
- return rect
- }
- // Scroll a given set of coordinates into view (immediately).
- function scrollIntoView(cm, rect) {
- var scrollPos = calculateScrollPos(cm, rect);
- if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
- if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
- }
- // Calculate a new scroll position needed to scroll the given
- // rectangle into view. Returns an object with scrollTop and
- // scrollLeft properties. When these are undefined, the
- // vertical/horizontal position does not need to be adjusted.
- function calculateScrollPos(cm, rect) {
- var display = cm.display, snapMargin = textHeight(cm.display);
- if (rect.top < 0) { rect.top = 0; }
- var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
- var screen = displayHeight(cm), result = {};
- if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
- var docBottom = cm.doc.height + paddingVert(display);
- var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
- if (rect.top < screentop) {
- result.scrollTop = atTop ? 0 : rect.top;
- } else if (rect.bottom > screentop + screen) {
- var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
- if (newTop != screentop) { result.scrollTop = newTop; }
- }
- var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;
- var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;
- var screenw = displayWidth(cm) - display.gutters.offsetWidth;
- var tooWide = rect.right - rect.left > screenw;
- if (tooWide) { rect.right = rect.left + screenw; }
- if (rect.left < 10)
- { result.scrollLeft = 0; }
- else if (rect.left < screenleft)
- { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }
- else if (rect.right > screenw + screenleft - 3)
- { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
- return result
- }
- // Store a relative adjustment to the scroll position in the current
- // operation (to be applied when the operation finishes).
- function addToScrollTop(cm, top) {
- if (top == null) { return }
- resolveScrollToPos(cm);
- cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
- }
- // Make sure that at the end of the operation the current cursor is
- // shown.
- function ensureCursorVisible(cm) {
- resolveScrollToPos(cm);
- var cur = cm.getCursor();
- cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
- }
- function scrollToCoords(cm, x, y) {
- if (x != null || y != null) { resolveScrollToPos(cm); }
- if (x != null) { cm.curOp.scrollLeft = x; }
- if (y != null) { cm.curOp.scrollTop = y; }
- }
- function scrollToRange(cm, range) {
- resolveScrollToPos(cm);
- cm.curOp.scrollToPos = range;
- }
- // When an operation has its scrollToPos property set, and another
- // scroll action is applied before the end of the operation, this
- // 'simulates' scrolling that position into view in a cheap way, so
- // that the effect of intermediate scroll commands is not ignored.
- function resolveScrollToPos(cm) {
- var range = cm.curOp.scrollToPos;
- if (range) {
- cm.curOp.scrollToPos = null;
- var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);
- scrollToCoordsRange(cm, from, to, range.margin);
- }
- }
- function scrollToCoordsRange(cm, from, to, margin) {
- var sPos = calculateScrollPos(cm, {
- left: Math.min(from.left, to.left),
- top: Math.min(from.top, to.top) - margin,
- right: Math.max(from.right, to.right),
- bottom: Math.max(from.bottom, to.bottom) + margin
- });
- scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
- }
- // Sync the scrollable area and scrollbars, ensure the viewport
- // covers the visible area.
- function updateScrollTop(cm, val) {
- if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
- if (!gecko) { updateDisplaySimple(cm, {top: val}); }
- setScrollTop(cm, val, true);
- if (gecko) { updateDisplaySimple(cm); }
- startWorker(cm, 100);
- }
- function setScrollTop(cm, val, forceScroll) {
- val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));
- if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
- cm.doc.scrollTop = val;
- cm.display.scrollbars.setScrollTop(val);
- if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
- }
- // Sync scroller and scrollbar, ensure the gutter elements are
- // aligned.
- function setScrollLeft(cm, val, isScroller, forceScroll) {
- val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));
- if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
- cm.doc.scrollLeft = val;
- alignHorizontally(cm);
- if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
- cm.display.scrollbars.setScrollLeft(val);
- }
- // SCROLLBARS
- // Prepare DOM reads needed to update the scrollbars. Done in one
- // shot to minimize update/measure roundtrips.
- function measureForScrollbars(cm) {
- var d = cm.display, gutterW = d.gutters.offsetWidth;
- var docH = Math.round(cm.doc.height + paddingVert(cm.display));
- return {
- clientHeight: d.scroller.clientHeight,
- viewHeight: d.wrapper.clientHeight,
- scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
- viewWidth: d.wrapper.clientWidth,
- barLeft: cm.options.fixedGutter ? gutterW : 0,
- docHeight: docH,
- scrollHeight: docH + scrollGap(cm) + d.barHeight,
- nativeBarWidth: d.nativeBarWidth,
- gutterWidth: gutterW
- }
- }
- var NativeScrollbars = function(place, scroll, cm) {
- this.cm = cm;
- var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
- var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
- vert.tabIndex = horiz.tabIndex = -1;
- place(vert); place(horiz);
- on(vert, "scroll", function () {
- if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
- });
- on(horiz, "scroll", function () {
- if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
- });
- this.checkedZeroWidth = false;
- // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
- if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
- };
- NativeScrollbars.prototype.update = function (measure) {
- var needsH = measure.scrollWidth > measure.clientWidth + 1;
- var needsV = measure.scrollHeight > measure.clientHeight + 1;
- var sWidth = measure.nativeBarWidth;
- if (needsV) {
- this.vert.style.display = "block";
- this.vert.style.bottom = needsH ? sWidth + "px" : "0";
- var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
- // A bug in IE8 can cause this value to be negative, so guard it.
- this.vert.firstChild.style.height =
- Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
- } else {
- this.vert.style.display = "";
- this.vert.firstChild.style.height = "0";
- }
- if (needsH) {
- this.horiz.style.display = "block";
- this.horiz.style.right = needsV ? sWidth + "px" : "0";
- this.horiz.style.left = measure.barLeft + "px";
- var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
- this.horiz.firstChild.style.width =
- Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
- } else {
- this.horiz.style.display = "";
- this.horiz.firstChild.style.width = "0";
- }
- if (!this.checkedZeroWidth && measure.clientHeight > 0) {
- if (sWidth == 0) { this.zeroWidthHack(); }
- this.checkedZeroWidth = true;
- }
- return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
- };
- NativeScrollbars.prototype.setScrollLeft = function (pos) {
- if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
- if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
- };
- NativeScrollbars.prototype.setScrollTop = function (pos) {
- if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
- if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
- };
- NativeScrollbars.prototype.zeroWidthHack = function () {
- var w = mac && !mac_geMountainLion ? "12px" : "18px";
- this.horiz.style.height = this.vert.style.width = w;
- this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
- this.disableHoriz = new Delayed;
- this.disableVert = new Delayed;
- };
- NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
- bar.style.pointerEvents = "auto";
- function maybeDisable() {
- // To find out whether the scrollbar is still visible, we
- // check whether the element under the pixel in the bottom
- // right corner of the scrollbar box is the scrollbar box
- // itself (when the bar is still visible) or its filler child
- // (when the bar is hidden). If it is still visible, we keep
- // it enabled, if it's hidden, we disable pointer events.
- var box = bar.getBoundingClientRect();
- var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
- : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
- if (elt != bar) { bar.style.pointerEvents = "none"; }
- else { delay.set(1000, maybeDisable); }
- }
- delay.set(1000, maybeDisable);
- };
- NativeScrollbars.prototype.clear = function () {
- var parent = this.horiz.parentNode;
- parent.removeChild(this.horiz);
- parent.removeChild(this.vert);
- };
- var NullScrollbars = function () {};
- NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
- NullScrollbars.prototype.setScrollLeft = function () {};
- NullScrollbars.prototype.setScrollTop = function () {};
- NullScrollbars.prototype.clear = function () {};
- function updateScrollbars(cm, measure) {
- if (!measure) { measure = measureForScrollbars(cm); }
- var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
- updateScrollbarsInner(cm, measure);
- for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
- if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
- { updateHeightsInViewport(cm); }
- updateScrollbarsInner(cm, measureForScrollbars(cm));
- startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
- }
- }
- // Re-synchronize the fake scrollbars with the actual size of the
- // content.
- function updateScrollbarsInner(cm, measure) {
- var d = cm.display;
- var sizes = d.scrollbars.update(measure);
- d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
- d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
- d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
- if (sizes.right && sizes.bottom) {
- d.scrollbarFiller.style.display = "block";
- d.scrollbarFiller.style.height = sizes.bottom + "px";
- d.scrollbarFiller.style.width = sizes.right + "px";
- } else { d.scrollbarFiller.style.display = ""; }
- if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
- d.gutterFiller.style.display = "block";
- d.gutterFiller.style.height = sizes.bottom + "px";
- d.gutterFiller.style.width = measure.gutterWidth + "px";
- } else { d.gutterFiller.style.display = ""; }
- }
- var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
- function initScrollbars(cm) {
- if (cm.display.scrollbars) {
- cm.display.scrollbars.clear();
- if (cm.display.scrollbars.addClass)
- { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
- }
- cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
- cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
- // Prevent clicks in the scrollbars from killing focus
- on(node, "mousedown", function () {
- if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
- });
- node.setAttribute("cm-not-content", "true");
- }, function (pos, axis) {
- if (axis == "horizontal") { setScrollLeft(cm, pos); }
- else { updateScrollTop(cm, pos); }
- }, cm);
- if (cm.display.scrollbars.addClass)
- { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
- }
- // Operations are used to wrap a series of changes to the editor
- // state in such a way that each change won't have to update the
- // cursor and display (which would be awkward, slow, and
- // error-prone). Instead, display updates are batched and then all
- // combined and executed at once.
- var nextOpId = 0;
- // Start a new operation.
- function startOperation(cm) {
- cm.curOp = {
- cm: cm,
- viewChanged: false, // Flag that indicates that lines might need to be redrawn
- startHeight: cm.doc.height, // Used to detect need to update scrollbar
- forceUpdate: false, // Used to force a redraw
- updateInput: 0, // Whether to reset the input textarea
- typing: false, // Whether this reset should be careful to leave existing text (for compositing)
- changeObjs: null, // Accumulated changes, for firing change events
- cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
- cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
- selectionChanged: false, // Whether the selection needs to be redrawn
- updateMaxLine: false, // Set when the widest line needs to be determined anew
- scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
- scrollToPos: null, // Used to scroll to a specific position
- focus: false,
- id: ++nextOpId // Unique ID
- };
- pushOperation(cm.curOp);
- }
- // Finish an operation, updating the display and signalling delayed events
- function endOperation(cm) {
- var op = cm.curOp;
- if (op) { finishOperation(op, function (group) {
- for (var i = 0; i < group.ops.length; i++)
- { group.ops[i].cm.curOp = null; }
- endOperations(group);
- }); }
- }
- // The DOM updates done when an operation finishes are batched so
- // that the minimum number of relayouts are required.
- function endOperations(group) {
- var ops = group.ops;
- for (var i = 0; i < ops.length; i++) // Read DOM
- { endOperation_R1(ops[i]); }
- for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
- { endOperation_W1(ops[i$1]); }
- for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
- { endOperation_R2(ops[i$2]); }
- for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
- { endOperation_W2(ops[i$3]); }
- for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
- { endOperation_finish(ops[i$4]); }
- }
- function endOperation_R1(op) {
- var cm = op.cm, display = cm.display;
- maybeClipScrollbars(cm);
- if (op.updateMaxLine) { findMaxLine(cm); }
- op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
- op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
- op.scrollToPos.to.line >= display.viewTo) ||
- display.maxLineChanged && cm.options.lineWrapping;
- op.update = op.mustUpdate &&
- new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
- }
- function endOperation_W1(op) {
- op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
- }
- function endOperation_R2(op) {
- var cm = op.cm, display = cm.display;
- if (op.updatedDisplay) { updateHeightsInViewport(cm); }
- op.barMeasure = measureForScrollbars(cm);
- // If the max line changed since it was last measured, measure it,
- // and ensure the document's width matches it.
- // updateDisplay_W2 will use these properties to do the actual resizing
- if (display.maxLineChanged && !cm.options.lineWrapping) {
- op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
- cm.display.sizerWidth = op.adjustWidthTo;
- op.barMeasure.scrollWidth =
- Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
- op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
- }
- if (op.updatedDisplay || op.selectionChanged)
- { op.preparedSelection = display.input.prepareSelection(); }
- }
- function endOperation_W2(op) {
- var cm = op.cm;
- if (op.adjustWidthTo != null) {
- cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
- if (op.maxScrollLeft < cm.doc.scrollLeft)
- { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
- cm.display.maxLineChanged = false;
- }
- var takeFocus = op.focus && op.focus == activeElt();
- if (op.preparedSelection)
- { cm.display.input.showSelection(op.preparedSelection, takeFocus); }
- if (op.updatedDisplay || op.startHeight != cm.doc.height)
- { updateScrollbars(cm, op.barMeasure); }
- if (op.updatedDisplay)
- { setDocumentHeight(cm, op.barMeasure); }
- if (op.selectionChanged) { restartBlink(cm); }
- if (cm.state.focused && op.updateInput)
- { cm.display.input.reset(op.typing); }
- if (takeFocus) { ensureFocus(op.cm); }
- }
- function endOperation_finish(op) {
- var cm = op.cm, display = cm.display, doc = cm.doc;
- if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
- // Abort mouse wheel delta measurement, when scrolling explicitly
- if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
- { display.wheelStartX = display.wheelStartY = null; }
- // Propagate the scroll position to the actual DOM scroller
- if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
- if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
- // If we need to scroll a specific position into view, do so.
- if (op.scrollToPos) {
- var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
- clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
- maybeScrollWindow(cm, rect);
- }
- // Fire events for markers that are hidden/unidden by editing or
- // undoing
- var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
- if (hidden) { for (var i = 0; i < hidden.length; ++i)
- { if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
- if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
- { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
- if (display.wrapper.offsetHeight)
- { doc.scrollTop = cm.display.scroller.scrollTop; }
- // Fire change events, and delayed event handlers
- if (op.changeObjs)
- { signal(cm, "changes", cm, op.changeObjs); }
- if (op.update)
- { op.update.finish(); }
- }
- // Run the given function in an operation
- function runInOp(cm, f) {
- if (cm.curOp) { return f() }
- startOperation(cm);
- try { return f() }
- finally { endOperation(cm); }
- }
- // Wraps a function in an operation. Returns the wrapped function.
- function operation(cm, f) {
- return function() {
- if (cm.curOp) { return f.apply(cm, arguments) }
- startOperation(cm);
- try { return f.apply(cm, arguments) }
- finally { endOperation(cm); }
- }
- }
- // Used to add methods to editor and doc instances, wrapping them in
- // operations.
- function methodOp(f) {
- return function() {
- if (this.curOp) { return f.apply(this, arguments) }
- startOperation(this);
- try { return f.apply(this, arguments) }
- finally { endOperation(this); }
- }
- }
- function docMethodOp(f) {
- return function() {
- var cm = this.cm;
- if (!cm || cm.curOp) { return f.apply(this, arguments) }
- startOperation(cm);
- try { return f.apply(this, arguments) }
- finally { endOperation(cm); }
- }
- }
- // HIGHLIGHT WORKER
- function startWorker(cm, time) {
- if (cm.doc.highlightFrontier < cm.display.viewTo)
- { cm.state.highlight.set(time, bind(highlightWorker, cm)); }
- }
- function highlightWorker(cm) {
- var doc = cm.doc;
- if (doc.highlightFrontier >= cm.display.viewTo) { return }
- var end = +new Date + cm.options.workTime;
- var context = getContextBefore(cm, doc.highlightFrontier);
- var changedLines = [];
- doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
- if (context.line >= cm.display.viewFrom) { // Visible
- var oldStyles = line.styles;
- var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
- var highlighted = highlightLine(cm, line, context, true);
- if (resetState) { context.state = resetState; }
- line.styles = highlighted.styles;
- var oldCls = line.styleClasses, newCls = highlighted.classes;
- if (newCls) { line.styleClasses = newCls; }
- else if (oldCls) { line.styleClasses = null; }
- var ischange = !oldStyles || oldStyles.length != line.styles.length ||
- oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
- for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
- if (ischange) { changedLines.push(context.line); }
- line.stateAfter = context.save();
- context.nextLine();
- } else {
- if (line.text.length <= cm.options.maxHighlightLength)
- { processLine(cm, line.text, context); }
- line.stateAfter = context.line % 5 == 0 ? context.save() : null;
- context.nextLine();
- }
- if (+new Date > end) {
- startWorker(cm, cm.options.workDelay);
- return true
- }
- });
- doc.highlightFrontier = context.line;
- doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
- if (changedLines.length) { runInOp(cm, function () {
- for (var i = 0; i < changedLines.length; i++)
- { regLineChange(cm, changedLines[i], "text"); }
- }); }
- }
- // DISPLAY DRAWING
- var DisplayUpdate = function(cm, viewport, force) {
- var display = cm.display;
- this.viewport = viewport;
- // Store some values that we'll need later (but don't want to force a relayout for)
- this.visible = visibleLines(display, cm.doc, viewport);
- this.editorIsHidden = !display.wrapper.offsetWidth;
- this.wrapperHeight = display.wrapper.clientHeight;
- this.wrapperWidth = display.wrapper.clientWidth;
- this.oldDisplayWidth = displayWidth(cm);
- this.force = force;
- this.dims = getDimensions(cm);
- this.events = [];
- };
- DisplayUpdate.prototype.signal = function (emitter, type) {
- if (hasHandler(emitter, type))
- { this.events.push(arguments); }
- };
- DisplayUpdate.prototype.finish = function () {
- for (var i = 0; i < this.events.length; i++)
- { signal.apply(null, this.events[i]); }
- };
- function maybeClipScrollbars(cm) {
- var display = cm.display;
- if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
- display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
- display.heightForcer.style.height = scrollGap(cm) + "px";
- display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
- display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
- display.scrollbarsClipped = true;
- }
- }
- function selectionSnapshot(cm) {
- if (cm.hasFocus()) { return null }
- var active = activeElt();
- if (!active || !contains(cm.display.lineDiv, active)) { return null }
- var result = {activeElt: active};
- if (window.getSelection) {
- var sel = window.getSelection();
- if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
- result.anchorNode = sel.anchorNode;
- result.anchorOffset = sel.anchorOffset;
- result.focusNode = sel.focusNode;
- result.focusOffset = sel.focusOffset;
- }
- }
- return result
- }
- function restoreSelection(snapshot) {
- if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
- snapshot.activeElt.focus();
- if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&
- snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
- var sel = window.getSelection(), range = document.createRange();
- range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
- range.collapse(false);
- sel.removeAllRanges();
- sel.addRange(range);
- sel.extend(snapshot.focusNode, snapshot.focusOffset);
- }
- }
- // Does the actual updating of the line display. Bails out
- // (returning false) when there is nothing to be done and forced is
- // false.
- function updateDisplayIfNeeded(cm, update) {
- var display = cm.display, doc = cm.doc;
- if (update.editorIsHidden) {
- resetView(cm);
- return false
- }
- // Bail out if the visible area is already rendered and nothing changed.
- if (!update.force &&
- update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
- (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
- display.renderedView == display.view && countDirtyView(cm) == 0)
- { return false }
- if (maybeUpdateLineNumberWidth(cm)) {
- resetView(cm);
- update.dims = getDimensions(cm);
- }
- // Compute a suitable new viewport (from & to)
- var end = doc.first + doc.size;
- var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
- var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
- if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
- if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
- if (sawCollapsedSpans) {
- from = visualLineNo(cm.doc, from);
- to = visualLineEndNo(cm.doc, to);
- }
- var different = from != display.viewFrom || to != display.viewTo ||
- display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
- adjustView(cm, from, to);
- display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
- // Position the mover div to align with the current scroll position
- cm.display.mover.style.top = display.viewOffset + "px";
- var toUpdate = countDirtyView(cm);
- if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
- (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
- { return false }
- // For big changes, we hide the enclosing element during the
- // update, since that speeds up the operations on most browsers.
- var selSnapshot = selectionSnapshot(cm);
- if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
- patchDisplay(cm, display.updateLineNumbers, update.dims);
- if (toUpdate > 4) { display.lineDiv.style.display = ""; }
- display.renderedView = display.view;
- // There might have been a widget with a focused element that got
- // hidden or updated, if so re-focus it.
- restoreSelection(selSnapshot);
- // Prevent selection and cursors from interfering with the scroll
- // width and height.
- removeChildren(display.cursorDiv);
- removeChildren(display.selectionDiv);
- display.gutters.style.height = display.sizer.style.minHeight = 0;
- if (different) {
- display.lastWrapHeight = update.wrapperHeight;
- display.lastWrapWidth = update.wrapperWidth;
- startWorker(cm, 400);
- }
- display.updateLineNumbers = null;
- return true
- }
- function postUpdateDisplay(cm, update) {
- var viewport = update.viewport;
- for (var first = true;; first = false) {
- if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
- // Clip forced viewport to actual scrollable area.
- if (viewport && viewport.top != null)
- { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
- // Updated line heights might result in the drawn area not
- // actually covering the viewport. Keep looping until it does.
- update.visible = visibleLines(cm.display, cm.doc, viewport);
- if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
- { break }
- } else if (first) {
- update.visible = visibleLines(cm.display, cm.doc, viewport);
- }
- if (!updateDisplayIfNeeded(cm, update)) { break }
- updateHeightsInViewport(cm);
- var barMeasure = measureForScrollbars(cm);
- updateSelection(cm);
- updateScrollbars(cm, barMeasure);
- setDocumentHeight(cm, barMeasure);
- update.force = false;
- }
- update.signal(cm, "update", cm);
- if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
- update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
- cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
- }
- }
- function updateDisplaySimple(cm, viewport) {
- var update = new DisplayUpdate(cm, viewport);
- if (updateDisplayIfNeeded(cm, update)) {
- updateHeightsInViewport(cm);
- postUpdateDisplay(cm, update);
- var barMeasure = measureForScrollbars(cm);
- updateSelection(cm);
- updateScrollbars(cm, barMeasure);
- setDocumentHeight(cm, barMeasure);
- update.finish();
- }
- }
- // Sync the actual display DOM structure with display.view, removing
- // nodes for lines that are no longer in view, and creating the ones
- // that are not there yet, and updating the ones that are out of
- // date.
- function patchDisplay(cm, updateNumbersFrom, dims) {
- var display = cm.display, lineNumbers = cm.options.lineNumbers;
- var container = display.lineDiv, cur = container.firstChild;
- function rm(node) {
- var next = node.nextSibling;
- // Works around a throw-scroll bug in OS X Webkit
- if (webkit && mac && cm.display.currentWheelTarget == node)
- { node.style.display = "none"; }
- else
- { node.parentNode.removeChild(node); }
- return next
- }
- var view = display.view, lineN = display.viewFrom;
- // Loop over the elements in the view, syncing cur (the DOM nodes
- // in display.lineDiv) with the view as we go.
- for (var i = 0; i < view.length; i++) {
- var lineView = view[i];
- if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
- var node = buildLineElement(cm, lineView, lineN, dims);
- container.insertBefore(node, cur);
- } else { // Already drawn
- while (cur != lineView.node) { cur = rm(cur); }
- var updateNumber = lineNumbers && updateNumbersFrom != null &&
- updateNumbersFrom <= lineN && lineView.lineNumber;
- if (lineView.changes) {
- if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
- updateLineForChanges(cm, lineView, lineN, dims);
- }
- if (updateNumber) {
- removeChildren(lineView.lineNumber);
- lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
- }
- cur = lineView.node.nextSibling;
- }
- lineN += lineView.size;
- }
- while (cur) { cur = rm(cur); }
- }
- function updateGutterSpace(display) {
- var width = display.gutters.offsetWidth;
- display.sizer.style.marginLeft = width + "px";
- }
- function setDocumentHeight(cm, measure) {
- cm.display.sizer.style.minHeight = measure.docHeight + "px";
- cm.display.heightForcer.style.top = measure.docHeight + "px";
- cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
- }
- // Re-align line numbers and gutter marks to compensate for
- // horizontal scrolling.
- function alignHorizontally(cm) {
- var display = cm.display, view = display.view;
- if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
- var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
- var gutterW = display.gutters.offsetWidth, left = comp + "px";
- for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
- if (cm.options.fixedGutter) {
- if (view[i].gutter)
- { view[i].gutter.style.left = left; }
- if (view[i].gutterBackground)
- { view[i].gutterBackground.style.left = left; }
- }
- var align = view[i].alignable;
- if (align) { for (var j = 0; j < align.length; j++)
- { align[j].style.left = left; } }
- } }
- if (cm.options.fixedGutter)
- { display.gutters.style.left = (comp + gutterW) + "px"; }
- }
- // Used to ensure that the line number gutter is still the right
- // size for the current document size. Returns true when an update
- // is needed.
- function maybeUpdateLineNumberWidth(cm) {
- if (!cm.options.lineNumbers) { return false }
- var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
- if (last.length != display.lineNumChars) {
- var test = display.measure.appendChild(elt("div", [elt("div", last)],
- "CodeMirror-linenumber CodeMirror-gutter-elt"));
- var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
- display.lineGutter.style.width = "";
- display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
- display.lineNumWidth = display.lineNumInnerWidth + padding;
- display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
- display.lineGutter.style.width = display.lineNumWidth + "px";
- updateGutterSpace(cm.display);
- return true
- }
- return false
- }
- function getGutters(gutters, lineNumbers) {
- var result = [], sawLineNumbers = false;
- for (var i = 0; i < gutters.length; i++) {
- var name = gutters[i], style = null;
- if (typeof name != "string") { style = name.style; name = name.className; }
- if (name == "CodeMirror-linenumbers") {
- if (!lineNumbers) { continue }
- else { sawLineNumbers = true; }
- }
- result.push({className: name, style: style});
- }
- if (lineNumbers && !sawLineNumbers) { result.push({className: "CodeMirror-linenumbers", style: null}); }
- return result
- }
- // Rebuild the gutter elements, ensure the margin to the left of the
- // code matches their width.
- function renderGutters(display) {
- var gutters = display.gutters, specs = display.gutterSpecs;
- removeChildren(gutters);
- display.lineGutter = null;
- for (var i = 0; i < specs.length; ++i) {
- var ref = specs[i];
- var className = ref.className;
- var style = ref.style;
- var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + className));
- if (style) { gElt.style.cssText = style; }
- if (className == "CodeMirror-linenumbers") {
- display.lineGutter = gElt;
- gElt.style.width = (display.lineNumWidth || 1) + "px";
- }
- }
- gutters.style.display = specs.length ? "" : "none";
- updateGutterSpace(display);
- }
- function updateGutters(cm) {
- renderGutters(cm.display);
- regChange(cm);
- alignHorizontally(cm);
- }
- // The display handles the DOM integration, both for input reading
- // and content drawing. It holds references to DOM nodes and
- // display-related state.
- function Display(place, doc, input, options) {
- var d = this;
- this.input = input;
- // Covers bottom-right square when both scrollbars are present.
- d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
- d.scrollbarFiller.setAttribute("cm-not-content", "true");
- // Covers bottom of gutter when coverGutterNextToScrollbar is on
- // and h scrollbar is present.
- d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
- d.gutterFiller.setAttribute("cm-not-content", "true");
- // Will contain the actual code, positioned to cover the viewport.
- d.lineDiv = eltP("div", null, "CodeMirror-code");
- // Elements are added to these to represent selection and cursors.
- d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
- d.cursorDiv = elt("div", null, "CodeMirror-cursors");
- // A visibility: hidden element used to find the size of things.
- d.measure = elt("div", null, "CodeMirror-measure");
- // When lines outside of the viewport are measured, they are drawn in this.
- d.lineMeasure = elt("div", null, "CodeMirror-measure");
- // Wraps everything that needs to exist inside the vertically-padded coordinate system
- d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
- null, "position: relative; outline: none");
- var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
- // Moved around its parent to cover visible view.
- d.mover = elt("div", [lines], null, "position: relative");
- // Set to the height of the document, allowing scrolling.
- d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
- d.sizerWidth = null;
- // Behavior of elts with overflow: auto and padding is
- // inconsistent across browsers. This is used to ensure the
- // scrollable area is big enough.
- d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
- // Will contain the gutters, if any.
- d.gutters = elt("div", null, "CodeMirror-gutters");
- d.lineGutter = null;
- // Actual scrollable element.
- d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
- d.scroller.setAttribute("tabIndex", "-1");
- // The element in which the editor lives.
- d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
- // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
- if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
- if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
- if (place) {
- if (place.appendChild) { place.appendChild(d.wrapper); }
- else { place(d.wrapper); }
- }
- // Current rendered range (may be bigger than the view window).
- d.viewFrom = d.viewTo = doc.first;
- d.reportedViewFrom = d.reportedViewTo = doc.first;
- // Information about the rendered lines.
- d.view = [];
- d.renderedView = null;
- // Holds info about a single rendered line when it was rendered
- // for measurement, while not in view.
- d.externalMeasured = null;
- // Empty space (in pixels) above the view
- d.viewOffset = 0;
- d.lastWrapHeight = d.lastWrapWidth = 0;
- d.updateLineNumbers = null;
- d.nativeBarWidth = d.barHeight = d.barWidth = 0;
- d.scrollbarsClipped = false;
- // Used to only resize the line number gutter when necessary (when
- // the amount of lines crosses a boundary that makes its width change)
- d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
- // Set to true when a non-horizontal-scrolling line widget is
- // added. As an optimization, line widget aligning is skipped when
- // this is false.
- d.alignWidgets = false;
- d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
- // Tracks the maximum line length so that the horizontal scrollbar
- // can be kept static when scrolling.
- d.maxLine = null;
- d.maxLineLength = 0;
- d.maxLineChanged = false;
- // Used for measuring wheel scrolling granularity
- d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
- // True when shift is held down.
- d.shift = false;
- // Used to track whether anything happened since the context menu
- // was opened.
- d.selForContextMenu = null;
- d.activeTouch = null;
- d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);
- renderGutters(d);
- input.init(d);
- }
- // Since the delta values reported on mouse wheel events are
- // unstandardized between browsers and even browser versions, and
- // generally horribly unpredictable, this code starts by measuring
- // the scroll effect that the first few mouse wheel events have,
- // and, from that, detects the way it can convert deltas to pixel
- // offsets afterwards.
- //
- // The reason we want to know the amount a wheel event will scroll
- // is that it gives us a chance to update the display before the
- // actual scrolling happens, reducing flickering.
- var wheelSamples = 0, wheelPixelsPerUnit = null;
- // Fill in a browser-detected starting value on browsers where we
- // know one. These don't have to be accurate -- the result of them
- // being wrong would just be a slight flicker on the first wheel
- // scroll (if it is large enough).
- if (ie) { wheelPixelsPerUnit = -.53; }
- else if (gecko) { wheelPixelsPerUnit = 15; }
- else if (chrome) { wheelPixelsPerUnit = -.7; }
- else if (safari) { wheelPixelsPerUnit = -1/3; }
- function wheelEventDelta(e) {
- var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
- if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
- if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
- else if (dy == null) { dy = e.wheelDelta; }
- return {x: dx, y: dy}
- }
- function wheelEventPixels(e) {
- var delta = wheelEventDelta(e);
- delta.x *= wheelPixelsPerUnit;
- delta.y *= wheelPixelsPerUnit;
- return delta
- }
- function onScrollWheel(cm, e) {
- var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
- var display = cm.display, scroll = display.scroller;
- // Quit if there's nothing to scroll here
- var canScrollX = scroll.scrollWidth > scroll.clientWidth;
- var canScrollY = scroll.scrollHeight > scroll.clientHeight;
- if (!(dx && canScrollX || dy && canScrollY)) { return }
- // Webkit browsers on OS X abort momentum scrolls when the target
- // of the scroll event is removed from the scrollable element.
- // This hack (see related code in patchDisplay) makes sure the
- // element is kept around.
- if (dy && mac && webkit) {
- outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
- for (var i = 0; i < view.length; i++) {
- if (view[i].node == cur) {
- cm.display.currentWheelTarget = cur;
- break outer
- }
- }
- }
- }
- // On some browsers, horizontal scrolling will cause redraws to
- // happen before the gutter has been realigned, causing it to
- // wriggle around in a most unseemly way. When we have an
- // estimated pixels/delta value, we just handle horizontal
- // scrolling entirely here. It'll be slightly off from native, but
- // better than glitching out.
- if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
- if (dy && canScrollY)
- { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
- setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
- // Only prevent default scrolling if vertical scrolling is
- // actually possible. Otherwise, it causes vertical scroll
- // jitter on OSX trackpads when deltaX is small and deltaY
- // is large (issue #3579)
- if (!dy || (dy && canScrollY))
- { e_preventDefault(e); }
- display.wheelStartX = null; // Abort measurement, if in progress
- return
- }
- // 'Project' the visible viewport to cover the area that is being
- // scrolled into view (if we know enough to estimate it).
- if (dy && wheelPixelsPerUnit != null) {
- var pixels = dy * wheelPixelsPerUnit;
- var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
- if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
- else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
- updateDisplaySimple(cm, {top: top, bottom: bot});
- }
- if (wheelSamples < 20) {
- if (display.wheelStartX == null) {
- display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
- display.wheelDX = dx; display.wheelDY = dy;
- setTimeout(function () {
- if (display.wheelStartX == null) { return }
- var movedX = scroll.scrollLeft - display.wheelStartX;
- var movedY = scroll.scrollTop - display.wheelStartY;
- var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
- (movedX && display.wheelDX && movedX / display.wheelDX);
- display.wheelStartX = display.wheelStartY = null;
- if (!sample) { return }
- wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
- ++wheelSamples;
- }, 200);
- } else {
- display.wheelDX += dx; display.wheelDY += dy;
- }
- }
- }
- // Selection objects are immutable. A new one is created every time
- // the selection changes. A selection is one or more non-overlapping
- // (and non-touching) ranges, sorted, and an integer that indicates
- // which one is the primary selection (the one that's scrolled into
- // view, that getCursor returns, etc).
- var Selection = function(ranges, primIndex) {
- this.ranges = ranges;
- this.primIndex = primIndex;
- };
- Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
- Selection.prototype.equals = function (other) {
- if (other == this) { return true }
- if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
- for (var i = 0; i < this.ranges.length; i++) {
- var here = this.ranges[i], there = other.ranges[i];
- if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
- }
- return true
- };
- Selection.prototype.deepCopy = function () {
- var out = [];
- for (var i = 0; i < this.ranges.length; i++)
- { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }
- return new Selection(out, this.primIndex)
- };
- Selection.prototype.somethingSelected = function () {
- for (var i = 0; i < this.ranges.length; i++)
- { if (!this.ranges[i].empty()) { return true } }
- return false
- };
- Selection.prototype.contains = function (pos, end) {
- if (!end) { end = pos; }
- for (var i = 0; i < this.ranges.length; i++) {
- var range = this.ranges[i];
- if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
- { return i }
- }
- return -1
- };
- var Range = function(anchor, head) {
- this.anchor = anchor; this.head = head;
- };
- Range.prototype.from = function () { return minPos(this.anchor, this.head) };
- Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
- Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
- // Take an unsorted, potentially overlapping set of ranges, and
- // build a selection out of it. 'Consumes' ranges array (modifying
- // it).
- function normalizeSelection(cm, ranges, primIndex) {
- var mayTouch = cm && cm.options.selectionsMayTouch;
- var prim = ranges[primIndex];
- ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
- primIndex = indexOf(ranges, prim);
- for (var i = 1; i < ranges.length; i++) {
- var cur = ranges[i], prev = ranges[i - 1];
- var diff = cmp(prev.to(), cur.from());
- if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
- var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
- var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
- if (i <= primIndex) { --primIndex; }
- ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
- }
- }
- return new Selection(ranges, primIndex)
- }
- function simpleSelection(anchor, head) {
- return new Selection([new Range(anchor, head || anchor)], 0)
- }
- // Compute the position of the end of a change (its 'to' property
- // refers to the pre-change end).
- function changeEnd(change) {
- if (!change.text) { return change.to }
- return Pos(change.from.line + change.text.length - 1,
- lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
- }
- // Adjust a position to refer to the post-change position of the
- // same text, or the end of the change if the change covers it.
- function adjustForChange(pos, change) {
- if (cmp(pos, change.from) < 0) { return pos }
- if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
- var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
- if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
- return Pos(line, ch)
- }
- function computeSelAfterChange(doc, change) {
- var out = [];
- for (var i = 0; i < doc.sel.ranges.length; i++) {
- var range = doc.sel.ranges[i];
- out.push(new Range(adjustForChange(range.anchor, change),
- adjustForChange(range.head, change)));
- }
- return normalizeSelection(doc.cm, out, doc.sel.primIndex)
- }
- function offsetPos(pos, old, nw) {
- if (pos.line == old.line)
- { return Pos(nw.line, pos.ch - old.ch + nw.ch) }
- else
- { return Pos(nw.line + (pos.line - old.line), pos.ch) }
- }
- // Used by replaceSelections to allow moving the selection to the
- // start or around the replaced test. Hint may be "start" or "around".
- function computeReplacedSel(doc, changes, hint) {
- var out = [];
- var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
- for (var i = 0; i < changes.length; i++) {
- var change = changes[i];
- var from = offsetPos(change.from, oldPrev, newPrev);
- var to = offsetPos(changeEnd(change), oldPrev, newPrev);
- oldPrev = change.to;
- newPrev = to;
- if (hint == "around") {
- var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
- out[i] = new Range(inv ? to : from, inv ? from : to);
- } else {
- out[i] = new Range(from, from);
- }
- }
- return new Selection(out, doc.sel.primIndex)
- }
- // Used to get the editor into a consistent state again when options change.
- function loadMode(cm) {
- cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
- resetModeState(cm);
- }
- function resetModeState(cm) {
- cm.doc.iter(function (line) {
- if (line.stateAfter) { line.stateAfter = null; }
- if (line.styles) { line.styles = null; }
- });
- cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
- startWorker(cm, 100);
- cm.state.modeGen++;
- if (cm.curOp) { regChange(cm); }
- }
- // DOCUMENT DATA STRUCTURE
- // By default, updates that start and end at the beginning of a line
- // are treated specially, in order to make the association of line
- // widgets and marker elements with the text behave more intuitive.
- function isWholeLineUpdate(doc, change) {
- return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
- (!doc.cm || doc.cm.options.wholeLineUpdateBefore)
- }
- // Perform a change on the document data structure.
- function updateDoc(doc, change, markedSpans, estimateHeight) {
- function spansFor(n) {return markedSpans ? markedSpans[n] : null}
- function update(line, text, spans) {
- updateLine(line, text, spans, estimateHeight);
- signalLater(line, "change", line, change);
- }
- function linesFor(start, end) {
- var result = [];
- for (var i = start; i < end; ++i)
- { result.push(new Line(text[i], spansFor(i), estimateHeight)); }
- return result
- }
- var from = change.from, to = change.to, text = change.text;
- var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
- var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
- // Adjust the line structure
- if (change.full) {
- doc.insert(0, linesFor(0, text.length));
- doc.remove(text.length, doc.size - text.length);
- } else if (isWholeLineUpdate(doc, change)) {
- // This is a whole-line replace. Treated specially to make
- // sure line objects move the way they are supposed to.
- var added = linesFor(0, text.length - 1);
- update(lastLine, lastLine.text, lastSpans);
- if (nlines) { doc.remove(from.line, nlines); }
- if (added.length) { doc.insert(from.line, added); }
- } else if (firstLine == lastLine) {
- if (text.length == 1) {
- update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
- } else {
- var added$1 = linesFor(1, text.length - 1);
- added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));
- update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
- doc.insert(from.line + 1, added$1);
- }
- } else if (text.length == 1) {
- update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
- doc.remove(from.line + 1, nlines);
- } else {
- update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
- update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
- var added$2 = linesFor(1, text.length - 1);
- if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
- doc.insert(from.line + 1, added$2);
- }
- signalLater(doc, "change", doc, change);
- }
- // Call f for all linked documents.
- function linkedDocs(doc, f, sharedHistOnly) {
- function propagate(doc, skip, sharedHist) {
- if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
- var rel = doc.linked[i];
- if (rel.doc == skip) { continue }
- var shared = sharedHist && rel.sharedHist;
- if (sharedHistOnly && !shared) { continue }
- f(rel.doc, shared);
- propagate(rel.doc, doc, shared);
- } }
- }
- propagate(doc, null, true);
- }
- // Attach a document to an editor.
- function attachDoc(cm, doc) {
- if (doc.cm) { throw new Error("This document is already in use.") }
- cm.doc = doc;
- doc.cm = cm;
- estimateLineHeights(cm);
- loadMode(cm);
- setDirectionClass(cm);
- if (!cm.options.lineWrapping) { findMaxLine(cm); }
- cm.options.mode = doc.modeOption;
- regChange(cm);
- }
- function setDirectionClass(cm) {
- (cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
- }
- function directionChanged(cm) {
- runInOp(cm, function () {
- setDirectionClass(cm);
- regChange(cm);
- });
- }
- function History(startGen) {
- // Arrays of change events and selections. Doing something adds an
- // event to done and clears undo. Undoing moves events from done
- // to undone, redoing moves them in the other direction.
- this.done = []; this.undone = [];
- this.undoDepth = Infinity;
- // Used to track when changes can be merged into a single undo
- // event
- this.lastModTime = this.lastSelTime = 0;
- this.lastOp = this.lastSelOp = null;
- this.lastOrigin = this.lastSelOrigin = null;
- // Used by the isClean() method
- this.generation = this.maxGeneration = startGen || 1;
- }
- // Create a history change event from an updateDoc-style change
- // object.
- function historyChangeFromChange(doc, change) {
- var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
- attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
- linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
- return histChange
- }
- // Pop all selection events off the end of a history array. Stop at
- // a change event.
- function clearSelectionEvents(array) {
- while (array.length) {
- var last = lst(array);
- if (last.ranges) { array.pop(); }
- else { break }
- }
- }
- // Find the top change event in the history. Pop off selection
- // events that are in the way.
- function lastChangeEvent(hist, force) {
- if (force) {
- clearSelectionEvents(hist.done);
- return lst(hist.done)
- } else if (hist.done.length && !lst(hist.done).ranges) {
- return lst(hist.done)
- } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
- hist.done.pop();
- return lst(hist.done)
- }
- }
- // Register a change in the history. Merges changes that are within
- // a single operation, or are close together with an origin that
- // allows merging (starting with "+") into a single event.
- function addChangeToHistory(doc, change, selAfter, opId) {
- var hist = doc.history;
- hist.undone.length = 0;
- var time = +new Date, cur;
- var last;
- if ((hist.lastOp == opId ||
- hist.lastOrigin == change.origin && change.origin &&
- ((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
- change.origin.charAt(0) == "*")) &&
- (cur = lastChangeEvent(hist, hist.lastOp == opId))) {
- // Merge this change into the last event
- last = lst(cur.changes);
- if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
- // Optimized case for simple insertion -- don't want to add
- // new changesets for every character typed
- last.to = changeEnd(change);
- } else {
- // Add new sub-event
- cur.changes.push(historyChangeFromChange(doc, change));
- }
- } else {
- // Can not be merged, start a new event.
- var before = lst(hist.done);
- if (!before || !before.ranges)
- { pushSelectionToHistory(doc.sel, hist.done); }
- cur = {changes: [historyChangeFromChange(doc, change)],
- generation: hist.generation};
- hist.done.push(cur);
- while (hist.done.length > hist.undoDepth) {
- hist.done.shift();
- if (!hist.done[0].ranges) { hist.done.shift(); }
- }
- }
- hist.done.push(selAfter);
- hist.generation = ++hist.maxGeneration;
- hist.lastModTime = hist.lastSelTime = time;
- hist.lastOp = hist.lastSelOp = opId;
- hist.lastOrigin = hist.lastSelOrigin = change.origin;
- if (!last) { signal(doc, "historyAdded"); }
- }
- function selectionEventCanBeMerged(doc, origin, prev, sel) {
- var ch = origin.charAt(0);
- return ch == "*" ||
- ch == "+" &&
- prev.ranges.length == sel.ranges.length &&
- prev.somethingSelected() == sel.somethingSelected() &&
- new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
- }
- // Called whenever the selection changes, sets the new selection as
- // the pending selection in the history, and pushes the old pending
- // selection into the 'done' array when it was significantly
- // different (in number of selected ranges, emptiness, or time).
- function addSelectionToHistory(doc, sel, opId, options) {
- var hist = doc.history, origin = options && options.origin;
- // A new event is started when the previous origin does not match
- // the current, or the origins don't allow matching. Origins
- // starting with * are always merged, those starting with + are
- // merged when similar and close together in time.
- if (opId == hist.lastSelOp ||
- (origin && hist.lastSelOrigin == origin &&
- (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
- selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
- { hist.done[hist.done.length - 1] = sel; }
- else
- { pushSelectionToHistory(sel, hist.done); }
- hist.lastSelTime = +new Date;
- hist.lastSelOrigin = origin;
- hist.lastSelOp = opId;
- if (options && options.clearRedo !== false)
- { clearSelectionEvents(hist.undone); }
- }
- function pushSelectionToHistory(sel, dest) {
- var top = lst(dest);
- if (!(top && top.ranges && top.equals(sel)))
- { dest.push(sel); }
- }
- // Used to store marked span information in the history.
- function attachLocalSpans(doc, change, from, to) {
- var existing = change["spans_" + doc.id], n = 0;
- doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
- if (line.markedSpans)
- { (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
- ++n;
- });
- }
- // When un/re-doing restores text containing marked spans, those
- // that have been explicitly cleared should not be restored.
- function removeClearedSpans(spans) {
- if (!spans) { return null }
- var out;
- for (var i = 0; i < spans.length; ++i) {
- if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
- else if (out) { out.push(spans[i]); }
- }
- return !out ? spans : out.length ? out : null
- }
- // Retrieve and filter the old marked spans stored in a change event.
- function getOldSpans(doc, change) {
- var found = change["spans_" + doc.id];
- if (!found) { return null }
- var nw = [];
- for (var i = 0; i < change.text.length; ++i)
- { nw.push(removeClearedSpans(found[i])); }
- return nw
- }
- // Used for un/re-doing changes from the history. Combines the
- // result of computing the existing spans with the set of spans that
- // existed in the history (so that deleting around a span and then
- // undoing brings back the span).
- function mergeOldSpans(doc, change) {
- var old = getOldSpans(doc, change);
- var stretched = stretchSpansOverChange(doc, change);
- if (!old) { return stretched }
- if (!stretched) { return old }
- for (var i = 0; i < old.length; ++i) {
- var oldCur = old[i], stretchCur = stretched[i];
- if (oldCur && stretchCur) {
- spans: for (var j = 0; j < stretchCur.length; ++j) {
- var span = stretchCur[j];
- for (var k = 0; k < oldCur.length; ++k)
- { if (oldCur[k].marker == span.marker) { continue spans } }
- oldCur.push(span);
- }
- } else if (stretchCur) {
- old[i] = stretchCur;
- }
- }
- return old
- }
- // Used both to provide a JSON-safe object in .getHistory, and, when
- // detaching a document, to split the history in two
- function copyHistoryArray(events, newGroup, instantiateSel) {
- var copy = [];
- for (var i = 0; i < events.length; ++i) {
- var event = events[i];
- if (event.ranges) {
- copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
- continue
- }
- var changes = event.changes, newChanges = [];
- copy.push({changes: newChanges});
- for (var j = 0; j < changes.length; ++j) {
- var change = changes[j], m = (void 0);
- newChanges.push({from: change.from, to: change.to, text: change.text});
- if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
- if (indexOf(newGroup, Number(m[1])) > -1) {
- lst(newChanges)[prop] = change[prop];
- delete change[prop];
- }
- } } }
- }
- }
- return copy
- }
- // The 'scroll' parameter given to many of these indicated whether
- // the new cursor position should be scrolled into view after
- // modifying the selection.
- // If shift is held or the extend flag is set, extends a range to
- // include a given position (and optionally a second position).
- // Otherwise, simply returns the range between the given positions.
- // Used for cursor motion and such.
- function extendRange(range, head, other, extend) {
- if (extend) {
- var anchor = range.anchor;
- if (other) {
- var posBefore = cmp(head, anchor) < 0;
- if (posBefore != (cmp(other, anchor) < 0)) {
- anchor = head;
- head = other;
- } else if (posBefore != (cmp(head, other) < 0)) {
- head = other;
- }
- }
- return new Range(anchor, head)
- } else {
- return new Range(other || head, head)
- }
- }
- // Extend the primary selection range, discard the rest.
- function extendSelection(doc, head, other, options, extend) {
- if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
- setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
- }
- // Extend all selections (pos is an array of selections with length
- // equal the number of selections)
- function extendSelections(doc, heads, options) {
- var out = [];
- var extend = doc.cm && (doc.cm.display.shift || doc.extend);
- for (var i = 0; i < doc.sel.ranges.length; i++)
- { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
- var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
- setSelection(doc, newSel, options);
- }
- // Updates a single range in the selection.
- function replaceOneSelection(doc, i, range, options) {
- var ranges = doc.sel.ranges.slice(0);
- ranges[i] = range;
- setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
- }
- // Reset the selection to a single range.
- function setSimpleSelection(doc, anchor, head, options) {
- setSelection(doc, simpleSelection(anchor, head), options);
- }
- // Give beforeSelectionChange handlers a change to influence a
- // selection update.
- function filterSelectionChange(doc, sel, options) {
- var obj = {
- ranges: sel.ranges,
- update: function(ranges) {
- this.ranges = [];
- for (var i = 0; i < ranges.length; i++)
- { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
- clipPos(doc, ranges[i].head)); }
- },
- origin: options && options.origin
- };
- signal(doc, "beforeSelectionChange", doc, obj);
- if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
- if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
- else { return sel }
- }
- function setSelectionReplaceHistory(doc, sel, options) {
- var done = doc.history.done, last = lst(done);
- if (last && last.ranges) {
- done[done.length - 1] = sel;
- setSelectionNoUndo(doc, sel, options);
- } else {
- setSelection(doc, sel, options);
- }
- }
- // Set a new selection.
- function setSelection(doc, sel, options) {
- setSelectionNoUndo(doc, sel, options);
- addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
- }
- function setSelectionNoUndo(doc, sel, options) {
- if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
- { sel = filterSelectionChange(doc, sel, options); }
- var bias = options && options.bias ||
- (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
- setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
- if (!(options && options.scroll === false) && doc.cm)
- { ensureCursorVisible(doc.cm); }
- }
- function setSelectionInner(doc, sel) {
- if (sel.equals(doc.sel)) { return }
- doc.sel = sel;
- if (doc.cm) {
- doc.cm.curOp.updateInput = 1;
- doc.cm.curOp.selectionChanged = true;
- signalCursorActivity(doc.cm);
- }
- signalLater(doc, "cursorActivity", doc);
- }
- // Verify that the selection does not partially select any atomic
- // marked ranges.
- function reCheckSelection(doc) {
- setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
- }
- // Return a selection that does not partially select any atomic
- // ranges.
- function skipAtomicInSelection(doc, sel, bias, mayClear) {
- var out;
- for (var i = 0; i < sel.ranges.length; i++) {
- var range = sel.ranges[i];
- var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
- var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
- var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
- if (out || newAnchor != range.anchor || newHead != range.head) {
- if (!out) { out = sel.ranges.slice(0, i); }
- out[i] = new Range(newAnchor, newHead);
- }
- }
- return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
- }
- function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
- var line = getLine(doc, pos.line);
- if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
- var sp = line.markedSpans[i], m = sp.marker;
- // Determine if we should prevent the cursor being placed to the left/right of an atomic marker
- // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it
- // is with selectLeft/Right
- var preventCursorLeft = ("selectLeft" in m) ? !m.selectLeft : m.inclusiveLeft;
- var preventCursorRight = ("selectRight" in m) ? !m.selectRight : m.inclusiveRight;
- if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
- (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
- if (mayClear) {
- signal(m, "beforeCursorEnter");
- if (m.explicitlyCleared) {
- if (!line.markedSpans) { break }
- else {--i; continue}
- }
- }
- if (!m.atomic) { continue }
- if (oldPos) {
- var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
- if (dir < 0 ? preventCursorRight : preventCursorLeft)
- { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
- if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
- { return skipAtomicInner(doc, near, pos, dir, mayClear) }
- }
- var far = m.find(dir < 0 ? -1 : 1);
- if (dir < 0 ? preventCursorLeft : preventCursorRight)
- { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
- return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
- }
- } }
- return pos
- }
- // Ensure a given position is not inside an atomic range.
- function skipAtomic(doc, pos, oldPos, bias, mayClear) {
- var dir = bias || 1;
- var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
- (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
- skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
- (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
- if (!found) {
- doc.cantEdit = true;
- return Pos(doc.first, 0)
- }
- return found
- }
- function movePos(doc, pos, dir, line) {
- if (dir < 0 && pos.ch == 0) {
- if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
- else { return null }
- } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
- if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
- else { return null }
- } else {
- return new Pos(pos.line, pos.ch + dir)
- }
- }
- function selectAll(cm) {
- cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
- }
- // UPDATING
- // Allow "beforeChange" event handlers to influence a change
- function filterChange(doc, change, update) {
- var obj = {
- canceled: false,
- from: change.from,
- to: change.to,
- text: change.text,
- origin: change.origin,
- cancel: function () { return obj.canceled = true; }
- };
- if (update) { obj.update = function (from, to, text, origin) {
- if (from) { obj.from = clipPos(doc, from); }
- if (to) { obj.to = clipPos(doc, to); }
- if (text) { obj.text = text; }
- if (origin !== undefined) { obj.origin = origin; }
- }; }
- signal(doc, "beforeChange", doc, obj);
- if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
- if (obj.canceled) {
- if (doc.cm) { doc.cm.curOp.updateInput = 2; }
- return null
- }
- return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
- }
- // Apply a change to a document, and add it to the document's
- // history, and propagating it to all linked documents.
- function makeChange(doc, change, ignoreReadOnly) {
- if (doc.cm) {
- if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
- if (doc.cm.state.suppressEdits) { return }
- }
- if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
- change = filterChange(doc, change, true);
- if (!change) { return }
- }
- // Possibly split or suppress the update based on the presence
- // of read-only spans in its range.
- var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
- if (split) {
- for (var i = split.length - 1; i >= 0; --i)
- { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
- } else {
- makeChangeInner(doc, change);
- }
- }
- function makeChangeInner(doc, change) {
- if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
- var selAfter = computeSelAfterChange(doc, change);
- addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
- makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
- var rebased = [];
- linkedDocs(doc, function (doc, sharedHist) {
- if (!sharedHist && indexOf(rebased, doc.history) == -1) {
- rebaseHist(doc.history, change);
- rebased.push(doc.history);
- }
- makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
- });
- }
- // Revert a change stored in a document's history.
- function makeChangeFromHistory(doc, type, allowSelectionOnly) {
- var suppress = doc.cm && doc.cm.state.suppressEdits;
- if (suppress && !allowSelectionOnly) { return }
- var hist = doc.history, event, selAfter = doc.sel;
- var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
- // Verify that there is a useable event (so that ctrl-z won't
- // needlessly clear selection events)
- var i = 0;
- for (; i < source.length; i++) {
- event = source[i];
- if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
- { break }
- }
- if (i == source.length) { return }
- hist.lastOrigin = hist.lastSelOrigin = null;
- for (;;) {
- event = source.pop();
- if (event.ranges) {
- pushSelectionToHistory(event, dest);
- if (allowSelectionOnly && !event.equals(doc.sel)) {
- setSelection(doc, event, {clearRedo: false});
- return
- }
- selAfter = event;
- } else if (suppress) {
- source.push(event);
- return
- } else { break }
- }
- // Build up a reverse change object to add to the opposite history
- // stack (redo when undoing, and vice versa).
- var antiChanges = [];
- pushSelectionToHistory(selAfter, dest);
- dest.push({changes: antiChanges, generation: hist.generation});
- hist.generation = event.generation || ++hist.maxGeneration;
- var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
- var loop = function ( i ) {
- var change = event.changes[i];
- change.origin = type;
- if (filter && !filterChange(doc, change, false)) {
- source.length = 0;
- return {}
- }
- antiChanges.push(historyChangeFromChange(doc, change));
- var after = i ? computeSelAfterChange(doc, change) : lst(source);
- makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
- if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
- var rebased = [];
- // Propagate to the linked documents
- linkedDocs(doc, function (doc, sharedHist) {
- if (!sharedHist && indexOf(rebased, doc.history) == -1) {
- rebaseHist(doc.history, change);
- rebased.push(doc.history);
- }
- makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
- });
- };
- for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
- var returned = loop( i$1 );
- if ( returned ) return returned.v;
- }
- }
- // Sub-views need their line numbers shifted when text is added
- // above or below them in the parent document.
- function shiftDoc(doc, distance) {
- if (distance == 0) { return }
- doc.first += distance;
- doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
- Pos(range.anchor.line + distance, range.anchor.ch),
- Pos(range.head.line + distance, range.head.ch)
- ); }), doc.sel.primIndex);
- if (doc.cm) {
- regChange(doc.cm, doc.first, doc.first - distance, distance);
- for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
- { regLineChange(doc.cm, l, "gutter"); }
- }
- }
- // More lower-level change function, handling only a single document
- // (not linked ones).
- function makeChangeSingleDoc(doc, change, selAfter, spans) {
- if (doc.cm && !doc.cm.curOp)
- { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
- if (change.to.line < doc.first) {
- shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
- return
- }
- if (change.from.line > doc.lastLine()) { return }
- // Clip the change to the size of this doc
- if (change.from.line < doc.first) {
- var shift = change.text.length - 1 - (doc.first - change.from.line);
- shiftDoc(doc, shift);
- change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
- text: [lst(change.text)], origin: change.origin};
- }
- var last = doc.lastLine();
- if (change.to.line > last) {
- change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
- text: [change.text[0]], origin: change.origin};
- }
- change.removed = getBetween(doc, change.from, change.to);
- if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
- if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
- else { updateDoc(doc, change, spans); }
- setSelectionNoUndo(doc, selAfter, sel_dontScroll);
- if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))
- { doc.cantEdit = false; }
- }
- // Handle the interaction of a change to a document with the editor
- // that this document is part of.
- function makeChangeSingleDocInEditor(cm, change, spans) {
- var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
- var recomputeMaxLength = false, checkWidthStart = from.line;
- if (!cm.options.lineWrapping) {
- checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
- doc.iter(checkWidthStart, to.line + 1, function (line) {
- if (line == display.maxLine) {
- recomputeMaxLength = true;
- return true
- }
- });
- }
- if (doc.sel.contains(change.from, change.to) > -1)
- { signalCursorActivity(cm); }
- updateDoc(doc, change, spans, estimateHeight(cm));
- if (!cm.options.lineWrapping) {
- doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
- var len = lineLength(line);
- if (len > display.maxLineLength) {
- display.maxLine = line;
- display.maxLineLength = len;
- display.maxLineChanged = true;
- recomputeMaxLength = false;
- }
- });
- if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
- }
- retreatFrontier(doc, from.line);
- startWorker(cm, 400);
- var lendiff = change.text.length - (to.line - from.line) - 1;
- // Remember that these lines changed, for updating the display
- if (change.full)
- { regChange(cm); }
- else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
- { regLineChange(cm, from.line, "text"); }
- else
- { regChange(cm, from.line, to.line + 1, lendiff); }
- var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
- if (changeHandler || changesHandler) {
- var obj = {
- from: from, to: to,
- text: change.text,
- removed: change.removed,
- origin: change.origin
- };
- if (changeHandler) { signalLater(cm, "change", cm, obj); }
- if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
- }
- cm.display.selForContextMenu = null;
- }
- function replaceRange(doc, code, from, to, origin) {
- var assign;
- if (!to) { to = from; }
- if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
- if (typeof code == "string") { code = doc.splitLines(code); }
- makeChange(doc, {from: from, to: to, text: code, origin: origin});
- }
- // Rebasing/resetting history to deal with externally-sourced changes
- function rebaseHistSelSingle(pos, from, to, diff) {
- if (to < pos.line) {
- pos.line += diff;
- } else if (from < pos.line) {
- pos.line = from;
- pos.ch = 0;
- }
- }
- // Tries to rebase an array of history events given a change in the
- // document. If the change touches the same lines as the event, the
- // event, and everything 'behind' it, is discarded. If the change is
- // before the event, the event's positions are updated. Uses a
- // copy-on-write scheme for the positions, to avoid having to
- // reallocate them all on every rebase, but also avoid problems with
- // shared position objects being unsafely updated.
- function rebaseHistArray(array, from, to, diff) {
- for (var i = 0; i < array.length; ++i) {
- var sub = array[i], ok = true;
- if (sub.ranges) {
- if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
- for (var j = 0; j < sub.ranges.length; j++) {
- rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
- rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
- }
- continue
- }
- for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
- var cur = sub.changes[j$1];
- if (to < cur.from.line) {
- cur.from = Pos(cur.from.line + diff, cur.from.ch);
- cur.to = Pos(cur.to.line + diff, cur.to.ch);
- } else if (from <= cur.to.line) {
- ok = false;
- break
- }
- }
- if (!ok) {
- array.splice(0, i + 1);
- i = 0;
- }
- }
- }
- function rebaseHist(hist, change) {
- var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
- rebaseHistArray(hist.done, from, to, diff);
- rebaseHistArray(hist.undone, from, to, diff);
- }
- // Utility for applying a change to a line by handle or number,
- // returning the number and optionally registering the line as
- // changed.
- function changeLine(doc, handle, changeType, op) {
- var no = handle, line = handle;
- if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
- else { no = lineNo(handle); }
- if (no == null) { return null }
- if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
- return line
- }
- // The document is represented as a BTree consisting of leaves, with
- // chunk of lines in them, and branches, with up to ten leaves or
- // other branch nodes below them. The top node is always a branch
- // node, and is the document object itself (meaning it has
- // additional methods and properties).
- //
- // All nodes have parent links. The tree is used both to go from
- // line numbers to line objects, and to go from objects to numbers.
- // It also indexes by height, and is used to convert between height
- // and line object, and to find the total height of the document.
- //
- // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
- function LeafChunk(lines) {
- this.lines = lines;
- this.parent = null;
- var height = 0;
- for (var i = 0; i < lines.length; ++i) {
- lines[i].parent = this;
- height += lines[i].height;
- }
- this.height = height;
- }
- LeafChunk.prototype = {
- chunkSize: function() { return this.lines.length },
- // Remove the n lines at offset 'at'.
- removeInner: function(at, n) {
- for (var i = at, e = at + n; i < e; ++i) {
- var line = this.lines[i];
- this.height -= line.height;
- cleanUpLine(line);
- signalLater(line, "delete");
- }
- this.lines.splice(at, n);
- },
- // Helper used to collapse a small branch into a single leaf.
- collapse: function(lines) {
- lines.push.apply(lines, this.lines);
- },
- // Insert the given array of lines at offset 'at', count them as
- // having the given height.
- insertInner: function(at, lines, height) {
- this.height += height;
- this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
- for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }
- },
- // Used to iterate over a part of the tree.
- iterN: function(at, n, op) {
- for (var e = at + n; at < e; ++at)
- { if (op(this.lines[at])) { return true } }
- }
- };
- function BranchChunk(children) {
- this.children = children;
- var size = 0, height = 0;
- for (var i = 0; i < children.length; ++i) {
- var ch = children[i];
- size += ch.chunkSize(); height += ch.height;
- ch.parent = this;
- }
- this.size = size;
- this.height = height;
- this.parent = null;
- }
- BranchChunk.prototype = {
- chunkSize: function() { return this.size },
- removeInner: function(at, n) {
- this.size -= n;
- for (var i = 0; i < this.children.length; ++i) {
- var child = this.children[i], sz = child.chunkSize();
- if (at < sz) {
- var rm = Math.min(n, sz - at), oldHeight = child.height;
- child.removeInner(at, rm);
- this.height -= oldHeight - child.height;
- if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }
- if ((n -= rm) == 0) { break }
- at = 0;
- } else { at -= sz; }
- }
- // If the result is smaller than 25 lines, ensure that it is a
- // single leaf node.
- if (this.size - n < 25 &&
- (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
- var lines = [];
- this.collapse(lines);
- this.children = [new LeafChunk(lines)];
- this.children[0].parent = this;
- }
- },
- collapse: function(lines) {
- for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }
- },
- insertInner: function(at, lines, height) {
- this.size += lines.length;
- this.height += height;
- for (var i = 0; i < this.children.length; ++i) {
- var child = this.children[i], sz = child.chunkSize();
- if (at <= sz) {
- child.insertInner(at, lines, height);
- if (child.lines && child.lines.length > 50) {
- // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
- // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
- var remaining = child.lines.length % 25 + 25;
- for (var pos = remaining; pos < child.lines.length;) {
- var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
- child.height -= leaf.height;
- this.children.splice(++i, 0, leaf);
- leaf.parent = this;
- }
- child.lines = child.lines.slice(0, remaining);
- this.maybeSpill();
- }
- break
- }
- at -= sz;
- }
- },
- // When a node has grown, check whether it should be split.
- maybeSpill: function() {
- if (this.children.length <= 10) { return }
- var me = this;
- do {
- var spilled = me.children.splice(me.children.length - 5, 5);
- var sibling = new BranchChunk(spilled);
- if (!me.parent) { // Become the parent node
- var copy = new BranchChunk(me.children);
- copy.parent = me;
- me.children = [copy, sibling];
- me = copy;
- } else {
- me.size -= sibling.size;
- me.height -= sibling.height;
- var myIndex = indexOf(me.parent.children, me);
- me.parent.children.splice(myIndex + 1, 0, sibling);
- }
- sibling.parent = me.parent;
- } while (me.children.length > 10)
- me.parent.maybeSpill();
- },
- iterN: function(at, n, op) {
- for (var i = 0; i < this.children.length; ++i) {
- var child = this.children[i], sz = child.chunkSize();
- if (at < sz) {
- var used = Math.min(n, sz - at);
- if (child.iterN(at, used, op)) { return true }
- if ((n -= used) == 0) { break }
- at = 0;
- } else { at -= sz; }
- }
- }
- };
- // Line widgets are block elements displayed above or below a line.
- var LineWidget = function(doc, node, options) {
- if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
- { this[opt] = options[opt]; } } }
- this.doc = doc;
- this.node = node;
- };
- LineWidget.prototype.clear = function () {
- var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
- if (no == null || !ws) { return }
- for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }
- if (!ws.length) { line.widgets = null; }
- var height = widgetHeight(this);
- updateLineHeight(line, Math.max(0, line.height - height));
- if (cm) {
- runInOp(cm, function () {
- adjustScrollWhenAboveVisible(cm, line, -height);
- regLineChange(cm, no, "widget");
- });
- signalLater(cm, "lineWidgetCleared", cm, this, no);
- }
- };
- LineWidget.prototype.changed = function () {
- var this$1 = this;
- var oldH = this.height, cm = this.doc.cm, line = this.line;
- this.height = null;
- var diff = widgetHeight(this) - oldH;
- if (!diff) { return }
- if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
- if (cm) {
- runInOp(cm, function () {
- cm.curOp.forceUpdate = true;
- adjustScrollWhenAboveVisible(cm, line, diff);
- signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
- });
- }
- };
- eventMixin(LineWidget);
- function adjustScrollWhenAboveVisible(cm, line, diff) {
- if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
- { addToScrollTop(cm, diff); }
- }
- function addLineWidget(doc, handle, node, options) {
- var widget = new LineWidget(doc, node, options);
- var cm = doc.cm;
- if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
- changeLine(doc, handle, "widget", function (line) {
- var widgets = line.widgets || (line.widgets = []);
- if (widget.insertAt == null) { widgets.push(widget); }
- else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
- widget.line = line;
- if (cm && !lineIsHidden(doc, line)) {
- var aboveVisible = heightAtLine(line) < doc.scrollTop;
- updateLineHeight(line, line.height + widgetHeight(widget));
- if (aboveVisible) { addToScrollTop(cm, widget.height); }
- cm.curOp.forceUpdate = true;
- }
- return true
- });
- if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
- return widget
- }
- // TEXTMARKERS
- // Created with markText and setBookmark methods. A TextMarker is a
- // handle that can be used to clear or find a marked position in the
- // document. Line objects hold arrays (markedSpans) containing
- // {from, to, marker} object pointing to such marker objects, and
- // indicating that such a marker is present on that line. Multiple
- // lines may point to the same marker when it spans across lines.
- // The spans will have null for their from/to properties when the
- // marker continues beyond the start/end of the line. Markers have
- // links back to the lines they currently touch.
- // Collapsed markers have unique ids, in order to be able to order
- // them, which is needed for uniquely determining an outer marker
- // when they overlap (they may nest, but not partially overlap).
- var nextMarkerId = 0;
- var TextMarker = function(doc, type) {
- this.lines = [];
- this.type = type;
- this.doc = doc;
- this.id = ++nextMarkerId;
- };
- // Clear the marker.
- TextMarker.prototype.clear = function () {
- if (this.explicitlyCleared) { return }
- var cm = this.doc.cm, withOp = cm && !cm.curOp;
- if (withOp) { startOperation(cm); }
- if (hasHandler(this, "clear")) {
- var found = this.find();
- if (found) { signalLater(this, "clear", found.from, found.to); }
- }
- var min = null, max = null;
- for (var i = 0; i < this.lines.length; ++i) {
- var line = this.lines[i];
- var span = getMarkedSpanFor(line.markedSpans, this);
- if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), "text"); }
- else if (cm) {
- if (span.to != null) { max = lineNo(line); }
- if (span.from != null) { min = lineNo(line); }
- }
- line.markedSpans = removeMarkedSpan(line.markedSpans, span);
- if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)
- { updateLineHeight(line, textHeight(cm.display)); }
- }
- if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
- var visual = visualLine(this.lines[i$1]), len = lineLength(visual);
- if (len > cm.display.maxLineLength) {
- cm.display.maxLine = visual;
- cm.display.maxLineLength = len;
- cm.display.maxLineChanged = true;
- }
- } }
- if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
- this.lines.length = 0;
- this.explicitlyCleared = true;
- if (this.atomic && this.doc.cantEdit) {
- this.doc.cantEdit = false;
- if (cm) { reCheckSelection(cm.doc); }
- }
- if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
- if (withOp) { endOperation(cm); }
- if (this.parent) { this.parent.clear(); }
- };
- // Find the position of the marker in the document. Returns a {from,
- // to} object by default. Side can be passed to get a specific side
- // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
- // Pos objects returned contain a line object, rather than a line
- // number (used to prevent looking up the same line twice).
- TextMarker.prototype.find = function (side, lineObj) {
- if (side == null && this.type == "bookmark") { side = 1; }
- var from, to;
- for (var i = 0; i < this.lines.length; ++i) {
- var line = this.lines[i];
- var span = getMarkedSpanFor(line.markedSpans, this);
- if (span.from != null) {
- from = Pos(lineObj ? line : lineNo(line), span.from);
- if (side == -1) { return from }
- }
- if (span.to != null) {
- to = Pos(lineObj ? line : lineNo(line), span.to);
- if (side == 1) { return to }
- }
- }
- return from && {from: from, to: to}
- };
- // Signals that the marker's widget changed, and surrounding layout
- // should be recomputed.
- TextMarker.prototype.changed = function () {
- var this$1 = this;
- var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
- if (!pos || !cm) { return }
- runInOp(cm, function () {
- var line = pos.line, lineN = lineNo(pos.line);
- var view = findViewForLine(cm, lineN);
- if (view) {
- clearLineMeasurementCacheFor(view);
- cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
- }
- cm.curOp.updateMaxLine = true;
- if (!lineIsHidden(widget.doc, line) && widget.height != null) {
- var oldHeight = widget.height;
- widget.height = null;
- var dHeight = widgetHeight(widget) - oldHeight;
- if (dHeight)
- { updateLineHeight(line, line.height + dHeight); }
- }
- signalLater(cm, "markerChanged", cm, this$1);
- });
- };
- TextMarker.prototype.attachLine = function (line) {
- if (!this.lines.length && this.doc.cm) {
- var op = this.doc.cm.curOp;
- if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
- { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
- }
- this.lines.push(line);
- };
- TextMarker.prototype.detachLine = function (line) {
- this.lines.splice(indexOf(this.lines, line), 1);
- if (!this.lines.length && this.doc.cm) {
- var op = this.doc.cm.curOp
- ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
- }
- };
- eventMixin(TextMarker);
- // Create a marker, wire it up to the right lines, and
- function markText(doc, from, to, options, type) {
- // Shared markers (across linked documents) are handled separately
- // (markTextShared will call out to this again, once per
- // document).
- if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
- // Ensure we are in an operation.
- if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
- var marker = new TextMarker(doc, type), diff = cmp(from, to);
- if (options) { copyObj(options, marker, false); }
- // Don't connect empty markers unless clearWhenEmpty is false
- if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
- { return marker }
- if (marker.replacedWith) {
- // Showing up as a widget implies collapsed (widget replaces text)
- marker.collapsed = true;
- marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
- if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
- if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
- }
- if (marker.collapsed) {
- if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
- from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
- { throw new Error("Inserting collapsed marker partially overlapping an existing one") }
- seeCollapsedSpans();
- }
- if (marker.addToHistory)
- { addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
- var curLine = from.line, cm = doc.cm, updateMaxLine;
- doc.iter(curLine, to.line + 1, function (line) {
- if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
- { updateMaxLine = true; }
- if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
- addMarkedSpan(line, new MarkedSpan(marker,
- curLine == from.line ? from.ch : null,
- curLine == to.line ? to.ch : null));
- ++curLine;
- });
- // lineIsHidden depends on the presence of the spans, so needs a second pass
- if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
- if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
- }); }
- if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
- if (marker.readOnly) {
- seeReadOnlySpans();
- if (doc.history.done.length || doc.history.undone.length)
- { doc.clearHistory(); }
- }
- if (marker.collapsed) {
- marker.id = ++nextMarkerId;
- marker.atomic = true;
- }
- if (cm) {
- // Sync editor state
- if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
- if (marker.collapsed)
- { regChange(cm, from.line, to.line + 1); }
- else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
- marker.attributes || marker.title)
- { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
- if (marker.atomic) { reCheckSelection(cm.doc); }
- signalLater(cm, "markerAdded", cm, marker);
- }
- return marker
- }
- // SHARED TEXTMARKERS
- // A shared marker spans multiple linked documents. It is
- // implemented as a meta-marker-object controlling multiple normal
- // markers.
- var SharedTextMarker = function(markers, primary) {
- this.markers = markers;
- this.primary = primary;
- for (var i = 0; i < markers.length; ++i)
- { markers[i].parent = this; }
- };
- SharedTextMarker.prototype.clear = function () {
- if (this.explicitlyCleared) { return }
- this.explicitlyCleared = true;
- for (var i = 0; i < this.markers.length; ++i)
- { this.markers[i].clear(); }
- signalLater(this, "clear");
- };
- SharedTextMarker.prototype.find = function (side, lineObj) {
- return this.primary.find(side, lineObj)
- };
- eventMixin(SharedTextMarker);
- function markTextShared(doc, from, to, options, type) {
- options = copyObj(options);
- options.shared = false;
- var markers = [markText(doc, from, to, options, type)], primary = markers[0];
- var widget = options.widgetNode;
- linkedDocs(doc, function (doc) {
- if (widget) { options.widgetNode = widget.cloneNode(true); }
- markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
- for (var i = 0; i < doc.linked.length; ++i)
- { if (doc.linked[i].isParent) { return } }
- primary = lst(markers);
- });
- return new SharedTextMarker(markers, primary)
- }
- function findSharedMarkers(doc) {
- return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
- }
- function copySharedMarkers(doc, markers) {
- for (var i = 0; i < markers.length; i++) {
- var marker = markers[i], pos = marker.find();
- var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
- if (cmp(mFrom, mTo)) {
- var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
- marker.markers.push(subMark);
- subMark.parent = marker;
- }
- }
- }
- function detachSharedMarkers(markers) {
- var loop = function ( i ) {
- var marker = markers[i], linked = [marker.primary.doc];
- linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
- for (var j = 0; j < marker.markers.length; j++) {
- var subMarker = marker.markers[j];
- if (indexOf(linked, subMarker.doc) == -1) {
- subMarker.parent = null;
- marker.markers.splice(j--, 1);
- }
- }
- };
- for (var i = 0; i < markers.length; i++) loop( i );
- }
- var nextDocId = 0;
- var Doc = function(text, mode, firstLine, lineSep, direction) {
- if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
- if (firstLine == null) { firstLine = 0; }
- BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
- this.first = firstLine;
- this.scrollTop = this.scrollLeft = 0;
- this.cantEdit = false;
- this.cleanGeneration = 1;
- this.modeFrontier = this.highlightFrontier = firstLine;
- var start = Pos(firstLine, 0);
- this.sel = simpleSelection(start);
- this.history = new History(null);
- this.id = ++nextDocId;
- this.modeOption = mode;
- this.lineSep = lineSep;
- this.direction = (direction == "rtl") ? "rtl" : "ltr";
- this.extend = false;
- if (typeof text == "string") { text = this.splitLines(text); }
- updateDoc(this, {from: start, to: start, text: text});
- setSelection(this, simpleSelection(start), sel_dontScroll);
- };
- Doc.prototype = createObj(BranchChunk.prototype, {
- constructor: Doc,
- // Iterate over the document. Supports two forms -- with only one
- // argument, it calls that for each line in the document. With
- // three, it iterates over the range given by the first two (with
- // the second being non-inclusive).
- iter: function(from, to, op) {
- if (op) { this.iterN(from - this.first, to - from, op); }
- else { this.iterN(this.first, this.first + this.size, from); }
- },
- // Non-public interface for adding and removing lines.
- insert: function(at, lines) {
- var height = 0;
- for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
- this.insertInner(at - this.first, lines, height);
- },
- remove: function(at, n) { this.removeInner(at - this.first, n); },
- // From here, the methods are part of the public interface. Most
- // are also available from CodeMirror (editor) instances.
- getValue: function(lineSep) {
- var lines = getLines(this, this.first, this.first + this.size);
- if (lineSep === false) { return lines }
- return lines.join(lineSep || this.lineSeparator())
- },
- setValue: docMethodOp(function(code) {
- var top = Pos(this.first, 0), last = this.first + this.size - 1;
- makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
- text: this.splitLines(code), origin: "setValue", full: true}, true);
- if (this.cm) { scrollToCoords(this.cm, 0, 0); }
- setSelection(this, simpleSelection(top), sel_dontScroll);
- }),
- replaceRange: function(code, from, to, origin) {
- from = clipPos(this, from);
- to = to ? clipPos(this, to) : from;
- replaceRange(this, code, from, to, origin);
- },
- getRange: function(from, to, lineSep) {
- var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
- if (lineSep === false) { return lines }
- return lines.join(lineSep || this.lineSeparator())
- },
- getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
- getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
- getLineNumber: function(line) {return lineNo(line)},
- getLineHandleVisualStart: function(line) {
- if (typeof line == "number") { line = getLine(this, line); }
- return visualLine(line)
- },
- lineCount: function() {return this.size},
- firstLine: function() {return this.first},
- lastLine: function() {return this.first + this.size - 1},
- clipPos: function(pos) {return clipPos(this, pos)},
- getCursor: function(start) {
- var range = this.sel.primary(), pos;
- if (start == null || start == "head") { pos = range.head; }
- else if (start == "anchor") { pos = range.anchor; }
- else if (start == "end" || start == "to" || start === false) { pos = range.to(); }
- else { pos = range.from(); }
- return pos
- },
- listSelections: function() { return this.sel.ranges },
- somethingSelected: function() {return this.sel.somethingSelected()},
- setCursor: docMethodOp(function(line, ch, options) {
- setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
- }),
- setSelection: docMethodOp(function(anchor, head, options) {
- setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
- }),
- extendSelection: docMethodOp(function(head, other, options) {
- extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
- }),
- extendSelections: docMethodOp(function(heads, options) {
- extendSelections(this, clipPosArray(this, heads), options);
- }),
- extendSelectionsBy: docMethodOp(function(f, options) {
- var heads = map(this.sel.ranges, f);
- extendSelections(this, clipPosArray(this, heads), options);
- }),
- setSelections: docMethodOp(function(ranges, primary, options) {
- if (!ranges.length) { return }
- var out = [];
- for (var i = 0; i < ranges.length; i++)
- { out[i] = new Range(clipPos(this, ranges[i].anchor),
- clipPos(this, ranges[i].head)); }
- if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
- setSelection(this, normalizeSelection(this.cm, out, primary), options);
- }),
- addSelection: docMethodOp(function(anchor, head, options) {
- var ranges = this.sel.ranges.slice(0);
- ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
- setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
- }),
- getSelection: function(lineSep) {
- var ranges = this.sel.ranges, lines;
- for (var i = 0; i < ranges.length; i++) {
- var sel = getBetween(this, ranges[i].from(), ranges[i].to());
- lines = lines ? lines.concat(sel) : sel;
- }
- if (lineSep === false) { return lines }
- else { return lines.join(lineSep || this.lineSeparator()) }
- },
- getSelections: function(lineSep) {
- var parts = [], ranges = this.sel.ranges;
- for (var i = 0; i < ranges.length; i++) {
- var sel = getBetween(this, ranges[i].from(), ranges[i].to());
- if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }
- parts[i] = sel;
- }
- return parts
- },
- replaceSelection: function(code, collapse, origin) {
- var dup = [];
- for (var i = 0; i < this.sel.ranges.length; i++)
- { dup[i] = code; }
- this.replaceSelections(dup, collapse, origin || "+input");
- },
- replaceSelections: docMethodOp(function(code, collapse, origin) {
- var changes = [], sel = this.sel;
- for (var i = 0; i < sel.ranges.length; i++) {
- var range = sel.ranges[i];
- changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};
- }
- var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
- for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
- { makeChange(this, changes[i$1]); }
- if (newSel) { setSelectionReplaceHistory(this, newSel); }
- else if (this.cm) { ensureCursorVisible(this.cm); }
- }),
- undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
- redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
- undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
- redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
- setExtending: function(val) {this.extend = val;},
- getExtending: function() {return this.extend},
- historySize: function() {
- var hist = this.history, done = 0, undone = 0;
- for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
- for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
- return {undo: done, redo: undone}
- },
- clearHistory: function() {
- var this$1 = this;
- this.history = new History(this.history.maxGeneration);
- linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);
- },
- markClean: function() {
- this.cleanGeneration = this.changeGeneration(true);
- },
- changeGeneration: function(forceSplit) {
- if (forceSplit)
- { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
- return this.history.generation
- },
- isClean: function (gen) {
- return this.history.generation == (gen || this.cleanGeneration)
- },
- getHistory: function() {
- return {done: copyHistoryArray(this.history.done),
- undone: copyHistoryArray(this.history.undone)}
- },
- setHistory: function(histData) {
- var hist = this.history = new History(this.history.maxGeneration);
- hist.done = copyHistoryArray(histData.done.slice(0), null, true);
- hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
- },
- setGutterMarker: docMethodOp(function(line, gutterID, value) {
- return changeLine(this, line, "gutter", function (line) {
- var markers = line.gutterMarkers || (line.gutterMarkers = {});
- markers[gutterID] = value;
- if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
- return true
- })
- }),
- clearGutter: docMethodOp(function(gutterID) {
- var this$1 = this;
- this.iter(function (line) {
- if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
- changeLine(this$1, line, "gutter", function () {
- line.gutterMarkers[gutterID] = null;
- if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
- return true
- });
- }
- });
- }),
- lineInfo: function(line) {
- var n;
- if (typeof line == "number") {
- if (!isLine(this, line)) { return null }
- n = line;
- line = getLine(this, line);
- if (!line) { return null }
- } else {
- n = lineNo(line);
- if (n == null) { return null }
- }
- return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
- textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
- widgets: line.widgets}
- },
- addLineClass: docMethodOp(function(handle, where, cls) {
- return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
- var prop = where == "text" ? "textClass"
- : where == "background" ? "bgClass"
- : where == "gutter" ? "gutterClass" : "wrapClass";
- if (!line[prop]) { line[prop] = cls; }
- else if (classTest(cls).test(line[prop])) { return false }
- else { line[prop] += " " + cls; }
- return true
- })
- }),
- removeLineClass: docMethodOp(function(handle, where, cls) {
- return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
- var prop = where == "text" ? "textClass"
- : where == "background" ? "bgClass"
- : where == "gutter" ? "gutterClass" : "wrapClass";
- var cur = line[prop];
- if (!cur) { return false }
- else if (cls == null) { line[prop] = null; }
- else {
- var found = cur.match(classTest(cls));
- if (!found) { return false }
- var end = found.index + found[0].length;
- line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
- }
- return true
- })
- }),
- addLineWidget: docMethodOp(function(handle, node, options) {
- return addLineWidget(this, handle, node, options)
- }),
- removeLineWidget: function(widget) { widget.clear(); },
- markText: function(from, to, options) {
- return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
- },
- setBookmark: function(pos, options) {
- var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
- insertLeft: options && options.insertLeft,
- clearWhenEmpty: false, shared: options && options.shared,
- handleMouseEvents: options && options.handleMouseEvents};
- pos = clipPos(this, pos);
- return markText(this, pos, pos, realOpts, "bookmark")
- },
- findMarksAt: function(pos) {
- pos = clipPos(this, pos);
- var markers = [], spans = getLine(this, pos.line).markedSpans;
- if (spans) { for (var i = 0; i < spans.length; ++i) {
- var span = spans[i];
- if ((span.from == null || span.from <= pos.ch) &&
- (span.to == null || span.to >= pos.ch))
- { markers.push(span.marker.parent || span.marker); }
- } }
- return markers
- },
- findMarks: function(from, to, filter) {
- from = clipPos(this, from); to = clipPos(this, to);
- var found = [], lineNo = from.line;
- this.iter(from.line, to.line + 1, function (line) {
- var spans = line.markedSpans;
- if (spans) { for (var i = 0; i < spans.length; i++) {
- var span = spans[i];
- if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||
- span.from == null && lineNo != from.line ||
- span.from != null && lineNo == to.line && span.from >= to.ch) &&
- (!filter || filter(span.marker)))
- { found.push(span.marker.parent || span.marker); }
- } }
- ++lineNo;
- });
- return found
- },
- getAllMarks: function() {
- var markers = [];
- this.iter(function (line) {
- var sps = line.markedSpans;
- if (sps) { for (var i = 0; i < sps.length; ++i)
- { if (sps[i].from != null) { markers.push(sps[i].marker); } } }
- });
- return markers
- },
- posFromIndex: function(off) {
- var ch, lineNo = this.first, sepSize = this.lineSeparator().length;
- this.iter(function (line) {
- var sz = line.text.length + sepSize;
- if (sz > off) { ch = off; return true }
- off -= sz;
- ++lineNo;
- });
- return clipPos(this, Pos(lineNo, ch))
- },
- indexFromPos: function (coords) {
- coords = clipPos(this, coords);
- var index = coords.ch;
- if (coords.line < this.first || coords.ch < 0) { return 0 }
- var sepSize = this.lineSeparator().length;
- this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
- index += line.text.length + sepSize;
- });
- return index
- },
- copy: function(copyHistory) {
- var doc = new Doc(getLines(this, this.first, this.first + this.size),
- this.modeOption, this.first, this.lineSep, this.direction);
- doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
- doc.sel = this.sel;
- doc.extend = false;
- if (copyHistory) {
- doc.history.undoDepth = this.history.undoDepth;
- doc.setHistory(this.getHistory());
- }
- return doc
- },
- linkedDoc: function(options) {
- if (!options) { options = {}; }
- var from = this.first, to = this.first + this.size;
- if (options.from != null && options.from > from) { from = options.from; }
- if (options.to != null && options.to < to) { to = options.to; }
- var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
- if (options.sharedHist) { copy.history = this.history
- ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
- copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
- copySharedMarkers(copy, findSharedMarkers(this));
- return copy
- },
- unlinkDoc: function(other) {
- if (other instanceof CodeMirror) { other = other.doc; }
- if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
- var link = this.linked[i];
- if (link.doc != other) { continue }
- this.linked.splice(i, 1);
- other.unlinkDoc(this);
- detachSharedMarkers(findSharedMarkers(this));
- break
- } }
- // If the histories were shared, split them again
- if (other.history == this.history) {
- var splitIds = [other.id];
- linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
- other.history = new History(null);
- other.history.done = copyHistoryArray(this.history.done, splitIds);
- other.history.undone = copyHistoryArray(this.history.undone, splitIds);
- }
- },
- iterLinkedDocs: function(f) {linkedDocs(this, f);},
- getMode: function() {return this.mode},
- getEditor: function() {return this.cm},
- splitLines: function(str) {
- if (this.lineSep) { return str.split(this.lineSep) }
- return splitLinesAuto(str)
- },
- lineSeparator: function() { return this.lineSep || "\n" },
- setDirection: docMethodOp(function (dir) {
- if (dir != "rtl") { dir = "ltr"; }
- if (dir == this.direction) { return }
- this.direction = dir;
- this.iter(function (line) { return line.order = null; });
- if (this.cm) { directionChanged(this.cm); }
- })
- });
- // Public alias.
- Doc.prototype.eachLine = Doc.prototype.iter;
- // Kludge to work around strange IE behavior where it'll sometimes
- // re-fire a series of drag-related events right after the drop (#1551)
- var lastDrop = 0;
- function onDrop(e) {
- var cm = this;
- clearDragCursor(cm);
- if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
- { return }
- e_preventDefault(e);
- if (ie) { lastDrop = +new Date; }
- var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
- if (!pos || cm.isReadOnly()) { return }
- // Might be a file drop, in which case we simply extract the text
- // and insert it.
- if (files && files.length && window.FileReader && window.File) {
- var n = files.length, text = Array(n), read = 0;
- var markAsReadAndPasteIfAllFilesAreRead = function () {
- if (++read == n) {
- operation(cm, function () {
- pos = clipPos(cm.doc, pos);
- var change = {from: pos, to: pos,
- text: cm.doc.splitLines(
- text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),
- origin: "paste"};
- makeChange(cm.doc, change);
- setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));
- })();
- }
- };
- var readTextFromFile = function (file, i) {
- if (cm.options.allowDropFileTypes &&
- indexOf(cm.options.allowDropFileTypes, file.type) == -1) {
- markAsReadAndPasteIfAllFilesAreRead();
- return
- }
- var reader = new FileReader;
- reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };
- reader.onload = function () {
- var content = reader.result;
- if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) {
- markAsReadAndPasteIfAllFilesAreRead();
- return
- }
- text[i] = content;
- markAsReadAndPasteIfAllFilesAreRead();
- };
- reader.readAsText(file);
- };
- for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }
- } else { // Normal drop
- // Don't do a replace if the drop happened inside of the selected text.
- if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
- cm.state.draggingText(e);
- // Ensure the editor is re-focused
- setTimeout(function () { return cm.display.input.focus(); }, 20);
- return
- }
- try {
- var text$1 = e.dataTransfer.getData("Text");
- if (text$1) {
- var selected;
- if (cm.state.draggingText && !cm.state.draggingText.copy)
- { selected = cm.listSelections(); }
- setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
- if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
- { replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
- cm.replaceSelection(text$1, "around", "paste");
- cm.display.input.focus();
- }
- }
- catch(e$1){}
- }
- }
- function onDragStart(cm, e) {
- if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
- if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
- e.dataTransfer.setData("Text", cm.getSelection());
- e.dataTransfer.effectAllowed = "copyMove";
- // Use dummy image instead of default browsers image.
- // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
- if (e.dataTransfer.setDragImage && !safari) {
- var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
- img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
- if (presto) {
- img.width = img.height = 1;
- cm.display.wrapper.appendChild(img);
- // Force a relayout, or Opera won't use our image for some obscure reason
- img._top = img.offsetTop;
- }
- e.dataTransfer.setDragImage(img, 0, 0);
- if (presto) { img.parentNode.removeChild(img); }
- }
- }
- function onDragOver(cm, e) {
- var pos = posFromMouse(cm, e);
- if (!pos) { return }
- var frag = document.createDocumentFragment();
- drawSelectionCursor(cm, pos, frag);
- if (!cm.display.dragCursor) {
- cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
- cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
- }
- removeChildrenAndAdd(cm.display.dragCursor, frag);
- }
- function clearDragCursor(cm) {
- if (cm.display.dragCursor) {
- cm.display.lineSpace.removeChild(cm.display.dragCursor);
- cm.display.dragCursor = null;
- }
- }
- // These must be handled carefully, because naively registering a
- // handler for each editor will cause the editors to never be
- // garbage collected.
- function forEachCodeMirror(f) {
- if (!document.getElementsByClassName) { return }
- var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
- for (var i = 0; i < byClass.length; i++) {
- var cm = byClass[i].CodeMirror;
- if (cm) { editors.push(cm); }
- }
- if (editors.length) { editors[0].operation(function () {
- for (var i = 0; i < editors.length; i++) { f(editors[i]); }
- }); }
- }
- var globalsRegistered = false;
- function ensureGlobalHandlers() {
- if (globalsRegistered) { return }
- registerGlobalHandlers();
- globalsRegistered = true;
- }
- function registerGlobalHandlers() {
- // When the window resizes, we need to refresh active editors.
- var resizeTimer;
- on(window, "resize", function () {
- if (resizeTimer == null) { resizeTimer = setTimeout(function () {
- resizeTimer = null;
- forEachCodeMirror(onResize);
- }, 100); }
- });
- // When the window loses focus, we want to show the editor as blurred
- on(window, "blur", function () { return forEachCodeMirror(onBlur); });
- }
- // Called when the window resizes
- function onResize(cm) {
- var d = cm.display;
- // Might be a text scaling operation, clear size caches.
- d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
- d.scrollbarsClipped = false;
- cm.setSize();
- }
- var keyNames = {
- 3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
- 19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
- 36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
- 46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
- 106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 145: "ScrollLock",
- 173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
- 221: "]", 222: "'", 224: "Mod", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
- 63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
- };
- // Number keys
- for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
- // Alphabetic keys
- for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
- // Function keys
- for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
- var keyMap = {};
- keyMap.basic = {
- "Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
- "End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
- "Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
- "Tab": "defaultTab", "Shift-Tab": "indentAuto",
- "Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
- "Esc": "singleSelection"
- };
- // Note that the save and find-related commands aren't defined by
- // default. User code or addons can define them. Unknown commands
- // are simply ignored.
- keyMap.pcDefault = {
- "Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
- "Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
- "Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
- "Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
- "Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
- "Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
- "Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
- "fallthrough": "basic"
- };
- // Very basic readline/emacs-style bindings, which are standard on Mac.
- keyMap.emacsy = {
- "Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
- "Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
- "Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
- "Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
- "Ctrl-O": "openLine"
- };
- keyMap.macDefault = {
- "Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
- "Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
- "Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
- "Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
- "Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
- "Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
- "Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
- "fallthrough": ["basic", "emacsy"]
- };
- keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
- // KEYMAP DISPATCH
- function normalizeKeyName(name) {
- var parts = name.split(/-(?!$)/);
- name = parts[parts.length - 1];
- var alt, ctrl, shift, cmd;
- for (var i = 0; i < parts.length - 1; i++) {
- var mod = parts[i];
- if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
- else if (/^a(lt)?$/i.test(mod)) { alt = true; }
- else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
- else if (/^s(hift)?$/i.test(mod)) { shift = true; }
- else { throw new Error("Unrecognized modifier name: " + mod) }
- }
- if (alt) { name = "Alt-" + name; }
- if (ctrl) { name = "Ctrl-" + name; }
- if (cmd) { name = "Cmd-" + name; }
- if (shift) { name = "Shift-" + name; }
- return name
- }
- // This is a kludge to keep keymaps mostly working as raw objects
- // (backwards compatibility) while at the same time support features
- // like normalization and multi-stroke key bindings. It compiles a
- // new normalized keymap, and then updates the old object to reflect
- // this.
- function normalizeKeyMap(keymap) {
- var copy = {};
- for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
- var value = keymap[keyname];
- if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
- if (value == "...") { delete keymap[keyname]; continue }
- var keys = map(keyname.split(" "), normalizeKeyName);
- for (var i = 0; i < keys.length; i++) {
- var val = (void 0), name = (void 0);
- if (i == keys.length - 1) {
- name = keys.join(" ");
- val = value;
- } else {
- name = keys.slice(0, i + 1).join(" ");
- val = "...";
- }
- var prev = copy[name];
- if (!prev) { copy[name] = val; }
- else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
- }
- delete keymap[keyname];
- } }
- for (var prop in copy) { keymap[prop] = copy[prop]; }
- return keymap
- }
- function lookupKey(key, map, handle, context) {
- map = getKeyMap(map);
- var found = map.call ? map.call(key, context) : map[key];
- if (found === false) { return "nothing" }
- if (found === "...") { return "multi" }
- if (found != null && handle(found)) { return "handled" }
- if (map.fallthrough) {
- if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
- { return lookupKey(key, map.fallthrough, handle, context) }
- for (var i = 0; i < map.fallthrough.length; i++) {
- var result = lookupKey(key, map.fallthrough[i], handle, context);
- if (result) { return result }
- }
- }
- }
- // Modifier key presses don't count as 'real' key presses for the
- // purpose of keymap fallthrough.
- function isModifierKey(value) {
- var name = typeof value == "string" ? value : keyNames[value.keyCode];
- return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
- }
- function addModifierNames(name, event, noShift) {
- var base = name;
- if (event.altKey && base != "Alt") { name = "Alt-" + name; }
- if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
- if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Mod") { name = "Cmd-" + name; }
- if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
- return name
- }
- // Look up the name of a key as indicated by an event object.
- function keyName(event, noShift) {
- if (presto && event.keyCode == 34 && event["char"]) { return false }
- var name = keyNames[event.keyCode];
- if (name == null || event.altGraphKey) { return false }
- // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
- // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
- if (event.keyCode == 3 && event.code) { name = event.code; }
- return addModifierNames(name, event, noShift)
- }
- function getKeyMap(val) {
- return typeof val == "string" ? keyMap[val] : val
- }
- // Helper for deleting text near the selection(s), used to implement
- // backspace, delete, and similar functionality.
- function deleteNearSelection(cm, compute) {
- var ranges = cm.doc.sel.ranges, kill = [];
- // Build up a set of ranges to kill first, merging overlapping
- // ranges.
- for (var i = 0; i < ranges.length; i++) {
- var toKill = compute(ranges[i]);
- while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
- var replaced = kill.pop();
- if (cmp(replaced.from, toKill.from) < 0) {
- toKill.from = replaced.from;
- break
- }
- }
- kill.push(toKill);
- }
- // Next, remove those actual ranges.
- runInOp(cm, function () {
- for (var i = kill.length - 1; i >= 0; i--)
- { replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
- ensureCursorVisible(cm);
- });
- }
- function moveCharLogically(line, ch, dir) {
- var target = skipExtendingChars(line.text, ch + dir, dir);
- return target < 0 || target > line.text.length ? null : target
- }
- function moveLogically(line, start, dir) {
- var ch = moveCharLogically(line, start.ch, dir);
- return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
- }
- function endOfLine(visually, cm, lineObj, lineNo, dir) {
- if (visually) {
- if (cm.doc.direction == "rtl") { dir = -dir; }
- var order = getOrder(lineObj, cm.doc.direction);
- if (order) {
- var part = dir < 0 ? lst(order) : order[0];
- var moveInStorageOrder = (dir < 0) == (part.level == 1);
- var sticky = moveInStorageOrder ? "after" : "before";
- var ch;
- // With a wrapped rtl chunk (possibly spanning multiple bidi parts),
- // it could be that the last bidi part is not on the last visual line,
- // since visual lines contain content order-consecutive chunks.
- // Thus, in rtl, we are looking for the first (content-order) character
- // in the rtl chunk that is on the last line (that is, the same line
- // as the last (content-order) character).
- if (part.level > 0 || cm.doc.direction == "rtl") {
- var prep = prepareMeasureForLine(cm, lineObj);
- ch = dir < 0 ? lineObj.text.length - 1 : 0;
- var targetTop = measureCharPrepared(cm, prep, ch).top;
- ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
- if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
- } else { ch = dir < 0 ? part.to : part.from; }
- return new Pos(lineNo, ch, sticky)
- }
- }
- return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
- }
- function moveVisually(cm, line, start, dir) {
- var bidi = getOrder(line, cm.doc.direction);
- if (!bidi) { return moveLogically(line, start, dir) }
- if (start.ch >= line.text.length) {
- start.ch = line.text.length;
- start.sticky = "before";
- } else if (start.ch <= 0) {
- start.ch = 0;
- start.sticky = "after";
- }
- var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
- if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
- // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
- // nothing interesting happens.
- return moveLogically(line, start, dir)
- }
- var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
- var prep;
- var getWrappedLineExtent = function (ch) {
- if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
- prep = prep || prepareMeasureForLine(cm, line);
- return wrappedLineExtentChar(cm, line, prep, ch)
- };
- var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
- if (cm.doc.direction == "rtl" || part.level == 1) {
- var moveInStorageOrder = (part.level == 1) == (dir < 0);
- var ch = mv(start, moveInStorageOrder ? 1 : -1);
- if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
- // Case 2: We move within an rtl part or in an rtl editor on the same visual line
- var sticky = moveInStorageOrder ? "before" : "after";
- return new Pos(start.line, ch, sticky)
- }
- }
- // Case 3: Could not move within this bidi part in this visual line, so leave
- // the current bidi part
- var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
- var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
- ? new Pos(start.line, mv(ch, 1), "before")
- : new Pos(start.line, ch, "after"); };
- for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
- var part = bidi[partPos];
- var moveInStorageOrder = (dir > 0) == (part.level != 1);
- var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
- if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
- ch = moveInStorageOrder ? part.from : mv(part.to, -1);
- if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
- }
- };
- // Case 3a: Look for other bidi parts on the same visual line
- var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
- if (res) { return res }
- // Case 3b: Look for other bidi parts on the next visual line
- var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
- if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
- res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
- if (res) { return res }
- }
- // Case 4: Nowhere to move
- return null
- }
- // Commands are parameter-less actions that can be performed on an
- // editor, mostly used for keybindings.
- var commands = {
- selectAll: selectAll,
- singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
- killLine: function (cm) { return deleteNearSelection(cm, function (range) {
- if (range.empty()) {
- var len = getLine(cm.doc, range.head.line).text.length;
- if (range.head.ch == len && range.head.line < cm.lastLine())
- { return {from: range.head, to: Pos(range.head.line + 1, 0)} }
- else
- { return {from: range.head, to: Pos(range.head.line, len)} }
- } else {
- return {from: range.from(), to: range.to()}
- }
- }); },
- deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({
- from: Pos(range.from().line, 0),
- to: clipPos(cm.doc, Pos(range.to().line + 1, 0))
- }); }); },
- delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({
- from: Pos(range.from().line, 0), to: range.from()
- }); }); },
- delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {
- var top = cm.charCoords(range.head, "div").top + 5;
- var leftPos = cm.coordsChar({left: 0, top: top}, "div");
- return {from: leftPos, to: range.from()}
- }); },
- delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {
- var top = cm.charCoords(range.head, "div").top + 5;
- var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div");
- return {from: range.from(), to: rightPos }
- }); },
- undo: function (cm) { return cm.undo(); },
- redo: function (cm) { return cm.redo(); },
- undoSelection: function (cm) { return cm.undoSelection(); },
- redoSelection: function (cm) { return cm.redoSelection(); },
- goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },
- goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },
- goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },
- {origin: "+move", bias: 1}
- ); },
- goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },
- {origin: "+move", bias: 1}
- ); },
- goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },
- {origin: "+move", bias: -1}
- ); },
- goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {
- var top = cm.cursorCoords(range.head, "div").top + 5;
- return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, "div")
- }, sel_move); },
- goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {
- var top = cm.cursorCoords(range.head, "div").top + 5;
- return cm.coordsChar({left: 0, top: top}, "div")
- }, sel_move); },
- goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {
- var top = cm.cursorCoords(range.head, "div").top + 5;
- var pos = cm.coordsChar({left: 0, top: top}, "div");
- if (pos.ch < cm.getLine(pos.line).search(/\S/)) { return lineStartSmart(cm, range.head) }
- return pos
- }, sel_move); },
- goLineUp: function (cm) { return cm.moveV(-1, "line"); },
- goLineDown: function (cm) { return cm.moveV(1, "line"); },
- goPageUp: function (cm) { return cm.moveV(-1, "page"); },
- goPageDown: function (cm) { return cm.moveV(1, "page"); },
- goCharLeft: function (cm) { return cm.moveH(-1, "char"); },
- goCharRight: function (cm) { return cm.moveH(1, "char"); },
- goColumnLeft: function (cm) { return cm.moveH(-1, "column"); },
- goColumnRight: function (cm) { return cm.moveH(1, "column"); },
- goWordLeft: function (cm) { return cm.moveH(-1, "word"); },
- goGroupRight: function (cm) { return cm.moveH(1, "group"); },
- goGroupLeft: function (cm) { return cm.moveH(-1, "group"); },
- goWordRight: function (cm) { return cm.moveH(1, "word"); },
- delCharBefore: function (cm) { return cm.deleteH(-1, "codepoint"); },
- delCharAfter: function (cm) { return cm.deleteH(1, "char"); },
- delWordBefore: function (cm) { return cm.deleteH(-1, "word"); },
- delWordAfter: function (cm) { return cm.deleteH(1, "word"); },
- delGroupBefore: function (cm) { return cm.deleteH(-1, "group"); },
- delGroupAfter: function (cm) { return cm.deleteH(1, "group"); },
- indentAuto: function (cm) { return cm.indentSelection("smart"); },
- indentMore: function (cm) { return cm.indentSelection("add"); },
- indentLess: function (cm) { return cm.indentSelection("subtract"); },
- insertTab: function (cm) { return cm.replaceSelection("\t"); },
- insertSoftTab: function (cm) {
- var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;
- for (var i = 0; i < ranges.length; i++) {
- var pos = ranges[i].from();
- var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);
- spaces.push(spaceStr(tabSize - col % tabSize));
- }
- cm.replaceSelections(spaces);
- },
- defaultTab: function (cm) {
- if (cm.somethingSelected()) { cm.indentSelection("add"); }
- else { cm.execCommand("insertTab"); }
- },
- // Swap the two chars left and right of each selection's head.
- // Move cursor behind the two swapped characters afterwards.
- //
- // Doesn't consider line feeds a character.
- // Doesn't scan more than one line above to find a character.
- // Doesn't do anything on an empty line.
- // Doesn't do anything with non-empty selections.
- transposeChars: function (cm) { return runInOp(cm, function () {
- var ranges = cm.listSelections(), newSel = [];
- for (var i = 0; i < ranges.length; i++) {
- if (!ranges[i].empty()) { continue }
- var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;
- if (line) {
- if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }
- if (cur.ch > 0) {
- cur = new Pos(cur.line, cur.ch + 1);
- cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),
- Pos(cur.line, cur.ch - 2), cur, "+transpose");
- } else if (cur.line > cm.doc.first) {
- var prev = getLine(cm.doc, cur.line - 1).text;
- if (prev) {
- cur = new Pos(cur.line, 1);
- cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +
- prev.charAt(prev.length - 1),
- Pos(cur.line - 1, prev.length - 1), cur, "+transpose");
- }
- }
- }
- newSel.push(new Range(cur, cur));
- }
- cm.setSelections(newSel);
- }); },
- newlineAndIndent: function (cm) { return runInOp(cm, function () {
- var sels = cm.listSelections();
- for (var i = sels.length - 1; i >= 0; i--)
- { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, "+input"); }
- sels = cm.listSelections();
- for (var i$1 = 0; i$1 < sels.length; i$1++)
- { cm.indentLine(sels[i$1].from().line, null, true); }
- ensureCursorVisible(cm);
- }); },
- openLine: function (cm) { return cm.replaceSelection("\n", "start"); },
- toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }
- };
- function lineStart(cm, lineN) {
- var line = getLine(cm.doc, lineN);
- var visual = visualLine(line);
- if (visual != line) { lineN = lineNo(visual); }
- return endOfLine(true, cm, visual, lineN, 1)
- }
- function lineEnd(cm, lineN) {
- var line = getLine(cm.doc, lineN);
- var visual = visualLineEnd(line);
- if (visual != line) { lineN = lineNo(visual); }
- return endOfLine(true, cm, line, lineN, -1)
- }
- function lineStartSmart(cm, pos) {
- var start = lineStart(cm, pos.line);
- var line = getLine(cm.doc, start.line);
- var order = getOrder(line, cm.doc.direction);
- if (!order || order[0].level == 0) {
- var firstNonWS = Math.max(start.ch, line.text.search(/\S/));
- var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;
- return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)
- }
- return start
- }
- // Run a handler that was bound to a key.
- function doHandleBinding(cm, bound, dropShift) {
- if (typeof bound == "string") {
- bound = commands[bound];
- if (!bound) { return false }
- }
- // Ensure previous input has been read, so that the handler sees a
- // consistent view of the document
- cm.display.input.ensurePolled();
- var prevShift = cm.display.shift, done = false;
- try {
- if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
- if (dropShift) { cm.display.shift = false; }
- done = bound(cm) != Pass;
- } finally {
- cm.display.shift = prevShift;
- cm.state.suppressEdits = false;
- }
- return done
- }
- function lookupKeyForEditor(cm, name, handle) {
- for (var i = 0; i < cm.state.keyMaps.length; i++) {
- var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);
- if (result) { return result }
- }
- return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))
- || lookupKey(name, cm.options.keyMap, handle, cm)
- }
- // Note that, despite the name, this function is also used to check
- // for bound mouse clicks.
- var stopSeq = new Delayed;
- function dispatchKey(cm, name, e, handle) {
- var seq = cm.state.keySeq;
- if (seq) {
- if (isModifierKey(name)) { return "handled" }
- if (/\'$/.test(name))
- { cm.state.keySeq = null; }
- else
- { stopSeq.set(50, function () {
- if (cm.state.keySeq == seq) {
- cm.state.keySeq = null;
- cm.display.input.reset();
- }
- }); }
- if (dispatchKeyInner(cm, seq + " " + name, e, handle)) { return true }
- }
- return dispatchKeyInner(cm, name, e, handle)
- }
- function dispatchKeyInner(cm, name, e, handle) {
- var result = lookupKeyForEditor(cm, name, handle);
- if (result == "multi")
- { cm.state.keySeq = name; }
- if (result == "handled")
- { signalLater(cm, "keyHandled", cm, name, e); }
- if (result == "handled" || result == "multi") {
- e_preventDefault(e);
- restartBlink(cm);
- }
- return !!result
- }
- // Handle a key from the keydown event.
- function handleKeyBinding(cm, e) {
- var name = keyName(e, true);
- if (!name) { return false }
- if (e.shiftKey && !cm.state.keySeq) {
- // First try to resolve full name (including 'Shift-'). Failing
- // that, see if there is a cursor-motion command (starting with
- // 'go') bound to the keyname without 'Shift-'.
- return dispatchKey(cm, "Shift-" + name, e, function (b) { return doHandleBinding(cm, b, true); })
- || dispatchKey(cm, name, e, function (b) {
- if (typeof b == "string" ? /^go[A-Z]/.test(b) : b.motion)
- { return doHandleBinding(cm, b) }
- })
- } else {
- return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })
- }
- }
- // Handle a key from the keypress event
- function handleCharBinding(cm, e, ch) {
- return dispatchKey(cm, "'" + ch + "'", e, function (b) { return doHandleBinding(cm, b, true); })
- }
- var lastStoppedKey = null;
- function onKeyDown(e) {
- var cm = this;
- if (e.target && e.target != cm.display.input.getField()) { return }
- cm.curOp.focus = activeElt();
- if (signalDOMEvent(cm, e)) { return }
- // IE does strange things with escape.
- if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }
- var code = e.keyCode;
- cm.display.shift = code == 16 || e.shiftKey;
- var handled = handleKeyBinding(cm, e);
- if (presto) {
- lastStoppedKey = handled ? code : null;
- // Opera has no cut event... we try to at least catch the key combo
- if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))
- { cm.replaceSelection("", null, "cut"); }
- }
- if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)
- { document.execCommand("cut"); }
- // Turn mouse into crosshair when Alt is held on Mac.
- if (code == 18 && !/\bCodeMirror-crosshair\b/.test(cm.display.lineDiv.className))
- { showCrossHair(cm); }
- }
- function showCrossHair(cm) {
- var lineDiv = cm.display.lineDiv;
- addClass(lineDiv, "CodeMirror-crosshair");
- function up(e) {
- if (e.keyCode == 18 || !e.altKey) {
- rmClass(lineDiv, "CodeMirror-crosshair");
- off(document, "keyup", up);
- off(document, "mouseover", up);
- }
- }
- on(document, "keyup", up);
- on(document, "mouseover", up);
- }
- function onKeyUp(e) {
- if (e.keyCode == 16) { this.doc.sel.shift = false; }
- signalDOMEvent(this, e);
- }
- function onKeyPress(e) {
- var cm = this;
- if (e.target && e.target != cm.display.input.getField()) { return }
- if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }
- var keyCode = e.keyCode, charCode = e.charCode;
- if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}
- if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }
- var ch = String.fromCharCode(charCode == null ? keyCode : charCode);
- // Some browsers fire keypress events for backspace
- if (ch == "\x08") { return }
- if (handleCharBinding(cm, e, ch)) { return }
- cm.display.input.onKeyPress(e);
- }
- var DOUBLECLICK_DELAY = 400;
- var PastClick = function(time, pos, button) {
- this.time = time;
- this.pos = pos;
- this.button = button;
- };
- PastClick.prototype.compare = function (time, pos, button) {
- return this.time + DOUBLECLICK_DELAY > time &&
- cmp(pos, this.pos) == 0 && button == this.button
- };
- var lastClick, lastDoubleClick;
- function clickRepeat(pos, button) {
- var now = +new Date;
- if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {
- lastClick = lastDoubleClick = null;
- return "triple"
- } else if (lastClick && lastClick.compare(now, pos, button)) {
- lastDoubleClick = new PastClick(now, pos, button);
- lastClick = null;
- return "double"
- } else {
- lastClick = new PastClick(now, pos, button);
- lastDoubleClick = null;
- return "single"
- }
- }
- // A mouse down can be a single click, double click, triple click,
- // start of selection drag, start of text drag, new cursor
- // (ctrl-click), rectangle drag (alt-drag), or xwin
- // middle-click-paste. Or it might be a click on something we should
- // not interfere with, such as a scrollbar or widget.
- function onMouseDown(e) {
- var cm = this, display = cm.display;
- if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }
- display.input.ensurePolled();
- display.shift = e.shiftKey;
- if (eventInWidget(display, e)) {
- if (!webkit) {
- // Briefly turn off draggability, to allow widgets to do
- // normal dragging things.
- display.scroller.draggable = false;
- setTimeout(function () { return display.scroller.draggable = true; }, 100);
- }
- return
- }
- if (clickInGutter(cm, e)) { return }
- var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : "single";
- window.focus();
- // #3261: make sure, that we're not starting a second selection
- if (button == 1 && cm.state.selectingText)
- { cm.state.selectingText(e); }
- if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }
- if (button == 1) {
- if (pos) { leftButtonDown(cm, pos, repeat, e); }
- else if (e_target(e) == display.scroller) { e_preventDefault(e); }
- } else if (button == 2) {
- if (pos) { extendSelection(cm.doc, pos); }
- setTimeout(function () { return display.input.focus(); }, 20);
- } else if (button == 3) {
- if (captureRightClick) { cm.display.input.onContextMenu(e); }
- else { delayBlurEvent(cm); }
- }
- }
- function handleMappedButton(cm, button, pos, repeat, event) {
- var name = "Click";
- if (repeat == "double") { name = "Double" + name; }
- else if (repeat == "triple") { name = "Triple" + name; }
- name = (button == 1 ? "Left" : button == 2 ? "Middle" : "Right") + name;
- return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {
- if (typeof bound == "string") { bound = commands[bound]; }
- if (!bound) { return false }
- var done = false;
- try {
- if (cm.isReadOnly()) { cm.state.suppressEdits = true; }
- done = bound(cm, pos) != Pass;
- } finally {
- cm.state.suppressEdits = false;
- }
- return done
- })
- }
- function configureMouse(cm, repeat, event) {
- var option = cm.getOption("configureMouse");
- var value = option ? option(cm, repeat, event) : {};
- if (value.unit == null) {
- var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;
- value.unit = rect ? "rectangle" : repeat == "single" ? "char" : repeat == "double" ? "word" : "line";
- }
- if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }
- if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }
- if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }
- return value
- }
- function leftButtonDown(cm, pos, repeat, event) {
- if (ie) { setTimeout(bind(ensureFocus, cm), 0); }
- else { cm.curOp.focus = activeElt(); }
- var behavior = configureMouse(cm, repeat, event);
- var sel = cm.doc.sel, contained;
- if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&
- repeat == "single" && (contained = sel.contains(pos)) > -1 &&
- (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&
- (cmp(contained.to(), pos) > 0 || pos.xRel < 0))
- { leftButtonStartDrag(cm, event, pos, behavior); }
- else
- { leftButtonSelect(cm, event, pos, behavior); }
- }
- // Start a text drag. When it ends, see if any dragging actually
- // happen, and treat as a click if it didn't.
- function leftButtonStartDrag(cm, event, pos, behavior) {
- var display = cm.display, moved = false;
- var dragEnd = operation(cm, function (e) {
- if (webkit) { display.scroller.draggable = false; }
- cm.state.draggingText = false;
- off(display.wrapper.ownerDocument, "mouseup", dragEnd);
- off(display.wrapper.ownerDocument, "mousemove", mouseMove);
- off(display.scroller, "dragstart", dragStart);
- off(display.scroller, "drop", dragEnd);
- if (!moved) {
- e_preventDefault(e);
- if (!behavior.addNew)
- { extendSelection(cm.doc, pos, null, null, behavior.extend); }
- // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)
- if ((webkit && !safari) || ie && ie_version == 9)
- { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }
- else
- { display.input.focus(); }
- }
- });
- var mouseMove = function(e2) {
- moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;
- };
- var dragStart = function () { return moved = true; };
- // Let the drag handler handle this.
- if (webkit) { display.scroller.draggable = true; }
- cm.state.draggingText = dragEnd;
- dragEnd.copy = !behavior.moveOnDrag;
- // IE's approach to draggable
- if (display.scroller.dragDrop) { display.scroller.dragDrop(); }
- on(display.wrapper.ownerDocument, "mouseup", dragEnd);
- on(display.wrapper.ownerDocument, "mousemove", mouseMove);
- on(display.scroller, "dragstart", dragStart);
- on(display.scroller, "drop", dragEnd);
- delayBlurEvent(cm);
- setTimeout(function () { return display.input.focus(); }, 20);
- }
- function rangeForUnit(cm, pos, unit) {
- if (unit == "char") { return new Range(pos, pos) }
- if (unit == "word") { return cm.findWordAt(pos) }
- if (unit == "line") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }
- var result = unit(cm, pos);
- return new Range(result.from, result.to)
- }
- // Normal selection, as opposed to text dragging.
- function leftButtonSelect(cm, event, start, behavior) {
- var display = cm.display, doc = cm.doc;
- e_preventDefault(event);
- var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;
- if (behavior.addNew && !behavior.extend) {
- ourIndex = doc.sel.contains(start);
- if (ourIndex > -1)
- { ourRange = ranges[ourIndex]; }
- else
- { ourRange = new Range(start, start); }
- } else {
- ourRange = doc.sel.primary();
- ourIndex = doc.sel.primIndex;
- }
- if (behavior.unit == "rectangle") {
- if (!behavior.addNew) { ourRange = new Range(start, start); }
- start = posFromMouse(cm, event, true, true);
- ourIndex = -1;
- } else {
- var range = rangeForUnit(cm, start, behavior.unit);
- if (behavior.extend)
- { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }
- else
- { ourRange = range; }
- }
- if (!behavior.addNew) {
- ourIndex = 0;
- setSelection(doc, new Selection([ourRange], 0), sel_mouse);
- startSel = doc.sel;
- } else if (ourIndex == -1) {
- ourIndex = ranges.length;
- setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),
- {scroll: false, origin: "*mouse"});
- } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == "char" && !behavior.extend) {
- setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),
- {scroll: false, origin: "*mouse"});
- startSel = doc.sel;
- } else {
- replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);
- }
- var lastPos = start;
- function extendTo(pos) {
- if (cmp(lastPos, pos) == 0) { return }
- lastPos = pos;
- if (behavior.unit == "rectangle") {
- var ranges = [], tabSize = cm.options.tabSize;
- var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);
- var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);
- var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);
- for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));
- line <= end; line++) {
- var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);
- if (left == right)
- { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }
- else if (text.length > leftPos)
- { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }
- }
- if (!ranges.length) { ranges.push(new Range(start, start)); }
- setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),
- {origin: "*mouse", scroll: false});
- cm.scrollIntoView(pos);
- } else {
- var oldRange = ourRange;
- var range = rangeForUnit(cm, pos, behavior.unit);
- var anchor = oldRange.anchor, head;
- if (cmp(range.anchor, anchor) > 0) {
- head = range.head;
- anchor = minPos(oldRange.from(), range.anchor);
- } else {
- head = range.anchor;
- anchor = maxPos(oldRange.to(), range.head);
- }
- var ranges$1 = startSel.ranges.slice(0);
- ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));
- setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);
- }
- }
- var editorSize = display.wrapper.getBoundingClientRect();
- // Used to ensure timeout re-tries don't fire when another extend
- // happened in the meantime (clearTimeout isn't reliable -- at
- // least on Chrome, the timeouts still happen even when cleared,
- // if the clear happens after their scheduled firing time).
- var counter = 0;
- function extend(e) {
- var curCount = ++counter;
- var cur = posFromMouse(cm, e, true, behavior.unit == "rectangle");
- if (!cur) { return }
- if (cmp(cur, lastPos) != 0) {
- cm.curOp.focus = activeElt();
- extendTo(cur);
- var visible = visibleLines(display, doc);
- if (cur.line >= visible.to || cur.line < visible.from)
- { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }
- } else {
- var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;
- if (outside) { setTimeout(operation(cm, function () {
- if (counter != curCount) { return }
- display.scroller.scrollTop += outside;
- extend(e);
- }), 50); }
- }
- }
- function done(e) {
- cm.state.selectingText = false;
- counter = Infinity;
- // If e is null or undefined we interpret this as someone trying
- // to explicitly cancel the selection rather than the user
- // letting go of the mouse button.
- if (e) {
- e_preventDefault(e);
- display.input.focus();
- }
- off(display.wrapper.ownerDocument, "mousemove", move);
- off(display.wrapper.ownerDocument, "mouseup", up);
- doc.history.lastSelOrigin = null;
- }
- var move = operation(cm, function (e) {
- if (e.buttons === 0 || !e_button(e)) { done(e); }
- else { extend(e); }
- });
- var up = operation(cm, done);
- cm.state.selectingText = up;
- on(display.wrapper.ownerDocument, "mousemove", move);
- on(display.wrapper.ownerDocument, "mouseup", up);
- }
- // Used when mouse-selecting to adjust the anchor to the proper side
- // of a bidi jump depending on the visual position of the head.
- function bidiSimplify(cm, range) {
- var anchor = range.anchor;
- var head = range.head;
- var anchorLine = getLine(cm.doc, anchor.line);
- if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }
- var order = getOrder(anchorLine);
- if (!order) { return range }
- var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];
- if (part.from != anchor.ch && part.to != anchor.ch) { return range }
- var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);
- if (boundary == 0 || boundary == order.length) { return range }
- // Compute the relative visual position of the head compared to the
- // anchor (<0 is to the left, >0 to the right)
- var leftSide;
- if (head.line != anchor.line) {
- leftSide = (head.line - anchor.line) * (cm.doc.direction == "ltr" ? 1 : -1) > 0;
- } else {
- var headIndex = getBidiPartAt(order, head.ch, head.sticky);
- var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);
- if (headIndex == boundary - 1 || headIndex == boundary)
- { leftSide = dir < 0; }
- else
- { leftSide = dir > 0; }
- }
- var usePart = order[boundary + (leftSide ? -1 : 0)];
- var from = leftSide == (usePart.level == 1);
- var ch = from ? usePart.from : usePart.to, sticky = from ? "after" : "before";
- return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)
- }
- // Determines whether an event happened in the gutter, and fires the
- // handlers for the corresponding event.
- function gutterEvent(cm, e, type, prevent) {
- var mX, mY;
- if (e.touches) {
- mX = e.touches[0].clientX;
- mY = e.touches[0].clientY;
- } else {
- try { mX = e.clientX; mY = e.clientY; }
- catch(e$1) { return false }
- }
- if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }
- if (prevent) { e_preventDefault(e); }
- var display = cm.display;
- var lineBox = display.lineDiv.getBoundingClientRect();
- if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }
- mY -= lineBox.top - display.viewOffset;
- for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {
- var g = display.gutters.childNodes[i];
- if (g && g.getBoundingClientRect().right >= mX) {
- var line = lineAtHeight(cm.doc, mY);
- var gutter = cm.display.gutterSpecs[i];
- signal(cm, type, cm, line, gutter.className, e);
- return e_defaultPrevented(e)
- }
- }
- }
- function clickInGutter(cm, e) {
- return gutterEvent(cm, e, "gutterClick", true)
- }
- // CONTEXT MENU HANDLING
- // To make the context menu work, we need to briefly unhide the
- // textarea (making it as unobtrusive as possible) to let the
- // right-click take effect on it.
- function onContextMenu(cm, e) {
- if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }
- if (signalDOMEvent(cm, e, "contextmenu")) { return }
- if (!captureRightClick) { cm.display.input.onContextMenu(e); }
- }
- function contextMenuInGutter(cm, e) {
- if (!hasHandler(cm, "gutterContextMenu")) { return false }
- return gutterEvent(cm, e, "gutterContextMenu", false)
- }
- function themeChanged(cm) {
- cm.display.wrapper.className = cm.display.wrapper.className.replace(/\s*cm-s-\S+/g, "") +
- cm.options.theme.replace(/(^|\s)\s*/g, " cm-s-");
- clearCaches(cm);
- }
- var Init = {toString: function(){return "CodeMirror.Init"}};
- var defaults = {};
- var optionHandlers = {};
- function defineOptions(CodeMirror) {
- var optionHandlers = CodeMirror.optionHandlers;
- function option(name, deflt, handle, notOnInit) {
- CodeMirror.defaults[name] = deflt;
- if (handle) { optionHandlers[name] =
- notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }
- }
- CodeMirror.defineOption = option;
- // Passed to option handlers when there is no old value.
- CodeMirror.Init = Init;
- // These two are, on init, called from the constructor because they
- // have to be initialized before the editor can start at all.
- option("value", "", function (cm, val) { return cm.setValue(val); }, true);
- option("mode", null, function (cm, val) {
- cm.doc.modeOption = val;
- loadMode(cm);
- }, true);
- option("indentUnit", 2, loadMode, true);
- option("indentWithTabs", false);
- option("smartIndent", true);
- option("tabSize", 4, function (cm) {
- resetModeState(cm);
- clearCaches(cm);
- regChange(cm);
- }, true);
- option("lineSeparator", null, function (cm, val) {
- cm.doc.lineSep = val;
- if (!val) { return }
- var newBreaks = [], lineNo = cm.doc.first;
- cm.doc.iter(function (line) {
- for (var pos = 0;;) {
- var found = line.text.indexOf(val, pos);
- if (found == -1) { break }
- pos = found + val.length;
- newBreaks.push(Pos(lineNo, found));
- }
- lineNo++;
- });
- for (var i = newBreaks.length - 1; i >= 0; i--)
- { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }
- });
- option("specialChars", /[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200c\u200e\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g, function (cm, val, old) {
- cm.state.specialChars = new RegExp(val.source + (val.test("\t") ? "" : "|\t"), "g");
- if (old != Init) { cm.refresh(); }
- });
- option("specialCharPlaceholder", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);
- option("electricChars", true);
- option("inputStyle", mobile ? "contenteditable" : "textarea", function () {
- throw new Error("inputStyle can not (yet) be changed in a running editor") // FIXME
- }, true);
- option("spellcheck", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);
- option("autocorrect", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);
- option("autocapitalize", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);
- option("rtlMoveVisually", !windows);
- option("wholeLineUpdateBefore", true);
- option("theme", "default", function (cm) {
- themeChanged(cm);
- updateGutters(cm);
- }, true);
- option("keyMap", "default", function (cm, val, old) {
- var next = getKeyMap(val);
- var prev = old != Init && getKeyMap(old);
- if (prev && prev.detach) { prev.detach(cm, next); }
- if (next.attach) { next.attach(cm, prev || null); }
- });
- option("extraKeys", null);
- option("configureMouse", null);
- option("lineWrapping", false, wrappingChanged, true);
- option("gutters", [], function (cm, val) {
- cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);
- updateGutters(cm);
- }, true);
- option("fixedGutter", true, function (cm, val) {
- cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + "px" : "0";
- cm.refresh();
- }, true);
- option("coverGutterNextToScrollbar", false, function (cm) { return updateScrollbars(cm); }, true);
- option("scrollbarStyle", "native", function (cm) {
- initScrollbars(cm);
- updateScrollbars(cm);
- cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);
- cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);
- }, true);
- option("lineNumbers", false, function (cm, val) {
- cm.display.gutterSpecs = getGutters(cm.options.gutters, val);
- updateGutters(cm);
- }, true);
- option("firstLineNumber", 1, updateGutters, true);
- option("lineNumberFormatter", function (integer) { return integer; }, updateGutters, true);
- option("showCursorWhenSelecting", false, updateSelection, true);
- option("resetSelectionOnContextMenu", true);
- option("lineWiseCopyCut", true);
- option("pasteLinesPerSelection", true);
- option("selectionsMayTouch", false);
- option("readOnly", false, function (cm, val) {
- if (val == "nocursor") {
- onBlur(cm);
- cm.display.input.blur();
- }
- cm.display.input.readOnlyChanged(val);
- });
- option("screenReaderLabel", null, function (cm, val) {
- val = (val === '') ? null : val;
- cm.display.input.screenReaderLabelChanged(val);
- });
- option("disableInput", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);
- option("dragDrop", true, dragDropChanged);
- option("allowDropFileTypes", null);
- option("cursorBlinkRate", 530);
- option("cursorScrollMargin", 0);
- option("cursorHeight", 1, updateSelection, true);
- option("singleCursorHeightPerLine", true, updateSelection, true);
- option("workTime", 100);
- option("workDelay", 100);
- option("flattenSpans", true, resetModeState, true);
- option("addModeClass", false, resetModeState, true);
- option("pollInterval", 100);
- option("undoDepth", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });
- option("historyEventDelay", 1250);
- option("viewportMargin", 10, function (cm) { return cm.refresh(); }, true);
- option("maxHighlightLength", 10000, resetModeState, true);
- option("moveInputWithCursor", true, function (cm, val) {
- if (!val) { cm.display.input.resetPosition(); }
- });
- option("tabindex", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || ""; });
- option("autofocus", null);
- option("direction", "ltr", function (cm, val) { return cm.doc.setDirection(val); }, true);
- option("phrases", null);
- }
- function dragDropChanged(cm, value, old) {
- var wasOn = old && old != Init;
- if (!value != !wasOn) {
- var funcs = cm.display.dragFunctions;
- var toggle = value ? on : off;
- toggle(cm.display.scroller, "dragstart", funcs.start);
- toggle(cm.display.scroller, "dragenter", funcs.enter);
- toggle(cm.display.scroller, "dragover", funcs.over);
- toggle(cm.display.scroller, "dragleave", funcs.leave);
- toggle(cm.display.scroller, "drop", funcs.drop);
- }
- }
- function wrappingChanged(cm) {
- if (cm.options.lineWrapping) {
- addClass(cm.display.wrapper, "CodeMirror-wrap");
- cm.display.sizer.style.minWidth = "";
- cm.display.sizerWidth = null;
- } else {
- rmClass(cm.display.wrapper, "CodeMirror-wrap");
- findMaxLine(cm);
- }
- estimateLineHeights(cm);
- regChange(cm);
- clearCaches(cm);
- setTimeout(function () { return updateScrollbars(cm); }, 100);
- }
- // A CodeMirror instance represents an editor. This is the object
- // that user code is usually dealing with.
- function CodeMirror(place, options) {
- var this$1 = this;
- if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }
- this.options = options = options ? copyObj(options) : {};
- // Determine effective options based on given values and defaults.
- copyObj(defaults, options, false);
- var doc = options.value;
- if (typeof doc == "string") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }
- else if (options.mode) { doc.modeOption = options.mode; }
- this.doc = doc;
- var input = new CodeMirror.inputStyles[options.inputStyle](this);
- var display = this.display = new Display(place, doc, input, options);
- display.wrapper.CodeMirror = this;
- themeChanged(this);
- if (options.lineWrapping)
- { this.display.wrapper.className += " CodeMirror-wrap"; }
- initScrollbars(this);
- this.state = {
- keyMaps: [], // stores maps added by addKeyMap
- overlays: [], // highlighting overlays, as added by addOverlay
- modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info
- overwrite: false,
- delayingBlurEvent: false,
- focused: false,
- suppressEdits: false, // used to disable editing during key handlers when in readOnly mode
- pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll
- selectingText: false,
- draggingText: false,
- highlight: new Delayed(), // stores highlight worker timeout
- keySeq: null, // Unfinished key sequence
- specialChars: null
- };
- if (options.autofocus && !mobile) { display.input.focus(); }
- // Override magic textarea content restore that IE sometimes does
- // on our hidden textarea on reload
- if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }
- registerEventHandlers(this);
- ensureGlobalHandlers();
- startOperation(this);
- this.curOp.forceUpdate = true;
- attachDoc(this, doc);
- if ((options.autofocus && !mobile) || this.hasFocus())
- { setTimeout(function () {
- if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }
- }, 20); }
- else
- { onBlur(this); }
- for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))
- { optionHandlers[opt](this, options[opt], Init); } }
- maybeUpdateLineNumberWidth(this);
- if (options.finishInit) { options.finishInit(this); }
- for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }
- endOperation(this);
- // Suppress optimizelegibility in Webkit, since it breaks text
- // measuring on line wrapping boundaries.
- if (webkit && options.lineWrapping &&
- getComputedStyle(display.lineDiv).textRendering == "optimizelegibility")
- { display.lineDiv.style.textRendering = "auto"; }
- }
- // The default configuration options.
- CodeMirror.defaults = defaults;
- // Functions to run when options are changed.
- CodeMirror.optionHandlers = optionHandlers;
- // Attach the necessary event handlers when initializing the editor
- function registerEventHandlers(cm) {
- var d = cm.display;
- on(d.scroller, "mousedown", operation(cm, onMouseDown));
- // Older IE's will not fire a second mousedown for a double click
- if (ie && ie_version < 11)
- { on(d.scroller, "dblclick", operation(cm, function (e) {
- if (signalDOMEvent(cm, e)) { return }
- var pos = posFromMouse(cm, e);
- if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }
- e_preventDefault(e);
- var word = cm.findWordAt(pos);
- extendSelection(cm.doc, word.anchor, word.head);
- })); }
- else
- { on(d.scroller, "dblclick", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }
- // Some browsers fire contextmenu *after* opening the menu, at
- // which point we can't mess with it anymore. Context menu is
- // handled in onMouseDown for these browsers.
- on(d.scroller, "contextmenu", function (e) { return onContextMenu(cm, e); });
- on(d.input.getField(), "contextmenu", function (e) {
- if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }
- });
- // Used to suppress mouse event handling when a touch happens
- var touchFinished, prevTouch = {end: 0};
- function finishTouch() {
- if (d.activeTouch) {
- touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);
- prevTouch = d.activeTouch;
- prevTouch.end = +new Date;
- }
- }
- function isMouseLikeTouchEvent(e) {
- if (e.touches.length != 1) { return false }
- var touch = e.touches[0];
- return touch.radiusX <= 1 && touch.radiusY <= 1
- }
- function farAway(touch, other) {
- if (other.left == null) { return true }
- var dx = other.left - touch.left, dy = other.top - touch.top;
- return dx * dx + dy * dy > 20 * 20
- }
- on(d.scroller, "touchstart", function (e) {
- if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {
- d.input.ensurePolled();
- clearTimeout(touchFinished);
- var now = +new Date;
- d.activeTouch = {start: now, moved: false,
- prev: now - prevTouch.end <= 300 ? prevTouch : null};
- if (e.touches.length == 1) {
- d.activeTouch.left = e.touches[0].pageX;
- d.activeTouch.top = e.touches[0].pageY;
- }
- }
- });
- on(d.scroller, "touchmove", function () {
- if (d.activeTouch) { d.activeTouch.moved = true; }
- });
- on(d.scroller, "touchend", function (e) {
- var touch = d.activeTouch;
- if (touch && !eventInWidget(d, e) && touch.left != null &&
- !touch.moved && new Date - touch.start < 300) {
- var pos = cm.coordsChar(d.activeTouch, "page"), range;
- if (!touch.prev || farAway(touch, touch.prev)) // Single tap
- { range = new Range(pos, pos); }
- else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap
- { range = cm.findWordAt(pos); }
- else // Triple tap
- { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }
- cm.setSelection(range.anchor, range.head);
- cm.focus();
- e_preventDefault(e);
- }
- finishTouch();
- });
- on(d.scroller, "touchcancel", finishTouch);
- // Sync scrolling between fake scrollbars and real scrollable
- // area, ensure viewport is updated when scrolling.
- on(d.scroller, "scroll", function () {
- if (d.scroller.clientHeight) {
- updateScrollTop(cm, d.scroller.scrollTop);
- setScrollLeft(cm, d.scroller.scrollLeft, true);
- signal(cm, "scroll", cm);
- }
- });
- // Listen to wheel events in order to try and update the viewport on time.
- on(d.scroller, "mousewheel", function (e) { return onScrollWheel(cm, e); });
- on(d.scroller, "DOMMouseScroll", function (e) { return onScrollWheel(cm, e); });
- // Prevent wrapper from ever scrolling
- on(d.wrapper, "scroll", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });
- d.dragFunctions = {
- enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},
- over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},
- start: function (e) { return onDragStart(cm, e); },
- drop: operation(cm, onDrop),
- leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}
- };
- var inp = d.input.getField();
- on(inp, "keyup", function (e) { return onKeyUp.call(cm, e); });
- on(inp, "keydown", operation(cm, onKeyDown));
- on(inp, "keypress", operation(cm, onKeyPress));
- on(inp, "focus", function (e) { return onFocus(cm, e); });
- on(inp, "blur", function (e) { return onBlur(cm, e); });
- }
- var initHooks = [];
- CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };
- // Indent the given line. The how parameter can be "smart",
- // "add"/null, "subtract", or "prev". When aggressive is false
- // (typically set to true for forced single-line indents), empty
- // lines are not indented, and places where the mode returns Pass
- // are left alone.
- function indentLine(cm, n, how, aggressive) {
- var doc = cm.doc, state;
- if (how == null) { how = "add"; }
- if (how == "smart") {
- // Fall back to "prev" when the mode doesn't have an indentation
- // method.
- if (!doc.mode.indent) { how = "prev"; }
- else { state = getContextBefore(cm, n).state; }
- }
- var tabSize = cm.options.tabSize;
- var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);
- if (line.stateAfter) { line.stateAfter = null; }
- var curSpaceString = line.text.match(/^\s*/)[0], indentation;
- if (!aggressive && !/\S/.test(line.text)) {
- indentation = 0;
- how = "not";
- } else if (how == "smart") {
- indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);
- if (indentation == Pass || indentation > 150) {
- if (!aggressive) { return }
- how = "prev";
- }
- }
- if (how == "prev") {
- if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }
- else { indentation = 0; }
- } else if (how == "add") {
- indentation = curSpace + cm.options.indentUnit;
- } else if (how == "subtract") {
- indentation = curSpace - cm.options.indentUnit;
- } else if (typeof how == "number") {
- indentation = curSpace + how;
- }
- indentation = Math.max(0, indentation);
- var indentString = "", pos = 0;
- if (cm.options.indentWithTabs)
- { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += "\t";} }
- if (pos < indentation) { indentString += spaceStr(indentation - pos); }
- if (indentString != curSpaceString) {
- replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), "+input");
- line.stateAfter = null;
- return true
- } else {
- // Ensure that, if the cursor was in the whitespace at the start
- // of the line, it is moved to the end of that space.
- for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {
- var range = doc.sel.ranges[i$1];
- if (range.head.line == n && range.head.ch < curSpaceString.length) {
- var pos$1 = Pos(n, curSpaceString.length);
- replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));
- break
- }
- }
- }
- }
- // This will be set to a {lineWise: bool, text: [string]} object, so
- // that, when pasting, we know what kind of selections the copied
- // text was made out of.
- var lastCopied = null;
- function setLastCopied(newLastCopied) {
- lastCopied = newLastCopied;
- }
- function applyTextInput(cm, inserted, deleted, sel, origin) {
- var doc = cm.doc;
- cm.display.shift = false;
- if (!sel) { sel = doc.sel; }
- var recent = +new Date - 200;
- var paste = origin == "paste" || cm.state.pasteIncoming > recent;
- var textLines = splitLinesAuto(inserted), multiPaste = null;
- // When pasting N lines into N selections, insert one line per selection
- if (paste && sel.ranges.length > 1) {
- if (lastCopied && lastCopied.text.join("\n") == inserted) {
- if (sel.ranges.length % lastCopied.text.length == 0) {
- multiPaste = [];
- for (var i = 0; i < lastCopied.text.length; i++)
- { multiPaste.push(doc.splitLines(lastCopied.text[i])); }
- }
- } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {
- multiPaste = map(textLines, function (l) { return [l]; });
- }
- }
- var updateInput = cm.curOp.updateInput;
- // Normal behavior is to insert the new text into every selection
- for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {
- var range = sel.ranges[i$1];
- var from = range.from(), to = range.to();
- if (range.empty()) {
- if (deleted && deleted > 0) // Handle deletion
- { from = Pos(from.line, from.ch - deleted); }
- else if (cm.state.overwrite && !paste) // Handle overwrite
- { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }
- else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join("\n") == textLines.join("\n"))
- { from = to = Pos(from.line, 0); }
- }
- var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,
- origin: origin || (paste ? "paste" : cm.state.cutIncoming > recent ? "cut" : "+input")};
- makeChange(cm.doc, changeEvent);
- signalLater(cm, "inputRead", cm, changeEvent);
- }
- if (inserted && !paste)
- { triggerElectric(cm, inserted); }
- ensureCursorVisible(cm);
- if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }
- cm.curOp.typing = true;
- cm.state.pasteIncoming = cm.state.cutIncoming = -1;
- }
- function handlePaste(e, cm) {
- var pasted = e.clipboardData && e.clipboardData.getData("Text");
- if (pasted) {
- e.preventDefault();
- if (!cm.isReadOnly() && !cm.options.disableInput)
- { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, "paste"); }); }
- return true
- }
- }
- function triggerElectric(cm, inserted) {
- // When an 'electric' character is inserted, immediately trigger a reindent
- if (!cm.options.electricChars || !cm.options.smartIndent) { return }
- var sel = cm.doc.sel;
- for (var i = sel.ranges.length - 1; i >= 0; i--) {
- var range = sel.ranges[i];
- if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }
- var mode = cm.getModeAt(range.head);
- var indented = false;
- if (mode.electricChars) {
- for (var j = 0; j < mode.electricChars.length; j++)
- { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {
- indented = indentLine(cm, range.head.line, "smart");
- break
- } }
- } else if (mode.electricInput) {
- if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))
- { indented = indentLine(cm, range.head.line, "smart"); }
- }
- if (indented) { signalLater(cm, "electricInput", cm, range.head.line); }
- }
- }
- function copyableRanges(cm) {
- var text = [], ranges = [];
- for (var i = 0; i < cm.doc.sel.ranges.length; i++) {
- var line = cm.doc.sel.ranges[i].head.line;
- var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};
- ranges.push(lineRange);
- text.push(cm.getRange(lineRange.anchor, lineRange.head));
- }
- return {text: text, ranges: ranges}
- }
- function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {
- field.setAttribute("autocorrect", autocorrect ? "" : "off");
- field.setAttribute("autocapitalize", autocapitalize ? "" : "off");
- field.setAttribute("spellcheck", !!spellcheck);
- }
- function hiddenTextarea() {
- var te = elt("textarea", null, null, "position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none");
- var div = elt("div", [te], null, "overflow: hidden; position: relative; width: 3px; height: 0px;");
- // The textarea is kept positioned near the cursor to prevent the
- // fact that it'll be scrolled into view on input from scrolling
- // our fake cursor out of view. On webkit, when wrap=off, paste is
- // very slow. So make the area wide instead.
- if (webkit) { te.style.width = "1000px"; }
- else { te.setAttribute("wrap", "off"); }
- // If border: 0; -- iOS fails to open keyboard (issue #1287)
- if (ios) { te.style.border = "1px solid black"; }
- disableBrowserMagic(te);
- return div
- }
- // The publicly visible API. Note that methodOp(f) means
- // 'wrap f in an operation, performed on its `this` parameter'.
- // This is not the complete set of editor methods. Most of the
- // methods defined on the Doc type are also injected into
- // CodeMirror.prototype, for backwards compatibility and
- // convenience.
- function addEditorMethods(CodeMirror) {
- var optionHandlers = CodeMirror.optionHandlers;
- var helpers = CodeMirror.helpers = {};
- CodeMirror.prototype = {
- constructor: CodeMirror,
- focus: function(){window.focus(); this.display.input.focus();},
- setOption: function(option, value) {
- var options = this.options, old = options[option];
- if (options[option] == value && option != "mode") { return }
- options[option] = value;
- if (optionHandlers.hasOwnProperty(option))
- { operation(this, optionHandlers[option])(this, value, old); }
- signal(this, "optionChange", this, option);
- },
- getOption: function(option) {return this.options[option]},
- getDoc: function() {return this.doc},
- addKeyMap: function(map, bottom) {
- this.state.keyMaps[bottom ? "push" : "unshift"](getKeyMap(map));
- },
- removeKeyMap: function(map) {
- var maps = this.state.keyMaps;
- for (var i = 0; i < maps.length; ++i)
- { if (maps[i] == map || maps[i].name == map) {
- maps.splice(i, 1);
- return true
- } }
- },
- addOverlay: methodOp(function(spec, options) {
- var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);
- if (mode.startState) { throw new Error("Overlays may not be stateful.") }
- insertSorted(this.state.overlays,
- {mode: mode, modeSpec: spec, opaque: options && options.opaque,
- priority: (options && options.priority) || 0},
- function (overlay) { return overlay.priority; });
- this.state.modeGen++;
- regChange(this);
- }),
- removeOverlay: methodOp(function(spec) {
- var overlays = this.state.overlays;
- for (var i = 0; i < overlays.length; ++i) {
- var cur = overlays[i].modeSpec;
- if (cur == spec || typeof spec == "string" && cur.name == spec) {
- overlays.splice(i, 1);
- this.state.modeGen++;
- regChange(this);
- return
- }
- }
- }),
- indentLine: methodOp(function(n, dir, aggressive) {
- if (typeof dir != "string" && typeof dir != "number") {
- if (dir == null) { dir = this.options.smartIndent ? "smart" : "prev"; }
- else { dir = dir ? "add" : "subtract"; }
- }
- if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }
- }),
- indentSelection: methodOp(function(how) {
- var ranges = this.doc.sel.ranges, end = -1;
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i];
- if (!range.empty()) {
- var from = range.from(), to = range.to();
- var start = Math.max(end, from.line);
- end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;
- for (var j = start; j < end; ++j)
- { indentLine(this, j, how); }
- var newRanges = this.doc.sel.ranges;
- if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)
- { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }
- } else if (range.head.line > end) {
- indentLine(this, range.head.line, how, true);
- end = range.head.line;
- if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }
- }
- }
- }),
- // Fetch the parser token for a given character. Useful for hacks
- // that want to inspect the mode state (say, for completion).
- getTokenAt: function(pos, precise) {
- return takeToken(this, pos, precise)
- },
- getLineTokens: function(line, precise) {
- return takeToken(this, Pos(line), precise, true)
- },
- getTokenTypeAt: function(pos) {
- pos = clipPos(this.doc, pos);
- var styles = getLineStyles(this, getLine(this.doc, pos.line));
- var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;
- var type;
- if (ch == 0) { type = styles[2]; }
- else { for (;;) {
- var mid = (before + after) >> 1;
- if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }
- else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }
- else { type = styles[mid * 2 + 2]; break }
- } }
- var cut = type ? type.indexOf("overlay ") : -1;
- return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)
- },
- getModeAt: function(pos) {
- var mode = this.doc.mode;
- if (!mode.innerMode) { return mode }
- return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode
- },
- getHelper: function(pos, type) {
- return this.getHelpers(pos, type)[0]
- },
- getHelpers: function(pos, type) {
- var found = [];
- if (!helpers.hasOwnProperty(type)) { return found }
- var help = helpers[type], mode = this.getModeAt(pos);
- if (typeof mode[type] == "string") {
- if (help[mode[type]]) { found.push(help[mode[type]]); }
- } else if (mode[type]) {
- for (var i = 0; i < mode[type].length; i++) {
- var val = help[mode[type][i]];
- if (val) { found.push(val); }
- }
- } else if (mode.helperType && help[mode.helperType]) {
- found.push(help[mode.helperType]);
- } else if (help[mode.name]) {
- found.push(help[mode.name]);
- }
- for (var i$1 = 0; i$1 < help._global.length; i$1++) {
- var cur = help._global[i$1];
- if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)
- { found.push(cur.val); }
- }
- return found
- },
- getStateAfter: function(line, precise) {
- var doc = this.doc;
- line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);
- return getContextBefore(this, line + 1, precise).state
- },
- cursorCoords: function(start, mode) {
- var pos, range = this.doc.sel.primary();
- if (start == null) { pos = range.head; }
- else if (typeof start == "object") { pos = clipPos(this.doc, start); }
- else { pos = start ? range.from() : range.to(); }
- return cursorCoords(this, pos, mode || "page")
- },
- charCoords: function(pos, mode) {
- return charCoords(this, clipPos(this.doc, pos), mode || "page")
- },
- coordsChar: function(coords, mode) {
- coords = fromCoordSystem(this, coords, mode || "page");
- return coordsChar(this, coords.left, coords.top)
- },
- lineAtHeight: function(height, mode) {
- height = fromCoordSystem(this, {top: height, left: 0}, mode || "page").top;
- return lineAtHeight(this.doc, height + this.display.viewOffset)
- },
- heightAtLine: function(line, mode, includeWidgets) {
- var end = false, lineObj;
- if (typeof line == "number") {
- var last = this.doc.first + this.doc.size - 1;
- if (line < this.doc.first) { line = this.doc.first; }
- else if (line > last) { line = last; end = true; }
- lineObj = getLine(this.doc, line);
- } else {
- lineObj = line;
- }
- return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || "page", includeWidgets || end).top +
- (end ? this.doc.height - heightAtLine(lineObj) : 0)
- },
- defaultTextHeight: function() { return textHeight(this.display) },
- defaultCharWidth: function() { return charWidth(this.display) },
- getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},
- addWidget: function(pos, node, scroll, vert, horiz) {
- var display = this.display;
- pos = cursorCoords(this, clipPos(this.doc, pos));
- var top = pos.bottom, left = pos.left;
- node.style.position = "absolute";
- node.setAttribute("cm-ignore-events", "true");
- this.display.input.setUneditable(node);
- display.sizer.appendChild(node);
- if (vert == "over") {
- top = pos.top;
- } else if (vert == "above" || vert == "near") {
- var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),
- hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);
- // Default to positioning above (if specified and possible); otherwise default to positioning below
- if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)
- { top = pos.top - node.offsetHeight; }
- else if (pos.bottom + node.offsetHeight <= vspace)
- { top = pos.bottom; }
- if (left + node.offsetWidth > hspace)
- { left = hspace - node.offsetWidth; }
- }
- node.style.top = top + "px";
- node.style.left = node.style.right = "";
- if (horiz == "right") {
- left = display.sizer.clientWidth - node.offsetWidth;
- node.style.right = "0px";
- } else {
- if (horiz == "left") { left = 0; }
- else if (horiz == "middle") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }
- node.style.left = left + "px";
- }
- if (scroll)
- { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }
- },
- triggerOnKeyDown: methodOp(onKeyDown),
- triggerOnKeyPress: methodOp(onKeyPress),
- triggerOnKeyUp: onKeyUp,
- triggerOnMouseDown: methodOp(onMouseDown),
- execCommand: function(cmd) {
- if (commands.hasOwnProperty(cmd))
- { return commands[cmd].call(null, this) }
- },
- triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),
- findPosH: function(from, amount, unit, visually) {
- var dir = 1;
- if (amount < 0) { dir = -1; amount = -amount; }
- var cur = clipPos(this.doc, from);
- for (var i = 0; i < amount; ++i) {
- cur = findPosH(this.doc, cur, dir, unit, visually);
- if (cur.hitSide) { break }
- }
- return cur
- },
- moveH: methodOp(function(dir, unit) {
- var this$1 = this;
- this.extendSelectionsBy(function (range) {
- if (this$1.display.shift || this$1.doc.extend || range.empty())
- { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }
- else
- { return dir < 0 ? range.from() : range.to() }
- }, sel_move);
- }),
- deleteH: methodOp(function(dir, unit) {
- var sel = this.doc.sel, doc = this.doc;
- if (sel.somethingSelected())
- { doc.replaceSelection("", null, "+delete"); }
- else
- { deleteNearSelection(this, function (range) {
- var other = findPosH(doc, range.head, dir, unit, false);
- return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}
- }); }
- }),
- findPosV: function(from, amount, unit, goalColumn) {
- var dir = 1, x = goalColumn;
- if (amount < 0) { dir = -1; amount = -amount; }
- var cur = clipPos(this.doc, from);
- for (var i = 0; i < amount; ++i) {
- var coords = cursorCoords(this, cur, "div");
- if (x == null) { x = coords.left; }
- else { coords.left = x; }
- cur = findPosV(this, coords, dir, unit);
- if (cur.hitSide) { break }
- }
- return cur
- },
- moveV: methodOp(function(dir, unit) {
- var this$1 = this;
- var doc = this.doc, goals = [];
- var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();
- doc.extendSelectionsBy(function (range) {
- if (collapse)
- { return dir < 0 ? range.from() : range.to() }
- var headPos = cursorCoords(this$1, range.head, "div");
- if (range.goalColumn != null) { headPos.left = range.goalColumn; }
- goals.push(headPos.left);
- var pos = findPosV(this$1, headPos, dir, unit);
- if (unit == "page" && range == doc.sel.primary())
- { addToScrollTop(this$1, charCoords(this$1, pos, "div").top - headPos.top); }
- return pos
- }, sel_move);
- if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)
- { doc.sel.ranges[i].goalColumn = goals[i]; } }
- }),
- // Find the word at the given position (as returned by coordsChar).
- findWordAt: function(pos) {
- var doc = this.doc, line = getLine(doc, pos.line).text;
- var start = pos.ch, end = pos.ch;
- if (line) {
- var helper = this.getHelper(pos, "wordChars");
- if ((pos.sticky == "before" || end == line.length) && start) { --start; } else { ++end; }
- var startChar = line.charAt(start);
- var check = isWordChar(startChar, helper)
- ? function (ch) { return isWordChar(ch, helper); }
- : /\s/.test(startChar) ? function (ch) { return /\s/.test(ch); }
- : function (ch) { return (!/\s/.test(ch) && !isWordChar(ch)); };
- while (start > 0 && check(line.charAt(start - 1))) { --start; }
- while (end < line.length && check(line.charAt(end))) { ++end; }
- }
- return new Range(Pos(pos.line, start), Pos(pos.line, end))
- },
- toggleOverwrite: function(value) {
- if (value != null && value == this.state.overwrite) { return }
- if (this.state.overwrite = !this.state.overwrite)
- { addClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
- else
- { rmClass(this.display.cursorDiv, "CodeMirror-overwrite"); }
- signal(this, "overwriteToggle", this, this.state.overwrite);
- },
- hasFocus: function() { return this.display.input.getField() == activeElt() },
- isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },
- scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),
- getScrollInfo: function() {
- var scroller = this.display.scroller;
- return {left: scroller.scrollLeft, top: scroller.scrollTop,
- height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,
- width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,
- clientHeight: displayHeight(this), clientWidth: displayWidth(this)}
- },
- scrollIntoView: methodOp(function(range, margin) {
- if (range == null) {
- range = {from: this.doc.sel.primary().head, to: null};
- if (margin == null) { margin = this.options.cursorScrollMargin; }
- } else if (typeof range == "number") {
- range = {from: Pos(range, 0), to: null};
- } else if (range.from == null) {
- range = {from: range, to: null};
- }
- if (!range.to) { range.to = range.from; }
- range.margin = margin || 0;
- if (range.from.line != null) {
- scrollToRange(this, range);
- } else {
- scrollToCoordsRange(this, range.from, range.to, range.margin);
- }
- }),
- setSize: methodOp(function(width, height) {
- var this$1 = this;
- var interpret = function (val) { return typeof val == "number" || /^\d+$/.test(String(val)) ? val + "px" : val; };
- if (width != null) { this.display.wrapper.style.width = interpret(width); }
- if (height != null) { this.display.wrapper.style.height = interpret(height); }
- if (this.options.lineWrapping) { clearLineMeasurementCache(this); }
- var lineNo = this.display.viewFrom;
- this.doc.iter(lineNo, this.display.viewTo, function (line) {
- if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)
- { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, "widget"); break } } }
- ++lineNo;
- });
- this.curOp.forceUpdate = true;
- signal(this, "refresh", this);
- }),
- operation: function(f){return runInOp(this, f)},
- startOperation: function(){return startOperation(this)},
- endOperation: function(){return endOperation(this)},
- refresh: methodOp(function() {
- var oldHeight = this.display.cachedTextHeight;
- regChange(this);
- this.curOp.forceUpdate = true;
- clearCaches(this);
- scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);
- updateGutterSpace(this.display);
- if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)
- { estimateLineHeights(this); }
- signal(this, "refresh", this);
- }),
- swapDoc: methodOp(function(doc) {
- var old = this.doc;
- old.cm = null;
- // Cancel the current text selection if any (#5821)
- if (this.state.selectingText) { this.state.selectingText(); }
- attachDoc(this, doc);
- clearCaches(this);
- this.display.input.reset();
- scrollToCoords(this, doc.scrollLeft, doc.scrollTop);
- this.curOp.forceScroll = true;
- signalLater(this, "swapDoc", this, old);
- return old
- }),
- phrase: function(phraseText) {
- var phrases = this.options.phrases;
- return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText
- },
- getInputField: function(){return this.display.input.getField()},
- getWrapperElement: function(){return this.display.wrapper},
- getScrollerElement: function(){return this.display.scroller},
- getGutterElement: function(){return this.display.gutters}
- };
- eventMixin(CodeMirror);
- CodeMirror.registerHelper = function(type, name, value) {
- if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }
- helpers[type][name] = value;
- };
- CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {
- CodeMirror.registerHelper(type, name, value);
- helpers[type]._global.push({pred: predicate, val: value});
- };
- }
- // Used for horizontal relative motion. Dir is -1 or 1 (left or
- // right), unit can be "codepoint", "char", "column" (like char, but
- // doesn't cross line boundaries), "word" (across next word), or
- // "group" (to the start of next group of word or
- // non-word-non-whitespace chars). The visually param controls
- // whether, in right-to-left text, direction 1 means to move towards
- // the next index in the string, or towards the character to the right
- // of the current position. The resulting position will have a
- // hitSide=true property if it reached the end of the document.
- function findPosH(doc, pos, dir, unit, visually) {
- var oldPos = pos;
- var origDir = dir;
- var lineObj = getLine(doc, pos.line);
- var lineDir = visually && doc.direction == "rtl" ? -dir : dir;
- function findNextLine() {
- var l = pos.line + lineDir;
- if (l < doc.first || l >= doc.first + doc.size) { return false }
- pos = new Pos(l, pos.ch, pos.sticky);
- return lineObj = getLine(doc, l)
- }
- function moveOnce(boundToLine) {
- var next;
- if (unit == "codepoint") {
- var ch = lineObj.text.charCodeAt(pos.ch + (unit > 0 ? 0 : -1));
- if (isNaN(ch)) { next = null; }
- else { next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (ch >= 0xD800 && ch < 0xDC00 ? 2 : 1))),
- -dir); }
- } else if (visually) {
- next = moveVisually(doc.cm, lineObj, pos, dir);
- } else {
- next = moveLogically(lineObj, pos, dir);
- }
- if (next == null) {
- if (!boundToLine && findNextLine())
- { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }
- else
- { return false }
- } else {
- pos = next;
- }
- return true
- }
- if (unit == "char" || unit == "codepoint") {
- moveOnce();
- } else if (unit == "column") {
- moveOnce(true);
- } else if (unit == "word" || unit == "group") {
- var sawType = null, group = unit == "group";
- var helper = doc.cm && doc.cm.getHelper(pos, "wordChars");
- for (var first = true;; first = false) {
- if (dir < 0 && !moveOnce(!first)) { break }
- var cur = lineObj.text.charAt(pos.ch) || "\n";
- var type = isWordChar(cur, helper) ? "w"
- : group && cur == "\n" ? "n"
- : !group || /\s/.test(cur) ? null
- : "p";
- if (group && !first && !type) { type = "s"; }
- if (sawType && sawType != type) {
- if (dir < 0) {dir = 1; moveOnce(); pos.sticky = "after";}
- break
- }
- if (type) { sawType = type; }
- if (dir > 0 && !moveOnce(!first)) { break }
- }
- }
- var result = skipAtomic(doc, pos, oldPos, origDir, true);
- if (equalCursorPos(oldPos, result)) { result.hitSide = true; }
- return result
- }
- // For relative vertical movement. Dir may be -1 or 1. Unit can be
- // "page" or "line". The resulting position will have a hitSide=true
- // property if it reached the end of the document.
- function findPosV(cm, pos, dir, unit) {
- var doc = cm.doc, x = pos.left, y;
- if (unit == "page") {
- var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);
- var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);
- y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;
- } else if (unit == "line") {
- y = dir > 0 ? pos.bottom + 3 : pos.top - 3;
- }
- var target;
- for (;;) {
- target = coordsChar(cm, x, y);
- if (!target.outside) { break }
- if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }
- y += dir * 5;
- }
- return target
- }
- // CONTENTEDITABLE INPUT STYLE
- var ContentEditableInput = function(cm) {
- this.cm = cm;
- this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;
- this.polling = new Delayed();
- this.composing = null;
- this.gracePeriod = false;
- this.readDOMTimeout = null;
- };
- ContentEditableInput.prototype.init = function (display) {
- var this$1 = this;
- var input = this, cm = input.cm;
- var div = input.div = display.lineDiv;
- disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);
- function belongsToInput(e) {
- for (var t = e.target; t; t = t.parentNode) {
- if (t == div) { return true }
- if (/\bCodeMirror-(?:line)?widget\b/.test(t.className)) { break }
- }
- return false
- }
- on(div, "paste", function (e) {
- if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
- // IE doesn't fire input events, so we schedule a read for the pasted content in this way
- if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }
- });
- on(div, "compositionstart", function (e) {
- this$1.composing = {data: e.data, done: false};
- });
- on(div, "compositionupdate", function (e) {
- if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }
- });
- on(div, "compositionend", function (e) {
- if (this$1.composing) {
- if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }
- this$1.composing.done = true;
- }
- });
- on(div, "touchstart", function () { return input.forceCompositionEnd(); });
- on(div, "input", function () {
- if (!this$1.composing) { this$1.readFromDOMSoon(); }
- });
- function onCopyCut(e) {
- if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }
- if (cm.somethingSelected()) {
- setLastCopied({lineWise: false, text: cm.getSelections()});
- if (e.type == "cut") { cm.replaceSelection("", null, "cut"); }
- } else if (!cm.options.lineWiseCopyCut) {
- return
- } else {
- var ranges = copyableRanges(cm);
- setLastCopied({lineWise: true, text: ranges.text});
- if (e.type == "cut") {
- cm.operation(function () {
- cm.setSelections(ranges.ranges, 0, sel_dontScroll);
- cm.replaceSelection("", null, "cut");
- });
- }
- }
- if (e.clipboardData) {
- e.clipboardData.clearData();
- var content = lastCopied.text.join("\n");
- // iOS exposes the clipboard API, but seems to discard content inserted into it
- e.clipboardData.setData("Text", content);
- if (e.clipboardData.getData("Text") == content) {
- e.preventDefault();
- return
- }
- }
- // Old-fashioned briefly-focus-a-textarea hack
- var kludge = hiddenTextarea(), te = kludge.firstChild;
- cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);
- te.value = lastCopied.text.join("\n");
- var hadFocus = document.activeElement;
- selectInput(te);
- setTimeout(function () {
- cm.display.lineSpace.removeChild(kludge);
- hadFocus.focus();
- if (hadFocus == div) { input.showPrimarySelection(); }
- }, 50);
- }
- on(div, "copy", onCopyCut);
- on(div, "cut", onCopyCut);
- };
- ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {
- // Label for screenreaders, accessibility
- if(label) {
- this.div.setAttribute('aria-label', label);
- } else {
- this.div.removeAttribute('aria-label');
- }
- };
- ContentEditableInput.prototype.prepareSelection = function () {
- var result = prepareSelection(this.cm, false);
- result.focus = document.activeElement == this.div;
- return result
- };
- ContentEditableInput.prototype.showSelection = function (info, takeFocus) {
- if (!info || !this.cm.display.view.length) { return }
- if (info.focus || takeFocus) { this.showPrimarySelection(); }
- this.showMultipleSelections(info);
- };
- ContentEditableInput.prototype.getSelection = function () {
- return this.cm.display.wrapper.ownerDocument.getSelection()
- };
- ContentEditableInput.prototype.showPrimarySelection = function () {
- var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();
- var from = prim.from(), to = prim.to();
- if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {
- sel.removeAllRanges();
- return
- }
- var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
- var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);
- if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&
- cmp(minPos(curAnchor, curFocus), from) == 0 &&
- cmp(maxPos(curAnchor, curFocus), to) == 0)
- { return }
- var view = cm.display.view;
- var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||
- {node: view[0].measure.map[2], offset: 0};
- var end = to.line < cm.display.viewTo && posToDOM(cm, to);
- if (!end) {
- var measure = view[view.length - 1].measure;
- var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;
- end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};
- }
- if (!start || !end) {
- sel.removeAllRanges();
- return
- }
- var old = sel.rangeCount && sel.getRangeAt(0), rng;
- try { rng = range(start.node, start.offset, end.offset, end.node); }
- catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible
- if (rng) {
- if (!gecko && cm.state.focused) {
- sel.collapse(start.node, start.offset);
- if (!rng.collapsed) {
- sel.removeAllRanges();
- sel.addRange(rng);
- }
- } else {
- sel.removeAllRanges();
- sel.addRange(rng);
- }
- if (old && sel.anchorNode == null) { sel.addRange(old); }
- else if (gecko) { this.startGracePeriod(); }
- }
- this.rememberSelection();
- };
- ContentEditableInput.prototype.startGracePeriod = function () {
- var this$1 = this;
- clearTimeout(this.gracePeriod);
- this.gracePeriod = setTimeout(function () {
- this$1.gracePeriod = false;
- if (this$1.selectionChanged())
- { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }
- }, 20);
- };
- ContentEditableInput.prototype.showMultipleSelections = function (info) {
- removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);
- removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);
- };
- ContentEditableInput.prototype.rememberSelection = function () {
- var sel = this.getSelection();
- this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;
- this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;
- };
- ContentEditableInput.prototype.selectionInEditor = function () {
- var sel = this.getSelection();
- if (!sel.rangeCount) { return false }
- var node = sel.getRangeAt(0).commonAncestorContainer;
- return contains(this.div, node)
- };
- ContentEditableInput.prototype.focus = function () {
- if (this.cm.options.readOnly != "nocursor") {
- if (!this.selectionInEditor() || document.activeElement != this.div)
- { this.showSelection(this.prepareSelection(), true); }
- this.div.focus();
- }
- };
- ContentEditableInput.prototype.blur = function () { this.div.blur(); };
- ContentEditableInput.prototype.getField = function () { return this.div };
- ContentEditableInput.prototype.supportsTouch = function () { return true };
- ContentEditableInput.prototype.receivedFocus = function () {
- var input = this;
- if (this.selectionInEditor())
- { this.pollSelection(); }
- else
- { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }
- function poll() {
- if (input.cm.state.focused) {
- input.pollSelection();
- input.polling.set(input.cm.options.pollInterval, poll);
- }
- }
- this.polling.set(this.cm.options.pollInterval, poll);
- };
- ContentEditableInput.prototype.selectionChanged = function () {
- var sel = this.getSelection();
- return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||
- sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset
- };
- ContentEditableInput.prototype.pollSelection = function () {
- if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }
- var sel = this.getSelection(), cm = this.cm;
- // On Android Chrome (version 56, at least), backspacing into an
- // uneditable block element will put the cursor in that element,
- // and then, because it's not editable, hide the virtual keyboard.
- // Because Android doesn't allow us to actually detect backspace
- // presses in a sane way, this code checks for when that happens
- // and simulates a backspace press in this case.
- if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {
- this.cm.triggerOnKeyDown({type: "keydown", keyCode: 8, preventDefault: Math.abs});
- this.blur();
- this.focus();
- return
- }
- if (this.composing) { return }
- this.rememberSelection();
- var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);
- var head = domToPos(cm, sel.focusNode, sel.focusOffset);
- if (anchor && head) { runInOp(cm, function () {
- setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);
- if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }
- }); }
- };
- ContentEditableInput.prototype.pollContent = function () {
- if (this.readDOMTimeout != null) {
- clearTimeout(this.readDOMTimeout);
- this.readDOMTimeout = null;
- }
- var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();
- var from = sel.from(), to = sel.to();
- if (from.ch == 0 && from.line > cm.firstLine())
- { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }
- if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())
- { to = Pos(to.line + 1, 0); }
- if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }
- var fromIndex, fromLine, fromNode;
- if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {
- fromLine = lineNo(display.view[0].line);
- fromNode = display.view[0].node;
- } else {
- fromLine = lineNo(display.view[fromIndex].line);
- fromNode = display.view[fromIndex - 1].node.nextSibling;
- }
- var toIndex = findViewIndex(cm, to.line);
- var toLine, toNode;
- if (toIndex == display.view.length - 1) {
- toLine = display.viewTo - 1;
- toNode = display.lineDiv.lastChild;
- } else {
- toLine = lineNo(display.view[toIndex + 1].line) - 1;
- toNode = display.view[toIndex + 1].node.previousSibling;
- }
- if (!fromNode) { return false }
- var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));
- var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));
- while (newText.length > 1 && oldText.length > 1) {
- if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }
- else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }
- else { break }
- }
- var cutFront = 0, cutEnd = 0;
- var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);
- while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))
- { ++cutFront; }
- var newBot = lst(newText), oldBot = lst(oldText);
- var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),
- oldBot.length - (oldText.length == 1 ? cutFront : 0));
- while (cutEnd < maxCutEnd &&
- newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))
- { ++cutEnd; }
- // Try to move start of change to start of selection if ambiguous
- if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {
- while (cutFront && cutFront > from.ch &&
- newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {
- cutFront--;
- cutEnd++;
- }
- }
- newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\u200b+/, "");
- newText[0] = newText[0].slice(cutFront).replace(/\u200b+$/, "");
- var chFrom = Pos(fromLine, cutFront);
- var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);
- if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {
- replaceRange(cm.doc, newText, chFrom, chTo, "+input");
- return true
- }
- };
- ContentEditableInput.prototype.ensurePolled = function () {
- this.forceCompositionEnd();
- };
- ContentEditableInput.prototype.reset = function () {
- this.forceCompositionEnd();
- };
- ContentEditableInput.prototype.forceCompositionEnd = function () {
- if (!this.composing) { return }
- clearTimeout(this.readDOMTimeout);
- this.composing = null;
- this.updateFromDOM();
- this.div.blur();
- this.div.focus();
- };
- ContentEditableInput.prototype.readFromDOMSoon = function () {
- var this$1 = this;
- if (this.readDOMTimeout != null) { return }
- this.readDOMTimeout = setTimeout(function () {
- this$1.readDOMTimeout = null;
- if (this$1.composing) {
- if (this$1.composing.done) { this$1.composing = null; }
- else { return }
- }
- this$1.updateFromDOM();
- }, 80);
- };
- ContentEditableInput.prototype.updateFromDOM = function () {
- var this$1 = this;
- if (this.cm.isReadOnly() || !this.pollContent())
- { runInOp(this.cm, function () { return regChange(this$1.cm); }); }
- };
- ContentEditableInput.prototype.setUneditable = function (node) {
- node.contentEditable = "false";
- };
- ContentEditableInput.prototype.onKeyPress = function (e) {
- if (e.charCode == 0 || this.composing) { return }
- e.preventDefault();
- if (!this.cm.isReadOnly())
- { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }
- };
- ContentEditableInput.prototype.readOnlyChanged = function (val) {
- this.div.contentEditable = String(val != "nocursor");
- };
- ContentEditableInput.prototype.onContextMenu = function () {};
- ContentEditableInput.prototype.resetPosition = function () {};
- ContentEditableInput.prototype.needsContentAttribute = true;
- function posToDOM(cm, pos) {
- var view = findViewForLine(cm, pos.line);
- if (!view || view.hidden) { return null }
- var line = getLine(cm.doc, pos.line);
- var info = mapFromLineView(view, line, pos.line);
- var order = getOrder(line, cm.doc.direction), side = "left";
- if (order) {
- var partPos = getBidiPartAt(order, pos.ch);
- side = partPos % 2 ? "right" : "left";
- }
- var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);
- result.offset = result.collapse == "right" ? result.end : result.start;
- return result
- }
- function isInGutter(node) {
- for (var scan = node; scan; scan = scan.parentNode)
- { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }
- return false
- }
- function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }
- function domTextBetween(cm, from, to, fromLine, toLine) {
- var text = "", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;
- function recognizeMarker(id) { return function (marker) { return marker.id == id; } }
- function close() {
- if (closing) {
- text += lineSep;
- if (extraLinebreak) { text += lineSep; }
- closing = extraLinebreak = false;
- }
- }
- function addText(str) {
- if (str) {
- close();
- text += str;
- }
- }
- function walk(node) {
- if (node.nodeType == 1) {
- var cmText = node.getAttribute("cm-text");
- if (cmText) {
- addText(cmText);
- return
- }
- var markerID = node.getAttribute("cm-marker"), range;
- if (markerID) {
- var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));
- if (found.length && (range = found[0].find(0)))
- { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }
- return
- }
- if (node.getAttribute("contenteditable") == "false") { return }
- var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);
- if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }
- if (isBlock) { close(); }
- for (var i = 0; i < node.childNodes.length; i++)
- { walk(node.childNodes[i]); }
- if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }
- if (isBlock) { closing = true; }
- } else if (node.nodeType == 3) {
- addText(node.nodeValue.replace(/\u200b/g, "").replace(/\u00a0/g, " "));
- }
- }
- for (;;) {
- walk(from);
- if (from == to) { break }
- from = from.nextSibling;
- extraLinebreak = false;
- }
- return text
- }
- function domToPos(cm, node, offset) {
- var lineNode;
- if (node == cm.display.lineDiv) {
- lineNode = cm.display.lineDiv.childNodes[offset];
- if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }
- node = null; offset = 0;
- } else {
- for (lineNode = node;; lineNode = lineNode.parentNode) {
- if (!lineNode || lineNode == cm.display.lineDiv) { return null }
- if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }
- }
- }
- for (var i = 0; i < cm.display.view.length; i++) {
- var lineView = cm.display.view[i];
- if (lineView.node == lineNode)
- { return locateNodeInLineView(lineView, node, offset) }
- }
- }
- function locateNodeInLineView(lineView, node, offset) {
- var wrapper = lineView.text.firstChild, bad = false;
- if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }
- if (node == wrapper) {
- bad = true;
- node = wrapper.childNodes[offset];
- offset = 0;
- if (!node) {
- var line = lineView.rest ? lst(lineView.rest) : lineView.line;
- return badPos(Pos(lineNo(line), line.text.length), bad)
- }
- }
- var textNode = node.nodeType == 3 ? node : null, topNode = node;
- if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
- textNode = node.firstChild;
- if (offset) { offset = textNode.nodeValue.length; }
- }
- while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }
- var measure = lineView.measure, maps = measure.maps;
- function find(textNode, topNode, offset) {
- for (var i = -1; i < (maps ? maps.length : 0); i++) {
- var map = i < 0 ? measure.map : maps[i];
- for (var j = 0; j < map.length; j += 3) {
- var curNode = map[j + 2];
- if (curNode == textNode || curNode == topNode) {
- var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);
- var ch = map[j] + offset;
- if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }
- return Pos(line, ch)
- }
- }
- }
- }
- var found = find(textNode, topNode, offset);
- if (found) { return badPos(found, bad) }
- // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems
- for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {
- found = find(after, after.firstChild, 0);
- if (found)
- { return badPos(Pos(found.line, found.ch - dist), bad) }
- else
- { dist += after.textContent.length; }
- }
- for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {
- found = find(before, before.firstChild, -1);
- if (found)
- { return badPos(Pos(found.line, found.ch + dist$1), bad) }
- else
- { dist$1 += before.textContent.length; }
- }
- }
- // TEXTAREA INPUT STYLE
- var TextareaInput = function(cm) {
- this.cm = cm;
- // See input.poll and input.reset
- this.prevInput = "";
- // Flag that indicates whether we expect input to appear real soon
- // now (after some event like 'keypress' or 'input') and are
- // polling intensively.
- this.pollingFast = false;
- // Self-resetting timeout for the poller
- this.polling = new Delayed();
- // Used to work around IE issue with selection being forgotten when focus moves away from textarea
- this.hasSelection = false;
- this.composing = null;
- };
- TextareaInput.prototype.init = function (display) {
- var this$1 = this;
- var input = this, cm = this.cm;
- this.createField(display);
- var te = this.textarea;
- display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);
- // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)
- if (ios) { te.style.width = "0px"; }
- on(te, "input", function () {
- if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }
- input.poll();
- });
- on(te, "paste", function (e) {
- if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }
- cm.state.pasteIncoming = +new Date;
- input.fastPoll();
- });
- function prepareCopyCut(e) {
- if (signalDOMEvent(cm, e)) { return }
- if (cm.somethingSelected()) {
- setLastCopied({lineWise: false, text: cm.getSelections()});
- } else if (!cm.options.lineWiseCopyCut) {
- return
- } else {
- var ranges = copyableRanges(cm);
- setLastCopied({lineWise: true, text: ranges.text});
- if (e.type == "cut") {
- cm.setSelections(ranges.ranges, null, sel_dontScroll);
- } else {
- input.prevInput = "";
- te.value = ranges.text.join("\n");
- selectInput(te);
- }
- }
- if (e.type == "cut") { cm.state.cutIncoming = +new Date; }
- }
- on(te, "cut", prepareCopyCut);
- on(te, "copy", prepareCopyCut);
- on(display.scroller, "paste", function (e) {
- if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }
- if (!te.dispatchEvent) {
- cm.state.pasteIncoming = +new Date;
- input.focus();
- return
- }
- // Pass the `paste` event to the textarea so it's handled by its event listener.
- var event = new Event("paste");
- event.clipboardData = e.clipboardData;
- te.dispatchEvent(event);
- });
- // Prevent normal selection in the editor (we handle our own)
- on(display.lineSpace, "selectstart", function (e) {
- if (!eventInWidget(display, e)) { e_preventDefault(e); }
- });
- on(te, "compositionstart", function () {
- var start = cm.getCursor("from");
- if (input.composing) { input.composing.range.clear(); }
- input.composing = {
- start: start,
- range: cm.markText(start, cm.getCursor("to"), {className: "CodeMirror-composing"})
- };
- });
- on(te, "compositionend", function () {
- if (input.composing) {
- input.poll();
- input.composing.range.clear();
- input.composing = null;
- }
- });
- };
- TextareaInput.prototype.createField = function (_display) {
- // Wraps and hides input textarea
- this.wrapper = hiddenTextarea();
- // The semihidden textarea that is focused when the editor is
- // focused, and receives input.
- this.textarea = this.wrapper.firstChild;
- };
- TextareaInput.prototype.screenReaderLabelChanged = function (label) {
- // Label for screenreaders, accessibility
- if(label) {
- this.textarea.setAttribute('aria-label', label);
- } else {
- this.textarea.removeAttribute('aria-label');
- }
- };
- TextareaInput.prototype.prepareSelection = function () {
- // Redraw the selection and/or cursor
- var cm = this.cm, display = cm.display, doc = cm.doc;
- var result = prepareSelection(cm);
- // Move the hidden textarea near the cursor to prevent scrolling artifacts
- if (cm.options.moveInputWithCursor) {
- var headPos = cursorCoords(cm, doc.sel.primary().head, "div");
- var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();
- result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
- headPos.top + lineOff.top - wrapOff.top));
- result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
- headPos.left + lineOff.left - wrapOff.left));
- }
- return result
- };
- TextareaInput.prototype.showSelection = function (drawn) {
- var cm = this.cm, display = cm.display;
- removeChildrenAndAdd(display.cursorDiv, drawn.cursors);
- removeChildrenAndAdd(display.selectionDiv, drawn.selection);
- if (drawn.teTop != null) {
- this.wrapper.style.top = drawn.teTop + "px";
- this.wrapper.style.left = drawn.teLeft + "px";
- }
- };
- // Reset the input to correspond to the selection (or to be empty,
- // when not typing and nothing is selected)
- TextareaInput.prototype.reset = function (typing) {
- if (this.contextMenuPending || this.composing) { return }
- var cm = this.cm;
- if (cm.somethingSelected()) {
- this.prevInput = "";
- var content = cm.getSelection();
- this.textarea.value = content;
- if (cm.state.focused) { selectInput(this.textarea); }
- if (ie && ie_version >= 9) { this.hasSelection = content; }
- } else if (!typing) {
- this.prevInput = this.textarea.value = "";
- if (ie && ie_version >= 9) { this.hasSelection = null; }
- }
- };
- TextareaInput.prototype.getField = function () { return this.textarea };
- TextareaInput.prototype.supportsTouch = function () { return false };
- TextareaInput.prototype.focus = function () {
- if (this.cm.options.readOnly != "nocursor" && (!mobile || activeElt() != this.textarea)) {
- try { this.textarea.focus(); }
- catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM
- }
- };
- TextareaInput.prototype.blur = function () { this.textarea.blur(); };
- TextareaInput.prototype.resetPosition = function () {
- this.wrapper.style.top = this.wrapper.style.left = 0;
- };
- TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };
- // Poll for input changes, using the normal rate of polling. This
- // runs as long as the editor is focused.
- TextareaInput.prototype.slowPoll = function () {
- var this$1 = this;
- if (this.pollingFast) { return }
- this.polling.set(this.cm.options.pollInterval, function () {
- this$1.poll();
- if (this$1.cm.state.focused) { this$1.slowPoll(); }
- });
- };
- // When an event has just come in that is likely to add or change
- // something in the input textarea, we poll faster, to ensure that
- // the change appears on the screen quickly.
- TextareaInput.prototype.fastPoll = function () {
- var missed = false, input = this;
- input.pollingFast = true;
- function p() {
- var changed = input.poll();
- if (!changed && !missed) {missed = true; input.polling.set(60, p);}
- else {input.pollingFast = false; input.slowPoll();}
- }
- input.polling.set(20, p);
- };
- // Read input from the textarea, and update the document to match.
- // When something is selected, it is present in the textarea, and
- // selected (unless it is huge, in which case a placeholder is
- // used). When nothing is selected, the cursor sits after previously
- // seen text (can be empty), which is stored in prevInput (we must
- // not reset the textarea when typing, because that breaks IME).
- TextareaInput.prototype.poll = function () {
- var this$1 = this;
- var cm = this.cm, input = this.textarea, prevInput = this.prevInput;
- // Since this is called a *lot*, try to bail out as cheaply as
- // possible when it is clear that nothing happened. hasSelection
- // will be the case when there is a lot of text in the textarea,
- // in which case reading its value would be expensive.
- if (this.contextMenuPending || !cm.state.focused ||
- (hasSelection(input) && !prevInput && !this.composing) ||
- cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)
- { return false }
- var text = input.value;
- // If nothing changed, bail.
- if (text == prevInput && !cm.somethingSelected()) { return false }
- // Work around nonsensical selection resetting in IE9/10, and
- // inexplicable appearance of private area unicode characters on
- // some key combos in Mac (#2689).
- if (ie && ie_version >= 9 && this.hasSelection === text ||
- mac && /[\uf700-\uf7ff]/.test(text)) {
- cm.display.input.reset();
- return false
- }
- if (cm.doc.sel == cm.display.selForContextMenu) {
- var first = text.charCodeAt(0);
- if (first == 0x200b && !prevInput) { prevInput = "\u200b"; }
- if (first == 0x21da) { this.reset(); return this.cm.execCommand("undo") }
- }
- // Find the part of the input that is actually new
- var same = 0, l = Math.min(prevInput.length, text.length);
- while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }
- runInOp(cm, function () {
- applyTextInput(cm, text.slice(same), prevInput.length - same,
- null, this$1.composing ? "*compose" : null);
- // Don't leave long text in the textarea, since it makes further polling slow
- if (text.length > 1000 || text.indexOf("\n") > -1) { input.value = this$1.prevInput = ""; }
- else { this$1.prevInput = text; }
- if (this$1.composing) {
- this$1.composing.range.clear();
- this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor("to"),
- {className: "CodeMirror-composing"});
- }
- });
- return true
- };
- TextareaInput.prototype.ensurePolled = function () {
- if (this.pollingFast && this.poll()) { this.pollingFast = false; }
- };
- TextareaInput.prototype.onKeyPress = function () {
- if (ie && ie_version >= 9) { this.hasSelection = null; }
- this.fastPoll();
- };
- TextareaInput.prototype.onContextMenu = function (e) {
- var input = this, cm = input.cm, display = cm.display, te = input.textarea;
- if (input.contextMenuPending) { input.contextMenuPending(); }
- var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;
- if (!pos || presto) { return } // Opera is difficult.
- // Reset the current text selection only if the click is done outside of the selection
- // and 'resetSelectionOnContextMenu' option is true.
- var reset = cm.options.resetSelectionOnContextMenu;
- if (reset && cm.doc.sel.contains(pos) == -1)
- { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }
- var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;
- var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();
- input.wrapper.style.cssText = "position: static";
- te.style.cssText = "position: absolute; width: 30px; height: 30px;\n top: " + (e.clientY - wrapperBox.top - 5) + "px; left: " + (e.clientX - wrapperBox.left - 5) + "px;\n z-index: 1000; background: " + (ie ? "rgba(255, 255, 255, .05)" : "transparent") + ";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);";
- var oldScrollY;
- if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)
- display.input.focus();
- if (webkit) { window.scrollTo(null, oldScrollY); }
- display.input.reset();
- // Adds "Select all" to context menu in FF
- if (!cm.somethingSelected()) { te.value = input.prevInput = " "; }
- input.contextMenuPending = rehide;
- display.selForContextMenu = cm.doc.sel;
- clearTimeout(display.detectingSelectAll);
- // Select-all will be greyed out if there's nothing to select, so
- // this adds a zero-width space so that we can later check whether
- // it got selected.
- function prepareSelectAllHack() {
- if (te.selectionStart != null) {
- var selected = cm.somethingSelected();
- var extval = "\u200b" + (selected ? te.value : "");
- te.value = "\u21da"; // Used to catch context-menu undo
- te.value = extval;
- input.prevInput = selected ? "" : "\u200b";
- te.selectionStart = 1; te.selectionEnd = extval.length;
- // Re-set this, in case some other handler touched the
- // selection in the meantime.
- display.selForContextMenu = cm.doc.sel;
- }
- }
- function rehide() {
- if (input.contextMenuPending != rehide) { return }
- input.contextMenuPending = false;
- input.wrapper.style.cssText = oldWrapperCSS;
- te.style.cssText = oldCSS;
- if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }
- // Try to detect the user choosing select-all
- if (te.selectionStart != null) {
- if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }
- var i = 0, poll = function () {
- if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&
- te.selectionEnd > 0 && input.prevInput == "\u200b") {
- operation(cm, selectAll)(cm);
- } else if (i++ < 10) {
- display.detectingSelectAll = setTimeout(poll, 500);
- } else {
- display.selForContextMenu = null;
- display.input.reset();
- }
- };
- display.detectingSelectAll = setTimeout(poll, 200);
- }
- }
- if (ie && ie_version >= 9) { prepareSelectAllHack(); }
- if (captureRightClick) {
- e_stop(e);
- var mouseup = function () {
- off(window, "mouseup", mouseup);
- setTimeout(rehide, 20);
- };
- on(window, "mouseup", mouseup);
- } else {
- setTimeout(rehide, 50);
- }
- };
- TextareaInput.prototype.readOnlyChanged = function (val) {
- if (!val) { this.reset(); }
- this.textarea.disabled = val == "nocursor";
- this.textarea.readOnly = !!val;
- };
- TextareaInput.prototype.setUneditable = function () {};
- TextareaInput.prototype.needsContentAttribute = false;
- function fromTextArea(textarea, options) {
- options = options ? copyObj(options) : {};
- options.value = textarea.value;
- if (!options.tabindex && textarea.tabIndex)
- { options.tabindex = textarea.tabIndex; }
- if (!options.placeholder && textarea.placeholder)
- { options.placeholder = textarea.placeholder; }
- // Set autofocus to true if this textarea is focused, or if it has
- // autofocus and no other element is focused.
- if (options.autofocus == null) {
- var hasFocus = activeElt();
- options.autofocus = hasFocus == textarea ||
- textarea.getAttribute("autofocus") != null && hasFocus == document.body;
- }
- function save() {textarea.value = cm.getValue();}
- var realSubmit;
- if (textarea.form) {
- on(textarea.form, "submit", save);
- // Deplorable hack to make the submit method do the right thing.
- if (!options.leaveSubmitMethodAlone) {
- var form = textarea.form;
- realSubmit = form.submit;
- try {
- var wrappedSubmit = form.submit = function () {
- save();
- form.submit = realSubmit;
- form.submit();
- form.submit = wrappedSubmit;
- };
- } catch(e) {}
- }
- }
- options.finishInit = function (cm) {
- cm.save = save;
- cm.getTextArea = function () { return textarea; };
- cm.toTextArea = function () {
- cm.toTextArea = isNaN; // Prevent this from being ran twice
- save();
- textarea.parentNode.removeChild(cm.getWrapperElement());
- textarea.style.display = "";
- if (textarea.form) {
- off(textarea.form, "submit", save);
- if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == "function")
- { textarea.form.submit = realSubmit; }
- }
- };
- };
- textarea.style.display = "none";
- var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },
- options);
- return cm
- }
- function addLegacyProps(CodeMirror) {
- CodeMirror.off = off;
- CodeMirror.on = on;
- CodeMirror.wheelEventPixels = wheelEventPixels;
- CodeMirror.Doc = Doc;
- CodeMirror.splitLines = splitLinesAuto;
- CodeMirror.countColumn = countColumn;
- CodeMirror.findColumn = findColumn;
- CodeMirror.isWordChar = isWordCharBasic;
- CodeMirror.Pass = Pass;
- CodeMirror.signal = signal;
- CodeMirror.Line = Line;
- CodeMirror.changeEnd = changeEnd;
- CodeMirror.scrollbarModel = scrollbarModel;
- CodeMirror.Pos = Pos;
- CodeMirror.cmpPos = cmp;
- CodeMirror.modes = modes;
- CodeMirror.mimeModes = mimeModes;
- CodeMirror.resolveMode = resolveMode;
- CodeMirror.getMode = getMode;
- CodeMirror.modeExtensions = modeExtensions;
- CodeMirror.extendMode = extendMode;
- CodeMirror.copyState = copyState;
- CodeMirror.startState = startState;
- CodeMirror.innerMode = innerMode;
- CodeMirror.commands = commands;
- CodeMirror.keyMap = keyMap;
- CodeMirror.keyName = keyName;
- CodeMirror.isModifierKey = isModifierKey;
- CodeMirror.lookupKey = lookupKey;
- CodeMirror.normalizeKeyMap = normalizeKeyMap;
- CodeMirror.StringStream = StringStream;
- CodeMirror.SharedTextMarker = SharedTextMarker;
- CodeMirror.TextMarker = TextMarker;
- CodeMirror.LineWidget = LineWidget;
- CodeMirror.e_preventDefault = e_preventDefault;
- CodeMirror.e_stopPropagation = e_stopPropagation;
- CodeMirror.e_stop = e_stop;
- CodeMirror.addClass = addClass;
- CodeMirror.contains = contains;
- CodeMirror.rmClass = rmClass;
- CodeMirror.keyNames = keyNames;
- }
- // EDITOR CONSTRUCTOR
- defineOptions(CodeMirror);
- addEditorMethods(CodeMirror);
- // Set up methods on CodeMirror's prototype to redirect to the editor's document.
- var dontDelegate = "iter insert remove copy getEditor constructor".split(" ");
- for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)
- { CodeMirror.prototype[prop] = (function(method) {
- return function() {return method.apply(this.doc, arguments)}
- })(Doc.prototype[prop]); } }
- eventMixin(Doc);
- CodeMirror.inputStyles = {"textarea": TextareaInput, "contenteditable": ContentEditableInput};
- // Extra arguments are stored as the mode's dependencies, which is
- // used by (legacy) mechanisms like loadmode.js to automatically
- // load a mode. (Preferred mechanism is the require/define calls.)
- CodeMirror.defineMode = function(name/*, mode, …*/) {
- if (!CodeMirror.defaults.mode && name != "null") { CodeMirror.defaults.mode = name; }
- defineMode.apply(this, arguments);
- };
- CodeMirror.defineMIME = defineMIME;
- // Minimal default mode.
- CodeMirror.defineMode("null", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });
- CodeMirror.defineMIME("text/plain", "null");
- // EXTENSIONS
- CodeMirror.defineExtension = function (name, func) {
- CodeMirror.prototype[name] = func;
- };
- CodeMirror.defineDocExtension = function (name, func) {
- Doc.prototype[name] = func;
- };
- CodeMirror.fromTextArea = fromTextArea;
- addLegacyProps(CodeMirror);
- CodeMirror.version = "5.58.2";
- return CodeMirror;
- })));
- ;(function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
- typeof define === 'function' && define.amd ? define('moment',factory) :
- global.moment = factory()
- }(this, (function () { 'use strict';
- var hookCallback;
- function hooks() {
- return hookCallback.apply(null, arguments);
- }
- // This is done to register the method called with moment()
- // without creating circular dependencies.
- function setHookCallback(callback) {
- hookCallback = callback;
- }
- function isArray(input) {
- return (
- input instanceof Array ||
- Object.prototype.toString.call(input) === '[object Array]'
- );
- }
- function isObject(input) {
- // IE8 will treat undefined and null as object if it wasn't for
- // input != null
- return (
- input != null &&
- Object.prototype.toString.call(input) === '[object Object]'
- );
- }
- function hasOwnProp(a, b) {
- return Object.prototype.hasOwnProperty.call(a, b);
- }
- function isObjectEmpty(obj) {
- if (Object.getOwnPropertyNames) {
- return Object.getOwnPropertyNames(obj).length === 0;
- } else {
- var k;
- for (k in obj) {
- if (hasOwnProp(obj, k)) {
- return false;
- }
- }
- return true;
- }
- }
- function isUndefined(input) {
- return input === void 0;
- }
- function isNumber(input) {
- return (
- typeof input === 'number' ||
- Object.prototype.toString.call(input) === '[object Number]'
- );
- }
- function isDate(input) {
- return (
- input instanceof Date ||
- Object.prototype.toString.call(input) === '[object Date]'
- );
- }
- function map(arr, fn) {
- var res = [],
- i,
- arrLen = arr.length;
- for (i = 0; i < arrLen; ++i) {
- res.push(fn(arr[i], i));
- }
- return res;
- }
- function extend(a, b) {
- for (var i in b) {
- if (hasOwnProp(b, i)) {
- a[i] = b[i];
- }
- }
- if (hasOwnProp(b, 'toString')) {
- a.toString = b.toString;
- }
- if (hasOwnProp(b, 'valueOf')) {
- a.valueOf = b.valueOf;
- }
- return a;
- }
- function createUTC(input, format, locale, strict) {
- return createLocalOrUTC(input, format, locale, strict, true).utc();
- }
- function defaultParsingFlags() {
- // We need to deep clone this object.
- return {
- empty: false,
- unusedTokens: [],
- unusedInput: [],
- overflow: -2,
- charsLeftOver: 0,
- nullInput: false,
- invalidEra: null,
- invalidMonth: null,
- invalidFormat: false,
- userInvalidated: false,
- iso: false,
- parsedDateParts: [],
- era: null,
- meridiem: null,
- rfc2822: false,
- weekdayMismatch: false,
- };
- }
- function getParsingFlags(m) {
- if (m._pf == null) {
- m._pf = defaultParsingFlags();
- }
- return m._pf;
- }
- var some;
- if (Array.prototype.some) {
- some = Array.prototype.some;
- } else {
- some = function (fun) {
- var t = Object(this),
- len = t.length >>> 0,
- i;
- for (i = 0; i < len; i++) {
- if (i in t && fun.call(this, t[i], i, t)) {
- return true;
- }
- }
- return false;
- };
- }
- function isValid(m) {
- if (m._isValid == null) {
- var flags = getParsingFlags(m),
- parsedParts = some.call(flags.parsedDateParts, function (i) {
- return i != null;
- }),
- isNowValid =
- !isNaN(m._d.getTime()) &&
- flags.overflow < 0 &&
- !flags.empty &&
- !flags.invalidEra &&
- !flags.invalidMonth &&
- !flags.invalidWeekday &&
- !flags.weekdayMismatch &&
- !flags.nullInput &&
- !flags.invalidFormat &&
- !flags.userInvalidated &&
- (!flags.meridiem || (flags.meridiem && parsedParts));
- if (m._strict) {
- isNowValid =
- isNowValid &&
- flags.charsLeftOver === 0 &&
- flags.unusedTokens.length === 0 &&
- flags.bigHour === undefined;
- }
- if (Object.isFrozen == null || !Object.isFrozen(m)) {
- m._isValid = isNowValid;
- } else {
- return isNowValid;
- }
- }
- return m._isValid;
- }
- function createInvalid(flags) {
- var m = createUTC(NaN);
- if (flags != null) {
- extend(getParsingFlags(m), flags);
- } else {
- getParsingFlags(m).userInvalidated = true;
- }
- return m;
- }
- // Plugins that add properties should also add the key here (null value),
- // so we can properly clone ourselves.
- var momentProperties = (hooks.momentProperties = []),
- updateInProgress = false;
- function copyConfig(to, from) {
- var i,
- prop,
- val,
- momentPropertiesLen = momentProperties.length;
- if (!isUndefined(from._isAMomentObject)) {
- to._isAMomentObject = from._isAMomentObject;
- }
- if (!isUndefined(from._i)) {
- to._i = from._i;
- }
- if (!isUndefined(from._f)) {
- to._f = from._f;
- }
- if (!isUndefined(from._l)) {
- to._l = from._l;
- }
- if (!isUndefined(from._strict)) {
- to._strict = from._strict;
- }
- if (!isUndefined(from._tzm)) {
- to._tzm = from._tzm;
- }
- if (!isUndefined(from._isUTC)) {
- to._isUTC = from._isUTC;
- }
- if (!isUndefined(from._offset)) {
- to._offset = from._offset;
- }
- if (!isUndefined(from._pf)) {
- to._pf = getParsingFlags(from);
- }
- if (!isUndefined(from._locale)) {
- to._locale = from._locale;
- }
- if (momentPropertiesLen > 0) {
- for (i = 0; i < momentPropertiesLen; i++) {
- prop = momentProperties[i];
- val = from[prop];
- if (!isUndefined(val)) {
- to[prop] = val;
- }
- }
- }
- return to;
- }
- // Moment prototype object
- function Moment(config) {
- copyConfig(this, config);
- this._d = new Date(config._d != null ? config._d.getTime() : NaN);
- if (!this.isValid()) {
- this._d = new Date(NaN);
- }
- // Prevent infinite loop in case updateOffset creates new moment
- // objects.
- if (updateInProgress === false) {
- updateInProgress = true;
- hooks.updateOffset(this);
- updateInProgress = false;
- }
- }
- function isMoment(obj) {
- return (
- obj instanceof Moment || (obj != null && obj._isAMomentObject != null)
- );
- }
- function warn(msg) {
- if (
- hooks.suppressDeprecationWarnings === false &&
- typeof console !== 'undefined' &&
- console.warn
- ) {
- console.warn('Deprecation warning: ' + msg);
- }
- }
- function deprecate(msg, fn) {
- var firstTime = true;
- return extend(function () {
- if (hooks.deprecationHandler != null) {
- hooks.deprecationHandler(null, msg);
- }
- if (firstTime) {
- var args = [],
- arg,
- i,
- key,
- argLen = arguments.length;
- for (i = 0; i < argLen; i++) {
- arg = '';
- if (typeof arguments[i] === 'object') {
- arg += '\n[' + i + '] ';
- for (key in arguments[0]) {
- if (hasOwnProp(arguments[0], key)) {
- arg += key + ': ' + arguments[0][key] + ', ';
- }
- }
- arg = arg.slice(0, -2); // Remove trailing comma and space
- } else {
- arg = arguments[i];
- }
- args.push(arg);
- }
- warn(
- msg +
- '\nArguments: ' +
- Array.prototype.slice.call(args).join('') +
- '\n' +
- new Error().stack
- );
- firstTime = false;
- }
- return fn.apply(this, arguments);
- }, fn);
- }
- var deprecations = {};
- function deprecateSimple(name, msg) {
- if (hooks.deprecationHandler != null) {
- hooks.deprecationHandler(name, msg);
- }
- if (!deprecations[name]) {
- warn(msg);
- deprecations[name] = true;
- }
- }
- hooks.suppressDeprecationWarnings = false;
- hooks.deprecationHandler = null;
- function isFunction(input) {
- return (
- (typeof Function !== 'undefined' && input instanceof Function) ||
- Object.prototype.toString.call(input) === '[object Function]'
- );
- }
- function set(config) {
- var prop, i;
- for (i in config) {
- if (hasOwnProp(config, i)) {
- prop = config[i];
- if (isFunction(prop)) {
- this[i] = prop;
- } else {
- this['_' + i] = prop;
- }
- }
- }
- this._config = config;
- // Lenient ordinal parsing accepts just a number in addition to
- // number + (possibly) stuff coming from _dayOfMonthOrdinalParse.
- // TODO: Remove "ordinalParse" fallback in next major release.
- this._dayOfMonthOrdinalParseLenient = new RegExp(
- (this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) +
- '|' +
- /\d{1,2}/.source
- );
- }
- function mergeConfigs(parentConfig, childConfig) {
- var res = extend({}, parentConfig),
- prop;
- for (prop in childConfig) {
- if (hasOwnProp(childConfig, prop)) {
- if (isObject(parentConfig[prop]) && isObject(childConfig[prop])) {
- res[prop] = {};
- extend(res[prop], parentConfig[prop]);
- extend(res[prop], childConfig[prop]);
- } else if (childConfig[prop] != null) {
- res[prop] = childConfig[prop];
- } else {
- delete res[prop];
- }
- }
- }
- for (prop in parentConfig) {
- if (
- hasOwnProp(parentConfig, prop) &&
- !hasOwnProp(childConfig, prop) &&
- isObject(parentConfig[prop])
- ) {
- // make sure changes to properties don't modify parent config
- res[prop] = extend({}, res[prop]);
- }
- }
- return res;
- }
- function Locale(config) {
- if (config != null) {
- this.set(config);
- }
- }
- var keys;
- if (Object.keys) {
- keys = Object.keys;
- } else {
- keys = function (obj) {
- var i,
- res = [];
- for (i in obj) {
- if (hasOwnProp(obj, i)) {
- res.push(i);
- }
- }
- return res;
- };
- }
- var defaultCalendar = {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- };
- function calendar(key, mom, now) {
- var output = this._calendar[key] || this._calendar['sameElse'];
- return isFunction(output) ? output.call(mom, now) : output;
- }
- function zeroFill(number, targetLength, forceSign) {
- var absNumber = '' + Math.abs(number),
- zerosToFill = targetLength - absNumber.length,
- sign = number >= 0;
- return (
- (sign ? (forceSign ? '+' : '') : '-') +
- Math.pow(10, Math.max(0, zerosToFill)).toString().substr(1) +
- absNumber
- );
- }
- var formattingTokens =
- /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g,
- localFormattingTokens = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g,
- formatFunctions = {},
- formatTokenFunctions = {};
- // token: 'M'
- // padded: ['MM', 2]
- // ordinal: 'Mo'
- // callback: function () { this.month() + 1 }
- function addFormatToken(token, padded, ordinal, callback) {
- var func = callback;
- if (typeof callback === 'string') {
- func = function () {
- return this[callback]();
- };
- }
- if (token) {
- formatTokenFunctions[token] = func;
- }
- if (padded) {
- formatTokenFunctions[padded[0]] = function () {
- return zeroFill(func.apply(this, arguments), padded[1], padded[2]);
- };
- }
- if (ordinal) {
- formatTokenFunctions[ordinal] = function () {
- return this.localeData().ordinal(
- func.apply(this, arguments),
- token
- );
- };
- }
- }
- function removeFormattingTokens(input) {
- if (input.match(/\[[\s\S]/)) {
- return input.replace(/^\[|\]$/g, '');
- }
- return input.replace(/\\/g, '');
- }
- function makeFormatFunction(format) {
- var array = format.match(formattingTokens),
- i,
- length;
- for (i = 0, length = array.length; i < length; i++) {
- if (formatTokenFunctions[array[i]]) {
- array[i] = formatTokenFunctions[array[i]];
- } else {
- array[i] = removeFormattingTokens(array[i]);
- }
- }
- return function (mom) {
- var output = '',
- i;
- for (i = 0; i < length; i++) {
- output += isFunction(array[i])
- ? array[i].call(mom, format)
- : array[i];
- }
- return output;
- };
- }
- // format date using native date object
- function formatMoment(m, format) {
- if (!m.isValid()) {
- return m.localeData().invalidDate();
- }
- format = expandFormat(format, m.localeData());
- formatFunctions[format] =
- formatFunctions[format] || makeFormatFunction(format);
- return formatFunctions[format](m);
- }
- function expandFormat(format, locale) {
- var i = 5;
- function replaceLongDateFormatTokens(input) {
- return locale.longDateFormat(input) || input;
- }
- localFormattingTokens.lastIndex = 0;
- while (i >= 0 && localFormattingTokens.test(format)) {
- format = format.replace(
- localFormattingTokens,
- replaceLongDateFormatTokens
- );
- localFormattingTokens.lastIndex = 0;
- i -= 1;
- }
- return format;
- }
- var defaultLongDateFormat = {
- LTS: 'h:mm:ss A',
- LT: 'h:mm A',
- L: 'MM/DD/YYYY',
- LL: 'MMMM D, YYYY',
- LLL: 'MMMM D, YYYY h:mm A',
- LLLL: 'dddd, MMMM D, YYYY h:mm A',
- };
- function longDateFormat(key) {
- var format = this._longDateFormat[key],
- formatUpper = this._longDateFormat[key.toUpperCase()];
- if (format || !formatUpper) {
- return format;
- }
- this._longDateFormat[key] = formatUpper
- .match(formattingTokens)
- .map(function (tok) {
- if (
- tok === 'MMMM' ||
- tok === 'MM' ||
- tok === 'DD' ||
- tok === 'dddd'
- ) {
- return tok.slice(1);
- }
- return tok;
- })
- .join('');
- return this._longDateFormat[key];
- }
- var defaultInvalidDate = 'Invalid date';
- function invalidDate() {
- return this._invalidDate;
- }
- var defaultOrdinal = '%d',
- defaultDayOfMonthOrdinalParse = /\d{1,2}/;
- function ordinal(number) {
- return this._ordinal.replace('%d', number);
- }
- var defaultRelativeTime = {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- w: 'a week',
- ww: '%d weeks',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- };
- function relativeTime(number, withoutSuffix, string, isFuture) {
- var output = this._relativeTime[string];
- return isFunction(output)
- ? output(number, withoutSuffix, string, isFuture)
- : output.replace(/%d/i, number);
- }
- function pastFuture(diff, output) {
- var format = this._relativeTime[diff > 0 ? 'future' : 'past'];
- return isFunction(format) ? format(output) : format.replace(/%s/i, output);
- }
- var aliases = {};
- function addUnitAlias(unit, shorthand) {
- var lowerCase = unit.toLowerCase();
- aliases[lowerCase] = aliases[lowerCase + 's'] = aliases[shorthand] = unit;
- }
- function normalizeUnits(units) {
- return typeof units === 'string'
- ? aliases[units] || aliases[units.toLowerCase()]
- : undefined;
- }
- function normalizeObjectUnits(inputObject) {
- var normalizedInput = {},
- normalizedProp,
- prop;
- for (prop in inputObject) {
- if (hasOwnProp(inputObject, prop)) {
- normalizedProp = normalizeUnits(prop);
- if (normalizedProp) {
- normalizedInput[normalizedProp] = inputObject[prop];
- }
- }
- }
- return normalizedInput;
- }
- var priorities = {};
- function addUnitPriority(unit, priority) {
- priorities[unit] = priority;
- }
- function getPrioritizedUnits(unitsObj) {
- var units = [],
- u;
- for (u in unitsObj) {
- if (hasOwnProp(unitsObj, u)) {
- units.push({ unit: u, priority: priorities[u] });
- }
- }
- units.sort(function (a, b) {
- return a.priority - b.priority;
- });
- return units;
- }
- function isLeapYear(year) {
- return (year % 4 === 0 && year % 100 !== 0) || year % 400 === 0;
- }
- function absFloor(number) {
- if (number < 0) {
- // -0 -> 0
- return Math.ceil(number) || 0;
- } else {
- return Math.floor(number);
- }
- }
- function toInt(argumentForCoercion) {
- var coercedNumber = +argumentForCoercion,
- value = 0;
- if (coercedNumber !== 0 && isFinite(coercedNumber)) {
- value = absFloor(coercedNumber);
- }
- return value;
- }
- function makeGetSet(unit, keepTime) {
- return function (value) {
- if (value != null) {
- set$1(this, unit, value);
- hooks.updateOffset(this, keepTime);
- return this;
- } else {
- return get(this, unit);
- }
- };
- }
- function get(mom, unit) {
- return mom.isValid()
- ? mom._d['get' + (mom._isUTC ? 'UTC' : '') + unit]()
- : NaN;
- }
- function set$1(mom, unit, value) {
- if (mom.isValid() && !isNaN(value)) {
- if (
- unit === 'FullYear' &&
- isLeapYear(mom.year()) &&
- mom.month() === 1 &&
- mom.date() === 29
- ) {
- value = toInt(value);
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](
- value,
- mom.month(),
- daysInMonth(value, mom.month())
- );
- } else {
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + unit](value);
- }
- }
- }
- // MOMENTS
- function stringGet(units) {
- units = normalizeUnits(units);
- if (isFunction(this[units])) {
- return this[units]();
- }
- return this;
- }
- function stringSet(units, value) {
- if (typeof units === 'object') {
- units = normalizeObjectUnits(units);
- var prioritized = getPrioritizedUnits(units),
- i,
- prioritizedLen = prioritized.length;
- for (i = 0; i < prioritizedLen; i++) {
- this[prioritized[i].unit](units[prioritized[i].unit]);
- }
- } else {
- units = normalizeUnits(units);
- if (isFunction(this[units])) {
- return this[units](value);
- }
- }
- return this;
- }
- var match1 = /\d/, // 0 - 9
- match2 = /\d\d/, // 00 - 99
- match3 = /\d{3}/, // 000 - 999
- match4 = /\d{4}/, // 0000 - 9999
- match6 = /[+-]?\d{6}/, // -999999 - 999999
- match1to2 = /\d\d?/, // 0 - 99
- match3to4 = /\d\d\d\d?/, // 999 - 9999
- match5to6 = /\d\d\d\d\d\d?/, // 99999 - 999999
- match1to3 = /\d{1,3}/, // 0 - 999
- match1to4 = /\d{1,4}/, // 0 - 9999
- match1to6 = /[+-]?\d{1,6}/, // -999999 - 999999
- matchUnsigned = /\d+/, // 0 - inf
- matchSigned = /[+-]?\d+/, // -inf - inf
- matchOffset = /Z|[+-]\d\d:?\d\d/gi, // +00:00 -00:00 +0000 -0000 or Z
- matchShortOffset = /Z|[+-]\d\d(?::?\d\d)?/gi, // +00 -00 +00:00 -00:00 +0000 -0000 or Z
- matchTimestamp = /[+-]?\d+(\.\d{1,3})?/, // 123456789 123456789.123
- // any word (or two) characters or numbers including two/three word month in arabic.
- // includes scottish gaelic two word and hyphenated months
- matchWord =
- /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i,
- regexes;
- regexes = {};
- function addRegexToken(token, regex, strictRegex) {
- regexes[token] = isFunction(regex)
- ? regex
- : function (isStrict, localeData) {
- return isStrict && strictRegex ? strictRegex : regex;
- };
- }
- function getParseRegexForToken(token, config) {
- if (!hasOwnProp(regexes, token)) {
- return new RegExp(unescapeFormat(token));
- }
- return regexes[token](config._strict, config._locale);
- }
- // Code from http://stackoverflow.com/questions/3561493/is-there-a-regexp-escape-function-in-javascript
- function unescapeFormat(s) {
- return regexEscape(
- s
- .replace('\\', '')
- .replace(
- /\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g,
- function (matched, p1, p2, p3, p4) {
- return p1 || p2 || p3 || p4;
- }
- )
- );
- }
- function regexEscape(s) {
- return s.replace(/[-\/\\^$*+?.()|[\]{}]/g, '\\$&');
- }
- var tokens = {};
- function addParseToken(token, callback) {
- var i,
- func = callback,
- tokenLen;
- if (typeof token === 'string') {
- token = [token];
- }
- if (isNumber(callback)) {
- func = function (input, array) {
- array[callback] = toInt(input);
- };
- }
- tokenLen = token.length;
- for (i = 0; i < tokenLen; i++) {
- tokens[token[i]] = func;
- }
- }
- function addWeekParseToken(token, callback) {
- addParseToken(token, function (input, array, config, token) {
- config._w = config._w || {};
- callback(input, config._w, config, token);
- });
- }
- function addTimeToArrayFromToken(token, input, config) {
- if (input != null && hasOwnProp(tokens, token)) {
- tokens[token](input, config._a, config, token);
- }
- }
- var YEAR = 0,
- MONTH = 1,
- DATE = 2,
- HOUR = 3,
- MINUTE = 4,
- SECOND = 5,
- MILLISECOND = 6,
- WEEK = 7,
- WEEKDAY = 8;
- function mod(n, x) {
- return ((n % x) + x) % x;
- }
- var indexOf;
- if (Array.prototype.indexOf) {
- indexOf = Array.prototype.indexOf;
- } else {
- indexOf = function (o) {
- // I know
- var i;
- for (i = 0; i < this.length; ++i) {
- if (this[i] === o) {
- return i;
- }
- }
- return -1;
- };
- }
- function daysInMonth(year, month) {
- if (isNaN(year) || isNaN(month)) {
- return NaN;
- }
- var modMonth = mod(month, 12);
- year += (month - modMonth) / 12;
- return modMonth === 1
- ? isLeapYear(year)
- ? 29
- : 28
- : 31 - ((modMonth % 7) % 2);
- }
- // FORMATTING
- addFormatToken('M', ['MM', 2], 'Mo', function () {
- return this.month() + 1;
- });
- addFormatToken('MMM', 0, 0, function (format) {
- return this.localeData().monthsShort(this, format);
- });
- addFormatToken('MMMM', 0, 0, function (format) {
- return this.localeData().months(this, format);
- });
- // ALIASES
- addUnitAlias('month', 'M');
- // PRIORITY
- addUnitPriority('month', 8);
- // PARSING
- addRegexToken('M', match1to2);
- addRegexToken('MM', match1to2, match2);
- addRegexToken('MMM', function (isStrict, locale) {
- return locale.monthsShortRegex(isStrict);
- });
- addRegexToken('MMMM', function (isStrict, locale) {
- return locale.monthsRegex(isStrict);
- });
- addParseToken(['M', 'MM'], function (input, array) {
- array[MONTH] = toInt(input) - 1;
- });
- addParseToken(['MMM', 'MMMM'], function (input, array, config, token) {
- var month = config._locale.monthsParse(input, token, config._strict);
- // if we didn't find a month name, mark the date as invalid.
- if (month != null) {
- array[MONTH] = month;
- } else {
- getParsingFlags(config).invalidMonth = input;
- }
- });
- // LOCALES
- var defaultLocaleMonths =
- 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- defaultLocaleMonthsShort =
- 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- MONTHS_IN_FORMAT = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/,
- defaultMonthsShortRegex = matchWord,
- defaultMonthsRegex = matchWord;
- function localeMonths(m, format) {
- if (!m) {
- return isArray(this._months)
- ? this._months
- : this._months['standalone'];
- }
- return isArray(this._months)
- ? this._months[m.month()]
- : this._months[
- (this._months.isFormat || MONTHS_IN_FORMAT).test(format)
- ? 'format'
- : 'standalone'
- ][m.month()];
- }
- function localeMonthsShort(m, format) {
- if (!m) {
- return isArray(this._monthsShort)
- ? this._monthsShort
- : this._monthsShort['standalone'];
- }
- return isArray(this._monthsShort)
- ? this._monthsShort[m.month()]
- : this._monthsShort[
- MONTHS_IN_FORMAT.test(format) ? 'format' : 'standalone'
- ][m.month()];
- }
- function handleStrictParse(monthName, format, strict) {
- var i,
- ii,
- mom,
- llc = monthName.toLocaleLowerCase();
- if (!this._monthsParse) {
- // this is not used
- this._monthsParse = [];
- this._longMonthsParse = [];
- this._shortMonthsParse = [];
- for (i = 0; i < 12; ++i) {
- mom = createUTC([2000, i]);
- this._shortMonthsParse[i] = this.monthsShort(
- mom,
- ''
- ).toLocaleLowerCase();
- this._longMonthsParse[i] = this.months(mom, '').toLocaleLowerCase();
- }
- }
- if (strict) {
- if (format === 'MMM') {
- ii = indexOf.call(this._shortMonthsParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._longMonthsParse, llc);
- return ii !== -1 ? ii : null;
- }
- } else {
- if (format === 'MMM') {
- ii = indexOf.call(this._shortMonthsParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._longMonthsParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._longMonthsParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._shortMonthsParse, llc);
- return ii !== -1 ? ii : null;
- }
- }
- }
- function localeMonthsParse(monthName, format, strict) {
- var i, mom, regex;
- if (this._monthsParseExact) {
- return handleStrictParse.call(this, monthName, format, strict);
- }
- if (!this._monthsParse) {
- this._monthsParse = [];
- this._longMonthsParse = [];
- this._shortMonthsParse = [];
- }
- // TODO: add sorting
- // Sorting makes sure if one month (or abbr) is a prefix of another
- // see sorting in computeMonthsParse
- for (i = 0; i < 12; i++) {
- // make the regex if we don't have it already
- mom = createUTC([2000, i]);
- if (strict && !this._longMonthsParse[i]) {
- this._longMonthsParse[i] = new RegExp(
- '^' + this.months(mom, '').replace('.', '') + '$',
- 'i'
- );
- this._shortMonthsParse[i] = new RegExp(
- '^' + this.monthsShort(mom, '').replace('.', '') + '$',
- 'i'
- );
- }
- if (!strict && !this._monthsParse[i]) {
- regex =
- '^' + this.months(mom, '') + '|^' + this.monthsShort(mom, '');
- this._monthsParse[i] = new RegExp(regex.replace('.', ''), 'i');
- }
- // test the regex
- if (
- strict &&
- format === 'MMMM' &&
- this._longMonthsParse[i].test(monthName)
- ) {
- return i;
- } else if (
- strict &&
- format === 'MMM' &&
- this._shortMonthsParse[i].test(monthName)
- ) {
- return i;
- } else if (!strict && this._monthsParse[i].test(monthName)) {
- return i;
- }
- }
- }
- // MOMENTS
- function setMonth(mom, value) {
- var dayOfMonth;
- if (!mom.isValid()) {
- // No op
- return mom;
- }
- if (typeof value === 'string') {
- if (/^\d+$/.test(value)) {
- value = toInt(value);
- } else {
- value = mom.localeData().monthsParse(value);
- // TODO: Another silent failure?
- if (!isNumber(value)) {
- return mom;
- }
- }
- }
- dayOfMonth = Math.min(mom.date(), daysInMonth(mom.year(), value));
- mom._d['set' + (mom._isUTC ? 'UTC' : '') + 'Month'](value, dayOfMonth);
- return mom;
- }
- function getSetMonth(value) {
- if (value != null) {
- setMonth(this, value);
- hooks.updateOffset(this, true);
- return this;
- } else {
- return get(this, 'Month');
- }
- }
- function getDaysInMonth() {
- return daysInMonth(this.year(), this.month());
- }
- function monthsShortRegex(isStrict) {
- if (this._monthsParseExact) {
- if (!hasOwnProp(this, '_monthsRegex')) {
- computeMonthsParse.call(this);
- }
- if (isStrict) {
- return this._monthsShortStrictRegex;
- } else {
- return this._monthsShortRegex;
- }
- } else {
- if (!hasOwnProp(this, '_monthsShortRegex')) {
- this._monthsShortRegex = defaultMonthsShortRegex;
- }
- return this._monthsShortStrictRegex && isStrict
- ? this._monthsShortStrictRegex
- : this._monthsShortRegex;
- }
- }
- function monthsRegex(isStrict) {
- if (this._monthsParseExact) {
- if (!hasOwnProp(this, '_monthsRegex')) {
- computeMonthsParse.call(this);
- }
- if (isStrict) {
- return this._monthsStrictRegex;
- } else {
- return this._monthsRegex;
- }
- } else {
- if (!hasOwnProp(this, '_monthsRegex')) {
- this._monthsRegex = defaultMonthsRegex;
- }
- return this._monthsStrictRegex && isStrict
- ? this._monthsStrictRegex
- : this._monthsRegex;
- }
- }
- function computeMonthsParse() {
- function cmpLenRev(a, b) {
- return b.length - a.length;
- }
- var shortPieces = [],
- longPieces = [],
- mixedPieces = [],
- i,
- mom;
- for (i = 0; i < 12; i++) {
- // make the regex if we don't have it already
- mom = createUTC([2000, i]);
- shortPieces.push(this.monthsShort(mom, ''));
- longPieces.push(this.months(mom, ''));
- mixedPieces.push(this.months(mom, ''));
- mixedPieces.push(this.monthsShort(mom, ''));
- }
- // Sorting makes sure if one month (or abbr) is a prefix of another it
- // will match the longer piece.
- shortPieces.sort(cmpLenRev);
- longPieces.sort(cmpLenRev);
- mixedPieces.sort(cmpLenRev);
- for (i = 0; i < 12; i++) {
- shortPieces[i] = regexEscape(shortPieces[i]);
- longPieces[i] = regexEscape(longPieces[i]);
- }
- for (i = 0; i < 24; i++) {
- mixedPieces[i] = regexEscape(mixedPieces[i]);
- }
- this._monthsRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
- this._monthsShortRegex = this._monthsRegex;
- this._monthsStrictRegex = new RegExp(
- '^(' + longPieces.join('|') + ')',
- 'i'
- );
- this._monthsShortStrictRegex = new RegExp(
- '^(' + shortPieces.join('|') + ')',
- 'i'
- );
- }
- // FORMATTING
- addFormatToken('Y', 0, 0, function () {
- var y = this.year();
- return y <= 9999 ? zeroFill(y, 4) : '+' + y;
- });
- addFormatToken(0, ['YY', 2], 0, function () {
- return this.year() % 100;
- });
- addFormatToken(0, ['YYYY', 4], 0, 'year');
- addFormatToken(0, ['YYYYY', 5], 0, 'year');
- addFormatToken(0, ['YYYYYY', 6, true], 0, 'year');
- // ALIASES
- addUnitAlias('year', 'y');
- // PRIORITIES
- addUnitPriority('year', 1);
- // PARSING
- addRegexToken('Y', matchSigned);
- addRegexToken('YY', match1to2, match2);
- addRegexToken('YYYY', match1to4, match4);
- addRegexToken('YYYYY', match1to6, match6);
- addRegexToken('YYYYYY', match1to6, match6);
- addParseToken(['YYYYY', 'YYYYYY'], YEAR);
- addParseToken('YYYY', function (input, array) {
- array[YEAR] =
- input.length === 2 ? hooks.parseTwoDigitYear(input) : toInt(input);
- });
- addParseToken('YY', function (input, array) {
- array[YEAR] = hooks.parseTwoDigitYear(input);
- });
- addParseToken('Y', function (input, array) {
- array[YEAR] = parseInt(input, 10);
- });
- // HELPERS
- function daysInYear(year) {
- return isLeapYear(year) ? 366 : 365;
- }
- // HOOKS
- hooks.parseTwoDigitYear = function (input) {
- return toInt(input) + (toInt(input) > 68 ? 1900 : 2000);
- };
- // MOMENTS
- var getSetYear = makeGetSet('FullYear', true);
- function getIsLeapYear() {
- return isLeapYear(this.year());
- }
- function createDate(y, m, d, h, M, s, ms) {
- // can't just apply() to create a date:
- // https://stackoverflow.com/q/181348
- var date;
- // the date constructor remaps years 0-99 to 1900-1999
- if (y < 100 && y >= 0) {
- // preserve leap years using a full 400 year cycle, then reset
- date = new Date(y + 400, m, d, h, M, s, ms);
- if (isFinite(date.getFullYear())) {
- date.setFullYear(y);
- }
- } else {
- date = new Date(y, m, d, h, M, s, ms);
- }
- return date;
- }
- function createUTCDate(y) {
- var date, args;
- // the Date.UTC function remaps years 0-99 to 1900-1999
- if (y < 100 && y >= 0) {
- args = Array.prototype.slice.call(arguments);
- // preserve leap years using a full 400 year cycle, then reset
- args[0] = y + 400;
- date = new Date(Date.UTC.apply(null, args));
- if (isFinite(date.getUTCFullYear())) {
- date.setUTCFullYear(y);
- }
- } else {
- date = new Date(Date.UTC.apply(null, arguments));
- }
- return date;
- }
- // start-of-first-week - start-of-year
- function firstWeekOffset(year, dow, doy) {
- var // first-week day -- which january is always in the first week (4 for iso, 1 for other)
- fwd = 7 + dow - doy,
- // first-week day local weekday -- which local weekday is fwd
- fwdlw = (7 + createUTCDate(year, 0, fwd).getUTCDay() - dow) % 7;
- return -fwdlw + fwd - 1;
- }
- // https://en.wikipedia.org/wiki/ISO_week_date#Calculating_a_date_given_the_year.2C_week_number_and_weekday
- function dayOfYearFromWeeks(year, week, weekday, dow, doy) {
- var localWeekday = (7 + weekday - dow) % 7,
- weekOffset = firstWeekOffset(year, dow, doy),
- dayOfYear = 1 + 7 * (week - 1) + localWeekday + weekOffset,
- resYear,
- resDayOfYear;
- if (dayOfYear <= 0) {
- resYear = year - 1;
- resDayOfYear = daysInYear(resYear) + dayOfYear;
- } else if (dayOfYear > daysInYear(year)) {
- resYear = year + 1;
- resDayOfYear = dayOfYear - daysInYear(year);
- } else {
- resYear = year;
- resDayOfYear = dayOfYear;
- }
- return {
- year: resYear,
- dayOfYear: resDayOfYear,
- };
- }
- function weekOfYear(mom, dow, doy) {
- var weekOffset = firstWeekOffset(mom.year(), dow, doy),
- week = Math.floor((mom.dayOfYear() - weekOffset - 1) / 7) + 1,
- resWeek,
- resYear;
- if (week < 1) {
- resYear = mom.year() - 1;
- resWeek = week + weeksInYear(resYear, dow, doy);
- } else if (week > weeksInYear(mom.year(), dow, doy)) {
- resWeek = week - weeksInYear(mom.year(), dow, doy);
- resYear = mom.year() + 1;
- } else {
- resYear = mom.year();
- resWeek = week;
- }
- return {
- week: resWeek,
- year: resYear,
- };
- }
- function weeksInYear(year, dow, doy) {
- var weekOffset = firstWeekOffset(year, dow, doy),
- weekOffsetNext = firstWeekOffset(year + 1, dow, doy);
- return (daysInYear(year) - weekOffset + weekOffsetNext) / 7;
- }
- // FORMATTING
- addFormatToken('w', ['ww', 2], 'wo', 'week');
- addFormatToken('W', ['WW', 2], 'Wo', 'isoWeek');
- // ALIASES
- addUnitAlias('week', 'w');
- addUnitAlias('isoWeek', 'W');
- // PRIORITIES
- addUnitPriority('week', 5);
- addUnitPriority('isoWeek', 5);
- // PARSING
- addRegexToken('w', match1to2);
- addRegexToken('ww', match1to2, match2);
- addRegexToken('W', match1to2);
- addRegexToken('WW', match1to2, match2);
- addWeekParseToken(
- ['w', 'ww', 'W', 'WW'],
- function (input, week, config, token) {
- week[token.substr(0, 1)] = toInt(input);
- }
- );
- // HELPERS
- // LOCALES
- function localeWeek(mom) {
- return weekOfYear(mom, this._week.dow, this._week.doy).week;
- }
- var defaultLocaleWeek = {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- };
- function localeFirstDayOfWeek() {
- return this._week.dow;
- }
- function localeFirstDayOfYear() {
- return this._week.doy;
- }
- // MOMENTS
- function getSetWeek(input) {
- var week = this.localeData().week(this);
- return input == null ? week : this.add((input - week) * 7, 'd');
- }
- function getSetISOWeek(input) {
- var week = weekOfYear(this, 1, 4).week;
- return input == null ? week : this.add((input - week) * 7, 'd');
- }
- // FORMATTING
- addFormatToken('d', 0, 'do', 'day');
- addFormatToken('dd', 0, 0, function (format) {
- return this.localeData().weekdaysMin(this, format);
- });
- addFormatToken('ddd', 0, 0, function (format) {
- return this.localeData().weekdaysShort(this, format);
- });
- addFormatToken('dddd', 0, 0, function (format) {
- return this.localeData().weekdays(this, format);
- });
- addFormatToken('e', 0, 0, 'weekday');
- addFormatToken('E', 0, 0, 'isoWeekday');
- // ALIASES
- addUnitAlias('day', 'd');
- addUnitAlias('weekday', 'e');
- addUnitAlias('isoWeekday', 'E');
- // PRIORITY
- addUnitPriority('day', 11);
- addUnitPriority('weekday', 11);
- addUnitPriority('isoWeekday', 11);
- // PARSING
- addRegexToken('d', match1to2);
- addRegexToken('e', match1to2);
- addRegexToken('E', match1to2);
- addRegexToken('dd', function (isStrict, locale) {
- return locale.weekdaysMinRegex(isStrict);
- });
- addRegexToken('ddd', function (isStrict, locale) {
- return locale.weekdaysShortRegex(isStrict);
- });
- addRegexToken('dddd', function (isStrict, locale) {
- return locale.weekdaysRegex(isStrict);
- });
- addWeekParseToken(['dd', 'ddd', 'dddd'], function (input, week, config, token) {
- var weekday = config._locale.weekdaysParse(input, token, config._strict);
- // if we didn't get a weekday name, mark the date as invalid
- if (weekday != null) {
- week.d = weekday;
- } else {
- getParsingFlags(config).invalidWeekday = input;
- }
- });
- addWeekParseToken(['d', 'e', 'E'], function (input, week, config, token) {
- week[token] = toInt(input);
- });
- // HELPERS
- function parseWeekday(input, locale) {
- if (typeof input !== 'string') {
- return input;
- }
- if (!isNaN(input)) {
- return parseInt(input, 10);
- }
- input = locale.weekdaysParse(input);
- if (typeof input === 'number') {
- return input;
- }
- return null;
- }
- function parseIsoWeekday(input, locale) {
- if (typeof input === 'string') {
- return locale.weekdaysParse(input) % 7 || 7;
- }
- return isNaN(input) ? null : input;
- }
- // LOCALES
- function shiftWeekdays(ws, n) {
- return ws.slice(n, 7).concat(ws.slice(0, n));
- }
- var defaultLocaleWeekdays =
- 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split('_'),
- defaultLocaleWeekdaysShort = 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- defaultLocaleWeekdaysMin = 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- defaultWeekdaysRegex = matchWord,
- defaultWeekdaysShortRegex = matchWord,
- defaultWeekdaysMinRegex = matchWord;
- function localeWeekdays(m, format) {
- var weekdays = isArray(this._weekdays)
- ? this._weekdays
- : this._weekdays[
- m && m !== true && this._weekdays.isFormat.test(format)
- ? 'format'
- : 'standalone'
- ];
- return m === true
- ? shiftWeekdays(weekdays, this._week.dow)
- : m
- ? weekdays[m.day()]
- : weekdays;
- }
- function localeWeekdaysShort(m) {
- return m === true
- ? shiftWeekdays(this._weekdaysShort, this._week.dow)
- : m
- ? this._weekdaysShort[m.day()]
- : this._weekdaysShort;
- }
- function localeWeekdaysMin(m) {
- return m === true
- ? shiftWeekdays(this._weekdaysMin, this._week.dow)
- : m
- ? this._weekdaysMin[m.day()]
- : this._weekdaysMin;
- }
- function handleStrictParse$1(weekdayName, format, strict) {
- var i,
- ii,
- mom,
- llc = weekdayName.toLocaleLowerCase();
- if (!this._weekdaysParse) {
- this._weekdaysParse = [];
- this._shortWeekdaysParse = [];
- this._minWeekdaysParse = [];
- for (i = 0; i < 7; ++i) {
- mom = createUTC([2000, 1]).day(i);
- this._minWeekdaysParse[i] = this.weekdaysMin(
- mom,
- ''
- ).toLocaleLowerCase();
- this._shortWeekdaysParse[i] = this.weekdaysShort(
- mom,
- ''
- ).toLocaleLowerCase();
- this._weekdaysParse[i] = this.weekdays(mom, '').toLocaleLowerCase();
- }
- }
- if (strict) {
- if (format === 'dddd') {
- ii = indexOf.call(this._weekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else if (format === 'ddd') {
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._minWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- }
- } else {
- if (format === 'dddd') {
- ii = indexOf.call(this._weekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._minWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else if (format === 'ddd') {
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._weekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._minWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- } else {
- ii = indexOf.call(this._minWeekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._weekdaysParse, llc);
- if (ii !== -1) {
- return ii;
- }
- ii = indexOf.call(this._shortWeekdaysParse, llc);
- return ii !== -1 ? ii : null;
- }
- }
- }
- function localeWeekdaysParse(weekdayName, format, strict) {
- var i, mom, regex;
- if (this._weekdaysParseExact) {
- return handleStrictParse$1.call(this, weekdayName, format, strict);
- }
- if (!this._weekdaysParse) {
- this._weekdaysParse = [];
- this._minWeekdaysParse = [];
- this._shortWeekdaysParse = [];
- this._fullWeekdaysParse = [];
- }
- for (i = 0; i < 7; i++) {
- // make the regex if we don't have it already
- mom = createUTC([2000, 1]).day(i);
- if (strict && !this._fullWeekdaysParse[i]) {
- this._fullWeekdaysParse[i] = new RegExp(
- '^' + this.weekdays(mom, '').replace('.', '\\.?') + '$',
- 'i'
- );
- this._shortWeekdaysParse[i] = new RegExp(
- '^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$',
- 'i'
- );
- this._minWeekdaysParse[i] = new RegExp(
- '^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$',
- 'i'
- );
- }
- if (!this._weekdaysParse[i]) {
- regex =
- '^' +
- this.weekdays(mom, '') +
- '|^' +
- this.weekdaysShort(mom, '') +
- '|^' +
- this.weekdaysMin(mom, '');
- this._weekdaysParse[i] = new RegExp(regex.replace('.', ''), 'i');
- }
- // test the regex
- if (
- strict &&
- format === 'dddd' &&
- this._fullWeekdaysParse[i].test(weekdayName)
- ) {
- return i;
- } else if (
- strict &&
- format === 'ddd' &&
- this._shortWeekdaysParse[i].test(weekdayName)
- ) {
- return i;
- } else if (
- strict &&
- format === 'dd' &&
- this._minWeekdaysParse[i].test(weekdayName)
- ) {
- return i;
- } else if (!strict && this._weekdaysParse[i].test(weekdayName)) {
- return i;
- }
- }
- }
- // MOMENTS
- function getSetDayOfWeek(input) {
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- var day = this._isUTC ? this._d.getUTCDay() : this._d.getDay();
- if (input != null) {
- input = parseWeekday(input, this.localeData());
- return this.add(input - day, 'd');
- } else {
- return day;
- }
- }
- function getSetLocaleDayOfWeek(input) {
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- var weekday = (this.day() + 7 - this.localeData()._week.dow) % 7;
- return input == null ? weekday : this.add(input - weekday, 'd');
- }
- function getSetISODayOfWeek(input) {
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- // behaves the same as moment#day except
- // as a getter, returns 7 instead of 0 (1-7 range instead of 0-6)
- // as a setter, sunday should belong to the previous week.
- if (input != null) {
- var weekday = parseIsoWeekday(input, this.localeData());
- return this.day(this.day() % 7 ? weekday : weekday - 7);
- } else {
- return this.day() || 7;
- }
- }
- function weekdaysRegex(isStrict) {
- if (this._weekdaysParseExact) {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- computeWeekdaysParse.call(this);
- }
- if (isStrict) {
- return this._weekdaysStrictRegex;
- } else {
- return this._weekdaysRegex;
- }
- } else {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- this._weekdaysRegex = defaultWeekdaysRegex;
- }
- return this._weekdaysStrictRegex && isStrict
- ? this._weekdaysStrictRegex
- : this._weekdaysRegex;
- }
- }
- function weekdaysShortRegex(isStrict) {
- if (this._weekdaysParseExact) {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- computeWeekdaysParse.call(this);
- }
- if (isStrict) {
- return this._weekdaysShortStrictRegex;
- } else {
- return this._weekdaysShortRegex;
- }
- } else {
- if (!hasOwnProp(this, '_weekdaysShortRegex')) {
- this._weekdaysShortRegex = defaultWeekdaysShortRegex;
- }
- return this._weekdaysShortStrictRegex && isStrict
- ? this._weekdaysShortStrictRegex
- : this._weekdaysShortRegex;
- }
- }
- function weekdaysMinRegex(isStrict) {
- if (this._weekdaysParseExact) {
- if (!hasOwnProp(this, '_weekdaysRegex')) {
- computeWeekdaysParse.call(this);
- }
- if (isStrict) {
- return this._weekdaysMinStrictRegex;
- } else {
- return this._weekdaysMinRegex;
- }
- } else {
- if (!hasOwnProp(this, '_weekdaysMinRegex')) {
- this._weekdaysMinRegex = defaultWeekdaysMinRegex;
- }
- return this._weekdaysMinStrictRegex && isStrict
- ? this._weekdaysMinStrictRegex
- : this._weekdaysMinRegex;
- }
- }
- function computeWeekdaysParse() {
- function cmpLenRev(a, b) {
- return b.length - a.length;
- }
- var minPieces = [],
- shortPieces = [],
- longPieces = [],
- mixedPieces = [],
- i,
- mom,
- minp,
- shortp,
- longp;
- for (i = 0; i < 7; i++) {
- // make the regex if we don't have it already
- mom = createUTC([2000, 1]).day(i);
- minp = regexEscape(this.weekdaysMin(mom, ''));
- shortp = regexEscape(this.weekdaysShort(mom, ''));
- longp = regexEscape(this.weekdays(mom, ''));
- minPieces.push(minp);
- shortPieces.push(shortp);
- longPieces.push(longp);
- mixedPieces.push(minp);
- mixedPieces.push(shortp);
- mixedPieces.push(longp);
- }
- // Sorting makes sure if one weekday (or abbr) is a prefix of another it
- // will match the longer piece.
- minPieces.sort(cmpLenRev);
- shortPieces.sort(cmpLenRev);
- longPieces.sort(cmpLenRev);
- mixedPieces.sort(cmpLenRev);
- this._weekdaysRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
- this._weekdaysShortRegex = this._weekdaysRegex;
- this._weekdaysMinRegex = this._weekdaysRegex;
- this._weekdaysStrictRegex = new RegExp(
- '^(' + longPieces.join('|') + ')',
- 'i'
- );
- this._weekdaysShortStrictRegex = new RegExp(
- '^(' + shortPieces.join('|') + ')',
- 'i'
- );
- this._weekdaysMinStrictRegex = new RegExp(
- '^(' + minPieces.join('|') + ')',
- 'i'
- );
- }
- // FORMATTING
- function hFormat() {
- return this.hours() % 12 || 12;
- }
- function kFormat() {
- return this.hours() || 24;
- }
- addFormatToken('H', ['HH', 2], 0, 'hour');
- addFormatToken('h', ['hh', 2], 0, hFormat);
- addFormatToken('k', ['kk', 2], 0, kFormat);
- addFormatToken('hmm', 0, 0, function () {
- return '' + hFormat.apply(this) + zeroFill(this.minutes(), 2);
- });
- addFormatToken('hmmss', 0, 0, function () {
- return (
- '' +
- hFormat.apply(this) +
- zeroFill(this.minutes(), 2) +
- zeroFill(this.seconds(), 2)
- );
- });
- addFormatToken('Hmm', 0, 0, function () {
- return '' + this.hours() + zeroFill(this.minutes(), 2);
- });
- addFormatToken('Hmmss', 0, 0, function () {
- return (
- '' +
- this.hours() +
- zeroFill(this.minutes(), 2) +
- zeroFill(this.seconds(), 2)
- );
- });
- function meridiem(token, lowercase) {
- addFormatToken(token, 0, 0, function () {
- return this.localeData().meridiem(
- this.hours(),
- this.minutes(),
- lowercase
- );
- });
- }
- meridiem('a', true);
- meridiem('A', false);
- // ALIASES
- addUnitAlias('hour', 'h');
- // PRIORITY
- addUnitPriority('hour', 13);
- // PARSING
- function matchMeridiem(isStrict, locale) {
- return locale._meridiemParse;
- }
- addRegexToken('a', matchMeridiem);
- addRegexToken('A', matchMeridiem);
- addRegexToken('H', match1to2);
- addRegexToken('h', match1to2);
- addRegexToken('k', match1to2);
- addRegexToken('HH', match1to2, match2);
- addRegexToken('hh', match1to2, match2);
- addRegexToken('kk', match1to2, match2);
- addRegexToken('hmm', match3to4);
- addRegexToken('hmmss', match5to6);
- addRegexToken('Hmm', match3to4);
- addRegexToken('Hmmss', match5to6);
- addParseToken(['H', 'HH'], HOUR);
- addParseToken(['k', 'kk'], function (input, array, config) {
- var kInput = toInt(input);
- array[HOUR] = kInput === 24 ? 0 : kInput;
- });
- addParseToken(['a', 'A'], function (input, array, config) {
- config._isPm = config._locale.isPM(input);
- config._meridiem = input;
- });
- addParseToken(['h', 'hh'], function (input, array, config) {
- array[HOUR] = toInt(input);
- getParsingFlags(config).bigHour = true;
- });
- addParseToken('hmm', function (input, array, config) {
- var pos = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos));
- array[MINUTE] = toInt(input.substr(pos));
- getParsingFlags(config).bigHour = true;
- });
- addParseToken('hmmss', function (input, array, config) {
- var pos1 = input.length - 4,
- pos2 = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos1));
- array[MINUTE] = toInt(input.substr(pos1, 2));
- array[SECOND] = toInt(input.substr(pos2));
- getParsingFlags(config).bigHour = true;
- });
- addParseToken('Hmm', function (input, array, config) {
- var pos = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos));
- array[MINUTE] = toInt(input.substr(pos));
- });
- addParseToken('Hmmss', function (input, array, config) {
- var pos1 = input.length - 4,
- pos2 = input.length - 2;
- array[HOUR] = toInt(input.substr(0, pos1));
- array[MINUTE] = toInt(input.substr(pos1, 2));
- array[SECOND] = toInt(input.substr(pos2));
- });
- // LOCALES
- function localeIsPM(input) {
- // IE8 Quirks Mode & IE7 Standards Mode do not allow accessing strings like arrays
- // Using charAt should be more compatible.
- return (input + '').toLowerCase().charAt(0) === 'p';
- }
- var defaultLocaleMeridiemParse = /[ap]\.?m?\.?/i,
- // Setting the hour should keep the time, because the user explicitly
- // specified which hour they want. So trying to maintain the same hour (in
- // a new timezone) makes sense. Adding/subtracting hours does not follow
- // this rule.
- getSetHour = makeGetSet('Hours', true);
- function localeMeridiem(hours, minutes, isLower) {
- if (hours > 11) {
- return isLower ? 'pm' : 'PM';
- } else {
- return isLower ? 'am' : 'AM';
- }
- }
- var baseConfig = {
- calendar: defaultCalendar,
- longDateFormat: defaultLongDateFormat,
- invalidDate: defaultInvalidDate,
- ordinal: defaultOrdinal,
- dayOfMonthOrdinalParse: defaultDayOfMonthOrdinalParse,
- relativeTime: defaultRelativeTime,
- months: defaultLocaleMonths,
- monthsShort: defaultLocaleMonthsShort,
- week: defaultLocaleWeek,
- weekdays: defaultLocaleWeekdays,
- weekdaysMin: defaultLocaleWeekdaysMin,
- weekdaysShort: defaultLocaleWeekdaysShort,
- meridiemParse: defaultLocaleMeridiemParse,
- };
- // internal storage for locale config files
- var locales = {},
- localeFamilies = {},
- globalLocale;
- function commonPrefix(arr1, arr2) {
- var i,
- minl = Math.min(arr1.length, arr2.length);
- for (i = 0; i < minl; i += 1) {
- if (arr1[i] !== arr2[i]) {
- return i;
- }
- }
- return minl;
- }
- function normalizeLocale(key) {
- return key ? key.toLowerCase().replace('_', '-') : key;
- }
- // pick the locale from the array
- // try ['en-au', 'en-gb'] as 'en-au', 'en-gb', 'en', as in move through the list trying each
- // substring from most specific to least, but move to the next array item if it's a more specific variant than the current root
- function chooseLocale(names) {
- var i = 0,
- j,
- next,
- locale,
- split;
- while (i < names.length) {
- split = normalizeLocale(names[i]).split('-');
- j = split.length;
- next = normalizeLocale(names[i + 1]);
- next = next ? next.split('-') : null;
- while (j > 0) {
- locale = loadLocale(split.slice(0, j).join('-'));
- if (locale) {
- return locale;
- }
- if (
- next &&
- next.length >= j &&
- commonPrefix(split, next) >= j - 1
- ) {
- //the next array item is better than a shallower substring of this one
- break;
- }
- j--;
- }
- i++;
- }
- return globalLocale;
- }
- function isLocaleNameSane(name) {
- // Prevent names that look like filesystem paths, i.e contain '/' or '\'
- return name.match('^[^/\\\\]*$') != null;
- }
- function loadLocale(name) {
- var oldLocale = null,
- aliasedRequire;
- // TODO: Find a better way to register and load all the locales in Node
- if (
- locales[name] === undefined &&
- typeof module !== 'undefined' &&
- module &&
- module.exports &&
- isLocaleNameSane(name)
- ) {
- try {
- oldLocale = globalLocale._abbr;
- aliasedRequire = require;
- aliasedRequire('./locale/' + name);
- getSetGlobalLocale(oldLocale);
- } catch (e) {
- // mark as not found to avoid repeating expensive file require call causing high CPU
- // when trying to find en-US, en_US, en-us for every format call
- locales[name] = null; // null means not found
- }
- }
- return locales[name];
- }
- // This function will load locale and then set the global locale. If
- // no arguments are passed in, it will simply return the current global
- // locale key.
- function getSetGlobalLocale(key, values) {
- var data;
- if (key) {
- if (isUndefined(values)) {
- data = getLocale(key);
- } else {
- data = defineLocale(key, values);
- }
- if (data) {
- // moment.duration._locale = moment._locale = data;
- globalLocale = data;
- } else {
- if (typeof console !== 'undefined' && console.warn) {
- //warn user if arguments are passed but the locale could not be set
- console.warn(
- 'Locale ' + key + ' not found. Did you forget to load it?'
- );
- }
- }
- }
- return globalLocale._abbr;
- }
- function defineLocale(name, config) {
- if (config !== null) {
- var locale,
- parentConfig = baseConfig;
- config.abbr = name;
- if (locales[name] != null) {
- deprecateSimple(
- 'defineLocaleOverride',
- 'use moment.updateLocale(localeName, config) to change ' +
- 'an existing locale. moment.defineLocale(localeName, ' +
- 'config) should only be used for creating a new locale ' +
- 'See http://momentjs.com/guides/#/warnings/define-locale/ for more info.'
- );
- parentConfig = locales[name]._config;
- } else if (config.parentLocale != null) {
- if (locales[config.parentLocale] != null) {
- parentConfig = locales[config.parentLocale]._config;
- } else {
- locale = loadLocale(config.parentLocale);
- if (locale != null) {
- parentConfig = locale._config;
- } else {
- if (!localeFamilies[config.parentLocale]) {
- localeFamilies[config.parentLocale] = [];
- }
- localeFamilies[config.parentLocale].push({
- name: name,
- config: config,
- });
- return null;
- }
- }
- }
- locales[name] = new Locale(mergeConfigs(parentConfig, config));
- if (localeFamilies[name]) {
- localeFamilies[name].forEach(function (x) {
- defineLocale(x.name, x.config);
- });
- }
- // backwards compat for now: also set the locale
- // make sure we set the locale AFTER all child locales have been
- // created, so we won't end up with the child locale set.
- getSetGlobalLocale(name);
- return locales[name];
- } else {
- // useful for testing
- delete locales[name];
- return null;
- }
- }
- function updateLocale(name, config) {
- if (config != null) {
- var locale,
- tmpLocale,
- parentConfig = baseConfig;
- if (locales[name] != null && locales[name].parentLocale != null) {
- // Update existing child locale in-place to avoid memory-leaks
- locales[name].set(mergeConfigs(locales[name]._config, config));
- } else {
- // MERGE
- tmpLocale = loadLocale(name);
- if (tmpLocale != null) {
- parentConfig = tmpLocale._config;
- }
- config = mergeConfigs(parentConfig, config);
- if (tmpLocale == null) {
- // updateLocale is called for creating a new locale
- // Set abbr so it will have a name (getters return
- // undefined otherwise).
- config.abbr = name;
- }
- locale = new Locale(config);
- locale.parentLocale = locales[name];
- locales[name] = locale;
- }
- // backwards compat for now: also set the locale
- getSetGlobalLocale(name);
- } else {
- // pass null for config to unupdate, useful for tests
- if (locales[name] != null) {
- if (locales[name].parentLocale != null) {
- locales[name] = locales[name].parentLocale;
- if (name === getSetGlobalLocale()) {
- getSetGlobalLocale(name);
- }
- } else if (locales[name] != null) {
- delete locales[name];
- }
- }
- }
- return locales[name];
- }
- // returns locale data
- function getLocale(key) {
- var locale;
- if (key && key._locale && key._locale._abbr) {
- key = key._locale._abbr;
- }
- if (!key) {
- return globalLocale;
- }
- if (!isArray(key)) {
- //short-circuit everything else
- locale = loadLocale(key);
- if (locale) {
- return locale;
- }
- key = [key];
- }
- return chooseLocale(key);
- }
- function listLocales() {
- return keys(locales);
- }
- function checkOverflow(m) {
- var overflow,
- a = m._a;
- if (a && getParsingFlags(m).overflow === -2) {
- overflow =
- a[MONTH] < 0 || a[MONTH] > 11
- ? MONTH
- : a[DATE] < 1 || a[DATE] > daysInMonth(a[YEAR], a[MONTH])
- ? DATE
- : a[HOUR] < 0 ||
- a[HOUR] > 24 ||
- (a[HOUR] === 24 &&
- (a[MINUTE] !== 0 ||
- a[SECOND] !== 0 ||
- a[MILLISECOND] !== 0))
- ? HOUR
- : a[MINUTE] < 0 || a[MINUTE] > 59
- ? MINUTE
- : a[SECOND] < 0 || a[SECOND] > 59
- ? SECOND
- : a[MILLISECOND] < 0 || a[MILLISECOND] > 999
- ? MILLISECOND
- : -1;
- if (
- getParsingFlags(m)._overflowDayOfYear &&
- (overflow < YEAR || overflow > DATE)
- ) {
- overflow = DATE;
- }
- if (getParsingFlags(m)._overflowWeeks && overflow === -1) {
- overflow = WEEK;
- }
- if (getParsingFlags(m)._overflowWeekday && overflow === -1) {
- overflow = WEEKDAY;
- }
- getParsingFlags(m).overflow = overflow;
- }
- return m;
- }
- // iso 8601 regex
- // 0000-00-00 0000-W00 or 0000-W00-0 + T + 00 or 00:00 or 00:00:00 or 00:00:00.000 + +00:00 or +0000 or +00)
- var extendedIsoRegex =
- /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
- basicIsoRegex =
- /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/,
- tzRegex = /Z|[+-]\d\d(?::?\d\d)?/,
- isoDates = [
- ['YYYYYY-MM-DD', /[+-]\d{6}-\d\d-\d\d/],
- ['YYYY-MM-DD', /\d{4}-\d\d-\d\d/],
- ['GGGG-[W]WW-E', /\d{4}-W\d\d-\d/],
- ['GGGG-[W]WW', /\d{4}-W\d\d/, false],
- ['YYYY-DDD', /\d{4}-\d{3}/],
- ['YYYY-MM', /\d{4}-\d\d/, false],
- ['YYYYYYMMDD', /[+-]\d{10}/],
- ['YYYYMMDD', /\d{8}/],
- ['GGGG[W]WWE', /\d{4}W\d{3}/],
- ['GGGG[W]WW', /\d{4}W\d{2}/, false],
- ['YYYYDDD', /\d{7}/],
- ['YYYYMM', /\d{6}/, false],
- ['YYYY', /\d{4}/, false],
- ],
- // iso time formats and regexes
- isoTimes = [
- ['HH:mm:ss.SSSS', /\d\d:\d\d:\d\d\.\d+/],
- ['HH:mm:ss,SSSS', /\d\d:\d\d:\d\d,\d+/],
- ['HH:mm:ss', /\d\d:\d\d:\d\d/],
- ['HH:mm', /\d\d:\d\d/],
- ['HHmmss.SSSS', /\d\d\d\d\d\d\.\d+/],
- ['HHmmss,SSSS', /\d\d\d\d\d\d,\d+/],
- ['HHmmss', /\d\d\d\d\d\d/],
- ['HHmm', /\d\d\d\d/],
- ['HH', /\d\d/],
- ],
- aspNetJsonRegex = /^\/?Date\((-?\d+)/i,
- // RFC 2822 regex: For details see https://tools.ietf.org/html/rfc2822#section-3.3
- rfc2822 =
- /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/,
- obsOffsets = {
- UT: 0,
- GMT: 0,
- EDT: -4 * 60,
- EST: -5 * 60,
- CDT: -5 * 60,
- CST: -6 * 60,
- MDT: -6 * 60,
- MST: -7 * 60,
- PDT: -7 * 60,
- PST: -8 * 60,
- };
- // date from iso format
- function configFromISO(config) {
- var i,
- l,
- string = config._i,
- match = extendedIsoRegex.exec(string) || basicIsoRegex.exec(string),
- allowTime,
- dateFormat,
- timeFormat,
- tzFormat,
- isoDatesLen = isoDates.length,
- isoTimesLen = isoTimes.length;
- if (match) {
- getParsingFlags(config).iso = true;
- for (i = 0, l = isoDatesLen; i < l; i++) {
- if (isoDates[i][1].exec(match[1])) {
- dateFormat = isoDates[i][0];
- allowTime = isoDates[i][2] !== false;
- break;
- }
- }
- if (dateFormat == null) {
- config._isValid = false;
- return;
- }
- if (match[3]) {
- for (i = 0, l = isoTimesLen; i < l; i++) {
- if (isoTimes[i][1].exec(match[3])) {
- // match[2] should be 'T' or space
- timeFormat = (match[2] || ' ') + isoTimes[i][0];
- break;
- }
- }
- if (timeFormat == null) {
- config._isValid = false;
- return;
- }
- }
- if (!allowTime && timeFormat != null) {
- config._isValid = false;
- return;
- }
- if (match[4]) {
- if (tzRegex.exec(match[4])) {
- tzFormat = 'Z';
- } else {
- config._isValid = false;
- return;
- }
- }
- config._f = dateFormat + (timeFormat || '') + (tzFormat || '');
- configFromStringAndFormat(config);
- } else {
- config._isValid = false;
- }
- }
- function extractFromRFC2822Strings(
- yearStr,
- monthStr,
- dayStr,
- hourStr,
- minuteStr,
- secondStr
- ) {
- var result = [
- untruncateYear(yearStr),
- defaultLocaleMonthsShort.indexOf(monthStr),
- parseInt(dayStr, 10),
- parseInt(hourStr, 10),
- parseInt(minuteStr, 10),
- ];
- if (secondStr) {
- result.push(parseInt(secondStr, 10));
- }
- return result;
- }
- function untruncateYear(yearStr) {
- var year = parseInt(yearStr, 10);
- if (year <= 49) {
- return 2000 + year;
- } else if (year <= 999) {
- return 1900 + year;
- }
- return year;
- }
- function preprocessRFC2822(s) {
- // Remove comments and folding whitespace and replace multiple-spaces with a single space
- return s
- .replace(/\([^()]*\)|[\n\t]/g, ' ')
- .replace(/(\s\s+)/g, ' ')
- .replace(/^\s\s*/, '')
- .replace(/\s\s*$/, '');
- }
- function checkWeekday(weekdayStr, parsedInput, config) {
- if (weekdayStr) {
- // TODO: Replace the vanilla JS Date object with an independent day-of-week check.
- var weekdayProvided = defaultLocaleWeekdaysShort.indexOf(weekdayStr),
- weekdayActual = new Date(
- parsedInput[0],
- parsedInput[1],
- parsedInput[2]
- ).getDay();
- if (weekdayProvided !== weekdayActual) {
- getParsingFlags(config).weekdayMismatch = true;
- config._isValid = false;
- return false;
- }
- }
- return true;
- }
- function calculateOffset(obsOffset, militaryOffset, numOffset) {
- if (obsOffset) {
- return obsOffsets[obsOffset];
- } else if (militaryOffset) {
- // the only allowed military tz is Z
- return 0;
- } else {
- var hm = parseInt(numOffset, 10),
- m = hm % 100,
- h = (hm - m) / 100;
- return h * 60 + m;
- }
- }
- // date and time from ref 2822 format
- function configFromRFC2822(config) {
- var match = rfc2822.exec(preprocessRFC2822(config._i)),
- parsedArray;
- if (match) {
- parsedArray = extractFromRFC2822Strings(
- match[4],
- match[3],
- match[2],
- match[5],
- match[6],
- match[7]
- );
- if (!checkWeekday(match[1], parsedArray, config)) {
- return;
- }
- config._a = parsedArray;
- config._tzm = calculateOffset(match[8], match[9], match[10]);
- config._d = createUTCDate.apply(null, config._a);
- config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
- getParsingFlags(config).rfc2822 = true;
- } else {
- config._isValid = false;
- }
- }
- // date from 1) ASP.NET, 2) ISO, 3) RFC 2822 formats, or 4) optional fallback if parsing isn't strict
- function configFromString(config) {
- var matched = aspNetJsonRegex.exec(config._i);
- if (matched !== null) {
- config._d = new Date(+matched[1]);
- return;
- }
- configFromISO(config);
- if (config._isValid === false) {
- delete config._isValid;
- } else {
- return;
- }
- configFromRFC2822(config);
- if (config._isValid === false) {
- delete config._isValid;
- } else {
- return;
- }
- if (config._strict) {
- config._isValid = false;
- } else {
- // Final attempt, use Input Fallback
- hooks.createFromInputFallback(config);
- }
- }
- hooks.createFromInputFallback = deprecate(
- 'value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), ' +
- 'which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are ' +
- 'discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.',
- function (config) {
- config._d = new Date(config._i + (config._useUTC ? ' UTC' : ''));
- }
- );
- // Pick the first defined of two or three arguments.
- function defaults(a, b, c) {
- if (a != null) {
- return a;
- }
- if (b != null) {
- return b;
- }
- return c;
- }
- function currentDateArray(config) {
- // hooks is actually the exported moment object
- var nowValue = new Date(hooks.now());
- if (config._useUTC) {
- return [
- nowValue.getUTCFullYear(),
- nowValue.getUTCMonth(),
- nowValue.getUTCDate(),
- ];
- }
- return [nowValue.getFullYear(), nowValue.getMonth(), nowValue.getDate()];
- }
- // convert an array to a date.
- // the array should mirror the parameters below
- // note: all values past the year are optional and will default to the lowest possible value.
- // [year, month, day , hour, minute, second, millisecond]
- function configFromArray(config) {
- var i,
- date,
- input = [],
- currentDate,
- expectedWeekday,
- yearToUse;
- if (config._d) {
- return;
- }
- currentDate = currentDateArray(config);
- //compute day of the year from weeks and weekdays
- if (config._w && config._a[DATE] == null && config._a[MONTH] == null) {
- dayOfYearFromWeekInfo(config);
- }
- //if the day of the year is set, figure out what it is
- if (config._dayOfYear != null) {
- yearToUse = defaults(config._a[YEAR], currentDate[YEAR]);
- if (
- config._dayOfYear > daysInYear(yearToUse) ||
- config._dayOfYear === 0
- ) {
- getParsingFlags(config)._overflowDayOfYear = true;
- }
- date = createUTCDate(yearToUse, 0, config._dayOfYear);
- config._a[MONTH] = date.getUTCMonth();
- config._a[DATE] = date.getUTCDate();
- }
- // Default to current date.
- // * if no year, month, day of month are given, default to today
- // * if day of month is given, default month and year
- // * if month is given, default only year
- // * if year is given, don't default anything
- for (i = 0; i < 3 && config._a[i] == null; ++i) {
- config._a[i] = input[i] = currentDate[i];
- }
- // Zero out whatever was not defaulted, including time
- for (; i < 7; i++) {
- config._a[i] = input[i] =
- config._a[i] == null ? (i === 2 ? 1 : 0) : config._a[i];
- }
- // Check for 24:00:00.000
- if (
- config._a[HOUR] === 24 &&
- config._a[MINUTE] === 0 &&
- config._a[SECOND] === 0 &&
- config._a[MILLISECOND] === 0
- ) {
- config._nextDay = true;
- config._a[HOUR] = 0;
- }
- config._d = (config._useUTC ? createUTCDate : createDate).apply(
- null,
- input
- );
- expectedWeekday = config._useUTC
- ? config._d.getUTCDay()
- : config._d.getDay();
- // Apply timezone offset from input. The actual utcOffset can be changed
- // with parseZone.
- if (config._tzm != null) {
- config._d.setUTCMinutes(config._d.getUTCMinutes() - config._tzm);
- }
- if (config._nextDay) {
- config._a[HOUR] = 24;
- }
- // check for mismatching day of week
- if (
- config._w &&
- typeof config._w.d !== 'undefined' &&
- config._w.d !== expectedWeekday
- ) {
- getParsingFlags(config).weekdayMismatch = true;
- }
- }
- function dayOfYearFromWeekInfo(config) {
- var w, weekYear, week, weekday, dow, doy, temp, weekdayOverflow, curWeek;
- w = config._w;
- if (w.GG != null || w.W != null || w.E != null) {
- dow = 1;
- doy = 4;
- // TODO: We need to take the current isoWeekYear, but that depends on
- // how we interpret now (local, utc, fixed offset). So create
- // a now version of current config (take local/utc/offset flags, and
- // create now).
- weekYear = defaults(
- w.GG,
- config._a[YEAR],
- weekOfYear(createLocal(), 1, 4).year
- );
- week = defaults(w.W, 1);
- weekday = defaults(w.E, 1);
- if (weekday < 1 || weekday > 7) {
- weekdayOverflow = true;
- }
- } else {
- dow = config._locale._week.dow;
- doy = config._locale._week.doy;
- curWeek = weekOfYear(createLocal(), dow, doy);
- weekYear = defaults(w.gg, config._a[YEAR], curWeek.year);
- // Default to current week.
- week = defaults(w.w, curWeek.week);
- if (w.d != null) {
- // weekday -- low day numbers are considered next week
- weekday = w.d;
- if (weekday < 0 || weekday > 6) {
- weekdayOverflow = true;
- }
- } else if (w.e != null) {
- // local weekday -- counting starts from beginning of week
- weekday = w.e + dow;
- if (w.e < 0 || w.e > 6) {
- weekdayOverflow = true;
- }
- } else {
- // default to beginning of week
- weekday = dow;
- }
- }
- if (week < 1 || week > weeksInYear(weekYear, dow, doy)) {
- getParsingFlags(config)._overflowWeeks = true;
- } else if (weekdayOverflow != null) {
- getParsingFlags(config)._overflowWeekday = true;
- } else {
- temp = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy);
- config._a[YEAR] = temp.year;
- config._dayOfYear = temp.dayOfYear;
- }
- }
- // constant that refers to the ISO standard
- hooks.ISO_8601 = function () {};
- // constant that refers to the RFC 2822 form
- hooks.RFC_2822 = function () {};
- // date from string and format string
- function configFromStringAndFormat(config) {
- // TODO: Move this to another part of the creation flow to prevent circular deps
- if (config._f === hooks.ISO_8601) {
- configFromISO(config);
- return;
- }
- if (config._f === hooks.RFC_2822) {
- configFromRFC2822(config);
- return;
- }
- config._a = [];
- getParsingFlags(config).empty = true;
- // This array is used to make a Date, either with `new Date` or `Date.UTC`
- var string = '' + config._i,
- i,
- parsedInput,
- tokens,
- token,
- skipped,
- stringLength = string.length,
- totalParsedInputLength = 0,
- era,
- tokenLen;
- tokens =
- expandFormat(config._f, config._locale).match(formattingTokens) || [];
- tokenLen = tokens.length;
- for (i = 0; i < tokenLen; i++) {
- token = tokens[i];
- parsedInput = (string.match(getParseRegexForToken(token, config)) ||
- [])[0];
- if (parsedInput) {
- skipped = string.substr(0, string.indexOf(parsedInput));
- if (skipped.length > 0) {
- getParsingFlags(config).unusedInput.push(skipped);
- }
- string = string.slice(
- string.indexOf(parsedInput) + parsedInput.length
- );
- totalParsedInputLength += parsedInput.length;
- }
- // don't parse if it's not a known token
- if (formatTokenFunctions[token]) {
- if (parsedInput) {
- getParsingFlags(config).empty = false;
- } else {
- getParsingFlags(config).unusedTokens.push(token);
- }
- addTimeToArrayFromToken(token, parsedInput, config);
- } else if (config._strict && !parsedInput) {
- getParsingFlags(config).unusedTokens.push(token);
- }
- }
- // add remaining unparsed input length to the string
- getParsingFlags(config).charsLeftOver =
- stringLength - totalParsedInputLength;
- if (string.length > 0) {
- getParsingFlags(config).unusedInput.push(string);
- }
- // clear _12h flag if hour is <= 12
- if (
- config._a[HOUR] <= 12 &&
- getParsingFlags(config).bigHour === true &&
- config._a[HOUR] > 0
- ) {
- getParsingFlags(config).bigHour = undefined;
- }
- getParsingFlags(config).parsedDateParts = config._a.slice(0);
- getParsingFlags(config).meridiem = config._meridiem;
- // handle meridiem
- config._a[HOUR] = meridiemFixWrap(
- config._locale,
- config._a[HOUR],
- config._meridiem
- );
- // handle era
- era = getParsingFlags(config).era;
- if (era !== null) {
- config._a[YEAR] = config._locale.erasConvertYear(era, config._a[YEAR]);
- }
- configFromArray(config);
- checkOverflow(config);
- }
- function meridiemFixWrap(locale, hour, meridiem) {
- var isPm;
- if (meridiem == null) {
- // nothing to do
- return hour;
- }
- if (locale.meridiemHour != null) {
- return locale.meridiemHour(hour, meridiem);
- } else if (locale.isPM != null) {
- // Fallback
- isPm = locale.isPM(meridiem);
- if (isPm && hour < 12) {
- hour += 12;
- }
- if (!isPm && hour === 12) {
- hour = 0;
- }
- return hour;
- } else {
- // this is not supposed to happen
- return hour;
- }
- }
- // date from string and array of format strings
- function configFromStringAndArray(config) {
- var tempConfig,
- bestMoment,
- scoreToBeat,
- i,
- currentScore,
- validFormatFound,
- bestFormatIsValid = false,
- configfLen = config._f.length;
- if (configfLen === 0) {
- getParsingFlags(config).invalidFormat = true;
- config._d = new Date(NaN);
- return;
- }
- for (i = 0; i < configfLen; i++) {
- currentScore = 0;
- validFormatFound = false;
- tempConfig = copyConfig({}, config);
- if (config._useUTC != null) {
- tempConfig._useUTC = config._useUTC;
- }
- tempConfig._f = config._f[i];
- configFromStringAndFormat(tempConfig);
- if (isValid(tempConfig)) {
- validFormatFound = true;
- }
- // if there is any input that was not parsed add a penalty for that format
- currentScore += getParsingFlags(tempConfig).charsLeftOver;
- //or tokens
- currentScore += getParsingFlags(tempConfig).unusedTokens.length * 10;
- getParsingFlags(tempConfig).score = currentScore;
- if (!bestFormatIsValid) {
- if (
- scoreToBeat == null ||
- currentScore < scoreToBeat ||
- validFormatFound
- ) {
- scoreToBeat = currentScore;
- bestMoment = tempConfig;
- if (validFormatFound) {
- bestFormatIsValid = true;
- }
- }
- } else {
- if (currentScore < scoreToBeat) {
- scoreToBeat = currentScore;
- bestMoment = tempConfig;
- }
- }
- }
- extend(config, bestMoment || tempConfig);
- }
- function configFromObject(config) {
- if (config._d) {
- return;
- }
- var i = normalizeObjectUnits(config._i),
- dayOrDate = i.day === undefined ? i.date : i.day;
- config._a = map(
- [i.year, i.month, dayOrDate, i.hour, i.minute, i.second, i.millisecond],
- function (obj) {
- return obj && parseInt(obj, 10);
- }
- );
- configFromArray(config);
- }
- function createFromConfig(config) {
- var res = new Moment(checkOverflow(prepareConfig(config)));
- if (res._nextDay) {
- // Adding is smart enough around DST
- res.add(1, 'd');
- res._nextDay = undefined;
- }
- return res;
- }
- function prepareConfig(config) {
- var input = config._i,
- format = config._f;
- config._locale = config._locale || getLocale(config._l);
- if (input === null || (format === undefined && input === '')) {
- return createInvalid({ nullInput: true });
- }
- if (typeof input === 'string') {
- config._i = input = config._locale.preparse(input);
- }
- if (isMoment(input)) {
- return new Moment(checkOverflow(input));
- } else if (isDate(input)) {
- config._d = input;
- } else if (isArray(format)) {
- configFromStringAndArray(config);
- } else if (format) {
- configFromStringAndFormat(config);
- } else {
- configFromInput(config);
- }
- if (!isValid(config)) {
- config._d = null;
- }
- return config;
- }
- function configFromInput(config) {
- var input = config._i;
- if (isUndefined(input)) {
- config._d = new Date(hooks.now());
- } else if (isDate(input)) {
- config._d = new Date(input.valueOf());
- } else if (typeof input === 'string') {
- configFromString(config);
- } else if (isArray(input)) {
- config._a = map(input.slice(0), function (obj) {
- return parseInt(obj, 10);
- });
- configFromArray(config);
- } else if (isObject(input)) {
- configFromObject(config);
- } else if (isNumber(input)) {
- // from milliseconds
- config._d = new Date(input);
- } else {
- hooks.createFromInputFallback(config);
- }
- }
- function createLocalOrUTC(input, format, locale, strict, isUTC) {
- var c = {};
- if (format === true || format === false) {
- strict = format;
- format = undefined;
- }
- if (locale === true || locale === false) {
- strict = locale;
- locale = undefined;
- }
- if (
- (isObject(input) && isObjectEmpty(input)) ||
- (isArray(input) && input.length === 0)
- ) {
- input = undefined;
- }
- // object construction must be done this way.
- // https://github.com/moment/moment/issues/1423
- c._isAMomentObject = true;
- c._useUTC = c._isUTC = isUTC;
- c._l = locale;
- c._i = input;
- c._f = format;
- c._strict = strict;
- return createFromConfig(c);
- }
- function createLocal(input, format, locale, strict) {
- return createLocalOrUTC(input, format, locale, strict, false);
- }
- var prototypeMin = deprecate(
- 'moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/',
- function () {
- var other = createLocal.apply(null, arguments);
- if (this.isValid() && other.isValid()) {
- return other < this ? this : other;
- } else {
- return createInvalid();
- }
- }
- ),
- prototypeMax = deprecate(
- 'moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/',
- function () {
- var other = createLocal.apply(null, arguments);
- if (this.isValid() && other.isValid()) {
- return other > this ? this : other;
- } else {
- return createInvalid();
- }
- }
- );
- // Pick a moment m from moments so that m[fn](other) is true for all
- // other. This relies on the function fn to be transitive.
- //
- // moments should either be an array of moment objects or an array, whose
- // first element is an array of moment objects.
- function pickBy(fn, moments) {
- var res, i;
- if (moments.length === 1 && isArray(moments[0])) {
- moments = moments[0];
- }
- if (!moments.length) {
- return createLocal();
- }
- res = moments[0];
- for (i = 1; i < moments.length; ++i) {
- if (!moments[i].isValid() || moments[i][fn](res)) {
- res = moments[i];
- }
- }
- return res;
- }
- // TODO: Use [].sort instead?
- function min() {
- var args = [].slice.call(arguments, 0);
- return pickBy('isBefore', args);
- }
- function max() {
- var args = [].slice.call(arguments, 0);
- return pickBy('isAfter', args);
- }
- var now = function () {
- return Date.now ? Date.now() : +new Date();
- };
- var ordering = [
- 'year',
- 'quarter',
- 'month',
- 'week',
- 'day',
- 'hour',
- 'minute',
- 'second',
- 'millisecond',
- ];
- function isDurationValid(m) {
- var key,
- unitHasDecimal = false,
- i,
- orderLen = ordering.length;
- for (key in m) {
- if (
- hasOwnProp(m, key) &&
- !(
- indexOf.call(ordering, key) !== -1 &&
- (m[key] == null || !isNaN(m[key]))
- )
- ) {
- return false;
- }
- }
- for (i = 0; i < orderLen; ++i) {
- if (m[ordering[i]]) {
- if (unitHasDecimal) {
- return false; // only allow non-integers for smallest unit
- }
- if (parseFloat(m[ordering[i]]) !== toInt(m[ordering[i]])) {
- unitHasDecimal = true;
- }
- }
- }
- return true;
- }
- function isValid$1() {
- return this._isValid;
- }
- function createInvalid$1() {
- return createDuration(NaN);
- }
- function Duration(duration) {
- var normalizedInput = normalizeObjectUnits(duration),
- years = normalizedInput.year || 0,
- quarters = normalizedInput.quarter || 0,
- months = normalizedInput.month || 0,
- weeks = normalizedInput.week || normalizedInput.isoWeek || 0,
- days = normalizedInput.day || 0,
- hours = normalizedInput.hour || 0,
- minutes = normalizedInput.minute || 0,
- seconds = normalizedInput.second || 0,
- milliseconds = normalizedInput.millisecond || 0;
- this._isValid = isDurationValid(normalizedInput);
- // representation for dateAddRemove
- this._milliseconds =
- +milliseconds +
- seconds * 1e3 + // 1000
- minutes * 6e4 + // 1000 * 60
- hours * 1000 * 60 * 60; //using 1000 * 60 * 60 instead of 36e5 to avoid floating point rounding errors https://github.com/moment/moment/issues/2978
- // Because of dateAddRemove treats 24 hours as different from a
- // day when working around DST, we need to store them separately
- this._days = +days + weeks * 7;
- // It is impossible to translate months into days without knowing
- // which months you are are talking about, so we have to store
- // it separately.
- this._months = +months + quarters * 3 + years * 12;
- this._data = {};
- this._locale = getLocale();
- this._bubble();
- }
- function isDuration(obj) {
- return obj instanceof Duration;
- }
- function absRound(number) {
- if (number < 0) {
- return Math.round(-1 * number) * -1;
- } else {
- return Math.round(number);
- }
- }
- // compare two arrays, return the number of differences
- function compareArrays(array1, array2, dontConvert) {
- var len = Math.min(array1.length, array2.length),
- lengthDiff = Math.abs(array1.length - array2.length),
- diffs = 0,
- i;
- for (i = 0; i < len; i++) {
- if (
- (dontConvert && array1[i] !== array2[i]) ||
- (!dontConvert && toInt(array1[i]) !== toInt(array2[i]))
- ) {
- diffs++;
- }
- }
- return diffs + lengthDiff;
- }
- // FORMATTING
- function offset(token, separator) {
- addFormatToken(token, 0, 0, function () {
- var offset = this.utcOffset(),
- sign = '+';
- if (offset < 0) {
- offset = -offset;
- sign = '-';
- }
- return (
- sign +
- zeroFill(~~(offset / 60), 2) +
- separator +
- zeroFill(~~offset % 60, 2)
- );
- });
- }
- offset('Z', ':');
- offset('ZZ', '');
- // PARSING
- addRegexToken('Z', matchShortOffset);
- addRegexToken('ZZ', matchShortOffset);
- addParseToken(['Z', 'ZZ'], function (input, array, config) {
- config._useUTC = true;
- config._tzm = offsetFromString(matchShortOffset, input);
- });
- // HELPERS
- // timezone chunker
- // '+10:00' > ['10', '00']
- // '-1530' > ['-15', '30']
- var chunkOffset = /([\+\-]|\d\d)/gi;
- function offsetFromString(matcher, string) {
- var matches = (string || '').match(matcher),
- chunk,
- parts,
- minutes;
- if (matches === null) {
- return null;
- }
- chunk = matches[matches.length - 1] || [];
- parts = (chunk + '').match(chunkOffset) || ['-', 0, 0];
- minutes = +(parts[1] * 60) + toInt(parts[2]);
- return minutes === 0 ? 0 : parts[0] === '+' ? minutes : -minutes;
- }
- // Return a moment from input, that is local/utc/zone equivalent to model.
- function cloneWithOffset(input, model) {
- var res, diff;
- if (model._isUTC) {
- res = model.clone();
- diff =
- (isMoment(input) || isDate(input)
- ? input.valueOf()
- : createLocal(input).valueOf()) - res.valueOf();
- // Use low-level api, because this fn is low-level api.
- res._d.setTime(res._d.valueOf() + diff);
- hooks.updateOffset(res, false);
- return res;
- } else {
- return createLocal(input).local();
- }
- }
- function getDateOffset(m) {
- // On Firefox.24 Date#getTimezoneOffset returns a floating point.
- // https://github.com/moment/moment/pull/1871
- return -Math.round(m._d.getTimezoneOffset());
- }
- // HOOKS
- // This function will be called whenever a moment is mutated.
- // It is intended to keep the offset in sync with the timezone.
- hooks.updateOffset = function () {};
- // MOMENTS
- // keepLocalTime = true means only change the timezone, without
- // affecting the local hour. So 5:31:26 +0300 --[utcOffset(2, true)]-->
- // 5:31:26 +0200 It is possible that 5:31:26 doesn't exist with offset
- // +0200, so we adjust the time as needed, to be valid.
- //
- // Keeping the time actually adds/subtracts (one hour)
- // from the actual represented time. That is why we call updateOffset
- // a second time. In case it wants us to change the offset again
- // _changeInProgress == true case, then we have to adjust, because
- // there is no such time in the given timezone.
- function getSetOffset(input, keepLocalTime, keepMinutes) {
- var offset = this._offset || 0,
- localAdjust;
- if (!this.isValid()) {
- return input != null ? this : NaN;
- }
- if (input != null) {
- if (typeof input === 'string') {
- input = offsetFromString(matchShortOffset, input);
- if (input === null) {
- return this;
- }
- } else if (Math.abs(input) < 16 && !keepMinutes) {
- input = input * 60;
- }
- if (!this._isUTC && keepLocalTime) {
- localAdjust = getDateOffset(this);
- }
- this._offset = input;
- this._isUTC = true;
- if (localAdjust != null) {
- this.add(localAdjust, 'm');
- }
- if (offset !== input) {
- if (!keepLocalTime || this._changeInProgress) {
- addSubtract(
- this,
- createDuration(input - offset, 'm'),
- 1,
- false
- );
- } else if (!this._changeInProgress) {
- this._changeInProgress = true;
- hooks.updateOffset(this, true);
- this._changeInProgress = null;
- }
- }
- return this;
- } else {
- return this._isUTC ? offset : getDateOffset(this);
- }
- }
- function getSetZone(input, keepLocalTime) {
- if (input != null) {
- if (typeof input !== 'string') {
- input = -input;
- }
- this.utcOffset(input, keepLocalTime);
- return this;
- } else {
- return -this.utcOffset();
- }
- }
- function setOffsetToUTC(keepLocalTime) {
- return this.utcOffset(0, keepLocalTime);
- }
- function setOffsetToLocal(keepLocalTime) {
- if (this._isUTC) {
- this.utcOffset(0, keepLocalTime);
- this._isUTC = false;
- if (keepLocalTime) {
- this.subtract(getDateOffset(this), 'm');
- }
- }
- return this;
- }
- function setOffsetToParsedOffset() {
- if (this._tzm != null) {
- this.utcOffset(this._tzm, false, true);
- } else if (typeof this._i === 'string') {
- var tZone = offsetFromString(matchOffset, this._i);
- if (tZone != null) {
- this.utcOffset(tZone);
- } else {
- this.utcOffset(0, true);
- }
- }
- return this;
- }
- function hasAlignedHourOffset(input) {
- if (!this.isValid()) {
- return false;
- }
- input = input ? createLocal(input).utcOffset() : 0;
- return (this.utcOffset() - input) % 60 === 0;
- }
- function isDaylightSavingTime() {
- return (
- this.utcOffset() > this.clone().month(0).utcOffset() ||
- this.utcOffset() > this.clone().month(5).utcOffset()
- );
- }
- function isDaylightSavingTimeShifted() {
- if (!isUndefined(this._isDSTShifted)) {
- return this._isDSTShifted;
- }
- var c = {},
- other;
- copyConfig(c, this);
- c = prepareConfig(c);
- if (c._a) {
- other = c._isUTC ? createUTC(c._a) : createLocal(c._a);
- this._isDSTShifted =
- this.isValid() && compareArrays(c._a, other.toArray()) > 0;
- } else {
- this._isDSTShifted = false;
- }
- return this._isDSTShifted;
- }
- function isLocal() {
- return this.isValid() ? !this._isUTC : false;
- }
- function isUtcOffset() {
- return this.isValid() ? this._isUTC : false;
- }
- function isUtc() {
- return this.isValid() ? this._isUTC && this._offset === 0 : false;
- }
- // ASP.NET json date format regex
- var aspNetRegex = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/,
- // from http://docs.closure-library.googlecode.com/git/closure_goog_date_date.js.source.html
- // somewhat more in line with 4.4.3.2 2004 spec, but allows decimal anywhere
- // and further modified to allow for strings containing both week and day
- isoRegex =
- /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/;
- function createDuration(input, key) {
- var duration = input,
- // matching against regexp is expensive, do it on demand
- match = null,
- sign,
- ret,
- diffRes;
- if (isDuration(input)) {
- duration = {
- ms: input._milliseconds,
- d: input._days,
- M: input._months,
- };
- } else if (isNumber(input) || !isNaN(+input)) {
- duration = {};
- if (key) {
- duration[key] = +input;
- } else {
- duration.milliseconds = +input;
- }
- } else if ((match = aspNetRegex.exec(input))) {
- sign = match[1] === '-' ? -1 : 1;
- duration = {
- y: 0,
- d: toInt(match[DATE]) * sign,
- h: toInt(match[HOUR]) * sign,
- m: toInt(match[MINUTE]) * sign,
- s: toInt(match[SECOND]) * sign,
- ms: toInt(absRound(match[MILLISECOND] * 1000)) * sign, // the millisecond decimal point is included in the match
- };
- } else if ((match = isoRegex.exec(input))) {
- sign = match[1] === '-' ? -1 : 1;
- duration = {
- y: parseIso(match[2], sign),
- M: parseIso(match[3], sign),
- w: parseIso(match[4], sign),
- d: parseIso(match[5], sign),
- h: parseIso(match[6], sign),
- m: parseIso(match[7], sign),
- s: parseIso(match[8], sign),
- };
- } else if (duration == null) {
- // checks for null or undefined
- duration = {};
- } else if (
- typeof duration === 'object' &&
- ('from' in duration || 'to' in duration)
- ) {
- diffRes = momentsDifference(
- createLocal(duration.from),
- createLocal(duration.to)
- );
- duration = {};
- duration.ms = diffRes.milliseconds;
- duration.M = diffRes.months;
- }
- ret = new Duration(duration);
- if (isDuration(input) && hasOwnProp(input, '_locale')) {
- ret._locale = input._locale;
- }
- if (isDuration(input) && hasOwnProp(input, '_isValid')) {
- ret._isValid = input._isValid;
- }
- return ret;
- }
- createDuration.fn = Duration.prototype;
- createDuration.invalid = createInvalid$1;
- function parseIso(inp, sign) {
- // We'd normally use ~~inp for this, but unfortunately it also
- // converts floats to ints.
- // inp may be undefined, so careful calling replace on it.
- var res = inp && parseFloat(inp.replace(',', '.'));
- // apply sign while we're at it
- return (isNaN(res) ? 0 : res) * sign;
- }
- function positiveMomentsDifference(base, other) {
- var res = {};
- res.months =
- other.month() - base.month() + (other.year() - base.year()) * 12;
- if (base.clone().add(res.months, 'M').isAfter(other)) {
- --res.months;
- }
- res.milliseconds = +other - +base.clone().add(res.months, 'M');
- return res;
- }
- function momentsDifference(base, other) {
- var res;
- if (!(base.isValid() && other.isValid())) {
- return { milliseconds: 0, months: 0 };
- }
- other = cloneWithOffset(other, base);
- if (base.isBefore(other)) {
- res = positiveMomentsDifference(base, other);
- } else {
- res = positiveMomentsDifference(other, base);
- res.milliseconds = -res.milliseconds;
- res.months = -res.months;
- }
- return res;
- }
- // TODO: remove 'name' arg after deprecation is removed
- function createAdder(direction, name) {
- return function (val, period) {
- var dur, tmp;
- //invert the arguments, but complain about it
- if (period !== null && !isNaN(+period)) {
- deprecateSimple(
- name,
- 'moment().' +
- name +
- '(period, number) is deprecated. Please use moment().' +
- name +
- '(number, period). ' +
- 'See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info.'
- );
- tmp = val;
- val = period;
- period = tmp;
- }
- dur = createDuration(val, period);
- addSubtract(this, dur, direction);
- return this;
- };
- }
- function addSubtract(mom, duration, isAdding, updateOffset) {
- var milliseconds = duration._milliseconds,
- days = absRound(duration._days),
- months = absRound(duration._months);
- if (!mom.isValid()) {
- // No op
- return;
- }
- updateOffset = updateOffset == null ? true : updateOffset;
- if (months) {
- setMonth(mom, get(mom, 'Month') + months * isAdding);
- }
- if (days) {
- set$1(mom, 'Date', get(mom, 'Date') + days * isAdding);
- }
- if (milliseconds) {
- mom._d.setTime(mom._d.valueOf() + milliseconds * isAdding);
- }
- if (updateOffset) {
- hooks.updateOffset(mom, days || months);
- }
- }
- var add = createAdder(1, 'add'),
- subtract = createAdder(-1, 'subtract');
- function isString(input) {
- return typeof input === 'string' || input instanceof String;
- }
- // type MomentInput = Moment | Date | string | number | (number | string)[] | MomentInputObject | void; // null | undefined
- function isMomentInput(input) {
- return (
- isMoment(input) ||
- isDate(input) ||
- isString(input) ||
- isNumber(input) ||
- isNumberOrStringArray(input) ||
- isMomentInputObject(input) ||
- input === null ||
- input === undefined
- );
- }
- function isMomentInputObject(input) {
- var objectTest = isObject(input) && !isObjectEmpty(input),
- propertyTest = false,
- properties = [
- 'years',
- 'year',
- 'y',
- 'months',
- 'month',
- 'M',
- 'days',
- 'day',
- 'd',
- 'dates',
- 'date',
- 'D',
- 'hours',
- 'hour',
- 'h',
- 'minutes',
- 'minute',
- 'm',
- 'seconds',
- 'second',
- 's',
- 'milliseconds',
- 'millisecond',
- 'ms',
- ],
- i,
- property,
- propertyLen = properties.length;
- for (i = 0; i < propertyLen; i += 1) {
- property = properties[i];
- propertyTest = propertyTest || hasOwnProp(input, property);
- }
- return objectTest && propertyTest;
- }
- function isNumberOrStringArray(input) {
- var arrayTest = isArray(input),
- dataTypeTest = false;
- if (arrayTest) {
- dataTypeTest =
- input.filter(function (item) {
- return !isNumber(item) && isString(input);
- }).length === 0;
- }
- return arrayTest && dataTypeTest;
- }
- function isCalendarSpec(input) {
- var objectTest = isObject(input) && !isObjectEmpty(input),
- propertyTest = false,
- properties = [
- 'sameDay',
- 'nextDay',
- 'lastDay',
- 'nextWeek',
- 'lastWeek',
- 'sameElse',
- ],
- i,
- property;
- for (i = 0; i < properties.length; i += 1) {
- property = properties[i];
- propertyTest = propertyTest || hasOwnProp(input, property);
- }
- return objectTest && propertyTest;
- }
- function getCalendarFormat(myMoment, now) {
- var diff = myMoment.diff(now, 'days', true);
- return diff < -6
- ? 'sameElse'
- : diff < -1
- ? 'lastWeek'
- : diff < 0
- ? 'lastDay'
- : diff < 1
- ? 'sameDay'
- : diff < 2
- ? 'nextDay'
- : diff < 7
- ? 'nextWeek'
- : 'sameElse';
- }
- function calendar$1(time, formats) {
- // Support for single parameter, formats only overload to the calendar function
- if (arguments.length === 1) {
- if (!arguments[0]) {
- time = undefined;
- formats = undefined;
- } else if (isMomentInput(arguments[0])) {
- time = arguments[0];
- formats = undefined;
- } else if (isCalendarSpec(arguments[0])) {
- formats = arguments[0];
- time = undefined;
- }
- }
- // We want to compare the start of today, vs this.
- // Getting start-of-today depends on whether we're local/utc/offset or not.
- var now = time || createLocal(),
- sod = cloneWithOffset(now, this).startOf('day'),
- format = hooks.calendarFormat(this, sod) || 'sameElse',
- output =
- formats &&
- (isFunction(formats[format])
- ? formats[format].call(this, now)
- : formats[format]);
- return this.format(
- output || this.localeData().calendar(format, this, createLocal(now))
- );
- }
- function clone() {
- return new Moment(this);
- }
- function isAfter(input, units) {
- var localInput = isMoment(input) ? input : createLocal(input);
- if (!(this.isValid() && localInput.isValid())) {
- return false;
- }
- units = normalizeUnits(units) || 'millisecond';
- if (units === 'millisecond') {
- return this.valueOf() > localInput.valueOf();
- } else {
- return localInput.valueOf() < this.clone().startOf(units).valueOf();
- }
- }
- function isBefore(input, units) {
- var localInput = isMoment(input) ? input : createLocal(input);
- if (!(this.isValid() && localInput.isValid())) {
- return false;
- }
- units = normalizeUnits(units) || 'millisecond';
- if (units === 'millisecond') {
- return this.valueOf() < localInput.valueOf();
- } else {
- return this.clone().endOf(units).valueOf() < localInput.valueOf();
- }
- }
- function isBetween(from, to, units, inclusivity) {
- var localFrom = isMoment(from) ? from : createLocal(from),
- localTo = isMoment(to) ? to : createLocal(to);
- if (!(this.isValid() && localFrom.isValid() && localTo.isValid())) {
- return false;
- }
- inclusivity = inclusivity || '()';
- return (
- (inclusivity[0] === '('
- ? this.isAfter(localFrom, units)
- : !this.isBefore(localFrom, units)) &&
- (inclusivity[1] === ')'
- ? this.isBefore(localTo, units)
- : !this.isAfter(localTo, units))
- );
- }
- function isSame(input, units) {
- var localInput = isMoment(input) ? input : createLocal(input),
- inputMs;
- if (!(this.isValid() && localInput.isValid())) {
- return false;
- }
- units = normalizeUnits(units) || 'millisecond';
- if (units === 'millisecond') {
- return this.valueOf() === localInput.valueOf();
- } else {
- inputMs = localInput.valueOf();
- return (
- this.clone().startOf(units).valueOf() <= inputMs &&
- inputMs <= this.clone().endOf(units).valueOf()
- );
- }
- }
- function isSameOrAfter(input, units) {
- return this.isSame(input, units) || this.isAfter(input, units);
- }
- function isSameOrBefore(input, units) {
- return this.isSame(input, units) || this.isBefore(input, units);
- }
- function diff(input, units, asFloat) {
- var that, zoneDelta, output;
- if (!this.isValid()) {
- return NaN;
- }
- that = cloneWithOffset(input, this);
- if (!that.isValid()) {
- return NaN;
- }
- zoneDelta = (that.utcOffset() - this.utcOffset()) * 6e4;
- units = normalizeUnits(units);
- switch (units) {
- case 'year':
- output = monthDiff(this, that) / 12;
- break;
- case 'month':
- output = monthDiff(this, that);
- break;
- case 'quarter':
- output = monthDiff(this, that) / 3;
- break;
- case 'second':
- output = (this - that) / 1e3;
- break; // 1000
- case 'minute':
- output = (this - that) / 6e4;
- break; // 1000 * 60
- case 'hour':
- output = (this - that) / 36e5;
- break; // 1000 * 60 * 60
- case 'day':
- output = (this - that - zoneDelta) / 864e5;
- break; // 1000 * 60 * 60 * 24, negate dst
- case 'week':
- output = (this - that - zoneDelta) / 6048e5;
- break; // 1000 * 60 * 60 * 24 * 7, negate dst
- default:
- output = this - that;
- }
- return asFloat ? output : absFloor(output);
- }
- function monthDiff(a, b) {
- if (a.date() < b.date()) {
- // end-of-month calculations work correct when the start month has more
- // days than the end month.
- return -monthDiff(b, a);
- }
- // difference in months
- var wholeMonthDiff = (b.year() - a.year()) * 12 + (b.month() - a.month()),
- // b is in (anchor - 1 month, anchor + 1 month)
- anchor = a.clone().add(wholeMonthDiff, 'months'),
- anchor2,
- adjust;
- if (b - anchor < 0) {
- anchor2 = a.clone().add(wholeMonthDiff - 1, 'months');
- // linear across the month
- adjust = (b - anchor) / (anchor - anchor2);
- } else {
- anchor2 = a.clone().add(wholeMonthDiff + 1, 'months');
- // linear across the month
- adjust = (b - anchor) / (anchor2 - anchor);
- }
- //check for negative zero, return zero if negative zero
- return -(wholeMonthDiff + adjust) || 0;
- }
- hooks.defaultFormat = 'YYYY-MM-DDTHH:mm:ssZ';
- hooks.defaultFormatUtc = 'YYYY-MM-DDTHH:mm:ss[Z]';
- function toString() {
- return this.clone().locale('en').format('ddd MMM DD YYYY HH:mm:ss [GMT]ZZ');
- }
- function toISOString(keepOffset) {
- if (!this.isValid()) {
- return null;
- }
- var utc = keepOffset !== true,
- m = utc ? this.clone().utc() : this;
- if (m.year() < 0 || m.year() > 9999) {
- return formatMoment(
- m,
- utc
- ? 'YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]'
- : 'YYYYYY-MM-DD[T]HH:mm:ss.SSSZ'
- );
- }
- if (isFunction(Date.prototype.toISOString)) {
- // native implementation is ~50x faster, use it when we can
- if (utc) {
- return this.toDate().toISOString();
- } else {
- return new Date(this.valueOf() + this.utcOffset() * 60 * 1000)
- .toISOString()
- .replace('Z', formatMoment(m, 'Z'));
- }
- }
- return formatMoment(
- m,
- utc ? 'YYYY-MM-DD[T]HH:mm:ss.SSS[Z]' : 'YYYY-MM-DD[T]HH:mm:ss.SSSZ'
- );
- }
- /**
- * Return a human readable representation of a moment that can
- * also be evaluated to get a new moment which is the same
- *
- * @link https://nodejs.org/dist/latest/docs/api/util.html#util_custom_inspect_function_on_objects
- */
- function inspect() {
- if (!this.isValid()) {
- return 'moment.invalid(/* ' + this._i + ' */)';
- }
- var func = 'moment',
- zone = '',
- prefix,
- year,
- datetime,
- suffix;
- if (!this.isLocal()) {
- func = this.utcOffset() === 0 ? 'moment.utc' : 'moment.parseZone';
- zone = 'Z';
- }
- prefix = '[' + func + '("]';
- year = 0 <= this.year() && this.year() <= 9999 ? 'YYYY' : 'YYYYYY';
- datetime = '-MM-DD[T]HH:mm:ss.SSS';
- suffix = zone + '[")]';
- return this.format(prefix + year + datetime + suffix);
- }
- function format(inputString) {
- if (!inputString) {
- inputString = this.isUtc()
- ? hooks.defaultFormatUtc
- : hooks.defaultFormat;
- }
- var output = formatMoment(this, inputString);
- return this.localeData().postformat(output);
- }
- function from(time, withoutSuffix) {
- if (
- this.isValid() &&
- ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
- ) {
- return createDuration({ to: this, from: time })
- .locale(this.locale())
- .humanize(!withoutSuffix);
- } else {
- return this.localeData().invalidDate();
- }
- }
- function fromNow(withoutSuffix) {
- return this.from(createLocal(), withoutSuffix);
- }
- function to(time, withoutSuffix) {
- if (
- this.isValid() &&
- ((isMoment(time) && time.isValid()) || createLocal(time).isValid())
- ) {
- return createDuration({ from: this, to: time })
- .locale(this.locale())
- .humanize(!withoutSuffix);
- } else {
- return this.localeData().invalidDate();
- }
- }
- function toNow(withoutSuffix) {
- return this.to(createLocal(), withoutSuffix);
- }
- // If passed a locale key, it will set the locale for this
- // instance. Otherwise, it will return the locale configuration
- // variables for this instance.
- function locale(key) {
- var newLocaleData;
- if (key === undefined) {
- return this._locale._abbr;
- } else {
- newLocaleData = getLocale(key);
- if (newLocaleData != null) {
- this._locale = newLocaleData;
- }
- return this;
- }
- }
- var lang = deprecate(
- 'moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.',
- function (key) {
- if (key === undefined) {
- return this.localeData();
- } else {
- return this.locale(key);
- }
- }
- );
- function localeData() {
- return this._locale;
- }
- var MS_PER_SECOND = 1000,
- MS_PER_MINUTE = 60 * MS_PER_SECOND,
- MS_PER_HOUR = 60 * MS_PER_MINUTE,
- MS_PER_400_YEARS = (365 * 400 + 97) * 24 * MS_PER_HOUR;
- // actual modulo - handles negative numbers (for dates before 1970):
- function mod$1(dividend, divisor) {
- return ((dividend % divisor) + divisor) % divisor;
- }
- function localStartOfDate(y, m, d) {
- // the date constructor remaps years 0-99 to 1900-1999
- if (y < 100 && y >= 0) {
- // preserve leap years using a full 400 year cycle, then reset
- return new Date(y + 400, m, d) - MS_PER_400_YEARS;
- } else {
- return new Date(y, m, d).valueOf();
- }
- }
- function utcStartOfDate(y, m, d) {
- // Date.UTC remaps years 0-99 to 1900-1999
- if (y < 100 && y >= 0) {
- // preserve leap years using a full 400 year cycle, then reset
- return Date.UTC(y + 400, m, d) - MS_PER_400_YEARS;
- } else {
- return Date.UTC(y, m, d);
- }
- }
- function startOf(units) {
- var time, startOfDate;
- units = normalizeUnits(units);
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
- return this;
- }
- startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
- switch (units) {
- case 'year':
- time = startOfDate(this.year(), 0, 1);
- break;
- case 'quarter':
- time = startOfDate(
- this.year(),
- this.month() - (this.month() % 3),
- 1
- );
- break;
- case 'month':
- time = startOfDate(this.year(), this.month(), 1);
- break;
- case 'week':
- time = startOfDate(
- this.year(),
- this.month(),
- this.date() - this.weekday()
- );
- break;
- case 'isoWeek':
- time = startOfDate(
- this.year(),
- this.month(),
- this.date() - (this.isoWeekday() - 1)
- );
- break;
- case 'day':
- case 'date':
- time = startOfDate(this.year(), this.month(), this.date());
- break;
- case 'hour':
- time = this._d.valueOf();
- time -= mod$1(
- time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
- MS_PER_HOUR
- );
- break;
- case 'minute':
- time = this._d.valueOf();
- time -= mod$1(time, MS_PER_MINUTE);
- break;
- case 'second':
- time = this._d.valueOf();
- time -= mod$1(time, MS_PER_SECOND);
- break;
- }
- this._d.setTime(time);
- hooks.updateOffset(this, true);
- return this;
- }
- function endOf(units) {
- var time, startOfDate;
- units = normalizeUnits(units);
- if (units === undefined || units === 'millisecond' || !this.isValid()) {
- return this;
- }
- startOfDate = this._isUTC ? utcStartOfDate : localStartOfDate;
- switch (units) {
- case 'year':
- time = startOfDate(this.year() + 1, 0, 1) - 1;
- break;
- case 'quarter':
- time =
- startOfDate(
- this.year(),
- this.month() - (this.month() % 3) + 3,
- 1
- ) - 1;
- break;
- case 'month':
- time = startOfDate(this.year(), this.month() + 1, 1) - 1;
- break;
- case 'week':
- time =
- startOfDate(
- this.year(),
- this.month(),
- this.date() - this.weekday() + 7
- ) - 1;
- break;
- case 'isoWeek':
- time =
- startOfDate(
- this.year(),
- this.month(),
- this.date() - (this.isoWeekday() - 1) + 7
- ) - 1;
- break;
- case 'day':
- case 'date':
- time = startOfDate(this.year(), this.month(), this.date() + 1) - 1;
- break;
- case 'hour':
- time = this._d.valueOf();
- time +=
- MS_PER_HOUR -
- mod$1(
- time + (this._isUTC ? 0 : this.utcOffset() * MS_PER_MINUTE),
- MS_PER_HOUR
- ) -
- 1;
- break;
- case 'minute':
- time = this._d.valueOf();
- time += MS_PER_MINUTE - mod$1(time, MS_PER_MINUTE) - 1;
- break;
- case 'second':
- time = this._d.valueOf();
- time += MS_PER_SECOND - mod$1(time, MS_PER_SECOND) - 1;
- break;
- }
- this._d.setTime(time);
- hooks.updateOffset(this, true);
- return this;
- }
- function valueOf() {
- return this._d.valueOf() - (this._offset || 0) * 60000;
- }
- function unix() {
- return Math.floor(this.valueOf() / 1000);
- }
- function toDate() {
- return new Date(this.valueOf());
- }
- function toArray() {
- var m = this;
- return [
- m.year(),
- m.month(),
- m.date(),
- m.hour(),
- m.minute(),
- m.second(),
- m.millisecond(),
- ];
- }
- function toObject() {
- var m = this;
- return {
- years: m.year(),
- months: m.month(),
- date: m.date(),
- hours: m.hours(),
- minutes: m.minutes(),
- seconds: m.seconds(),
- milliseconds: m.milliseconds(),
- };
- }
- function toJSON() {
- // new Date(NaN).toJSON() === null
- return this.isValid() ? this.toISOString() : null;
- }
- function isValid$2() {
- return isValid(this);
- }
- function parsingFlags() {
- return extend({}, getParsingFlags(this));
- }
- function invalidAt() {
- return getParsingFlags(this).overflow;
- }
- function creationData() {
- return {
- input: this._i,
- format: this._f,
- locale: this._locale,
- isUTC: this._isUTC,
- strict: this._strict,
- };
- }
- addFormatToken('N', 0, 0, 'eraAbbr');
- addFormatToken('NN', 0, 0, 'eraAbbr');
- addFormatToken('NNN', 0, 0, 'eraAbbr');
- addFormatToken('NNNN', 0, 0, 'eraName');
- addFormatToken('NNNNN', 0, 0, 'eraNarrow');
- addFormatToken('y', ['y', 1], 'yo', 'eraYear');
- addFormatToken('y', ['yy', 2], 0, 'eraYear');
- addFormatToken('y', ['yyy', 3], 0, 'eraYear');
- addFormatToken('y', ['yyyy', 4], 0, 'eraYear');
- addRegexToken('N', matchEraAbbr);
- addRegexToken('NN', matchEraAbbr);
- addRegexToken('NNN', matchEraAbbr);
- addRegexToken('NNNN', matchEraName);
- addRegexToken('NNNNN', matchEraNarrow);
- addParseToken(
- ['N', 'NN', 'NNN', 'NNNN', 'NNNNN'],
- function (input, array, config, token) {
- var era = config._locale.erasParse(input, token, config._strict);
- if (era) {
- getParsingFlags(config).era = era;
- } else {
- getParsingFlags(config).invalidEra = input;
- }
- }
- );
- addRegexToken('y', matchUnsigned);
- addRegexToken('yy', matchUnsigned);
- addRegexToken('yyy', matchUnsigned);
- addRegexToken('yyyy', matchUnsigned);
- addRegexToken('yo', matchEraYearOrdinal);
- addParseToken(['y', 'yy', 'yyy', 'yyyy'], YEAR);
- addParseToken(['yo'], function (input, array, config, token) {
- var match;
- if (config._locale._eraYearOrdinalRegex) {
- match = input.match(config._locale._eraYearOrdinalRegex);
- }
- if (config._locale.eraYearOrdinalParse) {
- array[YEAR] = config._locale.eraYearOrdinalParse(input, match);
- } else {
- array[YEAR] = parseInt(input, 10);
- }
- });
- function localeEras(m, format) {
- var i,
- l,
- date,
- eras = this._eras || getLocale('en')._eras;
- for (i = 0, l = eras.length; i < l; ++i) {
- switch (typeof eras[i].since) {
- case 'string':
- // truncate time
- date = hooks(eras[i].since).startOf('day');
- eras[i].since = date.valueOf();
- break;
- }
- switch (typeof eras[i].until) {
- case 'undefined':
- eras[i].until = +Infinity;
- break;
- case 'string':
- // truncate time
- date = hooks(eras[i].until).startOf('day').valueOf();
- eras[i].until = date.valueOf();
- break;
- }
- }
- return eras;
- }
- function localeErasParse(eraName, format, strict) {
- var i,
- l,
- eras = this.eras(),
- name,
- abbr,
- narrow;
- eraName = eraName.toUpperCase();
- for (i = 0, l = eras.length; i < l; ++i) {
- name = eras[i].name.toUpperCase();
- abbr = eras[i].abbr.toUpperCase();
- narrow = eras[i].narrow.toUpperCase();
- if (strict) {
- switch (format) {
- case 'N':
- case 'NN':
- case 'NNN':
- if (abbr === eraName) {
- return eras[i];
- }
- break;
- case 'NNNN':
- if (name === eraName) {
- return eras[i];
- }
- break;
- case 'NNNNN':
- if (narrow === eraName) {
- return eras[i];
- }
- break;
- }
- } else if ([name, abbr, narrow].indexOf(eraName) >= 0) {
- return eras[i];
- }
- }
- }
- function localeErasConvertYear(era, year) {
- var dir = era.since <= era.until ? +1 : -1;
- if (year === undefined) {
- return hooks(era.since).year();
- } else {
- return hooks(era.since).year() + (year - era.offset) * dir;
- }
- }
- function getEraName() {
- var i,
- l,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
- // truncate time
- val = this.clone().startOf('day').valueOf();
- if (eras[i].since <= val && val <= eras[i].until) {
- return eras[i].name;
- }
- if (eras[i].until <= val && val <= eras[i].since) {
- return eras[i].name;
- }
- }
- return '';
- }
- function getEraNarrow() {
- var i,
- l,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
- // truncate time
- val = this.clone().startOf('day').valueOf();
- if (eras[i].since <= val && val <= eras[i].until) {
- return eras[i].narrow;
- }
- if (eras[i].until <= val && val <= eras[i].since) {
- return eras[i].narrow;
- }
- }
- return '';
- }
- function getEraAbbr() {
- var i,
- l,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
- // truncate time
- val = this.clone().startOf('day').valueOf();
- if (eras[i].since <= val && val <= eras[i].until) {
- return eras[i].abbr;
- }
- if (eras[i].until <= val && val <= eras[i].since) {
- return eras[i].abbr;
- }
- }
- return '';
- }
- function getEraYear() {
- var i,
- l,
- dir,
- val,
- eras = this.localeData().eras();
- for (i = 0, l = eras.length; i < l; ++i) {
- dir = eras[i].since <= eras[i].until ? +1 : -1;
- // truncate time
- val = this.clone().startOf('day').valueOf();
- if (
- (eras[i].since <= val && val <= eras[i].until) ||
- (eras[i].until <= val && val <= eras[i].since)
- ) {
- return (
- (this.year() - hooks(eras[i].since).year()) * dir +
- eras[i].offset
- );
- }
- }
- return this.year();
- }
- function erasNameRegex(isStrict) {
- if (!hasOwnProp(this, '_erasNameRegex')) {
- computeErasParse.call(this);
- }
- return isStrict ? this._erasNameRegex : this._erasRegex;
- }
- function erasAbbrRegex(isStrict) {
- if (!hasOwnProp(this, '_erasAbbrRegex')) {
- computeErasParse.call(this);
- }
- return isStrict ? this._erasAbbrRegex : this._erasRegex;
- }
- function erasNarrowRegex(isStrict) {
- if (!hasOwnProp(this, '_erasNarrowRegex')) {
- computeErasParse.call(this);
- }
- return isStrict ? this._erasNarrowRegex : this._erasRegex;
- }
- function matchEraAbbr(isStrict, locale) {
- return locale.erasAbbrRegex(isStrict);
- }
- function matchEraName(isStrict, locale) {
- return locale.erasNameRegex(isStrict);
- }
- function matchEraNarrow(isStrict, locale) {
- return locale.erasNarrowRegex(isStrict);
- }
- function matchEraYearOrdinal(isStrict, locale) {
- return locale._eraYearOrdinalRegex || matchUnsigned;
- }
- function computeErasParse() {
- var abbrPieces = [],
- namePieces = [],
- narrowPieces = [],
- mixedPieces = [],
- i,
- l,
- eras = this.eras();
- for (i = 0, l = eras.length; i < l; ++i) {
- namePieces.push(regexEscape(eras[i].name));
- abbrPieces.push(regexEscape(eras[i].abbr));
- narrowPieces.push(regexEscape(eras[i].narrow));
- mixedPieces.push(regexEscape(eras[i].name));
- mixedPieces.push(regexEscape(eras[i].abbr));
- mixedPieces.push(regexEscape(eras[i].narrow));
- }
- this._erasRegex = new RegExp('^(' + mixedPieces.join('|') + ')', 'i');
- this._erasNameRegex = new RegExp('^(' + namePieces.join('|') + ')', 'i');
- this._erasAbbrRegex = new RegExp('^(' + abbrPieces.join('|') + ')', 'i');
- this._erasNarrowRegex = new RegExp(
- '^(' + narrowPieces.join('|') + ')',
- 'i'
- );
- }
- // FORMATTING
- addFormatToken(0, ['gg', 2], 0, function () {
- return this.weekYear() % 100;
- });
- addFormatToken(0, ['GG', 2], 0, function () {
- return this.isoWeekYear() % 100;
- });
- function addWeekYearFormatToken(token, getter) {
- addFormatToken(0, [token, token.length], 0, getter);
- }
- addWeekYearFormatToken('gggg', 'weekYear');
- addWeekYearFormatToken('ggggg', 'weekYear');
- addWeekYearFormatToken('GGGG', 'isoWeekYear');
- addWeekYearFormatToken('GGGGG', 'isoWeekYear');
- // ALIASES
- addUnitAlias('weekYear', 'gg');
- addUnitAlias('isoWeekYear', 'GG');
- // PRIORITY
- addUnitPriority('weekYear', 1);
- addUnitPriority('isoWeekYear', 1);
- // PARSING
- addRegexToken('G', matchSigned);
- addRegexToken('g', matchSigned);
- addRegexToken('GG', match1to2, match2);
- addRegexToken('gg', match1to2, match2);
- addRegexToken('GGGG', match1to4, match4);
- addRegexToken('gggg', match1to4, match4);
- addRegexToken('GGGGG', match1to6, match6);
- addRegexToken('ggggg', match1to6, match6);
- addWeekParseToken(
- ['gggg', 'ggggg', 'GGGG', 'GGGGG'],
- function (input, week, config, token) {
- week[token.substr(0, 2)] = toInt(input);
- }
- );
- addWeekParseToken(['gg', 'GG'], function (input, week, config, token) {
- week[token] = hooks.parseTwoDigitYear(input);
- });
- // MOMENTS
- function getSetWeekYear(input) {
- return getSetWeekYearHelper.call(
- this,
- input,
- this.week(),
- this.weekday(),
- this.localeData()._week.dow,
- this.localeData()._week.doy
- );
- }
- function getSetISOWeekYear(input) {
- return getSetWeekYearHelper.call(
- this,
- input,
- this.isoWeek(),
- this.isoWeekday(),
- 1,
- 4
- );
- }
- function getISOWeeksInYear() {
- return weeksInYear(this.year(), 1, 4);
- }
- function getISOWeeksInISOWeekYear() {
- return weeksInYear(this.isoWeekYear(), 1, 4);
- }
- function getWeeksInYear() {
- var weekInfo = this.localeData()._week;
- return weeksInYear(this.year(), weekInfo.dow, weekInfo.doy);
- }
- function getWeeksInWeekYear() {
- var weekInfo = this.localeData()._week;
- return weeksInYear(this.weekYear(), weekInfo.dow, weekInfo.doy);
- }
- function getSetWeekYearHelper(input, week, weekday, dow, doy) {
- var weeksTarget;
- if (input == null) {
- return weekOfYear(this, dow, doy).year;
- } else {
- weeksTarget = weeksInYear(input, dow, doy);
- if (week > weeksTarget) {
- week = weeksTarget;
- }
- return setWeekAll.call(this, input, week, weekday, dow, doy);
- }
- }
- function setWeekAll(weekYear, week, weekday, dow, doy) {
- var dayOfYearData = dayOfYearFromWeeks(weekYear, week, weekday, dow, doy),
- date = createUTCDate(dayOfYearData.year, 0, dayOfYearData.dayOfYear);
- this.year(date.getUTCFullYear());
- this.month(date.getUTCMonth());
- this.date(date.getUTCDate());
- return this;
- }
- // FORMATTING
- addFormatToken('Q', 0, 'Qo', 'quarter');
- // ALIASES
- addUnitAlias('quarter', 'Q');
- // PRIORITY
- addUnitPriority('quarter', 7);
- // PARSING
- addRegexToken('Q', match1);
- addParseToken('Q', function (input, array) {
- array[MONTH] = (toInt(input) - 1) * 3;
- });
- // MOMENTS
- function getSetQuarter(input) {
- return input == null
- ? Math.ceil((this.month() + 1) / 3)
- : this.month((input - 1) * 3 + (this.month() % 3));
- }
- // FORMATTING
- addFormatToken('D', ['DD', 2], 'Do', 'date');
- // ALIASES
- addUnitAlias('date', 'D');
- // PRIORITY
- addUnitPriority('date', 9);
- // PARSING
- addRegexToken('D', match1to2);
- addRegexToken('DD', match1to2, match2);
- addRegexToken('Do', function (isStrict, locale) {
- // TODO: Remove "ordinalParse" fallback in next major release.
- return isStrict
- ? locale._dayOfMonthOrdinalParse || locale._ordinalParse
- : locale._dayOfMonthOrdinalParseLenient;
- });
- addParseToken(['D', 'DD'], DATE);
- addParseToken('Do', function (input, array) {
- array[DATE] = toInt(input.match(match1to2)[0]);
- });
- // MOMENTS
- var getSetDayOfMonth = makeGetSet('Date', true);
- // FORMATTING
- addFormatToken('DDD', ['DDDD', 3], 'DDDo', 'dayOfYear');
- // ALIASES
- addUnitAlias('dayOfYear', 'DDD');
- // PRIORITY
- addUnitPriority('dayOfYear', 4);
- // PARSING
- addRegexToken('DDD', match1to3);
- addRegexToken('DDDD', match3);
- addParseToken(['DDD', 'DDDD'], function (input, array, config) {
- config._dayOfYear = toInt(input);
- });
- // HELPERS
- // MOMENTS
- function getSetDayOfYear(input) {
- var dayOfYear =
- Math.round(
- (this.clone().startOf('day') - this.clone().startOf('year')) / 864e5
- ) + 1;
- return input == null ? dayOfYear : this.add(input - dayOfYear, 'd');
- }
- // FORMATTING
- addFormatToken('m', ['mm', 2], 0, 'minute');
- // ALIASES
- addUnitAlias('minute', 'm');
- // PRIORITY
- addUnitPriority('minute', 14);
- // PARSING
- addRegexToken('m', match1to2);
- addRegexToken('mm', match1to2, match2);
- addParseToken(['m', 'mm'], MINUTE);
- // MOMENTS
- var getSetMinute = makeGetSet('Minutes', false);
- // FORMATTING
- addFormatToken('s', ['ss', 2], 0, 'second');
- // ALIASES
- addUnitAlias('second', 's');
- // PRIORITY
- addUnitPriority('second', 15);
- // PARSING
- addRegexToken('s', match1to2);
- addRegexToken('ss', match1to2, match2);
- addParseToken(['s', 'ss'], SECOND);
- // MOMENTS
- var getSetSecond = makeGetSet('Seconds', false);
- // FORMATTING
- addFormatToken('S', 0, 0, function () {
- return ~~(this.millisecond() / 100);
- });
- addFormatToken(0, ['SS', 2], 0, function () {
- return ~~(this.millisecond() / 10);
- });
- addFormatToken(0, ['SSS', 3], 0, 'millisecond');
- addFormatToken(0, ['SSSS', 4], 0, function () {
- return this.millisecond() * 10;
- });
- addFormatToken(0, ['SSSSS', 5], 0, function () {
- return this.millisecond() * 100;
- });
- addFormatToken(0, ['SSSSSS', 6], 0, function () {
- return this.millisecond() * 1000;
- });
- addFormatToken(0, ['SSSSSSS', 7], 0, function () {
- return this.millisecond() * 10000;
- });
- addFormatToken(0, ['SSSSSSSS', 8], 0, function () {
- return this.millisecond() * 100000;
- });
- addFormatToken(0, ['SSSSSSSSS', 9], 0, function () {
- return this.millisecond() * 1000000;
- });
- // ALIASES
- addUnitAlias('millisecond', 'ms');
- // PRIORITY
- addUnitPriority('millisecond', 16);
- // PARSING
- addRegexToken('S', match1to3, match1);
- addRegexToken('SS', match1to3, match2);
- addRegexToken('SSS', match1to3, match3);
- var token, getSetMillisecond;
- for (token = 'SSSS'; token.length <= 9; token += 'S') {
- addRegexToken(token, matchUnsigned);
- }
- function parseMs(input, array) {
- array[MILLISECOND] = toInt(('0.' + input) * 1000);
- }
- for (token = 'S'; token.length <= 9; token += 'S') {
- addParseToken(token, parseMs);
- }
- getSetMillisecond = makeGetSet('Milliseconds', false);
- // FORMATTING
- addFormatToken('z', 0, 0, 'zoneAbbr');
- addFormatToken('zz', 0, 0, 'zoneName');
- // MOMENTS
- function getZoneAbbr() {
- return this._isUTC ? 'UTC' : '';
- }
- function getZoneName() {
- return this._isUTC ? 'Coordinated Universal Time' : '';
- }
- var proto = Moment.prototype;
- proto.add = add;
- proto.calendar = calendar$1;
- proto.clone = clone;
- proto.diff = diff;
- proto.endOf = endOf;
- proto.format = format;
- proto.from = from;
- proto.fromNow = fromNow;
- proto.to = to;
- proto.toNow = toNow;
- proto.get = stringGet;
- proto.invalidAt = invalidAt;
- proto.isAfter = isAfter;
- proto.isBefore = isBefore;
- proto.isBetween = isBetween;
- proto.isSame = isSame;
- proto.isSameOrAfter = isSameOrAfter;
- proto.isSameOrBefore = isSameOrBefore;
- proto.isValid = isValid$2;
- proto.lang = lang;
- proto.locale = locale;
- proto.localeData = localeData;
- proto.max = prototypeMax;
- proto.min = prototypeMin;
- proto.parsingFlags = parsingFlags;
- proto.set = stringSet;
- proto.startOf = startOf;
- proto.subtract = subtract;
- proto.toArray = toArray;
- proto.toObject = toObject;
- proto.toDate = toDate;
- proto.toISOString = toISOString;
- proto.inspect = inspect;
- if (typeof Symbol !== 'undefined' && Symbol.for != null) {
- proto[Symbol.for('nodejs.util.inspect.custom')] = function () {
- return 'Moment<' + this.format() + '>';
- };
- }
- proto.toJSON = toJSON;
- proto.toString = toString;
- proto.unix = unix;
- proto.valueOf = valueOf;
- proto.creationData = creationData;
- proto.eraName = getEraName;
- proto.eraNarrow = getEraNarrow;
- proto.eraAbbr = getEraAbbr;
- proto.eraYear = getEraYear;
- proto.year = getSetYear;
- proto.isLeapYear = getIsLeapYear;
- proto.weekYear = getSetWeekYear;
- proto.isoWeekYear = getSetISOWeekYear;
- proto.quarter = proto.quarters = getSetQuarter;
- proto.month = getSetMonth;
- proto.daysInMonth = getDaysInMonth;
- proto.week = proto.weeks = getSetWeek;
- proto.isoWeek = proto.isoWeeks = getSetISOWeek;
- proto.weeksInYear = getWeeksInYear;
- proto.weeksInWeekYear = getWeeksInWeekYear;
- proto.isoWeeksInYear = getISOWeeksInYear;
- proto.isoWeeksInISOWeekYear = getISOWeeksInISOWeekYear;
- proto.date = getSetDayOfMonth;
- proto.day = proto.days = getSetDayOfWeek;
- proto.weekday = getSetLocaleDayOfWeek;
- proto.isoWeekday = getSetISODayOfWeek;
- proto.dayOfYear = getSetDayOfYear;
- proto.hour = proto.hours = getSetHour;
- proto.minute = proto.minutes = getSetMinute;
- proto.second = proto.seconds = getSetSecond;
- proto.millisecond = proto.milliseconds = getSetMillisecond;
- proto.utcOffset = getSetOffset;
- proto.utc = setOffsetToUTC;
- proto.local = setOffsetToLocal;
- proto.parseZone = setOffsetToParsedOffset;
- proto.hasAlignedHourOffset = hasAlignedHourOffset;
- proto.isDST = isDaylightSavingTime;
- proto.isLocal = isLocal;
- proto.isUtcOffset = isUtcOffset;
- proto.isUtc = isUtc;
- proto.isUTC = isUtc;
- proto.zoneAbbr = getZoneAbbr;
- proto.zoneName = getZoneName;
- proto.dates = deprecate(
- 'dates accessor is deprecated. Use date instead.',
- getSetDayOfMonth
- );
- proto.months = deprecate(
- 'months accessor is deprecated. Use month instead',
- getSetMonth
- );
- proto.years = deprecate(
- 'years accessor is deprecated. Use year instead',
- getSetYear
- );
- proto.zone = deprecate(
- 'moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/',
- getSetZone
- );
- proto.isDSTShifted = deprecate(
- 'isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information',
- isDaylightSavingTimeShifted
- );
- function createUnix(input) {
- return createLocal(input * 1000);
- }
- function createInZone() {
- return createLocal.apply(null, arguments).parseZone();
- }
- function preParsePostFormat(string) {
- return string;
- }
- var proto$1 = Locale.prototype;
- proto$1.calendar = calendar;
- proto$1.longDateFormat = longDateFormat;
- proto$1.invalidDate = invalidDate;
- proto$1.ordinal = ordinal;
- proto$1.preparse = preParsePostFormat;
- proto$1.postformat = preParsePostFormat;
- proto$1.relativeTime = relativeTime;
- proto$1.pastFuture = pastFuture;
- proto$1.set = set;
- proto$1.eras = localeEras;
- proto$1.erasParse = localeErasParse;
- proto$1.erasConvertYear = localeErasConvertYear;
- proto$1.erasAbbrRegex = erasAbbrRegex;
- proto$1.erasNameRegex = erasNameRegex;
- proto$1.erasNarrowRegex = erasNarrowRegex;
- proto$1.months = localeMonths;
- proto$1.monthsShort = localeMonthsShort;
- proto$1.monthsParse = localeMonthsParse;
- proto$1.monthsRegex = monthsRegex;
- proto$1.monthsShortRegex = monthsShortRegex;
- proto$1.week = localeWeek;
- proto$1.firstDayOfYear = localeFirstDayOfYear;
- proto$1.firstDayOfWeek = localeFirstDayOfWeek;
- proto$1.weekdays = localeWeekdays;
- proto$1.weekdaysMin = localeWeekdaysMin;
- proto$1.weekdaysShort = localeWeekdaysShort;
- proto$1.weekdaysParse = localeWeekdaysParse;
- proto$1.weekdaysRegex = weekdaysRegex;
- proto$1.weekdaysShortRegex = weekdaysShortRegex;
- proto$1.weekdaysMinRegex = weekdaysMinRegex;
- proto$1.isPM = localeIsPM;
- proto$1.meridiem = localeMeridiem;
- function get$1(format, index, field, setter) {
- var locale = getLocale(),
- utc = createUTC().set(setter, index);
- return locale[field](utc, format);
- }
- function listMonthsImpl(format, index, field) {
- if (isNumber(format)) {
- index = format;
- format = undefined;
- }
- format = format || '';
- if (index != null) {
- return get$1(format, index, field, 'month');
- }
- var i,
- out = [];
- for (i = 0; i < 12; i++) {
- out[i] = get$1(format, i, field, 'month');
- }
- return out;
- }
- // ()
- // (5)
- // (fmt, 5)
- // (fmt)
- // (true)
- // (true, 5)
- // (true, fmt, 5)
- // (true, fmt)
- function listWeekdaysImpl(localeSorted, format, index, field) {
- if (typeof localeSorted === 'boolean') {
- if (isNumber(format)) {
- index = format;
- format = undefined;
- }
- format = format || '';
- } else {
- format = localeSorted;
- index = format;
- localeSorted = false;
- if (isNumber(format)) {
- index = format;
- format = undefined;
- }
- format = format || '';
- }
- var locale = getLocale(),
- shift = localeSorted ? locale._week.dow : 0,
- i,
- out = [];
- if (index != null) {
- return get$1(format, (index + shift) % 7, field, 'day');
- }
- for (i = 0; i < 7; i++) {
- out[i] = get$1(format, (i + shift) % 7, field, 'day');
- }
- return out;
- }
- function listMonths(format, index) {
- return listMonthsImpl(format, index, 'months');
- }
- function listMonthsShort(format, index) {
- return listMonthsImpl(format, index, 'monthsShort');
- }
- function listWeekdays(localeSorted, format, index) {
- return listWeekdaysImpl(localeSorted, format, index, 'weekdays');
- }
- function listWeekdaysShort(localeSorted, format, index) {
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysShort');
- }
- function listWeekdaysMin(localeSorted, format, index) {
- return listWeekdaysImpl(localeSorted, format, index, 'weekdaysMin');
- }
- getSetGlobalLocale('en', {
- eras: [
- {
- since: '0001-01-01',
- until: +Infinity,
- offset: 1,
- name: 'Anno Domini',
- narrow: 'AD',
- abbr: 'AD',
- },
- {
- since: '0000-12-31',
- until: -Infinity,
- offset: 1,
- name: 'Before Christ',
- narrow: 'BC',
- abbr: 'BC',
- },
- ],
- dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- toInt((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- });
- // Side effect imports
- hooks.lang = deprecate(
- 'moment.lang is deprecated. Use moment.locale instead.',
- getSetGlobalLocale
- );
- hooks.langData = deprecate(
- 'moment.langData is deprecated. Use moment.localeData instead.',
- getLocale
- );
- var mathAbs = Math.abs;
- function abs() {
- var data = this._data;
- this._milliseconds = mathAbs(this._milliseconds);
- this._days = mathAbs(this._days);
- this._months = mathAbs(this._months);
- data.milliseconds = mathAbs(data.milliseconds);
- data.seconds = mathAbs(data.seconds);
- data.minutes = mathAbs(data.minutes);
- data.hours = mathAbs(data.hours);
- data.months = mathAbs(data.months);
- data.years = mathAbs(data.years);
- return this;
- }
- function addSubtract$1(duration, input, value, direction) {
- var other = createDuration(input, value);
- duration._milliseconds += direction * other._milliseconds;
- duration._days += direction * other._days;
- duration._months += direction * other._months;
- return duration._bubble();
- }
- // supports only 2.0-style add(1, 's') or add(duration)
- function add$1(input, value) {
- return addSubtract$1(this, input, value, 1);
- }
- // supports only 2.0-style subtract(1, 's') or subtract(duration)
- function subtract$1(input, value) {
- return addSubtract$1(this, input, value, -1);
- }
- function absCeil(number) {
- if (number < 0) {
- return Math.floor(number);
- } else {
- return Math.ceil(number);
- }
- }
- function bubble() {
- var milliseconds = this._milliseconds,
- days = this._days,
- months = this._months,
- data = this._data,
- seconds,
- minutes,
- hours,
- years,
- monthsFromDays;
- // if we have a mix of positive and negative values, bubble down first
- // check: https://github.com/moment/moment/issues/2166
- if (
- !(
- (milliseconds >= 0 && days >= 0 && months >= 0) ||
- (milliseconds <= 0 && days <= 0 && months <= 0)
- )
- ) {
- milliseconds += absCeil(monthsToDays(months) + days) * 864e5;
- days = 0;
- months = 0;
- }
- // The following code bubbles up values, see the tests for
- // examples of what that means.
- data.milliseconds = milliseconds % 1000;
- seconds = absFloor(milliseconds / 1000);
- data.seconds = seconds % 60;
- minutes = absFloor(seconds / 60);
- data.minutes = minutes % 60;
- hours = absFloor(minutes / 60);
- data.hours = hours % 24;
- days += absFloor(hours / 24);
- // convert days to months
- monthsFromDays = absFloor(daysToMonths(days));
- months += monthsFromDays;
- days -= absCeil(monthsToDays(monthsFromDays));
- // 12 months -> 1 year
- years = absFloor(months / 12);
- months %= 12;
- data.days = days;
- data.months = months;
- data.years = years;
- return this;
- }
- function daysToMonths(days) {
- // 400 years have 146097 days (taking into account leap year rules)
- // 400 years have 12 months === 4800
- return (days * 4800) / 146097;
- }
- function monthsToDays(months) {
- // the reverse of daysToMonths
- return (months * 146097) / 4800;
- }
- function as(units) {
- if (!this.isValid()) {
- return NaN;
- }
- var days,
- months,
- milliseconds = this._milliseconds;
- units = normalizeUnits(units);
- if (units === 'month' || units === 'quarter' || units === 'year') {
- days = this._days + milliseconds / 864e5;
- months = this._months + daysToMonths(days);
- switch (units) {
- case 'month':
- return months;
- case 'quarter':
- return months / 3;
- case 'year':
- return months / 12;
- }
- } else {
- // handle milliseconds separately because of floating point math errors (issue #1867)
- days = this._days + Math.round(monthsToDays(this._months));
- switch (units) {
- case 'week':
- return days / 7 + milliseconds / 6048e5;
- case 'day':
- return days + milliseconds / 864e5;
- case 'hour':
- return days * 24 + milliseconds / 36e5;
- case 'minute':
- return days * 1440 + milliseconds / 6e4;
- case 'second':
- return days * 86400 + milliseconds / 1000;
- // Math.floor prevents floating point math errors here
- case 'millisecond':
- return Math.floor(days * 864e5) + milliseconds;
- default:
- throw new Error('Unknown unit ' + units);
- }
- }
- }
- // TODO: Use this.as('ms')?
- function valueOf$1() {
- if (!this.isValid()) {
- return NaN;
- }
- return (
- this._milliseconds +
- this._days * 864e5 +
- (this._months % 12) * 2592e6 +
- toInt(this._months / 12) * 31536e6
- );
- }
- function makeAs(alias) {
- return function () {
- return this.as(alias);
- };
- }
- var asMilliseconds = makeAs('ms'),
- asSeconds = makeAs('s'),
- asMinutes = makeAs('m'),
- asHours = makeAs('h'),
- asDays = makeAs('d'),
- asWeeks = makeAs('w'),
- asMonths = makeAs('M'),
- asQuarters = makeAs('Q'),
- asYears = makeAs('y');
- function clone$1() {
- return createDuration(this);
- }
- function get$2(units) {
- units = normalizeUnits(units);
- return this.isValid() ? this[units + 's']() : NaN;
- }
- function makeGetter(name) {
- return function () {
- return this.isValid() ? this._data[name] : NaN;
- };
- }
- var milliseconds = makeGetter('milliseconds'),
- seconds = makeGetter('seconds'),
- minutes = makeGetter('minutes'),
- hours = makeGetter('hours'),
- days = makeGetter('days'),
- months = makeGetter('months'),
- years = makeGetter('years');
- function weeks() {
- return absFloor(this.days() / 7);
- }
- var round = Math.round,
- thresholds = {
- ss: 44, // a few seconds to seconds
- s: 45, // seconds to minute
- m: 45, // minutes to hour
- h: 22, // hours to day
- d: 26, // days to month/week
- w: null, // weeks to month
- M: 11, // months to year
- };
- // helper function for moment.fn.from, moment.fn.fromNow, and moment.duration.fn.humanize
- function substituteTimeAgo(string, number, withoutSuffix, isFuture, locale) {
- return locale.relativeTime(number || 1, !!withoutSuffix, string, isFuture);
- }
- function relativeTime$1(posNegDuration, withoutSuffix, thresholds, locale) {
- var duration = createDuration(posNegDuration).abs(),
- seconds = round(duration.as('s')),
- minutes = round(duration.as('m')),
- hours = round(duration.as('h')),
- days = round(duration.as('d')),
- months = round(duration.as('M')),
- weeks = round(duration.as('w')),
- years = round(duration.as('y')),
- a =
- (seconds <= thresholds.ss && ['s', seconds]) ||
- (seconds < thresholds.s && ['ss', seconds]) ||
- (minutes <= 1 && ['m']) ||
- (minutes < thresholds.m && ['mm', minutes]) ||
- (hours <= 1 && ['h']) ||
- (hours < thresholds.h && ['hh', hours]) ||
- (days <= 1 && ['d']) ||
- (days < thresholds.d && ['dd', days]);
- if (thresholds.w != null) {
- a =
- a ||
- (weeks <= 1 && ['w']) ||
- (weeks < thresholds.w && ['ww', weeks]);
- }
- a = a ||
- (months <= 1 && ['M']) ||
- (months < thresholds.M && ['MM', months]) ||
- (years <= 1 && ['y']) || ['yy', years];
- a[2] = withoutSuffix;
- a[3] = +posNegDuration > 0;
- a[4] = locale;
- return substituteTimeAgo.apply(null, a);
- }
- // This function allows you to set the rounding function for relative time strings
- function getSetRelativeTimeRounding(roundingFunction) {
- if (roundingFunction === undefined) {
- return round;
- }
- if (typeof roundingFunction === 'function') {
- round = roundingFunction;
- return true;
- }
- return false;
- }
- // This function allows you to set a threshold for relative time strings
- function getSetRelativeTimeThreshold(threshold, limit) {
- if (thresholds[threshold] === undefined) {
- return false;
- }
- if (limit === undefined) {
- return thresholds[threshold];
- }
- thresholds[threshold] = limit;
- if (threshold === 's') {
- thresholds.ss = limit - 1;
- }
- return true;
- }
- function humanize(argWithSuffix, argThresholds) {
- if (!this.isValid()) {
- return this.localeData().invalidDate();
- }
- var withSuffix = false,
- th = thresholds,
- locale,
- output;
- if (typeof argWithSuffix === 'object') {
- argThresholds = argWithSuffix;
- argWithSuffix = false;
- }
- if (typeof argWithSuffix === 'boolean') {
- withSuffix = argWithSuffix;
- }
- if (typeof argThresholds === 'object') {
- th = Object.assign({}, thresholds, argThresholds);
- if (argThresholds.s != null && argThresholds.ss == null) {
- th.ss = argThresholds.s - 1;
- }
- }
- locale = this.localeData();
- output = relativeTime$1(this, !withSuffix, th, locale);
- if (withSuffix) {
- output = locale.pastFuture(+this, output);
- }
- return locale.postformat(output);
- }
- var abs$1 = Math.abs;
- function sign(x) {
- return (x > 0) - (x < 0) || +x;
- }
- function toISOString$1() {
- // for ISO strings we do not use the normal bubbling rules:
- // * milliseconds bubble up until they become hours
- // * days do not bubble at all
- // * months bubble up until they become years
- // This is because there is no context-free conversion between hours and days
- // (think of clock changes)
- // and also not between days and months (28-31 days per month)
- if (!this.isValid()) {
- return this.localeData().invalidDate();
- }
- var seconds = abs$1(this._milliseconds) / 1000,
- days = abs$1(this._days),
- months = abs$1(this._months),
- minutes,
- hours,
- years,
- s,
- total = this.asSeconds(),
- totalSign,
- ymSign,
- daysSign,
- hmsSign;
- if (!total) {
- // this is the same as C#'s (Noda) and python (isodate)...
- // but not other JS (goog.date)
- return 'P0D';
- }
- // 3600 seconds -> 60 minutes -> 1 hour
- minutes = absFloor(seconds / 60);
- hours = absFloor(minutes / 60);
- seconds %= 60;
- minutes %= 60;
- // 12 months -> 1 year
- years = absFloor(months / 12);
- months %= 12;
- // inspired by https://github.com/dordille/moment-isoduration/blob/master/moment.isoduration.js
- s = seconds ? seconds.toFixed(3).replace(/\.?0+$/, '') : '';
- totalSign = total < 0 ? '-' : '';
- ymSign = sign(this._months) !== sign(total) ? '-' : '';
- daysSign = sign(this._days) !== sign(total) ? '-' : '';
- hmsSign = sign(this._milliseconds) !== sign(total) ? '-' : '';
- return (
- totalSign +
- 'P' +
- (years ? ymSign + years + 'Y' : '') +
- (months ? ymSign + months + 'M' : '') +
- (days ? daysSign + days + 'D' : '') +
- (hours || minutes || seconds ? 'T' : '') +
- (hours ? hmsSign + hours + 'H' : '') +
- (minutes ? hmsSign + minutes + 'M' : '') +
- (seconds ? hmsSign + s + 'S' : '')
- );
- }
- var proto$2 = Duration.prototype;
- proto$2.isValid = isValid$1;
- proto$2.abs = abs;
- proto$2.add = add$1;
- proto$2.subtract = subtract$1;
- proto$2.as = as;
- proto$2.asMilliseconds = asMilliseconds;
- proto$2.asSeconds = asSeconds;
- proto$2.asMinutes = asMinutes;
- proto$2.asHours = asHours;
- proto$2.asDays = asDays;
- proto$2.asWeeks = asWeeks;
- proto$2.asMonths = asMonths;
- proto$2.asQuarters = asQuarters;
- proto$2.asYears = asYears;
- proto$2.valueOf = valueOf$1;
- proto$2._bubble = bubble;
- proto$2.clone = clone$1;
- proto$2.get = get$2;
- proto$2.milliseconds = milliseconds;
- proto$2.seconds = seconds;
- proto$2.minutes = minutes;
- proto$2.hours = hours;
- proto$2.days = days;
- proto$2.weeks = weeks;
- proto$2.months = months;
- proto$2.years = years;
- proto$2.humanize = humanize;
- proto$2.toISOString = toISOString$1;
- proto$2.toString = toISOString$1;
- proto$2.toJSON = toISOString$1;
- proto$2.locale = locale;
- proto$2.localeData = localeData;
- proto$2.toIsoString = deprecate(
- 'toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)',
- toISOString$1
- );
- proto$2.lang = lang;
- // FORMATTING
- addFormatToken('X', 0, 0, 'unix');
- addFormatToken('x', 0, 0, 'valueOf');
- // PARSING
- addRegexToken('x', matchSigned);
- addRegexToken('X', matchTimestamp);
- addParseToken('X', function (input, array, config) {
- config._d = new Date(parseFloat(input) * 1000);
- });
- addParseToken('x', function (input, array, config) {
- config._d = new Date(toInt(input));
- });
- //! moment.js
- hooks.version = '2.29.4';
- setHookCallback(createLocal);
- hooks.fn = proto;
- hooks.min = min;
- hooks.max = max;
- hooks.now = now;
- hooks.utc = createUTC;
- hooks.unix = createUnix;
- hooks.months = listMonths;
- hooks.isDate = isDate;
- hooks.locale = getSetGlobalLocale;
- hooks.invalid = createInvalid;
- hooks.duration = createDuration;
- hooks.isMoment = isMoment;
- hooks.weekdays = listWeekdays;
- hooks.parseZone = createInZone;
- hooks.localeData = getLocale;
- hooks.isDuration = isDuration;
- hooks.monthsShort = listMonthsShort;
- hooks.weekdaysMin = listWeekdaysMin;
- hooks.defineLocale = defineLocale;
- hooks.updateLocale = updateLocale;
- hooks.locales = listLocales;
- hooks.weekdaysShort = listWeekdaysShort;
- hooks.normalizeUnits = normalizeUnits;
- hooks.relativeTimeRounding = getSetRelativeTimeRounding;
- hooks.relativeTimeThreshold = getSetRelativeTimeThreshold;
- hooks.calendarFormat = getCalendarFormat;
- hooks.prototype = proto;
- // currently HTML5 input type only supports 24-hour formats
- hooks.HTML5_FMT = {
- DATETIME_LOCAL: 'YYYY-MM-DDTHH:mm', // <input type="datetime-local" />
- DATETIME_LOCAL_SECONDS: 'YYYY-MM-DDTHH:mm:ss', // <input type="datetime-local" step="1" />
- DATETIME_LOCAL_MS: 'YYYY-MM-DDTHH:mm:ss.SSS', // <input type="datetime-local" step="0.001" />
- DATE: 'YYYY-MM-DD', // <input type="date" />
- TIME: 'HH:mm', // <input type="time" />
- TIME_SECONDS: 'HH:mm:ss', // <input type="time" step="1" />
- TIME_MS: 'HH:mm:ss.SSS', // <input type="time" step="0.001" />
- WEEK: 'GGGG-[W]WW', // <input type="week" />
- MONTH: 'YYYY-MM', // <input type="month" />
- };
- //! moment.js locale configuration
- hooks.defineLocale('af', {
- months: 'Januarie_Februarie_Maart_April_Mei_Junie_Julie_Augustus_September_Oktober_November_Desember'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mrt_Apr_Mei_Jun_Jul_Aug_Sep_Okt_Nov_Des'.split('_'),
- weekdays: 'Sondag_Maandag_Dinsdag_Woensdag_Donderdag_Vrydag_Saterdag'.split(
- '_'
- ),
- weekdaysShort: 'Son_Maa_Din_Woe_Don_Vry_Sat'.split('_'),
- weekdaysMin: 'So_Ma_Di_Wo_Do_Vr_Sa'.split('_'),
- meridiemParse: /vm|nm/i,
- isPM: function (input) {
- return /^nm$/i.test(input);
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 12) {
- return isLower ? 'vm' : 'VM';
- } else {
- return isLower ? 'nm' : 'NM';
- }
- },
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Vandag om] LT',
- nextDay: '[Môre om] LT',
- nextWeek: 'dddd [om] LT',
- lastDay: '[Gister om] LT',
- lastWeek: '[Laas] dddd [om] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'oor %s',
- past: '%s gelede',
- s: "'n paar sekondes",
- ss: '%d sekondes',
- m: "'n minuut",
- mm: '%d minute',
- h: "'n uur",
- hh: '%d ure',
- d: "'n dag",
- dd: '%d dae',
- M: "'n maand",
- MM: '%d maande',
- y: "'n jaar",
- yy: '%d jaar',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
- ordinal: function (number) {
- return (
- number +
- (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
- ); // Thanks to Joris Röling : https://github.com/jjupiter
- },
- week: {
- dow: 1, // Maandag is die eerste dag van die week.
- doy: 4, // Die week wat die 4de Januarie bevat is die eerste week van die jaar.
- },
- });
- //! moment.js locale configuration
- var pluralForm = function (n) {
- return n === 0
- ? 0
- : n === 1
- ? 1
- : n === 2
- ? 2
- : n % 100 >= 3 && n % 100 <= 10
- ? 3
- : n % 100 >= 11
- ? 4
- : 5;
- },
- plurals = {
- s: [
- 'أقل من ثانية',
- 'ثانية واحدة',
- ['ثانيتان', 'ثانيتين'],
- '%d ثوان',
- '%d ثانية',
- '%d ثانية',
- ],
- m: [
- 'أقل من دقيقة',
- 'دقيقة واحدة',
- ['دقيقتان', 'دقيقتين'],
- '%d دقائق',
- '%d دقيقة',
- '%d دقيقة',
- ],
- h: [
- 'أقل من ساعة',
- 'ساعة واحدة',
- ['ساعتان', 'ساعتين'],
- '%d ساعات',
- '%d ساعة',
- '%d ساعة',
- ],
- d: [
- 'أقل من يوم',
- 'يوم واحد',
- ['يومان', 'يومين'],
- '%d أيام',
- '%d يومًا',
- '%d يوم',
- ],
- M: [
- 'أقل من شهر',
- 'شهر واحد',
- ['شهران', 'شهرين'],
- '%d أشهر',
- '%d شهرا',
- '%d شهر',
- ],
- y: [
- 'أقل من عام',
- 'عام واحد',
- ['عامان', 'عامين'],
- '%d أعوام',
- '%d عامًا',
- '%d عام',
- ],
- },
- pluralize = function (u) {
- return function (number, withoutSuffix, string, isFuture) {
- var f = pluralForm(number),
- str = plurals[u][pluralForm(number)];
- if (f === 2) {
- str = str[withoutSuffix ? 0 : 1];
- }
- return str.replace(/%d/i, number);
- };
- },
- months$1 = [
- 'جانفي',
- 'فيفري',
- 'مارس',
- 'أفريل',
- 'ماي',
- 'جوان',
- 'جويلية',
- 'أوت',
- 'سبتمبر',
- 'أكتوبر',
- 'نوفمبر',
- 'ديسمبر',
- ];
- hooks.defineLocale('ar-dz', {
- months: months$1,
- monthsShort: months$1,
- weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'D/\u200FM/\u200FYYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- meridiemParse: /ص|م/,
- isPM: function (input) {
- return 'م' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ص';
- } else {
- return 'م';
- }
- },
- calendar: {
- sameDay: '[اليوم عند الساعة] LT',
- nextDay: '[غدًا عند الساعة] LT',
- nextWeek: 'dddd [عند الساعة] LT',
- lastDay: '[أمس عند الساعة] LT',
- lastWeek: 'dddd [عند الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'بعد %s',
- past: 'منذ %s',
- s: pluralize('s'),
- ss: pluralize('s'),
- m: pluralize('m'),
- mm: pluralize('m'),
- h: pluralize('h'),
- hh: pluralize('h'),
- d: pluralize('d'),
- dd: pluralize('d'),
- M: pluralize('M'),
- MM: pluralize('M'),
- y: pluralize('y'),
- yy: pluralize('y'),
- },
- postformat: function (string) {
- return string.replace(/,/g, '،');
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ar-kw', {
- months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
- '_'
- ),
- monthsShort:
- 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
- '_'
- ),
- weekdays: 'الأحد_الإتنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'احد_اتنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[اليوم على الساعة] LT',
- nextDay: '[غدا على الساعة] LT',
- nextWeek: 'dddd [على الساعة] LT',
- lastDay: '[أمس على الساعة] LT',
- lastWeek: 'dddd [على الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'في %s',
- past: 'منذ %s',
- s: 'ثوان',
- ss: '%d ثانية',
- m: 'دقيقة',
- mm: '%d دقائق',
- h: 'ساعة',
- hh: '%d ساعات',
- d: 'يوم',
- dd: '%d أيام',
- M: 'شهر',
- MM: '%d أشهر',
- y: 'سنة',
- yy: '%d سنوات',
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap = {
- 1: '1',
- 2: '2',
- 3: '3',
- 4: '4',
- 5: '5',
- 6: '6',
- 7: '7',
- 8: '8',
- 9: '9',
- 0: '0',
- },
- pluralForm$1 = function (n) {
- return n === 0
- ? 0
- : n === 1
- ? 1
- : n === 2
- ? 2
- : n % 100 >= 3 && n % 100 <= 10
- ? 3
- : n % 100 >= 11
- ? 4
- : 5;
- },
- plurals$1 = {
- s: [
- 'أقل من ثانية',
- 'ثانية واحدة',
- ['ثانيتان', 'ثانيتين'],
- '%d ثوان',
- '%d ثانية',
- '%d ثانية',
- ],
- m: [
- 'أقل من دقيقة',
- 'دقيقة واحدة',
- ['دقيقتان', 'دقيقتين'],
- '%d دقائق',
- '%d دقيقة',
- '%d دقيقة',
- ],
- h: [
- 'أقل من ساعة',
- 'ساعة واحدة',
- ['ساعتان', 'ساعتين'],
- '%d ساعات',
- '%d ساعة',
- '%d ساعة',
- ],
- d: [
- 'أقل من يوم',
- 'يوم واحد',
- ['يومان', 'يومين'],
- '%d أيام',
- '%d يومًا',
- '%d يوم',
- ],
- M: [
- 'أقل من شهر',
- 'شهر واحد',
- ['شهران', 'شهرين'],
- '%d أشهر',
- '%d شهرا',
- '%d شهر',
- ],
- y: [
- 'أقل من عام',
- 'عام واحد',
- ['عامان', 'عامين'],
- '%d أعوام',
- '%d عامًا',
- '%d عام',
- ],
- },
- pluralize$1 = function (u) {
- return function (number, withoutSuffix, string, isFuture) {
- var f = pluralForm$1(number),
- str = plurals$1[u][pluralForm$1(number)];
- if (f === 2) {
- str = str[withoutSuffix ? 0 : 1];
- }
- return str.replace(/%d/i, number);
- };
- },
- months$2 = [
- 'يناير',
- 'فبراير',
- 'مارس',
- 'أبريل',
- 'مايو',
- 'يونيو',
- 'يوليو',
- 'أغسطس',
- 'سبتمبر',
- 'أكتوبر',
- 'نوفمبر',
- 'ديسمبر',
- ];
- hooks.defineLocale('ar-ly', {
- months: months$2,
- monthsShort: months$2,
- weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'D/\u200FM/\u200FYYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- meridiemParse: /ص|م/,
- isPM: function (input) {
- return 'م' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ص';
- } else {
- return 'م';
- }
- },
- calendar: {
- sameDay: '[اليوم عند الساعة] LT',
- nextDay: '[غدًا عند الساعة] LT',
- nextWeek: 'dddd [عند الساعة] LT',
- lastDay: '[أمس عند الساعة] LT',
- lastWeek: 'dddd [عند الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'بعد %s',
- past: 'منذ %s',
- s: pluralize$1('s'),
- ss: pluralize$1('s'),
- m: pluralize$1('m'),
- mm: pluralize$1('m'),
- h: pluralize$1('h'),
- hh: pluralize$1('h'),
- d: pluralize$1('d'),
- dd: pluralize$1('d'),
- M: pluralize$1('M'),
- MM: pluralize$1('M'),
- y: pluralize$1('y'),
- yy: pluralize$1('y'),
- },
- preparse: function (string) {
- return string.replace(/،/g, ',');
- },
- postformat: function (string) {
- return string
- .replace(/\d/g, function (match) {
- return symbolMap[match];
- })
- .replace(/,/g, '،');
- },
- week: {
- dow: 6, // Saturday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ar-ma', {
- months: 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
- '_'
- ),
- monthsShort:
- 'يناير_فبراير_مارس_أبريل_ماي_يونيو_يوليوز_غشت_شتنبر_أكتوبر_نونبر_دجنبر'.split(
- '_'
- ),
- weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'احد_اثنين_ثلاثاء_اربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[اليوم على الساعة] LT',
- nextDay: '[غدا على الساعة] LT',
- nextWeek: 'dddd [على الساعة] LT',
- lastDay: '[أمس على الساعة] LT',
- lastWeek: 'dddd [على الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'في %s',
- past: 'منذ %s',
- s: 'ثوان',
- ss: '%d ثانية',
- m: 'دقيقة',
- mm: '%d دقائق',
- h: 'ساعة',
- hh: '%d ساعات',
- d: 'يوم',
- dd: '%d أيام',
- M: 'شهر',
- MM: '%d أشهر',
- y: 'سنة',
- yy: '%d سنوات',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$1 = {
- 1: '١',
- 2: '٢',
- 3: '٣',
- 4: '٤',
- 5: '٥',
- 6: '٦',
- 7: '٧',
- 8: '٨',
- 9: '٩',
- 0: '٠',
- },
- numberMap = {
- '١': '1',
- '٢': '2',
- '٣': '3',
- '٤': '4',
- '٥': '5',
- '٦': '6',
- '٧': '7',
- '٨': '8',
- '٩': '9',
- '٠': '0',
- };
- hooks.defineLocale('ar-sa', {
- months: 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
- '_'
- ),
- monthsShort:
- 'يناير_فبراير_مارس_أبريل_مايو_يونيو_يوليو_أغسطس_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
- '_'
- ),
- weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- meridiemParse: /ص|م/,
- isPM: function (input) {
- return 'م' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ص';
- } else {
- return 'م';
- }
- },
- calendar: {
- sameDay: '[اليوم على الساعة] LT',
- nextDay: '[غدا على الساعة] LT',
- nextWeek: 'dddd [على الساعة] LT',
- lastDay: '[أمس على الساعة] LT',
- lastWeek: 'dddd [على الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'في %s',
- past: 'منذ %s',
- s: 'ثوان',
- ss: '%d ثانية',
- m: 'دقيقة',
- mm: '%d دقائق',
- h: 'ساعة',
- hh: '%d ساعات',
- d: 'يوم',
- dd: '%d أيام',
- M: 'شهر',
- MM: '%d أشهر',
- y: 'سنة',
- yy: '%d سنوات',
- },
- preparse: function (string) {
- return string
- .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
- return numberMap[match];
- })
- .replace(/،/g, ',');
- },
- postformat: function (string) {
- return string
- .replace(/\d/g, function (match) {
- return symbolMap$1[match];
- })
- .replace(/,/g, '،');
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ar-tn', {
- months: 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
- '_'
- ),
- monthsShort:
- 'جانفي_فيفري_مارس_أفريل_ماي_جوان_جويلية_أوت_سبتمبر_أكتوبر_نوفمبر_ديسمبر'.split(
- '_'
- ),
- weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[اليوم على الساعة] LT',
- nextDay: '[غدا على الساعة] LT',
- nextWeek: 'dddd [على الساعة] LT',
- lastDay: '[أمس على الساعة] LT',
- lastWeek: 'dddd [على الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'في %s',
- past: 'منذ %s',
- s: 'ثوان',
- ss: '%d ثانية',
- m: 'دقيقة',
- mm: '%d دقائق',
- h: 'ساعة',
- hh: '%d ساعات',
- d: 'يوم',
- dd: '%d أيام',
- M: 'شهر',
- MM: '%d أشهر',
- y: 'سنة',
- yy: '%d سنوات',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$2 = {
- 1: '١',
- 2: '٢',
- 3: '٣',
- 4: '٤',
- 5: '٥',
- 6: '٦',
- 7: '٧',
- 8: '٨',
- 9: '٩',
- 0: '٠',
- },
- numberMap$1 = {
- '١': '1',
- '٢': '2',
- '٣': '3',
- '٤': '4',
- '٥': '5',
- '٦': '6',
- '٧': '7',
- '٨': '8',
- '٩': '9',
- '٠': '0',
- },
- pluralForm$2 = function (n) {
- return n === 0
- ? 0
- : n === 1
- ? 1
- : n === 2
- ? 2
- : n % 100 >= 3 && n % 100 <= 10
- ? 3
- : n % 100 >= 11
- ? 4
- : 5;
- },
- plurals$2 = {
- s: [
- 'أقل من ثانية',
- 'ثانية واحدة',
- ['ثانيتان', 'ثانيتين'],
- '%d ثوان',
- '%d ثانية',
- '%d ثانية',
- ],
- m: [
- 'أقل من دقيقة',
- 'دقيقة واحدة',
- ['دقيقتان', 'دقيقتين'],
- '%d دقائق',
- '%d دقيقة',
- '%d دقيقة',
- ],
- h: [
- 'أقل من ساعة',
- 'ساعة واحدة',
- ['ساعتان', 'ساعتين'],
- '%d ساعات',
- '%d ساعة',
- '%d ساعة',
- ],
- d: [
- 'أقل من يوم',
- 'يوم واحد',
- ['يومان', 'يومين'],
- '%d أيام',
- '%d يومًا',
- '%d يوم',
- ],
- M: [
- 'أقل من شهر',
- 'شهر واحد',
- ['شهران', 'شهرين'],
- '%d أشهر',
- '%d شهرا',
- '%d شهر',
- ],
- y: [
- 'أقل من عام',
- 'عام واحد',
- ['عامان', 'عامين'],
- '%d أعوام',
- '%d عامًا',
- '%d عام',
- ],
- },
- pluralize$2 = function (u) {
- return function (number, withoutSuffix, string, isFuture) {
- var f = pluralForm$2(number),
- str = plurals$2[u][pluralForm$2(number)];
- if (f === 2) {
- str = str[withoutSuffix ? 0 : 1];
- }
- return str.replace(/%d/i, number);
- };
- },
- months$3 = [
- 'يناير',
- 'فبراير',
- 'مارس',
- 'أبريل',
- 'مايو',
- 'يونيو',
- 'يوليو',
- 'أغسطس',
- 'سبتمبر',
- 'أكتوبر',
- 'نوفمبر',
- 'ديسمبر',
- ];
- hooks.defineLocale('ar', {
- months: months$3,
- monthsShort: months$3,
- weekdays: 'الأحد_الإثنين_الثلاثاء_الأربعاء_الخميس_الجمعة_السبت'.split('_'),
- weekdaysShort: 'أحد_إثنين_ثلاثاء_أربعاء_خميس_جمعة_سبت'.split('_'),
- weekdaysMin: 'ح_ن_ث_ر_خ_ج_س'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'D/\u200FM/\u200FYYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- meridiemParse: /ص|م/,
- isPM: function (input) {
- return 'م' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ص';
- } else {
- return 'م';
- }
- },
- calendar: {
- sameDay: '[اليوم عند الساعة] LT',
- nextDay: '[غدًا عند الساعة] LT',
- nextWeek: 'dddd [عند الساعة] LT',
- lastDay: '[أمس عند الساعة] LT',
- lastWeek: 'dddd [عند الساعة] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'بعد %s',
- past: 'منذ %s',
- s: pluralize$2('s'),
- ss: pluralize$2('s'),
- m: pluralize$2('m'),
- mm: pluralize$2('m'),
- h: pluralize$2('h'),
- hh: pluralize$2('h'),
- d: pluralize$2('d'),
- dd: pluralize$2('d'),
- M: pluralize$2('M'),
- MM: pluralize$2('M'),
- y: pluralize$2('y'),
- yy: pluralize$2('y'),
- },
- preparse: function (string) {
- return string
- .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
- return numberMap$1[match];
- })
- .replace(/،/g, ',');
- },
- postformat: function (string) {
- return string
- .replace(/\d/g, function (match) {
- return symbolMap$2[match];
- })
- .replace(/,/g, '،');
- },
- week: {
- dow: 6, // Saturday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var suffixes = {
- 1: '-inci',
- 5: '-inci',
- 8: '-inci',
- 70: '-inci',
- 80: '-inci',
- 2: '-nci',
- 7: '-nci',
- 20: '-nci',
- 50: '-nci',
- 3: '-üncü',
- 4: '-üncü',
- 100: '-üncü',
- 6: '-ncı',
- 9: '-uncu',
- 10: '-uncu',
- 30: '-uncu',
- 60: '-ıncı',
- 90: '-ıncı',
- };
- hooks.defineLocale('az', {
- months: 'yanvar_fevral_mart_aprel_may_iyun_iyul_avqust_sentyabr_oktyabr_noyabr_dekabr'.split(
- '_'
- ),
- monthsShort: 'yan_fev_mar_apr_may_iyn_iyl_avq_sen_okt_noy_dek'.split('_'),
- weekdays:
- 'Bazar_Bazar ertəsi_Çərşənbə axşamı_Çərşənbə_Cümə axşamı_Cümə_Şənbə'.split(
- '_'
- ),
- weekdaysShort: 'Baz_BzE_ÇAx_Çər_CAx_Cüm_Şən'.split('_'),
- weekdaysMin: 'Bz_BE_ÇA_Çə_CA_Cü_Şə'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[bugün saat] LT',
- nextDay: '[sabah saat] LT',
- nextWeek: '[gələn həftə] dddd [saat] LT',
- lastDay: '[dünən] LT',
- lastWeek: '[keçən həftə] dddd [saat] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s sonra',
- past: '%s əvvəl',
- s: 'bir neçə saniyə',
- ss: '%d saniyə',
- m: 'bir dəqiqə',
- mm: '%d dəqiqə',
- h: 'bir saat',
- hh: '%d saat',
- d: 'bir gün',
- dd: '%d gün',
- M: 'bir ay',
- MM: '%d ay',
- y: 'bir il',
- yy: '%d il',
- },
- meridiemParse: /gecə|səhər|gündüz|axşam/,
- isPM: function (input) {
- return /^(gündüz|axşam)$/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'gecə';
- } else if (hour < 12) {
- return 'səhər';
- } else if (hour < 17) {
- return 'gündüz';
- } else {
- return 'axşam';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(ıncı|inci|nci|üncü|ncı|uncu)/,
- ordinal: function (number) {
- if (number === 0) {
- // special case for zero
- return number + '-ıncı';
- }
- var a = number % 10,
- b = (number % 100) - a,
- c = number >= 100 ? 100 : null;
- return number + (suffixes[a] || suffixes[b] || suffixes[c]);
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function plural(word, num) {
- var forms = word.split('_');
- return num % 10 === 1 && num % 100 !== 11
- ? forms[0]
- : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
- ? forms[1]
- : forms[2];
- }
- function relativeTimeWithPlural(number, withoutSuffix, key) {
- var format = {
- ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',
- mm: withoutSuffix ? 'хвіліна_хвіліны_хвілін' : 'хвіліну_хвіліны_хвілін',
- hh: withoutSuffix ? 'гадзіна_гадзіны_гадзін' : 'гадзіну_гадзіны_гадзін',
- dd: 'дзень_дні_дзён',
- MM: 'месяц_месяцы_месяцаў',
- yy: 'год_гады_гадоў',
- };
- if (key === 'm') {
- return withoutSuffix ? 'хвіліна' : 'хвіліну';
- } else if (key === 'h') {
- return withoutSuffix ? 'гадзіна' : 'гадзіну';
- } else {
- return number + ' ' + plural(format[key], +number);
- }
- }
- hooks.defineLocale('be', {
- months: {
- format: 'студзеня_лютага_сакавіка_красавіка_траўня_чэрвеня_ліпеня_жніўня_верасня_кастрычніка_лістапада_снежня'.split(
- '_'
- ),
- standalone:
- 'студзень_люты_сакавік_красавік_травень_чэрвень_ліпень_жнівень_верасень_кастрычнік_лістапад_снежань'.split(
- '_'
- ),
- },
- monthsShort:
- 'студ_лют_сак_крас_трав_чэрв_ліп_жнів_вер_каст_ліст_снеж'.split('_'),
- weekdays: {
- format: 'нядзелю_панядзелак_аўторак_сераду_чацвер_пятніцу_суботу'.split(
- '_'
- ),
- standalone:
- 'нядзеля_панядзелак_аўторак_серада_чацвер_пятніца_субота'.split(
- '_'
- ),
- isFormat: /\[ ?[Ууў] ?(?:мінулую|наступную)? ?\] ?dddd/,
- },
- weekdaysShort: 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
- weekdaysMin: 'нд_пн_ат_ср_чц_пт_сб'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY г.',
- LLL: 'D MMMM YYYY г., HH:mm',
- LLLL: 'dddd, D MMMM YYYY г., HH:mm',
- },
- calendar: {
- sameDay: '[Сёння ў] LT',
- nextDay: '[Заўтра ў] LT',
- lastDay: '[Учора ў] LT',
- nextWeek: function () {
- return '[У] dddd [ў] LT';
- },
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- case 3:
- case 5:
- case 6:
- return '[У мінулую] dddd [ў] LT';
- case 1:
- case 2:
- case 4:
- return '[У мінулы] dddd [ў] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'праз %s',
- past: '%s таму',
- s: 'некалькі секунд',
- m: relativeTimeWithPlural,
- mm: relativeTimeWithPlural,
- h: relativeTimeWithPlural,
- hh: relativeTimeWithPlural,
- d: 'дзень',
- dd: relativeTimeWithPlural,
- M: 'месяц',
- MM: relativeTimeWithPlural,
- y: 'год',
- yy: relativeTimeWithPlural,
- },
- meridiemParse: /ночы|раніцы|дня|вечара/,
- isPM: function (input) {
- return /^(дня|вечара)$/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'ночы';
- } else if (hour < 12) {
- return 'раніцы';
- } else if (hour < 17) {
- return 'дня';
- } else {
- return 'вечара';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(і|ы|га)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'M':
- case 'd':
- case 'DDD':
- case 'w':
- case 'W':
- return (number % 10 === 2 || number % 10 === 3) &&
- number % 100 !== 12 &&
- number % 100 !== 13
- ? number + '-і'
- : number + '-ы';
- case 'D':
- return number + '-га';
- default:
- return number;
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('bg', {
- months: 'януари_февруари_март_април_май_юни_юли_август_септември_октомври_ноември_декември'.split(
- '_'
- ),
- monthsShort: 'яну_фев_мар_апр_май_юни_юли_авг_сеп_окт_ное_дек'.split('_'),
- weekdays: 'неделя_понеделник_вторник_сряда_четвъртък_петък_събота'.split(
- '_'
- ),
- weekdaysShort: 'нед_пон_вто_сря_чет_пет_съб'.split('_'),
- weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'D.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY H:mm',
- LLLL: 'dddd, D MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[Днес в] LT',
- nextDay: '[Утре в] LT',
- nextWeek: 'dddd [в] LT',
- lastDay: '[Вчера в] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- case 3:
- case 6:
- return '[Миналата] dddd [в] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[Миналия] dddd [в] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'след %s',
- past: 'преди %s',
- s: 'няколко секунди',
- ss: '%d секунди',
- m: 'минута',
- mm: '%d минути',
- h: 'час',
- hh: '%d часа',
- d: 'ден',
- dd: '%d дена',
- w: 'седмица',
- ww: '%d седмици',
- M: 'месец',
- MM: '%d месеца',
- y: 'година',
- yy: '%d години',
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
- ordinal: function (number) {
- var lastDigit = number % 10,
- last2Digits = number % 100;
- if (number === 0) {
- return number + '-ев';
- } else if (last2Digits === 0) {
- return number + '-ен';
- } else if (last2Digits > 10 && last2Digits < 20) {
- return number + '-ти';
- } else if (lastDigit === 1) {
- return number + '-ви';
- } else if (lastDigit === 2) {
- return number + '-ри';
- } else if (lastDigit === 7 || lastDigit === 8) {
- return number + '-ми';
- } else {
- return number + '-ти';
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('bm', {
- months: 'Zanwuyekalo_Fewuruyekalo_Marisikalo_Awirilikalo_Mɛkalo_Zuwɛnkalo_Zuluyekalo_Utikalo_Sɛtanburukalo_ɔkutɔburukalo_Nowanburukalo_Desanburukalo'.split(
- '_'
- ),
- monthsShort: 'Zan_Few_Mar_Awi_Mɛ_Zuw_Zul_Uti_Sɛt_ɔku_Now_Des'.split('_'),
- weekdays: 'Kari_Ntɛnɛn_Tarata_Araba_Alamisa_Juma_Sibiri'.split('_'),
- weekdaysShort: 'Kar_Ntɛ_Tar_Ara_Ala_Jum_Sib'.split('_'),
- weekdaysMin: 'Ka_Nt_Ta_Ar_Al_Ju_Si'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'MMMM [tile] D [san] YYYY',
- LLL: 'MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm',
- LLLL: 'dddd MMMM [tile] D [san] YYYY [lɛrɛ] HH:mm',
- },
- calendar: {
- sameDay: '[Bi lɛrɛ] LT',
- nextDay: '[Sini lɛrɛ] LT',
- nextWeek: 'dddd [don lɛrɛ] LT',
- lastDay: '[Kunu lɛrɛ] LT',
- lastWeek: 'dddd [tɛmɛnen lɛrɛ] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s kɔnɔ',
- past: 'a bɛ %s bɔ',
- s: 'sanga dama dama',
- ss: 'sekondi %d',
- m: 'miniti kelen',
- mm: 'miniti %d',
- h: 'lɛrɛ kelen',
- hh: 'lɛrɛ %d',
- d: 'tile kelen',
- dd: 'tile %d',
- M: 'kalo kelen',
- MM: 'kalo %d',
- y: 'san kelen',
- yy: 'san %d',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$3 = {
- 1: '১',
- 2: '২',
- 3: '৩',
- 4: '৪',
- 5: '৫',
- 6: '৬',
- 7: '৭',
- 8: '৮',
- 9: '৯',
- 0: '০',
- },
- numberMap$2 = {
- '১': '1',
- '২': '2',
- '৩': '3',
- '৪': '4',
- '৫': '5',
- '৬': '6',
- '৭': '7',
- '৮': '8',
- '৯': '9',
- '০': '0',
- };
- hooks.defineLocale('bn-bd', {
- months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split(
- '_'
- ),
- monthsShort:
- 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split(
- '_'
- ),
- weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split(
- '_'
- ),
- weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
- weekdaysMin: 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'),
- longDateFormat: {
- LT: 'A h:mm সময়',
- LTS: 'A h:mm:ss সময়',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm সময়',
- LLLL: 'dddd, D MMMM YYYY, A h:mm সময়',
- },
- calendar: {
- sameDay: '[আজ] LT',
- nextDay: '[আগামীকাল] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[গতকাল] LT',
- lastWeek: '[গত] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s পরে',
- past: '%s আগে',
- s: 'কয়েক সেকেন্ড',
- ss: '%d সেকেন্ড',
- m: 'এক মিনিট',
- mm: '%d মিনিট',
- h: 'এক ঘন্টা',
- hh: '%d ঘন্টা',
- d: 'এক দিন',
- dd: '%d দিন',
- M: 'এক মাস',
- MM: '%d মাস',
- y: 'এক বছর',
- yy: '%d বছর',
- },
- preparse: function (string) {
- return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
- return numberMap$2[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$3[match];
- });
- },
- meridiemParse: /রাত|ভোর|সকাল|দুপুর|বিকাল|সন্ধ্যা|রাত/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'রাত') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'ভোর') {
- return hour;
- } else if (meridiem === 'সকাল') {
- return hour;
- } else if (meridiem === 'দুপুর') {
- return hour >= 3 ? hour : hour + 12;
- } else if (meridiem === 'বিকাল') {
- return hour + 12;
- } else if (meridiem === 'সন্ধ্যা') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'রাত';
- } else if (hour < 6) {
- return 'ভোর';
- } else if (hour < 12) {
- return 'সকাল';
- } else if (hour < 15) {
- return 'দুপুর';
- } else if (hour < 18) {
- return 'বিকাল';
- } else if (hour < 20) {
- return 'সন্ধ্যা';
- } else {
- return 'রাত';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$4 = {
- 1: '১',
- 2: '২',
- 3: '৩',
- 4: '৪',
- 5: '৫',
- 6: '৬',
- 7: '৭',
- 8: '৮',
- 9: '৯',
- 0: '০',
- },
- numberMap$3 = {
- '১': '1',
- '২': '2',
- '৩': '3',
- '৪': '4',
- '৫': '5',
- '৬': '6',
- '৭': '7',
- '৮': '8',
- '৯': '9',
- '০': '0',
- };
- hooks.defineLocale('bn', {
- months: 'জানুয়ারি_ফেব্রুয়ারি_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্টেম্বর_অক্টোবর_নভেম্বর_ডিসেম্বর'.split(
- '_'
- ),
- monthsShort:
- 'জানু_ফেব্রু_মার্চ_এপ্রিল_মে_জুন_জুলাই_আগস্ট_সেপ্ট_অক্টো_নভে_ডিসে'.split(
- '_'
- ),
- weekdays: 'রবিবার_সোমবার_মঙ্গলবার_বুধবার_বৃহস্পতিবার_শুক্রবার_শনিবার'.split(
- '_'
- ),
- weekdaysShort: 'রবি_সোম_মঙ্গল_বুধ_বৃহস্পতি_শুক্র_শনি'.split('_'),
- weekdaysMin: 'রবি_সোম_মঙ্গল_বুধ_বৃহ_শুক্র_শনি'.split('_'),
- longDateFormat: {
- LT: 'A h:mm সময়',
- LTS: 'A h:mm:ss সময়',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm সময়',
- LLLL: 'dddd, D MMMM YYYY, A h:mm সময়',
- },
- calendar: {
- sameDay: '[আজ] LT',
- nextDay: '[আগামীকাল] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[গতকাল] LT',
- lastWeek: '[গত] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s পরে',
- past: '%s আগে',
- s: 'কয়েক সেকেন্ড',
- ss: '%d সেকেন্ড',
- m: 'এক মিনিট',
- mm: '%d মিনিট',
- h: 'এক ঘন্টা',
- hh: '%d ঘন্টা',
- d: 'এক দিন',
- dd: '%d দিন',
- M: 'এক মাস',
- MM: '%d মাস',
- y: 'এক বছর',
- yy: '%d বছর',
- },
- preparse: function (string) {
- return string.replace(/[১২৩৪৫৬৭৮৯০]/g, function (match) {
- return numberMap$3[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$4[match];
- });
- },
- meridiemParse: /রাত|সকাল|দুপুর|বিকাল|রাত/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (
- (meridiem === 'রাত' && hour >= 4) ||
- (meridiem === 'দুপুর' && hour < 5) ||
- meridiem === 'বিকাল'
- ) {
- return hour + 12;
- } else {
- return hour;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'রাত';
- } else if (hour < 10) {
- return 'সকাল';
- } else if (hour < 17) {
- return 'দুপুর';
- } else if (hour < 20) {
- return 'বিকাল';
- } else {
- return 'রাত';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$5 = {
- 1: '༡',
- 2: '༢',
- 3: '༣',
- 4: '༤',
- 5: '༥',
- 6: '༦',
- 7: '༧',
- 8: '༨',
- 9: '༩',
- 0: '༠',
- },
- numberMap$4 = {
- '༡': '1',
- '༢': '2',
- '༣': '3',
- '༤': '4',
- '༥': '5',
- '༦': '6',
- '༧': '7',
- '༨': '8',
- '༩': '9',
- '༠': '0',
- };
- hooks.defineLocale('bo', {
- months: 'ཟླ་བ་དང་པོ_ཟླ་བ་གཉིས་པ_ཟླ་བ་གསུམ་པ_ཟླ་བ་བཞི་པ_ཟླ་བ་ལྔ་པ_ཟླ་བ་དྲུག་པ_ཟླ་བ་བདུན་པ_ཟླ་བ་བརྒྱད་པ_ཟླ་བ་དགུ་པ_ཟླ་བ་བཅུ་པ_ཟླ་བ་བཅུ་གཅིག་པ_ཟླ་བ་བཅུ་གཉིས་པ'.split(
- '_'
- ),
- monthsShort:
- 'ཟླ་1_ཟླ་2_ཟླ་3_ཟླ་4_ཟླ་5_ཟླ་6_ཟླ་7_ཟླ་8_ཟླ་9_ཟླ་10_ཟླ་11_ཟླ་12'.split(
- '_'
- ),
- monthsShortRegex: /^(ཟླ་\d{1,2})/,
- monthsParseExact: true,
- weekdays:
- 'གཟའ་ཉི་མ་_གཟའ་ཟླ་བ་_གཟའ་མིག་དམར་_གཟའ་ལྷག་པ་_གཟའ་ཕུར་བུ_གཟའ་པ་སངས་_གཟའ་སྤེན་པ་'.split(
- '_'
- ),
- weekdaysShort: 'ཉི་མ་_ཟླ་བ་_མིག་དམར་_ལྷག་པ་_ཕུར་བུ_པ་སངས་_སྤེན་པ་'.split(
- '_'
- ),
- weekdaysMin: 'ཉི_ཟླ_མིག_ལྷག_ཕུར_སངས_སྤེན'.split('_'),
- longDateFormat: {
- LT: 'A h:mm',
- LTS: 'A h:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm',
- LLLL: 'dddd, D MMMM YYYY, A h:mm',
- },
- calendar: {
- sameDay: '[དི་རིང] LT',
- nextDay: '[སང་ཉིན] LT',
- nextWeek: '[བདུན་ཕྲག་རྗེས་མ], LT',
- lastDay: '[ཁ་སང] LT',
- lastWeek: '[བདུན་ཕྲག་མཐའ་མ] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s ལ་',
- past: '%s སྔན་ལ',
- s: 'ལམ་སང',
- ss: '%d སྐར་ཆ།',
- m: 'སྐར་མ་གཅིག',
- mm: '%d སྐར་མ',
- h: 'ཆུ་ཚོད་གཅིག',
- hh: '%d ཆུ་ཚོད',
- d: 'ཉིན་གཅིག',
- dd: '%d ཉིན་',
- M: 'ཟླ་བ་གཅིག',
- MM: '%d ཟླ་བ',
- y: 'ལོ་གཅིག',
- yy: '%d ལོ',
- },
- preparse: function (string) {
- return string.replace(/[༡༢༣༤༥༦༧༨༩༠]/g, function (match) {
- return numberMap$4[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$5[match];
- });
- },
- meridiemParse: /མཚན་མོ|ཞོགས་ཀས|ཉིན་གུང|དགོང་དག|མཚན་མོ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (
- (meridiem === 'མཚན་མོ' && hour >= 4) ||
- (meridiem === 'ཉིན་གུང' && hour < 5) ||
- meridiem === 'དགོང་དག'
- ) {
- return hour + 12;
- } else {
- return hour;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'མཚན་མོ';
- } else if (hour < 10) {
- return 'ཞོགས་ཀས';
- } else if (hour < 17) {
- return 'ཉིན་གུང';
- } else if (hour < 20) {
- return 'དགོང་དག';
- } else {
- return 'མཚན་མོ';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function relativeTimeWithMutation(number, withoutSuffix, key) {
- var format = {
- mm: 'munutenn',
- MM: 'miz',
- dd: 'devezh',
- };
- return number + ' ' + mutation(format[key], number);
- }
- function specialMutationForYears(number) {
- switch (lastNumber(number)) {
- case 1:
- case 3:
- case 4:
- case 5:
- case 9:
- return number + ' bloaz';
- default:
- return number + ' vloaz';
- }
- }
- function lastNumber(number) {
- if (number > 9) {
- return lastNumber(number % 10);
- }
- return number;
- }
- function mutation(text, number) {
- if (number === 2) {
- return softMutation(text);
- }
- return text;
- }
- function softMutation(text) {
- var mutationTable = {
- m: 'v',
- b: 'v',
- d: 'z',
- };
- if (mutationTable[text.charAt(0)] === undefined) {
- return text;
- }
- return mutationTable[text.charAt(0)] + text.substring(1);
- }
- var monthsParse = [
- /^gen/i,
- /^c[ʼ\']hwe/i,
- /^meu/i,
- /^ebr/i,
- /^mae/i,
- /^(mez|eve)/i,
- /^gou/i,
- /^eos/i,
- /^gwe/i,
- /^her/i,
- /^du/i,
- /^ker/i,
- ],
- monthsRegex$1 =
- /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu|gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
- monthsStrictRegex =
- /^(genver|c[ʼ\']hwevrer|meurzh|ebrel|mae|mezheven|gouere|eost|gwengolo|here|du|kerzu)/i,
- monthsShortStrictRegex =
- /^(gen|c[ʼ\']hwe|meu|ebr|mae|eve|gou|eos|gwe|her|du|ker)/i,
- fullWeekdaysParse = [
- /^sul/i,
- /^lun/i,
- /^meurzh/i,
- /^merc[ʼ\']her/i,
- /^yaou/i,
- /^gwener/i,
- /^sadorn/i,
- ],
- shortWeekdaysParse = [
- /^Sul/i,
- /^Lun/i,
- /^Meu/i,
- /^Mer/i,
- /^Yao/i,
- /^Gwe/i,
- /^Sad/i,
- ],
- minWeekdaysParse = [
- /^Su/i,
- /^Lu/i,
- /^Me([^r]|$)/i,
- /^Mer/i,
- /^Ya/i,
- /^Gw/i,
- /^Sa/i,
- ];
- hooks.defineLocale('br', {
- months: 'Genver_Cʼhwevrer_Meurzh_Ebrel_Mae_Mezheven_Gouere_Eost_Gwengolo_Here_Du_Kerzu'.split(
- '_'
- ),
- monthsShort: 'Gen_Cʼhwe_Meu_Ebr_Mae_Eve_Gou_Eos_Gwe_Her_Du_Ker'.split('_'),
- weekdays: 'Sul_Lun_Meurzh_Mercʼher_Yaou_Gwener_Sadorn'.split('_'),
- weekdaysShort: 'Sul_Lun_Meu_Mer_Yao_Gwe_Sad'.split('_'),
- weekdaysMin: 'Su_Lu_Me_Mer_Ya_Gw_Sa'.split('_'),
- weekdaysParse: minWeekdaysParse,
- fullWeekdaysParse: fullWeekdaysParse,
- shortWeekdaysParse: shortWeekdaysParse,
- minWeekdaysParse: minWeekdaysParse,
- monthsRegex: monthsRegex$1,
- monthsShortRegex: monthsRegex$1,
- monthsStrictRegex: monthsStrictRegex,
- monthsShortStrictRegex: monthsShortStrictRegex,
- monthsParse: monthsParse,
- longMonthsParse: monthsParse,
- shortMonthsParse: monthsParse,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [a viz] MMMM YYYY',
- LLL: 'D [a viz] MMMM YYYY HH:mm',
- LLLL: 'dddd, D [a viz] MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Hiziv da] LT',
- nextDay: '[Warcʼhoazh da] LT',
- nextWeek: 'dddd [da] LT',
- lastDay: '[Decʼh da] LT',
- lastWeek: 'dddd [paset da] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'a-benn %s',
- past: '%s ʼzo',
- s: 'un nebeud segondennoù',
- ss: '%d eilenn',
- m: 'ur vunutenn',
- mm: relativeTimeWithMutation,
- h: 'un eur',
- hh: '%d eur',
- d: 'un devezh',
- dd: relativeTimeWithMutation,
- M: 'ur miz',
- MM: relativeTimeWithMutation,
- y: 'ur bloaz',
- yy: specialMutationForYears,
- },
- dayOfMonthOrdinalParse: /\d{1,2}(añ|vet)/,
- ordinal: function (number) {
- var output = number === 1 ? 'añ' : 'vet';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- meridiemParse: /a.m.|g.m./, // goude merenn | a-raok merenn
- isPM: function (token) {
- return token === 'g.m.';
- },
- meridiem: function (hour, minute, isLower) {
- return hour < 12 ? 'a.m.' : 'g.m.';
- },
- });
- //! moment.js locale configuration
- function translate(number, withoutSuffix, key) {
- var result = number + ' ';
- switch (key) {
- case 'ss':
- if (number === 1) {
- result += 'sekunda';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'sekunde';
- } else {
- result += 'sekundi';
- }
- return result;
- case 'm':
- return withoutSuffix ? 'jedna minuta' : 'jedne minute';
- case 'mm':
- if (number === 1) {
- result += 'minuta';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'minute';
- } else {
- result += 'minuta';
- }
- return result;
- case 'h':
- return withoutSuffix ? 'jedan sat' : 'jednog sata';
- case 'hh':
- if (number === 1) {
- result += 'sat';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'sata';
- } else {
- result += 'sati';
- }
- return result;
- case 'dd':
- if (number === 1) {
- result += 'dan';
- } else {
- result += 'dana';
- }
- return result;
- case 'MM':
- if (number === 1) {
- result += 'mjesec';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'mjeseca';
- } else {
- result += 'mjeseci';
- }
- return result;
- case 'yy':
- if (number === 1) {
- result += 'godina';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'godine';
- } else {
- result += 'godina';
- }
- return result;
- }
- }
- hooks.defineLocale('bs', {
- months: 'januar_februar_mart_april_maj_juni_juli_august_septembar_oktobar_novembar_decembar'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._mar._apr._maj._jun._jul._aug._sep._okt._nov._dec.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
- '_'
- ),
- weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
- weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd, D. MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[danas u] LT',
- nextDay: '[sutra u] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[u] [nedjelju] [u] LT';
- case 3:
- return '[u] [srijedu] [u] LT';
- case 6:
- return '[u] [subotu] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[u] dddd [u] LT';
- }
- },
- lastDay: '[jučer u] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- case 3:
- return '[prošlu] dddd [u] LT';
- case 6:
- return '[prošle] [subote] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[prošli] dddd [u] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: 'prije %s',
- s: 'par sekundi',
- ss: translate,
- m: translate,
- mm: translate,
- h: translate,
- hh: translate,
- d: 'dan',
- dd: translate,
- M: 'mjesec',
- MM: translate,
- y: 'godinu',
- yy: translate,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ca', {
- months: {
- standalone:
- 'gener_febrer_març_abril_maig_juny_juliol_agost_setembre_octubre_novembre_desembre'.split(
- '_'
- ),
- format: "de gener_de febrer_de març_d'abril_de maig_de juny_de juliol_d'agost_de setembre_d'octubre_de novembre_de desembre".split(
- '_'
- ),
- isFormat: /D[oD]?(\s)+MMMM/,
- },
- monthsShort:
- 'gen._febr._març_abr._maig_juny_jul._ag._set._oct._nov._des.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays:
- 'diumenge_dilluns_dimarts_dimecres_dijous_divendres_dissabte'.split(
- '_'
- ),
- weekdaysShort: 'dg._dl._dt._dc._dj._dv._ds.'.split('_'),
- weekdaysMin: 'dg_dl_dt_dc_dj_dv_ds'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM [de] YYYY',
- ll: 'D MMM YYYY',
- LLL: 'D MMMM [de] YYYY [a les] H:mm',
- lll: 'D MMM YYYY, H:mm',
- LLLL: 'dddd D MMMM [de] YYYY [a les] H:mm',
- llll: 'ddd D MMM YYYY, H:mm',
- },
- calendar: {
- sameDay: function () {
- return '[avui a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
- },
- nextDay: function () {
- return '[demà a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
- },
- nextWeek: function () {
- return 'dddd [a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
- },
- lastDay: function () {
- return '[ahir a ' + (this.hours() !== 1 ? 'les' : 'la') + '] LT';
- },
- lastWeek: function () {
- return (
- '[el] dddd [passat a ' +
- (this.hours() !== 1 ? 'les' : 'la') +
- '] LT'
- );
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: "d'aquí %s",
- past: 'fa %s',
- s: 'uns segons',
- ss: '%d segons',
- m: 'un minut',
- mm: '%d minuts',
- h: 'una hora',
- hh: '%d hores',
- d: 'un dia',
- dd: '%d dies',
- M: 'un mes',
- MM: '%d mesos',
- y: 'un any',
- yy: '%d anys',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/,
- ordinal: function (number, period) {
- var output =
- number === 1
- ? 'r'
- : number === 2
- ? 'n'
- : number === 3
- ? 'r'
- : number === 4
- ? 't'
- : 'è';
- if (period === 'w' || period === 'W') {
- output = 'a';
- }
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var months$4 = {
- format: 'leden_únor_březen_duben_květen_červen_červenec_srpen_září_říjen_listopad_prosinec'.split(
- '_'
- ),
- standalone:
- 'ledna_února_března_dubna_května_června_července_srpna_září_října_listopadu_prosince'.split(
- '_'
- ),
- },
- monthsShort = 'led_úno_bře_dub_kvě_čvn_čvc_srp_zář_říj_lis_pro'.split('_'),
- monthsParse$1 = [
- /^led/i,
- /^úno/i,
- /^bře/i,
- /^dub/i,
- /^kvě/i,
- /^(čvn|červen$|června)/i,
- /^(čvc|červenec|července)/i,
- /^srp/i,
- /^zář/i,
- /^říj/i,
- /^lis/i,
- /^pro/i,
- ],
- // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched.
- // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'.
- monthsRegex$2 =
- /^(leden|únor|březen|duben|květen|červenec|července|červen|června|srpen|září|říjen|listopad|prosinec|led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i;
- function plural$1(n) {
- return n > 1 && n < 5 && ~~(n / 10) !== 1;
- }
- function translate$1(number, withoutSuffix, key, isFuture) {
- var result = number + ' ';
- switch (key) {
- case 's': // a few seconds / in a few seconds / a few seconds ago
- return withoutSuffix || isFuture ? 'pár sekund' : 'pár sekundami';
- case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
- if (withoutSuffix || isFuture) {
- return result + (plural$1(number) ? 'sekundy' : 'sekund');
- } else {
- return result + 'sekundami';
- }
- case 'm': // a minute / in a minute / a minute ago
- return withoutSuffix ? 'minuta' : isFuture ? 'minutu' : 'minutou';
- case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
- if (withoutSuffix || isFuture) {
- return result + (plural$1(number) ? 'minuty' : 'minut');
- } else {
- return result + 'minutami';
- }
- case 'h': // an hour / in an hour / an hour ago
- return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
- case 'hh': // 9 hours / in 9 hours / 9 hours ago
- if (withoutSuffix || isFuture) {
- return result + (plural$1(number) ? 'hodiny' : 'hodin');
- } else {
- return result + 'hodinami';
- }
- case 'd': // a day / in a day / a day ago
- return withoutSuffix || isFuture ? 'den' : 'dnem';
- case 'dd': // 9 days / in 9 days / 9 days ago
- if (withoutSuffix || isFuture) {
- return result + (plural$1(number) ? 'dny' : 'dní');
- } else {
- return result + 'dny';
- }
- case 'M': // a month / in a month / a month ago
- return withoutSuffix || isFuture ? 'měsíc' : 'měsícem';
- case 'MM': // 9 months / in 9 months / 9 months ago
- if (withoutSuffix || isFuture) {
- return result + (plural$1(number) ? 'měsíce' : 'měsíců');
- } else {
- return result + 'měsíci';
- }
- case 'y': // a year / in a year / a year ago
- return withoutSuffix || isFuture ? 'rok' : 'rokem';
- case 'yy': // 9 years / in 9 years / 9 years ago
- if (withoutSuffix || isFuture) {
- return result + (plural$1(number) ? 'roky' : 'let');
- } else {
- return result + 'lety';
- }
- }
- }
- hooks.defineLocale('cs', {
- months: months$4,
- monthsShort: monthsShort,
- monthsRegex: monthsRegex$2,
- monthsShortRegex: monthsRegex$2,
- // NOTE: 'červen' is substring of 'červenec'; therefore 'červenec' must precede 'červen' in the regex to be fully matched.
- // Otherwise parser matches '1. červenec' as '1. červen' + 'ec'.
- monthsStrictRegex:
- /^(leden|ledna|února|únor|březen|března|duben|dubna|květen|května|červenec|července|červen|června|srpen|srpna|září|říjen|října|listopadu|listopad|prosinec|prosince)/i,
- monthsShortStrictRegex:
- /^(led|úno|bře|dub|kvě|čvn|čvc|srp|zář|říj|lis|pro)/i,
- monthsParse: monthsParse$1,
- longMonthsParse: monthsParse$1,
- shortMonthsParse: monthsParse$1,
- weekdays: 'neděle_pondělí_úterý_středa_čtvrtek_pátek_sobota'.split('_'),
- weekdaysShort: 'ne_po_út_st_čt_pá_so'.split('_'),
- weekdaysMin: 'ne_po_út_st_čt_pá_so'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd D. MMMM YYYY H:mm',
- l: 'D. M. YYYY',
- },
- calendar: {
- sameDay: '[dnes v] LT',
- nextDay: '[zítra v] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[v neděli v] LT';
- case 1:
- case 2:
- return '[v] dddd [v] LT';
- case 3:
- return '[ve středu v] LT';
- case 4:
- return '[ve čtvrtek v] LT';
- case 5:
- return '[v pátek v] LT';
- case 6:
- return '[v sobotu v] LT';
- }
- },
- lastDay: '[včera v] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return '[minulou neděli v] LT';
- case 1:
- case 2:
- return '[minulé] dddd [v] LT';
- case 3:
- return '[minulou středu v] LT';
- case 4:
- case 5:
- return '[minulý] dddd [v] LT';
- case 6:
- return '[minulou sobotu v] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: 'před %s',
- s: translate$1,
- ss: translate$1,
- m: translate$1,
- mm: translate$1,
- h: translate$1,
- hh: translate$1,
- d: translate$1,
- dd: translate$1,
- M: translate$1,
- MM: translate$1,
- y: translate$1,
- yy: translate$1,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('cv', {
- months: 'кӑрлач_нарӑс_пуш_ака_май_ҫӗртме_утӑ_ҫурла_авӑн_юпа_чӳк_раштав'.split(
- '_'
- ),
- monthsShort: 'кӑр_нар_пуш_ака_май_ҫӗр_утӑ_ҫур_авн_юпа_чӳк_раш'.split('_'),
- weekdays:
- 'вырсарникун_тунтикун_ытларикун_юнкун_кӗҫнерникун_эрнекун_шӑматкун'.split(
- '_'
- ),
- weekdaysShort: 'выр_тун_ытл_юн_кӗҫ_эрн_шӑм'.split('_'),
- weekdaysMin: 'вр_тн_ыт_юн_кҫ_эр_шм'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD-MM-YYYY',
- LL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ]',
- LLL: 'YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
- LLLL: 'dddd, YYYY [ҫулхи] MMMM [уйӑхӗн] D[-мӗшӗ], HH:mm',
- },
- calendar: {
- sameDay: '[Паян] LT [сехетре]',
- nextDay: '[Ыран] LT [сехетре]',
- lastDay: '[Ӗнер] LT [сехетре]',
- nextWeek: '[Ҫитес] dddd LT [сехетре]',
- lastWeek: '[Иртнӗ] dddd LT [сехетре]',
- sameElse: 'L',
- },
- relativeTime: {
- future: function (output) {
- var affix = /сехет$/i.exec(output)
- ? 'рен'
- : /ҫул$/i.exec(output)
- ? 'тан'
- : 'ран';
- return output + affix;
- },
- past: '%s каялла',
- s: 'пӗр-ик ҫеккунт',
- ss: '%d ҫеккунт',
- m: 'пӗр минут',
- mm: '%d минут',
- h: 'пӗр сехет',
- hh: '%d сехет',
- d: 'пӗр кун',
- dd: '%d кун',
- M: 'пӗр уйӑх',
- MM: '%d уйӑх',
- y: 'пӗр ҫул',
- yy: '%d ҫул',
- },
- dayOfMonthOrdinalParse: /\d{1,2}-мӗш/,
- ordinal: '%d-мӗш',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('cy', {
- months: 'Ionawr_Chwefror_Mawrth_Ebrill_Mai_Mehefin_Gorffennaf_Awst_Medi_Hydref_Tachwedd_Rhagfyr'.split(
- '_'
- ),
- monthsShort: 'Ion_Chwe_Maw_Ebr_Mai_Meh_Gor_Aws_Med_Hyd_Tach_Rhag'.split(
- '_'
- ),
- weekdays:
- 'Dydd Sul_Dydd Llun_Dydd Mawrth_Dydd Mercher_Dydd Iau_Dydd Gwener_Dydd Sadwrn'.split(
- '_'
- ),
- weekdaysShort: 'Sul_Llun_Maw_Mer_Iau_Gwe_Sad'.split('_'),
- weekdaysMin: 'Su_Ll_Ma_Me_Ia_Gw_Sa'.split('_'),
- weekdaysParseExact: true,
- // time formats are the same as en-gb
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Heddiw am] LT',
- nextDay: '[Yfory am] LT',
- nextWeek: 'dddd [am] LT',
- lastDay: '[Ddoe am] LT',
- lastWeek: 'dddd [diwethaf am] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'mewn %s',
- past: '%s yn ôl',
- s: 'ychydig eiliadau',
- ss: '%d eiliad',
- m: 'munud',
- mm: '%d munud',
- h: 'awr',
- hh: '%d awr',
- d: 'diwrnod',
- dd: '%d diwrnod',
- M: 'mis',
- MM: '%d mis',
- y: 'blwyddyn',
- yy: '%d flynedd',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(fed|ain|af|il|ydd|ed|eg)/,
- // traditional ordinal numbers above 31 are not commonly used in colloquial Welsh
- ordinal: function (number) {
- var b = number,
- output = '',
- lookup = [
- '',
- 'af',
- 'il',
- 'ydd',
- 'ydd',
- 'ed',
- 'ed',
- 'ed',
- 'fed',
- 'fed',
- 'fed', // 1af to 10fed
- 'eg',
- 'fed',
- 'eg',
- 'eg',
- 'fed',
- 'eg',
- 'eg',
- 'fed',
- 'eg',
- 'fed', // 11eg to 20fed
- ];
- if (b > 20) {
- if (b === 40 || b === 50 || b === 60 || b === 80 || b === 100) {
- output = 'fed'; // not 30ain, 70ain or 90ain
- } else {
- output = 'ain';
- }
- } else if (b > 0) {
- output = lookup[b];
- }
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('da', {
- months: 'januar_februar_marts_april_maj_juni_juli_august_september_oktober_november_december'.split(
- '_'
- ),
- monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
- weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
- weekdaysShort: 'søn_man_tir_ons_tor_fre_lør'.split('_'),
- weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY HH:mm',
- LLLL: 'dddd [d.] D. MMMM YYYY [kl.] HH:mm',
- },
- calendar: {
- sameDay: '[i dag kl.] LT',
- nextDay: '[i morgen kl.] LT',
- nextWeek: 'på dddd [kl.] LT',
- lastDay: '[i går kl.] LT',
- lastWeek: '[i] dddd[s kl.] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'om %s',
- past: '%s siden',
- s: 'få sekunder',
- ss: '%d sekunder',
- m: 'et minut',
- mm: '%d minutter',
- h: 'en time',
- hh: '%d timer',
- d: 'en dag',
- dd: '%d dage',
- M: 'en måned',
- MM: '%d måneder',
- y: 'et år',
- yy: '%d år',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function processRelativeTime(number, withoutSuffix, key, isFuture) {
- var format = {
- m: ['eine Minute', 'einer Minute'],
- h: ['eine Stunde', 'einer Stunde'],
- d: ['ein Tag', 'einem Tag'],
- dd: [number + ' Tage', number + ' Tagen'],
- w: ['eine Woche', 'einer Woche'],
- M: ['ein Monat', 'einem Monat'],
- MM: [number + ' Monate', number + ' Monaten'],
- y: ['ein Jahr', 'einem Jahr'],
- yy: [number + ' Jahre', number + ' Jahren'],
- };
- return withoutSuffix ? format[key][0] : format[key][1];
- }
- hooks.defineLocale('de-at', {
- months: 'Jänner_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split(
- '_'
- ),
- monthsShort:
- 'Jän._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
- monthsParseExact: true,
- weekdays:
- 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split(
- '_'
- ),
- weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
- weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY HH:mm',
- LLLL: 'dddd, D. MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[heute um] LT [Uhr]',
- sameElse: 'L',
- nextDay: '[morgen um] LT [Uhr]',
- nextWeek: 'dddd [um] LT [Uhr]',
- lastDay: '[gestern um] LT [Uhr]',
- lastWeek: '[letzten] dddd [um] LT [Uhr]',
- },
- relativeTime: {
- future: 'in %s',
- past: 'vor %s',
- s: 'ein paar Sekunden',
- ss: '%d Sekunden',
- m: processRelativeTime,
- mm: '%d Minuten',
- h: processRelativeTime,
- hh: '%d Stunden',
- d: processRelativeTime,
- dd: processRelativeTime,
- w: processRelativeTime,
- ww: '%d Wochen',
- M: processRelativeTime,
- MM: processRelativeTime,
- y: processRelativeTime,
- yy: processRelativeTime,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function processRelativeTime$1(number, withoutSuffix, key, isFuture) {
- var format = {
- m: ['eine Minute', 'einer Minute'],
- h: ['eine Stunde', 'einer Stunde'],
- d: ['ein Tag', 'einem Tag'],
- dd: [number + ' Tage', number + ' Tagen'],
- w: ['eine Woche', 'einer Woche'],
- M: ['ein Monat', 'einem Monat'],
- MM: [number + ' Monate', number + ' Monaten'],
- y: ['ein Jahr', 'einem Jahr'],
- yy: [number + ' Jahre', number + ' Jahren'],
- };
- return withoutSuffix ? format[key][0] : format[key][1];
- }
- hooks.defineLocale('de-ch', {
- months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split(
- '_'
- ),
- monthsShort:
- 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
- monthsParseExact: true,
- weekdays:
- 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split(
- '_'
- ),
- weekdaysShort: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
- weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY HH:mm',
- LLLL: 'dddd, D. MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[heute um] LT [Uhr]',
- sameElse: 'L',
- nextDay: '[morgen um] LT [Uhr]',
- nextWeek: 'dddd [um] LT [Uhr]',
- lastDay: '[gestern um] LT [Uhr]',
- lastWeek: '[letzten] dddd [um] LT [Uhr]',
- },
- relativeTime: {
- future: 'in %s',
- past: 'vor %s',
- s: 'ein paar Sekunden',
- ss: '%d Sekunden',
- m: processRelativeTime$1,
- mm: '%d Minuten',
- h: processRelativeTime$1,
- hh: '%d Stunden',
- d: processRelativeTime$1,
- dd: processRelativeTime$1,
- w: processRelativeTime$1,
- ww: '%d Wochen',
- M: processRelativeTime$1,
- MM: processRelativeTime$1,
- y: processRelativeTime$1,
- yy: processRelativeTime$1,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function processRelativeTime$2(number, withoutSuffix, key, isFuture) {
- var format = {
- m: ['eine Minute', 'einer Minute'],
- h: ['eine Stunde', 'einer Stunde'],
- d: ['ein Tag', 'einem Tag'],
- dd: [number + ' Tage', number + ' Tagen'],
- w: ['eine Woche', 'einer Woche'],
- M: ['ein Monat', 'einem Monat'],
- MM: [number + ' Monate', number + ' Monaten'],
- y: ['ein Jahr', 'einem Jahr'],
- yy: [number + ' Jahre', number + ' Jahren'],
- };
- return withoutSuffix ? format[key][0] : format[key][1];
- }
- hooks.defineLocale('de', {
- months: 'Januar_Februar_März_April_Mai_Juni_Juli_August_September_Oktober_November_Dezember'.split(
- '_'
- ),
- monthsShort:
- 'Jan._Feb._März_Apr._Mai_Juni_Juli_Aug._Sep._Okt._Nov._Dez.'.split('_'),
- monthsParseExact: true,
- weekdays:
- 'Sonntag_Montag_Dienstag_Mittwoch_Donnerstag_Freitag_Samstag'.split(
- '_'
- ),
- weekdaysShort: 'So._Mo._Di._Mi._Do._Fr._Sa.'.split('_'),
- weekdaysMin: 'So_Mo_Di_Mi_Do_Fr_Sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY HH:mm',
- LLLL: 'dddd, D. MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[heute um] LT [Uhr]',
- sameElse: 'L',
- nextDay: '[morgen um] LT [Uhr]',
- nextWeek: 'dddd [um] LT [Uhr]',
- lastDay: '[gestern um] LT [Uhr]',
- lastWeek: '[letzten] dddd [um] LT [Uhr]',
- },
- relativeTime: {
- future: 'in %s',
- past: 'vor %s',
- s: 'ein paar Sekunden',
- ss: '%d Sekunden',
- m: processRelativeTime$2,
- mm: '%d Minuten',
- h: processRelativeTime$2,
- hh: '%d Stunden',
- d: processRelativeTime$2,
- dd: processRelativeTime$2,
- w: processRelativeTime$2,
- ww: '%d Wochen',
- M: processRelativeTime$2,
- MM: processRelativeTime$2,
- y: processRelativeTime$2,
- yy: processRelativeTime$2,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var months$5 = [
- 'ޖެނުއަރީ',
- 'ފެބްރުއަރީ',
- 'މާރިޗު',
- 'އޭޕްރީލު',
- 'މޭ',
- 'ޖޫން',
- 'ޖުލައި',
- 'އޯގަސްޓު',
- 'ސެޕްޓެމްބަރު',
- 'އޮކްޓޯބަރު',
- 'ނޮވެމްބަރު',
- 'ޑިސެމްބަރު',
- ],
- weekdays = [
- 'އާދިއްތަ',
- 'ހޯމަ',
- 'އަންގާރަ',
- 'ބުދަ',
- 'ބުރާސްފަތި',
- 'ހުކުރު',
- 'ހޮނިހިރު',
- ];
- hooks.defineLocale('dv', {
- months: months$5,
- monthsShort: months$5,
- weekdays: weekdays,
- weekdaysShort: weekdays,
- weekdaysMin: 'އާދި_ހޯމަ_އަން_ބުދަ_ބުރާ_ހުކު_ހޮނި'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'D/M/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- meridiemParse: /މކ|މފ/,
- isPM: function (input) {
- return 'މފ' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'މކ';
- } else {
- return 'މފ';
- }
- },
- calendar: {
- sameDay: '[މިއަދު] LT',
- nextDay: '[މާދަމާ] LT',
- nextWeek: 'dddd LT',
- lastDay: '[އިއްޔެ] LT',
- lastWeek: '[ފާއިތުވި] dddd LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'ތެރޭގައި %s',
- past: 'ކުރިން %s',
- s: 'ސިކުންތުކޮޅެއް',
- ss: 'd% ސިކުންތު',
- m: 'މިނިޓެއް',
- mm: 'މިނިޓު %d',
- h: 'ގަޑިއިރެއް',
- hh: 'ގަޑިއިރު %d',
- d: 'ދުވަހެއް',
- dd: 'ދުވަސް %d',
- M: 'މަހެއް',
- MM: 'މަސް %d',
- y: 'އަހަރެއް',
- yy: 'އަހަރު %d',
- },
- preparse: function (string) {
- return string.replace(/،/g, ',');
- },
- postformat: function (string) {
- return string.replace(/,/g, '،');
- },
- week: {
- dow: 7, // Sunday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function isFunction$1(input) {
- return (
- (typeof Function !== 'undefined' && input instanceof Function) ||
- Object.prototype.toString.call(input) === '[object Function]'
- );
- }
- hooks.defineLocale('el', {
- monthsNominativeEl:
- 'Ιανουάριος_Φεβρουάριος_Μάρτιος_Απρίλιος_Μάιος_Ιούνιος_Ιούλιος_Αύγουστος_Σεπτέμβριος_Οκτώβριος_Νοέμβριος_Δεκέμβριος'.split(
- '_'
- ),
- monthsGenitiveEl:
- 'Ιανουαρίου_Φεβρουαρίου_Μαρτίου_Απριλίου_Μαΐου_Ιουνίου_Ιουλίου_Αυγούστου_Σεπτεμβρίου_Οκτωβρίου_Νοεμβρίου_Δεκεμβρίου'.split(
- '_'
- ),
- months: function (momentToFormat, format) {
- if (!momentToFormat) {
- return this._monthsNominativeEl;
- } else if (
- typeof format === 'string' &&
- /D/.test(format.substring(0, format.indexOf('MMMM')))
- ) {
- // if there is a day number before 'MMMM'
- return this._monthsGenitiveEl[momentToFormat.month()];
- } else {
- return this._monthsNominativeEl[momentToFormat.month()];
- }
- },
- monthsShort: 'Ιαν_Φεβ_Μαρ_Απρ_Μαϊ_Ιουν_Ιουλ_Αυγ_Σεπ_Οκτ_Νοε_Δεκ'.split('_'),
- weekdays: 'Κυριακή_Δευτέρα_Τρίτη_Τετάρτη_Πέμπτη_Παρασκευή_Σάββατο'.split(
- '_'
- ),
- weekdaysShort: 'Κυρ_Δευ_Τρι_Τετ_Πεμ_Παρ_Σαβ'.split('_'),
- weekdaysMin: 'Κυ_Δε_Τρ_Τε_Πε_Πα_Σα'.split('_'),
- meridiem: function (hours, minutes, isLower) {
- if (hours > 11) {
- return isLower ? 'μμ' : 'ΜΜ';
- } else {
- return isLower ? 'πμ' : 'ΠΜ';
- }
- },
- isPM: function (input) {
- return (input + '').toLowerCase()[0] === 'μ';
- },
- meridiemParse: /[ΠΜ]\.?Μ?\.?/i,
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY h:mm A',
- LLLL: 'dddd, D MMMM YYYY h:mm A',
- },
- calendarEl: {
- sameDay: '[Σήμερα {}] LT',
- nextDay: '[Αύριο {}] LT',
- nextWeek: 'dddd [{}] LT',
- lastDay: '[Χθες {}] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 6:
- return '[το προηγούμενο] dddd [{}] LT';
- default:
- return '[την προηγούμενη] dddd [{}] LT';
- }
- },
- sameElse: 'L',
- },
- calendar: function (key, mom) {
- var output = this._calendarEl[key],
- hours = mom && mom.hours();
- if (isFunction$1(output)) {
- output = output.apply(mom);
- }
- return output.replace('{}', hours % 12 === 1 ? 'στη' : 'στις');
- },
- relativeTime: {
- future: 'σε %s',
- past: '%s πριν',
- s: 'λίγα δευτερόλεπτα',
- ss: '%d δευτερόλεπτα',
- m: 'ένα λεπτό',
- mm: '%d λεπτά',
- h: 'μία ώρα',
- hh: '%d ώρες',
- d: 'μία μέρα',
- dd: '%d μέρες',
- M: 'ένας μήνας',
- MM: '%d μήνες',
- y: 'ένας χρόνος',
- yy: '%d χρόνια',
- },
- dayOfMonthOrdinalParse: /\d{1,2}η/,
- ordinal: '%dη',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4st is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-au', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY h:mm A',
- LLLL: 'dddd, D MMMM YYYY h:mm A',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-ca', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'YYYY-MM-DD',
- LL: 'MMMM D, YYYY',
- LLL: 'MMMM D, YYYY h:mm A',
- LLLL: 'dddd, MMMM D, YYYY h:mm A',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-gb', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-ie', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-il', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-in', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY h:mm A',
- LLLL: 'dddd, D MMMM YYYY h:mm A',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 1st is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-nz', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY h:mm A',
- LLLL: 'dddd, D MMMM YYYY h:mm A',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('en-sg', {
- months: 'January_February_March_April_May_June_July_August_September_October_November_December'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec'.split('_'),
- weekdays: 'Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday'.split(
- '_'
- ),
- weekdaysShort: 'Sun_Mon_Tue_Wed_Thu_Fri_Sat'.split('_'),
- weekdaysMin: 'Su_Mo_Tu_We_Th_Fr_Sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Today at] LT',
- nextDay: '[Tomorrow at] LT',
- nextWeek: 'dddd [at] LT',
- lastDay: '[Yesterday at] LT',
- lastWeek: '[Last] dddd [at] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'in %s',
- past: '%s ago',
- s: 'a few seconds',
- ss: '%d seconds',
- m: 'a minute',
- mm: '%d minutes',
- h: 'an hour',
- hh: '%d hours',
- d: 'a day',
- dd: '%d days',
- M: 'a month',
- MM: '%d months',
- y: 'a year',
- yy: '%d years',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('eo', {
- months: 'januaro_februaro_marto_aprilo_majo_junio_julio_aŭgusto_septembro_oktobro_novembro_decembro'.split(
- '_'
- ),
- monthsShort: 'jan_feb_mart_apr_maj_jun_jul_aŭg_sept_okt_nov_dec'.split('_'),
- weekdays: 'dimanĉo_lundo_mardo_merkredo_ĵaŭdo_vendredo_sabato'.split('_'),
- weekdaysShort: 'dim_lun_mard_merk_ĵaŭ_ven_sab'.split('_'),
- weekdaysMin: 'di_lu_ma_me_ĵa_ve_sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: '[la] D[-an de] MMMM, YYYY',
- LLL: '[la] D[-an de] MMMM, YYYY HH:mm',
- LLLL: 'dddd[n], [la] D[-an de] MMMM, YYYY HH:mm',
- llll: 'ddd, [la] D[-an de] MMM, YYYY HH:mm',
- },
- meridiemParse: /[ap]\.t\.m/i,
- isPM: function (input) {
- return input.charAt(0).toLowerCase() === 'p';
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours > 11) {
- return isLower ? 'p.t.m.' : 'P.T.M.';
- } else {
- return isLower ? 'a.t.m.' : 'A.T.M.';
- }
- },
- calendar: {
- sameDay: '[Hodiaŭ je] LT',
- nextDay: '[Morgaŭ je] LT',
- nextWeek: 'dddd[n je] LT',
- lastDay: '[Hieraŭ je] LT',
- lastWeek: '[pasintan] dddd[n je] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'post %s',
- past: 'antaŭ %s',
- s: 'kelkaj sekundoj',
- ss: '%d sekundoj',
- m: 'unu minuto',
- mm: '%d minutoj',
- h: 'unu horo',
- hh: '%d horoj',
- d: 'unu tago', //ne 'diurno', ĉar estas uzita por proksimumo
- dd: '%d tagoj',
- M: 'unu monato',
- MM: '%d monatoj',
- y: 'unu jaro',
- yy: '%d jaroj',
- },
- dayOfMonthOrdinalParse: /\d{1,2}a/,
- ordinal: '%da',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsShortDot =
- 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
- '_'
- ),
- monthsShort$1 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
- monthsParse$2 = [
- /^ene/i,
- /^feb/i,
- /^mar/i,
- /^abr/i,
- /^may/i,
- /^jun/i,
- /^jul/i,
- /^ago/i,
- /^sep/i,
- /^oct/i,
- /^nov/i,
- /^dic/i,
- ],
- monthsRegex$3 =
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
- hooks.defineLocale('es-do', {
- months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortDot;
- } else if (/-MMM-/.test(format)) {
- return monthsShort$1[m.month()];
- } else {
- return monthsShortDot[m.month()];
- }
- },
- monthsRegex: monthsRegex$3,
- monthsShortRegex: monthsRegex$3,
- monthsStrictRegex:
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
- monthsShortStrictRegex:
- /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
- monthsParse: monthsParse$2,
- longMonthsParse: monthsParse$2,
- shortMonthsParse: monthsParse$2,
- weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
- weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
- weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY h:mm A',
- LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A',
- },
- calendar: {
- sameDay: function () {
- return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextDay: function () {
- return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextWeek: function () {
- return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastDay: function () {
- return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastWeek: function () {
- return (
- '[el] dddd [pasado a la' +
- (this.hours() !== 1 ? 's' : '') +
- '] LT'
- );
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'en %s',
- past: 'hace %s',
- s: 'unos segundos',
- ss: '%d segundos',
- m: 'un minuto',
- mm: '%d minutos',
- h: 'una hora',
- hh: '%d horas',
- d: 'un día',
- dd: '%d días',
- w: 'una semana',
- ww: '%d semanas',
- M: 'un mes',
- MM: '%d meses',
- y: 'un año',
- yy: '%d años',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsShortDot$1 =
- 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
- '_'
- ),
- monthsShort$2 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
- monthsParse$3 = [
- /^ene/i,
- /^feb/i,
- /^mar/i,
- /^abr/i,
- /^may/i,
- /^jun/i,
- /^jul/i,
- /^ago/i,
- /^sep/i,
- /^oct/i,
- /^nov/i,
- /^dic/i,
- ],
- monthsRegex$4 =
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
- hooks.defineLocale('es-mx', {
- months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortDot$1;
- } else if (/-MMM-/.test(format)) {
- return monthsShort$2[m.month()];
- } else {
- return monthsShortDot$1[m.month()];
- }
- },
- monthsRegex: monthsRegex$4,
- monthsShortRegex: monthsRegex$4,
- monthsStrictRegex:
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
- monthsShortStrictRegex:
- /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
- monthsParse: monthsParse$3,
- longMonthsParse: monthsParse$3,
- shortMonthsParse: monthsParse$3,
- weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
- weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
- weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY H:mm',
- LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
- },
- calendar: {
- sameDay: function () {
- return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextDay: function () {
- return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextWeek: function () {
- return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastDay: function () {
- return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastWeek: function () {
- return (
- '[el] dddd [pasado a la' +
- (this.hours() !== 1 ? 's' : '') +
- '] LT'
- );
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'en %s',
- past: 'hace %s',
- s: 'unos segundos',
- ss: '%d segundos',
- m: 'un minuto',
- mm: '%d minutos',
- h: 'una hora',
- hh: '%d horas',
- d: 'un día',
- dd: '%d días',
- w: 'una semana',
- ww: '%d semanas',
- M: 'un mes',
- MM: '%d meses',
- y: 'un año',
- yy: '%d años',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- invalidDate: 'Fecha inválida',
- });
- //! moment.js locale configuration
- var monthsShortDot$2 =
- 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
- '_'
- ),
- monthsShort$3 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
- monthsParse$4 = [
- /^ene/i,
- /^feb/i,
- /^mar/i,
- /^abr/i,
- /^may/i,
- /^jun/i,
- /^jul/i,
- /^ago/i,
- /^sep/i,
- /^oct/i,
- /^nov/i,
- /^dic/i,
- ],
- monthsRegex$5 =
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
- hooks.defineLocale('es-us', {
- months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortDot$2;
- } else if (/-MMM-/.test(format)) {
- return monthsShort$3[m.month()];
- } else {
- return monthsShortDot$2[m.month()];
- }
- },
- monthsRegex: monthsRegex$5,
- monthsShortRegex: monthsRegex$5,
- monthsStrictRegex:
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
- monthsShortStrictRegex:
- /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
- monthsParse: monthsParse$4,
- longMonthsParse: monthsParse$4,
- shortMonthsParse: monthsParse$4,
- weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
- weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
- weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'MM/DD/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY h:mm A',
- LLLL: 'dddd, D [de] MMMM [de] YYYY h:mm A',
- },
- calendar: {
- sameDay: function () {
- return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextDay: function () {
- return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextWeek: function () {
- return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastDay: function () {
- return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastWeek: function () {
- return (
- '[el] dddd [pasado a la' +
- (this.hours() !== 1 ? 's' : '') +
- '] LT'
- );
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'en %s',
- past: 'hace %s',
- s: 'unos segundos',
- ss: '%d segundos',
- m: 'un minuto',
- mm: '%d minutos',
- h: 'una hora',
- hh: '%d horas',
- d: 'un día',
- dd: '%d días',
- w: 'una semana',
- ww: '%d semanas',
- M: 'un mes',
- MM: '%d meses',
- y: 'un año',
- yy: '%d años',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsShortDot$3 =
- 'ene._feb._mar._abr._may._jun._jul._ago._sep._oct._nov._dic.'.split(
- '_'
- ),
- monthsShort$4 = 'ene_feb_mar_abr_may_jun_jul_ago_sep_oct_nov_dic'.split('_'),
- monthsParse$5 = [
- /^ene/i,
- /^feb/i,
- /^mar/i,
- /^abr/i,
- /^may/i,
- /^jun/i,
- /^jul/i,
- /^ago/i,
- /^sep/i,
- /^oct/i,
- /^nov/i,
- /^dic/i,
- ],
- monthsRegex$6 =
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre|ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i;
- hooks.defineLocale('es', {
- months: 'enero_febrero_marzo_abril_mayo_junio_julio_agosto_septiembre_octubre_noviembre_diciembre'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortDot$3;
- } else if (/-MMM-/.test(format)) {
- return monthsShort$4[m.month()];
- } else {
- return monthsShortDot$3[m.month()];
- }
- },
- monthsRegex: monthsRegex$6,
- monthsShortRegex: monthsRegex$6,
- monthsStrictRegex:
- /^(enero|febrero|marzo|abril|mayo|junio|julio|agosto|septiembre|octubre|noviembre|diciembre)/i,
- monthsShortStrictRegex:
- /^(ene\.?|feb\.?|mar\.?|abr\.?|may\.?|jun\.?|jul\.?|ago\.?|sep\.?|oct\.?|nov\.?|dic\.?)/i,
- monthsParse: monthsParse$5,
- longMonthsParse: monthsParse$5,
- shortMonthsParse: monthsParse$5,
- weekdays: 'domingo_lunes_martes_miércoles_jueves_viernes_sábado'.split('_'),
- weekdaysShort: 'dom._lun._mar._mié._jue._vie._sáb.'.split('_'),
- weekdaysMin: 'do_lu_ma_mi_ju_vi_sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY H:mm',
- LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
- },
- calendar: {
- sameDay: function () {
- return '[hoy a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextDay: function () {
- return '[mañana a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- nextWeek: function () {
- return 'dddd [a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastDay: function () {
- return '[ayer a la' + (this.hours() !== 1 ? 's' : '') + '] LT';
- },
- lastWeek: function () {
- return (
- '[el] dddd [pasado a la' +
- (this.hours() !== 1 ? 's' : '') +
- '] LT'
- );
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'en %s',
- past: 'hace %s',
- s: 'unos segundos',
- ss: '%d segundos',
- m: 'un minuto',
- mm: '%d minutos',
- h: 'una hora',
- hh: '%d horas',
- d: 'un día',
- dd: '%d días',
- w: 'una semana',
- ww: '%d semanas',
- M: 'un mes',
- MM: '%d meses',
- y: 'un año',
- yy: '%d años',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- invalidDate: 'Fecha inválida',
- });
- //! moment.js locale configuration
- function processRelativeTime$3(number, withoutSuffix, key, isFuture) {
- var format = {
- s: ['mõne sekundi', 'mõni sekund', 'paar sekundit'],
- ss: [number + 'sekundi', number + 'sekundit'],
- m: ['ühe minuti', 'üks minut'],
- mm: [number + ' minuti', number + ' minutit'],
- h: ['ühe tunni', 'tund aega', 'üks tund'],
- hh: [number + ' tunni', number + ' tundi'],
- d: ['ühe päeva', 'üks päev'],
- M: ['kuu aja', 'kuu aega', 'üks kuu'],
- MM: [number + ' kuu', number + ' kuud'],
- y: ['ühe aasta', 'aasta', 'üks aasta'],
- yy: [number + ' aasta', number + ' aastat'],
- };
- if (withoutSuffix) {
- return format[key][2] ? format[key][2] : format[key][1];
- }
- return isFuture ? format[key][0] : format[key][1];
- }
- hooks.defineLocale('et', {
- months: 'jaanuar_veebruar_märts_aprill_mai_juuni_juuli_august_september_oktoober_november_detsember'.split(
- '_'
- ),
- monthsShort:
- 'jaan_veebr_märts_apr_mai_juuni_juuli_aug_sept_okt_nov_dets'.split('_'),
- weekdays:
- 'pühapäev_esmaspäev_teisipäev_kolmapäev_neljapäev_reede_laupäev'.split(
- '_'
- ),
- weekdaysShort: 'P_E_T_K_N_R_L'.split('_'),
- weekdaysMin: 'P_E_T_K_N_R_L'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd, D. MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[Täna,] LT',
- nextDay: '[Homme,] LT',
- nextWeek: '[Järgmine] dddd LT',
- lastDay: '[Eile,] LT',
- lastWeek: '[Eelmine] dddd LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s pärast',
- past: '%s tagasi',
- s: processRelativeTime$3,
- ss: processRelativeTime$3,
- m: processRelativeTime$3,
- mm: processRelativeTime$3,
- h: processRelativeTime$3,
- hh: processRelativeTime$3,
- d: processRelativeTime$3,
- dd: '%d päeva',
- M: processRelativeTime$3,
- MM: processRelativeTime$3,
- y: processRelativeTime$3,
- yy: processRelativeTime$3,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('eu', {
- months: 'urtarrila_otsaila_martxoa_apirila_maiatza_ekaina_uztaila_abuztua_iraila_urria_azaroa_abendua'.split(
- '_'
- ),
- monthsShort:
- 'urt._ots._mar._api._mai._eka._uzt._abu._ira._urr._aza._abe.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays:
- 'igandea_astelehena_asteartea_asteazkena_osteguna_ostirala_larunbata'.split(
- '_'
- ),
- weekdaysShort: 'ig._al._ar._az._og._ol._lr.'.split('_'),
- weekdaysMin: 'ig_al_ar_az_og_ol_lr'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: 'YYYY[ko] MMMM[ren] D[a]',
- LLL: 'YYYY[ko] MMMM[ren] D[a] HH:mm',
- LLLL: 'dddd, YYYY[ko] MMMM[ren] D[a] HH:mm',
- l: 'YYYY-M-D',
- ll: 'YYYY[ko] MMM D[a]',
- lll: 'YYYY[ko] MMM D[a] HH:mm',
- llll: 'ddd, YYYY[ko] MMM D[a] HH:mm',
- },
- calendar: {
- sameDay: '[gaur] LT[etan]',
- nextDay: '[bihar] LT[etan]',
- nextWeek: 'dddd LT[etan]',
- lastDay: '[atzo] LT[etan]',
- lastWeek: '[aurreko] dddd LT[etan]',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s barru',
- past: 'duela %s',
- s: 'segundo batzuk',
- ss: '%d segundo',
- m: 'minutu bat',
- mm: '%d minutu',
- h: 'ordu bat',
- hh: '%d ordu',
- d: 'egun bat',
- dd: '%d egun',
- M: 'hilabete bat',
- MM: '%d hilabete',
- y: 'urte bat',
- yy: '%d urte',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$6 = {
- 1: '۱',
- 2: '۲',
- 3: '۳',
- 4: '۴',
- 5: '۵',
- 6: '۶',
- 7: '۷',
- 8: '۸',
- 9: '۹',
- 0: '۰',
- },
- numberMap$5 = {
- '۱': '1',
- '۲': '2',
- '۳': '3',
- '۴': '4',
- '۵': '5',
- '۶': '6',
- '۷': '7',
- '۸': '8',
- '۹': '9',
- '۰': '0',
- };
- hooks.defineLocale('fa', {
- months: 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split(
- '_'
- ),
- monthsShort:
- 'ژانویه_فوریه_مارس_آوریل_مه_ژوئن_ژوئیه_اوت_سپتامبر_اکتبر_نوامبر_دسامبر'.split(
- '_'
- ),
- weekdays:
- 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split(
- '_'
- ),
- weekdaysShort:
- 'یک\u200cشنبه_دوشنبه_سه\u200cشنبه_چهارشنبه_پنج\u200cشنبه_جمعه_شنبه'.split(
- '_'
- ),
- weekdaysMin: 'ی_د_س_چ_پ_ج_ش'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- meridiemParse: /قبل از ظهر|بعد از ظهر/,
- isPM: function (input) {
- return /بعد از ظهر/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'قبل از ظهر';
- } else {
- return 'بعد از ظهر';
- }
- },
- calendar: {
- sameDay: '[امروز ساعت] LT',
- nextDay: '[فردا ساعت] LT',
- nextWeek: 'dddd [ساعت] LT',
- lastDay: '[دیروز ساعت] LT',
- lastWeek: 'dddd [پیش] [ساعت] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'در %s',
- past: '%s پیش',
- s: 'چند ثانیه',
- ss: '%d ثانیه',
- m: 'یک دقیقه',
- mm: '%d دقیقه',
- h: 'یک ساعت',
- hh: '%d ساعت',
- d: 'یک روز',
- dd: '%d روز',
- M: 'یک ماه',
- MM: '%d ماه',
- y: 'یک سال',
- yy: '%d سال',
- },
- preparse: function (string) {
- return string
- .replace(/[۰-۹]/g, function (match) {
- return numberMap$5[match];
- })
- .replace(/،/g, ',');
- },
- postformat: function (string) {
- return string
- .replace(/\d/g, function (match) {
- return symbolMap$6[match];
- })
- .replace(/,/g, '،');
- },
- dayOfMonthOrdinalParse: /\d{1,2}م/,
- ordinal: '%dم',
- week: {
- dow: 6, // Saturday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var numbersPast =
- 'nolla yksi kaksi kolme neljä viisi kuusi seitsemän kahdeksan yhdeksän'.split(
- ' '
- ),
- numbersFuture = [
- 'nolla',
- 'yhden',
- 'kahden',
- 'kolmen',
- 'neljän',
- 'viiden',
- 'kuuden',
- numbersPast[7],
- numbersPast[8],
- numbersPast[9],
- ];
- function translate$2(number, withoutSuffix, key, isFuture) {
- var result = '';
- switch (key) {
- case 's':
- return isFuture ? 'muutaman sekunnin' : 'muutama sekunti';
- case 'ss':
- result = isFuture ? 'sekunnin' : 'sekuntia';
- break;
- case 'm':
- return isFuture ? 'minuutin' : 'minuutti';
- case 'mm':
- result = isFuture ? 'minuutin' : 'minuuttia';
- break;
- case 'h':
- return isFuture ? 'tunnin' : 'tunti';
- case 'hh':
- result = isFuture ? 'tunnin' : 'tuntia';
- break;
- case 'd':
- return isFuture ? 'päivän' : 'päivä';
- case 'dd':
- result = isFuture ? 'päivän' : 'päivää';
- break;
- case 'M':
- return isFuture ? 'kuukauden' : 'kuukausi';
- case 'MM':
- result = isFuture ? 'kuukauden' : 'kuukautta';
- break;
- case 'y':
- return isFuture ? 'vuoden' : 'vuosi';
- case 'yy':
- result = isFuture ? 'vuoden' : 'vuotta';
- break;
- }
- result = verbalNumber(number, isFuture) + ' ' + result;
- return result;
- }
- function verbalNumber(number, isFuture) {
- return number < 10
- ? isFuture
- ? numbersFuture[number]
- : numbersPast[number]
- : number;
- }
- hooks.defineLocale('fi', {
- months: 'tammikuu_helmikuu_maaliskuu_huhtikuu_toukokuu_kesäkuu_heinäkuu_elokuu_syyskuu_lokakuu_marraskuu_joulukuu'.split(
- '_'
- ),
- monthsShort:
- 'tammi_helmi_maalis_huhti_touko_kesä_heinä_elo_syys_loka_marras_joulu'.split(
- '_'
- ),
- weekdays:
- 'sunnuntai_maanantai_tiistai_keskiviikko_torstai_perjantai_lauantai'.split(
- '_'
- ),
- weekdaysShort: 'su_ma_ti_ke_to_pe_la'.split('_'),
- weekdaysMin: 'su_ma_ti_ke_to_pe_la'.split('_'),
- longDateFormat: {
- LT: 'HH.mm',
- LTS: 'HH.mm.ss',
- L: 'DD.MM.YYYY',
- LL: 'Do MMMM[ta] YYYY',
- LLL: 'Do MMMM[ta] YYYY, [klo] HH.mm',
- LLLL: 'dddd, Do MMMM[ta] YYYY, [klo] HH.mm',
- l: 'D.M.YYYY',
- ll: 'Do MMM YYYY',
- lll: 'Do MMM YYYY, [klo] HH.mm',
- llll: 'ddd, Do MMM YYYY, [klo] HH.mm',
- },
- calendar: {
- sameDay: '[tänään] [klo] LT',
- nextDay: '[huomenna] [klo] LT',
- nextWeek: 'dddd [klo] LT',
- lastDay: '[eilen] [klo] LT',
- lastWeek: '[viime] dddd[na] [klo] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s päästä',
- past: '%s sitten',
- s: translate$2,
- ss: translate$2,
- m: translate$2,
- mm: translate$2,
- h: translate$2,
- hh: translate$2,
- d: translate$2,
- dd: translate$2,
- M: translate$2,
- MM: translate$2,
- y: translate$2,
- yy: translate$2,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('fil', {
- months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split(
- '_'
- ),
- monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
- weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split(
- '_'
- ),
- weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
- weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'MM/D/YYYY',
- LL: 'MMMM D, YYYY',
- LLL: 'MMMM D, YYYY HH:mm',
- LLLL: 'dddd, MMMM DD, YYYY HH:mm',
- },
- calendar: {
- sameDay: 'LT [ngayong araw]',
- nextDay: '[Bukas ng] LT',
- nextWeek: 'LT [sa susunod na] dddd',
- lastDay: 'LT [kahapon]',
- lastWeek: 'LT [noong nakaraang] dddd',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'sa loob ng %s',
- past: '%s ang nakalipas',
- s: 'ilang segundo',
- ss: '%d segundo',
- m: 'isang minuto',
- mm: '%d minuto',
- h: 'isang oras',
- hh: '%d oras',
- d: 'isang araw',
- dd: '%d araw',
- M: 'isang buwan',
- MM: '%d buwan',
- y: 'isang taon',
- yy: '%d taon',
- },
- dayOfMonthOrdinalParse: /\d{1,2}/,
- ordinal: function (number) {
- return number;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('fo', {
- months: 'januar_februar_mars_apríl_mai_juni_juli_august_september_oktober_november_desember'.split(
- '_'
- ),
- monthsShort: 'jan_feb_mar_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_'),
- weekdays:
- 'sunnudagur_mánadagur_týsdagur_mikudagur_hósdagur_fríggjadagur_leygardagur'.split(
- '_'
- ),
- weekdaysShort: 'sun_mán_týs_mik_hós_frí_ley'.split('_'),
- weekdaysMin: 'su_má_tý_mi_hó_fr_le'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D. MMMM, YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Í dag kl.] LT',
- nextDay: '[Í morgin kl.] LT',
- nextWeek: 'dddd [kl.] LT',
- lastDay: '[Í gjár kl.] LT',
- lastWeek: '[síðstu] dddd [kl] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'um %s',
- past: '%s síðani',
- s: 'fá sekund',
- ss: '%d sekundir',
- m: 'ein minuttur',
- mm: '%d minuttir',
- h: 'ein tími',
- hh: '%d tímar',
- d: 'ein dagur',
- dd: '%d dagar',
- M: 'ein mánaður',
- MM: '%d mánaðir',
- y: 'eitt ár',
- yy: '%d ár',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('fr-ca', {
- months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
- '_'
- ),
- monthsShort:
- 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
- weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
- weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Aujourd’hui à] LT',
- nextDay: '[Demain à] LT',
- nextWeek: 'dddd [à] LT',
- lastDay: '[Hier à] LT',
- lastWeek: 'dddd [dernier à] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dans %s',
- past: 'il y a %s',
- s: 'quelques secondes',
- ss: '%d secondes',
- m: 'une minute',
- mm: '%d minutes',
- h: 'une heure',
- hh: '%d heures',
- d: 'un jour',
- dd: '%d jours',
- M: 'un mois',
- MM: '%d mois',
- y: 'un an',
- yy: '%d ans',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
- ordinal: function (number, period) {
- switch (period) {
- // Words with masculine grammatical gender: mois, trimestre, jour
- default:
- case 'M':
- case 'Q':
- case 'D':
- case 'DDD':
- case 'd':
- return number + (number === 1 ? 'er' : 'e');
- // Words with feminine grammatical gender: semaine
- case 'w':
- case 'W':
- return number + (number === 1 ? 're' : 'e');
- }
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('fr-ch', {
- months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
- '_'
- ),
- monthsShort:
- 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
- weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
- weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Aujourd’hui à] LT',
- nextDay: '[Demain à] LT',
- nextWeek: 'dddd [à] LT',
- lastDay: '[Hier à] LT',
- lastWeek: 'dddd [dernier à] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dans %s',
- past: 'il y a %s',
- s: 'quelques secondes',
- ss: '%d secondes',
- m: 'une minute',
- mm: '%d minutes',
- h: 'une heure',
- hh: '%d heures',
- d: 'un jour',
- dd: '%d jours',
- M: 'un mois',
- MM: '%d mois',
- y: 'un an',
- yy: '%d ans',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(er|e)/,
- ordinal: function (number, period) {
- switch (period) {
- // Words with masculine grammatical gender: mois, trimestre, jour
- default:
- case 'M':
- case 'Q':
- case 'D':
- case 'DDD':
- case 'd':
- return number + (number === 1 ? 'er' : 'e');
- // Words with feminine grammatical gender: semaine
- case 'w':
- case 'W':
- return number + (number === 1 ? 're' : 'e');
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsStrictRegex$1 =
- /^(janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,
- monthsShortStrictRegex$1 =
- /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?)/i,
- monthsRegex$7 =
- /(janv\.?|févr\.?|mars|avr\.?|mai|juin|juil\.?|août|sept\.?|oct\.?|nov\.?|déc\.?|janvier|février|mars|avril|mai|juin|juillet|août|septembre|octobre|novembre|décembre)/i,
- monthsParse$6 = [
- /^janv/i,
- /^févr/i,
- /^mars/i,
- /^avr/i,
- /^mai/i,
- /^juin/i,
- /^juil/i,
- /^août/i,
- /^sept/i,
- /^oct/i,
- /^nov/i,
- /^déc/i,
- ];
- hooks.defineLocale('fr', {
- months: 'janvier_février_mars_avril_mai_juin_juillet_août_septembre_octobre_novembre_décembre'.split(
- '_'
- ),
- monthsShort:
- 'janv._févr._mars_avr._mai_juin_juil._août_sept._oct._nov._déc.'.split(
- '_'
- ),
- monthsRegex: monthsRegex$7,
- monthsShortRegex: monthsRegex$7,
- monthsStrictRegex: monthsStrictRegex$1,
- monthsShortStrictRegex: monthsShortStrictRegex$1,
- monthsParse: monthsParse$6,
- longMonthsParse: monthsParse$6,
- shortMonthsParse: monthsParse$6,
- weekdays: 'dimanche_lundi_mardi_mercredi_jeudi_vendredi_samedi'.split('_'),
- weekdaysShort: 'dim._lun._mar._mer._jeu._ven._sam.'.split('_'),
- weekdaysMin: 'di_lu_ma_me_je_ve_sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Aujourd’hui à] LT',
- nextDay: '[Demain à] LT',
- nextWeek: 'dddd [à] LT',
- lastDay: '[Hier à] LT',
- lastWeek: 'dddd [dernier à] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dans %s',
- past: 'il y a %s',
- s: 'quelques secondes',
- ss: '%d secondes',
- m: 'une minute',
- mm: '%d minutes',
- h: 'une heure',
- hh: '%d heures',
- d: 'un jour',
- dd: '%d jours',
- w: 'une semaine',
- ww: '%d semaines',
- M: 'un mois',
- MM: '%d mois',
- y: 'un an',
- yy: '%d ans',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(er|)/,
- ordinal: function (number, period) {
- switch (period) {
- // TODO: Return 'e' when day of month > 1. Move this case inside
- // block for masculine words below.
- // See https://github.com/moment/moment/issues/3375
- case 'D':
- return number + (number === 1 ? 'er' : '');
- // Words with masculine grammatical gender: mois, trimestre, jour
- default:
- case 'M':
- case 'Q':
- case 'DDD':
- case 'd':
- return number + (number === 1 ? 'er' : 'e');
- // Words with feminine grammatical gender: semaine
- case 'w':
- case 'W':
- return number + (number === 1 ? 're' : 'e');
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsShortWithDots =
- 'jan._feb._mrt._apr._mai_jun._jul._aug._sep._okt._nov._des.'.split('_'),
- monthsShortWithoutDots =
- 'jan_feb_mrt_apr_mai_jun_jul_aug_sep_okt_nov_des'.split('_');
- hooks.defineLocale('fy', {
- months: 'jannewaris_febrewaris_maart_april_maaie_juny_july_augustus_septimber_oktober_novimber_desimber'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortWithDots;
- } else if (/-MMM-/.test(format)) {
- return monthsShortWithoutDots[m.month()];
- } else {
- return monthsShortWithDots[m.month()];
- }
- },
- monthsParseExact: true,
- weekdays: 'snein_moandei_tiisdei_woansdei_tongersdei_freed_sneon'.split(
- '_'
- ),
- weekdaysShort: 'si._mo._ti._wo._to._fr._so.'.split('_'),
- weekdaysMin: 'Si_Mo_Ti_Wo_To_Fr_So'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD-MM-YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[hjoed om] LT',
- nextDay: '[moarn om] LT',
- nextWeek: 'dddd [om] LT',
- lastDay: '[juster om] LT',
- lastWeek: '[ôfrûne] dddd [om] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'oer %s',
- past: '%s lyn',
- s: 'in pear sekonden',
- ss: '%d sekonden',
- m: 'ien minút',
- mm: '%d minuten',
- h: 'ien oere',
- hh: '%d oeren',
- d: 'ien dei',
- dd: '%d dagen',
- M: 'ien moanne',
- MM: '%d moannen',
- y: 'ien jier',
- yy: '%d jierren',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
- ordinal: function (number) {
- return (
- number +
- (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
- );
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var months$6 = [
- 'Eanáir',
- 'Feabhra',
- 'Márta',
- 'Aibreán',
- 'Bealtaine',
- 'Meitheamh',
- 'Iúil',
- 'Lúnasa',
- 'Meán Fómhair',
- 'Deireadh Fómhair',
- 'Samhain',
- 'Nollaig',
- ],
- monthsShort$5 = [
- 'Ean',
- 'Feabh',
- 'Márt',
- 'Aib',
- 'Beal',
- 'Meith',
- 'Iúil',
- 'Lún',
- 'M.F.',
- 'D.F.',
- 'Samh',
- 'Noll',
- ],
- weekdays$1 = [
- 'Dé Domhnaigh',
- 'Dé Luain',
- 'Dé Máirt',
- 'Dé Céadaoin',
- 'Déardaoin',
- 'Dé hAoine',
- 'Dé Sathairn',
- ],
- weekdaysShort = ['Domh', 'Luan', 'Máirt', 'Céad', 'Déar', 'Aoine', 'Sath'],
- weekdaysMin = ['Do', 'Lu', 'Má', 'Cé', 'Dé', 'A', 'Sa'];
- hooks.defineLocale('ga', {
- months: months$6,
- monthsShort: monthsShort$5,
- monthsParseExact: true,
- weekdays: weekdays$1,
- weekdaysShort: weekdaysShort,
- weekdaysMin: weekdaysMin,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Inniu ag] LT',
- nextDay: '[Amárach ag] LT',
- nextWeek: 'dddd [ag] LT',
- lastDay: '[Inné ag] LT',
- lastWeek: 'dddd [seo caite] [ag] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'i %s',
- past: '%s ó shin',
- s: 'cúpla soicind',
- ss: '%d soicind',
- m: 'nóiméad',
- mm: '%d nóiméad',
- h: 'uair an chloig',
- hh: '%d uair an chloig',
- d: 'lá',
- dd: '%d lá',
- M: 'mí',
- MM: '%d míonna',
- y: 'bliain',
- yy: '%d bliain',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/,
- ordinal: function (number) {
- var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var months$7 = [
- 'Am Faoilleach',
- 'An Gearran',
- 'Am Màrt',
- 'An Giblean',
- 'An Cèitean',
- 'An t-Ògmhios',
- 'An t-Iuchar',
- 'An Lùnastal',
- 'An t-Sultain',
- 'An Dàmhair',
- 'An t-Samhain',
- 'An Dùbhlachd',
- ],
- monthsShort$6 = [
- 'Faoi',
- 'Gear',
- 'Màrt',
- 'Gibl',
- 'Cèit',
- 'Ògmh',
- 'Iuch',
- 'Lùn',
- 'Sult',
- 'Dàmh',
- 'Samh',
- 'Dùbh',
- ],
- weekdays$2 = [
- 'Didòmhnaich',
- 'Diluain',
- 'Dimàirt',
- 'Diciadain',
- 'Diardaoin',
- 'Dihaoine',
- 'Disathairne',
- ],
- weekdaysShort$1 = ['Did', 'Dil', 'Dim', 'Dic', 'Dia', 'Dih', 'Dis'],
- weekdaysMin$1 = ['Dò', 'Lu', 'Mà', 'Ci', 'Ar', 'Ha', 'Sa'];
- hooks.defineLocale('gd', {
- months: months$7,
- monthsShort: monthsShort$6,
- monthsParseExact: true,
- weekdays: weekdays$2,
- weekdaysShort: weekdaysShort$1,
- weekdaysMin: weekdaysMin$1,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[An-diugh aig] LT',
- nextDay: '[A-màireach aig] LT',
- nextWeek: 'dddd [aig] LT',
- lastDay: '[An-dè aig] LT',
- lastWeek: 'dddd [seo chaidh] [aig] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'ann an %s',
- past: 'bho chionn %s',
- s: 'beagan diogan',
- ss: '%d diogan',
- m: 'mionaid',
- mm: '%d mionaidean',
- h: 'uair',
- hh: '%d uairean',
- d: 'latha',
- dd: '%d latha',
- M: 'mìos',
- MM: '%d mìosan',
- y: 'bliadhna',
- yy: '%d bliadhna',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(d|na|mh)/,
- ordinal: function (number) {
- var output = number === 1 ? 'd' : number % 10 === 2 ? 'na' : 'mh';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('gl', {
- months: 'xaneiro_febreiro_marzo_abril_maio_xuño_xullo_agosto_setembro_outubro_novembro_decembro'.split(
- '_'
- ),
- monthsShort:
- 'xan._feb._mar._abr._mai._xuñ._xul._ago._set._out._nov._dec.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'domingo_luns_martes_mércores_xoves_venres_sábado'.split('_'),
- weekdaysShort: 'dom._lun._mar._mér._xov._ven._sáb.'.split('_'),
- weekdaysMin: 'do_lu_ma_mé_xo_ve_sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY H:mm',
- LLLL: 'dddd, D [de] MMMM [de] YYYY H:mm',
- },
- calendar: {
- sameDay: function () {
- return '[hoxe ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT';
- },
- nextDay: function () {
- return '[mañá ' + (this.hours() !== 1 ? 'ás' : 'á') + '] LT';
- },
- nextWeek: function () {
- return 'dddd [' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT';
- },
- lastDay: function () {
- return '[onte ' + (this.hours() !== 1 ? 'á' : 'a') + '] LT';
- },
- lastWeek: function () {
- return (
- '[o] dddd [pasado ' + (this.hours() !== 1 ? 'ás' : 'a') + '] LT'
- );
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: function (str) {
- if (str.indexOf('un') === 0) {
- return 'n' + str;
- }
- return 'en ' + str;
- },
- past: 'hai %s',
- s: 'uns segundos',
- ss: '%d segundos',
- m: 'un minuto',
- mm: '%d minutos',
- h: 'unha hora',
- hh: '%d horas',
- d: 'un día',
- dd: '%d días',
- M: 'un mes',
- MM: '%d meses',
- y: 'un ano',
- yy: '%d anos',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function processRelativeTime$4(number, withoutSuffix, key, isFuture) {
- var format = {
- s: ['थोडया सॅकंडांनी', 'थोडे सॅकंड'],
- ss: [number + ' सॅकंडांनी', number + ' सॅकंड'],
- m: ['एका मिणटान', 'एक मिनूट'],
- mm: [number + ' मिणटांनी', number + ' मिणटां'],
- h: ['एका वरान', 'एक वर'],
- hh: [number + ' वरांनी', number + ' वरां'],
- d: ['एका दिसान', 'एक दीस'],
- dd: [number + ' दिसांनी', number + ' दीस'],
- M: ['एका म्हयन्यान', 'एक म्हयनो'],
- MM: [number + ' म्हयन्यानी', number + ' म्हयने'],
- y: ['एका वर्सान', 'एक वर्स'],
- yy: [number + ' वर्सांनी', number + ' वर्सां'],
- };
- return isFuture ? format[key][0] : format[key][1];
- }
- hooks.defineLocale('gom-deva', {
- months: {
- standalone:
- 'जानेवारी_फेब्रुवारी_मार्च_एप्रील_मे_जून_जुलय_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split(
- '_'
- ),
- format: 'जानेवारीच्या_फेब्रुवारीच्या_मार्चाच्या_एप्रीलाच्या_मेयाच्या_जूनाच्या_जुलयाच्या_ऑगस्टाच्या_सप्टेंबराच्या_ऑक्टोबराच्या_नोव्हेंबराच्या_डिसेंबराच्या'.split(
- '_'
- ),
- isFormat: /MMMM(\s)+D[oD]?/,
- },
- monthsShort:
- 'जाने._फेब्रु._मार्च_एप्री._मे_जून_जुल._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'आयतार_सोमार_मंगळार_बुधवार_बिरेस्तार_सुक्रार_शेनवार'.split('_'),
- weekdaysShort: 'आयत._सोम._मंगळ._बुध._ब्रेस्त._सुक्र._शेन.'.split('_'),
- weekdaysMin: 'आ_सो_मं_बु_ब्रे_सु_शे'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'A h:mm [वाजतां]',
- LTS: 'A h:mm:ss [वाजतां]',
- L: 'DD-MM-YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY A h:mm [वाजतां]',
- LLLL: 'dddd, MMMM Do, YYYY, A h:mm [वाजतां]',
- llll: 'ddd, D MMM YYYY, A h:mm [वाजतां]',
- },
- calendar: {
- sameDay: '[आयज] LT',
- nextDay: '[फाल्यां] LT',
- nextWeek: '[फुडलो] dddd[,] LT',
- lastDay: '[काल] LT',
- lastWeek: '[फाटलो] dddd[,] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s',
- past: '%s आदीं',
- s: processRelativeTime$4,
- ss: processRelativeTime$4,
- m: processRelativeTime$4,
- mm: processRelativeTime$4,
- h: processRelativeTime$4,
- hh: processRelativeTime$4,
- d: processRelativeTime$4,
- dd: processRelativeTime$4,
- M: processRelativeTime$4,
- MM: processRelativeTime$4,
- y: processRelativeTime$4,
- yy: processRelativeTime$4,
- },
- dayOfMonthOrdinalParse: /\d{1,2}(वेर)/,
- ordinal: function (number, period) {
- switch (period) {
- // the ordinal 'वेर' only applies to day of the month
- case 'D':
- return number + 'वेर';
- default:
- case 'M':
- case 'Q':
- case 'DDD':
- case 'd':
- case 'w':
- case 'W':
- return number;
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week
- doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4)
- },
- meridiemParse: /राती|सकाळीं|दनपारां|सांजे/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'राती') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'सकाळीं') {
- return hour;
- } else if (meridiem === 'दनपारां') {
- return hour > 12 ? hour : hour + 12;
- } else if (meridiem === 'सांजे') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'राती';
- } else if (hour < 12) {
- return 'सकाळीं';
- } else if (hour < 16) {
- return 'दनपारां';
- } else if (hour < 20) {
- return 'सांजे';
- } else {
- return 'राती';
- }
- },
- });
- //! moment.js locale configuration
- function processRelativeTime$5(number, withoutSuffix, key, isFuture) {
- var format = {
- s: ['thoddea sekondamni', 'thodde sekond'],
- ss: [number + ' sekondamni', number + ' sekond'],
- m: ['eka mintan', 'ek minut'],
- mm: [number + ' mintamni', number + ' mintam'],
- h: ['eka voran', 'ek vor'],
- hh: [number + ' voramni', number + ' voram'],
- d: ['eka disan', 'ek dis'],
- dd: [number + ' disamni', number + ' dis'],
- M: ['eka mhoinean', 'ek mhoino'],
- MM: [number + ' mhoineamni', number + ' mhoine'],
- y: ['eka vorsan', 'ek voros'],
- yy: [number + ' vorsamni', number + ' vorsam'],
- };
- return isFuture ? format[key][0] : format[key][1];
- }
- hooks.defineLocale('gom-latn', {
- months: {
- standalone:
- 'Janer_Febrer_Mars_Abril_Mai_Jun_Julai_Agost_Setembr_Otubr_Novembr_Dezembr'.split(
- '_'
- ),
- format: 'Janerachea_Febrerachea_Marsachea_Abrilachea_Maiachea_Junachea_Julaiachea_Agostachea_Setembrachea_Otubrachea_Novembrachea_Dezembrachea'.split(
- '_'
- ),
- isFormat: /MMMM(\s)+D[oD]?/,
- },
- monthsShort:
- 'Jan._Feb._Mars_Abr._Mai_Jun_Jul._Ago._Set._Otu._Nov._Dez.'.split('_'),
- monthsParseExact: true,
- weekdays: "Aitar_Somar_Mongllar_Budhvar_Birestar_Sukrar_Son'var".split('_'),
- weekdaysShort: 'Ait._Som._Mon._Bud._Bre._Suk._Son.'.split('_'),
- weekdaysMin: 'Ai_Sm_Mo_Bu_Br_Su_Sn'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'A h:mm [vazta]',
- LTS: 'A h:mm:ss [vazta]',
- L: 'DD-MM-YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY A h:mm [vazta]',
- LLLL: 'dddd, MMMM Do, YYYY, A h:mm [vazta]',
- llll: 'ddd, D MMM YYYY, A h:mm [vazta]',
- },
- calendar: {
- sameDay: '[Aiz] LT',
- nextDay: '[Faleam] LT',
- nextWeek: '[Fuddlo] dddd[,] LT',
- lastDay: '[Kal] LT',
- lastWeek: '[Fattlo] dddd[,] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s',
- past: '%s adim',
- s: processRelativeTime$5,
- ss: processRelativeTime$5,
- m: processRelativeTime$5,
- mm: processRelativeTime$5,
- h: processRelativeTime$5,
- hh: processRelativeTime$5,
- d: processRelativeTime$5,
- dd: processRelativeTime$5,
- M: processRelativeTime$5,
- MM: processRelativeTime$5,
- y: processRelativeTime$5,
- yy: processRelativeTime$5,
- },
- dayOfMonthOrdinalParse: /\d{1,2}(er)/,
- ordinal: function (number, period) {
- switch (period) {
- // the ordinal 'er' only applies to day of the month
- case 'D':
- return number + 'er';
- default:
- case 'M':
- case 'Q':
- case 'DDD':
- case 'd':
- case 'w':
- case 'W':
- return number;
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week
- doy: 3, // The week that contains Jan 4th is the first week of the year (7 + 0 - 4)
- },
- meridiemParse: /rati|sokallim|donparam|sanje/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'rati') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'sokallim') {
- return hour;
- } else if (meridiem === 'donparam') {
- return hour > 12 ? hour : hour + 12;
- } else if (meridiem === 'sanje') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'rati';
- } else if (hour < 12) {
- return 'sokallim';
- } else if (hour < 16) {
- return 'donparam';
- } else if (hour < 20) {
- return 'sanje';
- } else {
- return 'rati';
- }
- },
- });
- //! moment.js locale configuration
- var symbolMap$7 = {
- 1: '૧',
- 2: '૨',
- 3: '૩',
- 4: '૪',
- 5: '૫',
- 6: '૬',
- 7: '૭',
- 8: '૮',
- 9: '૯',
- 0: '૦',
- },
- numberMap$6 = {
- '૧': '1',
- '૨': '2',
- '૩': '3',
- '૪': '4',
- '૫': '5',
- '૬': '6',
- '૭': '7',
- '૮': '8',
- '૯': '9',
- '૦': '0',
- };
- hooks.defineLocale('gu', {
- months: 'જાન્યુઆરી_ફેબ્રુઆરી_માર્ચ_એપ્રિલ_મે_જૂન_જુલાઈ_ઑગસ્ટ_સપ્ટેમ્બર_ઑક્ટ્બર_નવેમ્બર_ડિસેમ્બર'.split(
- '_'
- ),
- monthsShort:
- 'જાન્યુ._ફેબ્રુ._માર્ચ_એપ્રિ._મે_જૂન_જુલા._ઑગ._સપ્ટે._ઑક્ટ્._નવે._ડિસે.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'રવિવાર_સોમવાર_મંગળવાર_બુધ્વાર_ગુરુવાર_શુક્રવાર_શનિવાર'.split(
- '_'
- ),
- weekdaysShort: 'રવિ_સોમ_મંગળ_બુધ્_ગુરુ_શુક્ર_શનિ'.split('_'),
- weekdaysMin: 'ર_સો_મં_બુ_ગુ_શુ_શ'.split('_'),
- longDateFormat: {
- LT: 'A h:mm વાગ્યે',
- LTS: 'A h:mm:ss વાગ્યે',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm વાગ્યે',
- LLLL: 'dddd, D MMMM YYYY, A h:mm વાગ્યે',
- },
- calendar: {
- sameDay: '[આજ] LT',
- nextDay: '[કાલે] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[ગઇકાલે] LT',
- lastWeek: '[પાછલા] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s મા',
- past: '%s પહેલા',
- s: 'અમુક પળો',
- ss: '%d સેકંડ',
- m: 'એક મિનિટ',
- mm: '%d મિનિટ',
- h: 'એક કલાક',
- hh: '%d કલાક',
- d: 'એક દિવસ',
- dd: '%d દિવસ',
- M: 'એક મહિનો',
- MM: '%d મહિનો',
- y: 'એક વર્ષ',
- yy: '%d વર્ષ',
- },
- preparse: function (string) {
- return string.replace(/[૧૨૩૪૫૬૭૮૯૦]/g, function (match) {
- return numberMap$6[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$7[match];
- });
- },
- // Gujarati notation for meridiems are quite fuzzy in practice. While there exists
- // a rigid notion of a 'Pahar' it is not used as rigidly in modern Gujarati.
- meridiemParse: /રાત|બપોર|સવાર|સાંજ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'રાત') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'સવાર') {
- return hour;
- } else if (meridiem === 'બપોર') {
- return hour >= 10 ? hour : hour + 12;
- } else if (meridiem === 'સાંજ') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'રાત';
- } else if (hour < 10) {
- return 'સવાર';
- } else if (hour < 17) {
- return 'બપોર';
- } else if (hour < 20) {
- return 'સાંજ';
- } else {
- return 'રાત';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('he', {
- months: 'ינואר_פברואר_מרץ_אפריל_מאי_יוני_יולי_אוגוסט_ספטמבר_אוקטובר_נובמבר_דצמבר'.split(
- '_'
- ),
- monthsShort:
- 'ינו׳_פבר׳_מרץ_אפר׳_מאי_יוני_יולי_אוג׳_ספט׳_אוק׳_נוב׳_דצמ׳'.split('_'),
- weekdays: 'ראשון_שני_שלישי_רביעי_חמישי_שישי_שבת'.split('_'),
- weekdaysShort: 'א׳_ב׳_ג׳_ד׳_ה׳_ו׳_ש׳'.split('_'),
- weekdaysMin: 'א_ב_ג_ד_ה_ו_ש'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [ב]MMMM YYYY',
- LLL: 'D [ב]MMMM YYYY HH:mm',
- LLLL: 'dddd, D [ב]MMMM YYYY HH:mm',
- l: 'D/M/YYYY',
- ll: 'D MMM YYYY',
- lll: 'D MMM YYYY HH:mm',
- llll: 'ddd, D MMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[היום ב־]LT',
- nextDay: '[מחר ב־]LT',
- nextWeek: 'dddd [בשעה] LT',
- lastDay: '[אתמול ב־]LT',
- lastWeek: '[ביום] dddd [האחרון בשעה] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'בעוד %s',
- past: 'לפני %s',
- s: 'מספר שניות',
- ss: '%d שניות',
- m: 'דקה',
- mm: '%d דקות',
- h: 'שעה',
- hh: function (number) {
- if (number === 2) {
- return 'שעתיים';
- }
- return number + ' שעות';
- },
- d: 'יום',
- dd: function (number) {
- if (number === 2) {
- return 'יומיים';
- }
- return number + ' ימים';
- },
- M: 'חודש',
- MM: function (number) {
- if (number === 2) {
- return 'חודשיים';
- }
- return number + ' חודשים';
- },
- y: 'שנה',
- yy: function (number) {
- if (number === 2) {
- return 'שנתיים';
- } else if (number % 10 === 0 && number !== 10) {
- return number + ' שנה';
- }
- return number + ' שנים';
- },
- },
- meridiemParse:
- /אחה"צ|לפנה"צ|אחרי הצהריים|לפני הצהריים|לפנות בוקר|בבוקר|בערב/i,
- isPM: function (input) {
- return /^(אחה"צ|אחרי הצהריים|בערב)$/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 5) {
- return 'לפנות בוקר';
- } else if (hour < 10) {
- return 'בבוקר';
- } else if (hour < 12) {
- return isLower ? 'לפנה"צ' : 'לפני הצהריים';
- } else if (hour < 18) {
- return isLower ? 'אחה"צ' : 'אחרי הצהריים';
- } else {
- return 'בערב';
- }
- },
- });
- //! moment.js locale configuration
- var symbolMap$8 = {
- 1: '१',
- 2: '२',
- 3: '३',
- 4: '४',
- 5: '५',
- 6: '६',
- 7: '७',
- 8: '८',
- 9: '९',
- 0: '०',
- },
- numberMap$7 = {
- '१': '1',
- '२': '2',
- '३': '3',
- '४': '4',
- '५': '5',
- '६': '6',
- '७': '7',
- '८': '8',
- '९': '9',
- '०': '0',
- },
- monthsParse$7 = [
- /^जन/i,
- /^फ़र|फर/i,
- /^मार्च/i,
- /^अप्रै/i,
- /^मई/i,
- /^जून/i,
- /^जुल/i,
- /^अग/i,
- /^सितं|सित/i,
- /^अक्टू/i,
- /^नव|नवं/i,
- /^दिसं|दिस/i,
- ],
- shortMonthsParse = [
- /^जन/i,
- /^फ़र/i,
- /^मार्च/i,
- /^अप्रै/i,
- /^मई/i,
- /^जून/i,
- /^जुल/i,
- /^अग/i,
- /^सित/i,
- /^अक्टू/i,
- /^नव/i,
- /^दिस/i,
- ];
- hooks.defineLocale('hi', {
- months: {
- format: 'जनवरी_फ़रवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितम्बर_अक्टूबर_नवम्बर_दिसम्बर'.split(
- '_'
- ),
- standalone:
- 'जनवरी_फरवरी_मार्च_अप्रैल_मई_जून_जुलाई_अगस्त_सितंबर_अक्टूबर_नवंबर_दिसंबर'.split(
- '_'
- ),
- },
- monthsShort:
- 'जन._फ़र._मार्च_अप्रै._मई_जून_जुल._अग._सित._अक्टू._नव._दिस.'.split('_'),
- weekdays: 'रविवार_सोमवार_मंगलवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
- weekdaysShort: 'रवि_सोम_मंगल_बुध_गुरू_शुक्र_शनि'.split('_'),
- weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'),
- longDateFormat: {
- LT: 'A h:mm बजे',
- LTS: 'A h:mm:ss बजे',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm बजे',
- LLLL: 'dddd, D MMMM YYYY, A h:mm बजे',
- },
- monthsParse: monthsParse$7,
- longMonthsParse: monthsParse$7,
- shortMonthsParse: shortMonthsParse,
- monthsRegex:
- /^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,
- monthsShortRegex:
- /^(जनवरी|जन\.?|फ़रवरी|फरवरी|फ़र\.?|मार्च?|अप्रैल|अप्रै\.?|मई?|जून?|जुलाई|जुल\.?|अगस्त|अग\.?|सितम्बर|सितंबर|सित\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर|नव\.?|दिसम्बर|दिसंबर|दिस\.?)/i,
- monthsStrictRegex:
- /^(जनवरी?|फ़रवरी|फरवरी?|मार्च?|अप्रैल?|मई?|जून?|जुलाई?|अगस्त?|सितम्बर|सितंबर|सित?\.?|अक्टूबर|अक्टू\.?|नवम्बर|नवंबर?|दिसम्बर|दिसंबर?)/i,
- monthsShortStrictRegex:
- /^(जन\.?|फ़र\.?|मार्च?|अप्रै\.?|मई?|जून?|जुल\.?|अग\.?|सित\.?|अक्टू\.?|नव\.?|दिस\.?)/i,
- calendar: {
- sameDay: '[आज] LT',
- nextDay: '[कल] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[कल] LT',
- lastWeek: '[पिछले] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s में',
- past: '%s पहले',
- s: 'कुछ ही क्षण',
- ss: '%d सेकंड',
- m: 'एक मिनट',
- mm: '%d मिनट',
- h: 'एक घंटा',
- hh: '%d घंटे',
- d: 'एक दिन',
- dd: '%d दिन',
- M: 'एक महीने',
- MM: '%d महीने',
- y: 'एक वर्ष',
- yy: '%d वर्ष',
- },
- preparse: function (string) {
- return string.replace(/[१२३४५६७८९०]/g, function (match) {
- return numberMap$7[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$8[match];
- });
- },
- // Hindi notation for meridiems are quite fuzzy in practice. While there exists
- // a rigid notion of a 'Pahar' it is not used as rigidly in modern Hindi.
- meridiemParse: /रात|सुबह|दोपहर|शाम/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'रात') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'सुबह') {
- return hour;
- } else if (meridiem === 'दोपहर') {
- return hour >= 10 ? hour : hour + 12;
- } else if (meridiem === 'शाम') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'रात';
- } else if (hour < 10) {
- return 'सुबह';
- } else if (hour < 17) {
- return 'दोपहर';
- } else if (hour < 20) {
- return 'शाम';
- } else {
- return 'रात';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function translate$3(number, withoutSuffix, key) {
- var result = number + ' ';
- switch (key) {
- case 'ss':
- if (number === 1) {
- result += 'sekunda';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'sekunde';
- } else {
- result += 'sekundi';
- }
- return result;
- case 'm':
- return withoutSuffix ? 'jedna minuta' : 'jedne minute';
- case 'mm':
- if (number === 1) {
- result += 'minuta';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'minute';
- } else {
- result += 'minuta';
- }
- return result;
- case 'h':
- return withoutSuffix ? 'jedan sat' : 'jednog sata';
- case 'hh':
- if (number === 1) {
- result += 'sat';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'sata';
- } else {
- result += 'sati';
- }
- return result;
- case 'dd':
- if (number === 1) {
- result += 'dan';
- } else {
- result += 'dana';
- }
- return result;
- case 'MM':
- if (number === 1) {
- result += 'mjesec';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'mjeseca';
- } else {
- result += 'mjeseci';
- }
- return result;
- case 'yy':
- if (number === 1) {
- result += 'godina';
- } else if (number === 2 || number === 3 || number === 4) {
- result += 'godine';
- } else {
- result += 'godina';
- }
- return result;
- }
- }
- hooks.defineLocale('hr', {
- months: {
- format: 'siječnja_veljače_ožujka_travnja_svibnja_lipnja_srpnja_kolovoza_rujna_listopada_studenoga_prosinca'.split(
- '_'
- ),
- standalone:
- 'siječanj_veljača_ožujak_travanj_svibanj_lipanj_srpanj_kolovoz_rujan_listopad_studeni_prosinac'.split(
- '_'
- ),
- },
- monthsShort:
- 'sij._velj._ožu._tra._svi._lip._srp._kol._ruj._lis._stu._pro.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
- '_'
- ),
- weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
- weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'Do MMMM YYYY',
- LLL: 'Do MMMM YYYY H:mm',
- LLLL: 'dddd, Do MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[danas u] LT',
- nextDay: '[sutra u] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[u] [nedjelju] [u] LT';
- case 3:
- return '[u] [srijedu] [u] LT';
- case 6:
- return '[u] [subotu] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[u] dddd [u] LT';
- }
- },
- lastDay: '[jučer u] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return '[prošlu] [nedjelju] [u] LT';
- case 3:
- return '[prošlu] [srijedu] [u] LT';
- case 6:
- return '[prošle] [subote] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[prošli] dddd [u] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: 'prije %s',
- s: 'par sekundi',
- ss: translate$3,
- m: translate$3,
- mm: translate$3,
- h: translate$3,
- hh: translate$3,
- d: 'dan',
- dd: translate$3,
- M: 'mjesec',
- MM: translate$3,
- y: 'godinu',
- yy: translate$3,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var weekEndings =
- 'vasárnap hétfőn kedden szerdán csütörtökön pénteken szombaton'.split(' ');
- function translate$4(number, withoutSuffix, key, isFuture) {
- var num = number;
- switch (key) {
- case 's':
- return isFuture || withoutSuffix
- ? 'néhány másodperc'
- : 'néhány másodperce';
- case 'ss':
- return num + (isFuture || withoutSuffix)
- ? ' másodperc'
- : ' másodperce';
- case 'm':
- return 'egy' + (isFuture || withoutSuffix ? ' perc' : ' perce');
- case 'mm':
- return num + (isFuture || withoutSuffix ? ' perc' : ' perce');
- case 'h':
- return 'egy' + (isFuture || withoutSuffix ? ' óra' : ' órája');
- case 'hh':
- return num + (isFuture || withoutSuffix ? ' óra' : ' órája');
- case 'd':
- return 'egy' + (isFuture || withoutSuffix ? ' nap' : ' napja');
- case 'dd':
- return num + (isFuture || withoutSuffix ? ' nap' : ' napja');
- case 'M':
- return 'egy' + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
- case 'MM':
- return num + (isFuture || withoutSuffix ? ' hónap' : ' hónapja');
- case 'y':
- return 'egy' + (isFuture || withoutSuffix ? ' év' : ' éve');
- case 'yy':
- return num + (isFuture || withoutSuffix ? ' év' : ' éve');
- }
- return '';
- }
- function week(isFuture) {
- return (
- (isFuture ? '' : '[múlt] ') +
- '[' +
- weekEndings[this.day()] +
- '] LT[-kor]'
- );
- }
- hooks.defineLocale('hu', {
- months: 'január_február_március_április_május_június_július_augusztus_szeptember_október_november_december'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._márc._ápr._máj._jún._júl._aug._szept._okt._nov._dec.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'vasárnap_hétfő_kedd_szerda_csütörtök_péntek_szombat'.split('_'),
- weekdaysShort: 'vas_hét_kedd_sze_csüt_pén_szo'.split('_'),
- weekdaysMin: 'v_h_k_sze_cs_p_szo'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'YYYY.MM.DD.',
- LL: 'YYYY. MMMM D.',
- LLL: 'YYYY. MMMM D. H:mm',
- LLLL: 'YYYY. MMMM D., dddd H:mm',
- },
- meridiemParse: /de|du/i,
- isPM: function (input) {
- return input.charAt(1).toLowerCase() === 'u';
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 12) {
- return isLower === true ? 'de' : 'DE';
- } else {
- return isLower === true ? 'du' : 'DU';
- }
- },
- calendar: {
- sameDay: '[ma] LT[-kor]',
- nextDay: '[holnap] LT[-kor]',
- nextWeek: function () {
- return week.call(this, true);
- },
- lastDay: '[tegnap] LT[-kor]',
- lastWeek: function () {
- return week.call(this, false);
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s múlva',
- past: '%s',
- s: translate$4,
- ss: translate$4,
- m: translate$4,
- mm: translate$4,
- h: translate$4,
- hh: translate$4,
- d: translate$4,
- dd: translate$4,
- M: translate$4,
- MM: translate$4,
- y: translate$4,
- yy: translate$4,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('hy-am', {
- months: {
- format: 'հունվարի_փետրվարի_մարտի_ապրիլի_մայիսի_հունիսի_հուլիսի_օգոստոսի_սեպտեմբերի_հոկտեմբերի_նոյեմբերի_դեկտեմբերի'.split(
- '_'
- ),
- standalone:
- 'հունվար_փետրվար_մարտ_ապրիլ_մայիս_հունիս_հուլիս_օգոստոս_սեպտեմբեր_հոկտեմբեր_նոյեմբեր_դեկտեմբեր'.split(
- '_'
- ),
- },
- monthsShort: 'հնվ_փտր_մրտ_ապր_մյս_հնս_հլս_օգս_սպտ_հկտ_նմբ_դկտ'.split('_'),
- weekdays:
- 'կիրակի_երկուշաբթի_երեքշաբթի_չորեքշաբթի_հինգշաբթի_ուրբաթ_շաբաթ'.split(
- '_'
- ),
- weekdaysShort: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
- weekdaysMin: 'կրկ_երկ_երք_չրք_հնգ_ուրբ_շբթ'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY թ.',
- LLL: 'D MMMM YYYY թ., HH:mm',
- LLLL: 'dddd, D MMMM YYYY թ., HH:mm',
- },
- calendar: {
- sameDay: '[այսօր] LT',
- nextDay: '[վաղը] LT',
- lastDay: '[երեկ] LT',
- nextWeek: function () {
- return 'dddd [օրը ժամը] LT';
- },
- lastWeek: function () {
- return '[անցած] dddd [օրը ժամը] LT';
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s հետո',
- past: '%s առաջ',
- s: 'մի քանի վայրկյան',
- ss: '%d վայրկյան',
- m: 'րոպե',
- mm: '%d րոպե',
- h: 'ժամ',
- hh: '%d ժամ',
- d: 'օր',
- dd: '%d օր',
- M: 'ամիս',
- MM: '%d ամիս',
- y: 'տարի',
- yy: '%d տարի',
- },
- meridiemParse: /գիշերվա|առավոտվա|ցերեկվա|երեկոյան/,
- isPM: function (input) {
- return /^(ցերեկվա|երեկոյան)$/.test(input);
- },
- meridiem: function (hour) {
- if (hour < 4) {
- return 'գիշերվա';
- } else if (hour < 12) {
- return 'առավոտվա';
- } else if (hour < 17) {
- return 'ցերեկվա';
- } else {
- return 'երեկոյան';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}|\d{1,2}-(ին|րդ)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'DDD':
- case 'w':
- case 'W':
- case 'DDDo':
- if (number === 1) {
- return number + '-ին';
- }
- return number + '-րդ';
- default:
- return number;
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('id', {
- months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_November_Desember'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Agt_Sep_Okt_Nov_Des'.split('_'),
- weekdays: 'Minggu_Senin_Selasa_Rabu_Kamis_Jumat_Sabtu'.split('_'),
- weekdaysShort: 'Min_Sen_Sel_Rab_Kam_Jum_Sab'.split('_'),
- weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sb'.split('_'),
- longDateFormat: {
- LT: 'HH.mm',
- LTS: 'HH.mm.ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY [pukul] HH.mm',
- LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
- },
- meridiemParse: /pagi|siang|sore|malam/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'pagi') {
- return hour;
- } else if (meridiem === 'siang') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === 'sore' || meridiem === 'malam') {
- return hour + 12;
- }
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 11) {
- return 'pagi';
- } else if (hours < 15) {
- return 'siang';
- } else if (hours < 19) {
- return 'sore';
- } else {
- return 'malam';
- }
- },
- calendar: {
- sameDay: '[Hari ini pukul] LT',
- nextDay: '[Besok pukul] LT',
- nextWeek: 'dddd [pukul] LT',
- lastDay: '[Kemarin pukul] LT',
- lastWeek: 'dddd [lalu pukul] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dalam %s',
- past: '%s yang lalu',
- s: 'beberapa detik',
- ss: '%d detik',
- m: 'semenit',
- mm: '%d menit',
- h: 'sejam',
- hh: '%d jam',
- d: 'sehari',
- dd: '%d hari',
- M: 'sebulan',
- MM: '%d bulan',
- y: 'setahun',
- yy: '%d tahun',
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function plural$2(n) {
- if (n % 100 === 11) {
- return true;
- } else if (n % 10 === 1) {
- return false;
- }
- return true;
- }
- function translate$5(number, withoutSuffix, key, isFuture) {
- var result = number + ' ';
- switch (key) {
- case 's':
- return withoutSuffix || isFuture
- ? 'nokkrar sekúndur'
- : 'nokkrum sekúndum';
- case 'ss':
- if (plural$2(number)) {
- return (
- result +
- (withoutSuffix || isFuture ? 'sekúndur' : 'sekúndum')
- );
- }
- return result + 'sekúnda';
- case 'm':
- return withoutSuffix ? 'mínúta' : 'mínútu';
- case 'mm':
- if (plural$2(number)) {
- return (
- result + (withoutSuffix || isFuture ? 'mínútur' : 'mínútum')
- );
- } else if (withoutSuffix) {
- return result + 'mínúta';
- }
- return result + 'mínútu';
- case 'hh':
- if (plural$2(number)) {
- return (
- result +
- (withoutSuffix || isFuture
- ? 'klukkustundir'
- : 'klukkustundum')
- );
- }
- return result + 'klukkustund';
- case 'd':
- if (withoutSuffix) {
- return 'dagur';
- }
- return isFuture ? 'dag' : 'degi';
- case 'dd':
- if (plural$2(number)) {
- if (withoutSuffix) {
- return result + 'dagar';
- }
- return result + (isFuture ? 'daga' : 'dögum');
- } else if (withoutSuffix) {
- return result + 'dagur';
- }
- return result + (isFuture ? 'dag' : 'degi');
- case 'M':
- if (withoutSuffix) {
- return 'mánuður';
- }
- return isFuture ? 'mánuð' : 'mánuði';
- case 'MM':
- if (plural$2(number)) {
- if (withoutSuffix) {
- return result + 'mánuðir';
- }
- return result + (isFuture ? 'mánuði' : 'mánuðum');
- } else if (withoutSuffix) {
- return result + 'mánuður';
- }
- return result + (isFuture ? 'mánuð' : 'mánuði');
- case 'y':
- return withoutSuffix || isFuture ? 'ár' : 'ári';
- case 'yy':
- if (plural$2(number)) {
- return result + (withoutSuffix || isFuture ? 'ár' : 'árum');
- }
- return result + (withoutSuffix || isFuture ? 'ár' : 'ári');
- }
- }
- hooks.defineLocale('is', {
- months: 'janúar_febrúar_mars_apríl_maí_júní_júlí_ágúst_september_október_nóvember_desember'.split(
- '_'
- ),
- monthsShort: 'jan_feb_mar_apr_maí_jún_júl_ágú_sep_okt_nóv_des'.split('_'),
- weekdays:
- 'sunnudagur_mánudagur_þriðjudagur_miðvikudagur_fimmtudagur_föstudagur_laugardagur'.split(
- '_'
- ),
- weekdaysShort: 'sun_mán_þri_mið_fim_fös_lau'.split('_'),
- weekdaysMin: 'Su_Má_Þr_Mi_Fi_Fö_La'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY [kl.] H:mm',
- LLLL: 'dddd, D. MMMM YYYY [kl.] H:mm',
- },
- calendar: {
- sameDay: '[í dag kl.] LT',
- nextDay: '[á morgun kl.] LT',
- nextWeek: 'dddd [kl.] LT',
- lastDay: '[í gær kl.] LT',
- lastWeek: '[síðasta] dddd [kl.] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'eftir %s',
- past: 'fyrir %s síðan',
- s: translate$5,
- ss: translate$5,
- m: translate$5,
- mm: translate$5,
- h: 'klukkustund',
- hh: translate$5,
- d: translate$5,
- dd: translate$5,
- M: translate$5,
- MM: translate$5,
- y: translate$5,
- yy: translate$5,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('it-ch', {
- months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split(
- '_'
- ),
- monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
- weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split(
- '_'
- ),
- weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'),
- weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Oggi alle] LT',
- nextDay: '[Domani alle] LT',
- nextWeek: 'dddd [alle] LT',
- lastDay: '[Ieri alle] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return '[la scorsa] dddd [alle] LT';
- default:
- return '[lo scorso] dddd [alle] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: function (s) {
- return (/^[0-9].+$/.test(s) ? 'tra' : 'in') + ' ' + s;
- },
- past: '%s fa',
- s: 'alcuni secondi',
- ss: '%d secondi',
- m: 'un minuto',
- mm: '%d minuti',
- h: "un'ora",
- hh: '%d ore',
- d: 'un giorno',
- dd: '%d giorni',
- M: 'un mese',
- MM: '%d mesi',
- y: 'un anno',
- yy: '%d anni',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('it', {
- months: 'gennaio_febbraio_marzo_aprile_maggio_giugno_luglio_agosto_settembre_ottobre_novembre_dicembre'.split(
- '_'
- ),
- monthsShort: 'gen_feb_mar_apr_mag_giu_lug_ago_set_ott_nov_dic'.split('_'),
- weekdays: 'domenica_lunedì_martedì_mercoledì_giovedì_venerdì_sabato'.split(
- '_'
- ),
- weekdaysShort: 'dom_lun_mar_mer_gio_ven_sab'.split('_'),
- weekdaysMin: 'do_lu_ma_me_gi_ve_sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: function () {
- return (
- '[Oggi a' +
- (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
- ']LT'
- );
- },
- nextDay: function () {
- return (
- '[Domani a' +
- (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
- ']LT'
- );
- },
- nextWeek: function () {
- return (
- 'dddd [a' +
- (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
- ']LT'
- );
- },
- lastDay: function () {
- return (
- '[Ieri a' +
- (this.hours() > 1 ? 'lle ' : this.hours() === 0 ? ' ' : "ll'") +
- ']LT'
- );
- },
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return (
- '[La scorsa] dddd [a' +
- (this.hours() > 1
- ? 'lle '
- : this.hours() === 0
- ? ' '
- : "ll'") +
- ']LT'
- );
- default:
- return (
- '[Lo scorso] dddd [a' +
- (this.hours() > 1
- ? 'lle '
- : this.hours() === 0
- ? ' '
- : "ll'") +
- ']LT'
- );
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'tra %s',
- past: '%s fa',
- s: 'alcuni secondi',
- ss: '%d secondi',
- m: 'un minuto',
- mm: '%d minuti',
- h: "un'ora",
- hh: '%d ore',
- d: 'un giorno',
- dd: '%d giorni',
- w: 'una settimana',
- ww: '%d settimane',
- M: 'un mese',
- MM: '%d mesi',
- y: 'un anno',
- yy: '%d anni',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ja', {
- eras: [
- {
- since: '2019-05-01',
- offset: 1,
- name: '令和',
- narrow: '㋿',
- abbr: 'R',
- },
- {
- since: '1989-01-08',
- until: '2019-04-30',
- offset: 1,
- name: '平成',
- narrow: '㍻',
- abbr: 'H',
- },
- {
- since: '1926-12-25',
- until: '1989-01-07',
- offset: 1,
- name: '昭和',
- narrow: '㍼',
- abbr: 'S',
- },
- {
- since: '1912-07-30',
- until: '1926-12-24',
- offset: 1,
- name: '大正',
- narrow: '㍽',
- abbr: 'T',
- },
- {
- since: '1873-01-01',
- until: '1912-07-29',
- offset: 6,
- name: '明治',
- narrow: '㍾',
- abbr: 'M',
- },
- {
- since: '0001-01-01',
- until: '1873-12-31',
- offset: 1,
- name: '西暦',
- narrow: 'AD',
- abbr: 'AD',
- },
- {
- since: '0000-12-31',
- until: -Infinity,
- offset: 1,
- name: '紀元前',
- narrow: 'BC',
- abbr: 'BC',
- },
- ],
- eraYearOrdinalRegex: /(元|\d+)年/,
- eraYearOrdinalParse: function (input, match) {
- return match[1] === '元' ? 1 : parseInt(match[1] || input, 10);
- },
- months: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split('_'),
- monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
- '_'
- ),
- weekdays: '日曜日_月曜日_火曜日_水曜日_木曜日_金曜日_土曜日'.split('_'),
- weekdaysShort: '日_月_火_水_木_金_土'.split('_'),
- weekdaysMin: '日_月_火_水_木_金_土'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY/MM/DD',
- LL: 'YYYY年M月D日',
- LLL: 'YYYY年M月D日 HH:mm',
- LLLL: 'YYYY年M月D日 dddd HH:mm',
- l: 'YYYY/MM/DD',
- ll: 'YYYY年M月D日',
- lll: 'YYYY年M月D日 HH:mm',
- llll: 'YYYY年M月D日(ddd) HH:mm',
- },
- meridiemParse: /午前|午後/i,
- isPM: function (input) {
- return input === '午後';
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return '午前';
- } else {
- return '午後';
- }
- },
- calendar: {
- sameDay: '[今日] LT',
- nextDay: '[明日] LT',
- nextWeek: function (now) {
- if (now.week() !== this.week()) {
- return '[来週]dddd LT';
- } else {
- return 'dddd LT';
- }
- },
- lastDay: '[昨日] LT',
- lastWeek: function (now) {
- if (this.week() !== now.week()) {
- return '[先週]dddd LT';
- } else {
- return 'dddd LT';
- }
- },
- sameElse: 'L',
- },
- dayOfMonthOrdinalParse: /\d{1,2}日/,
- ordinal: function (number, period) {
- switch (period) {
- case 'y':
- return number === 1 ? '元年' : number + '年';
- case 'd':
- case 'D':
- case 'DDD':
- return number + '日';
- default:
- return number;
- }
- },
- relativeTime: {
- future: '%s後',
- past: '%s前',
- s: '数秒',
- ss: '%d秒',
- m: '1分',
- mm: '%d分',
- h: '1時間',
- hh: '%d時間',
- d: '1日',
- dd: '%d日',
- M: '1ヶ月',
- MM: '%dヶ月',
- y: '1年',
- yy: '%d年',
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('jv', {
- months: 'Januari_Februari_Maret_April_Mei_Juni_Juli_Agustus_September_Oktober_Nopember_Desember'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mar_Apr_Mei_Jun_Jul_Ags_Sep_Okt_Nop_Des'.split('_'),
- weekdays: 'Minggu_Senen_Seloso_Rebu_Kemis_Jemuwah_Septu'.split('_'),
- weekdaysShort: 'Min_Sen_Sel_Reb_Kem_Jem_Sep'.split('_'),
- weekdaysMin: 'Mg_Sn_Sl_Rb_Km_Jm_Sp'.split('_'),
- longDateFormat: {
- LT: 'HH.mm',
- LTS: 'HH.mm.ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY [pukul] HH.mm',
- LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
- },
- meridiemParse: /enjing|siyang|sonten|ndalu/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'enjing') {
- return hour;
- } else if (meridiem === 'siyang') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === 'sonten' || meridiem === 'ndalu') {
- return hour + 12;
- }
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 11) {
- return 'enjing';
- } else if (hours < 15) {
- return 'siyang';
- } else if (hours < 19) {
- return 'sonten';
- } else {
- return 'ndalu';
- }
- },
- calendar: {
- sameDay: '[Dinten puniko pukul] LT',
- nextDay: '[Mbenjang pukul] LT',
- nextWeek: 'dddd [pukul] LT',
- lastDay: '[Kala wingi pukul] LT',
- lastWeek: 'dddd [kepengker pukul] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'wonten ing %s',
- past: '%s ingkang kepengker',
- s: 'sawetawis detik',
- ss: '%d detik',
- m: 'setunggal menit',
- mm: '%d menit',
- h: 'setunggal jam',
- hh: '%d jam',
- d: 'sedinten',
- dd: '%d dinten',
- M: 'sewulan',
- MM: '%d wulan',
- y: 'setaun',
- yy: '%d taun',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ka', {
- months: 'იანვარი_თებერვალი_მარტი_აპრილი_მაისი_ივნისი_ივლისი_აგვისტო_სექტემბერი_ოქტომბერი_ნოემბერი_დეკემბერი'.split(
- '_'
- ),
- monthsShort: 'იან_თებ_მარ_აპრ_მაი_ივნ_ივლ_აგვ_სექ_ოქტ_ნოე_დეკ'.split('_'),
- weekdays: {
- standalone:
- 'კვირა_ორშაბათი_სამშაბათი_ოთხშაბათი_ხუთშაბათი_პარასკევი_შაბათი'.split(
- '_'
- ),
- format: 'კვირას_ორშაბათს_სამშაბათს_ოთხშაბათს_ხუთშაბათს_პარასკევს_შაბათს'.split(
- '_'
- ),
- isFormat: /(წინა|შემდეგ)/,
- },
- weekdaysShort: 'კვი_ორშ_სამ_ოთხ_ხუთ_პარ_შაბ'.split('_'),
- weekdaysMin: 'კვ_ორ_სა_ოთ_ხუ_პა_შა'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[დღეს] LT[-ზე]',
- nextDay: '[ხვალ] LT[-ზე]',
- lastDay: '[გუშინ] LT[-ზე]',
- nextWeek: '[შემდეგ] dddd LT[-ზე]',
- lastWeek: '[წინა] dddd LT-ზე',
- sameElse: 'L',
- },
- relativeTime: {
- future: function (s) {
- return s.replace(
- /(წამ|წუთ|საათ|წელ|დღ|თვ)(ი|ე)/,
- function ($0, $1, $2) {
- return $2 === 'ი' ? $1 + 'ში' : $1 + $2 + 'ში';
- }
- );
- },
- past: function (s) {
- if (/(წამი|წუთი|საათი|დღე|თვე)/.test(s)) {
- return s.replace(/(ი|ე)$/, 'ის წინ');
- }
- if (/წელი/.test(s)) {
- return s.replace(/წელი$/, 'წლის წინ');
- }
- return s;
- },
- s: 'რამდენიმე წამი',
- ss: '%d წამი',
- m: 'წუთი',
- mm: '%d წუთი',
- h: 'საათი',
- hh: '%d საათი',
- d: 'დღე',
- dd: '%d დღე',
- M: 'თვე',
- MM: '%d თვე',
- y: 'წელი',
- yy: '%d წელი',
- },
- dayOfMonthOrdinalParse: /0|1-ლი|მე-\d{1,2}|\d{1,2}-ე/,
- ordinal: function (number) {
- if (number === 0) {
- return number;
- }
- if (number === 1) {
- return number + '-ლი';
- }
- if (
- number < 20 ||
- (number <= 100 && number % 20 === 0) ||
- number % 100 === 0
- ) {
- return 'მე-' + number;
- }
- return number + '-ე';
- },
- week: {
- dow: 1,
- doy: 7,
- },
- });
- //! moment.js locale configuration
- var suffixes$1 = {
- 0: '-ші',
- 1: '-ші',
- 2: '-ші',
- 3: '-ші',
- 4: '-ші',
- 5: '-ші',
- 6: '-шы',
- 7: '-ші',
- 8: '-ші',
- 9: '-шы',
- 10: '-шы',
- 20: '-шы',
- 30: '-шы',
- 40: '-шы',
- 50: '-ші',
- 60: '-шы',
- 70: '-ші',
- 80: '-ші',
- 90: '-шы',
- 100: '-ші',
- };
- hooks.defineLocale('kk', {
- months: 'қаңтар_ақпан_наурыз_сәуір_мамыр_маусым_шілде_тамыз_қыркүйек_қазан_қараша_желтоқсан'.split(
- '_'
- ),
- monthsShort: 'қаң_ақп_нау_сәу_мам_мау_шіл_там_қыр_қаз_қар_жел'.split('_'),
- weekdays: 'жексенбі_дүйсенбі_сейсенбі_сәрсенбі_бейсенбі_жұма_сенбі'.split(
- '_'
- ),
- weekdaysShort: 'жек_дүй_сей_сәр_бей_жұм_сен'.split('_'),
- weekdaysMin: 'жк_дй_сй_ср_бй_жм_сн'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Бүгін сағат] LT',
- nextDay: '[Ертең сағат] LT',
- nextWeek: 'dddd [сағат] LT',
- lastDay: '[Кеше сағат] LT',
- lastWeek: '[Өткен аптаның] dddd [сағат] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s ішінде',
- past: '%s бұрын',
- s: 'бірнеше секунд',
- ss: '%d секунд',
- m: 'бір минут',
- mm: '%d минут',
- h: 'бір сағат',
- hh: '%d сағат',
- d: 'бір күн',
- dd: '%d күн',
- M: 'бір ай',
- MM: '%d ай',
- y: 'бір жыл',
- yy: '%d жыл',
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(ші|шы)/,
- ordinal: function (number) {
- var a = number % 10,
- b = number >= 100 ? 100 : null;
- return number + (suffixes$1[number] || suffixes$1[a] || suffixes$1[b]);
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$9 = {
- 1: '១',
- 2: '២',
- 3: '៣',
- 4: '៤',
- 5: '៥',
- 6: '៦',
- 7: '៧',
- 8: '៨',
- 9: '៩',
- 0: '០',
- },
- numberMap$8 = {
- '១': '1',
- '២': '2',
- '៣': '3',
- '៤': '4',
- '៥': '5',
- '៦': '6',
- '៧': '7',
- '៨': '8',
- '៩': '9',
- '០': '0',
- };
- hooks.defineLocale('km', {
- months: 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
- '_'
- ),
- monthsShort:
- 'មករា_កុម្ភៈ_មីនា_មេសា_ឧសភា_មិថុនា_កក្កដា_សីហា_កញ្ញា_តុលា_វិច្ឆិកា_ធ្នូ'.split(
- '_'
- ),
- weekdays: 'អាទិត្យ_ច័ន្ទ_អង្គារ_ពុធ_ព្រហស្បតិ៍_សុក្រ_សៅរ៍'.split('_'),
- weekdaysShort: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
- weekdaysMin: 'អា_ច_អ_ព_ព្រ_សុ_ស'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- meridiemParse: /ព្រឹក|ល្ងាច/,
- isPM: function (input) {
- return input === 'ល្ងាច';
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ព្រឹក';
- } else {
- return 'ល្ងាច';
- }
- },
- calendar: {
- sameDay: '[ថ្ងៃនេះ ម៉ោង] LT',
- nextDay: '[ស្អែក ម៉ោង] LT',
- nextWeek: 'dddd [ម៉ោង] LT',
- lastDay: '[ម្សិលមិញ ម៉ោង] LT',
- lastWeek: 'dddd [សប្តាហ៍មុន] [ម៉ោង] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%sទៀត',
- past: '%sមុន',
- s: 'ប៉ុន្មានវិនាទី',
- ss: '%d វិនាទី',
- m: 'មួយនាទី',
- mm: '%d នាទី',
- h: 'មួយម៉ោង',
- hh: '%d ម៉ោង',
- d: 'មួយថ្ងៃ',
- dd: '%d ថ្ងៃ',
- M: 'មួយខែ',
- MM: '%d ខែ',
- y: 'មួយឆ្នាំ',
- yy: '%d ឆ្នាំ',
- },
- dayOfMonthOrdinalParse: /ទី\d{1,2}/,
- ordinal: 'ទី%d',
- preparse: function (string) {
- return string.replace(/[១២៣៤៥៦៧៨៩០]/g, function (match) {
- return numberMap$8[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$9[match];
- });
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$a = {
- 1: '೧',
- 2: '೨',
- 3: '೩',
- 4: '೪',
- 5: '೫',
- 6: '೬',
- 7: '೭',
- 8: '೮',
- 9: '೯',
- 0: '೦',
- },
- numberMap$9 = {
- '೧': '1',
- '೨': '2',
- '೩': '3',
- '೪': '4',
- '೫': '5',
- '೬': '6',
- '೭': '7',
- '೮': '8',
- '೯': '9',
- '೦': '0',
- };
- hooks.defineLocale('kn', {
- months: 'ಜನವರಿ_ಫೆಬ್ರವರಿ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂಬರ್_ಅಕ್ಟೋಬರ್_ನವೆಂಬರ್_ಡಿಸೆಂಬರ್'.split(
- '_'
- ),
- monthsShort:
- 'ಜನ_ಫೆಬ್ರ_ಮಾರ್ಚ್_ಏಪ್ರಿಲ್_ಮೇ_ಜೂನ್_ಜುಲೈ_ಆಗಸ್ಟ್_ಸೆಪ್ಟೆಂ_ಅಕ್ಟೋ_ನವೆಂ_ಡಿಸೆಂ'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'ಭಾನುವಾರ_ಸೋಮವಾರ_ಮಂಗಳವಾರ_ಬುಧವಾರ_ಗುರುವಾರ_ಶುಕ್ರವಾರ_ಶನಿವಾರ'.split(
- '_'
- ),
- weekdaysShort: 'ಭಾನು_ಸೋಮ_ಮಂಗಳ_ಬುಧ_ಗುರು_ಶುಕ್ರ_ಶನಿ'.split('_'),
- weekdaysMin: 'ಭಾ_ಸೋ_ಮಂ_ಬು_ಗು_ಶು_ಶ'.split('_'),
- longDateFormat: {
- LT: 'A h:mm',
- LTS: 'A h:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm',
- LLLL: 'dddd, D MMMM YYYY, A h:mm',
- },
- calendar: {
- sameDay: '[ಇಂದು] LT',
- nextDay: '[ನಾಳೆ] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[ನಿನ್ನೆ] LT',
- lastWeek: '[ಕೊನೆಯ] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s ನಂತರ',
- past: '%s ಹಿಂದೆ',
- s: 'ಕೆಲವು ಕ್ಷಣಗಳು',
- ss: '%d ಸೆಕೆಂಡುಗಳು',
- m: 'ಒಂದು ನಿಮಿಷ',
- mm: '%d ನಿಮಿಷ',
- h: 'ಒಂದು ಗಂಟೆ',
- hh: '%d ಗಂಟೆ',
- d: 'ಒಂದು ದಿನ',
- dd: '%d ದಿನ',
- M: 'ಒಂದು ತಿಂಗಳು',
- MM: '%d ತಿಂಗಳು',
- y: 'ಒಂದು ವರ್ಷ',
- yy: '%d ವರ್ಷ',
- },
- preparse: function (string) {
- return string.replace(/[೧೨೩೪೫೬೭೮೯೦]/g, function (match) {
- return numberMap$9[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$a[match];
- });
- },
- meridiemParse: /ರಾತ್ರಿ|ಬೆಳಿಗ್ಗೆ|ಮಧ್ಯಾಹ್ನ|ಸಂಜೆ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'ರಾತ್ರಿ') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'ಬೆಳಿಗ್ಗೆ') {
- return hour;
- } else if (meridiem === 'ಮಧ್ಯಾಹ್ನ') {
- return hour >= 10 ? hour : hour + 12;
- } else if (meridiem === 'ಸಂಜೆ') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'ರಾತ್ರಿ';
- } else if (hour < 10) {
- return 'ಬೆಳಿಗ್ಗೆ';
- } else if (hour < 17) {
- return 'ಮಧ್ಯಾಹ್ನ';
- } else if (hour < 20) {
- return 'ಸಂಜೆ';
- } else {
- return 'ರಾತ್ರಿ';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}(ನೇ)/,
- ordinal: function (number) {
- return number + 'ನೇ';
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ko', {
- months: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split('_'),
- monthsShort: '1월_2월_3월_4월_5월_6월_7월_8월_9월_10월_11월_12월'.split(
- '_'
- ),
- weekdays: '일요일_월요일_화요일_수요일_목요일_금요일_토요일'.split('_'),
- weekdaysShort: '일_월_화_수_목_금_토'.split('_'),
- weekdaysMin: '일_월_화_수_목_금_토'.split('_'),
- longDateFormat: {
- LT: 'A h:mm',
- LTS: 'A h:mm:ss',
- L: 'YYYY.MM.DD.',
- LL: 'YYYY년 MMMM D일',
- LLL: 'YYYY년 MMMM D일 A h:mm',
- LLLL: 'YYYY년 MMMM D일 dddd A h:mm',
- l: 'YYYY.MM.DD.',
- ll: 'YYYY년 MMMM D일',
- lll: 'YYYY년 MMMM D일 A h:mm',
- llll: 'YYYY년 MMMM D일 dddd A h:mm',
- },
- calendar: {
- sameDay: '오늘 LT',
- nextDay: '내일 LT',
- nextWeek: 'dddd LT',
- lastDay: '어제 LT',
- lastWeek: '지난주 dddd LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s 후',
- past: '%s 전',
- s: '몇 초',
- ss: '%d초',
- m: '1분',
- mm: '%d분',
- h: '한 시간',
- hh: '%d시간',
- d: '하루',
- dd: '%d일',
- M: '한 달',
- MM: '%d달',
- y: '일 년',
- yy: '%d년',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(일|월|주)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + '일';
- case 'M':
- return number + '월';
- case 'w':
- case 'W':
- return number + '주';
- default:
- return number;
- }
- },
- meridiemParse: /오전|오후/,
- isPM: function (token) {
- return token === '오후';
- },
- meridiem: function (hour, minute, isUpper) {
- return hour < 12 ? '오전' : '오후';
- },
- });
- //! moment.js locale configuration
- var symbolMap$b = {
- 1: '١',
- 2: '٢',
- 3: '٣',
- 4: '٤',
- 5: '٥',
- 6: '٦',
- 7: '٧',
- 8: '٨',
- 9: '٩',
- 0: '٠',
- },
- numberMap$a = {
- '١': '1',
- '٢': '2',
- '٣': '3',
- '٤': '4',
- '٥': '5',
- '٦': '6',
- '٧': '7',
- '٨': '8',
- '٩': '9',
- '٠': '0',
- },
- months$8 = [
- 'کانونی دووەم',
- 'شوبات',
- 'ئازار',
- 'نیسان',
- 'ئایار',
- 'حوزەیران',
- 'تەمموز',
- 'ئاب',
- 'ئەیلوول',
- 'تشرینی یەكەم',
- 'تشرینی دووەم',
- 'كانونی یەکەم',
- ];
- hooks.defineLocale('ku', {
- months: months$8,
- monthsShort: months$8,
- weekdays:
- 'یهكشهممه_دووشهممه_سێشهممه_چوارشهممه_پێنجشهممه_ههینی_شهممه'.split(
- '_'
- ),
- weekdaysShort:
- 'یهكشهم_دووشهم_سێشهم_چوارشهم_پێنجشهم_ههینی_شهممه'.split('_'),
- weekdaysMin: 'ی_د_س_چ_پ_ه_ش'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- meridiemParse: /ئێواره|بهیانی/,
- isPM: function (input) {
- return /ئێواره/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'بهیانی';
- } else {
- return 'ئێواره';
- }
- },
- calendar: {
- sameDay: '[ئهمرۆ كاتژمێر] LT',
- nextDay: '[بهیانی كاتژمێر] LT',
- nextWeek: 'dddd [كاتژمێر] LT',
- lastDay: '[دوێنێ كاتژمێر] LT',
- lastWeek: 'dddd [كاتژمێر] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'له %s',
- past: '%s',
- s: 'چهند چركهیهك',
- ss: 'چركه %d',
- m: 'یهك خولهك',
- mm: '%d خولهك',
- h: 'یهك كاتژمێر',
- hh: '%d كاتژمێر',
- d: 'یهك ڕۆژ',
- dd: '%d ڕۆژ',
- M: 'یهك مانگ',
- MM: '%d مانگ',
- y: 'یهك ساڵ',
- yy: '%d ساڵ',
- },
- preparse: function (string) {
- return string
- .replace(/[١٢٣٤٥٦٧٨٩٠]/g, function (match) {
- return numberMap$a[match];
- })
- .replace(/،/g, ',');
- },
- postformat: function (string) {
- return string
- .replace(/\d/g, function (match) {
- return symbolMap$b[match];
- })
- .replace(/,/g, '،');
- },
- week: {
- dow: 6, // Saturday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var suffixes$2 = {
- 0: '-чү',
- 1: '-чи',
- 2: '-чи',
- 3: '-чү',
- 4: '-чү',
- 5: '-чи',
- 6: '-чы',
- 7: '-чи',
- 8: '-чи',
- 9: '-чу',
- 10: '-чу',
- 20: '-чы',
- 30: '-чу',
- 40: '-чы',
- 50: '-чү',
- 60: '-чы',
- 70: '-чи',
- 80: '-чи',
- 90: '-чу',
- 100: '-чү',
- };
- hooks.defineLocale('ky', {
- months: 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split(
- '_'
- ),
- monthsShort: 'янв_фев_март_апр_май_июнь_июль_авг_сен_окт_ноя_дек'.split(
- '_'
- ),
- weekdays: 'Жекшемби_Дүйшөмбү_Шейшемби_Шаршемби_Бейшемби_Жума_Ишемби'.split(
- '_'
- ),
- weekdaysShort: 'Жек_Дүй_Шей_Шар_Бей_Жум_Ише'.split('_'),
- weekdaysMin: 'Жк_Дй_Шй_Шр_Бй_Жм_Иш'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Бүгүн саат] LT',
- nextDay: '[Эртең саат] LT',
- nextWeek: 'dddd [саат] LT',
- lastDay: '[Кечээ саат] LT',
- lastWeek: '[Өткөн аптанын] dddd [күнү] [саат] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s ичинде',
- past: '%s мурун',
- s: 'бирнече секунд',
- ss: '%d секунд',
- m: 'бир мүнөт',
- mm: '%d мүнөт',
- h: 'бир саат',
- hh: '%d саат',
- d: 'бир күн',
- dd: '%d күн',
- M: 'бир ай',
- MM: '%d ай',
- y: 'бир жыл',
- yy: '%d жыл',
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(чи|чы|чү|чу)/,
- ordinal: function (number) {
- var a = number % 10,
- b = number >= 100 ? 100 : null;
- return number + (suffixes$2[number] || suffixes$2[a] || suffixes$2[b]);
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function processRelativeTime$6(number, withoutSuffix, key, isFuture) {
- var format = {
- m: ['eng Minutt', 'enger Minutt'],
- h: ['eng Stonn', 'enger Stonn'],
- d: ['een Dag', 'engem Dag'],
- M: ['ee Mount', 'engem Mount'],
- y: ['ee Joer', 'engem Joer'],
- };
- return withoutSuffix ? format[key][0] : format[key][1];
- }
- function processFutureTime(string) {
- var number = string.substr(0, string.indexOf(' '));
- if (eifelerRegelAppliesToNumber(number)) {
- return 'a ' + string;
- }
- return 'an ' + string;
- }
- function processPastTime(string) {
- var number = string.substr(0, string.indexOf(' '));
- if (eifelerRegelAppliesToNumber(number)) {
- return 'viru ' + string;
- }
- return 'virun ' + string;
- }
- /**
- * Returns true if the word before the given number loses the '-n' ending.
- * e.g. 'an 10 Deeg' but 'a 5 Deeg'
- *
- * @param number {integer}
- * @returns {boolean}
- */
- function eifelerRegelAppliesToNumber(number) {
- number = parseInt(number, 10);
- if (isNaN(number)) {
- return false;
- }
- if (number < 0) {
- // Negative Number --> always true
- return true;
- } else if (number < 10) {
- // Only 1 digit
- if (4 <= number && number <= 7) {
- return true;
- }
- return false;
- } else if (number < 100) {
- // 2 digits
- var lastDigit = number % 10,
- firstDigit = number / 10;
- if (lastDigit === 0) {
- return eifelerRegelAppliesToNumber(firstDigit);
- }
- return eifelerRegelAppliesToNumber(lastDigit);
- } else if (number < 10000) {
- // 3 or 4 digits --> recursively check first digit
- while (number >= 10) {
- number = number / 10;
- }
- return eifelerRegelAppliesToNumber(number);
- } else {
- // Anything larger than 4 digits: recursively check first n-3 digits
- number = number / 1000;
- return eifelerRegelAppliesToNumber(number);
- }
- }
- hooks.defineLocale('lb', {
- months: 'Januar_Februar_Mäerz_Abrëll_Mee_Juni_Juli_August_September_Oktober_November_Dezember'.split(
- '_'
- ),
- monthsShort:
- 'Jan._Febr._Mrz._Abr._Mee_Jun._Jul._Aug._Sept._Okt._Nov._Dez.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays:
- 'Sonndeg_Méindeg_Dënschdeg_Mëttwoch_Donneschdeg_Freideg_Samschdeg'.split(
- '_'
- ),
- weekdaysShort: 'So._Mé._Dë._Më._Do._Fr._Sa.'.split('_'),
- weekdaysMin: 'So_Mé_Dë_Më_Do_Fr_Sa'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm [Auer]',
- LTS: 'H:mm:ss [Auer]',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm [Auer]',
- LLLL: 'dddd, D. MMMM YYYY H:mm [Auer]',
- },
- calendar: {
- sameDay: '[Haut um] LT',
- sameElse: 'L',
- nextDay: '[Muer um] LT',
- nextWeek: 'dddd [um] LT',
- lastDay: '[Gëschter um] LT',
- lastWeek: function () {
- // Different date string for 'Dënschdeg' (Tuesday) and 'Donneschdeg' (Thursday) due to phonological rule
- switch (this.day()) {
- case 2:
- case 4:
- return '[Leschten] dddd [um] LT';
- default:
- return '[Leschte] dddd [um] LT';
- }
- },
- },
- relativeTime: {
- future: processFutureTime,
- past: processPastTime,
- s: 'e puer Sekonnen',
- ss: '%d Sekonnen',
- m: processRelativeTime$6,
- mm: '%d Minutten',
- h: processRelativeTime$6,
- hh: '%d Stonnen',
- d: processRelativeTime$6,
- dd: '%d Deeg',
- M: processRelativeTime$6,
- MM: '%d Méint',
- y: processRelativeTime$6,
- yy: '%d Joer',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('lo', {
- months: 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split(
- '_'
- ),
- monthsShort:
- 'ມັງກອນ_ກຸມພາ_ມີນາ_ເມສາ_ພຶດສະພາ_ມິຖຸນາ_ກໍລະກົດ_ສິງຫາ_ກັນຍາ_ຕຸລາ_ພະຈິກ_ທັນວາ'.split(
- '_'
- ),
- weekdays: 'ອາທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
- weekdaysShort: 'ທິດ_ຈັນ_ອັງຄານ_ພຸດ_ພະຫັດ_ສຸກ_ເສົາ'.split('_'),
- weekdaysMin: 'ທ_ຈ_ອຄ_ພ_ພຫ_ສກ_ສ'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'ວັນdddd D MMMM YYYY HH:mm',
- },
- meridiemParse: /ຕອນເຊົ້າ|ຕອນແລງ/,
- isPM: function (input) {
- return input === 'ຕອນແລງ';
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ຕອນເຊົ້າ';
- } else {
- return 'ຕອນແລງ';
- }
- },
- calendar: {
- sameDay: '[ມື້ນີ້ເວລາ] LT',
- nextDay: '[ມື້ອື່ນເວລາ] LT',
- nextWeek: '[ວັນ]dddd[ໜ້າເວລາ] LT',
- lastDay: '[ມື້ວານນີ້ເວລາ] LT',
- lastWeek: '[ວັນ]dddd[ແລ້ວນີ້ເວລາ] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'ອີກ %s',
- past: '%sຜ່ານມາ',
- s: 'ບໍ່ເທົ່າໃດວິນາທີ',
- ss: '%d ວິນາທີ',
- m: '1 ນາທີ',
- mm: '%d ນາທີ',
- h: '1 ຊົ່ວໂມງ',
- hh: '%d ຊົ່ວໂມງ',
- d: '1 ມື້',
- dd: '%d ມື້',
- M: '1 ເດືອນ',
- MM: '%d ເດືອນ',
- y: '1 ປີ',
- yy: '%d ປີ',
- },
- dayOfMonthOrdinalParse: /(ທີ່)\d{1,2}/,
- ordinal: function (number) {
- return 'ທີ່' + number;
- },
- });
- //! moment.js locale configuration
- var units = {
- ss: 'sekundė_sekundžių_sekundes',
- m: 'minutė_minutės_minutę',
- mm: 'minutės_minučių_minutes',
- h: 'valanda_valandos_valandą',
- hh: 'valandos_valandų_valandas',
- d: 'diena_dienos_dieną',
- dd: 'dienos_dienų_dienas',
- M: 'mėnuo_mėnesio_mėnesį',
- MM: 'mėnesiai_mėnesių_mėnesius',
- y: 'metai_metų_metus',
- yy: 'metai_metų_metus',
- };
- function translateSeconds(number, withoutSuffix, key, isFuture) {
- if (withoutSuffix) {
- return 'kelios sekundės';
- } else {
- return isFuture ? 'kelių sekundžių' : 'kelias sekundes';
- }
- }
- function translateSingular(number, withoutSuffix, key, isFuture) {
- return withoutSuffix
- ? forms(key)[0]
- : isFuture
- ? forms(key)[1]
- : forms(key)[2];
- }
- function special(number) {
- return number % 10 === 0 || (number > 10 && number < 20);
- }
- function forms(key) {
- return units[key].split('_');
- }
- function translate$6(number, withoutSuffix, key, isFuture) {
- var result = number + ' ';
- if (number === 1) {
- return (
- result + translateSingular(number, withoutSuffix, key[0], isFuture)
- );
- } else if (withoutSuffix) {
- return result + (special(number) ? forms(key)[1] : forms(key)[0]);
- } else {
- if (isFuture) {
- return result + forms(key)[1];
- } else {
- return result + (special(number) ? forms(key)[1] : forms(key)[2]);
- }
- }
- }
- hooks.defineLocale('lt', {
- months: {
- format: 'sausio_vasario_kovo_balandžio_gegužės_birželio_liepos_rugpjūčio_rugsėjo_spalio_lapkričio_gruodžio'.split(
- '_'
- ),
- standalone:
- 'sausis_vasaris_kovas_balandis_gegužė_birželis_liepa_rugpjūtis_rugsėjis_spalis_lapkritis_gruodis'.split(
- '_'
- ),
- isFormat: /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?|MMMM?(\[[^\[\]]*\]|\s)+D[oD]?/,
- },
- monthsShort: 'sau_vas_kov_bal_geg_bir_lie_rgp_rgs_spa_lap_grd'.split('_'),
- weekdays: {
- format: 'sekmadienį_pirmadienį_antradienį_trečiadienį_ketvirtadienį_penktadienį_šeštadienį'.split(
- '_'
- ),
- standalone:
- 'sekmadienis_pirmadienis_antradienis_trečiadienis_ketvirtadienis_penktadienis_šeštadienis'.split(
- '_'
- ),
- isFormat: /dddd HH:mm/,
- },
- weekdaysShort: 'Sek_Pir_Ant_Tre_Ket_Pen_Šeš'.split('_'),
- weekdaysMin: 'S_P_A_T_K_Pn_Š'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: 'YYYY [m.] MMMM D [d.]',
- LLL: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
- LLLL: 'YYYY [m.] MMMM D [d.], dddd, HH:mm [val.]',
- l: 'YYYY-MM-DD',
- ll: 'YYYY [m.] MMMM D [d.]',
- lll: 'YYYY [m.] MMMM D [d.], HH:mm [val.]',
- llll: 'YYYY [m.] MMMM D [d.], ddd, HH:mm [val.]',
- },
- calendar: {
- sameDay: '[Šiandien] LT',
- nextDay: '[Rytoj] LT',
- nextWeek: 'dddd LT',
- lastDay: '[Vakar] LT',
- lastWeek: '[Praėjusį] dddd LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'po %s',
- past: 'prieš %s',
- s: translateSeconds,
- ss: translate$6,
- m: translateSingular,
- mm: translate$6,
- h: translateSingular,
- hh: translate$6,
- d: translateSingular,
- dd: translate$6,
- M: translateSingular,
- MM: translate$6,
- y: translateSingular,
- yy: translate$6,
- },
- dayOfMonthOrdinalParse: /\d{1,2}-oji/,
- ordinal: function (number) {
- return number + '-oji';
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var units$1 = {
- ss: 'sekundes_sekundēm_sekunde_sekundes'.split('_'),
- m: 'minūtes_minūtēm_minūte_minūtes'.split('_'),
- mm: 'minūtes_minūtēm_minūte_minūtes'.split('_'),
- h: 'stundas_stundām_stunda_stundas'.split('_'),
- hh: 'stundas_stundām_stunda_stundas'.split('_'),
- d: 'dienas_dienām_diena_dienas'.split('_'),
- dd: 'dienas_dienām_diena_dienas'.split('_'),
- M: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
- MM: 'mēneša_mēnešiem_mēnesis_mēneši'.split('_'),
- y: 'gada_gadiem_gads_gadi'.split('_'),
- yy: 'gada_gadiem_gads_gadi'.split('_'),
- };
- /**
- * @param withoutSuffix boolean true = a length of time; false = before/after a period of time.
- */
- function format$1(forms, number, withoutSuffix) {
- if (withoutSuffix) {
- // E.g. "21 minūte", "3 minūtes".
- return number % 10 === 1 && number % 100 !== 11 ? forms[2] : forms[3];
- } else {
- // E.g. "21 minūtes" as in "pēc 21 minūtes".
- // E.g. "3 minūtēm" as in "pēc 3 minūtēm".
- return number % 10 === 1 && number % 100 !== 11 ? forms[0] : forms[1];
- }
- }
- function relativeTimeWithPlural$1(number, withoutSuffix, key) {
- return number + ' ' + format$1(units$1[key], number, withoutSuffix);
- }
- function relativeTimeWithSingular(number, withoutSuffix, key) {
- return format$1(units$1[key], number, withoutSuffix);
- }
- function relativeSeconds(number, withoutSuffix) {
- return withoutSuffix ? 'dažas sekundes' : 'dažām sekundēm';
- }
- hooks.defineLocale('lv', {
- months: 'janvāris_februāris_marts_aprīlis_maijs_jūnijs_jūlijs_augusts_septembris_oktobris_novembris_decembris'.split(
- '_'
- ),
- monthsShort: 'jan_feb_mar_apr_mai_jūn_jūl_aug_sep_okt_nov_dec'.split('_'),
- weekdays:
- 'svētdiena_pirmdiena_otrdiena_trešdiena_ceturtdiena_piektdiena_sestdiena'.split(
- '_'
- ),
- weekdaysShort: 'Sv_P_O_T_C_Pk_S'.split('_'),
- weekdaysMin: 'Sv_P_O_T_C_Pk_S'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY.',
- LL: 'YYYY. [gada] D. MMMM',
- LLL: 'YYYY. [gada] D. MMMM, HH:mm',
- LLLL: 'YYYY. [gada] D. MMMM, dddd, HH:mm',
- },
- calendar: {
- sameDay: '[Šodien pulksten] LT',
- nextDay: '[Rīt pulksten] LT',
- nextWeek: 'dddd [pulksten] LT',
- lastDay: '[Vakar pulksten] LT',
- lastWeek: '[Pagājušā] dddd [pulksten] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'pēc %s',
- past: 'pirms %s',
- s: relativeSeconds,
- ss: relativeTimeWithPlural$1,
- m: relativeTimeWithSingular,
- mm: relativeTimeWithPlural$1,
- h: relativeTimeWithSingular,
- hh: relativeTimeWithPlural$1,
- d: relativeTimeWithSingular,
- dd: relativeTimeWithPlural$1,
- M: relativeTimeWithSingular,
- MM: relativeTimeWithPlural$1,
- y: relativeTimeWithSingular,
- yy: relativeTimeWithPlural$1,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var translator = {
- words: {
- //Different grammatical cases
- ss: ['sekund', 'sekunda', 'sekundi'],
- m: ['jedan minut', 'jednog minuta'],
- mm: ['minut', 'minuta', 'minuta'],
- h: ['jedan sat', 'jednog sata'],
- hh: ['sat', 'sata', 'sati'],
- dd: ['dan', 'dana', 'dana'],
- MM: ['mjesec', 'mjeseca', 'mjeseci'],
- yy: ['godina', 'godine', 'godina'],
- },
- correctGrammaticalCase: function (number, wordKey) {
- return number === 1
- ? wordKey[0]
- : number >= 2 && number <= 4
- ? wordKey[1]
- : wordKey[2];
- },
- translate: function (number, withoutSuffix, key) {
- var wordKey = translator.words[key];
- if (key.length === 1) {
- return withoutSuffix ? wordKey[0] : wordKey[1];
- } else {
- return (
- number +
- ' ' +
- translator.correctGrammaticalCase(number, wordKey)
- );
- }
- },
- };
- hooks.defineLocale('me', {
- months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
- monthsParseExact: true,
- weekdays: 'nedjelja_ponedjeljak_utorak_srijeda_četvrtak_petak_subota'.split(
- '_'
- ),
- weekdaysShort: 'ned._pon._uto._sri._čet._pet._sub.'.split('_'),
- weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd, D. MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[danas u] LT',
- nextDay: '[sjutra u] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[u] [nedjelju] [u] LT';
- case 3:
- return '[u] [srijedu] [u] LT';
- case 6:
- return '[u] [subotu] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[u] dddd [u] LT';
- }
- },
- lastDay: '[juče u] LT',
- lastWeek: function () {
- var lastWeekDays = [
- '[prošle] [nedjelje] [u] LT',
- '[prošlog] [ponedjeljka] [u] LT',
- '[prošlog] [utorka] [u] LT',
- '[prošle] [srijede] [u] LT',
- '[prošlog] [četvrtka] [u] LT',
- '[prošlog] [petka] [u] LT',
- '[prošle] [subote] [u] LT',
- ];
- return lastWeekDays[this.day()];
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: 'prije %s',
- s: 'nekoliko sekundi',
- ss: translator.translate,
- m: translator.translate,
- mm: translator.translate,
- h: translator.translate,
- hh: translator.translate,
- d: 'dan',
- dd: translator.translate,
- M: 'mjesec',
- MM: translator.translate,
- y: 'godinu',
- yy: translator.translate,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('mi', {
- months: 'Kohi-tāte_Hui-tanguru_Poutū-te-rangi_Paenga-whāwhā_Haratua_Pipiri_Hōngoingoi_Here-turi-kōkā_Mahuru_Whiringa-ā-nuku_Whiringa-ā-rangi_Hakihea'.split(
- '_'
- ),
- monthsShort:
- 'Kohi_Hui_Pou_Pae_Hara_Pipi_Hōngoi_Here_Mahu_Whi-nu_Whi-ra_Haki'.split(
- '_'
- ),
- monthsRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
- monthsStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
- monthsShortRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,3}/i,
- monthsShortStrictRegex: /(?:['a-z\u0101\u014D\u016B]+\-?){1,2}/i,
- weekdays: 'Rātapu_Mane_Tūrei_Wenerei_Tāite_Paraire_Hātarei'.split('_'),
- weekdaysShort: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'),
- weekdaysMin: 'Ta_Ma_Tū_We_Tāi_Pa_Hā'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY [i] HH:mm',
- LLLL: 'dddd, D MMMM YYYY [i] HH:mm',
- },
- calendar: {
- sameDay: '[i teie mahana, i] LT',
- nextDay: '[apopo i] LT',
- nextWeek: 'dddd [i] LT',
- lastDay: '[inanahi i] LT',
- lastWeek: 'dddd [whakamutunga i] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'i roto i %s',
- past: '%s i mua',
- s: 'te hēkona ruarua',
- ss: '%d hēkona',
- m: 'he meneti',
- mm: '%d meneti',
- h: 'te haora',
- hh: '%d haora',
- d: 'he ra',
- dd: '%d ra',
- M: 'he marama',
- MM: '%d marama',
- y: 'he tau',
- yy: '%d tau',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('mk', {
- months: 'јануари_февруари_март_април_мај_јуни_јули_август_септември_октомври_ноември_декември'.split(
- '_'
- ),
- monthsShort: 'јан_фев_мар_апр_мај_јун_јул_авг_сеп_окт_ное_дек'.split('_'),
- weekdays: 'недела_понеделник_вторник_среда_четврток_петок_сабота'.split(
- '_'
- ),
- weekdaysShort: 'нед_пон_вто_сре_чет_пет_саб'.split('_'),
- weekdaysMin: 'нe_пo_вт_ср_че_пе_сa'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'D.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY H:mm',
- LLLL: 'dddd, D MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[Денес во] LT',
- nextDay: '[Утре во] LT',
- nextWeek: '[Во] dddd [во] LT',
- lastDay: '[Вчера во] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- case 3:
- case 6:
- return '[Изминатата] dddd [во] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[Изминатиот] dddd [во] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'за %s',
- past: 'пред %s',
- s: 'неколку секунди',
- ss: '%d секунди',
- m: 'една минута',
- mm: '%d минути',
- h: 'еден час',
- hh: '%d часа',
- d: 'еден ден',
- dd: '%d дена',
- M: 'еден месец',
- MM: '%d месеци',
- y: 'една година',
- yy: '%d години',
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(ев|ен|ти|ви|ри|ми)/,
- ordinal: function (number) {
- var lastDigit = number % 10,
- last2Digits = number % 100;
- if (number === 0) {
- return number + '-ев';
- } else if (last2Digits === 0) {
- return number + '-ен';
- } else if (last2Digits > 10 && last2Digits < 20) {
- return number + '-ти';
- } else if (lastDigit === 1) {
- return number + '-ви';
- } else if (lastDigit === 2) {
- return number + '-ри';
- } else if (lastDigit === 7 || lastDigit === 8) {
- return number + '-ми';
- } else {
- return number + '-ти';
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ml', {
- months: 'ജനുവരി_ഫെബ്രുവരി_മാർച്ച്_ഏപ്രിൽ_മേയ്_ജൂൺ_ജൂലൈ_ഓഗസ്റ്റ്_സെപ്റ്റംബർ_ഒക്ടോബർ_നവംബർ_ഡിസംബർ'.split(
- '_'
- ),
- monthsShort:
- 'ജനു._ഫെബ്രു._മാർ._ഏപ്രി._മേയ്_ജൂൺ_ജൂലൈ._ഓഗ._സെപ്റ്റ._ഒക്ടോ._നവം._ഡിസം.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays:
- 'ഞായറാഴ്ച_തിങ്കളാഴ്ച_ചൊവ്വാഴ്ച_ബുധനാഴ്ച_വ്യാഴാഴ്ച_വെള്ളിയാഴ്ച_ശനിയാഴ്ച'.split(
- '_'
- ),
- weekdaysShort: 'ഞായർ_തിങ്കൾ_ചൊവ്വ_ബുധൻ_വ്യാഴം_വെള്ളി_ശനി'.split('_'),
- weekdaysMin: 'ഞാ_തി_ചൊ_ബു_വ്യാ_വെ_ശ'.split('_'),
- longDateFormat: {
- LT: 'A h:mm -നു',
- LTS: 'A h:mm:ss -നു',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm -നു',
- LLLL: 'dddd, D MMMM YYYY, A h:mm -നു',
- },
- calendar: {
- sameDay: '[ഇന്ന്] LT',
- nextDay: '[നാളെ] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[ഇന്നലെ] LT',
- lastWeek: '[കഴിഞ്ഞ] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s കഴിഞ്ഞ്',
- past: '%s മുൻപ്',
- s: 'അൽപ നിമിഷങ്ങൾ',
- ss: '%d സെക്കൻഡ്',
- m: 'ഒരു മിനിറ്റ്',
- mm: '%d മിനിറ്റ്',
- h: 'ഒരു മണിക്കൂർ',
- hh: '%d മണിക്കൂർ',
- d: 'ഒരു ദിവസം',
- dd: '%d ദിവസം',
- M: 'ഒരു മാസം',
- MM: '%d മാസം',
- y: 'ഒരു വർഷം',
- yy: '%d വർഷം',
- },
- meridiemParse: /രാത്രി|രാവിലെ|ഉച്ച കഴിഞ്ഞ്|വൈകുന്നേരം|രാത്രി/i,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (
- (meridiem === 'രാത്രി' && hour >= 4) ||
- meridiem === 'ഉച്ച കഴിഞ്ഞ്' ||
- meridiem === 'വൈകുന്നേരം'
- ) {
- return hour + 12;
- } else {
- return hour;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'രാത്രി';
- } else if (hour < 12) {
- return 'രാവിലെ';
- } else if (hour < 17) {
- return 'ഉച്ച കഴിഞ്ഞ്';
- } else if (hour < 20) {
- return 'വൈകുന്നേരം';
- } else {
- return 'രാത്രി';
- }
- },
- });
- //! moment.js locale configuration
- function translate$7(number, withoutSuffix, key, isFuture) {
- switch (key) {
- case 's':
- return withoutSuffix ? 'хэдхэн секунд' : 'хэдхэн секундын';
- case 'ss':
- return number + (withoutSuffix ? ' секунд' : ' секундын');
- case 'm':
- case 'mm':
- return number + (withoutSuffix ? ' минут' : ' минутын');
- case 'h':
- case 'hh':
- return number + (withoutSuffix ? ' цаг' : ' цагийн');
- case 'd':
- case 'dd':
- return number + (withoutSuffix ? ' өдөр' : ' өдрийн');
- case 'M':
- case 'MM':
- return number + (withoutSuffix ? ' сар' : ' сарын');
- case 'y':
- case 'yy':
- return number + (withoutSuffix ? ' жил' : ' жилийн');
- default:
- return number;
- }
- }
- hooks.defineLocale('mn', {
- months: 'Нэгдүгээр сар_Хоёрдугаар сар_Гуравдугаар сар_Дөрөвдүгээр сар_Тавдугаар сар_Зургадугаар сар_Долдугаар сар_Наймдугаар сар_Есдүгээр сар_Аравдугаар сар_Арван нэгдүгээр сар_Арван хоёрдугаар сар'.split(
- '_'
- ),
- monthsShort:
- '1 сар_2 сар_3 сар_4 сар_5 сар_6 сар_7 сар_8 сар_9 сар_10 сар_11 сар_12 сар'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'Ням_Даваа_Мягмар_Лхагва_Пүрэв_Баасан_Бямба'.split('_'),
- weekdaysShort: 'Ням_Дав_Мяг_Лха_Пүр_Баа_Бям'.split('_'),
- weekdaysMin: 'Ня_Да_Мя_Лх_Пү_Ба_Бя'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: 'YYYY оны MMMMын D',
- LLL: 'YYYY оны MMMMын D HH:mm',
- LLLL: 'dddd, YYYY оны MMMMын D HH:mm',
- },
- meridiemParse: /ҮӨ|ҮХ/i,
- isPM: function (input) {
- return input === 'ҮХ';
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ҮӨ';
- } else {
- return 'ҮХ';
- }
- },
- calendar: {
- sameDay: '[Өнөөдөр] LT',
- nextDay: '[Маргааш] LT',
- nextWeek: '[Ирэх] dddd LT',
- lastDay: '[Өчигдөр] LT',
- lastWeek: '[Өнгөрсөн] dddd LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s дараа',
- past: '%s өмнө',
- s: translate$7,
- ss: translate$7,
- m: translate$7,
- mm: translate$7,
- h: translate$7,
- hh: translate$7,
- d: translate$7,
- dd: translate$7,
- M: translate$7,
- MM: translate$7,
- y: translate$7,
- yy: translate$7,
- },
- dayOfMonthOrdinalParse: /\d{1,2} өдөр/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + ' өдөр';
- default:
- return number;
- }
- },
- });
- //! moment.js locale configuration
- var symbolMap$c = {
- 1: '१',
- 2: '२',
- 3: '३',
- 4: '४',
- 5: '५',
- 6: '६',
- 7: '७',
- 8: '८',
- 9: '९',
- 0: '०',
- },
- numberMap$b = {
- '१': '1',
- '२': '2',
- '३': '3',
- '४': '4',
- '५': '5',
- '६': '6',
- '७': '7',
- '८': '8',
- '९': '9',
- '०': '0',
- };
- function relativeTimeMr(number, withoutSuffix, string, isFuture) {
- var output = '';
- if (withoutSuffix) {
- switch (string) {
- case 's':
- output = 'काही सेकंद';
- break;
- case 'ss':
- output = '%d सेकंद';
- break;
- case 'm':
- output = 'एक मिनिट';
- break;
- case 'mm':
- output = '%d मिनिटे';
- break;
- case 'h':
- output = 'एक तास';
- break;
- case 'hh':
- output = '%d तास';
- break;
- case 'd':
- output = 'एक दिवस';
- break;
- case 'dd':
- output = '%d दिवस';
- break;
- case 'M':
- output = 'एक महिना';
- break;
- case 'MM':
- output = '%d महिने';
- break;
- case 'y':
- output = 'एक वर्ष';
- break;
- case 'yy':
- output = '%d वर्षे';
- break;
- }
- } else {
- switch (string) {
- case 's':
- output = 'काही सेकंदां';
- break;
- case 'ss':
- output = '%d सेकंदां';
- break;
- case 'm':
- output = 'एका मिनिटा';
- break;
- case 'mm':
- output = '%d मिनिटां';
- break;
- case 'h':
- output = 'एका तासा';
- break;
- case 'hh':
- output = '%d तासां';
- break;
- case 'd':
- output = 'एका दिवसा';
- break;
- case 'dd':
- output = '%d दिवसां';
- break;
- case 'M':
- output = 'एका महिन्या';
- break;
- case 'MM':
- output = '%d महिन्यां';
- break;
- case 'y':
- output = 'एका वर्षा';
- break;
- case 'yy':
- output = '%d वर्षां';
- break;
- }
- }
- return output.replace(/%d/i, number);
- }
- hooks.defineLocale('mr', {
- months: 'जानेवारी_फेब्रुवारी_मार्च_एप्रिल_मे_जून_जुलै_ऑगस्ट_सप्टेंबर_ऑक्टोबर_नोव्हेंबर_डिसेंबर'.split(
- '_'
- ),
- monthsShort:
- 'जाने._फेब्रु._मार्च._एप्रि._मे._जून._जुलै._ऑग._सप्टें._ऑक्टो._नोव्हें._डिसें.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'रविवार_सोमवार_मंगळवार_बुधवार_गुरूवार_शुक्रवार_शनिवार'.split('_'),
- weekdaysShort: 'रवि_सोम_मंगळ_बुध_गुरू_शुक्र_शनि'.split('_'),
- weekdaysMin: 'र_सो_मं_बु_गु_शु_श'.split('_'),
- longDateFormat: {
- LT: 'A h:mm वाजता',
- LTS: 'A h:mm:ss वाजता',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm वाजता',
- LLLL: 'dddd, D MMMM YYYY, A h:mm वाजता',
- },
- calendar: {
- sameDay: '[आज] LT',
- nextDay: '[उद्या] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[काल] LT',
- lastWeek: '[मागील] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%sमध्ये',
- past: '%sपूर्वी',
- s: relativeTimeMr,
- ss: relativeTimeMr,
- m: relativeTimeMr,
- mm: relativeTimeMr,
- h: relativeTimeMr,
- hh: relativeTimeMr,
- d: relativeTimeMr,
- dd: relativeTimeMr,
- M: relativeTimeMr,
- MM: relativeTimeMr,
- y: relativeTimeMr,
- yy: relativeTimeMr,
- },
- preparse: function (string) {
- return string.replace(/[१२३४५६७८९०]/g, function (match) {
- return numberMap$b[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$c[match];
- });
- },
- meridiemParse: /पहाटे|सकाळी|दुपारी|सायंकाळी|रात्री/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'पहाटे' || meridiem === 'सकाळी') {
- return hour;
- } else if (
- meridiem === 'दुपारी' ||
- meridiem === 'सायंकाळी' ||
- meridiem === 'रात्री'
- ) {
- return hour >= 12 ? hour : hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour >= 0 && hour < 6) {
- return 'पहाटे';
- } else if (hour < 12) {
- return 'सकाळी';
- } else if (hour < 17) {
- return 'दुपारी';
- } else if (hour < 20) {
- return 'सायंकाळी';
- } else {
- return 'रात्री';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ms-my', {
- months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
- weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
- weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
- weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
- longDateFormat: {
- LT: 'HH.mm',
- LTS: 'HH.mm.ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY [pukul] HH.mm',
- LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
- },
- meridiemParse: /pagi|tengahari|petang|malam/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'pagi') {
- return hour;
- } else if (meridiem === 'tengahari') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === 'petang' || meridiem === 'malam') {
- return hour + 12;
- }
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 11) {
- return 'pagi';
- } else if (hours < 15) {
- return 'tengahari';
- } else if (hours < 19) {
- return 'petang';
- } else {
- return 'malam';
- }
- },
- calendar: {
- sameDay: '[Hari ini pukul] LT',
- nextDay: '[Esok pukul] LT',
- nextWeek: 'dddd [pukul] LT',
- lastDay: '[Kelmarin pukul] LT',
- lastWeek: 'dddd [lepas pukul] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dalam %s',
- past: '%s yang lepas',
- s: 'beberapa saat',
- ss: '%d saat',
- m: 'seminit',
- mm: '%d minit',
- h: 'sejam',
- hh: '%d jam',
- d: 'sehari',
- dd: '%d hari',
- M: 'sebulan',
- MM: '%d bulan',
- y: 'setahun',
- yy: '%d tahun',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ms', {
- months: 'Januari_Februari_Mac_April_Mei_Jun_Julai_Ogos_September_Oktober_November_Disember'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ogs_Sep_Okt_Nov_Dis'.split('_'),
- weekdays: 'Ahad_Isnin_Selasa_Rabu_Khamis_Jumaat_Sabtu'.split('_'),
- weekdaysShort: 'Ahd_Isn_Sel_Rab_Kha_Jum_Sab'.split('_'),
- weekdaysMin: 'Ah_Is_Sl_Rb_Km_Jm_Sb'.split('_'),
- longDateFormat: {
- LT: 'HH.mm',
- LTS: 'HH.mm.ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY [pukul] HH.mm',
- LLLL: 'dddd, D MMMM YYYY [pukul] HH.mm',
- },
- meridiemParse: /pagi|tengahari|petang|malam/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'pagi') {
- return hour;
- } else if (meridiem === 'tengahari') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === 'petang' || meridiem === 'malam') {
- return hour + 12;
- }
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 11) {
- return 'pagi';
- } else if (hours < 15) {
- return 'tengahari';
- } else if (hours < 19) {
- return 'petang';
- } else {
- return 'malam';
- }
- },
- calendar: {
- sameDay: '[Hari ini pukul] LT',
- nextDay: '[Esok pukul] LT',
- nextWeek: 'dddd [pukul] LT',
- lastDay: '[Kelmarin pukul] LT',
- lastWeek: 'dddd [lepas pukul] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dalam %s',
- past: '%s yang lepas',
- s: 'beberapa saat',
- ss: '%d saat',
- m: 'seminit',
- mm: '%d minit',
- h: 'sejam',
- hh: '%d jam',
- d: 'sehari',
- dd: '%d hari',
- M: 'sebulan',
- MM: '%d bulan',
- y: 'setahun',
- yy: '%d tahun',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('mt', {
- months: 'Jannar_Frar_Marzu_April_Mejju_Ġunju_Lulju_Awwissu_Settembru_Ottubru_Novembru_Diċembru'.split(
- '_'
- ),
- monthsShort: 'Jan_Fra_Mar_Apr_Mej_Ġun_Lul_Aww_Set_Ott_Nov_Diċ'.split('_'),
- weekdays:
- 'Il-Ħadd_It-Tnejn_It-Tlieta_L-Erbgħa_Il-Ħamis_Il-Ġimgħa_Is-Sibt'.split(
- '_'
- ),
- weekdaysShort: 'Ħad_Tne_Tli_Erb_Ħam_Ġim_Sib'.split('_'),
- weekdaysMin: 'Ħa_Tn_Tl_Er_Ħa_Ġi_Si'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Illum fil-]LT',
- nextDay: '[Għada fil-]LT',
- nextWeek: 'dddd [fil-]LT',
- lastDay: '[Il-bieraħ fil-]LT',
- lastWeek: 'dddd [li għadda] [fil-]LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'f’ %s',
- past: '%s ilu',
- s: 'ftit sekondi',
- ss: '%d sekondi',
- m: 'minuta',
- mm: '%d minuti',
- h: 'siegħa',
- hh: '%d siegħat',
- d: 'ġurnata',
- dd: '%d ġranet',
- M: 'xahar',
- MM: '%d xhur',
- y: 'sena',
- yy: '%d sni',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$d = {
- 1: '၁',
- 2: '၂',
- 3: '၃',
- 4: '၄',
- 5: '၅',
- 6: '၆',
- 7: '၇',
- 8: '၈',
- 9: '၉',
- 0: '၀',
- },
- numberMap$c = {
- '၁': '1',
- '၂': '2',
- '၃': '3',
- '၄': '4',
- '၅': '5',
- '၆': '6',
- '၇': '7',
- '၈': '8',
- '၉': '9',
- '၀': '0',
- };
- hooks.defineLocale('my', {
- months: 'ဇန်နဝါရီ_ဖေဖော်ဝါရီ_မတ်_ဧပြီ_မေ_ဇွန်_ဇူလိုင်_သြဂုတ်_စက်တင်ဘာ_အောက်တိုဘာ_နိုဝင်ဘာ_ဒီဇင်ဘာ'.split(
- '_'
- ),
- monthsShort: 'ဇန်_ဖေ_မတ်_ပြီ_မေ_ဇွန်_လိုင်_သြ_စက်_အောက်_နို_ဒီ'.split('_'),
- weekdays: 'တနင်္ဂနွေ_တနင်္လာ_အင်္ဂါ_ဗုဒ္ဓဟူး_ကြာသပတေး_သောကြာ_စနေ'.split(
- '_'
- ),
- weekdaysShort: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
- weekdaysMin: 'နွေ_လာ_ဂါ_ဟူး_ကြာ_သော_နေ'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[ယနေ.] LT [မှာ]',
- nextDay: '[မနက်ဖြန်] LT [မှာ]',
- nextWeek: 'dddd LT [မှာ]',
- lastDay: '[မနေ.က] LT [မှာ]',
- lastWeek: '[ပြီးခဲ့သော] dddd LT [မှာ]',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'လာမည့် %s မှာ',
- past: 'လွန်ခဲ့သော %s က',
- s: 'စက္ကန်.အနည်းငယ်',
- ss: '%d စက္ကန့်',
- m: 'တစ်မိနစ်',
- mm: '%d မိနစ်',
- h: 'တစ်နာရီ',
- hh: '%d နာရီ',
- d: 'တစ်ရက်',
- dd: '%d ရက်',
- M: 'တစ်လ',
- MM: '%d လ',
- y: 'တစ်နှစ်',
- yy: '%d နှစ်',
- },
- preparse: function (string) {
- return string.replace(/[၁၂၃၄၅၆၇၈၉၀]/g, function (match) {
- return numberMap$c[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$d[match];
- });
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('nb', {
- months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split('_'),
- monthsParseExact: true,
- weekdays: 'søndag_mandag_tirsdag_onsdag_torsdag_fredag_lørdag'.split('_'),
- weekdaysShort: 'sø._ma._ti._on._to._fr._lø.'.split('_'),
- weekdaysMin: 'sø_ma_ti_on_to_fr_lø'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY [kl.] HH:mm',
- LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm',
- },
- calendar: {
- sameDay: '[i dag kl.] LT',
- nextDay: '[i morgen kl.] LT',
- nextWeek: 'dddd [kl.] LT',
- lastDay: '[i går kl.] LT',
- lastWeek: '[forrige] dddd [kl.] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'om %s',
- past: '%s siden',
- s: 'noen sekunder',
- ss: '%d sekunder',
- m: 'ett minutt',
- mm: '%d minutter',
- h: 'en time',
- hh: '%d timer',
- d: 'en dag',
- dd: '%d dager',
- w: 'en uke',
- ww: '%d uker',
- M: 'en måned',
- MM: '%d måneder',
- y: 'ett år',
- yy: '%d år',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$e = {
- 1: '१',
- 2: '२',
- 3: '३',
- 4: '४',
- 5: '५',
- 6: '६',
- 7: '७',
- 8: '८',
- 9: '९',
- 0: '०',
- },
- numberMap$d = {
- '१': '1',
- '२': '2',
- '३': '3',
- '४': '4',
- '५': '5',
- '६': '6',
- '७': '7',
- '८': '8',
- '९': '9',
- '०': '0',
- };
- hooks.defineLocale('ne', {
- months: 'जनवरी_फेब्रुवरी_मार्च_अप्रिल_मई_जुन_जुलाई_अगष्ट_सेप्टेम्बर_अक्टोबर_नोभेम्बर_डिसेम्बर'.split(
- '_'
- ),
- monthsShort:
- 'जन._फेब्रु._मार्च_अप्रि._मई_जुन_जुलाई._अग._सेप्ट._अक्टो._नोभे._डिसे.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'आइतबार_सोमबार_मङ्गलबार_बुधबार_बिहिबार_शुक्रबार_शनिबार'.split(
- '_'
- ),
- weekdaysShort: 'आइत._सोम._मङ्गल._बुध._बिहि._शुक्र._शनि.'.split('_'),
- weekdaysMin: 'आ._सो._मं._बु._बि._शु._श.'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'Aको h:mm बजे',
- LTS: 'Aको h:mm:ss बजे',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, Aको h:mm बजे',
- LLLL: 'dddd, D MMMM YYYY, Aको h:mm बजे',
- },
- preparse: function (string) {
- return string.replace(/[१२३४५६७८९०]/g, function (match) {
- return numberMap$d[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$e[match];
- });
- },
- meridiemParse: /राति|बिहान|दिउँसो|साँझ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'राति') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'बिहान') {
- return hour;
- } else if (meridiem === 'दिउँसो') {
- return hour >= 10 ? hour : hour + 12;
- } else if (meridiem === 'साँझ') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 3) {
- return 'राति';
- } else if (hour < 12) {
- return 'बिहान';
- } else if (hour < 16) {
- return 'दिउँसो';
- } else if (hour < 20) {
- return 'साँझ';
- } else {
- return 'राति';
- }
- },
- calendar: {
- sameDay: '[आज] LT',
- nextDay: '[भोलि] LT',
- nextWeek: '[आउँदो] dddd[,] LT',
- lastDay: '[हिजो] LT',
- lastWeek: '[गएको] dddd[,] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%sमा',
- past: '%s अगाडि',
- s: 'केही क्षण',
- ss: '%d सेकेण्ड',
- m: 'एक मिनेट',
- mm: '%d मिनेट',
- h: 'एक घण्टा',
- hh: '%d घण्टा',
- d: 'एक दिन',
- dd: '%d दिन',
- M: 'एक महिना',
- MM: '%d महिना',
- y: 'एक बर्ष',
- yy: '%d बर्ष',
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsShortWithDots$1 =
- 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
- monthsShortWithoutDots$1 =
- 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
- monthsParse$8 = [
- /^jan/i,
- /^feb/i,
- /^maart|mrt.?$/i,
- /^apr/i,
- /^mei$/i,
- /^jun[i.]?$/i,
- /^jul[i.]?$/i,
- /^aug/i,
- /^sep/i,
- /^okt/i,
- /^nov/i,
- /^dec/i,
- ],
- monthsRegex$8 =
- /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
- hooks.defineLocale('nl-be', {
- months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortWithDots$1;
- } else if (/-MMM-/.test(format)) {
- return monthsShortWithoutDots$1[m.month()];
- } else {
- return monthsShortWithDots$1[m.month()];
- }
- },
- monthsRegex: monthsRegex$8,
- monthsShortRegex: monthsRegex$8,
- monthsStrictRegex:
- /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,
- monthsShortStrictRegex:
- /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
- monthsParse: monthsParse$8,
- longMonthsParse: monthsParse$8,
- shortMonthsParse: monthsParse$8,
- weekdays:
- 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
- weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'),
- weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[vandaag om] LT',
- nextDay: '[morgen om] LT',
- nextWeek: 'dddd [om] LT',
- lastDay: '[gisteren om] LT',
- lastWeek: '[afgelopen] dddd [om] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'over %s',
- past: '%s geleden',
- s: 'een paar seconden',
- ss: '%d seconden',
- m: 'één minuut',
- mm: '%d minuten',
- h: 'één uur',
- hh: '%d uur',
- d: 'één dag',
- dd: '%d dagen',
- M: 'één maand',
- MM: '%d maanden',
- y: 'één jaar',
- yy: '%d jaar',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
- ordinal: function (number) {
- return (
- number +
- (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
- );
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsShortWithDots$2 =
- 'jan._feb._mrt._apr._mei_jun._jul._aug._sep._okt._nov._dec.'.split('_'),
- monthsShortWithoutDots$2 =
- 'jan_feb_mrt_apr_mei_jun_jul_aug_sep_okt_nov_dec'.split('_'),
- monthsParse$9 = [
- /^jan/i,
- /^feb/i,
- /^maart|mrt.?$/i,
- /^apr/i,
- /^mei$/i,
- /^jun[i.]?$/i,
- /^jul[i.]?$/i,
- /^aug/i,
- /^sep/i,
- /^okt/i,
- /^nov/i,
- /^dec/i,
- ],
- monthsRegex$9 =
- /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december|jan\.?|feb\.?|mrt\.?|apr\.?|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i;
- hooks.defineLocale('nl', {
- months: 'januari_februari_maart_april_mei_juni_juli_augustus_september_oktober_november_december'.split(
- '_'
- ),
- monthsShort: function (m, format) {
- if (!m) {
- return monthsShortWithDots$2;
- } else if (/-MMM-/.test(format)) {
- return monthsShortWithoutDots$2[m.month()];
- } else {
- return monthsShortWithDots$2[m.month()];
- }
- },
- monthsRegex: monthsRegex$9,
- monthsShortRegex: monthsRegex$9,
- monthsStrictRegex:
- /^(januari|februari|maart|april|mei|ju[nl]i|augustus|september|oktober|november|december)/i,
- monthsShortStrictRegex:
- /^(jan\.?|feb\.?|mrt\.?|apr\.?|mei|ju[nl]\.?|aug\.?|sep\.?|okt\.?|nov\.?|dec\.?)/i,
- monthsParse: monthsParse$9,
- longMonthsParse: monthsParse$9,
- shortMonthsParse: monthsParse$9,
- weekdays:
- 'zondag_maandag_dinsdag_woensdag_donderdag_vrijdag_zaterdag'.split('_'),
- weekdaysShort: 'zo._ma._di._wo._do._vr._za.'.split('_'),
- weekdaysMin: 'zo_ma_di_wo_do_vr_za'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD-MM-YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[vandaag om] LT',
- nextDay: '[morgen om] LT',
- nextWeek: 'dddd [om] LT',
- lastDay: '[gisteren om] LT',
- lastWeek: '[afgelopen] dddd [om] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'over %s',
- past: '%s geleden',
- s: 'een paar seconden',
- ss: '%d seconden',
- m: 'één minuut',
- mm: '%d minuten',
- h: 'één uur',
- hh: '%d uur',
- d: 'één dag',
- dd: '%d dagen',
- w: 'één week',
- ww: '%d weken',
- M: 'één maand',
- MM: '%d maanden',
- y: 'één jaar',
- yy: '%d jaar',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(ste|de)/,
- ordinal: function (number) {
- return (
- number +
- (number === 1 || number === 8 || number >= 20 ? 'ste' : 'de')
- );
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('nn', {
- months: 'januar_februar_mars_april_mai_juni_juli_august_september_oktober_november_desember'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._mars_apr._mai_juni_juli_aug._sep._okt._nov._des.'.split('_'),
- monthsParseExact: true,
- weekdays: 'sundag_måndag_tysdag_onsdag_torsdag_fredag_laurdag'.split('_'),
- weekdaysShort: 'su._må._ty._on._to._fr._lau.'.split('_'),
- weekdaysMin: 'su_må_ty_on_to_fr_la'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY [kl.] H:mm',
- LLLL: 'dddd D. MMMM YYYY [kl.] HH:mm',
- },
- calendar: {
- sameDay: '[I dag klokka] LT',
- nextDay: '[I morgon klokka] LT',
- nextWeek: 'dddd [klokka] LT',
- lastDay: '[I går klokka] LT',
- lastWeek: '[Føregåande] dddd [klokka] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'om %s',
- past: '%s sidan',
- s: 'nokre sekund',
- ss: '%d sekund',
- m: 'eit minutt',
- mm: '%d minutt',
- h: 'ein time',
- hh: '%d timar',
- d: 'ein dag',
- dd: '%d dagar',
- w: 'ei veke',
- ww: '%d veker',
- M: 'ein månad',
- MM: '%d månader',
- y: 'eit år',
- yy: '%d år',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('oc-lnc', {
- months: {
- standalone:
- 'genièr_febrièr_març_abril_mai_junh_julhet_agost_setembre_octòbre_novembre_decembre'.split(
- '_'
- ),
- format: "de genièr_de febrièr_de març_d'abril_de mai_de junh_de julhet_d'agost_de setembre_d'octòbre_de novembre_de decembre".split(
- '_'
- ),
- isFormat: /D[oD]?(\s)+MMMM/,
- },
- monthsShort:
- 'gen._febr._març_abr._mai_junh_julh._ago._set._oct._nov._dec.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'dimenge_diluns_dimars_dimècres_dijòus_divendres_dissabte'.split(
- '_'
- ),
- weekdaysShort: 'dg._dl._dm._dc._dj._dv._ds.'.split('_'),
- weekdaysMin: 'dg_dl_dm_dc_dj_dv_ds'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM [de] YYYY',
- ll: 'D MMM YYYY',
- LLL: 'D MMMM [de] YYYY [a] H:mm',
- lll: 'D MMM YYYY, H:mm',
- LLLL: 'dddd D MMMM [de] YYYY [a] H:mm',
- llll: 'ddd D MMM YYYY, H:mm',
- },
- calendar: {
- sameDay: '[uèi a] LT',
- nextDay: '[deman a] LT',
- nextWeek: 'dddd [a] LT',
- lastDay: '[ièr a] LT',
- lastWeek: 'dddd [passat a] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: "d'aquí %s",
- past: 'fa %s',
- s: 'unas segondas',
- ss: '%d segondas',
- m: 'una minuta',
- mm: '%d minutas',
- h: 'una ora',
- hh: '%d oras',
- d: 'un jorn',
- dd: '%d jorns',
- M: 'un mes',
- MM: '%d meses',
- y: 'un an',
- yy: '%d ans',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(r|n|t|è|a)/,
- ordinal: function (number, period) {
- var output =
- number === 1
- ? 'r'
- : number === 2
- ? 'n'
- : number === 3
- ? 'r'
- : number === 4
- ? 't'
- : 'è';
- if (period === 'w' || period === 'W') {
- output = 'a';
- }
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4,
- },
- });
- //! moment.js locale configuration
- var symbolMap$f = {
- 1: '੧',
- 2: '੨',
- 3: '੩',
- 4: '੪',
- 5: '੫',
- 6: '੬',
- 7: '੭',
- 8: '੮',
- 9: '੯',
- 0: '੦',
- },
- numberMap$e = {
- '੧': '1',
- '੨': '2',
- '੩': '3',
- '੪': '4',
- '੫': '5',
- '੬': '6',
- '੭': '7',
- '੮': '8',
- '੯': '9',
- '੦': '0',
- };
- hooks.defineLocale('pa-in', {
- // There are months name as per Nanakshahi Calendar but they are not used as rigidly in modern Punjabi.
- months: 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
- '_'
- ),
- monthsShort:
- 'ਜਨਵਰੀ_ਫ਼ਰਵਰੀ_ਮਾਰਚ_ਅਪ੍ਰੈਲ_ਮਈ_ਜੂਨ_ਜੁਲਾਈ_ਅਗਸਤ_ਸਤੰਬਰ_ਅਕਤੂਬਰ_ਨਵੰਬਰ_ਦਸੰਬਰ'.split(
- '_'
- ),
- weekdays: 'ਐਤਵਾਰ_ਸੋਮਵਾਰ_ਮੰਗਲਵਾਰ_ਬੁਧਵਾਰ_ਵੀਰਵਾਰ_ਸ਼ੁੱਕਰਵਾਰ_ਸ਼ਨੀਚਰਵਾਰ'.split(
- '_'
- ),
- weekdaysShort: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
- weekdaysMin: 'ਐਤ_ਸੋਮ_ਮੰਗਲ_ਬੁਧ_ਵੀਰ_ਸ਼ੁਕਰ_ਸ਼ਨੀ'.split('_'),
- longDateFormat: {
- LT: 'A h:mm ਵਜੇ',
- LTS: 'A h:mm:ss ਵਜੇ',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm ਵਜੇ',
- LLLL: 'dddd, D MMMM YYYY, A h:mm ਵਜੇ',
- },
- calendar: {
- sameDay: '[ਅਜ] LT',
- nextDay: '[ਕਲ] LT',
- nextWeek: '[ਅਗਲਾ] dddd, LT',
- lastDay: '[ਕਲ] LT',
- lastWeek: '[ਪਿਛਲੇ] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s ਵਿੱਚ',
- past: '%s ਪਿਛਲੇ',
- s: 'ਕੁਝ ਸਕਿੰਟ',
- ss: '%d ਸਕਿੰਟ',
- m: 'ਇਕ ਮਿੰਟ',
- mm: '%d ਮਿੰਟ',
- h: 'ਇੱਕ ਘੰਟਾ',
- hh: '%d ਘੰਟੇ',
- d: 'ਇੱਕ ਦਿਨ',
- dd: '%d ਦਿਨ',
- M: 'ਇੱਕ ਮਹੀਨਾ',
- MM: '%d ਮਹੀਨੇ',
- y: 'ਇੱਕ ਸਾਲ',
- yy: '%d ਸਾਲ',
- },
- preparse: function (string) {
- return string.replace(/[੧੨੩੪੫੬੭੮੯੦]/g, function (match) {
- return numberMap$e[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$f[match];
- });
- },
- // Punjabi notation for meridiems are quite fuzzy in practice. While there exists
- // a rigid notion of a 'Pahar' it is not used as rigidly in modern Punjabi.
- meridiemParse: /ਰਾਤ|ਸਵੇਰ|ਦੁਪਹਿਰ|ਸ਼ਾਮ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'ਰਾਤ') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'ਸਵੇਰ') {
- return hour;
- } else if (meridiem === 'ਦੁਪਹਿਰ') {
- return hour >= 10 ? hour : hour + 12;
- } else if (meridiem === 'ਸ਼ਾਮ') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'ਰਾਤ';
- } else if (hour < 10) {
- return 'ਸਵੇਰ';
- } else if (hour < 17) {
- return 'ਦੁਪਹਿਰ';
- } else if (hour < 20) {
- return 'ਸ਼ਾਮ';
- } else {
- return 'ਰਾਤ';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var monthsNominative =
- 'styczeń_luty_marzec_kwiecień_maj_czerwiec_lipiec_sierpień_wrzesień_październik_listopad_grudzień'.split(
- '_'
- ),
- monthsSubjective =
- 'stycznia_lutego_marca_kwietnia_maja_czerwca_lipca_sierpnia_września_października_listopada_grudnia'.split(
- '_'
- ),
- monthsParse$a = [
- /^sty/i,
- /^lut/i,
- /^mar/i,
- /^kwi/i,
- /^maj/i,
- /^cze/i,
- /^lip/i,
- /^sie/i,
- /^wrz/i,
- /^paź/i,
- /^lis/i,
- /^gru/i,
- ];
- function plural$3(n) {
- return n % 10 < 5 && n % 10 > 1 && ~~(n / 10) % 10 !== 1;
- }
- function translate$8(number, withoutSuffix, key) {
- var result = number + ' ';
- switch (key) {
- case 'ss':
- return result + (plural$3(number) ? 'sekundy' : 'sekund');
- case 'm':
- return withoutSuffix ? 'minuta' : 'minutę';
- case 'mm':
- return result + (plural$3(number) ? 'minuty' : 'minut');
- case 'h':
- return withoutSuffix ? 'godzina' : 'godzinę';
- case 'hh':
- return result + (plural$3(number) ? 'godziny' : 'godzin');
- case 'ww':
- return result + (plural$3(number) ? 'tygodnie' : 'tygodni');
- case 'MM':
- return result + (plural$3(number) ? 'miesiące' : 'miesięcy');
- case 'yy':
- return result + (plural$3(number) ? 'lata' : 'lat');
- }
- }
- hooks.defineLocale('pl', {
- months: function (momentToFormat, format) {
- if (!momentToFormat) {
- return monthsNominative;
- } else if (/D MMMM/.test(format)) {
- return monthsSubjective[momentToFormat.month()];
- } else {
- return monthsNominative[momentToFormat.month()];
- }
- },
- monthsShort: 'sty_lut_mar_kwi_maj_cze_lip_sie_wrz_paź_lis_gru'.split('_'),
- monthsParse: monthsParse$a,
- longMonthsParse: monthsParse$a,
- shortMonthsParse: monthsParse$a,
- weekdays:
- 'niedziela_poniedziałek_wtorek_środa_czwartek_piątek_sobota'.split('_'),
- weekdaysShort: 'ndz_pon_wt_śr_czw_pt_sob'.split('_'),
- weekdaysMin: 'Nd_Pn_Wt_Śr_Cz_Pt_So'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Dziś o] LT',
- nextDay: '[Jutro o] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[W niedzielę o] LT';
- case 2:
- return '[We wtorek o] LT';
- case 3:
- return '[W środę o] LT';
- case 6:
- return '[W sobotę o] LT';
- default:
- return '[W] dddd [o] LT';
- }
- },
- lastDay: '[Wczoraj o] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return '[W zeszłą niedzielę o] LT';
- case 3:
- return '[W zeszłą środę o] LT';
- case 6:
- return '[W zeszłą sobotę o] LT';
- default:
- return '[W zeszły] dddd [o] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: '%s temu',
- s: 'kilka sekund',
- ss: translate$8,
- m: translate$8,
- mm: translate$8,
- h: translate$8,
- hh: translate$8,
- d: '1 dzień',
- dd: '%d dni',
- w: 'tydzień',
- ww: translate$8,
- M: 'miesiąc',
- MM: translate$8,
- y: 'rok',
- yy: translate$8,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('pt-br', {
- months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split(
- '_'
- ),
- monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
- weekdays:
- 'domingo_segunda-feira_terça-feira_quarta-feira_quinta-feira_sexta-feira_sábado'.split(
- '_'
- ),
- weekdaysShort: 'dom_seg_ter_qua_qui_sex_sáb'.split('_'),
- weekdaysMin: 'do_2ª_3ª_4ª_5ª_6ª_sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY [às] HH:mm',
- LLLL: 'dddd, D [de] MMMM [de] YYYY [às] HH:mm',
- },
- calendar: {
- sameDay: '[Hoje às] LT',
- nextDay: '[Amanhã às] LT',
- nextWeek: 'dddd [às] LT',
- lastDay: '[Ontem às] LT',
- lastWeek: function () {
- return this.day() === 0 || this.day() === 6
- ? '[Último] dddd [às] LT' // Saturday + Sunday
- : '[Última] dddd [às] LT'; // Monday - Friday
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'em %s',
- past: 'há %s',
- s: 'poucos segundos',
- ss: '%d segundos',
- m: 'um minuto',
- mm: '%d minutos',
- h: 'uma hora',
- hh: '%d horas',
- d: 'um dia',
- dd: '%d dias',
- M: 'um mês',
- MM: '%d meses',
- y: 'um ano',
- yy: '%d anos',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- invalidDate: 'Data inválida',
- });
- //! moment.js locale configuration
- hooks.defineLocale('pt', {
- months: 'janeiro_fevereiro_março_abril_maio_junho_julho_agosto_setembro_outubro_novembro_dezembro'.split(
- '_'
- ),
- monthsShort: 'jan_fev_mar_abr_mai_jun_jul_ago_set_out_nov_dez'.split('_'),
- weekdays:
- 'Domingo_Segunda-feira_Terça-feira_Quarta-feira_Quinta-feira_Sexta-feira_Sábado'.split(
- '_'
- ),
- weekdaysShort: 'Dom_Seg_Ter_Qua_Qui_Sex_Sáb'.split('_'),
- weekdaysMin: 'Do_2ª_3ª_4ª_5ª_6ª_Sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D [de] MMMM [de] YYYY',
- LLL: 'D [de] MMMM [de] YYYY HH:mm',
- LLLL: 'dddd, D [de] MMMM [de] YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Hoje às] LT',
- nextDay: '[Amanhã às] LT',
- nextWeek: 'dddd [às] LT',
- lastDay: '[Ontem às] LT',
- lastWeek: function () {
- return this.day() === 0 || this.day() === 6
- ? '[Último] dddd [às] LT' // Saturday + Sunday
- : '[Última] dddd [às] LT'; // Monday - Friday
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'em %s',
- past: 'há %s',
- s: 'segundos',
- ss: '%d segundos',
- m: 'um minuto',
- mm: '%d minutos',
- h: 'uma hora',
- hh: '%d horas',
- d: 'um dia',
- dd: '%d dias',
- w: 'uma semana',
- ww: '%d semanas',
- M: 'um mês',
- MM: '%d meses',
- y: 'um ano',
- yy: '%d anos',
- },
- dayOfMonthOrdinalParse: /\d{1,2}º/,
- ordinal: '%dº',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function relativeTimeWithPlural$2(number, withoutSuffix, key) {
- var format = {
- ss: 'secunde',
- mm: 'minute',
- hh: 'ore',
- dd: 'zile',
- ww: 'săptămâni',
- MM: 'luni',
- yy: 'ani',
- },
- separator = ' ';
- if (number % 100 >= 20 || (number >= 100 && number % 100 === 0)) {
- separator = ' de ';
- }
- return number + separator + format[key];
- }
- hooks.defineLocale('ro', {
- months: 'ianuarie_februarie_martie_aprilie_mai_iunie_iulie_august_septembrie_octombrie_noiembrie_decembrie'.split(
- '_'
- ),
- monthsShort:
- 'ian._feb._mart._apr._mai_iun._iul._aug._sept._oct._nov._dec.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'duminică_luni_marți_miercuri_joi_vineri_sâmbătă'.split('_'),
- weekdaysShort: 'Dum_Lun_Mar_Mie_Joi_Vin_Sâm'.split('_'),
- weekdaysMin: 'Du_Lu_Ma_Mi_Jo_Vi_Sâ'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY H:mm',
- LLLL: 'dddd, D MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[azi la] LT',
- nextDay: '[mâine la] LT',
- nextWeek: 'dddd [la] LT',
- lastDay: '[ieri la] LT',
- lastWeek: '[fosta] dddd [la] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'peste %s',
- past: '%s în urmă',
- s: 'câteva secunde',
- ss: relativeTimeWithPlural$2,
- m: 'un minut',
- mm: relativeTimeWithPlural$2,
- h: 'o oră',
- hh: relativeTimeWithPlural$2,
- d: 'o zi',
- dd: relativeTimeWithPlural$2,
- w: 'o săptămână',
- ww: relativeTimeWithPlural$2,
- M: 'o lună',
- MM: relativeTimeWithPlural$2,
- y: 'un an',
- yy: relativeTimeWithPlural$2,
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function plural$4(word, num) {
- var forms = word.split('_');
- return num % 10 === 1 && num % 100 !== 11
- ? forms[0]
- : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
- ? forms[1]
- : forms[2];
- }
- function relativeTimeWithPlural$3(number, withoutSuffix, key) {
- var format = {
- ss: withoutSuffix ? 'секунда_секунды_секунд' : 'секунду_секунды_секунд',
- mm: withoutSuffix ? 'минута_минуты_минут' : 'минуту_минуты_минут',
- hh: 'час_часа_часов',
- dd: 'день_дня_дней',
- ww: 'неделя_недели_недель',
- MM: 'месяц_месяца_месяцев',
- yy: 'год_года_лет',
- };
- if (key === 'm') {
- return withoutSuffix ? 'минута' : 'минуту';
- } else {
- return number + ' ' + plural$4(format[key], +number);
- }
- }
- var monthsParse$b = [
- /^янв/i,
- /^фев/i,
- /^мар/i,
- /^апр/i,
- /^ма[йя]/i,
- /^июн/i,
- /^июл/i,
- /^авг/i,
- /^сен/i,
- /^окт/i,
- /^ноя/i,
- /^дек/i,
- ];
- // http://new.gramota.ru/spravka/rules/139-prop : § 103
- // Сокращения месяцев: http://new.gramota.ru/spravka/buro/search-answer?s=242637
- // CLDR data: http://www.unicode.org/cldr/charts/28/summary/ru.html#1753
- hooks.defineLocale('ru', {
- months: {
- format: 'января_февраля_марта_апреля_мая_июня_июля_августа_сентября_октября_ноября_декабря'.split(
- '_'
- ),
- standalone:
- 'январь_февраль_март_апрель_май_июнь_июль_август_сентябрь_октябрь_ноябрь_декабрь'.split(
- '_'
- ),
- },
- monthsShort: {
- // по CLDR именно "июл." и "июн.", но какой смысл менять букву на точку?
- format: 'янв._февр._мар._апр._мая_июня_июля_авг._сент._окт._нояб._дек.'.split(
- '_'
- ),
- standalone:
- 'янв._февр._март_апр._май_июнь_июль_авг._сент._окт._нояб._дек.'.split(
- '_'
- ),
- },
- weekdays: {
- standalone:
- 'воскресенье_понедельник_вторник_среда_четверг_пятница_суббота'.split(
- '_'
- ),
- format: 'воскресенье_понедельник_вторник_среду_четверг_пятницу_субботу'.split(
- '_'
- ),
- isFormat: /\[ ?[Вв] ?(?:прошлую|следующую|эту)? ?] ?dddd/,
- },
- weekdaysShort: 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
- weekdaysMin: 'вс_пн_вт_ср_чт_пт_сб'.split('_'),
- monthsParse: monthsParse$b,
- longMonthsParse: monthsParse$b,
- shortMonthsParse: monthsParse$b,
- // полные названия с падежами, по три буквы, для некоторых, по 4 буквы, сокращения с точкой и без точки
- monthsRegex:
- /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
- // копия предыдущего
- monthsShortRegex:
- /^(январ[ья]|янв\.?|феврал[ья]|февр?\.?|марта?|мар\.?|апрел[ья]|апр\.?|ма[йя]|июн[ья]|июн\.?|июл[ья]|июл\.?|августа?|авг\.?|сентябр[ья]|сент?\.?|октябр[ья]|окт\.?|ноябр[ья]|нояб?\.?|декабр[ья]|дек\.?)/i,
- // полные названия с падежами
- monthsStrictRegex:
- /^(январ[яь]|феврал[яь]|марта?|апрел[яь]|ма[яй]|июн[яь]|июл[яь]|августа?|сентябр[яь]|октябр[яь]|ноябр[яь]|декабр[яь])/i,
- // Выражение, которое соответствует только сокращённым формам
- monthsShortStrictRegex:
- /^(янв\.|февр?\.|мар[т.]|апр\.|ма[яй]|июн[ья.]|июл[ья.]|авг\.|сент?\.|окт\.|нояб?\.|дек\.)/i,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY г.',
- LLL: 'D MMMM YYYY г., H:mm',
- LLLL: 'dddd, D MMMM YYYY г., H:mm',
- },
- calendar: {
- sameDay: '[Сегодня, в] LT',
- nextDay: '[Завтра, в] LT',
- lastDay: '[Вчера, в] LT',
- nextWeek: function (now) {
- if (now.week() !== this.week()) {
- switch (this.day()) {
- case 0:
- return '[В следующее] dddd, [в] LT';
- case 1:
- case 2:
- case 4:
- return '[В следующий] dddd, [в] LT';
- case 3:
- case 5:
- case 6:
- return '[В следующую] dddd, [в] LT';
- }
- } else {
- if (this.day() === 2) {
- return '[Во] dddd, [в] LT';
- } else {
- return '[В] dddd, [в] LT';
- }
- }
- },
- lastWeek: function (now) {
- if (now.week() !== this.week()) {
- switch (this.day()) {
- case 0:
- return '[В прошлое] dddd, [в] LT';
- case 1:
- case 2:
- case 4:
- return '[В прошлый] dddd, [в] LT';
- case 3:
- case 5:
- case 6:
- return '[В прошлую] dddd, [в] LT';
- }
- } else {
- if (this.day() === 2) {
- return '[Во] dddd, [в] LT';
- } else {
- return '[В] dddd, [в] LT';
- }
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'через %s',
- past: '%s назад',
- s: 'несколько секунд',
- ss: relativeTimeWithPlural$3,
- m: relativeTimeWithPlural$3,
- mm: relativeTimeWithPlural$3,
- h: 'час',
- hh: relativeTimeWithPlural$3,
- d: 'день',
- dd: relativeTimeWithPlural$3,
- w: 'неделя',
- ww: relativeTimeWithPlural$3,
- M: 'месяц',
- MM: relativeTimeWithPlural$3,
- y: 'год',
- yy: relativeTimeWithPlural$3,
- },
- meridiemParse: /ночи|утра|дня|вечера/i,
- isPM: function (input) {
- return /^(дня|вечера)$/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'ночи';
- } else if (hour < 12) {
- return 'утра';
- } else if (hour < 17) {
- return 'дня';
- } else {
- return 'вечера';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(й|го|я)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'M':
- case 'd':
- case 'DDD':
- return number + '-й';
- case 'D':
- return number + '-го';
- case 'w':
- case 'W':
- return number + '-я';
- default:
- return number;
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var months$9 = [
- 'جنوري',
- 'فيبروري',
- 'مارچ',
- 'اپريل',
- 'مئي',
- 'جون',
- 'جولاءِ',
- 'آگسٽ',
- 'سيپٽمبر',
- 'آڪٽوبر',
- 'نومبر',
- 'ڊسمبر',
- ],
- days$1 = ['آچر', 'سومر', 'اڱارو', 'اربع', 'خميس', 'جمع', 'ڇنڇر'];
- hooks.defineLocale('sd', {
- months: months$9,
- monthsShort: months$9,
- weekdays: days$1,
- weekdaysShort: days$1,
- weekdaysMin: days$1,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd، D MMMM YYYY HH:mm',
- },
- meridiemParse: /صبح|شام/,
- isPM: function (input) {
- return 'شام' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'صبح';
- }
- return 'شام';
- },
- calendar: {
- sameDay: '[اڄ] LT',
- nextDay: '[سڀاڻي] LT',
- nextWeek: 'dddd [اڳين هفتي تي] LT',
- lastDay: '[ڪالهه] LT',
- lastWeek: '[گزريل هفتي] dddd [تي] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s پوء',
- past: '%s اڳ',
- s: 'چند سيڪنڊ',
- ss: '%d سيڪنڊ',
- m: 'هڪ منٽ',
- mm: '%d منٽ',
- h: 'هڪ ڪلاڪ',
- hh: '%d ڪلاڪ',
- d: 'هڪ ڏينهن',
- dd: '%d ڏينهن',
- M: 'هڪ مهينو',
- MM: '%d مهينا',
- y: 'هڪ سال',
- yy: '%d سال',
- },
- preparse: function (string) {
- return string.replace(/،/g, ',');
- },
- postformat: function (string) {
- return string.replace(/,/g, '،');
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('se', {
- months: 'ođđajagemánnu_guovvamánnu_njukčamánnu_cuoŋománnu_miessemánnu_geassemánnu_suoidnemánnu_borgemánnu_čakčamánnu_golggotmánnu_skábmamánnu_juovlamánnu'.split(
- '_'
- ),
- monthsShort:
- 'ođđj_guov_njuk_cuo_mies_geas_suoi_borg_čakč_golg_skáb_juov'.split('_'),
- weekdays:
- 'sotnabeaivi_vuossárga_maŋŋebárga_gaskavahkku_duorastat_bearjadat_lávvardat'.split(
- '_'
- ),
- weekdaysShort: 'sotn_vuos_maŋ_gask_duor_bear_láv'.split('_'),
- weekdaysMin: 's_v_m_g_d_b_L'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'MMMM D. [b.] YYYY',
- LLL: 'MMMM D. [b.] YYYY [ti.] HH:mm',
- LLLL: 'dddd, MMMM D. [b.] YYYY [ti.] HH:mm',
- },
- calendar: {
- sameDay: '[otne ti] LT',
- nextDay: '[ihttin ti] LT',
- nextWeek: 'dddd [ti] LT',
- lastDay: '[ikte ti] LT',
- lastWeek: '[ovddit] dddd [ti] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s geažes',
- past: 'maŋit %s',
- s: 'moadde sekunddat',
- ss: '%d sekunddat',
- m: 'okta minuhta',
- mm: '%d minuhtat',
- h: 'okta diimmu',
- hh: '%d diimmut',
- d: 'okta beaivi',
- dd: '%d beaivvit',
- M: 'okta mánnu',
- MM: '%d mánut',
- y: 'okta jahki',
- yy: '%d jagit',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- /*jshint -W100*/
- hooks.defineLocale('si', {
- months: 'ජනවාරි_පෙබරවාරි_මාර්තු_අප්රේල්_මැයි_ජූනි_ජූලි_අගෝස්තු_සැප්තැම්බර්_ඔක්තෝබර්_නොවැම්බර්_දෙසැම්බර්'.split(
- '_'
- ),
- monthsShort: 'ජන_පෙබ_මාර්_අප්_මැයි_ජූනි_ජූලි_අගෝ_සැප්_ඔක්_නොවැ_දෙසැ'.split(
- '_'
- ),
- weekdays:
- 'ඉරිදා_සඳුදා_අඟහරුවාදා_බදාදා_බ්රහස්පතින්දා_සිකුරාදා_සෙනසුරාදා'.split(
- '_'
- ),
- weekdaysShort: 'ඉරි_සඳු_අඟ_බදා_බ්රහ_සිකු_සෙන'.split('_'),
- weekdaysMin: 'ඉ_ස_අ_බ_බ්ර_සි_සෙ'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'a h:mm',
- LTS: 'a h:mm:ss',
- L: 'YYYY/MM/DD',
- LL: 'YYYY MMMM D',
- LLL: 'YYYY MMMM D, a h:mm',
- LLLL: 'YYYY MMMM D [වැනි] dddd, a h:mm:ss',
- },
- calendar: {
- sameDay: '[අද] LT[ට]',
- nextDay: '[හෙට] LT[ට]',
- nextWeek: 'dddd LT[ට]',
- lastDay: '[ඊයේ] LT[ට]',
- lastWeek: '[පසුගිය] dddd LT[ට]',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%sකින්',
- past: '%sකට පෙර',
- s: 'තත්පර කිහිපය',
- ss: 'තත්පර %d',
- m: 'මිනිත්තුව',
- mm: 'මිනිත්තු %d',
- h: 'පැය',
- hh: 'පැය %d',
- d: 'දිනය',
- dd: 'දින %d',
- M: 'මාසය',
- MM: 'මාස %d',
- y: 'වසර',
- yy: 'වසර %d',
- },
- dayOfMonthOrdinalParse: /\d{1,2} වැනි/,
- ordinal: function (number) {
- return number + ' වැනි';
- },
- meridiemParse: /පෙර වරු|පස් වරු|පෙ.ව|ප.ව./,
- isPM: function (input) {
- return input === 'ප.ව.' || input === 'පස් වරු';
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours > 11) {
- return isLower ? 'ප.ව.' : 'පස් වරු';
- } else {
- return isLower ? 'පෙ.ව.' : 'පෙර වරු';
- }
- },
- });
- //! moment.js locale configuration
- var months$a =
- 'január_február_marec_apríl_máj_jún_júl_august_september_október_november_december'.split(
- '_'
- ),
- monthsShort$7 = 'jan_feb_mar_apr_máj_jún_júl_aug_sep_okt_nov_dec'.split('_');
- function plural$5(n) {
- return n > 1 && n < 5;
- }
- function translate$9(number, withoutSuffix, key, isFuture) {
- var result = number + ' ';
- switch (key) {
- case 's': // a few seconds / in a few seconds / a few seconds ago
- return withoutSuffix || isFuture ? 'pár sekúnd' : 'pár sekundami';
- case 'ss': // 9 seconds / in 9 seconds / 9 seconds ago
- if (withoutSuffix || isFuture) {
- return result + (plural$5(number) ? 'sekundy' : 'sekúnd');
- } else {
- return result + 'sekundami';
- }
- case 'm': // a minute / in a minute / a minute ago
- return withoutSuffix ? 'minúta' : isFuture ? 'minútu' : 'minútou';
- case 'mm': // 9 minutes / in 9 minutes / 9 minutes ago
- if (withoutSuffix || isFuture) {
- return result + (plural$5(number) ? 'minúty' : 'minút');
- } else {
- return result + 'minútami';
- }
- case 'h': // an hour / in an hour / an hour ago
- return withoutSuffix ? 'hodina' : isFuture ? 'hodinu' : 'hodinou';
- case 'hh': // 9 hours / in 9 hours / 9 hours ago
- if (withoutSuffix || isFuture) {
- return result + (plural$5(number) ? 'hodiny' : 'hodín');
- } else {
- return result + 'hodinami';
- }
- case 'd': // a day / in a day / a day ago
- return withoutSuffix || isFuture ? 'deň' : 'dňom';
- case 'dd': // 9 days / in 9 days / 9 days ago
- if (withoutSuffix || isFuture) {
- return result + (plural$5(number) ? 'dni' : 'dní');
- } else {
- return result + 'dňami';
- }
- case 'M': // a month / in a month / a month ago
- return withoutSuffix || isFuture ? 'mesiac' : 'mesiacom';
- case 'MM': // 9 months / in 9 months / 9 months ago
- if (withoutSuffix || isFuture) {
- return result + (plural$5(number) ? 'mesiace' : 'mesiacov');
- } else {
- return result + 'mesiacmi';
- }
- case 'y': // a year / in a year / a year ago
- return withoutSuffix || isFuture ? 'rok' : 'rokom';
- case 'yy': // 9 years / in 9 years / 9 years ago
- if (withoutSuffix || isFuture) {
- return result + (plural$5(number) ? 'roky' : 'rokov');
- } else {
- return result + 'rokmi';
- }
- }
- }
- hooks.defineLocale('sk', {
- months: months$a,
- monthsShort: monthsShort$7,
- weekdays: 'nedeľa_pondelok_utorok_streda_štvrtok_piatok_sobota'.split('_'),
- weekdaysShort: 'ne_po_ut_st_št_pi_so'.split('_'),
- weekdaysMin: 'ne_po_ut_st_št_pi_so'.split('_'),
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd D. MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[dnes o] LT',
- nextDay: '[zajtra o] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[v nedeľu o] LT';
- case 1:
- case 2:
- return '[v] dddd [o] LT';
- case 3:
- return '[v stredu o] LT';
- case 4:
- return '[vo štvrtok o] LT';
- case 5:
- return '[v piatok o] LT';
- case 6:
- return '[v sobotu o] LT';
- }
- },
- lastDay: '[včera o] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return '[minulú nedeľu o] LT';
- case 1:
- case 2:
- return '[minulý] dddd [o] LT';
- case 3:
- return '[minulú stredu o] LT';
- case 4:
- case 5:
- return '[minulý] dddd [o] LT';
- case 6:
- return '[minulú sobotu o] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: 'pred %s',
- s: translate$9,
- ss: translate$9,
- m: translate$9,
- mm: translate$9,
- h: translate$9,
- hh: translate$9,
- d: translate$9,
- dd: translate$9,
- M: translate$9,
- MM: translate$9,
- y: translate$9,
- yy: translate$9,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function processRelativeTime$7(number, withoutSuffix, key, isFuture) {
- var result = number + ' ';
- switch (key) {
- case 's':
- return withoutSuffix || isFuture
- ? 'nekaj sekund'
- : 'nekaj sekundami';
- case 'ss':
- if (number === 1) {
- result += withoutSuffix ? 'sekundo' : 'sekundi';
- } else if (number === 2) {
- result += withoutSuffix || isFuture ? 'sekundi' : 'sekundah';
- } else if (number < 5) {
- result += withoutSuffix || isFuture ? 'sekunde' : 'sekundah';
- } else {
- result += 'sekund';
- }
- return result;
- case 'm':
- return withoutSuffix ? 'ena minuta' : 'eno minuto';
- case 'mm':
- if (number === 1) {
- result += withoutSuffix ? 'minuta' : 'minuto';
- } else if (number === 2) {
- result += withoutSuffix || isFuture ? 'minuti' : 'minutama';
- } else if (number < 5) {
- result += withoutSuffix || isFuture ? 'minute' : 'minutami';
- } else {
- result += withoutSuffix || isFuture ? 'minut' : 'minutami';
- }
- return result;
- case 'h':
- return withoutSuffix ? 'ena ura' : 'eno uro';
- case 'hh':
- if (number === 1) {
- result += withoutSuffix ? 'ura' : 'uro';
- } else if (number === 2) {
- result += withoutSuffix || isFuture ? 'uri' : 'urama';
- } else if (number < 5) {
- result += withoutSuffix || isFuture ? 'ure' : 'urami';
- } else {
- result += withoutSuffix || isFuture ? 'ur' : 'urami';
- }
- return result;
- case 'd':
- return withoutSuffix || isFuture ? 'en dan' : 'enim dnem';
- case 'dd':
- if (number === 1) {
- result += withoutSuffix || isFuture ? 'dan' : 'dnem';
- } else if (number === 2) {
- result += withoutSuffix || isFuture ? 'dni' : 'dnevoma';
- } else {
- result += withoutSuffix || isFuture ? 'dni' : 'dnevi';
- }
- return result;
- case 'M':
- return withoutSuffix || isFuture ? 'en mesec' : 'enim mesecem';
- case 'MM':
- if (number === 1) {
- result += withoutSuffix || isFuture ? 'mesec' : 'mesecem';
- } else if (number === 2) {
- result += withoutSuffix || isFuture ? 'meseca' : 'mesecema';
- } else if (number < 5) {
- result += withoutSuffix || isFuture ? 'mesece' : 'meseci';
- } else {
- result += withoutSuffix || isFuture ? 'mesecev' : 'meseci';
- }
- return result;
- case 'y':
- return withoutSuffix || isFuture ? 'eno leto' : 'enim letom';
- case 'yy':
- if (number === 1) {
- result += withoutSuffix || isFuture ? 'leto' : 'letom';
- } else if (number === 2) {
- result += withoutSuffix || isFuture ? 'leti' : 'letoma';
- } else if (number < 5) {
- result += withoutSuffix || isFuture ? 'leta' : 'leti';
- } else {
- result += withoutSuffix || isFuture ? 'let' : 'leti';
- }
- return result;
- }
- }
- hooks.defineLocale('sl', {
- months: 'januar_februar_marec_april_maj_junij_julij_avgust_september_oktober_november_december'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._mar._apr._maj._jun._jul._avg._sep._okt._nov._dec.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'nedelja_ponedeljek_torek_sreda_četrtek_petek_sobota'.split('_'),
- weekdaysShort: 'ned._pon._tor._sre._čet._pet._sob.'.split('_'),
- weekdaysMin: 'ne_po_to_sr_če_pe_so'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD. MM. YYYY',
- LL: 'D. MMMM YYYY',
- LLL: 'D. MMMM YYYY H:mm',
- LLLL: 'dddd, D. MMMM YYYY H:mm',
- },
- calendar: {
- sameDay: '[danes ob] LT',
- nextDay: '[jutri ob] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[v] [nedeljo] [ob] LT';
- case 3:
- return '[v] [sredo] [ob] LT';
- case 6:
- return '[v] [soboto] [ob] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[v] dddd [ob] LT';
- }
- },
- lastDay: '[včeraj ob] LT',
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- return '[prejšnjo] [nedeljo] [ob] LT';
- case 3:
- return '[prejšnjo] [sredo] [ob] LT';
- case 6:
- return '[prejšnjo] [soboto] [ob] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[prejšnji] dddd [ob] LT';
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'čez %s',
- past: 'pred %s',
- s: processRelativeTime$7,
- ss: processRelativeTime$7,
- m: processRelativeTime$7,
- mm: processRelativeTime$7,
- h: processRelativeTime$7,
- hh: processRelativeTime$7,
- d: processRelativeTime$7,
- dd: processRelativeTime$7,
- M: processRelativeTime$7,
- MM: processRelativeTime$7,
- y: processRelativeTime$7,
- yy: processRelativeTime$7,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('sq', {
- months: 'Janar_Shkurt_Mars_Prill_Maj_Qershor_Korrik_Gusht_Shtator_Tetor_Nëntor_Dhjetor'.split(
- '_'
- ),
- monthsShort: 'Jan_Shk_Mar_Pri_Maj_Qer_Kor_Gus_Sht_Tet_Nën_Dhj'.split('_'),
- weekdays: 'E Diel_E Hënë_E Martë_E Mërkurë_E Enjte_E Premte_E Shtunë'.split(
- '_'
- ),
- weekdaysShort: 'Die_Hën_Mar_Mër_Enj_Pre_Sht'.split('_'),
- weekdaysMin: 'D_H_Ma_Më_E_P_Sh'.split('_'),
- weekdaysParseExact: true,
- meridiemParse: /PD|MD/,
- isPM: function (input) {
- return input.charAt(0) === 'M';
- },
- meridiem: function (hours, minutes, isLower) {
- return hours < 12 ? 'PD' : 'MD';
- },
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Sot në] LT',
- nextDay: '[Nesër në] LT',
- nextWeek: 'dddd [në] LT',
- lastDay: '[Dje në] LT',
- lastWeek: 'dddd [e kaluar në] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'në %s',
- past: '%s më parë',
- s: 'disa sekonda',
- ss: '%d sekonda',
- m: 'një minutë',
- mm: '%d minuta',
- h: 'një orë',
- hh: '%d orë',
- d: 'një ditë',
- dd: '%d ditë',
- M: 'një muaj',
- MM: '%d muaj',
- y: 'një vit',
- yy: '%d vite',
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var translator$1 = {
- words: {
- //Different grammatical cases
- ss: ['секунда', 'секунде', 'секунди'],
- m: ['један минут', 'једног минута'],
- mm: ['минут', 'минута', 'минута'],
- h: ['један сат', 'једног сата'],
- hh: ['сат', 'сата', 'сати'],
- d: ['један дан', 'једног дана'],
- dd: ['дан', 'дана', 'дана'],
- M: ['један месец', 'једног месеца'],
- MM: ['месец', 'месеца', 'месеци'],
- y: ['једну годину', 'једне године'],
- yy: ['годину', 'године', 'година'],
- },
- correctGrammaticalCase: function (number, wordKey) {
- if (
- number % 10 >= 1 &&
- number % 10 <= 4 &&
- (number % 100 < 10 || number % 100 >= 20)
- ) {
- return number % 10 === 1 ? wordKey[0] : wordKey[1];
- }
- return wordKey[2];
- },
- translate: function (number, withoutSuffix, key, isFuture) {
- var wordKey = translator$1.words[key],
- word;
- if (key.length === 1) {
- // Nominativ
- if (key === 'y' && withoutSuffix) return 'једна година';
- return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
- }
- word = translator$1.correctGrammaticalCase(number, wordKey);
- // Nominativ
- if (key === 'yy' && withoutSuffix && word === 'годину') {
- return number + ' година';
- }
- return number + ' ' + word;
- },
- };
- hooks.defineLocale('sr-cyrl', {
- months: 'јануар_фебруар_март_април_мај_јун_јул_август_септембар_октобар_новембар_децембар'.split(
- '_'
- ),
- monthsShort:
- 'јан._феб._мар._апр._мај_јун_јул_авг._сеп._окт._нов._дец.'.split('_'),
- monthsParseExact: true,
- weekdays: 'недеља_понедељак_уторак_среда_четвртак_петак_субота'.split('_'),
- weekdaysShort: 'нед._пон._уто._сре._чет._пет._суб.'.split('_'),
- weekdaysMin: 'не_по_ут_ср_че_пе_су'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'D. M. YYYY.',
- LL: 'D. MMMM YYYY.',
- LLL: 'D. MMMM YYYY. H:mm',
- LLLL: 'dddd, D. MMMM YYYY. H:mm',
- },
- calendar: {
- sameDay: '[данас у] LT',
- nextDay: '[сутра у] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[у] [недељу] [у] LT';
- case 3:
- return '[у] [среду] [у] LT';
- case 6:
- return '[у] [суботу] [у] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[у] dddd [у] LT';
- }
- },
- lastDay: '[јуче у] LT',
- lastWeek: function () {
- var lastWeekDays = [
- '[прошле] [недеље] [у] LT',
- '[прошлог] [понедељка] [у] LT',
- '[прошлог] [уторка] [у] LT',
- '[прошле] [среде] [у] LT',
- '[прошлог] [четвртка] [у] LT',
- '[прошлог] [петка] [у] LT',
- '[прошле] [суботе] [у] LT',
- ];
- return lastWeekDays[this.day()];
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'за %s',
- past: 'пре %s',
- s: 'неколико секунди',
- ss: translator$1.translate,
- m: translator$1.translate,
- mm: translator$1.translate,
- h: translator$1.translate,
- hh: translator$1.translate,
- d: translator$1.translate,
- dd: translator$1.translate,
- M: translator$1.translate,
- MM: translator$1.translate,
- y: translator$1.translate,
- yy: translator$1.translate,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 1st is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var translator$2 = {
- words: {
- //Different grammatical cases
- ss: ['sekunda', 'sekunde', 'sekundi'],
- m: ['jedan minut', 'jednog minuta'],
- mm: ['minut', 'minuta', 'minuta'],
- h: ['jedan sat', 'jednog sata'],
- hh: ['sat', 'sata', 'sati'],
- d: ['jedan dan', 'jednog dana'],
- dd: ['dan', 'dana', 'dana'],
- M: ['jedan mesec', 'jednog meseca'],
- MM: ['mesec', 'meseca', 'meseci'],
- y: ['jednu godinu', 'jedne godine'],
- yy: ['godinu', 'godine', 'godina'],
- },
- correctGrammaticalCase: function (number, wordKey) {
- if (
- number % 10 >= 1 &&
- number % 10 <= 4 &&
- (number % 100 < 10 || number % 100 >= 20)
- ) {
- return number % 10 === 1 ? wordKey[0] : wordKey[1];
- }
- return wordKey[2];
- },
- translate: function (number, withoutSuffix, key, isFuture) {
- var wordKey = translator$2.words[key],
- word;
- if (key.length === 1) {
- // Nominativ
- if (key === 'y' && withoutSuffix) return 'jedna godina';
- return isFuture || withoutSuffix ? wordKey[0] : wordKey[1];
- }
- word = translator$2.correctGrammaticalCase(number, wordKey);
- // Nominativ
- if (key === 'yy' && withoutSuffix && word === 'godinu') {
- return number + ' godina';
- }
- return number + ' ' + word;
- },
- };
- hooks.defineLocale('sr', {
- months: 'januar_februar_mart_april_maj_jun_jul_avgust_septembar_oktobar_novembar_decembar'.split(
- '_'
- ),
- monthsShort:
- 'jan._feb._mar._apr._maj_jun_jul_avg._sep._okt._nov._dec.'.split('_'),
- monthsParseExact: true,
- weekdays: 'nedelja_ponedeljak_utorak_sreda_četvrtak_petak_subota'.split(
- '_'
- ),
- weekdaysShort: 'ned._pon._uto._sre._čet._pet._sub.'.split('_'),
- weekdaysMin: 'ne_po_ut_sr_če_pe_su'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'D. M. YYYY.',
- LL: 'D. MMMM YYYY.',
- LLL: 'D. MMMM YYYY. H:mm',
- LLLL: 'dddd, D. MMMM YYYY. H:mm',
- },
- calendar: {
- sameDay: '[danas u] LT',
- nextDay: '[sutra u] LT',
- nextWeek: function () {
- switch (this.day()) {
- case 0:
- return '[u] [nedelju] [u] LT';
- case 3:
- return '[u] [sredu] [u] LT';
- case 6:
- return '[u] [subotu] [u] LT';
- case 1:
- case 2:
- case 4:
- case 5:
- return '[u] dddd [u] LT';
- }
- },
- lastDay: '[juče u] LT',
- lastWeek: function () {
- var lastWeekDays = [
- '[prošle] [nedelje] [u] LT',
- '[prošlog] [ponedeljka] [u] LT',
- '[prošlog] [utorka] [u] LT',
- '[prošle] [srede] [u] LT',
- '[prošlog] [četvrtka] [u] LT',
- '[prošlog] [petka] [u] LT',
- '[prošle] [subote] [u] LT',
- ];
- return lastWeekDays[this.day()];
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'za %s',
- past: 'pre %s',
- s: 'nekoliko sekundi',
- ss: translator$2.translate,
- m: translator$2.translate,
- mm: translator$2.translate,
- h: translator$2.translate,
- hh: translator$2.translate,
- d: translator$2.translate,
- dd: translator$2.translate,
- M: translator$2.translate,
- MM: translator$2.translate,
- y: translator$2.translate,
- yy: translator$2.translate,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ss', {
- months: "Bhimbidvwane_Indlovana_Indlov'lenkhulu_Mabasa_Inkhwekhweti_Inhlaba_Kholwane_Ingci_Inyoni_Imphala_Lweti_Ingongoni".split(
- '_'
- ),
- monthsShort: 'Bhi_Ina_Inu_Mab_Ink_Inh_Kho_Igc_Iny_Imp_Lwe_Igo'.split('_'),
- weekdays:
- 'Lisontfo_Umsombuluko_Lesibili_Lesitsatfu_Lesine_Lesihlanu_Umgcibelo'.split(
- '_'
- ),
- weekdaysShort: 'Lis_Umb_Lsb_Les_Lsi_Lsh_Umg'.split('_'),
- weekdaysMin: 'Li_Us_Lb_Lt_Ls_Lh_Ug'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY h:mm A',
- LLLL: 'dddd, D MMMM YYYY h:mm A',
- },
- calendar: {
- sameDay: '[Namuhla nga] LT',
- nextDay: '[Kusasa nga] LT',
- nextWeek: 'dddd [nga] LT',
- lastDay: '[Itolo nga] LT',
- lastWeek: 'dddd [leliphelile] [nga] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'nga %s',
- past: 'wenteka nga %s',
- s: 'emizuzwana lomcane',
- ss: '%d mzuzwana',
- m: 'umzuzu',
- mm: '%d emizuzu',
- h: 'lihora',
- hh: '%d emahora',
- d: 'lilanga',
- dd: '%d emalanga',
- M: 'inyanga',
- MM: '%d tinyanga',
- y: 'umnyaka',
- yy: '%d iminyaka',
- },
- meridiemParse: /ekuseni|emini|entsambama|ebusuku/,
- meridiem: function (hours, minutes, isLower) {
- if (hours < 11) {
- return 'ekuseni';
- } else if (hours < 15) {
- return 'emini';
- } else if (hours < 19) {
- return 'entsambama';
- } else {
- return 'ebusuku';
- }
- },
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'ekuseni') {
- return hour;
- } else if (meridiem === 'emini') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === 'entsambama' || meridiem === 'ebusuku') {
- if (hour === 0) {
- return 0;
- }
- return hour + 12;
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}/,
- ordinal: '%d',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('sv', {
- months: 'januari_februari_mars_april_maj_juni_juli_augusti_september_oktober_november_december'.split(
- '_'
- ),
- monthsShort: 'jan_feb_mar_apr_maj_jun_jul_aug_sep_okt_nov_dec'.split('_'),
- weekdays: 'söndag_måndag_tisdag_onsdag_torsdag_fredag_lördag'.split('_'),
- weekdaysShort: 'sön_mån_tis_ons_tor_fre_lör'.split('_'),
- weekdaysMin: 'sö_må_ti_on_to_fr_lö'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY [kl.] HH:mm',
- LLLL: 'dddd D MMMM YYYY [kl.] HH:mm',
- lll: 'D MMM YYYY HH:mm',
- llll: 'ddd D MMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Idag] LT',
- nextDay: '[Imorgon] LT',
- lastDay: '[Igår] LT',
- nextWeek: '[På] dddd LT',
- lastWeek: '[I] dddd[s] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'om %s',
- past: 'för %s sedan',
- s: 'några sekunder',
- ss: '%d sekunder',
- m: 'en minut',
- mm: '%d minuter',
- h: 'en timme',
- hh: '%d timmar',
- d: 'en dag',
- dd: '%d dagar',
- M: 'en månad',
- MM: '%d månader',
- y: 'ett år',
- yy: '%d år',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(\:e|\:a)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? ':e'
- : b === 1
- ? ':a'
- : b === 2
- ? ':a'
- : b === 3
- ? ':e'
- : ':e';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('sw', {
- months: 'Januari_Februari_Machi_Aprili_Mei_Juni_Julai_Agosti_Septemba_Oktoba_Novemba_Desemba'.split(
- '_'
- ),
- monthsShort: 'Jan_Feb_Mac_Apr_Mei_Jun_Jul_Ago_Sep_Okt_Nov_Des'.split('_'),
- weekdays:
- 'Jumapili_Jumatatu_Jumanne_Jumatano_Alhamisi_Ijumaa_Jumamosi'.split(
- '_'
- ),
- weekdaysShort: 'Jpl_Jtat_Jnne_Jtan_Alh_Ijm_Jmos'.split('_'),
- weekdaysMin: 'J2_J3_J4_J5_Al_Ij_J1'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'hh:mm A',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[leo saa] LT',
- nextDay: '[kesho saa] LT',
- nextWeek: '[wiki ijayo] dddd [saat] LT',
- lastDay: '[jana] LT',
- lastWeek: '[wiki iliyopita] dddd [saat] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s baadaye',
- past: 'tokea %s',
- s: 'hivi punde',
- ss: 'sekunde %d',
- m: 'dakika moja',
- mm: 'dakika %d',
- h: 'saa limoja',
- hh: 'masaa %d',
- d: 'siku moja',
- dd: 'siku %d',
- M: 'mwezi mmoja',
- MM: 'miezi %d',
- y: 'mwaka mmoja',
- yy: 'miaka %d',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var symbolMap$g = {
- 1: '௧',
- 2: '௨',
- 3: '௩',
- 4: '௪',
- 5: '௫',
- 6: '௬',
- 7: '௭',
- 8: '௮',
- 9: '௯',
- 0: '௦',
- },
- numberMap$f = {
- '௧': '1',
- '௨': '2',
- '௩': '3',
- '௪': '4',
- '௫': '5',
- '௬': '6',
- '௭': '7',
- '௮': '8',
- '௯': '9',
- '௦': '0',
- };
- hooks.defineLocale('ta', {
- months: 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split(
- '_'
- ),
- monthsShort:
- 'ஜனவரி_பிப்ரவரி_மார்ச்_ஏப்ரல்_மே_ஜூன்_ஜூலை_ஆகஸ்ட்_செப்டெம்பர்_அக்டோபர்_நவம்பர்_டிசம்பர்'.split(
- '_'
- ),
- weekdays:
- 'ஞாயிற்றுக்கிழமை_திங்கட்கிழமை_செவ்வாய்கிழமை_புதன்கிழமை_வியாழக்கிழமை_வெள்ளிக்கிழமை_சனிக்கிழமை'.split(
- '_'
- ),
- weekdaysShort: 'ஞாயிறு_திங்கள்_செவ்வாய்_புதன்_வியாழன்_வெள்ளி_சனி'.split(
- '_'
- ),
- weekdaysMin: 'ஞா_தி_செ_பு_வி_வெ_ச'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, HH:mm',
- LLLL: 'dddd, D MMMM YYYY, HH:mm',
- },
- calendar: {
- sameDay: '[இன்று] LT',
- nextDay: '[நாளை] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[நேற்று] LT',
- lastWeek: '[கடந்த வாரம்] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s இல்',
- past: '%s முன்',
- s: 'ஒரு சில விநாடிகள்',
- ss: '%d விநாடிகள்',
- m: 'ஒரு நிமிடம்',
- mm: '%d நிமிடங்கள்',
- h: 'ஒரு மணி நேரம்',
- hh: '%d மணி நேரம்',
- d: 'ஒரு நாள்',
- dd: '%d நாட்கள்',
- M: 'ஒரு மாதம்',
- MM: '%d மாதங்கள்',
- y: 'ஒரு வருடம்',
- yy: '%d ஆண்டுகள்',
- },
- dayOfMonthOrdinalParse: /\d{1,2}வது/,
- ordinal: function (number) {
- return number + 'வது';
- },
- preparse: function (string) {
- return string.replace(/[௧௨௩௪௫௬௭௮௯௦]/g, function (match) {
- return numberMap$f[match];
- });
- },
- postformat: function (string) {
- return string.replace(/\d/g, function (match) {
- return symbolMap$g[match];
- });
- },
- // refer http://ta.wikipedia.org/s/1er1
- meridiemParse: /யாமம்|வைகறை|காலை|நண்பகல்|எற்பாடு|மாலை/,
- meridiem: function (hour, minute, isLower) {
- if (hour < 2) {
- return ' யாமம்';
- } else if (hour < 6) {
- return ' வைகறை'; // வைகறை
- } else if (hour < 10) {
- return ' காலை'; // காலை
- } else if (hour < 14) {
- return ' நண்பகல்'; // நண்பகல்
- } else if (hour < 18) {
- return ' எற்பாடு'; // எற்பாடு
- } else if (hour < 22) {
- return ' மாலை'; // மாலை
- } else {
- return ' யாமம்';
- }
- },
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'யாமம்') {
- return hour < 2 ? hour : hour + 12;
- } else if (meridiem === 'வைகறை' || meridiem === 'காலை') {
- return hour;
- } else if (meridiem === 'நண்பகல்') {
- return hour >= 10 ? hour : hour + 12;
- } else {
- return hour + 12;
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('te', {
- months: 'జనవరి_ఫిబ్రవరి_మార్చి_ఏప్రిల్_మే_జూన్_జులై_ఆగస్టు_సెప్టెంబర్_అక్టోబర్_నవంబర్_డిసెంబర్'.split(
- '_'
- ),
- monthsShort:
- 'జన._ఫిబ్ర._మార్చి_ఏప్రి._మే_జూన్_జులై_ఆగ._సెప్._అక్టో._నవ._డిసె.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays:
- 'ఆదివారం_సోమవారం_మంగళవారం_బుధవారం_గురువారం_శుక్రవారం_శనివారం'.split(
- '_'
- ),
- weekdaysShort: 'ఆది_సోమ_మంగళ_బుధ_గురు_శుక్ర_శని'.split('_'),
- weekdaysMin: 'ఆ_సో_మం_బు_గు_శు_శ'.split('_'),
- longDateFormat: {
- LT: 'A h:mm',
- LTS: 'A h:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY, A h:mm',
- LLLL: 'dddd, D MMMM YYYY, A h:mm',
- },
- calendar: {
- sameDay: '[నేడు] LT',
- nextDay: '[రేపు] LT',
- nextWeek: 'dddd, LT',
- lastDay: '[నిన్న] LT',
- lastWeek: '[గత] dddd, LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s లో',
- past: '%s క్రితం',
- s: 'కొన్ని క్షణాలు',
- ss: '%d సెకన్లు',
- m: 'ఒక నిమిషం',
- mm: '%d నిమిషాలు',
- h: 'ఒక గంట',
- hh: '%d గంటలు',
- d: 'ఒక రోజు',
- dd: '%d రోజులు',
- M: 'ఒక నెల',
- MM: '%d నెలలు',
- y: 'ఒక సంవత్సరం',
- yy: '%d సంవత్సరాలు',
- },
- dayOfMonthOrdinalParse: /\d{1,2}వ/,
- ordinal: '%dవ',
- meridiemParse: /రాత్రి|ఉదయం|మధ్యాహ్నం|సాయంత్రం/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'రాత్రి') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'ఉదయం') {
- return hour;
- } else if (meridiem === 'మధ్యాహ్నం') {
- return hour >= 10 ? hour : hour + 12;
- } else if (meridiem === 'సాయంత్రం') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'రాత్రి';
- } else if (hour < 10) {
- return 'ఉదయం';
- } else if (hour < 17) {
- return 'మధ్యాహ్నం';
- } else if (hour < 20) {
- return 'సాయంత్రం';
- } else {
- return 'రాత్రి';
- }
- },
- week: {
- dow: 0, // Sunday is the first day of the week.
- doy: 6, // The week that contains Jan 6th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('tet', {
- months: 'Janeiru_Fevereiru_Marsu_Abril_Maiu_Juñu_Jullu_Agustu_Setembru_Outubru_Novembru_Dezembru'.split(
- '_'
- ),
- monthsShort: 'Jan_Fev_Mar_Abr_Mai_Jun_Jul_Ago_Set_Out_Nov_Dez'.split('_'),
- weekdays: 'Domingu_Segunda_Tersa_Kuarta_Kinta_Sesta_Sabadu'.split('_'),
- weekdaysShort: 'Dom_Seg_Ters_Kua_Kint_Sest_Sab'.split('_'),
- weekdaysMin: 'Do_Seg_Te_Ku_Ki_Ses_Sa'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Ohin iha] LT',
- nextDay: '[Aban iha] LT',
- nextWeek: 'dddd [iha] LT',
- lastDay: '[Horiseik iha] LT',
- lastWeek: 'dddd [semana kotuk] [iha] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'iha %s',
- past: '%s liuba',
- s: 'segundu balun',
- ss: 'segundu %d',
- m: 'minutu ida',
- mm: 'minutu %d',
- h: 'oras ida',
- hh: 'oras %d',
- d: 'loron ida',
- dd: 'loron %d',
- M: 'fulan ida',
- MM: 'fulan %d',
- y: 'tinan ida',
- yy: 'tinan %d',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(st|nd|rd|th)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var suffixes$3 = {
- 0: '-ум',
- 1: '-ум',
- 2: '-юм',
- 3: '-юм',
- 4: '-ум',
- 5: '-ум',
- 6: '-ум',
- 7: '-ум',
- 8: '-ум',
- 9: '-ум',
- 10: '-ум',
- 12: '-ум',
- 13: '-ум',
- 20: '-ум',
- 30: '-юм',
- 40: '-ум',
- 50: '-ум',
- 60: '-ум',
- 70: '-ум',
- 80: '-ум',
- 90: '-ум',
- 100: '-ум',
- };
- hooks.defineLocale('tg', {
- months: {
- format: 'январи_феврали_марти_апрели_майи_июни_июли_августи_сентябри_октябри_ноябри_декабри'.split(
- '_'
- ),
- standalone:
- 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split(
- '_'
- ),
- },
- monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
- weekdays: 'якшанбе_душанбе_сешанбе_чоршанбе_панҷшанбе_ҷумъа_шанбе'.split(
- '_'
- ),
- weekdaysShort: 'яшб_дшб_сшб_чшб_пшб_ҷум_шнб'.split('_'),
- weekdaysMin: 'яш_дш_сш_чш_пш_ҷм_шб'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Имрӯз соати] LT',
- nextDay: '[Фардо соати] LT',
- lastDay: '[Дирӯз соати] LT',
- nextWeek: 'dddd[и] [ҳафтаи оянда соати] LT',
- lastWeek: 'dddd[и] [ҳафтаи гузашта соати] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'баъди %s',
- past: '%s пеш',
- s: 'якчанд сония',
- m: 'як дақиқа',
- mm: '%d дақиқа',
- h: 'як соат',
- hh: '%d соат',
- d: 'як рӯз',
- dd: '%d рӯз',
- M: 'як моҳ',
- MM: '%d моҳ',
- y: 'як сол',
- yy: '%d сол',
- },
- meridiemParse: /шаб|субҳ|рӯз|бегоҳ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === 'шаб') {
- return hour < 4 ? hour : hour + 12;
- } else if (meridiem === 'субҳ') {
- return hour;
- } else if (meridiem === 'рӯз') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === 'бегоҳ') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'шаб';
- } else if (hour < 11) {
- return 'субҳ';
- } else if (hour < 16) {
- return 'рӯз';
- } else if (hour < 19) {
- return 'бегоҳ';
- } else {
- return 'шаб';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(ум|юм)/,
- ordinal: function (number) {
- var a = number % 10,
- b = number >= 100 ? 100 : null;
- return number + (suffixes$3[number] || suffixes$3[a] || suffixes$3[b]);
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 1th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('th', {
- months: 'มกราคม_กุมภาพันธ์_มีนาคม_เมษายน_พฤษภาคม_มิถุนายน_กรกฎาคม_สิงหาคม_กันยายน_ตุลาคม_พฤศจิกายน_ธันวาคม'.split(
- '_'
- ),
- monthsShort:
- 'ม.ค._ก.พ._มี.ค._เม.ย._พ.ค._มิ.ย._ก.ค._ส.ค._ก.ย._ต.ค._พ.ย._ธ.ค.'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัสบดี_ศุกร์_เสาร์'.split('_'),
- weekdaysShort: 'อาทิตย์_จันทร์_อังคาร_พุธ_พฤหัส_ศุกร์_เสาร์'.split('_'), // yes, three characters difference
- weekdaysMin: 'อา._จ._อ._พ._พฤ._ศ._ส.'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'H:mm',
- LTS: 'H:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY เวลา H:mm',
- LLLL: 'วันddddที่ D MMMM YYYY เวลา H:mm',
- },
- meridiemParse: /ก่อนเที่ยง|หลังเที่ยง/,
- isPM: function (input) {
- return input === 'หลังเที่ยง';
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'ก่อนเที่ยง';
- } else {
- return 'หลังเที่ยง';
- }
- },
- calendar: {
- sameDay: '[วันนี้ เวลา] LT',
- nextDay: '[พรุ่งนี้ เวลา] LT',
- nextWeek: 'dddd[หน้า เวลา] LT',
- lastDay: '[เมื่อวานนี้ เวลา] LT',
- lastWeek: '[วัน]dddd[ที่แล้ว เวลา] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'อีก %s',
- past: '%sที่แล้ว',
- s: 'ไม่กี่วินาที',
- ss: '%d วินาที',
- m: '1 นาที',
- mm: '%d นาที',
- h: '1 ชั่วโมง',
- hh: '%d ชั่วโมง',
- d: '1 วัน',
- dd: '%d วัน',
- w: '1 สัปดาห์',
- ww: '%d สัปดาห์',
- M: '1 เดือน',
- MM: '%d เดือน',
- y: '1 ปี',
- yy: '%d ปี',
- },
- });
- //! moment.js locale configuration
- var suffixes$4 = {
- 1: "'inji",
- 5: "'inji",
- 8: "'inji",
- 70: "'inji",
- 80: "'inji",
- 2: "'nji",
- 7: "'nji",
- 20: "'nji",
- 50: "'nji",
- 3: "'ünji",
- 4: "'ünji",
- 100: "'ünji",
- 6: "'njy",
- 9: "'unjy",
- 10: "'unjy",
- 30: "'unjy",
- 60: "'ynjy",
- 90: "'ynjy",
- };
- hooks.defineLocale('tk', {
- months: 'Ýanwar_Fewral_Mart_Aprel_Maý_Iýun_Iýul_Awgust_Sentýabr_Oktýabr_Noýabr_Dekabr'.split(
- '_'
- ),
- monthsShort: 'Ýan_Few_Mar_Apr_Maý_Iýn_Iýl_Awg_Sen_Okt_Noý_Dek'.split('_'),
- weekdays: 'Ýekşenbe_Duşenbe_Sişenbe_Çarşenbe_Penşenbe_Anna_Şenbe'.split(
- '_'
- ),
- weekdaysShort: 'Ýek_Duş_Siş_Çar_Pen_Ann_Şen'.split('_'),
- weekdaysMin: 'Ýk_Dş_Sş_Çr_Pn_An_Şn'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[bugün sagat] LT',
- nextDay: '[ertir sagat] LT',
- nextWeek: '[indiki] dddd [sagat] LT',
- lastDay: '[düýn] LT',
- lastWeek: '[geçen] dddd [sagat] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s soň',
- past: '%s öň',
- s: 'birnäçe sekunt',
- m: 'bir minut',
- mm: '%d minut',
- h: 'bir sagat',
- hh: '%d sagat',
- d: 'bir gün',
- dd: '%d gün',
- M: 'bir aý',
- MM: '%d aý',
- y: 'bir ýyl',
- yy: '%d ýyl',
- },
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'Do':
- case 'DD':
- return number;
- default:
- if (number === 0) {
- // special case for zero
- return number + "'unjy";
- }
- var a = number % 10,
- b = (number % 100) - a,
- c = number >= 100 ? 100 : null;
- return number + (suffixes$4[a] || suffixes$4[b] || suffixes$4[c]);
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('tl-ph', {
- months: 'Enero_Pebrero_Marso_Abril_Mayo_Hunyo_Hulyo_Agosto_Setyembre_Oktubre_Nobyembre_Disyembre'.split(
- '_'
- ),
- monthsShort: 'Ene_Peb_Mar_Abr_May_Hun_Hul_Ago_Set_Okt_Nob_Dis'.split('_'),
- weekdays: 'Linggo_Lunes_Martes_Miyerkules_Huwebes_Biyernes_Sabado'.split(
- '_'
- ),
- weekdaysShort: 'Lin_Lun_Mar_Miy_Huw_Biy_Sab'.split('_'),
- weekdaysMin: 'Li_Lu_Ma_Mi_Hu_Bi_Sab'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'MM/D/YYYY',
- LL: 'MMMM D, YYYY',
- LLL: 'MMMM D, YYYY HH:mm',
- LLLL: 'dddd, MMMM DD, YYYY HH:mm',
- },
- calendar: {
- sameDay: 'LT [ngayong araw]',
- nextDay: '[Bukas ng] LT',
- nextWeek: 'LT [sa susunod na] dddd',
- lastDay: 'LT [kahapon]',
- lastWeek: 'LT [noong nakaraang] dddd',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'sa loob ng %s',
- past: '%s ang nakalipas',
- s: 'ilang segundo',
- ss: '%d segundo',
- m: 'isang minuto',
- mm: '%d minuto',
- h: 'isang oras',
- hh: '%d oras',
- d: 'isang araw',
- dd: '%d araw',
- M: 'isang buwan',
- MM: '%d buwan',
- y: 'isang taon',
- yy: '%d taon',
- },
- dayOfMonthOrdinalParse: /\d{1,2}/,
- ordinal: function (number) {
- return number;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var numbersNouns = 'pagh_wa’_cha’_wej_loS_vagh_jav_Soch_chorgh_Hut'.split('_');
- function translateFuture(output) {
- var time = output;
- time =
- output.indexOf('jaj') !== -1
- ? time.slice(0, -3) + 'leS'
- : output.indexOf('jar') !== -1
- ? time.slice(0, -3) + 'waQ'
- : output.indexOf('DIS') !== -1
- ? time.slice(0, -3) + 'nem'
- : time + ' pIq';
- return time;
- }
- function translatePast(output) {
- var time = output;
- time =
- output.indexOf('jaj') !== -1
- ? time.slice(0, -3) + 'Hu’'
- : output.indexOf('jar') !== -1
- ? time.slice(0, -3) + 'wen'
- : output.indexOf('DIS') !== -1
- ? time.slice(0, -3) + 'ben'
- : time + ' ret';
- return time;
- }
- function translate$a(number, withoutSuffix, string, isFuture) {
- var numberNoun = numberAsNoun(number);
- switch (string) {
- case 'ss':
- return numberNoun + ' lup';
- case 'mm':
- return numberNoun + ' tup';
- case 'hh':
- return numberNoun + ' rep';
- case 'dd':
- return numberNoun + ' jaj';
- case 'MM':
- return numberNoun + ' jar';
- case 'yy':
- return numberNoun + ' DIS';
- }
- }
- function numberAsNoun(number) {
- var hundred = Math.floor((number % 1000) / 100),
- ten = Math.floor((number % 100) / 10),
- one = number % 10,
- word = '';
- if (hundred > 0) {
- word += numbersNouns[hundred] + 'vatlh';
- }
- if (ten > 0) {
- word += (word !== '' ? ' ' : '') + numbersNouns[ten] + 'maH';
- }
- if (one > 0) {
- word += (word !== '' ? ' ' : '') + numbersNouns[one];
- }
- return word === '' ? 'pagh' : word;
- }
- hooks.defineLocale('tlh', {
- months: 'tera’ jar wa’_tera’ jar cha’_tera’ jar wej_tera’ jar loS_tera’ jar vagh_tera’ jar jav_tera’ jar Soch_tera’ jar chorgh_tera’ jar Hut_tera’ jar wa’maH_tera’ jar wa’maH wa’_tera’ jar wa’maH cha’'.split(
- '_'
- ),
- monthsShort:
- 'jar wa’_jar cha’_jar wej_jar loS_jar vagh_jar jav_jar Soch_jar chorgh_jar Hut_jar wa’maH_jar wa’maH wa’_jar wa’maH cha’'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split(
- '_'
- ),
- weekdaysShort:
- 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
- weekdaysMin:
- 'lojmItjaj_DaSjaj_povjaj_ghItlhjaj_loghjaj_buqjaj_ghInjaj'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[DaHjaj] LT',
- nextDay: '[wa’leS] LT',
- nextWeek: 'LLL',
- lastDay: '[wa’Hu’] LT',
- lastWeek: 'LLL',
- sameElse: 'L',
- },
- relativeTime: {
- future: translateFuture,
- past: translatePast,
- s: 'puS lup',
- ss: translate$a,
- m: 'wa’ tup',
- mm: translate$a,
- h: 'wa’ rep',
- hh: translate$a,
- d: 'wa’ jaj',
- dd: translate$a,
- M: 'wa’ jar',
- MM: translate$a,
- y: 'wa’ DIS',
- yy: translate$a,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var suffixes$5 = {
- 1: "'inci",
- 5: "'inci",
- 8: "'inci",
- 70: "'inci",
- 80: "'inci",
- 2: "'nci",
- 7: "'nci",
- 20: "'nci",
- 50: "'nci",
- 3: "'üncü",
- 4: "'üncü",
- 100: "'üncü",
- 6: "'ncı",
- 9: "'uncu",
- 10: "'uncu",
- 30: "'uncu",
- 60: "'ıncı",
- 90: "'ıncı",
- };
- hooks.defineLocale('tr', {
- months: 'Ocak_Şubat_Mart_Nisan_Mayıs_Haziran_Temmuz_Ağustos_Eylül_Ekim_Kasım_Aralık'.split(
- '_'
- ),
- monthsShort: 'Oca_Şub_Mar_Nis_May_Haz_Tem_Ağu_Eyl_Eki_Kas_Ara'.split('_'),
- weekdays: 'Pazar_Pazartesi_Salı_Çarşamba_Perşembe_Cuma_Cumartesi'.split(
- '_'
- ),
- weekdaysShort: 'Paz_Pzt_Sal_Çar_Per_Cum_Cmt'.split('_'),
- weekdaysMin: 'Pz_Pt_Sa_Ça_Pe_Cu_Ct'.split('_'),
- meridiem: function (hours, minutes, isLower) {
- if (hours < 12) {
- return isLower ? 'öö' : 'ÖÖ';
- } else {
- return isLower ? 'ös' : 'ÖS';
- }
- },
- meridiemParse: /öö|ÖÖ|ös|ÖS/,
- isPM: function (input) {
- return input === 'ös' || input === 'ÖS';
- },
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[bugün saat] LT',
- nextDay: '[yarın saat] LT',
- nextWeek: '[gelecek] dddd [saat] LT',
- lastDay: '[dün] LT',
- lastWeek: '[geçen] dddd [saat] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s sonra',
- past: '%s önce',
- s: 'birkaç saniye',
- ss: '%d saniye',
- m: 'bir dakika',
- mm: '%d dakika',
- h: 'bir saat',
- hh: '%d saat',
- d: 'bir gün',
- dd: '%d gün',
- w: 'bir hafta',
- ww: '%d hafta',
- M: 'bir ay',
- MM: '%d ay',
- y: 'bir yıl',
- yy: '%d yıl',
- },
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'Do':
- case 'DD':
- return number;
- default:
- if (number === 0) {
- // special case for zero
- return number + "'ıncı";
- }
- var a = number % 10,
- b = (number % 100) - a,
- c = number >= 100 ? 100 : null;
- return number + (suffixes$5[a] || suffixes$5[b] || suffixes$5[c]);
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- // After the year there should be a slash and the amount of years since December 26, 1979 in Roman numerals.
- // This is currently too difficult (maybe even impossible) to add.
- hooks.defineLocale('tzl', {
- months: 'Januar_Fevraglh_Març_Avrïu_Mai_Gün_Julia_Guscht_Setemvar_Listopäts_Noemvar_Zecemvar'.split(
- '_'
- ),
- monthsShort: 'Jan_Fev_Mar_Avr_Mai_Gün_Jul_Gus_Set_Lis_Noe_Zec'.split('_'),
- weekdays: 'Súladi_Lúneçi_Maitzi_Márcuri_Xhúadi_Viénerçi_Sáturi'.split('_'),
- weekdaysShort: 'Súl_Lún_Mai_Már_Xhú_Vié_Sát'.split('_'),
- weekdaysMin: 'Sú_Lú_Ma_Má_Xh_Vi_Sá'.split('_'),
- longDateFormat: {
- LT: 'HH.mm',
- LTS: 'HH.mm.ss',
- L: 'DD.MM.YYYY',
- LL: 'D. MMMM [dallas] YYYY',
- LLL: 'D. MMMM [dallas] YYYY HH.mm',
- LLLL: 'dddd, [li] D. MMMM [dallas] YYYY HH.mm',
- },
- meridiemParse: /d\'o|d\'a/i,
- isPM: function (input) {
- return "d'o" === input.toLowerCase();
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours > 11) {
- return isLower ? "d'o" : "D'O";
- } else {
- return isLower ? "d'a" : "D'A";
- }
- },
- calendar: {
- sameDay: '[oxhi à] LT',
- nextDay: '[demà à] LT',
- nextWeek: 'dddd [à] LT',
- lastDay: '[ieiri à] LT',
- lastWeek: '[sür el] dddd [lasteu à] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'osprei %s',
- past: 'ja%s',
- s: processRelativeTime$8,
- ss: processRelativeTime$8,
- m: processRelativeTime$8,
- mm: processRelativeTime$8,
- h: processRelativeTime$8,
- hh: processRelativeTime$8,
- d: processRelativeTime$8,
- dd: processRelativeTime$8,
- M: processRelativeTime$8,
- MM: processRelativeTime$8,
- y: processRelativeTime$8,
- yy: processRelativeTime$8,
- },
- dayOfMonthOrdinalParse: /\d{1,2}\./,
- ordinal: '%d.',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- function processRelativeTime$8(number, withoutSuffix, key, isFuture) {
- var format = {
- s: ['viensas secunds', "'iensas secunds"],
- ss: [number + ' secunds', '' + number + ' secunds'],
- m: ["'n míut", "'iens míut"],
- mm: [number + ' míuts', '' + number + ' míuts'],
- h: ["'n þora", "'iensa þora"],
- hh: [number + ' þoras', '' + number + ' þoras'],
- d: ["'n ziua", "'iensa ziua"],
- dd: [number + ' ziuas', '' + number + ' ziuas'],
- M: ["'n mes", "'iens mes"],
- MM: [number + ' mesen', '' + number + ' mesen'],
- y: ["'n ar", "'iens ar"],
- yy: [number + ' ars', '' + number + ' ars'],
- };
- return isFuture
- ? format[key][0]
- : withoutSuffix
- ? format[key][0]
- : format[key][1];
- }
- //! moment.js locale configuration
- hooks.defineLocale('tzm-latn', {
- months: 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split(
- '_'
- ),
- monthsShort:
- 'innayr_brˤayrˤ_marˤsˤ_ibrir_mayyw_ywnyw_ywlywz_ɣwšt_šwtanbir_ktˤwbrˤ_nwwanbir_dwjnbir'.split(
- '_'
- ),
- weekdays: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
- weekdaysShort: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
- weekdaysMin: 'asamas_aynas_asinas_akras_akwas_asimwas_asiḍyas'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[asdkh g] LT',
- nextDay: '[aska g] LT',
- nextWeek: 'dddd [g] LT',
- lastDay: '[assant g] LT',
- lastWeek: 'dddd [g] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'dadkh s yan %s',
- past: 'yan %s',
- s: 'imik',
- ss: '%d imik',
- m: 'minuḍ',
- mm: '%d minuḍ',
- h: 'saɛa',
- hh: '%d tassaɛin',
- d: 'ass',
- dd: '%d ossan',
- M: 'ayowr',
- MM: '%d iyyirn',
- y: 'asgas',
- yy: '%d isgasn',
- },
- week: {
- dow: 6, // Saturday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('tzm', {
- months: 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split(
- '_'
- ),
- monthsShort:
- 'ⵉⵏⵏⴰⵢⵔ_ⴱⵕⴰⵢⵕ_ⵎⴰⵕⵚ_ⵉⴱⵔⵉⵔ_ⵎⴰⵢⵢⵓ_ⵢⵓⵏⵢⵓ_ⵢⵓⵍⵢⵓⵣ_ⵖⵓⵛⵜ_ⵛⵓⵜⴰⵏⴱⵉⵔ_ⴽⵟⵓⴱⵕ_ⵏⵓⵡⴰⵏⴱⵉⵔ_ⴷⵓⵊⵏⴱⵉⵔ'.split(
- '_'
- ),
- weekdays: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
- weekdaysShort: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
- weekdaysMin: 'ⴰⵙⴰⵎⴰⵙ_ⴰⵢⵏⴰⵙ_ⴰⵙⵉⵏⴰⵙ_ⴰⴽⵔⴰⵙ_ⴰⴽⵡⴰⵙ_ⴰⵙⵉⵎⵡⴰⵙ_ⴰⵙⵉⴹⵢⴰⵙ'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[ⴰⵙⴷⵅ ⴴ] LT',
- nextDay: '[ⴰⵙⴽⴰ ⴴ] LT',
- nextWeek: 'dddd [ⴴ] LT',
- lastDay: '[ⴰⵚⴰⵏⵜ ⴴ] LT',
- lastWeek: 'dddd [ⴴ] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'ⴷⴰⴷⵅ ⵙ ⵢⴰⵏ %s',
- past: 'ⵢⴰⵏ %s',
- s: 'ⵉⵎⵉⴽ',
- ss: '%d ⵉⵎⵉⴽ',
- m: 'ⵎⵉⵏⵓⴺ',
- mm: '%d ⵎⵉⵏⵓⴺ',
- h: 'ⵙⴰⵄⴰ',
- hh: '%d ⵜⴰⵙⵙⴰⵄⵉⵏ',
- d: 'ⴰⵙⵙ',
- dd: '%d oⵙⵙⴰⵏ',
- M: 'ⴰⵢoⵓⵔ',
- MM: '%d ⵉⵢⵢⵉⵔⵏ',
- y: 'ⴰⵙⴳⴰⵙ',
- yy: '%d ⵉⵙⴳⴰⵙⵏ',
- },
- week: {
- dow: 6, // Saturday is the first day of the week.
- doy: 12, // The week that contains Jan 12th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('ug-cn', {
- months: 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split(
- '_'
- ),
- monthsShort:
- 'يانۋار_فېۋرال_مارت_ئاپرېل_ماي_ئىيۇن_ئىيۇل_ئاۋغۇست_سېنتەبىر_ئۆكتەبىر_نويابىر_دېكابىر'.split(
- '_'
- ),
- weekdays: 'يەكشەنبە_دۈشەنبە_سەيشەنبە_چارشەنبە_پەيشەنبە_جۈمە_شەنبە'.split(
- '_'
- ),
- weekdaysShort: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
- weekdaysMin: 'يە_دۈ_سە_چا_پە_جۈ_شە'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY-MM-DD',
- LL: 'YYYY-يىلىM-ئاينىڭD-كۈنى',
- LLL: 'YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm',
- LLLL: 'dddd، YYYY-يىلىM-ئاينىڭD-كۈنى، HH:mm',
- },
- meridiemParse: /يېرىم كېچە|سەھەر|چۈشتىن بۇرۇن|چۈش|چۈشتىن كېيىن|كەچ/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (
- meridiem === 'يېرىم كېچە' ||
- meridiem === 'سەھەر' ||
- meridiem === 'چۈشتىن بۇرۇن'
- ) {
- return hour;
- } else if (meridiem === 'چۈشتىن كېيىن' || meridiem === 'كەچ') {
- return hour + 12;
- } else {
- return hour >= 11 ? hour : hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- var hm = hour * 100 + minute;
- if (hm < 600) {
- return 'يېرىم كېچە';
- } else if (hm < 900) {
- return 'سەھەر';
- } else if (hm < 1130) {
- return 'چۈشتىن بۇرۇن';
- } else if (hm < 1230) {
- return 'چۈش';
- } else if (hm < 1800) {
- return 'چۈشتىن كېيىن';
- } else {
- return 'كەچ';
- }
- },
- calendar: {
- sameDay: '[بۈگۈن سائەت] LT',
- nextDay: '[ئەتە سائەت] LT',
- nextWeek: '[كېلەركى] dddd [سائەت] LT',
- lastDay: '[تۆنۈگۈن] LT',
- lastWeek: '[ئالدىنقى] dddd [سائەت] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s كېيىن',
- past: '%s بۇرۇن',
- s: 'نەچچە سېكونت',
- ss: '%d سېكونت',
- m: 'بىر مىنۇت',
- mm: '%d مىنۇت',
- h: 'بىر سائەت',
- hh: '%d سائەت',
- d: 'بىر كۈن',
- dd: '%d كۈن',
- M: 'بىر ئاي',
- MM: '%d ئاي',
- y: 'بىر يىل',
- yy: '%d يىل',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(-كۈنى|-ئاي|-ھەپتە)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + '-كۈنى';
- case 'w':
- case 'W':
- return number + '-ھەپتە';
- default:
- return number;
- }
- },
- preparse: function (string) {
- return string.replace(/،/g, ',');
- },
- postformat: function (string) {
- return string.replace(/,/g, '،');
- },
- week: {
- // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 1st is the first week of the year.
- },
- });
- //! moment.js locale configuration
- function plural$6(word, num) {
- var forms = word.split('_');
- return num % 10 === 1 && num % 100 !== 11
- ? forms[0]
- : num % 10 >= 2 && num % 10 <= 4 && (num % 100 < 10 || num % 100 >= 20)
- ? forms[1]
- : forms[2];
- }
- function relativeTimeWithPlural$4(number, withoutSuffix, key) {
- var format = {
- ss: withoutSuffix ? 'секунда_секунди_секунд' : 'секунду_секунди_секунд',
- mm: withoutSuffix ? 'хвилина_хвилини_хвилин' : 'хвилину_хвилини_хвилин',
- hh: withoutSuffix ? 'година_години_годин' : 'годину_години_годин',
- dd: 'день_дні_днів',
- MM: 'місяць_місяці_місяців',
- yy: 'рік_роки_років',
- };
- if (key === 'm') {
- return withoutSuffix ? 'хвилина' : 'хвилину';
- } else if (key === 'h') {
- return withoutSuffix ? 'година' : 'годину';
- } else {
- return number + ' ' + plural$6(format[key], +number);
- }
- }
- function weekdaysCaseReplace(m, format) {
- var weekdays = {
- nominative:
- 'неділя_понеділок_вівторок_середа_четвер_п’ятниця_субота'.split(
- '_'
- ),
- accusative:
- 'неділю_понеділок_вівторок_середу_четвер_п’ятницю_суботу'.split(
- '_'
- ),
- genitive:
- 'неділі_понеділка_вівторка_середи_четверга_п’ятниці_суботи'.split(
- '_'
- ),
- },
- nounCase;
- if (m === true) {
- return weekdays['nominative']
- .slice(1, 7)
- .concat(weekdays['nominative'].slice(0, 1));
- }
- if (!m) {
- return weekdays['nominative'];
- }
- nounCase = /(\[[ВвУу]\]) ?dddd/.test(format)
- ? 'accusative'
- : /\[?(?:минулої|наступної)? ?\] ?dddd/.test(format)
- ? 'genitive'
- : 'nominative';
- return weekdays[nounCase][m.day()];
- }
- function processHoursFunction(str) {
- return function () {
- return str + 'о' + (this.hours() === 11 ? 'б' : '') + '] LT';
- };
- }
- hooks.defineLocale('uk', {
- months: {
- format: 'січня_лютого_березня_квітня_травня_червня_липня_серпня_вересня_жовтня_листопада_грудня'.split(
- '_'
- ),
- standalone:
- 'січень_лютий_березень_квітень_травень_червень_липень_серпень_вересень_жовтень_листопад_грудень'.split(
- '_'
- ),
- },
- monthsShort: 'січ_лют_бер_квіт_трав_черв_лип_серп_вер_жовт_лист_груд'.split(
- '_'
- ),
- weekdays: weekdaysCaseReplace,
- weekdaysShort: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
- weekdaysMin: 'нд_пн_вт_ср_чт_пт_сб'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD.MM.YYYY',
- LL: 'D MMMM YYYY р.',
- LLL: 'D MMMM YYYY р., HH:mm',
- LLLL: 'dddd, D MMMM YYYY р., HH:mm',
- },
- calendar: {
- sameDay: processHoursFunction('[Сьогодні '),
- nextDay: processHoursFunction('[Завтра '),
- lastDay: processHoursFunction('[Вчора '),
- nextWeek: processHoursFunction('[У] dddd ['),
- lastWeek: function () {
- switch (this.day()) {
- case 0:
- case 3:
- case 5:
- case 6:
- return processHoursFunction('[Минулої] dddd [').call(this);
- case 1:
- case 2:
- case 4:
- return processHoursFunction('[Минулого] dddd [').call(this);
- }
- },
- sameElse: 'L',
- },
- relativeTime: {
- future: 'за %s',
- past: '%s тому',
- s: 'декілька секунд',
- ss: relativeTimeWithPlural$4,
- m: relativeTimeWithPlural$4,
- mm: relativeTimeWithPlural$4,
- h: 'годину',
- hh: relativeTimeWithPlural$4,
- d: 'день',
- dd: relativeTimeWithPlural$4,
- M: 'місяць',
- MM: relativeTimeWithPlural$4,
- y: 'рік',
- yy: relativeTimeWithPlural$4,
- },
- // M. E.: those two are virtually unused but a user might want to implement them for his/her website for some reason
- meridiemParse: /ночі|ранку|дня|вечора/,
- isPM: function (input) {
- return /^(дня|вечора)$/.test(input);
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 4) {
- return 'ночі';
- } else if (hour < 12) {
- return 'ранку';
- } else if (hour < 17) {
- return 'дня';
- } else {
- return 'вечора';
- }
- },
- dayOfMonthOrdinalParse: /\d{1,2}-(й|го)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'M':
- case 'd':
- case 'DDD':
- case 'w':
- case 'W':
- return number + '-й';
- case 'D':
- return number + '-го';
- default:
- return number;
- }
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- var months$b = [
- 'جنوری',
- 'فروری',
- 'مارچ',
- 'اپریل',
- 'مئی',
- 'جون',
- 'جولائی',
- 'اگست',
- 'ستمبر',
- 'اکتوبر',
- 'نومبر',
- 'دسمبر',
- ],
- days$2 = ['اتوار', 'پیر', 'منگل', 'بدھ', 'جمعرات', 'جمعہ', 'ہفتہ'];
- hooks.defineLocale('ur', {
- months: months$b,
- monthsShort: months$b,
- weekdays: days$2,
- weekdaysShort: days$2,
- weekdaysMin: days$2,
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd، D MMMM YYYY HH:mm',
- },
- meridiemParse: /صبح|شام/,
- isPM: function (input) {
- return 'شام' === input;
- },
- meridiem: function (hour, minute, isLower) {
- if (hour < 12) {
- return 'صبح';
- }
- return 'شام';
- },
- calendar: {
- sameDay: '[آج بوقت] LT',
- nextDay: '[کل بوقت] LT',
- nextWeek: 'dddd [بوقت] LT',
- lastDay: '[گذشتہ روز بوقت] LT',
- lastWeek: '[گذشتہ] dddd [بوقت] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s بعد',
- past: '%s قبل',
- s: 'چند سیکنڈ',
- ss: '%d سیکنڈ',
- m: 'ایک منٹ',
- mm: '%d منٹ',
- h: 'ایک گھنٹہ',
- hh: '%d گھنٹے',
- d: 'ایک دن',
- dd: '%d دن',
- M: 'ایک ماہ',
- MM: '%d ماہ',
- y: 'ایک سال',
- yy: '%d سال',
- },
- preparse: function (string) {
- return string.replace(/،/g, ',');
- },
- postformat: function (string) {
- return string.replace(/,/g, '،');
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('uz-latn', {
- months: 'Yanvar_Fevral_Mart_Aprel_May_Iyun_Iyul_Avgust_Sentabr_Oktabr_Noyabr_Dekabr'.split(
- '_'
- ),
- monthsShort: 'Yan_Fev_Mar_Apr_May_Iyun_Iyul_Avg_Sen_Okt_Noy_Dek'.split('_'),
- weekdays:
- 'Yakshanba_Dushanba_Seshanba_Chorshanba_Payshanba_Juma_Shanba'.split(
- '_'
- ),
- weekdaysShort: 'Yak_Dush_Sesh_Chor_Pay_Jum_Shan'.split('_'),
- weekdaysMin: 'Ya_Du_Se_Cho_Pa_Ju_Sha'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'D MMMM YYYY, dddd HH:mm',
- },
- calendar: {
- sameDay: '[Bugun soat] LT [da]',
- nextDay: '[Ertaga] LT [da]',
- nextWeek: 'dddd [kuni soat] LT [da]',
- lastDay: '[Kecha soat] LT [da]',
- lastWeek: "[O'tgan] dddd [kuni soat] LT [da]",
- sameElse: 'L',
- },
- relativeTime: {
- future: 'Yaqin %s ichida',
- past: 'Bir necha %s oldin',
- s: 'soniya',
- ss: '%d soniya',
- m: 'bir daqiqa',
- mm: '%d daqiqa',
- h: 'bir soat',
- hh: '%d soat',
- d: 'bir kun',
- dd: '%d kun',
- M: 'bir oy',
- MM: '%d oy',
- y: 'bir yil',
- yy: '%d yil',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 7th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('uz', {
- months: 'январ_феврал_март_апрел_май_июн_июл_август_сентябр_октябр_ноябр_декабр'.split(
- '_'
- ),
- monthsShort: 'янв_фев_мар_апр_май_июн_июл_авг_сен_окт_ноя_дек'.split('_'),
- weekdays: 'Якшанба_Душанба_Сешанба_Чоршанба_Пайшанба_Жума_Шанба'.split('_'),
- weekdaysShort: 'Якш_Душ_Сеш_Чор_Пай_Жум_Шан'.split('_'),
- weekdaysMin: 'Як_Ду_Се_Чо_Па_Жу_Ша'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'D MMMM YYYY, dddd HH:mm',
- },
- calendar: {
- sameDay: '[Бугун соат] LT [да]',
- nextDay: '[Эртага] LT [да]',
- nextWeek: 'dddd [куни соат] LT [да]',
- lastDay: '[Кеча соат] LT [да]',
- lastWeek: '[Утган] dddd [куни соат] LT [да]',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'Якин %s ичида',
- past: 'Бир неча %s олдин',
- s: 'фурсат',
- ss: '%d фурсат',
- m: 'бир дакика',
- mm: '%d дакика',
- h: 'бир соат',
- hh: '%d соат',
- d: 'бир кун',
- dd: '%d кун',
- M: 'бир ой',
- MM: '%d ой',
- y: 'бир йил',
- yy: '%d йил',
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 7, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('vi', {
- months: 'tháng 1_tháng 2_tháng 3_tháng 4_tháng 5_tháng 6_tháng 7_tháng 8_tháng 9_tháng 10_tháng 11_tháng 12'.split(
- '_'
- ),
- monthsShort:
- 'Thg 01_Thg 02_Thg 03_Thg 04_Thg 05_Thg 06_Thg 07_Thg 08_Thg 09_Thg 10_Thg 11_Thg 12'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays: 'chủ nhật_thứ hai_thứ ba_thứ tư_thứ năm_thứ sáu_thứ bảy'.split(
- '_'
- ),
- weekdaysShort: 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
- weekdaysMin: 'CN_T2_T3_T4_T5_T6_T7'.split('_'),
- weekdaysParseExact: true,
- meridiemParse: /sa|ch/i,
- isPM: function (input) {
- return /^ch$/i.test(input);
- },
- meridiem: function (hours, minutes, isLower) {
- if (hours < 12) {
- return isLower ? 'sa' : 'SA';
- } else {
- return isLower ? 'ch' : 'CH';
- }
- },
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM [năm] YYYY',
- LLL: 'D MMMM [năm] YYYY HH:mm',
- LLLL: 'dddd, D MMMM [năm] YYYY HH:mm',
- l: 'DD/M/YYYY',
- ll: 'D MMM YYYY',
- lll: 'D MMM YYYY HH:mm',
- llll: 'ddd, D MMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[Hôm nay lúc] LT',
- nextDay: '[Ngày mai lúc] LT',
- nextWeek: 'dddd [tuần tới lúc] LT',
- lastDay: '[Hôm qua lúc] LT',
- lastWeek: 'dddd [tuần trước lúc] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: '%s tới',
- past: '%s trước',
- s: 'vài giây',
- ss: '%d giây',
- m: 'một phút',
- mm: '%d phút',
- h: 'một giờ',
- hh: '%d giờ',
- d: 'một ngày',
- dd: '%d ngày',
- w: 'một tuần',
- ww: '%d tuần',
- M: 'một tháng',
- MM: '%d tháng',
- y: 'một năm',
- yy: '%d năm',
- },
- dayOfMonthOrdinalParse: /\d{1,2}/,
- ordinal: function (number) {
- return number;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('x-pseudo', {
- months: 'J~áñúá~rý_F~ébrú~árý_~Márc~h_Áp~ríl_~Máý_~Júñé~_Júl~ý_Áú~gúst~_Sép~témb~ér_Ó~ctób~ér_Ñ~óvém~bér_~Décé~mbér'.split(
- '_'
- ),
- monthsShort:
- 'J~áñ_~Féb_~Már_~Ápr_~Máý_~Júñ_~Júl_~Áúg_~Sép_~Óct_~Ñóv_~Déc'.split(
- '_'
- ),
- monthsParseExact: true,
- weekdays:
- 'S~úñdá~ý_Mó~ñdáý~_Túé~sdáý~_Wéd~ñésd~áý_T~húrs~dáý_~Fríd~áý_S~átúr~dáý'.split(
- '_'
- ),
- weekdaysShort: 'S~úñ_~Móñ_~Túé_~Wéd_~Thú_~Frí_~Sát'.split('_'),
- weekdaysMin: 'S~ú_Mó~_Tú_~Wé_T~h_Fr~_Sá'.split('_'),
- weekdaysParseExact: true,
- longDateFormat: {
- LT: 'HH:mm',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY HH:mm',
- LLLL: 'dddd, D MMMM YYYY HH:mm',
- },
- calendar: {
- sameDay: '[T~ódá~ý át] LT',
- nextDay: '[T~ómó~rró~w át] LT',
- nextWeek: 'dddd [át] LT',
- lastDay: '[Ý~ést~érdá~ý át] LT',
- lastWeek: '[L~ást] dddd [át] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'í~ñ %s',
- past: '%s á~gó',
- s: 'á ~féw ~sécó~ñds',
- ss: '%d s~écóñ~ds',
- m: 'á ~míñ~úté',
- mm: '%d m~íñú~tés',
- h: 'á~ñ hó~úr',
- hh: '%d h~óúrs',
- d: 'á ~dáý',
- dd: '%d d~áýs',
- M: 'á ~móñ~th',
- MM: '%d m~óñt~hs',
- y: 'á ~ýéár',
- yy: '%d ý~éárs',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/,
- ordinal: function (number) {
- var b = number % 10,
- output =
- ~~((number % 100) / 10) === 1
- ? 'th'
- : b === 1
- ? 'st'
- : b === 2
- ? 'nd'
- : b === 3
- ? 'rd'
- : 'th';
- return number + output;
- },
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('yo', {
- months: 'Sẹ́rẹ́_Èrèlè_Ẹrẹ̀nà_Ìgbé_Èbibi_Òkùdu_Agẹmo_Ògún_Owewe_Ọ̀wàrà_Bélú_Ọ̀pẹ̀̀'.split(
- '_'
- ),
- monthsShort: 'Sẹ́r_Èrl_Ẹrn_Ìgb_Èbi_Òkù_Agẹ_Ògú_Owe_Ọ̀wà_Bél_Ọ̀pẹ̀̀'.split('_'),
- weekdays: 'Àìkú_Ajé_Ìsẹ́gun_Ọjọ́rú_Ọjọ́bọ_Ẹtì_Àbámẹ́ta'.split('_'),
- weekdaysShort: 'Àìk_Ajé_Ìsẹ́_Ọjr_Ọjb_Ẹtì_Àbá'.split('_'),
- weekdaysMin: 'Àì_Aj_Ìs_Ọr_Ọb_Ẹt_Àb'.split('_'),
- longDateFormat: {
- LT: 'h:mm A',
- LTS: 'h:mm:ss A',
- L: 'DD/MM/YYYY',
- LL: 'D MMMM YYYY',
- LLL: 'D MMMM YYYY h:mm A',
- LLLL: 'dddd, D MMMM YYYY h:mm A',
- },
- calendar: {
- sameDay: '[Ònì ni] LT',
- nextDay: '[Ọ̀la ni] LT',
- nextWeek: "dddd [Ọsẹ̀ tón'bọ] [ni] LT",
- lastDay: '[Àna ni] LT',
- lastWeek: 'dddd [Ọsẹ̀ tólọ́] [ni] LT',
- sameElse: 'L',
- },
- relativeTime: {
- future: 'ní %s',
- past: '%s kọjá',
- s: 'ìsẹjú aayá die',
- ss: 'aayá %d',
- m: 'ìsẹjú kan',
- mm: 'ìsẹjú %d',
- h: 'wákati kan',
- hh: 'wákati %d',
- d: 'ọjọ́ kan',
- dd: 'ọjọ́ %d',
- M: 'osù kan',
- MM: 'osù %d',
- y: 'ọdún kan',
- yy: 'ọdún %d',
- },
- dayOfMonthOrdinalParse: /ọjọ́\s\d{1,2}/,
- ordinal: 'ọjọ́ %d',
- week: {
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('zh-cn', {
- months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
- '_'
- ),
- monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
- '_'
- ),
- weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
- weekdaysShort: '周日_周一_周二_周三_周四_周五_周六'.split('_'),
- weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY/MM/DD',
- LL: 'YYYY年M月D日',
- LLL: 'YYYY年M月D日Ah点mm分',
- LLLL: 'YYYY年M月D日ddddAh点mm分',
- l: 'YYYY/M/D',
- ll: 'YYYY年M月D日',
- lll: 'YYYY年M月D日 HH:mm',
- llll: 'YYYY年M月D日dddd HH:mm',
- },
- meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
- return hour;
- } else if (meridiem === '下午' || meridiem === '晚上') {
- return hour + 12;
- } else {
- // '中午'
- return hour >= 11 ? hour : hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- var hm = hour * 100 + minute;
- if (hm < 600) {
- return '凌晨';
- } else if (hm < 900) {
- return '早上';
- } else if (hm < 1130) {
- return '上午';
- } else if (hm < 1230) {
- return '中午';
- } else if (hm < 1800) {
- return '下午';
- } else {
- return '晚上';
- }
- },
- calendar: {
- sameDay: '[今天]LT',
- nextDay: '[明天]LT',
- nextWeek: function (now) {
- if (now.week() !== this.week()) {
- return '[下]dddLT';
- } else {
- return '[本]dddLT';
- }
- },
- lastDay: '[昨天]LT',
- lastWeek: function (now) {
- if (this.week() !== now.week()) {
- return '[上]dddLT';
- } else {
- return '[本]dddLT';
- }
- },
- sameElse: 'L',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(日|月|周)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + '日';
- case 'M':
- return number + '月';
- case 'w':
- case 'W':
- return number + '周';
- default:
- return number;
- }
- },
- relativeTime: {
- future: '%s后',
- past: '%s前',
- s: '几秒',
- ss: '%d 秒',
- m: '1 分钟',
- mm: '%d 分钟',
- h: '1 小时',
- hh: '%d 小时',
- d: '1 天',
- dd: '%d 天',
- w: '1 周',
- ww: '%d 周',
- M: '1 个月',
- MM: '%d 个月',
- y: '1 年',
- yy: '%d 年',
- },
- week: {
- // GB/T 7408-1994《数据元和交换格式·信息交换·日期和时间表示法》与ISO 8601:1988等效
- dow: 1, // Monday is the first day of the week.
- doy: 4, // The week that contains Jan 4th is the first week of the year.
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('zh-hk', {
- months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
- '_'
- ),
- monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
- '_'
- ),
- weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
- weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
- weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY/MM/DD',
- LL: 'YYYY年M月D日',
- LLL: 'YYYY年M月D日 HH:mm',
- LLLL: 'YYYY年M月D日dddd HH:mm',
- l: 'YYYY/M/D',
- ll: 'YYYY年M月D日',
- lll: 'YYYY年M月D日 HH:mm',
- llll: 'YYYY年M月D日dddd HH:mm',
- },
- meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
- return hour;
- } else if (meridiem === '中午') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === '下午' || meridiem === '晚上') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- var hm = hour * 100 + minute;
- if (hm < 600) {
- return '凌晨';
- } else if (hm < 900) {
- return '早上';
- } else if (hm < 1200) {
- return '上午';
- } else if (hm === 1200) {
- return '中午';
- } else if (hm < 1800) {
- return '下午';
- } else {
- return '晚上';
- }
- },
- calendar: {
- sameDay: '[今天]LT',
- nextDay: '[明天]LT',
- nextWeek: '[下]ddddLT',
- lastDay: '[昨天]LT',
- lastWeek: '[上]ddddLT',
- sameElse: 'L',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + '日';
- case 'M':
- return number + '月';
- case 'w':
- case 'W':
- return number + '週';
- default:
- return number;
- }
- },
- relativeTime: {
- future: '%s後',
- past: '%s前',
- s: '幾秒',
- ss: '%d 秒',
- m: '1 分鐘',
- mm: '%d 分鐘',
- h: '1 小時',
- hh: '%d 小時',
- d: '1 天',
- dd: '%d 天',
- M: '1 個月',
- MM: '%d 個月',
- y: '1 年',
- yy: '%d 年',
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('zh-mo', {
- months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
- '_'
- ),
- monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
- '_'
- ),
- weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
- weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
- weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'DD/MM/YYYY',
- LL: 'YYYY年M月D日',
- LLL: 'YYYY年M月D日 HH:mm',
- LLLL: 'YYYY年M月D日dddd HH:mm',
- l: 'D/M/YYYY',
- ll: 'YYYY年M月D日',
- lll: 'YYYY年M月D日 HH:mm',
- llll: 'YYYY年M月D日dddd HH:mm',
- },
- meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
- return hour;
- } else if (meridiem === '中午') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === '下午' || meridiem === '晚上') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- var hm = hour * 100 + minute;
- if (hm < 600) {
- return '凌晨';
- } else if (hm < 900) {
- return '早上';
- } else if (hm < 1130) {
- return '上午';
- } else if (hm < 1230) {
- return '中午';
- } else if (hm < 1800) {
- return '下午';
- } else {
- return '晚上';
- }
- },
- calendar: {
- sameDay: '[今天] LT',
- nextDay: '[明天] LT',
- nextWeek: '[下]dddd LT',
- lastDay: '[昨天] LT',
- lastWeek: '[上]dddd LT',
- sameElse: 'L',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + '日';
- case 'M':
- return number + '月';
- case 'w':
- case 'W':
- return number + '週';
- default:
- return number;
- }
- },
- relativeTime: {
- future: '%s內',
- past: '%s前',
- s: '幾秒',
- ss: '%d 秒',
- m: '1 分鐘',
- mm: '%d 分鐘',
- h: '1 小時',
- hh: '%d 小時',
- d: '1 天',
- dd: '%d 天',
- M: '1 個月',
- MM: '%d 個月',
- y: '1 年',
- yy: '%d 年',
- },
- });
- //! moment.js locale configuration
- hooks.defineLocale('zh-tw', {
- months: '一月_二月_三月_四月_五月_六月_七月_八月_九月_十月_十一月_十二月'.split(
- '_'
- ),
- monthsShort: '1月_2月_3月_4月_5月_6月_7月_8月_9月_10月_11月_12月'.split(
- '_'
- ),
- weekdays: '星期日_星期一_星期二_星期三_星期四_星期五_星期六'.split('_'),
- weekdaysShort: '週日_週一_週二_週三_週四_週五_週六'.split('_'),
- weekdaysMin: '日_一_二_三_四_五_六'.split('_'),
- longDateFormat: {
- LT: 'HH:mm',
- LTS: 'HH:mm:ss',
- L: 'YYYY/MM/DD',
- LL: 'YYYY年M月D日',
- LLL: 'YYYY年M月D日 HH:mm',
- LLLL: 'YYYY年M月D日dddd HH:mm',
- l: 'YYYY/M/D',
- ll: 'YYYY年M月D日',
- lll: 'YYYY年M月D日 HH:mm',
- llll: 'YYYY年M月D日dddd HH:mm',
- },
- meridiemParse: /凌晨|早上|上午|中午|下午|晚上/,
- meridiemHour: function (hour, meridiem) {
- if (hour === 12) {
- hour = 0;
- }
- if (meridiem === '凌晨' || meridiem === '早上' || meridiem === '上午') {
- return hour;
- } else if (meridiem === '中午') {
- return hour >= 11 ? hour : hour + 12;
- } else if (meridiem === '下午' || meridiem === '晚上') {
- return hour + 12;
- }
- },
- meridiem: function (hour, minute, isLower) {
- var hm = hour * 100 + minute;
- if (hm < 600) {
- return '凌晨';
- } else if (hm < 900) {
- return '早上';
- } else if (hm < 1130) {
- return '上午';
- } else if (hm < 1230) {
- return '中午';
- } else if (hm < 1800) {
- return '下午';
- } else {
- return '晚上';
- }
- },
- calendar: {
- sameDay: '[今天] LT',
- nextDay: '[明天] LT',
- nextWeek: '[下]dddd LT',
- lastDay: '[昨天] LT',
- lastWeek: '[上]dddd LT',
- sameElse: 'L',
- },
- dayOfMonthOrdinalParse: /\d{1,2}(日|月|週)/,
- ordinal: function (number, period) {
- switch (period) {
- case 'd':
- case 'D':
- case 'DDD':
- return number + '日';
- case 'M':
- return number + '月';
- case 'w':
- case 'W':
- return number + '週';
- default:
- return number;
- }
- },
- relativeTime: {
- future: '%s後',
- past: '%s前',
- s: '幾秒',
- ss: '%d 秒',
- m: '1 分鐘',
- mm: '%d 分鐘',
- h: '1 小時',
- hh: '%d 小時',
- d: '1 天',
- dd: '%d 天',
- M: '1 個月',
- MM: '%d 個月',
- y: '1 年',
- yy: '%d 年',
- },
- });
- hooks.locale('en');
- return hooks;
- })));
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/mode/meta',["../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.modeInfo = [
- {name: "APL", mime: "text/apl", mode: "apl", ext: ["dyalog", "apl"]},
- {name: "PGP", mimes: ["application/pgp", "application/pgp-encrypted", "application/pgp-keys", "application/pgp-signature"], mode: "asciiarmor", ext: ["asc", "pgp", "sig"]},
- {name: "ASN.1", mime: "text/x-ttcn-asn", mode: "asn.1", ext: ["asn", "asn1"]},
- {name: "Asterisk", mime: "text/x-asterisk", mode: "asterisk", file: /^extensions\.conf$/i},
- {name: "Brainfuck", mime: "text/x-brainfuck", mode: "brainfuck", ext: ["b", "bf"]},
- {name: "C", mime: "text/x-csrc", mode: "clike", ext: ["c", "h", "ino"]},
- {name: "C++", mime: "text/x-c++src", mode: "clike", ext: ["cpp", "c++", "cc", "cxx", "hpp", "h++", "hh", "hxx"], alias: ["cpp"]},
- {name: "Cobol", mime: "text/x-cobol", mode: "cobol", ext: ["cob", "cpy"]},
- {name: "C#", mime: "text/x-csharp", mode: "clike", ext: ["cs"], alias: ["csharp", "cs"]},
- {name: "Clojure", mime: "text/x-clojure", mode: "clojure", ext: ["clj", "cljc", "cljx"]},
- {name: "ClojureScript", mime: "text/x-clojurescript", mode: "clojure", ext: ["cljs"]},
- {name: "Closure Stylesheets (GSS)", mime: "text/x-gss", mode: "css", ext: ["gss"]},
- {name: "CMake", mime: "text/x-cmake", mode: "cmake", ext: ["cmake", "cmake.in"], file: /^CMakeLists\.txt$/},
- {name: "CoffeeScript", mimes: ["application/vnd.coffeescript", "text/coffeescript", "text/x-coffeescript"], mode: "coffeescript", ext: ["coffee"], alias: ["coffee", "coffee-script"]},
- {name: "Common Lisp", mime: "text/x-common-lisp", mode: "commonlisp", ext: ["cl", "lisp", "el"], alias: ["lisp"]},
- {name: "Cypher", mime: "application/x-cypher-query", mode: "cypher", ext: ["cyp", "cypher"]},
- {name: "Cython", mime: "text/x-cython", mode: "python", ext: ["pyx", "pxd", "pxi"]},
- {name: "Crystal", mime: "text/x-crystal", mode: "crystal", ext: ["cr"]},
- {name: "CSS", mime: "text/css", mode: "css", ext: ["css"]},
- {name: "CQL", mime: "text/x-cassandra", mode: "sql", ext: ["cql"]},
- {name: "D", mime: "text/x-d", mode: "d", ext: ["d"]},
- {name: "Dart", mimes: ["application/dart", "text/x-dart"], mode: "dart", ext: ["dart"]},
- {name: "diff", mime: "text/x-diff", mode: "diff", ext: ["diff", "patch"]},
- {name: "Django", mime: "text/x-django", mode: "django"},
- {name: "Dockerfile", mime: "text/x-dockerfile", mode: "dockerfile", file: /^Dockerfile$/},
- {name: "DTD", mime: "application/xml-dtd", mode: "dtd", ext: ["dtd"]},
- {name: "Dylan", mime: "text/x-dylan", mode: "dylan", ext: ["dylan", "dyl", "intr"]},
- {name: "EBNF", mime: "text/x-ebnf", mode: "ebnf"},
- {name: "ECL", mime: "text/x-ecl", mode: "ecl", ext: ["ecl"]},
- {name: "edn", mime: "application/edn", mode: "clojure", ext: ["edn"]},
- {name: "Eiffel", mime: "text/x-eiffel", mode: "eiffel", ext: ["e"]},
- {name: "Elm", mime: "text/x-elm", mode: "elm", ext: ["elm"]},
- {name: "Embedded Javascript", mime: "application/x-ejs", mode: "htmlembedded", ext: ["ejs"]},
- {name: "Embedded Ruby", mime: "application/x-erb", mode: "htmlembedded", ext: ["erb"]},
- {name: "Erlang", mime: "text/x-erlang", mode: "erlang", ext: ["erl"]},
- {name: "Esper", mime: "text/x-esper", mode: "sql"},
- {name: "Factor", mime: "text/x-factor", mode: "factor", ext: ["factor"]},
- {name: "FCL", mime: "text/x-fcl", mode: "fcl"},
- {name: "Forth", mime: "text/x-forth", mode: "forth", ext: ["forth", "fth", "4th"]},
- {name: "Fortran", mime: "text/x-fortran", mode: "fortran", ext: ["f", "for", "f77", "f90", "f95"]},
- {name: "F#", mime: "text/x-fsharp", mode: "mllike", ext: ["fs"], alias: ["fsharp"]},
- {name: "Gas", mime: "text/x-gas", mode: "gas", ext: ["s"]},
- {name: "Gherkin", mime: "text/x-feature", mode: "gherkin", ext: ["feature"]},
- {name: "GitHub Flavored Markdown", mime: "text/x-gfm", mode: "gfm", file: /^(readme|contributing|history)\.md$/i},
- {name: "Go", mime: "text/x-go", mode: "go", ext: ["go"]},
- {name: "Groovy", mime: "text/x-groovy", mode: "groovy", ext: ["groovy", "gradle"], file: /^Jenkinsfile$/},
- {name: "HAML", mime: "text/x-haml", mode: "haml", ext: ["haml"]},
- {name: "Haskell", mime: "text/x-haskell", mode: "haskell", ext: ["hs"]},
- {name: "Haskell (Literate)", mime: "text/x-literate-haskell", mode: "haskell-literate", ext: ["lhs"]},
- {name: "Haxe", mime: "text/x-haxe", mode: "haxe", ext: ["hx"]},
- {name: "HXML", mime: "text/x-hxml", mode: "haxe", ext: ["hxml"]},
- {name: "ASP.NET", mime: "application/x-aspx", mode: "htmlembedded", ext: ["aspx"], alias: ["asp", "aspx"]},
- {name: "HTML", mime: "text/html", mode: "htmlmixed", ext: ["html", "htm", "handlebars", "hbs"], alias: ["xhtml"]},
- {name: "HTTP", mime: "message/http", mode: "http"},
- {name: "IDL", mime: "text/x-idl", mode: "idl", ext: ["pro"]},
- {name: "Pug", mime: "text/x-pug", mode: "pug", ext: ["jade", "pug"], alias: ["jade"]},
- {name: "Java", mime: "text/x-java", mode: "clike", ext: ["java"]},
- {name: "Java Server Pages", mime: "application/x-jsp", mode: "htmlembedded", ext: ["jsp"], alias: ["jsp"]},
- {name: "JavaScript", mimes: ["text/javascript", "text/ecmascript", "application/javascript", "application/x-javascript", "application/ecmascript"],
- mode: "javascript", ext: ["js"], alias: ["ecmascript", "js", "node"]},
- {name: "JSON", mimes: ["application/json", "application/x-json"], mode: "javascript", ext: ["json", "map"], alias: ["json5"]},
- {name: "JSON-LD", mime: "application/ld+json", mode: "javascript", ext: ["jsonld"], alias: ["jsonld"]},
- {name: "JSX", mime: "text/jsx", mode: "jsx", ext: ["jsx"]},
- {name: "Jinja2", mime: "text/jinja2", mode: "jinja2", ext: ["j2", "jinja", "jinja2"]},
- {name: "Julia", mime: "text/x-julia", mode: "julia", ext: ["jl"]},
- {name: "Kotlin", mime: "text/x-kotlin", mode: "clike", ext: ["kt"]},
- {name: "LESS", mime: "text/x-less", mode: "css", ext: ["less"]},
- {name: "LiveScript", mime: "text/x-livescript", mode: "livescript", ext: ["ls"], alias: ["ls"]},
- {name: "Lua", mime: "text/x-lua", mode: "lua", ext: ["lua"]},
- {name: "Markdown", mime: "text/x-markdown", mode: "markdown", ext: ["markdown", "md", "mkd"]},
- {name: "mIRC", mime: "text/mirc", mode: "mirc"},
- {name: "MariaDB SQL", mime: "text/x-mariadb", mode: "sql"},
- {name: "Mathematica", mime: "text/x-mathematica", mode: "mathematica", ext: ["m", "nb", "wl", "wls"]},
- {name: "Modelica", mime: "text/x-modelica", mode: "modelica", ext: ["mo"]},
- {name: "MUMPS", mime: "text/x-mumps", mode: "mumps", ext: ["mps"]},
- {name: "MS SQL", mime: "text/x-mssql", mode: "sql"},
- {name: "mbox", mime: "application/mbox", mode: "mbox", ext: ["mbox"]},
- {name: "MySQL", mime: "text/x-mysql", mode: "sql"},
- {name: "Nginx", mime: "text/x-nginx-conf", mode: "nginx", file: /nginx.*\.conf$/i},
- {name: "NSIS", mime: "text/x-nsis", mode: "nsis", ext: ["nsh", "nsi"]},
- {name: "NTriples", mimes: ["application/n-triples", "application/n-quads", "text/n-triples"],
- mode: "ntriples", ext: ["nt", "nq"]},
- {name: "Objective-C", mime: "text/x-objectivec", mode: "clike", ext: ["m"], alias: ["objective-c", "objc"]},
- {name: "Objective-C++", mime: "text/x-objectivec++", mode: "clike", ext: ["mm"], alias: ["objective-c++", "objc++"]},
- {name: "OCaml", mime: "text/x-ocaml", mode: "mllike", ext: ["ml", "mli", "mll", "mly"]},
- {name: "Octave", mime: "text/x-octave", mode: "octave", ext: ["m"]},
- {name: "Oz", mime: "text/x-oz", mode: "oz", ext: ["oz"]},
- {name: "Pascal", mime: "text/x-pascal", mode: "pascal", ext: ["p", "pas"]},
- {name: "PEG.js", mime: "null", mode: "pegjs", ext: ["jsonld"]},
- {name: "Perl", mime: "text/x-perl", mode: "perl", ext: ["pl", "pm"]},
- {name: "PHP", mimes: ["text/x-php", "application/x-httpd-php", "application/x-httpd-php-open"], mode: "php", ext: ["php", "php3", "php4", "php5", "php7", "phtml"]},
- {name: "Pig", mime: "text/x-pig", mode: "pig", ext: ["pig"]},
- {name: "Plain Text", mime: "text/plain", mode: "null", ext: ["txt", "text", "conf", "def", "list", "log"]},
- {name: "PLSQL", mime: "text/x-plsql", mode: "sql", ext: ["pls"]},
- {name: "PostgreSQL", mime: "text/x-pgsql", mode: "sql"},
- {name: "PowerShell", mime: "application/x-powershell", mode: "powershell", ext: ["ps1", "psd1", "psm1"]},
- {name: "Properties files", mime: "text/x-properties", mode: "properties", ext: ["properties", "ini", "in"], alias: ["ini", "properties"]},
- {name: "ProtoBuf", mime: "text/x-protobuf", mode: "protobuf", ext: ["proto"]},
- {name: "Python", mime: "text/x-python", mode: "python", ext: ["BUILD", "bzl", "py", "pyw"], file: /^(BUCK|BUILD)$/},
- {name: "Puppet", mime: "text/x-puppet", mode: "puppet", ext: ["pp"]},
- {name: "Q", mime: "text/x-q", mode: "q", ext: ["q"]},
- {name: "R", mime: "text/x-rsrc", mode: "r", ext: ["r", "R"], alias: ["rscript"]},
- {name: "reStructuredText", mime: "text/x-rst", mode: "rst", ext: ["rst"], alias: ["rst"]},
- {name: "RPM Changes", mime: "text/x-rpm-changes", mode: "rpm"},
- {name: "RPM Spec", mime: "text/x-rpm-spec", mode: "rpm", ext: ["spec"]},
- {name: "Ruby", mime: "text/x-ruby", mode: "ruby", ext: ["rb"], alias: ["jruby", "macruby", "rake", "rb", "rbx"]},
- {name: "Rust", mime: "text/x-rustsrc", mode: "rust", ext: ["rs"]},
- {name: "SAS", mime: "text/x-sas", mode: "sas", ext: ["sas"]},
- {name: "Sass", mime: "text/x-sass", mode: "sass", ext: ["sass"]},
- {name: "Scala", mime: "text/x-scala", mode: "clike", ext: ["scala"]},
- {name: "Scheme", mime: "text/x-scheme", mode: "scheme", ext: ["scm", "ss"]},
- {name: "SCSS", mime: "text/x-scss", mode: "css", ext: ["scss"]},
- {name: "Shell", mimes: ["text/x-sh", "application/x-sh"], mode: "shell", ext: ["sh", "ksh", "bash"], alias: ["bash", "sh", "zsh"], file: /^PKGBUILD$/},
- {name: "Sieve", mime: "application/sieve", mode: "sieve", ext: ["siv", "sieve"]},
- {name: "Slim", mimes: ["text/x-slim", "application/x-slim"], mode: "slim", ext: ["slim"]},
- {name: "Smalltalk", mime: "text/x-stsrc", mode: "smalltalk", ext: ["st"]},
- {name: "Smarty", mime: "text/x-smarty", mode: "smarty", ext: ["tpl"]},
- {name: "Solr", mime: "text/x-solr", mode: "solr"},
- {name: "SML", mime: "text/x-sml", mode: "mllike", ext: ["sml", "sig", "fun", "smackspec"]},
- {name: "Soy", mime: "text/x-soy", mode: "soy", ext: ["soy"], alias: ["closure template"]},
- {name: "SPARQL", mime: "application/sparql-query", mode: "sparql", ext: ["rq", "sparql"], alias: ["sparul"]},
- {name: "Spreadsheet", mime: "text/x-spreadsheet", mode: "spreadsheet", alias: ["excel", "formula"]},
- {name: "SQL", mime: "text/x-sql", mode: "sql", ext: ["sql"]},
- {name: "SQLite", mime: "text/x-sqlite", mode: "sql"},
- {name: "Squirrel", mime: "text/x-squirrel", mode: "clike", ext: ["nut"]},
- {name: "Stylus", mime: "text/x-styl", mode: "stylus", ext: ["styl"]},
- {name: "Swift", mime: "text/x-swift", mode: "swift", ext: ["swift"]},
- {name: "sTeX", mime: "text/x-stex", mode: "stex"},
- {name: "LaTeX", mime: "text/x-latex", mode: "stex", ext: ["text", "ltx", "tex"], alias: ["tex"]},
- {name: "SystemVerilog", mime: "text/x-systemverilog", mode: "verilog", ext: ["v", "sv", "svh"]},
- {name: "Tcl", mime: "text/x-tcl", mode: "tcl", ext: ["tcl"]},
- {name: "Textile", mime: "text/x-textile", mode: "textile", ext: ["textile"]},
- {name: "TiddlyWiki", mime: "text/x-tiddlywiki", mode: "tiddlywiki"},
- {name: "Tiki wiki", mime: "text/tiki", mode: "tiki"},
- {name: "TOML", mime: "text/x-toml", mode: "toml", ext: ["toml"]},
- {name: "Tornado", mime: "text/x-tornado", mode: "tornado"},
- {name: "troff", mime: "text/troff", mode: "troff", ext: ["1", "2", "3", "4", "5", "6", "7", "8", "9"]},
- {name: "TTCN", mime: "text/x-ttcn", mode: "ttcn", ext: ["ttcn", "ttcn3", "ttcnpp"]},
- {name: "TTCN_CFG", mime: "text/x-ttcn-cfg", mode: "ttcn-cfg", ext: ["cfg"]},
- {name: "Turtle", mime: "text/turtle", mode: "turtle", ext: ["ttl"]},
- {name: "TypeScript", mime: "application/typescript", mode: "javascript", ext: ["ts"], alias: ["ts"]},
- {name: "TypeScript-JSX", mime: "text/typescript-jsx", mode: "jsx", ext: ["tsx"], alias: ["tsx"]},
- {name: "Twig", mime: "text/x-twig", mode: "twig"},
- {name: "Web IDL", mime: "text/x-webidl", mode: "webidl", ext: ["webidl"]},
- {name: "VB.NET", mime: "text/x-vb", mode: "vb", ext: ["vb"]},
- {name: "VBScript", mime: "text/vbscript", mode: "vbscript", ext: ["vbs"]},
- {name: "Velocity", mime: "text/velocity", mode: "velocity", ext: ["vtl"]},
- {name: "Verilog", mime: "text/x-verilog", mode: "verilog", ext: ["v"]},
- {name: "VHDL", mime: "text/x-vhdl", mode: "vhdl", ext: ["vhd", "vhdl"]},
- {name: "Vue.js Component", mimes: ["script/x-vue", "text/x-vue"], mode: "vue", ext: ["vue"]},
- {name: "XML", mimes: ["application/xml", "text/xml"], mode: "xml", ext: ["xml", "xsl", "xsd", "svg"], alias: ["rss", "wsdl", "xsd"]},
- {name: "XQuery", mime: "application/xquery", mode: "xquery", ext: ["xy", "xquery"]},
- {name: "Yacas", mime: "text/x-yacas", mode: "yacas", ext: ["ys"]},
- {name: "YAML", mimes: ["text/x-yaml", "text/yaml"], mode: "yaml", ext: ["yaml", "yml"], alias: ["yml"]},
- {name: "Z80", mime: "text/x-z80", mode: "z80", ext: ["z80"]},
- {name: "mscgen", mime: "text/x-mscgen", mode: "mscgen", ext: ["mscgen", "mscin", "msc"]},
- {name: "xu", mime: "text/x-xu", mode: "mscgen", ext: ["xu"]},
- {name: "msgenny", mime: "text/x-msgenny", mode: "mscgen", ext: ["msgenny"]},
- {name: "WebAssembly", mime: "text/webassembly", mode: "wast", ext: ["wat", "wast"]},
- ];
- // Ensure all modes have a mime property for backwards compatibility
- for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
- var info = CodeMirror.modeInfo[i];
- if (info.mimes) info.mime = info.mimes[0];
- }
- CodeMirror.findModeByMIME = function(mime) {
- mime = mime.toLowerCase();
- for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
- var info = CodeMirror.modeInfo[i];
- if (info.mime == mime) return info;
- if (info.mimes) for (var j = 0; j < info.mimes.length; j++)
- if (info.mimes[j] == mime) return info;
- }
- if (/\+xml$/.test(mime)) return CodeMirror.findModeByMIME("application/xml")
- if (/\+json$/.test(mime)) return CodeMirror.findModeByMIME("application/json")
- };
- CodeMirror.findModeByExtension = function(ext) {
- ext = ext.toLowerCase();
- for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
- var info = CodeMirror.modeInfo[i];
- if (info.ext) for (var j = 0; j < info.ext.length; j++)
- if (info.ext[j] == ext) return info;
- }
- };
- CodeMirror.findModeByFileName = function(filename) {
- for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
- var info = CodeMirror.modeInfo[i];
- if (info.file && info.file.test(filename)) return info;
- }
- var dot = filename.lastIndexOf(".");
- var ext = dot > -1 && filename.substring(dot + 1, filename.length);
- if (ext) return CodeMirror.findModeByExtension(ext);
- };
- CodeMirror.findModeByName = function(name) {
- name = name.toLowerCase();
- for (var i = 0; i < CodeMirror.modeInfo.length; i++) {
- var info = CodeMirror.modeInfo[i];
- if (info.name.toLowerCase() == name) return info;
- if (info.alias) for (var j = 0; j < info.alias.length; j++)
- if (info.alias[j].toLowerCase() == name) return info;
- }
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/utils',[
- 'jquery',
- 'codemirror/lib/codemirror',
- 'moment',
- 'underscore',
- // silently upgrades CodeMirror
- 'codemirror/mode/meta',
- ], function($, CodeMirror, moment, _){
- "use strict";
-
- // keep track of which extensions have been loaded already
- var extensions_loaded = [];
- /**
- * Whether or not an extension has been loaded
- * @param {string} extension - name of the extension
- * @return {boolean} true if loaded already
- */
- var is_loaded = function(extension) {
- var ext_path = "nbextensions/" + extension;
- return extensions_loaded.indexOf(ext_path) >= 0;
- };
- /**
- * Load a single extension.
- * @param {string} extension - extension path.
- * @return {Promise} that resolves to an extension module handle
- */
- var load_extension = function (extension) {
- return new Promise(function(resolve, reject) {
- var ext_path = "nbextensions/" + extension;
- requirejs([ext_path], function(module) {
- if (!is_loaded(extension)) {
- console.log("Loading extension: " + extension);
- if (module && module.load_ipython_extension) {
- Promise.resolve(module.load_ipython_extension()).then(function() {
- resolve(module);
- }).catch(reject);
- }
- extensions_loaded.push(ext_path);
- } else {
- console.log("Loaded extension already: " + extension);
- resolve(module);
- }
- }, function(err) {
- reject(err);
- });
- });
- };
- /**
- * Load multiple extensions.
- * Takes n-args, where each arg is a string path to the extension.
- * @return {Promise} that resolves to a list of loaded module handles.
- */
- var load_extensions = function () {
- console.log('load_extensions', arguments);
- return Promise.all(Array.prototype.map.call(arguments, load_extension)).catch(function(err) {
- console.error("Failed to load extension" + (err.requireModules.length>1?'s':'') + ":", err.requireModules, err);
- });
- };
- /**
- * Return a list of extensions that should be active
- * The config for nbextensions comes in as a dict where keys are
- * nbextensions paths and the values are a bool indicating if it
- * should be active. This returns a list of nbextension paths
- * where the value is true
- */
- function filter_extensions(nbext_config) {
- var active = [];
- Object.keys(nbext_config).forEach(function (nbext) {
- if (nbext_config[nbext]) {active.push(nbext);}
- });
- return active;
- }
- /**
- * Wait for a config section to load, and then load the extensions specified
- * in a 'load_extensions' key inside it.
- */
- function load_extensions_from_config(section) {
- return section.loaded.then(function() {
- if (section.data.load_extensions) {
- var active = filter_extensions(section.data.load_extensions);
- return load_extensions.apply(this, active);
- }
- }).catch(utils.reject('Could not load nbextensions from ' + section.section_name + ' config file'));
- }
- //============================================================================
- // Cross-browser RegEx Split
- //============================================================================
- // This code has been MODIFIED from the code licensed below to not replace the
- // default browser split. The license is reproduced here.
- // see http://blog.stevenlevithan.com/archives/cross-browser-split for more info:
- /*!
- * Cross-Browser Split 1.1.1
- * Copyright 2007-2012 Steven Levithan <stevenlevithan.com>
- * Available under the MIT License
- * ECMAScript compliant, uniform cross-browser split method
- */
- /**
- * Splits a string into an array of strings using a regex or string
- * separator. Matches of the separator are not included in the result array.
- * However, if `separator` is a regex that contains capturing groups,
- * backreferences are spliced into the result each time `separator` is
- * matched. Fixes browser bugs compared to the native
- * `String.prototype.split` and can be used reliably cross-browser.
- * @param {String} str String to split.
- * @param {RegExp} separator Regex to use for separating
- * the string.
- * @param {Number} [limit] Maximum number of items to include in the result
- * array.
- * @returns {Array} Array of substrings.
- * @example
- *
- * // Basic use
- * regex_split('a b c d', ' ');
- * // -> ['a', 'b', 'c', 'd']
- *
- * // With limit
- * regex_split('a b c d', ' ', 2);
- * // -> ['a', 'b']
- *
- * // Backreferences in result array
- * regex_split('..word1 word2..', /([a-z]+)(\d+)/i);
- * // -> ['..', 'word', '1', ' ', 'word', '2', '..']
- */
- var regex_split = function (str, separator, limit) {
- var output = [],
- flags = (separator.ignoreCase ? "i" : "") +
- (separator.multiline ? "m" : "") +
- (separator.extended ? "x" : "") + // Proposed for ES6
- (separator.sticky ? "y" : ""), // Firefox 3+
- lastLastIndex = 0,
- separator2, match, lastIndex, lastLength;
- // Make `global` and avoid `lastIndex` issues by working with a copy
- separator = new RegExp(separator.source, flags + "g");
- var compliantExecNpcg = typeof(/()??/.exec("")[1]) === "undefined";
- if (!compliantExecNpcg) {
- // Doesn't need flags gy, but they don't hurt
- separator2 = new RegExp("^" + separator.source + "$(?!\\s)", flags);
- }
- /* Values for `limit`, per the spec:
- * If undefined: 4294967295 // Math.pow(2, 32) - 1
- * If 0, Infinity, or NaN: 0
- * If positive number: limit = Math.floor(limit); if (limit > 4294967295) limit -= 4294967296;
- * If negative number: 4294967296 - Math.floor(Math.abs(limit))
- * If other: Type-convert, then use the above rules
- */
- limit = typeof(limit) === "undefined" ?
- -1 >>> 0 : // Math.pow(2, 32) - 1
- limit >>> 0; // ToUint32(limit)
- for (match = separator.exec(str); match; match = separator.exec(str)) {
- // `separator.lastIndex` is not reliable cross-browser
- lastIndex = match.index + match[0].length;
- if (lastIndex > lastLastIndex) {
- output.push(str.slice(lastLastIndex, match.index));
- // Fix browsers whose `exec` methods don't consistently return `undefined` for
- // nonparticipating capturing groups
- if (!compliantExecNpcg && match.length > 1) {
- match[0].replace(separator2, function () {
- for (var i = 1; i < arguments.length - 2; i++) {
- if (typeof(arguments[i]) === "undefined") {
- match[i] = undefined;
- }
- }
- });
- }
- if (match.length > 1 && match.index < str.length) {
- Array.prototype.push.apply(output, match.slice(1));
- }
- lastLength = match[0].length;
- lastLastIndex = lastIndex;
- if (output.length >= limit) {
- break;
- }
- }
- if (separator.lastIndex === match.index) {
- separator.lastIndex++; // Avoid an infinite loop
- }
- }
- if (lastLastIndex === str.length) {
- if (lastLength || !separator.test("")) {
- output.push("");
- }
- } else {
- output.push(str.slice(lastLastIndex));
- }
- return output.length > limit ? output.slice(0, limit) : output;
- };
- //============================================================================
- // End contributed Cross-browser RegEx Split
- //============================================================================
- var uuid = function () {
- /**
- * http://www.ietf.org/rfc/rfc4122.txt
- */
- var s = [];
- var hexDigits = "0123456789abcdef";
- for (var i = 0; i < 32; i++) {
- s[i] = hexDigits.substr(Math.floor(Math.random() * 0x10), 1);
- }
- s[12] = "4"; // bits 12-15 of the time_hi_and_version field to 0010
- s[16] = hexDigits.substr((s[16] & 0x3) | 0x8, 1); // bits 6-7 of the clock_seq_hi_and_reserved to 01
- var uuid = s.join("");
- return uuid;
- };
- var _ANSI_COLORS = [
- "ansi-black",
- "ansi-red",
- "ansi-green",
- "ansi-yellow",
- "ansi-blue",
- "ansi-magenta",
- "ansi-cyan",
- "ansi-white",
- "ansi-black-intense",
- "ansi-red-intense",
- "ansi-green-intense",
- "ansi-yellow-intense",
- "ansi-blue-intense",
- "ansi-magenta-intense",
- "ansi-cyan-intense",
- "ansi-white-intense",
- ];
-
- function _pushColoredChunk(chunk, fg, bg, bold, underline, inverse, out) {
- if (chunk) {
- var classes = [];
- var styles = [];
- if (bold && typeof fg === "number" && 0 <= fg && fg < 8) {
- fg += 8; // Bold text uses "intense" colors
- }
- if (inverse) {
- [fg, bg] = [bg, fg];
- }
- if (typeof fg === "number") {
- classes.push(_ANSI_COLORS[fg] + "-fg");
- } else if (fg.length) {
- styles.push("color: rgb(" + fg + ")");
- } else if (inverse) {
- classes.push("ansi-default-inverse-fg");
- }
- if (typeof bg === "number") {
- classes.push(_ANSI_COLORS[bg] + "-bg");
- } else if (bg.length) {
- styles.push("background-color: rgb(" + bg + ")");
- } else if (inverse) {
- classes.push("ansi-default-inverse-bg");
- }
- if (bold) {
- classes.push("ansi-bold");
- }
- if (underline) {
- classes.push("ansi-underline");
- }
- if (classes.length || styles.length) {
- out.push("<span");
- if (classes.length) {
- out.push(' class="' + classes.join(" ") + '"');
- }
- if (styles.length) {
- out.push(' style="' + styles.join("; ") + '"');
- }
- out.push(">");
- out.push(chunk);
- out.push("</span>");
- } else {
- out.push(chunk);
- }
- }
- }
- function _getExtendedColors(numbers) {
- var r, g, b;
- var n = numbers.shift();
- if (n === 2 && numbers.length >= 3) {
- // 24-bit RGB
- r = numbers.shift();
- g = numbers.shift();
- b = numbers.shift();
- if ([r, g, b].some(function (c) { return c < 0 || 255 < c; })) {
- throw new RangeError("Invalid range for RGB colors");
- }
- } else if (n === 5 && numbers.length >= 1) {
- // 256 colors
- var idx = numbers.shift();
- if (idx < 0) {
- throw new RangeError("Color index must be >= 0");
- } else if (idx < 16) {
- // 16 default terminal colors
- return idx;
- } else if (idx < 232) {
- // 6x6x6 color cube, see https://stackoverflow.com/a/27165165/500098
- r = Math.floor((idx - 16) / 36);
- r = r > 0 ? 55 + r * 40 : 0;
- g = Math.floor(((idx - 16) % 36) / 6);
- g = g > 0 ? 55 + g * 40 : 0;
- b = (idx - 16) % 6;
- b = b > 0 ? 55 + b * 40 : 0;
- } else if (idx < 256) {
- // grayscale, see https://stackoverflow.com/a/27165165/500098
- r = g = b = (idx - 232) * 10 + 8;
- } else {
- throw new RangeError("Color index must be < 256");
- }
- } else {
- throw new RangeError("Invalid extended color specification");
- }
- return [r, g, b];
- }
- function _ansispan(str) {
- var ansi_re = /\x1b\[(.*?)([@-~])/g;
- var fg = [];
- var bg = [];
- var bold = false;
- var underline = false;
- var inverse = false;
- var match;
- var out = [];
- var numbers = [];
- var start = 0;
- str += "\x1b[m"; // Ensure markup for trailing text
- while ((match = ansi_re.exec(str))) {
- if (match[2] === "m") {
- var items = match[1].split(";");
- for (var i = 0; i < items.length; i++) {
- var item = items[i];
- if (item === "") {
- numbers.push(0);
- } else if (item.search(/^\d+$/) !== -1) {
- numbers.push(parseInt(item));
- } else {
- // Ignored: Invalid color specification
- numbers.length = 0;
- break;
- }
- }
- } else {
- // Ignored: Not a color code
- }
- var chunk = str.substring(start, match.index);
- _pushColoredChunk(chunk, fg, bg, bold, underline, inverse, out);
- start = ansi_re.lastIndex;
- while (numbers.length) {
- var n = numbers.shift();
- switch (n) {
- case 0:
- fg = bg = [];
- bold = false;
- underline = false;
- inverse = false;
- break;
- case 1:
- case 5:
- bold = true;
- break;
- case 4:
- underline = true;
- break;
- case 7:
- inverse = true;
- break;
- case 21:
- case 22:
- bold = false;
- break;
- case 24:
- underline = false;
- break;
- case 27:
- inverse = false;
- break;
- case 30:
- case 31:
- case 32:
- case 33:
- case 34:
- case 35:
- case 36:
- case 37:
- fg = n - 30;
- break;
- case 38:
- try {
- fg = _getExtendedColors(numbers);
- } catch(e) {
- numbers.length = 0;
- }
- break;
- case 39:
- fg = [];
- break;
- case 40:
- case 41:
- case 42:
- case 43:
- case 44:
- case 45:
- case 46:
- case 47:
- bg = n - 40;
- break;
- case 48:
- try {
- bg = _getExtendedColors(numbers);
- } catch(e) {
- numbers.length = 0;
- }
- break;
- case 49:
- bg = [];
- break;
- case 90:
- case 91:
- case 92:
- case 93:
- case 94:
- case 95:
- case 96:
- case 97:
- fg = n - 90 + 8;
- break;
- case 100:
- case 101:
- case 102:
- case 103:
- case 104:
- case 105:
- case 106:
- case 107:
- bg = n - 100 + 8;
- break;
- default:
- // Unknown codes are ignored
- }
- }
- }
- return out.join("");
- }
- // Transform ANSI color escape codes into HTML <span> tags with CSS
- // classes such as "ansi-green-intense-fg".
- // The actual colors used are set in the CSS file.
- // This is supposed to have the same behavior as nbconvert.filters.ansi2html()
- function fixConsole(txt) {
- txt = _.escape(txt);
- // color ansi codes (and remove non-color escape sequences)
- txt = _ansispan(txt);
- return txt;
- }
- // Remove chunks that should be overridden by the effect of
- // carriage return characters
- function fixCarriageReturn(txt) {
- txt = txt.replace(/\r+\n/gm, '\n'); // \r followed by \n --> newline
- while (txt.search(/\r[^$]/g) > -1) {
- var base = txt.match(/^(.*)\r+/m)[1];
- var insert = txt.match(/\r+(.*)$/m)[1];
- insert = insert + base.slice(insert.length, base.length);
- txt = txt.replace(/\r+.*$/m, '\r').replace(/^.*\r/m, insert);
- }
- return txt;
- }
- // Remove characters that are overridden by backspace characters
- function fixBackspace(txt) {
- var tmp = txt;
- do {
- txt = tmp;
- // Cancel out anything-but-newline followed by backspace
- tmp = txt.replace(/[^\n]\x08/gm, '');
- } while (tmp.length < txt.length);
- return txt;
- }
- // Remove characters overridden by backspace and carriage return
- function fixOverwrittenChars(txt) {
- return fixCarriageReturn(fixBackspace(txt));
- }
- // Locate any URLs and convert them to an anchor tag
- function autoLinkUrls(txt) {
- return txt.replace(/(^|\s)(https?|ftp)(:[^'"<>\s]+)/gi,
- "$1<a target=\"_blank\" href=\"$2$3\">$2$3</a>");
- }
- var points_to_pixels = function (points) {
- /**
- * A reasonably good way of converting between points and pixels.
- */
- var test = $('<div style="display: none; width: 10000pt; padding:0; border:0;"></div>');
- $('body').append(test);
- var pixel_per_point = test.width()/10000;
- test.remove();
- return Math.floor(points*pixel_per_point);
- };
-
- var always_new = function (constructor) {
- /**
- * wrapper around contructor to avoid requiring `var a = new constructor()`
- * useful for passing constructors as callbacks,
- * not for programmer laziness.
- * from https://programmers.stackexchange.com/questions/118798
- */
- return function () {
- var obj = Object.create(constructor.prototype);
- constructor.apply(obj, arguments);
- return obj;
- };
- };
- var url_path_join = function () {
- /**
- * join a sequence of url components with '/'
- */
- var url = '';
- for (var i = 0; i < arguments.length; i++) {
- if (arguments[i] === '') {
- continue;
- }
- if (url.length > 0 && url[url.length-1] != '/') {
- url = url + '/' + arguments[i];
- } else {
- url = url + arguments[i];
- }
- }
- url = url.replace(/\/\/+/, '/');
- return url;
- };
-
- var url_path_split = function (path) {
- /**
- * Like os.path.split for URLs.
- * Always returns two strings, the directory path and the base filename
- */
-
- var idx = path.lastIndexOf('/');
- if (idx === -1) {
- return ['', path];
- } else {
- return [ path.slice(0, idx), path.slice(idx + 1) ];
- }
- };
-
- var parse_url = function (url) {
- /**
- * an `a` element with an href allows attr-access to the parsed segments of a URL
- * a = parse_url("http://localhost:8888/path/name#hash")
- * a.protocol = "http:"
- * a.host = "localhost:8888"
- * a.hostname = "localhost"
- * a.port = 8888
- * a.pathname = "/path/name"
- * a.hash = "#hash"
- */
- var a = document.createElement("a");
- a.href = url;
- return a;
- };
-
- var encode_uri_components = function (uri) {
- /**
- * encode just the components of a multi-segment uri,
- * leaving '/' separators
- */
- return uri.split('/').map(encodeURIComponent).join('/');
- };
-
- var url_join_encode = function () {
- /**
- * join a sequence of url components with '/',
- * encoding each component with encodeURIComponent
- */
- return encode_uri_components(url_path_join.apply(null, arguments));
- };
- var splitext = function (filename) {
- /**
- * mimic Python os.path.splitext
- * Returns ['base', '.ext']
- */
- var idx = filename.lastIndexOf('.');
- if (idx > 0) {
- return [filename.slice(0, idx), filename.slice(idx)];
- } else {
- return [filename, ''];
- }
- };
- var escape_html = function (text) {
- /**
- * escape text to HTML
- */
- return $("<div/>").text(text).html();
- };
- var get_body_data = function(key) {
- /**
- * get a url-encoded item from body.data and decode it
- * we should never have any encoded URLs anywhere else in code
- * until we are building an actual request
- */
- var val = $('body').data(key);
- if (typeof val === 'undefined')
- return val;
- return decodeURIComponent(val);
- };
-
- var to_absolute_cursor_pos = function (cm, cursor) {
- console.warn('`utils.to_absolute_cursor_pos(cm, pos)` is deprecated. Use `cm.indexFromPos(cursor)`');
- return cm.indexFromPos(cursor);
- };
-
- var from_absolute_cursor_pos = function (cm, cursor_pos) {
- console.warn('`utils.from_absolute_cursor_pos(cm, pos)` is deprecated. Use `cm.posFromIndex(index)`');
- return cm.posFromIndex(cursor_pos);
- };
-
- // https://stackoverflow.com/questions/2400935/browser-detection-in-javascript
- var browser = (function() {
- if (typeof navigator === 'undefined') {
- // navigator undefined in node
- return 'None';
- }
- var N= navigator.appName, ua= navigator.userAgent, tem;
- var M= ua.match(/(opera|chrome|safari|firefox|msie)\/?\s*(\.?\d+(\.\d+)*)/i);
- if (M && (tem= ua.match(/version\/([\.\d]+)/i)) !== null) M[2]= tem[1];
- M= M? [M[1], M[2]]: [N, navigator.appVersion,'-?'];
- return M;
- })();
- // https://stackoverflow.com/questions/11219582/how-to-detect-my-browser-version-and-operating-system-using-javascript
- var platform = (function () {
- if (typeof navigator === 'undefined') {
- // navigator undefined in node
- return 'None';
- }
- var OSName="None";
- if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
- if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
- if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
- if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
- return OSName;
- })();
-
- var get_url_param = function (name) {
- // get a URL parameter. I cannot believe we actually need this.
- // Based on https://stackoverflow.com/a/25359264/938949
- var match = new RegExp('[?&]' + name + '=([^&]*)').exec(window.location.search);
- if (match){
- return decodeURIComponent(match[1] || '');
- }
- };
-
- var is_or_has = function (a, b) {
- /**
- * Is b a child of a or a itself?
- */
- return a.has(b).length !==0 || a.is(b);
- };
- var is_focused = function (e) {
- /**
- * Is element e, or one of its children focused?
- */
- e = $(e);
- var target = $(document.activeElement);
- if (target.length > 0) {
- if (is_or_has(e, target)) {
- return true;
- } else {
- return false;
- }
- } else {
- return false;
- }
- };
-
- var mergeopt = function(_class, options, overwrite){
- options = options || {};
- overwrite = overwrite || {};
- return $.extend(true, {}, _class.options_default, options, overwrite);
- };
-
- var ajax_error_msg = function (jqXHR) {
- /**
- * Return a JSON error message if there is one,
- * otherwise the basic HTTP status text.
- */
- if (jqXHR.responseJSON && jqXHR.responseJSON.traceback) {
- return jqXHR.responseJSON.traceback;
- } else if (jqXHR.responseJSON && jqXHR.responseJSON.message) {
- return jqXHR.responseJSON.message;
- } else {
- return jqXHR.statusText;
- }
- };
- var log_ajax_error = function (jqXHR, status, error) {
- /**
- * log ajax failures with informative messages
- */
- var msg = "API request failed (" + jqXHR.status + "): ";
- console.log(jqXHR);
- msg += ajax_error_msg(jqXHR);
- console.log(msg);
- };
- var requireCodeMirrorMode = function (mode, callback, errback) {
- /**
- * find a predefined mode or detect from CM metadata then
- * require and callback with the resolvable mode string: mime or
- * custom name
- */
- var modename = (typeof mode == "string") ? mode :
- mode.mode || mode.name;
- // simplest, cheapest check by mode name: mode may also have config
- if (CodeMirror.modes.hasOwnProperty(modename)) {
- // return the full mode object, if it has a name
- callback(mode.name ? mode : modename);
- return;
- }
- // *somehow* get back a CM.modeInfo-like object that has .mode and
- // .mime
- var info = (mode && mode.mode && mode.mime && mode) ||
- CodeMirror.findModeByName(modename) ||
- CodeMirror.findModeByExtension(modename.split(".").slice(-1)[0]) ||
- CodeMirror.findModeByMIME(modename) ||
- {mode: modename, mime: modename};
- requirejs([
- // might want to use CodeMirror.modeURL here
- ['codemirror/mode', info.mode, info.mode].join('/'),
- ], function() {
- // return the original mode, as from a kernelspec on first load
- // or the mimetype, as for most highlighting
- callback(mode.name ? mode : info.mime);
- }, errback
- );
- };
-
- /** Error type for wrapped XHR errors. */
- var XHR_ERROR = 'XhrError';
-
- /**
- * Wraps an AJAX error as an Error object.
- */
- var wrap_ajax_error = function (jqXHR, status, error) {
- var wrapped_error = new Error(ajax_error_msg(jqXHR));
- wrapped_error.name = XHR_ERROR;
- // provide xhr response
- wrapped_error.xhr = jqXHR;
- wrapped_error.xhr_status = status;
- wrapped_error.xhr_error = error;
- return wrapped_error;
- };
-
- var ajax = function (url, settings) {
- // like $.ajax, but ensure XSRF or Authorization header is set
- if (typeof url === "object") {
- // called with single argument: $.ajax({url: '...'})
- settings = url;
- url = settings.url;
- delete settings.url;
- }
- settings = _add_auth_header(settings);
- return $.ajax(url, settings);
- };
-
- var _get_cookie = function (name) {
- // from tornado docs: http://www.tornadoweb.org/en/stable/guide/security.html
- var r = document.cookie.match("\\b" + name + "=([^;]*)\\b");
- return r ? r[1] : undefined;
- }
- var _add_auth_header = function (settings) {
- /**
- * Adds auth header to jquery ajax settings
- */
- settings = settings || {};
- if (!settings.headers) {
- settings.headers = {};
- }
- if (!settings.headers.Authorization) {
- var xsrf_token = _get_cookie('_xsrf');
- if (xsrf_token) {
- settings.headers['X-XSRFToken'] = xsrf_token;
- }
- }
- return settings;
- };
- var promising_ajax = function(url, settings) {
- /**
- * Like $.ajax, but returning an ES6 promise. success and error settings
- * will be ignored.
- */
- settings = settings || {};
- return new Promise(function(resolve, reject) {
- settings.success = function(data, status, jqXHR) {
- resolve(data);
- };
- settings.error = function(jqXHR, status, error) {
- log_ajax_error(jqXHR, status, error);
- reject(wrap_ajax_error(jqXHR, status, error));
- };
- ajax(url, settings);
- });
- };
- var WrappedError = function(message, error){
- /**
- * Wrappable Error class
- *
- * The Error class doesn't actually act on `this`. Instead it always
- * returns a new instance of Error. Here we capture that instance so we
- * can apply it's properties to `this`.
- */
- var tmp = Error.apply(this, [message]);
- // Copy the properties of the error over to this.
- var properties = Object.getOwnPropertyNames(tmp);
- for (var i = 0; i < properties.length; i++) {
- this[properties[i]] = tmp[properties[i]];
- }
- // Keep a stack of the original error messages.
- if (error instanceof WrappedError) {
- this.error_stack = error.error_stack;
- } else {
- this.error_stack = [error];
- }
- this.error_stack.push(tmp);
- return this;
- };
- WrappedError.prototype = Object.create(Error.prototype, {});
- var load_class = function(class_name, module_name, registry) {
- /**
- * Tries to load a class
- *
- * Tries to load a class from a module using require.js, if a module
- * is specified, otherwise tries to load a class from the global
- * registry, if the global registry is provided.
- */
- return new Promise(function(resolve, reject) {
- // Try loading the view module using require.js
- if (module_name) {
- requirejs([module_name], function(module) {
- if (module[class_name] === undefined) {
- reject(new Error('Class '+class_name+' not found in module '+module_name));
- } else {
- resolve(module[class_name]);
- }
- }, reject);
- } else {
- if (registry && registry[class_name]) {
- resolve(registry[class_name]);
- } else {
- reject(new Error('Class '+class_name+' not found in registry '));
- }
- }
- });
- };
- var resolve_promises_dict = function(d) {
- /**
- * Resolve a promiseful dictionary.
- * Returns a single Promise.
- */
- var keys = Object.keys(d);
- var values = [];
- keys.forEach(function(key) {
- values.push(d[key]);
- });
- return Promise.all(values).then(function(v) {
- d = {};
- for(var i=0; i<keys.length; i++) {
- d[keys[i]] = v[i];
- }
- return d;
- });
- };
- var reject = function(message, log) {
- /**
- * Creates a wrappable Promise rejection function.
- *
- * Creates a function that returns a Promise.reject with a new WrappedError
- * that has the provided message and wraps the original error that
- * caused the promise to reject.
- */
- return function(error) {
- var wrapped_error = new WrappedError(message, error);
- if (log) {
- console.error(message, " -- ", error);
- }
- return Promise.reject(wrapped_error);
- };
- };
- var typeset = function(element, text) {
- /**
- * Apply MathJax rendering to an element, and optionally set its text
- *
- * If MathJax is not available, make no changes.
- *
- * Returns the output any number of typeset elements, or undefined if
- * MathJax was not available.
- *
- * Parameters
- * ----------
- * element: Node, NodeList, or jQuery selection
- * text: option string
- */
- var $el = element.jquery ? element : $(element);
- if(arguments.length > 1){
- $el.text(text);
- }
- if(!window.MathJax){
- return;
- }
- $el.map(function(){
- // MathJax takes a DOM node: $.map makes `this` the context
- MathJax.Hub.Queue(["Typeset", MathJax.Hub, this]);
- try {
- MathJax.Hub.Queue(
- ["Require", MathJax.Ajax, "[MathJax]/extensions/TeX/AMSmath.js"],
- function() { MathJax.InputJax.TeX.resetEquationNumbers(); }
- );
- } catch (e) {
- console.error("Error queueing resetEquationNumbers:", e);
- }
- });
- };
- var parse_b64_data_uri = function(uri) {
- /**
- * Parses a base64 encoded data-uri to extract mimetype and the
- * base64 string.
- *
- * For example, given 'data:image/png;base64,iVBORw', it will return
- * ["image/png", "iVBORw"]
- *
- * Parameters
- */
- // For performance reasons, the non-greedy ? qualifiers are crucial so
- // that the matcher stops early on big blobs. Without them, it will try
- // to match the whole blob which can take ages
- var regex = /^data:(.+?\/.+?);base64,/;
- var matches = uri.match(regex);
- var mime = matches[1];
- // matches[0] contains the whole data-uri prefix
- var b64_data = uri.slice(matches[0].length);
- return [mime, b64_data];
- };
-
- var time = {};
- time.milliseconds = {};
- time.milliseconds.s = 1000;
- time.milliseconds.m = 60 * time.milliseconds.s;
- time.milliseconds.h = 60 * time.milliseconds.m;
- time.milliseconds.d = 24 * time.milliseconds.h;
-
- time.thresholds = {
- // moment.js thresholds in milliseconds
- s: moment.relativeTimeThreshold('s') * time.milliseconds.s,
- m: moment.relativeTimeThreshold('m') * time.milliseconds.m,
- h: moment.relativeTimeThreshold('h') * time.milliseconds.h,
- d: moment.relativeTimeThreshold('d') * time.milliseconds.d,
- };
-
- time.timeout_from_dt = function (dt) {
- /** compute a timeout based on dt
-
- input and output both in milliseconds
-
- use moment's relative time thresholds:
-
- - 10 seconds if in 'seconds ago' territory
- - 1 minute if in 'minutes ago'
- - 1 hour otherwise
- */
- if (dt < time.thresholds.s) {
- return 10 * time.milliseconds.s;
- } else if (dt < time.thresholds.m) {
- return time.milliseconds.m;
- } else {
- return time.milliseconds.h;
- }
- };
- var format_datetime = function(date) {
- var text = moment(date).fromNow();
- return text === 'a few seconds ago' ? 'seconds ago' : text;
- };
- var datetime_sort_helper = function(a, b, order) {
- if (moment(a).isBefore(moment(b))) {
- return (order == 1) ? -1 : 1;
- } else if (moment(a).isSame(moment(b))) {
- return 0;
- } else {
- return (order == 1) ? 1 : -1;
- }
- };
-
- /**
- source: https://github.com/sindresorhus/pretty-bytes
- The MIT License (MIT)
- Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
- Permission is hereby granted, free of charge, to any person obtaining a copy
- of this software and associated documentation files (the "Software"), to deal
- in the Software without restriction, including without limitation the rights
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- copies of the Software, and to permit persons to whom the Software is
- furnished to do so, subject to the following conditions:
- The above copyright notice and this permission notice shall be included in
- all copies or substantial portions of the Software.
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
- THE SOFTWARE.
- **/
- var format_filesize = function(num) {
- if (num === undefined || num === null)
- return;
- var UNITS = ['B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'];
- if (!Number.isFinite(num)) {
- console.error("Expected finite number, got ", typeof(num) + ": " + num);
- }
- var neg = num < 0;
- if (neg) {
- num = -num;
- }
- if (num < 1) {
- return (neg ? '-' : '') + num + ' B';
- }
- var exponent = Math.min(Math.floor(Math.log10(num) / 3), UNITS.length - 1);
- var numStr = Number((num / Math.pow(1000, exponent)).toPrecision(3));
- var unit = UNITS[exponent];
- return (neg ? '-' : '') + numStr + ' ' + unit;
- }
- // javascript stores text as utf16 and string indices use "code units",
- // which stores high-codepoint characters as "surrogate pairs",
- // which occupy two indices in the javascript string.
- // We need to translate cursor_pos in the protocol (in characters)
- // to js offset (with surrogate pairs taking two spots).
- function js_idx_to_char_idx (js_idx, text) {
- var char_idx = js_idx;
- for (var i = 0; i + 1 < text.length && i < js_idx; i++) {
- var char_code = text.charCodeAt(i);
- // check for surrogate pair
- if (char_code >= 0xD800 && char_code <= 0xDBFF) {
- var next_char_code = text.charCodeAt(i+1);
- if (next_char_code >= 0xDC00 && next_char_code <= 0xDFFF) {
- char_idx--;
- i++;
- }
- }
- }
- return char_idx;
- }
- function char_idx_to_js_idx (char_idx, text) {
- var js_idx = char_idx;
- for (var i = 0; i + 1 < text.length && i < js_idx; i++) {
- var char_code = text.charCodeAt(i);
- // check for surrogate pair
- if (char_code >= 0xD800 && char_code <= 0xDBFF) {
- var next_char_code = text.charCodeAt(i+1);
- if (next_char_code >= 0xDC00 && next_char_code <= 0xDFFF) {
- js_idx++;
- i++;
- }
- }
- }
- return js_idx;
- }
- if ('𝐚'.length === 1) {
- // If javascript fixes string indices of non-BMP characters,
- // don't keep shifting offsets to compensate for surrogate pairs
- char_idx_to_js_idx = js_idx_to_char_idx = function (idx, text) { return idx; };
- }
- // Test if a drag'n'drop event contains a file (as opposed to an HTML
- // element/text from the document)
- var dnd_contain_file = function(event) {
- // As per the HTML5 drag'n'drop spec, the dataTransfer.types should
- // contain one "Files" type if a file is being dragged
- // https://www.w3.org/TR/2011/WD-html5-20110113/dnd.html#dom-datatransfer-types
- if (event.dataTransfer.types) {
- for (var i = 0; i < event.dataTransfer.types.length; i++) {
- if (event.dataTransfer.types[i] == "Files") {
- return true;
- }
- }
- }
- return false;
- };
- var throttle = function(fn, time) {
- var pending = null;
- return function () {
- if (pending) return;
- pending = setTimeout(run, time);
- return function () {
- clearTimeout(pending);
- pending = null;
- }
- }
- function run () {
- pending = null;
- fn();
- }
- }
-
- var change_favicon = function (src) {
- var link = document.createElement('link'),
- oldLink = document.getElementById('favicon');
- link.id = 'favicon';
- link.type = 'image/x-icon';
- link.rel = 'shortcut icon';
- link.href = utils.url_path_join(utils.get_body_data('baseUrl'), src);
- if (oldLink && (link.href === oldLink.href)) {
- // This favicon is already set, don't modify the DOM.
- return;
- }
- if (oldLink) document.head.removeChild(oldLink);
- document.head.appendChild(link);
- };
- var utils = {
- throttle: throttle,
- is_loaded: is_loaded,
- load_extension: load_extension,
- load_extensions: load_extensions,
- filter_extensions: filter_extensions,
- load_extensions_from_config: load_extensions_from_config,
- regex_split : regex_split,
- uuid : uuid,
- fixConsole : fixConsole,
- fixCarriageReturn : fixCarriageReturn,
- fixBackspace : fixBackspace,
- fixOverwrittenChars: fixOverwrittenChars,
- autoLinkUrls : autoLinkUrls,
- points_to_pixels : points_to_pixels,
- get_body_data : get_body_data,
- parse_url : parse_url,
- url_path_split : url_path_split,
- url_path_join : url_path_join,
- url_join_encode : url_join_encode,
- encode_uri_components : encode_uri_components,
- splitext : splitext,
- escape_html : escape_html,
- always_new : always_new,
- to_absolute_cursor_pos : to_absolute_cursor_pos,
- from_absolute_cursor_pos : from_absolute_cursor_pos,
- browser : browser,
- platform: platform,
- get_url_param: get_url_param,
- is_or_has : is_or_has,
- is_focused : is_focused,
- mergeopt: mergeopt,
- requireCodeMirrorMode : requireCodeMirrorMode,
- XHR_ERROR : XHR_ERROR,
- ajax : ajax,
- ajax_error_msg : ajax_error_msg,
- log_ajax_error : log_ajax_error,
- wrap_ajax_error : wrap_ajax_error,
- promising_ajax : promising_ajax,
- WrappedError: WrappedError,
- load_class: load_class,
- resolve_promises_dict: resolve_promises_dict,
- reject: reject,
- typeset: typeset,
- parse_b64_data_uri: parse_b64_data_uri,
- time: time,
- format_datetime: format_datetime,
- format_filesize: format_filesize,
- datetime_sort_helper: datetime_sort_helper,
- dnd_contain_file: dnd_contain_file,
- js_idx_to_char_idx: js_idx_to_char_idx,
- char_idx_to_js_idx: char_idx_to_js_idx,
- _ansispan:_ansispan,
- change_favicon: change_favicon
- };
- return utils;
- });
- /**
- * @preserve jed.js https://github.com/SlexAxton/Jed
- */
- /*
- -----------
- A gettext compatible i18n library for modern JavaScript Applications
- by Alex Sexton - AlexSexton [at] gmail - @SlexAxton
- MIT License
- A jQuery Foundation project - requires CLA to contribute -
- https://contribute.jquery.org/CLA/
- Jed offers the entire applicable GNU gettext spec'd set of
- functions, but also offers some nicer wrappers around them.
- The api for gettext was written for a language with no function
- overloading, so Jed allows a little more of that.
- Many thanks to Joshua I. Miller - unrtst@cpan.org - who wrote
- gettext.js back in 2008. I was able to vet a lot of my ideas
- against his. I also made sure Jed passed against his tests
- in order to offer easy upgrades -- jsgettext.berlios.de
- */
- (function (root, undef) {
- // Set up some underscore-style functions, if you already have
- // underscore, feel free to delete this section, and use it
- // directly, however, the amount of functions used doesn't
- // warrant having underscore as a full dependency.
- // Underscore 1.3.0 was used to port and is licensed
- // under the MIT License by Jeremy Ashkenas.
- var ArrayProto = Array.prototype,
- ObjProto = Object.prototype,
- slice = ArrayProto.slice,
- hasOwnProp = ObjProto.hasOwnProperty,
- nativeForEach = ArrayProto.forEach,
- breaker = {};
- // We're not using the OOP style _ so we don't need the
- // extra level of indirection. This still means that you
- // sub out for real `_` though.
- var _ = {
- forEach : function( obj, iterator, context ) {
- var i, l, key;
- if ( obj === null ) {
- return;
- }
- if ( nativeForEach && obj.forEach === nativeForEach ) {
- obj.forEach( iterator, context );
- }
- else if ( obj.length === +obj.length ) {
- for ( i = 0, l = obj.length; i < l; i++ ) {
- if ( i in obj && iterator.call( context, obj[i], i, obj ) === breaker ) {
- return;
- }
- }
- }
- else {
- for ( key in obj) {
- if ( hasOwnProp.call( obj, key ) ) {
- if ( iterator.call (context, obj[key], key, obj ) === breaker ) {
- return;
- }
- }
- }
- }
- },
- extend : function( obj ) {
- this.forEach( slice.call( arguments, 1 ), function ( source ) {
- for ( var prop in source ) {
- obj[prop] = source[prop];
- }
- });
- return obj;
- }
- };
- // END Miniature underscore impl
- // Jed is a constructor function
- var Jed = function ( options ) {
- // Some minimal defaults
- this.defaults = {
- "locale_data" : {
- "messages" : {
- "" : {
- "domain" : "messages",
- "lang" : "en",
- "plural_forms" : "nplurals=2; plural=(n != 1);"
- }
- // There are no default keys, though
- }
- },
- // The default domain if one is missing
- "domain" : "messages",
- // enable debug mode to log untranslated strings to the console
- "debug" : false
- };
- // Mix in the sent options with the default options
- this.options = _.extend( {}, this.defaults, options );
- this.textdomain( this.options.domain );
- if ( options.domain && ! this.options.locale_data[ this.options.domain ] ) {
- throw new Error('Text domain set to non-existent domain: `' + options.domain + '`');
- }
- };
- // The gettext spec sets this character as the default
- // delimiter for context lookups.
- // e.g.: context\u0004key
- // If your translation company uses something different,
- // just change this at any time and it will use that instead.
- Jed.context_delimiter = String.fromCharCode( 4 );
- function getPluralFormFunc ( plural_form_string ) {
- return Jed.PF.compile( plural_form_string || "nplurals=2; plural=(n != 1);");
- }
- function Chain( key, i18n ){
- this._key = key;
- this._i18n = i18n;
- }
- // Create a chainable api for adding args prettily
- _.extend( Chain.prototype, {
- onDomain : function ( domain ) {
- this._domain = domain;
- return this;
- },
- withContext : function ( context ) {
- this._context = context;
- return this;
- },
- ifPlural : function ( num, pkey ) {
- this._val = num;
- this._pkey = pkey;
- return this;
- },
- fetch : function ( sArr ) {
- if ( {}.toString.call( sArr ) != '[object Array]' ) {
- sArr = [].slice.call(arguments, 0);
- }
- return ( sArr && sArr.length ? Jed.sprintf : function(x){ return x; } )(
- this._i18n.dcnpgettext(this._domain, this._context, this._key, this._pkey, this._val),
- sArr
- );
- }
- });
- // Add functions to the Jed prototype.
- // These will be the functions on the object that's returned
- // from creating a `new Jed()`
- // These seem redundant, but they gzip pretty well.
- _.extend( Jed.prototype, {
- // The sexier api start point
- translate : function ( key ) {
- return new Chain( key, this );
- },
- textdomain : function ( domain ) {
- if ( ! domain ) {
- return this._textdomain;
- }
- this._textdomain = domain;
- },
- gettext : function ( key ) {
- return this.dcnpgettext.call( this, undef, undef, key );
- },
- dgettext : function ( domain, key ) {
- return this.dcnpgettext.call( this, domain, undef, key );
- },
- dcgettext : function ( domain , key /*, category */ ) {
- // Ignores the category anyways
- return this.dcnpgettext.call( this, domain, undef, key );
- },
- ngettext : function ( skey, pkey, val ) {
- return this.dcnpgettext.call( this, undef, undef, skey, pkey, val );
- },
- dngettext : function ( domain, skey, pkey, val ) {
- return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );
- },
- dcngettext : function ( domain, skey, pkey, val/*, category */) {
- return this.dcnpgettext.call( this, domain, undef, skey, pkey, val );
- },
- pgettext : function ( context, key ) {
- return this.dcnpgettext.call( this, undef, context, key );
- },
- dpgettext : function ( domain, context, key ) {
- return this.dcnpgettext.call( this, domain, context, key );
- },
- dcpgettext : function ( domain, context, key/*, category */) {
- return this.dcnpgettext.call( this, domain, context, key );
- },
- npgettext : function ( context, skey, pkey, val ) {
- return this.dcnpgettext.call( this, undef, context, skey, pkey, val );
- },
- dnpgettext : function ( domain, context, skey, pkey, val ) {
- return this.dcnpgettext.call( this, domain, context, skey, pkey, val );
- },
- // The most fully qualified gettext function. It has every option.
- // Since it has every option, we can use it from every other method.
- // This is the bread and butter.
- // Technically there should be one more argument in this function for 'Category',
- // but since we never use it, we might as well not waste the bytes to define it.
- dcnpgettext : function ( domain, context, singular_key, plural_key, val ) {
- // Set some defaults
- plural_key = plural_key || singular_key;
- // Use the global domain default if one
- // isn't explicitly passed in
- domain = domain || this._textdomain;
- var fallback;
- // Handle special cases
- // No options found
- if ( ! this.options ) {
- // There's likely something wrong, but we'll return the correct key for english
- // We do this by instantiating a brand new Jed instance with the default set
- // for everything that could be broken.
- fallback = new Jed();
- return fallback.dcnpgettext.call( fallback, undefined, undefined, singular_key, plural_key, val );
- }
- // No translation data provided
- if ( ! this.options.locale_data ) {
- throw new Error('No locale data provided.');
- }
- if ( ! this.options.locale_data[ domain ] ) {
- throw new Error('Domain `' + domain + '` was not found.');
- }
- if ( ! this.options.locale_data[ domain ][ "" ] ) {
- throw new Error('No locale meta information provided.');
- }
- // Make sure we have a truthy key. Otherwise we might start looking
- // into the empty string key, which is the options for the locale
- // data.
- if ( ! singular_key ) {
- throw new Error('No translation key found.');
- }
- var key = context ? context + Jed.context_delimiter + singular_key : singular_key,
- locale_data = this.options.locale_data,
- dict = locale_data[ domain ],
- defaultConf = (locale_data.messages || this.defaults.locale_data.messages)[""],
- pluralForms = dict[""].plural_forms || dict[""]["Plural-Forms"] || dict[""]["plural-forms"] || defaultConf.plural_forms || defaultConf["Plural-Forms"] || defaultConf["plural-forms"],
- val_list,
- res;
- var val_idx;
- if (val === undefined) {
- // No value passed in; assume singular key lookup.
- val_idx = 0;
- } else {
- // Value has been passed in; use plural-forms calculations.
- // Handle invalid numbers, but try casting strings for good measure
- if ( typeof val != 'number' ) {
- val = parseInt( val, 10 );
- if ( isNaN( val ) ) {
- throw new Error('The number that was passed in is not a number.');
- }
- }
- val_idx = getPluralFormFunc(pluralForms)(val);
- }
- // Throw an error if a domain isn't found
- if ( ! dict ) {
- throw new Error('No domain named `' + domain + '` could be found.');
- }
- val_list = dict[ key ];
- // If there is no match, then revert back to
- // english style singular/plural with the keys passed in.
- if ( ! val_list || val_idx > val_list.length ) {
- if (this.options.missing_key_callback) {
- this.options.missing_key_callback(key, domain);
- }
- res = [ singular_key, plural_key ];
- // collect untranslated strings
- if (this.options.debug===true) {
- console.log(res[ getPluralFormFunc(pluralForms)( val ) ]);
- }
- return res[ getPluralFormFunc()( val ) ];
- }
- res = val_list[ val_idx ];
- // This includes empty strings on purpose
- if ( ! res ) {
- res = [ singular_key, plural_key ];
- return res[ getPluralFormFunc()( val ) ];
- }
- return res;
- }
- });
- // We add in sprintf capabilities for post translation value interolation
- // This is not internally used, so you can remove it if you have this
- // available somewhere else, or want to use a different system.
- // We _slightly_ modify the normal sprintf behavior to more gracefully handle
- // undefined values.
- /**
- sprintf() for JavaScript 0.7-beta1
- http://www.diveintojavascript.com/projects/javascript-sprintf
- Copyright (c) Alexandru Marasteanu <alexaholic [at) gmail (dot] com>
- All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
- * Redistributions of source code must retain the above copyright
- notice, this list of conditions and the following disclaimer.
- * Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
- * Neither the name of sprintf() for JavaScript nor the
- names of its contributors may be used to endorse or promote products
- derived from this software without specific prior written permission.
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- DISCLAIMED. IN NO EVENT SHALL Alexandru Marasteanu BE LIABLE FOR ANY
- DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
- var sprintf = (function() {
- function get_type(variable) {
- return Object.prototype.toString.call(variable).slice(8, -1).toLowerCase();
- }
- function str_repeat(input, multiplier) {
- for (var output = []; multiplier > 0; output[--multiplier] = input) {/* do nothing */}
- return output.join('');
- }
- var str_format = function() {
- if (!str_format.cache.hasOwnProperty(arguments[0])) {
- str_format.cache[arguments[0]] = str_format.parse(arguments[0]);
- }
- return str_format.format.call(null, str_format.cache[arguments[0]], arguments);
- };
- str_format.format = function(parse_tree, argv) {
- var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
- for (i = 0; i < tree_length; i++) {
- node_type = get_type(parse_tree[i]);
- if (node_type === 'string') {
- output.push(parse_tree[i]);
- }
- else if (node_type === 'array') {
- match = parse_tree[i]; // convenience purposes only
- if (match[2]) { // keyword argument
- arg = argv[cursor];
- for (k = 0; k < match[2].length; k++) {
- if (!arg.hasOwnProperty(match[2][k])) {
- throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
- }
- arg = arg[match[2][k]];
- }
- }
- else if (match[1]) { // positional argument (explicit)
- arg = argv[match[1]];
- }
- else { // positional argument (implicit)
- arg = argv[cursor++];
- }
- if (/[^s]/.test(match[8]) && (get_type(arg) != 'number')) {
- throw(sprintf('[sprintf] expecting number but found %s', get_type(arg)));
- }
- // Jed EDIT
- if ( typeof arg == 'undefined' || arg === null ) {
- arg = '';
- }
- // Jed EDIT
- switch (match[8]) {
- case 'b': arg = arg.toString(2); break;
- case 'c': arg = String.fromCharCode(arg); break;
- case 'd': arg = parseInt(arg, 10); break;
- case 'e': arg = match[7] ? arg.toExponential(match[7]) : arg.toExponential(); break;
- case 'f': arg = match[7] ? parseFloat(arg).toFixed(match[7]) : parseFloat(arg); break;
- case 'o': arg = arg.toString(8); break;
- case 's': arg = ((arg = String(arg)) && match[7] ? arg.substring(0, match[7]) : arg); break;
- case 'u': arg = Math.abs(arg); break;
- case 'x': arg = arg.toString(16); break;
- case 'X': arg = arg.toString(16).toUpperCase(); break;
- }
- arg = (/[def]/.test(match[8]) && match[3] && arg >= 0 ? '+'+ arg : arg);
- pad_character = match[4] ? match[4] == '0' ? '0' : match[4].charAt(1) : ' ';
- pad_length = match[6] - String(arg).length;
- pad = match[6] ? str_repeat(pad_character, pad_length) : '';
- output.push(match[5] ? arg + pad : pad + arg);
- }
- }
- return output.join('');
- };
- str_format.cache = {};
- str_format.parse = function(fmt) {
- var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
- while (_fmt) {
- if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
- parse_tree.push(match[0]);
- }
- else if ((match = /^\x25{2}/.exec(_fmt)) !== null) {
- parse_tree.push('%');
- }
- else if ((match = /^\x25(?:([1-9]\d*)\$|\(([^\)]+)\))?(\+)?(0|'[^$])?(-)?(\d+)?(?:\.(\d+))?([b-fosuxX])/.exec(_fmt)) !== null) {
- if (match[2]) {
- arg_names |= 1;
- var field_list = [], replacement_field = match[2], field_match = [];
- if ((field_match = /^([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
- field_list.push(field_match[1]);
- while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
- if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
- field_list.push(field_match[1]);
- }
- else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
- field_list.push(field_match[1]);
- }
- else {
- throw('[sprintf] huh?');
- }
- }
- }
- else {
- throw('[sprintf] huh?');
- }
- match[2] = field_list;
- }
- else {
- arg_names |= 2;
- }
- if (arg_names === 3) {
- throw('[sprintf] mixing positional and named placeholders is not (yet) supported');
- }
- parse_tree.push(match);
- }
- else {
- throw('[sprintf] huh?');
- }
- _fmt = _fmt.substring(match[0].length);
- }
- return parse_tree;
- };
- return str_format;
- })();
- var vsprintf = function(fmt, argv) {
- argv.unshift(fmt);
- return sprintf.apply(null, argv);
- };
- Jed.parse_plural = function ( plural_forms, n ) {
- plural_forms = plural_forms.replace(/n/g, n);
- return Jed.parse_expression(plural_forms);
- };
- Jed.sprintf = function ( fmt, args ) {
- if ( {}.toString.call( args ) == '[object Array]' ) {
- return vsprintf( fmt, [].slice.call(args) );
- }
- return sprintf.apply(this, [].slice.call(arguments) );
- };
- Jed.prototype.sprintf = function () {
- return Jed.sprintf.apply(this, arguments);
- };
- // END sprintf Implementation
- // Start the Plural forms section
- // This is a full plural form expression parser. It is used to avoid
- // running 'eval' or 'new Function' directly against the plural
- // forms.
- //
- // This can be important if you get translations done through a 3rd
- // party vendor. I encourage you to use this instead, however, I
- // also will provide a 'precompiler' that you can use at build time
- // to output valid/safe function representations of the plural form
- // expressions. This means you can build this code out for the most
- // part.
- Jed.PF = {};
- Jed.PF.parse = function ( p ) {
- var plural_str = Jed.PF.extractPluralExpr( p );
- return Jed.PF.parser.parse.call(Jed.PF.parser, plural_str);
- };
- Jed.PF.compile = function ( p ) {
- // Handle trues and falses as 0 and 1
- function imply( val ) {
- return (val === true ? 1 : val ? val : 0);
- }
- var ast = Jed.PF.parse( p );
- return function ( n ) {
- return imply( Jed.PF.interpreter( ast )( n ) );
- };
- };
- Jed.PF.interpreter = function ( ast ) {
- return function ( n ) {
- var res;
- switch ( ast.type ) {
- case 'GROUP':
- return Jed.PF.interpreter( ast.expr )( n );
- case 'TERNARY':
- if ( Jed.PF.interpreter( ast.expr )( n ) ) {
- return Jed.PF.interpreter( ast.truthy )( n );
- }
- return Jed.PF.interpreter( ast.falsey )( n );
- case 'OR':
- return Jed.PF.interpreter( ast.left )( n ) || Jed.PF.interpreter( ast.right )( n );
- case 'AND':
- return Jed.PF.interpreter( ast.left )( n ) && Jed.PF.interpreter( ast.right )( n );
- case 'LT':
- return Jed.PF.interpreter( ast.left )( n ) < Jed.PF.interpreter( ast.right )( n );
- case 'GT':
- return Jed.PF.interpreter( ast.left )( n ) > Jed.PF.interpreter( ast.right )( n );
- case 'LTE':
- return Jed.PF.interpreter( ast.left )( n ) <= Jed.PF.interpreter( ast.right )( n );
- case 'GTE':
- return Jed.PF.interpreter( ast.left )( n ) >= Jed.PF.interpreter( ast.right )( n );
- case 'EQ':
- return Jed.PF.interpreter( ast.left )( n ) == Jed.PF.interpreter( ast.right )( n );
- case 'NEQ':
- return Jed.PF.interpreter( ast.left )( n ) != Jed.PF.interpreter( ast.right )( n );
- case 'MOD':
- return Jed.PF.interpreter( ast.left )( n ) % Jed.PF.interpreter( ast.right )( n );
- case 'VAR':
- return n;
- case 'NUM':
- return ast.val;
- default:
- throw new Error("Invalid Token found.");
- }
- };
- };
- Jed.PF.extractPluralExpr = function ( p ) {
- // trim first
- p = p.replace(/^\s\s*/, '').replace(/\s\s*$/, '');
- if (! /;\s*$/.test(p)) {
- p = p.concat(';');
- }
- var nplurals_re = /nplurals\=(\d+);/,
- plural_re = /plural\=(.*);/,
- nplurals_matches = p.match( nplurals_re ),
- res = {},
- plural_matches;
- // Find the nplurals number
- if ( nplurals_matches.length > 1 ) {
- res.nplurals = nplurals_matches[1];
- }
- else {
- throw new Error('nplurals not found in plural_forms string: ' + p );
- }
- // remove that data to get to the formula
- p = p.replace( nplurals_re, "" );
- plural_matches = p.match( plural_re );
- if (!( plural_matches && plural_matches.length > 1 ) ) {
- throw new Error('`plural` expression not found: ' + p);
- }
- return plural_matches[ 1 ];
- };
- /* Jison generated parser */
- Jed.PF.parser = (function(){
- var parser = {trace: function trace() { },
- yy: {},
- symbols_: {"error":2,"expressions":3,"e":4,"EOF":5,"?":6,":":7,"||":8,"&&":9,"<":10,"<=":11,">":12,">=":13,"!=":14,"==":15,"%":16,"(":17,")":18,"n":19,"NUMBER":20,"$accept":0,"$end":1},
- terminals_: {2:"error",5:"EOF",6:"?",7:":",8:"||",9:"&&",10:"<",11:"<=",12:">",13:">=",14:"!=",15:"==",16:"%",17:"(",18:")",19:"n",20:"NUMBER"},
- productions_: [0,[3,2],[4,5],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,1],[4,1]],
- performAction: function anonymous(yytext,yyleng,yylineno,yy,yystate,$$,_$) {
- var $0 = $$.length - 1;
- switch (yystate) {
- case 1: return { type : 'GROUP', expr: $$[$0-1] };
- break;
- case 2:this.$ = { type: 'TERNARY', expr: $$[$0-4], truthy : $$[$0-2], falsey: $$[$0] };
- break;
- case 3:this.$ = { type: "OR", left: $$[$0-2], right: $$[$0] };
- break;
- case 4:this.$ = { type: "AND", left: $$[$0-2], right: $$[$0] };
- break;
- case 5:this.$ = { type: 'LT', left: $$[$0-2], right: $$[$0] };
- break;
- case 6:this.$ = { type: 'LTE', left: $$[$0-2], right: $$[$0] };
- break;
- case 7:this.$ = { type: 'GT', left: $$[$0-2], right: $$[$0] };
- break;
- case 8:this.$ = { type: 'GTE', left: $$[$0-2], right: $$[$0] };
- break;
- case 9:this.$ = { type: 'NEQ', left: $$[$0-2], right: $$[$0] };
- break;
- case 10:this.$ = { type: 'EQ', left: $$[$0-2], right: $$[$0] };
- break;
- case 11:this.$ = { type: 'MOD', left: $$[$0-2], right: $$[$0] };
- break;
- case 12:this.$ = { type: 'GROUP', expr: $$[$0-1] };
- break;
- case 13:this.$ = { type: 'VAR' };
- break;
- case 14:this.$ = { type: 'NUM', val: Number(yytext) };
- break;
- }
- },
- table: [{3:1,4:2,17:[1,3],19:[1,4],20:[1,5]},{1:[3]},{5:[1,6],6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{4:17,17:[1,3],19:[1,4],20:[1,5]},{5:[2,13],6:[2,13],7:[2,13],8:[2,13],9:[2,13],10:[2,13],11:[2,13],12:[2,13],13:[2,13],14:[2,13],15:[2,13],16:[2,13],18:[2,13]},{5:[2,14],6:[2,14],7:[2,14],8:[2,14],9:[2,14],10:[2,14],11:[2,14],12:[2,14],13:[2,14],14:[2,14],15:[2,14],16:[2,14],18:[2,14]},{1:[2,1]},{4:18,17:[1,3],19:[1,4],20:[1,5]},{4:19,17:[1,3],19:[1,4],20:[1,5]},{4:20,17:[1,3],19:[1,4],20:[1,5]},{4:21,17:[1,3],19:[1,4],20:[1,5]},{4:22,17:[1,3],19:[1,4],20:[1,5]},{4:23,17:[1,3],19:[1,4],20:[1,5]},{4:24,17:[1,3],19:[1,4],20:[1,5]},{4:25,17:[1,3],19:[1,4],20:[1,5]},{4:26,17:[1,3],19:[1,4],20:[1,5]},{4:27,17:[1,3],19:[1,4],20:[1,5]},{6:[1,7],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[1,28]},{6:[1,7],7:[1,29],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16]},{5:[2,3],6:[2,3],7:[2,3],8:[2,3],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,3]},{5:[2,4],6:[2,4],7:[2,4],8:[2,4],9:[2,4],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,4]},{5:[2,5],6:[2,5],7:[2,5],8:[2,5],9:[2,5],10:[2,5],11:[2,5],12:[2,5],13:[2,5],14:[2,5],15:[2,5],16:[1,16],18:[2,5]},{5:[2,6],6:[2,6],7:[2,6],8:[2,6],9:[2,6],10:[2,6],11:[2,6],12:[2,6],13:[2,6],14:[2,6],15:[2,6],16:[1,16],18:[2,6]},{5:[2,7],6:[2,7],7:[2,7],8:[2,7],9:[2,7],10:[2,7],11:[2,7],12:[2,7],13:[2,7],14:[2,7],15:[2,7],16:[1,16],18:[2,7]},{5:[2,8],6:[2,8],7:[2,8],8:[2,8],9:[2,8],10:[2,8],11:[2,8],12:[2,8],13:[2,8],14:[2,8],15:[2,8],16:[1,16],18:[2,8]},{5:[2,9],6:[2,9],7:[2,9],8:[2,9],9:[2,9],10:[2,9],11:[2,9],12:[2,9],13:[2,9],14:[2,9],15:[2,9],16:[1,16],18:[2,9]},{5:[2,10],6:[2,10],7:[2,10],8:[2,10],9:[2,10],10:[2,10],11:[2,10],12:[2,10],13:[2,10],14:[2,10],15:[2,10],16:[1,16],18:[2,10]},{5:[2,11],6:[2,11],7:[2,11],8:[2,11],9:[2,11],10:[2,11],11:[2,11],12:[2,11],13:[2,11],14:[2,11],15:[2,11],16:[2,11],18:[2,11]},{5:[2,12],6:[2,12],7:[2,12],8:[2,12],9:[2,12],10:[2,12],11:[2,12],12:[2,12],13:[2,12],14:[2,12],15:[2,12],16:[2,12],18:[2,12]},{4:30,17:[1,3],19:[1,4],20:[1,5]},{5:[2,2],6:[1,7],7:[2,2],8:[1,8],9:[1,9],10:[1,10],11:[1,11],12:[1,12],13:[1,13],14:[1,14],15:[1,15],16:[1,16],18:[2,2]}],
- defaultActions: {6:[2,1]},
- parseError: function parseError(str, hash) {
- throw new Error(str);
- },
- parse: function parse(input) {
- var self = this,
- stack = [0],
- vstack = [null], // semantic value stack
- lstack = [], // location stack
- table = this.table,
- yytext = '',
- yylineno = 0,
- yyleng = 0,
- recovering = 0,
- TERROR = 2,
- EOF = 1;
- //this.reductionCount = this.shiftCount = 0;
- this.lexer.setInput(input);
- this.lexer.yy = this.yy;
- this.yy.lexer = this.lexer;
- if (typeof this.lexer.yylloc == 'undefined')
- this.lexer.yylloc = {};
- var yyloc = this.lexer.yylloc;
- lstack.push(yyloc);
- if (typeof this.yy.parseError === 'function')
- this.parseError = this.yy.parseError;
- function popStack (n) {
- stack.length = stack.length - 2*n;
- vstack.length = vstack.length - n;
- lstack.length = lstack.length - n;
- }
- function lex() {
- var token;
- token = self.lexer.lex() || 1; // $end = 1
- // if token isn't its numeric value, convert
- if (typeof token !== 'number') {
- token = self.symbols_[token] || token;
- }
- return token;
- }
- var symbol, preErrorSymbol, state, action, a, r, yyval={},p,len,newState, expected;
- while (true) {
- // retreive state number from top of stack
- state = stack[stack.length-1];
- // use default actions if available
- if (this.defaultActions[state]) {
- action = this.defaultActions[state];
- } else {
- if (symbol == null)
- symbol = lex();
- // read action for current state and first input
- action = table[state] && table[state][symbol];
- }
- // handle parse error
- _handle_error:
- if (typeof action === 'undefined' || !action.length || !action[0]) {
- if (!recovering) {
- // Report error
- expected = [];
- for (p in table[state]) if (this.terminals_[p] && p > 2) {
- expected.push("'"+this.terminals_[p]+"'");
- }
- var errStr = '';
- if (this.lexer.showPosition) {
- errStr = 'Parse error on line '+(yylineno+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+expected.join(', ') + ", got '" + this.terminals_[symbol]+ "'";
- } else {
- errStr = 'Parse error on line '+(yylineno+1)+": Unexpected " +
- (symbol == 1 /*EOF*/ ? "end of input" :
- ("'"+(this.terminals_[symbol] || symbol)+"'"));
- }
- this.parseError(errStr,
- {text: this.lexer.match, token: this.terminals_[symbol] || symbol, line: this.lexer.yylineno, loc: yyloc, expected: expected});
- }
- // just recovered from another error
- if (recovering == 3) {
- if (symbol == EOF) {
- throw new Error(errStr || 'Parsing halted.');
- }
- // discard current lookahead and grab another
- yyleng = this.lexer.yyleng;
- yytext = this.lexer.yytext;
- yylineno = this.lexer.yylineno;
- yyloc = this.lexer.yylloc;
- symbol = lex();
- }
- // try to recover from error
- while (1) {
- // check for error recovery rule in this state
- if ((TERROR.toString()) in table[state]) {
- break;
- }
- if (state == 0) {
- throw new Error(errStr || 'Parsing halted.');
- }
- popStack(1);
- state = stack[stack.length-1];
- }
- preErrorSymbol = symbol; // save the lookahead token
- symbol = TERROR; // insert generic error symbol as new lookahead
- state = stack[stack.length-1];
- action = table[state] && table[state][TERROR];
- recovering = 3; // allow 3 real symbols to be shifted before reporting a new error
- }
- // this shouldn't happen, unless resolve defaults are off
- if (action[0] instanceof Array && action.length > 1) {
- throw new Error('Parse Error: multiple actions possible at state: '+state+', token: '+symbol);
- }
- switch (action[0]) {
- case 1: // shift
- //this.shiftCount++;
- stack.push(symbol);
- vstack.push(this.lexer.yytext);
- lstack.push(this.lexer.yylloc);
- stack.push(action[1]); // push state
- symbol = null;
- if (!preErrorSymbol) { // normal execution/no error
- yyleng = this.lexer.yyleng;
- yytext = this.lexer.yytext;
- yylineno = this.lexer.yylineno;
- yyloc = this.lexer.yylloc;
- if (recovering > 0)
- recovering--;
- } else { // error just occurred, resume old lookahead f/ before error
- symbol = preErrorSymbol;
- preErrorSymbol = null;
- }
- break;
- case 2: // reduce
- //this.reductionCount++;
- len = this.productions_[action[1]][1];
- // perform semantic action
- yyval.$ = vstack[vstack.length-len]; // default to $$ = $1
- // default location, uses first token for firsts, last for lasts
- yyval._$ = {
- first_line: lstack[lstack.length-(len||1)].first_line,
- last_line: lstack[lstack.length-1].last_line,
- first_column: lstack[lstack.length-(len||1)].first_column,
- last_column: lstack[lstack.length-1].last_column
- };
- r = this.performAction.call(yyval, yytext, yyleng, yylineno, this.yy, action[1], vstack, lstack);
- if (typeof r !== 'undefined') {
- return r;
- }
- // pop off stack
- if (len) {
- stack = stack.slice(0,-1*len*2);
- vstack = vstack.slice(0, -1*len);
- lstack = lstack.slice(0, -1*len);
- }
- stack.push(this.productions_[action[1]][0]); // push nonterminal (reduce)
- vstack.push(yyval.$);
- lstack.push(yyval._$);
- // goto new state = table[STATE][NONTERMINAL]
- newState = table[stack[stack.length-2]][stack[stack.length-1]];
- stack.push(newState);
- break;
- case 3: // accept
- return true;
- }
- }
- return true;
- }};/* Jison generated lexer */
- var lexer = (function(){
- var lexer = ({EOF:1,
- parseError:function parseError(str, hash) {
- if (this.yy.parseError) {
- this.yy.parseError(str, hash);
- } else {
- throw new Error(str);
- }
- },
- setInput:function (input) {
- this._input = input;
- this._more = this._less = this.done = false;
- this.yylineno = this.yyleng = 0;
- this.yytext = this.matched = this.match = '';
- this.conditionStack = ['INITIAL'];
- this.yylloc = {first_line:1,first_column:0,last_line:1,last_column:0};
- return this;
- },
- input:function () {
- var ch = this._input[0];
- this.yytext+=ch;
- this.yyleng++;
- this.match+=ch;
- this.matched+=ch;
- var lines = ch.match(/\n/);
- if (lines) this.yylineno++;
- this._input = this._input.slice(1);
- return ch;
- },
- unput:function (ch) {
- this._input = ch + this._input;
- return this;
- },
- more:function () {
- this._more = true;
- return this;
- },
- pastInput:function () {
- var past = this.matched.substr(0, this.matched.length - this.match.length);
- return (past.length > 20 ? '...':'') + past.substr(-20).replace(/\n/g, "");
- },
- upcomingInput:function () {
- var next = this.match;
- if (next.length < 20) {
- next += this._input.substr(0, 20-next.length);
- }
- return (next.substr(0,20)+(next.length > 20 ? '...':'')).replace(/\n/g, "");
- },
- showPosition:function () {
- var pre = this.pastInput();
- var c = new Array(pre.length + 1).join("-");
- return pre + this.upcomingInput() + "\n" + c+"^";
- },
- next:function () {
- if (this.done) {
- return this.EOF;
- }
- if (!this._input) this.done = true;
- var token,
- match,
- col,
- lines;
- if (!this._more) {
- this.yytext = '';
- this.match = '';
- }
- var rules = this._currentRules();
- for (var i=0;i < rules.length; i++) {
- match = this._input.match(this.rules[rules[i]]);
- if (match) {
- lines = match[0].match(/\n.*/g);
- if (lines) this.yylineno += lines.length;
- this.yylloc = {first_line: this.yylloc.last_line,
- last_line: this.yylineno+1,
- first_column: this.yylloc.last_column,
- last_column: lines ? lines[lines.length-1].length-1 : this.yylloc.last_column + match[0].length}
- this.yytext += match[0];
- this.match += match[0];
- this.matches = match;
- this.yyleng = this.yytext.length;
- this._more = false;
- this._input = this._input.slice(match[0].length);
- this.matched += match[0];
- token = this.performAction.call(this, this.yy, this, rules[i],this.conditionStack[this.conditionStack.length-1]);
- if (token) return token;
- else return;
- }
- }
- if (this._input === "") {
- return this.EOF;
- } else {
- this.parseError('Lexical error on line '+(this.yylineno+1)+'. Unrecognized text.\n'+this.showPosition(),
- {text: "", token: null, line: this.yylineno});
- }
- },
- lex:function lex() {
- var r = this.next();
- if (typeof r !== 'undefined') {
- return r;
- } else {
- return this.lex();
- }
- },
- begin:function begin(condition) {
- this.conditionStack.push(condition);
- },
- popState:function popState() {
- return this.conditionStack.pop();
- },
- _currentRules:function _currentRules() {
- return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules;
- },
- topState:function () {
- return this.conditionStack[this.conditionStack.length-2];
- },
- pushState:function begin(condition) {
- this.begin(condition);
- }});
- lexer.performAction = function anonymous(yy,yy_,$avoiding_name_collisions,YY_START) {
- var YYSTATE=YY_START;
- switch($avoiding_name_collisions) {
- case 0:/* skip whitespace */
- break;
- case 1:return 20
- break;
- case 2:return 19
- break;
- case 3:return 8
- break;
- case 4:return 9
- break;
- case 5:return 6
- break;
- case 6:return 7
- break;
- case 7:return 11
- break;
- case 8:return 13
- break;
- case 9:return 10
- break;
- case 10:return 12
- break;
- case 11:return 14
- break;
- case 12:return 15
- break;
- case 13:return 16
- break;
- case 14:return 17
- break;
- case 15:return 18
- break;
- case 16:return 5
- break;
- case 17:return 'INVALID'
- break;
- }
- };
- lexer.rules = [/^\s+/,/^[0-9]+(\.[0-9]+)?\b/,/^n\b/,/^\|\|/,/^&&/,/^\?/,/^:/,/^<=/,/^>=/,/^</,/^>/,/^!=/,/^==/,/^%/,/^\(/,/^\)/,/^$/,/^./];
- lexer.conditions = {"INITIAL":{"rules":[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17],"inclusive":true}};return lexer;})()
- parser.lexer = lexer;
- return parser;
- })();
- // End parser
- // Handle node, amd, and global systems
- if (typeof exports !== 'undefined') {
- if (typeof module !== 'undefined' && module.exports) {
- exports = module.exports = Jed;
- }
- exports.Jed = Jed;
- }
- else {
- if (typeof define === 'function' && define.amd) {
- define('jed',[],function() {
- return Jed;
- });
- }
- // Leak a global regardless of module system
- root['Jed'] = Jed;
- }
- })(this);
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // Module to handle i18n ( Internationalization ) and translated UI
- define('base/js/i18n',[
- 'jed'
- ], function(Jed) {
- "use strict";
- var i18n = new Jed(document.nbjs_translations);
- i18n._ = i18n.gettext;
- i18n.msg = i18n; // Just a place holder until the init promise resolves.
- return i18n;
- });
- /*!
- * Bootstrap v3.4.1 (https://getbootstrap.com/)
- * Copyright 2011-2019 Twitter, Inc.
- * Licensed under the MIT license
- */
- if("undefined"==typeof jQuery)throw new Error("Bootstrap's JavaScript requires jQuery");!function(t){"use strict";var e=jQuery.fn.jquery.split(" ")[0].split(".");if(e[0]<2&&e[1]<9||1==e[0]&&9==e[1]&&e[2]<1||3<e[0])throw new Error("Bootstrap's JavaScript requires jQuery version 1.9.1 or higher, but lower than version 4")}(),function(n){"use strict";n.fn.emulateTransitionEnd=function(t){var e=!1,i=this;n(this).one("bsTransitionEnd",function(){e=!0});return setTimeout(function(){e||n(i).trigger(n.support.transition.end)},t),this},n(function(){n.support.transition=function o(){var t=document.createElement("bootstrap"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"};for(var i in e)if(t.style[i]!==undefined)return{end:e[i]};return!1}(),n.support.transition&&(n.event.special.bsTransitionEnd={bindType:n.support.transition.end,delegateType:n.support.transition.end,handle:function(t){if(n(t.target).is(this))return t.handleObj.handler.apply(this,arguments)}})})}(jQuery),function(s){"use strict";var e='[data-dismiss="alert"]',a=function(t){s(t).on("click",e,this.close)};a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.close=function(t){var e=s(this),i=e.attr("data-target");i||(i=(i=e.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),i="#"===i?[]:i;var o=s(document).find(i);function n(){o.detach().trigger("closed.bs.alert").remove()}t&&t.preventDefault(),o.length||(o=e.closest(".alert")),o.trigger(t=s.Event("close.bs.alert")),t.isDefaultPrevented()||(o.removeClass("in"),s.support.transition&&o.hasClass("fade")?o.one("bsTransitionEnd",n).emulateTransitionEnd(a.TRANSITION_DURATION):n())};var t=s.fn.alert;s.fn.alert=function o(i){return this.each(function(){var t=s(this),e=t.data("bs.alert");e||t.data("bs.alert",e=new a(this)),"string"==typeof i&&e[i].call(t)})},s.fn.alert.Constructor=a,s.fn.alert.noConflict=function(){return s.fn.alert=t,this},s(document).on("click.bs.alert.data-api",e,a.prototype.close)}(jQuery),function(s){"use strict";var n=function(t,e){this.$element=s(t),this.options=s.extend({},n.DEFAULTS,e),this.isLoading=!1};function i(o){return this.each(function(){var t=s(this),e=t.data("bs.button"),i="object"==typeof o&&o;e||t.data("bs.button",e=new n(this,i)),"toggle"==o?e.toggle():o&&e.setState(o)})}n.VERSION="3.4.1",n.DEFAULTS={loadingText:"loading..."},n.prototype.setState=function(t){var e="disabled",i=this.$element,o=i.is("input")?"val":"html",n=i.data();t+="Text",null==n.resetText&&i.data("resetText",i[o]()),setTimeout(s.proxy(function(){i[o](null==n[t]?this.options[t]:n[t]),"loadingText"==t?(this.isLoading=!0,i.addClass(e).attr(e,e).prop(e,!0)):this.isLoading&&(this.isLoading=!1,i.removeClass(e).removeAttr(e).prop(e,!1))},this),0)},n.prototype.toggle=function(){var t=!0,e=this.$element.closest('[data-toggle="buttons"]');if(e.length){var i=this.$element.find("input");"radio"==i.prop("type")?(i.prop("checked")&&(t=!1),e.find(".active").removeClass("active"),this.$element.addClass("active")):"checkbox"==i.prop("type")&&(i.prop("checked")!==this.$element.hasClass("active")&&(t=!1),this.$element.toggleClass("active")),i.prop("checked",this.$element.hasClass("active")),t&&i.trigger("change")}else this.$element.attr("aria-pressed",!this.$element.hasClass("active")),this.$element.toggleClass("active")};var t=s.fn.button;s.fn.button=i,s.fn.button.Constructor=n,s.fn.button.noConflict=function(){return s.fn.button=t,this},s(document).on("click.bs.button.data-api",'[data-toggle^="button"]',function(t){var e=s(t.target).closest(".btn");i.call(e,"toggle"),s(t.target).is('input[type="radio"], input[type="checkbox"]')||(t.preventDefault(),e.is("input,button")?e.trigger("focus"):e.find("input:visible,button:visible").first().trigger("focus"))}).on("focus.bs.button.data-api blur.bs.button.data-api",'[data-toggle^="button"]',function(t){s(t.target).closest(".btn").toggleClass("focus",/^focus(in)?$/.test(t.type))})}(jQuery),function(p){"use strict";var c=function(t,e){this.$element=p(t),this.$indicators=this.$element.find(".carousel-indicators"),this.options=e,this.paused=null,this.sliding=null,this.interval=null,this.$active=null,this.$items=null,this.options.keyboard&&this.$element.on("keydown.bs.carousel",p.proxy(this.keydown,this)),"hover"==this.options.pause&&!("ontouchstart"in document.documentElement)&&this.$element.on("mouseenter.bs.carousel",p.proxy(this.pause,this)).on("mouseleave.bs.carousel",p.proxy(this.cycle,this))};function r(n){return this.each(function(){var t=p(this),e=t.data("bs.carousel"),i=p.extend({},c.DEFAULTS,t.data(),"object"==typeof n&&n),o="string"==typeof n?n:i.slide;e||t.data("bs.carousel",e=new c(this,i)),"number"==typeof n?e.to(n):o?e[o]():i.interval&&e.pause().cycle()})}c.VERSION="3.4.1",c.TRANSITION_DURATION=600,c.DEFAULTS={interval:5e3,pause:"hover",wrap:!0,keyboard:!0},c.prototype.keydown=function(t){if(!/input|textarea/i.test(t.target.tagName)){switch(t.which){case 37:this.prev();break;case 39:this.next();break;default:return}t.preventDefault()}},c.prototype.cycle=function(t){return t||(this.paused=!1),this.interval&&clearInterval(this.interval),this.options.interval&&!this.paused&&(this.interval=setInterval(p.proxy(this.next,this),this.options.interval)),this},c.prototype.getItemIndex=function(t){return this.$items=t.parent().children(".item"),this.$items.index(t||this.$active)},c.prototype.getItemForDirection=function(t,e){var i=this.getItemIndex(e);if(("prev"==t&&0===i||"next"==t&&i==this.$items.length-1)&&!this.options.wrap)return e;var o=(i+("prev"==t?-1:1))%this.$items.length;return this.$items.eq(o)},c.prototype.to=function(t){var e=this,i=this.getItemIndex(this.$active=this.$element.find(".item.active"));if(!(t>this.$items.length-1||t<0))return this.sliding?this.$element.one("slid.bs.carousel",function(){e.to(t)}):i==t?this.pause().cycle():this.slide(i<t?"next":"prev",this.$items.eq(t))},c.prototype.pause=function(t){return t||(this.paused=!0),this.$element.find(".next, .prev").length&&p.support.transition&&(this.$element.trigger(p.support.transition.end),this.cycle(!0)),this.interval=clearInterval(this.interval),this},c.prototype.next=function(){if(!this.sliding)return this.slide("next")},c.prototype.prev=function(){if(!this.sliding)return this.slide("prev")},c.prototype.slide=function(t,e){var i=this.$element.find(".item.active"),o=e||this.getItemForDirection(t,i),n=this.interval,s="next"==t?"left":"right",a=this;if(o.hasClass("active"))return this.sliding=!1;var r=o[0],l=p.Event("slide.bs.carousel",{relatedTarget:r,direction:s});if(this.$element.trigger(l),!l.isDefaultPrevented()){if(this.sliding=!0,n&&this.pause(),this.$indicators.length){this.$indicators.find(".active").removeClass("active");var h=p(this.$indicators.children()[this.getItemIndex(o)]);h&&h.addClass("active")}var d=p.Event("slid.bs.carousel",{relatedTarget:r,direction:s});return p.support.transition&&this.$element.hasClass("slide")?(o.addClass(t),"object"==typeof o&&o.length&&o[0].offsetWidth,i.addClass(s),o.addClass(s),i.one("bsTransitionEnd",function(){o.removeClass([t,s].join(" ")).addClass("active"),i.removeClass(["active",s].join(" ")),a.sliding=!1,setTimeout(function(){a.$element.trigger(d)},0)}).emulateTransitionEnd(c.TRANSITION_DURATION)):(i.removeClass("active"),o.addClass("active"),this.sliding=!1,this.$element.trigger(d)),n&&this.cycle(),this}};var t=p.fn.carousel;p.fn.carousel=r,p.fn.carousel.Constructor=c,p.fn.carousel.noConflict=function(){return p.fn.carousel=t,this};var e=function(t){var e=p(this),i=e.attr("href");i&&(i=i.replace(/.*(?=#[^\s]+$)/,""));var o=e.attr("data-target")||i,n=p(document).find(o);if(n.hasClass("carousel")){var s=p.extend({},n.data(),e.data()),a=e.attr("data-slide-to");a&&(s.interval=!1),r.call(n,s),a&&n.data("bs.carousel").to(a),t.preventDefault()}};p(document).on("click.bs.carousel.data-api","[data-slide]",e).on("click.bs.carousel.data-api","[data-slide-to]",e),p(window).on("load",function(){p('[data-ride="carousel"]').each(function(){var t=p(this);r.call(t,t.data())})})}(jQuery),function(a){"use strict";var r=function(t,e){this.$element=a(t),this.options=a.extend({},r.DEFAULTS,e),this.$trigger=a('[data-toggle="collapse"][href="#'+t.id+'"],[data-toggle="collapse"][data-target="#'+t.id+'"]'),this.transitioning=null,this.options.parent?this.$parent=this.getParent():this.addAriaAndCollapsedClass(this.$element,this.$trigger),this.options.toggle&&this.toggle()};function n(t){var e,i=t.attr("data-target")||(e=t.attr("href"))&&e.replace(/.*(?=#[^\s]+$)/,"");return a(document).find(i)}function l(o){return this.each(function(){var t=a(this),e=t.data("bs.collapse"),i=a.extend({},r.DEFAULTS,t.data(),"object"==typeof o&&o);!e&&i.toggle&&/show|hide/.test(o)&&(i.toggle=!1),e||t.data("bs.collapse",e=new r(this,i)),"string"==typeof o&&e[o]()})}r.VERSION="3.4.1",r.TRANSITION_DURATION=350,r.DEFAULTS={toggle:!0},r.prototype.dimension=function(){return this.$element.hasClass("width")?"width":"height"},r.prototype.show=function(){if(!this.transitioning&&!this.$element.hasClass("in")){var t,e=this.$parent&&this.$parent.children(".panel").children(".in, .collapsing");if(!(e&&e.length&&(t=e.data("bs.collapse"))&&t.transitioning)){var i=a.Event("show.bs.collapse");if(this.$element.trigger(i),!i.isDefaultPrevented()){e&&e.length&&(l.call(e,"hide"),t||e.data("bs.collapse",null));var o=this.dimension();this.$element.removeClass("collapse").addClass("collapsing")[o](0).attr("aria-expanded",!0),this.$trigger.removeClass("collapsed").attr("aria-expanded",!0),this.transitioning=1;var n=function(){this.$element.removeClass("collapsing").addClass("collapse in")[o](""),this.transitioning=0,this.$element.trigger("shown.bs.collapse")};if(!a.support.transition)return n.call(this);var s=a.camelCase(["scroll",o].join("-"));this.$element.one("bsTransitionEnd",a.proxy(n,this)).emulateTransitionEnd(r.TRANSITION_DURATION)[o](this.$element[0][s])}}}},r.prototype.hide=function(){if(!this.transitioning&&this.$element.hasClass("in")){var t=a.Event("hide.bs.collapse");if(this.$element.trigger(t),!t.isDefaultPrevented()){var e=this.dimension();this.$element[e](this.$element[e]())[0].offsetHeight,this.$element.addClass("collapsing").removeClass("collapse in").attr("aria-expanded",!1),this.$trigger.addClass("collapsed").attr("aria-expanded",!1),this.transitioning=1;var i=function(){this.transitioning=0,this.$element.removeClass("collapsing").addClass("collapse").trigger("hidden.bs.collapse")};if(!a.support.transition)return i.call(this);this.$element[e](0).one("bsTransitionEnd",a.proxy(i,this)).emulateTransitionEnd(r.TRANSITION_DURATION)}}},r.prototype.toggle=function(){this[this.$element.hasClass("in")?"hide":"show"]()},r.prototype.getParent=function(){return a(document).find(this.options.parent).find('[data-toggle="collapse"][data-parent="'+this.options.parent+'"]').each(a.proxy(function(t,e){var i=a(e);this.addAriaAndCollapsedClass(n(i),i)},this)).end()},r.prototype.addAriaAndCollapsedClass=function(t,e){var i=t.hasClass("in");t.attr("aria-expanded",i),e.toggleClass("collapsed",!i).attr("aria-expanded",i)};var t=a.fn.collapse;a.fn.collapse=l,a.fn.collapse.Constructor=r,a.fn.collapse.noConflict=function(){return a.fn.collapse=t,this},a(document).on("click.bs.collapse.data-api",'[data-toggle="collapse"]',function(t){var e=a(this);e.attr("data-target")||t.preventDefault();var i=n(e),o=i.data("bs.collapse")?"toggle":e.data();l.call(i,o)})}(jQuery),function(a){"use strict";var r='[data-toggle="dropdown"]',o=function(t){a(t).on("click.bs.dropdown",this.toggle)};function l(t){var e=t.attr("data-target");e||(e=(e=t.attr("href"))&&/#[A-Za-z]/.test(e)&&e.replace(/.*(?=#[^\s]*$)/,""));var i="#"!==e?a(document).find(e):null;return i&&i.length?i:t.parent()}function s(o){o&&3===o.which||(a(".dropdown-backdrop").remove(),a(r).each(function(){var t=a(this),e=l(t),i={relatedTarget:this};e.hasClass("open")&&(o&&"click"==o.type&&/input|textarea/i.test(o.target.tagName)&&a.contains(e[0],o.target)||(e.trigger(o=a.Event("hide.bs.dropdown",i)),o.isDefaultPrevented()||(t.attr("aria-expanded","false"),e.removeClass("open").trigger(a.Event("hidden.bs.dropdown",i)))))}))}o.VERSION="3.4.1",o.prototype.toggle=function(t){var e=a(this);if(!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(s(),!o){"ontouchstart"in document.documentElement&&!i.closest(".navbar-nav").length&&a(document.createElement("div")).addClass("dropdown-backdrop").insertAfter(a(this)).on("click",s);var n={relatedTarget:this};if(i.trigger(t=a.Event("show.bs.dropdown",n)),t.isDefaultPrevented())return;e.trigger("focus").attr("aria-expanded","true"),i.toggleClass("open").trigger(a.Event("shown.bs.dropdown",n))}return!1}},o.prototype.keydown=function(t){if(/(38|40|27|32)/.test(t.which)&&!/input|textarea/i.test(t.target.tagName)){var e=a(this);if(t.preventDefault(),t.stopPropagation(),!e.is(".disabled, :disabled")){var i=l(e),o=i.hasClass("open");if(!o&&27!=t.which||o&&27==t.which)return 27==t.which&&i.find(r).trigger("focus"),e.trigger("click");var n=i.find(".dropdown-menu li:not(.disabled):visible a");if(n.length){var s=n.index(t.target);38==t.which&&0<s&&s--,40==t.which&&s<n.length-1&&s++,~s||(s=0),n.eq(s).trigger("focus")}}}};var t=a.fn.dropdown;a.fn.dropdown=function e(i){return this.each(function(){var t=a(this),e=t.data("bs.dropdown");e||t.data("bs.dropdown",e=new o(this)),"string"==typeof i&&e[i].call(t)})},a.fn.dropdown.Constructor=o,a.fn.dropdown.noConflict=function(){return a.fn.dropdown=t,this},a(document).on("click.bs.dropdown.data-api",s).on("click.bs.dropdown.data-api",".dropdown form",function(t){t.stopPropagation()}).on("click.bs.dropdown.data-api",r,o.prototype.toggle).on("keydown.bs.dropdown.data-api",r,o.prototype.keydown).on("keydown.bs.dropdown.data-api",".dropdown-menu",o.prototype.keydown)}(jQuery),function(a){"use strict";var s=function(t,e){this.options=e,this.$body=a(document.body),this.$element=a(t),this.$dialog=this.$element.find(".modal-dialog"),this.$backdrop=null,this.isShown=null,this.originalBodyPad=null,this.scrollbarWidth=0,this.ignoreBackdropClick=!1,this.fixedContent=".navbar-fixed-top, .navbar-fixed-bottom",this.options.remote&&this.$element.find(".modal-content").load(this.options.remote,a.proxy(function(){this.$element.trigger("loaded.bs.modal")},this))};function r(o,n){return this.each(function(){var t=a(this),e=t.data("bs.modal"),i=a.extend({},s.DEFAULTS,t.data(),"object"==typeof o&&o);e||t.data("bs.modal",e=new s(this,i)),"string"==typeof o?e[o](n):i.show&&e.show(n)})}s.VERSION="3.4.1",s.TRANSITION_DURATION=300,s.BACKDROP_TRANSITION_DURATION=150,s.DEFAULTS={backdrop:!0,keyboard:!0,show:!0},s.prototype.toggle=function(t){return this.isShown?this.hide():this.show(t)},s.prototype.show=function(i){var o=this,t=a.Event("show.bs.modal",{relatedTarget:i});this.$element.trigger(t),this.isShown||t.isDefaultPrevented()||(this.isShown=!0,this.checkScrollbar(),this.setScrollbar(),this.$body.addClass("modal-open"),this.escape(),this.resize(),this.$element.on("click.dismiss.bs.modal",'[data-dismiss="modal"]',a.proxy(this.hide,this)),this.$dialog.on("mousedown.dismiss.bs.modal",function(){o.$element.one("mouseup.dismiss.bs.modal",function(t){a(t.target).is(o.$element)&&(o.ignoreBackdropClick=!0)})}),this.backdrop(function(){var t=a.support.transition&&o.$element.hasClass("fade");o.$element.parent().length||o.$element.appendTo(o.$body),o.$element.show().scrollTop(0),o.adjustDialog(),t&&o.$element[0].offsetWidth,o.$element.addClass("in"),o.enforceFocus();var e=a.Event("shown.bs.modal",{relatedTarget:i});t?o.$dialog.one("bsTransitionEnd",function(){o.$element.trigger("focus").trigger(e)}).emulateTransitionEnd(s.TRANSITION_DURATION):o.$element.trigger("focus").trigger(e)}))},s.prototype.hide=function(t){t&&t.preventDefault(),t=a.Event("hide.bs.modal"),this.$element.trigger(t),this.isShown&&!t.isDefaultPrevented()&&(this.isShown=!1,this.escape(),this.resize(),a(document).off("focusin.bs.modal"),this.$element.removeClass("in").off("click.dismiss.bs.modal").off("mouseup.dismiss.bs.modal"),this.$dialog.off("mousedown.dismiss.bs.modal"),a.support.transition&&this.$element.hasClass("fade")?this.$element.one("bsTransitionEnd",a.proxy(this.hideModal,this)).emulateTransitionEnd(s.TRANSITION_DURATION):this.hideModal())},s.prototype.enforceFocus=function(){a(document).off("focusin.bs.modal").on("focusin.bs.modal",a.proxy(function(t){document===t.target||this.$element[0]===t.target||this.$element.has(t.target).length||this.$element.trigger("focus")},this))},s.prototype.escape=function(){this.isShown&&this.options.keyboard?this.$element.on("keydown.dismiss.bs.modal",a.proxy(function(t){27==t.which&&this.hide()},this)):this.isShown||this.$element.off("keydown.dismiss.bs.modal")},s.prototype.resize=function(){this.isShown?a(window).on("resize.bs.modal",a.proxy(this.handleUpdate,this)):a(window).off("resize.bs.modal")},s.prototype.hideModal=function(){var t=this;this.$element.hide(),this.backdrop(function(){t.$body.removeClass("modal-open"),t.resetAdjustments(),t.resetScrollbar(),t.$element.trigger("hidden.bs.modal")})},s.prototype.removeBackdrop=function(){this.$backdrop&&this.$backdrop.remove(),this.$backdrop=null},s.prototype.backdrop=function(t){var e=this,i=this.$element.hasClass("fade")?"fade":"";if(this.isShown&&this.options.backdrop){var o=a.support.transition&&i;if(this.$backdrop=a(document.createElement("div")).addClass("modal-backdrop "+i).appendTo(this.$body),this.$element.on("click.dismiss.bs.modal",a.proxy(function(t){this.ignoreBackdropClick?this.ignoreBackdropClick=!1:t.target===t.currentTarget&&("static"==this.options.backdrop?this.$element[0].focus():this.hide())},this)),o&&this.$backdrop[0].offsetWidth,this.$backdrop.addClass("in"),!t)return;o?this.$backdrop.one("bsTransitionEnd",t).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):t()}else if(!this.isShown&&this.$backdrop){this.$backdrop.removeClass("in");var n=function(){e.removeBackdrop(),t&&t()};a.support.transition&&this.$element.hasClass("fade")?this.$backdrop.one("bsTransitionEnd",n).emulateTransitionEnd(s.BACKDROP_TRANSITION_DURATION):n()}else t&&t()},s.prototype.handleUpdate=function(){this.adjustDialog()},s.prototype.adjustDialog=function(){var t=this.$element[0].scrollHeight>document.documentElement.clientHeight;this.$element.css({paddingLeft:!this.bodyIsOverflowing&&t?this.scrollbarWidth:"",paddingRight:this.bodyIsOverflowing&&!t?this.scrollbarWidth:""})},s.prototype.resetAdjustments=function(){this.$element.css({paddingLeft:"",paddingRight:""})},s.prototype.checkScrollbar=function(){var t=window.innerWidth;if(!t){var e=document.documentElement.getBoundingClientRect();t=e.right-Math.abs(e.left)}this.bodyIsOverflowing=document.body.clientWidth<t,this.scrollbarWidth=this.measureScrollbar()},s.prototype.setScrollbar=function(){var t=parseInt(this.$body.css("padding-right")||0,10);this.originalBodyPad=document.body.style.paddingRight||"";var n=this.scrollbarWidth;this.bodyIsOverflowing&&(this.$body.css("padding-right",t+n),a(this.fixedContent).each(function(t,e){var i=e.style.paddingRight,o=a(e).css("padding-right");a(e).data("padding-right",i).css("padding-right",parseFloat(o)+n+"px")}))},s.prototype.resetScrollbar=function(){this.$body.css("padding-right",this.originalBodyPad),a(this.fixedContent).each(function(t,e){var i=a(e).data("padding-right");a(e).removeData("padding-right"),e.style.paddingRight=i||""})},s.prototype.measureScrollbar=function(){var t=document.createElement("div");t.className="modal-scrollbar-measure",this.$body.append(t);var e=t.offsetWidth-t.clientWidth;return this.$body[0].removeChild(t),e};var t=a.fn.modal;a.fn.modal=r,a.fn.modal.Constructor=s,a.fn.modal.noConflict=function(){return a.fn.modal=t,this},a(document).on("click.bs.modal.data-api",'[data-toggle="modal"]',function(t){var e=a(this),i=e.attr("href"),o=e.attr("data-target")||i&&i.replace(/.*(?=#[^\s]+$)/,""),n=a(document).find(o),s=n.data("bs.modal")?"toggle":a.extend({remote:!/#/.test(i)&&i},n.data(),e.data());e.is("a")&&t.preventDefault(),n.one("show.bs.modal",function(t){t.isDefaultPrevented()||n.one("hidden.bs.modal",function(){e.is(":visible")&&e.trigger("focus")})}),r.call(n,s,this)})}(jQuery),function(g){"use strict";var o=["sanitize","whiteList","sanitizeFn"],a=["background","cite","href","itemtype","longdesc","poster","src","xlink:href"],t={"*":["class","dir","id","lang","role",/^aria-[\w-]*$/i],a:["target","href","title","rel"],area:[],b:[],br:[],col:[],code:[],div:[],em:[],hr:[],h1:[],h2:[],h3:[],h4:[],h5:[],h6:[],i:[],img:["src","alt","title","width","height"],li:[],ol:[],p:[],pre:[],s:[],small:[],span:[],sub:[],sup:[],strong:[],u:[],ul:[]},r=/^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi,l=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+/]+=*$/i;function u(t,e){var i=t.nodeName.toLowerCase();if(-1!==g.inArray(i,e))return-1===g.inArray(i,a)||Boolean(t.nodeValue.match(r)||t.nodeValue.match(l));for(var o=g(e).filter(function(t,e){return e instanceof RegExp}),n=0,s=o.length;n<s;n++)if(i.match(o[n]))return!0;return!1}function n(t,e,i){if(0===t.length)return t;if(i&&"function"==typeof i)return i(t);if(!document.implementation||!document.implementation.createHTMLDocument)return t;var o=document.implementation.createHTMLDocument("sanitization");o.body.innerHTML=t;for(var n=g.map(e,function(t,e){return e}),s=g(o.body).find("*"),a=0,r=s.length;a<r;a++){var l=s[a],h=l.nodeName.toLowerCase();if(-1!==g.inArray(h,n))for(var d=g.map(l.attributes,function(t){return t}),p=[].concat(e["*"]||[],e[h]||[]),c=0,f=d.length;c<f;c++)u(d[c],p)||l.removeAttribute(d[c].nodeName);else l.parentNode.removeChild(l)}return o.body.innerHTML}var m=function(t,e){this.type=null,this.options=null,this.enabled=null,this.timeout=null,this.hoverState=null,this.$element=null,this.inState=null,this.init("tooltip",t,e)};m.VERSION="3.4.1",m.TRANSITION_DURATION=150,m.DEFAULTS={animation:!0,placement:"top",selector:!1,template:'<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',trigger:"hover focus",title:"",delay:0,html:!1,container:!1,viewport:{selector:"body",padding:0},sanitize:!0,sanitizeFn:null,whiteList:t},m.prototype.init=function(t,e,i){if(this.enabled=!0,this.type=t,this.$element=g(e),this.options=this.getOptions(i),this.$viewport=this.options.viewport&&g(document).find(g.isFunction(this.options.viewport)?this.options.viewport.call(this,this.$element):this.options.viewport.selector||this.options.viewport),this.inState={click:!1,hover:!1,focus:!1},this.$element[0]instanceof document.constructor&&!this.options.selector)throw new Error("`selector` option must be specified when initializing "+this.type+" on the window.document object!");for(var o=this.options.trigger.split(" "),n=o.length;n--;){var s=o[n];if("click"==s)this.$element.on("click."+this.type,this.options.selector,g.proxy(this.toggle,this));else if("manual"!=s){var a="hover"==s?"mouseenter":"focusin",r="hover"==s?"mouseleave":"focusout";this.$element.on(a+"."+this.type,this.options.selector,g.proxy(this.enter,this)),this.$element.on(r+"."+this.type,this.options.selector,g.proxy(this.leave,this))}}this.options.selector?this._options=g.extend({},this.options,{trigger:"manual",selector:""}):this.fixTitle()},m.prototype.getDefaults=function(){return m.DEFAULTS},m.prototype.getOptions=function(t){var e=this.$element.data();for(var i in e)e.hasOwnProperty(i)&&-1!==g.inArray(i,o)&&delete e[i];return(t=g.extend({},this.getDefaults(),e,t)).delay&&"number"==typeof t.delay&&(t.delay={show:t.delay,hide:t.delay}),t.sanitize&&(t.template=n(t.template,t.whiteList,t.sanitizeFn)),t},m.prototype.getDelegateOptions=function(){var i={},o=this.getDefaults();return this._options&&g.each(this._options,function(t,e){o[t]!=e&&(i[t]=e)}),i},m.prototype.enter=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusin"==t.type?"focus":"hover"]=!0),e.tip().hasClass("in")||"in"==e.hoverState)e.hoverState="in";else{if(clearTimeout(e.timeout),e.hoverState="in",!e.options.delay||!e.options.delay.show)return e.show();e.timeout=setTimeout(function(){"in"==e.hoverState&&e.show()},e.options.delay.show)}},m.prototype.isInStateTrue=function(){for(var t in this.inState)if(this.inState[t])return!0;return!1},m.prototype.leave=function(t){var e=t instanceof this.constructor?t:g(t.currentTarget).data("bs."+this.type);if(e||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e)),t instanceof g.Event&&(e.inState["focusout"==t.type?"focus":"hover"]=!1),!e.isInStateTrue()){if(clearTimeout(e.timeout),e.hoverState="out",!e.options.delay||!e.options.delay.hide)return e.hide();e.timeout=setTimeout(function(){"out"==e.hoverState&&e.hide()},e.options.delay.hide)}},m.prototype.show=function(){var t=g.Event("show.bs."+this.type);if(this.hasContent()&&this.enabled){this.$element.trigger(t);var e=g.contains(this.$element[0].ownerDocument.documentElement,this.$element[0]);if(t.isDefaultPrevented()||!e)return;var i=this,o=this.tip(),n=this.getUID(this.type);this.setContent(),o.attr("id",n),this.$element.attr("aria-describedby",n),this.options.animation&&o.addClass("fade");var s="function"==typeof this.options.placement?this.options.placement.call(this,o[0],this.$element[0]):this.options.placement,a=/\s?auto?\s?/i,r=a.test(s);r&&(s=s.replace(a,"")||"top"),o.detach().css({top:0,left:0,display:"block"}).addClass(s).data("bs."+this.type,this),this.options.container?o.appendTo(g(document).find(this.options.container)):o.insertAfter(this.$element),this.$element.trigger("inserted.bs."+this.type);var l=this.getPosition(),h=o[0].offsetWidth,d=o[0].offsetHeight;if(r){var p=s,c=this.getPosition(this.$viewport);s="bottom"==s&&l.bottom+d>c.bottom?"top":"top"==s&&l.top-d<c.top?"bottom":"right"==s&&l.right+h>c.width?"left":"left"==s&&l.left-h<c.left?"right":s,o.removeClass(p).addClass(s)}var f=this.getCalculatedOffset(s,l,h,d);this.applyPlacement(f,s);var u=function(){var t=i.hoverState;i.$element.trigger("shown.bs."+i.type),i.hoverState=null,"out"==t&&i.leave(i)};g.support.transition&&this.$tip.hasClass("fade")?o.one("bsTransitionEnd",u).emulateTransitionEnd(m.TRANSITION_DURATION):u()}},m.prototype.applyPlacement=function(t,e){var i=this.tip(),o=i[0].offsetWidth,n=i[0].offsetHeight,s=parseInt(i.css("margin-top"),10),a=parseInt(i.css("margin-left"),10);isNaN(s)&&(s=0),isNaN(a)&&(a=0),t.top+=s,t.left+=a,g.offset.setOffset(i[0],g.extend({using:function(t){i.css({top:Math.round(t.top),left:Math.round(t.left)})}},t),0),i.addClass("in");var r=i[0].offsetWidth,l=i[0].offsetHeight;"top"==e&&l!=n&&(t.top=t.top+n-l);var h=this.getViewportAdjustedDelta(e,t,r,l);h.left?t.left+=h.left:t.top+=h.top;var d=/top|bottom/.test(e),p=d?2*h.left-o+r:2*h.top-n+l,c=d?"offsetWidth":"offsetHeight";i.offset(t),this.replaceArrow(p,i[0][c],d)},m.prototype.replaceArrow=function(t,e,i){this.arrow().css(i?"left":"top",50*(1-t/e)+"%").css(i?"top":"left","")},m.prototype.setContent=function(){var t=this.tip(),e=this.getTitle();this.options.html?(this.options.sanitize&&(e=n(e,this.options.whiteList,this.options.sanitizeFn)),t.find(".tooltip-inner").html(e)):t.find(".tooltip-inner").text(e),t.removeClass("fade in top bottom left right")},m.prototype.hide=function(t){var e=this,i=g(this.$tip),o=g.Event("hide.bs."+this.type);function n(){"in"!=e.hoverState&&i.detach(),e.$element&&e.$element.removeAttr("aria-describedby").trigger("hidden.bs."+e.type),t&&t()}if(this.$element.trigger(o),!o.isDefaultPrevented())return i.removeClass("in"),g.support.transition&&i.hasClass("fade")?i.one("bsTransitionEnd",n).emulateTransitionEnd(m.TRANSITION_DURATION):n(),this.hoverState=null,this},m.prototype.fixTitle=function(){var t=this.$element;(t.attr("title")||"string"!=typeof t.attr("data-original-title"))&&t.attr("data-original-title",t.attr("title")||"").attr("title","")},m.prototype.hasContent=function(){return this.getTitle()},m.prototype.getPosition=function(t){var e=(t=t||this.$element)[0],i="BODY"==e.tagName,o=e.getBoundingClientRect();null==o.width&&(o=g.extend({},o,{width:o.right-o.left,height:o.bottom-o.top}));var n=window.SVGElement&&e instanceof window.SVGElement,s=i?{top:0,left:0}:n?null:t.offset(),a={scroll:i?document.documentElement.scrollTop||document.body.scrollTop:t.scrollTop()},r=i?{width:g(window).width(),height:g(window).height()}:null;return g.extend({},o,a,r,s)},m.prototype.getCalculatedOffset=function(t,e,i,o){return"bottom"==t?{top:e.top+e.height,left:e.left+e.width/2-i/2}:"top"==t?{top:e.top-o,left:e.left+e.width/2-i/2}:"left"==t?{top:e.top+e.height/2-o/2,left:e.left-i}:{top:e.top+e.height/2-o/2,left:e.left+e.width}},m.prototype.getViewportAdjustedDelta=function(t,e,i,o){var n={top:0,left:0};if(!this.$viewport)return n;var s=this.options.viewport&&this.options.viewport.padding||0,a=this.getPosition(this.$viewport);if(/right|left/.test(t)){var r=e.top-s-a.scroll,l=e.top+s-a.scroll+o;r<a.top?n.top=a.top-r:l>a.top+a.height&&(n.top=a.top+a.height-l)}else{var h=e.left-s,d=e.left+s+i;h<a.left?n.left=a.left-h:d>a.right&&(n.left=a.left+a.width-d)}return n},m.prototype.getTitle=function(){var t=this.$element,e=this.options;return t.attr("data-original-title")||("function"==typeof e.title?e.title.call(t[0]):e.title)},m.prototype.getUID=function(t){for(;t+=~~(1e6*Math.random()),document.getElementById(t););return t},m.prototype.tip=function(){if(!this.$tip&&(this.$tip=g(this.options.template),1!=this.$tip.length))throw new Error(this.type+" `template` option must consist of exactly 1 top-level element!");return this.$tip},m.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".tooltip-arrow")},m.prototype.enable=function(){this.enabled=!0},m.prototype.disable=function(){this.enabled=!1},m.prototype.toggleEnabled=function(){this.enabled=!this.enabled},m.prototype.toggle=function(t){var e=this;t&&((e=g(t.currentTarget).data("bs."+this.type))||(e=new this.constructor(t.currentTarget,this.getDelegateOptions()),g(t.currentTarget).data("bs."+this.type,e))),t?(e.inState.click=!e.inState.click,e.isInStateTrue()?e.enter(e):e.leave(e)):e.tip().hasClass("in")?e.leave(e):e.enter(e)},m.prototype.destroy=function(){var t=this;clearTimeout(this.timeout),this.hide(function(){t.$element.off("."+t.type).removeData("bs."+t.type),t.$tip&&t.$tip.detach(),t.$tip=null,t.$arrow=null,t.$viewport=null,t.$element=null})},m.prototype.sanitizeHtml=function(t){return n(t,this.options.whiteList,this.options.sanitizeFn)};var e=g.fn.tooltip;g.fn.tooltip=function i(o){return this.each(function(){var t=g(this),e=t.data("bs.tooltip"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.tooltip",e=new m(this,i)),"string"==typeof o&&e[o]())})},g.fn.tooltip.Constructor=m,g.fn.tooltip.noConflict=function(){return g.fn.tooltip=e,this}}(jQuery),function(n){"use strict";var s=function(t,e){this.init("popover",t,e)};if(!n.fn.tooltip)throw new Error("Popover requires tooltip.js");s.VERSION="3.4.1",s.DEFAULTS=n.extend({},n.fn.tooltip.Constructor.DEFAULTS,{placement:"right",trigger:"click",content:"",template:'<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'}),((s.prototype=n.extend({},n.fn.tooltip.Constructor.prototype)).constructor=s).prototype.getDefaults=function(){return s.DEFAULTS},s.prototype.setContent=function(){var t=this.tip(),e=this.getTitle(),i=this.getContent();if(this.options.html){var o=typeof i;this.options.sanitize&&(e=this.sanitizeHtml(e),"string"===o&&(i=this.sanitizeHtml(i))),t.find(".popover-title").html(e),t.find(".popover-content").children().detach().end()["string"===o?"html":"append"](i)}else t.find(".popover-title").text(e),t.find(".popover-content").children().detach().end().text(i);t.removeClass("fade top bottom left right in"),t.find(".popover-title").html()||t.find(".popover-title").hide()},s.prototype.hasContent=function(){return this.getTitle()||this.getContent()},s.prototype.getContent=function(){var t=this.$element,e=this.options;return t.attr("data-content")||("function"==typeof e.content?e.content.call(t[0]):e.content)},s.prototype.arrow=function(){return this.$arrow=this.$arrow||this.tip().find(".arrow")};var t=n.fn.popover;n.fn.popover=function e(o){return this.each(function(){var t=n(this),e=t.data("bs.popover"),i="object"==typeof o&&o;!e&&/destroy|hide/.test(o)||(e||t.data("bs.popover",e=new s(this,i)),"string"==typeof o&&e[o]())})},n.fn.popover.Constructor=s,n.fn.popover.noConflict=function(){return n.fn.popover=t,this}}(jQuery),function(s){"use strict";function n(t,e){this.$body=s(document.body),this.$scrollElement=s(t).is(document.body)?s(window):s(t),this.options=s.extend({},n.DEFAULTS,e),this.selector=(this.options.target||"")+" .nav li > a",this.offsets=[],this.targets=[],this.activeTarget=null,this.scrollHeight=0,this.$scrollElement.on("scroll.bs.scrollspy",s.proxy(this.process,this)),this.refresh(),this.process()}function e(o){return this.each(function(){var t=s(this),e=t.data("bs.scrollspy"),i="object"==typeof o&&o;e||t.data("bs.scrollspy",e=new n(this,i)),"string"==typeof o&&e[o]()})}n.VERSION="3.4.1",n.DEFAULTS={offset:10},n.prototype.getScrollHeight=function(){return this.$scrollElement[0].scrollHeight||Math.max(this.$body[0].scrollHeight,document.documentElement.scrollHeight)},n.prototype.refresh=function(){var t=this,o="offset",n=0;this.offsets=[],this.targets=[],this.scrollHeight=this.getScrollHeight(),s.isWindow(this.$scrollElement[0])||(o="position",n=this.$scrollElement.scrollTop()),this.$body.find(this.selector).map(function(){var t=s(this),e=t.data("target")||t.attr("href"),i=/^#./.test(e)&&s(e);return i&&i.length&&i.is(":visible")&&[[i[o]().top+n,e]]||null}).sort(function(t,e){return t[0]-e[0]}).each(function(){t.offsets.push(this[0]),t.targets.push(this[1])})},n.prototype.process=function(){var t,e=this.$scrollElement.scrollTop()+this.options.offset,i=this.getScrollHeight(),o=this.options.offset+i-this.$scrollElement.height(),n=this.offsets,s=this.targets,a=this.activeTarget;if(this.scrollHeight!=i&&this.refresh(),o<=e)return a!=(t=s[s.length-1])&&this.activate(t);if(a&&e<n[0])return this.activeTarget=null,this.clear();for(t=n.length;t--;)a!=s[t]&&e>=n[t]&&(n[t+1]===undefined||e<n[t+1])&&this.activate(s[t])},n.prototype.activate=function(t){this.activeTarget=t,this.clear();var e=this.selector+'[data-target="'+t+'"],'+this.selector+'[href="'+t+'"]',i=s(e).parents("li").addClass("active");i.parent(".dropdown-menu").length&&(i=i.closest("li.dropdown").addClass("active")),i.trigger("activate.bs.scrollspy")},n.prototype.clear=function(){s(this.selector).parentsUntil(this.options.target,".active").removeClass("active")};var t=s.fn.scrollspy;s.fn.scrollspy=e,s.fn.scrollspy.Constructor=n,s.fn.scrollspy.noConflict=function(){return s.fn.scrollspy=t,this},s(window).on("load.bs.scrollspy.data-api",function(){s('[data-spy="scroll"]').each(function(){var t=s(this);e.call(t,t.data())})})}(jQuery),function(r){"use strict";var a=function(t){this.element=r(t)};function e(i){return this.each(function(){var t=r(this),e=t.data("bs.tab");e||t.data("bs.tab",e=new a(this)),"string"==typeof i&&e[i]()})}a.VERSION="3.4.1",a.TRANSITION_DURATION=150,a.prototype.show=function(){var t=this.element,e=t.closest("ul:not(.dropdown-menu)"),i=t.data("target");if(i||(i=(i=t.attr("href"))&&i.replace(/.*(?=#[^\s]*$)/,"")),!t.parent("li").hasClass("active")){var o=e.find(".active:last a"),n=r.Event("hide.bs.tab",{relatedTarget:t[0]}),s=r.Event("show.bs.tab",{relatedTarget:o[0]});if(o.trigger(n),t.trigger(s),!s.isDefaultPrevented()&&!n.isDefaultPrevented()){var a=r(document).find(i);this.activate(t.closest("li"),e),this.activate(a,a.parent(),function(){o.trigger({type:"hidden.bs.tab",relatedTarget:t[0]}),t.trigger({type:"shown.bs.tab",relatedTarget:o[0]})})}}},a.prototype.activate=function(t,e,i){var o=e.find("> .active"),n=i&&r.support.transition&&(o.length&&o.hasClass("fade")||!!e.find("> .fade").length);function s(){o.removeClass("active").find("> .dropdown-menu > .active").removeClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!1),t.addClass("active").find('[data-toggle="tab"]').attr("aria-expanded",!0),n?(t[0].offsetWidth,t.addClass("in")):t.removeClass("fade"),t.parent(".dropdown-menu").length&&t.closest("li.dropdown").addClass("active").end().find('[data-toggle="tab"]').attr("aria-expanded",!0),i&&i()}o.length&&n?o.one("bsTransitionEnd",s).emulateTransitionEnd(a.TRANSITION_DURATION):s(),o.removeClass("in")};var t=r.fn.tab;r.fn.tab=e,r.fn.tab.Constructor=a,r.fn.tab.noConflict=function(){return r.fn.tab=t,this};var i=function(t){t.preventDefault(),e.call(r(this),"show")};r(document).on("click.bs.tab.data-api",'[data-toggle="tab"]',i).on("click.bs.tab.data-api",'[data-toggle="pill"]',i)}(jQuery),function(l){"use strict";var h=function(t,e){this.options=l.extend({},h.DEFAULTS,e);var i=this.options.target===h.DEFAULTS.target?l(this.options.target):l(document).find(this.options.target);this.$target=i.on("scroll.bs.affix.data-api",l.proxy(this.checkPosition,this)).on("click.bs.affix.data-api",l.proxy(this.checkPositionWithEventLoop,this)),this.$element=l(t),this.affixed=null,this.unpin=null,this.pinnedOffset=null,this.checkPosition()};function i(o){return this.each(function(){var t=l(this),e=t.data("bs.affix"),i="object"==typeof o&&o;e||t.data("bs.affix",e=new h(this,i)),"string"==typeof o&&e[o]()})}h.VERSION="3.4.1",h.RESET="affix affix-top affix-bottom",h.DEFAULTS={offset:0,target:window},h.prototype.getState=function(t,e,i,o){var n=this.$target.scrollTop(),s=this.$element.offset(),a=this.$target.height();if(null!=i&&"top"==this.affixed)return n<i&&"top";if("bottom"==this.affixed)return null!=i?!(n+this.unpin<=s.top)&&"bottom":!(n+a<=t-o)&&"bottom";var r=null==this.affixed,l=r?n:s.top;return null!=i&&n<=i?"top":null!=o&&t-o<=l+(r?a:e)&&"bottom"},h.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset;this.$element.removeClass(h.RESET).addClass("affix");var t=this.$target.scrollTop(),e=this.$element.offset();return this.pinnedOffset=e.top-t},h.prototype.checkPositionWithEventLoop=function(){setTimeout(l.proxy(this.checkPosition,this),1)},h.prototype.checkPosition=function(){if(this.$element.is(":visible")){var t=this.$element.height(),e=this.options.offset,i=e.top,o=e.bottom,n=Math.max(l(document).height(),l(document.body).height());"object"!=typeof e&&(o=i=e),"function"==typeof i&&(i=e.top(this.$element)),"function"==typeof o&&(o=e.bottom(this.$element));var s=this.getState(n,t,i,o);if(this.affixed!=s){null!=this.unpin&&this.$element.css("top","");var a="affix"+(s?"-"+s:""),r=l.Event(a+".bs.affix");if(this.$element.trigger(r),r.isDefaultPrevented())return;this.affixed=s,this.unpin="bottom"==s?this.getPinnedOffset():null,this.$element.removeClass(h.RESET).addClass(a).trigger(a.replace("affix","affixed")+".bs.affix")}"bottom"==s&&this.$element.offset({top:n-t-o})}};var t=l.fn.affix;l.fn.affix=i,l.fn.affix.Constructor=h,l.fn.affix.noConflict=function(){return l.fn.affix=t,this},l(window).on("load",function(){l('[data-spy="affix"]').each(function(){var t=l(this),e=t.data();e.offset=e.offset||{},null!=e.offsetBottom&&(e.offset.bottom=e.offsetBottom),null!=e.offsetTop&&(e.offset.top=e.offsetTop),i.call(t,e)})})}(jQuery);
- define("bootstrap", ["jquery"], (function (global) {
- return function () {
- var ret, fn;
- return ret || global.bootstrap;
- };
- }(this)));
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/dialog',['jquery',
- 'codemirror/lib/codemirror',
- 'bootstrap',
- 'base/js/i18n'],
- function($, CodeMirror, bs, i18n) {
- "use strict";
- /**
- * A wrapper around bootstrap modal for easier use
- * Pass it an option dictionary with the following properties:
- *
- * - body : <string> or <DOM node>, main content of the dialog
- * if pass a <string> it will be wrapped in a p tag and
- * html element escaped, unless you specify sanitize=false
- * option.
- * - title : Dialog title, default to empty string.
- * - buttons : dict of btn_options who keys are button label.
- * see btn_options below for description
- * - open : callback to trigger on dialog open.
- * - destroy:
- * - notebook : notebook instance
- * - keyboard_manager: keyboard manager instance.
- *
- * Unlike bootstrap modals, the backdrop options is set by default
- * to 'static'.
- *
- * The rest of the options are passed as is to bootstrap modals.
- *
- * btn_options: dict with the following property:
- *
- * - click : callback to trigger on click
- * - class : css classes to add to button.
- *
- *
- *
- **/
- var modal = function (options) {
- var modal = $("<div/>")
- .addClass("modal")
- .addClass("fade")
- .attr("role", "dialog");
- var dialog = $("<div/>")
- .addClass("modal-dialog")
- .appendTo(modal);
- var dialog_content = $("<div/>")
- .addClass("modal-content")
- .appendTo(dialog);
- if(typeof(options.body) === 'string' && options.sanitize !== false){
- options.body = $("<p/>").text(options.body);
- }
- dialog_content.append(
- $("<div/>")
- .addClass("modal-header")
- .mousedown(function() {
- $(".modal").draggable({handle: '.modal-header'});
- })
- .append($("<button>")
- .attr("type", "button")
- .attr("aria-label", i18n.msg._("close"))
- .addClass("close")
- .attr("data-dismiss", "modal")
- .attr("aria-hidden", "true")
- .html("×")
- ).append(
- $("<h4/>")
- .addClass('modal-title')
- .text(options.title || "")
- )
- ).append(
- $("<div/>")
- .addClass("modal-body")
- .append(
- options.body || $("<p/>")
- )
- );
-
- var footer = $("<div/>").addClass("modal-footer");
-
- var default_button;
-
- for (var label in options.buttons) {
- var btn_opts = options.buttons[label];
- var button = $("<button/>")
- .addClass("btn btn-default btn-sm")
- .attr("data-dismiss", "modal")
- .text(i18n.msg.translate(label).fetch());
- if (btn_opts.id) {
- button.attr('id', btn_opts.id);
- }
- if (btn_opts.click) {
- button.click($.proxy(btn_opts.click, dialog_content));
- }
- if (btn_opts.class) {
- button.addClass(btn_opts.class);
- }
- footer.append(button);
- if (options.default_button && label === options.default_button) {
- default_button = button;
- }
- }
- if (!options.default_button) {
- default_button = footer.find("button").last();
- }
- dialog_content.append(footer);
- // hook up on-open event
- modal.on("shown.bs.modal", function () {
- setTimeout(function () {
- default_button.focus();
- if (options.open) {
- $.proxy(options.open, modal)();
- }
- }, 0);
- });
-
- // destroy modal on hide, unless explicitly asked not to
- if (options.destroy === undefined || options.destroy) {
- modal.on("hidden.bs.modal", function () {
- modal.remove();
- });
- }
- modal.on("hidden.bs.modal", function () {
- if (options.notebook) {
- var cell = options.notebook.get_selected_cell();
- if (cell) cell.select();
- }
- if (options.keyboard_manager) {
- options.keyboard_manager.enable();
- options.keyboard_manager.command_mode();
- }
- if (options.focus_button) {
- $(options.focus_button).focus();
- }
- });
-
- if (options.keyboard_manager) {
- options.keyboard_manager.disable();
- }
-
- if(options.backdrop === undefined){
- options.backdrop = 'static';
- }
-
- return modal.modal(options);
- };
- var kernel_modal = function (options) {
- /**
- * only one kernel dialog should be open at a time -- but
- * other modal dialogs can still be open
- */
- $('.kernel-modal').modal('hide');
- var dialog = modal(options);
- dialog.addClass('kernel-modal');
- return dialog;
- };
- var edit_metadata = function (options) {
- options.name = options.name || "Cell";
- var error_div = $('<div/>').css('color', 'red');
- var message_cell =
- i18n.msg._("Manually edit the JSON below to manipulate the metadata for this cell.");
- var message_notebook =
- i18n.msg._("Manually edit the JSON below to manipulate the metadata for this notebook.");
- var message_end =
- i18n.msg._(" We recommend putting custom metadata attributes in an appropriately named substructure," +
- " so they don't conflict with those of others.");
- var message;
- if (options.name === 'Notebook') {
- message = message_notebook + message_end;
- } else {
- message = message_cell + message_end;
- }
- var textarea = $('<textarea/>')
- .attr('rows', '13')
- .attr('cols', '80')
- .attr('name', 'metadata')
- .text(JSON.stringify(options.md || {}, null, 2));
-
- var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the metadata'))
- .append(
- $('<form/>').append(
- $('<fieldset/>').append(
- $('<label/>')
- .attr('for','metadata')
- .text(message)
- )
- .append(error_div)
- .append($('<br/>'))
- .append(textarea)
- )
- );
- var editor = CodeMirror.fromTextArea(textarea[0], {
- lineNumbers: true,
- matchBrackets: true,
- indentUnit: 2,
- autoIndent: true,
- mode: 'application/json',
- });
- var title_msg;
- if (options.name === "Notebook") {
- title_msg = i18n.msg._("Edit Notebook Metadata");
- } else {
- title_msg = i18n.msg._("Edit Cell Metadata");
- }
- // This statement is used simply so that message extraction
- // will pick up the strings.
- var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Edit"), i18n.msg._("OK"), i18n.msg._("Apply")];
- var modal_obj = modal({
- title: title_msg,
- body: dialogform,
- default_button: "Cancel",
- buttons: {
- Cancel: {},
- Edit: { class : "btn-primary",
- click: function() {
- /**
- * validate json and set it
- */
- var new_md;
- try {
- new_md = JSON.parse(editor.getValue());
- } catch(e) {
- console.log(e);
- error_div.text(i18n.msg._('WARNING: Could not save invalid JSON.'));
- return false;
- }
- options.callback(new_md);
- options.notebook.apply_directionality();
- }
- }
- },
- notebook: options.notebook,
- keyboard_manager: options.keyboard_manager,
- });
- modal_obj.on('shown.bs.modal', function(){ editor.refresh(); });
- modal_obj.on('hide.bs.modal', function(){
- options.edit_metadata_button ? options.edit_metadata_button.focus() : "";});
- };
- var edit_attachments = function (options) {
- // This shows the Edit Attachments dialog. This dialog allows the
- // user to delete attachments. We show a list of attachments to
- // the user and he can mark some of them for deletion. The deletion
- // is applied when the 'Apply' button of this dialog is pressed.
- var message;
- var attachments_list;
- if (Object.keys(options.attachments).length == 0) {
- message = i18n.msg._("There are no attachments for this cell.");
- attachments_list = $('<div>');
- } else {
- message = i18n.msg._("Current cell attachments");
- attachments_list = $('<div>')
- .addClass('list_container')
- .append(
- $('<div>')
- .addClass('row list_header')
- .append(
- $('<div>')
- .text(i18n.msg._('Attachments'))
- )
- );
- // This is a set containing keys of attachments to be deleted when
- // the Apply button is clicked
- var to_delete = {};
- var refresh_attachments_list = function() {
- $(attachments_list).find('.row').remove();
- for (var key in options.attachments) {
- var mime = Object.keys(options.attachments[key])[0];
- var deleted = key in to_delete;
- // This ensures the current value of key is captured since
- // javascript only has function scope
- var btn;
- // Trash/restore button
- (function(){
- var _key = key;
- btn = $('<button>')
- .addClass('btn btn-default btn-xs')
- .css('display', 'inline-block');
- if (deleted) {
- btn.attr('title', i18n.msg._('Restore'))
- .append(
- $('<i>')
- .addClass('fa fa-plus')
- );
- btn.click(function() {
- delete to_delete[_key];
- refresh_attachments_list();
- });
- } else {
- btn.attr('title', i18n.msg._('Delete'))
- .addClass('btn-danger')
- .append(
- $('<i>')
- .addClass('fa fa-trash')
- );
- btn.click(function() {
- to_delete[_key] = true;
- refresh_attachments_list();
- });
- }
- return btn;
- })();
- var row = $('<div>')
- .addClass('col-md-12 att_row')
- .append(
- $('<div>')
- .addClass('row')
- .append(
- $('<div>')
- .addClass('att-name col-xs-4')
- .text(key)
- )
- .append(
- $('<div>')
- .addClass('col-xs-4 text-muted')
- .text(mime)
- )
- .append(
- $('<div>')
- .addClass('item-buttons pull-right')
- .append(btn)
- )
- );
- if (deleted) {
- row.find('.att-name')
- .css('text-decoration', 'line-through');
- }
- attachments_list.append($('<div>')
- .addClass('list_item row')
- .append(row)
- );
- }
- };
- refresh_attachments_list();
- }
- var dialogform = $('<div/>')
- .attr('title', i18n.msg._('Edit attachments'))
- .append(message)
- .append('<br />')
- .append(attachments_list);
- var title_msg;
- if ( options.name === "Notebook" ) {
- title_msg = i18n.msg._("Edit Notebook Attachments");
- } else {
- title_msg = i18n.msg._("Edit Cell Attachments");
- }
- var modal_obj = modal({
- title: title_msg,
- body: dialogform,
- buttons: {
- Apply: { class : "btn-primary",
- click: function() {
- for (var key in to_delete) {
- delete options.attachments[key];
- }
- options.callback(options.attachments);
- }
- },
- Cancel: {}
- },
- notebook: options.notebook,
- keyboard_manager: options.keyboard_manager,
- });
- };
- var insert_image = function (options) {
- var message =
- i18n.msg._("Select a file to insert.");
- var file_input = $('<input/>')
- .attr('type', 'file')
- .attr('accept', 'image/*')
- .attr('name', 'file')
- .on('change', function(file) {
- var $btn = $(modal_obj).find('#btn_ok');
- if (this.files.length > 0) {
- $btn.removeClass('disabled');
- } else {
- $btn.addClass('disabled');
- }
- });
- var dialogform = $('<div/>').attr('title', i18n.msg._('Edit attachments'))
- .append(
- $('<form id="insert-image-form" />').append(
- $('<fieldset/>').append(
- $('<label/>')
- .attr('for','file')
- .text(message)
- )
- .append($('<br/>'))
- .append(file_input)
- )
- );
- var modal_obj = modal({
- title: i18n.msg._("Select a file"),
- body: dialogform,
- buttons: {
- OK: {
- id : 'btn_ok',
- class : "btn-primary disabled",
- click: function() {
- options.callback(file_input[0].files[0]);
- }
- },
- Cancel: {}
- },
- notebook: options.notebook,
- keyboard_manager: options.keyboard_manager,
- });
- };
-
- var dialog = {
- modal : modal,
- kernel_modal : kernel_modal,
- edit_metadata : edit_metadata,
- edit_attachments : edit_attachments,
- insert_image : insert_image
- };
- return dialog;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/mathjaxutils',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/dialog',
- ], function($, utils, i18n, dialog) {
- "use strict";
- var init = function () {
- if (window.MathJax) {
- // MathJax loaded
- MathJax.Hub.Config({
- tex2jax: {
- inlineMath: [ ['$','$'], ["\\(","\\)"] ],
- displayMath: [ ['$$','$$'], ["\\[","\\]"] ],
- processEscapes: true,
- processEnvironments: true
- },
- TeX: {
- extensions: ['newcommand.js', 'begingroup.js'] // For \gdef
- },
- MathML: {
- extensions: ['content-mathml.js']
- },
- // Center justify equations in code and markdown cells. Elsewhere
- // we use CSS to left justify single line equations in code cells.
- displayAlign: 'center',
- "HTML-CSS": {
- availableFonts: [],
- imageFont: null,
- preferredFont: null,
- webFont: "STIX-Web",
- styles: {'.MathJax_Display': {"margin": 0}},
- linebreaks: { automatic: true }
- },
- });
- MathJax.Hub.Configured();
- } else if (window.mathjax_url !== "") {
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [ i18n.msg._("OK") ];
- // Don't have MathJax, but should. Show dialog.
- dialog.modal({
- title : i18n.msg.sprintf(i18n.msg._("Failed to retrieve MathJax from '%s'",window.mathjax_url)),
- body : $("<p/>").addClass('dialog').text(
- i18n.msg._("Math/LaTeX rendering will be disabled.")
- ),
- buttons : {
- OK : {class: "btn-danger"}
- }
- });
- }
- };
- // Some magic for deferring mathematical expressions to MathJax
- // by hiding them from the Markdown parser.
- // Some of the code here is adapted with permission from Davide Cervone
- // under the terms of the Apache2 license governing the MathJax project.
- // Other minor modifications are also due to StackExchange and are used with
- // permission.
- // MATHSPLIT contains the pattern for math delimiters and special symbols
- // needed for searching for math in the text input.
- var MATHSPLIT = /(\$\$?|\\(?:begin|end)\{[a-z]*\*?\}|\\[{}$]|[{}]|(?:\n\s*)+|@@\d+@@|\\\\(?:\(|\)|\[|\]))/i;
- // The math is in blocks i through j, so
- // collect it into one block and clear the others.
- // Replace &, <, and > by named entities.
- // For IE, put <br> at the ends of comments since IE removes \n.
- // Clear the current math positions and store the index of the
- // math, then push the math string onto the storage array.
- // The preProcess function is called on all blocks if it has been passed in
- var process_math = function (i, j, pre_process, math, blocks) {
- var block = blocks.slice(i, j + 1).join("").replace(/&/g, "&") // use HTML entity for &
- .replace(/</g, "<") // use HTML entity for <
- .replace(/>/g, ">") // use HTML entity for >
- ;
- if (utils.browser === 'msie') {
- block = block.replace(/(%[^\n]*)\n/g, "$1<br/>\n");
- }
- while (j > i) {
- blocks[j] = "";
- j--;
- }
- blocks[i] = "@@" + math.length + "@@"; // replace the current block text with a unique tag to find later
- if (pre_process){
- block = pre_process(block);
- }
- math.push(block);
- return blocks;
- };
- // Break up the text into its component parts and search
- // through them for math delimiters, braces, linebreaks, etc.
- // Math delimiters must match and braces must balance.
- // Don't allow math to pass through a double linebreak
- // (which will be a paragraph).
- //
- var remove_math = function (text) {
- var math = []; // stores math strings for later
- var start;
- var end;
- var last;
- var braces;
- // Except for extreme edge cases, this should catch precisely those pieces of the markdown
- // source that will later be turned into code spans. While MathJax will not TeXify code spans,
- // we still have to consider them at this point; the following issue has happened several times:
- //
- // `$foo` and `$bar` are varibales. --> <code>$foo ` and `$bar</code> are variables.
- var hasCodeSpans = /`/.test(text),
- de_tilde;
- if (hasCodeSpans) {
- var tilde = function (wholematch) {
- return wholematch.replace(/\$/g, "~D");
- }
- text = text.replace(/~/g, "~T")
- .replace(/(^|[^\\])(`+)([^\n]*?[^`\n])\2(?!`)/gm, tilde)
- .replace(/^\s{0,3}(`{3,})(.|\n)*?\1/gm, tilde);
- de_tilde = function (text) {
- return text.replace(/~([TD])/g, function (wholematch, character) {
- return { T: "~", D: "$" }[character];
- });
- };
- } else {
- de_tilde = function (text) { return text; };
- }
- var blocks = utils.regex_split(text.replace(/\r\n?/g, "\n"),MATHSPLIT);
- for (var i = 1, m = blocks.length; i < m; i += 2) {
- var block = blocks[i];
- if (block.charAt(0) === "@") {
- //
- // Things that look like our math markers will get
- // stored and then retrieved along with the math.
- //
- blocks[i] = "@@" + math.length + "@@";
- math.push(block);
- }
- else if (start) {
- //
- // If we are in math, look for the end delimiter,
- // but don't go past double line breaks, and
- // and balance braces within the math.
- //
- if (block === end) {
- if (braces) {
- last = i;
- }
- else {
- blocks = process_math(start, i, de_tilde, math, blocks);
- start = null;
- end = null;
- last = null;
- }
- }
- else if (block.match(/\n.*\n/)) {
- if (last) {
- i = last;
- blocks = process_math(start, i, de_tilde, math, blocks);
- }
- start = null;
- end = null;
- last = null;
- braces = 0;
- }
- else if (block === "{") {
- braces++;
- }
- else if (block === "}" && braces) {
- braces--;
- }
- }
- else {
- //
- // Look for math start delimiters and when
- // found, set up the end delimiter.
- //
- if (block === "$" || block === "$$") {
- start = i;
- end = block;
- braces = 0;
- }
- else if (block === "\\\\\(" || block === "\\\\\[") {
- start = i;
- end = block.slice(-1) === "(" ? "\\\\\)" : "\\\\\]";
- braces = 0;
- }
- else if (block.substr(1, 5) === "begin") {
- start = i;
- end = "\\end" + block.substr(6);
- braces = 0;
- }
- }
- }
- if (last) {
- blocks = process_math(start, last, de_tilde, math, blocks);
- start = null;
- end = null;
- last = null;
- }
- return [de_tilde(blocks.join("")), math];
- };
- //
- // Put back the math strings that were saved,
- // and clear the math array (no need to keep it around).
- //
- var replace_math = function (text, math) {
- //
- // Replaces a math placeholder with its corresponding group.
- // The math delimiters "\\(", "\\[", "\\)" and "\\]" are replaced
- // removing one backslash in order to be interpreted correctly by MathJax.
- //
- var math_group_process = function (match, n) {
- var math_group = math[n];
- if (math_group.substr(0, 3) === "\\\\\(" && math_group.substr(math_group.length - 3) === "\\\\\)") {
- math_group = "\\\(" + math_group.substring(3, math_group.length - 3) + "\\\)";
- } else if (math_group.substr(0, 3) === "\\\\\[" && math_group.substr(math_group.length - 3) === "\\\\\]") {
- math_group = "\\\[" + math_group.substring(3, math_group.length - 3) + "\\\]";
- }
-
- return math_group;
- };
- // Replace all the math group placeholders in the text
- // with the saved strings.
- text = text.replace(/@@(\d+)@@/g, math_group_process);
-
- return text;
- };
- var mathjaxutils = {
- init : init,
- remove_math : remove_math,
- replace_math : replace_math
- };
- return mathjaxutils;
- });
- define('components/sanitizer/index',[],() => { return /******/ (() => { // webpackBootstrap
- /******/ var __webpack_modules__ = ({
- /***/ 8299:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(9122);
- module.exports = __webpack_require__(8544).RegExp.escape;
- /***/ }),
- /***/ 6819:
- /***/ ((module) => {
- module.exports = function (it) {
- if (typeof it != 'function') throw TypeError(it + ' is not a function!');
- return it;
- };
- /***/ }),
- /***/ 9855:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var cof = __webpack_require__(3679);
- module.exports = function (it, msg) {
- if (typeof it != 'number' && cof(it) != 'Number') throw TypeError(msg);
- return +it;
- };
- /***/ }),
- /***/ 4339:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.31 Array.prototype[@@unscopables]
- var UNSCOPABLES = __webpack_require__(3336)('unscopables');
- var ArrayProto = Array.prototype;
- if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(8012)(ArrayProto, UNSCOPABLES, {});
- module.exports = function (key) {
- ArrayProto[UNSCOPABLES][key] = true;
- };
- /***/ }),
- /***/ 1330:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var at = __webpack_require__(3593)(true);
- // `AdvanceStringIndex` abstract operation
- // https://tc39.github.io/ecma262/#sec-advancestringindex
- module.exports = function (S, index, unicode) {
- return index + (unicode ? at(S, index).length : 1);
- };
- /***/ }),
- /***/ 2702:
- /***/ ((module) => {
- module.exports = function (it, Constructor, name, forbiddenField) {
- if (!(it instanceof Constructor) || forbiddenField !== undefined && forbiddenField in it) {
- throw TypeError(name + ': incorrect invocation!');
- }
- return it;
- };
- /***/ }),
- /***/ 6154:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var isObject = __webpack_require__(7156);
- module.exports = function (it) {
- if (!isObject(it)) throw TypeError(it + ' is not an object!');
- return it;
- };
- /***/ }),
- /***/ 2147:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
- var toObject = __webpack_require__(2515);
- var toAbsoluteIndex = __webpack_require__(6241);
- var toLength = __webpack_require__(8315);
- module.exports = [].copyWithin || function copyWithin(target /* = 0 */, start /* = 0, end = @length */) {
- var O = toObject(this);
- var len = toLength(O.length);
- var to = toAbsoluteIndex(target, len);
- var from = toAbsoluteIndex(start, len);
- var end = arguments.length > 2 ? arguments[2] : undefined;
- var count = Math.min((end === undefined ? len : toAbsoluteIndex(end, len)) - from, len - to);
- var inc = 1;
- if (from < to && to < from + count) {
- inc = -1;
- from += count - 1;
- to += count - 1;
- }
- while (count-- > 0) {
- if (from in O) O[to] = O[from];else delete O[to];
- to += inc;
- from += inc;
- }
- return O;
- };
- /***/ }),
- /***/ 1132:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
- var toObject = __webpack_require__(2515);
- var toAbsoluteIndex = __webpack_require__(6241);
- var toLength = __webpack_require__(8315);
- module.exports = function fill(value /* , start = 0, end = @length */) {
- var O = toObject(this);
- var length = toLength(O.length);
- var aLen = arguments.length;
- var index = toAbsoluteIndex(aLen > 1 ? arguments[1] : undefined, length);
- var end = aLen > 2 ? arguments[2] : undefined;
- var endPos = end === undefined ? length : toAbsoluteIndex(end, length);
- while (endPos > index) O[index++] = value;
- return O;
- };
- /***/ }),
- /***/ 5273:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var forOf = __webpack_require__(2734);
- module.exports = function (iter, ITERATOR) {
- var result = [];
- forOf(iter, false, result.push, result, ITERATOR);
- return result;
- };
- /***/ }),
- /***/ 4687:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // false -> Array#indexOf
- // true -> Array#includes
- var toIObject = __webpack_require__(8499);
- var toLength = __webpack_require__(8315);
- var toAbsoluteIndex = __webpack_require__(6241);
- module.exports = function (IS_INCLUDES) {
- return function ($this, el, fromIndex) {
- var O = toIObject($this);
- var length = toLength(O.length);
- var index = toAbsoluteIndex(fromIndex, length);
- var value;
- // Array#includes uses SameValueZero equality algorithm
- // eslint-disable-next-line no-self-compare
- if (IS_INCLUDES && el != el) while (length > index) {
- value = O[index++];
- // eslint-disable-next-line no-self-compare
- if (value != value) return true;
- // Array#indexOf ignores holes, Array#includes - not
- } else for (; length > index; index++) if (IS_INCLUDES || index in O) {
- if (O[index] === el) return IS_INCLUDES || index || 0;
- }
- return !IS_INCLUDES && -1;
- };
- };
- /***/ }),
- /***/ 3970:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 0 -> Array#forEach
- // 1 -> Array#map
- // 2 -> Array#filter
- // 3 -> Array#some
- // 4 -> Array#every
- // 5 -> Array#find
- // 6 -> Array#findIndex
- var ctx = __webpack_require__(566);
- var IObject = __webpack_require__(331);
- var toObject = __webpack_require__(2515);
- var toLength = __webpack_require__(8315);
- var asc = __webpack_require__(5486);
- module.exports = function (TYPE, $create) {
- var IS_MAP = TYPE == 1;
- var IS_FILTER = TYPE == 2;
- var IS_SOME = TYPE == 3;
- var IS_EVERY = TYPE == 4;
- var IS_FIND_INDEX = TYPE == 6;
- var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;
- var create = $create || asc;
- return function ($this, callbackfn, that) {
- var O = toObject($this);
- var self = IObject(O);
- var f = ctx(callbackfn, that, 3);
- var length = toLength(self.length);
- var index = 0;
- var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;
- var val, res;
- for (; length > index; index++) if (NO_HOLES || index in self) {
- val = self[index];
- res = f(val, index, O);
- if (TYPE) {
- if (IS_MAP) result[index] = res; // map
- else if (res) switch (TYPE) {
- case 3:
- return true;
- // some
- case 5:
- return val;
- // find
- case 6:
- return index;
- // findIndex
- case 2:
- result.push(val);
- // filter
- } else if (IS_EVERY) return false; // every
- }
- }
- return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;
- };
- };
- /***/ }),
- /***/ 6419:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var aFunction = __webpack_require__(6819);
- var toObject = __webpack_require__(2515);
- var IObject = __webpack_require__(331);
- var toLength = __webpack_require__(8315);
- module.exports = function (that, callbackfn, aLen, memo, isRight) {
- aFunction(callbackfn);
- var O = toObject(that);
- var self = IObject(O);
- var length = toLength(O.length);
- var index = isRight ? length - 1 : 0;
- var i = isRight ? -1 : 1;
- if (aLen < 2) for (;;) {
- if (index in self) {
- memo = self[index];
- index += i;
- break;
- }
- index += i;
- if (isRight ? index < 0 : length <= index) {
- throw TypeError('Reduce of empty array with no initial value');
- }
- }
- for (; isRight ? index >= 0 : length > index; index += i) if (index in self) {
- memo = callbackfn(memo, self[index], index, O);
- }
- return memo;
- };
- /***/ }),
- /***/ 2642:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var isObject = __webpack_require__(7156);
- var isArray = __webpack_require__(1320);
- var SPECIES = __webpack_require__(3336)('species');
- module.exports = function (original) {
- var C;
- if (isArray(original)) {
- C = original.constructor;
- // cross-realm fallback
- if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
- if (isObject(C)) {
- C = C[SPECIES];
- if (C === null) C = undefined;
- }
- }
- return C === undefined ? Array : C;
- };
- /***/ }),
- /***/ 5486:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 9.4.2.3 ArraySpeciesCreate(originalArray, length)
- var speciesConstructor = __webpack_require__(2642);
- module.exports = function (original, length) {
- return new (speciesConstructor(original))(length);
- };
- /***/ }),
- /***/ 8327:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var aFunction = __webpack_require__(6819);
- var isObject = __webpack_require__(7156);
- var invoke = __webpack_require__(2765);
- var arraySlice = [].slice;
- var factories = {};
- var construct = function construct(F, len, args) {
- if (!(len in factories)) {
- for (var n = [], i = 0; i < len; i++) n[i] = 'a[' + i + ']';
- // eslint-disable-next-line no-new-func
- factories[len] = Function('F,a', 'return new F(' + n.join(',') + ')');
- }
- return factories[len](F, args);
- };
- module.exports = Function.bind || function bind(that /* , ...args */) {
- var fn = aFunction(this);
- var partArgs = arraySlice.call(arguments, 1);
- var bound = function bound( /* args... */
- ) {
- var args = partArgs.concat(arraySlice.call(arguments));
- return this instanceof bound ? construct(fn, args.length, args) : invoke(fn, args, that);
- };
- if (isObject(fn.prototype)) bound.prototype = fn.prototype;
- return bound;
- };
- /***/ }),
- /***/ 2858:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // getting tag from 19.1.3.6 Object.prototype.toString()
- var cof = __webpack_require__(3679);
- var TAG = __webpack_require__(3336)('toStringTag');
- // ES3 wrong here
- var ARG = cof(function () {
- return arguments;
- }()) == 'Arguments';
- // fallback for IE11 Script Access Denied error
- var tryGet = function tryGet(it, key) {
- try {
- return it[key];
- } catch (e) {/* empty */}
- };
- module.exports = function (it) {
- var O, T, B;
- return it === undefined ? 'Undefined' : it === null ? 'Null'
- // @@toStringTag case
- : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
- // builtinTag case
- : ARG ? cof(O)
- // ES3 arguments fallback
- : (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
- };
- /***/ }),
- /***/ 3679:
- /***/ ((module) => {
- var toString = {}.toString;
- module.exports = function (it) {
- return toString.call(it).slice(8, -1);
- };
- /***/ }),
- /***/ 4396:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var dP = (__webpack_require__(4835).f);
- var create = __webpack_require__(4275);
- var redefineAll = __webpack_require__(7228);
- var ctx = __webpack_require__(566);
- var anInstance = __webpack_require__(2702);
- var forOf = __webpack_require__(2734);
- var $iterDefine = __webpack_require__(4873);
- var step = __webpack_require__(7218);
- var setSpecies = __webpack_require__(4798);
- var DESCRIPTORS = __webpack_require__(4926);
- var fastKey = (__webpack_require__(3763).fastKey);
- var validate = __webpack_require__(8546);
- var SIZE = DESCRIPTORS ? '_s' : 'size';
- var getEntry = function getEntry(that, key) {
- // fast case
- var index = fastKey(key);
- var entry;
- if (index !== 'F') return that._i[index];
- // frozen object case
- for (entry = that._f; entry; entry = entry.n) {
- if (entry.k == key) return entry;
- }
- };
- module.exports = {
- getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- anInstance(that, C, NAME, '_i');
- that._t = NAME; // collection type
- that._i = create(null); // index
- that._f = undefined; // first entry
- that._l = undefined; // last entry
- that[SIZE] = 0; // size
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- });
- redefineAll(C.prototype, {
- // 23.1.3.1 Map.prototype.clear()
- // 23.2.3.2 Set.prototype.clear()
- clear: function clear() {
- for (var that = validate(this, NAME), data = that._i, entry = that._f; entry; entry = entry.n) {
- entry.r = true;
- if (entry.p) entry.p = entry.p.n = undefined;
- delete data[entry.i];
- }
- that._f = that._l = undefined;
- that[SIZE] = 0;
- },
- // 23.1.3.3 Map.prototype.delete(key)
- // 23.2.3.4 Set.prototype.delete(value)
- 'delete': function _delete(key) {
- var that = validate(this, NAME);
- var entry = getEntry(that, key);
- if (entry) {
- var next = entry.n;
- var prev = entry.p;
- delete that._i[entry.i];
- entry.r = true;
- if (prev) prev.n = next;
- if (next) next.p = prev;
- if (that._f == entry) that._f = next;
- if (that._l == entry) that._l = prev;
- that[SIZE]--;
- }
- return !!entry;
- },
- // 23.2.3.6 Set.prototype.forEach(callbackfn, thisArg = undefined)
- // 23.1.3.5 Map.prototype.forEach(callbackfn, thisArg = undefined)
- forEach: function forEach(callbackfn /* , that = undefined */) {
- validate(this, NAME);
- var f = ctx(callbackfn, arguments.length > 1 ? arguments[1] : undefined, 3);
- var entry;
- while (entry = entry ? entry.n : this._f) {
- f(entry.v, entry.k, this);
- // revert to the last existing entry
- while (entry && entry.r) entry = entry.p;
- }
- },
- // 23.1.3.7 Map.prototype.has(key)
- // 23.2.3.7 Set.prototype.has(value)
- has: function has(key) {
- return !!getEntry(validate(this, NAME), key);
- }
- });
- if (DESCRIPTORS) dP(C.prototype, 'size', {
- get: function get() {
- return validate(this, NAME)[SIZE];
- }
- });
- return C;
- },
- def: function def(that, key, value) {
- var entry = getEntry(that, key);
- var prev, index;
- // change existing entry
- if (entry) {
- entry.v = value;
- // create new entry
- } else {
- that._l = entry = {
- i: index = fastKey(key, true),
- // <- index
- k: key,
- // <- key
- v: value,
- // <- value
- p: prev = that._l,
- // <- previous entry
- n: undefined,
- // <- next entry
- r: false // <- removed
- };
- if (!that._f) that._f = entry;
- if (prev) prev.n = entry;
- that[SIZE]++;
- // add to index
- if (index !== 'F') that._i[index] = entry;
- }
- return that;
- },
- getEntry: getEntry,
- setStrong: function setStrong(C, NAME, IS_MAP) {
- // add .keys, .values, .entries, [@@iterator]
- // 23.1.3.4, 23.1.3.8, 23.1.3.11, 23.1.3.12, 23.2.3.5, 23.2.3.8, 23.2.3.10, 23.2.3.11
- $iterDefine(C, NAME, function (iterated, kind) {
- this._t = validate(iterated, NAME); // target
- this._k = kind; // kind
- this._l = undefined; // previous
- }, function () {
- var that = this;
- var kind = that._k;
- var entry = that._l;
- // revert to the last existing entry
- while (entry && entry.r) entry = entry.p;
- // get next entry
- if (!that._t || !(that._l = entry = entry ? entry.n : that._t._f)) {
- // or finish the iteration
- that._t = undefined;
- return step(1);
- }
- // return step by kind
- if (kind == 'keys') return step(0, entry.k);
- if (kind == 'values') return step(0, entry.v);
- return step(0, [entry.k, entry.v]);
- }, IS_MAP ? 'entries' : 'values', !IS_MAP, true);
- // add [@@species], 23.1.2.2, 23.2.2.2
- setSpecies(NAME);
- }
- };
- /***/ }),
- /***/ 1872:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var classof = __webpack_require__(2858);
- var from = __webpack_require__(5273);
- module.exports = function (NAME) {
- return function toJSON() {
- if (classof(this) != NAME) throw TypeError(NAME + "#toJSON isn't generic");
- return from(this);
- };
- };
- /***/ }),
- /***/ 4495:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var redefineAll = __webpack_require__(7228);
- var getWeak = (__webpack_require__(3763).getWeak);
- var anObject = __webpack_require__(6154);
- var isObject = __webpack_require__(7156);
- var anInstance = __webpack_require__(2702);
- var forOf = __webpack_require__(2734);
- var createArrayMethod = __webpack_require__(3970);
- var $has = __webpack_require__(5389);
- var validate = __webpack_require__(8546);
- var arrayFind = createArrayMethod(5);
- var arrayFindIndex = createArrayMethod(6);
- var id = 0;
- // fallback for uncaught frozen keys
- var uncaughtFrozenStore = function uncaughtFrozenStore(that) {
- return that._l || (that._l = new UncaughtFrozenStore());
- };
- var UncaughtFrozenStore = function UncaughtFrozenStore() {
- this.a = [];
- };
- var findUncaughtFrozen = function findUncaughtFrozen(store, key) {
- return arrayFind(store.a, function (it) {
- return it[0] === key;
- });
- };
- UncaughtFrozenStore.prototype = {
- get: function get(key) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) return entry[1];
- },
- has: function has(key) {
- return !!findUncaughtFrozen(this, key);
- },
- set: function set(key, value) {
- var entry = findUncaughtFrozen(this, key);
- if (entry) entry[1] = value;else this.a.push([key, value]);
- },
- 'delete': function _delete(key) {
- var index = arrayFindIndex(this.a, function (it) {
- return it[0] === key;
- });
- if (~index) this.a.splice(index, 1);
- return !!~index;
- }
- };
- module.exports = {
- getConstructor: function getConstructor(wrapper, NAME, IS_MAP, ADDER) {
- var C = wrapper(function (that, iterable) {
- anInstance(that, C, NAME, '_i');
- that._t = NAME; // collection type
- that._i = id++; // collection id
- that._l = undefined; // leak store for uncaught frozen objects
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- });
- redefineAll(C.prototype, {
- // 23.3.3.2 WeakMap.prototype.delete(key)
- // 23.4.3.3 WeakSet.prototype.delete(value)
- 'delete': function _delete(key) {
- if (!isObject(key)) return false;
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, NAME))['delete'](key);
- return data && $has(data, this._i) && delete data[this._i];
- },
- // 23.3.3.4 WeakMap.prototype.has(key)
- // 23.4.3.4 WeakSet.prototype.has(value)
- has: function has(key) {
- if (!isObject(key)) return false;
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, NAME)).has(key);
- return data && $has(data, this._i);
- }
- });
- return C;
- },
- def: function def(that, key, value) {
- var data = getWeak(anObject(key), true);
- if (data === true) uncaughtFrozenStore(that).set(key, value);else data[that._i] = value;
- return that;
- },
- ufstore: uncaughtFrozenStore
- };
- /***/ }),
- /***/ 1966:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var $export = __webpack_require__(5913);
- var redefine = __webpack_require__(7278);
- var redefineAll = __webpack_require__(7228);
- var meta = __webpack_require__(3763);
- var forOf = __webpack_require__(2734);
- var anInstance = __webpack_require__(2702);
- var isObject = __webpack_require__(7156);
- var fails = __webpack_require__(5810);
- var $iterDetect = __webpack_require__(5508);
- var setToStringTag = __webpack_require__(8094);
- var inheritIfRequired = __webpack_require__(3654);
- module.exports = function (NAME, wrapper, methods, common, IS_MAP, IS_WEAK) {
- var Base = global[NAME];
- var C = Base;
- var ADDER = IS_MAP ? 'set' : 'add';
- var proto = C && C.prototype;
- var O = {};
- var fixMethod = function fixMethod(KEY) {
- var fn = proto[KEY];
- redefine(proto, KEY, KEY == 'delete' ? function (a) {
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'has' ? function has(a) {
- return IS_WEAK && !isObject(a) ? false : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'get' ? function get(a) {
- return IS_WEAK && !isObject(a) ? undefined : fn.call(this, a === 0 ? 0 : a);
- } : KEY == 'add' ? function add(a) {
- fn.call(this, a === 0 ? 0 : a);
- return this;
- } : function set(a, b) {
- fn.call(this, a === 0 ? 0 : a, b);
- return this;
- });
- };
- if (typeof C != 'function' || !(IS_WEAK || proto.forEach && !fails(function () {
- new C().entries().next();
- }))) {
- // create collection constructor
- C = common.getConstructor(wrapper, NAME, IS_MAP, ADDER);
- redefineAll(C.prototype, methods);
- meta.NEED = true;
- } else {
- var instance = new C();
- // early implementations not supports chaining
- var HASNT_CHAINING = instance[ADDER](IS_WEAK ? {} : -0, 1) != instance;
- // V8 ~ Chromium 40- weak-collections throws on primitives, but should return false
- var THROWS_ON_PRIMITIVES = fails(function () {
- instance.has(1);
- });
- // most early implementations doesn't supports iterables, most modern - not close it correctly
- var ACCEPT_ITERABLES = $iterDetect(function (iter) {
- new C(iter);
- }); // eslint-disable-line no-new
- // for early implementations -0 and +0 not the same
- var BUGGY_ZERO = !IS_WEAK && fails(function () {
- // V8 ~ Chromium 42- fails only with 5+ elements
- var $instance = new C();
- var index = 5;
- while (index--) $instance[ADDER](index, index);
- return !$instance.has(-0);
- });
- if (!ACCEPT_ITERABLES) {
- C = wrapper(function (target, iterable) {
- anInstance(target, C, NAME);
- var that = inheritIfRequired(new Base(), target, C);
- if (iterable != undefined) forOf(iterable, IS_MAP, that[ADDER], that);
- return that;
- });
- C.prototype = proto;
- proto.constructor = C;
- }
- if (THROWS_ON_PRIMITIVES || BUGGY_ZERO) {
- fixMethod('delete');
- fixMethod('has');
- IS_MAP && fixMethod('get');
- }
- if (BUGGY_ZERO || HASNT_CHAINING) fixMethod(ADDER);
- // weak collections should not contains .clear method
- if (IS_WEAK && proto.clear) delete proto.clear;
- }
- setToStringTag(C, NAME);
- O[NAME] = C;
- $export($export.G + $export.W + $export.F * (C != Base), O);
- if (!IS_WEAK) common.setStrong(C, NAME, IS_MAP);
- return C;
- };
- /***/ }),
- /***/ 8544:
- /***/ ((module) => {
- var core = module.exports = {
- version: '2.6.12'
- };
- if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
- /***/ }),
- /***/ 1348:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var $defineProperty = __webpack_require__(4835);
- var createDesc = __webpack_require__(6256);
- module.exports = function (object, index, value) {
- if (index in object) $defineProperty.f(object, index, createDesc(0, value));else object[index] = value;
- };
- /***/ }),
- /***/ 566:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // optional / simple context binding
- var aFunction = __webpack_require__(6819);
- module.exports = function (fn, that, length) {
- aFunction(fn);
- if (that === undefined) return fn;
- switch (length) {
- case 1:
- return function (a) {
- return fn.call(that, a);
- };
- case 2:
- return function (a, b) {
- return fn.call(that, a, b);
- };
- case 3:
- return function (a, b, c) {
- return fn.call(that, a, b, c);
- };
- }
- return function /* ...args */
- () {
- return fn.apply(that, arguments);
- };
- };
- /***/ }),
- /***/ 2115:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
- var fails = __webpack_require__(5810);
- var getTime = Date.prototype.getTime;
- var $toISOString = Date.prototype.toISOString;
- var lz = function lz(num) {
- return num > 9 ? num : '0' + num;
- };
- // PhantomJS / old WebKit has a broken implementations
- module.exports = fails(function () {
- return $toISOString.call(new Date(-5e13 - 1)) != '0385-07-25T07:06:39.999Z';
- }) || !fails(function () {
- $toISOString.call(new Date(NaN));
- }) ? function toISOString() {
- if (!isFinite(getTime.call(this))) throw RangeError('Invalid time value');
- var d = this;
- var y = d.getUTCFullYear();
- var m = d.getUTCMilliseconds();
- var s = y < 0 ? '-' : y > 9999 ? '+' : '';
- return s + ('00000' + Math.abs(y)).slice(s ? -6 : -4) + '-' + lz(d.getUTCMonth() + 1) + '-' + lz(d.getUTCDate()) + 'T' + lz(d.getUTCHours()) + ':' + lz(d.getUTCMinutes()) + ':' + lz(d.getUTCSeconds()) + '.' + (m > 99 ? m : '0' + lz(m)) + 'Z';
- } : $toISOString;
- /***/ }),
- /***/ 296:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var anObject = __webpack_require__(6154);
- var toPrimitive = __webpack_require__(8537);
- var NUMBER = 'number';
- module.exports = function (hint) {
- if (hint !== 'string' && hint !== NUMBER && hint !== 'default') throw TypeError('Incorrect hint');
- return toPrimitive(anObject(this), hint != NUMBER);
- };
- /***/ }),
- /***/ 408:
- /***/ ((module) => {
- // 7.2.1 RequireObjectCoercible(argument)
- module.exports = function (it) {
- if (it == undefined) throw TypeError("Can't call method on " + it);
- return it;
- };
- /***/ }),
- /***/ 4926:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // Thank's IE8 for his funny defineProperty
- module.exports = !__webpack_require__(5810)(function () {
- return Object.defineProperty({}, 'a', {
- get: function get() {
- return 7;
- }
- }).a != 7;
- });
- /***/ }),
- /***/ 2241:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var isObject = __webpack_require__(7156);
- var document = (__webpack_require__(7381).document);
- // typeof document.createElement is 'object' in old IE
- var is = isObject(document) && isObject(document.createElement);
- module.exports = function (it) {
- return is ? document.createElement(it) : {};
- };
- /***/ }),
- /***/ 6921:
- /***/ ((module) => {
- // IE 8- don't enum bug keys
- module.exports = 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'.split(',');
- /***/ }),
- /***/ 8727:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // all enumerable object keys, includes symbols
- var getKeys = __webpack_require__(9924);
- var gOPS = __webpack_require__(5421);
- var pIE = __webpack_require__(4616);
- module.exports = function (it) {
- var result = getKeys(it);
- var getSymbols = gOPS.f;
- if (getSymbols) {
- var symbols = getSymbols(it);
- var isEnum = pIE.f;
- var i = 0;
- var key;
- while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
- }
- return result;
- };
- /***/ }),
- /***/ 5913:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var core = __webpack_require__(8544);
- var hide = __webpack_require__(8012);
- var redefine = __webpack_require__(7278);
- var ctx = __webpack_require__(566);
- var PROTOTYPE = 'prototype';
- var $export = function $export(type, name, source) {
- var IS_FORCED = type & $export.F;
- var IS_GLOBAL = type & $export.G;
- var IS_STATIC = type & $export.S;
- var IS_PROTO = type & $export.P;
- var IS_BIND = type & $export.B;
- var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
- var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
- var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
- var key, own, out, exp;
- if (IS_GLOBAL) source = name;
- for (key in source) {
- // contains in native
- own = !IS_FORCED && target && target[key] !== undefined;
- // export native or passed
- out = (own ? target : source)[key];
- // bind timers to global for call from export context
- exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
- // extend global
- if (target) redefine(target, key, out, type & $export.U);
- // export
- if (exports[key] != out) hide(exports, key, exp);
- if (IS_PROTO && expProto[key] != out) expProto[key] = out;
- }
- };
- global.core = core;
- // type bitmap
- $export.F = 1; // forced
- $export.G = 2; // global
- $export.S = 4; // static
- $export.P = 8; // proto
- $export.B = 16; // bind
- $export.W = 32; // wrap
- $export.U = 64; // safe
- $export.R = 128; // real proto method for `library`
- module.exports = $export;
- /***/ }),
- /***/ 3483:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var MATCH = __webpack_require__(3336)('match');
- module.exports = function (KEY) {
- var re = /./;
- try {
- '/./'[KEY](re);
- } catch (e) {
- try {
- re[MATCH] = false;
- return !'/./'[KEY](re);
- } catch (f) {/* empty */}
- }
- return true;
- };
- /***/ }),
- /***/ 5810:
- /***/ ((module) => {
- module.exports = function (exec) {
- try {
- return !!exec();
- } catch (e) {
- return true;
- }
- };
- /***/ }),
- /***/ 8644:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(5997);
- var redefine = __webpack_require__(7278);
- var hide = __webpack_require__(8012);
- var fails = __webpack_require__(5810);
- var defined = __webpack_require__(408);
- var wks = __webpack_require__(3336);
- var regexpExec = __webpack_require__(6997);
- var SPECIES = wks('species');
- var REPLACE_SUPPORTS_NAMED_GROUPS = !fails(function () {
- // #replace needs built-in support for named groups.
- // #match works fine because it just return the exec results, even if it has
- // a "grops" property.
- var re = /./;
- re.exec = function () {
- var result = [];
- result.groups = {
- a: '7'
- };
- return result;
- };
- return ''.replace(re, '$<a>') !== '7';
- });
- var SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = function () {
- // Chrome 51 has a buggy "split" implementation when RegExp#exec !== nativeExec
- var re = /(?:)/;
- var originalExec = re.exec;
- re.exec = function () {
- return originalExec.apply(this, arguments);
- };
- var result = 'ab'.split(re);
- return result.length === 2 && result[0] === 'a' && result[1] === 'b';
- }();
- module.exports = function (KEY, length, exec) {
- var SYMBOL = wks(KEY);
- var DELEGATES_TO_SYMBOL = !fails(function () {
- // String methods call symbol-named RegEp methods
- var O = {};
- O[SYMBOL] = function () {
- return 7;
- };
- return ''[KEY](O) != 7;
- });
- var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !fails(function () {
- // Symbol-named RegExp methods call .exec
- var execCalled = false;
- var re = /a/;
- re.exec = function () {
- execCalled = true;
- return null;
- };
- if (KEY === 'split') {
- // RegExp[@@split] doesn't call the regex's exec method, but first creates
- // a new one. We need to return the patched regex when creating the new one.
- re.constructor = {};
- re.constructor[SPECIES] = function () {
- return re;
- };
- }
- re[SYMBOL]('');
- return !execCalled;
- }) : undefined;
- if (!DELEGATES_TO_SYMBOL || !DELEGATES_TO_EXEC || KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS || KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC) {
- var nativeRegExpMethod = /./[SYMBOL];
- var fns = exec(defined, SYMBOL, ''[KEY], function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {
- if (regexp.exec === regexpExec) {
- if (DELEGATES_TO_SYMBOL && !forceStringMethod) {
- // The native String method already delegates to @@method (this
- // polyfilled function), leasing to infinite recursion.
- // We avoid it by directly calling the native @@method method.
- return {
- done: true,
- value: nativeRegExpMethod.call(regexp, str, arg2)
- };
- }
- return {
- done: true,
- value: nativeMethod.call(str, regexp, arg2)
- };
- }
- return {
- done: false
- };
- });
- var strfn = fns[0];
- var rxfn = fns[1];
- redefine(String.prototype, KEY, strfn);
- hide(RegExp.prototype, SYMBOL, length == 2
- // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)
- // 21.2.5.11 RegExp.prototype[@@split](string, limit)
- ? function (string, arg) {
- return rxfn.call(string, this, arg);
- }
- // 21.2.5.6 RegExp.prototype[@@match](string)
- // 21.2.5.9 RegExp.prototype[@@search](string)
- : function (string) {
- return rxfn.call(string, this);
- });
- }
- };
- /***/ }),
- /***/ 2188:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 21.2.5.3 get RegExp.prototype.flags
- var anObject = __webpack_require__(6154);
- module.exports = function () {
- var that = anObject(this);
- var result = '';
- if (that.global) result += 'g';
- if (that.ignoreCase) result += 'i';
- if (that.multiline) result += 'm';
- if (that.unicode) result += 'u';
- if (that.sticky) result += 'y';
- return result;
- };
- /***/ }),
- /***/ 3120:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-flatMap/#sec-FlattenIntoArray
- var isArray = __webpack_require__(1320);
- var isObject = __webpack_require__(7156);
- var toLength = __webpack_require__(8315);
- var ctx = __webpack_require__(566);
- var IS_CONCAT_SPREADABLE = __webpack_require__(3336)('isConcatSpreadable');
- function flattenIntoArray(target, original, source, sourceLen, start, depth, mapper, thisArg) {
- var targetIndex = start;
- var sourceIndex = 0;
- var mapFn = mapper ? ctx(mapper, thisArg, 3) : false;
- var element, spreadable;
- while (sourceIndex < sourceLen) {
- if (sourceIndex in source) {
- element = mapFn ? mapFn(source[sourceIndex], sourceIndex, original) : source[sourceIndex];
- spreadable = false;
- if (isObject(element)) {
- spreadable = element[IS_CONCAT_SPREADABLE];
- spreadable = spreadable !== undefined ? !!spreadable : isArray(element);
- }
- if (spreadable && depth > 0) {
- targetIndex = flattenIntoArray(target, original, element, toLength(element.length), targetIndex, depth - 1) - 1;
- } else {
- if (targetIndex >= 0x1fffffffffffff) throw TypeError();
- target[targetIndex] = element;
- }
- targetIndex++;
- }
- sourceIndex++;
- }
- return targetIndex;
- }
- module.exports = flattenIntoArray;
- /***/ }),
- /***/ 2734:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var ctx = __webpack_require__(566);
- var call = __webpack_require__(2471);
- var isArrayIter = __webpack_require__(7063);
- var anObject = __webpack_require__(6154);
- var toLength = __webpack_require__(8315);
- var getIterFn = __webpack_require__(7637);
- var BREAK = {};
- var RETURN = {};
- var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
- var iterFn = ITERATOR ? function () {
- return iterable;
- } : getIterFn(iterable);
- var f = ctx(fn, that, entries ? 2 : 1);
- var index = 0;
- var length, step, iterator, result;
- if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
- // fast case for arrays with default iterator
- if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
- result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
- if (result === BREAK || result === RETURN) return result;
- } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
- result = call(iterator, f, step.value, entries);
- if (result === BREAK || result === RETURN) return result;
- }
- };
- exports.BREAK = BREAK;
- exports.RETURN = RETURN;
- /***/ }),
- /***/ 1174:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- module.exports = __webpack_require__(3192)('native-function-to-string', Function.toString);
- /***/ }),
- /***/ 7381:
- /***/ ((module) => {
- // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
- var global = module.exports = typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self
- // eslint-disable-next-line no-new-func
- : Function('return this')();
- if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
- /***/ }),
- /***/ 5389:
- /***/ ((module) => {
- var hasOwnProperty = {}.hasOwnProperty;
- module.exports = function (it, key) {
- return hasOwnProperty.call(it, key);
- };
- /***/ }),
- /***/ 8012:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var dP = __webpack_require__(4835);
- var createDesc = __webpack_require__(6256);
- module.exports = __webpack_require__(4926) ? function (object, key, value) {
- return dP.f(object, key, createDesc(1, value));
- } : function (object, key, value) {
- object[key] = value;
- return object;
- };
- /***/ }),
- /***/ 1225:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var document = (__webpack_require__(7381).document);
- module.exports = document && document.documentElement;
- /***/ }),
- /***/ 5142:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- module.exports = !__webpack_require__(4926) && !__webpack_require__(5810)(function () {
- return Object.defineProperty(__webpack_require__(2241)('div'), 'a', {
- get: function get() {
- return 7;
- }
- }).a != 7;
- });
- /***/ }),
- /***/ 3654:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var isObject = __webpack_require__(7156);
- var setPrototypeOf = (__webpack_require__(6931).set);
- module.exports = function (that, target, C) {
- var S = target.constructor;
- var P;
- if (S !== C && typeof S == 'function' && (P = S.prototype) !== C.prototype && isObject(P) && setPrototypeOf) {
- setPrototypeOf(that, P);
- }
- return that;
- };
- /***/ }),
- /***/ 2765:
- /***/ ((module) => {
- // fast apply, http://jsperf.lnkit.com/fast-apply/5
- module.exports = function (fn, args, that) {
- var un = that === undefined;
- switch (args.length) {
- case 0:
- return un ? fn() : fn.call(that);
- case 1:
- return un ? fn(args[0]) : fn.call(that, args[0]);
- case 2:
- return un ? fn(args[0], args[1]) : fn.call(that, args[0], args[1]);
- case 3:
- return un ? fn(args[0], args[1], args[2]) : fn.call(that, args[0], args[1], args[2]);
- case 4:
- return un ? fn(args[0], args[1], args[2], args[3]) : fn.call(that, args[0], args[1], args[2], args[3]);
- }
- return fn.apply(that, args);
- };
- /***/ }),
- /***/ 331:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // fallback for non-array-like ES3 and non-enumerable old V8 strings
- var cof = __webpack_require__(3679);
- // eslint-disable-next-line no-prototype-builtins
- module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
- return cof(it) == 'String' ? it.split('') : Object(it);
- };
- /***/ }),
- /***/ 7063:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // check on default Array iterator
- var Iterators = __webpack_require__(5301);
- var ITERATOR = __webpack_require__(3336)('iterator');
- var ArrayProto = Array.prototype;
- module.exports = function (it) {
- return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
- };
- /***/ }),
- /***/ 1320:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 7.2.2 IsArray(argument)
- var cof = __webpack_require__(3679);
- module.exports = Array.isArray || function isArray(arg) {
- return cof(arg) == 'Array';
- };
- /***/ }),
- /***/ 5127:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.3 Number.isInteger(number)
- var isObject = __webpack_require__(7156);
- var floor = Math.floor;
- module.exports = function isInteger(it) {
- return !isObject(it) && isFinite(it) && floor(it) === it;
- };
- /***/ }),
- /***/ 7156:
- /***/ ((module) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- module.exports = function (it) {
- return _typeof(it) === 'object' ? it !== null : typeof it === 'function';
- };
- /***/ }),
- /***/ 1993:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 7.2.8 IsRegExp(argument)
- var isObject = __webpack_require__(7156);
- var cof = __webpack_require__(3679);
- var MATCH = __webpack_require__(3336)('match');
- module.exports = function (it) {
- var isRegExp;
- return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
- };
- /***/ }),
- /***/ 2471:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // call something on iterator step with safe closing on error
- var anObject = __webpack_require__(6154);
- module.exports = function (iterator, fn, value, entries) {
- try {
- return entries ? fn(anObject(value)[0], value[1]) : fn(value);
- // 7.4.6 IteratorClose(iterator, completion)
- } catch (e) {
- var ret = iterator['return'];
- if (ret !== undefined) anObject(ret.call(iterator));
- throw e;
- }
- };
- /***/ }),
- /***/ 8258:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var create = __webpack_require__(4275);
- var descriptor = __webpack_require__(6256);
- var setToStringTag = __webpack_require__(8094);
- var IteratorPrototype = {};
- // 25.1.2.1.1 %IteratorPrototype%[@@iterator]()
- __webpack_require__(8012)(IteratorPrototype, __webpack_require__(3336)('iterator'), function () {
- return this;
- });
- module.exports = function (Constructor, NAME, next) {
- Constructor.prototype = create(IteratorPrototype, {
- next: descriptor(1, next)
- });
- setToStringTag(Constructor, NAME + ' Iterator');
- };
- /***/ }),
- /***/ 4873:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var LIBRARY = __webpack_require__(4219);
- var $export = __webpack_require__(5913);
- var redefine = __webpack_require__(7278);
- var hide = __webpack_require__(8012);
- var Iterators = __webpack_require__(5301);
- var $iterCreate = __webpack_require__(8258);
- var setToStringTag = __webpack_require__(8094);
- var getPrototypeOf = __webpack_require__(4153);
- var ITERATOR = __webpack_require__(3336)('iterator');
- var BUGGY = !([].keys && 'next' in [].keys()); // Safari has buggy iterators w/o `next`
- var FF_ITERATOR = '@@iterator';
- var KEYS = 'keys';
- var VALUES = 'values';
- var returnThis = function returnThis() {
- return this;
- };
- module.exports = function (Base, NAME, Constructor, next, DEFAULT, IS_SET, FORCED) {
- $iterCreate(Constructor, NAME, next);
- var getMethod = function getMethod(kind) {
- if (!BUGGY && kind in proto) return proto[kind];
- switch (kind) {
- case KEYS:
- return function keys() {
- return new Constructor(this, kind);
- };
- case VALUES:
- return function values() {
- return new Constructor(this, kind);
- };
- }
- return function entries() {
- return new Constructor(this, kind);
- };
- };
- var TAG = NAME + ' Iterator';
- var DEF_VALUES = DEFAULT == VALUES;
- var VALUES_BUG = false;
- var proto = Base.prototype;
- var $native = proto[ITERATOR] || proto[FF_ITERATOR] || DEFAULT && proto[DEFAULT];
- var $default = $native || getMethod(DEFAULT);
- var $entries = DEFAULT ? !DEF_VALUES ? $default : getMethod('entries') : undefined;
- var $anyNative = NAME == 'Array' ? proto.entries || $native : $native;
- var methods, key, IteratorPrototype;
- // Fix native
- if ($anyNative) {
- IteratorPrototype = getPrototypeOf($anyNative.call(new Base()));
- if (IteratorPrototype !== Object.prototype && IteratorPrototype.next) {
- // Set @@toStringTag to native iterators
- setToStringTag(IteratorPrototype, TAG, true);
- // fix for some old engines
- if (!LIBRARY && typeof IteratorPrototype[ITERATOR] != 'function') hide(IteratorPrototype, ITERATOR, returnThis);
- }
- }
- // fix Array#{values, @@iterator}.name in V8 / FF
- if (DEF_VALUES && $native && $native.name !== VALUES) {
- VALUES_BUG = true;
- $default = function values() {
- return $native.call(this);
- };
- }
- // Define iterator
- if ((!LIBRARY || FORCED) && (BUGGY || VALUES_BUG || !proto[ITERATOR])) {
- hide(proto, ITERATOR, $default);
- }
- // Plug for library
- Iterators[NAME] = $default;
- Iterators[TAG] = returnThis;
- if (DEFAULT) {
- methods = {
- values: DEF_VALUES ? $default : getMethod(VALUES),
- keys: IS_SET ? $default : getMethod(KEYS),
- entries: $entries
- };
- if (FORCED) for (key in methods) {
- if (!(key in proto)) redefine(proto, key, methods[key]);
- } else $export($export.P + $export.F * (BUGGY || VALUES_BUG), NAME, methods);
- }
- return methods;
- };
- /***/ }),
- /***/ 5508:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var ITERATOR = __webpack_require__(3336)('iterator');
- var SAFE_CLOSING = false;
- try {
- var riter = [7][ITERATOR]();
- riter['return'] = function () {
- SAFE_CLOSING = true;
- };
- // eslint-disable-next-line no-throw-literal
- Array.from(riter, function () {
- throw 2;
- });
- } catch (e) {/* empty */}
- module.exports = function (exec, skipClosing) {
- if (!skipClosing && !SAFE_CLOSING) return false;
- var safe = false;
- try {
- var arr = [7];
- var iter = arr[ITERATOR]();
- iter.next = function () {
- return {
- done: safe = true
- };
- };
- arr[ITERATOR] = function () {
- return iter;
- };
- exec(arr);
- } catch (e) {/* empty */}
- return safe;
- };
- /***/ }),
- /***/ 7218:
- /***/ ((module) => {
- module.exports = function (done, value) {
- return {
- value: value,
- done: !!done
- };
- };
- /***/ }),
- /***/ 5301:
- /***/ ((module) => {
- module.exports = {};
- /***/ }),
- /***/ 4219:
- /***/ ((module) => {
- module.exports = false;
- /***/ }),
- /***/ 4774:
- /***/ ((module) => {
- // 20.2.2.14 Math.expm1(x)
- var $expm1 = Math.expm1;
- module.exports = !$expm1
- // Old FF bug
- || $expm1(10) > 22025.465794806719 || $expm1(10) < 22025.4657948067165168
- // Tor Browser bug
- || $expm1(-2e-17) != -2e-17 ? function expm1(x) {
- return (x = +x) == 0 ? x : x > -1e-6 && x < 1e-6 ? x + x * x / 2 : Math.exp(x) - 1;
- } : $expm1;
- /***/ }),
- /***/ 3800:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.16 Math.fround(x)
- var sign = __webpack_require__(4012);
- var pow = Math.pow;
- var EPSILON = pow(2, -52);
- var EPSILON32 = pow(2, -23);
- var MAX32 = pow(2, 127) * (2 - EPSILON32);
- var MIN32 = pow(2, -126);
- var roundTiesToEven = function roundTiesToEven(n) {
- return n + 1 / EPSILON - 1 / EPSILON;
- };
- module.exports = Math.fround || function fround(x) {
- var $abs = Math.abs(x);
- var $sign = sign(x);
- var a, result;
- if ($abs < MIN32) return $sign * roundTiesToEven($abs / MIN32 / EPSILON32) * MIN32 * EPSILON32;
- a = (1 + EPSILON32 / EPSILON) * $abs;
- result = a - (a - $abs);
- // eslint-disable-next-line no-self-compare
- if (result > MAX32 || result != result) return $sign * Infinity;
- return $sign * result;
- };
- /***/ }),
- /***/ 5447:
- /***/ ((module) => {
- // 20.2.2.20 Math.log1p(x)
- module.exports = Math.log1p || function log1p(x) {
- return (x = +x) > -1e-8 && x < 1e-8 ? x - x * x / 2 : Math.log(1 + x);
- };
- /***/ }),
- /***/ 8124:
- /***/ ((module) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- module.exports = Math.scale || function scale(x, inLow, inHigh, outLow, outHigh) {
- if (arguments.length === 0
- // eslint-disable-next-line no-self-compare
- || x != x
- // eslint-disable-next-line no-self-compare
- || inLow != inLow
- // eslint-disable-next-line no-self-compare
- || inHigh != inHigh
- // eslint-disable-next-line no-self-compare
- || outLow != outLow
- // eslint-disable-next-line no-self-compare
- || outHigh != outHigh) return NaN;
- if (x === Infinity || x === -Infinity) return x;
- return (x - inLow) * (outHigh - outLow) / (inHigh - inLow) + outLow;
- };
- /***/ }),
- /***/ 4012:
- /***/ ((module) => {
- // 20.2.2.28 Math.sign(x)
- module.exports = Math.sign || function sign(x) {
- // eslint-disable-next-line no-self-compare
- return (x = +x) == 0 || x != x ? x : x < 0 ? -1 : 1;
- };
- /***/ }),
- /***/ 3763:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var META = __webpack_require__(7936)('meta');
- var isObject = __webpack_require__(7156);
- var has = __webpack_require__(5389);
- var setDesc = (__webpack_require__(4835).f);
- var id = 0;
- var isExtensible = Object.isExtensible || function () {
- return true;
- };
- var FREEZE = !__webpack_require__(5810)(function () {
- return isExtensible(Object.preventExtensions({}));
- });
- var setMeta = function setMeta(it) {
- setDesc(it, META, {
- value: {
- i: 'O' + ++id,
- // object ID
- w: {} // weak collections IDs
- }
- });
- };
- var fastKey = function fastKey(it, create) {
- // return primitive with prefix
- if (!isObject(it)) return _typeof(it) == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
- if (!has(it, META)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return 'F';
- // not necessary to add metadata
- if (!create) return 'E';
- // add missing metadata
- setMeta(it);
- // return object ID
- }
- return it[META].i;
- };
- var getWeak = function getWeak(it, create) {
- if (!has(it, META)) {
- // can't set metadata to uncaught frozen object
- if (!isExtensible(it)) return true;
- // not necessary to add metadata
- if (!create) return false;
- // add missing metadata
- setMeta(it);
- // return hash weak collections IDs
- }
- return it[META].w;
- };
- // add metadata on freeze-family methods calling
- var onFreeze = function onFreeze(it) {
- if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
- return it;
- };
- var meta = module.exports = {
- KEY: META,
- NEED: false,
- fastKey: fastKey,
- getWeak: getWeak,
- onFreeze: onFreeze
- };
- /***/ }),
- /***/ 8953:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var Map = __webpack_require__(8969);
- var $export = __webpack_require__(5913);
- var shared = __webpack_require__(3192)('metadata');
- var store = shared.store || (shared.store = new (__webpack_require__(3491))());
- var getOrCreateMetadataMap = function getOrCreateMetadataMap(target, targetKey, create) {
- var targetMetadata = store.get(target);
- if (!targetMetadata) {
- if (!create) return undefined;
- store.set(target, targetMetadata = new Map());
- }
- var keyMetadata = targetMetadata.get(targetKey);
- if (!keyMetadata) {
- if (!create) return undefined;
- targetMetadata.set(targetKey, keyMetadata = new Map());
- }
- return keyMetadata;
- };
- var ordinaryHasOwnMetadata = function ordinaryHasOwnMetadata(MetadataKey, O, P) {
- var metadataMap = getOrCreateMetadataMap(O, P, false);
- return metadataMap === undefined ? false : metadataMap.has(MetadataKey);
- };
- var ordinaryGetOwnMetadata = function ordinaryGetOwnMetadata(MetadataKey, O, P) {
- var metadataMap = getOrCreateMetadataMap(O, P, false);
- return metadataMap === undefined ? undefined : metadataMap.get(MetadataKey);
- };
- var ordinaryDefineOwnMetadata = function ordinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {
- getOrCreateMetadataMap(O, P, true).set(MetadataKey, MetadataValue);
- };
- var ordinaryOwnMetadataKeys = function ordinaryOwnMetadataKeys(target, targetKey) {
- var metadataMap = getOrCreateMetadataMap(target, targetKey, false);
- var keys = [];
- if (metadataMap) metadataMap.forEach(function (_, key) {
- keys.push(key);
- });
- return keys;
- };
- var toMetaKey = function toMetaKey(it) {
- return it === undefined || _typeof(it) == 'symbol' ? it : String(it);
- };
- var exp = function exp(O) {
- $export($export.S, 'Reflect', O);
- };
- module.exports = {
- store: store,
- map: getOrCreateMetadataMap,
- has: ordinaryHasOwnMetadata,
- get: ordinaryGetOwnMetadata,
- set: ordinaryDefineOwnMetadata,
- keys: ordinaryOwnMetadataKeys,
- key: toMetaKey,
- exp: exp
- };
- /***/ }),
- /***/ 1842:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var macrotask = (__webpack_require__(8220).set);
- var Observer = global.MutationObserver || global.WebKitMutationObserver;
- var process = global.process;
- var Promise = global.Promise;
- var isNode = __webpack_require__(3679)(process) == 'process';
- module.exports = function () {
- var head, last, notify;
- var flush = function flush() {
- var parent, fn;
- if (isNode && (parent = process.domain)) parent.exit();
- while (head) {
- fn = head.fn;
- head = head.next;
- try {
- fn();
- } catch (e) {
- if (head) notify();else last = undefined;
- throw e;
- }
- }
- last = undefined;
- if (parent) parent.enter();
- };
- // Node.js
- if (isNode) {
- notify = function notify() {
- process.nextTick(flush);
- };
- // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
- } else if (Observer && !(global.navigator && global.navigator.standalone)) {
- var toggle = true;
- var node = document.createTextNode('');
- new Observer(flush).observe(node, {
- characterData: true
- }); // eslint-disable-line no-new
- notify = function notify() {
- node.data = toggle = !toggle;
- };
- // environments with maybe non-completely correct, but existent Promise
- } else if (Promise && Promise.resolve) {
- // Promise.resolve without an argument throws an error in LG WebOS 2
- var promise = Promise.resolve(undefined);
- notify = function notify() {
- promise.then(flush);
- };
- // for other environments - macrotask based on:
- // - setImmediate
- // - MessageChannel
- // - window.postMessag
- // - onreadystatechange
- // - setTimeout
- } else {
- notify = function notify() {
- // strange IE + webpack dev server bug - use .call(global)
- macrotask.call(global, flush);
- };
- }
- return function (fn) {
- var task = {
- fn: fn,
- next: undefined
- };
- if (last) last.next = task;
- if (!head) {
- head = task;
- notify();
- }
- last = task;
- };
- };
- /***/ }),
- /***/ 4086:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 25.4.1.5 NewPromiseCapability(C)
- var aFunction = __webpack_require__(6819);
- function PromiseCapability(C) {
- var resolve, reject;
- this.promise = new C(function ($$resolve, $$reject) {
- if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
- resolve = $$resolve;
- reject = $$reject;
- });
- this.resolve = aFunction(resolve);
- this.reject = aFunction(reject);
- }
- module.exports.f = function (C) {
- return new PromiseCapability(C);
- };
- /***/ }),
- /***/ 8559:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.1 Object.assign(target, source, ...)
- var DESCRIPTORS = __webpack_require__(4926);
- var getKeys = __webpack_require__(9924);
- var gOPS = __webpack_require__(5421);
- var pIE = __webpack_require__(4616);
- var toObject = __webpack_require__(2515);
- var IObject = __webpack_require__(331);
- var $assign = Object.assign;
- // should work with symbols and should have deterministic property order (V8 bug)
- module.exports = !$assign || __webpack_require__(5810)(function () {
- var A = {};
- var B = {};
- // eslint-disable-next-line no-undef
- var S = Symbol();
- var K = 'abcdefghijklmnopqrst';
- A[S] = 7;
- K.split('').forEach(function (k) {
- B[k] = k;
- });
- return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;
- }) ? function assign(target, source) {
- // eslint-disable-line no-unused-vars
- var T = toObject(target);
- var aLen = arguments.length;
- var index = 1;
- var getSymbols = gOPS.f;
- var isEnum = pIE.f;
- while (aLen > index) {
- var S = IObject(arguments[index++]);
- var keys = getSymbols ? getKeys(S).concat(getSymbols(S)) : getKeys(S);
- var length = keys.length;
- var j = 0;
- var key;
- while (length > j) {
- key = keys[j++];
- if (!DESCRIPTORS || isEnum.call(S, key)) T[key] = S[key];
- }
- }
- return T;
- } : $assign;
- /***/ }),
- /***/ 4275:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- var anObject = __webpack_require__(6154);
- var dPs = __webpack_require__(6447);
- var enumBugKeys = __webpack_require__(6921);
- var IE_PROTO = __webpack_require__(8662)('IE_PROTO');
- var Empty = function Empty() {/* empty */};
- var PROTOTYPE = 'prototype';
- // Create object with fake `null` prototype: use iframe Object with cleared prototype
- var _createDict = function createDict() {
- // Thrash, waste and sodomy: IE GC bug
- var iframe = __webpack_require__(2241)('iframe');
- var i = enumBugKeys.length;
- var lt = '<';
- var gt = '>';
- var iframeDocument;
- iframe.style.display = 'none';
- (__webpack_require__(1225).appendChild)(iframe);
- iframe.src = 'javascript:'; // eslint-disable-line no-script-url
- // createDict = iframe.contentWindow.Object;
- // html.removeChild(iframe);
- iframeDocument = iframe.contentWindow.document;
- iframeDocument.open();
- iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
- iframeDocument.close();
- _createDict = iframeDocument.F;
- while (i--) delete _createDict[PROTOTYPE][enumBugKeys[i]];
- return _createDict();
- };
- module.exports = Object.create || function create(O, Properties) {
- var result;
- if (O !== null) {
- Empty[PROTOTYPE] = anObject(O);
- result = new Empty();
- Empty[PROTOTYPE] = null;
- // add "__proto__" for Object.getPrototypeOf polyfill
- result[IE_PROTO] = O;
- } else result = _createDict();
- return Properties === undefined ? result : dPs(result, Properties);
- };
- /***/ }),
- /***/ 4835:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- var anObject = __webpack_require__(6154);
- var IE8_DOM_DEFINE = __webpack_require__(5142);
- var toPrimitive = __webpack_require__(8537);
- var dP = Object.defineProperty;
- exports.f = __webpack_require__(4926) ? Object.defineProperty : function defineProperty(O, P, Attributes) {
- anObject(O);
- P = toPrimitive(P, true);
- anObject(Attributes);
- if (IE8_DOM_DEFINE) try {
- return dP(O, P, Attributes);
- } catch (e) {/* empty */}
- if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
- if ('value' in Attributes) O[P] = Attributes.value;
- return O;
- };
- /***/ }),
- /***/ 6447:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var dP = __webpack_require__(4835);
- var anObject = __webpack_require__(6154);
- var getKeys = __webpack_require__(9924);
- module.exports = __webpack_require__(4926) ? Object.defineProperties : function defineProperties(O, Properties) {
- anObject(O);
- var keys = getKeys(Properties);
- var length = keys.length;
- var i = 0;
- var P;
- while (length > i) dP.f(O, P = keys[i++], Properties[P]);
- return O;
- };
- /***/ }),
- /***/ 8249:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // Forced replacement prototype accessors methods
- module.exports = __webpack_require__(4219) || !__webpack_require__(5810)(function () {
- var K = Math.random();
- // In FF throws only define methods
- // eslint-disable-next-line no-undef, no-useless-call
- __defineSetter__.call(null, K, function () {/* empty */});
- delete __webpack_require__(7381)[K];
- });
- /***/ }),
- /***/ 3299:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- var pIE = __webpack_require__(4616);
- var createDesc = __webpack_require__(6256);
- var toIObject = __webpack_require__(8499);
- var toPrimitive = __webpack_require__(8537);
- var has = __webpack_require__(5389);
- var IE8_DOM_DEFINE = __webpack_require__(5142);
- var gOPD = Object.getOwnPropertyDescriptor;
- exports.f = __webpack_require__(4926) ? gOPD : function getOwnPropertyDescriptor(O, P) {
- O = toIObject(O);
- P = toPrimitive(P, true);
- if (IE8_DOM_DEFINE) try {
- return gOPD(O, P);
- } catch (e) {/* empty */}
- if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
- };
- /***/ }),
- /***/ 3136:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- // fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
- var toIObject = __webpack_require__(8499);
- var gOPN = (__webpack_require__(2982).f);
- var toString = {}.toString;
- var windowNames = (typeof window === "undefined" ? "undefined" : _typeof(window)) == 'object' && window && Object.getOwnPropertyNames ? Object.getOwnPropertyNames(window) : [];
- var getWindowNames = function getWindowNames(it) {
- try {
- return gOPN(it);
- } catch (e) {
- return windowNames.slice();
- }
- };
- module.exports.f = function getOwnPropertyNames(it) {
- return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
- };
- /***/ }),
- /***/ 2982:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- // 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
- var $keys = __webpack_require__(7960);
- var hiddenKeys = (__webpack_require__(6921).concat)('length', 'prototype');
- exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
- return $keys(O, hiddenKeys);
- };
- /***/ }),
- /***/ 5421:
- /***/ ((__unused_webpack_module, exports) => {
- exports.f = Object.getOwnPropertySymbols;
- /***/ }),
- /***/ 4153:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.9 / 15.2.3.2 Object.getPrototypeOf(O)
- var has = __webpack_require__(5389);
- var toObject = __webpack_require__(2515);
- var IE_PROTO = __webpack_require__(8662)('IE_PROTO');
- var ObjectProto = Object.prototype;
- module.exports = Object.getPrototypeOf || function (O) {
- O = toObject(O);
- if (has(O, IE_PROTO)) return O[IE_PROTO];
- if (typeof O.constructor == 'function' && O instanceof O.constructor) {
- return O.constructor.prototype;
- }
- return O instanceof Object ? ObjectProto : null;
- };
- /***/ }),
- /***/ 7960:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var has = __webpack_require__(5389);
- var toIObject = __webpack_require__(8499);
- var arrayIndexOf = __webpack_require__(4687)(false);
- var IE_PROTO = __webpack_require__(8662)('IE_PROTO');
- module.exports = function (object, names) {
- var O = toIObject(object);
- var i = 0;
- var result = [];
- var key;
- for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
- // Don't enum bug & hidden keys
- while (names.length > i) if (has(O, key = names[i++])) {
- ~arrayIndexOf(result, key) || result.push(key);
- }
- return result;
- };
- /***/ }),
- /***/ 9924:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.14 / 15.2.3.14 Object.keys(O)
- var $keys = __webpack_require__(7960);
- var enumBugKeys = __webpack_require__(6921);
- module.exports = Object.keys || function keys(O) {
- return $keys(O, enumBugKeys);
- };
- /***/ }),
- /***/ 4616:
- /***/ ((__unused_webpack_module, exports) => {
- exports.f = {}.propertyIsEnumerable;
- /***/ }),
- /***/ 4057:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // most Object methods by ES6 should accept primitives
- var $export = __webpack_require__(5913);
- var core = __webpack_require__(8544);
- var fails = __webpack_require__(5810);
- module.exports = function (KEY, exec) {
- var fn = (core.Object || {})[KEY] || Object[KEY];
- var exp = {};
- exp[KEY] = exec(fn);
- $export($export.S + $export.F * fails(function () {
- fn(1);
- }), 'Object', exp);
- };
- /***/ }),
- /***/ 8941:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var DESCRIPTORS = __webpack_require__(4926);
- var getKeys = __webpack_require__(9924);
- var toIObject = __webpack_require__(8499);
- var isEnum = (__webpack_require__(4616).f);
- module.exports = function (isEntries) {
- return function (it) {
- var O = toIObject(it);
- var keys = getKeys(O);
- var length = keys.length;
- var i = 0;
- var result = [];
- var key;
- while (length > i) {
- key = keys[i++];
- if (!DESCRIPTORS || isEnum.call(O, key)) {
- result.push(isEntries ? [key, O[key]] : O[key]);
- }
- }
- return result;
- };
- };
- /***/ }),
- /***/ 2600:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // all object keys, includes non-enumerable and symbols
- var gOPN = __webpack_require__(2982);
- var gOPS = __webpack_require__(5421);
- var anObject = __webpack_require__(6154);
- var Reflect = (__webpack_require__(7381).Reflect);
- module.exports = Reflect && Reflect.ownKeys || function ownKeys(it) {
- var keys = gOPN.f(anObject(it));
- var getSymbols = gOPS.f;
- return getSymbols ? keys.concat(getSymbols(it)) : keys;
- };
- /***/ }),
- /***/ 5031:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var $parseFloat = (__webpack_require__(7381).parseFloat);
- var $trim = (__webpack_require__(618).trim);
- module.exports = 1 / $parseFloat(__webpack_require__(3596) + '-0') !== -Infinity ? function parseFloat(str) {
- var string = $trim(String(str), 3);
- var result = $parseFloat(string);
- return result === 0 && string.charAt(0) == '-' ? -0 : result;
- } : $parseFloat;
- /***/ }),
- /***/ 6971:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var $parseInt = (__webpack_require__(7381).parseInt);
- var $trim = (__webpack_require__(618).trim);
- var ws = __webpack_require__(3596);
- var hex = /^[-+]?0[xX]/;
- module.exports = $parseInt(ws + '08') !== 8 || $parseInt(ws + '0x16') !== 22 ? function parseInt(str, radix) {
- var string = $trim(String(str), 3);
- return $parseInt(string, radix >>> 0 || (hex.test(string) ? 16 : 10));
- } : $parseInt;
- /***/ }),
- /***/ 8228:
- /***/ ((module) => {
- module.exports = function (exec) {
- try {
- return {
- e: false,
- v: exec()
- };
- } catch (e) {
- return {
- e: true,
- v: e
- };
- }
- };
- /***/ }),
- /***/ 3507:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var anObject = __webpack_require__(6154);
- var isObject = __webpack_require__(7156);
- var newPromiseCapability = __webpack_require__(4086);
- module.exports = function (C, x) {
- anObject(C);
- if (isObject(x) && x.constructor === C) return x;
- var promiseCapability = newPromiseCapability.f(C);
- var resolve = promiseCapability.resolve;
- resolve(x);
- return promiseCapability.promise;
- };
- /***/ }),
- /***/ 6256:
- /***/ ((module) => {
- module.exports = function (bitmap, value) {
- return {
- enumerable: !(bitmap & 1),
- configurable: !(bitmap & 2),
- writable: !(bitmap & 4),
- value: value
- };
- };
- /***/ }),
- /***/ 7228:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var redefine = __webpack_require__(7278);
- module.exports = function (target, src, safe) {
- for (var key in src) redefine(target, key, src[key], safe);
- return target;
- };
- /***/ }),
- /***/ 7278:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var hide = __webpack_require__(8012);
- var has = __webpack_require__(5389);
- var SRC = __webpack_require__(7936)('src');
- var $toString = __webpack_require__(1174);
- var TO_STRING = 'toString';
- var TPL = ('' + $toString).split(TO_STRING);
- (__webpack_require__(8544).inspectSource) = function (it) {
- return $toString.call(it);
- };
- (module.exports = function (O, key, val, safe) {
- var isFunction = typeof val == 'function';
- if (isFunction) has(val, 'name') || hide(val, 'name', key);
- if (O[key] === val) return;
- if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
- if (O === global) {
- O[key] = val;
- } else if (!safe) {
- delete O[key];
- hide(O, key, val);
- } else if (O[key]) {
- O[key] = val;
- } else {
- hide(O, key, val);
- }
- // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
- })(Function.prototype, TO_STRING, function toString() {
- return typeof this == 'function' && this[SRC] || $toString.call(this);
- });
- /***/ }),
- /***/ 4585:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var classof = __webpack_require__(2858);
- var builtinExec = RegExp.prototype.exec;
- // `RegExpExec` abstract operation
- // https://tc39.github.io/ecma262/#sec-regexpexec
- module.exports = function (R, S) {
- var exec = R.exec;
- if (typeof exec === 'function') {
- var result = exec.call(R, S);
- if (_typeof(result) !== 'object') {
- throw new TypeError('RegExp exec method returned something other than an Object or null');
- }
- return result;
- }
- if (classof(R) !== 'RegExp') {
- throw new TypeError('RegExp#exec called on incompatible receiver');
- }
- return builtinExec.call(R, S);
- };
- /***/ }),
- /***/ 6997:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var regexpFlags = __webpack_require__(2188);
- var nativeExec = RegExp.prototype.exec;
- // This always refers to the native implementation, because the
- // String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,
- // which loads this file before patching the method.
- var nativeReplace = String.prototype.replace;
- var patchedExec = nativeExec;
- var LAST_INDEX = 'lastIndex';
- var UPDATES_LAST_INDEX_WRONG = function () {
- var re1 = /a/,
- re2 = /b*/g;
- nativeExec.call(re1, 'a');
- nativeExec.call(re2, 'a');
- return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;
- }();
- // nonparticipating capturing group, copied from es5-shim's String#split patch.
- var NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;
- var PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;
- if (PATCH) {
- patchedExec = function exec(str) {
- var re = this;
- var lastIndex, reCopy, match, i;
- if (NPCG_INCLUDED) {
- reCopy = new RegExp('^' + re.source + '$(?!\\s)', regexpFlags.call(re));
- }
- if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];
- match = nativeExec.call(re, str);
- if (UPDATES_LAST_INDEX_WRONG && match) {
- re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;
- }
- if (NPCG_INCLUDED && match && match.length > 1) {
- // Fix browsers whose `exec` methods don't consistently return `undefined`
- // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
- // eslint-disable-next-line no-loop-func
- nativeReplace.call(match[0], reCopy, function () {
- for (i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === undefined) match[i] = undefined;
- }
- });
- }
- return match;
- };
- }
- module.exports = patchedExec;
- /***/ }),
- /***/ 6813:
- /***/ ((module) => {
- module.exports = function (regExp, replace) {
- var replacer = replace === Object(replace) ? function (part) {
- return replace[part];
- } : replace;
- return function (it) {
- return String(it).replace(regExp, replacer);
- };
- };
- /***/ }),
- /***/ 4261:
- /***/ ((module) => {
- // 7.2.9 SameValue(x, y)
- module.exports = Object.is || function is(x, y) {
- // eslint-disable-next-line no-self-compare
- return x === y ? x !== 0 || 1 / x === 1 / y : x != x && y != y;
- };
- /***/ }),
- /***/ 7598:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/
- var $export = __webpack_require__(5913);
- var aFunction = __webpack_require__(6819);
- var ctx = __webpack_require__(566);
- var forOf = __webpack_require__(2734);
- module.exports = function (COLLECTION) {
- $export($export.S, COLLECTION, {
- from: function from(source /* , mapFn, thisArg */) {
- var mapFn = arguments[1];
- var mapping, A, n, cb;
- aFunction(this);
- mapping = mapFn !== undefined;
- if (mapping) aFunction(mapFn);
- if (source == undefined) return new this();
- A = [];
- if (mapping) {
- n = 0;
- cb = ctx(mapFn, arguments[2], 2);
- forOf(source, false, function (nextItem) {
- A.push(cb(nextItem, n++));
- });
- } else {
- forOf(source, false, A.push, A);
- }
- return new this(A);
- }
- });
- };
- /***/ }),
- /***/ 5329:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/
- var $export = __webpack_require__(5913);
- module.exports = function (COLLECTION) {
- $export($export.S, COLLECTION, {
- of: function of() {
- var length = arguments.length;
- var A = new Array(length);
- while (length--) A[length] = arguments[length];
- return new this(A);
- }
- });
- };
- /***/ }),
- /***/ 6931:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // Works with __proto__ only. Old v8 can't work with null proto objects.
- /* eslint-disable no-proto */
- var isObject = __webpack_require__(7156);
- var anObject = __webpack_require__(6154);
- var check = function check(O, proto) {
- anObject(O);
- if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
- };
- module.exports = {
- set: Object.setPrototypeOf || ('__proto__' in {} ?
- // eslint-disable-line
- function (test, buggy, set) {
- try {
- set = __webpack_require__(566)(Function.call, (__webpack_require__(3299).f)(Object.prototype, '__proto__').set, 2);
- set(test, []);
- buggy = !(test instanceof Array);
- } catch (e) {
- buggy = true;
- }
- return function setPrototypeOf(O, proto) {
- check(O, proto);
- if (buggy) O.__proto__ = proto;else set(O, proto);
- return O;
- };
- }({}, false) : undefined),
- check: check
- };
- /***/ }),
- /***/ 4798:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var dP = __webpack_require__(4835);
- var DESCRIPTORS = __webpack_require__(4926);
- var SPECIES = __webpack_require__(3336)('species');
- module.exports = function (KEY) {
- var C = global[KEY];
- if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
- configurable: true,
- get: function get() {
- return this;
- }
- });
- };
- /***/ }),
- /***/ 8094:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var def = (__webpack_require__(4835).f);
- var has = __webpack_require__(5389);
- var TAG = __webpack_require__(3336)('toStringTag');
- module.exports = function (it, tag, stat) {
- if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, {
- configurable: true,
- value: tag
- });
- };
- /***/ }),
- /***/ 8662:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var shared = __webpack_require__(3192)('keys');
- var uid = __webpack_require__(7936);
- module.exports = function (key) {
- return shared[key] || (shared[key] = uid(key));
- };
- /***/ }),
- /***/ 3192:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var core = __webpack_require__(8544);
- var global = __webpack_require__(7381);
- var SHARED = '__core-js_shared__';
- var store = global[SHARED] || (global[SHARED] = {});
- (module.exports = function (key, value) {
- return store[key] || (store[key] = value !== undefined ? value : {});
- })('versions', []).push({
- version: core.version,
- mode: __webpack_require__(4219) ? 'pure' : 'global',
- copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
- });
- /***/ }),
- /***/ 2035:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 7.3.20 SpeciesConstructor(O, defaultConstructor)
- var anObject = __webpack_require__(6154);
- var aFunction = __webpack_require__(6819);
- var SPECIES = __webpack_require__(3336)('species');
- module.exports = function (O, D) {
- var C = anObject(O).constructor;
- var S;
- return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
- };
- /***/ }),
- /***/ 1411:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var fails = __webpack_require__(5810);
- module.exports = function (method, arg) {
- return !!method && fails(function () {
- // eslint-disable-next-line no-useless-call
- arg ? method.call(null, function () {/* empty */}, 1) : method.call(null);
- });
- };
- /***/ }),
- /***/ 3593:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var toInteger = __webpack_require__(3230);
- var defined = __webpack_require__(408);
- // true -> String#at
- // false -> String#codePointAt
- module.exports = function (TO_STRING) {
- return function (that, pos) {
- var s = String(defined(that));
- var i = toInteger(pos);
- var l = s.length;
- var a, b;
- if (i < 0 || i >= l) return TO_STRING ? '' : undefined;
- a = s.charCodeAt(i);
- return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff ? TO_STRING ? s.charAt(i) : a : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;
- };
- };
- /***/ }),
- /***/ 2376:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // helper for String#{startsWith, endsWith, includes}
- var isRegExp = __webpack_require__(1993);
- var defined = __webpack_require__(408);
- module.exports = function (that, searchString, NAME) {
- if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
- return String(defined(that));
- };
- /***/ }),
- /***/ 9927:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var fails = __webpack_require__(5810);
- var defined = __webpack_require__(408);
- var quot = /"/g;
- // B.2.3.2.1 CreateHTML(string, tag, attribute, value)
- var createHTML = function createHTML(string, tag, attribute, value) {
- var S = String(defined(string));
- var p1 = '<' + tag;
- if (attribute !== '') p1 += ' ' + attribute + '="' + String(value).replace(quot, '"') + '"';
- return p1 + '>' + S + '</' + tag + '>';
- };
- module.exports = function (NAME, exec) {
- var O = {};
- O[NAME] = exec(createHTML);
- $export($export.P + $export.F * fails(function () {
- var test = ''[NAME]('"');
- return test !== test.toLowerCase() || test.split('"').length > 3;
- }), 'String', O);
- };
- /***/ }),
- /***/ 1925:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-string-pad-start-end
- var toLength = __webpack_require__(8315);
- var repeat = __webpack_require__(1924);
- var defined = __webpack_require__(408);
- module.exports = function (that, maxLength, fillString, left) {
- var S = String(defined(that));
- var stringLength = S.length;
- var fillStr = fillString === undefined ? ' ' : String(fillString);
- var intMaxLength = toLength(maxLength);
- if (intMaxLength <= stringLength || fillStr == '') return S;
- var fillLen = intMaxLength - stringLength;
- var stringFiller = repeat.call(fillStr, Math.ceil(fillLen / fillStr.length));
- if (stringFiller.length > fillLen) stringFiller = stringFiller.slice(0, fillLen);
- return left ? stringFiller + S : S + stringFiller;
- };
- /***/ }),
- /***/ 1924:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var toInteger = __webpack_require__(3230);
- var defined = __webpack_require__(408);
- module.exports = function repeat(count) {
- var str = String(defined(this));
- var res = '';
- var n = toInteger(count);
- if (n < 0 || n == Infinity) throw RangeError("Count can't be negative");
- for (; n > 0; (n >>>= 1) && (str += str)) if (n & 1) res += str;
- return res;
- };
- /***/ }),
- /***/ 618:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var defined = __webpack_require__(408);
- var fails = __webpack_require__(5810);
- var spaces = __webpack_require__(3596);
- var space = '[' + spaces + ']';
- var non = "\u200B\x85";
- var ltrim = RegExp('^' + space + space + '*');
- var rtrim = RegExp(space + space + '*$');
- var exporter = function exporter(KEY, exec, ALIAS) {
- var exp = {};
- var FORCE = fails(function () {
- return !!spaces[KEY]() || non[KEY]() != non;
- });
- var fn = exp[KEY] = FORCE ? exec(trim) : spaces[KEY];
- if (ALIAS) exp[ALIAS] = fn;
- $export($export.P + $export.F * FORCE, 'String', exp);
- };
- // 1 -> String#trimLeft
- // 2 -> String#trimRight
- // 3 -> String#trim
- var trim = exporter.trim = function (string, TYPE) {
- string = String(defined(string));
- if (TYPE & 1) string = string.replace(ltrim, '');
- if (TYPE & 2) string = string.replace(rtrim, '');
- return string;
- };
- module.exports = exporter;
- /***/ }),
- /***/ 3596:
- /***/ ((module) => {
- module.exports = "\t\n\x0B\f\r \xA0\u1680\u180E\u2000\u2001\u2002\u2003" + "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF";
- /***/ }),
- /***/ 8220:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var ctx = __webpack_require__(566);
- var invoke = __webpack_require__(2765);
- var html = __webpack_require__(1225);
- var cel = __webpack_require__(2241);
- var global = __webpack_require__(7381);
- var process = global.process;
- var setTask = global.setImmediate;
- var clearTask = global.clearImmediate;
- var MessageChannel = global.MessageChannel;
- var Dispatch = global.Dispatch;
- var counter = 0;
- var queue = {};
- var ONREADYSTATECHANGE = 'onreadystatechange';
- var defer, channel, port;
- var run = function run() {
- var id = +this;
- // eslint-disable-next-line no-prototype-builtins
- if (queue.hasOwnProperty(id)) {
- var fn = queue[id];
- delete queue[id];
- fn();
- }
- };
- var listener = function listener(event) {
- run.call(event.data);
- };
- // Node.js 0.9+ & IE10+ has setImmediate, otherwise:
- if (!setTask || !clearTask) {
- setTask = function setImmediate(fn) {
- var args = [];
- var i = 1;
- while (arguments.length > i) args.push(arguments[i++]);
- queue[++counter] = function () {
- // eslint-disable-next-line no-new-func
- invoke(typeof fn == 'function' ? fn : Function(fn), args);
- };
- defer(counter);
- return counter;
- };
- clearTask = function clearImmediate(id) {
- delete queue[id];
- };
- // Node.js 0.8-
- if (__webpack_require__(3679)(process) == 'process') {
- defer = function defer(id) {
- process.nextTick(ctx(run, id, 1));
- };
- // Sphere (JS game engine) Dispatch API
- } else if (Dispatch && Dispatch.now) {
- defer = function defer(id) {
- Dispatch.now(ctx(run, id, 1));
- };
- // Browsers with MessageChannel, includes WebWorkers
- } else if (MessageChannel) {
- channel = new MessageChannel();
- port = channel.port2;
- channel.port1.onmessage = listener;
- defer = ctx(port.postMessage, port, 1);
- // Browsers with postMessage, skip WebWorkers
- // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
- } else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
- defer = function defer(id) {
- global.postMessage(id + '', '*');
- };
- global.addEventListener('message', listener, false);
- // IE8-
- } else if (ONREADYSTATECHANGE in cel('script')) {
- defer = function defer(id) {
- html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
- html.removeChild(this);
- run.call(id);
- };
- };
- // Rest old browsers
- } else {
- defer = function defer(id) {
- setTimeout(ctx(run, id, 1), 0);
- };
- }
- }
- module.exports = {
- set: setTask,
- clear: clearTask
- };
- /***/ }),
- /***/ 6241:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var toInteger = __webpack_require__(3230);
- var max = Math.max;
- var min = Math.min;
- module.exports = function (index, length) {
- index = toInteger(index);
- return index < 0 ? max(index + length, 0) : min(index, length);
- };
- /***/ }),
- /***/ 3472:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/ecma262/#sec-toindex
- var toInteger = __webpack_require__(3230);
- var toLength = __webpack_require__(8315);
- module.exports = function (it) {
- if (it === undefined) return 0;
- var number = toInteger(it);
- var length = toLength(number);
- if (number !== length) throw RangeError('Wrong length!');
- return length;
- };
- /***/ }),
- /***/ 3230:
- /***/ ((module) => {
- // 7.1.4 ToInteger
- var ceil = Math.ceil;
- var floor = Math.floor;
- module.exports = function (it) {
- return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
- };
- /***/ }),
- /***/ 8499:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // to indexed object, toObject with fallback for non-array-like ES3 strings
- var IObject = __webpack_require__(331);
- var defined = __webpack_require__(408);
- module.exports = function (it) {
- return IObject(defined(it));
- };
- /***/ }),
- /***/ 8315:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 7.1.15 ToLength
- var toInteger = __webpack_require__(3230);
- var min = Math.min;
- module.exports = function (it) {
- return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
- };
- /***/ }),
- /***/ 2515:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 7.1.13 ToObject(argument)
- var defined = __webpack_require__(408);
- module.exports = function (it) {
- return Object(defined(it));
- };
- /***/ }),
- /***/ 8537:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- // 7.1.1 ToPrimitive(input [, PreferredType])
- var isObject = __webpack_require__(7156);
- // instead of the ES6 spec version, we didn't implement @@toPrimitive case
- // and the second argument - flag - preferred type is a string
- module.exports = function (it, S) {
- if (!isObject(it)) return it;
- var fn, val;
- if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
- if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
- throw TypeError("Can't convert object to primitive value");
- };
- /***/ }),
- /***/ 431:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- if (__webpack_require__(4926)) {
- var LIBRARY = __webpack_require__(4219);
- var global = __webpack_require__(7381);
- var fails = __webpack_require__(5810);
- var $export = __webpack_require__(5913);
- var $typed = __webpack_require__(9161);
- var $buffer = __webpack_require__(9782);
- var ctx = __webpack_require__(566);
- var anInstance = __webpack_require__(2702);
- var propertyDesc = __webpack_require__(6256);
- var hide = __webpack_require__(8012);
- var redefineAll = __webpack_require__(7228);
- var toInteger = __webpack_require__(3230);
- var toLength = __webpack_require__(8315);
- var toIndex = __webpack_require__(3472);
- var toAbsoluteIndex = __webpack_require__(6241);
- var toPrimitive = __webpack_require__(8537);
- var has = __webpack_require__(5389);
- var classof = __webpack_require__(2858);
- var isObject = __webpack_require__(7156);
- var toObject = __webpack_require__(2515);
- var isArrayIter = __webpack_require__(7063);
- var create = __webpack_require__(4275);
- var getPrototypeOf = __webpack_require__(4153);
- var gOPN = (__webpack_require__(2982).f);
- var getIterFn = __webpack_require__(7637);
- var uid = __webpack_require__(7936);
- var wks = __webpack_require__(3336);
- var createArrayMethod = __webpack_require__(3970);
- var createArrayIncludes = __webpack_require__(4687);
- var speciesConstructor = __webpack_require__(2035);
- var ArrayIterators = __webpack_require__(4806);
- var Iterators = __webpack_require__(5301);
- var $iterDetect = __webpack_require__(5508);
- var setSpecies = __webpack_require__(4798);
- var arrayFill = __webpack_require__(1132);
- var arrayCopyWithin = __webpack_require__(2147);
- var $DP = __webpack_require__(4835);
- var $GOPD = __webpack_require__(3299);
- var dP = $DP.f;
- var gOPD = $GOPD.f;
- var RangeError = global.RangeError;
- var TypeError = global.TypeError;
- var Uint8Array = global.Uint8Array;
- var ARRAY_BUFFER = 'ArrayBuffer';
- var SHARED_BUFFER = 'Shared' + ARRAY_BUFFER;
- var BYTES_PER_ELEMENT = 'BYTES_PER_ELEMENT';
- var PROTOTYPE = 'prototype';
- var ArrayProto = Array[PROTOTYPE];
- var $ArrayBuffer = $buffer.ArrayBuffer;
- var $DataView = $buffer.DataView;
- var arrayForEach = createArrayMethod(0);
- var arrayFilter = createArrayMethod(2);
- var arraySome = createArrayMethod(3);
- var arrayEvery = createArrayMethod(4);
- var arrayFind = createArrayMethod(5);
- var arrayFindIndex = createArrayMethod(6);
- var arrayIncludes = createArrayIncludes(true);
- var arrayIndexOf = createArrayIncludes(false);
- var arrayValues = ArrayIterators.values;
- var arrayKeys = ArrayIterators.keys;
- var arrayEntries = ArrayIterators.entries;
- var arrayLastIndexOf = ArrayProto.lastIndexOf;
- var arrayReduce = ArrayProto.reduce;
- var arrayReduceRight = ArrayProto.reduceRight;
- var arrayJoin = ArrayProto.join;
- var arraySort = ArrayProto.sort;
- var arraySlice = ArrayProto.slice;
- var arrayToString = ArrayProto.toString;
- var arrayToLocaleString = ArrayProto.toLocaleString;
- var ITERATOR = wks('iterator');
- var TAG = wks('toStringTag');
- var TYPED_CONSTRUCTOR = uid('typed_constructor');
- var DEF_CONSTRUCTOR = uid('def_constructor');
- var ALL_CONSTRUCTORS = $typed.CONSTR;
- var TYPED_ARRAY = $typed.TYPED;
- var VIEW = $typed.VIEW;
- var WRONG_LENGTH = 'Wrong length!';
- var $map = createArrayMethod(1, function (O, length) {
- return allocate(speciesConstructor(O, O[DEF_CONSTRUCTOR]), length);
- });
- var LITTLE_ENDIAN = fails(function () {
- // eslint-disable-next-line no-undef
- return new Uint8Array(new Uint16Array([1]).buffer)[0] === 1;
- });
- var FORCED_SET = !!Uint8Array && !!Uint8Array[PROTOTYPE].set && fails(function () {
- new Uint8Array(1).set({});
- });
- var toOffset = function toOffset(it, BYTES) {
- var offset = toInteger(it);
- if (offset < 0 || offset % BYTES) throw RangeError('Wrong offset!');
- return offset;
- };
- var validate = function validate(it) {
- if (isObject(it) && TYPED_ARRAY in it) return it;
- throw TypeError(it + ' is not a typed array!');
- };
- var allocate = function allocate(C, length) {
- if (!(isObject(C) && TYPED_CONSTRUCTOR in C)) {
- throw TypeError('It is not a typed array constructor!');
- }
- return new C(length);
- };
- var speciesFromList = function speciesFromList(O, list) {
- return fromList(speciesConstructor(O, O[DEF_CONSTRUCTOR]), list);
- };
- var fromList = function fromList(C, list) {
- var index = 0;
- var length = list.length;
- var result = allocate(C, length);
- while (length > index) result[index] = list[index++];
- return result;
- };
- var addGetter = function addGetter(it, key, internal) {
- dP(it, key, {
- get: function get() {
- return this._d[internal];
- }
- });
- };
- var $from = function from(source /* , mapfn, thisArg */) {
- var O = toObject(source);
- var aLen = arguments.length;
- var mapfn = aLen > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var iterFn = getIterFn(O);
- var i, length, values, result, step, iterator;
- if (iterFn != undefined && !isArrayIter(iterFn)) {
- for (iterator = iterFn.call(O), values = [], i = 0; !(step = iterator.next()).done; i++) {
- values.push(step.value);
- }
- O = values;
- }
- if (mapping && aLen > 2) mapfn = ctx(mapfn, arguments[2], 2);
- for (i = 0, length = toLength(O.length), result = allocate(this, length); length > i; i++) {
- result[i] = mapping ? mapfn(O[i], i) : O[i];
- }
- return result;
- };
- var $of = function of( /* ...items */
- ) {
- var index = 0;
- var length = arguments.length;
- var result = allocate(this, length);
- while (length > index) result[index] = arguments[index++];
- return result;
- };
- // iOS Safari 6.x fails here
- var TO_LOCALE_BUG = !!Uint8Array && fails(function () {
- arrayToLocaleString.call(new Uint8Array(1));
- });
- var $toLocaleString = function toLocaleString() {
- return arrayToLocaleString.apply(TO_LOCALE_BUG ? arraySlice.call(validate(this)) : validate(this), arguments);
- };
- var proto = {
- copyWithin: function copyWithin(target, start /* , end */) {
- return arrayCopyWithin.call(validate(this), target, start, arguments.length > 2 ? arguments[2] : undefined);
- },
- every: function every(callbackfn /* , thisArg */) {
- return arrayEvery(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- },
- fill: function fill(value /* , start, end */) {
- // eslint-disable-line no-unused-vars
- return arrayFill.apply(validate(this), arguments);
- },
- filter: function filter(callbackfn /* , thisArg */) {
- return speciesFromList(this, arrayFilter(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined));
- },
- find: function find(predicate /* , thisArg */) {
- return arrayFind(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
- },
- findIndex: function findIndex(predicate /* , thisArg */) {
- return arrayFindIndex(validate(this), predicate, arguments.length > 1 ? arguments[1] : undefined);
- },
- forEach: function forEach(callbackfn /* , thisArg */) {
- arrayForEach(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- },
- indexOf: function indexOf(searchElement /* , fromIndex */) {
- return arrayIndexOf(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
- },
- includes: function includes(searchElement /* , fromIndex */) {
- return arrayIncludes(validate(this), searchElement, arguments.length > 1 ? arguments[1] : undefined);
- },
- join: function join(separator) {
- // eslint-disable-line no-unused-vars
- return arrayJoin.apply(validate(this), arguments);
- },
- lastIndexOf: function lastIndexOf(searchElement /* , fromIndex */) {
- // eslint-disable-line no-unused-vars
- return arrayLastIndexOf.apply(validate(this), arguments);
- },
- map: function map(mapfn /* , thisArg */) {
- return $map(validate(this), mapfn, arguments.length > 1 ? arguments[1] : undefined);
- },
- reduce: function reduce(callbackfn /* , initialValue */) {
- // eslint-disable-line no-unused-vars
- return arrayReduce.apply(validate(this), arguments);
- },
- reduceRight: function reduceRight(callbackfn /* , initialValue */) {
- // eslint-disable-line no-unused-vars
- return arrayReduceRight.apply(validate(this), arguments);
- },
- reverse: function reverse() {
- var that = this;
- var length = validate(that).length;
- var middle = Math.floor(length / 2);
- var index = 0;
- var value;
- while (index < middle) {
- value = that[index];
- that[index++] = that[--length];
- that[length] = value;
- }
- return that;
- },
- some: function some(callbackfn /* , thisArg */) {
- return arraySome(validate(this), callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- },
- sort: function sort(comparefn) {
- return arraySort.call(validate(this), comparefn);
- },
- subarray: function subarray(begin, end) {
- var O = validate(this);
- var length = O.length;
- var $begin = toAbsoluteIndex(begin, length);
- return new (speciesConstructor(O, O[DEF_CONSTRUCTOR]))(O.buffer, O.byteOffset + $begin * O.BYTES_PER_ELEMENT, toLength((end === undefined ? length : toAbsoluteIndex(end, length)) - $begin));
- }
- };
- var $slice = function slice(start, end) {
- return speciesFromList(this, arraySlice.call(validate(this), start, end));
- };
- var $set = function set(arrayLike /* , offset */) {
- validate(this);
- var offset = toOffset(arguments[1], 1);
- var length = this.length;
- var src = toObject(arrayLike);
- var len = toLength(src.length);
- var index = 0;
- if (len + offset > length) throw RangeError(WRONG_LENGTH);
- while (index < len) this[offset + index] = src[index++];
- };
- var $iterators = {
- entries: function entries() {
- return arrayEntries.call(validate(this));
- },
- keys: function keys() {
- return arrayKeys.call(validate(this));
- },
- values: function values() {
- return arrayValues.call(validate(this));
- }
- };
- var isTAIndex = function isTAIndex(target, key) {
- return isObject(target) && target[TYPED_ARRAY] && _typeof(key) != 'symbol' && key in target && String(+key) == String(key);
- };
- var $getDesc = function getOwnPropertyDescriptor(target, key) {
- return isTAIndex(target, key = toPrimitive(key, true)) ? propertyDesc(2, target[key]) : gOPD(target, key);
- };
- var $setDesc = function defineProperty(target, key, desc) {
- if (isTAIndex(target, key = toPrimitive(key, true)) && isObject(desc) && has(desc, 'value') && !has(desc, 'get') && !has(desc, 'set')
- // TODO: add validation descriptor w/o calling accessors
- && !desc.configurable && (!has(desc, 'writable') || desc.writable) && (!has(desc, 'enumerable') || desc.enumerable)) {
- target[key] = desc.value;
- return target;
- }
- return dP(target, key, desc);
- };
- if (!ALL_CONSTRUCTORS) {
- $GOPD.f = $getDesc;
- $DP.f = $setDesc;
- }
- $export($export.S + $export.F * !ALL_CONSTRUCTORS, 'Object', {
- getOwnPropertyDescriptor: $getDesc,
- defineProperty: $setDesc
- });
- if (fails(function () {
- arrayToString.call({});
- })) {
- arrayToString = arrayToLocaleString = function toString() {
- return arrayJoin.call(this);
- };
- }
- var $TypedArrayPrototype$ = redefineAll({}, proto);
- redefineAll($TypedArrayPrototype$, $iterators);
- hide($TypedArrayPrototype$, ITERATOR, $iterators.values);
- redefineAll($TypedArrayPrototype$, {
- slice: $slice,
- set: $set,
- constructor: function constructor() {/* noop */},
- toString: arrayToString,
- toLocaleString: $toLocaleString
- });
- addGetter($TypedArrayPrototype$, 'buffer', 'b');
- addGetter($TypedArrayPrototype$, 'byteOffset', 'o');
- addGetter($TypedArrayPrototype$, 'byteLength', 'l');
- addGetter($TypedArrayPrototype$, 'length', 'e');
- dP($TypedArrayPrototype$, TAG, {
- get: function get() {
- return this[TYPED_ARRAY];
- }
- });
- // eslint-disable-next-line max-statements
- module.exports = function (KEY, BYTES, wrapper, CLAMPED) {
- CLAMPED = !!CLAMPED;
- var NAME = KEY + (CLAMPED ? 'Clamped' : '') + 'Array';
- var GETTER = 'get' + KEY;
- var SETTER = 'set' + KEY;
- var TypedArray = global[NAME];
- var Base = TypedArray || {};
- var TAC = TypedArray && getPrototypeOf(TypedArray);
- var FORCED = !TypedArray || !$typed.ABV;
- var O = {};
- var TypedArrayPrototype = TypedArray && TypedArray[PROTOTYPE];
- var getter = function getter(that, index) {
- var data = that._d;
- return data.v[GETTER](index * BYTES + data.o, LITTLE_ENDIAN);
- };
- var setter = function setter(that, index, value) {
- var data = that._d;
- if (CLAMPED) value = (value = Math.round(value)) < 0 ? 0 : value > 0xff ? 0xff : value & 0xff;
- data.v[SETTER](index * BYTES + data.o, value, LITTLE_ENDIAN);
- };
- var addElement = function addElement(that, index) {
- dP(that, index, {
- get: function get() {
- return getter(this, index);
- },
- set: function set(value) {
- return setter(this, index, value);
- },
- enumerable: true
- });
- };
- if (FORCED) {
- TypedArray = wrapper(function (that, data, $offset, $length) {
- anInstance(that, TypedArray, NAME, '_d');
- var index = 0;
- var offset = 0;
- var buffer, byteLength, length, klass;
- if (!isObject(data)) {
- length = toIndex(data);
- byteLength = length * BYTES;
- buffer = new $ArrayBuffer(byteLength);
- } else if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
- buffer = data;
- offset = toOffset($offset, BYTES);
- var $len = data.byteLength;
- if ($length === undefined) {
- if ($len % BYTES) throw RangeError(WRONG_LENGTH);
- byteLength = $len - offset;
- if (byteLength < 0) throw RangeError(WRONG_LENGTH);
- } else {
- byteLength = toLength($length) * BYTES;
- if (byteLength + offset > $len) throw RangeError(WRONG_LENGTH);
- }
- length = byteLength / BYTES;
- } else if (TYPED_ARRAY in data) {
- return fromList(TypedArray, data);
- } else {
- return $from.call(TypedArray, data);
- }
- hide(that, '_d', {
- b: buffer,
- o: offset,
- l: byteLength,
- e: length,
- v: new $DataView(buffer)
- });
- while (index < length) addElement(that, index++);
- });
- TypedArrayPrototype = TypedArray[PROTOTYPE] = create($TypedArrayPrototype$);
- hide(TypedArrayPrototype, 'constructor', TypedArray);
- } else if (!fails(function () {
- TypedArray(1);
- }) || !fails(function () {
- new TypedArray(-1); // eslint-disable-line no-new
- }) || !$iterDetect(function (iter) {
- new TypedArray(); // eslint-disable-line no-new
- new TypedArray(null); // eslint-disable-line no-new
- new TypedArray(1.5); // eslint-disable-line no-new
- new TypedArray(iter); // eslint-disable-line no-new
- }, true)) {
- TypedArray = wrapper(function (that, data, $offset, $length) {
- anInstance(that, TypedArray, NAME);
- var klass;
- // `ws` module bug, temporarily remove validation length for Uint8Array
- // https://github.com/websockets/ws/pull/645
- if (!isObject(data)) return new Base(toIndex(data));
- if (data instanceof $ArrayBuffer || (klass = classof(data)) == ARRAY_BUFFER || klass == SHARED_BUFFER) {
- return $length !== undefined ? new Base(data, toOffset($offset, BYTES), $length) : $offset !== undefined ? new Base(data, toOffset($offset, BYTES)) : new Base(data);
- }
- if (TYPED_ARRAY in data) return fromList(TypedArray, data);
- return $from.call(TypedArray, data);
- });
- arrayForEach(TAC !== Function.prototype ? gOPN(Base).concat(gOPN(TAC)) : gOPN(Base), function (key) {
- if (!(key in TypedArray)) hide(TypedArray, key, Base[key]);
- });
- TypedArray[PROTOTYPE] = TypedArrayPrototype;
- if (!LIBRARY) TypedArrayPrototype.constructor = TypedArray;
- }
- var $nativeIterator = TypedArrayPrototype[ITERATOR];
- var CORRECT_ITER_NAME = !!$nativeIterator && ($nativeIterator.name == 'values' || $nativeIterator.name == undefined);
- var $iterator = $iterators.values;
- hide(TypedArray, TYPED_CONSTRUCTOR, true);
- hide(TypedArrayPrototype, TYPED_ARRAY, NAME);
- hide(TypedArrayPrototype, VIEW, true);
- hide(TypedArrayPrototype, DEF_CONSTRUCTOR, TypedArray);
- if (CLAMPED ? new TypedArray(1)[TAG] != NAME : !(TAG in TypedArrayPrototype)) {
- dP(TypedArrayPrototype, TAG, {
- get: function get() {
- return NAME;
- }
- });
- }
- O[NAME] = TypedArray;
- $export($export.G + $export.W + $export.F * (TypedArray != Base), O);
- $export($export.S, NAME, {
- BYTES_PER_ELEMENT: BYTES
- });
- $export($export.S + $export.F * fails(function () {
- Base.of.call(TypedArray, 1);
- }), NAME, {
- from: $from,
- of: $of
- });
- if (!(BYTES_PER_ELEMENT in TypedArrayPrototype)) hide(TypedArrayPrototype, BYTES_PER_ELEMENT, BYTES);
- $export($export.P, NAME, proto);
- setSpecies(NAME);
- $export($export.P + $export.F * FORCED_SET, NAME, {
- set: $set
- });
- $export($export.P + $export.F * !CORRECT_ITER_NAME, NAME, $iterators);
- if (!LIBRARY && TypedArrayPrototype.toString != arrayToString) TypedArrayPrototype.toString = arrayToString;
- $export($export.P + $export.F * fails(function () {
- new TypedArray(1).slice();
- }), NAME, {
- slice: $slice
- });
- $export($export.P + $export.F * (fails(function () {
- return [1, 2].toLocaleString() != new TypedArray([1, 2]).toLocaleString();
- }) || !fails(function () {
- TypedArrayPrototype.toLocaleString.call([1, 2]);
- })), NAME, {
- toLocaleString: $toLocaleString
- });
- Iterators[NAME] = CORRECT_ITER_NAME ? $nativeIterator : $iterator;
- if (!LIBRARY && !CORRECT_ITER_NAME) hide(TypedArrayPrototype, ITERATOR, $iterator);
- };
- } else module.exports = function () {/* empty */};
- /***/ }),
- /***/ 9782:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var DESCRIPTORS = __webpack_require__(4926);
- var LIBRARY = __webpack_require__(4219);
- var $typed = __webpack_require__(9161);
- var hide = __webpack_require__(8012);
- var redefineAll = __webpack_require__(7228);
- var fails = __webpack_require__(5810);
- var anInstance = __webpack_require__(2702);
- var toInteger = __webpack_require__(3230);
- var toLength = __webpack_require__(8315);
- var toIndex = __webpack_require__(3472);
- var gOPN = (__webpack_require__(2982).f);
- var dP = (__webpack_require__(4835).f);
- var arrayFill = __webpack_require__(1132);
- var setToStringTag = __webpack_require__(8094);
- var ARRAY_BUFFER = 'ArrayBuffer';
- var DATA_VIEW = 'DataView';
- var PROTOTYPE = 'prototype';
- var WRONG_LENGTH = 'Wrong length!';
- var WRONG_INDEX = 'Wrong index!';
- var $ArrayBuffer = global[ARRAY_BUFFER];
- var $DataView = global[DATA_VIEW];
- var Math = global.Math;
- var RangeError = global.RangeError;
- // eslint-disable-next-line no-shadow-restricted-names
- var Infinity = global.Infinity;
- var BaseBuffer = $ArrayBuffer;
- var abs = Math.abs;
- var pow = Math.pow;
- var floor = Math.floor;
- var log = Math.log;
- var LN2 = Math.LN2;
- var BUFFER = 'buffer';
- var BYTE_LENGTH = 'byteLength';
- var BYTE_OFFSET = 'byteOffset';
- var $BUFFER = DESCRIPTORS ? '_b' : BUFFER;
- var $LENGTH = DESCRIPTORS ? '_l' : BYTE_LENGTH;
- var $OFFSET = DESCRIPTORS ? '_o' : BYTE_OFFSET;
- // IEEE754 conversions based on https://github.com/feross/ieee754
- function packIEEE754(value, mLen, nBytes) {
- var buffer = new Array(nBytes);
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var rt = mLen === 23 ? pow(2, -24) - pow(2, -77) : 0;
- var i = 0;
- var s = value < 0 || value === 0 && 1 / value < 0 ? 1 : 0;
- var e, m, c;
- value = abs(value);
- // eslint-disable-next-line no-self-compare
- if (value != value || value === Infinity) {
- // eslint-disable-next-line no-self-compare
- m = value != value ? 1 : 0;
- e = eMax;
- } else {
- e = floor(log(value) / LN2);
- if (value * (c = pow(2, -e)) < 1) {
- e--;
- c *= 2;
- }
- if (e + eBias >= 1) {
- value += rt / c;
- } else {
- value += rt * pow(2, 1 - eBias);
- }
- if (value * c >= 2) {
- e++;
- c /= 2;
- }
- if (e + eBias >= eMax) {
- m = 0;
- e = eMax;
- } else if (e + eBias >= 1) {
- m = (value * c - 1) * pow(2, mLen);
- e = e + eBias;
- } else {
- m = value * pow(2, eBias - 1) * pow(2, mLen);
- e = 0;
- }
- }
- for (; mLen >= 8; buffer[i++] = m & 255, m /= 256, mLen -= 8);
- e = e << mLen | m;
- eLen += mLen;
- for (; eLen > 0; buffer[i++] = e & 255, e /= 256, eLen -= 8);
- buffer[--i] |= s * 128;
- return buffer;
- }
- function unpackIEEE754(buffer, mLen, nBytes) {
- var eLen = nBytes * 8 - mLen - 1;
- var eMax = (1 << eLen) - 1;
- var eBias = eMax >> 1;
- var nBits = eLen - 7;
- var i = nBytes - 1;
- var s = buffer[i--];
- var e = s & 127;
- var m;
- s >>= 7;
- for (; nBits > 0; e = e * 256 + buffer[i], i--, nBits -= 8);
- m = e & (1 << -nBits) - 1;
- e >>= -nBits;
- nBits += mLen;
- for (; nBits > 0; m = m * 256 + buffer[i], i--, nBits -= 8);
- if (e === 0) {
- e = 1 - eBias;
- } else if (e === eMax) {
- return m ? NaN : s ? -Infinity : Infinity;
- } else {
- m = m + pow(2, mLen);
- e = e - eBias;
- }
- return (s ? -1 : 1) * m * pow(2, e - mLen);
- }
- function unpackI32(bytes) {
- return bytes[3] << 24 | bytes[2] << 16 | bytes[1] << 8 | bytes[0];
- }
- function packI8(it) {
- return [it & 0xff];
- }
- function packI16(it) {
- return [it & 0xff, it >> 8 & 0xff];
- }
- function packI32(it) {
- return [it & 0xff, it >> 8 & 0xff, it >> 16 & 0xff, it >> 24 & 0xff];
- }
- function packF64(it) {
- return packIEEE754(it, 52, 8);
- }
- function packF32(it) {
- return packIEEE754(it, 23, 4);
- }
- function addGetter(C, key, internal) {
- dP(C[PROTOTYPE], key, {
- get: function get() {
- return this[internal];
- }
- });
- }
- function get(view, bytes, index, isLittleEndian) {
- var numIndex = +index;
- var intIndex = toIndex(numIndex);
- if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
- var store = view[$BUFFER]._b;
- var start = intIndex + view[$OFFSET];
- var pack = store.slice(start, start + bytes);
- return isLittleEndian ? pack : pack.reverse();
- }
- function set(view, bytes, index, conversion, value, isLittleEndian) {
- var numIndex = +index;
- var intIndex = toIndex(numIndex);
- if (intIndex + bytes > view[$LENGTH]) throw RangeError(WRONG_INDEX);
- var store = view[$BUFFER]._b;
- var start = intIndex + view[$OFFSET];
- var pack = conversion(+value);
- for (var i = 0; i < bytes; i++) store[start + i] = pack[isLittleEndian ? i : bytes - i - 1];
- }
- if (!$typed.ABV) {
- $ArrayBuffer = function ArrayBuffer(length) {
- anInstance(this, $ArrayBuffer, ARRAY_BUFFER);
- var byteLength = toIndex(length);
- this._b = arrayFill.call(new Array(byteLength), 0);
- this[$LENGTH] = byteLength;
- };
- $DataView = function DataView(buffer, byteOffset, byteLength) {
- anInstance(this, $DataView, DATA_VIEW);
- anInstance(buffer, $ArrayBuffer, DATA_VIEW);
- var bufferLength = buffer[$LENGTH];
- var offset = toInteger(byteOffset);
- if (offset < 0 || offset > bufferLength) throw RangeError('Wrong offset!');
- byteLength = byteLength === undefined ? bufferLength - offset : toLength(byteLength);
- if (offset + byteLength > bufferLength) throw RangeError(WRONG_LENGTH);
- this[$BUFFER] = buffer;
- this[$OFFSET] = offset;
- this[$LENGTH] = byteLength;
- };
- if (DESCRIPTORS) {
- addGetter($ArrayBuffer, BYTE_LENGTH, '_l');
- addGetter($DataView, BUFFER, '_b');
- addGetter($DataView, BYTE_LENGTH, '_l');
- addGetter($DataView, BYTE_OFFSET, '_o');
- }
- redefineAll($DataView[PROTOTYPE], {
- getInt8: function getInt8(byteOffset) {
- return get(this, 1, byteOffset)[0] << 24 >> 24;
- },
- getUint8: function getUint8(byteOffset) {
- return get(this, 1, byteOffset)[0];
- },
- getInt16: function getInt16(byteOffset /* , littleEndian */) {
- var bytes = get(this, 2, byteOffset, arguments[1]);
- return (bytes[1] << 8 | bytes[0]) << 16 >> 16;
- },
- getUint16: function getUint16(byteOffset /* , littleEndian */) {
- var bytes = get(this, 2, byteOffset, arguments[1]);
- return bytes[1] << 8 | bytes[0];
- },
- getInt32: function getInt32(byteOffset /* , littleEndian */) {
- return unpackI32(get(this, 4, byteOffset, arguments[1]));
- },
- getUint32: function getUint32(byteOffset /* , littleEndian */) {
- return unpackI32(get(this, 4, byteOffset, arguments[1])) >>> 0;
- },
- getFloat32: function getFloat32(byteOffset /* , littleEndian */) {
- return unpackIEEE754(get(this, 4, byteOffset, arguments[1]), 23, 4);
- },
- getFloat64: function getFloat64(byteOffset /* , littleEndian */) {
- return unpackIEEE754(get(this, 8, byteOffset, arguments[1]), 52, 8);
- },
- setInt8: function setInt8(byteOffset, value) {
- set(this, 1, byteOffset, packI8, value);
- },
- setUint8: function setUint8(byteOffset, value) {
- set(this, 1, byteOffset, packI8, value);
- },
- setInt16: function setInt16(byteOffset, value /* , littleEndian */) {
- set(this, 2, byteOffset, packI16, value, arguments[2]);
- },
- setUint16: function setUint16(byteOffset, value /* , littleEndian */) {
- set(this, 2, byteOffset, packI16, value, arguments[2]);
- },
- setInt32: function setInt32(byteOffset, value /* , littleEndian */) {
- set(this, 4, byteOffset, packI32, value, arguments[2]);
- },
- setUint32: function setUint32(byteOffset, value /* , littleEndian */) {
- set(this, 4, byteOffset, packI32, value, arguments[2]);
- },
- setFloat32: function setFloat32(byteOffset, value /* , littleEndian */) {
- set(this, 4, byteOffset, packF32, value, arguments[2]);
- },
- setFloat64: function setFloat64(byteOffset, value /* , littleEndian */) {
- set(this, 8, byteOffset, packF64, value, arguments[2]);
- }
- });
- } else {
- if (!fails(function () {
- $ArrayBuffer(1);
- }) || !fails(function () {
- new $ArrayBuffer(-1); // eslint-disable-line no-new
- }) || fails(function () {
- new $ArrayBuffer(); // eslint-disable-line no-new
- new $ArrayBuffer(1.5); // eslint-disable-line no-new
- new $ArrayBuffer(NaN); // eslint-disable-line no-new
- return $ArrayBuffer.name != ARRAY_BUFFER;
- })) {
- $ArrayBuffer = function ArrayBuffer(length) {
- anInstance(this, $ArrayBuffer);
- return new BaseBuffer(toIndex(length));
- };
- var ArrayBufferProto = $ArrayBuffer[PROTOTYPE] = BaseBuffer[PROTOTYPE];
- for (var keys = gOPN(BaseBuffer), j = 0, key; keys.length > j;) {
- if (!((key = keys[j++]) in $ArrayBuffer)) hide($ArrayBuffer, key, BaseBuffer[key]);
- }
- if (!LIBRARY) ArrayBufferProto.constructor = $ArrayBuffer;
- }
- // iOS Safari 7.x bug
- var view = new $DataView(new $ArrayBuffer(2));
- var $setInt8 = $DataView[PROTOTYPE].setInt8;
- view.setInt8(0, 2147483648);
- view.setInt8(1, 2147483649);
- if (view.getInt8(0) || !view.getInt8(1)) redefineAll($DataView[PROTOTYPE], {
- setInt8: function setInt8(byteOffset, value) {
- $setInt8.call(this, byteOffset, value << 24 >> 24);
- },
- setUint8: function setUint8(byteOffset, value) {
- $setInt8.call(this, byteOffset, value << 24 >> 24);
- }
- }, true);
- }
- setToStringTag($ArrayBuffer, ARRAY_BUFFER);
- setToStringTag($DataView, DATA_VIEW);
- hide($DataView[PROTOTYPE], $typed.VIEW, true);
- exports[ARRAY_BUFFER] = $ArrayBuffer;
- exports[DATA_VIEW] = $DataView;
- /***/ }),
- /***/ 9161:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var hide = __webpack_require__(8012);
- var uid = __webpack_require__(7936);
- var TYPED = uid('typed_array');
- var VIEW = uid('view');
- var ABV = !!(global.ArrayBuffer && global.DataView);
- var CONSTR = ABV;
- var i = 0;
- var l = 9;
- var Typed;
- var TypedArrayConstructors = 'Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array'.split(',');
- while (i < l) {
- if (Typed = global[TypedArrayConstructors[i++]]) {
- hide(Typed.prototype, TYPED, true);
- hide(Typed.prototype, VIEW, true);
- } else CONSTR = false;
- }
- module.exports = {
- ABV: ABV,
- CONSTR: CONSTR,
- TYPED: TYPED,
- VIEW: VIEW
- };
- /***/ }),
- /***/ 7936:
- /***/ ((module) => {
- var id = 0;
- var px = Math.random();
- module.exports = function (key) {
- return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
- };
- /***/ }),
- /***/ 851:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var navigator = global.navigator;
- module.exports = navigator && navigator.userAgent || '';
- /***/ }),
- /***/ 8546:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var isObject = __webpack_require__(7156);
- module.exports = function (it, TYPE) {
- if (!isObject(it) || it._t !== TYPE) throw TypeError('Incompatible receiver, ' + TYPE + ' required!');
- return it;
- };
- /***/ }),
- /***/ 5721:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var core = __webpack_require__(8544);
- var LIBRARY = __webpack_require__(4219);
- var wksExt = __webpack_require__(9078);
- var defineProperty = (__webpack_require__(4835).f);
- module.exports = function (name) {
- var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
- if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, {
- value: wksExt.f(name)
- });
- };
- /***/ }),
- /***/ 9078:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- exports.f = __webpack_require__(3336);
- /***/ }),
- /***/ 3336:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var store = __webpack_require__(3192)('wks');
- var uid = __webpack_require__(7936);
- var _Symbol = (__webpack_require__(7381).Symbol);
- var USE_SYMBOL = typeof _Symbol == 'function';
- var $exports = module.exports = function (name) {
- return store[name] || (store[name] = USE_SYMBOL && _Symbol[name] || (USE_SYMBOL ? _Symbol : uid)('Symbol.' + name));
- };
- $exports.store = store;
- /***/ }),
- /***/ 7637:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var classof = __webpack_require__(2858);
- var ITERATOR = __webpack_require__(3336)('iterator');
- var Iterators = __webpack_require__(5301);
- module.exports = (__webpack_require__(8544).getIteratorMethod) = function (it) {
- if (it != undefined) return it[ITERATOR] || it['@@iterator'] || Iterators[classof(it)];
- };
- /***/ }),
- /***/ 9122:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/benjamingr/RexExp.escape
- var $export = __webpack_require__(5913);
- var $re = __webpack_require__(6813)(/[\\^$*+?.()|[\]{}]/g, '\\$&');
- $export($export.S, 'RegExp', {
- escape: function escape(it) {
- return $re(it);
- }
- });
- /***/ }),
- /***/ 4611:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.3 Array.prototype.copyWithin(target, start, end = this.length)
- var $export = __webpack_require__(5913);
- $export($export.P, 'Array', {
- copyWithin: __webpack_require__(2147)
- });
- __webpack_require__(4339)('copyWithin');
- /***/ }),
- /***/ 9892:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $every = __webpack_require__(3970)(4);
- $export($export.P + $export.F * !__webpack_require__(1411)([].every, true), 'Array', {
- // 22.1.3.5 / 15.4.4.16 Array.prototype.every(callbackfn [, thisArg])
- every: function every(callbackfn /* , thisArg */) {
- return $every(this, callbackfn, arguments[1]);
- }
- });
- /***/ }),
- /***/ 9217:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.6 Array.prototype.fill(value, start = 0, end = this.length)
- var $export = __webpack_require__(5913);
- $export($export.P, 'Array', {
- fill: __webpack_require__(1132)
- });
- __webpack_require__(4339)('fill');
- /***/ }),
- /***/ 9355:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $filter = __webpack_require__(3970)(2);
- $export($export.P + $export.F * !__webpack_require__(1411)([].filter, true), 'Array', {
- // 22.1.3.7 / 15.4.4.20 Array.prototype.filter(callbackfn [, thisArg])
- filter: function filter(callbackfn /* , thisArg */) {
- return $filter(this, callbackfn, arguments[1]);
- }
- });
- /***/ }),
- /***/ 109:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.9 Array.prototype.findIndex(predicate, thisArg = undefined)
- var $export = __webpack_require__(5913);
- var $find = __webpack_require__(3970)(6);
- var KEY = 'findIndex';
- var forced = true;
- // Shouldn't skip holes
- if (KEY in []) Array(1)[KEY](function () {
- forced = false;
- });
- $export($export.P + $export.F * forced, 'Array', {
- findIndex: function findIndex(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- __webpack_require__(4339)(KEY);
- /***/ }),
- /***/ 4138:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.8 Array.prototype.find(predicate, thisArg = undefined)
- var $export = __webpack_require__(5913);
- var $find = __webpack_require__(3970)(5);
- var KEY = 'find';
- var forced = true;
- // Shouldn't skip holes
- if (KEY in []) Array(1)[KEY](function () {
- forced = false;
- });
- $export($export.P + $export.F * forced, 'Array', {
- find: function find(callbackfn /* , that = undefined */) {
- return $find(this, callbackfn, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- __webpack_require__(4339)(KEY);
- /***/ }),
- /***/ 791:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $forEach = __webpack_require__(3970)(0);
- var STRICT = __webpack_require__(1411)([].forEach, true);
- $export($export.P + $export.F * !STRICT, 'Array', {
- // 22.1.3.10 / 15.4.4.18 Array.prototype.forEach(callbackfn [, thisArg])
- forEach: function forEach(callbackfn /* , thisArg */) {
- return $forEach(this, callbackfn, arguments[1]);
- }
- });
- /***/ }),
- /***/ 8671:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var ctx = __webpack_require__(566);
- var $export = __webpack_require__(5913);
- var toObject = __webpack_require__(2515);
- var call = __webpack_require__(2471);
- var isArrayIter = __webpack_require__(7063);
- var toLength = __webpack_require__(8315);
- var createProperty = __webpack_require__(1348);
- var getIterFn = __webpack_require__(7637);
- $export($export.S + $export.F * !__webpack_require__(5508)(function (iter) {
- Array.from(iter);
- }), 'Array', {
- // 22.1.2.1 Array.from(arrayLike, mapfn = undefined, thisArg = undefined)
- from: function from(arrayLike /* , mapfn = undefined, thisArg = undefined */) {
- var O = toObject(arrayLike);
- var C = typeof this == 'function' ? this : Array;
- var aLen = arguments.length;
- var mapfn = aLen > 1 ? arguments[1] : undefined;
- var mapping = mapfn !== undefined;
- var index = 0;
- var iterFn = getIterFn(O);
- var length, result, step, iterator;
- if (mapping) mapfn = ctx(mapfn, aLen > 2 ? arguments[2] : undefined, 2);
- // if object isn't iterable or it's array with default iterator - use simple case
- if (iterFn != undefined && !(C == Array && isArrayIter(iterFn))) {
- for (iterator = iterFn.call(O), result = new C(); !(step = iterator.next()).done; index++) {
- createProperty(result, index, mapping ? call(iterator, mapfn, [step.value, index], true) : step.value);
- }
- } else {
- length = toLength(O.length);
- for (result = new C(length); length > index; index++) {
- createProperty(result, index, mapping ? mapfn(O[index], index) : O[index]);
- }
- }
- result.length = index;
- return result;
- }
- });
- /***/ }),
- /***/ 4751:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $indexOf = __webpack_require__(4687)(false);
- var $native = [].indexOf;
- var NEGATIVE_ZERO = !!$native && 1 / [1].indexOf(1, -0) < 0;
- $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(1411)($native)), 'Array', {
- // 22.1.3.11 / 15.4.4.14 Array.prototype.indexOf(searchElement [, fromIndex])
- indexOf: function indexOf(searchElement /* , fromIndex = 0 */) {
- return NEGATIVE_ZERO
- // convert -0 to +0
- ? $native.apply(this, arguments) || 0 : $indexOf(this, searchElement, arguments[1]);
- }
- });
- /***/ }),
- /***/ 1621:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.2.2 / 15.4.3.2 Array.isArray(arg)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Array', {
- isArray: __webpack_require__(1320)
- });
- /***/ }),
- /***/ 4806:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var addToUnscopables = __webpack_require__(4339);
- var step = __webpack_require__(7218);
- var Iterators = __webpack_require__(5301);
- var toIObject = __webpack_require__(8499);
- // 22.1.3.4 Array.prototype.entries()
- // 22.1.3.13 Array.prototype.keys()
- // 22.1.3.29 Array.prototype.values()
- // 22.1.3.30 Array.prototype[@@iterator]()
- module.exports = __webpack_require__(4873)(Array, 'Array', function (iterated, kind) {
- this._t = toIObject(iterated); // target
- this._i = 0; // next index
- this._k = kind; // kind
- // 22.1.5.2.1 %ArrayIteratorPrototype%.next()
- }, function () {
- var O = this._t;
- var kind = this._k;
- var index = this._i++;
- if (!O || index >= O.length) {
- this._t = undefined;
- return step(1);
- }
- if (kind == 'keys') return step(0, index);
- if (kind == 'values') return step(0, O[index]);
- return step(0, [index, O[index]]);
- }, 'values');
- // argumentsList[@@iterator] is %ArrayProto_values% (9.4.4.6, 9.4.4.7)
- Iterators.Arguments = Iterators.Array;
- addToUnscopables('keys');
- addToUnscopables('values');
- addToUnscopables('entries');
- /***/ }),
- /***/ 9437:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 22.1.3.13 Array.prototype.join(separator)
- var $export = __webpack_require__(5913);
- var toIObject = __webpack_require__(8499);
- var arrayJoin = [].join;
- // fallback for not array-like strings
- $export($export.P + $export.F * (__webpack_require__(331) != Object || !__webpack_require__(1411)(arrayJoin)), 'Array', {
- join: function join(separator) {
- return arrayJoin.call(toIObject(this), separator === undefined ? ',' : separator);
- }
- });
- /***/ }),
- /***/ 9822:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toIObject = __webpack_require__(8499);
- var toInteger = __webpack_require__(3230);
- var toLength = __webpack_require__(8315);
- var $native = [].lastIndexOf;
- var NEGATIVE_ZERO = !!$native && 1 / [1].lastIndexOf(1, -0) < 0;
- $export($export.P + $export.F * (NEGATIVE_ZERO || !__webpack_require__(1411)($native)), 'Array', {
- // 22.1.3.14 / 15.4.4.15 Array.prototype.lastIndexOf(searchElement [, fromIndex])
- lastIndexOf: function lastIndexOf(searchElement /* , fromIndex = @[*-1] */) {
- // convert -0 to +0
- if (NEGATIVE_ZERO) return $native.apply(this, arguments) || 0;
- var O = toIObject(this);
- var length = toLength(O.length);
- var index = length - 1;
- if (arguments.length > 1) index = Math.min(index, toInteger(arguments[1]));
- if (index < 0) index = length + index;
- for (; index >= 0; index--) if (index in O) if (O[index] === searchElement) return index || 0;
- return -1;
- }
- });
- /***/ }),
- /***/ 633:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $map = __webpack_require__(3970)(1);
- $export($export.P + $export.F * !__webpack_require__(1411)([].map, true), 'Array', {
- // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])
- map: function map(callbackfn /* , thisArg */) {
- return $map(this, callbackfn, arguments[1]);
- }
- });
- /***/ }),
- /***/ 6705:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var createProperty = __webpack_require__(1348);
- // WebKit Array.of isn't generic
- $export($export.S + $export.F * __webpack_require__(5810)(function () {
- function F() {/* empty */}
- return !(Array.of.call(F) instanceof F);
- }), 'Array', {
- // 22.1.2.3 Array.of( ...items)
- of: function of( /* ...args */
- ) {
- var index = 0;
- var aLen = arguments.length;
- var result = new (typeof this == 'function' ? this : Array)(aLen);
- while (aLen > index) createProperty(result, index, arguments[index++]);
- result.length = aLen;
- return result;
- }
- });
- /***/ }),
- /***/ 8738:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $reduce = __webpack_require__(6419);
- $export($export.P + $export.F * !__webpack_require__(1411)([].reduceRight, true), 'Array', {
- // 22.1.3.19 / 15.4.4.22 Array.prototype.reduceRight(callbackfn [, initialValue])
- reduceRight: function reduceRight(callbackfn /* , initialValue */) {
- return $reduce(this, callbackfn, arguments.length, arguments[1], true);
- }
- });
- /***/ }),
- /***/ 9121:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $reduce = __webpack_require__(6419);
- $export($export.P + $export.F * !__webpack_require__(1411)([].reduce, true), 'Array', {
- // 22.1.3.18 / 15.4.4.21 Array.prototype.reduce(callbackfn [, initialValue])
- reduce: function reduce(callbackfn /* , initialValue */) {
- return $reduce(this, callbackfn, arguments.length, arguments[1], false);
- }
- });
- /***/ }),
- /***/ 7263:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var html = __webpack_require__(1225);
- var cof = __webpack_require__(3679);
- var toAbsoluteIndex = __webpack_require__(6241);
- var toLength = __webpack_require__(8315);
- var arraySlice = [].slice;
- // fallback for not array-like ES3 strings and DOM objects
- $export($export.P + $export.F * __webpack_require__(5810)(function () {
- if (html) arraySlice.call(html);
- }), 'Array', {
- slice: function slice(begin, end) {
- var len = toLength(this.length);
- var klass = cof(this);
- end = end === undefined ? len : end;
- if (klass == 'Array') return arraySlice.call(this, begin, end);
- var start = toAbsoluteIndex(begin, len);
- var upTo = toAbsoluteIndex(end, len);
- var size = toLength(upTo - start);
- var cloned = new Array(size);
- var i = 0;
- for (; i < size; i++) cloned[i] = klass == 'String' ? this.charAt(start + i) : this[start + i];
- return cloned;
- }
- });
- /***/ }),
- /***/ 9253:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $some = __webpack_require__(3970)(3);
- $export($export.P + $export.F * !__webpack_require__(1411)([].some, true), 'Array', {
- // 22.1.3.23 / 15.4.4.17 Array.prototype.some(callbackfn [, thisArg])
- some: function some(callbackfn /* , thisArg */) {
- return $some(this, callbackfn, arguments[1]);
- }
- });
- /***/ }),
- /***/ 919:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var aFunction = __webpack_require__(6819);
- var toObject = __webpack_require__(2515);
- var fails = __webpack_require__(5810);
- var $sort = [].sort;
- var test = [1, 2, 3];
- $export($export.P + $export.F * (fails(function () {
- // IE8-
- test.sort(undefined);
- }) || !fails(function () {
- // V8 bug
- test.sort(null);
- // Old WebKit
- }) || !__webpack_require__(1411)($sort)), 'Array', {
- // 22.1.3.25 Array.prototype.sort(comparefn)
- sort: function sort(comparefn) {
- return comparefn === undefined ? $sort.call(toObject(this)) : $sort.call(toObject(this), aFunction(comparefn));
- }
- });
- /***/ }),
- /***/ 3821:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(4798)('Array');
- /***/ }),
- /***/ 8384:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.3.3.1 / 15.9.4.4 Date.now()
- var $export = __webpack_require__(5913);
- $export($export.S, 'Date', {
- now: function now() {
- return new Date().getTime();
- }
- });
- /***/ }),
- /***/ 9701:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.3.4.36 / 15.9.5.43 Date.prototype.toISOString()
- var $export = __webpack_require__(5913);
- var toISOString = __webpack_require__(2115);
- // PhantomJS / old WebKit has a broken implementations
- $export($export.P + $export.F * (Date.prototype.toISOString !== toISOString), 'Date', {
- toISOString: toISOString
- });
- /***/ }),
- /***/ 2334:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toObject = __webpack_require__(2515);
- var toPrimitive = __webpack_require__(8537);
- $export($export.P + $export.F * __webpack_require__(5810)(function () {
- return new Date(NaN).toJSON() !== null || Date.prototype.toJSON.call({
- toISOString: function toISOString() {
- return 1;
- }
- }) !== 1;
- }), 'Date', {
- // eslint-disable-next-line no-unused-vars
- toJSON: function toJSON(key) {
- var O = toObject(this);
- var pv = toPrimitive(O);
- return typeof pv == 'number' && !isFinite(pv) ? null : O.toISOString();
- }
- });
- /***/ }),
- /***/ 3233:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var TO_PRIMITIVE = __webpack_require__(3336)('toPrimitive');
- var proto = Date.prototype;
- if (!(TO_PRIMITIVE in proto)) __webpack_require__(8012)(proto, TO_PRIMITIVE, __webpack_require__(296));
- /***/ }),
- /***/ 1325:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var DateProto = Date.prototype;
- var INVALID_DATE = 'Invalid Date';
- var TO_STRING = 'toString';
- var $toString = DateProto[TO_STRING];
- var getTime = DateProto.getTime;
- if (new Date(NaN) + '' != INVALID_DATE) {
- __webpack_require__(7278)(DateProto, TO_STRING, function toString() {
- var value = getTime.call(this);
- // eslint-disable-next-line no-self-compare
- return value === value ? $toString.call(this) : INVALID_DATE;
- });
- }
- /***/ }),
- /***/ 161:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.2.3.2 / 15.3.4.5 Function.prototype.bind(thisArg, args...)
- var $export = __webpack_require__(5913);
- $export($export.P, 'Function', {
- bind: __webpack_require__(8327)
- });
- /***/ }),
- /***/ 15:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var isObject = __webpack_require__(7156);
- var getPrototypeOf = __webpack_require__(4153);
- var HAS_INSTANCE = __webpack_require__(3336)('hasInstance');
- var FunctionProto = Function.prototype;
- // 19.2.3.6 Function.prototype[@@hasInstance](V)
- if (!(HAS_INSTANCE in FunctionProto)) (__webpack_require__(4835).f)(FunctionProto, HAS_INSTANCE, {
- value: function value(O) {
- if (typeof this != 'function' || !isObject(O)) return false;
- if (!isObject(this.prototype)) return O instanceof this;
- // for environment w/o native `@@hasInstance` logic enough `instanceof`, but add this:
- while (O = getPrototypeOf(O)) if (this.prototype === O) return true;
- return false;
- }
- });
- /***/ }),
- /***/ 6042:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var dP = (__webpack_require__(4835).f);
- var FProto = Function.prototype;
- var nameRE = /^\s*function ([^ (]*)/;
- var NAME = 'name';
- // 19.2.4.2 name
- NAME in FProto || __webpack_require__(4926) && dP(FProto, NAME, {
- configurable: true,
- get: function get() {
- try {
- return ('' + this).match(nameRE)[1];
- } catch (e) {
- return '';
- }
- }
- });
- /***/ }),
- /***/ 8969:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var strong = __webpack_require__(4396);
- var validate = __webpack_require__(8546);
- var MAP = 'Map';
- // 23.1 Map Objects
- module.exports = __webpack_require__(1966)(MAP, function (get) {
- return function Map() {
- return get(this, arguments.length > 0 ? arguments[0] : undefined);
- };
- }, {
- // 23.1.3.6 Map.prototype.get(key)
- get: function get(key) {
- var entry = strong.getEntry(validate(this, MAP), key);
- return entry && entry.v;
- },
- // 23.1.3.9 Map.prototype.set(key, value)
- set: function set(key, value) {
- return strong.def(validate(this, MAP), key === 0 ? 0 : key, value);
- }
- }, strong, true);
- /***/ }),
- /***/ 4717:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.3 Math.acosh(x)
- var $export = __webpack_require__(5913);
- var log1p = __webpack_require__(5447);
- var sqrt = Math.sqrt;
- var $acosh = Math.acosh;
- $export($export.S + $export.F * !($acosh
- // V8 bug: https://code.google.com/p/v8/issues/detail?id=3509
- && Math.floor($acosh(Number.MAX_VALUE)) == 710
- // Tor Browser bug: Math.acosh(Infinity) -> NaN
- && $acosh(Infinity) == Infinity), 'Math', {
- acosh: function acosh(x) {
- return (x = +x) < 1 ? NaN : x > 94906265.62425156 ? Math.log(x) + Math.LN2 : log1p(x - 1 + sqrt(x - 1) * sqrt(x + 1));
- }
- });
- /***/ }),
- /***/ 7292:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.5 Math.asinh(x)
- var $export = __webpack_require__(5913);
- var $asinh = Math.asinh;
- function asinh(x) {
- return !isFinite(x = +x) || x == 0 ? x : x < 0 ? -asinh(-x) : Math.log(x + Math.sqrt(x * x + 1));
- }
- // Tor Browser bug: Math.asinh(0) -> -0
- $export($export.S + $export.F * !($asinh && 1 / $asinh(0) > 0), 'Math', {
- asinh: asinh
- });
- /***/ }),
- /***/ 1840:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.7 Math.atanh(x)
- var $export = __webpack_require__(5913);
- var $atanh = Math.atanh;
- // Tor Browser bug: Math.atanh(-0) -> 0
- $export($export.S + $export.F * !($atanh && 1 / $atanh(-0) < 0), 'Math', {
- atanh: function atanh(x) {
- return (x = +x) == 0 ? x : Math.log((1 + x) / (1 - x)) / 2;
- }
- });
- /***/ }),
- /***/ 3255:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.9 Math.cbrt(x)
- var $export = __webpack_require__(5913);
- var sign = __webpack_require__(4012);
- $export($export.S, 'Math', {
- cbrt: function cbrt(x) {
- return sign(x = +x) * Math.pow(Math.abs(x), 1 / 3);
- }
- });
- /***/ }),
- /***/ 5728:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.11 Math.clz32(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- clz32: function clz32(x) {
- return (x >>>= 0) ? 31 - Math.floor(Math.log(x + 0.5) * Math.LOG2E) : 32;
- }
- });
- /***/ }),
- /***/ 6255:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.12 Math.cosh(x)
- var $export = __webpack_require__(5913);
- var exp = Math.exp;
- $export($export.S, 'Math', {
- cosh: function cosh(x) {
- return (exp(x = +x) + exp(-x)) / 2;
- }
- });
- /***/ }),
- /***/ 2834:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.14 Math.expm1(x)
- var $export = __webpack_require__(5913);
- var $expm1 = __webpack_require__(4774);
- $export($export.S + $export.F * ($expm1 != Math.expm1), 'Math', {
- expm1: $expm1
- });
- /***/ }),
- /***/ 4489:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.16 Math.fround(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- fround: __webpack_require__(3800)
- });
- /***/ }),
- /***/ 575:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.17 Math.hypot([value1[, value2[, … ]]])
- var $export = __webpack_require__(5913);
- var abs = Math.abs;
- $export($export.S, 'Math', {
- hypot: function hypot(value1, value2) {
- // eslint-disable-line no-unused-vars
- var sum = 0;
- var i = 0;
- var aLen = arguments.length;
- var larg = 0;
- var arg, div;
- while (i < aLen) {
- arg = abs(arguments[i++]);
- if (larg < arg) {
- div = larg / arg;
- sum = sum * div * div + 1;
- larg = arg;
- } else if (arg > 0) {
- div = arg / larg;
- sum += div * div;
- } else sum += arg;
- }
- return larg === Infinity ? Infinity : larg * Math.sqrt(sum);
- }
- });
- /***/ }),
- /***/ 1369:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.18 Math.imul(x, y)
- var $export = __webpack_require__(5913);
- var $imul = Math.imul;
- // some WebKit versions fails with big numbers, some has wrong arity
- $export($export.S + $export.F * __webpack_require__(5810)(function () {
- return $imul(0xffffffff, 5) != -5 || $imul.length != 2;
- }), 'Math', {
- imul: function imul(x, y) {
- var UINT16 = 0xffff;
- var xn = +x;
- var yn = +y;
- var xl = UINT16 & xn;
- var yl = UINT16 & yn;
- return 0 | xl * yl + ((UINT16 & xn >>> 16) * yl + xl * (UINT16 & yn >>> 16) << 16 >>> 0);
- }
- });
- /***/ }),
- /***/ 2751:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.21 Math.log10(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- log10: function log10(x) {
- return Math.log(x) * Math.LOG10E;
- }
- });
- /***/ }),
- /***/ 9617:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.20 Math.log1p(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- log1p: __webpack_require__(5447)
- });
- /***/ }),
- /***/ 3656:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.22 Math.log2(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- log2: function log2(x) {
- return Math.log(x) / Math.LN2;
- }
- });
- /***/ }),
- /***/ 1850:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.28 Math.sign(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- sign: __webpack_require__(4012)
- });
- /***/ }),
- /***/ 5424:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.30 Math.sinh(x)
- var $export = __webpack_require__(5913);
- var expm1 = __webpack_require__(4774);
- var exp = Math.exp;
- // V8 near Chromium 38 has a problem with very small numbers
- $export($export.S + $export.F * __webpack_require__(5810)(function () {
- return !Math.sinh(-2e-17) != -2e-17;
- }), 'Math', {
- sinh: function sinh(x) {
- return Math.abs(x = +x) < 1 ? (expm1(x) - expm1(-x)) / 2 : (exp(x - 1) - exp(-x - 1)) * (Math.E / 2);
- }
- });
- /***/ }),
- /***/ 230:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.33 Math.tanh(x)
- var $export = __webpack_require__(5913);
- var expm1 = __webpack_require__(4774);
- var exp = Math.exp;
- $export($export.S, 'Math', {
- tanh: function tanh(x) {
- var a = expm1(x = +x);
- var b = expm1(-x);
- return a == Infinity ? 1 : b == Infinity ? -1 : (a - b) / (exp(x) + exp(-x));
- }
- });
- /***/ }),
- /***/ 8471:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.2.2.34 Math.trunc(x)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- trunc: function trunc(it) {
- return (it > 0 ? Math.floor : Math.ceil)(it);
- }
- });
- /***/ }),
- /***/ 440:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var has = __webpack_require__(5389);
- var cof = __webpack_require__(3679);
- var inheritIfRequired = __webpack_require__(3654);
- var toPrimitive = __webpack_require__(8537);
- var fails = __webpack_require__(5810);
- var gOPN = (__webpack_require__(2982).f);
- var gOPD = (__webpack_require__(3299).f);
- var dP = (__webpack_require__(4835).f);
- var $trim = (__webpack_require__(618).trim);
- var NUMBER = 'Number';
- var $Number = global[NUMBER];
- var Base = $Number;
- var proto = $Number.prototype;
- // Opera ~12 has broken Object#toString
- var BROKEN_COF = cof(__webpack_require__(4275)(proto)) == NUMBER;
- var TRIM = ('trim' in String.prototype);
- // 7.1.3 ToNumber(argument)
- var toNumber = function toNumber(argument) {
- var it = toPrimitive(argument, false);
- if (typeof it == 'string' && it.length > 2) {
- it = TRIM ? it.trim() : $trim(it, 3);
- var first = it.charCodeAt(0);
- var third, radix, maxCode;
- if (first === 43 || first === 45) {
- third = it.charCodeAt(2);
- if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
- } else if (first === 48) {
- switch (it.charCodeAt(1)) {
- case 66:
- case 98:
- radix = 2;
- maxCode = 49;
- break;
- // fast equal /^0b[01]+$/i
- case 79:
- case 111:
- radix = 8;
- maxCode = 55;
- break;
- // fast equal /^0o[0-7]+$/i
- default:
- return +it;
- }
- for (var digits = it.slice(2), i = 0, l = digits.length, code; i < l; i++) {
- code = digits.charCodeAt(i);
- // parseInt parses a string to a first unavailable symbol
- // but ToNumber should return NaN if a string contains unavailable symbols
- if (code < 48 || code > maxCode) return NaN;
- }
- return parseInt(digits, radix);
- }
- }
- return +it;
- };
- if (!$Number(' 0o1') || !$Number('0b1') || $Number('+0x1')) {
- $Number = function Number(value) {
- var it = arguments.length < 1 ? 0 : value;
- var that = this;
- return that instanceof $Number
- // check on 1..constructor(foo) case
- && (BROKEN_COF ? fails(function () {
- proto.valueOf.call(that);
- }) : cof(that) != NUMBER) ? inheritIfRequired(new Base(toNumber(it)), that, $Number) : toNumber(it);
- };
- for (var keys = __webpack_require__(4926) ? gOPN(Base) : (
- // ES3:
- 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
- // ES6 (in case, if modules with ES6 Number statics required before):
- 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' + 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger').split(','), j = 0, key; keys.length > j; j++) {
- if (has(Base, key = keys[j]) && !has($Number, key)) {
- dP($Number, key, gOPD(Base, key));
- }
- }
- $Number.prototype = proto;
- proto.constructor = $Number;
- __webpack_require__(7278)(global, NUMBER, $Number);
- }
- /***/ }),
- /***/ 1914:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.1 Number.EPSILON
- var $export = __webpack_require__(5913);
- $export($export.S, 'Number', {
- EPSILON: Math.pow(2, -52)
- });
- /***/ }),
- /***/ 4117:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.2 Number.isFinite(number)
- var $export = __webpack_require__(5913);
- var _isFinite = (__webpack_require__(7381).isFinite);
- $export($export.S, 'Number', {
- isFinite: function isFinite(it) {
- return typeof it == 'number' && _isFinite(it);
- }
- });
- /***/ }),
- /***/ 9619:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.3 Number.isInteger(number)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Number', {
- isInteger: __webpack_require__(5127)
- });
- /***/ }),
- /***/ 5849:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.4 Number.isNaN(number)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Number', {
- isNaN: function isNaN(number) {
- // eslint-disable-next-line no-self-compare
- return number != number;
- }
- });
- /***/ }),
- /***/ 4750:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.5 Number.isSafeInteger(number)
- var $export = __webpack_require__(5913);
- var isInteger = __webpack_require__(5127);
- var abs = Math.abs;
- $export($export.S, 'Number', {
- isSafeInteger: function isSafeInteger(number) {
- return isInteger(number) && abs(number) <= 0x1fffffffffffff;
- }
- });
- /***/ }),
- /***/ 1550:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.6 Number.MAX_SAFE_INTEGER
- var $export = __webpack_require__(5913);
- $export($export.S, 'Number', {
- MAX_SAFE_INTEGER: 0x1fffffffffffff
- });
- /***/ }),
- /***/ 3529:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 20.1.2.10 Number.MIN_SAFE_INTEGER
- var $export = __webpack_require__(5913);
- $export($export.S, 'Number', {
- MIN_SAFE_INTEGER: -0x1fffffffffffff
- });
- /***/ }),
- /***/ 2791:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $parseFloat = __webpack_require__(5031);
- // 20.1.2.12 Number.parseFloat(string)
- $export($export.S + $export.F * (Number.parseFloat != $parseFloat), 'Number', {
- parseFloat: $parseFloat
- });
- /***/ }),
- /***/ 6831:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $parseInt = __webpack_require__(6971);
- // 20.1.2.13 Number.parseInt(string, radix)
- $export($export.S + $export.F * (Number.parseInt != $parseInt), 'Number', {
- parseInt: $parseInt
- });
- /***/ }),
- /***/ 1077:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toInteger = __webpack_require__(3230);
- var aNumberValue = __webpack_require__(9855);
- var repeat = __webpack_require__(1924);
- var $toFixed = 1.0.toFixed;
- var floor = Math.floor;
- var data = [0, 0, 0, 0, 0, 0];
- var ERROR = 'Number.toFixed: incorrect invocation!';
- var ZERO = '0';
- var multiply = function multiply(n, c) {
- var i = -1;
- var c2 = c;
- while (++i < 6) {
- c2 += n * data[i];
- data[i] = c2 % 1e7;
- c2 = floor(c2 / 1e7);
- }
- };
- var divide = function divide(n) {
- var i = 6;
- var c = 0;
- while (--i >= 0) {
- c += data[i];
- data[i] = floor(c / n);
- c = c % n * 1e7;
- }
- };
- var numToString = function numToString() {
- var i = 6;
- var s = '';
- while (--i >= 0) {
- if (s !== '' || i === 0 || data[i] !== 0) {
- var t = String(data[i]);
- s = s === '' ? t : s + repeat.call(ZERO, 7 - t.length) + t;
- }
- }
- return s;
- };
- var pow = function pow(x, n, acc) {
- return n === 0 ? acc : n % 2 === 1 ? pow(x, n - 1, acc * x) : pow(x * x, n / 2, acc);
- };
- var log = function log(x) {
- var n = 0;
- var x2 = x;
- while (x2 >= 4096) {
- n += 12;
- x2 /= 4096;
- }
- while (x2 >= 2) {
- n += 1;
- x2 /= 2;
- }
- return n;
- };
- $export($export.P + $export.F * (!!$toFixed && (0.00008.toFixed(3) !== '0.000' || 0.9.toFixed(0) !== '1' || 1.255.toFixed(2) !== '1.25' || 1000000000000000128.0.toFixed(0) !== '1000000000000000128') || !__webpack_require__(5810)(function () {
- // V8 ~ Android 4.3-
- $toFixed.call({});
- })), 'Number', {
- toFixed: function toFixed(fractionDigits) {
- var x = aNumberValue(this, ERROR);
- var f = toInteger(fractionDigits);
- var s = '';
- var m = ZERO;
- var e, z, j, k;
- if (f < 0 || f > 20) throw RangeError(ERROR);
- // eslint-disable-next-line no-self-compare
- if (x != x) return 'NaN';
- if (x <= -1e21 || x >= 1e21) return String(x);
- if (x < 0) {
- s = '-';
- x = -x;
- }
- if (x > 1e-21) {
- e = log(x * pow(2, 69, 1)) - 69;
- z = e < 0 ? x * pow(2, -e, 1) : x / pow(2, e, 1);
- z *= 0x10000000000000;
- e = 52 - e;
- if (e > 0) {
- multiply(0, z);
- j = f;
- while (j >= 7) {
- multiply(1e7, 0);
- j -= 7;
- }
- multiply(pow(10, j, 1), 0);
- j = e - 1;
- while (j >= 23) {
- divide(1 << 23);
- j -= 23;
- }
- divide(1 << j);
- multiply(1, 1);
- divide(2);
- m = numToString();
- } else {
- multiply(0, z);
- multiply(1 << -e, 0);
- m = numToString() + repeat.call(ZERO, f);
- }
- }
- if (f > 0) {
- k = m.length;
- m = s + (k <= f ? '0.' + repeat.call(ZERO, f - k) + m : m.slice(0, k - f) + '.' + m.slice(k - f));
- } else {
- m = s + m;
- }
- return m;
- }
- });
- /***/ }),
- /***/ 820:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $fails = __webpack_require__(5810);
- var aNumberValue = __webpack_require__(9855);
- var $toPrecision = 1.0.toPrecision;
- $export($export.P + $export.F * ($fails(function () {
- // IE7-
- return $toPrecision.call(1, undefined) !== '1';
- }) || !$fails(function () {
- // V8 ~ Android 4.3-
- $toPrecision.call({});
- })), 'Number', {
- toPrecision: function toPrecision(precision) {
- var that = aNumberValue(this, 'Number#toPrecision: incorrect invocation!');
- return precision === undefined ? $toPrecision.call(that) : $toPrecision.call(that, precision);
- }
- });
- /***/ }),
- /***/ 5331:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.3.1 Object.assign(target, source)
- var $export = __webpack_require__(5913);
- $export($export.S + $export.F, 'Object', {
- assign: __webpack_require__(8559)
- });
- /***/ }),
- /***/ 3290:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- // 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
- $export($export.S, 'Object', {
- create: __webpack_require__(4275)
- });
- /***/ }),
- /***/ 8424:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- // 19.1.2.3 / 15.2.3.7 Object.defineProperties(O, Properties)
- $export($export.S + $export.F * !__webpack_require__(4926), 'Object', {
- defineProperties: __webpack_require__(6447)
- });
- /***/ }),
- /***/ 3690:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- // 19.1.2.4 / 15.2.3.6 Object.defineProperty(O, P, Attributes)
- $export($export.S + $export.F * !__webpack_require__(4926), 'Object', {
- defineProperty: (__webpack_require__(4835).f)
- });
- /***/ }),
- /***/ 754:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.5 Object.freeze(O)
- var isObject = __webpack_require__(7156);
- var meta = (__webpack_require__(3763).onFreeze);
- __webpack_require__(4057)('freeze', function ($freeze) {
- return function freeze(it) {
- return $freeze && isObject(it) ? $freeze(meta(it)) : it;
- };
- });
- /***/ }),
- /***/ 2357:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- var toIObject = __webpack_require__(8499);
- var $getOwnPropertyDescriptor = (__webpack_require__(3299).f);
- __webpack_require__(4057)('getOwnPropertyDescriptor', function () {
- return function getOwnPropertyDescriptor(it, key) {
- return $getOwnPropertyDescriptor(toIObject(it), key);
- };
- });
- /***/ }),
- /***/ 6022:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.7 Object.getOwnPropertyNames(O)
- __webpack_require__(4057)('getOwnPropertyNames', function () {
- return (__webpack_require__(3136).f);
- });
- /***/ }),
- /***/ 6667:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.9 Object.getPrototypeOf(O)
- var toObject = __webpack_require__(2515);
- var $getPrototypeOf = __webpack_require__(4153);
- __webpack_require__(4057)('getPrototypeOf', function () {
- return function getPrototypeOf(it) {
- return $getPrototypeOf(toObject(it));
- };
- });
- /***/ }),
- /***/ 4919:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.11 Object.isExtensible(O)
- var isObject = __webpack_require__(7156);
- __webpack_require__(4057)('isExtensible', function ($isExtensible) {
- return function isExtensible(it) {
- return isObject(it) ? $isExtensible ? $isExtensible(it) : true : false;
- };
- });
- /***/ }),
- /***/ 9219:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.12 Object.isFrozen(O)
- var isObject = __webpack_require__(7156);
- __webpack_require__(4057)('isFrozen', function ($isFrozen) {
- return function isFrozen(it) {
- return isObject(it) ? $isFrozen ? $isFrozen(it) : false : true;
- };
- });
- /***/ }),
- /***/ 3270:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.13 Object.isSealed(O)
- var isObject = __webpack_require__(7156);
- __webpack_require__(4057)('isSealed', function ($isSealed) {
- return function isSealed(it) {
- return isObject(it) ? $isSealed ? $isSealed(it) : false : true;
- };
- });
- /***/ }),
- /***/ 2456:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.3.10 Object.is(value1, value2)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Object', {
- is: __webpack_require__(4261)
- });
- /***/ }),
- /***/ 2506:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.14 Object.keys(O)
- var toObject = __webpack_require__(2515);
- var $keys = __webpack_require__(9924);
- __webpack_require__(4057)('keys', function () {
- return function keys(it) {
- return $keys(toObject(it));
- };
- });
- /***/ }),
- /***/ 6527:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.15 Object.preventExtensions(O)
- var isObject = __webpack_require__(7156);
- var meta = (__webpack_require__(3763).onFreeze);
- __webpack_require__(4057)('preventExtensions', function ($preventExtensions) {
- return function preventExtensions(it) {
- return $preventExtensions && isObject(it) ? $preventExtensions(meta(it)) : it;
- };
- });
- /***/ }),
- /***/ 7571:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.2.17 Object.seal(O)
- var isObject = __webpack_require__(7156);
- var meta = (__webpack_require__(3763).onFreeze);
- __webpack_require__(4057)('seal', function ($seal) {
- return function seal(it) {
- return $seal && isObject(it) ? $seal(meta(it)) : it;
- };
- });
- /***/ }),
- /***/ 8490:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.3.19 Object.setPrototypeOf(O, proto)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Object', {
- setPrototypeOf: (__webpack_require__(6931).set)
- });
- /***/ }),
- /***/ 4554:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 19.1.3.6 Object.prototype.toString()
- var classof = __webpack_require__(2858);
- var test = {};
- test[__webpack_require__(3336)('toStringTag')] = 'z';
- if (test + '' != '[object z]') {
- __webpack_require__(7278)(Object.prototype, 'toString', function toString() {
- return '[object ' + classof(this) + ']';
- }, true);
- }
- /***/ }),
- /***/ 3271:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $parseFloat = __webpack_require__(5031);
- // 18.2.4 parseFloat(string)
- $export($export.G + $export.F * (parseFloat != $parseFloat), {
- parseFloat: $parseFloat
- });
- /***/ }),
- /***/ 317:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $parseInt = __webpack_require__(6971);
- // 18.2.5 parseInt(string, radix)
- $export($export.G + $export.F * (parseInt != $parseInt), {
- parseInt: $parseInt
- });
- /***/ }),
- /***/ 829:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var LIBRARY = __webpack_require__(4219);
- var global = __webpack_require__(7381);
- var ctx = __webpack_require__(566);
- var classof = __webpack_require__(2858);
- var $export = __webpack_require__(5913);
- var isObject = __webpack_require__(7156);
- var aFunction = __webpack_require__(6819);
- var anInstance = __webpack_require__(2702);
- var forOf = __webpack_require__(2734);
- var speciesConstructor = __webpack_require__(2035);
- var task = (__webpack_require__(8220).set);
- var microtask = __webpack_require__(1842)();
- var newPromiseCapabilityModule = __webpack_require__(4086);
- var perform = __webpack_require__(8228);
- var userAgent = __webpack_require__(851);
- var promiseResolve = __webpack_require__(3507);
- var PROMISE = 'Promise';
- var TypeError = global.TypeError;
- var process = global.process;
- var versions = process && process.versions;
- var v8 = versions && versions.v8 || '';
- var $Promise = global[PROMISE];
- var isNode = classof(process) == 'process';
- var empty = function empty() {/* empty */};
- var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
- var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
- var USE_NATIVE = !!function () {
- try {
- // correct subclassing with @@species support
- var promise = $Promise.resolve(1);
- var FakePromise = (promise.constructor = {})[__webpack_require__(3336)('species')] = function (exec) {
- exec(empty, empty);
- };
- // unhandled rejections tracking support, NodeJS Promise without it fails @@species test
- return (isNode || typeof PromiseRejectionEvent == 'function') && promise.then(empty) instanceof FakePromise
- // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
- // https://bugs.chromium.org/p/chromium/issues/detail?id=830565
- // we can't detect it synchronously, so just check versions
- && v8.indexOf('6.6') !== 0 && userAgent.indexOf('Chrome/66') === -1;
- } catch (e) {/* empty */}
- }();
- // helpers
- var isThenable = function isThenable(it) {
- var then;
- return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
- };
- var notify = function notify(promise, isReject) {
- if (promise._n) return;
- promise._n = true;
- var chain = promise._c;
- microtask(function () {
- var value = promise._v;
- var ok = promise._s == 1;
- var i = 0;
- var run = function run(reaction) {
- var handler = ok ? reaction.ok : reaction.fail;
- var resolve = reaction.resolve;
- var reject = reaction.reject;
- var domain = reaction.domain;
- var result, then, exited;
- try {
- if (handler) {
- if (!ok) {
- if (promise._h == 2) onHandleUnhandled(promise);
- promise._h = 1;
- }
- if (handler === true) result = value;else {
- if (domain) domain.enter();
- result = handler(value); // may throw
- if (domain) {
- domain.exit();
- exited = true;
- }
- }
- if (result === reaction.promise) {
- reject(TypeError('Promise-chain cycle'));
- } else if (then = isThenable(result)) {
- then.call(result, resolve, reject);
- } else resolve(result);
- } else reject(value);
- } catch (e) {
- if (domain && !exited) domain.exit();
- reject(e);
- }
- };
- while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
- promise._c = [];
- promise._n = false;
- if (isReject && !promise._h) onUnhandled(promise);
- });
- };
- var onUnhandled = function onUnhandled(promise) {
- task.call(global, function () {
- var value = promise._v;
- var unhandled = isUnhandled(promise);
- var result, handler, console;
- if (unhandled) {
- result = perform(function () {
- if (isNode) {
- process.emit('unhandledRejection', value, promise);
- } else if (handler = global.onunhandledrejection) {
- handler({
- promise: promise,
- reason: value
- });
- } else if ((console = global.console) && console.error) {
- console.error('Unhandled promise rejection', value);
- }
- });
- // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
- promise._h = isNode || isUnhandled(promise) ? 2 : 1;
- }
- promise._a = undefined;
- if (unhandled && result.e) throw result.v;
- });
- };
- var isUnhandled = function isUnhandled(promise) {
- return promise._h !== 1 && (promise._a || promise._c).length === 0;
- };
- var onHandleUnhandled = function onHandleUnhandled(promise) {
- task.call(global, function () {
- var handler;
- if (isNode) {
- process.emit('rejectionHandled', promise);
- } else if (handler = global.onrejectionhandled) {
- handler({
- promise: promise,
- reason: promise._v
- });
- }
- });
- };
- var $reject = function $reject(value) {
- var promise = this;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise; // unwrap
- promise._v = value;
- promise._s = 2;
- if (!promise._a) promise._a = promise._c.slice();
- notify(promise, true);
- };
- var $resolve = function $resolve(value) {
- var promise = this;
- var then;
- if (promise._d) return;
- promise._d = true;
- promise = promise._w || promise; // unwrap
- try {
- if (promise === value) throw TypeError("Promise can't be resolved itself");
- if (then = isThenable(value)) {
- microtask(function () {
- var wrapper = {
- _w: promise,
- _d: false
- }; // wrap
- try {
- then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
- } catch (e) {
- $reject.call(wrapper, e);
- }
- });
- } else {
- promise._v = value;
- promise._s = 1;
- notify(promise, false);
- }
- } catch (e) {
- $reject.call({
- _w: promise,
- _d: false
- }, e); // wrap
- }
- };
- // constructor polyfill
- if (!USE_NATIVE) {
- // 25.4.3.1 Promise(executor)
- $Promise = function Promise(executor) {
- anInstance(this, $Promise, PROMISE, '_h');
- aFunction(executor);
- Internal.call(this);
- try {
- executor(ctx($resolve, this, 1), ctx($reject, this, 1));
- } catch (err) {
- $reject.call(this, err);
- }
- };
- // eslint-disable-next-line no-unused-vars
- Internal = function Promise(executor) {
- this._c = []; // <- awaiting reactions
- this._a = undefined; // <- checked in isUnhandled reactions
- this._s = 0; // <- state
- this._d = false; // <- done
- this._v = undefined; // <- value
- this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
- this._n = false; // <- notify
- };
- Internal.prototype = __webpack_require__(7228)($Promise.prototype, {
- // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
- then: function then(onFulfilled, onRejected) {
- var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
- reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
- reaction.fail = typeof onRejected == 'function' && onRejected;
- reaction.domain = isNode ? process.domain : undefined;
- this._c.push(reaction);
- if (this._a) this._a.push(reaction);
- if (this._s) notify(this, false);
- return reaction.promise;
- },
- // 25.4.5.1 Promise.prototype.catch(onRejected)
- 'catch': function _catch(onRejected) {
- return this.then(undefined, onRejected);
- }
- });
- OwnPromiseCapability = function OwnPromiseCapability() {
- var promise = new Internal();
- this.promise = promise;
- this.resolve = ctx($resolve, promise, 1);
- this.reject = ctx($reject, promise, 1);
- };
- newPromiseCapabilityModule.f = newPromiseCapability = function newPromiseCapability(C) {
- return C === $Promise || C === Wrapper ? new OwnPromiseCapability(C) : newGenericPromiseCapability(C);
- };
- }
- $export($export.G + $export.W + $export.F * !USE_NATIVE, {
- Promise: $Promise
- });
- __webpack_require__(8094)($Promise, PROMISE);
- __webpack_require__(4798)(PROMISE);
- Wrapper = __webpack_require__(8544)[PROMISE];
- // statics
- $export($export.S + $export.F * !USE_NATIVE, PROMISE, {
- // 25.4.4.5 Promise.reject(r)
- reject: function reject(r) {
- var capability = newPromiseCapability(this);
- var $$reject = capability.reject;
- $$reject(r);
- return capability.promise;
- }
- });
- $export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
- // 25.4.4.6 Promise.resolve(x)
- resolve: function resolve(x) {
- return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
- }
- });
- $export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(5508)(function (iter) {
- $Promise.all(iter)['catch'](empty);
- })), PROMISE, {
- // 25.4.4.1 Promise.all(iterable)
- all: function all(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var resolve = capability.resolve;
- var reject = capability.reject;
- var result = perform(function () {
- var values = [];
- var index = 0;
- var remaining = 1;
- forOf(iterable, false, function (promise) {
- var $index = index++;
- var alreadyCalled = false;
- values.push(undefined);
- remaining++;
- C.resolve(promise).then(function (value) {
- if (alreadyCalled) return;
- alreadyCalled = true;
- values[$index] = value;
- --remaining || resolve(values);
- }, reject);
- });
- --remaining || resolve(values);
- });
- if (result.e) reject(result.v);
- return capability.promise;
- },
- // 25.4.4.4 Promise.race(iterable)
- race: function race(iterable) {
- var C = this;
- var capability = newPromiseCapability(C);
- var reject = capability.reject;
- var result = perform(function () {
- forOf(iterable, false, function (promise) {
- C.resolve(promise).then(capability.resolve, reject);
- });
- });
- if (result.e) reject(result.v);
- return capability.promise;
- }
- });
- /***/ }),
- /***/ 1220:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.1 Reflect.apply(target, thisArgument, argumentsList)
- var $export = __webpack_require__(5913);
- var aFunction = __webpack_require__(6819);
- var anObject = __webpack_require__(6154);
- var rApply = ((__webpack_require__(7381).Reflect) || {}).apply;
- var fApply = Function.apply;
- // MS Edge argumentsList argument is optional
- $export($export.S + $export.F * !__webpack_require__(5810)(function () {
- rApply(function () {/* empty */});
- }), 'Reflect', {
- apply: function apply(target, thisArgument, argumentsList) {
- var T = aFunction(target);
- var L = anObject(argumentsList);
- return rApply ? rApply(T, thisArgument, L) : fApply.call(T, thisArgument, L);
- }
- });
- /***/ }),
- /***/ 9263:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.2 Reflect.construct(target, argumentsList [, newTarget])
- var $export = __webpack_require__(5913);
- var create = __webpack_require__(4275);
- var aFunction = __webpack_require__(6819);
- var anObject = __webpack_require__(6154);
- var isObject = __webpack_require__(7156);
- var fails = __webpack_require__(5810);
- var bind = __webpack_require__(8327);
- var rConstruct = ((__webpack_require__(7381).Reflect) || {}).construct;
- // MS Edge supports only 2 arguments and argumentsList argument is optional
- // FF Nightly sets third argument as `new.target`, but does not create `this` from it
- var NEW_TARGET_BUG = fails(function () {
- function F() {/* empty */}
- return !(rConstruct(function () {/* empty */}, [], F) instanceof F);
- });
- var ARGS_BUG = !fails(function () {
- rConstruct(function () {/* empty */});
- });
- $export($export.S + $export.F * (NEW_TARGET_BUG || ARGS_BUG), 'Reflect', {
- construct: function construct(Target, args /* , newTarget */) {
- aFunction(Target);
- anObject(args);
- var newTarget = arguments.length < 3 ? Target : aFunction(arguments[2]);
- if (ARGS_BUG && !NEW_TARGET_BUG) return rConstruct(Target, args, newTarget);
- if (Target == newTarget) {
- // w/o altered newTarget, optimization for 0-4 arguments
- switch (args.length) {
- case 0:
- return new Target();
- case 1:
- return new Target(args[0]);
- case 2:
- return new Target(args[0], args[1]);
- case 3:
- return new Target(args[0], args[1], args[2]);
- case 4:
- return new Target(args[0], args[1], args[2], args[3]);
- }
- // w/o altered newTarget, lot of arguments case
- var $args = [null];
- $args.push.apply($args, args);
- return new (bind.apply(Target, $args))();
- }
- // with altered newTarget, not support built-in constructors
- var proto = newTarget.prototype;
- var instance = create(isObject(proto) ? proto : Object.prototype);
- var result = Function.apply.call(Target, instance, args);
- return isObject(result) ? result : instance;
- }
- });
- /***/ }),
- /***/ 7622:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.3 Reflect.defineProperty(target, propertyKey, attributes)
- var dP = __webpack_require__(4835);
- var $export = __webpack_require__(5913);
- var anObject = __webpack_require__(6154);
- var toPrimitive = __webpack_require__(8537);
- // MS Edge has broken Reflect.defineProperty - throwing instead of returning false
- $export($export.S + $export.F * __webpack_require__(5810)(function () {
- // eslint-disable-next-line no-undef
- Reflect.defineProperty(dP.f({}, 1, {
- value: 1
- }), 1, {
- value: 2
- });
- }), 'Reflect', {
- defineProperty: function defineProperty(target, propertyKey, attributes) {
- anObject(target);
- propertyKey = toPrimitive(propertyKey, true);
- anObject(attributes);
- try {
- dP.f(target, propertyKey, attributes);
- return true;
- } catch (e) {
- return false;
- }
- }
- });
- /***/ }),
- /***/ 9060:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.4 Reflect.deleteProperty(target, propertyKey)
- var $export = __webpack_require__(5913);
- var gOPD = (__webpack_require__(3299).f);
- var anObject = __webpack_require__(6154);
- $export($export.S, 'Reflect', {
- deleteProperty: function deleteProperty(target, propertyKey) {
- var desc = gOPD(anObject(target), propertyKey);
- return desc && !desc.configurable ? false : delete target[propertyKey];
- }
- });
- /***/ }),
- /***/ 980:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.5 Reflect.enumerate(target)
- var $export = __webpack_require__(5913);
- var anObject = __webpack_require__(6154);
- var Enumerate = function Enumerate(iterated) {
- this._t = anObject(iterated); // target
- this._i = 0; // next index
- var keys = this._k = []; // keys
- var key;
- for (key in iterated) keys.push(key);
- };
- __webpack_require__(8258)(Enumerate, 'Object', function () {
- var that = this;
- var keys = that._k;
- var key;
- do {
- if (that._i >= keys.length) return {
- value: undefined,
- done: true
- };
- } while (!((key = keys[that._i++]) in that._t));
- return {
- value: key,
- done: false
- };
- });
- $export($export.S, 'Reflect', {
- enumerate: function enumerate(target) {
- return new Enumerate(target);
- }
- });
- /***/ }),
- /***/ 8484:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.7 Reflect.getOwnPropertyDescriptor(target, propertyKey)
- var gOPD = __webpack_require__(3299);
- var $export = __webpack_require__(5913);
- var anObject = __webpack_require__(6154);
- $export($export.S, 'Reflect', {
- getOwnPropertyDescriptor: function getOwnPropertyDescriptor(target, propertyKey) {
- return gOPD.f(anObject(target), propertyKey);
- }
- });
- /***/ }),
- /***/ 9869:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.8 Reflect.getPrototypeOf(target)
- var $export = __webpack_require__(5913);
- var getProto = __webpack_require__(4153);
- var anObject = __webpack_require__(6154);
- $export($export.S, 'Reflect', {
- getPrototypeOf: function getPrototypeOf(target) {
- return getProto(anObject(target));
- }
- });
- /***/ }),
- /***/ 6175:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.6 Reflect.get(target, propertyKey [, receiver])
- var gOPD = __webpack_require__(3299);
- var getPrototypeOf = __webpack_require__(4153);
- var has = __webpack_require__(5389);
- var $export = __webpack_require__(5913);
- var isObject = __webpack_require__(7156);
- var anObject = __webpack_require__(6154);
- function get(target, propertyKey /* , receiver */) {
- var receiver = arguments.length < 3 ? target : arguments[2];
- var desc, proto;
- if (anObject(target) === receiver) return target[propertyKey];
- if (desc = gOPD.f(target, propertyKey)) return has(desc, 'value') ? desc.value : desc.get !== undefined ? desc.get.call(receiver) : undefined;
- if (isObject(proto = getPrototypeOf(target))) return get(proto, propertyKey, receiver);
- }
- $export($export.S, 'Reflect', {
- get: get
- });
- /***/ }),
- /***/ 1285:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.9 Reflect.has(target, propertyKey)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Reflect', {
- has: function has(target, propertyKey) {
- return propertyKey in target;
- }
- });
- /***/ }),
- /***/ 4854:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.10 Reflect.isExtensible(target)
- var $export = __webpack_require__(5913);
- var anObject = __webpack_require__(6154);
- var $isExtensible = Object.isExtensible;
- $export($export.S, 'Reflect', {
- isExtensible: function isExtensible(target) {
- anObject(target);
- return $isExtensible ? $isExtensible(target) : true;
- }
- });
- /***/ }),
- /***/ 6647:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.11 Reflect.ownKeys(target)
- var $export = __webpack_require__(5913);
- $export($export.S, 'Reflect', {
- ownKeys: __webpack_require__(2600)
- });
- /***/ }),
- /***/ 7903:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.12 Reflect.preventExtensions(target)
- var $export = __webpack_require__(5913);
- var anObject = __webpack_require__(6154);
- var $preventExtensions = Object.preventExtensions;
- $export($export.S, 'Reflect', {
- preventExtensions: function preventExtensions(target) {
- anObject(target);
- try {
- if ($preventExtensions) $preventExtensions(target);
- return true;
- } catch (e) {
- return false;
- }
- }
- });
- /***/ }),
- /***/ 3113:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.14 Reflect.setPrototypeOf(target, proto)
- var $export = __webpack_require__(5913);
- var setProto = __webpack_require__(6931);
- if (setProto) $export($export.S, 'Reflect', {
- setPrototypeOf: function setPrototypeOf(target, proto) {
- setProto.check(target, proto);
- try {
- setProto.set(target, proto);
- return true;
- } catch (e) {
- return false;
- }
- }
- });
- /***/ }),
- /***/ 5197:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 26.1.13 Reflect.set(target, propertyKey, V [, receiver])
- var dP = __webpack_require__(4835);
- var gOPD = __webpack_require__(3299);
- var getPrototypeOf = __webpack_require__(4153);
- var has = __webpack_require__(5389);
- var $export = __webpack_require__(5913);
- var createDesc = __webpack_require__(6256);
- var anObject = __webpack_require__(6154);
- var isObject = __webpack_require__(7156);
- function set(target, propertyKey, V /* , receiver */) {
- var receiver = arguments.length < 4 ? target : arguments[3];
- var ownDesc = gOPD.f(anObject(target), propertyKey);
- var existingDescriptor, proto;
- if (!ownDesc) {
- if (isObject(proto = getPrototypeOf(target))) {
- return set(proto, propertyKey, V, receiver);
- }
- ownDesc = createDesc(0);
- }
- if (has(ownDesc, 'value')) {
- if (ownDesc.writable === false || !isObject(receiver)) return false;
- if (existingDescriptor = gOPD.f(receiver, propertyKey)) {
- if (existingDescriptor.get || existingDescriptor.set || existingDescriptor.writable === false) return false;
- existingDescriptor.value = V;
- dP.f(receiver, propertyKey, existingDescriptor);
- } else dP.f(receiver, propertyKey, createDesc(0, V));
- return true;
- }
- return ownDesc.set === undefined ? false : (ownDesc.set.call(receiver, V), true);
- }
- $export($export.S, 'Reflect', {
- set: set
- });
- /***/ }),
- /***/ 2566:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var inheritIfRequired = __webpack_require__(3654);
- var dP = (__webpack_require__(4835).f);
- var gOPN = (__webpack_require__(2982).f);
- var isRegExp = __webpack_require__(1993);
- var $flags = __webpack_require__(2188);
- var $RegExp = global.RegExp;
- var Base = $RegExp;
- var proto = $RegExp.prototype;
- var re1 = /a/g;
- var re2 = /a/g;
- // "new" creates a new object, old webkit buggy here
- var CORRECT_NEW = new $RegExp(re1) !== re1;
- if (__webpack_require__(4926) && (!CORRECT_NEW || __webpack_require__(5810)(function () {
- re2[__webpack_require__(3336)('match')] = false;
- // RegExp constructor can alter flags and IsRegExp works correct with @@match
- return $RegExp(re1) != re1 || $RegExp(re2) == re2 || $RegExp(re1, 'i') != '/a/i';
- }))) {
- $RegExp = function RegExp(p, f) {
- var tiRE = this instanceof $RegExp;
- var piRE = isRegExp(p);
- var fiU = f === undefined;
- return !tiRE && piRE && p.constructor === $RegExp && fiU ? p : inheritIfRequired(CORRECT_NEW ? new Base(piRE && !fiU ? p.source : p, f) : Base((piRE = p instanceof $RegExp) ? p.source : p, piRE && fiU ? $flags.call(p) : f), tiRE ? this : proto, $RegExp);
- };
- var proxy = function proxy(key) {
- key in $RegExp || dP($RegExp, key, {
- configurable: true,
- get: function get() {
- return Base[key];
- },
- set: function set(it) {
- Base[key] = it;
- }
- });
- };
- for (var keys = gOPN(Base), i = 0; keys.length > i;) proxy(keys[i++]);
- proto.constructor = $RegExp;
- $RegExp.prototype = proto;
- __webpack_require__(7278)(global, 'RegExp', $RegExp);
- }
- __webpack_require__(4798)('RegExp');
- /***/ }),
- /***/ 5997:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var regexpExec = __webpack_require__(6997);
- __webpack_require__(5913)({
- target: 'RegExp',
- proto: true,
- forced: regexpExec !== /./.exec
- }, {
- exec: regexpExec
- });
- /***/ }),
- /***/ 7181:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 21.2.5.3 get RegExp.prototype.flags()
- if (__webpack_require__(4926) && /./g.flags != 'g') (__webpack_require__(4835).f)(RegExp.prototype, 'flags', {
- configurable: true,
- get: __webpack_require__(2188)
- });
- /***/ }),
- /***/ 8682:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var anObject = __webpack_require__(6154);
- var toLength = __webpack_require__(8315);
- var advanceStringIndex = __webpack_require__(1330);
- var regExpExec = __webpack_require__(4585);
- // @@match logic
- __webpack_require__(8644)('match', 1, function (defined, MATCH, $match, maybeCallNative) {
- return [
- // `String.prototype.match` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.match
- function match(regexp) {
- var O = defined(this);
- var fn = regexp == undefined ? undefined : regexp[MATCH];
- return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[MATCH](String(O));
- },
- // `RegExp.prototype[@@match]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@match
- function (regexp) {
- var res = maybeCallNative($match, regexp, this);
- if (res.done) return res.value;
- var rx = anObject(regexp);
- var S = String(this);
- if (!rx.global) return regExpExec(rx, S);
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- var A = [];
- var n = 0;
- var result;
- while ((result = regExpExec(rx, S)) !== null) {
- var matchStr = String(result[0]);
- A[n] = matchStr;
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- n++;
- }
- return n === 0 ? null : A;
- }];
- });
- /***/ }),
- /***/ 8514:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var anObject = __webpack_require__(6154);
- var toObject = __webpack_require__(2515);
- var toLength = __webpack_require__(8315);
- var toInteger = __webpack_require__(3230);
- var advanceStringIndex = __webpack_require__(1330);
- var regExpExec = __webpack_require__(4585);
- var max = Math.max;
- var min = Math.min;
- var floor = Math.floor;
- var SUBSTITUTION_SYMBOLS = /\$([$&`']|\d\d?|<[^>]*>)/g;
- var SUBSTITUTION_SYMBOLS_NO_NAMED = /\$([$&`']|\d\d?)/g;
- var maybeToString = function maybeToString(it) {
- return it === undefined ? it : String(it);
- };
- // @@replace logic
- __webpack_require__(8644)('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {
- return [
- // `String.prototype.replace` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.replace
- function replace(searchValue, replaceValue) {
- var O = defined(this);
- var fn = searchValue == undefined ? undefined : searchValue[REPLACE];
- return fn !== undefined ? fn.call(searchValue, O, replaceValue) : $replace.call(String(O), searchValue, replaceValue);
- },
- // `RegExp.prototype[@@replace]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace
- function (regexp, replaceValue) {
- var res = maybeCallNative($replace, regexp, this, replaceValue);
- if (res.done) return res.value;
- var rx = anObject(regexp);
- var S = String(this);
- var functionalReplace = typeof replaceValue === 'function';
- if (!functionalReplace) replaceValue = String(replaceValue);
- var global = rx.global;
- if (global) {
- var fullUnicode = rx.unicode;
- rx.lastIndex = 0;
- }
- var results = [];
- while (true) {
- var result = regExpExec(rx, S);
- if (result === null) break;
- results.push(result);
- if (!global) break;
- var matchStr = String(result[0]);
- if (matchStr === '') rx.lastIndex = advanceStringIndex(S, toLength(rx.lastIndex), fullUnicode);
- }
- var accumulatedResult = '';
- var nextSourcePosition = 0;
- for (var i = 0; i < results.length; i++) {
- result = results[i];
- var matched = String(result[0]);
- var position = max(min(toInteger(result.index), S.length), 0);
- var captures = [];
- // NOTE: This is equivalent to
- // captures = result.slice(1).map(maybeToString)
- // but for some reason `nativeSlice.call(result, 1, result.length)` (called in
- // the slice polyfill when slicing native arrays) "doesn't work" in safari 9 and
- // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.
- for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));
- var namedCaptures = result.groups;
- if (functionalReplace) {
- var replacerArgs = [matched].concat(captures, position, S);
- if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);
- var replacement = String(replaceValue.apply(undefined, replacerArgs));
- } else {
- replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);
- }
- if (position >= nextSourcePosition) {
- accumulatedResult += S.slice(nextSourcePosition, position) + replacement;
- nextSourcePosition = position + matched.length;
- }
- }
- return accumulatedResult + S.slice(nextSourcePosition);
- }];
- // https://tc39.github.io/ecma262/#sec-getsubstitution
- function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {
- var tailPos = position + matched.length;
- var m = captures.length;
- var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;
- if (namedCaptures !== undefined) {
- namedCaptures = toObject(namedCaptures);
- symbols = SUBSTITUTION_SYMBOLS;
- }
- return $replace.call(replacement, symbols, function (match, ch) {
- var capture;
- switch (ch.charAt(0)) {
- case '$':
- return '$';
- case '&':
- return matched;
- case '`':
- return str.slice(0, position);
- case "'":
- return str.slice(tailPos);
- case '<':
- capture = namedCaptures[ch.slice(1, -1)];
- break;
- default:
- // \d\d?
- var n = +ch;
- if (n === 0) return match;
- if (n > m) {
- var f = floor(n / 10);
- if (f === 0) return match;
- if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);
- return match;
- }
- capture = captures[n - 1];
- }
- return capture === undefined ? '' : capture;
- });
- }
- });
- /***/ }),
- /***/ 5105:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var anObject = __webpack_require__(6154);
- var sameValue = __webpack_require__(4261);
- var regExpExec = __webpack_require__(4585);
- // @@search logic
- __webpack_require__(8644)('search', 1, function (defined, SEARCH, $search, maybeCallNative) {
- return [
- // `String.prototype.search` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.search
- function search(regexp) {
- var O = defined(this);
- var fn = regexp == undefined ? undefined : regexp[SEARCH];
- return fn !== undefined ? fn.call(regexp, O) : new RegExp(regexp)[SEARCH](String(O));
- },
- // `RegExp.prototype[@@search]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@search
- function (regexp) {
- var res = maybeCallNative($search, regexp, this);
- if (res.done) return res.value;
- var rx = anObject(regexp);
- var S = String(this);
- var previousLastIndex = rx.lastIndex;
- if (!sameValue(previousLastIndex, 0)) rx.lastIndex = 0;
- var result = regExpExec(rx, S);
- if (!sameValue(rx.lastIndex, previousLastIndex)) rx.lastIndex = previousLastIndex;
- return result === null ? -1 : result.index;
- }];
- });
- /***/ }),
- /***/ 5325:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var isRegExp = __webpack_require__(1993);
- var anObject = __webpack_require__(6154);
- var speciesConstructor = __webpack_require__(2035);
- var advanceStringIndex = __webpack_require__(1330);
- var toLength = __webpack_require__(8315);
- var callRegExpExec = __webpack_require__(4585);
- var regexpExec = __webpack_require__(6997);
- var fails = __webpack_require__(5810);
- var $min = Math.min;
- var $push = [].push;
- var $SPLIT = 'split';
- var LENGTH = 'length';
- var LAST_INDEX = 'lastIndex';
- var MAX_UINT32 = 0xffffffff;
- // babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError
- var SUPPORTS_Y = !fails(function () {
- RegExp(MAX_UINT32, 'y');
- });
- // @@split logic
- __webpack_require__(8644)('split', 2, function (defined, SPLIT, $split, maybeCallNative) {
- var internalSplit;
- if ('abbc'[$SPLIT](/(b)*/)[1] == 'c' || 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 || 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 || '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 || '.'[$SPLIT](/()()/)[LENGTH] > 1 || ''[$SPLIT](/.?/)[LENGTH]) {
- // based on es5-shim implementation, need to rework it
- internalSplit = function internalSplit(separator, limit) {
- var string = String(this);
- if (separator === undefined && limit === 0) return [];
- // If `separator` is not a regex, use native split
- if (!isRegExp(separator)) return $split.call(string, separator, limit);
- var output = [];
- var flags = (separator.ignoreCase ? 'i' : '') + (separator.multiline ? 'm' : '') + (separator.unicode ? 'u' : '') + (separator.sticky ? 'y' : '');
- var lastLastIndex = 0;
- var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;
- // Make `global` and avoid `lastIndex` issues by working with a copy
- var separatorCopy = new RegExp(separator.source, flags + 'g');
- var match, lastIndex, lastLength;
- while (match = regexpExec.call(separatorCopy, string)) {
- lastIndex = separatorCopy[LAST_INDEX];
- if (lastIndex > lastLastIndex) {
- output.push(string.slice(lastLastIndex, match.index));
- if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));
- lastLength = match[0][LENGTH];
- lastLastIndex = lastIndex;
- if (output[LENGTH] >= splitLimit) break;
- }
- if (separatorCopy[LAST_INDEX] === match.index) separatorCopy[LAST_INDEX]++; // Avoid an infinite loop
- }
- if (lastLastIndex === string[LENGTH]) {
- if (lastLength || !separatorCopy.test('')) output.push('');
- } else output.push(string.slice(lastLastIndex));
- return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;
- };
- // Chakra, V8
- } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {
- internalSplit = function internalSplit(separator, limit) {
- return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);
- };
- } else {
- internalSplit = $split;
- }
- return [
- // `String.prototype.split` method
- // https://tc39.github.io/ecma262/#sec-string.prototype.split
- function split(separator, limit) {
- var O = defined(this);
- var splitter = separator == undefined ? undefined : separator[SPLIT];
- return splitter !== undefined ? splitter.call(separator, O, limit) : internalSplit.call(String(O), separator, limit);
- },
- // `RegExp.prototype[@@split]` method
- // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split
- //
- // NOTE: This cannot be properly polyfilled in engines that don't support
- // the 'y' flag.
- function (regexp, limit) {
- var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);
- if (res.done) return res.value;
- var rx = anObject(regexp);
- var S = String(this);
- var C = speciesConstructor(rx, RegExp);
- var unicodeMatching = rx.unicode;
- var flags = (rx.ignoreCase ? 'i' : '') + (rx.multiline ? 'm' : '') + (rx.unicode ? 'u' : '') + (SUPPORTS_Y ? 'y' : 'g');
- // ^(? + rx + ) is needed, in combination with some S slicing, to
- // simulate the 'y' flag.
- var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);
- var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;
- if (lim === 0) return [];
- if (S.length === 0) return callRegExpExec(splitter, S) === null ? [S] : [];
- var p = 0;
- var q = 0;
- var A = [];
- while (q < S.length) {
- splitter.lastIndex = SUPPORTS_Y ? q : 0;
- var z = callRegExpExec(splitter, SUPPORTS_Y ? S : S.slice(q));
- var e;
- if (z === null || (e = $min(toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p) {
- q = advanceStringIndex(S, q, unicodeMatching);
- } else {
- A.push(S.slice(p, q));
- if (A.length === lim) return A;
- for (var i = 1; i <= z.length - 1; i++) {
- A.push(z[i]);
- if (A.length === lim) return A;
- }
- q = p = e;
- }
- }
- A.push(S.slice(p));
- return A;
- }];
- });
- /***/ }),
- /***/ 8359:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(7181);
- var anObject = __webpack_require__(6154);
- var $flags = __webpack_require__(2188);
- var DESCRIPTORS = __webpack_require__(4926);
- var TO_STRING = 'toString';
- var $toString = /./[TO_STRING];
- var define = function define(fn) {
- __webpack_require__(7278)(RegExp.prototype, TO_STRING, fn, true);
- };
- // 21.2.5.14 RegExp.prototype.toString()
- if (__webpack_require__(5810)(function () {
- return $toString.call({
- source: 'a',
- flags: 'b'
- }) != '/a/b';
- })) {
- define(function toString() {
- var R = anObject(this);
- return '/'.concat(R.source, '/', 'flags' in R ? R.flags : !DESCRIPTORS && R instanceof RegExp ? $flags.call(R) : undefined);
- });
- // FF44- RegExp#toString has a wrong name
- } else if ($toString.name != TO_STRING) {
- define(function toString() {
- return $toString.call(this);
- });
- }
- /***/ }),
- /***/ 3940:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var strong = __webpack_require__(4396);
- var validate = __webpack_require__(8546);
- var SET = 'Set';
- // 23.2 Set Objects
- module.exports = __webpack_require__(1966)(SET, function (get) {
- return function Set() {
- return get(this, arguments.length > 0 ? arguments[0] : undefined);
- };
- }, {
- // 23.2.3.1 Set.prototype.add(value)
- add: function add(value) {
- return strong.def(validate(this, SET), value = value === 0 ? 0 : value, value);
- }
- }, strong);
- /***/ }),
- /***/ 9718:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.2 String.prototype.anchor(name)
- __webpack_require__(9927)('anchor', function (createHTML) {
- return function anchor(name) {
- return createHTML(this, 'a', 'name', name);
- };
- });
- /***/ }),
- /***/ 3845:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.3 String.prototype.big()
- __webpack_require__(9927)('big', function (createHTML) {
- return function big() {
- return createHTML(this, 'big', '', '');
- };
- });
- /***/ }),
- /***/ 5803:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.4 String.prototype.blink()
- __webpack_require__(9927)('blink', function (createHTML) {
- return function blink() {
- return createHTML(this, 'blink', '', '');
- };
- });
- /***/ }),
- /***/ 2222:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.5 String.prototype.bold()
- __webpack_require__(9927)('bold', function (createHTML) {
- return function bold() {
- return createHTML(this, 'b', '', '');
- };
- });
- /***/ }),
- /***/ 5281:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $at = __webpack_require__(3593)(false);
- $export($export.P, 'String', {
- // 21.1.3.3 String.prototype.codePointAt(pos)
- codePointAt: function codePointAt(pos) {
- return $at(this, pos);
- }
- });
- /***/ }),
- /***/ 3917:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 21.1.3.6 String.prototype.endsWith(searchString [, endPosition])
- var $export = __webpack_require__(5913);
- var toLength = __webpack_require__(8315);
- var context = __webpack_require__(2376);
- var ENDS_WITH = 'endsWith';
- var $endsWith = ''[ENDS_WITH];
- $export($export.P + $export.F * __webpack_require__(3483)(ENDS_WITH), 'String', {
- endsWith: function endsWith(searchString /* , endPosition = @length */) {
- var that = context(this, searchString, ENDS_WITH);
- var endPosition = arguments.length > 1 ? arguments[1] : undefined;
- var len = toLength(that.length);
- var end = endPosition === undefined ? len : Math.min(toLength(endPosition), len);
- var search = String(searchString);
- return $endsWith ? $endsWith.call(that, search, end) : that.slice(end - search.length, end) === search;
- }
- });
- /***/ }),
- /***/ 5036:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.6 String.prototype.fixed()
- __webpack_require__(9927)('fixed', function (createHTML) {
- return function fixed() {
- return createHTML(this, 'tt', '', '');
- };
- });
- /***/ }),
- /***/ 6131:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.7 String.prototype.fontcolor(color)
- __webpack_require__(9927)('fontcolor', function (createHTML) {
- return function fontcolor(color) {
- return createHTML(this, 'font', 'color', color);
- };
- });
- /***/ }),
- /***/ 4110:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.8 String.prototype.fontsize(size)
- __webpack_require__(9927)('fontsize', function (createHTML) {
- return function fontsize(size) {
- return createHTML(this, 'font', 'size', size);
- };
- });
- /***/ }),
- /***/ 8577:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toAbsoluteIndex = __webpack_require__(6241);
- var fromCharCode = String.fromCharCode;
- var $fromCodePoint = String.fromCodePoint;
- // length should be 1, old FF problem
- $export($export.S + $export.F * (!!$fromCodePoint && $fromCodePoint.length != 1), 'String', {
- // 21.1.2.2 String.fromCodePoint(...codePoints)
- fromCodePoint: function fromCodePoint(x) {
- // eslint-disable-line no-unused-vars
- var res = [];
- var aLen = arguments.length;
- var i = 0;
- var code;
- while (aLen > i) {
- code = +arguments[i++];
- if (toAbsoluteIndex(code, 0x10ffff) !== code) throw RangeError(code + ' is not a valid code point');
- res.push(code < 0x10000 ? fromCharCode(code) : fromCharCode(((code -= 0x10000) >> 10) + 0xd800, code % 0x400 + 0xdc00));
- }
- return res.join('');
- }
- });
- /***/ }),
- /***/ 5450:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 21.1.3.7 String.prototype.includes(searchString, position = 0)
- var $export = __webpack_require__(5913);
- var context = __webpack_require__(2376);
- var INCLUDES = 'includes';
- $export($export.P + $export.F * __webpack_require__(3483)(INCLUDES), 'String', {
- includes: function includes(searchString /* , position = 0 */) {
- return !!~context(this, searchString, INCLUDES).indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- /***/ }),
- /***/ 6235:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.9 String.prototype.italics()
- __webpack_require__(9927)('italics', function (createHTML) {
- return function italics() {
- return createHTML(this, 'i', '', '');
- };
- });
- /***/ }),
- /***/ 6575:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $at = __webpack_require__(3593)(true);
- // 21.1.3.27 String.prototype[@@iterator]()
- __webpack_require__(4873)(String, 'String', function (iterated) {
- this._t = String(iterated); // target
- this._i = 0; // next index
- // 21.1.5.2.1 %StringIteratorPrototype%.next()
- }, function () {
- var O = this._t;
- var index = this._i;
- var point;
- if (index >= O.length) return {
- value: undefined,
- done: true
- };
- point = $at(O, index);
- this._i += point.length;
- return {
- value: point,
- done: false
- };
- });
- /***/ }),
- /***/ 6495:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.10 String.prototype.link(url)
- __webpack_require__(9927)('link', function (createHTML) {
- return function link(url) {
- return createHTML(this, 'a', 'href', url);
- };
- });
- /***/ }),
- /***/ 7906:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toIObject = __webpack_require__(8499);
- var toLength = __webpack_require__(8315);
- $export($export.S, 'String', {
- // 21.1.2.4 String.raw(callSite, ...substitutions)
- raw: function raw(callSite) {
- var tpl = toIObject(callSite.raw);
- var len = toLength(tpl.length);
- var aLen = arguments.length;
- var res = [];
- var i = 0;
- while (len > i) {
- res.push(String(tpl[i++]));
- if (i < aLen) res.push(String(arguments[i]));
- }
- return res.join('');
- }
- });
- /***/ }),
- /***/ 9449:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- $export($export.P, 'String', {
- // 21.1.3.13 String.prototype.repeat(count)
- repeat: __webpack_require__(1924)
- });
- /***/ }),
- /***/ 4162:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.11 String.prototype.small()
- __webpack_require__(9927)('small', function (createHTML) {
- return function small() {
- return createHTML(this, 'small', '', '');
- };
- });
- /***/ }),
- /***/ 1616:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 21.1.3.18 String.prototype.startsWith(searchString [, position ])
- var $export = __webpack_require__(5913);
- var toLength = __webpack_require__(8315);
- var context = __webpack_require__(2376);
- var STARTS_WITH = 'startsWith';
- var $startsWith = ''[STARTS_WITH];
- $export($export.P + $export.F * __webpack_require__(3483)(STARTS_WITH), 'String', {
- startsWith: function startsWith(searchString /* , position = 0 */) {
- var that = context(this, searchString, STARTS_WITH);
- var index = toLength(Math.min(arguments.length > 1 ? arguments[1] : undefined, that.length));
- var search = String(searchString);
- return $startsWith ? $startsWith.call(that, search, index) : that.slice(index, index + search.length) === search;
- }
- });
- /***/ }),
- /***/ 5297:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.12 String.prototype.strike()
- __webpack_require__(9927)('strike', function (createHTML) {
- return function strike() {
- return createHTML(this, 'strike', '', '');
- };
- });
- /***/ }),
- /***/ 1466:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.13 String.prototype.sub()
- __webpack_require__(9927)('sub', function (createHTML) {
- return function sub() {
- return createHTML(this, 'sub', '', '');
- };
- });
- /***/ }),
- /***/ 2581:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // B.2.3.14 String.prototype.sup()
- __webpack_require__(9927)('sup', function (createHTML) {
- return function sup() {
- return createHTML(this, 'sup', '', '');
- };
- });
- /***/ }),
- /***/ 8587:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // 21.1.3.25 String.prototype.trim()
- __webpack_require__(618)('trim', function ($trim) {
- return function trim() {
- return $trim(this, 3);
- };
- });
- /***/ }),
- /***/ 2403:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // ECMAScript 6 symbols shim
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var global = __webpack_require__(7381);
- var has = __webpack_require__(5389);
- var DESCRIPTORS = __webpack_require__(4926);
- var $export = __webpack_require__(5913);
- var redefine = __webpack_require__(7278);
- var META = (__webpack_require__(3763).KEY);
- var $fails = __webpack_require__(5810);
- var shared = __webpack_require__(3192);
- var setToStringTag = __webpack_require__(8094);
- var uid = __webpack_require__(7936);
- var wks = __webpack_require__(3336);
- var wksExt = __webpack_require__(9078);
- var wksDefine = __webpack_require__(5721);
- var enumKeys = __webpack_require__(8727);
- var isArray = __webpack_require__(1320);
- var anObject = __webpack_require__(6154);
- var isObject = __webpack_require__(7156);
- var toObject = __webpack_require__(2515);
- var toIObject = __webpack_require__(8499);
- var toPrimitive = __webpack_require__(8537);
- var createDesc = __webpack_require__(6256);
- var _create = __webpack_require__(4275);
- var gOPNExt = __webpack_require__(3136);
- var $GOPD = __webpack_require__(3299);
- var $GOPS = __webpack_require__(5421);
- var $DP = __webpack_require__(4835);
- var $keys = __webpack_require__(9924);
- var gOPD = $GOPD.f;
- var dP = $DP.f;
- var gOPN = gOPNExt.f;
- var $Symbol = global.Symbol;
- var $JSON = global.JSON;
- var _stringify = $JSON && $JSON.stringify;
- var PROTOTYPE = 'prototype';
- var HIDDEN = wks('_hidden');
- var TO_PRIMITIVE = wks('toPrimitive');
- var isEnum = {}.propertyIsEnumerable;
- var SymbolRegistry = shared('symbol-registry');
- var AllSymbols = shared('symbols');
- var OPSymbols = shared('op-symbols');
- var ObjectProto = Object[PROTOTYPE];
- var USE_NATIVE = typeof $Symbol == 'function' && !!$GOPS.f;
- var QObject = global.QObject;
- // Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
- var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
- // fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
- var setSymbolDesc = DESCRIPTORS && $fails(function () {
- return _create(dP({}, 'a', {
- get: function get() {
- return dP(this, 'a', {
- value: 7
- }).a;
- }
- })).a != 7;
- }) ? function (it, key, D) {
- var protoDesc = gOPD(ObjectProto, key);
- if (protoDesc) delete ObjectProto[key];
- dP(it, key, D);
- if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
- } : dP;
- var wrap = function wrap(tag) {
- var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
- sym._k = tag;
- return sym;
- };
- var isSymbol = USE_NATIVE && _typeof($Symbol.iterator) == 'symbol' ? function (it) {
- return _typeof(it) == 'symbol';
- } : function (it) {
- return it instanceof $Symbol;
- };
- var $defineProperty = function defineProperty(it, key, D) {
- if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
- anObject(it);
- key = toPrimitive(key, true);
- anObject(D);
- if (has(AllSymbols, key)) {
- if (!D.enumerable) {
- if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
- it[HIDDEN][key] = true;
- } else {
- if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
- D = _create(D, {
- enumerable: createDesc(0, false)
- });
- }
- return setSymbolDesc(it, key, D);
- }
- return dP(it, key, D);
- };
- var $defineProperties = function defineProperties(it, P) {
- anObject(it);
- var keys = enumKeys(P = toIObject(P));
- var i = 0;
- var l = keys.length;
- var key;
- while (l > i) $defineProperty(it, key = keys[i++], P[key]);
- return it;
- };
- var $create = function create(it, P) {
- return P === undefined ? _create(it) : $defineProperties(_create(it), P);
- };
- var $propertyIsEnumerable = function propertyIsEnumerable(key) {
- var E = isEnum.call(this, key = toPrimitive(key, true));
- if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
- return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
- };
- var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
- it = toIObject(it);
- key = toPrimitive(key, true);
- if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
- var D = gOPD(it, key);
- if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
- return D;
- };
- var $getOwnPropertyNames = function getOwnPropertyNames(it) {
- var names = gOPN(toIObject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
- }
- return result;
- };
- var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
- var IS_OP = it === ObjectProto;
- var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
- var result = [];
- var i = 0;
- var key;
- while (names.length > i) {
- if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
- }
- return result;
- };
- // 19.4.1.1 Symbol([description])
- if (!USE_NATIVE) {
- $Symbol = function _Symbol() {
- if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
- var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
- var $set = function $set(value) {
- if (this === ObjectProto) $set.call(OPSymbols, value);
- if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
- setSymbolDesc(this, tag, createDesc(1, value));
- };
- if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, {
- configurable: true,
- set: $set
- });
- return wrap(tag);
- };
- redefine($Symbol[PROTOTYPE], 'toString', function toString() {
- return this._k;
- });
- $GOPD.f = $getOwnPropertyDescriptor;
- $DP.f = $defineProperty;
- (__webpack_require__(2982).f) = gOPNExt.f = $getOwnPropertyNames;
- (__webpack_require__(4616).f) = $propertyIsEnumerable;
- $GOPS.f = $getOwnPropertySymbols;
- if (DESCRIPTORS && !__webpack_require__(4219)) {
- redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
- }
- wksExt.f = function (name) {
- return wrap(wks(name));
- };
- }
- $export($export.G + $export.W + $export.F * !USE_NATIVE, {
- Symbol: $Symbol
- });
- for (var es6Symbols =
- // 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
- 'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'.split(','), j = 0; es6Symbols.length > j;) wks(es6Symbols[j++]);
- for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
- $export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
- // 19.4.2.1 Symbol.for(key)
- 'for': function _for(key) {
- return has(SymbolRegistry, key += '') ? SymbolRegistry[key] : SymbolRegistry[key] = $Symbol(key);
- },
- // 19.4.2.5 Symbol.keyFor(sym)
- keyFor: function keyFor(sym) {
- if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
- for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
- },
- useSetter: function useSetter() {
- setter = true;
- },
- useSimple: function useSimple() {
- setter = false;
- }
- });
- $export($export.S + $export.F * !USE_NATIVE, 'Object', {
- // 19.1.2.2 Object.create(O [, Properties])
- create: $create,
- // 19.1.2.4 Object.defineProperty(O, P, Attributes)
- defineProperty: $defineProperty,
- // 19.1.2.3 Object.defineProperties(O, Properties)
- defineProperties: $defineProperties,
- // 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
- getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
- // 19.1.2.7 Object.getOwnPropertyNames(O)
- getOwnPropertyNames: $getOwnPropertyNames,
- // 19.1.2.8 Object.getOwnPropertySymbols(O)
- getOwnPropertySymbols: $getOwnPropertySymbols
- });
- // Chrome 38 and 39 `Object.getOwnPropertySymbols` fails on primitives
- // https://bugs.chromium.org/p/v8/issues/detail?id=3443
- var FAILS_ON_PRIMITIVES = $fails(function () {
- $GOPS.f(1);
- });
- $export($export.S + $export.F * FAILS_ON_PRIMITIVES, 'Object', {
- getOwnPropertySymbols: function getOwnPropertySymbols(it) {
- return $GOPS.f(toObject(it));
- }
- });
- // 24.3.2 JSON.stringify(value [, replacer [, space]])
- $JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
- var S = $Symbol();
- // MS Edge converts symbol values to JSON as {}
- // WebKit converts symbol values to JSON as null
- // V8 throws on boxed symbols
- return _stringify([S]) != '[null]' || _stringify({
- a: S
- }) != '{}' || _stringify(Object(S)) != '{}';
- })), 'JSON', {
- stringify: function stringify(it) {
- var args = [it];
- var i = 1;
- var replacer, $replacer;
- while (arguments.length > i) args.push(arguments[i++]);
- $replacer = replacer = args[1];
- if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
- if (!isArray(replacer)) replacer = function replacer(key, value) {
- if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
- if (!isSymbol(value)) return value;
- };
- args[1] = replacer;
- return _stringify.apply($JSON, args);
- }
- });
- // 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
- $Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(8012)($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
- // 19.4.3.5 Symbol.prototype[@@toStringTag]
- setToStringTag($Symbol, 'Symbol');
- // 20.2.1.9 Math[@@toStringTag]
- setToStringTag(Math, 'Math', true);
- // 24.3.3 JSON[@@toStringTag]
- setToStringTag(global.JSON, 'JSON', true);
- /***/ }),
- /***/ 7195:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $typed = __webpack_require__(9161);
- var buffer = __webpack_require__(9782);
- var anObject = __webpack_require__(6154);
- var toAbsoluteIndex = __webpack_require__(6241);
- var toLength = __webpack_require__(8315);
- var isObject = __webpack_require__(7156);
- var ArrayBuffer = (__webpack_require__(7381).ArrayBuffer);
- var speciesConstructor = __webpack_require__(2035);
- var $ArrayBuffer = buffer.ArrayBuffer;
- var $DataView = buffer.DataView;
- var $isView = $typed.ABV && ArrayBuffer.isView;
- var $slice = $ArrayBuffer.prototype.slice;
- var VIEW = $typed.VIEW;
- var ARRAY_BUFFER = 'ArrayBuffer';
- $export($export.G + $export.W + $export.F * (ArrayBuffer !== $ArrayBuffer), {
- ArrayBuffer: $ArrayBuffer
- });
- $export($export.S + $export.F * !$typed.CONSTR, ARRAY_BUFFER, {
- // 24.1.3.1 ArrayBuffer.isView(arg)
- isView: function isView(it) {
- return $isView && $isView(it) || isObject(it) && VIEW in it;
- }
- });
- $export($export.P + $export.U + $export.F * __webpack_require__(5810)(function () {
- return !new $ArrayBuffer(2).slice(1, undefined).byteLength;
- }), ARRAY_BUFFER, {
- // 24.1.4.3 ArrayBuffer.prototype.slice(start, end)
- slice: function slice(start, end) {
- if ($slice !== undefined && end === undefined) return $slice.call(anObject(this), start); // FF fix
- var len = anObject(this).byteLength;
- var first = toAbsoluteIndex(start, len);
- var fin = toAbsoluteIndex(end === undefined ? len : end, len);
- var result = new (speciesConstructor(this, $ArrayBuffer))(toLength(fin - first));
- var viewS = new $DataView(this);
- var viewT = new $DataView(result);
- var index = 0;
- while (first < fin) {
- viewT.setUint8(index++, viewS.getUint8(first++));
- }
- return result;
- }
- });
- __webpack_require__(4798)(ARRAY_BUFFER);
- /***/ }),
- /***/ 5345:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- $export($export.G + $export.W + $export.F * !(__webpack_require__(9161).ABV), {
- DataView: (__webpack_require__(9782).DataView)
- });
- /***/ }),
- /***/ 8824:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Float32', 4, function (init) {
- return function Float32Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 6472:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Float64', 8, function (init) {
- return function Float64Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 7683:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Int16', 2, function (init) {
- return function Int16Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 4797:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Int32', 4, function (init) {
- return function Int32Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 6670:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Int8', 1, function (init) {
- return function Int8Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 1123:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Uint16', 2, function (init) {
- return function Uint16Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 4871:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Uint32', 4, function (init) {
- return function Uint32Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 7736:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Uint8', 1, function (init) {
- return function Uint8Array(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- });
- /***/ }),
- /***/ 4457:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(431)('Uint8', 1, function (init) {
- return function Uint8ClampedArray(data, byteOffset, length) {
- return init(this, data, byteOffset, length);
- };
- }, true);
- /***/ }),
- /***/ 3491:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var global = __webpack_require__(7381);
- var each = __webpack_require__(3970)(0);
- var redefine = __webpack_require__(7278);
- var meta = __webpack_require__(3763);
- var assign = __webpack_require__(8559);
- var weak = __webpack_require__(4495);
- var isObject = __webpack_require__(7156);
- var validate = __webpack_require__(8546);
- var NATIVE_WEAK_MAP = __webpack_require__(8546);
- var IS_IE11 = !global.ActiveXObject && 'ActiveXObject' in global;
- var WEAK_MAP = 'WeakMap';
- var getWeak = meta.getWeak;
- var isExtensible = Object.isExtensible;
- var uncaughtFrozenStore = weak.ufstore;
- var InternalMap;
- var wrapper = function wrapper(get) {
- return function WeakMap() {
- return get(this, arguments.length > 0 ? arguments[0] : undefined);
- };
- };
- var methods = {
- // 23.3.3.3 WeakMap.prototype.get(key)
- get: function get(key) {
- if (isObject(key)) {
- var data = getWeak(key);
- if (data === true) return uncaughtFrozenStore(validate(this, WEAK_MAP)).get(key);
- return data ? data[this._i] : undefined;
- }
- },
- // 23.3.3.5 WeakMap.prototype.set(key, value)
- set: function set(key, value) {
- return weak.def(validate(this, WEAK_MAP), key, value);
- }
- };
- // 23.3 WeakMap Objects
- var $WeakMap = module.exports = __webpack_require__(1966)(WEAK_MAP, wrapper, methods, weak, true, true);
- // IE11 WeakMap frozen keys fix
- if (NATIVE_WEAK_MAP && IS_IE11) {
- InternalMap = weak.getConstructor(wrapper, WEAK_MAP);
- assign(InternalMap.prototype, methods);
- meta.NEED = true;
- each(['delete', 'has', 'get', 'set'], function (key) {
- var proto = $WeakMap.prototype;
- var method = proto[key];
- redefine(proto, key, function (a, b) {
- // store frozen objects on internal weakmap shim
- if (isObject(a) && !isExtensible(a)) {
- if (!this._f) this._f = new InternalMap();
- var result = this._f[key](a, b);
- return key == 'set' ? this : result;
- // store all the rest on native weakmap
- }
- return method.call(this, a, b);
- });
- });
- }
- /***/ }),
- /***/ 6332:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var weak = __webpack_require__(4495);
- var validate = __webpack_require__(8546);
- var WEAK_SET = 'WeakSet';
- // 23.4 WeakSet Objects
- __webpack_require__(1966)(WEAK_SET, function (get) {
- return function WeakSet() {
- return get(this, arguments.length > 0 ? arguments[0] : undefined);
- };
- }, {
- // 23.4.3.1 WeakSet.prototype.add(value)
- add: function add(value) {
- return weak.def(validate(this, WEAK_SET), value, true);
- }
- }, weak, false, true);
- /***/ }),
- /***/ 6032:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatMap
- var $export = __webpack_require__(5913);
- var flattenIntoArray = __webpack_require__(3120);
- var toObject = __webpack_require__(2515);
- var toLength = __webpack_require__(8315);
- var aFunction = __webpack_require__(6819);
- var arraySpeciesCreate = __webpack_require__(5486);
- $export($export.P, 'Array', {
- flatMap: function flatMap(callbackfn /* , thisArg */) {
- var O = toObject(this);
- var sourceLen, A;
- aFunction(callbackfn);
- sourceLen = toLength(O.length);
- A = arraySpeciesCreate(O, 0);
- flattenIntoArray(A, O, O, sourceLen, 0, 1, callbackfn, arguments[1]);
- return A;
- }
- });
- __webpack_require__(4339)('flatMap');
- /***/ }),
- /***/ 732:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-flatMap/#sec-Array.prototype.flatten
- var $export = __webpack_require__(5913);
- var flattenIntoArray = __webpack_require__(3120);
- var toObject = __webpack_require__(2515);
- var toLength = __webpack_require__(8315);
- var toInteger = __webpack_require__(3230);
- var arraySpeciesCreate = __webpack_require__(5486);
- $export($export.P, 'Array', {
- flatten: function flatten( /* depthArg = 1 */
- ) {
- var depthArg = arguments[0];
- var O = toObject(this);
- var sourceLen = toLength(O.length);
- var A = arraySpeciesCreate(O, 0);
- flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toInteger(depthArg));
- return A;
- }
- });
- __webpack_require__(4339)('flatten');
- /***/ }),
- /***/ 2963:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/Array.prototype.includes
- var $export = __webpack_require__(5913);
- var $includes = __webpack_require__(4687)(true);
- $export($export.P, 'Array', {
- includes: function includes(el /* , fromIndex = 0 */) {
- return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
- }
- });
- __webpack_require__(4339)('includes');
- /***/ }),
- /***/ 6321:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/rwaldron/tc39-notes/blob/master/es6/2014-09/sept-25.md#510-globalasap-for-enqueuing-a-microtask
- var $export = __webpack_require__(5913);
- var microtask = __webpack_require__(1842)();
- var process = (__webpack_require__(7381).process);
- var isNode = __webpack_require__(3679)(process) == 'process';
- $export($export.G, {
- asap: function asap(fn) {
- var domain = isNode && process.domain;
- microtask(domain ? domain.bind(fn) : fn);
- }
- });
- /***/ }),
- /***/ 7469:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/ljharb/proposal-is-error
- var $export = __webpack_require__(5913);
- var cof = __webpack_require__(3679);
- $export($export.S, 'Error', {
- isError: function isError(it) {
- return cof(it) === 'Error';
- }
- });
- /***/ }),
- /***/ 6426:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-global
- var $export = __webpack_require__(5913);
- $export($export.G, {
- global: __webpack_require__(7381)
- });
- /***/ }),
- /***/ 3591:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.from
- __webpack_require__(7598)('Map');
- /***/ }),
- /***/ 9992:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-map.of
- __webpack_require__(5329)('Map');
- /***/ }),
- /***/ 8455:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var $export = __webpack_require__(5913);
- $export($export.P + $export.R, 'Map', {
- toJSON: __webpack_require__(1872)('Map')
- });
- /***/ }),
- /***/ 4097:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- clamp: function clamp(x, lower, upper) {
- return Math.min(upper, Math.max(lower, x));
- }
- });
- /***/ }),
- /***/ 5813:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- DEG_PER_RAD: Math.PI / 180
- });
- /***/ }),
- /***/ 7245:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- var RAD_PER_DEG = 180 / Math.PI;
- $export($export.S, 'Math', {
- degrees: function degrees(radians) {
- return radians * RAD_PER_DEG;
- }
- });
- /***/ }),
- /***/ 6756:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- var scale = __webpack_require__(8124);
- var fround = __webpack_require__(3800);
- $export($export.S, 'Math', {
- fscale: function fscale(x, inLow, inHigh, outLow, outHigh) {
- return fround(scale(x, inLow, inHigh, outLow, outHigh));
- }
- });
- /***/ }),
- /***/ 8392:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- iaddh: function iaddh(x0, x1, y0, y1) {
- var $x0 = x0 >>> 0;
- var $x1 = x1 >>> 0;
- var $y0 = y0 >>> 0;
- return $x1 + (y1 >>> 0) + (($x0 & $y0 | ($x0 | $y0) & ~($x0 + $y0 >>> 0)) >>> 31) | 0;
- }
- });
- /***/ }),
- /***/ 3735:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- imulh: function imulh(u, v) {
- var UINT16 = 0xffff;
- var $u = +u;
- var $v = +v;
- var u0 = $u & UINT16;
- var v0 = $v & UINT16;
- var u1 = $u >> 16;
- var v1 = $v >> 16;
- var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
- return u1 * v1 + (t >> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >> 16);
- }
- });
- /***/ }),
- /***/ 1111:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- isubh: function isubh(x0, x1, y0, y1) {
- var $x0 = x0 >>> 0;
- var $x1 = x1 >>> 0;
- var $y0 = y0 >>> 0;
- return $x1 - (y1 >>> 0) - ((~$x0 & $y0 | ~($x0 ^ $y0) & $x0 - $y0 >>> 0) >>> 31) | 0;
- }
- });
- /***/ }),
- /***/ 3037:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- RAD_PER_DEG: 180 / Math.PI
- });
- /***/ }),
- /***/ 8422:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- var DEG_PER_RAD = Math.PI / 180;
- $export($export.S, 'Math', {
- radians: function radians(degrees) {
- return degrees * DEG_PER_RAD;
- }
- });
- /***/ }),
- /***/ 1818:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://rwaldron.github.io/proposal-math-extensions/
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- scale: __webpack_require__(8124)
- });
- /***/ }),
- /***/ 7371:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // http://jfbastien.github.io/papers/Math.signbit.html
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- signbit: function signbit(x) {
- // eslint-disable-next-line no-self-compare
- return (x = +x) != x ? x : x == 0 ? 1 / x == Infinity : x > 0;
- }
- });
- /***/ }),
- /***/ 7883:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://gist.github.com/BrendanEich/4294d5c212a6d2254703
- var $export = __webpack_require__(5913);
- $export($export.S, 'Math', {
- umulh: function umulh(u, v) {
- var UINT16 = 0xffff;
- var $u = +u;
- var $v = +v;
- var u0 = $u & UINT16;
- var v0 = $v & UINT16;
- var u1 = $u >>> 16;
- var v1 = $v >>> 16;
- var t = (u1 * v0 >>> 0) + (u0 * v0 >>> 16);
- return u1 * v1 + (t >>> 16) + ((u0 * v1 >>> 0) + (t & UINT16) >>> 16);
- }
- });
- /***/ }),
- /***/ 6792:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toObject = __webpack_require__(2515);
- var aFunction = __webpack_require__(6819);
- var $defineProperty = __webpack_require__(4835);
- // B.2.2.2 Object.prototype.__defineGetter__(P, getter)
- __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
- __defineGetter__: function __defineGetter__(P, getter) {
- $defineProperty.f(toObject(this), P, {
- get: aFunction(getter),
- enumerable: true,
- configurable: true
- });
- }
- });
- /***/ }),
- /***/ 88:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toObject = __webpack_require__(2515);
- var aFunction = __webpack_require__(6819);
- var $defineProperty = __webpack_require__(4835);
- // B.2.2.3 Object.prototype.__defineSetter__(P, setter)
- __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
- __defineSetter__: function __defineSetter__(P, setter) {
- $defineProperty.f(toObject(this), P, {
- set: aFunction(setter),
- enumerable: true,
- configurable: true
- });
- }
- });
- /***/ }),
- /***/ 8217:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-object-values-entries
- var $export = __webpack_require__(5913);
- var $entries = __webpack_require__(8941)(true);
- $export($export.S, 'Object', {
- entries: function entries(it) {
- return $entries(it);
- }
- });
- /***/ }),
- /***/ 9168:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-object-getownpropertydescriptors
- var $export = __webpack_require__(5913);
- var ownKeys = __webpack_require__(2600);
- var toIObject = __webpack_require__(8499);
- var gOPD = __webpack_require__(3299);
- var createProperty = __webpack_require__(1348);
- $export($export.S, 'Object', {
- getOwnPropertyDescriptors: function getOwnPropertyDescriptors(object) {
- var O = toIObject(object);
- var getDesc = gOPD.f;
- var keys = ownKeys(O);
- var result = {};
- var i = 0;
- var key, desc;
- while (keys.length > i) {
- desc = getDesc(O, key = keys[i++]);
- if (desc !== undefined) createProperty(result, key, desc);
- }
- return result;
- }
- });
- /***/ }),
- /***/ 2095:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toObject = __webpack_require__(2515);
- var toPrimitive = __webpack_require__(8537);
- var getPrototypeOf = __webpack_require__(4153);
- var getOwnPropertyDescriptor = (__webpack_require__(3299).f);
- // B.2.2.4 Object.prototype.__lookupGetter__(P)
- __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
- __lookupGetter__: function __lookupGetter__(P) {
- var O = toObject(this);
- var K = toPrimitive(P, true);
- var D;
- do {
- if (D = getOwnPropertyDescriptor(O, K)) return D.get;
- } while (O = getPrototypeOf(O));
- }
- });
- /***/ }),
- /***/ 2889:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var toObject = __webpack_require__(2515);
- var toPrimitive = __webpack_require__(8537);
- var getPrototypeOf = __webpack_require__(4153);
- var getOwnPropertyDescriptor = (__webpack_require__(3299).f);
- // B.2.2.5 Object.prototype.__lookupSetter__(P)
- __webpack_require__(4926) && $export($export.P + __webpack_require__(8249), 'Object', {
- __lookupSetter__: function __lookupSetter__(P) {
- var O = toObject(this);
- var K = toPrimitive(P, true);
- var D;
- do {
- if (D = getOwnPropertyDescriptor(O, K)) return D.set;
- } while (O = getPrototypeOf(O));
- }
- });
- /***/ }),
- /***/ 6351:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-object-values-entries
- var $export = __webpack_require__(5913);
- var $values = __webpack_require__(8941)(false);
- $export($export.S, 'Object', {
- values: function values(it) {
- return $values(it);
- }
- });
- /***/ }),
- /***/ 5613:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/zenparsing/es-observable
- var $export = __webpack_require__(5913);
- var global = __webpack_require__(7381);
- var core = __webpack_require__(8544);
- var microtask = __webpack_require__(1842)();
- var OBSERVABLE = __webpack_require__(3336)('observable');
- var aFunction = __webpack_require__(6819);
- var anObject = __webpack_require__(6154);
- var anInstance = __webpack_require__(2702);
- var redefineAll = __webpack_require__(7228);
- var hide = __webpack_require__(8012);
- var forOf = __webpack_require__(2734);
- var RETURN = forOf.RETURN;
- var getMethod = function getMethod(fn) {
- return fn == null ? undefined : aFunction(fn);
- };
- var cleanupSubscription = function cleanupSubscription(subscription) {
- var cleanup = subscription._c;
- if (cleanup) {
- subscription._c = undefined;
- cleanup();
- }
- };
- var subscriptionClosed = function subscriptionClosed(subscription) {
- return subscription._o === undefined;
- };
- var closeSubscription = function closeSubscription(subscription) {
- if (!subscriptionClosed(subscription)) {
- subscription._o = undefined;
- cleanupSubscription(subscription);
- }
- };
- var Subscription = function Subscription(observer, subscriber) {
- anObject(observer);
- this._c = undefined;
- this._o = observer;
- observer = new SubscriptionObserver(this);
- try {
- var cleanup = subscriber(observer);
- var subscription = cleanup;
- if (cleanup != null) {
- if (typeof cleanup.unsubscribe === 'function') cleanup = function cleanup() {
- subscription.unsubscribe();
- };else aFunction(cleanup);
- this._c = cleanup;
- }
- } catch (e) {
- observer.error(e);
- return;
- }
- if (subscriptionClosed(this)) cleanupSubscription(this);
- };
- Subscription.prototype = redefineAll({}, {
- unsubscribe: function unsubscribe() {
- closeSubscription(this);
- }
- });
- var SubscriptionObserver = function SubscriptionObserver(subscription) {
- this._s = subscription;
- };
- SubscriptionObserver.prototype = redefineAll({}, {
- next: function next(value) {
- var subscription = this._s;
- if (!subscriptionClosed(subscription)) {
- var observer = subscription._o;
- try {
- var m = getMethod(observer.next);
- if (m) return m.call(observer, value);
- } catch (e) {
- try {
- closeSubscription(subscription);
- } finally {
- throw e;
- }
- }
- }
- },
- error: function error(value) {
- var subscription = this._s;
- if (subscriptionClosed(subscription)) throw value;
- var observer = subscription._o;
- subscription._o = undefined;
- try {
- var m = getMethod(observer.error);
- if (!m) throw value;
- value = m.call(observer, value);
- } catch (e) {
- try {
- cleanupSubscription(subscription);
- } finally {
- throw e;
- }
- }
- cleanupSubscription(subscription);
- return value;
- },
- complete: function complete(value) {
- var subscription = this._s;
- if (!subscriptionClosed(subscription)) {
- var observer = subscription._o;
- subscription._o = undefined;
- try {
- var m = getMethod(observer.complete);
- value = m ? m.call(observer, value) : undefined;
- } catch (e) {
- try {
- cleanupSubscription(subscription);
- } finally {
- throw e;
- }
- }
- cleanupSubscription(subscription);
- return value;
- }
- }
- });
- var $Observable = function Observable(subscriber) {
- anInstance(this, $Observable, 'Observable', '_f')._f = aFunction(subscriber);
- };
- redefineAll($Observable.prototype, {
- subscribe: function subscribe(observer) {
- return new Subscription(observer, this._f);
- },
- forEach: function forEach(fn) {
- var that = this;
- return new (core.Promise || global.Promise)(function (resolve, reject) {
- aFunction(fn);
- var subscription = that.subscribe({
- next: function next(value) {
- try {
- return fn(value);
- } catch (e) {
- reject(e);
- subscription.unsubscribe();
- }
- },
- error: reject,
- complete: resolve
- });
- });
- }
- });
- redefineAll($Observable, {
- from: function from(x) {
- var C = typeof this === 'function' ? this : $Observable;
- var method = getMethod(anObject(x)[OBSERVABLE]);
- if (method) {
- var observable = anObject(method.call(x));
- return observable.constructor === C ? observable : new C(function (observer) {
- return observable.subscribe(observer);
- });
- }
- return new C(function (observer) {
- var done = false;
- microtask(function () {
- if (!done) {
- try {
- if (forOf(x, false, function (it) {
- observer.next(it);
- if (done) return RETURN;
- }) === RETURN) return;
- } catch (e) {
- if (done) throw e;
- observer.error(e);
- return;
- }
- observer.complete();
- }
- });
- return function () {
- done = true;
- };
- });
- },
- of: function of() {
- for (var i = 0, l = arguments.length, items = new Array(l); i < l;) items[i] = arguments[i++];
- return new (typeof this === 'function' ? this : $Observable)(function (observer) {
- var done = false;
- microtask(function () {
- if (!done) {
- for (var j = 0; j < items.length; ++j) {
- observer.next(items[j]);
- if (done) return;
- }
- observer.complete();
- }
- });
- return function () {
- done = true;
- };
- });
- }
- });
- hide($Observable.prototype, OBSERVABLE, function () {
- return this;
- });
- $export($export.G, {
- Observable: $Observable
- });
- __webpack_require__(4798)('Observable');
- /***/ }),
- /***/ 8088:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-promise-finally
- var $export = __webpack_require__(5913);
- var core = __webpack_require__(8544);
- var global = __webpack_require__(7381);
- var speciesConstructor = __webpack_require__(2035);
- var promiseResolve = __webpack_require__(3507);
- $export($export.P + $export.R, 'Promise', {
- 'finally': function _finally(onFinally) {
- var C = speciesConstructor(this, core.Promise || global.Promise);
- var isFunction = typeof onFinally == 'function';
- return this.then(isFunction ? function (x) {
- return promiseResolve(C, onFinally()).then(function () {
- return x;
- });
- } : onFinally, isFunction ? function (e) {
- return promiseResolve(C, onFinally()).then(function () {
- throw e;
- });
- } : onFinally);
- }
- });
- /***/ }),
- /***/ 5414:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-promise-try
- var $export = __webpack_require__(5913);
- var newPromiseCapability = __webpack_require__(4086);
- var perform = __webpack_require__(8228);
- $export($export.S, 'Promise', {
- 'try': function _try(callbackfn) {
- var promiseCapability = newPromiseCapability.f(this);
- var result = perform(callbackfn);
- (result.e ? promiseCapability.reject : promiseCapability.resolve)(result.v);
- return promiseCapability.promise;
- }
- });
- /***/ }),
- /***/ 2812:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var toMetaKey = metadata.key;
- var ordinaryDefineOwnMetadata = metadata.set;
- metadata.exp({
- defineMetadata: function defineMetadata(metadataKey, metadataValue, target, targetKey) {
- ordinaryDefineOwnMetadata(metadataKey, metadataValue, anObject(target), toMetaKey(targetKey));
- }
- });
- /***/ }),
- /***/ 2835:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var toMetaKey = metadata.key;
- var getOrCreateMetadataMap = metadata.map;
- var store = metadata.store;
- metadata.exp({
- deleteMetadata: function deleteMetadata(metadataKey, target /* , targetKey */) {
- var targetKey = arguments.length < 3 ? undefined : toMetaKey(arguments[2]);
- var metadataMap = getOrCreateMetadataMap(anObject(target), targetKey, false);
- if (metadataMap === undefined || !metadataMap['delete'](metadataKey)) return false;
- if (metadataMap.size) return true;
- var targetMetadata = store.get(target);
- targetMetadata['delete'](targetKey);
- return !!targetMetadata.size || store['delete'](target);
- }
- });
- /***/ }),
- /***/ 710:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var Set = __webpack_require__(3940);
- var from = __webpack_require__(5273);
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var getPrototypeOf = __webpack_require__(4153);
- var ordinaryOwnMetadataKeys = metadata.keys;
- var toMetaKey = metadata.key;
- var ordinaryMetadataKeys = function ordinaryMetadataKeys(O, P) {
- var oKeys = ordinaryOwnMetadataKeys(O, P);
- var parent = getPrototypeOf(O);
- if (parent === null) return oKeys;
- var pKeys = ordinaryMetadataKeys(parent, P);
- return pKeys.length ? oKeys.length ? from(new Set(oKeys.concat(pKeys))) : pKeys : oKeys;
- };
- metadata.exp({
- getMetadataKeys: function getMetadataKeys(target /* , targetKey */) {
- return ordinaryMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
- }
- });
- /***/ }),
- /***/ 7415:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var getPrototypeOf = __webpack_require__(4153);
- var ordinaryHasOwnMetadata = metadata.has;
- var ordinaryGetOwnMetadata = metadata.get;
- var toMetaKey = metadata.key;
- var ordinaryGetMetadata = function ordinaryGetMetadata(MetadataKey, O, P) {
- var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
- if (hasOwn) return ordinaryGetOwnMetadata(MetadataKey, O, P);
- var parent = getPrototypeOf(O);
- return parent !== null ? ordinaryGetMetadata(MetadataKey, parent, P) : undefined;
- };
- metadata.exp({
- getMetadata: function getMetadata(metadataKey, target /* , targetKey */) {
- return ordinaryGetMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
- }
- });
- /***/ }),
- /***/ 60:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var ordinaryOwnMetadataKeys = metadata.keys;
- var toMetaKey = metadata.key;
- metadata.exp({
- getOwnMetadataKeys: function getOwnMetadataKeys(target /* , targetKey */) {
- return ordinaryOwnMetadataKeys(anObject(target), arguments.length < 2 ? undefined : toMetaKey(arguments[1]));
- }
- });
- /***/ }),
- /***/ 3666:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var ordinaryGetOwnMetadata = metadata.get;
- var toMetaKey = metadata.key;
- metadata.exp({
- getOwnMetadata: function getOwnMetadata(metadataKey, target /* , targetKey */) {
- return ordinaryGetOwnMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
- }
- });
- /***/ }),
- /***/ 7216:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var getPrototypeOf = __webpack_require__(4153);
- var ordinaryHasOwnMetadata = metadata.has;
- var toMetaKey = metadata.key;
- var ordinaryHasMetadata = function ordinaryHasMetadata(MetadataKey, O, P) {
- var hasOwn = ordinaryHasOwnMetadata(MetadataKey, O, P);
- if (hasOwn) return true;
- var parent = getPrototypeOf(O);
- return parent !== null ? ordinaryHasMetadata(MetadataKey, parent, P) : false;
- };
- metadata.exp({
- hasMetadata: function hasMetadata(metadataKey, target /* , targetKey */) {
- return ordinaryHasMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
- }
- });
- /***/ }),
- /***/ 3470:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var ordinaryHasOwnMetadata = metadata.has;
- var toMetaKey = metadata.key;
- metadata.exp({
- hasOwnMetadata: function hasOwnMetadata(metadataKey, target /* , targetKey */) {
- return ordinaryHasOwnMetadata(metadataKey, anObject(target), arguments.length < 3 ? undefined : toMetaKey(arguments[2]));
- }
- });
- /***/ }),
- /***/ 2161:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $metadata = __webpack_require__(8953);
- var anObject = __webpack_require__(6154);
- var aFunction = __webpack_require__(6819);
- var toMetaKey = $metadata.key;
- var ordinaryDefineOwnMetadata = $metadata.set;
- $metadata.exp({
- metadata: function metadata(metadataKey, metadataValue) {
- return function decorator(target, targetKey) {
- ordinaryDefineOwnMetadata(metadataKey, metadataValue, (targetKey !== undefined ? anObject : aFunction)(target), toMetaKey(targetKey));
- };
- }
- });
- /***/ }),
- /***/ 922:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-set.from
- __webpack_require__(7598)('Set');
- /***/ }),
- /***/ 3798:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-set.of
- __webpack_require__(5329)('Set');
- /***/ }),
- /***/ 188:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/DavidBruant/Map-Set.prototype.toJSON
- var $export = __webpack_require__(5913);
- $export($export.P + $export.R, 'Set', {
- toJSON: __webpack_require__(1872)('Set')
- });
- /***/ }),
- /***/ 6696:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/mathiasbynens/String.prototype.at
- var $export = __webpack_require__(5913);
- var $at = __webpack_require__(3593)(true);
- var $fails = __webpack_require__(5810);
- var FORCED = $fails(function () {
- return '𠮷'.at(0) !== '𠮷';
- });
- $export($export.P + $export.F * FORCED, 'String', {
- at: function at(pos) {
- return $at(this, pos);
- }
- });
- /***/ }),
- /***/ 7593:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/String.prototype.matchAll/
- var $export = __webpack_require__(5913);
- var defined = __webpack_require__(408);
- var toLength = __webpack_require__(8315);
- var isRegExp = __webpack_require__(1993);
- var getFlags = __webpack_require__(2188);
- var RegExpProto = RegExp.prototype;
- var $RegExpStringIterator = function $RegExpStringIterator(regexp, string) {
- this._r = regexp;
- this._s = string;
- };
- __webpack_require__(8258)($RegExpStringIterator, 'RegExp String', function next() {
- var match = this._r.exec(this._s);
- return {
- value: match,
- done: match === null
- };
- });
- $export($export.P, 'String', {
- matchAll: function matchAll(regexp) {
- defined(this);
- if (!isRegExp(regexp)) throw TypeError(regexp + ' is not a regexp!');
- var S = String(this);
- var flags = 'flags' in RegExpProto ? String(regexp.flags) : getFlags.call(regexp);
- var rx = new RegExp(regexp.source, ~flags.indexOf('g') ? flags : 'g' + flags);
- rx.lastIndex = toLength(regexp.lastIndex);
- return new $RegExpStringIterator(rx, S);
- }
- });
- /***/ }),
- /***/ 2123:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-string-pad-start-end
- var $export = __webpack_require__(5913);
- var $pad = __webpack_require__(1925);
- var userAgent = __webpack_require__(851);
- // https://github.com/zloirock/core-js/issues/280
- var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
- $export($export.P + $export.F * WEBKIT_BUG, 'String', {
- padEnd: function padEnd(maxLength /* , fillString = ' ' */) {
- return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, false);
- }
- });
- /***/ }),
- /***/ 9391:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-string-pad-start-end
- var $export = __webpack_require__(5913);
- var $pad = __webpack_require__(1925);
- var userAgent = __webpack_require__(851);
- // https://github.com/zloirock/core-js/issues/280
- var WEBKIT_BUG = /Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(userAgent);
- $export($export.P + $export.F * WEBKIT_BUG, 'String', {
- padStart: function padStart(maxLength /* , fillString = ' ' */) {
- return $pad(this, maxLength, arguments.length > 1 ? arguments[1] : undefined, true);
- }
- });
- /***/ }),
- /***/ 6541:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
- __webpack_require__(618)('trimLeft', function ($trim) {
- return function trimLeft() {
- return $trim(this, 1);
- };
- }, 'trimStart');
- /***/ }),
- /***/ 1767:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/sebmarkbage/ecmascript-string-left-right-trim
- __webpack_require__(618)('trimRight', function ($trim) {
- return function trimRight() {
- return $trim(this, 2);
- };
- }, 'trimEnd');
- /***/ }),
- /***/ 4870:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(5721)('asyncIterator');
- /***/ }),
- /***/ 7937:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(5721)('observable');
- /***/ }),
- /***/ 3884:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://github.com/tc39/proposal-global
- var $export = __webpack_require__(5913);
- $export($export.S, 'System', {
- global: __webpack_require__(7381)
- });
- /***/ }),
- /***/ 2177:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.from
- __webpack_require__(7598)('WeakMap');
- /***/ }),
- /***/ 9737:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-weakmap.of
- __webpack_require__(5329)('WeakMap');
- /***/ }),
- /***/ 8791:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.from
- __webpack_require__(7598)('WeakSet');
- /***/ }),
- /***/ 5704:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // https://tc39.github.io/proposal-setmap-offrom/#sec-weakset.of
- __webpack_require__(5329)('WeakSet');
- /***/ }),
- /***/ 1094:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $iterators = __webpack_require__(4806);
- var getKeys = __webpack_require__(9924);
- var redefine = __webpack_require__(7278);
- var global = __webpack_require__(7381);
- var hide = __webpack_require__(8012);
- var Iterators = __webpack_require__(5301);
- var wks = __webpack_require__(3336);
- var ITERATOR = wks('iterator');
- var TO_STRING_TAG = wks('toStringTag');
- var ArrayValues = Iterators.Array;
- var DOMIterables = {
- CSSRuleList: true,
- // TODO: Not spec compliant, should be false.
- CSSStyleDeclaration: false,
- CSSValueList: false,
- ClientRectList: false,
- DOMRectList: false,
- DOMStringList: false,
- DOMTokenList: true,
- DataTransferItemList: false,
- FileList: false,
- HTMLAllCollection: false,
- HTMLCollection: false,
- HTMLFormElement: false,
- HTMLSelectElement: false,
- MediaList: true,
- // TODO: Not spec compliant, should be false.
- MimeTypeArray: false,
- NamedNodeMap: false,
- NodeList: true,
- PaintRequestList: false,
- Plugin: false,
- PluginArray: false,
- SVGLengthList: false,
- SVGNumberList: false,
- SVGPathSegList: false,
- SVGPointList: false,
- SVGStringList: false,
- SVGTransformList: false,
- SourceBufferList: false,
- StyleSheetList: true,
- // TODO: Not spec compliant, should be false.
- TextTrackCueList: false,
- TextTrackList: false,
- TouchList: false
- };
- for (var collections = getKeys(DOMIterables), i = 0; i < collections.length; i++) {
- var NAME = collections[i];
- var explicit = DOMIterables[NAME];
- var Collection = global[NAME];
- var proto = Collection && Collection.prototype;
- var key;
- if (proto) {
- if (!proto[ITERATOR]) hide(proto, ITERATOR, ArrayValues);
- if (!proto[TO_STRING_TAG]) hide(proto, TO_STRING_TAG, NAME);
- Iterators[NAME] = ArrayValues;
- if (explicit) for (key in $iterators) if (!proto[key]) redefine(proto, key, $iterators[key], true);
- }
- }
- /***/ }),
- /***/ 1605:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- var $export = __webpack_require__(5913);
- var $task = __webpack_require__(8220);
- $export($export.G + $export.B, {
- setImmediate: $task.set,
- clearImmediate: $task.clear
- });
- /***/ }),
- /***/ 2113:
- /***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
- // ie9- setTimeout & setInterval additional parameters fix
- var global = __webpack_require__(7381);
- var $export = __webpack_require__(5913);
- var userAgent = __webpack_require__(851);
- var slice = [].slice;
- var MSIE = /MSIE .\./.test(userAgent); // <- dirty ie9- check
- var wrap = function wrap(set) {
- return function (fn, time /* , ...args */) {
- var boundArgs = arguments.length > 2;
- var args = boundArgs ? slice.call(arguments, 2) : false;
- return set(boundArgs ? function () {
- // eslint-disable-next-line no-new-func
- (typeof fn == 'function' ? fn : Function(fn)).apply(this, args);
- } : fn, time);
- };
- };
- $export($export.G + $export.B + $export.F * MSIE, {
- setTimeout: wrap(global.setTimeout),
- setInterval: wrap(global.setInterval)
- });
- /***/ }),
- /***/ 2234:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- __webpack_require__(2403);
- __webpack_require__(3290);
- __webpack_require__(3690);
- __webpack_require__(8424);
- __webpack_require__(2357);
- __webpack_require__(6667);
- __webpack_require__(2506);
- __webpack_require__(6022);
- __webpack_require__(754);
- __webpack_require__(7571);
- __webpack_require__(6527);
- __webpack_require__(9219);
- __webpack_require__(3270);
- __webpack_require__(4919);
- __webpack_require__(5331);
- __webpack_require__(2456);
- __webpack_require__(8490);
- __webpack_require__(4554);
- __webpack_require__(161);
- __webpack_require__(6042);
- __webpack_require__(15);
- __webpack_require__(317);
- __webpack_require__(3271);
- __webpack_require__(440);
- __webpack_require__(1077);
- __webpack_require__(820);
- __webpack_require__(1914);
- __webpack_require__(4117);
- __webpack_require__(9619);
- __webpack_require__(5849);
- __webpack_require__(4750);
- __webpack_require__(1550);
- __webpack_require__(3529);
- __webpack_require__(2791);
- __webpack_require__(6831);
- __webpack_require__(4717);
- __webpack_require__(7292);
- __webpack_require__(1840);
- __webpack_require__(3255);
- __webpack_require__(5728);
- __webpack_require__(6255);
- __webpack_require__(2834);
- __webpack_require__(4489);
- __webpack_require__(575);
- __webpack_require__(1369);
- __webpack_require__(2751);
- __webpack_require__(9617);
- __webpack_require__(3656);
- __webpack_require__(1850);
- __webpack_require__(5424);
- __webpack_require__(230);
- __webpack_require__(8471);
- __webpack_require__(8577);
- __webpack_require__(7906);
- __webpack_require__(8587);
- __webpack_require__(6575);
- __webpack_require__(5281);
- __webpack_require__(3917);
- __webpack_require__(5450);
- __webpack_require__(9449);
- __webpack_require__(1616);
- __webpack_require__(9718);
- __webpack_require__(3845);
- __webpack_require__(5803);
- __webpack_require__(2222);
- __webpack_require__(5036);
- __webpack_require__(6131);
- __webpack_require__(4110);
- __webpack_require__(6235);
- __webpack_require__(6495);
- __webpack_require__(4162);
- __webpack_require__(5297);
- __webpack_require__(1466);
- __webpack_require__(2581);
- __webpack_require__(8384);
- __webpack_require__(2334);
- __webpack_require__(9701);
- __webpack_require__(1325);
- __webpack_require__(3233);
- __webpack_require__(1621);
- __webpack_require__(8671);
- __webpack_require__(6705);
- __webpack_require__(9437);
- __webpack_require__(7263);
- __webpack_require__(919);
- __webpack_require__(791);
- __webpack_require__(633);
- __webpack_require__(9355);
- __webpack_require__(9253);
- __webpack_require__(9892);
- __webpack_require__(9121);
- __webpack_require__(8738);
- __webpack_require__(4751);
- __webpack_require__(9822);
- __webpack_require__(4611);
- __webpack_require__(9217);
- __webpack_require__(4138);
- __webpack_require__(109);
- __webpack_require__(3821);
- __webpack_require__(4806);
- __webpack_require__(2566);
- __webpack_require__(5997);
- __webpack_require__(8359);
- __webpack_require__(7181);
- __webpack_require__(8682);
- __webpack_require__(8514);
- __webpack_require__(5105);
- __webpack_require__(5325);
- __webpack_require__(829);
- __webpack_require__(8969);
- __webpack_require__(3940);
- __webpack_require__(3491);
- __webpack_require__(6332);
- __webpack_require__(7195);
- __webpack_require__(5345);
- __webpack_require__(6670);
- __webpack_require__(7736);
- __webpack_require__(4457);
- __webpack_require__(7683);
- __webpack_require__(1123);
- __webpack_require__(4797);
- __webpack_require__(4871);
- __webpack_require__(8824);
- __webpack_require__(6472);
- __webpack_require__(1220);
- __webpack_require__(9263);
- __webpack_require__(7622);
- __webpack_require__(9060);
- __webpack_require__(980);
- __webpack_require__(6175);
- __webpack_require__(8484);
- __webpack_require__(9869);
- __webpack_require__(1285);
- __webpack_require__(4854);
- __webpack_require__(6647);
- __webpack_require__(7903);
- __webpack_require__(5197);
- __webpack_require__(3113);
- __webpack_require__(2963);
- __webpack_require__(6032);
- __webpack_require__(732);
- __webpack_require__(6696);
- __webpack_require__(9391);
- __webpack_require__(2123);
- __webpack_require__(6541);
- __webpack_require__(1767);
- __webpack_require__(7593);
- __webpack_require__(4870);
- __webpack_require__(7937);
- __webpack_require__(9168);
- __webpack_require__(6351);
- __webpack_require__(8217);
- __webpack_require__(6792);
- __webpack_require__(88);
- __webpack_require__(2095);
- __webpack_require__(2889);
- __webpack_require__(8455);
- __webpack_require__(188);
- __webpack_require__(9992);
- __webpack_require__(3798);
- __webpack_require__(9737);
- __webpack_require__(5704);
- __webpack_require__(3591);
- __webpack_require__(922);
- __webpack_require__(2177);
- __webpack_require__(8791);
- __webpack_require__(6426);
- __webpack_require__(3884);
- __webpack_require__(7469);
- __webpack_require__(4097);
- __webpack_require__(5813);
- __webpack_require__(7245);
- __webpack_require__(6756);
- __webpack_require__(8392);
- __webpack_require__(1111);
- __webpack_require__(3735);
- __webpack_require__(3037);
- __webpack_require__(8422);
- __webpack_require__(1818);
- __webpack_require__(7883);
- __webpack_require__(7371);
- __webpack_require__(8088);
- __webpack_require__(5414);
- __webpack_require__(2812);
- __webpack_require__(2835);
- __webpack_require__(7415);
- __webpack_require__(710);
- __webpack_require__(3666);
- __webpack_require__(60);
- __webpack_require__(7216);
- __webpack_require__(3470);
- __webpack_require__(2161);
- __webpack_require__(6321);
- __webpack_require__(5613);
- __webpack_require__(2113);
- __webpack_require__(1605);
- __webpack_require__(1094);
- module.exports = __webpack_require__(8544);
- /***/ }),
- /***/ 4036:
- /***/ ((module) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var isMergeableObject = function isMergeableObject(value) {
- return isNonNullObject(value) && !isSpecial(value);
- };
- function isNonNullObject(value) {
- return !!value && _typeof(value) === 'object';
- }
- function isSpecial(value) {
- var stringValue = Object.prototype.toString.call(value);
- return stringValue === '[object RegExp]' || stringValue === '[object Date]' || isReactElement(value);
- }
- // see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
- var canUseSymbol = typeof Symbol === 'function' && Symbol["for"];
- var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol["for"]('react.element') : 0xeac7;
- function isReactElement(value) {
- return value.$$typeof === REACT_ELEMENT_TYPE;
- }
- function emptyTarget(val) {
- return Array.isArray(val) ? [] : {};
- }
- function cloneUnlessOtherwiseSpecified(value, options) {
- return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
- }
- function defaultArrayMerge(target, source, options) {
- return target.concat(source).map(function (element) {
- return cloneUnlessOtherwiseSpecified(element, options);
- });
- }
- function getMergeFunction(key, options) {
- if (!options.customMerge) {
- return deepmerge;
- }
- var customMerge = options.customMerge(key);
- return typeof customMerge === 'function' ? customMerge : deepmerge;
- }
- function getEnumerableOwnPropertySymbols(target) {
- return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function (symbol) {
- return Object.propertyIsEnumerable.call(target, symbol);
- }) : [];
- }
- function getKeys(target) {
- return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
- }
- function propertyIsOnObject(object, property) {
- try {
- return property in object;
- } catch (_) {
- return false;
- }
- }
- // Protects from prototype poisoning and unexpected merging up the prototype chain.
- function propertyIsUnsafe(target, key) {
- return propertyIsOnObject(target, key) // Properties are safe to merge if they don't exist in the target yet,
- && !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
- && Object.propertyIsEnumerable.call(target, key)); // and also unsafe if they're nonenumerable.
- }
- function mergeObject(target, source, options) {
- var destination = {};
- if (options.isMergeableObject(target)) {
- getKeys(target).forEach(function (key) {
- destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
- });
- }
- getKeys(source).forEach(function (key) {
- if (propertyIsUnsafe(target, key)) {
- return;
- }
- if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
- destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
- } else {
- destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
- }
- });
- return destination;
- }
- function deepmerge(target, source, options) {
- options = options || {};
- options.arrayMerge = options.arrayMerge || defaultArrayMerge;
- options.isMergeableObject = options.isMergeableObject || isMergeableObject;
- // cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
- // implementations can use it. The caller may not replace it.
- options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
- var sourceIsArray = Array.isArray(source);
- var targetIsArray = Array.isArray(target);
- var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
- if (!sourceAndTargetTypesMatch) {
- return cloneUnlessOtherwiseSpecified(source, options);
- } else if (sourceIsArray) {
- return options.arrayMerge(target, source, options);
- } else {
- return mergeObject(target, source, options);
- }
- }
- deepmerge.all = function deepmergeAll(array, options) {
- if (!Array.isArray(array)) {
- throw new Error('first argument should be an array');
- }
- return array.reduce(function (prev, next) {
- return deepmerge(prev, next, options);
- }, {});
- };
- var deepmerge_1 = deepmerge;
- module.exports = deepmerge_1;
- /***/ }),
- /***/ 3117:
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.attributeNames = exports.elementNames = void 0;
- exports.elementNames = new Map([["altglyph", "altGlyph"], ["altglyphdef", "altGlyphDef"], ["altglyphitem", "altGlyphItem"], ["animatecolor", "animateColor"], ["animatemotion", "animateMotion"], ["animatetransform", "animateTransform"], ["clippath", "clipPath"], ["feblend", "feBlend"], ["fecolormatrix", "feColorMatrix"], ["fecomponenttransfer", "feComponentTransfer"], ["fecomposite", "feComposite"], ["feconvolvematrix", "feConvolveMatrix"], ["fediffuselighting", "feDiffuseLighting"], ["fedisplacementmap", "feDisplacementMap"], ["fedistantlight", "feDistantLight"], ["fedropshadow", "feDropShadow"], ["feflood", "feFlood"], ["fefunca", "feFuncA"], ["fefuncb", "feFuncB"], ["fefuncg", "feFuncG"], ["fefuncr", "feFuncR"], ["fegaussianblur", "feGaussianBlur"], ["feimage", "feImage"], ["femerge", "feMerge"], ["femergenode", "feMergeNode"], ["femorphology", "feMorphology"], ["feoffset", "feOffset"], ["fepointlight", "fePointLight"], ["fespecularlighting", "feSpecularLighting"], ["fespotlight", "feSpotLight"], ["fetile", "feTile"], ["feturbulence", "feTurbulence"], ["foreignobject", "foreignObject"], ["glyphref", "glyphRef"], ["lineargradient", "linearGradient"], ["radialgradient", "radialGradient"], ["textpath", "textPath"]]);
- exports.attributeNames = new Map([["definitionurl", "definitionURL"], ["attributename", "attributeName"], ["attributetype", "attributeType"], ["basefrequency", "baseFrequency"], ["baseprofile", "baseProfile"], ["calcmode", "calcMode"], ["clippathunits", "clipPathUnits"], ["diffuseconstant", "diffuseConstant"], ["edgemode", "edgeMode"], ["filterunits", "filterUnits"], ["glyphref", "glyphRef"], ["gradienttransform", "gradientTransform"], ["gradientunits", "gradientUnits"], ["kernelmatrix", "kernelMatrix"], ["kernelunitlength", "kernelUnitLength"], ["keypoints", "keyPoints"], ["keysplines", "keySplines"], ["keytimes", "keyTimes"], ["lengthadjust", "lengthAdjust"], ["limitingconeangle", "limitingConeAngle"], ["markerheight", "markerHeight"], ["markerunits", "markerUnits"], ["markerwidth", "markerWidth"], ["maskcontentunits", "maskContentUnits"], ["maskunits", "maskUnits"], ["numoctaves", "numOctaves"], ["pathlength", "pathLength"], ["patterncontentunits", "patternContentUnits"], ["patterntransform", "patternTransform"], ["patternunits", "patternUnits"], ["pointsatx", "pointsAtX"], ["pointsaty", "pointsAtY"], ["pointsatz", "pointsAtZ"], ["preservealpha", "preserveAlpha"], ["preserveaspectratio", "preserveAspectRatio"], ["primitiveunits", "primitiveUnits"], ["refx", "refX"], ["refy", "refY"], ["repeatcount", "repeatCount"], ["repeatdur", "repeatDur"], ["requiredextensions", "requiredExtensions"], ["requiredfeatures", "requiredFeatures"], ["specularconstant", "specularConstant"], ["specularexponent", "specularExponent"], ["spreadmethod", "spreadMethod"], ["startoffset", "startOffset"], ["stddeviation", "stdDeviation"], ["stitchtiles", "stitchTiles"], ["surfacescale", "surfaceScale"], ["systemlanguage", "systemLanguage"], ["tablevalues", "tableValues"], ["targetx", "targetX"], ["targety", "targetY"], ["textlength", "textLength"], ["viewbox", "viewBox"], ["viewtarget", "viewTarget"], ["xchannelselector", "xChannelSelector"], ["ychannelselector", "yChannelSelector"], ["zoomandpan", "zoomAndPan"]]);
- /***/ }),
- /***/ 1671:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __assign = this && this.__assign || function () {
- __assign = Object.assign || function (t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, {
- enumerable: true,
- get: function get() {
- return m[k];
- }
- });
- } : function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
- });
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
- Object.defineProperty(o, "default", {
- enumerable: true,
- value: v
- });
- } : function (o, v) {
- o["default"] = v;
- });
- var __importStar = this && this.__importStar || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- /*
- * Module dependencies
- */
- var ElementType = __importStar(__webpack_require__(7304));
- var entities_1 = __webpack_require__(7531);
- /**
- * Mixed-case SVG and MathML tags & attributes
- * recognized by the HTML parser.
- *
- * @see https://html.spec.whatwg.org/multipage/parsing.html#parsing-main-inforeign
- */
- var foreignNames_1 = __webpack_require__(3117);
- var unencodedElements = new Set(["style", "script", "xmp", "iframe", "noembed", "noframes", "plaintext", "noscript"]);
- /**
- * Format attributes
- */
- function formatAttributes(attributes, opts) {
- if (!attributes) return;
- return Object.keys(attributes).map(function (key) {
- var _a, _b;
- var value = (_a = attributes[key]) !== null && _a !== void 0 ? _a : "";
- if (opts.xmlMode === "foreign") {
- /* Fix up mixed-case attribute names */
- key = (_b = foreignNames_1.attributeNames.get(key)) !== null && _b !== void 0 ? _b : key;
- }
- if (!opts.emptyAttrs && !opts.xmlMode && value === "") {
- return key;
- }
- return key + "=\"" + (opts.decodeEntities !== false ? entities_1.encodeXML(value) : value.replace(/"/g, """)) + "\"";
- }).join(" ");
- }
- /**
- * Self-enclosing tags
- */
- var singleTag = new Set(["area", "base", "basefont", "br", "col", "command", "embed", "frame", "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
- /**
- * Renders a DOM node or an array of DOM nodes to a string.
- *
- * Can be thought of as the equivalent of the `outerHTML` of the passed node(s).
- *
- * @param node Node to be rendered.
- * @param options Changes serialization behavior
- */
- function render(node, options) {
- if (options === void 0) {
- options = {};
- }
- var nodes = "length" in node ? node : [node];
- var output = "";
- for (var i = 0; i < nodes.length; i++) {
- output += renderNode(nodes[i], options);
- }
- return output;
- }
- exports["default"] = render;
- function renderNode(node, options) {
- switch (node.type) {
- case ElementType.Root:
- return render(node.children, options);
- case ElementType.Directive:
- case ElementType.Doctype:
- return renderDirective(node);
- case ElementType.Comment:
- return renderComment(node);
- case ElementType.CDATA:
- return renderCdata(node);
- case ElementType.Script:
- case ElementType.Style:
- case ElementType.Tag:
- return renderTag(node, options);
- case ElementType.Text:
- return renderText(node, options);
- }
- }
- var foreignModeIntegrationPoints = new Set(["mi", "mo", "mn", "ms", "mtext", "annotation-xml", "foreignObject", "desc", "title"]);
- var foreignElements = new Set(["svg", "math"]);
- function renderTag(elem, opts) {
- var _a;
- // Handle SVG / MathML in HTML
- if (opts.xmlMode === "foreign") {
- /* Fix up mixed-case element names */
- elem.name = (_a = foreignNames_1.elementNames.get(elem.name)) !== null && _a !== void 0 ? _a : elem.name;
- /* Exit foreign mode at integration points */
- if (elem.parent && foreignModeIntegrationPoints.has(elem.parent.name)) {
- opts = __assign(__assign({}, opts), {
- xmlMode: false
- });
- }
- }
- if (!opts.xmlMode && foreignElements.has(elem.name)) {
- opts = __assign(__assign({}, opts), {
- xmlMode: "foreign"
- });
- }
- var tag = "<" + elem.name;
- var attribs = formatAttributes(elem.attribs, opts);
- if (attribs) {
- tag += " " + attribs;
- }
- if (elem.children.length === 0 && (opts.xmlMode ?
- // In XML mode or foreign mode, and user hasn't explicitly turned off self-closing tags
- opts.selfClosingTags !== false :
- // User explicitly asked for self-closing tags, even in HTML mode
- opts.selfClosingTags && singleTag.has(elem.name))) {
- if (!opts.xmlMode) tag += " ";
- tag += "/>";
- } else {
- tag += ">";
- if (elem.children.length > 0) {
- tag += render(elem.children, opts);
- }
- if (opts.xmlMode || !singleTag.has(elem.name)) {
- tag += "</" + elem.name + ">";
- }
- }
- return tag;
- }
- function renderDirective(elem) {
- return "<" + elem.data + ">";
- }
- function renderText(elem, opts) {
- var data = elem.data || "";
- // If entities weren't decoded, no need to encode them back
- if (opts.decodeEntities !== false && !(!opts.xmlMode && elem.parent && unencodedElements.has(elem.parent.name))) {
- data = entities_1.encodeXML(data);
- }
- return data;
- }
- function renderCdata(elem) {
- return "<![CDATA[" + elem.children[0].data + "]]>";
- }
- function renderComment(elem) {
- return "<!--" + elem.data + "-->";
- }
- /***/ }),
- /***/ 7304:
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.Doctype = exports.CDATA = exports.Tag = exports.Style = exports.Script = exports.Comment = exports.Directive = exports.Text = exports.Root = exports.isTag = exports.ElementType = void 0;
- /** Types of elements found in htmlparser2's DOM */
- var ElementType;
- (function (ElementType) {
- /** Type for the root element of a document */
- ElementType["Root"] = "root";
- /** Type for Text */
- ElementType["Text"] = "text";
- /** Type for <? ... ?> */
- ElementType["Directive"] = "directive";
- /** Type for <!-- ... --> */
- ElementType["Comment"] = "comment";
- /** Type for <script> tags */
- ElementType["Script"] = "script";
- /** Type for <style> tags */
- ElementType["Style"] = "style";
- /** Type for Any tag */
- ElementType["Tag"] = "tag";
- /** Type for <![CDATA[ ... ]]> */
- ElementType["CDATA"] = "cdata";
- /** Type for <!doctype ...> */
- ElementType["Doctype"] = "doctype";
- })(ElementType = exports.ElementType || (exports.ElementType = {}));
- /**
- * Tests whether an element is a tag or not.
- *
- * @param elem Element to test
- */
- function isTag(elem) {
- return elem.type === ElementType.Tag || elem.type === ElementType.Script || elem.type === ElementType.Style;
- }
- exports.isTag = isTag;
- // Exports for backwards compatibility
- /** Type for the root element of a document */
- exports.Root = ElementType.Root;
- /** Type for Text */
- exports.Text = ElementType.Text;
- /** Type for <? ... ?> */
- exports.Directive = ElementType.Directive;
- /** Type for <!-- ... --> */
- exports.Comment = ElementType.Comment;
- /** Type for <script> tags */
- exports.Script = ElementType.Script;
- /** Type for <style> tags */
- exports.Style = ElementType.Style;
- /** Type for Any tag */
- exports.Tag = ElementType.Tag;
- /** Type for <![CDATA[ ... ]]> */
- exports.CDATA = ElementType.CDATA;
- /** Type for <!doctype ...> */
- exports.Doctype = ElementType.Doctype;
- /***/ }),
- /***/ 1363:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- var desc = Object.getOwnPropertyDescriptor(m, k);
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
- desc = {
- enumerable: true,
- get: function get() {
- return m[k];
- }
- };
- }
- Object.defineProperty(o, k2, desc);
- } : function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
- });
- var __exportStar = this && this.__exportStar || function (m, exports) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.DomHandler = void 0;
- var domelementtype_1 = __webpack_require__(7304);
- var node_1 = __webpack_require__(5653);
- __exportStar(__webpack_require__(5653), exports);
- var reWhitespace = /\s+/g;
- // Default options
- var defaultOpts = {
- normalizeWhitespace: false,
- withStartIndices: false,
- withEndIndices: false,
- xmlMode: false
- };
- var DomHandler = /** @class */function () {
- /**
- * @param callback Called once parsing has completed.
- * @param options Settings for the handler.
- * @param elementCB Callback whenever a tag is closed.
- */
- function DomHandler(callback, options, elementCB) {
- /** The elements of the DOM */
- this.dom = [];
- /** The root element for the DOM */
- this.root = new node_1.Document(this.dom);
- /** Indicated whether parsing has been completed. */
- this.done = false;
- /** Stack of open tags. */
- this.tagStack = [this.root];
- /** A data node that is still being written to. */
- this.lastNode = null;
- /** Reference to the parser instance. Used for location information. */
- this.parser = null;
- // Make it possible to skip arguments, for backwards-compatibility
- if (typeof options === "function") {
- elementCB = options;
- options = defaultOpts;
- }
- if (_typeof(callback) === "object") {
- options = callback;
- callback = undefined;
- }
- this.callback = callback !== null && callback !== void 0 ? callback : null;
- this.options = options !== null && options !== void 0 ? options : defaultOpts;
- this.elementCB = elementCB !== null && elementCB !== void 0 ? elementCB : null;
- }
- DomHandler.prototype.onparserinit = function (parser) {
- this.parser = parser;
- };
- // Resets the handler back to starting state
- DomHandler.prototype.onreset = function () {
- this.dom = [];
- this.root = new node_1.Document(this.dom);
- this.done = false;
- this.tagStack = [this.root];
- this.lastNode = null;
- this.parser = null;
- };
- // Signals the handler that parsing is done
- DomHandler.prototype.onend = function () {
- if (this.done) return;
- this.done = true;
- this.parser = null;
- this.handleCallback(null);
- };
- DomHandler.prototype.onerror = function (error) {
- this.handleCallback(error);
- };
- DomHandler.prototype.onclosetag = function () {
- this.lastNode = null;
- var elem = this.tagStack.pop();
- if (this.options.withEndIndices) {
- elem.endIndex = this.parser.endIndex;
- }
- if (this.elementCB) this.elementCB(elem);
- };
- DomHandler.prototype.onopentag = function (name, attribs) {
- var type = this.options.xmlMode ? domelementtype_1.ElementType.Tag : undefined;
- var element = new node_1.Element(name, attribs, undefined, type);
- this.addNode(element);
- this.tagStack.push(element);
- };
- DomHandler.prototype.ontext = function (data) {
- var normalizeWhitespace = this.options.normalizeWhitespace;
- var lastNode = this.lastNode;
- if (lastNode && lastNode.type === domelementtype_1.ElementType.Text) {
- if (normalizeWhitespace) {
- lastNode.data = (lastNode.data + data).replace(reWhitespace, " ");
- } else {
- lastNode.data += data;
- }
- if (this.options.withEndIndices) {
- lastNode.endIndex = this.parser.endIndex;
- }
- } else {
- if (normalizeWhitespace) {
- data = data.replace(reWhitespace, " ");
- }
- var node = new node_1.Text(data);
- this.addNode(node);
- this.lastNode = node;
- }
- };
- DomHandler.prototype.oncomment = function (data) {
- if (this.lastNode && this.lastNode.type === domelementtype_1.ElementType.Comment) {
- this.lastNode.data += data;
- return;
- }
- var node = new node_1.Comment(data);
- this.addNode(node);
- this.lastNode = node;
- };
- DomHandler.prototype.oncommentend = function () {
- this.lastNode = null;
- };
- DomHandler.prototype.oncdatastart = function () {
- var text = new node_1.Text("");
- var node = new node_1.NodeWithChildren(domelementtype_1.ElementType.CDATA, [text]);
- this.addNode(node);
- text.parent = node;
- this.lastNode = text;
- };
- DomHandler.prototype.oncdataend = function () {
- this.lastNode = null;
- };
- DomHandler.prototype.onprocessinginstruction = function (name, data) {
- var node = new node_1.ProcessingInstruction(name, data);
- this.addNode(node);
- };
- DomHandler.prototype.handleCallback = function (error) {
- if (typeof this.callback === "function") {
- this.callback(error, this.dom);
- } else if (error) {
- throw error;
- }
- };
- DomHandler.prototype.addNode = function (node) {
- var parent = this.tagStack[this.tagStack.length - 1];
- var previousSibling = parent.children[parent.children.length - 1];
- if (this.options.withStartIndices) {
- node.startIndex = this.parser.startIndex;
- }
- if (this.options.withEndIndices) {
- node.endIndex = this.parser.endIndex;
- }
- parent.children.push(node);
- if (previousSibling) {
- node.prev = previousSibling;
- previousSibling.next = node;
- }
- node.parent = parent;
- this.lastNode = null;
- };
- return DomHandler;
- }();
- exports.DomHandler = DomHandler;
- exports["default"] = DomHandler;
- /***/ }),
- /***/ 5653:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __extends = this && this.__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __assign = this && this.__assign || function () {
- __assign = Object.assign || function (t) {
- for (var s, i = 1, n = arguments.length; i < n; i++) {
- s = arguments[i];
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
- }
- return t;
- };
- return __assign.apply(this, arguments);
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.cloneNode = exports.hasChildren = exports.isDocument = exports.isDirective = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = exports.Element = exports.Document = exports.NodeWithChildren = exports.ProcessingInstruction = exports.Comment = exports.Text = exports.DataNode = exports.Node = void 0;
- var domelementtype_1 = __webpack_require__(7304);
- var nodeTypes = new Map([[domelementtype_1.ElementType.Tag, 1], [domelementtype_1.ElementType.Script, 1], [domelementtype_1.ElementType.Style, 1], [domelementtype_1.ElementType.Directive, 1], [domelementtype_1.ElementType.Text, 3], [domelementtype_1.ElementType.CDATA, 4], [domelementtype_1.ElementType.Comment, 8], [domelementtype_1.ElementType.Root, 9]]);
- /**
- * This object will be used as the prototype for Nodes when creating a
- * DOM-Level-1-compliant structure.
- */
- var Node = /** @class */function () {
- /**
- *
- * @param type The type of the node.
- */
- function Node(type) {
- this.type = type;
- /** Parent of the node */
- this.parent = null;
- /** Previous sibling */
- this.prev = null;
- /** Next sibling */
- this.next = null;
- /** The start index of the node. Requires `withStartIndices` on the handler to be `true. */
- this.startIndex = null;
- /** The end index of the node. Requires `withEndIndices` on the handler to be `true. */
- this.endIndex = null;
- }
- Object.defineProperty(Node.prototype, "nodeType", {
- // Read-only aliases
- /**
- * [DOM spec](https://dom.spec.whatwg.org/#dom-node-nodetype)-compatible
- * node {@link type}.
- */
- get: function get() {
- var _a;
- return (_a = nodeTypes.get(this.type)) !== null && _a !== void 0 ? _a : 1;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Node.prototype, "parentNode", {
- // Read-write aliases for properties
- /**
- * Same as {@link parent}.
- * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
- */
- get: function get() {
- return this.parent;
- },
- set: function set(parent) {
- this.parent = parent;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Node.prototype, "previousSibling", {
- /**
- * Same as {@link prev}.
- * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
- */
- get: function get() {
- return this.prev;
- },
- set: function set(prev) {
- this.prev = prev;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Node.prototype, "nextSibling", {
- /**
- * Same as {@link next}.
- * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
- */
- get: function get() {
- return this.next;
- },
- set: function set(next) {
- this.next = next;
- },
- enumerable: false,
- configurable: true
- });
- /**
- * Clone this node, and optionally its children.
- *
- * @param recursive Clone child nodes as well.
- * @returns A clone of the node.
- */
- Node.prototype.cloneNode = function (recursive) {
- if (recursive === void 0) {
- recursive = false;
- }
- return cloneNode(this, recursive);
- };
- return Node;
- }();
- exports.Node = Node;
- /**
- * A node that contains some data.
- */
- var DataNode = /** @class */function (_super) {
- __extends(DataNode, _super);
- /**
- * @param type The type of the node
- * @param data The content of the data node
- */
- function DataNode(type, data) {
- var _this = _super.call(this, type) || this;
- _this.data = data;
- return _this;
- }
- Object.defineProperty(DataNode.prototype, "nodeValue", {
- /**
- * Same as {@link data}.
- * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
- */
- get: function get() {
- return this.data;
- },
- set: function set(data) {
- this.data = data;
- },
- enumerable: false,
- configurable: true
- });
- return DataNode;
- }(Node);
- exports.DataNode = DataNode;
- /**
- * Text within the document.
- */
- var Text = /** @class */function (_super) {
- __extends(Text, _super);
- function Text(data) {
- return _super.call(this, domelementtype_1.ElementType.Text, data) || this;
- }
- return Text;
- }(DataNode);
- exports.Text = Text;
- /**
- * Comments within the document.
- */
- var Comment = /** @class */function (_super) {
- __extends(Comment, _super);
- function Comment(data) {
- return _super.call(this, domelementtype_1.ElementType.Comment, data) || this;
- }
- return Comment;
- }(DataNode);
- exports.Comment = Comment;
- /**
- * Processing instructions, including doc types.
- */
- var ProcessingInstruction = /** @class */function (_super) {
- __extends(ProcessingInstruction, _super);
- function ProcessingInstruction(name, data) {
- var _this = _super.call(this, domelementtype_1.ElementType.Directive, data) || this;
- _this.name = name;
- return _this;
- }
- return ProcessingInstruction;
- }(DataNode);
- exports.ProcessingInstruction = ProcessingInstruction;
- /**
- * A `Node` that can have children.
- */
- var NodeWithChildren = /** @class */function (_super) {
- __extends(NodeWithChildren, _super);
- /**
- * @param type Type of the node.
- * @param children Children of the node. Only certain node types can have children.
- */
- function NodeWithChildren(type, children) {
- var _this = _super.call(this, type) || this;
- _this.children = children;
- return _this;
- }
- Object.defineProperty(NodeWithChildren.prototype, "firstChild", {
- // Aliases
- /** First child of the node. */
- get: function get() {
- var _a;
- return (_a = this.children[0]) !== null && _a !== void 0 ? _a : null;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(NodeWithChildren.prototype, "lastChild", {
- /** Last child of the node. */
- get: function get() {
- return this.children.length > 0 ? this.children[this.children.length - 1] : null;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(NodeWithChildren.prototype, "childNodes", {
- /**
- * Same as {@link children}.
- * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
- */
- get: function get() {
- return this.children;
- },
- set: function set(children) {
- this.children = children;
- },
- enumerable: false,
- configurable: true
- });
- return NodeWithChildren;
- }(Node);
- exports.NodeWithChildren = NodeWithChildren;
- /**
- * The root node of the document.
- */
- var Document = /** @class */function (_super) {
- __extends(Document, _super);
- function Document(children) {
- return _super.call(this, domelementtype_1.ElementType.Root, children) || this;
- }
- return Document;
- }(NodeWithChildren);
- exports.Document = Document;
- /**
- * An element within the DOM.
- */
- var Element = /** @class */function (_super) {
- __extends(Element, _super);
- /**
- * @param name Name of the tag, eg. `div`, `span`.
- * @param attribs Object mapping attribute names to attribute values.
- * @param children Children of the node.
- */
- function Element(name, attribs, children, type) {
- if (children === void 0) {
- children = [];
- }
- if (type === void 0) {
- type = name === "script" ? domelementtype_1.ElementType.Script : name === "style" ? domelementtype_1.ElementType.Style : domelementtype_1.ElementType.Tag;
- }
- var _this = _super.call(this, type, children) || this;
- _this.name = name;
- _this.attribs = attribs;
- return _this;
- }
- Object.defineProperty(Element.prototype, "tagName", {
- // DOM Level 1 aliases
- /**
- * Same as {@link name}.
- * [DOM spec](https://dom.spec.whatwg.org)-compatible alias.
- */
- get: function get() {
- return this.name;
- },
- set: function set(name) {
- this.name = name;
- },
- enumerable: false,
- configurable: true
- });
- Object.defineProperty(Element.prototype, "attributes", {
- get: function get() {
- var _this = this;
- return Object.keys(this.attribs).map(function (name) {
- var _a, _b;
- return {
- name: name,
- value: _this.attribs[name],
- namespace: (_a = _this["x-attribsNamespace"]) === null || _a === void 0 ? void 0 : _a[name],
- prefix: (_b = _this["x-attribsPrefix"]) === null || _b === void 0 ? void 0 : _b[name]
- };
- });
- },
- enumerable: false,
- configurable: true
- });
- return Element;
- }(NodeWithChildren);
- exports.Element = Element;
- /**
- * @param node Node to check.
- * @returns `true` if the node is a `Element`, `false` otherwise.
- */
- function isTag(node) {
- return (0, domelementtype_1.isTag)(node);
- }
- exports.isTag = isTag;
- /**
- * @param node Node to check.
- * @returns `true` if the node has the type `CDATA`, `false` otherwise.
- */
- function isCDATA(node) {
- return node.type === domelementtype_1.ElementType.CDATA;
- }
- exports.isCDATA = isCDATA;
- /**
- * @param node Node to check.
- * @returns `true` if the node has the type `Text`, `false` otherwise.
- */
- function isText(node) {
- return node.type === domelementtype_1.ElementType.Text;
- }
- exports.isText = isText;
- /**
- * @param node Node to check.
- * @returns `true` if the node has the type `Comment`, `false` otherwise.
- */
- function isComment(node) {
- return node.type === domelementtype_1.ElementType.Comment;
- }
- exports.isComment = isComment;
- /**
- * @param node Node to check.
- * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
- */
- function isDirective(node) {
- return node.type === domelementtype_1.ElementType.Directive;
- }
- exports.isDirective = isDirective;
- /**
- * @param node Node to check.
- * @returns `true` if the node has the type `ProcessingInstruction`, `false` otherwise.
- */
- function isDocument(node) {
- return node.type === domelementtype_1.ElementType.Root;
- }
- exports.isDocument = isDocument;
- /**
- * @param node Node to check.
- * @returns `true` if the node is a `NodeWithChildren` (has children), `false` otherwise.
- */
- function hasChildren(node) {
- return Object.prototype.hasOwnProperty.call(node, "children");
- }
- exports.hasChildren = hasChildren;
- /**
- * Clone a node, and optionally its children.
- *
- * @param recursive Clone child nodes as well.
- * @returns A clone of the node.
- */
- function cloneNode(node, recursive) {
- if (recursive === void 0) {
- recursive = false;
- }
- var result;
- if (isText(node)) {
- result = new Text(node.data);
- } else if (isComment(node)) {
- result = new Comment(node.data);
- } else if (isTag(node)) {
- var children = recursive ? cloneChildren(node.children) : [];
- var clone_1 = new Element(node.name, __assign({}, node.attribs), children);
- children.forEach(function (child) {
- return child.parent = clone_1;
- });
- if (node.namespace != null) {
- clone_1.namespace = node.namespace;
- }
- if (node["x-attribsNamespace"]) {
- clone_1["x-attribsNamespace"] = __assign({}, node["x-attribsNamespace"]);
- }
- if (node["x-attribsPrefix"]) {
- clone_1["x-attribsPrefix"] = __assign({}, node["x-attribsPrefix"]);
- }
- result = clone_1;
- } else if (isCDATA(node)) {
- var children = recursive ? cloneChildren(node.children) : [];
- var clone_2 = new NodeWithChildren(domelementtype_1.ElementType.CDATA, children);
- children.forEach(function (child) {
- return child.parent = clone_2;
- });
- result = clone_2;
- } else if (isDocument(node)) {
- var children = recursive ? cloneChildren(node.children) : [];
- var clone_3 = new Document(children);
- children.forEach(function (child) {
- return child.parent = clone_3;
- });
- if (node["x-mode"]) {
- clone_3["x-mode"] = node["x-mode"];
- }
- result = clone_3;
- } else if (isDirective(node)) {
- var instruction = new ProcessingInstruction(node.name, node.data);
- if (node["x-name"] != null) {
- instruction["x-name"] = node["x-name"];
- instruction["x-publicId"] = node["x-publicId"];
- instruction["x-systemId"] = node["x-systemId"];
- }
- result = instruction;
- } else {
- throw new Error("Not implemented yet: ".concat(node.type));
- }
- result.startIndex = node.startIndex;
- result.endIndex = node.endIndex;
- if (node.sourceCodeLocation != null) {
- result.sourceCodeLocation = node.sourceCodeLocation;
- }
- return result;
- }
- exports.cloneNode = cloneNode;
- function cloneChildren(childs) {
- var children = childs.map(function (child) {
- return cloneNode(child, true);
- });
- for (var i = 1; i < children.length; i++) {
- children[i].prev = children[i - 1];
- children[i - 1].next = children[i];
- }
- return children;
- }
- /***/ }),
- /***/ 3625:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.getFeed = void 0;
- var stringify_1 = __webpack_require__(3633);
- var legacy_1 = __webpack_require__(7344);
- /**
- * Get the feed object from the root of a DOM tree.
- *
- * @param doc - The DOM to to extract the feed from.
- * @returns The feed.
- */
- function getFeed(doc) {
- var feedRoot = getOneElement(isValidFeed, doc);
- return !feedRoot ? null : feedRoot.name === "feed" ? getAtomFeed(feedRoot) : getRssFeed(feedRoot);
- }
- exports.getFeed = getFeed;
- /**
- * Parse an Atom feed.
- *
- * @param feedRoot The root of the feed.
- * @returns The parsed feed.
- */
- function getAtomFeed(feedRoot) {
- var _a;
- var childs = feedRoot.children;
- var feed = {
- type: "atom",
- items: (0, legacy_1.getElementsByTagName)("entry", childs).map(function (item) {
- var _a;
- var children = item.children;
- var entry = {
- media: getMediaElements(children)
- };
- addConditionally(entry, "id", "id", children);
- addConditionally(entry, "title", "title", children);
- var href = (_a = getOneElement("link", children)) === null || _a === void 0 ? void 0 : _a.attribs.href;
- if (href) {
- entry.link = href;
- }
- var description = fetch("summary", children) || fetch("content", children);
- if (description) {
- entry.description = description;
- }
- var pubDate = fetch("updated", children);
- if (pubDate) {
- entry.pubDate = new Date(pubDate);
- }
- return entry;
- })
- };
- addConditionally(feed, "id", "id", childs);
- addConditionally(feed, "title", "title", childs);
- var href = (_a = getOneElement("link", childs)) === null || _a === void 0 ? void 0 : _a.attribs.href;
- if (href) {
- feed.link = href;
- }
- addConditionally(feed, "description", "subtitle", childs);
- var updated = fetch("updated", childs);
- if (updated) {
- feed.updated = new Date(updated);
- }
- addConditionally(feed, "author", "email", childs, true);
- return feed;
- }
- /**
- * Parse a RSS feed.
- *
- * @param feedRoot The root of the feed.
- * @returns The parsed feed.
- */
- function getRssFeed(feedRoot) {
- var _a, _b;
- var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
- var feed = {
- type: feedRoot.name.substr(0, 3),
- id: "",
- items: (0, legacy_1.getElementsByTagName)("item", feedRoot.children).map(function (item) {
- var children = item.children;
- var entry = {
- media: getMediaElements(children)
- };
- addConditionally(entry, "id", "guid", children);
- addConditionally(entry, "title", "title", children);
- addConditionally(entry, "link", "link", children);
- addConditionally(entry, "description", "description", children);
- var pubDate = fetch("pubDate", children);
- if (pubDate) entry.pubDate = new Date(pubDate);
- return entry;
- })
- };
- addConditionally(feed, "title", "title", childs);
- addConditionally(feed, "link", "link", childs);
- addConditionally(feed, "description", "description", childs);
- var updated = fetch("lastBuildDate", childs);
- if (updated) {
- feed.updated = new Date(updated);
- }
- addConditionally(feed, "author", "managingEditor", childs, true);
- return feed;
- }
- var MEDIA_KEYS_STRING = ["url", "type", "lang"];
- var MEDIA_KEYS_INT = ["fileSize", "bitrate", "framerate", "samplingrate", "channels", "duration", "height", "width"];
- /**
- * Get all media elements of a feed item.
- *
- * @param where Nodes to search in.
- * @returns Media elements.
- */
- function getMediaElements(where) {
- return (0, legacy_1.getElementsByTagName)("media:content", where).map(function (elem) {
- var attribs = elem.attribs;
- var media = {
- medium: attribs.medium,
- isDefault: !!attribs.isDefault
- };
- for (var _i = 0, MEDIA_KEYS_STRING_1 = MEDIA_KEYS_STRING; _i < MEDIA_KEYS_STRING_1.length; _i++) {
- var attrib = MEDIA_KEYS_STRING_1[_i];
- if (attribs[attrib]) {
- media[attrib] = attribs[attrib];
- }
- }
- for (var _a = 0, MEDIA_KEYS_INT_1 = MEDIA_KEYS_INT; _a < MEDIA_KEYS_INT_1.length; _a++) {
- var attrib = MEDIA_KEYS_INT_1[_a];
- if (attribs[attrib]) {
- media[attrib] = parseInt(attribs[attrib], 10);
- }
- }
- if (attribs.expression) {
- media.expression = attribs.expression;
- }
- return media;
- });
- }
- /**
- * Get one element by tag name.
- *
- * @param tagName Tag name to look for
- * @param node Node to search in
- * @returns The element or null
- */
- function getOneElement(tagName, node) {
- return (0, legacy_1.getElementsByTagName)(tagName, node, true, 1)[0];
- }
- /**
- * Get the text content of an element with a certain tag name.
- *
- * @param tagName Tag name to look for.
- * @param where Node to search in.
- * @param recurse Whether to recurse into child nodes.
- * @returns The text content of the element.
- */
- function fetch(tagName, where, recurse) {
- if (recurse === void 0) {
- recurse = false;
- }
- return (0, stringify_1.textContent)((0, legacy_1.getElementsByTagName)(tagName, where, recurse, 1)).trim();
- }
- /**
- * Adds a property to an object if it has a value.
- *
- * @param obj Object to be extended
- * @param prop Property name
- * @param tagName Tag name that contains the conditionally added property
- * @param where Element to search for the property
- * @param recurse Whether to recurse into child nodes.
- */
- function addConditionally(obj, prop, tagName, where, recurse) {
- if (recurse === void 0) {
- recurse = false;
- }
- var val = fetch(tagName, where, recurse);
- if (val) obj[prop] = val;
- }
- /**
- * Checks if an element is a feed root node.
- *
- * @param value The name of the element to check.
- * @returns Whether an element is a feed root node.
- */
- function isValidFeed(value) {
- return value === "rss" || value === "feed" || value === "rdf:RDF";
- }
- /***/ }),
- /***/ 3757:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.uniqueSort = exports.compareDocumentPosition = exports.removeSubsets = void 0;
- var domhandler_1 = __webpack_require__(1363);
- /**
- * Given an array of nodes, remove any member that is contained by another.
- *
- * @param nodes Nodes to filter.
- * @returns Remaining nodes that aren't subtrees of each other.
- */
- function removeSubsets(nodes) {
- var idx = nodes.length;
- /*
- * Check if each node (or one of its ancestors) is already contained in the
- * array.
- */
- while (--idx >= 0) {
- var node = nodes[idx];
- /*
- * Remove the node if it is not unique.
- * We are going through the array from the end, so we only
- * have to check nodes that preceed the node under consideration in the array.
- */
- if (idx > 0 && nodes.lastIndexOf(node, idx - 1) >= 0) {
- nodes.splice(idx, 1);
- continue;
- }
- for (var ancestor = node.parent; ancestor; ancestor = ancestor.parent) {
- if (nodes.includes(ancestor)) {
- nodes.splice(idx, 1);
- break;
- }
- }
- }
- return nodes;
- }
- exports.removeSubsets = removeSubsets;
- /**
- * Compare the position of one node against another node in any other document.
- * The return value is a bitmask with the following values:
- *
- * Document order:
- * > There is an ordering, document order, defined on all the nodes in the
- * > document corresponding to the order in which the first character of the
- * > XML representation of each node occurs in the XML representation of the
- * > document after expansion of general entities. Thus, the document element
- * > node will be the first node. Element nodes occur before their children.
- * > Thus, document order orders element nodes in order of the occurrence of
- * > their start-tag in the XML (after expansion of entities). The attribute
- * > nodes of an element occur after the element and before its children. The
- * > relative order of attribute nodes is implementation-dependent./
- *
- * Source:
- * http://www.w3.org/TR/DOM-Level-3-Core/glossary.html#dt-document-order
- *
- * @param nodeA The first node to use in the comparison
- * @param nodeB The second node to use in the comparison
- * @returns A bitmask describing the input nodes' relative position.
- *
- * See http://dom.spec.whatwg.org/#dom-node-comparedocumentposition for
- * a description of these values.
- */
- function compareDocumentPosition(nodeA, nodeB) {
- var aParents = [];
- var bParents = [];
- if (nodeA === nodeB) {
- return 0;
- }
- var current = (0, domhandler_1.hasChildren)(nodeA) ? nodeA : nodeA.parent;
- while (current) {
- aParents.unshift(current);
- current = current.parent;
- }
- current = (0, domhandler_1.hasChildren)(nodeB) ? nodeB : nodeB.parent;
- while (current) {
- bParents.unshift(current);
- current = current.parent;
- }
- var maxIdx = Math.min(aParents.length, bParents.length);
- var idx = 0;
- while (idx < maxIdx && aParents[idx] === bParents[idx]) {
- idx++;
- }
- if (idx === 0) {
- return 1 /* DISCONNECTED */;
- }
- var sharedParent = aParents[idx - 1];
- var siblings = sharedParent.children;
- var aSibling = aParents[idx];
- var bSibling = bParents[idx];
- if (siblings.indexOf(aSibling) > siblings.indexOf(bSibling)) {
- if (sharedParent === nodeB) {
- return 4 /* FOLLOWING */ | 16 /* CONTAINED_BY */;
- }
- return 4 /* FOLLOWING */;
- }
- if (sharedParent === nodeA) {
- return 2 /* PRECEDING */ | 8 /* CONTAINS */;
- }
- return 2 /* PRECEDING */;
- }
- exports.compareDocumentPosition = compareDocumentPosition;
- /**
- * Sort an array of nodes based on their relative position in the document and
- * remove any duplicate nodes. If the array contains nodes that do not belong
- * to the same document, sort order is unspecified.
- *
- * @param nodes Array of DOM nodes.
- * @returns Collection of unique nodes, sorted in document order.
- */
- function uniqueSort(nodes) {
- nodes = nodes.filter(function (node, i, arr) {
- return !arr.includes(node, i + 1);
- });
- nodes.sort(function (a, b) {
- var relative = compareDocumentPosition(a, b);
- if (relative & 2 /* PRECEDING */) {
- return -1;
- } else if (relative & 4 /* FOLLOWING */) {
- return 1;
- }
- return 0;
- });
- return nodes;
- }
- exports.uniqueSort = uniqueSort;
- /***/ }),
- /***/ 5511:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, {
- enumerable: true,
- get: function get() {
- return m[k];
- }
- });
- } : function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
- });
- var __exportStar = this && this.__exportStar || function (m, exports) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.hasChildren = exports.isDocument = exports.isComment = exports.isText = exports.isCDATA = exports.isTag = void 0;
- __exportStar(__webpack_require__(3633), exports);
- __exportStar(__webpack_require__(6530), exports);
- __exportStar(__webpack_require__(1833), exports);
- __exportStar(__webpack_require__(7062), exports);
- __exportStar(__webpack_require__(7344), exports);
- __exportStar(__webpack_require__(3757), exports);
- __exportStar(__webpack_require__(3625), exports);
- /** @deprecated Use these methods from `domhandler` directly. */
- var domhandler_1 = __webpack_require__(1363);
- Object.defineProperty(exports, "isTag", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.isTag;
- }
- }));
- Object.defineProperty(exports, "isCDATA", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.isCDATA;
- }
- }));
- Object.defineProperty(exports, "isText", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.isText;
- }
- }));
- Object.defineProperty(exports, "isComment", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.isComment;
- }
- }));
- Object.defineProperty(exports, "isDocument", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.isDocument;
- }
- }));
- Object.defineProperty(exports, "hasChildren", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.hasChildren;
- }
- }));
- /***/ }),
- /***/ 7344:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.getElementsByTagType = exports.getElementsByTagName = exports.getElementById = exports.getElements = exports.testElement = void 0;
- var domhandler_1 = __webpack_require__(1363);
- var querying_1 = __webpack_require__(7062);
- var Checks = {
- tag_name: function tag_name(name) {
- if (typeof name === "function") {
- return function (elem) {
- return (0, domhandler_1.isTag)(elem) && name(elem.name);
- };
- } else if (name === "*") {
- return domhandler_1.isTag;
- }
- return function (elem) {
- return (0, domhandler_1.isTag)(elem) && elem.name === name;
- };
- },
- tag_type: function tag_type(type) {
- if (typeof type === "function") {
- return function (elem) {
- return type(elem.type);
- };
- }
- return function (elem) {
- return elem.type === type;
- };
- },
- tag_contains: function tag_contains(data) {
- if (typeof data === "function") {
- return function (elem) {
- return (0, domhandler_1.isText)(elem) && data(elem.data);
- };
- }
- return function (elem) {
- return (0, domhandler_1.isText)(elem) && elem.data === data;
- };
- }
- };
- /**
- * @param attrib Attribute to check.
- * @param value Attribute value to look for.
- * @returns A function to check whether the a node has an attribute with a particular value.
- */
- function getAttribCheck(attrib, value) {
- if (typeof value === "function") {
- return function (elem) {
- return (0, domhandler_1.isTag)(elem) && value(elem.attribs[attrib]);
- };
- }
- return function (elem) {
- return (0, domhandler_1.isTag)(elem) && elem.attribs[attrib] === value;
- };
- }
- /**
- * @param a First function to combine.
- * @param b Second function to combine.
- * @returns A function taking a node and returning `true` if either
- * of the input functions returns `true` for the node.
- */
- function combineFuncs(a, b) {
- return function (elem) {
- return a(elem) || b(elem);
- };
- }
- /**
- * @param options An object describing nodes to look for.
- * @returns A function executing all checks in `options` and returning `true`
- * if any of them match a node.
- */
- function compileTest(options) {
- var funcs = Object.keys(options).map(function (key) {
- var value = options[key];
- return Object.prototype.hasOwnProperty.call(Checks, key) ? Checks[key](value) : getAttribCheck(key, value);
- });
- return funcs.length === 0 ? null : funcs.reduce(combineFuncs);
- }
- /**
- * @param options An object describing nodes to look for.
- * @param node The element to test.
- * @returns Whether the element matches the description in `options`.
- */
- function testElement(options, node) {
- var test = compileTest(options);
- return test ? test(node) : true;
- }
- exports.testElement = testElement;
- /**
- * @param options An object describing nodes to look for.
- * @param nodes Nodes to search through.
- * @param recurse Also consider child nodes.
- * @param limit Maximum number of nodes to return.
- * @returns All nodes that match `options`.
- */
- function getElements(options, nodes, recurse, limit) {
- if (limit === void 0) {
- limit = Infinity;
- }
- var test = compileTest(options);
- return test ? (0, querying_1.filter)(test, nodes, recurse, limit) : [];
- }
- exports.getElements = getElements;
- /**
- * @param id The unique ID attribute value to look for.
- * @param nodes Nodes to search through.
- * @param recurse Also consider child nodes.
- * @returns The node with the supplied ID.
- */
- function getElementById(id, nodes, recurse) {
- if (recurse === void 0) {
- recurse = true;
- }
- if (!Array.isArray(nodes)) nodes = [nodes];
- return (0, querying_1.findOne)(getAttribCheck("id", id), nodes, recurse);
- }
- exports.getElementById = getElementById;
- /**
- * @param tagName Tag name to search for.
- * @param nodes Nodes to search through.
- * @param recurse Also consider child nodes.
- * @param limit Maximum number of nodes to return.
- * @returns All nodes with the supplied `tagName`.
- */
- function getElementsByTagName(tagName, nodes, recurse, limit) {
- if (recurse === void 0) {
- recurse = true;
- }
- if (limit === void 0) {
- limit = Infinity;
- }
- return (0, querying_1.filter)(Checks.tag_name(tagName), nodes, recurse, limit);
- }
- exports.getElementsByTagName = getElementsByTagName;
- /**
- * @param type Element type to look for.
- * @param nodes Nodes to search through.
- * @param recurse Also consider child nodes.
- * @param limit Maximum number of nodes to return.
- * @returns All nodes with the supplied `type`.
- */
- function getElementsByTagType(type, nodes, recurse, limit) {
- if (recurse === void 0) {
- recurse = true;
- }
- if (limit === void 0) {
- limit = Infinity;
- }
- return (0, querying_1.filter)(Checks.tag_type(type), nodes, recurse, limit);
- }
- exports.getElementsByTagType = getElementsByTagType;
- /***/ }),
- /***/ 1833:
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.prepend = exports.prependChild = exports.append = exports.appendChild = exports.replaceElement = exports.removeElement = void 0;
- /**
- * Remove an element from the dom
- *
- * @param elem The element to be removed
- */
- function removeElement(elem) {
- if (elem.prev) elem.prev.next = elem.next;
- if (elem.next) elem.next.prev = elem.prev;
- if (elem.parent) {
- var childs = elem.parent.children;
- childs.splice(childs.lastIndexOf(elem), 1);
- }
- }
- exports.removeElement = removeElement;
- /**
- * Replace an element in the dom
- *
- * @param elem The element to be replaced
- * @param replacement The element to be added
- */
- function replaceElement(elem, replacement) {
- var prev = replacement.prev = elem.prev;
- if (prev) {
- prev.next = replacement;
- }
- var next = replacement.next = elem.next;
- if (next) {
- next.prev = replacement;
- }
- var parent = replacement.parent = elem.parent;
- if (parent) {
- var childs = parent.children;
- childs[childs.lastIndexOf(elem)] = replacement;
- }
- }
- exports.replaceElement = replaceElement;
- /**
- * Append a child to an element.
- *
- * @param elem The element to append to.
- * @param child The element to be added as a child.
- */
- function appendChild(elem, child) {
- removeElement(child);
- child.next = null;
- child.parent = elem;
- if (elem.children.push(child) > 1) {
- var sibling = elem.children[elem.children.length - 2];
- sibling.next = child;
- child.prev = sibling;
- } else {
- child.prev = null;
- }
- }
- exports.appendChild = appendChild;
- /**
- * Append an element after another.
- *
- * @param elem The element to append after.
- * @param next The element be added.
- */
- function append(elem, next) {
- removeElement(next);
- var parent = elem.parent;
- var currNext = elem.next;
- next.next = currNext;
- next.prev = elem;
- elem.next = next;
- next.parent = parent;
- if (currNext) {
- currNext.prev = next;
- if (parent) {
- var childs = parent.children;
- childs.splice(childs.lastIndexOf(currNext), 0, next);
- }
- } else if (parent) {
- parent.children.push(next);
- }
- }
- exports.append = append;
- /**
- * Prepend a child to an element.
- *
- * @param elem The element to prepend before.
- * @param child The element to be added as a child.
- */
- function prependChild(elem, child) {
- removeElement(child);
- child.parent = elem;
- child.prev = null;
- if (elem.children.unshift(child) !== 1) {
- var sibling = elem.children[1];
- sibling.prev = child;
- child.next = sibling;
- } else {
- child.next = null;
- }
- }
- exports.prependChild = prependChild;
- /**
- * Prepend an element before another.
- *
- * @param elem The element to prepend before.
- * @param prev The element be added.
- */
- function prepend(elem, prev) {
- removeElement(prev);
- var parent = elem.parent;
- if (parent) {
- var childs = parent.children;
- childs.splice(childs.indexOf(elem), 0, prev);
- }
- if (elem.prev) {
- elem.prev.next = prev;
- }
- prev.parent = parent;
- prev.prev = elem.prev;
- prev.next = elem;
- elem.prev = prev;
- }
- exports.prepend = prepend;
- /***/ }),
- /***/ 7062:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.findAll = exports.existsOne = exports.findOne = exports.findOneChild = exports.find = exports.filter = void 0;
- var domhandler_1 = __webpack_require__(1363);
- /**
- * Search a node and its children for nodes passing a test function.
- *
- * @param test Function to test nodes on.
- * @param node Node to search. Will be included in the result set if it matches.
- * @param recurse Also consider child nodes.
- * @param limit Maximum number of nodes to return.
- * @returns All nodes passing `test`.
- */
- function filter(test, node, recurse, limit) {
- if (recurse === void 0) {
- recurse = true;
- }
- if (limit === void 0) {
- limit = Infinity;
- }
- if (!Array.isArray(node)) node = [node];
- return find(test, node, recurse, limit);
- }
- exports.filter = filter;
- /**
- * Search an array of node and its children for nodes passing a test function.
- *
- * @param test Function to test nodes on.
- * @param nodes Array of nodes to search.
- * @param recurse Also consider child nodes.
- * @param limit Maximum number of nodes to return.
- * @returns All nodes passing `test`.
- */
- function find(test, nodes, recurse, limit) {
- var result = [];
- for (var _i = 0, nodes_1 = nodes; _i < nodes_1.length; _i++) {
- var elem = nodes_1[_i];
- if (test(elem)) {
- result.push(elem);
- if (--limit <= 0) break;
- }
- if (recurse && (0, domhandler_1.hasChildren)(elem) && elem.children.length > 0) {
- var children = find(test, elem.children, recurse, limit);
- result.push.apply(result, children);
- limit -= children.length;
- if (limit <= 0) break;
- }
- }
- return result;
- }
- exports.find = find;
- /**
- * Finds the first element inside of an array that matches a test function.
- *
- * @param test Function to test nodes on.
- * @param nodes Array of nodes to search.
- * @returns The first node in the array that passes `test`.
- */
- function findOneChild(test, nodes) {
- return nodes.find(test);
- }
- exports.findOneChild = findOneChild;
- /**
- * Finds one element in a tree that passes a test.
- *
- * @param test Function to test nodes on.
- * @param nodes Array of nodes to search.
- * @param recurse Also consider child nodes.
- * @returns The first child node that passes `test`.
- */
- function findOne(test, nodes, recurse) {
- if (recurse === void 0) {
- recurse = true;
- }
- var elem = null;
- for (var i = 0; i < nodes.length && !elem; i++) {
- var checked = nodes[i];
- if (!(0, domhandler_1.isTag)(checked)) {
- continue;
- } else if (test(checked)) {
- elem = checked;
- } else if (recurse && checked.children.length > 0) {
- elem = findOne(test, checked.children);
- }
- }
- return elem;
- }
- exports.findOne = findOne;
- /**
- * @param test Function to test nodes on.
- * @param nodes Array of nodes to search.
- * @returns Whether a tree of nodes contains at least one node passing a test.
- */
- function existsOne(test, nodes) {
- return nodes.some(function (checked) {
- return (0, domhandler_1.isTag)(checked) && (test(checked) || checked.children.length > 0 && existsOne(test, checked.children));
- });
- }
- exports.existsOne = existsOne;
- /**
- * Search and array of nodes and its children for nodes passing a test function.
- *
- * Same as `find`, only with less options, leading to reduced complexity.
- *
- * @param test Function to test nodes on.
- * @param nodes Array of nodes to search.
- * @returns All nodes passing `test`.
- */
- function findAll(test, nodes) {
- var _a;
- var result = [];
- var stack = nodes.filter(domhandler_1.isTag);
- var elem;
- while (elem = stack.shift()) {
- var children = (_a = elem.children) === null || _a === void 0 ? void 0 : _a.filter(domhandler_1.isTag);
- if (children && children.length > 0) {
- stack.unshift.apply(stack, children);
- }
- if (test(elem)) result.push(elem);
- }
- return result;
- }
- exports.findAll = findAll;
- /***/ }),
- /***/ 3633:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.innerText = exports.textContent = exports.getText = exports.getInnerHTML = exports.getOuterHTML = void 0;
- var domhandler_1 = __webpack_require__(1363);
- var dom_serializer_1 = __importDefault(__webpack_require__(1671));
- var domelementtype_1 = __webpack_require__(7304);
- /**
- * @param node Node to get the outer HTML of.
- * @param options Options for serialization.
- * @deprecated Use the `dom-serializer` module directly.
- * @returns `node`'s outer HTML.
- */
- function getOuterHTML(node, options) {
- return (0, dom_serializer_1["default"])(node, options);
- }
- exports.getOuterHTML = getOuterHTML;
- /**
- * @param node Node to get the inner HTML of.
- * @param options Options for serialization.
- * @deprecated Use the `dom-serializer` module directly.
- * @returns `node`'s inner HTML.
- */
- function getInnerHTML(node, options) {
- return (0, domhandler_1.hasChildren)(node) ? node.children.map(function (node) {
- return getOuterHTML(node, options);
- }).join("") : "";
- }
- exports.getInnerHTML = getInnerHTML;
- /**
- * Get a node's inner text. Same as `textContent`, but inserts newlines for `<br>` tags.
- *
- * @deprecated Use `textContent` instead.
- * @param node Node to get the inner text of.
- * @returns `node`'s inner text.
- */
- function getText(node) {
- if (Array.isArray(node)) return node.map(getText).join("");
- if ((0, domhandler_1.isTag)(node)) return node.name === "br" ? "\n" : getText(node.children);
- if ((0, domhandler_1.isCDATA)(node)) return getText(node.children);
- if ((0, domhandler_1.isText)(node)) return node.data;
- return "";
- }
- exports.getText = getText;
- /**
- * Get a node's text content.
- *
- * @param node Node to get the text content of.
- * @returns `node`'s text content.
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/textContent}
- */
- function textContent(node) {
- if (Array.isArray(node)) return node.map(textContent).join("");
- if ((0, domhandler_1.hasChildren)(node) && !(0, domhandler_1.isComment)(node)) {
- return textContent(node.children);
- }
- if ((0, domhandler_1.isText)(node)) return node.data;
- return "";
- }
- exports.textContent = textContent;
- /**
- * Get a node's inner text.
- *
- * @param node Node to get the inner text of.
- * @returns `node`'s inner text.
- * @see {@link https://developer.mozilla.org/en-US/docs/Web/API/Node/innerText}
- */
- function innerText(node) {
- if (Array.isArray(node)) return node.map(innerText).join("");
- if ((0, domhandler_1.hasChildren)(node) && (node.type === domelementtype_1.ElementType.Tag || (0, domhandler_1.isCDATA)(node))) {
- return innerText(node.children);
- }
- if ((0, domhandler_1.isText)(node)) return node.data;
- return "";
- }
- exports.innerText = innerText;
- /***/ }),
- /***/ 6530:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.prevElementSibling = exports.nextElementSibling = exports.getName = exports.hasAttrib = exports.getAttributeValue = exports.getSiblings = exports.getParent = exports.getChildren = void 0;
- var domhandler_1 = __webpack_require__(1363);
- var emptyArray = [];
- /**
- * Get a node's children.
- *
- * @param elem Node to get the children of.
- * @returns `elem`'s children, or an empty array.
- */
- function getChildren(elem) {
- var _a;
- return (_a = elem.children) !== null && _a !== void 0 ? _a : emptyArray;
- }
- exports.getChildren = getChildren;
- /**
- * Get a node's parent.
- *
- * @param elem Node to get the parent of.
- * @returns `elem`'s parent node.
- */
- function getParent(elem) {
- return elem.parent || null;
- }
- exports.getParent = getParent;
- /**
- * Gets an elements siblings, including the element itself.
- *
- * Attempts to get the children through the element's parent first.
- * If we don't have a parent (the element is a root node),
- * we walk the element's `prev` & `next` to get all remaining nodes.
- *
- * @param elem Element to get the siblings of.
- * @returns `elem`'s siblings.
- */
- function getSiblings(elem) {
- var _a, _b;
- var parent = getParent(elem);
- if (parent != null) return getChildren(parent);
- var siblings = [elem];
- var prev = elem.prev,
- next = elem.next;
- while (prev != null) {
- siblings.unshift(prev);
- _a = prev, prev = _a.prev;
- }
- while (next != null) {
- siblings.push(next);
- _b = next, next = _b.next;
- }
- return siblings;
- }
- exports.getSiblings = getSiblings;
- /**
- * Gets an attribute from an element.
- *
- * @param elem Element to check.
- * @param name Attribute name to retrieve.
- * @returns The element's attribute value, or `undefined`.
- */
- function getAttributeValue(elem, name) {
- var _a;
- return (_a = elem.attribs) === null || _a === void 0 ? void 0 : _a[name];
- }
- exports.getAttributeValue = getAttributeValue;
- /**
- * Checks whether an element has an attribute.
- *
- * @param elem Element to check.
- * @param name Attribute name to look for.
- * @returns Returns whether `elem` has the attribute `name`.
- */
- function hasAttrib(elem, name) {
- return elem.attribs != null && Object.prototype.hasOwnProperty.call(elem.attribs, name) && elem.attribs[name] != null;
- }
- exports.hasAttrib = hasAttrib;
- /**
- * Get the tag name of an element.
- *
- * @param elem The element to get the name for.
- * @returns The tag name of `elem`.
- */
- function getName(elem) {
- return elem.name;
- }
- exports.getName = getName;
- /**
- * Returns the next element sibling of a node.
- *
- * @param elem The element to get the next sibling of.
- * @returns `elem`'s next sibling that is a tag.
- */
- function nextElementSibling(elem) {
- var _a;
- var next = elem.next;
- while (next !== null && !(0, domhandler_1.isTag)(next)) _a = next, next = _a.next;
- return next;
- }
- exports.nextElementSibling = nextElementSibling;
- /**
- * Returns the previous element sibling of a node.
- *
- * @param elem The element to get the previous sibling of.
- * @returns `elem`'s previous sibling that is a tag.
- */
- function prevElementSibling(elem) {
- var _a;
- var prev = elem.prev;
- while (prev !== null && !(0, domhandler_1.isTag)(prev)) _a = prev, prev = _a.prev;
- return prev;
- }
- exports.prevElementSibling = prevElementSibling;
- /***/ }),
- /***/ 6347:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.decodeHTML = exports.decodeHTMLStrict = exports.decodeXML = void 0;
- var entities_json_1 = __importDefault(__webpack_require__(9323));
- var legacy_json_1 = __importDefault(__webpack_require__(9591));
- var xml_json_1 = __importDefault(__webpack_require__(2586));
- var decode_codepoint_1 = __importDefault(__webpack_require__(8271));
- var strictEntityRe = /&(?:[a-zA-Z0-9]+|#[xX][\da-fA-F]+|#\d+);/g;
- exports.decodeXML = getStrictDecoder(xml_json_1["default"]);
- exports.decodeHTMLStrict = getStrictDecoder(entities_json_1["default"]);
- function getStrictDecoder(map) {
- var replace = getReplacer(map);
- return function (str) {
- return String(str).replace(strictEntityRe, replace);
- };
- }
- var sorter = function sorter(a, b) {
- return a < b ? 1 : -1;
- };
- exports.decodeHTML = function () {
- var legacy = Object.keys(legacy_json_1["default"]).sort(sorter);
- var keys = Object.keys(entities_json_1["default"]).sort(sorter);
- for (var i = 0, j = 0; i < keys.length; i++) {
- if (legacy[j] === keys[i]) {
- keys[i] += ";?";
- j++;
- } else {
- keys[i] += ";";
- }
- }
- var re = new RegExp("&(?:" + keys.join("|") + "|#[xX][\\da-fA-F]+;?|#\\d+;?)", "g");
- var replace = getReplacer(entities_json_1["default"]);
- function replacer(str) {
- if (str.substr(-1) !== ";") str += ";";
- return replace(str);
- }
- // TODO consider creating a merged map
- return function (str) {
- return String(str).replace(re, replacer);
- };
- }();
- function getReplacer(map) {
- return function replace(str) {
- if (str.charAt(1) === "#") {
- var secondChar = str.charAt(2);
- if (secondChar === "X" || secondChar === "x") {
- return decode_codepoint_1["default"](parseInt(str.substr(3), 16));
- }
- return decode_codepoint_1["default"](parseInt(str.substr(2), 10));
- }
- // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
- return map[str.slice(1, -1)] || str;
- };
- }
- /***/ }),
- /***/ 8271:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- var decode_json_1 = __importDefault(__webpack_require__(3600));
- // Adapted from https://github.com/mathiasbynens/he/blob/master/src/he.js#L94-L119
- var fromCodePoint =
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- String.fromCodePoint || function (codePoint) {
- var output = "";
- if (codePoint > 0xffff) {
- codePoint -= 0x10000;
- output += String.fromCharCode(codePoint >>> 10 & 0x3ff | 0xd800);
- codePoint = 0xdc00 | codePoint & 0x3ff;
- }
- output += String.fromCharCode(codePoint);
- return output;
- };
- function decodeCodePoint(codePoint) {
- if (codePoint >= 0xd800 && codePoint <= 0xdfff || codePoint > 0x10ffff) {
- return "\uFFFD";
- }
- if (codePoint in decode_json_1["default"]) {
- codePoint = decode_json_1["default"][codePoint];
- }
- return fromCodePoint(codePoint);
- }
- exports["default"] = decodeCodePoint;
- /***/ }),
- /***/ 3393:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = void 0;
- var xml_json_1 = __importDefault(__webpack_require__(2586));
- var inverseXML = getInverseObj(xml_json_1["default"]);
- var xmlReplacer = getInverseReplacer(inverseXML);
- /**
- * Encodes all non-ASCII characters, as well as characters not valid in XML
- * documents using XML entities.
- *
- * If a character has no equivalent entity, a
- * numeric hexadecimal reference (eg. `ü`) will be used.
- */
- exports.encodeXML = getASCIIEncoder(inverseXML);
- var entities_json_1 = __importDefault(__webpack_require__(9323));
- var inverseHTML = getInverseObj(entities_json_1["default"]);
- var htmlReplacer = getInverseReplacer(inverseHTML);
- /**
- * Encodes all entities and non-ASCII characters in the input.
- *
- * This includes characters that are valid ASCII characters in HTML documents.
- * For example `#` will be encoded as `#`. To get a more compact output,
- * consider using the `encodeNonAsciiHTML` function.
- *
- * If a character has no equivalent entity, a
- * numeric hexadecimal reference (eg. `ü`) will be used.
- */
- exports.encodeHTML = getInverse(inverseHTML, htmlReplacer);
- /**
- * Encodes all non-ASCII characters, as well as characters not valid in HTML
- * documents using HTML entities.
- *
- * If a character has no equivalent entity, a
- * numeric hexadecimal reference (eg. `ü`) will be used.
- */
- exports.encodeNonAsciiHTML = getASCIIEncoder(inverseHTML);
- function getInverseObj(obj) {
- return Object.keys(obj).sort().reduce(function (inverse, name) {
- inverse[obj[name]] = "&" + name + ";";
- return inverse;
- }, {});
- }
- function getInverseReplacer(inverse) {
- var single = [];
- var multiple = [];
- for (var _i = 0, _a = Object.keys(inverse); _i < _a.length; _i++) {
- var k = _a[_i];
- if (k.length === 1) {
- // Add value to single array
- single.push("\\" + k);
- } else {
- // Add value to multiple array
- multiple.push(k);
- }
- }
- // Add ranges to single characters.
- single.sort();
- for (var start = 0; start < single.length - 1; start++) {
- // Find the end of a run of characters
- var end = start;
- while (end < single.length - 1 && single[end].charCodeAt(1) + 1 === single[end + 1].charCodeAt(1)) {
- end += 1;
- }
- var count = 1 + end - start;
- // We want to replace at least three characters
- if (count < 3) continue;
- single.splice(start, count, single[start] + "-" + single[end]);
- }
- multiple.unshift("[" + single.join("") + "]");
- return new RegExp(multiple.join("|"), "g");
- }
- // /[^\0-\x7F]/gu
- var reNonASCII = /(?:[\x80-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])/g;
- var getCodePoint =
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- String.prototype.codePointAt != null ?
- // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
- function (str) {
- return str.codePointAt(0);
- } :
- // http://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
- function (c) {
- return (c.charCodeAt(0) - 0xd800) * 0x400 + c.charCodeAt(1) - 0xdc00 + 0x10000;
- };
- function singleCharReplacer(c) {
- return "&#x" + (c.length > 1 ? getCodePoint(c) : c.charCodeAt(0)).toString(16).toUpperCase() + ";";
- }
- function getInverse(inverse, re) {
- return function (data) {
- return data.replace(re, function (name) {
- return inverse[name];
- }).replace(reNonASCII, singleCharReplacer);
- };
- }
- var reEscapeChars = new RegExp(xmlReplacer.source + "|" + reNonASCII.source, "g");
- /**
- * Encodes all non-ASCII characters, as well as characters not valid in XML
- * documents using numeric hexadecimal reference (eg. `ü`).
- *
- * Have a look at `escapeUTF8` if you want a more concise output at the expense
- * of reduced transportability.
- *
- * @param data String to escape.
- */
- function escape(data) {
- return data.replace(reEscapeChars, singleCharReplacer);
- }
- exports.escape = escape;
- /**
- * Encodes all characters not valid in XML documents using numeric hexadecimal
- * reference (eg. `ü`).
- *
- * Note that the output will be character-set dependent.
- *
- * @param data String to escape.
- */
- function escapeUTF8(data) {
- return data.replace(xmlReplacer, singleCharReplacer);
- }
- exports.escapeUTF8 = escapeUTF8;
- function getASCIIEncoder(obj) {
- return function (data) {
- return data.replace(reEscapeChars, function (c) {
- return obj[c] || singleCharReplacer(c);
- });
- };
- }
- /***/ }),
- /***/ 7531:
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.decodeXMLStrict = exports.decodeHTML5Strict = exports.decodeHTML4Strict = exports.decodeHTML5 = exports.decodeHTML4 = exports.decodeHTMLStrict = exports.decodeHTML = exports.decodeXML = exports.encodeHTML5 = exports.encodeHTML4 = exports.escapeUTF8 = exports.escape = exports.encodeNonAsciiHTML = exports.encodeHTML = exports.encodeXML = exports.encode = exports.decodeStrict = exports.decode = void 0;
- var decode_1 = __webpack_require__(6347);
- var encode_1 = __webpack_require__(3393);
- /**
- * Decodes a string with entities.
- *
- * @param data String to decode.
- * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
- * @deprecated Use `decodeXML` or `decodeHTML` directly.
- */
- function decode(data, level) {
- return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTML)(data);
- }
- exports.decode = decode;
- /**
- * Decodes a string with entities. Does not allow missing trailing semicolons for entities.
- *
- * @param data String to decode.
- * @param level Optional level to decode at. 0 = XML, 1 = HTML. Default is 0.
- * @deprecated Use `decodeHTMLStrict` or `decodeXML` directly.
- */
- function decodeStrict(data, level) {
- return (!level || level <= 0 ? decode_1.decodeXML : decode_1.decodeHTMLStrict)(data);
- }
- exports.decodeStrict = decodeStrict;
- /**
- * Encodes a string with entities.
- *
- * @param data String to encode.
- * @param level Optional level to encode at. 0 = XML, 1 = HTML. Default is 0.
- * @deprecated Use `encodeHTML`, `encodeXML` or `encodeNonAsciiHTML` directly.
- */
- function encode(data, level) {
- return (!level || level <= 0 ? encode_1.encodeXML : encode_1.encodeHTML)(data);
- }
- exports.encode = encode;
- var encode_2 = __webpack_require__(3393);
- Object.defineProperty(exports, "encodeXML", ({
- enumerable: true,
- get: function get() {
- return encode_2.encodeXML;
- }
- }));
- Object.defineProperty(exports, "encodeHTML", ({
- enumerable: true,
- get: function get() {
- return encode_2.encodeHTML;
- }
- }));
- Object.defineProperty(exports, "encodeNonAsciiHTML", ({
- enumerable: true,
- get: function get() {
- return encode_2.encodeNonAsciiHTML;
- }
- }));
- Object.defineProperty(exports, "escape", ({
- enumerable: true,
- get: function get() {
- return encode_2.escape;
- }
- }));
- Object.defineProperty(exports, "escapeUTF8", ({
- enumerable: true,
- get: function get() {
- return encode_2.escapeUTF8;
- }
- }));
- // Legacy aliases (deprecated)
- Object.defineProperty(exports, "encodeHTML4", ({
- enumerable: true,
- get: function get() {
- return encode_2.encodeHTML;
- }
- }));
- Object.defineProperty(exports, "encodeHTML5", ({
- enumerable: true,
- get: function get() {
- return encode_2.encodeHTML;
- }
- }));
- var decode_2 = __webpack_require__(6347);
- Object.defineProperty(exports, "decodeXML", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeXML;
- }
- }));
- Object.defineProperty(exports, "decodeHTML", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeHTML;
- }
- }));
- Object.defineProperty(exports, "decodeHTMLStrict", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeHTMLStrict;
- }
- }));
- // Legacy aliases (deprecated)
- Object.defineProperty(exports, "decodeHTML4", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeHTML;
- }
- }));
- Object.defineProperty(exports, "decodeHTML5", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeHTML;
- }
- }));
- Object.defineProperty(exports, "decodeHTML4Strict", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeHTMLStrict;
- }
- }));
- Object.defineProperty(exports, "decodeHTML5Strict", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeHTMLStrict;
- }
- }));
- Object.defineProperty(exports, "decodeXMLStrict", ({
- enumerable: true,
- get: function get() {
- return decode_2.decodeXML;
- }
- }));
- /***/ }),
- /***/ 2369:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var __extends = this && this.__extends || function () {
- var _extendStatics = function extendStatics(d, b) {
- _extendStatics = Object.setPrototypeOf || {
- __proto__: []
- } instanceof Array && function (d, b) {
- d.__proto__ = b;
- } || function (d, b) {
- for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
- };
- return _extendStatics(d, b);
- };
- return function (d, b) {
- if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
- _extendStatics(d, b);
- function __() {
- this.constructor = d;
- }
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
- };
- }();
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, {
- enumerable: true,
- get: function get() {
- return m[k];
- }
- });
- } : function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
- });
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
- Object.defineProperty(o, "default", {
- enumerable: true,
- value: v
- });
- } : function (o, v) {
- o["default"] = v;
- });
- var __importStar = this && this.__importStar || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
- };
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.parseFeed = exports.FeedHandler = void 0;
- var domhandler_1 = __importDefault(__webpack_require__(1363));
- var DomUtils = __importStar(__webpack_require__(5511));
- var Parser_1 = __webpack_require__(8168);
- var FeedItemMediaMedium;
- (function (FeedItemMediaMedium) {
- FeedItemMediaMedium[FeedItemMediaMedium["image"] = 0] = "image";
- FeedItemMediaMedium[FeedItemMediaMedium["audio"] = 1] = "audio";
- FeedItemMediaMedium[FeedItemMediaMedium["video"] = 2] = "video";
- FeedItemMediaMedium[FeedItemMediaMedium["document"] = 3] = "document";
- FeedItemMediaMedium[FeedItemMediaMedium["executable"] = 4] = "executable";
- })(FeedItemMediaMedium || (FeedItemMediaMedium = {}));
- var FeedItemMediaExpression;
- (function (FeedItemMediaExpression) {
- FeedItemMediaExpression[FeedItemMediaExpression["sample"] = 0] = "sample";
- FeedItemMediaExpression[FeedItemMediaExpression["full"] = 1] = "full";
- FeedItemMediaExpression[FeedItemMediaExpression["nonstop"] = 2] = "nonstop";
- })(FeedItemMediaExpression || (FeedItemMediaExpression = {}));
- // TODO: Consume data as it is coming in
- var FeedHandler = /** @class */function (_super) {
- __extends(FeedHandler, _super);
- /**
- *
- * @param callback
- * @param options
- */
- function FeedHandler(callback, options) {
- var _this = this;
- if (_typeof(callback) === "object") {
- callback = undefined;
- options = callback;
- }
- _this = _super.call(this, callback, options) || this;
- return _this;
- }
- FeedHandler.prototype.onend = function () {
- var _a, _b;
- var feedRoot = getOneElement(isValidFeed, this.dom);
- if (!feedRoot) {
- this.handleCallback(new Error("couldn't find root of feed"));
- return;
- }
- var feed = {};
- if (feedRoot.name === "feed") {
- var childs = feedRoot.children;
- feed.type = "atom";
- addConditionally(feed, "id", "id", childs);
- addConditionally(feed, "title", "title", childs);
- var href = getAttribute("href", getOneElement("link", childs));
- if (href) {
- feed.link = href;
- }
- addConditionally(feed, "description", "subtitle", childs);
- var updated = fetch("updated", childs);
- if (updated) {
- feed.updated = new Date(updated);
- }
- addConditionally(feed, "author", "email", childs, true);
- feed.items = getElements("entry", childs).map(function (item) {
- var entry = {};
- var children = item.children;
- addConditionally(entry, "id", "id", children);
- addConditionally(entry, "title", "title", children);
- var href = getAttribute("href", getOneElement("link", children));
- if (href) {
- entry.link = href;
- }
- var description = fetch("summary", children) || fetch("content", children);
- if (description) {
- entry.description = description;
- }
- var pubDate = fetch("updated", children);
- if (pubDate) {
- entry.pubDate = new Date(pubDate);
- }
- entry.media = getMediaElements(children);
- return entry;
- });
- } else {
- var childs = (_b = (_a = getOneElement("channel", feedRoot.children)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : [];
- feed.type = feedRoot.name.substr(0, 3);
- feed.id = "";
- addConditionally(feed, "title", "title", childs);
- addConditionally(feed, "link", "link", childs);
- addConditionally(feed, "description", "description", childs);
- var updated = fetch("lastBuildDate", childs);
- if (updated) {
- feed.updated = new Date(updated);
- }
- addConditionally(feed, "author", "managingEditor", childs, true);
- feed.items = getElements("item", feedRoot.children).map(function (item) {
- var entry = {};
- var children = item.children;
- addConditionally(entry, "id", "guid", children);
- addConditionally(entry, "title", "title", children);
- addConditionally(entry, "link", "link", children);
- addConditionally(entry, "description", "description", children);
- var pubDate = fetch("pubDate", children);
- if (pubDate) entry.pubDate = new Date(pubDate);
- entry.media = getMediaElements(children);
- return entry;
- });
- }
- this.feed = feed;
- this.handleCallback(null);
- };
- return FeedHandler;
- }(domhandler_1["default"]);
- exports.FeedHandler = FeedHandler;
- function getMediaElements(where) {
- return getElements("media:content", where).map(function (elem) {
- var media = {
- medium: elem.attribs.medium,
- isDefault: !!elem.attribs.isDefault
- };
- if (elem.attribs.url) {
- media.url = elem.attribs.url;
- }
- if (elem.attribs.fileSize) {
- media.fileSize = parseInt(elem.attribs.fileSize, 10);
- }
- if (elem.attribs.type) {
- media.type = elem.attribs.type;
- }
- if (elem.attribs.expression) {
- media.expression = elem.attribs.expression;
- }
- if (elem.attribs.bitrate) {
- media.bitrate = parseInt(elem.attribs.bitrate, 10);
- }
- if (elem.attribs.framerate) {
- media.framerate = parseInt(elem.attribs.framerate, 10);
- }
- if (elem.attribs.samplingrate) {
- media.samplingrate = parseInt(elem.attribs.samplingrate, 10);
- }
- if (elem.attribs.channels) {
- media.channels = parseInt(elem.attribs.channels, 10);
- }
- if (elem.attribs.duration) {
- media.duration = parseInt(elem.attribs.duration, 10);
- }
- if (elem.attribs.height) {
- media.height = parseInt(elem.attribs.height, 10);
- }
- if (elem.attribs.width) {
- media.width = parseInt(elem.attribs.width, 10);
- }
- if (elem.attribs.lang) {
- media.lang = elem.attribs.lang;
- }
- return media;
- });
- }
- function getElements(tagName, where) {
- return DomUtils.getElementsByTagName(tagName, where, true);
- }
- function getOneElement(tagName, node) {
- return DomUtils.getElementsByTagName(tagName, node, true, 1)[0];
- }
- function fetch(tagName, where, recurse) {
- if (recurse === void 0) {
- recurse = false;
- }
- return DomUtils.getText(DomUtils.getElementsByTagName(tagName, where, recurse, 1)).trim();
- }
- function getAttribute(name, elem) {
- if (!elem) {
- return null;
- }
- var attribs = elem.attribs;
- return attribs[name];
- }
- function addConditionally(obj, prop, what, where, recurse) {
- if (recurse === void 0) {
- recurse = false;
- }
- var tmp = fetch(what, where, recurse);
- if (tmp) obj[prop] = tmp;
- }
- function isValidFeed(value) {
- return value === "rss" || value === "feed" || value === "rdf:RDF";
- }
- /**
- * Parse a feed.
- *
- * @param feed The feed that should be parsed, as a string.
- * @param options Optionally, options for parsing. When using this option, you should set `xmlMode` to `true`.
- */
- function parseFeed(feed, options) {
- if (options === void 0) {
- options = {
- xmlMode: true
- };
- }
- var handler = new FeedHandler(options);
- new Parser_1.Parser(handler, options).end(feed);
- return handler.feed;
- }
- exports.parseFeed = parseFeed;
- /***/ }),
- /***/ 8168:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.Parser = void 0;
- var Tokenizer_1 = __importDefault(__webpack_require__(6506));
- var formTags = new Set(["input", "option", "optgroup", "select", "button", "datalist", "textarea"]);
- var pTag = new Set(["p"]);
- var openImpliesClose = {
- tr: new Set(["tr", "th", "td"]),
- th: new Set(["th"]),
- td: new Set(["thead", "th", "td"]),
- body: new Set(["head", "link", "script"]),
- li: new Set(["li"]),
- p: pTag,
- h1: pTag,
- h2: pTag,
- h3: pTag,
- h4: pTag,
- h5: pTag,
- h6: pTag,
- select: formTags,
- input: formTags,
- output: formTags,
- button: formTags,
- datalist: formTags,
- textarea: formTags,
- option: new Set(["option"]),
- optgroup: new Set(["optgroup", "option"]),
- dd: new Set(["dt", "dd"]),
- dt: new Set(["dt", "dd"]),
- address: pTag,
- article: pTag,
- aside: pTag,
- blockquote: pTag,
- details: pTag,
- div: pTag,
- dl: pTag,
- fieldset: pTag,
- figcaption: pTag,
- figure: pTag,
- footer: pTag,
- form: pTag,
- header: pTag,
- hr: pTag,
- main: pTag,
- nav: pTag,
- ol: pTag,
- pre: pTag,
- section: pTag,
- table: pTag,
- ul: pTag,
- rt: new Set(["rt", "rp"]),
- rp: new Set(["rt", "rp"]),
- tbody: new Set(["thead", "tbody"]),
- tfoot: new Set(["thead", "tbody"])
- };
- var voidElements = new Set(["area", "base", "basefont", "br", "col", "command", "embed", "frame", "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source", "track", "wbr"]);
- var foreignContextElements = new Set(["math", "svg"]);
- var htmlIntegrationElements = new Set(["mi", "mo", "mn", "ms", "mtext", "annotation-xml", "foreignObject", "desc", "title"]);
- var reNameEnd = /\s|\//;
- var Parser = /** @class */function () {
- function Parser(cbs, options) {
- if (options === void 0) {
- options = {};
- }
- var _a, _b, _c, _d, _e;
- /** The start index of the last event. */
- this.startIndex = 0;
- /** The end index of the last event. */
- this.endIndex = null;
- this.tagname = "";
- this.attribname = "";
- this.attribvalue = "";
- this.attribs = null;
- this.stack = [];
- this.foreignContext = [];
- this.options = options;
- this.cbs = cbs !== null && cbs !== void 0 ? cbs : {};
- this.lowerCaseTagNames = (_a = options.lowerCaseTags) !== null && _a !== void 0 ? _a : !options.xmlMode;
- this.lowerCaseAttributeNames = (_b = options.lowerCaseAttributeNames) !== null && _b !== void 0 ? _b : !options.xmlMode;
- this.tokenizer = new ((_c = options.Tokenizer) !== null && _c !== void 0 ? _c : Tokenizer_1["default"])(this.options, this);
- (_e = (_d = this.cbs).onparserinit) === null || _e === void 0 ? void 0 : _e.call(_d, this);
- }
- Parser.prototype.updatePosition = function (initialOffset) {
- if (this.endIndex === null) {
- if (this.tokenizer.sectionStart <= initialOffset) {
- this.startIndex = 0;
- } else {
- this.startIndex = this.tokenizer.sectionStart - initialOffset;
- }
- } else {
- this.startIndex = this.endIndex + 1;
- }
- this.endIndex = this.tokenizer.getAbsoluteIndex();
- };
- // Tokenizer event handlers
- Parser.prototype.ontext = function (data) {
- var _a, _b;
- this.updatePosition(1);
- this.endIndex--;
- (_b = (_a = this.cbs).ontext) === null || _b === void 0 ? void 0 : _b.call(_a, data);
- };
- Parser.prototype.onopentagname = function (name) {
- var _a, _b;
- if (this.lowerCaseTagNames) {
- name = name.toLowerCase();
- }
- this.tagname = name;
- if (!this.options.xmlMode && Object.prototype.hasOwnProperty.call(openImpliesClose, name)) {
- var el = void 0;
- while (this.stack.length > 0 && openImpliesClose[name].has(el = this.stack[this.stack.length - 1])) {
- this.onclosetag(el);
- }
- }
- if (this.options.xmlMode || !voidElements.has(name)) {
- this.stack.push(name);
- if (foreignContextElements.has(name)) {
- this.foreignContext.push(true);
- } else if (htmlIntegrationElements.has(name)) {
- this.foreignContext.push(false);
- }
- }
- (_b = (_a = this.cbs).onopentagname) === null || _b === void 0 ? void 0 : _b.call(_a, name);
- if (this.cbs.onopentag) this.attribs = {};
- };
- Parser.prototype.onopentagend = function () {
- var _a, _b;
- this.updatePosition(1);
- if (this.attribs) {
- (_b = (_a = this.cbs).onopentag) === null || _b === void 0 ? void 0 : _b.call(_a, this.tagname, this.attribs);
- this.attribs = null;
- }
- if (!this.options.xmlMode && this.cbs.onclosetag && voidElements.has(this.tagname)) {
- this.cbs.onclosetag(this.tagname);
- }
- this.tagname = "";
- };
- Parser.prototype.onclosetag = function (name) {
- this.updatePosition(1);
- if (this.lowerCaseTagNames) {
- name = name.toLowerCase();
- }
- if (foreignContextElements.has(name) || htmlIntegrationElements.has(name)) {
- this.foreignContext.pop();
- }
- if (this.stack.length && (this.options.xmlMode || !voidElements.has(name))) {
- var pos = this.stack.lastIndexOf(name);
- if (pos !== -1) {
- if (this.cbs.onclosetag) {
- pos = this.stack.length - pos;
- while (pos--) {
- // We know the stack has sufficient elements.
- this.cbs.onclosetag(this.stack.pop());
- }
- } else this.stack.length = pos;
- } else if (name === "p" && !this.options.xmlMode) {
- this.onopentagname(name);
- this.closeCurrentTag();
- }
- } else if (!this.options.xmlMode && (name === "br" || name === "p")) {
- this.onopentagname(name);
- this.closeCurrentTag();
- }
- };
- Parser.prototype.onselfclosingtag = function () {
- if (this.options.xmlMode || this.options.recognizeSelfClosing || this.foreignContext[this.foreignContext.length - 1]) {
- this.closeCurrentTag();
- } else {
- this.onopentagend();
- }
- };
- Parser.prototype.closeCurrentTag = function () {
- var _a, _b;
- var name = this.tagname;
- this.onopentagend();
- /*
- * Self-closing tags will be on the top of the stack
- * (cheaper check than in onclosetag)
- */
- if (this.stack[this.stack.length - 1] === name) {
- (_b = (_a = this.cbs).onclosetag) === null || _b === void 0 ? void 0 : _b.call(_a, name);
- this.stack.pop();
- }
- };
- Parser.prototype.onattribname = function (name) {
- if (this.lowerCaseAttributeNames) {
- name = name.toLowerCase();
- }
- this.attribname = name;
- };
- Parser.prototype.onattribdata = function (value) {
- this.attribvalue += value;
- };
- Parser.prototype.onattribend = function (quote) {
- var _a, _b;
- (_b = (_a = this.cbs).onattribute) === null || _b === void 0 ? void 0 : _b.call(_a, this.attribname, this.attribvalue, quote);
- if (this.attribs && !Object.prototype.hasOwnProperty.call(this.attribs, this.attribname)) {
- this.attribs[this.attribname] = this.attribvalue;
- }
- this.attribname = "";
- this.attribvalue = "";
- };
- Parser.prototype.getInstructionName = function (value) {
- var idx = value.search(reNameEnd);
- var name = idx < 0 ? value : value.substr(0, idx);
- if (this.lowerCaseTagNames) {
- name = name.toLowerCase();
- }
- return name;
- };
- Parser.prototype.ondeclaration = function (value) {
- if (this.cbs.onprocessinginstruction) {
- var name_1 = this.getInstructionName(value);
- this.cbs.onprocessinginstruction("!" + name_1, "!" + value);
- }
- };
- Parser.prototype.onprocessinginstruction = function (value) {
- if (this.cbs.onprocessinginstruction) {
- var name_2 = this.getInstructionName(value);
- this.cbs.onprocessinginstruction("?" + name_2, "?" + value);
- }
- };
- Parser.prototype.oncomment = function (value) {
- var _a, _b, _c, _d;
- this.updatePosition(4);
- (_b = (_a = this.cbs).oncomment) === null || _b === void 0 ? void 0 : _b.call(_a, value);
- (_d = (_c = this.cbs).oncommentend) === null || _d === void 0 ? void 0 : _d.call(_c);
- };
- Parser.prototype.oncdata = function (value) {
- var _a, _b, _c, _d, _e, _f;
- this.updatePosition(1);
- if (this.options.xmlMode || this.options.recognizeCDATA) {
- (_b = (_a = this.cbs).oncdatastart) === null || _b === void 0 ? void 0 : _b.call(_a);
- (_d = (_c = this.cbs).ontext) === null || _d === void 0 ? void 0 : _d.call(_c, value);
- (_f = (_e = this.cbs).oncdataend) === null || _f === void 0 ? void 0 : _f.call(_e);
- } else {
- this.oncomment("[CDATA[" + value + "]]");
- }
- };
- Parser.prototype.onerror = function (err) {
- var _a, _b;
- (_b = (_a = this.cbs).onerror) === null || _b === void 0 ? void 0 : _b.call(_a, err);
- };
- Parser.prototype.onend = function () {
- var _a, _b;
- if (this.cbs.onclosetag) {
- for (var i = this.stack.length; i > 0; this.cbs.onclosetag(this.stack[--i]));
- }
- (_b = (_a = this.cbs).onend) === null || _b === void 0 ? void 0 : _b.call(_a);
- };
- /**
- * Resets the parser to a blank state, ready to parse a new HTML document
- */
- Parser.prototype.reset = function () {
- var _a, _b, _c, _d;
- (_b = (_a = this.cbs).onreset) === null || _b === void 0 ? void 0 : _b.call(_a);
- this.tokenizer.reset();
- this.tagname = "";
- this.attribname = "";
- this.attribs = null;
- this.stack = [];
- (_d = (_c = this.cbs).onparserinit) === null || _d === void 0 ? void 0 : _d.call(_c, this);
- };
- /**
- * Resets the parser, then parses a complete document and
- * pushes it to the handler.
- *
- * @param data Document to parse.
- */
- Parser.prototype.parseComplete = function (data) {
- this.reset();
- this.end(data);
- };
- /**
- * Parses a chunk of data and calls the corresponding callbacks.
- *
- * @param chunk Chunk to parse.
- */
- Parser.prototype.write = function (chunk) {
- this.tokenizer.write(chunk);
- };
- /**
- * Parses the end of the buffer and clears the stack, calls onend.
- *
- * @param chunk Optional final chunk to parse.
- */
- Parser.prototype.end = function (chunk) {
- this.tokenizer.end(chunk);
- };
- /**
- * Pauses parsing. The parser won't emit events until `resume` is called.
- */
- Parser.prototype.pause = function () {
- this.tokenizer.pause();
- };
- /**
- * Resumes parsing after `pause` was called.
- */
- Parser.prototype.resume = function () {
- this.tokenizer.resume();
- };
- /**
- * Alias of `write`, for backwards compatibility.
- *
- * @param chunk Chunk to parse.
- * @deprecated
- */
- Parser.prototype.parseChunk = function (chunk) {
- this.write(chunk);
- };
- /**
- * Alias of `end`, for backwards compatibility.
- *
- * @param chunk Optional final chunk to parse.
- * @deprecated
- */
- Parser.prototype.done = function (chunk) {
- this.end(chunk);
- };
- return Parser;
- }();
- exports.Parser = Parser;
- /***/ }),
- /***/ 6506:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- var decode_codepoint_1 = __importDefault(__webpack_require__(8271));
- var entities_json_1 = __importDefault(__webpack_require__(9323));
- var legacy_json_1 = __importDefault(__webpack_require__(9591));
- var xml_json_1 = __importDefault(__webpack_require__(2586));
- function whitespace(c) {
- return c === " " || c === "\n" || c === "\t" || c === "\f" || c === "\r";
- }
- function isASCIIAlpha(c) {
- return c >= "a" && c <= "z" || c >= "A" && c <= "Z";
- }
- function ifElseState(upper, SUCCESS, FAILURE) {
- var lower = upper.toLowerCase();
- if (upper === lower) {
- return function (t, c) {
- if (c === lower) {
- t._state = SUCCESS;
- } else {
- t._state = FAILURE;
- t._index--;
- }
- };
- }
- return function (t, c) {
- if (c === lower || c === upper) {
- t._state = SUCCESS;
- } else {
- t._state = FAILURE;
- t._index--;
- }
- };
- }
- function consumeSpecialNameChar(upper, NEXT_STATE) {
- var lower = upper.toLowerCase();
- return function (t, c) {
- if (c === lower || c === upper) {
- t._state = NEXT_STATE;
- } else {
- t._state = 3 /* InTagName */;
- t._index--; // Consume the token again
- }
- };
- }
- var stateBeforeCdata1 = ifElseState("C", 24 /* BeforeCdata2 */, 16 /* InDeclaration */);
- var stateBeforeCdata2 = ifElseState("D", 25 /* BeforeCdata3 */, 16 /* InDeclaration */);
- var stateBeforeCdata3 = ifElseState("A", 26 /* BeforeCdata4 */, 16 /* InDeclaration */);
- var stateBeforeCdata4 = ifElseState("T", 27 /* BeforeCdata5 */, 16 /* InDeclaration */);
- var stateBeforeCdata5 = ifElseState("A", 28 /* BeforeCdata6 */, 16 /* InDeclaration */);
- var stateBeforeScript1 = consumeSpecialNameChar("R", 35 /* BeforeScript2 */);
- var stateBeforeScript2 = consumeSpecialNameChar("I", 36 /* BeforeScript3 */);
- var stateBeforeScript3 = consumeSpecialNameChar("P", 37 /* BeforeScript4 */);
- var stateBeforeScript4 = consumeSpecialNameChar("T", 38 /* BeforeScript5 */);
- var stateAfterScript1 = ifElseState("R", 40 /* AfterScript2 */, 1 /* Text */);
- var stateAfterScript2 = ifElseState("I", 41 /* AfterScript3 */, 1 /* Text */);
- var stateAfterScript3 = ifElseState("P", 42 /* AfterScript4 */, 1 /* Text */);
- var stateAfterScript4 = ifElseState("T", 43 /* AfterScript5 */, 1 /* Text */);
- var stateBeforeStyle1 = consumeSpecialNameChar("Y", 45 /* BeforeStyle2 */);
- var stateBeforeStyle2 = consumeSpecialNameChar("L", 46 /* BeforeStyle3 */);
- var stateBeforeStyle3 = consumeSpecialNameChar("E", 47 /* BeforeStyle4 */);
- var stateAfterStyle1 = ifElseState("Y", 49 /* AfterStyle2 */, 1 /* Text */);
- var stateAfterStyle2 = ifElseState("L", 50 /* AfterStyle3 */, 1 /* Text */);
- var stateAfterStyle3 = ifElseState("E", 51 /* AfterStyle4 */, 1 /* Text */);
- var stateBeforeSpecialT = consumeSpecialNameChar("I", 54 /* BeforeTitle1 */);
- var stateBeforeTitle1 = consumeSpecialNameChar("T", 55 /* BeforeTitle2 */);
- var stateBeforeTitle2 = consumeSpecialNameChar("L", 56 /* BeforeTitle3 */);
- var stateBeforeTitle3 = consumeSpecialNameChar("E", 57 /* BeforeTitle4 */);
- var stateAfterSpecialTEnd = ifElseState("I", 58 /* AfterTitle1 */, 1 /* Text */);
- var stateAfterTitle1 = ifElseState("T", 59 /* AfterTitle2 */, 1 /* Text */);
- var stateAfterTitle2 = ifElseState("L", 60 /* AfterTitle3 */, 1 /* Text */);
- var stateAfterTitle3 = ifElseState("E", 61 /* AfterTitle4 */, 1 /* Text */);
- var stateBeforeEntity = ifElseState("#", 63 /* BeforeNumericEntity */, 64 /* InNamedEntity */);
- var stateBeforeNumericEntity = ifElseState("X", 66 /* InHexEntity */, 65 /* InNumericEntity */);
- var Tokenizer = /** @class */function () {
- function Tokenizer(options, cbs) {
- var _a;
- /** The current state the tokenizer is in. */
- this._state = 1 /* Text */;
- /** The read buffer. */
- this.buffer = "";
- /** The beginning of the section that is currently being read. */
- this.sectionStart = 0;
- /** The index within the buffer that we are currently looking at. */
- this._index = 0;
- /**
- * Data that has already been processed will be removed from the buffer occasionally.
- * `_bufferOffset` keeps track of how many characters have been removed, to make sure position information is accurate.
- */
- this.bufferOffset = 0;
- /** Some behavior, eg. when decoding entities, is done while we are in another state. This keeps track of the other state type. */
- this.baseState = 1 /* Text */;
- /** For special parsing behavior inside of script and style tags. */
- this.special = 1 /* None */;
- /** Indicates whether the tokenizer has been paused. */
- this.running = true;
- /** Indicates whether the tokenizer has finished running / `.end` has been called. */
- this.ended = false;
- this.cbs = cbs;
- this.xmlMode = !!(options === null || options === void 0 ? void 0 : options.xmlMode);
- this.decodeEntities = (_a = options === null || options === void 0 ? void 0 : options.decodeEntities) !== null && _a !== void 0 ? _a : true;
- }
- Tokenizer.prototype.reset = function () {
- this._state = 1 /* Text */;
- this.buffer = "";
- this.sectionStart = 0;
- this._index = 0;
- this.bufferOffset = 0;
- this.baseState = 1 /* Text */;
- this.special = 1 /* None */;
- this.running = true;
- this.ended = false;
- };
- Tokenizer.prototype.write = function (chunk) {
- if (this.ended) this.cbs.onerror(Error(".write() after done!"));
- this.buffer += chunk;
- this.parse();
- };
- Tokenizer.prototype.end = function (chunk) {
- if (this.ended) this.cbs.onerror(Error(".end() after done!"));
- if (chunk) this.write(chunk);
- this.ended = true;
- if (this.running) this.finish();
- };
- Tokenizer.prototype.pause = function () {
- this.running = false;
- };
- Tokenizer.prototype.resume = function () {
- this.running = true;
- if (this._index < this.buffer.length) {
- this.parse();
- }
- if (this.ended) {
- this.finish();
- }
- };
- /**
- * The current index within all of the written data.
- */
- Tokenizer.prototype.getAbsoluteIndex = function () {
- return this.bufferOffset + this._index;
- };
- Tokenizer.prototype.stateText = function (c) {
- if (c === "<") {
- if (this._index > this.sectionStart) {
- this.cbs.ontext(this.getSection());
- }
- this._state = 2 /* BeforeTagName */;
- this.sectionStart = this._index;
- } else if (this.decodeEntities && c === "&" && (this.special === 1 /* None */ || this.special === 4 /* Title */)) {
- if (this._index > this.sectionStart) {
- this.cbs.ontext(this.getSection());
- }
- this.baseState = 1 /* Text */;
- this._state = 62 /* BeforeEntity */;
- this.sectionStart = this._index;
- }
- };
- /**
- * HTML only allows ASCII alpha characters (a-z and A-Z) at the beginning of a tag name.
- *
- * XML allows a lot more characters here (@see https://www.w3.org/TR/REC-xml/#NT-NameStartChar).
- * We allow anything that wouldn't end the tag.
- */
- Tokenizer.prototype.isTagStartChar = function (c) {
- return isASCIIAlpha(c) || this.xmlMode && !whitespace(c) && c !== "/" && c !== ">";
- };
- Tokenizer.prototype.stateBeforeTagName = function (c) {
- if (c === "/") {
- this._state = 5 /* BeforeClosingTagName */;
- } else if (c === "<") {
- this.cbs.ontext(this.getSection());
- this.sectionStart = this._index;
- } else if (c === ">" || this.special !== 1 /* None */ || whitespace(c)) {
- this._state = 1 /* Text */;
- } else if (c === "!") {
- this._state = 15 /* BeforeDeclaration */;
- this.sectionStart = this._index + 1;
- } else if (c === "?") {
- this._state = 17 /* InProcessingInstruction */;
- this.sectionStart = this._index + 1;
- } else if (!this.isTagStartChar(c)) {
- this._state = 1 /* Text */;
- } else {
- this._state = !this.xmlMode && (c === "s" || c === "S") ? 32 /* BeforeSpecialS */ : !this.xmlMode && (c === "t" || c === "T") ? 52 /* BeforeSpecialT */ : 3 /* InTagName */;
- this.sectionStart = this._index;
- }
- };
- Tokenizer.prototype.stateInTagName = function (c) {
- if (c === "/" || c === ">" || whitespace(c)) {
- this.emitToken("onopentagname");
- this._state = 8 /* BeforeAttributeName */;
- this._index--;
- }
- };
- Tokenizer.prototype.stateBeforeClosingTagName = function (c) {
- if (whitespace(c)) {
- // Ignore
- } else if (c === ">") {
- this._state = 1 /* Text */;
- } else if (this.special !== 1 /* None */) {
- if (this.special !== 4 /* Title */ && (c === "s" || c === "S")) {
- this._state = 33 /* BeforeSpecialSEnd */;
- } else if (this.special === 4 /* Title */ && (c === "t" || c === "T")) {
- this._state = 53 /* BeforeSpecialTEnd */;
- } else {
- this._state = 1 /* Text */;
- this._index--;
- }
- } else if (!this.isTagStartChar(c)) {
- this._state = 20 /* InSpecialComment */;
- this.sectionStart = this._index;
- } else {
- this._state = 6 /* InClosingTagName */;
- this.sectionStart = this._index;
- }
- };
- Tokenizer.prototype.stateInClosingTagName = function (c) {
- if (c === ">" || whitespace(c)) {
- this.emitToken("onclosetag");
- this._state = 7 /* AfterClosingTagName */;
- this._index--;
- }
- };
- Tokenizer.prototype.stateAfterClosingTagName = function (c) {
- // Skip everything until ">"
- if (c === ">") {
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- }
- };
- Tokenizer.prototype.stateBeforeAttributeName = function (c) {
- if (c === ">") {
- this.cbs.onopentagend();
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- } else if (c === "/") {
- this._state = 4 /* InSelfClosingTag */;
- } else if (!whitespace(c)) {
- this._state = 9 /* InAttributeName */;
- this.sectionStart = this._index;
- }
- };
- Tokenizer.prototype.stateInSelfClosingTag = function (c) {
- if (c === ">") {
- this.cbs.onselfclosingtag();
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- this.special = 1 /* None */; // Reset special state, in case of self-closing special tags
- } else if (!whitespace(c)) {
- this._state = 8 /* BeforeAttributeName */;
- this._index--;
- }
- };
- Tokenizer.prototype.stateInAttributeName = function (c) {
- if (c === "=" || c === "/" || c === ">" || whitespace(c)) {
- this.cbs.onattribname(this.getSection());
- this.sectionStart = -1;
- this._state = 10 /* AfterAttributeName */;
- this._index--;
- }
- };
- Tokenizer.prototype.stateAfterAttributeName = function (c) {
- if (c === "=") {
- this._state = 11 /* BeforeAttributeValue */;
- } else if (c === "/" || c === ">") {
- this.cbs.onattribend(undefined);
- this._state = 8 /* BeforeAttributeName */;
- this._index--;
- } else if (!whitespace(c)) {
- this.cbs.onattribend(undefined);
- this._state = 9 /* InAttributeName */;
- this.sectionStart = this._index;
- }
- };
- Tokenizer.prototype.stateBeforeAttributeValue = function (c) {
- if (c === '"') {
- this._state = 12 /* InAttributeValueDq */;
- this.sectionStart = this._index + 1;
- } else if (c === "'") {
- this._state = 13 /* InAttributeValueSq */;
- this.sectionStart = this._index + 1;
- } else if (!whitespace(c)) {
- this._state = 14 /* InAttributeValueNq */;
- this.sectionStart = this._index;
- this._index--; // Reconsume token
- }
- };
- Tokenizer.prototype.handleInAttributeValue = function (c, quote) {
- if (c === quote) {
- this.emitToken("onattribdata");
- this.cbs.onattribend(quote);
- this._state = 8 /* BeforeAttributeName */;
- } else if (this.decodeEntities && c === "&") {
- this.emitToken("onattribdata");
- this.baseState = this._state;
- this._state = 62 /* BeforeEntity */;
- this.sectionStart = this._index;
- }
- };
- Tokenizer.prototype.stateInAttributeValueDoubleQuotes = function (c) {
- this.handleInAttributeValue(c, '"');
- };
- Tokenizer.prototype.stateInAttributeValueSingleQuotes = function (c) {
- this.handleInAttributeValue(c, "'");
- };
- Tokenizer.prototype.stateInAttributeValueNoQuotes = function (c) {
- if (whitespace(c) || c === ">") {
- this.emitToken("onattribdata");
- this.cbs.onattribend(null);
- this._state = 8 /* BeforeAttributeName */;
- this._index--;
- } else if (this.decodeEntities && c === "&") {
- this.emitToken("onattribdata");
- this.baseState = this._state;
- this._state = 62 /* BeforeEntity */;
- this.sectionStart = this._index;
- }
- };
- Tokenizer.prototype.stateBeforeDeclaration = function (c) {
- this._state = c === "[" ? 23 /* BeforeCdata1 */ : c === "-" ? 18 /* BeforeComment */ : 16 /* InDeclaration */;
- };
- Tokenizer.prototype.stateInDeclaration = function (c) {
- if (c === ">") {
- this.cbs.ondeclaration(this.getSection());
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- }
- };
- Tokenizer.prototype.stateInProcessingInstruction = function (c) {
- if (c === ">") {
- this.cbs.onprocessinginstruction(this.getSection());
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- }
- };
- Tokenizer.prototype.stateBeforeComment = function (c) {
- if (c === "-") {
- this._state = 19 /* InComment */;
- this.sectionStart = this._index + 1;
- } else {
- this._state = 16 /* InDeclaration */;
- }
- };
- Tokenizer.prototype.stateInComment = function (c) {
- if (c === "-") this._state = 21 /* AfterComment1 */;
- };
- Tokenizer.prototype.stateInSpecialComment = function (c) {
- if (c === ">") {
- this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index));
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- }
- };
- Tokenizer.prototype.stateAfterComment1 = function (c) {
- if (c === "-") {
- this._state = 22 /* AfterComment2 */;
- } else {
- this._state = 19 /* InComment */;
- }
- };
- Tokenizer.prototype.stateAfterComment2 = function (c) {
- if (c === ">") {
- // Remove 2 trailing chars
- this.cbs.oncomment(this.buffer.substring(this.sectionStart, this._index - 2));
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- } else if (c !== "-") {
- this._state = 19 /* InComment */;
- }
- // Else: stay in AFTER_COMMENT_2 (`--->`)
- };
- Tokenizer.prototype.stateBeforeCdata6 = function (c) {
- if (c === "[") {
- this._state = 29 /* InCdata */;
- this.sectionStart = this._index + 1;
- } else {
- this._state = 16 /* InDeclaration */;
- this._index--;
- }
- };
- Tokenizer.prototype.stateInCdata = function (c) {
- if (c === "]") this._state = 30 /* AfterCdata1 */;
- };
- Tokenizer.prototype.stateAfterCdata1 = function (c) {
- if (c === "]") this._state = 31 /* AfterCdata2 */;else this._state = 29 /* InCdata */;
- };
- Tokenizer.prototype.stateAfterCdata2 = function (c) {
- if (c === ">") {
- // Remove 2 trailing chars
- this.cbs.oncdata(this.buffer.substring(this.sectionStart, this._index - 2));
- this._state = 1 /* Text */;
- this.sectionStart = this._index + 1;
- } else if (c !== "]") {
- this._state = 29 /* InCdata */;
- }
- // Else: stay in AFTER_CDATA_2 (`]]]>`)
- };
- Tokenizer.prototype.stateBeforeSpecialS = function (c) {
- if (c === "c" || c === "C") {
- this._state = 34 /* BeforeScript1 */;
- } else if (c === "t" || c === "T") {
- this._state = 44 /* BeforeStyle1 */;
- } else {
- this._state = 3 /* InTagName */;
- this._index--; // Consume the token again
- }
- };
- Tokenizer.prototype.stateBeforeSpecialSEnd = function (c) {
- if (this.special === 2 /* Script */ && (c === "c" || c === "C")) {
- this._state = 39 /* AfterScript1 */;
- } else if (this.special === 3 /* Style */ && (c === "t" || c === "T")) {
- this._state = 48 /* AfterStyle1 */;
- } else this._state = 1 /* Text */;
- };
- Tokenizer.prototype.stateBeforeSpecialLast = function (c, special) {
- if (c === "/" || c === ">" || whitespace(c)) {
- this.special = special;
- }
- this._state = 3 /* InTagName */;
- this._index--; // Consume the token again
- };
- Tokenizer.prototype.stateAfterSpecialLast = function (c, sectionStartOffset) {
- if (c === ">" || whitespace(c)) {
- this.special = 1 /* None */;
- this._state = 6 /* InClosingTagName */;
- this.sectionStart = this._index - sectionStartOffset;
- this._index--; // Reconsume the token
- } else this._state = 1 /* Text */;
- };
- // For entities terminated with a semicolon
- Tokenizer.prototype.parseFixedEntity = function (map) {
- if (map === void 0) {
- map = this.xmlMode ? xml_json_1["default"] : entities_json_1["default"];
- }
- // Offset = 1
- if (this.sectionStart + 1 < this._index) {
- var entity = this.buffer.substring(this.sectionStart + 1, this._index);
- if (Object.prototype.hasOwnProperty.call(map, entity)) {
- this.emitPartial(map[entity]);
- this.sectionStart = this._index + 1;
- }
- }
- };
- // Parses legacy entities (without trailing semicolon)
- Tokenizer.prototype.parseLegacyEntity = function () {
- var start = this.sectionStart + 1;
- // The max length of legacy entities is 6
- var limit = Math.min(this._index - start, 6);
- while (limit >= 2) {
- // The min length of legacy entities is 2
- var entity = this.buffer.substr(start, limit);
- if (Object.prototype.hasOwnProperty.call(legacy_json_1["default"], entity)) {
- this.emitPartial(legacy_json_1["default"][entity]);
- this.sectionStart += limit + 1;
- return;
- }
- limit--;
- }
- };
- Tokenizer.prototype.stateInNamedEntity = function (c) {
- if (c === ";") {
- this.parseFixedEntity();
- // Retry as legacy entity if entity wasn't parsed
- if (this.baseState === 1 /* Text */ && this.sectionStart + 1 < this._index && !this.xmlMode) {
- this.parseLegacyEntity();
- }
- this._state = this.baseState;
- } else if ((c < "0" || c > "9") && !isASCIIAlpha(c)) {
- if (this.xmlMode || this.sectionStart + 1 === this._index) {
- // Ignore
- } else if (this.baseState !== 1 /* Text */) {
- if (c !== "=") {
- // Parse as legacy entity, without allowing additional characters.
- this.parseFixedEntity(legacy_json_1["default"]);
- }
- } else {
- this.parseLegacyEntity();
- }
- this._state = this.baseState;
- this._index--;
- }
- };
- Tokenizer.prototype.decodeNumericEntity = function (offset, base, strict) {
- var sectionStart = this.sectionStart + offset;
- if (sectionStart !== this._index) {
- // Parse entity
- var entity = this.buffer.substring(sectionStart, this._index);
- var parsed = parseInt(entity, base);
- this.emitPartial(decode_codepoint_1["default"](parsed));
- this.sectionStart = strict ? this._index + 1 : this._index;
- }
- this._state = this.baseState;
- };
- Tokenizer.prototype.stateInNumericEntity = function (c) {
- if (c === ";") {
- this.decodeNumericEntity(2, 10, true);
- } else if (c < "0" || c > "9") {
- if (!this.xmlMode) {
- this.decodeNumericEntity(2, 10, false);
- } else {
- this._state = this.baseState;
- }
- this._index--;
- }
- };
- Tokenizer.prototype.stateInHexEntity = function (c) {
- if (c === ";") {
- this.decodeNumericEntity(3, 16, true);
- } else if ((c < "a" || c > "f") && (c < "A" || c > "F") && (c < "0" || c > "9")) {
- if (!this.xmlMode) {
- this.decodeNumericEntity(3, 16, false);
- } else {
- this._state = this.baseState;
- }
- this._index--;
- }
- };
- Tokenizer.prototype.cleanup = function () {
- if (this.sectionStart < 0) {
- this.buffer = "";
- this.bufferOffset += this._index;
- this._index = 0;
- } else if (this.running) {
- if (this._state === 1 /* Text */) {
- if (this.sectionStart !== this._index) {
- this.cbs.ontext(this.buffer.substr(this.sectionStart));
- }
- this.buffer = "";
- this.bufferOffset += this._index;
- this._index = 0;
- } else if (this.sectionStart === this._index) {
- // The section just started
- this.buffer = "";
- this.bufferOffset += this._index;
- this._index = 0;
- } else {
- // Remove everything unnecessary
- this.buffer = this.buffer.substr(this.sectionStart);
- this._index -= this.sectionStart;
- this.bufferOffset += this.sectionStart;
- }
- this.sectionStart = 0;
- }
- };
- /**
- * Iterates through the buffer, calling the function corresponding to the current state.
- *
- * States that are more likely to be hit are higher up, as a performance improvement.
- */
- Tokenizer.prototype.parse = function () {
- while (this._index < this.buffer.length && this.running) {
- var c = this.buffer.charAt(this._index);
- if (this._state === 1 /* Text */) {
- this.stateText(c);
- } else if (this._state === 12 /* InAttributeValueDq */) {
- this.stateInAttributeValueDoubleQuotes(c);
- } else if (this._state === 9 /* InAttributeName */) {
- this.stateInAttributeName(c);
- } else if (this._state === 19 /* InComment */) {
- this.stateInComment(c);
- } else if (this._state === 20 /* InSpecialComment */) {
- this.stateInSpecialComment(c);
- } else if (this._state === 8 /* BeforeAttributeName */) {
- this.stateBeforeAttributeName(c);
- } else if (this._state === 3 /* InTagName */) {
- this.stateInTagName(c);
- } else if (this._state === 6 /* InClosingTagName */) {
- this.stateInClosingTagName(c);
- } else if (this._state === 2 /* BeforeTagName */) {
- this.stateBeforeTagName(c);
- } else if (this._state === 10 /* AfterAttributeName */) {
- this.stateAfterAttributeName(c);
- } else if (this._state === 13 /* InAttributeValueSq */) {
- this.stateInAttributeValueSingleQuotes(c);
- } else if (this._state === 11 /* BeforeAttributeValue */) {
- this.stateBeforeAttributeValue(c);
- } else if (this._state === 5 /* BeforeClosingTagName */) {
- this.stateBeforeClosingTagName(c);
- } else if (this._state === 7 /* AfterClosingTagName */) {
- this.stateAfterClosingTagName(c);
- } else if (this._state === 32 /* BeforeSpecialS */) {
- this.stateBeforeSpecialS(c);
- } else if (this._state === 21 /* AfterComment1 */) {
- this.stateAfterComment1(c);
- } else if (this._state === 14 /* InAttributeValueNq */) {
- this.stateInAttributeValueNoQuotes(c);
- } else if (this._state === 4 /* InSelfClosingTag */) {
- this.stateInSelfClosingTag(c);
- } else if (this._state === 16 /* InDeclaration */) {
- this.stateInDeclaration(c);
- } else if (this._state === 15 /* BeforeDeclaration */) {
- this.stateBeforeDeclaration(c);
- } else if (this._state === 22 /* AfterComment2 */) {
- this.stateAfterComment2(c);
- } else if (this._state === 18 /* BeforeComment */) {
- this.stateBeforeComment(c);
- } else if (this._state === 33 /* BeforeSpecialSEnd */) {
- this.stateBeforeSpecialSEnd(c);
- } else if (this._state === 53 /* BeforeSpecialTEnd */) {
- stateAfterSpecialTEnd(this, c);
- } else if (this._state === 39 /* AfterScript1 */) {
- stateAfterScript1(this, c);
- } else if (this._state === 40 /* AfterScript2 */) {
- stateAfterScript2(this, c);
- } else if (this._state === 41 /* AfterScript3 */) {
- stateAfterScript3(this, c);
- } else if (this._state === 34 /* BeforeScript1 */) {
- stateBeforeScript1(this, c);
- } else if (this._state === 35 /* BeforeScript2 */) {
- stateBeforeScript2(this, c);
- } else if (this._state === 36 /* BeforeScript3 */) {
- stateBeforeScript3(this, c);
- } else if (this._state === 37 /* BeforeScript4 */) {
- stateBeforeScript4(this, c);
- } else if (this._state === 38 /* BeforeScript5 */) {
- this.stateBeforeSpecialLast(c, 2 /* Script */);
- } else if (this._state === 42 /* AfterScript4 */) {
- stateAfterScript4(this, c);
- } else if (this._state === 43 /* AfterScript5 */) {
- this.stateAfterSpecialLast(c, 6);
- } else if (this._state === 44 /* BeforeStyle1 */) {
- stateBeforeStyle1(this, c);
- } else if (this._state === 29 /* InCdata */) {
- this.stateInCdata(c);
- } else if (this._state === 45 /* BeforeStyle2 */) {
- stateBeforeStyle2(this, c);
- } else if (this._state === 46 /* BeforeStyle3 */) {
- stateBeforeStyle3(this, c);
- } else if (this._state === 47 /* BeforeStyle4 */) {
- this.stateBeforeSpecialLast(c, 3 /* Style */);
- } else if (this._state === 48 /* AfterStyle1 */) {
- stateAfterStyle1(this, c);
- } else if (this._state === 49 /* AfterStyle2 */) {
- stateAfterStyle2(this, c);
- } else if (this._state === 50 /* AfterStyle3 */) {
- stateAfterStyle3(this, c);
- } else if (this._state === 51 /* AfterStyle4 */) {
- this.stateAfterSpecialLast(c, 5);
- } else if (this._state === 52 /* BeforeSpecialT */) {
- stateBeforeSpecialT(this, c);
- } else if (this._state === 54 /* BeforeTitle1 */) {
- stateBeforeTitle1(this, c);
- } else if (this._state === 55 /* BeforeTitle2 */) {
- stateBeforeTitle2(this, c);
- } else if (this._state === 56 /* BeforeTitle3 */) {
- stateBeforeTitle3(this, c);
- } else if (this._state === 57 /* BeforeTitle4 */) {
- this.stateBeforeSpecialLast(c, 4 /* Title */);
- } else if (this._state === 58 /* AfterTitle1 */) {
- stateAfterTitle1(this, c);
- } else if (this._state === 59 /* AfterTitle2 */) {
- stateAfterTitle2(this, c);
- } else if (this._state === 60 /* AfterTitle3 */) {
- stateAfterTitle3(this, c);
- } else if (this._state === 61 /* AfterTitle4 */) {
- this.stateAfterSpecialLast(c, 5);
- } else if (this._state === 17 /* InProcessingInstruction */) {
- this.stateInProcessingInstruction(c);
- } else if (this._state === 64 /* InNamedEntity */) {
- this.stateInNamedEntity(c);
- } else if (this._state === 23 /* BeforeCdata1 */) {
- stateBeforeCdata1(this, c);
- } else if (this._state === 62 /* BeforeEntity */) {
- stateBeforeEntity(this, c);
- } else if (this._state === 24 /* BeforeCdata2 */) {
- stateBeforeCdata2(this, c);
- } else if (this._state === 25 /* BeforeCdata3 */) {
- stateBeforeCdata3(this, c);
- } else if (this._state === 30 /* AfterCdata1 */) {
- this.stateAfterCdata1(c);
- } else if (this._state === 31 /* AfterCdata2 */) {
- this.stateAfterCdata2(c);
- } else if (this._state === 26 /* BeforeCdata4 */) {
- stateBeforeCdata4(this, c);
- } else if (this._state === 27 /* BeforeCdata5 */) {
- stateBeforeCdata5(this, c);
- } else if (this._state === 28 /* BeforeCdata6 */) {
- this.stateBeforeCdata6(c);
- } else if (this._state === 66 /* InHexEntity */) {
- this.stateInHexEntity(c);
- } else if (this._state === 65 /* InNumericEntity */) {
- this.stateInNumericEntity(c);
- // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
- } else if (this._state === 63 /* BeforeNumericEntity */) {
- stateBeforeNumericEntity(this, c);
- } else {
- this.cbs.onerror(Error("unknown _state"), this._state);
- }
- this._index++;
- }
- this.cleanup();
- };
- Tokenizer.prototype.finish = function () {
- // If there is remaining data, emit it in a reasonable way
- if (this.sectionStart < this._index) {
- this.handleTrailingData();
- }
- this.cbs.onend();
- };
- Tokenizer.prototype.handleTrailingData = function () {
- var data = this.buffer.substr(this.sectionStart);
- if (this._state === 29 /* InCdata */ || this._state === 30 /* AfterCdata1 */ || this._state === 31 /* AfterCdata2 */) {
- this.cbs.oncdata(data);
- } else if (this._state === 19 /* InComment */ || this._state === 21 /* AfterComment1 */ || this._state === 22 /* AfterComment2 */) {
- this.cbs.oncomment(data);
- } else if (this._state === 64 /* InNamedEntity */ && !this.xmlMode) {
- this.parseLegacyEntity();
- if (this.sectionStart < this._index) {
- this._state = this.baseState;
- this.handleTrailingData();
- }
- } else if (this._state === 65 /* InNumericEntity */ && !this.xmlMode) {
- this.decodeNumericEntity(2, 10, false);
- if (this.sectionStart < this._index) {
- this._state = this.baseState;
- this.handleTrailingData();
- }
- } else if (this._state === 66 /* InHexEntity */ && !this.xmlMode) {
- this.decodeNumericEntity(3, 16, false);
- if (this.sectionStart < this._index) {
- this._state = this.baseState;
- this.handleTrailingData();
- }
- } else if (this._state !== 3 /* InTagName */ && this._state !== 8 /* BeforeAttributeName */ && this._state !== 11 /* BeforeAttributeValue */ && this._state !== 10 /* AfterAttributeName */ && this._state !== 9 /* InAttributeName */ && this._state !== 13 /* InAttributeValueSq */ && this._state !== 12 /* InAttributeValueDq */ && this._state !== 14 /* InAttributeValueNq */ && this._state !== 6 /* InClosingTagName */) {
- this.cbs.ontext(data);
- }
- /*
- * Else, ignore remaining data
- * TODO add a way to remove current tag
- */
- };
- Tokenizer.prototype.getSection = function () {
- return this.buffer.substring(this.sectionStart, this._index);
- };
- Tokenizer.prototype.emitToken = function (name) {
- this.cbs[name](this.getSection());
- this.sectionStart = -1;
- };
- Tokenizer.prototype.emitPartial = function (value) {
- if (this.baseState !== 1 /* Text */) {
- this.cbs.onattribdata(value); // TODO implement the new event
- } else {
- this.cbs.ontext(value);
- }
- };
- return Tokenizer;
- }();
- exports["default"] = Tokenizer;
- /***/ }),
- /***/ 6124:
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
- var __createBinding = this && this.__createBinding || (Object.create ? function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- Object.defineProperty(o, k2, {
- enumerable: true,
- get: function get() {
- return m[k];
- }
- });
- } : function (o, m, k, k2) {
- if (k2 === undefined) k2 = k;
- o[k2] = m[k];
- });
- var __setModuleDefault = this && this.__setModuleDefault || (Object.create ? function (o, v) {
- Object.defineProperty(o, "default", {
- enumerable: true,
- value: v
- });
- } : function (o, v) {
- o["default"] = v;
- });
- var __importStar = this && this.__importStar || function (mod) {
- if (mod && mod.__esModule) return mod;
- var result = {};
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
- __setModuleDefault(result, mod);
- return result;
- };
- var __exportStar = this && this.__exportStar || function (m, exports) {
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
- };
- var __importDefault = this && this.__importDefault || function (mod) {
- return mod && mod.__esModule ? mod : {
- "default": mod
- };
- };
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- exports.RssHandler = exports.DefaultHandler = exports.DomUtils = exports.ElementType = exports.Tokenizer = exports.createDomStream = exports.parseDOM = exports.parseDocument = exports.DomHandler = exports.Parser = void 0;
- var Parser_1 = __webpack_require__(8168);
- Object.defineProperty(exports, "Parser", ({
- enumerable: true,
- get: function get() {
- return Parser_1.Parser;
- }
- }));
- var domhandler_1 = __webpack_require__(1363);
- Object.defineProperty(exports, "DomHandler", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.DomHandler;
- }
- }));
- Object.defineProperty(exports, "DefaultHandler", ({
- enumerable: true,
- get: function get() {
- return domhandler_1.DomHandler;
- }
- }));
- // Helper methods
- /**
- * Parses the data, returns the resulting document.
- *
- * @param data The data that should be parsed.
- * @param options Optional options for the parser and DOM builder.
- */
- function parseDocument(data, options) {
- var handler = new domhandler_1.DomHandler(undefined, options);
- new Parser_1.Parser(handler, options).end(data);
- return handler.root;
- }
- exports.parseDocument = parseDocument;
- /**
- * Parses data, returns an array of the root nodes.
- *
- * Note that the root nodes still have a `Document` node as their parent.
- * Use `parseDocument` to get the `Document` node instead.
- *
- * @param data The data that should be parsed.
- * @param options Optional options for the parser and DOM builder.
- * @deprecated Use `parseDocument` instead.
- */
- function parseDOM(data, options) {
- return parseDocument(data, options).children;
- }
- exports.parseDOM = parseDOM;
- /**
- * Creates a parser instance, with an attached DOM handler.
- *
- * @param cb A callback that will be called once parsing has been completed.
- * @param options Optional options for the parser and DOM builder.
- * @param elementCb An optional callback that will be called every time a tag has been completed inside of the DOM.
- */
- function createDomStream(cb, options, elementCb) {
- var handler = new domhandler_1.DomHandler(cb, options, elementCb);
- return new Parser_1.Parser(handler, options);
- }
- exports.createDomStream = createDomStream;
- var Tokenizer_1 = __webpack_require__(6506);
- Object.defineProperty(exports, "Tokenizer", ({
- enumerable: true,
- get: function get() {
- return __importDefault(Tokenizer_1)["default"];
- }
- }));
- var ElementType = __importStar(__webpack_require__(7304));
- exports.ElementType = ElementType;
- /*
- * All of the following exports exist for backwards-compatibility.
- * They should probably be removed eventually.
- */
- __exportStar(__webpack_require__(2369), exports);
- exports.DomUtils = __importStar(__webpack_require__(5511));
- var FeedHandler_1 = __webpack_require__(2369);
- Object.defineProperty(exports, "RssHandler", ({
- enumerable: true,
- get: function get() {
- return FeedHandler_1.FeedHandler;
- }
- }));
- /***/ }),
- /***/ 4281:
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({
- value: true
- }));
- /*!
- * is-plain-object <https://github.com/jonschlinkert/is-plain-object>
- *
- * Copyright (c) 2014-2017, Jon Schlinkert.
- * Released under the MIT License.
- */
- function isObject(o) {
- return Object.prototype.toString.call(o) === '[object Object]';
- }
- function isPlainObject(o) {
- var ctor, prot;
- if (isObject(o) === false) return false;
- // If has modified constructor
- ctor = o.constructor;
- if (ctor === undefined) return true;
- // If has modified prototype
- prot = ctor.prototype;
- if (isObject(prot) === false) return false;
- // If constructor does not have an Object-specific method
- if (prot.hasOwnProperty('isPrototypeOf') === false) {
- return false;
- }
- // Most likely a plain Object
- return true;
- }
- exports.isPlainObject = isPlainObject;
- /***/ }),
- /***/ 2134:
- /***/ (function(module, exports) {
- var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- /**
- * Srcset Parser
- *
- * By Alex Bell | MIT License
- *
- * JS Parser for the string value that appears in markup <img srcset="here">
- *
- * @returns Array [{url: _, d: _, w: _, h:_}, ...]
- *
- * Based super duper closely on the reference algorithm at:
- * https://html.spec.whatwg.org/multipage/embedded-content.html#parse-a-srcset-attribute
- *
- * Most comments are copied in directly from the spec
- * (except for comments in parens).
- */
- (function (root, factory) {
- if (true) {
- // AMD. Register as an anonymous module.
- !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
- __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
- (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
- __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
- } else {}
- })(this, function () {
- // 1. Let input be the value passed to this algorithm.
- return function (input) {
- // UTILITY FUNCTIONS
- // Manual is faster than RegEx
- // http://bjorn.tipling.com/state-and-regular-expressions-in-javascript
- // http://jsperf.com/whitespace-character/5
- function isSpace(c) {
- return c === " " ||
- // space
- c === "\t" ||
- // horizontal tab
- c === "\n" ||
- // new line
- c === "\f" ||
- // form feed
- c === "\r"; // carriage return
- }
- function collectCharacters(regEx) {
- var chars,
- match = regEx.exec(input.substring(pos));
- if (match) {
- chars = match[0];
- pos += chars.length;
- return chars;
- }
- }
- var inputLength = input.length,
- // (Don't use \s, to avoid matching non-breaking space)
- regexLeadingSpaces = /^[ \t\n\r\u000c]+/,
- regexLeadingCommasOrSpaces = /^[, \t\n\r\u000c]+/,
- regexLeadingNotSpaces = /^[^ \t\n\r\u000c]+/,
- regexTrailingCommas = /[,]+$/,
- regexNonNegativeInteger = /^\d+$/,
- // ( Positive or negative or unsigned integers or decimals, without or without exponents.
- // Must include at least one digit.
- // According to spec tests any decimal point must be followed by a digit.
- // No leading plus sign is allowed.)
- // https://html.spec.whatwg.org/multipage/infrastructure.html#valid-floating-point-number
- regexFloatingPoint = /^-?(?:[0-9]+|[0-9]*\.[0-9]+)(?:[eE][+-]?[0-9]+)?$/,
- url,
- descriptors,
- currentDescriptor,
- state,
- c,
- // 2. Let position be a pointer into input, initially pointing at the start
- // of the string.
- pos = 0,
- // 3. Let candidates be an initially empty source set.
- candidates = [];
- // 4. Splitting loop: Collect a sequence of characters that are space
- // characters or U+002C COMMA characters. If any U+002C COMMA characters
- // were collected, that is a parse error.
- while (true) {
- collectCharacters(regexLeadingCommasOrSpaces);
- // 5. If position is past the end of input, return candidates and abort these steps.
- if (pos >= inputLength) {
- return candidates; // (we're done, this is the sole return path)
- }
- // 6. Collect a sequence of characters that are not space characters,
- // and let that be url.
- url = collectCharacters(regexLeadingNotSpaces);
- // 7. Let descriptors be a new empty list.
- descriptors = [];
- // 8. If url ends with a U+002C COMMA character (,), follow these substeps:
- // (1). Remove all trailing U+002C COMMA characters from url. If this removed
- // more than one character, that is a parse error.
- if (url.slice(-1) === ",") {
- url = url.replace(regexTrailingCommas, "");
- // (Jump ahead to step 9 to skip tokenization and just push the candidate).
- parseDescriptors();
- // Otherwise, follow these substeps:
- } else {
- tokenize();
- } // (close else of step 8)
- // 16. Return to the step labeled splitting loop.
- } // (Close of big while loop.)
- /**
- * Tokenizes descriptor properties prior to parsing
- * Returns undefined.
- */
- function tokenize() {
- // 8.1. Descriptor tokeniser: Skip whitespace
- collectCharacters(regexLeadingSpaces);
- // 8.2. Let current descriptor be the empty string.
- currentDescriptor = "";
- // 8.3. Let state be in descriptor.
- state = "in descriptor";
- while (true) {
- // 8.4. Let c be the character at position.
- c = input.charAt(pos);
- // Do the following depending on the value of state.
- // For the purpose of this step, "EOF" is a special character representing
- // that position is past the end of input.
- // In descriptor
- if (state === "in descriptor") {
- // Do the following, depending on the value of c:
- // Space character
- // If current descriptor is not empty, append current descriptor to
- // descriptors and let current descriptor be the empty string.
- // Set state to after descriptor.
- if (isSpace(c)) {
- if (currentDescriptor) {
- descriptors.push(currentDescriptor);
- currentDescriptor = "";
- state = "after descriptor";
- }
- // U+002C COMMA (,)
- // Advance position to the next character in input. If current descriptor
- // is not empty, append current descriptor to descriptors. Jump to the step
- // labeled descriptor parser.
- } else if (c === ",") {
- pos += 1;
- if (currentDescriptor) {
- descriptors.push(currentDescriptor);
- }
- parseDescriptors();
- return;
- // U+0028 LEFT PARENTHESIS (()
- // Append c to current descriptor. Set state to in parens.
- } else if (c === "(") {
- currentDescriptor = currentDescriptor + c;
- state = "in parens";
- // EOF
- // If current descriptor is not empty, append current descriptor to
- // descriptors. Jump to the step labeled descriptor parser.
- } else if (c === "") {
- if (currentDescriptor) {
- descriptors.push(currentDescriptor);
- }
- parseDescriptors();
- return;
- // Anything else
- // Append c to current descriptor.
- } else {
- currentDescriptor = currentDescriptor + c;
- }
- // (end "in descriptor"
- // In parens
- } else if (state === "in parens") {
- // U+0029 RIGHT PARENTHESIS ())
- // Append c to current descriptor. Set state to in descriptor.
- if (c === ")") {
- currentDescriptor = currentDescriptor + c;
- state = "in descriptor";
- // EOF
- // Append current descriptor to descriptors. Jump to the step labeled
- // descriptor parser.
- } else if (c === "") {
- descriptors.push(currentDescriptor);
- parseDescriptors();
- return;
- // Anything else
- // Append c to current descriptor.
- } else {
- currentDescriptor = currentDescriptor + c;
- }
- // After descriptor
- } else if (state === "after descriptor") {
- // Do the following, depending on the value of c:
- // Space character: Stay in this state.
- if (isSpace(c)) {
- // EOF: Jump to the step labeled descriptor parser.
- } else if (c === "") {
- parseDescriptors();
- return;
- // Anything else
- // Set state to in descriptor. Set position to the previous character in input.
- } else {
- state = "in descriptor";
- pos -= 1;
- }
- }
- // Advance position to the next character in input.
- pos += 1;
- // Repeat this step.
- } // (close while true loop)
- }
- /**
- * Adds descriptor properties to a candidate, pushes to the candidates array
- * @return undefined
- */
- // Declared outside of the while loop so that it's only created once.
- function parseDescriptors() {
- // 9. Descriptor parser: Let error be no.
- var pError = false,
- // 10. Let width be absent.
- // 11. Let density be absent.
- // 12. Let future-compat-h be absent. (We're implementing it now as h)
- w,
- d,
- h,
- i,
- candidate = {},
- desc,
- lastChar,
- value,
- intVal,
- floatVal;
- // 13. For each descriptor in descriptors, run the appropriate set of steps
- // from the following list:
- for (i = 0; i < descriptors.length; i++) {
- desc = descriptors[i];
- lastChar = desc[desc.length - 1];
- value = desc.substring(0, desc.length - 1);
- intVal = parseInt(value, 10);
- floatVal = parseFloat(value);
- // If the descriptor consists of a valid non-negative integer followed by
- // a U+0077 LATIN SMALL LETTER W character
- if (regexNonNegativeInteger.test(value) && lastChar === "w") {
- // If width and density are not both absent, then let error be yes.
- if (w || d) {
- pError = true;
- }
- // Apply the rules for parsing non-negative integers to the descriptor.
- // If the result is zero, let error be yes.
- // Otherwise, let width be the result.
- if (intVal === 0) {
- pError = true;
- } else {
- w = intVal;
- }
- // If the descriptor consists of a valid floating-point number followed by
- // a U+0078 LATIN SMALL LETTER X character
- } else if (regexFloatingPoint.test(value) && lastChar === "x") {
- // If width, density and future-compat-h are not all absent, then let error
- // be yes.
- if (w || d || h) {
- pError = true;
- }
- // Apply the rules for parsing floating-point number values to the descriptor.
- // If the result is less than zero, let error be yes. Otherwise, let density
- // be the result.
- if (floatVal < 0) {
- pError = true;
- } else {
- d = floatVal;
- }
- // If the descriptor consists of a valid non-negative integer followed by
- // a U+0068 LATIN SMALL LETTER H character
- } else if (regexNonNegativeInteger.test(value) && lastChar === "h") {
- // If height and density are not both absent, then let error be yes.
- if (h || d) {
- pError = true;
- }
- // Apply the rules for parsing non-negative integers to the descriptor.
- // If the result is zero, let error be yes. Otherwise, let future-compat-h
- // be the result.
- if (intVal === 0) {
- pError = true;
- } else {
- h = intVal;
- }
- // Anything else, Let error be yes.
- } else {
- pError = true;
- }
- } // (close step 13 for loop)
- // 15. If error is still no, then append a new image source to candidates whose
- // URL is url, associated with a width width if not absent and a pixel
- // density density if not absent. Otherwise, there is a parse error.
- if (!pError) {
- candidate.url = url;
- if (w) {
- candidate.w = w;
- }
- if (d) {
- candidate.d = d;
- }
- if (h) {
- candidate.h = h;
- }
- candidates.push(candidate);
- } else if (console && console.log) {
- console.log("Invalid srcset descriptor found in '" + input + "' at '" + desc + "'.");
- }
- } // (close parseDescriptors fn)
- };
- });
- /***/ }),
- /***/ 8799:
- /***/ ((module) => {
- var x = String;
- var create = function create() {
- return {
- isColorSupported: false,
- reset: x,
- bold: x,
- dim: x,
- italic: x,
- underline: x,
- inverse: x,
- hidden: x,
- strikethrough: x,
- black: x,
- red: x,
- green: x,
- yellow: x,
- blue: x,
- magenta: x,
- cyan: x,
- white: x,
- gray: x,
- bgBlack: x,
- bgRed: x,
- bgGreen: x,
- bgYellow: x,
- bgBlue: x,
- bgMagenta: x,
- bgCyan: x,
- bgWhite: x
- };
- };
- module.exports = create();
- module.exports.createColors = create;
- /***/ }),
- /***/ 8940:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var Container = __webpack_require__(1204);
- var AtRule = /*#__PURE__*/function (_Container) {
- _inherits(AtRule, _Container);
- var _super = _createSuper(AtRule);
- function AtRule(defaults) {
- var _this;
- _classCallCheck(this, AtRule);
- _this = _super.call(this, defaults);
- _this.type = 'atrule';
- return _this;
- }
- _createClass(AtRule, [{
- key: "append",
- value: function append() {
- var _get2;
- if (!this.proxyOf.nodes) this.nodes = [];
- for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
- children[_key] = arguments[_key];
- }
- return (_get2 = _get(_getPrototypeOf(AtRule.prototype), "append", this)).call.apply(_get2, [this].concat(children));
- }
- }, {
- key: "prepend",
- value: function prepend() {
- var _get3;
- if (!this.proxyOf.nodes) this.nodes = [];
- for (var _len2 = arguments.length, children = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- children[_key2] = arguments[_key2];
- }
- return (_get3 = _get(_getPrototypeOf(AtRule.prototype), "prepend", this)).call.apply(_get3, [this].concat(children));
- }
- }]);
- return AtRule;
- }(Container);
- module.exports = AtRule;
- AtRule["default"] = AtRule;
- Container.registerAtRule(AtRule);
- /***/ }),
- /***/ 3102:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var Node = __webpack_require__(4343);
- var Comment = /*#__PURE__*/function (_Node) {
- _inherits(Comment, _Node);
- var _super = _createSuper(Comment);
- function Comment(defaults) {
- var _this;
- _classCallCheck(this, Comment);
- _this = _super.call(this, defaults);
- _this.type = 'comment';
- return _this;
- }
- return _createClass(Comment);
- }(Node);
- module.exports = Comment;
- Comment["default"] = Comment;
- /***/ }),
- /***/ 1204:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- var _require = __webpack_require__(5506),
- isClean = _require.isClean,
- my = _require.my;
- var Declaration = __webpack_require__(6417);
- var Comment = __webpack_require__(3102);
- var Node = __webpack_require__(4343);
- var parse, Rule, AtRule, Root;
- function cleanSource(nodes) {
- return nodes.map(function (i) {
- if (i.nodes) i.nodes = cleanSource(i.nodes);
- delete i.source;
- return i;
- });
- }
- function markDirtyUp(node) {
- node[isClean] = false;
- if (node.proxyOf.nodes) {
- var _iterator = _createForOfIteratorHelper(node.proxyOf.nodes),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var i = _step.value;
- markDirtyUp(i);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- }
- var Container = /*#__PURE__*/function (_Node) {
- _inherits(Container, _Node);
- var _super = _createSuper(Container);
- function Container() {
- _classCallCheck(this, Container);
- return _super.apply(this, arguments);
- }
- _createClass(Container, [{
- key: "push",
- value: function push(child) {
- child.parent = this;
- this.proxyOf.nodes.push(child);
- return this;
- }
- }, {
- key: "each",
- value: function each(callback) {
- if (!this.proxyOf.nodes) return undefined;
- var iterator = this.getIterator();
- var index, result;
- while (this.indexes[iterator] < this.proxyOf.nodes.length) {
- index = this.indexes[iterator];
- result = callback(this.proxyOf.nodes[index], index);
- if (result === false) break;
- this.indexes[iterator] += 1;
- }
- delete this.indexes[iterator];
- return result;
- }
- }, {
- key: "walk",
- value: function walk(callback) {
- return this.each(function (child, i) {
- var result;
- try {
- result = callback(child, i);
- } catch (e) {
- throw child.addToError(e);
- }
- if (result !== false && child.walk) {
- result = child.walk(callback);
- }
- return result;
- });
- }
- }, {
- key: "walkDecls",
- value: function walkDecls(prop, callback) {
- if (!callback) {
- callback = prop;
- return this.walk(function (child, i) {
- if (child.type === 'decl') {
- return callback(child, i);
- }
- });
- }
- if (prop instanceof RegExp) {
- return this.walk(function (child, i) {
- if (child.type === 'decl' && prop.test(child.prop)) {
- return callback(child, i);
- }
- });
- }
- return this.walk(function (child, i) {
- if (child.type === 'decl' && child.prop === prop) {
- return callback(child, i);
- }
- });
- }
- }, {
- key: "walkRules",
- value: function walkRules(selector, callback) {
- if (!callback) {
- callback = selector;
- return this.walk(function (child, i) {
- if (child.type === 'rule') {
- return callback(child, i);
- }
- });
- }
- if (selector instanceof RegExp) {
- return this.walk(function (child, i) {
- if (child.type === 'rule' && selector.test(child.selector)) {
- return callback(child, i);
- }
- });
- }
- return this.walk(function (child, i) {
- if (child.type === 'rule' && child.selector === selector) {
- return callback(child, i);
- }
- });
- }
- }, {
- key: "walkAtRules",
- value: function walkAtRules(name, callback) {
- if (!callback) {
- callback = name;
- return this.walk(function (child, i) {
- if (child.type === 'atrule') {
- return callback(child, i);
- }
- });
- }
- if (name instanceof RegExp) {
- return this.walk(function (child, i) {
- if (child.type === 'atrule' && name.test(child.name)) {
- return callback(child, i);
- }
- });
- }
- return this.walk(function (child, i) {
- if (child.type === 'atrule' && child.name === name) {
- return callback(child, i);
- }
- });
- }
- }, {
- key: "walkComments",
- value: function walkComments(callback) {
- return this.walk(function (child, i) {
- if (child.type === 'comment') {
- return callback(child, i);
- }
- });
- }
- }, {
- key: "append",
- value: function append() {
- for (var _len = arguments.length, children = new Array(_len), _key = 0; _key < _len; _key++) {
- children[_key] = arguments[_key];
- }
- for (var _i = 0, _children = children; _i < _children.length; _i++) {
- var child = _children[_i];
- var nodes = this.normalize(child, this.last);
- var _iterator2 = _createForOfIteratorHelper(nodes),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var node = _step2.value;
- this.proxyOf.nodes.push(node);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- }
- this.markDirty();
- return this;
- }
- }, {
- key: "prepend",
- value: function prepend() {
- for (var _len2 = arguments.length, children = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- children[_key2] = arguments[_key2];
- }
- children = children.reverse();
- var _iterator3 = _createForOfIteratorHelper(children),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var child = _step3.value;
- var nodes = this.normalize(child, this.first, 'prepend').reverse();
- var _iterator4 = _createForOfIteratorHelper(nodes),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var node = _step4.value;
- this.proxyOf.nodes.unshift(node);
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- for (var id in this.indexes) {
- this.indexes[id] = this.indexes[id] + nodes.length;
- }
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- this.markDirty();
- return this;
- }
- }, {
- key: "cleanRaws",
- value: function cleanRaws(keepBetween) {
- _get(_getPrototypeOf(Container.prototype), "cleanRaws", this).call(this, keepBetween);
- if (this.nodes) {
- var _iterator5 = _createForOfIteratorHelper(this.nodes),
- _step5;
- try {
- for (_iterator5.s(); !(_step5 = _iterator5.n()).done;) {
- var node = _step5.value;
- node.cleanRaws(keepBetween);
- }
- } catch (err) {
- _iterator5.e(err);
- } finally {
- _iterator5.f();
- }
- }
- }
- }, {
- key: "insertBefore",
- value: function insertBefore(exist, add) {
- var existIndex = this.index(exist);
- var type = existIndex === 0 ? 'prepend' : false;
- var nodes = this.normalize(add, this.proxyOf.nodes[existIndex], type).reverse();
- existIndex = this.index(exist);
- var _iterator6 = _createForOfIteratorHelper(nodes),
- _step6;
- try {
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
- var node = _step6.value;
- this.proxyOf.nodes.splice(existIndex, 0, node);
- }
- } catch (err) {
- _iterator6.e(err);
- } finally {
- _iterator6.f();
- }
- var index;
- for (var id in this.indexes) {
- index = this.indexes[id];
- if (existIndex <= index) {
- this.indexes[id] = index + nodes.length;
- }
- }
- this.markDirty();
- return this;
- }
- }, {
- key: "insertAfter",
- value: function insertAfter(exist, add) {
- var existIndex = this.index(exist);
- var nodes = this.normalize(add, this.proxyOf.nodes[existIndex]).reverse();
- existIndex = this.index(exist);
- var _iterator7 = _createForOfIteratorHelper(nodes),
- _step7;
- try {
- for (_iterator7.s(); !(_step7 = _iterator7.n()).done;) {
- var node = _step7.value;
- this.proxyOf.nodes.splice(existIndex + 1, 0, node);
- }
- } catch (err) {
- _iterator7.e(err);
- } finally {
- _iterator7.f();
- }
- var index;
- for (var id in this.indexes) {
- index = this.indexes[id];
- if (existIndex < index) {
- this.indexes[id] = index + nodes.length;
- }
- }
- this.markDirty();
- return this;
- }
- }, {
- key: "removeChild",
- value: function removeChild(child) {
- child = this.index(child);
- this.proxyOf.nodes[child].parent = undefined;
- this.proxyOf.nodes.splice(child, 1);
- var index;
- for (var id in this.indexes) {
- index = this.indexes[id];
- if (index >= child) {
- this.indexes[id] = index - 1;
- }
- }
- this.markDirty();
- return this;
- }
- }, {
- key: "removeAll",
- value: function removeAll() {
- var _iterator8 = _createForOfIteratorHelper(this.proxyOf.nodes),
- _step8;
- try {
- for (_iterator8.s(); !(_step8 = _iterator8.n()).done;) {
- var node = _step8.value;
- node.parent = undefined;
- }
- } catch (err) {
- _iterator8.e(err);
- } finally {
- _iterator8.f();
- }
- this.proxyOf.nodes = [];
- this.markDirty();
- return this;
- }
- }, {
- key: "replaceValues",
- value: function replaceValues(pattern, opts, callback) {
- if (!callback) {
- callback = opts;
- opts = {};
- }
- this.walkDecls(function (decl) {
- if (opts.props && !opts.props.includes(decl.prop)) return;
- if (opts.fast && !decl.value.includes(opts.fast)) return;
- decl.value = decl.value.replace(pattern, callback);
- });
- this.markDirty();
- return this;
- }
- }, {
- key: "every",
- value: function every(condition) {
- return this.nodes.every(condition);
- }
- }, {
- key: "some",
- value: function some(condition) {
- return this.nodes.some(condition);
- }
- }, {
- key: "index",
- value: function index(child) {
- if (typeof child === 'number') return child;
- if (child.proxyOf) child = child.proxyOf;
- return this.proxyOf.nodes.indexOf(child);
- }
- }, {
- key: "first",
- get: function get() {
- if (!this.proxyOf.nodes) return undefined;
- return this.proxyOf.nodes[0];
- }
- }, {
- key: "last",
- get: function get() {
- if (!this.proxyOf.nodes) return undefined;
- return this.proxyOf.nodes[this.proxyOf.nodes.length - 1];
- }
- }, {
- key: "normalize",
- value: function normalize(nodes, sample) {
- var _this = this;
- if (typeof nodes === 'string') {
- nodes = cleanSource(parse(nodes).nodes);
- } else if (Array.isArray(nodes)) {
- nodes = nodes.slice(0);
- var _iterator9 = _createForOfIteratorHelper(nodes),
- _step9;
- try {
- for (_iterator9.s(); !(_step9 = _iterator9.n()).done;) {
- var i = _step9.value;
- if (i.parent) i.parent.removeChild(i, 'ignore');
- }
- } catch (err) {
- _iterator9.e(err);
- } finally {
- _iterator9.f();
- }
- } else if (nodes.type === 'root' && this.type !== 'document') {
- nodes = nodes.nodes.slice(0);
- var _iterator10 = _createForOfIteratorHelper(nodes),
- _step10;
- try {
- for (_iterator10.s(); !(_step10 = _iterator10.n()).done;) {
- var _i2 = _step10.value;
- if (_i2.parent) _i2.parent.removeChild(_i2, 'ignore');
- }
- } catch (err) {
- _iterator10.e(err);
- } finally {
- _iterator10.f();
- }
- } else if (nodes.type) {
- nodes = [nodes];
- } else if (nodes.prop) {
- if (typeof nodes.value === 'undefined') {
- throw new Error('Value field is missed in node creation');
- } else if (typeof nodes.value !== 'string') {
- nodes.value = String(nodes.value);
- }
- nodes = [new Declaration(nodes)];
- } else if (nodes.selector) {
- nodes = [new Rule(nodes)];
- } else if (nodes.name) {
- nodes = [new AtRule(nodes)];
- } else if (nodes.text) {
- nodes = [new Comment(nodes)];
- } else {
- throw new Error('Unknown node type in node creation');
- }
- var processed = nodes.map(function (i) {
- /* c8 ignore next */
- if (!i[my]) Container.rebuild(i);
- i = i.proxyOf;
- if (i.parent) i.parent.removeChild(i);
- if (i[isClean]) markDirtyUp(i);
- if (typeof i.raws.before === 'undefined') {
- if (sample && typeof sample.raws.before !== 'undefined') {
- i.raws.before = sample.raws.before.replace(/\S/g, '');
- }
- }
- i.parent = _this.proxyOf;
- return i;
- });
- return processed;
- }
- }, {
- key: "getProxyProcessor",
- value: function getProxyProcessor() {
- return {
- set: function set(node, prop, value) {
- if (node[prop] === value) return true;
- node[prop] = value;
- if (prop === 'name' || prop === 'params' || prop === 'selector') {
- node.markDirty();
- }
- return true;
- },
- get: function get(node, prop) {
- if (prop === 'proxyOf') {
- return node;
- } else if (!node[prop]) {
- return node[prop];
- } else if (prop === 'each' || typeof prop === 'string' && prop.startsWith('walk')) {
- return function () {
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- return node[prop].apply(node, _toConsumableArray(args.map(function (i) {
- if (typeof i === 'function') {
- return function (child, index) {
- return i(child.toProxy(), index);
- };
- } else {
- return i;
- }
- })));
- };
- } else if (prop === 'every' || prop === 'some') {
- return function (cb) {
- return node[prop](function (child) {
- for (var _len4 = arguments.length, other = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
- other[_key4 - 1] = arguments[_key4];
- }
- return cb.apply(void 0, [child.toProxy()].concat(other));
- });
- };
- } else if (prop === 'root') {
- return function () {
- return node.root().toProxy();
- };
- } else if (prop === 'nodes') {
- return node.nodes.map(function (i) {
- return i.toProxy();
- });
- } else if (prop === 'first' || prop === 'last') {
- return node[prop].toProxy();
- } else {
- return node[prop];
- }
- }
- };
- }
- }, {
- key: "getIterator",
- value: function getIterator() {
- if (!this.lastEach) this.lastEach = 0;
- if (!this.indexes) this.indexes = {};
- this.lastEach += 1;
- var iterator = this.lastEach;
- this.indexes[iterator] = 0;
- return iterator;
- }
- }]);
- return Container;
- }(Node);
- Container.registerParse = function (dependant) {
- parse = dependant;
- };
- Container.registerRule = function (dependant) {
- Rule = dependant;
- };
- Container.registerAtRule = function (dependant) {
- AtRule = dependant;
- };
- Container.registerRoot = function (dependant) {
- Root = dependant;
- };
- module.exports = Container;
- Container["default"] = Container;
- /* c8 ignore start */
- Container.rebuild = function (node) {
- if (node.type === 'atrule') {
- Object.setPrototypeOf(node, AtRule.prototype);
- } else if (node.type === 'rule') {
- Object.setPrototypeOf(node, Rule.prototype);
- } else if (node.type === 'decl') {
- Object.setPrototypeOf(node, Declaration.prototype);
- } else if (node.type === 'comment') {
- Object.setPrototypeOf(node, Comment.prototype);
- } else if (node.type === 'root') {
- Object.setPrototypeOf(node, Root.prototype);
- }
- node[my] = true;
- if (node.nodes) {
- node.nodes.forEach(function (child) {
- Container.rebuild(child);
- });
- }
- };
- /* c8 ignore stop */
- /***/ }),
- /***/ 1667:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _wrapNativeSuper(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrapNativeSuper = function _wrapNativeSuper(Class) { if (Class === null || !_isNativeFunction(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _getPrototypeOf(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _setPrototypeOf(Wrapper, Class); }; return _wrapNativeSuper(Class); }
- function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct.bind(); } else { _construct = function _construct(Parent, args, Class) { var a = [null]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _setPrototypeOf(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _isNativeFunction(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var pico = __webpack_require__(8799);
- var terminalHighlight = __webpack_require__(2868);
- var CssSyntaxError = /*#__PURE__*/function (_Error) {
- _inherits(CssSyntaxError, _Error);
- var _super = _createSuper(CssSyntaxError);
- function CssSyntaxError(message, line, column, source, file, plugin) {
- var _this;
- _classCallCheck(this, CssSyntaxError);
- _this = _super.call(this, message);
- _this.name = 'CssSyntaxError';
- _this.reason = message;
- if (file) {
- _this.file = file;
- }
- if (source) {
- _this.source = source;
- }
- if (plugin) {
- _this.plugin = plugin;
- }
- if (typeof line !== 'undefined' && typeof column !== 'undefined') {
- if (typeof line === 'number') {
- _this.line = line;
- _this.column = column;
- } else {
- _this.line = line.line;
- _this.column = line.column;
- _this.endLine = column.line;
- _this.endColumn = column.column;
- }
- }
- _this.setMessage();
- if (Error.captureStackTrace) {
- Error.captureStackTrace(_assertThisInitialized(_this), CssSyntaxError);
- }
- return _this;
- }
- _createClass(CssSyntaxError, [{
- key: "setMessage",
- value: function setMessage() {
- this.message = this.plugin ? this.plugin + ': ' : '';
- this.message += this.file ? this.file : '<css input>';
- if (typeof this.line !== 'undefined') {
- this.message += ':' + this.line + ':' + this.column;
- }
- this.message += ': ' + this.reason;
- }
- }, {
- key: "showSourceCode",
- value: function showSourceCode(color) {
- var _this2 = this;
- if (!this.source) return '';
- var css = this.source;
- if (color == null) color = pico.isColorSupported;
- if (terminalHighlight) {
- if (color) css = terminalHighlight(css);
- }
- var lines = css.split(/\r?\n/);
- var start = Math.max(this.line - 3, 0);
- var end = Math.min(this.line + 2, lines.length);
- var maxWidth = String(end).length;
- var mark, aside;
- if (color) {
- var _pico$createColors = pico.createColors(true),
- bold = _pico$createColors.bold,
- red = _pico$createColors.red,
- gray = _pico$createColors.gray;
- mark = function mark(text) {
- return bold(red(text));
- };
- aside = function aside(text) {
- return gray(text);
- };
- } else {
- mark = aside = function aside(str) {
- return str;
- };
- }
- return lines.slice(start, end).map(function (line, index) {
- var number = start + 1 + index;
- var gutter = ' ' + (' ' + number).slice(-maxWidth) + ' | ';
- if (number === _this2.line) {
- var spacing = aside(gutter.replace(/\d/g, ' ')) + line.slice(0, _this2.column - 1).replace(/[^\t]/g, ' ');
- return mark('>') + aside(gutter) + line + '\n ' + spacing + mark('^');
- }
- return ' ' + aside(gutter) + line;
- }).join('\n');
- }
- }, {
- key: "toString",
- value: function toString() {
- var code = this.showSourceCode();
- if (code) {
- code = '\n\n' + code + '\n';
- }
- return this.name + ': ' + this.message + code;
- }
- }]);
- return CssSyntaxError;
- }( /*#__PURE__*/_wrapNativeSuper(Error));
- module.exports = CssSyntaxError;
- CssSyntaxError["default"] = CssSyntaxError;
- /***/ }),
- /***/ 6417:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var Node = __webpack_require__(4343);
- var Declaration = /*#__PURE__*/function (_Node) {
- _inherits(Declaration, _Node);
- var _super = _createSuper(Declaration);
- function Declaration(defaults) {
- var _this;
- _classCallCheck(this, Declaration);
- if (defaults && typeof defaults.value !== 'undefined' && typeof defaults.value !== 'string') {
- defaults = _objectSpread(_objectSpread({}, defaults), {}, {
- value: String(defaults.value)
- });
- }
- _this = _super.call(this, defaults);
- _this.type = 'decl';
- return _this;
- }
- _createClass(Declaration, [{
- key: "variable",
- get: function get() {
- return this.prop.startsWith('--') || this.prop[0] === '$';
- }
- }]);
- return Declaration;
- }(Node);
- module.exports = Declaration;
- Declaration["default"] = Declaration;
- /***/ }),
- /***/ 7083:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var Container = __webpack_require__(1204);
- var LazyResult, Processor;
- var Document = /*#__PURE__*/function (_Container) {
- _inherits(Document, _Container);
- var _super = _createSuper(Document);
- function Document(defaults) {
- var _this;
- _classCallCheck(this, Document);
- // type needs to be passed to super, otherwise child roots won't be normalized correctly
- _this = _super.call(this, _objectSpread({
- type: 'document'
- }, defaults));
- if (!_this.nodes) {
- _this.nodes = [];
- }
- return _this;
- }
- _createClass(Document, [{
- key: "toResult",
- value: function toResult() {
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var lazy = new LazyResult(new Processor(), this, opts);
- return lazy.stringify();
- }
- }]);
- return Document;
- }(Container);
- Document.registerLazyResult = function (dependant) {
- LazyResult = dependant;
- };
- Document.registerProcessor = function (dependant) {
- Processor = dependant;
- };
- module.exports = Document;
- Document["default"] = Document;
- /***/ }),
- /***/ 9295:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var _excluded = ["inputs"],
- _excluded2 = ["inputId"];
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
- function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
- var Declaration = __webpack_require__(6417);
- var PreviousMap = __webpack_require__(3353);
- var Comment = __webpack_require__(3102);
- var AtRule = __webpack_require__(8940);
- var Input = __webpack_require__(2993);
- var Root = __webpack_require__(7563);
- var Rule = __webpack_require__(6621);
- function fromJSON(json, inputs) {
- if (Array.isArray(json)) return json.map(function (n) {
- return fromJSON(n);
- });
- var ownInputs = json.inputs,
- defaults = _objectWithoutProperties(json, _excluded);
- if (ownInputs) {
- inputs = [];
- var _iterator = _createForOfIteratorHelper(ownInputs),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var input = _step.value;
- var inputHydrated = _objectSpread(_objectSpread({}, input), {}, {
- __proto__: Input.prototype
- });
- if (inputHydrated.map) {
- inputHydrated.map = _objectSpread(_objectSpread({}, inputHydrated.map), {}, {
- __proto__: PreviousMap.prototype
- });
- }
- inputs.push(inputHydrated);
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- if (defaults.nodes) {
- defaults.nodes = json.nodes.map(function (n) {
- return fromJSON(n, inputs);
- });
- }
- if (defaults.source) {
- var _defaults$source = defaults.source,
- inputId = _defaults$source.inputId,
- source = _objectWithoutProperties(_defaults$source, _excluded2);
- defaults.source = source;
- if (inputId != null) {
- defaults.source.input = inputs[inputId];
- }
- }
- if (defaults.type === 'root') {
- return new Root(defaults);
- } else if (defaults.type === 'decl') {
- return new Declaration(defaults);
- } else if (defaults.type === 'rule') {
- return new Rule(defaults);
- } else if (defaults.type === 'comment') {
- return new Comment(defaults);
- } else if (defaults.type === 'atrule') {
- return new AtRule(defaults);
- } else {
- throw new Error('Unknown node type: ' + json.type);
- }
- }
- module.exports = fromJSON;
- fromJSON["default"] = fromJSON;
- /***/ }),
- /***/ 2993:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var _require = __webpack_require__(209),
- SourceMapConsumer = _require.SourceMapConsumer,
- SourceMapGenerator = _require.SourceMapGenerator;
- var _require2 = __webpack_require__(7414),
- fileURLToPath = _require2.fileURLToPath,
- pathToFileURL = _require2.pathToFileURL;
- var _require3 = __webpack_require__(9830),
- resolve = _require3.resolve,
- isAbsolute = _require3.isAbsolute;
- var _require4 = __webpack_require__(2961),
- nanoid = _require4.nanoid;
- var terminalHighlight = __webpack_require__(2868);
- var CssSyntaxError = __webpack_require__(1667);
- var PreviousMap = __webpack_require__(3353);
- var fromOffsetCache = Symbol('fromOffsetCache');
- var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
- var pathAvailable = Boolean(resolve && isAbsolute);
- var Input = /*#__PURE__*/function () {
- function Input(css) {
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- _classCallCheck(this, Input);
- if (css === null || typeof css === 'undefined' || _typeof(css) === 'object' && !css.toString) {
- throw new Error("PostCSS received ".concat(css, " instead of CSS string"));
- }
- this.css = css.toString();
- if (this.css[0] === "\uFEFF" || this.css[0] === "\uFFFE") {
- this.hasBOM = true;
- this.css = this.css.slice(1);
- } else {
- this.hasBOM = false;
- }
- if (opts.from) {
- if (!pathAvailable || /^\w+:\/\//.test(opts.from) || isAbsolute(opts.from)) {
- this.file = opts.from;
- } else {
- this.file = resolve(opts.from);
- }
- }
- if (pathAvailable && sourceMapAvailable) {
- var map = new PreviousMap(this.css, opts);
- if (map.text) {
- this.map = map;
- var file = map.consumer().file;
- if (!this.file && file) this.file = this.mapResolve(file);
- }
- }
- if (!this.file) {
- this.id = '<input css ' + nanoid(6) + '>';
- }
- if (this.map) this.map.file = this.from;
- }
- _createClass(Input, [{
- key: "fromOffset",
- value: function fromOffset(offset) {
- var lastLine, lineToIndex;
- if (!this[fromOffsetCache]) {
- var lines = this.css.split('\n');
- lineToIndex = new Array(lines.length);
- var prevIndex = 0;
- for (var i = 0, l = lines.length; i < l; i++) {
- lineToIndex[i] = prevIndex;
- prevIndex += lines[i].length + 1;
- }
- this[fromOffsetCache] = lineToIndex;
- } else {
- lineToIndex = this[fromOffsetCache];
- }
- lastLine = lineToIndex[lineToIndex.length - 1];
- var min = 0;
- if (offset >= lastLine) {
- min = lineToIndex.length - 1;
- } else {
- var max = lineToIndex.length - 2;
- var mid;
- while (min < max) {
- mid = min + (max - min >> 1);
- if (offset < lineToIndex[mid]) {
- max = mid - 1;
- } else if (offset >= lineToIndex[mid + 1]) {
- min = mid + 1;
- } else {
- min = mid;
- break;
- }
- }
- }
- return {
- line: min + 1,
- col: offset - lineToIndex[min] + 1
- };
- }
- }, {
- key: "error",
- value: function error(message, line, column) {
- var opts = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
- var result, endLine, endColumn;
- if (line && _typeof(line) === 'object') {
- var start = line;
- var end = column;
- if (typeof start.offset === 'number') {
- var pos = this.fromOffset(start.offset);
- line = pos.line;
- column = pos.col;
- } else {
- line = start.line;
- column = start.column;
- }
- if (typeof end.offset === 'number') {
- var _pos = this.fromOffset(end.offset);
- endLine = _pos.line;
- endColumn = _pos.col;
- } else {
- endLine = end.line;
- endColumn = end.column;
- }
- } else if (!column) {
- var _pos2 = this.fromOffset(line);
- line = _pos2.line;
- column = _pos2.col;
- }
- var origin = this.origin(line, column, endLine, endColumn);
- if (origin) {
- result = new CssSyntaxError(message, origin.endLine === undefined ? origin.line : {
- line: origin.line,
- column: origin.column
- }, origin.endLine === undefined ? origin.column : {
- line: origin.endLine,
- column: origin.endColumn
- }, origin.source, origin.file, opts.plugin);
- } else {
- result = new CssSyntaxError(message, endLine === undefined ? line : {
- line: line,
- column: column
- }, endLine === undefined ? column : {
- line: endLine,
- column: endColumn
- }, this.css, this.file, opts.plugin);
- }
- result.input = {
- line: line,
- column: column,
- endLine: endLine,
- endColumn: endColumn,
- source: this.css
- };
- if (this.file) {
- if (pathToFileURL) {
- result.input.url = pathToFileURL(this.file).toString();
- }
- result.input.file = this.file;
- }
- return result;
- }
- }, {
- key: "origin",
- value: function origin(line, column, endLine, endColumn) {
- if (!this.map) return false;
- var consumer = this.map.consumer();
- var from = consumer.originalPositionFor({
- line: line,
- column: column
- });
- if (!from.source) return false;
- var to;
- if (typeof endLine === 'number') {
- to = consumer.originalPositionFor({
- line: endLine,
- column: endColumn
- });
- }
- var fromUrl;
- if (isAbsolute(from.source)) {
- fromUrl = pathToFileURL(from.source);
- } else {
- fromUrl = new URL(from.source, this.map.consumer().sourceRoot || pathToFileURL(this.map.mapFile));
- }
- var result = {
- url: fromUrl.toString(),
- line: from.line,
- column: from.column,
- endLine: to && to.line,
- endColumn: to && to.column
- };
- if (fromUrl.protocol === 'file:') {
- if (fileURLToPath) {
- result.file = fileURLToPath(fromUrl);
- } else {
- /* c8 ignore next 2 */
- throw new Error("file: protocol is not available in this PostCSS build");
- }
- }
- var source = consumer.sourceContentFor(from.source);
- if (source) result.source = source;
- return result;
- }
- }, {
- key: "mapResolve",
- value: function mapResolve(file) {
- if (/^\w+:\/\//.test(file)) {
- return file;
- }
- return resolve(this.map.consumer().sourceRoot || this.map.root || '.', file);
- }
- }, {
- key: "from",
- get: function get() {
- return this.file || this.id;
- }
- }, {
- key: "toJSON",
- value: function toJSON() {
- var json = {};
- for (var _i = 0, _arr = ['hasBOM', 'css', 'file', 'id']; _i < _arr.length; _i++) {
- var name = _arr[_i];
- if (this[name] != null) {
- json[name] = this[name];
- }
- }
- if (this.map) {
- json.map = _objectSpread({}, this.map);
- if (json.map.consumerCache) {
- json.map.consumerCache = undefined;
- }
- }
- return json;
- }
- }]);
- return Input;
- }();
- module.exports = Input;
- Input["default"] = Input;
- if (terminalHighlight && terminalHighlight.registerInput) {
- terminalHighlight.registerInput(Input);
- }
- /***/ }),
- /***/ 6992:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator["return"] && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, "catch": function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var _require = __webpack_require__(5506),
- isClean = _require.isClean,
- my = _require.my;
- var MapGenerator = __webpack_require__(8991);
- var _stringify = __webpack_require__(6157);
- var Container = __webpack_require__(1204);
- var Document = __webpack_require__(7083);
- var warnOnce = __webpack_require__(6574);
- var Result = __webpack_require__(6865);
- var parse = __webpack_require__(7057);
- var Root = __webpack_require__(7563);
- var TYPE_TO_CLASS_NAME = {
- document: 'Document',
- root: 'Root',
- atrule: 'AtRule',
- rule: 'Rule',
- decl: 'Declaration',
- comment: 'Comment'
- };
- var PLUGIN_PROPS = {
- postcssPlugin: true,
- prepare: true,
- Once: true,
- Document: true,
- Root: true,
- Declaration: true,
- Rule: true,
- AtRule: true,
- Comment: true,
- DeclarationExit: true,
- RuleExit: true,
- AtRuleExit: true,
- CommentExit: true,
- RootExit: true,
- DocumentExit: true,
- OnceExit: true
- };
- var NOT_VISITORS = {
- postcssPlugin: true,
- prepare: true,
- Once: true
- };
- var CHILDREN = 0;
- function isPromise(obj) {
- return _typeof(obj) === 'object' && typeof obj.then === 'function';
- }
- function getEvents(node) {
- var key = false;
- var type = TYPE_TO_CLASS_NAME[node.type];
- if (node.type === 'decl') {
- key = node.prop.toLowerCase();
- } else if (node.type === 'atrule') {
- key = node.name.toLowerCase();
- }
- if (key && node.append) {
- return [type, type + '-' + key, CHILDREN, type + 'Exit', type + 'Exit-' + key];
- } else if (key) {
- return [type, type + '-' + key, type + 'Exit', type + 'Exit-' + key];
- } else if (node.append) {
- return [type, CHILDREN, type + 'Exit'];
- } else {
- return [type, type + 'Exit'];
- }
- }
- function toStack(node) {
- var events;
- if (node.type === 'document') {
- events = ['Document', CHILDREN, 'DocumentExit'];
- } else if (node.type === 'root') {
- events = ['Root', CHILDREN, 'RootExit'];
- } else {
- events = getEvents(node);
- }
- return {
- node: node,
- events: events,
- eventIndex: 0,
- visitors: [],
- visitorIndex: 0,
- iterator: 0
- };
- }
- function cleanMarks(node) {
- node[isClean] = false;
- if (node.nodes) node.nodes.forEach(function (i) {
- return cleanMarks(i);
- });
- return node;
- }
- var postcss = {};
- var LazyResult = /*#__PURE__*/function (_Symbol$toStringTag) {
- function LazyResult(processor, css, opts) {
- var _this = this;
- _classCallCheck(this, LazyResult);
- this.stringified = false;
- this.processed = false;
- var root;
- if (_typeof(css) === 'object' && css !== null && (css.type === 'root' || css.type === 'document')) {
- root = cleanMarks(css);
- } else if (css instanceof LazyResult || css instanceof Result) {
- root = cleanMarks(css.root);
- if (css.map) {
- if (typeof opts.map === 'undefined') opts.map = {};
- if (!opts.map.inline) opts.map.inline = false;
- opts.map.prev = css.map;
- }
- } else {
- var parser = parse;
- if (opts.syntax) parser = opts.syntax.parse;
- if (opts.parser) parser = opts.parser;
- if (parser.parse) parser = parser.parse;
- try {
- root = parser(css, opts);
- } catch (error) {
- this.processed = true;
- this.error = error;
- }
- if (root && !root[my]) {
- /* c8 ignore next 2 */
- Container.rebuild(root);
- }
- }
- this.result = new Result(processor, root, opts);
- this.helpers = _objectSpread(_objectSpread({}, postcss), {}, {
- result: this.result,
- postcss: postcss
- });
- this.plugins = this.processor.plugins.map(function (plugin) {
- if (_typeof(plugin) === 'object' && plugin.prepare) {
- return _objectSpread(_objectSpread({}, plugin), plugin.prepare(_this.result));
- } else {
- return plugin;
- }
- });
- }
- _createClass(LazyResult, [{
- key: _Symbol$toStringTag,
- get: function get() {
- return 'LazyResult';
- }
- }, {
- key: "processor",
- get: function get() {
- return this.result.processor;
- }
- }, {
- key: "opts",
- get: function get() {
- return this.result.opts;
- }
- }, {
- key: "css",
- get: function get() {
- return this.stringify().css;
- }
- }, {
- key: "content",
- get: function get() {
- return this.stringify().content;
- }
- }, {
- key: "map",
- get: function get() {
- return this.stringify().map;
- }
- }, {
- key: "root",
- get: function get() {
- return this.sync().root;
- }
- }, {
- key: "messages",
- get: function get() {
- return this.sync().messages;
- }
- }, {
- key: "warnings",
- value: function warnings() {
- return this.sync().warnings();
- }
- }, {
- key: "toString",
- value: function toString() {
- return this.css;
- }
- }, {
- key: "then",
- value: function then(onFulfilled, onRejected) {
- if (false) {}
- return this.async().then(onFulfilled, onRejected);
- }
- }, {
- key: "catch",
- value: function _catch(onRejected) {
- return this.async()["catch"](onRejected);
- }
- }, {
- key: "finally",
- value: function _finally(onFinally) {
- return this.async().then(onFinally, onFinally);
- }
- }, {
- key: "async",
- value: function async() {
- if (this.error) return Promise.reject(this.error);
- if (this.processed) return Promise.resolve(this.result);
- if (!this.processing) {
- this.processing = this.runAsync();
- }
- return this.processing;
- }
- }, {
- key: "sync",
- value: function sync() {
- if (this.error) throw this.error;
- if (this.processed) return this.result;
- this.processed = true;
- if (this.processing) {
- throw this.getAsyncError();
- }
- var _iterator = _createForOfIteratorHelper(this.plugins),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var plugin = _step.value;
- var promise = this.runOnRoot(plugin);
- if (isPromise(promise)) {
- throw this.getAsyncError();
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- this.prepareVisitors();
- if (this.hasListener) {
- var root = this.result.root;
- while (!root[isClean]) {
- root[isClean] = true;
- this.walkSync(root);
- }
- if (this.listeners.OnceExit) {
- if (root.type === 'document') {
- var _iterator2 = _createForOfIteratorHelper(root.nodes),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var subRoot = _step2.value;
- this.visitSync(this.listeners.OnceExit, subRoot);
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- } else {
- this.visitSync(this.listeners.OnceExit, root);
- }
- }
- }
- return this.result;
- }
- }, {
- key: "stringify",
- value: function stringify() {
- if (this.error) throw this.error;
- if (this.stringified) return this.result;
- this.stringified = true;
- this.sync();
- var opts = this.result.opts;
- var str = _stringify;
- if (opts.syntax) str = opts.syntax.stringify;
- if (opts.stringifier) str = opts.stringifier;
- if (str.stringify) str = str.stringify;
- var map = new MapGenerator(str, this.result.root, this.result.opts);
- var data = map.generate();
- this.result.css = data[0];
- this.result.map = data[1];
- return this.result;
- }
- }, {
- key: "walkSync",
- value: function walkSync(node) {
- var _this2 = this;
- node[isClean] = true;
- var events = getEvents(node);
- var _iterator3 = _createForOfIteratorHelper(events),
- _step3;
- try {
- for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {
- var event = _step3.value;
- if (event === CHILDREN) {
- if (node.nodes) {
- node.each(function (child) {
- if (!child[isClean]) _this2.walkSync(child);
- });
- }
- } else {
- var visitors = this.listeners[event];
- if (visitors) {
- if (this.visitSync(visitors, node.toProxy())) return;
- }
- }
- }
- } catch (err) {
- _iterator3.e(err);
- } finally {
- _iterator3.f();
- }
- }
- }, {
- key: "visitSync",
- value: function visitSync(visitors, node) {
- var _iterator4 = _createForOfIteratorHelper(visitors),
- _step4;
- try {
- for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {
- var _step4$value = _slicedToArray(_step4.value, 2),
- plugin = _step4$value[0],
- visitor = _step4$value[1];
- this.result.lastPlugin = plugin;
- var promise = void 0;
- try {
- promise = visitor(node, this.helpers);
- } catch (e) {
- throw this.handleError(e, node.proxyOf);
- }
- if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
- return true;
- }
- if (isPromise(promise)) {
- throw this.getAsyncError();
- }
- }
- } catch (err) {
- _iterator4.e(err);
- } finally {
- _iterator4.f();
- }
- }
- }, {
- key: "runOnRoot",
- value: function runOnRoot(plugin) {
- var _this3 = this;
- this.result.lastPlugin = plugin;
- try {
- if (_typeof(plugin) === 'object' && plugin.Once) {
- if (this.result.root.type === 'document') {
- var roots = this.result.root.nodes.map(function (root) {
- return plugin.Once(root, _this3.helpers);
- });
- if (isPromise(roots[0])) {
- return Promise.all(roots);
- }
- return roots;
- }
- return plugin.Once(this.result.root, this.helpers);
- } else if (typeof plugin === 'function') {
- return plugin(this.result.root, this.result);
- }
- } catch (error) {
- throw this.handleError(error);
- }
- }
- }, {
- key: "getAsyncError",
- value: function getAsyncError() {
- throw new Error('Use process(css).then(cb) to work with async plugins');
- }
- }, {
- key: "handleError",
- value: function handleError(error, node) {
- var plugin = this.result.lastPlugin;
- try {
- if (node) node.addToError(error);
- this.error = error;
- if (error.name === 'CssSyntaxError' && !error.plugin) {
- error.plugin = plugin.postcssPlugin;
- error.setMessage();
- } else if (plugin.postcssVersion) {
- if (false) { var b, a, runtimeVer, pluginVer, pluginName; }
- }
- } catch (err) {
- /* c8 ignore next 3 */
- // eslint-disable-next-line no-console
- if (console && console.error) console.error(err);
- }
- return error;
- }
- }, {
- key: "runAsync",
- value: function () {
- var _runAsync = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
- var _this4 = this;
- var i, plugin, promise, root, stack, _promise, node, _iterator5, _step5, _loop;
- return _regeneratorRuntime().wrap(function _callee$(_context2) {
- while (1) switch (_context2.prev = _context2.next) {
- case 0:
- this.plugin = 0;
- i = 0;
- case 2:
- if (!(i < this.plugins.length)) {
- _context2.next = 17;
- break;
- }
- plugin = this.plugins[i];
- promise = this.runOnRoot(plugin);
- if (!isPromise(promise)) {
- _context2.next = 14;
- break;
- }
- _context2.prev = 6;
- _context2.next = 9;
- return promise;
- case 9:
- _context2.next = 14;
- break;
- case 11:
- _context2.prev = 11;
- _context2.t0 = _context2["catch"](6);
- throw this.handleError(_context2.t0);
- case 14:
- i++;
- _context2.next = 2;
- break;
- case 17:
- this.prepareVisitors();
- if (!this.hasListener) {
- _context2.next = 56;
- break;
- }
- root = this.result.root;
- case 20:
- if (root[isClean]) {
- _context2.next = 39;
- break;
- }
- root[isClean] = true;
- stack = [toStack(root)];
- case 23:
- if (!(stack.length > 0)) {
- _context2.next = 37;
- break;
- }
- _promise = this.visitTick(stack);
- if (!isPromise(_promise)) {
- _context2.next = 35;
- break;
- }
- _context2.prev = 26;
- _context2.next = 29;
- return _promise;
- case 29:
- _context2.next = 35;
- break;
- case 31:
- _context2.prev = 31;
- _context2.t1 = _context2["catch"](26);
- node = stack[stack.length - 1].node;
- throw this.handleError(_context2.t1, node);
- case 35:
- _context2.next = 23;
- break;
- case 37:
- _context2.next = 20;
- break;
- case 39:
- if (!this.listeners.OnceExit) {
- _context2.next = 56;
- break;
- }
- _iterator5 = _createForOfIteratorHelper(this.listeners.OnceExit);
- _context2.prev = 41;
- _loop = /*#__PURE__*/_regeneratorRuntime().mark(function _loop() {
- var _step5$value, plugin, visitor, roots;
- return _regeneratorRuntime().wrap(function _loop$(_context) {
- while (1) switch (_context.prev = _context.next) {
- case 0:
- _step5$value = _slicedToArray(_step5.value, 2), plugin = _step5$value[0], visitor = _step5$value[1];
- _this4.result.lastPlugin = plugin;
- _context.prev = 2;
- if (!(root.type === 'document')) {
- _context.next = 9;
- break;
- }
- roots = root.nodes.map(function (subRoot) {
- return visitor(subRoot, _this4.helpers);
- });
- _context.next = 7;
- return Promise.all(roots);
- case 7:
- _context.next = 11;
- break;
- case 9:
- _context.next = 11;
- return visitor(root, _this4.helpers);
- case 11:
- _context.next = 16;
- break;
- case 13:
- _context.prev = 13;
- _context.t0 = _context["catch"](2);
- throw _this4.handleError(_context.t0);
- case 16:
- case "end":
- return _context.stop();
- }
- }, _loop, null, [[2, 13]]);
- });
- _iterator5.s();
- case 44:
- if ((_step5 = _iterator5.n()).done) {
- _context2.next = 48;
- break;
- }
- return _context2.delegateYield(_loop(), "t2", 46);
- case 46:
- _context2.next = 44;
- break;
- case 48:
- _context2.next = 53;
- break;
- case 50:
- _context2.prev = 50;
- _context2.t3 = _context2["catch"](41);
- _iterator5.e(_context2.t3);
- case 53:
- _context2.prev = 53;
- _iterator5.f();
- return _context2.finish(53);
- case 56:
- this.processed = true;
- return _context2.abrupt("return", this.stringify());
- case 58:
- case "end":
- return _context2.stop();
- }
- }, _callee, this, [[6, 11], [26, 31], [41, 50, 53, 56]]);
- }));
- function runAsync() {
- return _runAsync.apply(this, arguments);
- }
- return runAsync;
- }()
- }, {
- key: "prepareVisitors",
- value: function prepareVisitors() {
- var _this5 = this;
- this.listeners = {};
- var add = function add(plugin, type, cb) {
- if (!_this5.listeners[type]) _this5.listeners[type] = [];
- _this5.listeners[type].push([plugin, cb]);
- };
- var _iterator6 = _createForOfIteratorHelper(this.plugins),
- _step6;
- try {
- for (_iterator6.s(); !(_step6 = _iterator6.n()).done;) {
- var plugin = _step6.value;
- if (_typeof(plugin) === 'object') {
- for (var event in plugin) {
- if (!PLUGIN_PROPS[event] && /^[A-Z]/.test(event)) {
- throw new Error("Unknown event ".concat(event, " in ").concat(plugin.postcssPlugin, ". ") + "Try to update PostCSS (".concat(this.processor.version, " now)."));
- }
- if (!NOT_VISITORS[event]) {
- if (_typeof(plugin[event]) === 'object') {
- for (var filter in plugin[event]) {
- if (filter === '*') {
- add(plugin, event, plugin[event][filter]);
- } else {
- add(plugin, event + '-' + filter.toLowerCase(), plugin[event][filter]);
- }
- }
- } else if (typeof plugin[event] === 'function') {
- add(plugin, event, plugin[event]);
- }
- }
- }
- }
- }
- } catch (err) {
- _iterator6.e(err);
- } finally {
- _iterator6.f();
- }
- this.hasListener = Object.keys(this.listeners).length > 0;
- }
- }, {
- key: "visitTick",
- value: function visitTick(stack) {
- var visit = stack[stack.length - 1];
- var node = visit.node,
- visitors = visit.visitors;
- if (node.type !== 'root' && node.type !== 'document' && !node.parent) {
- stack.pop();
- return;
- }
- if (visitors.length > 0 && visit.visitorIndex < visitors.length) {
- var _visitors$visit$visit = _slicedToArray(visitors[visit.visitorIndex], 2),
- plugin = _visitors$visit$visit[0],
- visitor = _visitors$visit$visit[1];
- visit.visitorIndex += 1;
- if (visit.visitorIndex === visitors.length) {
- visit.visitors = [];
- visit.visitorIndex = 0;
- }
- this.result.lastPlugin = plugin;
- try {
- return visitor(node.toProxy(), this.helpers);
- } catch (e) {
- throw this.handleError(e, node);
- }
- }
- if (visit.iterator !== 0) {
- var iterator = visit.iterator;
- var child;
- while (child = node.nodes[node.indexes[iterator]]) {
- node.indexes[iterator] += 1;
- if (!child[isClean]) {
- child[isClean] = true;
- stack.push(toStack(child));
- return;
- }
- }
- visit.iterator = 0;
- delete node.indexes[iterator];
- }
- var events = visit.events;
- while (visit.eventIndex < events.length) {
- var event = events[visit.eventIndex];
- visit.eventIndex += 1;
- if (event === CHILDREN) {
- if (node.nodes && node.nodes.length) {
- node[isClean] = true;
- visit.iterator = node.getIterator();
- }
- return;
- } else if (this.listeners[event]) {
- visit.visitors = this.listeners[event];
- return;
- }
- }
- stack.pop();
- }
- }]);
- return LazyResult;
- }(Symbol.toStringTag);
- LazyResult.registerPostcss = function (dependant) {
- postcss = dependant;
- };
- module.exports = LazyResult;
- LazyResult["default"] = LazyResult;
- Root.registerLazyResult(LazyResult);
- Document.registerLazyResult(LazyResult);
- /***/ }),
- /***/ 6136:
- /***/ ((module) => {
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- var list = {
- split: function split(string, separators, last) {
- var array = [];
- var current = '';
- var split = false;
- var func = 0;
- var inQuote = false;
- var prevQuote = '';
- var escape = false;
- var _iterator = _createForOfIteratorHelper(string),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var letter = _step.value;
- if (escape) {
- escape = false;
- } else if (letter === '\\') {
- escape = true;
- } else if (inQuote) {
- if (letter === prevQuote) {
- inQuote = false;
- }
- } else if (letter === '"' || letter === "'") {
- inQuote = true;
- prevQuote = letter;
- } else if (letter === '(') {
- func += 1;
- } else if (letter === ')') {
- if (func > 0) func -= 1;
- } else if (func === 0) {
- if (separators.includes(letter)) split = true;
- }
- if (split) {
- if (current !== '') array.push(current.trim());
- current = '';
- split = false;
- } else {
- current += letter;
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- if (last || current !== '') array.push(current.trim());
- return array;
- },
- space: function space(string) {
- var spaces = [' ', '\n', '\t'];
- return list.split(string, spaces);
- },
- comma: function comma(string) {
- return list.split(string, [','], true);
- }
- };
- module.exports = list;
- list["default"] = list;
- /***/ }),
- /***/ 8991:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var _require = __webpack_require__(209),
- SourceMapConsumer = _require.SourceMapConsumer,
- SourceMapGenerator = _require.SourceMapGenerator;
- var _require2 = __webpack_require__(9830),
- dirname = _require2.dirname,
- resolve = _require2.resolve,
- relative = _require2.relative,
- sep = _require2.sep;
- var _require3 = __webpack_require__(7414),
- pathToFileURL = _require3.pathToFileURL;
- var Input = __webpack_require__(2993);
- var sourceMapAvailable = Boolean(SourceMapConsumer && SourceMapGenerator);
- var pathAvailable = Boolean(dirname && resolve && relative && sep);
- var MapGenerator = /*#__PURE__*/function () {
- function MapGenerator(stringify, root, opts, cssString) {
- _classCallCheck(this, MapGenerator);
- this.stringify = stringify;
- this.mapOpts = opts.map || {};
- this.root = root;
- this.opts = opts;
- this.css = cssString;
- this.usesFileUrls = !this.mapOpts.from && this.mapOpts.absolute;
- }
- _createClass(MapGenerator, [{
- key: "isMap",
- value: function isMap() {
- if (typeof this.opts.map !== 'undefined') {
- return !!this.opts.map;
- }
- return this.previous().length > 0;
- }
- }, {
- key: "previous",
- value: function previous() {
- var _this = this;
- if (!this.previousMaps) {
- this.previousMaps = [];
- if (this.root) {
- this.root.walk(function (node) {
- if (node.source && node.source.input.map) {
- var map = node.source.input.map;
- if (!_this.previousMaps.includes(map)) {
- _this.previousMaps.push(map);
- }
- }
- });
- } else {
- var input = new Input(this.css, this.opts);
- if (input.map) this.previousMaps.push(input.map);
- }
- }
- return this.previousMaps;
- }
- }, {
- key: "isInline",
- value: function isInline() {
- if (typeof this.mapOpts.inline !== 'undefined') {
- return this.mapOpts.inline;
- }
- var annotation = this.mapOpts.annotation;
- if (typeof annotation !== 'undefined' && annotation !== true) {
- return false;
- }
- if (this.previous().length) {
- return this.previous().some(function (i) {
- return i.inline;
- });
- }
- return true;
- }
- }, {
- key: "isSourcesContent",
- value: function isSourcesContent() {
- if (typeof this.mapOpts.sourcesContent !== 'undefined') {
- return this.mapOpts.sourcesContent;
- }
- if (this.previous().length) {
- return this.previous().some(function (i) {
- return i.withContent();
- });
- }
- return true;
- }
- }, {
- key: "clearAnnotation",
- value: function clearAnnotation() {
- if (this.mapOpts.annotation === false) return;
- if (this.root) {
- var node;
- for (var i = this.root.nodes.length - 1; i >= 0; i--) {
- node = this.root.nodes[i];
- if (node.type !== 'comment') continue;
- if (node.text.indexOf('# sourceMappingURL=') === 0) {
- this.root.removeChild(i);
- }
- }
- } else if (this.css) {
- this.css = this.css.replace(/(\n)?\/\*#[\S\s]*?\*\/$/gm, '');
- }
- }
- }, {
- key: "setSourcesContent",
- value: function setSourcesContent() {
- var _this2 = this;
- var already = {};
- if (this.root) {
- this.root.walk(function (node) {
- if (node.source) {
- var from = node.source.input.from;
- if (from && !already[from]) {
- already[from] = true;
- var fromUrl = _this2.usesFileUrls ? _this2.toFileUrl(from) : _this2.toUrl(_this2.path(from));
- _this2.map.setSourceContent(fromUrl, node.source.input.css);
- }
- }
- });
- } else if (this.css) {
- var from = this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>';
- this.map.setSourceContent(from, this.css);
- }
- }
- }, {
- key: "applyPrevMaps",
- value: function applyPrevMaps() {
- var _iterator = _createForOfIteratorHelper(this.previous()),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var prev = _step.value;
- var from = this.toUrl(this.path(prev.file));
- var root = prev.root || dirname(prev.file);
- var map = void 0;
- if (this.mapOpts.sourcesContent === false) {
- map = new SourceMapConsumer(prev.text);
- if (map.sourcesContent) {
- map.sourcesContent = map.sourcesContent.map(function () {
- return null;
- });
- }
- } else {
- map = prev.consumer();
- }
- this.map.applySourceMap(map, from, this.toUrl(this.path(root)));
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- }, {
- key: "isAnnotation",
- value: function isAnnotation() {
- if (this.isInline()) {
- return true;
- }
- if (typeof this.mapOpts.annotation !== 'undefined') {
- return this.mapOpts.annotation;
- }
- if (this.previous().length) {
- return this.previous().some(function (i) {
- return i.annotation;
- });
- }
- return true;
- }
- }, {
- key: "toBase64",
- value: function toBase64(str) {
- if (Buffer) {
- return Buffer.from(str).toString('base64');
- } else {
- return window.btoa(unescape(encodeURIComponent(str)));
- }
- }
- }, {
- key: "addAnnotation",
- value: function addAnnotation() {
- var content;
- if (this.isInline()) {
- content = 'data:application/json;base64,' + this.toBase64(this.map.toString());
- } else if (typeof this.mapOpts.annotation === 'string') {
- content = this.mapOpts.annotation;
- } else if (typeof this.mapOpts.annotation === 'function') {
- content = this.mapOpts.annotation(this.opts.to, this.root);
- } else {
- content = this.outputFile() + '.map';
- }
- var eol = '\n';
- if (this.css.includes('\r\n')) eol = '\r\n';
- this.css += eol + '/*# sourceMappingURL=' + content + ' */';
- }
- }, {
- key: "outputFile",
- value: function outputFile() {
- if (this.opts.to) {
- return this.path(this.opts.to);
- } else if (this.opts.from) {
- return this.path(this.opts.from);
- } else {
- return 'to.css';
- }
- }
- }, {
- key: "generateMap",
- value: function generateMap() {
- if (this.root) {
- this.generateString();
- } else if (this.previous().length === 1) {
- var prev = this.previous()[0].consumer();
- prev.file = this.outputFile();
- this.map = SourceMapGenerator.fromSourceMap(prev);
- } else {
- this.map = new SourceMapGenerator({
- file: this.outputFile()
- });
- this.map.addMapping({
- source: this.opts.from ? this.toUrl(this.path(this.opts.from)) : '<no source>',
- generated: {
- line: 1,
- column: 0
- },
- original: {
- line: 1,
- column: 0
- }
- });
- }
- if (this.isSourcesContent()) this.setSourcesContent();
- if (this.root && this.previous().length > 0) this.applyPrevMaps();
- if (this.isAnnotation()) this.addAnnotation();
- if (this.isInline()) {
- return [this.css];
- } else {
- return [this.css, this.map];
- }
- }
- }, {
- key: "path",
- value: function path(file) {
- if (file.indexOf('<') === 0) return file;
- if (/^\w+:\/\//.test(file)) return file;
- if (this.mapOpts.absolute) return file;
- var from = this.opts.to ? dirname(this.opts.to) : '.';
- if (typeof this.mapOpts.annotation === 'string') {
- from = dirname(resolve(from, this.mapOpts.annotation));
- }
- file = relative(from, file);
- return file;
- }
- }, {
- key: "toUrl",
- value: function toUrl(path) {
- if (sep === '\\') {
- path = path.replace(/\\/g, '/');
- }
- return encodeURI(path).replace(/[#?]/g, encodeURIComponent);
- }
- }, {
- key: "toFileUrl",
- value: function toFileUrl(path) {
- if (pathToFileURL) {
- return pathToFileURL(path).toString();
- } else {
- throw new Error('`map.absolute` option is not available in this PostCSS build');
- }
- }
- }, {
- key: "sourcePath",
- value: function sourcePath(node) {
- if (this.mapOpts.from) {
- return this.toUrl(this.mapOpts.from);
- } else if (this.usesFileUrls) {
- return this.toFileUrl(node.source.input.from);
- } else {
- return this.toUrl(this.path(node.source.input.from));
- }
- }
- }, {
- key: "generateString",
- value: function generateString() {
- var _this3 = this;
- this.css = '';
- this.map = new SourceMapGenerator({
- file: this.outputFile()
- });
- var line = 1;
- var column = 1;
- var noSource = '<no source>';
- var mapping = {
- source: '',
- generated: {
- line: 0,
- column: 0
- },
- original: {
- line: 0,
- column: 0
- }
- };
- var lines, last;
- this.stringify(this.root, function (str, node, type) {
- _this3.css += str;
- if (node && type !== 'end') {
- mapping.generated.line = line;
- mapping.generated.column = column - 1;
- if (node.source && node.source.start) {
- mapping.source = _this3.sourcePath(node);
- mapping.original.line = node.source.start.line;
- mapping.original.column = node.source.start.column - 1;
- _this3.map.addMapping(mapping);
- } else {
- mapping.source = noSource;
- mapping.original.line = 1;
- mapping.original.column = 0;
- _this3.map.addMapping(mapping);
- }
- }
- lines = str.match(/\n/g);
- if (lines) {
- line += lines.length;
- last = str.lastIndexOf('\n');
- column = str.length - last;
- } else {
- column += str.length;
- }
- if (node && type !== 'start') {
- var p = node.parent || {
- raws: {}
- };
- var childless = node.type === 'decl' || node.type === 'atrule' && !node.nodes;
- if (!childless || node !== p.last || p.raws.semicolon) {
- if (node.source && node.source.end) {
- mapping.source = _this3.sourcePath(node);
- mapping.original.line = node.source.end.line;
- mapping.original.column = node.source.end.column - 1;
- mapping.generated.line = line;
- mapping.generated.column = column - 2;
- _this3.map.addMapping(mapping);
- } else {
- mapping.source = noSource;
- mapping.original.line = 1;
- mapping.original.column = 0;
- mapping.generated.line = line;
- mapping.generated.column = column - 1;
- _this3.map.addMapping(mapping);
- }
- }
- }
- });
- }
- }, {
- key: "generate",
- value: function generate() {
- this.clearAnnotation();
- if (pathAvailable && sourceMapAvailable && this.isMap()) {
- return this.generateMap();
- } else {
- var result = '';
- this.stringify(this.root, function (i) {
- result += i;
- });
- return [result];
- }
- }
- }]);
- return MapGenerator;
- }();
- module.exports = MapGenerator;
- /***/ }),
- /***/ 7686:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var MapGenerator = __webpack_require__(8991);
- var stringify = __webpack_require__(6157);
- var warnOnce = __webpack_require__(6574);
- var parse = __webpack_require__(7057);
- var Result = __webpack_require__(6865);
- var NoWorkResult = /*#__PURE__*/function (_Symbol$toStringTag) {
- function NoWorkResult(processor, css, opts) {
- _classCallCheck(this, NoWorkResult);
- css = css.toString();
- this.stringified = false;
- this._processor = processor;
- this._css = css;
- this._opts = opts;
- this._map = undefined;
- var root;
- var str = stringify;
- this.result = new Result(this._processor, root, this._opts);
- this.result.css = css;
- var self = this;
- Object.defineProperty(this.result, 'root', {
- get: function get() {
- return self.root;
- }
- });
- var map = new MapGenerator(str, root, this._opts, css);
- if (map.isMap()) {
- var _map$generate = map.generate(),
- _map$generate2 = _slicedToArray(_map$generate, 2),
- generatedCSS = _map$generate2[0],
- generatedMap = _map$generate2[1];
- if (generatedCSS) {
- this.result.css = generatedCSS;
- }
- if (generatedMap) {
- this.result.map = generatedMap;
- }
- }
- }
- _createClass(NoWorkResult, [{
- key: _Symbol$toStringTag,
- get: function get() {
- return 'NoWorkResult';
- }
- }, {
- key: "processor",
- get: function get() {
- return this.result.processor;
- }
- }, {
- key: "opts",
- get: function get() {
- return this.result.opts;
- }
- }, {
- key: "css",
- get: function get() {
- return this.result.css;
- }
- }, {
- key: "content",
- get: function get() {
- return this.result.css;
- }
- }, {
- key: "map",
- get: function get() {
- return this.result.map;
- }
- }, {
- key: "root",
- get: function get() {
- if (this._root) {
- return this._root;
- }
- var root;
- var parser = parse;
- try {
- root = parser(this._css, this._opts);
- } catch (error) {
- this.error = error;
- }
- if (this.error) {
- throw this.error;
- } else {
- this._root = root;
- return root;
- }
- }
- }, {
- key: "messages",
- get: function get() {
- return [];
- }
- }, {
- key: "warnings",
- value: function warnings() {
- return [];
- }
- }, {
- key: "toString",
- value: function toString() {
- return this._css;
- }
- }, {
- key: "then",
- value: function then(onFulfilled, onRejected) {
- if (false) {}
- return this.async().then(onFulfilled, onRejected);
- }
- }, {
- key: "catch",
- value: function _catch(onRejected) {
- return this.async()["catch"](onRejected);
- }
- }, {
- key: "finally",
- value: function _finally(onFinally) {
- return this.async().then(onFinally, onFinally);
- }
- }, {
- key: "async",
- value: function async() {
- if (this.error) return Promise.reject(this.error);
- return Promise.resolve(this.result);
- }
- }, {
- key: "sync",
- value: function sync() {
- if (this.error) throw this.error;
- return this.result;
- }
- }]);
- return NoWorkResult;
- }(Symbol.toStringTag);
- module.exports = NoWorkResult;
- NoWorkResult["default"] = NoWorkResult;
- /***/ }),
- /***/ 4343:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- var _require = __webpack_require__(5506),
- isClean = _require.isClean,
- my = _require.my;
- var CssSyntaxError = __webpack_require__(1667);
- var Stringifier = __webpack_require__(5701);
- var stringify = __webpack_require__(6157);
- function cloneNode(obj, parent) {
- var cloned = new obj.constructor();
- for (var i in obj) {
- if (!Object.prototype.hasOwnProperty.call(obj, i)) {
- /* c8 ignore next 2 */
- continue;
- }
- if (i === 'proxyCache') continue;
- var value = obj[i];
- var type = _typeof(value);
- if (i === 'parent' && type === 'object') {
- if (parent) cloned[i] = parent;
- } else if (i === 'source') {
- cloned[i] = value;
- } else if (Array.isArray(value)) {
- cloned[i] = value.map(function (j) {
- return cloneNode(j, cloned);
- });
- } else {
- if (type === 'object' && value !== null) value = cloneNode(value);
- cloned[i] = value;
- }
- }
- return cloned;
- }
- var Node = /*#__PURE__*/function () {
- function Node() {
- var defaults = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- _classCallCheck(this, Node);
- this.raws = {};
- this[isClean] = false;
- this[my] = true;
- for (var name in defaults) {
- if (name === 'nodes') {
- this.nodes = [];
- var _iterator = _createForOfIteratorHelper(defaults[name]),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var node = _step.value;
- if (typeof node.clone === 'function') {
- this.append(node.clone());
- } else {
- this.append(node);
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- } else {
- this[name] = defaults[name];
- }
- }
- }
- _createClass(Node, [{
- key: "error",
- value: function error(message) {
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (this.source) {
- var _this$rangeBy = this.rangeBy(opts),
- start = _this$rangeBy.start,
- end = _this$rangeBy.end;
- return this.source.input.error(message, {
- line: start.line,
- column: start.column
- }, {
- line: end.line,
- column: end.column
- }, opts);
- }
- return new CssSyntaxError(message);
- }
- }, {
- key: "warn",
- value: function warn(result, text, opts) {
- var data = {
- node: this
- };
- for (var i in opts) data[i] = opts[i];
- return result.warn(text, data);
- }
- }, {
- key: "remove",
- value: function remove() {
- if (this.parent) {
- this.parent.removeChild(this);
- }
- this.parent = undefined;
- return this;
- }
- }, {
- key: "toString",
- value: function toString() {
- var stringifier = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : stringify;
- if (stringifier.stringify) stringifier = stringifier.stringify;
- var result = '';
- stringifier(this, function (i) {
- result += i;
- });
- return result;
- }
- }, {
- key: "assign",
- value: function assign() {
- var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- for (var name in overrides) {
- this[name] = overrides[name];
- }
- return this;
- }
- }, {
- key: "clone",
- value: function clone() {
- var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cloned = cloneNode(this);
- for (var name in overrides) {
- cloned[name] = overrides[name];
- }
- return cloned;
- }
- }, {
- key: "cloneBefore",
- value: function cloneBefore() {
- var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cloned = this.clone(overrides);
- this.parent.insertBefore(this, cloned);
- return cloned;
- }
- }, {
- key: "cloneAfter",
- value: function cloneAfter() {
- var overrides = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var cloned = this.clone(overrides);
- this.parent.insertAfter(this, cloned);
- return cloned;
- }
- }, {
- key: "replaceWith",
- value: function replaceWith() {
- if (this.parent) {
- var bookmark = this;
- var foundSelf = false;
- for (var _len = arguments.length, nodes = new Array(_len), _key = 0; _key < _len; _key++) {
- nodes[_key] = arguments[_key];
- }
- for (var _i = 0, _nodes = nodes; _i < _nodes.length; _i++) {
- var node = _nodes[_i];
- if (node === this) {
- foundSelf = true;
- } else if (foundSelf) {
- this.parent.insertAfter(bookmark, node);
- bookmark = node;
- } else {
- this.parent.insertBefore(bookmark, node);
- }
- }
- if (!foundSelf) {
- this.remove();
- }
- }
- return this;
- }
- }, {
- key: "next",
- value: function next() {
- if (!this.parent) return undefined;
- var index = this.parent.index(this);
- return this.parent.nodes[index + 1];
- }
- }, {
- key: "prev",
- value: function prev() {
- if (!this.parent) return undefined;
- var index = this.parent.index(this);
- return this.parent.nodes[index - 1];
- }
- }, {
- key: "before",
- value: function before(add) {
- this.parent.insertBefore(this, add);
- return this;
- }
- }, {
- key: "after",
- value: function after(add) {
- this.parent.insertAfter(this, add);
- return this;
- }
- }, {
- key: "root",
- value: function root() {
- var result = this;
- while (result.parent && result.parent.type !== 'document') {
- result = result.parent;
- }
- return result;
- }
- }, {
- key: "raw",
- value: function raw(prop, defaultType) {
- var str = new Stringifier();
- return str.raw(this, prop, defaultType);
- }
- }, {
- key: "cleanRaws",
- value: function cleanRaws(keepBetween) {
- delete this.raws.before;
- delete this.raws.after;
- if (!keepBetween) delete this.raws.between;
- }
- }, {
- key: "toJSON",
- value: function toJSON(_, inputs) {
- var fixed = {};
- var emitInputs = inputs == null;
- inputs = inputs || new Map();
- var inputsNextIndex = 0;
- for (var name in this) {
- if (!Object.prototype.hasOwnProperty.call(this, name)) {
- /* c8 ignore next 2 */
- continue;
- }
- if (name === 'parent' || name === 'proxyCache') continue;
- var value = this[name];
- if (Array.isArray(value)) {
- fixed[name] = value.map(function (i) {
- if (_typeof(i) === 'object' && i.toJSON) {
- return i.toJSON(null, inputs);
- } else {
- return i;
- }
- });
- } else if (_typeof(value) === 'object' && value.toJSON) {
- fixed[name] = value.toJSON(null, inputs);
- } else if (name === 'source') {
- var inputId = inputs.get(value.input);
- if (inputId == null) {
- inputId = inputsNextIndex;
- inputs.set(value.input, inputsNextIndex);
- inputsNextIndex++;
- }
- fixed[name] = {
- inputId: inputId,
- start: value.start,
- end: value.end
- };
- } else {
- fixed[name] = value;
- }
- }
- if (emitInputs) {
- fixed.inputs = _toConsumableArray(inputs.keys()).map(function (input) {
- return input.toJSON();
- });
- }
- return fixed;
- }
- }, {
- key: "positionInside",
- value: function positionInside(index) {
- var string = this.toString();
- var column = this.source.start.column;
- var line = this.source.start.line;
- for (var i = 0; i < index; i++) {
- if (string[i] === '\n') {
- column = 1;
- line += 1;
- } else {
- column += 1;
- }
- }
- return {
- line: line,
- column: column
- };
- }
- }, {
- key: "positionBy",
- value: function positionBy(opts) {
- var pos = this.source.start;
- if (opts.index) {
- pos = this.positionInside(opts.index);
- } else if (opts.word) {
- var index = this.toString().indexOf(opts.word);
- if (index !== -1) pos = this.positionInside(index);
- }
- return pos;
- }
- }, {
- key: "rangeBy",
- value: function rangeBy(opts) {
- var start = {
- line: this.source.start.line,
- column: this.source.start.column
- };
- var end = this.source.end ? {
- line: this.source.end.line,
- column: this.source.end.column + 1
- } : {
- line: start.line,
- column: start.column + 1
- };
- if (opts.word) {
- var index = this.toString().indexOf(opts.word);
- if (index !== -1) {
- start = this.positionInside(index);
- end = this.positionInside(index + opts.word.length);
- }
- } else {
- if (opts.start) {
- start = {
- line: opts.start.line,
- column: opts.start.column
- };
- } else if (opts.index) {
- start = this.positionInside(opts.index);
- }
- if (opts.end) {
- end = {
- line: opts.end.line,
- column: opts.end.column
- };
- } else if (opts.endIndex) {
- end = this.positionInside(opts.endIndex);
- } else if (opts.index) {
- end = this.positionInside(opts.index + 1);
- }
- }
- if (end.line < start.line || end.line === start.line && end.column <= start.column) {
- end = {
- line: start.line,
- column: start.column + 1
- };
- }
- return {
- start: start,
- end: end
- };
- }
- }, {
- key: "getProxyProcessor",
- value: function getProxyProcessor() {
- return {
- set: function set(node, prop, value) {
- if (node[prop] === value) return true;
- node[prop] = value;
- if (prop === 'prop' || prop === 'value' || prop === 'name' || prop === 'params' || prop === 'important' || /* c8 ignore next */
- prop === 'text') {
- node.markDirty();
- }
- return true;
- },
- get: function get(node, prop) {
- if (prop === 'proxyOf') {
- return node;
- } else if (prop === 'root') {
- return function () {
- return node.root().toProxy();
- };
- } else {
- return node[prop];
- }
- }
- };
- }
- }, {
- key: "toProxy",
- value: function toProxy() {
- if (!this.proxyCache) {
- this.proxyCache = new Proxy(this, this.getProxyProcessor());
- }
- return this.proxyCache;
- }
- }, {
- key: "addToError",
- value: function addToError(error) {
- error.postcssNode = this;
- if (error.stack && this.source && /\n\s{4}at /.test(error.stack)) {
- var s = this.source;
- error.stack = error.stack.replace(/\n\s{4}at /, "$&".concat(s.input.from, ":").concat(s.start.line, ":").concat(s.start.column, "$&"));
- }
- return error;
- }
- }, {
- key: "markDirty",
- value: function markDirty() {
- if (this[isClean]) {
- this[isClean] = false;
- var next = this;
- while (next = next.parent) {
- next[isClean] = false;
- }
- }
- }
- }, {
- key: "proxyOf",
- get: function get() {
- return this;
- }
- }]);
- return Node;
- }();
- module.exports = Node;
- Node["default"] = Node;
- /***/ }),
- /***/ 7057:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var Container = __webpack_require__(1204);
- var Parser = __webpack_require__(7116);
- var Input = __webpack_require__(2993);
- function parse(css, opts) {
- var input = new Input(css, opts);
- var parser = new Parser(input);
- try {
- parser.parse();
- } catch (e) {
- if (false) {}
- throw e;
- }
- return parser.root;
- }
- module.exports = parse;
- parse["default"] = parse;
- Container.registerParse(parse);
- /***/ }),
- /***/ 7116:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i["return"] && (_r = _i["return"](), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e2) { throw _e2; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e3) { didErr = true; err = _e3; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var Declaration = __webpack_require__(6417);
- var tokenizer = __webpack_require__(1157);
- var Comment = __webpack_require__(3102);
- var AtRule = __webpack_require__(8940);
- var Root = __webpack_require__(7563);
- var Rule = __webpack_require__(6621);
- var SAFE_COMMENT_NEIGHBOR = {
- empty: true,
- space: true
- };
- function findLastWithPosition(tokens) {
- for (var i = tokens.length - 1; i >= 0; i--) {
- var token = tokens[i];
- var pos = token[3] || token[2];
- if (pos) return pos;
- }
- }
- var Parser = /*#__PURE__*/function () {
- function Parser(input) {
- _classCallCheck(this, Parser);
- this.input = input;
- this.root = new Root();
- this.current = this.root;
- this.spaces = '';
- this.semicolon = false;
- this.customProperty = false;
- this.createTokenizer();
- this.root.source = {
- input: input,
- start: {
- offset: 0,
- line: 1,
- column: 1
- }
- };
- }
- _createClass(Parser, [{
- key: "createTokenizer",
- value: function createTokenizer() {
- this.tokenizer = tokenizer(this.input);
- }
- }, {
- key: "parse",
- value: function parse() {
- var token;
- while (!this.tokenizer.endOfFile()) {
- token = this.tokenizer.nextToken();
- switch (token[0]) {
- case 'space':
- this.spaces += token[1];
- break;
- case ';':
- this.freeSemicolon(token);
- break;
- case '}':
- this.end(token);
- break;
- case 'comment':
- this.comment(token);
- break;
- case 'at-word':
- this.atrule(token);
- break;
- case '{':
- this.emptyRule(token);
- break;
- default:
- this.other(token);
- break;
- }
- }
- this.endFile();
- }
- }, {
- key: "comment",
- value: function comment(token) {
- var node = new Comment();
- this.init(node, token[2]);
- node.source.end = this.getPosition(token[3] || token[2]);
- var text = token[1].slice(2, -2);
- if (/^\s*$/.test(text)) {
- node.text = '';
- node.raws.left = text;
- node.raws.right = '';
- } else {
- var match = text.match(/^(\s*)([^]*\S)(\s*)$/);
- node.text = match[2];
- node.raws.left = match[1];
- node.raws.right = match[3];
- }
- }
- }, {
- key: "emptyRule",
- value: function emptyRule(token) {
- var node = new Rule();
- this.init(node, token[2]);
- node.selector = '';
- node.raws.between = '';
- this.current = node;
- }
- }, {
- key: "other",
- value: function other(start) {
- var end = false;
- var type = null;
- var colon = false;
- var bracket = null;
- var brackets = [];
- var customProperty = start[1].startsWith('--');
- var tokens = [];
- var token = start;
- while (token) {
- type = token[0];
- tokens.push(token);
- if (type === '(' || type === '[') {
- if (!bracket) bracket = token;
- brackets.push(type === '(' ? ')' : ']');
- } else if (customProperty && colon && type === '{') {
- if (!bracket) bracket = token;
- brackets.push('}');
- } else if (brackets.length === 0) {
- if (type === ';') {
- if (colon) {
- this.decl(tokens, customProperty);
- return;
- } else {
- break;
- }
- } else if (type === '{') {
- this.rule(tokens);
- return;
- } else if (type === '}') {
- this.tokenizer.back(tokens.pop());
- end = true;
- break;
- } else if (type === ':') {
- colon = true;
- }
- } else if (type === brackets[brackets.length - 1]) {
- brackets.pop();
- if (brackets.length === 0) bracket = null;
- }
- token = this.tokenizer.nextToken();
- }
- if (this.tokenizer.endOfFile()) end = true;
- if (brackets.length > 0) this.unclosedBracket(bracket);
- if (end && colon) {
- if (!customProperty) {
- while (tokens.length) {
- token = tokens[tokens.length - 1][0];
- if (token !== 'space' && token !== 'comment') break;
- this.tokenizer.back(tokens.pop());
- }
- }
- this.decl(tokens, customProperty);
- } else {
- this.unknownWord(tokens);
- }
- }
- }, {
- key: "rule",
- value: function rule(tokens) {
- tokens.pop();
- var node = new Rule();
- this.init(node, tokens[0][2]);
- node.raws.between = this.spacesAndCommentsFromEnd(tokens);
- this.raw(node, 'selector', tokens);
- this.current = node;
- }
- }, {
- key: "decl",
- value: function decl(tokens, customProperty) {
- var node = new Declaration();
- this.init(node, tokens[0][2]);
- var last = tokens[tokens.length - 1];
- if (last[0] === ';') {
- this.semicolon = true;
- tokens.pop();
- }
- node.source.end = this.getPosition(last[3] || last[2] || findLastWithPosition(tokens));
- while (tokens[0][0] !== 'word') {
- if (tokens.length === 1) this.unknownWord(tokens);
- node.raws.before += tokens.shift()[1];
- }
- node.source.start = this.getPosition(tokens[0][2]);
- node.prop = '';
- while (tokens.length) {
- var type = tokens[0][0];
- if (type === ':' || type === 'space' || type === 'comment') {
- break;
- }
- node.prop += tokens.shift()[1];
- }
- node.raws.between = '';
- var token;
- while (tokens.length) {
- token = tokens.shift();
- if (token[0] === ':') {
- node.raws.between += token[1];
- break;
- } else {
- if (token[0] === 'word' && /\w/.test(token[1])) {
- this.unknownWord([token]);
- }
- node.raws.between += token[1];
- }
- }
- if (node.prop[0] === '_' || node.prop[0] === '*') {
- node.raws.before += node.prop[0];
- node.prop = node.prop.slice(1);
- }
- var firstSpaces = [];
- var next;
- while (tokens.length) {
- next = tokens[0][0];
- if (next !== 'space' && next !== 'comment') break;
- firstSpaces.push(tokens.shift());
- }
- this.precheckMissedSemicolon(tokens);
- for (var i = tokens.length - 1; i >= 0; i--) {
- token = tokens[i];
- if (token[1].toLowerCase() === '!important') {
- node.important = true;
- var string = this.stringFrom(tokens, i);
- string = this.spacesFromEnd(tokens) + string;
- if (string !== ' !important') node.raws.important = string;
- break;
- } else if (token[1].toLowerCase() === 'important') {
- var cache = tokens.slice(0);
- var str = '';
- for (var j = i; j > 0; j--) {
- var _type = cache[j][0];
- if (str.trim().indexOf('!') === 0 && _type !== 'space') {
- break;
- }
- str = cache.pop()[1] + str;
- }
- if (str.trim().indexOf('!') === 0) {
- node.important = true;
- node.raws.important = str;
- tokens = cache;
- }
- }
- if (token[0] !== 'space' && token[0] !== 'comment') {
- break;
- }
- }
- var hasWord = tokens.some(function (i) {
- return i[0] !== 'space' && i[0] !== 'comment';
- });
- if (hasWord) {
- node.raws.between += firstSpaces.map(function (i) {
- return i[1];
- }).join('');
- firstSpaces = [];
- }
- this.raw(node, 'value', firstSpaces.concat(tokens), customProperty);
- if (node.value.includes(':') && !customProperty) {
- this.checkMissedSemicolon(tokens);
- }
- }
- }, {
- key: "atrule",
- value: function atrule(token) {
- var node = new AtRule();
- node.name = token[1].slice(1);
- if (node.name === '') {
- this.unnamedAtrule(node, token);
- }
- this.init(node, token[2]);
- var type;
- var prev;
- var shift;
- var last = false;
- var open = false;
- var params = [];
- var brackets = [];
- while (!this.tokenizer.endOfFile()) {
- token = this.tokenizer.nextToken();
- type = token[0];
- if (type === '(' || type === '[') {
- brackets.push(type === '(' ? ')' : ']');
- } else if (type === '{' && brackets.length > 0) {
- brackets.push('}');
- } else if (type === brackets[brackets.length - 1]) {
- brackets.pop();
- }
- if (brackets.length === 0) {
- if (type === ';') {
- node.source.end = this.getPosition(token[2]);
- this.semicolon = true;
- break;
- } else if (type === '{') {
- open = true;
- break;
- } else if (type === '}') {
- if (params.length > 0) {
- shift = params.length - 1;
- prev = params[shift];
- while (prev && prev[0] === 'space') {
- prev = params[--shift];
- }
- if (prev) {
- node.source.end = this.getPosition(prev[3] || prev[2]);
- }
- }
- this.end(token);
- break;
- } else {
- params.push(token);
- }
- } else {
- params.push(token);
- }
- if (this.tokenizer.endOfFile()) {
- last = true;
- break;
- }
- }
- node.raws.between = this.spacesAndCommentsFromEnd(params);
- if (params.length) {
- node.raws.afterName = this.spacesAndCommentsFromStart(params);
- this.raw(node, 'params', params);
- if (last) {
- token = params[params.length - 1];
- node.source.end = this.getPosition(token[3] || token[2]);
- this.spaces = node.raws.between;
- node.raws.between = '';
- }
- } else {
- node.raws.afterName = '';
- node.params = '';
- }
- if (open) {
- node.nodes = [];
- this.current = node;
- }
- }
- }, {
- key: "end",
- value: function end(token) {
- if (this.current.nodes && this.current.nodes.length) {
- this.current.raws.semicolon = this.semicolon;
- }
- this.semicolon = false;
- this.current.raws.after = (this.current.raws.after || '') + this.spaces;
- this.spaces = '';
- if (this.current.parent) {
- this.current.source.end = this.getPosition(token[2]);
- this.current = this.current.parent;
- } else {
- this.unexpectedClose(token);
- }
- }
- }, {
- key: "endFile",
- value: function endFile() {
- if (this.current.parent) this.unclosedBlock();
- if (this.current.nodes && this.current.nodes.length) {
- this.current.raws.semicolon = this.semicolon;
- }
- this.current.raws.after = (this.current.raws.after || '') + this.spaces;
- }
- }, {
- key: "freeSemicolon",
- value: function freeSemicolon(token) {
- this.spaces += token[1];
- if (this.current.nodes) {
- var prev = this.current.nodes[this.current.nodes.length - 1];
- if (prev && prev.type === 'rule' && !prev.raws.ownSemicolon) {
- prev.raws.ownSemicolon = this.spaces;
- this.spaces = '';
- }
- }
- }
- // Helpers
- }, {
- key: "getPosition",
- value: function getPosition(offset) {
- var pos = this.input.fromOffset(offset);
- return {
- offset: offset,
- line: pos.line,
- column: pos.col
- };
- }
- }, {
- key: "init",
- value: function init(node, offset) {
- this.current.push(node);
- node.source = {
- start: this.getPosition(offset),
- input: this.input
- };
- node.raws.before = this.spaces;
- this.spaces = '';
- if (node.type !== 'comment') this.semicolon = false;
- }
- }, {
- key: "raw",
- value: function raw(node, prop, tokens, customProperty) {
- var token, type;
- var length = tokens.length;
- var value = '';
- var clean = true;
- var next, prev;
- for (var i = 0; i < length; i += 1) {
- token = tokens[i];
- type = token[0];
- if (type === 'space' && i === length - 1 && !customProperty) {
- clean = false;
- } else if (type === 'comment') {
- prev = tokens[i - 1] ? tokens[i - 1][0] : 'empty';
- next = tokens[i + 1] ? tokens[i + 1][0] : 'empty';
- if (!SAFE_COMMENT_NEIGHBOR[prev] && !SAFE_COMMENT_NEIGHBOR[next]) {
- if (value.slice(-1) === ',') {
- clean = false;
- } else {
- value += token[1];
- }
- } else {
- clean = false;
- }
- } else {
- value += token[1];
- }
- }
- if (!clean) {
- var raw = tokens.reduce(function (all, i) {
- return all + i[1];
- }, '');
- node.raws[prop] = {
- value: value,
- raw: raw
- };
- }
- node[prop] = value;
- }
- }, {
- key: "spacesAndCommentsFromEnd",
- value: function spacesAndCommentsFromEnd(tokens) {
- var lastTokenType;
- var spaces = '';
- while (tokens.length) {
- lastTokenType = tokens[tokens.length - 1][0];
- if (lastTokenType !== 'space' && lastTokenType !== 'comment') break;
- spaces = tokens.pop()[1] + spaces;
- }
- return spaces;
- }
- }, {
- key: "spacesAndCommentsFromStart",
- value: function spacesAndCommentsFromStart(tokens) {
- var next;
- var spaces = '';
- while (tokens.length) {
- next = tokens[0][0];
- if (next !== 'space' && next !== 'comment') break;
- spaces += tokens.shift()[1];
- }
- return spaces;
- }
- }, {
- key: "spacesFromEnd",
- value: function spacesFromEnd(tokens) {
- var lastTokenType;
- var spaces = '';
- while (tokens.length) {
- lastTokenType = tokens[tokens.length - 1][0];
- if (lastTokenType !== 'space') break;
- spaces = tokens.pop()[1] + spaces;
- }
- return spaces;
- }
- }, {
- key: "stringFrom",
- value: function stringFrom(tokens, from) {
- var result = '';
- for (var i = from; i < tokens.length; i++) {
- result += tokens[i][1];
- }
- tokens.splice(from, tokens.length - from);
- return result;
- }
- }, {
- key: "colon",
- value: function colon(tokens) {
- var brackets = 0;
- var token, type, prev;
- var _iterator = _createForOfIteratorHelper(tokens.entries()),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var _step$value = _slicedToArray(_step.value, 2),
- i = _step$value[0],
- element = _step$value[1];
- token = element;
- type = token[0];
- if (type === '(') {
- brackets += 1;
- }
- if (type === ')') {
- brackets -= 1;
- }
- if (brackets === 0 && type === ':') {
- if (!prev) {
- this.doubleColon(token);
- } else if (prev[0] === 'word' && prev[1] === 'progid') {
- continue;
- } else {
- return i;
- }
- }
- prev = token;
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- return false;
- }
- // Errors
- }, {
- key: "unclosedBracket",
- value: function unclosedBracket(bracket) {
- throw this.input.error('Unclosed bracket', {
- offset: bracket[2]
- }, {
- offset: bracket[2] + 1
- });
- }
- }, {
- key: "unknownWord",
- value: function unknownWord(tokens) {
- throw this.input.error('Unknown word', {
- offset: tokens[0][2]
- }, {
- offset: tokens[0][2] + tokens[0][1].length
- });
- }
- }, {
- key: "unexpectedClose",
- value: function unexpectedClose(token) {
- throw this.input.error('Unexpected }', {
- offset: token[2]
- }, {
- offset: token[2] + 1
- });
- }
- }, {
- key: "unclosedBlock",
- value: function unclosedBlock() {
- var pos = this.current.source.start;
- throw this.input.error('Unclosed block', pos.line, pos.column);
- }
- }, {
- key: "doubleColon",
- value: function doubleColon(token) {
- throw this.input.error('Double colon', {
- offset: token[2]
- }, {
- offset: token[2] + token[1].length
- });
- }
- }, {
- key: "unnamedAtrule",
- value: function unnamedAtrule(node, token) {
- throw this.input.error('At-rule without name', {
- offset: token[2]
- }, {
- offset: token[2] + token[1].length
- });
- }
- }, {
- key: "precheckMissedSemicolon",
- value: function precheckMissedSemicolon( /* tokens */
- ) {
- // Hook for Safe Parser
- }
- }, {
- key: "checkMissedSemicolon",
- value: function checkMissedSemicolon(tokens) {
- var colon = this.colon(tokens);
- if (colon === false) return;
- var founded = 0;
- var token;
- for (var j = colon - 1; j >= 0; j--) {
- token = tokens[j];
- if (token[0] !== 'space') {
- founded += 1;
- if (founded === 2) break;
- }
- }
- // If the token is a word, e.g. `!important`, `red` or any other valid property's value.
- // Then we need to return the colon after that word token. [3] is the "end" colon of that word.
- // And because we need it after that one we do +1 to get the next one.
- throw this.input.error('Missed semicolon', token[0] === 'word' ? token[3] + 1 : token[2]);
- }
- }]);
- return Parser;
- }();
- module.exports = Parser;
- /***/ }),
- /***/ 7866:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var CssSyntaxError = __webpack_require__(1667);
- var Declaration = __webpack_require__(6417);
- var LazyResult = __webpack_require__(6992);
- var Container = __webpack_require__(1204);
- var Processor = __webpack_require__(9429);
- var stringify = __webpack_require__(6157);
- var fromJSON = __webpack_require__(9295);
- var Document = __webpack_require__(7083);
- var Warning = __webpack_require__(1662);
- var Comment = __webpack_require__(3102);
- var AtRule = __webpack_require__(8940);
- var Result = __webpack_require__(6865);
- var Input = __webpack_require__(2993);
- var parse = __webpack_require__(7057);
- var list = __webpack_require__(6136);
- var Rule = __webpack_require__(6621);
- var Root = __webpack_require__(7563);
- var Node = __webpack_require__(4343);
- function postcss() {
- for (var _len = arguments.length, plugins = new Array(_len), _key = 0; _key < _len; _key++) {
- plugins[_key] = arguments[_key];
- }
- if (plugins.length === 1 && Array.isArray(plugins[0])) {
- plugins = plugins[0];
- }
- return new Processor(plugins);
- }
- postcss.plugin = function plugin(name, initializer) {
- var warningPrinted = false;
- function creator() {
- // eslint-disable-next-line no-console
- if (console && console.warn && !warningPrinted) {
- warningPrinted = true;
- // eslint-disable-next-line no-console
- console.warn(name + ': postcss.plugin was deprecated. Migration guide:\n' + 'https://evilmartians.com/chronicles/postcss-8-plugin-migration');
- if (process.env.LANG && process.env.LANG.startsWith('cn')) {
- /* c8 ignore next 7 */
- // eslint-disable-next-line no-console
- console.warn(name + ': 里面 postcss.plugin 被弃用. 迁移指南:\n' + 'https://www.w3ctech.com/topic/2226');
- }
- }
- var transformer = initializer.apply(void 0, arguments);
- transformer.postcssPlugin = name;
- transformer.postcssVersion = new Processor().version;
- return transformer;
- }
- var cache;
- Object.defineProperty(creator, 'postcss', {
- get: function get() {
- if (!cache) cache = creator();
- return cache;
- }
- });
- creator.process = function (css, processOpts, pluginOpts) {
- return postcss([creator(pluginOpts)]).process(css, processOpts);
- };
- return creator;
- };
- postcss.stringify = stringify;
- postcss.parse = parse;
- postcss.fromJSON = fromJSON;
- postcss.list = list;
- postcss.comment = function (defaults) {
- return new Comment(defaults);
- };
- postcss.atRule = function (defaults) {
- return new AtRule(defaults);
- };
- postcss.decl = function (defaults) {
- return new Declaration(defaults);
- };
- postcss.rule = function (defaults) {
- return new Rule(defaults);
- };
- postcss.root = function (defaults) {
- return new Root(defaults);
- };
- postcss.document = function (defaults) {
- return new Document(defaults);
- };
- postcss.CssSyntaxError = CssSyntaxError;
- postcss.Declaration = Declaration;
- postcss.Container = Container;
- postcss.Processor = Processor;
- postcss.Document = Document;
- postcss.Comment = Comment;
- postcss.Warning = Warning;
- postcss.AtRule = AtRule;
- postcss.Result = Result;
- postcss.Input = Input;
- postcss.Rule = Rule;
- postcss.Root = Root;
- postcss.Node = Node;
- LazyResult.registerPostcss(postcss);
- module.exports = postcss;
- postcss["default"] = postcss;
- /***/ }),
- /***/ 3353:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var _require = __webpack_require__(209),
- SourceMapConsumer = _require.SourceMapConsumer,
- SourceMapGenerator = _require.SourceMapGenerator;
- var _require2 = __webpack_require__(4777),
- existsSync = _require2.existsSync,
- readFileSync = _require2.readFileSync;
- var _require3 = __webpack_require__(9830),
- dirname = _require3.dirname,
- join = _require3.join;
- function fromBase64(str) {
- if (Buffer) {
- return Buffer.from(str, 'base64').toString();
- } else {
- /* c8 ignore next 2 */
- return window.atob(str);
- }
- }
- var PreviousMap = /*#__PURE__*/function () {
- function PreviousMap(css, opts) {
- _classCallCheck(this, PreviousMap);
- if (opts.map === false) return;
- this.loadAnnotation(css);
- this.inline = this.startWith(this.annotation, 'data:');
- var prev = opts.map ? opts.map.prev : undefined;
- var text = this.loadMap(opts.from, prev);
- if (!this.mapFile && opts.from) {
- this.mapFile = opts.from;
- }
- if (this.mapFile) this.root = dirname(this.mapFile);
- if (text) this.text = text;
- }
- _createClass(PreviousMap, [{
- key: "consumer",
- value: function consumer() {
- if (!this.consumerCache) {
- this.consumerCache = new SourceMapConsumer(this.text);
- }
- return this.consumerCache;
- }
- }, {
- key: "withContent",
- value: function withContent() {
- return !!(this.consumer().sourcesContent && this.consumer().sourcesContent.length > 0);
- }
- }, {
- key: "startWith",
- value: function startWith(string, start) {
- if (!string) return false;
- return string.substr(0, start.length) === start;
- }
- }, {
- key: "getAnnotationURL",
- value: function getAnnotationURL(sourceMapString) {
- return sourceMapString.replace(/^\/\*\s*# sourceMappingURL=/, '').trim();
- }
- }, {
- key: "loadAnnotation",
- value: function loadAnnotation(css) {
- var comments = css.match(/\/\*\s*# sourceMappingURL=/gm);
- if (!comments) return;
- // sourceMappingURLs from comments, strings, etc.
- var start = css.lastIndexOf(comments.pop());
- var end = css.indexOf('*/', start);
- if (start > -1 && end > -1) {
- // Locate the last sourceMappingURL to avoid pickin
- this.annotation = this.getAnnotationURL(css.substring(start, end));
- }
- }
- }, {
- key: "decodeInline",
- value: function decodeInline(text) {
- var baseCharsetUri = /^data:application\/json;charset=utf-?8;base64,/;
- var baseUri = /^data:application\/json;base64,/;
- var charsetUri = /^data:application\/json;charset=utf-?8,/;
- var uri = /^data:application\/json,/;
- if (charsetUri.test(text) || uri.test(text)) {
- return decodeURIComponent(text.substr(RegExp.lastMatch.length));
- }
- if (baseCharsetUri.test(text) || baseUri.test(text)) {
- return fromBase64(text.substr(RegExp.lastMatch.length));
- }
- var encoding = text.match(/data:application\/json;([^,]+),/)[1];
- throw new Error('Unsupported source map encoding ' + encoding);
- }
- }, {
- key: "loadFile",
- value: function loadFile(path) {
- this.root = dirname(path);
- if (existsSync(path)) {
- this.mapFile = path;
- return readFileSync(path, 'utf-8').toString().trim();
- }
- }
- }, {
- key: "loadMap",
- value: function loadMap(file, prev) {
- if (prev === false) return false;
- if (prev) {
- if (typeof prev === 'string') {
- return prev;
- } else if (typeof prev === 'function') {
- var prevPath = prev(file);
- if (prevPath) {
- var map = this.loadFile(prevPath);
- if (!map) {
- throw new Error('Unable to load previous source map: ' + prevPath.toString());
- }
- return map;
- }
- } else if (prev instanceof SourceMapConsumer) {
- return SourceMapGenerator.fromSourceMap(prev).toString();
- } else if (prev instanceof SourceMapGenerator) {
- return prev.toString();
- } else if (this.isMap(prev)) {
- return JSON.stringify(prev);
- } else {
- throw new Error('Unsupported previous source map format: ' + prev.toString());
- }
- } else if (this.inline) {
- return this.decodeInline(this.annotation);
- } else if (this.annotation) {
- var _map = this.annotation;
- if (file) _map = join(dirname(file), _map);
- return this.loadFile(_map);
- }
- }
- }, {
- key: "isMap",
- value: function isMap(map) {
- if (_typeof(map) !== 'object') return false;
- return typeof map.mappings === 'string' || typeof map._mappings === 'string' || Array.isArray(map.sections);
- }
- }]);
- return PreviousMap;
- }();
- module.exports = PreviousMap;
- PreviousMap["default"] = PreviousMap;
- /***/ }),
- /***/ 9429:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var NoWorkResult = __webpack_require__(7686);
- var LazyResult = __webpack_require__(6992);
- var Document = __webpack_require__(7083);
- var Root = __webpack_require__(7563);
- var Processor = /*#__PURE__*/function () {
- function Processor() {
- var plugins = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
- _classCallCheck(this, Processor);
- this.version = '8.4.23';
- this.plugins = this.normalize(plugins);
- }
- _createClass(Processor, [{
- key: "use",
- value: function use(plugin) {
- this.plugins = this.plugins.concat(this.normalize([plugin]));
- return this;
- }
- }, {
- key: "process",
- value: function process(css) {
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (this.plugins.length === 0 && typeof opts.parser === 'undefined' && typeof opts.stringifier === 'undefined' && typeof opts.syntax === 'undefined') {
- return new NoWorkResult(this, css, opts);
- } else {
- return new LazyResult(this, css, opts);
- }
- }
- }, {
- key: "normalize",
- value: function normalize(plugins) {
- var normalized = [];
- var _iterator = _createForOfIteratorHelper(plugins),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var i = _step.value;
- if (i.postcss === true) {
- i = i();
- } else if (i.postcss) {
- i = i.postcss;
- }
- if (_typeof(i) === 'object' && Array.isArray(i.plugins)) {
- normalized = normalized.concat(i.plugins);
- } else if (_typeof(i) === 'object' && i.postcssPlugin) {
- normalized.push(i);
- } else if (typeof i === 'function') {
- normalized.push(i);
- } else if (_typeof(i) === 'object' && (i.parse || i.stringify)) {
- if (false) {}
- } else {
- throw new Error(i + ' is not a PostCSS plugin');
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- return normalized;
- }
- }]);
- return Processor;
- }();
- module.exports = Processor;
- Processor["default"] = Processor;
- Root.registerProcessor(Processor);
- Document.registerProcessor(Processor);
- /***/ }),
- /***/ 6865:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var Warning = __webpack_require__(1662);
- var Result = /*#__PURE__*/function () {
- function Result(processor, root, opts) {
- _classCallCheck(this, Result);
- this.processor = processor;
- this.messages = [];
- this.root = root;
- this.opts = opts;
- this.css = undefined;
- this.map = undefined;
- }
- _createClass(Result, [{
- key: "toString",
- value: function toString() {
- return this.css;
- }
- }, {
- key: "warn",
- value: function warn(text) {
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- if (!opts.plugin) {
- if (this.lastPlugin && this.lastPlugin.postcssPlugin) {
- opts.plugin = this.lastPlugin.postcssPlugin;
- }
- }
- var warning = new Warning(text, opts);
- this.messages.push(warning);
- return warning;
- }
- }, {
- key: "warnings",
- value: function warnings() {
- return this.messages.filter(function (i) {
- return i.type === 'warning';
- });
- }
- }, {
- key: "content",
- get: function get() {
- return this.css;
- }
- }]);
- return Result;
- }();
- module.exports = Result;
- Result["default"] = Result;
- /***/ }),
- /***/ 7563:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
- function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var Container = __webpack_require__(1204);
- var LazyResult, Processor;
- var Root = /*#__PURE__*/function (_Container) {
- _inherits(Root, _Container);
- var _super = _createSuper(Root);
- function Root(defaults) {
- var _this;
- _classCallCheck(this, Root);
- _this = _super.call(this, defaults);
- _this.type = 'root';
- if (!_this.nodes) _this.nodes = [];
- return _this;
- }
- _createClass(Root, [{
- key: "removeChild",
- value: function removeChild(child, ignore) {
- var index = this.index(child);
- if (!ignore && index === 0 && this.nodes.length > 1) {
- this.nodes[1].raws.before = this.nodes[index].raws.before;
- }
- return _get(_getPrototypeOf(Root.prototype), "removeChild", this).call(this, child);
- }
- }, {
- key: "normalize",
- value: function normalize(child, sample, type) {
- var nodes = _get(_getPrototypeOf(Root.prototype), "normalize", this).call(this, child);
- if (sample) {
- if (type === 'prepend') {
- if (this.nodes.length > 1) {
- sample.raws.before = this.nodes[1].raws.before;
- } else {
- delete sample.raws.before;
- }
- } else if (this.first !== sample) {
- var _iterator = _createForOfIteratorHelper(nodes),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var node = _step.value;
- node.raws.before = sample.raws.before;
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- }
- return nodes;
- }
- }, {
- key: "toResult",
- value: function toResult() {
- var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
- var lazy = new LazyResult(new Processor(), this, opts);
- return lazy.stringify();
- }
- }]);
- return Root;
- }(Container);
- Root.registerLazyResult = function (dependant) {
- LazyResult = dependant;
- };
- Root.registerProcessor = function (dependant) {
- Processor = dependant;
- };
- module.exports = Root;
- Root["default"] = Root;
- Container.registerRoot(Root);
- /***/ }),
- /***/ 6621:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
- function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
- function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
- function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
- function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
- function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
- function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
- var Container = __webpack_require__(1204);
- var list = __webpack_require__(6136);
- var Rule = /*#__PURE__*/function (_Container) {
- _inherits(Rule, _Container);
- var _super = _createSuper(Rule);
- function Rule(defaults) {
- var _this;
- _classCallCheck(this, Rule);
- _this = _super.call(this, defaults);
- _this.type = 'rule';
- if (!_this.nodes) _this.nodes = [];
- return _this;
- }
- _createClass(Rule, [{
- key: "selectors",
- get: function get() {
- return list.comma(this.selector);
- },
- set: function set(values) {
- var match = this.selector ? this.selector.match(/,\s*/) : null;
- var sep = match ? match[0] : ',' + this.raw('between', 'beforeOpen');
- this.selector = values.join(sep);
- }
- }]);
- return Rule;
- }(Container);
- module.exports = Rule;
- Rule["default"] = Rule;
- Container.registerRule(Rule);
- /***/ }),
- /***/ 5701:
- /***/ ((module) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var DEFAULT_RAW = {
- colon: ': ',
- indent: ' ',
- beforeDecl: '\n',
- beforeRule: '\n',
- beforeOpen: ' ',
- beforeClose: '\n',
- beforeComment: '\n',
- after: '\n',
- emptyBody: '',
- commentLeft: ' ',
- commentRight: ' ',
- semicolon: false
- };
- function capitalize(str) {
- return str[0].toUpperCase() + str.slice(1);
- }
- var Stringifier = /*#__PURE__*/function () {
- function Stringifier(builder) {
- _classCallCheck(this, Stringifier);
- this.builder = builder;
- }
- _createClass(Stringifier, [{
- key: "stringify",
- value: function stringify(node, semicolon) {
- /* c8 ignore start */
- if (!this[node.type]) {
- throw new Error('Unknown AST node type ' + node.type + '. ' + 'Maybe you need to change PostCSS stringifier.');
- }
- /* c8 ignore stop */
- this[node.type](node, semicolon);
- }
- }, {
- key: "document",
- value: function document(node) {
- this.body(node);
- }
- }, {
- key: "root",
- value: function root(node) {
- this.body(node);
- if (node.raws.after) this.builder(node.raws.after);
- }
- }, {
- key: "comment",
- value: function comment(node) {
- var left = this.raw(node, 'left', 'commentLeft');
- var right = this.raw(node, 'right', 'commentRight');
- this.builder('/*' + left + node.text + right + '*/', node);
- }
- }, {
- key: "decl",
- value: function decl(node, semicolon) {
- var between = this.raw(node, 'between', 'colon');
- var string = node.prop + between + this.rawValue(node, 'value');
- if (node.important) {
- string += node.raws.important || ' !important';
- }
- if (semicolon) string += ';';
- this.builder(string, node);
- }
- }, {
- key: "rule",
- value: function rule(node) {
- this.block(node, this.rawValue(node, 'selector'));
- if (node.raws.ownSemicolon) {
- this.builder(node.raws.ownSemicolon, node, 'end');
- }
- }
- }, {
- key: "atrule",
- value: function atrule(node, semicolon) {
- var name = '@' + node.name;
- var params = node.params ? this.rawValue(node, 'params') : '';
- if (typeof node.raws.afterName !== 'undefined') {
- name += node.raws.afterName;
- } else if (params) {
- name += ' ';
- }
- if (node.nodes) {
- this.block(node, name + params);
- } else {
- var end = (node.raws.between || '') + (semicolon ? ';' : '');
- this.builder(name + params + end, node);
- }
- }
- }, {
- key: "body",
- value: function body(node) {
- var last = node.nodes.length - 1;
- while (last > 0) {
- if (node.nodes[last].type !== 'comment') break;
- last -= 1;
- }
- var semicolon = this.raw(node, 'semicolon');
- for (var i = 0; i < node.nodes.length; i++) {
- var child = node.nodes[i];
- var before = this.raw(child, 'before');
- if (before) this.builder(before);
- this.stringify(child, last !== i || semicolon);
- }
- }
- }, {
- key: "block",
- value: function block(node, start) {
- var between = this.raw(node, 'between', 'beforeOpen');
- this.builder(start + between + '{', node, 'start');
- var after;
- if (node.nodes && node.nodes.length) {
- this.body(node);
- after = this.raw(node, 'after');
- } else {
- after = this.raw(node, 'after', 'emptyBody');
- }
- if (after) this.builder(after);
- this.builder('}', node, 'end');
- }
- }, {
- key: "raw",
- value: function raw(node, own, detect) {
- var value;
- if (!detect) detect = own;
- // Already had
- if (own) {
- value = node.raws[own];
- if (typeof value !== 'undefined') return value;
- }
- var parent = node.parent;
- if (detect === 'before') {
- // Hack for first rule in CSS
- if (!parent || parent.type === 'root' && parent.first === node) {
- return '';
- }
- // `root` nodes in `document` should use only their own raws
- if (parent && parent.type === 'document') {
- return '';
- }
- }
- // Floating child without parent
- if (!parent) return DEFAULT_RAW[detect];
- // Detect style by other nodes
- var root = node.root();
- if (!root.rawCache) root.rawCache = {};
- if (typeof root.rawCache[detect] !== 'undefined') {
- return root.rawCache[detect];
- }
- if (detect === 'before' || detect === 'after') {
- return this.beforeAfter(node, detect);
- } else {
- var method = 'raw' + capitalize(detect);
- if (this[method]) {
- value = this[method](root, node);
- } else {
- root.walk(function (i) {
- value = i.raws[own];
- if (typeof value !== 'undefined') return false;
- });
- }
- }
- if (typeof value === 'undefined') value = DEFAULT_RAW[detect];
- root.rawCache[detect] = value;
- return value;
- }
- }, {
- key: "rawSemicolon",
- value: function rawSemicolon(root) {
- var value;
- root.walk(function (i) {
- if (i.nodes && i.nodes.length && i.last.type === 'decl') {
- value = i.raws.semicolon;
- if (typeof value !== 'undefined') return false;
- }
- });
- return value;
- }
- }, {
- key: "rawEmptyBody",
- value: function rawEmptyBody(root) {
- var value;
- root.walk(function (i) {
- if (i.nodes && i.nodes.length === 0) {
- value = i.raws.after;
- if (typeof value !== 'undefined') return false;
- }
- });
- return value;
- }
- }, {
- key: "rawIndent",
- value: function rawIndent(root) {
- if (root.raws.indent) return root.raws.indent;
- var value;
- root.walk(function (i) {
- var p = i.parent;
- if (p && p !== root && p.parent && p.parent === root) {
- if (typeof i.raws.before !== 'undefined') {
- var parts = i.raws.before.split('\n');
- value = parts[parts.length - 1];
- value = value.replace(/\S/g, '');
- return false;
- }
- }
- });
- return value;
- }
- }, {
- key: "rawBeforeComment",
- value: function rawBeforeComment(root, node) {
- var value;
- root.walkComments(function (i) {
- if (typeof i.raws.before !== 'undefined') {
- value = i.raws.before;
- if (value.includes('\n')) {
- value = value.replace(/[^\n]+$/, '');
- }
- return false;
- }
- });
- if (typeof value === 'undefined') {
- value = this.raw(node, null, 'beforeDecl');
- } else if (value) {
- value = value.replace(/\S/g, '');
- }
- return value;
- }
- }, {
- key: "rawBeforeDecl",
- value: function rawBeforeDecl(root, node) {
- var value;
- root.walkDecls(function (i) {
- if (typeof i.raws.before !== 'undefined') {
- value = i.raws.before;
- if (value.includes('\n')) {
- value = value.replace(/[^\n]+$/, '');
- }
- return false;
- }
- });
- if (typeof value === 'undefined') {
- value = this.raw(node, null, 'beforeRule');
- } else if (value) {
- value = value.replace(/\S/g, '');
- }
- return value;
- }
- }, {
- key: "rawBeforeRule",
- value: function rawBeforeRule(root) {
- var value;
- root.walk(function (i) {
- if (i.nodes && (i.parent !== root || root.first !== i)) {
- if (typeof i.raws.before !== 'undefined') {
- value = i.raws.before;
- if (value.includes('\n')) {
- value = value.replace(/[^\n]+$/, '');
- }
- return false;
- }
- }
- });
- if (value) value = value.replace(/\S/g, '');
- return value;
- }
- }, {
- key: "rawBeforeClose",
- value: function rawBeforeClose(root) {
- var value;
- root.walk(function (i) {
- if (i.nodes && i.nodes.length > 0) {
- if (typeof i.raws.after !== 'undefined') {
- value = i.raws.after;
- if (value.includes('\n')) {
- value = value.replace(/[^\n]+$/, '');
- }
- return false;
- }
- }
- });
- if (value) value = value.replace(/\S/g, '');
- return value;
- }
- }, {
- key: "rawBeforeOpen",
- value: function rawBeforeOpen(root) {
- var value;
- root.walk(function (i) {
- if (i.type !== 'decl') {
- value = i.raws.between;
- if (typeof value !== 'undefined') return false;
- }
- });
- return value;
- }
- }, {
- key: "rawColon",
- value: function rawColon(root) {
- var value;
- root.walkDecls(function (i) {
- if (typeof i.raws.between !== 'undefined') {
- value = i.raws.between.replace(/[^\s:]/g, '');
- return false;
- }
- });
- return value;
- }
- }, {
- key: "beforeAfter",
- value: function beforeAfter(node, detect) {
- var value;
- if (node.type === 'decl') {
- value = this.raw(node, null, 'beforeDecl');
- } else if (node.type === 'comment') {
- value = this.raw(node, null, 'beforeComment');
- } else if (detect === 'before') {
- value = this.raw(node, null, 'beforeRule');
- } else {
- value = this.raw(node, null, 'beforeClose');
- }
- var buf = node.parent;
- var depth = 0;
- while (buf && buf.type !== 'root') {
- depth += 1;
- buf = buf.parent;
- }
- if (value.includes('\n')) {
- var indent = this.raw(node, null, 'indent');
- if (indent.length) {
- for (var step = 0; step < depth; step++) value += indent;
- }
- }
- return value;
- }
- }, {
- key: "rawValue",
- value: function rawValue(node, prop) {
- var value = node[prop];
- var raw = node.raws[prop];
- if (raw && raw.value === value) {
- return raw.raw;
- }
- return value;
- }
- }]);
- return Stringifier;
- }();
- module.exports = Stringifier;
- Stringifier["default"] = Stringifier;
- /***/ }),
- /***/ 6157:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- var Stringifier = __webpack_require__(5701);
- function stringify(node, builder) {
- var str = new Stringifier(builder);
- str.stringify(node);
- }
- module.exports = stringify;
- stringify["default"] = stringify;
- /***/ }),
- /***/ 5506:
- /***/ ((module) => {
- module.exports.isClean = Symbol('isClean');
- module.exports.my = Symbol('my');
- /***/ }),
- /***/ 1157:
- /***/ ((module) => {
- var SINGLE_QUOTE = "'".charCodeAt(0);
- var DOUBLE_QUOTE = '"'.charCodeAt(0);
- var BACKSLASH = '\\'.charCodeAt(0);
- var SLASH = '/'.charCodeAt(0);
- var NEWLINE = '\n'.charCodeAt(0);
- var SPACE = ' '.charCodeAt(0);
- var FEED = '\f'.charCodeAt(0);
- var TAB = '\t'.charCodeAt(0);
- var CR = '\r'.charCodeAt(0);
- var OPEN_SQUARE = '['.charCodeAt(0);
- var CLOSE_SQUARE = ']'.charCodeAt(0);
- var OPEN_PARENTHESES = '('.charCodeAt(0);
- var CLOSE_PARENTHESES = ')'.charCodeAt(0);
- var OPEN_CURLY = '{'.charCodeAt(0);
- var CLOSE_CURLY = '}'.charCodeAt(0);
- var SEMICOLON = ';'.charCodeAt(0);
- var ASTERISK = '*'.charCodeAt(0);
- var COLON = ':'.charCodeAt(0);
- var AT = '@'.charCodeAt(0);
- var RE_AT_END = /[\t\n\f\r "#'()/;[\\\]{}]/g;
- var RE_WORD_END = /[\t\n\f\r !"#'():;@[\\\]{}]|\/(?=\*)/g;
- var RE_BAD_BRACKET = /.[\n"'(/\\]/;
- var RE_HEX_ESCAPE = /[\da-f]/i;
- module.exports = function tokenizer(input) {
- var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- var css = input.css.valueOf();
- var ignore = options.ignoreErrors;
- var code, next, quote, content, escape;
- var escaped, escapePos, prev, n, currentToken;
- var length = css.length;
- var pos = 0;
- var buffer = [];
- var returned = [];
- function position() {
- return pos;
- }
- function unclosed(what) {
- throw input.error('Unclosed ' + what, pos);
- }
- function endOfFile() {
- return returned.length === 0 && pos >= length;
- }
- function nextToken(opts) {
- if (returned.length) return returned.pop();
- if (pos >= length) return;
- var ignoreUnclosed = opts ? opts.ignoreUnclosed : false;
- code = css.charCodeAt(pos);
- switch (code) {
- case NEWLINE:
- case SPACE:
- case TAB:
- case CR:
- case FEED:
- {
- next = pos;
- do {
- next += 1;
- code = css.charCodeAt(next);
- } while (code === SPACE || code === NEWLINE || code === TAB || code === CR || code === FEED);
- currentToken = ['space', css.slice(pos, next)];
- pos = next - 1;
- break;
- }
- case OPEN_SQUARE:
- case CLOSE_SQUARE:
- case OPEN_CURLY:
- case CLOSE_CURLY:
- case COLON:
- case SEMICOLON:
- case CLOSE_PARENTHESES:
- {
- var controlChar = String.fromCharCode(code);
- currentToken = [controlChar, controlChar, pos];
- break;
- }
- case OPEN_PARENTHESES:
- {
- prev = buffer.length ? buffer.pop()[1] : '';
- n = css.charCodeAt(pos + 1);
- if (prev === 'url' && n !== SINGLE_QUOTE && n !== DOUBLE_QUOTE && n !== SPACE && n !== NEWLINE && n !== TAB && n !== FEED && n !== CR) {
- next = pos;
- do {
- escaped = false;
- next = css.indexOf(')', next + 1);
- if (next === -1) {
- if (ignore || ignoreUnclosed) {
- next = pos;
- break;
- } else {
- unclosed('bracket');
- }
- }
- escapePos = next;
- while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
- escapePos -= 1;
- escaped = !escaped;
- }
- } while (escaped);
- currentToken = ['brackets', css.slice(pos, next + 1), pos, next];
- pos = next;
- } else {
- next = css.indexOf(')', pos + 1);
- content = css.slice(pos, next + 1);
- if (next === -1 || RE_BAD_BRACKET.test(content)) {
- currentToken = ['(', '(', pos];
- } else {
- currentToken = ['brackets', content, pos, next];
- pos = next;
- }
- }
- break;
- }
- case SINGLE_QUOTE:
- case DOUBLE_QUOTE:
- {
- quote = code === SINGLE_QUOTE ? "'" : '"';
- next = pos;
- do {
- escaped = false;
- next = css.indexOf(quote, next + 1);
- if (next === -1) {
- if (ignore || ignoreUnclosed) {
- next = pos + 1;
- break;
- } else {
- unclosed('string');
- }
- }
- escapePos = next;
- while (css.charCodeAt(escapePos - 1) === BACKSLASH) {
- escapePos -= 1;
- escaped = !escaped;
- }
- } while (escaped);
- currentToken = ['string', css.slice(pos, next + 1), pos, next];
- pos = next;
- break;
- }
- case AT:
- {
- RE_AT_END.lastIndex = pos + 1;
- RE_AT_END.test(css);
- if (RE_AT_END.lastIndex === 0) {
- next = css.length - 1;
- } else {
- next = RE_AT_END.lastIndex - 2;
- }
- currentToken = ['at-word', css.slice(pos, next + 1), pos, next];
- pos = next;
- break;
- }
- case BACKSLASH:
- {
- next = pos;
- escape = true;
- while (css.charCodeAt(next + 1) === BACKSLASH) {
- next += 1;
- escape = !escape;
- }
- code = css.charCodeAt(next + 1);
- if (escape && code !== SLASH && code !== SPACE && code !== NEWLINE && code !== TAB && code !== CR && code !== FEED) {
- next += 1;
- if (RE_HEX_ESCAPE.test(css.charAt(next))) {
- while (RE_HEX_ESCAPE.test(css.charAt(next + 1))) {
- next += 1;
- }
- if (css.charCodeAt(next + 1) === SPACE) {
- next += 1;
- }
- }
- }
- currentToken = ['word', css.slice(pos, next + 1), pos, next];
- pos = next;
- break;
- }
- default:
- {
- if (code === SLASH && css.charCodeAt(pos + 1) === ASTERISK) {
- next = css.indexOf('*/', pos + 2) + 1;
- if (next === 0) {
- if (ignore || ignoreUnclosed) {
- next = css.length;
- } else {
- unclosed('comment');
- }
- }
- currentToken = ['comment', css.slice(pos, next + 1), pos, next];
- pos = next;
- } else {
- RE_WORD_END.lastIndex = pos + 1;
- RE_WORD_END.test(css);
- if (RE_WORD_END.lastIndex === 0) {
- next = css.length - 1;
- } else {
- next = RE_WORD_END.lastIndex - 2;
- }
- currentToken = ['word', css.slice(pos, next + 1), pos, next];
- buffer.push(currentToken);
- pos = next;
- }
- break;
- }
- }
- pos++;
- return currentToken;
- }
- function back(token) {
- returned.push(token);
- }
- return {
- back: back,
- nextToken: nextToken,
- endOfFile: endOfFile,
- position: position
- };
- };
- /***/ }),
- /***/ 6574:
- /***/ ((module) => {
- /* eslint-disable no-console */
- var printed = {};
- module.exports = function warnOnce(message) {
- if (printed[message]) return;
- printed[message] = true;
- if (typeof console !== 'undefined' && console.warn) {
- console.warn(message);
- }
- };
- /***/ }),
- /***/ 1662:
- /***/ ((module) => {
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- var Warning = /*#__PURE__*/function () {
- function Warning(text) {
- var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- _classCallCheck(this, Warning);
- this.type = 'warning';
- this.text = text;
- if (opts.node && opts.node.source) {
- var range = opts.node.rangeBy(opts);
- this.line = range.start.line;
- this.column = range.start.column;
- this.endLine = range.end.line;
- this.endColumn = range.end.column;
- }
- for (var opt in opts) this[opt] = opts[opt];
- }
- _createClass(Warning, [{
- key: "toString",
- value: function toString() {
- if (this.node) {
- return this.node.error(this.text, {
- plugin: this.plugin,
- index: this.index,
- word: this.word
- }).message;
- }
- if (this.plugin) {
- return this.plugin + ': ' + this.text;
- }
- return this.text;
- }
- }]);
- return Warning;
- }();
- module.exports = Warning;
- Warning["default"] = Warning;
- /***/ }),
- /***/ 6760:
- /***/ (function(module, __unused_webpack_exports, __webpack_require__) {
- /* module decorator */ module = __webpack_require__.nmd(module);
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- /**
- * Copyright (c) 2014, Facebook, Inc.
- * All rights reserved.
- *
- * This source code is licensed under the BSD-style license found in the
- * https://raw.github.com/facebook/regenerator/master/LICENSE file. An
- * additional grant of patent rights can be found in the PATENTS file in
- * the same directory.
- */
- !function (global) {
- "use strict";
- var Op = Object.prototype;
- var hasOwn = Op.hasOwnProperty;
- var undefined; // More compressible than void 0.
- var $Symbol = typeof Symbol === "function" ? Symbol : {};
- var iteratorSymbol = $Symbol.iterator || "@@iterator";
- var asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator";
- var toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
- var inModule = ( false ? 0 : _typeof(module)) === "object";
- var runtime = global.regeneratorRuntime;
- if (runtime) {
- if (inModule) {
- // If regeneratorRuntime is defined globally and we're in a module,
- // make the exports object identical to regeneratorRuntime.
- module.exports = runtime;
- }
- // Don't bother evaluating the rest of this file if the runtime was
- // already defined globally.
- return;
- }
- // Define the runtime globally (as expected by generated code) as either
- // module.exports (if we're in a module) or a new, empty object.
- runtime = global.regeneratorRuntime = inModule ? module.exports : {};
- function wrap(innerFn, outerFn, self, tryLocsList) {
- // If outerFn provided and outerFn.prototype is a Generator, then outerFn.prototype instanceof Generator.
- var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator;
- var generator = Object.create(protoGenerator.prototype);
- var context = new Context(tryLocsList || []);
- // The ._invoke method unifies the implementations of the .next,
- // .throw, and .return methods.
- generator._invoke = makeInvokeMethod(innerFn, self, context);
- return generator;
- }
- runtime.wrap = wrap;
- // Try/catch helper to minimize deoptimizations. Returns a completion
- // record like context.tryEntries[i].completion. This interface could
- // have been (and was previously) designed to take a closure to be
- // invoked without arguments, but in all the cases we care about we
- // already have an existing method we want to call, so there's no need
- // to create a new function object. We can even get away with assuming
- // the method takes exactly one argument, since that happens to be true
- // in every case, so we don't have to touch the arguments object. The
- // only additional allocation required is the completion record, which
- // has a stable shape and so hopefully should be cheap to allocate.
- function tryCatch(fn, obj, arg) {
- try {
- return {
- type: "normal",
- arg: fn.call(obj, arg)
- };
- } catch (err) {
- return {
- type: "throw",
- arg: err
- };
- }
- }
- var GenStateSuspendedStart = "suspendedStart";
- var GenStateSuspendedYield = "suspendedYield";
- var GenStateExecuting = "executing";
- var GenStateCompleted = "completed";
- // Returning this object from the innerFn has the same effect as
- // breaking out of the dispatch switch statement.
- var ContinueSentinel = {};
- // Dummy constructor functions that we use as the .constructor and
- // .constructor.prototype properties for functions that return Generator
- // objects. For full spec compliance, you may wish to configure your
- // minifier not to mangle the names of these two functions.
- function Generator() {}
- function GeneratorFunction() {}
- function GeneratorFunctionPrototype() {}
- // This is a polyfill for %IteratorPrototype% for environments that
- // don't natively support it.
- var IteratorPrototype = {};
- IteratorPrototype[iteratorSymbol] = function () {
- return this;
- };
- var getProto = Object.getPrototypeOf;
- var NativeIteratorPrototype = getProto && getProto(getProto(values([])));
- if (NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol)) {
- // This environment has a native %IteratorPrototype%; use it instead
- // of the polyfill.
- IteratorPrototype = NativeIteratorPrototype;
- }
- var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
- GeneratorFunction.prototype = Gp.constructor = GeneratorFunctionPrototype;
- GeneratorFunctionPrototype.constructor = GeneratorFunction;
- GeneratorFunctionPrototype[toStringTagSymbol] = GeneratorFunction.displayName = "GeneratorFunction";
- // Helper for defining the .next, .throw, and .return methods of the
- // Iterator interface in terms of a single ._invoke method.
- function defineIteratorMethods(prototype) {
- ["next", "throw", "return"].forEach(function (method) {
- prototype[method] = function (arg) {
- return this._invoke(method, arg);
- };
- });
- }
- runtime.isGeneratorFunction = function (genFun) {
- var ctor = typeof genFun === "function" && genFun.constructor;
- return ctor ? ctor === GeneratorFunction ||
- // For the native GeneratorFunction constructor, the best we can
- // do is to check its .name property.
- (ctor.displayName || ctor.name) === "GeneratorFunction" : false;
- };
- runtime.mark = function (genFun) {
- if (Object.setPrototypeOf) {
- Object.setPrototypeOf(genFun, GeneratorFunctionPrototype);
- } else {
- genFun.__proto__ = GeneratorFunctionPrototype;
- if (!(toStringTagSymbol in genFun)) {
- genFun[toStringTagSymbol] = "GeneratorFunction";
- }
- }
- genFun.prototype = Object.create(Gp);
- return genFun;
- };
- // Within the body of any async function, `await x` is transformed to
- // `yield regeneratorRuntime.awrap(x)`, so that the runtime can test
- // `hasOwn.call(value, "__await")` to determine if the yielded value is
- // meant to be awaited.
- runtime.awrap = function (arg) {
- return {
- __await: arg
- };
- };
- function AsyncIterator(generator) {
- function invoke(method, arg, resolve, reject) {
- var record = tryCatch(generator[method], generator, arg);
- if (record.type === "throw") {
- reject(record.arg);
- } else {
- var result = record.arg;
- var value = result.value;
- if (value && _typeof(value) === "object" && hasOwn.call(value, "__await")) {
- return Promise.resolve(value.__await).then(function (value) {
- invoke("next", value, resolve, reject);
- }, function (err) {
- invoke("throw", err, resolve, reject);
- });
- }
- return Promise.resolve(value).then(function (unwrapped) {
- // When a yielded Promise is resolved, its final value becomes
- // the .value of the Promise<{value,done}> result for the
- // current iteration. If the Promise is rejected, however, the
- // result for this iteration will be rejected with the same
- // reason. Note that rejections of yielded Promises are not
- // thrown back into the generator function, as is the case
- // when an awaited Promise is rejected. This difference in
- // behavior between yield and await is important, because it
- // allows the consumer to decide what to do with the yielded
- // rejection (swallow it and continue, manually .throw it back
- // into the generator, abandon iteration, whatever). With
- // await, by contrast, there is no opportunity to examine the
- // rejection reason outside the generator function, so the
- // only option is to throw it from the await expression, and
- // let the generator function handle the exception.
- result.value = unwrapped;
- resolve(result);
- }, reject);
- }
- }
- if (_typeof(global.process) === "object" && global.process.domain) {
- invoke = global.process.domain.bind(invoke);
- }
- var previousPromise;
- function enqueue(method, arg) {
- function callInvokeWithMethodAndArg() {
- return new Promise(function (resolve, reject) {
- invoke(method, arg, resolve, reject);
- });
- }
- return previousPromise =
- // If enqueue has been called before, then we want to wait until
- // all previous Promises have been resolved before calling invoke,
- // so that results are always delivered in the correct order. If
- // enqueue has not been called before, then it is important to
- // call invoke immediately, without waiting on a callback to fire,
- // so that the async generator function has the opportunity to do
- // any necessary setup in a predictable way. This predictability
- // is why the Promise constructor synchronously invokes its
- // executor callback, and why async functions synchronously
- // execute code before the first await. Since we implement simple
- // async functions in terms of async generators, it is especially
- // important to get this right, even though it requires care.
- previousPromise ? previousPromise.then(callInvokeWithMethodAndArg,
- // Avoid propagating failures to Promises returned by later
- // invocations of the iterator.
- callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
- }
- // Define the unified helper method that is used to implement .next,
- // .throw, and .return (see defineIteratorMethods).
- this._invoke = enqueue;
- }
- defineIteratorMethods(AsyncIterator.prototype);
- AsyncIterator.prototype[asyncIteratorSymbol] = function () {
- return this;
- };
- runtime.AsyncIterator = AsyncIterator;
- // Note that simple async functions are implemented on top of
- // AsyncIterator objects; they just return a Promise for the value of
- // the final result produced by the iterator.
- runtime.async = function (innerFn, outerFn, self, tryLocsList) {
- var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList));
- return runtime.isGeneratorFunction(outerFn) ? iter // If outerFn is a generator, return the full iterator.
- : iter.next().then(function (result) {
- return result.done ? result.value : iter.next();
- });
- };
- function makeInvokeMethod(innerFn, self, context) {
- var state = GenStateSuspendedStart;
- return function invoke(method, arg) {
- if (state === GenStateExecuting) {
- throw new Error("Generator is already running");
- }
- if (state === GenStateCompleted) {
- if (method === "throw") {
- throw arg;
- }
- // Be forgiving, per 25.3.3.3.3 of the spec:
- // https://people.mozilla.org/~jorendorff/es6-draft.html#sec-generatorresume
- return doneResult();
- }
- context.method = method;
- context.arg = arg;
- while (true) {
- var delegate = context.delegate;
- if (delegate) {
- var delegateResult = maybeInvokeDelegate(delegate, context);
- if (delegateResult) {
- if (delegateResult === ContinueSentinel) continue;
- return delegateResult;
- }
- }
- if (context.method === "next") {
- // Setting context._sent for legacy support of Babel's
- // function.sent implementation.
- context.sent = context._sent = context.arg;
- } else if (context.method === "throw") {
- if (state === GenStateSuspendedStart) {
- state = GenStateCompleted;
- throw context.arg;
- }
- context.dispatchException(context.arg);
- } else if (context.method === "return") {
- context.abrupt("return", context.arg);
- }
- state = GenStateExecuting;
- var record = tryCatch(innerFn, self, context);
- if (record.type === "normal") {
- // If an exception is thrown from innerFn, we leave state ===
- // GenStateExecuting and loop back for another invocation.
- state = context.done ? GenStateCompleted : GenStateSuspendedYield;
- if (record.arg === ContinueSentinel) {
- continue;
- }
- return {
- value: record.arg,
- done: context.done
- };
- } else if (record.type === "throw") {
- state = GenStateCompleted;
- // Dispatch the exception by looping back around to the
- // context.dispatchException(context.arg) call above.
- context.method = "throw";
- context.arg = record.arg;
- }
- }
- };
- }
- // Call delegate.iterator[context.method](context.arg) and handle the
- // result, either by returning a { value, done } result from the
- // delegate iterator, or by modifying context.method and context.arg,
- // setting context.delegate to null, and returning the ContinueSentinel.
- function maybeInvokeDelegate(delegate, context) {
- var method = delegate.iterator[context.method];
- if (method === undefined) {
- // A .throw or .return when the delegate iterator has no .throw
- // method always terminates the yield* loop.
- context.delegate = null;
- if (context.method === "throw") {
- if (delegate.iterator["return"]) {
- // If the delegate iterator has a return method, give it a
- // chance to clean up.
- context.method = "return";
- context.arg = undefined;
- maybeInvokeDelegate(delegate, context);
- if (context.method === "throw") {
- // If maybeInvokeDelegate(context) changed context.method from
- // "return" to "throw", let that override the TypeError below.
- return ContinueSentinel;
- }
- }
- context.method = "throw";
- context.arg = new TypeError("The iterator does not provide a 'throw' method");
- }
- return ContinueSentinel;
- }
- var record = tryCatch(method, delegate.iterator, context.arg);
- if (record.type === "throw") {
- context.method = "throw";
- context.arg = record.arg;
- context.delegate = null;
- return ContinueSentinel;
- }
- var info = record.arg;
- if (!info) {
- context.method = "throw";
- context.arg = new TypeError("iterator result is not an object");
- context.delegate = null;
- return ContinueSentinel;
- }
- if (info.done) {
- // Assign the result of the finished delegate to the temporary
- // variable specified by delegate.resultName (see delegateYield).
- context[delegate.resultName] = info.value;
- // Resume execution at the desired location (see delegateYield).
- context.next = delegate.nextLoc;
- // If context.method was "throw" but the delegate handled the
- // exception, let the outer generator proceed normally. If
- // context.method was "next", forget context.arg since it has been
- // "consumed" by the delegate iterator. If context.method was
- // "return", allow the original .return call to continue in the
- // outer generator.
- if (context.method !== "return") {
- context.method = "next";
- context.arg = undefined;
- }
- } else {
- // Re-yield the result returned by the delegate method.
- return info;
- }
- // The delegate iterator is finished, so forget it and continue with
- // the outer generator.
- context.delegate = null;
- return ContinueSentinel;
- }
- // Define Generator.prototype.{next,throw,return} in terms of the
- // unified ._invoke helper method.
- defineIteratorMethods(Gp);
- Gp[toStringTagSymbol] = "Generator";
- // A Generator should always return itself as the iterator object when the
- // @@iterator function is called on it. Some browsers' implementations of the
- // iterator prototype chain incorrectly implement this, causing the Generator
- // object to not be returned from this call. This ensures that doesn't happen.
- // See https://github.com/facebook/regenerator/issues/274 for more details.
- Gp[iteratorSymbol] = function () {
- return this;
- };
- Gp.toString = function () {
- return "[object Generator]";
- };
- function pushTryEntry(locs) {
- var entry = {
- tryLoc: locs[0]
- };
- if (1 in locs) {
- entry.catchLoc = locs[1];
- }
- if (2 in locs) {
- entry.finallyLoc = locs[2];
- entry.afterLoc = locs[3];
- }
- this.tryEntries.push(entry);
- }
- function resetTryEntry(entry) {
- var record = entry.completion || {};
- record.type = "normal";
- delete record.arg;
- entry.completion = record;
- }
- function Context(tryLocsList) {
- // The root entry object (effectively a try statement without a catch
- // or a finally block) gives us a place to store values thrown from
- // locations where there is no enclosing try statement.
- this.tryEntries = [{
- tryLoc: "root"
- }];
- tryLocsList.forEach(pushTryEntry, this);
- this.reset(true);
- }
- runtime.keys = function (object) {
- var keys = [];
- for (var key in object) {
- keys.push(key);
- }
- keys.reverse();
- // Rather than returning an object with a next method, we keep
- // things simple and return the next function itself.
- return function next() {
- while (keys.length) {
- var key = keys.pop();
- if (key in object) {
- next.value = key;
- next.done = false;
- return next;
- }
- }
- // To avoid creating an additional object, we just hang the .value
- // and .done properties off the next function object itself. This
- // also ensures that the minifier will not anonymize the function.
- next.done = true;
- return next;
- };
- };
- function values(iterable) {
- if (iterable) {
- var iteratorMethod = iterable[iteratorSymbol];
- if (iteratorMethod) {
- return iteratorMethod.call(iterable);
- }
- if (typeof iterable.next === "function") {
- return iterable;
- }
- if (!isNaN(iterable.length)) {
- var i = -1,
- next = function next() {
- while (++i < iterable.length) {
- if (hasOwn.call(iterable, i)) {
- next.value = iterable[i];
- next.done = false;
- return next;
- }
- }
- next.value = undefined;
- next.done = true;
- return next;
- };
- return next.next = next;
- }
- }
- // Return an iterator with no values.
- return {
- next: doneResult
- };
- }
- runtime.values = values;
- function doneResult() {
- return {
- value: undefined,
- done: true
- };
- }
- Context.prototype = {
- constructor: Context,
- reset: function reset(skipTempReset) {
- this.prev = 0;
- this.next = 0;
- // Resetting context._sent for legacy support of Babel's
- // function.sent implementation.
- this.sent = this._sent = undefined;
- this.done = false;
- this.delegate = null;
- this.method = "next";
- this.arg = undefined;
- this.tryEntries.forEach(resetTryEntry);
- if (!skipTempReset) {
- for (var name in this) {
- // Not sure about the optimal order of these conditions:
- if (name.charAt(0) === "t" && hasOwn.call(this, name) && !isNaN(+name.slice(1))) {
- this[name] = undefined;
- }
- }
- }
- },
- stop: function stop() {
- this.done = true;
- var rootEntry = this.tryEntries[0];
- var rootRecord = rootEntry.completion;
- if (rootRecord.type === "throw") {
- throw rootRecord.arg;
- }
- return this.rval;
- },
- dispatchException: function dispatchException(exception) {
- if (this.done) {
- throw exception;
- }
- var context = this;
- function handle(loc, caught) {
- record.type = "throw";
- record.arg = exception;
- context.next = loc;
- if (caught) {
- // If the dispatched exception was caught by a catch block,
- // then let that catch block handle the exception normally.
- context.method = "next";
- context.arg = undefined;
- }
- return !!caught;
- }
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- var record = entry.completion;
- if (entry.tryLoc === "root") {
- // Exception thrown outside of any try block that could handle
- // it, so set the completion value of the entire function to
- // throw the exception.
- return handle("end");
- }
- if (entry.tryLoc <= this.prev) {
- var hasCatch = hasOwn.call(entry, "catchLoc");
- var hasFinally = hasOwn.call(entry, "finallyLoc");
- if (hasCatch && hasFinally) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- } else if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else if (hasCatch) {
- if (this.prev < entry.catchLoc) {
- return handle(entry.catchLoc, true);
- }
- } else if (hasFinally) {
- if (this.prev < entry.finallyLoc) {
- return handle(entry.finallyLoc);
- }
- } else {
- throw new Error("try statement without catch or finally");
- }
- }
- }
- },
- abrupt: function abrupt(type, arg) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
- var finallyEntry = entry;
- break;
- }
- }
- if (finallyEntry && (type === "break" || type === "continue") && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc) {
- // Ignore the finally entry if control is not jumping to a
- // location outside the try/catch block.
- finallyEntry = null;
- }
- var record = finallyEntry ? finallyEntry.completion : {};
- record.type = type;
- record.arg = arg;
- if (finallyEntry) {
- this.method = "next";
- this.next = finallyEntry.finallyLoc;
- return ContinueSentinel;
- }
- return this.complete(record);
- },
- complete: function complete(record, afterLoc) {
- if (record.type === "throw") {
- throw record.arg;
- }
- if (record.type === "break" || record.type === "continue") {
- this.next = record.arg;
- } else if (record.type === "return") {
- this.rval = this.arg = record.arg;
- this.method = "return";
- this.next = "end";
- } else if (record.type === "normal" && afterLoc) {
- this.next = afterLoc;
- }
- return ContinueSentinel;
- },
- finish: function finish(finallyLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.finallyLoc === finallyLoc) {
- this.complete(entry.completion, entry.afterLoc);
- resetTryEntry(entry);
- return ContinueSentinel;
- }
- }
- },
- "catch": function _catch(tryLoc) {
- for (var i = this.tryEntries.length - 1; i >= 0; --i) {
- var entry = this.tryEntries[i];
- if (entry.tryLoc === tryLoc) {
- var record = entry.completion;
- if (record.type === "throw") {
- var thrown = record.arg;
- resetTryEntry(entry);
- }
- return thrown;
- }
- }
- // The context.catch method must only be called with a location
- // argument that corresponds to a known catch block.
- throw new Error("illegal catch attempt");
- },
- delegateYield: function delegateYield(iterable, resultName, nextLoc) {
- this.delegate = {
- iterator: values(iterable),
- resultName: resultName,
- nextLoc: nextLoc
- };
- if (this.method === "next") {
- // Deliberately forget the last sent value so that we don't
- // accidentally pass it on to the delegate.
- this.arg = undefined;
- }
- return ContinueSentinel;
- }
- };
- }(
- // Among the various tricks for obtaining a reference to the global
- // object, this seems to be the most reliable technique that does not
- // use indirect eval (which violates Content Security Policy).
- (typeof __webpack_require__.g === "undefined" ? "undefined" : _typeof(__webpack_require__.g)) === "object" ? __webpack_require__.g : (typeof window === "undefined" ? "undefined" : _typeof(window)) === "object" ? window : (typeof self === "undefined" ? "undefined" : _typeof(self)) === "object" ? self : this);
- /***/ }),
- /***/ 6482:
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- var htmlparser = __webpack_require__(6124);
- var escapeStringRegexp = __webpack_require__(432);
- var _require = __webpack_require__(4281),
- isPlainObject = _require.isPlainObject;
- var deepmerge = __webpack_require__(4036);
- var parseSrcset = __webpack_require__(2134);
- var _require2 = __webpack_require__(7866),
- postcssParse = _require2.parse;
- // Tags that can conceivably represent stand-alone media.
- var mediaTags = ['img', 'audio', 'video', 'picture', 'svg', 'object', 'map', 'iframe', 'embed'];
- // Tags that are inherently vulnerable to being used in XSS attacks.
- var vulnerableTags = ['script', 'style'];
- function each(obj, cb) {
- if (obj) {
- Object.keys(obj).forEach(function (key) {
- cb(obj[key], key);
- });
- }
- }
- // Avoid false positives with .__proto__, .hasOwnProperty, etc.
- function has(obj, key) {
- return {}.hasOwnProperty.call(obj, key);
- }
- // Returns those elements of `a` for which `cb(a)` returns truthy
- function filter(a, cb) {
- var n = [];
- each(a, function (v) {
- if (cb(v)) {
- n.push(v);
- }
- });
- return n;
- }
- function isEmptyObject(obj) {
- for (var key in obj) {
- if (has(obj, key)) {
- return false;
- }
- }
- return true;
- }
- function stringifySrcset(parsedSrcset) {
- return parsedSrcset.map(function (part) {
- if (!part.url) {
- throw new Error('URL missing');
- }
- return part.url + (part.w ? " ".concat(part.w, "w") : '') + (part.h ? " ".concat(part.h, "h") : '') + (part.d ? " ".concat(part.d, "x") : '');
- }).join(', ');
- }
- module.exports = sanitizeHtml;
- // A valid attribute name.
- // We use a tolerant definition based on the set of strings defined by
- // html.spec.whatwg.org/multipage/parsing.html#before-attribute-name-state
- // and html.spec.whatwg.org/multipage/parsing.html#attribute-name-state .
- // The characters accepted are ones which can be appended to the attribute
- // name buffer without triggering a parse error:
- // * unexpected-equals-sign-before-attribute-name
- // * unexpected-null-character
- // * unexpected-character-in-attribute-name
- // We exclude the empty string because it's impossible to get to the after
- // attribute name state with an empty attribute name buffer.
- var VALID_HTML_ATTRIBUTE_NAME = /^[^\0\t\n\f\r /<=>]+$/;
- // Ignore the _recursing flag; it's there for recursive
- // invocation as a guard against this exploit:
- // https://github.com/fb55/htmlparser2/issues/105
- function sanitizeHtml(html, options, _recursing) {
- if (html == null) {
- return '';
- }
- var result = '';
- // Used for hot swapping the result variable with an empty string in order to "capture" the text written to it.
- var tempResult = '';
- function Frame(tag, attribs) {
- var that = this;
- this.tag = tag;
- this.attribs = attribs || {};
- this.tagPosition = result.length;
- this.text = ''; // Node inner text
- this.mediaChildren = [];
- this.updateParentNodeText = function () {
- if (stack.length) {
- var parentFrame = stack[stack.length - 1];
- parentFrame.text += that.text;
- }
- };
- this.updateParentNodeMediaChildren = function () {
- if (stack.length && mediaTags.includes(this.tag)) {
- var parentFrame = stack[stack.length - 1];
- parentFrame.mediaChildren.push(this.tag);
- }
- };
- }
- options = Object.assign({}, sanitizeHtml.defaults, options);
- options.parser = Object.assign({}, htmlParserDefaults, options.parser);
- // vulnerableTags
- vulnerableTags.forEach(function (tag) {
- if (options.allowedTags !== false && (options.allowedTags || []).indexOf(tag) > -1 && !options.allowVulnerableTags) {
- console.warn("\n\n\u26A0\uFE0F Your `allowedTags` option includes, `".concat(tag, "`, which is inherently\nvulnerable to XSS attacks. Please remove it from `allowedTags`.\nOr, to disable this warning, add the `allowVulnerableTags` option\nand ensure you are accounting for this risk.\n\n"));
- }
- });
- // Tags that contain something other than HTML, or where discarding
- // the text when the tag is disallowed makes sense for other reasons.
- // If we are not allowing these tags, we should drop their content too.
- // For other tags you would drop the tag but keep its content.
- var nonTextTagsArray = options.nonTextTags || ['script', 'style', 'textarea', 'option'];
- var allowedAttributesMap;
- var allowedAttributesGlobMap;
- if (options.allowedAttributes) {
- allowedAttributesMap = {};
- allowedAttributesGlobMap = {};
- each(options.allowedAttributes, function (attributes, tag) {
- allowedAttributesMap[tag] = [];
- var globRegex = [];
- attributes.forEach(function (obj) {
- if (typeof obj === 'string' && obj.indexOf('*') >= 0) {
- globRegex.push(escapeStringRegexp(obj).replace(/\\\*/g, '.*'));
- } else {
- allowedAttributesMap[tag].push(obj);
- }
- });
- if (globRegex.length) {
- allowedAttributesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');
- }
- });
- }
- var allowedClassesMap = {};
- var allowedClassesGlobMap = {};
- var allowedClassesRegexMap = {};
- each(options.allowedClasses, function (classes, tag) {
- // Implicitly allows the class attribute
- if (allowedAttributesMap) {
- if (!has(allowedAttributesMap, tag)) {
- allowedAttributesMap[tag] = [];
- }
- allowedAttributesMap[tag].push('class');
- }
- allowedClassesMap[tag] = [];
- allowedClassesRegexMap[tag] = [];
- var globRegex = [];
- classes.forEach(function (obj) {
- if (typeof obj === 'string' && obj.indexOf('*') >= 0) {
- globRegex.push(escapeStringRegexp(obj).replace(/\\\*/g, '.*'));
- } else if (obj instanceof RegExp) {
- allowedClassesRegexMap[tag].push(obj);
- } else {
- allowedClassesMap[tag].push(obj);
- }
- });
- if (globRegex.length) {
- allowedClassesGlobMap[tag] = new RegExp('^(' + globRegex.join('|') + ')$');
- }
- });
- var transformTagsMap = {};
- var transformTagsAll;
- each(options.transformTags, function (transform, tag) {
- var transFun;
- if (typeof transform === 'function') {
- transFun = transform;
- } else if (typeof transform === 'string') {
- transFun = sanitizeHtml.simpleTransform(transform);
- }
- if (tag === '*') {
- transformTagsAll = transFun;
- } else {
- transformTagsMap[tag] = transFun;
- }
- });
- var depth;
- var stack;
- var skipMap;
- var transformMap;
- var skipText;
- var skipTextDepth;
- var addedText = false;
- initializeState();
- var parser = new htmlparser.Parser({
- onopentag: function onopentag(name, attribs) {
- // If `enforceHtmlBoundary` is `true` and this has found the opening
- // `html` tag, reset the state.
- if (options.enforceHtmlBoundary && name === 'html') {
- initializeState();
- }
- if (skipText) {
- skipTextDepth++;
- return;
- }
- var frame = new Frame(name, attribs);
- stack.push(frame);
- var skip = false;
- var hasText = !!frame.text;
- var transformedTag;
- if (has(transformTagsMap, name)) {
- transformedTag = transformTagsMap[name](name, attribs);
- frame.attribs = attribs = transformedTag.attribs;
- if (transformedTag.text !== undefined) {
- frame.innerText = transformedTag.text;
- }
- if (name !== transformedTag.tagName) {
- frame.name = name = transformedTag.tagName;
- transformMap[depth] = transformedTag.tagName;
- }
- }
- if (transformTagsAll) {
- transformedTag = transformTagsAll(name, attribs);
- frame.attribs = attribs = transformedTag.attribs;
- if (name !== transformedTag.tagName) {
- frame.name = name = transformedTag.tagName;
- transformMap[depth] = transformedTag.tagName;
- }
- }
- if (options.allowedTags !== false && (options.allowedTags || []).indexOf(name) === -1 || options.disallowedTagsMode === 'recursiveEscape' && !isEmptyObject(skipMap) || options.nestingLimit != null && depth >= options.nestingLimit) {
- skip = true;
- skipMap[depth] = true;
- if (options.disallowedTagsMode === 'discard') {
- if (nonTextTagsArray.indexOf(name) !== -1) {
- skipText = true;
- skipTextDepth = 1;
- }
- }
- skipMap[depth] = true;
- }
- depth++;
- if (skip) {
- if (options.disallowedTagsMode === 'discard') {
- // We want the contents but not this tag
- return;
- }
- tempResult = result;
- result = '';
- }
- result += '<' + name;
- if (name === 'script') {
- if (options.allowedScriptHostnames || options.allowedScriptDomains) {
- frame.innerText = '';
- }
- }
- if (!allowedAttributesMap || has(allowedAttributesMap, name) || allowedAttributesMap['*']) {
- each(attribs, function (value, a) {
- if (!VALID_HTML_ATTRIBUTE_NAME.test(a)) {
- // This prevents part of an attribute name in the output from being
- // interpreted as the end of an attribute, or end of a tag.
- delete frame.attribs[a];
- return;
- }
- // check allowedAttributesMap for the element and attribute and modify the value
- // as necessary if there are specific values defined.
- var passedAllowedAttributesMapCheck = false;
- if (!allowedAttributesMap || has(allowedAttributesMap, name) && allowedAttributesMap[name].indexOf(a) !== -1 || allowedAttributesMap['*'] && allowedAttributesMap['*'].indexOf(a) !== -1 || has(allowedAttributesGlobMap, name) && allowedAttributesGlobMap[name].test(a) || allowedAttributesGlobMap['*'] && allowedAttributesGlobMap['*'].test(a)) {
- passedAllowedAttributesMapCheck = true;
- } else if (allowedAttributesMap && allowedAttributesMap[name]) {
- var _iterator = _createForOfIteratorHelper(allowedAttributesMap[name]),
- _step;
- try {
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
- var o = _step.value;
- if (isPlainObject(o) && o.name && o.name === a) {
- passedAllowedAttributesMapCheck = true;
- var newValue = '';
- if (o.multiple === true) {
- // verify the values that are allowed
- var splitStrArray = value.split(' ');
- var _iterator2 = _createForOfIteratorHelper(splitStrArray),
- _step2;
- try {
- for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
- var s = _step2.value;
- if (o.values.indexOf(s) !== -1) {
- if (newValue === '') {
- newValue = s;
- } else {
- newValue += ' ' + s;
- }
- }
- }
- } catch (err) {
- _iterator2.e(err);
- } finally {
- _iterator2.f();
- }
- } else if (o.values.indexOf(value) >= 0) {
- // verified an allowed value matches the entire attribute value
- newValue = value;
- }
- value = newValue;
- }
- }
- } catch (err) {
- _iterator.e(err);
- } finally {
- _iterator.f();
- }
- }
- if (passedAllowedAttributesMapCheck) {
- if (options.allowedSchemesAppliedToAttributes.indexOf(a) !== -1) {
- if (naughtyHref(name, value)) {
- delete frame.attribs[a];
- return;
- }
- }
- if (name === 'script' && a === 'src') {
- var allowed = true;
- try {
- var parsed = parseUrl(value);
- if (options.allowedScriptHostnames || options.allowedScriptDomains) {
- var allowedHostname = (options.allowedScriptHostnames || []).find(function (hostname) {
- return hostname === parsed.url.hostname;
- });
- var allowedDomain = (options.allowedScriptDomains || []).find(function (domain) {
- return parsed.url.hostname === domain || parsed.url.hostname.endsWith(".".concat(domain));
- });
- allowed = allowedHostname || allowedDomain;
- }
- } catch (e) {
- allowed = false;
- }
- if (!allowed) {
- delete frame.attribs[a];
- return;
- }
- }
- if (name === 'iframe' && a === 'src') {
- var _allowed = true;
- try {
- var _parsed = parseUrl(value);
- if (_parsed.isRelativeUrl) {
- // default value of allowIframeRelativeUrls is true
- // unless allowedIframeHostnames or allowedIframeDomains specified
- _allowed = has(options, 'allowIframeRelativeUrls') ? options.allowIframeRelativeUrls : !options.allowedIframeHostnames && !options.allowedIframeDomains;
- } else if (options.allowedIframeHostnames || options.allowedIframeDomains) {
- var _allowedHostname = (options.allowedIframeHostnames || []).find(function (hostname) {
- return hostname === _parsed.url.hostname;
- });
- var _allowedDomain = (options.allowedIframeDomains || []).find(function (domain) {
- return _parsed.url.hostname === domain || _parsed.url.hostname.endsWith(".".concat(domain));
- });
- _allowed = _allowedHostname || _allowedDomain;
- }
- } catch (e) {
- // Unparseable iframe src
- _allowed = false;
- }
- if (!_allowed) {
- delete frame.attribs[a];
- return;
- }
- }
- if (a === 'srcset') {
- try {
- var _parsed2 = parseSrcset(value);
- _parsed2.forEach(function (value) {
- if (naughtyHref('srcset', value.url)) {
- value.evil = true;
- }
- });
- _parsed2 = filter(_parsed2, function (v) {
- return !v.evil;
- });
- if (!_parsed2.length) {
- delete frame.attribs[a];
- return;
- } else {
- value = stringifySrcset(filter(_parsed2, function (v) {
- return !v.evil;
- }));
- frame.attribs[a] = value;
- }
- } catch (e) {
- // Unparseable srcset
- delete frame.attribs[a];
- return;
- }
- }
- if (a === 'class') {
- var allowedSpecificClasses = allowedClassesMap[name];
- var allowedWildcardClasses = allowedClassesMap['*'];
- var allowedSpecificClassesGlob = allowedClassesGlobMap[name];
- var allowedSpecificClassesRegex = allowedClassesRegexMap[name];
- var allowedWildcardClassesGlob = allowedClassesGlobMap['*'];
- var allowedClassesGlobs = [allowedSpecificClassesGlob, allowedWildcardClassesGlob].concat(allowedSpecificClassesRegex).filter(function (t) {
- return t;
- });
- if (allowedSpecificClasses && allowedWildcardClasses) {
- value = filterClasses(value, deepmerge(allowedSpecificClasses, allowedWildcardClasses), allowedClassesGlobs);
- } else {
- value = filterClasses(value, allowedSpecificClasses || allowedWildcardClasses, allowedClassesGlobs);
- }
- if (!value.length) {
- delete frame.attribs[a];
- return;
- }
- }
- if (a === 'style') {
- try {
- var abstractSyntaxTree = postcssParse(name + ' {' + value + '}');
- var filteredAST = filterCss(abstractSyntaxTree, options.allowedStyles);
- value = stringifyStyleAttributes(filteredAST);
- if (value.length === 0) {
- delete frame.attribs[a];
- return;
- }
- } catch (e) {
- delete frame.attribs[a];
- return;
- }
- }
- result += ' ' + a;
- if (value && value.length) {
- result += '="' + escapeHtml(value, true) + '"';
- }
- } else {
- delete frame.attribs[a];
- }
- });
- }
- if (options.selfClosing.indexOf(name) !== -1) {
- result += ' />';
- } else {
- result += '>';
- if (frame.innerText && !hasText && !options.textFilter) {
- result += escapeHtml(frame.innerText);
- addedText = true;
- }
- }
- if (skip) {
- result = tempResult + escapeHtml(result);
- tempResult = '';
- }
- },
- ontext: function ontext(text) {
- if (skipText) {
- return;
- }
- var lastFrame = stack[stack.length - 1];
- var tag;
- if (lastFrame) {
- tag = lastFrame.tag;
- // If inner text was set by transform function then let's use it
- text = lastFrame.innerText !== undefined ? lastFrame.innerText : text;
- }
- if (options.disallowedTagsMode === 'discard' && (tag === 'script' || tag === 'style')) {
- // htmlparser2 gives us these as-is. Escaping them ruins the content. Allowing
- // script tags is, by definition, game over for XSS protection, so if that's
- // your concern, don't allow them. The same is essentially true for style tags
- // which have their own collection of XSS vectors.
- result += text;
- } else {
- var escaped = escapeHtml(text, false);
- if (options.textFilter && !addedText) {
- result += options.textFilter(escaped, tag);
- } else if (!addedText) {
- result += escaped;
- }
- }
- if (stack.length) {
- var frame = stack[stack.length - 1];
- frame.text += text;
- }
- },
- onclosetag: function onclosetag(name) {
- if (skipText) {
- skipTextDepth--;
- if (!skipTextDepth) {
- skipText = false;
- } else {
- return;
- }
- }
- var frame = stack.pop();
- if (!frame) {
- // Do not crash on bad markup
- return;
- }
- if (frame.tag !== name) {
- // Another case of bad markup.
- // Push to stack, so that it will be used in future closing tags.
- stack.push(frame);
- return;
- }
- skipText = options.enforceHtmlBoundary ? name === 'html' : false;
- depth--;
- var skip = skipMap[depth];
- if (skip) {
- delete skipMap[depth];
- if (options.disallowedTagsMode === 'discard') {
- frame.updateParentNodeText();
- return;
- }
- tempResult = result;
- result = '';
- }
- if (transformMap[depth]) {
- name = transformMap[depth];
- delete transformMap[depth];
- }
- if (options.exclusiveFilter && options.exclusiveFilter(frame)) {
- result = result.substr(0, frame.tagPosition);
- return;
- }
- frame.updateParentNodeMediaChildren();
- frame.updateParentNodeText();
- if (options.selfClosing.indexOf(name) !== -1) {
- // Already output />
- if (skip) {
- result = tempResult;
- tempResult = '';
- }
- return;
- }
- result += '</' + name + '>';
- if (skip) {
- result = tempResult + escapeHtml(result);
- tempResult = '';
- }
- addedText = false;
- }
- }, options.parser);
- parser.write(html);
- parser.end();
- return result;
- function initializeState() {
- result = '';
- depth = 0;
- stack = [];
- skipMap = {};
- transformMap = {};
- skipText = false;
- skipTextDepth = 0;
- }
- function escapeHtml(s, quote) {
- if (typeof s !== 'string') {
- s = s + '';
- }
- if (options.parser.decodeEntities) {
- s = s.replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>');
- if (quote) {
- s = s.replace(/"/g, '"');
- }
- }
- // TODO: this is inadequate because it will pass `&0;`. This approach
- // will not work, each & must be considered with regard to whether it
- // is followed by a 100% syntactically valid entity or not, and escaped
- // if it is not. If this bothers you, don't set parser.decodeEntities
- // to false. (The default is true.)
- s = s.replace(/&(?![a-zA-Z0-9#]{1,20};)/g, '&') // Match ampersands not part of existing HTML entity
- .replace(/</g, '<').replace(/>/g, '>');
- if (quote) {
- s = s.replace(/"/g, '"');
- }
- return s;
- }
- function naughtyHref(name, href) {
- // Browsers ignore character codes of 32 (space) and below in a surprising
- // number of situations. Start reading here:
- // https://www.owasp.org/index.php/XSS_Filter_Evasion_Cheat_Sheet#Embedded_tab
- // eslint-disable-next-line no-control-regex
- href = href.replace(/[\x00-\x20]+/g, '');
- // Clobber any comments in URLs, which the browser might
- // interpret inside an XML data island, allowing
- // a javascript: URL to be snuck through
- while (true) {
- var firstIndex = href.indexOf('<!--');
- if (firstIndex === -1) {
- break;
- }
- var lastIndex = href.indexOf('-->', firstIndex + 4);
- if (lastIndex === -1) {
- break;
- }
- href = href.substring(0, firstIndex) + href.substring(lastIndex + 3);
- }
- // Case insensitive so we don't get faked out by JAVASCRIPT #1
- // Allow more characters after the first so we don't get faked
- // out by certain schemes browsers accept
- var matches = href.match(/^([a-zA-Z][a-zA-Z0-9.\-+]*):/);
- if (!matches) {
- // Protocol-relative URL starting with any combination of '/' and '\'
- if (href.match(/^[/\\]{2}/)) {
- return !options.allowProtocolRelative;
- }
- // No scheme
- return false;
- }
- var scheme = matches[1].toLowerCase();
- if (has(options.allowedSchemesByTag, name)) {
- return options.allowedSchemesByTag[name].indexOf(scheme) === -1;
- }
- return !options.allowedSchemes || options.allowedSchemes.indexOf(scheme) === -1;
- }
- function parseUrl(value) {
- value = value.replace(/^(\w+:)?\s*[\\/]\s*[\\/]/, '$1//');
- if (value.startsWith('relative:')) {
- // An attempt to exploit our workaround for base URLs being
- // mandatory for relative URL validation in the WHATWG
- // URL parser, reject it
- throw new Error('relative: exploit attempt');
- }
- // naughtyHref is in charge of whether protocol relative URLs
- // are cool. Here we are concerned just with allowed hostnames and
- // whether to allow relative URLs.
- //
- // Build a placeholder "base URL" against which any reasonable
- // relative URL may be parsed successfully
- var base = 'relative://relative-site';
- for (var i = 0; i < 100; i++) {
- base += "/".concat(i);
- }
- var parsed = new URL(value, base);
- var isRelativeUrl = parsed && parsed.hostname === 'relative-site' && parsed.protocol === 'relative:';
- return {
- isRelativeUrl: isRelativeUrl,
- url: parsed
- };
- }
- /**
- * Filters user input css properties by allowlisted regex attributes.
- * Modifies the abstractSyntaxTree object.
- *
- * @param {object} abstractSyntaxTree - Object representation of CSS attributes.
- * @property {array[Declaration]} abstractSyntaxTree.nodes[0] - Each object cointains prop and value key, i.e { prop: 'color', value: 'red' }.
- * @param {object} allowedStyles - Keys are properties (i.e color), value is list of permitted regex rules (i.e /green/i).
- * @return {object} - The modified tree.
- */
- function filterCss(abstractSyntaxTree, allowedStyles) {
- if (!allowedStyles) {
- return abstractSyntaxTree;
- }
- var astRules = abstractSyntaxTree.nodes[0];
- var selectedRule;
- // Merge global and tag-specific styles into new AST.
- if (allowedStyles[astRules.selector] && allowedStyles['*']) {
- selectedRule = deepmerge(allowedStyles[astRules.selector], allowedStyles['*']);
- } else {
- selectedRule = allowedStyles[astRules.selector] || allowedStyles['*'];
- }
- if (selectedRule) {
- abstractSyntaxTree.nodes[0].nodes = astRules.nodes.reduce(filterDeclarations(selectedRule), []);
- }
- return abstractSyntaxTree;
- }
- /**
- * Extracts the style attributes from an AbstractSyntaxTree and formats those
- * values in the inline style attribute format.
- *
- * @param {AbstractSyntaxTree} filteredAST
- * @return {string} - Example: "color:yellow;text-align:center !important;font-family:helvetica;"
- */
- function stringifyStyleAttributes(filteredAST) {
- return filteredAST.nodes[0].nodes.reduce(function (extractedAttributes, attrObject) {
- extractedAttributes.push("".concat(attrObject.prop, ":").concat(attrObject.value).concat(attrObject.important ? ' !important' : ''));
- return extractedAttributes;
- }, []).join(';');
- }
- /**
- * Filters the existing attributes for the given property. Discards any attributes
- * which don't match the allowlist.
- *
- * @param {object} selectedRule - Example: { color: red, font-family: helvetica }
- * @param {array} allowedDeclarationsList - List of declarations which pass the allowlist.
- * @param {object} attributeObject - Object representing the current css property.
- * @property {string} attributeObject.type - Typically 'declaration'.
- * @property {string} attributeObject.prop - The CSS property, i.e 'color'.
- * @property {string} attributeObject.value - The corresponding value to the css property, i.e 'red'.
- * @return {function} - When used in Array.reduce, will return an array of Declaration objects
- */
- function filterDeclarations(selectedRule) {
- return function (allowedDeclarationsList, attributeObject) {
- // If this property is allowlisted...
- if (has(selectedRule, attributeObject.prop)) {
- var matchesRegex = selectedRule[attributeObject.prop].some(function (regularExpression) {
- return regularExpression.test(attributeObject.value);
- });
- if (matchesRegex) {
- allowedDeclarationsList.push(attributeObject);
- }
- }
- return allowedDeclarationsList;
- };
- }
- function filterClasses(classes, allowed, allowedGlobs) {
- if (!allowed) {
- // The class attribute is allowed without filtering on this tag
- return classes;
- }
- classes = classes.split(/\s+/);
- return classes.filter(function (clss) {
- return allowed.indexOf(clss) !== -1 || allowedGlobs.some(function (glob) {
- return glob.test(clss);
- });
- }).join(' ');
- }
- }
- // Defaults are accessible to you so that you can use them as a starting point
- // programmatically if you wish
- var htmlParserDefaults = {
- decodeEntities: true
- };
- sanitizeHtml.defaults = {
- allowedTags: [
- // Sections derived from MDN element categories and limited to the more
- // benign categories.
- // https://developer.mozilla.org/en-US/docs/Web/HTML/Element
- // Content sectioning
- 'address', 'article', 'aside', 'footer', 'header', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hgroup', 'main', 'nav', 'section',
- // Text content
- 'blockquote', 'dd', 'div', 'dl', 'dt', 'figcaption', 'figure', 'hr', 'li', 'main', 'ol', 'p', 'pre', 'ul',
- // Inline text semantics
- 'a', 'abbr', 'b', 'bdi', 'bdo', 'br', 'cite', 'code', 'data', 'dfn', 'em', 'i', 'kbd', 'mark', 'q', 'rb', 'rp', 'rt', 'rtc', 'ruby', 's', 'samp', 'small', 'span', 'strong', 'sub', 'sup', 'time', 'u', 'var', 'wbr',
- // Table content
- 'caption', 'col', 'colgroup', 'table', 'tbody', 'td', 'tfoot', 'th', 'thead', 'tr'],
- disallowedTagsMode: 'discard',
- allowedAttributes: {
- a: ['href', 'name', 'target'],
- // We don't currently allow img itself by default, but
- // these attributes would make sense if we did.
- img: ['src', 'srcset', 'alt', 'title', 'width', 'height', 'loading']
- },
- // Lots of these won't come up by default because we don't allow them
- selfClosing: ['img', 'br', 'hr', 'area', 'base', 'basefont', 'input', 'link', 'meta'],
- // URL schemes we permit
- allowedSchemes: ['http', 'https', 'ftp', 'mailto', 'tel'],
- allowedSchemesByTag: {},
- allowedSchemesAppliedToAttributes: ['href', 'src', 'cite'],
- allowProtocolRelative: true,
- enforceHtmlBoundary: false
- };
- sanitizeHtml.simpleTransform = function (newTagName, newAttribs, merge) {
- merge = merge === undefined ? true : merge;
- newAttribs = newAttribs || {};
- return function (tagName, attribs) {
- var attrib;
- if (merge) {
- for (attrib in newAttribs) {
- attribs[attrib] = newAttribs[attrib];
- }
- } else {
- attribs = newAttribs;
- }
- return {
- tagName: newTagName,
- attribs: attribs
- };
- };
- };
- /***/ }),
- /***/ 432:
- /***/ ((module) => {
- module.exports = function (string) {
- if (typeof string !== 'string') {
- throw new TypeError('Expected a string');
- }
- // Escape characters with special meaning either inside or outside character sets.
- // Use a simple backslash escape when it’s always valid, and a \unnnn escape when the simpler form would be disallowed by Unicode patterns’ stricter grammar.
- return string.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&').replace(/-/g, '\\x2d');
- };
- /***/ }),
- /***/ 2868:
- /***/ (() => {
- /* (ignored) */
- /***/ }),
- /***/ 4777:
- /***/ (() => {
- /* (ignored) */
- /***/ }),
- /***/ 9830:
- /***/ (() => {
- /* (ignored) */
- /***/ }),
- /***/ 209:
- /***/ (() => {
- /* (ignored) */
- /***/ }),
- /***/ 7414:
- /***/ (() => {
- /* (ignored) */
- /***/ }),
- /***/ 2961:
- /***/ ((module) => {
- let urlAlphabet =
- 'useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict'
- let customAlphabet = (alphabet, defaultSize = 21) => {
- return (size = defaultSize) => {
- let id = ''
- let i = size
- while (i--) {
- id += alphabet[(Math.random() * alphabet.length) | 0]
- }
- return id
- }
- }
- let nanoid = (size = 21) => {
- let id = ''
- let i = size
- while (i--) {
- id += urlAlphabet[(Math.random() * 64) | 0]
- }
- return id
- }
- module.exports = { nanoid, customAlphabet }
- /***/ }),
- /***/ 3600:
- /***/ ((module) => {
- module.exports = JSON.parse('{"0":65533,"128":8364,"130":8218,"131":402,"132":8222,"133":8230,"134":8224,"135":8225,"136":710,"137":8240,"138":352,"139":8249,"140":338,"142":381,"145":8216,"146":8217,"147":8220,"148":8221,"149":8226,"150":8211,"151":8212,"152":732,"153":8482,"154":353,"155":8250,"156":339,"158":382,"159":376}');
- /***/ }),
- /***/ 9323:
- /***/ ((module) => {
- module.exports = JSON.parse('{"Aacute":"Á","aacute":"á","Abreve":"Ă","abreve":"ă","ac":"∾","acd":"∿","acE":"∾̳","Acirc":"Â","acirc":"â","acute":"´","Acy":"А","acy":"а","AElig":"Æ","aelig":"æ","af":"","Afr":"𝔄","afr":"𝔞","Agrave":"À","agrave":"à","alefsym":"ℵ","aleph":"ℵ","Alpha":"Α","alpha":"α","Amacr":"Ā","amacr":"ā","amalg":"⨿","amp":"&","AMP":"&","andand":"⩕","And":"⩓","and":"∧","andd":"⩜","andslope":"⩘","andv":"⩚","ang":"∠","ange":"⦤","angle":"∠","angmsdaa":"⦨","angmsdab":"⦩","angmsdac":"⦪","angmsdad":"⦫","angmsdae":"⦬","angmsdaf":"⦭","angmsdag":"⦮","angmsdah":"⦯","angmsd":"∡","angrt":"∟","angrtvb":"⊾","angrtvbd":"⦝","angsph":"∢","angst":"Å","angzarr":"⍼","Aogon":"Ą","aogon":"ą","Aopf":"𝔸","aopf":"𝕒","apacir":"⩯","ap":"≈","apE":"⩰","ape":"≊","apid":"≋","apos":"\'","ApplyFunction":"","approx":"≈","approxeq":"≊","Aring":"Å","aring":"å","Ascr":"𝒜","ascr":"𝒶","Assign":"≔","ast":"*","asymp":"≈","asympeq":"≍","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","awconint":"∳","awint":"⨑","backcong":"≌","backepsilon":"϶","backprime":"‵","backsim":"∽","backsimeq":"⋍","Backslash":"∖","Barv":"⫧","barvee":"⊽","barwed":"⌅","Barwed":"⌆","barwedge":"⌅","bbrk":"⎵","bbrktbrk":"⎶","bcong":"≌","Bcy":"Б","bcy":"б","bdquo":"„","becaus":"∵","because":"∵","Because":"∵","bemptyv":"⦰","bepsi":"϶","bernou":"ℬ","Bernoullis":"ℬ","Beta":"Β","beta":"β","beth":"ℶ","between":"≬","Bfr":"𝔅","bfr":"𝔟","bigcap":"⋂","bigcirc":"◯","bigcup":"⋃","bigodot":"⨀","bigoplus":"⨁","bigotimes":"⨂","bigsqcup":"⨆","bigstar":"★","bigtriangledown":"▽","bigtriangleup":"△","biguplus":"⨄","bigvee":"⋁","bigwedge":"⋀","bkarow":"⤍","blacklozenge":"⧫","blacksquare":"▪","blacktriangle":"▴","blacktriangledown":"▾","blacktriangleleft":"◂","blacktriangleright":"▸","blank":"␣","blk12":"▒","blk14":"░","blk34":"▓","block":"█","bne":"=⃥","bnequiv":"≡⃥","bNot":"⫭","bnot":"⌐","Bopf":"𝔹","bopf":"𝕓","bot":"⊥","bottom":"⊥","bowtie":"⋈","boxbox":"⧉","boxdl":"┐","boxdL":"╕","boxDl":"╖","boxDL":"╗","boxdr":"┌","boxdR":"╒","boxDr":"╓","boxDR":"╔","boxh":"─","boxH":"═","boxhd":"┬","boxHd":"╤","boxhD":"╥","boxHD":"╦","boxhu":"┴","boxHu":"╧","boxhU":"╨","boxHU":"╩","boxminus":"⊟","boxplus":"⊞","boxtimes":"⊠","boxul":"┘","boxuL":"╛","boxUl":"╜","boxUL":"╝","boxur":"└","boxuR":"╘","boxUr":"╙","boxUR":"╚","boxv":"│","boxV":"║","boxvh":"┼","boxvH":"╪","boxVh":"╫","boxVH":"╬","boxvl":"┤","boxvL":"╡","boxVl":"╢","boxVL":"╣","boxvr":"├","boxvR":"╞","boxVr":"╟","boxVR":"╠","bprime":"‵","breve":"˘","Breve":"˘","brvbar":"¦","bscr":"𝒷","Bscr":"ℬ","bsemi":"⁏","bsim":"∽","bsime":"⋍","bsolb":"⧅","bsol":"\\\\","bsolhsub":"⟈","bull":"•","bullet":"•","bump":"≎","bumpE":"⪮","bumpe":"≏","Bumpeq":"≎","bumpeq":"≏","Cacute":"Ć","cacute":"ć","capand":"⩄","capbrcup":"⩉","capcap":"⩋","cap":"∩","Cap":"⋒","capcup":"⩇","capdot":"⩀","CapitalDifferentialD":"ⅅ","caps":"∩︀","caret":"⁁","caron":"ˇ","Cayleys":"ℭ","ccaps":"⩍","Ccaron":"Č","ccaron":"č","Ccedil":"Ç","ccedil":"ç","Ccirc":"Ĉ","ccirc":"ĉ","Cconint":"∰","ccups":"⩌","ccupssm":"⩐","Cdot":"Ċ","cdot":"ċ","cedil":"¸","Cedilla":"¸","cemptyv":"⦲","cent":"¢","centerdot":"·","CenterDot":"·","cfr":"𝔠","Cfr":"ℭ","CHcy":"Ч","chcy":"ч","check":"✓","checkmark":"✓","Chi":"Χ","chi":"χ","circ":"ˆ","circeq":"≗","circlearrowleft":"↺","circlearrowright":"↻","circledast":"⊛","circledcirc":"⊚","circleddash":"⊝","CircleDot":"⊙","circledR":"®","circledS":"Ⓢ","CircleMinus":"⊖","CirclePlus":"⊕","CircleTimes":"⊗","cir":"○","cirE":"⧃","cire":"≗","cirfnint":"⨐","cirmid":"⫯","cirscir":"⧂","ClockwiseContourIntegral":"∲","CloseCurlyDoubleQuote":"”","CloseCurlyQuote":"’","clubs":"♣","clubsuit":"♣","colon":":","Colon":"∷","Colone":"⩴","colone":"≔","coloneq":"≔","comma":",","commat":"@","comp":"∁","compfn":"∘","complement":"∁","complexes":"ℂ","cong":"≅","congdot":"⩭","Congruent":"≡","conint":"∮","Conint":"∯","ContourIntegral":"∮","copf":"𝕔","Copf":"ℂ","coprod":"∐","Coproduct":"∐","copy":"©","COPY":"©","copysr":"℗","CounterClockwiseContourIntegral":"∳","crarr":"↵","cross":"✗","Cross":"⨯","Cscr":"𝒞","cscr":"𝒸","csub":"⫏","csube":"⫑","csup":"⫐","csupe":"⫒","ctdot":"⋯","cudarrl":"⤸","cudarrr":"⤵","cuepr":"⋞","cuesc":"⋟","cularr":"↶","cularrp":"⤽","cupbrcap":"⩈","cupcap":"⩆","CupCap":"≍","cup":"∪","Cup":"⋓","cupcup":"⩊","cupdot":"⊍","cupor":"⩅","cups":"∪︀","curarr":"↷","curarrm":"⤼","curlyeqprec":"⋞","curlyeqsucc":"⋟","curlyvee":"⋎","curlywedge":"⋏","curren":"¤","curvearrowleft":"↶","curvearrowright":"↷","cuvee":"⋎","cuwed":"⋏","cwconint":"∲","cwint":"∱","cylcty":"⌭","dagger":"†","Dagger":"‡","daleth":"ℸ","darr":"↓","Darr":"↡","dArr":"⇓","dash":"‐","Dashv":"⫤","dashv":"⊣","dbkarow":"⤏","dblac":"˝","Dcaron":"Ď","dcaron":"ď","Dcy":"Д","dcy":"д","ddagger":"‡","ddarr":"⇊","DD":"ⅅ","dd":"ⅆ","DDotrahd":"⤑","ddotseq":"⩷","deg":"°","Del":"∇","Delta":"Δ","delta":"δ","demptyv":"⦱","dfisht":"⥿","Dfr":"𝔇","dfr":"𝔡","dHar":"⥥","dharl":"⇃","dharr":"⇂","DiacriticalAcute":"´","DiacriticalDot":"˙","DiacriticalDoubleAcute":"˝","DiacriticalGrave":"`","DiacriticalTilde":"˜","diam":"⋄","diamond":"⋄","Diamond":"⋄","diamondsuit":"♦","diams":"♦","die":"¨","DifferentialD":"ⅆ","digamma":"ϝ","disin":"⋲","div":"÷","divide":"÷","divideontimes":"⋇","divonx":"⋇","DJcy":"Ђ","djcy":"ђ","dlcorn":"⌞","dlcrop":"⌍","dollar":"$","Dopf":"𝔻","dopf":"𝕕","Dot":"¨","dot":"˙","DotDot":"⃜","doteq":"≐","doteqdot":"≑","DotEqual":"≐","dotminus":"∸","dotplus":"∔","dotsquare":"⊡","doublebarwedge":"⌆","DoubleContourIntegral":"∯","DoubleDot":"¨","DoubleDownArrow":"⇓","DoubleLeftArrow":"⇐","DoubleLeftRightArrow":"⇔","DoubleLeftTee":"⫤","DoubleLongLeftArrow":"⟸","DoubleLongLeftRightArrow":"⟺","DoubleLongRightArrow":"⟹","DoubleRightArrow":"⇒","DoubleRightTee":"⊨","DoubleUpArrow":"⇑","DoubleUpDownArrow":"⇕","DoubleVerticalBar":"∥","DownArrowBar":"⤓","downarrow":"↓","DownArrow":"↓","Downarrow":"⇓","DownArrowUpArrow":"⇵","DownBreve":"̑","downdownarrows":"⇊","downharpoonleft":"⇃","downharpoonright":"⇂","DownLeftRightVector":"⥐","DownLeftTeeVector":"⥞","DownLeftVectorBar":"⥖","DownLeftVector":"↽","DownRightTeeVector":"⥟","DownRightVectorBar":"⥗","DownRightVector":"⇁","DownTeeArrow":"↧","DownTee":"⊤","drbkarow":"⤐","drcorn":"⌟","drcrop":"⌌","Dscr":"𝒟","dscr":"𝒹","DScy":"Ѕ","dscy":"ѕ","dsol":"⧶","Dstrok":"Đ","dstrok":"đ","dtdot":"⋱","dtri":"▿","dtrif":"▾","duarr":"⇵","duhar":"⥯","dwangle":"⦦","DZcy":"Џ","dzcy":"џ","dzigrarr":"⟿","Eacute":"É","eacute":"é","easter":"⩮","Ecaron":"Ě","ecaron":"ě","Ecirc":"Ê","ecirc":"ê","ecir":"≖","ecolon":"≕","Ecy":"Э","ecy":"э","eDDot":"⩷","Edot":"Ė","edot":"ė","eDot":"≑","ee":"ⅇ","efDot":"≒","Efr":"𝔈","efr":"𝔢","eg":"⪚","Egrave":"È","egrave":"è","egs":"⪖","egsdot":"⪘","el":"⪙","Element":"∈","elinters":"⏧","ell":"ℓ","els":"⪕","elsdot":"⪗","Emacr":"Ē","emacr":"ē","empty":"∅","emptyset":"∅","EmptySmallSquare":"◻","emptyv":"∅","EmptyVerySmallSquare":"▫","emsp13":" ","emsp14":" ","emsp":" ","ENG":"Ŋ","eng":"ŋ","ensp":" ","Eogon":"Ę","eogon":"ę","Eopf":"𝔼","eopf":"𝕖","epar":"⋕","eparsl":"⧣","eplus":"⩱","epsi":"ε","Epsilon":"Ε","epsilon":"ε","epsiv":"ϵ","eqcirc":"≖","eqcolon":"≕","eqsim":"≂","eqslantgtr":"⪖","eqslantless":"⪕","Equal":"⩵","equals":"=","EqualTilde":"≂","equest":"≟","Equilibrium":"⇌","equiv":"≡","equivDD":"⩸","eqvparsl":"⧥","erarr":"⥱","erDot":"≓","escr":"ℯ","Escr":"ℰ","esdot":"≐","Esim":"⩳","esim":"≂","Eta":"Η","eta":"η","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","euro":"€","excl":"!","exist":"∃","Exists":"∃","expectation":"ℰ","exponentiale":"ⅇ","ExponentialE":"ⅇ","fallingdotseq":"≒","Fcy":"Ф","fcy":"ф","female":"♀","ffilig":"ffi","fflig":"ff","ffllig":"ffl","Ffr":"𝔉","ffr":"𝔣","filig":"fi","FilledSmallSquare":"◼","FilledVerySmallSquare":"▪","fjlig":"fj","flat":"♭","fllig":"fl","fltns":"▱","fnof":"ƒ","Fopf":"𝔽","fopf":"𝕗","forall":"∀","ForAll":"∀","fork":"⋔","forkv":"⫙","Fouriertrf":"ℱ","fpartint":"⨍","frac12":"½","frac13":"⅓","frac14":"¼","frac15":"⅕","frac16":"⅙","frac18":"⅛","frac23":"⅔","frac25":"⅖","frac34":"¾","frac35":"⅗","frac38":"⅜","frac45":"⅘","frac56":"⅚","frac58":"⅝","frac78":"⅞","frasl":"⁄","frown":"⌢","fscr":"𝒻","Fscr":"ℱ","gacute":"ǵ","Gamma":"Γ","gamma":"γ","Gammad":"Ϝ","gammad":"ϝ","gap":"⪆","Gbreve":"Ğ","gbreve":"ğ","Gcedil":"Ģ","Gcirc":"Ĝ","gcirc":"ĝ","Gcy":"Г","gcy":"г","Gdot":"Ġ","gdot":"ġ","ge":"≥","gE":"≧","gEl":"⪌","gel":"⋛","geq":"≥","geqq":"≧","geqslant":"⩾","gescc":"⪩","ges":"⩾","gesdot":"⪀","gesdoto":"⪂","gesdotol":"⪄","gesl":"⋛︀","gesles":"⪔","Gfr":"𝔊","gfr":"𝔤","gg":"≫","Gg":"⋙","ggg":"⋙","gimel":"ℷ","GJcy":"Ѓ","gjcy":"ѓ","gla":"⪥","gl":"≷","glE":"⪒","glj":"⪤","gnap":"⪊","gnapprox":"⪊","gne":"⪈","gnE":"≩","gneq":"⪈","gneqq":"≩","gnsim":"⋧","Gopf":"𝔾","gopf":"𝕘","grave":"`","GreaterEqual":"≥","GreaterEqualLess":"⋛","GreaterFullEqual":"≧","GreaterGreater":"⪢","GreaterLess":"≷","GreaterSlantEqual":"⩾","GreaterTilde":"≳","Gscr":"𝒢","gscr":"ℊ","gsim":"≳","gsime":"⪎","gsiml":"⪐","gtcc":"⪧","gtcir":"⩺","gt":">","GT":">","Gt":"≫","gtdot":"⋗","gtlPar":"⦕","gtquest":"⩼","gtrapprox":"⪆","gtrarr":"⥸","gtrdot":"⋗","gtreqless":"⋛","gtreqqless":"⪌","gtrless":"≷","gtrsim":"≳","gvertneqq":"≩︀","gvnE":"≩︀","Hacek":"ˇ","hairsp":" ","half":"½","hamilt":"ℋ","HARDcy":"Ъ","hardcy":"ъ","harrcir":"⥈","harr":"↔","hArr":"⇔","harrw":"↭","Hat":"^","hbar":"ℏ","Hcirc":"Ĥ","hcirc":"ĥ","hearts":"♥","heartsuit":"♥","hellip":"…","hercon":"⊹","hfr":"𝔥","Hfr":"ℌ","HilbertSpace":"ℋ","hksearow":"⤥","hkswarow":"⤦","hoarr":"⇿","homtht":"∻","hookleftarrow":"↩","hookrightarrow":"↪","hopf":"𝕙","Hopf":"ℍ","horbar":"―","HorizontalLine":"─","hscr":"𝒽","Hscr":"ℋ","hslash":"ℏ","Hstrok":"Ħ","hstrok":"ħ","HumpDownHump":"≎","HumpEqual":"≏","hybull":"⁃","hyphen":"‐","Iacute":"Í","iacute":"í","ic":"","Icirc":"Î","icirc":"î","Icy":"И","icy":"и","Idot":"İ","IEcy":"Е","iecy":"е","iexcl":"¡","iff":"⇔","ifr":"𝔦","Ifr":"ℑ","Igrave":"Ì","igrave":"ì","ii":"ⅈ","iiiint":"⨌","iiint":"∭","iinfin":"⧜","iiota":"℩","IJlig":"IJ","ijlig":"ij","Imacr":"Ī","imacr":"ī","image":"ℑ","ImaginaryI":"ⅈ","imagline":"ℐ","imagpart":"ℑ","imath":"ı","Im":"ℑ","imof":"⊷","imped":"Ƶ","Implies":"⇒","incare":"℅","in":"∈","infin":"∞","infintie":"⧝","inodot":"ı","intcal":"⊺","int":"∫","Int":"∬","integers":"ℤ","Integral":"∫","intercal":"⊺","Intersection":"⋂","intlarhk":"⨗","intprod":"⨼","InvisibleComma":"","InvisibleTimes":"","IOcy":"Ё","iocy":"ё","Iogon":"Į","iogon":"į","Iopf":"𝕀","iopf":"𝕚","Iota":"Ι","iota":"ι","iprod":"⨼","iquest":"¿","iscr":"𝒾","Iscr":"ℐ","isin":"∈","isindot":"⋵","isinE":"⋹","isins":"⋴","isinsv":"⋳","isinv":"∈","it":"","Itilde":"Ĩ","itilde":"ĩ","Iukcy":"І","iukcy":"і","Iuml":"Ï","iuml":"ï","Jcirc":"Ĵ","jcirc":"ĵ","Jcy":"Й","jcy":"й","Jfr":"𝔍","jfr":"𝔧","jmath":"ȷ","Jopf":"𝕁","jopf":"𝕛","Jscr":"𝒥","jscr":"𝒿","Jsercy":"Ј","jsercy":"ј","Jukcy":"Є","jukcy":"є","Kappa":"Κ","kappa":"κ","kappav":"ϰ","Kcedil":"Ķ","kcedil":"ķ","Kcy":"К","kcy":"к","Kfr":"𝔎","kfr":"𝔨","kgreen":"ĸ","KHcy":"Х","khcy":"х","KJcy":"Ќ","kjcy":"ќ","Kopf":"𝕂","kopf":"𝕜","Kscr":"𝒦","kscr":"𝓀","lAarr":"⇚","Lacute":"Ĺ","lacute":"ĺ","laemptyv":"⦴","lagran":"ℒ","Lambda":"Λ","lambda":"λ","lang":"⟨","Lang":"⟪","langd":"⦑","langle":"⟨","lap":"⪅","Laplacetrf":"ℒ","laquo":"«","larrb":"⇤","larrbfs":"⤟","larr":"←","Larr":"↞","lArr":"⇐","larrfs":"⤝","larrhk":"↩","larrlp":"↫","larrpl":"⤹","larrsim":"⥳","larrtl":"↢","latail":"⤙","lAtail":"⤛","lat":"⪫","late":"⪭","lates":"⪭︀","lbarr":"⤌","lBarr":"⤎","lbbrk":"❲","lbrace":"{","lbrack":"[","lbrke":"⦋","lbrksld":"⦏","lbrkslu":"⦍","Lcaron":"Ľ","lcaron":"ľ","Lcedil":"Ļ","lcedil":"ļ","lceil":"⌈","lcub":"{","Lcy":"Л","lcy":"л","ldca":"⤶","ldquo":"“","ldquor":"„","ldrdhar":"⥧","ldrushar":"⥋","ldsh":"↲","le":"≤","lE":"≦","LeftAngleBracket":"⟨","LeftArrowBar":"⇤","leftarrow":"←","LeftArrow":"←","Leftarrow":"⇐","LeftArrowRightArrow":"⇆","leftarrowtail":"↢","LeftCeiling":"⌈","LeftDoubleBracket":"⟦","LeftDownTeeVector":"⥡","LeftDownVectorBar":"⥙","LeftDownVector":"⇃","LeftFloor":"⌊","leftharpoondown":"↽","leftharpoonup":"↼","leftleftarrows":"⇇","leftrightarrow":"↔","LeftRightArrow":"↔","Leftrightarrow":"⇔","leftrightarrows":"⇆","leftrightharpoons":"⇋","leftrightsquigarrow":"↭","LeftRightVector":"⥎","LeftTeeArrow":"↤","LeftTee":"⊣","LeftTeeVector":"⥚","leftthreetimes":"⋋","LeftTriangleBar":"⧏","LeftTriangle":"⊲","LeftTriangleEqual":"⊴","LeftUpDownVector":"⥑","LeftUpTeeVector":"⥠","LeftUpVectorBar":"⥘","LeftUpVector":"↿","LeftVectorBar":"⥒","LeftVector":"↼","lEg":"⪋","leg":"⋚","leq":"≤","leqq":"≦","leqslant":"⩽","lescc":"⪨","les":"⩽","lesdot":"⩿","lesdoto":"⪁","lesdotor":"⪃","lesg":"⋚︀","lesges":"⪓","lessapprox":"⪅","lessdot":"⋖","lesseqgtr":"⋚","lesseqqgtr":"⪋","LessEqualGreater":"⋚","LessFullEqual":"≦","LessGreater":"≶","lessgtr":"≶","LessLess":"⪡","lesssim":"≲","LessSlantEqual":"⩽","LessTilde":"≲","lfisht":"⥼","lfloor":"⌊","Lfr":"𝔏","lfr":"𝔩","lg":"≶","lgE":"⪑","lHar":"⥢","lhard":"↽","lharu":"↼","lharul":"⥪","lhblk":"▄","LJcy":"Љ","ljcy":"љ","llarr":"⇇","ll":"≪","Ll":"⋘","llcorner":"⌞","Lleftarrow":"⇚","llhard":"⥫","lltri":"◺","Lmidot":"Ŀ","lmidot":"ŀ","lmoustache":"⎰","lmoust":"⎰","lnap":"⪉","lnapprox":"⪉","lne":"⪇","lnE":"≨","lneq":"⪇","lneqq":"≨","lnsim":"⋦","loang":"⟬","loarr":"⇽","lobrk":"⟦","longleftarrow":"⟵","LongLeftArrow":"⟵","Longleftarrow":"⟸","longleftrightarrow":"⟷","LongLeftRightArrow":"⟷","Longleftrightarrow":"⟺","longmapsto":"⟼","longrightarrow":"⟶","LongRightArrow":"⟶","Longrightarrow":"⟹","looparrowleft":"↫","looparrowright":"↬","lopar":"⦅","Lopf":"𝕃","lopf":"𝕝","loplus":"⨭","lotimes":"⨴","lowast":"∗","lowbar":"_","LowerLeftArrow":"↙","LowerRightArrow":"↘","loz":"◊","lozenge":"◊","lozf":"⧫","lpar":"(","lparlt":"⦓","lrarr":"⇆","lrcorner":"⌟","lrhar":"⇋","lrhard":"⥭","lrm":"","lrtri":"⊿","lsaquo":"‹","lscr":"𝓁","Lscr":"ℒ","lsh":"↰","Lsh":"↰","lsim":"≲","lsime":"⪍","lsimg":"⪏","lsqb":"[","lsquo":"‘","lsquor":"‚","Lstrok":"Ł","lstrok":"ł","ltcc":"⪦","ltcir":"⩹","lt":"<","LT":"<","Lt":"≪","ltdot":"⋖","lthree":"⋋","ltimes":"⋉","ltlarr":"⥶","ltquest":"⩻","ltri":"◃","ltrie":"⊴","ltrif":"◂","ltrPar":"⦖","lurdshar":"⥊","luruhar":"⥦","lvertneqq":"≨︀","lvnE":"≨︀","macr":"¯","male":"♂","malt":"✠","maltese":"✠","Map":"⤅","map":"↦","mapsto":"↦","mapstodown":"↧","mapstoleft":"↤","mapstoup":"↥","marker":"▮","mcomma":"⨩","Mcy":"М","mcy":"м","mdash":"—","mDDot":"∺","measuredangle":"∡","MediumSpace":" ","Mellintrf":"ℳ","Mfr":"𝔐","mfr":"𝔪","mho":"℧","micro":"µ","midast":"*","midcir":"⫰","mid":"∣","middot":"·","minusb":"⊟","minus":"−","minusd":"∸","minusdu":"⨪","MinusPlus":"∓","mlcp":"⫛","mldr":"…","mnplus":"∓","models":"⊧","Mopf":"𝕄","mopf":"𝕞","mp":"∓","mscr":"𝓂","Mscr":"ℳ","mstpos":"∾","Mu":"Μ","mu":"μ","multimap":"⊸","mumap":"⊸","nabla":"∇","Nacute":"Ń","nacute":"ń","nang":"∠⃒","nap":"≉","napE":"⩰̸","napid":"≋̸","napos":"ʼn","napprox":"≉","natural":"♮","naturals":"ℕ","natur":"♮","nbsp":" ","nbump":"≎̸","nbumpe":"≏̸","ncap":"⩃","Ncaron":"Ň","ncaron":"ň","Ncedil":"Ņ","ncedil":"ņ","ncong":"≇","ncongdot":"⩭̸","ncup":"⩂","Ncy":"Н","ncy":"н","ndash":"–","nearhk":"⤤","nearr":"↗","neArr":"⇗","nearrow":"↗","ne":"≠","nedot":"≐̸","NegativeMediumSpace":"","NegativeThickSpace":"","NegativeThinSpace":"","NegativeVeryThinSpace":"","nequiv":"≢","nesear":"⤨","nesim":"≂̸","NestedGreaterGreater":"≫","NestedLessLess":"≪","NewLine":"\\n","nexist":"∄","nexists":"∄","Nfr":"𝔑","nfr":"𝔫","ngE":"≧̸","nge":"≱","ngeq":"≱","ngeqq":"≧̸","ngeqslant":"⩾̸","nges":"⩾̸","nGg":"⋙̸","ngsim":"≵","nGt":"≫⃒","ngt":"≯","ngtr":"≯","nGtv":"≫̸","nharr":"↮","nhArr":"⇎","nhpar":"⫲","ni":"∋","nis":"⋼","nisd":"⋺","niv":"∋","NJcy":"Њ","njcy":"њ","nlarr":"↚","nlArr":"⇍","nldr":"‥","nlE":"≦̸","nle":"≰","nleftarrow":"↚","nLeftarrow":"⇍","nleftrightarrow":"↮","nLeftrightarrow":"⇎","nleq":"≰","nleqq":"≦̸","nleqslant":"⩽̸","nles":"⩽̸","nless":"≮","nLl":"⋘̸","nlsim":"≴","nLt":"≪⃒","nlt":"≮","nltri":"⋪","nltrie":"⋬","nLtv":"≪̸","nmid":"∤","NoBreak":"","NonBreakingSpace":" ","nopf":"𝕟","Nopf":"ℕ","Not":"⫬","not":"¬","NotCongruent":"≢","NotCupCap":"≭","NotDoubleVerticalBar":"∦","NotElement":"∉","NotEqual":"≠","NotEqualTilde":"≂̸","NotExists":"∄","NotGreater":"≯","NotGreaterEqual":"≱","NotGreaterFullEqual":"≧̸","NotGreaterGreater":"≫̸","NotGreaterLess":"≹","NotGreaterSlantEqual":"⩾̸","NotGreaterTilde":"≵","NotHumpDownHump":"≎̸","NotHumpEqual":"≏̸","notin":"∉","notindot":"⋵̸","notinE":"⋹̸","notinva":"∉","notinvb":"⋷","notinvc":"⋶","NotLeftTriangleBar":"⧏̸","NotLeftTriangle":"⋪","NotLeftTriangleEqual":"⋬","NotLess":"≮","NotLessEqual":"≰","NotLessGreater":"≸","NotLessLess":"≪̸","NotLessSlantEqual":"⩽̸","NotLessTilde":"≴","NotNestedGreaterGreater":"⪢̸","NotNestedLessLess":"⪡̸","notni":"∌","notniva":"∌","notnivb":"⋾","notnivc":"⋽","NotPrecedes":"⊀","NotPrecedesEqual":"⪯̸","NotPrecedesSlantEqual":"⋠","NotReverseElement":"∌","NotRightTriangleBar":"⧐̸","NotRightTriangle":"⋫","NotRightTriangleEqual":"⋭","NotSquareSubset":"⊏̸","NotSquareSubsetEqual":"⋢","NotSquareSuperset":"⊐̸","NotSquareSupersetEqual":"⋣","NotSubset":"⊂⃒","NotSubsetEqual":"⊈","NotSucceeds":"⊁","NotSucceedsEqual":"⪰̸","NotSucceedsSlantEqual":"⋡","NotSucceedsTilde":"≿̸","NotSuperset":"⊃⃒","NotSupersetEqual":"⊉","NotTilde":"≁","NotTildeEqual":"≄","NotTildeFullEqual":"≇","NotTildeTilde":"≉","NotVerticalBar":"∤","nparallel":"∦","npar":"∦","nparsl":"⫽⃥","npart":"∂̸","npolint":"⨔","npr":"⊀","nprcue":"⋠","nprec":"⊀","npreceq":"⪯̸","npre":"⪯̸","nrarrc":"⤳̸","nrarr":"↛","nrArr":"⇏","nrarrw":"↝̸","nrightarrow":"↛","nRightarrow":"⇏","nrtri":"⋫","nrtrie":"⋭","nsc":"⊁","nsccue":"⋡","nsce":"⪰̸","Nscr":"𝒩","nscr":"𝓃","nshortmid":"∤","nshortparallel":"∦","nsim":"≁","nsime":"≄","nsimeq":"≄","nsmid":"∤","nspar":"∦","nsqsube":"⋢","nsqsupe":"⋣","nsub":"⊄","nsubE":"⫅̸","nsube":"⊈","nsubset":"⊂⃒","nsubseteq":"⊈","nsubseteqq":"⫅̸","nsucc":"⊁","nsucceq":"⪰̸","nsup":"⊅","nsupE":"⫆̸","nsupe":"⊉","nsupset":"⊃⃒","nsupseteq":"⊉","nsupseteqq":"⫆̸","ntgl":"≹","Ntilde":"Ñ","ntilde":"ñ","ntlg":"≸","ntriangleleft":"⋪","ntrianglelefteq":"⋬","ntriangleright":"⋫","ntrianglerighteq":"⋭","Nu":"Ν","nu":"ν","num":"#","numero":"№","numsp":" ","nvap":"≍⃒","nvdash":"⊬","nvDash":"⊭","nVdash":"⊮","nVDash":"⊯","nvge":"≥⃒","nvgt":">⃒","nvHarr":"⤄","nvinfin":"⧞","nvlArr":"⤂","nvle":"≤⃒","nvlt":"<⃒","nvltrie":"⊴⃒","nvrArr":"⤃","nvrtrie":"⊵⃒","nvsim":"∼⃒","nwarhk":"⤣","nwarr":"↖","nwArr":"⇖","nwarrow":"↖","nwnear":"⤧","Oacute":"Ó","oacute":"ó","oast":"⊛","Ocirc":"Ô","ocirc":"ô","ocir":"⊚","Ocy":"О","ocy":"о","odash":"⊝","Odblac":"Ő","odblac":"ő","odiv":"⨸","odot":"⊙","odsold":"⦼","OElig":"Œ","oelig":"œ","ofcir":"⦿","Ofr":"𝔒","ofr":"𝔬","ogon":"˛","Ograve":"Ò","ograve":"ò","ogt":"⧁","ohbar":"⦵","ohm":"Ω","oint":"∮","olarr":"↺","olcir":"⦾","olcross":"⦻","oline":"‾","olt":"⧀","Omacr":"Ō","omacr":"ō","Omega":"Ω","omega":"ω","Omicron":"Ο","omicron":"ο","omid":"⦶","ominus":"⊖","Oopf":"𝕆","oopf":"𝕠","opar":"⦷","OpenCurlyDoubleQuote":"“","OpenCurlyQuote":"‘","operp":"⦹","oplus":"⊕","orarr":"↻","Or":"⩔","or":"∨","ord":"⩝","order":"ℴ","orderof":"ℴ","ordf":"ª","ordm":"º","origof":"⊶","oror":"⩖","orslope":"⩗","orv":"⩛","oS":"Ⓢ","Oscr":"𝒪","oscr":"ℴ","Oslash":"Ø","oslash":"ø","osol":"⊘","Otilde":"Õ","otilde":"õ","otimesas":"⨶","Otimes":"⨷","otimes":"⊗","Ouml":"Ö","ouml":"ö","ovbar":"⌽","OverBar":"‾","OverBrace":"⏞","OverBracket":"⎴","OverParenthesis":"⏜","para":"¶","parallel":"∥","par":"∥","parsim":"⫳","parsl":"⫽","part":"∂","PartialD":"∂","Pcy":"П","pcy":"п","percnt":"%","period":".","permil":"‰","perp":"⊥","pertenk":"‱","Pfr":"𝔓","pfr":"𝔭","Phi":"Φ","phi":"φ","phiv":"ϕ","phmmat":"ℳ","phone":"☎","Pi":"Π","pi":"π","pitchfork":"⋔","piv":"ϖ","planck":"ℏ","planckh":"ℎ","plankv":"ℏ","plusacir":"⨣","plusb":"⊞","pluscir":"⨢","plus":"+","plusdo":"∔","plusdu":"⨥","pluse":"⩲","PlusMinus":"±","plusmn":"±","plussim":"⨦","plustwo":"⨧","pm":"±","Poincareplane":"ℌ","pointint":"⨕","popf":"𝕡","Popf":"ℙ","pound":"£","prap":"⪷","Pr":"⪻","pr":"≺","prcue":"≼","precapprox":"⪷","prec":"≺","preccurlyeq":"≼","Precedes":"≺","PrecedesEqual":"⪯","PrecedesSlantEqual":"≼","PrecedesTilde":"≾","preceq":"⪯","precnapprox":"⪹","precneqq":"⪵","precnsim":"⋨","pre":"⪯","prE":"⪳","precsim":"≾","prime":"′","Prime":"″","primes":"ℙ","prnap":"⪹","prnE":"⪵","prnsim":"⋨","prod":"∏","Product":"∏","profalar":"⌮","profline":"⌒","profsurf":"⌓","prop":"∝","Proportional":"∝","Proportion":"∷","propto":"∝","prsim":"≾","prurel":"⊰","Pscr":"𝒫","pscr":"𝓅","Psi":"Ψ","psi":"ψ","puncsp":" ","Qfr":"𝔔","qfr":"𝔮","qint":"⨌","qopf":"𝕢","Qopf":"ℚ","qprime":"⁗","Qscr":"𝒬","qscr":"𝓆","quaternions":"ℍ","quatint":"⨖","quest":"?","questeq":"≟","quot":"\\"","QUOT":"\\"","rAarr":"⇛","race":"∽̱","Racute":"Ŕ","racute":"ŕ","radic":"√","raemptyv":"⦳","rang":"⟩","Rang":"⟫","rangd":"⦒","range":"⦥","rangle":"⟩","raquo":"»","rarrap":"⥵","rarrb":"⇥","rarrbfs":"⤠","rarrc":"⤳","rarr":"→","Rarr":"↠","rArr":"⇒","rarrfs":"⤞","rarrhk":"↪","rarrlp":"↬","rarrpl":"⥅","rarrsim":"⥴","Rarrtl":"⤖","rarrtl":"↣","rarrw":"↝","ratail":"⤚","rAtail":"⤜","ratio":"∶","rationals":"ℚ","rbarr":"⤍","rBarr":"⤏","RBarr":"⤐","rbbrk":"❳","rbrace":"}","rbrack":"]","rbrke":"⦌","rbrksld":"⦎","rbrkslu":"⦐","Rcaron":"Ř","rcaron":"ř","Rcedil":"Ŗ","rcedil":"ŗ","rceil":"⌉","rcub":"}","Rcy":"Р","rcy":"р","rdca":"⤷","rdldhar":"⥩","rdquo":"”","rdquor":"”","rdsh":"↳","real":"ℜ","realine":"ℛ","realpart":"ℜ","reals":"ℝ","Re":"ℜ","rect":"▭","reg":"®","REG":"®","ReverseElement":"∋","ReverseEquilibrium":"⇋","ReverseUpEquilibrium":"⥯","rfisht":"⥽","rfloor":"⌋","rfr":"𝔯","Rfr":"ℜ","rHar":"⥤","rhard":"⇁","rharu":"⇀","rharul":"⥬","Rho":"Ρ","rho":"ρ","rhov":"ϱ","RightAngleBracket":"⟩","RightArrowBar":"⇥","rightarrow":"→","RightArrow":"→","Rightarrow":"⇒","RightArrowLeftArrow":"⇄","rightarrowtail":"↣","RightCeiling":"⌉","RightDoubleBracket":"⟧","RightDownTeeVector":"⥝","RightDownVectorBar":"⥕","RightDownVector":"⇂","RightFloor":"⌋","rightharpoondown":"⇁","rightharpoonup":"⇀","rightleftarrows":"⇄","rightleftharpoons":"⇌","rightrightarrows":"⇉","rightsquigarrow":"↝","RightTeeArrow":"↦","RightTee":"⊢","RightTeeVector":"⥛","rightthreetimes":"⋌","RightTriangleBar":"⧐","RightTriangle":"⊳","RightTriangleEqual":"⊵","RightUpDownVector":"⥏","RightUpTeeVector":"⥜","RightUpVectorBar":"⥔","RightUpVector":"↾","RightVectorBar":"⥓","RightVector":"⇀","ring":"˚","risingdotseq":"≓","rlarr":"⇄","rlhar":"⇌","rlm":"","rmoustache":"⎱","rmoust":"⎱","rnmid":"⫮","roang":"⟭","roarr":"⇾","robrk":"⟧","ropar":"⦆","ropf":"𝕣","Ropf":"ℝ","roplus":"⨮","rotimes":"⨵","RoundImplies":"⥰","rpar":")","rpargt":"⦔","rppolint":"⨒","rrarr":"⇉","Rrightarrow":"⇛","rsaquo":"›","rscr":"𝓇","Rscr":"ℛ","rsh":"↱","Rsh":"↱","rsqb":"]","rsquo":"’","rsquor":"’","rthree":"⋌","rtimes":"⋊","rtri":"▹","rtrie":"⊵","rtrif":"▸","rtriltri":"⧎","RuleDelayed":"⧴","ruluhar":"⥨","rx":"℞","Sacute":"Ś","sacute":"ś","sbquo":"‚","scap":"⪸","Scaron":"Š","scaron":"š","Sc":"⪼","sc":"≻","sccue":"≽","sce":"⪰","scE":"⪴","Scedil":"Ş","scedil":"ş","Scirc":"Ŝ","scirc":"ŝ","scnap":"⪺","scnE":"⪶","scnsim":"⋩","scpolint":"⨓","scsim":"≿","Scy":"С","scy":"с","sdotb":"⊡","sdot":"⋅","sdote":"⩦","searhk":"⤥","searr":"↘","seArr":"⇘","searrow":"↘","sect":"§","semi":";","seswar":"⤩","setminus":"∖","setmn":"∖","sext":"✶","Sfr":"𝔖","sfr":"𝔰","sfrown":"⌢","sharp":"♯","SHCHcy":"Щ","shchcy":"щ","SHcy":"Ш","shcy":"ш","ShortDownArrow":"↓","ShortLeftArrow":"←","shortmid":"∣","shortparallel":"∥","ShortRightArrow":"→","ShortUpArrow":"↑","shy":"","Sigma":"Σ","sigma":"σ","sigmaf":"ς","sigmav":"ς","sim":"∼","simdot":"⩪","sime":"≃","simeq":"≃","simg":"⪞","simgE":"⪠","siml":"⪝","simlE":"⪟","simne":"≆","simplus":"⨤","simrarr":"⥲","slarr":"←","SmallCircle":"∘","smallsetminus":"∖","smashp":"⨳","smeparsl":"⧤","smid":"∣","smile":"⌣","smt":"⪪","smte":"⪬","smtes":"⪬︀","SOFTcy":"Ь","softcy":"ь","solbar":"⌿","solb":"⧄","sol":"/","Sopf":"𝕊","sopf":"𝕤","spades":"♠","spadesuit":"♠","spar":"∥","sqcap":"⊓","sqcaps":"⊓︀","sqcup":"⊔","sqcups":"⊔︀","Sqrt":"√","sqsub":"⊏","sqsube":"⊑","sqsubset":"⊏","sqsubseteq":"⊑","sqsup":"⊐","sqsupe":"⊒","sqsupset":"⊐","sqsupseteq":"⊒","square":"□","Square":"□","SquareIntersection":"⊓","SquareSubset":"⊏","SquareSubsetEqual":"⊑","SquareSuperset":"⊐","SquareSupersetEqual":"⊒","SquareUnion":"⊔","squarf":"▪","squ":"□","squf":"▪","srarr":"→","Sscr":"𝒮","sscr":"𝓈","ssetmn":"∖","ssmile":"⌣","sstarf":"⋆","Star":"⋆","star":"☆","starf":"★","straightepsilon":"ϵ","straightphi":"ϕ","strns":"¯","sub":"⊂","Sub":"⋐","subdot":"⪽","subE":"⫅","sube":"⊆","subedot":"⫃","submult":"⫁","subnE":"⫋","subne":"⊊","subplus":"⪿","subrarr":"⥹","subset":"⊂","Subset":"⋐","subseteq":"⊆","subseteqq":"⫅","SubsetEqual":"⊆","subsetneq":"⊊","subsetneqq":"⫋","subsim":"⫇","subsub":"⫕","subsup":"⫓","succapprox":"⪸","succ":"≻","succcurlyeq":"≽","Succeeds":"≻","SucceedsEqual":"⪰","SucceedsSlantEqual":"≽","SucceedsTilde":"≿","succeq":"⪰","succnapprox":"⪺","succneqq":"⪶","succnsim":"⋩","succsim":"≿","SuchThat":"∋","sum":"∑","Sum":"∑","sung":"♪","sup1":"¹","sup2":"²","sup3":"³","sup":"⊃","Sup":"⋑","supdot":"⪾","supdsub":"⫘","supE":"⫆","supe":"⊇","supedot":"⫄","Superset":"⊃","SupersetEqual":"⊇","suphsol":"⟉","suphsub":"⫗","suplarr":"⥻","supmult":"⫂","supnE":"⫌","supne":"⊋","supplus":"⫀","supset":"⊃","Supset":"⋑","supseteq":"⊇","supseteqq":"⫆","supsetneq":"⊋","supsetneqq":"⫌","supsim":"⫈","supsub":"⫔","supsup":"⫖","swarhk":"⤦","swarr":"↙","swArr":"⇙","swarrow":"↙","swnwar":"⤪","szlig":"ß","Tab":"\\t","target":"⌖","Tau":"Τ","tau":"τ","tbrk":"⎴","Tcaron":"Ť","tcaron":"ť","Tcedil":"Ţ","tcedil":"ţ","Tcy":"Т","tcy":"т","tdot":"⃛","telrec":"⌕","Tfr":"𝔗","tfr":"𝔱","there4":"∴","therefore":"∴","Therefore":"∴","Theta":"Θ","theta":"θ","thetasym":"ϑ","thetav":"ϑ","thickapprox":"≈","thicksim":"∼","ThickSpace":" ","ThinSpace":" ","thinsp":" ","thkap":"≈","thksim":"∼","THORN":"Þ","thorn":"þ","tilde":"˜","Tilde":"∼","TildeEqual":"≃","TildeFullEqual":"≅","TildeTilde":"≈","timesbar":"⨱","timesb":"⊠","times":"×","timesd":"⨰","tint":"∭","toea":"⤨","topbot":"⌶","topcir":"⫱","top":"⊤","Topf":"𝕋","topf":"𝕥","topfork":"⫚","tosa":"⤩","tprime":"‴","trade":"™","TRADE":"™","triangle":"▵","triangledown":"▿","triangleleft":"◃","trianglelefteq":"⊴","triangleq":"≜","triangleright":"▹","trianglerighteq":"⊵","tridot":"◬","trie":"≜","triminus":"⨺","TripleDot":"⃛","triplus":"⨹","trisb":"⧍","tritime":"⨻","trpezium":"⏢","Tscr":"𝒯","tscr":"𝓉","TScy":"Ц","tscy":"ц","TSHcy":"Ћ","tshcy":"ћ","Tstrok":"Ŧ","tstrok":"ŧ","twixt":"≬","twoheadleftarrow":"↞","twoheadrightarrow":"↠","Uacute":"Ú","uacute":"ú","uarr":"↑","Uarr":"↟","uArr":"⇑","Uarrocir":"⥉","Ubrcy":"Ў","ubrcy":"ў","Ubreve":"Ŭ","ubreve":"ŭ","Ucirc":"Û","ucirc":"û","Ucy":"У","ucy":"у","udarr":"⇅","Udblac":"Ű","udblac":"ű","udhar":"⥮","ufisht":"⥾","Ufr":"𝔘","ufr":"𝔲","Ugrave":"Ù","ugrave":"ù","uHar":"⥣","uharl":"↿","uharr":"↾","uhblk":"▀","ulcorn":"⌜","ulcorner":"⌜","ulcrop":"⌏","ultri":"◸","Umacr":"Ū","umacr":"ū","uml":"¨","UnderBar":"_","UnderBrace":"⏟","UnderBracket":"⎵","UnderParenthesis":"⏝","Union":"⋃","UnionPlus":"⊎","Uogon":"Ų","uogon":"ų","Uopf":"𝕌","uopf":"𝕦","UpArrowBar":"⤒","uparrow":"↑","UpArrow":"↑","Uparrow":"⇑","UpArrowDownArrow":"⇅","updownarrow":"↕","UpDownArrow":"↕","Updownarrow":"⇕","UpEquilibrium":"⥮","upharpoonleft":"↿","upharpoonright":"↾","uplus":"⊎","UpperLeftArrow":"↖","UpperRightArrow":"↗","upsi":"υ","Upsi":"ϒ","upsih":"ϒ","Upsilon":"Υ","upsilon":"υ","UpTeeArrow":"↥","UpTee":"⊥","upuparrows":"⇈","urcorn":"⌝","urcorner":"⌝","urcrop":"⌎","Uring":"Ů","uring":"ů","urtri":"◹","Uscr":"𝒰","uscr":"𝓊","utdot":"⋰","Utilde":"Ũ","utilde":"ũ","utri":"▵","utrif":"▴","uuarr":"⇈","Uuml":"Ü","uuml":"ü","uwangle":"⦧","vangrt":"⦜","varepsilon":"ϵ","varkappa":"ϰ","varnothing":"∅","varphi":"ϕ","varpi":"ϖ","varpropto":"∝","varr":"↕","vArr":"⇕","varrho":"ϱ","varsigma":"ς","varsubsetneq":"⊊︀","varsubsetneqq":"⫋︀","varsupsetneq":"⊋︀","varsupsetneqq":"⫌︀","vartheta":"ϑ","vartriangleleft":"⊲","vartriangleright":"⊳","vBar":"⫨","Vbar":"⫫","vBarv":"⫩","Vcy":"В","vcy":"в","vdash":"⊢","vDash":"⊨","Vdash":"⊩","VDash":"⊫","Vdashl":"⫦","veebar":"⊻","vee":"∨","Vee":"⋁","veeeq":"≚","vellip":"⋮","verbar":"|","Verbar":"‖","vert":"|","Vert":"‖","VerticalBar":"∣","VerticalLine":"|","VerticalSeparator":"❘","VerticalTilde":"≀","VeryThinSpace":" ","Vfr":"𝔙","vfr":"𝔳","vltri":"⊲","vnsub":"⊂⃒","vnsup":"⊃⃒","Vopf":"𝕍","vopf":"𝕧","vprop":"∝","vrtri":"⊳","Vscr":"𝒱","vscr":"𝓋","vsubnE":"⫋︀","vsubne":"⊊︀","vsupnE":"⫌︀","vsupne":"⊋︀","Vvdash":"⊪","vzigzag":"⦚","Wcirc":"Ŵ","wcirc":"ŵ","wedbar":"⩟","wedge":"∧","Wedge":"⋀","wedgeq":"≙","weierp":"℘","Wfr":"𝔚","wfr":"𝔴","Wopf":"𝕎","wopf":"𝕨","wp":"℘","wr":"≀","wreath":"≀","Wscr":"𝒲","wscr":"𝓌","xcap":"⋂","xcirc":"◯","xcup":"⋃","xdtri":"▽","Xfr":"𝔛","xfr":"𝔵","xharr":"⟷","xhArr":"⟺","Xi":"Ξ","xi":"ξ","xlarr":"⟵","xlArr":"⟸","xmap":"⟼","xnis":"⋻","xodot":"⨀","Xopf":"𝕏","xopf":"𝕩","xoplus":"⨁","xotime":"⨂","xrarr":"⟶","xrArr":"⟹","Xscr":"𝒳","xscr":"𝓍","xsqcup":"⨆","xuplus":"⨄","xutri":"△","xvee":"⋁","xwedge":"⋀","Yacute":"Ý","yacute":"ý","YAcy":"Я","yacy":"я","Ycirc":"Ŷ","ycirc":"ŷ","Ycy":"Ы","ycy":"ы","yen":"¥","Yfr":"𝔜","yfr":"𝔶","YIcy":"Ї","yicy":"ї","Yopf":"𝕐","yopf":"𝕪","Yscr":"𝒴","yscr":"𝓎","YUcy":"Ю","yucy":"ю","yuml":"ÿ","Yuml":"Ÿ","Zacute":"Ź","zacute":"ź","Zcaron":"Ž","zcaron":"ž","Zcy":"З","zcy":"з","Zdot":"Ż","zdot":"ż","zeetrf":"ℨ","ZeroWidthSpace":"","Zeta":"Ζ","zeta":"ζ","zfr":"𝔷","Zfr":"ℨ","ZHcy":"Ж","zhcy":"ж","zigrarr":"⇝","zopf":"𝕫","Zopf":"ℤ","Zscr":"𝒵","zscr":"𝓏","zwj":"","zwnj":""}');
- /***/ }),
- /***/ 9591:
- /***/ ((module) => {
- module.exports = JSON.parse('{"Aacute":"Á","aacute":"á","Acirc":"Â","acirc":"â","acute":"´","AElig":"Æ","aelig":"æ","Agrave":"À","agrave":"à","amp":"&","AMP":"&","Aring":"Å","aring":"å","Atilde":"Ã","atilde":"ã","Auml":"Ä","auml":"ä","brvbar":"¦","Ccedil":"Ç","ccedil":"ç","cedil":"¸","cent":"¢","copy":"©","COPY":"©","curren":"¤","deg":"°","divide":"÷","Eacute":"É","eacute":"é","Ecirc":"Ê","ecirc":"ê","Egrave":"È","egrave":"è","ETH":"Ð","eth":"ð","Euml":"Ë","euml":"ë","frac12":"½","frac14":"¼","frac34":"¾","gt":">","GT":">","Iacute":"Í","iacute":"í","Icirc":"Î","icirc":"î","iexcl":"¡","Igrave":"Ì","igrave":"ì","iquest":"¿","Iuml":"Ï","iuml":"ï","laquo":"«","lt":"<","LT":"<","macr":"¯","micro":"µ","middot":"·","nbsp":" ","not":"¬","Ntilde":"Ñ","ntilde":"ñ","Oacute":"Ó","oacute":"ó","Ocirc":"Ô","ocirc":"ô","Ograve":"Ò","ograve":"ò","ordf":"ª","ordm":"º","Oslash":"Ø","oslash":"ø","Otilde":"Õ","otilde":"õ","Ouml":"Ö","ouml":"ö","para":"¶","plusmn":"±","pound":"£","quot":"\\"","QUOT":"\\"","raquo":"»","reg":"®","REG":"®","sect":"§","shy":"","sup1":"¹","sup2":"²","sup3":"³","szlig":"ß","THORN":"Þ","thorn":"þ","times":"×","Uacute":"Ú","uacute":"ú","Ucirc":"Û","ucirc":"û","Ugrave":"Ù","ugrave":"ù","uml":"¨","Uuml":"Ü","uuml":"ü","Yacute":"Ý","yacute":"ý","yen":"¥","yuml":"ÿ"}');
- /***/ }),
- /***/ 2586:
- /***/ ((module) => {
- module.exports = JSON.parse('{"amp":"&","apos":"\'","gt":">","lt":"<","quot":"\\""}');
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ id: moduleId,
- /******/ loaded: false,
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
- /******/
- /******/ // Flag the module as loaded
- /******/ module.loaded = true;
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/compat get default export */
- /******/ (() => {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = (module) => {
- /******/ var getter = module && module.__esModule ?
- /******/ () => (module['default']) :
- /******/ () => (module);
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ (() => {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = (exports, definition) => {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/global */
- /******/ (() => {
- /******/ __webpack_require__.g = (function() {
- /******/ if (typeof globalThis === 'object') return globalThis;
- /******/ try {
- /******/ return this || new Function('return this')();
- /******/ } catch (e) {
- /******/ if (typeof window === 'object') return window;
- /******/ }
- /******/ })();
- /******/ })();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ (() => {
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
- /******/ })();
- /******/
- /******/ /* webpack/runtime/make namespace object */
- /******/ (() => {
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = (exports) => {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/node module decorator */
- /******/ (() => {
- /******/ __webpack_require__.nmd = (module) => {
- /******/ module.paths = [];
- /******/ if (!module.children) module.children = [];
- /******/ return module;
- /******/ };
- /******/ })();
- /******/
- /************************************************************************/
- var __webpack_exports__ = {};
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
- (() => {
- "use strict";
- __webpack_require__(2234);
- __webpack_require__(6760);
- __webpack_require__(8299);
- if (__webpack_require__.g._babelPolyfill) {
- throw new Error("only one instance of babel-polyfill is allowed");
- }
- __webpack_require__.g._babelPolyfill = true;
- var DEFINE_PROPERTY = "defineProperty";
- function define(O, key, value) {
- O[key] || Object[DEFINE_PROPERTY](O, key, {
- writable: true,
- configurable: true,
- value: value
- });
- }
- define(String.prototype, "padLeft", "".padStart);
- define(String.prototype, "padRight", "".padEnd);
- "pop,reverse,shift,keys,values,entries,indexOf,every,some,forEach,map,filter,find,findIndex,includes,join,slice,concat,push,splice,unshift,sort,lastIndexOf,reduce,reduceRight,copyWithin,fill".split(",").forEach(function (key) {
- [][key] && define(Array, key, Function.call.bind([][key]));
- });
- })();
- // This entry need to be wrapped in an IIFE because it need to be in strict mode.
- (() => {
- "use strict";
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "Sanitizer": () => (/* binding */ Sanitizer),
- /* harmony export */ "defaultSanitizer": () => (/* binding */ defaultSanitizer)
- /* harmony export */ });
- /* harmony import */ var sanitize_html__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6482);
- /* harmony import */ var sanitize_html__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(sanitize_html__WEBPACK_IMPORTED_MODULE_0__);
- var _templateObject, _templateObject2, _templateObject3, _templateObject4;
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
- function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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, _toPropertyKey(descriptor.key), descriptor); } }
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
- function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
- function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // sanitize-html uses the url package, so we depend on a standalone version of
- // it which acts as a polyfill for browsers.
- /**
- * Helper class that contains regular expressions for inline CSS style validation.
- *
- * Which properties (and values) to allow is largely based on the Google Caja project:
- * https://github.com/google/caja
- *
- * The regular expressions are largly based on the syntax definition found at
- * https://developer.mozilla.org/en-US/docs/Web/CSS.
- */
- var CssProp = /*#__PURE__*/function () {
- function CssProp() {
- _classCallCheck(this, CssProp);
- }
- _createClass(CssProp, null, [{
- key: "reg",
- value: function reg(r) {
- return new RegExp('^' + r + '$', 'i');
- }
- }]);
- return CssProp;
- }();
- /*
- * Numeric base expressions used to help build more complex regular expressions
- */
- CssProp.N = {
- integer: "[+-]?[0-9]+",
- integer_pos: "[+]?[0-9]+",
- integer_zero_ff: "([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])",
- number: "[+-]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?",
- number_pos: "[+]?([0-9]*[.])?[0-9]+(e-?[0-9]*)?",
- number_zero_hundred: "[+]?(([0-9]|[1-9][0-9])([.][0-9]+)?|100)",
- number_zero_one: "[+]?(1([.][0]+)?|0?([.][0-9]+)?)"
- };
- /*
- * Base expressions of common CSS syntax elements
- */
- CssProp.B = {
- angle: "(".concat(CssProp.N.number, "(deg|rad|grad|turn)|0)"),
- frequency: "".concat(CssProp.N.number, "(Hz|kHz)"),
- ident: String.raw(_templateObject || (_templateObject = _taggedTemplateLiteral(["-?([_a-z]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])([_a-z0-9-]|[\xA0-\xFF]|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*"], ["-?([_a-z]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])([_a-z0-9-]|[\\xA0-\\xFF]|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*"]))),
- len_or_perc: "(0|".concat(CssProp.N.number, "(px|em|rem|ex|in|cm|mm|pt|pc|%))"),
- length: "(".concat(CssProp.N.number, "(px|em|rem|ex|in|cm|mm|pt|pc)|0)"),
- length_pos: "(".concat(CssProp.N.number_pos, "(px|em|rem|ex|in|cm|mm|pt|pc)|0)"),
- percentage: "".concat(CssProp.N.number, "%"),
- percentage_pos: "".concat(CssProp.N.number_pos, "%"),
- percentage_zero_hundred: "".concat(CssProp.N.number_zero_hundred, "%"),
- string: String.raw(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["(\"([^\n\r\f\\\"]|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*\")|('([^\n\r\f\\']|\\\n|\r\n|\r|\f|\\[0-9a-f]{1,6}(\r\n|[ \t\r\n\f])?|\\[^\r\n\f0-9a-f])*')"], ["(\\\"([^\\n\\r\\f\\\\\"]|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\\")|(\\'([^\\n\\r\\f\\\\']|\\\\\\n|\\r\\n|\\r|\\f|\\\\[0-9a-f]{1,6}(\\r\\n|[ \\t\\r\\n\\f])?|\\\\[^\\r\\n\\f0-9a-f])*\\')"]))),
- time: "".concat(CssProp.N.number, "(s|ms)"),
- url: "url\\(.*?\\)",
- z_index: "[+-]?[0-9]{1,7}"
- };
- /*
- * Atomic (i.e. not dependant on other regular expressions) sub RegEx segments
- */
- CssProp.A = {
- absolute_size: "xx-small|x-small|small|medium|large|x-large|xx-large",
- attachment: "scroll|fixed|local",
- bg_origin: "border-box|padding-box|content-box",
- border_style: "none|hidden|dotted|dashed|solid|double|groove|ridge|inset|outset",
- box: "border-box|padding-box|content-box",
- display_inside: "auto|block|table|flex|grid",
- display_outside: "block-level|inline-level|none|table-row-group|table-header-group|table-footer-group|table-row|table-cell|table-column-group|table-column|table-caption",
- ending_shape: "circle|ellipse",
- generic_family: "serif|sans-serif|cursive|fantasy|monospace",
- generic_voice: "male|female|child",
- relative_size: "smaller|larger",
- repeat_style: "repeat-x|repeat-y|((?:repeat|space|round|no-repeat)(?:\\s*(?:repeat|space|round|no-repeat))?)",
- side_or_corner: "(left|right)?\\s*(top|bottom)?",
- single_animation_direction: "normal|reverse|alternate|alternate-reverse",
- single_animation_fill_mode: "none|forwards|backwards|both",
- single_animation_play_state: "running|paused"
- };
- /*
- * Color definition sub expressions
- */
- CssProp._COLOR = {
- hex: "\\#(0x)?[0-9a-f]+",
- name: "aliceblue|antiquewhite|aqua|aquamarine|azure|beige|bisque|black|blanchedalmond|blue|blueviolet|brown|burlywood|cadetblue|chartreuse|chocolate|coral|cornflowerblue|cornsilk|crimson|cyan|darkblue|darkcyan|darkgoldenrod|darkgray|darkgreen|darkkhaki|darkmagenta|darkolivegreen|darkorange|darkorchid|darkred|darksalmon|darkseagreen|darkslateblue|darkslategray|darkturquoise|darkviolet|deeppink|deepskyblue|dimgray|dodgerblue|firebrick|floralwhite|forestgreen|fuchsia|gainsboro|ghostwhite|gold|goldenrod|gray|green|greenyellow|honeydew|hotpink|indianred|indigo|ivory|khaki|lavender|lavenderblush|lawngreen|lemonchiffon|lightblue|lightcoral|lightcyan|lightgoldenrodyellow|lightgreen|lightgrey|lightpink|lightsalmon|lightseagreen|lightskyblue|lightslategray|lightsteelblue|lightyellow|lime|limegreen|linen|magenta|maroon|mediumaquamarine|mediumblue|mediumorchid|mediumpurple|mediumseagreen|mediumslateblue|mediumspringgreen|mediumturquoise|mediumvioletred|midnightblue|mintcream|mistyrose|moccasin|navajowhite|navy|oldlace|olive|olivedrab|orange|orangered|orchid|palegoldenrod|palegreen|paleturquoise|palevioletred|papayawhip|peachpuff|peru|pink|plum|powderblue|purple|red|rosybrown|royalblue|saddlebrown|salmon|sandybrown|seagreen|seashell|sienna|silver|skyblue|slateblue|slategray|snow|springgreen|steelblue|tan|teal|thistle|tomato|turquoise|transparent|violet|wheat|white|whitesmoke|yellow|yellowgreen",
- rgb: String.raw(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["rgb(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*)"], ["rgb\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*\\)"]))),
- rgba: String.raw(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["rgba(s*(d{1,3})s*,s*(d{1,3})s*,s*(d{1,3})s*,s*(", "|", "|", ")s*)"], ["rgba\\(\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(\\d{1,3})\\s*,\\s*(", "|", "|", ")\\s*\\)"])), CssProp.N.integer_zero_ff, CssProp.N.number_zero_one, CssProp.B.percentage_zero_hundred)
- };
- /*
- * Compound (i.e. dependant on other (sub) regular expressions) sub RegEx segments
- */
- CssProp._C = {
- alpha: "".concat(CssProp.N.integer_zero_ff, "|").concat(CssProp.N.number_zero_one, "|").concat(CssProp.B.percentage_zero_hundred),
- alphavalue: CssProp.N.number_zero_one,
- bg_position: "((".concat(CssProp.B.len_or_perc, "|left|center|right|top|bottom)\\s*){1,4}"),
- bg_size: "(".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage, "|auto){1,2}|cover|contain"),
- border_width: "thin|medium|thick|".concat(CssProp.B.length),
- bottom: "".concat(CssProp.B.length, "|auto"),
- color: "".concat(CssProp._COLOR.hex, "|").concat(CssProp._COLOR.rgb, "|").concat(CssProp._COLOR.rgba, "|").concat(CssProp._COLOR.name),
- color_stop_length: "(".concat(CssProp.B.len_or_perc, "\\s*){1,2}"),
- linear_color_hint: "".concat(CssProp.B.len_or_perc),
- family_name: "".concat(CssProp.B.string, "|(").concat(CssProp.B.ident, "\\s*)+"),
- image_decl: CssProp.B.url,
- left: "".concat(CssProp.B.length, "|auto"),
- loose_quotable_words: "(".concat(CssProp.B.ident, ")+"),
- margin_width: "".concat(CssProp.B.len_or_perc, "|auto"),
- padding_width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos),
- page_url: CssProp.B.url,
- position: "((".concat(CssProp.B.len_or_perc, "|left|center|right|top|bottom)\\s*){1,4}"),
- right: "".concat(CssProp.B.length, "|auto"),
- shadow: '',
- size: "closest-side|farthest-side|closest-corner|farthest-corner|".concat(CssProp.B.length, "|(").concat(CssProp.B.len_or_perc, ")\\s+(").concat(CssProp.B.len_or_perc, ")"),
- top: "".concat(CssProp.B.length, "|auto")
- };
- CssProp._C1 = {
- image_list: "image\\(\\s*(".concat(CssProp.B.url, ")*\\s*(").concat(CssProp.B.url, "|").concat(CssProp._C.color, ")\\s*\\)"),
- linear_color_stop: "(".concat(CssProp._C.color, ")(\\s*").concat(CssProp._C.color_stop_length, ")?"),
- shadow: "((".concat(CssProp._C.color, ")\\s+((").concat(CssProp.B.length, ")\\s*){2,4}(s+inset)?)|((inset\\s+)?((").concat(CssProp.B.length, ")\\s*){2,4}\\s*(").concat(CssProp._C.color, ")?)")
- };
- CssProp._C2 = {
- color_stop_list: "((".concat(CssProp._C1.linear_color_stop, ")(\\s*(").concat(CssProp._C.linear_color_hint, "))?\\s*,\\s*)+(").concat(CssProp._C1.linear_color_stop, ")"),
- shape: "rect\\(\\s*(".concat(CssProp._C.top, ")\\s*,\\s*(").concat(CssProp._C.right, ")\\s*,\\s*(").concat(CssProp._C.bottom, ")\\s*,\\s*(").concat(CssProp._C.left, ")\\s*\\)")
- };
- CssProp._C3 = {
- linear_gradient: "linear-gradient\\((((".concat(CssProp.B.angle, ")|to\\s+(").concat(CssProp.A.side_or_corner, "))\\s*,\\s*)?\\s*(").concat(CssProp._C2.color_stop_list, ")\\s*\\)"),
- radial_gradient: "radial-gradient\\(((((".concat(CssProp.A.ending_shape, ")|(").concat(CssProp._C.size, "))\\s*)*\\s*(at\\s+").concat(CssProp._C.position, ")?\\s*,\\s*)?\\s*(").concat(CssProp._C2.color_stop_list, ")\\s*\\)")
- };
- CssProp._C4 = {
- image: "".concat(CssProp.B.url, "|").concat(CssProp._C3.linear_gradient, "|").concat(CssProp._C3.radial_gradient, "|").concat(CssProp._C1.image_list),
- bg_image: "(".concat(CssProp.B.url, "|").concat(CssProp._C3.linear_gradient, "|").concat(CssProp._C3.radial_gradient, "|").concat(CssProp._C1.image_list, ")|none")
- };
- CssProp.C = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, CssProp._C), CssProp._C1), CssProp._C2), CssProp._C3), CssProp._C4);
- /*
- * Property value regular expressions not dependant on other sub expressions
- */
- CssProp.AP = {
- border_collapse: "collapse|separate",
- box: "normal|none|contents",
- box_sizing: "content-box|padding-box|border-box",
- caption_side: "top|bottom",
- clear: "none|left|right|both",
- direction: "ltr|rtl",
- empty_cells: "show|hide",
- "float": "left|right|none",
- font_stretch: "normal|wider|narrower|ultra-condensed|extra-condensed|condensed|semi-condensed|semi-expanded|expanded|extra-expanded|ultra-expanded",
- font_style: "normal|italic|oblique",
- font_variant: "normal|small-caps",
- font_weight: "normal|bold|bolder|lighter|100|200|300|400|500|600|700|800|900",
- list_style_position: "inside|outside",
- list_style_type: "disc|circle|square|decimal|decimal-leading-zero|lower-roman|upper-roman|lower-greek|lower-latin|upper-latin|armenian|georgian|lower-alpha|upper-alpha|none",
- overflow: "visible|hidden|scroll|auto",
- overflow_wrap: "normal|break-word",
- overflow_x: "visible|hidden|scroll|auto|no-display|no-content",
- page_break_after: "auto|always|avoid|left|right",
- page_break_before: "auto|always|avoid|left|right",
- page_break_inside: "avoid|auto",
- position: "static|relative|absolute",
- resize: "none|both|horizontal|vertical",
- speak: "normal|none|spell-out",
- speak_header: "once|always",
- speak_numeral: "digits|continuous",
- speak_punctuation: "code|none",
- table_layout: "auto|fixed",
- text_align: "left|right|center|justify",
- text_decoration: "none|((underline|overline|line-through|blink)\\s*)+",
- text_transform: "capitalize|uppercase|lowercase|none",
- text_wrap: "normal|unrestricted|none|suppress",
- unicode_bidi: "normal|embed|bidi-override",
- visibility: "visible|hidden|collapse",
- white_space: "normal|pre|nowrap|pre-wrap|pre-line",
- word_break: "normal|keep-all|break-all"
- };
- /*
- * Compound propertiy value regular expressions (i.e. dependant on other sub expressions)
- */
- CssProp._CP = {
- background_attachment: "".concat(CssProp.A.attachment, "(,\\s*").concat(CssProp.A.attachment, ")*"),
- background_color: CssProp.C.color,
- background_origin: "".concat(CssProp.A.box, "(,\\s*").concat(CssProp.A.box, ")*"),
- background_repeat: "".concat(CssProp.A.repeat_style, "(,\\s*").concat(CssProp.A.repeat_style, ")*"),
- border: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
- border_radius: "((".concat(CssProp.B.len_or_perc, ")\\s*){1,4}(\\/\\s*((").concat(CssProp.B.len_or_perc, ")\\s*){1,4})?"),
- border_spacing: "".concat(CssProp.B.length, "\\s*(").concat(CssProp.B.length, ")?"),
- border_top_color: CssProp.C.color,
- border_top_style: CssProp.A.border_style,
- border_width: "((".concat(CssProp.C.border_width, ")\\s*){1,4}"),
- color: CssProp.C.color,
- cursor: "(".concat(CssProp.B.url, "(\\s*,\\s*)?)*(auto|crosshair|default|pointer|move|e-resize|ne-resize|nw-resize|n-resize|se-resize|sw-resize|s-resize|w-resize|text|wait|help|progress|all-scroll|col-resize|hand|no-drop|not-allowed|row-resize|vertical-text)"),
- display: "inline|block|list-item|run-in|inline-list-item|inline-block|table|inline-table|table-cell|table-caption|flex|inline-flex|grid|inline-grid|".concat(CssProp.A.display_inside, "|").concat(CssProp.A.display_outside, "|inherit|inline-box|inline-stack"),
- display_outside: CssProp.A.display_outside,
- elevation: "".concat(CssProp.B.angle, "|below|level|above|higher|lower"),
- font_family: "(".concat(CssProp.C.family_name, "|").concat(CssProp.A.generic_family, ")(,\\s*(").concat(CssProp.C.family_name, "|").concat(CssProp.A.generic_family, "))*"),
- height: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "|auto"),
- letter_spacing: "normal|".concat(CssProp.B.length),
- list_style_image: "".concat(CssProp.C.image, "|none"),
- margin_right: CssProp.C.margin_width,
- max_height: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|none|auto"),
- min_height: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|auto"),
- opacity: CssProp.C.alphavalue,
- outline_color: "".concat(CssProp.C.color, "|invert"),
- outline_width: CssProp.C.border_width,
- padding: "((".concat(CssProp.C.padding_width, ")\\s*){1,4}"),
- padding_top: CssProp.C.padding_width,
- pitch_range: CssProp.N.number,
- right: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "|auto"),
- stress: CssProp.N.number,
- text_indent: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage),
- text_shadow: "none|".concat(CssProp.C.shadow, "(,\\s*(").concat(CssProp.C.shadow, "))*"),
- volume: "".concat(CssProp.N.number_pos, "|").concat(CssProp.B.percentage_pos, "|silent|x-soft|soft|medium|loud|x-loud"),
- word_wrap: CssProp.AP.overflow_wrap,
- zoom: "normal|".concat(CssProp.N.number_pos, "|").concat(CssProp.B.percentage_pos),
- backface_visibility: CssProp.AP.visibility,
- background_clip: "".concat(CssProp.A.box, "(,\\s*(").concat(CssProp.A.box, "))*"),
- background_position: "".concat(CssProp.C.bg_position, "(,\\s*(").concat(CssProp.C.bg_position, "))*"),
- border_bottom_color: CssProp.C.color,
- border_bottom_style: CssProp.A.border_style,
- border_color: "((".concat(CssProp.C.color, ")\\s*){1,4}"),
- border_left_color: CssProp.C.color,
- border_right_color: CssProp.C.color,
- border_style: "((".concat(CssProp.A.border_style, ")\\s*){1,4}"),
- border_top_left_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
- border_top_width: CssProp.C.border_width,
- box_shadow: "none|".concat(CssProp.C.shadow, "(,\\s*(").concat(CssProp.C.shadow, "))*"),
- clip: "".concat(CssProp.C.shape, "|auto"),
- display_inside: CssProp.A.display_inside,
- font_size: "".concat(CssProp.A.absolute_size, "|").concat(CssProp.A.relative_size, "|").concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos),
- line_height: "normal|".concat(CssProp.N.number_pos, "|").concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos),
- margin_left: CssProp.C.margin_width,
- max_width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|none|auto"),
- outline_style: CssProp.A.border_style,
- padding_bottom: CssProp.C.padding_width,
- padding_right: CssProp.C.padding_width,
- perspective: "none|".concat(CssProp.B.length),
- richness: CssProp.N.number,
- text_overflow: "((clip|ellipsis|".concat(CssProp.B.string, ")\\s*){1,2}"),
- top: "".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "|auto"),
- width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|auto"),
- z_index: "auto|".concat(CssProp.B.z_index),
- // Simplified background
- background: "(((".concat(CssProp.C.bg_position, "\\s*(\\/\\s*").concat(CssProp.C.bg_size, ")?)|(").concat(CssProp.A.repeat_style, ")|(").concat(CssProp.A.attachment, ")|(").concat(CssProp.A.bg_origin, ")|(").concat(CssProp.C.bg_image, ")|(").concat(CssProp.C.color, "))\\s*)+"),
- background_size: "".concat(CssProp.C.bg_size, "(,\\s*").concat(CssProp.C.bg_size, ")*"),
- border_bottom_left_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
- border_bottom_width: CssProp.C.border_width,
- border_left_style: CssProp.A.border_style,
- border_right_style: CssProp.A.border_style,
- border_top: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
- bottom: "".concat(CssProp.B.len_or_perc, "|auto"),
- list_style: "((".concat(CssProp.AP.list_style_type, "|").concat(CssProp.AP.list_style_position, "|").concat(CssProp.C.image, "|none})\\s*){1,3}"),
- margin_top: CssProp.C.margin_width,
- outline: "((".concat(CssProp.C.color, "|invert|").concat(CssProp.A.border_style, "|").concat(CssProp.C.border_width, ")\\s*){1,3}"),
- overflow_y: CssProp.AP.overflow_x,
- pitch: "".concat(CssProp.B.frequency, "|x-low|low|medium|high|x-high"),
- vertical_align: "baseline|sub|super|top|text-top|middle|bottom|text-bottom|".concat(CssProp.B.len_or_perc),
- word_spacing: "normal|".concat(CssProp.B.length),
- background_image: "".concat(CssProp.C.bg_image, "(,\\s*").concat(CssProp.C.bg_image, ")*"),
- border_bottom_right_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
- border_left_width: CssProp.C.border_width,
- border_right_width: CssProp.C.border_width,
- left: "".concat(CssProp.B.len_or_perc, "|auto"),
- margin_bottom: CssProp.C.margin_width,
- pause_after: "".concat(CssProp.B.time, "|").concat(CssProp.B.percentage),
- speech_rate: "".concat(CssProp.N.number, "|x-slow|slow|medium|fast|x-fast|faster|slower"),
- transition_duration: "".concat(CssProp.B.time, "(,\\s*").concat(CssProp.B.time, ")*"),
- border_bottom: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
- border_right: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
- margin: "((".concat(CssProp.C.margin_width, ")\\s*){1,4}"),
- padding_left: CssProp.C.padding_width,
- border_left: "((".concat(CssProp.C.border_width, "|").concat(CssProp.A.border_style, "|").concat(CssProp.C.color, ")\\s*){1,3}"),
- quotes: "(".concat(CssProp.B.string, "\\s*").concat(CssProp.B.string, ")+|none"),
- border_top_right_radius: "(".concat(CssProp.B.length, "|").concat(CssProp.B.percentage, ")(\\s*(").concat(CssProp.B.length, "|").concat(CssProp.B.percentage, "))?"),
- min_width: "".concat(CssProp.B.length_pos, "|").concat(CssProp.B.percentage_pos, "|auto")
- };
- CssProp._CP1 = {
- font: "(((((".concat(CssProp.AP.font_style, "|").concat(CssProp.AP.font_variant, "|").concat(CssProp.AP.font_weight, ")\\s*){1,3})?\\s*(").concat(CssProp._CP.font_size, ")\\s*(\\/\\s*(").concat(CssProp._CP.line_height, "))?\\s+(").concat(CssProp._CP.font_family, "))|caption|icon|menu|message-box|small-caption|status-bar)")
- };
- CssProp.CP = Object.assign(Object.assign({}, CssProp._CP), CssProp._CP1);
- // CSS Property value validation regular expressions for use with sanitize-html
- CssProp.BORDER_COLLAPSE = CssProp.reg(CssProp.AP.border_collapse);
- CssProp.BOX = CssProp.reg(CssProp.AP.box);
- CssProp.BOX_SIZING = CssProp.reg(CssProp.AP.box_sizing);
- CssProp.CAPTION_SIDE = CssProp.reg(CssProp.AP.caption_side);
- CssProp.CLEAR = CssProp.reg(CssProp.AP.clear);
- CssProp.DIRECTION = CssProp.reg(CssProp.AP.direction);
- CssProp.EMPTY_CELLS = CssProp.reg(CssProp.AP.empty_cells);
- CssProp.FLOAT = CssProp.reg(CssProp.AP["float"]);
- CssProp.FONT_STRETCH = CssProp.reg(CssProp.AP.font_stretch);
- CssProp.FONT_STYLE = CssProp.reg(CssProp.AP.font_style);
- CssProp.FONT_VARIANT = CssProp.reg(CssProp.AP.font_variant);
- CssProp.FONT_WEIGHT = CssProp.reg(CssProp.AP.font_weight);
- CssProp.LIST_STYLE_POSITION = CssProp.reg(CssProp.AP.list_style_position);
- CssProp.LIST_STYLE_TYPE = CssProp.reg(CssProp.AP.list_style_type);
- CssProp.OVERFLOW = CssProp.reg(CssProp.AP.overflow);
- CssProp.OVERFLOW_WRAP = CssProp.reg(CssProp.AP.overflow_wrap);
- CssProp.OVERFLOW_X = CssProp.reg(CssProp.AP.overflow_x);
- CssProp.PAGE_BREAK_AFTER = CssProp.reg(CssProp.AP.page_break_after);
- CssProp.PAGE_BREAK_BEFORE = CssProp.reg(CssProp.AP.page_break_before);
- CssProp.PAGE_BREAK_INSIDE = CssProp.reg(CssProp.AP.page_break_inside);
- CssProp.POSITION = CssProp.reg(CssProp.AP.position);
- CssProp.RESIZE = CssProp.reg(CssProp.AP.resize);
- CssProp.SPEAK = CssProp.reg(CssProp.AP.speak);
- CssProp.SPEAK_HEADER = CssProp.reg(CssProp.AP.speak_header);
- CssProp.SPEAK_NUMERAL = CssProp.reg(CssProp.AP.speak_numeral);
- CssProp.SPEAK_PUNCTUATION = CssProp.reg(CssProp.AP.speak_punctuation);
- CssProp.TABLE_LAYOUT = CssProp.reg(CssProp.AP.table_layout);
- CssProp.TEXT_ALIGN = CssProp.reg(CssProp.AP.text_align);
- CssProp.TEXT_DECORATION = CssProp.reg(CssProp.AP.text_decoration);
- CssProp.TEXT_TRANSFORM = CssProp.reg(CssProp.AP.text_transform);
- CssProp.TEXT_WRAP = CssProp.reg(CssProp.AP.text_wrap);
- CssProp.UNICODE_BIDI = CssProp.reg(CssProp.AP.unicode_bidi);
- CssProp.VISIBILITY = CssProp.reg(CssProp.AP.visibility);
- CssProp.WHITE_SPACE = CssProp.reg(CssProp.AP.white_space);
- CssProp.WORD_BREAK = CssProp.reg(CssProp.AP.word_break);
- CssProp.BACKGROUND_ATTACHMENT = CssProp.reg(CssProp.CP.background_attachment);
- CssProp.BACKGROUND_COLOR = CssProp.reg(CssProp.CP.background_color);
- CssProp.BACKGROUND_ORIGIN = CssProp.reg(CssProp.CP.background_origin);
- CssProp.BACKGROUND_REPEAT = CssProp.reg(CssProp.CP.background_repeat);
- CssProp.BORDER = CssProp.reg(CssProp.CP.border);
- CssProp.BORDER_RADIUS = CssProp.reg(CssProp.CP.border_radius);
- CssProp.BORDER_SPACING = CssProp.reg(CssProp.CP.border_spacing);
- CssProp.BORDER_TOP_COLOR = CssProp.reg(CssProp.CP.border_top_color);
- CssProp.BORDER_TOP_STYLE = CssProp.reg(CssProp.CP.border_top_style);
- CssProp.BORDER_WIDTH = CssProp.reg(CssProp.CP.border_width);
- CssProp.COLOR = CssProp.reg(CssProp.CP.color);
- CssProp.CURSOR = CssProp.reg(CssProp.CP.cursor);
- CssProp.DISPLAY = CssProp.reg(CssProp.CP.display);
- CssProp.DISPLAY_OUTSIDE = CssProp.reg(CssProp.CP.display_outside);
- CssProp.ELEVATION = CssProp.reg(CssProp.CP.elevation);
- CssProp.FONT_FAMILY = CssProp.reg(CssProp.CP.font_family);
- CssProp.HEIGHT = CssProp.reg(CssProp.CP.height);
- CssProp.LETTER_SPACING = CssProp.reg(CssProp.CP.letter_spacing);
- CssProp.LIST_STYLE_IMAGE = CssProp.reg(CssProp.CP.list_style_image);
- CssProp.MARGIN_RIGHT = CssProp.reg(CssProp.CP.margin_right);
- CssProp.MAX_HEIGHT = CssProp.reg(CssProp.CP.max_height);
- CssProp.MIN_HEIGHT = CssProp.reg(CssProp.CP.min_height);
- CssProp.OPACITY = CssProp.reg(CssProp.CP.opacity);
- CssProp.OUTLINE_COLOR = CssProp.reg(CssProp.CP.outline_color);
- CssProp.OUTLINE_WIDTH = CssProp.reg(CssProp.CP.outline_width);
- CssProp.PADDING = CssProp.reg(CssProp.CP.padding);
- CssProp.PADDING_TOP = CssProp.reg(CssProp.CP.padding_top);
- CssProp.PITCH_RANGE = CssProp.reg(CssProp.CP.pitch_range);
- CssProp.RIGHT = CssProp.reg(CssProp.CP.right);
- CssProp.STRESS = CssProp.reg(CssProp.CP.stress);
- CssProp.TEXT_INDENT = CssProp.reg(CssProp.CP.text_indent);
- CssProp.TEXT_SHADOW = CssProp.reg(CssProp.CP.text_shadow);
- CssProp.VOLUME = CssProp.reg(CssProp.CP.volume);
- CssProp.WORD_WRAP = CssProp.reg(CssProp.CP.word_wrap);
- CssProp.ZOOM = CssProp.reg(CssProp.CP.zoom);
- CssProp.BACKFACE_VISIBILITY = CssProp.reg(CssProp.CP.backface_visibility);
- CssProp.BACKGROUND_CLIP = CssProp.reg(CssProp.CP.background_clip);
- CssProp.BACKGROUND_POSITION = CssProp.reg(CssProp.CP.background_position);
- CssProp.BORDER_BOTTOM_COLOR = CssProp.reg(CssProp.CP.border_bottom_color);
- CssProp.BORDER_BOTTOM_STYLE = CssProp.reg(CssProp.CP.border_bottom_style);
- CssProp.BORDER_COLOR = CssProp.reg(CssProp.CP.border_color);
- CssProp.BORDER_LEFT_COLOR = CssProp.reg(CssProp.CP.border_left_color);
- CssProp.BORDER_RIGHT_COLOR = CssProp.reg(CssProp.CP.border_right_color);
- CssProp.BORDER_STYLE = CssProp.reg(CssProp.CP.border_style);
- CssProp.BORDER_TOP_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_top_left_radius);
- CssProp.BORDER_TOP_WIDTH = CssProp.reg(CssProp.CP.border_top_width);
- CssProp.BOX_SHADOW = CssProp.reg(CssProp.CP.box_shadow);
- CssProp.CLIP = CssProp.reg(CssProp.CP.clip);
- CssProp.DISPLAY_INSIDE = CssProp.reg(CssProp.CP.display_inside);
- CssProp.FONT_SIZE = CssProp.reg(CssProp.CP.font_size);
- CssProp.LINE_HEIGHT = CssProp.reg(CssProp.CP.line_height);
- CssProp.MARGIN_LEFT = CssProp.reg(CssProp.CP.margin_left);
- CssProp.MAX_WIDTH = CssProp.reg(CssProp.CP.max_width);
- CssProp.OUTLINE_STYLE = CssProp.reg(CssProp.CP.outline_style);
- CssProp.PADDING_BOTTOM = CssProp.reg(CssProp.CP.padding_bottom);
- CssProp.PADDING_RIGHT = CssProp.reg(CssProp.CP.padding_right);
- CssProp.PERSPECTIVE = CssProp.reg(CssProp.CP.perspective);
- CssProp.RICHNESS = CssProp.reg(CssProp.CP.richness);
- CssProp.TEXT_OVERFLOW = CssProp.reg(CssProp.CP.text_overflow);
- CssProp.TOP = CssProp.reg(CssProp.CP.top);
- CssProp.WIDTH = CssProp.reg(CssProp.CP.width);
- CssProp.Z_INDEX = CssProp.reg(CssProp.CP.z_index);
- CssProp.BACKGROUND = CssProp.reg(CssProp.CP.background);
- CssProp.BACKGROUND_SIZE = CssProp.reg(CssProp.CP.background_size);
- CssProp.BORDER_BOTTOM_LEFT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_left_radius);
- CssProp.BORDER_BOTTOM_WIDTH = CssProp.reg(CssProp.CP.border_bottom_width);
- CssProp.BORDER_LEFT_STYLE = CssProp.reg(CssProp.CP.border_left_style);
- CssProp.BORDER_RIGHT_STYLE = CssProp.reg(CssProp.CP.border_right_style);
- CssProp.BORDER_TOP = CssProp.reg(CssProp.CP.border_top);
- CssProp.BOTTOM = CssProp.reg(CssProp.CP.bottom);
- CssProp.LIST_STYLE = CssProp.reg(CssProp.CP.list_style);
- CssProp.MARGIN_TOP = CssProp.reg(CssProp.CP.margin_top);
- CssProp.OUTLINE = CssProp.reg(CssProp.CP.outline);
- CssProp.OVERFLOW_Y = CssProp.reg(CssProp.CP.overflow_y);
- CssProp.PITCH = CssProp.reg(CssProp.CP.pitch);
- CssProp.VERTICAL_ALIGN = CssProp.reg(CssProp.CP.vertical_align);
- CssProp.WORD_SPACING = CssProp.reg(CssProp.CP.word_spacing);
- CssProp.BACKGROUND_IMAGE = CssProp.reg(CssProp.CP.background_image);
- CssProp.BORDER_BOTTOM_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_bottom_right_radius);
- CssProp.BORDER_LEFT_WIDTH = CssProp.reg(CssProp.CP.border_left_width);
- CssProp.BORDER_RIGHT_WIDTH = CssProp.reg(CssProp.CP.border_right_width);
- CssProp.LEFT = CssProp.reg(CssProp.CP.left);
- CssProp.MARGIN_BOTTOM = CssProp.reg(CssProp.CP.margin_bottom);
- CssProp.PAUSE_AFTER = CssProp.reg(CssProp.CP.pause_after);
- CssProp.SPEECH_RATE = CssProp.reg(CssProp.CP.speech_rate);
- CssProp.TRANSITION_DURATION = CssProp.reg(CssProp.CP.transition_duration);
- CssProp.BORDER_BOTTOM = CssProp.reg(CssProp.CP.border_bottom);
- CssProp.BORDER_RIGHT = CssProp.reg(CssProp.CP.border_right);
- CssProp.MARGIN = CssProp.reg(CssProp.CP.margin);
- CssProp.PADDING_LEFT = CssProp.reg(CssProp.CP.padding_left);
- CssProp.BORDER_LEFT = CssProp.reg(CssProp.CP.border_left);
- CssProp.FONT = CssProp.reg(CssProp.CP.font);
- CssProp.QUOTES = CssProp.reg(CssProp.CP.quotes);
- CssProp.BORDER_TOP_RIGHT_RADIUS = CssProp.reg(CssProp.CP.border_top_right_radius);
- CssProp.MIN_WIDTH = CssProp.reg(CssProp.CP.min_width);
- /**
- * A class to sanitize HTML strings.
- */
- var Sanitizer = /*#__PURE__*/function () {
- function Sanitizer() {
- _classCallCheck(this, Sanitizer);
- this._options = {
- // HTML tags that are allowed to be used. Tags were extracted from Google Caja
- allowedTags: ['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blockquote', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'colspan', 'command', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dir', 'div', 'dl', 'dt', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'hgroup', 'hr', 'i',
- // 'iframe' is allowed by Google Caja, but disallowed by default by sanitize-html
- // , 'iframe'
- 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'map', 'mark', 'menu', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'pre', 'progress', 'q', 'rowspan', 's', 'samp', 'section', 'select', 'small', 'source', 'span', 'strike', 'strong', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr'],
- // Attributes that HTML tags are allowed to have, extracted from Google Caja.
- // See https://github.com/jupyterlab/jupyterlab/issues/1812#issuecomment-285848435
- allowedAttributes: {
- '*': ['class', 'dir', 'draggable', 'hidden', 'id', 'inert', 'itemprop', 'itemref', 'itemscope', 'lang', 'spellcheck', 'style', 'title', 'translate'],
- // 'rel' and 'target' were *not* allowed by Google Caja
- a: ['accesskey', 'coords', 'href', 'hreflang', 'name', 'rel', 'shape', 'tabindex', 'target', 'type'],
- area: ['accesskey', 'alt', 'coords', 'href', 'nohref', 'shape', 'tabindex'],
- // 'autoplay' was *not* allowed by Google Caja
- audio: ['autoplay', 'controls', 'loop', 'mediagroup', 'muted', 'preload', 'src'],
- bdo: ['dir'],
- blockquote: ['cite'],
- br: ['clear'],
- button: ['accesskey', 'data-commandlinker-args', 'data-commandlinker-command', 'disabled', 'name', 'tabindex', 'type', 'value'],
- canvas: ['height', 'width'],
- caption: ['align'],
- col: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
- colgroup: ['align', 'char', 'charoff', 'span', 'valign', 'width'],
- command: ['checked', 'command', 'disabled', 'icon', 'label', 'radiogroup', 'type'],
- data: ['value'],
- del: ['cite', 'datetime'],
- details: ['open'],
- dir: ['compact'],
- div: ['align'],
- dl: ['compact'],
- fieldset: ['disabled'],
- font: ['color', 'face', 'size'],
- form: ['accept', 'autocomplete', 'enctype', 'method', 'name', 'novalidate'],
- h1: ['align'],
- h2: ['align'],
- h3: ['align'],
- h4: ['align'],
- h5: ['align'],
- h6: ['align'],
- hr: ['align', 'noshade', 'size', 'width'],
- iframe: ['align', 'frameborder', 'height', 'marginheight', 'marginwidth', 'width'],
- img: ['align', 'alt', 'border', 'height', 'hspace', 'ismap', 'name', 'src', 'usemap', 'vspace', 'width'],
- input: ['accept', 'accesskey', 'align', 'alt', 'autocomplete', 'checked', 'disabled', 'inputmode', 'ismap', 'list', 'max', 'maxlength', 'min', 'multiple', 'name', 'placeholder', 'readonly', 'required', 'size', 'src', 'step', 'tabindex', 'type', 'usemap', 'value'],
- ins: ['cite', 'datetime'],
- label: ['accesskey', 'for'],
- legend: ['accesskey', 'align'],
- li: ['type', 'value'],
- map: ['name'],
- menu: ['compact', 'label', 'type'],
- meter: ['high', 'low', 'max', 'min', 'value'],
- ol: ['compact', 'reversed', 'start', 'type'],
- optgroup: ['disabled', 'label'],
- option: ['disabled', 'label', 'selected', 'value'],
- output: ['for', 'name'],
- p: ['align'],
- pre: ['width'],
- progress: ['max', 'min', 'value'],
- q: ['cite'],
- select: ['autocomplete', 'disabled', 'multiple', 'name', 'required', 'size', 'tabindex'],
- source: ['type'],
- table: ['align', 'bgcolor', 'border', 'cellpadding', 'cellspacing', 'frame', 'rules', 'summary', 'width'],
- tbody: ['align', 'char', 'charoff', 'valign'],
- td: ['abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width'],
- textarea: ['accesskey', 'autocomplete', 'cols', 'disabled', 'inputmode', 'name', 'placeholder', 'readonly', 'required', 'rows', 'tabindex', 'wrap'],
- tfoot: ['align', 'char', 'charoff', 'valign'],
- th: ['abbr', 'align', 'axis', 'bgcolor', 'char', 'charoff', 'colspan', 'headers', 'height', 'nowrap', 'rowspan', 'scope', 'valign', 'width'],
- thead: ['align', 'char', 'charoff', 'valign'],
- tr: ['align', 'bgcolor', 'char', 'charoff', 'valign'],
- track: ['default', 'kind', 'label', 'srclang'],
- ul: ['compact', 'type'],
- video: ['autoplay', 'controls', 'height', 'loop', 'mediagroup', 'muted', 'poster', 'preload', 'src', 'width']
- },
- // Inline CSS styles that HTML tags may have (and their allowed values)
- allowedStyles: {
- // To simplify the data, all styles are allowed on all tags that allow the style attribute
- '*': {
- 'backface-visibility': [CssProp.BACKFACE_VISIBILITY],
- background: [CssProp.BACKGROUND],
- 'background-attachment': [CssProp.BACKGROUND_ATTACHMENT],
- 'background-clip': [CssProp.BACKGROUND_CLIP],
- 'background-color': [CssProp.BACKGROUND_COLOR],
- 'background-image': [CssProp.BACKGROUND_IMAGE],
- 'background-origin': [CssProp.BACKGROUND_ORIGIN],
- 'background-position': [CssProp.BACKGROUND_POSITION],
- 'background-repeat': [CssProp.BACKGROUND_REPEAT],
- 'background-size': [CssProp.BACKGROUND_SIZE],
- border: [CssProp.BORDER],
- 'border-bottom': [CssProp.BORDER_BOTTOM],
- 'border-bottom-color': [CssProp.BORDER_BOTTOM_COLOR],
- 'border-bottom-left-radius': [CssProp.BORDER_BOTTOM_LEFT_RADIUS],
- 'border-bottom-right-radius': [CssProp.BORDER_BOTTOM_RIGHT_RADIUS],
- 'border-bottom-style': [CssProp.BORDER_BOTTOM_STYLE],
- 'border-bottom-width': [CssProp.BORDER_BOTTOM_WIDTH],
- 'border-collapse': [CssProp.BORDER_COLLAPSE],
- 'border-color': [CssProp.BORDER_COLOR],
- 'border-left': [CssProp.BORDER_LEFT],
- 'border-left-color': [CssProp.BORDER_LEFT_COLOR],
- 'border-left-style': [CssProp.BORDER_LEFT_STYLE],
- 'border-left-width': [CssProp.BORDER_LEFT_WIDTH],
- 'border-radius': [CssProp.BORDER_RADIUS],
- 'border-right': [CssProp.BORDER_RIGHT],
- 'border-right-color': [CssProp.BORDER_RIGHT_COLOR],
- 'border-right-style': [CssProp.BORDER_RIGHT_STYLE],
- 'border-right-width': [CssProp.BORDER_RIGHT_WIDTH],
- 'border-spacing': [CssProp.BORDER_SPACING],
- 'border-style': [CssProp.BORDER_STYLE],
- 'border-top': [CssProp.BORDER_TOP],
- 'border-top-color': [CssProp.BORDER_TOP_COLOR],
- 'border-top-left-radius': [CssProp.BORDER_TOP_LEFT_RADIUS],
- 'border-top-right-radius': [CssProp.BORDER_TOP_RIGHT_RADIUS],
- 'border-top-style': [CssProp.BORDER_TOP_STYLE],
- 'border-top-width': [CssProp.BORDER_TOP_WIDTH],
- 'border-width': [CssProp.BORDER_WIDTH],
- bottom: [CssProp.BOTTOM],
- box: [CssProp.BOX],
- 'box-shadow': [CssProp.BOX_SHADOW],
- 'box-sizing': [CssProp.BOX_SIZING],
- 'caption-side': [CssProp.CAPTION_SIDE],
- clear: [CssProp.CLEAR],
- clip: [CssProp.CLIP],
- color: [CssProp.COLOR],
- cursor: [CssProp.CURSOR],
- direction: [CssProp.DIRECTION],
- display: [CssProp.DISPLAY],
- 'display-inside': [CssProp.DISPLAY_INSIDE],
- 'display-outside': [CssProp.DISPLAY_OUTSIDE],
- elevation: [CssProp.ELEVATION],
- 'empty-cells': [CssProp.EMPTY_CELLS],
- "float": [CssProp.FLOAT],
- font: [CssProp.FONT],
- 'font-family': [CssProp.FONT_FAMILY],
- 'font-size': [CssProp.FONT_SIZE],
- 'font-stretch': [CssProp.FONT_STRETCH],
- 'font-style': [CssProp.FONT_STYLE],
- 'font-variant': [CssProp.FONT_VARIANT],
- 'font-weight': [CssProp.FONT_WEIGHT],
- height: [CssProp.HEIGHT],
- left: [CssProp.LEFT],
- 'letter-spacing': [CssProp.LETTER_SPACING],
- 'line-height': [CssProp.LINE_HEIGHT],
- 'list-style': [CssProp.LIST_STYLE],
- 'list-style-image': [CssProp.LIST_STYLE_IMAGE],
- 'list-style-position': [CssProp.LIST_STYLE_POSITION],
- 'list-style-type': [CssProp.LIST_STYLE_TYPE],
- margin: [CssProp.MARGIN],
- 'margin-bottom': [CssProp.MARGIN_BOTTOM],
- 'margin-left': [CssProp.MARGIN_LEFT],
- 'margin-right': [CssProp.MARGIN_RIGHT],
- 'margin-top': [CssProp.MARGIN_TOP],
- 'max-height': [CssProp.MAX_HEIGHT],
- 'max-width': [CssProp.MAX_WIDTH],
- 'min-height': [CssProp.MIN_HEIGHT],
- 'min-width': [CssProp.MIN_WIDTH],
- opacity: [CssProp.OPACITY],
- outline: [CssProp.OUTLINE],
- 'outline-color': [CssProp.OUTLINE_COLOR],
- 'outline-style': [CssProp.OUTLINE_STYLE],
- 'outline-width': [CssProp.OUTLINE_WIDTH],
- overflow: [CssProp.OVERFLOW],
- 'overflow-wrap': [CssProp.OVERFLOW_WRAP],
- 'overflow-x': [CssProp.OVERFLOW_X],
- 'overflow-y': [CssProp.OVERFLOW_Y],
- padding: [CssProp.PADDING],
- 'padding-bottom': [CssProp.PADDING_BOTTOM],
- 'padding-left': [CssProp.PADDING_LEFT],
- 'padding-right': [CssProp.PADDING_RIGHT],
- 'padding-top': [CssProp.PADDING_TOP],
- 'page-break-after': [CssProp.PAGE_BREAK_AFTER],
- 'page-break-before': [CssProp.PAGE_BREAK_BEFORE],
- 'page-break-inside': [CssProp.PAGE_BREAK_INSIDE],
- 'pause-after': [CssProp.PAUSE_AFTER],
- perspective: [CssProp.PERSPECTIVE],
- pitch: [CssProp.PITCH],
- 'pitch-range': [CssProp.PITCH_RANGE],
- position: [CssProp.POSITION],
- quotes: [CssProp.QUOTES],
- resize: [CssProp.RESIZE],
- richness: [CssProp.RICHNESS],
- right: [CssProp.RIGHT],
- speak: [CssProp.SPEAK],
- 'speak-header': [CssProp.SPEAK_HEADER],
- 'speak-numeral': [CssProp.SPEAK_NUMERAL],
- 'speak-punctuation': [CssProp.SPEAK_PUNCTUATION],
- 'speech-rate': [CssProp.SPEECH_RATE],
- stress: [CssProp.STRESS],
- 'table-layout': [CssProp.TABLE_LAYOUT],
- 'text-align': [CssProp.TEXT_ALIGN],
- 'text-decoration': [CssProp.TEXT_DECORATION],
- 'text-indent': [CssProp.TEXT_INDENT],
- 'text-overflow': [CssProp.TEXT_OVERFLOW],
- 'text-shadow': [CssProp.TEXT_SHADOW],
- 'text-transform': [CssProp.TEXT_TRANSFORM],
- 'text-wrap': [CssProp.TEXT_WRAP],
- top: [CssProp.TOP],
- 'unicode-bidi': [CssProp.UNICODE_BIDI],
- 'vertical-align': [CssProp.VERTICAL_ALIGN],
- visibility: [CssProp.VISIBILITY],
- volume: [CssProp.VOLUME],
- 'white-space': [CssProp.WHITE_SPACE],
- width: [CssProp.WIDTH],
- 'word-break': [CssProp.WORD_BREAK],
- 'word-spacing': [CssProp.WORD_SPACING],
- 'word-wrap': [CssProp.WORD_WRAP],
- 'z-index': [CssProp.Z_INDEX],
- zoom: [CssProp.ZOOM]
- }
- },
- transformTags: {
- // Set the "rel" attribute for <a> tags to "nofollow".
- a: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().simpleTransform('a', {
- rel: 'nofollow'
- }),
- // Set the "disabled" attribute for <input> tags.
- input: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().simpleTransform('input', {
- disabled: 'disabled'
- })
- },
- allowedSchemes: _toConsumableArray((sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().defaults.allowedSchemes)),
- allowedSchemesByTag: {
- // Allow 'attachment:' img src (used for markdown cell attachments).
- img: sanitize_html__WEBPACK_IMPORTED_MODULE_0___default().defaults.allowedSchemes.concat(['attachment'])
- },
- // Override of the default option, so we can skip 'src' attribute validation.
- // 'src' Attributes are validated to be URIs, which does not allow for embedded (image) data.
- // Since embedded data is no longer deemed to be a threat, validation can be skipped.
- // See https://github.com/jupyterlab/jupyterlab/issues/5183
- allowedSchemesAppliedToAttributes: ['href', 'cite']
- };
- }
- /**
- * Sanitize an HTML string.
- *
- * @param dirty - The dirty text.
- *
- * @param options - The optional sanitization options.
- *
- * @returns The sanitized string.
- */
- _createClass(Sanitizer, [{
- key: "sanitize",
- value: function sanitize(dirty, options) {
- return sanitize_html__WEBPACK_IMPORTED_MODULE_0___default()(dirty, Object.assign(Object.assign({}, this._options), options || {}));
- }
- /**
- * Set the allowed schemes
- *
- * @param scheme Allowed schemes
- */
- }, {
- key: "setAllowedSchemes",
- value: function setAllowedSchemes(scheme) {
- // Force copy of `scheme`
- this._options.allowedSchemes = _toConsumableArray(scheme);
- }
- }]);
- return Sanitizer;
- }();
- /**
- * The default instance of an `ISanitizer` meant for use by user code.
- *
- * @deprecated It will be removed in JupyterLab v4. You should request the `ISanitizer` in
- * your plugin instead.
- */
- var defaultSanitizer = new Sanitizer();
- })();
- /******/ return __webpack_exports__;
- /******/ })()
- ;
- });;
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/security',[
- 'jquery',
- 'components/sanitizer/index',
- ], function($, sanitizer) {
- "use strict";
- var noop = function (x) { return x; };
- var defaultSanitizer = sanitizer.defaultSanitizer;
- var sanitize_html = function (html, allow_css) {
- /**
- * sanitize HTML
- * if allow_css is true (default: false), CSS is sanitized as well.
- * otherwise, CSS elements and attributes are simply removed.
- */
- const options = {};
- if (!allow_css) {
- options.allowedStyles = {};
- }
- return defaultSanitizer.sanitize(html, options);
- };
- var sanitize_html_and_parse = function (html, allow_css) {
- /**
- * Sanitize HTML and parse it safely using jQuery.
- *
- * This disable's jQuery's html 'prefilter', which can make invalid
- * HTML valid after the sanitizer has checked it.
- *
- * Returns an array of DOM nodes.
- */
- var sanitized_html = sanitize_html(html, allow_css);
- var prev_htmlPrefilter = $.htmlPrefilter;
- $.htmlPrefilter = function(html) {return html;}; // Don't modify HTML
- try {
- return $.parseHTML(sanitized_html);
- } finally {
- $.htmlPrefilter = prev_htmlPrefilter; // Set it back again
- }
- };
- var security = {
- sanitize_html_and_parse: sanitize_html_and_parse,
- sanitize_html: sanitize_html
- };
- return security;
- });
- /**
- * marked - a markdown parser
- * Copyright (c) 2011-2022, Christopher Jeffrey. (MIT Licensed)
- * https://github.com/markedjs/marked
- */
- /**
- * DO NOT EDIT THIS FILE
- * The code in this file is generated from files in ./src/
- */
- (function (global, factory) {
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) :
- typeof define === 'function' && define.amd ? define('components/marked/lib/marked',['exports'], factory) :
- (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.marked = {}));
- })(this, (function (exports) { 'use strict';
- 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);
- }
- }
- function _createClass(Constructor, protoProps, staticProps) {
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
- if (staticProps) _defineProperties(Constructor, staticProps);
- Object.defineProperty(Constructor, "prototype", {
- writable: false
- });
- return Constructor;
- }
- function _unsupportedIterableToArray(o, minLen) {
- if (!o) return;
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
- var n = Object.prototype.toString.call(o).slice(8, -1);
- if (n === "Object" && o.constructor) n = o.constructor.name;
- if (n === "Map" || n === "Set") return Array.from(o);
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
- }
- function _arrayLikeToArray(arr, len) {
- if (len == null || len > arr.length) len = arr.length;
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
- return arr2;
- }
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
- var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
- if (it) return (it = it.call(o)).next.bind(it);
- if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
- if (it) o = it;
- var i = 0;
- return function () {
- if (i >= o.length) return {
- done: true
- };
- return {
- done: false,
- value: o[i++]
- };
- };
- }
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
- }
- function getDefaults() {
- return {
- baseUrl: null,
- breaks: false,
- extensions: null,
- gfm: true,
- headerIds: true,
- headerPrefix: '',
- highlight: null,
- langPrefix: 'language-',
- mangle: true,
- pedantic: false,
- renderer: null,
- sanitize: false,
- sanitizer: null,
- silent: false,
- smartLists: false,
- smartypants: false,
- tokenizer: null,
- walkTokens: null,
- xhtml: false
- };
- }
- exports.defaults = getDefaults();
- function changeDefaults(newDefaults) {
- exports.defaults = newDefaults;
- }
- /**
- * Helpers
- */
- var escapeTest = /[&<>"']/;
- var escapeReplace = /[&<>"']/g;
- var escapeTestNoEncode = /[<>"']|&(?!#?\w+;)/;
- var escapeReplaceNoEncode = /[<>"']|&(?!#?\w+;)/g;
- var escapeReplacements = {
- '&': '&',
- '<': '<',
- '>': '>',
- '"': '"',
- "'": '''
- };
- var getEscapeReplacement = function getEscapeReplacement(ch) {
- return escapeReplacements[ch];
- };
- function escape(html, encode) {
- if (encode) {
- if (escapeTest.test(html)) {
- return html.replace(escapeReplace, getEscapeReplacement);
- }
- } else {
- if (escapeTestNoEncode.test(html)) {
- return html.replace(escapeReplaceNoEncode, getEscapeReplacement);
- }
- }
- return html;
- }
- var unescapeTest = /&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/ig;
- /**
- * @param {string} html
- */
- function unescape(html) {
- // explicitly match decimal, hex, and named HTML entities
- return html.replace(unescapeTest, function (_, n) {
- n = n.toLowerCase();
- if (n === 'colon') return ':';
- if (n.charAt(0) === '#') {
- return n.charAt(1) === 'x' ? String.fromCharCode(parseInt(n.substring(2), 16)) : String.fromCharCode(+n.substring(1));
- }
- return '';
- });
- }
- var caret = /(^|[^\[])\^/g;
- /**
- * @param {string | RegExp} regex
- * @param {string} opt
- */
- function edit(regex, opt) {
- regex = typeof regex === 'string' ? regex : regex.source;
- opt = opt || '';
- var obj = {
- replace: function replace(name, val) {
- val = val.source || val;
- val = val.replace(caret, '$1');
- regex = regex.replace(name, val);
- return obj;
- },
- getRegex: function getRegex() {
- return new RegExp(regex, opt);
- }
- };
- return obj;
- }
- var nonWordAndColonTest = /[^\w:]/g;
- var originIndependentUrl = /^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;
- /**
- * @param {boolean} sanitize
- * @param {string} base
- * @param {string} href
- */
- function cleanUrl(sanitize, base, href) {
- if (sanitize) {
- var prot;
- try {
- prot = decodeURIComponent(unescape(href)).replace(nonWordAndColonTest, '').toLowerCase();
- } catch (e) {
- return null;
- }
- if (prot.indexOf('javascript:') === 0 || prot.indexOf('vbscript:') === 0 || prot.indexOf('data:') === 0) {
- return null;
- }
- }
- if (base && !originIndependentUrl.test(href)) {
- href = resolveUrl(base, href);
- }
- try {
- href = encodeURI(href).replace(/%25/g, '%');
- } catch (e) {
- return null;
- }
- return href;
- }
- var baseUrls = {};
- var justDomain = /^[^:]+:\/*[^/]*$/;
- var protocol = /^([^:]+:)[\s\S]*$/;
- var domain = /^([^:]+:\/*[^/]*)[\s\S]*$/;
- /**
- * @param {string} base
- * @param {string} href
- */
- function resolveUrl(base, href) {
- if (!baseUrls[' ' + base]) {
- // we can ignore everything in base after the last slash of its path component,
- // but we might need to add _that_
- // https://tools.ietf.org/html/rfc3986#section-3
- if (justDomain.test(base)) {
- baseUrls[' ' + base] = base + '/';
- } else {
- baseUrls[' ' + base] = rtrim(base, '/', true);
- }
- }
- base = baseUrls[' ' + base];
- var relativeBase = base.indexOf(':') === -1;
- if (href.substring(0, 2) === '//') {
- if (relativeBase) {
- return href;
- }
- return base.replace(protocol, '$1') + href;
- } else if (href.charAt(0) === '/') {
- if (relativeBase) {
- return href;
- }
- return base.replace(domain, '$1') + href;
- } else {
- return base + href;
- }
- }
- var noopTest = {
- exec: function noopTest() {}
- };
- function merge(obj) {
- var i = 1,
- target,
- key;
- for (; i < arguments.length; i++) {
- target = arguments[i];
- for (key in target) {
- if (Object.prototype.hasOwnProperty.call(target, key)) {
- obj[key] = target[key];
- }
- }
- }
- return obj;
- }
- function splitCells(tableRow, count) {
- // ensure that every cell-delimiting pipe has a space
- // before it to distinguish it from an escaped pipe
- var row = tableRow.replace(/\|/g, function (match, offset, str) {
- var escaped = false,
- curr = offset;
- while (--curr >= 0 && str[curr] === '\\') {
- escaped = !escaped;
- }
- if (escaped) {
- // odd number of slashes means | is escaped
- // so we leave it alone
- return '|';
- } else {
- // add space before unescaped |
- return ' |';
- }
- }),
- cells = row.split(/ \|/);
- var i = 0; // First/last cell in a row cannot be empty if it has no leading/trailing pipe
- if (!cells[0].trim()) {
- cells.shift();
- }
- if (cells.length > 0 && !cells[cells.length - 1].trim()) {
- cells.pop();
- }
- if (cells.length > count) {
- cells.splice(count);
- } else {
- while (cells.length < count) {
- cells.push('');
- }
- }
- for (; i < cells.length; i++) {
- // leading or trailing whitespace is ignored per the gfm spec
- cells[i] = cells[i].trim().replace(/\\\|/g, '|');
- }
- return cells;
- }
- /**
- * Remove trailing 'c's. Equivalent to str.replace(/c*$/, '').
- * /c*$/ is vulnerable to REDOS.
- *
- * @param {string} str
- * @param {string} c
- * @param {boolean} invert Remove suffix of non-c chars instead. Default falsey.
- */
- function rtrim(str, c, invert) {
- var l = str.length;
- if (l === 0) {
- return '';
- } // Length of suffix matching the invert condition.
- var suffLen = 0; // Step left until we fail to match the invert condition.
- while (suffLen < l) {
- var currChar = str.charAt(l - suffLen - 1);
- if (currChar === c && !invert) {
- suffLen++;
- } else if (currChar !== c && invert) {
- suffLen++;
- } else {
- break;
- }
- }
- return str.slice(0, l - suffLen);
- }
- function findClosingBracket(str, b) {
- if (str.indexOf(b[1]) === -1) {
- return -1;
- }
- var l = str.length;
- var level = 0,
- i = 0;
- for (; i < l; i++) {
- if (str[i] === '\\') {
- i++;
- } else if (str[i] === b[0]) {
- level++;
- } else if (str[i] === b[1]) {
- level--;
- if (level < 0) {
- return i;
- }
- }
- }
- return -1;
- }
- function checkSanitizeDeprecation(opt) {
- if (opt && opt.sanitize && !opt.silent) {
- console.warn('marked(): sanitize and sanitizer parameters are deprecated since version 0.7.0, should not be used and will be removed in the future. Read more here: https://marked.js.org/#/USING_ADVANCED.md#options');
- }
- } // copied from https://stackoverflow.com/a/5450113/806777
- /**
- * @param {string} pattern
- * @param {number} count
- */
- function repeatString(pattern, count) {
- if (count < 1) {
- return '';
- }
- var result = '';
- while (count > 1) {
- if (count & 1) {
- result += pattern;
- }
- count >>= 1;
- pattern += pattern;
- }
- return result + pattern;
- }
- function outputLink(cap, link, raw, lexer) {
- var href = link.href;
- var title = link.title ? escape(link.title) : null;
- var text = cap[1].replace(/\\([\[\]])/g, '$1');
- if (cap[0].charAt(0) !== '!') {
- lexer.state.inLink = true;
- var token = {
- type: 'link',
- raw: raw,
- href: href,
- title: title,
- text: text,
- tokens: lexer.inlineTokens(text, [])
- };
- lexer.state.inLink = false;
- return token;
- }
- return {
- type: 'image',
- raw: raw,
- href: href,
- title: title,
- text: escape(text)
- };
- }
- function indentCodeCompensation(raw, text) {
- var matchIndentToCode = raw.match(/^(\s+)(?:```)/);
- if (matchIndentToCode === null) {
- return text;
- }
- var indentToCode = matchIndentToCode[1];
- return text.split('\n').map(function (node) {
- var matchIndentInNode = node.match(/^\s+/);
- if (matchIndentInNode === null) {
- return node;
- }
- var indentInNode = matchIndentInNode[0];
- if (indentInNode.length >= indentToCode.length) {
- return node.slice(indentToCode.length);
- }
- return node;
- }).join('\n');
- }
- /**
- * Tokenizer
- */
- var Tokenizer = /*#__PURE__*/function () {
- function Tokenizer(options) {
- this.options = options || exports.defaults;
- }
- var _proto = Tokenizer.prototype;
- _proto.space = function space(src) {
- var cap = this.rules.block.newline.exec(src);
- if (cap && cap[0].length > 0) {
- return {
- type: 'space',
- raw: cap[0]
- };
- }
- };
- _proto.code = function code(src) {
- var cap = this.rules.block.code.exec(src);
- if (cap) {
- var text = cap[0].replace(/^ {1,4}/gm, '');
- return {
- type: 'code',
- raw: cap[0],
- codeBlockStyle: 'indented',
- text: !this.options.pedantic ? rtrim(text, '\n') : text
- };
- }
- };
- _proto.fences = function fences(src) {
- var cap = this.rules.block.fences.exec(src);
- if (cap) {
- var raw = cap[0];
- var text = indentCodeCompensation(raw, cap[3] || '');
- return {
- type: 'code',
- raw: raw,
- lang: cap[2] ? cap[2].trim() : cap[2],
- text: text
- };
- }
- };
- _proto.heading = function heading(src) {
- var cap = this.rules.block.heading.exec(src);
- if (cap) {
- var text = cap[2].trim(); // remove trailing #s
- if (/#$/.test(text)) {
- var trimmed = rtrim(text, '#');
- if (this.options.pedantic) {
- text = trimmed.trim();
- } else if (!trimmed || / $/.test(trimmed)) {
- // CommonMark requires space before trailing #s
- text = trimmed.trim();
- }
- }
- var token = {
- type: 'heading',
- raw: cap[0],
- depth: cap[1].length,
- text: text,
- tokens: []
- };
- this.lexer.inline(token.text, token.tokens);
- return token;
- }
- };
- _proto.hr = function hr(src) {
- var cap = this.rules.block.hr.exec(src);
- if (cap) {
- return {
- type: 'hr',
- raw: cap[0]
- };
- }
- };
- _proto.blockquote = function blockquote(src) {
- var cap = this.rules.block.blockquote.exec(src);
- if (cap) {
- var text = cap[0].replace(/^ *>[ \t]?/gm, '');
- return {
- type: 'blockquote',
- raw: cap[0],
- tokens: this.lexer.blockTokens(text, []),
- text: text
- };
- }
- };
- _proto.list = function list(src) {
- var cap = this.rules.block.list.exec(src);
- if (cap) {
- var raw, istask, ischecked, indent, i, blankLine, endsWithBlankLine, line, nextLine, rawLine, itemContents, endEarly;
- var bull = cap[1].trim();
- var isordered = bull.length > 1;
- var list = {
- type: 'list',
- raw: '',
- ordered: isordered,
- start: isordered ? +bull.slice(0, -1) : '',
- loose: false,
- items: []
- };
- bull = isordered ? "\\d{1,9}\\" + bull.slice(-1) : "\\" + bull;
- if (this.options.pedantic) {
- bull = isordered ? bull : '[*+-]';
- } // Get next list item
- var itemRegex = new RegExp("^( {0,3}" + bull + ")((?:[\t ][^\\n]*)?(?:\\n|$))"); // Check if current bullet point can start a new List Item
- while (src) {
- endEarly = false;
- if (!(cap = itemRegex.exec(src))) {
- break;
- }
- if (this.rules.block.hr.test(src)) {
- // End list if bullet was actually HR (possibly move into itemRegex?)
- break;
- }
- raw = cap[0];
- src = src.substring(raw.length);
- line = cap[2].split('\n', 1)[0];
- nextLine = src.split('\n', 1)[0];
- if (this.options.pedantic) {
- indent = 2;
- itemContents = line.trimLeft();
- } else {
- indent = cap[2].search(/[^ ]/); // Find first non-space char
- indent = indent > 4 ? 1 : indent; // Treat indented code blocks (> 4 spaces) as having only 1 indent
- itemContents = line.slice(indent);
- indent += cap[1].length;
- }
- blankLine = false;
- if (!line && /^ *$/.test(nextLine)) {
- // Items begin with at most one blank line
- raw += nextLine + '\n';
- src = src.substring(nextLine.length + 1);
- endEarly = true;
- }
- if (!endEarly) {
- var nextBulletRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:[*+-]|\\d{1,9}[.)])((?: [^\\n]*)?(?:\\n|$))");
- var hrRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)");
- var fencesBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}(?:```|~~~)");
- var headingBeginRegex = new RegExp("^ {0," + Math.min(3, indent - 1) + "}#"); // Check if following lines should be included in List Item
- while (src) {
- rawLine = src.split('\n', 1)[0];
- line = rawLine; // Re-align to follow commonmark nesting rules
- if (this.options.pedantic) {
- line = line.replace(/^ {1,4}(?=( {4})*[^ ])/g, ' ');
- } // End list item if found code fences
- if (fencesBeginRegex.test(line)) {
- break;
- } // End list item if found start of new heading
- if (headingBeginRegex.test(line)) {
- break;
- } // End list item if found start of new bullet
- if (nextBulletRegex.test(line)) {
- break;
- } // Horizontal rule found
- if (hrRegex.test(src)) {
- break;
- }
- if (line.search(/[^ ]/) >= indent || !line.trim()) {
- // Dedent if possible
- itemContents += '\n' + line.slice(indent);
- } else if (!blankLine) {
- // Until blank line, item doesn't need indentation
- itemContents += '\n' + line;
- } else {
- // Otherwise, improper indentation ends this item
- break;
- }
- if (!blankLine && !line.trim()) {
- // Check if current line is blank
- blankLine = true;
- }
- raw += rawLine + '\n';
- src = src.substring(rawLine.length + 1);
- }
- }
- if (!list.loose) {
- // If the previous item ended with a blank line, the list is loose
- if (endsWithBlankLine) {
- list.loose = true;
- } else if (/\n *\n *$/.test(raw)) {
- endsWithBlankLine = true;
- }
- } // Check for task list items
- if (this.options.gfm) {
- istask = /^\[[ xX]\] /.exec(itemContents);
- if (istask) {
- ischecked = istask[0] !== '[ ] ';
- itemContents = itemContents.replace(/^\[[ xX]\] +/, '');
- }
- }
- list.items.push({
- type: 'list_item',
- raw: raw,
- task: !!istask,
- checked: ischecked,
- loose: false,
- text: itemContents
- });
- list.raw += raw;
- } // Do not consume newlines at end of final item. Alternatively, make itemRegex *start* with any newlines to simplify/speed up endsWithBlankLine logic
- list.items[list.items.length - 1].raw = raw.trimRight();
- list.items[list.items.length - 1].text = itemContents.trimRight();
- list.raw = list.raw.trimRight();
- var l = list.items.length; // Item child tokens handled here at end because we needed to have the final item to trim it first
- for (i = 0; i < l; i++) {
- this.lexer.state.top = false;
- list.items[i].tokens = this.lexer.blockTokens(list.items[i].text, []);
- var spacers = list.items[i].tokens.filter(function (t) {
- return t.type === 'space';
- });
- var hasMultipleLineBreaks = spacers.every(function (t) {
- var chars = t.raw.split('');
- var lineBreaks = 0;
- for (var _iterator = _createForOfIteratorHelperLoose(chars), _step; !(_step = _iterator()).done;) {
- var _char = _step.value;
- if (_char === '\n') {
- lineBreaks += 1;
- }
- if (lineBreaks > 1) {
- return true;
- }
- }
- return false;
- });
- if (!list.loose && spacers.length && hasMultipleLineBreaks) {
- // Having a single line break doesn't mean a list is loose. A single line break is terminating the last list item
- list.loose = true;
- list.items[i].loose = true;
- }
- }
- return list;
- }
- };
- _proto.html = function html(src) {
- var cap = this.rules.block.html.exec(src);
- if (cap) {
- var token = {
- type: 'html',
- raw: cap[0],
- pre: !this.options.sanitizer && (cap[1] === 'pre' || cap[1] === 'script' || cap[1] === 'style'),
- text: cap[0]
- };
- if (this.options.sanitize) {
- token.type = 'paragraph';
- token.text = this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]);
- token.tokens = [];
- this.lexer.inline(token.text, token.tokens);
- }
- return token;
- }
- };
- _proto.def = function def(src) {
- var cap = this.rules.block.def.exec(src);
- if (cap) {
- if (cap[3]) cap[3] = cap[3].substring(1, cap[3].length - 1);
- var tag = cap[1].toLowerCase().replace(/\s+/g, ' ');
- return {
- type: 'def',
- tag: tag,
- raw: cap[0],
- href: cap[2],
- title: cap[3]
- };
- }
- };
- _proto.table = function table(src) {
- var cap = this.rules.block.table.exec(src);
- if (cap) {
- var item = {
- type: 'table',
- header: splitCells(cap[1]).map(function (c) {
- return {
- text: c
- };
- }),
- align: cap[2].replace(/^ *|\| *$/g, '').split(/ *\| */),
- rows: cap[3] && cap[3].trim() ? cap[3].replace(/\n[ \t]*$/, '').split('\n') : []
- };
- if (item.header.length === item.align.length) {
- item.raw = cap[0];
- var l = item.align.length;
- var i, j, k, row;
- for (i = 0; i < l; i++) {
- if (/^ *-+: *$/.test(item.align[i])) {
- item.align[i] = 'right';
- } else if (/^ *:-+: *$/.test(item.align[i])) {
- item.align[i] = 'center';
- } else if (/^ *:-+ *$/.test(item.align[i])) {
- item.align[i] = 'left';
- } else {
- item.align[i] = null;
- }
- }
- l = item.rows.length;
- for (i = 0; i < l; i++) {
- item.rows[i] = splitCells(item.rows[i], item.header.length).map(function (c) {
- return {
- text: c
- };
- });
- } // parse child tokens inside headers and cells
- // header child tokens
- l = item.header.length;
- for (j = 0; j < l; j++) {
- item.header[j].tokens = [];
- this.lexer.inline(item.header[j].text, item.header[j].tokens);
- } // cell child tokens
- l = item.rows.length;
- for (j = 0; j < l; j++) {
- row = item.rows[j];
- for (k = 0; k < row.length; k++) {
- row[k].tokens = [];
- this.lexer.inline(row[k].text, row[k].tokens);
- }
- }
- return item;
- }
- }
- };
- _proto.lheading = function lheading(src) {
- var cap = this.rules.block.lheading.exec(src);
- if (cap) {
- var token = {
- type: 'heading',
- raw: cap[0],
- depth: cap[2].charAt(0) === '=' ? 1 : 2,
- text: cap[1],
- tokens: []
- };
- this.lexer.inline(token.text, token.tokens);
- return token;
- }
- };
- _proto.paragraph = function paragraph(src) {
- var cap = this.rules.block.paragraph.exec(src);
- if (cap) {
- var token = {
- type: 'paragraph',
- raw: cap[0],
- text: cap[1].charAt(cap[1].length - 1) === '\n' ? cap[1].slice(0, -1) : cap[1],
- tokens: []
- };
- this.lexer.inline(token.text, token.tokens);
- return token;
- }
- };
- _proto.text = function text(src) {
- var cap = this.rules.block.text.exec(src);
- if (cap) {
- var token = {
- type: 'text',
- raw: cap[0],
- text: cap[0],
- tokens: []
- };
- this.lexer.inline(token.text, token.tokens);
- return token;
- }
- };
- _proto.escape = function escape$1(src) {
- var cap = this.rules.inline.escape.exec(src);
- if (cap) {
- return {
- type: 'escape',
- raw: cap[0],
- text: escape(cap[1])
- };
- }
- };
- _proto.tag = function tag(src) {
- var cap = this.rules.inline.tag.exec(src);
- if (cap) {
- if (!this.lexer.state.inLink && /^<a /i.test(cap[0])) {
- this.lexer.state.inLink = true;
- } else if (this.lexer.state.inLink && /^<\/a>/i.test(cap[0])) {
- this.lexer.state.inLink = false;
- }
- if (!this.lexer.state.inRawBlock && /^<(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
- this.lexer.state.inRawBlock = true;
- } else if (this.lexer.state.inRawBlock && /^<\/(pre|code|kbd|script)(\s|>)/i.test(cap[0])) {
- this.lexer.state.inRawBlock = false;
- }
- return {
- type: this.options.sanitize ? 'text' : 'html',
- raw: cap[0],
- inLink: this.lexer.state.inLink,
- inRawBlock: this.lexer.state.inRawBlock,
- text: this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0]
- };
- }
- };
- _proto.link = function link(src) {
- var cap = this.rules.inline.link.exec(src);
- if (cap) {
- var trimmedUrl = cap[2].trim();
- if (!this.options.pedantic && /^</.test(trimmedUrl)) {
- // commonmark requires matching angle brackets
- if (!/>$/.test(trimmedUrl)) {
- return;
- } // ending angle bracket cannot be escaped
- var rtrimSlash = rtrim(trimmedUrl.slice(0, -1), '\\');
- if ((trimmedUrl.length - rtrimSlash.length) % 2 === 0) {
- return;
- }
- } else {
- // find closing parenthesis
- var lastParenIndex = findClosingBracket(cap[2], '()');
- if (lastParenIndex > -1) {
- var start = cap[0].indexOf('!') === 0 ? 5 : 4;
- var linkLen = start + cap[1].length + lastParenIndex;
- cap[2] = cap[2].substring(0, lastParenIndex);
- cap[0] = cap[0].substring(0, linkLen).trim();
- cap[3] = '';
- }
- }
- var href = cap[2];
- var title = '';
- if (this.options.pedantic) {
- // split pedantic href and title
- var link = /^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(href);
- if (link) {
- href = link[1];
- title = link[3];
- }
- } else {
- title = cap[3] ? cap[3].slice(1, -1) : '';
- }
- href = href.trim();
- if (/^</.test(href)) {
- if (this.options.pedantic && !/>$/.test(trimmedUrl)) {
- // pedantic allows starting angle bracket without ending angle bracket
- href = href.slice(1);
- } else {
- href = href.slice(1, -1);
- }
- }
- return outputLink(cap, {
- href: href ? href.replace(this.rules.inline._escapes, '$1') : href,
- title: title ? title.replace(this.rules.inline._escapes, '$1') : title
- }, cap[0], this.lexer);
- }
- };
- _proto.reflink = function reflink(src, links) {
- var cap;
- if ((cap = this.rules.inline.reflink.exec(src)) || (cap = this.rules.inline.nolink.exec(src))) {
- var link = (cap[2] || cap[1]).replace(/\s+/g, ' ');
- link = links[link.toLowerCase()];
- if (!link || !link.href) {
- var text = cap[0].charAt(0);
- return {
- type: 'text',
- raw: text,
- text: text
- };
- }
- return outputLink(cap, link, cap[0], this.lexer);
- }
- };
- _proto.emStrong = function emStrong(src, maskedSrc, prevChar) {
- if (prevChar === void 0) {
- prevChar = '';
- }
- var match = this.rules.inline.emStrong.lDelim.exec(src);
- if (!match) return; // _ can't be between two alphanumerics. \p{L}\p{N} includes non-english alphabet/numbers as well
- if (match[3] && prevChar.match(/(?:[0-9A-Za-z\xAA\xB2\xB3\xB5\xB9\xBA\xBC-\xBE\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0560-\u0588\u05D0-\u05EA\u05EF-\u05F2\u0620-\u064A\u0660-\u0669\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07C0-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u0870-\u0887\u0889-\u088E\u08A0-\u08C9\u0904-\u0939\u093D\u0950\u0958-\u0961\u0966-\u096F\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09E6-\u09F1\u09F4-\u09F9\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A66-\u0A6F\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AE6-\u0AEF\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B66-\u0B6F\u0B71-\u0B77\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0BE6-\u0BF2\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C5D\u0C60\u0C61\u0C66-\u0C6F\u0C78-\u0C7E\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDD\u0CDE\u0CE0\u0CE1\u0CE6-\u0CEF\u0CF1\u0CF2\u0D04-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D58-\u0D61\u0D66-\u0D78\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0DE6-\u0DEF\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E50-\u0E59\u0E81\u0E82\u0E84\u0E86-\u0E8A\u0E8C-\u0EA3\u0EA5\u0EA7-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0ED0-\u0ED9\u0EDC-\u0EDF\u0F00\u0F20-\u0F33\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F-\u1049\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u1090-\u1099\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1369-\u137C\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16EE-\u16F8\u1700-\u1711\u171F-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u17E0-\u17E9\u17F0-\u17F9\u1810-\u1819\u1820-\u1878\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1946-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u19D0-\u19DA\u1A00-\u1A16\u1A20-\u1A54\u1A80-\u1A89\u1A90-\u1A99\u1AA7\u1B05-\u1B33\u1B45-\u1B4C\u1B50-\u1B59\u1B83-\u1BA0\u1BAE-\u1BE5\u1C00-\u1C23\u1C40-\u1C49\u1C4D-\u1C7D\u1C80-\u1C88\u1C90-\u1CBA\u1CBD-\u1CBF\u1CE9-\u1CEC\u1CEE-\u1CF3\u1CF5\u1CF6\u1CFA\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2070\u2071\u2074-\u2079\u207F-\u2089\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2150-\u2189\u2460-\u249B\u24EA-\u24FF\u2776-\u2793\u2C00-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2CFD\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005-\u3007\u3021-\u3029\u3031-\u3035\u3038-\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312F\u3131-\u318E\u3192-\u3195\u31A0-\u31BF\u31F0-\u31FF\u3220-\u3229\u3248-\u324F\u3251-\u325F\u3280-\u3289\u32B1-\u32BF\u3400-\u4DBF\u4E00-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6EF\uA717-\uA71F\uA722-\uA788\uA78B-\uA7CA\uA7D0\uA7D1\uA7D3\uA7D5-\uA7D9\uA7F2-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA830-\uA835\uA840-\uA873\uA882-\uA8B3\uA8D0-\uA8D9\uA8F2-\uA8F7\uA8FB\uA8FD\uA8FE\uA900-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF-\uA9D9\uA9E0-\uA9E4\uA9E6-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA50-\uAA59\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB69\uAB70-\uABE2\uABF0-\uABF9\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF10-\uFF19\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDD07-\uDD33\uDD40-\uDD78\uDD8A\uDD8B\uDE80-\uDE9C\uDEA0-\uDED0\uDEE1-\uDEFB\uDF00-\uDF23\uDF2D-\uDF4A\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF\uDFD1-\uDFD5]|\uD801[\uDC00-\uDC9D\uDCA0-\uDCA9\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDD70-\uDD7A\uDD7C-\uDD8A\uDD8C-\uDD92\uDD94\uDD95\uDD97-\uDDA1\uDDA3-\uDDB1\uDDB3-\uDDB9\uDDBB\uDDBC\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67\uDF80-\uDF85\uDF87-\uDFB0\uDFB2-\uDFBA]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC58-\uDC76\uDC79-\uDC9E\uDCA7-\uDCAF\uDCE0-\uDCF2\uDCF4\uDCF5\uDCFB-\uDD1B\uDD20-\uDD39\uDD80-\uDDB7\uDDBC-\uDDCF\uDDD2-\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE35\uDE40-\uDE48\uDE60-\uDE7E\uDE80-\uDE9F\uDEC0-\uDEC7\uDEC9-\uDEE4\uDEEB-\uDEEF\uDF00-\uDF35\uDF40-\uDF55\uDF58-\uDF72\uDF78-\uDF91\uDFA9-\uDFAF]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2\uDCFA-\uDD23\uDD30-\uDD39\uDE60-\uDE7E\uDE80-\uDEA9\uDEB0\uDEB1\uDF00-\uDF27\uDF30-\uDF45\uDF51-\uDF54\uDF70-\uDF81\uDFB0-\uDFCB\uDFE0-\uDFF6]|\uD804[\uDC03-\uDC37\uDC52-\uDC6F\uDC71\uDC72\uDC75\uDC83-\uDCAF\uDCD0-\uDCE8\uDCF0-\uDCF9\uDD03-\uDD26\uDD36-\uDD3F\uDD44\uDD47\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDD0-\uDDDA\uDDDC\uDDE1-\uDDF4\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDEF0-\uDEF9\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC50-\uDC59\uDC5F-\uDC61\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDCD0-\uDCD9\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE50-\uDE59\uDE80-\uDEAA\uDEB8\uDEC0-\uDEC9\uDF00-\uDF1A\uDF30-\uDF3B\uDF40-\uDF46]|\uD806[\uDC00-\uDC2B\uDCA0-\uDCF2\uDCFF-\uDD06\uDD09\uDD0C-\uDD13\uDD15\uDD16\uDD18-\uDD2F\uDD3F\uDD41\uDD50-\uDD59\uDDA0-\uDDA7\uDDAA-\uDDD0\uDDE1\uDDE3\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE89\uDE9D\uDEB0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC50-\uDC6C\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46\uDD50-\uDD59\uDD60-\uDD65\uDD67\uDD68\uDD6A-\uDD89\uDD98\uDDA0-\uDDA9\uDEE0-\uDEF2\uDFB0\uDFC0-\uDFD4]|\uD808[\uDC00-\uDF99]|\uD809[\uDC00-\uDC6E\uDC80-\uDD43]|\uD80B[\uDF90-\uDFF0]|[\uD80C\uD81C-\uD820\uD822\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879\uD880-\uD883][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDE60-\uDE69\uDE70-\uDEBE\uDEC0-\uDEC9\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF50-\uDF59\uDF5B-\uDF61\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDE40-\uDE96\uDF00-\uDF4A\uDF50\uDF93-\uDF9F\uDFE0\uDFE1\uDFE3]|\uD821[\uDC00-\uDFF7]|\uD823[\uDC00-\uDCD5\uDD00-\uDD08]|\uD82B[\uDFF0-\uDFF3\uDFF5-\uDFFB\uDFFD\uDFFE]|\uD82C[\uDC00-\uDD22\uDD50-\uDD52\uDD64-\uDD67\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD834[\uDEE0-\uDEF3\uDF60-\uDF78]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB\uDFCE-\uDFFF]|\uD837[\uDF00-\uDF1E]|\uD838[\uDD00-\uDD2C\uDD37-\uDD3D\uDD40-\uDD49\uDD4E\uDE90-\uDEAD\uDEC0-\uDEEB\uDEF0-\uDEF9]|\uD839[\uDFE0-\uDFE6\uDFE8-\uDFEB\uDFED\uDFEE\uDFF0-\uDFFE]|\uD83A[\uDC00-\uDCC4\uDCC7-\uDCCF\uDD00-\uDD43\uDD4B\uDD50-\uDD59]|\uD83B[\uDC71-\uDCAB\uDCAD-\uDCAF\uDCB1-\uDCB4\uDD01-\uDD2D\uDD2F-\uDD3D\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD83C[\uDD00-\uDD0C]|\uD83E[\uDFF0-\uDFF9]|\uD869[\uDC00-\uDEDF\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF38\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D]|\uD884[\uDC00-\uDF4A])/)) return;
- var nextChar = match[1] || match[2] || '';
- if (!nextChar || nextChar && (prevChar === '' || this.rules.inline.punctuation.exec(prevChar))) {
- var lLength = match[0].length - 1;
- var rDelim,
- rLength,
- delimTotal = lLength,
- midDelimTotal = 0;
- var endReg = match[0][0] === '*' ? this.rules.inline.emStrong.rDelimAst : this.rules.inline.emStrong.rDelimUnd;
- endReg.lastIndex = 0; // Clip maskedSrc to same section of string as src (move to lexer?)
- maskedSrc = maskedSrc.slice(-1 * src.length + lLength);
- while ((match = endReg.exec(maskedSrc)) != null) {
- rDelim = match[1] || match[2] || match[3] || match[4] || match[5] || match[6];
- if (!rDelim) continue; // skip single * in __abc*abc__
- rLength = rDelim.length;
- if (match[3] || match[4]) {
- // found another Left Delim
- delimTotal += rLength;
- continue;
- } else if (match[5] || match[6]) {
- // either Left or Right Delim
- if (lLength % 3 && !((lLength + rLength) % 3)) {
- midDelimTotal += rLength;
- continue; // CommonMark Emphasis Rules 9-10
- }
- }
- delimTotal -= rLength;
- if (delimTotal > 0) continue; // Haven't found enough closing delimiters
- // Remove extra characters. *a*** -> *a*
- rLength = Math.min(rLength, rLength + delimTotal + midDelimTotal); // Create `em` if smallest delimiter has odd char count. *a***
- if (Math.min(lLength, rLength) % 2) {
- var _text = src.slice(1, lLength + match.index + rLength);
- return {
- type: 'em',
- raw: src.slice(0, lLength + match.index + rLength + 1),
- text: _text,
- tokens: this.lexer.inlineTokens(_text, [])
- };
- } // Create 'strong' if smallest delimiter has even char count. **a***
- var text = src.slice(2, lLength + match.index + rLength - 1);
- return {
- type: 'strong',
- raw: src.slice(0, lLength + match.index + rLength + 1),
- text: text,
- tokens: this.lexer.inlineTokens(text, [])
- };
- }
- }
- };
- _proto.codespan = function codespan(src) {
- var cap = this.rules.inline.code.exec(src);
- if (cap) {
- var text = cap[2].replace(/\n/g, ' ');
- var hasNonSpaceChars = /[^ ]/.test(text);
- var hasSpaceCharsOnBothEnds = /^ /.test(text) && / $/.test(text);
- if (hasNonSpaceChars && hasSpaceCharsOnBothEnds) {
- text = text.substring(1, text.length - 1);
- }
- text = escape(text, true);
- return {
- type: 'codespan',
- raw: cap[0],
- text: text
- };
- }
- };
- _proto.br = function br(src) {
- var cap = this.rules.inline.br.exec(src);
- if (cap) {
- return {
- type: 'br',
- raw: cap[0]
- };
- }
- };
- _proto.del = function del(src) {
- var cap = this.rules.inline.del.exec(src);
- if (cap) {
- return {
- type: 'del',
- raw: cap[0],
- text: cap[2],
- tokens: this.lexer.inlineTokens(cap[2], [])
- };
- }
- };
- _proto.autolink = function autolink(src, mangle) {
- var cap = this.rules.inline.autolink.exec(src);
- if (cap) {
- var text, href;
- if (cap[2] === '@') {
- text = escape(this.options.mangle ? mangle(cap[1]) : cap[1]);
- href = 'mailto:' + text;
- } else {
- text = escape(cap[1]);
- href = text;
- }
- return {
- type: 'link',
- raw: cap[0],
- text: text,
- href: href,
- tokens: [{
- type: 'text',
- raw: text,
- text: text
- }]
- };
- }
- };
- _proto.url = function url(src, mangle) {
- var cap;
- if (cap = this.rules.inline.url.exec(src)) {
- var text, href;
- if (cap[2] === '@') {
- text = escape(this.options.mangle ? mangle(cap[0]) : cap[0]);
- href = 'mailto:' + text;
- } else {
- // do extended autolink path validation
- var prevCapZero;
- do {
- prevCapZero = cap[0];
- cap[0] = this.rules.inline._backpedal.exec(cap[0])[0];
- } while (prevCapZero !== cap[0]);
- text = escape(cap[0]);
- if (cap[1] === 'www.') {
- href = 'http://' + text;
- } else {
- href = text;
- }
- }
- return {
- type: 'link',
- raw: cap[0],
- text: text,
- href: href,
- tokens: [{
- type: 'text',
- raw: text,
- text: text
- }]
- };
- }
- };
- _proto.inlineText = function inlineText(src, smartypants) {
- var cap = this.rules.inline.text.exec(src);
- if (cap) {
- var text;
- if (this.lexer.state.inRawBlock) {
- text = this.options.sanitize ? this.options.sanitizer ? this.options.sanitizer(cap[0]) : escape(cap[0]) : cap[0];
- } else {
- text = escape(this.options.smartypants ? smartypants(cap[0]) : cap[0]);
- }
- return {
- type: 'text',
- raw: cap[0],
- text: text
- };
- }
- };
- return Tokenizer;
- }();
- /**
- * Block-Level Grammar
- */
- var block = {
- newline: /^(?: *(?:\n|$))+/,
- code: /^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,
- fences: /^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?=\n|$)|$)/,
- hr: /^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,
- heading: /^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,
- blockquote: /^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,
- list: /^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/,
- html: '^ {0,3}(?:' // optional indentation
- + '<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)' // (1)
- + '|comment[^\\n]*(\\n+|$)' // (2)
- + '|<\\?[\\s\\S]*?(?:\\?>\\n*|$)' // (3)
- + '|<![A-Z][\\s\\S]*?(?:>\\n*|$)' // (4)
- + '|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)' // (5)
- + '|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (6)
- + '|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) open tag
- + '|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)' // (7) closing tag
- + ')',
- def: /^ {0,3}\[(label)\]: *(?:\n *)?<?([^\s>]+)>?(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/,
- table: noopTest,
- lheading: /^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,
- // regex template, placeholders will be replaced according to different paragraph
- // interruption rules of commonmark and the original markdown spec:
- _paragraph: /^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,
- text: /^[^\n]+/
- };
- block._label = /(?!\s*\])(?:\\.|[^\[\]\\])+/;
- block._title = /(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/;
- block.def = edit(block.def).replace('label', block._label).replace('title', block._title).getRegex();
- block.bullet = /(?:[*+-]|\d{1,9}[.)])/;
- block.listItemStart = edit(/^( *)(bull) */).replace('bull', block.bullet).getRegex();
- block.list = edit(block.list).replace(/bull/g, block.bullet).replace('hr', '\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))').replace('def', '\\n+(?=' + block.def.source + ')').getRegex();
- block._tag = 'address|article|aside|base|basefont|blockquote|body|caption' + '|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption' + '|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe' + '|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option' + '|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr' + '|track|ul';
- block._comment = /<!--(?!-?>)[\s\S]*?(?:-->|$)/;
- block.html = edit(block.html, 'i').replace('comment', block._comment).replace('tag', block._tag).replace('attribute', / +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex();
- block.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
- .replace('|table', '').replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
- .getRegex();
- block.blockquote = edit(block.blockquote).replace('paragraph', block.paragraph).getRegex();
- /**
- * Normal Block Grammar
- */
- block.normal = merge({}, block);
- /**
- * GFM Block Grammar
- */
- block.gfm = merge({}, block.normal, {
- table: '^ *([^\\n ].*\\|.*)\\n' // Header
- + ' {0,3}(?:\\| *)?(:?-+:? *(?:\\| *:?-+:? *)*)(?:\\| *)?' // Align
- + '(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)' // Cells
- });
- block.gfm.table = edit(block.gfm.table).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('blockquote', ' {0,3}>').replace('code', ' {4}[^\\n]').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // tables can be interrupted by type (6) html blocks
- .getRegex();
- block.gfm.paragraph = edit(block._paragraph).replace('hr', block.hr).replace('heading', ' {0,3}#{1,6} ').replace('|lheading', '') // setex headings don't interrupt commonmark paragraphs
- .replace('table', block.gfm.table) // interrupt paragraphs with table
- .replace('blockquote', ' {0,3}>').replace('fences', ' {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n').replace('list', ' {0,3}(?:[*+-]|1[.)]) ') // only lists starting from 1 can interrupt
- .replace('html', '</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)').replace('tag', block._tag) // pars can be interrupted by type (6) html blocks
- .getRegex();
- /**
- * Pedantic grammar (original John Gruber's loose markdown specification)
- */
- block.pedantic = merge({}, block.normal, {
- html: edit('^ *(?:comment *(?:\\n|\\s*$)' + '|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)' // closed tag
- + '|<tag(?:"[^"]*"|\'[^\']*\'|\\s[^\'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))').replace('comment', block._comment).replace(/tag/g, '(?!(?:' + 'a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub' + '|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)' + '\\b)\\w+(?!:|[^\\w\\s@]*@)\\b').getRegex(),
- def: /^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,
- heading: /^(#{1,6})(.*)(?:\n+|$)/,
- fences: noopTest,
- // fences not supported
- paragraph: edit(block.normal._paragraph).replace('hr', block.hr).replace('heading', ' *#{1,6} *[^\n]').replace('lheading', block.lheading).replace('blockquote', ' {0,3}>').replace('|fences', '').replace('|list', '').replace('|html', '').getRegex()
- });
- /**
- * Inline-Level Grammar
- */
- var inline = {
- escape: /^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,
- autolink: /^<(scheme:[^\s\x00-\x1f<>]*|email)>/,
- url: noopTest,
- tag: '^comment' + '|^</[a-zA-Z][\\w:-]*\\s*>' // self-closing tag
- + '|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>' // open tag
- + '|^<\\?[\\s\\S]*?\\?>' // processing instruction, e.g. <?php ?>
- + '|^<![a-zA-Z]+\\s[\\s\\S]*?>' // declaration, e.g. <!DOCTYPE html>
- + '|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>',
- // CDATA section
- link: /^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,
- reflink: /^!?\[(label)\]\[(ref)\]/,
- nolink: /^!?\[(ref)\](?:\[\])?/,
- reflinkSearch: 'reflink|nolink(?!\\()',
- emStrong: {
- lDelim: /^(?:\*+(?:([punct_])|[^\s*]))|^_+(?:([punct*])|([^\s_]))/,
- // (1) and (2) can only be a Right Delimiter. (3) and (4) can only be Left. (5) and (6) can be either Left or Right.
- // () Skip orphan inside strong () Consume to delim (1) #*** (2) a***#, a*** (3) #***a, ***a (4) ***# (5) #***# (6) a***a
- rDelimAst: /^[^_*]*?\_\_[^_*]*?\*[^_*]*?(?=\_\_)|[^*]+(?=[^*])|[punct_](\*+)(?=[\s]|$)|[^punct*_\s](\*+)(?=[punct_\s]|$)|[punct_\s](\*+)(?=[^punct*_\s])|[\s](\*+)(?=[punct_])|[punct_](\*+)(?=[punct_])|[^punct*_\s](\*+)(?=[^punct*_\s])/,
- rDelimUnd: /^[^_*]*?\*\*[^_*]*?\_[^_*]*?(?=\*\*)|[^_]+(?=[^_])|[punct*](\_+)(?=[\s]|$)|[^punct*_\s](\_+)(?=[punct*\s]|$)|[punct*\s](\_+)(?=[^punct*_\s])|[\s](\_+)(?=[punct*])|[punct*](\_+)(?=[punct*])/ // ^- Not allowed for _
- },
- code: /^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,
- br: /^( {2,}|\\)\n(?!\s*$)/,
- del: noopTest,
- text: /^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,
- punctuation: /^([\spunctuation])/
- }; // list of punctuation marks from CommonMark spec
- // without * and _ to handle the different emphasis markers * and _
- inline._punctuation = '!"#$%&\'()+\\-.,/:;<=>?@\\[\\]`^{|}~';
- inline.punctuation = edit(inline.punctuation).replace(/punctuation/g, inline._punctuation).getRegex(); // sequences em should skip over [title](link), `code`, <html>
- inline.blockSkip = /\[[^\]]*?\]\([^\)]*?\)|`[^`]*?`|<[^>]*?>/g;
- inline.escapedEmSt = /\\\*|\\_/g;
- inline._comment = edit(block._comment).replace('(?:-->|$)', '-->').getRegex();
- inline.emStrong.lDelim = edit(inline.emStrong.lDelim).replace(/punct/g, inline._punctuation).getRegex();
- inline.emStrong.rDelimAst = edit(inline.emStrong.rDelimAst, 'g').replace(/punct/g, inline._punctuation).getRegex();
- inline.emStrong.rDelimUnd = edit(inline.emStrong.rDelimUnd, 'g').replace(/punct/g, inline._punctuation).getRegex();
- inline._escapes = /\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g;
- inline._scheme = /[a-zA-Z][a-zA-Z0-9+.-]{1,31}/;
- inline._email = /[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/;
- inline.autolink = edit(inline.autolink).replace('scheme', inline._scheme).replace('email', inline._email).getRegex();
- inline._attribute = /\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/;
- inline.tag = edit(inline.tag).replace('comment', inline._comment).replace('attribute', inline._attribute).getRegex();
- inline._label = /(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/;
- inline._href = /<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/;
- inline._title = /"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/;
- inline.link = edit(inline.link).replace('label', inline._label).replace('href', inline._href).replace('title', inline._title).getRegex();
- inline.reflink = edit(inline.reflink).replace('label', inline._label).replace('ref', block._label).getRegex();
- inline.nolink = edit(inline.nolink).replace('ref', block._label).getRegex();
- inline.reflinkSearch = edit(inline.reflinkSearch, 'g').replace('reflink', inline.reflink).replace('nolink', inline.nolink).getRegex();
- /**
- * Normal Inline Grammar
- */
- inline.normal = merge({}, inline);
- /**
- * Pedantic Inline Grammar
- */
- inline.pedantic = merge({}, inline.normal, {
- strong: {
- start: /^__|\*\*/,
- middle: /^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,
- endAst: /\*\*(?!\*)/g,
- endUnd: /__(?!_)/g
- },
- em: {
- start: /^_|\*/,
- middle: /^()\*(?=\S)([\s\S]*?\S)\*(?!\*)|^_(?=\S)([\s\S]*?\S)_(?!_)/,
- endAst: /\*(?!\*)/g,
- endUnd: /_(?!_)/g
- },
- link: edit(/^!?\[(label)\]\((.*?)\)/).replace('label', inline._label).getRegex(),
- reflink: edit(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace('label', inline._label).getRegex()
- });
- /**
- * GFM Inline Grammar
- */
- inline.gfm = merge({}, inline.normal, {
- escape: edit(inline.escape).replace('])', '~|])').getRegex(),
- _extended_email: /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,
- url: /^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,
- _backpedal: /(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,
- del: /^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,
- text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/
- });
- inline.gfm.url = edit(inline.gfm.url, 'i').replace('email', inline.gfm._extended_email).getRegex();
- /**
- * GFM + Line Breaks Inline Grammar
- */
- inline.breaks = merge({}, inline.gfm, {
- br: edit(inline.br).replace('{2,}', '*').getRegex(),
- text: edit(inline.gfm.text).replace('\\b_', '\\b_| {2,}\\n').replace(/\{2,\}/g, '*').getRegex()
- });
- /**
- * smartypants text replacement
- * @param {string} text
- */
- function smartypants(text) {
- return text // em-dashes
- .replace(/---/g, "\u2014") // en-dashes
- .replace(/--/g, "\u2013") // opening singles
- .replace(/(^|[-\u2014/(\[{"\s])'/g, "$1\u2018") // closing singles & apostrophes
- .replace(/'/g, "\u2019") // opening doubles
- .replace(/(^|[-\u2014/(\[{\u2018\s])"/g, "$1\u201C") // closing doubles
- .replace(/"/g, "\u201D") // ellipses
- .replace(/\.{3}/g, "\u2026");
- }
- /**
- * mangle email addresses
- * @param {string} text
- */
- function mangle(text) {
- var out = '',
- i,
- ch;
- var l = text.length;
- for (i = 0; i < l; i++) {
- ch = text.charCodeAt(i);
- if (Math.random() > 0.5) {
- ch = 'x' + ch.toString(16);
- }
- out += '&#' + ch + ';';
- }
- return out;
- }
- /**
- * Block Lexer
- */
- var Lexer = /*#__PURE__*/function () {
- function Lexer(options) {
- this.tokens = [];
- this.tokens.links = Object.create(null);
- this.options = options || exports.defaults;
- this.options.tokenizer = this.options.tokenizer || new Tokenizer();
- this.tokenizer = this.options.tokenizer;
- this.tokenizer.options = this.options;
- this.tokenizer.lexer = this;
- this.inlineQueue = [];
- this.state = {
- inLink: false,
- inRawBlock: false,
- top: true
- };
- var rules = {
- block: block.normal,
- inline: inline.normal
- };
- if (this.options.pedantic) {
- rules.block = block.pedantic;
- rules.inline = inline.pedantic;
- } else if (this.options.gfm) {
- rules.block = block.gfm;
- if (this.options.breaks) {
- rules.inline = inline.breaks;
- } else {
- rules.inline = inline.gfm;
- }
- }
- this.tokenizer.rules = rules;
- }
- /**
- * Expose Rules
- */
- /**
- * Static Lex Method
- */
- Lexer.lex = function lex(src, options) {
- var lexer = new Lexer(options);
- return lexer.lex(src);
- }
- /**
- * Static Lex Inline Method
- */
- ;
- Lexer.lexInline = function lexInline(src, options) {
- var lexer = new Lexer(options);
- return lexer.inlineTokens(src);
- }
- /**
- * Preprocessing
- */
- ;
- var _proto = Lexer.prototype;
- _proto.lex = function lex(src) {
- src = src.replace(/\r\n|\r/g, '\n');
- this.blockTokens(src, this.tokens);
- var next;
- while (next = this.inlineQueue.shift()) {
- this.inlineTokens(next.src, next.tokens);
- }
- return this.tokens;
- }
- /**
- * Lexing
- */
- ;
- _proto.blockTokens = function blockTokens(src, tokens) {
- var _this = this;
- if (tokens === void 0) {
- tokens = [];
- }
- if (this.options.pedantic) {
- src = src.replace(/\t/g, ' ').replace(/^ +$/gm, '');
- } else {
- src = src.replace(/^( *)(\t+)/gm, function (_, leading, tabs) {
- return leading + ' '.repeat(tabs.length);
- });
- }
- var token, lastToken, cutSrc, lastParagraphClipped;
- while (src) {
- if (this.options.extensions && this.options.extensions.block && this.options.extensions.block.some(function (extTokenizer) {
- if (token = extTokenizer.call({
- lexer: _this
- }, src, tokens)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- return true;
- }
- return false;
- })) {
- continue;
- } // newline
- if (token = this.tokenizer.space(src)) {
- src = src.substring(token.raw.length);
- if (token.raw.length === 1 && tokens.length > 0) {
- // if there's a single \n as a spacer, it's terminating the last line,
- // so move it there so that we don't get unecessary paragraph tags
- tokens[tokens.length - 1].raw += '\n';
- } else {
- tokens.push(token);
- }
- continue;
- } // code
- if (token = this.tokenizer.code(src)) {
- src = src.substring(token.raw.length);
- lastToken = tokens[tokens.length - 1]; // An indented code block cannot interrupt a paragraph.
- if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
- lastToken.raw += '\n' + token.raw;
- lastToken.text += '\n' + token.text;
- this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
- } else {
- tokens.push(token);
- }
- continue;
- } // fences
- if (token = this.tokenizer.fences(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // heading
- if (token = this.tokenizer.heading(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // hr
- if (token = this.tokenizer.hr(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // blockquote
- if (token = this.tokenizer.blockquote(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // list
- if (token = this.tokenizer.list(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // html
- if (token = this.tokenizer.html(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // def
- if (token = this.tokenizer.def(src)) {
- src = src.substring(token.raw.length);
- lastToken = tokens[tokens.length - 1];
- if (lastToken && (lastToken.type === 'paragraph' || lastToken.type === 'text')) {
- lastToken.raw += '\n' + token.raw;
- lastToken.text += '\n' + token.raw;
- this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
- } else if (!this.tokens.links[token.tag]) {
- this.tokens.links[token.tag] = {
- href: token.href,
- title: token.title
- };
- }
- continue;
- } // table (gfm)
- if (token = this.tokenizer.table(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // lheading
- if (token = this.tokenizer.lheading(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // top-level paragraph
- // prevent paragraph consuming extensions by clipping 'src' to extension start
- cutSrc = src;
- if (this.options.extensions && this.options.extensions.startBlock) {
- (function () {
- var startIndex = Infinity;
- var tempSrc = src.slice(1);
- var tempStart = void 0;
- _this.options.extensions.startBlock.forEach(function (getStartIndex) {
- tempStart = getStartIndex.call({
- lexer: this
- }, tempSrc);
- if (typeof tempStart === 'number' && tempStart >= 0) {
- startIndex = Math.min(startIndex, tempStart);
- }
- });
- if (startIndex < Infinity && startIndex >= 0) {
- cutSrc = src.substring(0, startIndex + 1);
- }
- })();
- }
- if (this.state.top && (token = this.tokenizer.paragraph(cutSrc))) {
- lastToken = tokens[tokens.length - 1];
- if (lastParagraphClipped && lastToken.type === 'paragraph') {
- lastToken.raw += '\n' + token.raw;
- lastToken.text += '\n' + token.text;
- this.inlineQueue.pop();
- this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
- } else {
- tokens.push(token);
- }
- lastParagraphClipped = cutSrc.length !== src.length;
- src = src.substring(token.raw.length);
- continue;
- } // text
- if (token = this.tokenizer.text(src)) {
- src = src.substring(token.raw.length);
- lastToken = tokens[tokens.length - 1];
- if (lastToken && lastToken.type === 'text') {
- lastToken.raw += '\n' + token.raw;
- lastToken.text += '\n' + token.text;
- this.inlineQueue.pop();
- this.inlineQueue[this.inlineQueue.length - 1].src = lastToken.text;
- } else {
- tokens.push(token);
- }
- continue;
- }
- if (src) {
- var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
- if (this.options.silent) {
- console.error(errMsg);
- break;
- } else {
- throw new Error(errMsg);
- }
- }
- }
- this.state.top = true;
- return tokens;
- };
- _proto.inline = function inline(src, tokens) {
- if (tokens === void 0) {
- tokens = [];
- }
- this.inlineQueue.push({
- src: src,
- tokens: tokens
- });
- return tokens;
- }
- /**
- * Lexing/Compiling
- */
- ;
- _proto.inlineTokens = function inlineTokens(src, tokens) {
- var _this2 = this;
- if (tokens === void 0) {
- tokens = [];
- }
- var token, lastToken, cutSrc; // String with links masked to avoid interference with em and strong
- var maskedSrc = src;
- var match;
- var keepPrevChar, prevChar; // Mask out reflinks
- if (this.tokens.links) {
- var links = Object.keys(this.tokens.links);
- if (links.length > 0) {
- while ((match = this.tokenizer.rules.inline.reflinkSearch.exec(maskedSrc)) != null) {
- if (links.includes(match[0].slice(match[0].lastIndexOf('[') + 1, -1))) {
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex);
- }
- }
- }
- } // Mask out other blocks
- while ((match = this.tokenizer.rules.inline.blockSkip.exec(maskedSrc)) != null) {
- maskedSrc = maskedSrc.slice(0, match.index) + '[' + repeatString('a', match[0].length - 2) + ']' + maskedSrc.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);
- } // Mask out escaped em & strong delimiters
- while ((match = this.tokenizer.rules.inline.escapedEmSt.exec(maskedSrc)) != null) {
- maskedSrc = maskedSrc.slice(0, match.index) + '++' + maskedSrc.slice(this.tokenizer.rules.inline.escapedEmSt.lastIndex);
- }
- while (src) {
- if (!keepPrevChar) {
- prevChar = '';
- }
- keepPrevChar = false; // extensions
- if (this.options.extensions && this.options.extensions.inline && this.options.extensions.inline.some(function (extTokenizer) {
- if (token = extTokenizer.call({
- lexer: _this2
- }, src, tokens)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- return true;
- }
- return false;
- })) {
- continue;
- } // escape
- if (token = this.tokenizer.escape(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // tag
- if (token = this.tokenizer.tag(src)) {
- src = src.substring(token.raw.length);
- lastToken = tokens[tokens.length - 1];
- if (lastToken && token.type === 'text' && lastToken.type === 'text') {
- lastToken.raw += token.raw;
- lastToken.text += token.text;
- } else {
- tokens.push(token);
- }
- continue;
- } // link
- if (token = this.tokenizer.link(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // reflink, nolink
- if (token = this.tokenizer.reflink(src, this.tokens.links)) {
- src = src.substring(token.raw.length);
- lastToken = tokens[tokens.length - 1];
- if (lastToken && token.type === 'text' && lastToken.type === 'text') {
- lastToken.raw += token.raw;
- lastToken.text += token.text;
- } else {
- tokens.push(token);
- }
- continue;
- } // em & strong
- if (token = this.tokenizer.emStrong(src, maskedSrc, prevChar)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // code
- if (token = this.tokenizer.codespan(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // br
- if (token = this.tokenizer.br(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // del (gfm)
- if (token = this.tokenizer.del(src)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // autolink
- if (token = this.tokenizer.autolink(src, mangle)) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // url (gfm)
- if (!this.state.inLink && (token = this.tokenizer.url(src, mangle))) {
- src = src.substring(token.raw.length);
- tokens.push(token);
- continue;
- } // text
- // prevent inlineText consuming extensions by clipping 'src' to extension start
- cutSrc = src;
- if (this.options.extensions && this.options.extensions.startInline) {
- (function () {
- var startIndex = Infinity;
- var tempSrc = src.slice(1);
- var tempStart = void 0;
- _this2.options.extensions.startInline.forEach(function (getStartIndex) {
- tempStart = getStartIndex.call({
- lexer: this
- }, tempSrc);
- if (typeof tempStart === 'number' && tempStart >= 0) {
- startIndex = Math.min(startIndex, tempStart);
- }
- });
- if (startIndex < Infinity && startIndex >= 0) {
- cutSrc = src.substring(0, startIndex + 1);
- }
- })();
- }
- if (token = this.tokenizer.inlineText(cutSrc, smartypants)) {
- src = src.substring(token.raw.length);
- if (token.raw.slice(-1) !== '_') {
- // Track prevChar before string of ____ started
- prevChar = token.raw.slice(-1);
- }
- keepPrevChar = true;
- lastToken = tokens[tokens.length - 1];
- if (lastToken && lastToken.type === 'text') {
- lastToken.raw += token.raw;
- lastToken.text += token.text;
- } else {
- tokens.push(token);
- }
- continue;
- }
- if (src) {
- var errMsg = 'Infinite loop on byte: ' + src.charCodeAt(0);
- if (this.options.silent) {
- console.error(errMsg);
- break;
- } else {
- throw new Error(errMsg);
- }
- }
- }
- return tokens;
- };
- _createClass(Lexer, null, [{
- key: "rules",
- get: function get() {
- return {
- block: block,
- inline: inline
- };
- }
- }]);
- return Lexer;
- }();
- /**
- * Renderer
- */
- var Renderer = /*#__PURE__*/function () {
- function Renderer(options) {
- this.options = options || exports.defaults;
- }
- var _proto = Renderer.prototype;
- _proto.code = function code(_code, infostring, escaped) {
- var lang = (infostring || '').match(/\S*/)[0];
- if (this.options.highlight) {
- var out = this.options.highlight(_code, lang);
- if (out != null && out !== _code) {
- escaped = true;
- _code = out;
- }
- }
- _code = _code.replace(/\n$/, '') + '\n';
- if (!lang) {
- return '<pre><code>' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
- }
- return '<pre><code class="' + this.options.langPrefix + escape(lang, true) + '">' + (escaped ? _code : escape(_code, true)) + '</code></pre>\n';
- }
- /**
- * @param {string} quote
- */
- ;
- _proto.blockquote = function blockquote(quote) {
- return "<blockquote>\n" + quote + "</blockquote>\n";
- };
- _proto.html = function html(_html) {
- return _html;
- }
- /**
- * @param {string} text
- * @param {string} level
- * @param {string} raw
- * @param {any} slugger
- */
- ;
- _proto.heading = function heading(text, level, raw, slugger) {
- if (this.options.headerIds) {
- var id = this.options.headerPrefix + slugger.slug(raw);
- return "<h" + level + " id=\"" + id + "\">" + text + "</h" + level + ">\n";
- } // ignore IDs
- return "<h" + level + ">" + text + "</h" + level + ">\n";
- };
- _proto.hr = function hr() {
- return this.options.xhtml ? '<hr/>\n' : '<hr>\n';
- };
- _proto.list = function list(body, ordered, start) {
- var type = ordered ? 'ol' : 'ul',
- startatt = ordered && start !== 1 ? ' start="' + start + '"' : '';
- return '<' + type + startatt + '>\n' + body + '</' + type + '>\n';
- }
- /**
- * @param {string} text
- */
- ;
- _proto.listitem = function listitem(text) {
- return "<li>" + text + "</li>\n";
- };
- _proto.checkbox = function checkbox(checked) {
- return '<input ' + (checked ? 'checked="" ' : '') + 'disabled="" type="checkbox"' + (this.options.xhtml ? ' /' : '') + '> ';
- }
- /**
- * @param {string} text
- */
- ;
- _proto.paragraph = function paragraph(text) {
- return "<p>" + text + "</p>\n";
- }
- /**
- * @param {string} header
- * @param {string} body
- */
- ;
- _proto.table = function table(header, body) {
- if (body) body = "<tbody>" + body + "</tbody>";
- return '<table>\n' + '<thead>\n' + header + '</thead>\n' + body + '</table>\n';
- }
- /**
- * @param {string} content
- */
- ;
- _proto.tablerow = function tablerow(content) {
- return "<tr>\n" + content + "</tr>\n";
- };
- _proto.tablecell = function tablecell(content, flags) {
- var type = flags.header ? 'th' : 'td';
- var tag = flags.align ? "<" + type + " align=\"" + flags.align + "\">" : "<" + type + ">";
- return tag + content + ("</" + type + ">\n");
- }
- /**
- * span level renderer
- * @param {string} text
- */
- ;
- _proto.strong = function strong(text) {
- return "<strong>" + text + "</strong>";
- }
- /**
- * @param {string} text
- */
- ;
- _proto.em = function em(text) {
- return "<em>" + text + "</em>";
- }
- /**
- * @param {string} text
- */
- ;
- _proto.codespan = function codespan(text) {
- return "<code>" + text + "</code>";
- };
- _proto.br = function br() {
- return this.options.xhtml ? '<br/>' : '<br>';
- }
- /**
- * @param {string} text
- */
- ;
- _proto.del = function del(text) {
- return "<del>" + text + "</del>";
- }
- /**
- * @param {string} href
- * @param {string} title
- * @param {string} text
- */
- ;
- _proto.link = function link(href, title, text) {
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
- if (href === null) {
- return text;
- }
- var out = '<a href="' + escape(href) + '"';
- if (title) {
- out += ' title="' + title + '"';
- }
- out += '>' + text + '</a>';
- return out;
- }
- /**
- * @param {string} href
- * @param {string} title
- * @param {string} text
- */
- ;
- _proto.image = function image(href, title, text) {
- href = cleanUrl(this.options.sanitize, this.options.baseUrl, href);
- if (href === null) {
- return text;
- }
- var out = "<img src=\"" + href + "\" alt=\"" + text + "\"";
- if (title) {
- out += " title=\"" + title + "\"";
- }
- out += this.options.xhtml ? '/>' : '>';
- return out;
- };
- _proto.text = function text(_text) {
- return _text;
- };
- return Renderer;
- }();
- /**
- * TextRenderer
- * returns only the textual part of the token
- */
- var TextRenderer = /*#__PURE__*/function () {
- function TextRenderer() {}
- var _proto = TextRenderer.prototype;
- // no need for block level renderers
- _proto.strong = function strong(text) {
- return text;
- };
- _proto.em = function em(text) {
- return text;
- };
- _proto.codespan = function codespan(text) {
- return text;
- };
- _proto.del = function del(text) {
- return text;
- };
- _proto.html = function html(text) {
- return text;
- };
- _proto.text = function text(_text) {
- return _text;
- };
- _proto.link = function link(href, title, text) {
- return '' + text;
- };
- _proto.image = function image(href, title, text) {
- return '' + text;
- };
- _proto.br = function br() {
- return '';
- };
- return TextRenderer;
- }();
- /**
- * Slugger generates header id
- */
- var Slugger = /*#__PURE__*/function () {
- function Slugger() {
- this.seen = {};
- }
- /**
- * @param {string} value
- */
- var _proto = Slugger.prototype;
- _proto.serialize = function serialize(value) {
- return value.toLowerCase().trim() // remove html tags
- .replace(/<[!\/a-z].*?>/ig, '') // remove unwanted chars
- .replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g, '').replace(/\s/g, '-');
- }
- /**
- * Finds the next safe (unique) slug to use
- * @param {string} originalSlug
- * @param {boolean} isDryRun
- */
- ;
- _proto.getNextSafeSlug = function getNextSafeSlug(originalSlug, isDryRun) {
- var slug = originalSlug;
- var occurenceAccumulator = 0;
- if (this.seen.hasOwnProperty(slug)) {
- occurenceAccumulator = this.seen[originalSlug];
- do {
- occurenceAccumulator++;
- slug = originalSlug + '-' + occurenceAccumulator;
- } while (this.seen.hasOwnProperty(slug));
- }
- if (!isDryRun) {
- this.seen[originalSlug] = occurenceAccumulator;
- this.seen[slug] = 0;
- }
- return slug;
- }
- /**
- * Convert string to unique id
- * @param {object} [options]
- * @param {boolean} [options.dryrun] Generates the next unique slug without
- * updating the internal accumulator.
- */
- ;
- _proto.slug = function slug(value, options) {
- if (options === void 0) {
- options = {};
- }
- var slug = this.serialize(value);
- return this.getNextSafeSlug(slug, options.dryrun);
- };
- return Slugger;
- }();
- /**
- * Parsing & Compiling
- */
- var Parser = /*#__PURE__*/function () {
- function Parser(options) {
- this.options = options || exports.defaults;
- this.options.renderer = this.options.renderer || new Renderer();
- this.renderer = this.options.renderer;
- this.renderer.options = this.options;
- this.textRenderer = new TextRenderer();
- this.slugger = new Slugger();
- }
- /**
- * Static Parse Method
- */
- Parser.parse = function parse(tokens, options) {
- var parser = new Parser(options);
- return parser.parse(tokens);
- }
- /**
- * Static Parse Inline Method
- */
- ;
- Parser.parseInline = function parseInline(tokens, options) {
- var parser = new Parser(options);
- return parser.parseInline(tokens);
- }
- /**
- * Parse Loop
- */
- ;
- var _proto = Parser.prototype;
- _proto.parse = function parse(tokens, top) {
- if (top === void 0) {
- top = true;
- }
- var out = '',
- i,
- j,
- k,
- l2,
- l3,
- row,
- cell,
- header,
- body,
- token,
- ordered,
- start,
- loose,
- itemBody,
- item,
- checked,
- task,
- checkbox,
- ret;
- var l = tokens.length;
- for (i = 0; i < l; i++) {
- token = tokens[i]; // Run any renderer extensions
- if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
- ret = this.options.extensions.renderers[token.type].call({
- parser: this
- }, token);
- if (ret !== false || !['space', 'hr', 'heading', 'code', 'table', 'blockquote', 'list', 'html', 'paragraph', 'text'].includes(token.type)) {
- out += ret || '';
- continue;
- }
- }
- switch (token.type) {
- case 'space':
- {
- continue;
- }
- case 'hr':
- {
- out += this.renderer.hr();
- continue;
- }
- case 'heading':
- {
- out += this.renderer.heading(this.parseInline(token.tokens), token.depth, unescape(this.parseInline(token.tokens, this.textRenderer)), this.slugger);
- continue;
- }
- case 'code':
- {
- out += this.renderer.code(token.text, token.lang, token.escaped);
- continue;
- }
- case 'table':
- {
- header = ''; // header
- cell = '';
- l2 = token.header.length;
- for (j = 0; j < l2; j++) {
- cell += this.renderer.tablecell(this.parseInline(token.header[j].tokens), {
- header: true,
- align: token.align[j]
- });
- }
- header += this.renderer.tablerow(cell);
- body = '';
- l2 = token.rows.length;
- for (j = 0; j < l2; j++) {
- row = token.rows[j];
- cell = '';
- l3 = row.length;
- for (k = 0; k < l3; k++) {
- cell += this.renderer.tablecell(this.parseInline(row[k].tokens), {
- header: false,
- align: token.align[k]
- });
- }
- body += this.renderer.tablerow(cell);
- }
- out += this.renderer.table(header, body);
- continue;
- }
- case 'blockquote':
- {
- body = this.parse(token.tokens);
- out += this.renderer.blockquote(body);
- continue;
- }
- case 'list':
- {
- ordered = token.ordered;
- start = token.start;
- loose = token.loose;
- l2 = token.items.length;
- body = '';
- for (j = 0; j < l2; j++) {
- item = token.items[j];
- checked = item.checked;
- task = item.task;
- itemBody = '';
- if (item.task) {
- checkbox = this.renderer.checkbox(checked);
- if (loose) {
- if (item.tokens.length > 0 && item.tokens[0].type === 'paragraph') {
- item.tokens[0].text = checkbox + ' ' + item.tokens[0].text;
- if (item.tokens[0].tokens && item.tokens[0].tokens.length > 0 && item.tokens[0].tokens[0].type === 'text') {
- item.tokens[0].tokens[0].text = checkbox + ' ' + item.tokens[0].tokens[0].text;
- }
- } else {
- item.tokens.unshift({
- type: 'text',
- text: checkbox
- });
- }
- } else {
- itemBody += checkbox;
- }
- }
- itemBody += this.parse(item.tokens, loose);
- body += this.renderer.listitem(itemBody, task, checked);
- }
- out += this.renderer.list(body, ordered, start);
- continue;
- }
- case 'html':
- {
- // TODO parse inline content if parameter markdown=1
- out += this.renderer.html(token.text);
- continue;
- }
- case 'paragraph':
- {
- out += this.renderer.paragraph(this.parseInline(token.tokens));
- continue;
- }
- case 'text':
- {
- body = token.tokens ? this.parseInline(token.tokens) : token.text;
- while (i + 1 < l && tokens[i + 1].type === 'text') {
- token = tokens[++i];
- body += '\n' + (token.tokens ? this.parseInline(token.tokens) : token.text);
- }
- out += top ? this.renderer.paragraph(body) : body;
- continue;
- }
- default:
- {
- var errMsg = 'Token with "' + token.type + '" type was not found.';
- if (this.options.silent) {
- console.error(errMsg);
- return;
- } else {
- throw new Error(errMsg);
- }
- }
- }
- }
- return out;
- }
- /**
- * Parse Inline Tokens
- */
- ;
- _proto.parseInline = function parseInline(tokens, renderer) {
- renderer = renderer || this.renderer;
- var out = '',
- i,
- token,
- ret;
- var l = tokens.length;
- for (i = 0; i < l; i++) {
- token = tokens[i]; // Run any renderer extensions
- if (this.options.extensions && this.options.extensions.renderers && this.options.extensions.renderers[token.type]) {
- ret = this.options.extensions.renderers[token.type].call({
- parser: this
- }, token);
- if (ret !== false || !['escape', 'html', 'link', 'image', 'strong', 'em', 'codespan', 'br', 'del', 'text'].includes(token.type)) {
- out += ret || '';
- continue;
- }
- }
- switch (token.type) {
- case 'escape':
- {
- out += renderer.text(token.text);
- break;
- }
- case 'html':
- {
- out += renderer.html(token.text);
- break;
- }
- case 'link':
- {
- out += renderer.link(token.href, token.title, this.parseInline(token.tokens, renderer));
- break;
- }
- case 'image':
- {
- out += renderer.image(token.href, token.title, token.text);
- break;
- }
- case 'strong':
- {
- out += renderer.strong(this.parseInline(token.tokens, renderer));
- break;
- }
- case 'em':
- {
- out += renderer.em(this.parseInline(token.tokens, renderer));
- break;
- }
- case 'codespan':
- {
- out += renderer.codespan(token.text);
- break;
- }
- case 'br':
- {
- out += renderer.br();
- break;
- }
- case 'del':
- {
- out += renderer.del(this.parseInline(token.tokens, renderer));
- break;
- }
- case 'text':
- {
- out += renderer.text(token.text);
- break;
- }
- default:
- {
- var errMsg = 'Token with "' + token.type + '" type was not found.';
- if (this.options.silent) {
- console.error(errMsg);
- return;
- } else {
- throw new Error(errMsg);
- }
- }
- }
- }
- return out;
- };
- return Parser;
- }();
- /**
- * Marked
- */
- function marked(src, opt, callback) {
- // throw error in case of non string input
- if (typeof src === 'undefined' || src === null) {
- throw new Error('marked(): input parameter is undefined or null');
- }
- if (typeof src !== 'string') {
- throw new Error('marked(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
- }
- if (typeof opt === 'function') {
- callback = opt;
- opt = null;
- }
- opt = merge({}, marked.defaults, opt || {});
- checkSanitizeDeprecation(opt);
- if (callback) {
- var highlight = opt.highlight;
- var tokens;
- try {
- tokens = Lexer.lex(src, opt);
- } catch (e) {
- return callback(e);
- }
- var done = function done(err) {
- var out;
- if (!err) {
- try {
- if (opt.walkTokens) {
- marked.walkTokens(tokens, opt.walkTokens);
- }
- out = Parser.parse(tokens, opt);
- } catch (e) {
- err = e;
- }
- }
- opt.highlight = highlight;
- return err ? callback(err) : callback(null, out);
- };
- if (!highlight || highlight.length < 3) {
- return done();
- }
- delete opt.highlight;
- if (!tokens.length) return done();
- var pending = 0;
- marked.walkTokens(tokens, function (token) {
- if (token.type === 'code') {
- pending++;
- setTimeout(function () {
- highlight(token.text, token.lang, function (err, code) {
- if (err) {
- return done(err);
- }
- if (code != null && code !== token.text) {
- token.text = code;
- token.escaped = true;
- }
- pending--;
- if (pending === 0) {
- done();
- }
- });
- }, 0);
- }
- });
- if (pending === 0) {
- done();
- }
- return;
- }
- try {
- var _tokens = Lexer.lex(src, opt);
- if (opt.walkTokens) {
- marked.walkTokens(_tokens, opt.walkTokens);
- }
- return Parser.parse(_tokens, opt);
- } catch (e) {
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
- if (opt.silent) {
- return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
- }
- throw e;
- }
- }
- /**
- * Options
- */
- marked.options = marked.setOptions = function (opt) {
- merge(marked.defaults, opt);
- changeDefaults(marked.defaults);
- return marked;
- };
- marked.getDefaults = getDefaults;
- marked.defaults = exports.defaults;
- /**
- * Use Extension
- */
- marked.use = function () {
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
- args[_key] = arguments[_key];
- }
- var opts = merge.apply(void 0, [{}].concat(args));
- var extensions = marked.defaults.extensions || {
- renderers: {},
- childTokens: {}
- };
- var hasExtensions;
- args.forEach(function (pack) {
- // ==-- Parse "addon" extensions --== //
- if (pack.extensions) {
- hasExtensions = true;
- pack.extensions.forEach(function (ext) {
- if (!ext.name) {
- throw new Error('extension name required');
- }
- if (ext.renderer) {
- // Renderer extensions
- var prevRenderer = extensions.renderers ? extensions.renderers[ext.name] : null;
- if (prevRenderer) {
- // Replace extension with func to run new extension but fall back if false
- extensions.renderers[ext.name] = function () {
- for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
- args[_key2] = arguments[_key2];
- }
- var ret = ext.renderer.apply(this, args);
- if (ret === false) {
- ret = prevRenderer.apply(this, args);
- }
- return ret;
- };
- } else {
- extensions.renderers[ext.name] = ext.renderer;
- }
- }
- if (ext.tokenizer) {
- // Tokenizer Extensions
- if (!ext.level || ext.level !== 'block' && ext.level !== 'inline') {
- throw new Error("extension level must be 'block' or 'inline'");
- }
- if (extensions[ext.level]) {
- extensions[ext.level].unshift(ext.tokenizer);
- } else {
- extensions[ext.level] = [ext.tokenizer];
- }
- if (ext.start) {
- // Function to check for start of token
- if (ext.level === 'block') {
- if (extensions.startBlock) {
- extensions.startBlock.push(ext.start);
- } else {
- extensions.startBlock = [ext.start];
- }
- } else if (ext.level === 'inline') {
- if (extensions.startInline) {
- extensions.startInline.push(ext.start);
- } else {
- extensions.startInline = [ext.start];
- }
- }
- }
- }
- if (ext.childTokens) {
- // Child tokens to be visited by walkTokens
- extensions.childTokens[ext.name] = ext.childTokens;
- }
- });
- } // ==-- Parse "overwrite" extensions --== //
- if (pack.renderer) {
- (function () {
- var renderer = marked.defaults.renderer || new Renderer();
- var _loop = function _loop(prop) {
- var prevRenderer = renderer[prop]; // Replace renderer with func to run extension, but fall back if false
- renderer[prop] = function () {
- for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
- args[_key3] = arguments[_key3];
- }
- var ret = pack.renderer[prop].apply(renderer, args);
- if (ret === false) {
- ret = prevRenderer.apply(renderer, args);
- }
- return ret;
- };
- };
- for (var prop in pack.renderer) {
- _loop(prop);
- }
- opts.renderer = renderer;
- })();
- }
- if (pack.tokenizer) {
- (function () {
- var tokenizer = marked.defaults.tokenizer || new Tokenizer();
- var _loop2 = function _loop2(prop) {
- var prevTokenizer = tokenizer[prop]; // Replace tokenizer with func to run extension, but fall back if false
- tokenizer[prop] = function () {
- for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
- args[_key4] = arguments[_key4];
- }
- var ret = pack.tokenizer[prop].apply(tokenizer, args);
- if (ret === false) {
- ret = prevTokenizer.apply(tokenizer, args);
- }
- return ret;
- };
- };
- for (var prop in pack.tokenizer) {
- _loop2(prop);
- }
- opts.tokenizer = tokenizer;
- })();
- } // ==-- Parse WalkTokens extensions --== //
- if (pack.walkTokens) {
- var _walkTokens = marked.defaults.walkTokens;
- opts.walkTokens = function (token) {
- pack.walkTokens.call(this, token);
- if (_walkTokens) {
- _walkTokens.call(this, token);
- }
- };
- }
- if (hasExtensions) {
- opts.extensions = extensions;
- }
- marked.setOptions(opts);
- });
- };
- /**
- * Run callback for every token
- */
- marked.walkTokens = function (tokens, callback) {
- var _loop3 = function _loop3() {
- var token = _step.value;
- callback.call(marked, token);
- switch (token.type) {
- case 'table':
- {
- for (var _iterator2 = _createForOfIteratorHelperLoose(token.header), _step2; !(_step2 = _iterator2()).done;) {
- var cell = _step2.value;
- marked.walkTokens(cell.tokens, callback);
- }
- for (var _iterator3 = _createForOfIteratorHelperLoose(token.rows), _step3; !(_step3 = _iterator3()).done;) {
- var row = _step3.value;
- for (var _iterator4 = _createForOfIteratorHelperLoose(row), _step4; !(_step4 = _iterator4()).done;) {
- var _cell = _step4.value;
- marked.walkTokens(_cell.tokens, callback);
- }
- }
- break;
- }
- case 'list':
- {
- marked.walkTokens(token.items, callback);
- break;
- }
- default:
- {
- if (marked.defaults.extensions && marked.defaults.extensions.childTokens && marked.defaults.extensions.childTokens[token.type]) {
- // Walk any extensions
- marked.defaults.extensions.childTokens[token.type].forEach(function (childTokens) {
- marked.walkTokens(token[childTokens], callback);
- });
- } else if (token.tokens) {
- marked.walkTokens(token.tokens, callback);
- }
- }
- }
- };
- for (var _iterator = _createForOfIteratorHelperLoose(tokens), _step; !(_step = _iterator()).done;) {
- _loop3();
- }
- };
- /**
- * Parse Inline
- * @param {string} src
- */
- marked.parseInline = function (src, opt) {
- // throw error in case of non string input
- if (typeof src === 'undefined' || src === null) {
- throw new Error('marked.parseInline(): input parameter is undefined or null');
- }
- if (typeof src !== 'string') {
- throw new Error('marked.parseInline(): input parameter is of type ' + Object.prototype.toString.call(src) + ', string expected');
- }
- opt = merge({}, marked.defaults, opt || {});
- checkSanitizeDeprecation(opt);
- try {
- var tokens = Lexer.lexInline(src, opt);
- if (opt.walkTokens) {
- marked.walkTokens(tokens, opt.walkTokens);
- }
- return Parser.parseInline(tokens, opt);
- } catch (e) {
- e.message += '\nPlease report this to https://github.com/markedjs/marked.';
- if (opt.silent) {
- return '<p>An error occurred:</p><pre>' + escape(e.message + '', true) + '</pre>';
- }
- throw e;
- }
- };
- /**
- * Expose
- */
- marked.Parser = Parser;
- marked.parser = Parser.parse;
- marked.Renderer = Renderer;
- marked.TextRenderer = TextRenderer;
- marked.Lexer = Lexer;
- marked.lexer = Lexer.lex;
- marked.Tokenizer = Tokenizer;
- marked.Slugger = Slugger;
- marked.parse = marked;
- var options = marked.options;
- var setOptions = marked.setOptions;
- var use = marked.use;
- var walkTokens = marked.walkTokens;
- var parseInline = marked.parseInline;
- var parse = marked;
- var parser = Parser.parse;
- var lexer = Lexer.lex;
- exports.Lexer = Lexer;
- exports.Parser = Parser;
- exports.Renderer = Renderer;
- exports.Slugger = Slugger;
- exports.TextRenderer = TextRenderer;
- exports.Tokenizer = Tokenizer;
- exports.getDefaults = getDefaults;
- exports.lexer = lexer;
- exports.marked = marked;
- exports.options = options;
- exports.parse = parse;
- exports.parseInline = parseInline;
- exports.parser = parser;
- exports.setOptions = setOptions;
- exports.use = use;
- exports.walkTokens = walkTokens;
- Object.defineProperty(exports, '__esModule', { value: true });
- }));
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/markdown',[
- 'jquery',
- 'base/js/utils',
- 'base/js/mathjaxutils',
- 'base/js/security',
- 'components/marked/lib/marked',
- 'codemirror/lib/codemirror',
- ], function($, utils, mathjaxutils, security, marked, CodeMirror){
- "use strict";
- marked.setOptions({
- gfm : true,
- tables: true,
- langPrefix: "cm-s-ipython language-",
- highlight: function(code, lang, callback) {
- if (!lang) {
- // no language, no highlight
- if (callback) {
- callback(null, code);
- return;
- } else {
- return code;
- }
- }
- utils.requireCodeMirrorMode(lang, function (spec) {
- var el = document.createElement("div");
- var mode = CodeMirror.getMode({}, spec);
- if (!mode) {
- console.log("No CodeMirror mode: " + lang);
- callback(null, code);
- return;
- }
- try {
- CodeMirror.runMode(code, spec, el);
- callback(null, el.innerHTML);
- } catch (err) {
- console.log("Failed to highlight " + lang + " code", err);
- callback(err, code);
- }
- }, function (err) {
- console.log("No CodeMirror mode: " + lang);
- console.log("Require CodeMirror mode error: " + err);
- callback(null, code);
- });
- }
- });
- var mathjax_init_done = false;
- function ensure_mathjax_init() {
- if(!mathjax_init_done) {
- mathjax_init_done = true;
- mathjaxutils.init();
- }
- }
- function render(markdown, options, callback) {
- /**
- * Find a readme in the current directory. Look for files with
- * a name like 'readme.md' (case insensitive) or similar and
- * mimetype 'text/markdown'.
- *
- * @param markdown: the markdown text to parse
- * @param options
- * Object with parameters:
- * with_math: the markdown can contain mathematics
- * clean_tables: prevent default inline styles for table cells
- * sanitize: remove dangerous html (like <script>)
- * @param callback
- * A function with two arguments (err, html)
- * err: null or the error if there was one
- * html: the rendered html string, or if {sanitize: true} was used
- * a sanitized jQuery object
- */
- options = $.extend({
- // Apply mathjax transformation
- with_math: false,
- // Prevent marked from returning inline styles for table cells
- clean_tables: false,
- // Apply sanitation, this will return a jQuery object.
- sanitize: false,
- }, options);
- var renderer = new marked.Renderer();
- if(options.clean_tables) {
- renderer.tablecell = function (content, flags) {
- var type = flags.header ? 'th' : 'td';
- var style = flags.align == null ? '': ' style="text-align: ' + flags.align + '"';
- var start_tag = '<' + type + style + '>';
- var end_tag = '</' + type + '>\n';
- return start_tag + content + end_tag;
- };
- }
- var text = markdown;
- var math = null;
- if(options.with_math) {
- ensure_mathjax_init();
- var text_and_math = mathjaxutils.remove_math(markdown);
- text = text_and_math[0];
- math = text_and_math[1];
- }
- marked.marked(text, { renderer: renderer }, function (err, html) {
- if(!err) {
- if(options.with_math) {
- html = mathjaxutils.replace_math(html, math);
- }
- if(options.sanitize) {
- html = $(security.sanitize_html_and_parse(html, true));
- }
- }
- callback(err, html);
- });
- }
- return {'render': render};
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/addon/edit/matchbrackets',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- var ie_lt8 = /MSIE \d/.test(navigator.userAgent) &&
- (document.documentMode == null || document.documentMode < 8);
- var Pos = CodeMirror.Pos;
- var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"};
- function bracketRegex(config) {
- return config && config.bracketRegex || /[(){}[\]]/
- }
- function findMatchingBracket(cm, where, config) {
- var line = cm.getLineHandle(where.line), pos = where.ch - 1;
- var afterCursor = config && config.afterCursor
- if (afterCursor == null)
- afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
- var re = bracketRegex(config)
- // A cursor is defined as between two characters, but in in vim command mode
- // (i.e. not insert mode), the cursor is visually represented as a
- // highlighted box on top of the 2nd character. Otherwise, we allow matches
- // from before or after the cursor.
- var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) ||
- re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)];
- if (!match) return null;
- var dir = match.charAt(1) == ">" ? 1 : -1;
- if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
- var style = cm.getTokenTypeAt(Pos(where.line, pos + 1));
- var found = scanForBracket(cm, Pos(where.line, pos + (dir > 0 ? 1 : 0)), dir, style || null, config);
- if (found == null) return null;
- return {from: Pos(where.line, pos), to: found && found.pos,
- match: found && found.ch == match.charAt(0), forward: dir > 0};
- }
- // bracketRegex is used to specify which type of bracket to scan
- // should be a regexp, e.g. /[[\]]/
- //
- // Note: If "where" is on an open bracket, then this bracket is ignored.
- //
- // Returns false when no bracket was found, null when it reached
- // maxScanLines and gave up
- function scanForBracket(cm, where, dir, style, config) {
- var maxScanLen = (config && config.maxScanLineLength) || 10000;
- var maxScanLines = (config && config.maxScanLines) || 1000;
- var stack = [];
- var re = bracketRegex(config)
- var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
- : Math.max(cm.firstLine() - 1, where.line - maxScanLines);
- for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
- var line = cm.getLine(lineNo);
- if (!line) continue;
- var pos = dir > 0 ? 0 : line.length - 1, end = dir > 0 ? line.length : -1;
- if (line.length > maxScanLen) continue;
- if (lineNo == where.line) pos = where.ch - (dir < 0 ? 1 : 0);
- for (; pos != end; pos += dir) {
- var ch = line.charAt(pos);
- if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
- var match = matching[ch];
- if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
- else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
- else stack.pop();
- }
- }
- }
- return lineNo - dir == (dir > 0 ? cm.lastLine() : cm.firstLine()) ? false : null;
- }
- function matchBrackets(cm, autoclear, config) {
- // Disable brace matching in long lines, since it'll cause hugely slow updates
- var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000;
- var marks = [], ranges = cm.listSelections();
- for (var i = 0; i < ranges.length; i++) {
- var match = ranges[i].empty() && findMatchingBracket(cm, ranges[i].head, config);
- if (match && cm.getLine(match.from.line).length <= maxHighlightLen) {
- var style = match.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket";
- marks.push(cm.markText(match.from, Pos(match.from.line, match.from.ch + 1), {className: style}));
- if (match.to && cm.getLine(match.to.line).length <= maxHighlightLen)
- marks.push(cm.markText(match.to, Pos(match.to.line, match.to.ch + 1), {className: style}));
- }
- }
- if (marks.length) {
- // Kludge to work around the IE bug from issue #1193, where text
- // input stops going to the textare whever this fires.
- if (ie_lt8 && cm.state.focused) cm.focus();
- var clear = function() {
- cm.operation(function() {
- for (var i = 0; i < marks.length; i++) marks[i].clear();
- });
- };
- if (autoclear) setTimeout(clear, 800);
- else return clear;
- }
- }
- function doMatchBrackets(cm) {
- cm.operation(function() {
- if (cm.state.matchBrackets.currentlyHighlighted) {
- cm.state.matchBrackets.currentlyHighlighted();
- cm.state.matchBrackets.currentlyHighlighted = null;
- }
- cm.state.matchBrackets.currentlyHighlighted = matchBrackets(cm, false, cm.state.matchBrackets);
- });
- }
- CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) {
- function clear(cm) {
- if (cm.state.matchBrackets && cm.state.matchBrackets.currentlyHighlighted) {
- cm.state.matchBrackets.currentlyHighlighted();
- cm.state.matchBrackets.currentlyHighlighted = null;
- }
- }
- if (old && old != CodeMirror.Init) {
- cm.off("cursorActivity", doMatchBrackets);
- cm.off("focus", doMatchBrackets)
- cm.off("blur", clear)
- clear(cm);
- }
- if (val) {
- cm.state.matchBrackets = typeof val == "object" ? val : {};
- cm.on("cursorActivity", doMatchBrackets);
- cm.on("focus", doMatchBrackets)
- cm.on("blur", clear)
- }
- });
- CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);});
- CodeMirror.defineExtension("findMatchingBracket", function(pos, config, oldConfig){
- // Backwards-compatibility kludge
- if (oldConfig || typeof config == "boolean") {
- if (!oldConfig) {
- config = config ? {strict: true} : null
- } else {
- oldConfig.strict = config
- config = oldConfig
- }
- }
- return findMatchingBracket(this, pos, config)
- });
- CodeMirror.defineExtension("scanForBracket", function(pos, dir, style, config){
- return scanForBracket(this, pos, dir, style, config);
- });
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/addon/edit/closebrackets',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- var defaults = {
- pairs: "()[]{}''\"\"",
- closeBefore: ")]}'\":;>",
- triples: "",
- explode: "[]{}"
- };
- var Pos = CodeMirror.Pos;
- CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) {
- if (old && old != CodeMirror.Init) {
- cm.removeKeyMap(keyMap);
- cm.state.closeBrackets = null;
- }
- if (val) {
- ensureBound(getOption(val, "pairs"))
- cm.state.closeBrackets = val;
- cm.addKeyMap(keyMap);
- }
- });
- function getOption(conf, name) {
- if (name == "pairs" && typeof conf == "string") return conf;
- if (typeof conf == "object" && conf[name] != null) return conf[name];
- return defaults[name];
- }
- var keyMap = {Backspace: handleBackspace, Enter: handleEnter};
- function ensureBound(chars) {
- for (var i = 0; i < chars.length; i++) {
- var ch = chars.charAt(i), key = "'" + ch + "'"
- if (!keyMap[key]) keyMap[key] = handler(ch)
- }
- }
- ensureBound(defaults.pairs + "`")
- function handler(ch) {
- return function(cm) { return handleChar(cm, ch); };
- }
- function getConfig(cm) {
- var deflt = cm.state.closeBrackets;
- if (!deflt || deflt.override) return deflt;
- var mode = cm.getModeAt(cm.getCursor());
- return mode.closeBrackets || deflt;
- }
- function handleBackspace(cm) {
- var conf = getConfig(cm);
- if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
- var pairs = getOption(conf, "pairs");
- var ranges = cm.listSelections();
- for (var i = 0; i < ranges.length; i++) {
- if (!ranges[i].empty()) return CodeMirror.Pass;
- var around = charsAround(cm, ranges[i].head);
- if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass;
- }
- for (var i = ranges.length - 1; i >= 0; i--) {
- var cur = ranges[i].head;
- cm.replaceRange("", Pos(cur.line, cur.ch - 1), Pos(cur.line, cur.ch + 1), "+delete");
- }
- }
- function handleEnter(cm) {
- var conf = getConfig(cm);
- var explode = conf && getOption(conf, "explode");
- if (!explode || cm.getOption("disableInput")) return CodeMirror.Pass;
- var ranges = cm.listSelections();
- for (var i = 0; i < ranges.length; i++) {
- if (!ranges[i].empty()) return CodeMirror.Pass;
- var around = charsAround(cm, ranges[i].head);
- if (!around || explode.indexOf(around) % 2 != 0) return CodeMirror.Pass;
- }
- cm.operation(function() {
- var linesep = cm.lineSeparator() || "\n";
- cm.replaceSelection(linesep + linesep, null);
- cm.execCommand("goCharLeft");
- ranges = cm.listSelections();
- for (var i = 0; i < ranges.length; i++) {
- var line = ranges[i].head.line;
- cm.indentLine(line, null, true);
- cm.indentLine(line + 1, null, true);
- }
- });
- }
- function contractSelection(sel) {
- var inverted = CodeMirror.cmpPos(sel.anchor, sel.head) > 0;
- return {anchor: new Pos(sel.anchor.line, sel.anchor.ch + (inverted ? -1 : 1)),
- head: new Pos(sel.head.line, sel.head.ch + (inverted ? 1 : -1))};
- }
- function handleChar(cm, ch) {
- var conf = getConfig(cm);
- if (!conf || cm.getOption("disableInput")) return CodeMirror.Pass;
- var pairs = getOption(conf, "pairs");
- var pos = pairs.indexOf(ch);
- if (pos == -1) return CodeMirror.Pass;
- var closeBefore = getOption(conf,"closeBefore");
- var triples = getOption(conf, "triples");
- var identical = pairs.charAt(pos + 1) == ch;
- var ranges = cm.listSelections();
- var opening = pos % 2 == 0;
- var type;
- for (var i = 0; i < ranges.length; i++) {
- var range = ranges[i], cur = range.head, curType;
- var next = cm.getRange(cur, Pos(cur.line, cur.ch + 1));
- if (opening && !range.empty()) {
- curType = "surround";
- } else if ((identical || !opening) && next == ch) {
- if (identical && stringStartsAfter(cm, cur))
- curType = "both";
- else if (triples.indexOf(ch) >= 0 && cm.getRange(cur, Pos(cur.line, cur.ch + 3)) == ch + ch + ch)
- curType = "skipThree";
- else
- curType = "skip";
- } else if (identical && cur.ch > 1 && triples.indexOf(ch) >= 0 &&
- cm.getRange(Pos(cur.line, cur.ch - 2), cur) == ch + ch) {
- if (cur.ch > 2 && /\bstring/.test(cm.getTokenTypeAt(Pos(cur.line, cur.ch - 2)))) return CodeMirror.Pass;
- curType = "addFour";
- } else if (identical) {
- var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
- if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
- else return CodeMirror.Pass;
- } else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) {
- curType = "both";
- } else {
- return CodeMirror.Pass;
- }
- if (!type) type = curType;
- else if (type != curType) return CodeMirror.Pass;
- }
- var left = pos % 2 ? pairs.charAt(pos - 1) : ch;
- var right = pos % 2 ? ch : pairs.charAt(pos + 1);
- cm.operation(function() {
- if (type == "skip") {
- cm.execCommand("goCharRight");
- } else if (type == "skipThree") {
- for (var i = 0; i < 3; i++)
- cm.execCommand("goCharRight");
- } else if (type == "surround") {
- var sels = cm.getSelections();
- for (var i = 0; i < sels.length; i++)
- sels[i] = left + sels[i] + right;
- cm.replaceSelections(sels, "around");
- sels = cm.listSelections().slice();
- for (var i = 0; i < sels.length; i++)
- sels[i] = contractSelection(sels[i]);
- cm.setSelections(sels);
- } else if (type == "both") {
- cm.replaceSelection(left + right, null);
- cm.triggerElectric(left + right);
- cm.execCommand("goCharLeft");
- } else if (type == "addFour") {
- cm.replaceSelection(left + left + left + left, "before");
- cm.execCommand("goCharRight");
- }
- });
- }
- function charsAround(cm, pos) {
- var str = cm.getRange(Pos(pos.line, pos.ch - 1),
- Pos(pos.line, pos.ch + 1));
- return str.length == 2 ? str : null;
- }
- function stringStartsAfter(cm, pos) {
- var token = cm.getTokenAt(Pos(pos.line, pos.ch + 1))
- return /\bstring/.test(token.type) && token.start == pos.ch &&
- (pos.ch == 0 || !/\bstring/.test(cm.getTokenTypeAt(pos)))
- }
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/addon/comment/comment',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- var noOptions = {};
- var nonWS = /[^\s\u00a0]/;
- var Pos = CodeMirror.Pos, cmp = CodeMirror.cmpPos;
- function firstNonWS(str) {
- var found = str.search(nonWS);
- return found == -1 ? 0 : found;
- }
- CodeMirror.commands.toggleComment = function(cm) {
- cm.toggleComment();
- };
- CodeMirror.defineExtension("toggleComment", function(options) {
- if (!options) options = noOptions;
- var cm = this;
- var minLine = Infinity, ranges = this.listSelections(), mode = null;
- for (var i = ranges.length - 1; i >= 0; i--) {
- var from = ranges[i].from(), to = ranges[i].to();
- if (from.line >= minLine) continue;
- if (to.line >= minLine) to = Pos(minLine, 0);
- minLine = from.line;
- if (mode == null) {
- if (cm.uncomment(from, to, options)) mode = "un";
- else { cm.lineComment(from, to, options); mode = "line"; }
- } else if (mode == "un") {
- cm.uncomment(from, to, options);
- } else {
- cm.lineComment(from, to, options);
- }
- }
- });
- // Rough heuristic to try and detect lines that are part of multi-line string
- function probablyInsideString(cm, pos, line) {
- return /\bstring\b/.test(cm.getTokenTypeAt(Pos(pos.line, 0))) && !/^[\'\"\`]/.test(line)
- }
- function getMode(cm, pos) {
- var mode = cm.getMode()
- return mode.useInnerComments === false || !mode.innerMode ? mode : cm.getModeAt(pos)
- }
- CodeMirror.defineExtension("lineComment", function(from, to, options) {
- if (!options) options = noOptions;
- var self = this, mode = getMode(self, from);
- var firstLine = self.getLine(from.line);
- if (firstLine == null || probablyInsideString(self, from, firstLine)) return;
- var commentString = options.lineComment || mode.lineComment;
- if (!commentString) {
- if (options.blockCommentStart || mode.blockCommentStart) {
- options.fullLines = true;
- self.blockComment(from, to, options);
- }
- return;
- }
- var end = Math.min(to.ch != 0 || to.line == from.line ? to.line + 1 : to.line, self.lastLine() + 1);
- var pad = options.padding == null ? " " : options.padding;
- var blankLines = options.commentBlankLines || from.line == to.line;
- self.operation(function() {
- if (options.indent) {
- var baseString = null;
- for (var i = from.line; i < end; ++i) {
- var line = self.getLine(i);
- var whitespace = line.slice(0, firstNonWS(line));
- if (baseString == null || baseString.length > whitespace.length) {
- baseString = whitespace;
- }
- }
- for (var i = from.line; i < end; ++i) {
- var line = self.getLine(i), cut = baseString.length;
- if (!blankLines && !nonWS.test(line)) continue;
- if (line.slice(0, cut) != baseString) cut = firstNonWS(line);
- self.replaceRange(baseString + commentString + pad, Pos(i, 0), Pos(i, cut));
- }
- } else {
- for (var i = from.line; i < end; ++i) {
- if (blankLines || nonWS.test(self.getLine(i)))
- self.replaceRange(commentString + pad, Pos(i, 0));
- }
- }
- });
- });
- CodeMirror.defineExtension("blockComment", function(from, to, options) {
- if (!options) options = noOptions;
- var self = this, mode = getMode(self, from);
- var startString = options.blockCommentStart || mode.blockCommentStart;
- var endString = options.blockCommentEnd || mode.blockCommentEnd;
- if (!startString || !endString) {
- if ((options.lineComment || mode.lineComment) && options.fullLines != false)
- self.lineComment(from, to, options);
- return;
- }
- if (/\bcomment\b/.test(self.getTokenTypeAt(Pos(from.line, 0)))) return
- var end = Math.min(to.line, self.lastLine());
- if (end != from.line && to.ch == 0 && nonWS.test(self.getLine(end))) --end;
- var pad = options.padding == null ? " " : options.padding;
- if (from.line > end) return;
- self.operation(function() {
- if (options.fullLines != false) {
- var lastLineHasText = nonWS.test(self.getLine(end));
- self.replaceRange(pad + endString, Pos(end));
- self.replaceRange(startString + pad, Pos(from.line, 0));
- var lead = options.blockCommentLead || mode.blockCommentLead;
- if (lead != null) for (var i = from.line + 1; i <= end; ++i)
- if (i != end || lastLineHasText)
- self.replaceRange(lead + pad, Pos(i, 0));
- } else {
- var atCursor = cmp(self.getCursor("to"), to) == 0, empty = !self.somethingSelected()
- self.replaceRange(endString, to);
- if (atCursor) self.setSelection(empty ? to : self.getCursor("from"), to)
- self.replaceRange(startString, from);
- }
- });
- });
- CodeMirror.defineExtension("uncomment", function(from, to, options) {
- if (!options) options = noOptions;
- var self = this, mode = getMode(self, from);
- var end = Math.min(to.ch != 0 || to.line == from.line ? to.line : to.line - 1, self.lastLine()), start = Math.min(from.line, end);
- // Try finding line comments
- var lineString = options.lineComment || mode.lineComment, lines = [];
- var pad = options.padding == null ? " " : options.padding, didSomething;
- lineComment: {
- if (!lineString) break lineComment;
- for (var i = start; i <= end; ++i) {
- var line = self.getLine(i);
- var found = line.indexOf(lineString);
- if (found > -1 && !/comment/.test(self.getTokenTypeAt(Pos(i, found + 1)))) found = -1;
- if (found == -1 && nonWS.test(line)) break lineComment;
- if (found > -1 && nonWS.test(line.slice(0, found))) break lineComment;
- lines.push(line);
- }
- self.operation(function() {
- for (var i = start; i <= end; ++i) {
- var line = lines[i - start];
- var pos = line.indexOf(lineString), endPos = pos + lineString.length;
- if (pos < 0) continue;
- if (line.slice(endPos, endPos + pad.length) == pad) endPos += pad.length;
- didSomething = true;
- self.replaceRange("", Pos(i, pos), Pos(i, endPos));
- }
- });
- if (didSomething) return true;
- }
- // Try block comments
- var startString = options.blockCommentStart || mode.blockCommentStart;
- var endString = options.blockCommentEnd || mode.blockCommentEnd;
- if (!startString || !endString) return false;
- var lead = options.blockCommentLead || mode.blockCommentLead;
- var startLine = self.getLine(start), open = startLine.indexOf(startString)
- if (open == -1) return false
- var endLine = end == start ? startLine : self.getLine(end)
- var close = endLine.indexOf(endString, end == start ? open + startString.length : 0);
- var insideStart = Pos(start, open + 1), insideEnd = Pos(end, close + 1)
- if (close == -1 ||
- !/comment/.test(self.getTokenTypeAt(insideStart)) ||
- !/comment/.test(self.getTokenTypeAt(insideEnd)) ||
- self.getRange(insideStart, insideEnd, "\n").indexOf(endString) > -1)
- return false;
- // Avoid killing block comments completely outside the selection.
- // Positions of the last startString before the start of the selection, and the first endString after it.
- var lastStart = startLine.lastIndexOf(startString, from.ch);
- var firstEnd = lastStart == -1 ? -1 : startLine.slice(0, from.ch).indexOf(endString, lastStart + startString.length);
- if (lastStart != -1 && firstEnd != -1 && firstEnd + endString.length != from.ch) return false;
- // Positions of the first endString after the end of the selection, and the last startString before it.
- firstEnd = endLine.indexOf(endString, to.ch);
- var almostLastStart = endLine.slice(to.ch).lastIndexOf(startString, firstEnd - to.ch);
- lastStart = (firstEnd == -1 || almostLastStart == -1) ? -1 : to.ch + almostLastStart;
- if (firstEnd != -1 && lastStart != -1 && lastStart != to.ch) return false;
- self.operation(function() {
- self.replaceRange("", Pos(end, close - (pad && endLine.slice(close - pad.length, close) == pad ? pad.length : 0)),
- Pos(end, close + endString.length));
- var openEnd = open + startString.length;
- if (pad && startLine.slice(openEnd, openEnd + pad.length) == pad) openEnd += pad.length;
- self.replaceRange("", Pos(start, open), Pos(start, openEnd));
- if (lead) for (var i = start + 1; i <= end; ++i) {
- var line = self.getLine(i), found = line.indexOf(lead);
- if (found == -1 || nonWS.test(line.slice(0, found))) continue;
- var foundEnd = found + lead.length;
- if (pad && line.slice(foundEnd, foundEnd + pad.length) == pad) foundEnd += pad.length;
- self.replaceRange("", Pos(i, found), Pos(i, foundEnd));
- }
- });
- return true;
- });
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('services/config',[
- 'base/js/utils',
- ],
- function(utils) {
- "use strict";
- var ConfigSection = function(section_name, options) {
- this.section_name = section_name;
- this.nbclassic_path = options.nbclassic_path;
- this.base_url = options.base_url;
- this.data = {};
-
- var that = this;
-
- /* .loaded is a promise, fulfilled the first time the config is loaded
- * from the server. Code can do:
- * conf.loaded.then(function() { ... using conf.data ... });
- */
- this._one_load_finished = false;
- this.loaded = new Promise(function(resolve, reject) {
- that._finish_firstload = resolve;
- });
- };
- ConfigSection.prototype.api_url = function() {
- return utils.url_path_join(this.base_url, 'api/config',
- utils.encode_uri_components(this.section_name));
- };
-
- ConfigSection.prototype._load_done = function() {
- if (!this._one_load_finished) {
- this._one_load_finished = true;
- this._finish_firstload();
- }
- };
-
- ConfigSection.prototype.load = function() {
- var that = this;
- return utils.promising_ajax(this.api_url(), {
- cache: false,
- type: "GET",
- dataType: "json",
- }).then(function(data) {
- that.data = data;
- that._load_done();
- return data;
- });
- };
-
- /**
- * Modify the config values stored. Update the local data immediately,
- * send the change to the server, and use the updated data from the server
- * when the reply comes.
- */
- ConfigSection.prototype.update = function(newdata) {
- $.extend(true, this.data, newdata); // true -> recursive update
-
- var that = this;
- return utils.promising_ajax(this.api_url(), {
- processData: false,
- type : "PATCH",
- data: JSON.stringify(newdata),
- dataType : "json",
- contentType: 'application/json',
- }).then(function(data) {
- that.data = data;
- that._load_done();
- return data;
- });
- };
-
-
- var ConfigWithDefaults = function(section, defaults, classname) {
- this.section = section;
- this.defaults = defaults;
- this.classname = classname;
- };
-
- ConfigWithDefaults.prototype._class_data = function() {
- if (this.classname) {
- return this.section.data[this.classname] || {};
- } else {
- return this.section.data;
- }
- };
-
- /**
- * Wait for config to have loaded, then get a value or the default.
- * Returns a promise.
- */
- ConfigWithDefaults.prototype.get = function(key) {
- var that = this;
- return this.section.loaded.then(function() {
- return that.get_sync(key);
- });
- };
-
- /**
- * Return a config value. If config is not yet loaded, return the default
- * instead of waiting for it to load.
- */
- ConfigWithDefaults.prototype.get_sync = function(key) {
- var data = this._class_data();
- if (key === undefined) {
- // no key specified, return full config data
- return $.extend(true, {}, this.defaults, data);
- }
- var value = data[key];
- if (value !== undefined) {
- if (typeof value == 'object') {
- // merge with defaults if it's an object
- return $.extend(true, {}, this.defaults[key], value);
- } else {
- return value;
- }
- }
- return this.defaults[key];
- };
-
- /**
- * Set a config value. Send the update to the server, and change our
- * local copy of the data immediately.
- * Returns a promise which is fulfilled when the server replies to the
- * change.
- */
- ConfigWithDefaults.prototype.set = function(key, value) {
- var d = {};
- d[key] = value;
- if (this.classname) {
- var d2 = {};
- d2[this.classname] = d;
- return this.section.update(d2);
- } else {
- return this.section.update(d);
- }
- };
-
- return {ConfigSection: ConfigSection,
- ConfigWithDefaults: ConfigWithDefaults,
- };
- });
- // Distributed under the terms of the Modified BSD License.
- /**
- *
- *
- * @module cell
- * @namespace cell
- * @class Cell
- */
- define('notebook/js/cell',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'codemirror/lib/codemirror',
- 'codemirror/addon/edit/matchbrackets',
- 'codemirror/addon/edit/closebrackets',
- 'codemirror/addon/comment/comment',
- 'services/config',
- ], function($, utils, i18n, CodeMirror, cm_match, cm_closeb, cm_comment, configmod) {
- "use strict";
- function is_single_cursor(dict1, dict2) {
- return ((dict1.line == dict2.line) && (dict1.ch == dict2.ch));
- };
-
- var overlayHack = CodeMirror.scrollbarModel.native.prototype.overlayHack;
- CodeMirror.scrollbarModel.native.prototype.overlayHack = function () {
- overlayHack.apply(this, arguments);
- // Reverse `min-height: 18px` scrollbar hack on OS X
- // which causes a dead area, making it impossible to click on the last line
- // when there is horizontal scrolling to do and the "show scrollbar only when scrolling" behavior
- // is enabled.
- // This, in turn, has the undesirable behavior of never showing the horizontal scrollbar,
- // even when it should, which is less problematic, at least.
- if (/Mac/.test(navigator.platform)) {
- this.horiz.style.minHeight = "";
- }
- };
-
- var Cell = function (options) {
- /* Constructor
- *
- * The Base `Cell` class from which to inherit.
- * @constructor
- * @param:
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * config: dictionary
- * keyboard_manager: KeyboardManager instance
- */
- options = options || {};
- this.keyboard_manager = options.keyboard_manager;
- this.events = options.events;
- var config = options.config;
- // superclass default overwrite our default
-
- this.selected = false;
- this.anchor = false;
- this.rendered = false;
- this.mode = 'command';
- // Metadata property
- var that = this;
- this._metadata = {};
- Object.defineProperty(this, 'metadata', {
- get: function() { return that._metadata; },
- set: function(value) {
- that._metadata = value;
- if (that.celltoolbar) {
- that.celltoolbar.rebuild();
- }
- }
- });
- // backward compat.
- Object.defineProperty(this, 'cm_config', {
- get: function() {
- console.warn(i18n.msg._("Warning: accessing Cell.cm_config directly is deprecated."));
- return that._options.cm_config;
- },
- });
- // load this from metadata later ?
- this.user_highlight = 'auto';
- // merge my class-specific config data with general cell-level config
- var class_config_data = {};
- if (this.class_config) {
- class_config_data = this.class_config.get_sync();
- }
- var cell_config = new configmod.ConfigWithDefaults(options.config,
- Cell.options_default, 'Cell');
- var cell_config_data = cell_config.get_sync();
- // this._options is a merge of SomeCell and Cell config data:
- this._options = utils.mergeopt({}, cell_config_data, class_config_data);
- this.placeholder = this._options.placeholder || '';
- this.cell_id = utils.uuid();
- // For JS VM engines optimization, attributes should be all set (even
- // to null) in the constructor, and if possible, if different subclass
- // have new attributes with same name, they should be created in the
- // same order. Easiest is to create and set to null in parent class.
- this.element = null;
- this.cell_type = this.cell_type || null;
- this.code_mirror = null;
- // The nbformat only specifies attachments for textcell, but to avoid
- // data loss when switching between cell types in the UI, all cells
- // have an attachments property here. It is only saved to disk
- // for textcell though (in toJSON)
- this.attachments = {};
- this.create_element();
- if (this.element !== null) {
- this.element.data("cell", this);
- this.bind_events();
- this.init_classes();
- }
- };
- Cell.options_default = {
- cm_config : {
- indentUnit : 4,
- readOnly: false,
- theme: "default",
- extraKeys: {
- "Cmd-Right": "goLineRight",
- "End": "goLineRight",
- "Cmd-Left": "goLineLeft",
- "Tab": "indentMore",
- "Shift-Tab" : "indentLess",
- "Cmd-/" : "toggleComment",
- "Ctrl-/" : "toggleComment",
- }
- }
- };
-
- // FIXME: Workaround CM Bug #332 (Safari segfault on drag)
- // by disabling drag/drop altogether on Safari
- // https://github.com/codemirror/CodeMirror/issues/332
- if (utils.browser[0] == "Safari") {
- Cell.options_default.cm_config.dragDrop = false;
- }
- /**
- * Empty. Subclasses must implement create_element.
- * This should contain all the code to create the DOM element in notebook
- * and will be called by Base Class constructor.
- * @method create_element
- */
- Cell.prototype.create_element = function () {
- };
- Cell.prototype.init_classes = function () {
- /**
- * Call after this.element exists to initialize the css classes
- * related to selected, rendered and mode.
- */
- if (this.selected) {
- this.element.addClass('selected');
- } else {
- this.element.addClass('unselected');
- }
- if (this.rendered) {
- this.element.addClass('rendered');
- } else {
- this.element.addClass('unrendered');
- }
- };
- /**
- * trigger on focus and on click to bubble up to the notebook and
- * potentially extend the selection if shift-click, contract the selection
- * if just codemirror focus (so edit mode).
- * We **might** be able to move that to notebook `handle_edit_mode`.
- */
- Cell.prototype._on_click = function (event) {
- if (!this.selected) {
- this.events.trigger('select.Cell', {'cell':this, 'extendSelection':event.shiftKey});
- } else {
- // I'm already part of the selection; contract selection to just me
- this.events.trigger('select.Cell', {'cell': this});
- }
- };
- /**
- * Subclasses can implement override bind_events.
- * Be careful to call the parent method when overwriting as it fires event.
- * this will be triggered after create_element in constructor.
- * @method bind_events
- */
- Cell.prototype.bind_events = function () {
- var that = this;
- // We trigger events so that Cell doesn't have to depend on Notebook.
- that.element.click(function (event) {
- that._on_click(event);
- });
- if (this.code_mirror) {
- this.code_mirror.on("change", function(cm, change) {
- that.events.trigger("change.Cell", {cell: that, change: change});
- that.events.trigger("set_dirty.Notebook", {value: true});
- });
- }
- if (this.code_mirror) {
- this.code_mirror.on('focus', function(cm, change) {
- if (!that.selected) {
- that.events.trigger('select.Cell', {'cell':that});
- }
- that.events.trigger('edit_mode.Cell', {cell: that});
- });
- }
- if (this.code_mirror) {
- this.code_mirror.on('blur', function(cm, change) {
- that.events.trigger('command_mode.Cell', {cell: that});
- });
- }
- this.element.dblclick(function () {
- if (that.selected === false) {
- this.events.trigger('select.Cell', {'cell':that});
- }
- });
- };
-
- /**
- * This method gets called in CodeMirror's onKeyDown/onKeyPress
- * handlers and is used to provide custom key handling.
- *
- * To have custom handling, subclasses should override this method, but still call it
- * in order to process the Edit mode keyboard shortcuts.
- *
- * @method handle_codemirror_keyevent
- * @param {CodeMirror} editor - The codemirror instance bound to the cell
- * @param {event} event - key press event which either should or should not be handled by CodeMirror
- * @return {Boolean} `true` if CodeMirror should ignore the event, `false` Otherwise
- */
- Cell.prototype.handle_codemirror_keyevent = function (editor, event) {
- var shortcuts = this.keyboard_manager.edit_shortcuts;
- var cur = editor.getCursor();
- if((cur.line !== 0 || cur.ch !==0) && event.keyCode === 38){
- event._ipkmIgnore = true;
- }
- var nLastLine = editor.lastLine();
- if ((event.keyCode === 40) &&
- ((cur.line !== nLastLine) ||
- (cur.ch !== editor.getLineHandle(nLastLine).text.length))
- ) {
- event._ipkmIgnore = true;
- }
- // if this is an edit_shortcuts shortcut, the global keyboard/shortcut
- // manager will handle it
- if (shortcuts.handles(event)) {
- return true;
- }
-
- return false;
- };
- /**
- * Triger typesetting of math by mathjax on current cell element
- * @method typeset
- */
- Cell.prototype.typeset = function () {
- utils.typeset(this.element);
- };
- /**
- * handle cell level logic when a cell is selected
- * @method select
- * @return is the action being taken
- */
- Cell.prototype.select = function (moveanchor) {
- // if anchor is true, set the move the anchor
- moveanchor = (moveanchor === undefined)? true:moveanchor;
- if(moveanchor){
- this.anchor=true;
- }
- if (!this.selected) {
- this.element.addClass('selected');
- this.element.removeClass('unselected');
- this.selected = true;
- // disable 'insert image' menu item (specific cell types will enable
- // it in their override select())
- this.notebook.set_insert_image_enabled(false);
- return true;
- } else {
- return false;
- }
- };
- /**
- * handle cell level logic when the cell is unselected
- * @method unselect
- * @return is the action being taken
- */
- Cell.prototype.unselect = function (moveanchor) {
- // if anchor is true, remove also the anchor
- moveanchor = (moveanchor === undefined)? true:moveanchor;
- if (moveanchor){
- this.anchor = false;
- }
- if (this.selected) {
- this.element.addClass('unselected');
- this.element.removeClass('selected');
- this.selected = false;
- return true;
- } else {
- return false;
- }
- };
-
- /**
- * should be overwritten by subclass
- * @method execute
- */
- Cell.prototype.execute = function () {
- return;
- };
- /**
- * handle cell level logic when a cell is rendered
- * @method render
- * @return is the action being taken
- */
- Cell.prototype.render = function () {
- if (!this.rendered) {
- this.element.addClass('rendered');
- this.element.removeClass('unrendered');
- this.rendered = true;
- return true;
- } else {
- return false;
- }
- };
- /**
- * handle cell level logic when a cell is unrendered
- * @method unrender
- * @return is the action being taken
- */
- Cell.prototype.unrender = function () {
- if (this.rendered) {
- this.element.addClass('unrendered');
- this.element.removeClass('rendered');
- this.rendered = false;
- return true;
- } else {
- return false;
- }
- };
- /**
- * Delegates keyboard shortcut handling to either Jupyter keyboard
- * manager when in command mode, or CodeMirror when in edit mode
- *
- * @method handle_keyevent
- * @param {CodeMirror} editor - The codemirror instance bound to the cell
- * @param {event} - key event to be handled
- * @return {Boolean} `true` if CodeMirror should ignore the event, `false` Otherwise
- */
- Cell.prototype.handle_keyevent = function (editor, event) {
- if (this.mode === 'command') {
- return true;
- } else if (this.mode === 'edit') {
- return this.handle_codemirror_keyevent(editor, event);
- }
- };
- /**
- * @method at_top
- * @return {Boolean}
- */
- Cell.prototype.at_top = function () {
- var cm = this.code_mirror;
- var cursor = cm.getCursor();
- if (cursor.line === 0 && cursor.ch === 0) {
- return true;
- }
- return false;
- };
- /**
- * @method at_bottom
- * @return {Boolean}
- * */
- Cell.prototype.at_bottom = function () {
- var cm = this.code_mirror;
- var cursor = cm.getCursor();
- if (cursor.line === (cm.lineCount()-1) && cursor.ch === cm.getLine(cursor.line).length) {
- return true;
- }
- return false;
- };
- /**
- * enter the command mode for the cell
- * @method command_mode
- * @return is the action being taken
- */
- Cell.prototype.command_mode = function () {
- if (this.mode !== 'command') {
- this.mode = 'command';
- return true;
- } else {
- return false;
- }
- };
- /**
- * enter the edit mode for the cell
- * @method command_mode
- * @return is the action being taken
- */
- Cell.prototype.edit_mode = function () {
- if (this.mode !== 'edit') {
- this.mode = 'edit';
- return true;
- } else {
- return false;
- }
- };
- Cell.prototype.ensure_focused = function() {
- if(this.element !== document.activeElement && !this.code_mirror.hasFocus()){
- this.focus_cell();
- }
- };
-
- /**
- * Focus the cell in the DOM sense
- * @method focus_cell
- */
- Cell.prototype.focus_cell = function () {
- this.element.focus();
- this._on_click({});
- };
- /**
- * Focus the editor area so a user can type
- *
- * NOTE: If codemirror is focused via a mouse click event, you don't want to
- * call this because it will cause a page jump.
- * @method focus_editor
- */
- Cell.prototype.focus_editor = function () {
- this.refresh();
- this.code_mirror.focus();
- };
- /**
- * Refresh codemirror instance
- * @method refresh
- */
- Cell.prototype.refresh = function () {
- if (this.code_mirror) {
- this.code_mirror.refresh();
- }
- };
- /**
- * should be overwritten by subclass
- * @method get_text
- */
- Cell.prototype.get_text = function () {
- };
- /**
- * should be overwritten by subclass
- * @method set_text
- * @param {string} text
- */
- Cell.prototype.set_text = function (text) {
- };
- /**
- * should be overwritten by subclass
- * serialise cell to json.
- * @method toJSON
- **/
- Cell.prototype.toJSON = function () {
- var data = {};
- // deepcopy the metadata so copied cells don't share the same object
- data.metadata = JSON.parse(JSON.stringify(this.metadata));
- if (this.id !== undefined) {
- data.id = this.id;
- }
- if (data.metadata.deletable) {
- delete data.metadata.deletable;
- }
- if (data.metadata.editable) {
- delete data.metadata.editable;
- }
- if (data.metadata.collapsed === false) {
- delete data.metadata.collapsed;
- }
- data.cell_type = this.cell_type;
- return data;
- };
- /**
- * should be overwritten by subclass
- * @method fromJSON
- **/
- Cell.prototype.fromJSON = function (data) {
- if (data.metadata !== undefined) {
- this.metadata = data.metadata;
- }
- if (data.id !== undefined) {
- this.id = data.id;
- }
- };
- /**
- * can the cell be split into two cells (false if not deletable)
- *
- * @method is_splittable
- **/
- Cell.prototype.is_splittable = function () {
- return this.is_deletable();
- };
- /**
- * can the cell be merged with other cells (false if not deletable)
- * @method is_mergeable
- **/
- Cell.prototype.is_mergeable = function () {
- return this.is_deletable();
- };
- /**
- * is the cell edtitable? only false (readonly) if
- * metadata.editable is explicitly false -- everything else
- * counts as true
- *
- * @method is_editable
- **/
- Cell.prototype.is_editable = function () {
- if (this.metadata.editable === false) {
- return false;
- }
- return true;
- };
- /**
- * is the cell deletable? only false (undeletable) if
- * metadata.deletable is explicitly false or if the cell is not
- * editable -- everything else counts as true
- *
- * @method is_deletable
- **/
- Cell.prototype.is_deletable = function () {
- if (this.metadata.deletable === false || !this.is_editable()) {
- return false;
- }
- return true;
- };
- /**
- * @return {String} - the text before the cursor
- * @method get_pre_cursor
- **/
- Cell.prototype.get_pre_cursor = function () {
- var cursor = this.code_mirror.getCursor();
- var text = this.code_mirror.getRange({line:0, ch:0}, cursor);
- text = text.replace(/^\n+/, '').replace(/\n+$/, '');
- return text;
- };
- /**
- * @return {String} - the text after the cursor
- * @method get_post_cursor
- **/
- Cell.prototype.get_post_cursor = function () {
- var cursor = this.code_mirror.getCursor();
- var last_line_num = this.code_mirror.lineCount()-1;
- var last_line_len = this.code_mirror.getLine(last_line_num).length;
- var end = {line:last_line_num, ch:last_line_len};
- var text = this.code_mirror.getRange(cursor, end);
- text = text.replace(/^\n+/, '').replace(/\n+$/, '');
- return text;
- };
- /**
- * @return {Array} - the text between cursors and within selections (multicursor/sorted)
- * @method get_split_text
- **/
- Cell.prototype.get_split_text = function () {
- var start = {line:0, ch:0};
- var last_line_num = this.code_mirror.lineCount()-1;
- var last_line_len = this.code_mirror.getLine(last_line_num).length;
- var end = {line:last_line_num, ch:last_line_len};
- var flag_empty_cell = is_single_cursor(start, end);
- var flag_first_position = false;
- var flag_last_position = false;
- var flag_all_select = false;
- var ranges = this.code_mirror.listSelections();
- var cursors = [start];
- for (var i = 0; i < ranges.length; i++) {
- // append both to handle selections
- // ranges[i].head.sticky is null if ctrl-a select
- if ((ranges[i].head.sticky == 'before') || (ranges[i].head.sticky === null )) {
- cursors.push(ranges[i].anchor);
- cursors.push(ranges[i].head);
- if (is_single_cursor(ranges[i].anchor, start) &&
- is_single_cursor(ranges[i].head, end)) {
- flag_all_select = true;
- }
- } else {
- cursors.push(ranges[i].head);
- cursors.push(ranges[i].anchor);
- if (is_single_cursor(ranges[i].head, start) &&
- is_single_cursor(ranges[i].anchor, end)) {
- flag_all_select = true;
- }
- }
- // single cursor at beginning or end of cell
- if (is_single_cursor(ranges[i].head, ranges[i].anchor)) {
- if (is_single_cursor(ranges[i].head, start)) flag_first_position = true;
- if (is_single_cursor(ranges[i].head, end)) flag_last_position = true;
- }
- }
- cursors.push(end);
- // Cursors is now sorted, but likely has duplicates due to anchor and head being the same for cursors
- var locations = [cursors[0]];
- for (var i = 1; i < cursors.length; i++) {
- var last = locations[locations.length-1];
- var current = cursors[i];
- if ((last.line != current.line) || (last.ch != current.ch)) {
- locations.push(cursors[i]);
- }
- }
- // Split text
- var text_list = [];
- // Split single cursors at first position
- if (flag_empty_cell || flag_first_position) text_list.push('');
- for (var i = 1; i < locations.length; i++) {
- var text = this.code_mirror.getRange(locations[i-1], locations[i]);
- text = text.replace(/^\n+/, '').replace(/\n+$/, ''); // removes newlines at beginning and end
- text_list.push(text);
- }
- // Split single cursors at last position
- if (flag_last_position) text_list.push('');
- // Duplicate cell if full cell is selected
- if ((text_list.length == 1) && flag_all_select && !flag_empty_cell) {
- text_list = text_list.concat(text_list);
- }
- return text_list;
- };
- /**
- * Show/Hide CodeMirror LineNumber
- * @method show_line_numbers
- *
- * @param value {Bool} show (true), or hide (false) the line number in CodeMirror
- **/
- Cell.prototype.show_line_numbers = function (value) {
- this.code_mirror.setOption('lineNumbers', value);
- this.code_mirror.refresh();
- };
- /**
- * Toggle CodeMirror LineNumber
- * @method toggle_line_numbers
- **/
- Cell.prototype.toggle_line_numbers = function () {
- var val = this.code_mirror.getOption('lineNumbers');
- this.show_line_numbers(!val);
- };
- /**
- * Force codemirror highlight mode
- * @method force_highlight
- * @param {object} - CodeMirror mode
- **/
- Cell.prototype.force_highlight = function(mode) {
- this.user_highlight = mode;
- this.auto_highlight();
- };
-
- /**
- * Trigger autodetection of highlight scheme for current cell
- * @method auto_highlight
- */
- Cell.prototype.auto_highlight = function () {
- this._auto_highlight(this.class_config.get_sync('highlight_modes'));
- };
-
- /**
- * Try to autodetect cell highlight mode, or use selected mode
- * @methods _auto_highlight
- * @private
- * @param {String|object|undefined} - CodeMirror mode | 'auto'
- **/
- Cell.prototype._auto_highlight = function (modes) {
- /**
- *Here we handle manually selected modes
- */
- var that = this;
- var mode;
- if( this.user_highlight !== undefined && this.user_highlight != 'auto' )
- {
- mode = this.user_highlight;
- CodeMirror.autoLoadMode(this.code_mirror, mode);
- this.code_mirror.setOption('mode', mode);
- return;
- }
- var current_mode = this.code_mirror.getOption('mode', mode);
- var first_line = this.code_mirror.getLine(0);
- // loop on every pairs
- for(mode in modes) {
- var regs = modes[mode].reg;
- // only one key every time but regexp can't be keys...
- for(var i=0; i<regs.length; i++) {
- // here we handle non magic_modes.
- // TODO :
- // On 3.0 and below, these things were regex.
- // But now should be string for json-able config.
- // We should get rid of assuming they might be already
- // in a later version of Jupyter.
- var re = regs[i];
- if(typeof(re) === 'string'){
- re = new RegExp(re);
- }
- if(first_line.match(re) !== null) {
- if(current_mode == mode){
- return;
- }
- if (mode.search('magic_') !== 0) {
- utils.requireCodeMirrorMode(mode, function (spec) {
- that.code_mirror.setOption('mode', spec);
- });
- return;
- }
- var magic_mode = mode;
- mode = magic_mode.substr(6);
- if(current_mode == magic_mode){
- return;
- }
- utils.requireCodeMirrorMode(mode, function (spec) {
- // Add an overlay mode to recognize the first line as "magic" instead
- // of the mode used for the rest of the cell.
- CodeMirror.defineMode(magic_mode, function(config) {
- var magicOverlay = {
- startState: function() {
- return {firstMatched : false, inMagicLine: false};
- },
- token: function(stream, state) {
- if(!state.firstMatched) {
- state.firstMatched = true;
- if (stream.match("%%", false)) {
- state.inMagicLine = true;
- }
- }
- if (state.inMagicLine) {
- stream.eat(function any(ch) { return true; });
- if (stream.eol()) {
- state.inMagicLine = false;
- }
- return "magic";
- }
- stream.skipToEnd();
- return null;
- }
- };
- return CodeMirror.overlayMode(CodeMirror.getMode(config, spec), magicOverlay);
- });
- that.code_mirror.setOption('mode', magic_mode);
- });
- return;
- }
- }
- }
- // fallback on default
- var default_mode;
- try {
- default_mode = this._options.cm_config.mode;
- } catch(e) {
- default_mode = 'text/plain';
- }
- if( current_mode === default_mode){
- return;
- }
- this.code_mirror.setOption('mode', default_mode);
- };
- var UnrecognizedCell = function (options) {
- /** Constructor for unrecognized cells */
- Cell.apply(this, arguments);
- this.cell_type = 'unrecognized';
- this.celltoolbar = null;
- this.data = {};
-
- Object.seal(this);
- };
- UnrecognizedCell.prototype = Object.create(Cell.prototype);
-
-
- // cannot merge or split unrecognized cells
- UnrecognizedCell.prototype.is_mergeable = function () {
- return false;
- };
-
- UnrecognizedCell.prototype.is_splittable = function () {
- return false;
- };
-
- UnrecognizedCell.prototype.toJSON = function () {
- /**
- * deepcopy the metadata so copied cells don't share the same object
- */
- return JSON.parse(JSON.stringify(this.data));
- };
- UnrecognizedCell.prototype.fromJSON = function (data) {
- this.data = data;
- if (data.metadata !== undefined) {
- this.metadata = data.metadata;
- } else {
- data.metadata = this.metadata;
- }
- this.element.find('.inner_cell').find("a").text(i18n.msg.sprintf(i18n.msg._("Unrecognized cell type: %s"), data.cell_type));
- };
-
- UnrecognizedCell.prototype.create_element = function () {
- Cell.prototype.create_element.apply(this, arguments);
- var cell = this.element = $("<div>").addClass('cell unrecognized_cell');
- cell.attr('tabindex','2');
- var prompt = $('<div/>').addClass('prompt input_prompt');
- cell.append(prompt);
- var inner_cell = $('<div/>').addClass('inner_cell');
- inner_cell.append(
- $("<a>")
- .attr("href", "#")
- .text(i18n.msg._("Unrecognized cell type"))
- );
- cell.append(inner_cell);
- this.element = cell;
- };
- UnrecognizedCell.prototype.bind_events = function () {
- Cell.prototype.bind_events.apply(this, arguments);
- var cell = this;
-
- this.element.find('.inner_cell').find("a").click(function () {
- cell.events.trigger('unrecognized_cell.Cell', {cell: cell});
- });
- };
- return {
- Cell: Cell,
- UnrecognizedCell: UnrecognizedCell
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // Give us an object to bind all events to. This object should be created
- // before all other objects so it exists when others register event handlers.
- // To register an event handler:
- //
- // requirejs(['base/js/events'], function (events) {
- // events.on("event.Namespace", function () { do_stuff(); });
- // });
- define('base/js/events',['jquery', 'base/js/namespace'], function($, Jupyter) {
- "use strict";
-
- // Events singleton
- if (!window._Events) {
- window._Events = function () {};
- window._events = new window._Events();
- }
-
- // Backwards compatibility.
- Jupyter.Events = window._Events;
- Jupyter.events = window._events;
-
- var events = $([window._events]);
- // catch and log errors in triggered events
- events._original_trigger = events.trigger;
- events.trigger = function (name, data) {
- try {
- this._original_trigger.apply(this, arguments);
- } catch (e) {
- console.error("Exception in event handler for " + name, e, arguments);
- }
- }
- return events;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/celltoolbar',[
- 'jquery',
- 'base/js/namespace',
- 'base/js/events',
- 'base/js/i18n'
- ], function($, IPython, events, i18n) {
- "use strict";
- var CellToolbar = function (options) {
- /**
- * Constructor
- *
- * Parameters:
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * cell: Cell instance
- * notebook: Notebook instance
- *
- * TODO: This leaks, when cell are deleted
- * There is still a reference to each celltoolbars.
- */
- CellToolbar._instances.push(this);
- this.notebook = options.notebook;
- this.cell = options.cell;
- this.create_element();
- this.rebuild();
- return this;
- };
- CellToolbar.prototype.create_element = function () {
- this.inner_element = $('<div/>').addClass('celltoolbar');
- this.element = $('<div/>').addClass('ctb_hideshow')
- .append(this.inner_element);
- };
- // The default css style for the outer celltoolbar div
- // (ctb_hideshow) is display: none.
- // To show the cell toolbar, *both* of the following conditions must be met:
- // - A parent container has class `ctb_global_show`
- // - The celltoolbar has the class `ctb_show`
- // This allows global show/hide, as well as per-cell show/hide.
- CellToolbar.global_hide = function () {
- $('body').removeClass('ctb_global_show');
- };
- CellToolbar.global_show = function () {
- $('body').addClass('ctb_global_show');
- };
- CellToolbar.prototype.hide = function () {
- this.element.removeClass('ctb_show');
- };
- CellToolbar.prototype.show = function () {
- this.element.addClass('ctb_show');
- };
- /**
- * Class variable that should contain a dict of all available callback
- * we need to think of wether or not we allow nested namespace
- * @property _callback_dict
- * @private
- * @static
- * @type Dict
- */
- CellToolbar._callback_dict = {};
- /**
- * Class variable that should contain the reverse order list of the button
- * to add to the toolbar of each cell
- * @property _ui_controls_list
- * @private
- * @static
- * @type List
- */
- CellToolbar._ui_controls_list = [];
- /**
- * Class variable that should contain the CellToolbar instances for each
- * cell of the notebook
- *
- * @private
- * @property _instances
- * @static
- * @type List
- */
- CellToolbar._instances = [];
- /**
- * keep a list of all the available presets for the toolbar
- * @private
- * @property _presets
- * @static
- * @type Dict
- */
- CellToolbar._presets = {};
- // this is by design not a prototype.
- /**
- * Register a callback to create an UI element in a cell toolbar.
- * @method register_callback
- * @param name {String} name to use to refer to the callback. It is advised to use a prefix with the name
- * for easier sorting and avoid collision
- * @param callback {function(div, cell)} callback that will be called to generate the ui element
- * @param [cell_types] {List_of_String|undefined} optional list of cell types. If present the UI element
- * will be added only to cells of types in the list.
- *
- *
- * The callback will receive the following element :
- *
- * * a div in which to add element.
- * * the cell it is responsible from
- *
- * @example
- *
- * Example that create callback for a button that toggle between `true` and `false` label,
- * with the metadata under the key 'foo' to reflect the status of the button.
- *
- * // first param reference to a DOM div
- * // second param reference to the cell.
- * var toggle = function(div, cell) {
- * var button_container = $(div)
- *
- * // let's create a button that show the current value of the metadata
- * var button = $('<div/>').button({label:String(cell.metadata.foo)});
- *
- * // On click, change the metadata value and update the button label
- * button.click(function(){
- * var v = cell.metadata.foo;
- * cell.metadata.foo = !v;
- * button.button("option", "label", String(!v));
- * })
- *
- * // add the button to the DOM div.
- * button_container.append(button);
- * }
- *
- * // now we register the callback under the name `foo` to give the
- * // user the ability to use it later
- * CellToolbar.register_callback('foo', toggle);
- */
- CellToolbar.register_callback = function(name, callback, cell_types) {
- // Overwrite if it already exists.
- CellToolbar._callback_dict[name] = cell_types ? {callback: callback, cell_types: cell_types} : callback;
- };
- /**
- * Register a preset of UI element in a cell toolbar.
- * Not supported Yet.
- * @method register_preset
- * @param name {String} name to use to refer to the preset. It is advised to use a prefix with the name
- * for easier sorting and avoid collision
- * @param preset_list {List_of_String} reverse order of the button in the toolbar. Each String of the list
- * should correspond to a name of a registered callback.
- *
- * @private
- * @example
- *
- * CellToolbar.register_callback('foo.c1', function(div, cell){...});
- * CellToolbar.register_callback('foo.c2', function(div, cell){...});
- * CellToolbar.register_callback('foo.c3', function(div, cell){...});
- * CellToolbar.register_callback('foo.c4', function(div, cell){...});
- * CellToolbar.register_callback('foo.c5', function(div, cell){...});
- *
- * CellToolbar.register_preset('foo.foo_preset1', ['foo.c1', 'foo.c2', 'foo.c5'])
- * CellToolbar.register_preset('foo.foo_preset2', ['foo.c4', 'foo.c5'])
- */
- CellToolbar.register_preset = function(name, preset_list, notebook) {
- CellToolbar._presets[name] = preset_list;
- events.trigger('preset_added.CellToolbar', {name: name});
- // When "register_callback" is called by a custom extension, it may be executed after notebook is loaded.
- // In that case, activate the preset if needed.
- if (notebook && notebook.metadata && notebook.metadata.celltoolbar === name){
- CellToolbar.activate_preset(name);
- }
- };
- /**
- * unregister the selected preset,
- *
- * return true if preset successfully unregistered
- * false otherwise
- *
- **/
- CellToolbar.unregister_preset = function(name){
- if(CellToolbar._presets[name]){
- delete CellToolbar._presets[name];
- events.trigger('unregistered_preset.CellToolbar', {name: name});
- return true
- }
- return false
- }
- /**
- * List the names of the presets that are currently registered.
- *
- * @method list_presets
- * @static
- */
- CellToolbar.list_presets = function() {
- var keys = [];
- for (var k in CellToolbar._presets) {
- keys.push(k);
- }
- return keys;
- };
- /**
- * Activate an UI preset from `register_preset`
- *
- * This does not update the selection UI.
- *
- * @method activate_preset
- * @param preset_name {String} string corresponding to the preset name
- *
- * @static
- * @private
- * @example
- *
- * CellToolbar.activate_preset('foo.foo_preset1');
- */
- CellToolbar.activate_preset = function(preset_name){
- var preset = CellToolbar._presets[preset_name];
- if(preset !== undefined){
- CellToolbar._ui_controls_list = preset;
- CellToolbar.rebuild_all();
- }
- events.trigger('preset_activated.CellToolbar', {name: preset_name});
- };
- /**
- * This should be called on the class and not on a instance as it will trigger
- * rebuild of all the instances.
- * @method rebuild_all
- * @static
- *
- */
- CellToolbar.rebuild_all = function(){
- for(var i=0; i < CellToolbar._instances.length; i++){
- CellToolbar._instances[i].rebuild();
- }
- };
- /**
- * Rebuild all the button on the toolbar to update its state.
- * @method rebuild
- */
- CellToolbar.prototype.rebuild = function(){
- /**
- * strip everything from the div
- * which is probably inner_element
- * or this.element.
- */
- this.inner_element.empty();
- this.ui_controls_list = [];
- var callbacks = CellToolbar._callback_dict;
- var preset = CellToolbar._ui_controls_list;
- // Yes we iterate on the class variable, not the instance one.
- for (var i=0; i < preset.length; i++) {
- var key = preset[i];
- var callback = callbacks[key];
- if (!callback) continue;
- if (typeof callback === 'object') {
- if (callback.cell_types.indexOf(this.cell.cell_type) === -1) continue;
- callback = callback.callback;
- }
-
- var local_div = $('<div/>').addClass('button_container');
- try {
- callback(local_div, this.cell, this);
- this.ui_controls_list.push(key);
- } catch (e) {
- console.log(i18n.msg.sprintf(i18n.msg._("Error in cell toolbar callback %s"), key), e);
- continue;
- }
- // only append if callback succeeded.
- this.inner_element.append(local_div);
- }
- // If there are no controls or the cell is a rendered TextCell hide the toolbar.
- if (!this.ui_controls_list.length) {
- this.hide();
- } else {
- this.show();
- }
- };
- CellToolbar.utils = {};
- /**
- * A utility function to generate bindings between a checkbox and cell/metadata
- * @method utils.checkbox_ui_generator
- * @static
- *
- * @param name {string} Label in front of the checkbox
- * @param setter {function( cell, newValue )}
- * A setter method to set the newValue
- * @param getter {function( cell )}
- * A getter methods which return the current value.
- *
- * @return callback {function( div, cell )} Callback to be passed to `register_callback`
- *
- * @example
- *
- * An exmple that bind the subkey `slideshow.isSectionStart` to a checkbox with a `New Slide` label
- *
- * var newSlide = CellToolbar.utils.checkbox_ui_generator('New Slide',
- * // setter
- * function(cell, value){
- * // we check that the slideshow namespace exist and create it if needed
- * if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
- * // set the value
- * cell.metadata.slideshow.isSectionStart = value
- * },
- * // getter
- * function(cell){ var ns = cell.metadata.slideshow;
- * // if the slideshow namespace does not exist return `undefined`
- * // (will be interpreted as `false` by checkbox) otherwise
- * // return the value
- * return (ns == undefined)? undefined: ns.isSectionStart
- * }
- * );
- *
- * CellToolbar.register_callback('newSlide', newSlide);
- *
- */
- CellToolbar.utils.checkbox_ui_generator = function(name, setter, getter){
- return function(div, cell, celltoolbar) {
- var button_container = $(div);
- var chkb = $('<input/>').attr('type', 'checkbox');
- var lbl = $('<label/>').append($('<span/>').text(name));
- chkb.attr("checked", getter(cell));
- chkb.click(function(){
- var v = getter(cell);
- setter(cell, !v);
- chkb.attr("checked", !v);
- });
- button_container.append($('<span/>').append(lbl).append(chkb));
- };
- };
- /**
- * A utility function to generate bindings between a input field and cell/metadata
- * @method utils.input_ui_generator
- * @static
- *
- * @param name {string} Label in front of the input field
- * @param setter {function( cell, newValue )}
- * A setter method to set the newValue
- * @param getter {function( cell )}
- * A getter methods which return the current value.
- *
- * @return callback {function( div, cell )} Callback to be passed to `register_callback`
- *
- */
- CellToolbar.utils.input_ui_generator = function(name, setter, getter){
- return function(div, cell, celltoolbar) {
- var button_container = $(div);
- var text = $('<input/>').attr('type', 'text');
- var lbl = $('<label/>').append($('<span/>').text(name));
- text.attr("value", getter(cell));
- text.keyup(function(){
- setter(cell, text.val());
- });
- button_container.append($('<span/>').append(lbl).append(text));
- IPython.keyboard_manager.register_events(text);
- };
- };
- /**
- * A utility function to generate bindings between a dropdown list cell
- * @method utils.select_ui_generator
- * @static
- *
- * @param list_list {list_of_sublist} List of sublist of metadata value and name in the dropdown list.
- * sublist should contain 2 element each, first a string that would be displayed in the dropdown list,
- * and second the corresponding value to be passed to setter/return by getter. the corresponding value
- * should not be "undefined" or behavior can be unexpected.
- * @param setter {function( cell, newValue )}
- * A setter method to set the newValue
- * @param getter {function( cell )}
- * A getter methods which return the current value of the metadata.
- * @param [label=""] {String} optional label for the dropdown menu
- *
- * @return callback {function( div, cell )} Callback to be passed to `register_callback`
- *
- * @example
- *
- * var select_type = CellToolbar.utils.select_ui_generator([
- * ["<None>" , "None" ],
- * ["Header Slide" , "header_slide" ],
- * ["Slide" , "slide" ],
- * ["Fragment" , "fragment" ],
- * ["Skip" , "skip" ],
- * ],
- * // setter
- * function(cell, value){
- * // we check that the slideshow namespace exist and create it if needed
- * if (cell.metadata.slideshow == undefined){cell.metadata.slideshow = {}}
- * // set the value
- * cell.metadata.slideshow.slide_type = value
- * },
- * // getter
- * function(cell){ var ns = cell.metadata.slideshow;
- * // if the slideshow namespace does not exist return `undefined`
- * // (will be interpreted as `false` by checkbox) otherwise
- * // return the value
- * return (ns == undefined)? undefined: ns.slide_type
- * }
- * CellToolbar.register_callback('slideshow.select', select_type);
- *
- */
- CellToolbar.utils.select_ui_generator = function(list_list, setter, getter, label) {
- label = label || "";
- return function(div, cell, celltoolbar) {
- var button_container = $(div);
- var lbl = $("<label/>").append($('<span/>').text(label));
- var select = $('<select/>');
- if(!cell.is_editable()){
- select.attr("disabled","disabled")
- }
- for(var i=0; i < list_list.length; i++){
- var opt = $('<option/>')
- .attr('value', list_list[i][1])
- .text(list_list[i][0]);
- select.append(opt);
- }
- select.val(getter(cell));
- select.change(function(){
- setter(cell, select.val());
- });
- button_container.append($('<span/>').append(lbl).append(select));
- };
- };
- // Backwards compatibility.
- IPython.CellToolbar = CellToolbar;
- return {'CellToolbar': CellToolbar};
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/mode/xml/xml',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- var htmlConfig = {
- autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
- 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
- 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,
- 'track': true, 'wbr': true, 'menuitem': true},
- implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,
- 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,
- 'th': true, 'tr': true},
- contextGrabbers: {
- 'dd': {'dd': true, 'dt': true},
- 'dt': {'dd': true, 'dt': true},
- 'li': {'li': true},
- 'option': {'option': true, 'optgroup': true},
- 'optgroup': {'optgroup': true},
- 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,
- 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,
- 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,
- 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,
- 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},
- 'rp': {'rp': true, 'rt': true},
- 'rt': {'rp': true, 'rt': true},
- 'tbody': {'tbody': true, 'tfoot': true},
- 'td': {'td': true, 'th': true},
- 'tfoot': {'tbody': true},
- 'th': {'td': true, 'th': true},
- 'thead': {'tbody': true, 'tfoot': true},
- 'tr': {'tr': true}
- },
- doNotIndent: {"pre": true},
- allowUnquoted: true,
- allowMissing: true,
- caseFold: true
- }
- var xmlConfig = {
- autoSelfClosers: {},
- implicitlyClosed: {},
- contextGrabbers: {},
- doNotIndent: {},
- allowUnquoted: false,
- allowMissing: false,
- allowMissingTagName: false,
- caseFold: false
- }
- CodeMirror.defineMode("xml", function(editorConf, config_) {
- var indentUnit = editorConf.indentUnit
- var config = {}
- var defaults = config_.htmlMode ? htmlConfig : xmlConfig
- for (var prop in defaults) config[prop] = defaults[prop]
- for (var prop in config_) config[prop] = config_[prop]
- // Return variables for tokenizers
- var type, setStyle;
- function inText(stream, state) {
- function chain(parser) {
- state.tokenize = parser;
- return parser(stream, state);
- }
- var ch = stream.next();
- if (ch == "<") {
- if (stream.eat("!")) {
- if (stream.eat("[")) {
- if (stream.match("CDATA[")) return chain(inBlock("atom", "]]>"));
- else return null;
- } else if (stream.match("--")) {
- return chain(inBlock("comment", "-->"));
- } else if (stream.match("DOCTYPE", true, true)) {
- stream.eatWhile(/[\w\._\-]/);
- return chain(doctype(1));
- } else {
- return null;
- }
- } else if (stream.eat("?")) {
- stream.eatWhile(/[\w\._\-]/);
- state.tokenize = inBlock("meta", "?>");
- return "meta";
- } else {
- type = stream.eat("/") ? "closeTag" : "openTag";
- state.tokenize = inTag;
- return "tag bracket";
- }
- } else if (ch == "&") {
- var ok;
- if (stream.eat("#")) {
- if (stream.eat("x")) {
- ok = stream.eatWhile(/[a-fA-F\d]/) && stream.eat(";");
- } else {
- ok = stream.eatWhile(/[\d]/) && stream.eat(";");
- }
- } else {
- ok = stream.eatWhile(/[\w\.\-:]/) && stream.eat(";");
- }
- return ok ? "atom" : "error";
- } else {
- stream.eatWhile(/[^&<]/);
- return null;
- }
- }
- inText.isInText = true;
- function inTag(stream, state) {
- var ch = stream.next();
- if (ch == ">" || (ch == "/" && stream.eat(">"))) {
- state.tokenize = inText;
- type = ch == ">" ? "endTag" : "selfcloseTag";
- return "tag bracket";
- } else if (ch == "=") {
- type = "equals";
- return null;
- } else if (ch == "<") {
- state.tokenize = inText;
- state.state = baseState;
- state.tagName = state.tagStart = null;
- var next = state.tokenize(stream, state);
- return next ? next + " tag error" : "tag error";
- } else if (/[\'\"]/.test(ch)) {
- state.tokenize = inAttribute(ch);
- state.stringStartCol = stream.column();
- return state.tokenize(stream, state);
- } else {
- stream.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/);
- return "word";
- }
- }
- function inAttribute(quote) {
- var closure = function(stream, state) {
- while (!stream.eol()) {
- if (stream.next() == quote) {
- state.tokenize = inTag;
- break;
- }
- }
- return "string";
- };
- closure.isInAttribute = true;
- return closure;
- }
- function inBlock(style, terminator) {
- return function(stream, state) {
- while (!stream.eol()) {
- if (stream.match(terminator)) {
- state.tokenize = inText;
- break;
- }
- stream.next();
- }
- return style;
- }
- }
- function doctype(depth) {
- return function(stream, state) {
- var ch;
- while ((ch = stream.next()) != null) {
- if (ch == "<") {
- state.tokenize = doctype(depth + 1);
- return state.tokenize(stream, state);
- } else if (ch == ">") {
- if (depth == 1) {
- state.tokenize = inText;
- break;
- } else {
- state.tokenize = doctype(depth - 1);
- return state.tokenize(stream, state);
- }
- }
- }
- return "meta";
- };
- }
- function Context(state, tagName, startOfLine) {
- this.prev = state.context;
- this.tagName = tagName;
- this.indent = state.indented;
- this.startOfLine = startOfLine;
- if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))
- this.noIndent = true;
- }
- function popContext(state) {
- if (state.context) state.context = state.context.prev;
- }
- function maybePopContext(state, nextTagName) {
- var parentTagName;
- while (true) {
- if (!state.context) {
- return;
- }
- parentTagName = state.context.tagName;
- if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||
- !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {
- return;
- }
- popContext(state);
- }
- }
- function baseState(type, stream, state) {
- if (type == "openTag") {
- state.tagStart = stream.column();
- return tagNameState;
- } else if (type == "closeTag") {
- return closeTagNameState;
- } else {
- return baseState;
- }
- }
- function tagNameState(type, stream, state) {
- if (type == "word") {
- state.tagName = stream.current();
- setStyle = "tag";
- return attrState;
- } else if (config.allowMissingTagName && type == "endTag") {
- setStyle = "tag bracket";
- return attrState(type, stream, state);
- } else {
- setStyle = "error";
- return tagNameState;
- }
- }
- function closeTagNameState(type, stream, state) {
- if (type == "word") {
- var tagName = stream.current();
- if (state.context && state.context.tagName != tagName &&
- config.implicitlyClosed.hasOwnProperty(state.context.tagName))
- popContext(state);
- if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {
- setStyle = "tag";
- return closeState;
- } else {
- setStyle = "tag error";
- return closeStateErr;
- }
- } else if (config.allowMissingTagName && type == "endTag") {
- setStyle = "tag bracket";
- return closeState(type, stream, state);
- } else {
- setStyle = "error";
- return closeStateErr;
- }
- }
- function closeState(type, _stream, state) {
- if (type != "endTag") {
- setStyle = "error";
- return closeState;
- }
- popContext(state);
- return baseState;
- }
- function closeStateErr(type, stream, state) {
- setStyle = "error";
- return closeState(type, stream, state);
- }
- function attrState(type, _stream, state) {
- if (type == "word") {
- setStyle = "attribute";
- return attrEqState;
- } else if (type == "endTag" || type == "selfcloseTag") {
- var tagName = state.tagName, tagStart = state.tagStart;
- state.tagName = state.tagStart = null;
- if (type == "selfcloseTag" ||
- config.autoSelfClosers.hasOwnProperty(tagName)) {
- maybePopContext(state, tagName);
- } else {
- maybePopContext(state, tagName);
- state.context = new Context(state, tagName, tagStart == state.indented);
- }
- return baseState;
- }
- setStyle = "error";
- return attrState;
- }
- function attrEqState(type, stream, state) {
- if (type == "equals") return attrValueState;
- if (!config.allowMissing) setStyle = "error";
- return attrState(type, stream, state);
- }
- function attrValueState(type, stream, state) {
- if (type == "string") return attrContinuedState;
- if (type == "word" && config.allowUnquoted) {setStyle = "string"; return attrState;}
- setStyle = "error";
- return attrState(type, stream, state);
- }
- function attrContinuedState(type, stream, state) {
- if (type == "string") return attrContinuedState;
- return attrState(type, stream, state);
- }
- return {
- startState: function(baseIndent) {
- var state = {tokenize: inText,
- state: baseState,
- indented: baseIndent || 0,
- tagName: null, tagStart: null,
- context: null}
- if (baseIndent != null) state.baseIndent = baseIndent
- return state
- },
- token: function(stream, state) {
- if (!state.tagName && stream.sol())
- state.indented = stream.indentation();
- if (stream.eatSpace()) return null;
- type = null;
- var style = state.tokenize(stream, state);
- if ((style || type) && style != "comment") {
- setStyle = null;
- state.state = state.state(type || style, stream, state);
- if (setStyle)
- style = setStyle == "error" ? style + " error" : setStyle;
- }
- return style;
- },
- indent: function(state, textAfter, fullLine) {
- var context = state.context;
- // Indent multi-line strings (e.g. css).
- if (state.tokenize.isInAttribute) {
- if (state.tagStart == state.indented)
- return state.stringStartCol + 1;
- else
- return state.indented + indentUnit;
- }
- if (context && context.noIndent) return CodeMirror.Pass;
- if (state.tokenize != inTag && state.tokenize != inText)
- return fullLine ? fullLine.match(/^(\s*)/)[0].length : 0;
- // Indent the starts of attribute names.
- if (state.tagName) {
- if (config.multilineTagIndentPastTag !== false)
- return state.tagStart + state.tagName.length + 2;
- else
- return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);
- }
- if (config.alignCDATA && /<!\[CDATA\[/.test(textAfter)) return 0;
- var tagAfter = textAfter && /^<(\/)?([\w_:\.-]*)/.exec(textAfter);
- if (tagAfter && tagAfter[1]) { // Closing tag spotted
- while (context) {
- if (context.tagName == tagAfter[2]) {
- context = context.prev;
- break;
- } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {
- context = context.prev;
- } else {
- break;
- }
- }
- } else if (tagAfter) { // Opening tag spotted
- while (context) {
- var grabbers = config.contextGrabbers[context.tagName];
- if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))
- context = context.prev;
- else
- break;
- }
- }
- while (context && context.prev && !context.startOfLine)
- context = context.prev;
- if (context) return context.indent + indentUnit;
- else return state.baseIndent || 0;
- },
- electricInput: /<\/[\s\w:]+>$/,
- blockCommentStart: "<!--",
- blockCommentEnd: "-->",
- configuration: config.htmlMode ? "html" : "xml",
- helperType: config.htmlMode ? "html" : "xml",
- skipAttribute: function(state) {
- if (state.state == attrValueState)
- state.state = attrState
- },
- xmlCurrentTag: function(state) {
- return state.tagName ? {name: state.tagName, close: state.type == "closeTag"} : null
- },
- xmlCurrentContext: function(state) {
- var context = []
- for (var cx = state.context; cx; cx = cx.prev)
- if (cx.tagName) context.push(cx.tagName)
- return context.reverse()
- }
- };
- });
- CodeMirror.defineMIME("text/xml", "xml");
- CodeMirror.defineMIME("application/xml", "xml");
- if (!CodeMirror.mimeModes.hasOwnProperty("text/html"))
- CodeMirror.defineMIME("text/html", {name: "xml", htmlMode: true});
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"), require("../xml/xml"), require("../meta"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/mode/markdown/markdown',["../../lib/codemirror", "../xml/xml", "../meta"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.defineMode("markdown", function(cmCfg, modeCfg) {
- var htmlMode = CodeMirror.getMode(cmCfg, "text/html");
- var htmlModeMissing = htmlMode.name == "null"
- function getMode(name) {
- if (CodeMirror.findModeByName) {
- var found = CodeMirror.findModeByName(name);
- if (found) name = found.mime || found.mimes[0];
- }
- var mode = CodeMirror.getMode(cmCfg, name);
- return mode.name == "null" ? null : mode;
- }
- // Should characters that affect highlighting be highlighted separate?
- // Does not include characters that will be output (such as `1.` and `-` for lists)
- if (modeCfg.highlightFormatting === undefined)
- modeCfg.highlightFormatting = false;
- // Maximum number of nested blockquotes. Set to 0 for infinite nesting.
- // Excess `>` will emit `error` token.
- if (modeCfg.maxBlockquoteDepth === undefined)
- modeCfg.maxBlockquoteDepth = 0;
- // Turn on task lists? ("- [ ] " and "- [x] ")
- if (modeCfg.taskLists === undefined) modeCfg.taskLists = false;
- // Turn on strikethrough syntax
- if (modeCfg.strikethrough === undefined)
- modeCfg.strikethrough = false;
- if (modeCfg.emoji === undefined)
- modeCfg.emoji = false;
- if (modeCfg.fencedCodeBlockHighlighting === undefined)
- modeCfg.fencedCodeBlockHighlighting = true;
- if (modeCfg.fencedCodeBlockDefaultMode === undefined)
- modeCfg.fencedCodeBlockDefaultMode = 'text/plain';
- if (modeCfg.xml === undefined)
- modeCfg.xml = true;
- // Allow token types to be overridden by user-provided token types.
- if (modeCfg.tokenTypeOverrides === undefined)
- modeCfg.tokenTypeOverrides = {};
- var tokenTypes = {
- header: "header",
- code: "comment",
- quote: "quote",
- list1: "variable-2",
- list2: "variable-3",
- list3: "keyword",
- hr: "hr",
- image: "image",
- imageAltText: "image-alt-text",
- imageMarker: "image-marker",
- formatting: "formatting",
- linkInline: "link",
- linkEmail: "link",
- linkText: "link",
- linkHref: "string",
- em: "em",
- strong: "strong",
- strikethrough: "strikethrough",
- emoji: "builtin"
- };
- for (var tokenType in tokenTypes) {
- if (tokenTypes.hasOwnProperty(tokenType) && modeCfg.tokenTypeOverrides[tokenType]) {
- tokenTypes[tokenType] = modeCfg.tokenTypeOverrides[tokenType];
- }
- }
- var hrRE = /^([*\-_])(?:\s*\1){2,}\s*$/
- , listRE = /^(?:[*\-+]|^[0-9]+([.)]))\s+/
- , taskListRE = /^\[(x| )\](?=\s)/i // Must follow listRE
- , atxHeaderRE = modeCfg.allowAtxHeaderWithoutSpace ? /^(#+)/ : /^(#+)(?: |$)/
- , setextHeaderRE = /^ {0,3}(?:\={1,}|-{2,})\s*$/
- , textRE = /^[^#!\[\]*_\\<>` "'(~:]+/
- , fencedCodeRE = /^(~~~+|```+)[ \t]*([\w\/+#-]*)[^\n`]*$/
- , linkDefRE = /^\s*\[[^\]]+?\]:.*$/ // naive link-definition
- , punctuation = /[!"#$%&'()*+,\-.\/:;<=>?@\[\\\]^_`{|}~\xA1\xA7\xAB\xB6\xB7\xBB\xBF\u037E\u0387\u055A-\u055F\u0589\u058A\u05BE\u05C0\u05C3\u05C6\u05F3\u05F4\u0609\u060A\u060C\u060D\u061B\u061E\u061F\u066A-\u066D\u06D4\u0700-\u070D\u07F7-\u07F9\u0830-\u083E\u085E\u0964\u0965\u0970\u0AF0\u0DF4\u0E4F\u0E5A\u0E5B\u0F04-\u0F12\u0F14\u0F3A-\u0F3D\u0F85\u0FD0-\u0FD4\u0FD9\u0FDA\u104A-\u104F\u10FB\u1360-\u1368\u1400\u166D\u166E\u169B\u169C\u16EB-\u16ED\u1735\u1736\u17D4-\u17D6\u17D8-\u17DA\u1800-\u180A\u1944\u1945\u1A1E\u1A1F\u1AA0-\u1AA6\u1AA8-\u1AAD\u1B5A-\u1B60\u1BFC-\u1BFF\u1C3B-\u1C3F\u1C7E\u1C7F\u1CC0-\u1CC7\u1CD3\u2010-\u2027\u2030-\u2043\u2045-\u2051\u2053-\u205E\u207D\u207E\u208D\u208E\u2308-\u230B\u2329\u232A\u2768-\u2775\u27C5\u27C6\u27E6-\u27EF\u2983-\u2998\u29D8-\u29DB\u29FC\u29FD\u2CF9-\u2CFC\u2CFE\u2CFF\u2D70\u2E00-\u2E2E\u2E30-\u2E42\u3001-\u3003\u3008-\u3011\u3014-\u301F\u3030\u303D\u30A0\u30FB\uA4FE\uA4FF\uA60D-\uA60F\uA673\uA67E\uA6F2-\uA6F7\uA874-\uA877\uA8CE\uA8CF\uA8F8-\uA8FA\uA8FC\uA92E\uA92F\uA95F\uA9C1-\uA9CD\uA9DE\uA9DF\uAA5C-\uAA5F\uAADE\uAADF\uAAF0\uAAF1\uABEB\uFD3E\uFD3F\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE61\uFE63\uFE68\uFE6A\uFE6B\uFF01-\uFF03\uFF05-\uFF0A\uFF0C-\uFF0F\uFF1A\uFF1B\uFF1F\uFF20\uFF3B-\uFF3D\uFF3F\uFF5B\uFF5D\uFF5F-\uFF65]|\uD800[\uDD00-\uDD02\uDF9F\uDFD0]|\uD801\uDD6F|\uD802[\uDC57\uDD1F\uDD3F\uDE50-\uDE58\uDE7F\uDEF0-\uDEF6\uDF39-\uDF3F\uDF99-\uDF9C]|\uD804[\uDC47-\uDC4D\uDCBB\uDCBC\uDCBE-\uDCC1\uDD40-\uDD43\uDD74\uDD75\uDDC5-\uDDC9\uDDCD\uDDDB\uDDDD-\uDDDF\uDE38-\uDE3D\uDEA9]|\uD805[\uDCC6\uDDC1-\uDDD7\uDE41-\uDE43\uDF3C-\uDF3E]|\uD809[\uDC70-\uDC74]|\uD81A[\uDE6E\uDE6F\uDEF5\uDF37-\uDF3B\uDF44]|\uD82F\uDC9F|\uD836[\uDE87-\uDE8B]/
- , expandedTab = " " // CommonMark specifies tab as 4 spaces
- function switchInline(stream, state, f) {
- state.f = state.inline = f;
- return f(stream, state);
- }
- function switchBlock(stream, state, f) {
- state.f = state.block = f;
- return f(stream, state);
- }
- function lineIsEmpty(line) {
- return !line || !/\S/.test(line.string)
- }
- // Blocks
- function blankLine(state) {
- // Reset linkTitle state
- state.linkTitle = false;
- state.linkHref = false;
- state.linkText = false;
- // Reset EM state
- state.em = false;
- // Reset STRONG state
- state.strong = false;
- // Reset strikethrough state
- state.strikethrough = false;
- // Reset state.quote
- state.quote = 0;
- // Reset state.indentedCode
- state.indentedCode = false;
- if (state.f == htmlBlock) {
- var exit = htmlModeMissing
- if (!exit) {
- var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
- exit = inner.mode.name == "xml" && inner.state.tagStart === null &&
- (!inner.state.context && inner.state.tokenize.isInText)
- }
- if (exit) {
- state.f = inlineNormal;
- state.block = blockNormal;
- state.htmlState = null;
- }
- }
- // Reset state.trailingSpace
- state.trailingSpace = 0;
- state.trailingSpaceNewLine = false;
- // Mark this line as blank
- state.prevLine = state.thisLine
- state.thisLine = {stream: null}
- return null;
- }
- function blockNormal(stream, state) {
- var firstTokenOnLine = stream.column() === state.indentation;
- var prevLineLineIsEmpty = lineIsEmpty(state.prevLine.stream);
- var prevLineIsIndentedCode = state.indentedCode;
- var prevLineIsHr = state.prevLine.hr;
- var prevLineIsList = state.list !== false;
- var maxNonCodeIndentation = (state.listStack[state.listStack.length - 1] || 0) + 3;
- state.indentedCode = false;
- var lineIndentation = state.indentation;
- // compute once per line (on first token)
- if (state.indentationDiff === null) {
- state.indentationDiff = state.indentation;
- if (prevLineIsList) {
- state.list = null;
- // While this list item's marker's indentation is less than the deepest
- // list item's content's indentation,pop the deepest list item
- // indentation off the stack, and update block indentation state
- while (lineIndentation < state.listStack[state.listStack.length - 1]) {
- state.listStack.pop();
- if (state.listStack.length) {
- state.indentation = state.listStack[state.listStack.length - 1];
- // less than the first list's indent -> the line is no longer a list
- } else {
- state.list = false;
- }
- }
- if (state.list !== false) {
- state.indentationDiff = lineIndentation - state.listStack[state.listStack.length - 1]
- }
- }
- }
- // not comprehensive (currently only for setext detection purposes)
- var allowsInlineContinuation = (
- !prevLineLineIsEmpty && !prevLineIsHr && !state.prevLine.header &&
- (!prevLineIsList || !prevLineIsIndentedCode) &&
- !state.prevLine.fencedCodeEnd
- );
- var isHr = (state.list === false || prevLineIsHr || prevLineLineIsEmpty) &&
- state.indentation <= maxNonCodeIndentation && stream.match(hrRE);
- var match = null;
- if (state.indentationDiff >= 4 && (prevLineIsIndentedCode || state.prevLine.fencedCodeEnd ||
- state.prevLine.header || prevLineLineIsEmpty)) {
- stream.skipToEnd();
- state.indentedCode = true;
- return tokenTypes.code;
- } else if (stream.eatSpace()) {
- return null;
- } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(atxHeaderRE)) && match[1].length <= 6) {
- state.quote = 0;
- state.header = match[1].length;
- state.thisLine.header = true;
- if (modeCfg.highlightFormatting) state.formatting = "header";
- state.f = state.inline;
- return getType(state);
- } else if (state.indentation <= maxNonCodeIndentation && stream.eat('>')) {
- state.quote = firstTokenOnLine ? 1 : state.quote + 1;
- if (modeCfg.highlightFormatting) state.formatting = "quote";
- stream.eatSpace();
- return getType(state);
- } else if (!isHr && !state.setext && firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(listRE))) {
- var listType = match[1] ? "ol" : "ul";
- state.indentation = lineIndentation + stream.current().length;
- state.list = true;
- state.quote = 0;
- // Add this list item's content's indentation to the stack
- state.listStack.push(state.indentation);
- // Reset inline styles which shouldn't propagate aross list items
- state.em = false;
- state.strong = false;
- state.code = false;
- state.strikethrough = false;
- if (modeCfg.taskLists && stream.match(taskListRE, false)) {
- state.taskList = true;
- }
- state.f = state.inline;
- if (modeCfg.highlightFormatting) state.formatting = ["list", "list-" + listType];
- return getType(state);
- } else if (firstTokenOnLine && state.indentation <= maxNonCodeIndentation && (match = stream.match(fencedCodeRE, true))) {
- state.quote = 0;
- state.fencedEndRE = new RegExp(match[1] + "+ *$");
- // try switching mode
- state.localMode = modeCfg.fencedCodeBlockHighlighting && getMode(match[2] || modeCfg.fencedCodeBlockDefaultMode );
- if (state.localMode) state.localState = CodeMirror.startState(state.localMode);
- state.f = state.block = local;
- if (modeCfg.highlightFormatting) state.formatting = "code-block";
- state.code = -1
- return getType(state);
- // SETEXT has lowest block-scope precedence after HR, so check it after
- // the others (code, blockquote, list...)
- } else if (
- // if setext set, indicates line after ---/===
- state.setext || (
- // line before ---/===
- (!allowsInlineContinuation || !prevLineIsList) && !state.quote && state.list === false &&
- !state.code && !isHr && !linkDefRE.test(stream.string) &&
- (match = stream.lookAhead(1)) && (match = match.match(setextHeaderRE))
- )
- ) {
- if ( !state.setext ) {
- state.header = match[0].charAt(0) == '=' ? 1 : 2;
- state.setext = state.header;
- } else {
- state.header = state.setext;
- // has no effect on type so we can reset it now
- state.setext = 0;
- stream.skipToEnd();
- if (modeCfg.highlightFormatting) state.formatting = "header";
- }
- state.thisLine.header = true;
- state.f = state.inline;
- return getType(state);
- } else if (isHr) {
- stream.skipToEnd();
- state.hr = true;
- state.thisLine.hr = true;
- return tokenTypes.hr;
- } else if (stream.peek() === '[') {
- return switchInline(stream, state, footnoteLink);
- }
- return switchInline(stream, state, state.inline);
- }
- function htmlBlock(stream, state) {
- var style = htmlMode.token(stream, state.htmlState);
- if (!htmlModeMissing) {
- var inner = CodeMirror.innerMode(htmlMode, state.htmlState)
- if ((inner.mode.name == "xml" && inner.state.tagStart === null &&
- (!inner.state.context && inner.state.tokenize.isInText)) ||
- (state.md_inside && stream.current().indexOf(">") > -1)) {
- state.f = inlineNormal;
- state.block = blockNormal;
- state.htmlState = null;
- }
- }
- return style;
- }
- function local(stream, state) {
- var currListInd = state.listStack[state.listStack.length - 1] || 0;
- var hasExitedList = state.indentation < currListInd;
- var maxFencedEndInd = currListInd + 3;
- if (state.fencedEndRE && state.indentation <= maxFencedEndInd && (hasExitedList || stream.match(state.fencedEndRE))) {
- if (modeCfg.highlightFormatting) state.formatting = "code-block";
- var returnType;
- if (!hasExitedList) returnType = getType(state)
- state.localMode = state.localState = null;
- state.block = blockNormal;
- state.f = inlineNormal;
- state.fencedEndRE = null;
- state.code = 0
- state.thisLine.fencedCodeEnd = true;
- if (hasExitedList) return switchBlock(stream, state, state.block);
- return returnType;
- } else if (state.localMode) {
- return state.localMode.token(stream, state.localState);
- } else {
- stream.skipToEnd();
- return tokenTypes.code;
- }
- }
- // Inline
- function getType(state) {
- var styles = [];
- if (state.formatting) {
- styles.push(tokenTypes.formatting);
- if (typeof state.formatting === "string") state.formatting = [state.formatting];
- for (var i = 0; i < state.formatting.length; i++) {
- styles.push(tokenTypes.formatting + "-" + state.formatting[i]);
- if (state.formatting[i] === "header") {
- styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.header);
- }
- // Add `formatting-quote` and `formatting-quote-#` for blockquotes
- // Add `error` instead if the maximum blockquote nesting depth is passed
- if (state.formatting[i] === "quote") {
- if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
- styles.push(tokenTypes.formatting + "-" + state.formatting[i] + "-" + state.quote);
- } else {
- styles.push("error");
- }
- }
- }
- }
- if (state.taskOpen) {
- styles.push("meta");
- return styles.length ? styles.join(' ') : null;
- }
- if (state.taskClosed) {
- styles.push("property");
- return styles.length ? styles.join(' ') : null;
- }
- if (state.linkHref) {
- styles.push(tokenTypes.linkHref, "url");
- } else { // Only apply inline styles to non-url text
- if (state.strong) { styles.push(tokenTypes.strong); }
- if (state.em) { styles.push(tokenTypes.em); }
- if (state.strikethrough) { styles.push(tokenTypes.strikethrough); }
- if (state.emoji) { styles.push(tokenTypes.emoji); }
- if (state.linkText) { styles.push(tokenTypes.linkText); }
- if (state.code) { styles.push(tokenTypes.code); }
- if (state.image) { styles.push(tokenTypes.image); }
- if (state.imageAltText) { styles.push(tokenTypes.imageAltText, "link"); }
- if (state.imageMarker) { styles.push(tokenTypes.imageMarker); }
- }
- if (state.header) { styles.push(tokenTypes.header, tokenTypes.header + "-" + state.header); }
- if (state.quote) {
- styles.push(tokenTypes.quote);
- // Add `quote-#` where the maximum for `#` is modeCfg.maxBlockquoteDepth
- if (!modeCfg.maxBlockquoteDepth || modeCfg.maxBlockquoteDepth >= state.quote) {
- styles.push(tokenTypes.quote + "-" + state.quote);
- } else {
- styles.push(tokenTypes.quote + "-" + modeCfg.maxBlockquoteDepth);
- }
- }
- if (state.list !== false) {
- var listMod = (state.listStack.length - 1) % 3;
- if (!listMod) {
- styles.push(tokenTypes.list1);
- } else if (listMod === 1) {
- styles.push(tokenTypes.list2);
- } else {
- styles.push(tokenTypes.list3);
- }
- }
- if (state.trailingSpaceNewLine) {
- styles.push("trailing-space-new-line");
- } else if (state.trailingSpace) {
- styles.push("trailing-space-" + (state.trailingSpace % 2 ? "a" : "b"));
- }
- return styles.length ? styles.join(' ') : null;
- }
- function handleText(stream, state) {
- if (stream.match(textRE, true)) {
- return getType(state);
- }
- return undefined;
- }
- function inlineNormal(stream, state) {
- var style = state.text(stream, state);
- if (typeof style !== 'undefined')
- return style;
- if (state.list) { // List marker (*, +, -, 1., etc)
- state.list = null;
- return getType(state);
- }
- if (state.taskList) {
- var taskOpen = stream.match(taskListRE, true)[1] === " ";
- if (taskOpen) state.taskOpen = true;
- else state.taskClosed = true;
- if (modeCfg.highlightFormatting) state.formatting = "task";
- state.taskList = false;
- return getType(state);
- }
- state.taskOpen = false;
- state.taskClosed = false;
- if (state.header && stream.match(/^#+$/, true)) {
- if (modeCfg.highlightFormatting) state.formatting = "header";
- return getType(state);
- }
- var ch = stream.next();
- // Matches link titles present on next line
- if (state.linkTitle) {
- state.linkTitle = false;
- var matchCh = ch;
- if (ch === '(') {
- matchCh = ')';
- }
- matchCh = (matchCh+'').replace(/([.?*+^\[\]\\(){}|-])/g, "\\$1");
- var regex = '^\\s*(?:[^' + matchCh + '\\\\]+|\\\\\\\\|\\\\.)' + matchCh;
- if (stream.match(new RegExp(regex), true)) {
- return tokenTypes.linkHref;
- }
- }
- // If this block is changed, it may need to be updated in GFM mode
- if (ch === '`') {
- var previousFormatting = state.formatting;
- if (modeCfg.highlightFormatting) state.formatting = "code";
- stream.eatWhile('`');
- var count = stream.current().length
- if (state.code == 0 && (!state.quote || count == 1)) {
- state.code = count
- return getType(state)
- } else if (count == state.code) { // Must be exact
- var t = getType(state)
- state.code = 0
- return t
- } else {
- state.formatting = previousFormatting
- return getType(state)
- }
- } else if (state.code) {
- return getType(state);
- }
- if (ch === '\\') {
- stream.next();
- if (modeCfg.highlightFormatting) {
- var type = getType(state);
- var formattingEscape = tokenTypes.formatting + "-escape";
- return type ? type + " " + formattingEscape : formattingEscape;
- }
- }
- if (ch === '!' && stream.match(/\[[^\]]*\] ?(?:\(|\[)/, false)) {
- state.imageMarker = true;
- state.image = true;
- if (modeCfg.highlightFormatting) state.formatting = "image";
- return getType(state);
- }
- if (ch === '[' && state.imageMarker && stream.match(/[^\]]*\](\(.*?\)| ?\[.*?\])/, false)) {
- state.imageMarker = false;
- state.imageAltText = true
- if (modeCfg.highlightFormatting) state.formatting = "image";
- return getType(state);
- }
- if (ch === ']' && state.imageAltText) {
- if (modeCfg.highlightFormatting) state.formatting = "image";
- var type = getType(state);
- state.imageAltText = false;
- state.image = false;
- state.inline = state.f = linkHref;
- return type;
- }
- if (ch === '[' && !state.image) {
- if (state.linkText && stream.match(/^.*?\]/)) return getType(state)
- state.linkText = true;
- if (modeCfg.highlightFormatting) state.formatting = "link";
- return getType(state);
- }
- if (ch === ']' && state.linkText) {
- if (modeCfg.highlightFormatting) state.formatting = "link";
- var type = getType(state);
- state.linkText = false;
- state.inline = state.f = stream.match(/\(.*?\)| ?\[.*?\]/, false) ? linkHref : inlineNormal
- return type;
- }
- if (ch === '<' && stream.match(/^(https?|ftps?):\/\/(?:[^\\>]|\\.)+>/, false)) {
- state.f = state.inline = linkInline;
- if (modeCfg.highlightFormatting) state.formatting = "link";
- var type = getType(state);
- if (type){
- type += " ";
- } else {
- type = "";
- }
- return type + tokenTypes.linkInline;
- }
- if (ch === '<' && stream.match(/^[^> \\]+@(?:[^\\>]|\\.)+>/, false)) {
- state.f = state.inline = linkInline;
- if (modeCfg.highlightFormatting) state.formatting = "link";
- var type = getType(state);
- if (type){
- type += " ";
- } else {
- type = "";
- }
- return type + tokenTypes.linkEmail;
- }
- if (modeCfg.xml && ch === '<' && stream.match(/^(!--|\?|!\[CDATA\[|[a-z][a-z0-9-]*(?:\s+[a-z_:.\-]+(?:\s*=\s*[^>]+)?)*\s*(?:>|$))/i, false)) {
- var end = stream.string.indexOf(">", stream.pos);
- if (end != -1) {
- var atts = stream.string.substring(stream.start, end);
- if (/markdown\s*=\s*('|"){0,1}1('|"){0,1}/.test(atts)) state.md_inside = true;
- }
- stream.backUp(1);
- state.htmlState = CodeMirror.startState(htmlMode);
- return switchBlock(stream, state, htmlBlock);
- }
- if (modeCfg.xml && ch === '<' && stream.match(/^\/\w*?>/)) {
- state.md_inside = false;
- return "tag";
- } else if (ch === "*" || ch === "_") {
- var len = 1, before = stream.pos == 1 ? " " : stream.string.charAt(stream.pos - 2)
- while (len < 3 && stream.eat(ch)) len++
- var after = stream.peek() || " "
- // See http://spec.commonmark.org/0.27/#emphasis-and-strong-emphasis
- var leftFlanking = !/\s/.test(after) && (!punctuation.test(after) || /\s/.test(before) || punctuation.test(before))
- var rightFlanking = !/\s/.test(before) && (!punctuation.test(before) || /\s/.test(after) || punctuation.test(after))
- var setEm = null, setStrong = null
- if (len % 2) { // Em
- if (!state.em && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
- setEm = true
- else if (state.em == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
- setEm = false
- }
- if (len > 1) { // Strong
- if (!state.strong && leftFlanking && (ch === "*" || !rightFlanking || punctuation.test(before)))
- setStrong = true
- else if (state.strong == ch && rightFlanking && (ch === "*" || !leftFlanking || punctuation.test(after)))
- setStrong = false
- }
- if (setStrong != null || setEm != null) {
- if (modeCfg.highlightFormatting) state.formatting = setEm == null ? "strong" : setStrong == null ? "em" : "strong em"
- if (setEm === true) state.em = ch
- if (setStrong === true) state.strong = ch
- var t = getType(state)
- if (setEm === false) state.em = false
- if (setStrong === false) state.strong = false
- return t
- }
- } else if (ch === ' ') {
- if (stream.eat('*') || stream.eat('_')) { // Probably surrounded by spaces
- if (stream.peek() === ' ') { // Surrounded by spaces, ignore
- return getType(state);
- } else { // Not surrounded by spaces, back up pointer
- stream.backUp(1);
- }
- }
- }
- if (modeCfg.strikethrough) {
- if (ch === '~' && stream.eatWhile(ch)) {
- if (state.strikethrough) {// Remove strikethrough
- if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
- var t = getType(state);
- state.strikethrough = false;
- return t;
- } else if (stream.match(/^[^\s]/, false)) {// Add strikethrough
- state.strikethrough = true;
- if (modeCfg.highlightFormatting) state.formatting = "strikethrough";
- return getType(state);
- }
- } else if (ch === ' ') {
- if (stream.match(/^~~/, true)) { // Probably surrounded by space
- if (stream.peek() === ' ') { // Surrounded by spaces, ignore
- return getType(state);
- } else { // Not surrounded by spaces, back up pointer
- stream.backUp(2);
- }
- }
- }
- }
- if (modeCfg.emoji && ch === ":" && stream.match(/^(?:[a-z_\d+][a-z_\d+-]*|\-[a-z_\d+][a-z_\d+-]*):/)) {
- state.emoji = true;
- if (modeCfg.highlightFormatting) state.formatting = "emoji";
- var retType = getType(state);
- state.emoji = false;
- return retType;
- }
- if (ch === ' ') {
- if (stream.match(/^ +$/, false)) {
- state.trailingSpace++;
- } else if (state.trailingSpace) {
- state.trailingSpaceNewLine = true;
- }
- }
- return getType(state);
- }
- function linkInline(stream, state) {
- var ch = stream.next();
- if (ch === ">") {
- state.f = state.inline = inlineNormal;
- if (modeCfg.highlightFormatting) state.formatting = "link";
- var type = getType(state);
- if (type){
- type += " ";
- } else {
- type = "";
- }
- return type + tokenTypes.linkInline;
- }
- stream.match(/^[^>]+/, true);
- return tokenTypes.linkInline;
- }
- function linkHref(stream, state) {
- // Check if space, and return NULL if so (to avoid marking the space)
- if(stream.eatSpace()){
- return null;
- }
- var ch = stream.next();
- if (ch === '(' || ch === '[') {
- state.f = state.inline = getLinkHrefInside(ch === "(" ? ")" : "]");
- if (modeCfg.highlightFormatting) state.formatting = "link-string";
- state.linkHref = true;
- return getType(state);
- }
- return 'error';
- }
- var linkRE = {
- ")": /^(?:[^\\\(\)]|\\.|\((?:[^\\\(\)]|\\.)*\))*?(?=\))/,
- "]": /^(?:[^\\\[\]]|\\.|\[(?:[^\\\[\]]|\\.)*\])*?(?=\])/
- }
- function getLinkHrefInside(endChar) {
- return function(stream, state) {
- var ch = stream.next();
- if (ch === endChar) {
- state.f = state.inline = inlineNormal;
- if (modeCfg.highlightFormatting) state.formatting = "link-string";
- var returnState = getType(state);
- state.linkHref = false;
- return returnState;
- }
- stream.match(linkRE[endChar])
- state.linkHref = true;
- return getType(state);
- };
- }
- function footnoteLink(stream, state) {
- if (stream.match(/^([^\]\\]|\\.)*\]:/, false)) {
- state.f = footnoteLinkInside;
- stream.next(); // Consume [
- if (modeCfg.highlightFormatting) state.formatting = "link";
- state.linkText = true;
- return getType(state);
- }
- return switchInline(stream, state, inlineNormal);
- }
- function footnoteLinkInside(stream, state) {
- if (stream.match(/^\]:/, true)) {
- state.f = state.inline = footnoteUrl;
- if (modeCfg.highlightFormatting) state.formatting = "link";
- var returnType = getType(state);
- state.linkText = false;
- return returnType;
- }
- stream.match(/^([^\]\\]|\\.)+/, true);
- return tokenTypes.linkText;
- }
- function footnoteUrl(stream, state) {
- // Check if space, and return NULL if so (to avoid marking the space)
- if(stream.eatSpace()){
- return null;
- }
- // Match URL
- stream.match(/^[^\s]+/, true);
- // Check for link title
- if (stream.peek() === undefined) { // End of line, set flag to check next line
- state.linkTitle = true;
- } else { // More content on line, check if link title
- stream.match(/^(?:\s+(?:"(?:[^"\\]|\\\\|\\.)+"|'(?:[^'\\]|\\\\|\\.)+'|\((?:[^)\\]|\\\\|\\.)+\)))?/, true);
- }
- state.f = state.inline = inlineNormal;
- return tokenTypes.linkHref + " url";
- }
- var mode = {
- startState: function() {
- return {
- f: blockNormal,
- prevLine: {stream: null},
- thisLine: {stream: null},
- block: blockNormal,
- htmlState: null,
- indentation: 0,
- inline: inlineNormal,
- text: handleText,
- formatting: false,
- linkText: false,
- linkHref: false,
- linkTitle: false,
- code: 0,
- em: false,
- strong: false,
- header: 0,
- setext: 0,
- hr: false,
- taskList: false,
- list: false,
- listStack: [],
- quote: 0,
- trailingSpace: 0,
- trailingSpaceNewLine: false,
- strikethrough: false,
- emoji: false,
- fencedEndRE: null
- };
- },
- copyState: function(s) {
- return {
- f: s.f,
- prevLine: s.prevLine,
- thisLine: s.thisLine,
- block: s.block,
- htmlState: s.htmlState && CodeMirror.copyState(htmlMode, s.htmlState),
- indentation: s.indentation,
- localMode: s.localMode,
- localState: s.localMode ? CodeMirror.copyState(s.localMode, s.localState) : null,
- inline: s.inline,
- text: s.text,
- formatting: false,
- linkText: s.linkText,
- linkTitle: s.linkTitle,
- linkHref: s.linkHref,
- code: s.code,
- em: s.em,
- strong: s.strong,
- strikethrough: s.strikethrough,
- emoji: s.emoji,
- header: s.header,
- setext: s.setext,
- hr: s.hr,
- taskList: s.taskList,
- list: s.list,
- listStack: s.listStack.slice(0),
- quote: s.quote,
- indentedCode: s.indentedCode,
- trailingSpace: s.trailingSpace,
- trailingSpaceNewLine: s.trailingSpaceNewLine,
- md_inside: s.md_inside,
- fencedEndRE: s.fencedEndRE
- };
- },
- token: function(stream, state) {
- // Reset state.formatting
- state.formatting = false;
- if (stream != state.thisLine.stream) {
- state.header = 0;
- state.hr = false;
- if (stream.match(/^\s*$/, true)) {
- blankLine(state);
- return null;
- }
- state.prevLine = state.thisLine
- state.thisLine = {stream: stream}
- // Reset state.taskList
- state.taskList = false;
- // Reset state.trailingSpace
- state.trailingSpace = 0;
- state.trailingSpaceNewLine = false;
- if (!state.localState) {
- state.f = state.block;
- if (state.f != htmlBlock) {
- var indentation = stream.match(/^\s*/, true)[0].replace(/\t/g, expandedTab).length;
- state.indentation = indentation;
- state.indentationDiff = null;
- if (indentation > 0) return null;
- }
- }
- }
- return state.f(stream, state);
- },
- innerMode: function(state) {
- if (state.block == htmlBlock) return {state: state.htmlState, mode: htmlMode};
- if (state.localState) return {state: state.localState, mode: state.localMode};
- return {state: state, mode: mode};
- },
- indent: function(state, textAfter, line) {
- if (state.block == htmlBlock && htmlMode.indent) return htmlMode.indent(state.htmlState, textAfter, line)
- if (state.localState && state.localMode.indent) return state.localMode.indent(state.localState, textAfter, line)
- return CodeMirror.Pass
- },
- blankLine: blankLine,
- getType: getType,
- blockCommentStart: "<!--",
- blockCommentEnd: "-->",
- closeBrackets: "()[]{}''\"\"``",
- fold: "markdown"
- };
- return mode;
- }, "xml");
- CodeMirror.defineMIME("text/markdown", "markdown");
- CodeMirror.defineMIME("text/x-markdown", "markdown");
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- // Utility function that allows modes to be combined. The mode given
- // as the base argument takes care of most of the normal mode
- // functionality, but a second (typically simple) mode is used, which
- // can override the style of text. Both modes get to parse all of the
- // text, but when both assign a non-null style to a piece of code, the
- // overlay wins, unless the combine argument was true and not overridden,
- // or state.overlay.combineTokens was true, in which case the styles are
- // combined.
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/addon/mode/overlay',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.overlayMode = function(base, overlay, combine) {
- return {
- startState: function() {
- return {
- base: CodeMirror.startState(base),
- overlay: CodeMirror.startState(overlay),
- basePos: 0, baseCur: null,
- overlayPos: 0, overlayCur: null,
- streamSeen: null
- };
- },
- copyState: function(state) {
- return {
- base: CodeMirror.copyState(base, state.base),
- overlay: CodeMirror.copyState(overlay, state.overlay),
- basePos: state.basePos, baseCur: null,
- overlayPos: state.overlayPos, overlayCur: null
- };
- },
- token: function(stream, state) {
- if (stream != state.streamSeen ||
- Math.min(state.basePos, state.overlayPos) < stream.start) {
- state.streamSeen = stream;
- state.basePos = state.overlayPos = stream.start;
- }
- if (stream.start == state.basePos) {
- state.baseCur = base.token(stream, state.base);
- state.basePos = stream.pos;
- }
- if (stream.start == state.overlayPos) {
- stream.pos = stream.start;
- state.overlayCur = overlay.token(stream, state.overlay);
- state.overlayPos = stream.pos;
- }
- stream.pos = Math.min(state.basePos, state.overlayPos);
- // state.overlay.combineTokens always takes precedence over combine,
- // unless set to null
- if (state.overlayCur == null) return state.baseCur;
- else if (state.baseCur != null &&
- state.overlay.combineTokens ||
- combine && state.overlay.combineTokens == null)
- return state.baseCur + " " + state.overlayCur;
- else return state.overlayCur;
- },
- indent: base.indent && function(state, textAfter, line) {
- return base.indent(state.base, textAfter, line);
- },
- electricChars: base.electricChars,
- innerMode: function(state) { return {state: state.base, mode: base}; },
- blankLine: function(state) {
- var baseToken, overlayToken;
- if (base.blankLine) baseToken = base.blankLine(state.base);
- if (overlay.blankLine) overlayToken = overlay.blankLine(state.overlay);
- return overlayToken == null ?
- baseToken :
- (combine && baseToken != null ? baseToken + " " + overlayToken : overlayToken);
- }
- };
- };
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"), require("../markdown/markdown"), require("../../addon/mode/overlay"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/mode/gfm/gfm',["../../lib/codemirror", "../markdown/markdown", "../../addon/mode/overlay"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- var urlRE = /^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i
- CodeMirror.defineMode("gfm", function(config, modeConfig) {
- var codeDepth = 0;
- function blankLine(state) {
- state.code = false;
- return null;
- }
- var gfmOverlay = {
- startState: function() {
- return {
- code: false,
- codeBlock: false,
- ateSpace: false
- };
- },
- copyState: function(s) {
- return {
- code: s.code,
- codeBlock: s.codeBlock,
- ateSpace: s.ateSpace
- };
- },
- token: function(stream, state) {
- state.combineTokens = null;
- // Hack to prevent formatting override inside code blocks (block and inline)
- if (state.codeBlock) {
- if (stream.match(/^```+/)) {
- state.codeBlock = false;
- return null;
- }
- stream.skipToEnd();
- return null;
- }
- if (stream.sol()) {
- state.code = false;
- }
- if (stream.sol() && stream.match(/^```+/)) {
- stream.skipToEnd();
- state.codeBlock = true;
- return null;
- }
- // If this block is changed, it may need to be updated in Markdown mode
- if (stream.peek() === '`') {
- stream.next();
- var before = stream.pos;
- stream.eatWhile('`');
- var difference = 1 + stream.pos - before;
- if (!state.code) {
- codeDepth = difference;
- state.code = true;
- } else {
- if (difference === codeDepth) { // Must be exact
- state.code = false;
- }
- }
- return null;
- } else if (state.code) {
- stream.next();
- return null;
- }
- // Check if space. If so, links can be formatted later on
- if (stream.eatSpace()) {
- state.ateSpace = true;
- return null;
- }
- if (stream.sol() || state.ateSpace) {
- state.ateSpace = false;
- if (modeConfig.gitHubSpice !== false) {
- if(stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+@)?(?=.{0,6}\d)(?:[a-f0-9]{7,40}\b)/)) {
- // User/Project@SHA
- // User@SHA
- // SHA
- state.combineTokens = true;
- return "link";
- } else if (stream.match(/^(?:[a-zA-Z0-9\-_]+\/)?(?:[a-zA-Z0-9\-_]+)?#[0-9]+\b/)) {
- // User/Project#Num
- // User#Num
- // #Num
- state.combineTokens = true;
- return "link";
- }
- }
- }
- if (stream.match(urlRE) &&
- stream.string.slice(stream.start - 2, stream.start) != "](" &&
- (stream.start == 0 || /\W/.test(stream.string.charAt(stream.start - 1)))) {
- // URLs
- // Taken from http://daringfireball.net/2010/07/improved_regex_for_matching_urls
- // And then (issue #1160) simplified to make it not crash the Chrome Regexp engine
- // And then limited url schemes to the CommonMark list, so foo:bar isn't matched as a URL
- state.combineTokens = true;
- return "link";
- }
- stream.next();
- return null;
- },
- blankLine: blankLine
- };
- var markdownConfig = {
- taskLists: true,
- strikethrough: true,
- emoji: true
- };
- for (var attr in modeConfig) {
- markdownConfig[attr] = modeConfig[attr];
- }
- markdownConfig.name = "markdown";
- return CodeMirror.overlayMode(CodeMirror.getMode(config, markdownConfig), gfmOverlay);
- }, "markdown");
- CodeMirror.defineMIME("text/x-gfm", "gfm");
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/addon/mode/multiplex',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.multiplexingMode = function(outer /*, others */) {
- // Others should be {open, close, mode [, delimStyle] [, innerStyle]} objects
- var others = Array.prototype.slice.call(arguments, 1);
- function indexOf(string, pattern, from, returnEnd) {
- if (typeof pattern == "string") {
- var found = string.indexOf(pattern, from);
- return returnEnd && found > -1 ? found + pattern.length : found;
- }
- var m = pattern.exec(from ? string.slice(from) : string);
- return m ? m.index + from + (returnEnd ? m[0].length : 0) : -1;
- }
- return {
- startState: function() {
- return {
- outer: CodeMirror.startState(outer),
- innerActive: null,
- inner: null
- };
- },
- copyState: function(state) {
- return {
- outer: CodeMirror.copyState(outer, state.outer),
- innerActive: state.innerActive,
- inner: state.innerActive && CodeMirror.copyState(state.innerActive.mode, state.inner)
- };
- },
- token: function(stream, state) {
- if (!state.innerActive) {
- var cutOff = Infinity, oldContent = stream.string;
- for (var i = 0; i < others.length; ++i) {
- var other = others[i];
- var found = indexOf(oldContent, other.open, stream.pos);
- if (found == stream.pos) {
- if (!other.parseDelimiters) stream.match(other.open);
- state.innerActive = other;
- // Get the outer indent, making sure to handle CodeMirror.Pass
- var outerIndent = 0;
- if (outer.indent) {
- var possibleOuterIndent = outer.indent(state.outer, "", "");
- if (possibleOuterIndent !== CodeMirror.Pass) outerIndent = possibleOuterIndent;
- }
- state.inner = CodeMirror.startState(other.mode, outerIndent);
- return other.delimStyle && (other.delimStyle + " " + other.delimStyle + "-open");
- } else if (found != -1 && found < cutOff) {
- cutOff = found;
- }
- }
- if (cutOff != Infinity) stream.string = oldContent.slice(0, cutOff);
- var outerToken = outer.token(stream, state.outer);
- if (cutOff != Infinity) stream.string = oldContent;
- return outerToken;
- } else {
- var curInner = state.innerActive, oldContent = stream.string;
- if (!curInner.close && stream.sol()) {
- state.innerActive = state.inner = null;
- return this.token(stream, state);
- }
- var found = curInner.close ? indexOf(oldContent, curInner.close, stream.pos, curInner.parseDelimiters) : -1;
- if (found == stream.pos && !curInner.parseDelimiters) {
- stream.match(curInner.close);
- state.innerActive = state.inner = null;
- return curInner.delimStyle && (curInner.delimStyle + " " + curInner.delimStyle + "-close");
- }
- if (found > -1) stream.string = oldContent.slice(0, found);
- var innerToken = curInner.mode.token(stream, state.inner);
- if (found > -1) stream.string = oldContent;
- if (found == stream.pos && curInner.parseDelimiters)
- state.innerActive = state.inner = null;
- if (curInner.innerStyle) {
- if (innerToken) innerToken = innerToken + " " + curInner.innerStyle;
- else innerToken = curInner.innerStyle;
- }
- return innerToken;
- }
- },
- indent: function(state, textAfter, line) {
- var mode = state.innerActive ? state.innerActive.mode : outer;
- if (!mode.indent) return CodeMirror.Pass;
- return mode.indent(state.innerActive ? state.inner : state.outer, textAfter, line);
- },
- blankLine: function(state) {
- var mode = state.innerActive ? state.innerActive.mode : outer;
- if (mode.blankLine) {
- mode.blankLine(state.innerActive ? state.inner : state.outer);
- }
- if (!state.innerActive) {
- for (var i = 0; i < others.length; ++i) {
- var other = others[i];
- if (other.open === "\n") {
- state.innerActive = other;
- state.inner = CodeMirror.startState(other.mode, mode.indent ? mode.indent(state.outer, "", "") : 0);
- }
- }
- } else if (state.innerActive.close === "\n") {
- state.innerActive = state.inner = null;
- }
- },
- electricChars: outer.electricChars,
- innerMode: function(state) {
- return state.inner ? {state: state.inner, mode: state.innerActive.mode} : {state: state.outer, mode: outer};
- }
- };
- };
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/mode/python/python',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- function wordRegexp(words) {
- return new RegExp("^((" + words.join(")|(") + "))\\b");
- }
- var wordOperators = wordRegexp(["and", "or", "not", "is"]);
- var commonKeywords = ["as", "assert", "break", "class", "continue",
- "def", "del", "elif", "else", "except", "finally",
- "for", "from", "global", "if", "import",
- "lambda", "pass", "raise", "return",
- "try", "while", "with", "yield", "in"];
- var commonBuiltins = ["abs", "all", "any", "bin", "bool", "bytearray", "callable", "chr",
- "classmethod", "compile", "complex", "delattr", "dict", "dir", "divmod",
- "enumerate", "eval", "filter", "float", "format", "frozenset",
- "getattr", "globals", "hasattr", "hash", "help", "hex", "id",
- "input", "int", "isinstance", "issubclass", "iter", "len",
- "list", "locals", "map", "max", "memoryview", "min", "next",
- "object", "oct", "open", "ord", "pow", "property", "range",
- "repr", "reversed", "round", "set", "setattr", "slice",
- "sorted", "staticmethod", "str", "sum", "super", "tuple",
- "type", "vars", "zip", "__import__", "NotImplemented",
- "Ellipsis", "__debug__"];
- CodeMirror.registerHelper("hintWords", "python", commonKeywords.concat(commonBuiltins));
- function top(state) {
- return state.scopes[state.scopes.length - 1];
- }
- CodeMirror.defineMode("python", function(conf, parserConf) {
- var ERRORCLASS = "error";
- var delimiters = parserConf.delimiters || parserConf.singleDelimiters || /^[\(\)\[\]\{\}@,:`=;\.\\]/;
- // (Backwards-compatibility with old, cumbersome config system)
- var operators = [parserConf.singleOperators, parserConf.doubleOperators, parserConf.doubleDelimiters, parserConf.tripleDelimiters,
- parserConf.operators || /^([-+*/%\/&|^]=?|[<>=]+|\/\/=?|\*\*=?|!=|[~!@]|\.\.\.)/]
- for (var i = 0; i < operators.length; i++) if (!operators[i]) operators.splice(i--, 1)
- var hangingIndent = parserConf.hangingIndent || conf.indentUnit;
- var myKeywords = commonKeywords, myBuiltins = commonBuiltins;
- if (parserConf.extra_keywords != undefined)
- myKeywords = myKeywords.concat(parserConf.extra_keywords);
- if (parserConf.extra_builtins != undefined)
- myBuiltins = myBuiltins.concat(parserConf.extra_builtins);
- var py3 = !(parserConf.version && Number(parserConf.version) < 3)
- if (py3) {
- // since http://legacy.python.org/dev/peps/pep-0465/ @ is also an operator
- var identifiers = parserConf.identifiers|| /^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*/;
- myKeywords = myKeywords.concat(["nonlocal", "False", "True", "None", "async", "await"]);
- myBuiltins = myBuiltins.concat(["ascii", "bytes", "exec", "print"]);
- var stringPrefixes = new RegExp("^(([rbuf]|(br)|(fr))?('{3}|\"{3}|['\"]))", "i");
- } else {
- var identifiers = parserConf.identifiers|| /^[_A-Za-z][_A-Za-z0-9]*/;
- myKeywords = myKeywords.concat(["exec", "print"]);
- myBuiltins = myBuiltins.concat(["apply", "basestring", "buffer", "cmp", "coerce", "execfile",
- "file", "intern", "long", "raw_input", "reduce", "reload",
- "unichr", "unicode", "xrange", "False", "True", "None"]);
- var stringPrefixes = new RegExp("^(([rubf]|(ur)|(br))?('{3}|\"{3}|['\"]))", "i");
- }
- var keywords = wordRegexp(myKeywords);
- var builtins = wordRegexp(myBuiltins);
- // tokenizers
- function tokenBase(stream, state) {
- var sol = stream.sol() && state.lastToken != "\\"
- if (sol) state.indent = stream.indentation()
- // Handle scope changes
- if (sol && top(state).type == "py") {
- var scopeOffset = top(state).offset;
- if (stream.eatSpace()) {
- var lineOffset = stream.indentation();
- if (lineOffset > scopeOffset)
- pushPyScope(state);
- else if (lineOffset < scopeOffset && dedent(stream, state) && stream.peek() != "#")
- state.errorToken = true;
- return null;
- } else {
- var style = tokenBaseInner(stream, state);
- if (scopeOffset > 0 && dedent(stream, state))
- style += " " + ERRORCLASS;
- return style;
- }
- }
- return tokenBaseInner(stream, state);
- }
- function tokenBaseInner(stream, state, inFormat) {
- if (stream.eatSpace()) return null;
- // Handle Comments
- if (!inFormat && stream.match(/^#.*/)) return "comment";
- // Handle Number Literals
- if (stream.match(/^[0-9\.]/, false)) {
- var floatLiteral = false;
- // Floats
- if (stream.match(/^[\d_]*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; }
- if (stream.match(/^[\d_]+\.\d*/)) { floatLiteral = true; }
- if (stream.match(/^\.\d+/)) { floatLiteral = true; }
- if (floatLiteral) {
- // Float literals may be "imaginary"
- stream.eat(/J/i);
- return "number";
- }
- // Integers
- var intLiteral = false;
- // Hex
- if (stream.match(/^0x[0-9a-f_]+/i)) intLiteral = true;
- // Binary
- if (stream.match(/^0b[01_]+/i)) intLiteral = true;
- // Octal
- if (stream.match(/^0o[0-7_]+/i)) intLiteral = true;
- // Decimal
- if (stream.match(/^[1-9][\d_]*(e[\+\-]?[\d_]+)?/)) {
- // Decimal literals may be "imaginary"
- stream.eat(/J/i);
- // TODO - Can you have imaginary longs?
- intLiteral = true;
- }
- // Zero by itself with no other piece of number.
- if (stream.match(/^0(?![\dx])/i)) intLiteral = true;
- if (intLiteral) {
- // Integer literals may be "long"
- stream.eat(/L/i);
- return "number";
- }
- }
- // Handle Strings
- if (stream.match(stringPrefixes)) {
- var isFmtString = stream.current().toLowerCase().indexOf('f') !== -1;
- if (!isFmtString) {
- state.tokenize = tokenStringFactory(stream.current(), state.tokenize);
- return state.tokenize(stream, state);
- } else {
- state.tokenize = formatStringFactory(stream.current(), state.tokenize);
- return state.tokenize(stream, state);
- }
- }
- for (var i = 0; i < operators.length; i++)
- if (stream.match(operators[i])) return "operator"
- if (stream.match(delimiters)) return "punctuation";
- if (state.lastToken == "." && stream.match(identifiers))
- return "property";
- if (stream.match(keywords) || stream.match(wordOperators))
- return "keyword";
- if (stream.match(builtins))
- return "builtin";
- if (stream.match(/^(self|cls)\b/))
- return "variable-2";
- if (stream.match(identifiers)) {
- if (state.lastToken == "def" || state.lastToken == "class")
- return "def";
- return "variable";
- }
- // Handle non-detected items
- stream.next();
- return inFormat ? null :ERRORCLASS;
- }
- function formatStringFactory(delimiter, tokenOuter) {
- while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
- delimiter = delimiter.substr(1);
- var singleline = delimiter.length == 1;
- var OUTCLASS = "string";
- function tokenNestedExpr(depth) {
- return function(stream, state) {
- var inner = tokenBaseInner(stream, state, true)
- if (inner == "punctuation") {
- if (stream.current() == "{") {
- state.tokenize = tokenNestedExpr(depth + 1)
- } else if (stream.current() == "}") {
- if (depth > 1) state.tokenize = tokenNestedExpr(depth - 1)
- else state.tokenize = tokenString
- }
- }
- return inner
- }
- }
- function tokenString(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^'"\{\}\\]/);
- if (stream.eat("\\")) {
- stream.next();
- if (singleline && stream.eol())
- return OUTCLASS;
- } else if (stream.match(delimiter)) {
- state.tokenize = tokenOuter;
- return OUTCLASS;
- } else if (stream.match('{{')) {
- // ignore {{ in f-str
- return OUTCLASS;
- } else if (stream.match('{', false)) {
- // switch to nested mode
- state.tokenize = tokenNestedExpr(0)
- if (stream.current()) return OUTCLASS;
- else return state.tokenize(stream, state)
- } else if (stream.match('}}')) {
- return OUTCLASS;
- } else if (stream.match('}')) {
- // single } in f-string is an error
- return ERRORCLASS;
- } else {
- stream.eat(/['"]/);
- }
- }
- if (singleline) {
- if (parserConf.singleLineStringErrors)
- return ERRORCLASS;
- else
- state.tokenize = tokenOuter;
- }
- return OUTCLASS;
- }
- tokenString.isString = true;
- return tokenString;
- }
- function tokenStringFactory(delimiter, tokenOuter) {
- while ("rubf".indexOf(delimiter.charAt(0).toLowerCase()) >= 0)
- delimiter = delimiter.substr(1);
- var singleline = delimiter.length == 1;
- var OUTCLASS = "string";
- function tokenString(stream, state) {
- while (!stream.eol()) {
- stream.eatWhile(/[^'"\\]/);
- if (stream.eat("\\")) {
- stream.next();
- if (singleline && stream.eol())
- return OUTCLASS;
- } else if (stream.match(delimiter)) {
- state.tokenize = tokenOuter;
- return OUTCLASS;
- } else {
- stream.eat(/['"]/);
- }
- }
- if (singleline) {
- if (parserConf.singleLineStringErrors)
- return ERRORCLASS;
- else
- state.tokenize = tokenOuter;
- }
- return OUTCLASS;
- }
- tokenString.isString = true;
- return tokenString;
- }
- function pushPyScope(state) {
- while (top(state).type != "py") state.scopes.pop()
- state.scopes.push({offset: top(state).offset + conf.indentUnit,
- type: "py",
- align: null})
- }
- function pushBracketScope(stream, state, type) {
- var align = stream.match(/^([\s\[\{\(]|#.*)*$/, false) ? null : stream.column() + 1
- state.scopes.push({offset: state.indent + hangingIndent,
- type: type,
- align: align})
- }
- function dedent(stream, state) {
- var indented = stream.indentation();
- while (state.scopes.length > 1 && top(state).offset > indented) {
- if (top(state).type != "py") return true;
- state.scopes.pop();
- }
- return top(state).offset != indented;
- }
- function tokenLexer(stream, state) {
- if (stream.sol()) state.beginningOfLine = true;
- var style = state.tokenize(stream, state);
- var current = stream.current();
- // Handle decorators
- if (state.beginningOfLine && current == "@")
- return stream.match(identifiers, false) ? "meta" : py3 ? "operator" : ERRORCLASS;
- if (/\S/.test(current)) state.beginningOfLine = false;
- if ((style == "variable" || style == "builtin")
- && state.lastToken == "meta")
- style = "meta";
- // Handle scope changes.
- if (current == "pass" || current == "return")
- state.dedent += 1;
- if (current == "lambda") state.lambda = true;
- if (current == ":" && !state.lambda && top(state).type == "py")
- pushPyScope(state);
- if (current.length == 1 && !/string|comment/.test(style)) {
- var delimiter_index = "[({".indexOf(current);
- if (delimiter_index != -1)
- pushBracketScope(stream, state, "])}".slice(delimiter_index, delimiter_index+1));
- delimiter_index = "])}".indexOf(current);
- if (delimiter_index != -1) {
- if (top(state).type == current) state.indent = state.scopes.pop().offset - hangingIndent
- else return ERRORCLASS;
- }
- }
- if (state.dedent > 0 && stream.eol() && top(state).type == "py") {
- if (state.scopes.length > 1) state.scopes.pop();
- state.dedent -= 1;
- }
- return style;
- }
- var external = {
- startState: function(basecolumn) {
- return {
- tokenize: tokenBase,
- scopes: [{offset: basecolumn || 0, type: "py", align: null}],
- indent: basecolumn || 0,
- lastToken: null,
- lambda: false,
- dedent: 0
- };
- },
- token: function(stream, state) {
- var addErr = state.errorToken;
- if (addErr) state.errorToken = false;
- var style = tokenLexer(stream, state);
- if (style && style != "comment")
- state.lastToken = (style == "keyword" || style == "punctuation") ? stream.current() : style;
- if (style == "punctuation") style = null;
- if (stream.eol() && state.lambda)
- state.lambda = false;
- return addErr ? style + " " + ERRORCLASS : style;
- },
- indent: function(state, textAfter) {
- if (state.tokenize != tokenBase)
- return state.tokenize.isString ? CodeMirror.Pass : 0;
- var scope = top(state), closing = scope.type == textAfter.charAt(0)
- if (scope.align != null)
- return scope.align - (closing ? 1 : 0)
- else
- return scope.offset - (closing ? hangingIndent : 0)
- },
- electricInput: /^\s*[\}\]\)]$/,
- closeBrackets: {triples: "'\""},
- lineComment: "#",
- fold: "indent"
- };
- return external;
- });
- CodeMirror.defineMIME("text/x-python", "python");
- var words = function(str) { return str.split(" "); };
- CodeMirror.defineMIME("text/x-cython", {
- name: "python",
- extra_keywords: words("by cdef cimport cpdef ctypedef enum except "+
- "extern gil include nogil property public "+
- "readonly struct union DEF IF ELIF ELSE")
- });
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- /*
- * Author: Constantin Jucovschi (c.jucovschi@jacobs-university.de)
- * Licence: MIT
- */
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/mode/stex/stex',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.defineMode("stex", function(_config, parserConfig) {
- "use strict";
- function pushCommand(state, command) {
- state.cmdState.push(command);
- }
- function peekCommand(state) {
- if (state.cmdState.length > 0) {
- return state.cmdState[state.cmdState.length - 1];
- } else {
- return null;
- }
- }
- function popCommand(state) {
- var plug = state.cmdState.pop();
- if (plug) {
- plug.closeBracket();
- }
- }
- // returns the non-default plugin closest to the end of the list
- function getMostPowerful(state) {
- var context = state.cmdState;
- for (var i = context.length - 1; i >= 0; i--) {
- var plug = context[i];
- if (plug.name == "DEFAULT") {
- continue;
- }
- return plug;
- }
- return { styleIdentifier: function() { return null; } };
- }
- function addPluginPattern(pluginName, cmdStyle, styles) {
- return function () {
- this.name = pluginName;
- this.bracketNo = 0;
- this.style = cmdStyle;
- this.styles = styles;
- this.argument = null; // \begin and \end have arguments that follow. These are stored in the plugin
- this.styleIdentifier = function() {
- return this.styles[this.bracketNo - 1] || null;
- };
- this.openBracket = function() {
- this.bracketNo++;
- return "bracket";
- };
- this.closeBracket = function() {};
- };
- }
- var plugins = {};
- plugins["importmodule"] = addPluginPattern("importmodule", "tag", ["string", "builtin"]);
- plugins["documentclass"] = addPluginPattern("documentclass", "tag", ["", "atom"]);
- plugins["usepackage"] = addPluginPattern("usepackage", "tag", ["atom"]);
- plugins["begin"] = addPluginPattern("begin", "tag", ["atom"]);
- plugins["end"] = addPluginPattern("end", "tag", ["atom"]);
- plugins["label" ] = addPluginPattern("label" , "tag", ["atom"]);
- plugins["ref" ] = addPluginPattern("ref" , "tag", ["atom"]);
- plugins["eqref" ] = addPluginPattern("eqref" , "tag", ["atom"]);
- plugins["cite" ] = addPluginPattern("cite" , "tag", ["atom"]);
- plugins["bibitem" ] = addPluginPattern("bibitem" , "tag", ["atom"]);
- plugins["Bibitem" ] = addPluginPattern("Bibitem" , "tag", ["atom"]);
- plugins["RBibitem" ] = addPluginPattern("RBibitem" , "tag", ["atom"]);
- plugins["DEFAULT"] = function () {
- this.name = "DEFAULT";
- this.style = "tag";
- this.styleIdentifier = this.openBracket = this.closeBracket = function() {};
- };
- function setState(state, f) {
- state.f = f;
- }
- // called when in a normal (no environment) context
- function normal(source, state) {
- var plug;
- // Do we look like '\command' ? If so, attempt to apply the plugin 'command'
- if (source.match(/^\\[a-zA-Z@]+/)) {
- var cmdName = source.current().slice(1);
- plug = plugins.hasOwnProperty(cmdName) ? plugins[cmdName] : plugins["DEFAULT"];
- plug = new plug();
- pushCommand(state, plug);
- setState(state, beginParams);
- return plug.style;
- }
- // escape characters
- if (source.match(/^\\[$&%#{}_]/)) {
- return "tag";
- }
- // white space control characters
- if (source.match(/^\\[,;!\/\\]/)) {
- return "tag";
- }
- // find if we're starting various math modes
- if (source.match("\\[")) {
- setState(state, function(source, state){ return inMathMode(source, state, "\\]"); });
- return "keyword";
- }
- if (source.match("\\(")) {
- setState(state, function(source, state){ return inMathMode(source, state, "\\)"); });
- return "keyword";
- }
- if (source.match("$$")) {
- setState(state, function(source, state){ return inMathMode(source, state, "$$"); });
- return "keyword";
- }
- if (source.match("$")) {
- setState(state, function(source, state){ return inMathMode(source, state, "$"); });
- return "keyword";
- }
- var ch = source.next();
- if (ch == "%") {
- source.skipToEnd();
- return "comment";
- } else if (ch == '}' || ch == ']') {
- plug = peekCommand(state);
- if (plug) {
- plug.closeBracket(ch);
- setState(state, beginParams);
- } else {
- return "error";
- }
- return "bracket";
- } else if (ch == '{' || ch == '[') {
- plug = plugins["DEFAULT"];
- plug = new plug();
- pushCommand(state, plug);
- return "bracket";
- } else if (/\d/.test(ch)) {
- source.eatWhile(/[\w.%]/);
- return "atom";
- } else {
- source.eatWhile(/[\w\-_]/);
- plug = getMostPowerful(state);
- if (plug.name == 'begin') {
- plug.argument = source.current();
- }
- return plug.styleIdentifier();
- }
- }
- function inMathMode(source, state, endModeSeq) {
- if (source.eatSpace()) {
- return null;
- }
- if (endModeSeq && source.match(endModeSeq)) {
- setState(state, normal);
- return "keyword";
- }
- if (source.match(/^\\[a-zA-Z@]+/)) {
- return "tag";
- }
- if (source.match(/^[a-zA-Z]+/)) {
- return "variable-2";
- }
- // escape characters
- if (source.match(/^\\[$&%#{}_]/)) {
- return "tag";
- }
- // white space control characters
- if (source.match(/^\\[,;!\/]/)) {
- return "tag";
- }
- // special math-mode characters
- if (source.match(/^[\^_&]/)) {
- return "tag";
- }
- // non-special characters
- if (source.match(/^[+\-<>|=,\/@!*:;'"`~#?]/)) {
- return null;
- }
- if (source.match(/^(\d+\.\d*|\d*\.\d+|\d+)/)) {
- return "number";
- }
- var ch = source.next();
- if (ch == "{" || ch == "}" || ch == "[" || ch == "]" || ch == "(" || ch == ")") {
- return "bracket";
- }
- if (ch == "%") {
- source.skipToEnd();
- return "comment";
- }
- return "error";
- }
- function beginParams(source, state) {
- var ch = source.peek(), lastPlug;
- if (ch == '{' || ch == '[') {
- lastPlug = peekCommand(state);
- lastPlug.openBracket(ch);
- source.eat(ch);
- setState(state, normal);
- return "bracket";
- }
- if (/[ \t\r]/.test(ch)) {
- source.eat(ch);
- return null;
- }
- setState(state, normal);
- popCommand(state);
- return normal(source, state);
- }
- return {
- startState: function() {
- var f = parserConfig.inMathMode ? function(source, state){ return inMathMode(source, state); } : normal;
- return {
- cmdState: [],
- f: f
- };
- },
- copyState: function(s) {
- return {
- cmdState: s.cmdState.slice(),
- f: s.f
- };
- },
- token: function(stream, state) {
- return state.f(stream, state);
- },
- blankLine: function(state) {
- state.f = normal;
- state.cmdState.length = 0;
- },
- lineComment: "%"
- };
- });
- CodeMirror.defineMIME("text/x-stex", "stex");
- CodeMirror.defineMIME("text/x-latex", "stex");
- });
- // IPython GFM (GitHub Flavored Markdown) mode is just a slightly altered GFM
- // Mode with support for latex.
- //
- // Latex support was supported by Codemirror GFM as of
- // https://github.com/codemirror/CodeMirror/pull/567
- // But was later removed in
- // https://github.com/codemirror/CodeMirror/commit/d9c9f1b1ffe984aee41307f3e927f80d1f23590c
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object"){ // CommonJS
- mod(requirejs("codemirror/lib/codemirror")
- ,requirejs("codemirror/addon/mode/multiplex")
- ,requirejs("codemirror/mode/gfm/gfm")
- ,requirejs("codemirror/mode/stex/stex")
- );
- } else if (typeof define == "function" && define.amd){ // AMD
- define('notebook/js/codemirror-ipythongfm',["codemirror/lib/codemirror"
- ,"codemirror/addon/mode/multiplex"
- ,"codemirror/mode/python/python"
- ,"codemirror/mode/stex/stex"
- ], mod);
- } else {// Plain browser env
- mod(CodeMirror);
- }
- })( function(CodeMirror){
- "use strict";
- CodeMirror.defineMode("ipythongfm", function(config, parserConfig) {
- var gfm_mode = CodeMirror.getMode(config, "gfm");
- var tex_mode = CodeMirror.getMode(config, "stex");
- return CodeMirror.multiplexingMode(
- gfm_mode,
- // By defining the $$ delimiter before the $ delimiter we don't run
- // into the problem that $$ is interpreted as two consecutive $.
- {
- open: "$$", close: "$$",
- mode: tex_mode,
- delimStyle: "delimit"
- },
- {
- open: "$", close: "$",
- mode: tex_mode,
- delimStyle: "delimit"
- },
- {
- open: "\\(", close: "\\)",
- mode: tex_mode,
- delimStyle: "delimit"
- },
- {
- open: "\\[", close: "\\]",
- mode: tex_mode,
- delimStyle: "delimit"
- }
- // .. more multiplexed styles can follow here
- );
- }, 'gfm');
- CodeMirror.defineMIME("text/x-ipythongfm", "ipythongfm");
- })
- ;
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('bidi/numericshaping',[],
- function(bidi) {
- "use strict";
-
- var regex = /([0-9])|([\u0660-\u0669])|([\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE]+)|([^0-9\u0660-\u0669\u0608\u060B\u060D\u061B-\u064A\u066D-\u066F\u0671-\u06D5\u06E5-\u06E6\u06EE-\u06EF\u06FA-\u06FF\u0750-\u077F\u08A0-\u08E3\u200F\u202B\u202E\u2067\uFB50-\uFD3D\uFD40-\uFDCF\uFDF0-\uFDFC\uFDFE-\uFDFF\uFE70-\uFEFE\u0600-\u0607\u0609-\u060A\u060C\u060E-\u061A\u064B-\u066C\u0670\u06D6-\u06E4\u06E7-\u06ED\u06F0-\u06F9\u08E4-\u08FF\uFD3E-\uFD3F\uFDD0-\uFDEF\uFDFD\uFEFF\u0000-\u0040\u005B-\u0060\u007B-\u007F\u0080-\u00A9\u00AB-\u00B4\u00B6-\u00B9\u00BB-\u00BF\u00D7\u00F7\u02B9-\u02BA\u02C2-\u02CF\u02D2-\u02DF\u02E5-\u02ED\u02EF-\u02FF\u2070\u2074-\u207E\u2080-\u208E\u2100-\u2101\u2103-\u2106\u2108-\u2109\u2114\u2116-\u2118\u211E-\u2123\u2125\u2127\u2129\u212E\u213A-\u213B\u2140-\u2144\u214A-\u214D\u2150-\u215F\u2189\uA720-\uA721\uA788\uFF01-\uFF20\uFF3B-\uFF40\uFF5B-\uFF65\uFFE0-\uFFE6\uFFE8-\uFFEE]+)/g;
-
- var shape = function(text, shaperType) {
- text = text.toString();
- if (!text) {
- return text;
- }
- switch (shaperType) {
- case "defaultNumeral":
- return _shapeEuropean(text);
- case "national":
- return _shapeArabic(text);
- default:
- return text;
- }
- };
-
- var _shapeEuropean = function(text) {
- return text.replace(/[\u0660-\u0669]/g, function(c) {
- return c.charCodeAt(0) - 1632;
- });
- };
- var _shapeArabic = function(text) {
- return text.replace(/[0-9]/g, function(c) {
- return String.fromCharCode(parseInt(c) + 1632);
- });
- };
-
- var numericshaping = {
- shapeNumerals : shape
- };
-
- return numericshaping;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('bidi/bidi',['bidi/numericshaping'], function(numericshaping) {
- 'use strict';
- var shaperType = '';
- var _uiLang = function() {
- return navigator.language.toLowerCase();
- };
- var _loadLocale = function() {
- if (_isMirroringEnabled()) {
- document.body.dir = 'rtl';
- }
- requirejs(['moment'], function (moment) {
- console.log('Loaded moment locale', moment.locale(_uiLang()));
- });
- shaperType = _uiLang().split('-')[0] == 'ar' ? 'national' : 'defaultNumeral';
- };
- var _isMirroringEnabled = function() {
- return new RegExp('^(ar|ara|arc|ae|ave|egy|he|heb|nqo|pal|phn|sam|syc|syr|fa|per|fas|ckb|ur|urd)').test(_uiLang());
- };
- /**
- * @param value : the string to apply the bidi-support on it.
- * @param flag :indicates the type of bidi-support (Numeric-shaping ,Base-text-dir ).
- */
- var _applyBidi = function(value /*, flag*/) {
- value = numericshaping.shapeNumerals(value, shaperType);
- return value;
- };
- var bidi = {
- applyBidi: _applyBidi,
- isMirroringEnabled: _isMirroringEnabled,
- loadLocale: _loadLocale,
- };
- return bidi;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/textcell',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'notebook/js/cell',
- 'base/js/markdown',
- 'services/config',
- 'notebook/js/celltoolbar',
- 'codemirror/lib/codemirror',
- 'codemirror/mode/gfm/gfm',
- 'notebook/js/codemirror-ipythongfm',
- 'bidi/bidi'
- ], function(
- $,
- utils,
- i18n,
- cell,
- markdown,
- configmod,
- celltoolbar,
- CodeMirror,
- gfm,
- ipgfm,
- bidi
- ) {
- "use strict";
- function encodeURIandParens(uri){return encodeURI(uri).replace('(','%28').replace(')','%29')}
- /**
- * Given a file name and a list of existing file names, returns a new file name
- * that is not in the existing list. If the file name already exists, a new one with
- * an incremented index is returned instead.
- *
- * Example:
- * addIndexToFileName('attachment.png',
- * ['attachment.png', 'attachment-3.png']) returns 'attachment-4.png'
- *
- * @param {string} fileName - original file name
- * @param {string} fileNames - other file names
- * @return {string} the original file name or one with a postfix
- * index (before the extension, if one exists)
- */
- function addIndexToFileName(fileName, fileNames) {
- if (fileNames === undefined) {
- return fileName;
- }
- var lastDot = fileName.lastIndexOf('.');
- var pre = fileName.substr(0, lastDot);
- var optionalExt = fileName.substr(lastDot);
- var indexMatch = '-(\\d+)';
- // Make the index match optional so we can match both 'fileName.png' and 'fileName-2.png'
- // The ?: makes it a non-capturing group.
- var optionalIndexMatch = '(?:' + indexMatch + ')?';
- var regex = new RegExp(pre + optionalIndexMatch + optionalExt);
- var highestIndex = 0;
- for (var existingFileName in fileNames) {
- var match = existingFileName.match(regex);
- var index = match[1];
- if (index === undefined) {
- index = 1;
- }
- else {
- index = parseInt(index);
- }
- if (index > highestIndex) {
- highestIndex = index;
- }
- }
- if (highestIndex > 0) {
- return pre + "-" + (highestIndex + 1) + optionalExt;
- }
- else {
- return fileName;
- }
- };
- var Cell = cell.Cell;
- var TextCell = function (options) {
- /**
- * Constructor
- *
- * Construct a new TextCell, codemirror mode is by default 'htmlmixed',
- * and cell type is 'text' cell start as not redered.
- *
- * Parameters:
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * config: dictionary
- * keyboard_manager: KeyboardManager instance
- * notebook: Notebook instance
- */
- options = options || {};
- // in all TextCell/Cell subclasses
- // do not assign most of members here, just pass it down
- // in the options dict potentially overwriting what you wish.
- // they will be assigned in the base class.
- this.notebook = options.notebook;
- this.events = options.events;
- this.config = options.config;
- // we cannot put this as a class key as it has handle to "this".
- Cell.apply(this, [{
- config: options.config,
- keyboard_manager: options.keyboard_manager,
- events: this.events}]);
- this.cell_type = this.cell_type || 'text';
- this.rendered = false;
- };
- TextCell.prototype = Object.create(Cell.prototype);
- TextCell.options_default = {
- cm_config : {
- mode: 'htmlmixed',
- lineWrapping : true,
- }
- };
- /**
- * Create the DOM element of the TextCell
- * @method create_element
- * @private
- */
- TextCell.prototype.create_element = function () {
- Cell.prototype.create_element.apply(this, arguments);
- var that = this;
- var cell = $("<div>").addClass('cell text_cell');
- cell.attr('tabindex','2');
- var prompt = $('<div/>').addClass('prompt input_prompt');
- cell.append(prompt);
- var inner_cell = $('<div/>').addClass('inner_cell');
- this.celltoolbar = new celltoolbar.CellToolbar({
- cell: this,
- notebook: this.notebook});
- inner_cell.append(this.celltoolbar.element);
- var input_area = $('<div/>').addClass('input_area').attr("aria-label", i18n.msg._("Edit Markup Text here"));
- this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);
- // In case of bugs that put the keyboard manager into an inconsistent state,
- // ensure KM is enabled when CodeMirror is focused:
- this.code_mirror.on('focus', function () {
- if (that.keyboard_manager) {
- that.keyboard_manager.enable();
- }
- that.code_mirror.setOption('readOnly', !that.is_editable());
- });
- this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this))
- // The tabindex=-1 makes this div focusable.
- var render_area = $('<div/>').addClass('text_cell_render rendered_html')
- .attr('tabindex','-1');
- inner_cell.append(input_area).append(render_area);
- cell.append(inner_cell);
- this.element = cell;
- this.inner_cell = inner_cell;
- };
- // Cell level actions
- TextCell.prototype.add_attachment = function (key, mime_type, b64_data) {
- /**
- * Add a new attachment to this cell
- */
- this.attachments[key] = {};
- this.attachments[key][mime_type] = b64_data;
- };
- TextCell.prototype.select = function () {
- var cont = Cell.prototype.select.apply(this, arguments);
- if (cont) {
- if (this.mode === 'edit') {
- this.code_mirror.refresh();
- }
- }
- return cont;
- };
- TextCell.prototype.unrender = function () {
- var cont = Cell.prototype.unrender.apply(this);
- if (cont) {
- var text_cell = this.element;
- if (this.get_text() === this.placeholder) {
- this.set_text('');
- }
- this.refresh();
- }
- return cont;
- };
- TextCell.prototype.execute = function () {
- this.render();
- };
- /**
- * setter: {{#crossLink "TextCell/set_text"}}{{/crossLink}}
- * @method get_text
- * @return {string} CodeMirror current text value
- */
- TextCell.prototype.get_text = function() {
- return this.code_mirror.getValue();
- };
- /**
- * @param {string} text - Codemiror text value
- * @see TextCell#get_text
- * @method set_text
- * */
- TextCell.prototype.set_text = function(text) {
- this.code_mirror.setValue(text);
- this.unrender();
- this.code_mirror.refresh();
- };
- /**
- * setter :{{#crossLink "TextCell/set_rendered"}}{{/crossLink}}
- * @method get_rendered
- * */
- TextCell.prototype.get_rendered = function() {
- return this.element.find('div.text_cell_render').html();
- };
- /**
- * @method set_rendered
- */
- TextCell.prototype.set_rendered = function(text) {
- this.element.find('div.text_cell_render').html(text);
- };
- /**
- * Create Text cell from JSON
- * @param {json} data - JSON serialized text-cell
- * @method fromJSON
- */
- TextCell.prototype.fromJSON = function (data) {
- Cell.prototype.fromJSON.apply(this, arguments);
- if (data.cell_type === this.cell_type) {
- if (data.attachments !== undefined) {
- this.attachments = data.attachments;
- }
- if (data.source !== undefined) {
- this.set_text(data.source);
- // make this value the starting point, so that we can only undo
- // to this state, instead of a blank cell
- this.code_mirror.clearHistory();
- // TODO: This HTML needs to be treated as potentially dangerous
- // user input and should be handled before set_rendered.
- this.set_rendered(data.rendered || '');
- this.rendered = false;
- this.render();
- }
- }
- };
- /** Generate JSON from cell
- * @param {bool} gc_attachments - If true, will remove unused attachments
- * from the returned JSON
- * @return {object} cell data serialised to json
- */
- TextCell.prototype.toJSON = function (gc_attachments) {
- if (gc_attachments === undefined) {
- gc_attachments = false;
- }
- var data = Cell.prototype.toJSON.apply(this);
- data.source = this.get_text();
- if (data.source == this.placeholder) {
- data.source = "";
- }
- // We deepcopy the attachments so copied cells don't share the same
- // objects
- if (Object.keys(this.attachments).length > 0) {
- if (gc_attachments) {
- // Garbage collect unused attachments : The general idea is to
- // render the text, and find used attachments like when we
- // substitute them in render()
- var that = this;
- data.attachments = {};
- // To find attachments, rendering to HTML is easier than
- // searching in the markdown source for the multiple ways you
- // can reference an image in markdown (using []() or a
- // HTML <img>)
- var text = this.get_text();
- markdown.render(text, {
- sanitize: true,
- }, function (err, html) {
- html.find('img[src^="attachment:"]').each(function (i, h) {
- h = $(h);
- var key = h.attr('src').replace(/^attachment:/, '');
- if (that.attachments.hasOwnProperty(key)) {
- data.attachments[key] = JSON.parse(JSON.stringify(
- that.attachments[key]));
- }
- // This is to avoid having the browser do a GET request
- // on the invalid attachment: URL
- h.attr('src', '');
- });
- });
- if (data.attachments.length === 0) {
- // omit attachments dict if no attachments
- delete data.attachments;
- }
- } else {
- data.attachments = JSON.parse(JSON.stringify(this.attachments));
- }
- }
- return data;
- };
- var MarkdownCell = function (options) {
- /**
- * Constructor
- *
- * Parameters:
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * config: ConfigSection instance
- * keyboard_manager: KeyboardManager instance
- * notebook: Notebook instance
- */
- options = options || {};
- var config_default = utils.mergeopt(TextCell, MarkdownCell.options_default);
- this.class_config = new configmod.ConfigWithDefaults(options.config,
- config_default, 'MarkdownCell');
- TextCell.apply(this, [$.extend({}, options, {config: options.config})]);
- this.cell_type = 'markdown';
- // Used to keep track of drag events
- this.drag_counter = 0;
- };
- MarkdownCell.options_default = {
- cm_config: {
- mode: 'ipythongfm',
- },
- placeholder: "Type *Markdown* and LaTeX: $\\alpha^2$"
- };
- MarkdownCell.prototype = Object.create(TextCell.prototype);
- MarkdownCell.prototype.set_heading_level = function (level) {
- /**
- * make a markdown cell a heading
- */
- level = level || 1;
- var source = this.get_text();
- source = source.replace(/^(#*)\s?/,
- new Array(level + 1).join('#') + ' ');
- this.set_text(source);
- this.refresh();
- if (this.rendered) {
- this.render();
- }
- };
- MarkdownCell.prototype.select = function () {
- var cont = TextCell.prototype.select.apply(this, arguments);
- if (cont) {
- this.notebook.set_insert_image_enabled(!this.rendered);
- }
- };
- MarkdownCell.prototype.unrender = function () {
- var cont = TextCell.prototype.unrender.apply(this);
- this.notebook.set_insert_image_enabled(true);
- };
- MarkdownCell.prototype.insert_inline_image_from_blob = function(blob) {
- /**
- * Insert markup for an inline image at the current cursor position.
- * This works as follow :
- * - We insert the base64-encoded blob data into the cell attachments
- * dictionary, keyed by the filename.
- * - We insert an img tag with a 'attachment:key' src that refers to
- * the attachments entry.
- *
- * Parameters:
- * file: Blob
- * The JS Blob object (e.g. from the DataTransferItem)
- */
- var that = this;
- var pos = this.code_mirror.getCursor();
- var reader = new FileReader();
- // We can get either a named file (drag'n'drop) or a blob (copy/paste)
- // We generate names for blobs
- var key;
- if (blob.name !== undefined) {
- key = encodeURIandParens(blob.name);
- // Add an index to the filename if we already have one with the same name
- key = addIndexToFileName(key, that.attachments);
- } else {
- key = '_auto_' + Object.keys(that.attachments).length;
- }
- reader.onloadend = function() {
- var d = utils.parse_b64_data_uri(reader.result);
- var blobData = d[1]
- if (blob.type != d[0]) {
- // TODO(julienr): Not sure what we should do in this case
- console.log('File type (' + blob.type + ') != data-uri ' +
- 'type (' + d[0] + ')');
- }
- // If we have the same attachment already under another key, we change the key to that.
- // This ensures we don't create two attachments if pasting the same image twice.
- for (var savedKey in that.attachments) {
- var attachment = that.attachments[savedKey];
- if (attachment === undefined) continue;
- var savedBlob = attachment[blob.type];
- if (savedBlob === blobData) {
- key = savedKey;
- }
- }
- that.add_attachment(key, blob.type, blobData);
- var img_md = '![' + key + '](attachment:' + key + ')';
- that.code_mirror.replaceRange(img_md, pos);
- }
- reader.readAsDataURL(blob);
- };
- /**
- * @method render
- */
- MarkdownCell.prototype.render = function () {
- // We clear the dropzone here just in case the dragenter/leave
- // logic of bind_events wasn't 100% successful.
- this.drag_counter = 0;
- this.inner_cell.removeClass('dropzone');
- var cont = TextCell.prototype.render.apply(this);
- if (cont) {
- var that = this;
- var text = this.get_text();
- var math = null;
- if (text === "") { text = this.placeholder; }
- markdown.render(text, {
- with_math: true,
- clean_tables: true,
- sanitize: true,
- }, function (err, html) {
- // add anchors to headings
- html.find(":header").addBack(":header").each(function (i, h) {
- h = $(h);
- var hash = h.text().replace(/ /g, '-');
- h.attr('id', hash);
- h.append(
- $('<a/>')
- .addClass('anchor-link')
- .attr('href', '#' + hash)
- .text('¶')
- .on('click',function(){
- setTimeout(function(){that.unrender(); that.render()}, 100)
- })
- );
- });
- // links in markdown cells should open in new tabs
- html.find("a[href]").not('[href^="#"]').attr("target", "_blank");
- // replace attachment:<key> by the corresponding entry
- // in the cell's attachments
- html.find('img[src^="attachment:"]').each(function (i, h) {
- h = $(h);
- var key = h.attr('src').replace(/^attachment:/, '');
- if (that.attachments.hasOwnProperty(key)) {
- var att = that.attachments[key];
- var mime = Object.keys(att)[0];
- h.attr('src', 'data:' + mime + ';base64,' + att[mime]);
- } else {
- h.attr('src', '');
- }
- });
- that.set_rendered(html);
- that.typeset();
- that.events.trigger("rendered.MarkdownCell", {cell: that});
- });
- }
- return cont;
- };
- /** @method bind_events **/
- MarkdownCell.prototype.bind_events = function () {
- TextCell.prototype.bind_events.apply(this);
- var that = this;
- this.element.dblclick(function () {
- var cont = that.unrender();
- if (cont) {
- that.focus_editor();
- }
- });
- var attachment_regex = /^image\/.*$/;
- // Event handlers to allow users to insert image using either
- // drag'n'drop or copy/paste
- var div = that.code_mirror.getWrapperElement();
- $(div).on('paste', function(evt) {
- var data = evt.originalEvent.clipboardData;
- var items = data.items;
- if (items !== undefined) {
- for (var i = 0; i < items.length; ++i) {
- var item = items[i];
- if (item.kind == 'file' && attachment_regex.test(item.type)) {
- // TODO(julienr): This does not stop code_mirror from pasting
- // the filename.
- evt.stopPropagation();
- evt.preventDefault();
- that.insert_inline_image_from_blob(item.getAsFile());
- }
- }
- }
- });
- // Allow drag event if the dragged file can be used as an attachment
- // If we use this.code_mirror.on to register a "dragover" handler, we
- // get an empty dataTransfer
- this.code_mirror.on("dragover", function(cm, evt) {
- if (utils.dnd_contain_file(evt)) {
- evt.preventDefault();
- }
- });
- // We want to display a visual indicator that the drop is possible.
- // The dragleave event is fired when we hover a child element (which
- // is often immediately after we got the dragenter), so we keep track
- // of the number of dragenter/dragleave we got, as discussed here :
- // https://stackoverflow.com/q/7110353/116067
- // This doesn't seem to be 100% reliable, so we clear the dropzone
- // class when the cell is rendered as well
- this.code_mirror.on("dragenter", function(cm, evt) {
- if (utils.dnd_contain_file(evt)) {
- that.drag_counter++;
- that.inner_cell.addClass('dropzone');
- }
- evt.preventDefault();
- evt.stopPropagation();
- });
- this.code_mirror.on("dragleave", function(cm, evt) {
- that.drag_counter--;
- if (that.drag_counter <= 0) {
- that.inner_cell.removeClass('dropzone');
- }
- evt.preventDefault();
- evt.stopPropagation();
- });
- this.code_mirror.on("drop", function(cm, evt) {
- that.drag_counter = 0;
- that.inner_cell.removeClass('dropzone');
- var files = evt.dataTransfer.files;
- for (var i = 0; i < files.length; ++i) {
- var file = files[i];
- if (attachment_regex.test(file.type)) {
- // Prevent the default code_mirror 'drop' event handler
- // (which inserts the file content) if this is a
- // recognized media file
- evt.stopPropagation();
- evt.preventDefault();
- that.insert_inline_image_from_blob(file);
- }
- }
- });
- };
- var RawCell = function (options) {
- /**
- * Constructor
- *
- * Parameters:
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * config: ConfigSection instance
- * keyboard_manager: KeyboardManager instance
- * notebook: Notebook instance
- */
- options = options || {};
- var config_default = utils.mergeopt(TextCell, RawCell.options_default);
- this.class_config = new configmod.ConfigWithDefaults(options.config,
- config_default, 'RawCell');
- TextCell.apply(this, [$.extend({}, options, {config: options.config})]);
- this.cell_type = 'raw';
- };
- RawCell.options_default = {
- highlight_modes : {
- 'diff' :{'reg':[/^diff/]}
- },
- placeholder : i18n.msg._("Write raw LaTeX or other formats here, for use with nbconvert. " +
- "It will not be rendered in the notebook. " +
- "When passing through nbconvert, a Raw Cell's content is added to the output unmodified."),
- };
- RawCell.prototype = Object.create(TextCell.prototype);
- /** @method bind_events **/
- RawCell.prototype.bind_events = function () {
- TextCell.prototype.bind_events.apply(this);
- var that = this;
- this.element.focusout(function() {
- that.auto_highlight();
- that.render();
- });
- this.code_mirror.on('focus', function() { that.unrender(); });
- };
- /** @method render **/
- RawCell.prototype.render = function () {
- var cont = TextCell.prototype.render.apply(this);
- if (cont){
- var text = this.get_text();
- if (text === "") { text = this.placeholder; }
- this.set_text(text);
- this.element.removeClass('rendered');
- this.auto_highlight();
- }
- return cont;
- };
- var textcell = {
- TextCell: TextCell,
- MarkdownCell: MarkdownCell,
- RawCell: RawCell
- };
- return textcell;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- /**
- *
- *
- * @module keyboard
- * @namespace keyboard
- * @class ShortcutManager
- */
- define('base/js/keyboard',[
- 'jquery',
- 'base/js/utils',
- 'underscore',
- ], function($, utils, _) {
- "use strict";
- /**
- * Setup global keycodes and inverse keycodes.
- *
- * See http://unixpapa.com/js/key.html for a complete description. The short of
- * it is that there are different keycode sets. Firefox uses the "Mozilla keycodes"
- * and Webkit/IE use the "IE keycodes". These keycode sets are mostly the same
- * but have minor differences.
- **/
- // These apply to Firefox, (Webkit and IE)
- // This does work **only** on US keyboard.
- var _keycodes = {
- 'a': 65, 'b': 66, 'c': 67, 'd': 68, 'e': 69, 'f': 70, 'g': 71, 'h': 72, 'i': 73,
- 'j': 74, 'k': 75, 'l': 76, 'm': 77, 'n': 78, 'o': 79, 'p': 80, 'q': 81, 'r': 82,
- 's': 83, 't': 84, 'u': 85, 'v': 86, 'w': 87, 'x': 88, 'y': 89, 'z': 90,
- '1 !': 49, '2 @': 50, '3 #': 51, '4 $': 52, '5 %': 53, '6 ^': 54,
- '7 &': 55, '8 *': 56, '9 (': 57, '0 )': 48,
- '[ {': 219, '] }': 221, '` ~': 192, ', <': 188, '. >': 190, '/ ?': 191,
- '\\ |': 220, '\' "': 222,
- 'numpad0': 96, 'numpad1': 97, 'numpad2': 98, 'numpad3': 99, 'numpad4': 100,
- 'numpad5': 101, 'numpad6': 102, 'numpad7': 103, 'numpad8': 104, 'numpad9': 105,
- 'multiply': 106, 'add': 107, 'subtract': 109, 'decimal': 110, 'divide': 111,
- 'f1': 112, 'f2': 113, 'f3': 114, 'f4': 115, 'f5': 116, 'f6': 117, 'f7': 118,
- 'f8': 119, 'f9': 120, 'f10': 121, 'f11': 122, 'f12': 123, 'f13': 124, 'f14': 125, 'f15': 126,
- 'backspace': 8, 'tab': 9, 'enter': 13, 'shift': 16, 'ctrl': 17, 'alt': 18,
- 'meta': 91, 'capslock': 20, 'esc': 27, 'space': 32, 'pageup': 33, 'pagedown': 34,
- 'end': 35, 'home': 36, 'left': 37, 'up': 38, 'right': 39, 'down': 40,
- 'insert': 45, 'delete': 46, 'numlock': 144,
- };
-
- // These apply to Firefox and Opera
- var _mozilla_keycodes = {
- '; :': 59, '= +': 61, '- _': 173, 'meta': 224, 'minus':173
- };
-
- // This apply to Webkit and IE
- var _ie_keycodes = {
- '; :': 186, '= +': 187, '- _': 189, 'minus':189
- };
-
- var browser = utils.browser[0];
- var platform = utils.platform;
-
- if (browser === 'Firefox' || browser === 'Opera' || browser === 'Netscape') {
- $.extend(_keycodes, _mozilla_keycodes);
- } else if (browser === 'Safari' || browser === 'Chrome' || browser === 'MSIE') {
- $.extend(_keycodes, _ie_keycodes);
- }
- var keycodes = {};
- var inv_keycodes = {};
- for (var name in _keycodes) {
- var names = name.split(' ');
- if (names.length === 1) {
- var n = names[0];
- keycodes[n] = _keycodes[n];
- inv_keycodes[_keycodes[n]] = n;
- } else {
- var primary = names[0];
- var secondary = names[1];
- keycodes[primary] = _keycodes[name];
- keycodes[secondary] = _keycodes[name];
- inv_keycodes[_keycodes[name]] = primary;
- }
- }
- var normalize_key = function (key) {
- return inv_keycodes[keycodes[key]];
- };
- var normalize_shortcut = function (shortcut) {
- /**
- * @function _normalize_shortcut
- * @private
- * return a dict containing the normalized shortcut and the number of time it should be pressed:
- *
- * Put a shortcut into normalized form:
- * 1. Make lowercase
- * 2. Replace cmd by meta
- * 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
- * 4. Normalize keys
- **/
- if (platform === 'MacOS') {
- shortcut = shortcut.toLowerCase().replace('cmdtrl-', 'cmd-');
- } else {
- shortcut = shortcut.toLowerCase().replace('cmdtrl-', 'ctrl-');
- }
- shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
- shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
- shortcut = shortcut.replace(/,$/, 'comma'); // catch shortcuts using '-' key
- if(shortcut.indexOf(',') !== -1){
- var sht = shortcut.split(',');
- sht = _.map(sht, normalize_shortcut);
- return shortcut;
- }
- shortcut = shortcut.replace(/comma/g, ','); // catch shortcuts using '-' key
- var values = shortcut.split("-");
- if (values.length === 1) {
- return normalize_key(values[0]);
- } else {
- var modifiers = values.slice(0,-1);
- var key = normalize_key(values[values.length-1]);
- modifiers.sort();
- return modifiers.join('-') + '-' + key;
- }
- };
- var shortcut_to_event = function (shortcut, type) {
- /**
- * Convert a shortcut (shift-r) to a jQuery Event object
- **/
- type = type || 'keydown';
- shortcut = normalize_shortcut(shortcut);
- shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
- var values = shortcut.split("-");
- var modifiers = values.slice(0,-1);
- var key = values[values.length-1];
- var opts = {which: keycodes[key]};
- if (modifiers.indexOf('alt') !== -1) {opts.altKey = true;}
- if (modifiers.indexOf('ctrl') !== -1) {opts.ctrlKey = true;}
- if (modifiers.indexOf('meta') !== -1) {opts.metaKey = true;}
- if (modifiers.indexOf('shift') !== -1) {opts.shiftKey = true;}
- return $.Event(type, opts);
- };
- var only_modifier_event = function(event){
- /**
- * Return `true` if the event only contains modifiers keys.
- * false otherwise
- **/
- var key = inv_keycodes[event.which];
- return ((event.altKey || event.ctrlKey || event.metaKey || event.shiftKey) &&
- (key === 'alt'|| key === 'ctrl'|| key === 'meta'|| key === 'shift'));
- };
- var event_to_shortcut = function (event) {
- /**
- * Convert a jQuery Event object to a normalized shortcut string (shift-r)
- **/
- var shortcut = '';
- var key = inv_keycodes[event.which];
- if (event.altKey && key !== 'alt') {shortcut += 'alt-';}
- if (event.ctrlKey && key !== 'ctrl') {shortcut += 'ctrl-';}
- if (event.metaKey && key !== 'meta') {shortcut += 'meta-';}
- if (event.shiftKey && key !== 'shift') {shortcut += 'shift-';}
- shortcut += key;
- return shortcut;
- };
- // Shortcut manager class
- var ShortcutManager = function (delay, events, actions, env, config, mode) {
- /**
- * A class to deal with keyboard event and shortcut
- *
- * @class ShortcutManager
- * @constructor
- *
- * :config: configobjet on which to call `update(....)` to persist the config.
- * :mode: mode of this shortcut manager where to persist config.
- */
- mode = mode || 'command';
- this._shortcuts = {};
- this._defaults_bindings = [];
- this.delay = delay || 800; // delay in milliseconds
- this.events = events;
- this.actions = actions;
- this.actions.extend_env(env);
- this._queue = [];
- this._cleartimeout = null;
- this._config = config;
- this._mode = mode;
- Object.seal(this);
- };
- ShortcutManager.prototype.clearsoon = function(){
- /**
- * Clear the pending shortcut soon, and cancel previous clearing
- * that might be registered.
- **/
- var that = this;
- clearTimeout(this._cleartimeout);
- this._cleartimeout = setTimeout(function(){that.clearqueue();}, this.delay);
- };
- ShortcutManager.prototype.clearqueue = function(){
- /**
- * clear the pending shortcut sequence now.
- **/
- this._queue = [];
- clearTimeout(this._cleartimeout);
- };
- var flatten_shorttree = function(tree){
- /**
- * Flatten a tree of shortcut sequences.
- * use full to iterate over all the key/values of available shortcuts.
- **/
- var dct = {};
- _.forEach(tree, function(value, key) {
- if(typeof(value) === 'string'){
- dct[key] = value;
- } else {
- var ftree=flatten_shorttree(value);
- _.forEach(ftree, function(v2, subkey) {
- dct[key+','+subkey] = ftree[subkey];
- });
- }
- });
- return dct;
- };
- ShortcutManager.prototype.get_action_shortcuts = function(name){
- var ftree = flatten_shorttree(this._shortcuts);
- var res = [];
- _.forEach(ftree, function(value, key) {
- if(value === name){
- res.push(key);
- }
- });
- return res;
- };
-
- ShortcutManager.prototype.get_action_shortcut = function(name){
- var matches = this.get_action_shortcuts(name);
- if (matches.length > 0) {
- return matches[0];
- }
- return undefined;
- };
- ShortcutManager.prototype.help = function () {
- var that = this;
- var help = [];
- var ftree = flatten_shorttree(this._shortcuts);
- _.forEach(ftree, function(value, key) {
- var action = that.actions.get(value);
- var help_string = action.help||'== no help ==';
- var help_index = action.help_index;
- if (help_string) {
- var shortstring = (action.shortstring||key);
- help.push({
- shortcut: shortstring,
- help: help_string,
- help_index: help_index}
- );
- }
- });
- help.sort(function (a, b) {
- if (a.help_index === b.help_index) {
- if (a.shortcut === b.shortcut) {
- return 0;
- }
- if (a.shortcut > b.shortcut) {
- return 1;
- }
- return -1;
- }
- if (a.help_index === undefined || a.help_index > b.help_index){
- return 1;
- }
- return -1;
- });
- return help;
- };
- ShortcutManager.prototype.clear_shortcuts = function () {
- this._shortcuts = {};
- };
- ShortcutManager.prototype.get_shortcut = function (shortcut){
- /**
- * return a node of the shortcut tree which an action name (string) if leaf,
- * and an object with `object.subtree===true`
- **/
- if(typeof(shortcut) === 'string'){
- shortcut = shortcut.split(',');
- }
-
- return this._get_leaf(shortcut, this._shortcuts);
- };
- ShortcutManager.prototype._get_leaf = function(shortcut_array, tree){
- /**
- * @private
- * find a leaf/node in a subtree of the keyboard shortcut
- *
- **/
- if(shortcut_array.length === 1){
- return tree[shortcut_array[0]];
- } else if( typeof(tree[shortcut_array[0]]) !== 'string'){
- return this._get_leaf(shortcut_array.slice(1), tree[shortcut_array[0]]);
- }
- return null;
- };
- ShortcutManager.prototype.set_shortcut = function( shortcut, action_name){
- if( typeof(action_name) !== 'string'){throw new Error('action is not a string', action_name);}
- if( typeof(shortcut) === 'string'){
- shortcut = shortcut.split(',');
- }
- return this._set_leaf(shortcut, action_name, this._shortcuts);
- };
- ShortcutManager.prototype._is_leaf = function(shortcut_array, tree){
- if(shortcut_array.length === 1){
- return(typeof(tree[shortcut_array[0]]) === 'string');
- } else {
- var subtree = tree[shortcut_array[0]];
- return this._is_leaf(shortcut_array.slice(1), subtree );
- }
- };
- ShortcutManager.prototype._remove_leaf = function(shortcut_array, tree, allow_node){
- if(shortcut_array.length === 1){
- var current_node = tree[shortcut_array[0]];
- if(typeof(current_node) === 'string'){
- delete tree[shortcut_array[0]];
- } else {
- throw new Error('try to delete non-leaf');
- }
- } else {
- this._remove_leaf(shortcut_array.slice(1), tree[shortcut_array[0]], allow_node);
- if(_.keys(tree[shortcut_array[0]]).length === 0){
- delete tree[shortcut_array[0]];
- }
- }
- };
- ShortcutManager.prototype.is_available_shortcut = function(shortcut){
- var shortcut_array = shortcut.split(',');
- return this._is_available_shortcut(shortcut_array, this._shortcuts);
- };
- ShortcutManager.prototype._is_available_shortcut = function(shortcut_array, tree){
- var current_node = tree[shortcut_array[0]];
- if(!shortcut_array[0]){
- return false;
- }
- if(current_node === undefined){
- return true;
- } else {
- if (typeof(current_node) === 'string'){
- return false;
- } else { // assume is a sub-shortcut tree
- return this._is_available_shortcut(shortcut_array.slice(1), current_node);
- }
- }
- };
- ShortcutManager.prototype._set_leaf = function(shortcut_array, action_name, tree){
- var current_node = tree[shortcut_array[0]];
- if(shortcut_array.length === 1){
- if(current_node !== undefined && typeof(current_node) !== 'string'){
- console.warn('[warning], you are overriting a long shortcut with a shorter one');
- }
- tree[shortcut_array[0]] = action_name;
- return true;
- } else {
- if(typeof(current_node) === 'string'){
- console.warn('you are trying to set a shortcut that will be shadowed'+
- 'by a more specific one. Aborting for :', action_name, 'the following '+
- 'will take precedence', current_node);
- return false;
- } else {
- tree[shortcut_array[0]] = tree[shortcut_array[0]]||{};
- }
- this._set_leaf(shortcut_array.slice(1), action_name, tree[shortcut_array[0]]);
- return true;
- }
- };
- ShortcutManager.prototype._persist_shortcut = function(shortcut, data) {
- /**
- * add a shortcut to this manager and persist it to the config file.
- **/
- shortcut = shortcut.toLowerCase();
- this.add_shortcut(shortcut, data);
- var patch = {keys:{}};
- patch.keys[this._mode] = {bind:{}};
- patch.keys[this._mode].bind[shortcut] = data;
- this._config.update(patch);
- };
- ShortcutManager.prototype._persist_remove_shortcut = function(shortcut){
- /**
- * Remove a shortcut from this manager and persist its removal.
- */
- shortcut = shortcut.toLowerCase();
- this.remove_shortcut(shortcut);
- var patch = {keys: {}};
- patch.keys[this._mode] = {bind:{}};
- patch.keys[this._mode].bind[shortcut] = null;
- this._config.update(patch);
- // if the shortcut we unbind is a default one, we add it to the list of
- // things to unbind at startup
- if( this._defaults_bindings.indexOf(shortcut) !== -1 ){
- var cnf = (this._config.data.keys || {})[this._mode];
- var unbind_array = cnf.unbind || [];
- // unless it's already there (like if we have remapped a default
- // shortcut to another command): unbind it)
- if(unbind_array.indexOf(shortcut) === -1){
- var _parray = unbind_array.concat(shortcut);
- var unbind_patch = {keys:{}};
- unbind_patch.keys[this._mode] = {unbind:_parray};
- console.warn('up:', unbind_patch);
- this._config.update(unbind_patch);
- }
- }
- };
- ShortcutManager.prototype.add_shortcut = function (shortcut, data, suppress_help_update) {
- /**
- * Add an action to be handled by shortcut manager.
- *
- * - `shortcut` should be a `Shortcut Sequence` of the for `Ctrl-Alt-C,Meta-X`...
- * - `data` could be an `action name`, an `action` or a `function`.
- * if a `function` is passed it will be converted to an anonymous `action`.
- *
- **/
- var action_name = this.actions.get_name(data);
- if (! action_name){
- if (typeof data === 'string') {
- // If we have an action name, allow it to be bound anyway.
- console.log("Unknown action '" + data + "' for shortcut " + shortcut
- + "; it may be defined by an extension which is not yet loaded.");
- action_name = data;
- } else {
- throw new Error('does not know how to deal with : ' + data);
- }
- }
- var _shortcut = normalize_shortcut(shortcut);
- this.set_shortcut(_shortcut, action_name);
- if (!suppress_help_update) {
- // update the keyboard shortcuts notebook help
- this.events.trigger('rebuild.QuickHelp');
- }
- };
- ShortcutManager.prototype.add_shortcuts = function (data) {
- /**
- * Convenient methods to call `add_shortcut(key, value)` on several items
- *
- * data : Dict of the form {key:value, ...}
- **/
- var that = this;
- _.forEach(data, function(value, key) {
- that.add_shortcut(key, value, true);
- });
- // update the keyboard shortcuts notebook help
- this.events.trigger('rebuild.QuickHelp');
- };
- ShortcutManager.prototype._add_default_shortcuts = function (data) {
- /**
- * same as add_shortcuts, but register them as "default" that if persistently unbound, with
- * persist_remove_shortcut, need to be on the "unbind" list.
- **/
- this._defaults_bindings = this._defaults_bindings.concat(Object.keys(data));
- this.add_shortcuts(data);
- };
- ShortcutManager.prototype.remove_shortcut = function (shortcut, suppress_help_update) {
- /**
- * Remove the binding of shortcut `shortcut` with its action.
- * throw an error if trying to remove a non-exiting shortcut
- **/
- if(!shortcut){
- console.warn('trying to remove empty shortcut');
- return;
- }
- shortcut = normalize_shortcut(shortcut);
- if( typeof(shortcut) === 'string'){
- shortcut = shortcut.split(',');
- }
- /*
- * The shortcut error should be explicit here, because it will be
- * seen by users.
- */
- try {
- this._remove_leaf(shortcut, this._shortcuts);
- if (!suppress_help_update) {
- // update the keyboard shortcuts notebook help
- this.events.trigger('rebuild.QuickHelp');
- }
- } catch (ex) {
- throw new Error('trying to remove a non-existent shortcut', shortcut, typeof shortcut);
- }
- };
- ShortcutManager.prototype.call_handler = function (event) {
- /**
- * Call the corresponding shortcut handler for a keyboard event
- * @method call_handler
- * @return {Boolean} `true|false`, `false` if no handler was found, otherwise the value return by the handler.
- * @param event {event}
- *
- * given an event, call the corresponding shortcut.
- * return false is event wan handled, true otherwise
- * in any case returning false stop event propagation
- **/
- this.clearsoon();
- if(only_modifier_event(event)){
- return true;
- }
- var shortcut = event_to_shortcut(event);
- this._queue.push(shortcut);
- var action_name = this.get_shortcut(this._queue);
- if (typeof(action_name) === 'undefined'|| action_name === null){
- this.clearqueue();
- return true;
- }
-
- if (this.actions.exists(action_name)) {
- event.preventDefault();
- this.clearqueue();
- return this.actions.call(action_name, event);
- }
- return false;
- };
- ShortcutManager.prototype.handles = function (event) {
- var shortcut = event_to_shortcut(event);
- var action_name = this.get_shortcut(this._queue.concat(shortcut));
- return (typeof(action_name) !== 'undefined');
- };
- return {
- keycodes : keycodes,
- inv_keycodes : inv_keycodes,
- ShortcutManager : ShortcutManager,
- normalize_key : normalize_key,
- normalize_shortcut : normalize_shortcut,
- shortcut_to_event : shortcut_to_event,
- event_to_shortcut : event_to_shortcut,
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/outputarea',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/security',
- 'base/js/keyboard',
- 'base/js/markdown',
- 'services/config',
- ], function($, utils, i18n, security, keyboard, markdown, configmod) {
- "use strict";
- /**
- * @class OutputArea
- *
- * @constructor
- */
- var OutputArea = function (options) {
- this.config = options.config;
- this.selector = options.selector;
- this.events = options.events;
- this.keyboard_manager = options.keyboard_manager;
- this.wrapper = $(options.selector);
- this.outputs = [];
- this.collapsed = false;
- this.scrolled = false;
- this.scroll_state = 'auto';
- this.trusted = true;
- this.clear_queued = null;
- if (options.prompt_area === undefined) {
- this.prompt_area = true;
- } else {
- this.prompt_area = options.prompt_area;
- }
- this._display_id_targets = {};
- this.create_elements();
- this.style();
- this.bind_events();
- this.class_config = new configmod.ConfigWithDefaults(this.config,
- OutputArea.config_defaults, 'OutputArea');
- this.handle_appended = utils.throttle(this.handle_appended.bind(this));
- };
- OutputArea.config_defaults = {
- stream_chunk_size: 8192, // chunk size for stream output
- };
- /**
- * Class prototypes
- **/
- OutputArea.prototype.create_elements = function () {
- var element = this.element = $("<div/>");
- // wrap element in safe trigger,
- // so that errors (e.g. in widget extensions) are logged instead of
- // breaking everything.
- this.element._original_trigger = this.element.trigger;
- this.element.trigger = function (name, data) {
- try {
- this._original_trigger.apply(this, arguments);
- } catch (e) {
- console.error("Exception in event handler for " + name, e, arguments);
- }
- }
- this.collapse_button = $("<div/>");
- this.prompt_overlay = $("<div/>");
- this.wrapper.append(this.prompt_overlay);
- this.wrapper.append(this.element);
- this.wrapper.append(this.collapse_button);
- };
- OutputArea.prototype.style = function () {
- this.collapse_button.hide();
- if (!this.prompt_area) {
- this.prompt_overlay.hide();
- }
- this.wrapper.addClass('output_wrapper');
- this.element.addClass('output');
- this.collapse_button.addClass("btn btn-default output_collapsed");
- this.collapse_button.attr('title', i18n.msg._('click to expand output'));
- this.collapse_button.text('. . .');
- this.prompt_overlay.addClass('out_prompt_overlay prompt');
- this.prompt_overlay.attr('title', i18n.msg._('click to expand output; double click to hide output'));
- this.expand();
- };
- /**
- * Should the OutputArea scroll?
- * Returns whether the height (in lines) exceeds the current threshold.
- * Threshold will be OutputArea.minimum_scroll_threshold if scroll_state=true (manually requested)
- * or OutputArea.auto_scroll_threshold if scroll_state='auto'.
- * This will always return false if scroll_state=false (scroll disabled).
- *
- */
- OutputArea.prototype._should_scroll = function () {
- var threshold;
- if (this.scroll_state === false) {
- return false;
- } else if (this.scroll_state === true) {
- threshold = OutputArea.minimum_scroll_threshold;
- } else {
- threshold = OutputArea.auto_scroll_threshold;
- }
- if (threshold <=0) {
- return false;
- }
- // line-height from https://stackoverflow.com/questions/1185151
- var fontSize = this.element.css('font-size') || '14px';
- var lineHeight = Math.floor((parseFloat(fontSize.replace('px','')) || 14) * 1.3);
- return (this.element.height() > threshold * lineHeight);
- };
- OutputArea.prototype.bind_events = function () {
- var that = this;
- this.prompt_overlay.dblclick(function () { that.toggle_output(); });
- this.prompt_overlay.click(function () { that.toggle_scroll(); });
- this.element.on('resizeOutput', function () {
- // maybe scroll output,
- // if it's grown large enough and hasn't already been scrolled.
- if (!that.scrolled && that._should_scroll()) {
- that.scroll_area();
- }
- });
- this.collapse_button.click(function () {
- that.expand();
- });
- };
- OutputArea.prototype.collapse = function () {
- if (!this.collapsed) {
- this.element.hide();
- this.prompt_overlay.hide();
- if (this.element.html()){
- this.collapse_button.show();
- }
- this.collapsed = true;
- // collapsing output clears scroll state
- this.scroll_state = 'auto';
- }
- };
- OutputArea.prototype.expand = function () {
- if (this.collapsed) {
- this.collapse_button.hide();
- this.element.show();
- if (this.prompt_area) {
- this.prompt_overlay.show();
- }
- this.collapsed = false;
- this.scroll_if_long();
- }
- };
- OutputArea.prototype.toggle_output = function () {
- if (this.collapsed) {
- this.expand();
- } else {
- this.collapse();
- }
- };
- OutputArea.prototype.scroll_area = function () {
- this.element.addClass('output_scroll');
- this.prompt_overlay.attr('title', i18n.msg._('click to unscroll output; double click to hide'));
- this.scrolled = true;
- };
- OutputArea.prototype.unscroll_area = function () {
- this.element.removeClass('output_scroll');
- this.prompt_overlay.attr('title', i18n.msg._('click to scroll output; double click to hide'));
- this.scrolled = false;
- };
- /**
- * Scroll OutputArea if height exceeds a threshold.
- *
- * Threshold is OutputArea.minimum_scroll_threshold if scroll_state = true,
- * OutputArea.auto_scroll_threshold if scroll_state='auto'.
- *
- **/
- OutputArea.prototype.scroll_if_long = function () {
- var should_scroll = this._should_scroll();
- if (!this.scrolled && should_scroll) {
- // only allow scrolling long-enough output
- this.scroll_area();
- } else if (this.scrolled && !should_scroll) {
- // scrolled and shouldn't be
- this.unscroll_area();
- }
- };
- OutputArea.prototype.toggle_scroll = function () {
- if (this.scroll_state == 'auto') {
- this.scroll_state = !this.scrolled;
- } else {
- this.scroll_state = !this.scroll_state;
- }
- if (this.scrolled) {
- this.unscroll_area();
- } else {
- // only allow scrolling long-enough output
- this.scroll_if_long();
- }
- };
- // typeset with MathJax if MathJax is available
- OutputArea.prototype.typeset = function () {
- utils.typeset(this.element);
- };
- OutputArea.prototype.handle_output = function (msg) {
- var json = {};
- var msg_type = json.output_type = msg.header.msg_type;
- var content = msg.content;
- switch(msg_type) {
- case "stream" :
- json.text = content.text;
- json.name = content.name;
- break;
- case "execute_result":
- json.execution_count = content.execution_count;
- case "update_display_data":
- case "display_data":
- json.transient = content.transient;
- json.data = content.data;
- json.metadata = content.metadata;
- break;
- case "error":
- json.ename = content.ename;
- json.evalue = content.evalue;
- json.traceback = content.traceback;
- break;
- default:
- console.error("unhandled output message", msg);
- return;
- }
- this.append_output(json);
- };
- // Declare mime type as constants
- var MIME_JAVASCRIPT = 'application/javascript';
- var MIME_HTML = 'text/html';
- var MIME_MARKDOWN = 'text/markdown';
- var MIME_LATEX = 'text/latex';
- var MIME_SVG = 'image/svg+xml';
- var MIME_PNG = 'image/png';
- var MIME_JPEG = 'image/jpeg';
- var MIME_GIF = 'image/gif';
- var MIME_PDF = 'application/pdf';
- var MIME_TEXT = 'text/plain';
- OutputArea.output_types = [
- MIME_JAVASCRIPT,
- MIME_HTML,
- MIME_MARKDOWN,
- MIME_LATEX,
- MIME_SVG,
- MIME_PNG,
- MIME_JPEG,
- MIME_GIF,
- MIME_PDF,
- MIME_TEXT,
- ];
- OutputArea.prototype.validate_mimebundle = function (bundle) {
- /** scrub invalid outputs */
- if (typeof bundle.data !== 'object') {
- console.warn("mimebundle missing data", bundle);
- bundle.data = {};
- }
- if (typeof bundle.metadata !== 'object') {
- console.warn("mimebundle missing metadata", bundle);
- bundle.metadata = {};
- }
- var data = bundle.data;
- $.map(OutputArea.output_types, function(key){
- if ((key.indexOf('application/') === -1 || key.indexOf('json') === -1) &&
- data[key] !== undefined &&
- typeof data[key] !== 'string'
- ) {
- console.log("Invalid type for " + key, data[key]);
- delete data[key];
- }
- });
- return bundle;
- };
- OutputArea.prototype.append_output = function (json) {
- this.expand();
- if (this.clear_queued) {
- this.clear_output(false);
- this._needs_height_reset = true;
- }
- var record_output = true;
- switch(json.output_type) {
- case 'update_display_data':
- record_output = false;
- json = this.validate_mimebundle(json);
- this.update_display_data(json);
- return;
- case 'execute_result':
- json = this.validate_mimebundle(json);
- this.append_execute_result(json);
- break;
- case 'stream':
- // append_stream might have merged the output with earlier stream output
- record_output = this.append_stream(json);
- break;
- case 'error':
- this.append_error(json);
- break;
- case 'display_data':
- // append handled below
- json = this.validate_mimebundle(json);
- break;
- default:
- console.log("unrecognized output type: " + json.output_type);
- this.append_unrecognized(json);
- }
- if (json.output_type === 'display_data') {
- var that = this;
- this.append_display_data(json, this.handle_appended);
- } else {
- this.handle_appended();
- }
- if (record_output) {
- this.outputs.push(json);
- }
- this.events.trigger('output_added.OutputArea', {
- output: json,
- output_area: this,
- });
- };
- OutputArea.prototype.handle_appended = function () {
- if (this._needs_height_reset) {
- this.element.height('');
- this._needs_height_reset = false;
- }
- this.element.trigger('resizeOutput', {output_area: this});
- };
- OutputArea.prototype.create_output_area = function () {
- var oa = $("<div/>").addClass("output_area");
- if (this.prompt_area) {
- oa.append($('<div/>').addClass('run_this_cell'));
- oa.append($('<div/>').addClass('prompt'));
- }
- return oa;
- };
- function _get_metadata_key(metadata, key, mime) {
- var mime_md = metadata[mime];
- // mime-specific higher priority
- if (mime_md && mime_md[key] !== undefined) {
- return mime_md[key];
- }
- // fallback on global
- return metadata[key];
- }
- OutputArea.prototype.create_output_subarea = function(md, classes, mime) {
- var subarea = $('<div/>').addClass('output_subarea').addClass(classes);
- // Unforce RTL
- subarea.attr("dir","auto");
- if (_get_metadata_key(md, 'isolated', mime)) {
- // Create an iframe to isolate the subarea from the rest of the
- // document
- var iframe = $('<iframe/>').addClass('box-flex1');
- iframe.css({'height':1, 'width':'100%', 'display':'block'});
- iframe.attr('frameborder', 0);
- iframe.attr('scrolling', 'auto');
- // Once the iframe is loaded, the subarea is dynamically inserted
- iframe.on('load', function() {
- // Workaround needed by Firefox, to properly render svg inside
- // iframes, see https://stackoverflow.com/questions/10177190/
- // svg-dynamically-added-to-iframe-does-not-render-correctly
- this.contentDocument.open();
- // Insert the subarea into the iframe
- // We must directly write the html. When using Jquery's append
- // method, javascript is evaluated in the parent document and
- // not in the iframe document. At this point, subarea doesn't
- // contain any user content.
- this.contentDocument.write(subarea.html());
- this.contentDocument.close();
- var body = this.contentDocument.body;
- // Adjust the iframe height automatically
- iframe.height(body.scrollHeight + 'px');
- });
- // Elements should be appended to the inner subarea and not to the
- // iframe
- iframe.append = function(that) {
- subarea.append(that);
- };
- return iframe;
- } else {
- return subarea;
- }
- };
- OutputArea.prototype._append_javascript_error = function (err, element) {
- /**
- * display a message when a javascript error occurs in display output
- */
- var msg = i18n.msg._("Javascript error adding output!");
- if ( element === undefined ) return;
- element
- .append($('<div/>').text(msg).addClass('js-error'))
- .append($('<div/>').text(err.toString()).addClass('js-error'))
- .append($('<div/>').text(i18n.msg._('See your browser Javascript console for more details.')).addClass('js-error'));
- };
- OutputArea.prototype._safe_append = function (toinsert, toreplace) {
- /**
- * safely append an item to the document
- * this is an object created by user code,
- * and may have errors, which should not be raised
- * under any circumstances.
- */
- try {
- if (toreplace) {
- toreplace.replaceWith(toinsert);
- } else {
- this.element.append(toinsert);
- }
- } catch(err) {
- console.error(err);
- // Create an actual output_area and output_subarea, which creates
- // the prompt area and the proper indentation.
- toinsert = this.create_output_area();
- var subarea = $('<div/>').addClass('output_subarea');
- // Unforce RTL
- subarea.attr("dir","auto");
- toinsert.append(subarea);
- this._append_javascript_error(err, subarea);
- this.element.append(toinsert);
- }
- // Notify others of changes.
- this.element.trigger('changed', {output_area: this});
- };
- OutputArea.output_prompt_classical = function(prompt_value) {
- return $('<bdi>').text(i18n.msg.sprintf(i18n.msg._('Out[%s]:'),prompt_value));
- };
- OutputArea.output_prompt_function = OutputArea.output_prompt_classical;
- OutputArea.prototype.append_execute_result = function (json) {
- var n = json.execution_count || ' ';
- var toinsert = this.create_output_area();
- this._record_display_id(json, toinsert);
- if (this.prompt_area) {
- toinsert.find('div.prompt')
- .addClass('output_prompt')
- .empty()
- .append(OutputArea.output_prompt_function(n));
- }
- var inserted = this.append_mime_type(json, toinsert);
- if (inserted) {
- inserted.addClass('output_result');
- }
- this._safe_append(toinsert);
- // If we just output latex, typeset it.
- if ((json.data[MIME_LATEX] !== undefined) ||
- (json.data[MIME_HTML] !== undefined) ||
- (json.data[MIME_MARKDOWN] !== undefined)) {
- this.typeset();
- }
- };
- OutputArea.prototype.append_error = function (json) {
- var ename = json.ename;
- var evalue = json.evalue;
- var tb = json.traceback;
- var s = '';
- if (tb !== undefined && tb.length > 0) {
- var len = tb.length;
- for (var i=0; i<len; i++) {
- s = s + tb[i] + '\n';
- }
- s = s + '\n';
- } else if (ename !== undefined && ename.length > 0 && evalue !== undefined && evalue.length > 0) {
- // If traceback is empty, and we have ename and evalue entries, concatenate the two to display
- s = ename + ': ' + evalue;
- }
- if (s.length > 0) {
- var toinsert = this.create_output_area();
- var append_text = OutputArea.append_map[MIME_TEXT];
- if (append_text) {
- append_text.apply(this, [s, {}, toinsert]).addClass('output_error');
- }
- this._safe_append(toinsert);
- }
- };
- OutputArea.prototype.append_stream = function (json) {
- var text = json.text;
- if (typeof text !== 'string') {
- console.error("Stream output is invalid (missing text)", json);
- return false;
- }
- var subclass = "output_"+json.name;
- if (this.outputs.length > 0){
- // have at least one output to consider
- var last = this.outputs[this.outputs.length-1];
- if (last.output_type == 'stream' && json.name == last.name){
- if (last.text.length > this.class_config.get_sync('stream_chunk_size')) {
- // don't keep extending long blocks
- var last_newline_idx = last.text.lastIndexOf('\n');
- // if the last stream output doesn't end on a newline,
- // split on last newline and take the tail with the new output
- if (last_newline_idx !== -1 && last_newline_idx !== last.text.length - 1) {
- // truncate last.text to its last newline,
- // and take the tail with the new output.
- var tail = last.text.slice(last_newline_idx + 1);
- last.text = last.text.slice(0, last_newline_idx + 1);
- // we changed last's content, so we have to re-render it
- text = json.text = tail + json.text;
- var pre = this.element.find('div.'+subclass).last().find('pre');
- var html = utils.fixConsole(last.text);
- html = utils.autoLinkUrls(html);
- pre.html(html);
- }
- } else {
- // latest output was in the same stream,
- // so append to it instead of making a new output.
- // escape ANSI & HTML specials:
- last.text = utils.fixOverwrittenChars(last.text + json.text);
- var pre = this.element.find('div.'+subclass).last().find('pre');
- var html = utils.fixConsole(last.text);
- html = utils.autoLinkUrls(html);
- // The only user content injected with this HTML call is
- // escaped by the fixConsole() method.
- pre.html(html);
- // return false signals that we merged this output with the previous one,
- // and the new output shouldn't be recorded.
- return false;
- }
- }
- }
- if (!text.replace("\r", "")) {
- // text is nothing (empty string, \r, etc.)
- // so don't append any elements, which might add undesirable space
- // return true to indicate the output should be recorded.
- return true;
- }
- // If we got here, attach a new div
- var toinsert = this.create_output_area();
- var append_text = OutputArea.append_map[MIME_TEXT];
- if (append_text) {
- append_text.apply(this, [text, {}, toinsert]).addClass("output_stream " + subclass);
- }
- this._safe_append(toinsert);
- return true;
- };
- OutputArea.prototype.append_unrecognized = function (json) {
- var that = this;
- var toinsert = this.create_output_area();
- var subarea = $('<div/>').addClass('output_subarea output_unrecognized');
- // Unforce RTL
- subarea.attr("dir","auto");
- toinsert.append(subarea);
- subarea.append(
- $("<a>")
- .attr("href", "#")
- .text(i18n.msg.sprintf(i18n.msg._("Unrecognized output: %s"),json.output_type))
- .click(function () {
- that.events.trigger('unrecognized_output.OutputArea', {output: json});
- })
- );
- this._safe_append(toinsert);
- };
- OutputArea.prototype.update_display_data = function (json, handle_inserted) {
- var oa = this;
- var targets;
- var display_id = (json.transient || {}).display_id;
- if (!display_id) {
- console.warn("Handling update_display with no display_id", json);
- return;
- }
- targets = this._display_id_targets[display_id];
- if (!targets) {
- console.warn("No targets for display_id", display_id, json);
- return;
- }
- // we've seen it before, update output data
- targets.map(function (target) {
- oa.outputs[target.index].data = json.data;
- oa.outputs[target.index].metadata = json.metadata;
- var toinsert = oa.create_output_area();
- if (oa.append_mime_type(json, toinsert, handle_inserted)) {
- oa._safe_append(toinsert, target.element);
- }
- target.element = toinsert;
- });
- // If we just output something that could contain latex, typeset it.
- if ((json.data[MIME_LATEX] !== undefined) ||
- (json.data[MIME_HTML] !== undefined) ||
- (json.data[MIME_MARKDOWN] !== undefined)) {
- this.typeset();
- }
- this.events.trigger('output_updated.OutputArea', {
- output: json,
- output_area: this,
- });
- };
- OutputArea.prototype._record_display_id = function (json, element) {
- // record display_id of a display_data / execute_result
- var display_id = (json.transient || {}).display_id;
- if (!display_id) return;
- // it has a display_id;
- var targets = this._display_id_targets[display_id];
- if (!targets) {
- targets = this._display_id_targets[display_id] = [];
- }
- targets.push({
- index: this.outputs.length,
- element: element,
- });
- };
- OutputArea.prototype.append_display_data = function (json, handle_inserted) {
- var toinsert = this.create_output_area();
- this._record_display_id(json, toinsert);
- if (this.append_mime_type(json, toinsert, handle_inserted)) {
- this._safe_append(toinsert);
- // If we just output latex, typeset it.
- if ((json.data[MIME_LATEX] !== undefined) ||
- (json.data[MIME_HTML] !== undefined) ||
- (json.data[MIME_MARKDOWN] !== undefined)) {
- this.typeset();
- }
- }
- };
- OutputArea.safe_outputs = {};
- OutputArea.safe_outputs[MIME_TEXT] = true;
- OutputArea.safe_outputs[MIME_LATEX] = true;
- OutputArea.safe_outputs[MIME_PNG] = true;
- OutputArea.safe_outputs[MIME_JPEG] = true;
- OutputArea.safe_outputs[MIME_GIF] = true;
- OutputArea.prototype.append_mime_type = function (json, element, handle_inserted) {
- for (var i=0; i < OutputArea.display_order.length; i++) {
- var type = OutputArea.display_order[i];
- var append = OutputArea.append_map[type];
- if ((json.data[type] !== undefined) && append) {
- var md = json.metadata || {};
- var value = json.data[type];
- var toinsert;
- try {
- if (!this.trusted && !OutputArea.safe_outputs[type]) {
- // not trusted, sanitize HTML
- if (type===MIME_HTML || type==='text/svg') {
- var parsed = $(security.sanitize_html_and_parse(value));
- toinsert = append.apply(this, [parsed, md, element, handle_inserted]);
- } else {
- // don't display if we don't know how to sanitize it
- console.log("Ignoring untrusted " + type + " output.");
- continue;
- }
- } else {
- toinsert = append.apply(this, [value, md, element, handle_inserted]);
- }
- } catch (e) {
- console.error('Failed to render mimetype "' + type + '" with: ', e);
- continue;
- }
- // Since only the png and jpeg mime types call the inserted
- // callback, if the mime type is something other we must call the
- // inserted callback only when the element is actually inserted
- // into the DOM. Use a timeout of 0 to do this.
- if ([MIME_PNG, MIME_JPEG, MIME_GIF].indexOf(type) < 0 && handle_inserted !== undefined) {
- setTimeout(handle_inserted, 0);
- }
- this.events.trigger('output_appended.OutputArea', [type, value, md, toinsert]);
- return toinsert;
- }
- }
- return null;
- };
- var append_html = function (html, md, element) {
- var type = MIME_HTML;
- var toinsert = this.create_output_subarea(md, "output_html rendered_html", type);
- this.keyboard_manager.register_events(toinsert);
- toinsert.append(html);
- dblclick_to_reset_size(toinsert.find('img'));
- element.append(toinsert);
- return toinsert;
- };
- var append_markdown = function(text, md, element) {
- var type = MIME_MARKDOWN;
- var toinsert = this.create_output_subarea(md, "output_markdown rendered_html", type);
- markdown.render(text, {
- with_math: true,
- clean_tables: true
- }, function (err, html) {
- toinsert.append(html);
- });
- dblclick_to_reset_size(toinsert.find('img'));
- element.append(toinsert);
- return toinsert;
- };
- var append_javascript = function (js, md, element) {
- /**
- * We just eval the JS code, element appears in the local scope.
- */
- var type = MIME_JAVASCRIPT;
- var toinsert = this.create_output_subarea(md, "output_javascript rendered_html", type);
- this.keyboard_manager.register_events(toinsert);
- element.append(toinsert);
- // Fix for ipython/issues/5293, make sure `element` is the area which
- // output can be inserted into at the time of JS execution.
- element = toinsert;
- try {
- eval(js);
- } catch(err) {
- console.log(err);
- this._append_javascript_error(err, toinsert);
- }
- return toinsert;
- };
- var append_text = function (data, md, element) {
- var type = MIME_TEXT;
- var toinsert = this.create_output_subarea(md, "output_text", type);
- data = utils.fixOverwrittenChars(data);
- // escape ANSI & HTML specials in plaintext:
- data = utils.fixConsole(data);
- data = utils.autoLinkUrls(data);
- // The only user content injected with this HTML call is
- // escaped by the fixConsole() method.
- toinsert.append($("<pre/>").html(data));
- element.append(toinsert);
- return toinsert;
- };
- var append_svg = function (svg_html, md, element) {
- var type = MIME_SVG;
- var toinsert = this.create_output_subarea(md, "output_svg", type);
- // Get the svg element from within the HTML.
- // One svg is supposed, but could embed other nested svgs
- var svg = $($('<div \>').html(svg_html).find('svg')[0]);
- var svg_area = $('<div />');
- var width = svg.attr('width');
- var height = svg.attr('height');
- svg
- .width('100%')
- .height('100%');
- svg_area
- .width(width)
- .height(height);
- svg_area.append(svg);
- toinsert.append(svg_area);
- element.append(toinsert);
- return toinsert;
- };
- function dblclick_to_reset_size (img) {
- /**
- * Double-click on an image toggles confinement to notebook width
- *
- * img: jQuery element
- */
- img.dblclick(function () {
- // dblclick toggles *raw* size, disabling max-width confinement.
- if (img.hasClass('unconfined')) {
- img.removeClass('unconfined');
- } else {
- img.addClass('unconfined');
- }
- });
- }
- var set_width_height = function (img, md, mime) {
- /**
- * set width and height of an img element from metadata
- */
- var height = _get_metadata_key(md, 'height', mime);
- if (height !== undefined) img.attr('height', height);
- var width = _get_metadata_key(md, 'width', mime);
- if (width !== undefined) img.attr('width', width);
- if (_get_metadata_key(md, 'unconfined', mime)) {
- img.addClass('unconfined');
- }
- };
- OutputArea.prototype._append_img = function (src_type, md, element, handle_inserted, MIME, type_string) {
- var type = MIME;
- var toinsert = this.create_output_subarea(md, 'output_' + type_string, type);
- var img = $("<img/>");
- if (handle_inserted !== undefined) {
- img.on('load', function(){
- handle_inserted(img);
- });
- }
- img[0].src = 'data:image/' + type_string + ';base64,'+ src_type;
- set_width_height(img, md, type);
- dblclick_to_reset_size(img);
- toinsert.append(img);
- element.append(toinsert);
- return toinsert;
- };
- var append_png = function (png, md, element, handle_inserted) {
- return this._append_img(png, md, element, handle_inserted, MIME_PNG, 'png');
- };
- var append_jpeg = function (jpeg, md, element, handle_inserted) {
- return this._append_img(jpeg, md, element, handle_inserted, MIME_JPEG, 'jpeg');
- };
- var append_gif = function (gif, md, element, handle_inserted) {
- return this._append_img(gif, md, element, handle_inserted, MIME_GIF, 'gif');
- };
- var append_pdf = function (pdf, md, element) {
- var type = MIME_PDF;
- var toinsert = this.create_output_subarea(md, "output_pdf", type);
- var a = $('<a/>').attr('href', 'data:application/pdf;base64,'+pdf);
- a.attr('target', '_blank');
- a.text('View PDF');
- toinsert.append(a);
- element.append(toinsert);
- return toinsert;
- };
- var append_latex = function (latex, md, element) {
- /**
- * This method cannot do the typesetting because the latex first has to
- * be on the page.
- */
- var type = MIME_LATEX;
- var toinsert = this.create_output_subarea(md, "output_latex", type);
- toinsert.text(latex);
- element.append(toinsert);
- return toinsert;
- };
- OutputArea.prototype.append_raw_input = function (msg) {
- var that = this;
- this.expand();
- var content = msg.content;
- var area = this.create_output_area();
- // disable any other raw_inputs, if they are left around
- $("div.output_subarea.raw_input_container").remove();
- var input_type = content.password ? 'password' : 'text';
- area.append(
- $("<div/>")
- .addClass("box-flex1 output_subarea raw_input_container")
- .append(
- $("<pre/>")
- .addClass("raw_input_prompt")
- .html(utils.fixConsole(content.prompt))
- .append(
- $("<input/>")
- .addClass("raw_input")
- .attr('type', input_type)
- .attr("size", 47)
- .keydown(function (event, ui) {
- // make sure we submit on enter,
- // and don't re-execute the *cell* on shift-enter
- if (event.which === keyboard.keycodes.enter) {
- that._submit_raw_input();
- return false;
- }
- })
- )
- )
- .attr("dir","auto")
- );
- this.element.append(area);
- var raw_input = area.find('input.raw_input');
- // Register events that enable/disable the keyboard manager while raw
- // input is focused.
- this.keyboard_manager.register_events(raw_input);
- // Note, the following line used to read raw_input.focus().focus().
- // This seemed to be needed otherwise only the cell would be focused.
- // But with the modal UI, this seems to work fine with one call to focus().
- raw_input.focus();
- };
- OutputArea.prototype._submit_raw_input = function (evt) {
- var container = this.element.find("div.raw_input_container");
- var theprompt = container.find("pre.raw_input_prompt");
- var theinput = container.find("input.raw_input");
- var value = theinput.val();
- var echo = value;
- // don't echo if it's a password
- if (theinput.attr('type') == 'password') {
- echo = '········';
- }
- var content = {
- output_type : 'stream',
- name : 'stdout',
- text : theprompt.text() + echo + '\n'
- };
- // remove form container
- container.parent().remove();
- // replace with plaintext version in stdout
- this.append_output(content);
- this.events.trigger('send_input_reply.Kernel', value);
- };
- OutputArea.prototype.handle_clear_output = function (msg) {
- /**
- * msg spec v4 had stdout, stderr, display keys
- * v4.1 replaced these with just wait
- * The default behavior is the same (stdout=stderr=display=True, wait=False),
- * so v4 messages will still be properly handled,
- * except for the rarely used clearing less than all output.
- */
- this.clear_output(msg.content.wait || false);
- };
- OutputArea.prototype.clear_output = function(wait, ignore_clear_queue) {
- if (wait) {
- // If a clear is queued, clear before adding another to the queue.
- if (this.clear_queued) {
- this.clear_output(false);
- }
- this.clear_queued = true;
- } else {
- // Fix the output div's height if the clear_output is waiting for
- // new output (it is being used in an animation).
- if (!ignore_clear_queue && this.clear_queued) {
- // this.element.height() rounds the height, so we get the exact value
- var height = this.element[0].getBoundingClientRect().height;
- this.element.height(height);
- this.clear_queued = false;
- }
- // Clear all
- // Remove load event handlers from img tags because we don't want
- // them to fire if the image is never added to the page.
- this.element.find('img').off('load');
- this.element.trigger('clearing', {output_area: this});
- this.element.html("");
- // Notify others of changes.
- this.element.trigger('changed', {output_area: this});
- this.element.trigger('cleared', {output_area: this});
- this.outputs = [];
- this._display_id_targets = {};
- this.trusted = true;
- this.unscroll_area();
- this.expand();
- return;
- }
- };
- // JSON serialization
- OutputArea.prototype.fromJSON = function (outputs, metadata) {
- var len = outputs.length;
- metadata = metadata || {};
- for (var i=0; i<len; i++) {
- this.append_output(outputs[i]);
- }
- if (metadata.collapsed !== undefined) {
- if (metadata.collapsed) {
- this.collapse();
- } else {
- this.expand();
- }
- }
- if (metadata.scrolled !== undefined) {
- this.scroll_state = metadata.scrolled;
- if (metadata.scrolled) {
- this.scroll_if_long();
- } else {
- this.unscroll_area();
- }
- }
- };
- /**
- * Return for-saving version of outputs.
- * Excludes transient values.
- */
- OutputArea.prototype.toJSON = function () {
- return this.outputs.map(function (out) {
- var out2 = {};
- Object.keys(out).map(function (key) {
- if (key != 'transient') {
- out2[key] = out[key];
- }
- });
- return out2;
- });
- };
- /**
- * Class properties
- **/
- /**
- * Threshold to trigger autoscroll when the OutputArea is resized,
- * typically when new outputs are added.
- *
- * Behavior is undefined if autoscroll is lower than minimum_scroll_threshold,
- * unless it is < 0, in which case autoscroll will never be triggered
- *
- * @property auto_scroll_threshold
- * @type Number
- * @default 100
- *
- **/
- OutputArea.auto_scroll_threshold = 100;
- /**
- * Lower limit (in lines) for OutputArea to be made scrollable. OutputAreas
- * shorter than this are never scrolled.
- *
- * @property minimum_scroll_threshold
- * @type Number
- * @default 20
- *
- **/
- OutputArea.minimum_scroll_threshold = 20;
- OutputArea.display_order = [
- MIME_JAVASCRIPT,
- MIME_HTML,
- MIME_MARKDOWN,
- MIME_LATEX,
- MIME_SVG,
- MIME_PNG,
- MIME_JPEG,
- MIME_GIF,
- MIME_PDF,
- MIME_TEXT
- ];
- OutputArea.append_map = {};
- OutputArea.append_map[MIME_TEXT] = append_text;
- OutputArea.append_map[MIME_HTML] = append_html;
- OutputArea.append_map[MIME_MARKDOWN] = append_markdown;
- OutputArea.append_map[MIME_SVG] = append_svg;
- OutputArea.append_map[MIME_PNG] = append_png;
- OutputArea.append_map[MIME_JPEG] = append_jpeg;
- OutputArea.append_map[MIME_GIF] = append_gif;
- OutputArea.append_map[MIME_LATEX] = append_latex;
- OutputArea.append_map[MIME_JAVASCRIPT] = append_javascript;
- OutputArea.append_map[MIME_PDF] = append_pdf;
- OutputArea.prototype.mime_types = function () {
- return OutputArea.display_order;
- };
- OutputArea.prototype.register_mime_type = function (mimetype, append, options) {
- if (mimetype && typeof(append) === 'function') {
- OutputArea.output_types.push(mimetype);
- if (options.safe) OutputArea.safe_outputs[mimetype] = true;
- OutputArea.display_order.splice(options.index || 0, 0, mimetype);
- OutputArea.append_map[mimetype] = append;
- }
- };
- return {'OutputArea': OutputArea};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // highly adapted for codemiror jshint
- define('notebook/js/contexthint',['codemirror/lib/codemirror'], function(CodeMirror) {
- "use strict";
- var forEach = function(arr, f) {
- for (var i = 0, e = arr.length; i < e; ++i) f(arr[i]);
- };
- var arrayContains = function(arr, item) {
- if (!Array.prototype.indexOf) {
- var i = arr.length;
- while (i--) {
- if (arr[i] === item) {
- return true;
- }
- }
- return false;
- }
- return arr.indexOf(item) != -1;
- };
- CodeMirror.contextHint = function (editor) {
- // Find the token at the cursor
- var cur = editor.getCursor(),
- token = editor.getTokenAt(cur),
- tprop = token;
- // If it's not a 'word-style' token, ignore the token.
- // If it is a property, find out what it is a property of.
- var list = [];
- var clist = getCompletions(token, editor);
- for (var i = 0; i < clist.length; i++) {
- list.push({
- str: clist[i],
- type: "context",
- from: {
- line: cur.line,
- ch: token.start
- },
- to: {
- line: cur.line,
- ch: token.end
- }
- });
- }
- return list;
- };
- // find all 'words' of current cell
- var getAllTokens = function (editor) {
- var found = [];
- // add to found if not already in it
- function maybeAdd(str) {
- if (!arrayContains(found, str)) found.push(str);
- }
- // loop through all token on all lines
- var lineCount = editor.lineCount();
- // loop on line
- for (var l = 0; l < lineCount; l++) {
- var line = editor.getLine(l);
- //loop on char
- for (var c = 1; c < line.length; c++) {
- var tk = editor.getTokenAt({
- line: l,
- ch: c
- });
- // if token has a class, it has geat chances of beeing
- // of interest. Add it to the list of possible completions.
- // we could skip token of ClassName 'comment'
- // or 'number' and 'operator'
- if (tk.className !== null) {
- maybeAdd(tk.string);
- }
- // jump to char after end of current token
- c = tk.end;
- }
- }
- return found;
- };
- var getCompletions = function(token, editor) {
- var candidates = getAllTokens(editor);
- // filter all token that have a common start (but nox exactly) the length of the current token
- var lambda = function (x) {
- return (x.indexOf(token.string) === 0 && x != token.string);
- };
- var filterd = candidates.filter(lambda);
- return filterd;
- };
- return {'contextHint': CodeMirror.contextHint};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/completer',[
- 'jquery',
- 'base/js/utils',
- 'base/js/keyboard',
- 'notebook/js/contexthint',
- 'codemirror/lib/codemirror',
- ], function($, utils, keyboard, CodeMirror) {
- "use strict";
- // easier key mapping
- var keycodes = keyboard.keycodes;
- var prepend_n_prc = function(str, n) {
- for( var i =0 ; i< n ; i++){
- str = '%'+str ;
- }
- return str;
- };
- var _existing_completion = function(item, completion_array){
- for( var i=0; i < completion_array.length; i++) {
- if (completion_array[i].trim().substr(-item.length) == item) {
- return true;
- }
- }
- return false;
- };
- // what is the common start of all completions
- function shared_start(B, drop_prct) {
- if (B.length == 1) {
- return B[0];
- }
- var A = [];
- var common;
- var min_lead_prct = 10;
- for (var i = 0; i < B.length; i++) {
- var str = B[i].str;
- var localmin = 0;
- if(drop_prct === true){
- while ( str.substr(0, 1) == '%') {
- localmin = localmin+1;
- str = str.substring(1);
- }
- }
- min_lead_prct = Math.min(min_lead_prct, localmin);
- A.push(str);
- }
- if (A.length > 1) {
- var tem1, tem2, s;
- A = A.slice(0).sort();
- tem1 = A[0];
- s = tem1.length;
- tem2 = A.pop();
- while (s && tem2.indexOf(tem1) == -1) {
- tem1 = tem1.substring(0, --s);
- }
- if (tem1 === "" || tem2.indexOf(tem1) !== 0) {
- return {
- str:prepend_n_prc('', min_lead_prct),
- type: "computed",
- from: B[0].from,
- to: B[0].to
- };
- }
- return {
- str: prepend_n_prc(tem1, min_lead_prct),
- type: "computed",
- from: B[0].from,
- to: B[0].to
- };
- }
- return null;
- }
- var Completer = function (cell, events) {
- this.cell = cell;
- this.editor = cell.code_mirror;
- var that = this;
- events.on('kernel_busy.Kernel', function () {
- that.skip_kernel_completion = true;
- });
- events.on('kernel_idle.Kernel', function () {
- that.skip_kernel_completion = false;
- });
- };
- Completer.prototype.startCompletion = function () {
- /**
- * call for a 'first' completion, that will set the editor and do some
- * special behavior like autopicking if only one completion available.
- */
- if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) return;
- this.done = false;
- // use to get focus back on opera
- this.carry_on_completion(true);
- };
- // easy access for julia to monkeypatch
- //
- Completer.reinvoke_re = /[%0-9a-z._/\\:~-]/i;
- Completer.prototype.reinvoke= function(pre_cursor, block, cursor){
- return Completer.reinvoke_re.test(pre_cursor);
- };
- /**
- *
- * pass true as parameter if this is the first invocation of the completer
- * this will prevent the completer to dismiss itself if it is not on a
- * word boundary like pressing tab after a space, and make it autopick the
- * only choice if there is only one which prevent from popping the UI. as
- * well as fast-forwarding the typing if all completion have a common
- * shared start
- **/
- Completer.prototype.carry_on_completion = function (first_invocation) {
- /**
- * Pass true as parameter if you want the completer to autopick when
- * only one completion. This function is automatically reinvoked at
- * each keystroke with first_invocation = false
- */
- var cur = this.editor.getCursor();
- var line = this.editor.getLine(cur.line);
- var pre_cursor = this.editor.getRange({
- line: cur.line,
- ch: cur.ch - 1
- }, cur);
- // we need to check that we are still on a word boundary
- // because while typing the completer is still reinvoking itself
- // so dismiss if we are on a "bad" character
- if (!this.reinvoke(pre_cursor) && !first_invocation) {
- this.close();
- return;
- }
- this.autopick = false;
- if (first_invocation) {
- this.autopick = true;
- }
- // We want a single cursor position.
- if (this.editor.somethingSelected()|| this.editor.getSelections().length > 1) {
- return;
- }
- // one kernel completion came back, finish_completing will be called with the results
- // we fork here and directly call finish completing if kernel is busy
- var cursor_pos = this.editor.indexFromPos(cur);
- var text = this.editor.getValue();
- cursor_pos = utils.js_idx_to_char_idx(cursor_pos, text);
- if (this.skip_kernel_completion) {
- this.finish_completing({ content: {
- matches: [],
- cursor_start: cursor_pos,
- cursor_end: cursor_pos,
- }});
- } else {
- this.cell.kernel.complete(text, cursor_pos,
- $.proxy(this.finish_completing, this)
- );
- }
- };
- Completer.prototype.finish_completing = function (msg) {
- /**
- * let's build a function that wrap all that stuff into what is needed
- * for the new completer:
- */
- var content = msg.content;
- var start = content.cursor_start;
- var end = content.cursor_end;
- var matches = content.matches;
- console.log(content);
- var cur = this.editor.getCursor();
- if (end === null) {
- // adapted message spec replies don't have cursor position info,
- // interpret end=null as current position,
- // and negative start relative to that
- end = this.editor.indexFromPos(cur);
- if (start === null) {
- start = end;
- } else if (start < 0) {
- start = end + start;
- }
- } else {
- // handle surrogate pairs
- var text = this.editor.getValue();
- end = utils.char_idx_to_js_idx(end, text);
- start = utils.char_idx_to_js_idx(start, text);
- }
- var results = CodeMirror.contextHint(this.editor);
- var filtered_results = [];
- //remove results from context completion
- //that are already in kernel completion
- var i;
- for (i=0; i < results.length; i++) {
- if (!_existing_completion(results[i].str, matches)) {
- filtered_results.push(results[i]);
- }
- }
- // append the introspection result, in order, at at the beginning of
- // the table and compute the replacement range from current cursor
- // position and matched_text length.
- var from = this.editor.posFromIndex(start);
- var to = this.editor.posFromIndex(end);
- for (i = matches.length - 1; i >= 0; --i) {
- filtered_results.unshift({
- str: matches[i],
- type: "introspection",
- from: from,
- to: to
- });
- }
- // one the 2 sources results have been merge, deal with it
- this.raw_result = filtered_results;
- // if empty result return
- if (!this.raw_result || !this.raw_result.length) return;
- // When there is only one completion, use it directly.
- if (this.autopick && this.raw_result.length == 1) {
- this.insert(this.raw_result[0]);
- return;
- }
- if (this.raw_result.length == 1) {
- // test if first and only completion totally matches
- // what is typed, in this case dismiss
- var str = this.raw_result[0].str;
- var pre_cursor = this.editor.getRange({
- line: cur.line,
- ch: cur.ch - str.length
- }, cur);
- if (pre_cursor == str) {
- this.close();
- return;
- }
- }
- if (!this.visible) {
- this.complete = $('<div/>').addClass('completions');
- this.complete.attr('id', 'complete');
- // Currently webkit doesn't use the size attr correctly. See:
- // https://code.google.com/p/chromium/issues/detail?id=4579
- this.sel = $('<select/>')
- .attr('tabindex', -1)
- .attr('multiple', 'true');
- this.complete.append(this.sel);
- this.visible = true;
- $('body').append(this.complete);
- //build the container
- var that = this;
- this.sel.click(function () {
- that.pick();
- that.editor.focus();
- });
- this._handle_keydown = function (cm, event) {
- that.keydown(event);
- };
- this.editor.on('keydown', this._handle_keydown);
- this._handle_keypress = function (cm, event) {
- that.keypress(event);
- };
- this.editor.on('keypress', this._handle_keypress);
- }
- this.sel.attr('size', Math.min(10, this.raw_result.length));
- // After everything is on the page, compute the position.
- // We put it above the code if it is too close to the bottom of the page.
- var pos = this.editor.cursorCoords(
- this.editor.posFromIndex(start)
- );
- var left = pos.left-3;
- var top;
- var cheight = this.complete.height();
- var wheight = $(window).height();
- if (pos.bottom+cheight+5 > wheight) {
- top = pos.top-cheight-4;
- } else {
- top = pos.bottom+1;
- }
- this.complete.css('left', left + 'px');
- this.complete.css('top', top + 'px');
- // Clear and fill the list.
- this.sel.text('');
- this.build_gui_list(this.raw_result);
- return true;
- };
- Completer.prototype.insert = function (completion) {
- this.editor.replaceRange(completion.str, completion.from, completion.to);
- };
- Completer.prototype.build_gui_list = function (completions) {
- var MAXIMUM_GUI_LIST_LENGTH = 1000;
- for (var i = 0; i < completions.length && i < MAXIMUM_GUI_LIST_LENGTH; ++i) {
- var opt = $('<option/>').text(completions[i].str).addClass(completions[i].type);
- this.sel.append(opt);
- }
- this.sel.children().first().attr('selected', 'true');
- this.sel.scrollTop(0);
- };
- Completer.prototype.close = function () {
- this.done = true;
- $('#complete').remove();
- this.editor.off('keydown', this._handle_keydown);
- this.editor.off('keypress', this._handle_keypress);
- this.visible = false;
- };
- Completer.prototype.pick = function () {
- this.insert(this.raw_result[this.sel[0].selectedIndex]);
- this.close();
- };
- Completer.prototype.keydown = function (event) {
- var code = event.keyCode;
- // Enter
- var options;
- var index;
- if (code == keycodes.enter) {
- event.codemirrorIgnore = true;
- event._ipkmIgnore = true;
- event.preventDefault();
- this.pick();
- // Escape or backspace
- } else if (code == keycodes.esc || code == keycodes.backspace) {
- event.codemirrorIgnore = true;
- event._ipkmIgnore = true;
- event.preventDefault();
- this.close();
- } else if (code == keycodes.tab) {
- //all the fastforwarding operation,
- //Check that shared start is not null which can append with prefixed completion
- // like %pylab , pylab have no shared start, and ff will result in py<tab><tab>
- // to erase py
- var sh = shared_start(this.raw_result, true);
- if (sh.str !== '') {
- this.insert(sh);
- }
- this.close();
- this.carry_on_completion();
- } else if (code == keycodes.up || code == keycodes.down) {
- // need to do that to be able to move the arrow
- // when on the first or last line of a code cell
- event.codemirrorIgnore = true;
- event._ipkmIgnore = true;
- event.preventDefault();
- options = this.sel.find('option');
- index = this.sel[0].selectedIndex;
- if (code == keycodes.up) {
- index--;
- }
- if (code == keycodes.down) {
- index++;
- }
- index = Math.min(Math.max(index, 0), options.length-1);
- this.sel[0].selectedIndex = index;
- } else if (code == keycodes.pageup || code == keycodes.pagedown) {
- event.codemirrorIgnore = true;
- event._ipkmIgnore = true;
- options = this.sel.find('option');
- index = this.sel[0].selectedIndex;
- if (code == keycodes.pageup) {
- index -= 10; // As 10 is the hard coded size of the drop down menu
- } else {
- index += 10;
- }
- index = Math.min(Math.max(index, 0), options.length-1);
- this.sel[0].selectedIndex = index;
- } else if (code == keycodes.left || code == keycodes.right) {
- this.close();
- }
- };
- Completer.prototype.keypress = function (event) {
- /**
- * FIXME: This is a band-aid.
- * on keypress, trigger insertion of a single character.
- * This simulates the old behavior of completion as you type,
- * before events were disconnected and CodeMirror stopped
- * receiving events while the completer is focused.
- */
-
- var that = this;
- var code = event.keyCode;
-
- // don't handle keypress if it's not a character (arrows on FF)
- // or ENTER/TAB
- if (event.charCode === 0 ||
- code == keycodes.tab ||
- code == keycodes.enter
- ) return;
-
- this.close();
- this.editor.focus();
- setTimeout(function () {
- that.carry_on_completion();
- }, 50);
- };
- return {'Completer': Completer};
- });
- // IPython mode is just a slightly altered Python Mode with `?` beeing a extra
- // single operator. Here we define `ipython` mode in the require `python`
- // callback to auto-load python mode, which is more likely not the best things
- // to do, but at least the simple one for now.
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object"){ // CommonJS
- mod(requirejs("codemirror/lib/codemirror"),
- requirejs("codemirror/mode/python/python")
- );
- } else if (typeof define == "function" && define.amd){ // AMD
- define('notebook/js/codemirror-ipython',["codemirror/lib/codemirror",
- "codemirror/mode/python/python"], mod);
- } else {// Plain browser env
- mod(CodeMirror);
- }
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.defineMode("ipython", function(conf, parserConf) {
- var pythonConf = {};
- for (var prop in parserConf) {
- if (parserConf.hasOwnProperty(prop)) {
- pythonConf[prop] = parserConf[prop];
- }
- }
- pythonConf.name = 'python';
- pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]");
- if (pythonConf.version === 3) {
- pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*");
- } else if (pythonConf.version === 2) {
- pythonConf.identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*");
- }
- return CodeMirror.getMode(conf, pythonConf);
- }, 'python');
- CodeMirror.defineMIME("text/x-ipython", "ipython");
- })
- ;
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- /**
- *
- *
- * @module codecell
- * @namespace codecell
- * @class CodeCell
- */
- define('notebook/js/codecell',[
- 'jquery',
- 'base/js/namespace',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/keyboard',
- 'services/config',
- 'notebook/js/cell',
- 'notebook/js/outputarea',
- 'notebook/js/completer',
- 'notebook/js/celltoolbar',
- 'codemirror/lib/codemirror',
- 'codemirror/mode/python/python',
- 'notebook/js/codemirror-ipython'
- ], function(
- $,
- IPython,
- utils,
- i18n,
- keyboard,
- configmod,
- cell,
- outputarea,
- completer,
- celltoolbar,
- CodeMirror,
- cmpython,
- cmip
- ) {
- "use strict";
-
- var Cell = cell.Cell;
- /* local util for codemirror */
- var posEq = function(a, b) {return a.line === b.line && a.ch === b.ch;};
- /**
- *
- * function to delete until previous non blanking space character
- * or first multiple of 4 tabstop.
- * @private
- */
- CodeMirror.commands.delSpaceToPrevTabStop = function(cm){
- var tabSize = cm.getOption('tabSize');
- var ranges = cm.listSelections(); // handle multicursor
- for (var i = ranges.length - 1; i >= 0; i--) { // iterate reverse so any deletions don't overlap
- var head = ranges[i].head;
- var anchor = ranges[i].anchor;
- var sel = !posEq(head, anchor);
- if (sel) {
- // range is selection
- cm.replaceRange("", anchor, head);
- } else {
- // range is cursor
- var line = cm.getLine(head.line).substring(0, head.ch);
- if (line.match(/^\ +$/) !== null){
- // delete tabs
- var prevTabStop = (Math.ceil(head.ch/tabSize)-1)*tabSize;
- var from = CodeMirror.Pos(head.line, prevTabStop)
- cm.replaceRange("", from, head);
- } else {
- // delete normally
- var from = cm.findPosH(head, -1, 'char', false);
- cm.replaceRange("", from, head);
- }
- }
- }
- };
- var keycodes = keyboard.keycodes;
- var CodeCell = function (kernel, options) {
- /**
- * Constructor
- *
- * A Cell conceived to write code.
- *
- * Parameters:
- * kernel: Kernel instance
- * The kernel doesn't have to be set at creation time, in that case
- * it will be null and set_kernel has to be called later.
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * config: dictionary
- * keyboard_manager: KeyboardManager instance
- * notebook: Notebook instance
- * tooltip: Tooltip instance
- */
- this.kernel = kernel || null;
- this.notebook = options.notebook;
- this.collapsed = false;
- this.events = options.events;
- this.tooltip = options.tooltip;
- this.config = options.config;
- this.class_config = new configmod.ConfigWithDefaults(this.config,
- CodeCell.options_default, 'CodeCell');
- // create all attributed in constructor function
- // even if null for V8 VM optimisation
- this.input_prompt_number = null;
- this.celltoolbar = null;
- this.output_area = null;
- this.last_msg_id = null;
- this.completer = null;
- Cell.apply(this,[{
- config: options.config,
- keyboard_manager: options.keyboard_manager,
- events: this.events}]);
- // Attributes we want to override in this subclass.
- this.cell_type = "code";
- var that = this;
- this.element.focusout(
- function() { that.auto_highlight(); }
- );
- };
- CodeCell.options_default = {
- cm_config : {
- extraKeys: {
- "Backspace" : "delSpaceToPrevTabStop",
- },
- mode: 'text',
- theme: 'ipython',
- matchBrackets: true,
- autoCloseBrackets: true
- },
- highlight_modes : {
- 'magic_javascript' :{'reg':['^%%javascript']},
- 'magic_perl' :{'reg':['^%%perl']},
- 'magic_ruby' :{'reg':['^%%ruby']},
- 'magic_python' :{'reg':['^%%python3?']},
- 'magic_shell' :{'reg':['^%%bash']},
- 'magic_r' :{'reg':['^%%R']},
- 'magic_text/x-cython' :{'reg':['^%%cython']},
- },
- };
- CodeCell.msg_cells = {};
- CodeCell.prototype = Object.create(Cell.prototype);
-
- /** @method create_element */
- CodeCell.prototype.create_element = function () {
- Cell.prototype.create_element.apply(this, arguments);
- var that = this;
- var cell = $('<div></div>').addClass('cell code_cell');
- cell.attr('tabindex','2');
- var input = $('<div></div>').addClass('input');
- this.input = input;
- var prompt_container = $('<div/>').addClass('prompt_container');
- var run_this_cell = $('<div></div>').addClass('run_this_cell');
- run_this_cell.prop('title', 'Run this cell');
- run_this_cell.append('<i class="fa-step-forward fa"></i>');
- run_this_cell.click(function (event) {
- event.stopImmediatePropagation();
- that.execute();
- });
- var prompt = $('<div/>').addClass('prompt input_prompt');
-
- var inner_cell = $('<div/>').addClass('inner_cell');
- this.celltoolbar = new celltoolbar.CellToolbar({
- cell: this,
- notebook: this.notebook});
- inner_cell.append(this.celltoolbar.element);
- var input_area = $('<div/>').addClass('input_area').attr("aria-label", i18n.msg._("Edit code here"));
- this.code_mirror = new CodeMirror(input_area.get(0), this._options.cm_config);
- // In case of bugs that put the keyboard manager into an inconsistent state,
- // ensure KM is enabled when CodeMirror is focused:
- this.code_mirror.on('focus', function () {
- if (that.keyboard_manager) {
- that.keyboard_manager.enable();
- }
- that.code_mirror.setOption('readOnly', !that.is_editable());
- });
- this.code_mirror.on('keydown', $.proxy(this.handle_keyevent,this));
- $(this.code_mirror.getInputField()).attr("spellcheck", "false");
- inner_cell.append(input_area);
- prompt_container.append(prompt).append(run_this_cell);
- input.append(prompt_container).append(inner_cell);
- var output = $('<div></div>');
- cell.append(input).append(output);
- this.element = cell;
- this.output_area = new outputarea.OutputArea({
- config: this.config,
- selector: output,
- prompt_area: true,
- events: this.events,
- keyboard_manager: this.keyboard_manager,
- });
- this.completer = new completer.Completer(this, this.events);
- };
- /** @method bind_events */
- CodeCell.prototype.bind_events = function () {
- Cell.prototype.bind_events.apply(this, arguments);
- var that = this;
- this.element.focusout(
- function() { that.auto_highlight(); }
- );
- this.events.on('kernel_restarting.Kernel', function() {
- if (that.input_prompt_number === '*') {
- that.set_input_prompt();
- }
- });
- };
- /**
- * This method gets called in CodeMirror's onKeyDown/onKeyPress
- * handlers and is used to provide custom key handling. Its return
- * value is used to determine if CodeMirror should ignore the event:
- * true = ignore, false = don't ignore.
- * @method handle_codemirror_keyevent
- */
- CodeCell.prototype.handle_codemirror_keyevent = function (editor, event) {
- var that = this;
- // whatever key is pressed, first, cancel the tooltip request before
- // they are sent, and remove tooltip if any, except for tab again
- var tooltip_closed = null;
- if (event.type === 'keydown' && event.which !== keycodes.tab ) {
- tooltip_closed = this.tooltip.remove_and_cancel_tooltip();
- }
- var cur = editor.getCursor();
- if (event.keyCode === keycodes.enter){
- this.auto_highlight();
- }
- if (event.which === keycodes.down && event.type === 'keypress' && this.tooltip.time_before_tooltip >= 0) {
- // triger on keypress (!) otherwise inconsistent event.which depending on platform
- // browser and keyboard layout !
- // Pressing '(' , request tooltip, don't forget to reappend it
- // The second argument says to hide the tooltip if the docstring
- // is actually empty
- this.tooltip.pending(that, true);
- } else if ( tooltip_closed && event.which === keycodes.esc && event.type === 'keydown') {
- // If tooltip is active, cancel it. The call to
- // remove_and_cancel_tooltip above doesn't pass, force=true.
- // Because of this it won't actually close the tooltip
- // if it is in sticky mode. Thus, we have to check again if it is open
- // and close it with force=true.
- if (!this.tooltip._hidden) {
- this.tooltip.remove_and_cancel_tooltip(true);
- }
- // If we closed the tooltip, don't let CM or the global handlers
- // handle this event.
- event.codemirrorIgnore = true;
- event._ipkmIgnore = true;
- event.preventDefault();
- return true;
- } else if (event.keyCode === keycodes.tab && event.type === 'keydown' && event.shiftKey) {
- if (editor.somethingSelected() || editor.getSelections().length !== 1){
- var anchor = editor.getCursor("anchor");
- var head = editor.getCursor("head");
- if( anchor.line !== head.line){
- return false;
- }
- }
- var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
- if (pre_cursor.trim() === "") {
- // Don't show tooltip if the part of the line before the cursor
- // is empty. In this case, let CodeMirror handle indentation.
- return false;
- }
- this.tooltip.request(that);
- event.codemirrorIgnore = true;
- event.preventDefault();
- return true;
- } else if (event.keyCode === keycodes.tab && event.type === 'keydown') {
- // Tab completion.
- this.tooltip.remove_and_cancel_tooltip();
- // completion does not work on multicursor, it might be possible though in some cases
- if (editor.somethingSelected() || editor.getSelections().length > 1) {
- return false;
- }
- var pre_cursor = editor.getRange({line:cur.line,ch:0},cur);
- if (pre_cursor.trim() === "") {
- // Don't autocomplete if the part of the line before the cursor
- // is empty. In this case, let CodeMirror handle indentation.
- return false;
- } else {
- event.codemirrorIgnore = true;
- event.preventDefault();
- this.completer.startCompletion();
- return true;
- }
- }
-
- // keyboard event wasn't one of those unique to code cells, let's see
- // if it's one of the generic ones (i.e. check edit mode shortcuts)
- return Cell.prototype.handle_codemirror_keyevent.apply(this, [editor, event]);
- };
- // Kernel related calls.
- CodeCell.prototype.set_kernel = function (kernel) {
- this.kernel = kernel;
- };
- /**
- * Execute current code cell to the kernel
- * @method execute
- */
- CodeCell.prototype.execute = function (stop_on_error) {
- if (!this.kernel) {
- console.log(i18n.msg._("Can't execute cell since kernel is not set."));
- return;
- }
- if (stop_on_error === undefined) {
- if (this.metadata !== undefined &&
- this.metadata.tags !== undefined) {
- if (this.metadata.tags.indexOf('raises-exception') !== -1) {
- stop_on_error = false;
- } else {
- stop_on_error = true;
- }
- } else {
- stop_on_error = true;
- }
- }
- this.clear_output(false, true);
- var old_msg_id = this.last_msg_id;
- if (old_msg_id) {
- this.kernel.clear_callbacks_for_msg(old_msg_id);
- delete CodeCell.msg_cells[old_msg_id];
- this.last_msg_id = null;
- }
- if (this.get_text().trim().length === 0) {
- // nothing to do
- this.set_input_prompt(null);
- return;
- }
- this.set_input_prompt('*');
- this.element.addClass("running");
- var callbacks = this.get_callbacks();
-
- this.last_msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false, store_history: true,
- stop_on_error : stop_on_error});
- CodeCell.msg_cells[this.last_msg_id] = this;
- this.render();
- this.events.trigger('execute.CodeCell', {cell: this});
- var that = this;
- function handleFinished(evt, data) {
- if (that.kernel.id === data.kernel.id && that.last_msg_id === data.msg_id) {
- that.events.trigger('finished_execute.CodeCell', {cell: that});
- that.events.off('finished_iopub.Kernel', handleFinished);
- }
- }
- this.events.on('finished_iopub.Kernel', handleFinished);
- };
-
- /**
- * Construct the default callbacks for
- * @method get_callbacks
- */
- CodeCell.prototype.get_callbacks = function () {
- var that = this;
- return {
- clear_on_done: false,
- shell : {
- reply : $.proxy(this._handle_execute_reply, this),
- payload : {
- set_next_input : $.proxy(this._handle_set_next_input, this),
- page : $.proxy(this._open_with_pager, this)
- }
- },
- iopub : {
- output : function() {
- that.events.trigger('set_dirty.Notebook', {value: true});
- that.output_area.handle_output.apply(that.output_area, arguments);
- },
- clear_output : function() {
- that.events.trigger('set_dirty.Notebook', {value: true});
- that.output_area.handle_clear_output.apply(that.output_area, arguments);
- },
- },
- input : $.proxy(this._handle_input_request, this),
- };
- };
-
- CodeCell.prototype._open_with_pager = function (payload) {
- this.events.trigger('open_with_text.Pager', payload);
- };
- /**
- * @method _handle_execute_reply
- * @private
- */
- CodeCell.prototype._handle_execute_reply = function (msg) {
- this.set_input_prompt(msg.content.execution_count);
- this.element.removeClass("running");
- this.events.trigger('set_dirty.Notebook', {value: true});
- };
- /**
- * @method _handle_set_next_input
- * @private
- */
- CodeCell.prototype._handle_set_next_input = function (payload) {
- var data = {
- cell: this,
- text: payload.text,
- replace: payload.replace,
- clear_output: payload.clear_output,
- };
- this.events.trigger('set_next_input.Notebook', data);
- };
- /**
- * @method _handle_input_request
- * @private
- */
- CodeCell.prototype._handle_input_request = function (msg) {
- this.output_area.append_raw_input(msg);
- };
- // Basic cell manipulation.
- CodeCell.prototype.select = function () {
- var cont = Cell.prototype.select.apply(this, arguments);
- if (cont) {
- this.code_mirror.refresh();
- this.auto_highlight();
- }
- return cont;
- };
- CodeCell.prototype.render = function () {
- var cont = Cell.prototype.render.apply(this, arguments);
- // Always execute, even if we are already in the rendered state
- return cont;
- };
-
- CodeCell.prototype.select_all = function () {
- var start = {line: 0, ch: 0};
- var nlines = this.code_mirror.lineCount();
- var last_line = this.code_mirror.getLine(nlines-1);
- var end = {line: nlines-1, ch: last_line.length};
- this.code_mirror.setSelection(start, end);
- };
- CodeCell.prototype.collapse_output = function () {
- this.output_area.collapse();
- };
- CodeCell.prototype.expand_output = function () {
- this.output_area.expand();
- this.output_area.unscroll_area();
- };
- CodeCell.prototype.scroll_output = function () {
- this.output_area.expand();
- this.output_area.scroll_if_long();
- };
- CodeCell.prototype.toggle_output = function () {
- this.output_area.toggle_output();
- };
- CodeCell.prototype.toggle_output_scroll = function () {
- this.output_area.toggle_scroll();
- };
- CodeCell.input_prompt_classical = function (prompt_value, lines_number) {
- var ns;
- if (prompt_value === undefined || prompt_value === null) {
- ns = " ";
- } else {
- ns = encodeURIComponent(prompt_value);
- }
- return '<bdi>'+i18n.msg._('In')+'</bdi> [' + ns + ']:';
- };
- CodeCell.input_prompt_continuation = function (prompt_value, lines_number) {
- var html = [CodeCell.input_prompt_classical(prompt_value, lines_number)];
- for(var i=1; i < lines_number; i++) {
- html.push(['...:']);
- }
- return html.join('<br/>');
- };
- CodeCell.input_prompt_function = CodeCell.input_prompt_classical;
- CodeCell.prototype.set_input_prompt = function (number) {
- var nline = 1;
- if (this.code_mirror !== undefined) {
- nline = this.code_mirror.lineCount();
- }
- this.input_prompt_number = number;
- var prompt_html = CodeCell.input_prompt_function(this.input_prompt_number, nline);
- // This HTML call is okay because the user contents are escaped.
- this.element.find('div.input_prompt').html(prompt_html);
- this.events.trigger('set_dirty.Notebook', {value: true});
- };
- CodeCell.prototype.clear_input = function () {
- this.code_mirror.setValue('');
- };
- CodeCell.prototype.get_text = function () {
- return this.code_mirror.getValue();
- };
- CodeCell.prototype.set_text = function (code) {
- return this.code_mirror.setValue(code);
- };
- CodeCell.prototype.clear_output = function (wait, ignore_queue) {
- this.events.trigger('clear_output.CodeCell', {cell: this});
- this.output_area.clear_output(wait, ignore_queue);
- this.set_input_prompt();
- };
- // JSON serialization
- CodeCell.prototype.fromJSON = function (data) {
- Cell.prototype.fromJSON.apply(this, arguments);
- if (data.cell_type === 'code') {
- if (data.source !== undefined) {
- this.set_text(data.source);
- // make this value the starting point, so that we can only undo
- // to this state, instead of a blank cell
- this.code_mirror.clearHistory();
- this.auto_highlight();
- }
- this.set_input_prompt(data.execution_count);
- this.output_area.trusted = data.metadata.trusted || false;
- this.output_area.fromJSON(data.outputs, data.metadata);
- }
- };
- CodeCell.prototype.toJSON = function () {
- var data = Cell.prototype.toJSON.apply(this);
- data.source = this.get_text();
- // is finite protect against undefined and '*' value
- if (isFinite(this.input_prompt_number)) {
- data.execution_count = this.input_prompt_number;
- } else {
- data.execution_count = null;
- }
- var outputs = this.output_area.toJSON();
- data.outputs = outputs;
- data.metadata.trusted = this.output_area.trusted;
- if (this.output_area.collapsed) {
- data.metadata.collapsed = this.output_area.collapsed;
- } else {
- delete data.metadata.collapsed;
- }
- if (this.output_area.scroll_state === 'auto') {
- delete data.metadata.scrolled;
- } else {
- data.metadata.scrolled = this.output_area.scroll_state;
- }
- return data;
- };
- /**
- * handle cell level logic when the cell is unselected
- * @method unselect
- * @return is the action being taken
- */
- CodeCell.prototype.unselect = function() {
- var cont = Cell.prototype.unselect.apply(this, arguments);
- if (cont) {
- // When a code cell is unselected, make sure that the corresponding
- // tooltip and completer to that cell is closed.
- this.tooltip.remove_and_cancel_tooltip(true);
- if (this.completer !== null) {
- this.completer.close();
- }
- }
- return cont;
- };
- // Backwards compatibility.
- IPython.CodeCell = CodeCell;
- return {'CodeCell': CodeCell};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('services/kernels/comm',[
- 'jquery',
- 'base/js/utils',
- ], function($, utils) {
- "use strict";
- //-----------------------------------------------------------------------
- // CommManager class
- //-----------------------------------------------------------------------
-
- var CommManager = function (kernel) {
- this.comms = {};
- this.targets = {};
- if (kernel !== undefined) {
- this.init_kernel(kernel);
- }
- };
-
- CommManager.prototype.init_kernel = function (kernel) {
- /**
- * connect the kernel, and register message handlers
- */
- this.kernel = kernel;
- var msg_types = ['comm_open', 'comm_msg', 'comm_close'];
- for (var i = 0; i < msg_types.length; i++) {
- var msg_type = msg_types[i];
- kernel.register_iopub_handler(msg_type, $.proxy(this[msg_type], this));
- }
- };
- CommManager.prototype.new_comm = function (target_name, data, callbacks, metadata, comm_id, buffers) {
- /**
- * Create a new Comm, register it, and open its Kernel-side counterpart
- * Mimics the auto-registration in `Comm.__init__` in the Jupyter Comm.
- *
- * argument comm_id is optional
- */
- var comm = new Comm(target_name, comm_id);
- this.register_comm(comm);
- comm.open(data, callbacks, metadata, buffers);
- return comm;
- };
-
- CommManager.prototype.register_target = function (target_name, f) {
- /**
- * Register a target function for a given target name
- */
- this.targets[target_name] = f;
- };
-
- CommManager.prototype.unregister_target = function (target_name, f) {
- /**
- * Unregister a target function for a given target name
- */
- delete this.targets[target_name];
- };
-
- CommManager.prototype.register_comm = function (comm) {
- /**
- * Register a comm in the mapping
- */
- this.comms[comm.comm_id] = Promise.resolve(comm);
- comm.kernel = this.kernel;
- return comm.comm_id;
- };
-
- CommManager.prototype.unregister_comm = function (comm) {
- /**
- * Remove a comm from the mapping
- */
- delete this.comms[comm.comm_id];
- };
-
- // comm message handlers
-
- CommManager.prototype.comm_open = function (msg) {
- var content = msg.content;
- var that = this;
- var comm_id = content.comm_id;
- this.comms[comm_id] = utils.load_class(content.target_name, content.target_module,
- this.targets).then(function(target) {
- var comm = new Comm(content.target_name, comm_id);
- comm.kernel = that.kernel;
- try {
- var response = target(comm, msg);
- } catch (e) {
- comm.close();
- that.unregister_comm(comm);
- var wrapped_error = new utils.WrappedError("Exception opening new comm", e);
- console.error(wrapped_error);
- return Promise.reject(wrapped_error);
- }
- // Regardless of the target return value, we need to
- // then return the comm
- return Promise.resolve(response).then(function() {return comm;});
- }, utils.reject('Could not open comm', true));
- return this.comms[comm_id];
- };
-
- CommManager.prototype.comm_close = function(msg) {
- var content = msg.content;
- if (this.comms[content.comm_id] === undefined) {
- console.error('Comm promise not found for comm id ' + content.comm_id);
- return;
- }
- var that = this;
- this.comms[content.comm_id] = this.comms[content.comm_id].then(function(comm) {
- that.unregister_comm(comm);
- try {
- comm.handle_close(msg);
- } catch (e) {
- console.log("Exception closing comm: ", e, e.stack, msg);
- }
- // don't return a comm, so that further .then() functions
- // get an undefined comm input
- });
- return this.comms[content.comm_id];
- };
-
- CommManager.prototype.comm_msg = function(msg) {
- var content = msg.content;
- if (this.comms[content.comm_id] === undefined) {
- console.error('Comm promise not found for comm id ' + content.comm_id);
- return;
- }
- this.comms[content.comm_id] = this.comms[content.comm_id].then(function(comm) {
- return (Promise.resolve(comm.handle_msg(msg))
- .catch(utils.reject('Exception handling comm message'))
- .then(function() {return comm;}));
- });
- return this.comms[content.comm_id];
- };
-
- //-----------------------------------------------------------------------
- // Comm base class
- //-----------------------------------------------------------------------
-
- var Comm = function (target_name, comm_id) {
- this.target_name = target_name;
- this.comm_id = comm_id || utils.uuid();
- this._msg_callback = this._close_callback = null;
- };
-
- // methods for sending messages
- Comm.prototype.open = function (data, callbacks, metadata, buffers) {
- var content = {
- comm_id : this.comm_id,
- target_name : this.target_name,
- data : data || {},
- };
- return this.kernel.send_shell_message("comm_open", content, callbacks, metadata, buffers);
- };
-
- Comm.prototype.send = function (data, callbacks, metadata, buffers) {
- var content = {
- comm_id : this.comm_id,
- data : data || {},
- };
- return this.kernel.send_shell_message("comm_msg", content, callbacks, metadata, buffers);
- };
- Comm.prototype.close = function (data, callbacks, metadata, buffers) {
- var content = {
- comm_id : this.comm_id,
- data : data || {},
- };
- return this.kernel.send_shell_message("comm_close", content, callbacks, metadata, buffers);
- };
-
- // methods for registering callbacks for incoming messages
- Comm.prototype._register_callback = function (key, callback) {
- this['_' + key + '_callback'] = callback;
- };
-
- Comm.prototype.on_msg = function (callback) {
- this._register_callback('msg', callback);
- };
-
- Comm.prototype.on_close = function (callback) {
- this._register_callback('close', callback);
- };
-
- // methods for handling incoming messages
-
- Comm.prototype._callback = function (key, msg) {
- var callback = this['_' + key + '_callback'];
- if (callback) {
- try {
- return callback(msg);
- } catch (e) {
- console.log("Exception in Comm callback", e, e.stack, msg);
- }
- }
- };
-
- Comm.prototype.handle_msg = function (msg) {
- return this._callback('msg', msg);
- };
-
- Comm.prototype.handle_close = function (msg) {
- this._callback('close', msg);
- };
-
- return {
- 'CommManager': CommManager,
- 'Comm': Comm
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('services/kernels/serialize',[
- 'underscore',
- ], function (_) {
- "use strict";
-
- var _deserialize_array_buffer = function (buf) {
- var data = new DataView(buf);
- // read the header: 1 + nbufs 32b integers
- var nbufs = data.getUint32(0);
- var offsets = [];
- var i;
- for (i = 1; i <= nbufs; i++) {
- offsets.push(data.getUint32(i * 4));
- }
- var json_bytes = new Uint8Array(buf.slice(offsets[0], offsets[1]));
- var msg = JSON.parse(
- (new TextDecoder('utf8')).decode(json_bytes)
- );
- // the remaining chunks are stored as DataViews in msg.buffers
- msg.buffers = [];
- var start, stop;
- for (i = 1; i < nbufs; i++) {
- start = offsets[i];
- stop = offsets[i+1] || buf.byteLength;
- msg.buffers.push(new DataView(buf.slice(start, stop)));
- }
- return msg;
- };
-
- var _deserialize_binary = function(data) {
- /**
- * deserialize the binary message format
- * callback will be called with a message whose buffers attribute
- * will be an array of DataViews.
- */
- if (data instanceof Blob) {
- // data is Blob, have to deserialize from ArrayBuffer in reader callback
- var reader = new FileReader();
- var promise = new Promise(function(resolve, reject) {
- reader.onload = function () {
- var msg = _deserialize_array_buffer(this.result);
- resolve(msg);
- };
- });
- reader.readAsArrayBuffer(data);
- return promise;
- } else {
- // data is ArrayBuffer, can deserialize directly
- var msg = _deserialize_array_buffer(data);
- return msg;
- }
- };
- var deserialize = function (data) {
- /**
- * deserialize a message and return a promise for the unpacked message
- */
- if (typeof data === "string") {
- // text JSON message
- return Promise.resolve(JSON.parse(data));
- } else {
- // binary message
- return Promise.resolve(_deserialize_binary(data));
- }
- };
-
- var _serialize_binary = function (msg) {
- /**
- * implement the binary serialization protocol
- * serializes JSON message to ArrayBuffer
- */
- msg = _.clone(msg);
- var offsets = [];
- var buffers = [];
- var i;
- for (i = 0; i < msg.buffers.length; i++) {
- // msg.buffers elements could be either views or ArrayBuffers
- // buffers elements are ArrayBuffers
- var b = msg.buffers[i];
- buffers.push(b.buffer instanceof ArrayBuffer ? b.buffer : b);
- }
- delete msg.buffers;
- var json_utf8 = (new TextEncoder('utf8')).encode(JSON.stringify(msg));
- buffers.unshift(json_utf8);
- var nbufs = buffers.length;
- offsets.push(4 * (nbufs + 1));
- for (i = 0; i + 1 < buffers.length; i++) {
- offsets.push(offsets[offsets.length-1] + buffers[i].byteLength);
- }
- var msg_buf = new Uint8Array(
- offsets[offsets.length-1] + buffers[buffers.length-1].byteLength
- );
- // use DataView.setUint32 for network byte-order
- var view = new DataView(msg_buf.buffer);
- // write nbufs to first 4 bytes
- view.setUint32(0, nbufs);
- // write offsets to next 4 * nbufs bytes
- for (i = 0; i < offsets.length; i++) {
- view.setUint32(4 * (i+1), offsets[i]);
- }
- // write all the buffers at their respective offsets
- for (i = 0; i < buffers.length; i++) {
- msg_buf.set(new Uint8Array(buffers[i]), offsets[i]);
- }
-
- // return raw ArrayBuffer
- return msg_buf.buffer;
- };
-
- var serialize = function (msg) {
- if (msg.buffers && msg.buffers.length) {
- return _serialize_binary(msg);
- } else {
- return JSON.stringify(msg);
- }
- };
-
- var exports = {
- deserialize : deserialize,
- serialize: serialize
- };
- return exports;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('services/kernels/kernel',[
- 'jquery',
- 'base/js/utils',
- './comm',
- './serialize',
- 'base/js/events'
- ], function($, utils, comm, serialize, events) {
- "use strict";
- /**
- * A Kernel class to communicate with the Python kernel. This
- * should generally not be constructed directly, but be created
- * by. the `Session` object. Once created, this object should be
- * used to communicate with the kernel.
- *
- * Preliminary documentation for the REST API is at
- * https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping#kernels-api
- *
- * Documentation for the messaging specifications is at
- * https://jupyter-client.readthedocs.io/en/stable/messaging.html
- *
- * @class Kernel
- * @param {string} kernel_service_url - the URL to access the kernel REST api
- * @param {string} ws_url - the websockets URL
- * @param {string} name - the kernel type (e.g. python3)
- */
- var Kernel = function (kernel_service_url, ws_url, name) {
- this.events = events;
- this.id = null;
- this.name = name;
- this.ws = null;
- this._stopping = false;
- this.kernel_service_url = kernel_service_url;
- this.kernel_url = null;
- this.ws_url = ws_url || utils.get_body_data("wsUrl");
- if (!this.ws_url) {
- // trailing 's' in https will become wss for secure web sockets
- this.ws_url = location.protocol.replace('http', 'ws') + "//" + location.host;
- }
- this.username = "username";
- this.session_id = utils.uuid();
- this._msg_callbacks = {};
- this._msg_callbacks_overrides = {};
- this._display_id_to_parent_ids = {};
- this._msg_queue = Promise.resolve();
- this.info_reply = {}; // kernel_info_reply stored here after starting
- if (typeof(WebSocket) !== 'undefined') {
- this.WebSocket = WebSocket;
- } else if (typeof(MozWebSocket) !== 'undefined') {
- this.WebSocket = MozWebSocket;
- } else {
- alert('Your browser does not have WebSocket support, please try Chrome, Safari or Firefox ≥ 6. Firefox 4 and 5 are also supported by you have to enable WebSockets in about:config.');
- }
-
- this.bind_events();
- this.init_iopub_handlers();
- this.comm_manager = new comm.CommManager(this);
-
- this.last_msg_id = null;
- this.last_msg_callbacks = {};
- this._autorestart_attempt = 0;
- this._reconnect_attempt = 0;
- this.reconnect_limit = 7;
-
- this._pending_messages = [];
- };
- /**
- * @function _get_msg
- */
- Kernel.prototype._get_msg = function (msg_type, content, metadata, buffers) {
- var msg = {
- header : {
- date: new Date().toISOString(),
- msg_id : utils.uuid(),
- username : this.username,
- session : this.session_id,
- msg_type : msg_type,
- version : "5.2",
- },
- metadata : metadata || {},
- content : content,
- buffers : buffers || [],
- parent_header : {}
- };
- return msg;
- };
- /**
- * @function bind_events
- */
- Kernel.prototype.bind_events = function () {
- var that = this;
- this.events.on('send_input_reply.Kernel', function(evt, data) {
- that.send_input_reply(data);
- });
- var record_status = function (evt, info) {
- console.log('Kernel: ' + evt.type + ' (' + info.kernel.id + ')');
- };
- this.events.on('kernel_created.Kernel', record_status);
- this.events.on('kernel_reconnecting.Kernel', record_status);
- this.events.on('kernel_connected.Kernel', record_status);
- this.events.on('kernel_starting.Kernel', record_status);
- this.events.on('kernel_restarting.Kernel', record_status);
- this.events.on('kernel_autorestarting.Kernel', record_status);
- this.events.on('kernel_interrupting.Kernel', record_status);
- this.events.on('kernel_disconnected.Kernel', record_status);
- // these are commented out because they are triggered a lot, but can
- // be uncommented for debugging purposes
- //this.events.on('kernel_idle.Kernel', record_status);
- //this.events.on('kernel_busy.Kernel', record_status);
- this.events.on('kernel_ready.Kernel', record_status);
- this.events.on('kernel_killed.Kernel', record_status);
- this.events.on('kernel_dead.Kernel', record_status);
- this.events.on('kernel_ready.Kernel', function () {
- that._autorestart_attempt = 0;
- });
- this.events.on('kernel_connected.Kernel', function () {
- that._reconnect_attempt = 0;
- });
- };
- /**
- * Initialize the iopub handlers.
- *
- * @function init_iopub_handlers
- */
- Kernel.prototype.init_iopub_handlers = function () {
- var output_msg_types = ['stream', 'display_data', 'execute_result', 'error', 'update_display_data'];
- this._iopub_handlers = {};
- this.register_iopub_handler('status', $.proxy(this._handle_status_message, this));
- this.register_iopub_handler('clear_output', $.proxy(this._handle_clear_output, this));
- this.register_iopub_handler('execute_input', $.proxy(this._handle_input_message, this));
- this.register_iopub_handler('shutdown_reply', $.proxy(this._handle_shutdown_message, this));
-
- for (var i=0; i < output_msg_types.length; i++) {
- this.register_iopub_handler(output_msg_types[i], $.proxy(this._handle_output_message, this));
- }
- };
- /**
- * GET /api/kernels
- *
- * Get the list of running kernels.
- *
- * @function list
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Kernel.prototype.list = function (success, error) {
- utils.ajax(this.kernel_service_url, {
- processData: false,
- cache: false,
- type: "GET",
- dataType: "json",
- success: success,
- error: this._on_error(error)
- });
- };
- /**
- * POST /api/kernels
- *
- * Start a new kernel.
- *
- * In general this shouldn't be used -- the kernel should be
- * started through the session API. If you use this function and
- * are also using the session API then your session and kernel
- * WILL be out of sync!
- *
- * @function start
- * @param {params} [Object] - parameters to include in the query string
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Kernel.prototype.start = function (params, success, error) {
- var url = this.kernel_service_url;
- var qs = $.param(params || {}); // query string for sage math stuff
- if (qs !== "") {
- url = url + "?" + qs;
- }
- this.events.trigger('kernel_starting.Kernel', {kernel: this});
- var that = this;
- var on_success = function (data, status, xhr) {
- that.events.trigger('kernel_created.Kernel', {kernel: that});
- that._kernel_created(data);
- if (success) {
- success(data, status, xhr);
- }
- };
- utils.ajax(url, {
- processData: false,
- cache: false,
- type: "POST",
- data: JSON.stringify({name: this.name}),
- contentType: 'application/json',
- dataType: "json",
- success: this._on_success(on_success),
- error: this._on_error(error)
- });
- return url;
- };
- /**
- * GET /api/kernels/[:kernel_id]
- *
- * Get information about the kernel.
- *
- * @function get_info
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Kernel.prototype.get_info = function (success, error) {
- utils.ajax(this.kernel_url, {
- processData: false,
- cache: false,
- type: "GET",
- dataType: "json",
- success: this._on_success(success),
- error: this._on_error(error)
- });
- };
- /**
- * DELETE /api/kernels/[:kernel_id]
- *
- * Shutdown the kernel.
- *
- * If you are also using sessions, then this function should NOT be
- * used. Instead, use Session.delete. Otherwise, the session and
- * kernel WILL be out of sync.
- *
- * @function kill
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Kernel.prototype.kill = function (success, error) {
- this.events.trigger('kernel_killed.Kernel', {kernel: this});
- this._kernel_dead();
- utils.ajax(this.kernel_url, {
- processData: false,
- cache: false,
- type: "DELETE",
- dataType: "json",
- success: this._on_success(success),
- error: this._on_error(error)
- });
- };
- /**
- * POST /api/kernels/[:kernel_id]/interrupt
- *
- * Interrupt the kernel.
- *
- * @function interrupt
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Kernel.prototype.interrupt = function (success, error) {
- this.events.trigger('kernel_interrupting.Kernel', {kernel: this});
- var that = this;
- var on_success = function (data, status, xhr) {
- /**
- * get kernel info so we know what state the kernel is in
- */
- that.kernel_info();
- if (success) {
- success(data, status, xhr);
- }
- };
- var url = utils.url_path_join(this.kernel_url, 'interrupt');
- utils.ajax(url, {
- processData: false,
- cache: false,
- type: "POST",
- contentType: false, // there's no data with this
- dataType: "json",
- success: this._on_success(on_success),
- error: this._on_error(error)
- });
- };
- Kernel.prototype.restart = function (success, error) {
- /**
- * POST /api/kernels/[:kernel_id]/restart
- *
- * Restart the kernel.
- *
- * @function interrupt
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- this.events.trigger('kernel_restarting.Kernel', {kernel: this});
- this.stop_channels();
- this._msg_callbacks = {};
- this._msg_callbacks_overrides = {};
- this._display_id_to_parent_ids = {};
- var that = this;
- var on_success = function (data, status, xhr) {
- that.events.trigger('kernel_created.Kernel', {kernel: that});
- that._kernel_created(data);
- if (success) {
- success(data, status, xhr);
- }
- };
- var on_error = function (xhr, status, err) {
- that.events.trigger('kernel_failed_restart.Kernel', {kernel: that});
- that._kernel_dead();
- if (error) {
- error(xhr, status, err);
- }
- };
- var url = utils.url_path_join(this.kernel_url, 'restart');
- utils.ajax(url, {
- processData: false,
- cache: false,
- type: "POST",
- contentType: false, // there's no data with this
- dataType: "json",
- success: this._on_success(on_success),
- error: this._on_error(on_error)
- });
- };
- Kernel.prototype.reconnect = function () {
- /**
- * Reconnect to a disconnected kernel. This is not actually a
- * standard HTTP request, but useful function nonetheless for
- * reconnecting to the kernel if the connection is somehow lost.
- *
- * @function reconnect
- */
- if (this.is_connected()) {
- this.stop_channels();
- }
- this._reconnect_attempt = this._reconnect_attempt + 1;
- this.events.trigger('kernel_reconnecting.Kernel', {
- kernel: this,
- attempt: this._reconnect_attempt,
- });
- this.start_channels();
- };
- Kernel.prototype._on_success = function (success) {
- /**
- * Handle a successful AJAX request by updating the kernel id and
- * name from the response, and then optionally calling a provided
- * callback.
- *
- * @function _on_success
- * @param {function} success - callback
- */
- var that = this;
- return function (data, status, xhr) {
- if (data) {
- that.id = data.id;
- that.name = data.name;
- }
- that.kernel_url = utils.url_path_join(that.kernel_service_url,
- encodeURIComponent(that.id));
- if (success) {
- success(data, status, xhr);
- }
- };
- };
- Kernel.prototype._on_error = function (error) {
- /**
- * Handle a failed AJAX request by logging the error message, and
- * then optionally calling a provided callback.
- *
- * @function _on_error
- * @param {function} error - callback
- */
- return function (xhr, status, err) {
- utils.log_ajax_error(xhr, status, err);
- if (error) {
- error(xhr, status, err);
- }
- };
- };
- Kernel.prototype._kernel_created = function (data) {
- /**
- * Perform necessary tasks once the kernel has been started,
- * including actually connecting to the kernel.
- *
- * @function _kernel_created
- * @param {Object} data - information about the kernel including id
- */
- this.id = data.id;
- this.kernel_url = utils.url_path_join(this.kernel_service_url,
- encodeURIComponent(this.id));
- this.start_channels();
- };
- Kernel.prototype._kernel_connected = function () {
- /**
- * Perform necessary tasks once the connection to the kernel has
- * been established. This includes requesting information about
- * the kernel.
- *
- * @function _kernel_connected
- */
- this.events.trigger('kernel_connected.Kernel', {kernel: this});
- // Send pending messages. We shift the message off the queue
- // after the message is sent so that if there is an exception,
- // the message is still pending.
- while (this._pending_messages.length > 0) {
- this.ws.send(this._pending_messages[0]);
- this._pending_messages.shift();
- }
- // get kernel info so we know what state the kernel is in
- var that = this;
- this.kernel_info(function (reply) {
- that.info_reply = reply.content;
- that.events.trigger('kernel_ready.Kernel', {kernel: that});
- });
- };
- Kernel.prototype._kernel_dead = function () {
- /**
- * Perform necessary tasks after the kernel has died. This closing
- * communication channels to the kernel if they are still somehow
- * open.
- *
- * @function _kernel_dead
- */
- this.stop_channels();
- };
- Kernel.prototype.start_channels = function () {
- /**
- * Start the websocket channels.
- * Will stop and restart them if they already exist.
- *
- * @function start_channels
- */
- var that = this;
- this.stop_channels();
- var ws_host_url = this.ws_url + this.kernel_url;
- console.log("Starting WebSockets:", ws_host_url);
- this.ws = new this.WebSocket([
- that.ws_url,
- utils.url_path_join(that.kernel_url, 'channels'),
- "?session_id=" + that.session_id
- ].join('')
- );
-
- var already_called_onclose = false; // only alert once
- var ws_closed_early = function(evt){
- console.log("WebSocket closed early", evt);
- if (already_called_onclose){
- return;
- }
- already_called_onclose = true;
- // If the websocket was closed early, that could mean
- // that the kernel is actually dead. Try getting
- // information about the kernel from the API call --
- // if that fails, then assume the kernel is dead,
- // otherwise just follow the typical websocket closed
- // protocol.
- that.get_info(function () {
- that._ws_closed(ws_host_url, false);
- }, function () {
- that.events.trigger('kernel_dead.Kernel', {kernel: that});
- that._kernel_dead();
- });
- };
- var ws_closed_late = function(evt){
- console.log("WebSocket closed unexpectedly", evt);
- if (already_called_onclose){
- return;
- }
- already_called_onclose = true;
- that._ws_closed(ws_host_url, false);
- };
- var ws_error = function(evt){
- if (already_called_onclose){
- return;
- }
- already_called_onclose = true;
- that._ws_closed(ws_host_url, true);
- };
- this.ws.onopen = $.proxy(this._ws_opened, this);
- this.ws.onclose = ws_closed_early;
- this.ws.onerror = ws_error;
- // switch from early-close to late-close message after 1s
- setTimeout(function() {
- if (that.ws !== null && !that._stopping) {
- that.ws.onclose = ws_closed_late;
- }
- }, 1000);
- this.ws.onmessage = $.proxy(this._handle_ws_message, this);
- };
- Kernel.prototype._ws_opened = function (evt) {
- /**
- * Handle a websocket entering the open state,
- * signaling that the kernel is connected when websocket is open.
- *
- * @function _ws_opened
- */
- if (this.is_connected()) {
- // all events ready, trigger started event.
- this._kernel_connected();
- }
- };
- Kernel.prototype._ws_closed = function(ws_url, error) {
- /**
- * Handle a websocket entering the closed state. If the websocket
- * was not closed due to an error, try to reconnect to the kernel.
- *
- * @function _ws_closed
- * @param {string} ws_url - the websocket url
- * @param {bool} error - whether the connection was closed due to an error
- */
- this.stop_channels();
- this.events.trigger('kernel_disconnected.Kernel', {kernel: this});
- if (error) {
- console.log('WebSocket connection failed: ', ws_url, error);
- this.events.trigger('kernel_connection_failed.Kernel', {
- kernel: this,
- ws_url: ws_url,
- attempt: this._reconnect_attempt,
- error: error,
- });
- }
- this._schedule_reconnect();
- };
-
- Kernel.prototype._schedule_reconnect = function () {
- /**
- * function to call when kernel connection is lost
- * schedules reconnect, or fires 'connection_dead' if reconnect limit is hit
- */
- if (this._reconnect_attempt < this.reconnect_limit) {
- var timeout = Math.pow(2, this._reconnect_attempt);
- console.log("Connection lost, reconnecting in " + timeout + " seconds.");
- setTimeout($.proxy(this.reconnect, this), 1e3 * timeout);
- } else {
- this.events.trigger('kernel_connection_dead.Kernel', {
- kernel: this,
- reconnect_attempt: this._reconnect_attempt,
- });
- console.log("Failed to reconnect, giving up.");
- }
- };
-
- Kernel.prototype.stop_channels = function () {
- /**
- * Close the websocket. After successful close, the value
- * in `this.ws` will be null.
- *
- * @function stop_channels
- */
- var that = this;
- var close = function () {
- that._stopping = false;
- if (that.ws && that.ws.readyState === WebSocket.CLOSED) {
- that.ws = null;
- }
- };
- if (this.ws !== null) {
- // flag to avoid races with on_close_late
- this._stopping = true;
- if (this.ws.readyState === WebSocket.OPEN) {
- this.ws.onclose = close;
- this.ws.close();
- } else {
- close();
- }
- }
- };
- Kernel.prototype.is_connected = function () {
- /**
- * Check whether there is a connection to the kernel. This
- * function only returns true if websocket has been
- * created and has a state of WebSocket.OPEN.
- *
- * @function is_connected
- * @returns {bool} - whether there is a connection
- */
- // if any channel is not ready, then we're not connected
- if (this.ws === null) {
- return false;
- }
- if (this.ws.readyState !== WebSocket.OPEN) {
- return false;
- }
- return true;
- };
- Kernel.prototype.is_fully_disconnected = function () {
- /**
- * Check whether the connection to the kernel has been completely
- * severed. This function only returns true if all channel objects
- * are null.
- *
- * @function is_fully_disconnected
- * @returns {bool} - whether the kernel is fully disconnected
- */
- return (this.ws === null);
- };
-
- Kernel.prototype._send = function(msg) {
- /**
- * Send a message (if the kernel is connected) or queue the message for future delivery
- *
- * Pending messages will automatically be sent when a kernel becomes connected.
- *
- * @function _send
- * @param msg
- */
- if (this.is_connected()) {
- this.ws.send(msg);
- } else {
- this._pending_messages.push(msg);
- }
- };
-
- Kernel.prototype.send_shell_message = function (msg_type, content, callbacks, metadata, buffers) {
- /**
- * Send a message on the Kernel's shell channel
- *
- * If the kernel is not connected, the message will be buffered.
- *
- * @function send_shell_message
- */
- var msg = this._get_msg(msg_type, content, metadata, buffers);
- msg.channel = 'shell';
- this.set_callbacks_for_msg(msg.header.msg_id, callbacks);
- this._send(serialize.serialize(msg));
- return msg.header.msg_id;
- };
- Kernel.prototype.kernel_info = function (callback) {
- /**
- * Get kernel info
- *
- * @function kernel_info
- * @param callback {function}
- *
- * When calling this method, pass a callback function that expects one argument.
- * The callback will be passed the complete `kernel_info_reply` message documented
- * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#kernel-info)
- */
- var callbacks;
- if (callback) {
- callbacks = { shell : { reply : callback } };
- }
- return this.send_shell_message("kernel_info_request", {}, callbacks);
- };
- Kernel.prototype.comm_info = function (target_name, callback) {
- /**
- * Get comm info
- *
- * @function comm_info
- * @param callback {function}
- *
- * When calling this method, pass a callback function that expects one argument.
- * The callback will be passed the complete `comm_info_reply` message documented
- * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#comm_info)
- */
- var callbacks;
- if (callback) {
- callbacks = { shell : { reply : callback } };
- }
- var content = {
- target_name : target_name,
- };
- return this.send_shell_message("comm_info_request", content, callbacks);
- };
- Kernel.prototype.inspect = function (code, cursor_pos, callback) {
- /**
- * Get info on an object
- *
- * When calling this method, pass a callback function that expects one argument.
- * The callback will be passed the complete `inspect_reply` message documented
- * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#object-information)
- *
- * @function inspect
- * @param code {string}
- * @param cursor_pos {integer}
- * @param callback {function}
- */
- var callbacks;
- if (callback) {
- callbacks = { shell : { reply : callback } };
- }
-
- var content = {
- code : code,
- cursor_pos : cursor_pos,
- detail_level : 0
- };
- return this.send_shell_message("inspect_request", content, callbacks);
- };
- Kernel.prototype.execute = function (code, callbacks, options) {
- /**
- * Execute given code into kernel, and pass result to callback.
- *
- * @async
- * @function execute
- * @param {string} code
- * @param [callbacks] {Object} With the following keys (all optional)
- * @param callbacks.shell.reply {function}
- * @param callbacks.shell.payload.[payload_name] {function}
- * @param callbacks.iopub.output {function}
- * @param callbacks.iopub.clear_output {function}
- * @param callbacks.input {function}
- * @param callbacks.clear_on_done=true {Boolean}
- * @param {object} [options]
- * @param [options.silent=false] {Boolean}
- * @param [options.user_expressions=empty_dict] {Dict}
- * @param [options.allow_stdin=false] {Boolean} true|false
- *
- * @example
- *
- * The options object should contain the options for the execute
- * call. Its default values are:
- *
- * options = {
- * silent : true,
- * user_expressions : {},
- * allow_stdin : false
- * }
- *
- * When calling this method pass a callbacks structure of the
- * form:
- *
- * callbacks = {
- * shell : {
- * reply : execute_reply_callback,
- * payload : {
- * set_next_input : set_next_input_callback,
- * }
- * },
- * iopub : {
- * output : output_callback,
- * clear_output : clear_output_callback,
- * },
- * input : raw_input_callback
- * }
- *
- * Each callback will be passed the entire message as a single
- * argument. Payload handlers will be passed the corresponding
- * payload and the execute_reply message.
- */
- var content = {
- code : code,
- silent : true,
- store_history : false,
- user_expressions : {},
- allow_stdin : false
- };
- callbacks = callbacks || {};
- if (callbacks.input !== undefined) {
- content.allow_stdin = true;
- }
- $.extend(true, content, options);
- this.events.trigger('execution_request.Kernel', {kernel: this, content: content});
- return this.send_shell_message("execute_request", content, callbacks);
- };
- /**
- * When calling this method, pass a function to be called with the
- * `complete_reply` message as its only argument when it arrives.
- *
- * `complete_reply` is documented
- * [here](https://jupyter-client.readthedocs.io/en/latest/messaging.html#complete)
- *
- * @function complete
- * @param code {string}
- * @param cursor_pos {integer}
- * @param callback {function}
- */
- Kernel.prototype.complete = function (code, cursor_pos, callback) {
- var callbacks;
- if (callback) {
- callbacks = { shell : { reply : callback } };
- }
- var content = {
- code : code,
- cursor_pos : cursor_pos
- };
- return this.send_shell_message("complete_request", content, callbacks);
- };
- /**
- * @function send_input_reply
- */
- Kernel.prototype.send_input_reply = function (input) {
- var content = {
- value : input
- };
- this.events.trigger('input_reply.Kernel', {kernel: this, content: content});
- var msg = this._get_msg("input_reply", content);
- msg.channel = 'stdin';
- this._send(serialize.serialize(msg));
- return msg.header.msg_id;
- };
- /**
- * @function register_iopub_handler
- */
- Kernel.prototype.register_iopub_handler = function (msg_type, callback) {
- this._iopub_handlers[msg_type] = callback;
- };
- /**
- * Get the iopub handler for a specific message type.
- *
- * @function get_iopub_handler
- */
- Kernel.prototype.get_iopub_handler = function (msg_type) {
- return this._iopub_handlers[msg_type];
- };
- /**
- * Get callbacks for a specific message.
- *
- * @function get_callbacks_for_msg
- */
- Kernel.prototype.get_callbacks_for_msg = function (msg_id) {
- if (msg_id == this.last_msg_id) {
- return this.last_msg_callbacks;
- } else {
- return this._msg_callbacks[msg_id];
- }
- };
- /**
- * Get output callbacks for a specific message.
- *
- * @function get_output_callbacks_for_msg
- *
- * Since output callbacks can be overridden, we first check the override stack.
- */
- Kernel.prototype.get_output_callbacks_for_msg = function (msg_id) {
- return this.get_callbacks_for_msg(this.get_output_callback_id(msg_id));
- };
- /**
- * Get the output callback id for a message
- *
- * Since output callbacks can be redirected, this may not be the same as
- * the msg_id.
- *
- * @function get_output_callback_id
- */
- Kernel.prototype.get_output_callback_id = function (msg_id) {
- var callback_id = msg_id;
- var overrides = this._msg_callbacks_overrides[msg_id];
- if (overrides && overrides.length > 0) {
- callback_id = overrides[overrides.length-1];
- }
- return callback_id
- }
- /**
- * Clear callbacks for a specific message.
- *
- * @function clear_callbacks_for_msg
- */
- Kernel.prototype.clear_callbacks_for_msg = function (msg_id) {
- if (this._msg_callbacks[msg_id] !== undefined ) {
- var callbacks = this._msg_callbacks[msg_id];
- var kernel = this;
- // clear display_id:msg_id map for display_ids associated with this msg_id
- if (!callbacks) return;
- callbacks.display_ids.map(function (display_id) {
- var msg_ids = kernel._display_id_to_parent_ids[display_id];
- if (msg_ids) {
- var idx = msg_ids.indexOf(msg_id);
- if (idx === -1) {
- return;
- }
- if (msg_ids.length === 1) {
- delete kernel._display_id_to_parent_ids[display_id];
- } else {
- msg_ids.splice(idx, 1);
- kernel._display_id_to_parent_ids[display_id] = msg_ids;
- }
- }
- });
- delete this._msg_callbacks[msg_id];
- }
- };
-
- /**
- * @function _finish_shell
- */
- Kernel.prototype._finish_shell = function (msg_id) {
- var callbacks = this._msg_callbacks[msg_id];
- if (callbacks !== undefined) {
- callbacks.shell_done = true;
- if (callbacks.clear_on_done && callbacks.iopub_done) {
- this.clear_callbacks_for_msg(msg_id);
- }
- }
- };
- /**
- * @function _finish_iopub
- */
- Kernel.prototype._finish_iopub = function (msg_id) {
- var callbacks = this._msg_callbacks[msg_id];
- if (callbacks !== undefined) {
- callbacks.iopub_done = true;
- if (callbacks.clear_on_done && callbacks.shell_done) {
- this.clear_callbacks_for_msg(msg_id);
- }
- }
- this.events.trigger('finished_iopub.Kernel', {kernel: this, msg_id: msg_id});
- };
-
- /**
- * Set callbacks for a particular message.
- * Callbacks should be a struct of the following form:
- * shell : {
- *
- * }
- *
- * If the third parameter is truthy, the callback is set as the last
- * callback registered.
- *
- * @function set_callbacks_for_msg
- */
- Kernel.prototype.set_callbacks_for_msg = function (msg_id, callbacks, save) {
- var remember = save || true;
- if (remember) {
- this.last_msg_id = msg_id;
- }
- if (callbacks) {
- // shallow-copy mapping, because we will modify it at the top level
- var cbcopy = this._msg_callbacks[msg_id] = this.last_msg_callbacks = {};
- cbcopy.shell = callbacks.shell;
- cbcopy.iopub = callbacks.iopub;
- cbcopy.input = callbacks.input;
- cbcopy.clear_on_done = callbacks.clear_on_done;
- cbcopy.shell_done = (!callbacks.shell);
- cbcopy.iopub_done = (!callbacks.iopub);
- cbcopy.display_ids = [];
- if (callbacks.clear_on_done === undefined) {
- // default to clear-on-done
- cbcopy.clear_on_done = true;
- }
- } else if (remember) {
- this.last_msg_callbacks = {};
- }
- };
- /**
- * Override output callbacks for a particular msg_id
- */
- Kernel.prototype.output_callback_overrides_push = function(msg_id, callback_id) {
- var output_callbacks = this._msg_callbacks_overrides[msg_id];
- if (!output_callbacks) {
- this._msg_callbacks_overrides[msg_id] = output_callbacks = [];
- }
- output_callbacks.push(callback_id);
- }
- Kernel.prototype.output_callback_overrides_pop = function(msg_id) {
- var callback_ids = this._msg_callbacks_overrides[msg_id];
- if (!callback_ids) {
- console.error("Popping callback overrides, but none registered", msg_id);
- return;
- }
- return callback_ids.pop();
- }
- Kernel.prototype._handle_ws_message = function (e) {
- var that = this;
- this._msg_queue = this._msg_queue.then(function() {
- return serialize.deserialize(e.data);
- }).then(function(msg) {return that._finish_ws_message(msg);})
- .catch(function(error) { console.error("Couldn't process kernel message", error); });
- };
- Kernel.prototype._finish_ws_message = function (msg) {
- switch (msg.channel) {
- case 'shell':
- return this._handle_shell_reply(msg);
- case 'iopub':
- return this._handle_iopub_message(msg);
- case 'stdin':
- return this._handle_input_request(msg);
- default:
- console.error("unrecognized message channel", msg.channel, msg);
- }
- };
-
- Kernel.prototype._handle_shell_reply = function (reply) {
- this.events.trigger('shell_reply.Kernel', {kernel: this, reply:reply});
- var that = this;
- var content = reply.content;
- var metadata = reply.metadata;
- var parent_id = reply.parent_header.msg_id;
- var callbacks = this.get_callbacks_for_msg(parent_id);
- var promise = Promise.resolve();
- if (!callbacks || !callbacks.shell) {
- return;
- }
- var shell_callbacks = callbacks.shell;
-
- // signal that shell callbacks are done
- this._finish_shell(parent_id);
-
- if (shell_callbacks.reply !== undefined) {
- promise = promise.then(function() {return shell_callbacks.reply(reply);});
- }
- if (content.payload && shell_callbacks.payload) {
- promise = promise.then(function() {
- return that._handle_payloads(content.payload, shell_callbacks.payload, reply);
- });
- }
- return promise;
- };
- /**
- * @function _handle_payloads
- */
- Kernel.prototype._handle_payloads = function (payloads, payload_callbacks, msg) {
- var promise = [];
- var l = payloads.length;
- // Payloads are handled by triggering events because we don't want the Kernel
- // to depend on the Notebook or Pager classes.
- for (var i=0; i<l; i++) {
- var payload = payloads[i];
- var callback = payload_callbacks[payload.source];
- if (callback) {
- promise.push(callback(payload, msg));
- }
- }
- return Promise.all(promise);
- };
- /**
- * @function _handle_status_message
- */
- Kernel.prototype._handle_status_message = function (msg) {
- var execution_state = msg.content.execution_state;
- var parent_id = msg.parent_header.msg_id;
-
- // dispatch status msg callbacks, if any
- var callbacks = this.get_callbacks_for_msg(parent_id);
- if (callbacks && callbacks.iopub && callbacks.iopub.status) {
- try {
- callbacks.iopub.status(msg);
- } catch (e) {
- console.log("Exception in status msg handler", e, e.stack);
- }
- }
-
- if (execution_state === 'busy') {
- this.events.trigger('kernel_busy.Kernel', {kernel: this});
- } else if (execution_state === 'idle') {
- // signal that iopub callbacks are (probably) done
- // async output may still arrive,
- // but only for the most recent request
- this._finish_iopub(parent_id);
-
- // trigger status_idle event
- this.events.trigger('kernel_idle.Kernel', {kernel: this});
- } else if (execution_state === 'starting') {
- this.events.trigger('kernel_starting.Kernel', {kernel: this});
- var that = this;
- this.kernel_info(function (reply) {
- that.info_reply = reply.content;
- that.events.trigger('kernel_ready.Kernel', {kernel: that});
- });
- } else if (execution_state === 'restarting') {
- // autorestarting is distinct from restarting,
- // in that it means the kernel died and the server is restarting it.
- // kernel_restarting sets the notification widget,
- // autorestart shows the more prominent dialog.
- this._autorestart_attempt = this._autorestart_attempt + 1;
- this.events.trigger('kernel_restarting.Kernel', {kernel: this});
- this.events.trigger('kernel_autorestarting.Kernel', {kernel: this, attempt: this._autorestart_attempt});
- } else if (execution_state === 'dead') {
- this.events.trigger('kernel_dead.Kernel', {kernel: this});
- this._kernel_dead();
- }
- };
-
- /**
- * Handle clear_output message
- *
- * @function _handle_clear_output
- */
- Kernel.prototype._handle_clear_output = function (msg) {
- var callbacks = this.get_output_callbacks_for_msg(msg.parent_header.msg_id);
- if (!callbacks || !callbacks.iopub) {
- return;
- }
- var callback = callbacks.iopub.clear_output;
- if (callback) {
- callback(msg);
- }
- };
- /**
- * handle an output message (execute_result, display_data, etc.)
- *
- * @function _handle_output_message
- */
- Kernel.prototype._handle_output_message = function (msg) {
- var that = this;
- var msg_id = msg.parent_header.msg_id;
- var callbacks = this.get_output_callbacks_for_msg(msg_id);
- if (['display_data', 'update_display_data', 'execute_result'].indexOf(msg.header.msg_type) > -1) {
- // display_data messages may re-route based on their display_id
- var display_id = (msg.content.transient || {}).display_id;
- if (display_id) {
- // it has a display_id
- var parent_ids = this._display_id_to_parent_ids[display_id];
- if (parent_ids) {
- // we've seen it before, update existing outputs with same display_id
- // by handling display_data as update_display_data
- var update_msg = $.extend(true, {}, msg);
- update_msg.header.msg_type = 'update_display_data';
- parent_ids.map(function (parent_id) {
- var callbacks = that.get_callbacks_for_msg(parent_id);
- if (!callbacks) return;
- var callback = callbacks.iopub.output;
- if (callback) {
- callback(update_msg);
- }
- });
- }
- // we're done here if it's update_display
- if (msg.header.msg_type === 'update_display_data') {
- // it's an update, don't proceed to the normal display
- return;
- }
- // regular display_data with id, record it for future updating
- // in _display_id_to_parent_ids for future lookup
- if (this._display_id_to_parent_ids[display_id] === undefined) {
- this._display_id_to_parent_ids[display_id] = [];
- }
- var callback_id = this.get_output_callback_id(msg_id);
- if (this._display_id_to_parent_ids[display_id].indexOf(callback_id) === -1) {
- this._display_id_to_parent_ids[display_id].push(callback_id);
- }
- // and in callbacks for cleanup on clear_callbacks_for_msg
- if (callbacks && callbacks.display_ids.indexOf(display_id) === -1) {
- callbacks.display_ids.push(display_id);
- }
- }
- }
- if (!callbacks || !callbacks.iopub) {
- // The message came from another client. Let the UI decide what to
- // do with it.
- this.events.trigger('received_unsolicited_message.Kernel', msg);
- return;
- }
- var callback = callbacks.iopub.output;
- if (callback) {
- callback(msg);
- }
- };
- /**
- * Handle an input message (execute_input).
- *
- * @function _handle_input message
- */
- Kernel.prototype._handle_input_message = function (msg) {
- var callbacks = this.get_callbacks_for_msg(msg.parent_header.msg_id);
- if (!callbacks) {
- // The message came from another client. Let the UI decide what to
- // do with it.
- this.events.trigger('received_unsolicited_message.Kernel', msg);
- }
- };
- /**
- * Handle a kernel shutdown message
- * @function _handle_shutdown_message
- */
- Kernel.prototype._handle_shutdown_message = function (msg) {
- if (!msg.content.restart) {
- this.events.trigger('kernel_dead.Kernel', {kernel: this});
- this._kernel_dead();
- }
- }
- /**
- * Dispatch IOPub messages to respective handlers. Each message
- * type should have a handler.
- *
- * @function _handle_iopub_message
- */
- Kernel.prototype._handle_iopub_message = function (msg) {
- var handler = this.get_iopub_handler(msg.header.msg_type);
- if (handler !== undefined) {
- return handler(msg);
- }
- };
- /**
- * @function _handle_input_request
- */
- Kernel.prototype._handle_input_request = function (request) {
- var header = request.header;
- var content = request.content;
- var metadata = request.metadata;
- var msg_type = header.msg_type;
- if (msg_type !== 'input_request') {
- console.log("Invalid input request!", request);
- return;
- }
- var callbacks = this.get_callbacks_for_msg(request.parent_header.msg_id);
- if (callbacks) {
- if (callbacks.input) {
- callbacks.input(request);
- }
- }
- };
- return {'Kernel': Kernel};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('services/sessions/session',[
- 'jquery',
- 'base/js/utils',
- 'services/kernels/kernel',
- ], function($, utils, kernel) {
- "use strict";
- /**
- * Session object for accessing the session REST api. The session
- * should be used to start kernels and then shut them down -- for
- * all other operations, the kernel object should be used.
- *
- * Preliminary documentation for the REST API is at
- * https://github.com/ipython/ipython/wiki/IPEP-16%3A-Notebook-multi-directory-dashboard-and-URL-mapping#sessions-api
- *
- * Options should include:
- * - notebook_path: the path (not including name) to the notebook
- * - kernel_name: the type of kernel (e.g. python3)
- * - base_url: the root url of the notebook server
- * - ws_url: the url to access websockets
- * - notebook: Notebook object
- *
- * @class Session
- * @param {Object} options
- */
- var Session = function (options) {
- this.id = null;
- this.notebook_model = {
- path: options.notebook_path
- };
- this.kernel_model = {
- id: null,
- name: options.kernel_name
- };
- this.nbclassic_path = options.nbclassic_path;
- this.base_url = options.base_url;
- this.ws_url = options.ws_url;
- this.session_service_url = utils.url_path_join(this.base_url, 'api/sessions');
- this.session_url = null;
- this.notebook = options.notebook;
- this.kernel = null;
- this.events = options.notebook.events;
- this.bind_events();
- };
- Session.prototype.bind_events = function () {
- var that = this;
- var record_status = function (evt, info) {
- console.log('Session: ' + evt.type + ' (' + info.session.id + ')');
- };
- this.events.on('kernel_created.Session', record_status);
- this.events.on('kernel_dead.Session', record_status);
- this.events.on('kernel_killed.Session', record_status);
- // if the kernel dies, then also remove the session
- this.events.on('kernel_dead.Kernel', function () {
- that.delete();
- });
- this.events.on('kernel_failed_restart.Kernel', function () {
- that.notebook.start_session();
- });
- };
- // Public REST api functions
- /**
- * GET /api/sessions
- *
- * Get a list of the current sessions.
- *
- * @function list
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Session.prototype.list = function (success, error) {
- utils.ajax(this.session_service_url, {
- processData: false,
- cache: false,
- type: "GET",
- dataType: "json",
- success: success,
- error: this._on_error(error)
- });
- };
- /**
- * POST /api/sessions
- *
- * Start a new session. This function can only executed once.
- *
- * @function start
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Session.prototype.start = function (success, error) {
- var that = this;
- var on_success = function (data, status, xhr) {
- if (that.kernel) {
- that.kernel.name = that.kernel_model.name;
- } else {
- var kernel_service_url = utils.url_path_join(that.base_url, "api/kernels");
- that.kernel = new kernel.Kernel(kernel_service_url, that.ws_url, that.kernel_model.name);
- }
- that.events.trigger('kernel_created.Session', {session: that, kernel: that.kernel});
- that.kernel._kernel_created(data.kernel);
- if (success) {
- success(data, status, xhr);
- }
- };
- var on_error = function (xhr, status, err) {
- that.events.trigger('kernel_dead.Session', {session: that, xhr: xhr, status: status, error: err});
- if (error) {
- error(xhr, status, err);
- }
- };
- utils.ajax(this.session_service_url, {
- processData: false,
- cache: false,
- type: "POST",
- data: JSON.stringify(this._get_model()),
- contentType: 'application/json',
- dataType: "json",
- success: this._on_success(on_success),
- error: this._on_error(on_error)
- });
- };
- /**
- * GET /api/sessions/[:session_id]
- *
- * Get information about a session.
- *
- * @function get_info
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Session.prototype.get_info = function (success, error) {
- utils.ajax(this.session_url, {
- processData: false,
- cache: false,
- type: "GET",
- dataType: "json",
- success: this._on_success(success),
- error: this._on_error(error)
- });
- };
- /**
- * PATCH /api/sessions/[:session_id]
- *
- * Rename or move a notebook. If the given name or path are
- * undefined, then they will not be changed.
- *
- * @function rename_notebook
- * @param {string} [path] - new notebook path
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Session.prototype.rename_notebook = function (path, success, error) {
- if (path !== undefined) {
- this.notebook_model.path = path;
- }
- utils.ajax(this.session_url, {
- processData: false,
- cache: false,
- type: "PATCH",
- data: JSON.stringify(this._get_model()),
- contentType: 'application/json',
- dataType: "json",
- success: this._on_success(success),
- error: this._on_error(error)
- });
- };
- /**
- * DELETE /api/sessions/[:session_id]
- *
- * Kill the kernel and shutdown the session.
- *
- * @function delete
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Session.prototype.delete = function (success, error) {
- if (this.kernel && this.kernel.is_connected()) {
- this.events.trigger('kernel_killed.Session', {session: this, kernel: this.kernel});
- this.kernel._kernel_dead();
- }
- utils.ajax(this.session_url, {
- processData: false,
- cache: false,
- type: "DELETE",
- dataType: "json",
- success: this._on_success(success),
- error: this._on_error(error)
- });
- };
- /**
- * Restart the session by deleting it and the starting it
- * fresh. If options are given, they can include any of the
- * following:
- *
- * - notebook_path - the path to the notebook
- * - kernel_name - the name (type) of the kernel
- *
- * @function restart
- * @param {Object} [options] - options for the new kernel
- * @param {function} [success] - function executed on ajax success
- * @param {function} [error] - function executed on ajax error
- */
- Session.prototype.restart = function (options, success, error) {
- var that = this;
- var start = function () {
- if (options && options.notebook_path) {
- that.notebook_model.path = options.notebook_path;
- }
- if (options && options.kernel_name) {
- that.kernel_model.name = options.kernel_name;
- }
- that.kernel_model.id = null;
- that.start(success, error);
- };
- this.delete(start, start);
- };
- // Helper functions
- /**
- * Get the data model for the session, which includes the notebook path
- * and kernel (name and id).
- *
- * @function _get_model
- * @returns {Object} - the data model
- */
- Session.prototype._get_model = function () {
- return {
- path: this.notebook_model.path,
- type: 'notebook',
- name: '',
- kernel: this.kernel_model
- };
- };
- /**
- * Update the data model from the given JSON object, which should
- * have attributes of `id`, `notebook`, and/or `kernel`. If
- * provided, the notebook data must include name and path, and the
- * kernel data must include name and id.
- *
- * @function _update_model
- * @param {Object} data - updated data model
- */
- Session.prototype._update_model = function (data) {
- if (data && data.id) {
- this.id = data.id;
- this.session_url = utils.url_path_join(this.session_service_url, this.id);
- }
- if (data && data.notebook) {
- this.notebook_model.path = data.path;
- }
- if (data && data.kernel) {
- this.kernel_model.name = data.kernel.name;
- this.kernel_model.id = data.kernel.id;
- }
- };
- /**
- * Handle a successful AJAX request by updating the session data
- * model with the response, and then optionally calling a provided
- * callback.
- *
- * @function _on_success
- * @param {function} success - callback
- */
- Session.prototype._on_success = function (success) {
- var that = this;
- return function (data, status, xhr) {
- that._update_model(data);
- if (success) {
- success(data, status, xhr);
- }
- };
- };
- /**
- * Handle a failed AJAX request by logging the error message, and
- * then optionally calling a provided callback.
- *
- * @function _on_error
- * @param {function} error - callback
- */
- Session.prototype._on_error = function (error) {
- return function (xhr, status, err) {
- utils.log_ajax_error(xhr, status, err);
- if (error) {
- error(xhr, status, err);
- }
- };
- };
- /**
- * Error type indicating that the session is already starting.
- */
- var SessionAlreadyStarting = function (message) {
- this.name = "SessionAlreadyStarting";
- this.message = (message || "");
- };
- SessionAlreadyStarting.prototype = Error.prototype;
- return {
- Session: Session,
- SessionAlreadyStarting: SessionAlreadyStarting
- };
- });
- // CodeMirror, copyright (c) by Marijn Haverbeke and others
- // Distributed under an MIT license: https://codemirror.net/LICENSE
- (function(mod) {
- if (typeof exports == "object" && typeof module == "object") // CommonJS
- mod(require("../../lib/codemirror"));
- else if (typeof define == "function" && define.amd) // AMD
- define('codemirror/addon/runmode/runmode',["../../lib/codemirror"], mod);
- else // Plain browser env
- mod(CodeMirror);
- })(function(CodeMirror) {
- "use strict";
- CodeMirror.runMode = function(string, modespec, callback, options) {
- var mode = CodeMirror.getMode(CodeMirror.defaults, modespec);
- var tabSize = (options && options.tabSize) || CodeMirror.defaults.tabSize;
- // Create a tokenizing callback function if passed-in callback is a DOM element.
- if (callback.appendChild) {
- var ie = /MSIE \d/.test(navigator.userAgent);
- var ie_lt9 = ie && (document.documentMode == null || document.documentMode < 9);
- var node = callback, col = 0;
- node.innerHTML = "";
- callback = function(text, style) {
- if (text == "\n") {
- // Emitting LF or CRLF on IE8 or earlier results in an incorrect display.
- // Emitting a carriage return makes everything ok.
- node.appendChild(document.createTextNode(ie_lt9 ? '\r' : text));
- col = 0;
- return;
- }
- var content = "";
- // replace tabs
- for (var pos = 0;;) {
- var idx = text.indexOf("\t", pos);
- if (idx == -1) {
- content += text.slice(pos);
- col += text.length - pos;
- break;
- } else {
- col += idx - pos;
- content += text.slice(pos, idx);
- var size = tabSize - col % tabSize;
- col += size;
- for (var i = 0; i < size; ++i) content += " ";
- pos = idx + 1;
- }
- }
- // Create a node with token style and append it to the callback DOM element.
- if (style) {
- var sp = node.appendChild(document.createElement("span"));
- sp.className = "cm-" + style.replace(/ +/g, " cm-");
- sp.appendChild(document.createTextNode(content));
- } else {
- node.appendChild(document.createTextNode(content));
- }
- };
- }
- var lines = CodeMirror.splitLines(string), state = (options && options.state) || CodeMirror.startState(mode);
- for (var i = 0, e = lines.length; i < e; ++i) {
- if (i) callback("\n");
- var stream = new CodeMirror.StringStream(lines[i], null, {
- lookAhead: function(n) { return lines[i + n] },
- baseToken: function() {}
- });
- if (!stream.string && mode.blankLine) mode.blankLine(state);
- while (!stream.eol()) {
- var style = mode.token(stream, state);
- callback(stream.current(), style, i, stream.start, state);
- stream.start = stream.pos;
- }
- }
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/tooltip',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n'
- ], function($, utils, i18n) {
- "use strict";
- // tooltip constructor
- var Tooltip = function (events) {
- var that = this;
- this.events = events;
- this.time_before_tooltip = 1200;
- // handle to html
- this.tooltip = $('#tooltip');
- this._hidden = true;
- // variable for consecutive call
- this._old_cell = null;
- this._old_request = null;
- this._consecutive_counter = 0;
- // 'sticky ?'
- this._sticky = false;
- // display tooltip if the docstring is empty?
- this._hide_if_no_docstring = false;
- // contain the button in the upper right corner
- this.buttons = $('<div/>').addClass('tooltipbuttons');
- // will contain the docstring
- this.text = $('<div/>').addClass('tooltiptext').addClass('smalltooltip');
- // build the buttons menu on the upper right
- // expand the tooltip to see more
- var expandlink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button')
- .attr('id', 'expanbutton').attr('title', i18n.msg._('Grow the tooltip vertically (press shift-tab twice)')).click(function () {
- that.expand();
- event.preventDefault();
- }).append(
- $('<span/>').text('Expand').addClass('ui-icon').addClass('ui-icon-plus'));
- // open in pager
- var morelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button').attr('title', i18n.msg._('show the current docstring in pager (press shift-tab 4 times)'));
- var morespan = $('<span/>').text(i18n.msg._('Open in Pager')).addClass('ui-icon').addClass('ui-icon-arrowstop-l-n');
- morelink.append(morespan);
- morelink.click(function () {
- that.showInPager(that._old_cell);
- event.preventDefault();
- });
- // close the tooltip
- var closelink = $('<a/>').attr('href', "#").attr('role', "button").addClass('ui-button');
- var closespan = $('<span/>').text(i18n.msg._('Close')).addClass('ui-icon').addClass('ui-icon-close');
- closelink.append(closespan);
- closelink.click(function () {
- that.remove_and_cancel_tooltip(true);
- event.preventDefault();
- });
- this._clocklink = $('<a/>').attr('href', "#");
- this._clocklink.attr('role', "button");
- this._clocklink.addClass('ui-button');
- this._clocklink.attr('title', i18n.msg._('Tooltip will linger for 10 seconds while you type'));
- var clockspan = $('<span/>').text(i18n.msg._('Close'));
- clockspan.addClass('ui-icon');
- clockspan.addClass('ui-icon-clock');
- this._clocklink.append(clockspan);
- this._clocklink.click(function () {
- that.cancel_stick();
- event.preventDefault();
- });
- //construct the tooltip
- // add in the reverse order you want them to appear
- this.buttons.append(closelink);
- this.buttons.append(expandlink);
- this.buttons.append(morelink);
- this.buttons.append(this._clocklink);
- this._clocklink.hide();
- // we need a phony element to make the small arrow
- // of the tooltip in css
- // we will move the arrow later
- this.arrow = $('<div/>').addClass('pretooltiparrow');
- this.tooltip.append(this.buttons);
- this.tooltip.append(this.arrow);
- this.tooltip.append(this.text);
- // function that will be called if you press tab 1, 2, 3... times in a row
- this.tabs_functions = [function (cell, text, cursor) {
- that._request_tooltip(cell, text, cursor);
- }, function () {
- that.expand();
- }, function () {
- that.stick();
- }, function (cell) {
- that.cancel_stick();
- that.showInPager(cell);
- }];
- // call after all the tabs function above have bee call to clean their effects
- // if necessary
- this.reset_tabs_function = function (cell, text) {
- this._old_cell = (cell) ? cell : null;
- this._old_request = (text) ? text : null;
- this._consecutive_counter = 0;
- };
- };
- Tooltip.prototype.is_visible = function () {
- return !this._hidden;
- };
- Tooltip.prototype.showInPager = function (cell) {
- /**
- * reexecute last call in pager by appending ? to show back in pager
- */
- this.events.trigger('open_with_text.Pager', this._reply.content);
- this.remove_and_cancel_tooltip();
- };
- // grow the tooltip vertically
- Tooltip.prototype.expand = function () {
- this.text.removeClass('smalltooltip');
- this.text.addClass('bigtooltip');
- $('#expanbutton').hide('slow');
- };
- // deal with all the logic of hiding the tooltip
- // and reset its status
- Tooltip.prototype._hide = function () {
- this._hidden = true;
- this.tooltip.fadeOut('fast');
- $('#expanbutton').show('slow');
- this.text.removeClass('bigtooltip');
- this.text.addClass('smalltooltip');
- // keep scroll top to be sure to always see the first line
- this.text.scrollTop(0);
- this.code_mirror = null;
- };
- // return true on successfully removing a visible tooltip; otherwise return
- // false.
- Tooltip.prototype.remove_and_cancel_tooltip = function (force) {
- /**
- * note that we don't handle closing directly inside the calltip
- * as in the completer, because it is not focusable, so won't
- * get the event.
- */
- this.cancel_pending();
- if (!this._hidden) {
- if (force || !this._sticky) {
- this.cancel_stick();
- this._hide();
- }
- this.reset_tabs_function();
- return true;
- } else {
- return false;
- }
- };
- // cancel autocall done after '(' for example.
- Tooltip.prototype.cancel_pending = function () {
- if (this._tooltip_timeout !== null) {
- clearTimeout(this._tooltip_timeout);
- this._tooltip_timeout = null;
- }
- };
- // will trigger tooltip after timeout
- Tooltip.prototype.pending = function (cell, hide_if_no_docstring) {
- var that = this;
- this._tooltip_timeout = setTimeout(function () {
- that.request(cell, hide_if_no_docstring);
- }, that.time_before_tooltip);
- };
- // easy access for julia monkey patching.
- Tooltip.last_token_re = /[a-z_][0-9a-z._]*$/gi;
- Tooltip.prototype._request_tooltip = function (cell, text, cursor_pos) {
- var callbacks = $.proxy(this._show, this);
- var msg_id = cell.kernel.inspect(text, cursor_pos, callbacks);
- };
- // make an immediate completion request
- Tooltip.prototype.request = function (cell, hide_if_no_docstring) {
- /**
- * request(codecell)
- * Deal with extracting the text from the cell and counting
- * call in a row
- */
- this.cancel_pending();
- var editor = cell.code_mirror;
- var cursor = editor.getCursor();
- var text = cell.get_text();
- var cursor_pos = utils.js_idx_to_char_idx(editor.indexFromPos(cursor), text);
- this._hide_if_no_docstring = hide_if_no_docstring;
- if(editor.somethingSelected()){
- // get only the most recent selection.
- text = editor.getSelection();
- }
- // need a permanent handle to code_mirror for future auto recall
- this.code_mirror = editor;
- // now we treat the different number of keypress
- // first if same cell, same text, increment counter by 1
- if (this._old_cell == cell && this._old_request == text && this._hidden === false) {
- this._consecutive_counter++;
- } else {
- // else reset
- this.cancel_stick();
- this.reset_tabs_function (cell, text);
- }
- this.tabs_functions[this._consecutive_counter](cell, text, cursor_pos);
- // then if we are at the end of list function, reset
- if (this._consecutive_counter == this.tabs_functions.length) {
- this.reset_tabs_function (cell, text, cursor);
- }
- return;
- };
- // cancel the option of having the tooltip to stick
- Tooltip.prototype.cancel_stick = function () {
- clearTimeout(this._stick_timeout);
- this._stick_timeout = null;
- this._clocklink.hide('slow');
- this._sticky = false;
- };
- // put the tooltip in a sticky state for 10 seconds
- // it won't be removed by remove_and_cancel() unless you called with
- // the first parameter set to true.
- // remove_and_cancel_tooltip(true)
- Tooltip.prototype.stick = function (time) {
- time = (time !== undefined) ? time : 10;
- var that = this;
- this._sticky = true;
- this._clocklink.show('slow');
- this._stick_timeout = setTimeout(function () {
- that._sticky = false;
- that._clocklink.hide('slow');
- }, time * 1000);
- };
- // should be called with the kernel reply to actually show the tooltip
- Tooltip.prototype._show = function (reply) {
- /**
- * move the bubble if it is not hidden
- * otherwise fade it
- */
- this._reply = reply;
- var content = reply.content;
- if (!content.found) {
- // object not found, nothing to show
- return;
- }
- this.name = content.name;
- // do some math to have the tooltip arrow on more or less on left or right
- // position of the editor
- var cm_pos = $(this.code_mirror.getWrapperElement()).position();
- var cell_pos = $(this.code_mirror.getWrapperElement().offsetParent).position();
- // anchor and head positions are local within CodeMirror element
- var anchor = this.code_mirror.cursorCoords(false, 'local');
- var head = this.code_mirror.cursorCoords(true, 'local');
- // locate the target at the center of anchor, head
- var center_left = (head.left + anchor.left) / 2;
- // locate the left edge of the tooltip, at most 450 px left of the arrow
- var edge_left = Math.max(center_left - 450, 0);
- // locate the arrow at the cursor. A 24 px offset seems necessary.
- var arrow_left = center_left - edge_left - 24;
-
- // locate left, top within container element
- var left = (cell_pos.left + cm_pos.left + edge_left) + 'px';
- var top = (cell_pos.top + cm_pos.top + head.bottom + 10) + 'px';
- if (this._hidden === false) {
- this.tooltip.animate({
- left: left,
- top: top
- });
- } else {
- this.tooltip.css({
- left: left
- });
- this.tooltip.css({
- top: top
- });
- }
- this.arrow.animate({
- 'left': arrow_left + 'px'
- });
-
- this._hidden = false;
- this.tooltip.fadeIn('fast');
- this.text.children().remove();
-
- // This should support rich data types, but only text/plain for now
- // Any HTML within the docstring is escaped by the fixConsole() method.
- var pre = $('<pre/>').html(utils.fixConsole(content.data['text/plain']));
- this.text.append(pre);
- // keep scroll top to be sure to always see the first line
- this.text.scrollTop(0);
- };
- return {'Tooltip': Tooltip};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/celltoolbarpresets/default',[
- 'notebook/js/celltoolbar',
- 'base/js/dialog',
- 'base/js/i18n'
- ], function(celltoolbar, dialog, i18n) {
- "use strict";
- var CellToolbar = celltoolbar.CellToolbar;
- var raw_edit = function (cell , edit_metadata_button) {
- dialog.edit_metadata({
- md: cell.metadata,
- callback: function (md) {
- cell.metadata = md;
- },
- name: i18n.msg._('Cell'),
- notebook: this.notebook,
- keyboard_manager: this.keyboard_manager,
- edit_metadata_button: edit_metadata_button
- });
- };
- var add_raw_edit_button = function(div, cell) {
- var button_container = $(div);
- var button = $('<button/>')
- .addClass("btn btn-default btn-xs")
- .text(i18n.msg._("Edit Metadata"))
- .click( function () {
- raw_edit(cell, this);
- return false;
- });
- button_container.append(button);
- };
- var register = function (notebook) {
- CellToolbar.register_callback('default.rawedit', add_raw_edit_button);
- raw_edit = $.proxy(raw_edit, {
- notebook: notebook,
- keyboard_manager: notebook.keyboard_manager
- });
- var example_preset = [];
- example_preset.push('default.rawedit');
- CellToolbar.register_preset(i18n.msg._('Edit Metadata'), example_preset, notebook);
- };
- return {'register': register};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/celltoolbarpresets/rawcell',[
- 'notebook/js/celltoolbar',
- 'base/js/dialog',
- 'base/js/keyboard',
- 'base/js/i18n'
- ], function(celltoolbar, dialog, keyboard, i18n) {
- "use strict";
- var CellToolbar = celltoolbar.CellToolbar;
- var raw_cell_preset = [];
- var select_type = CellToolbar.utils.select_ui_generator([
- [i18n.msg._("None"), "-"],
- ["LaTeX", "text/latex"],
- ["reST", "text/restructuredtext"],
- ["HTML", "text/html"],
- ["Markdown", "text/markdown"],
- ["Python", "text/x-python"],
- [i18n.msg._("Custom"), "dialog"],
- ],
- // setter
- function(cell, value) {
- if (value === "-") {
- delete cell.metadata.raw_mimetype;
- } else if (value === 'dialog') {
- var message =
- i18n.msg._("Set the MIME type of the raw cell:");
- var mimeinput = $('<input/>')
- .attr('type', 'text')
- .attr('size', '25')
- .attr('name', 'mimetype')
- .val(cell.metadata.raw_mimetype || "-");
- var dialogform = $('<div/>').attr('title', i18n.msg._("Edit MIME type"))
- .append(
- $('<form/>').append(
- $('<fieldset/>').append(
- $('<label/>')
- .attr('for', 'mimetype')
- .text(message)
- )
- .append($('<br/>'))
- .append(mimeinput)
- )
- );
- dialog.modal({
- title: i18n.msg._("Raw Cell MIME Type"),
- body: dialogform,
- buttons : {
- Cancel: {},
- OK: {
- class: "btn-primary",
- click: function () {
- console.log(cell);
- cell.metadata.raw_mimetype = $(this).find('input').val();
- console.log(cell.metadata);
- }
- }
- },
- notebook: cell.notebook,
- keyboard_manager: cell.keyboard_manager,
- open : function (event, ui) {
- var that = $(this);
- // Upon ENTER, click the OK button.
- that.find('input[type="text"]').keydown(function (event, ui) {
- if (event.which === keyboard.keycodes.enter) {
- that.find('.btn-primary').first().click();
- return false;
- }
- });
- that.find('input[type="text"]').focus().select();
- }
- });
- } else {
- cell.metadata.raw_mimetype = value;
- }
- },
- //getter
- function(cell) {
- return cell.metadata.raw_mimetype || "";
- },
- // name
- i18n.msg._("Raw NBConvert Format")
- );
- var register = function (notebook) {
- CellToolbar.register_callback('raw_cell.select', select_type, ['raw']);
- raw_cell_preset.push('raw_cell.select');
- CellToolbar.register_preset(i18n.msg._('Raw Cell Format'), raw_cell_preset, notebook);
- };
- return {'register': register};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/celltoolbarpresets/slideshow',[
- 'notebook/js/celltoolbar',
- 'base/js/i18n'
- ], function(celltoolbar, i18n) {
- "use strict";
- var CellToolbar = celltoolbar.CellToolbar;
- var slideshow_preset = [];
- var select_type = CellToolbar.utils.select_ui_generator([
- ["-" ,"-" ],
- [i18n.msg._("Slide") ,"slide" ],
- [i18n.msg._("Sub-Slide") ,"subslide" ],
- [i18n.msg._("Fragment") ,"fragment" ],
- [i18n.msg._("Skip") ,"skip" ],
- [i18n.msg._("Notes") ,"notes" ],
- ],
- // setter
- function(cell, value){
- // we check that the slideshow namespace exist and create it if needed
- if (cell.metadata.slideshow === undefined){cell.metadata.slideshow = {};}
- // set the value
- cell.metadata.slideshow.slide_type = value;
- },
- // getter
- function(cell){ var ns = cell.metadata.slideshow;
- // if the slideshow namespace does not exist return `undefined`
- // (will be interpreted as `false` by checkbox) otherwise
- // return the value
- return (ns === undefined)? undefined: ns.slide_type;
- },
- i18n.msg._("Slide Type"));
- var register = function (notebook) {
- CellToolbar.register_callback('slideshow.select',select_type);
- slideshow_preset.push('slideshow.select');
- CellToolbar.register_preset(i18n.msg._('Slideshow'),slideshow_preset, notebook);
- };
- return {'register': register};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/celltoolbarpresets/attachments',[
- 'notebook/js/celltoolbar',
- 'base/js/dialog',
- 'base/js/i18n'
- ], function(celltoolbar, dialog, i18n) {
- "use strict";
- var CellToolbar = celltoolbar.CellToolbar;
- var edit_attachments_dialog = function(cell) {
- dialog.edit_attachments({
- attachments: cell.attachments,
- callback: function(attachments) {
- cell.attachments = attachments;
- // Force cell refresh
- cell.unrender();
- cell.render();
- },
- name: 'Cell',
- notebook: cell.notebook,
- keyboard_manager: cell.keyboard_manager
- });
- };
- var add_dialog_button = function(div, cell) {
- var button_container = $(div);
- var button = $('<button />')
- .addClass('btn btn-default btn-xs')
- .text(i18n.msg._('Edit Attachments'))
- .click( function() {
- edit_attachments_dialog(cell);
- return false;
- });
- button_container.append(button);
- };
- var register = function(notebook) {
- CellToolbar.register_callback('attachments.edit', add_dialog_button);
- var attachments_preset = [];
- attachments_preset.push('attachments.edit');
- CellToolbar.register_preset(i18n.msg._('Attachments'), attachments_preset, notebook);
- };
- return {'register' : register};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/celltoolbarpresets/tags',[
- 'notebook/js/celltoolbar',
- 'base/js/dialog',
- 'base/js/i18n'
- ], function(celltoolbar, dialog, i18n) {
- "use strict";
- var CellToolbar = celltoolbar.CellToolbar;
- var array_difference = function(a, b) {
- return a.filter(function(n) {
- return b.indexOf(n) === -1;
- });
- };
- var write_tag = function(cell, name, add) {
- if (add) {
- // Add to metadata
- if (cell.metadata.tags === undefined) {
- cell.metadata.tags = [];
- } else if (cell.metadata.tags.indexOf(name) !== -1) {
- // Tag already exists
- return false;
- }
- cell.metadata.tags.push(name);
- } else {
- // Remove from metadata
- if (!cell.metadata || !cell.metadata.tags) {
- // No tags to remove
- return false;
- }
- // Remove tag from tags list
- var index = cell.metadata.tags.indexOf(name);
- if (index !== -1) {
- cell.metadata.tags.splice(index, 1);
- }
- // If tags list is empty, remove it
- if (cell.metadata.tags.length === 0) {
- delete cell.metadata.tags;
- }
- }
- cell.events.trigger('set_dirty.Notebook', {value: true});
- return true;
- };
- var preprocess_input = function(input) {
- // Split on whitespace + commas:
- return input.split(/[,\s]+/)
- };
- var add_tag = function(cell, tag_container, on_remove) {
- return function(name) {
- if (name === '') {
- // Skip empty strings
- return;
- }
- // Write tag to metadata
- var changed = write_tag(cell, name, true);
- if (changed) {
- // Make tag UI
- var tag = make_tag(name, on_remove, cell.is_editable());
- tag_container.append(tag);
- var tag_map = jQuery.data(tag_container, "tag_map") || {};
- tag_map[name] = tag;
- jQuery.data(tag_container, 'tag_map', tag_map);
- }
- };
- };
- var remove_tag = function(cell, tag_container) {
- return function(name) {
- var changed = write_tag(cell, name, false);
- if (changed) {
- // Remove tag UI
- var tag_map = jQuery.data(tag_container, "tag_map") || {};
- var tag_UI = tag_map[name];
- delete tag_map[name];
- tag_UI.remove();
- }
- };
- };
- var init_tag_container = function(cell, tag_container, on_remove) {
- var tag_list = cell.metadata.tags || [];
- if (!Array.isArray(tag_list)) {
- // We cannot make tags UI for this cell!
- // Maybe someone else used "tags" for something?
- return false; // Fail gracefully
- }
- var tag_map = {};
- for (var i=0; i < tag_list.length; ++i) {
- var tag_name = tag_list[i];
- if (typeof tag_name !== 'string') {
- // Unexpected type, disable toolbar for safety
- return false;
- }
- var tag = make_tag(tag_name, on_remove, cell.is_editable());
- tag_container.append(tag);
- tag_map[tag_name] = tag;
- }
- jQuery.data(tag_container, 'tag_map', tag_map);
- return true;
- };
- var make_tag = function(name, on_remove, is_editable) {
- var tag_UI = $('<span/>')
- .addClass('cell-tag')
- .text(name);
- if(is_editable){
- var remove_button = $('<i/>')
- .addClass('remove-tag-btn')
- .addClass('fa fa-times')
- .click(function () {
- on_remove(name);
- return false;
- });
- tag_UI.append(remove_button);
- }
- return tag_UI;
- };
- // Single edit with button to add tags
- var add_tag_edit = function(div, cell, on_add, on_remove) {
- var button_container = $(div);
- var text = $('<input/>').attr('type', 'text');
- var button = $('<button />')
- .addClass('btn btn-default btn-xs')
- .text(i18n.msg._('Add tag'))
- .click(function() {
- var tags = preprocess_input(text[0].value);
- for (var i=0; i < tags.length; ++i) {
- on_add(tags[i]);
- }
- // Clear input after adding:
- text[0].value = '';
- return false;
- });
- // Wire enter in input to button click
- text.keyup(function(event){
- if(event.keyCode == 13){
- button.click();
- }
- });
- var input_container = $('<span/>')
- .addClass('tags-input');
- add_dialog_button(input_container, cell, on_add, on_remove);
- button_container.append(input_container
- .append(text)
- .append(button)
- );
- IPython.keyboard_manager.register_events(text);
- };
- var tag_dialog = function(cell, on_add, on_remove) {
- var tag_list = cell.metadata.tags || [];
- var message =
- i18n.msg._("Edit the list of tags below. All whitespace " +
- "is treated as tag separators.");
- var textarea = $('<textarea/>')
- .attr('aria-label', i18n.msg._('Edit the tags in the text area'))
- .attr('rows', '13')
- .attr('cols', '80')
- .attr('name', 'tags')
- .text(tag_list.join('\n'));
- var dialogform = $('<div/>').attr('title', i18n.msg._('Edit the tags'))
- .append(
- $('<form/>').append(
- $('<fieldset/>').append(
- $('<label/>')
- .attr('for','tags')
- .text(message)
- )
- .append($('<br/>'))
- .append(textarea)
- )
- );
- var modal_obj = dialog.modal({
- title: i18n.msg._("Edit Tags"),
- body: dialogform,
- default_button: "Cancel",
- buttons: {
- Cancel: {},
- Edit: { class : "btn-primary",
- click: function() {
- var old_tags = cell.metadata.tags || [];
- var new_tags = preprocess_input(textarea[0].value);
- var added_tags = array_difference(new_tags, old_tags);
- var removed_tags = array_difference(old_tags, new_tags);
- for (var i=0; i < added_tags.length; ++i) {
- on_add(added_tags[i]);
- }
- for (var i=0; i < removed_tags.length; ++i) {
- on_remove(removed_tags[i]);
- }
- }
- }
- },
- notebook: cell.notebook,
- keyboard_manager: cell.keyboard_manager,
- });
- };
- var add_dialog_button = function(container, cell, on_add, on_remove) {
- var button = $('<button />')
- .addClass('btn btn-default btn-xs tags-dialog-btn')
- .text('...')
- .click( function() {
- tag_dialog(cell, on_add, on_remove);
- return false;
- });
- container.append(button);
- };
- var add_tags_cellbar = function(div, cell) {
- var button_container = $(div);
- button_container.addClass('tags_button_container');
- var tag_container = $('<span/>').
- addClass('tag-container');
- var on_remove = remove_tag(cell, tag_container);
- var ok = init_tag_container(cell, tag_container, on_remove);
- if (!ok) {
- return;
- }
- button_container.append(tag_container);
- var on_add = add_tag(cell, tag_container, on_remove);
- if(cell.is_editable()){
- add_tag_edit(div, cell, on_add, on_remove);
- }
- };
- var register = function(notebook) {
- CellToolbar.register_callback('tags.edit', add_tags_cellbar);
- var tags_preset = [];
- tags_preset.push('tags.edit');
- CellToolbar.register_preset('Tags', tags_preset, notebook);
- };
- return {'register' : register};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/scrollmanager',['jquery'], function($) {
- "use strict";
- var ScrollManager = function(notebook, options) {
- /**
- * Public constructor.
- */
- this.notebook = notebook;
- this.element = $('#site');
- options = options || {};
- this.animation_speed = options.animation_speed || 250; //ms
- };
- ScrollManager.prototype.onScroll = function (func, rate) {
- /**
- * Register a function to be called when the page is scrolled, throttled
- * at a particular rate limit.
- */
- rate = rate || 100; // default rate limit
- this.element.scroll(function () {
- clearTimeout(func._timeout);
- func._timeout = setTimeout(func, rate);
- });
- };
- ScrollManager.prototype.scroll = function (delta) {
- /**
- * Scroll the document.
- *
- * Parameters
- * ----------
- * delta: integer
- * direction to scroll the document. Positive is downwards.
- * Unit is one page length.
- */
- this.scroll_some(delta);
- return false;
- };
- ScrollManager.prototype.scroll_to = function(selector) {
- /**
- * Scroll to an element in the notebook.
- */
- this.element.animate({'scrollTop': $(selector).offset().top + this.element.scrollTop() - this.element.offset().top}, this.animation_speed);
- };
- ScrollManager.prototype.scroll_some = function(pages) {
- /**
- * Scroll up or down a given number of pages.
- *
- * Parameters
- * ----------
- * pages: integer
- * number of pages to scroll the document, may be positive or negative.
- */
- this.element.animate({'scrollTop': this.element.scrollTop() + pages * this.element.height()}, this.animation_speed);
- };
- ScrollManager.prototype.get_first_visible_cell = function() {
- /**
- * Gets the index of the first visible cell in the document.
- *
- * First, attempt to be smart by guessing the index of the cell we are
- * scrolled to. Then, walk from there up or down until the right cell
- * is found. To guess the index, get the top of the last cell, and
- * divide that by the number of cells to get an average cell height.
- * Then divide the scroll height by the average cell height.
- */
- var cell_count = this.notebook.ncells();
- var first_cell_top = this.notebook.get_cell(0).element.offset().top;
- var last_cell_top = this.notebook.get_cell(cell_count-1).element.offset().top;
- var avg_cell_height = (last_cell_top - first_cell_top) / cell_count;
- var i = Math.ceil(this.element.scrollTop() / avg_cell_height);
- i = Math.min(Math.max(i , 0), cell_count - 1);
- while (this.notebook.get_cell(i).element.offset().top - first_cell_top < this.element.scrollTop() && i < cell_count - 1) {
- i += 1;
- }
- while (this.notebook.get_cell(i).element.offset().top - first_cell_top > this.element.scrollTop() - 50 && i >= 0) {
- i -= 1;
- }
- return Math.min(i + 1, cell_count - 1);
- };
- ScrollManager.prototype.is_cell_visible = function (cell) {
- var cell_rect = cell.element[0].getBoundingClientRect();
- var scroll_rect = this.element[0].getBoundingClientRect();
- return ((cell_rect.top <= scroll_rect.bottom) && (cell_rect.bottom >= scroll_rect.top));
- };
- var TargetScrollManager = function(notebook, options) {
- /**
- * Public constructor.
- */
- ScrollManager.apply(this, [notebook, options]);
- };
- TargetScrollManager.prototype = Object.create(ScrollManager.prototype);
- TargetScrollManager.prototype.is_target = function (index) {
- /**
- * Check if a cell should be a scroll stop.
- *
- * Returns `true` if the cell is a cell that the scroll manager
- * should scroll to. Otherwise, false is returned.
- *
- * Parameters
- * ----------
- * index: integer
- * index of the cell to test.
- */
- return false;
- };
- TargetScrollManager.prototype.scroll = function (delta) {
- /**
- * Scroll the document.
- *
- * Parameters
- * ----------
- * delta: integer
- * direction to scroll the document. Positive is downwards.
- * Units are targets.
- *
- * Try to scroll to the next slide.
- */
- var cell_count = this.notebook.ncells();
- var selected_index = this.get_first_visible_cell() + delta;
- while (0 <= selected_index && selected_index < cell_count && !this.is_target(selected_index)) {
- selected_index += delta;
- }
- if (selected_index < 0 || cell_count <= selected_index) {
- return ScrollManager.prototype.scroll.apply(this, [delta]);
- } else {
- this.scroll_to(this.notebook.get_cell(selected_index).element);
-
- // Cancel browser keyboard scroll.
- return false;
- }
- };
- var SlideScrollManager = function(notebook, options) {
- /**
- * Public constructor.
- */
- TargetScrollManager.apply(this, [notebook, options]);
- };
- SlideScrollManager.prototype = Object.create(TargetScrollManager.prototype);
- SlideScrollManager.prototype.is_target = function (index) {
- var cell = this.notebook.get_cell(index);
- return cell.metadata && cell.metadata.slideshow &&
- cell.metadata.slideshow.slide_type &&
- (cell.metadata.slideshow.slide_type === "slide" ||
- cell.metadata.slideshow.slide_type === "subslide");
- };
- var HeadingScrollManager = function(notebook, options) {
- /**
- * Public constructor.
- */
- ScrollManager.apply(this, [notebook, options]);
- options = options || {};
- this._level = options.heading_level || 1;
- };
- HeadingScrollManager.prototype = Object.create(ScrollManager.prototype);
- HeadingScrollManager.prototype.scroll = function (delta) {
- /**
- * Scroll the document.
- *
- * Parameters
- * ----------
- * delta: integer
- * direction to scroll the document. Positive is downwards.
- * Units are headers.
- *
- * Get all of the header elements that match the heading level or are of
- * greater magnitude (a smaller header number).
- */
- var headers = $();
- var i;
- for (i = 1; i <= this._level; i++) {
- headers = headers.add('#notebook-container h' + i);
- }
- // Find the header the user is on or below.
- var first_cell_top = this.notebook.get_cell(0).element.offset().top;
- var current_scroll = this.element.scrollTop();
- var header_scroll = 0;
- i = -1;
- while (current_scroll >= header_scroll && i < headers.length) {
- if (++i < headers.length) {
- header_scroll = $(headers[i]).offset().top - first_cell_top;
- }
- }
- i--;
- // Check if the user is below the header.
- if (i < 0 || current_scroll > $(headers[i]).offset().top - first_cell_top + 30) {
- // Below the header, count the header as a target.
- if (delta < 0) {
- delta += 1;
- }
- }
- i += delta;
- // Scroll!
- if (0 <= i && i < headers.length) {
- this.scroll_to(headers[i]);
- return false;
- } else {
- // Default to the base's scroll behavior when target header doesn't
- // exist.
- return ScrollManager.prototype.scroll.apply(this, [delta]);
- }
- };
- // Return namespace for require.js loads
- return {
- 'ScrollManager': ScrollManager,
- 'SlideScrollManager': SlideScrollManager,
- 'HeadingScrollManager': HeadingScrollManager,
- 'TargetScrollManager': TargetScrollManager
- };
- });
- /*!
- * jQuery Typeahead
- * Copyright (C) 2019 RunningCoder.org
- * Licensed under the MIT license
- *
- * @author Tom Bertrand
- * @version 2.10.7 (2019-10-19)
- * @link http://www.runningcoder.org/jquerytypeahead/
- */
- !function(e){var t;"function"==typeof define&&define.amd?define("jquery-typeahead",["jquery"],function(t){return e(t)}):"object"==typeof module&&module.exports?module.exports=(void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(void 0)),e(t)):e(jQuery)}(function(j){"use strict";function r(t,e){this.rawQuery=t.val()||"",this.query=t.val()||"",this.selector=t[0].selector,this.deferred=null,this.tmpSource={},this.source={},this.dynamicGroups=[],this.hasDynamicGroups=!1,this.generatedGroupCount=0,this.groupBy="group",this.groups=[],this.searchGroups=[],this.generateGroups=[],this.requestGroups=[],this.result=[],this.tmpResult={},this.groupTemplate="",this.resultHtml=null,this.resultCount=0,this.resultCountPerGroup={},this.options=e,this.node=t,this.namespace="."+this.helper.slugify.call(this,this.selector)+".typeahead",this.isContentEditable=void 0!==this.node.attr("contenteditable")&&"false"!==this.node.attr("contenteditable"),this.container=null,this.resultContainer=null,this.item=null,this.items=null,this.comparedItems=null,this.xhr={},this.hintIndex=null,this.filters={dropdown:{},dynamic:{}},this.dropdownFilter={static:[],dynamic:[]},this.dropdownFilterAll=null,this.isDropdownEvent=!1,this.requests={},this.backdrop={},this.hint={},this.label={},this.hasDragged=!1,this.focusOnly=!1,this.displayEmptyTemplate,this.__construct()}var i,s={input:null,minLength:2,maxLength:!(window.Typeahead={version:"2.10.7"}),maxItem:8,dynamic:!1,delay:300,order:null,offset:!1,hint:!1,accent:!1,highlight:!0,multiselect:null,group:!1,groupOrder:null,maxItemPerGroup:null,dropdownFilter:!1,dynamicFilter:null,backdrop:!1,backdropOnFocus:!1,cache:!1,ttl:36e5,compression:!1,searchOnFocus:!1,blurOnTab:!0,resultContainer:null,generateOnLoad:null,mustSelectItem:!1,href:null,display:["display"],template:null,templateValue:null,groupTemplate:null,correlativeTemplate:!1,emptyTemplate:!1,cancelButton:!0,loadingAnimation:!0,filter:!0,matcher:null,source:null,callback:{onInit:null,onReady:null,onShowLayout:null,onHideLayout:null,onSearch:null,onResult:null,onLayoutBuiltBefore:null,onLayoutBuiltAfter:null,onNavigateBefore:null,onNavigateAfter:null,onEnter:null,onLeave:null,onClickBefore:null,onClickAfter:null,onDropdownFilter:null,onSendRequest:null,onReceiveRequest:null,onPopulateSource:null,onCacheSave:null,onSubmit:null,onCancel:null},selector:{container:"typeahead__container",result:"typeahead__result",list:"typeahead__list",group:"typeahead__group",item:"typeahead__item",empty:"typeahead__empty",display:"typeahead__display",query:"typeahead__query",filter:"typeahead__filter",filterButton:"typeahead__filter-button",dropdown:"typeahead__dropdown",dropdownItem:"typeahead__dropdown-item",labelContainer:"typeahead__label-container",label:"typeahead__label",button:"typeahead__button",backdrop:"typeahead__backdrop",hint:"typeahead__hint",cancelButton:"typeahead__cancel-button"},debug:!1},o={from:"ãàáäâẽèéëêìíïîõòóöôùúüûñç",to:"aaaaaeeeeeiiiiooooouuuunc"},n=~window.navigator.appVersion.indexOf("MSIE 9."),a=~window.navigator.appVersion.indexOf("MSIE 10"),l=!!~window.navigator.userAgent.indexOf("Trident")&&~window.navigator.userAgent.indexOf("rv:11");r.prototype={_validateCacheMethod:function(t){var e;if(!0===t)t="localStorage";else if("string"==typeof t&&!~["localStorage","sessionStorage"].indexOf(t))return!1;e=void 0!==window[t];try{window[t].setItem("typeahead","typeahead"),window[t].removeItem("typeahead")}catch(t){e=!1}return e&&t||!1},extendOptions:function(){if(this.options.cache=this._validateCacheMethod(this.options.cache),this.options.compression&&("object"==typeof LZString&&this.options.cache||(this.options.compression=!1)),this.options.maxLength&&!isNaN(this.options.maxLength)||(this.options.maxLength=1/0),void 0!==this.options.maxItem&&~[0,!1].indexOf(this.options.maxItem)&&(this.options.maxItem=1/0),this.options.maxItemPerGroup&&!/^\d+$/.test(this.options.maxItemPerGroup)&&(this.options.maxItemPerGroup=null),this.options.display&&!Array.isArray(this.options.display)&&(this.options.display=[this.options.display]),this.options.multiselect&&(this.items=[],this.comparedItems=[],"string"==typeof this.options.multiselect.matchOn&&(this.options.multiselect.matchOn=[this.options.multiselect.matchOn])),this.options.group&&(Array.isArray(this.options.group)||("string"==typeof this.options.group?this.options.group={key:this.options.group}:"boolean"==typeof this.options.group&&(this.options.group={key:"group"}),this.options.group.key=this.options.group.key||"group")),this.options.highlight&&!~["any",!0].indexOf(this.options.highlight)&&(this.options.highlight=!1),this.options.dropdownFilter&&this.options.dropdownFilter instanceof Object){Array.isArray(this.options.dropdownFilter)||(this.options.dropdownFilter=[this.options.dropdownFilter]);for(var t=0,e=this.options.dropdownFilter.length;t<e;++t)this.dropdownFilter[this.options.dropdownFilter[t].value?"static":"dynamic"].push(this.options.dropdownFilter[t])}this.options.dynamicFilter&&!Array.isArray(this.options.dynamicFilter)&&(this.options.dynamicFilter=[this.options.dynamicFilter]),this.options.accent&&("object"==typeof this.options.accent?this.options.accent.from&&this.options.accent.to&&(this.options.accent.from.length,this.options.accent.to.length):this.options.accent=o),this.options.groupTemplate&&(this.groupTemplate=this.options.groupTemplate),this.options.resultContainer&&("string"==typeof this.options.resultContainer&&(this.options.resultContainer=j(this.options.resultContainer)),this.options.resultContainer instanceof j&&this.options.resultContainer[0]&&(this.resultContainer=this.options.resultContainer)),this.options.group&&this.options.group.key&&(this.groupBy=this.options.group.key),this.options.callback&&this.options.callback.onClick&&(this.options.callback.onClickBefore=this.options.callback.onClick,delete this.options.callback.onClick),this.options.callback&&this.options.callback.onNavigate&&(this.options.callback.onNavigateBefore=this.options.callback.onNavigate,delete this.options.callback.onNavigate),this.options=j.extend(!0,{},s,this.options)},unifySourceFormat:function(){var t,e,i;for(t in this.dynamicGroups=[],Array.isArray(this.options.source)&&(this.options.source={group:{data:this.options.source}}),"string"==typeof this.options.source&&(this.options.source={group:{ajax:{url:this.options.source}}}),this.options.source.ajax&&(this.options.source={group:{ajax:this.options.source.ajax}}),(this.options.source.url||this.options.source.data)&&(this.options.source={group:this.options.source}),this.options.source)if(this.options.source.hasOwnProperty(t)){if("string"==typeof(e=this.options.source[t])&&(e={ajax:{url:e}}),i=e.url||e.ajax,Array.isArray(i)?(e.ajax="string"==typeof i[0]?{url:i[0]}:i[0],e.ajax.path=e.ajax.path||i[1]||null):"object"==typeof e.url?e.ajax=e.url:"string"==typeof e.url&&(e.ajax={url:e.url}),delete e.url,!e.data&&!e.ajax)return!1;e.display&&!Array.isArray(e.display)&&(e.display=[e.display]),e.minLength="number"==typeof e.minLength?e.minLength:this.options.minLength,e.maxLength="number"==typeof e.maxLength?e.maxLength:this.options.maxLength,e.dynamic="boolean"==typeof e.dynamic||this.options.dynamic,e.minLength>e.maxLength&&(e.minLength=e.maxLength),this.options.source[t]=e,this.options.source[t].dynamic&&this.dynamicGroups.push(t),e.cache=void 0!==e.cache?this._validateCacheMethod(e.cache):this.options.cache,e.compression&&("object"==typeof LZString&&e.cache||(e.compression=!1))}return this.hasDynamicGroups=this.options.dynamic||!!this.dynamicGroups.length,!0},init:function(){this.helper.executeCallback.call(this,this.options.callback.onInit,[this.node]),this.container=this.node.closest("."+this.options.selector.container)},delegateEvents:function(){var i=this,t=["focus"+this.namespace,"input"+this.namespace,"propertychange"+this.namespace,"keydown"+this.namespace,"keyup"+this.namespace,"search"+this.namespace,"generate"+this.namespace];j("html").on("touchmove",function(){i.hasDragged=!0}).on("touchstart",function(){i.hasDragged=!1}),this.node.closest("form").on("submit",function(t){if(!i.options.mustSelectItem||!i.helper.isEmpty(i.item))return i.options.backdropOnFocus||i.hideLayout(),i.options.callback.onSubmit?i.helper.executeCallback.call(i,i.options.callback.onSubmit,[i.node,this,i.item||i.items,t]):void 0;t.preventDefault()}).on("reset",function(){setTimeout(function(){i.node.trigger("input"+i.namespace),i.hideLayout()})});var s=!1;if(this.node.attr("placeholder")&&(a||l)){var e=!0;this.node.on("focusin focusout",function(){e=!(this.value||!this.placeholder)}),this.node.on("input",function(t){e&&(t.stopImmediatePropagation(),e=!1)})}this.node.off(this.namespace).on(t.join(" "),function(t,e){switch(t.type){case"generate":i.generateSource(Object.keys(i.options.source));break;case"focus":if(i.focusOnly){i.focusOnly=!1;break}i.options.backdropOnFocus&&(i.buildBackdropLayout(),i.showLayout()),i.options.searchOnFocus&&!i.item&&(i.deferred=j.Deferred(),i.assignQuery(),i.generateSource());break;case"keydown":8===t.keyCode&&i.options.multiselect&&i.options.multiselect.cancelOnBackspace&&""===i.query&&i.items.length?i.cancelMultiselectItem(i.items.length-1,null,t):t.keyCode&&~[9,13,27,38,39,40].indexOf(t.keyCode)&&(s=!0,i.navigate(t));break;case"keyup":n&&i.node[0].value.replace(/^\s+/,"").toString().length<i.query.length&&i.node.trigger("input"+i.namespace);break;case"propertychange":if(s){s=!1;break}case"input":i.deferred=j.Deferred(),i.assignQuery(),""===i.rawQuery&&""===i.query&&(t.originalEvent=e||{},i.helper.executeCallback.call(i,i.options.callback.onCancel,[i.node,i.item,t]),i.item=null),i.options.cancelButton&&i.toggleCancelButtonVisibility(),i.options.hint&&i.hint.container&&""!==i.hint.container.val()&&0!==i.hint.container.val().indexOf(i.rawQuery)&&(i.hint.container.val(""),i.isContentEditable&&i.hint.container.text("")),i.hasDynamicGroups?i.helper.typeWatch(function(){i.generateSource()},i.options.delay):i.generateSource();break;case"search":i.searchResult(),i.buildLayout(),i.result.length||i.searchGroups.length&&i.displayEmptyTemplate?i.showLayout():i.hideLayout(),i.deferred&&i.deferred.resolve()}return i.deferred&&i.deferred.promise()}),this.options.generateOnLoad&&this.node.trigger("generate"+this.namespace)},assignQuery:function(){this.isContentEditable?this.rawQuery=this.node.text():this.rawQuery=this.node.val().toString(),this.rawQuery=this.rawQuery.replace(/^\s+/,""),this.rawQuery!==this.query&&(this.query=this.rawQuery)},filterGenerateSource:function(){if(this.searchGroups=[],this.generateGroups=[],!this.focusOnly||this.options.multiselect)for(var t in this.options.source)if(this.options.source.hasOwnProperty(t)&&this.query.length>=this.options.source[t].minLength&&this.query.length<=this.options.source[t].maxLength){if(this.filters.dropdown&&"group"===this.filters.dropdown.key&&this.filters.dropdown.value!==t)continue;if(this.searchGroups.push(t),!this.options.source[t].dynamic&&this.source[t])continue;this.generateGroups.push(t)}},generateSource:function(t){if(this.filterGenerateSource(),Array.isArray(t)&&t.length)this.generateGroups=t;else if(!this.generateGroups.length)return void this.node.trigger("search"+this.namespace);if(this.requestGroups=[],this.generatedGroupCount=0,this.options.loadingAnimation&&this.container.addClass("loading"),!this.helper.isEmpty(this.xhr)){for(var e in this.xhr)this.xhr.hasOwnProperty(e)&&this.xhr[e].abort();this.xhr={}}for(var i,s,o,n,r,a,l,h=this,c=(e=0,this.generateGroups.length);e<c;++e){if(i=this.generateGroups[e],n=(o=this.options.source[i]).cache,r=o.compression,n&&(a=window[n].getItem("TYPEAHEAD_"+this.selector+":"+i))){r&&(a=LZString.decompressFromUTF16(a)),l=!1;try{(a=JSON.parse(a+"")).data&&a.ttl>(new Date).getTime()?(this.populateSource(a.data,i),l=!0):window[n].removeItem("TYPEAHEAD_"+this.selector+":"+i)}catch(t){}if(l)continue}!o.data||o.ajax?o.ajax&&(this.requests[i]||(this.requests[i]=this.generateRequestObject(i)),this.requestGroups.push(i)):"function"==typeof o.data?(s=o.data.call(this),Array.isArray(s)?h.populateSource(s,i):"function"==typeof s.promise&&function(e){j.when(s).then(function(t){t&&Array.isArray(t)&&h.populateSource(t,e)})}(i)):this.populateSource(j.extend(!0,[],o.data),i)}return this.requestGroups.length&&this.handleRequests(),!!this.generateGroups.length},generateRequestObject:function(s){var o=this,n=this.options.source[s],t={request:{url:n.ajax.url||null,dataType:"json",beforeSend:function(t,e){o.xhr[s]=t;var i=o.requests[s].callback.beforeSend||n.ajax.beforeSend;"function"==typeof i&&i.apply(null,arguments)}},callback:{beforeSend:null,done:null,fail:null,then:null,always:null},extra:{path:n.ajax.path||null,group:s},validForGroup:[s]};if("function"!=typeof n.ajax&&(n.ajax instanceof Object&&(t=this.extendXhrObject(t,n.ajax)),1<Object.keys(this.options.source).length))for(var e in this.requests)this.requests.hasOwnProperty(e)&&(this.requests[e].isDuplicated||t.request.url&&t.request.url===this.requests[e].request.url&&(this.requests[e].validForGroup.push(s),t.isDuplicated=!0,delete t.validForGroup));return t},extendXhrObject:function(t,e){return"object"==typeof e.callback&&(t.callback=e.callback,delete e.callback),"function"==typeof e.beforeSend&&(t.callback.beforeSend=e.beforeSend,delete e.beforeSend),t.request=j.extend(!0,t.request,e),"jsonp"!==t.request.dataType.toLowerCase()||t.request.jsonpCallback||(t.request.jsonpCallback="callback_"+t.extra.group),t},handleRequests:function(){var t,h=this,c=this.requestGroups.length;if(!1!==this.helper.executeCallback.call(this,this.options.callback.onSendRequest,[this.node,this.query]))for(var e=0,i=this.requestGroups.length;e<i;++e)t=this.requestGroups[e],this.requests[t].isDuplicated||function(t,r){if("function"==typeof h.options.source[t].ajax){var e=h.options.source[t].ajax.call(h,h.query);if("object"!=typeof(r=h.extendXhrObject(h.generateRequestObject(t),"object"==typeof e?e:{})).request||!r.request.url)return h.populateSource([],t);h.requests[t]=r}var a,i=!1,l={};if(~r.request.url.indexOf("{{query}}")&&(i||(r=j.extend(!0,{},r),i=!0),r.request.url=r.request.url.replace("{{query}}",encodeURIComponent(h.query))),r.request.data)for(var s in r.request.data)if(r.request.data.hasOwnProperty(s)&&~String(r.request.data[s]).indexOf("{{query}}")){i||(r=j.extend(!0,{},r),i=!0),r.request.data[s]=r.request.data[s].replace("{{query}}",h.query);break}j.ajax(r.request).done(function(t,e,i){for(var s,o=0,n=r.validForGroup.length;o<n;o++)s=r.validForGroup[o],"function"==typeof(a=h.requests[s]).callback.done&&(l[s]=a.callback.done.call(h,t,e,i))}).fail(function(t,e,i){for(var s=0,o=r.validForGroup.length;s<o;s++)(a=h.requests[r.validForGroup[s]]).callback.fail instanceof Function&&a.callback.fail.call(h,t,e,i)}).always(function(t,e,i){for(var s,o=0,n=r.validForGroup.length;o<n;o++){if(s=r.validForGroup[o],(a=h.requests[s]).callback.always instanceof Function&&a.callback.always.call(h,t,e,i),"abort"===e)return;h.populateSource(null!==t&&"function"==typeof t.promise&&[]||l[s]||t,a.extra.group,a.extra.path||a.request.path),0===(c-=1)&&h.helper.executeCallback.call(h,h.options.callback.onReceiveRequest,[h.node,h.query])}}).then(function(t,e){for(var i=0,s=r.validForGroup.length;i<s;i++)(a=h.requests[r.validForGroup[i]]).callback.then instanceof Function&&a.callback.then.call(h,t,e)})}(t,this.requests[t])},populateSource:function(i,t,e){var s=this,o=this.options.source[t],n=o.ajax&&o.data;e&&"string"==typeof e&&(i=this.helper.namespace.call(this,e,i)),Array.isArray(i)||(i=[]),n&&("function"==typeof n&&(n=n()),Array.isArray(n)&&(i=i.concat(n)));for(var r,a=o.display?"compiled"===o.display[0]?o.display[1]:o.display[0]:"compiled"===this.options.display[0]?this.options.display[1]:this.options.display[0],l=0,h=i.length;l<h;l++)null!==i[l]&&"boolean"!=typeof i[l]&&("string"==typeof i[l]&&((r={})[a]=i[l],i[l]=r),i[l].group=t);if(!this.hasDynamicGroups&&this.dropdownFilter.dynamic.length){var c,p,u={};for(l=0,h=i.length;l<h;l++)for(var d=0,f=this.dropdownFilter.dynamic.length;d<f;d++)c=this.dropdownFilter.dynamic[d].key,(p=i[l][c])&&(this.dropdownFilter.dynamic[d].value||(this.dropdownFilter.dynamic[d].value=[]),u[c]||(u[c]=[]),~u[c].indexOf(p.toLowerCase())||(u[c].push(p.toLowerCase()),this.dropdownFilter.dynamic[d].value.push(p)))}if(this.options.correlativeTemplate){var m=o.template||this.options.template,g="";if("function"==typeof m&&(m=m.call(this,"",{})),m){if(Array.isArray(this.options.correlativeTemplate))for(l=0,h=this.options.correlativeTemplate.length;l<h;l++)g+="{{"+this.options.correlativeTemplate[l]+"}} ";else g=m.replace(/<.+?>/g," ").replace(/\s{2,}/," ").trim();for(l=0,h=i.length;l<h;l++)i[l].compiled=j("<textarea />").html(g.replace(/\{\{([\w\-\.]+)(?:\|(\w+))?}}/g,function(t,e){return s.helper.namespace.call(s,e,i[l],"get","")}).trim()).text();o.display?~o.display.indexOf("compiled")||o.display.unshift("compiled"):~this.options.display.indexOf("compiled")||this.options.display.unshift("compiled")}else;}this.options.callback.onPopulateSource&&(i=this.helper.executeCallback.call(this,this.options.callback.onPopulateSource,[this.node,i,t,e])),this.tmpSource[t]=Array.isArray(i)&&i||[];var y=this.options.source[t].cache,v=this.options.source[t].compression,b=this.options.source[t].ttl||this.options.ttl;if(y&&!window[y].getItem("TYPEAHEAD_"+this.selector+":"+t)){this.options.callback.onCacheSave&&(i=this.helper.executeCallback.call(this,this.options.callback.onCacheSave,[this.node,i,t,e]));var k=JSON.stringify({data:i,ttl:(new Date).getTime()+b});v&&(k=LZString.compressToUTF16(k)),window[y].setItem("TYPEAHEAD_"+this.selector+":"+t,k)}this.incrementGeneratedGroup()},incrementGeneratedGroup:function(){if(this.generatedGroupCount++,this.generatedGroupCount===this.generateGroups.length){this.xhr={};for(var t=0,e=this.generateGroups.length;t<e;t++)this.source[this.generateGroups[t]]=this.tmpSource[this.generateGroups[t]];this.hasDynamicGroups||this.buildDropdownItemLayout("dynamic"),this.options.loadingAnimation&&this.container.removeClass("loading"),this.node.trigger("search"+this.namespace)}},navigate:function(t){if(this.helper.executeCallback.call(this,this.options.callback.onNavigateBefore,[this.node,this.query,t]),27===t.keyCode)return t.preventDefault(),void(this.query.length?(this.resetInput(),this.node.trigger("input"+this.namespace,[t])):(this.node.blur(),this.hideLayout()));if(this.result.length){var e,i=this.resultContainer.find("."+this.options.selector.item).not("[disabled]"),s=i.filter(".active"),o=s[0]?i.index(s):null,n=s[0]?s.attr("data-index"):null,r=null;if(this.clearActiveItem(),this.helper.executeCallback.call(this,this.options.callback.onLeave,[this.node,null!==o&&i.eq(o)||void 0,null!==n&&this.result[n]||void 0,t]),13===t.keyCode)return t.preventDefault(),void(0<s.length?"javascript:;"===s.find("a:first")[0].href?s.find("a:first").trigger("click",t):s.find("a:first")[0].click():this.node.closest("form").trigger("submit"));if(39!==t.keyCode){9===t.keyCode?this.options.blurOnTab?this.hideLayout():0<s.length?o+1<i.length?(t.preventDefault(),r=o+1,this.addActiveItem(i.eq(r))):this.hideLayout():i.length?(t.preventDefault(),r=0,this.addActiveItem(i.first())):this.hideLayout():38===t.keyCode?(t.preventDefault(),0<s.length?0<=o-1&&(r=o-1,this.addActiveItem(i.eq(r))):i.length&&(r=i.length-1,this.addActiveItem(i.last()))):40===t.keyCode&&(t.preventDefault(),0<s.length?o+1<i.length&&(r=o+1,this.addActiveItem(i.eq(r))):i.length&&(r=0,this.addActiveItem(i.first()))),e=null!==r?i.eq(r).attr("data-index"):null,this.helper.executeCallback.call(this,this.options.callback.onEnter,[this.node,null!==r&&i.eq(r)||void 0,null!==e&&this.result[e]||void 0,t]),t.preventInputChange&&~[38,40].indexOf(t.keyCode)&&this.buildHintLayout(null!==e&&e<this.result.length?[this.result[e]]:null),this.options.hint&&this.hint.container&&this.hint.container.css("color",t.preventInputChange?this.hint.css.color:null===e&&this.hint.css.color||this.hint.container.css("background-color")||"fff");var a=null===e||t.preventInputChange?this.rawQuery:this.getTemplateValue.call(this,this.result[e]);this.node.val(a),this.isContentEditable&&this.node.text(a),this.helper.executeCallback.call(this,this.options.callback.onNavigateAfter,[this.node,i,null!==r&&i.eq(r).find("a:first")||void 0,null!==e&&this.result[e]||void 0,this.query,t])}else null!==o?i.eq(o).find("a:first")[0].click():this.options.hint&&""!==this.hint.container.val()&&this.helper.getCaret(this.node[0])>=this.query.length&&i.filter('[data-index="'+this.hintIndex+'"]').find("a:first")[0].click()}},getTemplateValue:function(i){if(i){var t=i.group&&this.options.source[i.group].templateValue||this.options.templateValue;if("function"==typeof t&&(t=t.call(this)),!t)return this.helper.namespace.call(this,i.matchedKey,i).toString();var s=this;return t.replace(/\{\{([\w\-.]+)}}/gi,function(t,e){return s.helper.namespace.call(s,e,i,"get","")})}},clearActiveItem:function(){this.resultContainer.find("."+this.options.selector.item).removeClass("active")},addActiveItem:function(t){t.addClass("active")},searchResult:function(){this.resetLayout(),!1!==this.helper.executeCallback.call(this,this.options.callback.onSearch,[this.node,this.query])&&(!this.searchGroups.length||this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit||this.searchResultData(),this.helper.executeCallback.call(this,this.options.callback.onResult,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]),this.isDropdownEvent&&(this.helper.executeCallback.call(this,this.options.callback.onDropdownFilter,[this.node,this.query,this.filters.dropdown,this.result]),this.isDropdownEvent=!1))},searchResultData:function(){var t,e,i,s,o,n,r,a,l,h,c,p=this.groupBy,u=null,d=this.query.toLowerCase(),f=this.options.maxItem,m=this.options.maxItemPerGroup,g=this.filters.dynamic&&!this.helper.isEmpty(this.filters.dynamic),y="function"==typeof this.options.matcher&&this.options.matcher;this.options.accent&&(d=this.helper.removeAccent.call(this,d));for(var v=0,b=this.searchGroups.length;v<b;++v)if(F=this.searchGroups[v],!this.filters.dropdown||"group"!==this.filters.dropdown.key||this.filters.dropdown.value===F){o=void 0!==this.options.source[F].filter?this.options.source[F].filter:this.options.filter,r="function"==typeof this.options.source[F].matcher&&this.options.source[F].matcher||y;for(var k=0,w=this.source[F].length;k<w&&(!(this.resultItemCount>=f)||this.options.callback.onResult);k++)if((!g||this.dynamicFilter.validate.apply(this,[this.source[F][k]]))&&null!==(t=this.source[F][k])&&"boolean"!=typeof t&&(!this.options.multiselect||this.isMultiselectUniqueData(t))&&(!this.filters.dropdown||(t[this.filters.dropdown.key]||"").toLowerCase()===(this.filters.dropdown.value||"").toLowerCase())){if((u="group"===p?F:t[p]?t[p]:t.group)&&!this.tmpResult[u]&&(this.tmpResult[u]=[],this.resultCountPerGroup[u]=0),m&&"group"===p&&this.tmpResult[u].length>=m&&!this.options.callback.onResult)break;for(var x=0,C=(S=this.options.source[F].display||this.options.display).length;x<C;++x){if(!1!==o){if(void 0===(s=/\./.test(S[x])?this.helper.namespace.call(this,S[x],t):t[S[x]])||""===s)continue;s=this.helper.cleanStringFromScript(s)}if("function"==typeof o){if(void 0===(n=o.call(this,t,s)))break;if(!n)continue;"object"==typeof n&&(t=n)}if(~[void 0,!0].indexOf(o)){if(null===s)continue;if(i=(i=s).toString().toLowerCase(),this.options.accent&&(i=this.helper.removeAccent.call(this,i)),e=i.indexOf(d),this.options.correlativeTemplate&&"compiled"===S[x]&&e<0&&/\s/.test(d)){l=!0,c=i;for(var q=0,A=(h=d.split(" ")).length;q<A;q++)if(""!==h[q]){if(!~c.indexOf(h[q])){l=!1;break}c=c.replace(h[q],"")}}if(e<0&&!l)continue;if(this.options.offset&&0!==e)continue;if(r){if(void 0===(a=r.call(this,t,s)))break;if(!a)continue;"object"==typeof a&&(t=a)}}if(this.resultCount++,this.resultCountPerGroup[u]++,this.resultItemCount<f){if(m&&this.tmpResult[u].length>=m)break;this.tmpResult[u].push(j.extend(!0,{matchedKey:S[x]},t)),this.resultItemCount++}break}if(!this.options.callback.onResult){if(this.resultItemCount>=f)break;if(m&&this.tmpResult[u].length>=m&&"group"===p)break}}}if(this.options.order){var O,S=[];for(var F in this.tmpResult)if(this.tmpResult.hasOwnProperty(F)){for(v=0,b=this.tmpResult[F].length;v<b;v++)O=this.options.source[this.tmpResult[F][v].group].display||this.options.display,~S.indexOf(O[0])||S.push(O[0]);this.tmpResult[F].sort(this.helper.sort(S,"asc"===this.options.order,function(t){return t?t.toString().toUpperCase():""}))}}var L=[],I=[];for(v=0,b=(I="function"==typeof this.options.groupOrder?this.options.groupOrder.apply(this,[this.node,this.query,this.tmpResult,this.resultCount,this.resultCountPerGroup]):Array.isArray(this.options.groupOrder)?this.options.groupOrder:"string"==typeof this.options.groupOrder&&~["asc","desc"].indexOf(this.options.groupOrder)?Object.keys(this.tmpResult).sort(this.helper.sort([],"asc"===this.options.groupOrder,function(t){return t.toString().toUpperCase()})):Object.keys(this.tmpResult)).length;v<b;v++)L=L.concat(this.tmpResult[I[v]]||[]);this.groups=JSON.parse(JSON.stringify(I)),this.result=L},buildLayout:function(){this.buildHtmlLayout(),this.buildBackdropLayout(),this.buildHintLayout(),this.options.callback.onLayoutBuiltBefore&&(this.tmpResultHtml=this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltBefore,[this.node,this.query,this.result,this.resultHtml])),this.tmpResultHtml instanceof j?this.resultContainer.html(this.tmpResultHtml):this.resultHtml instanceof j&&this.resultContainer.html(this.resultHtml),this.options.callback.onLayoutBuiltAfter&&this.helper.executeCallback.call(this,this.options.callback.onLayoutBuiltAfter,[this.node,this.query,this.result])},buildHtmlLayout:function(){if(!1!==this.options.resultContainer){var h;if(this.resultContainer||(this.resultContainer=j("<div/>",{class:this.options.selector.result}),this.container.append(this.resultContainer)),!this.result.length)if(this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit)h=this.options.multiselect.limitTemplate?"function"==typeof this.options.multiselect.limitTemplate?this.options.multiselect.limitTemplate.call(this,this.query):this.options.multiselect.limitTemplate.replace(/\{\{query}}/gi,j("<div>").text(this.helper.cleanStringFromScript(this.query)).html()):"Can't select more than "+this.items.length+" items.";else{if(!this.options.emptyTemplate||""===this.query)return;h="function"==typeof this.options.emptyTemplate?this.options.emptyTemplate.call(this,this.query):this.options.emptyTemplate.replace(/\{\{query}}/gi,j("<div>").text(this.helper.cleanStringFromScript(this.query)).html())}this.displayEmptyTemplate=!!h;var o=this.query.toLowerCase();this.options.accent&&(o=this.helper.removeAccent.call(this,o));var c=this,t=this.groupTemplate||"<ul></ul>",p=!1;this.groupTemplate?t=j(t.replace(/<([^>]+)>\{\{(.+?)}}<\/[^>]+>/g,function(t,e,i,s,o){var n="",r="group"===i?c.groups:[i];if(!c.result.length)return!0===p?"":(p=!0,"<"+e+' class="'+c.options.selector.empty+'">'+h+"</"+e+">");for(var a=0,l=r.length;a<l;++a)n+="<"+e+' data-group-template="'+r[a]+'"><ul></ul></'+e+">";return n})):(t=j(t),this.result.length||t.append(h instanceof j?h:'<li class="'+c.options.selector.empty+'">'+h+"</li>")),t.addClass(this.options.selector.list+(this.helper.isEmpty(this.result)?" empty":""));for(var e,i,n,s,r,a,l,u,d,f,m,g,y,v=this.groupTemplate&&this.result.length&&c.groups||[],b=0,k=this.result.length;b<k;++b)e=(n=this.result[b]).group,s=!this.options.multiselect&&this.options.source[n.group].href||this.options.href,u=[],d=this.options.source[n.group].display||this.options.display,this.options.group&&(e=n[this.options.group.key],this.options.group.template&&("function"==typeof this.options.group.template?i=this.options.group.template.call(this,n):"string"==typeof this.options.group.template&&(i=this.options.group.template.replace(/\{\{([\w\-\.]+)}}/gi,function(t,e){return c.helper.namespace.call(c,e,n,"get","")}))),t.find('[data-search-group="'+e+'"]')[0]||(this.groupTemplate?t.find('[data-group-template="'+e+'"] ul'):t).append(j("<li/>",{class:c.options.selector.group,html:j("<a/>",{href:"javascript:;",html:i||e,tabindex:-1}),"data-search-group":e}))),this.groupTemplate&&v.length&&~(m=v.indexOf(e||n.group))&&v.splice(m,1),r=j("<li/>",{class:c.options.selector.item+" "+c.options.selector.group+"-"+this.helper.slugify.call(this,e),disabled:!!n.disabled,"data-group":e,"data-index":b,html:j("<a/>",{href:s&&!n.disabled?(g=s,y=n,y.href=c.generateHref.call(c,g,y)):"javascript:;",html:function(){if(a=n.group&&c.options.source[n.group].template||c.options.template)"function"==typeof a&&(a=a.call(c,c.query,n)),l=a.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(t,e,i){var s=c.helper.cleanStringFromScript(String(c.helper.namespace.call(c,e,n,"get","")));return~(i=i&&i.split("|")||[]).indexOf("slugify")&&(s=c.helper.slugify.call(c,s)),~i.indexOf("raw")||!0===c.options.highlight&&o&&~d.indexOf(e)&&(s=c.helper.highlight.call(c,s,o.split(" "),c.options.accent)),s});else{for(var t=0,e=d.length;t<e;t++)void 0!==(f=/\./.test(d[t])?c.helper.namespace.call(c,d[t],n,"get",""):n[d[t]])&&""!==f&&u.push(f);l='<span class="'+c.options.selector.display+'">'+c.helper.cleanStringFromScript(String(u.join(" ")))+"</span>"}(!0===c.options.highlight&&o&&!a||"any"===c.options.highlight)&&(l=c.helper.highlight.call(c,l,o.split(" "),c.options.accent)),j(this).append(l)}})}),function(t,i,e){e.on("click",function(t,e){i.disabled?t.preventDefault():(e&&"object"==typeof e&&(t.originalEvent=e),c.options.mustSelectItem&&c.helper.isEmpty(i)?t.preventDefault():(c.options.multiselect||(c.item=i),!1!==c.helper.executeCallback.call(c,c.options.callback.onClickBefore,[c.node,j(this),i,t])&&(t.originalEvent&&t.originalEvent.defaultPrevented||t.isDefaultPrevented()||(c.options.multiselect?(c.query=c.rawQuery="",c.addMultiselectItemLayout(i)):(c.focusOnly=!0,c.query=c.rawQuery=c.getTemplateValue.call(c,i),c.isContentEditable&&(c.node.text(c.query),c.helper.setCaretAtEnd(c.node[0]))),c.hideLayout(),c.node.val(c.query).focus(),c.options.cancelButton&&c.toggleCancelButtonVisibility(),c.helper.executeCallback.call(c,c.options.callback.onClickAfter,[c.node,j(this),i,t])))))}),e.on("mouseenter",function(t){i.disabled||(c.clearActiveItem(),c.addActiveItem(j(this))),c.helper.executeCallback.call(c,c.options.callback.onEnter,[c.node,j(this),i,t])}),e.on("mouseleave",function(t){i.disabled||c.clearActiveItem(),c.helper.executeCallback.call(c,c.options.callback.onLeave,[c.node,j(this),i,t])})}(0,n,r),(this.groupTemplate?t.find('[data-group-template="'+e+'"] ul'):t).append(r);if(this.result.length&&v.length)for(b=0,k=v.length;b<k;++b)t.find('[data-group-template="'+v[b]+'"]').remove();this.resultHtml=t}},generateHref:function(t,o){var n=this;return"string"==typeof t?t=t.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(t,e,i){var s=n.helper.namespace.call(n,e,o,"get","");return~(i=i&&i.split("|")||[]).indexOf("slugify")&&(s=n.helper.slugify.call(n,s)),s}):"function"==typeof t&&(t=t.call(this,o)),t},getMultiselectComparedData:function(t){var e="";if(Array.isArray(this.options.multiselect.matchOn))for(var i=0,s=this.options.multiselect.matchOn.length;i<s;++i)e+=void 0!==t[this.options.multiselect.matchOn[i]]?t[this.options.multiselect.matchOn[i]]:"";else{var o=JSON.parse(JSON.stringify(t)),n=["group","matchedKey","compiled","href"];for(i=0,s=n.length;i<s;++i)delete o[n[i]];e=JSON.stringify(o)}return e},buildBackdropLayout:function(){this.options.backdrop&&(this.backdrop.container||(this.backdrop.css=j.extend({opacity:.6,filter:"alpha(opacity=60)",position:"fixed",top:0,right:0,bottom:0,left:0,"z-index":1040,"background-color":"#000"},this.options.backdrop),this.backdrop.container=j("<div/>",{class:this.options.selector.backdrop,css:this.backdrop.css}).insertAfter(this.container)),this.container.addClass("backdrop").css({"z-index":this.backdrop.css["z-index"]+1,position:"relative"}))},buildHintLayout:function(t){if(this.options.hint)if(this.node[0].scrollWidth>Math.ceil(this.node.innerWidth()))this.hint.container&&this.hint.container.val("");else{var e=this,i="",s=(t=t||this.result,this.query.toLowerCase());if(this.options.accent&&(s=this.helper.removeAccent.call(this,s)),this.hintIndex=null,this.searchGroups.length){if(this.hint.container||(this.hint.css=j.extend({"border-color":"transparent",position:"absolute",top:0,display:"inline","z-index":-1,float:"none",color:"silver","box-shadow":"none",cursor:"default","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},this.options.hint),this.hint.container=j("<"+this.node[0].nodeName+"/>",{type:this.node.attr("type"),class:this.node.attr("class"),readonly:!0,unselectable:"on","aria-hidden":"true",tabindex:-1,click:function(){e.node.focus()}}).addClass(this.options.selector.hint).css(this.hint.css).insertAfter(this.node),this.node.parent().css({position:"relative"})),this.hint.container.css("color",this.hint.css.color),s)for(var o,n,r,a=0,l=t.length;a<l;a++)if(!t[a].disabled){n=t[a].group;for(var h=0,c=(o=this.options.source[n].display||this.options.display).length;h<c;h++)if(r=String(t[a][o[h]]).toLowerCase(),this.options.accent&&(r=this.helper.removeAccent.call(this,r)),0===r.indexOf(s)){i=String(t[a][o[h]]),this.hintIndex=a;break}if(null!==this.hintIndex)break}var p=0<i.length&&this.rawQuery+i.substring(this.query.length)||"";this.hint.container.val(p),this.isContentEditable&&this.hint.container.text(p)}}},buildDropdownLayout:function(){if(this.options.dropdownFilter){var i=this;j("<span/>",{class:this.options.selector.filter,html:function(){j(this).append(j("<button/>",{type:"button",class:i.options.selector.filterButton,style:"display: none;",click:function(){i.container.toggleClass("filter");var e=i.namespace+"-dropdown-filter";j("html").off(e),i.container.hasClass("filter")&&j("html").on("click"+e+" touchend"+e,function(t){j(t.target).closest("."+i.options.selector.filter)[0]&&j(t.target).closest(i.container)[0]||i.hasDragged||(i.container.removeClass("filter"),j("html").off(e))})}})),j(this).append(j("<ul/>",{class:i.options.selector.dropdown}))}}).insertAfter(i.container.find("."+i.options.selector.query))}},buildDropdownItemLayout:function(t){if(this.options.dropdownFilter){var e,i,o=this,n="string"==typeof this.options.dropdownFilter&&this.options.dropdownFilter||"All",r=this.container.find("."+this.options.selector.dropdown);"static"!==t||!0!==this.options.dropdownFilter&&"string"!=typeof this.options.dropdownFilter||this.dropdownFilter.static.push({key:"group",template:"{{group}}",all:n,value:Object.keys(this.options.source)});for(var s=0,a=this.dropdownFilter[t].length;s<a;s++){i=this.dropdownFilter[t][s],Array.isArray(i.value)||(i.value=[i.value]),i.all&&(this.dropdownFilterAll=i.all);for(var l=0,h=i.value.length;l<=h;l++)l===h&&s!==a-1||l===h&&s===a-1&&"static"===t&&this.dropdownFilter.dynamic.length||(e=this.dropdownFilterAll||n,i.value[l]?e=i.template?i.template.replace(new RegExp("{{"+i.key+"}}","gi"),i.value[l]):i.value[l]:this.container.find("."+o.options.selector.filterButton).html(e),function(e,i,s){r.append(j("<li/>",{class:o.options.selector.dropdownItem+" "+o.helper.slugify.call(o,i.key+"-"+(i.value[e]||n)),html:j("<a/>",{href:"javascript:;",html:s,click:function(t){t.preventDefault(),c.call(o,{key:i.key,value:i.value[e]||"*",template:s})}})}))}(l,i,e))}this.dropdownFilter[t].length&&this.container.find("."+o.options.selector.filterButton).removeAttr("style")}function c(t){"*"===t.value?delete this.filters.dropdown:this.filters.dropdown=t,this.container.removeClass("filter").find("."+this.options.selector.filterButton).html(t.template),this.isDropdownEvent=!0,this.node.trigger("input"+this.namespace),this.options.multiselect&&this.adjustInputSize(),this.node.focus()}},dynamicFilter:{isEnabled:!1,init:function(){this.options.dynamicFilter&&(this.dynamicFilter.bind.call(this),this.dynamicFilter.isEnabled=!0)},validate:function(t){var e,i,s=null,o=null;for(var n in this.filters.dynamic)if(this.filters.dynamic.hasOwnProperty(n)&&(i=~n.indexOf(".")?this.helper.namespace.call(this,n,t,"get"):t[n],"|"!==this.filters.dynamic[n].modifier||s||(s=i==this.filters.dynamic[n].value||!1),"&"===this.filters.dynamic[n].modifier)){if(i!=this.filters.dynamic[n].value){o=!1;break}o=!0}return e=s,null!==o&&!0===(e=o)&&null!==s&&(e=s),!!e},set:function(t,e){var i=t.match(/^([|&])?(.+)/);e?this.filters.dynamic[i[2]]={modifier:i[1]||"|",value:e}:delete this.filters.dynamic[i[2]],this.dynamicFilter.isEnabled&&this.generateSource()},bind:function(){for(var t,e=this,i=0,s=this.options.dynamicFilter.length;i<s;i++)"string"==typeof(t=this.options.dynamicFilter[i]).selector&&(t.selector=j(t.selector)),t.selector instanceof j&&t.selector[0]&&t.key&&function(t){t.selector.off(e.namespace).on("change"+e.namespace,function(){e.dynamicFilter.set.apply(e,[t.key,e.dynamicFilter.getValue(this)])}).trigger("change"+e.namespace)}(t)},getValue:function(t){var e;return"SELECT"===t.tagName?e=t.value:"INPUT"===t.tagName&&("checkbox"===t.type?e=t.checked&&t.getAttribute("value")||t.checked||null:"radio"===t.type&&t.checked&&(e=t.value)),e}},buildMultiselectLayout:function(){if(this.options.multiselect){var t,e=this;this.label.container=j("<span/>",{class:this.options.selector.labelContainer,"data-padding-left":parseFloat(this.node.css("padding-left"))||0,"data-padding-right":parseFloat(this.node.css("padding-right"))||0,"data-padding-top":parseFloat(this.node.css("padding-top"))||0,click:function(t){j(t.target).hasClass(e.options.selector.labelContainer)&&e.node.focus()}}),this.node.closest("."+this.options.selector.query).prepend(this.label.container),this.options.multiselect.data&&(Array.isArray(this.options.multiselect.data)?this.populateMultiselectData(this.options.multiselect.data):"function"==typeof this.options.multiselect.data&&(t=this.options.multiselect.data.call(this),Array.isArray(t)?this.populateMultiselectData(t):"function"==typeof t.promise&&j.when(t).then(function(t){t&&Array.isArray(t)&&e.populateMultiselectData(t)})))}},isMultiselectUniqueData:function(t){for(var e=!0,i=0,s=this.comparedItems.length;i<s;++i)if(this.comparedItems[i]===this.getMultiselectComparedData(t)){e=!1;break}return e},populateMultiselectData:function(t){for(var e=0,i=t.length;e<i;++e)this.addMultiselectItemLayout(t[e]);this.node.trigger("search"+this.namespace,{origin:"populateMultiselectData"})},addMultiselectItemLayout:function(t){if(this.isMultiselectUniqueData(t)){this.items.push(t),this.comparedItems.push(this.getMultiselectComparedData(t));var e,i=this.getTemplateValue(t),s=this,o=this.options.multiselect.href?"a":"span",n=j("<span/>",{class:this.options.selector.label,html:j("<"+o+"/>",{text:i,click:function(t){var e=j(this).closest("."+s.options.selector.label),i=s.label.container.find("."+s.options.selector.label).index(e);s.options.multiselect.callback&&s.helper.executeCallback.call(s,s.options.multiselect.callback.onClick,[s.node,s.items[i],t])},href:this.options.multiselect.href?(e=s.items[s.items.length-1],s.generateHref.call(s,s.options.multiselect.href,e)):null})});return n.append(j("<span/>",{class:this.options.selector.cancelButton,html:"×",click:function(t){var e=j(this).closest("."+s.options.selector.label),i=s.label.container.find("."+s.options.selector.label).index(e);s.cancelMultiselectItem(i,e,t)}})),this.label.container.append(n),this.adjustInputSize(),!0}},cancelMultiselectItem:function(t,e,i){var s=this.items[t];(e=e||this.label.container.find("."+this.options.selector.label).eq(t)).remove(),this.items.splice(t,1),this.comparedItems.splice(t,1),this.options.multiselect.callback&&this.helper.executeCallback.call(this,this.options.multiselect.callback.onCancel,[this.node,s,i]),this.adjustInputSize(),this.focusOnly=!0,this.node.focus().trigger("input"+this.namespace,{origin:"cancelMultiselectItem"})},adjustInputSize:function(){var i=this.node[0].getBoundingClientRect().width-(parseFloat(this.label.container.data("padding-right"))||0)-(parseFloat(this.label.container.css("padding-left"))||0),s=0,o=0,n=0,r=!1,a=0;this.label.container.find("."+this.options.selector.label).filter(function(t,e){0===t&&(a=j(e)[0].getBoundingClientRect().height+parseFloat(j(e).css("margin-bottom")||0)),s=j(e)[0].getBoundingClientRect().width+parseFloat(j(e).css("margin-right")||0),.7*i<n+s&&!r&&(o++,r=!0),n+s<i?n+=s:(r=!1,n=s)});var t=parseFloat(this.label.container.data("padding-left")||0)+(r?0:n),e=o*a+parseFloat(this.label.container.data("padding-top")||0);this.container.find("."+this.options.selector.query).find("input, textarea, [contenteditable], .typeahead__hint").css({paddingLeft:t,paddingTop:e})},showLayout:function(){!this.container.hasClass("result")&&(this.result.length||this.displayEmptyTemplate||this.options.backdropOnFocus)&&(function(){var e=this;j("html").off("keydown"+this.namespace).on("keydown"+this.namespace,function(t){t.keyCode&&9===t.keyCode&&setTimeout(function(){j(":focus").closest(e.container).find(e.node)[0]||e.hideLayout()},0)}),j("html").off("click"+this.namespace+" touchend"+this.namespace).on("click"+this.namespace+" touchend"+this.namespace,function(t){j(t.target).closest(e.container)[0]||j(t.target).closest("."+e.options.selector.item)[0]||t.target.className===e.options.selector.cancelButton||e.hasDragged||e.hideLayout()})}.call(this),this.container.addClass([this.result.length||this.searchGroups.length&&this.displayEmptyTemplate?"result ":"",this.options.hint&&this.searchGroups.length?"hint":"",this.options.backdrop||this.options.backdropOnFocus?"backdrop":""].join(" ")),this.helper.executeCallback.call(this,this.options.callback.onShowLayout,[this.node,this.query]))},hideLayout:function(){(this.container.hasClass("result")||this.container.hasClass("backdrop"))&&(this.container.removeClass("result hint filter"+(this.options.backdropOnFocus&&j(this.node).is(":focus")?"":" backdrop")),this.options.backdropOnFocus&&this.container.hasClass("backdrop")||(j("html").off(this.namespace),this.helper.executeCallback.call(this,this.options.callback.onHideLayout,[this.node,this.query])))},resetLayout:function(){this.result=[],this.tmpResult={},this.groups=[],this.resultCount=0,this.resultCountPerGroup={},this.resultItemCount=0,this.resultHtml=null,this.options.hint&&this.hint.container&&(this.hint.container.val(""),this.isContentEditable&&this.hint.container.text(""))},resetInput:function(){this.node.val(""),this.isContentEditable&&this.node.text(""),this.query="",this.rawQuery=""},buildCancelButtonLayout:function(){if(this.options.cancelButton){var e=this;j("<span/>",{class:this.options.selector.cancelButton,html:"×",mousedown:function(t){t.stopImmediatePropagation(),t.preventDefault(),e.resetInput(),e.node.trigger("input"+e.namespace,[t])}}).insertBefore(this.node)}},toggleCancelButtonVisibility:function(){this.container.toggleClass("cancel",!!this.query.length)},__construct:function(){this.extendOptions(),this.unifySourceFormat()&&(this.dynamicFilter.init.apply(this),this.init(),this.buildDropdownLayout(),this.buildDropdownItemLayout("static"),this.buildMultiselectLayout(),this.delegateEvents(),this.buildCancelButtonLayout(),this.helper.executeCallback.call(this,this.options.callback.onReady,[this.node]))},helper:{isEmpty:function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},removeAccent:function(t){if("string"==typeof t){var e=o;return"object"==typeof this.options.accent&&(e=this.options.accent),t=t.toLowerCase().replace(new RegExp("["+e.from+"]","g"),function(t){return e.to[e.from.indexOf(t)]})}},slugify:function(t){return""!==(t=String(t))&&(t=(t=this.helper.removeAccent.call(this,t)).replace(/[^-a-z0-9]+/g,"-").replace(/-+/g,"-").replace(/^-|-$/g,"")),t},sort:function(s,i,o){function n(t){for(var e=0,i=s.length;e<i;e++)if(void 0!==t[s[e]])return o(t[s[e]]);return t}return i=[-1,1][+!!i],function(t,e){return t=n(t),e=n(e),i*((e<t)-(t<e))}},replaceAt:function(t,e,i,s){return t.substring(0,e)+s+t.substring(e+i)},highlight:function(t,e,i){t=String(t);var s=i&&this.helper.removeAccent.call(this,t)||t,o=[];Array.isArray(e)||(e=[e]),e.sort(function(t,e){return e.length-t.length});for(var n=e.length-1;0<=n;n--)""!==e[n].trim()?e[n]=e[n].replace(/[-[\]{}()*+?.,\\^$|#\s]/g,"\\$&"):e.splice(n,1);s.replace(new RegExp("(?:"+e.join("|")+")(?!([^<]+)?>)","gi"),function(t,e,i){o.push({offset:i,length:t.length})});for(n=o.length-1;0<=n;n--)t=this.helper.replaceAt(t,o[n].offset,o[n].length,"<strong>"+t.substr(o[n].offset,o[n].length)+"</strong>");return t},getCaret:function(t){var e=0;if(t.selectionStart)return t.selectionStart;if(document.selection){var i=document.selection.createRange();if(null===i)return e;var s=t.createTextRange(),o=s.duplicate();s.moveToBookmark(i.getBookmark()),o.setEndPoint("EndToStart",s),e=o.text.length}else if(window.getSelection){var n=window.getSelection();if(n.rangeCount){var r=n.getRangeAt(0);r.commonAncestorContainer.parentNode==t&&(e=r.endOffset)}}return e},setCaretAtEnd:function(t){if(void 0!==window.getSelection&&void 0!==document.createRange){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(e)}else if(void 0!==document.body.createTextRange){var s=document.body.createTextRange();s.moveToElementText(t),s.collapse(!1),s.select()}},cleanStringFromScript:function(t){return"string"==typeof t&&t.replace(/<\/?(?:script|iframe)\b[^>]*>/gm,"")||t},executeCallback:function(t,e){if(t){var i;if("function"==typeof t)i=t;else if(("string"==typeof t||Array.isArray(t))&&("string"==typeof t&&(t=[t,[]]),"function"!=typeof(i=this.helper.namespace.call(this,t[0],window))))return;return i.apply(this,(t[1]||[]).concat(e||[]))}},namespace:function(t,e,i,s){if("string"!=typeof t||""===t)return!1;var o=void 0!==s?s:void 0;if(!~t.indexOf("."))return e[t]||o;for(var n=t.split("."),r=e||window,a=(i=i||"get",""),l=0,h=n.length;l<h;l++){if(void 0===r[a=n[l]]){if(~["get","delete"].indexOf(i))return void 0!==s?s:void 0;r[a]={}}if(~["set","create","delete"].indexOf(i)&&l===h-1){if("set"!==i&&"create"!==i)return delete r[a],!0;r[a]=o}r=r[a]}return r},typeWatch:(i=0,function(t,e){clearTimeout(i),i=setTimeout(t,e)})}},j.fn.typeahead=j.typeahead=function(t){return e.typeahead(this,t)};var e={typeahead:function(t,e){if(e&&e.source&&"object"==typeof e.source){if("function"==typeof t){if(!e.input)return;t=j(e.input)}if(t.length){if(void 0===t[0].value&&(t[0].value=t.text()),1===t.length)return t[0].selector=t.selector||e.input||t[0].nodeName.toLowerCase(),window.Typeahead[t[0].selector]=new r(t,e);for(var i,s={},o=0,n=t.length;o<n;++o)void 0!==s[i=t[o].nodeName.toLowerCase()]&&(i+=o),t[o].selector=i,window.Typeahead[i]=s[i]=new r(t.eq(o),e);return s}}}};return window.console=window.console||{log:function(){}},Array.isArray||(Array.isArray=function(t){return"[object Array]"===Object.prototype.toString.call(t)}),"trim"in String.prototype||(String.prototype.trim=function(){return this.replace(/^\s+/,"").replace(/\s+$/,"")}),"indexOf"in Array.prototype||(Array.prototype.indexOf=function(t,e){void 0===e&&(e=0),e<0&&(e+=this.length),e<0&&(e=0);for(var i=this.length;e<i;e++)if(e in this&&this[e]===t)return e;return-1}),Object.keys||(Object.keys=function(t){var e,i=[];for(e in t)Object.prototype.hasOwnProperty.call(t,e)&&i.push(e);return i}),r});
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/quickhelp',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/dialog',
- 'underscore'
- ], function($, utils, i18n, dialog, _) {
- "use strict";
- var platform = utils.platform;
- var QuickHelp = function (options) {
- /**
- * Constructor
- *
- * Parameters:
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * keyboard_manager: KeyboardManager instance
- * notebook: Notebook instance
- */
- this.keyboard_manager = options.keyboard_manager;
- this.notebook = options.notebook;
- this.keyboard_manager.quick_help = this;
- this.events = options.events;
- };
- var cmd_ctrl = 'Ctrl-';
- var platform_specific;
- if (platform === 'MacOS') {
- // Mac OS X specific
- cmd_ctrl = 'Cmd-';
- platform_specific = [
- { shortcut: "Cmd-Up", help:i18n.msg._("go to cell start") },
- { shortcut: "Cmd-Down", help:i18n.msg._("go to cell end") },
- { shortcut: "Alt-Left", help:i18n.msg._("go one word left") },
- { shortcut: "Alt-Right", help:i18n.msg._("go one word right") },
- { shortcut: "Alt-Backspace", help:i18n.msg._("delete word before") },
- { shortcut: "Alt-Delete", help:i18n.msg._("delete word after") },
- { shortcut: "Cmd-Shift-z", help:i18n.msg._("redo") },
- { shortcut: "Cmd-Shift-u", help:i18n.msg._("redo selection") },
- { shortcut: "Ctrl-k", help:i18n.msg._("emacs-style line kill") },
- { shortcut: "Cmd-Backspace", help:i18n.msg._("delete line left of cursor") },
- { shortcut: "Cmd-Delete", help:i18n.msg._("delete line right of cursor") }
- ];
- } else {
- // PC specific
- platform_specific = [
- { shortcut: "Ctrl-Home", help:i18n.msg._("go to cell start") },
- { shortcut: "Ctrl-Up", help:i18n.msg._("go to cell start") },
- { shortcut: "Ctrl-End", help:i18n.msg._("go to cell end") },
- { shortcut: "Ctrl-Down", help:i18n.msg._("go to cell end") },
- { shortcut: "Ctrl-Left", help:i18n.msg._("go one word left") },
- { shortcut: "Ctrl-Right", help:i18n.msg._("go one word right") },
- { shortcut: "Ctrl-Backspace", help:i18n.msg._("delete word before")},
- { shortcut: "Ctrl-Delete", help:i18n.msg._("delete word after")},
- { shortcut: "Ctrl-y", help:i18n.msg._("redo")},
- { shortcut: "Alt-u", help:i18n.msg._("redo selection") }
- ];
- }
- var cm_shortcuts = [
- { shortcut:"Tab", help:i18n.msg._("code completion or indent") },
- { shortcut:"Shift-Tab", help:i18n.msg._("tooltip") },
- { shortcut: cmd_ctrl + "]", help:i18n.msg._("indent") },
- { shortcut: cmd_ctrl + "[", help:i18n.msg._("dedent") },
- { shortcut: cmd_ctrl + "a", help:i18n.msg._("select all") },
- { shortcut: cmd_ctrl + "z", help:i18n.msg._("undo") },
- { shortcut: cmd_ctrl + "/", help:i18n.msg._("comment") },
- { shortcut: cmd_ctrl + "d", help:i18n.msg._("delete whole line") },
- { shortcut: cmd_ctrl + "u", help:i18n.msg._("undo selection") },
- { shortcut: "Insert", help:i18n.msg._("toggle overwrite flag") }
- ].concat( platform_specific );
-
- var mac_humanize_map = {
- // all these are unicode, will probably display badly on anything except macs.
- // these are the standard symbol that are used in MacOS native menus
- // cf https://apple.stackexchange.com/questions/55727/
- // for htmlentities and/or unicode value
- 'cmd':'⌘',
- 'shift':'⇧',
- 'alt':'⌥',
- 'up':'↑',
- 'down':'↓',
- 'left':'←',
- 'right':'→',
- 'eject':'⏏',
- 'tab':'⇥',
- 'backtab':'⇤',
- 'capslock':'⇪',
- 'esc':'esc',
- 'ctrl':'⌃',
- 'enter':'↩',
- 'pageup':'⇞',
- 'pagedown':'⇟',
- 'home':'↖',
- 'end':'↘',
- 'altenter':'⌤',
- 'space':'␣',
- 'delete':'⌦',
- 'backspace':'⌫',
- 'apple':'',
- };
- var default_humanize_map = {
- 'shift':i18n.msg._('Shift'),
- 'alt':i18n.msg._('Alt'),
- 'up':i18n.msg._('Up'),
- 'down':i18n.msg._('Down'),
- 'left':i18n.msg._('Left'),
- 'right':i18n.msg._('Right'),
- 'tab':i18n.msg._('Tab'),
- 'capslock':i18n.msg._('Caps Lock'),
- 'esc':i18n.msg._('Esc'),
- 'ctrl':i18n.msg._('Ctrl'),
- 'enter':i18n.msg._('Enter'),
- 'pageup':i18n.msg._('Page Up'),
- 'pagedown':i18n.msg._('Page Down'),
- 'home':i18n.msg._('Home'),
- 'end':i18n.msg._('End'),
- 'space':i18n.msg._('Space'),
- 'backspace':i18n.msg._('Backspace'),
- '-':i18n.msg._('Minus')
- };
-
- var humanize_map;
- if (platform === 'MacOS'){
- humanize_map = mac_humanize_map;
- } else {
- humanize_map = default_humanize_map;
- }
- var special_case = { pageup: i18n.msg._("PageUp"), pagedown: i18n.msg._("Page Down") };
-
- function humanize_key(key){
- if (key.length === 1){
- return key.toUpperCase();
- }
- key = humanize_map[key.toLowerCase()]||key;
-
- if (key.indexOf(',') === -1){
- return ( special_case[key] ? special_case[key] : key.charAt(0).toUpperCase() + key.slice(1) );
- }
- }
- // return an **html** string of the keyboard shortcut
- // for human eyes consumption.
- // the sequence is a string, comma separated linkt of shortcut,
- // where the shortcut is a list of dash-joined keys.
- // Each shortcut will be wrapped in <kbd> tag, and joined by comma is in a
- // sequence.
- //
- // Depending on the platform each shortcut will be normalized, with or without dashes.
- // and replace with the corresponding unicode symbol for modifier if necessary.
- function humanize_sequence(sequence){
- var joinchar = ',';
- var hum = _.map(sequence.replace(/meta/g, 'cmd').split(','), humanize_shortcut).join(joinchar);
- return hum;
- }
- function _humanize_sequence(sequence){
- var joinchar = ',';
- var hum = _.map(sequence.replace(/meta/g, 'cmd').split(','), _humanize_shortcut).join(joinchar);
- return hum;
- }
- function _humanize_shortcut(shortcut){
- var joinchar = '-';
- if (platform === 'MacOS'){
- joinchar = '';
- }
- return _.map(shortcut.split('-'), humanize_key ).join(joinchar);
- }
- function humanize_shortcut(shortcut){
- return '<kbd>'+_humanize_shortcut(shortcut)+'</kbd>';
- }
-
- QuickHelp.prototype.show_keyboard_shortcuts = function () {
- /**
- * toggles display of keyboard shortcut dialog
- */
- var that = this;
- if ( this.force_rebuild ) {
- this.shortcut_dialog.remove();
- delete(this.shortcut_dialog);
- this.force_rebuild = false;
- }
- if ( this.shortcut_dialog ){
- // if dialog is already shown, close it
- $(this.shortcut_dialog).modal("toggle");
- return;
- }
- var element = $('<div/>');
- // The documentation
- var doc = $('<div/>').addClass('alert alert-info');
- doc.append(i18n.msg._('The Jupyter Notebook has two different keyboard input modes.'))
- .append(' ')
- .append(i18n.msg._('<b>Edit mode</b> allows you to type code or text into a cell and is indicated by a green cell border.'))
- .append(' ')
- .append(i18n.msg._('<b>Command mode</b> binds the keyboard to notebook level commands and is indicated by a grey cell border with a blue left margin.')
- );
- element.append(doc);
- if (platform === 'MacOS') {
- doc = $('<div/>').addClass('alert alert-info');
- var key_div = this.build_key_names();
- doc.append(key_div);
- element.append(doc);
- }
- // Command mode
- var cmd_div = this.build_command_help();
- element.append(cmd_div);
- // Edit mode
- var edit_div = this.build_edit_help(cm_shortcuts);
- element.append(edit_div);
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [ i18n.msg._("Close") ];
- this.shortcut_dialog = dialog.modal({
- title : i18n.msg._("Keyboard shortcuts"),
- body : element,
- destroy : false,
- buttons : {
- Close : {}
- },
- notebook: this.notebook,
- keyboard_manager: this.keyboard_manager,
- });
- this.shortcut_dialog.addClass("modal_stretch");
-
- this.events.on('rebuild.QuickHelp', function() { that.force_rebuild = true;});
- };
- QuickHelp.prototype.build_key_names = function () {
- var key_names_mac = [{ shortcut:"⌘", help:i18n.msg._("Command") },
- { shortcut:"⌃", help:i18n.msg._("Control") },
- { shortcut:"⌥", help:i18n.msg._("Option") },
- { shortcut:"⇧", help:i18n.msg._("Shift") },
- { shortcut:"↩", help:i18n.msg._("Return") },
- { shortcut:"␣", help:i18n.msg._("Space") },
- { shortcut:"⇥", help:i18n.msg._("Tab") }];
- var i, half, n;
- var div = $('<div/>').append('Mac OS X modifier keys:');
- var sub_div = $('<div/>').addClass('container-fluid');
- var col1 = $('<div/>').addClass('col-md-6');
- var col2 = $('<div/>').addClass('col-md-6');
- n = key_names_mac.length;
- half = ~~(n/2);
- for (i=0; i<half; i++) { col1.append(
- build_one(key_names_mac[i])
- ); }
- for (i=half; i<n; i++) { col2.append(
- build_one(key_names_mac[i])
- ); }
- sub_div.append(col1).append(col2);
- div.append(sub_div);
- return div;
- };
- QuickHelp.prototype.build_command_help = function () {
- var that = this;
- var command_shortcuts = this.keyboard_manager.command_shortcuts.help();
- var cmdkey = '<kbd>'+i18n.msg._('Esc')+'</kbd>';
- var div = build_div('<h4>'+i18n.msg.sprintf(i18n.msg._('Command Mode (press %s to enable)'),cmdkey)+'</h4>', command_shortcuts);
- var edit_button = $('<button/>')
- .text(i18n.msg._("Edit Shortcuts"))
- .addClass('btn btn-xs btn-default pull-right')
- .attr('href', '#')
- .attr('title', i18n.msg._('edit command-mode keyboard shortcuts'))
- .click(function () {
- // close this dialog
- $(that.shortcut_dialog).modal("toggle");
- // and open the next one
- $(that.shortcut_dialog).on('hidden.bs.modal', function (e) {
- that.keyboard_manager.actions.call(
- 'jupyter-notebook:edit-command-mode-keyboard-shortcuts'
- );
- });
- });
- div.find('h4').append(edit_button);
- return div;
- };
-
- QuickHelp.prototype.build_edit_help = function (cm_shortcuts) {
- var edit_shortcuts = this.keyboard_manager.edit_shortcuts.help();
- var enterkey = '<kbd>'+i18n.msg._('Enter')+'</kbd>';
- edit_shortcuts = $.merge($.merge([], cm_shortcuts), edit_shortcuts);
- return build_div('<h4>'+i18n.msg.sprintf(i18n.msg._('Edit Mode (press %s to enable)'),enterkey)+'</h4>', edit_shortcuts);
- };
- var build_one = function (s) {
- var help = s.help;
- var shortcut = '';
- if(s.shortcut){
- shortcut = humanize_sequence(s.shortcut);
- }
- return $('<div>').addClass('quickhelp').
- append($('<span/>').addClass('shortcut_key').append($(shortcut))).
- append($('<span/>').addClass('shortcut_descr').text(' : ' + help));
- };
- var build_div = function (title, shortcuts) {
-
- // Remove jupyter-notebook:ignore shortcuts.
- shortcuts = shortcuts.filter(function(shortcut) {
- if (shortcut.help === 'ignore') {
- return false;
- } else {
- return true;
- }
- });
-
- var i, half, n;
- var div = $('<div/>').append($(title));
- var sub_div = $('<div/>').addClass('container-fluid');
- var col1 = $('<div/>').addClass('col-md-6');
- var col2 = $('<div/>').addClass('col-md-6');
- n = shortcuts.length;
- half = ~~(n/2); // Truncate :)
- for (i=0; i<half; i++) { col1.append( build_one(shortcuts[i]) ); }
- for (i=half; i<n; i++) { col2.append( build_one(shortcuts[i]) ); }
- sub_div.append(col1).append(col2);
- div.append(sub_div);
- return div;
- };
- return {'QuickHelp': QuickHelp,
- humanize_shortcut: humanize_shortcut,
- humanize_sequence: humanize_sequence,
- _humanize_sequence: _humanize_sequence,
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/commandpalette',[
- 'jquery',
- 'typeahead',
- 'base/js/i18n',
- 'notebook/js/quickhelp'
- ],function($, typeahead, i18n, QH){
- "use strict";
- /**
- * Humanize the action name to be consumed by user.
- * internally the actions anem are of the form
- * <namespace>:<description-with-dashes>
- * we drop <namespace> and replace dashes for space.
- */
- var humanize_action_id = function(str) {
- return str.split(':')[1].replace(/-/g, ' ').replace(/_/g, '-');
- };
- /**
- * given an action id return 'command-shortcut', 'edit-shortcut' or 'no-shortcut'
- * for the action. This allows us to tag UI in order to visually distinguish
- * wether an action have a keybinding or not.
- **/
- var get_mode_for_action_id = function(name, notebook) {
- var shortcut = notebook.keyboard_manager.command_shortcuts.get_action_shortcut(name);
- if (shortcut) {
- return 'command-shortcut';
- }
- shortcut = notebook.keyboard_manager.edit_shortcuts.get_action_shortcut(name);
- if (shortcut) {
- return 'edit-shortcut';
- }
- return 'no-shortcut';
- };
- var CommandPalette = function(notebook) {
- if(!notebook){
- throw new Error("CommandPalette takes a notebook non-null mandatory argument");
- }
- // typeahead lib need a specific layout with specific class names.
- // the following just does that
- var form = $('<form/>');
- var container = $('<div/>').addClass('typeahead__container');
- var field = $('<div/>').addClass('typeahead__field');
- var input = $('<input/>').attr('type', 'search');
- field
- .append(
- $('<span>').addClass('typeahead__query').append(
- input
- )
- )
- .append(
- $('<span/>').addClass('typeahead__button').append(
- $('<button/>').attr('type', 'submit').append(
- $('<span/>').addClass('typeahead__search-icon')
- )
- )
- );
- container.append(field);
- form.append(container);
- var mod = $('<div/>').addClass('modal cmd-palette').append(
- $('<div/>').addClass('modal-dialog')
- .append(
- $('<div/>').addClass('modal-content').append(
- $('<div/>').addClass('modal-body')
- .append(
- form
- )
- )
- )
- )
- // end setting up right layout
- .modal({show: false, backdrop:true})
- .on('shown.bs.modal', function () {
- // click on button trigger de-focus on mouse up.
- // or something like that.
- setTimeout(function(){input.focus();}, 100);
- });
- notebook.keyboard_manager.disable();
- var before_close = function() {
- // little trick to trigger early in onsubmit
- // when the action called pop-up a dialog
- // insure this function is only called once
- if (before_close.ok) {
- return;
- }
- var cell = notebook.get_selected_cell();
- if (cell) {
- cell.select();
- }
- if (notebook.keyboard_manager) {
- notebook.keyboard_manager.enable();
- notebook.keyboard_manager.command_mode();
- }
- before_close.ok = true; // avoid double call.
- };
-
- mod.on("hide.bs.modal", before_close);
-
- // will be trigger when user select action
- var onSubmit = function(node, query, result, resultCount) {
- if (actions.indexOf(result.key) >= 0) {
- before_close();
- notebook.keyboard_manager.actions.call(result.key);
- } else {
- console.warning("No command " + result.key);
- }
- mod.modal('hide');
- };
- /* Whenever a result is rendered, if there is only one resulting
- * element then automatically select that element.
- */
- var onResult = function(node, query, result, resultCount) {
- if (resultCount == 1) {
- requestAnimationFrame(function() {
- $('.typeahead-list > li:nth-child(2)').addClass('active');
- });
- }
- };
- // generate structure needed for typeahead layout and ability to search
- var src = {};
- var actions = Object.keys(notebook.keyboard_manager.actions._actions);
- for (var i = 0; i < actions.length; i++) {
- var action_id = actions[i];
- var action = notebook.keyboard_manager.actions.get(action_id);
- var group = action_id.split(':')[0];
- src[group] = src[group] || {
- data: [],
- display: 'display'
- };
- var short = notebook.keyboard_manager.command_shortcuts.get_action_shortcut(action_id) ||
- notebook.keyboard_manager.edit_shortcuts.get_action_shortcut(action_id);
- if (short) {
- short = QH.humanize_sequence(short);
- }
- var display_text;
- if (action.cmd) {
- display_text = i18n.msg._(action.cmd);
- } else {
- display_text = humanize_action_id(action_id);
- }
- var help = null;
- if (action.help) {
- help = i18n.msg._(action.help);
- }
-
- src[group].data.push({
- display: display_text,
- shortcut: short,
- mode_shortcut: get_mode_for_action_id(action_id, notebook),
- group: group,
- icon: action.icon,
- help: help,
- key: action_id,
- });
- }
- // now src is the right structure for typeahead
- input.typeahead({
- emptyTemplate: function(query) {
- return $('<div>').text("No results found for ").append(
- $('<code>').text(query)
- );
- },
- maxItem: 1e3,
- minLength: 0,
- hint: true,
- group: {
- template:"{{group}} command group"
- },
- searchOnFocus: true,
- mustSelectItem: true,
- template: '<i class="fa fa-icon {{icon}}"></i>{{display}} <div title={{key}} class="pull-right {{mode_shortcut}}">{{shortcut}}</div>',
- order: "asc",
- source: src,
- callback: {
- onSubmit: onSubmit,
- onClickAfter: onSubmit,
- onResult: onResult
- },
- debug: false,
- });
- mod.modal('show');
- };
- return {'CommandPalette': CommandPalette};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/shortcuteditor',[
- "jquery",
- "notebook/js/quickhelp",
- "base/js/dialog",
- "components/marked/lib/marked"
- ], function (
- $,
- QH,
- dialog,
- marked
- ) {
- /**
- * Humanize the action name to be consumed by user.
- * internally the actions name are of the form
- * <namespace>:<description-with-dashes>
- * we drop <namespace> and replace dashes for space.
- */
- var humanize_action_id = function(str) {
- return str.split(':')[1].replace(/-/g, ' ').replace(/_/g, '-');
- };
- /**
- * given an action id return 'command-shortcut', 'edit-shortcut' or 'no-shortcut'
- * for the action. This allows us to tag UI in order to visually distinguish
- * Wether an action have a keybinding or not.
- **/
- var KeyBinding = createReactClass({
- displayName: 'KeyBindings',
- getInitialState: function() {
- return {shrt:''};
- },
- handleShrtChange: function (element){
- this.setState({shrt:element.target.value});
- },
- render: function(){
- var that = this;
- var available = this.props.available(this.state.shrt);
- var empty = (this.state.shrt === '');
- var binding_setter = function(){
- if (available) {
- that.props.onAddBindings(that.state.shrt, that.props.ckey);
- }
- that.state.shrt='';
- event.preventDefault();
- return false;
- };
- return React.createElement('form', {className:'jupyter-keybindings',
- onSubmit: binding_setter
- },
- React.createElement('i', {className: "pull-right fa fa-plus", alt: 'add-keyboard-shortcut',
- onClick: binding_setter
- }),
- React.createElement('input', {
- type:'text',
- placeholder:'add shortcut',
- className:'pull-right'+((available||empty)?'':' alert alert-danger'),
- value:that.state.shrt,
- onChange:that.handleShrtChange
- }),
- that.props.shortcuts ? that.props.shortcuts.map(function (item, index) {
- return React.createElement('span', {className: 'pull-right'},
- React.createElement('kbd', {}, [
- item.h,
- React.createElement('i', {className: "fa fa-times", alt: 'remove '+item.h,
- onClick:function () {
- that.props.unbind(item.raw);
- }
- })
- ])
- );
- }): null,
- React.createElement('div', {title: '(' + that.props.ckey + ')' ,
- className:'jupyter-keybindings-text'}, that.props.display )
- );
- }
- });
- var KeyBindingList = createReactClass({
- displayName: 'KeyBindingList',
- getInitialState: function(){
- return {data:[]};
- },
- componentDidMount: function(){
- this.setState({data:this.props.callback()});
- },
- render: function() {
- var that = this;
- var children = this.state.data.map(function (binding) {
- return React.createElement(KeyBinding, Object.assign({}, binding, {
- onAddBindings: function (shortcut, action) {
- that.props.bind(shortcut, action);
- that.setState({data:that.props.callback()});
- },
- available: that.props.available,
- unbind: function (shortcut) {
- that.props.unbind(shortcut);
- that.setState({data:that.props.callback()});
- }
- }));
- });
- children.unshift(React.createElement('div', {className:'well', key:'disclamer', id:'short-key-binding-intro', dangerouslySetInnerHTML:
- {__html:
- marked.marked(
- "Here you can modify the keyboard shortcuts available in "+
- "command mode. Your changes will be stored for later sessions. "+
- "See more [**details of defining keyboard shortcuts**](#long-key-binding-intro) below."
- )}
- }));
- children.push(React.createElement('div', {className:'well', key:'disclamer', id:'long-key-binding-intro', dangerouslySetInnerHTML:
- {__html:
- marked.marked(
- "This dialog allows you to modify the keyboard shortcuts available in command mode. "+
- "Any changes will be persisted between sessions and across environments. "+
- "You can define two kinds of shortcuts: **key combinations** and **key sequences**.\n"+
- "\n"+
- " - **Key Combinations**:\n"+
- " - Use hyphens `-` to represent keys that should be pressed at the same time.\n"+
- " - This is designed for use with *modifier* keys: `Cmd`, `Ctrl`, `Alt` ,`Meta`, "+
- "`Cmdtrl`, and `Shift`.\n"+
- " - `Cmdtrl` acts like `Cmd` on OS X/MacOS and `Ctrl` on Windows/Linux.\n"+
- " - At most, one non-modifier key can exist in a key combination.\n"+
- " - Multiple modifier keys can exist in a key combination.\n"+
- " - Modifier keys need to precede the non-modifier key in a combination.\n"+
- " - *Valid Examples*: `Shift-a`, `Ctrl-;`, or `Ctrl-Shift-a`. \n"+
- " - *Invalid Example*s: `a-b` and `a-Ctrl-Shift`. \n"+
- " - **Key Sequences**:\n"+
- " - Use commas `,` to represent keys that should be pressed in sequence.\n"+
- " - The order in which keys must be pressed exactly matches the left-to-right order of "+
- "the characters in the sequence, with no interruptions.\n"+
- " - E.g., `h,a,l,t` would be triggered by typing <kbd>h</kbd> <kbd>a</kbd> "+
- "<kbd>l</kbd> <kbd>t</kbd> but not <kbd>h</kbd> <kbd>a</kbd> <kbd>a</kbd> <kbd>l</kbd> "+
- "<kbd>t</kbd> or <kbd>a</kbd> <kbd>h</kbd> <kbd>l</kbd> <kbd>t</kbd>.\n"+
- " - Sequences can include the same key multiple times (e.g., `d,d`).\n"+
- " - You cannot include any pairs of sequences where one is a 'prefix' the other.\n"+
- " - E.g., `d,d,d` cannot be used a the same time as `d,d`.\n"+
- " - Key combinations are unique elements that can be used in a sequence.\n"+
- " - E.g., `Ctrl-d,d` and `d,d` can exist at the same time and are both valid key sequences.\n"+
- "\n"+
- "**Additional notes**:\n"+
- "\n"+
- "The case in which elements are written does not change the binding's meaning. "+
- "E.g., `Ctrl-D` and `cTrl-d` are the same key binding. "+
- "Thus, `Shift` needs to be explicitly included if it is part of the key binding. "+
- "So, for example, if you set a command to be activated by `Shift-D,D`, the second `d` "+
- "cannot be pressed at the same time as the `Shift` modifier key.\n"+
- "\n"+
- "Valid modifiers are specified by writing out their names explicitly: "+
- "e.g., `Shift`, `Cmd`, `Ctrl`, `Alt` ,`Meta`, `Cmdtrl`. You cannot use the symbol equivalents "+
- "(e.g., `⇧`, `⌘`, `⌃`, `⌥`); refer to developer docs for the corresponding keys "+
- "(the mapping of which depends on the platform you are using)."+
- "You can hover on the name/description of a command to see its exact internal name and "+
- "differentiate from actions defined in various plugins. \n"+
- "\n"+
- "Changing the keybindings of edit mode is not currently available."
- )}
- }));
- return React.createElement('div',{}, children);
- }
- });
- var get_shortcuts_data = function(notebook) {
- var actions = Object.keys(notebook.keyboard_manager.actions._actions);
- var src = [];
- for (var i = 0; i < actions.length; i++) {
- var action_id = actions[i];
- var action = notebook.keyboard_manager.actions.get(action_id);
- var shortcuts = notebook.keyboard_manager.command_shortcuts.get_action_shortcuts(action_id);
- var hshortcuts = [];
- if (shortcuts.length > 0) {
- hshortcuts = shortcuts.map(function (raw) {
- return {h:QH._humanize_sequence(raw),raw:raw};}
- );
- }
- src.push({
- display: humanize_action_id(action_id),
- shortcuts: hshortcuts,
- key:action_id, // react specific thing
- ckey: action_id
- });
- }
- return src;
- };
- var ShortcutEditor = function(notebook) {
- if(!notebook){
- throw new Error("CommandPalette takes a notebook non-null mandatory argument");
- }
- var body = $('<div>');
- var mod = dialog.modal({
- notebook: notebook,
- keyboard_manager: notebook.keyboard_manager,
- title : "Edit Command mode Shortcuts",
- body : body,
- buttons : {
- OK : {}
- }
- });
-
- var src = get_shortcuts_data(notebook);
- mod.addClass("modal_stretch");
- mod.modal('show');
- ReactDOM.render(
- React.createElement(KeyBindingList, {
- callback: function () { return get_shortcuts_data(notebook);},
- bind: function (shortcut, command) {
- return notebook.keyboard_manager.command_shortcuts._persist_shortcut(shortcut, command);
- },
- unbind: function (shortcut) {
- return notebook.keyboard_manager.command_shortcuts._persist_remove_shortcut(shortcut);
- },
- available: function (shrt) { return notebook.keyboard_manager.command_shortcuts.is_available_shortcut(shrt);}
- }),
- body.get(0)
- );
- };
- return {ShortcutEditor: ShortcutEditor};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- /**
- * @module notebook
- */
- define('notebook/js/notebook',[
- 'jquery',
- 'base/js/namespace',
- 'underscore',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/dialog',
- 'base/js/markdown',
- './cell',
- './textcell',
- './codecell',
- 'moment',
- 'services/config',
- 'services/sessions/session',
- './celltoolbar',
- 'codemirror/lib/codemirror',
- 'codemirror/addon/runmode/runmode',
- 'base/js/mathjaxutils',
- 'base/js/keyboard',
- './tooltip',
- './celltoolbarpresets/default',
- './celltoolbarpresets/rawcell',
- './celltoolbarpresets/slideshow',
- './celltoolbarpresets/attachments',
- './celltoolbarpresets/tags',
- './scrollmanager',
- './commandpalette',
- './shortcuteditor',
- ], function (
- $,
- IPython,
- _,
- utils,
- i18n,
- dialog,
- markdown,
- cellmod,
- textcell,
- codecell,
- moment,
- configmod,
- session,
- celltoolbar,
- CodeMirror,
- runMode,
- mathjaxutils,
- keyboard,
- tooltip,
- default_celltoolbar,
- rawcell_celltoolbar,
- slideshow_celltoolbar,
- attachments_celltoolbar,
- tags_celltoolbar,
- scrollmanager,
- commandpalette,
- shortcuteditor
- ) {
- var ShortcutEditor = shortcuteditor.ShortcutEditor;
- var _SOFT_SELECTION_CLASS = 'jupyter-soft-selected';
- function soft_selected(cell){
- return cell.element.hasClass(_SOFT_SELECTION_CLASS);
- }
- /**
- * Contains and manages cells.
- * @class Notebook
- * @param {string} selector
- * @param {object} options - Dictionary of keyword arguments.
- * @param {jQuery} options.events - selector of Events
- * @param {KeyboardManager} options.keyboard_manager
- * @param {Contents} options.contents
- * @param {SaveWidget} options.save_widget
- * @param {object} options.config
- * @param {string} options.base_url
- * @param {string} options.notebook_path
- * @param {string} options.notebook_name
- */
- function Notebook(selector, options) {
- this.config = options.config;
- this.config.loaded.then(this.validate_config.bind(this));
- this.class_config = new configmod.ConfigWithDefaults(this.config,
- Notebook.options_default, 'Notebook');
- this.nbclassic_path = options.nbclassic_path;
- this.base_url = options.base_url;
- this.notebook_path = options.notebook_path;
- this.notebook_name = options.notebook_name;
- this.events = options.events;
- this.keyboard_manager = options.keyboard_manager;
- this.contents = options.contents;
- this.save_widget = options.save_widget;
- this.tooltip = new tooltip.Tooltip(this.events);
- this.ws_url = options.ws_url;
- this._session_starting = false;
- this.last_modified = null;
- // debug 484
- this._last_modified = 'init';
- // Firefox workaround
- this._ff_beforeunload_fired = false;
- // Create default scroll manager.
- this.scroll_manager = new scrollmanager.ScrollManager(this);
- // TODO: This code smells (and the other `= this` line a couple lines down)
- // We need a better way to deal with circular instance references.
- this.keyboard_manager.notebook = this;
- this.save_widget.notebook = this;
-
- mathjaxutils.init();
- this.element = $(selector);
- this.element.scroll();
- this.element.data("notebook", this);
- this.session = null;
- this.kernel = null;
- this.kernel_busy = false;
- this.clipboard = null;
- this.clipboard_attachments = null;
- this.undelete_backup_stack = [];
- this.paste_enabled = false;
- this.paste_attachments_enabled = false;
- this.writable = false;
- // It is important to start out in command mode to match the initial mode
- // of the KeyboardManager.
- this.mode = 'command';
- this.set_dirty(false);
- this.metadata = {};
- this._checkpoint_after_save = false;
- this.last_checkpoint = null;
- this.checkpoints = [];
- this.autosave_interval = 0;
- this.autosave_timer = null;
- // autosave *at most* every two minutes
- this.minimum_autosave_interval = 120000;
- this.notebook_name_blacklist_re = /[\/\\:]/;
- this.nbformat = 4; // Increment this when changing the nbformat
- this.nbformat_minor = this.current_nbformat_minor = 1; // Increment this when changing the nbformat
- this.codemirror_mode = 'text';
- this.create_elements();
- this.bind_events();
- this.kernel_selector = null;
- this.dirty = null;
- this.trusted = null;
- this._changed_on_disk_dialog = null;
- this._fully_loaded = false;
- // Trigger cell toolbar registration.
- default_celltoolbar.register(this);
- rawcell_celltoolbar.register(this);
- slideshow_celltoolbar.register(this);
- attachments_celltoolbar.register(this);
- tags_celltoolbar.register(this);
- var that = this;
- Object.defineProperty(this, 'line_numbers', {
- get: function() {
- var d = that.config.data || {};
- var cmc = (d['Cell'] || {}) ['cm_config'] || {};
- return cmc['lineNumbers'] || false;
- },
- set: function(value) {
- that.config.update({
- 'Cell': {
- 'cm_config': {
- 'lineNumbers':value
- }
- }
- });
- }
- });
-
- Object.defineProperty(this, 'header', {
- get: function() {
- return that.class_config.get_sync('Header');
- },
- set: function(value) {
- that.class_config.set('Header', value);
- }
- });
-
- Object.defineProperty(this, 'toolbar', {
- get: function() {
- return that.class_config.get_sync('Toolbar');
- },
- set: function(value) {
- that.class_config.set('Toolbar', value);
- }
- });
-
- this.class_config.get('Header').then(function(header) {
- if (header === false) {
- that.keyboard_manager.actions.call('jupyter-notebook:hide-header');
- }
- });
-
- this.class_config.get('Toolbar').then(function(toolbar) {
- if (toolbar === false) {
- that.keyboard_manager.actions.call('jupyter-notebook:hide-toolbar');
- }
- });
-
- // prevent assign to miss-typed properties.
- Object.seal(this);
- }
- Notebook.options_default = {
- // can be any cell type, or the special values of
- // 'above', 'below', or 'selected' to get the value from another cell.
- default_cell_type: 'code',
- Header: true,
- Toolbar: true,
- kill_kernel: false
- };
- Notebook.prototype.validate_config = function() {
- var code_cell = this.config.data['CodeCell'] || {};
- var cm_keymap = (code_cell['cm_config'] || {})['keyMap'];
- if (cm_keymap && CodeMirror.keyMap[cm_keymap] === undefined) {
- console.warn('CodeMirror keymap not found, ignoring: ' + cm_keymap);
- delete code_cell.cm_config.keyMap;
- }
- };
- /**
- * Create an HTML and CSS representation of the notebook.
- */
- Notebook.prototype.create_elements = function () {
- var that = this;
- this.element.attr('tabindex','-1');
- this.container = $("<div/>").addClass("container").attr("id", "notebook-container");
- // We add this end_space div to the end of the notebook div to:
- // i) provide a margin between the last cell and the end of the notebook
- // ii) to prevent the div from scrolling up when the last cell is being
- // edited, but is too low on the page, which browsers will do automatically.
- var end_space = $('<div/>')
- .addClass('end_space');
- end_space.dblclick(function () {
- var ncells = that.ncells();
- that.insert_cell_below('code',ncells-1);
- });
- this.element.append(this.container);
- this.container.after(end_space);
- };
- /**
- * Bind JavaScript events: key presses and custom Jupyter events.
- */
- Notebook.prototype.bind_events = function () {
- var that = this;
- this.events.on('set_next_input.Notebook', function (event, data) {
- if (data.replace) {
- data.cell.set_text(data.text);
- if (data.clear_output !== false) {
- // default (undefined) is true to preserve prior behavior
- data.cell.clear_output();
- }
- } else {
- var index = that.find_cell_index(data.cell);
- var new_cell = that.insert_cell_below('code',index);
- new_cell.set_text(data.text);
- }
- that.dirty = true;
- });
- this.events.on('unrecognized_cell.Cell', function () {
- that.warn_nbformat_minor();
- });
- this.events.on('unrecognized_output.OutputArea', function () {
- that.warn_nbformat_minor();
- });
- this.events.on('set_dirty.Notebook', function (event, data) {
- that.dirty = data.value;
- });
- this.events.on('trust_changed.Notebook', function (event, trusted) {
- that.trusted = trusted;
- });
- this.events.on('select.Cell', function (event, data) {
- var index = that.find_cell_index(data.cell);
- that.select(index, !data.extendSelection);
- });
- this.events.on('edit_mode.Cell', function (event, data) {
- that.handle_edit_mode(data.cell);
- });
- this.events.on('command_mode.Cell', function (event, data) {
- that.handle_command_mode(data.cell);
- });
-
- this.events.on('spec_changed.Kernel', function(event, data) {
- var existing_spec = that.metadata.kernelspec;
- that.metadata.kernelspec = {
- name: data.name,
- display_name: data.spec.display_name,
- language: data.spec.language,
- };
- if (!existing_spec || ! _.isEqual(existing_spec, that.metadata.kernelspec)) {
- that.set_dirty(true);
- }
- // start a new session
- that.start_session(data.name);
- });
- this.events.on('kernel_ready.Kernel', function(event, data) {
- var kinfo = data.kernel.info_reply;
- if (!kinfo.language_info) {
- delete that.metadata.language_info;
- return;
- }
- var existing_info = that.metadata.language_info;
- var langinfo = kinfo.language_info;
- that.metadata.language_info = langinfo;
- if (!existing_info || ! _.isEqual(existing_info, langinfo)) {
- that.set_dirty(true);
- }
- // Mode 'null' should be plain, unhighlighted text.
- var cm_mode = langinfo.codemirror_mode || langinfo.name || 'null';
- that.set_codemirror_mode(cm_mode);
- });
-
- this.events.on('kernel_idle.Kernel', function () {
- that.kernel_busy = false;
- });
-
- this.events.on('kernel_busy.Kernel', function () {
- that.kernel_busy = true;
- });
- var collapse_time = function (time) {
- var app_height = $('#ipython-main-app').height(); // content height
- var splitter_height = $('div#pager_splitter').outerHeight(true);
- var new_height = app_height - splitter_height;
- that.element.animate({height : new_height + 'px'}, time);
- };
- this.element.bind('collapse_pager', function (event, extrap) {
- var time = (extrap !== undefined) ? ((extrap.duration !== undefined ) ? extrap.duration : 'fast') : 'fast';
- collapse_time(time);
- });
- var expand_time = function (time) {
- var app_height = $('#ipython-main-app').height(); // content height
- var splitter_height = $('div#pager_splitter').outerHeight(true);
- var pager_height = $('div#pager').outerHeight(true);
- var new_height = app_height - pager_height - splitter_height;
- that.element.animate({height : new_height + 'px'}, time);
- };
- this.element.bind('expand_pager', function (event, extrap) {
- var time = (extrap !== undefined) ? ((extrap.duration !== undefined ) ? extrap.duration : 'fast') : 'fast';
- expand_time(time);
- });
- // Firefox 22 broke $(window).on("beforeunload")
- // I'm not sure why or how.
- window.onbeforeunload = function () {
- /* Make kill kernel configurable.
- example in custom.js:
- var notebook = Jupyter.notebook;
- var config = notebook.config;
- var patch = {
- Notebook:{
- kill_kernel: true
- }
- };
- config.update(patch);
- */
- var kill_kernel = that.class_config.get_sync("kill_kernel");
- if (kill_kernel) {
- that.session.delete();
- }
- if ( utils.browser[0] === "Firefox") {
- // Workaround ancient Firefox bug showing beforeunload twice: https://bugzilla.mozilla.org/show_bug.cgi?id=531199
- if (that._ff_beforeunload_fired) {
- return; // don't show twice on FF
- }
- that._ff_beforeunload_fired = true;
- // unset flag immediately after dialog is dismissed
- setTimeout(function () {
- that._ff_beforeunload_fired = false;
- }, 1);
- }
- // if we are autosaving, trigger an autosave on nav-away.
- // still warn, because if we don't the autosave may fail.
- if (that.dirty) {
- if ( that.autosave_interval ) {
- // schedule autosave in a timeout
- // this gives you a chance to forcefully discard changes
- // by reloading the page if you *really* want to.
- // the timer doesn't start until you *dismiss* the dialog.
- setTimeout(function () {
- if (that.dirty) {
- that.save_notebook();
- }
- }, 1000);
- return i18n.msg._("Autosave in progress, latest changes may be lost.");
- } else {
- return i18n.msg._("Unsaved changes will be lost.");
- }
- }
- // if the kernel is busy, prompt the user if he’s sure
- if (that.kernel_busy) {
- return i18n.msg._("The Kernel is busy, outputs may be lost.");
- }
- // IE treats null as a string. Instead just return which will avoid the dialog.
- return;
- };
- };
-
- Notebook.prototype.show_command_palette = function() {
- new commandpalette.CommandPalette(this);
- };
- Notebook.prototype.show_shortcuts_editor = function() {
- new ShortcutEditor(this);
- };
- /**
- * Trigger a warning dialog about missing functionality from newer minor versions
- */
- Notebook.prototype.warn_nbformat_minor = function () {
- var v = 'v' + this.nbformat + '.';
- var orig_vs = v + this.nbformat_minor;
- var this_vs = v + this.current_nbformat_minor;
- var msg = i18n.msg.sprintf(i18n.msg._("This notebook is version %1$s, but we only fully support up to %2$s."),
- orig_vs,this_vs) + " " +
- i18n.msg._("You can still work with this notebook, but cell and output types introduced in later notebook versions will not be available.");
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [
- i18n.msg._("OK"),
- i18n.msg._("Restart and Run All Cells"),
- i18n.msg._("Restart and Clear All Outputs"),
- i18n.msg._("Restart"),
- i18n.msg._("Continue Running"),
- i18n.msg._("Reload"),
- i18n.msg._("Cancel"),
- i18n.msg._("Overwrite"),
- i18n.msg._("Trust"),
- i18n.msg._("Revert")];
-
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title : i18n.msg._("Newer Notebook"),
- body : msg,
- buttons : {
- OK : {
- "class" : "btn-danger"
- }
- }
- });
- };
- /**
- * Set the dirty flag, and trigger the set_dirty.Notebook event
- */
- Notebook.prototype.set_dirty = function (value) {
- if (value === undefined) {
- value = true;
- }
- if (this.dirty === value) {
- return;
- }
- this.events.trigger('set_dirty.Notebook', {value: value});
- };
- /**
- * Scroll the top of the page to a given cell.
- *
- * @param {integer} index - An index of the cell to view
- * @param {integer} time - Animation time in milliseconds
- * @return {integer} Pixel offset from the top of the container
- */
- Notebook.prototype.scroll_to_cell = function (index, time) {
- return this.scroll_cell_percent(index, 0, time);
- };
- /**
- * Scroll the middle of the page to a given cell.
- *
- * @param {integer} index - An index of the cell to view
- * @param {integer} percent - 0-100, the location on the screen to scroll.
- * 0 is the top, 100 is the bottom.
- * @param {integer} time - Animation time in milliseconds
- * @return {integer} Pixel offset from the top of the container
- */
- Notebook.prototype.scroll_cell_percent = function (index, percent, time) {
- var cells = this.get_cells();
- time = time || 0;
- percent = percent || 0;
- index = Math.min(cells.length-1,index);
- index = Math.max(0 ,index);
- var sme = this.scroll_manager.element;
- var h = sme.height();
- var st = sme.scrollTop();
- var t = sme.offset().top;
- var ct = cells[index].element.offset().top;
- var scroll_value = st + ct - (t + 0.01 * percent * h);
- this.scroll_manager.element.animate({scrollTop:scroll_value}, time);
- return scroll_value;
- };
- /**
- * Scroll to the bottom of the page.
- */
- Notebook.prototype.scroll_to_bottom = function () {
- this.scroll_manager.element.animate({scrollTop:this.element.get(0).scrollHeight}, 0);
- };
- /**
- * Scroll to the top of the page.
- */
- Notebook.prototype.scroll_to_top = function () {
- this.scroll_manager.element.animate({scrollTop:0}, 0);
- };
- // Edit Notebook metadata
- /**
- * Display a dialog that allows the user to edit the Notebook's metadata.
- */
- Notebook.prototype.edit_metadata = function () {
- var that = this;
- dialog.edit_metadata({
- md: this.metadata,
- callback: function (new_md) {
- if(!_.isEqual(that.metadata, new_md)){
- that.set_dirty(true);
- }
- that.metadata = new_md;
- },
- name: 'Notebook',
- notebook: this,
- keyboard_manager: this.keyboard_manager});
- };
- // Cell indexing, retrieval, etc.
- /**
- * Get all cell elements in the notebook.
- *
- * @return {jQuery} A selector of all cell elements
- */
- Notebook.prototype.get_cell_elements = function () {
- var container = this.container || $('#notebook-container');
- return container.find(".cell").not('.cell .cell');
- };
- /**
- * Get a particular cell element.
- *
- * @param {integer} index An index of a cell to select
- * @return {jQuery} A selector of the given cell.
- */
- Notebook.prototype.get_cell_element = function (index) {
- var result = null;
- var e = this.get_cell_elements().eq(index);
- if (e.length !== 0) {
- result = e;
- }
- return result;
- };
- /**
- * Try to get a particular cell by msg_id.
- *
- * @param {string} msg_id A message UUID
- * @return {Cell} Cell or null if no cell was found.
- */
- Notebook.prototype.get_msg_cell = function (msg_id) {
- return codecell.CodeCell.msg_cells[msg_id] || null;
- };
- /**
- * Count the cells in this notebook.
- *
- * @return {integer} The number of cells in this notebook
- */
- Notebook.prototype.ncells = function () {
- return this.get_cell_elements().length;
- };
- /**
- * Get all cell objects in this notebook.
- *
- * @return {Array} This notebook's Cell objects
- */
- Notebook.prototype.get_cells = function () {
- // TODO: we are often calling cells as cells()[i], which we should optimize
- // to cells(i) or a new method.
- return this.get_cell_elements().toArray().map(function (e) {
- return $(e).data("cell");
- });
- };
- /**
- * Get a cell object from this notebook.
- *
- * @param {integer} index - An index of a cell to retrieve
- * @return {Cell} Cell or null if no cell was found.
- */
- Notebook.prototype.get_cell = function (index) {
- var result = null;
- var ce = this.get_cell_element(index);
- if (ce !== null) {
- result = ce.data('cell');
- }
- return result;
- };
- /**
- * Get the cell below a given cell.
- *
- * @param {Cell} cell
- * @return {Cell} the next cell or null if no cell was found.
- */
- Notebook.prototype.get_next_cell = function (cell) {
- var result = null;
- var index = this.find_cell_index(cell);
- if (this.is_valid_cell_index(index+1)) {
- result = this.get_cell(index+1);
- }
- return result;
- };
-
- /**
- * Toggles the display of line numbers in all cells.
- */
- Notebook.prototype.toggle_all_line_numbers = function () {
- this.line_numbers = !this.line_numbers;
- };
- /**
- * Reads direction settings (LTR/RTL) from nbclassic/cells metadata
- * and applies them to display elements.
- */
- Notebook.prototype.apply_directionality = function () {
- var notebook_direction = this.metadata.direction || 'ltr';
- // html
- document.body.setAttribute('dir', notebook_direction);
- // existing cells
- this.get_cells().forEach( function(cell) {
- if (cell.cell_type == 'markdown') {
- cell.code_mirror.setOption('direction', cell.metadata.direction || notebook_direction);
- cell.element.find('.rendered_html').attr('dir', cell.metadata.direction || notebook_direction);
- } else if (cell.cell_type == 'code') {
- cell.element.find('.output_text').attr('dir', cell.metadata.direction || 'auto');
- }
- });
- // new cells
- textcell.MarkdownCell.options_default.cm_config.direction = notebook_direction;
- };
- /**
- * Get the cell above a given cell.
- *
- * @param {Cell} cell
- * @return {Cell} The previous cell or null if no cell was found.
- */
- Notebook.prototype.get_prev_cell = function (cell) {
- var result = null;
- var index = this.find_cell_index(cell);
- if (index !== null && index > 0) {
- result = this.get_cell(index-1);
- }
- return result;
- };
-
- /**
- * Get the numeric index of a given cell.
- *
- * @param {Cell} cell
- * @return {integer} The cell's numeric index or null if no cell was found.
- */
- Notebook.prototype.find_cell_index = function (cell) {
- var result = null;
- this.get_cell_elements().filter(function (index) {
- if ($(this).data("cell") === cell) {
- result = index;
- }
- });
- return result;
- };
- /**
- * Return given index if defined, or the selected index if not.
- *
- * @param {integer} [index] - A cell's index
- * @return {integer} cell index
- */
- Notebook.prototype.index_or_selected = function (index) {
- var i;
- if (index === undefined || index === null) {
- i = this.get_selected_index();
- if (i === null) {
- i = 0;
- }
- } else {
- i = index;
- }
- return i;
- };
- /**
- * Get the selected cells.
- *
- * @return {Cell} The selected cells or null if no cell was found.
- */
- Notebook.prototype.get_selected_cells = function () {
- return this.get_cells().filter(function(cell, index){ return cell.selected || soft_selected(cell) || cell.anchor;});
- };
-
- /**
- * Get the selected cells.
- *
- * @return {array} cell indicies
- */
- Notebook.prototype.get_selected_cells_indices = function () {
- var result = [];
- this.get_cells().filter(function (cell, index) {
- if (cell.selected || soft_selected(cell) || cell.anchor) {
- result.push(index);
- }
- });
- return result;
- };
- /**
- * Get the currently selected cell.
- *
- * @return {Cell} The selected cell
- */
- Notebook.prototype.get_selected_cell = function () {
- var index = this.get_selected_index();
- return this.get_cell(index);
- };
- /**
- * Check whether a cell index is valid.
- *
- * @param {integer} index - A cell index
- * @return True if the index is valid, false otherwise
- */
- Notebook.prototype.is_valid_cell_index = function (index) {
- if (index !== null && index >= 0 && index < this.ncells()) {
- return true;
- } else {
- return false;
- }
- };
- /**
- * Returns the index of the cell that the selection is currently anchored on.
- *
- * @return {integer} Index of first cell selected in selection
- */
- Notebook.prototype.get_anchor_index = function () {
- var result = null;
- this.get_cell_elements().filter(function (index) {
- if ($(this).data("cell").anchor === true) {
- result = index;
- }
- });
- return result;
- };
- /**
- * Get the index of the currently selected cell.
- *
- * @return {integer} The selected cell's numeric index
- */
- Notebook.prototype.get_selected_index = function () {
- var result = null;
- this.get_cell_elements().filter(function (index) {
- if ($(this).data("cell").selected === true) {
- result = index;
- }
- });
- return result;
- };
- // Cell selection.
- Notebook.prototype.extend_selection_by = function(delta) {
- var index = this.get_selected_index();
- // do not move anchor
- return this.select(index+delta, false);
- };
- Notebook.prototype.update_soft_selection = function(){
- var i1 = this.get_selected_index();
- var i2 = this.get_anchor_index();
- var low = Math.min(i1, i2);
- var high = Math.max(i1, i2);
- this.get_cells().map(function(cell, index, all){
- if( low <= index && index <= high && low !== high){
- cell.element.addClass(_SOFT_SELECTION_CLASS);
- } else {
- cell.element.removeClass(_SOFT_SELECTION_CLASS);
- }
- });
- };
- Notebook.prototype.select_all = function(){
- this.select(0, true);
- this.select(this.ncells()-1, false);
- };
- Notebook.prototype._contract_selection = function(){
- var i = this.get_selected_index();
- this.select(i, true);
- };
- /**
- * Programmatically select a cell.
- *
- * @param {integer} index - A cell's index
- * @param {boolean} moveanchor – whether to move the selection
- * anchor, default to true.
- * @return {Notebook} This notebook
- */
- Notebook.prototype.select = function (index, moveanchor) {
- moveanchor = (moveanchor===undefined)? true : moveanchor;
- if (this.is_valid_cell_index(index)) {
- var sindex = this.get_selected_index();
- if (sindex !== null && index !== sindex) {
- // If we are about to select a different cell, make sure we are
- // first in command mode.
- if (this.mode !== 'command') {
- this.command_mode();
- }
- this.get_cell(sindex).unselect(moveanchor);
- }
- if(moveanchor){
- this.get_cell(this.get_anchor_index()).unselect(moveanchor);
- }
- var cell = this.get_cell(index);
- cell.select(moveanchor);
- this.update_soft_selection();
- if (cell.cell_type === 'heading') {
- this.events.trigger('selected_cell_type_changed.Notebook',
- {
- 'cell_type': cell.cell_type,
- 'level': cell.level,
- 'editable': cell.is_editable()
- }
- );
- } else {
- this.events.trigger('selected_cell_type_changed.Notebook',
- {
- 'cell_type': cell.cell_type,
- 'editable': cell.is_editable()
- }
- );
- }
- }
- return this;
- };
- /**
- * Programmatically select the next cell.
- *
- * @param {bool} moveanchor – whether to move the selection
- * anchor, default to true.
- * @return {Notebook} This notebook
- */
- Notebook.prototype.select_next = function (moveanchor) {
- var index = this.get_selected_index();
- this.select(index+1, moveanchor);
- return this;
- };
- /**
- * Programmatically select the previous cell.
- *
- * @return {Notebook} This notebook
- */
- Notebook.prototype.select_prev = function (moveanchor) {
- var index = this.get_selected_index();
- this.select(index-1, moveanchor);
- return this;
- };
- // Edit/Command mode
- /**
- * Gets the index of the cell that is in edit mode.
- *
- * @return {integer} index
- */
- Notebook.prototype.get_edit_index = function () {
- var result = null;
- this.get_cell_elements().filter(function (index) {
- if ($(this).data("cell").mode === 'edit') {
- result = index;
- }
- });
- return result;
- };
- /**
- * Handle when a a cell blurs and the notebook should enter command mode.
- *
- * @param {Cell} [cell] - Cell to enter command mode on.
- */
- Notebook.prototype.handle_command_mode = function (cell) {
- if (this.mode !== 'command') {
- cell.command_mode();
- this.mode = 'command';
- this.events.trigger('command_mode.Notebook');
- this.keyboard_manager.command_mode();
- }
- };
- /**
- * Make the notebook enter command mode.
- */
- Notebook.prototype.command_mode = function () {
- var cell = this.get_cell(this.get_edit_index());
- if (cell && this.mode !== 'command') {
- // We don't call cell.command_mode, but rather blur the CM editor
- // which will trigger the call to handle_command_mode.
- cell.code_mirror.getInputField().blur();
- }
- };
- /**
- * Handle when a cell fires it's edit_mode event.
- *
- * @param {Cell} [cell] Cell to enter edit mode on.
- */
- Notebook.prototype.handle_edit_mode = function (cell) {
- this._contract_selection();
- if (cell && this.mode !== 'edit') {
- cell.edit_mode();
- this.mode = 'edit';
- this.events.trigger('edit_mode.Notebook');
- this.keyboard_manager.edit_mode();
- }
- };
- /**
- * Make a cell enter edit mode.
- */
- Notebook.prototype.edit_mode = function () {
- this._contract_selection();
- var cell = this.get_selected_cell();
- if (cell && this.mode !== 'edit') {
- cell.unrender();
- cell.focus_editor();
- }
- };
-
- /**
- * Ensure either cell or codemirror is focused. If none
- * is focused, focus the cell.
- */
- Notebook.prototype.ensure_focused = function(){
- var cell = this.get_selected_cell();
- if (cell === null) {return;} // No cell is selected
- cell.ensure_focused();
- };
- /**
- * Focus the currently selected cell.
- */
- Notebook.prototype.focus_cell = function () {
- var cell = this.get_selected_cell();
- if (cell === null) {return;} // No cell is selected
- cell.focus_cell();
- };
- // Cell movement
- /**
- * Move the current selection up, keeping the same cells selected
- * No op if the selection is at the beginning of the notebook
- */
- Notebook.prototype.move_selection_up = function(){
- // actually will move the cell before the selection, after the selection
- var indices = this.get_selected_cells_indices();
- var first = indices[0];
- var last = indices[indices.length - 1];
- var selected = this.get_selected_index();
- var anchored = this.get_anchor_index();
- if (first === 0){
- return;
- }
- var tomove = this.get_cell_element(first - 1);
- var pivot = this.get_cell_element(last);
- tomove.detach();
- pivot.after(tomove);
- this.get_cell(selected-1).focus_cell();
- this.select(anchored - 1);
- this.select(selected - 1, false);
- };
- /**
- * Move the current selection down, keeping the same cells selected.
- * No op if the selection is at the end of the notebook
- */
- Notebook.prototype.move_selection_down = function(){
- // actually will move the cell after the selection, before the selection
- var indices = this.get_selected_cells_indices();
- var first = indices[0];
- var last = indices[indices.length - 1];
- var selected = this.get_selected_index();
- var anchored = this.get_anchor_index();
- if(!this.is_valid_cell_index(last + 1)){
- return;
- }
- var tomove = this.get_cell_element(last + 1);
- var pivot = this.get_cell_element(first);
- tomove.detach();
- pivot.before(tomove);
- this.get_cell(selected+1).focus_cell();
- this.select(first);
- this.select(anchored + 1);
- this.select(selected + 1, false);
- };
- /**
- * Move given (or selected) cell up and select it.
- *
- * @param {integer} [index] - cell index
- * @return {Notebook} This notebook
- */
- Notebook.prototype.move_cell_up = function (index) {
- console.warn('Notebook.move_cell_up is deprecated as of v4.1 and will be removed in v5.0');
- if(index === undefined){
- this.move_selection_up();
- return this;
- }
-
- var i = this.index_or_selected(index);
- if (this.is_valid_cell_index(i) && i > 0) {
- var pivot = this.get_cell_element(i-1);
- var tomove = this.get_cell_element(i);
- if (pivot !== null && tomove !== null) {
- tomove.detach();
- pivot.before(tomove);
- this.select(i-1);
- var cell = this.get_selected_cell();
- cell.focus_cell();
- }
- this.set_dirty(true);
- }
- return this;
- };
- /**
- * Move given (or selected) cell down and select it.
- *
- * @param {integer} [index] - cell index
- * @return {Notebook} This notebook
- */
- Notebook.prototype.move_cell_down = function (index) {
- console.warn('Notebook.move_cell_down is deprecated as of v4.1 and will be removed in v5.0');
- if(index === undefined){
- this.move_selection_down();
- return this;
- }
-
- var i = this.index_or_selected(index);
- if (this.is_valid_cell_index(i) && this.is_valid_cell_index(i+1)) {
- var pivot = this.get_cell_element(i+1);
- var tomove = this.get_cell_element(i);
- if (pivot !== null && tomove !== null) {
- tomove.detach();
- pivot.after(tomove);
- this.select(i+1);
- var cell = this.get_selected_cell();
- cell.focus_cell();
- }
- }
- this.set_dirty();
- return this;
- };
- // Insertion, deletion.
- /**
- * Delete a cell from the notebook without any precautions
- * Needed to reload checkpoints and other things like that.
- *
- * @param {integer} [index] - cell's numeric index
- * @return {Notebook} This notebook
- */
- Notebook.prototype._unsafe_delete_cell = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- $('#undelete_cell').addClass('disabled');
- $('#undelete_cell > a').attr('aria-disabled','true');
- if (this.is_valid_cell_index(i)) {
- var old_ncells = this.ncells();
- var ce = this.get_cell_element(i);
- ce.remove();
- this.set_dirty(true);
- }
- return this;
- };
- /**
- * Delete cells from the notebook
- *
- * @param {Array} [indices] - the numeric indices of cells to delete.
- * @return {Notebook} This notebook
- */
- Notebook.prototype.delete_cells = function(indices) {
- if (indices === undefined) {
- indices = this.get_selected_cells_indices();
- }
- var undelete_backup = {
- cells: [],
- below: false,
- index: 0,
- };
- var cursor_ix_before = this.get_selected_index();
- var deleting_before_cursor = 0;
- for (var i=0; i < indices.length; i++) {
- if (!this.get_cell(indices[i]).is_deletable()) {
- // If any cell is marked undeletable, cancel
- return this;
- }
- if (indices[i] < cursor_ix_before) {
- deleting_before_cursor++;
- }
- }
- // If we started deleting cells from the top, the later indices would
- // get offset. We sort them into descending order to avoid that.
- indices.sort(function(a, b) {return b-a;});
- for (i=0; i < indices.length; i++) {
- var cell = this.get_cell(indices[i]);
- undelete_backup.cells.push(cell.toJSON());
- this.get_cell_element(indices[i]).remove();
- this.events.trigger('delete.Cell', {'cell': cell, 'index': indices[i]});
- }
- var new_ncells = this.ncells();
- // Always make sure we have at least one cell.
- if (new_ncells === 0) {
- this.insert_cell_below('code');
- new_ncells = 1;
- }
- var cursor_ix_after = this.get_selected_index();
- if (cursor_ix_after === null) {
- // Selected cell was deleted
- cursor_ix_after = cursor_ix_before - deleting_before_cursor;
- if (cursor_ix_after >= new_ncells) {
- cursor_ix_after = new_ncells - 1;
- undelete_backup.below = true;
- }
- this.select(cursor_ix_after);
- }
- // Check if the cells were after the cursor
- for (i=0; i < indices.length; i++) {
- if (indices[i] > cursor_ix_before) {
- undelete_backup.below = true;
- }
- }
- // This will put all the deleted cells back in one location, rather than
- // where they came from. It will do until we have proper undo support.
- undelete_backup.index = cursor_ix_after;
- $('#undelete_cell').removeClass('disabled');
- $('#undelete_cell > a').attr('aria-disabled','false');
- this.undelete_backup_stack.push(undelete_backup);
- this.set_dirty(true);
- return this;
- };
- /**
- * Delete a cell from the notebook.
- *
- * @param {integer} [index] - cell's numeric index
- * @return {Notebook} This notebook
- */
- Notebook.prototype.delete_cell = function (index) {
- if (index === undefined) {
- return this.delete_cells();
- } else {
- return this.delete_cells([index]);
- }
- };
- /**
- * Restore the most recently deleted cells.
- */
- Notebook.prototype.undelete_cell = function() {
- if (this.undelete_backup_stack.length > 0) {
- var undelete_backup = this.undelete_backup_stack.pop();
- var i, cell_data, new_cell, insert;
- if (undelete_backup.below) {
- insert = $.proxy(this.insert_cell_below, this);
- } else {
- insert = $.proxy(this.insert_cell_above, this);
- }
- for (i=0; i < undelete_backup.cells.length; i++) {
- cell_data = undelete_backup.cells[i];
- new_cell = insert(cell_data.cell_type, undelete_backup.index);
- new_cell.fromJSON(cell_data);
- }
- this.set_dirty(true);
- }
- if (this.undelete_backup_stack.length === 0) {
- $('#undelete_cell').addClass('disabled');
- $('#undelete_cell > a').attr('aria-disabled','true');
- }
- };
- /**
- * Insert a cell so that after insertion the cell is at given index.
- *
- * If cell type is not provided, it will default to the type of the
- * currently active cell.
- *
- * Similar to insert_above, but index parameter is mandatory.
- *
- * Index will be brought back into the accessible range [0,n].
- *
- * @param {string} [type] - in ['code','markdown', 'raw'], defaults to 'code'
- * @param {integer} [index] - a valid index where to insert cell
- * @return {Cell|null} created cell or null
- */
- Notebook.prototype.insert_cell_at_index = function(type, index){
- var ncells = this.ncells();
- index = Math.min(index, ncells);
- index = Math.max(index, 0);
- var cell = null;
- type = type || this.class_config.get_sync('default_cell_type');
- if (type === 'above') {
- if (index > 0) {
- type = this.get_cell(index-1).cell_type;
- } else {
- type = 'code';
- }
- } else if (type === 'below') {
- if (index < ncells) {
- type = this.get_cell(index).cell_type;
- } else {
- type = 'code';
- }
- } else if (type === 'selected') {
- type = this.get_selected_cell().cell_type;
- }
- if (ncells === 0 || this.is_valid_cell_index(index) || index === ncells) {
- var cell_options = {
- events: this.events,
- config: this.config,
- keyboard_manager: this.keyboard_manager,
- notebook: this,
- tooltip: this.tooltip
- };
- switch(type) {
- case 'code':
- cell = new codecell.CodeCell(this.kernel, cell_options);
- cell.set_input_prompt();
- break;
- case 'markdown':
- cell = new textcell.MarkdownCell(cell_options);
- break;
- case 'raw':
- cell = new textcell.RawCell(cell_options);
- break;
- default:
- console.log("Unrecognized cell type: ", type, cellmod);
- cell = new cellmod.UnrecognizedCell(cell_options);
- }
- if(this._insert_element_at_index(cell.element,index)) {
- cell.render();
- this.events.trigger('create.Cell', {'cell': cell, 'index': index});
- cell.refresh();
- // We used to select the cell after we refresh it, but there
- // are now cases were this method is called where select is
- // not appropriate. The selection logic should be handled by the
- // caller of the the top level insert_cell methods.
- this.set_dirty(true);
- }
- }
- return cell;
- };
- /**
- * Insert an element at given cell index.
- *
- * @param {HTMLElement} element - a cell element
- * @param {integer} [index] - a valid index where to inser cell
- * @returns {boolean} success
- */
- Notebook.prototype._insert_element_at_index = function(element, index){
- if (element === undefined){
- return false;
- }
- var ncells = this.ncells();
- if (ncells === 0) {
- // special case append if empty
- this.container.append(element);
- } else if ( ncells === index ) {
- // special case append it the end, but not empty
- this.get_cell_element(index-1).after(element);
- } else if (this.is_valid_cell_index(index)) {
- // otherwise always somewhere to append to
- this.get_cell_element(index).before(element);
- } else {
- return false;
- }
-
- this.undelete_backup_stack.map(function (undelete_backup) {
- if (index < undelete_backup.index) {
- undelete_backup.index += 1;
- }
- });
- this.set_dirty(true);
- return true;
- };
- /**
- * Insert a cell of given type above given index, or at top
- * of notebook if index smaller than 0.
- *
- * @param {string} [type] - cell type
- * @param {integer} [index] - defaults to the currently selected cell
- * @return {Cell|null} handle to created cell or null
- */
- Notebook.prototype.insert_cell_above = function (type, index) {
- if (index === null || index === undefined) {
- index = Math.min(this.get_selected_index(index), this.get_anchor_index());
- }
- return this.insert_cell_at_index(type, index);
- };
- /**
- * Insert a cell of given type below given index, or at bottom
- * of notebook if index greater than number of cells
- *
- * @param {string} [type] - cell type
- * @param {integer} [index] - defaults to the currently selected cell
- * @return {Cell|null} handle to created cell or null
- */
- Notebook.prototype.insert_cell_below = function (type, index) {
- if (index === null || index === undefined) {
- index = Math.max(this.get_selected_index(index), this.get_anchor_index());
- }
- return this.insert_cell_at_index(type, index+1);
- };
- /**
- * Insert cell at end of notebook
- *
- * @param {string} type - cell type
- * @return {Cell|null} handle to created cell or null
- */
- Notebook.prototype.insert_cell_at_bottom = function (type){
- var len = this.ncells();
- return this.insert_cell_below(type,len-1);
- };
- /**
- * Transfer contents from one cell to a new type cell
- */
- Notebook.prototype.transfer_to_new_cell = function (source_cell, target_cell){
- var text = source_cell.get_text();
- if (text === source_cell.placeholder) {
- text = '';
- }
- // metadata
- target_cell.metadata = source_cell.metadata;
- target_cell.attachments = source_cell.attachments;
- // We must show the editor before setting its contents
- target_cell.unrender();
- target_cell.set_text(text);
- // make this value the starting point, so that we can only undo
- // to this state, instead of a blank cell
- target_cell.code_mirror.clearHistory();
- source_cell.element.remove();
- }
-
- /**
- * Turn one or more cells into code.
- *
- * @param {Array} indices - cell indices to convert
- */
- Notebook.prototype.cells_to_code = function (indices) {
- if (indices === undefined){
- indices = this.get_selected_cells_indices();
- }
-
- for (var i=0; i <indices.length; i++){
- this.to_code(indices[i]);
- }
- };
- /**
- * Turn a cell into a code cell.
- *
- * @param {integer} [index] - cell index
- */
- Notebook.prototype.to_code = function (index) {
- var i = this.index_or_selected(index);
- if (this.is_valid_cell_index(i)) {
- var source_cell = this.get_cell(i);
- if (!(source_cell instanceof codecell.CodeCell) && source_cell.is_editable()) {
- var target_cell = this.insert_cell_below('code',i);
- var text = source_cell.get_text();
- if (text === source_cell.placeholder) {
- text = '';
- }
- //metadata
- target_cell.metadata = source_cell.metadata;
- // attachments (we transfer them so they aren't lost if the
- // cell is turned back into markdown)
- target_cell.attachments = source_cell.attachments;
- target_cell.set_text(text);
- // make this value the starting point, so that we can only undo
- // to this state, instead of a blank cell
- target_cell.code_mirror.clearHistory();
- source_cell.element.remove();
- this.select(i);
- var cursor = source_cell.code_mirror.getCursor();
- target_cell.code_mirror.setCursor(cursor);
- this.set_dirty(true);
- }
- }
- };
- /**
- * Turn one or more cells into Markdown.
- *
- * @param {Array} indices - cell indices to convert
- */
- Notebook.prototype.cells_to_markdown = function (indices) {
- if (indices === undefined) {
- indices = this.get_selected_cells_indices();
- }
- for(var i=0; i < indices.length; i++) {
- this.to_markdown(indices[i]);
- }
- };
- /**
- * Turn a cell into a Markdown cell.
- *
- * @param {integer} [index] - cell index
- */
- Notebook.prototype.to_markdown = function (index) {
- var i = this.index_or_selected(index);
- if (this.is_valid_cell_index(i)) {
- var source_cell = this.get_cell(i);
- if (!(source_cell instanceof textcell.MarkdownCell) && source_cell.is_editable()) {
- var target_cell = this.insert_cell_below('markdown',i);
- this.transfer_to_new_cell(source_cell, target_cell);
- this.select(i);
- if ((source_cell instanceof textcell.TextCell) && source_cell.rendered) {
- target_cell.render();
- }
- var cursor = source_cell.code_mirror.getCursor();
- target_cell.code_mirror.setCursor(cursor);
- this.set_dirty(true);
- }
- }
- };
- /**
- * Turn one or more cells into a raw text cell.
- *
- * @param {Array} indices - cell indices to convert
- */
- Notebook.prototype.cells_to_raw = function (indices) {
- if (indices === undefined) {
- indices = this.get_selected_cells_indices();
- }
- for(var i=0; i < indices.length; i++) {
- this.to_raw(indices[i]);
- }
- };
- /**
- * Turn a cell into a raw text cell.
- *
- * @param {integer} [index] - cell index
- */
- Notebook.prototype.to_raw = function (index) {
- var i = this.index_or_selected(index);
- if (this.is_valid_cell_index(i)) {
- var target_cell = null;
- var source_cell = this.get_cell(i);
- if (!(source_cell instanceof textcell.RawCell) && source_cell.is_editable()) {
- target_cell = this.insert_cell_below('raw',i);
-
- this.transfer_to_new_cell(source_cell, target_cell);
- this.select(i);
-
- var cursor = source_cell.code_mirror.getCursor();
- target_cell.code_mirror.setCursor(cursor);
- this.set_dirty(true);
- }
- }
- };
-
- /**
- * Warn about heading cell support removal.
- */
- Notebook.prototype._warn_heading = function () {
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title : i18n.msg._("Use markdown headings"),
- body : $("<p/>").text(
- i18n.msg._('Jupyter no longer uses special heading cells. ' +
- 'Instead, write your headings in Markdown cells using # characters:')
- ).append($('<pre/>').text(
- i18n.msg._('## This is a level 2 heading')
- )),
- buttons : {
- "OK" : {}
- }
- });
- };
-
- /**
- * Turn a cell into a heading containing markdown cell.
- *
- * @param {integer} [index] - cell index
- * @param {integer} [level] - heading level (e.g., 1 for h1)
- */
- Notebook.prototype.to_heading = function (index, level) {
- this.to_markdown(index);
- level = level || 1;
- var i = this.index_or_selected(index);
- if (this.is_valid_cell_index(i)) {
- var cell = this.get_cell(i);
- cell.set_heading_level(level);
- this.set_dirty(true);
- }
- };
- // Cut/Copy/Paste
- /**
- * Enable the UI elements for pasting cells.
- */
- Notebook.prototype.enable_paste = function () {
- var that = this;
- if (!this.paste_enabled) {
- $('#paste_cell_replace').removeClass('disabled')
- $('#paste_cell_replace > a').attr('aria-disabled', 'false');
- $('#paste_cell_above').removeClass('disabled')
- $('#paste_cell_above > a').attr('aria-disabled', 'false');
- $('#paste_cell_below').removeClass('disabled')
- $('#paste_cell_below > a').attr('aria-disabled', 'false');
- this.paste_enabled = true;
- }
- };
- /**
- * Disable the UI elements for pasting cells.
- */
- Notebook.prototype.disable_paste = function () {
- if (this.paste_enabled) {
- $('#paste_cell_replace').addClass('disabled');
- $('#paste_cell_replace > a').attr('aria-disabled', 'true');
- $('#paste_cell_above').addClass('disabled');
- $('#paste_cell_above > a').attr('aria-disabled', 'true');
- $('#paste_cell_below').addClass('disabled');
- $('#paste_cell_below > a').attr('aria-disabled', 'true');
- this.paste_enabled = false;
- }
- };
- /**
- * Cut a cell.
- */
- Notebook.prototype.cut_cell = function () {
- this.copy_cell();
- this.delete_cell();
- };
- /**
- * Copy cells.
- */
- Notebook.prototype.copy_cell = function () {
- var cells = this.get_selected_cells();
- if (cells.length === 0) {
- cells = [this.get_selected_cell()];
- }
-
- this.clipboard = [];
- var cell_json;
- for (var i=0; i < cells.length; i++) {
- cell_json = cells[i].toJSON();
- if (cell_json.metadata.deletable !== undefined) {
- delete cell_json.metadata.deletable;
- }
- if (cell_json.id !== undefined) {
- delete cell_json.id;
- }
- this.clipboard.push(cell_json);
- }
- this.enable_paste();
- };
- /**
- * Replace the selected cell with the cells in the clipboard.
- */
- Notebook.prototype.paste_cell_replace = function () {
- if (!(this.clipboard !== null && this.paste_enabled)) {
- return;
- }
- var selected = this.get_selected_cells_indices();
- var insertion_index = selected[0];
- this.delete_cells(selected);
- for (var i=this.clipboard.length-1; i >= 0; i--) {
- var cell_data = this.clipboard[i];
- var new_cell = this.insert_cell_at_index(cell_data.cell_type, insertion_index);
- new_cell.fromJSON(cell_data);
- }
- this.select(insertion_index+this.clipboard.length-1);
- };
- /**
- * Paste cells from the clipboard above the selected cell.
- */
- Notebook.prototype.paste_cell_above = function () {
- if (this.clipboard !== null && this.paste_enabled) {
- var first_inserted = null;
- for (var i=0; i < this.clipboard.length; i++) {
- var cell_data = this.clipboard[i];
- var new_cell = this.insert_cell_above(cell_data.cell_type);
- new_cell.fromJSON(cell_data);
- if (first_inserted === null) {
- first_inserted = new_cell;
- }
- }
- first_inserted.focus_cell();
- }
- };
- /**
- * Paste cells from the clipboard below the selected cell.
- */
- Notebook.prototype.paste_cell_below = function () {
- if (this.clipboard !== null && this.paste_enabled) {
- var first_inserted = null;
- for (var i = this.clipboard.length-1; i >= 0; i--) {
- var cell_data = this.clipboard[i];
- var new_cell = this.insert_cell_below(cell_data.cell_type);
- new_cell.fromJSON(cell_data);
- if (first_inserted === null) {
- first_inserted = new_cell;
- }
- }
- first_inserted.focus_cell();
- }
- };
-
- /**
- * Re-render the output of a code cell.
- */
- Notebook.prototype.render_cell_output = function (code_cell) {
- var cell_data = code_cell.toJSON();
- var cell_index = this.find_cell_index(code_cell);
- var trusted = code_cell.output_area.trusted;
- this.clear_output(cell_index);
- code_cell.output_area.trusted = trusted;
- code_cell.fromJSON(cell_data);
- };
- // Split/merge
- /**
- * Split the selected cell into two cells.
- */
- Notebook.prototype.split_cell = function () {
- var cell = this.get_selected_cell();
- if (cell.is_splittable()) {
- var text_list = cell.get_split_text();
- for (var i = 0; i < text_list.length-1; i++) {
- // Create new cell with same type
- var new_cell = this.insert_cell_above(cell.cell_type);
- // Unrender the new cell so we can call set_text.
- new_cell.unrender();
- new_cell.set_text(text_list[i]);
- // Duplicate metadata
- new_cell.metadata = JSON.parse(JSON.stringify(cell.metadata));
- }
- // Original cell becomes the last one
- // so we don't need to worry about selection
- cell.set_text(text_list[text_list.length-1]);
- }
- };
- /**
- * Merge a series of cells into one
- *
- * @param {Array} indices - the numeric indices of the cells to be merged
- * @param {boolean} into_last - merge into the last cell instead of the first
- */
- Notebook.prototype.merge_cells = function(indices, into_last) {
- if (indices.length <= 1) {
- return;
- }
- // Check if trying to merge above on topmost cell or wrap around
- // when merging above, see #330
- if (indices.filter(function(item) {return item < 0;}).length > 0) {
- return;
- }
- for (var i=0; i < indices.length; i++) {
- if (!this.get_cell(indices[i]).is_mergeable()) {
- return;
- }
- }
- var target = this.get_cell(into_last ? indices.pop() : indices.shift());
- // Get all the cells' contents
- var contents = [];
- for (i=0; i < indices.length; i++) {
- contents.push(this.get_cell(indices[i]).get_text());
- }
- if (into_last) {
- contents.push(target.get_text());
- } else {
- contents.unshift(target.get_text());
- }
- // Update the contents of the target cell
- if (target instanceof codecell.CodeCell) {
- target.set_text(contents.join('\n\n'));
- } else {
- var was_rendered = target.rendered;
- target.unrender(); // Must unrender before we set_text.
- target.set_text(contents.join('\n\n'));
- if (was_rendered) {
- // The rendered state of the final cell should match
- // that of the original selected cell;
- target.render();
- }
- }
- // Delete the other cells
- this.delete_cells(indices);
-
- // Reset the target cell's undo history
- target.code_mirror.clearHistory();
- this.select(this.find_cell_index(target));
- };
- /**
- * Merge the selected range of cells
- */
- Notebook.prototype.merge_selected_cells = function() {
- this.merge_cells(this.get_selected_cells_indices());
- };
- /**
- * Merge the selected cell into the cell above it.
- */
- Notebook.prototype.merge_cell_above = function () {
- var index = this.get_selected_index();
- this.merge_cells([index-1, index], true);
- };
- /**
- * Merge the selected cell into the cell below it.
- */
- Notebook.prototype.merge_cell_below = function () {
- var index = this.get_selected_index();
- this.merge_cells([index, index+1], false);
- };
- // Attachments handling
- /**
- * Shows a dialog letting the user pick an image from her computer and
- * insert it into the edited markdown cell
- */
- Notebook.prototype.insert_image = function () {
- var that = this;
- var cell = this.get_selected_cell();
- // The following should not happen as the menu item is greyed out
- // when those conditions are not fulfilled (see MarkdownCell
- // unselect/select/unrender handlers)
- if (cell.cell_type !== 'markdown') {
- console.log('Error: insert_image called on non-markdown cell');
- return;
- }
- if (cell.rendered) {
- console.log('Error: insert_image called on rendered cell');
- return;
- }
- dialog.insert_image({
- callback: function(file) {
- cell.edit_mode();
- cell.insert_inline_image_from_blob(file);
- },
- notebook: this,
- keyboard_manager: this.keyboard_manager
- });
- };
- /**
- * Cut the attachments of a cell
- */
- Notebook.prototype.cut_cell_attachments = function() {
- var cell = this.get_selected_cell();
- if (cell.attachments !== undefined) {
- this.clipboard_attachments = cell.attachments;
- this.enable_attachments_paste();
- delete cell.attachments;
- cell.unrender();
- cell.render();
- }
- };
- /**
- * Copy the attachments of a cell
- */
- Notebook.prototype.copy_cell_attachments = function() {
- var cell = this.get_selected_cell();
- if (cell.attachments !== undefined) {
- // Do a deep copy of attachments to avoid subsequent modification
- // to the cell to modify the clipboard
- this.clipboard_attachments = $.extend(true, {}, cell.attachments);
- this.enable_attachments_paste();
- }
- };
- /**
- * Paste the attachments in the clipboard into the currently selected
- * cell
- */
- Notebook.prototype.paste_cell_attachments = function() {
- if (this.clipboard_attachments !== null &&
- this.paste_attachments_enabled) {
- var cell = this.get_selected_cell();
- if (cell.attachments === undefined) {
- cell.attachments = {};
- }
- // Do a deep copy so we can paste multiple times
- $.extend(true, cell.attachments, this.clipboard_attachments);
- cell.unrender();
- cell.render();
- }
- };
- /**
- * Disable the "Paste Cell Attachments" menu item
- */
- Notebook.prototype.disable_attachments_paste = function () {
- if (this.paste_attachments_enabled) {
- $('#paste_cell_attachments').addClass('disabled');
- $('#paste_cell_attachments > a').attr('disabled','true');
- this.paste_attachments_enabled = false;
- }
- };
- /**
- * Enable the "Paste Cell Attachments" menu item
- */
- Notebook.prototype.enable_attachments_paste = function () {
- if (!this.paste_attachments_enabled) {
- $('#paste_cell_attachments').removeClass('disabled');
- $('#paste_cell_attachments > a').attr('aria-disabled','false');
- this.paste_attachments_enabled = true;
- }
- };
- /**
- * Enable/disable the "Insert image" menu item
- */
- Notebook.prototype.set_insert_image_enabled = function(enabled) {
- if (enabled) {
- $('#insert_image').removeClass('disabled');
- $('#insert_image > a').attr('aria-disabled', 'false');
- } else {
- $('#insert_image').addClass('disabled');
- $('#insert_image > a').attr('aria-disabled', 'true');
- }
- };
- // Cell collapsing and output clearing
- /**
- * Hide a cell's output.
- *
- * @param {integer} index - cell index
- */
- Notebook.prototype.collapse_output = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- if (cell !== null && (cell instanceof codecell.CodeCell)) {
- cell.collapse_output();
- this.set_dirty(true);
- }
- };
- /**
- * Hide each code cell's output area.
- */
- Notebook.prototype.collapse_all_output = function () {
- this.get_cells().map(function (cell) {
- if (cell instanceof codecell.CodeCell) {
- cell.collapse_output();
- }
- });
- // this should not be set if the `collapse` key is removed from nbformat
- this.set_dirty(true);
- };
- /**
- * Show a cell's output.
- *
- * @param {integer} index - cell index
- */
- Notebook.prototype.expand_output = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- if (cell !== null && (cell instanceof codecell.CodeCell)) {
- cell.expand_output();
- this.set_dirty(true);
- }
- };
- /**
- * Expand each code cell's output area, and remove scrollbars.
- */
- Notebook.prototype.expand_all_output = function () {
- this.get_cells().map(function (cell) {
- if (cell instanceof codecell.CodeCell) {
- cell.expand_output();
- }
- });
- // this should not be set if the `collapse` key is removed from nbformat
- this.set_dirty(true);
- };
- /**
- * Clear a code cell's output area.
- *
- * @param {integer} index - cell index
- */
- Notebook.prototype.clear_output = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- if (cell !== null && (cell instanceof codecell.CodeCell)) {
- cell.clear_output();
- this.set_dirty(true);
- }
- };
- /**
- * Clear multiple selected code cells' output areas.
- *
- */
- Notebook.prototype.clear_cells_outputs = function(indices) {
- if (!indices) {
- indices = this.get_selected_cells_indices();
- }
- for (var i = 0; i < indices.length; i++){
- this.clear_output(indices[i]);
- }
- };
- /**
- * Clear each code cell's output area.
- */
- Notebook.prototype.clear_all_output = function () {
- this.get_cells().map(function (cell) {
- if (cell instanceof codecell.CodeCell) {
- cell.clear_output();
- }
- });
- this.set_dirty(true);
- };
- /**
- * Scroll the selected CodeCell's output area.
- *
- * @param {integer} index - cell index
- */
- Notebook.prototype.scroll_output = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- if (cell !== null && (cell instanceof codecell.CodeCell)) {
- cell.scroll_output();
- this.set_dirty(true);
- }
- };
- /**
- * Expand each code cell's output area and add a scrollbar for long output.
- */
- Notebook.prototype.scroll_all_output = function () {
- this.get_cells().map(function (cell, i) {
- if (cell instanceof codecell.CodeCell) {
- cell.scroll_output();
- }
- });
- // this should not be set if the `collapse` key is removed from nbformat
- this.set_dirty(true);
- };
- /**
- * Toggle whether a cell's output is collapsed or expanded.
- *
- * @param {integer} index - cell index
- */
- Notebook.prototype.toggle_output = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- if (cell !== null && (cell instanceof codecell.CodeCell)) {
- cell.toggle_output();
- this.set_dirty(true);
- }
- };
- /**
- * Toggle whether all selected cells' outputs are collapsed or expanded.
- *
- * @param {integer} indices - the indices of the cells to toggle
- */
- Notebook.prototype.toggle_cells_outputs = function(indices) {
- if (!indices) {
- indices = this.get_selected_cells_indices();
- }
- for (var i = 0; i < indices.length; i++){
- this.toggle_output(indices[i]);
- }
- };
- /**
- * Toggle the output of all cells.
- */
- Notebook.prototype.toggle_all_output = function () {
- this.get_cells().map(function (cell) {
- if (cell instanceof codecell.CodeCell) {
- cell.toggle_output();
- }
- });
- // this should not be set if the `collapse` key is removed from nbformat
- this.set_dirty(true);
- };
- /**
- * Toggle a scrollbar for long cell outputs.
- *
- * @param {integer} index - cell index
- */
- Notebook.prototype.toggle_output_scroll = function (index) {
- var i = this.index_or_selected(index);
- var cell = this.get_cell(i);
- if (cell !== null && (cell instanceof codecell.CodeCell)) {
- cell.toggle_output_scroll();
- this.set_dirty(true);
- }
- };
- /**
- * Toggle a scrollbar for selected long cells' outputs.
- *
- * @param {integer} indices - the indices of the cells to toggle
- */
- Notebook.prototype.toggle_cells_outputs_scroll = function(indices) {
- if (!indices) {
- indices = this.get_selected_cells_indices();
- }
- for (var i = 0; i < indices.length; i++){
- this.toggle_output_scroll(indices[i]);
- }
- };
- /**
- * Toggle the scrolling of long output on all cells.
- */
- Notebook.prototype.toggle_all_output_scroll = function () {
- this.get_cells().map(function (cell) {
- if (cell instanceof codecell.CodeCell) {
- cell.toggle_output_scroll();
- }
- });
- // this should not be set if the `collapse` key is removed from nbformat
- this.set_dirty(true);
- };
- // Other cell functions: line numbers, ...
- /**
- * Toggle line numbers in the selected cell's input area.
- */
- Notebook.prototype.cell_toggle_line_numbers = function() {
- this.get_selected_cells().map(function(cell){cell.toggle_line_numbers();});
- };
- //dispatch codemirror mode to all cells.
- Notebook.prototype._dispatch_mode = function(spec, newmode){
- this.codemirror_mode = newmode;
- codecell.CodeCell.options_default.cm_config.mode = newmode;
- this.get_cells().map(function(cell) {
- if (cell.cell_type === 'code'){
- cell.code_mirror.setOption('mode', spec);
- // This is currently redundant, because cm_config ends up as
- // codemirror's own .options object, but I don't want to
- // rely on that.
- cell._options.cm_config.mode = spec;
- }
- });
- };
- // roughly try to check mode equality
- var _mode_equal = function(mode1, mode2){
- return ((mode1||{}).name||mode1)===((mode2||{}).name||mode2);
- };
-
- /**
- * Set the codemirror mode for all code cells, including the default for
- * new code cells.
- * Set the mode to 'null' (no highlighting) if it can't be found.
- */
- Notebook.prototype.set_codemirror_mode = function(newmode){
- // if mode is the same don't reset,
- // to avoid n-time re-highlighting.
- if (_mode_equal(newmode, this.codemirror_mode)) {
- return;
- }
-
- var that = this;
- utils.requireCodeMirrorMode(newmode, function (spec) {
- that._dispatch_mode(spec, newmode);
- }, function(){
- // on error don't dispatch the new mode as re-setting it later will not work.
- // don't either set to null mode if it has been changed in the meantime
- if( _mode_equal(newmode, that.codemirror_mode) ){
- that._dispatch_mode('null','null');
- }
- });
- };
- // Session related things
- /**
- * Start a new session and set it on each code cell.
- */
- Notebook.prototype.start_session = function (kernel_name) {
- if (this._session_starting) {
- throw new session.SessionAlreadyStarting();
- }
- this._session_starting = true;
- var options = {
- base_url: this.base_url,
- ws_url: this.ws_url,
- notebook_path: this.notebook_path,
- notebook_name: this.notebook_name,
- kernel_name: kernel_name,
- notebook: this
- };
- var success = $.proxy(this._session_started, this);
- var failure = $.proxy(this._session_start_failed, this);
- if (this.session && this.session.kernel) {
- this.session.restart(options, success, failure);
- } else {
- this.session = new session.Session(options);
- this.session.start(success, failure);
- }
- };
- /**
- * Once a session is started, link the code cells to the kernel and pass the
- * comm manager to the widget manager.
- */
- Notebook.prototype._session_started = function (){
- this._session_starting = false;
- this.kernel = this.session.kernel;
- var ncells = this.ncells();
- for (var i=0; i<ncells; i++) {
- var cell = this.get_cell(i);
- if (cell instanceof codecell.CodeCell) {
- cell.set_kernel(this.session.kernel);
- }
- }
- };
- /**
- * Called when the session fails to start.
- */
- Notebook.prototype._session_start_failed = function(jqxhr, status, error){
- this._session_starting = false;
- utils.log_ajax_error(jqxhr, status, error);
- };
-
- /**
- * Prompt the user to restart the kernel and re-run everything.
- * if options.confirm === false, no confirmation dialog is shown.
- */
- Notebook.prototype.restart_run_all = function (options) {
- var that = this;
- var restart_options = {};
- restart_options.confirm = (options || {}).confirm;
- restart_options.dialog = {
- notebook: that,
- keyboard_manager: that.keyboard_manager,
- title : i18n.msg._("Restart kernel and re-run the whole notebook?"),
- body : $("<p/>").text(
- i18n.msg._('Are you sure you want to restart the current kernel and re-execute the whole notebook? All variables and outputs will be lost.')
- ),
- buttons : {
- "Restart and Run All Cells" : {
- "class" : "btn-danger",
- "click" : function () {
- that.execute_all_cells();
- },
- },
- }
- };
- return this._restart_kernel(restart_options);
- };
- /**
- * Prompt the user to restart the kernel and clear output.
- * if options.confirm === false, no confirmation dialog is shown.
- */
- Notebook.prototype.restart_clear_output = function (options) {
- var that = this;
- var restart_options = {};
- restart_options.confirm = (options || {}).confirm;
- restart_options.dialog = {
- notebook: that,
- keyboard_manager: that.keyboard_manager,
- title : i18n.msg._("Restart kernel and clear all output?"),
- body : $("<p/>").text(
- i18n.msg._('Do you want to restart the current kernel and clear all output? All variables and outputs will be lost.')
- ),
- buttons : {
- "Restart and Clear All Outputs" : {
- "class" : "btn-danger",
- "click" : function (){
- that.clear_all_output();
- },
- },
- }
- };
- return this._restart_kernel(restart_options);
- };
- /**
- * Prompt the user to restart the kernel.
- * if options.confirm === false, no confirmation dialog is shown.
- */
- Notebook.prototype.shutdown_kernel = function (options) {
- var that = this;
- var shutdown_options = {};
- shutdown_options.confirm = (options || {}).confirm;
- shutdown_options.dialog = {
- title : "Shutdown kernel?",
- body : $("<p/>").text(
- i18n.msg._('Do you want to shutdown the current kernel? All variables will be lost.')
- ),
- buttons : {
- "Shutdown" : {
- "class" : "btn-danger",
- "click" : function () {},
- },
- }
- };
- shutdown_options.kernel_action = function() {
- that.session.delete();
- };
- return this._restart_kernel(shutdown_options);
- };
- Notebook.prototype.restart_kernel = function (options) {
- var restart_options = {};
- restart_options.confirm = (options || {}).confirm;
- restart_options.dialog = {
- title : i18n.msg._("Restart kernel?"),
- body : $("<p/>").text(
- i18n.msg._('Do you want to restart the current kernel? All variables will be lost.')
- ),
- buttons : {
- "Restart" : {
- "class" : "btn-danger",
- "click" : function () {},
- },
- }
- };
- return this._restart_kernel(restart_options);
- };
-
- // inner implementation of restart dialog & promise
- Notebook.prototype._restart_kernel = function (options) {
- var that = this;
- options = options || {};
- var resolve_promise, reject_promise;
- var promise = new Promise(function (resolve, reject){
- resolve_promise = resolve;
- reject_promise = reject;
- });
-
- function restart_and_resolve () {
- that.kernel.restart(function () {
- // resolve when the kernel is *ready* not just started
- that.events.one('kernel_ready.Kernel', resolve_promise);
- }, reject_promise);
- }
- var do_kernel_action = options.kernel_action || restart_and_resolve;
-
- // no need to confirm if the kernel is not connected
- if (options.confirm === false || !that.kernel.is_connected()) {
- var default_button = options.dialog.buttons[Object.keys(options.dialog.buttons)[0]];
- promise.then(default_button.click);
- do_kernel_action();
- return promise;
- }
- options.dialog.notebook = this;
- options.dialog.keyboard_manager = this.keyboard_manager;
- // add 'Continue running' cancel button
- var buttons = {
- "Continue Running": {},
- };
- // hook up button.click actions after restart promise resolves
- Object.keys(options.dialog.buttons).map(function (key) {
- var button = buttons[key] = options.dialog.buttons[key];
- var click = button.click;
- button.click = function () {
- promise.then(click);
- do_kernel_action();
- };
- });
- options.dialog.buttons = buttons;
- dialog.modal(options.dialog);
- return promise;
- };
- /**
- *
- * Halt the kernel and close the notebook window
- */
- Notebook.prototype.close_and_halt = function () {
- var close_window = function () {
- /**
- * allow closing of new tabs in Chromium, impossible in FF
- */
- window.open('', '_self', '');
- window.close();
- };
- // finish with close on success or failure
- this.session.delete(close_window, close_window);
- };
-
- /**
- * Execute cells corresponding to the given indices.
- *
- * @param {Array} indices - indices of the cells to execute
- */
- Notebook.prototype.execute_cells = function (indices) {
- if (indices.length === 0) {
- return;
- }
- var cell;
- for (var i = 0; i < indices.length; i++) {
- cell = this.get_cell(indices[i]);
- cell.execute();
- }
- this.select(indices[indices.length - 1]);
- this.command_mode();
- this.set_dirty(true);
- };
- /**
- * Execute or render cell outputs and go into command mode.
- */
- Notebook.prototype.execute_selected_cells = function () {
- this.execute_cells(this.get_selected_cells_indices());
- };
-
- /**
- * Alias for execute_selected_cells, for backwards compatibility --
- * previously, doing "Run Cell" would only ever run a single cell (hence
- * `execute_cell`), but now it runs all marked cells, so that's the
- * preferable function to use. But it is good to keep this function to avoid
- * breaking existing extensions, etc.
- */
- Notebook.prototype.execute_cell = function () {
- this.execute_selected_cells();
- };
- /**
- * Execute or render cell outputs and insert a new cell below.
- */
- Notebook.prototype.execute_cell_and_insert_below = function () {
- var indices = this.get_selected_cells_indices();
- var cell_index;
- if (indices.length > 1) {
- this.execute_cells(indices);
- cell_index = Math.max.apply(Math, indices);
- } else {
- var cell = this.get_selected_cell();
- cell_index = this.find_cell_index(cell);
- cell.execute();
- }
- // If we are at the end always insert a new cell and return
- if (cell_index === (this.ncells()-1)) {
- this.command_mode();
- this.insert_cell_below();
- this.select(cell_index+1);
- this.edit_mode();
- this.scroll_to_bottom();
- this.set_dirty(true);
- return;
- }
- this.command_mode();
- this.insert_cell_below();
- this.select(cell_index+1);
- this.edit_mode();
- this.set_dirty(true);
- };
- /**
- * Execute or render cell outputs and select the next cell.
- */
- Notebook.prototype.execute_cell_and_select_below = function () {
- var indices = this.get_selected_cells_indices();
- var cell_index;
- if (indices.length > 1) {
- this.execute_cells(indices);
- cell_index = Math.max.apply(Math, indices);
- } else {
- var cell = this.get_selected_cell();
- cell_index = this.find_cell_index(cell);
- cell.execute();
- }
- // If we are at the end always insert a new cell and return
- if (cell_index === (this.ncells()-1)) {
- this.command_mode();
- this.insert_cell_below();
- this.select(cell_index+1);
- this.edit_mode();
- this.scroll_to_bottom();
- this.set_dirty(true);
- return;
- }
- this.command_mode();
- this.select(cell_index+1);
- this.focus_cell();
- this.set_dirty(true);
- };
- /**
- * Execute all cells below the selected cell.
- */
- Notebook.prototype.execute_cells_below = function () {
- this.execute_cell_range(this.get_selected_index(), this.ncells());
- this.scroll_to_bottom();
- };
- /**
- * Execute all cells above the selected cell.
- */
- Notebook.prototype.execute_cells_above = function () {
- this.execute_cell_range(0, this.get_selected_index());
- };
- /**
- * Execute all cells.
- */
- Notebook.prototype.execute_all_cells = function () {
- this.execute_cell_range(0, this.ncells());
- this.scroll_to_bottom();
- };
- /**
- * Execute a contiguous range of cells.
- *
- * @param {integer} start - index of the first cell to execute (inclusive)
- * @param {integer} end - index of the last cell to execute (exclusive)
- */
- Notebook.prototype.execute_cell_range = function (start, end) {
- this.command_mode();
- var indices = [];
- for (var i=start; i<end; i++) {
- indices.push(i);
- }
- this.execute_cells(indices);
- };
- // Persistance and loading
- /**
- * Getter method for this notebook's name.
- *
- * @return {string} This notebook's name (excluding file extension)
- */
- Notebook.prototype.get_notebook_name = function () {
- return utils.splitext(this.notebook_name)[0];
- };
- /**
- * Setter method for this notebook's name.
- *
- * @param {string} name
- */
- Notebook.prototype.set_notebook_name = function (name) {
- var parent = utils.url_path_split(this.notebook_path)[0];
- this.notebook_name = name;
- this.notebook_path = utils.url_path_join(parent, name);
- };
- /**
- * Check that a notebook's name is valid.
- *
- * @param {string} nbname - A name for this notebook
- * @return {boolean} True if the name is valid, false if invalid
- */
- Notebook.prototype.test_notebook_name = function (nbname) {
- nbname = nbname || '';
- return nbname.length > 0 && !this.notebook_name_blacklist_re.test(nbname);
- };
- /**
- Move the unused attachments garbage collection logic to TextCell.toJSON.
- * Load a notebook from JSON (.ipynb).
- *
- * @param {object} data - JSON representation of a notebook
- */
- Notebook.prototype.fromJSON = function (data) {
- var content = data.content;
- var ncells = this.ncells();
- var i;
- for (i=0; i<ncells; i++) {
- // Always delete cell 0 as they get renumbered as they are deleted.
- this._unsafe_delete_cell(0);
- }
- // Save the metadata and name.
- this.metadata = content.metadata;
- this.notebook_name = data.name;
- this.notebook_path = data.path;
- var trusted = true;
-
- // Set the codemirror mode from language_info metadata
- if (this.metadata.language_info !== undefined) {
- var langinfo = this.metadata.language_info;
- // Mode 'null' should be plain, unhighlighted text.
- var cm_mode = langinfo.codemirror_mode || langinfo.name || 'null';
- this.set_codemirror_mode(cm_mode);
- }
-
- var new_cells = content.cells;
- ncells = new_cells.length;
- var cell_data = null;
- var new_cell = null;
- for (i=0; i<ncells; i++) {
- cell_data = new_cells[i];
- new_cell = this.insert_cell_at_index(cell_data.cell_type, i);
- new_cell.fromJSON(cell_data);
- if (new_cell.cell_type === 'code' && !new_cell.output_area.trusted) {
- trusted = false;
- }
- }
- if (trusted !== this.trusted) {
- this.trusted = trusted;
- this.events.trigger("trust_changed.Notebook", trusted);
- }
- this.apply_directionality();
- };
- /**
- * Dump this notebook into a JSON-friendly object.
- *
- * @return {object} A JSON-friendly representation of this notebook.
- */
- Notebook.prototype.toJSON = function () {
- // remove the conversion indicator, which only belongs in-memory
- delete this.metadata.orig_nbformat;
- delete this.metadata.orig_nbformat_minor;
- var cells = this.get_cells();
- var ncells = cells.length;
- var cell_array = new Array(ncells);
- var trusted = true;
- for (var i=0; i<ncells; i++) {
- var cell = cells[i];
- if (cell.cell_type === 'code' && !cell.output_area.trusted) {
- trusted = false;
- }
- cell_array[i] = cell.toJSON(true);
- }
- var data = {
- cells: cell_array,
- metadata: this.metadata,
- nbformat: this.nbformat,
- nbformat_minor: this.nbformat_minor
- };
- if (trusted !== this.trusted) {
- this.trusted = trusted;
- this.events.trigger("trust_changed.Notebook", trusted);
- }
- return data;
- };
- /**
- * Start an autosave timer which periodically saves the notebook.
- *
- * @param {integer} interval - the autosave interval in milliseconds
- */
- Notebook.prototype.set_autosave_interval = function (interval) {
- var that = this;
- // clear previous interval, so we don't get simultaneous timers
- if (this.autosave_timer) {
- clearInterval(this.autosave_timer);
- }
- if (!this.writable) {
- // disable autosave if not writable
- interval = 0;
- }
-
- this.autosave_interval = this.minimum_autosave_interval = interval;
- if (interval) {
- this.autosave_timer = setInterval(function() {
- if (that.dirty) {
- that.save_notebook();
- }
- }, interval);
- this.events.trigger("autosave_enabled.Notebook", interval);
- } else {
- this.autosave_timer = null;
- this.events.trigger("autosave_disabled.Notebook");
- }
- };
-
- /**
- * Save this notebook on the server. This becomes a notebook instance's
- * .save_notebook method *after* the entire notebook has been loaded.
- *
- */
- Notebook.prototype.save_notebook = function (check_last_modified) {
- if (check_last_modified === undefined) {
- check_last_modified = true;
- }
- var error;
- if (!this._fully_loaded) {
- error = new Error("Load failed, save is disabled");
- this.events.trigger('notebook_save_failed.Notebook', error);
- return Promise.reject(error);
- } else if (!this.writable) {
- error = new Error("Notebook is read-only");
- this.events.trigger('notebook_save_failed.Notebook', error);
- return Promise.reject(error);
- }
- // Trigger an event before save, which allows listeners to modify
- // the notebook as needed.
- this.events.trigger('before_save.Notebook');
- // Create a JSON model to be sent to the server.
- var model = {
- type : "notebook",
- content : this.toJSON()
- };
- // time the ajax call for autosave tuning purposes.
- var start = new Date().getTime();
- var that = this;
- var _save = function () {
- return that.contents.save(that.notebook_path, model).then(
- $.proxy(that.save_notebook_success, that, start),
- function (error) {
- that.events.trigger('notebook_save_failed.Notebook', error);
- // This hasn't handled the error, so propagate it up
- return Promise.reject(error);
- }
- );
- };
- if (check_last_modified) {
- return this.contents.get(this.notebook_path, {content: false}).then(
- function (data) {
- var last_modified = new Date(data.last_modified);
- var last_modified_check_margin = (that.config.data['last_modified_check_margin'] || 0.5) * 1000; // 500 ms
- // We want to check last_modified (disk) > that.last_modified (our last save)
- // In some cases the filesystem reports an inconsistent time,
- // so we allow 0.5 seconds difference before complaining.
- // This is configurable in nbconfig/notebook.json as `last_modified_check_margin`.
- if ((last_modified.getTime() - that.last_modified.getTime()) > last_modified_check_margin) {
- console.warn("Last saving was done on `"+that.last_modified+"`("+that._last_modified+"), "+
- "while the current file seem to have been saved on `"+data.last_modified+"`");
- if (that._changed_on_disk_dialog !== null) {
- // update save callback on the confirmation button
- that._changed_on_disk_dialog.find('.save-confirm-btn').click(_save);
- //Rebind Click Event on Reload
- that._changed_on_disk_dialog.find('.btn-warning').click(function () {window.location.reload()});
- // redisplay existing dialog
- that._changed_on_disk_dialog.modal('show');
- } else {
- // create new dialog
- that._changed_on_disk_dialog = dialog.modal({
- notebook: that,
- keyboard_manager: that.keyboard_manager,
- title: i18n.msg._("Notebook changed"),
- body: i18n.msg._("The notebook file has changed on disk since the last time we opened or saved it. "
- + "Do you want to overwrite the file on disk with the version open here, or load "
- + "the version on disk (reload the page)?"),
- buttons: {
- Reload: {
- class: 'btn-warning',
- click: function() {
- window.location.reload();
- }
- },
- Cancel: {},
- Overwrite: {
- class: 'btn-danger save-confirm-btn',
- click: function () {
- _save();
- }
- },
- }
- });
- }
- } else {
- return _save();
- }
- }, function () {
- // maybe it has been deleted or renamed? Go ahead and save.
- return _save();
- }
- );
- } else {
- return _save();
- }
- };
-
- /**
- * Success callback for saving a notebook.
- *
- * @param {integer} start - Time when the save request start
- * @param {object} data - JSON representation of a notebook
- */
- Notebook.prototype.save_notebook_success = function (start, data) {
- this.set_dirty(false);
- this.last_modified = new Date(data.last_modified);
- // debug 484
- this._last_modified = 'save-success:'+data.last_modified;
- if (data.message) {
- // save succeeded, but validation failed.
- var body = $("<div>");
- var title = i18n.msg._("Notebook validation failed");
- body.append($("<p>").text(
- i18n.msg._("The save operation succeeded," +
- " but the notebook does not appear to be valid." +
- " The validation error was:")
- )).append($("<div>").addClass("validation-error").append(
- $("<pre>").text(data.message)
- ));
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title: title,
- body: body,
- buttons : {
- OK : {
- "class" : "btn-primary"
- }
- }
- });
- }
- this.events.trigger('notebook_saved.Notebook');
- this._update_autosave_interval(start);
- if (this._checkpoint_after_save) {
- this.create_checkpoint();
- this._checkpoint_after_save = false;
- }
- return data;
- };
- Notebook.prototype.save_notebook_as = function() {
- var that = this;
- var current_dir = $('body').attr('data-notebook-path').split('/').slice(0, -1).join("/");
- current_dir = current_dir? current_dir + "/": "";
- current_dir = decodeURIComponent(current_dir);
- var dialog_body = $('<div/>').append(
- $('<p/>').addClass('save-message')
- .text(i18n.msg._('Enter a notebook path relative to notebook dir'))
- ).append(
- $('<br/>')
- ).append(
- $('<input/>').attr('type','text').attr('size','25')
- .attr('data-testid', 'save-as')
- .addClass('form-control')
- );
- var d = dialog.modal({
- title: 'Save As',
- body: dialog_body,
- keyboard_manager: this.keyboard_manager,
- notebook: this,
- buttons: {
- Cancel: {},
- Save: {
- class: 'btn-primary',
- click: function() {
- var nb_path = d.find('input').val();
- var nb_name = nb_path.split('/').slice(-1).pop();
- if (!nb_name) {
- $(".save-message").html(
- $("<span>")
- .attr("style", "color:red;")
- .text($(".save-message").text())
- );
- return false;
- }
- // If notebook name does not contain extension '.ipynb' add it
- var ext = utils.splitext(nb_name)[1];
- if (ext === '') {
- nb_name = nb_name + '.ipynb';
- nb_path = nb_path + '.ipynb';
- }
- var save_thunk = function() {
- var model = {
- 'type': 'notebook',
- 'content': that.toJSON(),
- 'name': nb_name
- };
- var start = new Date().getTime();
- return that.contents.save(nb_path, model)
- .then(function(data) {
- d.modal('hide');
- that.writable = true;
- that.notebook_name = data.name;
- that.notebook_path = data.path;
- that.session.rename_notebook(data.path);
- that.events.trigger('notebook_renamed.Notebook', data);
- that.save_notebook_success(start, data);
- }, function(error) {
- var msg = i18n.msg._(error.message || 'Unknown error saving notebook');
- $(".save-message").html(
- $("<span>")
- .attr("style", "color:red;")
- .text(msg)
- );
- });
- };
- that.contents.get(nb_path, {type: 'notebook', content: false}).then(function(data) {
- var warning_body = $('<div/>').append(
- $("<p/>").text(i18n.msg._('Notebook with that name exists.')));
- dialog.modal({
- title: 'Save As',
- body: warning_body,
- buttons: {Cancel: {},
- Overwrite: {
- class: 'btn-warning',
- click: function() {
- return save_thunk();
- }
- }
- }
- });
- }, function(err) {
- return save_thunk();
- });
- return false;
- }
- },
- },
- open : function () {
- d.find('input[type="text"]').keydown(function (event) {
- if (event.which === keyboard.keycodes.enter) {
- d.find('.btn-primary').first().click();
- return false;
- }
- });
- d.find('input[type="text"]').val(current_dir).focus();
- }
- });
- };
- /**
- * Update the autosave interval based on the duration of the last save.
- *
- * @param {integer} start - when the save request started
- */
- Notebook.prototype._update_autosave_interval = function (start) {
- var duration = (new Date().getTime() - start);
- if (this.autosave_interval) {
- // new save interval: higher of 10x save duration or parameter (default 30 seconds)
- var interval = Math.max(10 * duration, this.minimum_autosave_interval);
- // ceil to 10 seconds, otherwise we will be setting a new interval too often
- // do not round or anything below 5000ms will desactivate saving.
- interval = 10000 * Math.ceil(interval / 10000);
- // set new interval, if it's changed
- if (interval !== this.autosave_interval) {
- this.set_autosave_interval(interval);
- }
- }
- };
- /**
- * Explicitly trust the output of this notebook.
- */
- Notebook.prototype.trust_notebook = function (from_notification) {
- var body = $("<div>").append($("<p>")
- .text(i18n.msg._("A trusted Jupyter notebook may execute hidden malicious code when you open it. " +
- "Selecting trust will immediately reload this notebook in a trusted state. " +
- "For more information, see the Jupyter security documentation: "))
- .append($("<a>").attr("href", "https://jupyter-notebook.readthedocs.io/en/stable/security.html")
- .text(i18n.msg._("here"))
- )
- );
- var nb = this;
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title: i18n.msg._("Trust this notebook?"),
- body: body,
- focus_button: from_notification,
- buttons: {
- Cancel : {},
- Trust : {
- class : "btn-danger",
- click : function () {
- var cells = nb.get_cells();
- for (var i = 0; i < cells.length; i++) {
- var cell = cells[i];
- if (cell.cell_type === 'code') {
- cell.output_area.trusted = true;
- }
- }
- // If its write only and dirty, save before
- // trusting
- var pr;
- if(nb.writable && nb.dirty) {
- pr = nb.save_notebook();
- }
- else {
- pr = Promise.resolve();
- }
- return pr.then(function() {
- nb.contents.trust(nb.notebook_path)
- .then(function() {
- nb.events.trigger("trust_changed.Notebook", true);
- window.location.reload();
- }, function(err) {
- console.log(err);
- });
- });
- }
- }
- }
- });
- };
- /**
- * Make a copy of the current notebook.
- * If the notebook has unsaved changes, it is saved first.
- */
- Notebook.prototype.copy_notebook = function () {
- var that = this;
- var base_url = this.base_url;
- var w = window.open('', IPython._target);
- var parent = utils.url_path_split(this.notebook_path)[0];
- var p;
- if (this.dirty && this.writable) {
- p = this.save_notebook(true);
- } else {
- p = Promise.resolve();
- }
- return p.then(function () {
- return that.contents.copy(that.notebook_path, parent).then(
- function (data) {
- w.location = utils.url_path_join(
- base_url, 'notebooks', utils.encode_uri_components(data.path)
- );
- },
- function(error) {
- w.close();
- that.events.trigger('notebook_copy_failed', error);
- }
- );
- });
- };
-
- /**
- * Ensure a filename has the right extension
- * Returns the filename with the appropriate extension, appending if necessary.
- */
- Notebook.prototype.ensure_extension = function (name) {
- var ext = utils.splitext(this.notebook_path)[1];
- if (ext.length && name.slice(-ext.length) !== ext) {
- name = name + ext;
- }
- return name;
- };
- /**
- * Rename the notebook.
- * @param {string} new_name
- * @return {Promise} promise that resolves when the notebook is renamed.
- */
- Notebook.prototype.rename = function (new_name) {
- new_name = this.ensure_extension(new_name);
- var that = this;
- var parent = utils.url_path_split(this.notebook_path)[0];
- var new_path = utils.url_path_join(parent, new_name);
- return this.contents.rename(this.notebook_path, new_path).then(
- function (json) {
- that.notebook_name = json.name;
- that.notebook_path = json.path;
- that.last_modified = new Date(json.last_modified);
- // debug 484
- that._last_modified = json.last_modified;
- that.session.rename_notebook(json.path);
- that.events.trigger('notebook_renamed.Notebook', json);
- }
- );
- };
- /**
- * Delete this notebook
- */
- Notebook.prototype.delete = function () {
- this.contents.delete(this.notebook_path);
- };
- /**
- * Request a notebook's data from the server.
- *
- * @param {string} notebook_path - A notebook to load
- */
- Notebook.prototype.load_notebook = function (notebook_path) {
- this.notebook_path = notebook_path;
- this.notebook_name = utils.url_path_split(this.notebook_path)[1];
- this.events.trigger('notebook_loading.Notebook');
- this.contents.get(notebook_path, {type: 'notebook'}).then(
- $.proxy(this.load_notebook_success, this),
- $.proxy(this.load_notebook_error, this)
- );
- };
- /**
- * Success callback for loading a notebook from the server.
- *
- * Load notebook data from the JSON response.
- *
- * @param {object} data JSON representation of a notebook
- */
- Notebook.prototype.load_notebook_success = function (data) {
- var failed, msg;
- try {
- this.fromJSON(data);
- } catch (e) {
- failed = e;
- console.error("Notebook failed to load from JSON:", e);
- }
- if (failed || data.message) {
- // *either* fromJSON failed or validation failed
- var body = $("<div>");
- var title;
- if (failed) {
- title = i18n.msg._("Notebook failed to load");
- body.append($("<p>").text(
- i18n.msg._("The error was: ")
- )).append($("<div>").addClass("js-error").text(
- failed.toString()
- )).append($("<p>").text(
- i18n.msg._("See the error console for details.")
- ));
- } else {
- title = i18n.msg._("Notebook validation failed");
- }
- if (data.message) {
- if (failed) {
- msg = i18n.msg._("The notebook also failed validation:");
- } else {
- msg = i18n.msg._("An invalid notebook may not function properly." +
- " The validation error was:");
- }
- body.append($("<p>").text(
- msg
- )).append($("<div>").addClass("validation-error").append(
- $("<pre>").text(data.message)
- ));
- }
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title: title,
- body: body,
- buttons : {
- OK : {
- "class" : "btn-primary"
- }
- }
- });
- }
- if (this.ncells() === 0) {
- this.insert_cell_below('code');
- this.edit_mode(0);
- } else {
- this.select(0);
- this.handle_command_mode(this.get_cell(0));
- }
- this.set_dirty(false);
- this.scroll_to_top();
- this.writable = data.writable || false;
- this.last_modified = new Date(data.last_modified);
- // debug 484
- this._last_modified = 'load-success:'+data.last_modified;
- var nbmodel = data.content;
- var orig_nbformat = nbmodel.metadata.orig_nbformat;
- var orig_nbformat_minor = nbmodel.metadata.orig_nbformat_minor;
- if (orig_nbformat !== undefined && nbmodel.nbformat !== orig_nbformat) {
- var oldmsg = i18n.msg._("This notebook has been converted from an older notebook format" +
- " to the current notebook format v(%s).");
- var newmsg = i18n.msg._("This notebook has been converted from a newer notebook format" +
- " to the current notebook format v(%s).");
- if (nbmodel.nbformat > orig_nbformat) {
- msg = i18n.msg.sprintf(oldmsg,nbmodel.nbformat);
- } else {
- msg = i18n.msg.sprintf(newmsg,nbmodel.nbformat);
- }
- msg += " ";
- msg += i18n.msg._("The next time you save this notebook, the " +
- "current notebook format will be used.");
-
- msg += " ";
- if (nbmodel.nbformat > orig_nbformat) {
- msg += i18n.msg._("Older versions of Jupyter may not be able to read the new format.");
- } else {
- msg += i18n.msg._("Some features of the original notebook may not be available.");
- }
- msg += " ";
- msg += i18n.msg._("To preserve the original version, close the " +
- "notebook without saving it.");
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title : i18n.msg._("Notebook converted"),
- body : msg,
- buttons : {
- OK : {
- class : "btn-primary"
- }
- }
- });
- } else if (this.nbformat_minor < nbmodel.nbformat_minor) {
- this.nbformat_minor = nbmodel.nbformat_minor;
- }
- if (this.session === null) {
- var kernel_name = utils.get_url_param('kernel_name');
- if (kernel_name) {
- this.kernel_selector.set_kernel(kernel_name);
- } else if (this.metadata.kernelspec) {
- this.kernel_selector.set_kernel(this.metadata.kernelspec);
- } else if (this.metadata.language) {
- // compat with IJulia, IHaskell, and other early kernels
- // adopters that where setting a language metadata.
- this.kernel_selector.set_kernel({
- name: i18n.msg._("(No name)"),
- language: this.metadata.language
- });
- // this should be stored in kspec now, delete it.
- // remove once we do not support notebook v3 anymore.
- delete this.metadata.language;
- } else {
- // setting kernel via set_kernel above triggers start_session,
- // otherwise start a new session with the server's default kernel
- // spec_changed events will fire after kernel is loaded
- this.start_session();
- }
- }
- // load our checkpoint list
- this.list_checkpoints();
-
- // load toolbar state
- if (this.metadata.celltoolbar) {
- celltoolbar.CellToolbar.global_show();
- celltoolbar.CellToolbar.activate_preset(this.metadata.celltoolbar);
- } else {
- celltoolbar.CellToolbar.global_hide();
- }
-
- if (!this.writable) {
- this.set_autosave_interval(0);
- this.events.trigger('notebook_read_only.Notebook');
- }
-
- // now that we're fully loaded, it is safe to restore save functionality
- this._fully_loaded = true;
- this.events.trigger('notebook_loaded.Notebook');
- };
- Notebook.prototype.set_kernelselector = function(k_selector){
- this.kernel_selector = k_selector;
- };
- /**
- * Failure callback for loading a notebook from the server.
- *
- * @param {Error} error
- */
- Notebook.prototype.load_notebook_error = function (error) {
- var isSanitized = true;
- this.events.trigger('notebook_load_failed.Notebook', error);
- var msg;
- if (error.name === utils.XHR_ERROR && error.xhr.status === 500) {
- utils.log_ajax_error(error.xhr, error.xhr_status, error.xhr_error);
- msg = i18n.msg.sprintf(i18n.msg._("An unknown error occurred while loading this notebook. " +
- "This version can load notebook formats %s or earlier. See the server log for details.",
- "v" + this.nbformat));
- } else {
- msg = error.message;
- console.warn('Error stack trace while loading notebook was:');
- console.warn(error.stack);
- }
- if (navigator.cookieEnabled == false){
- msg = i18n.msg._("Jupyter requires cookies to work; please enable cookies" +
- " and refresh page. <a href=\"https://www.wikihow.com/Enable-Cookies-in-Your-Internet-Web-Browser\"> Learn more about enabling cookies. </a>");
- isSanitized = false;
- }
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title: i18n.msg._("Error loading notebook"),
- body : msg,
- buttons : {
- "Close": {
- class : 'btn-danger',
- click : function () {
- window.close();
- }
- }
- },
- sanitize: isSanitized
-
- });
- };
- /********************* checkpoint-related ********************/
-
- /**
- * Save the notebook then immediately create a checkpoint.
- */
- Notebook.prototype.save_checkpoint = function () {
- this._checkpoint_after_save = true;
- return this.save_notebook(true);
- };
-
- /**
- * Add a checkpoint for this notebook.
- */
- Notebook.prototype.add_checkpoint = function (checkpoint) {
- var found = false;
- for (var i = 0; i < this.checkpoints.length; i++) {
- var existing = this.checkpoints[i];
- if (existing.id === checkpoint.id) {
- found = true;
- this.checkpoints[i] = checkpoint;
- break;
- }
- }
- if (!found) {
- this.checkpoints.push(checkpoint);
- }
- this.last_checkpoint = this.checkpoints[this.checkpoints.length - 1];
- };
-
- /**
- * List checkpoints for this notebook.
- */
- Notebook.prototype.list_checkpoints = function () {
- var that = this;
- this.contents.list_checkpoints(this.notebook_path).then(
- $.proxy(this.list_checkpoints_success, this),
- function(error) {
- that.events.trigger('list_checkpoints_failed.Notebook', error);
- }
- );
- };
- /**
- * Success callback for listing checkpoints.
- *
- * @param {object} data - JSON representation of a checkpoint
- */
- Notebook.prototype.list_checkpoints_success = function (data) {
- this.checkpoints = data;
- if (data.length) {
- this.last_checkpoint = data[data.length - 1];
- } else {
- this.last_checkpoint = null;
- }
- this.events.trigger('checkpoints_listed.Notebook', [data]);
- };
- /**
- * Create a checkpoint of this notebook on the server from the most recent save.
- */
- Notebook.prototype.create_checkpoint = function () {
- var that = this;
- this.contents.create_checkpoint(this.notebook_path).then(
- $.proxy(this.create_checkpoint_success, this),
- function (error) {
- that.events.trigger('checkpoint_failed.Notebook', error);
- }
- );
- };
- /**
- * Success callback for creating a checkpoint.
- *
- * @param {object} data - JSON representation of a checkpoint
- */
- Notebook.prototype.create_checkpoint_success = function (data) {
- this.add_checkpoint(data);
- this.events.trigger('checkpoint_created.Notebook', data);
- };
- /**
- * Display the restore checkpoint dialog
- * @param {string} checkpoint ID
- */
- Notebook.prototype.restore_checkpoint_dialog = function (checkpoint) {
- var that = this;
- checkpoint = checkpoint || this.last_checkpoint;
- if ( ! checkpoint ) {
- console.log("restore dialog, but no checkpoint to restore to!");
- return;
- }
- var body = $('<div/>').append(
- $('<p/>').addClass("p-space").text(
- i18n.msg._("Are you sure you want to revert the notebook to " +
- "the latest checkpoint?")
- ).append(
- $("<strong/>").text(" "+i18n.msg._("This cannot be undone."))
- )
- ).append(
- $('<p/>').addClass("p-space").text(i18n.msg._("The checkpoint was last updated at:"))
- ).append(
- $('<p/>').addClass("p-space").text(
- moment(checkpoint.last_modified).format('LLLL') +
- ' ('+moment(checkpoint.last_modified).fromNow()+')'// Long form: Tuesday, January 27, 2015 12:15 PM
- ).css("text-align", "center")
- );
-
- dialog.modal({
- notebook: this,
- keyboard_manager: this.keyboard_manager,
- title : i18n.msg._("Revert notebook to checkpoint"),
- body : body,
- default_button: "Cancel",
- buttons : {
- Cancel: {},
- Revert : {
- class : "btn-danger",
- click : function () {
- that.restore_checkpoint(checkpoint.id);
- }
- }
- }
- });
- };
-
- /**
- * Restore the notebook to a checkpoint state.
- *
- * @param {string} checkpoint ID
- */
- Notebook.prototype.restore_checkpoint = function (checkpoint) {
- this.events.trigger('notebook_restoring.Notebook', checkpoint);
- var that = this;
- this.contents.restore_checkpoint(this.notebook_path, checkpoint).then(
- $.proxy(this.restore_checkpoint_success, this),
- function (error) {
- that.events.trigger('checkpoint_restore_failed.Notebook', error);
- }
- );
- };
-
- /**
- * Success callback for restoring a notebook to a checkpoint.
- */
- Notebook.prototype.restore_checkpoint_success = function () {
- this.events.trigger('checkpoint_restored.Notebook');
- this.load_notebook(this.notebook_path);
- };
- /**
- * Delete a notebook checkpoint.
- *
- * @param {string} checkpoint ID
- */
- Notebook.prototype.delete_checkpoint = function (checkpoint) {
- this.events.trigger('notebook_restoring.Notebook', checkpoint);
- var that = this;
- this.contents.delete_checkpoint(this.notebook_path, checkpoint).then(
- $.proxy(this.delete_checkpoint_success, this),
- function (error) {
- that.events.trigger('checkpoint_delete_failed.Notebook', error);
- }
- );
- };
-
- /**
- * Success callback for deleting a notebook checkpoint.
- */
- Notebook.prototype.delete_checkpoint_success = function () {
- this.events.trigger('checkpoint_deleted.Notebook');
- this.load_notebook(this.notebook_path);
- };
- return {Notebook: Notebook};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/page',[
- 'jquery',
- 'base/js/events',
- ], function($, events){
- "use strict";
- var Page = function (header_div_selector, site_div_selector) {
- /**
- * Constructor
- *
- * Parameters
- * header_div_selector: string
- * site_div_selector: string
- */
- this.header_div_element = $(header_div_selector || 'div#header');
- this.site_div_element = $(site_div_selector || 'div#site');
- this.bind_events();
- };
- Page.prototype.bind_events = function () {
- // resize site on:
- // - window resize
- // - header change
- // - page load
- var _handle_resize = $.proxy(this._resize_site, this);
- $(window).resize(_handle_resize);
- // On document ready, resize codemirror.
- $(document).ready(_handle_resize);
- events.on('resize-header.Page', _handle_resize);
- };
- Page.prototype.show = function () {
- /**
- * The header and site divs start out hidden to prevent FLOUC.
- * Main scripts should call this method after styling everything.
- */
- this.show_header();
- this.show_site();
- };
- Page.prototype.show_header = function () {
- /**
- * The header and site divs start out hidden to prevent FLOUC.
- * Main scripts should call this method after styling everything.
- */
- this.header_div_element.css('display','block');
- };
- Page.prototype.show_site = function () {
- /**
- * The header and site divs start out hidden to prevent FLOUC.
- * Main scripts should call this method after styling everything.
- */
- this.site_div_element.css('display', 'block');
- this._resize_site();
- };
- Page.prototype._resize_site = function(e) {
- /**
- * Update the site's size.
- */
- // In the case an event is passed in, only trigger if the event does
- // *not* have a target DOM node (i.e., it is not bubbling up). See
- // https://bugs.jquery.com/ticket/9841#comment:8
- if (!(e && e.target && e.target.tagName)) {
- $('div#site').height($(window).height() - $('#header').height());
- }
- };
- return {'Page': Page};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // Define an object to attach promises to for one-time events.
- define('base/js/promises',['base/js/events', 'base/js/namespace'], function(events, Jupyter) {
- "use strict";
- // Promise to be resolved when the application is initialized.
- // The value is the name of the app on the current page.
- var app_initialized = new Promise(function(resolve, reject) {
- events.on('app_initialized.NotebookApp', function() {
- resolve('NotebookApp');
- });
- events.on('app_initialized.DashboardApp', function() {
- resolve('DashboardApp');
- });
- });
- var promises = {
- app_initialized: app_initialized
- };
- Jupyter.promises = promises;
- return promises;
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('auth/js/loginwidget',[
- 'jquery',
- 'base/js/utils',
- ], function($, utils){
- "use strict";
- var LoginWidget = function (selector, options) {
- options = options || {};
- this.base_url = options.base_url || utils.get_body_data("baseUrl");
- this.selector = selector;
- if (this.selector !== undefined) {
- this.element = $(selector);
- this.bind_events();
- }
- };
- LoginWidget.prototype.bind_events = function () {
- var that = this;
- this.element.find("button#logout").click(function () {
- window.location = utils.url_path_join(
- that.base_url,
- "logout"
- );
- });
- this.element.find("button#login").click(function () {
- window.location = utils.url_path_join(
- that.base_url,
- "login"
- );
- });
- };
- return {'LoginWidget': LoginWidget};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/toolbar',['jquery','base/js/i18n'], function($, i18n) {
- "use strict";
- /**
- * A generic toolbar on which one can add button
- * @class ToolBar
- * @constructor
- * @param {Dom_object} selector
- */
- var ToolBar = function (selector, options) {
- this.selector = selector;
- this.actions = (options||{}).actions;
- if (this.selector !== undefined) {
- this.element = $(selector);
- this.style();
- }
- };
- ToolBar.prototype._pseudo_actions={};
- ToolBar.prototype.construct = function (config) {
- for(var k=0; k<config.length; k++) {
- this.add_buttons_group(config[k][0],config[k][1]);
- }
- };
- /**
- * Add a group of button into the current toolbar.
- *
- * Use a [dict of [list of action name]] to trigger
- * on click to the button
- *
- * @example
- *
- * ... todo, maybe use a list of list to keep ordering.
- *
- * [
- * [
- * [
- * action_name_1,
- * action_name_2,
- * action_name_3,
- * ],
- * optional_group_name
- * ],
- * ...
- * ]
- *
- * @param list {List}
- * List of button of the group, with the following parameter for each :
- * @param list.label {string} text to show on button hover
- * @param list.icon {string} icon to choose from [Font Awesome](http://fortawesome.github.io/Font-Awesome)
- * @param list.callback {function} function to be called on button click
- * @param [list.id] {String} id to give to the button
- * @param [group_id] {String} optional id to give to the group
- *
- *
- * for private usage, the key can also be strings starting with '<' and ending with '>' to inject custom element that cannot
- * be bound to an action.
- *
- */
- // TODO JUPYTER:
- // get rid of legacy code that handle things that are not actions.
- ToolBar.prototype.add_buttons_group = function (list, group_id) {
- // handle custom call of pseudoaction binding.
- if(typeof(list) === 'string' && list.slice(0,1) === '<' && list.slice(-1) === '>'){
- var _pseudo_action;
- try{
- _pseudo_action = list.slice(1,-1);
- this.element.append(this._pseudo_actions[_pseudo_action].call(this));
- } catch (e) {
- console.warn('ouch, calling ', _pseudo_action, 'does not seem to work...:', e);
- }
- return ;
- }
- var that = this;
- var btn_group = $('<div/>').addClass("btn-group");
- if( group_id !== undefined ) {
- btn_group.attr('id',group_id);
- }
- list.forEach(function(el) {
- var action_name;
- var action;
- if(typeof(el) === 'string'){
- action = that.actions.get(el);
- action_name = el;
- } else if (el.action) {
- action = that.actions.get(el.action);
- action_name = el.action
- }
- var title = el.label;
- if(action && action.help) {
- title = i18n.msg._(action.help) || el.label;
- }
- var button = $('<button/>')
- .addClass('btn btn-default')
- .attr("aria-label", el.label)
- .attr("title", title)
- .append(
- $("<i/>").addClass(el.icon||(action||{icon:'fa-exclamation-triangle'}).icon).addClass('fa')
- );
- if (el.label) {
- var label = $('<span/>').text(i18n.msg._(el.label)).addClass('toolbar-btn-label');
- button.append(label);
- }
- var id = el.id;
- if( id !== undefined ){
- button.attr('id',id);
- }
- button.attr('data-jupyter-action', action_name);
- var fun = el.callback|| function(){
- that.actions.call(action_name);
- };
- button.click(fun);
- btn_group.append(button);
- });
- $(this.selector).append(btn_group);
- return btn_group;
- };
- ToolBar.prototype.style = function () {
- this.element.addClass('toolbar');
- };
- /**
- * Show and hide toolbar
- * @method toggle
- */
- ToolBar.prototype.toggle = function () {
- this.element.toggle();
- };
- /**
- * A simple class to hold information defining one toolbar button.
- * @class ToolBar
- * @constructor
- * @param action {String} name of a Jupyter action taken when pressed
- * @param options.label {String} short label to display on the button
- */
- var Button = function(action, options) {
- this.action = action;
- this.label = (options||{}).label;
- };
- return {
- 'ToolBar': ToolBar,
- 'Button': Button
- };
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/maintoolbar',[
- 'jquery',
- 'require',
- './toolbar',
- './celltoolbar',
- 'base/js/i18n'
- ], function($, requirejs, toolbar, celltoolbar, i18n) {
- "use strict";
- var MainToolBar = function (selector, options) {
- /**
- * Constructor
- *
- * Parameters:
- * selector: string
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- * notebook: Notebook instance
- **/
- toolbar.ToolBar.apply(this, [selector, options] );
- this.events = options.events;
- this.notebook = options.notebook;
- this._make();
- Object.seal(this);
- };
- MainToolBar.prototype = Object.create(toolbar.ToolBar.prototype);
- MainToolBar.prototype._make = function () {
- var grps = [
- [
- ['jupyter-notebook:save-notebook'],
- 'save-notbook'
- ],
- [
- ['jupyter-notebook:insert-cell-below'],
- 'insert_above_below'],
- [
- ['jupyter-notebook:cut-cell',
- 'jupyter-notebook:copy-cell',
- 'jupyter-notebook:paste-cell-below'
- ] ,
- 'cut_copy_paste'],
- [
- ['jupyter-notebook:move-cell-up',
- 'jupyter-notebook:move-cell-down'
- ],
- 'move_up_down'],
- [ [new toolbar.Button('jupyter-notebook:run-cell-and-select-next',
- {label: i18n.msg._('Run')}),
- 'jupyter-notebook:interrupt-kernel',
- 'jupyter-notebook:confirm-restart-kernel',
- 'jupyter-notebook:confirm-restart-kernel-and-run-all-cells'
- ],
- 'run_int'],
- ['<add_celltype_list>'],
- [
- ['jupyter-notebook:show-command-palette'],
- 'cmd_palette']
- ];
- this.construct(grps);
- };
- MainToolBar.prototype._pseudo_actions = {};
- // add a cell type drop down to the maintoolbar.
- // triggered when the pseudo action `<add_celltype_list>` is
- // encountered when building a toolbar.
- MainToolBar.prototype._pseudo_actions.add_celltype_list = function () {
- var that = this;
- var multiselect = $('<option/>').attr('value','multiselect').attr('disabled','').text('-');
- var sel = $('<select/>')
- .attr('id','cell_type')
- .attr('aria-label', i18n.msg._('combobox, select cell type'))
- .attr('role', 'combobox')
- .addClass('form-control select-xs')
- .append($('<option/>').attr('value','code').text(i18n.msg._('Code')))
- .append($('<option/>').attr('value','markdown').text(i18n.msg._('Markdown')))
- .append($('<option/>').attr('value','raw').text(i18n.msg._('Raw NBConvert')))
- .append($('<option/>').attr('value','heading').text(i18n.msg._('Heading')))
- .append(multiselect);
- this.notebook.keyboard_manager.register_events(sel);
- this.events.on('selected_cell_type_changed.Notebook', function (event, data) {
- if (data.editable === false) {
- sel.attr('disabled', true);
- } else {
- sel.removeAttr('disabled');
- }
- if (that.notebook.get_selected_cells_indices().length > 1) {
- multiselect.show();
- sel.val('multiselect');
- } else {
- multiselect.hide();
- if (data.cell_type === 'heading') {
- sel.val('Markdown');
- } else {
- sel.val(data.cell_type);
- }
- }
- });
- sel.change(function () {
- var cell_type = $(this).val();
- switch (cell_type) {
- case 'code':
- that.notebook.cells_to_code();
- break;
- case 'markdown':
- that.notebook.cells_to_markdown();
- break;
- case 'raw':
- that.notebook.cells_to_raw();
- break;
- case 'heading':
- that.notebook._warn_heading();
- that.notebook.to_heading();
- sel.val('markdown');
- break;
- case 'multiselect':
- break;
- default:
- console.log(i18n.msg._("unrecognized cell type:"), cell_type);
- }
- that.notebook.focus_cell();
- });
- return sel;
- };
- return {'MainToolBar': MainToolBar};
- });
- /*! jQuery UI - v1.13.2 - 2022-07-14
- * http://jqueryui.com
- * Includes: widget.js, position.js, data.js, disable-selection.js, effect.js, effects/effect-blind.js, effects/effect-bounce.js, effects/effect-clip.js, effects/effect-drop.js, effects/effect-explode.js, effects/effect-fade.js, effects/effect-fold.js, effects/effect-highlight.js, effects/effect-puff.js, effects/effect-pulsate.js, effects/effect-scale.js, effects/effect-shake.js, effects/effect-size.js, effects/effect-slide.js, effects/effect-transfer.js, focusable.js, form-reset-mixin.js, jquery-patch.js, keycode.js, labels.js, scroll-parent.js, tabbable.js, unique-id.js, widgets/accordion.js, widgets/autocomplete.js, widgets/button.js, widgets/checkboxradio.js, widgets/controlgroup.js, widgets/datepicker.js, widgets/dialog.js, widgets/draggable.js, widgets/droppable.js, widgets/menu.js, widgets/mouse.js, widgets/progressbar.js, widgets/resizable.js, widgets/selectable.js, widgets/selectmenu.js, widgets/slider.js, widgets/sortable.js, widgets/spinner.js, widgets/tabs.js, widgets/tooltip.js
- * Copyright jQuery Foundation and other contributors; Licensed MIT */
- !function(t){"use strict";"function"==typeof define&&define.amd?define('jquery-ui',["jquery"],t):t(jQuery)}(function(V){"use strict";V.ui=V.ui||{};V.ui.version="1.13.2";var n,i=0,a=Array.prototype.hasOwnProperty,r=Array.prototype.slice;V.cleanData=(n=V.cleanData,function(t){for(var e,i,s=0;null!=(i=t[s]);s++)(e=V._data(i,"events"))&&e.remove&&V(i).triggerHandler("remove");n(t)}),V.widget=function(t,i,e){var s,n,o,a={},r=t.split(".")[0],l=r+"-"+(t=t.split(".")[1]);return e||(e=i,i=V.Widget),Array.isArray(e)&&(e=V.extend.apply(null,[{}].concat(e))),V.expr.pseudos[l.toLowerCase()]=function(t){return!!V.data(t,l)},V[r]=V[r]||{},s=V[r][t],n=V[r][t]=function(t,e){if(!this||!this._createWidget)return new n(t,e);arguments.length&&this._createWidget(t,e)},V.extend(n,s,{version:e.version,_proto:V.extend({},e),_childConstructors:[]}),(o=new i).options=V.widget.extend({},o.options),V.each(e,function(e,s){function n(){return i.prototype[e].apply(this,arguments)}function o(t){return i.prototype[e].apply(this,t)}a[e]="function"==typeof s?function(){var t,e=this._super,i=this._superApply;return this._super=n,this._superApply=o,t=s.apply(this,arguments),this._super=e,this._superApply=i,t}:s}),n.prototype=V.widget.extend(o,{widgetEventPrefix:s&&o.widgetEventPrefix||t},a,{constructor:n,namespace:r,widgetName:t,widgetFullName:l}),s?(V.each(s._childConstructors,function(t,e){var i=e.prototype;V.widget(i.namespace+"."+i.widgetName,n,e._proto)}),delete s._childConstructors):i._childConstructors.push(n),V.widget.bridge(t,n),n},V.widget.extend=function(t){for(var e,i,s=r.call(arguments,1),n=0,o=s.length;n<o;n++)for(e in s[n])i=s[n][e],a.call(s[n],e)&&void 0!==i&&(V.isPlainObject(i)?t[e]=V.isPlainObject(t[e])?V.widget.extend({},t[e],i):V.widget.extend({},i):t[e]=i);return t},V.widget.bridge=function(o,e){var a=e.prototype.widgetFullName||o;V.fn[o]=function(i){var t="string"==typeof i,s=r.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t,e=V.data(this,a);return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for "+o+" widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on "+o+" prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V.data(this,a);t?(t.option(i||{}),t._init&&t._init()):V.data(this,a,new e(i,this))})),n}},V.Widget=function(){},V.Widget._childConstructors=[],V.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",defaultElement:"<div>",options:{classes:{},disabled:!1,create:null},_createWidget:function(t,e){e=V(e||this.defaultElement||this)[0],this.element=V(e),this.uuid=i++,this.eventNamespace="."+this.widgetName+this.uuid,this.bindings=V(),this.hoverable=V(),this.focusable=V(),this.classesElementLookup={},e!==this&&(V.data(e,this.widgetFullName,this),this._on(!0,this.element,{remove:function(t){t.target===e&&this.destroy()}}),this.document=V(e.style?e.ownerDocument:e.document||e),this.window=V(this.document[0].defaultView||this.document[0].parentWindow)),this.options=V.widget.extend({},this.options,this._getCreateOptions(),t),this._create(),this.options.disabled&&this._setOptionDisabled(this.options.disabled),this._trigger("create",null,this._getCreateEventData()),this._init()},_getCreateOptions:function(){return{}},_getCreateEventData:V.noop,_create:V.noop,_init:V.noop,destroy:function(){var i=this;this._destroy(),V.each(this.classesElementLookup,function(t,e){i._removeClass(e,t)}),this.element.off(this.eventNamespace).removeData(this.widgetFullName),this.widget().off(this.eventNamespace).removeAttr("aria-disabled"),this.bindings.off(this.eventNamespace)},_destroy:V.noop,widget:function(){return this.element},option:function(t,e){var i,s,n,o=t;if(0===arguments.length)return V.widget.extend({},this.options);if("string"==typeof t)if(o={},t=(i=t.split(".")).shift(),i.length){for(s=o[t]=V.widget.extend({},this.options[t]),n=0;n<i.length-1;n++)s[i[n]]=s[i[n]]||{},s=s[i[n]];if(t=i.pop(),1===arguments.length)return void 0===s[t]?null:s[t];s[t]=e}else{if(1===arguments.length)return void 0===this.options[t]?null:this.options[t];o[t]=e}return this._setOptions(o),this},_setOptions:function(t){for(var e in t)this._setOption(e,t[e]);return this},_setOption:function(t,e){return"classes"===t&&this._setOptionClasses(e),this.options[t]=e,"disabled"===t&&this._setOptionDisabled(e),this},_setOptionClasses:function(t){var e,i,s;for(e in t)s=this.classesElementLookup[e],t[e]!==this.options.classes[e]&&s&&s.length&&(i=V(s.get()),this._removeClass(s,e),i.addClass(this._classes({element:i,keys:e,classes:t,add:!0})))},_setOptionDisabled:function(t){this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!!t),t&&(this._removeClass(this.hoverable,null,"ui-state-hover"),this._removeClass(this.focusable,null,"ui-state-focus"))},enable:function(){return this._setOptions({disabled:!1})},disable:function(){return this._setOptions({disabled:!0})},_classes:function(n){var o=[],a=this;function t(t,e){for(var i,s=0;s<t.length;s++)i=a.classesElementLookup[t[s]]||V(),i=n.add?(function(){var i=[];n.element.each(function(t,e){V.map(a.classesElementLookup,function(t){return t}).some(function(t){return t.is(e)})||i.push(e)}),a._on(V(i),{remove:"_untrackClassesElement"})}(),V(V.uniqueSort(i.get().concat(n.element.get())))):V(i.not(n.element).get()),a.classesElementLookup[t[s]]=i,o.push(t[s]),e&&n.classes[t[s]]&&o.push(n.classes[t[s]])}return(n=V.extend({element:this.element,classes:this.options.classes||{}},n)).keys&&t(n.keys.match(/\S+/g)||[],!0),n.extra&&t(n.extra.match(/\S+/g)||[]),o.join(" ")},_untrackClassesElement:function(i){var s=this;V.each(s.classesElementLookup,function(t,e){-1!==V.inArray(i.target,e)&&(s.classesElementLookup[t]=V(e.not(i.target).get()))}),this._off(V(i.target))},_removeClass:function(t,e,i){return this._toggleClass(t,e,i,!1)},_addClass:function(t,e,i){return this._toggleClass(t,e,i,!0)},_toggleClass:function(t,e,i,s){var n="string"==typeof t||null===t,i={extra:n?e:i,keys:n?t:e,element:n?this.element:t,add:s="boolean"==typeof s?s:i};return i.element.toggleClass(this._classes(i),s),this},_on:function(n,o,t){var a,r=this;"boolean"!=typeof n&&(t=o,o=n,n=!1),t?(o=a=V(o),this.bindings=this.bindings.add(o)):(t=o,o=this.element,a=this.widget()),V.each(t,function(t,e){function i(){if(n||!0!==r.options.disabled&&!V(this).hasClass("ui-state-disabled"))return("string"==typeof e?r[e]:e).apply(r,arguments)}"string"!=typeof e&&(i.guid=e.guid=e.guid||i.guid||V.guid++);var s=t.match(/^([\w:-]*)\s*(.*)$/),t=s[1]+r.eventNamespace,s=s[2];s?a.on(t,s,i):o.on(t,i)})},_off:function(t,e){e=(e||"").split(" ").join(this.eventNamespace+" ")+this.eventNamespace,t.off(e),this.bindings=V(this.bindings.not(t).get()),this.focusable=V(this.focusable.not(t).get()),this.hoverable=V(this.hoverable.not(t).get())},_delay:function(t,e){var i=this;return setTimeout(function(){return("string"==typeof t?i[t]:t).apply(i,arguments)},e||0)},_hoverable:function(t){this.hoverable=this.hoverable.add(t),this._on(t,{mouseenter:function(t){this._addClass(V(t.currentTarget),null,"ui-state-hover")},mouseleave:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-hover")}})},_focusable:function(t){this.focusable=this.focusable.add(t),this._on(t,{focusin:function(t){this._addClass(V(t.currentTarget),null,"ui-state-focus")},focusout:function(t){this._removeClass(V(t.currentTarget),null,"ui-state-focus")}})},_trigger:function(t,e,i){var s,n,o=this.options[t];if(i=i||{},(e=V.Event(e)).type=(t===this.widgetEventPrefix?t:this.widgetEventPrefix+t).toLowerCase(),e.target=this.element[0],n=e.originalEvent)for(s in n)s in e||(e[s]=n[s]);return this.element.trigger(e,i),!("function"==typeof o&&!1===o.apply(this.element[0],[e].concat(i))||e.isDefaultPrevented())}},V.each({show:"fadeIn",hide:"fadeOut"},function(o,a){V.Widget.prototype["_"+o]=function(e,t,i){var s,n=(t="string"==typeof t?{effect:t}:t)?!0!==t&&"number"!=typeof t&&t.effect||a:o;"number"==typeof(t=t||{})?t={duration:t}:!0===t&&(t={}),s=!V.isEmptyObject(t),t.complete=i,t.delay&&e.delay(t.delay),s&&V.effects&&V.effects.effect[n]?e[o](t):n!==o&&e[n]?e[n](t.duration,t.easing,i):e.queue(function(t){V(this)[o](),i&&i.call(e[0]),t()})}});var s,x,k,o,l,h,c,u,C;V.widget;function D(t,e,i){return[parseFloat(t[0])*(u.test(t[0])?e/100:1),parseFloat(t[1])*(u.test(t[1])?i/100:1)]}function I(t,e){return parseInt(V.css(t,e),10)||0}function T(t){return null!=t&&t===t.window}x=Math.max,k=Math.abs,o=/left|center|right/,l=/top|center|bottom/,h=/[\+\-]\d+(\.[\d]+)?%?/,c=/^\w+/,u=/%$/,C=V.fn.position,V.position={scrollbarWidth:function(){if(void 0!==s)return s;var t,e=V("<div style='display:block;position:absolute;width:200px;height:200px;overflow:hidden;'><div style='height:300px;width:auto;'></div></div>"),i=e.children()[0];return V("body").append(e),t=i.offsetWidth,e.css("overflow","scroll"),t===(i=i.offsetWidth)&&(i=e[0].clientWidth),e.remove(),s=t-i},getScrollInfo:function(t){var e=t.isWindow||t.isDocument?"":t.element.css("overflow-x"),i=t.isWindow||t.isDocument?"":t.element.css("overflow-y"),e="scroll"===e||"auto"===e&&t.width<t.element[0].scrollWidth;return{width:"scroll"===i||"auto"===i&&t.height<t.element[0].scrollHeight?V.position.scrollbarWidth():0,height:e?V.position.scrollbarWidth():0}},getWithinInfo:function(t){var e=V(t||window),i=T(e[0]),s=!!e[0]&&9===e[0].nodeType;return{element:e,isWindow:i,isDocument:s,offset:!i&&!s?V(t).offset():{left:0,top:0},scrollLeft:e.scrollLeft(),scrollTop:e.scrollTop(),width:e.outerWidth(),height:e.outerHeight()}}},V.fn.position=function(u){if(!u||!u.of)return C.apply(this,arguments);var d,p,f,g,m,t,_="string"==typeof(u=V.extend({},u)).of?V(document).find(u.of):V(u.of),v=V.position.getWithinInfo(u.within),b=V.position.getScrollInfo(v),y=(u.collision||"flip").split(" "),w={},e=9===(t=(e=_)[0]).nodeType?{width:e.width(),height:e.height(),offset:{top:0,left:0}}:T(t)?{width:e.width(),height:e.height(),offset:{top:e.scrollTop(),left:e.scrollLeft()}}:t.preventDefault?{width:0,height:0,offset:{top:t.pageY,left:t.pageX}}:{width:e.outerWidth(),height:e.outerHeight(),offset:e.offset()};return _[0].preventDefault&&(u.at="left top"),p=e.width,f=e.height,m=V.extend({},g=e.offset),V.each(["my","at"],function(){var t,e,i=(u[this]||"").split(" ");(i=1===i.length?o.test(i[0])?i.concat(["center"]):l.test(i[0])?["center"].concat(i):["center","center"]:i)[0]=o.test(i[0])?i[0]:"center",i[1]=l.test(i[1])?i[1]:"center",t=h.exec(i[0]),e=h.exec(i[1]),w[this]=[t?t[0]:0,e?e[0]:0],u[this]=[c.exec(i[0])[0],c.exec(i[1])[0]]}),1===y.length&&(y[1]=y[0]),"right"===u.at[0]?m.left+=p:"center"===u.at[0]&&(m.left+=p/2),"bottom"===u.at[1]?m.top+=f:"center"===u.at[1]&&(m.top+=f/2),d=D(w.at,p,f),m.left+=d[0],m.top+=d[1],this.each(function(){var i,t,a=V(this),r=a.outerWidth(),l=a.outerHeight(),e=I(this,"marginLeft"),s=I(this,"marginTop"),n=r+e+I(this,"marginRight")+b.width,o=l+s+I(this,"marginBottom")+b.height,h=V.extend({},m),c=D(w.my,a.outerWidth(),a.outerHeight());"right"===u.my[0]?h.left-=r:"center"===u.my[0]&&(h.left-=r/2),"bottom"===u.my[1]?h.top-=l:"center"===u.my[1]&&(h.top-=l/2),h.left+=c[0],h.top+=c[1],i={marginLeft:e,marginTop:s},V.each(["left","top"],function(t,e){V.ui.position[y[t]]&&V.ui.position[y[t]][e](h,{targetWidth:p,targetHeight:f,elemWidth:r,elemHeight:l,collisionPosition:i,collisionWidth:n,collisionHeight:o,offset:[d[0]+c[0],d[1]+c[1]],my:u.my,at:u.at,within:v,elem:a})}),u.using&&(t=function(t){var e=g.left-h.left,i=e+p-r,s=g.top-h.top,n=s+f-l,o={target:{element:_,left:g.left,top:g.top,width:p,height:f},element:{element:a,left:h.left,top:h.top,width:r,height:l},horizontal:i<0?"left":0<e?"right":"center",vertical:n<0?"top":0<s?"bottom":"middle"};p<r&&k(e+i)<p&&(o.horizontal="center"),f<l&&k(s+n)<f&&(o.vertical="middle"),x(k(e),k(i))>x(k(s),k(n))?o.important="horizontal":o.important="vertical",u.using.call(this,t,o)}),a.offset(V.extend(h,{using:t}))})},V.ui.position={fit:{left:function(t,e){var i=e.within,s=i.isWindow?i.scrollLeft:i.offset.left,n=i.width,o=t.left-e.collisionPosition.marginLeft,a=s-o,r=o+e.collisionWidth-n-s;e.collisionWidth>n?0<a&&r<=0?(i=t.left+a+e.collisionWidth-n-s,t.left+=a-i):t.left=!(0<r&&a<=0)&&r<a?s+n-e.collisionWidth:s:0<a?t.left+=a:0<r?t.left-=r:t.left=x(t.left-o,t.left)},top:function(t,e){var i=e.within,s=i.isWindow?i.scrollTop:i.offset.top,n=e.within.height,o=t.top-e.collisionPosition.marginTop,a=s-o,r=o+e.collisionHeight-n-s;e.collisionHeight>n?0<a&&r<=0?(i=t.top+a+e.collisionHeight-n-s,t.top+=a-i):t.top=!(0<r&&a<=0)&&r<a?s+n-e.collisionHeight:s:0<a?t.top+=a:0<r?t.top-=r:t.top=x(t.top-o,t.top)}},flip:{left:function(t,e){var i=e.within,s=i.offset.left+i.scrollLeft,n=i.width,o=i.isWindow?i.scrollLeft:i.offset.left,a=t.left-e.collisionPosition.marginLeft,r=a-o,l=a+e.collisionWidth-n-o,h="left"===e.my[0]?-e.elemWidth:"right"===e.my[0]?e.elemWidth:0,i="left"===e.at[0]?e.targetWidth:"right"===e.at[0]?-e.targetWidth:0,a=-2*e.offset[0];r<0?((s=t.left+h+i+a+e.collisionWidth-n-s)<0||s<k(r))&&(t.left+=h+i+a):0<l&&(0<(o=t.left-e.collisionPosition.marginLeft+h+i+a-o)||k(o)<l)&&(t.left+=h+i+a)},top:function(t,e){var i=e.within,s=i.offset.top+i.scrollTop,n=i.height,o=i.isWindow?i.scrollTop:i.offset.top,a=t.top-e.collisionPosition.marginTop,r=a-o,l=a+e.collisionHeight-n-o,h="top"===e.my[1]?-e.elemHeight:"bottom"===e.my[1]?e.elemHeight:0,i="top"===e.at[1]?e.targetHeight:"bottom"===e.at[1]?-e.targetHeight:0,a=-2*e.offset[1];r<0?((s=t.top+h+i+a+e.collisionHeight-n-s)<0||s<k(r))&&(t.top+=h+i+a):0<l&&(0<(o=t.top-e.collisionPosition.marginTop+h+i+a-o)||k(o)<l)&&(t.top+=h+i+a)}},flipfit:{left:function(){V.ui.position.flip.left.apply(this,arguments),V.ui.position.fit.left.apply(this,arguments)},top:function(){V.ui.position.flip.top.apply(this,arguments),V.ui.position.fit.top.apply(this,arguments)}}};V.ui.position,V.extend(V.expr.pseudos,{data:V.expr.createPseudo?V.expr.createPseudo(function(e){return function(t){return!!V.data(t,e)}}):function(t,e,i){return!!V.data(t,i[3])}}),V.fn.extend({disableSelection:(t="onselectstart"in document.createElement("div")?"selectstart":"mousedown",function(){return this.on(t+".ui-disableSelection",function(t){t.preventDefault()})}),enableSelection:function(){return this.off(".ui-disableSelection")}});var t,d=V,p={},e=p.toString,f=/^([\-+])=\s*(\d+\.?\d*)/,g=[{re:/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[t[1],t[2],t[3],t[4]]}},{re:/rgba?\(\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,parse:function(t){return[2.55*t[1],2.55*t[2],2.55*t[3],t[4]]}},{re:/#([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})([a-f0-9]{2})?/,parse:function(t){return[parseInt(t[1],16),parseInt(t[2],16),parseInt(t[3],16),t[4]?(parseInt(t[4],16)/255).toFixed(2):1]}},{re:/#([a-f0-9])([a-f0-9])([a-f0-9])([a-f0-9])?/,parse:function(t){return[parseInt(t[1]+t[1],16),parseInt(t[2]+t[2],16),parseInt(t[3]+t[3],16),t[4]?(parseInt(t[4]+t[4],16)/255).toFixed(2):1]}},{re:/hsla?\(\s*(\d+(?:\.\d+)?)\s*,\s*(\d+(?:\.\d+)?)\%\s*,\s*(\d+(?:\.\d+)?)\%\s*(?:,\s*(\d?(?:\.\d+)?)\s*)?\)/,space:"hsla",parse:function(t){return[t[1],t[2]/100,t[3]/100,t[4]]}}],m=d.Color=function(t,e,i,s){return new d.Color.fn.parse(t,e,i,s)},_={rgba:{props:{red:{idx:0,type:"byte"},green:{idx:1,type:"byte"},blue:{idx:2,type:"byte"}}},hsla:{props:{hue:{idx:0,type:"degrees"},saturation:{idx:1,type:"percent"},lightness:{idx:2,type:"percent"}}}},v={byte:{floor:!0,max:255},percent:{max:1},degrees:{mod:360,floor:!0}},b=m.support={},y=d("<p>")[0],w=d.each;function P(t){return null==t?t+"":"object"==typeof t?p[e.call(t)]||"object":typeof t}function M(t,e,i){var s=v[e.type]||{};return null==t?i||!e.def?null:e.def:(t=s.floor?~~t:parseFloat(t),isNaN(t)?e.def:s.mod?(t+s.mod)%s.mod:Math.min(s.max,Math.max(0,t)))}function S(s){var n=m(),o=n._rgba=[];return s=s.toLowerCase(),w(g,function(t,e){var i=e.re.exec(s),i=i&&e.parse(i),e=e.space||"rgba";if(i)return i=n[e](i),n[_[e].cache]=i[_[e].cache],o=n._rgba=i._rgba,!1}),o.length?("0,0,0,0"===o.join()&&d.extend(o,B.transparent),n):B[s]}function H(t,e,i){return 6*(i=(i+1)%1)<1?t+(e-t)*i*6:2*i<1?e:3*i<2?t+(e-t)*(2/3-i)*6:t}y.style.cssText="background-color:rgba(1,1,1,.5)",b.rgba=-1<y.style.backgroundColor.indexOf("rgba"),w(_,function(t,e){e.cache="_"+t,e.props.alpha={idx:3,type:"percent",def:1}}),d.each("Boolean Number String Function Array Date RegExp Object Error Symbol".split(" "),function(t,e){p["[object "+e+"]"]=e.toLowerCase()}),(m.fn=d.extend(m.prototype,{parse:function(n,t,e,i){if(void 0===n)return this._rgba=[null,null,null,null],this;(n.jquery||n.nodeType)&&(n=d(n).css(t),t=void 0);var o=this,s=P(n),a=this._rgba=[];return void 0!==t&&(n=[n,t,e,i],s="array"),"string"===s?this.parse(S(n)||B._default):"array"===s?(w(_.rgba.props,function(t,e){a[e.idx]=M(n[e.idx],e)}),this):"object"===s?(w(_,n instanceof m?function(t,e){n[e.cache]&&(o[e.cache]=n[e.cache].slice())}:function(t,i){var s=i.cache;w(i.props,function(t,e){if(!o[s]&&i.to){if("alpha"===t||null==n[t])return;o[s]=i.to(o._rgba)}o[s][e.idx]=M(n[t],e,!0)}),o[s]&&d.inArray(null,o[s].slice(0,3))<0&&(null==o[s][3]&&(o[s][3]=1),i.from&&(o._rgba=i.from(o[s])))}),this):void 0},is:function(t){var n=m(t),o=!0,a=this;return w(_,function(t,e){var i,s=n[e.cache];return s&&(i=a[e.cache]||e.to&&e.to(a._rgba)||[],w(e.props,function(t,e){if(null!=s[e.idx])return o=s[e.idx]===i[e.idx]})),o}),o},_space:function(){var i=[],s=this;return w(_,function(t,e){s[e.cache]&&i.push(t)}),i.pop()},transition:function(t,a){var e=(h=m(t))._space(),i=_[e],t=0===this.alpha()?m("transparent"):this,r=t[i.cache]||i.to(t._rgba),l=r.slice(),h=h[i.cache];return w(i.props,function(t,e){var i=e.idx,s=r[i],n=h[i],o=v[e.type]||{};null!==n&&(null===s?l[i]=n:(o.mod&&(n-s>o.mod/2?s+=o.mod:s-n>o.mod/2&&(s-=o.mod)),l[i]=M((n-s)*a+s,e)))}),this[e](l)},blend:function(t){if(1===this._rgba[3])return this;var e=this._rgba.slice(),i=e.pop(),s=m(t)._rgba;return m(d.map(e,function(t,e){return(1-i)*s[e]+i*t}))},toRgbaString:function(){var t="rgba(",e=d.map(this._rgba,function(t,e){return null!=t?t:2<e?1:0});return 1===e[3]&&(e.pop(),t="rgb("),t+e.join()+")"},toHslaString:function(){var t="hsla(",e=d.map(this.hsla(),function(t,e){return null==t&&(t=2<e?1:0),t=e&&e<3?Math.round(100*t)+"%":t});return 1===e[3]&&(e.pop(),t="hsl("),t+e.join()+")"},toHexString:function(t){var e=this._rgba.slice(),i=e.pop();return t&&e.push(~~(255*i)),"#"+d.map(e,function(t){return 1===(t=(t||0).toString(16)).length?"0"+t:t}).join("")},toString:function(){return 0===this._rgba[3]?"transparent":this.toRgbaString()}})).parse.prototype=m.fn,_.hsla.to=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/255,i=t[1]/255,s=t[2]/255,n=t[3],o=Math.max(e,i,s),a=Math.min(e,i,s),r=o-a,l=o+a,t=.5*l,i=a===o?0:e===o?60*(i-s)/r+360:i===o?60*(s-e)/r+120:60*(e-i)/r+240,l=0==r?0:t<=.5?r/l:r/(2-l);return[Math.round(i)%360,l,t,null==n?1:n]},_.hsla.from=function(t){if(null==t[0]||null==t[1]||null==t[2])return[null,null,null,t[3]];var e=t[0]/360,i=t[1],s=t[2],t=t[3],i=s<=.5?s*(1+i):s+i-s*i,s=2*s-i;return[Math.round(255*H(s,i,e+1/3)),Math.round(255*H(s,i,e)),Math.round(255*H(s,i,e-1/3)),t]},w(_,function(l,t){var e=t.props,o=t.cache,a=t.to,r=t.from;m.fn[l]=function(t){if(a&&!this[o]&&(this[o]=a(this._rgba)),void 0===t)return this[o].slice();var i=P(t),s="array"===i||"object"===i?t:arguments,n=this[o].slice();return w(e,function(t,e){t=s["object"===i?t:e.idx];null==t&&(t=n[e.idx]),n[e.idx]=M(t,e)}),r?((t=m(r(n)))[o]=n,t):m(n)},w(e,function(a,r){m.fn[a]||(m.fn[a]=function(t){var e,i=P(t),s="alpha"===a?this._hsla?"hsla":"rgba":l,n=this[s](),o=n[r.idx];return"undefined"===i?o:("function"===i&&(i=P(t=t.call(this,o))),null==t&&r.empty?this:("string"===i&&(e=f.exec(t))&&(t=o+parseFloat(e[2])*("+"===e[1]?1:-1)),n[r.idx]=t,this[s](n)))})})}),(m.hook=function(t){t=t.split(" ");w(t,function(t,o){d.cssHooks[o]={set:function(t,e){var i,s,n="";if("transparent"!==e&&("string"!==P(e)||(i=S(e)))){if(e=m(i||e),!b.rgba&&1!==e._rgba[3]){for(s="backgroundColor"===o?t.parentNode:t;(""===n||"transparent"===n)&&s&&s.style;)try{n=d.css(s,"backgroundColor"),s=s.parentNode}catch(t){}e=e.blend(n&&"transparent"!==n?n:"_default")}e=e.toRgbaString()}try{t.style[o]=e}catch(t){}}},d.fx.step[o]=function(t){t.colorInit||(t.start=m(t.elem,o),t.end=m(t.end),t.colorInit=!0),d.cssHooks[o].set(t.elem,t.start.transition(t.end,t.pos))}})})("backgroundColor borderBottomColor borderLeftColor borderRightColor borderTopColor color columnRuleColor outlineColor textDecorationColor textEmphasisColor"),d.cssHooks.borderColor={expand:function(i){var s={};return w(["Top","Right","Bottom","Left"],function(t,e){s["border"+e+"Color"]=i}),s}};var z,A,O,N,E,W,F,L,R,Y,B=d.Color.names={aqua:"#00ffff",black:"#000000",blue:"#0000ff",fuchsia:"#ff00ff",gray:"#808080",green:"#008000",lime:"#00ff00",maroon:"#800000",navy:"#000080",olive:"#808000",purple:"#800080",red:"#ff0000",silver:"#c0c0c0",teal:"#008080",white:"#ffffff",yellow:"#ffff00",transparent:[null,null,null,0],_default:"#ffffff"},j="ui-effects-",q="ui-effects-style",K="ui-effects-animated";function U(t){var e,i,s=t.ownerDocument.defaultView?t.ownerDocument.defaultView.getComputedStyle(t,null):t.currentStyle,n={};if(s&&s.length&&s[0]&&s[s[0]])for(i=s.length;i--;)"string"==typeof s[e=s[i]]&&(n[e.replace(/-([\da-z])/gi,function(t,e){return e.toUpperCase()})]=s[e]);else for(e in s)"string"==typeof s[e]&&(n[e]=s[e]);return n}function X(t,e,i,s){return t={effect:t=V.isPlainObject(t)?(e=t).effect:t},"function"==typeof(e=null==e?{}:e)&&(s=e,i=null,e={}),"number"!=typeof e&&!V.fx.speeds[e]||(s=i,i=e,e={}),"function"==typeof i&&(s=i,i=null),e&&V.extend(t,e),i=i||e.duration,t.duration=V.fx.off?0:"number"==typeof i?i:i in V.fx.speeds?V.fx.speeds[i]:V.fx.speeds._default,t.complete=s||e.complete,t}function $(t){return!t||"number"==typeof t||V.fx.speeds[t]||("string"==typeof t&&!V.effects.effect[t]||("function"==typeof t||"object"==typeof t&&!t.effect))}function G(t,e){var i=e.outerWidth(),e=e.outerHeight(),t=/^rect\((-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto),?\s*(-?\d*\.?\d*px|-?\d+%|auto)\)$/.exec(t)||["",0,i,e,0];return{top:parseFloat(t[1])||0,right:"auto"===t[2]?i:parseFloat(t[2]),bottom:"auto"===t[3]?e:parseFloat(t[3]),left:parseFloat(t[4])||0}}V.effects={effect:{}},N=["add","remove","toggle"],E={border:1,borderBottom:1,borderColor:1,borderLeft:1,borderRight:1,borderTop:1,borderWidth:1,margin:1,padding:1},V.each(["borderLeftStyle","borderRightStyle","borderBottomStyle","borderTopStyle"],function(t,e){V.fx.step[e]=function(t){("none"!==t.end&&!t.setAttr||1===t.pos&&!t.setAttr)&&(d.style(t.elem,e,t.end),t.setAttr=!0)}}),V.fn.addBack||(V.fn.addBack=function(t){return this.add(null==t?this.prevObject:this.prevObject.filter(t))}),V.effects.animateClass=function(n,t,e,i){var o=V.speed(t,e,i);return this.queue(function(){var i=V(this),t=i.attr("class")||"",e=(e=o.children?i.find("*").addBack():i).map(function(){return{el:V(this),start:U(this)}}),s=function(){V.each(N,function(t,e){n[e]&&i[e+"Class"](n[e])})};s(),e=e.map(function(){return this.end=U(this.el[0]),this.diff=function(t,e){var i,s,n={};for(i in e)s=e[i],t[i]!==s&&(E[i]||!V.fx.step[i]&&isNaN(parseFloat(s))||(n[i]=s));return n}(this.start,this.end),this}),i.attr("class",t),e=e.map(function(){var t=this,e=V.Deferred(),i=V.extend({},o,{queue:!1,complete:function(){e.resolve(t)}});return this.el.animate(this.diff,i),e.promise()}),V.when.apply(V,e.get()).done(function(){s(),V.each(arguments,function(){var e=this.el;V.each(this.diff,function(t){e.css(t,"")})}),o.complete.call(i[0])})})},V.fn.extend({addClass:(O=V.fn.addClass,function(t,e,i,s){return e?V.effects.animateClass.call(this,{add:t},e,i,s):O.apply(this,arguments)}),removeClass:(A=V.fn.removeClass,function(t,e,i,s){return 1<arguments.length?V.effects.animateClass.call(this,{remove:t},e,i,s):A.apply(this,arguments)}),toggleClass:(z=V.fn.toggleClass,function(t,e,i,s,n){return"boolean"==typeof e||void 0===e?i?V.effects.animateClass.call(this,e?{add:t}:{remove:t},i,s,n):z.apply(this,arguments):V.effects.animateClass.call(this,{toggle:t},e,i,s)}),switchClass:function(t,e,i,s,n){return V.effects.animateClass.call(this,{add:e,remove:t},i,s,n)}}),V.expr&&V.expr.pseudos&&V.expr.pseudos.animated&&(V.expr.pseudos.animated=(W=V.expr.pseudos.animated,function(t){return!!V(t).data(K)||W(t)})),!1!==V.uiBackCompat&&V.extend(V.effects,{save:function(t,e){for(var i=0,s=e.length;i<s;i++)null!==e[i]&&t.data(j+e[i],t[0].style[e[i]])},restore:function(t,e){for(var i,s=0,n=e.length;s<n;s++)null!==e[s]&&(i=t.data(j+e[s]),t.css(e[s],i))},setMode:function(t,e){return e="toggle"===e?t.is(":hidden")?"show":"hide":e},createWrapper:function(i){if(i.parent().is(".ui-effects-wrapper"))return i.parent();var s={width:i.outerWidth(!0),height:i.outerHeight(!0),float:i.css("float")},t=V("<div></div>").addClass("ui-effects-wrapper").css({fontSize:"100%",background:"transparent",border:"none",margin:0,padding:0}),e={width:i.width(),height:i.height()},n=document.activeElement;try{n.id}catch(t){n=document.body}return i.wrap(t),i[0]!==n&&!V.contains(i[0],n)||V(n).trigger("focus"),t=i.parent(),"static"===i.css("position")?(t.css({position:"relative"}),i.css({position:"relative"})):(V.extend(s,{position:i.css("position"),zIndex:i.css("z-index")}),V.each(["top","left","bottom","right"],function(t,e){s[e]=i.css(e),isNaN(parseInt(s[e],10))&&(s[e]="auto")}),i.css({position:"relative",top:0,left:0,right:"auto",bottom:"auto"})),i.css(e),t.css(s).show()},removeWrapper:function(t){var e=document.activeElement;return t.parent().is(".ui-effects-wrapper")&&(t.parent().replaceWith(t),t[0]!==e&&!V.contains(t[0],e)||V(e).trigger("focus")),t}}),V.extend(V.effects,{version:"1.13.2",define:function(t,e,i){return i||(i=e,e="effect"),V.effects.effect[t]=i,V.effects.effect[t].mode=e,i},scaledDimensions:function(t,e,i){if(0===e)return{height:0,width:0,outerHeight:0,outerWidth:0};var s="horizontal"!==i?(e||100)/100:1,e="vertical"!==i?(e||100)/100:1;return{height:t.height()*e,width:t.width()*s,outerHeight:t.outerHeight()*e,outerWidth:t.outerWidth()*s}},clipToBox:function(t){return{width:t.clip.right-t.clip.left,height:t.clip.bottom-t.clip.top,left:t.clip.left,top:t.clip.top}},unshift:function(t,e,i){var s=t.queue();1<e&&s.splice.apply(s,[1,0].concat(s.splice(e,i))),t.dequeue()},saveStyle:function(t){t.data(q,t[0].style.cssText)},restoreStyle:function(t){t[0].style.cssText=t.data(q)||"",t.removeData(q)},mode:function(t,e){t=t.is(":hidden");return"toggle"===e&&(e=t?"show":"hide"),e=(t?"hide"===e:"show"===e)?"none":e},getBaseline:function(t,e){var i,s;switch(t[0]){case"top":i=0;break;case"middle":i=.5;break;case"bottom":i=1;break;default:i=t[0]/e.height}switch(t[1]){case"left":s=0;break;case"center":s=.5;break;case"right":s=1;break;default:s=t[1]/e.width}return{x:s,y:i}},createPlaceholder:function(t){var e,i=t.css("position"),s=t.position();return t.css({marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()),/^(static|relative)/.test(i)&&(i="absolute",e=V("<"+t[0].nodeName+">").insertAfter(t).css({display:/^(inline|ruby)/.test(t.css("display"))?"inline-block":"block",visibility:"hidden",marginTop:t.css("marginTop"),marginBottom:t.css("marginBottom"),marginLeft:t.css("marginLeft"),marginRight:t.css("marginRight"),float:t.css("float")}).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).addClass("ui-effects-placeholder"),t.data(j+"placeholder",e)),t.css({position:i,left:s.left,top:s.top}),e},removePlaceholder:function(t){var e=j+"placeholder",i=t.data(e);i&&(i.remove(),t.removeData(e))},cleanUp:function(t){V.effects.restoreStyle(t),V.effects.removePlaceholder(t)},setTransition:function(s,t,n,o){return o=o||{},V.each(t,function(t,e){var i=s.cssUnit(e);0<i[0]&&(o[e]=i[0]*n+i[1])}),o}}),V.fn.extend({effect:function(){function t(t){var e=V(this),i=V.effects.mode(e,r)||o;e.data(K,!0),l.push(i),o&&("show"===i||i===o&&"hide"===i)&&e.show(),o&&"none"===i||V.effects.saveStyle(e),"function"==typeof t&&t()}var s=X.apply(this,arguments),n=V.effects.effect[s.effect],o=n.mode,e=s.queue,i=e||"fx",a=s.complete,r=s.mode,l=[];return V.fx.off||!n?r?this[r](s.duration,a):this.each(function(){a&&a.call(this)}):!1===e?this.each(t).each(h):this.queue(i,t).queue(i,h);function h(t){var e=V(this);function i(){"function"==typeof a&&a.call(e[0]),"function"==typeof t&&t()}s.mode=l.shift(),!1===V.uiBackCompat||o?"none"===s.mode?(e[r](),i()):n.call(e[0],s,function(){e.removeData(K),V.effects.cleanUp(e),"hide"===s.mode&&e.hide(),i()}):(e.is(":hidden")?"hide"===r:"show"===r)?(e[r](),i()):n.call(e[0],s,i)}},show:(R=V.fn.show,function(t){if($(t))return R.apply(this,arguments);t=X.apply(this,arguments);return t.mode="show",this.effect.call(this,t)}),hide:(L=V.fn.hide,function(t){if($(t))return L.apply(this,arguments);t=X.apply(this,arguments);return t.mode="hide",this.effect.call(this,t)}),toggle:(F=V.fn.toggle,function(t){if($(t)||"boolean"==typeof t)return F.apply(this,arguments);t=X.apply(this,arguments);return t.mode="toggle",this.effect.call(this,t)}),cssUnit:function(t){var i=this.css(t),s=[];return V.each(["em","px","%","pt"],function(t,e){0<i.indexOf(e)&&(s=[parseFloat(i),e])}),s},cssClip:function(t){return t?this.css("clip","rect("+t.top+"px "+t.right+"px "+t.bottom+"px "+t.left+"px)"):G(this.css("clip"),this)},transfer:function(t,e){var i=V(this),s=V(t.to),n="fixed"===s.css("position"),o=V("body"),a=n?o.scrollTop():0,r=n?o.scrollLeft():0,o=s.offset(),o={top:o.top-a,left:o.left-r,height:s.innerHeight(),width:s.innerWidth()},s=i.offset(),l=V("<div class='ui-effects-transfer'></div>");l.appendTo("body").addClass(t.className).css({top:s.top-a,left:s.left-r,height:i.innerHeight(),width:i.innerWidth(),position:n?"fixed":"absolute"}).animate(o,t.duration,t.easing,function(){l.remove(),"function"==typeof e&&e()})}}),V.fx.step.clip=function(t){t.clipInit||(t.start=V(t.elem).cssClip(),"string"==typeof t.end&&(t.end=G(t.end,t.elem)),t.clipInit=!0),V(t.elem).cssClip({top:t.pos*(t.end.top-t.start.top)+t.start.top,right:t.pos*(t.end.right-t.start.right)+t.start.right,bottom:t.pos*(t.end.bottom-t.start.bottom)+t.start.bottom,left:t.pos*(t.end.left-t.start.left)+t.start.left})},Y={},V.each(["Quad","Cubic","Quart","Quint","Expo"],function(e,t){Y[t]=function(t){return Math.pow(t,e+2)}}),V.extend(Y,{Sine:function(t){return 1-Math.cos(t*Math.PI/2)},Circ:function(t){return 1-Math.sqrt(1-t*t)},Elastic:function(t){return 0===t||1===t?t:-Math.pow(2,8*(t-1))*Math.sin((80*(t-1)-7.5)*Math.PI/15)},Back:function(t){return t*t*(3*t-2)},Bounce:function(t){for(var e,i=4;t<((e=Math.pow(2,--i))-1)/11;);return 1/Math.pow(4,3-i)-7.5625*Math.pow((3*e-2)/22-t,2)}}),V.each(Y,function(t,e){V.easing["easeIn"+t]=e,V.easing["easeOut"+t]=function(t){return 1-e(1-t)},V.easing["easeInOut"+t]=function(t){return t<.5?e(2*t)/2:1-e(-2*t+2)/2}});y=V.effects,V.effects.define("blind","hide",function(t,e){var i={up:["bottom","top"],vertical:["bottom","top"],down:["top","bottom"],left:["right","left"],horizontal:["right","left"],right:["left","right"]},s=V(this),n=t.direction||"up",o=s.cssClip(),a={clip:V.extend({},o)},r=V.effects.createPlaceholder(s);a.clip[i[n][0]]=a.clip[i[n][1]],"show"===t.mode&&(s.cssClip(a.clip),r&&r.css(V.effects.clipToBox(a)),a.clip=o),r&&r.animate(V.effects.clipToBox(a),t.duration,t.easing),s.animate(a,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("bounce",function(t,e){var i,s,n=V(this),o=t.mode,a="hide"===o,r="show"===o,l=t.direction||"up",h=t.distance,c=t.times||5,o=2*c+(r||a?1:0),u=t.duration/o,d=t.easing,p="up"===l||"down"===l?"top":"left",f="up"===l||"left"===l,g=0,t=n.queue().length;for(V.effects.createPlaceholder(n),l=n.css(p),h=h||n["top"==p?"outerHeight":"outerWidth"]()/3,r&&((s={opacity:1})[p]=l,n.css("opacity",0).css(p,f?2*-h:2*h).animate(s,u,d)),a&&(h/=Math.pow(2,c-1)),(s={})[p]=l;g<c;g++)(i={})[p]=(f?"-=":"+=")+h,n.animate(i,u,d).animate(s,u,d),h=a?2*h:h/2;a&&((i={opacity:0})[p]=(f?"-=":"+=")+h,n.animate(i,u,d)),n.queue(e),V.effects.unshift(n,t,1+o)}),V.effects.define("clip","hide",function(t,e){var i={},s=V(this),n=t.direction||"vertical",o="both"===n,a=o||"horizontal"===n,o=o||"vertical"===n,n=s.cssClip();i.clip={top:o?(n.bottom-n.top)/2:n.top,right:a?(n.right-n.left)/2:n.right,bottom:o?(n.bottom-n.top)/2:n.bottom,left:a?(n.right-n.left)/2:n.left},V.effects.createPlaceholder(s),"show"===t.mode&&(s.cssClip(i.clip),i.clip=n),s.animate(i,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("drop","hide",function(t,e){var i=V(this),s="show"===t.mode,n=t.direction||"left",o="up"===n||"down"===n?"top":"left",a="up"===n||"left"===n?"-=":"+=",r="+="==a?"-=":"+=",l={opacity:0};V.effects.createPlaceholder(i),n=t.distance||i["top"==o?"outerHeight":"outerWidth"](!0)/2,l[o]=a+n,s&&(i.css(l),l[o]=r+n,l.opacity=1),i.animate(l,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("explode","hide",function(t,e){var i,s,n,o,a,r,l=t.pieces?Math.round(Math.sqrt(t.pieces)):3,h=l,c=V(this),u="show"===t.mode,d=c.show().css("visibility","hidden").offset(),p=Math.ceil(c.outerWidth()/h),f=Math.ceil(c.outerHeight()/l),g=[];function m(){g.push(this),g.length===l*h&&(c.css({visibility:"visible"}),V(g).remove(),e())}for(i=0;i<l;i++)for(o=d.top+i*f,r=i-(l-1)/2,s=0;s<h;s++)n=d.left+s*p,a=s-(h-1)/2,c.clone().appendTo("body").wrap("<div></div>").css({position:"absolute",visibility:"visible",left:-s*p,top:-i*f}).parent().addClass("ui-effects-explode").css({position:"absolute",overflow:"hidden",width:p,height:f,left:n+(u?a*p:0),top:o+(u?r*f:0),opacity:u?0:1}).animate({left:n+(u?0:a*p),top:o+(u?0:r*f),opacity:u?1:0},t.duration||500,t.easing,m)}),V.effects.define("fade","toggle",function(t,e){var i="show"===t.mode;V(this).css("opacity",i?0:1).animate({opacity:i?1:0},{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("fold","hide",function(e,t){var i=V(this),s=e.mode,n="show"===s,o="hide"===s,a=e.size||15,r=/([0-9]+)%/.exec(a),l=!!e.horizFirst?["right","bottom"]:["bottom","right"],h=e.duration/2,c=V.effects.createPlaceholder(i),u=i.cssClip(),d={clip:V.extend({},u)},p={clip:V.extend({},u)},f=[u[l[0]],u[l[1]]],s=i.queue().length;r&&(a=parseInt(r[1],10)/100*f[o?0:1]),d.clip[l[0]]=a,p.clip[l[0]]=a,p.clip[l[1]]=0,n&&(i.cssClip(p.clip),c&&c.css(V.effects.clipToBox(p)),p.clip=u),i.queue(function(t){c&&c.animate(V.effects.clipToBox(d),h,e.easing).animate(V.effects.clipToBox(p),h,e.easing),t()}).animate(d,h,e.easing).animate(p,h,e.easing).queue(t),V.effects.unshift(i,s,4)}),V.effects.define("highlight","show",function(t,e){var i=V(this),s={backgroundColor:i.css("backgroundColor")};"hide"===t.mode&&(s.opacity=0),V.effects.saveStyle(i),i.css({backgroundImage:"none",backgroundColor:t.color||"#ffff99"}).animate(s,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),V.effects.define("size",function(s,e){var n,i=V(this),t=["fontSize"],o=["borderTopWidth","borderBottomWidth","paddingTop","paddingBottom"],a=["borderLeftWidth","borderRightWidth","paddingLeft","paddingRight"],r=s.mode,l="effect"!==r,h=s.scale||"both",c=s.origin||["middle","center"],u=i.css("position"),d=i.position(),p=V.effects.scaledDimensions(i),f=s.from||p,g=s.to||V.effects.scaledDimensions(i,0);V.effects.createPlaceholder(i),"show"===r&&(r=f,f=g,g=r),n={from:{y:f.height/p.height,x:f.width/p.width},to:{y:g.height/p.height,x:g.width/p.width}},"box"!==h&&"both"!==h||(n.from.y!==n.to.y&&(f=V.effects.setTransition(i,o,n.from.y,f),g=V.effects.setTransition(i,o,n.to.y,g)),n.from.x!==n.to.x&&(f=V.effects.setTransition(i,a,n.from.x,f),g=V.effects.setTransition(i,a,n.to.x,g))),"content"!==h&&"both"!==h||n.from.y!==n.to.y&&(f=V.effects.setTransition(i,t,n.from.y,f),g=V.effects.setTransition(i,t,n.to.y,g)),c&&(c=V.effects.getBaseline(c,p),f.top=(p.outerHeight-f.outerHeight)*c.y+d.top,f.left=(p.outerWidth-f.outerWidth)*c.x+d.left,g.top=(p.outerHeight-g.outerHeight)*c.y+d.top,g.left=(p.outerWidth-g.outerWidth)*c.x+d.left),delete f.outerHeight,delete f.outerWidth,i.css(f),"content"!==h&&"both"!==h||(o=o.concat(["marginTop","marginBottom"]).concat(t),a=a.concat(["marginLeft","marginRight"]),i.find("*[width]").each(function(){var t=V(this),e=V.effects.scaledDimensions(t),i={height:e.height*n.from.y,width:e.width*n.from.x,outerHeight:e.outerHeight*n.from.y,outerWidth:e.outerWidth*n.from.x},e={height:e.height*n.to.y,width:e.width*n.to.x,outerHeight:e.height*n.to.y,outerWidth:e.width*n.to.x};n.from.y!==n.to.y&&(i=V.effects.setTransition(t,o,n.from.y,i),e=V.effects.setTransition(t,o,n.to.y,e)),n.from.x!==n.to.x&&(i=V.effects.setTransition(t,a,n.from.x,i),e=V.effects.setTransition(t,a,n.to.x,e)),l&&V.effects.saveStyle(t),t.css(i),t.animate(e,s.duration,s.easing,function(){l&&V.effects.restoreStyle(t)})})),i.animate(g,{queue:!1,duration:s.duration,easing:s.easing,complete:function(){var t=i.offset();0===g.opacity&&i.css("opacity",f.opacity),l||(i.css("position","static"===u?"relative":u).offset(t),V.effects.saveStyle(i)),e()}})}),V.effects.define("scale",function(t,e){var i=V(this),s=t.mode,s=parseInt(t.percent,10)||(0===parseInt(t.percent,10)||"effect"!==s?0:100),s=V.extend(!0,{from:V.effects.scaledDimensions(i),to:V.effects.scaledDimensions(i,s,t.direction||"both"),origin:t.origin||["middle","center"]},t);t.fade&&(s.from.opacity=1,s.to.opacity=0),V.effects.effect.size.call(this,s,e)}),V.effects.define("puff","hide",function(t,e){t=V.extend(!0,{},t,{fade:!0,percent:parseInt(t.percent,10)||150});V.effects.effect.scale.call(this,t,e)}),V.effects.define("pulsate","show",function(t,e){var i=V(this),s=t.mode,n="show"===s,o=2*(t.times||5)+(n||"hide"===s?1:0),a=t.duration/o,r=0,l=1,s=i.queue().length;for(!n&&i.is(":visible")||(i.css("opacity",0).show(),r=1);l<o;l++)i.animate({opacity:r},a,t.easing),r=1-r;i.animate({opacity:r},a,t.easing),i.queue(e),V.effects.unshift(i,s,1+o)}),V.effects.define("shake",function(t,e){var i=1,s=V(this),n=t.direction||"left",o=t.distance||20,a=t.times||3,r=2*a+1,l=Math.round(t.duration/r),h="up"===n||"down"===n?"top":"left",c="up"===n||"left"===n,u={},d={},p={},n=s.queue().length;for(V.effects.createPlaceholder(s),u[h]=(c?"-=":"+=")+o,d[h]=(c?"+=":"-=")+2*o,p[h]=(c?"-=":"+=")+2*o,s.animate(u,l,t.easing);i<a;i++)s.animate(d,l,t.easing).animate(p,l,t.easing);s.animate(d,l,t.easing).animate(u,l/2,t.easing).queue(e),V.effects.unshift(s,n,1+r)}),V.effects.define("slide","show",function(t,e){var i,s,n=V(this),o={up:["bottom","top"],down:["top","bottom"],left:["right","left"],right:["left","right"]},a=t.mode,r=t.direction||"left",l="up"===r||"down"===r?"top":"left",h="up"===r||"left"===r,c=t.distance||n["top"==l?"outerHeight":"outerWidth"](!0),u={};V.effects.createPlaceholder(n),i=n.cssClip(),s=n.position()[l],u[l]=(h?-1:1)*c+s,u.clip=n.cssClip(),u.clip[o[r][1]]=u.clip[o[r][0]],"show"===a&&(n.cssClip(u.clip),n.css(l,u[l]),u.clip=i,u[l]=s),n.animate(u,{queue:!1,duration:t.duration,easing:t.easing,complete:e})}),y=!1!==V.uiBackCompat?V.effects.define("transfer",function(t,e){V(this).transfer(t,e)}):y;V.ui.focusable=function(t,e){var i,s,n,o,a=t.nodeName.toLowerCase();return"area"===a?(s=(i=t.parentNode).name,!(!t.href||!s||"map"!==i.nodeName.toLowerCase())&&(0<(s=V("img[usemap='#"+s+"']")).length&&s.is(":visible"))):(/^(input|select|textarea|button|object)$/.test(a)?(n=!t.disabled)&&(o=V(t).closest("fieldset")[0])&&(n=!o.disabled):n="a"===a&&t.href||e,n&&V(t).is(":visible")&&function(t){var e=t.css("visibility");for(;"inherit"===e;)t=t.parent(),e=t.css("visibility");return"visible"===e}(V(t)))},V.extend(V.expr.pseudos,{focusable:function(t){return V.ui.focusable(t,null!=V.attr(t,"tabindex"))}});var Q,J;V.ui.focusable,V.fn._form=function(){return"string"==typeof this[0].form?this.closest("form"):V(this[0].form)},V.ui.formResetMixin={_formResetHandler:function(){var e=V(this);setTimeout(function(){var t=e.data("ui-form-reset-instances");V.each(t,function(){this.refresh()})})},_bindFormResetHandler:function(){var t;this.form=this.element._form(),this.form.length&&((t=this.form.data("ui-form-reset-instances")||[]).length||this.form.on("reset.ui-form-reset",this._formResetHandler),t.push(this),this.form.data("ui-form-reset-instances",t))},_unbindFormResetHandler:function(){var t;this.form.length&&((t=this.form.data("ui-form-reset-instances")).splice(V.inArray(this,t),1),t.length?this.form.data("ui-form-reset-instances",t):this.form.removeData("ui-form-reset-instances").off("reset.ui-form-reset"))}};V.expr.pseudos||(V.expr.pseudos=V.expr[":"]),V.uniqueSort||(V.uniqueSort=V.unique),V.escapeSelector||(Q=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\x80-\uFFFF\w-]/g,J=function(t,e){return e?"\0"===t?"�":t.slice(0,-1)+"\\"+t.charCodeAt(t.length-1).toString(16)+" ":"\\"+t},V.escapeSelector=function(t){return(t+"").replace(Q,J)}),V.fn.even&&V.fn.odd||V.fn.extend({even:function(){return this.filter(function(t){return t%2==0})},odd:function(){return this.filter(function(t){return t%2==1})}});var Z;V.ui.keyCode={BACKSPACE:8,COMMA:188,DELETE:46,DOWN:40,END:35,ENTER:13,ESCAPE:27,HOME:36,LEFT:37,PAGE_DOWN:34,PAGE_UP:33,PERIOD:190,RIGHT:39,SPACE:32,TAB:9,UP:38},V.fn.labels=function(){var t,e,i;return this.length?this[0].labels&&this[0].labels.length?this.pushStack(this[0].labels):(e=this.eq(0).parents("label"),(t=this.attr("id"))&&(i=(i=this.eq(0).parents().last()).add((i.length?i:this).siblings()),t="label[for='"+V.escapeSelector(t)+"']",e=e.add(i.find(t).addBack(t))),this.pushStack(e)):this.pushStack([])},V.fn.scrollParent=function(t){var e=this.css("position"),i="absolute"===e,s=t?/(auto|scroll|hidden)/:/(auto|scroll)/,t=this.parents().filter(function(){var t=V(this);return(!i||"static"!==t.css("position"))&&s.test(t.css("overflow")+t.css("overflow-y")+t.css("overflow-x"))}).eq(0);return"fixed"!==e&&t.length?t:V(this[0].ownerDocument||document)},V.extend(V.expr.pseudos,{tabbable:function(t){var e=V.attr(t,"tabindex"),i=null!=e;return(!i||0<=e)&&V.ui.focusable(t,i)}}),V.fn.extend({uniqueId:(Z=0,function(){return this.each(function(){this.id||(this.id="ui-id-"+ ++Z)})}),removeUniqueId:function(){return this.each(function(){/^ui-id-\d+$/.test(this.id)&&V(this).removeAttr("id")})}}),V.widget("ui.accordion",{version:"1.13.2",options:{active:0,animate:{},classes:{"ui-accordion-header":"ui-corner-top","ui-accordion-header-collapsed":"ui-corner-all","ui-accordion-content":"ui-corner-bottom"},collapsible:!1,event:"click",header:function(t){return t.find("> li > :first-child").add(t.find("> :not(li)").even())},heightStyle:"auto",icons:{activeHeader:"ui-icon-triangle-1-s",header:"ui-icon-triangle-1-e"},activate:null,beforeActivate:null},hideProps:{borderTopWidth:"hide",borderBottomWidth:"hide",paddingTop:"hide",paddingBottom:"hide",height:"hide"},showProps:{borderTopWidth:"show",borderBottomWidth:"show",paddingTop:"show",paddingBottom:"show",height:"show"},_create:function(){var t=this.options;this.prevShow=this.prevHide=V(),this._addClass("ui-accordion","ui-widget ui-helper-reset"),this.element.attr("role","tablist"),t.collapsible||!1!==t.active&&null!=t.active||(t.active=0),this._processPanels(),t.active<0&&(t.active+=this.headers.length),this._refresh()},_getCreateEventData:function(){return{header:this.active,panel:this.active.length?this.active.next():V()}},_createIcons:function(){var t,e=this.options.icons;e&&(t=V("<span>"),this._addClass(t,"ui-accordion-header-icon","ui-icon "+e.header),t.prependTo(this.headers),t=this.active.children(".ui-accordion-header-icon"),this._removeClass(t,e.header)._addClass(t,null,e.activeHeader)._addClass(this.headers,"ui-accordion-icons"))},_destroyIcons:function(){this._removeClass(this.headers,"ui-accordion-icons"),this.headers.children(".ui-accordion-header-icon").remove()},_destroy:function(){var t;this.element.removeAttr("role"),this.headers.removeAttr("role aria-expanded aria-selected aria-controls tabIndex").removeUniqueId(),this._destroyIcons(),t=this.headers.next().css("display","").removeAttr("role aria-hidden aria-labelledby").removeUniqueId(),"content"!==this.options.heightStyle&&t.css("height","")},_setOption:function(t,e){"active"!==t?("event"===t&&(this.options.event&&this._off(this.headers,this.options.event),this._setupEvents(e)),this._super(t,e),"collapsible"!==t||e||!1!==this.options.active||this._activate(0),"icons"===t&&(this._destroyIcons(),e&&this._createIcons())):this._activate(e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t),this._toggleClass(this.headers.add(this.headers.next()),null,"ui-state-disabled",!!t)},_keydown:function(t){if(!t.altKey&&!t.ctrlKey){var e=V.ui.keyCode,i=this.headers.length,s=this.headers.index(t.target),n=!1;switch(t.keyCode){case e.RIGHT:case e.DOWN:n=this.headers[(s+1)%i];break;case e.LEFT:case e.UP:n=this.headers[(s-1+i)%i];break;case e.SPACE:case e.ENTER:this._eventHandler(t);break;case e.HOME:n=this.headers[0];break;case e.END:n=this.headers[i-1]}n&&(V(t.target).attr("tabIndex",-1),V(n).attr("tabIndex",0),V(n).trigger("focus"),t.preventDefault())}},_panelKeyDown:function(t){t.keyCode===V.ui.keyCode.UP&&t.ctrlKey&&V(t.currentTarget).prev().trigger("focus")},refresh:function(){var t=this.options;this._processPanels(),!1===t.active&&!0===t.collapsible||!this.headers.length?(t.active=!1,this.active=V()):!1===t.active?this._activate(0):this.active.length&&!V.contains(this.element[0],this.active[0])?this.headers.length===this.headers.find(".ui-state-disabled").length?(t.active=!1,this.active=V()):this._activate(Math.max(0,t.active-1)):t.active=this.headers.index(this.active),this._destroyIcons(),this._refresh()},_processPanels:function(){var t=this.headers,e=this.panels;"function"==typeof this.options.header?this.headers=this.options.header(this.element):this.headers=this.element.find(this.options.header),this._addClass(this.headers,"ui-accordion-header ui-accordion-header-collapsed","ui-state-default"),this.panels=this.headers.next().filter(":not(.ui-accordion-content-active)").hide(),this._addClass(this.panels,"ui-accordion-content","ui-helper-reset ui-widget-content"),e&&(this._off(t.not(this.headers)),this._off(e.not(this.panels)))},_refresh:function(){var i,t=this.options,e=t.heightStyle,s=this.element.parent();this.active=this._findActive(t.active),this._addClass(this.active,"ui-accordion-header-active","ui-state-active")._removeClass(this.active,"ui-accordion-header-collapsed"),this._addClass(this.active.next(),"ui-accordion-content-active"),this.active.next().show(),this.headers.attr("role","tab").each(function(){var t=V(this),e=t.uniqueId().attr("id"),i=t.next(),s=i.uniqueId().attr("id");t.attr("aria-controls",s),i.attr("aria-labelledby",e)}).next().attr("role","tabpanel"),this.headers.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}).next().attr({"aria-hidden":"true"}).hide(),this.active.length?this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}).next().attr({"aria-hidden":"false"}):this.headers.eq(0).attr("tabIndex",0),this._createIcons(),this._setupEvents(t.event),"fill"===e?(i=s.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.headers.each(function(){i-=V(this).outerHeight(!0)}),this.headers.next().each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===e&&(i=0,this.headers.next().each(function(){var t=V(this).is(":visible");t||V(this).show(),i=Math.max(i,V(this).css("height","").height()),t||V(this).hide()}).height(i))},_activate:function(t){t=this._findActive(t)[0];t!==this.active[0]&&(t=t||this.active[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return"number"==typeof t?this.headers.eq(t):V()},_setupEvents:function(t){var i={keydown:"_keydown"};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.headers.add(this.headers.next())),this._on(this.headers,i),this._on(this.headers.next(),{keydown:"_panelKeyDown"}),this._hoverable(this.headers),this._focusable(this.headers)},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():s.next(),r=i.next(),a={oldHeader:i,oldPanel:r,newHeader:o?V():s,newPanel:a};t.preventDefault(),n&&!e.collapsible||!1===this._trigger("beforeActivate",t,a)||(e.active=!o&&this.headers.index(s),this.active=n?V():s,this._toggle(a),this._removeClass(i,"ui-accordion-header-active","ui-state-active"),e.icons&&(i=i.children(".ui-accordion-header-icon"),this._removeClass(i,null,e.icons.activeHeader)._addClass(i,null,e.icons.header)),n||(this._removeClass(s,"ui-accordion-header-collapsed")._addClass(s,"ui-accordion-header-active","ui-state-active"),e.icons&&(n=s.children(".ui-accordion-header-icon"),this._removeClass(n,null,e.icons.header)._addClass(n,null,e.icons.activeHeader)),this._addClass(s.next(),"ui-accordion-content-active")))},_toggle:function(t){var e=t.newPanel,i=this.prevShow.length?this.prevShow:t.oldPanel;this.prevShow.add(this.prevHide).stop(!0,!0),this.prevShow=e,this.prevHide=i,this.options.animate?this._animate(e,i,t):(i.hide(),e.show(),this._toggleComplete(t)),i.attr({"aria-hidden":"true"}),i.prev().attr({"aria-selected":"false","aria-expanded":"false"}),e.length&&i.length?i.prev().attr({tabIndex:-1,"aria-expanded":"false"}):e.length&&this.headers.filter(function(){return 0===parseInt(V(this).attr("tabIndex"),10)}).attr("tabIndex",-1),e.attr("aria-hidden","false").prev().attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_animate:function(t,i,e){var s,n,o,a=this,r=0,l=t.css("box-sizing"),h=t.length&&(!i.length||t.index()<i.index()),c=this.options.animate||{},u=h&&c.down||c,h=function(){a._toggleComplete(e)};return n=(n="string"==typeof u?u:n)||u.easing||c.easing,o=(o="number"==typeof u?u:o)||u.duration||c.duration,i.length?t.length?(s=t.show().outerHeight(),i.animate(this.hideProps,{duration:o,easing:n,step:function(t,e){e.now=Math.round(t)}}),void t.hide().animate(this.showProps,{duration:o,easing:n,complete:h,step:function(t,e){e.now=Math.round(t),"height"!==e.prop?"content-box"===l&&(r+=e.now):"content"!==a.options.heightStyle&&(e.now=Math.round(s-i.outerHeight()-r),r=0)}})):i.animate(this.hideProps,o,n,h):t.animate(this.showProps,o,n,h)},_toggleComplete:function(t){var e=t.oldPanel,i=e.prev();this._removeClass(e,"ui-accordion-content-active"),this._removeClass(i,"ui-accordion-header-active")._addClass(i,"ui-accordion-header-collapsed"),e.length&&(e.parent()[0].className=e.parent()[0].className),this._trigger("activate",null,t)}}),V.ui.safeActiveElement=function(e){var i;try{i=e.activeElement}catch(t){i=e.body}return i=!(i=i||e.body).nodeName?e.body:i},V.widget("ui.menu",{version:"1.13.2",defaultElement:"<ul>",delay:300,options:{icons:{submenu:"ui-icon-caret-1-e"},items:"> *",menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activeMenu=this.element,this.mouseHandled=!1,this.lastMousePosition={x:null,y:null},this.element.uniqueId().attr({role:this.options.role,tabIndex:0}),this._addClass("ui-menu","ui-widget ui-widget-content"),this._on({"mousedown .ui-menu-item":function(t){t.preventDefault(),this._activateItem(t)},"click .ui-menu-item":function(t){var e=V(t.target),i=V(V.ui.safeActiveElement(this.document[0]));!this.mouseHandled&&e.not(".ui-state-disabled").length&&(this.select(t),t.isPropagationStopped()||(this.mouseHandled=!0),e.has(".ui-menu").length?this.expand(t):!this.element.is(":focus")&&i.closest(".ui-menu").length&&(this.element.trigger("focus",[!0]),this.active&&1===this.active.parents(".ui-menu").length&&clearTimeout(this.timer)))},"mouseenter .ui-menu-item":"_activateItem","mousemove .ui-menu-item":"_activateItem",mouseleave:"collapseAll","mouseleave .ui-menu":"collapseAll",focus:function(t,e){var i=this.active||this._menuItems().first();e||this.focus(t,i)},blur:function(t){this._delay(function(){V.contains(this.element[0],V.ui.safeActiveElement(this.document[0]))||this.collapseAll(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){this._closeOnDocumentClick(t)&&this.collapseAll(t,!0),this.mouseHandled=!1}})},_activateItem:function(t){var e,i;this.previousFilter||t.clientX===this.lastMousePosition.x&&t.clientY===this.lastMousePosition.y||(this.lastMousePosition={x:t.clientX,y:t.clientY},e=V(t.target).closest(".ui-menu-item"),i=V(t.currentTarget),e[0]===i[0]&&(i.is(".ui-state-active")||(this._removeClass(i.siblings().children(".ui-state-active"),null,"ui-state-active"),this.focus(t,i))))},_destroy:function(){var t=this.element.find(".ui-menu-item").removeAttr("role aria-disabled").children(".ui-menu-item-wrapper").removeUniqueId().removeAttr("tabIndex role aria-haspopup");this.element.removeAttr("aria-activedescendant").find(".ui-menu").addBack().removeAttr("role aria-labelledby aria-expanded aria-hidden aria-disabled tabIndex").removeUniqueId().show(),t.children().each(function(){var t=V(this);t.data("ui-menu-submenu-caret")&&t.remove()})},_keydown:function(t){var e,i,s,n=!0;switch(t.keyCode){case V.ui.keyCode.PAGE_UP:this.previousPage(t);break;case V.ui.keyCode.PAGE_DOWN:this.nextPage(t);break;case V.ui.keyCode.HOME:this._move("first","first",t);break;case V.ui.keyCode.END:this._move("last","last",t);break;case V.ui.keyCode.UP:this.previous(t);break;case V.ui.keyCode.DOWN:this.next(t);break;case V.ui.keyCode.LEFT:this.collapse(t);break;case V.ui.keyCode.RIGHT:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case V.ui.keyCode.ENTER:case V.ui.keyCode.SPACE:this._activate(t);break;case V.ui.keyCode.ESCAPE:this.collapse(t);break;default:e=this.previousFilter||"",s=n=!1,i=96<=t.keyCode&&t.keyCode<=105?(t.keyCode-96).toString():String.fromCharCode(t.keyCode),clearTimeout(this.filterTimer),i===e?s=!0:i=e+i,e=this._filterMenuItems(i),(e=s&&-1!==e.index(this.active.next())?this.active.nextAll(".ui-menu-item"):e).length||(i=String.fromCharCode(t.keyCode),e=this._filterMenuItems(i)),e.length?(this.focus(t,e),this.previousFilter=i,this.filterTimer=this._delay(function(){delete this.previousFilter},1e3)):delete this.previousFilter}n&&t.preventDefault()},_activate:function(t){this.active&&!this.active.is(".ui-state-disabled")&&(this.active.children("[aria-haspopup='true']").length?this.expand(t):this.select(t))},refresh:function(){var t,e,s=this,n=this.options.icons.submenu,i=this.element.find(this.options.menus);this._toggleClass("ui-menu-icons",null,!!this.element.find(".ui-icon").length),e=i.filter(":not(.ui-menu)").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=V(this),e=t.prev(),i=V("<span>").data("ui-menu-submenu-caret",!0);s._addClass(i,"ui-menu-icon","ui-icon "+n),e.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",e.attr("id"))}),this._addClass(e,"ui-menu","ui-widget ui-widget-content ui-front"),(t=i.add(this.element).find(this.options.items)).not(".ui-menu-item").each(function(){var t=V(this);s._isDivider(t)&&s._addClass(t,"ui-menu-divider","ui-widget-content")}),i=(e=t.not(".ui-menu-item, .ui-menu-divider")).children().not(".ui-menu").uniqueId().attr({tabIndex:-1,role:this._itemRole()}),this._addClass(e,"ui-menu-item")._addClass(i,"ui-menu-item-wrapper"),t.filter(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!V.contains(this.element[0],this.active[0])&&this.blur()},_itemRole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},_setOption:function(t,e){var i;"icons"===t&&(i=this.element.find(".ui-menu-icon"),this._removeClass(i,null,this.options.icons.submenu)._addClass(i,null,e.submenu)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",String(t)),this._toggleClass(null,"ui-state-disabled",!!t)},focus:function(t,e){var i;this.blur(t,t&&"focus"===t.type),this._scrollIntoView(e),this.active=e.first(),i=this.active.children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),this.options.role&&this.element.attr("aria-activedescendant",i.attr("id")),i=this.active.parent().closest(".ui-menu-item").children(".ui-menu-item-wrapper"),this._addClass(i,null,"ui-state-active"),t&&"keydown"===t.type?this._close():this.timer=this._delay(function(){this._close()},this.delay),(i=e.children(".ui-menu")).length&&t&&/^mouse/.test(t.type)&&this._startOpening(i),this.activeMenu=e.parent(),this._trigger("focus",t,{item:e})},_scrollIntoView:function(t){var e,i,s;this._hasScroll()&&(i=parseFloat(V.css(this.activeMenu[0],"borderTopWidth"))||0,s=parseFloat(V.css(this.activeMenu[0],"paddingTop"))||0,e=t.offset().top-this.activeMenu.offset().top-i-s,i=this.activeMenu.scrollTop(),s=this.activeMenu.height(),t=t.outerHeight(),e<0?this.activeMenu.scrollTop(i+e):s<e+t&&this.activeMenu.scrollTop(i+e-s+t))},blur:function(t,e){e||clearTimeout(this.timer),this.active&&(this._removeClass(this.active.children(".ui-menu-item-wrapper"),null,"ui-state-active"),this._trigger("blur",t,{item:this.active}),this.active=null)},_startOpening:function(t){clearTimeout(this.timer),"true"===t.attr("aria-hidden")&&(this.timer=this._delay(function(){this._close(),this._open(t)},this.delay))},_open:function(t){var e=V.extend({of:this.active},this.options.position);clearTimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeAttr("aria-hidden").attr("aria-expanded","true").position(e)},collapseAll:function(e,i){clearTimeout(this.timer),this.timer=this._delay(function(){var t=i?this.element:V(e&&e.target).closest(this.element.find(".ui-menu"));t.length||(t=this.element),this._close(t),this.blur(e),this._removeClass(t.find(".ui-state-active"),null,"ui-state-active"),this.activeMenu=t},i?0:this.delay)},_close:function(t){(t=t||(this.active?this.active.parent():this.element)).find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false")},_closeOnDocumentClick:function(t){return!V(t.target).closest(".ui-menu").length},_isDivider:function(t){return!/[^\-\u2014\u2013\s]/.test(t.text())},collapse:function(t){var e=this.active&&this.active.parent().closest(".ui-menu-item",this.element);e&&e.length&&(this._close(),this.focus(t,e))},expand:function(t){var e=this.active&&this._menuItems(this.active.children(".ui-menu")).first();e&&e.length&&(this._open(e.parent()),this._delay(function(){this.focus(t,e)}))},next:function(t){this._move("next","first",t)},previous:function(t){this._move("prev","last",t)},isFirstItem:function(){return this.active&&!this.active.prevAll(".ui-menu-item").length},isLastItem:function(){return this.active&&!this.active.nextAll(".ui-menu-item").length},_menuItems:function(t){return(t||this.element).find(this.options.items).filter(".ui-menu-item")},_move:function(t,e,i){var s;(s=this.active?"first"===t||"last"===t?this.active["first"===t?"prevAll":"nextAll"](".ui-menu-item").last():this.active[t+"All"](".ui-menu-item").first():s)&&s.length&&this.active||(s=this._menuItems(this.activeMenu)[e]()),this.focus(i,s)},nextPage:function(t){var e,i,s;this.active?this.isLastItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.nextAll(".ui-menu-item").each(function(){return(e=V(this)).offset().top-i-s<0}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu)[this.active?"last":"first"]())):this.next(t)},previousPage:function(t){var e,i,s;this.active?this.isFirstItem()||(this._hasScroll()?(i=this.active.offset().top,s=this.element.innerHeight(),0===V.fn.jquery.indexOf("3.2.")&&(s+=this.element[0].offsetHeight-this.element.outerHeight()),this.active.prevAll(".ui-menu-item").each(function(){return 0<(e=V(this)).offset().top-i+s}),this.focus(t,e)):this.focus(t,this._menuItems(this.activeMenu).first())):this.next(t)},_hasScroll:function(){return this.element.outerHeight()<this.element.prop("scrollHeight")},select:function(t){this.active=this.active||V(t.target).closest(".ui-menu-item");var e={item:this.active};this.active.has(".ui-menu").length||this.collapseAll(t,!0),this._trigger("select",t,e)},_filterMenuItems:function(t){var t=t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&"),e=new RegExp("^"+t,"i");return this.activeMenu.find(this.options.items).filter(".ui-menu-item").filter(function(){return e.test(String.prototype.trim.call(V(this).children(".ui-menu-item-wrapper").text()))})}});V.widget("ui.autocomplete",{version:"1.13.2",defaultElement:"<input>",options:{appendTo:null,autoFocus:!1,delay:300,minLength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},requestIndex:0,pending:0,liveRegionTimer:null,_create:function(){var i,s,n,t=this.element[0].nodeName.toLowerCase(),e="textarea"===t,t="input"===t;this.isMultiLine=e||!t&&this._isContentEditable(this.element),this.valueMethod=this.element[e||t?"val":"text"],this.isNewMenu=!0,this._addClass("ui-autocomplete-input"),this.element.attr("autocomplete","off"),this._on(this.element,{keydown:function(t){if(this.element.prop("readOnly"))s=n=i=!0;else{s=n=i=!1;var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:i=!0,this._move("previousPage",t);break;case e.PAGE_DOWN:i=!0,this._move("nextPage",t);break;case e.UP:i=!0,this._keyEvent("previous",t);break;case e.DOWN:i=!0,this._keyEvent("next",t);break;case e.ENTER:this.menu.active&&(i=!0,t.preventDefault(),this.menu.select(t));break;case e.TAB:this.menu.active&&this.menu.select(t);break;case e.ESCAPE:this.menu.element.is(":visible")&&(this.isMultiLine||this._value(this.term),this.close(t),t.preventDefault());break;default:s=!0,this._searchTimeout(t)}}},keypress:function(t){if(i)return i=!1,void(this.isMultiLine&&!this.menu.element.is(":visible")||t.preventDefault());if(!s){var e=V.ui.keyCode;switch(t.keyCode){case e.PAGE_UP:this._move("previousPage",t);break;case e.PAGE_DOWN:this._move("nextPage",t);break;case e.UP:this._keyEvent("previous",t);break;case e.DOWN:this._keyEvent("next",t)}}},input:function(t){if(n)return n=!1,void t.preventDefault();this._searchTimeout(t)},focus:function(){this.selectedItem=null,this.previous=this._value()},blur:function(t){clearTimeout(this.searching),this.close(t),this._change(t)}}),this._initSource(),this.menu=V("<ul>").appendTo(this._appendTo()).menu({role:null}).hide().attr({unselectable:"on"}).menu("instance"),this._addClass(this.menu.element,"ui-autocomplete","ui-front"),this._on(this.menu.element,{mousedown:function(t){t.preventDefault()},menufocus:function(t,e){var i,s;if(this.isNewMenu&&(this.isNewMenu=!1,t.originalEvent&&/^mouse/.test(t.originalEvent.type)))return this.menu.blur(),void this.document.one("mousemove",function(){V(t.target).trigger(t.originalEvent)});s=e.item.data("ui-autocomplete-item"),!1!==this._trigger("focus",t,{item:s})&&t.originalEvent&&/^key/.test(t.originalEvent.type)&&this._value(s.value),(i=e.item.attr("aria-label")||s.value)&&String.prototype.trim.call(i).length&&(clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(V("<div>").text(i))},100))},menuselect:function(t,e){var i=e.item.data("ui-autocomplete-item"),s=this.previous;this.element[0]!==V.ui.safeActiveElement(this.document[0])&&(this.element.trigger("focus"),this.previous=s,this._delay(function(){this.previous=s,this.selectedItem=i})),!1!==this._trigger("select",t,{item:i})&&this._value(i.value),this.term=this._value(),this.close(t),this.selectedItem=i}}),this.liveRegion=V("<div>",{role:"status","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_destroy:function(){clearTimeout(this.searching),this.element.removeAttr("autocomplete"),this.menu.element.remove(),this.liveRegion.remove()},_setOption:function(t,e){this._super(t,e),"source"===t&&this._initSource(),"appendTo"===t&&this.menu.element.appendTo(this._appendTo()),"disabled"===t&&e&&this.xhr&&this.xhr.abort()},_isEventTargetInWidget:function(t){var e=this.menu.element[0];return t.target===this.element[0]||t.target===e||V.contains(e,t.target)},_closeOnClickOutside:function(t){this._isEventTargetInWidget(t)||this.close()},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_initSource:function(){var i,s,n=this;Array.isArray(this.options.source)?(i=this.options.source,this.source=function(t,e){e(V.ui.autocomplete.filter(i,t.term))}):"string"==typeof this.options.source?(s=this.options.source,this.source=function(t,e){n.xhr&&n.xhr.abort(),n.xhr=V.ajax({url:s,data:t,dataType:"json",success:function(t){e(t)},error:function(){e([])}})}):this.source=this.options.source},_searchTimeout:function(s){clearTimeout(this.searching),this.searching=this._delay(function(){var t=this.term===this._value(),e=this.menu.element.is(":visible"),i=s.altKey||s.ctrlKey||s.metaKey||s.shiftKey;t&&(e||i)||(this.selectedItem=null,this.search(null,s))},this.options.delay)},search:function(t,e){return t=null!=t?t:this._value(),this.term=this._value(),t.length<this.options.minLength?this.close(e):!1!==this._trigger("search",e)?this._search(t):void 0},_search:function(t){this.pending++,this._addClass("ui-autocomplete-loading"),this.cancelSearch=!1,this.source({term:t},this._response())},_response:function(){var e=++this.requestIndex;return function(t){e===this.requestIndex&&this.__response(t),this.pending--,this.pending||this._removeClass("ui-autocomplete-loading")}.bind(this)},__response:function(t){t=t&&this._normalize(t),this._trigger("response",null,{content:t}),!this.options.disabled&&t&&t.length&&!this.cancelSearch?(this._suggest(t),this._trigger("open")):this._close()},close:function(t){this.cancelSearch=!0,this._close(t)},_close:function(t){this._off(this.document,"mousedown"),this.menu.element.is(":visible")&&(this.menu.element.hide(),this.menu.blur(),this.isNewMenu=!0,this._trigger("close",t))},_change:function(t){this.previous!==this._value()&&this._trigger("change",t,{item:this.selectedItem})},_normalize:function(t){return t.length&&t[0].label&&t[0].value?t:V.map(t,function(t){return"string"==typeof t?{label:t,value:t}:V.extend({},t,{label:t.label||t.value,value:t.value||t.label})})},_suggest:function(t){var e=this.menu.element.empty();this._renderMenu(e,t),this.isNewMenu=!0,this.menu.refresh(),e.show(),this._resizeMenu(),e.position(V.extend({of:this.element},this.options.position)),this.options.autoFocus&&this.menu.next(),this._on(this.document,{mousedown:"_closeOnClickOutside"})},_resizeMenu:function(){var t=this.menu.element;t.outerWidth(Math.max(t.width("").outerWidth()+1,this.element.outerWidth()))},_renderMenu:function(i,t){var s=this;V.each(t,function(t,e){s._renderItemData(i,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-autocomplete-item",e)},_renderItem:function(t,e){return V("<li>").append(V("<div>").text(e.label)).appendTo(t)},_move:function(t,e){if(this.menu.element.is(":visible"))return this.menu.isFirstItem()&&/^previous/.test(t)||this.menu.isLastItem()&&/^next/.test(t)?(this.isMultiLine||this._value(this.term),void this.menu.blur()):void this.menu[t](e);this.search(null,e)},widget:function(){return this.menu.element},_value:function(){return this.valueMethod.apply(this.element,arguments)},_keyEvent:function(t,e){this.isMultiLine&&!this.menu.element.is(":visible")||(this._move(t,e),e.preventDefault())},_isContentEditable:function(t){if(!t.length)return!1;var e=t.prop("contentEditable");return"inherit"===e?this._isContentEditable(t.parent()):"true"===e}}),V.extend(V.ui.autocomplete,{escapeRegex:function(t){return t.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,e){var i=new RegExp(V.ui.autocomplete.escapeRegex(e),"i");return V.grep(t,function(t){return i.test(t.label||t.value||t)})}}),V.widget("ui.autocomplete",V.ui.autocomplete,{options:{messages:{noResults:"No search results.",results:function(t){return t+(1<t?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(t){var e;this._superApply(arguments),this.options.disabled||this.cancelSearch||(e=t&&t.length?this.options.messages.results(t.length):this.options.messages.noResults,clearTimeout(this.liveRegionTimer),this.liveRegionTimer=this._delay(function(){this.liveRegion.html(V("<div>").text(e))},100))}});V.ui.autocomplete;var tt=/ui-corner-([a-z]){2,6}/g;V.widget("ui.controlgroup",{version:"1.13.2",defaultElement:"<div>",options:{direction:"horizontal",disabled:null,onlyVisible:!0,items:{button:"input[type=button], input[type=submit], input[type=reset], button, a",controlgroupLabel:".ui-controlgroup-label",checkboxradio:"input[type='checkbox'], input[type='radio']",selectmenu:"select",spinner:".ui-spinner-input"}},_create:function(){this._enhance()},_enhance:function(){this.element.attr("role","toolbar"),this.refresh()},_destroy:function(){this._callChildMethod("destroy"),this.childWidgets.removeData("ui-controlgroup-data"),this.element.removeAttr("role"),this.options.items.controlgroupLabel&&this.element.find(this.options.items.controlgroupLabel).find(".ui-controlgroup-label-contents").contents().unwrap()},_initWidgets:function(){var o=this,a=[];V.each(this.options.items,function(s,t){var e,n={};if(t)return"controlgroupLabel"===s?((e=o.element.find(t)).each(function(){var t=V(this);t.children(".ui-controlgroup-label-contents").length||t.contents().wrapAll("<span class='ui-controlgroup-label-contents'></span>")}),o._addClass(e,null,"ui-widget ui-widget-content ui-state-default"),void(a=a.concat(e.get()))):void(V.fn[s]&&(n=o["_"+s+"Options"]?o["_"+s+"Options"]("middle"):{classes:{}},o.element.find(t).each(function(){var t=V(this),e=t[s]("instance"),i=V.widget.extend({},n);"button"===s&&t.parent(".ui-spinner").length||((e=e||t[s]()[s]("instance"))&&(i.classes=o._resolveClassesValues(i.classes,e)),t[s](i),i=t[s]("widget"),V.data(i[0],"ui-controlgroup-data",e||t[s]("instance")),a.push(i[0]))})))}),this.childWidgets=V(V.uniqueSort(a)),this._addClass(this.childWidgets,"ui-controlgroup-item")},_callChildMethod:function(e){this.childWidgets.each(function(){var t=V(this).data("ui-controlgroup-data");t&&t[e]&&t[e]()})},_updateCornerClass:function(t,e){e=this._buildSimpleOptions(e,"label").classes.label;this._removeClass(t,null,"ui-corner-top ui-corner-bottom ui-corner-left ui-corner-right ui-corner-all"),this._addClass(t,null,e)},_buildSimpleOptions:function(t,e){var i="vertical"===this.options.direction,s={classes:{}};return s.classes[e]={middle:"",first:"ui-corner-"+(i?"top":"left"),last:"ui-corner-"+(i?"bottom":"right"),only:"ui-corner-all"}[t],s},_spinnerOptions:function(t){t=this._buildSimpleOptions(t,"ui-spinner");return t.classes["ui-spinner-up"]="",t.classes["ui-spinner-down"]="",t},_buttonOptions:function(t){return this._buildSimpleOptions(t,"ui-button")},_checkboxradioOptions:function(t){return this._buildSimpleOptions(t,"ui-checkboxradio-label")},_selectmenuOptions:function(t){var e="vertical"===this.options.direction;return{width:e&&"auto",classes:{middle:{"ui-selectmenu-button-open":"","ui-selectmenu-button-closed":""},first:{"ui-selectmenu-button-open":"ui-corner-"+(e?"top":"tl"),"ui-selectmenu-button-closed":"ui-corner-"+(e?"top":"left")},last:{"ui-selectmenu-button-open":e?"":"ui-corner-tr","ui-selectmenu-button-closed":"ui-corner-"+(e?"bottom":"right")},only:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"}}[t]}},_resolveClassesValues:function(i,s){var n={};return V.each(i,function(t){var e=s.options.classes[t]||"",e=String.prototype.trim.call(e.replace(tt,""));n[t]=(e+" "+i[t]).replace(/\s+/g," ")}),n},_setOption:function(t,e){"direction"===t&&this._removeClass("ui-controlgroup-"+this.options.direction),this._super(t,e),"disabled"!==t?this.refresh():this._callChildMethod(e?"disable":"enable")},refresh:function(){var n,o=this;this._addClass("ui-controlgroup ui-controlgroup-"+this.options.direction),"horizontal"===this.options.direction&&this._addClass(null,"ui-helper-clearfix"),this._initWidgets(),n=this.childWidgets,(n=this.options.onlyVisible?n.filter(":visible"):n).length&&(V.each(["first","last"],function(t,e){var i,s=n[e]().data("ui-controlgroup-data");s&&o["_"+s.widgetName+"Options"]?((i=o["_"+s.widgetName+"Options"](1===n.length?"only":e)).classes=o._resolveClassesValues(i.classes,s),s.element[s.widgetName](i)):o._updateCornerClass(n[e](),e)}),this._callChildMethod("refresh"))}});V.widget("ui.checkboxradio",[V.ui.formResetMixin,{version:"1.13.2",options:{disabled:null,label:null,icon:!0,classes:{"ui-checkboxradio-label":"ui-corner-all","ui-checkboxradio-icon":"ui-corner-all"}},_getCreateOptions:function(){var t,e=this._super()||{};return this._readType(),t=this.element.labels(),this.label=V(t[t.length-1]),this.label.length||V.error("No label found for checkboxradio widget"),this.originalLabel="",(t=this.label.contents().not(this.element[0])).length&&(this.originalLabel+=t.clone().wrapAll("<div></div>").parent().html()),this.originalLabel&&(e.label=this.originalLabel),null!=(t=this.element[0].disabled)&&(e.disabled=t),e},_create:function(){var t=this.element[0].checked;this._bindFormResetHandler(),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled),this._setOption("disabled",this.options.disabled),this._addClass("ui-checkboxradio","ui-helper-hidden-accessible"),this._addClass(this.label,"ui-checkboxradio-label","ui-button ui-widget"),"radio"===this.type&&this._addClass(this.label,"ui-checkboxradio-radio-label"),this.options.label&&this.options.label!==this.originalLabel?this._updateLabel():this.originalLabel&&(this.options.label=this.originalLabel),this._enhance(),t&&this._addClass(this.label,"ui-checkboxradio-checked","ui-state-active"),this._on({change:"_toggleClasses",focus:function(){this._addClass(this.label,null,"ui-state-focus ui-visual-focus")},blur:function(){this._removeClass(this.label,null,"ui-state-focus ui-visual-focus")}})},_readType:function(){var t=this.element[0].nodeName.toLowerCase();this.type=this.element[0].type,"input"===t&&/radio|checkbox/.test(this.type)||V.error("Can't create checkboxradio on element.nodeName="+t+" and element.type="+this.type)},_enhance:function(){this._updateIcon(this.element[0].checked)},widget:function(){return this.label},_getRadioGroup:function(){var t=this.element[0].name,e="input[name='"+V.escapeSelector(t)+"']";return t?(this.form.length?V(this.form[0].elements).filter(e):V(e).filter(function(){return 0===V(this)._form().length})).not(this.element):V([])},_toggleClasses:function(){var t=this.element[0].checked;this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),this.options.icon&&"checkbox"===this.type&&this._toggleClass(this.icon,null,"ui-icon-check ui-state-checked",t)._toggleClass(this.icon,null,"ui-icon-blank",!t),"radio"===this.type&&this._getRadioGroup().each(function(){var t=V(this).checkboxradio("instance");t&&t._removeClass(t.label,"ui-checkboxradio-checked","ui-state-active")})},_destroy:function(){this._unbindFormResetHandler(),this.icon&&(this.icon.remove(),this.iconSpace.remove())},_setOption:function(t,e){if("label"!==t||e){if(this._super(t,e),"disabled"===t)return this._toggleClass(this.label,null,"ui-state-disabled",e),void(this.element[0].disabled=e);this.refresh()}},_updateIcon:function(t){var e="ui-icon ui-icon-background ";this.options.icon?(this.icon||(this.icon=V("<span>"),this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-checkboxradio-icon-space")),"checkbox"===this.type?(e+=t?"ui-icon-check ui-state-checked":"ui-icon-blank",this._removeClass(this.icon,null,t?"ui-icon-blank":"ui-icon-check")):e+="ui-icon-blank",this._addClass(this.icon,"ui-checkboxradio-icon",e),t||this._removeClass(this.icon,null,"ui-icon-check ui-state-checked"),this.icon.prependTo(this.label).after(this.iconSpace)):void 0!==this.icon&&(this.icon.remove(),this.iconSpace.remove(),delete this.icon)},_updateLabel:function(){var t=this.label.contents().not(this.element[0]);this.icon&&(t=t.not(this.icon[0])),(t=this.iconSpace?t.not(this.iconSpace[0]):t).remove(),this.label.append(this.options.label)},refresh:function(){var t=this.element[0].checked,e=this.element[0].disabled;this._updateIcon(t),this._toggleClass(this.label,"ui-checkboxradio-checked","ui-state-active",t),null!==this.options.label&&this._updateLabel(),e!==this.options.disabled&&this._setOptions({disabled:e})}}]);var et;V.ui.checkboxradio;V.widget("ui.button",{version:"1.13.2",defaultElement:"<button>",options:{classes:{"ui-button":"ui-corner-all"},disabled:null,icon:null,iconPosition:"beginning",label:null,showLabel:!0},_getCreateOptions:function(){var t,e=this._super()||{};return this.isInput=this.element.is("input"),null!=(t=this.element[0].disabled)&&(e.disabled=t),this.originalLabel=this.isInput?this.element.val():this.element.html(),this.originalLabel&&(e.label=this.originalLabel),e},_create:function(){!this.option.showLabel&!this.options.icon&&(this.options.showLabel=!0),null==this.options.disabled&&(this.options.disabled=this.element[0].disabled||!1),this.hasTitle=!!this.element.attr("title"),this.options.label&&this.options.label!==this.originalLabel&&(this.isInput?this.element.val(this.options.label):this.element.html(this.options.label)),this._addClass("ui-button","ui-widget"),this._setOption("disabled",this.options.disabled),this._enhance(),this.element.is("a")&&this._on({keyup:function(t){t.keyCode===V.ui.keyCode.SPACE&&(t.preventDefault(),this.element[0].click?this.element[0].click():this.element.trigger("click"))}})},_enhance:function(){this.element.is("button")||this.element.attr("role","button"),this.options.icon&&(this._updateIcon("icon",this.options.icon),this._updateTooltip())},_updateTooltip:function(){this.title=this.element.attr("title"),this.options.showLabel||this.title||this.element.attr("title",this.options.label)},_updateIcon:function(t,e){var i="iconPosition"!==t,s=i?this.options.iconPosition:e,t="top"===s||"bottom"===s;this.icon?i&&this._removeClass(this.icon,null,this.options.icon):(this.icon=V("<span>"),this._addClass(this.icon,"ui-button-icon","ui-icon"),this.options.showLabel||this._addClass("ui-button-icon-only")),i&&this._addClass(this.icon,null,e),this._attachIcon(s),t?(this._addClass(this.icon,null,"ui-widget-icon-block"),this.iconSpace&&this.iconSpace.remove()):(this.iconSpace||(this.iconSpace=V("<span> </span>"),this._addClass(this.iconSpace,"ui-button-icon-space")),this._removeClass(this.icon,null,"ui-wiget-icon-block"),this._attachIconSpace(s))},_destroy:function(){this.element.removeAttr("role"),this.icon&&this.icon.remove(),this.iconSpace&&this.iconSpace.remove(),this.hasTitle||this.element.removeAttr("title")},_attachIconSpace:function(t){this.icon[/^(?:end|bottom)/.test(t)?"before":"after"](this.iconSpace)},_attachIcon:function(t){this.element[/^(?:end|bottom)/.test(t)?"append":"prepend"](this.icon)},_setOptions:function(t){var e=(void 0===t.showLabel?this.options:t).showLabel,i=(void 0===t.icon?this.options:t).icon;e||i||(t.showLabel=!0),this._super(t)},_setOption:function(t,e){"icon"===t&&(e?this._updateIcon(t,e):this.icon&&(this.icon.remove(),this.iconSpace&&this.iconSpace.remove())),"iconPosition"===t&&this._updateIcon(t,e),"showLabel"===t&&(this._toggleClass("ui-button-icon-only",null,!e),this._updateTooltip()),"label"===t&&(this.isInput?this.element.val(e):(this.element.html(e),this.icon&&(this._attachIcon(this.options.iconPosition),this._attachIconSpace(this.options.iconPosition)))),this._super(t,e),"disabled"===t&&(this._toggleClass(null,"ui-state-disabled",e),(this.element[0].disabled=e)&&this.element.trigger("blur"))},refresh:function(){var t=this.element.is("input, button")?this.element[0].disabled:this.element.hasClass("ui-button-disabled");t!==this.options.disabled&&this._setOptions({disabled:t}),this._updateTooltip()}}),!1!==V.uiBackCompat&&(V.widget("ui.button",V.ui.button,{options:{text:!0,icons:{primary:null,secondary:null}},_create:function(){this.options.showLabel&&!this.options.text&&(this.options.showLabel=this.options.text),!this.options.showLabel&&this.options.text&&(this.options.text=this.options.showLabel),this.options.icon||!this.options.icons.primary&&!this.options.icons.secondary?this.options.icon&&(this.options.icons.primary=this.options.icon):this.options.icons.primary?this.options.icon=this.options.icons.primary:(this.options.icon=this.options.icons.secondary,this.options.iconPosition="end"),this._super()},_setOption:function(t,e){"text"!==t?("showLabel"===t&&(this.options.text=e),"icon"===t&&(this.options.icons.primary=e),"icons"===t&&(e.primary?(this._super("icon",e.primary),this._super("iconPosition","beginning")):e.secondary&&(this._super("icon",e.secondary),this._super("iconPosition","end"))),this._superApply(arguments)):this._super("showLabel",e)}}),V.fn.button=(et=V.fn.button,function(i){var t="string"==typeof i,s=Array.prototype.slice.call(arguments,1),n=this;return t?this.length||"instance"!==i?this.each(function(){var t=V(this).attr("type"),e=V.data(this,"ui-"+("checkbox"!==t&&"radio"!==t?"button":"checkboxradio"));return"instance"===i?(n=e,!1):e?"function"!=typeof e[i]||"_"===i.charAt(0)?V.error("no such method '"+i+"' for button widget instance"):(t=e[i].apply(e,s))!==e&&void 0!==t?(n=t&&t.jquery?n.pushStack(t.get()):t,!1):void 0:V.error("cannot call methods on button prior to initialization; attempted to call method '"+i+"'")}):n=void 0:(s.length&&(i=V.widget.extend.apply(null,[i].concat(s))),this.each(function(){var t=V(this).attr("type"),e="checkbox"!==t&&"radio"!==t?"button":"checkboxradio",t=V.data(this,"ui-"+e);t?(t.option(i||{}),t._init&&t._init()):"button"!=e?V(this).checkboxradio(V.extend({icon:!1},i)):et.call(V(this),i)})),n}),V.fn.buttonset=function(){return V.ui.controlgroup||V.error("Controlgroup widget missing"),"option"===arguments[0]&&"items"===arguments[1]&&arguments[2]?this.controlgroup.apply(this,[arguments[0],"items.button",arguments[2]]):"option"===arguments[0]&&"items"===arguments[1]?this.controlgroup.apply(this,[arguments[0],"items.button"]):("object"==typeof arguments[0]&&arguments[0].items&&(arguments[0].items={button:arguments[0].items}),this.controlgroup.apply(this,arguments))});var it;V.ui.button;function st(){this._curInst=null,this._keyEvent=!1,this._disabledInputs=[],this._datepickerShowing=!1,this._inDialog=!1,this._mainDivId="ui-datepicker-div",this._inlineClass="ui-datepicker-inline",this._appendClass="ui-datepicker-append",this._triggerClass="ui-datepicker-trigger",this._dialogClass="ui-datepicker-dialog",this._disableClass="ui-datepicker-disabled",this._unselectableClass="ui-datepicker-unselectable",this._currentClass="ui-datepicker-current-day",this._dayOverClass="ui-datepicker-days-cell-over",this.regional=[],this.regional[""]={closeText:"Done",prevText:"Prev",nextText:"Next",currentText:"Today",monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],dayNamesMin:["Su","Mo","Tu","We","Th","Fr","Sa"],weekHeader:"Wk",dateFormat:"mm/dd/yy",firstDay:0,isRTL:!1,showMonthAfterYear:!1,yearSuffix:"",selectMonthLabel:"Select month",selectYearLabel:"Select year"},this._defaults={showOn:"focus",showAnim:"fadeIn",showOptions:{},defaultDate:null,appendText:"",buttonText:"...",buttonImage:"",buttonImageOnly:!1,hideIfNoPrevNext:!1,navigationAsDateFormat:!1,gotoCurrent:!1,changeMonth:!1,changeYear:!1,yearRange:"c-10:c+10",showOtherMonths:!1,selectOtherMonths:!1,showWeek:!1,calculateWeek:this.iso8601Week,shortYearCutoff:"+10",minDate:null,maxDate:null,duration:"fast",beforeShowDay:null,beforeShow:null,onSelect:null,onChangeMonthYear:null,onClose:null,onUpdateDatepicker:null,numberOfMonths:1,showCurrentAtPos:0,stepMonths:1,stepBigMonths:12,altField:"",altFormat:"",constrainInput:!0,showButtonPanel:!1,autoSize:!1,disabled:!1},V.extend(this._defaults,this.regional[""]),this.regional.en=V.extend(!0,{},this.regional[""]),this.regional["en-US"]=V.extend(!0,{},this.regional.en),this.dpDiv=nt(V("<div id='"+this._mainDivId+"' class='ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>"))}function nt(t){var e="button, .ui-datepicker-prev, .ui-datepicker-next, .ui-datepicker-calendar td a";return t.on("mouseout",e,function(){V(this).removeClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).removeClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).removeClass("ui-datepicker-next-hover")}).on("mouseover",e,ot)}function ot(){V.datepicker._isDisabledDatepicker((it.inline?it.dpDiv.parent():it.input)[0])||(V(this).parents(".ui-datepicker-calendar").find("a").removeClass("ui-state-hover"),V(this).addClass("ui-state-hover"),-1!==this.className.indexOf("ui-datepicker-prev")&&V(this).addClass("ui-datepicker-prev-hover"),-1!==this.className.indexOf("ui-datepicker-next")&&V(this).addClass("ui-datepicker-next-hover"))}function at(t,e){for(var i in V.extend(t,e),e)null==e[i]&&(t[i]=e[i]);return t}V.extend(V.ui,{datepicker:{version:"1.13.2"}}),V.extend(st.prototype,{markerClassName:"hasDatepicker",maxRows:4,_widgetDatepicker:function(){return this.dpDiv},setDefaults:function(t){return at(this._defaults,t||{}),this},_attachDatepicker:function(t,e){var i,s=t.nodeName.toLowerCase(),n="div"===s||"span"===s;t.id||(this.uuid+=1,t.id="dp"+this.uuid),(i=this._newInst(V(t),n)).settings=V.extend({},e||{}),"input"===s?this._connectDatepicker(t,i):n&&this._inlineDatepicker(t,i)},_newInst:function(t,e){return{id:t[0].id.replace(/([^A-Za-z0-9_\-])/g,"\\\\$1"),input:t,selectedDay:0,selectedMonth:0,selectedYear:0,drawMonth:0,drawYear:0,inline:e,dpDiv:e?nt(V("<div class='"+this._inlineClass+" ui-datepicker ui-widget ui-widget-content ui-helper-clearfix ui-corner-all'></div>")):this.dpDiv}},_connectDatepicker:function(t,e){var i=V(t);e.append=V([]),e.trigger=V([]),i.hasClass(this.markerClassName)||(this._attachments(i,e),i.addClass(this.markerClassName).on("keydown",this._doKeyDown).on("keypress",this._doKeyPress).on("keyup",this._doKeyUp),this._autoSize(e),V.data(t,"datepicker",e),e.settings.disabled&&this._disableDatepicker(t))},_attachments:function(t,e){var i,s=this._get(e,"appendText"),n=this._get(e,"isRTL");e.append&&e.append.remove(),s&&(e.append=V("<span>").addClass(this._appendClass).text(s),t[n?"before":"after"](e.append)),t.off("focus",this._showDatepicker),e.trigger&&e.trigger.remove(),"focus"!==(i=this._get(e,"showOn"))&&"both"!==i||t.on("focus",this._showDatepicker),"button"!==i&&"both"!==i||(s=this._get(e,"buttonText"),i=this._get(e,"buttonImage"),this._get(e,"buttonImageOnly")?e.trigger=V("<img>").addClass(this._triggerClass).attr({src:i,alt:s,title:s}):(e.trigger=V("<button type='button'>").addClass(this._triggerClass),i?e.trigger.html(V("<img>").attr({src:i,alt:s,title:s})):e.trigger.text(s)),t[n?"before":"after"](e.trigger),e.trigger.on("click",function(){return V.datepicker._datepickerShowing&&V.datepicker._lastInput===t[0]?V.datepicker._hideDatepicker():(V.datepicker._datepickerShowing&&V.datepicker._lastInput!==t[0]&&V.datepicker._hideDatepicker(),V.datepicker._showDatepicker(t[0])),!1}))},_autoSize:function(t){var e,i,s,n,o,a;this._get(t,"autoSize")&&!t.inline&&(o=new Date(2009,11,20),(a=this._get(t,"dateFormat")).match(/[DM]/)&&(e=function(t){for(n=s=i=0;n<t.length;n++)t[n].length>i&&(i=t[n].length,s=n);return s},o.setMonth(e(this._get(t,a.match(/MM/)?"monthNames":"monthNamesShort"))),o.setDate(e(this._get(t,a.match(/DD/)?"dayNames":"dayNamesShort"))+20-o.getDay())),t.input.attr("size",this._formatDate(t,o).length))},_inlineDatepicker:function(t,e){var i=V(t);i.hasClass(this.markerClassName)||(i.addClass(this.markerClassName).append(e.dpDiv),V.data(t,"datepicker",e),this._setDate(e,this._getDefaultDate(e),!0),this._updateDatepicker(e),this._updateAlternate(e),e.settings.disabled&&this._disableDatepicker(t),e.dpDiv.css("display","block"))},_dialogDatepicker:function(t,e,i,s,n){var o,a=this._dialogInst;return a||(this.uuid+=1,o="dp"+this.uuid,this._dialogInput=V("<input type='text' id='"+o+"' style='position: absolute; top: -100px; width: 0px;'/>"),this._dialogInput.on("keydown",this._doKeyDown),V("body").append(this._dialogInput),(a=this._dialogInst=this._newInst(this._dialogInput,!1)).settings={},V.data(this._dialogInput[0],"datepicker",a)),at(a.settings,s||{}),e=e&&e.constructor===Date?this._formatDate(a,e):e,this._dialogInput.val(e),this._pos=n?n.length?n:[n.pageX,n.pageY]:null,this._pos||(o=document.documentElement.clientWidth,s=document.documentElement.clientHeight,e=document.documentElement.scrollLeft||document.body.scrollLeft,n=document.documentElement.scrollTop||document.body.scrollTop,this._pos=[o/2-100+e,s/2-150+n]),this._dialogInput.css("left",this._pos[0]+20+"px").css("top",this._pos[1]+"px"),a.settings.onSelect=i,this._inDialog=!0,this.dpDiv.addClass(this._dialogClass),this._showDatepicker(this._dialogInput[0]),V.blockUI&&V.blockUI(this.dpDiv),V.data(this._dialogInput[0],"datepicker",a),this},_destroyDatepicker:function(t){var e,i=V(t),s=V.data(t,"datepicker");i.hasClass(this.markerClassName)&&(e=t.nodeName.toLowerCase(),V.removeData(t,"datepicker"),"input"===e?(s.append.remove(),s.trigger.remove(),i.removeClass(this.markerClassName).off("focus",this._showDatepicker).off("keydown",this._doKeyDown).off("keypress",this._doKeyPress).off("keyup",this._doKeyUp)):"div"!==e&&"span"!==e||i.removeClass(this.markerClassName).empty(),it===s&&(it=null,this._curInst=null))},_enableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!1,s.trigger.filter("button").each(function(){this.disabled=!1}).end().filter("img").css({opacity:"1.0",cursor:""})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().removeClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!1)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}))},_disableDatepicker:function(e){var t,i=V(e),s=V.data(e,"datepicker");i.hasClass(this.markerClassName)&&("input"===(t=e.nodeName.toLowerCase())?(e.disabled=!0,s.trigger.filter("button").each(function(){this.disabled=!0}).end().filter("img").css({opacity:"0.5",cursor:"default"})):"div"!==t&&"span"!==t||((i=i.children("."+this._inlineClass)).children().addClass("ui-state-disabled"),i.find("select.ui-datepicker-month, select.ui-datepicker-year").prop("disabled",!0)),this._disabledInputs=V.map(this._disabledInputs,function(t){return t===e?null:t}),this._disabledInputs[this._disabledInputs.length]=e)},_isDisabledDatepicker:function(t){if(!t)return!1;for(var e=0;e<this._disabledInputs.length;e++)if(this._disabledInputs[e]===t)return!0;return!1},_getInst:function(t){try{return V.data(t,"datepicker")}catch(t){throw"Missing instance data for this datepicker"}},_optionDatepicker:function(t,e,i){var s,n,o=this._getInst(t);if(2===arguments.length&&"string"==typeof e)return"defaults"===e?V.extend({},V.datepicker._defaults):o?"all"===e?V.extend({},o.settings):this._get(o,e):null;s=e||{},"string"==typeof e&&((s={})[e]=i),o&&(this._curInst===o&&this._hideDatepicker(),n=this._getDateDatepicker(t,!0),e=this._getMinMaxDate(o,"min"),i=this._getMinMaxDate(o,"max"),at(o.settings,s),null!==e&&void 0!==s.dateFormat&&void 0===s.minDate&&(o.settings.minDate=this._formatDate(o,e)),null!==i&&void 0!==s.dateFormat&&void 0===s.maxDate&&(o.settings.maxDate=this._formatDate(o,i)),"disabled"in s&&(s.disabled?this._disableDatepicker(t):this._enableDatepicker(t)),this._attachments(V(t),o),this._autoSize(o),this._setDate(o,n),this._updateAlternate(o),this._updateDatepicker(o))},_changeDatepicker:function(t,e,i){this._optionDatepicker(t,e,i)},_refreshDatepicker:function(t){t=this._getInst(t);t&&this._updateDatepicker(t)},_setDateDatepicker:function(t,e){t=this._getInst(t);t&&(this._setDate(t,e),this._updateDatepicker(t),this._updateAlternate(t))},_getDateDatepicker:function(t,e){t=this._getInst(t);return t&&!t.inline&&this._setDateFromField(t,e),t?this._getDate(t):null},_doKeyDown:function(t){var e,i,s=V.datepicker._getInst(t.target),n=!0,o=s.dpDiv.is(".ui-datepicker-rtl");if(s._keyEvent=!0,V.datepicker._datepickerShowing)switch(t.keyCode){case 9:V.datepicker._hideDatepicker(),n=!1;break;case 13:return(i=V("td."+V.datepicker._dayOverClass+":not(."+V.datepicker._currentClass+")",s.dpDiv))[0]&&V.datepicker._selectDay(t.target,s.selectedMonth,s.selectedYear,i[0]),(e=V.datepicker._get(s,"onSelect"))?(i=V.datepicker._formatDate(s),e.apply(s.input?s.input[0]:null,[i,s])):V.datepicker._hideDatepicker(),!1;case 27:V.datepicker._hideDatepicker();break;case 33:V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 34:V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 35:(t.ctrlKey||t.metaKey)&&V.datepicker._clearDate(t.target),n=t.ctrlKey||t.metaKey;break;case 36:(t.ctrlKey||t.metaKey)&&V.datepicker._gotoToday(t.target),n=t.ctrlKey||t.metaKey;break;case 37:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?1:-1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?-V.datepicker._get(s,"stepBigMonths"):-V.datepicker._get(s,"stepMonths"),"M");break;case 38:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,-7,"D"),n=t.ctrlKey||t.metaKey;break;case 39:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,o?-1:1,"D"),n=t.ctrlKey||t.metaKey,t.originalEvent.altKey&&V.datepicker._adjustDate(t.target,t.ctrlKey?+V.datepicker._get(s,"stepBigMonths"):+V.datepicker._get(s,"stepMonths"),"M");break;case 40:(t.ctrlKey||t.metaKey)&&V.datepicker._adjustDate(t.target,7,"D"),n=t.ctrlKey||t.metaKey;break;default:n=!1}else 36===t.keyCode&&t.ctrlKey?V.datepicker._showDatepicker(this):n=!1;n&&(t.preventDefault(),t.stopPropagation())},_doKeyPress:function(t){var e,i=V.datepicker._getInst(t.target);if(V.datepicker._get(i,"constrainInput"))return e=V.datepicker._possibleChars(V.datepicker._get(i,"dateFormat")),i=String.fromCharCode(null==t.charCode?t.keyCode:t.charCode),t.ctrlKey||t.metaKey||i<" "||!e||-1<e.indexOf(i)},_doKeyUp:function(t){t=V.datepicker._getInst(t.target);if(t.input.val()!==t.lastVal)try{V.datepicker.parseDate(V.datepicker._get(t,"dateFormat"),t.input?t.input.val():null,V.datepicker._getFormatConfig(t))&&(V.datepicker._setDateFromField(t),V.datepicker._updateAlternate(t),V.datepicker._updateDatepicker(t))}catch(t){}return!0},_showDatepicker:function(t){var e,i,s,n;"input"!==(t=t.target||t).nodeName.toLowerCase()&&(t=V("input",t.parentNode)[0]),V.datepicker._isDisabledDatepicker(t)||V.datepicker._lastInput===t||(n=V.datepicker._getInst(t),V.datepicker._curInst&&V.datepicker._curInst!==n&&(V.datepicker._curInst.dpDiv.stop(!0,!0),n&&V.datepicker._datepickerShowing&&V.datepicker._hideDatepicker(V.datepicker._curInst.input[0])),!1!==(i=(s=V.datepicker._get(n,"beforeShow"))?s.apply(t,[t,n]):{})&&(at(n.settings,i),n.lastVal=null,V.datepicker._lastInput=t,V.datepicker._setDateFromField(n),V.datepicker._inDialog&&(t.value=""),V.datepicker._pos||(V.datepicker._pos=V.datepicker._findPos(t),V.datepicker._pos[1]+=t.offsetHeight),e=!1,V(t).parents().each(function(){return!(e|="fixed"===V(this).css("position"))}),s={left:V.datepicker._pos[0],top:V.datepicker._pos[1]},V.datepicker._pos=null,n.dpDiv.empty(),n.dpDiv.css({position:"absolute",display:"block",top:"-1000px"}),V.datepicker._updateDatepicker(n),s=V.datepicker._checkOffset(n,s,e),n.dpDiv.css({position:V.datepicker._inDialog&&V.blockUI?"static":e?"fixed":"absolute",display:"none",left:s.left+"px",top:s.top+"px"}),n.inline||(i=V.datepicker._get(n,"showAnim"),s=V.datepicker._get(n,"duration"),n.dpDiv.css("z-index",function(t){for(var e,i;t.length&&t[0]!==document;){if(("absolute"===(e=t.css("position"))||"relative"===e||"fixed"===e)&&(i=parseInt(t.css("zIndex"),10),!isNaN(i)&&0!==i))return i;t=t.parent()}return 0}(V(t))+1),V.datepicker._datepickerShowing=!0,V.effects&&V.effects.effect[i]?n.dpDiv.show(i,V.datepicker._get(n,"showOptions"),s):n.dpDiv[i||"show"](i?s:null),V.datepicker._shouldFocusInput(n)&&n.input.trigger("focus"),V.datepicker._curInst=n)))},_updateDatepicker:function(t){this.maxRows=4,(it=t).dpDiv.empty().append(this._generateHTML(t)),this._attachHandlers(t);var e,i=this._getNumberOfMonths(t),s=i[1],n=t.dpDiv.find("."+this._dayOverClass+" a"),o=V.datepicker._get(t,"onUpdateDatepicker");0<n.length&&ot.apply(n.get(0)),t.dpDiv.removeClass("ui-datepicker-multi-2 ui-datepicker-multi-3 ui-datepicker-multi-4").width(""),1<s&&t.dpDiv.addClass("ui-datepicker-multi-"+s).css("width",17*s+"em"),t.dpDiv[(1!==i[0]||1!==i[1]?"add":"remove")+"Class"]("ui-datepicker-multi"),t.dpDiv[(this._get(t,"isRTL")?"add":"remove")+"Class"]("ui-datepicker-rtl"),t===V.datepicker._curInst&&V.datepicker._datepickerShowing&&V.datepicker._shouldFocusInput(t)&&t.input.trigger("focus"),t.yearshtml&&(e=t.yearshtml,setTimeout(function(){e===t.yearshtml&&t.yearshtml&&t.dpDiv.find("select.ui-datepicker-year").first().replaceWith(t.yearshtml),e=t.yearshtml=null},0)),o&&o.apply(t.input?t.input[0]:null,[t])},_shouldFocusInput:function(t){return t.input&&t.input.is(":visible")&&!t.input.is(":disabled")&&!t.input.is(":focus")},_checkOffset:function(t,e,i){var s=t.dpDiv.outerWidth(),n=t.dpDiv.outerHeight(),o=t.input?t.input.outerWidth():0,a=t.input?t.input.outerHeight():0,r=document.documentElement.clientWidth+(i?0:V(document).scrollLeft()),l=document.documentElement.clientHeight+(i?0:V(document).scrollTop());return e.left-=this._get(t,"isRTL")?s-o:0,e.left-=i&&e.left===t.input.offset().left?V(document).scrollLeft():0,e.top-=i&&e.top===t.input.offset().top+a?V(document).scrollTop():0,e.left-=Math.min(e.left,e.left+s>r&&s<r?Math.abs(e.left+s-r):0),e.top-=Math.min(e.top,e.top+n>l&&n<l?Math.abs(n+a):0),e},_findPos:function(t){for(var e=this._getInst(t),i=this._get(e,"isRTL");t&&("hidden"===t.type||1!==t.nodeType||V.expr.pseudos.hidden(t));)t=t[i?"previousSibling":"nextSibling"];return[(e=V(t).offset()).left,e.top]},_hideDatepicker:function(t){var e,i,s=this._curInst;!s||t&&s!==V.data(t,"datepicker")||this._datepickerShowing&&(e=this._get(s,"showAnim"),i=this._get(s,"duration"),t=function(){V.datepicker._tidyDialog(s)},V.effects&&(V.effects.effect[e]||V.effects[e])?s.dpDiv.hide(e,V.datepicker._get(s,"showOptions"),i,t):s.dpDiv["slideDown"===e?"slideUp":"fadeIn"===e?"fadeOut":"hide"](e?i:null,t),e||t(),this._datepickerShowing=!1,(t=this._get(s,"onClose"))&&t.apply(s.input?s.input[0]:null,[s.input?s.input.val():"",s]),this._lastInput=null,this._inDialog&&(this._dialogInput.css({position:"absolute",left:"0",top:"-100px"}),V.blockUI&&(V.unblockUI(),V("body").append(this.dpDiv))),this._inDialog=!1)},_tidyDialog:function(t){t.dpDiv.removeClass(this._dialogClass).off(".ui-datepicker-calendar")},_checkExternalClick:function(t){var e;V.datepicker._curInst&&(e=V(t.target),t=V.datepicker._getInst(e[0]),(e[0].id===V.datepicker._mainDivId||0!==e.parents("#"+V.datepicker._mainDivId).length||e.hasClass(V.datepicker.markerClassName)||e.closest("."+V.datepicker._triggerClass).length||!V.datepicker._datepickerShowing||V.datepicker._inDialog&&V.blockUI)&&(!e.hasClass(V.datepicker.markerClassName)||V.datepicker._curInst===t)||V.datepicker._hideDatepicker())},_adjustDate:function(t,e,i){var s=V(t),t=this._getInst(s[0]);this._isDisabledDatepicker(s[0])||(this._adjustInstDate(t,e,i),this._updateDatepicker(t))},_gotoToday:function(t){var e=V(t),i=this._getInst(e[0]);this._get(i,"gotoCurrent")&&i.currentDay?(i.selectedDay=i.currentDay,i.drawMonth=i.selectedMonth=i.currentMonth,i.drawYear=i.selectedYear=i.currentYear):(t=new Date,i.selectedDay=t.getDate(),i.drawMonth=i.selectedMonth=t.getMonth(),i.drawYear=i.selectedYear=t.getFullYear()),this._notifyChange(i),this._adjustDate(e)},_selectMonthYear:function(t,e,i){var s=V(t),t=this._getInst(s[0]);t["selected"+("M"===i?"Month":"Year")]=t["draw"+("M"===i?"Month":"Year")]=parseInt(e.options[e.selectedIndex].value,10),this._notifyChange(t),this._adjustDate(s)},_selectDay:function(t,e,i,s){var n=V(t);V(s).hasClass(this._unselectableClass)||this._isDisabledDatepicker(n[0])||((n=this._getInst(n[0])).selectedDay=n.currentDay=parseInt(V("a",s).attr("data-date")),n.selectedMonth=n.currentMonth=e,n.selectedYear=n.currentYear=i,this._selectDate(t,this._formatDate(n,n.currentDay,n.currentMonth,n.currentYear)))},_clearDate:function(t){t=V(t);this._selectDate(t,"")},_selectDate:function(t,e){var i=V(t),t=this._getInst(i[0]);e=null!=e?e:this._formatDate(t),t.input&&t.input.val(e),this._updateAlternate(t),(i=this._get(t,"onSelect"))?i.apply(t.input?t.input[0]:null,[e,t]):t.input&&t.input.trigger("change"),t.inline?this._updateDatepicker(t):(this._hideDatepicker(),this._lastInput=t.input[0],"object"!=typeof t.input[0]&&t.input.trigger("focus"),this._lastInput=null)},_updateAlternate:function(t){var e,i,s=this._get(t,"altField");s&&(e=this._get(t,"altFormat")||this._get(t,"dateFormat"),i=this._getDate(t),t=this.formatDate(e,i,this._getFormatConfig(t)),V(document).find(s).val(t))},noWeekends:function(t){t=t.getDay();return[0<t&&t<6,""]},iso8601Week:function(t){var e=new Date(t.getTime());return e.setDate(e.getDate()+4-(e.getDay()||7)),t=e.getTime(),e.setMonth(0),e.setDate(1),Math.floor(Math.round((t-e)/864e5)/7)+1},parseDate:function(e,n,t){if(null==e||null==n)throw"Invalid arguments";if(""===(n="object"==typeof n?n.toString():n+""))return null;for(var i,s,o,a=0,r=(t?t.shortYearCutoff:null)||this._defaults.shortYearCutoff,r="string"!=typeof r?r:(new Date).getFullYear()%100+parseInt(r,10),l=(t?t.dayNamesShort:null)||this._defaults.dayNamesShort,h=(t?t.dayNames:null)||this._defaults.dayNames,c=(t?t.monthNamesShort:null)||this._defaults.monthNamesShort,u=(t?t.monthNames:null)||this._defaults.monthNames,d=-1,p=-1,f=-1,g=-1,m=!1,_=function(t){t=w+1<e.length&&e.charAt(w+1)===t;return t&&w++,t},v=function(t){var e=_(t),e="@"===t?14:"!"===t?20:"y"===t&&e?4:"o"===t?3:2,e=new RegExp("^\\d{"+("y"===t?e:1)+","+e+"}"),e=n.substring(a).match(e);if(!e)throw"Missing number at position "+a;return a+=e[0].length,parseInt(e[0],10)},b=function(t,e,i){var s=-1,e=V.map(_(t)?i:e,function(t,e){return[[e,t]]}).sort(function(t,e){return-(t[1].length-e[1].length)});if(V.each(e,function(t,e){var i=e[1];if(n.substr(a,i.length).toLowerCase()===i.toLowerCase())return s=e[0],a+=i.length,!1}),-1!==s)return s+1;throw"Unknown name at position "+a},y=function(){if(n.charAt(a)!==e.charAt(w))throw"Unexpected literal at position "+a;a++},w=0;w<e.length;w++)if(m)"'"!==e.charAt(w)||_("'")?y():m=!1;else switch(e.charAt(w)){case"d":f=v("d");break;case"D":b("D",l,h);break;case"o":g=v("o");break;case"m":p=v("m");break;case"M":p=b("M",c,u);break;case"y":d=v("y");break;case"@":d=(o=new Date(v("@"))).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"!":d=(o=new Date((v("!")-this._ticksTo1970)/1e4)).getFullYear(),p=o.getMonth()+1,f=o.getDate();break;case"'":_("'")?y():m=!0;break;default:y()}if(a<n.length&&(s=n.substr(a),!/^\s+/.test(s)))throw"Extra/unparsed characters found in date: "+s;if(-1===d?d=(new Date).getFullYear():d<100&&(d+=(new Date).getFullYear()-(new Date).getFullYear()%100+(d<=r?0:-100)),-1<g)for(p=1,f=g;;){if(f<=(i=this._getDaysInMonth(d,p-1)))break;p++,f-=i}if((o=this._daylightSavingAdjust(new Date(d,p-1,f))).getFullYear()!==d||o.getMonth()+1!==p||o.getDate()!==f)throw"Invalid date";return o},ATOM:"yy-mm-dd",COOKIE:"D, dd M yy",ISO_8601:"yy-mm-dd",RFC_822:"D, d M y",RFC_850:"DD, dd-M-y",RFC_1036:"D, d M y",RFC_1123:"D, d M yy",RFC_2822:"D, d M yy",RSS:"D, d M y",TICKS:"!",TIMESTAMP:"@",W3C:"yy-mm-dd",_ticksTo1970:24*(718685+Math.floor(492.5)-Math.floor(19.7)+Math.floor(4.925))*60*60*1e7,formatDate:function(e,t,i){if(!t)return"";function s(t,e,i){var s=""+e;if(c(t))for(;s.length<i;)s="0"+s;return s}function n(t,e,i,s){return(c(t)?s:i)[e]}var o,a=(i?i.dayNamesShort:null)||this._defaults.dayNamesShort,r=(i?i.dayNames:null)||this._defaults.dayNames,l=(i?i.monthNamesShort:null)||this._defaults.monthNamesShort,h=(i?i.monthNames:null)||this._defaults.monthNames,c=function(t){t=o+1<e.length&&e.charAt(o+1)===t;return t&&o++,t},u="",d=!1;if(t)for(o=0;o<e.length;o++)if(d)"'"!==e.charAt(o)||c("'")?u+=e.charAt(o):d=!1;else switch(e.charAt(o)){case"d":u+=s("d",t.getDate(),2);break;case"D":u+=n("D",t.getDay(),a,r);break;case"o":u+=s("o",Math.round((new Date(t.getFullYear(),t.getMonth(),t.getDate()).getTime()-new Date(t.getFullYear(),0,0).getTime())/864e5),3);break;case"m":u+=s("m",t.getMonth()+1,2);break;case"M":u+=n("M",t.getMonth(),l,h);break;case"y":u+=c("y")?t.getFullYear():(t.getFullYear()%100<10?"0":"")+t.getFullYear()%100;break;case"@":u+=t.getTime();break;case"!":u+=1e4*t.getTime()+this._ticksTo1970;break;case"'":c("'")?u+="'":d=!0;break;default:u+=e.charAt(o)}return u},_possibleChars:function(e){for(var t="",i=!1,s=function(t){t=n+1<e.length&&e.charAt(n+1)===t;return t&&n++,t},n=0;n<e.length;n++)if(i)"'"!==e.charAt(n)||s("'")?t+=e.charAt(n):i=!1;else switch(e.charAt(n)){case"d":case"m":case"y":case"@":t+="0123456789";break;case"D":case"M":return null;case"'":s("'")?t+="'":i=!0;break;default:t+=e.charAt(n)}return t},_get:function(t,e){return(void 0!==t.settings[e]?t.settings:this._defaults)[e]},_setDateFromField:function(t,e){if(t.input.val()!==t.lastVal){var i=this._get(t,"dateFormat"),s=t.lastVal=t.input?t.input.val():null,n=this._getDefaultDate(t),o=n,a=this._getFormatConfig(t);try{o=this.parseDate(i,s,a)||n}catch(t){s=e?"":s}t.selectedDay=o.getDate(),t.drawMonth=t.selectedMonth=o.getMonth(),t.drawYear=t.selectedYear=o.getFullYear(),t.currentDay=s?o.getDate():0,t.currentMonth=s?o.getMonth():0,t.currentYear=s?o.getFullYear():0,this._adjustInstDate(t)}},_getDefaultDate:function(t){return this._restrictMinMax(t,this._determineDate(t,this._get(t,"defaultDate"),new Date))},_determineDate:function(r,t,e){var i,s,t=null==t||""===t?e:"string"==typeof t?function(t){try{return V.datepicker.parseDate(V.datepicker._get(r,"dateFormat"),t,V.datepicker._getFormatConfig(r))}catch(t){}for(var e=(t.toLowerCase().match(/^c/)?V.datepicker._getDate(r):null)||new Date,i=e.getFullYear(),s=e.getMonth(),n=e.getDate(),o=/([+\-]?[0-9]+)\s*(d|D|w|W|m|M|y|Y)?/g,a=o.exec(t);a;){switch(a[2]||"d"){case"d":case"D":n+=parseInt(a[1],10);break;case"w":case"W":n+=7*parseInt(a[1],10);break;case"m":case"M":s+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s));break;case"y":case"Y":i+=parseInt(a[1],10),n=Math.min(n,V.datepicker._getDaysInMonth(i,s))}a=o.exec(t)}return new Date(i,s,n)}(t):"number"==typeof t?isNaN(t)?e:(i=t,(s=new Date).setDate(s.getDate()+i),s):new Date(t.getTime());return(t=t&&"Invalid Date"===t.toString()?e:t)&&(t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0)),this._daylightSavingAdjust(t)},_daylightSavingAdjust:function(t){return t?(t.setHours(12<t.getHours()?t.getHours()+2:0),t):null},_setDate:function(t,e,i){var s=!e,n=t.selectedMonth,o=t.selectedYear,e=this._restrictMinMax(t,this._determineDate(t,e,new Date));t.selectedDay=t.currentDay=e.getDate(),t.drawMonth=t.selectedMonth=t.currentMonth=e.getMonth(),t.drawYear=t.selectedYear=t.currentYear=e.getFullYear(),n===t.selectedMonth&&o===t.selectedYear||i||this._notifyChange(t),this._adjustInstDate(t),t.input&&t.input.val(s?"":this._formatDate(t))},_getDate:function(t){return!t.currentYear||t.input&&""===t.input.val()?null:this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay))},_attachHandlers:function(t){var e=this._get(t,"stepMonths"),i="#"+t.id.replace(/\\\\/g,"\\");t.dpDiv.find("[data-handler]").map(function(){var t={prev:function(){V.datepicker._adjustDate(i,-e,"M")},next:function(){V.datepicker._adjustDate(i,+e,"M")},hide:function(){V.datepicker._hideDatepicker()},today:function(){V.datepicker._gotoToday(i)},selectDay:function(){return V.datepicker._selectDay(i,+this.getAttribute("data-month"),+this.getAttribute("data-year"),this),!1},selectMonth:function(){return V.datepicker._selectMonthYear(i,this,"M"),!1},selectYear:function(){return V.datepicker._selectMonthYear(i,this,"Y"),!1}};V(this).on(this.getAttribute("data-event"),t[this.getAttribute("data-handler")])})},_generateHTML:function(t){var e,i,s,n,o,a,r,l,h,c,u,d,p,f,g,m,_,v,b,y,w,x,k,C,D,I,T,P,M,S,H,z,A=new Date,O=this._daylightSavingAdjust(new Date(A.getFullYear(),A.getMonth(),A.getDate())),N=this._get(t,"isRTL"),E=this._get(t,"showButtonPanel"),W=this._get(t,"hideIfNoPrevNext"),F=this._get(t,"navigationAsDateFormat"),L=this._getNumberOfMonths(t),R=this._get(t,"showCurrentAtPos"),A=this._get(t,"stepMonths"),Y=1!==L[0]||1!==L[1],B=this._daylightSavingAdjust(t.currentDay?new Date(t.currentYear,t.currentMonth,t.currentDay):new Date(9999,9,9)),j=this._getMinMaxDate(t,"min"),q=this._getMinMaxDate(t,"max"),K=t.drawMonth-R,U=t.drawYear;if(K<0&&(K+=12,U--),q)for(e=this._daylightSavingAdjust(new Date(q.getFullYear(),q.getMonth()-L[0]*L[1]+1,q.getDate())),e=j&&e<j?j:e;this._daylightSavingAdjust(new Date(U,K,1))>e;)--K<0&&(K=11,U--);for(t.drawMonth=K,t.drawYear=U,R=this._get(t,"prevText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K-A,1)),this._getFormatConfig(t)):R,i=this._canAdjustMonth(t,-1,U,K)?V("<a>").attr({class:"ui-datepicker-prev ui-corner-all","data-handler":"prev","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-prev ui-corner-all ui-state-disabled",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"e":"w")).text(R))[0].outerHTML,R=this._get(t,"nextText"),R=F?this.formatDate(R,this._daylightSavingAdjust(new Date(U,K+A,1)),this._getFormatConfig(t)):R,s=this._canAdjustMonth(t,1,U,K)?V("<a>").attr({class:"ui-datepicker-next ui-corner-all","data-handler":"next","data-event":"click",title:R}).append(V("<span>").addClass("ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML:W?"":V("<a>").attr({class:"ui-datepicker-next ui-corner-all ui-state-disabled",title:R}).append(V("<span>").attr("class","ui-icon ui-icon-circle-triangle-"+(N?"w":"e")).text(R))[0].outerHTML,A=this._get(t,"currentText"),W=this._get(t,"gotoCurrent")&&t.currentDay?B:O,A=F?this.formatDate(A,W,this._getFormatConfig(t)):A,R="",t.inline||(R=V("<button>").attr({type:"button",class:"ui-datepicker-close ui-state-default ui-priority-primary ui-corner-all","data-handler":"hide","data-event":"click"}).text(this._get(t,"closeText"))[0].outerHTML),F="",E&&(F=V("<div class='ui-datepicker-buttonpane ui-widget-content'>").append(N?R:"").append(this._isInRange(t,W)?V("<button>").attr({type:"button",class:"ui-datepicker-current ui-state-default ui-priority-secondary ui-corner-all","data-handler":"today","data-event":"click"}).text(A):"").append(N?"":R)[0].outerHTML),n=parseInt(this._get(t,"firstDay"),10),n=isNaN(n)?0:n,o=this._get(t,"showWeek"),a=this._get(t,"dayNames"),r=this._get(t,"dayNamesMin"),l=this._get(t,"monthNames"),h=this._get(t,"monthNamesShort"),c=this._get(t,"beforeShowDay"),u=this._get(t,"showOtherMonths"),d=this._get(t,"selectOtherMonths"),p=this._getDefaultDate(t),f="",m=0;m<L[0];m++){for(_="",this.maxRows=4,v=0;v<L[1];v++){if(b=this._daylightSavingAdjust(new Date(U,K,t.selectedDay)),y=" ui-corner-all",w="",Y){if(w+="<div class='ui-datepicker-group",1<L[1])switch(v){case 0:w+=" ui-datepicker-group-first",y=" ui-corner-"+(N?"right":"left");break;case L[1]-1:w+=" ui-datepicker-group-last",y=" ui-corner-"+(N?"left":"right");break;default:w+=" ui-datepicker-group-middle",y=""}w+="'>"}for(w+="<div class='ui-datepicker-header ui-widget-header ui-helper-clearfix"+y+"'>"+(/all|left/.test(y)&&0===m?N?s:i:"")+(/all|right/.test(y)&&0===m?N?i:s:"")+this._generateMonthYearHeader(t,K,U,j,q,0<m||0<v,l,h)+"</div><table class='ui-datepicker-calendar'><thead><tr>",x=o?"<th class='ui-datepicker-week-col'>"+this._get(t,"weekHeader")+"</th>":"",g=0;g<7;g++)x+="<th scope='col'"+(5<=(g+n+6)%7?" class='ui-datepicker-week-end'":"")+"><span title='"+a[k=(g+n)%7]+"'>"+r[k]+"</span></th>";for(w+=x+"</tr></thead><tbody>",D=this._getDaysInMonth(U,K),U===t.selectedYear&&K===t.selectedMonth&&(t.selectedDay=Math.min(t.selectedDay,D)),C=(this._getFirstDayOfMonth(U,K)-n+7)%7,D=Math.ceil((C+D)/7),I=Y&&this.maxRows>D?this.maxRows:D,this.maxRows=I,T=this._daylightSavingAdjust(new Date(U,K,1-C)),P=0;P<I;P++){for(w+="<tr>",M=o?"<td class='ui-datepicker-week-col'>"+this._get(t,"calculateWeek")(T)+"</td>":"",g=0;g<7;g++)S=c?c.apply(t.input?t.input[0]:null,[T]):[!0,""],z=(H=T.getMonth()!==K)&&!d||!S[0]||j&&T<j||q&&q<T,M+="<td class='"+(5<=(g+n+6)%7?" ui-datepicker-week-end":"")+(H?" ui-datepicker-other-month":"")+(T.getTime()===b.getTime()&&K===t.selectedMonth&&t._keyEvent||p.getTime()===T.getTime()&&p.getTime()===b.getTime()?" "+this._dayOverClass:"")+(z?" "+this._unselectableClass+" ui-state-disabled":"")+(H&&!u?"":" "+S[1]+(T.getTime()===B.getTime()?" "+this._currentClass:"")+(T.getTime()===O.getTime()?" ui-datepicker-today":""))+"'"+(H&&!u||!S[2]?"":" title='"+S[2].replace(/'/g,"'")+"'")+(z?"":" data-handler='selectDay' data-event='click' data-month='"+T.getMonth()+"' data-year='"+T.getFullYear()+"'")+">"+(H&&!u?" ":z?"<span class='ui-state-default'>"+T.getDate()+"</span>":"<a class='ui-state-default"+(T.getTime()===O.getTime()?" ui-state-highlight":"")+(T.getTime()===B.getTime()?" ui-state-active":"")+(H?" ui-priority-secondary":"")+"' href='#' aria-current='"+(T.getTime()===B.getTime()?"true":"false")+"' data-date='"+T.getDate()+"'>"+T.getDate()+"</a>")+"</td>",T.setDate(T.getDate()+1),T=this._daylightSavingAdjust(T);w+=M+"</tr>"}11<++K&&(K=0,U++),_+=w+="</tbody></table>"+(Y?"</div>"+(0<L[0]&&v===L[1]-1?"<div class='ui-datepicker-row-break'></div>":""):"")}f+=_}return f+=F,t._keyEvent=!1,f},_generateMonthYearHeader:function(t,e,i,s,n,o,a,r){var l,h,c,u,d,p,f=this._get(t,"changeMonth"),g=this._get(t,"changeYear"),m=this._get(t,"showMonthAfterYear"),_=this._get(t,"selectMonthLabel"),v=this._get(t,"selectYearLabel"),b="<div class='ui-datepicker-title'>",y="";if(o||!f)y+="<span class='ui-datepicker-month'>"+a[e]+"</span>";else{for(l=s&&s.getFullYear()===i,h=n&&n.getFullYear()===i,y+="<select class='ui-datepicker-month' aria-label='"+_+"' data-handler='selectMonth' data-event='change'>",c=0;c<12;c++)(!l||c>=s.getMonth())&&(!h||c<=n.getMonth())&&(y+="<option value='"+c+"'"+(c===e?" selected='selected'":"")+">"+r[c]+"</option>");y+="</select>"}if(m||(b+=y+(!o&&f&&g?"":" ")),!t.yearshtml)if(t.yearshtml="",o||!g)b+="<span class='ui-datepicker-year'>"+i+"</span>";else{for(a=this._get(t,"yearRange").split(":"),u=(new Date).getFullYear(),d=(_=function(t){t=t.match(/c[+\-].*/)?i+parseInt(t.substring(1),10):t.match(/[+\-].*/)?u+parseInt(t,10):parseInt(t,10);return isNaN(t)?u:t})(a[0]),p=Math.max(d,_(a[1]||"")),d=s?Math.max(d,s.getFullYear()):d,p=n?Math.min(p,n.getFullYear()):p,t.yearshtml+="<select class='ui-datepicker-year' aria-label='"+v+"' data-handler='selectYear' data-event='change'>";d<=p;d++)t.yearshtml+="<option value='"+d+"'"+(d===i?" selected='selected'":"")+">"+d+"</option>";t.yearshtml+="</select>",b+=t.yearshtml,t.yearshtml=null}return b+=this._get(t,"yearSuffix"),m&&(b+=(!o&&f&&g?"":" ")+y),b+="</div>"},_adjustInstDate:function(t,e,i){var s=t.selectedYear+("Y"===i?e:0),n=t.selectedMonth+("M"===i?e:0),e=Math.min(t.selectedDay,this._getDaysInMonth(s,n))+("D"===i?e:0),e=this._restrictMinMax(t,this._daylightSavingAdjust(new Date(s,n,e)));t.selectedDay=e.getDate(),t.drawMonth=t.selectedMonth=e.getMonth(),t.drawYear=t.selectedYear=e.getFullYear(),"M"!==i&&"Y"!==i||this._notifyChange(t)},_restrictMinMax:function(t,e){var i=this._getMinMaxDate(t,"min"),t=this._getMinMaxDate(t,"max"),e=i&&e<i?i:e;return t&&t<e?t:e},_notifyChange:function(t){var e=this._get(t,"onChangeMonthYear");e&&e.apply(t.input?t.input[0]:null,[t.selectedYear,t.selectedMonth+1,t])},_getNumberOfMonths:function(t){t=this._get(t,"numberOfMonths");return null==t?[1,1]:"number"==typeof t?[1,t]:t},_getMinMaxDate:function(t,e){return this._determineDate(t,this._get(t,e+"Date"),null)},_getDaysInMonth:function(t,e){return 32-this._daylightSavingAdjust(new Date(t,e,32)).getDate()},_getFirstDayOfMonth:function(t,e){return new Date(t,e,1).getDay()},_canAdjustMonth:function(t,e,i,s){var n=this._getNumberOfMonths(t),n=this._daylightSavingAdjust(new Date(i,s+(e<0?e:n[0]*n[1]),1));return e<0&&n.setDate(this._getDaysInMonth(n.getFullYear(),n.getMonth())),this._isInRange(t,n)},_isInRange:function(t,e){var i=this._getMinMaxDate(t,"min"),s=this._getMinMaxDate(t,"max"),n=null,o=null,a=this._get(t,"yearRange");return a&&(t=a.split(":"),a=(new Date).getFullYear(),n=parseInt(t[0],10),o=parseInt(t[1],10),t[0].match(/[+\-].*/)&&(n+=a),t[1].match(/[+\-].*/)&&(o+=a)),(!i||e.getTime()>=i.getTime())&&(!s||e.getTime()<=s.getTime())&&(!n||e.getFullYear()>=n)&&(!o||e.getFullYear()<=o)},_getFormatConfig:function(t){var e=this._get(t,"shortYearCutoff");return{shortYearCutoff:e="string"!=typeof e?e:(new Date).getFullYear()%100+parseInt(e,10),dayNamesShort:this._get(t,"dayNamesShort"),dayNames:this._get(t,"dayNames"),monthNamesShort:this._get(t,"monthNamesShort"),monthNames:this._get(t,"monthNames")}},_formatDate:function(t,e,i,s){e||(t.currentDay=t.selectedDay,t.currentMonth=t.selectedMonth,t.currentYear=t.selectedYear);e=e?"object"==typeof e?e:this._daylightSavingAdjust(new Date(s,i,e)):this._daylightSavingAdjust(new Date(t.currentYear,t.currentMonth,t.currentDay));return this.formatDate(this._get(t,"dateFormat"),e,this._getFormatConfig(t))}}),V.fn.datepicker=function(t){if(!this.length)return this;V.datepicker.initialized||(V(document).on("mousedown",V.datepicker._checkExternalClick),V.datepicker.initialized=!0),0===V("#"+V.datepicker._mainDivId).length&&V("body").append(V.datepicker.dpDiv);var e=Array.prototype.slice.call(arguments,1);return"string"==typeof t&&("isDisabled"===t||"getDate"===t||"widget"===t)||"option"===t&&2===arguments.length&&"string"==typeof arguments[1]?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this[0]].concat(e)):this.each(function(){"string"==typeof t?V.datepicker["_"+t+"Datepicker"].apply(V.datepicker,[this].concat(e)):V.datepicker._attachDatepicker(this,t)})},V.datepicker=new st,V.datepicker.initialized=!1,V.datepicker.uuid=(new Date).getTime(),V.datepicker.version="1.13.2";V.datepicker,V.ui.ie=!!/msie [\w.]+/.exec(navigator.userAgent.toLowerCase());var rt=!1;V(document).on("mouseup",function(){rt=!1});V.widget("ui.mouse",{version:"1.13.2",options:{cancel:"input, textarea, button, select, option",distance:1,delay:0},_mouseInit:function(){var e=this;this.element.on("mousedown."+this.widgetName,function(t){return e._mouseDown(t)}).on("click."+this.widgetName,function(t){if(!0===V.data(t.target,e.widgetName+".preventClickEvent"))return V.removeData(t.target,e.widgetName+".preventClickEvent"),t.stopImmediatePropagation(),!1}),this.started=!1},_mouseDestroy:function(){this.element.off("."+this.widgetName),this._mouseMoveDelegate&&this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate)},_mouseDown:function(t){if(!rt){this._mouseMoved=!1,this._mouseStarted&&this._mouseUp(t),this._mouseDownEvent=t;var e=this,i=1===t.which,s=!("string"!=typeof this.options.cancel||!t.target.nodeName)&&V(t.target).closest(this.options.cancel).length;return i&&!s&&this._mouseCapture(t)?(this.mouseDelayMet=!this.options.delay,this.mouseDelayMet||(this._mouseDelayTimer=setTimeout(function(){e.mouseDelayMet=!0},this.options.delay)),this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(t),!this._mouseStarted)?(t.preventDefault(),!0):(!0===V.data(t.target,this.widgetName+".preventClickEvent")&&V.removeData(t.target,this.widgetName+".preventClickEvent"),this._mouseMoveDelegate=function(t){return e._mouseMove(t)},this._mouseUpDelegate=function(t){return e._mouseUp(t)},this.document.on("mousemove."+this.widgetName,this._mouseMoveDelegate).on("mouseup."+this.widgetName,this._mouseUpDelegate),t.preventDefault(),rt=!0)):!0}},_mouseMove:function(t){if(this._mouseMoved){if(V.ui.ie&&(!document.documentMode||document.documentMode<9)&&!t.button)return this._mouseUp(t);if(!t.which)if(t.originalEvent.altKey||t.originalEvent.ctrlKey||t.originalEvent.metaKey||t.originalEvent.shiftKey)this.ignoreMissingWhich=!0;else if(!this.ignoreMissingWhich)return this._mouseUp(t)}return(t.which||t.button)&&(this._mouseMoved=!0),this._mouseStarted?(this._mouseDrag(t),t.preventDefault()):(this._mouseDistanceMet(t)&&this._mouseDelayMet(t)&&(this._mouseStarted=!1!==this._mouseStart(this._mouseDownEvent,t),this._mouseStarted?this._mouseDrag(t):this._mouseUp(t)),!this._mouseStarted)},_mouseUp:function(t){this.document.off("mousemove."+this.widgetName,this._mouseMoveDelegate).off("mouseup."+this.widgetName,this._mouseUpDelegate),this._mouseStarted&&(this._mouseStarted=!1,t.target===this._mouseDownEvent.target&&V.data(t.target,this.widgetName+".preventClickEvent",!0),this._mouseStop(t)),this._mouseDelayTimer&&(clearTimeout(this._mouseDelayTimer),delete this._mouseDelayTimer),this.ignoreMissingWhich=!1,rt=!1,t.preventDefault()},_mouseDistanceMet:function(t){return Math.max(Math.abs(this._mouseDownEvent.pageX-t.pageX),Math.abs(this._mouseDownEvent.pageY-t.pageY))>=this.options.distance},_mouseDelayMet:function(){return this.mouseDelayMet},_mouseStart:function(){},_mouseDrag:function(){},_mouseStop:function(){},_mouseCapture:function(){return!0}}),V.ui.plugin={add:function(t,e,i){var s,n=V.ui[t].prototype;for(s in i)n.plugins[s]=n.plugins[s]||[],n.plugins[s].push([e,i[s]])},call:function(t,e,i,s){var n,o=t.plugins[e];if(o&&(s||t.element[0].parentNode&&11!==t.element[0].parentNode.nodeType))for(n=0;n<o.length;n++)t.options[o[n][0]]&&o[n][1].apply(t.element,i)}},V.ui.safeBlur=function(t){t&&"body"!==t.nodeName.toLowerCase()&&V(t).trigger("blur")};V.widget("ui.draggable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"drag",options:{addClasses:!0,appendTo:"parent",axis:!1,connectToSortable:!1,containment:!1,cursor:"auto",cursorAt:!1,grid:!1,handle:!1,helper:"original",iframeFix:!1,opacity:!1,refreshPositions:!1,revert:!1,revertDuration:500,scope:"default",scroll:!0,scrollSensitivity:20,scrollSpeed:20,snap:!1,snapMode:"both",snapTolerance:20,stack:!1,zIndex:!1,drag:null,start:null,stop:null},_create:function(){"original"===this.options.helper&&this._setPositionRelative(),this.options.addClasses&&this._addClass("ui-draggable"),this._setHandleClassName(),this._mouseInit()},_setOption:function(t,e){this._super(t,e),"handle"===t&&(this._removeHandleClassName(),this._setHandleClassName())},_destroy:function(){(this.helper||this.element).is(".ui-draggable-dragging")?this.destroyOnClear=!0:(this._removeHandleClassName(),this._mouseDestroy())},_mouseCapture:function(t){var e=this.options;return!(this.helper||e.disabled||0<V(t.target).closest(".ui-resizable-handle").length)&&(this.handle=this._getHandle(t),!!this.handle&&(this._blurActiveElement(t),this._blockFrames(!0===e.iframeFix?"iframe":e.iframeFix),!0))},_blockFrames:function(t){this.iframeBlocks=this.document.find(t).map(function(){var t=V(this);return V("<div>").css("position","absolute").appendTo(t.parent()).outerWidth(t.outerWidth()).outerHeight(t.outerHeight()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_blurActiveElement:function(t){var e=V.ui.safeActiveElement(this.document[0]);V(t.target).closest(e).length||V.ui.safeBlur(e)},_mouseStart:function(t){var e=this.options;return this.helper=this._createHelper(t),this._addClass(this.helper,"ui-draggable-dragging"),this._cacheHelperProportions(),V.ui.ddmanager&&(V.ui.ddmanager.current=this),this._cacheMargins(),this.cssPosition=this.helper.css("position"),this.scrollParent=this.helper.scrollParent(!0),this.offsetParent=this.helper.offsetParent(),this.hasFixedAncestor=0<this.helper.parents().filter(function(){return"fixed"===V(this).css("position")}).length,this.positionAbs=this.element.offset(),this._refreshOffsets(t),this.originalPosition=this.position=this._generatePosition(t,!1),this.originalPageX=t.pageX,this.originalPageY=t.pageY,e.cursorAt&&this._adjustOffsetFromHelper(e.cursorAt),this._setContainment(),!1===this._trigger("start",t)?(this._clear(),!1):(this._cacheHelperProportions(),V.ui.ddmanager&&!e.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this._mouseDrag(t,!0),V.ui.ddmanager&&V.ui.ddmanager.dragStart(this,t),!0)},_refreshOffsets:function(t){this.offset={top:this.positionAbs.top-this.margins.top,left:this.positionAbs.left-this.margins.left,scroll:!1,parent:this._getParentOffset(),relative:this._getRelativeOffset()},this.offset.click={left:t.pageX-this.offset.left,top:t.pageY-this.offset.top}},_mouseDrag:function(t,e){if(this.hasFixedAncestor&&(this.offset.parent=this._getParentOffset()),this.position=this._generatePosition(t,!0),this.positionAbs=this._convertPositionTo("absolute"),!e){e=this._uiHash();if(!1===this._trigger("drag",t,e))return this._mouseUp(new V.Event("mouseup",t)),!1;this.position=e.position}return this.helper[0].style.left=this.position.left+"px",this.helper[0].style.top=this.position.top+"px",V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),!1},_mouseStop:function(t){var e=this,i=!1;return V.ui.ddmanager&&!this.options.dropBehaviour&&(i=V.ui.ddmanager.drop(this,t)),this.dropped&&(i=this.dropped,this.dropped=!1),"invalid"===this.options.revert&&!i||"valid"===this.options.revert&&i||!0===this.options.revert||"function"==typeof this.options.revert&&this.options.revert.call(this.element,i)?V(this.helper).animate(this.originalPosition,parseInt(this.options.revertDuration,10),function(){!1!==e._trigger("stop",t)&&e._clear()}):!1!==this._trigger("stop",t)&&this._clear(),!1},_mouseUp:function(t){return this._unblockFrames(),V.ui.ddmanager&&V.ui.ddmanager.dragStop(this,t),this.handleElement.is(t.target)&&this.element.trigger("focus"),V.ui.mouse.prototype._mouseUp.call(this,t)},cancel:function(){return this.helper.is(".ui-draggable-dragging")?this._mouseUp(new V.Event("mouseup",{target:this.element[0]})):this._clear(),this},_getHandle:function(t){return!this.options.handle||!!V(t.target).closest(this.element.find(this.options.handle)).length},_setHandleClassName:function(){this.handleElement=this.options.handle?this.element.find(this.options.handle):this.element,this._addClass(this.handleElement,"ui-draggable-handle")},_removeHandleClassName:function(){this._removeClass(this.handleElement,"ui-draggable-handle")},_createHelper:function(t){var e=this.options,i="function"==typeof e.helper,t=i?V(e.helper.apply(this.element[0],[t])):"clone"===e.helper?this.element.clone().removeAttr("id"):this.element;return t.parents("body").length||t.appendTo("parent"===e.appendTo?this.element[0].parentNode:e.appendTo),i&&t[0]===this.element[0]&&this._setPositionRelative(),t[0]===this.element[0]||/(fixed|absolute)/.test(t.css("position"))||t.css("position","absolute"),t},_setPositionRelative:function(){/^(?:r|a|f)/.test(this.element.css("position"))||(this.element[0].style.position="relative")},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_isRootNode:function(t){return/(html|body)/i.test(t.tagName)||t===this.document[0]},_getParentOffset:function(){var t=this.offsetParent.offset(),e=this.document[0];return"absolute"===this.cssPosition&&this.scrollParent[0]!==e&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this._isRootNode(this.offsetParent[0])?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.element.position(),e=this._isRootNode(this.scrollParent[0]);return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+(e?0:this.scrollParent.scrollTop()),left:t.left-(parseInt(this.helper.css("left"),10)||0)+(e?0:this.scrollParent.scrollLeft())}},_cacheMargins:function(){this.margins={left:parseInt(this.element.css("marginLeft"),10)||0,top:parseInt(this.element.css("marginTop"),10)||0,right:parseInt(this.element.css("marginRight"),10)||0,bottom:parseInt(this.element.css("marginBottom"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i,s=this.options,n=this.document[0];this.relativeContainer=null,s.containment?"window"!==s.containment?"document"!==s.containment?s.containment.constructor!==Array?("parent"===s.containment&&(s.containment=this.helper[0].parentNode),(i=(e=V(s.containment))[0])&&(t=/(scroll|auto)/.test(e.css("overflow")),this.containment=[(parseInt(e.css("borderLeftWidth"),10)||0)+(parseInt(e.css("paddingLeft"),10)||0),(parseInt(e.css("borderTopWidth"),10)||0)+(parseInt(e.css("paddingTop"),10)||0),(t?Math.max(i.scrollWidth,i.offsetWidth):i.offsetWidth)-(parseInt(e.css("borderRightWidth"),10)||0)-(parseInt(e.css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left-this.margins.right,(t?Math.max(i.scrollHeight,i.offsetHeight):i.offsetHeight)-(parseInt(e.css("borderBottomWidth"),10)||0)-(parseInt(e.css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top-this.margins.bottom],this.relativeContainer=e)):this.containment=s.containment:this.containment=[0,0,V(n).width()-this.helperProportions.width-this.margins.left,(V(n).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=[V(window).scrollLeft()-this.offset.relative.left-this.offset.parent.left,V(window).scrollTop()-this.offset.relative.top-this.offset.parent.top,V(window).scrollLeft()+V(window).width()-this.helperProportions.width-this.margins.left,V(window).scrollTop()+(V(window).height()||n.body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]:this.containment=null},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,t=this._isRootNode(this.scrollParent[0]);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.offset.scroll.top:t?0:this.offset.scroll.top)*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.offset.scroll.left:t?0:this.offset.scroll.left)*i}},_generatePosition:function(t,e){var i,s=this.options,n=this._isRootNode(this.scrollParent[0]),o=t.pageX,a=t.pageY;return n&&this.offset.scroll||(this.offset.scroll={top:this.scrollParent.scrollTop(),left:this.scrollParent.scrollLeft()}),e&&(this.containment&&(i=this.relativeContainer?(i=this.relativeContainer.offset(),[this.containment[0]+i.left,this.containment[1]+i.top,this.containment[2]+i.left,this.containment[3]+i.top]):this.containment,t.pageX-this.offset.click.left<i[0]&&(o=i[0]+this.offset.click.left),t.pageY-this.offset.click.top<i[1]&&(a=i[1]+this.offset.click.top),t.pageX-this.offset.click.left>i[2]&&(o=i[2]+this.offset.click.left),t.pageY-this.offset.click.top>i[3]&&(a=i[3]+this.offset.click.top)),s.grid&&(t=s.grid[1]?this.originalPageY+Math.round((a-this.originalPageY)/s.grid[1])*s.grid[1]:this.originalPageY,a=!i||t-this.offset.click.top>=i[1]||t-this.offset.click.top>i[3]?t:t-this.offset.click.top>=i[1]?t-s.grid[1]:t+s.grid[1],t=s.grid[0]?this.originalPageX+Math.round((o-this.originalPageX)/s.grid[0])*s.grid[0]:this.originalPageX,o=!i||t-this.offset.click.left>=i[0]||t-this.offset.click.left>i[2]?t:t-this.offset.click.left>=i[0]?t-s.grid[0]:t+s.grid[0]),"y"===s.axis&&(o=this.originalPageX),"x"===s.axis&&(a=this.originalPageY)),{top:a-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.offset.scroll.top:n?0:this.offset.scroll.top),left:o-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.offset.scroll.left:n?0:this.offset.scroll.left)}},_clear:function(){this._removeClass(this.helper,"ui-draggable-dragging"),this.helper[0]===this.element[0]||this.cancelHelperRemoval||this.helper.remove(),this.helper=null,this.cancelHelperRemoval=!1,this.destroyOnClear&&this.destroy()},_trigger:function(t,e,i){return i=i||this._uiHash(),V.ui.plugin.call(this,t,[e,i,this],!0),/^(drag|start|stop)/.test(t)&&(this.positionAbs=this._convertPositionTo("absolute"),i.offset=this.positionAbs),V.Widget.prototype._trigger.call(this,t,e,i)},plugins:{},_uiHash:function(){return{helper:this.helper,position:this.position,originalPosition:this.originalPosition,offset:this.positionAbs}}}),V.ui.plugin.add("draggable","connectToSortable",{start:function(e,t,i){var s=V.extend({},t,{item:i.element});i.sortables=[],V(i.options.connectToSortable).each(function(){var t=V(this).sortable("instance");t&&!t.options.disabled&&(i.sortables.push(t),t.refreshPositions(),t._trigger("activate",e,s))})},stop:function(e,t,i){var s=V.extend({},t,{item:i.element});i.cancelHelperRemoval=!1,V.each(i.sortables,function(){var t=this;t.isOver?(t.isOver=0,i.cancelHelperRemoval=!0,t.cancelHelperRemoval=!1,t._storedCSS={position:t.placeholder.css("position"),top:t.placeholder.css("top"),left:t.placeholder.css("left")},t._mouseStop(e),t.options.helper=t.options._helper):(t.cancelHelperRemoval=!0,t._trigger("deactivate",e,s))})},drag:function(i,s,n){V.each(n.sortables,function(){var t=!1,e=this;e.positionAbs=n.positionAbs,e.helperProportions=n.helperProportions,e.offset.click=n.offset.click,e._intersectsWith(e.containerCache)&&(t=!0,V.each(n.sortables,function(){return this.positionAbs=n.positionAbs,this.helperProportions=n.helperProportions,this.offset.click=n.offset.click,t=this!==e&&this._intersectsWith(this.containerCache)&&V.contains(e.element[0],this.element[0])?!1:t})),t?(e.isOver||(e.isOver=1,n._parent=s.helper.parent(),e.currentItem=s.helper.appendTo(e.element).data("ui-sortable-item",!0),e.options._helper=e.options.helper,e.options.helper=function(){return s.helper[0]},i.target=e.currentItem[0],e._mouseCapture(i,!0),e._mouseStart(i,!0,!0),e.offset.click.top=n.offset.click.top,e.offset.click.left=n.offset.click.left,e.offset.parent.left-=n.offset.parent.left-e.offset.parent.left,e.offset.parent.top-=n.offset.parent.top-e.offset.parent.top,n._trigger("toSortable",i),n.dropped=e.element,V.each(n.sortables,function(){this.refreshPositions()}),n.currentItem=n.element,e.fromOutside=n),e.currentItem&&(e._mouseDrag(i),s.position=e.position)):e.isOver&&(e.isOver=0,e.cancelHelperRemoval=!0,e.options._revert=e.options.revert,e.options.revert=!1,e._trigger("out",i,e._uiHash(e)),e._mouseStop(i,!0),e.options.revert=e.options._revert,e.options.helper=e.options._helper,e.placeholder&&e.placeholder.remove(),s.helper.appendTo(n._parent),n._refreshOffsets(i),s.position=n._generatePosition(i,!0),n._trigger("fromSortable",i),n.dropped=!1,V.each(n.sortables,function(){this.refreshPositions()}))})}}),V.ui.plugin.add("draggable","cursor",{start:function(t,e,i){var s=V("body"),i=i.options;s.css("cursor")&&(i._cursor=s.css("cursor")),s.css("cursor",i.cursor)},stop:function(t,e,i){i=i.options;i._cursor&&V("body").css("cursor",i._cursor)}}),V.ui.plugin.add("draggable","opacity",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("opacity")&&(i._opacity=e.css("opacity")),e.css("opacity",i.opacity)},stop:function(t,e,i){i=i.options;i._opacity&&V(e.helper).css("opacity",i._opacity)}}),V.ui.plugin.add("draggable","scroll",{start:function(t,e,i){i.scrollParentNotHidden||(i.scrollParentNotHidden=i.helper.scrollParent(!1)),i.scrollParentNotHidden[0]!==i.document[0]&&"HTML"!==i.scrollParentNotHidden[0].tagName&&(i.overflowOffset=i.scrollParentNotHidden.offset())},drag:function(t,e,i){var s=i.options,n=!1,o=i.scrollParentNotHidden[0],a=i.document[0];o!==a&&"HTML"!==o.tagName?(s.axis&&"x"===s.axis||(i.overflowOffset.top+o.offsetHeight-t.pageY<s.scrollSensitivity?o.scrollTop=n=o.scrollTop+s.scrollSpeed:t.pageY-i.overflowOffset.top<s.scrollSensitivity&&(o.scrollTop=n=o.scrollTop-s.scrollSpeed)),s.axis&&"y"===s.axis||(i.overflowOffset.left+o.offsetWidth-t.pageX<s.scrollSensitivity?o.scrollLeft=n=o.scrollLeft+s.scrollSpeed:t.pageX-i.overflowOffset.left<s.scrollSensitivity&&(o.scrollLeft=n=o.scrollLeft-s.scrollSpeed))):(s.axis&&"x"===s.axis||(t.pageY-V(a).scrollTop()<s.scrollSensitivity?n=V(a).scrollTop(V(a).scrollTop()-s.scrollSpeed):V(window).height()-(t.pageY-V(a).scrollTop())<s.scrollSensitivity&&(n=V(a).scrollTop(V(a).scrollTop()+s.scrollSpeed))),s.axis&&"y"===s.axis||(t.pageX-V(a).scrollLeft()<s.scrollSensitivity?n=V(a).scrollLeft(V(a).scrollLeft()-s.scrollSpeed):V(window).width()-(t.pageX-V(a).scrollLeft())<s.scrollSensitivity&&(n=V(a).scrollLeft(V(a).scrollLeft()+s.scrollSpeed)))),!1!==n&&V.ui.ddmanager&&!s.dropBehaviour&&V.ui.ddmanager.prepareOffsets(i,t)}}),V.ui.plugin.add("draggable","snap",{start:function(t,e,i){var s=i.options;i.snapElements=[],V(s.snap.constructor!==String?s.snap.items||":data(ui-draggable)":s.snap).each(function(){var t=V(this),e=t.offset();this!==i.element[0]&&i.snapElements.push({item:this,width:t.outerWidth(),height:t.outerHeight(),top:e.top,left:e.left})})},drag:function(t,e,i){for(var s,n,o,a,r,l,h,c,u,d=i.options,p=d.snapTolerance,f=e.offset.left,g=f+i.helperProportions.width,m=e.offset.top,_=m+i.helperProportions.height,v=i.snapElements.length-1;0<=v;v--)l=(r=i.snapElements[v].left-i.margins.left)+i.snapElements[v].width,c=(h=i.snapElements[v].top-i.margins.top)+i.snapElements[v].height,g<r-p||l+p<f||_<h-p||c+p<m||!V.contains(i.snapElements[v].item.ownerDocument,i.snapElements[v].item)?(i.snapElements[v].snapping&&i.options.snap.release&&i.options.snap.release.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=!1):("inner"!==d.snapMode&&(s=Math.abs(h-_)<=p,n=Math.abs(c-m)<=p,o=Math.abs(r-g)<=p,a=Math.abs(l-f)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h-i.helperProportions.height,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r-i.helperProportions.width}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l}).left)),u=s||n||o||a,"outer"!==d.snapMode&&(s=Math.abs(h-m)<=p,n=Math.abs(c-_)<=p,o=Math.abs(r-f)<=p,a=Math.abs(l-g)<=p,s&&(e.position.top=i._convertPositionTo("relative",{top:h,left:0}).top),n&&(e.position.top=i._convertPositionTo("relative",{top:c-i.helperProportions.height,left:0}).top),o&&(e.position.left=i._convertPositionTo("relative",{top:0,left:r}).left),a&&(e.position.left=i._convertPositionTo("relative",{top:0,left:l-i.helperProportions.width}).left)),!i.snapElements[v].snapping&&(s||n||o||a||u)&&i.options.snap.snap&&i.options.snap.snap.call(i.element,t,V.extend(i._uiHash(),{snapItem:i.snapElements[v].item})),i.snapElements[v].snapping=s||n||o||a||u)}}),V.ui.plugin.add("draggable","stack",{start:function(t,e,i){var s,i=i.options,i=V.makeArray(V(i.stack)).sort(function(t,e){return(parseInt(V(t).css("zIndex"),10)||0)-(parseInt(V(e).css("zIndex"),10)||0)});i.length&&(s=parseInt(V(i[0]).css("zIndex"),10)||0,V(i).each(function(t){V(this).css("zIndex",s+t)}),this.css("zIndex",s+i.length))}}),V.ui.plugin.add("draggable","zIndex",{start:function(t,e,i){e=V(e.helper),i=i.options;e.css("zIndex")&&(i._zIndex=e.css("zIndex")),e.css("zIndex",i.zIndex)},stop:function(t,e,i){i=i.options;i._zIndex&&V(e.helper).css("zIndex",i._zIndex)}});V.ui.draggable;V.widget("ui.resizable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"resize",options:{alsoResize:!1,animate:!1,animateDuration:"slow",animateEasing:"swing",aspectRatio:!1,autoHide:!1,classes:{"ui-resizable-se":"ui-icon ui-icon-gripsmall-diagonal-se"},containment:!1,ghost:!1,grid:!1,handles:"e,s,se",helper:!1,maxHeight:null,maxWidth:null,minHeight:10,minWidth:10,zIndex:90,resize:null,start:null,stop:null},_num:function(t){return parseFloat(t)||0},_isNumber:function(t){return!isNaN(parseFloat(t))},_hasScroll:function(t,e){if("hidden"===V(t).css("overflow"))return!1;var i=e&&"left"===e?"scrollLeft":"scrollTop",e=!1;if(0<t[i])return!0;try{t[i]=1,e=0<t[i],t[i]=0}catch(t){}return e},_create:function(){var t,e=this.options,i=this;this._addClass("ui-resizable"),V.extend(this,{_aspectRatio:!!e.aspectRatio,aspectRatio:e.aspectRatio,originalElement:this.element,_proportionallyResizeElements:[],_helper:e.helper||e.ghost||e.animate?e.helper||"ui-resizable-helper":null}),this.element[0].nodeName.match(/^(canvas|textarea|input|select|button|img)$/i)&&(this.element.wrap(V("<div class='ui-wrapper'></div>").css({overflow:"hidden",position:this.element.css("position"),width:this.element.outerWidth(),height:this.element.outerHeight(),top:this.element.css("top"),left:this.element.css("left")})),this.element=this.element.parent().data("ui-resizable",this.element.resizable("instance")),this.elementIsWrapper=!0,t={marginTop:this.originalElement.css("marginTop"),marginRight:this.originalElement.css("marginRight"),marginBottom:this.originalElement.css("marginBottom"),marginLeft:this.originalElement.css("marginLeft")},this.element.css(t),this.originalElement.css("margin",0),this.originalResizeStyle=this.originalElement.css("resize"),this.originalElement.css("resize","none"),this._proportionallyResizeElements.push(this.originalElement.css({position:"static",zoom:1,display:"block"})),this.originalElement.css(t),this._proportionallyResize()),this._setupHandles(),e.autoHide&&V(this.element).on("mouseenter",function(){e.disabled||(i._removeClass("ui-resizable-autohide"),i._handles.show())}).on("mouseleave",function(){e.disabled||i.resizing||(i._addClass("ui-resizable-autohide"),i._handles.hide())}),this._mouseInit()},_destroy:function(){this._mouseDestroy(),this._addedHandles.remove();function t(t){V(t).removeData("resizable").removeData("ui-resizable").off(".resizable")}var e;return this.elementIsWrapper&&(t(this.element),e=this.element,this.originalElement.css({position:e.css("position"),width:e.outerWidth(),height:e.outerHeight(),top:e.css("top"),left:e.css("left")}).insertAfter(e),e.remove()),this.originalElement.css("resize",this.originalResizeStyle),t(this.originalElement),this},_setOption:function(t,e){switch(this._super(t,e),t){case"handles":this._removeHandles(),this._setupHandles();break;case"aspectRatio":this._aspectRatio=!!e}},_setupHandles:function(){var t,e,i,s,n,o=this.options,a=this;if(this.handles=o.handles||(V(".ui-resizable-handle",this.element).length?{n:".ui-resizable-n",e:".ui-resizable-e",s:".ui-resizable-s",w:".ui-resizable-w",se:".ui-resizable-se",sw:".ui-resizable-sw",ne:".ui-resizable-ne",nw:".ui-resizable-nw"}:"e,s,se"),this._handles=V(),this._addedHandles=V(),this.handles.constructor===String)for("all"===this.handles&&(this.handles="n,e,s,w,se,sw,ne,nw"),i=this.handles.split(","),this.handles={},e=0;e<i.length;e++)s="ui-resizable-"+(t=String.prototype.trim.call(i[e])),n=V("<div>"),this._addClass(n,"ui-resizable-handle "+s),n.css({zIndex:o.zIndex}),this.handles[t]=".ui-resizable-"+t,this.element.children(this.handles[t]).length||(this.element.append(n),this._addedHandles=this._addedHandles.add(n));this._renderAxis=function(t){var e,i,s;for(e in t=t||this.element,this.handles)this.handles[e].constructor===String?this.handles[e]=this.element.children(this.handles[e]).first().show():(this.handles[e].jquery||this.handles[e].nodeType)&&(this.handles[e]=V(this.handles[e]),this._on(this.handles[e],{mousedown:a._mouseDown})),this.elementIsWrapper&&this.originalElement[0].nodeName.match(/^(textarea|input|select|button)$/i)&&(i=V(this.handles[e],this.element),s=/sw|ne|nw|se|n|s/.test(e)?i.outerHeight():i.outerWidth(),i=["padding",/ne|nw|n/.test(e)?"Top":/se|sw|s/.test(e)?"Bottom":/^e$/.test(e)?"Right":"Left"].join(""),t.css(i,s),this._proportionallyResize()),this._handles=this._handles.add(this.handles[e])},this._renderAxis(this.element),this._handles=this._handles.add(this.element.find(".ui-resizable-handle")),this._handles.disableSelection(),this._handles.on("mouseover",function(){a.resizing||(this.className&&(n=this.className.match(/ui-resizable-(se|sw|ne|nw|n|e|s|w)/i)),a.axis=n&&n[1]?n[1]:"se")}),o.autoHide&&(this._handles.hide(),this._addClass("ui-resizable-autohide"))},_removeHandles:function(){this._addedHandles.remove()},_mouseCapture:function(t){var e,i,s=!1;for(e in this.handles)(i=V(this.handles[e])[0])!==t.target&&!V.contains(i,t.target)||(s=!0);return!this.options.disabled&&s},_mouseStart:function(t){var e,i,s=this.options,n=this.element;return this.resizing=!0,this._renderProxy(),e=this._num(this.helper.css("left")),i=this._num(this.helper.css("top")),s.containment&&(e+=V(s.containment).scrollLeft()||0,i+=V(s.containment).scrollTop()||0),this.offset=this.helper.offset(),this.position={left:e,top:i},this.size=this._helper?{width:this.helper.width(),height:this.helper.height()}:{width:n.width(),height:n.height()},this.originalSize=this._helper?{width:n.outerWidth(),height:n.outerHeight()}:{width:n.width(),height:n.height()},this.sizeDiff={width:n.outerWidth()-n.width(),height:n.outerHeight()-n.height()},this.originalPosition={left:e,top:i},this.originalMousePosition={left:t.pageX,top:t.pageY},this.aspectRatio="number"==typeof s.aspectRatio?s.aspectRatio:this.originalSize.width/this.originalSize.height||1,s=V(".ui-resizable-"+this.axis).css("cursor"),V("body").css("cursor","auto"===s?this.axis+"-resize":s),this._addClass("ui-resizable-resizing"),this._propagate("start",t),!0},_mouseDrag:function(t){var e=this.originalMousePosition,i=this.axis,s=t.pageX-e.left||0,e=t.pageY-e.top||0,i=this._change[i];return this._updatePrevProperties(),i&&(e=i.apply(this,[t,s,e]),this._updateVirtualBoundaries(t.shiftKey),(this._aspectRatio||t.shiftKey)&&(e=this._updateRatio(e,t)),e=this._respectSize(e,t),this._updateCache(e),this._propagate("resize",t),e=this._applyChanges(),!this._helper&&this._proportionallyResizeElements.length&&this._proportionallyResize(),V.isEmptyObject(e)||(this._updatePrevProperties(),this._trigger("resize",t,this.ui()),this._applyChanges())),!1},_mouseStop:function(t){this.resizing=!1;var e,i,s,n=this.options,o=this;return this._helper&&(s=(e=(i=this._proportionallyResizeElements).length&&/textarea/i.test(i[0].nodeName))&&this._hasScroll(i[0],"left")?0:o.sizeDiff.height,i=e?0:o.sizeDiff.width,e={width:o.helper.width()-i,height:o.helper.height()-s},i=parseFloat(o.element.css("left"))+(o.position.left-o.originalPosition.left)||null,s=parseFloat(o.element.css("top"))+(o.position.top-o.originalPosition.top)||null,n.animate||this.element.css(V.extend(e,{top:s,left:i})),o.helper.height(o.size.height),o.helper.width(o.size.width),this._helper&&!n.animate&&this._proportionallyResize()),V("body").css("cursor","auto"),this._removeClass("ui-resizable-resizing"),this._propagate("stop",t),this._helper&&this.helper.remove(),!1},_updatePrevProperties:function(){this.prevPosition={top:this.position.top,left:this.position.left},this.prevSize={width:this.size.width,height:this.size.height}},_applyChanges:function(){var t={};return this.position.top!==this.prevPosition.top&&(t.top=this.position.top+"px"),this.position.left!==this.prevPosition.left&&(t.left=this.position.left+"px"),this.size.width!==this.prevSize.width&&(t.width=this.size.width+"px"),this.size.height!==this.prevSize.height&&(t.height=this.size.height+"px"),this.helper.css(t),t},_updateVirtualBoundaries:function(t){var e,i,s=this.options,n={minWidth:this._isNumber(s.minWidth)?s.minWidth:0,maxWidth:this._isNumber(s.maxWidth)?s.maxWidth:1/0,minHeight:this._isNumber(s.minHeight)?s.minHeight:0,maxHeight:this._isNumber(s.maxHeight)?s.maxHeight:1/0};(this._aspectRatio||t)&&(e=n.minHeight*this.aspectRatio,i=n.minWidth/this.aspectRatio,s=n.maxHeight*this.aspectRatio,t=n.maxWidth/this.aspectRatio,e>n.minWidth&&(n.minWidth=e),i>n.minHeight&&(n.minHeight=i),s<n.maxWidth&&(n.maxWidth=s),t<n.maxHeight&&(n.maxHeight=t)),this._vBoundaries=n},_updateCache:function(t){this.offset=this.helper.offset(),this._isNumber(t.left)&&(this.position.left=t.left),this._isNumber(t.top)&&(this.position.top=t.top),this._isNumber(t.height)&&(this.size.height=t.height),this._isNumber(t.width)&&(this.size.width=t.width)},_updateRatio:function(t){var e=this.position,i=this.size,s=this.axis;return this._isNumber(t.height)?t.width=t.height*this.aspectRatio:this._isNumber(t.width)&&(t.height=t.width/this.aspectRatio),"sw"===s&&(t.left=e.left+(i.width-t.width),t.top=null),"nw"===s&&(t.top=e.top+(i.height-t.height),t.left=e.left+(i.width-t.width)),t},_respectSize:function(t){var e=this._vBoundaries,i=this.axis,s=this._isNumber(t.width)&&e.maxWidth&&e.maxWidth<t.width,n=this._isNumber(t.height)&&e.maxHeight&&e.maxHeight<t.height,o=this._isNumber(t.width)&&e.minWidth&&e.minWidth>t.width,a=this._isNumber(t.height)&&e.minHeight&&e.minHeight>t.height,r=this.originalPosition.left+this.originalSize.width,l=this.originalPosition.top+this.originalSize.height,h=/sw|nw|w/.test(i),i=/nw|ne|n/.test(i);return o&&(t.width=e.minWidth),a&&(t.height=e.minHeight),s&&(t.width=e.maxWidth),n&&(t.height=e.maxHeight),o&&h&&(t.left=r-e.minWidth),s&&h&&(t.left=r-e.maxWidth),a&&i&&(t.top=l-e.minHeight),n&&i&&(t.top=l-e.maxHeight),t.width||t.height||t.left||!t.top?t.width||t.height||t.top||!t.left||(t.left=null):t.top=null,t},_getPaddingPlusBorderDimensions:function(t){for(var e=0,i=[],s=[t.css("borderTopWidth"),t.css("borderRightWidth"),t.css("borderBottomWidth"),t.css("borderLeftWidth")],n=[t.css("paddingTop"),t.css("paddingRight"),t.css("paddingBottom"),t.css("paddingLeft")];e<4;e++)i[e]=parseFloat(s[e])||0,i[e]+=parseFloat(n[e])||0;return{height:i[0]+i[2],width:i[1]+i[3]}},_proportionallyResize:function(){if(this._proportionallyResizeElements.length)for(var t,e=0,i=this.helper||this.element;e<this._proportionallyResizeElements.length;e++)t=this._proportionallyResizeElements[e],this.outerDimensions||(this.outerDimensions=this._getPaddingPlusBorderDimensions(t)),t.css({height:i.height()-this.outerDimensions.height||0,width:i.width()-this.outerDimensions.width||0})},_renderProxy:function(){var t=this.element,e=this.options;this.elementOffset=t.offset(),this._helper?(this.helper=this.helper||V("<div></div>").css({overflow:"hidden"}),this._addClass(this.helper,this._helper),this.helper.css({width:this.element.outerWidth(),height:this.element.outerHeight(),position:"absolute",left:this.elementOffset.left+"px",top:this.elementOffset.top+"px",zIndex:++e.zIndex}),this.helper.appendTo("body").disableSelection()):this.helper=this.element},_change:{e:function(t,e){return{width:this.originalSize.width+e}},w:function(t,e){var i=this.originalSize;return{left:this.originalPosition.left+e,width:i.width-e}},n:function(t,e,i){var s=this.originalSize;return{top:this.originalPosition.top+i,height:s.height-i}},s:function(t,e,i){return{height:this.originalSize.height+i}},se:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},sw:function(t,e,i){return V.extend(this._change.s.apply(this,arguments),this._change.w.apply(this,[t,e,i]))},ne:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.e.apply(this,[t,e,i]))},nw:function(t,e,i){return V.extend(this._change.n.apply(this,arguments),this._change.w.apply(this,[t,e,i]))}},_propagate:function(t,e){V.ui.plugin.call(this,t,[e,this.ui()]),"resize"!==t&&this._trigger(t,e,this.ui())},plugins:{},ui:function(){return{originalElement:this.originalElement,element:this.element,helper:this.helper,position:this.position,size:this.size,originalSize:this.originalSize,originalPosition:this.originalPosition}}}),V.ui.plugin.add("resizable","animate",{stop:function(e){var i=V(this).resizable("instance"),t=i.options,s=i._proportionallyResizeElements,n=s.length&&/textarea/i.test(s[0].nodeName),o=n&&i._hasScroll(s[0],"left")?0:i.sizeDiff.height,a=n?0:i.sizeDiff.width,n={width:i.size.width-a,height:i.size.height-o},a=parseFloat(i.element.css("left"))+(i.position.left-i.originalPosition.left)||null,o=parseFloat(i.element.css("top"))+(i.position.top-i.originalPosition.top)||null;i.element.animate(V.extend(n,o&&a?{top:o,left:a}:{}),{duration:t.animateDuration,easing:t.animateEasing,step:function(){var t={width:parseFloat(i.element.css("width")),height:parseFloat(i.element.css("height")),top:parseFloat(i.element.css("top")),left:parseFloat(i.element.css("left"))};s&&s.length&&V(s[0]).css({width:t.width,height:t.height}),i._updateCache(t),i._propagate("resize",e)}})}}),V.ui.plugin.add("resizable","containment",{start:function(){var i,s,n=V(this).resizable("instance"),t=n.options,e=n.element,o=t.containment,a=o instanceof V?o.get(0):/parent/.test(o)?e.parent().get(0):o;a&&(n.containerElement=V(a),/document/.test(o)||o===document?(n.containerOffset={left:0,top:0},n.containerPosition={left:0,top:0},n.parentData={element:V(document),left:0,top:0,width:V(document).width(),height:V(document).height()||document.body.parentNode.scrollHeight}):(i=V(a),s=[],V(["Top","Right","Left","Bottom"]).each(function(t,e){s[t]=n._num(i.css("padding"+e))}),n.containerOffset=i.offset(),n.containerPosition=i.position(),n.containerSize={height:i.innerHeight()-s[3],width:i.innerWidth()-s[1]},t=n.containerOffset,e=n.containerSize.height,o=n.containerSize.width,o=n._hasScroll(a,"left")?a.scrollWidth:o,e=n._hasScroll(a)?a.scrollHeight:e,n.parentData={element:a,left:t.left,top:t.top,width:o,height:e}))},resize:function(t){var e=V(this).resizable("instance"),i=e.options,s=e.containerOffset,n=e.position,o=e._aspectRatio||t.shiftKey,a={top:0,left:0},r=e.containerElement,t=!0;r[0]!==document&&/static/.test(r.css("position"))&&(a=s),n.left<(e._helper?s.left:0)&&(e.size.width=e.size.width+(e._helper?e.position.left-s.left:e.position.left-a.left),o&&(e.size.height=e.size.width/e.aspectRatio,t=!1),e.position.left=i.helper?s.left:0),n.top<(e._helper?s.top:0)&&(e.size.height=e.size.height+(e._helper?e.position.top-s.top:e.position.top),o&&(e.size.width=e.size.height*e.aspectRatio,t=!1),e.position.top=e._helper?s.top:0),i=e.containerElement.get(0)===e.element.parent().get(0),n=/relative|absolute/.test(e.containerElement.css("position")),i&&n?(e.offset.left=e.parentData.left+e.position.left,e.offset.top=e.parentData.top+e.position.top):(e.offset.left=e.element.offset().left,e.offset.top=e.element.offset().top),n=Math.abs(e.sizeDiff.width+(e._helper?e.offset.left-a.left:e.offset.left-s.left)),s=Math.abs(e.sizeDiff.height+(e._helper?e.offset.top-a.top:e.offset.top-s.top)),n+e.size.width>=e.parentData.width&&(e.size.width=e.parentData.width-n,o&&(e.size.height=e.size.width/e.aspectRatio,t=!1)),s+e.size.height>=e.parentData.height&&(e.size.height=e.parentData.height-s,o&&(e.size.width=e.size.height*e.aspectRatio,t=!1)),t||(e.position.left=e.prevPosition.left,e.position.top=e.prevPosition.top,e.size.width=e.prevSize.width,e.size.height=e.prevSize.height)},stop:function(){var t=V(this).resizable("instance"),e=t.options,i=t.containerOffset,s=t.containerPosition,n=t.containerElement,o=V(t.helper),a=o.offset(),r=o.outerWidth()-t.sizeDiff.width,o=o.outerHeight()-t.sizeDiff.height;t._helper&&!e.animate&&/relative/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o}),t._helper&&!e.animate&&/static/.test(n.css("position"))&&V(this).css({left:a.left-s.left-i.left,width:r,height:o})}}),V.ui.plugin.add("resizable","alsoResize",{start:function(){var t=V(this).resizable("instance").options;V(t.alsoResize).each(function(){var t=V(this);t.data("ui-resizable-alsoresize",{width:parseFloat(t.width()),height:parseFloat(t.height()),left:parseFloat(t.css("left")),top:parseFloat(t.css("top"))})})},resize:function(t,i){var e=V(this).resizable("instance"),s=e.options,n=e.originalSize,o=e.originalPosition,a={height:e.size.height-n.height||0,width:e.size.width-n.width||0,top:e.position.top-o.top||0,left:e.position.left-o.left||0};V(s.alsoResize).each(function(){var t=V(this),s=V(this).data("ui-resizable-alsoresize"),n={},e=t.parents(i.originalElement[0]).length?["width","height"]:["width","height","top","left"];V.each(e,function(t,e){var i=(s[e]||0)+(a[e]||0);i&&0<=i&&(n[e]=i||null)}),t.css(n)})},stop:function(){V(this).removeData("ui-resizable-alsoresize")}}),V.ui.plugin.add("resizable","ghost",{start:function(){var t=V(this).resizable("instance"),e=t.size;t.ghost=t.originalElement.clone(),t.ghost.css({opacity:.25,display:"block",position:"relative",height:e.height,width:e.width,margin:0,left:0,top:0}),t._addClass(t.ghost,"ui-resizable-ghost"),!1!==V.uiBackCompat&&"string"==typeof t.options.ghost&&t.ghost.addClass(this.options.ghost),t.ghost.appendTo(t.helper)},resize:function(){var t=V(this).resizable("instance");t.ghost&&t.ghost.css({position:"relative",height:t.size.height,width:t.size.width})},stop:function(){var t=V(this).resizable("instance");t.ghost&&t.helper&&t.helper.get(0).removeChild(t.ghost.get(0))}}),V.ui.plugin.add("resizable","grid",{resize:function(){var t,e=V(this).resizable("instance"),i=e.options,s=e.size,n=e.originalSize,o=e.originalPosition,a=e.axis,r="number"==typeof i.grid?[i.grid,i.grid]:i.grid,l=r[0]||1,h=r[1]||1,c=Math.round((s.width-n.width)/l)*l,u=Math.round((s.height-n.height)/h)*h,d=n.width+c,p=n.height+u,f=i.maxWidth&&i.maxWidth<d,g=i.maxHeight&&i.maxHeight<p,m=i.minWidth&&i.minWidth>d,s=i.minHeight&&i.minHeight>p;i.grid=r,m&&(d+=l),s&&(p+=h),f&&(d-=l),g&&(p-=h),/^(se|s|e)$/.test(a)?(e.size.width=d,e.size.height=p):/^(ne)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.top=o.top-u):/^(sw)$/.test(a)?(e.size.width=d,e.size.height=p,e.position.left=o.left-c):((p-h<=0||d-l<=0)&&(t=e._getPaddingPlusBorderDimensions(this)),0<p-h?(e.size.height=p,e.position.top=o.top-u):(p=h-t.height,e.size.height=p,e.position.top=o.top+n.height-p),0<d-l?(e.size.width=d,e.position.left=o.left-c):(d=l-t.width,e.size.width=d,e.position.left=o.left+n.width-d))}});V.ui.resizable;V.widget("ui.dialog",{version:"1.13.2",options:{appendTo:"body",autoOpen:!0,buttons:[],classes:{"ui-dialog":"ui-corner-all","ui-dialog-titlebar":"ui-corner-all"},closeOnEscape:!0,closeText:"Close",draggable:!0,hide:null,height:"auto",maxHeight:null,maxWidth:null,minHeight:150,minWidth:150,modal:!1,position:{my:"center",at:"center",of:window,collision:"fit",using:function(t){var e=V(this).css(t).offset().top;e<0&&V(this).css("top",t.top-e)}},resizable:!0,show:null,title:null,width:300,beforeClose:null,close:null,drag:null,dragStart:null,dragStop:null,focus:null,open:null,resize:null,resizeStart:null,resizeStop:null},sizeRelatedOptions:{buttons:!0,height:!0,maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0,width:!0},resizableRelatedOptions:{maxHeight:!0,maxWidth:!0,minHeight:!0,minWidth:!0},_create:function(){this.originalCss={display:this.element[0].style.display,width:this.element[0].style.width,minHeight:this.element[0].style.minHeight,maxHeight:this.element[0].style.maxHeight,height:this.element[0].style.height},this.originalPosition={parent:this.element.parent(),index:this.element.parent().children().index(this.element)},this.originalTitle=this.element.attr("title"),null==this.options.title&&null!=this.originalTitle&&(this.options.title=this.originalTitle),this.options.disabled&&(this.options.disabled=!1),this._createWrapper(),this.element.show().removeAttr("title").appendTo(this.uiDialog),this._addClass("ui-dialog-content","ui-widget-content"),this._createTitlebar(),this._createButtonPane(),this.options.draggable&&V.fn.draggable&&this._makeDraggable(),this.options.resizable&&V.fn.resizable&&this._makeResizable(),this._isOpen=!1,this._trackFocus()},_init:function(){this.options.autoOpen&&this.open()},_appendTo:function(){var t=this.options.appendTo;return t&&(t.jquery||t.nodeType)?V(t):this.document.find(t||"body").eq(0)},_destroy:function(){var t,e=this.originalPosition;this._untrackInstance(),this._destroyOverlay(),this.element.removeUniqueId().css(this.originalCss).detach(),this.uiDialog.remove(),this.originalTitle&&this.element.attr("title",this.originalTitle),(t=e.parent.children().eq(e.index)).length&&t[0]!==this.element[0]?t.before(this.element):e.parent.append(this.element)},widget:function(){return this.uiDialog},disable:V.noop,enable:V.noop,close:function(t){var e=this;this._isOpen&&!1!==this._trigger("beforeClose",t)&&(this._isOpen=!1,this._focusedElement=null,this._destroyOverlay(),this._untrackInstance(),this.opener.filter(":focusable").trigger("focus").length||V.ui.safeBlur(V.ui.safeActiveElement(this.document[0])),this._hide(this.uiDialog,this.options.hide,function(){e._trigger("close",t)}))},isOpen:function(){return this._isOpen},moveToTop:function(){this._moveToTop()},_moveToTop:function(t,e){var i=!1,s=this.uiDialog.siblings(".ui-front:visible").map(function(){return+V(this).css("z-index")}).get(),s=Math.max.apply(null,s);return s>=+this.uiDialog.css("z-index")&&(this.uiDialog.css("z-index",s+1),i=!0),i&&!e&&this._trigger("focus",t),i},open:function(){var t=this;this._isOpen?this._moveToTop()&&this._focusTabbable():(this._isOpen=!0,this.opener=V(V.ui.safeActiveElement(this.document[0])),this._size(),this._position(),this._createOverlay(),this._moveToTop(null,!0),this.overlay&&this.overlay.css("z-index",this.uiDialog.css("z-index")-1),this._show(this.uiDialog,this.options.show,function(){t._focusTabbable(),t._trigger("focus")}),this._makeFocusTarget(),this._trigger("open"))},_focusTabbable:function(){var t=this._focusedElement;(t=!(t=!(t=!(t=!(t=t||this.element.find("[autofocus]")).length?this.element.find(":tabbable"):t).length?this.uiDialogButtonPane.find(":tabbable"):t).length?this.uiDialogTitlebarClose.filter(":tabbable"):t).length?this.uiDialog:t).eq(0).trigger("focus")},_restoreTabbableFocus:function(){var t=V.ui.safeActiveElement(this.document[0]);this.uiDialog[0]===t||V.contains(this.uiDialog[0],t)||this._focusTabbable()},_keepFocus:function(t){t.preventDefault(),this._restoreTabbableFocus(),this._delay(this._restoreTabbableFocus)},_createWrapper:function(){this.uiDialog=V("<div>").hide().attr({tabIndex:-1,role:"dialog"}).appendTo(this._appendTo()),this._addClass(this.uiDialog,"ui-dialog","ui-widget ui-widget-content ui-front"),this._on(this.uiDialog,{keydown:function(t){if(this.options.closeOnEscape&&!t.isDefaultPrevented()&&t.keyCode&&t.keyCode===V.ui.keyCode.ESCAPE)return t.preventDefault(),void this.close(t);var e,i,s;t.keyCode!==V.ui.keyCode.TAB||t.isDefaultPrevented()||(e=this.uiDialog.find(":tabbable"),i=e.first(),s=e.last(),t.target!==s[0]&&t.target!==this.uiDialog[0]||t.shiftKey?t.target!==i[0]&&t.target!==this.uiDialog[0]||!t.shiftKey||(this._delay(function(){s.trigger("focus")}),t.preventDefault()):(this._delay(function(){i.trigger("focus")}),t.preventDefault()))},mousedown:function(t){this._moveToTop(t)&&this._focusTabbable()}}),this.element.find("[aria-describedby]").length||this.uiDialog.attr({"aria-describedby":this.element.uniqueId().attr("id")})},_createTitlebar:function(){var t;this.uiDialogTitlebar=V("<div>"),this._addClass(this.uiDialogTitlebar,"ui-dialog-titlebar","ui-widget-header ui-helper-clearfix"),this._on(this.uiDialogTitlebar,{mousedown:function(t){V(t.target).closest(".ui-dialog-titlebar-close")||this.uiDialog.trigger("focus")}}),this.uiDialogTitlebarClose=V("<button type='button'></button>").button({label:V("<a>").text(this.options.closeText).html(),icon:"ui-icon-closethick",showLabel:!1}).appendTo(this.uiDialogTitlebar),this._addClass(this.uiDialogTitlebarClose,"ui-dialog-titlebar-close"),this._on(this.uiDialogTitlebarClose,{click:function(t){t.preventDefault(),this.close(t)}}),t=V("<span>").uniqueId().prependTo(this.uiDialogTitlebar),this._addClass(t,"ui-dialog-title"),this._title(t),this.uiDialogTitlebar.prependTo(this.uiDialog),this.uiDialog.attr({"aria-labelledby":t.attr("id")})},_title:function(t){this.options.title?t.text(this.options.title):t.html(" ")},_createButtonPane:function(){this.uiDialogButtonPane=V("<div>"),this._addClass(this.uiDialogButtonPane,"ui-dialog-buttonpane","ui-widget-content ui-helper-clearfix"),this.uiButtonSet=V("<div>").appendTo(this.uiDialogButtonPane),this._addClass(this.uiButtonSet,"ui-dialog-buttonset"),this._createButtons()},_createButtons:function(){var s=this,t=this.options.buttons;this.uiDialogButtonPane.remove(),this.uiButtonSet.empty(),V.isEmptyObject(t)||Array.isArray(t)&&!t.length?this._removeClass(this.uiDialog,"ui-dialog-buttons"):(V.each(t,function(t,e){var i;e=V.extend({type:"button"},e="function"==typeof e?{click:e,text:t}:e),i=e.click,t={icon:e.icon,iconPosition:e.iconPosition,showLabel:e.showLabel,icons:e.icons,text:e.text},delete e.click,delete e.icon,delete e.iconPosition,delete e.showLabel,delete e.icons,"boolean"==typeof e.text&&delete e.text,V("<button></button>",e).button(t).appendTo(s.uiButtonSet).on("click",function(){i.apply(s.element[0],arguments)})}),this._addClass(this.uiDialog,"ui-dialog-buttons"),this.uiDialogButtonPane.appendTo(this.uiDialog))},_makeDraggable:function(){var n=this,o=this.options;function a(t){return{position:t.position,offset:t.offset}}this.uiDialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(t,e){n._addClass(V(this),"ui-dialog-dragging"),n._blockFrames(),n._trigger("dragStart",t,a(e))},drag:function(t,e){n._trigger("drag",t,a(e))},stop:function(t,e){var i=e.offset.left-n.document.scrollLeft(),s=e.offset.top-n.document.scrollTop();o.position={my:"left top",at:"left"+(0<=i?"+":"")+i+" top"+(0<=s?"+":"")+s,of:n.window},n._removeClass(V(this),"ui-dialog-dragging"),n._unblockFrames(),n._trigger("dragStop",t,a(e))}})},_makeResizable:function(){var n=this,o=this.options,t=o.resizable,e=this.uiDialog.css("position"),t="string"==typeof t?t:"n,e,s,w,se,sw,ne,nw";function a(t){return{originalPosition:t.originalPosition,originalSize:t.originalSize,position:t.position,size:t.size}}this.uiDialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoResize:this.element,maxWidth:o.maxWidth,maxHeight:o.maxHeight,minWidth:o.minWidth,minHeight:this._minHeight(),handles:t,start:function(t,e){n._addClass(V(this),"ui-dialog-resizing"),n._blockFrames(),n._trigger("resizeStart",t,a(e))},resize:function(t,e){n._trigger("resize",t,a(e))},stop:function(t,e){var i=n.uiDialog.offset(),s=i.left-n.document.scrollLeft(),i=i.top-n.document.scrollTop();o.height=n.uiDialog.height(),o.width=n.uiDialog.width(),o.position={my:"left top",at:"left"+(0<=s?"+":"")+s+" top"+(0<=i?"+":"")+i,of:n.window},n._removeClass(V(this),"ui-dialog-resizing"),n._unblockFrames(),n._trigger("resizeStop",t,a(e))}}).css("position",e)},_trackFocus:function(){this._on(this.widget(),{focusin:function(t){this._makeFocusTarget(),this._focusedElement=V(t.target)}})},_makeFocusTarget:function(){this._untrackInstance(),this._trackingInstances().unshift(this)},_untrackInstance:function(){var t=this._trackingInstances(),e=V.inArray(this,t);-1!==e&&t.splice(e,1)},_trackingInstances:function(){var t=this.document.data("ui-dialog-instances");return t||this.document.data("ui-dialog-instances",t=[]),t},_minHeight:function(){var t=this.options;return"auto"===t.height?t.minHeight:Math.min(t.minHeight,t.height)},_position:function(){var t=this.uiDialog.is(":visible");t||this.uiDialog.show(),this.uiDialog.position(this.options.position),t||this.uiDialog.hide()},_setOptions:function(t){var i=this,s=!1,n={};V.each(t,function(t,e){i._setOption(t,e),t in i.sizeRelatedOptions&&(s=!0),t in i.resizableRelatedOptions&&(n[t]=e)}),s&&(this._size(),this._position()),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option",n)},_setOption:function(t,e){var i,s=this.uiDialog;"disabled"!==t&&(this._super(t,e),"appendTo"===t&&this.uiDialog.appendTo(this._appendTo()),"buttons"===t&&this._createButtons(),"closeText"===t&&this.uiDialogTitlebarClose.button({label:V("<a>").text(""+this.options.closeText).html()}),"draggable"===t&&((i=s.is(":data(ui-draggable)"))&&!e&&s.draggable("destroy"),!i&&e&&this._makeDraggable()),"position"===t&&this._position(),"resizable"===t&&((i=s.is(":data(ui-resizable)"))&&!e&&s.resizable("destroy"),i&&"string"==typeof e&&s.resizable("option","handles",e),i||!1===e||this._makeResizable()),"title"===t&&this._title(this.uiDialogTitlebar.find(".ui-dialog-title")))},_size:function(){var t,e,i,s=this.options;this.element.show().css({width:"auto",minHeight:0,maxHeight:"none",height:0}),s.minWidth>s.width&&(s.width=s.minWidth),t=this.uiDialog.css({height:"auto",width:s.width}).outerHeight(),e=Math.max(0,s.minHeight-t),i="number"==typeof s.maxHeight?Math.max(0,s.maxHeight-t):"none","auto"===s.height?this.element.css({minHeight:e,maxHeight:i,height:"auto"}):this.element.height(Math.max(0,s.height-t)),this.uiDialog.is(":data(ui-resizable)")&&this.uiDialog.resizable("option","minHeight",this._minHeight())},_blockFrames:function(){this.iframeBlocks=this.document.find("iframe").map(function(){var t=V(this);return V("<div>").css({position:"absolute",width:t.outerWidth(),height:t.outerHeight()}).appendTo(t.parent()).offset(t.offset())[0]})},_unblockFrames:function(){this.iframeBlocks&&(this.iframeBlocks.remove(),delete this.iframeBlocks)},_allowInteraction:function(t){return!!V(t.target).closest(".ui-dialog").length||!!V(t.target).closest(".ui-datepicker").length},_createOverlay:function(){var i,s;this.options.modal&&(i=V.fn.jquery.substring(0,4),s=!0,this._delay(function(){s=!1}),this.document.data("ui-dialog-overlays")||this.document.on("focusin.ui-dialog",function(t){var e;s||((e=this._trackingInstances()[0])._allowInteraction(t)||(t.preventDefault(),e._focusTabbable(),"3.4."!==i&&"3.5."!==i||e._delay(e._restoreTabbableFocus)))}.bind(this)),this.overlay=V("<div>").appendTo(this._appendTo()),this._addClass(this.overlay,null,"ui-widget-overlay ui-front"),this._on(this.overlay,{mousedown:"_keepFocus"}),this.document.data("ui-dialog-overlays",(this.document.data("ui-dialog-overlays")||0)+1))},_destroyOverlay:function(){var t;this.options.modal&&this.overlay&&((t=this.document.data("ui-dialog-overlays")-1)?this.document.data("ui-dialog-overlays",t):(this.document.off("focusin.ui-dialog"),this.document.removeData("ui-dialog-overlays")),this.overlay.remove(),this.overlay=null)}}),!1!==V.uiBackCompat&&V.widget("ui.dialog",V.ui.dialog,{options:{dialogClass:""},_createWrapper:function(){this._super(),this.uiDialog.addClass(this.options.dialogClass)},_setOption:function(t,e){"dialogClass"===t&&this.uiDialog.removeClass(this.options.dialogClass).addClass(e),this._superApply(arguments)}});V.ui.dialog;function lt(t,e,i){return e<=t&&t<e+i}V.widget("ui.droppable",{version:"1.13.2",widgetEventPrefix:"drop",options:{accept:"*",addClasses:!0,greedy:!1,scope:"default",tolerance:"intersect",activate:null,deactivate:null,drop:null,out:null,over:null},_create:function(){var t,e=this.options,i=e.accept;this.isover=!1,this.isout=!0,this.accept="function"==typeof i?i:function(t){return t.is(i)},this.proportions=function(){if(!arguments.length)return t=t||{width:this.element[0].offsetWidth,height:this.element[0].offsetHeight};t=arguments[0]},this._addToManager(e.scope),e.addClasses&&this._addClass("ui-droppable")},_addToManager:function(t){V.ui.ddmanager.droppables[t]=V.ui.ddmanager.droppables[t]||[],V.ui.ddmanager.droppables[t].push(this)},_splice:function(t){for(var e=0;e<t.length;e++)t[e]===this&&t.splice(e,1)},_destroy:function(){var t=V.ui.ddmanager.droppables[this.options.scope];this._splice(t)},_setOption:function(t,e){var i;"accept"===t?this.accept="function"==typeof e?e:function(t){return t.is(e)}:"scope"===t&&(i=V.ui.ddmanager.droppables[this.options.scope],this._splice(i),this._addToManager(e)),this._super(t,e)},_activate:function(t){var e=V.ui.ddmanager.current;this._addActiveClass(),e&&this._trigger("activate",t,this.ui(e))},_deactivate:function(t){var e=V.ui.ddmanager.current;this._removeActiveClass(),e&&this._trigger("deactivate",t,this.ui(e))},_over:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._addHoverClass(),this._trigger("over",t,this.ui(e)))},_out:function(t){var e=V.ui.ddmanager.current;e&&(e.currentItem||e.element)[0]!==this.element[0]&&this.accept.call(this.element[0],e.currentItem||e.element)&&(this._removeHoverClass(),this._trigger("out",t,this.ui(e)))},_drop:function(e,t){var i=t||V.ui.ddmanager.current,s=!1;return!(!i||(i.currentItem||i.element)[0]===this.element[0])&&(this.element.find(":data(ui-droppable)").not(".ui-draggable-dragging").each(function(){var t=V(this).droppable("instance");if(t.options.greedy&&!t.options.disabled&&t.options.scope===i.options.scope&&t.accept.call(t.element[0],i.currentItem||i.element)&&V.ui.intersect(i,V.extend(t,{offset:t.element.offset()}),t.options.tolerance,e))return!(s=!0)}),!s&&(!!this.accept.call(this.element[0],i.currentItem||i.element)&&(this._removeActiveClass(),this._removeHoverClass(),this._trigger("drop",e,this.ui(i)),this.element)))},ui:function(t){return{draggable:t.currentItem||t.element,helper:t.helper,position:t.position,offset:t.positionAbs}},_addHoverClass:function(){this._addClass("ui-droppable-hover")},_removeHoverClass:function(){this._removeClass("ui-droppable-hover")},_addActiveClass:function(){this._addClass("ui-droppable-active")},_removeActiveClass:function(){this._removeClass("ui-droppable-active")}}),V.ui.intersect=function(t,e,i,s){if(!e.offset)return!1;var n=(t.positionAbs||t.position.absolute).left+t.margins.left,o=(t.positionAbs||t.position.absolute).top+t.margins.top,a=n+t.helperProportions.width,r=o+t.helperProportions.height,l=e.offset.left,h=e.offset.top,c=l+e.proportions().width,u=h+e.proportions().height;switch(i){case"fit":return l<=n&&a<=c&&h<=o&&r<=u;case"intersect":return l<n+t.helperProportions.width/2&&a-t.helperProportions.width/2<c&&h<o+t.helperProportions.height/2&&r-t.helperProportions.height/2<u;case"pointer":return lt(s.pageY,h,e.proportions().height)&<(s.pageX,l,e.proportions().width);case"touch":return(h<=o&&o<=u||h<=r&&r<=u||o<h&&u<r)&&(l<=n&&n<=c||l<=a&&a<=c||n<l&&c<a);default:return!1}},!(V.ui.ddmanager={current:null,droppables:{default:[]},prepareOffsets:function(t,e){var i,s,n=V.ui.ddmanager.droppables[t.options.scope]||[],o=e?e.type:null,a=(t.currentItem||t.element).find(":data(ui-droppable)").addBack();t:for(i=0;i<n.length;i++)if(!(n[i].options.disabled||t&&!n[i].accept.call(n[i].element[0],t.currentItem||t.element))){for(s=0;s<a.length;s++)if(a[s]===n[i].element[0]){n[i].proportions().height=0;continue t}n[i].visible="none"!==n[i].element.css("display"),n[i].visible&&("mousedown"===o&&n[i]._activate.call(n[i],e),n[i].offset=n[i].element.offset(),n[i].proportions({width:n[i].element[0].offsetWidth,height:n[i].element[0].offsetHeight}))}},drop:function(t,e){var i=!1;return V.each((V.ui.ddmanager.droppables[t.options.scope]||[]).slice(),function(){this.options&&(!this.options.disabled&&this.visible&&V.ui.intersect(t,this,this.options.tolerance,e)&&(i=this._drop.call(this,e)||i),!this.options.disabled&&this.visible&&this.accept.call(this.element[0],t.currentItem||t.element)&&(this.isout=!0,this.isover=!1,this._deactivate.call(this,e)))}),i},dragStart:function(t,e){t.element.parentsUntil("body").on("scroll.droppable",function(){t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)})},drag:function(n,o){n.options.refreshPositions&&V.ui.ddmanager.prepareOffsets(n,o),V.each(V.ui.ddmanager.droppables[n.options.scope]||[],function(){var t,e,i,s;this.options.disabled||this.greedyChild||!this.visible||(s=!(i=V.ui.intersect(n,this,this.options.tolerance,o))&&this.isover?"isout":i&&!this.isover?"isover":null)&&(this.options.greedy&&(e=this.options.scope,(i=this.element.parents(":data(ui-droppable)").filter(function(){return V(this).droppable("instance").options.scope===e})).length&&((t=V(i[0]).droppable("instance")).greedyChild="isover"===s)),t&&"isover"===s&&(t.isover=!1,t.isout=!0,t._out.call(t,o)),this[s]=!0,this["isout"===s?"isover":"isout"]=!1,this["isover"===s?"_over":"_out"].call(this,o),t&&"isout"===s&&(t.isout=!1,t.isover=!0,t._over.call(t,o)))})},dragStop:function(t,e){t.element.parentsUntil("body").off("scroll.droppable"),t.options.refreshPositions||V.ui.ddmanager.prepareOffsets(t,e)}})!==V.uiBackCompat&&V.widget("ui.droppable",V.ui.droppable,{options:{hoverClass:!1,activeClass:!1},_addActiveClass:function(){this._super(),this.options.activeClass&&this.element.addClass(this.options.activeClass)},_removeActiveClass:function(){this._super(),this.options.activeClass&&this.element.removeClass(this.options.activeClass)},_addHoverClass:function(){this._super(),this.options.hoverClass&&this.element.addClass(this.options.hoverClass)},_removeHoverClass:function(){this._super(),this.options.hoverClass&&this.element.removeClass(this.options.hoverClass)}});V.ui.droppable,V.widget("ui.progressbar",{version:"1.13.2",options:{classes:{"ui-progressbar":"ui-corner-all","ui-progressbar-value":"ui-corner-left","ui-progressbar-complete":"ui-corner-right"},max:100,value:0,change:null,complete:null},min:0,_create:function(){this.oldValue=this.options.value=this._constrainedValue(),this.element.attr({role:"progressbar","aria-valuemin":this.min}),this._addClass("ui-progressbar","ui-widget ui-widget-content"),this.valueDiv=V("<div>").appendTo(this.element),this._addClass(this.valueDiv,"ui-progressbar-value","ui-widget-header"),this._refreshValue()},_destroy:function(){this.element.removeAttr("role aria-valuemin aria-valuemax aria-valuenow"),this.valueDiv.remove()},value:function(t){if(void 0===t)return this.options.value;this.options.value=this._constrainedValue(t),this._refreshValue()},_constrainedValue:function(t){return void 0===t&&(t=this.options.value),this.indeterminate=!1===t,"number"!=typeof t&&(t=0),!this.indeterminate&&Math.min(this.options.max,Math.max(this.min,t))},_setOptions:function(t){var e=t.value;delete t.value,this._super(t),this.options.value=this._constrainedValue(e),this._refreshValue()},_setOption:function(t,e){"max"===t&&(e=Math.max(this.min,e)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this.element.attr("aria-disabled",t),this._toggleClass(null,"ui-state-disabled",!!t)},_percentage:function(){return this.indeterminate?100:100*(this.options.value-this.min)/(this.options.max-this.min)},_refreshValue:function(){var t=this.options.value,e=this._percentage();this.valueDiv.toggle(this.indeterminate||t>this.min).width(e.toFixed(0)+"%"),this._toggleClass(this.valueDiv,"ui-progressbar-complete",null,t===this.options.max)._toggleClass("ui-progressbar-indeterminate",null,this.indeterminate),this.indeterminate?(this.element.removeAttr("aria-valuenow"),this.overlayDiv||(this.overlayDiv=V("<div>").appendTo(this.valueDiv),this._addClass(this.overlayDiv,"ui-progressbar-overlay"))):(this.element.attr({"aria-valuemax":this.options.max,"aria-valuenow":t}),this.overlayDiv&&(this.overlayDiv.remove(),this.overlayDiv=null)),this.oldValue!==t&&(this.oldValue=t,this._trigger("change")),t===this.options.max&&this._trigger("complete")}}),V.widget("ui.selectable",V.ui.mouse,{version:"1.13.2",options:{appendTo:"body",autoRefresh:!0,distance:0,filter:"*",tolerance:"touch",selected:null,selecting:null,start:null,stop:null,unselected:null,unselecting:null},_create:function(){var i=this;this._addClass("ui-selectable"),this.dragged=!1,this.refresh=function(){i.elementPos=V(i.element[0]).offset(),i.selectees=V(i.options.filter,i.element[0]),i._addClass(i.selectees,"ui-selectee"),i.selectees.each(function(){var t=V(this),e=t.offset(),e={left:e.left-i.elementPos.left,top:e.top-i.elementPos.top};V.data(this,"selectable-item",{element:this,$element:t,left:e.left,top:e.top,right:e.left+t.outerWidth(),bottom:e.top+t.outerHeight(),startselected:!1,selected:t.hasClass("ui-selected"),selecting:t.hasClass("ui-selecting"),unselecting:t.hasClass("ui-unselecting")})})},this.refresh(),this._mouseInit(),this.helper=V("<div>"),this._addClass(this.helper,"ui-selectable-helper")},_destroy:function(){this.selectees.removeData("selectable-item"),this._mouseDestroy()},_mouseStart:function(i){var s=this,t=this.options;this.opos=[i.pageX,i.pageY],this.elementPos=V(this.element[0]).offset(),this.options.disabled||(this.selectees=V(t.filter,this.element[0]),this._trigger("start",i),V(t.appendTo).append(this.helper),this.helper.css({left:i.pageX,top:i.pageY,width:0,height:0}),t.autoRefresh&&this.refresh(),this.selectees.filter(".ui-selected").each(function(){var t=V.data(this,"selectable-item");t.startselected=!0,i.metaKey||i.ctrlKey||(s._removeClass(t.$element,"ui-selected"),t.selected=!1,s._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,s._trigger("unselecting",i,{unselecting:t.element}))}),V(i.target).parents().addBack().each(function(){var t,e=V.data(this,"selectable-item");if(e)return t=!i.metaKey&&!i.ctrlKey||!e.$element.hasClass("ui-selected"),s._removeClass(e.$element,t?"ui-unselecting":"ui-selected")._addClass(e.$element,t?"ui-selecting":"ui-unselecting"),e.unselecting=!t,e.selecting=t,(e.selected=t)?s._trigger("selecting",i,{selecting:e.element}):s._trigger("unselecting",i,{unselecting:e.element}),!1}))},_mouseDrag:function(s){if(this.dragged=!0,!this.options.disabled){var t,n=this,o=this.options,a=this.opos[0],r=this.opos[1],l=s.pageX,h=s.pageY;return l<a&&(t=l,l=a,a=t),h<r&&(t=h,h=r,r=t),this.helper.css({left:a,top:r,width:l-a,height:h-r}),this.selectees.each(function(){var t=V.data(this,"selectable-item"),e=!1,i={};t&&t.element!==n.element[0]&&(i.left=t.left+n.elementPos.left,i.right=t.right+n.elementPos.left,i.top=t.top+n.elementPos.top,i.bottom=t.bottom+n.elementPos.top,"touch"===o.tolerance?e=!(i.left>l||i.right<a||i.top>h||i.bottom<r):"fit"===o.tolerance&&(e=i.left>a&&i.right<l&&i.top>r&&i.bottom<h),e?(t.selected&&(n._removeClass(t.$element,"ui-selected"),t.selected=!1),t.unselecting&&(n._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1),t.selecting||(n._addClass(t.$element,"ui-selecting"),t.selecting=!0,n._trigger("selecting",s,{selecting:t.element}))):(t.selecting&&((s.metaKey||s.ctrlKey)&&t.startselected?(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,n._addClass(t.$element,"ui-selected"),t.selected=!0):(n._removeClass(t.$element,"ui-selecting"),t.selecting=!1,t.startselected&&(n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0),n._trigger("unselecting",s,{unselecting:t.element}))),t.selected&&(s.metaKey||s.ctrlKey||t.startselected||(n._removeClass(t.$element,"ui-selected"),t.selected=!1,n._addClass(t.$element,"ui-unselecting"),t.unselecting=!0,n._trigger("unselecting",s,{unselecting:t.element})))))}),!1}},_mouseStop:function(e){var i=this;return this.dragged=!1,V(".ui-unselecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-unselecting"),t.unselecting=!1,t.startselected=!1,i._trigger("unselected",e,{unselected:t.element})}),V(".ui-selecting",this.element[0]).each(function(){var t=V.data(this,"selectable-item");i._removeClass(t.$element,"ui-selecting")._addClass(t.$element,"ui-selected"),t.selecting=!1,t.selected=!0,t.startselected=!0,i._trigger("selected",e,{selected:t.element})}),this._trigger("stop",e),this.helper.remove(),!1}}),V.widget("ui.selectmenu",[V.ui.formResetMixin,{version:"1.13.2",defaultElement:"<select>",options:{appendTo:null,classes:{"ui-selectmenu-button-open":"ui-corner-top","ui-selectmenu-button-closed":"ui-corner-all"},disabled:null,icons:{button:"ui-icon-triangle-1-s"},position:{my:"left top",at:"left bottom",collision:"none"},width:!1,change:null,close:null,focus:null,open:null,select:null},_create:function(){var t=this.element.uniqueId().attr("id");this.ids={element:t,button:t+"-button",menu:t+"-menu"},this._drawButton(),this._drawMenu(),this._bindFormResetHandler(),this._rendered=!1,this.menuItems=V()},_drawButton:function(){var t,e=this,i=this._parseOption(this.element.find("option:selected"),this.element[0].selectedIndex);this.labels=this.element.labels().attr("for",this.ids.button),this._on(this.labels,{click:function(t){this.button.trigger("focus"),t.preventDefault()}}),this.element.hide(),this.button=V("<span>",{tabindex:this.options.disabled?-1:0,id:this.ids.button,role:"combobox","aria-expanded":"false","aria-autocomplete":"list","aria-owns":this.ids.menu,"aria-haspopup":"true",title:this.element.attr("title")}).insertAfter(this.element),this._addClass(this.button,"ui-selectmenu-button ui-selectmenu-button-closed","ui-button ui-widget"),t=V("<span>").appendTo(this.button),this._addClass(t,"ui-selectmenu-icon","ui-icon "+this.options.icons.button),this.buttonItem=this._renderButtonItem(i).appendTo(this.button),!1!==this.options.width&&this._resizeButton(),this._on(this.button,this._buttonEvents),this.button.one("focusin",function(){e._rendered||e._refreshMenu()})},_drawMenu:function(){var i=this;this.menu=V("<ul>",{"aria-hidden":"true","aria-labelledby":this.ids.button,id:this.ids.menu}),this.menuWrap=V("<div>").append(this.menu),this._addClass(this.menuWrap,"ui-selectmenu-menu","ui-front"),this.menuWrap.appendTo(this._appendTo()),this.menuInstance=this.menu.menu({classes:{"ui-menu":"ui-corner-bottom"},role:"listbox",select:function(t,e){t.preventDefault(),i._setSelection(),i._select(e.item.data("ui-selectmenu-item"),t)},focus:function(t,e){e=e.item.data("ui-selectmenu-item");null!=i.focusIndex&&e.index!==i.focusIndex&&(i._trigger("focus",t,{item:e}),i.isOpen||i._select(e,t)),i.focusIndex=e.index,i.button.attr("aria-activedescendant",i.menuItems.eq(e.index).attr("id"))}}).menu("instance"),this.menuInstance._off(this.menu,"mouseleave"),this.menuInstance._closeOnDocumentClick=function(){return!1},this.menuInstance._isDivider=function(){return!1}},refresh:function(){this._refreshMenu(),this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(this._getSelectedItem().data("ui-selectmenu-item")||{})),null===this.options.width&&this._resizeButton()},_refreshMenu:function(){var t=this.element.find("option");this.menu.empty(),this._parseOptions(t),this._renderMenu(this.menu,this.items),this.menuInstance.refresh(),this.menuItems=this.menu.find("li").not(".ui-selectmenu-optgroup").find(".ui-menu-item-wrapper"),this._rendered=!0,t.length&&(t=this._getSelectedItem(),this.menuInstance.focus(null,t),this._setAria(t.data("ui-selectmenu-item")),this._setOption("disabled",this.element.prop("disabled")))},open:function(t){this.options.disabled||(this._rendered?(this._removeClass(this.menu.find(".ui-state-active"),null,"ui-state-active"),this.menuInstance.focus(null,this._getSelectedItem())):this._refreshMenu(),this.menuItems.length&&(this.isOpen=!0,this._toggleAttr(),this._resizeMenu(),this._position(),this._on(this.document,this._documentClick),this._trigger("open",t)))},_position:function(){this.menuWrap.position(V.extend({of:this.button},this.options.position))},close:function(t){this.isOpen&&(this.isOpen=!1,this._toggleAttr(),this.range=null,this._off(this.document),this._trigger("close",t))},widget:function(){return this.button},menuWidget:function(){return this.menu},_renderButtonItem:function(t){var e=V("<span>");return this._setText(e,t.label),this._addClass(e,"ui-selectmenu-text"),e},_renderMenu:function(s,t){var n=this,o="";V.each(t,function(t,e){var i;e.optgroup!==o&&(i=V("<li>",{text:e.optgroup}),n._addClass(i,"ui-selectmenu-optgroup","ui-menu-divider"+(e.element.parent("optgroup").prop("disabled")?" ui-state-disabled":"")),i.appendTo(s),o=e.optgroup),n._renderItemData(s,e)})},_renderItemData:function(t,e){return this._renderItem(t,e).data("ui-selectmenu-item",e)},_renderItem:function(t,e){var i=V("<li>"),s=V("<div>",{title:e.element.attr("title")});return e.disabled&&this._addClass(i,null,"ui-state-disabled"),this._setText(s,e.label),i.append(s).appendTo(t)},_setText:function(t,e){e?t.text(e):t.html(" ")},_move:function(t,e){var i,s=".ui-menu-item";this.isOpen?i=this.menuItems.eq(this.focusIndex).parent("li"):(i=this.menuItems.eq(this.element[0].selectedIndex).parent("li"),s+=":not(.ui-state-disabled)"),(s="first"===t||"last"===t?i["first"===t?"prevAll":"nextAll"](s).eq(-1):i[t+"All"](s).eq(0)).length&&this.menuInstance.focus(e,s)},_getSelectedItem:function(){return this.menuItems.eq(this.element[0].selectedIndex).parent("li")},_toggle:function(t){this[this.isOpen?"close":"open"](t)},_setSelection:function(){var t;this.range&&(window.getSelection?((t=window.getSelection()).removeAllRanges(),t.addRange(this.range)):this.range.select(),this.button.trigger("focus"))},_documentClick:{mousedown:function(t){this.isOpen&&(V(t.target).closest(".ui-selectmenu-menu, #"+V.escapeSelector(this.ids.button)).length||this.close(t))}},_buttonEvents:{mousedown:function(){var t;window.getSelection?(t=window.getSelection()).rangeCount&&(this.range=t.getRangeAt(0)):this.range=document.selection.createRange()},click:function(t){this._setSelection(),this._toggle(t)},keydown:function(t){var e=!0;switch(t.keyCode){case V.ui.keyCode.TAB:case V.ui.keyCode.ESCAPE:this.close(t),e=!1;break;case V.ui.keyCode.ENTER:this.isOpen&&this._selectFocusedItem(t);break;case V.ui.keyCode.UP:t.altKey?this._toggle(t):this._move("prev",t);break;case V.ui.keyCode.DOWN:t.altKey?this._toggle(t):this._move("next",t);break;case V.ui.keyCode.SPACE:this.isOpen?this._selectFocusedItem(t):this._toggle(t);break;case V.ui.keyCode.LEFT:this._move("prev",t);break;case V.ui.keyCode.RIGHT:this._move("next",t);break;case V.ui.keyCode.HOME:case V.ui.keyCode.PAGE_UP:this._move("first",t);break;case V.ui.keyCode.END:case V.ui.keyCode.PAGE_DOWN:this._move("last",t);break;default:this.menu.trigger(t),e=!1}e&&t.preventDefault()}},_selectFocusedItem:function(t){var e=this.menuItems.eq(this.focusIndex).parent("li");e.hasClass("ui-state-disabled")||this._select(e.data("ui-selectmenu-item"),t)},_select:function(t,e){var i=this.element[0].selectedIndex;this.element[0].selectedIndex=t.index,this.buttonItem.replaceWith(this.buttonItem=this._renderButtonItem(t)),this._setAria(t),this._trigger("select",e,{item:t}),t.index!==i&&this._trigger("change",e,{item:t}),this.close(e)},_setAria:function(t){t=this.menuItems.eq(t.index).attr("id");this.button.attr({"aria-labelledby":t,"aria-activedescendant":t}),this.menu.attr("aria-activedescendant",t)},_setOption:function(t,e){var i;"icons"===t&&(i=this.button.find("span.ui-icon"),this._removeClass(i,null,this.options.icons.button)._addClass(i,null,e.button)),this._super(t,e),"appendTo"===t&&this.menuWrap.appendTo(this._appendTo()),"width"===t&&this._resizeButton()},_setOptionDisabled:function(t){this._super(t),this.menuInstance.option("disabled",t),this.button.attr("aria-disabled",t),this._toggleClass(this.button,null,"ui-state-disabled",t),this.element.prop("disabled",t),t?(this.button.attr("tabindex",-1),this.close()):this.button.attr("tabindex",0)},_appendTo:function(){var t=this.options.appendTo;return t=!(t=!(t=t&&(t.jquery||t.nodeType?V(t):this.document.find(t).eq(0)))||!t[0]?this.element.closest(".ui-front, dialog"):t).length?this.document[0].body:t},_toggleAttr:function(){this.button.attr("aria-expanded",this.isOpen),this._removeClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"closed":"open"))._addClass(this.button,"ui-selectmenu-button-"+(this.isOpen?"open":"closed"))._toggleClass(this.menuWrap,"ui-selectmenu-open",null,this.isOpen),this.menu.attr("aria-hidden",!this.isOpen)},_resizeButton:function(){var t=this.options.width;!1!==t?(null===t&&(t=this.element.show().outerWidth(),this.element.hide()),this.button.outerWidth(t)):this.button.css("width","")},_resizeMenu:function(){this.menu.outerWidth(Math.max(this.button.outerWidth(),this.menu.width("").outerWidth()+1))},_getCreateOptions:function(){var t=this._super();return t.disabled=this.element.prop("disabled"),t},_parseOptions:function(t){var i=this,s=[];t.each(function(t,e){e.hidden||s.push(i._parseOption(V(e),t))}),this.items=s},_parseOption:function(t,e){var i=t.parent("optgroup");return{element:t,index:e,value:t.val(),label:t.text(),optgroup:i.attr("label")||"",disabled:i.prop("disabled")||t.prop("disabled")}},_destroy:function(){this._unbindFormResetHandler(),this.menuWrap.remove(),this.button.remove(),this.element.show(),this.element.removeUniqueId(),this.labels.attr("for",this.ids.element)}}]),V.widget("ui.slider",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"slide",options:{animate:!1,classes:{"ui-slider":"ui-corner-all","ui-slider-handle":"ui-corner-all","ui-slider-range":"ui-corner-all ui-widget-header"},distance:0,max:100,min:0,orientation:"horizontal",range:!1,step:1,value:0,values:null,change:null,slide:null,start:null,stop:null},numPages:5,_create:function(){this._keySliding=!1,this._mouseSliding=!1,this._animateOff=!0,this._handleIndex=null,this._detectOrientation(),this._mouseInit(),this._calculateNewMax(),this._addClass("ui-slider ui-slider-"+this.orientation,"ui-widget ui-widget-content"),this._refresh(),this._animateOff=!1},_refresh:function(){this._createRange(),this._createHandles(),this._setupEvents(),this._refreshValue()},_createHandles:function(){var t,e=this.options,i=this.element.find(".ui-slider-handle"),s=[],n=e.values&&e.values.length||1;for(i.length>n&&(i.slice(n).remove(),i=i.slice(0,n)),t=i.length;t<n;t++)s.push("<span tabindex='0'></span>");this.handles=i.add(V(s.join("")).appendTo(this.element)),this._addClass(this.handles,"ui-slider-handle","ui-state-default"),this.handle=this.handles.eq(0),this.handles.each(function(t){V(this).data("ui-slider-handle-index",t).attr("tabIndex",0)})},_createRange:function(){var t=this.options;t.range?(!0===t.range&&(t.values?t.values.length&&2!==t.values.length?t.values=[t.values[0],t.values[0]]:Array.isArray(t.values)&&(t.values=t.values.slice(0)):t.values=[this._valueMin(),this._valueMin()]),this.range&&this.range.length?(this._removeClass(this.range,"ui-slider-range-min ui-slider-range-max"),this.range.css({left:"",bottom:""})):(this.range=V("<div>").appendTo(this.element),this._addClass(this.range,"ui-slider-range")),"min"!==t.range&&"max"!==t.range||this._addClass(this.range,"ui-slider-range-"+t.range)):(this.range&&this.range.remove(),this.range=null)},_setupEvents:function(){this._off(this.handles),this._on(this.handles,this._handleEvents),this._hoverable(this.handles),this._focusable(this.handles)},_destroy:function(){this.handles.remove(),this.range&&this.range.remove(),this._mouseDestroy()},_mouseCapture:function(t){var i,s,n,o,e,a,r=this,l=this.options;return!l.disabled&&(this.elementSize={width:this.element.outerWidth(),height:this.element.outerHeight()},this.elementOffset=this.element.offset(),a={x:t.pageX,y:t.pageY},i=this._normValueFromMouse(a),s=this._valueMax()-this._valueMin()+1,this.handles.each(function(t){var e=Math.abs(i-r.values(t));(e<s||s===e&&(t===r._lastChangedValue||r.values(t)===l.min))&&(s=e,n=V(this),o=t)}),!1!==this._start(t,o)&&(this._mouseSliding=!0,this._handleIndex=o,this._addClass(n,null,"ui-state-active"),n.trigger("focus"),e=n.offset(),a=!V(t.target).parents().addBack().is(".ui-slider-handle"),this._clickOffset=a?{left:0,top:0}:{left:t.pageX-e.left-n.width()/2,top:t.pageY-e.top-n.height()/2-(parseInt(n.css("borderTopWidth"),10)||0)-(parseInt(n.css("borderBottomWidth"),10)||0)+(parseInt(n.css("marginTop"),10)||0)},this.handles.hasClass("ui-state-hover")||this._slide(t,o,i),this._animateOff=!0))},_mouseStart:function(){return!0},_mouseDrag:function(t){var e={x:t.pageX,y:t.pageY},e=this._normValueFromMouse(e);return this._slide(t,this._handleIndex,e),!1},_mouseStop:function(t){return this._removeClass(this.handles,null,"ui-state-active"),this._mouseSliding=!1,this._stop(t,this._handleIndex),this._change(t,this._handleIndex),this._handleIndex=null,this._clickOffset=null,this._animateOff=!1},_detectOrientation:function(){this.orientation="vertical"===this.options.orientation?"vertical":"horizontal"},_normValueFromMouse:function(t){var e,t="horizontal"===this.orientation?(e=this.elementSize.width,t.x-this.elementOffset.left-(this._clickOffset?this._clickOffset.left:0)):(e=this.elementSize.height,t.y-this.elementOffset.top-(this._clickOffset?this._clickOffset.top:0)),t=t/e;return(t=1<t?1:t)<0&&(t=0),"vertical"===this.orientation&&(t=1-t),e=this._valueMax()-this._valueMin(),e=this._valueMin()+t*e,this._trimAlignValue(e)},_uiHash:function(t,e,i){var s={handle:this.handles[t],handleIndex:t,value:void 0!==e?e:this.value()};return this._hasMultipleValues()&&(s.value=void 0!==e?e:this.values(t),s.values=i||this.values()),s},_hasMultipleValues:function(){return this.options.values&&this.options.values.length},_start:function(t,e){return this._trigger("start",t,this._uiHash(e))},_slide:function(t,e,i){var s,n=this.value(),o=this.values();this._hasMultipleValues()&&(s=this.values(e?0:1),n=this.values(e),2===this.options.values.length&&!0===this.options.range&&(i=0===e?Math.min(s,i):Math.max(s,i)),o[e]=i),i!==n&&!1!==this._trigger("slide",t,this._uiHash(e,i,o))&&(this._hasMultipleValues()?this.values(e,i):this.value(i))},_stop:function(t,e){this._trigger("stop",t,this._uiHash(e))},_change:function(t,e){this._keySliding||this._mouseSliding||(this._lastChangedValue=e,this._trigger("change",t,this._uiHash(e)))},value:function(t){return arguments.length?(this.options.value=this._trimAlignValue(t),this._refreshValue(),void this._change(null,0)):this._value()},values:function(t,e){var i,s,n;if(1<arguments.length)return this.options.values[t]=this._trimAlignValue(e),this._refreshValue(),void this._change(null,t);if(!arguments.length)return this._values();if(!Array.isArray(t))return this._hasMultipleValues()?this._values(t):this.value();for(i=this.options.values,s=t,n=0;n<i.length;n+=1)i[n]=this._trimAlignValue(s[n]),this._change(null,n);this._refreshValue()},_setOption:function(t,e){var i,s=0;switch("range"===t&&!0===this.options.range&&("min"===e?(this.options.value=this._values(0),this.options.values=null):"max"===e&&(this.options.value=this._values(this.options.values.length-1),this.options.values=null)),Array.isArray(this.options.values)&&(s=this.options.values.length),this._super(t,e),t){case"orientation":this._detectOrientation(),this._removeClass("ui-slider-horizontal ui-slider-vertical")._addClass("ui-slider-"+this.orientation),this._refreshValue(),this.options.range&&this._refreshRange(e),this.handles.css("horizontal"===e?"bottom":"left","");break;case"value":this._animateOff=!0,this._refreshValue(),this._change(null,0),this._animateOff=!1;break;case"values":for(this._animateOff=!0,this._refreshValue(),i=s-1;0<=i;i--)this._change(null,i);this._animateOff=!1;break;case"step":case"min":case"max":this._animateOff=!0,this._calculateNewMax(),this._refreshValue(),this._animateOff=!1;break;case"range":this._animateOff=!0,this._refresh(),this._animateOff=!1}},_setOptionDisabled:function(t){this._super(t),this._toggleClass(null,"ui-state-disabled",!!t)},_value:function(){var t=this.options.value;return t=this._trimAlignValue(t)},_values:function(t){var e,i;if(arguments.length)return t=this.options.values[t],t=this._trimAlignValue(t);if(this._hasMultipleValues()){for(e=this.options.values.slice(),i=0;i<e.length;i+=1)e[i]=this._trimAlignValue(e[i]);return e}return[]},_trimAlignValue:function(t){if(t<=this._valueMin())return this._valueMin();if(t>=this._valueMax())return this._valueMax();var e=0<this.options.step?this.options.step:1,i=(t-this._valueMin())%e,t=t-i;return 2*Math.abs(i)>=e&&(t+=0<i?e:-e),parseFloat(t.toFixed(5))},_calculateNewMax:function(){var t=this.options.max,e=this._valueMin(),i=this.options.step;(t=Math.round((t-e)/i)*i+e)>this.options.max&&(t-=i),this.max=parseFloat(t.toFixed(this._precision()))},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_valueMin:function(){return this.options.min},_valueMax:function(){return this.max},_refreshRange:function(t){"vertical"===t&&this.range.css({width:"",left:""}),"horizontal"===t&&this.range.css({height:"",bottom:""})},_refreshValue:function(){var e,i,t,s,n,o=this.options.range,a=this.options,r=this,l=!this._animateOff&&a.animate,h={};this._hasMultipleValues()?this.handles.each(function(t){i=(r.values(t)-r._valueMin())/(r._valueMax()-r._valueMin())*100,h["horizontal"===r.orientation?"left":"bottom"]=i+"%",V(this).stop(1,1)[l?"animate":"css"](h,a.animate),!0===r.options.range&&("horizontal"===r.orientation?(0===t&&r.range.stop(1,1)[l?"animate":"css"]({left:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({width:i-e+"%"},{queue:!1,duration:a.animate})):(0===t&&r.range.stop(1,1)[l?"animate":"css"]({bottom:i+"%"},a.animate),1===t&&r.range[l?"animate":"css"]({height:i-e+"%"},{queue:!1,duration:a.animate}))),e=i}):(t=this.value(),s=this._valueMin(),n=this._valueMax(),i=n!==s?(t-s)/(n-s)*100:0,h["horizontal"===this.orientation?"left":"bottom"]=i+"%",this.handle.stop(1,1)[l?"animate":"css"](h,a.animate),"min"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:i+"%"},a.animate),"max"===o&&"horizontal"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({width:100-i+"%"},a.animate),"min"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:i+"%"},a.animate),"max"===o&&"vertical"===this.orientation&&this.range.stop(1,1)[l?"animate":"css"]({height:100-i+"%"},a.animate))},_handleEvents:{keydown:function(t){var e,i,s,n=V(t.target).data("ui-slider-handle-index");switch(t.keyCode){case V.ui.keyCode.HOME:case V.ui.keyCode.END:case V.ui.keyCode.PAGE_UP:case V.ui.keyCode.PAGE_DOWN:case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(t.preventDefault(),!this._keySliding&&(this._keySliding=!0,this._addClass(V(t.target),null,"ui-state-active"),!1===this._start(t,n)))return}switch(s=this.options.step,e=i=this._hasMultipleValues()?this.values(n):this.value(),t.keyCode){case V.ui.keyCode.HOME:i=this._valueMin();break;case V.ui.keyCode.END:i=this._valueMax();break;case V.ui.keyCode.PAGE_UP:i=this._trimAlignValue(e+(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.PAGE_DOWN:i=this._trimAlignValue(e-(this._valueMax()-this._valueMin())/this.numPages);break;case V.ui.keyCode.UP:case V.ui.keyCode.RIGHT:if(e===this._valueMax())return;i=this._trimAlignValue(e+s);break;case V.ui.keyCode.DOWN:case V.ui.keyCode.LEFT:if(e===this._valueMin())return;i=this._trimAlignValue(e-s)}this._slide(t,n,i)},keyup:function(t){var e=V(t.target).data("ui-slider-handle-index");this._keySliding&&(this._keySliding=!1,this._stop(t,e),this._change(t,e),this._removeClass(V(t.target),null,"ui-state-active"))}}}),V.widget("ui.sortable",V.ui.mouse,{version:"1.13.2",widgetEventPrefix:"sort",ready:!1,options:{appendTo:"parent",axis:!1,connectWith:!1,containment:!1,cursor:"auto",cursorAt:!1,dropOnEmpty:!0,forcePlaceholderSize:!1,forceHelperSize:!1,grid:!1,handle:!1,helper:"original",items:"> *",opacity:!1,placeholder:!1,revert:!1,scroll:!0,scrollSensitivity:20,scrollSpeed:20,scope:"default",tolerance:"intersect",zIndex:1e3,activate:null,beforeStop:null,change:null,deactivate:null,out:null,over:null,receive:null,remove:null,sort:null,start:null,stop:null,update:null},_isOverAxis:function(t,e,i){return e<=t&&t<e+i},_isFloating:function(t){return/left|right/.test(t.css("float"))||/inline|table-cell/.test(t.css("display"))},_create:function(){this.containerCache={},this._addClass("ui-sortable"),this.refresh(),this.offset=this.element.offset(),this._mouseInit(),this._setHandleClassName(),this.ready=!0},_setOption:function(t,e){this._super(t,e),"handle"===t&&this._setHandleClassName()},_setHandleClassName:function(){var t=this;this._removeClass(this.element.find(".ui-sortable-handle"),"ui-sortable-handle"),V.each(this.items,function(){t._addClass(this.instance.options.handle?this.item.find(this.instance.options.handle):this.item,"ui-sortable-handle")})},_destroy:function(){this._mouseDestroy();for(var t=this.items.length-1;0<=t;t--)this.items[t].item.removeData(this.widgetName+"-item");return this},_mouseCapture:function(t,e){var i=null,s=!1,n=this;return!this.reverting&&(!this.options.disabled&&"static"!==this.options.type&&(this._refreshItems(t),V(t.target).parents().each(function(){if(V.data(this,n.widgetName+"-item")===n)return i=V(this),!1}),!!(i=V.data(t.target,n.widgetName+"-item")===n?V(t.target):i)&&(!(this.options.handle&&!e&&(V(this.options.handle,i).find("*").addBack().each(function(){this===t.target&&(s=!0)}),!s))&&(this.currentItem=i,this._removeCurrentsFromItems(),!0))))},_mouseStart:function(t,e,i){var s,n,o=this.options;if((this.currentContainer=this).refreshPositions(),this.appendTo=V("parent"!==o.appendTo?o.appendTo:this.currentItem.parent()),this.helper=this._createHelper(t),this._cacheHelperProportions(),this._cacheMargins(),this.offset=this.currentItem.offset(),this.offset={top:this.offset.top-this.margins.top,left:this.offset.left-this.margins.left},V.extend(this.offset,{click:{left:t.pageX-this.offset.left,top:t.pageY-this.offset.top},relative:this._getRelativeOffset()}),this.helper.css("position","absolute"),this.cssPosition=this.helper.css("position"),o.cursorAt&&this._adjustOffsetFromHelper(o.cursorAt),this.domPosition={prev:this.currentItem.prev()[0],parent:this.currentItem.parent()[0]},this.helper[0]!==this.currentItem[0]&&this.currentItem.hide(),this._createPlaceholder(),this.scrollParent=this.placeholder.scrollParent(),V.extend(this.offset,{parent:this._getParentOffset()}),o.containment&&this._setContainment(),o.cursor&&"auto"!==o.cursor&&(n=this.document.find("body"),this.storedCursor=n.css("cursor"),n.css("cursor",o.cursor),this.storedStylesheet=V("<style>*{ cursor: "+o.cursor+" !important; }</style>").appendTo(n)),o.zIndex&&(this.helper.css("zIndex")&&(this._storedZIndex=this.helper.css("zIndex")),this.helper.css("zIndex",o.zIndex)),o.opacity&&(this.helper.css("opacity")&&(this._storedOpacity=this.helper.css("opacity")),this.helper.css("opacity",o.opacity)),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this._trigger("start",t,this._uiHash()),this._preserveHelperProportions||this._cacheHelperProportions(),!i)for(s=this.containers.length-1;0<=s;s--)this.containers[s]._trigger("activate",t,this._uiHash(this));return V.ui.ddmanager&&(V.ui.ddmanager.current=this),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t),this.dragging=!0,this._addClass(this.helper,"ui-sortable-helper"),this.helper.parent().is(this.appendTo)||(this.helper.detach().appendTo(this.appendTo),this.offset.parent=this._getParentOffset()),this.position=this.originalPosition=this._generatePosition(t),this.originalPageX=t.pageX,this.originalPageY=t.pageY,this.lastPositionAbs=this.positionAbs=this._convertPositionTo("absolute"),this._mouseDrag(t),!0},_scroll:function(t){var e=this.options,i=!1;return this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName?(this.overflowOffset.top+this.scrollParent[0].offsetHeight-t.pageY<e.scrollSensitivity?this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop+e.scrollSpeed:t.pageY-this.overflowOffset.top<e.scrollSensitivity&&(this.scrollParent[0].scrollTop=i=this.scrollParent[0].scrollTop-e.scrollSpeed),this.overflowOffset.left+this.scrollParent[0].offsetWidth-t.pageX<e.scrollSensitivity?this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft+e.scrollSpeed:t.pageX-this.overflowOffset.left<e.scrollSensitivity&&(this.scrollParent[0].scrollLeft=i=this.scrollParent[0].scrollLeft-e.scrollSpeed)):(t.pageY-this.document.scrollTop()<e.scrollSensitivity?i=this.document.scrollTop(this.document.scrollTop()-e.scrollSpeed):this.window.height()-(t.pageY-this.document.scrollTop())<e.scrollSensitivity&&(i=this.document.scrollTop(this.document.scrollTop()+e.scrollSpeed)),t.pageX-this.document.scrollLeft()<e.scrollSensitivity?i=this.document.scrollLeft(this.document.scrollLeft()-e.scrollSpeed):this.window.width()-(t.pageX-this.document.scrollLeft())<e.scrollSensitivity&&(i=this.document.scrollLeft(this.document.scrollLeft()+e.scrollSpeed))),i},_mouseDrag:function(t){var e,i,s,n,o=this.options;for(this.position=this._generatePosition(t),this.positionAbs=this._convertPositionTo("absolute"),this.options.axis&&"y"===this.options.axis||(this.helper[0].style.left=this.position.left+"px"),this.options.axis&&"x"===this.options.axis||(this.helper[0].style.top=this.position.top+"px"),o.scroll&&!1!==this._scroll(t)&&(this._refreshItemPositions(!0),V.ui.ddmanager&&!o.dropBehaviour&&V.ui.ddmanager.prepareOffsets(this,t)),this.dragDirection={vertical:this._getDragVerticalDirection(),horizontal:this._getDragHorizontalDirection()},e=this.items.length-1;0<=e;e--)if(s=(i=this.items[e]).item[0],(n=this._intersectsWithPointer(i))&&i.instance===this.currentContainer&&!(s===this.currentItem[0]||this.placeholder[1===n?"next":"prev"]()[0]===s||V.contains(this.placeholder[0],s)||"semi-dynamic"===this.options.type&&V.contains(this.element[0],s))){if(this.direction=1===n?"down":"up","pointer"!==this.options.tolerance&&!this._intersectsWithSides(i))break;this._rearrange(t,i),this._trigger("change",t,this._uiHash());break}return this._contactContainers(t),V.ui.ddmanager&&V.ui.ddmanager.drag(this,t),this._trigger("sort",t,this._uiHash()),this.lastPositionAbs=this.positionAbs,!1},_mouseStop:function(t,e){var i,s,n,o;if(t)return V.ui.ddmanager&&!this.options.dropBehaviour&&V.ui.ddmanager.drop(this,t),this.options.revert?(s=(i=this).placeholder.offset(),o={},(n=this.options.axis)&&"x"!==n||(o.left=s.left-this.offset.parent.left-this.margins.left+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollLeft)),n&&"y"!==n||(o.top=s.top-this.offset.parent.top-this.margins.top+(this.offsetParent[0]===this.document[0].body?0:this.offsetParent[0].scrollTop)),this.reverting=!0,V(this.helper).animate(o,parseInt(this.options.revert,10)||500,function(){i._clear(t)})):this._clear(t,e),!1},cancel:function(){if(this.dragging){this._mouseUp(new V.Event("mouseup",{target:null})),"original"===this.options.helper?(this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")):this.currentItem.show();for(var t=this.containers.length-1;0<=t;t--)this.containers[t]._trigger("deactivate",null,this._uiHash(this)),this.containers[t].containerCache.over&&(this.containers[t]._trigger("out",null,this._uiHash(this)),this.containers[t].containerCache.over=0)}return this.placeholder&&(this.placeholder[0].parentNode&&this.placeholder[0].parentNode.removeChild(this.placeholder[0]),"original"!==this.options.helper&&this.helper&&this.helper[0].parentNode&&this.helper.remove(),V.extend(this,{helper:null,dragging:!1,reverting:!1,_noFinalSort:null}),this.domPosition.prev?V(this.domPosition.prev).after(this.currentItem):V(this.domPosition.parent).prepend(this.currentItem)),this},serialize:function(e){var t=this._getItemsAsjQuery(e&&e.connected),i=[];return e=e||{},V(t).each(function(){var t=(V(e.item||this).attr(e.attribute||"id")||"").match(e.expression||/(.+)[\-=_](.+)/);t&&i.push((e.key||t[1]+"[]")+"="+(e.key&&e.expression?t[1]:t[2]))}),!i.length&&e.key&&i.push(e.key+"="),i.join("&")},toArray:function(t){var e=this._getItemsAsjQuery(t&&t.connected),i=[];return t=t||{},e.each(function(){i.push(V(t.item||this).attr(t.attribute||"id")||"")}),i},_intersectsWith:function(t){var e=this.positionAbs.left,i=e+this.helperProportions.width,s=this.positionAbs.top,n=s+this.helperProportions.height,o=t.left,a=o+t.width,r=t.top,l=r+t.height,h=this.offset.click.top,c=this.offset.click.left,h="x"===this.options.axis||r<s+h&&s+h<l,c="y"===this.options.axis||o<e+c&&e+c<a;return"pointer"===this.options.tolerance||this.options.forcePointerForContainers||"pointer"!==this.options.tolerance&&this.helperProportions[this.floating?"width":"height"]>t[this.floating?"width":"height"]?h&&c:o<e+this.helperProportions.width/2&&i-this.helperProportions.width/2<a&&r<s+this.helperProportions.height/2&&n-this.helperProportions.height/2<l},_intersectsWithPointer:function(t){var e="x"===this.options.axis||this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top,t.height),t="y"===this.options.axis||this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left,t.width);return!(!e||!t)&&(e=this.dragDirection.vertical,t=this.dragDirection.horizontal,this.floating?"right"===t||"down"===e?2:1:e&&("down"===e?2:1))},_intersectsWithSides:function(t){var e=this._isOverAxis(this.positionAbs.top+this.offset.click.top,t.top+t.height/2,t.height),i=this._isOverAxis(this.positionAbs.left+this.offset.click.left,t.left+t.width/2,t.width),s=this.dragDirection.vertical,t=this.dragDirection.horizontal;return this.floating&&t?"right"===t&&i||"left"===t&&!i:s&&("down"===s&&e||"up"===s&&!e)},_getDragVerticalDirection:function(){var t=this.positionAbs.top-this.lastPositionAbs.top;return 0!=t&&(0<t?"down":"up")},_getDragHorizontalDirection:function(){var t=this.positionAbs.left-this.lastPositionAbs.left;return 0!=t&&(0<t?"right":"left")},refresh:function(t){return this._refreshItems(t),this._setHandleClassName(),this.refreshPositions(),this},_connectWith:function(){var t=this.options;return t.connectWith.constructor===String?[t.connectWith]:t.connectWith},_getItemsAsjQuery:function(t){var e,i,s,n,o=[],a=[],r=this._connectWith();if(r&&t)for(e=r.length-1;0<=e;e--)for(i=(s=V(r[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&a.push(["function"==typeof n.options.items?n.options.items.call(n.element):V(n.options.items,n.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),n]);function l(){o.push(this)}for(a.push(["function"==typeof this.options.items?this.options.items.call(this.element,null,{options:this.options,item:this.currentItem}):V(this.options.items,this.element).not(".ui-sortable-helper").not(".ui-sortable-placeholder"),this]),e=a.length-1;0<=e;e--)a[e][0].each(l);return V(o)},_removeCurrentsFromItems:function(){var i=this.currentItem.find(":data("+this.widgetName+"-item)");this.items=V.grep(this.items,function(t){for(var e=0;e<i.length;e++)if(i[e]===t.item[0])return!1;return!0})},_refreshItems:function(t){this.items=[],this.containers=[this];var e,i,s,n,o,a,r,l,h=this.items,c=[["function"==typeof this.options.items?this.options.items.call(this.element[0],t,{item:this.currentItem}):V(this.options.items,this.element),this]],u=this._connectWith();if(u&&this.ready)for(e=u.length-1;0<=e;e--)for(i=(s=V(u[e],this.document[0])).length-1;0<=i;i--)(n=V.data(s[i],this.widgetFullName))&&n!==this&&!n.options.disabled&&(c.push(["function"==typeof n.options.items?n.options.items.call(n.element[0],t,{item:this.currentItem}):V(n.options.items,n.element),n]),this.containers.push(n));for(e=c.length-1;0<=e;e--)for(o=c[e][1],l=(a=c[e][i=0]).length;i<l;i++)(r=V(a[i])).data(this.widgetName+"-item",o),h.push({item:r,instance:o,width:0,height:0,left:0,top:0})},_refreshItemPositions:function(t){for(var e,i,s=this.items.length-1;0<=s;s--)e=this.items[s],this.currentContainer&&e.instance!==this.currentContainer&&e.item[0]!==this.currentItem[0]||(i=this.options.toleranceElement?V(this.options.toleranceElement,e.item):e.item,t||(e.width=i.outerWidth(),e.height=i.outerHeight()),i=i.offset(),e.left=i.left,e.top=i.top)},refreshPositions:function(t){var e,i;if(this.floating=!!this.items.length&&("x"===this.options.axis||this._isFloating(this.items[0].item)),this.offsetParent&&this.helper&&(this.offset.parent=this._getParentOffset()),this._refreshItemPositions(t),this.options.custom&&this.options.custom.refreshContainers)this.options.custom.refreshContainers.call(this);else for(e=this.containers.length-1;0<=e;e--)i=this.containers[e].element.offset(),this.containers[e].containerCache.left=i.left,this.containers[e].containerCache.top=i.top,this.containers[e].containerCache.width=this.containers[e].element.outerWidth(),this.containers[e].containerCache.height=this.containers[e].element.outerHeight();return this},_createPlaceholder:function(i){var s,n,o=(i=i||this).options;o.placeholder&&o.placeholder.constructor!==String||(s=o.placeholder,n=i.currentItem[0].nodeName.toLowerCase(),o.placeholder={element:function(){var t=V("<"+n+">",i.document[0]);return i._addClass(t,"ui-sortable-placeholder",s||i.currentItem[0].className)._removeClass(t,"ui-sortable-helper"),"tbody"===n?i._createTrPlaceholder(i.currentItem.find("tr").eq(0),V("<tr>",i.document[0]).appendTo(t)):"tr"===n?i._createTrPlaceholder(i.currentItem,t):"img"===n&&t.attr("src",i.currentItem.attr("src")),s||t.css("visibility","hidden"),t},update:function(t,e){s&&!o.forcePlaceholderSize||(e.height()&&(!o.forcePlaceholderSize||"tbody"!==n&&"tr"!==n)||e.height(i.currentItem.innerHeight()-parseInt(i.currentItem.css("paddingTop")||0,10)-parseInt(i.currentItem.css("paddingBottom")||0,10)),e.width()||e.width(i.currentItem.innerWidth()-parseInt(i.currentItem.css("paddingLeft")||0,10)-parseInt(i.currentItem.css("paddingRight")||0,10)))}}),i.placeholder=V(o.placeholder.element.call(i.element,i.currentItem)),i.currentItem.after(i.placeholder),o.placeholder.update(i,i.placeholder)},_createTrPlaceholder:function(t,e){var i=this;t.children().each(function(){V("<td> </td>",i.document[0]).attr("colspan",V(this).attr("colspan")||1).appendTo(e)})},_contactContainers:function(t){for(var e,i,s,n,o,a,r,l,h,c=null,u=null,d=this.containers.length-1;0<=d;d--)V.contains(this.currentItem[0],this.containers[d].element[0])||(this._intersectsWith(this.containers[d].containerCache)?c&&V.contains(this.containers[d].element[0],c.element[0])||(c=this.containers[d],u=d):this.containers[d].containerCache.over&&(this.containers[d]._trigger("out",t,this._uiHash(this)),this.containers[d].containerCache.over=0));if(c)if(1===this.containers.length)this.containers[u].containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1);else{for(i=1e4,s=null,n=(l=c.floating||this._isFloating(this.currentItem))?"left":"top",o=l?"width":"height",h=l?"pageX":"pageY",e=this.items.length-1;0<=e;e--)V.contains(this.containers[u].element[0],this.items[e].item[0])&&this.items[e].item[0]!==this.currentItem[0]&&(a=this.items[e].item.offset()[n],r=!1,t[h]-a>this.items[e][o]/2&&(r=!0),Math.abs(t[h]-a)<i&&(i=Math.abs(t[h]-a),s=this.items[e],this.direction=r?"up":"down"));(s||this.options.dropOnEmpty)&&(this.currentContainer!==this.containers[u]?(s?this._rearrange(t,s,null,!0):this._rearrange(t,null,this.containers[u].element,!0),this._trigger("change",t,this._uiHash()),this.containers[u]._trigger("change",t,this._uiHash(this)),this.currentContainer=this.containers[u],this.options.placeholder.update(this.currentContainer,this.placeholder),this.scrollParent=this.placeholder.scrollParent(),this.scrollParent[0]!==this.document[0]&&"HTML"!==this.scrollParent[0].tagName&&(this.overflowOffset=this.scrollParent.offset()),this.containers[u]._trigger("over",t,this._uiHash(this)),this.containers[u].containerCache.over=1):this.currentContainer.containerCache.over||(this.containers[u]._trigger("over",t,this._uiHash()),this.currentContainer.containerCache.over=1))}},_createHelper:function(t){var e=this.options,t="function"==typeof e.helper?V(e.helper.apply(this.element[0],[t,this.currentItem])):"clone"===e.helper?this.currentItem.clone():this.currentItem;return t.parents("body").length||this.appendTo[0].appendChild(t[0]),t[0]===this.currentItem[0]&&(this._storedCSS={width:this.currentItem[0].style.width,height:this.currentItem[0].style.height,position:this.currentItem.css("position"),top:this.currentItem.css("top"),left:this.currentItem.css("left")}),t[0].style.width&&!e.forceHelperSize||t.width(this.currentItem.width()),t[0].style.height&&!e.forceHelperSize||t.height(this.currentItem.height()),t},_adjustOffsetFromHelper:function(t){"string"==typeof t&&(t=t.split(" ")),"left"in(t=Array.isArray(t)?{left:+t[0],top:+t[1]||0}:t)&&(this.offset.click.left=t.left+this.margins.left),"right"in t&&(this.offset.click.left=this.helperProportions.width-t.right+this.margins.left),"top"in t&&(this.offset.click.top=t.top+this.margins.top),"bottom"in t&&(this.offset.click.top=this.helperProportions.height-t.bottom+this.margins.top)},_getParentOffset:function(){this.offsetParent=this.helper.offsetParent();var t=this.offsetParent.offset();return"absolute"===this.cssPosition&&this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])&&(t.left+=this.scrollParent.scrollLeft(),t.top+=this.scrollParent.scrollTop()),{top:(t=this.offsetParent[0]===this.document[0].body||this.offsetParent[0].tagName&&"html"===this.offsetParent[0].tagName.toLowerCase()&&V.ui.ie?{top:0,left:0}:t).top+(parseInt(this.offsetParent.css("borderTopWidth"),10)||0),left:t.left+(parseInt(this.offsetParent.css("borderLeftWidth"),10)||0)}},_getRelativeOffset:function(){if("relative"!==this.cssPosition)return{top:0,left:0};var t=this.currentItem.position();return{top:t.top-(parseInt(this.helper.css("top"),10)||0)+this.scrollParent.scrollTop(),left:t.left-(parseInt(this.helper.css("left"),10)||0)+this.scrollParent.scrollLeft()}},_cacheMargins:function(){this.margins={left:parseInt(this.currentItem.css("marginLeft"),10)||0,top:parseInt(this.currentItem.css("marginTop"),10)||0}},_cacheHelperProportions:function(){this.helperProportions={width:this.helper.outerWidth(),height:this.helper.outerHeight()}},_setContainment:function(){var t,e,i=this.options;"parent"===i.containment&&(i.containment=this.helper[0].parentNode),"document"!==i.containment&&"window"!==i.containment||(this.containment=[0-this.offset.relative.left-this.offset.parent.left,0-this.offset.relative.top-this.offset.parent.top,"document"===i.containment?this.document.width():this.window.width()-this.helperProportions.width-this.margins.left,("document"===i.containment?this.document.height()||document.body.parentNode.scrollHeight:this.window.height()||this.document[0].body.parentNode.scrollHeight)-this.helperProportions.height-this.margins.top]),/^(document|window|parent)$/.test(i.containment)||(t=V(i.containment)[0],e=V(i.containment).offset(),i="hidden"!==V(t).css("overflow"),this.containment=[e.left+(parseInt(V(t).css("borderLeftWidth"),10)||0)+(parseInt(V(t).css("paddingLeft"),10)||0)-this.margins.left,e.top+(parseInt(V(t).css("borderTopWidth"),10)||0)+(parseInt(V(t).css("paddingTop"),10)||0)-this.margins.top,e.left+(i?Math.max(t.scrollWidth,t.offsetWidth):t.offsetWidth)-(parseInt(V(t).css("borderLeftWidth"),10)||0)-(parseInt(V(t).css("paddingRight"),10)||0)-this.helperProportions.width-this.margins.left,e.top+(i?Math.max(t.scrollHeight,t.offsetHeight):t.offsetHeight)-(parseInt(V(t).css("borderTopWidth"),10)||0)-(parseInt(V(t).css("paddingBottom"),10)||0)-this.helperProportions.height-this.margins.top])},_convertPositionTo:function(t,e){e=e||this.position;var i="absolute"===t?1:-1,s="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,t=/(html|body)/i.test(s[0].tagName);return{top:e.top+this.offset.relative.top*i+this.offset.parent.top*i-("fixed"===this.cssPosition?-this.scrollParent.scrollTop():t?0:s.scrollTop())*i,left:e.left+this.offset.relative.left*i+this.offset.parent.left*i-("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():t?0:s.scrollLeft())*i}},_generatePosition:function(t){var e=this.options,i=t.pageX,s=t.pageY,n="absolute"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&V.contains(this.scrollParent[0],this.offsetParent[0])?this.scrollParent:this.offsetParent,o=/(html|body)/i.test(n[0].tagName);return"relative"!==this.cssPosition||this.scrollParent[0]!==this.document[0]&&this.scrollParent[0]!==this.offsetParent[0]||(this.offset.relative=this._getRelativeOffset()),this.originalPosition&&(this.containment&&(t.pageX-this.offset.click.left<this.containment[0]&&(i=this.containment[0]+this.offset.click.left),t.pageY-this.offset.click.top<this.containment[1]&&(s=this.containment[1]+this.offset.click.top),t.pageX-this.offset.click.left>this.containment[2]&&(i=this.containment[2]+this.offset.click.left),t.pageY-this.offset.click.top>this.containment[3]&&(s=this.containment[3]+this.offset.click.top)),e.grid&&(t=this.originalPageY+Math.round((s-this.originalPageY)/e.grid[1])*e.grid[1],s=!this.containment||t-this.offset.click.top>=this.containment[1]&&t-this.offset.click.top<=this.containment[3]?t:t-this.offset.click.top>=this.containment[1]?t-e.grid[1]:t+e.grid[1],t=this.originalPageX+Math.round((i-this.originalPageX)/e.grid[0])*e.grid[0],i=!this.containment||t-this.offset.click.left>=this.containment[0]&&t-this.offset.click.left<=this.containment[2]?t:t-this.offset.click.left>=this.containment[0]?t-e.grid[0]:t+e.grid[0])),{top:s-this.offset.click.top-this.offset.relative.top-this.offset.parent.top+("fixed"===this.cssPosition?-this.scrollParent.scrollTop():o?0:n.scrollTop()),left:i-this.offset.click.left-this.offset.relative.left-this.offset.parent.left+("fixed"===this.cssPosition?-this.scrollParent.scrollLeft():o?0:n.scrollLeft())}},_rearrange:function(t,e,i,s){i?i[0].appendChild(this.placeholder[0]):e.item[0].parentNode.insertBefore(this.placeholder[0],"down"===this.direction?e.item[0]:e.item[0].nextSibling),this.counter=this.counter?++this.counter:1;var n=this.counter;this._delay(function(){n===this.counter&&this.refreshPositions(!s)})},_clear:function(t,e){this.reverting=!1;var i,s=[];if(!this._noFinalSort&&this.currentItem.parent().length&&this.placeholder.before(this.currentItem),this._noFinalSort=null,this.helper[0]===this.currentItem[0]){for(i in this._storedCSS)"auto"!==this._storedCSS[i]&&"static"!==this._storedCSS[i]||(this._storedCSS[i]="");this.currentItem.css(this._storedCSS),this._removeClass(this.currentItem,"ui-sortable-helper")}else this.currentItem.show();function n(e,i,s){return function(t){s._trigger(e,t,i._uiHash(i))}}for(this.fromOutside&&!e&&s.push(function(t){this._trigger("receive",t,this._uiHash(this.fromOutside))}),!this.fromOutside&&this.domPosition.prev===this.currentItem.prev().not(".ui-sortable-helper")[0]&&this.domPosition.parent===this.currentItem.parent()[0]||e||s.push(function(t){this._trigger("update",t,this._uiHash())}),this!==this.currentContainer&&(e||(s.push(function(t){this._trigger("remove",t,this._uiHash())}),s.push(function(e){return function(t){e._trigger("receive",t,this._uiHash(this))}}.call(this,this.currentContainer)),s.push(function(e){return function(t){e._trigger("update",t,this._uiHash(this))}}.call(this,this.currentContainer)))),i=this.containers.length-1;0<=i;i--)e||s.push(n("deactivate",this,this.containers[i])),this.containers[i].containerCache.over&&(s.push(n("out",this,this.containers[i])),this.containers[i].containerCache.over=0);if(this.storedCursor&&(this.document.find("body").css("cursor",this.storedCursor),this.storedStylesheet.remove()),this._storedOpacity&&this.helper.css("opacity",this._storedOpacity),this._storedZIndex&&this.helper.css("zIndex","auto"===this._storedZIndex?"":this._storedZIndex),this.dragging=!1,e||this._trigger("beforeStop",t,this._uiHash()),this.placeholder[0].parentNode.removeChild(this.placeholder[0]),this.cancelHelperRemoval||(this.helper[0]!==this.currentItem[0]&&this.helper.remove(),this.helper=null),!e){for(i=0;i<s.length;i++)s[i].call(this,t);this._trigger("stop",t,this._uiHash())}return this.fromOutside=!1,!this.cancelHelperRemoval},_trigger:function(){!1===V.Widget.prototype._trigger.apply(this,arguments)&&this.cancel()},_uiHash:function(t){var e=t||this;return{helper:e.helper,placeholder:e.placeholder||V([]),position:e.position,originalPosition:e.originalPosition,offset:e.positionAbs,item:e.currentItem,sender:t?t.element:null}}});function ht(e){return function(){var t=this.element.val();e.apply(this,arguments),this._refresh(),t!==this.element.val()&&this._trigger("change")}}V.widget("ui.spinner",{version:"1.13.2",defaultElement:"<input>",widgetEventPrefix:"spin",options:{classes:{"ui-spinner":"ui-corner-all","ui-spinner-down":"ui-corner-br","ui-spinner-up":"ui-corner-tr"},culture:null,icons:{down:"ui-icon-triangle-1-s",up:"ui-icon-triangle-1-n"},incremental:!0,max:null,min:null,numberFormat:null,page:10,step:1,change:null,spin:null,start:null,stop:null},_create:function(){this._setOption("max",this.options.max),this._setOption("min",this.options.min),this._setOption("step",this.options.step),""!==this.value()&&this._value(this.element.val(),!0),this._draw(),this._on(this._events),this._refresh(),this._on(this.window,{beforeunload:function(){this.element.removeAttr("autocomplete")}})},_getCreateOptions:function(){var s=this._super(),n=this.element;return V.each(["min","max","step"],function(t,e){var i=n.attr(e);null!=i&&i.length&&(s[e]=i)}),s},_events:{keydown:function(t){this._start(t)&&this._keydown(t)&&t.preventDefault()},keyup:"_stop",focus:function(){this.previous=this.element.val()},blur:function(t){this.cancelBlur?delete this.cancelBlur:(this._stop(),this._refresh(),this.previous!==this.element.val()&&this._trigger("change",t))},mousewheel:function(t,e){var i=V.ui.safeActiveElement(this.document[0]);if(this.element[0]===i&&e){if(!this.spinning&&!this._start(t))return!1;this._spin((0<e?1:-1)*this.options.step,t),clearTimeout(this.mousewheelTimer),this.mousewheelTimer=this._delay(function(){this.spinning&&this._stop(t)},100),t.preventDefault()}},"mousedown .ui-spinner-button":function(t){var e;function i(){this.element[0]===V.ui.safeActiveElement(this.document[0])||(this.element.trigger("focus"),this.previous=e,this._delay(function(){this.previous=e}))}e=this.element[0]===V.ui.safeActiveElement(this.document[0])?this.previous:this.element.val(),t.preventDefault(),i.call(this),this.cancelBlur=!0,this._delay(function(){delete this.cancelBlur,i.call(this)}),!1!==this._start(t)&&this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseup .ui-spinner-button":"_stop","mouseenter .ui-spinner-button":function(t){if(V(t.currentTarget).hasClass("ui-state-active"))return!1!==this._start(t)&&void this._repeat(null,V(t.currentTarget).hasClass("ui-spinner-up")?1:-1,t)},"mouseleave .ui-spinner-button":"_stop"},_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap("<span>").parent().append("<a></a><a></a>")},_draw:function(){this._enhance(),this._addClass(this.uiSpinner,"ui-spinner","ui-widget ui-widget-content"),this._addClass("ui-spinner-input"),this.element.attr("role","spinbutton"),this.buttons=this.uiSpinner.children("a").attr("tabIndex",-1).attr("aria-hidden",!0).button({classes:{"ui-button":""}}),this._removeClass(this.buttons,"ui-corner-all"),this._addClass(this.buttons.first(),"ui-spinner-button ui-spinner-up"),this._addClass(this.buttons.last(),"ui-spinner-button ui-spinner-down"),this.buttons.first().button({icon:this.options.icons.up,showLabel:!1}),this.buttons.last().button({icon:this.options.icons.down,showLabel:!1}),this.buttons.height()>Math.ceil(.5*this.uiSpinner.height())&&0<this.uiSpinner.height()&&this.uiSpinner.height(this.uiSpinner.height())},_keydown:function(t){var e=this.options,i=V.ui.keyCode;switch(t.keyCode){case i.UP:return this._repeat(null,1,t),!0;case i.DOWN:return this._repeat(null,-1,t),!0;case i.PAGE_UP:return this._repeat(null,e.page,t),!0;case i.PAGE_DOWN:return this._repeat(null,-e.page,t),!0}return!1},_start:function(t){return!(!this.spinning&&!1===this._trigger("start",t))&&(this.counter||(this.counter=1),this.spinning=!0)},_repeat:function(t,e,i){t=t||500,clearTimeout(this.timer),this.timer=this._delay(function(){this._repeat(40,e,i)},t),this._spin(e*this.options.step,i)},_spin:function(t,e){var i=this.value()||0;this.counter||(this.counter=1),i=this._adjustValue(i+t*this._increment(this.counter)),this.spinning&&!1===this._trigger("spin",e,{value:i})||(this._value(i),this.counter++)},_increment:function(t){var e=this.options.incremental;return e?"function"==typeof e?e(t):Math.floor(t*t*t/5e4-t*t/500+17*t/200+1):1},_precision:function(){var t=this._precisionOf(this.options.step);return t=null!==this.options.min?Math.max(t,this._precisionOf(this.options.min)):t},_precisionOf:function(t){var e=t.toString(),t=e.indexOf(".");return-1===t?0:e.length-t-1},_adjustValue:function(t){var e=this.options,i=null!==e.min?e.min:0,s=t-i;return t=i+Math.round(s/e.step)*e.step,t=parseFloat(t.toFixed(this._precision())),null!==e.max&&t>e.max?e.max:null!==e.min&&t<e.min?e.min:t},_stop:function(t){this.spinning&&(clearTimeout(this.timer),clearTimeout(this.mousewheelTimer),this.counter=0,this.spinning=!1,this._trigger("stop",t))},_setOption:function(t,e){var i;if("culture"===t||"numberFormat"===t)return i=this._parse(this.element.val()),this.options[t]=e,void this.element.val(this._format(i));"max"!==t&&"min"!==t&&"step"!==t||"string"==typeof e&&(e=this._parse(e)),"icons"===t&&(i=this.buttons.first().find(".ui-icon"),this._removeClass(i,null,this.options.icons.up),this._addClass(i,null,e.up),i=this.buttons.last().find(".ui-icon"),this._removeClass(i,null,this.options.icons.down),this._addClass(i,null,e.down)),this._super(t,e)},_setOptionDisabled:function(t){this._super(t),this._toggleClass(this.uiSpinner,null,"ui-state-disabled",!!t),this.element.prop("disabled",!!t),this.buttons.button(t?"disable":"enable")},_setOptions:ht(function(t){this._super(t)}),_parse:function(t){return""===(t="string"==typeof t&&""!==t?window.Globalize&&this.options.numberFormat?Globalize.parseFloat(t,10,this.options.culture):+t:t)||isNaN(t)?null:t},_format:function(t){return""===t?"":window.Globalize&&this.options.numberFormat?Globalize.format(t,this.options.numberFormat,this.options.culture):t},_refresh:function(){this.element.attr({"aria-valuemin":this.options.min,"aria-valuemax":this.options.max,"aria-valuenow":this._parse(this.element.val())})},isValid:function(){var t=this.value();return null!==t&&t===this._adjustValue(t)},_value:function(t,e){var i;""!==t&&null!==(i=this._parse(t))&&(e||(i=this._adjustValue(i)),t=this._format(i)),this.element.val(t),this._refresh()},_destroy:function(){this.element.prop("disabled",!1).removeAttr("autocomplete role aria-valuemin aria-valuemax aria-valuenow"),this.uiSpinner.replaceWith(this.element)},stepUp:ht(function(t){this._stepUp(t)}),_stepUp:function(t){this._start()&&(this._spin((t||1)*this.options.step),this._stop())},stepDown:ht(function(t){this._stepDown(t)}),_stepDown:function(t){this._start()&&(this._spin((t||1)*-this.options.step),this._stop())},pageUp:ht(function(t){this._stepUp((t||1)*this.options.page)}),pageDown:ht(function(t){this._stepDown((t||1)*this.options.page)}),value:function(t){if(!arguments.length)return this._parse(this.element.val());ht(this._value).call(this,t)},widget:function(){return this.uiSpinner}}),!1!==V.uiBackCompat&&V.widget("ui.spinner",V.ui.spinner,{_enhance:function(){this.uiSpinner=this.element.attr("autocomplete","off").wrap(this._uiSpinnerHtml()).parent().append(this._buttonHtml())},_uiSpinnerHtml:function(){return"<span>"},_buttonHtml:function(){return"<a></a><a></a>"}});var ct;V.ui.spinner;V.widget("ui.tabs",{version:"1.13.2",delay:300,options:{active:null,classes:{"ui-tabs":"ui-corner-all","ui-tabs-nav":"ui-corner-all","ui-tabs-panel":"ui-corner-bottom","ui-tabs-tab":"ui-corner-top"},collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:(ct=/#.*$/,function(t){var e=t.href.replace(ct,""),i=location.href.replace(ct,"");try{e=decodeURIComponent(e)}catch(t){}try{i=decodeURIComponent(i)}catch(t){}return 1<t.hash.length&&e===i}),_create:function(){var e=this,t=this.options;this.running=!1,this._addClass("ui-tabs","ui-widget ui-widget-content"),this._toggleClass("ui-tabs-collapsible",null,t.collapsible),this._processTabs(),t.active=this._initialActive(),Array.isArray(t.disabled)&&(t.disabled=V.uniqueSort(t.disabled.concat(V.map(this.tabs.filter(".ui-state-disabled"),function(t){return e.tabs.index(t)}))).sort()),!1!==this.options.active&&this.anchors.length?this.active=this._findActive(t.active):this.active=V(),this._refresh(),this.active.length&&this.load(t.active)},_initialActive:function(){var i=this.options.active,t=this.options.collapsible,s=location.hash.substring(1);return null===i&&(s&&this.tabs.each(function(t,e){if(V(e).attr("aria-controls")===s)return i=t,!1}),null!==(i=null===i?this.tabs.index(this.tabs.filter(".ui-tabs-active")):i)&&-1!==i||(i=!!this.tabs.length&&0)),!1!==i&&-1===(i=this.tabs.index(this.tabs.eq(i)))&&(i=!t&&0),i=!t&&!1===i&&this.anchors.length?0:i},_getCreateEventData:function(){return{tab:this.active,panel:this.active.length?this._getPanelForTab(this.active):V()}},_tabKeydown:function(t){var e=V(V.ui.safeActiveElement(this.document[0])).closest("li"),i=this.tabs.index(e),s=!0;if(!this._handlePageNav(t)){switch(t.keyCode){case V.ui.keyCode.RIGHT:case V.ui.keyCode.DOWN:i++;break;case V.ui.keyCode.UP:case V.ui.keyCode.LEFT:s=!1,i--;break;case V.ui.keyCode.END:i=this.anchors.length-1;break;case V.ui.keyCode.HOME:i=0;break;case V.ui.keyCode.SPACE:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i);case V.ui.keyCode.ENTER:return t.preventDefault(),clearTimeout(this.activating),void this._activate(i!==this.options.active&&i);default:return}t.preventDefault(),clearTimeout(this.activating),i=this._focusNextTab(i,s),t.ctrlKey||t.metaKey||(e.attr("aria-selected","false"),this.tabs.eq(i).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",i)},this.delay))}},_panelKeydown:function(t){this._handlePageNav(t)||t.ctrlKey&&t.keyCode===V.ui.keyCode.UP&&(t.preventDefault(),this.active.trigger("focus"))},_handlePageNav:function(t){return t.altKey&&t.keyCode===V.ui.keyCode.PAGE_UP?(this._activate(this._focusNextTab(this.options.active-1,!1)),!0):t.altKey&&t.keyCode===V.ui.keyCode.PAGE_DOWN?(this._activate(this._focusNextTab(this.options.active+1,!0)),!0):void 0},_findNextTab:function(t,e){var i=this.tabs.length-1;for(;-1!==V.inArray(t=(t=i<t?0:t)<0?i:t,this.options.disabled);)t=e?t+1:t-1;return t},_focusNextTab:function(t,e){return t=this._findNextTab(t,e),this.tabs.eq(t).trigger("focus"),t},_setOption:function(t,e){"active"!==t?(this._super(t,e),"collapsible"===t&&(this._toggleClass("ui-tabs-collapsible",null,e),e||!1!==this.options.active||this._activate(0)),"event"===t&&this._setupEvents(e),"heightStyle"===t&&this._setupHeightStyle(e)):this._activate(e)},_sanitizeSelector:function(t){return t?t.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var t=this.options,e=this.tablist.children(":has(a[href])");t.disabled=V.map(e.filter(".ui-state-disabled"),function(t){return e.index(t)}),this._processTabs(),!1!==t.active&&this.anchors.length?this.active.length&&!V.contains(this.tablist[0],this.active[0])?this.tabs.length===t.disabled.length?(t.active=!1,this.active=V()):this._activate(this._findNextTab(Math.max(0,t.active-1),!1)):t.active=this.tabs.index(this.active):(t.active=!1,this.active=V()),this._refresh()},_refresh:function(){this._setOptionDisabled(this.options.disabled),this._setupEvents(this.options.event),this._setupHeightStyle(this.options.heightStyle),this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1}),this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"}),this.active.length?(this.active.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._addClass(this.active,"ui-tabs-active","ui-state-active"),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var l=this,t=this.tabs,e=this.anchors,i=this.panels;this.tablist=this._getList().attr("role","tablist"),this._addClass(this.tablist,"ui-tabs-nav","ui-helper-reset ui-helper-clearfix ui-widget-header"),this.tablist.on("mousedown"+this.eventNamespace,"> li",function(t){V(this).is(".ui-state-disabled")&&t.preventDefault()}).on("focus"+this.eventNamespace,".ui-tabs-anchor",function(){V(this).closest("li").is(".ui-state-disabled")&&this.blur()}),this.tabs=this.tablist.find("> li:has(a[href])").attr({role:"tab",tabIndex:-1}),this._addClass(this.tabs,"ui-tabs-tab","ui-state-default"),this.anchors=this.tabs.map(function(){return V("a",this)[0]}).attr({tabIndex:-1}),this._addClass(this.anchors,"ui-tabs-anchor"),this.panels=V(),this.anchors.each(function(t,e){var i,s,n,o=V(e).uniqueId().attr("id"),a=V(e).closest("li"),r=a.attr("aria-controls");l._isLocal(e)?(n=(i=e.hash).substring(1),s=l.element.find(l._sanitizeSelector(i))):(n=a.attr("aria-controls")||V({}).uniqueId()[0].id,(s=l.element.find(i="#"+n)).length||(s=l._createPanel(n)).insertAfter(l.panels[t-1]||l.tablist),s.attr("aria-live","polite")),s.length&&(l.panels=l.panels.add(s)),r&&a.data("ui-tabs-aria-controls",r),a.attr({"aria-controls":n,"aria-labelledby":o}),s.attr("aria-labelledby",o)}),this.panels.attr("role","tabpanel"),this._addClass(this.panels,"ui-tabs-panel","ui-widget-content"),t&&(this._off(t.not(this.tabs)),this._off(e.not(this.anchors)),this._off(i.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol, ul").eq(0)},_createPanel:function(t){return V("<div>").attr("id",t).data("ui-tabs-destroy",!0)},_setOptionDisabled:function(t){var e,i;for(Array.isArray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1),i=0;e=this.tabs[i];i++)e=V(e),!0===t||-1!==V.inArray(i,t)?(e.attr("aria-disabled","true"),this._addClass(e,null,"ui-state-disabled")):(e.removeAttr("aria-disabled"),this._removeClass(e,null,"ui-state-disabled"));this.options.disabled=t,this._toggleClass(this.widget(),this.widgetFullName+"-disabled",null,!0===t)},_setupEvents:function(t){var i={};t&&V.each(t.split(" "),function(t,e){i[e]="_eventHandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(!0,this.anchors,{click:function(t){t.preventDefault()}}),this._on(this.anchors,i),this._on(this.tabs,{keydown:"_tabKeydown"}),this._on(this.panels,{keydown:"_panelKeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupHeightStyle:function(t){var i,e=this.element.parent();"fill"===t?(i=e.height(),i-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var t=V(this),e=t.css("position");"absolute"!==e&&"fixed"!==e&&(i-=t.outerHeight(!0))}),this.element.children().not(this.panels).each(function(){i-=V(this).outerHeight(!0)}),this.panels.each(function(){V(this).height(Math.max(0,i-V(this).innerHeight()+V(this).height()))}).css("overflow","auto")):"auto"===t&&(i=0,this.panels.each(function(){i=Math.max(i,V(this).height("").height())}).height(i))},_eventHandler:function(t){var e=this.options,i=this.active,s=V(t.currentTarget).closest("li"),n=s[0]===i[0],o=n&&e.collapsible,a=o?V():this._getPanelForTab(s),r=i.length?this._getPanelForTab(i):V(),i={oldTab:i,oldPanel:r,newTab:o?V():s,newPanel:a};t.preventDefault(),s.hasClass("ui-state-disabled")||s.hasClass("ui-tabs-loading")||this.running||n&&!e.collapsible||!1===this._trigger("beforeActivate",t,i)||(e.active=!o&&this.tabs.index(s),this.active=n?V():s,this.xhr&&this.xhr.abort(),r.length||a.length||V.error("jQuery UI Tabs: Mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,i))},_toggle:function(t,e){var i=this,s=e.newPanel,n=e.oldPanel;function o(){i.running=!1,i._trigger("activate",t,e)}function a(){i._addClass(e.newTab.closest("li"),"ui-tabs-active","ui-state-active"),s.length&&i.options.show?i._show(s,i.options.show,o):(s.show(),o())}this.running=!0,n.length&&this.options.hide?this._hide(n,this.options.hide,function(){i._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),a()}):(this._removeClass(e.oldTab.closest("li"),"ui-tabs-active","ui-state-active"),n.hide(),a()),n.attr("aria-hidden","true"),e.oldTab.attr({"aria-selected":"false","aria-expanded":"false"}),s.length&&n.length?e.oldTab.attr("tabIndex",-1):s.length&&this.tabs.filter(function(){return 0===V(this).attr("tabIndex")}).attr("tabIndex",-1),s.attr("aria-hidden","false"),e.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(t){var t=this._findActive(t);t[0]!==this.active[0]&&(t=(t=!t.length?this.active:t).find(".ui-tabs-anchor")[0],this._eventHandler({target:t,currentTarget:t,preventDefault:V.noop}))},_findActive:function(t){return!1===t?V():this.tabs.eq(t)},_getIndex:function(t){return t="string"==typeof t?this.anchors.index(this.anchors.filter("[href$='"+V.escapeSelector(t)+"']")):t},_destroy:function(){this.xhr&&this.xhr.abort(),this.tablist.removeAttr("role").off(this.eventNamespace),this.anchors.removeAttr("role tabIndex").removeUniqueId(),this.tabs.add(this.panels).each(function(){V.data(this,"ui-tabs-destroy")?V(this).remove():V(this).removeAttr("role tabIndex aria-live aria-busy aria-selected aria-labelledby aria-hidden aria-expanded")}),this.tabs.each(function(){var t=V(this),e=t.data("ui-tabs-aria-controls");e?t.attr("aria-controls",e).removeData("ui-tabs-aria-controls"):t.removeAttr("aria-controls")}),this.panels.show(),"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(i){var t=this.options.disabled;!1!==t&&(t=void 0!==i&&(i=this._getIndex(i),Array.isArray(t)?V.map(t,function(t){return t!==i?t:null}):V.map(this.tabs,function(t,e){return e!==i?e:null})),this._setOptionDisabled(t))},disable:function(t){var e=this.options.disabled;if(!0!==e){if(void 0===t)e=!0;else{if(t=this._getIndex(t),-1!==V.inArray(t,e))return;e=Array.isArray(e)?V.merge([t],e).sort():[t]}this._setOptionDisabled(e)}},load:function(t,s){t=this._getIndex(t);function n(t,e){"abort"===e&&o.panels.stop(!1,!0),o._removeClass(i,"ui-tabs-loading"),a.removeAttr("aria-busy"),t===o.xhr&&delete o.xhr}var o=this,i=this.tabs.eq(t),t=i.find(".ui-tabs-anchor"),a=this._getPanelForTab(i),r={tab:i,panel:a};this._isLocal(t[0])||(this.xhr=V.ajax(this._ajaxSettings(t,s,r)),this.xhr&&"canceled"!==this.xhr.statusText&&(this._addClass(i,"ui-tabs-loading"),a.attr("aria-busy","true"),this.xhr.done(function(t,e,i){setTimeout(function(){a.html(t),o._trigger("load",s,r),n(i,e)},1)}).fail(function(t,e){setTimeout(function(){n(t,e)},1)})))},_ajaxSettings:function(t,i,s){var n=this;return{url:t.attr("href").replace(/#.*$/,""),beforeSend:function(t,e){return n._trigger("beforeLoad",i,V.extend({jqXHR:t,ajaxSettings:e},s))}}},_getPanelForTab:function(t){t=V(t).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+t))}}),!1!==V.uiBackCompat&&V.widget("ui.tabs",V.ui.tabs,{_processTabs:function(){this._superApply(arguments),this._addClass(this.tabs,"ui-tab")}});V.ui.tabs;V.widget("ui.tooltip",{version:"1.13.2",options:{classes:{"ui-tooltip":"ui-corner-all ui-widget-shadow"},content:function(){var t=V(this).attr("title");return V("<a>").text(t).html()},hide:!0,items:"[title]:not([disabled])",position:{my:"left top+15",at:"left bottom",collision:"flipfit flip"},show:!0,track:!1,close:null,open:null},_addDescribedBy:function(t,e){var i=(t.attr("aria-describedby")||"").split(/\s+/);i.push(e),t.data("ui-tooltip-id",e).attr("aria-describedby",String.prototype.trim.call(i.join(" ")))},_removeDescribedBy:function(t){var e=t.data("ui-tooltip-id"),i=(t.attr("aria-describedby")||"").split(/\s+/),e=V.inArray(e,i);-1!==e&&i.splice(e,1),t.removeData("ui-tooltip-id"),(i=String.prototype.trim.call(i.join(" ")))?t.attr("aria-describedby",i):t.removeAttr("aria-describedby")},_create:function(){this._on({mouseover:"open",focusin:"open"}),this.tooltips={},this.parents={},this.liveRegion=V("<div>").attr({role:"log","aria-live":"assertive","aria-relevant":"additions"}).appendTo(this.document[0].body),this._addClass(this.liveRegion,null,"ui-helper-hidden-accessible"),this.disabledTitles=V([])},_setOption:function(t,e){var i=this;this._super(t,e),"content"===t&&V.each(this.tooltips,function(t,e){i._updateContent(e.element)})},_setOptionDisabled:function(t){this[t?"_disable":"_enable"]()},_disable:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur");i.target=i.currentTarget=e.element[0],s.close(i,!0)}),this.disabledTitles=this.disabledTitles.add(this.element.find(this.options.items).addBack().filter(function(){var t=V(this);if(t.is("[title]"))return t.data("ui-tooltip-title",t.attr("title")).removeAttr("title")}))},_enable:function(){this.disabledTitles.each(function(){var t=V(this);t.data("ui-tooltip-title")&&t.attr("title",t.data("ui-tooltip-title"))}),this.disabledTitles=V([])},open:function(t){var i=this,e=V(t?t.target:this.element).closest(this.options.items);e.length&&!e.data("ui-tooltip-id")&&(e.attr("title")&&e.data("ui-tooltip-title",e.attr("title")),e.data("ui-tooltip-open",!0),t&&"mouseover"===t.type&&e.parents().each(function(){var t,e=V(this);e.data("ui-tooltip-open")&&((t=V.Event("blur")).target=t.currentTarget=this,i.close(t,!0)),e.attr("title")&&(e.uniqueId(),i.parents[this.id]={element:this,title:e.attr("title")},e.attr("title",""))}),this._registerCloseHandlers(t,e),this._updateContent(e,t))},_updateContent:function(e,i){var t=this.options.content,s=this,n=i?i.type:null;if("string"==typeof t||t.nodeType||t.jquery)return this._open(i,e,t);(t=t.call(e[0],function(t){s._delay(function(){e.data("ui-tooltip-open")&&(i&&(i.type=n),this._open(i,e,t))})}))&&this._open(i,e,t)},_open:function(t,e,i){var s,n,o,a=V.extend({},this.options.position);function r(t){a.of=t,n.is(":hidden")||n.position(a)}i&&((s=this._find(e))?s.tooltip.find(".ui-tooltip-content").html(i):(e.is("[title]")&&(t&&"mouseover"===t.type?e.attr("title",""):e.removeAttr("title")),s=this._tooltip(e),n=s.tooltip,this._addDescribedBy(e,n.attr("id")),n.find(".ui-tooltip-content").html(i),this.liveRegion.children().hide(),(i=V("<div>").html(n.find(".ui-tooltip-content").html())).removeAttr("name").find("[name]").removeAttr("name"),i.removeAttr("id").find("[id]").removeAttr("id"),i.appendTo(this.liveRegion),this.options.track&&t&&/^mouse/.test(t.type)?(this._on(this.document,{mousemove:r}),r(t)):n.position(V.extend({of:e},this.options.position)),n.hide(),this._show(n,this.options.show),this.options.track&&this.options.show&&this.options.show.delay&&(o=this.delayedShow=setInterval(function(){n.is(":visible")&&(r(a.of),clearInterval(o))},13)),this._trigger("open",t,{tooltip:n})))},_registerCloseHandlers:function(t,e){var i={keyup:function(t){t.keyCode===V.ui.keyCode.ESCAPE&&((t=V.Event(t)).currentTarget=e[0],this.close(t,!0))}};e[0]!==this.element[0]&&(i.remove=function(){var t=this._find(e);t&&this._removeTooltip(t.tooltip)}),t&&"mouseover"!==t.type||(i.mouseleave="close"),t&&"focusin"!==t.type||(i.focusout="close"),this._on(!0,e,i)},close:function(t){var e,i=this,s=V(t?t.currentTarget:this.element),n=this._find(s);n?(e=n.tooltip,n.closing||(clearInterval(this.delayedShow),s.data("ui-tooltip-title")&&!s.attr("title")&&s.attr("title",s.data("ui-tooltip-title")),this._removeDescribedBy(s),n.hiding=!0,e.stop(!0),this._hide(e,this.options.hide,function(){i._removeTooltip(V(this))}),s.removeData("ui-tooltip-open"),this._off(s,"mouseleave focusout keyup"),s[0]!==this.element[0]&&this._off(s,"remove"),this._off(this.document,"mousemove"),t&&"mouseleave"===t.type&&V.each(this.parents,function(t,e){V(e.element).attr("title",e.title),delete i.parents[t]}),n.closing=!0,this._trigger("close",t,{tooltip:e}),n.hiding||(n.closing=!1))):s.removeData("ui-tooltip-open")},_tooltip:function(t){var e=V("<div>").attr("role","tooltip"),i=V("<div>").appendTo(e),s=e.uniqueId().attr("id");return this._addClass(i,"ui-tooltip-content"),this._addClass(e,"ui-tooltip","ui-widget ui-widget-content"),e.appendTo(this._appendTo(t)),this.tooltips[s]={element:t,tooltip:e}},_find:function(t){t=t.data("ui-tooltip-id");return t?this.tooltips[t]:null},_removeTooltip:function(t){clearInterval(this.delayedShow),t.remove(),delete this.tooltips[t.attr("id")]},_appendTo:function(t){t=t.closest(".ui-front, dialog");return t=!t.length?this.document[0].body:t},_destroy:function(){var s=this;V.each(this.tooltips,function(t,e){var i=V.Event("blur"),e=e.element;i.target=i.currentTarget=e[0],s.close(i,!0),V("#"+t).remove(),e.data("ui-tooltip-title")&&(e.attr("title")||e.attr("title",e.data("ui-tooltip-title")),e.removeData("ui-tooltip-title"))}),this.liveRegion.remove()}}),!1!==V.uiBackCompat&&V.widget("ui.tooltip",V.ui.tooltip,{options:{tooltipClass:null},_tooltip:function(){var t=this._superApply(arguments);return this.options.tooltipClass&&t.tooltip.addClass(this.options.tooltipClass),t}});V.ui.tooltip});
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/pager',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'jquery-ui'
- ], function($, utils, i18n) {
- "use strict";
- var Pager = function (pager_selector, options) {
- /**
- * Constructor
- *
- * Parameters:
- * pager_selector: string
- * options: dictionary
- * Dictionary of keyword arguments.
- * events: $(Events) instance
- */
- this.events = options.events;
- this.pager_element = $(pager_selector);
- this.pager_button_area = $('#pager-button-area');
- this._default_end_space = 100;
- this.pager_element.resizable({handles: 'n', resize: $.proxy(this._resize, this)});
- this.expanded = false;
- this.create_button_area();
- this.bind_events();
- };
- Pager.prototype.create_button_area = function(){
- var that = this;
- this.pager_button_area.append(
- $('<a>').attr('role', "button")
- .attr('title',i18n.msg._("Open the pager in an external window"))
- .addClass('ui-button')
- .click(function(){that.detach();})
- .append(
- $('<span>').addClass("ui-icon ui-icon-extlink")
- )
- );
- this.pager_button_area.append(
- $('<a>').attr('role', "button")
- .attr('title',i18n.msg._("Close the pager"))
- .addClass('ui-button')
- .click(function(){that.collapse();})
- .append(
- $('<span>').addClass("ui-icon ui-icon-close")
- )
- );
- };
- Pager.prototype.bind_events = function () {
- var that = this;
- this.pager_element.bind('collapse_pager', function (event, extrap) {
- // Animate hiding of the pager.
- var time = (extrap && extrap.duration) ? extrap.duration : 'fast';
- that.pager_element.animate({
- height: 'toggle'
- }, {
- duration: time,
- done: function() {
- $('.end_space').css('height', that._default_end_space);
- }
- });
- });
- this.pager_element.bind('expand_pager', function (event, extrap) {
- // Clear the pager's height attr if it's set. This allows the
- // pager to size itself according to its contents.
- that.pager_element.height('initial');
- // Animate the showing of the pager
- var time = (extrap && extrap.duration) ? extrap.duration : 'fast';
- that.pager_element.show(time, function() {
- // Explicitly set pager height once the pager has shown itself.
- // This allows the pager-contents div to use percentage sizing.
- that.pager_element.height(that.pager_element.height());
- that._resize();
-
- // HACK: Less horrible, but still horrible hack to force the
- // pager to show it's scrollbars on FireFox. ipython/ipython/#8853
- that.pager_element.css('position', 'relative');
- window.requestAnimationFrame(function() { /* Wait one frame */
- that.pager_element.css('position', '');
- });
- });
- });
- this.events.on('open_with_text.Pager', function (event, payload) {
- // FIXME: support other mime types with generic mimebundle display
- // mechanism
- if (payload.data['text/html'] && payload.data['text/html'] !== "") {
- that.clear();
- that.expand();
- that.append(payload.data['text/html']);
- } else if (payload.data['text/plain'] && payload.data['text/plain'] !== "") {
- that.clear();
- that.expand();
- that.append_text(payload.data['text/plain']);
- }
- });
- };
- Pager.prototype.collapse = function (extrap) {
- if (this.expanded === true) {
- this.expanded = false;
- this.pager_element.trigger('collapse_pager', extrap);
- }
- };
- Pager.prototype.expand = function (extrap) {
- if (this.expanded !== true) {
- this.expanded = true;
- this.pager_element.trigger('expand_pager', extrap);
- }
- };
- Pager.prototype.toggle = function () {
- if (this.expanded === true) {
- this.collapse();
- } else {
- this.expand();
- }
- };
- Pager.prototype.clear = function (text) {
- this.pager_element.find(".container").empty();
- };
- Pager.prototype.detach = function(){
- var w = window.open("","_blank");
- $(w.document.head)
- .append(
- $('<link>')
- .attr('rel',"stylesheet")
- .attr('href', utils.url_path_join(utils.get_body_data('baseUrl'), "static/style/style.min.css"))
- .attr('type',"text/css")
- )
- .append(
- $('<title>').text(i18n.msg._("Jupyter Pager"))
- );
- var pager_body = $(w.document.body);
- pager_body.css('overflow','scroll');
- pager_body.append(this.pager_element.clone().children());
- w.document.close();
- this.collapse();
- };
- Pager.prototype.append_text = function (text) {
- /**
- * The only user content injected with this HTML call is escaped by
- * the fixConsole() method.
- */
- this.pager_element.find(".container").append($('<pre/>').html(utils.fixConsole(utils.fixOverwrittenChars(text))));
- };
- Pager.prototype.append = function (htm) {
- /**
- * The only user content injected with this HTML call is escaped by
- * the fixConsole() method.
- */
- this.pager_element.find(".container").append(htm);
- };
- Pager.prototype._resize = function() {
- /**
- * Update document based on pager size.
- */
-
- // Make sure the padding at the end of the notebook is large
- // enough that the user can scroll to the bottom of the
- // notebook.
- $('.end_space').css('height', Math.max(this.pager_element.height(), this._default_end_space));
- };
- return {'Pager': Pager};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // Define promises for notebook events.
- define('notebook/js/promises',['base/js/events', 'base/js/promises'], function(events, promises) {
- "use strict";
- // Promise to be resolved when the notebook is *initially* loaded.
- // The event may fire again if the notebook is reloaded later, but this
- // promise only tracks the initial load.
- promises.notebook_loaded = new Promise(function(resolve, reject) {
- events.one('notebook_loaded.Notebook', function() {
- resolve();
- });
- events.one('notebook_load_failed.Notebook', function() {
- reject();
- });
- });
- return promises;
- });
- /* ===========================================================
- # bootstrap-tour - v0.9.0
- # http://bootstraptour.com
- # ==============================================================
- # Copyright 2012-2013 Ulrich Sossou
- #
- # Licensed under the Apache License, Version 2.0 (the "License");
- # you may not use this file except in compliance with the License.
- # You may obtain a copy of the License at
- #
- # http://www.apache.org/licenses/LICENSE-2.0
- #
- # Unless required by applicable law or agreed to in writing, software
- # distributed under the License is distributed on an "AS IS" BASIS,
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- # See the License for the specific language governing permissions and
- # limitations under the License.
- */
- !function(a,b){var c,d;return d=b.document,c=function(){function c(c){this._options=a.extend({name:"tour",steps:[],container:"body",keyboard:!0,storage:b.localStorage,debug:!1,backdrop:!1,redirect:!0,orphan:!1,duration:!1,basePath:"",template:"<div class='popover'> <div class='arrow'></div> <h3 class='popover-title'></h3> <div class='popover-content'></div> <div class='popover-navigation'> <div class='btn-group'> <button class='btn btn-sm btn-default' data-role='prev'>« Prev</button> <button class='btn btn-sm btn-default' data-role='next'>Next »</button> <button class='btn btn-sm btn-default' data-role='pause-resume' data-pause-text='Pause' data-resume-text='Resume'>Pause</button> </div> <button class='btn btn-sm btn-default' data-role='end'>End tour</button> </div> </div>",afterSetState:function(){},afterGetState:function(){},afterRemoveState:function(){},onStart:function(){},onEnd:function(){},onShow:function(){},onShown:function(){},onHide:function(){},onHidden:function(){},onNext:function(){},onPrev:function(){},onPause:function(){},onResume:function(){}},c),this._force=!1,this._inited=!1,this.backdrop={overlay:null,$element:null,$background:null,backgroundShown:!1,overlayElementShown:!1}}return c.prototype.addSteps=function(a){var b,c,d;for(c=0,d=a.length;d>c;c++)b=a[c],this.addStep(b);return this},c.prototype.addStep=function(a){return this._options.steps.push(a),this},c.prototype.getStep=function(b){return null!=this._options.steps[b]?a.extend({id:"step-"+b,path:"",placement:"right",title:"",content:"<p></p>",next:b===this._options.steps.length-1?-1:b+1,prev:b-1,animation:!0,container:this._options.container,backdrop:this._options.backdrop,redirect:this._options.redirect,orphan:this._options.orphan,duration:this._options.duration,template:this._options.template,onShow:this._options.onShow,onShown:this._options.onShown,onHide:this._options.onHide,onHidden:this._options.onHidden,onNext:this._options.onNext,onPrev:this._options.onPrev,onPause:this._options.onPause,onResume:this._options.onResume},this._options.steps[b]):void 0},c.prototype.init=function(a){var b=this;return this._force=a,this.ended()?(this._debug("Tour ended, init prevented."),this):(this.setCurrentStep(),this._initMouseNavigation(),this._initKeyboardNavigation(),this._onResize(function(){return b.showStep(b._current)}),null!==this._current&&this.showStep(this._current),this._inited=!0,this)},c.prototype.start=function(a){var b;return null==a&&(a=!1),this._inited||this.init(a),null===this._current&&(b=this._makePromise(null!=this._options.onStart?this._options.onStart(this):void 0),this._callOnPromiseDone(b,this.showStep,0)),this},c.prototype.next=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showNextStep)},c.prototype.prev=function(){var a;return a=this.hideStep(this._current),this._callOnPromiseDone(a,this._showPrevStep)},c.prototype.goTo=function(a){var b;return b=this.hideStep(this._current),this._callOnPromiseDone(b,this.showStep,a)},c.prototype.end=function(){var c,e,f=this;return c=function(){return a(d).off("click.tour-"+f._options.name),a(d).off("keyup.tour-"+f._options.name),a(b).off("resize.tour-"+f._options.name),f._setState("end","yes"),f._inited=!1,f._force=!1,f._clearTimer(),null!=f._options.onEnd?f._options.onEnd(f):void 0},e=this.hideStep(this._current),this._callOnPromiseDone(e,c)},c.prototype.ended=function(){return!this._force&&!!this._getState("end")},c.prototype.restart=function(){return this._removeState("current_step"),this._removeState("end"),this.setCurrentStep(0),this.start()},c.prototype.pause=function(){var a;return a=this.getStep(this._current),a&&a.duration?(this._paused=!0,this._duration-=(new Date).getTime()-this._start,b.clearTimeout(this._timer),this._debug("Paused/Stopped step "+(this._current+1)+" timer ("+this._duration+" remaining)."),null!=a.onPause?a.onPause(this,this._duration):void 0):this},c.prototype.resume=function(){var a,c=this;return a=this.getStep(this._current),a&&a.duration?(this._paused=!1,this._start=(new Date).getTime(),this._duration=this._duration||a.duration,this._timer=b.setTimeout(function(){return c._isLast()?c.next():c.end()},this._duration),this._debug("Started step "+(this._current+1)+" timer with duration "+this._duration),null!=a.onResume&&this._duration!==a.duration?a.onResume(this,this._duration):void 0):this},c.prototype.hideStep=function(b){var c,d,e,f=this;return(e=this.getStep(b))?(this._clearTimer(),d=this._makePromise(null!=e.onHide?e.onHide(this,b):void 0),c=function(){var b;return b=a(e.element),b.data("bs.popover")||b.data("popover")||(b=a("body")),b.popover("destroy"),e.reflex&&b.css("cursor","").off("click.tour-"+f._options.name),e.backdrop&&f._hideBackdrop(),null!=e.onHidden?e.onHidden(f):void 0},this._callOnPromiseDone(d,c),d):void 0},c.prototype.showStep=function(a){var b,c,e,f,g=this;return this.ended()?(this._debug("Tour ended, showStep prevented."),this):(f=this.getStep(a))?(e=a<this._current,b=this._makePromise(null!=f.onShow?f.onShow(this,a):void 0),c=function(){var b,c;if(g.setCurrentStep(a),c=function(){switch(toString.call(f.path)){case"[object Function]":return f.path();case"[object String]":return this._options.basePath+f.path;default:return f.path}}.call(g),b=[d.location.pathname,d.location.hash].join(""),g._isRedirect(c,b))return g._redirect(f,c),void 0;if(g._isOrphan(f)){if(!f.orphan)return g._debug("Skip the orphan step "+(g._current+1)+". Orphan option is false and the element doesn't exist or is hidden."),e?g._showPrevStep():g._showNextStep(),void 0;g._debug("Show the orphan step "+(g._current+1)+". Orphans option is true.")}return f.backdrop&&g._showBackdrop(g._isOrphan(f)?void 0:f.element),g._scrollIntoView(f.element,function(){return null!=f.element&&f.backdrop&&g._showOverlayElement(f.element),g._showPopover(f,a),null!=f.onShown&&f.onShown(g),g._debug("Step "+(g._current+1)+" of "+g._options.steps.length)}),f.duration?g.resume():void 0},this._callOnPromiseDone(b,c),b):void 0},c.prototype.getCurrentStep=function(){return this._current},c.prototype.setCurrentStep=function(a){return null!=a?(this._current=a,this._setState("current_step",a)):(this._current=this._getState("current_step"),this._current=null===this._current?null:parseInt(this._current,10)),this},c.prototype._setState=function(a,b){var c,d;if(this._options.storage){d=""+this._options.name+"_"+a;try{this._options.storage.setItem(d,b)}catch(e){c=e,c.code===DOMException.QUOTA_EXCEEDED_ERR&&this.debug("LocalStorage quota exceeded. State storage failed.")}return this._options.afterSetState(d,b)}return null==this._state&&(this._state={}),this._state[a]=b},c.prototype._removeState=function(a){var b;return this._options.storage?(b=""+this._options.name+"_"+a,this._options.storage.removeItem(b),this._options.afterRemoveState(b)):null!=this._state?delete this._state[a]:void 0},c.prototype._getState=function(a){var b,c;return this._options.storage?(b=""+this._options.name+"_"+a,c=this._options.storage.getItem(b)):null!=this._state&&(c=this._state[a]),(void 0===c||"null"===c)&&(c=null),this._options.afterGetState(a,c),c},c.prototype._showNextStep=function(){var a,b,c,d=this;return c=this.getStep(this._current),b=function(){return d.showStep(c.next)},a=this._makePromise(null!=c.onNext?c.onNext(this):void 0),this._callOnPromiseDone(a,b)},c.prototype._showPrevStep=function(){var a,b,c,d=this;return c=this.getStep(this._current),b=function(){return d.showStep(c.prev)},a=this._makePromise(null!=c.onPrev?c.onPrev(this):void 0),this._callOnPromiseDone(a,b)},c.prototype._debug=function(a){return this._options.debug?b.console.log("Bootstrap Tour '"+this._options.name+"' | "+a):void 0},c.prototype._isRedirect=function(a,b){return null!=a&&""!==a&&("[object RegExp]"===toString.call(a)&&!a.test(b)||"[object String]"===toString.call(a)&&a.replace(/\?.*$/,"").replace(/\/?$/,"")!==b.replace(/\/?$/,""))},c.prototype._redirect=function(b,c){return a.isFunction(b.redirect)?b.redirect.call(this,c):b.redirect===!0?(this._debug("Redirect to "+c),d.location.href=c):void 0},c.prototype._isOrphan=function(b){return null==b.element||!a(b.element).length||a(b.element).is(":hidden")&&"http://www.w3.org/2000/svg"!==a(b.element)[0].namespaceURI},c.prototype._isLast=function(){return this._current<this._options.steps.length-1},c.prototype._showPopover=function(b,c){var d,e,f,g,h,i,j=this;return i=a.extend({},this._options),f=a.isFunction(b.template)?a(b.template(c,b)):a(b.template),e=f.find(".popover-navigation"),h=this._isOrphan(b),h&&(b.element="body",b.placement="top",f=f.addClass("orphan")),d=a(b.element),f.addClass("tour-"+this._options.name+" tour-"+this._options.name+"-"+c),b.options&&a.extend(i,b.options),b.reflex&&d.css("cursor","pointer").on("click.tour-"+this._options.name,function(){return j._isLast()?j.next():j.end()}),b.prev<0&&e.find("[data-role='prev']").addClass("disabled"),b.next<0&&e.find("[data-role='next']").addClass("disabled"),b.duration||e.find("[data-role='pause-resume']").remove(),b.template=f.clone().wrap("<div>").parent().html(),d.popover({placement:b.placement,trigger:"manual",title:b.title,content:b.content,html:!0,animation:b.animation,container:b.container,template:b.template,selector:b.element}).popover("show"),g=d.data("bs.popover")?d.data("bs.popover").tip():d.data("popover").tip(),g.attr("id",b.id),this._reposition(g,b),h?this._center(g):void 0},c.prototype._reposition=function(b,c){var e,f,g,h,i,j,k;if(h=b[0].offsetWidth,f=b[0].offsetHeight,k=b.offset(),i=k.left,j=k.top,e=a(d).outerHeight()-k.top-b.outerHeight(),0>e&&(k.top=k.top+e),g=a("html").outerWidth()-k.left-b.outerWidth(),0>g&&(k.left=k.left+g),k.top<0&&(k.top=0),k.left<0&&(k.left=0),b.offset(k),"bottom"===c.placement||"top"===c.placement){if(i!==k.left)return this._replaceArrow(b,2*(k.left-i),h,"left")}else if(j!==k.top)return this._replaceArrow(b,2*(k.top-j),f,"top")},c.prototype._center=function(c){return c.css("top",a(b).outerHeight()/2-c.outerHeight()/2)},c.prototype._replaceArrow=function(a,b,c,d){return a.find(".arrow").css(d,b?50*(1-b/c)+"%":"")},c.prototype._scrollIntoView=function(c,d){var e,f,g,h,i,j,k=this;return e=a(c),e.length?(f=a(b),h=e.offset().top,j=f.height(),i=Math.max(0,h-j/2),this._debug("Scroll into view. ScrollTop: "+i+". Element offset: "+h+". Window height: "+j+"."),g=0,a("body,html").stop(!0,!0).animate({scrollTop:Math.ceil(i)},function(){return 2===++g?(d(),k._debug("Scroll into view. Animation end element offset: "+e.offset().top+". Window height: "+f.height()+".")):void 0})):d()},c.prototype._onResize=function(c,d){return a(b).on("resize.tour-"+this._options.name,function(){return clearTimeout(d),d=setTimeout(c,100)})},c.prototype._initMouseNavigation=function(){var b=this;return b=this,a(d).off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']:not(.disabled)").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']:not(.disabled)").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']").off("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']").on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='next']:not(.disabled)",function(a){return a.preventDefault(),b.next()}).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='prev']:not(.disabled)",function(a){return a.preventDefault(),b.prev()}).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='end']",function(a){return a.preventDefault(),b.end()}).on("click.tour-"+this._options.name,".popover.tour-"+this._options.name+" *[data-role='pause-resume']",function(c){var d;return c.preventDefault(),d=a(this),d.text(b._paused?d.data("pause-text"):d.data("resume-text")),b._paused?b.resume():b.pause()})},c.prototype._initKeyboardNavigation=function(){var b=this;if(this._options.keyboard)return a(d).on("keyup.tour-"+this._options.name,function(a){if(a.which)switch(a.which){case 39:return a.preventDefault(),b._isLast()?b.next():b.end();case 37:if(a.preventDefault(),b._current>0)return b.prev();break;case 27:return a.preventDefault(),b.end()}})},c.prototype._makePromise=function(b){return b&&a.isFunction(b.then)?b:null},c.prototype._callOnPromiseDone=function(a,b,c){var d=this;return a?a.then(function(){return b.call(d,c)}):b.call(this,c)},c.prototype._showBackdrop=function(){return this.backdrop.backgroundShown?void 0:(this.backdrop=a("<div/>",{"class":"tour-backdrop"}),this.backdrop.backgroundShown=!0,a("body").append(this.backdrop))},c.prototype._hideBackdrop=function(){return this._hideOverlayElement(),this._hideBackground()},c.prototype._hideBackground=function(){return this.backdrop.remove(),this.backdrop.overlay=null,this.backdrop.backgroundShown=!1},c.prototype._showOverlayElement=function(b){var c,d,e;return d=a(b),d&&0!==d.length&&!this.backdrop.overlayElementShown?(this.backdrop.overlayElementShown=!0,c=a("<div/>"),e=d.offset(),e.top=e.top,e.left=e.left,c.width(d.innerWidth()).height(d.innerHeight()).addClass("tour-step-background").offset(e),d.addClass("tour-step-backdrop"),a("body").append(c),this.backdrop.$element=d,this.backdrop.$background=c):void 0},c.prototype._hideOverlayElement=function(){return this.backdrop.overlayElementShown?(this.backdrop.$element.removeClass("tour-step-backdrop"),this.backdrop.$background.remove(),this.backdrop.$element=null,this.backdrop.$background=null,this.backdrop.overlayElementShown=!1):void 0},c.prototype._clearTimer=function(){return b.clearTimeout(this._timer),this._timer=null,this._duration=null},c}(),b.Tour=c}(jQuery,window);
- define("bootstraptour", ["bootstrap"], (function (global) {
- return function () {
- var ret, fn;
- return ret || global.Tour;
- };
- }(this)));
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/tour',['jquery', 'bootstraptour', 'base/js/i18n'], function($, Tour, i18n) {
- "use strict";
- var tour_style = "<div class='popover tour'>\n" +
- "<div class='arrow'></div>\n" +
- "<div style='position:absolute; top:7px; right:7px'>\n" +
- "<button class='btn btn-default btn-sm fa fa-times' data-role='end'></button>\n" +
- "</div><h3 class='popover-title'></h3>\n" +
- "<div class='popover-content'></div>\n" +
- "<div class='popover-navigation'>\n" +
- "<button class='btn btn-default fa fa-step-backward' data-role='prev'></button>\n" +
- "<button class='btn btn-default fa fa-step-forward pull-right' data-role='next'></button>\n" +
- "<button id='tour-pause' class='btn btn-sm btn-default fa fa-pause' data-resume-text='' data-pause-text='' data-role='pause-resume'></button>\n" +
- "</div>\n" +
- "</div>";
- var NotebookTour = function (notebook, events) {
- var that = this;
- this.notebook = notebook;
- this.step_duration = 0;
- this.events = events;
- this.tour_steps = [
- {
- title: i18n.msg._("Welcome to the Notebook Tour"),
- placement: 'bottom',
- orphan: true,
- content: i18n.msg._("You can use the left and right arrow keys to go backwards and forwards.")
- }, {
- element: "#notebook_name",
- title: i18n.msg._("Filename"),
- placement: 'bottom',
- content: i18n.msg._("Click here to change the filename for this notebook.")
- }, {
- element: $("#menus").parent(),
- placement: 'bottom',
- title: i18n.msg._("Notebook Menubar"),
- content: i18n.msg._("The menubar has menus for actions on the notebook, its cells, and the kernel it communicates with.")
- }, {
- element: "#maintoolbar",
- placement: 'bottom',
- title: i18n.msg._("Notebook Toolbar"),
- content: i18n.msg._("The toolbar has buttons for the most common actions. Hover your mouse over each button for more information.")
- }, {
- element: "#modal_indicator",
- title: i18n.msg._("Mode Indicator"),
- placement: 'bottom',
- content: i18n.msg._("The Notebook has two modes: Edit Mode and Command Mode. In this area, an indicator can appear to tell you which mode you are in."),
- onShow: function(tour) { that.command_icon_hack(); }
- }, {
- element: "#modal_indicator",
- title: i18n.msg._("Command Mode"),
- placement: 'bottom',
- onShow: function(tour) { notebook.command_mode(); that.command_icon_hack(); },
- onNext: function(tour) { that.edit_mode(); },
- content: i18n.msg._("Right now you are in Command Mode, and many keyboard shortcuts are available. In this mode, no icon is displayed in the indicator area.")
- }, {
- element: "#modal_indicator",
- title: i18n.msg._("Edit Mode"),
- placement: 'bottom',
- onShow: function(tour) { that.edit_mode(); },
- content: i18n.msg._("Pressing <code>Enter</code> or clicking in the input text area of the cell switches to Edit Mode.")
- }, {
- element: '.selected',
- title: i18n.msg._("Edit Mode"),
- placement: 'bottom',
- onShow: function(tour) { that.edit_mode(); },
- content: i18n.msg._("Notice that the border around the currently active cell changed color. Typing will insert text into the currently active cell.")
- }, {
- element: '.selected',
- title: i18n.msg._("Back to Command Mode"),
- placement: 'bottom',
- onShow: function(tour) { notebook.command_mode(); },
- content: i18n.msg._("Pressing <code>Esc</code> or clicking outside of the input text area takes you back to Command Mode.")
- }, {
- element: '#keyboard_shortcuts',
- title: i18n.msg._("Keyboard Shortcuts"),
- placement: 'bottom',
- onShow: function(tour) {
- /** need to add `open` and `pulse` classes in 2 calls */
- $('#help_menu').parent().addClass('open');
- $('#help_menu').parent().addClass('pulse');
- $('#keyboard_shortcuts').addClass('pulse');
- },
- onHide: function(tour) {
- $('#help_menu').parent().removeClass('open pulse');
- $('#keyboard_shortcuts').removeClass('pulse');
- },
- content: i18n.msg._("You can click here to get a list of all of the keyboard shortcuts.")
- }, {
- element: "#kernel_indicator_icon",
- title: i18n.msg._("Kernel Indicator"),
- placement: 'bottom',
- onShow: function(tour) { events.trigger('kernel_idle.Kernel');},
- content: i18n.msg._("This is the Kernel indicator. It looks like this when the Kernel is idle.")
- }, {
- element: "#kernel_indicator_icon",
- title: i18n.msg._("Kernel Indicator"),
- placement: 'bottom',
- onShow: function(tour) { events.trigger('kernel_busy.Kernel'); },
- content: i18n.msg._("The Kernel indicator looks like this when the Kernel is busy.")
- }, {
- element: ".fa-stop",
- placement: 'bottom',
- title: i18n.msg._("Interrupting the Kernel"),
- onHide: function(tour) { events.trigger('kernel_idle.Kernel'); },
- content: i18n.msg._("To cancel a computation in progress, you can click here.")
- }, {
- element: "#notification_kernel",
- placement: 'bottom',
- onShow: function(tour) { $('.fa-stop').click(); },
- title: i18n.msg._("Notification Area"),
- content: i18n.msg._("Messages in response to user actions (Save, Interrupt, etc.) appear here.")
- }, {
- title: i18n.msg._("End of Tour"),
- placement: 'bottom',
- orphan: true,
- content: i18n.msg._("This concludes the Jupyter Notebook User Interface Tour.")
- }
- ];
- this.tour = new Tour({
- storage: false, // start tour from beginning every time
- debug: true,
- reflex: true, // click on element to continue tour
- animation: false,
- duration: this.step_duration,
- onStart: function() { console.log('tour started'); },
- // TODO: remove the onPause/onResume logic once pi's patch has been
- // merged upstream to make this work via data-resume-class and
- // data-resume-text attributes.
- onPause: this.toggle_pause_play,
- onResume: this.toggle_pause_play,
- steps: this.tour_steps,
- template: tour_style,
- orphan: true
- });
-
- };
- NotebookTour.prototype.start = function () {
- console.log("let's start the tour");
- this.tour.init();
- this.tour.start();
- if (this.tour.ended())
- {
- this.tour.restart();
- }
- };
- NotebookTour.prototype.command_icon_hack = function() {
- $('#modal_indicator').css('min-height', '18px');
- };
-
- NotebookTour.prototype.toggle_pause_play = function () {
- $('#tour-pause').toggleClass('fa-pause fa-play');
- };
-
- NotebookTour.prototype.edit_mode = function() {
- this.notebook.focus_cell();
- this.notebook.edit_mode();
- };
- return {'Tour': NotebookTour};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/menubar',[
- 'jquery',
- 'base/js/namespace',
- 'base/js/dialog',
- 'base/js/utils',
- 'base/js/i18n',
- 'notebook/js/quickhelp',
- './celltoolbar',
- './tour',
- 'moment',
- ], function($, IPython, dialog, utils, i18n, quickhelp, celltoolbar, tour, moment) {
- "use strict";
- var MenuBar = function (selector, options) {
- /**
- * Constructor
- *
- * A MenuBar Class to generate the menubar of Jupyter notebook
- *
- * Parameters:
- * selector: string
- * options: dictionary
- * Dictionary of keyword arguments.
- * notebook: Notebook instance
- * render keyboard shortcuts from KeyboardManager
- * contents: ContentManager instance
- * events: $(Events) instance
- * save_widget: SaveWidget instance
- * quick_help: QuickHelp instance
- * base_url : string
- * notebook_path : string
- * notebook_name : string
- * config: ConfigSection instance
- */
- options = options || {};
- this.nbclassic_path = options.nbclassic_path;
- this.base_url = options.base_url || utils.get_body_data("baseUrl");
- this.selector = selector;
- this.notebook = options.notebook;
- this.keyboard_manager = this.notebook.keyboard_manager;
- this.actions = this.keyboard_manager.actions;
- this.contents = options.contents;
- this.events = options.events;
- this.save_widget = options.save_widget;
- this.quick_help = options.quick_help;
- this.actions = options.actions;
- this.config = options.config;
- try {
- this.tour = new tour.Tour(this.notebook, this.events);
- } catch (e) {
- this.tour = undefined;
- console.log("Failed to instantiate Notebook Tour", e);
- }
- if (this.selector !== undefined) {
- this.element = $(selector);
- this.style();
- this.add_bundler_items();
- this.bind_events();
- }
- };
- // TODO: This has definitively nothing to do with style ...
- MenuBar.prototype.style = function () {
- var that = this;
- this.element.find("li").click(function (event, ui) {
- // The selected cell loses focus when the menu is entered, so we
- // re-select it upon selection.
- var i = that.notebook.get_selected_index();
- that.notebook.select(i, false);
- }
- );
- };
-
- MenuBar.prototype.add_bundler_items = function() {
- var that = this;
- this.config.loaded.then(function() {
- var bundlers = that.config.data.bundlerextensions;
- if(bundlers) {
- // Stable sort the keys to ensure menu items don't hop around
- var ids = Object.keys(bundlers).sort()
- ids.forEach(function(bundler_id) {
- var bundler = bundlers[bundler_id];
- var group = that.element.find('#'+bundler.group+'_menu')
-
- // Validate menu item metadata
- if(!group.length) {
- console.warn('unknown group', bundler.group, 'for bundler ID', bundler_id, '; skipping');
- return;
- } else if(!bundler.label) {
- console.warn('no label for bundler ID', bundler_id, '; skipping');
- return;
- }
-
- // Insert menu item into correct group, click handler
- group.parent().removeClass('hidden');
- var $li = $('<li>')
- .appendTo(group);
- $('<a>')
- .attr('href', '#')
- .text(bundler.label)
- .appendTo($li)
- .on('click', that._bundle.bind(that, bundler_id))
- .appendTo($li);
- });
- }
- });
- };
- MenuBar.prototype._new_window = function(url) {
- var w = window.open('', IPython._target);
- if (this.notebook.dirty && this.notebook.writable) {
- this.notebook.save_notebook().then(function() {
- w.location = url;
- });
- } else {
- w.location = url;
- }
- };
-
- MenuBar.prototype._bundle = function(bundler_id) {
- // Read notebook path and base url here in case they change
- var notebook_path = utils.encode_uri_components(this.notebook.notebook_path);
- var url = utils.url_path_join(
- this.base_url,
- 'bundle',
- notebook_path
- ) + '?bundler=' + utils.encode_uri_components(bundler_id);
- this._new_window(url);
- };
- MenuBar.prototype._nbconvert = function (format, download) {
- download = download || false;
- var notebook_path = utils.encode_uri_components(this.notebook.notebook_path);
- var url = utils.url_path_join(
- this.base_url,
- 'nbconvert',
- format,
- notebook_path
- ) + "?download=" + download.toString();
-
- this._new_window(url);
- };
- MenuBar.prototype._size_header = function() {
- /**
- * Update header spacer size.
- */
- console.warn('`_size_header` is deprecated and will be removed in future versions.'+
- ' Please trigger the `resize-header.Page` manually if you rely on it.');
- this.events.trigger('resize-header.Page');
- };
- (function($){
- $(document).ready(function(){
- $('ul.dropdown-menu [data-toggle=dropdown]').on('click', function(event) {
- event.preventDefault();
- event.stopPropagation();
- $(this).parent().siblings().removeClass('open');
- $(this).parent().toggleClass('open');
- });
- });
- })(jQuery);
- MenuBar.prototype.bind_events = function () {
- /**
- * File
- */
- var that = this;
-
- this.element.find('#open_notebook').click(function () {
- var parent = utils.url_path_split(that.notebook.notebook_path)[0];
- window.open(
- utils.url_path_join(
- that.base_url, that.nbclassic_path, 'tree',
- utils.encode_uri_components(parent)
- ), IPython._target);
- });
- this.element.find('#copy_notebook').click(function () {
- that.notebook.copy_notebook();
- return false;
- });
- this.element.find('#save_notebook_as').click(function() {
- that.notebook.save_notebook_as();
- return false;
- });
-
- this.element.find('#print_preview').click(function () {
- that._nbconvert('html', false);
- });
- this.element.find('#download_menu li').click(function (ev) {
- that._nbconvert(ev.target.parentElement.getAttribute('id').substring(9), true);
- });
- this.events.on('trust_changed.Notebook', function (event, trusted) {
- if (trusted) {
- that.element.find('#trust_notebook')
- .addClass("disabled").off('click')
- .find("a").text(i18n.msg._("Trusted Notebook"));
- } else {
- that.element.find('#trust_notebook')
- .removeClass("disabled").on('click', function () {
- that.notebook.trust_notebook();
- })
- .find("a").text(i18n.msg._("Trust Notebook"));
- }
- });
- // View
- this._add_celltoolbar_list();
- // Edit
- this.element.find('#edit_nb_metadata').click(function () {
- that.notebook.edit_metadata({
- notebook: that.notebook,
- keyboard_manager: that.notebook.keyboard_manager});
- });
- var id_actions_dict = {
- '#trust_notebook' : 'trust-notebook',
- '#rename_notebook' : 'rename-notebook',
- '#find_and_replace' : 'find-and-replace',
- '#save_checkpoint': 'save-notebook',
- '#shutdown_kernel': 'confirm-shutdown-kernel',
- '#restart_kernel': 'confirm-restart-kernel',
- '#restart_clear_output': 'confirm-restart-kernel-and-clear-output',
- '#restart_run_all': 'confirm-restart-kernel-and-run-all-cells',
- '#close_and_halt': 'close-and-halt',
- '#int_kernel': 'interrupt-kernel',
- '#cut_cell': 'cut-cell',
- '#copy_cell': 'copy-cell',
- '#paste_cell_above': 'paste-cell-above',
- '#paste_cell_below': 'paste-cell-below',
- '#paste_cell_replace': 'paste-cell-replace',
- '#delete_cell': 'delete-cell',
- '#undelete_cell': 'undo-cell-deletion',
- '#split_cell': 'split-cell-at-cursor',
- '#merge_cell_above': 'merge-cell-with-previous-cell',
- '#merge_cell_below': 'merge-cell-with-next-cell',
- '#move_cell_up': 'move-cell-up',
- '#move_cell_down': 'move-cell-down',
- '#toggle_header': 'toggle-header',
- '#toggle_toolbar': 'toggle-toolbar',
- '#toggle_line_numbers': 'toggle-all-line-numbers',
- '#insert_cell_above': 'insert-cell-above',
- '#insert_cell_below': 'insert-cell-below',
- '#run_cell': 'run-cell',
- '#run_cell_select_below': 'run-cell-and-select-next',
- '#run_cell_insert_below': 'run-cell-and-insert-below',
- '#run_all_cells': 'run-all-cells',
- '#run_all_cells_above': 'run-all-cells-above',
- '#run_all_cells_below': 'run-all-cells-below',
- '#to_code': 'change-cell-to-code',
- '#to_markdown': 'change-cell-to-markdown',
- '#to_raw': 'change-cell-to-raw',
- '#toggle_current_output': 'toggle-cell-output-collapsed',
- '#toggle_current_output_scroll': 'toggle-cell-output-scrolled',
- '#clear_current_output': 'clear-cell-output',
- '#toggle_all_output': 'toggle-all-cells-output-collapsed',
- '#toggle_all_output_scroll': 'toggle-all-cells-output-scrolled',
- '#clear_all_output': 'clear-all-cells-output',
- '#cut_cell_attachments': 'cut-cell-attachments',
- '#copy_cell_attachments': 'copy-cell-attachments',
- '#paste_cell_attachments': 'paste-cell-attachments',
- '#insert_image': 'insert-image',
- '#keyboard_shortcuts' : 'show-keyboard-shortcuts',
- '#edit_keyboard_shortcuts' : 'edit-command-mode-keyboard-shortcuts',
- };
- for(var idx in id_actions_dict){
- if (!id_actions_dict.hasOwnProperty(idx)){
- continue;
- }
- var id_act = 'jupyter-notebook:'+id_actions_dict[idx];
- if(!that.actions.exists(id_act)){
- console.warn('actions', id_act, 'does not exist, still binding it in case it will be defined later...');
- }
- // Immediately-Invoked Function Expression cause JS.
- (function(that, id_act, idx){
- var el = that.element.find(idx);
- el.click(function(event){
- that.actions.call(id_act, event);
- });
-
- var keybinding = that.keyboard_manager.command_shortcuts.get_action_shortcut(id_act) || that.keyboard_manager.edit_shortcuts.get_action_shortcut(id_act);
-
- if (keybinding) {
- var shortcut = quickhelp.humanize_sequence(keybinding);
- var link_element = el.children('a');
- var text = link_element.text();
- link_element.text('');
- link_element.addClass('menu-shortcut-container');
- link_element.append('<span class="action">' + text + '</span>');
- link_element.append('<span class="kb">' + shortcut + '</span>');
- }
- })(that, id_act, idx);
- }
-
- // Kernel
- this.element.find('#reconnect_kernel').click(function () {
- that.notebook.kernel.reconnect();
- });
- // Help
- if (this.tour) {
- this.element.find('#notebook_tour').click(function () {
- that.tour.start();
- });
- } else {
- this.element.find('#notebook_tour').addClass("disabled");
- }
-
- this.update_restore_checkpoint(null);
-
- this.events.on('checkpoints_listed.Notebook', function (event, data) {
- that.update_restore_checkpoint(that.notebook.checkpoints);
- });
-
- this.events.on('checkpoint_created.Notebook', function (event, data) {
- that.update_restore_checkpoint(that.notebook.checkpoints);
- });
-
- this.events.on('notebook_loaded.Notebook', function() {
- var langinfo = that.notebook.metadata.language_info || {};
- that.update_nbconvert_script(langinfo);
- });
-
- this.events.on('kernel_ready.Kernel', function(event, data) {
- var langinfo = data.kernel.info_reply.language_info || {};
- that.update_nbconvert_script(langinfo);
- that.add_kernel_help_links(data.kernel.info_reply.help_links || []);
- });
- };
-
- MenuBar.prototype._add_celltoolbar_list = function () {
- var that = this;
- var submenu = $("#menu-cell-toolbar-submenu");
-
- function preset_added(event, data) {
- var name = data.name;
- submenu.append(
- $("<li/>")
- .attr('data-name', encodeURIComponent(name))
- .append(
- $("<a/>")
- .attr('href', '#')
- .text(name)
- .click(function () {
- if (name ==='None') {
- celltoolbar.CellToolbar.global_hide();
- delete that.notebook.metadata.celltoolbar;
- } else {
- celltoolbar.CellToolbar.global_show();
- celltoolbar.CellToolbar.activate_preset(name, that.events);
- that.notebook.metadata.celltoolbar = name;
- }
- that.notebook.focus_cell();
- })
- )
- );
- }
-
- // Setup the existing presets
- var presets = celltoolbar.CellToolbar.list_presets();
- preset_added(null, {name: i18n.msg._("None")});
- presets.map(function (name) {
- preset_added(null, {name: name});
- });
- // Setup future preset registrations
- this.events.on('preset_added.CellToolbar', preset_added);
-
- // Handle unregistered presets
- this.events.on('unregistered_preset.CellToolbar', function (event, data) {
- submenu.find("li[data-name='" + encodeURIComponent(data.name) + "']").remove();
- });
- };
- MenuBar.prototype.update_restore_checkpoint = function(checkpoints) {
- var ul = this.element.find("#restore_checkpoint").find("ul");
- ul.empty();
- if (!checkpoints || checkpoints.length === 0) {
- ul.append(
- $("<li/>")
- .addClass("disabled")
- .append(
- $("<a/>")
- .text(i18n.msg._("No checkpoints"))
- )
- );
- return;
- }
-
- var that = this;
- checkpoints.map(function (checkpoint) {
- var d = new Date(checkpoint.last_modified);
- ul.append(
- $("<li/>").append(
- $("<a/>")
- .attr("href", "#")
- .text(moment(d).format("LLLL"))
- .click(function () {
- that.notebook.restore_checkpoint_dialog(checkpoint);
- })
- )
- );
- });
- };
-
- MenuBar.prototype.update_nbconvert_script = function(langinfo) {
- /**
- * Set the 'Download as foo' menu option for the relevant language.
- */
- var el = this.element.find('#download_script');
-
- // Set menu entry text to e.g. "Python (.py)"
- var langname = (langinfo.name || 'Script');
- langname = langname.charAt(0).toUpperCase()+langname.substr(1); // Capitalise
- el.find('a').text(langname + ' ('+(langinfo.file_extension || 'txt')+')');
- };
- MenuBar.prototype.add_kernel_help_links = function(help_links) {
- /** add links from kernel_info to the help menu */
- var divider = $("#kernel-help-links");
- if (divider.length === 0) {
- // insert kernel help section above about link
- var about = $("#notebook_about").parent();
- divider = $("<li>")
- .attr('id', "kernel-help-links")
- .addClass('divider');
- about.prev().before(divider);
- }
- // remove previous entries
- while (!divider.next().hasClass('divider')) {
- divider.next().remove();
- }
- if (help_links.length === 0) {
- // no help links, remove the divider
- divider.remove();
- return;
- }
- var cursor = divider;
- help_links.map(function (link) {
- cursor.after($("<li>")
- .append($("<a>")
- .attr('target', '_blank')
- .attr('title', i18n.msg._('Opens in a new window'))
- .attr('href', requirejs.toUrl(link.url))
- .append($("<i>")
- .addClass("fa fa-external-link menu-icon pull-right")
- )
- .append($("<span>")
- .text(link.text)
- )
- )
- );
- cursor = cursor.next();
- });
-
- };
- return {'MenuBar': MenuBar};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/notificationwidget',['jquery'], function($) {
- "use strict";
- /**
- * Construct a NotificationWidget object.
- *
- * @constructor
- * @param {string} selector - a jQuery selector string for the
- * notification widget element
- */
- var NotificationWidget = function (selector) {
- this.selector = selector;
- this.timeout = null;
- this.busy = false;
- if (this.selector !== undefined) {
- this.element = $(selector);
- this.style();
- }
- this.element.hide();
- this.inner = $('<span/>');
- this.element.append(this.inner);
- };
- /**
- * Add the 'notification_widget' CSS class to the widget element.
- *
- * @method style
- */
- NotificationWidget.prototype.style = function () {
- // use explicit bootstrap classes here,
- // because multiple inheritance in LESS doesn't work
- // for this particular combination
- this.element.addClass('notification_widget btn btn-xs navbar-btn');
- };
-
- /**
- * hide the widget and empty the text
- **/
- NotificationWidget.prototype.hide = function () {
- var that = this;
- this.element.fadeOut(100, function(){that.inner.text('');});
- };
- /**
- * Set the notification widget message to display for a certain
- * amount of time (timeout). The widget will be shown forever if
- * timeout is <= 0 or undefined. If the widget is clicked while it
- * is still displayed, execute an optional callback
- * (click_callback). If the callback returns false, it will
- * prevent the notification from being dismissed.
- *
- * Options:
- * class - CSS class name for styling
- * icon - CSS class name for the widget icon
- * title - HTML title attribute for the widget
- *
- * @method set_message
- * @param {string} msg - The notification to display
- * @param {integer} [timeout] - The amount of time in milliseconds to display the widget
- * @param {function} [click_callback] - The function to run when the widget is clicked
- * @param {Object} [options] - Additional options
- */
- NotificationWidget.prototype.set_message = function (msg, timeout, click_callback, options) {
- options = options || {};
- // unbind potential previous callback
- this.element.unbind('click');
- this.inner.attr('class', options.icon);
- this.inner.attr('title', options.title);
- this.inner.text(msg);
- this.element.fadeIn(100);
- // reset previous set style
- this.element.removeClass();
- this.style();
- if (options.class) {
- this.element.addClass(options.class);
- }
- // clear previous timer
- if (this.timeout !== null) {
- clearTimeout(this.timeout);
- this.timeout = null;
- }
- // set the timer if a timeout is given
- var that = this;
- if (timeout !== undefined && timeout >= 0) {
- this.timeout = setTimeout(function () {
- that.element.fadeOut(100, function () {that.inner.text('');});
- that.element.unbind('click');
- that.timeout = null;
- }, timeout);
- }
- // if no click callback assume we will just dismiss the notification
- if (click_callback === undefined) {
- click_callback = function(){return true};
- }
- // on click, remove widget if click callback say so
- // and unbind click event.
- this.element.click(function () {
- if (click_callback() !== false) {
- that.element.fadeOut(100, function () {that.inner.text('');});
- that.element.unbind('click');
- }
- if (that.timeout !== null) {
- clearTimeout(that.timeout);
- that.timeout = null;
- }
- });
- };
- /**
- * Display an information message (styled with the 'info'
- * class). Arguments are the same as in set_message. Default
- * timeout is 3500 milliseconds.
- *
- * @method info
- */
- NotificationWidget.prototype.info = function (msg, timeout, click_callback, options) {
- options = options || {};
- options.class = options.class + ' info';
- timeout = timeout || 3500;
- this.set_message(msg, timeout, click_callback, options);
- };
- /**
- * Display a warning message (styled with the 'warning'
- * class). Arguments are the same as in set_message. Messages are
- * sticky by default.
- *
- * @method warning
- */
- NotificationWidget.prototype.warning = function (msg, timeout, click_callback, options) {
- options = options || {};
- options.class = options.class + ' warning';
- this.set_message(msg, timeout, click_callback, options);
- };
- /**
- * Display a danger message (styled with the 'danger'
- * class). Arguments are the same as in set_message. Messages are
- * sticky by default.
- *
- * @method danger
- */
- NotificationWidget.prototype.danger = function (msg, timeout, click_callback, options) {
- options = options || {};
- options.class = options.class + ' danger';
- this.set_message(msg, timeout, click_callback, options);
- };
- /**
- * Get the text of the widget message.
- *
- * @method get_message
- * @return {string} - the message text
- */
- NotificationWidget.prototype.get_message = function () {
- return this.inner.html();
- };
- return {'NotificationWidget': NotificationWidget};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('base/js/notificationarea',[
- 'jquery',
- 'base/js/notificationwidget',
- ], function($, notificationwidget) {
- "use strict";
- // store reference to the NotificationWidget class
- var NotificationWidget = notificationwidget.NotificationWidget;
- /**
- * Construct the NotificationArea object. Options are:
- * events: $(Events) instance
- * save_widget: SaveWidget instance
- * notebook: Notebook instance
- * keyboard_manager: KeyboardManager instance
- *
- * @constructor
- * @param {string} selector - a jQuery selector string for the
- * notification area element
- * @param {Object} [options] - a dictionary of keyword arguments.
- */
- var NotificationArea = function (selector, options) {
- this.selector = selector;
- this.events = options.events;
- if (this.selector !== undefined) {
- this.element = $(selector);
- }
- this.widget_dict = {};
- };
- /**
- * Get a widget by name, creating it if it doesn't exist.
- *
- * @method widget
- * @param {string} name - the widget name
- */
- NotificationArea.prototype.widget = function (name) {
- if (this.widget_dict[name] === undefined) {
- return this.new_notification_widget(name);
- }
- return this.get_widget(name);
- };
- /**
- * Get a widget by name, throwing an error if it doesn't exist.
- *
- * @method get_widget
- * @param {string} name - the widget name
- */
- NotificationArea.prototype.get_widget = function (name) {
- if(this.widget_dict[name] === undefined) {
- throw new Error('no widgets with this name');
- }
- return this.widget_dict[name];
- };
- /**
- * Create a new notification widget with the given name. The
- * widget must not already exist.
- *
- * @method new_notification_widget
- * @param {string} name - the widget name
- */
- NotificationArea.prototype.new_notification_widget = function (name) {
- if (this.widget_dict[name] !== undefined) {
- throw new Error('widget with that name already exists!');
- }
- // create the element for the notification widget and add it
- // to the notification aread element
- var div = $('<div/>').attr('id', 'notification_' + name);
- $(this.selector).append(div);
- // create the widget object and return it
- this.widget_dict[name] = new NotificationWidget('#notification_' + name);
- return this.widget_dict[name];
- };
- return {'NotificationArea': NotificationArea};
- });
- define('notebook/js/notificationarea',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/dialog',
- 'base/js/notificationarea',
- 'moment'
- ], function($, utils, i18n, dialog, notificationarea, moment) {
- "use strict";
- var NotificationArea = notificationarea.NotificationArea;
-
- var NotebookNotificationArea = function(selector, options) {
- NotificationArea.apply(this, [selector, options]);
- this.save_widget = options.save_widget;
- this.notebook = options.notebook;
- this.keyboard_manager = options.keyboard_manager;
- };
-
- NotebookNotificationArea.prototype = Object.create(NotificationArea.prototype);
-
- /**
- * Initialize the default set of notification widgets.
- *
- * @method init_notification_widgets
- */
- NotebookNotificationArea.prototype.init_notification_widgets = function () {
- this.init_kernel_notification_widget();
- this.init_notebook_notification_widget();
- this.init_trusted_notebook_notification_widget();
- };
- /**
- * Initialize the notification widget for kernel status messages.
- *
- * @method init_kernel_notification_widget
- */
- NotebookNotificationArea.prototype.init_kernel_notification_widget = function () {
- var that = this;
- var knw = this.widget('kernel');
- var $kernel_ind_icon = $("#kernel_indicator_icon");
- var $modal_ind_icon = $("#modal_indicator");
- var $readonly_ind_icon = $('#readonly-indicator');
- var $body = $('body');
- var busy_favicon_timer = -1;
-
- var set_busy_favicon = function(on) {
- if (on) {
- // Only show the busy icon if execution lasts > 1s
- // This is to avoid rapidly switching icons and making lots of
- // HTTP requests.
- clearTimeout(busy_favicon_timer);
- busy_favicon_timer = setTimeout(function() {
- utils.change_favicon('/static/base/images/favicon-busy-1.ico');
- }, 1000);
- } else {
- clearTimeout(busy_favicon_timer);
- utils.change_favicon('/static/base/images/favicon-notebook.ico');
- }
- };
- // Listen for the notebook loaded event. Set readonly indicator.
- this.events.on('notebook_loaded.Notebook', function() {
- if (that.notebook.writable) {
- $readonly_ind_icon.hide();
- } else {
- $readonly_ind_icon.show();
- }
- });
- // Command/Edit mode
- this.events.on('edit_mode.Notebook', function () {
- that.save_widget.update_document_title();
- $body.addClass('edit_mode');
- $body.removeClass('command_mode');
- $modal_ind_icon.attr('title',i18n.msg._('Edit Mode'));
- });
- this.events.on('command_mode.Notebook', function () {
- that.save_widget.update_document_title();
- $body.removeClass('edit_mode');
- $body.addClass('command_mode');
- $modal_ind_icon.attr('title',i18n.msg._('Command Mode'));
- });
- // Implicitly start off in Command mode, switching to Edit mode will trigger event
- $modal_ind_icon.addClass('modal_indicator').attr('title',i18n.msg._('Command Mode'));
- $body.addClass('command_mode');
- // Kernel events
- // this can be either kernel_created.Kernel or kernel_created.Session
- this.events.on('kernel_created.Kernel kernel_created.Session', function () {
- knw.info(i18n.msg._("Kernel Created"), 500);
- });
- this.events.on('kernel_reconnecting.Kernel', function () {
- knw.warning(i18n.msg._("Connecting to kernel"));
- });
- this.events.on('kernel_connection_dead.Kernel', function (evt, info) {
- knw.danger(i18n.msg._("Not Connected"), undefined, function () {
- // schedule reconnect a short time in the future, don't reconnect immediately
- setTimeout($.proxy(info.kernel.reconnect, info.kernel), 500);
- }, {title: i18n.msg._('click to reconnect')});
- });
- this.events.on('kernel_connected.Kernel', function () {
- knw.info("Connected", 500);
- // trigger busy in the status to clear broken-link state immediately
- // a kernel_ready event will come when the kernel becomes responsive.
- $kernel_ind_icon
- .attr('class', 'kernel_busy_icon')
- .attr('title', i18n.msg._('Kernel Connected'));
- });
- this.events.on('kernel_restarting.Kernel', function () {
- that.save_widget.update_document_title();
- knw.set_message(i18n.msg._("Restarting kernel"), 2000);
- });
- this.events.on('kernel_autorestarting.Kernel', function (evt, info) {
- // Only show the dialog on the first restart attempt. This
- // number gets tracked by the `Kernel` object and passed
- // along here, because we don't want to show the user 5
- // dialogs saying the same thing (which is the number of
- // times it tries restarting).
- if (info.attempt === 1) {
- dialog.kernel_modal({
- notebook: that.notebook,
- keyboard_manager: that.keyboard_manager,
- title: i18n.msg._("Kernel Restarting"),
- body: i18n.msg._("The kernel appears to have died. It will restart automatically."),
- buttons: {
- OK : {
- class : "btn-primary"
- }
- }
- });
- }
- that.save_widget.update_document_title();
- knw.danger(i18n.msg._("Dead kernel"));
- $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
- });
- this.events.on('kernel_interrupting.Kernel', function () {
- knw.set_message(i18n.msg._("Interrupting kernel"), 2000);
- });
- this.events.on('kernel_disconnected.Kernel', function () {
- $kernel_ind_icon
- .attr('class', 'kernel_disconnected_icon')
- .attr('title', i18n.msg._('No Connection to Kernel'));
- });
- this.events.on('kernel_connection_failed.Kernel', function (evt, info) {
- // only show the dialog if this is the first failed
- // connect attempt, because the kernel will continue
- // trying to reconnect and we don't want to spam the user
- // with messages
- if (info.attempt === 1) {
- var msg = i18n.msg._("A connection to the notebook server could not be established." +
- " The notebook will continue trying to reconnect. Check your" +
- " network connection or notebook server configuration.");
- var the_dialog = dialog.kernel_modal({
- title: i18n.msg._("Connection failed"),
- body: msg,
- keyboard_manager: that.keyboard_manager,
- notebook: that.notebook,
- buttons : {
- "OK": {}
- }
- });
- // hide the dialog on reconnect if it's still visible
- var dismiss = function () {
- the_dialog.modal('hide');
- }
- that.events.on("kernel_connected.Kernel", dismiss);
- the_dialog.on("hidden.bs.modal", function () {
- // clear handler on dismiss
- that.events.off("kernel_connected.Kernel", dismiss);
- });
- }
- });
- this.events.on('kernel_killed.Kernel kernel_killed.Session', function () {
- that.save_widget.update_document_title();
- knw.warning(i18n.msg._("No kernel"));
- $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel is not running'));
- });
- this.events.on('kernel_dead.Kernel', function () {
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [ i18n.msg._("Don't Restart"), i18n.msg._("Try Restarting Now"), i18n.msg._("OK")];
- var showMsg = function () {
- var msg = i18n.msg._('The kernel has died, and the automatic restart has failed.' +
- ' It is possible the kernel cannot be restarted. ' +
- 'If you are not able to restart the kernel, you will still be able to save' +
- ' the notebook, but running code will no longer work until the notebook' +
- ' is reopened.');
- dialog.kernel_modal({
- title: i18n.msg._("Dead kernel"),
- body : msg,
- keyboard_manager: that.keyboard_manager,
- notebook: that.notebook,
- default_button: "Don't Restart",
- buttons : {
- "Don't Restart": {},
- "Try Restarting Now": {
- class: "btn-danger",
- click: function () {
- that.notebook.start_session();
- }
- }
- }
- });
- return false;
- };
- that.save_widget.update_document_title();
- knw.danger(i18n.msg._("Dead kernel"), undefined, showMsg);
- $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
- showMsg();
- });
-
- this.events.on("no_kernel.Kernel", function (evt, data) {
- $("#kernel_indicator").find('.kernel_indicator_name').text(i18n.msg._("No Kernel"));
- });
- this.events.on('kernel_dead.Session', function (evt, info) {
- var full = info.xhr.responseJSON.message;
- var short = info.xhr.responseJSON.short_message || 'Kernel error';
- var traceback = info.xhr.responseJSON.traceback;
- var showMsg = function () {
- var msg = $('<div/>').append($('<p/>').text(full));
- var cm, cm_elem, cm_open;
- if (traceback) {
- cm_elem = $('<div/>')
- .css('margin-top', '1em')
- .css('padding', '1em')
- .addClass('output_scroll');
- msg.append(cm_elem);
- cm = new CodeMirror(cm_elem.get(0), {
- mode: "python",
- readOnly : true
- });
- cm.setValue(traceback);
- cm_open = $.proxy(cm.refresh, cm);
- }
- dialog.kernel_modal({
- title: i18n.msg._("Failed to start the kernel"),
- body : msg,
- keyboard_manager: that.keyboard_manager,
- notebook: that.notebook,
- open: cm_open,
- buttons : {
- "OK": { class: 'btn-primary' }
- }
- });
- return false;
- };
- that.save_widget.update_document_title();
- $kernel_ind_icon.attr('class','kernel_dead_icon').attr('title',i18n.msg._('Kernel Dead'));
- knw.danger(short, undefined, showMsg);
- });
-
- this.events.on('kernel_starting.Kernel kernel_created.Session', function () {
- // window.document.title='(Starting) '+window.document.title;
- $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
- knw.set_message(i18n.msg._("Kernel starting, please wait..."));
- set_busy_favicon(true);
- });
- this.events.on('kernel_ready.Kernel', function () {
- // that.save_widget.update_document_title();
- $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title',i18n.msg._('Kernel Idle'));
- knw.info(i18n.msg._("Kernel ready"), 500);
- set_busy_favicon(false);
- });
- this.events.on('kernel_idle.Kernel', function () {
- // that.save_widget.update_document_title();
- $kernel_ind_icon.attr('class','kernel_idle_icon').attr('title',i18n.msg._('Kernel Idle'));
- set_busy_favicon(false);
- });
- this.events.on('kernel_busy.Kernel', function () {
- // window.document.title='(Busy) '+window.document.title;
- $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
- set_busy_favicon(true);
- });
- this.events.on('spec_match_found.Kernel', function (evt, data) {
- that.widget('kernelspec').info(i18n.msg._("Using kernel: ") + data.found.spec.display_name, 3000, undefined, {
- title: i18n.msg.sprintf(i18n.msg._("Only candidate for language: %1$s was %2$s."),
- data.selected.language, data.found.spec.display_name)
- });
- });
-
- // Start the kernel indicator in the busy state, and send a kernel_info request.
- // When the kernel_info reply arrives, the kernel is idle.
- $kernel_ind_icon.attr('class','kernel_busy_icon').attr('title',i18n.msg._('Kernel Busy'));
- };
- /**
- * Initialize the notification widget for notebook status messages.
- *
- * @method init_notebook_notification_widget
- */
- NotebookNotificationArea.prototype.init_notebook_notification_widget = function () {
- var nnw = this.widget('notebook');
- // Notebook events
- this.events.on('notebook_loading.Notebook', function () {
- nnw.set_message(i18n.msg._("Loading notebook"),500);
- });
- this.events.on('notebook_loaded.Notebook', function () {
- nnw.set_message(i18n.msg._("Notebook loaded"),500);
- });
- this.events.on('notebook_saving.Notebook', function () {
- nnw.set_message(i18n.msg._("Saving notebook"),500);
- });
- this.events.on('notebook_saved.Notebook', function () {
- nnw.set_message(i18n.msg._("Notebook saved"),2000);
- });
- this.events.on('notebook_save_failed.Notebook', function (evt, error) {
- nnw.warning(error.message || i18n.msg._("Notebook save failed"));
- });
- this.events.on('notebook_copy_failed.Notebook', function (evt, error) {
- nnw.warning(error.message || i18n.msg._("Notebook copy failed"));
- });
-
- // Checkpoint events
- this.events.on('checkpoint_created.Notebook', function (evt, data) {
- var msg = i18n.msg._("Checkpoint created");
- if (data.last_modified) {
- var d = new Date(data.last_modified);
- msg = msg + ": " + moment(d).format("HH:mm:ss");
- }
- nnw.set_message(msg, 2000);
- });
- this.events.on('checkpoint_failed.Notebook', function () {
- nnw.warning(i18n.msg._("Checkpoint failed"));
- });
- this.events.on('checkpoint_deleted.Notebook', function () {
- nnw.set_message(i18n.msg._("Checkpoint deleted"), 500);
- });
- this.events.on('checkpoint_delete_failed.Notebook', function () {
- nnw.warning(i18n.msg._("Checkpoint delete failed"));
- });
- this.events.on('checkpoint_restoring.Notebook', function () {
- nnw.set_message(i18n.msg._("Restoring to checkpoint..."), 500);
- });
- this.events.on('checkpoint_restore_failed.Notebook', function () {
- nnw.warning(i18n.msg._("Checkpoint restore failed"));
- });
- // Autosave events
- this.events.on('autosave_disabled.Notebook', function () {
- nnw.set_message(i18n.msg._("Autosave disabled"), 2000);
- });
- this.events.on('autosave_enabled.Notebook', function (evt, interval) {
- nnw.set_message(i18n.msg.sprintf(i18n.msg._("Saving every %d sec."), interval / 1000) , 1000);
- });
- };
- /**
- * Initialize the notification widget for trusted notebook messages.
- *
- * @method init_trusted_notebook_notification_widget
- */
- NotebookNotificationArea.prototype.init_trusted_notebook_notification_widget = function () {
- var that = this;
- var tnw = this.widget('trusted');
- // Notebook trust events
- this.events.on('trust_changed.Notebook', function (event, trusted) {
- if (trusted) {
- tnw.set_message(i18n.msg._("Trusted"), undefined, function() {
- return false;
- }, {'title':'Javascript enabled for notebook display'});
- // don't allow 'Trusted' button to be clicked
- $(tnw.selector).attr('disabled', true);
- $(tnw.selector).css('cursor', 'help');
- } else {
- tnw.set_message(i18n.msg._("Not Trusted"), undefined, function() {
- that.notebook.trust_notebook("#notification_trusted");
- return false;
- }, {'title':'Javascript disabled for notebook display'});
- $(tnw.selector).attr('role', 'button');
- }
- });
- };
- return {'NotebookNotificationArea': NotebookNotificationArea};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/savewidget',[
- 'jquery',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/dialog',
- 'base/js/keyboard',
- 'moment',
- 'bidi/bidi',
- ], function($, utils, i18n, dialog, keyboard, moment, bidi) {
- "use strict";
- var SaveWidget = function (selector, options) {
- /**
- * TODO: Remove circular ref.
- */
- this.notebook = undefined;
- this.selector = selector;
- this.events = options.events;
- this._checkpoint_date = undefined;
- this.keyboard_manager = options.keyboard_manager;
- if (this.selector !== undefined) {
- this.element = $(selector);
- this.bind_events();
- }
- };
- SaveWidget.prototype.bind_events = function () {
- var that = this;
- this.element.find('span.filename').click(function () {
- that.rename_notebook({notebook: that.notebook});
- });
- this.events.on('notebook_loaded.Notebook', function () {
- that.update_notebook_name();
- that.update_document_title();
- });
- this.events.on('notebook_saved.Notebook', function () {
- that.update_notebook_name();
- that.update_document_title();
- });
- this.events.on('notebook_renamed.Notebook', function () {
- that.update_notebook_name();
- that.update_document_title();
- that.update_address_bar();
- });
- this.events.on('notebook_save_failed.Notebook', function () {
- that.set_save_status(i18n.msg._('Autosave Failed!'));
- });
- this.events.on('notebook_read_only.Notebook', function () {
- that.set_save_status('(read only)');
- // disable future set_save_status
- that.set_save_status = function () {};
- });
- this.events.on('checkpoints_listed.Notebook', function (event, data) {
- that._set_last_checkpoint(data[0]);
- });
- this.events.on('checkpoint_created.Notebook', function (event, data) {
- that._set_last_checkpoint(data);
- });
- this.events.on('set_dirty.Notebook', function (event, data) {
- that.set_autosaved(data.value);
- });
- };
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [ i18n.msg._("Cancel"), i18n.msg._("Rename"), i18n.msg._("OK")];
- SaveWidget.prototype.rename_notebook = function (options) {
- options = options || {};
- var that = this;
- var dialog_body = $('<div/>').append(
- $("<p/>").addClass("rename-message")
- .text(i18n.msg._('Enter a new notebook name:'))
- ).append(
- $("<br/>")
- ).append(
- $('<input/>').attr('type','text').attr('size','25').addClass('form-control')
- .val(options.notebook.get_notebook_name())
- );
- var d = dialog.modal({
- title: i18n.msg._("Rename Notebook"),
- body: dialog_body,
- notebook: options.notebook,
- keyboard_manager: this.keyboard_manager,
- default_button: "Cancel",
- buttons : {
- "Cancel": {},
- "Rename": {
- class: "btn-primary",
- click: function () {
- var new_name = d.find('input').val();
- if (!options.notebook.test_notebook_name(new_name)) {
- d.find('.rename-message').text(i18n.msg._(
- "Invalid notebook name. Notebook names must have 1 or more characters and can contain any characters except :/\\. Please enter a new notebook name:")
- );
- return false;
- } else {
- d.find('.rename-message').text(i18n.msg._("Renaming..."));
- d.find('input[type="text"]').prop('disabled', true);
- that.notebook.rename(new_name).then(
- function () {
- d.modal('hide');
- }, function (error) {
- d.find('.rename-message').text(error.message || i18n.msg._('Unknown error'));
- d.find('input[type="text"]').prop('disabled', false).focus().select();
- }
- );
- return false;
- }
- }
- }
- },
- open : function () {
- /**
- * Upon ENTER, click the OK button.
- */
- d.find('input[type="text"]').keydown(function (event) {
- if (event.which === keyboard.keycodes.enter) {
- d.find('.btn-primary').first().click();
- return false;
- }
- });
- d.find('input[type="text"]').focus().select();
- }
- });
- };
- SaveWidget.prototype.update_notebook_name = function () {
- var nbname = this.notebook.get_notebook_name();
- nbname = bidi.applyBidi(nbname);
- this.element.find('span.filename').text(nbname);
- };
- SaveWidget.prototype.update_document_title = function () {
- var nbname = this.notebook.get_notebook_name();
- document.title = nbname + ' - Jupyter Notebook';
- };
- SaveWidget.prototype.update_address_bar = function(){
- var base_url = this.notebook.base_url;
- var path = this.notebook.notebook_path;
- var state = {path : path};
- window.history.replaceState(state, "", utils.url_path_join(
- base_url,
- "notebooks",
- utils.encode_uri_components(path))
- );
- };
- SaveWidget.prototype.set_save_status = function (msg) {
- this.element.find('span.autosave_status').text(msg);
- };
- SaveWidget.prototype._set_last_checkpoint = function (checkpoint) {
- if (checkpoint) {
- this._checkpoint_date = new Date(checkpoint.last_modified);
- } else {
- this._checkpoint_date = null;
- }
- this._render_checkpoint();
- };
-
- SaveWidget.prototype._render_checkpoint = function () {
- /** actually set the text in the element, from our _checkpoint value
-
- called directly, and periodically in timeouts.
- */
- this._schedule_render_checkpoint();
- var el = this.element.find('span.checkpoint_status');
- if (!this._checkpoint_date) {
- el.text('').attr('title', i18n.msg._('no checkpoint'));
- return;
- }
- var chkd = moment(this._checkpoint_date);
- var long_date = chkd.format('llll');
- var human_date;
- var tdelta = Math.ceil(new Date() - this._checkpoint_date);
- if (tdelta < utils.time.milliseconds.d){
- // less than 24 hours old, use relative date
- human_date = chkd.fromNow();
- } else {
- // otherwise show calendar
- // <Today | yesterday|...> at hh,mm,ss
- human_date = chkd.calendar();
- }
-
- el.text(i18n.msg.sprintf(i18n.msg._('Last Checkpoint: %s'),human_date)).attr('title', long_date);
- };
-
- SaveWidget.prototype._schedule_render_checkpoint = function () {
- /** schedule the next update to relative date
-
- periodically updated, so short values like 'a few seconds ago' don't get stale.
- */
- if (!this._checkpoint_date) {
- return;
- }
- if ((this._checkpoint_timeout)) {
- clearTimeout(this._checkpoint_timeout);
- }
- var dt = Math.ceil(new Date() - this._checkpoint_date);
- this._checkpoint_timeout = setTimeout(
- $.proxy(this._render_checkpoint, this),
- utils.time.timeout_from_dt(dt)
- );
- };
- SaveWidget.prototype.set_autosaved = function (dirty) {
- if (dirty) {
- this.set_save_status(i18n.msg._("(unsaved changes)"));
- } else {
- this.set_save_status(i18n.msg._("(autosaved)"));
- }
- };
- return {'SaveWidget': SaveWidget};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // How to pick action names:
- //
- // * First pick a noun and a verb for the action. For example, if the action is "restart kernel," the verb is
- // "restart" and the noun is "kernel".
- // * Omit terms like "selected" and "active" by default, so "delete-cell", rather than "delete-selected-cell".
- // Only provide a scope like "-all-" if it is other than the default "selected" or "active" scope.
- // * If an action has a secondary action, separate the secondary action with "-and-", so
- // "restart-kernel-and-clear-output".
- // * Don't ever use before/after as they have a temporal connotation that is confusing when used in a spatial
- // context.
- // * Use above/below or previous/next to indicate spacial and sequential relationships.
- // * For dialogs, use a verb that indicates what the dialog will accomplish, such as "confirm-restart-kernel".
- define('notebook/js/actions',[
- 'base/js/i18n',
- ], function(i18n){
- "use strict";
- var warn_bad_name = function(name){
- if(name !== "" && !name.match(/:/)){
- console.warn('You are trying to use an action/command name, where the separator between prefix and name is not `:`\n'+
- '"'+name+'"\n'+
- 'You are likely to not use the API in a correct way. Typically use the following:\n'+
- '`var key = actions.register(<object>, "<name>", "<prefix>");` and reuse the `key` variable'+
- 'instead of re-generating the key yourself.'
- );
- }
- };
- var ActionHandler = function (env) {
- this.env = env || {};
- Object.seal(this);
- };
- var $ = requirejs('jquery');
- var events = requirejs('base/js/events');
- /**
- * A bunch of predefined `Simple Actions` used by Jupyter.
- * `Simple Actions` have the following keys:
- * help (optional): a short string the describe the action.
- * will be used in various context, like as menu name, tool tips on buttons,
- * and short description in help menu.
- * help_index (optional): a string used to sort action in help menu.
- * icon (optional): a short string that represent the icon that have to be used with this
- * action. this should mainly correspond to a Font_awesome class.
- * handler : a function which is called when the action is activated. It will receive at first parameter
- * a dictionary containing various handle to element of the notebook.
- *
- * action need to be registered with a **name** that can be use to refer to this action.
- *
- * if `help` is not provided it will be derived by replacing any dash by space
- * in the **name** of the action. It is advised to provide a prefix to action name to
- * avoid conflict the prefix should be all lowercase and end with a dot `.`
- * in the absence of a prefix the behavior of the action is undefined.
- *
- * All action provided by the Jupyter notebook are prefixed with `jupyter-notebook:`.
- *
- * One can register extra actions or replace an existing action with another one is possible
- * but is considered undefined behavior.
- *
- **/
- var _actions = {
- 'toggle-cell-rtl-layout': {
- cmd: i18n.msg._('toggle current cell ltr/rtl direction'),
- help: i18n.msg._('Toggle current cell directionality between left-to-right and right-to-left'),
- handler: function (env) {
- var notebook_direction = document.body.getAttribute('dir') == 'rtl' ? 'rtl' : 'ltr';
- var current_cell_default_direction = env.notebook.get_selected_cell().cell_type == 'code' ? 'ltr' : notebook_direction;
- var current_cell_direction = env.notebook.get_selected_cell().metadata.direction || current_cell_default_direction;
- var new_direction = current_cell_direction == 'rtl' ? 'ltr' : 'rtl';
- env.notebook.get_selected_cells().forEach(
- function(cell) { cell.metadata.direction = new_direction; }
- );
- env.notebook.set_dirty(true);
- env.notebook.apply_directionality();
- }
- },
- 'toggle-rtl-layout': {
- cmd: i18n.msg._('toggle notebook ltr/rtl direction'),
- help: i18n.msg._('Toggle notebook directionality between left-to-right and right-to-left'),
- handler: function (env) {
- var new_direction = document.body.getAttribute('dir') == 'rtl' ? 'ltr' : 'rtl';
- env.notebook.metadata.direction = new_direction;
- env.notebook.set_dirty(true);
- env.notebook.apply_directionality();
- }
- },
- 'edit-command-mode-keyboard-shortcuts': {
- cmd: i18n.msg._('edit command mode keyboard shortcuts'),
- help: i18n.msg._('Open a dialog to edit the command mode keyboard shortcuts'),
- handler: function (env) {
- env.notebook.show_shortcuts_editor();
- }
- },
- 'shutdown-kernel': {
- help: 'Shutdown the kernel (no confirmation dialog)',
- handler: function (env) {
- env.notebook.shutdown_kernel({confirm: false});
- }
- },
- 'confirm-shutdown-kernel':{
- icon: 'fa-repeat',
- help_index : 'hb',
- help: 'Shutdown the kernel (with confirmation dialog)',
- handler : function (env) {
- env.notebook.shutdown_kernel();
- }
- },
- 'restart-kernel': {
- cmd: i18n.msg._('restart kernel'),
- help: i18n.msg._('restart the kernel (no confirmation dialog)'),
- handler: function (env) {
- env.notebook.restart_kernel({confirm: false});
- },
- },
- 'confirm-restart-kernel':{
- icon: 'fa-repeat',
- help_index : 'hb',
- cmd: i18n.msg._('confirm restart kernel'),
- help: i18n.msg._('restart the kernel (with dialog)'),
- handler : function (env) {
- env.notebook.restart_kernel();
- }
- },
- 'restart-kernel-and-run-all-cells': {
- cmd: i18n.msg._('restart kernel and run all cells'),
- help: i18n.msg._('restart the kernel, then re-run the whole notebook (no confirmation dialog)'),
- handler: function (env) {
- env.notebook.restart_run_all({confirm: false});
- }
- },
- 'confirm-restart-kernel-and-run-all-cells': {
- icon: 'fa-forward',
- cmd: i18n.msg._('confirm restart kernel and run all cells'),
- help: i18n.msg._('restart the kernel, then re-run the whole notebook (with dialog)'),
- handler: function (env) {
- env.notebook.restart_run_all();
- }
- },
- 'restart-kernel-and-clear-output': {
- cmd: i18n.msg._('restart kernel and clear output'),
- help: i18n.msg._('restart the kernel and clear all output (no confirmation dialog)'),
- handler: function (env) {
- env.notebook.restart_clear_output({confirm: false});
- }
- },
- 'confirm-restart-kernel-and-clear-output': {
- cmd: i18n.msg._('confirm restart kernel and clear output'),
- help: i18n.msg._('restart the kernel and clear all output (with dialog)'),
- handler: function (env) {
- env.notebook.restart_clear_output();
- }
- },
- 'interrupt-kernel':{
- icon: 'fa-stop',
- cmd: i18n.msg._('interrupt the kernel'),
- help: i18n.msg._('interrupt the kernel'),
- help_index : 'ha',
- handler : function (env) {
- env.notebook.kernel.interrupt();
- }
- },
- 'run-cell-and-select-next': {
- cmd: i18n.msg._('run cell and select next'),
- icon: 'fa-play',
- help: i18n.msg._('run cell, select below'),
- help_index : 'ba',
- handler : function (env) {
- env.notebook.execute_cell_and_select_below();
- }
- },
- 'run-cell':{
- cmd: i18n.msg._('run selected cells'),
- help : i18n.msg._('run selected cells'),
- help_index : 'bb',
- handler : function (env) {
- env.notebook.execute_selected_cells();
- }
- },
- 'run-cell-and-insert-below':{
- cmd: i18n.msg._('run cell and insert below'),
- help : i18n.msg._('run cell and insert below'),
- help_index : 'bc',
- handler : function (env) {
- env.notebook.execute_cell_and_insert_below();
- }
- },
- 'run-all-cells': {
- cmd: i18n.msg._('run all cells'),
- help: i18n.msg._('run all cells'),
- help_index: 'bd',
- handler: function (env) {
- env.notebook.execute_all_cells();
- }
- },
- 'run-all-cells-above':{
- cmd: i18n.msg._('run all cells above'),
- help: i18n.msg._('run all cells above'),
- handler : function (env) {
- env.notebook.execute_cells_above();
- }
- },
- 'run-all-cells-below':{
- cmd: i18n.msg._('run all cells below'),
- help: i18n.msg._('run all cells below'),
- handler : function (env) {
- env.notebook.execute_cells_below();
- }
- },
- 'enter-command-mode': {
- cmd: i18n.msg._('enter command mode'),
- help : i18n.msg._('enter command mode'),
- help_index : 'aa',
- handler : function (env) {
- env.notebook.command_mode();
- }
- },
- 'insert-image': {
- cmd: i18n.msg._('insert image'),
- help : i18n.msg._('insert image'),
- help_index : 'dz',
- handler : function (env) {
- env.notebook.insert_image();
- }
- },
- 'cut-cell-attachments': {
- cmd: i18n.msg._('cut cell attachments'),
- help : i18n.msg._('cut cell attachments'),
- help_index : 'dza',
- handler: function (env) {
- env.notebook.cut_cell_attachments();
- }
- },
- 'copy-cell-attachments': {
- cmd: i18n.msg._('copy cell attachments'),
- help : i18n.msg._('copy cell attachments'),
- help_index: 'dzb',
- handler: function (env) {
- env.notebook.copy_cell_attachments();
- }
- },
- 'paste-cell-attachments': {
- cmd: i18n.msg._('paste cell attachments'),
- help : i18n.msg._('paste cell attachments'),
- help_index: 'dzc',
- handler: function (env) {
- env.notebook.paste_cell_attachments();
- }
- },
- 'split-cell-at-cursor': {
- cmd: i18n.msg._('split cell at cursor(s)'),
- help : i18n.msg._('split cell at cursor(s)'),
- help_index : 'ea',
- handler : function (env) {
- env.notebook.split_cell();
- }
- },
- 'enter-edit-mode' : {
- cmd: i18n.msg._('enter edit mode'),
- help : i18n.msg._('enter edit mode'),
- help_index : 'aa',
- handler : function (env) {
- env.notebook.edit_mode();
- }
- },
- 'select-previous-cell' : {
- cmd: i18n.msg._('select previous cell'),
- help: i18n.msg._('select cell above'),
- help_index : 'da',
- handler : function (env) {
- var index = env.notebook.get_selected_index();
- if (index !== 0 && index !== null) {
- env.notebook.select_prev(true);
- env.notebook.focus_cell();
- }
- }
- },
- 'select-next-cell' : {
- cmd: i18n.msg._('select next cell'),
- help: i18n.msg._('select cell below'),
- help_index : 'db',
- handler : function (env) {
- var index = env.notebook.get_selected_index();
- if (index !== (env.notebook.ncells()-1) && index !== null) {
- env.notebook.select_next(true);
- env.notebook.focus_cell();
- }
- }
- },
- 'extend-selection-above' : {
- cmd: i18n.msg._('extend selection above'),
- help: i18n.msg._('extend selected cells above'),
- help_index : 'dc',
- handler : function (env) {
- env.notebook.extend_selection_by(-1);
- // scroll into view,
- // do not call notebook.focus_cell(), or
- // all the selection get thrown away
- env.notebook.get_selected_cell().element.focus();
- }
- },
- 'extend-selection-below' : {
- cmd: i18n.msg._('extend selection below'),
- help: i18n.msg._('extend selected cells below'),
- help_index : 'dd',
- handler : function (env) {
- env.notebook.extend_selection_by(1);
- // scroll into view,
- // do not call notebook.focus_cell(), or
- // all the selection get thrown away
- env.notebook.get_selected_cell().element.focus();
- }
- },
- 'select-all' : {
- cmd: i18n.msg._('select all'),
- help: i18n.msg._('select all cells'),
- help_index : 'de',
- handler : function (env) {
- env.notebook.select_all();
- env.notebook.get_selected_cell().element.focus();
- }
- },
- 'cut-cell' : {
- cmd: i18n.msg._('cut selected cells'),
- help: i18n.msg._('cut selected cells'),
- icon: 'fa-cut',
- help_index : 'ee',
- handler : function (env) {
- var index = env.notebook.get_selected_index();
- env.notebook.cut_cell();
- env.notebook.select(index);
- }
- },
- 'copy-cell' : {
- cmd: i18n.msg._('copy selected cells'),
- help: i18n.msg._('copy selected cells'),
- icon: 'fa-copy',
- help_index : 'ef',
- handler : function (env) {
- env.notebook.copy_cell();
- }
- },
- 'paste-cell-replace' : {
- help: 'paste cells replace',
- handler : function (env) {
- env.notebook.paste_cell_replace();
- }
- },
- 'paste-cell-above' : {
- cmd: i18n.msg._('paste cells above'),
- help: i18n.msg._('paste cells above'),
- help_index : 'eg',
- handler : function (env) {
- env.notebook.paste_cell_above();
- }
- },
- 'paste-cell-below' : {
- cmd: i18n.msg._('paste cells below'),
- help: i18n.msg._('paste cells below'),
- icon: 'fa-paste',
- help_index : 'eh',
- handler : function (env) {
- env.notebook.paste_cell_below();
- }
- },
- 'insert-cell-above' : {
- cmd: i18n.msg._('insert cell above'),
- help: i18n.msg._('insert cell above'),
- help_index : 'ec',
- handler : function (env) {
- env.notebook.insert_cell_above();
- env.notebook.select_prev(true);
- env.notebook.focus_cell();
- }
- },
- 'insert-cell-below' : {
- cmd: i18n.msg._('insert cell below'),
- help: i18n.msg._('insert cell below'),
- icon : 'fa-plus',
- help_index : 'ed',
- handler : function (env) {
- env.notebook.insert_cell_below();
- env.notebook.select_next(true);
- env.notebook.focus_cell();
- }
- },
- 'change-cell-to-code' : {
- cmd: i18n.msg._('change cell to code'),
- help : i18n.msg._('change cell to code'),
- help_index : 'ca',
- handler : function (env) {
- env.notebook.cells_to_code();
- }
- },
- 'change-cell-to-markdown' : {
- cmd: i18n.msg._('change cell to markdown'),
- help : i18n.msg._('change cell to markdown'),
- help_index : 'cb',
- handler : function (env) {
- env.notebook.cells_to_markdown();
- }
- },
- 'change-cell-to-raw' : {
- cmd: i18n.msg._('change cell to raw'),
- help : i18n.msg._('change cell to raw'),
- help_index : 'cc',
- handler : function (env) {
- env.notebook.cells_to_raw();
- }
- },
- 'change-cell-to-heading-1' : {
- cmd: i18n.msg._('change cell to heading 1'),
- help : i18n.msg._('change cell to heading 1'),
- help_index : 'cd',
- handler : function (env) {
- env.notebook.to_heading(undefined, 1);
- }
- },
- 'change-cell-to-heading-2' : {
- cmd: i18n.msg._('change cell to heading 2'),
- help : i18n.msg._('change cell to heading 2'),
- help_index : 'ce',
- handler : function (env) {
- env.notebook.to_heading(undefined, 2);
- }
- },
- 'change-cell-to-heading-3' : {
- cmd: i18n.msg._('change cell to heading 3'),
- help : i18n.msg._('change cell to heading 3'),
- help_index : 'cf',
- handler : function (env) {
- env.notebook.to_heading(undefined, 3);
- }
- },
- 'change-cell-to-heading-4' : {
- cmd: i18n.msg._('change cell to heading 4'),
- help : i18n.msg._('change cell to heading 4'),
- help_index : 'cg',
- handler : function (env) {
- env.notebook.to_heading(undefined, 4);
- }
- },
- 'change-cell-to-heading-5' : {
- cmd: i18n.msg._('change cell to heading 5'),
- help : i18n.msg._('change cell to heading 5'),
- help_index : 'ch',
- handler : function (env) {
- env.notebook.to_heading(undefined, 5);
- }
- },
- 'change-cell-to-heading-6' : {
- cmd: i18n.msg._('change cell to heading 6'),
- help : i18n.msg._('change cell to heading 6'),
- help_index : 'ci',
- handler : function (env) {
- env.notebook.to_heading(undefined, 6);
- }
- },
- 'toggle-cell-output-collapsed' : {
- cmd: i18n.msg._('toggle cell output'),
- help : i18n.msg._('toggle output of selected cells'),
- help_index : 'gb',
- handler : function (env) {
- env.notebook.toggle_cells_outputs();
- }
- },
- 'toggle-cell-output-scrolled' : {
- cmd: i18n.msg._('toggle cell scrolling'),
- help : i18n.msg._('toggle output scrolling of selected cells'),
- help_index : 'gc',
- handler : function (env) {
- env.notebook.toggle_cells_outputs_scroll();
- }
- },
- 'clear-cell-output' : {
- cmd: i18n.msg._('clear cell output'),
- help : i18n.msg._('clear output of selected cells'),
- handler : function (env) {
- env.notebook.clear_cells_outputs();
- }
- },
- 'move-cell-down' : {
- cmd: i18n.msg._('move cells down'),
- help: i18n.msg._('move selected cells down'),
- icon: 'fa-arrow-down',
- help_index : 'eb',
- handler : function (env) {
- env.notebook.move_cell_down();
- }
- },
- 'move-cell-up' : {
- cmd: i18n.msg._('move cells up'),
- help: i18n.msg._('move selected cells up'),
- icon: 'fa-arrow-up',
- help_index : 'ea',
- handler : function (env) {
- env.notebook.move_cell_up();
- }
- },
- 'toggle-cell-line-numbers' : {
- cmd: i18n.msg._('toggle line numbers'),
- help : i18n.msg._('toggle line numbers'),
- help_index : 'ga',
- handler : function (env) {
- env.notebook.cell_toggle_line_numbers();
- }
- },
- 'show-keyboard-shortcuts' : {
- cmd: i18n.msg._('show keyboard shortcuts'),
- help : i18n.msg._('show keyboard shortcuts'),
- help_index : 'ge',
- handler : function (env) {
- env.quick_help.show_keyboard_shortcuts();
- }
- },
- 'delete-cell': {
- cmd: i18n.msg._('delete cells'),
- help: i18n.msg._('delete selected cells'),
- help_index : 'ej',
- handler : function (env) {
- env.notebook.delete_cell();
- }
- },
- 'undo-cell-deletion' : {
- cmd: i18n.msg._('undo cell deletion'),
- help: i18n.msg._('undo cell deletion'),
- help_index : 'ei',
- handler : function (env) {
- env.notebook.undelete_cell();
- }
- },
- // TODO reminder
- // open an issue, merge with above merge with last cell of notebook if at top.
- 'merge-cell-with-previous-cell' : {
- cmd: i18n.msg._('merge cell with previous cell'),
- help : i18n.msg._('merge cell above'),
- handler : function (env) {
- env.notebook.merge_cell_above();
- }
- },
- 'merge-cell-with-next-cell' : {
- cmd: i18n.msg._('merge cell with next cell'),
- help : i18n.msg._('merge cell below'),
- help_index : 'ek',
- handler : function (env) {
- env.notebook.merge_cell_below();
- }
- },
- 'merge-selected-cells' : {
- cmd: i18n.msg._('merge selected cells'),
- help : i18n.msg._('merge selected cells'),
- help_index: 'el',
- handler: function(env) {
- env.notebook.merge_selected_cells();
- }
- },
- 'merge-cells' : {
- cmd: i18n.msg._('merge cells'),
- help : i18n.msg._('merge selected cells, or current cell with cell below if only one cell is selected'),
- help_index: 'el',
- handler: function(env) {
- var l = env.notebook.get_selected_cells_indices().length;
- if(l == 1){
- env.notebook.merge_cell_below();
- } else {
- env.notebook.merge_selected_cells();
- }
- }
- },
- 'show-command-palette': {
- help_index : 'aa',
- cmd: i18n.msg._('show command pallette'),
- help: i18n.msg._('open the command palette'),
- icon: 'fa-keyboard-o',
- handler : function(env){
- env.notebook.show_command_palette();
- }
- },
- 'toggle-all-line-numbers': {
- cmd: i18n.msg._('toggle all line numbers'),
- help : i18n.msg._('toggles line numbers in all cells, and persist the setting'),
- icon: 'fa-list-ol',
- handler: function(env) {
- var value = !env.notebook.line_numbers;
- env.notebook.get_cells().map(function(c) {
- c.code_mirror.setOption('lineNumbers', value);
- });
- env.notebook.line_numbers = value;
- }
- },
- 'show-all-line-numbers': {
- cmd: i18n.msg._('show all line numbers'),
- help : i18n.msg._('show line numbers in all cells, and persist the setting'),
- handler: function(env) {
- env.notebook.get_cells().map(function(c) {
- c.code_mirror.setOption('lineNumbers', true);
- });
- env.notebook.line_numbers = true;
- }
- },
- 'hide-all-line-numbers': {
- cmd: i18n.msg._('hide all line numbers'),
- help : i18n.msg._('hide line numbers in all cells, and persist the setting'),
- handler: function(env) {
- env.notebook.get_cells().map(function(c) {
- c.code_mirror.setOption('lineNumbers', false);
- });
- env.notebook.line_numbers = false;
- }
- },
- 'toggle-header':{
- cmd: i18n.msg._('toggle header'),
- help: i18n.msg._('switch between showing and hiding the header'),
- handler : function(env) {
- var value = !env.notebook.header;
- if (value === true) {
- $('#header-container').show();
- $('.header-bar').show();
- } else if (value === false) {
- $('#header-container').hide();
- $('.header-bar').hide();
- }
- events.trigger('resize-header.Page');
- env.notebook.header = value;
- }
- },
- 'show-header':{
- cmd: i18n.msg._('show the header'),
- help: i18n.msg._('show the header'),
- handler : function(env) {
- $('#header-container').show();
- $('.header-bar').show();
- events.trigger('resize-header.Page');
- env.notebook.header = true;
- }
- },
- 'hide-header':{
- cmd: i18n.msg._('hide the header'),
- help: i18n.msg._('hide the header'),
- handler : function(env) {
- $('#header-container').hide();
- $('.header-bar').hide();
- events.trigger('resize-header.Page');
- env.notebook.header = false;
- }
- },
- 'toggle-menubar':{
- help: 'hide/show the menu bar',
- handler : function(env) {
- $('#menubar-container').toggle();
- events.trigger('resize-header.Page');
- }
- },
- 'show-menubar':{
- help: 'show the menu bar',
- handler : function(env) {
- $('#menubar-container').show();
- events.trigger('resize-header.Page');
- }
- },
- 'hide-menubar':{
- help: 'hide the menu bar',
- handler : function(env) {
- $('#menubar-container').hide();
- events.trigger('resize-header.Page');
- }
- },
- 'toggle-toolbar':{
- cmd: i18n.msg._('toggle toolbar'),
- help: i18n.msg._('switch between showing and hiding the toolbar'),
- handler : function(env) {
- var value = !env.notebook.toolbar;
- if (value === true) {
- $('div#maintoolbar').show();
- } else if (value === false) {
- $('div#maintoolbar').hide();
- }
- events.trigger('resize-header.Page');
- env.notebook.toolbar = value;
- }
- },
- 'show-toolbar':{
- cmd: i18n.msg._('show the toolbar'),
- help: i18n.msg._('show the toolbar'),
- handler : function(env) {
- $('div#maintoolbar').show();
- events.trigger('resize-header.Page');
- env.notebook.toolbar = true;
- }
- },
- 'hide-toolbar':{
- cmd: i18n.msg._('hide the toolbar'),
- help: i18n.msg._('hide the toolbar'),
- handler : function(env) {
- $('div#maintoolbar').hide();
- events.trigger('resize-header.Page');
- env.notebook.toolbar = false;
- }
- },
- 'close-pager': {
- cmd: i18n.msg._('close the pager'),
- help : i18n.msg._('close the pager'),
- handler : function(env) {
- // Collapse the page if it is open
- if (env.pager && env.pager.expanded) {
- env.pager.collapse();
- }
- }
- },
- 'auto-indent': {
- cmd: i18n.msg._('automatically indent selection'),
- help : i18n.msg._('automatically indent selection'),
- handler : function(env) {
- // Get selected cell
- var selected_cell = env.notebook.get_selected_cell();
- // Execute a CM command
- selected_cell.code_mirror.execCommand('indentAuto');
- }
- },
- 'close-and-halt': {
- cmd: i18n.msg._('shutdown kernel and close window'),
- help : i18n.msg._('shutdown kernel and close window'),
- handler : function(env) {
- env.notebook.close_and_halt();
- }
- }
- };
- /**
- * A bunch of `Advance actions` for Jupyter.
- * Cf `Simple Action` plus the following properties.
- *
- * handler: first argument of the handler is the event that triggered the action
- * (typically keypress). The handler is responsible for any modification of the
- * event and event propagation.
- * Is also responsible for returning false if the event have to be further ignored,
- * true, to tell keyboard manager that it ignored the event.
- *
- * the second parameter of the handler is the environment passed to Simple Actions
- *
- **/
- var custom_ignore = {
- 'ignore':{
- cmd: i18n.msg._('ignore'),
- handler : function () {
- return true;
- }
- },
- 'move-cursor-up':{
- cmd: i18n.msg._('move cursor up'),
- help: i18n.msg._("move cursor up"),
- handler : function (env, event) {
- var index = env.notebook.get_selected_index();
- var cell = env.notebook.get_cell(index);
- var cm = env.notebook.get_selected_cell().code_mirror;
- var cur = cm.getCursor();
- if (cell && cell.at_top() && index !== 0 && cur.ch === 0) {
- if(event){
- event.preventDefault();
- }
- env.notebook.command_mode();
- env.notebook.select_prev(true);
- env.notebook.edit_mode();
- cm = env.notebook.get_selected_cell().code_mirror;
- cm.setCursor(cm.lastLine(), 0);
- }
- return false;
- }
- },
- 'move-cursor-down':{
- cmd: i18n.msg._('move cursor down'),
- help: i18n.msg._("move cursor down"),
- handler : function (env, event) {
- var index = env.notebook.get_selected_index();
- var cell = env.notebook.get_cell(index);
- if (cell.at_bottom() && index !== (env.notebook.ncells()-1)) {
- if(event){
- event.preventDefault();
- }
- env.notebook.command_mode();
- env.notebook.select_next(true);
- env.notebook.edit_mode();
- var cm = env.notebook.get_selected_cell().code_mirror;
- cm.setCursor(0, 0);
- }
- return false;
- }
- },
- 'scroll-notebook-down': {
- cmd: i18n.msg._('scroll notebook down'),
- help: i18n.msg._("scroll notebook down"),
- handler: function(env, event) {
- if(event){
- event.preventDefault();
- }
- return env.notebook.scroll_manager.scroll(1);
- },
- },
- 'scroll-notebook-up': {
- cmd: i18n.msg._('scroll notebook up'),
- help: i18n.msg._("scroll notebook up"),
- handler: function(env, event) {
- if(event){
- event.preventDefault();
- }
- return env.notebook.scroll_manager.scroll(-1);
- },
- },
- 'scroll-cell-center': {
- cmd: i18n.msg._('scroll cell center'),
- help: i18n.msg._("Scroll the current cell to the center"),
- handler: function (env, event) {
- if(event){
- event.preventDefault();
- }
- var cell = env.notebook.get_selected_index();
- return env.notebook.scroll_cell_percent(cell, 50, 0);
- }
- },
- 'scroll-cell-top': {
- cmd: i18n.msg._('scroll cell top'),
- help: i18n.msg._("Scroll the current cell to the top"),
- handler: function (env, event) {
- if(event){
- event.preventDefault();
- }
- var cell = env.notebook.get_selected_index();
- return env.notebook.scroll_cell_percent(cell, 0, 0);
- }
- },
- 'duplicate-notebook':{
- cmd: i18n.msg._('duplicate notebook'),
- help: i18n.msg._("Create and open a copy of the current notebook"),
- handler : function (env, event) {
- env.notebook.copy_notebook();
- }
- },
- 'trust-notebook':{
- cmd: i18n.msg._('trust notebook'),
- help: i18n.msg._("Trust the current notebook"),
- handler : function (env, event) {
- env.notebook.trust_notebook();
- }
- },
- 'rename-notebook':{
- cmd: i18n.msg._('rename notebook'),
- help: i18n.msg._("Rename the current notebook"),
- handler : function (env, event) {
- env.notebook.save_widget.rename_notebook({notebook: env.notebook});
- }
- },
- 'toggle-all-cells-output-collapsed':{
- cmd: i18n.msg._('toggle all cells output collapsed'),
- help: i18n.msg._("Toggle the hidden state of all output areas"),
- handler : function (env, event) {
- env.notebook.toggle_all_output();
- }
- },
- 'toggle-all-cells-output-scrolled':{
- cmd: i18n.msg._('toggle all cells output scrolled'),
- help: i18n.msg._("Toggle the scrolling state of all output areas"),
- handler : function (env, event) {
- env.notebook.toggle_all_output_scroll();
- }
- },
- 'clear-all-cells-output':{
- cmd: i18n.msg._('clear all cells output'),
- help: i18n.msg._("Clear the content of all the outputs"),
- handler : function (env, event) {
- env.notebook.clear_all_output();
- }
- },
- 'save-notebook':{
- cmd: i18n.msg._('save notebook'),
- help: i18n.msg._("Save and Checkpoint"),
- help_index : 'fb',
- icon: 'fa-save',
- handler : function (env, event) {
- env.notebook.save_checkpoint();
- if(event){
- event.preventDefault();
- }
- return false;
- }
- },
- };
- // private stuff that prepend `jupyter-notebook:` to actions names
- // and uniformize/fill in missing pieces in of an action.
- var _prepare_handler = function(registry, subkey, source){
- registry['jupyter-notebook:'+subkey] = {};
- registry['jupyter-notebook:'+subkey].cmd = source[subkey].cmd;
- registry['jupyter-notebook:'+subkey].help = source[subkey].help||subkey.replace(/-/g,' ');
- registry['jupyter-notebook:'+subkey].help_index = source[subkey].help_index;
- registry['jupyter-notebook:'+subkey].icon = source[subkey].icon;
- return source[subkey].handler;
- };
- // Will actually generate/register all the Jupyter actions
- var fun = function(){
- var final_actions = {};
- var k;
- for(k in _actions){
- if(_actions.hasOwnProperty(k)){
- // Js closure are function level not block level need to wrap in a IIFE
- // and append jupyter-notebook: to event name these things do intercept event so are wrapped
- // in a function that return false.
- var handler = _prepare_handler(final_actions, k, _actions);
- (function(key, handler){
- final_actions['jupyter-notebook:'+key].handler = function(env, event){
- handler(env);
- if(event){
- event.preventDefault();
- }
- return false;
- };
- })(k, handler);
- }
- }
- for(k in custom_ignore){
- // Js closure are function level not block level need to wrap in a IIFE
- // same as above, but decide for themselves whether or not they intercept events.
- if(custom_ignore.hasOwnProperty(k)){
- handler = _prepare_handler(final_actions, k, custom_ignore);
- (function(key, handler){
- final_actions['jupyter-notebook:'+key].handler = function(env, event){
- return handler(env, event);
- };
- })(k, handler);
- }
- }
- return final_actions;
- };
- ActionHandler.prototype._actions = fun();
- /**
- * extend the environment variable that will be pass to handlers
- **/
- ActionHandler.prototype.extend_env = function(env){
- for(var k in env){
- this.env[k] = env[k];
- }
- };
- ActionHandler.prototype.register = function(action, name, prefix){
- /**
- * Register an `action` with an optional name and prefix.
- *
- * if name and prefix are not given they will be determined automatically.
- * if action if just a `function` it will be wrapped in an anonymous action.
- *
- * @return the full name to access this action .
- **/
- action = this.normalise(action);
- if( !name ){
- name = 'autogenerated-'+String(action.handler);
- }
- prefix = prefix || 'auto';
- var full_name = prefix+':'+name;
- this._actions[full_name] = action;
- return full_name;
- };
- ActionHandler.prototype.normalise = function(data){
- /**
- * given an `action` or `function`, return a normalised `action`
- * by setting all known attributes and removing unknown attributes;
- **/
- if(typeof(data) === 'function'){
- data = {handler:data};
- }
- if(typeof(data.handler) !== 'function'){
- throw new Error('unknown datatype, cannot register');
- }
- var _data = data;
- data = {};
- data.handler = _data.handler;
- data.help = _data.help || '';
- data.icon = _data.icon || '';
- data.help_index = _data.help_index || '';
- return data;
- };
- ActionHandler.prototype.get_name = function(name_or_data){
- /**
- * given an `action` or `name` of an action, return the name attached to this action.
- * if given the name of and corresponding actions does not exist in registry, return `null`.
- **/
- if(typeof(name_or_data) === 'string'){
- warn_bad_name(name_or_data);
- if(this.exists(name_or_data)){
- return name_or_data;
- } else {
- return null;
- }
- } else {
- return this.register(name_or_data);
- }
- };
- ActionHandler.prototype.get = function(name){
- warn_bad_name(name);
- return this._actions[name];
- };
- ActionHandler.prototype.call = function(name, event, env){
- return this._actions[name].handler(env|| this.env, event);
- };
- ActionHandler.prototype.exists = function(name){
- return (typeof(this._actions[name]) !== 'undefined');
- };
- return {init:ActionHandler};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- /**
- *
- *
- * @module keyboardmanager
- * @namespace keyboardmanager
- * @class KeyboardManager
- */
- define('notebook/js/keyboardmanager',[
- 'jquery',
- 'base/js/utils',
- 'base/js/keyboard',
- ], function($, utils, keyboard) {
- "use strict";
-
- // Main keyboard manager for the notebook
- var keycodes = keyboard.keycodes;
- var KeyboardManager = function (options) {
- /**
- * A class to deal with keyboard event and shortcut
- *
- * @class KeyboardManager
- * @constructor
- * @param options {dict} Dictionary of keyword arguments :
- * @param options.events {$(Events)} instance
- * @param options.pager: {Pager} pager instance
- */
- this.mode = 'command';
- this.enabled = true;
- this.pager = options.pager;
- this.quick_help = undefined;
- this.notebook = undefined;
- this.last_mode = undefined;
- this.bind_events();
- this.env = {pager:this.pager};
- this.actions = options.actions;
- this.command_shortcuts = new keyboard.ShortcutManager(undefined, options.events, this.actions, this.env, options.config, 'command');
- this.command_shortcuts._add_default_shortcuts(this.get_default_common_shortcuts());
- this.command_shortcuts._add_default_shortcuts(this.get_default_command_shortcuts());
- this.edit_shortcuts = new keyboard.ShortcutManager(undefined, options.events, this.actions, this.env);
- this.edit_shortcuts._add_default_shortcuts(this.get_default_common_shortcuts());
- this.edit_shortcuts._add_default_shortcuts(this.get_default_edit_shortcuts());
- this.config = options.config;
- var that = this;
- this.config.loaded.then(function(){
- var edit_unbind;
- try {
- edit_unbind = that.config.data.keys.edit.unbind||[];
- } catch (e) {
- if (e instanceof TypeError) {
- edit_unbind = [];
- } else {
- throw e;
- }
- }
- edit_unbind.forEach(function(u){that.edit_shortcuts.remove_shortcut(u);});
- var command_unbind;
- try {
- command_unbind = that.config.data.keys.command.unbind||[];
- } catch (e) {
- if (e instanceof TypeError) {
- command_unbind = [];
- } else {
- throw e;
- }
- }
- command_unbind.forEach(function(u){that.command_shortcuts.remove_shortcut(u);});
- that.command_shortcuts.add_shortcuts( ((that.config.data.keys||{}).command||{}).bind);
- that.edit_shortcuts.add_shortcuts( ((that.config.data.keys||{}).edit ||{}).bind);
- }
- );
- Object.seal(this);
- };
- /**
- * Return a dict of common shortcut
- * @method get_default_common_shortcuts
- *
- * @example Example of returned shortcut
- * ```
- * 'shortcut-key': 'action-name'
- * // a string representing the shortcut as dash separated value.
- * // e.g. 'shift' , 'shift-enter', 'cmd-t'
- *```
- */
- KeyboardManager.prototype.get_default_common_shortcuts = function() {
- return {
- 'shift' : 'jupyter-notebook:ignore',
- 'shift-enter' : 'jupyter-notebook:run-cell-and-select-next',
- 'alt-enter' : 'jupyter-notebook:run-cell-and-insert-below',
- 'ctrl-enter' : 'jupyter-notebook:run-cell',
- // cmd on mac, ctrl otherwise
- 'cmdtrl-enter' : 'jupyter-notebook:run-cell',
- 'cmdtrl-s' : 'jupyter-notebook:save-notebook'
- };
- };
- KeyboardManager.prototype.get_default_edit_shortcuts = function() {
- return {
- 'cmdtrl-shift-p' : 'jupyter-notebook:show-command-palette',
- 'cmdtrl-shift-f' : 'jupyter-notebook:show-command-palette',
- 'esc' : 'jupyter-notebook:enter-command-mode',
- 'ctrl-m' : 'jupyter-notebook:enter-command-mode',
- 'up' : 'jupyter-notebook:move-cursor-up',
- 'down' : 'jupyter-notebook:move-cursor-down',
- 'ctrl-shift--' : 'jupyter-notebook:split-cell-at-cursor',
- };
- };
- KeyboardManager.prototype.get_default_command_shortcuts = function() {
- return {
- 'cmdtrl-shift-p': 'jupyter-notebook:show-command-palette',
- 'cmdtrl-shift-f': 'jupyter-notebook:show-command-palette',
- 'shift-space': 'jupyter-notebook:scroll-notebook-up',
- 'shift-v' : 'jupyter-notebook:paste-cell-above',
- 'shift-m' : 'jupyter-notebook:merge-cells',
- 'shift-o' : 'jupyter-notebook:toggle-cell-output-scrolled',
- 'enter' : 'jupyter-notebook:enter-edit-mode',
- 'space' : 'jupyter-notebook:scroll-notebook-down',
- 'down' : 'jupyter-notebook:select-next-cell',
- 'i,i' : 'jupyter-notebook:interrupt-kernel',
- '0,0' : 'jupyter-notebook:confirm-restart-kernel',
- 'd,d' : 'jupyter-notebook:delete-cell',
- 'esc': 'jupyter-notebook:close-pager',
- 'up' : 'jupyter-notebook:select-previous-cell',
- 'k' : 'jupyter-notebook:select-previous-cell',
- 'j' : 'jupyter-notebook:select-next-cell',
- 'shift-k': 'jupyter-notebook:extend-selection-above',
- 'shift-j': 'jupyter-notebook:extend-selection-below',
- 'shift-up': 'jupyter-notebook:extend-selection-above',
- 'shift-down': 'jupyter-notebook:extend-selection-below',
- 'cmdtrl-a': 'jupyter-notebook:select-all',
- 'x' : 'jupyter-notebook:cut-cell',
- 'c' : 'jupyter-notebook:copy-cell',
- 'v' : 'jupyter-notebook:paste-cell-below',
- 'a' : 'jupyter-notebook:insert-cell-above',
- 'b' : 'jupyter-notebook:insert-cell-below',
- 'y' : 'jupyter-notebook:change-cell-to-code',
- 'm' : 'jupyter-notebook:change-cell-to-markdown',
- 'r' : 'jupyter-notebook:change-cell-to-raw',
- '1' : 'jupyter-notebook:change-cell-to-heading-1',
- '2' : 'jupyter-notebook:change-cell-to-heading-2',
- '3' : 'jupyter-notebook:change-cell-to-heading-3',
- '4' : 'jupyter-notebook:change-cell-to-heading-4',
- '5' : 'jupyter-notebook:change-cell-to-heading-5',
- '6' : 'jupyter-notebook:change-cell-to-heading-6',
- 'o' : 'jupyter-notebook:toggle-cell-output-collapsed',
- 's' : 'jupyter-notebook:save-notebook',
- 'l' : 'jupyter-notebook:toggle-cell-line-numbers',
- 'shift-l' : 'jupyter-notebook:toggle-all-line-numbers',
- 'h' : 'jupyter-notebook:show-keyboard-shortcuts',
- 'z' : 'jupyter-notebook:undo-cell-deletion',
- 'q' : 'jupyter-notebook:close-pager',
- 'p' : 'jupyter-notebook:show-command-palette',
- };
- };
- KeyboardManager.prototype.bind_events = function () {
- var that = this;
- $(document).keydown(function (event) {
- if(event._ipkmIgnore===true||(event.originalEvent||{})._ipkmIgnore===true){
- return false;
- }
- return that.handle_keydown(event);
- });
- };
- KeyboardManager.prototype.set_notebook = function (notebook) {
- this.notebook = notebook;
- this.actions.extend_env({notebook:notebook});
- };
-
- KeyboardManager.prototype.set_quickhelp = function (notebook) {
- this.actions.extend_env({quick_help:notebook});
- };
- KeyboardManager.prototype.handle_keydown = function (event) {
- /**
- * returning false from this will stop event propagation
- **/
- if (event.which === keycodes.esc) {
- // Intercept escape at highest level to avoid closing
- // websocket connection with firefox
- event.preventDefault();
- }
-
- if (!this.enabled) {
- if (event.which === keycodes.esc) {
- this.notebook.command_mode();
- return false;
- }
- return true;
- }
-
- if (this.mode === 'edit') {
- return this.edit_shortcuts.call_handler(event);
- } else if (this.mode === 'command') {
- return this.command_shortcuts.call_handler(event);
- }
- return true;
- };
- KeyboardManager.prototype.edit_mode = function () {
- this.last_mode = this.mode;
- this.mode = 'edit';
- };
- KeyboardManager.prototype.command_mode = function () {
- this.last_mode = this.mode;
- this.mode = 'command';
- };
- KeyboardManager.prototype.enable = function () {
- this.enabled = true;
- };
- KeyboardManager.prototype.disable = function () {
- this.enabled = false;
- };
- KeyboardManager.prototype.register_events = function (e) {
- e = $(e);
- var that = this;
- var handle_focus = function () {
- that.disable();
- };
- var handle_blur = function () {
- that.enable();
- };
- e.on('focusin', handle_focus);
- e.on('focusout', handle_blur);
- // TODO: Very strange. The focusout event does not seem fire for the
- // bootstrap textboxes on FF25&26... This works around that by
- // registering focus and blur events recursively on all inputs within
- // registered element.
- e.find('input').blur(handle_blur);
- e.on('DOMNodeInserted', function (event) {
- var target = $(event.target);
- if (target.is('input')) {
- target.blur(handle_blur);
- } else {
- target.find('input').blur(handle_blur);
- }
- });
- // There are times (raw_input) where we remove the element from the DOM before
- // focusout is called. In this case we bind to the remove event of jQueryUI,
- // which gets triggered upon removal, iff it is focused at the time.
- // is_focused must be used to check for the case where an element within
- // the element being removed is focused.
- e.on('remove', function () {
- if (utils.is_focused(e[0])) {
- that.enable();
- }
- });
- };
- return {'KeyboardManager': KeyboardManager};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/kernelselector',[
- 'jquery',
- 'base/js/namespace',
- 'base/js/dialog',
- 'base/js/utils',
- 'base/js/i18n'
- ], function($, IPython, dialog, utils, i18n) {
- "use strict";
-
- var KernelSelector = function(selector, notebook, options) {
- options = options || {};
- var that = this;
- this.selector = selector;
- this.notebook = notebook;
- this.nbclassic_path = options.nbclassic_path;
- this.notebook.set_kernelselector(this);
- this.events = notebook.events;
- this.current_selection = null;
- this.kernelspecs = {};
- if (this.selector !== undefined) {
- this.element = $(selector);
- this.request_kernelspecs();
- }
- this.bind_events();
- // Make the object globally available for user convenience & inspection
- IPython.kernelselector = this;
- this._finish_load = null;
- this._loaded = false;
- this.loaded = new Promise(function(resolve) {
- that._finish_load = resolve;
- });
-
- Object.seal(this);
- };
-
- KernelSelector.prototype.request_kernelspecs = function() {
- // Preliminary documentation for kernelspecs api is at
- // https://github.com/ipython/ipython/wiki/IPEP-25%3A-Registry-of-installed-kernels#rest-api
- var url = utils.url_path_join(this.notebook.base_url, 'api/kernelspecs');
- utils.promising_ajax(url).then($.proxy(this._got_kernelspecs, this));
- };
-
- var _sorted_names = function(kernelspecs) {
- // sort kernel names
- return Object.keys(kernelspecs).sort(function (a, b) {
- // sort by display_name
- var da = kernelspecs[a].spec.display_name;
- var db = kernelspecs[b].spec.display_name;
- if (da === db) {
- return 0;
- } else if (da > db) {
- return 1;
- } else {
- return -1;
- }
- });
- };
-
- KernelSelector.prototype._got_kernelspecs = function(data) {
- var that = this;
- this.kernelspecs = data.kernelspecs;
- var change_kernel_submenu = $("#menu-change-kernel-submenu");
- var new_notebook_submenu = $("#menu-new-notebook-submenu");
- var keys = _sorted_names(data.kernelspecs);
-
- keys.map(function (key) {
- // Create the Kernel > Change kernel submenu
- var ks = data.kernelspecs[key];
- change_kernel_submenu.append(
- $("<li>").attr("id", "kernel-submenu-"+ks.name).append(
- $('<a>')
- .attr('href', '#')
- .click( function () {
- that.set_kernel(ks.name);
- })
- .text(ks.spec.display_name)
- )
- );
- // Create the File > New Notebook submenu
- new_notebook_submenu.append(
- $("<li>").attr("id", "new-notebook-submenu-"+ks.name).append(
- $('<a>')
- .attr('href', '#')
- .click( function () {
- that.new_notebook(ks.name);
- })
- .text(ks.spec.display_name)
- )
- );
- });
- // trigger loaded promise
- this._loaded = true;
- this._finish_load();
- };
-
- KernelSelector.prototype._spec_changed = function (event, ks) {
- /** event handler for spec_changed */
- var that = this;
-
- // update selection
- this.current_selection = ks.name;
-
- // put the current kernel at the top of File > New Notebook
- var cur_kernel_entry = $("#new-notebook-submenu-" + ks.name);
- var parent = cur_kernel_entry.parent();
- // do something only if there is more than one kernel
- if (parent.children().length > 1) {
- // first, sort back the submenu
- parent.append(
- parent.children("li[class!='divider']").sort(
- function (a,b) {
- var da = $("a",a).text();
- var db = $("a",b).text();
- if (da === db) {
- return 0;
- } else if (da > db) {
- return 1;
- } else {
- return -1;
- }}));
- // then, if there is no divider yet, add one
- if (!parent.children("li[class='divider']").length) {
- parent.prepend($("<li>").attr("class","divider"));
- }
- // finally, put the current kernel at the top
- parent.prepend(cur_kernel_entry);
- }
-
- // load logo
- var logo_img = this.element.find("img.current_kernel_logo");
- $("#kernel_indicator").find('.kernel_indicator_name').text(ks.spec.display_name);
- if (ks.resources['logo-64x64']) {
- logo_img.attr("src", ks.resources['logo-64x64']);
- logo_img.attr("title", ks.spec.display_name);
- logo_img.show();
- } else {
- logo_img.hide();
- }
-
- // load kernel css
- var css_url = ks.resources['kernel.css'];
- if (css_url) {
- $('#kernel-css').attr('href', css_url);
- } else {
- $('#kernel-css').attr('href', '');
- }
-
- // load kernel js
- if (ks.resources['kernel.js']) {
- // Debug added for Notebook 4.2, please remove at some point in the
- // future if the following does not append anymore when kernels
- // have kernel.js
- //
- // > Uncaught (in promise) TypeError: require is not a function
- //
- console.info('Dynamically requiring kernel.js, `requirejs` is ', requirejs);
- requirejs([ks.resources['kernel.js']],
- function (kernel_mod) {
- if (kernel_mod && kernel_mod.onload) {
- kernel_mod.onload();
- } else {
- console.warn("Kernel " + ks.name + " has a kernel.js file that does not contain "+
- "any asynchronous module definition. This is undefined behavior "+
- "and not recommended.");
- }
- }, function (err) {
- console.warn("Failed to load kernel.js from ", ks.resources['kernel.js'], err);
- }
- );
- this.events.on('spec_changed.Kernel', function (evt, new_ks) {
- if (ks.name != new_ks.name) {
- console.warn("kernelspec %s had custom kernel.js. Forcing page reload for %s.",
- ks.name, new_ks.name);
- that.notebook.save_notebook().then(function () {
- window.location.reload();
- });
- }
- });
- }
- };
- KernelSelector.prototype.set_kernel = function (selected) {
- /** set the kernel by name, ensuring kernelspecs have been loaded, first
-
- kernel can be just a kernel name, or a notebook kernelspec metadata
- (name, language, display_name).
- */
- var that = this;
- if (typeof selected === 'string') {
- selected = {
- name: selected
- };
- }
- if (this._loaded) {
- this._set_kernel(selected);
- } else {
- return this.loaded.then(function () {
- that._set_kernel(selected);
- });
- }
- };
- KernelSelector.prototype._set_kernel = function (selected) {
- /** Actually set the kernel (kernelspecs have been loaded) */
- if (selected.name === this.current_selection) {
- // only trigger event if value changed
- return;
- }
- var kernelspecs = this.kernelspecs;
- var ks = kernelspecs[selected.name];
- if (ks === undefined) {
- var available = _sorted_names(kernelspecs);
- var matches = [];
- if (selected.language && selected.language.length > 0) {
- available.map(function (name) {
- if (kernelspecs[name].spec.language.toLowerCase() === selected.language.toLowerCase()) {
- matches.push(name);
- }
- });
- }
- if (matches.length === 1) {
- ks = kernelspecs[matches[0]];
- console.log("No exact match found for " + selected.name +
- ", using only kernel that matches language=" + selected.language, ks);
- this.events.trigger("spec_match_found.Kernel", {
- selected: selected,
- found: ks,
- });
- }
- // if still undefined, trigger failure event
- if (ks === undefined) {
- this.events.trigger("spec_not_found.Kernel", {
- selected: selected,
- matches: matches,
- available: available,
- });
- return;
- }
- }
- if (this.notebook._session_starting &&
- this.notebook.session.kernel.name !== ks.name) {
- console.error("Cannot change kernel while waiting for pending session start.");
- return;
- }
- this.current_selection = ks.name;
- this.events.trigger('spec_changed.Kernel', ks);
- };
-
- KernelSelector.prototype._spec_not_found = function (event, data) {
- var that = this;
- var select = $("<select>").addClass('form-control');
- console.warn("Kernelspec not found:", data);
- var names;
- if (data.matches.length > 1) {
- names = data.matches;
- } else {
- names = data.available;
- }
- names.map(function (name) {
- var ks = that.kernelspecs[name];
- select.append(
- $('<option/>').attr('value', ks.name).text(ks.spec.display_name || ks.name)
- );
- });
-
- var no_kernel_msg = i18n.msg.sprintf(i18n.msg._("Could not find a kernel matching %s. Please select a kernel:"),
- (data.selected.display_name || data.selected.name))
- var body = $("<form>").addClass("form-inline").append(
- $("<span>").text(no_kernel_msg)
- ).append(select);
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [ i18n.msg._("Continue Without Kernel"), i18n.msg._("Set Kernel"), i18n.msg._("OK") ];
-
- dialog.modal({
- title : i18n.msg._('Kernel not found'),
- body : body,
- buttons : {
- 'Continue Without Kernel' : {
- class : 'btn-danger',
- click : function () {
- that.events.trigger('no_kernel.Kernel');
- }
- },
- 'Set Kernel' : {
- class : 'btn-primary',
- click : function () {
- that.set_kernel(select.val());
- }
- }
- }
- });
- };
- KernelSelector.prototype.new_notebook = function (kernel_name) {
-
- var w = window.open('', IPython._target);
- // Create a new notebook in the same path as the current
- // notebook's path.
- var that = this;
- var parent = utils.url_path_split(that.notebook.notebook_path)[0];
- that.notebook.contents.new_untitled(parent, {type: "notebook"}).then(
- function (data) {
- var url = utils.url_path_join(
- that.notebook.base_url, that.nbclassic_path, 'notebooks',
- utils.encode_uri_components(data.path)
- );
- url += "?kernel_name=" + kernel_name;
- w.location = url;
- },
- function(error) {
- w.close();
- dialog.modal({
- title : i18n.msg._('Creating Notebook Failed'),
- body : i18n.msg.sprintf(i18n.msg._("The error was: %s"), error.message),
- buttons : {'OK' : {'class' : 'btn-primary'}}
- });
- }
- );
- };
- KernelSelector.prototype.lock_switch = function() {
- // should set a flag and display warning+reload if user want to
- // re-change kernel. As UI discussion never finish
- // making that a separate PR.
- console.warn('switching kernel is not guaranteed to work !');
- };
- KernelSelector.prototype.bind_events = function() {
- var that = this;
- this.events.on('spec_changed.Kernel', $.proxy(this._spec_changed, this));
- this.events.on('spec_not_found.Kernel', $.proxy(this._spec_not_found, this));
- this.events.on('kernel_created.Session', function (event, data) {
- that.set_kernel(data.kernel.name);
- });
-
- var logo_img = this.element.find("img.current_kernel_logo");
- logo_img.on("load", function() {
- logo_img.show();
- });
- logo_img.on("error", function() {
- logo_img.hide();
- });
- };
- return {'KernelSelector': KernelSelector};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- requirejs([
- 'jquery',
- 'base/js/dialog',
- 'base/js/i18n',
- 'underscore',
- 'base/js/namespace'
- ], function ($, dialog, i18n, _, IPython) {
- 'use strict';
- $('#notebook_about').click(function () {
- // The nbclassicPath is only injected in the document by nbclassic.
- var is_nbclassic = document.nbclassicPath !== undefined;
- // use underscore template to auto html escape
- if (sys_info) {
- var text = '';
- if (is_nbclassic) {
- text = text + i18n.msg._('You are using Jupyter NbClassic.');
- text = text + '<br/><br/>';
- text = text + i18n.msg._('The version of the Jupyter server is: ');
- text = text + _.template('<b><%- version %></b>')({ version: sys_info.jupyter_server_version });
- if (sys_info.commit_hash) {
- text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
- }
- text = text + '<br/>';
- text = text + 'To get the version of nbclassic, run in a terminal: jupyter nbclassic --version';
- }
- else {
- text = text + i18n.msg._('You are using Jupyter Notebook.');
- text = text + '<br/><br/>';
- text = text + i18n.msg._('The version of the notebook server is: ');
- text = text + _.template('<b><%- version %></b>')({ version: sys_info.notebook_version });
- if (sys_info.commit_hash) {
- text = text + _.template('-<%- hash %>')({ hash: sys_info.commit_hash });
- }
- }
- text = text + '<br/>';
- text = text + i18n.msg._('The server is running on this version of Python:');
- text = text + _.template('<br/><pre>Python <%- pyver %></pre>')({
- pyver: sys_info.sys_version });
- var kinfo = $('<div/>').attr('id', '#about-kinfo').text(i18n.msg._('Waiting for kernel to be available...'));
- var body = $('<div/>');
- body.append($('<h4/>').text(i18n.msg._('Server Information:')));
- body.append($('<p/>').html(text));
- body.append($('<h4/>').text(i18n.msg._('Current Kernel Information:')));
- body.append(kinfo);
- } else {
- var text = i18n.msg._('Could not access sys_info variable for version information.');
- var body = $('<div/>');
- body.append($('<h4/>').text(i18n.msg._('Cannot find sys_info!')));
- body.append($('<p/>').html(text));
- }
- if (is_nbclassic) {
- dialog.modal({
- title: i18n.msg._('About Jupyter NbClassic'),
- body: body,
- buttons: { 'OK': {} }
- });
- } else {
- dialog.modal({
- title: i18n.msg._('About Jupyter Notebook'),
- body: body,
- buttons: { 'OK': {} }
- });
- }
- try {
- IPython.notebook.session.kernel.kernel_info(function (data) {
- kinfo.html($('<pre/>').text(data.content.banner));
- });
- } catch (e) {
- kinfo.html($('<p/>').text(i18n.msg._('unable to contact kernel')));
- }
- });
- });
- define("notebook/js/about", function(){});
- define('notebook/js/searchandreplace',[
- 'jquery',
- 'base/js/dialog',
- 'base/js/i18n'
- ], function($, dialog, i18n){
- "use strict";
- /**
- * escape a Regular expression to act as a pure search string.
- * though it will still have the case sensitivity options and all
- * the benefits
- **/
- function escapeRegExp(string){
- return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
- }
- /**
- * Compute the model of the preview for the search and replace.
- * It might not be perfectly accurate if matches overlap...
- * Parameter:
- * sre: the string that will become the Search Regular Expression
- * arr: a list of string on which the match will be applied.
- * isCaseSensitive: should the match be CaseSensitive
- * RegExOrNot: a `RegExOrNot` object.
- * replace: the replacement string for the matching `sre`
- * Return: a tuple of 2 value:
- * 1) array of [before match, match, replacement, after match]
- * where before and after match are cut to a reasonable length after the match.
- * 2) Boolean, whether the matching has been aborted because one of the element of
- * arr have too many matches.
- **/
- var compute_preview_model = function(sre, arr, isCaseSensitive, RegExpOrNot, replace){
- var html = [];
- // and create an array of
- // before_match, match , replacement, after_match
- var aborted = false;
- var replacer_reg = new RegExpOrNot(sre);
- for(var r=0; r < arr.length; r++){
- var current_line = arr[r];
- var match_abort = getMatches(sre, current_line, isCaseSensitive, RegExpOrNot);
- aborted = aborted || match_abort[1];
- var matches = match_abort[0];
- for(var mindex=0; mindex < matches.length ; mindex++){
- var start = matches[mindex][0];
- var stop = matches[mindex][1];
- var initial = current_line.slice(start, stop);
- var replaced = initial.replace(replacer_reg, replace);
- // that might be better as a dictionary
- html.push([cutBefore(current_line.slice(0, start)),
- initial,
- replaced,
- cutAfter(current_line.slice(stop), 30-(stop-start))]);
- }
- }
- return [html, aborted];
- };
- /**
- * Build the preview model where things matched and their replacement values
- * are wrapped in tags with correct CSS classes.
- * Parameter:
- * body: jQuery element into which the preview will be build
- * aborted : have the model been aborted (Boolean) use to tell the user
- * that the preview might not show all the replacements
- * html: array of model created by compute_preview_model
- * replace: Boolean: whether we are actually replacing with something or just matching.
- **/
- var build_preview = function(body, aborted, html, replace){
- body.empty();
- if(aborted){
- var warnmsg = i18n.msg.sprintf(i18n.msg._("Warning: too many matches (%d). Some changes might not be shown or applied."),html.length);
- body.append($('<p/>').addClass('bg-warning').text(warnmsg));
- } else {
- var matchmsg = i18n.msg.sprintf(i18n.msg.ngettext("%d match","%d matches",html.length),html.length);
- body.append($('<p/>').text(matchmsg));
- }
- for(var rindex=0; rindex<html.length; rindex++){
- var pre = $('<pre/>')
- .append(html[rindex][0])
- .append($('<span/>').addClass('match').text(html[rindex][1]));
- if(replace){
- pre.append($('<span/>').addClass('insert').text(html[rindex][2]));
- pre.addClass('replace');
- }
- pre.append(html[rindex][3]);
- body.append(pre);
- }
- };
- /**
- * Given a string, return only the beginning, with potentially an ellipsis
- * at the end.
- **/
- var cutAfter = function(string, n){
- n=n||10;
- while(n<10){
- n+=15;
- }
- if(string.length > n+3){
- return string.slice(0, n)+'...';
- }
- return string;
- };
- /**
- * Given a string, return only the end, with potentially an ellipsis
- * at the beginning.
- **/
- var cutBefore = function(string){
- if(string.length > 33){
- return '...'+string.slice(-30);
- }
- return string;
- };
- /**
- * Find all occurrences of `re` in `string`, match in a `caseSensitive`
- * manner or not, and determine whether `re` is a RegExp or not depending of
- * the type of object passed as `r`.
- *
- * Return a tuple
- * 1) list of matches [start, stop] indexes in the string.
- * 2) abort Boolean, if more that 100 matches and the matches were aborted.
- **/
- var getMatches = function(re, string, caseSensitive, r){
- var extra = caseSensitive ? '':'i';
- extra = '';
- try {
- re = r(re, 'g'+extra);// have to global or infinite loop
- } catch (e){
- return [[], false];
- }
- var res = [];
- var match;
- var escape_hatch = 0;
- var abort = false;
- while((match = re.exec(string)) !== null) {
- res.push([match.index, match.index+match[0].length]);
- escape_hatch++;
- if(escape_hatch > 100){
- console.warn(i18n.msg._("More than 100 matches, aborting"));
- abort = true;
- break;
- }
- }
- return [res, abort];
- };
- // main function
- /**
- * Search N' Replace action handler.
- **/
- var snr = function(env, event) {
-
- var isRegExpButton = $('<button/>')
- .attr('type', 'button')
- .attr('id', 'isreg')
- .addClass("btn btn-default btn-sm")
- .attr('data-toggle','button')
- .css('font-weight', 'bold')
- .attr('title', i18n.msg._('Use regex (JavaScript regex syntax)'))
- .text('.*');
- var allCellsButton = $('<button/>')
- .append($('<i/>').addClass('fa fa-arrows-v'))
- .attr('id', 'findreplace_allcells_btn')
- .attr('type', 'button')
- .addClass("btn btn-default btn-sm")
- .attr('data-toggle','button')
- .attr('title', i18n.msg._('Replace in all cells'));
- var isCaseSensitiveButton = $('<button/>')
- .attr('type', 'button')
- .addClass("btn btn-default btn-sm")
- .attr('data-toggle','button')
- .attr('tabindex', '0')
- .attr('title', i18n.msg._('Match case'))
- .css('font-weight', 'bold')
- .text('Aa');
-
- var search = $("<input/>")
- .addClass('form-control input-sm')
- .attr('id', 'findreplace_find_inp')
- .attr('placeholder',i18n.msg._('Find'));
- var findFormGroup = $('<div/>').addClass('form-group');
- findFormGroup.append(
- $('<div/>').addClass('input-group')
- .append(
- $('<div/>').addClass('input-group-btn')
- .append(isCaseSensitiveButton)
- .append(isRegExpButton)
- .append(allCellsButton)
- )
- .append(search)
- )
- var replace = $("<input/>")
- .attr('id', 'findreplace_replace_inp')
- .addClass('form-control input-sm')
- .attr('placeholder',i18n.msg._('Replace'));
- var replaceFormGroup = $('<div/>').addClass('form-group');
- replaceFormGroup.append(replace);
- var body = $('<div/>').attr('id', 'replace-preview');
-
- var form = $('<form/>').attr('id', 'find-and-replace')
- form.append(findFormGroup);
- form.append(replaceFormGroup);
- form.append(body);
- // return whether the search is case sensitive
- var isCaseSensitive = function(){
- var value = isCaseSensitiveButton.attr('aria-pressed') == 'true';
- return value;
- };
- // return whether the search is RegExp based, or
- // plain string matching.
- var isReg = function(){
- var value = isRegExpButton.attr('aria-pressed') == 'true';
- return value;
- };
- var allCells = function(){
- return (allCellsButton.attr('aria-pressed') == 'true');
- };
- // return a Pseudo RegExp object that acts
- // either as a plain RegExp Object, or as a pure string matching.
- // automatically set the flags for case sensitivity from the UI
- var RegExpOrNot = function(str, flags){
- if (!isCaseSensitive()){
- flags = (flags || '')+'i';
- }
- if (isRegExpButton.attr('aria-pressed') === 'true'){
- return new RegExp(str, flags);
- } else {
- return new RegExp(escapeRegExp(str), flags);
- }
- };
- var onError = function(body){
- body.empty();
- body.append($('<p/>').text(i18n.msg._('No matches, invalid or empty regular expression')));
- };
- var get_cells = function(env){
- if(allCells()){
- return env.notebook.get_cells();
- } else {
- return env.notebook.get_selected_cells();
- }
- };
- var get_all_text = function(cells) {
- var arr = [];
- for (var c = 0; c < cells.length; c++) {
- arr = arr.concat(cells[c].code_mirror.getValue().split('\n'));
- }
- return arr;
- };
- /**
- * callback triggered anytime a change is made to the
- * request, case sensitivity, isregex, search or replace
- * modification.
- **/
- var onChange = function(){
- var sre = search.val();
- // abort on invalid RE
- if (!sre) {
- return onError(body);
- }
- try {
- new RegExpOrNot(sre);
- } catch (e) {
- return onError(body);
- }
- // might want to warn if replace is empty
- var replaceValue = replace.val();
- var lines = get_all_text(get_cells(env));
- var _hb = compute_preview_model(sre, lines, isCaseSensitive(), RegExpOrNot, replaceValue);
- var html = _hb[0];
- var aborted = _hb[1];
- build_preview(body, aborted, html, replaceValue);
- // done on type return false not to submit form
- return false;
- };
- var onsubmit = function(event) {
- var sre = search.val();
- var replaceValue = replace.val();
- if (!sre) {
- return false;
- }
- // should abort on invalid RegExp.
- // need to be multi line if we want to directly replace in codemirror.
- // or need to split/replace/join
- var reg = RegExpOrNot(sre, 'gm');
- var cells = get_cells(env);
- for (var c = 0; c < cells.length; c++) {
- var cell = cells[c];
- if (!cell.is_editable()) {
- continue;
- }
-
- var oldvalue = cell.code_mirror.getValue();
- var newvalue = oldvalue.replace(reg , replaceValue);
- cell.code_mirror.setValue(newvalue);
- if (cell.cell_type === 'markdown') {
- cell.rendered = false;
- cell.render();
- }
- }
- };
- // wire-up the UI
- isRegExpButton.click(function(){
- search.focus();
- setTimeout(function(){onChange();}, 100);
- });
- isCaseSensitiveButton.click(function(){
- search.focus();
- setTimeout(function(){onChange();}, 100);
- });
- allCellsButton.click(function(){
- replace.focus();
- setTimeout(function(){onChange();}, 100);
- });
- search.keypress(function (e) {
- if (e.which == 13) {//enter
- replace.focus();
- }
- });
- search.on('input', onChange);
- replace.on('input', onChange);
- // This statement is used simply so that message extraction
- // will pick up the strings. The actual setting of the text
- // for the button is in dialog.js.
- var button_labels = [ i18n.msg._("Replace All")];
- var mod = dialog.modal({
- show: false,
- title: i18n.msg._("Find and Replace"),
- body:form,
- keyboard_manager: env.notebook.keyboard_manager,
- buttons:{
- 'Replace All':{ class: "btn-primary",
- click: function(event){onsubmit(event); return true;},
- id: "findreplace_replaceall_btn",
- }
- },
- open: function(){
- search.focus();
- }
- });
- replace.keypress(function (e) {
- if (e.which == 13) {//enter
- onsubmit();
- mod.modal('hide');
- }
- });
- mod.modal('show');
- };
- var load = function(keyboard_manager){
- var action_all = {
- cmd: i18n.msg._('find and replace'),
- help: i18n.msg._('find and replace'),
- handler: function(env, event){
- snr(env, event);
- }
- };
- var act_all = keyboard_manager.actions.register(action_all, 'find-and-replace', 'jupyter-notebook');
- keyboard_manager.command_shortcuts.add_shortcuts({
- 'f': 'jupyter-notebook:find-and-replace'
- });
- };
- return {load:load};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- define('notebook/js/clipboard',[
- 'jquery',
- 'base/js/namespace',
- 'base/js/utils',
- 'base/js/i18n',
- 'base/js/dialog'
- ], function($, Jupyter, utils, i18n, dialog) {
- var jcbprefix = '<pre class="jupyter-nb-cells-json">';
- var jcbsuffix = '</pre>';
- function store_json(cells, clipboard) {
- // Firefox ignores application/json mime type, so put it in HTML as well.
- // We also copy a text version so you can paste cell sources into a text editor
- var j = JSON.stringify(cells);
- var t = cells.map(function(c) {return c.source;}).join('\n\n');
- clipboard.setData('text/plain', t);
- clipboard.setData('text/html', jcbprefix + j + jcbsuffix);
- clipboard.setData('application/json', j);
- }
- function load_json(clipboard) {
- var s = clipboard.getData('text/html');
- // System/browsers may add some more stuff before/after our content, so
- // find where our prefix and suffix are.
- var pix = s.indexOf(jcbprefix);
- var six = s.lastIndexOf(jcbsuffix);
- if (pix === -1 || six === -1) {
- return null;
- }
- return JSON.parse(s.slice(pix + jcbprefix.length, six));
- }
- function isProgrammaticCopy(event) {
- return (typeof(event.target.selectionStart) !== 'undefined'
- && typeof(event.target.selectionEnd) !== 'undefined'
- && ((event.target.selectionEnd - event.target.selectionStart) > 0));
- }
- function copy(event) {
- if ((Jupyter.notebook.mode !== 'command') ||
- // window.getSelection checks if text is selected, e.g. in output
- !window.getSelection().isCollapsed ||
- // Allow programmatic copy
- isProgrammaticCopy(event)) {
- return;
- }
- var selecn = Jupyter.notebook.get_selected_cells().map(
- function(c) { return c.toJSON();});
- store_json(selecn, event.clipboardData);
- event.preventDefault();
- }
- function paste(event) {
- if (Jupyter.notebook.mode !== 'command') {
- return;
- }
- console.log(i18n.msg.sprintf(i18n.msg._('Clipboard types: %s'),event.clipboardData.types));
- cells = load_json(event.clipboardData);
- // console.log(cells);
- // Does this JSON look like cells?
- if (Array.isArray(cells) && (cells.length > 0) &&
- cells[0].cell_type && cells[0].source) {
- var first_inserted = null;
- for (var i=0; i < cells.length; i++) {
- var cell_data = cells[i];
- var new_cell = Jupyter.notebook.insert_cell_above(cell_data.cell_type);
- new_cell.fromJSON(cell_data);
- if (first_inserted === null) {
- first_inserted = new_cell;
- }
- }
- first_inserted.focus_cell();
- }
- event.preventDefault();
- }
- function notebookOnlyEvent(callback) {
- // Only call the callback to redirect the event if the notebook should be
- // handling the events, at the discretion of the keyboard manager.
- // If the focus is in a text widget or something (kbmanager disabled),
- // allow the default event.
- return function() {
- if (Jupyter.keyboard_manager.enabled) {
- callback.apply(this, arguments);
- }
- };
- }
- function needs_text_box_for_paste_event() {
- // I know this is bad, but I don't know a better way to check this
- return navigator.userAgent.indexOf('Firefox') !== -1;
- }
- function setup_paste_dialog() {
- // Firefox only fires a paste event if the cursor is in a text input. So, on
- // Ctrl-V, bring up a dialog with an invisible text box and catch the
- // second Ctrl-V
- var action = {
- icon: 'fa-clipboard', // a font-awesome class used on buttons, etc
- help : i18n.msg._('Dialog for paste from system clipboard'),
- help_index : 'zz',
- handler : function () {
- var entry_box = $('<input type="text"/>');
- entry_box.css('opacity', 0);
- function paste_close_dlg(e) {
- paste(e);
- // There must be a better way to do this, but it's not any of:
- // .hide(), .remove() or .dialog('close')
- paste_dlg.find('.close').click();
- document.removeEventListener('paste', paste_close_dlg);
- }
- document.addEventListener('paste', paste_close_dlg);
- var cmdtrl = i18n.msg._('Ctrl-V');
- if (utils.platform === 'MacOS') {
- cmdtrl = i18n.msg._('Cmd-V');
- }
- var dialog_body = $("<div/>").append("<p>").append(i18n.msg.sprintf(i18n.msg._("Press %s again to paste"),cmdtrl))
- .append("<br/>")
- .append("<p><b>")
- .append(i18n.msg._("Why is this needed? "))
- .append("</b>")
- .append(i18n.msg._("We can't get paste events in this browser without a text box. "))
- .append(i18n.msg._("There's an invisible text box focused in this dialog."))
- .append($("<form/>").append(entry_box));
- var paste_dlg = dialog.modal({
- notebook: Jupyter.notebook,
- keyboard_manager: Jupyter.keyboard_manager,
- title : i18n.msg.sprintf(i18n.msg._("%s to paste"),cmdtrl),
- body : dialog_body,
- open: function() {
- entry_box.focus();
- },
- buttons : {
- "Cancel" : {
- // click : function() { reject("Dialog cancelled"); },
- }
- }
- });
- }
- };
- var full_action_name = Jupyter.actions.register(action, 'paste-dialog', 'system-clipboard');
- Jupyter.keyboard_manager.command_shortcuts.add_shortcut('Cmdtrl-V', full_action_name);
- }
- // Set clipboard event listeners on the document.
- return {setup_clipboard_events: function() {
- document.addEventListener('copy', notebookOnlyEvent(copy));
- if (needs_text_box_for_paste_event()) {
- setup_paste_dialog();
- } else {
- document.addEventListener('paste', notebookOnlyEvent(paste));
- }
- }};
- });
- // Copyright (c) Jupyter Development Team.
- // Distributed under the terms of the Modified BSD License.
- // adapted from Mozilla Developer Network example at
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Function/bind
- // shim `bind` for testing under casper.js
- var bind = function bind(obj) {
- var slice = [].slice;
- var args = slice.call(arguments, 1),
- self = this,
- nop = function() {
- },
- bound = function() {
- return self.apply(this instanceof nop ? this : (obj || {}), args.concat(slice.call(arguments)));
- };
- nop.prototype = this.prototype || {}; // Firefox cries sometimes if prototype is undefined
- bound.prototype = new nop();
- return bound;
- };
- Function.prototype.bind = Function.prototype.bind || bind ;
- requirejs.config({
- map: {
- "*": {
- "typeahead": "jquery-typeahead"
- }
- }
- })
- requirejs([
- 'jquery',
- 'contents',
- 'base/js/namespace',
- 'notebook/js/notebook',
- 'services/config',
- 'base/js/utils',
- 'base/js/page',
- 'base/js/events',
- 'base/js/promises',
- 'auth/js/loginwidget',
- 'notebook/js/maintoolbar',
- 'notebook/js/pager',
- 'notebook/js/promises',
- 'notebook/js/quickhelp',
- 'notebook/js/menubar',
- 'notebook/js/notificationarea',
- 'notebook/js/savewidget',
- 'notebook/js/actions',
- 'notebook/js/keyboardmanager',
- 'notebook/js/kernelselector',
- 'codemirror/lib/codemirror',
- 'notebook/js/about',
- 'notebook/js/searchandreplace',
- 'notebook/js/clipboard',
- 'bidi/bidi',
- 'notebook/js/celltoolbarpresets/tags',
- 'custom-preload'
- ], function(
- $,
- contents_service,
- IPython,
- notebook,
- configmod,
- utils,
- page,
- events,
- promises,
- loginwidget,
- maintoolbar,
- pager,
- nb_promises,
- quickhelp,
- menubar,
- notificationarea,
- savewidget,
- actions,
- keyboardmanager,
- kernelselector,
- CodeMirror,
- about,
- searchandreplace,
- clipboard,
- bidi
- ) {
- "use strict";
- // Pull typeahead from the global jquery object
- var typeahead = $.typeahead;
-
- try{
- requirejs(['custom/custom'], function() {});
- bidi.loadLocale();
- } catch(err) {
- console.log("Error processing custom.js. Logging and continuing");
- console.warn(err);
- }
- // compat with old IPython, remove for IPython > 3.0
- window.CodeMirror = CodeMirror;
- // Setup all of the config related things
-
- var common_options = {
- ws_url : utils.get_body_data("wsUrl"),
- base_url : utils.get_body_data("baseUrl"),
- nbclassic_path: document.nbclassicPath || "",
- notebook_path : utils.get_body_data("notebookPath"),
- notebook_name : utils.get_body_data('notebookName')
- };
- var config_section = new configmod.ConfigSection('notebook', common_options);
- config_section.load();
- var common_config = new configmod.ConfigSection('common', common_options);
- common_config.load();
- // Instantiate the main objects
-
- var page = new page.Page('div#header', 'div#site');
- var pager = new pager.Pager('div#pager', {
- events: events});
- var acts = new actions.init();
- var keyboard_manager = new keyboardmanager.KeyboardManager({
- pager: pager,
- events: events,
- actions: acts,
- config: config_section,
- });
- var save_widget = new savewidget.SaveWidget('span#save_widget', {
- events: events,
- keyboard_manager: keyboard_manager});
- acts.extend_env({save_widget:save_widget});
- var contents = new contents_service.Contents({
- base_url: common_options.base_url,
- common_config: common_config
- });
- var notebook = new notebook.Notebook('div#notebook', $.extend({
- events: events,
- keyboard_manager: keyboard_manager,
- save_widget: save_widget,
- contents: contents,
- config: config_section},
- common_options));
- var login_widget = new loginwidget.LoginWidget('span#login_widget', common_options);
- var toolbar = new maintoolbar.MainToolBar('#maintoolbar-container', {
- notebook: notebook,
- events: events,
- actions: acts});
- var quick_help = new quickhelp.QuickHelp({
- keyboard_manager: keyboard_manager,
- events: events,
- notebook: notebook});
- keyboard_manager.set_notebook(notebook);
- keyboard_manager.set_quickhelp(quick_help);
- var menubar = new menubar.MenuBar('#menubar', $.extend({
- notebook: notebook,
- contents: contents,
- events: events,
- save_widget: save_widget,
- quick_help: quick_help,
- actions: acts,
- config: config_section},
- common_options));
- var notification_area = new notificationarea.NotebookNotificationArea(
- '#notification_area', {
- events: events,
- save_widget: save_widget,
- notebook: notebook,
- keyboard_manager: keyboard_manager});
- notification_area.init_notification_widgets();
- var kernel_selector = new kernelselector.KernelSelector(
- '#kernel_logo_widget', notebook, common_options);
- searchandreplace.load(keyboard_manager);
- $('body').append('<div id="fonttest"><pre><span id="test1">x</span>'+
- '<span id="test2" style="font-weight: bold;">x</span>'+
- '<span id="test3" style="font-style: italic;">x</span></pre></div>');
- var nh = $('#test1').innerHeight();
- var bh = $('#test2').innerHeight();
- var ih = $('#test3').innerHeight();
- if(nh != bh || nh != ih) {
- $('head').append('<style>.CodeMirror span { vertical-align: bottom; }</style>');
- }
- $('#fonttest').remove();
- page.show();
- events.one('notebook_loaded.Notebook', function () {
- var hash = document.location.hash;
- if (hash) {
- document.location.hash = '';
- document.location.hash = hash;
- }
- notebook.set_autosave_interval(notebook.minimum_autosave_interval);
- });
- IPython.page = page;
- IPython.notebook = notebook;
- IPython.contents = contents;
- IPython.pager = pager;
- IPython.quick_help = quick_help;
- IPython.login_widget = login_widget;
- IPython.menubar = menubar;
- IPython.toolbar = toolbar;
- IPython.notification_area = notification_area;
- IPython.keyboard_manager = keyboard_manager;
- IPython.save_widget = save_widget;
- IPython.tooltip = notebook.tooltip;
- try {
- events.trigger('app_initialized.NotebookApp');
- } catch (e) {
- console.error("Error in app_initialized callback", e);
- }
- Object.defineProperty( IPython, 'actions', {
- get: function() {
- console.warn('accessing "actions" on the global IPython/Jupyter is not recommended. Pass it to your objects constructors at creation time');
- return acts;
- },
- enumerable: true,
- configurable: false
- });
- clipboard.setup_clipboard_events();
-
- // Now actually load nbextensionsload_extensions_from_config
- Promise.all([
- utils.load_extensions_from_config(config_section),
- utils.load_extensions_from_config(common_config),
- ])
- .catch(function(error) {
- console.error('Could not load nbextensions from user config files', error);
- })
- // BEGIN HARDCODED WIDGETS HACK
- .then(function() {
- if (!utils.is_loaded('jupyter-js-widgets/extension')) {
- // Fallback to the ipywidgets extension
- utils.load_extension('widgets/notebook/js/extension').catch(function () {
- console.warn('Widgets are not available. Please install widgetsnbextension or ipywidgets 4.0');
- });
- }
- })
- .catch(function(error) {
- console.error('Could not load ipywidgets', error);
- });
- // END HARDCODED WIDGETS HACK
- notebook.load_notebook(common_options.notebook_path);
- });
- define("notebook/js/main", function(){});
- //# sourceMappingURL=main.min.js.map
|