123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279 |
- // IMPORTANT: the original ace.js file must be encapsulated in
- // (function(require,define,requirejs) { ...})(undefined,undefined,undefined);
- (function(require,define,requirejs) {
-
- /* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (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.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is Ajax.org Code Editor (ACE).
- *
- * The Initial Developer of the Original Code is
- * Ajax.org B.V.
- * Portions created by the Initial Developer are Copyright (C) 2010
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- * Fabian Jakobs <fabian AT ajax DOT org>
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * use your version of this file under the terms of the MPL, indicate your
- * decision by deleting the provisions above and replace them with the notice
- * and other provisions required by the GPL or the LGPL. If you do not delete
- * the provisions above, a recipient may use your version of this file under
- * the terms of any one of the MPL, the GPL or the LGPL.
- *
- * ***** END LICENSE BLOCK ***** */
-
- /**
- * Define a module along with a payload
- * @param module a name for the payload
- * @param payload a function to call with (require, exports, module) params
- */
-
- (function() {
-
- var ACE_NAMESPACE = "ace";
-
- var global = (function() {
- return this;
- })();
-
- var _define = function(module, deps, payload) {
- if (typeof module !== 'string') {
- if (_define.original)
- _define.original.apply(window, arguments);
- else {
- console.error('dropping module because define wasn\'t a string.');
- console.trace();
- }
- return;
- }
-
- if (arguments.length == 2)
- payload = deps;
-
- if (!_define.modules)
- _define.modules = {};
-
- _define.modules[module] = payload;
- };
- var _require = function(parentId, module, callback) {
- if (Object.prototype.toString.call(module) === "[object Array]") {
- var params = [];
- for (var i = 0, l = module.length; i < l; ++i) {
- var dep = lookup(parentId, module[i]);
- if (!dep && _require.original)
- return _require.original.apply(window, arguments);
- params.push(dep);
- }
- if (callback) {
- callback.apply(null, params);
- }
- }
- else if (typeof module === 'string') {
- var payload = lookup(parentId, module);
- if (!payload && _require.original)
- return _require.original.apply(window, arguments);
-
- if (callback) {
- callback();
- }
-
- return payload;
- }
- else {
- if (_require.original)
- return _require.original.apply(window, arguments);
- }
- };
-
- var normalizeModule = function(parentId, moduleName) {
- // normalize plugin requires
- if (moduleName.indexOf("!") !== -1) {
- var chunks = moduleName.split("!");
- return normalizeModule(parentId, chunks[0]) + "!" + normalizeModule(parentId, chunks[1]);
- }
- // normalize relative requires
- if (moduleName.charAt(0) == ".") {
- var base = parentId.split("/").slice(0, -1).join("/");
- moduleName = base + "/" + moduleName;
-
- while(moduleName.indexOf(".") !== -1 && previous != moduleName) {
- var previous = moduleName;
- moduleName = moduleName.replace(/\/\.\//, "/").replace(/[^\/]+\/\.\.\//, "");
- }
- }
-
- return moduleName;
- };
- var lookup = function(parentId, moduleName) {
-
- moduleName = normalizeModule(parentId, moduleName);
-
- var module = _define.modules[moduleName];
- if (!module) {
- return null;
- }
-
- if (typeof module === 'function') {
- var exports = {};
- var mod = {
- id: moduleName,
- uri: '',
- exports: exports,
- packaged: true
- };
-
- var req = function(module, callback) {
- return _require(moduleName, module, callback);
- };
-
- var returnValue = module(req, exports, mod);
- exports = returnValue || mod.exports;
-
- // cache the resulting module object for next time
- _define.modules[moduleName] = exports;
- return exports;
- }
-
- return module;
- };
-
- function exportAce(ns) {
-
- if (typeof requirejs !== "undefined") {
-
- var define = global.define;
- global.define = function(id, deps, callback) {
- if (typeof callback !== "function")
- return define.apply(this, arguments);
-
- return ace.define(id, deps, function(require, exports, module) {
- if (deps[2] == "module")
- module.packaged = true;
- return callback.apply(this, arguments);
- });
- };
- global.define.packaged = true;
-
- return;
- }
-
- var require = function(module, callback) {
- return _require("", module, callback);
- };
- require.packaged = true;
-
- var root = global;
- if (ns) {
- if (!global[ns])
- global[ns] = {};
- root = global[ns];
- }
-
- if (root.define)
- _define.original = root.define;
-
- root.define = _define;
-
- if (root.require)
- _require.original = root.require;
-
- root.require = require;
- }
-
- exportAce(ACE_NAMESPACE);
-
- })();
-
- /**
- * class Ace
- *
- * The main class required to set up an Ace instance in the browser.
- *
- *
- **/
-
- ace.define('ace/ace', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/dom', 'ace/lib/event', 'ace/editor', 'ace/edit_session', 'ace/undomanager', 'ace/virtual_renderer', 'ace/multi_select', 'ace/worker/worker_client', 'ace/keyboard/hash_handler', 'ace/keyboard/state_handler', 'ace/placeholder', 'ace/config', 'ace/theme/textmate'], function(require, exports, module) {
-
-
- require("./lib/fixoldbrowsers");
-
- var Dom = require("./lib/dom");
- var Event = require("./lib/event");
-
- var Editor = require("./editor").Editor;
- var EditSession = require("./edit_session").EditSession;
- var UndoManager = require("./undomanager").UndoManager;
- var Renderer = require("./virtual_renderer").VirtualRenderer;
- var MultiSelect = require("./multi_select").MultiSelect;
-
- // The following require()s are for inclusion in the built ace file
- require("./worker/worker_client");
- require("./keyboard/hash_handler");
- require("./keyboard/state_handler");
- require("./placeholder");
- exports.config = require("./config");
- exports.edit = function(el) {
- if (typeof(el) == "string") {
- el = document.getElementById(el);
- }
-
- if (el.env && el.env.editor instanceof Editor)
- return el.env.editor;
-
- var doc = new EditSession(Dom.getInnerText(el));
- doc.setUndoManager(new UndoManager());
- el.innerHTML = '';
-
- var editor = new Editor(new Renderer(el, require("./theme/textmate")));
- new MultiSelect(editor);
- editor.setSession(doc);
-
- var env = {};
- env.document = doc;
- env.editor = editor;
- editor.resize();
- Event.addListener(window, "resize", function() {
- editor.resize();
- });
- el.env = env;
- // Store env on editor such that it can be accessed later on from
- // the returned object.
- editor.env = env;
- return editor;
- };
-
- });
- // vim:set ts=4 sts=4 sw=4 st:
- // -- kriskowal Kris Kowal Copyright (C) 2009-2010 MIT License
- // -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
- // -- dantman Daniel Friesen Copyright(C) 2010 XXX No License Specified
- // -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
- // -- Irakli Gozalishvili Copyright (C) 2010 MIT License
-
- /*!
- Copyright (c) 2009, 280 North Inc. http://280north.com/
- MIT License. http://github.com/280north/narwhal/blob/master/README.md
- */
-
- ace.define('ace/lib/fixoldbrowsers', ['require', 'exports', 'module' , 'ace/lib/regexp', 'ace/lib/es5-shim'], function(require, exports, module) {
-
-
- require("./regexp");
- require("./es5-shim");
-
- });
-
- ace.define('ace/lib/regexp', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- //---------------------------------
- // Private variables
- //---------------------------------
-
- var real = {
- exec: RegExp.prototype.exec,
- test: RegExp.prototype.test,
- match: String.prototype.match,
- replace: String.prototype.replace,
- split: String.prototype.split
- },
- compliantExecNpcg = real.exec.call(/()??/, "")[1] === undefined, // check `exec` handling of nonparticipating capturing groups
- compliantLastIndexIncrement = function () {
- var x = /^/g;
- real.test.call(x, "");
- return !x.lastIndex;
- }();
-
- if (compliantLastIndexIncrement && compliantExecNpcg)
- return;
-
- //---------------------------------
- // Overriden native methods
- //---------------------------------
-
- // Adds named capture support (with backreferences returned as `result.name`), and fixes two
- // cross-browser issues per ES3:
- // - Captured values for nonparticipating capturing groups should be returned as `undefined`,
- // rather than the empty string.
- // - `lastIndex` should not be incremented after zero-length matches.
- RegExp.prototype.exec = function (str) {
- var match = real.exec.apply(this, arguments),
- name, r2;
- if ( typeof(str) == 'string' && match) {
- // Fix browsers whose `exec` methods don't consistently return `undefined` for
- // nonparticipating capturing groups
- if (!compliantExecNpcg && match.length > 1 && indexOf(match, "") > -1) {
- r2 = RegExp(this.source, real.replace.call(getNativeFlags(this), "g", ""));
- // Using `str.slice(match.index)` rather than `match[0]` in case lookahead allowed
- // matching due to characters outside the match
- real.replace.call(str.slice(match.index), r2, function () {
- for (var i = 1; i < arguments.length - 2; i++) {
- if (arguments[i] === undefined)
- match[i] = undefined;
- }
- });
- }
- // Attach named capture properties
- if (this._xregexp && this._xregexp.captureNames) {
- for (var i = 1; i < match.length; i++) {
- name = this._xregexp.captureNames[i - 1];
- if (name)
- match[name] = match[i];
- }
- }
- // Fix browsers that increment `lastIndex` after zero-length matches
- if (!compliantLastIndexIncrement && this.global && !match[0].length && (this.lastIndex > match.index))
- this.lastIndex--;
- }
- return match;
- };
-
- // Don't override `test` if it won't change anything
- if (!compliantLastIndexIncrement) {
- // Fix browser bug in native method
- RegExp.prototype.test = function (str) {
- // Use the native `exec` to skip some processing overhead, even though the overriden
- // `exec` would take care of the `lastIndex` fix
- var match = real.exec.call(this, str);
- // Fix browsers that increment `lastIndex` after zero-length matches
- if (match && this.global && !match[0].length && (this.lastIndex > match.index))
- this.lastIndex--;
- return !!match;
- };
- }
-
- //---------------------------------
- // Private helper functions
- //---------------------------------
-
- function getNativeFlags (regex) {
- return (regex.global ? "g" : "") +
- (regex.ignoreCase ? "i" : "") +
- (regex.multiline ? "m" : "") +
- (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
- (regex.sticky ? "y" : "");
- };
-
- function indexOf (array, item, from) {
- if (Array.prototype.indexOf) // Use the native array method if available
- return array.indexOf(item, from);
- for (var i = from || 0; i < array.length; i++) {
- if (array[i] === item)
- return i;
- }
- return -1;
- };
-
- });
- // vim: ts=4 sts=4 sw=4 expandtab
- // -- kriskowal Kris Kowal Copyright (C) 2009-2011 MIT License
- // -- tlrobinson Tom Robinson Copyright (C) 2009-2010 MIT License (Narwhal Project)
- // -- dantman Daniel Friesen Copyright (C) 2010 XXX TODO License or CLA
- // -- fschaefer Florian Schäfer Copyright (C) 2010 MIT License
- // -- Gozala Irakli Gozalishvili Copyright (C) 2010 MIT License
- // -- kitcambridge Kit Cambridge Copyright (C) 2011 MIT License
- // -- kossnocorp Sasha Koss XXX TODO License or CLA
- // -- bryanforbes Bryan Forbes XXX TODO License or CLA
- // -- killdream Quildreen Motta Copyright (C) 2011 MIT Licence
- // -- michaelficarra Michael Ficarra Copyright (C) 2011 3-clause BSD License
- // -- sharkbrainguy Gerard Paapu Copyright (C) 2011 MIT License
- // -- bbqsrc Brendan Molloy (C) 2011 Creative Commons Zero (public domain)
- // -- iwyg XXX TODO License or CLA
- // -- DomenicDenicola Domenic Denicola Copyright (C) 2011 MIT License
- // -- xavierm02 Montillet Xavier XXX TODO License or CLA
- // -- Raynos Raynos XXX TODO License or CLA
- // -- samsonjs Sami Samhuri Copyright (C) 2010 MIT License
- // -- rwldrn Rick Waldron Copyright (C) 2011 MIT License
- // -- lexer Alexey Zakharov XXX TODO License or CLA
-
- /*!
- Copyright (c) 2009, 280 North Inc. http://280north.com/
- MIT License. http://github.com/280north/narwhal/blob/master/README.md
- */
-
- ace.define('ace/lib/es5-shim', ['require', 'exports', 'module' ], function(require, exports, module) {
-
- /*
- * Brings an environment as close to ECMAScript 5 compliance
- * as is possible with the facilities of erstwhile engines.
- *
- * Annotated ES5: http://es5.github.com/ (specific links below)
- * ES5 Spec: http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pdf
- *
- * @module
- */
-
- /*whatsupdoc*/
-
- //
- // Function
- // ========
- //
-
- // ES-5 15.3.4.5
- // http://es5.github.com/#x15.3.4.5
-
- if (!Function.prototype.bind) {
- Function.prototype.bind = function bind(that) { // .length is 1
- // 1. Let Target be the this value.
- var target = this;
- // 2. If IsCallable(Target) is false, throw a TypeError exception.
- if (typeof target != "function")
- throw new TypeError(); // TODO message
- // 3. Let A be a new (possibly empty) internal list of all of the
- // argument values provided after thisArg (arg1, arg2 etc), in order.
- // XXX slicedArgs will stand in for "A" if used
- var args = slice.call(arguments, 1); // for normal call
- // 4. Let F be a new native ECMAScript object.
- // 11. Set the [[Prototype]] internal property of F to the standard
- // built-in Function prototype object as specified in 15.3.3.1.
- // 12. Set the [[Call]] internal property of F as described in
- // 15.3.4.5.1.
- // 13. Set the [[Construct]] internal property of F as described in
- // 15.3.4.5.2.
- // 14. Set the [[HasInstance]] internal property of F as described in
- // 15.3.4.5.3.
- var bound = function () {
-
- if (this instanceof bound) {
- // 15.3.4.5.2 [[Construct]]
- // When the [[Construct]] internal method of a function object,
- // F that was created using the bind function is called with a
- // list of arguments ExtraArgs, the following steps are taken:
- // 1. Let target be the value of F's [[TargetFunction]]
- // internal property.
- // 2. If target has no [[Construct]] internal method, a
- // TypeError exception is thrown.
- // 3. Let boundArgs be the value of F's [[BoundArgs]] internal
- // property.
- // 4. Let args be a new list containing the same values as the
- // list boundArgs in the same order followed by the same
- // values as the list ExtraArgs in the same order.
- // 5. Return the result of calling the [[Construct]] internal
- // method of target providing args as the arguments.
-
- var F = function(){};
- F.prototype = target.prototype;
- var self = new F;
-
- var result = target.apply(
- self,
- args.concat(slice.call(arguments))
- );
- if (result !== null && Object(result) === result)
- return result;
- return self;
-
- } else {
- // 15.3.4.5.1 [[Call]]
- // When the [[Call]] internal method of a function object, F,
- // which was created using the bind function is called with a
- // this value and a list of arguments ExtraArgs, the following
- // steps are taken:
- // 1. Let boundArgs be the value of F's [[BoundArgs]] internal
- // property.
- // 2. Let boundThis be the value of F's [[BoundThis]] internal
- // property.
- // 3. Let target be the value of F's [[TargetFunction]] internal
- // property.
- // 4. Let args be a new list containing the same values as the
- // list boundArgs in the same order followed by the same
- // values as the list ExtraArgs in the same order.
- // 5. Return the result of calling the [[Call]] internal method
- // of target providing boundThis as the this value and
- // providing args as the arguments.
-
- // equiv: target.call(this, ...boundArgs, ...args)
- return target.apply(
- that,
- args.concat(slice.call(arguments))
- );
-
- }
-
- };
- // XXX bound.length is never writable, so don't even try
- //
- // 15. If the [[Class]] internal property of Target is "Function", then
- // a. Let L be the length property of Target minus the length of A.
- // b. Set the length own property of F to either 0 or L, whichever is
- // larger.
- // 16. Else set the length own property of F to 0.
- // 17. Set the attributes of the length own property of F to the values
- // specified in 15.3.5.1.
-
- // TODO
- // 18. Set the [[Extensible]] internal property of F to true.
-
- // TODO
- // 19. Let thrower be the [[ThrowTypeError]] function Object (13.2.3).
- // 20. Call the [[DefineOwnProperty]] internal method of F with
- // arguments "caller", PropertyDescriptor {[[Get]]: thrower, [[Set]]:
- // thrower, [[Enumerable]]: false, [[Configurable]]: false}, and
- // false.
- // 21. Call the [[DefineOwnProperty]] internal method of F with
- // arguments "arguments", PropertyDescriptor {[[Get]]: thrower,
- // [[Set]]: thrower, [[Enumerable]]: false, [[Configurable]]: false},
- // and false.
-
- // TODO
- // NOTE Function objects created using Function.prototype.bind do not
- // have a prototype property or the [[Code]], [[FormalParameters]], and
- // [[Scope]] internal properties.
- // XXX can't delete prototype in pure-js.
-
- // 22. Return F.
- return bound;
- };
- }
-
- // Shortcut to an often accessed properties, in order to avoid multiple
- // dereference that costs universally.
- // _Please note: Shortcuts are defined after `Function.prototype.bind` as we
- // us it in defining shortcuts.
- var call = Function.prototype.call;
- var prototypeOfArray = Array.prototype;
- var prototypeOfObject = Object.prototype;
- var slice = prototypeOfArray.slice;
- var toString = call.bind(prototypeOfObject.toString);
- var owns = call.bind(prototypeOfObject.hasOwnProperty);
-
- // If JS engine supports accessors creating shortcuts.
- var defineGetter;
- var defineSetter;
- var lookupGetter;
- var lookupSetter;
- var supportsAccessors;
- if ((supportsAccessors = owns(prototypeOfObject, "__defineGetter__"))) {
- defineGetter = call.bind(prototypeOfObject.__defineGetter__);
- defineSetter = call.bind(prototypeOfObject.__defineSetter__);
- lookupGetter = call.bind(prototypeOfObject.__lookupGetter__);
- lookupSetter = call.bind(prototypeOfObject.__lookupSetter__);
- }
-
- //
- // Array
- // =====
- //
-
- // ES5 15.4.3.2
- // http://es5.github.com/#x15.4.3.2
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/isArray
- if (!Array.isArray) {
- Array.isArray = function isArray(obj) {
- return toString(obj) == "[object Array]";
- };
- }
-
- // The IsCallable() check in the Array functions
- // has been replaced with a strict check on the
- // internal class of the object to trap cases where
- // the provided function was actually a regular
- // expression literal, which in V8 and
- // JavaScriptCore is a typeof "function". Only in
- // V8 are regular expression literals permitted as
- // reduce parameters, so it is desirable in the
- // general case for the shim to match the more
- // strict and common behavior of rejecting regular
- // expressions.
-
- // ES5 15.4.4.18
- // http://es5.github.com/#x15.4.4.18
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/array/forEach
- if (!Array.prototype.forEach) {
- Array.prototype.forEach = function forEach(fun /*, thisp*/) {
- var self = toObject(this),
- thisp = arguments[1],
- i = 0,
- length = self.length >>> 0;
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- while (i < length) {
- if (i in self) {
- // Invoke the callback function with call, passing arguments:
- // context, property value, property key, thisArg object context
- fun.call(thisp, self[i], i, self);
- }
- i++;
- }
- };
- }
-
- // ES5 15.4.4.19
- // http://es5.github.com/#x15.4.4.19
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/map
- if (!Array.prototype.map) {
- Array.prototype.map = function map(fun /*, thisp*/) {
- var self = toObject(this),
- length = self.length >>> 0,
- result = Array(length),
- thisp = arguments[1];
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- for (var i = 0; i < length; i++) {
- if (i in self)
- result[i] = fun.call(thisp, self[i], i, self);
- }
- return result;
- };
- }
-
- // ES5 15.4.4.20
- // http://es5.github.com/#x15.4.4.20
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/filter
- if (!Array.prototype.filter) {
- Array.prototype.filter = function filter(fun /*, thisp */) {
- var self = toObject(this),
- length = self.length >>> 0,
- result = [],
- thisp = arguments[1];
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- for (var i = 0; i < length; i++) {
- if (i in self && fun.call(thisp, self[i], i, self))
- result.push(self[i]);
- }
- return result;
- };
- }
-
- // ES5 15.4.4.16
- // http://es5.github.com/#x15.4.4.16
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/every
- if (!Array.prototype.every) {
- Array.prototype.every = function every(fun /*, thisp */) {
- var self = toObject(this),
- length = self.length >>> 0,
- thisp = arguments[1];
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- for (var i = 0; i < length; i++) {
- if (i in self && !fun.call(thisp, self[i], i, self))
- return false;
- }
- return true;
- };
- }
-
- // ES5 15.4.4.17
- // http://es5.github.com/#x15.4.4.17
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/some
- if (!Array.prototype.some) {
- Array.prototype.some = function some(fun /*, thisp */) {
- var self = toObject(this),
- length = self.length >>> 0,
- thisp = arguments[1];
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- for (var i = 0; i < length; i++) {
- if (i in self && fun.call(thisp, self[i], i, self))
- return true;
- }
- return false;
- };
- }
-
- // ES5 15.4.4.21
- // http://es5.github.com/#x15.4.4.21
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduce
- if (!Array.prototype.reduce) {
- Array.prototype.reduce = function reduce(fun /*, initial*/) {
- var self = toObject(this),
- length = self.length >>> 0;
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- // no value to return if no initial value and an empty array
- if (!length && arguments.length == 1)
- throw new TypeError(); // TODO message
-
- var i = 0;
- var result;
- if (arguments.length >= 2) {
- result = arguments[1];
- } else {
- do {
- if (i in self) {
- result = self[i++];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (++i >= length)
- throw new TypeError(); // TODO message
- } while (true);
- }
-
- for (; i < length; i++) {
- if (i in self)
- result = fun.call(void 0, result, self[i], i, self);
- }
-
- return result;
- };
- }
-
- // ES5 15.4.4.22
- // http://es5.github.com/#x15.4.4.22
- // https://developer.mozilla.org/en/Core_JavaScript_1.5_Reference/Objects/Array/reduceRight
- if (!Array.prototype.reduceRight) {
- Array.prototype.reduceRight = function reduceRight(fun /*, initial*/) {
- var self = toObject(this),
- length = self.length >>> 0;
-
- // If no callback function or if callback is not a callable function
- if (toString(fun) != "[object Function]") {
- throw new TypeError(); // TODO message
- }
-
- // no value to return if no initial value, empty array
- if (!length && arguments.length == 1)
- throw new TypeError(); // TODO message
-
- var result, i = length - 1;
- if (arguments.length >= 2) {
- result = arguments[1];
- } else {
- do {
- if (i in self) {
- result = self[i--];
- break;
- }
-
- // if array contains no values, no initial value to return
- if (--i < 0)
- throw new TypeError(); // TODO message
- } while (true);
- }
-
- do {
- if (i in this)
- result = fun.call(void 0, result, self[i], i, self);
- } while (i--);
-
- return result;
- };
- }
-
- // ES5 15.4.4.14
- // http://es5.github.com/#x15.4.4.14
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/indexOf
- if (!Array.prototype.indexOf) {
- Array.prototype.indexOf = function indexOf(sought /*, fromIndex */ ) {
- var self = toObject(this),
- length = self.length >>> 0;
-
- if (!length)
- return -1;
-
- var i = 0;
- if (arguments.length > 1)
- i = toInteger(arguments[1]);
-
- // handle negative indices
- i = i >= 0 ? i : Math.max(0, length + i);
- for (; i < length; i++) {
- if (i in self && self[i] === sought) {
- return i;
- }
- }
- return -1;
- };
- }
-
- // ES5 15.4.4.15
- // http://es5.github.com/#x15.4.4.15
- // https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Array/lastIndexOf
- if (!Array.prototype.lastIndexOf) {
- Array.prototype.lastIndexOf = function lastIndexOf(sought /*, fromIndex */) {
- var self = toObject(this),
- length = self.length >>> 0;
-
- if (!length)
- return -1;
- var i = length - 1;
- if (arguments.length > 1)
- i = Math.min(i, toInteger(arguments[1]));
- // handle negative indices
- i = i >= 0 ? i : length - Math.abs(i);
- for (; i >= 0; i--) {
- if (i in self && sought === self[i])
- return i;
- }
- return -1;
- };
- }
-
- //
- // Object
- // ======
- //
-
- // ES5 15.2.3.2
- // http://es5.github.com/#x15.2.3.2
- if (!Object.getPrototypeOf) {
- // https://github.com/kriskowal/es5-shim/issues#issue/2
- // http://ejohn.org/blog/objectgetprototypeof/
- // recommended by fschaefer on github
- Object.getPrototypeOf = function getPrototypeOf(object) {
- return object.__proto__ || (
- object.constructor ?
- object.constructor.prototype :
- prototypeOfObject
- );
- };
- }
-
- // ES5 15.2.3.3
- // http://es5.github.com/#x15.2.3.3
- if (!Object.getOwnPropertyDescriptor) {
- var ERR_NON_OBJECT = "Object.getOwnPropertyDescriptor called on a " +
- "non-object: ";
- Object.getOwnPropertyDescriptor = function getOwnPropertyDescriptor(object, property) {
- if ((typeof object != "object" && typeof object != "function") || object === null)
- throw new TypeError(ERR_NON_OBJECT + object);
- // If object does not owns property return undefined immediately.
- if (!owns(object, property))
- return;
-
- var descriptor, getter, setter;
-
- // If object has a property then it's for sure both `enumerable` and
- // `configurable`.
- descriptor = { enumerable: true, configurable: true };
-
- // If JS engine supports accessor properties then property may be a
- // getter or setter.
- if (supportsAccessors) {
- // Unfortunately `__lookupGetter__` will return a getter even
- // if object has own non getter property along with a same named
- // inherited getter. To avoid misbehavior we temporary remove
- // `__proto__` so that `__lookupGetter__` will return getter only
- // if it's owned by an object.
- var prototype = object.__proto__;
- object.__proto__ = prototypeOfObject;
-
- var getter = lookupGetter(object, property);
- var setter = lookupSetter(object, property);
-
- // Once we have getter and setter we can put values back.
- object.__proto__ = prototype;
-
- if (getter || setter) {
- if (getter) descriptor.get = getter;
- if (setter) descriptor.set = setter;
-
- // If it was accessor property we're done and return here
- // in order to avoid adding `value` to the descriptor.
- return descriptor;
- }
- }
-
- // If we got this far we know that object has an own property that is
- // not an accessor so we set it as a value and return descriptor.
- descriptor.value = object[property];
- return descriptor;
- };
- }
-
- // ES5 15.2.3.4
- // http://es5.github.com/#x15.2.3.4
- if (!Object.getOwnPropertyNames) {
- Object.getOwnPropertyNames = function getOwnPropertyNames(object) {
- return Object.keys(object);
- };
- }
-
- // ES5 15.2.3.5
- // http://es5.github.com/#x15.2.3.5
- if (!Object.create) {
- Object.create = function create(prototype, properties) {
- var object;
- if (prototype === null) {
- object = { "__proto__": null };
- } else {
- if (typeof prototype != "object")
- throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
- var Type = function () {};
- Type.prototype = prototype;
- object = new Type();
- // IE has no built-in implementation of `Object.getPrototypeOf`
- // neither `__proto__`, but this manually setting `__proto__` will
- // guarantee that `Object.getPrototypeOf` will work as expected with
- // objects created using `Object.create`
- object.__proto__ = prototype;
- }
- if (properties !== void 0)
- Object.defineProperties(object, properties);
- return object;
- };
- }
-
- // ES5 15.2.3.6
- // http://es5.github.com/#x15.2.3.6
-
- // Patch for WebKit and IE8 standard mode
- // Designed by hax <hax.github.com>
- // related issue: https://github.com/kriskowal/es5-shim/issues#issue/5
- // IE8 Reference:
- // http://msdn.microsoft.com/en-us/library/dd282900.aspx
- // http://msdn.microsoft.com/en-us/library/dd229916.aspx
- // WebKit Bugs:
- // https://bugs.webkit.org/show_bug.cgi?id=36423
-
- function doesDefinePropertyWork(object) {
- try {
- Object.defineProperty(object, "sentinel", {});
- return "sentinel" in object;
- } catch (exception) {
- // returns falsy
- }
- }
-
- // check whether defineProperty works if it's given. Otherwise,
- // shim partially.
- if (Object.defineProperty) {
- var definePropertyWorksOnObject = doesDefinePropertyWork({});
- var definePropertyWorksOnDom = typeof document == "undefined" ||
- doesDefinePropertyWork(document.createElement("div"));
- if (!definePropertyWorksOnObject || !definePropertyWorksOnDom) {
- var definePropertyFallback = Object.defineProperty;
- }
- }
-
- if (!Object.defineProperty || definePropertyFallback) {
- var ERR_NON_OBJECT_DESCRIPTOR = "Property description must be an object: ";
- var ERR_NON_OBJECT_TARGET = "Object.defineProperty called on non-object: "
- var ERR_ACCESSORS_NOT_SUPPORTED = "getters & setters can not be defined " +
- "on this javascript engine";
-
- Object.defineProperty = function defineProperty(object, property, descriptor) {
- if ((typeof object != "object" && typeof object != "function") || object === null)
- throw new TypeError(ERR_NON_OBJECT_TARGET + object);
- if ((typeof descriptor != "object" && typeof descriptor != "function") || descriptor === null)
- throw new TypeError(ERR_NON_OBJECT_DESCRIPTOR + descriptor);
-
- // make a valiant attempt to use the real defineProperty
- // for I8's DOM elements.
- if (definePropertyFallback) {
- try {
- return definePropertyFallback.call(Object, object, property, descriptor);
- } catch (exception) {
- // try the shim if the real one doesn't work
- }
- }
-
- // If it's a data property.
- if (owns(descriptor, "value")) {
- // fail silently if "writable", "enumerable", or "configurable"
- // are requested but not supported
- /*
- // alternate approach:
- if ( // can't implement these features; allow false but not true
- !(owns(descriptor, "writable") ? descriptor.writable : true) ||
- !(owns(descriptor, "enumerable") ? descriptor.enumerable : true) ||
- !(owns(descriptor, "configurable") ? descriptor.configurable : true)
- )
- throw new RangeError(
- "This implementation of Object.defineProperty does not " +
- "support configurable, enumerable, or writable."
- );
- */
-
- if (supportsAccessors && (lookupGetter(object, property) ||
- lookupSetter(object, property)))
- {
- // As accessors are supported only on engines implementing
- // `__proto__` we can safely override `__proto__` while defining
- // a property to make sure that we don't hit an inherited
- // accessor.
- var prototype = object.__proto__;
- object.__proto__ = prototypeOfObject;
- // Deleting a property anyway since getter / setter may be
- // defined on object itself.
- delete object[property];
- object[property] = descriptor.value;
- // Setting original `__proto__` back now.
- object.__proto__ = prototype;
- } else {
- object[property] = descriptor.value;
- }
- } else {
- if (!supportsAccessors)
- throw new TypeError(ERR_ACCESSORS_NOT_SUPPORTED);
- // If we got that far then getters and setters can be defined !!
- if (owns(descriptor, "get"))
- defineGetter(object, property, descriptor.get);
- if (owns(descriptor, "set"))
- defineSetter(object, property, descriptor.set);
- }
-
- return object;
- };
- }
-
- // ES5 15.2.3.7
- // http://es5.github.com/#x15.2.3.7
- if (!Object.defineProperties) {
- Object.defineProperties = function defineProperties(object, properties) {
- for (var property in properties) {
- if (owns(properties, property))
- Object.defineProperty(object, property, properties[property]);
- }
- return object;
- };
- }
-
- // ES5 15.2.3.8
- // http://es5.github.com/#x15.2.3.8
- if (!Object.seal) {
- Object.seal = function seal(object) {
- // this is misleading and breaks feature-detection, but
- // allows "securable" code to "gracefully" degrade to working
- // but insecure code.
- return object;
- };
- }
-
- // ES5 15.2.3.9
- // http://es5.github.com/#x15.2.3.9
- if (!Object.freeze) {
- Object.freeze = function freeze(object) {
- // this is misleading and breaks feature-detection, but
- // allows "securable" code to "gracefully" degrade to working
- // but insecure code.
- return object;
- };
- }
-
- // detect a Rhino bug and patch it
- try {
- Object.freeze(function () {});
- } catch (exception) {
- Object.freeze = (function freeze(freezeObject) {
- return function freeze(object) {
- if (typeof object == "function") {
- return object;
- } else {
- return freezeObject(object);
- }
- };
- })(Object.freeze);
- }
-
- // ES5 15.2.3.10
- // http://es5.github.com/#x15.2.3.10
- if (!Object.preventExtensions) {
- Object.preventExtensions = function preventExtensions(object) {
- // this is misleading and breaks feature-detection, but
- // allows "securable" code to "gracefully" degrade to working
- // but insecure code.
- return object;
- };
- }
-
- // ES5 15.2.3.11
- // http://es5.github.com/#x15.2.3.11
- if (!Object.isSealed) {
- Object.isSealed = function isSealed(object) {
- return false;
- };
- }
-
- // ES5 15.2.3.12
- // http://es5.github.com/#x15.2.3.12
- if (!Object.isFrozen) {
- Object.isFrozen = function isFrozen(object) {
- return false;
- };
- }
-
- // ES5 15.2.3.13
- // http://es5.github.com/#x15.2.3.13
- if (!Object.isExtensible) {
- Object.isExtensible = function isExtensible(object) {
- // 1. If Type(O) is not Object throw a TypeError exception.
- if (Object(object) === object) {
- throw new TypeError(); // TODO message
- }
- // 2. Return the Boolean value of the [[Extensible]] internal property of O.
- var name = '';
- while (owns(object, name)) {
- name += '?';
- }
- object[name] = true;
- var returnValue = owns(object, name);
- delete object[name];
- return returnValue;
- };
- }
-
- // ES5 15.2.3.14
- // http://es5.github.com/#x15.2.3.14
- if (!Object.keys) {
- // http://whattheheadsaid.com/2010/10/a-safer-object-keys-compatibility-implementation
- var hasDontEnumBug = true,
- dontEnums = [
- "toString",
- "toLocaleString",
- "valueOf",
- "hasOwnProperty",
- "isPrototypeOf",
- "propertyIsEnumerable",
- "constructor"
- ],
- dontEnumsLength = dontEnums.length;
-
- for (var key in {"toString": null})
- hasDontEnumBug = false;
-
- Object.keys = function keys(object) {
-
- if ((typeof object != "object" && typeof object != "function") || object === null)
- throw new TypeError("Object.keys called on a non-object");
-
- var keys = [];
- for (var name in object) {
- if (owns(object, name)) {
- keys.push(name);
- }
- }
-
- if (hasDontEnumBug) {
- for (var i = 0, ii = dontEnumsLength; i < ii; i++) {
- var dontEnum = dontEnums[i];
- if (owns(object, dontEnum)) {
- keys.push(dontEnum);
- }
- }
- }
-
- return keys;
- };
-
- }
-
- //
- // Date
- // ====
- //
-
- // ES5 15.9.5.43
- // http://es5.github.com/#x15.9.5.43
- // This function returns a String value represent the instance in time
- // represented by this Date object. The format of the String is the Date Time
- // string format defined in 15.9.1.15. All fields are present in the String.
- // The time zone is always UTC, denoted by the suffix Z. If the time value of
- // this object is not a finite Number a RangeError exception is thrown.
- if (!Date.prototype.toISOString || (new Date(-62198755200000).toISOString().indexOf('-000001') === -1)) {
- Date.prototype.toISOString = function toISOString() {
- var result, length, value, year;
- if (!isFinite(this))
- throw new RangeError;
-
- // the date time string format is specified in 15.9.1.15.
- result = [this.getUTCMonth() + 1, this.getUTCDate(),
- this.getUTCHours(), this.getUTCMinutes(), this.getUTCSeconds()];
- year = this.getUTCFullYear();
- year = (year < 0 ? '-' : (year > 9999 ? '+' : '')) + ('00000' + Math.abs(year)).slice(0 <= year && year <= 9999 ? -4 : -6);
-
- length = result.length;
- while (length--) {
- value = result[length];
- // pad months, days, hours, minutes, and seconds to have two digits.
- if (value < 10)
- result[length] = "0" + value;
- }
- // pad milliseconds to have three digits.
- return year + "-" + result.slice(0, 2).join("-") + "T" + result.slice(2).join(":") + "." +
- ("000" + this.getUTCMilliseconds()).slice(-3) + "Z";
- }
- }
-
- // ES5 15.9.4.4
- // http://es5.github.com/#x15.9.4.4
- if (!Date.now) {
- Date.now = function now() {
- return new Date().getTime();
- };
- }
-
- // ES5 15.9.5.44
- // http://es5.github.com/#x15.9.5.44
- // This function provides a String representation of a Date object for use by
- // JSON.stringify (15.12.3).
- if (!Date.prototype.toJSON) {
- Date.prototype.toJSON = function toJSON(key) {
- // When the toJSON method is called with argument key, the following
- // steps are taken:
-
- // 1. Let O be the result of calling ToObject, giving it the this
- // value as its argument.
- // 2. Let tv be ToPrimitive(O, hint Number).
- // 3. If tv is a Number and is not finite, return null.
- // XXX
- // 4. Let toISO be the result of calling the [[Get]] internal method of
- // O with argument "toISOString".
- // 5. If IsCallable(toISO) is false, throw a TypeError exception.
- if (typeof this.toISOString != "function")
- throw new TypeError(); // TODO message
- // 6. Return the result of calling the [[Call]] internal method of
- // toISO with O as the this value and an empty argument list.
- return this.toISOString();
-
- // NOTE 1 The argument is ignored.
-
- // NOTE 2 The toJSON function is intentionally generic; it does not
- // require that its this value be a Date object. Therefore, it can be
- // transferred to other kinds of objects for use as a method. However,
- // it does require that any such object have a toISOString method. An
- // object is free to use the argument key to filter its
- // stringification.
- };
- }
-
- // ES5 15.9.4.2
- // http://es5.github.com/#x15.9.4.2
- // based on work shared by Daniel Friesen (dantman)
- // http://gist.github.com/303249
- if (Date.parse("+275760-09-13T00:00:00.000Z") !== 8.64e15) {
- // XXX global assignment won't work in embeddings that use
- // an alternate object for the context.
- Date = (function(NativeDate) {
-
- // Date.length === 7
- var Date = function Date(Y, M, D, h, m, s, ms) {
- var length = arguments.length;
- if (this instanceof NativeDate) {
- var date = length == 1 && String(Y) === Y ? // isString(Y)
- // We explicitly pass it through parse:
- new NativeDate(Date.parse(Y)) :
- // We have to manually make calls depending on argument
- // length here
- length >= 7 ? new NativeDate(Y, M, D, h, m, s, ms) :
- length >= 6 ? new NativeDate(Y, M, D, h, m, s) :
- length >= 5 ? new NativeDate(Y, M, D, h, m) :
- length >= 4 ? new NativeDate(Y, M, D, h) :
- length >= 3 ? new NativeDate(Y, M, D) :
- length >= 2 ? new NativeDate(Y, M) :
- length >= 1 ? new NativeDate(Y) :
- new NativeDate();
- // Prevent mixups with unfixed Date object
- date.constructor = Date;
- return date;
- }
- return NativeDate.apply(this, arguments);
- };
-
- // 15.9.1.15 Date Time String Format.
- var isoDateExpression = new RegExp("^" +
- "(\\d{4}|[\+\-]\\d{6})" + // four-digit year capture or sign + 6-digit extended year
- "(?:-(\\d{2})" + // optional month capture
- "(?:-(\\d{2})" + // optional day capture
- "(?:" + // capture hours:minutes:seconds.milliseconds
- "T(\\d{2})" + // hours capture
- ":(\\d{2})" + // minutes capture
- "(?:" + // optional :seconds.milliseconds
- ":(\\d{2})" + // seconds capture
- "(?:\\.(\\d{3}))?" + // milliseconds capture
- ")?" +
- "(?:" + // capture UTC offset component
- "Z|" + // UTC capture
- "(?:" + // offset specifier +/-hours:minutes
- "([-+])" + // sign capture
- "(\\d{2})" + // hours offset capture
- ":(\\d{2})" + // minutes offset capture
- ")" +
- ")?)?)?)?" +
- "$");
-
- // Copy any custom methods a 3rd party library may have added
- for (var key in NativeDate)
- Date[key] = NativeDate[key];
-
- // Copy "native" methods explicitly; they may be non-enumerable
- Date.now = NativeDate.now;
- Date.UTC = NativeDate.UTC;
- Date.prototype = NativeDate.prototype;
- Date.prototype.constructor = Date;
-
- // Upgrade Date.parse to handle simplified ISO 8601 strings
- Date.parse = function parse(string) {
- var match = isoDateExpression.exec(string);
- if (match) {
- match.shift(); // kill match[0], the full match
- // parse months, days, hours, minutes, seconds, and milliseconds
- for (var i = 1; i < 7; i++) {
- // provide default values if necessary
- match[i] = +(match[i] || (i < 3 ? 1 : 0));
- // match[1] is the month. Months are 0-11 in JavaScript
- // `Date` objects, but 1-12 in ISO notation, so we
- // decrement.
- if (i == 1)
- match[i]--;
- }
-
- // parse the UTC offset component
- var minuteOffset = +match.pop(), hourOffset = +match.pop(), sign = match.pop();
-
- // compute the explicit time zone offset if specified
- var offset = 0;
- if (sign) {
- // detect invalid offsets and return early
- if (hourOffset > 23 || minuteOffset > 59)
- return NaN;
-
- // express the provided time zone offset in minutes. The offset is
- // negative for time zones west of UTC; positive otherwise.
- offset = (hourOffset * 60 + minuteOffset) * 6e4 * (sign == "+" ? -1 : 1);
- }
-
- // Date.UTC for years between 0 and 99 converts year to 1900 + year
- // The Gregorian calendar has a 400-year cycle, so
- // to Date.UTC(year + 400, .... ) - 12622780800000 == Date.UTC(year, ...),
- // where 12622780800000 - number of milliseconds in Gregorian calendar 400 years
- var year = +match[0];
- if (0 <= year && year <= 99) {
- match[0] = year + 400;
- return NativeDate.UTC.apply(this, match) + offset - 12622780800000;
- }
-
- // compute a new UTC date value, accounting for the optional offset
- return NativeDate.UTC.apply(this, match) + offset;
- }
- return NativeDate.parse.apply(this, arguments);
- };
-
- return Date;
- })(Date);
- }
-
- //
- // String
- // ======
- //
-
- // ES5 15.5.4.20
- // http://es5.github.com/#x15.5.4.20
- var ws = "\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003" +
- "\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028" +
- "\u2029\uFEFF";
- if (!String.prototype.trim || ws.trim()) {
- // http://blog.stevenlevithan.com/archives/faster-trim-javascript
- // http://perfectionkills.com/whitespace-deviations/
- ws = "[" + ws + "]";
- var trimBeginRegexp = new RegExp("^" + ws + ws + "*"),
- trimEndRegexp = new RegExp(ws + ws + "*$");
- String.prototype.trim = function trim() {
- return String(this).replace(trimBeginRegexp, "").replace(trimEndRegexp, "");
- };
- }
-
- //
- // Util
- // ======
- //
-
- // ES5 9.4
- // http://es5.github.com/#x9.4
- // http://jsperf.com/to-integer
- var toInteger = function (n) {
- n = +n;
- if (n !== n) // isNaN
- n = 0;
- else if (n !== 0 && n !== (1/0) && n !== -(1/0))
- n = (n > 0 || -1) * Math.floor(Math.abs(n));
- return n;
- };
-
- var prepareString = "a"[0] != "a",
- // ES5 9.9
- // http://es5.github.com/#x9.9
- toObject = function (o) {
- if (o == null) { // this matches both null and undefined
- throw new TypeError(); // TODO message
- }
- // If the implementation doesn't support by-index access of
- // string characters (ex. IE < 7), split the string
- if (prepareString && typeof o == "string" && o) {
- return o.split("");
- }
- return Object(o);
- };
- });
-
- ace.define('ace/lib/dom', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- var XHTML_NS = "http://www.w3.org/1999/xhtml";
-
- exports.createElement = function(tag, ns) {
- return document.createElementNS ?
- document.createElementNS(ns || XHTML_NS, tag) :
- document.createElement(tag);
- };
-
- exports.setText = function(elem, text) {
- if (elem.innerText !== undefined) {
- elem.innerText = text;
- }
- if (elem.textContent !== undefined) {
- elem.textContent = text;
- }
- };
-
- exports.hasCssClass = function(el, name) {
- var classes = el.className.split(/\s+/g);
- return classes.indexOf(name) !== -1;
- };
- exports.addCssClass = function(el, name) {
- if (!exports.hasCssClass(el, name)) {
- el.className += " " + name;
- }
- };
- exports.removeCssClass = function(el, name) {
- var classes = el.className.split(/\s+/g);
- while (true) {
- var index = classes.indexOf(name);
- if (index == -1) {
- break;
- }
- classes.splice(index, 1);
- }
- el.className = classes.join(" ");
- };
-
- exports.toggleCssClass = function(el, name) {
- var classes = el.className.split(/\s+/g), add = true;
- while (true) {
- var index = classes.indexOf(name);
- if (index == -1) {
- break;
- }
- add = false;
- classes.splice(index, 1);
- }
- if(add)
- classes.push(name);
-
- el.className = classes.join(" ");
- return add;
- };
- exports.setCssClass = function(node, className, include) {
- if (include) {
- exports.addCssClass(node, className);
- } else {
- exports.removeCssClass(node, className);
- }
- };
-
- exports.hasCssString = function(id, doc) {
- var index = 0, sheets;
- doc = doc || document;
-
- if (doc.createStyleSheet && (sheets = doc.styleSheets)) {
- while (index < sheets.length)
- if (sheets[index++].owningElement.id === id) return true;
- } else if ((sheets = doc.getElementsByTagName("style"))) {
- while (index < sheets.length)
- if (sheets[index++].id === id) return true;
- }
-
- return false;
- };
-
- exports.importCssString = function importCssString(cssText, id, doc) {
- doc = doc || document;
- // If style is already imported return immediately.
- if (id && exports.hasCssString(id, doc))
- return null;
-
- var style;
-
- if (doc.createStyleSheet) {
- style = doc.createStyleSheet();
- style.cssText = cssText;
- if (id)
- style.owningElement.id = id;
- } else {
- style = doc.createElementNS
- ? doc.createElementNS(XHTML_NS, "style")
- : doc.createElement("style");
-
- style.appendChild(doc.createTextNode(cssText));
- if (id)
- style.id = id;
-
- var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
- head.appendChild(style);
- }
- };
-
- exports.importCssStylsheet = function(uri, doc) {
- if (doc.createStyleSheet) {
- doc.createStyleSheet(uri);
- } else {
- var link = exports.createElement('link');
- link.rel = 'stylesheet';
- link.href = uri;
-
- var head = doc.getElementsByTagName("head")[0] || doc.documentElement;
- head.appendChild(link);
- }
- };
-
- exports.getInnerWidth = function(element) {
- return (
- parseInt(exports.computedStyle(element, "paddingLeft"), 10) +
- parseInt(exports.computedStyle(element, "paddingRight"), 10) +
- element.clientWidth
- );
- };
-
- exports.getInnerHeight = function(element) {
- return (
- parseInt(exports.computedStyle(element, "paddingTop"), 10) +
- parseInt(exports.computedStyle(element, "paddingBottom"), 10) +
- element.clientHeight
- );
- };
-
- if (window.pageYOffset !== undefined) {
- exports.getPageScrollTop = function() {
- return window.pageYOffset;
- };
-
- exports.getPageScrollLeft = function() {
- return window.pageXOffset;
- };
- }
- else {
- exports.getPageScrollTop = function() {
- return document.body.scrollTop;
- };
-
- exports.getPageScrollLeft = function() {
- return document.body.scrollLeft;
- };
- }
-
- if (window.getComputedStyle)
- exports.computedStyle = function(element, style) {
- if (style)
- return (window.getComputedStyle(element, "") || {})[style] || "";
- return window.getComputedStyle(element, "") || {};
- };
- else
- exports.computedStyle = function(element, style) {
- if (style)
- return element.currentStyle[style];
- return element.currentStyle;
- };
-
- exports.scrollbarWidth = function(document) {
-
- var inner = exports.createElement("p");
- inner.style.width = "100%";
- inner.style.minWidth = "0px";
- inner.style.height = "200px";
-
- var outer = exports.createElement("div");
- var style = outer.style;
-
- style.position = "absolute";
- style.left = "-10000px";
- style.overflow = "hidden";
- style.width = "200px";
- style.minWidth = "0px";
- style.height = "150px";
-
- outer.appendChild(inner);
-
- var body = document.body || document.documentElement;
- body.appendChild(outer);
-
- var noScrollbar = inner.offsetWidth;
-
- style.overflow = "scroll";
- var withScrollbar = inner.offsetWidth;
-
- if (noScrollbar == withScrollbar) {
- withScrollbar = outer.clientWidth;
- }
-
- body.removeChild(outer);
-
- return noScrollbar-withScrollbar;
- };
- exports.setInnerHtml = function(el, innerHtml) {
- var element = el.cloneNode(false);//document.createElement("div");
- element.innerHTML = innerHtml;
- el.parentNode.replaceChild(element, el);
- return element;
- };
-
- exports.setInnerText = function(el, innerText) {
- var document = el.ownerDocument;
- if (document.body && "textContent" in document.body)
- el.textContent = innerText;
- else
- el.innerText = innerText;
-
- };
-
- exports.getInnerText = function(el) {
- var document = el.ownerDocument;
- if (document.body && "textContent" in document.body)
- return el.textContent;
- else
- return el.innerText || el.textContent || "";
- };
-
- exports.getParentWindow = function(document) {
- return document.defaultView || document.parentWindow;
- };
-
- });
-
- ace.define('ace/lib/event', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/useragent', 'ace/lib/dom'], function(require, exports, module) {
-
-
- var keys = require("./keys");
- var useragent = require("./useragent");
- var dom = require("./dom");
-
- exports.addListener = function(elem, type, callback) {
- if (elem.addEventListener) {
- return elem.addEventListener(type, callback, false);
- }
- if (elem.attachEvent) {
- var wrapper = function() {
- callback(window.event);
- };
- callback._wrapper = wrapper;
- elem.attachEvent("on" + type, wrapper);
- }
- };
-
- exports.removeListener = function(elem, type, callback) {
- if (elem.removeEventListener) {
- return elem.removeEventListener(type, callback, false);
- }
- if (elem.detachEvent) {
- elem.detachEvent("on" + type, callback._wrapper || callback);
- }
- };
- exports.stopEvent = function(e) {
- exports.stopPropagation(e);
- exports.preventDefault(e);
- return false;
- };
-
- exports.stopPropagation = function(e) {
- if (e.stopPropagation)
- e.stopPropagation();
- else
- e.cancelBubble = true;
- };
-
- exports.preventDefault = function(e) {
- if (e.preventDefault)
- e.preventDefault();
- else
- e.returnValue = false;
- };
- exports.getButton = function(e) {
- if (e.type == "dblclick")
- return 0;
- if (e.type == "contextmenu" || (e.ctrlKey && useragent.isMac))
- return 2;
-
- // DOM Event
- if (e.preventDefault) {
- return e.button;
- }
- // old IE
- else {
- return {1:0, 2:2, 4:1}[e.button];
- }
- };
-
- if (document.documentElement.setCapture) {
- exports.capture = function(el, eventHandler, releaseCaptureHandler) {
- function onMouseMove(e) {
- eventHandler(e);
- return exports.stopPropagation(e);
- }
-
- var called = false;
- function onReleaseCapture(e) {
- eventHandler(e);
-
- if (!called) {
- called = true;
- releaseCaptureHandler(e);
- }
-
- exports.removeListener(el, "mousemove", eventHandler);
- exports.removeListener(el, "mouseup", onReleaseCapture);
- exports.removeListener(el, "losecapture", onReleaseCapture);
-
- el.releaseCapture();
- }
-
- exports.addListener(el, "mousemove", eventHandler);
- exports.addListener(el, "mouseup", onReleaseCapture);
- exports.addListener(el, "losecapture", onReleaseCapture);
- el.setCapture();
- };
- }
- else {
- exports.capture = function(el, eventHandler, releaseCaptureHandler) {
- function onMouseMove(e) {
- eventHandler(e);
- e.stopPropagation();
- }
-
- function onMouseUp(e) {
- eventHandler && eventHandler(e);
- releaseCaptureHandler && releaseCaptureHandler(e);
-
- document.removeEventListener("mousemove", onMouseMove, true);
- document.removeEventListener("mouseup", onMouseUp, true);
-
- e.stopPropagation();
- }
-
- document.addEventListener("mousemove", onMouseMove, true);
- document.addEventListener("mouseup", onMouseUp, true);
- };
- }
-
- exports.addMouseWheelListener = function(el, callback) {
- var factor = 8;
- var listener = function(e) {
- if (e.wheelDelta !== undefined) {
- if (e.wheelDeltaX !== undefined) {
- e.wheelX = -e.wheelDeltaX / factor;
- e.wheelY = -e.wheelDeltaY / factor;
- } else {
- e.wheelX = 0;
- e.wheelY = -e.wheelDelta / factor;
- }
- }
- else {
- if (e.axis && e.axis == e.HORIZONTAL_AXIS) {
- e.wheelX = (e.detail || 0) * 5;
- e.wheelY = 0;
- } else {
- e.wheelX = 0;
- e.wheelY = (e.detail || 0) * 5;
- }
- }
- callback(e);
- };
- exports.addListener(el, "DOMMouseScroll", listener);
- exports.addListener(el, "mousewheel", listener);
- };
-
- exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbackName) {
- var clicks = 0;
- var startX, startY, timer;
- var eventNames = {
- 2: "dblclick",
- 3: "tripleclick",
- 4: "quadclick"
- };
-
- var listener = function(e) {
- if (exports.getButton(e) != 0) {
- clicks = 0;
- } else {
- var isNewClick = Math.abs(e.clientX - startX) > 5 || Math.abs(e.clientY - startY) > 5;
-
- if (!timer || isNewClick)
- clicks = 0;
-
- clicks += 1;
-
- if (timer)
- clearTimeout(timer)
- timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
- }
- if (clicks == 1) {
- startX = e.clientX;
- startY = e.clientY;
- }
-
- eventHandler[callbackName]("mousedown", e);
-
- if (clicks > 4)
- clicks = 0;
- else if (clicks > 1)
- return eventHandler[callbackName](eventNames[clicks], e);
- };
-
- exports.addListener(el, "mousedown", listener);
- useragent.isOldIE && exports.addListener(el, "dblclick", listener);
- };
-
- function normalizeCommandKeys(callback, e, keyCode) {
- var hashId = 0;
- if (useragent.isOpera && useragent.isMac) {
- hashId = 0 | (e.metaKey ? 1 : 0) | (e.altKey ? 2 : 0)
- | (e.shiftKey ? 4 : 0) | (e.ctrlKey ? 8 : 0);
- } else {
- hashId = 0 | (e.ctrlKey ? 1 : 0) | (e.altKey ? 2 : 0)
- | (e.shiftKey ? 4 : 0) | (e.metaKey ? 8 : 0);
- }
-
- if (keyCode in keys.MODIFIER_KEYS) {
- switch (keys.MODIFIER_KEYS[keyCode]) {
- case "Alt":
- hashId = 2;
- break;
- case "Shift":
- hashId = 4;
- break;
- case "Ctrl":
- hashId = 1;
- break;
- default:
- hashId = 8;
- break;
- }
- keyCode = 0;
- }
-
- if (hashId & 8 && (keyCode == 91 || keyCode == 93)) {
- keyCode = 0;
- }
-
- // If there is no hashID and the keyCode is not a function key, then
- // we don't call the callback as we don't handle a command key here
- // (it's a normal key/character input).
- if (!hashId && !(keyCode in keys.FUNCTION_KEYS) && !(keyCode in keys.PRINTABLE_KEYS)) {
- return false;
- }
- return callback(e, hashId, keyCode);
- }
-
- exports.addCommandKeyListener = function(el, callback) {
- var addListener = exports.addListener;
- if (useragent.isOldGecko || useragent.isOpera) {
- // Old versions of Gecko aka. Firefox < 4.0 didn't repeat the keydown
- // event if the user pressed the key for a longer time. Instead, the
- // keydown event was fired once and later on only the keypress event.
- // To emulate the 'right' keydown behavior, the keyCode of the initial
- // keyDown event is stored and in the following keypress events the
- // stores keyCode is used to emulate a keyDown event.
- var lastKeyDownKeyCode = null;
- addListener(el, "keydown", function(e) {
- lastKeyDownKeyCode = e.keyCode;
- });
- addListener(el, "keypress", function(e) {
- return normalizeCommandKeys(callback, e, lastKeyDownKeyCode);
- });
- } else {
- var lastDown = null;
-
- addListener(el, "keydown", function(e) {
- lastDown = e.keyIdentifier || e.keyCode;
- return normalizeCommandKeys(callback, e, e.keyCode);
- });
- }
- };
-
- if (window.postMessage) {
- var postMessageId = 1;
- exports.nextTick = function(callback, win) {
- win = win || window;
- var messageName = "zero-timeout-message-" + postMessageId;
- exports.addListener(win, "message", function listener(e) {
- if (e.data == messageName) {
- exports.stopPropagation(e);
- exports.removeListener(win, "message", listener);
- callback();
- }
- });
- win.postMessage(messageName, "*");
- };
- }
- else {
- exports.nextTick = function(callback, win) {
- win = win || window;
- window.setTimeout(callback, 0);
- };
- }
-
- });
-
- // Most of the following code is taken from SproutCore with a few changes.
-
- ace.define('ace/lib/keys', ['require', 'exports', 'module' , 'ace/lib/oop'], function(require, exports, module) {
-
-
- var oop = require("./oop");
- var Keys = (function() {
- var ret = {
- MODIFIER_KEYS: {
- 16: 'Shift', 17: 'Ctrl', 18: 'Alt', 224: 'Meta'
- },
-
- KEY_MODS: {
- "ctrl": 1, "alt": 2, "option" : 2,
- "shift": 4, "meta": 8, "command": 8
- },
-
- FUNCTION_KEYS : {
- 8 : "Backspace",
- 9 : "Tab",
- 13 : "Return",
- 19 : "Pause",
- 27 : "Esc",
- 32 : "Space",
- 33 : "PageUp",
- 34 : "PageDown",
- 35 : "End",
- 36 : "Home",
- 37 : "Left",
- 38 : "Up",
- 39 : "Right",
- 40 : "Down",
- 44 : "Print",
- 45 : "Insert",
- 46 : "Delete",
- 96 : "Numpad0",
- 97 : "Numpad1",
- 98 : "Numpad2",
- 99 : "Numpad3",
- 100: "Numpad4",
- 101: "Numpad5",
- 102: "Numpad6",
- 103: "Numpad7",
- 104: "Numpad8",
- 105: "Numpad9",
- 112: "F1",
- 113: "F2",
- 114: "F3",
- 115: "F4",
- 116: "F5",
- 117: "F6",
- 118: "F7",
- 119: "F8",
- 120: "F9",
- 121: "F10",
- 122: "F11",
- 123: "F12",
- 144: "Numlock",
- 145: "Scrolllock"
- },
-
- PRINTABLE_KEYS: {
- 32: ' ', 48: '0', 49: '1', 50: '2', 51: '3', 52: '4', 53: '5',
- 54: '6', 55: '7', 56: '8', 57: '9', 59: ';', 61: '=', 65: 'a',
- 66: 'b', 67: 'c', 68: 'd', 69: 'e', 70: 'f', 71: 'g', 72: 'h',
- 73: 'i', 74: 'j', 75: 'k', 76: 'l', 77: 'm', 78: 'n', 79: 'o',
- 80: 'p', 81: 'q', 82: 'r', 83: 's', 84: 't', 85: 'u', 86: 'v',
- 87: 'w', 88: 'x', 89: 'y', 90: 'z', 107: '+', 109: '-', 110: '.',
- 188: ',', 190: '.', 191: '/', 192: '`', 219: '[', 220: '\\',
- 221: ']', 222: '\''
- }
- };
-
- // A reverse map of FUNCTION_KEYS
- for (var i in ret.FUNCTION_KEYS) {
- var name = ret.FUNCTION_KEYS[i].toUpperCase();
- ret[name] = parseInt(i, 10);
- }
-
- // Add the MODIFIER_KEYS, FUNCTION_KEYS and PRINTABLE_KEYS to the KEY
- // variables as well.
- oop.mixin(ret, ret.MODIFIER_KEYS);
- oop.mixin(ret, ret.PRINTABLE_KEYS);
- oop.mixin(ret, ret.FUNCTION_KEYS);
-
- return ret;
- })();
- oop.mixin(exports, Keys);
-
- exports.keyCodeToString = function(keyCode) {
- return (Keys[keyCode] || String.fromCharCode(keyCode)).toLowerCase();
- }
-
- });
-
- ace.define('ace/lib/oop', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- exports.inherits = (function() {
- var tempCtor = function() {};
- return function(ctor, superCtor) {
- tempCtor.prototype = superCtor.prototype;
- ctor.super_ = superCtor.prototype;
- ctor.prototype = new tempCtor();
- ctor.prototype.constructor = ctor;
- };
- }());
-
- exports.mixin = function(obj, mixin) {
- for (var key in mixin) {
- obj[key] = mixin[key];
- }
- };
-
- exports.implement = function(proto, mixin) {
- exports.mixin(proto, mixin);
- };
-
- });
-
- ace.define('ace/lib/useragent', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
- var ua = navigator.userAgent;
-
- // Is the user using a browser that identifies itself as Windows
- exports.isWin = (os == "win");
-
- // Is the user using a browser that identifies itself as Mac OS
- exports.isMac = (os == "mac");
-
- // Is the user using a browser that identifies itself as Linux
- exports.isLinux = (os == "linux");
-
- exports.isIE =
- navigator.appName == "Microsoft Internet Explorer"
- && parseFloat(navigator.userAgent.match(/MSIE ([0-9]+[\.0-9]+)/)[1]);
-
- exports.isOldIE = exports.isIE && exports.isIE < 9;
-
- // Is this Firefox or related?
- exports.isGecko = exports.isMozilla = window.controllers && window.navigator.product === "Gecko";
-
- // oldGecko == rev < 2.0
- exports.isOldGecko = exports.isGecko && parseInt((navigator.userAgent.match(/rv\:(\d+)/)||[])[1], 10) < 4;
-
- // Is this Opera
- exports.isOpera = window.opera && Object.prototype.toString.call(window.opera) == "[object Opera]";
-
- // Is the user using a browser that identifies itself as WebKit
- exports.isWebKit = parseFloat(ua.split("WebKit/")[1]) || undefined;
-
- exports.isChrome = parseFloat(ua.split(" Chrome/")[1]) || undefined;
-
- exports.isAIR = ua.indexOf("AdobeAIR") >= 0;
-
- exports.isIPad = ua.indexOf("iPad") >= 0;
-
- exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
- exports.OS = {
- LINUX: "LINUX",
- MAC: "MAC",
- WINDOWS: "WINDOWS"
- };
- exports.getOS = function() {
- if (exports.isMac) {
- return exports.OS.MAC;
- } else if (exports.isLinux) {
- return exports.OS.LINUX;
- } else {
- return exports.OS.WINDOWS;
- }
- };
-
- });
-
- ace.define('ace/editor', ['require', 'exports', 'module' , 'ace/lib/fixoldbrowsers', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/useragent', 'ace/keyboard/textinput', 'ace/mouse/mouse_handler', 'ace/mouse/fold_handler', 'ace/keyboard/keybinding', 'ace/edit_session', 'ace/search', 'ace/range', 'ace/lib/event_emitter', 'ace/commands/command_manager', 'ace/commands/default_commands'], function(require, exports, module) {
-
-
- require("./lib/fixoldbrowsers");
-
- var oop = require("./lib/oop");
- var lang = require("./lib/lang");
- var useragent = require("./lib/useragent");
- var TextInput = require("./keyboard/textinput").TextInput;
- var MouseHandler = require("./mouse/mouse_handler").MouseHandler;
- var FoldHandler = require("./mouse/fold_handler").FoldHandler;
- //var TouchHandler = require("./touch_handler").TouchHandler;
- var KeyBinding = require("./keyboard/keybinding").KeyBinding;
- var EditSession = require("./edit_session").EditSession;
- var Search = require("./search").Search;
- var Range = require("./range").Range;
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
- var CommandManager = require("./commands/command_manager").CommandManager;
- var defaultCommands = require("./commands/default_commands").commands;
-
- /**
- * new Editor(renderer, session)
- * - renderer (VirtualRenderer): Associated `VirtualRenderer` that draws everything
- * - session (EditSession): The `EditSession` to refer to
- *
- * Creates a new `Editor` object.
- *
- **/
- var Editor = function(renderer, session) {
- var container = renderer.getContainerElement();
- this.container = container;
- this.renderer = renderer;
-
- this.commands = new CommandManager(useragent.isMac ? "mac" : "win", defaultCommands);
- this.textInput = new TextInput(renderer.getTextAreaContainer(), this);
- this.renderer.textarea = this.textInput.getElement();
- this.keyBinding = new KeyBinding(this);
-
- // TODO detect touch event support
- if (useragent.isIPad) {
- //this.$mouseHandler = new TouchHandler(this);
- } else {
- this.$mouseHandler = new MouseHandler(this);
- new FoldHandler(this);
- }
-
- this.$blockScrolling = 0;
- this.$search = new Search().set({
- wrap: true
- });
-
- this.setSession(session || new EditSession(""));
- };
-
- (function(){
-
- oop.implement(this, EventEmitter);
- this.setKeyboardHandler = function(keyboardHandler) {
- this.keyBinding.setKeyboardHandler(keyboardHandler);
- };
- this.getKeyboardHandler = function() {
- return this.keyBinding.getKeyboardHandler();
- };
- this.setSession = function(session) {
- if (this.session == session)
- return;
-
- if (this.session) {
- var oldSession = this.session;
- this.session.removeEventListener("change", this.$onDocumentChange);
- this.session.removeEventListener("changeMode", this.$onChangeMode);
- this.session.removeEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
- this.session.removeEventListener("changeTabSize", this.$onChangeTabSize);
- this.session.removeEventListener("changeWrapLimit", this.$onChangeWrapLimit);
- this.session.removeEventListener("changeWrapMode", this.$onChangeWrapMode);
- this.session.removeEventListener("onChangeFold", this.$onChangeFold);
- this.session.removeEventListener("changeFrontMarker", this.$onChangeFrontMarker);
- this.session.removeEventListener("changeBackMarker", this.$onChangeBackMarker);
- this.session.removeEventListener("changeBreakpoint", this.$onChangeBreakpoint);
- this.session.removeEventListener("changeAnnotation", this.$onChangeAnnotation);
- this.session.removeEventListener("changeOverwrite", this.$onCursorChange);
- this.session.removeEventListener("changeScrollTop", this.$onScrollTopChange);
- this.session.removeEventListener("changeLeftTop", this.$onScrollLeftChange);
-
- var selection = this.session.getSelection();
- selection.removeEventListener("changeCursor", this.$onCursorChange);
- selection.removeEventListener("changeSelection", this.$onSelectionChange);
- }
-
- this.session = session;
-
- this.$onDocumentChange = this.onDocumentChange.bind(this);
- session.addEventListener("change", this.$onDocumentChange);
- this.renderer.setSession(session);
-
- this.$onChangeMode = this.onChangeMode.bind(this);
- session.addEventListener("changeMode", this.$onChangeMode);
-
- this.$onTokenizerUpdate = this.onTokenizerUpdate.bind(this);
- session.addEventListener("tokenizerUpdate", this.$onTokenizerUpdate);
-
- this.$onChangeTabSize = this.renderer.updateText.bind(this.renderer);
- session.addEventListener("changeTabSize", this.$onChangeTabSize);
-
- this.$onChangeWrapLimit = this.onChangeWrapLimit.bind(this);
- session.addEventListener("changeWrapLimit", this.$onChangeWrapLimit);
-
- this.$onChangeWrapMode = this.onChangeWrapMode.bind(this);
- session.addEventListener("changeWrapMode", this.$onChangeWrapMode);
-
- this.$onChangeFold = this.onChangeFold.bind(this);
- session.addEventListener("changeFold", this.$onChangeFold);
-
- this.$onChangeFrontMarker = this.onChangeFrontMarker.bind(this);
- this.session.addEventListener("changeFrontMarker", this.$onChangeFrontMarker);
-
- this.$onChangeBackMarker = this.onChangeBackMarker.bind(this);
- this.session.addEventListener("changeBackMarker", this.$onChangeBackMarker);
-
- this.$onChangeBreakpoint = this.onChangeBreakpoint.bind(this);
- this.session.addEventListener("changeBreakpoint", this.$onChangeBreakpoint);
-
- this.$onChangeAnnotation = this.onChangeAnnotation.bind(this);
- this.session.addEventListener("changeAnnotation", this.$onChangeAnnotation);
-
- this.$onCursorChange = this.onCursorChange.bind(this);
- this.session.addEventListener("changeOverwrite", this.$onCursorChange);
-
- this.$onScrollTopChange = this.onScrollTopChange.bind(this);
- this.session.addEventListener("changeScrollTop", this.$onScrollTopChange);
-
- this.$onScrollLeftChange = this.onScrollLeftChange.bind(this);
- this.session.addEventListener("changeScrollLeft", this.$onScrollLeftChange);
-
- this.selection = session.getSelection();
- this.selection.addEventListener("changeCursor", this.$onCursorChange);
-
- this.$onSelectionChange = this.onSelectionChange.bind(this);
- this.selection.addEventListener("changeSelection", this.$onSelectionChange);
-
- this.onChangeMode();
-
- this.$blockScrolling += 1;
- this.onCursorChange();
- this.$blockScrolling -= 1;
-
- this.onScrollTopChange();
- this.onScrollLeftChange();
- this.onSelectionChange();
- this.onChangeFrontMarker();
- this.onChangeBackMarker();
- this.onChangeBreakpoint();
- this.onChangeAnnotation();
- this.session.getUseWrapMode() && this.renderer.adjustWrapLimit();
- this.renderer.updateFull();
-
- this._emit("changeSession", {
- session: session,
- oldSession: oldSession
- });
- };
- this.getSession = function() {
- return this.session;
- };
- this.setValue = function(val, cursorPos) {
- this.session.doc.setValue(val);
-
- if (!cursorPos)
- this.selectAll();
- else if (cursorPos == 1)
- this.navigateFileEnd();
- else if (cursorPos == -1)
- this.navigateFileStart();
-
- return val;
- };
- this.getValue = function() {
- return this.session.getValue();
- };
- this.getSelection = function() {
- return this.selection;
- };
- this.resize = function(force) {
- this.renderer.onResize(force);
- };
- this.setTheme = function(theme) {
- this.renderer.setTheme(theme);
- };
- this.getTheme = function() {
- return this.renderer.getTheme();
- };
- this.setStyle = function(style) {
- this.renderer.setStyle(style);
- };
- this.unsetStyle = function(style) {
- this.renderer.unsetStyle(style);
- };
- this.setFontSize = function(size) {
- this.container.style.fontSize = size;
- this.renderer.updateFontSize();
- };
- this.$highlightBrackets = function() {
- if (this.session.$bracketHighlight) {
- this.session.removeMarker(this.session.$bracketHighlight);
- this.session.$bracketHighlight = null;
- }
-
- if (this.$highlightPending) {
- return;
- }
-
- // perform highlight async to not block the browser during navigation
- var self = this;
- this.$highlightPending = true;
- setTimeout(function() {
- self.$highlightPending = false;
-
- var pos = self.session.findMatchingBracket(self.getCursorPosition());
- if (pos) {
- var range = new Range(pos.row, pos.column, pos.row, pos.column+1);
- self.session.$bracketHighlight = self.session.addMarker(range, "ace_bracket", "text");
- }
- }, 10);
- };
- this.focus = function() {
- // Safari needs the timeout
- // iOS and Firefox need it called immediately
- // to be on the save side we do both
- var _self = this;
- setTimeout(function() {
- _self.textInput.focus();
- });
- this.textInput.focus();
- };
- this.isFocused = function() {
- return this.textInput.isFocused();
- };
- this.blur = function() {
- this.textInput.blur();
- };
- this.onFocus = function() {
- if (this.$isFocused)
- return;
- this.$isFocused = true;
- this.renderer.showCursor();
- this.renderer.visualizeFocus();
- this._emit("focus");
- };
- this.onBlur = function() {
- if (!this.$isFocused)
- return;
- this.$isFocused = false;
- this.renderer.hideCursor();
- this.renderer.visualizeBlur();
- this._emit("blur");
- };
-
- this.$cursorChange = function() {
- this.renderer.updateCursor();
- };
- this.onDocumentChange = function(e) {
- var delta = e.data;
- var range = delta.range;
- var lastRow;
-
- if (range.start.row == range.end.row && delta.action != "insertLines" && delta.action != "removeLines")
- lastRow = range.end.row;
- else
- lastRow = Infinity;
- this.renderer.updateLines(range.start.row, lastRow);
-
- this._emit("change", e);
-
- // update cursor because tab characters can influence the cursor position
- this.$cursorChange();
- };
- this.onTokenizerUpdate = function(e) {
- var rows = e.data;
- this.renderer.updateLines(rows.first, rows.last);
- };
- this.onScrollTopChange = function() {
- this.renderer.scrollToY(this.session.getScrollTop());
- };
- this.onScrollLeftChange = function() {
- this.renderer.scrollToX(this.session.getScrollLeft());
- };
- this.onCursorChange = function() {
- this.$cursorChange();
-
- if (!this.$blockScrolling) {
- this.renderer.scrollCursorIntoView();
- }
-
- this.$highlightBrackets();
- this.$updateHighlightActiveLine();
- };
- this.$updateHighlightActiveLine = function() {
- var session = this.getSession();
-
- if (session.$highlightLineMarker)
- session.removeMarker(session.$highlightLineMarker);
-
- session.$highlightLineMarker = null;
-
- if (this.$highlightActiveLine) {
- var cursor = this.getCursorPosition();
- var foldLine = this.session.getFoldLine(cursor.row);
-
- if ((this.getSelectionStyle() != "line" || !this.selection.isMultiLine())) {
- var range;
- if (foldLine) {
- range = new Range(foldLine.start.row, 0, foldLine.end.row + 1, 0);
- } else {
- range = new Range(cursor.row, 0, cursor.row+1, 0);
- }
- session.$highlightLineMarker = session.addMarker(range, "ace_active_line", "background");
- }
- }
- };
- this.onSelectionChange = function(e) {
- var session = this.session;
-
- if (session.$selectionMarker) {
- session.removeMarker(session.$selectionMarker);
- }
- session.$selectionMarker = null;
-
- if (!this.selection.isEmpty()) {
- var range = this.selection.getRange();
- var style = this.getSelectionStyle();
- session.$selectionMarker = session.addMarker(range, "ace_selection", style);
- } else {
- this.$updateHighlightActiveLine();
- }
-
- var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()
- this.session.highlight(re);
- };
-
- this.$getSelectionHighLightRegexp = function() {
- var session = this.session;
-
- var selection = this.getSelectionRange();
- if (selection.isEmpty() || selection.isMultiLine())
- return;
-
- var startOuter = selection.start.column - 1;
- var endOuter = selection.end.column + 1;
- var line = session.getLine(selection.start.row);
- var lineCols = line.length;
- var needle = line.substring(Math.max(startOuter, 0),
- Math.min(endOuter, lineCols));
-
- // Make sure the outer characters are not part of the word.
- if ((startOuter >= 0 && /^[\w\d]/.test(needle)) ||
- (endOuter <= lineCols && /[\w\d]$/.test(needle)))
- return;
-
- needle = line.substring(selection.start.column, selection.end.column);
- if (!/^[\w\d]+$/.test(needle))
- return;
-
- var re = this.$search.$assembleRegExp({
- wholeWord: true,
- caseSensitive: true,
- needle: needle
- });
-
- return re;
- };
- this.onChangeFrontMarker = function() {
- this.renderer.updateFrontMarkers();
- };
- this.onChangeBackMarker = function() {
- this.renderer.updateBackMarkers();
- };
- this.onChangeBreakpoint = function() {
- this.renderer.updateBreakpoints();
- };
- this.onChangeAnnotation = function() {
- this.renderer.setAnnotations(this.session.getAnnotations());
- };
- this.onChangeMode = function() {
- this.renderer.updateText();
- };
- this.onChangeWrapLimit = function() {
- this.renderer.updateFull();
- };
- this.onChangeWrapMode = function() {
- this.renderer.onResize(true);
- };
- this.onChangeFold = function() {
- // Update the active line marker as due to folding changes the current
- // line range on the screen might have changed.
- this.$updateHighlightActiveLine();
- // TODO: This might be too much updating. Okay for now.
- this.renderer.updateFull();
- };
- this.getCopyText = function() {
- var text = "";
- if (!this.selection.isEmpty())
- text = this.session.getTextRange(this.getSelectionRange());
-
- this._emit("copy", text);
- return text;
- };
- this.onCopy = function() {
- this.commands.exec("copy", this);
- };
- this.onCut = function() {
- this.commands.exec("cut", this);
- };
- this.onPaste = function(text) {
- this._emit("paste", text);
- this.insert(text);
- };
- this.insert = function(text) {
- var session = this.session;
- var mode = session.getMode();
-
- var cursor = this.getCursorPosition();
-
- if (this.getBehavioursEnabled()) {
- // Get a transform if the current mode wants one.
- var transform = mode.transformAction(session.getState(cursor.row), 'insertion', this, session, text);
- if (transform)
- text = transform.text;
- }
-
- text = text.replace("\t", this.session.getTabString());
-
- // remove selected text
- if (!this.selection.isEmpty()) {
- cursor = this.session.remove(this.getSelectionRange());
- this.clearSelection();
- }
- else if (this.session.getOverwrite()) {
- var range = new Range.fromPoints(cursor, cursor);
- range.end.column += text.length;
- this.session.remove(range);
- }
-
- this.clearSelection();
-
- var start = cursor.column;
- var lineState = session.getState(cursor.row);
- var shouldOutdent = mode.checkOutdent(lineState, session.getLine(cursor.row), text);
- var line = session.getLine(cursor.row);
- var lineIndent = mode.getNextLineIndent(lineState, line.slice(0, cursor.column), session.getTabString());
- var end = session.insert(cursor, text);
-
- if (transform && transform.selection) {
- if (transform.selection.length == 2) { // Transform relative to the current column
- this.selection.setSelectionRange(
- new Range(cursor.row, start + transform.selection[0],
- cursor.row, start + transform.selection[1]));
- } else { // Transform relative to the current row.
- this.selection.setSelectionRange(
- new Range(cursor.row + transform.selection[0],
- transform.selection[1],
- cursor.row + transform.selection[2],
- transform.selection[3]));
- }
- }
-
- var lineState = session.getState(cursor.row);
-
- // TODO disabled multiline auto indent
- // possibly doing the indent before inserting the text
- // if (cursor.row !== end.row) {
- if (session.getDocument().isNewLine(text)) {
- this.moveCursorTo(cursor.row+1, 0);
-
- var size = session.getTabSize();
- var minIndent = Number.MAX_VALUE;
-
- for (var row = cursor.row + 1; row <= end.row; ++row) {
- var indent = 0;
-
- line = session.getLine(row);
- for (var i = 0; i < line.length; ++i)
- if (line.charAt(i) == '\t')
- indent += size;
- else if (line.charAt(i) == ' ')
- indent += 1;
- else
- break;
- if (/[^\s]/.test(line))
- minIndent = Math.min(indent, minIndent);
- }
-
- for (var row = cursor.row + 1; row <= end.row; ++row) {
- var outdent = minIndent;
-
- line = session.getLine(row);
- for (var i = 0; i < line.length && outdent > 0; ++i)
- if (line.charAt(i) == '\t')
- outdent -= size;
- else if (line.charAt(i) == ' ')
- outdent -= 1;
- session.remove(new Range(row, 0, row, i));
- }
- session.indentRows(cursor.row + 1, end.row, lineIndent);
- }
- if (shouldOutdent)
- mode.autoOutdent(lineState, session, cursor.row);
- };
- this.onTextInput = function(text) {
- this.keyBinding.onTextInput(text);
- };
- this.onCommandKey = function(e, hashId, keyCode) {
- this.keyBinding.onCommandKey(e, hashId, keyCode);
- };
- this.setOverwrite = function(overwrite) {
- this.session.setOverwrite(overwrite);
- };
- this.getOverwrite = function() {
- return this.session.getOverwrite();
- };
- this.toggleOverwrite = function() {
- this.session.toggleOverwrite();
- };
- this.setScrollSpeed = function(speed) {
- this.$mouseHandler.setScrollSpeed(speed);
- };
- this.getScrollSpeed = function() {
- return this.$mouseHandler.getScrollSpeed();
- };
- this.setDragDelay = function(dragDelay) {
- this.$mouseHandler.setDragDelay(dragDelay);
- };
- this.getDragDelay = function() {
- return this.$mouseHandler.getDragDelay();
- };
-
- this.$selectionStyle = "line";
- this.setSelectionStyle = function(style) {
- if (this.$selectionStyle == style) return;
-
- this.$selectionStyle = style;
- this.onSelectionChange();
- this._emit("changeSelectionStyle", {data: style});
- };
- this.getSelectionStyle = function() {
- return this.$selectionStyle;
- };
-
- this.$highlightActiveLine = true;
- this.setHighlightActiveLine = function(shouldHighlight) {
- if (this.$highlightActiveLine == shouldHighlight)
- return;
-
- this.$highlightActiveLine = shouldHighlight;
- this.$updateHighlightActiveLine();
- };
- this.getHighlightActiveLine = function() {
- return this.$highlightActiveLine;
- };
-
- this.$highlightGutterLine = true;
- this.setHighlightGutterLine = function(shouldHighlight) {
- if (this.$highlightGutterLine == shouldHighlight)
- return;
-
- this.renderer.setHighlightGutterLine(shouldHighlight);
- this.$highlightGutterLine = shouldHighlight;
- };
-
- this.getHighlightGutterLine = function() {
- return this.$highlightGutterLine;
- };
-
- this.$highlightSelectedWord = true;
- this.setHighlightSelectedWord = function(shouldHighlight) {
- if (this.$highlightSelectedWord == shouldHighlight)
- return;
-
- this.$highlightSelectedWord = shouldHighlight;
- this.$onSelectionChange();
- };
- this.getHighlightSelectedWord = function() {
- return this.$highlightSelectedWord;
- };
-
- this.setAnimatedScroll = function(shouldAnimate){
- this.renderer.setAnimatedScroll(shouldAnimate);
- };
-
- this.getAnimatedScroll = function(){
- return this.renderer.getAnimatedScroll();
- };
- this.setShowInvisibles = function(showInvisibles) {
- if (this.getShowInvisibles() == showInvisibles)
- return;
-
- this.renderer.setShowInvisibles(showInvisibles);
- };
- this.getShowInvisibles = function() {
- return this.renderer.getShowInvisibles();
- };
- this.setShowPrintMargin = function(showPrintMargin) {
- this.renderer.setShowPrintMargin(showPrintMargin);
- };
- this.getShowPrintMargin = function() {
- return this.renderer.getShowPrintMargin();
- };
- this.setPrintMarginColumn = function(showPrintMargin) {
- this.renderer.setPrintMarginColumn(showPrintMargin);
- };
- this.getPrintMarginColumn = function() {
- return this.renderer.getPrintMarginColumn();
- };
-
- this.$readOnly = false;
- this.setReadOnly = function(readOnly) {
- this.$readOnly = readOnly;
- };
- this.getReadOnly = function() {
- return this.$readOnly;
- };
-
- this.$modeBehaviours = true;
- this.setBehavioursEnabled = function (enabled) {
- this.$modeBehaviours = enabled;
- };
- this.getBehavioursEnabled = function () {
- return this.$modeBehaviours;
- };
- this.setShowFoldWidgets = function(show) {
- var gutter = this.renderer.$gutterLayer;
- if (gutter.getShowFoldWidgets() == show)
- return;
-
- this.renderer.$gutterLayer.setShowFoldWidgets(show);
- this.$showFoldWidgets = show;
- this.renderer.updateFull();
- };
- this.getShowFoldWidgets = function() {
- return this.renderer.$gutterLayer.getShowFoldWidgets();
- };
-
- this.setFadeFoldWidgets = function(show) {
- this.renderer.setFadeFoldWidgets(show);
- };
-
- this.getFadeFoldWidgets = function() {
- return this.renderer.getFadeFoldWidgets();
- };
- this.remove = function(dir) {
- if (this.selection.isEmpty()){
- if (dir == "left")
- this.selection.selectLeft();
- else
- this.selection.selectRight();
- }
-
- var range = this.getSelectionRange();
- if (this.getBehavioursEnabled()) {
- var session = this.session;
- var state = session.getState(range.start.row);
- var new_range = session.getMode().transformAction(state, 'deletion', this, session, range);
- if (new_range)
- range = new_range;
- }
-
- this.session.remove(range);
- this.clearSelection();
- };
- this.removeWordRight = function() {
- if (this.selection.isEmpty())
- this.selection.selectWordRight();
-
- this.session.remove(this.getSelectionRange());
- this.clearSelection();
- };
- this.removeWordLeft = function() {
- if (this.selection.isEmpty())
- this.selection.selectWordLeft();
-
- this.session.remove(this.getSelectionRange());
- this.clearSelection();
- };
- this.removeToLineStart = function() {
- if (this.selection.isEmpty())
- this.selection.selectLineStart();
-
- this.session.remove(this.getSelectionRange());
- this.clearSelection();
- };
- this.removeToLineEnd = function() {
- if (this.selection.isEmpty())
- this.selection.selectLineEnd();
-
- var range = this.getSelectionRange();
- if (range.start.column == range.end.column && range.start.row == range.end.row) {
- range.end.column = 0;
- range.end.row++;
- }
-
- this.session.remove(range);
- this.clearSelection();
- };
- this.splitLine = function() {
- if (!this.selection.isEmpty()) {
- this.session.remove(this.getSelectionRange());
- this.clearSelection();
- }
-
- var cursor = this.getCursorPosition();
- this.insert("\n");
- this.moveCursorToPosition(cursor);
- };
- this.transposeLetters = function() {
- if (!this.selection.isEmpty()) {
- return;
- }
-
- var cursor = this.getCursorPosition();
- var column = cursor.column;
- if (column === 0)
- return;
-
- var line = this.session.getLine(cursor.row);
- var swap, range;
- if (column < line.length) {
- swap = line.charAt(column) + line.charAt(column-1);
- range = new Range(cursor.row, column-1, cursor.row, column+1);
- }
- else {
- swap = line.charAt(column-1) + line.charAt(column-2);
- range = new Range(cursor.row, column-2, cursor.row, column);
- }
- this.session.replace(range, swap);
- };
- this.toLowerCase = function() {
- var originalRange = this.getSelectionRange();
- if (this.selection.isEmpty()) {
- this.selection.selectWord();
- }
-
- var range = this.getSelectionRange();
- var text = this.session.getTextRange(range);
- this.session.replace(range, text.toLowerCase());
- this.selection.setSelectionRange(originalRange);
- };
- this.toUpperCase = function() {
- var originalRange = this.getSelectionRange();
- if (this.selection.isEmpty()) {
- this.selection.selectWord();
- }
-
- var range = this.getSelectionRange();
- var text = this.session.getTextRange(range);
- this.session.replace(range, text.toUpperCase());
- this.selection.setSelectionRange(originalRange);
- };
- this.indent = function() {
- var session = this.session;
- var range = this.getSelectionRange();
-
- if (range.start.row < range.end.row || range.start.column < range.end.column) {
- var rows = this.$getSelectedRows();
- session.indentRows(rows.first, rows.last, "\t");
- } else {
- var indentString;
-
- if (this.session.getUseSoftTabs()) {
- var size = session.getTabSize(),
- position = this.getCursorPosition(),
- column = session.documentToScreenColumn(position.row, position.column),
- count = (size - column % size);
-
- indentString = lang.stringRepeat(" ", count);
- } else
- indentString = "\t";
- return this.insert(indentString);
- }
- };
- this.blockOutdent = function() {
- var selection = this.session.getSelection();
- this.session.outdentRows(selection.getRange());
- };
- this.toggleCommentLines = function() {
- var state = this.session.getState(this.getCursorPosition().row);
- var rows = this.$getSelectedRows();
- this.session.getMode().toggleCommentLines(state, this.session, rows.first, rows.last);
- };
- this.removeLines = function() {
- var rows = this.$getSelectedRows();
- var range;
- if (rows.first === 0 || rows.last+1 < this.session.getLength())
- range = new Range(rows.first, 0, rows.last+1, 0);
- else
- range = new Range(
- rows.first-1, this.session.getLine(rows.first-1).length,
- rows.last, this.session.getLine(rows.last).length
- );
- this.session.remove(range);
- this.clearSelection();
- };
-
- this.duplicateSelection = function() {
- var sel = this.selection;
- var doc = this.session;
- var range = sel.getRange();
- if (range.isEmpty()) {
- var row = range.start.row;
- doc.duplicateLines(row, row);
- } else {
- var reverse = sel.isBackwards()
- var point = sel.isBackwards() ? range.start : range.end;
- var endPoint = doc.insert(point, doc.getTextRange(range), false);
- range.start = point;
- range.end = endPoint;
-
- sel.setSelectionRange(range, reverse)
- }
- };
- this.moveLinesDown = function() {
- this.$moveLines(function(firstRow, lastRow) {
- return this.session.moveLinesDown(firstRow, lastRow);
- });
- };
- this.moveLinesUp = function() {
- this.$moveLines(function(firstRow, lastRow) {
- return this.session.moveLinesUp(firstRow, lastRow);
- });
- };
- this.moveText = function(range, toPosition) {
- if (this.$readOnly)
- return null;
-
- return this.session.moveText(range, toPosition);
- };
- this.copyLinesUp = function() {
- this.$moveLines(function(firstRow, lastRow) {
- this.session.duplicateLines(firstRow, lastRow);
- return 0;
- });
- };
- this.copyLinesDown = function() {
- this.$moveLines(function(firstRow, lastRow) {
- return this.session.duplicateLines(firstRow, lastRow);
- });
- };
- this.$moveLines = function(mover) {
- var rows = this.$getSelectedRows();
- var selection = this.selection;
- if (!selection.isMultiLine()) {
- var range = selection.getRange();
- var reverse = selection.isBackwards();
- }
-
- var linesMoved = mover.call(this, rows.first, rows.last);
-
- if (range) {
- range.start.row += linesMoved;
- range.end.row += linesMoved;
- selection.setSelectionRange(range, reverse);
- }
- else {
- selection.setSelectionAnchor(rows.last+linesMoved+1, 0);
- selection.$moveSelection(function() {
- selection.moveCursorTo(rows.first+linesMoved, 0);
- });
- }
- };
- this.$getSelectedRows = function() {
- var range = this.getSelectionRange().collapseRows();
-
- return {
- first: range.start.row,
- last: range.end.row
- };
- };
- this.onCompositionStart = function(text) {
- this.renderer.showComposition(this.getCursorPosition());
- };
- this.onCompositionUpdate = function(text) {
- this.renderer.setCompositionText(text);
- };
- this.onCompositionEnd = function() {
- this.renderer.hideComposition();
- };
- this.getFirstVisibleRow = function() {
- return this.renderer.getFirstVisibleRow();
- };
- this.getLastVisibleRow = function() {
- return this.renderer.getLastVisibleRow();
- };
- this.isRowVisible = function(row) {
- return (row >= this.getFirstVisibleRow() && row <= this.getLastVisibleRow());
- };
- this.isRowFullyVisible = function(row) {
- return (row >= this.renderer.getFirstFullyVisibleRow() && row <= this.renderer.getLastFullyVisibleRow());
- };
- this.$getVisibleRowCount = function() {
- return this.renderer.getScrollBottomRow() - this.renderer.getScrollTopRow() + 1;
- };
-
- this.$moveByPage = function(dir, select) {
- var renderer = this.renderer;
- var config = this.renderer.layerConfig;
- var rows = dir * Math.floor(config.height / config.lineHeight);
-
- this.$blockScrolling++;
- if (select == true) {
- this.selection.$moveSelection(function(){
- this.moveCursorBy(rows, 0);
- });
- } else if (select == false) {
- this.selection.moveCursorBy(rows, 0);
- this.selection.clearSelection();
- }
- this.$blockScrolling--;
-
- var scrollTop = renderer.scrollTop;
-
- renderer.scrollBy(0, rows * config.lineHeight);
- if (select != null)
- renderer.scrollCursorIntoView(null, 0.5);
-
- renderer.animateScrolling(scrollTop);
- };
- this.selectPageDown = function() {
- this.$moveByPage(1, true);
- };
- this.selectPageUp = function() {
- this.$moveByPage(-1, true);
- };
- this.gotoPageDown = function() {
- this.$moveByPage(1, false);
- };
- this.gotoPageUp = function() {
- this.$moveByPage(-1, false);
- };
- this.scrollPageDown = function() {
- this.$moveByPage(1);
- };
- this.scrollPageUp = function() {
- this.$moveByPage(-1);
- };
- this.scrollToRow = function(row) {
- this.renderer.scrollToRow(row);
- };
- this.scrollToLine = function(line, center, animate, callback) {
- this.renderer.scrollToLine(line, center, animate, callback);
- };
- this.centerSelection = function() {
- var range = this.getSelectionRange();
- var pos = {
- row: Math.floor(range.start.row + (range.end.row - range.start.row) / 2),
- column: Math.floor(range.start.column + (range.end.column - range.start.column) / 2)
- }
- this.renderer.alignCursor(pos, 0.5);
- };
- this.getCursorPosition = function() {
- return this.selection.getCursor();
- };
- this.getCursorPositionScreen = function() {
- return this.session.documentToScreenPosition(this.getCursorPosition());
- };
- this.getSelectionRange = function() {
- return this.selection.getRange();
- };
- this.selectAll = function() {
- this.$blockScrolling += 1;
- this.selection.selectAll();
- this.$blockScrolling -= 1;
- };
- this.clearSelection = function() {
- this.selection.clearSelection();
- };
- this.moveCursorTo = function(row, column) {
- this.selection.moveCursorTo(row, column);
- };
- this.moveCursorToPosition = function(pos) {
- this.selection.moveCursorToPosition(pos);
- };
- this.jumpToMatching = function(select) {
- var cursor = this.getCursorPosition();
-
- var range = this.session.getBracketRange(cursor);
- if (!range) {
- range = editor.find({
- needle: /[{}()\[\]]/g,
- preventScroll:true,
- start: {row: cursor.row, column: cursor.column - 1}
- });
- if (!range)
- return;
- var pos = range.start;
- if (pos.row == cursor.row && Math.abs(pos.column - cursor.column) < 2)
- range = this.session.getBracketRange(pos);
- }
-
- pos = range && range.cursor || pos;
- if (pos) {
- if (select) {
- if (range && range.isEqual(editor.getSelectionRange()))
- this.clearSelection();
- else
- this.selection.selectTo(pos.row, pos.column);
- } else {
- this.clearSelection();
- this.moveCursorTo(pos.row, pos.column);
- }
- }
- };
- this.gotoLine = function(lineNumber, column, animate) {
- this.selection.clearSelection();
- this.session.unfold({row: lineNumber - 1, column: column || 0});
-
- this.$blockScrolling += 1;
- this.moveCursorTo(lineNumber - 1, column || 0);
- this.$blockScrolling -= 1;
-
- if (!this.isRowFullyVisible(lineNumber - 1))
- this.scrollToLine(lineNumber - 1, true, animate);
- };
- this.navigateTo = function(row, column) {
- this.clearSelection();
- this.moveCursorTo(row, column);
- };
- this.navigateUp = function(times) {
- this.selection.clearSelection();
- times = times || 1;
- this.selection.moveCursorBy(-times, 0);
- };
- this.navigateDown = function(times) {
- this.selection.clearSelection();
- times = times || 1;
- this.selection.moveCursorBy(times, 0);
- };
- this.navigateLeft = function(times) {
- if (!this.selection.isEmpty()) {
- var selectionStart = this.getSelectionRange().start;
- this.moveCursorToPosition(selectionStart);
- }
- else {
- times = times || 1;
- while (times--) {
- this.selection.moveCursorLeft();
- }
- }
- this.clearSelection();
- };
- this.navigateRight = function(times) {
- if (!this.selection.isEmpty()) {
- var selectionEnd = this.getSelectionRange().end;
- this.moveCursorToPosition(selectionEnd);
- }
- else {
- times = times || 1;
- while (times--) {
- this.selection.moveCursorRight();
- }
- }
- this.clearSelection();
- };
- this.navigateLineStart = function() {
- this.selection.moveCursorLineStart();
- this.clearSelection();
- };
- this.navigateLineEnd = function() {
- this.selection.moveCursorLineEnd();
- this.clearSelection();
- };
- this.navigateFileEnd = function() {
- var scrollTop = this.renderer.scrollTop;
- this.selection.moveCursorFileEnd();
- this.clearSelection();
- this.renderer.animateScrolling(scrollTop);
- };
- this.navigateFileStart = function() {
- var scrollTop = this.renderer.scrollTop;
- this.selection.moveCursorFileStart();
- this.clearSelection();
- this.renderer.animateScrolling(scrollTop);
- };
- this.navigateWordRight = function() {
- this.selection.moveCursorWordRight();
- this.clearSelection();
- };
- this.navigateWordLeft = function() {
- this.selection.moveCursorWordLeft();
- this.clearSelection();
- };
- this.replace = function(replacement, options) {
- if (options)
- this.$search.set(options);
-
- var range = this.$search.find(this.session);
- var replaced = 0;
- if (!range)
- return replaced;
-
- if (this.$tryReplace(range, replacement)) {
- replaced = 1;
- }
- if (range !== null) {
- this.selection.setSelectionRange(range);
- this.renderer.scrollSelectionIntoView(range.start, range.end);
- }
-
- return replaced;
- };
- this.replaceAll = function(replacement, options) {
- if (options) {
- this.$search.set(options);
- }
-
- var ranges = this.$search.findAll(this.session);
- var replaced = 0;
- if (!ranges.length)
- return replaced;
-
- this.$blockScrolling += 1;
-
- var selection = this.getSelectionRange();
- this.clearSelection();
- this.selection.moveCursorTo(0, 0);
-
- for (var i = ranges.length - 1; i >= 0; --i) {
- if(this.$tryReplace(ranges[i], replacement)) {
- replaced++;
- }
- }
-
- this.selection.setSelectionRange(selection);
- this.$blockScrolling -= 1;
-
- return replaced;
- };
-
- this.$tryReplace = function(range, replacement) {
- var input = this.session.getTextRange(range);
- replacement = this.$search.replace(input, replacement);
- if (replacement !== null) {
- range.end = this.session.replace(range, replacement);
- return range;
- } else {
- return null;
- }
- };
- this.getLastSearchOptions = function() {
- return this.$search.getOptions();
- };
- this.find = function(needle, options, animate) {
- if (!options)
- options = {};
-
- if (typeof needle == "string" || needle instanceof RegExp)
- options.needle = needle;
- else if (typeof needle == "object")
- oop.mixin(options, needle);
-
- var range = this.selection.getRange();
- if (options.needle == null) {
- needle = this.session.getTextRange(range)
- || this.$search.$options.needle;
- if (!needle) {
- range = this.session.getWordRange(range.start.row, range.start.column);
- needle = this.session.getTextRange(range);
- }
- this.$search.set({needle: needle});
- }
-
- this.$search.set(options);
- if (!options.start)
- this.$search.set({start: range});
-
- var newRange = this.$search.find(this.session);
- if (options.preventScroll)
- return newRange;
- if (newRange) {
- this.revealRange(newRange, animate);
- return newRange;
- }
- // clear selection if nothing is found
- if (options.backwards)
- range.start = range.end;
- else
- range.end = range.start;
- this.selection.setRange(range);
- };
- this.findNext = function(options, animate) {
- this.find({skipCurrent: true, backwards: false}, options, animate);
- };
- this.findPrevious = function(options, animate) {
- this.find(options, {skipCurrent: true, backwards: true}, animate);
- };
-
- this.revealRange = function(range, animate) {
- this.$blockScrolling += 1;
- this.session.unfold(range);
- this.selection.setSelectionRange(range);
- this.$blockScrolling -= 1;
-
- var scrollTop = this.renderer.scrollTop;
- this.renderer.scrollSelectionIntoView(range.start, range.end, 0.5);
- if (animate != false)
- this.renderer.animateScrolling(scrollTop);
- };
- this.undo = function() {
- this.$blockScrolling++;
- this.session.getUndoManager().undo();
- this.$blockScrolling--;
- this.renderer.scrollCursorIntoView(null, 0.5);
- };
- this.redo = function() {
- this.$blockScrolling++;
- this.session.getUndoManager().redo();
- this.$blockScrolling--;
- this.renderer.scrollCursorIntoView(null, 0.5);
- };
- this.destroy = function() {
- this.renderer.destroy();
- };
-
- }).call(Editor.prototype);
-
-
- exports.Editor = Editor;
- });
-
- ace.define('ace/lib/lang', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- exports.stringReverse = function(string) {
- return string.split("").reverse().join("");
- };
-
- exports.stringRepeat = function (string, count) {
- return new Array(count + 1).join(string);
- };
-
- var trimBeginRegexp = /^\s\s*/;
- var trimEndRegexp = /\s\s*$/;
-
- exports.stringTrimLeft = function (string) {
- return string.replace(trimBeginRegexp, '');
- };
-
- exports.stringTrimRight = function (string) {
- return string.replace(trimEndRegexp, '');
- };
-
- exports.copyObject = function(obj) {
- var copy = {};
- for (var key in obj) {
- copy[key] = obj[key];
- }
- return copy;
- };
-
- exports.copyArray = function(array){
- var copy = [];
- for (var i=0, l=array.length; i<l; i++) {
- if (array[i] && typeof array[i] == "object")
- copy[i] = this.copyObject( array[i] );
- else
- copy[i] = array[i];
- }
- return copy;
- };
-
- exports.deepCopy = function (obj) {
- if (typeof obj != "object") {
- return obj;
- }
-
- var copy = obj.constructor();
- for (var key in obj) {
- if (typeof obj[key] == "object") {
- copy[key] = this.deepCopy(obj[key]);
- } else {
- copy[key] = obj[key];
- }
- }
- return copy;
- };
-
- exports.arrayToMap = function(arr) {
- var map = {};
- for (var i=0; i<arr.length; i++) {
- map[arr[i]] = 1;
- }
- return map;
-
- };
- exports.arrayRemove = function(array, value) {
- for (var i = 0; i <= array.length; i++) {
- if (value === array[i]) {
- array.splice(i, 1);
- }
- }
- };
-
- exports.escapeRegExp = function(str) {
- return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
- };
-
- exports.getMatchOffsets = function(string, regExp) {
- var matches = [];
-
- string.replace(regExp, function(str) {
- matches.push({
- offset: arguments[arguments.length-2],
- length: str.length
- });
- });
-
- return matches;
- };
-
-
- exports.deferredCall = function(fcn) {
-
- var timer = null;
- var callback = function() {
- timer = null;
- fcn();
- };
-
- var deferred = function(timeout) {
- deferred.cancel();
- timer = setTimeout(callback, timeout || 0);
- return deferred;
- };
-
- deferred.schedule = deferred;
-
- deferred.call = function() {
- this.cancel();
- fcn();
- return deferred;
- };
-
- deferred.cancel = function() {
- clearTimeout(timer);
- timer = null;
- return deferred;
- };
-
- return deferred;
- };
-
- });
-
- ace.define('ace/keyboard/textinput', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent', 'ace/lib/dom'], function(require, exports, module) {
-
-
- var event = require("../lib/event");
- var useragent = require("../lib/useragent");
- var dom = require("../lib/dom");
-
- var TextInput = function(parentNode, host) {
- var text = dom.createElement("textarea");
- if (useragent.isTouchPad)
- text.setAttribute("x-palm-disable-auto-cap", true);
-
- text.setAttribute("wrap", "off");
-
- text.style.top = "-2em";
- parentNode.insertBefore(text, parentNode.firstChild);
-
- var PLACEHOLDER = useragent.isIE ? "\x01" : "\x01";
- sendText();
-
- var inCompostion = false;
- var copied = false;
- var pasted = false;
- var tempStyle = '';
-
- function reset(full) {
- try {
- if (full) {
- text.value = PLACEHOLDER;
- text.selectionStart = 0;
- text.selectionEnd = 1;
- } else
- text.select();
- } catch (e) {}
- }
-
- function sendText(valueToSend) {
- if (!copied) {
- var value = valueToSend || text.value;
- if (value) {
- if (value.length > 1) {
- if (value.charAt(0) == PLACEHOLDER)
- value = value.substr(1);
- else if (value.charAt(value.length - 1) == PLACEHOLDER)
- value = value.slice(0, -1);
- }
-
- if (value && value != PLACEHOLDER) {
- if (pasted)
- host.onPaste(value);
- else
- host.onTextInput(value);
- }
- }
- }
-
- copied = false;
- pasted = false;
-
- // Safari doesn't fire copy events if no text is selected
- reset(true);
- }
-
- var onTextInput = function(e) {
- if (!inCompostion)
- sendText(e.data);
- setTimeout(function () {
- if (!inCompostion)
- reset(true);
- }, 0);
- };
-
- var onPropertyChange = function(e) {
- setTimeout(function() {
- if (!inCompostion)
- sendText();
- }, 0);
- };
-
- var onCompositionStart = function(e) {
- inCompostion = true;
- host.onCompositionStart();
- setTimeout(onCompositionUpdate, 0);
- };
-
- var onCompositionUpdate = function() {
- if (!inCompostion) return;
- host.onCompositionUpdate(text.value);
- };
-
- var onCompositionEnd = function(e) {
- inCompostion = false;
- host.onCompositionEnd();
- };
-
- var onCopy = function(e) {
- copied = true;
- var copyText = host.getCopyText();
- if(copyText)
- text.value = copyText;
- else
- e.preventDefault();
- reset();
- setTimeout(function () {
- sendText();
- }, 0);
- };
-
- var onCut = function(e) {
- copied = true;
- var copyText = host.getCopyText();
- if(copyText) {
- text.value = copyText;
- host.onCut();
- } else
- e.preventDefault();
- reset();
- setTimeout(function () {
- sendText();
- }, 0);
- };
-
- event.addCommandKeyListener(text, host.onCommandKey.bind(host));
- event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
-
- event.addListener(text, "paste", function(e) {
- // Mark that the next input text comes from past.
- pasted = true;
- // Some browsers support the event.clipboardData API. Use this to get
- // the pasted content which increases speed if pasting a lot of lines.
- if (e.clipboardData && e.clipboardData.getData) {
- sendText(e.clipboardData.getData("text/plain"));
- e.preventDefault();
- }
- else {
- // If a browser doesn't support any of the things above, use the regular
- // method to detect the pasted input.
- onPropertyChange();
- }
- });
-
- if ("onbeforecopy" in text && typeof clipboardData !== "undefined") {
- event.addListener(text, "beforecopy", function(e) {
- if (tempStyle)
- return; // without this text is copied when contextmenu is shown
- var copyText = host.getCopyText();
- if (copyText)
- clipboardData.setData("Text", copyText);
- else
- e.preventDefault();
- });
- event.addListener(parentNode, "keydown", function(e) {
- if (e.ctrlKey && e.keyCode == 88) {
- var copyText = host.getCopyText();
- if (copyText) {
- clipboardData.setData("Text", copyText);
- host.onCut();
- }
- event.preventDefault(e);
- }
- });
- event.addListener(text, "cut", onCut); // for ie9 context menu
- }
- else if (useragent.isOpera) {
- event.addListener(parentNode, "keydown", function(e) {
- if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
- return;
-
- if ((e.keyCode == 88 || e.keyCode == 67)) {
- var copyText = host.getCopyText();
- if (copyText) {
- text.value = copyText;
- text.select();
- if (e.keyCode == 88)
- host.onCut();
- }
- }
- });
- }
- else {
- event.addListener(text, "copy", onCopy);
- event.addListener(text, "cut", onCut);
- }
-
- event.addListener(text, "compositionstart", onCompositionStart);
- if (useragent.isGecko) {
- event.addListener(text, "text", onCompositionUpdate);
- }
- if (useragent.isWebKit) {
- event.addListener(text, "keyup", onCompositionUpdate);
- }
- event.addListener(text, "compositionend", onCompositionEnd);
-
- event.addListener(text, "blur", function() {
- host.onBlur();
- });
-
- event.addListener(text, "focus", function() {
- host.onFocus();
- reset();
- });
-
- this.focus = function() {
- reset();
- text.focus();
- };
-
- this.blur = function() {
- text.blur();
- };
-
- function isFocused() {
- return document.activeElement === text;
- }
- this.isFocused = isFocused;
-
- this.getElement = function() {
- return text;
- };
-
- this.onContextMenu = function(e) {
- if (!tempStyle)
- tempStyle = text.style.cssText;
-
- text.style.cssText =
- "position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
- "left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
-
- if (host.selection.isEmpty())
- text.value = "";
-
- if (e.type != "mousedown")
- return;
-
- if (host.renderer.$keepTextAreaAtCursor)
- host.renderer.$keepTextAreaAtCursor = null;
-
- // on windows context menu is opened after mouseup
- if (useragent.isGecko && useragent.isWin)
- event.capture(host.container, function(e) {
- text.style.left = e.clientX - 2 + "px";
- text.style.top = e.clientY - 2 + "px";
- }, onContextMenuClose);
- };
-
- function onContextMenuClose() {
- setTimeout(function () {
- if (tempStyle) {
- text.style.cssText = tempStyle;
- tempStyle = '';
- }
- sendText();
- if (host.renderer.$keepTextAreaAtCursor == null) {
- host.renderer.$keepTextAreaAtCursor = true;
- host.renderer.$moveTextAreaToCursor();
- }
- }, 0);
- };
- this.onContextMenuClose = onContextMenuClose;
-
- // firefox fires contextmenu event after opening it
- if (!useragent.isGecko)
- event.addListener(text, "contextmenu", function(e) {
- host.textInput.onContextMenu(e);
- onContextMenuClose()
- });
- };
-
- exports.TextInput = TextInput;
- });
-
- ace.define('ace/mouse/mouse_handler', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/mouse/default_handlers', 'ace/mouse/default_gutter_handler', 'ace/mouse/mouse_event', 'ace/mouse/dragdrop'], function(require, exports, module) {
-
-
- var event = require("../lib/event");
- var DefaultHandlers = require("./default_handlers").DefaultHandlers;
- var DefaultGutterHandler = require("./default_gutter_handler").GutterHandler;
- var MouseEvent = require("./mouse_event").MouseEvent;
- var DragdropHandler = require("./dragdrop").DragdropHandler;
-
- var MouseHandler = function(editor) {
- this.editor = editor;
-
- new DefaultHandlers(this);
- new DefaultGutterHandler(this);
- new DragdropHandler(this);
-
- event.addListener(editor.container, "mousedown", function(e) {
- editor.focus();
- return event.preventDefault(e);
- });
-
- var mouseTarget = editor.renderer.getMouseEventTarget();
- event.addListener(mouseTarget, "click", this.onMouseEvent.bind(this, "click"));
- event.addListener(mouseTarget, "mousemove", this.onMouseMove.bind(this, "mousemove"));
- event.addMultiMouseDownListener(mouseTarget, [300, 300, 250], this, "onMouseEvent");
- event.addMouseWheelListener(editor.container, this.onMouseWheel.bind(this, "mousewheel"));
-
- var gutterEl = editor.renderer.$gutter;
- event.addListener(gutterEl, "mousedown", this.onMouseEvent.bind(this, "guttermousedown"));
- event.addListener(gutterEl, "click", this.onMouseEvent.bind(this, "gutterclick"));
- event.addListener(gutterEl, "dblclick", this.onMouseEvent.bind(this, "gutterdblclick"));
- event.addListener(gutterEl, "mousemove", this.onMouseMove.bind(this, "gutter"));
- };
-
- (function() {
-
- this.$scrollSpeed = 1;
- this.setScrollSpeed = function(speed) {
- this.$scrollSpeed = speed;
- };
-
- this.getScrollSpeed = function() {
- return this.$scrollSpeed;
- };
-
- this.onMouseEvent = function(name, e) {
- this.editor._emit(name, new MouseEvent(e, this.editor));
- };
-
- this.$dragDelay = 250;
- this.setDragDelay = function(dragDelay) {
- this.$dragDelay = dragDelay;
- };
-
- this.getDragDelay = function() {
- return this.$dragDelay;
- };
-
- this.onMouseMove = function(name, e) {
- // optimization, because mousemove doesn't have a default handler.
- var listeners = this.editor._eventRegistry && this.editor._eventRegistry.mousemove;
- if (!listeners || !listeners.length)
- return;
-
- this.editor._emit(name, new MouseEvent(e, this.editor));
- };
-
- this.onMouseWheel = function(name, e) {
- var mouseEvent = new MouseEvent(e, this.editor);
- mouseEvent.speed = this.$scrollSpeed * 2;
- mouseEvent.wheelX = e.wheelX;
- mouseEvent.wheelY = e.wheelY;
-
- this.editor._emit(name, mouseEvent);
- };
-
- this.setState = function(state) {
- this.state = state;
- };
-
- this.captureMouse = function(ev, state) {
- if (state)
- this.setState(state);
-
- this.x = ev.x;
- this.y = ev.y;
-
- // do not move textarea during selection
- var renderer = this.editor.renderer;
- if (renderer.$keepTextAreaAtCursor)
- renderer.$keepTextAreaAtCursor = null;
-
- var self = this;
- var onMouseMove = function(e) {
- self.x = e.clientX;
- self.y = e.clientY;
- };
-
- var onCaptureEnd = function(e) {
- clearInterval(timerId);
- self[self.state + "End"] && self[self.state + "End"](e);
- self.$clickSelection = null;
- if (renderer.$keepTextAreaAtCursor == null) {
- renderer.$keepTextAreaAtCursor = true;
- renderer.$moveTextAreaToCursor();
- }
- };
-
- var onCaptureInterval = function() {
- self[self.state] && self[self.state]();
- }
-
- event.capture(this.editor.container, onMouseMove, onCaptureEnd);
- var timerId = setInterval(onCaptureInterval, 20);
- };
- }).call(MouseHandler.prototype);
-
- exports.MouseHandler = MouseHandler;
- });
-
- ace.define('ace/mouse/default_handlers', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/useragent'], function(require, exports, module) {
-
-
- var dom = require("../lib/dom");
- var useragent = require("../lib/useragent");
-
- var DRAG_OFFSET = 5; // pixels
-
- function DefaultHandlers(mouseHandler) {
- mouseHandler.$clickSelection = null;
-
- var editor = mouseHandler.editor;
- editor.setDefaultHandler("mousedown", this.onMouseDown.bind(mouseHandler));
- editor.setDefaultHandler("dblclick", this.onDoubleClick.bind(mouseHandler));
- editor.setDefaultHandler("tripleclick", this.onTripleClick.bind(mouseHandler));
- editor.setDefaultHandler("quadclick", this.onQuadClick.bind(mouseHandler));
- editor.setDefaultHandler("mousewheel", this.onScroll.bind(mouseHandler));
-
- var exports = ["select", "startSelect", "drag", "dragEnd", "dragWait",
- "dragWaitEnd", "startDrag", "focusWait"];
-
- exports.forEach(function(x) {
- mouseHandler[x] = this[x];
- }, this);
-
- mouseHandler.selectByLines = this.extendSelectionBy.bind(mouseHandler, "getLineRange");
- mouseHandler.selectByWords = this.extendSelectionBy.bind(mouseHandler, "getWordRange");
-
- mouseHandler.$focusWaitTimout = 250;
- }
-
- (function() {
-
- this.onMouseDown = function(ev) {
- var inSelection = ev.inSelection();
- var pos = ev.getDocumentPosition();
- this.mousedownEvent = ev;
- var editor = this.editor;
- var _self = this;
-
- var button = ev.getButton();
- if (button !== 0) {
- var selectionRange = editor.getSelectionRange();
- var selectionEmpty = selectionRange.isEmpty();
-
- if (selectionEmpty) {
- editor.moveCursorToPosition(pos);
- editor.selection.clearSelection();
- }
-
- // 2: contextmenu, 1: linux paste
- editor.textInput.onContextMenu(ev.domEvent);
- return; // stopping event here breaks contextmenu on ff mac
- }
-
- // if this click caused the editor to be focused should not clear the
- // selection
- if (inSelection && !editor.isFocused()) {
- editor.focus();
- if (this.$focusWaitTimout && !this.$clickSelection) {
- this.setState("focusWait");
- this.captureMouse(ev);
- return ev.preventDefault();
- }
- }
-
- if (!inSelection || this.$clickSelection || ev.getShiftKey()) {
- // Directly pick STATE_SELECT, since the user is not clicking inside
- // a selection.
- this.startSelect(pos);
- } else if (inSelection) {
- this.mousedownEvent.time = (new Date()).getTime();
- this.setState("dragWait");
- }
-
- this.captureMouse(ev);
- return ev.preventDefault();
- };
-
- this.startSelect = function(pos) {
- pos = pos || this.editor.renderer.screenToTextCoordinates(this.x, this.y);
- if (this.mousedownEvent.getShiftKey()) {
- this.editor.selection.selectToPosition(pos);
- }
- else if (!this.$clickSelection) {
- this.editor.moveCursorToPosition(pos);
- this.editor.selection.clearSelection();
- }
- this.setState("select");
- }
-
- this.select = function() {
- var anchor, editor = this.editor;
- var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
-
- if (this.$clickSelection) {
- var cmp = this.$clickSelection.comparePoint(cursor);
-
- if (cmp == -1) {
- anchor = this.$clickSelection.end;
- } else if (cmp == 1) {
- anchor = this.$clickSelection.start;
- } else {
- var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
- cursor = orientedRange.cursor;
- anchor = orientedRange.anchor;
- }
- editor.selection.setSelectionAnchor(anchor.row, anchor.column);
- }
- editor.selection.selectToPosition(cursor);
-
- editor.renderer.scrollCursorIntoView();
- };
-
- this.extendSelectionBy = function(unitName) {
- var anchor, editor = this.editor;
- var cursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
- var range = editor.selection[unitName](cursor.row, cursor.column);
-
- if (this.$clickSelection) {
- var cmpStart = this.$clickSelection.comparePoint(range.start);
- var cmpEnd = this.$clickSelection.comparePoint(range.end);
-
- if (cmpStart == -1 && cmpEnd <= 0) {
- anchor = this.$clickSelection.end;
- cursor = range.start;
- } else if (cmpEnd == 1 && cmpStart >= 0) {
- anchor = this.$clickSelection.start;
- cursor = range.end;
- } else if (cmpStart == -1 && cmpEnd == 1) {
- cursor = range.end;
- anchor = range.start;
- } else {
- var orientedRange = calcRangeOrientation(this.$clickSelection, cursor);
- cursor = orientedRange.cursor;
- anchor = orientedRange.anchor;
- }
- editor.selection.setSelectionAnchor(anchor.row, anchor.column);
- }
- editor.selection.selectToPosition(cursor);
-
- editor.renderer.scrollCursorIntoView();
- };
-
- this.startDrag = function() {
- var editor = this.editor;
- this.setState("drag");
- this.dragRange = editor.getSelectionRange();
- var style = editor.getSelectionStyle();
- this.dragSelectionMarker = editor.session.addMarker(this.dragRange, "ace_selection", style);
- editor.clearSelection();
- dom.addCssClass(editor.container, "ace_dragging");
- if (!this.$dragKeybinding) {
- this.$dragKeybinding = {
- handleKeyboard: function(data, hashId, keyString, keyCode) {
- if (keyString == "esc")
- return {command: this.command};
- },
- command: {
- exec: function(editor) {
- var self = editor.$mouseHandler;
- self.dragCursor = null
- self.dragEnd();
- self.startSelect();
- }
- }
- }
- }
-
- editor.keyBinding.addKeyboardHandler(this.$dragKeybinding);
- };
-
- this.focusWait = function() {
- var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
- var time = (new Date()).getTime();
-
- if (distance > DRAG_OFFSET ||time - this.mousedownEvent.time > this.$focusWaitTimout)
- this.startSelect();
- };
-
- this.dragWait = function(e) {
- var distance = calcDistance(this.mousedownEvent.x, this.mousedownEvent.y, this.x, this.y);
- var time = (new Date()).getTime();
- var editor = this.editor;
-
- if (distance > DRAG_OFFSET) {
- this.startSelect();
- } else if (time - this.mousedownEvent.time > editor.getDragDelay()) {
- this.startDrag();
- }
- };
-
- this.dragWaitEnd = function(e) {
- this.mousedownEvent.domEvent = e;
- this.startSelect();
- };
-
- this.drag = function() {
- var editor = this.editor;
- this.dragCursor = editor.renderer.screenToTextCoordinates(this.x, this.y);
- editor.moveCursorToPosition(this.dragCursor);
- editor.renderer.scrollCursorIntoView();
- };
-
- this.dragEnd = function(e) {
- var editor = this.editor;
- var dragCursor = this.dragCursor;
- var dragRange = this.dragRange;
- dom.removeCssClass(editor.container, "ace_dragging");
- editor.session.removeMarker(this.dragSelectionMarker);
- editor.keyBinding.removeKeyboardHandler(this.$dragKeybinding);
-
- if (!dragCursor)
- return;
-
- editor.clearSelection();
- if (e && (e.ctrlKey || e.altKey)) {
- var session = editor.session;
- var newRange = dragRange;
- newRange.end = session.insert(dragCursor, session.getTextRange(dragRange));
- newRange.start = dragCursor;
- } else if (dragRange.contains(dragCursor.row, dragCursor.column)) {
- return;
- } else {
- var newRange = editor.moveText(dragRange, dragCursor);
- }
-
- if (!newRange)
- return;
-
- editor.selection.setSelectionRange(newRange);
- };
-
- this.onDoubleClick = function(ev) {
- var pos = ev.getDocumentPosition();
- var editor = this.editor;
- var session = editor.session
-
- var range = session.getBracketRange(pos);
- if (range) {
- if (range.isEmpty()) {
- range.start.column--;
- range.end.column++;
- }
- this.$clickSelection = range;
- this.setState("select");
- return;
- }
-
- this.$clickSelection = editor.selection.getWordRange(pos.row, pos.column);
- this.setState("selectByWords");
- };
-
- this.onTripleClick = function(ev) {
- var pos = ev.getDocumentPosition();
- var editor = this.editor;
-
- this.setState("selectByLines");
-
- editor.moveCursorToPosition(pos);
- editor.selection.selectLine();
- this.$clickSelection = editor.getSelectionRange();
- };
-
- this.onQuadClick = function(ev) {
- var editor = this.editor;
-
- editor.selectAll();
- this.$clickSelection = editor.getSelectionRange();
- this.setState("null");
- };
-
- this.onScroll = function(ev) {
- var editor = this.editor;
- var isScrolable = editor.renderer.isScrollableBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
- if (isScrolable) {
- this.$passScrollEvent = false;
- } else {
- if (this.$passScrollEvent)
- return;
-
- if (!this.$scrollStopTimeout) {
- var self = this;
- this.$scrollStopTimeout = setTimeout(function() {
- self.$passScrollEvent = true;
- self.$scrollStopTimeout = null;
- }, 200);
- }
- }
-
- editor.renderer.scrollBy(ev.wheelX * ev.speed, ev.wheelY * ev.speed);
- return ev.preventDefault();
- };
-
- }).call(DefaultHandlers.prototype);
-
- exports.DefaultHandlers = DefaultHandlers;
-
- function calcDistance(ax, ay, bx, by) {
- return Math.sqrt(Math.pow(bx - ax, 2) + Math.pow(by - ay, 2));
- }
-
- function calcRangeOrientation(range, cursor) {
- if (range.start.row == range.end.row)
- var cmp = 2 * cursor.column - range.start.column - range.end.column;
- else
- var cmp = 2 * cursor.row - range.start.row - range.end.row;
-
- if (cmp < 0)
- return {cursor: range.start, anchor: range.end};
- else
- return {cursor: range.end, anchor: range.start};
- }
-
- });
-
- ace.define('ace/mouse/default_gutter_handler', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
-
- var dom = require("../lib/dom");
-
- function GutterHandler(mouseHandler) {
- var editor = mouseHandler.editor;
-
- mouseHandler.editor.setDefaultHandler("guttermousedown", function(e) {
- var target = e.domEvent.target;
- if (target.className.indexOf("ace_gutter-cell") == -1)
- return;
-
- if (!editor.isFocused())
- return;
-
- var padding = parseInt(dom.computedStyle(target).paddingLeft);
- if (e.x < padding + target.getBoundingClientRect().left + 1)
- return;
-
- var row = e.getDocumentPosition().row;
- var selection = editor.session.selection;
-
- if (e.getShiftKey()) {
- selection.selectTo(row, 0);
- } else {
- selection.moveCursorTo(row, 0);
- selection.selectLine();
- mouseHandler.$clickSelection = selection.getRange();
- }
-
- mouseHandler.captureMouse(e, "selectByLines");
- return e.preventDefault();
- });
- }
-
- exports.GutterHandler = GutterHandler;
-
- });
-
- ace.define('ace/mouse/mouse_event', ['require', 'exports', 'module' , 'ace/lib/event', 'ace/lib/useragent'], function(require, exports, module) {
-
-
- var event = require("../lib/event");
- var useragent = require("../lib/useragent");
- var MouseEvent = exports.MouseEvent = function(domEvent, editor) {
- this.domEvent = domEvent;
- this.editor = editor;
-
- this.x = this.clientX = domEvent.clientX;
- this.y = this.clientY = domEvent.clientY;
-
- this.$pos = null;
- this.$inSelection = null;
-
- this.propagationStopped = false;
- this.defaultPrevented = false;
- };
-
- (function() {
-
- this.stopPropagation = function() {
- event.stopPropagation(this.domEvent);
- this.propagationStopped = true;
- };
-
- this.preventDefault = function() {
- event.preventDefault(this.domEvent);
- this.defaultPrevented = true;
- };
-
- this.stop = function() {
- this.stopPropagation();
- this.preventDefault();
- };
- this.getDocumentPosition = function() {
- if (this.$pos)
- return this.$pos;
-
- this.$pos = this.editor.renderer.screenToTextCoordinates(this.clientX, this.clientY);
- return this.$pos;
- };
- this.inSelection = function() {
- if (this.$inSelection !== null)
- return this.$inSelection;
-
- var editor = this.editor;
-
- if (editor.getReadOnly()) {
- this.$inSelection = false;
- }
- else {
- var selectionRange = editor.getSelectionRange();
- if (selectionRange.isEmpty())
- this.$inSelection = false;
- else {
- var pos = this.getDocumentPosition();
- this.$inSelection = selectionRange.contains(pos.row, pos.column);
- }
- }
- return this.$inSelection;
- };
- this.getButton = function() {
- return event.getButton(this.domEvent);
- };
- this.getShiftKey = function() {
- return this.domEvent.shiftKey;
- };
-
- this.getAccelKey = useragent.isMac
- ? function() { return this.domEvent.metaKey; }
- : function() { return this.domEvent.ctrlKey; };
-
- }).call(MouseEvent.prototype);
-
- });
-
- ace.define('ace/mouse/dragdrop', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
-
-
- var event = require("../lib/event");
-
- var DragdropHandler = function(mouseHandler) {
- var editor = mouseHandler.editor;
- var dragSelectionMarker, x, y;
- var timerId, range, isBackwards;
- var dragCursor, counter = 0;
-
- var mouseTarget = editor.container;
- event.addListener(mouseTarget, "dragenter", function(e) {console.log(e.type, counter,e.target);
- counter++;
- if (!dragSelectionMarker) {
- range = editor.getSelectionRange();
- isBackwards = editor.selection.isBackwards();
- var style = editor.getSelectionStyle();
- dragSelectionMarker = editor.session.addMarker(range, "ace_selection", style);
- editor.clearSelection();
- clearInterval(timerId);
- timerId = setInterval(onDragInterval, 20);
- }
- return event.preventDefault(e);
- });
-
- event.addListener(mouseTarget, "dragover", function(e) {
- x = e.clientX;
- y = e.clientY;
- return event.preventDefault(e);
- });
-
- var onDragInterval = function() {
- dragCursor = editor.renderer.screenToTextCoordinates(x, y);
- editor.moveCursorToPosition(dragCursor);
- editor.renderer.scrollCursorIntoView();
- };
-
- event.addListener(mouseTarget, "dragleave", function(e) {console.log(e.type, counter,e.target);
- counter--;
- if (counter > 0)
- return;
- console.log(e.type, counter,e.target);
- clearInterval(timerId);
- editor.session.removeMarker(dragSelectionMarker);
- dragSelectionMarker = null;
- editor.selection.setSelectionRange(range, isBackwards);
- return event.preventDefault(e);
- });
-
- event.addListener(mouseTarget, "drop", function(e) {
- console.log(e.type, counter,e.target);
- counter = 0;
- clearInterval(timerId);
- editor.session.removeMarker(dragSelectionMarker);
- dragSelectionMarker = null;
-
- range.end = editor.session.insert(dragCursor, e.dataTransfer.getData('Text'));
- range.start = dragCursor;
- editor.focus();
- editor.selection.setSelectionRange(range);
- return event.preventDefault(e);
- });
-
- };
-
- exports.DragdropHandler = DragdropHandler;
- });
-
- ace.define('ace/mouse/fold_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- function FoldHandler(editor) {
-
- editor.on("click", function(e) {
- var position = e.getDocumentPosition();
- var session = editor.session;
-
- // If the user clicked on a fold, then expand it.
- var fold = session.getFoldAt(position.row, position.column, 1);
- if (fold) {
- if (e.getAccelKey())
- session.removeFold(fold);
- else
- session.expandFold(fold);
-
- e.stop();
- }
- });
-
- editor.on("gutterclick", function(e) {
- if (e.domEvent.target.className.indexOf("ace_fold-widget") != -1) {
- var row = e.getDocumentPosition().row;
- editor.session.onFoldWidgetClick(row, e.domEvent);
- e.stop();
- }
- });
- }
-
- exports.FoldHandler = FoldHandler;
-
- });
-
- ace.define('ace/keyboard/keybinding', ['require', 'exports', 'module' , 'ace/lib/keys', 'ace/lib/event'], function(require, exports, module) {
-
-
- var keyUtil = require("../lib/keys");
- var event = require("../lib/event");
-
- var KeyBinding = function(editor) {
- this.$editor = editor;
- this.$data = { };
- this.$handlers = [];
- this.setDefaultHandler(editor.commands);
- };
-
- (function() {
- this.setDefaultHandler = function(kb) {
- this.removeKeyboardHandler(this.$defaultHandler);
- this.$defaultHandler = kb;
- this.addKeyboardHandler(kb, 0);
- this.$data = {editor: this.$editor};
- };
-
- this.setKeyboardHandler = function(kb) {
- if (this.$handlers[this.$handlers.length - 1] == kb)
- return;
-
- while (this.$handlers[1])
- this.removeKeyboardHandler(this.$handlers[1]);
-
- this.addKeyboardHandler(kb, 1);
- };
-
- this.addKeyboardHandler = function(kb, pos) {
- if (!kb)
- return;
- var i = this.$handlers.indexOf(kb);
- if (i != -1)
- this.$handlers.splice(i, 1);
-
- if (pos == undefined)
- this.$handlers.push(kb);
- else
- this.$handlers.splice(pos, 0, kb);
-
- if (i == -1 && kb.attach)
- kb.attach(this.$editor);
- };
-
- this.removeKeyboardHandler = function(kb) {
- var i = this.$handlers.indexOf(kb);
- if (i == -1)
- return false;
- this.$handlers.splice(i, 1);
- kb.detach && kb.detach(this.$editor);
- return true;
- };
-
- this.getKeyboardHandler = function() {
- return this.$handlers[this.$handlers.length - 1];
- };
-
- this.$callKeyboardHandlers = function (hashId, keyString, keyCode, e) {
- var toExecute;
- for (var i = this.$handlers.length; i--;) {
- toExecute = this.$handlers[i].handleKeyboard(
- this.$data, hashId, keyString, keyCode, e
- );
- if (toExecute && toExecute.command)
- break;
- }
-
- if (!toExecute || !toExecute.command)
- return false;
-
- var success = false;
- var commands = this.$editor.commands;
-
- // allow keyboardHandler to consume keys
- if (toExecute.command != "null")
- success = commands.exec(toExecute.command, this.$editor, toExecute.args, e);
- else
- success = toExecute.passEvent != true;
-
- // do not stop input events to not break repeating
- if (success && e && hashId != -1)
- event.stopEvent(e);
-
- return success;
- };
-
- this.onCommandKey = function(e, hashId, keyCode) {
- var keyString = keyUtil.keyCodeToString(keyCode);
- this.$callKeyboardHandlers(hashId, keyString, keyCode, e);
- };
-
- this.onTextInput = function(text) {
- var success = this.$callKeyboardHandlers(-1, text);
- if (!success)
- this.$editor.commands.exec("insertstring", this.$editor, text);
- };
-
- }).call(KeyBinding.prototype);
-
- exports.KeyBinding = KeyBinding;
- });
-
- ace.define('ace/edit_session', ['require', 'exports', 'module' , 'ace/config', 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/net', 'ace/lib/event_emitter', 'ace/selection', 'ace/mode/text', 'ace/range', 'ace/document', 'ace/background_tokenizer', 'ace/search_highlight', 'ace/edit_session/folding', 'ace/edit_session/bracket_match'], function(require, exports, module) {
-
-
- var config = require("./config");
- var oop = require("./lib/oop");
- var lang = require("./lib/lang");
- var net = require("./lib/net");
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
- var Selection = require("./selection").Selection;
- var TextMode = require("./mode/text").Mode;
- var Range = require("./range").Range;
- var Document = require("./document").Document;
- var BackgroundTokenizer = require("./background_tokenizer").BackgroundTokenizer;
- var SearchHighlight = require("./search_highlight").SearchHighlight;
-
- /**
- * new EditSession(text, mode)
- * - text (Document | String): If `text` is a `Document`, it associates the `EditSession` with it. Otherwise, a new `Document` is created, with the initial text
- * - mode (TextMode): The inital language mode to use for the document
- *
- * Sets up a new `EditSession` and associates it with the given `Document` and `TextMode`.
- *
- **/
-
- var EditSession = function(text, mode) {
- this.$modified = true;
- this.$breakpoints = [];
- this.$frontMarkers = {};
- this.$backMarkers = {};
- this.$markerId = 1;
- this.$resetRowCache(0);
- this.$wrapData = [];
- this.$foldData = [];
- this.$rowLengthCache = [];
- this.$undoSelect = true;
- this.$foldData.toString = function() {
- var str = "";
- this.forEach(function(foldLine) {
- str += "\n" + foldLine.toString();
- });
- return str;
- }
-
- if (typeof text == "object" && text.getLine) {
- this.setDocument(text);
- } else {
- this.setDocument(new Document(text));
- }
-
- this.selection = new Selection(this);
- this.setMode(mode);
- };
-
-
- (function() {
-
- oop.implement(this, EventEmitter);
- this.setDocument = function(doc) {
- if (this.doc)
- throw new Error("Document is already set");
-
- this.doc = doc;
- doc.on("change", this.onChange.bind(this));
- this.on("changeFold", this.onChangeFold.bind(this));
-
- if (this.bgTokenizer) {
- this.bgTokenizer.setDocument(this.getDocument());
- this.bgTokenizer.start(0);
- }
- };
- this.getDocument = function() {
- return this.doc;
- };
- this.$resetRowCache = function(docRrow) {
- if (!docRrow) {
- this.$docRowCache = [];
- this.$screenRowCache = [];
- return;
- }
-
- var i = this.$getRowCacheIndex(this.$docRowCache, docRrow) + 1;
- var l = this.$docRowCache.length;
- this.$docRowCache.splice(i, l);
- this.$screenRowCache.splice(i, l);
-
- };
-
- this.$getRowCacheIndex = function(cacheArray, val) {
- var low = 0;
- var hi = cacheArray.length - 1;
-
- while (low <= hi) {
- var mid = (low + hi) >> 1;
- var c = cacheArray[mid];
-
- if (val > c)
- low = mid + 1;
- else if (val < c)
- hi = mid - 1;
- else
- return mid;
- }
-
- return low && low -1;
- };
- this.onChangeFold = function(e) {
- var fold = e.data;
- this.$resetRowCache(fold.start.row);
- };
- this.onChange = function(e) {
- var delta = e.data;
- this.$modified = true;
-
- this.$resetRowCache(delta.range.start.row);
-
- var removedFolds = this.$updateInternalDataOnChange(e);
- if (!this.$fromUndo && this.$undoManager && !delta.ignore) {
- this.$deltasDoc.push(delta);
- if (removedFolds && removedFolds.length != 0) {
- this.$deltasFold.push({
- action: "removeFolds",
- folds: removedFolds
- });
- }
-
- this.$informUndoManager.schedule();
- }
-
- this.bgTokenizer.$updateOnChange(delta);
- this._emit("change", e);
- };
- this.setValue = function(text) {
- this.doc.setValue(text);
- this.selection.moveCursorTo(0, 0);
- this.selection.clearSelection();
-
- this.$resetRowCache(0);
- this.$deltas = [];
- this.$deltasDoc = [];
- this.$deltasFold = [];
- this.getUndoManager().reset();
- };
- /** alias of: EditSession.getValue
- * EditSession.toString() -> String
- *
- * Returns the current [[Document `Document`]] as a string.
- *
- **/
- this.getValue =
- this.toString = function() {
- return this.doc.getValue();
- };
- this.getSelection = function() {
- return this.selection;
- };
- this.getState = function(row) {
- return this.bgTokenizer.getState(row);
- };
- this.getTokens = function(row) {
- return this.bgTokenizer.getTokens(row);
- };
- this.getTokenAt = function(row, column) {
- var tokens = this.bgTokenizer.getTokens(row);
- var token, c = 0;
- if (column == null) {
- i = tokens.length - 1;
- c = this.getLine(row).length;
- } else {
- for (var i = 0; i < tokens.length; i++) {
- c += tokens[i].value.length;
- if (c >= column)
- break;
- }
- }
- token = tokens[i];
- if (!token)
- return null;
- token.index = i;
- token.start = c - token.value.length;
- return token;
- };
-
- this.highlight = function(re) {
- if (!this.$searchHighlight) {
- var highlight = new SearchHighlight(null, "ace_selected_word", "text");
- this.$searchHighlight = this.addDynamicMarker(highlight);
- }
- this.$searchHighlight.setRegexp(re);
- }
- /**
- * EditSession.setUndoManager(undoManager)
- * - undoManager (UndoManager): The new undo manager
- *
- * Sets the undo manager.
- **/
- this.setUndoManager = function(undoManager) {
- this.$undoManager = undoManager;
- this.$deltas = [];
- this.$deltasDoc = [];
- this.$deltasFold = [];
-
- if (this.$informUndoManager)
- this.$informUndoManager.cancel();
-
- if (undoManager) {
- var self = this;
- this.$syncInformUndoManager = function() {
- self.$informUndoManager.cancel();
-
- if (self.$deltasFold.length) {
- self.$deltas.push({
- group: "fold",
- deltas: self.$deltasFold
- });
- self.$deltasFold = [];
- }
-
- if (self.$deltasDoc.length) {
- self.$deltas.push({
- group: "doc",
- deltas: self.$deltasDoc
- });
- self.$deltasDoc = [];
- }
-
- if (self.$deltas.length > 0) {
- undoManager.execute({
- action: "aceupdate",
- args: [self.$deltas, self]
- });
- }
-
- self.$deltas = [];
- }
- this.$informUndoManager =
- lang.deferredCall(this.$syncInformUndoManager);
- }
- };
-
- this.$defaultUndoManager = {
- undo: function() {},
- redo: function() {},
- reset: function() {}
- };
- this.getUndoManager = function() {
- return this.$undoManager || this.$defaultUndoManager;
- },
-
- /**
- * EditSession.getTabString() -> String
- *
- * Returns the current value for tabs. If the user is using soft tabs, this will be a series of spaces (defined by [[EditSession.getTabSize `getTabSize()`]]); otherwise it's simply `'\t'`.
- **/
- this.getTabString = function() {
- if (this.getUseSoftTabs()) {
- return lang.stringRepeat(" ", this.getTabSize());
- } else {
- return "\t";
- }
- };
-
- this.$useSoftTabs = true;
- this.setUseSoftTabs = function(useSoftTabs) {
- if (this.$useSoftTabs === useSoftTabs) return;
-
- this.$useSoftTabs = useSoftTabs;
- };
- this.getUseSoftTabs = function() {
- return this.$useSoftTabs;
- };
-
- this.$tabSize = 4;
- this.setTabSize = function(tabSize) {
- if (isNaN(tabSize) || this.$tabSize === tabSize) return;
-
- this.$modified = true;
- this.$rowLengthCache = [];
- this.$tabSize = tabSize;
- this._emit("changeTabSize");
- };
- this.getTabSize = function() {
- return this.$tabSize;
- };
- this.isTabStop = function(position) {
- return this.$useSoftTabs && (position.column % this.$tabSize == 0);
- };
-
- this.$overwrite = false;
- this.setOverwrite = function(overwrite) {
- if (this.$overwrite == overwrite) return;
-
- this.$overwrite = overwrite;
- this._emit("changeOverwrite");
- };
- this.getOverwrite = function() {
- return this.$overwrite;
- };
- this.toggleOverwrite = function() {
- this.setOverwrite(!this.$overwrite);
- };
- this.getBreakpoints = function() {
- return this.$breakpoints;
- };
- this.setBreakpoints = function(rows) {
- this.$breakpoints = [];
- for (var i=0; i<rows.length; i++) {
- this.$breakpoints[rows[i]] = true;
- }
- this._emit("changeBreakpoint", {});
- };
- this.clearBreakpoints = function() {
- this.$breakpoints = [];
- this._emit("changeBreakpoint", {});
- };
- this.setBreakpoint = function(row) {
- this.$breakpoints[row] = true;
- this._emit("changeBreakpoint", {});
- };
- this.clearBreakpoint = function(row) {
- delete this.$breakpoints[row];
- this._emit("changeBreakpoint", {});
- };
- this.addMarker = function(range, clazz, type, inFront) {
- var id = this.$markerId++;
-
- var marker = {
- range : range,
- type : type || "line",
- renderer: typeof type == "function" ? type : null,
- clazz : clazz,
- inFront: !!inFront,
- id: id
- }
-
- if (inFront) {
- this.$frontMarkers[id] = marker;
- this._emit("changeFrontMarker")
- } else {
- this.$backMarkers[id] = marker;
- this._emit("changeBackMarker")
- }
-
- return id;
- };
- this.addDynamicMarker = function(marker, inFront) {
- if (!marker.update)
- return;
- var id = this.$markerId++;
- marker.id = id;
- marker.inFront = !!inFront;
-
- if (inFront) {
- this.$frontMarkers[id] = marker;
- this._emit("changeFrontMarker")
- } else {
- this.$backMarkers[id] = marker;
- this._emit("changeBackMarker")
- }
-
- return marker;
- };
- this.removeMarker = function(markerId) {
- var marker = this.$frontMarkers[markerId] || this.$backMarkers[markerId];
- if (!marker)
- return;
-
- var markers = marker.inFront ? this.$frontMarkers : this.$backMarkers;
- if (marker) {
- delete (markers[markerId]);
- this._emit(marker.inFront ? "changeFrontMarker" : "changeBackMarker");
- }
- };
- this.getMarkers = function(inFront) {
- return inFront ? this.$frontMarkers : this.$backMarkers;
- };
- /**
- * EditSession.setAnnotations(annotations)
- * - annotations (Array): A list of annotations
- *
- * Sets annotations for the `EditSession`. This functions emits the `'changeAnnotation'` event.
- **/
- this.setAnnotations = function(annotations) {
- this.$annotations = {};
- for (var i=0; i<annotations.length; i++) {
- var annotation = annotations[i];
- var row = annotation.row;
- if (this.$annotations[row])
- this.$annotations[row].push(annotation);
- else
- this.$annotations[row] = [annotation];
- }
- this._emit("changeAnnotation", {});
- };
- this.getAnnotations = function() {
- return this.$annotations || {};
- };
- this.clearAnnotations = function() {
- this.$annotations = {};
- this._emit("changeAnnotation", {});
- };
- this.$detectNewLine = function(text) {
- var match = text.match(/^.*?(\r?\n)/m);
- if (match) {
- this.$autoNewLine = match[1];
- } else {
- this.$autoNewLine = "\n";
- }
- };
- this.getWordRange = function(row, column) {
- var line = this.getLine(row);
-
- var inToken = false;
- if (column > 0)
- inToken = !!line.charAt(column - 1).match(this.tokenRe);
-
- if (!inToken)
- inToken = !!line.charAt(column).match(this.tokenRe);
-
- if (inToken)
- var re = this.tokenRe;
- else if (/^\s+$/.test(line.slice(column-1, column+1)))
- var re = /\s/;
- else
- var re = this.nonTokenRe;
-
- var start = column;
- if (start > 0) {
- do {
- start--;
- }
- while (start >= 0 && line.charAt(start).match(re));
- start++;
- }
-
- var end = column;
- while (end < line.length && line.charAt(end).match(re)) {
- end++;
- }
-
- return new Range(row, start, row, end);
- };
- this.getAWordRange = function(row, column) {
- var wordRange = this.getWordRange(row, column);
- var line = this.getLine(wordRange.end.row);
-
- while (line.charAt(wordRange.end.column).match(/[ \t]/)) {
- wordRange.end.column += 1;
- }
- return wordRange;
- };
- this.setNewLineMode = function(newLineMode) {
- this.doc.setNewLineMode(newLineMode);
- };
- this.getNewLineMode = function() {
- return this.doc.getNewLineMode();
- };
-
- this.$useWorker = true;
- this.setUseWorker = function(useWorker) {
- if (this.$useWorker == useWorker)
- return;
-
- this.$useWorker = useWorker;
-
- this.$stopWorker();
- if (useWorker)
- this.$startWorker();
- };
- this.getUseWorker = function() {
- return this.$useWorker;
- };
- this.onReloadTokenizer = function(e) {
- var rows = e.data;
- this.bgTokenizer.start(rows.first);
- this._emit("tokenizerUpdate", e);
- };
-
- this.$modes = {};
- this._loadMode = function(mode, callback) {
- if (!this.$modes["null"])
- this.$modes["null"] = this.$modes["ace/mode/text"] = new TextMode();
-
- if (this.$modes[mode])
- return callback(this.$modes[mode]);
-
- var _self = this;
- var module;
- try {
- module = require(mode);
- } catch (e) {};
- // sometimes require returns empty object (this bug is present in requirejs 2 as well)
- if (module && module.Mode)
- return done(module);
-
- // set mode to text until loading is finished
- if (!this.$mode)
- this.$setModePlaceholder();
-
- fetch(function() {
- require([mode], done);
- });
-
- function done(module) {
- if (_self.$modes[mode])
- return callback(_self.$modes[mode]);
-
- _self.$modes[mode] = new module.Mode();
- _self.$modes[mode].$id = mode;
- _self._emit("loadmode", {
- name: mode,
- mode: _self.$modes[mode]
- });
- callback(_self.$modes[mode]);
- }
-
- function fetch(callback) {
- if (!config.get("packaged"))
- return callback();
-
- var base = mode.split("/").pop();
- var filename = config.get("modePath") + "/mode-" + base + ".js";
- net.loadScript(filename, callback);
- }
- };
-
- this.$setModePlaceholder = function() {
- this.$mode = this.$modes["null"];
- var tokenizer = this.$mode.getTokenizer();
-
- if (!this.bgTokenizer) {
- this.bgTokenizer = new BackgroundTokenizer(tokenizer);
- var _self = this;
- this.bgTokenizer.addEventListener("update", function(e) {
- _self._emit("tokenizerUpdate", e);
- });
- } else {
- this.bgTokenizer.setTokenizer(tokenizer);
- }
- this.bgTokenizer.setDocument(this.getDocument());
-
- this.tokenRe = this.$mode.tokenRe;
- this.nonTokenRe = this.$mode.nonTokenRe;
- };
- this.$mode = null;
- this.$modeId = null;
- this.setMode = function(mode) {
- mode = mode || "null";
- // load on demand
- if (typeof mode === "string") {
- if (this.$modeId == mode)
- return;
-
- this.$modeId = mode;
- var _self = this;
- this._loadMode(mode, function(module) {
- if (_self.$modeId !== mode)
- return;
-
- _self.setMode(module);
- });
- return;
- }
-
- if (this.$mode === mode) return;
- this.$mode = mode;
- this.$modeId = mode.$id;
-
- this.$stopWorker();
-
- if (this.$useWorker)
- this.$startWorker();
-
- var tokenizer = mode.getTokenizer();
-
- if(tokenizer.addEventListener !== undefined) {
- var onReloadTokenizer = this.onReloadTokenizer.bind(this);
- tokenizer.addEventListener("update", onReloadTokenizer);
- }
-
- if (!this.bgTokenizer) {
- this.bgTokenizer = new BackgroundTokenizer(tokenizer);
- var _self = this;
- this.bgTokenizer.addEventListener("update", function(e) {
- _self._emit("tokenizerUpdate", e);
- });
- } else {
- this.bgTokenizer.setTokenizer(tokenizer);
- }
-
- this.bgTokenizer.setDocument(this.getDocument());
- this.bgTokenizer.start(0);
-
- this.tokenRe = mode.tokenRe;
- this.nonTokenRe = mode.nonTokenRe;
-
- this.$setFolding(mode.foldingRules);
-
- this._emit("changeMode");
- };
- this.$stopWorker = function() {
- if (this.$worker)
- this.$worker.terminate();
-
- this.$worker = null;
- };
- this.$startWorker = function() {
- if (typeof Worker !== "undefined" && !require.noWorker) {
- try {
- this.$worker = this.$mode.createWorker(this);
- } catch (e) {
- console.log("Could not load worker");
- console.log(e);
- this.$worker = null;
- }
- }
- else
- this.$worker = null;
- };
- this.getMode = function() {
- return this.$mode;
- };
-
- this.$scrollTop = 0;
- this.setScrollTop = function(scrollTop) {
- scrollTop = Math.round(Math.max(0, scrollTop));
- if (this.$scrollTop === scrollTop)
- return;
-
- this.$scrollTop = scrollTop;
- this._emit("changeScrollTop", scrollTop);
- };
- this.getScrollTop = function() {
- return this.$scrollTop;
- };
-
- this.$scrollLeft = 0;
- this.setScrollLeft = function(scrollLeft) {
- scrollLeft = Math.round(Math.max(0, scrollLeft));
- if (this.$scrollLeft === scrollLeft)
- return;
-
- this.$scrollLeft = scrollLeft;
- this._emit("changeScrollLeft", scrollLeft);
- };
- this.getScrollLeft = function() {
- return this.$scrollLeft;
- };
- this.getScreenWidth = function() {
- this.$computeWidth();
- return this.screenWidth;
- };
-
- this.$computeWidth = function(force) {
- if (this.$modified || force) {
- this.$modified = false;
-
- if (this.$useWrapMode)
- return this.screenWidth = this.$wrapLimit;
-
- var lines = this.doc.getAllLines();
- var cache = this.$rowLengthCache;
- var longestScreenLine = 0;
- var foldIndex = 0;
- var foldLine = this.$foldData[foldIndex];
- var foldStart = foldLine ? foldLine.start.row : Infinity;
- var len = lines.length;
-
- for (var i = 0; i < len; i++) {
- if (i > foldStart) {
- i = foldLine.end.row + 1;
- if (i >= len)
- break
- foldLine = this.$foldData[foldIndex++];
- foldStart = foldLine ? foldLine.start.row : Infinity;
- }
-
- if (cache[i] == null)
- cache[i] = this.$getStringScreenWidth(lines[i])[0];
-
- if (cache[i] > longestScreenLine)
- longestScreenLine = cache[i];
- }
- this.screenWidth = longestScreenLine;
- }
- };
- this.getLine = function(row) {
- return this.doc.getLine(row);
- };
- this.getLines = function(firstRow, lastRow) {
- return this.doc.getLines(firstRow, lastRow);
- };
- this.getLength = function() {
- return this.doc.getLength();
- };
- this.getTextRange = function(range) {
- return this.doc.getTextRange(range || this.selection.getRange());
- };
- this.insert = function(position, text) {
- return this.doc.insert(position, text);
- };
- this.remove = function(range) {
- return this.doc.remove(range);
- };
- this.undoChanges = function(deltas, dontSelect) {
- if (!deltas.length)
- return;
-
- this.$fromUndo = true;
- var lastUndoRange = null;
- for (var i = deltas.length - 1; i != -1; i--) {
- var delta = deltas[i];
- if (delta.group == "doc") {
- this.doc.revertDeltas(delta.deltas);
- lastUndoRange =
- this.$getUndoSelection(delta.deltas, true, lastUndoRange);
- } else {
- delta.deltas.forEach(function(foldDelta) {
- this.addFolds(foldDelta.folds);
- }, this);
- }
- }
- this.$fromUndo = false;
- lastUndoRange &&
- this.$undoSelect &&
- !dontSelect &&
- this.selection.setSelectionRange(lastUndoRange);
- return lastUndoRange;
- };
- this.redoChanges = function(deltas, dontSelect) {
- if (!deltas.length)
- return;
-
- this.$fromUndo = true;
- var lastUndoRange = null;
- for (var i = 0; i < deltas.length; i++) {
- var delta = deltas[i];
- if (delta.group == "doc") {
- this.doc.applyDeltas(delta.deltas);
- lastUndoRange =
- this.$getUndoSelection(delta.deltas, false, lastUndoRange);
- }
- }
- this.$fromUndo = false;
- lastUndoRange &&
- this.$undoSelect &&
- !dontSelect &&
- this.selection.setSelectionRange(lastUndoRange);
- return lastUndoRange;
- };
- this.setUndoSelect = function(enable) {
- this.$undoSelect = enable;
- };
- this.$getUndoSelection = function(deltas, isUndo, lastUndoRange) {
- function isInsert(delta) {
- var insert =
- delta.action == "insertText" || delta.action == "insertLines";
- return isUndo ? !insert : insert;
- }
-
- var delta = deltas[0];
- var range, point;
- var lastDeltaIsInsert = false;
- if (isInsert(delta)) {
- range = delta.range.clone();
- lastDeltaIsInsert = true;
- } else {
- range = Range.fromPoints(delta.range.start, delta.range.start);
- lastDeltaIsInsert = false;
- }
-
- for (var i = 1; i < deltas.length; i++) {
- delta = deltas[i];
- if (isInsert(delta)) {
- point = delta.range.start;
- if (range.compare(point.row, point.column) == -1) {
- range.setStart(delta.range.start);
- }
- point = delta.range.end;
- if (range.compare(point.row, point.column) == 1) {
- range.setEnd(delta.range.end);
- }
- lastDeltaIsInsert = true;
- } else {
- point = delta.range.start;
- if (range.compare(point.row, point.column) == -1) {
- range =
- Range.fromPoints(delta.range.start, delta.range.start);
- }
- lastDeltaIsInsert = false;
- }
- }
-
- // Check if this range and the last undo range has something in common.
- // If true, merge the ranges.
- if (lastUndoRange != null) {
- var cmp = lastUndoRange.compareRange(range);
- if (cmp == 1) {
- range.setStart(lastUndoRange.start);
- } else if (cmp == -1) {
- range.setEnd(lastUndoRange.end);
- }
- }
-
- return range;
- },
-
- /** related to: Document.replace
- * EditSession.replace(range, text) -> Object
- * - range (Range): A specified Range to replace
- * - text (String): The new text to use as a replacement
- * + (Object): Returns an object containing the final row and column, like this:<br/>
- * ```{row: endRow, column: 0}```<br/>
- * If the text and range are empty, this function returns an object containing the current `range.start` value.<br/>
- * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
- *
- * Replaces a range in the document with the new `text`.
- *
- *
- *
- **/
- this.replace = function(range, text) {
- return this.doc.replace(range, text);
- };
- this.moveText = function(fromRange, toPosition) {
- var text = this.getTextRange(fromRange);
- this.remove(fromRange);
-
- var toRow = toPosition.row;
- var toColumn = toPosition.column;
-
- // Make sure to update the insert location, when text is removed in
- // front of the chosen point of insertion.
- if (!fromRange.isMultiLine() && fromRange.start.row == toRow &&
- fromRange.end.column < toColumn)
- toColumn -= text.length;
-
- if (fromRange.isMultiLine() && fromRange.end.row < toRow) {
- var lines = this.doc.$split(text);
- toRow -= lines.length - 1;
- }
-
- var endRow = toRow + fromRange.end.row - fromRange.start.row;
- var endColumn = fromRange.isMultiLine() ?
- fromRange.end.column :
- toColumn + fromRange.end.column - fromRange.start.column;
-
- var toRange = new Range(toRow, toColumn, endRow, endColumn);
-
- this.insert(toRange.start, text);
-
- return toRange;
- };
- this.indentRows = function(startRow, endRow, indentString) {
- indentString = indentString.replace(/\t/g, this.getTabString());
- for (var row=startRow; row<=endRow; row++)
- this.insert({row: row, column:0}, indentString);
- };
- this.outdentRows = function (range) {
- var rowRange = range.collapseRows();
- var deleteRange = new Range(0, 0, 0, 0);
- var size = this.getTabSize();
-
- for (var i = rowRange.start.row; i <= rowRange.end.row; ++i) {
- var line = this.getLine(i);
-
- deleteRange.start.row = i;
- deleteRange.end.row = i;
- for (var j = 0; j < size; ++j)
- if (line.charAt(j) != ' ')
- break;
- if (j < size && line.charAt(j) == '\t') {
- deleteRange.start.column = j;
- deleteRange.end.column = j + 1;
- } else {
- deleteRange.start.column = 0;
- deleteRange.end.column = j;
- }
- this.remove(deleteRange);
- }
- };
- this.moveLinesUp = function(firstRow, lastRow) {
- if (firstRow <= 0) return 0;
-
- var removed = this.doc.removeLines(firstRow, lastRow);
- this.doc.insertLines(firstRow - 1, removed);
- return -1;
- };
- this.moveLinesDown = function(firstRow, lastRow) {
- if (lastRow >= this.doc.getLength()-1) return 0;
-
- var removed = this.doc.removeLines(firstRow, lastRow);
- this.doc.insertLines(firstRow+1, removed);
- return 1;
- };
- this.duplicateLines = function(firstRow, lastRow) {
- var firstRow = this.$clipRowToDocument(firstRow);
- var lastRow = this.$clipRowToDocument(lastRow);
-
- var lines = this.getLines(firstRow, lastRow);
- this.doc.insertLines(firstRow, lines);
-
- var addedRows = lastRow - firstRow + 1;
- return addedRows;
- };
-
-
- this.$clipRowToDocument = function(row) {
- return Math.max(0, Math.min(row, this.doc.getLength()-1));
- };
-
- this.$clipColumnToRow = function(row, column) {
- if (column < 0)
- return 0;
- return Math.min(this.doc.getLine(row).length, column);
- };
-
-
- this.$clipPositionToDocument = function(row, column) {
- column = Math.max(0, column);
-
- if (row < 0) {
- row = 0;
- column = 0;
- } else {
- var len = this.doc.getLength();
- if (row >= len) {
- row = len - 1;
- column = this.doc.getLine(len-1).length;
- } else {
- column = Math.min(this.doc.getLine(row).length, column);
- }
- }
-
- return {
- row: row,
- column: column
- };
- };
-
- this.$clipRangeToDocument = function(range) {
- if (range.start.row < 0) {
- range.start.row = 0;
- range.start.column = 0
- } else {
- range.start.column = this.$clipColumnToRow(
- range.start.row,
- range.start.column
- );
- }
-
- var len = this.doc.getLength() - 1;
- if (range.end.row > len) {
- range.end.row = len;
- range.end.column = this.doc.getLine(len).length;
- } else {
- range.end.column = this.$clipColumnToRow(
- range.end.row,
- range.end.column
- );
- }
- return range;
- };
-
- // WRAPMODE
- this.$wrapLimit = 80;
- this.$useWrapMode = false;
- this.$wrapLimitRange = {
- min : null,
- max : null
- };
- this.setUseWrapMode = function(useWrapMode) {
- if (useWrapMode != this.$useWrapMode) {
- this.$useWrapMode = useWrapMode;
- this.$modified = true;
- this.$resetRowCache(0);
-
- // If wrapMode is activaed, the wrapData array has to be initialized.
- if (useWrapMode) {
- var len = this.getLength();
- this.$wrapData = [];
- for (var i = 0; i < len; i++) {
- this.$wrapData.push([]);
- }
- this.$updateWrapData(0, len - 1);
- }
-
- this._emit("changeWrapMode");
- }
- };
- this.getUseWrapMode = function() {
- return this.$useWrapMode;
- };
-
- // Allow the wrap limit to move freely between min and max. Either
- // parameter can be null to allow the wrap limit to be unconstrained
- // in that direction. Or set both parameters to the same number to pin
- // the limit to that value.
- /**
- * EditSession.setWrapLimitRange(min, max)
- * - min (Number): The minimum wrap value (the left side wrap)
- * - max (Number): The maximum wrap value (the right side wrap)
- *
- * Sets the boundaries of wrap. Either value can be `null` to have an unconstrained wrap, or, they can be the same number to pin the limit. If the wrap limits for `min` or `max` are different, this method also emits the `'changeWrapMode'` event.
- **/
- this.setWrapLimitRange = function(min, max) {
- if (this.$wrapLimitRange.min !== min || this.$wrapLimitRange.max !== max) {
- this.$wrapLimitRange.min = min;
- this.$wrapLimitRange.max = max;
- this.$modified = true;
- // This will force a recalculation of the wrap limit
- this._emit("changeWrapMode");
- }
- };
- this.adjustWrapLimit = function(desiredLimit) {
- var wrapLimit = this.$constrainWrapLimit(desiredLimit);
- if (wrapLimit != this.$wrapLimit && wrapLimit > 0) {
- this.$wrapLimit = wrapLimit;
- this.$modified = true;
- if (this.$useWrapMode) {
- this.$updateWrapData(0, this.getLength() - 1);
- this.$resetRowCache(0)
- this._emit("changeWrapLimit");
- }
- return true;
- }
- return false;
- };
- this.$constrainWrapLimit = function(wrapLimit) {
- var min = this.$wrapLimitRange.min;
- if (min)
- wrapLimit = Math.max(min, wrapLimit);
-
- var max = this.$wrapLimitRange.max;
- if (max)
- wrapLimit = Math.min(max, wrapLimit);
-
- // What would a limit of 0 even mean?
- return Math.max(1, wrapLimit);
- };
- this.getWrapLimit = function() {
- return this.$wrapLimit;
- };
- this.getWrapLimitRange = function() {
- // Avoid unexpected mutation by returning a copy
- return {
- min : this.$wrapLimitRange.min,
- max : this.$wrapLimitRange.max
- };
- };
- this.$updateInternalDataOnChange = function(e) {
- var useWrapMode = this.$useWrapMode;
- var len;
- var action = e.data.action;
- var firstRow = e.data.range.start.row;
- var lastRow = e.data.range.end.row;
- var start = e.data.range.start;
- var end = e.data.range.end;
- var removedFolds = null;
-
- if (action.indexOf("Lines") != -1) {
- if (action == "insertLines") {
- lastRow = firstRow + (e.data.lines.length);
- } else {
- lastRow = firstRow;
- }
- len = e.data.lines ? e.data.lines.length : lastRow - firstRow;
- } else {
- len = lastRow - firstRow;
- }
-
- if (len != 0) {
- if (action.indexOf("remove") != -1) {
- this[useWrapMode ? "$wrapData" : "$rowLengthCache"].splice(firstRow, len);
-
- var foldLines = this.$foldData;
- removedFolds = this.getFoldsInRange(e.data.range);
- this.removeFolds(removedFolds);
-
- var foldLine = this.getFoldLine(end.row);
- var idx = 0;
- if (foldLine) {
- foldLine.addRemoveChars(end.row, end.column, start.column - end.column);
- foldLine.shiftRow(-len);
-
- var foldLineBefore = this.getFoldLine(firstRow);
- if (foldLineBefore && foldLineBefore !== foldLine) {
- foldLineBefore.merge(foldLine);
- foldLine = foldLineBefore;
- }
- idx = foldLines.indexOf(foldLine) + 1;
- }
-
- for (idx; idx < foldLines.length; idx++) {
- var foldLine = foldLines[idx];
- if (foldLine.start.row >= end.row) {
- foldLine.shiftRow(-len);
- }
- }
-
- lastRow = firstRow;
- } else {
- var args;
- if (useWrapMode) {
- args = [firstRow, 0];
- for (var i = 0; i < len; i++) args.push([]);
- this.$wrapData.splice.apply(this.$wrapData, args);
- } else {
- args = Array(len);
- args.unshift(firstRow, 0);
- this.$rowLengthCache.splice.apply(this.$rowLengthCache, args);
- }
-
- // If some new line is added inside of a foldLine, then split
- // the fold line up.
- var foldLines = this.$foldData;
- var foldLine = this.getFoldLine(firstRow);
- var idx = 0;
- if (foldLine) {
- var cmp = foldLine.range.compareInside(start.row, start.column)
- // Inside of the foldLine range. Need to split stuff up.
- if (cmp == 0) {
- foldLine = foldLine.split(start.row, start.column);
- foldLine.shiftRow(len);
- foldLine.addRemoveChars(
- lastRow, 0, end.column - start.column);
- } else
- // Infront of the foldLine but same row. Need to shift column.
- if (cmp == -1) {
- foldLine.addRemoveChars(firstRow, 0, end.column - start.column);
- foldLine.shiftRow(len);
- }
- // Nothing to do if the insert is after the foldLine.
- idx = foldLines.indexOf(foldLine) + 1;
- }
-
- for (idx; idx < foldLines.length; idx++) {
- var foldLine = foldLines[idx];
- if (foldLine.start.row >= firstRow) {
- foldLine.shiftRow(len);
- }
- }
- }
- } else {
- // Realign folds. E.g. if you add some new chars before a fold, the
- // fold should "move" to the right.
- len = Math.abs(e.data.range.start.column - e.data.range.end.column);
- if (action.indexOf("remove") != -1) {
- // Get all the folds in the change range and remove them.
- removedFolds = this.getFoldsInRange(e.data.range);
- this.removeFolds(removedFolds);
-
- len = -len;
- }
- var foldLine = this.getFoldLine(firstRow);
- if (foldLine) {
- foldLine.addRemoveChars(firstRow, start.column, len);
- }
- }
-
- if (useWrapMode && this.$wrapData.length != this.doc.getLength()) {
- console.error("doc.getLength() and $wrapData.length have to be the same!");
- }
-
- if (useWrapMode)
- this.$updateWrapData(firstRow, lastRow);
- else
- this.$updateRowLengthCache(firstRow, lastRow);
-
- return removedFolds;
- };
-
- this.$updateRowLengthCache = function(firstRow, lastRow, b) {
- //console.log(firstRow, lastRow, b)
- this.$rowLengthCache[firstRow] = null;
- this.$rowLengthCache[lastRow] = null;
- //console.log(this.$rowLengthCache)
- };
- this.$updateWrapData = function(firstRow, lastRow) {
- var lines = this.doc.getAllLines();
- var tabSize = this.getTabSize();
- var wrapData = this.$wrapData;
- var wrapLimit = this.$wrapLimit;
- var tokens;
- var foldLine;
-
- var row = firstRow;
- lastRow = Math.min(lastRow, lines.length - 1);
- while (row <= lastRow) {
- foldLine = this.getFoldLine(row, foldLine);
- if (!foldLine) {
- tokens = this.$getDisplayTokens(lang.stringTrimRight(lines[row]));
- wrapData[row] = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
- row ++;
- } else {
- tokens = [];
- foldLine.walk(
- function(placeholder, row, column, lastColumn) {
- var walkTokens;
- if (placeholder) {
- walkTokens = this.$getDisplayTokens(
- placeholder, tokens.length);
- walkTokens[0] = PLACEHOLDER_START;
- for (var i = 1; i < walkTokens.length; i++) {
- walkTokens[i] = PLACEHOLDER_BODY;
- }
- } else {
- walkTokens = this.$getDisplayTokens(
- lines[row].substring(lastColumn, column),
- tokens.length);
- }
- tokens = tokens.concat(walkTokens);
- }.bind(this),
- foldLine.end.row,
- lines[foldLine.end.row].length + 1
- );
- // Remove spaces/tabs from the back of the token array.
- while (tokens.length != 0 && tokens[tokens.length - 1] >= SPACE)
- tokens.pop();
-
- wrapData[foldLine.start.row]
- = this.$computeWrapSplits(tokens, wrapLimit, tabSize);
- row = foldLine.end.row + 1;
- }
- }
- };
-
- // "Tokens"
- var CHAR = 1,
- CHAR_EXT = 2,
- PLACEHOLDER_START = 3,
- PLACEHOLDER_BODY = 4,
- PUNCTUATION = 9,
- SPACE = 10,
- TAB = 11,
- TAB_SPACE = 12;
- this.$computeWrapSplits = function(tokens, wrapLimit) {
- if (tokens.length == 0) {
- return [];
- }
-
- var splits = [];
- var displayLength = tokens.length;
- var lastSplit = 0, lastDocSplit = 0;
-
- function addSplit(screenPos) {
- var displayed = tokens.slice(lastSplit, screenPos);
-
- // The document size is the current size - the extra width for tabs
- // and multipleWidth characters.
- var len = displayed.length;
- displayed.join("").
- // Get all the TAB_SPACEs.
- replace(/12/g, function() {
- len -= 1;
- }).
- // Get all the CHAR_EXT/multipleWidth characters.
- replace(/2/g, function() {
- len -= 1;
- });
-
- lastDocSplit += len;
- splits.push(lastDocSplit);
- lastSplit = screenPos;
- }
-
- while (displayLength - lastSplit > wrapLimit) {
- // This is, where the split should be.
- var split = lastSplit + wrapLimit;
-
- // If there is a space or tab at this split position, then making
- // a split is simple.
- if (tokens[split] >= SPACE) {
- // Include all following spaces + tabs in this split as well.
- while (tokens[split] >= SPACE) {
- split ++;
- }
- addSplit(split);
- continue;
- }
-
- // === ELSE ===
- // Check if split is inside of a placeholder. Placeholder are
- // not splitable. Therefore, seek the beginning of the placeholder
- // and try to place the split beofre the placeholder's start.
- if (tokens[split] == PLACEHOLDER_START
- || tokens[split] == PLACEHOLDER_BODY)
- {
- // Seek the start of the placeholder and do the split
- // before the placeholder. By definition there always
- // a PLACEHOLDER_START between split and lastSplit.
- for (split; split != lastSplit - 1; split--) {
- if (tokens[split] == PLACEHOLDER_START) {
- // split++; << No incremental here as we want to
- // have the position before the Placeholder.
- break;
- }
- }
-
- // If the PLACEHOLDER_START is not the index of the
- // last split, then we can do the split
- if (split > lastSplit) {
- addSplit(split);
- continue;
- }
-
- // If the PLACEHOLDER_START IS the index of the last
- // split, then we have to place the split after the
- // placeholder. So, let's seek for the end of the placeholder.
- split = lastSplit + wrapLimit;
- for (split; split < tokens.length; split++) {
- if (tokens[split] != PLACEHOLDER_BODY)
- {
- break;
- }
- }
-
- // If spilt == tokens.length, then the placeholder is the last
- // thing in the line and adding a new split doesn't make sense.
- if (split == tokens.length) {
- break; // Breaks the while-loop.
- }
-
- // Finally, add the split...
- addSplit(split);
- continue;
- }
-
- // === ELSE ===
- // Search for the first non space/tab/placeholder/punctuation token backwards.
- var minSplit = Math.max(split - 10, lastSplit - 1);
- while (split > minSplit && tokens[split] < PLACEHOLDER_START) {
- split --;
- }
- while (split > minSplit && tokens[split] == PUNCTUATION) {
- split --;
- }
- // If we found one, then add the split.
- if (split > minSplit) {
- addSplit(++split);
- continue;
- }
-
- // === ELSE ===
- split = lastSplit + wrapLimit;
- // The split is inside of a CHAR or CHAR_EXT token and no space
- // around -> force a split.
- addSplit(split);
- }
- return splits;
- }
-
- /** internal, hide
- * EditSession.$getDisplayTokens(str, offset) -> Array
- * - str (String): The string to check
- * - offset (Number): The value to start at
- *
- * Given a string, returns an array of the display characters, including tabs and spaces.
- **/
- this.$getDisplayTokens = function(str, offset) {
- var arr = [];
- var tabSize;
- offset = offset || 0;
-
- for (var i = 0; i < str.length; i++) {
- var c = str.charCodeAt(i);
- // Tab
- if (c == 9) {
- tabSize = this.getScreenTabSize(arr.length + offset);
- arr.push(TAB);
- for (var n = 1; n < tabSize; n++) {
- arr.push(TAB_SPACE);
- }
- }
- // Space
- else if (c == 32) {
- arr.push(SPACE);
- } else if((c > 39 && c < 48) || (c > 57 && c < 64)) {
- arr.push(PUNCTUATION);
- }
- // full width characters
- else if (c >= 0x1100 && isFullWidth(c)) {
- arr.push(CHAR, CHAR_EXT);
- } else {
- arr.push(CHAR);
- }
- }
- return arr;
- }
-
- /** internal, hide
- * EditSession.$getStringScreenWidth(str, maxScreenColumn, screenColumn) -> [Number]
- * - str (String): The string to calculate the screen width of
- * - maxScreenColumn (Number):
- * - screenColumn (Number):
- * + ([Number]): Returns an `int[]` array with two elements:<br/>
- * The first position indicates the number of columns for `str` on screen.<br/>
- * The second value contains the position of the document column that this function read until.
- *
- * Calculates the width of the string `str` on the screen while assuming that the string starts at the first column on the screen.
- *
- *
- **/
- this.$getStringScreenWidth = function(str, maxScreenColumn, screenColumn) {
- if (maxScreenColumn == 0)
- return [0, 0];
- if (maxScreenColumn == null)
- maxScreenColumn = Infinity;
- screenColumn = screenColumn || 0;
-
- var c, column;
- for (column = 0; column < str.length; column++) {
- c = str.charCodeAt(column);
- // tab
- if (c == 9) {
- screenColumn += this.getScreenTabSize(screenColumn);
- }
- // full width characters
- else if (c >= 0x1100 && isFullWidth(c)) {
- screenColumn += 2;
- } else {
- screenColumn += 1;
- }
- if (screenColumn > maxScreenColumn) {
- break
- }
- }
-
- return [screenColumn, column];
- }
-
- /**
- * EditSession.getRowLength(row) -> Number
- * - row (Number): The row number to check
- *
- *
- * Returns the length of the indicated row.
- **/
- this.getRowLength = function(row) {
- if (!this.$useWrapMode || !this.$wrapData[row]) {
- return 1;
- } else {
- return this.$wrapData[row].length + 1;
- }
- }
-
- /**
- * EditSession.getRowHeight(config, row) -> Number
- * - config (Object): An object containing a parameter indicating the `lineHeight`.
- * - row (Number): The row number to check
- *
- * Returns the height of the indicated row. This is mostly relevant for situations where wrapping occurs, and a single line spans across multiple rows.
- *
- **/
- this.getRowHeight = function(config, row) {
- return this.getRowLength(row) * config.lineHeight;
- }
-
- /** internal, hide, related to: EditSession.documentToScreenColumn
- * EditSession.getScreenLastRowColumn(screenRow) -> Number
- * - screenRow (Number): The screen row to check
- *
- * Returns the column position (on screen) for the last character in the provided row.
- **/
- this.getScreenLastRowColumn = function(screenRow) {
- var pos = this.screenToDocumentPosition(screenRow, Number.MAX_VALUE)
- return this.documentToScreenColumn(pos.row, pos.column);
- };
- this.getDocumentLastRowColumn = function(docRow, docColumn) {
- var screenRow = this.documentToScreenRow(docRow, docColumn);
- return this.getScreenLastRowColumn(screenRow);
- };
- this.getDocumentLastRowColumnPosition = function(docRow, docColumn) {
- var screenRow = this.documentToScreenRow(docRow, docColumn);
- return this.screenToDocumentPosition(screenRow, Number.MAX_VALUE / 10);
- };
- this.getRowSplitData = function(row) {
- if (!this.$useWrapMode) {
- return undefined;
- } else {
- return this.$wrapData[row];
- }
- };
- this.getScreenTabSize = function(screenColumn) {
- return this.$tabSize - screenColumn % this.$tabSize;
- };
- this.screenToDocumentRow = function(screenRow, screenColumn) {
- return this.screenToDocumentPosition(screenRow, screenColumn).row;
- };
- this.screenToDocumentColumn = function(screenRow, screenColumn) {
- return this.screenToDocumentPosition(screenRow, screenColumn).column;
- };
- this.screenToDocumentPosition = function(screenRow, screenColumn) {
- if (screenRow < 0)
- return {row: 0, column: 0};
-
- var line;
- var docRow = 0;
- var docColumn = 0;
- var column;
- var row = 0;
- var rowLength = 0;
-
- var rowCache = this.$screenRowCache;
- var i = this.$getRowCacheIndex(rowCache, screenRow);
- var row1 = rowCache[i];
- var docRow1 = this.$docRowCache[i];
- if (0 < i && i < rowCache.length) {
- var row = rowCache[i];
- var docRow = this.$docRowCache[i];
- var doCache = screenRow > row || (screenRow == row && i == rowCache.length - 1);
- } else {
- var doCache = true;
- }
-
- var maxRow = this.getLength() - 1;
- var foldLine = this.getNextFoldLine(docRow);
- var foldStart = foldLine ? foldLine.start.row : Infinity;
-
- while (row <= screenRow) {
- rowLength = this.getRowLength(docRow);
- if (row + rowLength - 1 >= screenRow || docRow >= maxRow) {
- break;
- } else {
- row += rowLength;
- docRow++;
- if (docRow > foldStart) {
- docRow = foldLine.end.row+1;
- foldLine = this.getNextFoldLine(docRow, foldLine);
- foldStart = foldLine ? foldLine.start.row : Infinity;
- }
- }
- if (doCache) {
- this.$docRowCache.push(docRow);
- this.$screenRowCache.push(row);
- }
- }
-
- if (foldLine && foldLine.start.row <= docRow) {
- line = this.getFoldDisplayLine(foldLine);
- docRow = foldLine.start.row;
- } else if (row + rowLength <= screenRow || docRow > maxRow) {
- // clip at the end of the document
- return {
- row: maxRow,
- column: this.getLine(maxRow).length
- }
- } else {
- line = this.getLine(docRow);
- foldLine = null;
- }
-
- if (this.$useWrapMode) {
- var splits = this.$wrapData[docRow];
- if (splits) {
- column = splits[screenRow - row];
- if(screenRow > row && splits.length) {
- docColumn = splits[screenRow - row - 1] || splits[splits.length - 1];
- line = line.substring(docColumn);
- }
- }
- }
-
- docColumn += this.$getStringScreenWidth(line, screenColumn)[1];
-
- // We remove one character at the end so that the docColumn
- // position returned is not associated to the next row on the screen.
- if (this.$useWrapMode && docColumn >= column)
- docColumn = column - 1;
-
- if (foldLine)
- return foldLine.idxToPosition(docColumn);
-
- return {row: docRow, column: docColumn};
- };
- this.documentToScreenPosition = function(docRow, docColumn) {
- // Normalize the passed in arguments.
- if (typeof docColumn === "undefined")
- var pos = this.$clipPositionToDocument(docRow.row, docRow.column);
- else
- pos = this.$clipPositionToDocument(docRow, docColumn);
-
- docRow = pos.row;
- docColumn = pos.column;
-
- var screenRow = 0;
- var foldStartRow = null;
- var fold = null;
-
- // Clamp the docRow position in case it's inside of a folded block.
- fold = this.getFoldAt(docRow, docColumn, 1);
- if (fold) {
- docRow = fold.start.row;
- docColumn = fold.start.column;
- }
-
- var rowEnd, row = 0;
-
-
- var rowCache = this.$docRowCache;
- var i = this.$getRowCacheIndex(rowCache, docRow);
- if (0 < i && i < rowCache.length) {
- var row = rowCache[i];
- var screenRow = this.$screenRowCache[i];
- var doCache = docRow > row || (docRow == row && i == rowCache.length - 1);
- } else {
- var doCache = true;
- }
-
- var foldLine = this.getNextFoldLine(row);
- var foldStart = foldLine ?foldLine.start.row :Infinity;
-
- while (row < docRow) {
- if (row >= foldStart) {
- rowEnd = foldLine.end.row + 1;
- if (rowEnd > docRow)
- break;
- foldLine = this.getNextFoldLine(rowEnd, foldLine);
- foldStart = foldLine ?foldLine.start.row :Infinity;
- }
- else {
- rowEnd = row + 1;
- }
-
- screenRow += this.getRowLength(row);
- row = rowEnd;
-
- if (doCache) {
- this.$docRowCache.push(row);
- this.$screenRowCache.push(screenRow);
- }
- }
-
- // Calculate the text line that is displayed in docRow on the screen.
- var textLine = "";
- // Check if the final row we want to reach is inside of a fold.
- if (foldLine && row >= foldStart) {
- textLine = this.getFoldDisplayLine(foldLine, docRow, docColumn);
- foldStartRow = foldLine.start.row;
- } else {
- textLine = this.getLine(docRow).substring(0, docColumn);
- foldStartRow = docRow;
- }
- // Clamp textLine if in wrapMode.
- if (this.$useWrapMode) {
- var wrapRow = this.$wrapData[foldStartRow];
- var screenRowOffset = 0;
- while (textLine.length >= wrapRow[screenRowOffset]) {
- screenRow ++;
- screenRowOffset++;
- }
- textLine = textLine.substring(
- wrapRow[screenRowOffset - 1] || 0, textLine.length
- );
- }
-
- return {
- row: screenRow,
- column: this.$getStringScreenWidth(textLine)[0]
- };
- };
- this.documentToScreenColumn = function(row, docColumn) {
- return this.documentToScreenPosition(row, docColumn).column;
- };
- this.documentToScreenRow = function(docRow, docColumn) {
- return this.documentToScreenPosition(docRow, docColumn).row;
- };
- this.getScreenLength = function() {
- var screenRows = 0;
- var fold = null;
- if (!this.$useWrapMode) {
- screenRows = this.getLength();
-
- // Remove the folded lines again.
- var foldData = this.$foldData;
- for (var i = 0; i < foldData.length; i++) {
- fold = foldData[i];
- screenRows -= fold.end.row - fold.start.row;
- }
- } else {
- var lastRow = this.$wrapData.length;
- var row = 0, i = 0;
- var fold = this.$foldData[i++];
- var foldStart = fold ? fold.start.row :Infinity;
-
- while (row < lastRow) {
- screenRows += this.$wrapData[row].length + 1;
- row ++;
- if (row > foldStart) {
- row = fold.end.row+1;
- fold = this.$foldData[i++];
- foldStart = fold ?fold.start.row :Infinity;
- }
- }
- }
-
- return screenRows;
- }
-
- // For every keystroke this gets called once per char in the whole doc!!
- // Wouldn't hurt to make it a bit faster for c >= 0x1100
- function isFullWidth(c) {
- if (c < 0x1100)
- return false;
- return c >= 0x1100 && c <= 0x115F ||
- c >= 0x11A3 && c <= 0x11A7 ||
- c >= 0x11FA && c <= 0x11FF ||
- c >= 0x2329 && c <= 0x232A ||
- c >= 0x2E80 && c <= 0x2E99 ||
- c >= 0x2E9B && c <= 0x2EF3 ||
- c >= 0x2F00 && c <= 0x2FD5 ||
- c >= 0x2FF0 && c <= 0x2FFB ||
- c >= 0x3000 && c <= 0x303E ||
- c >= 0x3041 && c <= 0x3096 ||
- c >= 0x3099 && c <= 0x30FF ||
- c >= 0x3105 && c <= 0x312D ||
- c >= 0x3131 && c <= 0x318E ||
- c >= 0x3190 && c <= 0x31BA ||
- c >= 0x31C0 && c <= 0x31E3 ||
- c >= 0x31F0 && c <= 0x321E ||
- c >= 0x3220 && c <= 0x3247 ||
- c >= 0x3250 && c <= 0x32FE ||
- c >= 0x3300 && c <= 0x4DBF ||
- c >= 0x4E00 && c <= 0xA48C ||
- c >= 0xA490 && c <= 0xA4C6 ||
- c >= 0xA960 && c <= 0xA97C ||
- c >= 0xAC00 && c <= 0xD7A3 ||
- c >= 0xD7B0 && c <= 0xD7C6 ||
- c >= 0xD7CB && c <= 0xD7FB ||
- c >= 0xF900 && c <= 0xFAFF ||
- c >= 0xFE10 && c <= 0xFE19 ||
- c >= 0xFE30 && c <= 0xFE52 ||
- c >= 0xFE54 && c <= 0xFE66 ||
- c >= 0xFE68 && c <= 0xFE6B ||
- c >= 0xFF01 && c <= 0xFF60 ||
- c >= 0xFFE0 && c <= 0xFFE6;
- };
-
- }).call(EditSession.prototype);
-
- require("./edit_session/folding").Folding.call(EditSession.prototype);
- require("./edit_session/bracket_match").BracketMatch.call(EditSession.prototype);
-
- exports.EditSession = EditSession;
- });
-
- ace.define('ace/config', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
- "no use strict";
-
- var lang = require("./lib/lang");
-
- var global = (function() {
- return this;
- })();
-
- var options = {
- packaged: false,
- workerPath: "",
- modePath: "",
- themePath: "",
- suffix: ".js"
- };
-
- exports.get = function(key) {
- if (!options.hasOwnProperty(key))
- throw new Error("Unknown config key: " + key);
-
- return options[key];
- };
-
- exports.set = function(key, value) {
- if (!options.hasOwnProperty(key))
- throw new Error("Unknown config key: " + key);
-
- options[key] = value;
- };
-
- exports.all = function() {
- return lang.copyObject(options);
- };
-
- exports.init = function() {
- options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
-
- if (!global.document)
- return "";
-
- var scriptOptions = {};
- var scriptUrl = "";
-
- var scripts = document.getElementsByTagName("script");
- for (var i=0; i<scripts.length; i++) {
- var script = scripts[i];
-
- var src = script.src || script.getAttribute("src");
- if (!src) {
- continue;
- }
-
- var attributes = script.attributes;
- for (var j=0, l=attributes.length; j < l; j++) {
- var attr = attributes[j];
- if (attr.name.indexOf("data-ace-") === 0) {
- scriptOptions[deHyphenate(attr.name.replace(/^data-ace-/, ""))] = attr.value;
- }
- }
-
- var m = src.match(/^(?:(.*\/)ace\.js)(?:\?|$)/);
- if (m) {
- scriptUrl = m[1] || m[2];
- }
- }
-
- if (scriptUrl) {
- scriptOptions.base = scriptOptions.base || scriptUrl;
- scriptOptions.packaged = true;
- }
-
- scriptOptions.workerPath = scriptOptions.workerPath || scriptOptions.base;
- scriptOptions.modePath = scriptOptions.modePath || scriptOptions.base;
- scriptOptions.themePath = scriptOptions.themePath || scriptOptions.base;
- delete scriptOptions.base;
-
- for (var key in scriptOptions)
- if (typeof scriptOptions[key] !== "undefined")
- exports.set(key, scriptOptions[key]);
- };
-
- function deHyphenate(str) {
- return str.replace(/-(.)/g, function(m, m1) { return m1.toUpperCase(); });
- }
-
- });
- ace.define('ace/lib/net', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- exports.get = function (url, callback) {
- var xhr = exports.createXhr();
- xhr.open('GET', url, true);
- xhr.onreadystatechange = function (evt) {
- //Do not explicitly handle errors, those should be
- //visible via console output in the browser.
- if (xhr.readyState === 4) {
- callback(xhr.responseText);
- }
- };
- xhr.send(null);
- };
-
- var progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'];
-
- exports.createXhr = function() {
- //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
- var xhr, i, progId;
- if (typeof XMLHttpRequest !== "undefined") {
- return new XMLHttpRequest();
- } else {
- for (i = 0; i < 3; i++) {
- progId = progIds[i];
- try {
- xhr = new ActiveXObject(progId);
- } catch (e) {}
-
- if (xhr) {
- progIds = [progId]; // so faster next time
- break;
- }
- }
- }
-
- if (!xhr) {
- throw new Error("createXhr(): XMLHttpRequest not available");
- }
-
- return xhr;
- };
-
- exports.loadScript = function(path, callback) {
- var head = document.getElementsByTagName('head')[0];
- var s = document.createElement('script');
-
- s.src = path;
- head.appendChild(s);
-
- s.onload = callback;
- };
-
- });
-
- ace.define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- var EventEmitter = {};
-
- EventEmitter._emit =
- EventEmitter._dispatchEvent = function(eventName, e) {
- this._eventRegistry = this._eventRegistry || {};
- this._defaultHandlers = this._defaultHandlers || {};
-
- var listeners = this._eventRegistry[eventName] || [];
- var defaultHandler = this._defaultHandlers[eventName];
- if (!listeners.length && !defaultHandler)
- return;
-
- e = e || {};
- e.type = eventName;
-
- if (!e.stopPropagation) {
- e.stopPropagation = function() {
- this.propagationStopped = true;
- };
- }
-
- if (!e.preventDefault) {
- e.preventDefault = function() {
- this.defaultPrevented = true;
- };
- }
-
- for (var i=0; i<listeners.length; i++) {
- listeners[i](e);
- if (e.propagationStopped)
- break;
- }
-
- if (defaultHandler && !e.defaultPrevented)
- return defaultHandler(e);
- };
-
- EventEmitter.setDefaultHandler = function(eventName, callback) {
- this._defaultHandlers = this._defaultHandlers || {};
-
- if (this._defaultHandlers[eventName])
- throw new Error("The default handler for '" + eventName + "' is already set");
-
- this._defaultHandlers[eventName] = callback;
- };
-
- EventEmitter.on =
- EventEmitter.addEventListener = function(eventName, callback) {
- this._eventRegistry = this._eventRegistry || {};
-
- var listeners = this._eventRegistry[eventName];
- if (!listeners)
- var listeners = this._eventRegistry[eventName] = [];
-
- if (listeners.indexOf(callback) == -1)
- listeners.push(callback);
- };
-
- EventEmitter.removeListener =
- EventEmitter.removeEventListener = function(eventName, callback) {
- this._eventRegistry = this._eventRegistry || {};
-
- var listeners = this._eventRegistry[eventName];
- if (!listeners)
- return;
-
- var index = listeners.indexOf(callback);
- if (index !== -1)
- listeners.splice(index, 1);
- };
-
- EventEmitter.removeAllListeners = function(eventName) {
- if (this._eventRegistry) this._eventRegistry[eventName] = [];
- };
-
- exports.EventEmitter = EventEmitter;
-
- });
-
- ace.define('ace/selection', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/lang', 'ace/lib/event_emitter', 'ace/range'], function(require, exports, module) {
-
-
- var oop = require("./lib/oop");
- var lang = require("./lib/lang");
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
- var Range = require("./range").Range;
-
- /**
- * new Selection(session)
- * - session (EditSession): The session to use
- *
- * Creates a new `Selection` object.
- *
- **/
- var Selection = function(session) {
- this.session = session;
- this.doc = session.getDocument();
-
- this.clearSelection();
- this.lead = this.selectionLead = this.doc.createAnchor(0, 0);
- this.anchor = this.selectionAnchor = this.doc.createAnchor(0, 0);
-
- var self = this;
- this.lead.on("change", function(e) {
- self._emit("changeCursor");
- if (!self.$isEmpty)
- self._emit("changeSelection");
- if (!self.$keepDesiredColumnOnChange && e.old.column != e.value.column)
- self.$desiredColumn = null;
- });
-
- this.selectionAnchor.on("change", function() {
- if (!self.$isEmpty)
- self._emit("changeSelection");
- });
- };
-
- (function() {
-
- oop.implement(this, EventEmitter);
- this.isEmpty = function() {
- return (this.$isEmpty || (
- this.anchor.row == this.lead.row &&
- this.anchor.column == this.lead.column
- ));
- };
- this.isMultiLine = function() {
- if (this.isEmpty()) {
- return false;
- }
-
- return this.getRange().isMultiLine();
- };
- this.getCursor = function() {
- return this.lead.getPosition();
- };
- this.setSelectionAnchor = function(row, column) {
- this.anchor.setPosition(row, column);
-
- if (this.$isEmpty) {
- this.$isEmpty = false;
- this._emit("changeSelection");
- }
- };
- this.getSelectionAnchor = function() {
- if (this.$isEmpty)
- return this.getSelectionLead()
- else
- return this.anchor.getPosition();
- };
- this.getSelectionLead = function() {
- return this.lead.getPosition();
- };
- this.shiftSelection = function(columns) {
- if (this.$isEmpty) {
- this.moveCursorTo(this.lead.row, this.lead.column + columns);
- return;
- };
-
- var anchor = this.getSelectionAnchor();
- var lead = this.getSelectionLead();
-
- var isBackwards = this.isBackwards();
-
- if (!isBackwards || anchor.column !== 0)
- this.setSelectionAnchor(anchor.row, anchor.column + columns);
-
- if (isBackwards || lead.column !== 0) {
- this.$moveSelection(function() {
- this.moveCursorTo(lead.row, lead.column + columns);
- });
- }
- };
- this.isBackwards = function() {
- var anchor = this.anchor;
- var lead = this.lead;
- return (anchor.row > lead.row || (anchor.row == lead.row && anchor.column > lead.column));
- };
- this.getRange = function() {
- var anchor = this.anchor;
- var lead = this.lead;
-
- if (this.isEmpty())
- return Range.fromPoints(lead, lead);
-
- if (this.isBackwards()) {
- return Range.fromPoints(lead, anchor);
- }
- else {
- return Range.fromPoints(anchor, lead);
- }
- };
- this.clearSelection = function() {
- if (!this.$isEmpty) {
- this.$isEmpty = true;
- this._emit("changeSelection");
- }
- };
- this.selectAll = function() {
- var lastRow = this.doc.getLength() - 1;
- this.setSelectionAnchor(0, 0);
- this.moveCursorTo(lastRow, this.doc.getLine(lastRow).length);
- };
- this.setRange =
- this.setSelectionRange = function(range, reverse) {
- if (reverse) {
- this.setSelectionAnchor(range.end.row, range.end.column);
- this.selectTo(range.start.row, range.start.column);
- } else {
- this.setSelectionAnchor(range.start.row, range.start.column);
- this.selectTo(range.end.row, range.end.column);
- }
- this.$desiredColumn = null;
- };
-
- this.$moveSelection = function(mover) {
- var lead = this.lead;
- if (this.$isEmpty)
- this.setSelectionAnchor(lead.row, lead.column);
-
- mover.call(this);
- };
- this.selectTo = function(row, column) {
- this.$moveSelection(function() {
- this.moveCursorTo(row, column);
- });
- };
- this.selectToPosition = function(pos) {
- this.$moveSelection(function() {
- this.moveCursorToPosition(pos);
- });
- };
- this.selectUp = function() {
- this.$moveSelection(this.moveCursorUp);
- };
- this.selectDown = function() {
- this.$moveSelection(this.moveCursorDown);
- };
- this.selectRight = function() {
- this.$moveSelection(this.moveCursorRight);
- };
- this.selectLeft = function() {
- this.$moveSelection(this.moveCursorLeft);
- };
- this.selectLineStart = function() {
- this.$moveSelection(this.moveCursorLineStart);
- };
- this.selectLineEnd = function() {
- this.$moveSelection(this.moveCursorLineEnd);
- };
- this.selectFileEnd = function() {
- this.$moveSelection(this.moveCursorFileEnd);
- };
- this.selectFileStart = function() {
- this.$moveSelection(this.moveCursorFileStart);
- };
- this.selectWordRight = function() {
- this.$moveSelection(this.moveCursorWordRight);
- };
- this.selectWordLeft = function() {
- this.$moveSelection(this.moveCursorWordLeft);
- };
- this.getWordRange = function(row, column) {
- if (typeof column == "undefined") {
- var cursor = row || this.lead;
- row = cursor.row;
- column = cursor.column;
- }
- return this.session.getWordRange(row, column);
- };
-
- this.selectWord = function() {
- this.setSelectionRange(this.getWordRange());
- };
- this.selectAWord = function() {
- var cursor = this.getCursor();
- var range = this.session.getAWordRange(cursor.row, cursor.column);
- this.setSelectionRange(range);
- };
-
- this.getLineRange = function(row, excludeLastChar) {
- var rowStart = typeof row == "number" ? row : this.lead.row;
- var rowEnd;
-
- var foldLine = this.session.getFoldLine(rowStart);
- if (foldLine) {
- rowStart = foldLine.start.row;
- rowEnd = foldLine.end.row;
- } else {
- rowEnd = rowStart;
- }
- if (excludeLastChar)
- return new Range(rowStart, 0, rowEnd, this.session.getLine(rowEnd).length);
- else
- return new Range(rowStart, 0, rowEnd + 1, 0);
- };
- this.selectLine = function() {
- this.setSelectionRange(this.getLineRange());
- };
- this.moveCursorUp = function() {
- this.moveCursorBy(-1, 0);
- };
- this.moveCursorDown = function() {
- this.moveCursorBy(1, 0);
- };
- this.moveCursorLeft = function() {
- var cursor = this.lead.getPosition(),
- fold;
-
- if (fold = this.session.getFoldAt(cursor.row, cursor.column, -1)) {
- this.moveCursorTo(fold.start.row, fold.start.column);
- } else if (cursor.column == 0) {
- // cursor is a line (start
- if (cursor.row > 0) {
- this.moveCursorTo(cursor.row - 1, this.doc.getLine(cursor.row - 1).length);
- }
- }
- else {
- var tabSize = this.session.getTabSize();
- if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column-tabSize, cursor.column).split(" ").length-1 == tabSize)
- this.moveCursorBy(0, -tabSize);
- else
- this.moveCursorBy(0, -1);
- }
- };
- this.moveCursorRight = function() {
- var cursor = this.lead.getPosition(),
- fold;
- if (fold = this.session.getFoldAt(cursor.row, cursor.column, 1)) {
- this.moveCursorTo(fold.end.row, fold.end.column);
- }
- else if (this.lead.column == this.doc.getLine(this.lead.row).length) {
- if (this.lead.row < this.doc.getLength() - 1) {
- this.moveCursorTo(this.lead.row + 1, 0);
- }
- }
- else {
- var tabSize = this.session.getTabSize();
- var cursor = this.lead;
- if (this.session.isTabStop(cursor) && this.doc.getLine(cursor.row).slice(cursor.column, cursor.column+tabSize).split(" ").length-1 == tabSize)
- this.moveCursorBy(0, tabSize);
- else
- this.moveCursorBy(0, 1);
- }
- };
- this.moveCursorLineStart = function() {
- var row = this.lead.row;
- var column = this.lead.column;
- var screenRow = this.session.documentToScreenRow(row, column);
-
- // Determ the doc-position of the first character at the screen line.
- var firstColumnPosition = this.session.screenToDocumentPosition(screenRow, 0);
-
- // Determ the line
- var beforeCursor = this.session.getDisplayLine(
- row, null,
- firstColumnPosition.row, firstColumnPosition.column
- );
-
- var leadingSpace = beforeCursor.match(/^\s*/);
- if (leadingSpace[0].length == column) {
- this.moveCursorTo(
- firstColumnPosition.row, firstColumnPosition.column
- );
- }
- else {
- this.moveCursorTo(
- firstColumnPosition.row,
- firstColumnPosition.column + leadingSpace[0].length
- );
- }
- };
- this.moveCursorLineEnd = function() {
- var lead = this.lead;
- var lastRowColumnPosition =
- this.session.getDocumentLastRowColumnPosition(lead.row, lead.column);
- this.moveCursorTo(
- lastRowColumnPosition.row,
- lastRowColumnPosition.column
- );
- };
- this.moveCursorFileEnd = function() {
- var row = this.doc.getLength() - 1;
- var column = this.doc.getLine(row).length;
- this.moveCursorTo(row, column);
- };
- this.moveCursorFileStart = function() {
- this.moveCursorTo(0, 0);
- };
- this.moveCursorLongWordRight = function() {
- var row = this.lead.row;
- var column = this.lead.column;
- var line = this.doc.getLine(row);
- var rightOfCursor = line.substring(column);
-
- var match;
- this.session.nonTokenRe.lastIndex = 0;
- this.session.tokenRe.lastIndex = 0;
-
- // skip folds
- var fold = this.session.getFoldAt(row, column, 1);
- if (fold) {
- this.moveCursorTo(fold.end.row, fold.end.column);
- return;
- }
-
- // first skip space
- if (match = this.session.nonTokenRe.exec(rightOfCursor)) {
- column += this.session.nonTokenRe.lastIndex;
- this.session.nonTokenRe.lastIndex = 0;
- rightOfCursor = line.substring(column);
- }
-
- // if at line end proceed with next line
- if (column >= line.length) {
- this.moveCursorTo(row, line.length);
- this.moveCursorRight();
- if (row < this.doc.getLength() - 1)
- this.moveCursorWordRight();
- return;
- }
-
- // advance to the end of the next token
- if (match = this.session.tokenRe.exec(rightOfCursor)) {
- column += this.session.tokenRe.lastIndex;
- this.session.tokenRe.lastIndex = 0;
- }
-
- this.moveCursorTo(row, column);
- };
- this.moveCursorLongWordLeft = function() {
- var row = this.lead.row;
- var column = this.lead.column;
-
- // skip folds
- var fold;
- if (fold = this.session.getFoldAt(row, column, -1)) {
- this.moveCursorTo(fold.start.row, fold.start.column);
- return;
- }
-
- var str = this.session.getFoldStringAt(row, column, -1);
- if (str == null) {
- str = this.doc.getLine(row).substring(0, column)
- }
-
- var leftOfCursor = lang.stringReverse(str);
- var match;
- this.session.nonTokenRe.lastIndex = 0;
- this.session.tokenRe.lastIndex = 0;
-
- // skip whitespace
- if (match = this.session.nonTokenRe.exec(leftOfCursor)) {
- column -= this.session.nonTokenRe.lastIndex;
- leftOfCursor = leftOfCursor.slice(this.session.nonTokenRe.lastIndex);
- this.session.nonTokenRe.lastIndex = 0;
- }
-
- // if at begin of the line proceed in line above
- if (column <= 0) {
- this.moveCursorTo(row, 0);
- this.moveCursorLeft();
- if (row > 0)
- this.moveCursorWordLeft();
- return;
- }
-
- // move to the begin of the word
- if (match = this.session.tokenRe.exec(leftOfCursor)) {
- column -= this.session.tokenRe.lastIndex;
- this.session.tokenRe.lastIndex = 0;
- }
-
- this.moveCursorTo(row, column);
- };
-
- this.$shortWordEndIndex = function(rightOfCursor) {
- var match, index = 0, ch;
- var whitespaceRe = /\s/;
- var tokenRe = this.session.tokenRe;
-
- tokenRe.lastIndex = 0;
- if (match = this.session.tokenRe.exec(rightOfCursor)) {
- index = this.session.tokenRe.lastIndex;
- } else {
- while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
- index ++;
-
- if (index <= 1) {
- tokenRe.lastIndex = 0;
- while ((ch = rightOfCursor[index]) && !tokenRe.test(ch)) {
- tokenRe.lastIndex = 0;
- index ++;
- if (whitespaceRe.test(ch)) {
- if (index > 2) {
- index--
- break;
- } else {
- while ((ch = rightOfCursor[index]) && whitespaceRe.test(ch))
- index ++;
- if (index > 2)
- break
- }
- }
- }
- }
- }
- tokenRe.lastIndex = 0;
-
- return index;
- };
-
- this.moveCursorShortWordRight = function() {
- var row = this.lead.row;
- var column = this.lead.column;
- var line = this.doc.getLine(row);
- var rightOfCursor = line.substring(column);
-
- var fold = this.session.getFoldAt(row, column, 1);
- if (fold)
- return this.moveCursorTo(fold.end.row, fold.end.column);
-
- if (column == line.length) {
- var l = this.doc.getLength();
- do {
- row++;
- rightOfCursor = this.doc.getLine(row)
- } while (row < l && /^\s*$/.test(rightOfCursor))
-
- if (!/^\s+/.test(rightOfCursor))
- rightOfCursor = ""
- column = 0;
- }
-
- var index = this.$shortWordEndIndex(rightOfCursor);
-
- this.moveCursorTo(row, column + index);
- };
-
- this.moveCursorShortWordLeft = function() {
- var row = this.lead.row;
- var column = this.lead.column;
-
- var fold;
- if (fold = this.session.getFoldAt(row, column, -1))
- return this.moveCursorTo(fold.start.row, fold.start.column);
-
- var line = this.session.getLine(row).substring(0, column);
- if (column == 0) {
- do {
- row--;
- line = this.doc.getLine(row);
- } while (row > 0 && /^\s*$/.test(line))
-
- column = line.length;
- if (!/\s+$/.test(line))
- line = ""
- }
-
- var leftOfCursor = lang.stringReverse(line);
- var index = this.$shortWordEndIndex(leftOfCursor);
-
- return this.moveCursorTo(row, column - index);
- };
-
- this.moveCursorWordRight = function() {
- if (this.session.$selectLongWords)
- this.moveCursorLongWordRight();
- else
- this.moveCursorShortWordRight();
- };
-
- this.moveCursorWordLeft = function() {
- if (this.session.$selectLongWords)
- this.moveCursorLongWordLeft();
- else
- this.moveCursorShortWordLeft();
- };
- this.moveCursorBy = function(rows, chars) {
- var screenPos = this.session.documentToScreenPosition(
- this.lead.row,
- this.lead.column
- );
-
- if (chars === 0) {
- if (this.$desiredColumn)
- screenPos.column = this.$desiredColumn;
- else
- this.$desiredColumn = screenPos.column;
- }
-
- var docPos = this.session.screenToDocumentPosition(screenPos.row + rows, screenPos.column);
-
- // move the cursor and update the desired column
- this.moveCursorTo(docPos.row, docPos.column + chars, chars === 0);
- };
- this.moveCursorToPosition = function(position) {
- this.moveCursorTo(position.row, position.column);
- };
- this.moveCursorTo = function(row, column, keepDesiredColumn) {
- // Ensure the row/column is not inside of a fold.
- var fold = this.session.getFoldAt(row, column, 1);
- if (fold) {
- row = fold.start.row;
- column = fold.start.column;
- }
-
- this.$keepDesiredColumnOnChange = true;
- this.lead.setPosition(row, column);
- this.$keepDesiredColumnOnChange = false;
-
- if (!keepDesiredColumn)
- this.$desiredColumn = null;
- };
- this.moveCursorToScreen = function(row, column, keepDesiredColumn) {
- var pos = this.session.screenToDocumentPosition(row, column);
- this.moveCursorTo(pos.row, pos.column, keepDesiredColumn);
- };
-
- // remove listeners from document
- this.detach = function() {
- this.lead.detach();
- this.anchor.detach();
- this.session = this.doc = null;
- }
-
- this.fromOrientedRange = function(range) {
- this.setSelectionRange(range, range.cursor == range.start);
- this.$desiredColumn = range.desiredColumn || this.$desiredColumn;
- }
-
- this.toOrientedRange = function(range) {
- var r = this.getRange();
- if (range) {
- range.start.column = r.start.column;
- range.start.row = r.start.row;
- range.end.column = r.end.column;
- range.end.row = r.end.row;
- } else {
- range = r;
- }
-
- range.cursor = this.isBackwards() ? range.start : range.end;
- range.desiredColumn = this.$desiredColumn;
- return range;
- }
-
- }).call(Selection.prototype);
-
- exports.Selection = Selection;
- });
-
- ace.define('ace/range', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- /**
- * class Range
- *
- * This object is used in various places to indicate a region within the editor. To better visualize how this works, imagine a rectangle. Each quadrant of the rectangle is analogus to a range, as ranges contain a starting row and starting column, and an ending row, and ending column.
- *
- **/
-
- /**
- * new Range(startRow, startColumn, endRow, endColumn)
- * - startRow (Number): The starting row
- * - startColumn (Number): The starting column
- * - endRow (Number): The ending row
- * - endColumn (Number): The ending column
- *
- * Creates a new `Range` object with the given starting and ending row and column points.
- *
- **/
- var Range = function(startRow, startColumn, endRow, endColumn) {
- this.start = {
- row: startRow,
- column: startColumn
- };
-
- this.end = {
- row: endRow,
- column: endColumn
- };
- };
-
- (function() {
- /**
- * Range.isEqual(range) -> Boolean
- * - range (Range): A range to check against
- *
- * Returns `true` if and only if the starting row and column, and ending tow and column, are equivalent to those given by `range`.
- *
- **/
- this.isEqual = function(range) {
- return this.start.row == range.start.row &&
- this.end.row == range.end.row &&
- this.start.column == range.start.column &&
- this.end.column == range.end.column
- };
- this.toString = function() {
- return ("Range: [" + this.start.row + "/" + this.start.column +
- "] -> [" + this.end.row + "/" + this.end.column + "]");
- };
-
- this.contains = function(row, column) {
- return this.compare(row, column) == 0;
- };
- this.compareRange = function(range) {
- var cmp,
- end = range.end,
- start = range.start;
-
- cmp = this.compare(end.row, end.column);
- if (cmp == 1) {
- cmp = this.compare(start.row, start.column);
- if (cmp == 1) {
- return 2;
- } else if (cmp == 0) {
- return 1;
- } else {
- return 0;
- }
- } else if (cmp == -1) {
- return -2;
- } else {
- cmp = this.compare(start.row, start.column);
- if (cmp == -1) {
- return -1;
- } else if (cmp == 1) {
- return 42;
- } else {
- return 0;
- }
- }
- }
-
- /** related to: Range.compare
- * Range.comparePoint(p) -> Number
- * - p (Range): A point to compare with
- * + (Number): This method returns one of the following numbers:<br/>
- * * `0` if the two points are exactly equal<br/>
- * * `-1` if `p.row` is less then the calling range<br/>
- * * `1` if `p.row` is greater than the calling range<br/>
- * <br/>
- * If the starting row of the calling range is equal to `p.row`, and:<br/>
- * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
- * * Otherwise, it returns -1<br/>
- *<br/>
- * If the ending row of the calling range is equal to `p.row`, and:<br/>
- * * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
- * * Otherwise, it returns 1<br/>
- *
- * Checks the row and column points of `p` with the row and column points of the calling range.
- *
- *
- *
- **/
- this.comparePoint = function(p) {
- return this.compare(p.row, p.column);
- }
-
- /** related to: Range.comparePoint
- * Range.containsRange(range) -> Boolean
- * - range (Range): A range to compare with
- *
- * Checks the start and end points of `range` and compares them to the calling range. Returns `true` if the `range` is contained within the caller's range.
- *
- **/
- this.containsRange = function(range) {
- return this.comparePoint(range.start) == 0 && this.comparePoint(range.end) == 0;
- }
-
- /**
- * Range.intersects(range) -> Boolean
- * - range (Range): A range to compare with
- *
- * Returns `true` if passed in `range` intersects with the one calling this method.
- *
- **/
- this.intersects = function(range) {
- var cmp = this.compareRange(range);
- return (cmp == -1 || cmp == 0 || cmp == 1);
- }
-
- /**
- * Range.isEnd(row, column) -> Boolean
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- *
- * Returns `true` if the caller's ending row point is the same as `row`, and if the caller's ending column is the same as `column`.
- *
- **/
- this.isEnd = function(row, column) {
- return this.end.row == row && this.end.column == column;
- }
-
- /**
- * Range.isStart(row, column) -> Boolean
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- *
- * Returns `true` if the caller's starting row point is the same as `row`, and if the caller's starting column is the same as `column`.
- *
- **/
- this.isStart = function(row, column) {
- return this.start.row == row && this.start.column == column;
- }
-
- /**
- * Range.setStart(row, column)
- * - row (Number): A row point to set
- * - column (Number): A column point to set
- *
- * Sets the starting row and column for the range.
- *
- **/
- this.setStart = function(row, column) {
- if (typeof row == "object") {
- this.start.column = row.column;
- this.start.row = row.row;
- } else {
- this.start.row = row;
- this.start.column = column;
- }
- }
-
- /**
- * Range.setEnd(row, column)
- * - row (Number): A row point to set
- * - column (Number): A column point to set
- *
- * Sets the starting row and column for the range.
- *
- **/
- this.setEnd = function(row, column) {
- if (typeof row == "object") {
- this.end.column = row.column;
- this.end.row = row.row;
- } else {
- this.end.row = row;
- this.end.column = column;
- }
- }
-
- /** related to: Range.compare
- * Range.inside(row, column) -> Boolean
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- *
- * Returns `true` if the `row` and `column` are within the given range.
- *
- **/
- this.inside = function(row, column) {
- if (this.compare(row, column) == 0) {
- if (this.isEnd(row, column) || this.isStart(row, column)) {
- return false;
- } else {
- return true;
- }
- }
- return false;
- }
-
- /** related to: Range.compare
- * Range.insideStart(row, column) -> Boolean
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- *
- * Returns `true` if the `row` and `column` are within the given range's starting points.
- *
- **/
- this.insideStart = function(row, column) {
- if (this.compare(row, column) == 0) {
- if (this.isEnd(row, column)) {
- return false;
- } else {
- return true;
- }
- }
- return false;
- }
-
- /** related to: Range.compare
- * Range.insideEnd(row, column) -> Boolean
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- *
- * Returns `true` if the `row` and `column` are within the given range's ending points.
- *
- **/
- this.insideEnd = function(row, column) {
- if (this.compare(row, column) == 0) {
- if (this.isStart(row, column)) {
- return false;
- } else {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Range.compare(row, column) -> Number
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- * + (Number): This method returns one of the following numbers:<br/>
- * * `0` if the two points are exactly equal <br/>
- * * `-1` if `p.row` is less then the calling range <br/>
- * * `1` if `p.row` is greater than the calling range <br/>
- * <br/>
- * If the starting row of the calling range is equal to `p.row`, and: <br/>
- * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
- * * Otherwise, it returns -1<br/>
- * <br/>
- * If the ending row of the calling range is equal to `p.row`, and: <br/>
- * * `p.column` is less than or equal to the calling range's ending column, this returns `0` <br/>
- * * Otherwise, it returns 1
- *
- * Checks the row and column points with the row and column points of the calling range.
- *
- *
- **/
- this.compare = function(row, column) {
- if (!this.isMultiLine()) {
- if (row === this.start.row) {
- return column < this.start.column ? -1 : (column > this.end.column ? 1 : 0);
- };
- }
-
- if (row < this.start.row)
- return -1;
-
- if (row > this.end.row)
- return 1;
-
- if (this.start.row === row)
- return column >= this.start.column ? 0 : -1;
-
- if (this.end.row === row)
- return column <= this.end.column ? 0 : 1;
-
- return 0;
- };
- this.compareStart = function(row, column) {
- if (this.start.row == row && this.start.column == column) {
- return -1;
- } else {
- return this.compare(row, column);
- }
- }
-
- /**
- * Range.compareEnd(row, column) -> Number
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- * + (Number): This method returns one of the following numbers:<br/>
- * * `0` if the two points are exactly equal<br/>
- * * `-1` if `p.row` is less then the calling range<br/>
- * * `1` if `p.row` is greater than the calling range, or if `isEnd` is `true.<br/>
- * <br/>
- * If the starting row of the calling range is equal to `p.row`, and:<br/>
- * * `p.column` is greater than or equal to the calling range's starting column, this returns `0`<br/>
- * * Otherwise, it returns -1<br/>
- *<br/>
- * If the ending row of the calling range is equal to `p.row`, and:<br/>
- * * `p.column` is less than or equal to the calling range's ending column, this returns `0`<br/>
- * * Otherwise, it returns 1
- *
- * Checks the row and column points with the row and column points of the calling range.
- *
- *
- **/
- this.compareEnd = function(row, column) {
- if (this.end.row == row && this.end.column == column) {
- return 1;
- } else {
- return this.compare(row, column);
- }
- }
-
- /**
- * Range.compareInside(row, column) -> Number
- * - row (Number): A row point to compare with
- * - column (Number): A column point to compare with
- * + (Number): This method returns one of the following numbers:<br/>
- * * `1` if the ending row of the calling range is equal to `row`, and the ending column of the calling range is equal to `column`<br/>
- * * `-1` if the starting row of the calling range is equal to `row`, and the starting column of the calling range is equal to `column`<br/>
- * <br/>
- * Otherwise, it returns the value after calling [[Range.compare `compare()`]].
- *
- * Checks the row and column points with the row and column points of the calling range.
- *
- *
- *
- **/
- this.compareInside = function(row, column) {
- if (this.end.row == row && this.end.column == column) {
- return 1;
- } else if (this.start.row == row && this.start.column == column) {
- return -1;
- } else {
- return this.compare(row, column);
- }
- }
-
- /**
- * Range.clipRows(firstRow, lastRow) -> Range
- * - firstRow (Number): The starting row
- * - lastRow (Number): The ending row
- *
- * Returns the part of the current `Range` that occurs within the boundaries of `firstRow` and `lastRow` as a new `Range` object.
- *
- **/
- this.clipRows = function(firstRow, lastRow) {
- if (this.end.row > lastRow) {
- var end = {
- row: lastRow+1,
- column: 0
- };
- }
-
- if (this.start.row > lastRow) {
- var start = {
- row: lastRow+1,
- column: 0
- };
- }
-
- if (this.start.row < firstRow) {
- var start = {
- row: firstRow,
- column: 0
- };
- }
-
- if (this.end.row < firstRow) {
- var end = {
- row: firstRow,
- column: 0
- };
- }
- return Range.fromPoints(start || this.start, end || this.end);
- };
- this.extend = function(row, column) {
- var cmp = this.compare(row, column);
-
- if (cmp == 0)
- return this;
- else if (cmp == -1)
- var start = {row: row, column: column};
- else
- var end = {row: row, column: column};
-
- return Range.fromPoints(start || this.start, end || this.end);
- };
-
- this.isEmpty = function() {
- return (this.start.row == this.end.row && this.start.column == this.end.column);
- };
- this.isMultiLine = function() {
- return (this.start.row !== this.end.row);
- };
- this.clone = function() {
- return Range.fromPoints(this.start, this.end);
- };
- this.collapseRows = function() {
- if (this.end.column == 0)
- return new Range(this.start.row, 0, Math.max(this.start.row, this.end.row-1), 0)
- else
- return new Range(this.start.row, 0, this.end.row, 0)
- };
- this.toScreenRange = function(session) {
- var screenPosStart =
- session.documentToScreenPosition(this.start);
- var screenPosEnd =
- session.documentToScreenPosition(this.end);
-
- return new Range(
- screenPosStart.row, screenPosStart.column,
- screenPosEnd.row, screenPosEnd.column
- );
- };
-
- }).call(Range.prototype);
- Range.fromPoints = function(start, end) {
- return new Range(start.row, start.column, end.row, end.column);
- };
-
- exports.Range = Range;
- });
-
- ace.define('ace/mode/text', ['require', 'exports', 'module' , 'ace/tokenizer', 'ace/mode/text_highlight_rules', 'ace/mode/behaviour', 'ace/unicode'], function(require, exports, module) {
-
-
- var Tokenizer = require("../tokenizer").Tokenizer;
- var TextHighlightRules = require("./text_highlight_rules").TextHighlightRules;
- var Behaviour = require("./behaviour").Behaviour;
- var unicode = require("../unicode");
-
- var Mode = function() {
- this.$tokenizer = new Tokenizer(new TextHighlightRules().getRules());
- this.$behaviour = new Behaviour();
- };
-
- (function() {
-
- this.tokenRe = new RegExp("^["
- + unicode.packages.L
- + unicode.packages.Mn + unicode.packages.Mc
- + unicode.packages.Nd
- + unicode.packages.Pc + "\\$_]+", "g"
- );
-
- this.nonTokenRe = new RegExp("^(?:[^"
- + unicode.packages.L
- + unicode.packages.Mn + unicode.packages.Mc
- + unicode.packages.Nd
- + unicode.packages.Pc + "\\$_]|\s])+", "g"
- );
-
- this.getTokenizer = function() {
- return this.$tokenizer;
- };
-
- this.toggleCommentLines = function(state, doc, startRow, endRow) {
- };
-
- this.getNextLineIndent = function(state, line, tab) {
- return "";
- };
-
- this.checkOutdent = function(state, line, input) {
- return false;
- };
-
- this.autoOutdent = function(state, doc, row) {
- };
-
- this.$getIndent = function(line) {
- var match = line.match(/^(\s+)/);
- if (match) {
- return match[1];
- }
-
- return "";
- };
-
- this.createWorker = function(session) {
- return null;
- };
-
- this.createModeDelegates = function (mapping) {
- if (!this.$embeds) {
- return;
- }
- this.$modes = {};
- for (var i = 0; i < this.$embeds.length; i++) {
- if (mapping[this.$embeds[i]]) {
- this.$modes[this.$embeds[i]] = new mapping[this.$embeds[i]]();
- }
- }
-
- var delegations = ['toggleCommentLines', 'getNextLineIndent', 'checkOutdent', 'autoOutdent', 'transformAction'];
-
- for (var i = 0; i < delegations.length; i++) {
- (function(scope) {
- var functionName = delegations[i];
- var defaultHandler = scope[functionName];
- scope[delegations[i]] = function() {
- return this.$delegator(functionName, arguments, defaultHandler);
- }
- } (this));
- }
- }
-
- this.$delegator = function(method, args, defaultHandler) {
- var state = args[0];
-
- for (var i = 0; i < this.$embeds.length; i++) {
- if (!this.$modes[this.$embeds[i]]) continue;
-
- var split = state.split(this.$embeds[i]);
- if (!split[0] && split[1]) {
- args[0] = split[1];
- var mode = this.$modes[this.$embeds[i]];
- return mode[method].apply(mode, args);
- }
- }
- var ret = defaultHandler.apply(this, args);
- return defaultHandler ? ret : undefined;
- };
-
- this.transformAction = function(state, action, editor, session, param) {
- if (this.$behaviour) {
- var behaviours = this.$behaviour.getBehaviours();
- for (var key in behaviours) {
- if (behaviours[key][action]) {
- var ret = behaviours[key][action].apply(this, arguments);
- if (ret) {
- return ret;
- }
- }
- }
- }
- }
-
- }).call(Mode.prototype);
-
- exports.Mode = Mode;
- });
-
- ace.define('ace/tokenizer', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- /**
- * class Tokenizer
- *
- * This class takes a set of highlighting rules, and creates a tokenizer out of them. For more information, see [the wiki on extending highlighters](https://github.com/ajaxorg/ace/wiki/Creating-or-Extending-an-Edit-Mode#wiki-extendingTheHighlighter).
- *
- **/
-
- /**
- * new Tokenizer(rules, flag)
- * - rules (Object): The highlighting rules
- * - flag (String): Any additional regular expression flags to pass (like "i" for case insensitive)
- *
- * Constructs a new tokenizer based on the given rules and flags.
- *
- **/
- var Tokenizer = function(rules, flag) {
- flag = flag ? "g" + flag : "g";
- this.rules = rules;
-
- this.regExps = {};
- this.matchMappings = {};
- for ( var key in this.rules) {
- var rule = this.rules[key];
- var state = rule;
- var ruleRegExps = [];
- var matchTotal = 0;
- var mapping = this.matchMappings[key] = {};
-
- for ( var i = 0; i < state.length; i++) {
-
- if (state[i].regex instanceof RegExp)
- state[i].regex = state[i].regex.toString().slice(1, -1);
-
- // Count number of matching groups. 2 extra groups from the full match
- // And the catch-all on the end (used to force a match);
- var matchcount = new RegExp("(?:(" + state[i].regex + ")|(.))").exec("a").length - 2;
-
- // Replace any backreferences and offset appropriately.
- var adjustedregex = state[i].regex.replace(/\\([0-9]+)/g, function (match, digit) {
- return "\\" + (parseInt(digit, 10) + matchTotal + 1);
- });
-
- if (matchcount > 1 && state[i].token.length !== matchcount-1)
- throw new Error("Matching groups and length of the token array don't match in rule #" + i + " of state " + key);
-
- mapping[matchTotal] = {
- rule: i,
- len: matchcount
- };
- matchTotal += matchcount;
-
- ruleRegExps.push(adjustedregex);
- }
-
- this.regExps[key] = new RegExp("(?:(" + ruleRegExps.join(")|(") + ")|(.))", flag);
- }
- };
-
- (function() {
-
- /**
- * Tokenizer.getLineTokens() -> Object
- *
- * Returns an object containing two properties: `tokens`, which contains all the tokens; and `state`, the current state.
- **/
- this.getLineTokens = function(line, startState) {
- var currentState = startState || "start";
- var state = this.rules[currentState];
- var mapping = this.matchMappings[currentState];
- var re = this.regExps[currentState];
- re.lastIndex = 0;
-
- var match, tokens = [];
-
- var lastIndex = 0;
-
- var token = {
- type: null,
- value: ""
- };
-
- while (match = re.exec(line)) {
- var type = "text";
- var rule = null;
- var value = [match[0]];
-
- for (var i = 0; i < match.length-2; i++) {
- if (match[i + 1] === undefined)
- continue;
-
- rule = state[mapping[i].rule];
-
- if (mapping[i].len > 1)
- value = match.slice(i+2, i+1+mapping[i].len);
-
- // compute token type
- if (typeof rule.token == "function")
- type = rule.token.apply(this, value);
- else
- type = rule.token;
-
- if (rule.next) {
- currentState = rule.next;
- state = this.rules[currentState];
- mapping = this.matchMappings[currentState];
- lastIndex = re.lastIndex;
-
- re = this.regExps[currentState];
- re.lastIndex = lastIndex;
- }
- break;
- }
-
- if (value[0]) {
- if (typeof type == "string") {
- value = [value.join("")];
- type = [type];
- }
- for (var i = 0; i < value.length; i++) {
- if (!value[i])
- continue;
-
- if ((!rule || rule.merge || type[i] === "text") && token.type === type[i]) {
- token.value += value[i];
- } else {
- if (token.type)
- tokens.push(token);
-
- token = {
- type: type[i],
- value: value[i]
- };
- }
- }
- }
-
- if (lastIndex == line.length)
- break;
-
- lastIndex = re.lastIndex;
- }
-
- if (token.type)
- tokens.push(token);
-
- return {
- tokens : tokens,
- state : currentState
- };
- };
-
- }).call(Tokenizer.prototype);
-
- exports.Tokenizer = Tokenizer;
- });
-
- ace.define('ace/mode/text_highlight_rules', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
-
-
- var lang = require("../lib/lang");
-
- var TextHighlightRules = function() {
-
- // regexp must not have capturing parentheses
- // regexps are ordered -> the first match is used
-
- this.$rules = {
- "start" : [{
- token : "empty_line",
- regex : '^$'
- }, {
- token : "text",
- regex : ".+"
- }]
- };
- };
-
- (function() {
-
- this.addRules = function(rules, prefix) {
- for (var key in rules) {
- var state = rules[key];
- for (var i=0; i<state.length; i++) {
- var rule = state[i];
- if (rule.next) {
- rule.next = prefix + rule.next;
- }
- }
- this.$rules[prefix + key] = state;
- }
- };
-
- this.getRules = function() {
- return this.$rules;
- };
-
- this.embedRules = function (HighlightRules, prefix, escapeRules, states) {
- var embedRules = new HighlightRules().getRules();
- if (states) {
- for (var i = 0; i < states.length; i++) {
- states[i] = prefix + states[i];
- }
- } else {
- states = [];
- for (var key in embedRules) {
- states.push(prefix + key);
- }
- }
- this.addRules(embedRules, prefix);
-
- for (var i = 0; i < states.length; i++) {
- Array.prototype.unshift.apply(this.$rules[states[i]], lang.deepCopy(escapeRules));
- }
-
- if (!this.$embeds) {
- this.$embeds = [];
- }
- this.$embeds.push(prefix);
- }
-
- this.getEmbeds = function() {
- return this.$embeds;
- }
-
- }).call(TextHighlightRules.prototype);
-
- exports.TextHighlightRules = TextHighlightRules;
- });
-
- ace.define('ace/mode/behaviour', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- var Behaviour = function() {
- this.$behaviours = {};
- };
-
- (function () {
-
- this.add = function (name, action, callback) {
- switch (undefined) {
- case this.$behaviours:
- this.$behaviours = {};
- case this.$behaviours[name]:
- this.$behaviours[name] = {};
- }
- this.$behaviours[name][action] = callback;
- }
-
- this.addBehaviours = function (behaviours) {
- for (var key in behaviours) {
- for (var action in behaviours[key]) {
- this.add(key, action, behaviours[key][action]);
- }
- }
- }
-
- this.remove = function (name) {
- if (this.$behaviours && this.$behaviours[name]) {
- delete this.$behaviours[name];
- }
- }
-
- this.inherit = function (mode, filter) {
- if (typeof mode === "function") {
- var behaviours = new mode().getBehaviours(filter);
- } else {
- var behaviours = mode.getBehaviours(filter);
- }
- this.addBehaviours(behaviours);
- }
-
- this.getBehaviours = function (filter) {
- if (!filter) {
- return this.$behaviours;
- } else {
- var ret = {}
- for (var i = 0; i < filter.length; i++) {
- if (this.$behaviours[filter[i]]) {
- ret[filter[i]] = this.$behaviours[filter[i]];
- }
- }
- return ret;
- }
- }
-
- }).call(Behaviour.prototype);
-
- exports.Behaviour = Behaviour;
- });
- ace.define('ace/unicode', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- /*
- XRegExp Unicode plugin pack: Categories 1.0
- (c) 2010 Steven Levithan
- MIT License
- <http://xregexp.com>
- Uses the Unicode 5.2 character database
-
- This package for the XRegExp Unicode plugin enables the following Unicode categories (aka properties):
-
- L - Letter (the top-level Letter category is included in the Unicode plugin base script)
- Ll - Lowercase letter
- Lu - Uppercase letter
- Lt - Titlecase letter
- Lm - Modifier letter
- Lo - Letter without case
- M - Mark
- Mn - Non-spacing mark
- Mc - Spacing combining mark
- Me - Enclosing mark
- N - Number
- Nd - Decimal digit
- Nl - Letter number
- No - Other number
- P - Punctuation
- Pd - Dash punctuation
- Ps - Open punctuation
- Pe - Close punctuation
- Pi - Initial punctuation
- Pf - Final punctuation
- Pc - Connector punctuation
- Po - Other punctuation
- S - Symbol
- Sm - Math symbol
- Sc - Currency symbol
- Sk - Modifier symbol
- So - Other symbol
- Z - Separator
- Zs - Space separator
- Zl - Line separator
- Zp - Paragraph separator
- C - Other
- Cc - Control
- Cf - Format
- Co - Private use
- Cs - Surrogate
- Cn - Unassigned
-
- Example usage:
-
- \p{N}
- \p{Cn}
- */
-
-
- // will be populated by addUnicodePackage
- exports.packages = {};
-
- addUnicodePackage({
- L: "0041-005A0061-007A00AA00B500BA00C0-00D600D8-00F600F8-02C102C6-02D102E0-02E402EC02EE0370-037403760377037A-037D03860388-038A038C038E-03A103A3-03F503F7-0481048A-05250531-055605590561-058705D0-05EA05F0-05F20621-064A066E066F0671-06D306D506E506E606EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA07F407F507FA0800-0815081A082408280904-0939093D09500958-0961097109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E460E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EC60EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10A0-10C510D0-10FA10FC1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317D717DC1820-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541AA71B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C7D1CE9-1CEC1CEE-1CF11D00-1DBF1E00-1F151F18-1F1D1F20-1F451F48-1F4D1F50-1F571F591F5B1F5D1F5F-1F7D1F80-1FB41FB6-1FBC1FBE1FC2-1FC41FC6-1FCC1FD0-1FD31FD6-1FDB1FE0-1FEC1FF2-1FF41FF6-1FFC2071207F2090-209421022107210A-211321152119-211D212421262128212A-212D212F-2139213C-213F2145-2149214E218321842C00-2C2E2C30-2C5E2C60-2CE42CEB-2CEE2D00-2D252D30-2D652D6F2D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE2E2F300530063031-3035303B303C3041-3096309D-309F30A1-30FA30FC-30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A48CA4D0-A4FDA500-A60CA610-A61FA62AA62BA640-A65FA662-A66EA67F-A697A6A0-A6E5A717-A71FA722-A788A78BA78CA7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2A9CFAA00-AA28AA40-AA42AA44-AA4BAA60-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADB-AADDABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB00-FB06FB13-FB17FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF21-FF3AFF41-FF5AFF66-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
- Ll: "0061-007A00AA00B500BA00DF-00F600F8-00FF01010103010501070109010B010D010F01110113011501170119011B011D011F01210123012501270129012B012D012F01310133013501370138013A013C013E014001420144014601480149014B014D014F01510153015501570159015B015D015F01610163016501670169016B016D016F0171017301750177017A017C017E-0180018301850188018C018D019201950199-019B019E01A101A301A501A801AA01AB01AD01B001B401B601B901BA01BD-01BF01C601C901CC01CE01D001D201D401D601D801DA01DC01DD01DF01E101E301E501E701E901EB01ED01EF01F001F301F501F901FB01FD01FF02010203020502070209020B020D020F02110213021502170219021B021D021F02210223022502270229022B022D022F02310233-0239023C023F0240024202470249024B024D024F-02930295-02AF037103730377037B-037D039003AC-03CE03D003D103D5-03D703D903DB03DD03DF03E103E303E503E703E903EB03ED03EF-03F303F503F803FB03FC0430-045F04610463046504670469046B046D046F04710473047504770479047B047D047F0481048B048D048F04910493049504970499049B049D049F04A104A304A504A704A904AB04AD04AF04B104B304B504B704B904BB04BD04BF04C204C404C604C804CA04CC04CE04CF04D104D304D504D704D904DB04DD04DF04E104E304E504E704E904EB04ED04EF04F104F304F504F704F904FB04FD04FF05010503050505070509050B050D050F05110513051505170519051B051D051F0521052305250561-05871D00-1D2B1D62-1D771D79-1D9A1E011E031E051E071E091E0B1E0D1E0F1E111E131E151E171E191E1B1E1D1E1F1E211E231E251E271E291E2B1E2D1E2F1E311E331E351E371E391E3B1E3D1E3F1E411E431E451E471E491E4B1E4D1E4F1E511E531E551E571E591E5B1E5D1E5F1E611E631E651E671E691E6B1E6D1E6F1E711E731E751E771E791E7B1E7D1E7F1E811E831E851E871E891E8B1E8D1E8F1E911E931E95-1E9D1E9F1EA11EA31EA51EA71EA91EAB1EAD1EAF1EB11EB31EB51EB71EB91EBB1EBD1EBF1EC11EC31EC51EC71EC91ECB1ECD1ECF1ED11ED31ED51ED71ED91EDB1EDD1EDF1EE11EE31EE51EE71EE91EEB1EED1EEF1EF11EF31EF51EF71EF91EFB1EFD1EFF-1F071F10-1F151F20-1F271F30-1F371F40-1F451F50-1F571F60-1F671F70-1F7D1F80-1F871F90-1F971FA0-1FA71FB0-1FB41FB61FB71FBE1FC2-1FC41FC61FC71FD0-1FD31FD61FD71FE0-1FE71FF2-1FF41FF61FF7210A210E210F2113212F21342139213C213D2146-2149214E21842C30-2C5E2C612C652C662C682C6A2C6C2C712C732C742C76-2C7C2C812C832C852C872C892C8B2C8D2C8F2C912C932C952C972C992C9B2C9D2C9F2CA12CA32CA52CA72CA92CAB2CAD2CAF2CB12CB32CB52CB72CB92CBB2CBD2CBF2CC12CC32CC52CC72CC92CCB2CCD2CCF2CD12CD32CD52CD72CD92CDB2CDD2CDF2CE12CE32CE42CEC2CEE2D00-2D25A641A643A645A647A649A64BA64DA64FA651A653A655A657A659A65BA65DA65FA663A665A667A669A66BA66DA681A683A685A687A689A68BA68DA68FA691A693A695A697A723A725A727A729A72BA72DA72F-A731A733A735A737A739A73BA73DA73FA741A743A745A747A749A74BA74DA74FA751A753A755A757A759A75BA75DA75FA761A763A765A767A769A76BA76DA76FA771-A778A77AA77CA77FA781A783A785A787A78CFB00-FB06FB13-FB17FF41-FF5A",
- Lu: "0041-005A00C0-00D600D8-00DE01000102010401060108010A010C010E01100112011401160118011A011C011E01200122012401260128012A012C012E01300132013401360139013B013D013F0141014301450147014A014C014E01500152015401560158015A015C015E01600162016401660168016A016C016E017001720174017601780179017B017D018101820184018601870189-018B018E-0191019301940196-0198019C019D019F01A001A201A401A601A701A901AC01AE01AF01B1-01B301B501B701B801BC01C401C701CA01CD01CF01D101D301D501D701D901DB01DE01E001E201E401E601E801EA01EC01EE01F101F401F6-01F801FA01FC01FE02000202020402060208020A020C020E02100212021402160218021A021C021E02200222022402260228022A022C022E02300232023A023B023D023E02410243-02460248024A024C024E03700372037603860388-038A038C038E038F0391-03A103A3-03AB03CF03D2-03D403D803DA03DC03DE03E003E203E403E603E803EA03EC03EE03F403F703F903FA03FD-042F04600462046404660468046A046C046E04700472047404760478047A047C047E0480048A048C048E04900492049404960498049A049C049E04A004A204A404A604A804AA04AC04AE04B004B204B404B604B804BA04BC04BE04C004C104C304C504C704C904CB04CD04D004D204D404D604D804DA04DC04DE04E004E204E404E604E804EA04EC04EE04F004F204F404F604F804FA04FC04FE05000502050405060508050A050C050E05100512051405160518051A051C051E0520052205240531-055610A0-10C51E001E021E041E061E081E0A1E0C1E0E1E101E121E141E161E181E1A1E1C1E1E1E201E221E241E261E281E2A1E2C1E2E1E301E321E341E361E381E3A1E3C1E3E1E401E421E441E461E481E4A1E4C1E4E1E501E521E541E561E581E5A1E5C1E5E1E601E621E641E661E681E6A1E6C1E6E1E701E721E741E761E781E7A1E7C1E7E1E801E821E841E861E881E8A1E8C1E8E1E901E921E941E9E1EA01EA21EA41EA61EA81EAA1EAC1EAE1EB01EB21EB41EB61EB81EBA1EBC1EBE1EC01EC21EC41EC61EC81ECA1ECC1ECE1ED01ED21ED41ED61ED81EDA1EDC1EDE1EE01EE21EE41EE61EE81EEA1EEC1EEE1EF01EF21EF41EF61EF81EFA1EFC1EFE1F08-1F0F1F18-1F1D1F28-1F2F1F38-1F3F1F48-1F4D1F591F5B1F5D1F5F1F68-1F6F1FB8-1FBB1FC8-1FCB1FD8-1FDB1FE8-1FEC1FF8-1FFB21022107210B-210D2110-211221152119-211D212421262128212A-212D2130-2133213E213F214521832C00-2C2E2C602C62-2C642C672C692C6B2C6D-2C702C722C752C7E-2C802C822C842C862C882C8A2C8C2C8E2C902C922C942C962C982C9A2C9C2C9E2CA02CA22CA42CA62CA82CAA2CAC2CAE2CB02CB22CB42CB62CB82CBA2CBC2CBE2CC02CC22CC42CC62CC82CCA2CCC2CCE2CD02CD22CD42CD62CD82CDA2CDC2CDE2CE02CE22CEB2CEDA640A642A644A646A648A64AA64CA64EA650A652A654A656A658A65AA65CA65EA662A664A666A668A66AA66CA680A682A684A686A688A68AA68CA68EA690A692A694A696A722A724A726A728A72AA72CA72EA732A734A736A738A73AA73CA73EA740A742A744A746A748A74AA74CA74EA750A752A754A756A758A75AA75CA75EA760A762A764A766A768A76AA76CA76EA779A77BA77DA77EA780A782A784A786A78BFF21-FF3A",
- Lt: "01C501C801CB01F21F88-1F8F1F98-1F9F1FA8-1FAF1FBC1FCC1FFC",
- Lm: "02B0-02C102C6-02D102E0-02E402EC02EE0374037A0559064006E506E607F407F507FA081A0824082809710E460EC610FC17D718431AA71C78-1C7D1D2C-1D611D781D9B-1DBF2071207F2090-20942C7D2D6F2E2F30053031-3035303B309D309E30FC-30FEA015A4F8-A4FDA60CA67FA717-A71FA770A788A9CFAA70AADDFF70FF9EFF9F",
- Lo: "01BB01C0-01C3029405D0-05EA05F0-05F20621-063F0641-064A066E066F0671-06D306D506EE06EF06FA-06FC06FF07100712-072F074D-07A507B107CA-07EA0800-08150904-0939093D09500958-096109720979-097F0985-098C098F09900993-09A809AA-09B009B209B6-09B909BD09CE09DC09DD09DF-09E109F009F10A05-0A0A0A0F0A100A13-0A280A2A-0A300A320A330A350A360A380A390A59-0A5C0A5E0A72-0A740A85-0A8D0A8F-0A910A93-0AA80AAA-0AB00AB20AB30AB5-0AB90ABD0AD00AE00AE10B05-0B0C0B0F0B100B13-0B280B2A-0B300B320B330B35-0B390B3D0B5C0B5D0B5F-0B610B710B830B85-0B8A0B8E-0B900B92-0B950B990B9A0B9C0B9E0B9F0BA30BA40BA8-0BAA0BAE-0BB90BD00C05-0C0C0C0E-0C100C12-0C280C2A-0C330C35-0C390C3D0C580C590C600C610C85-0C8C0C8E-0C900C92-0CA80CAA-0CB30CB5-0CB90CBD0CDE0CE00CE10D05-0D0C0D0E-0D100D12-0D280D2A-0D390D3D0D600D610D7A-0D7F0D85-0D960D9A-0DB10DB3-0DBB0DBD0DC0-0DC60E01-0E300E320E330E40-0E450E810E820E840E870E880E8A0E8D0E94-0E970E99-0E9F0EA1-0EA30EA50EA70EAA0EAB0EAD-0EB00EB20EB30EBD0EC0-0EC40EDC0EDD0F000F40-0F470F49-0F6C0F88-0F8B1000-102A103F1050-1055105A-105D106110651066106E-10701075-1081108E10D0-10FA1100-1248124A-124D1250-12561258125A-125D1260-1288128A-128D1290-12B012B2-12B512B8-12BE12C012C2-12C512C8-12D612D8-13101312-13151318-135A1380-138F13A0-13F41401-166C166F-167F1681-169A16A0-16EA1700-170C170E-17111720-17311740-17511760-176C176E-17701780-17B317DC1820-18421844-18771880-18A818AA18B0-18F51900-191C1950-196D1970-19741980-19AB19C1-19C71A00-1A161A20-1A541B05-1B331B45-1B4B1B83-1BA01BAE1BAF1C00-1C231C4D-1C4F1C5A-1C771CE9-1CEC1CEE-1CF12135-21382D30-2D652D80-2D962DA0-2DA62DA8-2DAE2DB0-2DB62DB8-2DBE2DC0-2DC62DC8-2DCE2DD0-2DD62DD8-2DDE3006303C3041-3096309F30A1-30FA30FF3105-312D3131-318E31A0-31B731F0-31FF3400-4DB54E00-9FCBA000-A014A016-A48CA4D0-A4F7A500-A60BA610-A61FA62AA62BA66EA6A0-A6E5A7FB-A801A803-A805A807-A80AA80C-A822A840-A873A882-A8B3A8F2-A8F7A8FBA90A-A925A930-A946A960-A97CA984-A9B2AA00-AA28AA40-AA42AA44-AA4BAA60-AA6FAA71-AA76AA7AAA80-AAAFAAB1AAB5AAB6AAB9-AABDAAC0AAC2AADBAADCABC0-ABE2AC00-D7A3D7B0-D7C6D7CB-D7FBF900-FA2DFA30-FA6DFA70-FAD9FB1DFB1F-FB28FB2A-FB36FB38-FB3CFB3EFB40FB41FB43FB44FB46-FBB1FBD3-FD3DFD50-FD8FFD92-FDC7FDF0-FDFBFE70-FE74FE76-FEFCFF66-FF6FFF71-FF9DFFA0-FFBEFFC2-FFC7FFCA-FFCFFFD2-FFD7FFDA-FFDC",
- M: "0300-036F0483-04890591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DE-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0903093C093E-094E0951-0955096209630981-098309BC09BE-09C409C709C809CB-09CD09D709E209E30A01-0A030A3C0A3E-0A420A470A480A4B-0A4D0A510A700A710A750A81-0A830ABC0ABE-0AC50AC7-0AC90ACB-0ACD0AE20AE30B01-0B030B3C0B3E-0B440B470B480B4B-0B4D0B560B570B620B630B820BBE-0BC20BC6-0BC80BCA-0BCD0BD70C01-0C030C3E-0C440C46-0C480C4A-0C4D0C550C560C620C630C820C830CBC0CBE-0CC40CC6-0CC80CCA-0CCD0CD50CD60CE20CE30D020D030D3E-0D440D46-0D480D4A-0D4D0D570D620D630D820D830DCA0DCF-0DD40DD60DD8-0DDF0DF20DF30E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F3E0F3F0F71-0F840F860F870F90-0F970F99-0FBC0FC6102B-103E1056-1059105E-10601062-10641067-106D1071-10741082-108D108F109A-109D135F1712-17141732-1734175217531772177317B6-17D317DD180B-180D18A91920-192B1930-193B19B0-19C019C819C91A17-1A1B1A55-1A5E1A60-1A7C1A7F1B00-1B041B34-1B441B6B-1B731B80-1B821BA1-1BAA1C24-1C371CD0-1CD21CD4-1CE81CED1CF21DC0-1DE61DFD-1DFF20D0-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66F-A672A67CA67DA6F0A6F1A802A806A80BA823-A827A880A881A8B4-A8C4A8E0-A8F1A926-A92DA947-A953A980-A983A9B3-A9C0AA29-AA36AA43AA4CAA4DAA7BAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE3-ABEAABECABEDFB1EFE00-FE0FFE20-FE26",
- Mn: "0300-036F0483-04870591-05BD05BF05C105C205C405C505C70610-061A064B-065E067006D6-06DC06DF-06E406E706E806EA-06ED07110730-074A07A6-07B007EB-07F30816-0819081B-08230825-08270829-082D0900-0902093C0941-0948094D0951-095509620963098109BC09C1-09C409CD09E209E30A010A020A3C0A410A420A470A480A4B-0A4D0A510A700A710A750A810A820ABC0AC1-0AC50AC70AC80ACD0AE20AE30B010B3C0B3F0B41-0B440B4D0B560B620B630B820BC00BCD0C3E-0C400C46-0C480C4A-0C4D0C550C560C620C630CBC0CBF0CC60CCC0CCD0CE20CE30D41-0D440D4D0D620D630DCA0DD2-0DD40DD60E310E34-0E3A0E47-0E4E0EB10EB4-0EB90EBB0EBC0EC8-0ECD0F180F190F350F370F390F71-0F7E0F80-0F840F860F870F90-0F970F99-0FBC0FC6102D-10301032-10371039103A103D103E10581059105E-10601071-1074108210851086108D109D135F1712-17141732-1734175217531772177317B7-17BD17C617C9-17D317DD180B-180D18A91920-19221927192819321939-193B1A171A181A561A58-1A5E1A601A621A65-1A6C1A73-1A7C1A7F1B00-1B031B341B36-1B3A1B3C1B421B6B-1B731B801B811BA2-1BA51BA81BA91C2C-1C331C361C371CD0-1CD21CD4-1CE01CE2-1CE81CED1DC0-1DE61DFD-1DFF20D0-20DC20E120E5-20F02CEF-2CF12DE0-2DFF302A-302F3099309AA66FA67CA67DA6F0A6F1A802A806A80BA825A826A8C4A8E0-A8F1A926-A92DA947-A951A980-A982A9B3A9B6-A9B9A9BCAA29-AA2EAA31AA32AA35AA36AA43AA4CAAB0AAB2-AAB4AAB7AAB8AABEAABFAAC1ABE5ABE8ABEDFB1EFE00-FE0FFE20-FE26",
- Mc: "0903093E-09400949-094C094E0982098309BE-09C009C709C809CB09CC09D70A030A3E-0A400A830ABE-0AC00AC90ACB0ACC0B020B030B3E0B400B470B480B4B0B4C0B570BBE0BBF0BC10BC20BC6-0BC80BCA-0BCC0BD70C01-0C030C41-0C440C820C830CBE0CC0-0CC40CC70CC80CCA0CCB0CD50CD60D020D030D3E-0D400D46-0D480D4A-0D4C0D570D820D830DCF-0DD10DD8-0DDF0DF20DF30F3E0F3F0F7F102B102C10311038103B103C105610571062-10641067-106D108310841087-108C108F109A-109C17B617BE-17C517C717C81923-19261929-192B193019311933-193819B0-19C019C819C91A19-1A1B1A551A571A611A631A641A6D-1A721B041B351B3B1B3D-1B411B431B441B821BA11BA61BA71BAA1C24-1C2B1C341C351CE11CF2A823A824A827A880A881A8B4-A8C3A952A953A983A9B4A9B5A9BAA9BBA9BD-A9C0AA2FAA30AA33AA34AA4DAA7BABE3ABE4ABE6ABE7ABE9ABEAABEC",
- Me: "0488048906DE20DD-20E020E2-20E4A670-A672",
- N: "0030-003900B200B300B900BC-00BE0660-066906F0-06F907C0-07C90966-096F09E6-09EF09F4-09F90A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BF20C66-0C6F0C78-0C7E0CE6-0CEF0D66-0D750E50-0E590ED0-0ED90F20-0F331040-10491090-10991369-137C16EE-16F017E0-17E917F0-17F91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C5920702074-20792080-20892150-21822185-21892460-249B24EA-24FF2776-27932CFD30073021-30293038-303A3192-31953220-32293251-325F3280-328932B1-32BFA620-A629A6E6-A6EFA830-A835A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
- Nd: "0030-00390660-066906F0-06F907C0-07C90966-096F09E6-09EF0A66-0A6F0AE6-0AEF0B66-0B6F0BE6-0BEF0C66-0C6F0CE6-0CEF0D66-0D6F0E50-0E590ED0-0ED90F20-0F291040-10491090-109917E0-17E91810-18191946-194F19D0-19DA1A80-1A891A90-1A991B50-1B591BB0-1BB91C40-1C491C50-1C59A620-A629A8D0-A8D9A900-A909A9D0-A9D9AA50-AA59ABF0-ABF9FF10-FF19",
- Nl: "16EE-16F02160-21822185-218830073021-30293038-303AA6E6-A6EF",
- No: "00B200B300B900BC-00BE09F4-09F90BF0-0BF20C78-0C7E0D70-0D750F2A-0F331369-137C17F0-17F920702074-20792080-20892150-215F21892460-249B24EA-24FF2776-27932CFD3192-31953220-32293251-325F3280-328932B1-32BFA830-A835",
- P: "0021-00230025-002A002C-002F003A003B003F0040005B-005D005F007B007D00A100AB00B700BB00BF037E0387055A-055F0589058A05BE05C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F3A-0F3D0F850FD0-0FD4104A-104F10FB1361-13681400166D166E169B169C16EB-16ED1735173617D4-17D617D8-17DA1800-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD32010-20272030-20432045-20512053-205E207D207E208D208E2329232A2768-277527C527C627E6-27EF2983-299829D8-29DB29FC29FD2CF9-2CFC2CFE2CFF2E00-2E2E2E302E313001-30033008-30113014-301F3030303D30A030FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFD3EFD3FFE10-FE19FE30-FE52FE54-FE61FE63FE68FE6AFE6BFF01-FF03FF05-FF0AFF0C-FF0FFF1AFF1BFF1FFF20FF3B-FF3DFF3FFF5BFF5DFF5F-FF65",
- Pd: "002D058A05BE140018062010-20152E172E1A301C303030A0FE31FE32FE58FE63FF0D",
- Ps: "0028005B007B0F3A0F3C169B201A201E2045207D208D23292768276A276C276E27702772277427C527E627E827EA27EC27EE2983298529872989298B298D298F299129932995299729D829DA29FC2E222E242E262E283008300A300C300E3010301430163018301A301DFD3EFE17FE35FE37FE39FE3BFE3DFE3FFE41FE43FE47FE59FE5BFE5DFF08FF3BFF5BFF5FFF62",
- Pe: "0029005D007D0F3B0F3D169C2046207E208E232A2769276B276D276F27712773277527C627E727E927EB27ED27EF298429862988298A298C298E2990299229942996299829D929DB29FD2E232E252E272E293009300B300D300F3011301530173019301B301E301FFD3FFE18FE36FE38FE3AFE3CFE3EFE40FE42FE44FE48FE5AFE5CFE5EFF09FF3DFF5DFF60FF63",
- Pi: "00AB2018201B201C201F20392E022E042E092E0C2E1C2E20",
- Pf: "00BB2019201D203A2E032E052E0A2E0D2E1D2E21",
- Pc: "005F203F20402054FE33FE34FE4D-FE4FFF3F",
- Po: "0021-00230025-0027002A002C002E002F003A003B003F0040005C00A100B700BF037E0387055A-055F058905C005C305C605F305F40609060A060C060D061B061E061F066A-066D06D40700-070D07F7-07F90830-083E0964096509700DF40E4F0E5A0E5B0F04-0F120F850FD0-0FD4104A-104F10FB1361-1368166D166E16EB-16ED1735173617D4-17D617D8-17DA1800-18051807-180A1944194519DE19DF1A1E1A1F1AA0-1AA61AA8-1AAD1B5A-1B601C3B-1C3F1C7E1C7F1CD3201620172020-20272030-2038203B-203E2041-20432047-205120532055-205E2CF9-2CFC2CFE2CFF2E002E012E06-2E082E0B2E0E-2E162E182E192E1B2E1E2E1F2E2A-2E2E2E302E313001-3003303D30FBA4FEA4FFA60D-A60FA673A67EA6F2-A6F7A874-A877A8CEA8CFA8F8-A8FAA92EA92FA95FA9C1-A9CDA9DEA9DFAA5C-AA5FAADEAADFABEBFE10-FE16FE19FE30FE45FE46FE49-FE4CFE50-FE52FE54-FE57FE5F-FE61FE68FE6AFE6BFF01-FF03FF05-FF07FF0AFF0CFF0EFF0FFF1AFF1BFF1FFF20FF3CFF61FF64FF65",
- S: "0024002B003C-003E005E0060007C007E00A2-00A900AC00AE-00B100B400B600B800D700F702C2-02C502D2-02DF02E5-02EB02ED02EF-02FF03750384038503F604820606-0608060B060E060F06E906FD06FE07F609F209F309FA09FB0AF10B700BF3-0BFA0C7F0CF10CF20D790E3F0F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-139917DB194019E0-19FF1B61-1B6A1B74-1B7C1FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE20442052207A-207C208A-208C20A0-20B8210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B2140-2144214A-214D214F2190-2328232B-23E82400-24262440-244A249C-24E92500-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE27C0-27C427C7-27CA27CC27D0-27E527F0-29822999-29D729DC-29FB29FE-2B4C2B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F309B309C319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A700-A716A720A721A789A78AA828-A82BA836-A839AA77-AA79FB29FDFCFDFDFE62FE64-FE66FE69FF04FF0BFF1C-FF1EFF3EFF40FF5CFF5EFFE0-FFE6FFE8-FFEEFFFCFFFD",
- Sm: "002B003C-003E007C007E00AC00B100D700F703F60606-060820442052207A-207C208A-208C2140-2144214B2190-2194219A219B21A021A321A621AE21CE21CF21D221D421F4-22FF2308-230B23202321237C239B-23B323DC-23E125B725C125F8-25FF266F27C0-27C427C7-27CA27CC27D0-27E527F0-27FF2900-29822999-29D729DC-29FB29FE-2AFF2B30-2B442B47-2B4CFB29FE62FE64-FE66FF0BFF1C-FF1EFF5CFF5EFFE2FFE9-FFEC",
- Sc: "002400A2-00A5060B09F209F309FB0AF10BF90E3F17DB20A0-20B8A838FDFCFE69FF04FFE0FFE1FFE5FFE6",
- Sk: "005E006000A800AF00B400B802C2-02C502D2-02DF02E5-02EB02ED02EF-02FF0375038403851FBD1FBF-1FC11FCD-1FCF1FDD-1FDF1FED-1FEF1FFD1FFE309B309CA700-A716A720A721A789A78AFF3EFF40FFE3",
- So: "00A600A700A900AE00B000B60482060E060F06E906FD06FE07F609FA0B700BF3-0BF80BFA0C7F0CF10CF20D790F01-0F030F13-0F170F1A-0F1F0F340F360F380FBE-0FC50FC7-0FCC0FCE0FCF0FD5-0FD8109E109F13601390-1399194019E0-19FF1B61-1B6A1B74-1B7C210021012103-21062108210921142116-2118211E-2123212521272129212E213A213B214A214C214D214F2195-2199219C-219F21A121A221A421A521A7-21AD21AF-21CD21D021D121D321D5-21F32300-2307230C-231F2322-2328232B-237B237D-239A23B4-23DB23E2-23E82400-24262440-244A249C-24E92500-25B625B8-25C025C2-25F72600-266E2670-26CD26CF-26E126E326E8-26FF2701-27042706-2709270C-27272729-274B274D274F-27522756-275E2761-276727942798-27AF27B1-27BE2800-28FF2B00-2B2F2B452B462B50-2B592CE5-2CEA2E80-2E992E9B-2EF32F00-2FD52FF0-2FFB300430123013302030363037303E303F319031913196-319F31C0-31E33200-321E322A-32503260-327F328A-32B032C0-32FE3300-33FF4DC0-4DFFA490-A4C6A828-A82BA836A837A839AA77-AA79FDFDFFE4FFE8FFEDFFEEFFFCFFFD",
- Z: "002000A01680180E2000-200A20282029202F205F3000",
- Zs: "002000A01680180E2000-200A202F205F3000",
- Zl: "2028",
- Zp: "2029",
- C: "0000-001F007F-009F00AD03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-0605061C061D0620065F06DD070E070F074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17B417B517DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF200B-200F202A-202E2060-206F20722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-F8FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFD-FF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFFBFFFEFFFF",
- Cc: "0000-001F007F-009F",
- Cf: "00AD0600-060306DD070F17B417B5200B-200F202A-202E2060-2064206A-206FFEFFFFF9-FFFB",
- Co: "E000-F8FF",
- Cs: "D800-DFFF",
- Cn: "03780379037F-0383038B038D03A20526-05300557055805600588058B-059005C8-05CF05EB-05EF05F5-05FF06040605061C061D0620065F070E074B074C07B2-07BF07FB-07FF082E082F083F-08FF093A093B094F095609570973-097809800984098D098E0991099209A909B109B3-09B509BA09BB09C509C609C909CA09CF-09D609D8-09DB09DE09E409E509FC-0A000A040A0B-0A0E0A110A120A290A310A340A370A3A0A3B0A3D0A43-0A460A490A4A0A4E-0A500A52-0A580A5D0A5F-0A650A76-0A800A840A8E0A920AA90AB10AB40ABA0ABB0AC60ACA0ACE0ACF0AD1-0ADF0AE40AE50AF00AF2-0B000B040B0D0B0E0B110B120B290B310B340B3A0B3B0B450B460B490B4A0B4E-0B550B58-0B5B0B5E0B640B650B72-0B810B840B8B-0B8D0B910B96-0B980B9B0B9D0BA0-0BA20BA5-0BA70BAB-0BAD0BBA-0BBD0BC3-0BC50BC90BCE0BCF0BD1-0BD60BD8-0BE50BFB-0C000C040C0D0C110C290C340C3A-0C3C0C450C490C4E-0C540C570C5A-0C5F0C640C650C70-0C770C800C810C840C8D0C910CA90CB40CBA0CBB0CC50CC90CCE-0CD40CD7-0CDD0CDF0CE40CE50CF00CF3-0D010D040D0D0D110D290D3A-0D3C0D450D490D4E-0D560D58-0D5F0D640D650D76-0D780D800D810D840D97-0D990DB20DBC0DBE0DBF0DC7-0DC90DCB-0DCE0DD50DD70DE0-0DF10DF5-0E000E3B-0E3E0E5C-0E800E830E850E860E890E8B0E8C0E8E-0E930E980EA00EA40EA60EA80EA90EAC0EBA0EBE0EBF0EC50EC70ECE0ECF0EDA0EDB0EDE-0EFF0F480F6D-0F700F8C-0F8F0F980FBD0FCD0FD9-0FFF10C6-10CF10FD-10FF1249124E124F12571259125E125F1289128E128F12B112B612B712BF12C112C612C712D7131113161317135B-135E137D-137F139A-139F13F5-13FF169D-169F16F1-16FF170D1715-171F1737-173F1754-175F176D17711774-177F17DE17DF17EA-17EF17FA-17FF180F181A-181F1878-187F18AB-18AF18F6-18FF191D-191F192C-192F193C-193F1941-1943196E196F1975-197F19AC-19AF19CA-19CF19DB-19DD1A1C1A1D1A5F1A7D1A7E1A8A-1A8F1A9A-1A9F1AAE-1AFF1B4C-1B4F1B7D-1B7F1BAB-1BAD1BBA-1BFF1C38-1C3A1C4A-1C4C1C80-1CCF1CF3-1CFF1DE7-1DFC1F161F171F1E1F1F1F461F471F4E1F4F1F581F5A1F5C1F5E1F7E1F7F1FB51FC51FD41FD51FDC1FF01FF11FF51FFF2065-206920722073208F2095-209F20B9-20CF20F1-20FF218A-218F23E9-23FF2427-243F244B-245F26CE26E226E4-26E727002705270A270B2728274C274E2753-2755275F27602795-279727B027BF27CB27CD-27CF2B4D-2B4F2B5A-2BFF2C2F2C5F2CF2-2CF82D26-2D2F2D66-2D6E2D70-2D7F2D97-2D9F2DA72DAF2DB72DBF2DC72DCF2DD72DDF2E32-2E7F2E9A2EF4-2EFF2FD6-2FEF2FFC-2FFF3040309730983100-3104312E-3130318F31B8-31BF31E4-31EF321F32FF4DB6-4DBF9FCC-9FFFA48D-A48FA4C7-A4CFA62C-A63FA660A661A674-A67BA698-A69FA6F8-A6FFA78D-A7FAA82C-A82FA83A-A83FA878-A87FA8C5-A8CDA8DA-A8DFA8FC-A8FFA954-A95EA97D-A97FA9CEA9DA-A9DDA9E0-A9FFAA37-AA3FAA4EAA4FAA5AAA5BAA7C-AA7FAAC3-AADAAAE0-ABBFABEEABEFABFA-ABFFD7A4-D7AFD7C7-D7CAD7FC-D7FFFA2EFA2FFA6EFA6FFADA-FAFFFB07-FB12FB18-FB1CFB37FB3DFB3FFB42FB45FBB2-FBD2FD40-FD4FFD90FD91FDC8-FDEFFDFEFDFFFE1A-FE1FFE27-FE2FFE53FE67FE6C-FE6FFE75FEFDFEFEFF00FFBF-FFC1FFC8FFC9FFD0FFD1FFD8FFD9FFDD-FFDFFFE7FFEF-FFF8FFFEFFFF"
- });
-
- function addUnicodePackage (pack) {
- var codePoint = /\w{4}/g;
- for (var name in pack)
- exports.packages[name] = pack[name].replace(codePoint, "\\u$&");
- };
-
- });
-
- ace.define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/range', 'ace/anchor'], function(require, exports, module) {
-
-
- var oop = require("./lib/oop");
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
- var Range = require("./range").Range;
- var Anchor = require("./anchor").Anchor;
-
- /**
- * new Document([text])
- * - text (String | Array): The starting text
- *
- * Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
- *
- **/
- var Document = function(text) {
- this.$lines = [];
-
- // There has to be one line at least in the document. If you pass an empty
- // string to the insert function, nothing will happen. Workaround.
- if (text.length == 0) {
- this.$lines = [""];
- } else if (Array.isArray(text)) {
- this.insertLines(0, text);
- } else {
- this.insert({row: 0, column:0}, text);
- }
- };
-
- (function() {
-
- oop.implement(this, EventEmitter);
- this.setValue = function(text) {
- var len = this.getLength();
- this.remove(new Range(0, 0, len, this.getLine(len-1).length));
- this.insert({row: 0, column:0}, text);
- };
- this.getValue = function() {
- return this.getAllLines().join(this.getNewLineCharacter());
- };
- this.createAnchor = function(row, column) {
- return new Anchor(this, row, column);
- };
-
- // check for IE split bug
- if ("aaa".split(/a/).length == 0)
- this.$split = function(text) {
- return text.replace(/\r\n|\r/g, "\n").split("\n");
- }
- else
- this.$split = function(text) {
- return text.split(/\r\n|\r|\n/);
- };
- this.$detectNewLine = function(text) {
- var match = text.match(/^.*?(\r\n|\r|\n)/m);
- if (match) {
- this.$autoNewLine = match[1];
- } else {
- this.$autoNewLine = "\n";
- }
- };
- this.getNewLineCharacter = function() {
- switch (this.$newLineMode) {
- case "windows":
- return "\r\n";
-
- case "unix":
- return "\n";
-
- case "auto":
- return this.$autoNewLine;
- }
- };
-
- this.$autoNewLine = "\n";
- this.$newLineMode = "auto";
- this.setNewLineMode = function(newLineMode) {
- if (this.$newLineMode === newLineMode)
- return;
-
- this.$newLineMode = newLineMode;
- };
- this.getNewLineMode = function() {
- return this.$newLineMode;
- };
- this.isNewLine = function(text) {
- return (text == "\r\n" || text == "\r" || text == "\n");
- };
- this.getLine = function(row) {
- return this.$lines[row] || "";
- };
- this.getLines = function(firstRow, lastRow) {
- return this.$lines.slice(firstRow, lastRow + 1);
- };
- this.getAllLines = function() {
- return this.getLines(0, this.getLength());
- };
- this.getLength = function() {
- return this.$lines.length;
- };
- this.getTextRange = function(range) {
- if (range.start.row == range.end.row) {
- return this.$lines[range.start.row].substring(range.start.column,
- range.end.column);
- }
- else {
- var lines = this.getLines(range.start.row+1, range.end.row-1);
- lines.unshift((this.$lines[range.start.row] || "").substring(range.start.column));
- lines.push((this.$lines[range.end.row] || "").substring(0, range.end.column));
- return lines.join(this.getNewLineCharacter());
- }
- };
- this.$clipPosition = function(position) {
- var length = this.getLength();
- if (position.row >= length) {
- position.row = Math.max(0, length - 1);
- position.column = this.getLine(length-1).length;
- }
- return position;
- };
- this.insert = function(position, text) {
- if (!text || text.length === 0)
- return position;
-
- position = this.$clipPosition(position);
-
- // only detect new lines if the document has no line break yet
- if (this.getLength() <= 1)
- this.$detectNewLine(text);
-
- var lines = this.$split(text);
- var firstLine = lines.splice(0, 1)[0];
- var lastLine = lines.length == 0 ? null : lines.splice(lines.length - 1, 1)[0];
-
- position = this.insertInLine(position, firstLine);
- if (lastLine !== null) {
- position = this.insertNewLine(position); // terminate first line
- position = this.insertLines(position.row, lines);
- position = this.insertInLine(position, lastLine || "");
- }
- return position;
- };
- this.insertLines = function(row, lines) {
- if (lines.length == 0)
- return {row: row, column: 0};
-
- // apply doesn't work for big arrays (smallest threshold is on safari 0xFFFF)
- // to circumvent that we have to break huge inserts into smaller chunks here
- if (lines.length > 0xFFFF) {
- var end = this.insertLines(row, lines.slice(0xFFFF));
- lines = lines.slice(0, 0xFFFF);
- }
-
- var args = [row, 0];
- args.push.apply(args, lines);
- this.$lines.splice.apply(this.$lines, args);
-
- var range = new Range(row, 0, row + lines.length, 0);
- var delta = {
- action: "insertLines",
- range: range,
- lines: lines
- };
- this._emit("change", { data: delta });
- return end || range.end;
- };
- this.insertNewLine = function(position) {
- position = this.$clipPosition(position);
- var line = this.$lines[position.row] || "";
-
- this.$lines[position.row] = line.substring(0, position.column);
- this.$lines.splice(position.row + 1, 0, line.substring(position.column, line.length));
-
- var end = {
- row : position.row + 1,
- column : 0
- };
-
- var delta = {
- action: "insertText",
- range: Range.fromPoints(position, end),
- text: this.getNewLineCharacter()
- };
- this._emit("change", { data: delta });
-
- return end;
- };
- this.insertInLine = function(position, text) {
- if (text.length == 0)
- return position;
-
- var line = this.$lines[position.row] || "";
-
- this.$lines[position.row] = line.substring(0, position.column) + text
- + line.substring(position.column);
-
- var end = {
- row : position.row,
- column : position.column + text.length
- };
-
- var delta = {
- action: "insertText",
- range: Range.fromPoints(position, end),
- text: text
- };
- this._emit("change", { data: delta });
-
- return end;
- };
- this.remove = function(range) {
- // clip to document
- range.start = this.$clipPosition(range.start);
- range.end = this.$clipPosition(range.end);
-
- if (range.isEmpty())
- return range.start;
-
- var firstRow = range.start.row;
- var lastRow = range.end.row;
-
- if (range.isMultiLine()) {
- var firstFullRow = range.start.column == 0 ? firstRow : firstRow + 1;
- var lastFullRow = lastRow - 1;
-
- if (range.end.column > 0)
- this.removeInLine(lastRow, 0, range.end.column);
-
- if (lastFullRow >= firstFullRow)
- this.removeLines(firstFullRow, lastFullRow);
-
- if (firstFullRow != firstRow) {
- this.removeInLine(firstRow, range.start.column, this.getLine(firstRow).length);
- this.removeNewLine(range.start.row);
- }
- }
- else {
- this.removeInLine(firstRow, range.start.column, range.end.column);
- }
- return range.start;
- };
- this.removeInLine = function(row, startColumn, endColumn) {
- if (startColumn == endColumn)
- return;
-
- var range = new Range(row, startColumn, row, endColumn);
- var line = this.getLine(row);
- var removed = line.substring(startColumn, endColumn);
- var newLine = line.substring(0, startColumn) + line.substring(endColumn, line.length);
- this.$lines.splice(row, 1, newLine);
-
- var delta = {
- action: "removeText",
- range: range,
- text: removed
- };
- this._emit("change", { data: delta });
- return range.start;
- };
- this.removeLines = function(firstRow, lastRow) {
- var range = new Range(firstRow, 0, lastRow + 1, 0);
- var removed = this.$lines.splice(firstRow, lastRow - firstRow + 1);
-
- var delta = {
- action: "removeLines",
- range: range,
- nl: this.getNewLineCharacter(),
- lines: removed
- };
- this._emit("change", { data: delta });
- return removed;
- };
- this.removeNewLine = function(row) {
- var firstLine = this.getLine(row);
- var secondLine = this.getLine(row+1);
-
- var range = new Range(row, firstLine.length, row+1, 0);
- var line = firstLine + secondLine;
-
- this.$lines.splice(row, 2, line);
-
- var delta = {
- action: "removeText",
- range: range,
- text: this.getNewLineCharacter()
- };
- this._emit("change", { data: delta });
- };
- this.replace = function(range, text) {
- if (text.length == 0 && range.isEmpty())
- return range.start;
-
- // Shortcut: If the text we want to insert is the same as it is already
- // in the document, we don't have to replace anything.
- if (text == this.getTextRange(range))
- return range.end;
-
- this.remove(range);
- if (text) {
- var end = this.insert(range.start, text);
- }
- else {
- end = range.start;
- }
-
- return end;
- };
- this.applyDeltas = function(deltas) {
- for (var i=0; i<deltas.length; i++) {
- var delta = deltas[i];
- var range = Range.fromPoints(delta.range.start, delta.range.end);
-
- if (delta.action == "insertLines")
- this.insertLines(range.start.row, delta.lines);
- else if (delta.action == "insertText")
- this.insert(range.start, delta.text);
- else if (delta.action == "removeLines")
- this.removeLines(range.start.row, range.end.row - 1);
- else if (delta.action == "removeText")
- this.remove(range);
- }
- };
- this.revertDeltas = function(deltas) {
- for (var i=deltas.length-1; i>=0; i--) {
- var delta = deltas[i];
-
- var range = Range.fromPoints(delta.range.start, delta.range.end);
-
- if (delta.action == "insertLines")
- this.removeLines(range.start.row, range.end.row - 1);
- else if (delta.action == "insertText")
- this.remove(range);
- else if (delta.action == "removeLines")
- this.insertLines(range.start.row, delta.lines);
- else if (delta.action == "removeText")
- this.insert(range.start, delta.text);
- }
- };
-
- }).call(Document.prototype);
-
- exports.Document = Document;
- });
-
- ace.define('ace/anchor', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
-
-
- var oop = require("./lib/oop");
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
-
- /**
- * new Anchor(doc, row, column)
- * - doc (Document): The document to associate with the anchor
- * - row (Number): The starting row position
- * - column (Number): The starting column position
- *
- * Creates a new `Anchor` and associates it with a document.
- *
- **/
-
- var Anchor = exports.Anchor = function(doc, row, column) {
- this.document = doc;
-
- if (typeof column == "undefined")
- this.setPosition(row.row, row.column);
- else
- this.setPosition(row, column);
-
- this.$onChange = this.onChange.bind(this);
- doc.on("change", this.$onChange);
- };
-
- (function() {
-
- oop.implement(this, EventEmitter);
-
- this.getPosition = function() {
- return this.$clipPositionToDocument(this.row, this.column);
- };
-
- this.getDocument = function() {
- return this.document;
- };
-
- this.onChange = function(e) {
- var delta = e.data;
- var range = delta.range;
-
- if (range.start.row == range.end.row && range.start.row != this.row)
- return;
-
- if (range.start.row > this.row)
- return;
-
- if (range.start.row == this.row && range.start.column > this.column)
- return;
-
- var row = this.row;
- var column = this.column;
-
- if (delta.action === "insertText") {
- if (range.start.row === row && range.start.column <= column) {
- if (range.start.row === range.end.row) {
- column += range.end.column - range.start.column;
- }
- else {
- column -= range.start.column;
- row += range.end.row - range.start.row;
- }
- }
- else if (range.start.row !== range.end.row && range.start.row < row) {
- row += range.end.row - range.start.row;
- }
- } else if (delta.action === "insertLines") {
- if (range.start.row <= row) {
- row += range.end.row - range.start.row;
- }
- }
- else if (delta.action == "removeText") {
- if (range.start.row == row && range.start.column < column) {
- if (range.end.column >= column)
- column = range.start.column;
- else
- column = Math.max(0, column - (range.end.column - range.start.column));
-
- } else if (range.start.row !== range.end.row && range.start.row < row) {
- if (range.end.row == row) {
- column = Math.max(0, column - range.end.column) + range.start.column;
- }
- row -= (range.end.row - range.start.row);
- }
- else if (range.end.row == row) {
- row -= range.end.row - range.start.row;
- column = Math.max(0, column - range.end.column) + range.start.column;
- }
- } else if (delta.action == "removeLines") {
- if (range.start.row <= row) {
- if (range.end.row <= row)
- row -= range.end.row - range.start.row;
- else {
- row = range.start.row;
- column = 0;
- }
- }
- }
-
- this.setPosition(row, column, true);
- };
-
- this.setPosition = function(row, column, noClip) {
- var pos;
- if (noClip) {
- pos = {
- row: row,
- column: column
- };
- }
- else {
- pos = this.$clipPositionToDocument(row, column);
- }
-
- if (this.row == pos.row && this.column == pos.column)
- return;
-
- var old = {
- row: this.row,
- column: this.column
- };
-
- this.row = pos.row;
- this.column = pos.column;
- this._emit("change", {
- old: old,
- value: pos
- });
- };
-
- this.detach = function() {
- this.document.removeEventListener("change", this.$onChange);
- };
-
- this.$clipPositionToDocument = function(row, column) {
- var pos = {};
-
- if (row >= this.document.getLength()) {
- pos.row = Math.max(0, this.document.getLength() - 1);
- pos.column = this.document.getLine(pos.row).length;
- }
- else if (row < 0) {
- pos.row = 0;
- pos.column = 0;
- }
- else {
- pos.row = row;
- pos.column = Math.min(this.document.getLine(pos.row).length, Math.max(0, column));
- }
-
- if (column < 0)
- pos.column = 0;
-
- return pos;
- };
-
- }).call(Anchor.prototype);
-
- });
-
- ace.define('ace/background_tokenizer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
-
-
- var oop = require("./lib/oop");
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
-
- // tokenizing lines longer than this makes editor very slow
- var MAX_LINE_LENGTH = 5000;
-
- /**
- * new BackgroundTokenizer(tokenizer, editor)
- * - tokenizer (Tokenizer): The tokenizer to use
- * - editor (Editor): The editor to associate with
- *
- * Creates a new `BackgroundTokenizer` object.
- *
- *
- **/
-
- var BackgroundTokenizer = function(tokenizer, editor) {
- this.running = false;
- this.lines = [];
- this.states = [];
- this.currentLine = 0;
- this.tokenizer = tokenizer;
-
- var self = this;
-
- this.$worker = function() {
- if (!self.running) { return; }
-
- var workerStart = new Date();
- var startLine = self.currentLine;
- var doc = self.doc;
-
- var processedLines = 0;
-
- var len = doc.getLength();
- while (self.currentLine < len) {
- self.$tokenizeRow(self.currentLine);
- while (self.lines[self.currentLine])
- self.currentLine++;
-
- // only check every 5 lines
- processedLines ++;
- if ((processedLines % 5 == 0) && (new Date() - workerStart) > 20) {
- self.fireUpdateEvent(startLine, self.currentLine-1);
- self.running = setTimeout(self.$worker, 20);
- return;
- }
- }
-
- self.running = false;
-
- self.fireUpdateEvent(startLine, len - 1);
- };
- };
-
- (function(){
-
- oop.implement(this, EventEmitter);
- this.setTokenizer = function(tokenizer) {
- this.tokenizer = tokenizer;
- this.lines = [];
- this.states = [];
-
- this.start(0);
- };
- this.setDocument = function(doc) {
- this.doc = doc;
- this.lines = [];
- this.states = [];
-
- this.stop();
- };
- this.fireUpdateEvent = function(firstRow, lastRow) {
- var data = {
- first: firstRow,
- last: lastRow
- };
- this._emit("update", {data: data});
- };
- this.start = function(startRow) {
- this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
-
- // remove all cached items below this line
- this.lines.splice(this.currentLine, this.lines.length);
- this.states.splice(this.currentLine, this.states.length);
-
- this.stop();
- // pretty long delay to prevent the tokenizer from interfering with the user
- this.running = setTimeout(this.$worker, 700);
- };
-
- this.$updateOnChange = function(delta) {
- var range = delta.range;
- var startRow = range.start.row;
- var len = range.end.row - startRow;
-
- if (len === 0) {
- this.lines[startRow] = null;
- } else if (delta.action == "removeText" || delta.action == "removeLines") {
- this.lines.splice(startRow, len + 1, null);
- this.states.splice(startRow, len + 1, null);
- } else {
- var args = Array(len + 1);
- args.unshift(startRow, 1);
- this.lines.splice.apply(this.lines, args);
- this.states.splice.apply(this.states, args);
- }
-
- this.currentLine = Math.min(startRow, this.currentLine, this.doc.getLength());
-
- this.stop();
- // pretty long delay to prevent the tokenizer from interfering with the user
- this.running = setTimeout(this.$worker, 700);
- };
- this.stop = function() {
- if (this.running)
- clearTimeout(this.running);
- this.running = false;
- };
- this.getTokens = function(row) {
- return this.lines[row] || this.$tokenizeRow(row);
- };
- this.getState = function(row) {
- if (this.currentLine == row)
- this.$tokenizeRow(row);
- return this.states[row] || "start";
- };
-
- this.$tokenizeRow = function(row) {
- var line = this.doc.getLine(row);
- var state = this.states[row - 1];
-
- if (line.length > MAX_LINE_LENGTH) {
- var overflow = {value: line.substr(MAX_LINE_LENGTH), type: "text"};
- line = line.slice(0, MAX_LINE_LENGTH);
- }
- var data = this.tokenizer.getLineTokens(line, state);
- if (overflow) {
- data.tokens.push(overflow);
- data.state = "start";
- }
-
- if (this.states[row] !== data.state) {
- this.states[row] = data.state;
- this.lines[row + 1] = null;
- if (this.currentLine > row + 1)
- this.currentLine = row + 1;
- } else if (this.currentLine == row) {
- this.currentLine = row + 1;
- }
-
- return this.lines[row] = data.tokens;
- };
-
- }).call(BackgroundTokenizer.prototype);
-
- exports.BackgroundTokenizer = BackgroundTokenizer;
- });
-
- ace.define('ace/search_highlight', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/range'], function(require, exports, module) {
-
-
- var lang = require("./lib/lang");
- var oop = require("./lib/oop");
- var Range = require("./range").Range;
-
- var SearchHighlight = function(regExp, clazz, type) {
- this.setRegexp(regExp);
- this.clazz = clazz;
- this.type = type || "text";
- };
-
- (function() {
- this.setRegexp = function(regExp) {
- if (this.regExp+"" == regExp+"")
- return;
- this.regExp = regExp;
- this.cache = [];
- };
-
- this.update = function(html, markerLayer, session, config) {
- if (!this.regExp)
- return;
- var start = config.firstRow, end = config.lastRow;
-
- for (var i = start; i <= end; i++) {
- var ranges = this.cache[i];
- if (ranges == null) {
- ranges = lang.getMatchOffsets(session.getLine(i), this.regExp);
- ranges = ranges.map(function(match) {
- return new Range(i, match.offset, i, match.offset + match.length);
- });
- this.cache[i] = ranges.length ? ranges : "";
- }
-
- for (var j = ranges.length; j --; ) {
- markerLayer.drawSingleLineMarker(
- html, ranges[j].toScreenRange(session), this.clazz, config,
- null, this.type
- );
- }
- }
- };
-
- }).call(SearchHighlight.prototype);
-
- exports.SearchHighlight = SearchHighlight;
- });
-
- ace.define('ace/edit_session/folding', ['require', 'exports', 'module' , 'ace/range', 'ace/edit_session/fold_line', 'ace/edit_session/fold', 'ace/token_iterator'], function(require, exports, module) {
-
-
- var Range = require("../range").Range;
- var FoldLine = require("./fold_line").FoldLine;
- var Fold = require("./fold").Fold;
- var TokenIterator = require("../token_iterator").TokenIterator;
-
- function Folding() {
- /*
- * Looks up a fold at a given row/column. Possible values for side:
- * -1: ignore a fold if fold.start = row/column
- * +1: ignore a fold if fold.end = row/column
- */
- this.getFoldAt = function(row, column, side) {
- var foldLine = this.getFoldLine(row);
- if (!foldLine)
- return null;
-
- var folds = foldLine.folds;
- for (var i = 0; i < folds.length; i++) {
- var fold = folds[i];
- if (fold.range.contains(row, column)) {
- if (side == 1 && fold.range.isEnd(row, column)) {
- continue;
- } else if (side == -1 && fold.range.isStart(row, column)) {
- continue;
- }
- return fold;
- }
- }
- };
- this.getFoldsInRange = function(range) {
- range = range.clone();
- var start = range.start;
- var end = range.end;
- var foldLines = this.$foldData;
- var foundFolds = [];
-
- start.column += 1;
- end.column -= 1;
-
- for (var i = 0; i < foldLines.length; i++) {
- var cmp = foldLines[i].range.compareRange(range);
- if (cmp == 2) {
- // Range is before foldLine. No intersection. This means,
- // there might be other foldLines that intersect.
- continue;
- }
- else if (cmp == -2) {
- // Range is after foldLine. There can't be any other foldLines then,
- // so let's give up.
- break;
- }
-
- var folds = foldLines[i].folds;
- for (var j = 0; j < folds.length; j++) {
- var fold = folds[j];
- cmp = fold.range.compareRange(range);
- if (cmp == -2) {
- break;
- } else if (cmp == 2) {
- continue;
- } else
- // WTF-state: Can happen due to -1/+1 to start/end column.
- if (cmp == 42) {
- break;
- }
- foundFolds.push(fold);
- }
- }
- return foundFolds;
- };
- this.getAllFolds = function() {
- var folds = [];
- var foldLines = this.$foldData;
-
- function addFold(fold) {
- folds.push(fold);
- if (!fold.subFolds)
- return;
-
- for (var i = 0; i < fold.subFolds.length; i++)
- addFold(fold.subFolds[i]);
- }
-
- for (var i = 0; i < foldLines.length; i++)
- for (var j = 0; j < foldLines[i].folds.length; j++)
- addFold(foldLines[i].folds[j]);
-
- return folds;
- };
- this.getFoldStringAt = function(row, column, trim, foldLine) {
- foldLine = foldLine || this.getFoldLine(row);
- if (!foldLine)
- return null;
-
- var lastFold = {
- end: { column: 0 }
- };
- // TODO: Refactor to use getNextFoldTo function.
- var str, fold;
- for (var i = 0; i < foldLine.folds.length; i++) {
- fold = foldLine.folds[i];
- var cmp = fold.range.compareEnd(row, column);
- if (cmp == -1) {
- str = this
- .getLine(fold.start.row)
- .substring(lastFold.end.column, fold.start.column);
- break;
- }
- else if (cmp === 0) {
- return null;
- }
- lastFold = fold;
- }
- if (!str)
- str = this.getLine(fold.start.row).substring(lastFold.end.column);
-
- if (trim == -1)
- return str.substring(0, column - lastFold.end.column);
- else if (trim == 1)
- return str.substring(column - lastFold.end.column);
- else
- return str;
- };
-
- this.getFoldLine = function(docRow, startFoldLine) {
- var foldData = this.$foldData;
- var i = 0;
- if (startFoldLine)
- i = foldData.indexOf(startFoldLine);
- if (i == -1)
- i = 0;
- for (i; i < foldData.length; i++) {
- var foldLine = foldData[i];
- if (foldLine.start.row <= docRow && foldLine.end.row >= docRow) {
- return foldLine;
- } else if (foldLine.end.row > docRow) {
- return null;
- }
- }
- return null;
- };
-
- // returns the fold which starts after or contains docRow
- this.getNextFoldLine = function(docRow, startFoldLine) {
- var foldData = this.$foldData;
- var i = 0;
- if (startFoldLine)
- i = foldData.indexOf(startFoldLine);
- if (i == -1)
- i = 0;
- for (i; i < foldData.length; i++) {
- var foldLine = foldData[i];
- if (foldLine.end.row >= docRow) {
- return foldLine;
- }
- }
- return null;
- };
-
- this.getFoldedRowCount = function(first, last) {
- var foldData = this.$foldData, rowCount = last-first+1;
- for (var i = 0; i < foldData.length; i++) {
- var foldLine = foldData[i],
- end = foldLine.end.row,
- start = foldLine.start.row;
- if (end >= last) {
- if(start < last) {
- if(start >= first)
- rowCount -= last-start;
- else
- rowCount = 0;//in one fold
- }
- break;
- } else if(end >= first){
- if (start >= first) //fold inside range
- rowCount -= end-start;
- else
- rowCount -= end-first+1;
- }
- }
- return rowCount;
- };
-
- this.$addFoldLine = function(foldLine) {
- this.$foldData.push(foldLine);
- this.$foldData.sort(function(a, b) {
- return a.start.row - b.start.row;
- });
- return foldLine;
- };
- this.addFold = function(placeholder, range) {
- var foldData = this.$foldData;
- var added = false;
- var fold;
-
- if (placeholder instanceof Fold)
- fold = placeholder;
- else
- fold = new Fold(range, placeholder);
-
- this.$clipRangeToDocument(fold.range);
-
- var startRow = fold.start.row;
- var startColumn = fold.start.column;
- var endRow = fold.end.row;
- var endColumn = fold.end.column;
-
- // --- Some checking ---
- if (fold.placeholder.length < 2)
- throw "Placeholder has to be at least 2 characters";
-
- if (startRow == endRow && endColumn - startColumn < 2)
- throw "The range has to be at least 2 characters width";
-
- var startFold = this.getFoldAt(startRow, startColumn, 1);
- var endFold = this.getFoldAt(endRow, endColumn, -1);
- if (startFold && endFold == startFold)
- return startFold.addSubFold(fold);
-
- if (
- (startFold && !startFold.range.isStart(startRow, startColumn))
- || (endFold && !endFold.range.isEnd(endRow, endColumn))
- ) {
- throw "A fold can't intersect already existing fold" + fold.range + startFold.range;
- }
-
- // Check if there are folds in the range we create the new fold for.
- var folds = this.getFoldsInRange(fold.range);
- if (folds.length > 0) {
- // Remove the folds from fold data.
- this.removeFolds(folds);
- // Add the removed folds as subfolds on the new fold.
- fold.subFolds = folds;
- }
-
- for (var i = 0; i < foldData.length; i++) {
- var foldLine = foldData[i];
- if (endRow == foldLine.start.row) {
- foldLine.addFold(fold);
- added = true;
- break;
- }
- else if (startRow == foldLine.end.row) {
- foldLine.addFold(fold);
- added = true;
- if (!fold.sameRow) {
- // Check if we might have to merge two FoldLines.
- var foldLineNext = foldData[i + 1];
- if (foldLineNext && foldLineNext.start.row == endRow) {
- // We need to merge!
- foldLine.merge(foldLineNext);
- break;
- }
- }
- break;
- }
- else if (endRow <= foldLine.start.row) {
- break;
- }
- }
-
- if (!added)
- foldLine = this.$addFoldLine(new FoldLine(this.$foldData, fold));
-
- if (this.$useWrapMode)
- this.$updateWrapData(foldLine.start.row, foldLine.start.row);
- else
- this.$updateRowLengthCache(foldLine.start.row, foldLine.start.row);
-
- // Notify that fold data has changed.
- this.$modified = true;
- this._emit("changeFold", { data: fold });
-
- return fold;
- };
-
- this.addFolds = function(folds) {
- folds.forEach(function(fold) {
- this.addFold(fold);
- }, this);
- };
-
- this.removeFold = function(fold) {
- var foldLine = fold.foldLine;
- var startRow = foldLine.start.row;
- var endRow = foldLine.end.row;
-
- var foldLines = this.$foldData;
- var folds = foldLine.folds;
- // Simple case where there is only one fold in the FoldLine such that
- // the entire fold line can get removed directly.
- if (folds.length == 1) {
- foldLines.splice(foldLines.indexOf(foldLine), 1);
- } else
- // If the fold is the last fold of the foldLine, just remove it.
- if (foldLine.range.isEnd(fold.end.row, fold.end.column)) {
- folds.pop();
- foldLine.end.row = folds[folds.length - 1].end.row;
- foldLine.end.column = folds[folds.length - 1].end.column;
- } else
- // If the fold is the first fold of the foldLine, just remove it.
- if (foldLine.range.isStart(fold.start.row, fold.start.column)) {
- folds.shift();
- foldLine.start.row = folds[0].start.row;
- foldLine.start.column = folds[0].start.column;
- } else
- // We know there are more then 2 folds and the fold is not at the edge.
- // This means, the fold is somewhere in between.
- //
- // If the fold is in one row, we just can remove it.
- if (fold.sameRow) {
- folds.splice(folds.indexOf(fold), 1);
- } else
- // The fold goes over more then one row. This means remvoing this fold
- // will cause the fold line to get splitted up. newFoldLine is the second part
- {
- var newFoldLine = foldLine.split(fold.start.row, fold.start.column);
- folds = newFoldLine.folds;
- folds.shift();
- newFoldLine.start.row = folds[0].start.row;
- newFoldLine.start.column = folds[0].start.column;
- }
-
- if (this.$useWrapMode)
- this.$updateWrapData(startRow, endRow);
- else
- this.$updateRowLengthCache(startRow, endRow);
-
- // Notify that fold data has changed.
- this.$modified = true;
- this._emit("changeFold", { data: fold });
- };
-
- this.removeFolds = function(folds) {
- // We need to clone the folds array passed in as it might be the folds
- // array of a fold line and as we call this.removeFold(fold), folds
- // are removed from folds and changes the current index.
- var cloneFolds = [];
- for (var i = 0; i < folds.length; i++) {
- cloneFolds.push(folds[i]);
- }
-
- cloneFolds.forEach(function(fold) {
- this.removeFold(fold);
- }, this);
- this.$modified = true;
- };
-
- this.expandFold = function(fold) {
- this.removeFold(fold);
- fold.subFolds.forEach(function(fold) {
- this.addFold(fold);
- }, this);
- fold.subFolds = [];
- };
-
- this.expandFolds = function(folds) {
- folds.forEach(function(fold) {
- this.expandFold(fold);
- }, this);
- };
-
- this.unfold = function(location, expandInner) {
- var range, folds;
- if (location == null)
- range = new Range(0, 0, this.getLength(), 0);
- else if (typeof location == "number")
- range = new Range(location, 0, location, this.getLine(location).length);
- else if ("row" in location)
- range = Range.fromPoints(location, location);
- else
- range = location;
-
- folds = this.getFoldsInRange(range);
- if (expandInner) {
- this.removeFolds(folds);
- } else {
- // TODO: might need to remove and add folds in one go instead of using
- // expandFolds several times.
- while (folds.length) {
- this.expandFolds(folds);
- folds = this.getFoldsInRange(range);
- }
- }
- };
- this.isRowFolded = function(docRow, startFoldRow) {
- return !!this.getFoldLine(docRow, startFoldRow);
- };
-
- this.getRowFoldEnd = function(docRow, startFoldRow) {
- var foldLine = this.getFoldLine(docRow, startFoldRow);
- return (foldLine
- ? foldLine.end.row
- : docRow);
- };
-
- this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
- if (startRow == null) {
- startRow = foldLine.start.row;
- startColumn = 0;
- }
-
- if (endRow == null) {
- endRow = foldLine.end.row;
- endColumn = this.getLine(endRow).length;
- }
-
- // Build the textline using the FoldLine walker.
- var doc = this.doc;
- var textLine = "";
-
- foldLine.walk(function(placeholder, row, column, lastColumn) {
- if (row < startRow) {
- return;
- } else if (row == startRow) {
- if (column < startColumn) {
- return;
- }
- lastColumn = Math.max(startColumn, lastColumn);
- }
- if (placeholder) {
- textLine += placeholder;
- } else {
- textLine += doc.getLine(row).substring(lastColumn, column);
- }
- }.bind(this), endRow, endColumn);
- return textLine;
- };
-
- this.getDisplayLine = function(row, endColumn, startRow, startColumn) {
- var foldLine = this.getFoldLine(row);
-
- if (!foldLine) {
- var line;
- line = this.doc.getLine(row);
- return line.substring(startColumn || 0, endColumn || line.length);
- } else {
- return this.getFoldDisplayLine(
- foldLine, row, endColumn, startRow, startColumn);
- }
- };
-
- this.$cloneFoldData = function() {
- var fd = [];
- fd = this.$foldData.map(function(foldLine) {
- var folds = foldLine.folds.map(function(fold) {
- return fold.clone();
- });
- return new FoldLine(fd, folds);
- });
-
- return fd;
- };
-
- this.toggleFold = function(tryToUnfold) {
- var selection = this.selection;
- var range = selection.getRange();
- var fold;
- var bracketPos;
-
- if (range.isEmpty()) {
- var cursor = range.start;
- fold = this.getFoldAt(cursor.row, cursor.column);
-
- if (fold) {
- this.expandFold(fold);
- return;
- }
- else if (bracketPos = this.findMatchingBracket(cursor)) {
- if (range.comparePoint(bracketPos) == 1) {
- range.end = bracketPos;
- }
- else {
- range.start = bracketPos;
- range.start.column++;
- range.end.column--;
- }
- }
- else if (bracketPos = this.findMatchingBracket({row: cursor.row, column: cursor.column + 1})) {
- if (range.comparePoint(bracketPos) == 1)
- range.end = bracketPos;
- else
- range.start = bracketPos;
-
- range.start.column++;
- }
- else {
- range = this.getCommentFoldRange(cursor.row, cursor.column) || range;
- }
- } else {
- var folds = this.getFoldsInRange(range);
- if (tryToUnfold && folds.length) {
- this.expandFolds(folds);
- return;
- }
- else if (folds.length == 1 ) {
- fold = folds[0];
- }
- }
-
- if (!fold)
- fold = this.getFoldAt(range.start.row, range.start.column);
-
- if (fold && fold.range.toString() == range.toString()) {
- this.expandFold(fold);
- return;
- }
-
- var placeholder = "...";
- if (!range.isMultiLine()) {
- placeholder = this.getTextRange(range);
- if(placeholder.length < 4)
- return;
- placeholder = placeholder.trim().substring(0, 2) + "..";
- }
-
- this.addFold(placeholder, range);
- };
-
- this.getCommentFoldRange = function(row, column) {
- var iterator = new TokenIterator(this, row, column);
- var token = iterator.getCurrentToken();
- if (token && /^comment|string/.test(token.type)) {
- var range = new Range();
- var re = new RegExp(token.type.replace(/\..*/, "\\."));
- do {
- token = iterator.stepBackward();
- } while(token && re.test(token.type));
-
- iterator.stepForward();
- range.start.row = iterator.getCurrentTokenRow();
- range.start.column = iterator.getCurrentTokenColumn() + 2;
-
- iterator = new TokenIterator(this, row, column);
-
- do {
- token = iterator.stepForward();
- } while(token && re.test(token.type));
-
- token = iterator.stepBackward();
-
- range.end.row = iterator.getCurrentTokenRow();
- range.end.column = iterator.getCurrentTokenColumn() + token.value.length;
- return range;
- }
- };
-
- this.foldAll = function(startRow, endRow) {
- var foldWidgets = this.foldWidgets;
- endRow = endRow || this.getLength();
- for (var row = startRow || 0; row < endRow; row++) {
- if (foldWidgets[row] == null)
- foldWidgets[row] = this.getFoldWidget(row);
- if (foldWidgets[row] != "start")
- continue;
-
- var range = this.getFoldWidgetRange(row);
- // sometimes range can be incompatible with existing fold
- // wouldn't it be better for addFold to return null istead of throwing?
- if (range && range.end.row < endRow) try {
- this.addFold("...", range);
- } catch(e) {}
- }
- };
-
- this.$foldStyles = {
- "manual": 1,
- "markbegin": 1,
- "markbeginend": 1
- };
- this.$foldStyle = "markbegin";
- this.setFoldStyle = function(style) {
- if (!this.$foldStyles[style])
- throw new Error("invalid fold style: " + style + "[" + Object.keys(this.$foldStyles).join(", ") + "]");
-
- if (this.$foldStyle == style)
- return;
-
- this.$foldStyle = style;
-
- if (style == "manual")
- this.unfold();
-
- // reset folding
- var mode = this.$foldMode;
- this.$setFolding(null);
- this.$setFolding(mode);
- };
-
- // structured folding
- this.$setFolding = function(foldMode) {
- if (this.$foldMode == foldMode)
- return;
-
- this.$foldMode = foldMode;
-
- this.removeListener('change', this.$updateFoldWidgets);
- this._emit("changeAnnotation");
-
- if (!foldMode || this.$foldStyle == "manual") {
- this.foldWidgets = null;
- return;
- }
-
- this.foldWidgets = [];
- this.getFoldWidget = foldMode.getFoldWidget.bind(foldMode, this, this.$foldStyle);
- this.getFoldWidgetRange = foldMode.getFoldWidgetRange.bind(foldMode, this, this.$foldStyle);
-
- this.$updateFoldWidgets = this.updateFoldWidgets.bind(this);
- this.on('change', this.$updateFoldWidgets);
-
- };
-
- this.onFoldWidgetClick = function(row, e) {
- var type = this.getFoldWidget(row);
- var line = this.getLine(row);
- var onlySubfolds = e.shiftKey;
- var addSubfolds = onlySubfolds || e.ctrlKey || e.altKey || e.metaKey;
- var fold;
-
- if (type == "end")
- fold = this.getFoldAt(row, 0, -1);
- else
- fold = this.getFoldAt(row, line.length, 1);
-
- if (fold) {
- if (addSubfolds)
- this.removeFold(fold);
- else
- this.expandFold(fold);
- return;
- }
-
- var range = this.getFoldWidgetRange(row);
- if (range) {
- // sometimes singleline folds can be missed by the code above
- if (!range.isMultiLine()) {
- fold = this.getFoldAt(range.start.row, range.start.column, 1);
- if (fold && range.isEqual(fold.range)) {
- this.removeFold(fold);
- return;
- }
- }
-
- if (!onlySubfolds)
- this.addFold("...", range);
-
- if (addSubfolds)
- this.foldAll(range.start.row + 1, range.end.row);
- } else {
- if (addSubfolds)
- this.foldAll(row + 1, this.getLength());
- e.target.className += " invalid"
- }
- };
-
- this.updateFoldWidgets = function(e) {
- var delta = e.data;
- var range = delta.range;
- var firstRow = range.start.row;
- var len = range.end.row - firstRow;
-
- if (len === 0) {
- this.foldWidgets[firstRow] = null;
- } else if (delta.action == "removeText" || delta.action == "removeLines") {
- this.foldWidgets.splice(firstRow, len + 1, null);
- } else {
- var args = Array(len + 1);
- args.unshift(firstRow, 1);
- this.foldWidgets.splice.apply(this.foldWidgets, args);
- }
- };
-
- }
-
- exports.Folding = Folding;
-
- });
-
- ace.define('ace/edit_session/fold_line', ['require', 'exports', 'module' , 'ace/range'], function(require, exports, module) {
-
-
- var Range = require("../range").Range;
- function FoldLine(foldData, folds) {
- this.foldData = foldData;
- if (Array.isArray(folds)) {
- this.folds = folds;
- } else {
- folds = this.folds = [ folds ];
- }
-
- var last = folds[folds.length - 1]
- this.range = new Range(folds[0].start.row, folds[0].start.column,
- last.end.row, last.end.column);
- this.start = this.range.start;
- this.end = this.range.end;
-
- this.folds.forEach(function(fold) {
- fold.setFoldLine(this);
- }, this);
- }
-
- (function() {
- /*
- * Note: This doesn't update wrapData!
- */
- this.shiftRow = function(shift) {
- this.start.row += shift;
- this.end.row += shift;
- this.folds.forEach(function(fold) {
- fold.start.row += shift;
- fold.end.row += shift;
- });
- }
-
- this.addFold = function(fold) {
- if (fold.sameRow) {
- if (fold.start.row < this.startRow || fold.endRow > this.endRow) {
- throw "Can't add a fold to this FoldLine as it has no connection";
- }
- this.folds.push(fold);
- this.folds.sort(function(a, b) {
- return -a.range.compareEnd(b.start.row, b.start.column);
- });
- if (this.range.compareEnd(fold.start.row, fold.start.column) > 0) {
- this.end.row = fold.end.row;
- this.end.column = fold.end.column;
- } else if (this.range.compareStart(fold.end.row, fold.end.column) < 0) {
- this.start.row = fold.start.row;
- this.start.column = fold.start.column;
- }
- } else if (fold.start.row == this.end.row) {
- this.folds.push(fold);
- this.end.row = fold.end.row;
- this.end.column = fold.end.column;
- } else if (fold.end.row == this.start.row) {
- this.folds.unshift(fold);
- this.start.row = fold.start.row;
- this.start.column = fold.start.column;
- } else {
- throw "Trying to add fold to FoldRow that doesn't have a matching row";
- }
- fold.foldLine = this;
- }
-
- this.containsRow = function(row) {
- return row >= this.start.row && row <= this.end.row;
- }
-
- this.walk = function(callback, endRow, endColumn) {
- var lastEnd = 0,
- folds = this.folds,
- fold,
- comp, stop, isNewRow = true;
-
- if (endRow == null) {
- endRow = this.end.row;
- endColumn = this.end.column;
- }
-
- for (var i = 0; i < folds.length; i++) {
- fold = folds[i];
-
- comp = fold.range.compareStart(endRow, endColumn);
- // This fold is after the endRow/Column.
- if (comp == -1) {
- callback(null, endRow, endColumn, lastEnd, isNewRow);
- return;
- }
-
- stop = callback(null, fold.start.row, fold.start.column, lastEnd, isNewRow);
- stop = !stop && callback(fold.placeholder, fold.start.row, fold.start.column, lastEnd);
-
- // If the user requested to stop the walk or endRow/endColumn is
- // inside of this fold (comp == 0), then end here.
- if (stop || comp == 0) {
- return;
- }
-
- // Note the new lastEnd might not be on the same line. However,
- // it's the callback's job to recognize this.
- isNewRow = !fold.sameRow;
- lastEnd = fold.end.column;
- }
- callback(null, endRow, endColumn, lastEnd, isNewRow);
- }
-
- this.getNextFoldTo = function(row, column) {
- var fold, cmp;
- for (var i = 0; i < this.folds.length; i++) {
- fold = this.folds[i];
- cmp = fold.range.compareEnd(row, column);
- if (cmp == -1) {
- return {
- fold: fold,
- kind: "after"
- };
- } else if (cmp == 0) {
- return {
- fold: fold,
- kind: "inside"
- }
- }
- }
- return null;
- }
-
- this.addRemoveChars = function(row, column, len) {
- var ret = this.getNextFoldTo(row, column),
- fold, folds;
- if (ret) {
- fold = ret.fold;
- if (ret.kind == "inside"
- && fold.start.column != column
- && fold.start.row != row)
- {
- //throwing here breaks whole editor
- //@todo properly handle this
- window.console && window.console.log(row, column, fold);
- } else if (fold.start.row == row) {
- folds = this.folds;
- var i = folds.indexOf(fold);
- if (i == 0) {
- this.start.column += len;
- }
- for (i; i < folds.length; i++) {
- fold = folds[i];
- fold.start.column += len;
- if (!fold.sameRow) {
- return;
- }
- fold.end.column += len;
- }
- this.end.column += len;
- }
- }
- }
-
- this.split = function(row, column) {
- var fold = this.getNextFoldTo(row, column).fold,
- folds = this.folds;
- var foldData = this.foldData;
-
- if (!fold) {
- return null;
- }
- var i = folds.indexOf(fold);
- var foldBefore = folds[i - 1];
- this.end.row = foldBefore.end.row;
- this.end.column = foldBefore.end.column;
-
- // Remove the folds after row/column and create a new FoldLine
- // containing these removed folds.
- folds = folds.splice(i, folds.length - i);
-
- var newFoldLine = new FoldLine(foldData, folds);
- foldData.splice(foldData.indexOf(this) + 1, 0, newFoldLine);
- return newFoldLine;
- }
-
- this.merge = function(foldLineNext) {
- var folds = foldLineNext.folds;
- for (var i = 0; i < folds.length; i++) {
- this.addFold(folds[i]);
- }
- // Remove the foldLineNext - no longer needed, as
- // it's merged now with foldLineNext.
- var foldData = this.foldData;
- foldData.splice(foldData.indexOf(foldLineNext), 1);
- }
-
- this.toString = function() {
- var ret = [this.range.toString() + ": [" ];
-
- this.folds.forEach(function(fold) {
- ret.push(" " + fold.toString());
- });
- ret.push("]")
- return ret.join("\n");
- }
-
- this.idxToPosition = function(idx) {
- var lastFoldEndColumn = 0;
- var fold;
-
- for (var i = 0; i < this.folds.length; i++) {
- var fold = this.folds[i];
-
- idx -= fold.start.column - lastFoldEndColumn;
- if (idx < 0) {
- return {
- row: fold.start.row,
- column: fold.start.column + idx
- };
- }
-
- idx -= fold.placeholder.length;
- if (idx < 0) {
- return fold.start;
- }
-
- lastFoldEndColumn = fold.end.column;
- }
-
- return {
- row: this.end.row,
- column: this.end.column + idx
- };
- }
- }).call(FoldLine.prototype);
-
- exports.FoldLine = FoldLine;
- });
-
- ace.define('ace/edit_session/fold', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- /*
- * Simple fold-data struct.
- **/
- var Fold = exports.Fold = function(range, placeholder) {
- this.foldLine = null;
- this.placeholder = placeholder;
- this.range = range;
- this.start = range.start;
- this.end = range.end;
-
- this.sameRow = range.start.row == range.end.row;
- this.subFolds = [];
- };
-
- (function() {
-
- this.toString = function() {
- return '"' + this.placeholder + '" ' + this.range.toString();
- };
-
- this.setFoldLine = function(foldLine) {
- this.foldLine = foldLine;
- this.subFolds.forEach(function(fold) {
- fold.setFoldLine(foldLine);
- });
- };
-
- this.clone = function() {
- var range = this.range.clone();
- var fold = new Fold(range, this.placeholder);
- this.subFolds.forEach(function(subFold) {
- fold.subFolds.push(subFold.clone());
- });
- return fold;
- };
-
- this.addSubFold = function(fold) {
- if (this.range.isEqual(fold))
- return this;
-
- if (!this.range.containsRange(fold))
- throw "A fold can't intersect already existing fold" + fold.range + this.range;
-
- var row = fold.range.start.row, column = fold.range.start.column;
- for (var i = 0, cmp = -1; i < this.subFolds.length; i++) {
- cmp = this.subFolds[i].range.compare(row, column);
- if (cmp != 1)
- break;
- }
- var afterStart = this.subFolds[i];
-
- if (cmp == 0)
- return afterStart.addSubFold(fold)
-
- // cmp == -1
- var row = fold.range.end.row, column = fold.range.end.column;
- for (var j = i, cmp = -1; j < this.subFolds.length; j++) {
- cmp = this.subFolds[j].range.compare(row, column);
- if (cmp != 1)
- break;
- }
- var afterEnd = this.subFolds[j];
-
- if (cmp == 0)
- throw "A fold can't intersect already existing fold" + fold.range + this.range;
-
- var consumedFolds = this.subFolds.splice(i, j - i, fold)
- fold.setFoldLine(this.foldLine);
-
- return fold;
- }
-
- }).call(Fold.prototype);
-
- });
-
- ace.define('ace/token_iterator', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- /**
- * class TokenIterator
- *
- * This class provides an essay way to treat the document as a stream of tokens, and provides methods to iterate over these tokens.
- *
- **/
-
- /**
- * new TokenIterator(session, initialRow, initialColumn)
- * - session (EditSession): The session to associate with
- * - initialRow (Number): The row to start the tokenizing at
- * - initialColumn (Number): The column to start the tokenizing at
- *
- * Creates a new token iterator object. The inital token index is set to the provided row and column coordinates.
- *
- **/
- var TokenIterator = function(session, initialRow, initialColumn) {
- this.$session = session;
- this.$row = initialRow;
- this.$rowTokens = session.getTokens(initialRow);
-
- var token = session.getTokenAt(initialRow, initialColumn);
- this.$tokenIndex = token ? token.index : -1;
- };
-
- (function() {
-
- /**
- * TokenIterator.stepBackward() -> [String]
- * + (String): If the current point is not at the top of the file, this function returns `null`. Otherwise, it returns an array of the tokenized strings.
- *
- * Tokenizes all the items from the current point to the row prior in the document.
- **/
- this.stepBackward = function() {
- this.$tokenIndex -= 1;
-
- while (this.$tokenIndex < 0) {
- this.$row -= 1;
- if (this.$row < 0) {
- this.$row = 0;
- return null;
- }
-
- this.$rowTokens = this.$session.getTokens(this.$row);
- this.$tokenIndex = this.$rowTokens.length - 1;
- }
-
- return this.$rowTokens[this.$tokenIndex];
- };
- this.stepForward = function() {
- var rowCount = this.$session.getLength();
- this.$tokenIndex += 1;
-
- while (this.$tokenIndex >= this.$rowTokens.length) {
- this.$row += 1;
- if (this.$row >= rowCount) {
- this.$row = rowCount - 1;
- return null;
- }
-
- this.$rowTokens = this.$session.getTokens(this.$row);
- this.$tokenIndex = 0;
- }
-
- return this.$rowTokens[this.$tokenIndex];
- };
- this.getCurrentToken = function () {
- return this.$rowTokens[this.$tokenIndex];
- };
- this.getCurrentTokenRow = function () {
- return this.$row;
- };
- this.getCurrentTokenColumn = function() {
- var rowTokens = this.$rowTokens;
- var tokenIndex = this.$tokenIndex;
-
- // If a column was cached by EditSession.getTokenAt, then use it
- var column = rowTokens[tokenIndex].start;
- if (column !== undefined)
- return column;
-
- column = 0;
- while (tokenIndex > 0) {
- tokenIndex -= 1;
- column += rowTokens[tokenIndex].value.length;
- }
-
- return column;
- };
-
- }).call(TokenIterator.prototype);
-
- exports.TokenIterator = TokenIterator;
- });
-
- ace.define('ace/edit_session/bracket_match', ['require', 'exports', 'module' , 'ace/token_iterator', 'ace/range'], function(require, exports, module) {
-
-
- var TokenIterator = require("../token_iterator").TokenIterator;
- var Range = require("../range").Range;
-
- /**
- * new BracketMatch(position)
- * - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
- * - commands (Array): A list of commands
- *
- * TODO
- *
- *
- **/
- function BracketMatch() {
-
- /**
- * new findMatchingBracket(position)
- * - position (Number): Identifier for the platform; must be either `'mac'` or `'win'`
- * - commands (Array): A list of commands
- *
- * TODO
- *
- *
- **/
- this.findMatchingBracket = function(position) {
- if (position.column == 0) return null;
-
- var charBeforeCursor = this.getLine(position.row).charAt(position.column-1);
- if (charBeforeCursor == "") return null;
-
- var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
- if (!match)
- return null;
-
- if (match[1])
- return this.$findClosingBracket(match[1], position);
- else
- return this.$findOpeningBracket(match[2], position);
- };
-
- this.getBracketRange = function(pos) {
- var line = this.getLine(pos.row);
- var before = true, range;
-
- var chr = line.charAt(pos.column-1);
- var match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
- if (!match) {
- chr = line.charAt(pos.column);
- pos.column++;
- match = chr && chr.match(/([\(\[\{])|([\)\]\}])/);
- before = false;
- }
- if (!match)
- return null;
-
- if (match[1]) {
- var bracketPos = this.$findClosingBracket(match[1], pos);
- if (!bracketPos)
- return null;
- range = Range.fromPoints(pos, bracketPos);
- if (!before) {
- range.end.column++;
- range.start.column--;
- }
- range.cursor = range.end;
- } else {
- var bracketPos = this.$findOpeningBracket(match[2], pos);
- if (!bracketPos)
- return null;
- range = Range.fromPoints(bracketPos, pos);
- if (!before) {
- range.start.column++;
- range.end.column--;
- }
- range.cursor = range.start;
- }
-
- if (!before)
- pos.column--;
-
- return range;
- };
-
- this.$brackets = {
- ")": "(",
- "(": ")",
- "]": "[",
- "[": "]",
- "{": "}",
- "}": "{"
- };
-
- this.$findOpeningBracket = function(bracket, position, typeRe) {
- var openBracket = this.$brackets[bracket];
- var depth = 1;
-
- var iterator = new TokenIterator(this, position.row, position.column);
- var token = iterator.getCurrentToken();
- if (!token)
- token = iterator.stepForward();
- if (!token)
- return
-
- if (!typeRe){
- typeRe = new RegExp(
- "(\\.?" +
- token.type.replace(".", "\\.").replace("rparen", ".paren")
- + ")+"
- );
- }
-
- // Start searching in token, just before the character at position.column
- var valueIndex = position.column - iterator.getCurrentTokenColumn() - 2;
- var value = token.value;
-
- while (true) {
-
- while (valueIndex >= 0) {
- var chr = value.charAt(valueIndex);
- if (chr == openBracket) {
- depth -= 1;
- if (depth == 0) {
- return {row: iterator.getCurrentTokenRow(),
- column: valueIndex + iterator.getCurrentTokenColumn()};
- }
- }
- else if (chr == bracket) {
- depth += 1;
- }
- valueIndex -= 1;
- }
-
- // Scan backward through the document, looking for the next token
- // whose type matches typeRe
- do {
- token = iterator.stepBackward();
- } while (token && !typeRe.test(token.type));
-
- if (token == null)
- break;
-
- value = token.value;
- valueIndex = value.length - 1;
- }
-
- return null;
- };
-
- this.$findClosingBracket = function(bracket, position, typeRe, allowBlankLine) {
- var closingBracket = this.$brackets[bracket];
- var depth = 1;
-
- var iterator = new TokenIterator(this, position.row, position.column);
- var token = iterator.getCurrentToken();
- if (!token)
- token = iterator.stepForward();
- if (!token)
- return
-
- if (!typeRe){
- typeRe = new RegExp(
- "(\\.?" +
- token.type.replace(".", "\\.").replace("lparen", ".paren")
- + ")+"
- );
- }
-
- // Start searching in token, after the character at position.column
- var valueIndex = position.column - iterator.getCurrentTokenColumn();
-
- while (true) {
-
- var value = token.value;
- var valueLength = value.length;
- while (valueIndex < valueLength) {
- var chr = value.charAt(valueIndex);
- if (chr == closingBracket) {
- depth -= 1;
- if (depth == 0) {
- return {row: iterator.getCurrentTokenRow(),
- column: valueIndex + iterator.getCurrentTokenColumn()};
- }
- }
- else if (chr == bracket) {
- depth += 1;
- }
- valueIndex += 1;
- }
-
- // Scan forward through the document, looking for the next token
- // whose type matches typeRe
- do {
- token = iterator.stepForward();
- if (allowBlankLine) {
- // if you've reached the doc end, or, you match a new content line
- if (token === null || token.type == "string") {
- return {row: iterator.getCurrentTokenRow() + (token === null ? 1 : -1), column: 0};
- }
- }
- } while (token && !typeRe.test(token.type));
-
- if (token == null)
- break;
-
- valueIndex = 0;
- }
-
- return null;
- };
- }
- exports.BracketMatch = BracketMatch;
-
- });
-
- ace.define('ace/search', ['require', 'exports', 'module' , 'ace/lib/lang', 'ace/lib/oop', 'ace/range'], function(require, exports, module) {
-
-
- var lang = require("./lib/lang");
- var oop = require("./lib/oop");
- var Range = require("./range").Range;
-
- /**
- * new Search()
- *
- * Creates a new `Search` object. The following search options are avaliable:
- *
- * * needle: string or regular expression
- * * backwards: false
- * * wrap: false
- * * caseSensitive: false
- * * wholeWord: false
- * * range: Range or null for whole document
- * * regExp: false
- * * start: Range or position
- * * skipCurrent: false
- *
- **/
-
- var Search = function() {
- this.$options = {};
- };
-
- (function() {
- /**
- * Search.set(options) -> Search
- * - options (Object): An object containing all the new search properties
- *
- * Sets the search options via the `options` parameter.
- *
- **/
- this.set = function(options) {
- oop.mixin(this.$options, options);
- return this;
- };
- this.getOptions = function() {
- return lang.copyObject(this.$options);
- };
-
- this.setOptions = function(options) {
- this.$options = options;
- };
- this.find = function(session) {
- var iterator = this.$matchIterator(session, this.$options);
-
- if (!iterator)
- return false;
-
- var firstRange = null;
- iterator.forEach(function(range, row, offset) {
- if (!range.start) {
- var column = range.offset + (offset || 0);
- firstRange = new Range(row, column, row, column+range.length);
- } else
- firstRange = range;
- return true;
- });
-
- return firstRange;
- };
- this.findAll = function(session) {
- var options = this.$options;
- if (!options.needle)
- return [];
- this.$assembleRegExp(options);
-
- if (options.range) {
- var range = options.range;
- var lines = session.getLines(range.start.row, range.end.row);
- } else
- var lines = session.doc.getAllLines();
-
- var ranges = [];
- var re = options.re;
- if (options.$isMultiLine) {
- var len = re.length;
- var maxRow = lines.length - len;
- for (var row = re.offset || 0; row < maxRow; row++) {
- for (var j = 0; j < re.length; j++)
- if (lines[row + j].search(re[j]) == -1)
- break;
-
- var startIndex = lines[row + j].match(re[0])[0].length;
- var endIndex = line.match(re[len - 1])[0].length;
-
- ranges.push(new Range(
- row, startLine.length - startIndex,
- row + len - 1, endIndex
- ));
- }
- } else {
- for (var i = 0; i < lines.length; i++) {
- var matches = lang.getMatchOffsets(lines[i], re);
- for (var j = 0; j < matches.length; j++) {
- var match = matches[j];
- ranges.push(new Range(i, match.offset, i, match.offset + match.length));
- };
- }
- }
-
- if (options.range) {
- var startColumn = range.start.column;
- var endColumn = range.start.column;
- var i = 0, j = ranges.length - 1;
- while (i < j && ranges[i].start.column < startColumn && ranges[i].start.row == range.start.row)
- i++;
-
- while (i < j && ranges[j].end.column > endColumn && ranges[j].end.row == range.end.row)
- j--;
- return ranges.slice(i, j + 1);
- }
-
- return ranges;
- };
- this.replace = function(input, replacement) {
- var options = this.$options;
-
- var re = this.$assembleRegExp(options);
- if (options.$isMultiLine)
- return replacement;
-
- if (!re)
- return;
-
- var match = re.exec(input);
- if (!match || match[0].length != input.length)
- return null;
-
- replacement = input.replace(re, replacement)
- if (options.preserveCase) {
- replacement = replacement.split("");
- for (var i = Math.min(input.length, input.length); i--; ) {
- var ch = input[i];
- if (ch && ch.toLowerCase() != ch)
- replacement[i] = replacement[i].toUpperCase();
- else
- replacement[i] = replacement[i].toLowerCase();
- }
- replacement = replacement.join("");
- }
-
- return replacement;
- };
- this.$matchIterator = function(session, options) {
- var re = this.$assembleRegExp(options);
- if (!re)
- return false;
-
- var self = this, callback, backwards = options.backwards;
-
- if (options.$isMultiLine) {
- var len = re.length;
- var matchIterator = function(line, row, offset) {
- var startIndex = line.search(re[0]);
- if (startIndex == -1)
- return;
- for (var i = 1; i < len; i++) {
- line = session.getLine(row + i);
- if (line.search(re[i]) == -1)
- return;
- }
-
- var endIndex = line.match(re[len - 1])[0].length;
-
- var range = new Range(row, startIndex, row + len - 1, endIndex);
- if (re.offset == 1) {
- range.start.row--;
- range.start.column = Number.MAX_VALUE;
- } else if (offset)
- range.start.column += offset;
-
- if (callback(range))
- return true;
- }
- } else if (backwards) {
- var matchIterator = function(line, row, startIndex) {
- var matches = lang.getMatchOffsets(line, re);
- for (var i = matches.length-1; i >= 0; i--)
- if (callback(matches[i], row, startIndex))
- return true;
- }
- } else {
- var matchIterator = function(line, row, startIndex) {
- var matches = lang.getMatchOffsets(line, re);
- for (var i = 0; i < matches.length; i++)
- if (callback(matches[i], row, startIndex))
- return true;
- }
- }
-
- return {
- forEach: function(_callback) {
- callback = _callback;
- self.$lineIterator(session, options).forEach(matchIterator);
- }
- };
- };
-
- this.$assembleRegExp = function(options) {
- if (options.needle instanceof RegExp)
- return options.re = options.needle;
-
- var needle = options.needle;
-
- if (!options.needle)
- return options.re = false;
-
- if (!options.regExp)
- needle = lang.escapeRegExp(needle);
-
- if (options.wholeWord)
- needle = "\\b" + needle + "\\b";
-
- var modifier = options.caseSensitive ? "g" : "gi";
-
- options.$isMultiLine = /[\n\r]/.test(needle);
- if (options.$isMultiLine)
- return options.re = this.$assembleMultilineRegExp(needle, modifier);
-
- try {
- var re = new RegExp(needle, modifier);
- } catch(e) {
- var re = false;
- }
- return options.re = re;
- };
-
- this.$assembleMultilineRegExp = function(needle, modifier) {
- var parts = needle.replace(/\r\n|\r|\n/g, "$\n^").split("\n");
- var re = [];
- for (var i = 0; i < parts.length; i++) try {
- re.push(new RegExp(parts[i], modifier));
- } catch(e) {
- return false;
- }
- if (parts[0] == "") {
- re.shift();
- re.offset = 1;
- } else {
- re.offset = 0;
- }
- return re;
- };
-
- this.$lineIterator = function(session, options) {
- var range = options.range;
- var backwards = options.backwards == true;
- var skipCurrent = options.skipCurrent != false;
-
- var range = options.range;
- var start = options.start;
- if (!start)
- start = range ? range[backwards ? "end" : "start"] : session.selection.getRange();
-
- if (start.start)
- start = start[skipCurrent != backwards ? "end" : "start"];
-
- var firstRow = range ? range.start.row : 0;
- var firstColumn = range ? range.start.column : 0;
- var lastRow = range ? range.end.row : session.getLength() - 1;
-
- if (!backwards) {
- var forEach = function(callback) {
- var row = start.row;
-
- var line = session.getLine(row).substr(start.column);
- if (callback(line, row, start.column))
- return;
-
- for (row = row+1; row <= lastRow; row++)
- if (callback(session.getLine(row), row))
- return;
-
- if (options.wrap == false)
- return;
-
- for (row = firstRow, lastRow = start.row; row <= lastRow; row++)
- if (callback(session.getLine(row), row))
- return;
- }
- } else {
- var forEach = function(callback) {
- var row = start.row;
-
- var line = session.getLine(row).substring(0, start.column);
- if (callback(line, row))
- return;
-
- for (row--; row >= firstRow; row--)
- if (callback(session.getLine(row), row))
- return;
-
- if (options.wrap == false)
- return;
-
- for (row = lastRow, firstRow = start.row; row >= firstRow; row--)
- if (callback(session.getLine(row), row))
- return;
- }
- }
-
- return {forEach: forEach};
- };
-
- }).call(Search.prototype);
-
- exports.Search = Search;
- });
- ace.define('ace/commands/command_manager', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/keyboard/hash_handler', 'ace/lib/event_emitter'], function(require, exports, module) {
-
-
- var oop = require("../lib/oop");
- var HashHandler = require("../keyboard/hash_handler").HashHandler;
- var EventEmitter = require("../lib/event_emitter").EventEmitter;
-
- /**
- * new CommandManager(platform, commands)
- * - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
- * - commands (Array): A list of commands
- *
- * TODO
- *
- *
- **/
-
- var CommandManager = function(platform, commands) {
- this.platform = platform;
- this.commands = {};
- this.commmandKeyBinding = {};
-
- this.addCommands(commands);
-
- this.setDefaultHandler("exec", function(e) {
- return e.command.exec(e.editor, e.args || {});
- });
- };
-
- oop.inherits(CommandManager, HashHandler);
-
- (function() {
-
- oop.implement(this, EventEmitter);
-
- this.exec = function(command, editor, args) {
- if (typeof command === 'string')
- command = this.commands[command];
-
- if (!command)
- return false;
-
- if (editor && editor.$readOnly && !command.readOnly)
- return false;
-
- var retvalue = this._emit("exec", {
- editor: editor,
- command: command,
- args: args
- });
-
- return retvalue === false ? false : true;
- };
-
- this.toggleRecording = function() {
- if (this.$inReplay)
- return;
- if (this.recording) {
- this.macro.pop();
- this.removeEventListener("exec", this.$addCommandToMacro);
-
- if (!this.macro.length)
- this.macro = this.oldMacro;
-
- return this.recording = false;
- }
- if (!this.$addCommandToMacro) {
- this.$addCommandToMacro = function(e) {
- this.macro.push([e.command, e.args]);
- }.bind(this);
- }
-
- this.oldMacro = this.macro;
- this.macro = [];
- this.on("exec", this.$addCommandToMacro);
- return this.recording = true;
- };
-
- this.replay = function(editor) {
- if (this.$inReplay || !this.macro)
- return;
-
- if (this.recording)
- return this.toggleRecording();
-
- try {
- this.$inReplay = true;
- this.macro.forEach(function(x) {
- if (typeof x == "string")
- this.exec(x, editor);
- else
- this.exec(x[0], editor, x[1]);
- }, this);
- } finally {
- this.$inReplay = false;
- }
- };
-
- this.trimMacro = function(m) {
- return m.map(function(x){
- if (typeof x[0] != "string")
- x[0] = x[0].name;
- if (!x[1])
- x = x[0];
- return x;
- });
- };
-
- }).call(CommandManager.prototype);
-
- exports.CommandManager = CommandManager;
-
- });
-
- ace.define('ace/keyboard/hash_handler', ['require', 'exports', 'module' , 'ace/lib/keys'], function(require, exports, module) {
-
-
- var keyUtil = require("../lib/keys");
-
- function HashHandler(config, platform) {
- this.platform = platform;
- this.commands = {};
- this.commmandKeyBinding = {};
-
- this.addCommands(config);
- };
-
- (function() {
-
- this.addCommand = function(command) {
- if (this.commands[command.name])
- this.removeCommand(command);
-
- this.commands[command.name] = command;
-
- if (command.bindKey)
- this._buildKeyHash(command);
- };
-
- this.removeCommand = function(command) {
- var name = (typeof command === 'string' ? command : command.name);
- command = this.commands[name];
- delete this.commands[name];
-
- // exhaustive search is brute force but since removeCommand is
- // not a performance critical operation this should be OK
- var ckb = this.commmandKeyBinding;
- for (var hashId in ckb) {
- for (var key in ckb[hashId]) {
- if (ckb[hashId][key] == command)
- delete ckb[hashId][key];
- }
- }
- };
-
- this.bindKey = function(key, command) {
- if(!key)
- return;
- if (typeof command == "function") {
- this.addCommand({exec: command, bindKey: key, name: key});
- return;
- }
-
- var ckb = this.commmandKeyBinding;
- key.split("|").forEach(function(keyPart) {
- var binding = this.parseKeys(keyPart, command);
- var hashId = binding.hashId;
- (ckb[hashId] || (ckb[hashId] = {}))[binding.key] = command;
- }, this);
- };
-
- this.addCommands = function(commands) {
- commands && Object.keys(commands).forEach(function(name) {
- var command = commands[name];
- if (typeof command === "string")
- return this.bindKey(command, name);
-
- if (typeof command === "function")
- command = { exec: command };
-
- if (!command.name)
- command.name = name;
-
- this.addCommand(command);
- }, this);
- };
-
- this.removeCommands = function(commands) {
- Object.keys(commands).forEach(function(name) {
- this.removeCommand(commands[name]);
- }, this);
- };
-
- this.bindKeys = function(keyList) {
- Object.keys(keyList).forEach(function(key) {
- this.bindKey(key, keyList[key]);
- }, this);
- };
-
- this._buildKeyHash = function(command) {
- var binding = command.bindKey;
- if (!binding)
- return;
-
- var key = typeof binding == "string" ? binding: binding[this.platform];
- this.bindKey(key, command);
- };
-
- this.parseKeys = function(keys) {
- var key;
- var hashId = 0;
- var parts = keys.toLowerCase().trim().split(/\s*\-\s*/);
-
- for (var i = 0, l = parts.length; i < l; i++) {
- if (keyUtil.KEY_MODS[parts[i]])
- hashId = hashId | keyUtil.KEY_MODS[parts[i]];
- else
- key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
- }
-
- if (parts[0] == "text" && parts.length == 2) {
- hashId = -1;
- key = parts[1];
- }
-
- return {
- key: key,
- hashId: hashId
- };
- };
-
- this.findKeyCommand = function findKeyCommand(hashId, keyString) {
- var ckbr = this.commmandKeyBinding;
- return ckbr[hashId] && ckbr[hashId][keyString.toLowerCase()];
- };
-
- this.handleKeyboard = function(data, hashId, keyString, keyCode) {
- return {
- command: this.findKeyCommand(hashId, keyString)
- };
- };
-
- }).call(HashHandler.prototype)
-
- exports.HashHandler = HashHandler;
- });
-
- ace.define('ace/commands/default_commands', ['require', 'exports', 'module' , 'ace/lib/lang'], function(require, exports, module) {
-
-
- var lang = require("../lib/lang");
-
- function bindKey(win, mac) {
- return {
- win: win,
- mac: mac
- };
- }
-
- exports.commands = [{
- name: "selectall",
- bindKey: bindKey("Ctrl-A", "Command-A"),
- exec: function(editor) { editor.selectAll(); },
- readOnly: true
- }, {
- name: "centerselection",
- bindKey: bindKey(null, "Ctrl-L"),
- exec: function(editor) { editor.centerSelection(); },
- readOnly: true
- }, {
- name: "gotoline",
- bindKey: bindKey("Ctrl-L", "Command-L"),
- exec: function(editor) {
- var line = parseInt(prompt("Enter line number:"), 10);
- if (!isNaN(line)) {
- editor.gotoLine(line);
- }
- },
- readOnly: true
- }, {
- name: "fold",
- bindKey: bindKey("Alt-L|Ctrl-F1", "Command-Alt-L|Command-F1"),
- exec: function(editor) { editor.session.toggleFold(false); },
- readOnly: true
- }, {
- name: "unfold",
- bindKey: bindKey("Alt-Shift-L|Ctrl-Shift-F1", "Command-Alt-Shift-L|Command-Shift-F1"),
- exec: function(editor) { editor.session.toggleFold(true); },
- readOnly: true
- }, {
- name: "foldall",
- bindKey: bindKey("Alt-0", "Command-Option-0"),
- exec: function(editor) { editor.session.foldAll(); },
- readOnly: true
- }, {
- name: "unfoldall",
- bindKey: bindKey("Alt-Shift-0", "Command-Option-Shift-0"),
- exec: function(editor) { editor.session.unfold(); },
- readOnly: true
- }, {
- name: "findnext",
- bindKey: bindKey("Ctrl-K", "Command-G"),
- exec: function(editor) { editor.findNext(); },
- readOnly: true
- }, {
- name: "findprevious",
- bindKey: bindKey("Ctrl-Shift-K", "Command-Shift-G"),
- exec: function(editor) { editor.findPrevious(); },
- readOnly: true
- }, {
- name: "find",
- bindKey: bindKey("Ctrl-F", "Command-F"),
- exec: function(editor) {
- var needle = prompt("Find:", editor.getCopyText());
- editor.find(needle);
- },
- readOnly: true
- }, {
- name: "overwrite",
- bindKey: "Insert",
- exec: function(editor) { editor.toggleOverwrite(); },
- readOnly: true
- }, {
- name: "selecttostart",
- bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
- exec: function(editor) { editor.getSelection().selectFileStart(); },
- readOnly: true
- }, {
- name: "gotostart",
- bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
- exec: function(editor) { editor.navigateFileStart(); },
- readOnly: true
- }, {
- name: "selectup",
- bindKey: bindKey("Shift-Up", "Shift-Up"),
- exec: function(editor) { editor.getSelection().selectUp(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "golineup",
- bindKey: bindKey("Up", "Up|Ctrl-P"),
- exec: function(editor, args) { editor.navigateUp(args.times); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selecttoend",
- bindKey: bindKey("Ctrl-Shift-End", "Command-Shift-Down"),
- exec: function(editor) { editor.getSelection().selectFileEnd(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotoend",
- bindKey: bindKey("Ctrl-End", "Command-End|Command-Down"),
- exec: function(editor) { editor.navigateFileEnd(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectdown",
- bindKey: bindKey("Shift-Down", "Shift-Down"),
- exec: function(editor) { editor.getSelection().selectDown(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "golinedown",
- bindKey: bindKey("Down", "Down|Ctrl-N"),
- exec: function(editor, args) { editor.navigateDown(args.times); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectwordleft",
- bindKey: bindKey("Ctrl-Shift-Left", "Option-Shift-Left"),
- exec: function(editor) { editor.getSelection().selectWordLeft(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotowordleft",
- bindKey: bindKey("Ctrl-Left", "Option-Left"),
- exec: function(editor) { editor.navigateWordLeft(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selecttolinestart",
- bindKey: bindKey("Alt-Shift-Left", "Command-Shift-Left"),
- exec: function(editor) { editor.getSelection().selectLineStart(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotolinestart",
- bindKey: bindKey("Alt-Left|Home", "Command-Left|Home|Ctrl-A"),
- exec: function(editor) { editor.navigateLineStart(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectleft",
- bindKey: bindKey("Shift-Left", "Shift-Left"),
- exec: function(editor) { editor.getSelection().selectLeft(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotoleft",
- bindKey: bindKey("Left", "Left|Ctrl-B"),
- exec: function(editor, args) { editor.navigateLeft(args.times); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectwordright",
- bindKey: bindKey("Ctrl-Shift-Right", "Option-Shift-Right"),
- exec: function(editor) { editor.getSelection().selectWordRight(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotowordright",
- bindKey: bindKey("Ctrl-Right", "Option-Right"),
- exec: function(editor) { editor.navigateWordRight(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selecttolineend",
- bindKey: bindKey("Alt-Shift-Right", "Command-Shift-Right"),
- exec: function(editor) { editor.getSelection().selectLineEnd(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotolineend",
- bindKey: bindKey("Alt-Right|End", "Command-Right|End|Ctrl-E"),
- exec: function(editor) { editor.navigateLineEnd(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectright",
- bindKey: bindKey("Shift-Right", "Shift-Right"),
- exec: function(editor) { editor.getSelection().selectRight(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "gotoright",
- bindKey: bindKey("Right", "Right|Ctrl-F"),
- exec: function(editor, args) { editor.navigateRight(args.times); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectpagedown",
- bindKey: "Shift-PageDown",
- exec: function(editor) { editor.selectPageDown(); },
- readOnly: true
- }, {
- name: "pagedown",
- bindKey: bindKey(null, "Option-PageDown"),
- exec: function(editor) { editor.scrollPageDown(); },
- readOnly: true
- }, {
- name: "gotopagedown",
- bindKey: bindKey("PageDown", "PageDown|Ctrl-V"),
- exec: function(editor) { editor.gotoPageDown(); },
- readOnly: true
- }, {
- name: "selectpageup",
- bindKey: "Shift-PageUp",
- exec: function(editor) { editor.selectPageUp(); },
- readOnly: true
- }, {
- name: "pageup",
- bindKey: bindKey(null, "Option-PageUp"),
- exec: function(editor) { editor.scrollPageUp(); },
- readOnly: true
- }, {
- name: "gotopageup",
- bindKey: "PageUp",
- exec: function(editor) { editor.gotoPageUp(); },
- readOnly: true
- }, {
- name: "scrollup",
- bindKey: bindKey("Ctrl-Up", null),
- exec: function(e) { e.renderer.scrollBy(0, -2 * e.renderer.layerConfig.lineHeight); },
- readOnly: true
- }, {
- name: "scrolldown",
- bindKey: bindKey("Ctrl-Down", null),
- exec: function(e) { e.renderer.scrollBy(0, 2 * e.renderer.layerConfig.lineHeight); },
- readOnly: true
- }, {
- name: "selectlinestart",
- bindKey: "Shift-Home",
- exec: function(editor) { editor.getSelection().selectLineStart(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selectlineend",
- bindKey: "Shift-End",
- exec: function(editor) { editor.getSelection().selectLineEnd(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "togglerecording",
- bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
- exec: function(editor) { editor.commands.toggleRecording(); },
- readOnly: true
- }, {
- name: "replaymacro",
- bindKey: bindKey("Ctrl-Shift-E", "Command-Shift-E"),
- exec: function(editor) { editor.commands.replay(editor); },
- readOnly: true
- }, {
- name: "jumptomatching",
- bindKey: bindKey("Ctrl-P", "Ctrl-P"),
- exec: function(editor) { editor.jumpToMatching(); },
- multiSelectAction: "forEach",
- readOnly: true
- }, {
- name: "selecttomatching",
- bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"),
- exec: function(editor) { editor.jumpToMatching(true); },
- readOnly: true
- },
-
- // commands disabled in readOnly mode
- {
- name: "cut",
- exec: function(editor) {
- var range = editor.getSelectionRange();
- editor._emit("cut", range);
-
- if (!editor.selection.isEmpty()) {
- editor.session.remove(range);
- editor.clearSelection();
- }
- },
- multiSelectAction: "forEach"
- }, {
- name: "removeline",
- bindKey: bindKey("Ctrl-D", "Command-D"),
- exec: function(editor) { editor.removeLines(); },
- multiSelectAction: "forEach"
- }, {
- name: "duplicateSelection",
- bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
- exec: function(editor) { editor.duplicateSelection(); },
- multiSelectAction: "forEach"
- }, {
- name: "togglecomment",
- bindKey: bindKey("Ctrl-/", "Command-/"),
- exec: function(editor) { editor.toggleCommentLines(); },
- multiSelectAction: "forEach"
- }, {
- name: "replace",
- bindKey: bindKey("Ctrl-R", "Command-Option-F"),
- exec: function(editor) {
- var needle = prompt("Find:", editor.getCopyText());
- if (!needle)
- return;
- var replacement = prompt("Replacement:");
- if (!replacement)
- return;
- editor.replace(replacement, {needle: needle});
- }
- }, {
- name: "replaceall",
- bindKey: bindKey("Ctrl-Shift-R", "Command-Shift-Option-F"),
- exec: function(editor) {
- var needle = prompt("Find:");
- if (!needle)
- return;
- var replacement = prompt("Replacement:");
- if (!replacement)
- return;
- editor.replaceAll(replacement, {needle: needle});
- }
- }, {
- name: "undo",
- bindKey: bindKey("Ctrl-Z", "Command-Z"),
- exec: function(editor) { editor.undo(); }
- }, {
- name: "redo",
- bindKey: bindKey("Ctrl-Shift-Z|Ctrl-Y", "Command-Shift-Z|Command-Y"),
- exec: function(editor) { editor.redo(); }
- }, {
- name: "copylinesup",
- bindKey: bindKey("Alt-Shift-Up", "Command-Option-Up"),
- exec: function(editor) { editor.copyLinesUp(); }
- }, {
- name: "movelinesup",
- bindKey: bindKey("Alt-Up", "Option-Up"),
- exec: function(editor) { editor.moveLinesUp(); }
- }, {
- name: "copylinesdown",
- bindKey: bindKey("Alt-Shift-Down", "Command-Option-Down"),
- exec: function(editor) { editor.copyLinesDown(); }
- }, {
- name: "movelinesdown",
- bindKey: bindKey("Alt-Down", "Option-Down"),
- exec: function(editor) { editor.moveLinesDown(); }
- }, {
- name: "del",
- bindKey: bindKey("Delete", "Delete|Ctrl-D"),
- exec: function(editor) { editor.remove("right"); },
- multiSelectAction: "forEach"
- }, {
- name: "backspace",
- bindKey: bindKey(
- "Command-Backspace|Option-Backspace|Shift-Backspace|Backspace",
- "Ctrl-Backspace|Command-Backspace|Shift-Backspace|Backspace|Ctrl-H"
- ),
- exec: function(editor) { editor.remove("left"); },
- multiSelectAction: "forEach"
- }, {
- name: "removetolinestart",
- bindKey: bindKey("Alt-Backspace", "Command-Backspace"),
- exec: function(editor) { editor.removeToLineStart(); },
- multiSelectAction: "forEach"
- }, {
- name: "removetolineend",
- bindKey: bindKey("Alt-Delete", "Ctrl-K"),
- exec: function(editor) { editor.removeToLineEnd(); },
- multiSelectAction: "forEach"
- }, {
- name: "removewordleft",
- bindKey: bindKey("Ctrl-Backspace", "Alt-Backspace|Ctrl-Alt-Backspace"),
- exec: function(editor) { editor.removeWordLeft(); },
- multiSelectAction: "forEach"
- }, {
- name: "removewordright",
- bindKey: bindKey("Ctrl-Delete", "Alt-Delete"),
- exec: function(editor) { editor.removeWordRight(); },
- multiSelectAction: "forEach"
- }, {
- name: "outdent",
- bindKey: bindKey("Shift-Tab", "Shift-Tab"),
- exec: function(editor) { editor.blockOutdent(); },
- multiSelectAction: "forEach"
- }, {
- name: "indent",
- bindKey: bindKey("Tab", "Tab"),
- exec: function(editor) { editor.indent(); },
- multiSelectAction: "forEach"
- }, {
- name: "insertstring",
- exec: function(editor, str) { editor.insert(str); },
- multiSelectAction: "forEach"
- }, {
- name: "inserttext",
- exec: function(editor, args) {
- editor.insert(lang.stringRepeat(args.text || "", args.times || 1));
- },
- multiSelectAction: "forEach"
- }, {
- name: "splitline",
- bindKey: bindKey(null, "Ctrl-O"),
- exec: function(editor) { editor.splitLine(); },
- multiSelectAction: "forEach"
- }, {
- name: "transposeletters",
- bindKey: bindKey("Ctrl-T", "Ctrl-T"),
- exec: function(editor) { editor.transposeLetters(); },
- multiSelectAction: function(editor) {editor.transposeSelections(1); }
- }, {
- name: "touppercase",
- bindKey: bindKey("Ctrl-U", "Ctrl-U"),
- exec: function(editor) { editor.toUpperCase(); },
- multiSelectAction: "forEach"
- }, {
- name: "tolowercase",
- bindKey: bindKey("Ctrl-Shift-U", "Ctrl-Shift-U"),
- exec: function(editor) { editor.toLowerCase(); },
- multiSelectAction: "forEach"
- }];
-
- });
-
- ace.define('ace/undomanager', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- /**
- * class UndoManager
- *
- * This object maintains the undo stack for an [[EditSession `EditSession`]].
- *
- **/
-
- /**
- * new UndoManager()
- *
- * Resets the current undo state and creates a new `UndoManager`.
- **/
- var UndoManager = function() {
- this.reset();
- };
-
- (function() {
-
- /**
- * UndoManager.execute(options) -> Void
- * - options (Object): Contains additional properties
- *
- * Provides a means for implementing your own undo manager. `options` has one property, `args`, an [[Array `Array`]], with two elements:
- * * `args[0]` is an array of deltas
- * * `args[1]` is the document to associate with
- *
- **/
- this.execute = function(options) {
- var deltas = options.args[0];
- this.$doc = options.args[1];
- this.$undoStack.push(deltas);
- this.$redoStack = [];
- };
- this.undo = function(dontSelect) {
- var deltas = this.$undoStack.pop();
- var undoSelectionRange = null;
- if (deltas) {
- undoSelectionRange =
- this.$doc.undoChanges(deltas, dontSelect);
- this.$redoStack.push(deltas);
- }
- return undoSelectionRange;
- };
- this.redo = function(dontSelect) {
- var deltas = this.$redoStack.pop();
- var redoSelectionRange = null;
- if (deltas) {
- redoSelectionRange =
- this.$doc.redoChanges(deltas, dontSelect);
- this.$undoStack.push(deltas);
- }
- return redoSelectionRange;
- };
- this.reset = function() {
- this.$undoStack = [];
- this.$redoStack = [];
- };
- this.hasUndo = function() {
- return this.$undoStack.length > 0;
- };
- this.hasRedo = function() {
- return this.$redoStack.length > 0;
- };
-
- }).call(UndoManager.prototype);
-
- exports.UndoManager = UndoManager;
- });
-
- ace.define('ace/virtual_renderer', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/useragent', 'ace/config', 'ace/lib/net', 'ace/layer/gutter', 'ace/layer/marker', 'ace/layer/text', 'ace/layer/cursor', 'ace/scrollbar', 'ace/renderloop', 'ace/lib/event_emitter', 'text!ace/css/editor.css'], function(require, exports, module) {
-
-
- var oop = require("./lib/oop");
- var dom = require("./lib/dom");
- var event = require("./lib/event");
- var useragent = require("./lib/useragent");
- var config = require("./config");
- var net = require("./lib/net");
- var GutterLayer = require("./layer/gutter").Gutter;
- var MarkerLayer = require("./layer/marker").Marker;
- var TextLayer = require("./layer/text").Text;
- var CursorLayer = require("./layer/cursor").Cursor;
- var ScrollBar = require("./scrollbar").ScrollBar;
- var RenderLoop = require("./renderloop").RenderLoop;
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
- var editorCss = require("text!./css/editor.css");
-
- dom.importCssString(editorCss, "ace_editor");
-
- /**
- * new VirtualRenderer(container, theme)
- * - container (DOMElement): The root element of the editor
- * - theme (String): The starting theme
- *
- * Constructs a new `VirtualRenderer` within the `container` specified, applying the given `theme`.
- *
- **/
-
- var VirtualRenderer = function(container, theme) {
- var _self = this;
-
- this.container = container;
-
- // TODO: this breaks rendering in Cloud9 with multiple ace instances
- // // Imports CSS once per DOM document ('ace_editor' serves as an identifier).
- // dom.importCssString(editorCss, "ace_editor", container.ownerDocument);
-
- // in IE <= 9 the native cursor always shines through
- this.$keepTextAreaAtCursor = !useragent.isIE;
-
- dom.addCssClass(container, "ace_editor");
-
- this.setTheme(theme);
-
- this.$gutter = dom.createElement("div");
- this.$gutter.className = "ace_gutter";
- this.container.appendChild(this.$gutter);
-
- this.scroller = dom.createElement("div");
- this.scroller.className = "ace_scroller";
- this.container.appendChild(this.scroller);
-
- this.content = dom.createElement("div");
- this.content.className = "ace_content";
- this.scroller.appendChild(this.content);
-
- this.$gutterLayer = new GutterLayer(this.$gutter);
- this.$gutterLayer.on("changeGutterWidth", this.onResize.bind(this, true));
- this.setFadeFoldWidgets(true);
-
- this.$markerBack = new MarkerLayer(this.content);
-
- var textLayer = this.$textLayer = new TextLayer(this.content);
- this.canvas = textLayer.element;
-
- this.$markerFront = new MarkerLayer(this.content);
-
- this.characterWidth = textLayer.getCharacterWidth();
- this.lineHeight = textLayer.getLineHeight();
-
- this.$cursorLayer = new CursorLayer(this.content);
- this.$cursorPadding = 8;
-
- // Indicates whether the horizontal scrollbar is visible
- this.$horizScroll = false;
- this.$horizScrollAlwaysVisible = false;
-
- this.$animatedScroll = false;
-
- this.scrollBar = new ScrollBar(container);
- this.scrollBar.addEventListener("scroll", function(e) {
- if (!_self.$inScrollAnimation)
- _self.session.setScrollTop(e.data);
- });
-
- this.scrollTop = 0;
- this.scrollLeft = 0;
-
- event.addListener(this.scroller, "scroll", function() {
- var scrollLeft = _self.scroller.scrollLeft;
- _self.scrollLeft = scrollLeft;
- _self.session.setScrollLeft(scrollLeft);
- });
-
- this.cursorPos = {
- row : 0,
- column : 0
- };
-
- this.$textLayer.addEventListener("changeCharacterSize", function() {
- _self.characterWidth = textLayer.getCharacterWidth();
- _self.lineHeight = textLayer.getLineHeight();
- _self.$updatePrintMargin();
- _self.onResize(true);
-
- _self.$loop.schedule(_self.CHANGE_FULL);
- });
-
- this.$size = {
- width: 0,
- height: 0,
- scrollerHeight: 0,
- scrollerWidth: 0
- };
-
- this.layerConfig = {
- width : 1,
- padding : 0,
- firstRow : 0,
- firstRowScreen: 0,
- lastRow : 0,
- lineHeight : 1,
- characterWidth : 1,
- minHeight : 1,
- maxHeight : 1,
- offset : 0,
- height : 1
- };
-
- this.$loop = new RenderLoop(
- this.$renderChanges.bind(this),
- this.container.ownerDocument.defaultView
- );
- this.$loop.schedule(this.CHANGE_FULL);
-
- this.setPadding(4);
- this.$updatePrintMargin();
- };
-
- (function() {
- this.showGutter = true;
-
- this.CHANGE_CURSOR = 1;
- this.CHANGE_MARKER = 2;
- this.CHANGE_GUTTER = 4;
- this.CHANGE_SCROLL = 8;
- this.CHANGE_LINES = 16;
- this.CHANGE_TEXT = 32;
- this.CHANGE_SIZE = 64;
- this.CHANGE_MARKER_BACK = 128;
- this.CHANGE_MARKER_FRONT = 256;
- this.CHANGE_FULL = 512;
- this.CHANGE_H_SCROLL = 1024;
-
- oop.implement(this, EventEmitter);
- this.setSession = function(session) {
- this.session = session;
-
- this.scroller.className = "ace_scroller";
-
- this.$cursorLayer.setSession(session);
- this.$markerBack.setSession(session);
- this.$markerFront.setSession(session);
- this.$gutterLayer.setSession(session);
- this.$textLayer.setSession(session);
- this.$loop.schedule(this.CHANGE_FULL);
-
- };
- this.updateLines = function(firstRow, lastRow) {
- if (lastRow === undefined)
- lastRow = Infinity;
-
- if (!this.$changedLines) {
- this.$changedLines = {
- firstRow: firstRow,
- lastRow: lastRow
- };
- }
- else {
- if (this.$changedLines.firstRow > firstRow)
- this.$changedLines.firstRow = firstRow;
-
- if (this.$changedLines.lastRow < lastRow)
- this.$changedLines.lastRow = lastRow;
- }
-
- this.$loop.schedule(this.CHANGE_LINES);
- };
- this.updateText = function() {
- this.$loop.schedule(this.CHANGE_TEXT);
- };
- this.updateFull = function() {
- this.$loop.schedule(this.CHANGE_FULL);
- };
- this.updateFontSize = function() {
- this.$textLayer.checkForSizeChanges();
- };
- this.onResize = function(force) {
- var changes = this.CHANGE_SIZE;
- var size = this.$size;
-
- var height = dom.getInnerHeight(this.container);
- if (force || size.height != height) {
- size.height = height;
-
- this.scroller.style.height = height + "px";
- size.scrollerHeight = this.scroller.clientHeight;
- this.scrollBar.setHeight(size.scrollerHeight);
-
- if (this.session) {
- this.session.setScrollTop(this.getScrollTop());
- changes = changes | this.CHANGE_FULL;
- }
- }
-
- var width = dom.getInnerWidth(this.container);
- if (force || size.width != width) {
- size.width = width;
-
- var gutterWidth = this.showGutter ? this.$gutter.offsetWidth : 0;
- this.scroller.style.left = gutterWidth + "px";
- size.scrollerWidth = Math.max(0, width - gutterWidth - this.scrollBar.getWidth());
- this.scroller.style.width = size.scrollerWidth + "px";
-
- if (this.session.getUseWrapMode() && this.adjustWrapLimit() || force)
- changes = changes | this.CHANGE_FULL;
- }
-
- this.$loop.schedule(changes);
- };
- this.adjustWrapLimit = function() {
- var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
- var limit = Math.floor(availableWidth / this.characterWidth);
- return this.session.adjustWrapLimit(limit);
- };
- this.setAnimatedScroll = function(shouldAnimate){
- this.$animatedScroll = shouldAnimate;
- };
- this.getAnimatedScroll = function() {
- return this.$animatedScroll;
- };
- this.setShowInvisibles = function(showInvisibles) {
- if (this.$textLayer.setShowInvisibles(showInvisibles))
- this.$loop.schedule(this.CHANGE_TEXT);
- };
- this.getShowInvisibles = function() {
- return this.$textLayer.showInvisibles;
- };
-
- this.$showPrintMargin = true;
- this.setShowPrintMargin = function(showPrintMargin) {
- this.$showPrintMargin = showPrintMargin;
- this.$updatePrintMargin();
- };
- this.getShowPrintMargin = function() {
- return this.$showPrintMargin;
- };
-
- this.$printMarginColumn = 80;
- this.setPrintMarginColumn = function(showPrintMargin) {
- this.$printMarginColumn = showPrintMargin;
- this.$updatePrintMargin();
- };
- this.getPrintMarginColumn = function() {
- return this.$printMarginColumn;
- };
- this.getShowGutter = function(){
- return this.showGutter;
- };
- this.setShowGutter = function(show){
- if(this.showGutter === show)
- return;
- this.$gutter.style.display = show ? "block" : "none";
- this.showGutter = show;
- this.onResize(true);
- };
-
- this.getFadeFoldWidgets = function(){
- return dom.hasCssClass(this.$gutter, "ace_fade-fold-widgets");
- };
-
- this.setFadeFoldWidgets = function(show) {
- if (show)
- dom.addCssClass(this.$gutter, "ace_fade-fold-widgets");
- else
- dom.removeCssClass(this.$gutter, "ace_fade-fold-widgets");
- };
-
- this.$highlightGutterLine = true;
- this.setHighlightGutterLine = function(shouldHighlight) {
- if (this.$highlightGutterLine == shouldHighlight)
- return;
- this.$highlightGutterLine = shouldHighlight;
-
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
-
- this.getHighlightGutterLine = function() {
- return this.$highlightGutterLine;
- };
-
- this.$updateGutterLineHighlight = function(gutterReady) {
- var i = this.session.selection.lead.row;
- if (i == this.$gutterLineHighlight)
- return;
-
- if (!gutterReady) {
- var lineEl, ch = this.$gutterLayer.element.children;
- var index = this.$gutterLineHighlight - this.layerConfig.firstRow;
- if (index >= 0 && (lineEl = ch[index]))
- dom.removeCssClass(lineEl, "ace_gutter_active_line");
-
- index = i - this.layerConfig.firstRow;
- if (index >= 0 && (lineEl = ch[index]))
- dom.addCssClass(lineEl, "ace_gutter_active_line");
- }
-
- this.$gutterLayer.removeGutterDecoration(this.$gutterLineHighlight, "ace_gutter_active_line");
- this.$gutterLayer.addGutterDecoration(i, "ace_gutter_active_line");
- this.$gutterLineHighlight = i;
- };
-
- this.$updatePrintMargin = function() {
- var containerEl;
-
- if (!this.$showPrintMargin && !this.$printMarginEl)
- return;
-
- if (!this.$printMarginEl) {
- containerEl = dom.createElement("div");
- containerEl.className = "ace_print_margin_layer";
- this.$printMarginEl = dom.createElement("div");
- this.$printMarginEl.className = "ace_print_margin";
- containerEl.appendChild(this.$printMarginEl);
- this.content.insertBefore(containerEl, this.$textLayer.element);
- }
-
- var style = this.$printMarginEl.style;
- style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
- style.visibility = this.$showPrintMargin ? "visible" : "hidden";
- };
- this.getContainerElement = function() {
- return this.container;
- };
- this.getMouseEventTarget = function() {
- return this.content;
- };
- this.getTextAreaContainer = function() {
- return this.container;
- };
-
- // move text input over the cursor
- // this is required for iOS and IME
- this.$moveTextAreaToCursor = function() {
- if (!this.$keepTextAreaAtCursor)
- return;
-
- var posTop = this.$cursorLayer.$pixelPos.top;
- var posLeft = this.$cursorLayer.$pixelPos.left;
- posTop -= this.layerConfig.offset;
-
- if (posTop < 0 || posTop > this.layerConfig.height - this.lineHeight)
- return;
-
- var w = this.characterWidth;
- if (this.$composition)
- w += this.textarea.scrollWidth;
- posLeft -= this.scrollLeft;
- if (posLeft > this.$size.scrollerWidth - w)
- posLeft = this.$size.scrollerWidth - w;
-
- if (this.showGutter)
- posLeft += this.$gutterLayer.gutterWidth;
-
- this.textarea.style.height = this.lineHeight + "px";
- this.textarea.style.width = w + "px";
- this.textarea.style.left = posLeft + "px";
- this.textarea.style.top = posTop - 1 + "px";
- };
- this.getFirstVisibleRow = function() {
- return this.layerConfig.firstRow;
- };
- this.getFirstFullyVisibleRow = function() {
- return this.layerConfig.firstRow + (this.layerConfig.offset === 0 ? 0 : 1);
- };
- this.getLastFullyVisibleRow = function() {
- var flint = Math.floor((this.layerConfig.height + this.layerConfig.offset) / this.layerConfig.lineHeight);
- return this.layerConfig.firstRow - 1 + flint;
- };
- this.getLastVisibleRow = function() {
- return this.layerConfig.lastRow;
- };
-
- this.$padding = null;
- this.setPadding = function(padding) {
- this.$padding = padding;
- this.$textLayer.setPadding(padding);
- this.$cursorLayer.setPadding(padding);
- this.$markerFront.setPadding(padding);
- this.$markerBack.setPadding(padding);
- this.$loop.schedule(this.CHANGE_FULL);
- this.$updatePrintMargin();
- };
- this.getHScrollBarAlwaysVisible = function() {
- return this.$horizScrollAlwaysVisible;
- };
- this.setHScrollBarAlwaysVisible = function(alwaysVisible) {
- if (this.$horizScrollAlwaysVisible != alwaysVisible) {
- this.$horizScrollAlwaysVisible = alwaysVisible;
- if (!this.$horizScrollAlwaysVisible || !this.$horizScroll)
- this.$loop.schedule(this.CHANGE_SCROLL);
- }
- };
-
- this.$updateScrollBar = function() {
- this.scrollBar.setInnerHeight(this.layerConfig.maxHeight);
- this.scrollBar.setScrollTop(this.scrollTop);
- };
-
- this.$renderChanges = function(changes) {
- if (!changes || !this.session || !this.container.offsetWidth)
- return;
-
- // text, scrolling and resize changes can cause the view port size to change
- if (changes & this.CHANGE_FULL ||
- changes & this.CHANGE_SIZE ||
- changes & this.CHANGE_TEXT ||
- changes & this.CHANGE_LINES ||
- changes & this.CHANGE_SCROLL
- )
- this.$computeLayerConfig();
-
- // horizontal scrolling
- if (changes & this.CHANGE_H_SCROLL) {
- this.scroller.scrollLeft = this.scrollLeft;
-
- // read the value after writing it since the value might get clipped
- var scrollLeft = this.scroller.scrollLeft;
- this.scrollLeft = scrollLeft;
- this.session.setScrollLeft(scrollLeft);
-
- this.scroller.className = this.scrollLeft == 0 ? "ace_scroller" : "ace_scroller horscroll";
- }
-
- // full
- if (changes & this.CHANGE_FULL) {
- this.$textLayer.checkForSizeChanges();
- // update scrollbar first to not lose scroll position when gutter calls resize
- this.$updateScrollBar();
- this.$textLayer.update(this.layerConfig);
- if (this.showGutter) {
- if (this.$highlightGutterLine)
- this.$updateGutterLineHighlight(true);
- this.$gutterLayer.update(this.layerConfig);
- }
- this.$markerBack.update(this.layerConfig);
- this.$markerFront.update(this.layerConfig);
- this.$cursorLayer.update(this.layerConfig);
- this.$moveTextAreaToCursor();
- return;
- }
-
- // scrolling
- if (changes & this.CHANGE_SCROLL) {
- this.$updateScrollBar();
- if (changes & this.CHANGE_TEXT || changes & this.CHANGE_LINES)
- this.$textLayer.update(this.layerConfig);
- else
- this.$textLayer.scrollLines(this.layerConfig);
-
- if (this.showGutter) {
- if (this.$highlightGutterLine)
- this.$updateGutterLineHighlight(true);
- this.$gutterLayer.update(this.layerConfig);
- }
- this.$markerBack.update(this.layerConfig);
- this.$markerFront.update(this.layerConfig);
- this.$cursorLayer.update(this.layerConfig);
- this.$moveTextAreaToCursor();
- return;
- }
-
- if (changes & this.CHANGE_TEXT) {
- this.$textLayer.update(this.layerConfig);
- if (this.showGutter)
- this.$gutterLayer.update(this.layerConfig);
- }
- else if (changes & this.CHANGE_LINES) {
- if (this.$updateLines()) {
- this.$updateScrollBar();
- if (this.showGutter)
- this.$gutterLayer.update(this.layerConfig);
- }
- } else if (changes & this.CHANGE_GUTTER) {
- if (this.showGutter)
- this.$gutterLayer.update(this.layerConfig);
- }
-
- if (changes & this.CHANGE_CURSOR) {
- this.$cursorLayer.update(this.layerConfig);
- this.$moveTextAreaToCursor();
- this.$highlightGutterLine && this.$updateGutterLineHighlight(false);
- }
-
- if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_FRONT)) {
- this.$markerFront.update(this.layerConfig);
- }
-
- if (changes & (this.CHANGE_MARKER | this.CHANGE_MARKER_BACK)) {
- this.$markerBack.update(this.layerConfig);
- }
-
- if (changes & this.CHANGE_SIZE)
- this.$updateScrollBar();
- };
-
- this.$computeLayerConfig = function() {
- var session = this.session;
-
- var offset = this.scrollTop % this.lineHeight;
- var minHeight = this.$size.scrollerHeight + this.lineHeight;
-
- var longestLine = this.$getLongestLine();
-
- var horizScroll = this.$horizScrollAlwaysVisible || this.$size.scrollerWidth - longestLine < 0;
- var horizScrollChanged = this.$horizScroll !== horizScroll;
- this.$horizScroll = horizScroll;
- if (horizScrollChanged) {
- this.scroller.style.overflowX = horizScroll ? "scroll" : "hidden";
- // when we hide scrollbar scroll event isn't emited
- // leaving session with wrong scrollLeft value
- if (!horizScroll)
- this.session.setScrollLeft(0);
- }
- var maxHeight = this.session.getScreenLength() * this.lineHeight;
- this.session.setScrollTop(Math.max(0, Math.min(this.scrollTop, maxHeight - this.$size.scrollerHeight)));
-
- var lineCount = Math.ceil(minHeight / this.lineHeight) - 1;
- var firstRow = Math.max(0, Math.round((this.scrollTop - offset) / this.lineHeight));
- var lastRow = firstRow + lineCount;
-
- // Map lines on the screen to lines in the document.
- var firstRowScreen, firstRowHeight;
- var lineHeight = { lineHeight: this.lineHeight };
- firstRow = session.screenToDocumentRow(firstRow, 0);
-
- // Check if firstRow is inside of a foldLine. If true, then use the first
- // row of the foldLine.
- var foldLine = session.getFoldLine(firstRow);
- if (foldLine) {
- firstRow = foldLine.start.row;
- }
-
- firstRowScreen = session.documentToScreenRow(firstRow, 0);
- firstRowHeight = session.getRowHeight(lineHeight, firstRow);
-
- lastRow = Math.min(session.screenToDocumentRow(lastRow, 0), session.getLength() - 1);
- minHeight = this.$size.scrollerHeight + session.getRowHeight(lineHeight, lastRow)+
- firstRowHeight;
-
- offset = this.scrollTop - firstRowScreen * this.lineHeight;
-
- this.layerConfig = {
- width : longestLine,
- padding : this.$padding,
- firstRow : firstRow,
- firstRowScreen: firstRowScreen,
- lastRow : lastRow,
- lineHeight : this.lineHeight,
- characterWidth : this.characterWidth,
- minHeight : minHeight,
- maxHeight : maxHeight,
- offset : offset,
- height : this.$size.scrollerHeight
- };
-
- // For debugging.
- // console.log(JSON.stringify(this.layerConfig));
-
- this.$gutterLayer.element.style.marginTop = (-offset) + "px";
- this.content.style.marginTop = (-offset) + "px";
- this.content.style.width = longestLine + 2 * this.$padding + "px";
- this.content.style.height = minHeight + "px";
-
- // Horizontal scrollbar visibility may have changed, which changes
- // the client height of the scroller
- if (horizScrollChanged)
- this.onResize(true);
- };
-
- this.$updateLines = function() {
- var firstRow = this.$changedLines.firstRow;
- var lastRow = this.$changedLines.lastRow;
- this.$changedLines = null;
-
- var layerConfig = this.layerConfig;
-
- if (firstRow > layerConfig.lastRow + 1) { return; }
- if (lastRow < layerConfig.firstRow) { return; }
-
- // if the last row is unknown -> redraw everything
- if (lastRow === Infinity) {
- if (this.showGutter)
- this.$gutterLayer.update(layerConfig);
- this.$textLayer.update(layerConfig);
- return;
- }
-
- // else update only the changed rows
- this.$textLayer.updateLines(layerConfig, firstRow, lastRow);
- return true;
- };
-
- this.$getLongestLine = function() {
- var charCount = this.session.getScreenWidth();
- if (this.$textLayer.showInvisibles)
- charCount += 1;
-
- return Math.max(this.$size.scrollerWidth - 2 * this.$padding, Math.round(charCount * this.characterWidth));
- };
- this.updateFrontMarkers = function() {
- this.$markerFront.setMarkers(this.session.getMarkers(true));
- this.$loop.schedule(this.CHANGE_MARKER_FRONT);
- };
- this.updateBackMarkers = function() {
- this.$markerBack.setMarkers(this.session.getMarkers());
- this.$loop.schedule(this.CHANGE_MARKER_BACK);
- };
- this.addGutterDecoration = function(row, className){
- this.$gutterLayer.addGutterDecoration(row, className);
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
- this.removeGutterDecoration = function(row, className){
- this.$gutterLayer.removeGutterDecoration(row, className);
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
- this.updateBreakpoints = function(rows) {
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
- this.setAnnotations = function(annotations) {
- this.$gutterLayer.setAnnotations(annotations);
- this.$loop.schedule(this.CHANGE_GUTTER);
- };
- this.updateCursor = function() {
- this.$loop.schedule(this.CHANGE_CURSOR);
- };
- this.hideCursor = function() {
- this.$cursorLayer.hideCursor();
- };
- this.showCursor = function() {
- this.$cursorLayer.showCursor();
- };
-
- this.scrollSelectionIntoView = function(anchor, lead, offset) {
- // first scroll anchor into view then scroll lead into view
- this.scrollCursorIntoView(anchor, offset);
- this.scrollCursorIntoView(lead, offset);
- };
- this.scrollCursorIntoView = function(cursor, offset) {
- // the editor is not visible
- if (this.$size.scrollerHeight === 0)
- return;
-
- var pos = this.$cursorLayer.getPixelPosition(cursor);
-
- var left = pos.left;
- var top = pos.top;
-
- if (this.scrollTop > top) {
- if (offset)
- top -= offset * this.$size.scrollerHeight;
- this.session.setScrollTop(top);
- } else if (this.scrollTop + this.$size.scrollerHeight < top + this.lineHeight) {
- if (offset)
- top += offset * this.$size.scrollerHeight;
- this.session.setScrollTop(top + this.lineHeight - this.$size.scrollerHeight);
- }
-
- var scrollLeft = this.scrollLeft;
-
- if (scrollLeft > left) {
- if (left < this.$padding + 2 * this.layerConfig.characterWidth)
- left = 0;
- this.session.setScrollLeft(left);
- } else if (scrollLeft + this.$size.scrollerWidth < left + this.characterWidth) {
- this.session.setScrollLeft(Math.round(left + this.characterWidth - this.$size.scrollerWidth));
- }
- };
- this.getScrollTop = function() {
- return this.session.getScrollTop();
- };
- this.getScrollLeft = function() {
- return this.session.getScrollLeft();
- };
- this.getScrollTopRow = function() {
- return this.scrollTop / this.lineHeight;
- };
- this.getScrollBottomRow = function() {
- return Math.max(0, Math.floor((this.scrollTop + this.$size.scrollerHeight) / this.lineHeight) - 1);
- };
- this.scrollToRow = function(row) {
- this.session.setScrollTop(row * this.lineHeight);
- };
-
- this.alignCursor = function(cursor, alignment) {
- if (typeof cursor == "number")
- cursor = {row: cursor, column: 0};
-
- var pos = this.$cursorLayer.getPixelPosition(cursor);
- var offset = pos.top - this.$size.scrollerHeight * (alignment || 0);
-
- this.session.setScrollTop(offset);
- };
-
- this.STEPS = 8;
- this.$calcSteps = function(fromValue, toValue){
- var i = 0;
- var l = this.STEPS;
- var steps = [];
-
- var func = function(t, x_min, dx) {
- return dx * (Math.pow(t - 1, 3) + 1) + x_min;
- };
-
- for (i = 0; i < l; ++i)
- steps.push(func(i / this.STEPS, fromValue, toValue - fromValue));
-
- return steps;
- };
- this.scrollToLine = function(line, center, animate, callback) {
- var pos = this.$cursorLayer.getPixelPosition({row: line, column: 0});
- var offset = pos.top;
- if (center)
- offset -= this.$size.scrollerHeight / 2;
-
- var initialScroll = this.scrollTop;
- this.session.setScrollTop(offset);
- if (animate !== false)
- this.animateScrolling(initialScroll, callback);
- };
-
- this.animateScrolling = function(fromValue, callback) {
- var toValue = this.scrollTop;
- if (this.$animatedScroll && Math.abs(fromValue - toValue) < 100000) {
- var _self = this;
- var steps = _self.$calcSteps(fromValue, toValue);
- this.$inScrollAnimation = true;
-
- clearInterval(this.$timer);
-
- _self.session.setScrollTop(steps.shift());
- this.$timer = setInterval(function() {
- if (steps.length) {
- _self.session.setScrollTop(steps.shift());
- // trick session to think it's already scrolled to not loose toValue
- _self.session.$scrollTop = toValue;
- } else if (toValue != null) {
- _self.session.$scrollTop = -1;
- _self.session.setScrollTop(toValue);
- toValue = null;
- } else {
- // do this on separate step to not get spurious scroll event from scrollbar
- _self.$timer = clearInterval(_self.$timer);
- _self.$inScrollAnimation = false;
- callback && callback();
- }
- }, 10);
- }
- };
- this.scrollToY = function(scrollTop) {
- // after calling scrollBar.setScrollTop
- // scrollbar sends us event with same scrollTop. ignore it
- if (this.scrollTop !== scrollTop) {
- this.$loop.schedule(this.CHANGE_SCROLL);
- this.scrollTop = scrollTop;
- }
- };
- this.scrollToX = function(scrollLeft) {
- if (scrollLeft < 0)
- scrollLeft = 0;
-
- if (this.scrollLeft !== scrollLeft)
- this.scrollLeft = scrollLeft;
- this.$loop.schedule(this.CHANGE_H_SCROLL);
- };
- this.scrollBy = function(deltaX, deltaY) {
- deltaY && this.session.setScrollTop(this.session.getScrollTop() + deltaY);
- deltaX && this.session.setScrollLeft(this.session.getScrollLeft() + deltaX);
- };
- this.isScrollableBy = function(deltaX, deltaY) {
- if (deltaY < 0 && this.session.getScrollTop() > 0)
- return true;
- if (deltaY > 0 && this.session.getScrollTop() + this.$size.scrollerHeight < this.layerConfig.maxHeight)
- return true;
- // todo: handle horizontal scrolling
- };
-
- this.pixelToScreenCoordinates = function(x, y) {
- var canvasPos = this.scroller.getBoundingClientRect();
-
- var offset = (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth;
- var row = Math.floor((y + this.scrollTop - canvasPos.top) / this.lineHeight);
- var col = Math.round(offset);
-
- return {row: row, column: col, side: offset - col > 0 ? 1 : -1};
- };
-
- this.screenToTextCoordinates = function(x, y) {
- var canvasPos = this.scroller.getBoundingClientRect();
-
- var col = Math.round(
- (x + this.scrollLeft - canvasPos.left - this.$padding) / this.characterWidth
- );
- var row = Math.floor(
- (y + this.scrollTop - canvasPos.top) / this.lineHeight
- );
-
- return this.session.screenToDocumentPosition(row, Math.max(col, 0));
- };
- this.textToScreenCoordinates = function(row, column) {
- var canvasPos = this.scroller.getBoundingClientRect();
- var pos = this.session.documentToScreenPosition(row, column);
-
- var x = this.$padding + Math.round(pos.column * this.characterWidth);
- var y = pos.row * this.lineHeight;
-
- return {
- pageX: canvasPos.left + x - this.scrollLeft,
- pageY: canvasPos.top + y - this.scrollTop
- };
- };
- this.visualizeFocus = function() {
- dom.addCssClass(this.container, "ace_focus");
- };
- this.visualizeBlur = function() {
- dom.removeCssClass(this.container, "ace_focus");
- };
- this.showComposition = function(position) {
- if (!this.$composition)
- this.$composition = {
- keepTextAreaAtCursor: this.$keepTextAreaAtCursor,
- cssText: this.textarea.style.cssText
- };
-
- this.$keepTextAreaAtCursor = true;
- dom.addCssClass(this.textarea, "ace_composition");
- this.textarea.style.cssText = "";
- this.$moveTextAreaToCursor();
- };
- this.setCompositionText = function(text) {
- this.$moveTextAreaToCursor();
- };
- this.hideComposition = function() {
- if (!this.$composition)
- return;
-
- dom.removeCssClass(this.textarea, "ace_composition");
- this.$keepTextAreaAtCursor = this.$composition.keepTextAreaAtCursor;
- this.textarea.style.cssText = this.$composition.cssText;
- this.$composition = null;
- };
-
- this._loadTheme = function(name, callback) {
- if (!config.get("packaged"))
- return callback();
-
- var base = name.split("/").pop();
- var filename = config.get("themePath") + "/theme-" + base + config.get("suffix");
- net.loadScript(filename, callback);
- };
- this.setTheme = function(theme) {
- var _self = this;
-
- this.$themeValue = theme;
- if (!theme || typeof theme == "string") {
- var moduleName = theme || "ace/theme/textmate";
-
- var module;
- try {
- module = require(moduleName);
- } catch (e) {};
- if (module)
- return afterLoad(module);
-
- _self._loadTheme(moduleName, function() {
- require([moduleName], function(module) {
- if (_self.$themeValue !== theme)
- return;
-
- afterLoad(module);
- });
- });
- } else {
- afterLoad(theme);
- }
-
- function afterLoad(theme) {
- dom.importCssString(
- theme.cssText,
- theme.cssClass,
- _self.container.ownerDocument
- );
-
- if (_self.$theme)
- dom.removeCssClass(_self.container, _self.$theme);
-
- _self.$theme = theme ? theme.cssClass : null;
-
- if (_self.$theme)
- dom.addCssClass(_self.container, _self.$theme);
-
- if (theme && theme.isDark)
- dom.addCssClass(_self.container, "ace_dark");
- else
- dom.removeCssClass(_self.container, "ace_dark");
-
- // force re-measure of the gutter width
- if (_self.$size) {
- _self.$size.width = 0;
- _self.onResize();
- }
- }
- };
- this.getTheme = function() {
- return this.$themeValue;
- };
-
- // Methods allows to add / remove CSS classnames to the editor element.
- // This feature can be used by plug-ins to provide a visual indication of
- // a certain mode that editor is in.
-
- /**
- * VirtualRenderer.setStyle(style) -> Void
- * - style (String): A class name
- *
- * [Adds a new class, `style`, to the editor.]{: #VirtualRenderer.setStyle}
- **/
- this.setStyle = function setStyle(style) {
- dom.addCssClass(this.container, style);
- };
- this.unsetStyle = function unsetStyle(style) {
- dom.removeCssClass(this.container, style);
- };
- this.destroy = function() {
- this.$textLayer.destroy();
- this.$cursorLayer.destroy();
- };
-
- }).call(VirtualRenderer.prototype);
-
- exports.VirtualRenderer = VirtualRenderer;
- });
-
- ace.define('ace/layer/gutter', ['require', 'exports', 'module' , 'ace/lib/dom', 'ace/lib/oop', 'ace/lib/event_emitter'], function(require, exports, module) {
-
-
- var dom = require("../lib/dom");
- var oop = require("../lib/oop");
- var EventEmitter = require("../lib/event_emitter").EventEmitter;
-
- var Gutter = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_gutter-layer";
- parentEl.appendChild(this.element);
- this.setShowFoldWidgets(this.$showFoldWidgets);
-
- this.gutterWidth = 0;
-
- this.$breakpoints = [];
- this.$annotations = [];
- this.$decorations = [];
- };
-
- (function() {
-
- oop.implement(this, EventEmitter);
-
- this.setSession = function(session) {
- this.session = session;
- };
-
- this.addGutterDecoration = function(row, className){
- if (!this.$decorations[row])
- this.$decorations[row] = "";
- this.$decorations[row] += " " + className;
- };
-
- this.removeGutterDecoration = function(row, className){
- this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, "");
- };
-
- this.setAnnotations = function(annotations) {
- // iterate over sparse array
- this.$annotations = [];
- for (var row in annotations) if (annotations.hasOwnProperty(row)) {
- var rowAnnotations = annotations[row];
- if (!rowAnnotations)
- continue;
-
- var rowInfo = this.$annotations[row] = {
- text: []
- };
- for (var i=0; i<rowAnnotations.length; i++) {
- var annotation = rowAnnotations[i];
- var annoText = annotation.text.replace(/"/g, """).replace(/'/g, "’").replace(/</, "<");
- if (rowInfo.text.indexOf(annoText) === -1)
- rowInfo.text.push(annoText);
- var type = annotation.type;
- if (type == "error")
- rowInfo.className = "ace_error";
- else if (type == "warning" && rowInfo.className != "ace_error")
- rowInfo.className = "ace_warning";
- else if (type == "info" && (!rowInfo.className))
- rowInfo.className = "ace_info";
- }
- }
- };
-
- this.update = function(config) {
- this.$config = config;
-
- var emptyAnno = {className: "", text: []};
- var html = [];
- var i = config.firstRow;
- var lastRow = config.lastRow;
- var fold = this.session.getNextFoldLine(i);
- var foldStart = fold ? fold.start.row : Infinity;
- var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
- var breakpoints = this.session.$breakpoints;
-
- while (true) {
- if(i > foldStart) {
- i = fold.end.row + 1;
- fold = this.session.getNextFoldLine(i, fold);
- foldStart = fold ?fold.start.row :Infinity;
- }
- if(i > lastRow)
- break;
-
- var annotation = this.$annotations[i] || emptyAnno;
- html.push("<div class='ace_gutter-cell",
- this.$decorations[i] || "",
- breakpoints[i] ? " ace_breakpoint " : " ",
- annotation.className,
- "' title='", annotation.text.join("\n"),
- "' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1));
-
- if (foldWidgets) {
- var c = foldWidgets[i];
- // check if cached value is invalidated and we need to recompute
- if (c == null)
- c = foldWidgets[i] = this.session.getFoldWidget(i);
- if (c)
- html.push(
- "<span class='ace_fold-widget ", c,
- c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open",
- "'></span>"
- );
- }
-
- html.push("</div>");
-
- i++;
- }
-
- if (this.session.$useWrapMode)
- html.push(
- "<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
- this.session.getLength() - 1,
- "</div>"
- );
-
- this.element = dom.setInnerHtml(this.element, html.join(""));
- this.element.style.height = config.minHeight + "px";
-
- var gutterWidth = this.element.offsetWidth;
- if (gutterWidth !== this.gutterWidth) {
- this.gutterWidth = gutterWidth;
- this._emit("changeGutterWidth", gutterWidth);
- }
- };
-
- this.$showFoldWidgets = true;
- this.setShowFoldWidgets = function(show) {
- if (show)
- dom.addCssClass(this.element, "ace_folding-enabled");
- else
- dom.removeCssClass(this.element, "ace_folding-enabled");
-
- this.$showFoldWidgets = show;
- };
-
- this.getShowFoldWidgets = function() {
- return this.$showFoldWidgets;
- };
-
- }).call(Gutter.prototype);
-
- exports.Gutter = Gutter;
-
- });
-
- ace.define('ace/layer/marker', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/dom'], function(require, exports, module) {
-
-
- var Range = require("../range").Range;
- var dom = require("../lib/dom");
-
- var Marker = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_marker-layer";
- parentEl.appendChild(this.element);
- };
-
- (function() {
-
- this.$padding = 0;
-
- this.setPadding = function(padding) {
- this.$padding = padding;
- };
- this.setSession = function(session) {
- this.session = session;
- };
-
- this.setMarkers = function(markers) {
- this.markers = markers;
- };
-
- this.update = function(config) {
- var config = config || this.config;
- if (!config)
- return;
-
- this.config = config;
-
-
- var html = [];
- for ( var key in this.markers) {
- var marker = this.markers[key];
-
- if (!marker.range) {
- marker.update(html, this, this.session, config);
- continue;
- }
-
- var range = marker.range.clipRows(config.firstRow, config.lastRow);
- if (range.isEmpty()) continue;
-
- range = range.toScreenRange(this.session);
- if (marker.renderer) {
- var top = this.$getTop(range.start.row, config);
- var left = Math.round(
- this.$padding + range.start.column * config.characterWidth
- );
- marker.renderer(html, range, left, top, config);
- }
- else if (range.isMultiLine()) {
- if (marker.type == "text") {
- this.drawTextMarker(html, range, marker.clazz, config);
- } else {
- this.drawMultiLineMarker(
- html, range, marker.clazz, config,
- marker.type
- );
- }
- }
- else {
- this.drawSingleLineMarker(
- html, range, marker.clazz + " start", config,
- null, marker.type
- );
- }
- }
- this.element = dom.setInnerHtml(this.element, html.join(""));
- };
-
- this.$getTop = function(row, layerConfig) {
- return (row - layerConfig.firstRowScreen) * layerConfig.lineHeight;
- };
-
- // Draws a marker, which spans a range of text on multiple lines
- this.drawTextMarker = function(stringBuilder, range, clazz, layerConfig) {
- // selection start
- var row = range.start.row;
-
- var lineRange = new Range(
- row, range.start.column,
- row, this.session.getScreenLastRowColumn(row)
- );
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text");
-
- // selection end
- row = range.end.row;
- lineRange = new Range(row, 0, row, range.end.column);
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 0, "text");
-
- for (row = range.start.row + 1; row < range.end.row; row++) {
- lineRange.start.row = row;
- lineRange.end.row = row;
- lineRange.end.column = this.session.getScreenLastRowColumn(row);
- this.drawSingleLineMarker(stringBuilder, lineRange, clazz, layerConfig, 1, "text");
- }
- };
-
- // Draws a multi line marker, where lines span the full width
- this.drawMultiLineMarker = function(stringBuilder, range, clazz, layerConfig, type) {
- var padding = type === "background" ? 0 : this.$padding;
- var layerWidth = layerConfig.width + 2 * this.$padding - padding;
- // from selection start to the end of the line
- var height = layerConfig.lineHeight;
- var width = Math.round(layerWidth - (range.start.column * layerConfig.characterWidth));
- var top = this.$getTop(range.start.row, layerConfig);
- var left = Math.round(
- padding + range.start.column * layerConfig.characterWidth
- );
-
- stringBuilder.push(
- "<div class='", clazz, " start' style='",
- "height:", height, "px;",
- "width:", width, "px;",
- "top:", top, "px;",
- "left:", left, "px;'></div>"
- );
-
- // from start of the last line to the selection end
- top = this.$getTop(range.end.row, layerConfig);
- width = Math.round(range.end.column * layerConfig.characterWidth);
-
- stringBuilder.push(
- "<div class='", clazz, "' style='",
- "height:", height, "px;",
- "width:", width, "px;",
- "top:", top, "px;",
- "left:", padding, "px;'></div>"
- );
-
- // all the complete lines
- height = (range.end.row - range.start.row - 1) * layerConfig.lineHeight;
- if (height < 0)
- return;
- top = this.$getTop(range.start.row + 1, layerConfig);
-
- stringBuilder.push(
- "<div class='", clazz, "' style='",
- "height:", height, "px;",
- "width:", layerWidth, "px;",
- "top:", top, "px;",
- "left:", padding, "px;'></div>"
- );
- };
-
- // Draws a marker which covers part or whole width of a single screen line
- this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) {
- var padding = type === "background" ? 0 : this.$padding;
- var height = layerConfig.lineHeight;
-
- if (type === "background")
- var width = layerConfig.width;
- else
- width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
-
- var top = this.$getTop(range.start.row, layerConfig);
- var left = Math.round(
- padding + range.start.column * layerConfig.characterWidth
- );
-
- stringBuilder.push(
- "<div class='", clazz, "' style='",
- "height:", height, "px;",
- "width:", width, "px;",
- "top:", top, "px;",
- "left:", left,"px;'></div>"
- );
- };
-
- }).call(Marker.prototype);
-
- exports.Marker = Marker;
-
- });
-
- ace.define('ace/layer/text', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/lang', 'ace/lib/useragent', 'ace/lib/event_emitter'], function(require, exports, module) {
-
-
- var oop = require("../lib/oop");
- var dom = require("../lib/dom");
- var lang = require("../lib/lang");
- var useragent = require("../lib/useragent");
- var EventEmitter = require("../lib/event_emitter").EventEmitter;
-
- var Text = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_text-layer";
- parentEl.appendChild(this.element);
-
- this.$characterSize = this.$measureSizes() || {width: 0, height: 0};
- this.$pollSizeChanges();
- };
-
- (function() {
-
- oop.implement(this, EventEmitter);
-
- this.EOF_CHAR = "\xB6"; //"¶";
- this.EOL_CHAR = "\xAC"; //"¬";
- this.TAB_CHAR = "\u2192"; //"→" "\u21E5";
- this.SPACE_CHAR = "\xB7"; //"·";
- this.$padding = 0;
-
- this.setPadding = function(padding) {
- this.$padding = padding;
- this.element.style.padding = "0 " + padding + "px";
- };
-
- this.getLineHeight = function() {
- return this.$characterSize.height || 1;
- };
-
- this.getCharacterWidth = function() {
- return this.$characterSize.width || 1;
- };
-
- this.checkForSizeChanges = function() {
- var size = this.$measureSizes();
- if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
- this.$characterSize = size;
- this._emit("changeCharacterSize", {data: size});
- }
- };
-
- this.$pollSizeChanges = function() {
- var self = this;
- this.$pollSizeChangesTimer = setInterval(function() {
- self.checkForSizeChanges();
- }, 500);
- };
-
- this.$fontStyles = {
- fontFamily : 1,
- fontSize : 1,
- fontWeight : 1,
- fontStyle : 1,
- lineHeight : 1
- };
-
- this.$measureSizes = useragent.isIE || useragent.isOldGecko ? function() {
- var n = 1000;
- if (!this.$measureNode) {
- var measureNode = this.$measureNode = dom.createElement("div");
- var style = measureNode.style;
-
- style.width = style.height = "auto";
- style.left = style.top = (-n * 40) + "px";
-
- style.visibility = "hidden";
- style.position = "fixed";
- style.overflow = "visible";
- style.whiteSpace = "nowrap";
-
- // in FF 3.6 monospace fonts can have a fixed sub pixel width.
- // that's why we have to measure many characters
- // Note: characterWidth can be a float!
- measureNode.innerHTML = lang.stringRepeat("Xy", n);
-
- if (this.element.ownerDocument.body) {
- this.element.ownerDocument.body.appendChild(measureNode);
- } else {
- var container = this.element.parentNode;
- while (!dom.hasCssClass(container, "ace_editor"))
- container = container.parentNode;
- container.appendChild(measureNode);
- }
- }
-
- // Size and width can be null if the editor is not visible or
- // detached from the document
- if (!this.element.offsetWidth)
- return null;
-
- var style = this.$measureNode.style;
- var computedStyle = dom.computedStyle(this.element);
- for (var prop in this.$fontStyles)
- style[prop] = computedStyle[prop];
-
- var size = {
- height: this.$measureNode.offsetHeight,
- width: this.$measureNode.offsetWidth / (n * 2)
- };
-
- // Size and width can be null if the editor is not visible or
- // detached from the document
- if (size.width == 0 || size.height == 0)
- return null;
-
- return size;
- }
- : function() {
- if (!this.$measureNode) {
- var measureNode = this.$measureNode = dom.createElement("div");
- var style = measureNode.style;
-
- style.width = style.height = "auto";
- style.left = style.top = -100 + "px";
-
- style.visibility = "hidden";
- style.position = "fixed";
- style.overflow = "visible";
- style.whiteSpace = "nowrap";
-
- measureNode.innerHTML = "X";
-
- var container = this.element.parentNode;
- while (container && !dom.hasCssClass(container, "ace_editor"))
- container = container.parentNode;
-
- if (!container)
- return this.$measureNode = null;
-
- container.appendChild(measureNode);
- }
-
- var rect = this.$measureNode.getBoundingClientRect();
-
- var size = {
- height: rect.height,
- width: rect.width
- };
-
- // Size and width can be null if the editor is not visible or
- // detached from the document
- if (size.width == 0 || size.height == 0)
- return null;
-
- return size;
- };
-
- this.setSession = function(session) {
- this.session = session;
- };
-
- this.showInvisibles = false;
- this.setShowInvisibles = function(showInvisibles) {
- if (this.showInvisibles == showInvisibles)
- return false;
-
- this.showInvisibles = showInvisibles;
- return true;
- };
-
- this.$tabStrings = [];
- this.$computeTabString = function() {
- var tabSize = this.session.getTabSize();
- var tabStr = this.$tabStrings = [0];
- for (var i = 1; i < tabSize + 1; i++) {
- if (this.showInvisibles) {
- tabStr.push("<span class='ace_invisible'>"
- + this.TAB_CHAR
- + new Array(i).join(" ")
- + "</span>");
- } else {
- tabStr.push(new Array(i+1).join(" "));
- }
- }
-
- };
-
- this.updateLines = function(config, firstRow, lastRow) {
- this.$computeTabString();
- // Due to wrap line changes there can be new lines if e.g.
- // the line to updated wrapped in the meantime.
- if (this.config.lastRow != config.lastRow ||
- this.config.firstRow != config.firstRow) {
- this.scrollLines(config);
- }
- this.config = config;
-
- var first = Math.max(firstRow, config.firstRow);
- var last = Math.min(lastRow, config.lastRow);
-
- var lineElements = this.element.childNodes;
- var lineElementsIdx = 0;
-
- for (var row = config.firstRow; row < first; row++) {
- var foldLine = this.session.getFoldLine(row);
- if (foldLine) {
- if (foldLine.containsRow(first)) {
- first = foldLine.start.row;
- break;
- } else {
- row = foldLine.end.row;
- }
- }
- lineElementsIdx ++;
- }
-
- for (var i=first; i<=last; i++) {
- var lineElement = lineElements[lineElementsIdx++];
- if (!lineElement)
- continue;
-
- var html = [];
- var tokens = this.session.getTokens(i);
- this.$renderLine(html, i, tokens, !this.$useLineGroups());
- lineElement = dom.setInnerHtml(lineElement, html.join(""));
-
- i = this.session.getRowFoldEnd(i);
- }
- };
-
- this.scrollLines = function(config) {
- this.$computeTabString();
- var oldConfig = this.config;
- this.config = config;
-
- if (!oldConfig || oldConfig.lastRow < config.firstRow)
- return this.update(config);
-
- if (config.lastRow < oldConfig.firstRow)
- return this.update(config);
-
- var el = this.element;
- if (oldConfig.firstRow < config.firstRow)
- for (var row=this.session.getFoldedRowCount(oldConfig.firstRow, config.firstRow - 1); row>0; row--)
- el.removeChild(el.firstChild);
-
- if (oldConfig.lastRow > config.lastRow)
- for (var row=this.session.getFoldedRowCount(config.lastRow + 1, oldConfig.lastRow); row>0; row--)
- el.removeChild(el.lastChild);
-
- if (config.firstRow < oldConfig.firstRow) {
- var fragment = this.$renderLinesFragment(config, config.firstRow, oldConfig.firstRow - 1);
- if (el.firstChild)
- el.insertBefore(fragment, el.firstChild);
- else
- el.appendChild(fragment);
- }
-
- if (config.lastRow > oldConfig.lastRow) {
- var fragment = this.$renderLinesFragment(config, oldConfig.lastRow + 1, config.lastRow);
- el.appendChild(fragment);
- }
- };
-
- this.$renderLinesFragment = function(config, firstRow, lastRow) {
- var fragment = this.element.ownerDocument.createDocumentFragment();
- var row = firstRow;
- var foldLine = this.session.getNextFoldLine(row);
- var foldStart = foldLine ? foldLine.start.row : Infinity;
-
- while (true) {
- if (row > foldStart) {
- row = foldLine.end.row+1;
- foldLine = this.session.getNextFoldLine(row, foldLine);
- foldStart = foldLine ? foldLine.start.row : Infinity;
- }
- if (row > lastRow)
- break;
-
- var container = dom.createElement("div");
-
- var html = [];
- // Get the tokens per line as there might be some lines in between
- // beeing folded.
- var tokens = this.session.getTokens(row);
- this.$renderLine(html, row, tokens, false);
-
- // don't use setInnerHtml since we are working with an empty DIV
- container.innerHTML = html.join("");
- if (this.$useLineGroups()) {
- container.className = 'ace_line_group';
- fragment.appendChild(container);
- } else {
- var lines = container.childNodes
- while(lines.length)
- fragment.appendChild(lines[0]);
- }
-
- row++;
- }
- return fragment;
- };
-
- this.update = function(config) {
- this.$computeTabString();
- this.config = config;
-
- var html = [];
- var firstRow = config.firstRow, lastRow = config.lastRow;
-
- var row = firstRow;
- var foldLine = this.session.getNextFoldLine(row);
- var foldStart = foldLine ? foldLine.start.row : Infinity;
-
- while (true) {
- if (row > foldStart) {
- row = foldLine.end.row+1;
- foldLine = this.session.getNextFoldLine(row, foldLine);
- foldStart = foldLine ? foldLine.start.row :Infinity;
- }
- if (row > lastRow)
- break;
-
- if (this.$useLineGroups())
- html.push("<div class='ace_line_group'>")
-
- // Get the tokens per line as there might be some lines in between
- // beeing folded.
- var tokens = this.session.getTokens(row);
- this.$renderLine(html, row, tokens, false);
-
- if (this.$useLineGroups())
- html.push("</div>"); // end the line group
-
- row++;
- }
- this.element = dom.setInnerHtml(this.element, html.join(""));
- };
-
- this.$textToken = {
- "text": true,
- "rparen": true,
- "lparen": true
- };
-
- this.$renderToken = function(stringBuilder, screenColumn, token, value) {
- var self = this;
- var replaceReg = /\t|&|<|( +)|([\u0000-\u0019\u00a0\u1680\u180E\u2000-\u200b\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
- var replaceFunc = function(c, a, b, tabIdx, idx4) {
- if (a) {
- return new Array(c.length+1).join(" ");
- } else if (c == "&") {
- return "&";
- } else if (c == "<") {
- return "<";
- } else if (c == "\t") {
- var tabSize = self.session.getScreenTabSize(screenColumn + tabIdx);
- screenColumn += tabSize - 1;
- return self.$tabStrings[tabSize];
- } else if (c == "\u3000") {
- // U+3000 is both invisible AND full-width, so must be handled uniquely
- var classToUse = self.showInvisibles ? "ace_cjk ace_invisible" : "ace_cjk";
- var space = self.showInvisibles ? self.SPACE_CHAR : "";
- screenColumn += 1;
- return "<span class='" + classToUse + "' style='width:" +
- (self.config.characterWidth * 2) +
- "px'>" + space + "</span>";
- } else if (b) {
- return "<span class='ace_invisible ace_invalid'>" + self.SPACE_CHAR + "</span>";
- } else {
- screenColumn += 1;
- return "<span class='ace_cjk' style='width:" +
- (self.config.characterWidth * 2) +
- "px'>" + c + "</span>";
- }
- };
-
- var output = value.replace(replaceReg, replaceFunc);
-
- if (!this.$textToken[token.type]) {
- var classes = "ace_" + token.type.replace(/\./g, " ace_");
- var style = "";
- if (token.type == "fold")
- style = " style='width:" + (token.value.length * this.config.characterWidth) + "px;' ";
- stringBuilder.push("<span class='", classes, "'", style, ">", output, "</span>");
- }
- else {
- stringBuilder.push(output);
- }
- return screenColumn + value.length;
- };
-
- this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits, onlyContents) {
- var chars = 0;
- var split = 0;
- var splitChars;
- var screenColumn = 0;
- var self = this;
-
- if (!splits || splits.length == 0)
- splitChars = Number.MAX_VALUE;
- else
- splitChars = splits[0];
-
- if (!onlyContents) {
- stringBuilder.push("<div class='ace_line' style='height:",
- this.config.lineHeight, "px",
- "'>"
- );
- }
-
- for (var i = 0; i < tokens.length; i++) {
- var token = tokens[i];
- var value = token.value;
-
- if (chars + value.length < splitChars) {
- screenColumn = self.$renderToken(
- stringBuilder, screenColumn, token, value
- );
- chars += value.length;
- }
- else {
- while (chars + value.length >= splitChars) {
- screenColumn = self.$renderToken(
- stringBuilder, screenColumn,
- token, value.substring(0, splitChars - chars)
- );
- value = value.substring(splitChars - chars);
- chars = splitChars;
-
- if (!onlyContents) {
- stringBuilder.push("</div>",
- "<div class='ace_line' style='height:",
- this.config.lineHeight, "px",
- "'>"
- );
- }
-
- split ++;
- screenColumn = 0;
- splitChars = splits[split] || Number.MAX_VALUE;
- }
- if (value.length != 0) {
- chars += value.length;
- screenColumn = self.$renderToken(
- stringBuilder, screenColumn, token, value
- );
- }
- }
- }
-
- if (this.showInvisibles) {
- if (lastRow !== this.session.getLength() - 1)
- stringBuilder.push("<span class='ace_invisible'>" + this.EOL_CHAR + "</span>");
- else
- stringBuilder.push("<span class='ace_invisible'>" + this.EOF_CHAR + "</span>");
- }
- if (!onlyContents)
- stringBuilder.push("</div>");
- };
-
- this.$renderLine = function(stringBuilder, row, tokens, onlyContents) {
- // Check if the line to render is folded or not. If not, things are
- // simple, otherwise, we need to fake some things...
- if (!this.session.isRowFolded(row)) {
- var splits = this.session.getRowSplitData(row);
- this.$renderLineCore(stringBuilder, row, tokens, splits, onlyContents);
- } else {
- this.$renderFoldLine(stringBuilder, row, tokens, onlyContents);
- }
- };
-
- this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
- var session = this.session,
- foldLine = session.getFoldLine(row),
- renderTokens = [];
-
- function addTokens(tokens, from, to) {
- var idx = 0, col = 0;
- while ((col + tokens[idx].value.length) < from) {
- col += tokens[idx].value.length;
- idx++;
-
- if (idx == tokens.length) {
- return;
- }
- }
- if (col != from) {
- var value = tokens[idx].value.substring(from - col);
- // Check if the token value is longer then the from...to spacing.
- if (value.length > (to - from)) {
- value = value.substring(0, to - from);
- }
-
- renderTokens.push({
- type: tokens[idx].type,
- value: value
- });
-
- col = from + value.length;
- idx += 1;
- }
-
- while (col < to) {
- var value = tokens[idx].value;
- if (value.length + col > to) {
- value = value.substring(0, to - col);
- }
- renderTokens.push({
- type: tokens[idx].type,
- value: value
- });
- col += value.length;
- idx += 1;
- }
- }
-
- foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
- if (placeholder) {
- renderTokens.push({
- type: "fold",
- value: placeholder
- });
- } else {
- if (isNewRow)
- tokens = this.session.getTokens(row);
-
- if (tokens.length)
- addTokens(tokens, lastColumn, column);
- }
- }.bind(this), foldLine.end.row, this.session.getLine(foldLine.end.row).length);
-
- // TODO: Build a fake splits array!
- var splits = this.session.$useWrapMode?this.session.$wrapData[row]:null;
- this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
- };
-
- this.$useLineGroups = function() {
- // For the updateLines function to work correctly, it's important that the
- // child nodes of this.element correspond on a 1-to-1 basis to rows in the
- // document (as distinct from lines on the screen). For sessions that are
- // wrapped, this means we need to add a layer to the node hierarchy (tagged
- // with the class name ace_line_group).
- return this.session.getUseWrapMode();
- };
-
- this.destroy = function() {
- clearInterval(this.$pollSizeChangesTimer);
- if (this.$measureNode)
- this.$measureNode.parentNode.removeChild(this.$measureNode);
- delete this.$measureNode;
- };
-
- }).call(Text.prototype);
-
- exports.Text = Text;
-
- });
-
- ace.define('ace/layer/cursor', ['require', 'exports', 'module' , 'ace/lib/dom'], function(require, exports, module) {
-
-
- var dom = require("../lib/dom");
-
- var Cursor = function(parentEl) {
- this.element = dom.createElement("div");
- this.element.className = "ace_layer ace_cursor-layer";
- parentEl.appendChild(this.element);
-
- this.isVisible = false;
-
- this.cursors = [];
- this.cursor = this.addCursor();
- };
-
- (function() {
-
- this.$padding = 0;
- this.setPadding = function(padding) {
- this.$padding = padding;
- };
-
- this.setSession = function(session) {
- this.session = session;
- };
-
- this.addCursor = function() {
- var el = dom.createElement("div");
- var className = "ace_cursor";
- if (!this.isVisible)
- className += " ace_hidden";
- if (this.overwrite)
- className += " ace_overwrite";
-
- el.className = className;
- this.element.appendChild(el);
- this.cursors.push(el);
- return el;
- };
-
- this.removeCursor = function() {
- if (this.cursors.length > 1) {
- var el = this.cursors.pop();
- el.parentNode.removeChild(el);
- return el;
- }
- };
-
- this.hideCursor = function() {
- this.isVisible = false;
- for (var i = this.cursors.length; i--; )
- dom.addCssClass(this.cursors[i], "ace_hidden");
- clearInterval(this.blinkId);
- };
-
- this.showCursor = function() {
- this.isVisible = true;
- for (var i = this.cursors.length; i--; )
- dom.removeCssClass(this.cursors[i], "ace_hidden");
-
- this.element.style.visibility = "";
- this.restartTimer();
- };
-
- this.restartTimer = function() {
- clearInterval(this.blinkId);
- if (!this.isVisible)
- return;
-
- var element = this.cursors.length == 1 ? this.cursor : this.element;
- this.blinkId = setInterval(function() {
- element.style.visibility = "hidden";
- setTimeout(function() {
- element.style.visibility = "";
- }, 400);
- }, 1000);
- };
-
- this.getPixelPosition = function(position, onScreen) {
- if (!this.config || !this.session) {
- return {
- left : 0,
- top : 0
- };
- }
-
- if (!position)
- position = this.session.selection.getCursor();
- var pos = this.session.documentToScreenPosition(position);
- var cursorLeft = Math.round(this.$padding +
- pos.column * this.config.characterWidth);
- var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
- this.config.lineHeight;
-
- return {
- left : cursorLeft,
- top : cursorTop
- };
- };
-
- this.update = function(config) {
- this.config = config;
-
- if (this.session.selectionMarkerCount > 0) {
- var selections = this.session.$selectionMarkers;
- var i = 0, sel, cursorIndex = 0;
-
- for (var i = selections.length; i--; ) {
- sel = selections[i];
- var pixelPos = this.getPixelPosition(sel.cursor, true);
-
- var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
-
- style.left = pixelPos.left + "px";
- style.top = pixelPos.top + "px";
- style.width = config.characterWidth + "px";
- style.height = config.lineHeight + "px";
- }
- if (cursorIndex > 1)
- while (this.cursors.length > cursorIndex)
- this.removeCursor();
- } else {
- var pixelPos = this.getPixelPosition(null, true);
- var style = this.cursor.style;
- style.left = pixelPos.left + "px";
- style.top = pixelPos.top + "px";
- style.width = config.characterWidth + "px";
- style.height = config.lineHeight + "px";
-
- while (this.cursors.length > 1)
- this.removeCursor();
- }
-
- var overwrite = this.session.getOverwrite();
- if (overwrite != this.overwrite)
- this.$setOverite(overwrite);
-
- // cache for textarea and gutter highlight
- this.$pixelPos = pixelPos;
-
- this.restartTimer();
- };
-
- this.$setOverite = function(overwrite) {
- this.overwrite = overwrite;
- for (var i = this.cursors.length; i--; ) {
- if (overwrite)
- dom.addCssClass(this.cursors[i], "ace_overwrite");
- else
- dom.removeCssClass(this.cursors[i], "ace_overwrite");
- }
- };
-
- this.destroy = function() {
- clearInterval(this.blinkId);
- }
-
- }).call(Cursor.prototype);
-
- exports.Cursor = Cursor;
-
- });
-
- ace.define('ace/scrollbar', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/dom', 'ace/lib/event', 'ace/lib/event_emitter'], function(require, exports, module) {
-
-
- var oop = require("./lib/oop");
- var dom = require("./lib/dom");
- var event = require("./lib/event");
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
-
- /**
- * new ScrollBar(parent)
- * - parent (DOMElement): A DOM element
- *
- * Creates a new `ScrollBar`. `parent` is the owner of the scroll bar.
- *
- **/
- var ScrollBar = function(parent) {
- this.element = dom.createElement("div");
- this.element.className = "ace_sb";
-
- this.inner = dom.createElement("div");
- this.element.appendChild(this.inner);
-
- parent.appendChild(this.element);
-
- // in OSX lion the scrollbars appear to have no width. In this case resize
- // the to show the scrollbar but still pretend that the scrollbar has a width
- // of 0px
- // in Firefox 6+ scrollbar is hidden if element has the same width as scrollbar
- // make element a little bit wider to retain scrollbar when page is zoomed
- this.width = dom.scrollbarWidth(parent.ownerDocument);
- this.element.style.width = (this.width || 15) + 5 + "px";
-
- event.addListener(this.element, "scroll", this.onScroll.bind(this));
- };
-
- (function() {
- oop.implement(this, EventEmitter);
- this.onScroll = function() {
- this._emit("scroll", {data: this.element.scrollTop});
- };
- this.getWidth = function() {
- return this.width;
- };
- this.setHeight = function(height) {
- this.element.style.height = height + "px";
- };
- this.setInnerHeight = function(height) {
- this.inner.style.height = height + "px";
- };
- // TODO: on chrome 17+ after for small zoom levels after this function
- // this.element.scrollTop != scrollTop which makes page to scroll up.
- this.setScrollTop = function(scrollTop) {
- this.element.scrollTop = scrollTop;
- };
-
- }).call(ScrollBar.prototype);
-
- exports.ScrollBar = ScrollBar;
- });
-
- ace.define('ace/renderloop', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
-
-
- var event = require("./lib/event");
-
- /** internal, hide
- * new RenderLoop(onRender, win)
- *
- *
- *
- **/
- var RenderLoop = function(onRender, win) {
- this.onRender = onRender;
- this.pending = false;
- this.changes = 0;
- this.window = win || window;
- };
-
- (function() {
-
- /** internal, hide
- * RenderLoop.schedule(change)
- * - change (Array):
- *
- *
- **/
- this.schedule = function(change) {
- //this.onRender(change);
- //return;
- this.changes = this.changes | change;
- if (!this.pending) {
- this.pending = true;
- var _self = this;
- event.nextTick(function() {
- _self.pending = false;
- var changes;
- while (changes = _self.changes) {
- _self.changes = 0;
- _self.onRender(changes);
- }
- }, this.window);
- }
- };
-
- }).call(RenderLoop.prototype);
-
- exports.RenderLoop = RenderLoop;
- });
- ace.define("text!ace/css/editor.css", [], ".ace_editor {\n" +
- " position: absolute;\n" +
- " overflow: hidden;\n" +
- " font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace;\n" +
- " font-size: 12px;\n" +
- "}\n" +
- "\n" +
- ".ace_scroller {\n" +
- " position: absolute;\n" +
- " overflow: hidden;\n" +
- "}\n" +
- "\n" +
- ".ace_content {\n" +
- " position: absolute;\n" +
- " box-sizing: border-box;\n" +
- " -moz-box-sizing: border-box;\n" +
- " -webkit-box-sizing: border-box;\n" +
- " cursor: text;\n" +
- "}\n" +
- "\n" +
- ".ace_gutter {\n" +
- " position: absolute;\n" +
- " overflow : hidden;\n" +
- " height: 100%;\n" +
- " width: auto;\n" +
- " cursor: default;\n" +
- " z-index: 4;\n" +
- "}\n" +
- "\n" +
- ".ace_scroller.horscroll {\n" +
- " box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;\n" +
- "}\n" +
- "\n" +
- ".ace_gutter-cell {\n" +
- " padding-left: 19px;\n" +
- " padding-right: 6px;\n" +
- "}\n" +
- "\n" +
- ".ace_gutter-cell.ace_error {\n" +
- " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTQ4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTU4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBMjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBMzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PkgXxbAAAAJbSURBVHjapFNNaBNBFH4zs5vdZLP5sQmNpT82QY209heh1ioWisaDRcSKF0WKJ0GQnrzrxasHsR6EnlrwD0TagxJabaVEpFYxLWlLSS822tr87m66ccfd2GKyVhA6MMybgfe97/vmPUQphd0sZjto9XIn9OOsvlu2nkqRzVU+6vvlzPf8W6bk8dxQ0NPbxAALgCgg2JkaQuhzQau/El0zbmUA7U0Es8v2CiYmKQJHGO1QICCLoqilMhkmurDAyapKgqItezi/USRdJqEYY4D5jCy03ht2yMkkvL91jTTX10qzyyu2hruPRN7jgbH+EOsXcMLgYiThEgAMhABW85oqy1DXdRIdvP1AHJ2acQXvDIrVHcdQNrEKNYSVMSZGMjEzIIAwDXIo+6G/FxcGnzkC3T2oMhLjre49sBB+RRcHLqdafK6sYdE/GGBwU1VpFNj0aN8pJbe+BkZyevUrvLl6Xmm0W9IuTc0DxrDNAJd5oEvI/KRsNC3bQyNjPO9yQ1YHcfj2QvfQc/5TUhJTBc2iM0U7AWDQtc1nJHvD/cfO2s7jaGkiTEfa/Ep8coLu7zmNmh8+dc5lZDuUeFAGUNA/OY6JVaypQ0vjr7XYjUvJM37vt+j1vuTK5DgVfVUoTjVe+y3/LxMxY2GgU+CSLy4cpfsYorRXuXIOi0Vt40h67uZFTdIo6nLaZcwUJWAzwNS0tBnqqKzQDnjdG/iPyZxo46HaKUpbvYkj8qYRTZsBhge+JHhZyh0x9b95JqjVJkT084kZIPwu/mPWqPgfQ5jXh2+92Ay7HedfAgwA6KDWafb4w3cAAAAASUVORK5CYII=\");\n" +
- " background-repeat: no-repeat;\n" +
- " background-position: 2px center;\n" +
- "}\n" +
- "\n" +
- ".ace_gutter-cell.ace_warning {\n" +
- " background-image: url(\"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==\");\n" +
- " background-repeat: no-repeat;\n" +
- " background-position: 2px center;\n" +
- "}\n" +
- "\n" +
- ".ace_gutter-cell.ace_info {\n" +
- " background-image: url(\"data:image/gif;base64,R0lGODlhEAAQAMQAAAAAAEFBQVJSUl5eXmRkZGtra39/f4WFhYmJiZGRkaampry8vMPDw8zMzNXV1dzc3OTk5Orq6vDw8P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAkAABQALAAAAAAQABAAAAUuICWOZGmeaBml5XGwFCQSBGyXRSAwtqQIiRuiwIM5BoYVbEFIyGCQoeJGrVptIQA7\");\n" +
- " background-repeat: no-repeat;\n" +
- " background-position: 2px center;\n" +
- "}\n" +
- "\n" +
- ".ace_editor .ace_sb {\n" +
- " position: absolute;\n" +
- " overflow-x: hidden;\n" +
- " overflow-y: scroll;\n" +
- " right: 0;\n" +
- "}\n" +
- "\n" +
- ".ace_editor .ace_sb div {\n" +
- " position: absolute;\n" +
- " width: 1px;\n" +
- " left: 0;\n" +
- "}\n" +
- "\n" +
- ".ace_editor .ace_print_margin_layer {\n" +
- " z-index: 0;\n" +
- " position: absolute;\n" +
- " overflow: hidden;\n" +
- " margin: 0;\n" +
- " left: 0;\n" +
- " height: 100%;\n" +
- " width: 100%;\n" +
- "}\n" +
- "\n" +
- ".ace_editor .ace_print_margin {\n" +
- " position: absolute;\n" +
- " height: 100%;\n" +
- "}\n" +
- "\n" +
- ".ace_editor > textarea {\n" +
- " position: absolute;\n" +
- " z-index: 0;\n" +
- " width: 0.5em;\n" +
- " height: 1em;\n" +
- " opacity: 0;\n" +
- " background: transparent;\n" +
- " appearance: none;\n" +
- " -moz-appearance: none;\n" +
- " border: none;\n" +
- " resize: none;\n" +
- " outline: none;\n" +
- " overflow: hidden;\n" +
- "}\n" +
- "\n" +
- ".ace_editor > textarea.ace_composition {\n" +
- " background: #fff;\n" +
- " color: #000;\n" +
- " z-index: 1000;\n" +
- " opacity: 1;\n" +
- " border: solid lightgray 1px;\n" +
- " margin: -1px\n" +
- "}\n" +
- "\n" +
- ".ace_layer {\n" +
- " z-index: 1;\n" +
- " position: absolute;\n" +
- " overflow: hidden;\n" +
- " white-space: nowrap;\n" +
- " height: 100%;\n" +
- " width: 100%;\n" +
- " box-sizing: border-box;\n" +
- " -moz-box-sizing: border-box;\n" +
- " -webkit-box-sizing: border-box;\n" +
- " /* setting pointer-events: auto; on node under the mouse, which changes\n" +
- " during scroll, will break mouse wheel scrolling in Safari */\n" +
- " pointer-events: none;\n" +
- "}\n" +
- "\n" +
- ".ace_gutter .ace_layer {\n" +
- " position: relative;\n" +
- " min-width: 40px;\n" +
- " width: auto;\n" +
- " text-align: right;\n" +
- " pointer-events: auto;\n" +
- "}\n" +
- "\n" +
- ".ace_text-layer {\n" +
- " color: black;\n" +
- " font: inherit !important;\n" +
- "}\n" +
- "\n" +
- ".ace_cjk {\n" +
- " display: inline-block;\n" +
- " text-align: center;\n" +
- "}\n" +
- "\n" +
- ".ace_cursor-layer {\n" +
- " z-index: 4;\n" +
- "}\n" +
- "\n" +
- ".ace_cursor {\n" +
- " z-index: 4;\n" +
- " position: absolute;\n" +
- "}\n" +
- "\n" +
- ".ace_cursor.ace_hidden {\n" +
- " opacity: 0.2;\n" +
- "}\n" +
- "\n" +
- ".ace_editor.multiselect .ace_cursor {\n" +
- " border-left-width: 1px;\n" +
- "}\n" +
- "\n" +
- ".ace_line {\n" +
- " white-space: nowrap;\n" +
- "}\n" +
- "\n" +
- ".ace_marker-layer .ace_step {\n" +
- " position: absolute;\n" +
- " z-index: 3;\n" +
- "}\n" +
- "\n" +
- ".ace_marker-layer .ace_selection {\n" +
- " position: absolute;\n" +
- " z-index: 5;\n" +
- "}\n" +
- "\n" +
- ".ace_marker-layer .ace_bracket {\n" +
- " position: absolute;\n" +
- " z-index: 6;\n" +
- "}\n" +
- "\n" +
- ".ace_marker-layer .ace_active_line {\n" +
- " position: absolute;\n" +
- " z-index: 2;\n" +
- "}\n" +
- "\n" +
- ".ace_marker-layer .ace_selected_word {\n" +
- " position: absolute;\n" +
- " z-index: 4;\n" +
- " box-sizing: border-box;\n" +
- " -moz-box-sizing: border-box;\n" +
- " -webkit-box-sizing: border-box;\n" +
- "}\n" +
- "\n" +
- ".ace_line .ace_fold {\n" +
- " box-sizing: border-box;\n" +
- " -moz-box-sizing: border-box;\n" +
- " -webkit-box-sizing: border-box;\n" +
- "\n" +
- " display: inline-block;\n" +
- " height: 11px;\n" +
- " margin-top: -2px;\n" +
- " vertical-align: middle;\n" +
- "\n" +
- " background-image:\n" +
- " url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\n" +
- " url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%3AIDAT8%11c%FC%FF%FF%7F%18%03%1A%60%01%F2%3F%A0%891%80%04%FF%11-%F8%17%9BJ%E2%05%B1ZD%81v%26t%E7%80%F8%A3%82h%A12%1A%20%A3%01%02%0F%01%BA%25%06%00%19%C0%0D%AEF%D5%3ES%00%00%00%00IEND%AEB%60%82\");\n" +
- " background-repeat: no-repeat, repeat-x;\n" +
- " background-position: center center, top left;\n" +
- " color: transparent;\n" +
- "\n" +
- " border: 1px solid black;\n" +
- " -moz-border-radius: 2px;\n" +
- " -webkit-border-radius: 2px;\n" +
- " border-radius: 2px;\n" +
- "\n" +
- " cursor: pointer;\n" +
- " pointer-events: auto;\n" +
- "}\n" +
- "\n" +
- ".ace_dark .ace_fold {\n" +
- "}\n" +
- "\n" +
- ".ace_fold:hover{\n" +
- " background-image:\n" +
- " url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%11%00%00%00%09%08%06%00%00%00%D4%E8%C7%0C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%00%B5IDAT(%15%A5%91%3D%0E%02!%10%85ac%E1%05%D6%CE%D6%C6%CE%D2%E8%ED%CD%DE%C0%C6%D6N.%E0V%F8%3D%9Ca%891XH%C2%BE%D9y%3F%90!%E6%9C%C3%BFk%E5%011%C6-%F5%C8N%04%DF%BD%FF%89%DFt%83DN%60%3E%F3%AB%A0%DE%1A%5Dg%BE%10Q%97%1B%40%9C%A8o%10%8F%5E%828%B4%1B%60%87%F6%02%26%85%1Ch%1E%C1%2B%5Bk%FF%86%EE%B7j%09%9A%DA%9B%ACe%A3%F9%EC%DA!9%B4%D5%A6%81%86%86%98%CC%3C%5B%40%FA%81%B3%E9%CB%23%94%C16Azo%05%D4%E1%C1%95a%3B%8A'%A0%E8%CC%17%22%85%1D%BA%00%A2%FA%DC%0A%94%D1%D1%8D%8B%3A%84%17B%C7%60%1A%25Z%FC%8D%00%00%00%00IEND%AEB%60%82\"),\n" +
- " url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%007%08%06%00%00%00%C4%DD%80C%00%00%03%1EiCCPICC%20Profile%00%00x%01%85T%DFk%D3P%14%FE%DAe%9D%B0%E1%8B%3Ag%11%09%3Eh%91ndStC%9C%B6kW%BA%CDZ%EA6%B7!H%9B%A6m%5C%9A%C6%24%ED~%B0%07%D9%8Bo%3A%C5w%F1%07%3E%F9%07%0C%D9%83o%7B%92%0D%C6%14a%F8%AC%88%22L%F6%22%B3%9E%9B4M'S%03%B9%F7%BB%DF%F9%EE9'%E7%E4%5E%A0%F9qZ%D3%14%2F%0F%14USO%C5%C2%FC%C4%E4%14%DF%F2%01%5E%1CC%2B%FChM%8B%86%16J%26G%40%0F%D3%B2y%EF%B3%F3%0E%1E%C6lt%EEo%DF%AB%FEc%D5%9A%95%0C%11%F0%1C%20%BE%945%C4%22%E1Y%A0i%5C%D4t%13%E0%D6%89%EF%9D15%C2%CDLsX%A7%04%09%1Fg8oc%81%E1%8C%8D%23%96f45%40%9A%09%C2%07%C5B%3AK%B8%408%98i%E0%F3%0D%D8%CE%81%14%E4'%26%A9%92.%8B%3C%ABER%2F%E5dE%B2%0C%F6%F0%1Fs%83%F2_%B0%A8%94%E9%9B%AD%E7%10%8Dm%9A%19N%D1%7C%8A%DE%1F9%7Dp%8C%E6%00%D5%C1%3F_%18%BDA%B8%9DpX6%E3%A35~B%CD%24%AE%11%26%BD%E7%EEti%98%EDe%9A%97Y)%12%25%1C%24%BCbT%AE3li%E6%0B%03%89%9A%E6%D3%ED%F4P%92%B0%9F4%BF43Y%F3%E3%EDP%95%04%EB1%C5%F5%F6KF%F4%BA%BD%D7%DB%91%93%07%E35%3E%A7)%D6%7F%40%FE%BD%F7%F5r%8A%E5y%92%F0%EB%B4%1E%8D%D5%F4%5B%92%3AV%DB%DB%E4%CD%A6%23%C3%C4wQ%3F%03HB%82%8E%1Cd(%E0%91B%0Ca%9Ac%C4%AA%F8L%16%19%22J%A4%D2itTy%B28%D6%3B(%93%96%ED%1CGx%C9_%0E%B8%5E%16%F5%5B%B2%B8%F6%E0%FB%9E%DD%25%D7%8E%BC%15%85%C5%B7%A3%D8Q%ED%B5%81%E9%BA%B2%13%9A%1B%7Fua%A5%A3n%E17%B9%E5%9B%1Bm%AB%0B%08Q%FE%8A%E5%B1H%5Ee%CAO%82Q%D7u6%E6%90S%97%FCu%0B%CF2%94%EE%25v%12X%0C%BA%AC%F0%5E%F8*l%0AO%85%17%C2%97%BF%D4%C8%CE%DE%AD%11%CB%80q%2C%3E%AB%9ES%CD%C6%EC%25%D2L%D2%EBd%B8%BF%8A%F5B%C6%18%F9%901CZ%9D%BE%24M%9C%8A9%F2%DAP%0B'%06w%82%EB%E6%E2%5C%2F%D7%07%9E%BB%CC%5D%E1%FA%B9%08%AD.r%23%8E%C2%17%F5E%7C!%F0%BE3%BE%3E_%B7o%88a%A7%DB%BE%D3d%EB%A31Z%EB%BB%D3%91%BA%A2%B1z%94%8F%DB'%F6%3D%8E%AA%13%19%B2%B1%BE%B1~V%08%2B%B4%A2cjJ%B3tO%00%03%25mN%97%F3%05%93%EF%11%84%0B%7C%88%AE-%89%8F%ABbW%90O%2B%0Ao%99%0C%5E%97%0CI%AFH%D9.%B0%3B%8F%ED%03%B6S%D6%5D%E6i_s9%F3*p%E9%1B%FD%C3%EB.7U%06%5E%19%C0%D1s.%17%A03u%E4%09%B0%7C%5E%2C%EB%15%DB%1F%3C%9E%B7%80%91%3B%DBc%AD%3Dma%BA%8B%3EV%AB%DBt.%5B%1E%01%BB%0F%AB%D5%9F%CF%AA%D5%DD%E7%E4%7F%0Bx%A3%FC%06%A9%23%0A%D6%C2%A1_2%00%00%00%09pHYs%00%00%0B%13%00%00%0B%13%01%00%9A%9C%18%00%00%003IDAT8%11c%FC%FF%FF%7F%3E%03%1A%60%01%F2%3F%A3%891%80%04%FFQ%26%F8w%C0%B43%A1%DB%0C%E2%8F%0A%A2%85%CAh%80%8C%06%08%3C%04%E8%96%18%00%A3S%0D%CD%CF%D8%C1%9D%00%00%00%00IEND%AEB%60%82\");\n" +
- " background-repeat: no-repeat, repeat-x;\n" +
- " background-position: center center, top left;\n" +
- "}\n" +
- "\n" +
- ".ace_dragging .ace_content {\n" +
- " cursor: move;\n" +
- "}\n" +
- "\n" +
- ".ace_folding-enabled > .ace_gutter-cell {\n" +
- " padding-right: 13px;\n" +
- "}\n" +
- "\n" +
- ".ace_fold-widget {\n" +
- " box-sizing: border-box;\n" +
- " -moz-box-sizing: border-box;\n" +
- " -webkit-box-sizing: border-box;\n" +
- "\n" +
- " margin: 0 -12px 1px 1px;\n" +
- " display: inline-block;\n" +
- " height: 14px;\n" +
- " width: 11px;\n" +
- " vertical-align: text-bottom;\n" +
- "\n" +
- " background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82\");\n" +
- " background-repeat: no-repeat;\n" +
- " background-position: center 5px;\n" +
- "\n" +
- " border-radius: 3px;\n" +
- "}\n" +
- "\n" +
- ".ace_fold-widget.end {\n" +
- " background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82\");\n" +
- "}\n" +
- "\n" +
- ".ace_fold-widget.closed {\n" +
- " background-image: url(\"data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82\");\n" +
- "}\n" +
- "\n" +
- ".ace_fold-widget:hover {\n" +
- " border: 1px solid rgba(0, 0, 0, 0.3);\n" +
- " background-color: rgba(255, 255, 255, 0.2);\n" +
- " -moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);\n" +
- " -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n" +
- " -webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);\n" +
- " -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n" +
- " box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.7);\n" +
- " box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);\n" +
- " background-position: center 4px;\n" +
- "}\n" +
- "\n" +
- ".ace_fold-widget:active {\n" +
- " border: 1px solid rgba(0, 0, 0, 0.4);\n" +
- " background-color: rgba(0, 0, 0, 0.05);\n" +
- " -moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255);\n" +
- " -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n" +
- " -webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255);\n" +
- " -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n" +
- " box-shadow:inset 0 1px 1px rgba(255, 255, 255);\n" +
- " box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);\n" +
- "}\n" +
- "\n" +
- ".ace_fold-widget.invalid {\n" +
- " background-color: #FFB4B4;\n" +
- " border-color: #DE5555;\n" +
- "}\n" +
- "\n" +
- ".ace_fade-fold-widgets .ace_fold-widget {\n" +
- " -moz-transition: opacity 0.4s ease 0.05s;\n" +
- " -webkit-transition: opacity 0.4s ease 0.05s;\n" +
- " -o-transition: opacity 0.4s ease 0.05s;\n" +
- " -ms-transition: opacity 0.4s ease 0.05s;\n" +
- " transition: opacity 0.4s ease 0.05s;\n" +
- " opacity: 0;\n" +
- "}\n" +
- "\n" +
- ".ace_fade-fold-widgets:hover .ace_fold-widget {\n" +
- " -moz-transition: opacity 0.05s ease 0.05s;\n" +
- " -webkit-transition: opacity 0.05s ease 0.05s;\n" +
- " -o-transition: opacity 0.05s ease 0.05s;\n" +
- " -ms-transition: opacity 0.05s ease 0.05s;\n" +
- " transition: opacity 0.05s ease 0.05s;\n" +
- " opacity:1;\n" +
- "}\n" +
- "");
-
- ace.define('ace/multi_select', ['require', 'exports', 'module' , 'ace/range_list', 'ace/range', 'ace/selection', 'ace/mouse/multi_select_handler', 'ace/lib/event', 'ace/commands/multi_select_commands', 'ace/search', 'ace/edit_session', 'ace/editor'], function(require, exports, module) {
-
- var RangeList = require("./range_list").RangeList;
- var Range = require("./range").Range;
- var Selection = require("./selection").Selection;
- var onMouseDown = require("./mouse/multi_select_handler").onMouseDown;
- var event = require("./lib/event");
- var commands = require("./commands/multi_select_commands");
- exports.commands = commands.defaultCommands.concat(commands.multiSelectCommands);
-
- // Todo: session.find or editor.findVolatile that returns range
- var Search = require("./search").Search;
- var search = new Search();
-
- function find(session, needle, dir) {
- search.$options.wrap = true;
- search.$options.needle = needle;
- search.$options.backwards = dir == -1;
- return search.find(session);
- }
-
- // extend EditSession
- var EditSession = require("./edit_session").EditSession;
- (function() {
- this.getSelectionMarkers = function() {
- return this.$selectionMarkers;
- };
- }).call(EditSession.prototype);
-
- // extend Selection
- (function() {
- // list of ranges in reverse addition order
- this.ranges = null;
-
- // automatically sorted list of ranges
- this.rangeList = null;
- this.addRange = function(range, $blockChangeEvents) {
- if (!range)
- return;
-
- if (!this.inMultiSelectMode && this.rangeCount == 0) {
- var oldRange = this.toOrientedRange();
- if (range.intersects(oldRange))
- return $blockChangeEvents || this.fromOrientedRange(range);
-
- this.rangeList.add(oldRange);
- this.$onAddRange(oldRange);
- }
-
- if (!range.cursor)
- range.cursor = range.end;
-
- var removed = this.rangeList.add(range);
-
- this.$onAddRange(range);
-
- if (removed.length)
- this.$onRemoveRange(removed);
-
- if (this.rangeCount > 1 && !this.inMultiSelectMode) {
- this._emit("multiSelect");
- this.inMultiSelectMode = true;
- this.session.$undoSelect = false;
- this.rangeList.attach(this.session);
- }
-
- return $blockChangeEvents || this.fromOrientedRange(range);
- };
-
- this.toSingleRange = function(range) {
- range = range || this.ranges[0];
- var removed = this.rangeList.removeAll();
- if (removed.length)
- this.$onRemoveRange(removed);
-
- range && this.fromOrientedRange(range);
- };
- this.substractPoint = function(pos) {
- var removed = this.rangeList.substractPoint(pos);
- if (removed) {
- this.$onRemoveRange(removed);
- return removed[0];
- }
- };
- this.mergeOverlappingRanges = function() {
- var removed = this.rangeList.merge();
- if (removed.length)
- this.$onRemoveRange(removed);
- else if(this.ranges[0])
- this.fromOrientedRange(this.ranges[0]);
- };
-
- this.$onAddRange = function(range) {
- this.rangeCount = this.rangeList.ranges.length;
- this.ranges.unshift(range);
- this._emit("addRange", {range: range});
- };
-
- this.$onRemoveRange = function(removed) {
- this.rangeCount = this.rangeList.ranges.length;
- if (this.rangeCount == 1 && this.inMultiSelectMode) {
- var lastRange = this.rangeList.ranges.pop();
- removed.push(lastRange);
- this.rangeCount = 0;
- }
-
- for (var i = removed.length; i--; ) {
- var index = this.ranges.indexOf(removed[i]);
- this.ranges.splice(index, 1);
- }
-
- this._emit("removeRange", {ranges: removed});
-
- if (this.rangeCount == 0 && this.inMultiSelectMode) {
- this.inMultiSelectMode = false;
- this._emit("singleSelect");
- this.session.$undoSelect = true;
- this.rangeList.detach(this.session);
- }
-
- lastRange = lastRange || this.ranges[0];
- if (lastRange && !lastRange.isEqual(this.getRange()))
- this.fromOrientedRange(lastRange);
- };
-
- // adds multicursor support to selection
- this.$initRangeList = function() {
- if (this.rangeList)
- return;
-
- this.rangeList = new RangeList();
- this.ranges = [];
- this.rangeCount = 0;
- };
-
- this.getAllRanges = function() {
- return this.rangeList.ranges.concat();
- };
-
- this.splitIntoLines = function () {
- if (this.rangeCount > 1) {
- var ranges = this.rangeList.ranges;
- var lastRange = ranges[ranges.length - 1];
- var range = Range.fromPoints(ranges[0].start, lastRange.end);
-
- this.toSingleRange();
- this.setSelectionRange(range, lastRange.cursor == lastRange.start);
- } else {
- var range = this.getRange();
- var startRow = range.start.row;
- var endRow = range.end.row;
- if (startRow == endRow)
- return;
-
- var rectSel = [];
- var r = this.getLineRange(startRow, true);
- r.start.column = range.start.column;
- rectSel.push(r);
-
- for (var i = startRow + 1; i < endRow; i++)
- rectSel.push(this.getLineRange(i, true));
-
- r = this.getLineRange(endRow, true);
- r.end.column = range.end.column;
- rectSel.push(r);
-
- rectSel.forEach(this.addRange, this);
- }
- };
-
- this.toggleBlockSelection = function () {
- if (this.rangeCount > 1) {
- var ranges = this.rangeList.ranges;
- var lastRange = ranges[ranges.length - 1];
- var range = Range.fromPoints(ranges[0].start, lastRange.end);
-
- this.toSingleRange();
- this.setSelectionRange(range, lastRange.cursor == lastRange.start);
- } else {
- var cursor = this.session.documentToScreenPosition(this.selectionLead);
- var anchor = this.session.documentToScreenPosition(this.selectionAnchor);
-
- var rectSel = this.rectangularRangeBlock(cursor, anchor);
- rectSel.forEach(this.addRange, this);
- }
- };
- this.rectangularRangeBlock = function(screenCursor, screenAnchor, includeEmptyLines) {
- var rectSel = [];
-
- var xBackwards = screenCursor.column < screenAnchor.column;
- if (xBackwards) {
- var startColumn = screenCursor.column;
- var endColumn = screenAnchor.column;
- } else {
- var startColumn = screenAnchor.column;
- var endColumn = screenCursor.column;
- }
-
- var yBackwards = screenCursor.row < screenAnchor.row;
- if (yBackwards) {
- var startRow = screenCursor.row;
- var endRow = screenAnchor.row;
- } else {
- var startRow = screenAnchor.row;
- var endRow = screenCursor.row;
- }
-
- if (startColumn < 0)
- startColumn = 0;
- if (startRow < 0)
- startRow = 0;
-
- if (startRow == endRow)
- includeEmptyLines = true;
-
- for (var row = startRow; row <= endRow; row++) {
- var range = Range.fromPoints(
- this.session.screenToDocumentPosition(row, startColumn),
- this.session.screenToDocumentPosition(row, endColumn)
- );
- if (range.isEmpty()) {
- if (docEnd && isSamePoint(range.end, docEnd))
- break;
- var docEnd = range.end;
- }
- range.cursor = xBackwards ? range.start : range.end;
- rectSel.push(range);
- }
-
- if (yBackwards)
- rectSel.reverse();
-
- if (!includeEmptyLines) {
- var end = rectSel.length - 1;
- while (rectSel[end].isEmpty() && end > 0)
- end--;
- if (end > 0) {
- var start = 0;
- while (rectSel[start].isEmpty())
- start++;
- }
- for (var i = end; i >= start; i--) {
- if (rectSel[i].isEmpty())
- rectSel.splice(i, 1);
- }
- }
-
- return rectSel;
- };
- }).call(Selection.prototype);
-
- // extend Editor
- var Editor = require("./editor").Editor;
- (function() {
-
- /** extension
- * Editor.updateSelectionMarkers()
- *
- * Updates the cursor and marker layers.
- **/
- this.updateSelectionMarkers = function() {
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
- this.addSelectionMarker = function(orientedRange) {
- if (!orientedRange.cursor)
- orientedRange.cursor = orientedRange.end;
-
- var style = this.getSelectionStyle();
- orientedRange.marker = this.session.addMarker(orientedRange, "ace_selection", style);
-
- this.session.$selectionMarkers.push(orientedRange);
- this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
- return orientedRange;
- };
- this.removeSelectionMarker = function(range) {
- if (!range.marker)
- return;
- this.session.removeMarker(range.marker);
- var index = this.session.$selectionMarkers.indexOf(range);
- if (index != -1)
- this.session.$selectionMarkers.splice(index, 1);
- this.session.selectionMarkerCount = this.session.$selectionMarkers.length;
- };
-
- this.removeSelectionMarkers = function(ranges) {
- var markerList = this.session.$selectionMarkers;
- for (var i = ranges.length; i--; ) {
- var range = ranges[i];
- if (!range.marker)
- continue;
- this.session.removeMarker(range.marker);
- var index = markerList.indexOf(range);
- if (index != -1)
- markerList.splice(index, 1);
- }
- this.session.selectionMarkerCount = markerList.length;
- };
-
- this.$onAddRange = function(e) {
- this.addSelectionMarker(e.range);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onRemoveRange = function(e) {
- this.removeSelectionMarkers(e.ranges);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onMultiSelect = function(e) {
- if (this.inMultiSelectMode)
- return;
- this.inMultiSelectMode = true;
-
- this.setStyle("multiselect");
- this.keyBinding.addKeyboardHandler(commands.keyboardHandler);
- this.commands.on("exec", this.$onMultiSelectExec);
-
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onSingleSelect = function(e) {
- if (this.session.multiSelect.inVirtualMode)
- return;
- this.inMultiSelectMode = false;
-
- this.unsetStyle("multiselect");
- this.keyBinding.removeKeyboardHandler(commands.keyboardHandler);
-
- this.commands.removeEventListener("exec", this.$onMultiSelectExec);
- this.renderer.updateCursor();
- this.renderer.updateBackMarkers();
- };
-
- this.$onMultiSelectExec = function(e) {
- var command = e.command;
- var editor = e.editor;
- if (!editor.multiSelect)
- return;
- if (!command.multiSelectAction) {
- command.exec(editor, e.args || {});
- editor.multiSelect.addRange(editor.multiSelect.toOrientedRange());
- editor.multiSelect.mergeOverlappingRanges();
- } else if (command.multiSelectAction == "forEach") {
- editor.forEachSelection(command, e.args);
- } else if (command.multiSelectAction == "single") {
- editor.exitMultiSelectMode();
- command.exec(editor, e.args || {});
- } else {
- command.multiSelectAction(editor, e.args || {});
- }
- e.preventDefault();
- };
- this.forEachSelection = function(cmd, args) {
- if (this.inVirtualSelectionMode)
- return;
-
- var session = this.session;
- var selection = this.selection;
- var rangeList = selection.rangeList;
-
- var reg = selection._eventRegistry;
- selection._eventRegistry = {};
-
- var tmpSel = new Selection(session);
- this.inVirtualSelectionMode = true;
- for (var i = rangeList.ranges.length; i--;) {
- tmpSel.fromOrientedRange(rangeList.ranges[i]);
- this.selection = session.selection = tmpSel;
- cmd.exec(this, args || {});
- tmpSel.toOrientedRange(rangeList.ranges[i]);
- }
- tmpSel.detach();
-
- this.selection = session.selection = selection;
- this.inVirtualSelectionMode = false;
- selection._eventRegistry = reg;
- selection.mergeOverlappingRanges();
-
- this.onCursorChange();
- this.onSelectionChange();
- };
- this.exitMultiSelectMode = function() {
- if (this.inVirtualSelectionMode)
- return;
- this.multiSelect.toSingleRange();
- };
-
- this.getCopyText = function() {
- var text = "";
- if (this.inMultiSelectMode) {
- var ranges = this.multiSelect.rangeList.ranges;
- text = [];
- for (var i = 0; i < ranges.length; i++) {
- text.push(this.session.getTextRange(ranges[i]));
- }
- text = text.join(this.session.getDocument().getNewLineCharacter());
- } else if (!this.selection.isEmpty()) {
- text = this.session.getTextRange(this.getSelectionRange());
- }
-
- return text;
- };
-
- this.onPaste = function(text) {
- this._emit("paste", text);
- if (!this.inMultiSelectMode)
- return this.insert(text);
-
- var lines = text.split(/\r\n|\r|\n/);
- var ranges = this.selection.rangeList.ranges;
-
- if (lines.length > ranges.length || (lines.length <= 2 || !lines[1]))
- return this.commands.exec("insertstring", this, text);
-
- for (var i = ranges.length; i--; ) {
- var range = ranges[i];
- if (!range.isEmpty())
- this.session.remove(range);
-
- this.session.insert(range.start, lines[i]);
- }
- };
- this.findAll = function(needle, options, additive) {
- options = options || {};
- options.needle = needle || options.needle;
- this.$search.set(options);
-
- var ranges = this.$search.findAll(this.session);
- if (!ranges.length)
- return 0;
-
- this.$blockScrolling += 1;
- var selection = this.multiSelect;
-
- if (!additive)
- selection.toSingleRange(ranges[0]);
-
- for (var i = ranges.length; i--; )
- selection.addRange(ranges[i], true);
-
- this.$blockScrolling -= 1;
-
- return ranges.length;
- };
-
- // commands
- /** extension
- * Editor.selectMoreLines(dir, skip)
- * - dir (Number): The direction of lines to select: -1 for up, 1 for down
- * - skip (Boolean): If `true`, removes the active selection range
- *
- * Adds a cursor above or below the active cursor.
- **/
- this.selectMoreLines = function(dir, skip) {
- var range = this.selection.toOrientedRange();
- var isBackwards = range.cursor == range.end;
-
- var screenLead = this.session.documentToScreenPosition(range.cursor);
- if (this.selection.$desiredColumn)
- screenLead.column = this.selection.$desiredColumn;
-
- var lead = this.session.screenToDocumentPosition(screenLead.row + dir, screenLead.column);
-
- if (!range.isEmpty()) {
- var screenAnchor = this.session.documentToScreenPosition(isBackwards ? range.end : range.start);
- var anchor = this.session.screenToDocumentPosition(screenAnchor.row + dir, screenAnchor.column);
- } else {
- var anchor = lead;
- }
-
- if (isBackwards) {
- var newRange = Range.fromPoints(lead, anchor);
- newRange.cursor = newRange.start;
- } else {
- var newRange = Range.fromPoints(anchor, lead);
- newRange.cursor = newRange.end;
- }
-
- newRange.desiredColumn = screenLead.column;
- if (!this.selection.inMultiSelectMode) {
- this.selection.addRange(range);
- } else {
- if (skip)
- var toRemove = range.cursor;
- }
-
- this.selection.addRange(newRange);
- if (toRemove)
- this.selection.substractPoint(toRemove);
- };
- this.transposeSelections = function(dir) {
- var session = this.session;
- var sel = session.multiSelect;
- var all = sel.ranges;
-
- for (var i = all.length; i--; ) {
- var range = all[i];
- if (range.isEmpty()) {
- var tmp = session.getWordRange(range.start.row, range.start.column);
- range.start.row = tmp.start.row;
- range.start.column = tmp.start.column;
- range.end.row = tmp.end.row;
- range.end.column = tmp.end.column;
- }
- }
- sel.mergeOverlappingRanges();
-
- var words = [];
- for (var i = all.length; i--; ) {
- var range = all[i];
- words.unshift(session.getTextRange(range));
- }
-
- if (dir < 0)
- words.unshift(words.pop());
- else
- words.push(words.shift());
-
- for (var i = all.length; i--; ) {
- var range = all[i];
- var tmp = range.clone();
- session.replace(range, words[i]);
- range.start.row = tmp.start.row;
- range.start.column = tmp.start.column;
- }
- }
-
- /** extension
- * Editor.selectMore(dir, skip)
- * - dir (Number): The direction of lines to select: -1 for up, 1 for down
- * - skip (Boolean): If `true`, removes the active selection range
- *
- * Finds the next occurence of text in an active selection and adds it to the selections.
- **/
- this.selectMore = function (dir, skip) {
- var session = this.session;
- var sel = session.multiSelect;
-
- var range = sel.toOrientedRange();
- if (range.isEmpty()) {
- var range = session.getWordRange(range.start.row, range.start.column);
- range.cursor = range.end;
- this.multiSelect.addRange(range);
- }
- var needle = session.getTextRange(range);
-
- var newRange = find(session, needle, dir);
- if (newRange) {
- newRange.cursor = dir == -1 ? newRange.start : newRange.end;
- this.multiSelect.addRange(newRange);
- }
- if (skip)
- this.multiSelect.substractPoint(range.cursor);
- };
- }).call(Editor.prototype);
-
-
- function isSamePoint(p1, p2) {
- return p1.row == p2.row && p1.column == p2.column;
- }
-
- // patch
- // adds multicursor support to a session
- exports.onSessionChange = function(e) {
- var session = e.session;
- if (!session.multiSelect) {
- session.$selectionMarkers = [];
- session.selection.$initRangeList();
- session.multiSelect = session.selection;
- }
- this.multiSelect = session.multiSelect;
-
- var oldSession = e.oldSession;
- if (oldSession) {
- // todo use events
- if (oldSession.multiSelect && oldSession.multiSelect.editor == this)
- oldSession.multiSelect.editor = null;
-
- session.multiSelect.removeEventListener("addRange", this.$onAddRange);
- session.multiSelect.removeEventListener("removeRange", this.$onRemoveRange);
- session.multiSelect.removeEventListener("multiSelect", this.$onMultiSelect);
- session.multiSelect.removeEventListener("singleSelect", this.$onSingleSelect);
- }
-
- session.multiSelect.on("addRange", this.$onAddRange);
- session.multiSelect.on("removeRange", this.$onRemoveRange);
- session.multiSelect.on("multiSelect", this.$onMultiSelect);
- session.multiSelect.on("singleSelect", this.$onSingleSelect);
-
- // this.$onSelectionChange = this.onSelectionChange.bind(this);
-
- if (this.inMultiSelectMode != session.selection.inMultiSelectMode) {
- if (session.selection.inMultiSelectMode)
- this.$onMultiSelect();
- else
- this.$onSingleSelect();
- }
- };
-
- // MultiSelect(editor)
- // adds multiple selection support to the editor
- // (note: should be called only once for each editor instance)
- function MultiSelect(editor) {
- editor.$onAddRange = editor.$onAddRange.bind(editor);
- editor.$onRemoveRange = editor.$onRemoveRange.bind(editor);
- editor.$onMultiSelect = editor.$onMultiSelect.bind(editor);
- editor.$onSingleSelect = editor.$onSingleSelect.bind(editor);
-
- exports.onSessionChange.call(editor, editor);
- editor.on("changeSession", exports.onSessionChange.bind(editor));
-
- editor.on("mousedown", onMouseDown);
- editor.commands.addCommands(commands.defaultCommands);
-
- addAltCursorListeners(editor);
- }
-
- function addAltCursorListeners(editor){
- var el = editor.textInput.getElement();
- var altCursor = false;
- var contentEl = editor.renderer.content;
- event.addListener(el, "keydown", function(e) {
- if (e.keyCode == 18 && !(e.ctrlKey || e.shiftKey || e.metaKey)) {
- if (!altCursor) {
- contentEl.style.cursor = "crosshair";
- altCursor = true;
- }
- } else if (altCursor) {
- contentEl.style.cursor = "";
- }
- });
-
- event.addListener(el, "keyup", reset);
- event.addListener(el, "blur", reset);
- function reset() {
- if (altCursor) {
- contentEl.style.cursor = "";
- altCursor = false;
- }
- }
- }
-
- exports.MultiSelect = MultiSelect;
-
- });
-
- ace.define('ace/range_list', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
-
- var RangeList = function() {
- this.ranges = [];
- };
-
- (function() {
- this.comparePoints = function(p1, p2) {
- return p1.row - p2.row || p1.column - p2.column;
- };
-
- this.pointIndex = function(pos, startIndex) {
- var list = this.ranges;
-
- for (var i = startIndex || 0; i < list.length; i++) {
- var range = list[i];
- var cmp = this.comparePoints(pos, range.end);
-
- if (cmp > 0)
- continue;
- if (cmp == 0)
- return i;
- cmp = this.comparePoints(pos, range.start);
- if (cmp >= 0)
- return i;
-
- return -i-1;
- }
- return -i - 1;
- };
-
- this.add = function(range) {
- var startIndex = this.pointIndex(range.start);
- if (startIndex < 0)
- startIndex = -startIndex - 1;
-
- var endIndex = this.pointIndex(range.end, startIndex);
-
- if (endIndex < 0)
- endIndex = -endIndex - 1;
- else
- endIndex++;
-
- return this.ranges.splice(startIndex, endIndex - startIndex, range);
- };
-
- this.addList = function(list) {
- var removed = [];
- for (var i = list.length; i--; ) {
- removed.push.call(removed, this.add(list[i]));
- }
- return removed;
- };
-
- this.substractPoint = function(pos) {
- var i = this.pointIndex(pos);
-
- if (i >= 0)
- return this.ranges.splice(i, 1);
- };
-
- // merge overlapping ranges
- this.merge = function() {
- var removed = [];
- var list = this.ranges;
- var next = list[0], range;
- for (var i = 1; i < list.length; i++) {
- range = next;
- next = list[i];
- var cmp = this.comparePoints(range.end, next.start);
- if (cmp < 0)
- continue;
-
- if (cmp == 0 && !(range.isEmpty() || next.isEmpty()))
- continue;
-
- if (this.comparePoints(range.end, next.end) < 0) {
- range.end.row = next.end.row;
- range.end.column = next.end.column;
- }
-
- list.splice(i, 1);
- removed.push(next);
- next = range;
- i--;
- }
-
- return removed;
- };
-
- this.contains = function(row, column) {
- return this.pointIndex({row: row, column: column}) >= 0;
- };
-
- this.containsPoint = function(pos) {
- return this.pointIndex(pos) >= 0;
- };
-
- this.rangeAtPoint = function(pos) {
- var i = this.pointIndex(pos);
- if (i >= 0)
- return this.ranges[i];
- };
-
-
- this.clipRows = function(startRow, endRow) {
- var list = this.ranges;
- if (list[0].start.row > endRow || list[list.length - 1].start.row < startRow)
- return [];
-
- var startIndex = this.pointIndex({row: startRow, column: 0});
- if (startIndex < 0)
- startIndex = -startIndex - 1;
- var endIndex = this.pointIndex({row: endRow, column: 0}, startIndex);
- if (endIndex < 0)
- endIndex = -endIndex - 1;
-
- var clipped = [];
- for (var i = startIndex; i < endIndex; i++) {
- clipped.push(list[i]);
- }
- return clipped;
- };
-
- this.removeAll = function() {
- return this.ranges.splice(0, this.ranges.length);
- };
-
- this.attach = function(session) {
- if (this.session)
- this.detach();
-
- this.session = session;
- this.onChange = this.$onChange.bind(this);
-
- this.session.on('change', this.onChange);
- };
-
- this.detach = function() {
- if (!this.session)
- return;
- this.session.removeListener('change', this.onChange);
- this.session = null;
- };
-
- this.$onChange = function(e) {
- var changeRange = e.data.range;
- if (e.data.action[0] == "i"){
- var start = changeRange.start;
- var end = changeRange.end;
- } else {
- var end = changeRange.start;
- var start = changeRange.end;
- }
- var startRow = start.row;
- var endRow = end.row;
- var lineDif = endRow - startRow;
-
- var colDiff = -start.column + end.column;
- var ranges = this.ranges;
-
- for (var i = 0, n = ranges.length; i < n; i++) {
- var r = ranges[i];
- if (r.end.row < startRow)
- continue;
- if (r.start.row > startRow)
- break;
-
- if (r.start.row == startRow && r.start.column >= start.column ) {
- r.start.column += colDiff;
- r.start.row += lineDif;
- }
- if (r.end.row == startRow && r.end.column >= start.column) {
- r.end.column += colDiff;
- r.end.row += lineDif;
- }
- }
-
- if (lineDif != 0 && i < n) {
- for (; i < n; i++) {
- var r = ranges[i];
- r.start.row += lineDif;
- r.end.row += lineDif;
- }
- }
- };
-
- }).call(RangeList.prototype);
-
- exports.RangeList = RangeList;
- });
-
- ace.define('ace/mouse/multi_select_handler', ['require', 'exports', 'module' , 'ace/lib/event'], function(require, exports, module) {
-
- var event = require("../lib/event");
-
-
- // mouse
- function isSamePoint(p1, p2) {
- return p1.row == p2.row && p1.column == p2.column;
- }
-
- function onMouseDown(e) {
- var ev = e.domEvent;
- var alt = ev.altKey;
- var shift = ev.shiftKey;
- var ctrl = e.getAccelKey();
- var button = e.getButton();
-
- if (e.editor.inMultiSelectMode && button == 2) {
- e.editor.textInput.onContextMenu(e.domEvent);
- return;
- }
-
- if (!ctrl && !alt) {
- if (button == 0 && e.editor.inMultiSelectMode)
- e.editor.exitMultiSelectMode();
- return;
- }
-
- var editor = e.editor;
- var selection = editor.selection;
- var isMultiSelect = editor.inMultiSelectMode;
- var pos = e.getDocumentPosition();
- var cursor = selection.getCursor();
- var inSelection = e.inSelection() || (selection.isEmpty() && isSamePoint(pos, cursor));
-
-
- var mouseX = e.x, mouseY = e.y;
- var onMouseSelection = function(e) {
- mouseX = e.clientX;
- mouseY = e.clientY;
- };
-
- var blockSelect = function() {
- var newCursor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
- var cursor = session.screenToDocumentPosition(newCursor.row, newCursor.column);
-
- if (isSamePoint(screenCursor, newCursor)
- && isSamePoint(cursor, selection.selectionLead))
- return;
- screenCursor = newCursor;
-
- editor.selection.moveCursorToPosition(cursor);
- editor.selection.clearSelection();
- editor.renderer.scrollCursorIntoView();
-
- editor.removeSelectionMarkers(rectSel);
- rectSel = selection.rectangularRangeBlock(screenCursor, screenAnchor);
- rectSel.forEach(editor.addSelectionMarker, editor);
- editor.updateSelectionMarkers();
- };
-
- var session = editor.session;
- var screenAnchor = editor.renderer.pixelToScreenCoordinates(mouseX, mouseY);
- var screenCursor = screenAnchor;
-
-
-
- if (ctrl && !shift && !alt && button == 0) {
- if (!isMultiSelect && inSelection)
- return; // dragging
-
- if (!isMultiSelect) {
- var range = selection.toOrientedRange();
- editor.addSelectionMarker(range);
- }
-
- var oldRange = selection.rangeList.rangeAtPoint(pos);
-
- event.capture(editor.container, function(){}, function() {
- var tmpSel = selection.toOrientedRange();
-
- if (oldRange && tmpSel.isEmpty() && isSamePoint(oldRange.cursor, tmpSel.cursor))
- selection.substractPoint(tmpSel.cursor);
- else {
- if (range) {
- editor.removeSelectionMarker(range);
- selection.addRange(range);
- }
- selection.addRange(tmpSel);
- }
- });
-
- } else if (!shift && alt && button == 0) {
- e.stop();
-
- if (isMultiSelect && !ctrl)
- selection.toSingleRange();
- else if (!isMultiSelect && ctrl)
- selection.addRange();
-
- selection.moveCursorToPosition(pos);
- selection.clearSelection();
-
- var rectSel = [];
-
- var onMouseSelectionEnd = function(e) {
- clearInterval(timerId);
- editor.removeSelectionMarkers(rectSel);
- for (var i = 0; i < rectSel.length; i++)
- selection.addRange(rectSel[i]);
- };
-
- var onSelectionInterval = blockSelect;
-
- event.capture(editor.container, onMouseSelection, onMouseSelectionEnd);
- var timerId = setInterval(function() {onSelectionInterval();}, 20);
-
- return e.preventDefault();
- }
- }
-
-
- exports.onMouseDown = onMouseDown;
-
- });
-
- ace.define('ace/commands/multi_select_commands', ['require', 'exports', 'module' , 'ace/keyboard/hash_handler'], function(require, exports, module) {
-
- // commands to enter multiselect mode
- exports.defaultCommands = [{
- name: "addCursorAbove",
- exec: function(editor) { editor.selectMoreLines(-1); },
- bindKey: {win: "Ctrl-Alt-Up", mac: "Ctrl-Alt-Up"},
- readonly: true
- }, {
- name: "addCursorBelow",
- exec: function(editor) { editor.selectMoreLines(1); },
- bindKey: {win: "Ctrl-Alt-Down", mac: "Ctrl-Alt-Down"},
- readonly: true
- }, {
- name: "addCursorAboveSkipCurrent",
- exec: function(editor) { editor.selectMoreLines(-1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Up", mac: "Ctrl-Alt-Shift-Up"},
- readonly: true
- }, {
- name: "addCursorBelowSkipCurrent",
- exec: function(editor) { editor.selectMoreLines(1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Down", mac: "Ctrl-Alt-Shift-Down"},
- readonly: true
- }, {
- name: "selectMoreBefore",
- exec: function(editor) { editor.selectMore(-1); },
- bindKey: {win: "Ctrl-Alt-Left", mac: "Ctrl-Alt-Left"},
- readonly: true
- }, {
- name: "selectMoreAfter",
- exec: function(editor) { editor.selectMore(1); },
- bindKey: {win: "Ctrl-Alt-Right", mac: "Ctrl-Alt-Right"},
- readonly: true
- }, {
- name: "selectNextBefore",
- exec: function(editor) { editor.selectMore(-1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Left", mac: "Ctrl-Alt-Shift-Left"},
- readonly: true
- }, {
- name: "selectNextAfter",
- exec: function(editor) { editor.selectMore(1, true); },
- bindKey: {win: "Ctrl-Alt-Shift-Right", mac: "Ctrl-Alt-Shift-Right"},
- readonly: true
- }, {
- name: "splitIntoLines",
- exec: function(editor) { editor.multiSelect.splitIntoLines(); },
- bindKey: {win: "Ctrl-Shift-L", mac: "Ctrl-Shift-L"},
- readonly: true
- }];
-
- // commands active in multiselect mode
- exports.multiSelectCommands = [{
- name: "singleSelection",
- bindKey: "esc",
- exec: function(editor) { editor.exitMultiSelectMode(); },
- readonly: true,
- isAvailable: function(editor) {return editor.inMultiSelectMode}
- }];
-
- var HashHandler = require("../keyboard/hash_handler").HashHandler;
- exports.keyboardHandler = new HashHandler(exports.multiSelectCommands);
-
- });
-
- ace.define('ace/worker/worker_client', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib/event_emitter', 'ace/config'], function(require, exports, module) {
-
-
- var oop = require("../lib/oop");
- var EventEmitter = require("../lib/event_emitter").EventEmitter;
- var config = require("../config");
-
- var WorkerClient = function(topLevelNamespaces, packagedJs, mod, classname) {
-
- this.changeListener = this.changeListener.bind(this);
-
- if (config.get("packaged")) {
- this.$worker = new Worker(config.get("workerPath") + "/" + packagedJs);
- }
- else {
- var workerUrl;
- if (typeof require.supports !== "undefined" && require.supports.indexOf("ucjs2-pinf-0") >= 0) {
- // We are running in the sourcemint loader.
- workerUrl = require.nameToUrl("ace/worker/worker_sourcemint");
- } else {
- // We are running in RequireJS.
- // nameToUrl is renamed to toUrl in requirejs 2
- if (require.nameToUrl && !require.toUrl)
- require.toUrl = require.nameToUrl;
- workerUrl = this.$normalizePath(require.toUrl("ace/worker/worker", null, "_"));
- }
- this.$worker = new Worker(workerUrl);
-
- var tlns = {};
- for (var i=0; i<topLevelNamespaces.length; i++) {
- var ns = topLevelNamespaces[i];
- var path = this.$normalizePath(require.toUrl(ns, null, "_").replace(/.js$/, ""));
-
- tlns[ns] = path;
- }
- }
-
- this.$worker.postMessage({
- init : true,
- tlns: tlns,
- module: mod,
- classname: classname
- });
-
- this.callbackId = 1;
- this.callbacks = {};
-
- var _self = this;
- this.$worker.onerror = function(e) {
- window.console && console.log && console.log(e);
- throw e;
- };
- this.$worker.onmessage = function(e) {
- var msg = e.data;
- switch(msg.type) {
- case "log":
- window.console && console.log && console.log(msg.data);
- break;
-
- case "event":
- _self._emit(msg.name, {data: msg.data});
- break;
-
- case "call":
- var callback = _self.callbacks[msg.id];
- if (callback) {
- callback(msg.data);
- delete _self.callbacks[msg.id];
- }
- break;
- }
- };
- };
-
- (function(){
-
- oop.implement(this, EventEmitter);
-
- this.$normalizePath = function(path) {
- path = path.replace(/^[a-z]+:\/\/[^\/]+/, ""); // Remove domain name and rebuild it
- path = location.protocol + "//" + location.host
- // paths starting with a slash are relative to the root (host)
- + (path.charAt(0) == "/" ? "" : location.pathname.replace(/\/[^\/]*$/, ""))
- + "/" + path.replace(/^[\/]+/, "");
- return path;
- };
-
- this.terminate = function() {
- this._emit("terminate", {});
- this.$worker.terminate();
- this.$worker = null;
- this.$doc.removeEventListener("change", this.changeListener);
- this.$doc = null;
- };
-
- this.send = function(cmd, args) {
- this.$worker.postMessage({command: cmd, args: args});
- };
-
- this.call = function(cmd, args, callback) {
- if (callback) {
- var id = this.callbackId++;
- this.callbacks[id] = callback;
- args.push(id);
- }
- this.send(cmd, args);
- };
-
- this.emit = function(event, data) {
- try {
- // firefox refuses to clone objects which have function properties
- // TODO: cleanup event
- this.$worker.postMessage({event: event, data: {data: data.data}});
- }
- catch(ex) {}
- };
-
- this.attachToDocument = function(doc) {
- if(this.$doc)
- this.terminate();
-
- this.$doc = doc;
- this.call("setValue", [doc.getValue()]);
- doc.on("change", this.changeListener);
- };
-
- this.changeListener = function(e) {
- e.range = {
- start: e.data.range.start,
- end: e.data.range.end
- };
- this.emit("change", e);
- };
-
- }).call(WorkerClient.prototype);
-
- exports.WorkerClient = WorkerClient;
-
- });
-
- ace.define('ace/keyboard/state_handler', ['require', 'exports', 'module' ], function(require, exports, module) {
-
-
- // If you're developing a new keymapping and want to get an idea what's going
- // on, then enable debugging.
- var DEBUG = false;
-
- function StateHandler(keymapping) {
- this.keymapping = this.$buildKeymappingRegex(keymapping);
- }
-
- StateHandler.prototype = {
- /*
- * Build the RegExp from the keymapping as RegExp can't stored directly
- * in the metadata JSON and as the RegExp used to match the keys/buffer
- * need to be adapted.
- */
- $buildKeymappingRegex: function(keymapping) {
- for (var state in keymapping) {
- this.$buildBindingsRegex(keymapping[state]);
- }
- return keymapping;
- },
-
- $buildBindingsRegex: function(bindings) {
- // Escape a given Regex string.
- bindings.forEach(function(binding) {
- if (binding.key) {
- binding.key = new RegExp('^' + binding.key + '$');
- } else if (Array.isArray(binding.regex)) {
- if (!('key' in binding))
- binding.key = new RegExp('^' + binding.regex[1] + '$');
- binding.regex = new RegExp(binding.regex.join('') + '$');
- } else if (binding.regex) {
- binding.regex = new RegExp(binding.regex + '$');
- }
- });
- },
-
- $composeBuffer: function(data, hashId, key, e) {
- // Initialize the data object.
- if (data.state == null || data.buffer == null) {
- data.state = "start";
- data.buffer = "";
- }
-
- var keyArray = [];
- if (hashId & 1) keyArray.push("ctrl");
- if (hashId & 8) keyArray.push("command");
- if (hashId & 2) keyArray.push("option");
- if (hashId & 4) keyArray.push("shift");
- if (key) keyArray.push(key);
-
- var symbolicName = keyArray.join("-");
- var bufferToUse = data.buffer + symbolicName;
-
- // Don't add the symbolic name to the key buffer if the alt_ key is
- // part of the symbolic name. If it starts with alt_, this means
- // that the user hit an alt keycombo and there will be a single,
- // new character detected after this event, which then will be
- // added to the buffer (e.g. alt_j will result in ∆).
- //
- // We test for 2 and not for & 2 as we only want to exclude the case where
- // the option key is pressed alone.
- if (hashId != 2) {
- data.buffer = bufferToUse;
- }
-
- var bufferObj = {
- bufferToUse: bufferToUse,
- symbolicName: symbolicName,
- };
-
- if (e) {
- bufferObj.keyIdentifier = e.keyIdentifier
- }
-
- return bufferObj;
- },
-
- $find: function(data, buffer, symbolicName, hashId, key, keyIdentifier) {
- // Holds the command to execute and the args if a command matched.
- var result = {};
-
- // Loop over all the bindings of the keymap until a match is found.
- this.keymapping[data.state].some(function(binding) {
- var match;
-
- // Check if the key matches.
- if (binding.key && !binding.key.test(symbolicName)) {
- return false;
- }
-
- // Check if the regex matches.
- if (binding.regex && !(match = binding.regex.exec(buffer))) {
- return false;
- }
-
- // Check if the match function matches.
- if (binding.match && !binding.match(buffer, hashId, key, symbolicName, keyIdentifier)) {
- return false;
- }
-
- // Check for disallowed matches.
- if (binding.disallowMatches) {
- for (var i = 0; i < binding.disallowMatches.length; i++) {
- if (!!match[binding.disallowMatches[i]]) {
- return false;
- }
- }
- }
-
- // If there is a command to execute, then figure out the
- // command and the arguments.
- if (binding.exec) {
- result.command = binding.exec;
-
- // Build the arguments.
- if (binding.params) {
- var value;
- result.args = {};
- binding.params.forEach(function(param) {
- if (param.match != null && match != null) {
- value = match[param.match] || param.defaultValue;
- } else {
- value = param.defaultValue;
- }
-
- if (param.type === 'number') {
- value = parseInt(value);
- }
-
- result.args[param.name] = value;
- });
- }
- data.buffer = "";
- }
-
- // Handle the 'then' property.
- if (binding.then) {
- data.state = binding.then;
- data.buffer = "";
- }
-
- // If no command is set, then execute the "null" fake command.
- if (result.command == null) {
- result.command = "null";
- }
-
- if (DEBUG) {
- console.log("KeyboardStateMapper#find", binding);
- }
- return true;
- });
-
- if (result.command) {
- return result;
- } else {
- data.buffer = "";
- return false;
- }
- },
-
- /*
- * This function is called by keyBinding.
- */
- handleKeyboard: function(data, hashId, key, keyCode, e) {
- if (hashId == -1)
- hashId = 0
- // If we pressed any command key but no other key, then ignore the input.
- // Otherwise "shift-" is added to the buffer, and later on "shift-g"
- // which results in "shift-shift-g" which doesn't make sense.
- if (hashId != 0 && (key == "" || key == String.fromCharCode(0))) {
- return null;
- }
-
- // Compute the current value of the keyboard input buffer.
- var r = this.$composeBuffer(data, hashId, key, e);
- var buffer = r.bufferToUse;
- var symbolicName = r.symbolicName;
- var keyId = r.keyIdentifier;
-
- r = this.$find(data, buffer, symbolicName, hashId, key, keyId);
- if (DEBUG) {
- console.log("KeyboardStateMapper#match", buffer, symbolicName, r);
- }
-
- return r;
- }
- }
-
- /*
- * This is a useful matching function and therefore is defined here so that
- * users of KeyboardStateMapper can use it.
- *
- * @return boolean
- * If no command key (Command|Option|Shift|Ctrl) is pressed, it
- * returns true. If the only the Shift key is pressed + a character
- * true is returned as well. Otherwise, false is returned.
- * Summing up, the function returns true whenever the user typed
- * a normal character on the keyboard and no shortcut.
- */
- exports.matchCharacterOnly = function(buffer, hashId, key, symbolicName) {
- // If no command keys are pressed, then catch the input.
- if (hashId == 0) {
- return true;
- }
- // If only the shift key is pressed and a character key, then
- // catch that input as well.
- else if ((hashId == 4) && key.length == 1) {
- return true;
- }
- // Otherwise, we let the input got through.
- else {
- return false;
- }
- };
-
- exports.StateHandler = StateHandler;
- });
- ace.define('ace/placeholder', ['require', 'exports', 'module' , 'ace/range', 'ace/lib/event_emitter', 'ace/lib/oop'], function(require, exports, module) {
-
-
- var Range = require('./range').Range;
- var EventEmitter = require("./lib/event_emitter").EventEmitter;
- var oop = require("./lib/oop");
-
- /**
- * new PlaceHolder(session, length, pos, others, mainClass, othersClass)
- * - session (Document): The document to associate with the anchor
- * - length (Number): The starting row position
- * - pos (Number): The starting column position
- * - others (String):
- * - mainClass (String):
- * - othersClass (String):
- *
- * TODO
- *
- **/
-
- var PlaceHolder = function(session, length, pos, others, mainClass, othersClass) {
- var _self = this;
- this.length = length;
- this.session = session;
- this.doc = session.getDocument();
- this.mainClass = mainClass;
- this.othersClass = othersClass;
- this.$onUpdate = this.onUpdate.bind(this);
- this.doc.on("change", this.$onUpdate);
- this.$others = others;
-
- this.$onCursorChange = function() {
- setTimeout(function() {
- _self.onCursorChange();
- });
- };
-
- this.$pos = pos;
- // Used for reset
- var undoStack = session.getUndoManager().$undoStack || session.getUndoManager().$undostack || {length: -1};
- this.$undoStackDepth = undoStack.length;
- this.setup();
-
- session.selection.on("changeCursor", this.$onCursorChange);
- };
-
- (function() {
-
- oop.implement(this, EventEmitter);
- this.setup = function() {
- var _self = this;
- var doc = this.doc;
- var session = this.session;
- var pos = this.$pos;
-
- this.pos = doc.createAnchor(pos.row, pos.column);
- this.markerId = session.addMarker(new Range(pos.row, pos.column, pos.row, pos.column + this.length), this.mainClass, null, false);
- this.pos.on("change", function(event) {
- session.removeMarker(_self.markerId);
- _self.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.mainClass, null, false);
- });
- this.others = [];
- this.$others.forEach(function(other) {
- var anchor = doc.createAnchor(other.row, other.column);
- _self.others.push(anchor);
- });
- session.setUndoSelect(false);
- };
- this.showOtherMarkers = function() {
- if(this.othersActive) return;
- var session = this.session;
- var _self = this;
- this.othersActive = true;
- this.others.forEach(function(anchor) {
- anchor.markerId = session.addMarker(new Range(anchor.row, anchor.column, anchor.row, anchor.column+_self.length), _self.othersClass, null, false);
- anchor.on("change", function(event) {
- session.removeMarker(anchor.markerId);
- anchor.markerId = session.addMarker(new Range(event.value.row, event.value.column, event.value.row, event.value.column+_self.length), _self.othersClass, null, false);
- });
- });
- };
- this.hideOtherMarkers = function() {
- if(!this.othersActive) return;
- this.othersActive = false;
- for (var i = 0; i < this.others.length; i++) {
- this.session.removeMarker(this.others[i].markerId);
- }
- };
- this.onUpdate = function(event) {
- var delta = event.data;
- var range = delta.range;
- if(range.start.row !== range.end.row) return;
- if(range.start.row !== this.pos.row) return;
- if (this.$updating) return;
- this.$updating = true;
- var lengthDiff = delta.action === "insertText" ? range.end.column - range.start.column : range.start.column - range.end.column;
-
- if(range.start.column >= this.pos.column && range.start.column <= this.pos.column + this.length + 1) {
- var distanceFromStart = range.start.column - this.pos.column;
- this.length += lengthDiff;
- if(!this.session.$fromUndo) {
- if(delta.action === "insertText") {
- for (var i = this.others.length - 1; i >= 0; i--) {
- var otherPos = this.others[i];
- var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
- if(otherPos.row === range.start.row && range.start.column < otherPos.column)
- newPos.column += lengthDiff;
- this.doc.insert(newPos, delta.text);
- }
- } else if(delta.action === "removeText") {
- for (var i = this.others.length - 1; i >= 0; i--) {
- var otherPos = this.others[i];
- var newPos = {row: otherPos.row, column: otherPos.column + distanceFromStart};
- if(otherPos.row === range.start.row && range.start.column < otherPos.column)
- newPos.column += lengthDiff;
- this.doc.remove(new Range(newPos.row, newPos.column, newPos.row, newPos.column - lengthDiff));
- }
- }
- // Special case: insert in beginning
- if(range.start.column === this.pos.column && delta.action === "insertText") {
- setTimeout(function() {
- this.pos.setPosition(this.pos.row, this.pos.column - lengthDiff);
- for (var i = 0; i < this.others.length; i++) {
- var other = this.others[i];
- var newPos = {row: other.row, column: other.column - lengthDiff};
- if(other.row === range.start.row && range.start.column < other.column)
- newPos.column += lengthDiff;
- other.setPosition(newPos.row, newPos.column);
- }
- }.bind(this), 0);
- }
- else if(range.start.column === this.pos.column && delta.action === "removeText") {
- setTimeout(function() {
- for (var i = 0; i < this.others.length; i++) {
- var other = this.others[i];
- if(other.row === range.start.row && range.start.column < other.column) {
- other.setPosition(other.row, other.column - lengthDiff);
- }
- }
- }.bind(this), 0);
- }
- }
- this.pos._emit("change", {value: this.pos});
- for (var i = 0; i < this.others.length; i++) {
- this.others[i]._emit("change", {value: this.others[i]});
- }
- }
- this.$updating = false;
- };
-
- this.onCursorChange = function(event) {
- if (this.$updating) return;
- var pos = this.session.selection.getCursor();
- if(pos.row === this.pos.row && pos.column >= this.pos.column && pos.column <= this.pos.column + this.length) {
- this.showOtherMarkers();
- this._emit("cursorEnter", event);
- } else {
- this.hideOtherMarkers();
- this._emit("cursorLeave", event);
- }
- };
- this.detach = function() {
- this.session.removeMarker(this.markerId);
- this.hideOtherMarkers();
- this.doc.removeEventListener("change", this.$onUpdate);
- this.session.selection.removeEventListener("changeCursor", this.$onCursorChange);
- this.pos.detach();
- for (var i = 0; i < this.others.length; i++) {
- this.others[i].detach();
- }
- this.session.setUndoSelect(true);
- };
- this.cancel = function() {
- if(this.$undoStackDepth === -1)
- throw Error("Canceling placeholders only supported with undo manager attached to session.");
- var undoManager = this.session.getUndoManager();
- var undosRequired = (undoManager.$undoStack || undoManager.$undostack).length - this.$undoStackDepth;
- for (var i = 0; i < undosRequired; i++) {
- undoManager.undo(true);
- }
- };
- }).call(PlaceHolder.prototype);
-
-
- exports.PlaceHolder = PlaceHolder;
- });
-
- ace.define('ace/theme/textmate', ['require', 'exports', 'module' , 'text!ace/theme/textmate.css', 'ace/lib/dom'], function(require, exports, module) {
-
-
- exports.isDark = false;
- exports.cssClass = "ace-tm";
- exports.cssText = require('text!./textmate.css');
-
- var dom = require("../lib/dom");
- dom.importCssString(exports.cssText, exports.cssClass);
- });
- ace.define("text!ace/theme/textmate.css", [], ".ace-tm .ace_editor {\n" +
- " border: 2px solid rgb(159, 159, 159);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_editor.ace_focus {\n" +
- " border: 2px solid #327fbd;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_gutter {\n" +
- " background: #e8e8e8;\n" +
- " color: #333;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_print_margin {\n" +
- " width: 1px;\n" +
- " background: #e8e8e8;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_fold {\n" +
- " background-color: #6B72E6;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_text-layer {\n" +
- " cursor: text;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_cursor {\n" +
- " border-left: 2px solid black;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_cursor.ace_overwrite {\n" +
- " border-left: 0px;\n" +
- " border-bottom: 1px solid black;\n" +
- "}\n" +
- " \n" +
- ".ace-tm .ace_line .ace_invisible {\n" +
- " color: rgb(191, 191, 191);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_storage,\n" +
- ".ace-tm .ace_line .ace_keyword {\n" +
- " color: blue;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_constant {\n" +
- " color: rgb(197, 6, 11);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_constant.ace_buildin {\n" +
- " color: rgb(88, 72, 246);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_constant.ace_language {\n" +
- " color: rgb(88, 92, 246);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_constant.ace_library {\n" +
- " color: rgb(6, 150, 14);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_invalid {\n" +
- " background-color: rgba(255, 0, 0, 0.1);\n" +
- " color: red;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_support.ace_function {\n" +
- " color: rgb(60, 76, 114);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_support.ace_constant {\n" +
- " color: rgb(6, 150, 14);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_support.ace_type,\n" +
- ".ace-tm .ace_line .ace_support.ace_class {\n" +
- " color: rgb(109, 121, 222);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_keyword.ace_operator {\n" +
- " color: rgb(104, 118, 135);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_string {\n" +
- " color: rgb(3, 106, 7);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_comment {\n" +
- " color: rgb(76, 136, 107);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_comment.ace_doc {\n" +
- " color: rgb(0, 102, 255);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_comment.ace_doc.ace_tag {\n" +
- " color: rgb(128, 159, 191);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_constant.ace_numeric {\n" +
- " color: rgb(0, 0, 205);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_variable {\n" +
- " color: rgb(49, 132, 149);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_line .ace_xml_pe {\n" +
- " color: rgb(104, 104, 91);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_entity.ace_name.ace_function {\n" +
- " color: #0000A2;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_markup.ace_markupine {\n" +
- " text-decoration:underline;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_markup.ace_heading {\n" +
- " color: rgb(12, 7, 255);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_markup.ace_list {\n" +
- " color:rgb(185, 6, 144);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_marker-layer .ace_selection {\n" +
- " background: rgb(181, 213, 255);\n" +
- "}\n" +
- ".ace-tm.multiselect .ace_selection.start {\n" +
- " box-shadow: 0 0 3px 0px white;\n" +
- " border-radius: 2px;\n" +
- "}\n" +
- ".ace-tm .ace_marker-layer .ace_step {\n" +
- " background: rgb(252, 255, 0);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_marker-layer .ace_stack {\n" +
- " background: rgb(164, 229, 101);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_marker-layer .ace_bracket {\n" +
- " margin: -1px 0 0 -1px;\n" +
- " border: 1px solid rgb(192, 192, 192);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_marker-layer .ace_active_line {\n" +
- " background: rgba(0, 0, 0, 0.07);\n" +
- "}\n" +
- ".ace-tm .ace_gutter_active_line{\n" +
- " background-color : #dcdcdc;\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_marker-layer .ace_selected_word {\n" +
- " background: rgb(250, 250, 255);\n" +
- " border: 1px solid rgb(200, 200, 250);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_meta.ace_tag {\n" +
- " color:rgb(0, 50, 198);\n" +
- "}\n" +
- "\n" +
- ".ace-tm .ace_string.ace_regex {\n" +
- " color: rgb(255, 0, 0)\n" +
- "}");
-
- ;
- (function() {
- ace.require(["ace/ace"], function(a) {
- a && a.config.init();
- if (!window.ace)
- window.ace = {};
- for (var key in a) if (a.hasOwnProperty(key))
- ace[key] = a[key];
- });
- })();
- })(undefined, undefined, undefined);
|