zx-quill.common.js 541 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469347034713472347334743475347634773478347934803481348234833484348534863487348834893490349134923493349434953496349734983499350035013502350335043505350635073508350935103511351235133514351535163517351835193520352135223523352435253526352735283529353035313532353335343535353635373538353935403541354235433544354535463547354835493550355135523553355435553556355735583559356035613562356335643565356635673568356935703571357235733574357535763577357835793580358135823583358435853586358735883589359035913592359335943595359635973598359936003601360236033604360536063607360836093610361136123613361436153616361736183619362036213622362336243625362636273628362936303631363236333634363536363637363836393640364136423643364436453646364736483649365036513652365336543655365636573658365936603661366236633664366536663667366836693670367136723673367436753676367736783679368036813682368336843685368636873688368936903691369236933694369536963697369836993700370137023703370437053706370737083709371037113712371337143715371637173718371937203721372237233724372537263727372837293730373137323733373437353736373737383739374037413742374337443745374637473748374937503751375237533754375537563757375837593760376137623763376437653766376737683769377037713772377337743775377637773778377937803781378237833784378537863787378837893790379137923793379437953796379737983799380038013802380338043805380638073808380938103811381238133814381538163817381838193820382138223823382438253826382738283829383038313832383338343835383638373838383938403841384238433844384538463847384838493850385138523853385438553856385738583859386038613862386338643865386638673868386938703871387238733874387538763877387838793880388138823883388438853886388738883889389038913892389338943895389638973898389939003901390239033904390539063907390839093910391139123913391439153916391739183919392039213922392339243925392639273928392939303931393239333934393539363937393839393940394139423943394439453946394739483949395039513952395339543955395639573958395939603961396239633964396539663967396839693970397139723973397439753976397739783979398039813982398339843985398639873988398939903991399239933994399539963997399839994000400140024003400440054006400740084009401040114012401340144015401640174018401940204021402240234024402540264027402840294030403140324033403440354036403740384039404040414042404340444045404640474048404940504051405240534054405540564057405840594060406140624063406440654066406740684069407040714072407340744075407640774078407940804081408240834084408540864087408840894090409140924093409440954096409740984099410041014102410341044105410641074108410941104111411241134114411541164117411841194120412141224123412441254126412741284129413041314132413341344135413641374138413941404141414241434144414541464147414841494150415141524153415441554156415741584159416041614162416341644165416641674168416941704171417241734174417541764177417841794180418141824183418441854186418741884189419041914192419341944195419641974198419942004201420242034204420542064207420842094210421142124213421442154216421742184219422042214222422342244225422642274228422942304231423242334234423542364237423842394240424142424243424442454246424742484249425042514252425342544255425642574258425942604261426242634264426542664267426842694270427142724273427442754276427742784279428042814282428342844285428642874288428942904291429242934294429542964297429842994300430143024303430443054306430743084309431043114312431343144315431643174318431943204321432243234324432543264327432843294330433143324333433443354336433743384339434043414342434343444345434643474348434943504351435243534354435543564357435843594360436143624363436443654366436743684369437043714372437343744375437643774378437943804381438243834384438543864387438843894390439143924393439443954396439743984399440044014402440344044405440644074408440944104411441244134414441544164417441844194420442144224423442444254426442744284429443044314432443344344435443644374438443944404441444244434444444544464447444844494450445144524453445444554456445744584459446044614462446344644465446644674468446944704471447244734474447544764477447844794480448144824483448444854486448744884489449044914492449344944495449644974498449945004501450245034504450545064507450845094510451145124513451445154516451745184519452045214522452345244525452645274528452945304531453245334534453545364537453845394540454145424543454445454546454745484549455045514552455345544555455645574558455945604561456245634564456545664567456845694570457145724573457445754576457745784579458045814582458345844585458645874588458945904591459245934594459545964597459845994600460146024603460446054606460746084609461046114612461346144615461646174618461946204621462246234624462546264627462846294630463146324633463446354636463746384639464046414642464346444645464646474648464946504651465246534654465546564657465846594660466146624663466446654666466746684669467046714672467346744675467646774678467946804681468246834684468546864687468846894690469146924693469446954696469746984699470047014702470347044705470647074708470947104711471247134714471547164717471847194720472147224723472447254726472747284729473047314732473347344735473647374738473947404741474247434744474547464747474847494750475147524753475447554756475747584759476047614762476347644765476647674768476947704771477247734774477547764777477847794780478147824783478447854786478747884789479047914792479347944795479647974798479948004801480248034804480548064807480848094810481148124813481448154816481748184819482048214822482348244825482648274828482948304831483248334834483548364837483848394840484148424843484448454846484748484849485048514852485348544855485648574858485948604861486248634864486548664867486848694870487148724873487448754876487748784879488048814882488348844885488648874888488948904891489248934894489548964897489848994900490149024903490449054906490749084909491049114912491349144915491649174918491949204921492249234924492549264927492849294930493149324933493449354936493749384939494049414942494349444945494649474948494949504951495249534954495549564957495849594960496149624963496449654966496749684969497049714972497349744975497649774978497949804981498249834984498549864987498849894990499149924993499449954996499749984999500050015002500350045005500650075008500950105011501250135014501550165017501850195020502150225023502450255026502750285029503050315032503350345035503650375038503950405041504250435044504550465047504850495050505150525053505450555056505750585059506050615062506350645065506650675068506950705071507250735074507550765077507850795080508150825083508450855086508750885089509050915092509350945095509650975098509951005101510251035104510551065107510851095110511151125113511451155116511751185119512051215122512351245125512651275128512951305131513251335134513551365137513851395140514151425143514451455146514751485149515051515152515351545155515651575158515951605161516251635164516551665167516851695170517151725173517451755176517751785179518051815182518351845185518651875188518951905191519251935194519551965197519851995200520152025203520452055206520752085209521052115212521352145215521652175218521952205221522252235224522552265227522852295230523152325233523452355236523752385239524052415242524352445245524652475248524952505251525252535254525552565257525852595260526152625263526452655266526752685269527052715272527352745275527652775278527952805281528252835284528552865287528852895290529152925293529452955296529752985299530053015302530353045305530653075308530953105311531253135314531553165317531853195320532153225323532453255326532753285329533053315332533353345335533653375338533953405341534253435344534553465347534853495350535153525353535453555356535753585359536053615362536353645365536653675368536953705371537253735374537553765377537853795380538153825383538453855386538753885389539053915392539353945395539653975398539954005401540254035404540554065407540854095410541154125413541454155416541754185419542054215422542354245425542654275428542954305431543254335434543554365437543854395440544154425443544454455446544754485449545054515452545354545455545654575458545954605461546254635464546554665467546854695470547154725473547454755476547754785479548054815482548354845485548654875488548954905491549254935494549554965497549854995500550155025503550455055506550755085509551055115512551355145515551655175518551955205521552255235524552555265527552855295530553155325533553455355536553755385539554055415542554355445545554655475548554955505551555255535554555555565557555855595560556155625563556455655566556755685569557055715572557355745575557655775578557955805581558255835584558555865587558855895590559155925593559455955596559755985599560056015602560356045605560656075608560956105611561256135614561556165617561856195620562156225623562456255626562756285629563056315632563356345635563656375638563956405641564256435644564556465647564856495650565156525653565456555656565756585659566056615662566356645665566656675668566956705671567256735674567556765677567856795680568156825683568456855686568756885689569056915692569356945695569656975698569957005701570257035704570557065707570857095710571157125713571457155716571757185719572057215722572357245725572657275728572957305731573257335734573557365737573857395740574157425743574457455746574757485749575057515752575357545755575657575758575957605761576257635764576557665767576857695770577157725773577457755776577757785779578057815782578357845785578657875788578957905791579257935794579557965797579857995800580158025803580458055806580758085809581058115812581358145815581658175818581958205821582258235824582558265827582858295830583158325833583458355836583758385839584058415842584358445845584658475848584958505851585258535854585558565857585858595860586158625863586458655866586758685869587058715872587358745875587658775878587958805881588258835884588558865887588858895890589158925893589458955896589758985899590059015902590359045905590659075908590959105911591259135914591559165917591859195920592159225923592459255926592759285929593059315932593359345935593659375938593959405941594259435944594559465947594859495950595159525953595459555956595759585959596059615962596359645965596659675968596959705971597259735974597559765977597859795980598159825983598459855986598759885989599059915992599359945995599659975998599960006001600260036004600560066007600860096010601160126013601460156016601760186019602060216022602360246025602660276028602960306031603260336034603560366037603860396040604160426043604460456046604760486049605060516052605360546055605660576058605960606061606260636064606560666067606860696070607160726073607460756076607760786079608060816082608360846085608660876088608960906091609260936094609560966097609860996100610161026103610461056106610761086109611061116112611361146115611661176118611961206121612261236124612561266127612861296130613161326133613461356136613761386139614061416142614361446145614661476148614961506151615261536154615561566157615861596160616161626163616461656166616761686169617061716172617361746175617661776178617961806181618261836184618561866187618861896190619161926193619461956196619761986199620062016202620362046205620662076208620962106211621262136214621562166217621862196220622162226223622462256226622762286229623062316232623362346235623662376238623962406241624262436244624562466247624862496250625162526253625462556256625762586259626062616262626362646265626662676268626962706271627262736274627562766277627862796280628162826283628462856286628762886289629062916292629362946295629662976298629963006301630263036304630563066307630863096310631163126313631463156316631763186319632063216322632363246325632663276328632963306331633263336334633563366337633863396340634163426343634463456346634763486349635063516352635363546355635663576358635963606361636263636364636563666367636863696370637163726373637463756376637763786379638063816382638363846385638663876388638963906391639263936394639563966397639863996400640164026403640464056406640764086409641064116412641364146415641664176418641964206421642264236424642564266427642864296430643164326433643464356436643764386439644064416442644364446445644664476448644964506451645264536454645564566457645864596460646164626463646464656466646764686469647064716472647364746475647664776478647964806481648264836484648564866487648864896490649164926493649464956496649764986499650065016502650365046505650665076508650965106511651265136514651565166517651865196520652165226523652465256526652765286529653065316532653365346535653665376538653965406541654265436544654565466547654865496550655165526553655465556556655765586559656065616562656365646565656665676568656965706571657265736574657565766577657865796580658165826583658465856586658765886589659065916592659365946595659665976598659966006601660266036604660566066607660866096610661166126613661466156616661766186619662066216622662366246625662666276628662966306631663266336634663566366637663866396640664166426643664466456646664766486649665066516652665366546655665666576658665966606661666266636664666566666667666866696670667166726673667466756676667766786679668066816682668366846685668666876688668966906691669266936694669566966697669866996700670167026703670467056706670767086709671067116712671367146715671667176718671967206721672267236724672567266727672867296730673167326733673467356736673767386739674067416742674367446745674667476748674967506751675267536754675567566757675867596760676167626763676467656766676767686769677067716772677367746775677667776778677967806781678267836784678567866787678867896790679167926793679467956796679767986799680068016802680368046805680668076808680968106811681268136814681568166817681868196820682168226823682468256826682768286829683068316832683368346835683668376838683968406841684268436844684568466847684868496850685168526853685468556856685768586859686068616862686368646865686668676868686968706871687268736874687568766877687868796880688168826883688468856886688768886889689068916892689368946895689668976898689969006901690269036904690569066907690869096910691169126913691469156916691769186919692069216922692369246925692669276928692969306931693269336934693569366937693869396940694169426943694469456946694769486949695069516952695369546955695669576958695969606961696269636964696569666967696869696970697169726973697469756976697769786979698069816982698369846985698669876988698969906991699269936994699569966997699869997000700170027003700470057006700770087009701070117012701370147015701670177018701970207021702270237024702570267027702870297030703170327033703470357036703770387039704070417042704370447045704670477048704970507051705270537054705570567057705870597060706170627063706470657066706770687069707070717072707370747075707670777078707970807081708270837084708570867087708870897090709170927093709470957096709770987099710071017102710371047105710671077108710971107111711271137114711571167117711871197120712171227123712471257126712771287129713071317132713371347135713671377138713971407141714271437144714571467147714871497150715171527153715471557156715771587159716071617162716371647165716671677168716971707171717271737174717571767177717871797180718171827183718471857186718771887189719071917192719371947195719671977198719972007201720272037204720572067207720872097210721172127213721472157216721772187219722072217222722372247225722672277228722972307231723272337234723572367237723872397240724172427243724472457246724772487249725072517252725372547255725672577258725972607261726272637264726572667267726872697270727172727273727472757276727772787279728072817282728372847285728672877288728972907291729272937294729572967297729872997300730173027303730473057306730773087309731073117312731373147315731673177318731973207321732273237324732573267327732873297330733173327333733473357336733773387339734073417342734373447345734673477348734973507351735273537354735573567357735873597360736173627363736473657366736773687369737073717372737373747375737673777378737973807381738273837384738573867387738873897390739173927393739473957396739773987399740074017402740374047405740674077408740974107411741274137414741574167417741874197420742174227423742474257426742774287429743074317432743374347435743674377438743974407441744274437444744574467447744874497450745174527453745474557456745774587459746074617462746374647465746674677468746974707471747274737474747574767477747874797480748174827483748474857486748774887489749074917492749374947495749674977498749975007501750275037504750575067507750875097510751175127513751475157516751775187519752075217522752375247525752675277528752975307531753275337534753575367537753875397540754175427543754475457546754775487549755075517552755375547555755675577558755975607561756275637564756575667567756875697570757175727573757475757576757775787579758075817582758375847585758675877588758975907591759275937594759575967597759875997600760176027603760476057606760776087609761076117612761376147615761676177618761976207621762276237624762576267627762876297630763176327633763476357636763776387639764076417642764376447645764676477648764976507651765276537654765576567657765876597660766176627663766476657666766776687669767076717672767376747675767676777678767976807681768276837684768576867687768876897690769176927693769476957696769776987699770077017702770377047705770677077708770977107711771277137714771577167717771877197720772177227723772477257726772777287729773077317732773377347735773677377738773977407741774277437744774577467747774877497750775177527753775477557756775777587759776077617762776377647765776677677768776977707771777277737774777577767777777877797780778177827783778477857786778777887789779077917792779377947795779677977798779978007801780278037804780578067807780878097810781178127813781478157816781778187819782078217822782378247825782678277828782978307831783278337834783578367837783878397840784178427843784478457846784778487849785078517852785378547855785678577858785978607861786278637864786578667867786878697870787178727873787478757876787778787879788078817882788378847885788678877888788978907891789278937894789578967897789878997900790179027903790479057906790779087909791079117912791379147915791679177918791979207921792279237924792579267927792879297930793179327933793479357936793779387939794079417942794379447945794679477948794979507951795279537954795579567957795879597960796179627963796479657966796779687969797079717972797379747975797679777978797979807981798279837984798579867987798879897990799179927993799479957996799779987999800080018002800380048005800680078008800980108011801280138014801580168017801880198020802180228023802480258026802780288029803080318032803380348035803680378038803980408041804280438044804580468047804880498050805180528053805480558056805780588059806080618062806380648065806680678068806980708071807280738074807580768077807880798080808180828083808480858086808780888089809080918092809380948095809680978098809981008101810281038104810581068107810881098110811181128113811481158116811781188119812081218122812381248125812681278128812981308131813281338134813581368137813881398140814181428143814481458146814781488149815081518152815381548155815681578158815981608161816281638164816581668167816881698170817181728173817481758176817781788179818081818182818381848185818681878188818981908191819281938194819581968197819881998200820182028203820482058206820782088209821082118212821382148215821682178218821982208221822282238224822582268227822882298230823182328233823482358236823782388239824082418242824382448245824682478248824982508251825282538254825582568257825882598260826182628263826482658266826782688269827082718272827382748275827682778278827982808281828282838284828582868287828882898290829182928293829482958296829782988299830083018302830383048305830683078308830983108311831283138314831583168317831883198320832183228323832483258326832783288329833083318332833383348335833683378338833983408341834283438344834583468347834883498350835183528353835483558356835783588359836083618362836383648365836683678368836983708371837283738374837583768377837883798380838183828383838483858386838783888389839083918392839383948395839683978398839984008401840284038404840584068407840884098410841184128413841484158416841784188419842084218422842384248425842684278428842984308431843284338434843584368437843884398440844184428443844484458446844784488449845084518452845384548455845684578458845984608461846284638464846584668467846884698470847184728473847484758476847784788479848084818482848384848485848684878488848984908491849284938494849584968497849884998500850185028503850485058506850785088509851085118512851385148515851685178518851985208521852285238524852585268527852885298530853185328533853485358536853785388539854085418542854385448545854685478548854985508551855285538554855585568557855885598560856185628563856485658566856785688569857085718572857385748575857685778578857985808581858285838584858585868587858885898590859185928593859485958596859785988599860086018602860386048605860686078608860986108611861286138614861586168617861886198620862186228623862486258626862786288629863086318632863386348635863686378638863986408641864286438644864586468647864886498650865186528653865486558656865786588659866086618662866386648665866686678668866986708671867286738674867586768677867886798680868186828683868486858686868786888689869086918692869386948695869686978698869987008701870287038704870587068707870887098710871187128713871487158716871787188719872087218722872387248725872687278728872987308731873287338734873587368737873887398740874187428743874487458746874787488749875087518752875387548755875687578758875987608761876287638764876587668767876887698770877187728773877487758776877787788779878087818782878387848785878687878788878987908791879287938794879587968797879887998800880188028803880488058806880788088809881088118812881388148815881688178818881988208821882288238824882588268827882888298830883188328833883488358836883788388839884088418842884388448845884688478848884988508851885288538854885588568857885888598860886188628863886488658866886788688869887088718872887388748875887688778878887988808881888288838884888588868887888888898890889188928893889488958896889788988899890089018902890389048905890689078908890989108911891289138914891589168917891889198920892189228923892489258926892789288929893089318932893389348935893689378938893989408941894289438944894589468947894889498950895189528953895489558956895789588959896089618962896389648965896689678968896989708971897289738974897589768977897889798980898189828983898489858986898789888989899089918992899389948995899689978998899990009001900290039004900590069007900890099010901190129013901490159016901790189019902090219022902390249025902690279028902990309031903290339034903590369037903890399040904190429043904490459046904790489049905090519052905390549055905690579058905990609061906290639064906590669067906890699070907190729073907490759076907790789079908090819082908390849085908690879088908990909091909290939094909590969097909890999100910191029103910491059106910791089109911091119112911391149115911691179118911991209121912291239124912591269127912891299130913191329133913491359136913791389139914091419142914391449145914691479148914991509151915291539154915591569157915891599160916191629163916491659166916791689169917091719172917391749175917691779178917991809181918291839184918591869187918891899190919191929193919491959196919791989199920092019202920392049205920692079208920992109211921292139214921592169217921892199220922192229223922492259226922792289229923092319232923392349235923692379238923992409241924292439244924592469247924892499250925192529253925492559256925792589259926092619262926392649265926692679268926992709271927292739274927592769277927892799280928192829283928492859286928792889289929092919292929392949295929692979298929993009301930293039304930593069307930893099310931193129313931493159316931793189319932093219322932393249325932693279328932993309331933293339334933593369337933893399340934193429343934493459346934793489349935093519352935393549355935693579358935993609361936293639364936593669367936893699370937193729373937493759376937793789379938093819382938393849385938693879388938993909391939293939394939593969397939893999400940194029403940494059406940794089409941094119412941394149415941694179418941994209421942294239424942594269427942894299430943194329433943494359436943794389439944094419442944394449445944694479448944994509451945294539454945594569457945894599460946194629463946494659466946794689469947094719472947394749475947694779478947994809481948294839484948594869487948894899490949194929493949494959496949794989499950095019502950395049505950695079508950995109511951295139514951595169517951895199520952195229523952495259526952795289529953095319532953395349535953695379538953995409541954295439544954595469547954895499550955195529553955495559556955795589559956095619562956395649565956695679568956995709571957295739574957595769577957895799580958195829583958495859586958795889589959095919592959395949595959695979598959996009601960296039604960596069607960896099610961196129613961496159616961796189619962096219622962396249625962696279628962996309631963296339634963596369637963896399640964196429643964496459646964796489649965096519652965396549655965696579658965996609661966296639664966596669667966896699670967196729673967496759676967796789679968096819682968396849685968696879688968996909691969296939694969596969697969896999700970197029703970497059706970797089709971097119712971397149715971697179718971997209721972297239724972597269727972897299730973197329733973497359736973797389739974097419742974397449745974697479748974997509751975297539754975597569757975897599760976197629763976497659766976797689769977097719772977397749775977697779778977997809781978297839784978597869787978897899790979197929793979497959796979797989799980098019802980398049805980698079808980998109811981298139814981598169817981898199820982198229823982498259826982798289829983098319832983398349835983698379838983998409841984298439844984598469847984898499850985198529853985498559856985798589859986098619862986398649865986698679868986998709871987298739874987598769877987898799880988198829883988498859886988798889889989098919892989398949895989698979898989999009901990299039904990599069907990899099910991199129913991499159916991799189919992099219922992399249925992699279928992999309931993299339934993599369937993899399940994199429943994499459946994799489949995099519952995399549955995699579958995999609961996299639964996599669967996899699970997199729973997499759976997799789979998099819982998399849985998699879988998999909991999299939994999599969997999899991000010001100021000310004100051000610007100081000910010100111001210013100141001510016100171001810019100201002110022100231002410025100261002710028100291003010031100321003310034100351003610037100381003910040100411004210043100441004510046100471004810049100501005110052100531005410055100561005710058100591006010061100621006310064100651006610067100681006910070100711007210073100741007510076100771007810079100801008110082100831008410085100861008710088100891009010091100921009310094100951009610097100981009910100101011010210103101041010510106101071010810109101101011110112101131011410115101161011710118101191012010121101221012310124101251012610127101281012910130101311013210133101341013510136101371013810139101401014110142101431014410145101461014710148101491015010151101521015310154101551015610157101581015910160101611016210163101641016510166101671016810169101701017110172101731017410175101761017710178101791018010181101821018310184101851018610187101881018910190101911019210193101941019510196101971019810199102001020110202102031020410205102061020710208102091021010211102121021310214102151021610217102181021910220102211022210223102241022510226102271022810229102301023110232102331023410235102361023710238102391024010241102421024310244102451024610247102481024910250102511025210253102541025510256102571025810259102601026110262102631026410265102661026710268102691027010271102721027310274102751027610277102781027910280102811028210283102841028510286102871028810289102901029110292102931029410295102961029710298102991030010301103021030310304103051030610307103081030910310103111031210313103141031510316103171031810319103201032110322103231032410325103261032710328103291033010331103321033310334103351033610337103381033910340103411034210343103441034510346103471034810349103501035110352103531035410355103561035710358103591036010361103621036310364103651036610367103681036910370103711037210373103741037510376103771037810379103801038110382103831038410385103861038710388103891039010391103921039310394103951039610397103981039910400104011040210403104041040510406104071040810409104101041110412104131041410415104161041710418104191042010421104221042310424104251042610427104281042910430104311043210433104341043510436104371043810439104401044110442104431044410445104461044710448104491045010451104521045310454104551045610457104581045910460104611046210463104641046510466104671046810469104701047110472104731047410475104761047710478104791048010481104821048310484104851048610487104881048910490104911049210493104941049510496104971049810499105001050110502105031050410505105061050710508105091051010511105121051310514105151051610517105181051910520105211052210523105241052510526105271052810529105301053110532105331053410535105361053710538105391054010541105421054310544105451054610547105481054910550105511055210553105541055510556105571055810559105601056110562105631056410565105661056710568105691057010571105721057310574105751057610577105781057910580105811058210583105841058510586105871058810589105901059110592105931059410595105961059710598105991060010601106021060310604106051060610607106081060910610106111061210613106141061510616106171061810619106201062110622106231062410625106261062710628106291063010631106321063310634106351063610637106381063910640106411064210643106441064510646106471064810649106501065110652106531065410655106561065710658106591066010661106621066310664106651066610667106681066910670106711067210673106741067510676106771067810679106801068110682106831068410685106861068710688106891069010691106921069310694106951069610697106981069910700107011070210703107041070510706107071070810709107101071110712107131071410715107161071710718107191072010721107221072310724107251072610727107281072910730107311073210733107341073510736107371073810739107401074110742107431074410745107461074710748107491075010751107521075310754107551075610757107581075910760107611076210763107641076510766107671076810769107701077110772107731077410775107761077710778107791078010781107821078310784107851078610787107881078910790107911079210793107941079510796107971079810799108001080110802108031080410805108061080710808108091081010811108121081310814108151081610817108181081910820108211082210823108241082510826108271082810829108301083110832108331083410835108361083710838108391084010841108421084310844108451084610847108481084910850108511085210853108541085510856108571085810859108601086110862108631086410865108661086710868108691087010871108721087310874108751087610877108781087910880108811088210883108841088510886108871088810889108901089110892108931089410895108961089710898108991090010901109021090310904109051090610907109081090910910109111091210913109141091510916109171091810919109201092110922109231092410925109261092710928109291093010931109321093310934109351093610937109381093910940109411094210943109441094510946109471094810949109501095110952109531095410955109561095710958109591096010961109621096310964109651096610967109681096910970109711097210973109741097510976109771097810979109801098110982109831098410985109861098710988109891099010991109921099310994109951099610997109981099911000110011100211003110041100511006110071100811009110101101111012110131101411015110161101711018110191102011021110221102311024110251102611027110281102911030110311103211033110341103511036110371103811039110401104111042110431104411045110461104711048110491105011051110521105311054110551105611057110581105911060110611106211063110641106511066110671106811069110701107111072110731107411075110761107711078110791108011081110821108311084110851108611087110881108911090110911109211093110941109511096110971109811099111001110111102111031110411105111061110711108111091111011111111121111311114111151111611117111181111911120111211112211123111241112511126111271112811129111301113111132111331113411135111361113711138111391114011141111421114311144111451114611147111481114911150111511115211153111541115511156111571115811159111601116111162111631116411165111661116711168111691117011171111721117311174111751117611177111781117911180111811118211183111841118511186111871118811189111901119111192111931119411195111961119711198111991120011201112021120311204112051120611207112081120911210112111121211213112141121511216112171121811219112201122111222112231122411225112261122711228112291123011231112321123311234112351123611237112381123911240112411124211243112441124511246112471124811249112501125111252112531125411255112561125711258112591126011261112621126311264112651126611267112681126911270112711127211273112741127511276112771127811279112801128111282112831128411285112861128711288112891129011291112921129311294112951129611297112981129911300113011130211303113041130511306113071130811309113101131111312113131131411315113161131711318113191132011321113221132311324113251132611327113281132911330113311133211333113341133511336113371133811339113401134111342113431134411345113461134711348113491135011351113521135311354113551135611357113581135911360113611136211363113641136511366113671136811369113701137111372113731137411375113761137711378113791138011381113821138311384113851138611387113881138911390113911139211393113941139511396113971139811399114001140111402114031140411405114061140711408114091141011411114121141311414114151141611417114181141911420114211142211423114241142511426114271142811429114301143111432114331143411435114361143711438114391144011441114421144311444114451144611447114481144911450114511145211453114541145511456114571145811459114601146111462114631146411465114661146711468114691147011471114721147311474114751147611477114781147911480114811148211483114841148511486114871148811489114901149111492114931149411495114961149711498114991150011501115021150311504115051150611507115081150911510115111151211513115141151511516115171151811519115201152111522115231152411525115261152711528115291153011531115321153311534115351153611537115381153911540115411154211543115441154511546115471154811549115501155111552115531155411555115561155711558115591156011561115621156311564115651156611567115681156911570115711157211573115741157511576115771157811579115801158111582115831158411585115861158711588115891159011591115921159311594115951159611597115981159911600116011160211603116041160511606116071160811609116101161111612116131161411615116161161711618116191162011621116221162311624116251162611627116281162911630116311163211633116341163511636116371163811639116401164111642116431164411645116461164711648116491165011651116521165311654116551165611657116581165911660116611166211663116641166511666116671166811669116701167111672116731167411675116761167711678116791168011681116821168311684116851168611687116881168911690116911169211693116941169511696116971169811699117001170111702117031170411705117061170711708117091171011711117121171311714117151171611717117181171911720117211172211723117241172511726117271172811729117301173111732117331173411735117361173711738117391174011741117421174311744117451174611747117481174911750117511175211753117541175511756117571175811759117601176111762117631176411765117661176711768117691177011771117721177311774117751177611777117781177911780117811178211783117841178511786117871178811789117901179111792117931179411795117961179711798117991180011801118021180311804118051180611807118081180911810118111181211813118141181511816118171181811819118201182111822118231182411825118261182711828118291183011831118321183311834118351183611837118381183911840118411184211843118441184511846118471184811849118501185111852118531185411855118561185711858118591186011861118621186311864118651186611867118681186911870118711187211873118741187511876118771187811879118801188111882118831188411885118861188711888118891189011891118921189311894118951189611897118981189911900119011190211903119041190511906119071190811909119101191111912119131191411915119161191711918119191192011921119221192311924119251192611927119281192911930119311193211933119341193511936119371193811939119401194111942119431194411945119461194711948119491195011951119521195311954119551195611957119581195911960119611196211963119641196511966119671196811969119701197111972119731197411975119761197711978119791198011981119821198311984119851198611987119881198911990119911199211993119941199511996119971199811999120001200112002120031200412005120061200712008120091201012011120121201312014120151201612017120181201912020120211202212023120241202512026120271202812029120301203112032120331203412035120361203712038120391204012041120421204312044120451204612047120481204912050120511205212053120541205512056120571205812059120601206112062120631206412065120661206712068120691207012071120721207312074120751207612077120781207912080120811208212083120841208512086120871208812089120901209112092120931209412095120961209712098120991210012101121021210312104121051210612107121081210912110121111211212113121141211512116121171211812119121201212112122121231212412125121261212712128121291213012131121321213312134121351213612137121381213912140121411214212143121441214512146121471214812149121501215112152121531215412155121561215712158121591216012161121621216312164121651216612167121681216912170121711217212173121741217512176121771217812179121801218112182121831218412185121861218712188121891219012191121921219312194121951219612197121981219912200122011220212203122041220512206122071220812209122101221112212122131221412215122161221712218122191222012221122221222312224122251222612227122281222912230122311223212233122341223512236122371223812239122401224112242122431224412245122461224712248122491225012251122521225312254122551225612257122581225912260122611226212263122641226512266122671226812269122701227112272122731227412275122761227712278122791228012281122821228312284122851228612287122881228912290122911229212293122941229512296122971229812299123001230112302123031230412305123061230712308123091231012311123121231312314123151231612317123181231912320123211232212323123241232512326123271232812329123301233112332123331233412335123361233712338123391234012341123421234312344123451234612347123481234912350123511235212353123541235512356123571235812359123601236112362123631236412365123661236712368123691237012371123721237312374123751237612377123781237912380123811238212383123841238512386123871238812389123901239112392123931239412395123961239712398123991240012401124021240312404124051240612407124081240912410124111241212413124141241512416124171241812419124201242112422124231242412425124261242712428124291243012431124321243312434124351243612437124381243912440124411244212443124441244512446124471244812449124501245112452124531245412455124561245712458124591246012461124621246312464124651246612467124681246912470124711247212473124741247512476124771247812479124801248112482124831248412485124861248712488124891249012491124921249312494124951249612497124981249912500125011250212503125041250512506125071250812509125101251112512125131251412515125161251712518125191252012521125221252312524125251252612527125281252912530125311253212533125341253512536125371253812539125401254112542125431254412545125461254712548125491255012551125521255312554125551255612557125581255912560125611256212563125641256512566125671256812569125701257112572125731257412575125761257712578125791258012581125821258312584125851258612587125881258912590125911259212593125941259512596125971259812599126001260112602126031260412605126061260712608126091261012611126121261312614126151261612617126181261912620126211262212623126241262512626126271262812629126301263112632126331263412635126361263712638126391264012641126421264312644126451264612647126481264912650126511265212653126541265512656126571265812659126601266112662126631266412665126661266712668126691267012671126721267312674126751267612677126781267912680126811268212683126841268512686126871268812689126901269112692126931269412695126961269712698126991270012701127021270312704127051270612707127081270912710127111271212713127141271512716127171271812719127201272112722127231272412725127261272712728127291273012731127321273312734127351273612737127381273912740127411274212743127441274512746127471274812749127501275112752127531275412755127561275712758127591276012761127621276312764127651276612767127681276912770127711277212773127741277512776127771277812779127801278112782127831278412785127861278712788127891279012791127921279312794127951279612797127981279912800128011280212803128041280512806128071280812809128101281112812128131281412815128161281712818128191282012821128221282312824128251282612827128281282912830128311283212833128341283512836128371283812839128401284112842128431284412845128461284712848128491285012851128521285312854128551285612857128581285912860128611286212863128641286512866128671286812869128701287112872128731287412875128761287712878128791288012881128821288312884128851288612887128881288912890128911289212893128941289512896128971289812899129001290112902129031290412905129061290712908129091291012911129121291312914129151291612917129181291912920129211292212923129241292512926129271292812929129301293112932129331293412935129361293712938129391294012941129421294312944129451294612947129481294912950129511295212953129541295512956129571295812959129601296112962129631296412965129661296712968129691297012971129721297312974129751297612977129781297912980129811298212983129841298512986129871298812989129901299112992129931299412995129961299712998129991300013001130021300313004130051300613007130081300913010130111301213013130141301513016130171301813019130201302113022130231302413025130261302713028130291303013031130321303313034130351303613037130381303913040130411304213043130441304513046130471304813049130501305113052130531305413055130561305713058130591306013061130621306313064130651306613067130681306913070130711307213073130741307513076130771307813079130801308113082130831308413085130861308713088130891309013091130921309313094130951309613097130981309913100131011310213103131041310513106131071310813109131101311113112131131311413115131161311713118131191312013121131221312313124131251312613127131281312913130131311313213133131341313513136131371313813139131401314113142131431314413145131461314713148131491315013151131521315313154131551315613157131581315913160131611316213163131641316513166131671316813169131701317113172131731317413175131761317713178131791318013181131821318313184131851318613187131881318913190131911319213193131941319513196131971319813199132001320113202132031320413205132061320713208132091321013211132121321313214132151321613217132181321913220132211322213223132241322513226132271322813229132301323113232132331323413235132361323713238132391324013241132421324313244132451324613247132481324913250132511325213253132541325513256132571325813259132601326113262132631326413265132661326713268132691327013271132721327313274132751327613277132781327913280132811328213283132841328513286132871328813289132901329113292132931329413295132961329713298132991330013301133021330313304133051330613307133081330913310133111331213313133141331513316133171331813319133201332113322133231332413325133261332713328133291333013331133321333313334133351333613337133381333913340133411334213343133441334513346133471334813349133501335113352133531335413355133561335713358133591336013361133621336313364133651336613367133681336913370133711337213373133741337513376133771337813379133801338113382133831338413385133861338713388133891339013391133921339313394133951339613397133981339913400134011340213403134041340513406134071340813409134101341113412134131341413415134161341713418134191342013421134221342313424134251342613427134281342913430134311343213433134341343513436134371343813439134401344113442134431344413445134461344713448134491345013451134521345313454134551345613457134581345913460134611346213463134641346513466134671346813469134701347113472134731347413475134761347713478134791348013481134821348313484134851348613487134881348913490134911349213493134941349513496134971349813499135001350113502135031350413505135061350713508135091351013511135121351313514135151351613517135181351913520135211352213523135241352513526135271352813529135301353113532135331353413535135361353713538135391354013541135421354313544135451354613547135481354913550135511355213553135541355513556135571355813559135601356113562135631356413565135661356713568135691357013571135721357313574135751357613577135781357913580135811358213583135841358513586135871358813589135901359113592135931359413595135961359713598135991360013601136021360313604136051360613607136081360913610136111361213613136141361513616136171361813619136201362113622136231362413625136261362713628136291363013631136321363313634136351363613637136381363913640136411364213643136441364513646136471364813649136501365113652136531365413655136561365713658136591366013661136621366313664136651366613667136681366913670136711367213673136741367513676136771367813679136801368113682136831368413685136861368713688136891369013691136921369313694136951369613697136981369913700137011370213703137041370513706137071370813709137101371113712137131371413715137161371713718137191372013721137221372313724137251372613727137281372913730137311373213733137341373513736137371373813739137401374113742137431374413745137461374713748137491375013751137521375313754137551375613757137581375913760137611376213763137641376513766137671376813769137701377113772137731377413775137761377713778137791378013781137821378313784137851378613787137881378913790137911379213793137941379513796137971379813799138001380113802138031380413805138061380713808138091381013811138121381313814138151381613817138181381913820138211382213823138241382513826138271382813829138301383113832138331383413835138361383713838138391384013841138421384313844138451384613847138481384913850138511385213853138541385513856138571385813859138601386113862138631386413865138661386713868138691387013871138721387313874138751387613877138781387913880138811388213883138841388513886138871388813889138901389113892138931389413895138961389713898138991390013901139021390313904139051390613907139081390913910139111391213913139141391513916139171391813919139201392113922139231392413925139261392713928139291393013931139321393313934139351393613937139381393913940139411394213943139441394513946139471394813949139501395113952139531395413955139561395713958139591396013961139621396313964139651396613967139681396913970139711397213973139741397513976139771397813979139801398113982139831398413985139861398713988139891399013991139921399313994139951399613997139981399914000140011400214003140041400514006140071400814009140101401114012140131401414015140161401714018140191402014021140221402314024140251402614027140281402914030140311403214033140341403514036140371403814039140401404114042140431404414045140461404714048140491405014051140521405314054140551405614057140581405914060140611406214063140641406514066140671406814069140701407114072140731407414075140761407714078140791408014081140821408314084140851408614087140881408914090140911409214093140941409514096140971409814099141001410114102141031410414105141061410714108141091411014111141121411314114141151411614117141181411914120141211412214123141241412514126141271412814129141301413114132141331413414135141361413714138141391414014141141421414314144141451414614147141481414914150141511415214153141541415514156141571415814159141601416114162141631416414165141661416714168141691417014171141721417314174141751417614177141781417914180141811418214183141841418514186141871418814189141901419114192141931419414195141961419714198141991420014201142021420314204142051420614207142081420914210142111421214213142141421514216142171421814219142201422114222142231422414225142261422714228142291423014231142321423314234142351423614237142381423914240142411424214243142441424514246142471424814249142501425114252142531425414255142561425714258142591426014261142621426314264142651426614267142681426914270142711427214273142741427514276142771427814279142801428114282142831428414285142861428714288142891429014291142921429314294142951429614297142981429914300143011430214303143041430514306143071430814309143101431114312143131431414315143161431714318143191432014321143221432314324143251432614327143281432914330143311433214333143341433514336143371433814339143401434114342143431434414345143461434714348143491435014351143521435314354143551435614357143581435914360143611436214363143641436514366143671436814369143701437114372143731437414375143761437714378143791438014381143821438314384143851438614387143881438914390143911439214393143941439514396143971439814399144001440114402144031440414405144061440714408144091441014411144121441314414144151441614417144181441914420144211442214423144241442514426144271442814429144301443114432144331443414435144361443714438144391444014441144421444314444144451444614447144481444914450144511445214453144541445514456144571445814459144601446114462144631446414465144661446714468144691447014471144721447314474144751447614477144781447914480144811448214483144841448514486144871448814489144901449114492144931449414495144961449714498144991450014501145021450314504145051450614507145081450914510145111451214513145141451514516145171451814519145201452114522145231452414525145261452714528145291453014531145321453314534145351453614537145381453914540145411454214543145441454514546145471454814549145501455114552145531455414555145561455714558145591456014561145621456314564145651456614567145681456914570145711457214573145741457514576145771457814579145801458114582145831458414585145861458714588145891459014591145921459314594145951459614597145981459914600146011460214603146041460514606146071460814609146101461114612146131461414615146161461714618146191462014621146221462314624146251462614627146281462914630146311463214633146341463514636146371463814639146401464114642146431464414645146461464714648146491465014651146521465314654146551465614657146581465914660146611466214663146641466514666146671466814669146701467114672146731467414675146761467714678146791468014681146821468314684146851468614687146881468914690146911469214693146941469514696146971469814699147001470114702147031470414705147061470714708147091471014711147121471314714147151471614717147181471914720147211472214723147241472514726147271472814729147301473114732147331473414735147361473714738147391474014741147421474314744147451474614747147481474914750147511475214753147541475514756147571475814759147601476114762147631476414765147661476714768147691477014771147721477314774147751477614777147781477914780147811478214783147841478514786147871478814789147901479114792147931479414795147961479714798147991480014801148021480314804148051480614807148081480914810148111481214813148141481514816148171481814819148201482114822148231482414825148261482714828148291483014831148321483314834148351483614837148381483914840148411484214843148441484514846148471484814849148501485114852148531485414855148561485714858148591486014861148621486314864148651486614867148681486914870148711487214873148741487514876148771487814879148801488114882148831488414885148861488714888148891489014891148921489314894148951489614897148981489914900149011490214903149041490514906149071490814909149101491114912149131491414915149161491714918149191492014921149221492314924149251492614927149281492914930149311493214933149341493514936149371493814939149401494114942149431494414945149461494714948149491495014951149521495314954149551495614957149581495914960149611496214963149641496514966149671496814969149701497114972149731497414975149761497714978149791498014981149821498314984149851498614987149881498914990149911499214993149941499514996149971499814999150001500115002150031500415005150061500715008150091501015011150121501315014150151501615017150181501915020150211502215023150241502515026150271502815029150301503115032150331503415035150361503715038150391504015041150421504315044150451504615047150481504915050150511505215053150541505515056150571505815059150601506115062150631506415065150661506715068150691507015071150721507315074150751507615077150781507915080150811508215083150841508515086150871508815089150901509115092150931509415095150961509715098150991510015101151021510315104151051510615107151081510915110151111511215113151141511515116151171511815119151201512115122151231512415125151261512715128151291513015131151321513315134151351513615137151381513915140151411514215143151441514515146151471514815149151501515115152151531515415155151561515715158151591516015161151621516315164151651516615167151681516915170151711517215173151741517515176151771517815179151801518115182151831518415185151861518715188151891519015191151921519315194151951519615197151981519915200152011520215203152041520515206152071520815209152101521115212152131521415215152161521715218152191522015221152221522315224152251522615227152281522915230152311523215233152341523515236152371523815239152401524115242152431524415245152461524715248152491525015251152521525315254152551525615257152581525915260152611526215263152641526515266152671526815269152701527115272152731527415275152761527715278152791528015281152821528315284152851528615287152881528915290152911529215293152941529515296152971529815299153001530115302153031530415305153061530715308153091531015311153121531315314153151531615317153181531915320153211532215323153241532515326153271532815329153301533115332153331533415335153361533715338153391534015341153421534315344153451534615347153481534915350153511535215353153541535515356153571535815359153601536115362153631536415365153661536715368153691537015371153721537315374153751537615377153781537915380153811538215383153841538515386153871538815389153901539115392153931539415395153961539715398153991540015401154021540315404154051540615407154081540915410154111541215413154141541515416154171541815419154201542115422154231542415425154261542715428154291543015431154321543315434154351543615437154381543915440154411544215443154441544515446154471544815449154501545115452154531545415455154561545715458154591546015461154621546315464154651546615467154681546915470154711547215473154741547515476154771547815479154801548115482154831548415485154861548715488154891549015491154921549315494154951549615497154981549915500155011550215503155041550515506155071550815509155101551115512155131551415515155161551715518155191552015521155221552315524155251552615527155281552915530155311553215533155341553515536155371553815539155401554115542155431554415545155461554715548155491555015551155521555315554155551555615557155581555915560155611556215563155641556515566155671556815569155701557115572155731557415575155761557715578155791558015581155821558315584155851558615587155881558915590155911559215593155941559515596155971559815599156001560115602156031560415605156061560715608156091561015611156121561315614156151561615617156181561915620156211562215623156241562515626156271562815629
  1. module.exports =
  2. /******/ (function(modules) { // webpackBootstrap
  3. /******/ // The module cache
  4. /******/ var installedModules = {};
  5. /******/
  6. /******/ // The require function
  7. /******/ function __webpack_require__(moduleId) {
  8. /******/
  9. /******/ // Check if module is in cache
  10. /******/ if(installedModules[moduleId]) {
  11. /******/ return installedModules[moduleId].exports;
  12. /******/ }
  13. /******/ // Create a new module (and put it into the cache)
  14. /******/ var module = installedModules[moduleId] = {
  15. /******/ i: moduleId,
  16. /******/ l: false,
  17. /******/ exports: {}
  18. /******/ };
  19. /******/
  20. /******/ // Execute the module function
  21. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  22. /******/
  23. /******/ // Flag the module as loaded
  24. /******/ module.l = true;
  25. /******/
  26. /******/ // Return the exports of the module
  27. /******/ return module.exports;
  28. /******/ }
  29. /******/
  30. /******/
  31. /******/ // expose the modules object (__webpack_modules__)
  32. /******/ __webpack_require__.m = modules;
  33. /******/
  34. /******/ // expose the module cache
  35. /******/ __webpack_require__.c = installedModules;
  36. /******/
  37. /******/ // define getter function for harmony exports
  38. /******/ __webpack_require__.d = function(exports, name, getter) {
  39. /******/ if(!__webpack_require__.o(exports, name)) {
  40. /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
  41. /******/ }
  42. /******/ };
  43. /******/
  44. /******/ // define __esModule on exports
  45. /******/ __webpack_require__.r = function(exports) {
  46. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  47. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  48. /******/ }
  49. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  50. /******/ };
  51. /******/
  52. /******/ // create a fake namespace object
  53. /******/ // mode & 1: value is a module id, require it
  54. /******/ // mode & 2: merge all properties of value into the ns
  55. /******/ // mode & 4: return value when already ns object
  56. /******/ // mode & 8|1: behave like require
  57. /******/ __webpack_require__.t = function(value, mode) {
  58. /******/ if(mode & 1) value = __webpack_require__(value);
  59. /******/ if(mode & 8) return value;
  60. /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
  61. /******/ var ns = Object.create(null);
  62. /******/ __webpack_require__.r(ns);
  63. /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
  64. /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
  65. /******/ return ns;
  66. /******/ };
  67. /******/
  68. /******/ // getDefaultExport function for compatibility with non-harmony modules
  69. /******/ __webpack_require__.n = function(module) {
  70. /******/ var getter = module && module.__esModule ?
  71. /******/ function getDefault() { return module['default']; } :
  72. /******/ function getModuleExports() { return module; };
  73. /******/ __webpack_require__.d(getter, 'a', getter);
  74. /******/ return getter;
  75. /******/ };
  76. /******/
  77. /******/ // Object.prototype.hasOwnProperty.call
  78. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  79. /******/
  80. /******/ // __webpack_public_path__
  81. /******/ __webpack_require__.p = "";
  82. /******/
  83. /******/
  84. /******/ // Load entry module and return exports
  85. /******/ return __webpack_require__(__webpack_require__.s = "9896");
  86. /******/ })
  87. /************************************************************************/
  88. /******/ ({
  89. /***/ "0126":
  90. /***/ (function(module, exports, __webpack_require__) {
  91. /* WEBPACK VAR INJECTION */(function(Buffer) {/*!
  92. * Quill Editor v1.3.7
  93. * https://quilljs.com/
  94. * Copyright (c) 2014, Jason Chen
  95. * Copyright (c) 2013, salesforce.com
  96. */
  97. (function webpackUniversalModuleDefinition(root, factory) {
  98. if(true)
  99. module.exports = factory();
  100. else {}
  101. })(typeof self !== 'undefined' ? self : this, function() {
  102. return /******/ (function(modules) { // webpackBootstrap
  103. /******/ // The module cache
  104. /******/ var installedModules = {};
  105. /******/
  106. /******/ // The require function
  107. /******/ function __webpack_require__(moduleId) {
  108. /******/
  109. /******/ // Check if module is in cache
  110. /******/ if(installedModules[moduleId]) {
  111. /******/ return installedModules[moduleId].exports;
  112. /******/ }
  113. /******/ // Create a new module (and put it into the cache)
  114. /******/ var module = installedModules[moduleId] = {
  115. /******/ i: moduleId,
  116. /******/ l: false,
  117. /******/ exports: {}
  118. /******/ };
  119. /******/
  120. /******/ // Execute the module function
  121. /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
  122. /******/
  123. /******/ // Flag the module as loaded
  124. /******/ module.l = true;
  125. /******/
  126. /******/ // Return the exports of the module
  127. /******/ return module.exports;
  128. /******/ }
  129. /******/
  130. /******/
  131. /******/ // expose the modules object (__webpack_modules__)
  132. /******/ __webpack_require__.m = modules;
  133. /******/
  134. /******/ // expose the module cache
  135. /******/ __webpack_require__.c = installedModules;
  136. /******/
  137. /******/ // define getter function for harmony exports
  138. /******/ __webpack_require__.d = function(exports, name, getter) {
  139. /******/ if(!__webpack_require__.o(exports, name)) {
  140. /******/ Object.defineProperty(exports, name, {
  141. /******/ configurable: false,
  142. /******/ enumerable: true,
  143. /******/ get: getter
  144. /******/ });
  145. /******/ }
  146. /******/ };
  147. /******/
  148. /******/ // getDefaultExport function for compatibility with non-harmony modules
  149. /******/ __webpack_require__.n = function(module) {
  150. /******/ var getter = module && module.__esModule ?
  151. /******/ function getDefault() { return module['default']; } :
  152. /******/ function getModuleExports() { return module; };
  153. /******/ __webpack_require__.d(getter, 'a', getter);
  154. /******/ return getter;
  155. /******/ };
  156. /******/
  157. /******/ // Object.prototype.hasOwnProperty.call
  158. /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
  159. /******/
  160. /******/ // __webpack_public_path__
  161. /******/ __webpack_require__.p = "";
  162. /******/
  163. /******/ // Load entry module and return exports
  164. /******/ return __webpack_require__(__webpack_require__.s = 109);
  165. /******/ })
  166. /************************************************************************/
  167. /******/ ([
  168. /* 0 */
  169. /***/ (function(module, exports, __webpack_require__) {
  170. "use strict";
  171. Object.defineProperty(exports, "__esModule", { value: true });
  172. var container_1 = __webpack_require__(17);
  173. var format_1 = __webpack_require__(18);
  174. var leaf_1 = __webpack_require__(19);
  175. var scroll_1 = __webpack_require__(45);
  176. var inline_1 = __webpack_require__(46);
  177. var block_1 = __webpack_require__(47);
  178. var embed_1 = __webpack_require__(48);
  179. var text_1 = __webpack_require__(49);
  180. var attributor_1 = __webpack_require__(12);
  181. var class_1 = __webpack_require__(32);
  182. var style_1 = __webpack_require__(33);
  183. var store_1 = __webpack_require__(31);
  184. var Registry = __webpack_require__(1);
  185. var Parchment = {
  186. Scope: Registry.Scope,
  187. create: Registry.create,
  188. find: Registry.find,
  189. query: Registry.query,
  190. register: Registry.register,
  191. Container: container_1.default,
  192. Format: format_1.default,
  193. Leaf: leaf_1.default,
  194. Embed: embed_1.default,
  195. Scroll: scroll_1.default,
  196. Block: block_1.default,
  197. Inline: inline_1.default,
  198. Text: text_1.default,
  199. Attributor: {
  200. Attribute: attributor_1.default,
  201. Class: class_1.default,
  202. Style: style_1.default,
  203. Store: store_1.default,
  204. },
  205. };
  206. exports.default = Parchment;
  207. /***/ }),
  208. /* 1 */
  209. /***/ (function(module, exports, __webpack_require__) {
  210. "use strict";
  211. var __extends = (this && this.__extends) || (function () {
  212. var extendStatics = Object.setPrototypeOf ||
  213. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  214. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  215. return function (d, b) {
  216. extendStatics(d, b);
  217. function __() { this.constructor = d; }
  218. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  219. };
  220. })();
  221. Object.defineProperty(exports, "__esModule", { value: true });
  222. var ParchmentError = /** @class */ (function (_super) {
  223. __extends(ParchmentError, _super);
  224. function ParchmentError(message) {
  225. var _this = this;
  226. message = '[Parchment] ' + message;
  227. _this = _super.call(this, message) || this;
  228. _this.message = message;
  229. _this.name = _this.constructor.name;
  230. return _this;
  231. }
  232. return ParchmentError;
  233. }(Error));
  234. exports.ParchmentError = ParchmentError;
  235. var attributes = {};
  236. var classes = {};
  237. var tags = {};
  238. var types = {};
  239. exports.DATA_KEY = '__blot';
  240. var Scope;
  241. (function (Scope) {
  242. Scope[Scope["TYPE"] = 3] = "TYPE";
  243. Scope[Scope["LEVEL"] = 12] = "LEVEL";
  244. Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE";
  245. Scope[Scope["BLOT"] = 14] = "BLOT";
  246. Scope[Scope["INLINE"] = 7] = "INLINE";
  247. Scope[Scope["BLOCK"] = 11] = "BLOCK";
  248. Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT";
  249. Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT";
  250. Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE";
  251. Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE";
  252. Scope[Scope["ANY"] = 15] = "ANY";
  253. })(Scope = exports.Scope || (exports.Scope = {}));
  254. function create(input, value) {
  255. var match = query(input);
  256. if (match == null) {
  257. throw new ParchmentError("Unable to create " + input + " blot");
  258. }
  259. var BlotClass = match;
  260. var node =
  261. // @ts-ignore
  262. input instanceof Node || input['nodeType'] === Node.TEXT_NODE ? input : BlotClass.create(value);
  263. return new BlotClass(node, value);
  264. }
  265. exports.create = create;
  266. function find(node, bubble) {
  267. if (bubble === void 0) { bubble = false; }
  268. if (node == null)
  269. return null;
  270. // @ts-ignore
  271. if (node[exports.DATA_KEY] != null)
  272. return node[exports.DATA_KEY].blot;
  273. if (bubble)
  274. return find(node.parentNode, bubble);
  275. return null;
  276. }
  277. exports.find = find;
  278. function query(query, scope) {
  279. if (scope === void 0) { scope = Scope.ANY; }
  280. var match;
  281. if (typeof query === 'string') {
  282. match = types[query] || attributes[query];
  283. // @ts-ignore
  284. }
  285. else if (query instanceof Text || query['nodeType'] === Node.TEXT_NODE) {
  286. match = types['text'];
  287. }
  288. else if (typeof query === 'number') {
  289. if (query & Scope.LEVEL & Scope.BLOCK) {
  290. match = types['block'];
  291. }
  292. else if (query & Scope.LEVEL & Scope.INLINE) {
  293. match = types['inline'];
  294. }
  295. }
  296. else if (query instanceof HTMLElement) {
  297. var names = (query.getAttribute('class') || '').split(/\s+/);
  298. for (var i in names) {
  299. match = classes[names[i]];
  300. if (match)
  301. break;
  302. }
  303. match = match || tags[query.tagName];
  304. }
  305. if (match == null)
  306. return null;
  307. // @ts-ignore
  308. if (scope & Scope.LEVEL & match.scope && scope & Scope.TYPE & match.scope)
  309. return match;
  310. return null;
  311. }
  312. exports.query = query;
  313. function register() {
  314. var Definitions = [];
  315. for (var _i = 0; _i < arguments.length; _i++) {
  316. Definitions[_i] = arguments[_i];
  317. }
  318. if (Definitions.length > 1) {
  319. return Definitions.map(function (d) {
  320. return register(d);
  321. });
  322. }
  323. var Definition = Definitions[0];
  324. if (typeof Definition.blotName !== 'string' && typeof Definition.attrName !== 'string') {
  325. throw new ParchmentError('Invalid definition');
  326. }
  327. else if (Definition.blotName === 'abstract') {
  328. throw new ParchmentError('Cannot register abstract class');
  329. }
  330. types[Definition.blotName || Definition.attrName] = Definition;
  331. if (typeof Definition.keyName === 'string') {
  332. attributes[Definition.keyName] = Definition;
  333. }
  334. else {
  335. if (Definition.className != null) {
  336. classes[Definition.className] = Definition;
  337. }
  338. if (Definition.tagName != null) {
  339. if (Array.isArray(Definition.tagName)) {
  340. Definition.tagName = Definition.tagName.map(function (tagName) {
  341. return tagName.toUpperCase();
  342. });
  343. }
  344. else {
  345. Definition.tagName = Definition.tagName.toUpperCase();
  346. }
  347. var tagNames = Array.isArray(Definition.tagName) ? Definition.tagName : [Definition.tagName];
  348. tagNames.forEach(function (tag) {
  349. if (tags[tag] == null || Definition.className == null) {
  350. tags[tag] = Definition;
  351. }
  352. });
  353. }
  354. }
  355. return Definition;
  356. }
  357. exports.register = register;
  358. /***/ }),
  359. /* 2 */
  360. /***/ (function(module, exports, __webpack_require__) {
  361. var diff = __webpack_require__(51);
  362. var equal = __webpack_require__(11);
  363. var extend = __webpack_require__(3);
  364. var op = __webpack_require__(20);
  365. var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff()
  366. var Delta = function (ops) {
  367. // Assume we are given a well formed ops
  368. if (Array.isArray(ops)) {
  369. this.ops = ops;
  370. } else if (ops != null && Array.isArray(ops.ops)) {
  371. this.ops = ops.ops;
  372. } else {
  373. this.ops = [];
  374. }
  375. };
  376. Delta.prototype.insert = function (text, attributes) {
  377. var newOp = {};
  378. if (text.length === 0) return this;
  379. newOp.insert = text;
  380. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  381. newOp.attributes = attributes;
  382. }
  383. return this.push(newOp);
  384. };
  385. Delta.prototype['delete'] = function (length) {
  386. if (length <= 0) return this;
  387. return this.push({ 'delete': length });
  388. };
  389. Delta.prototype.retain = function (length, attributes) {
  390. if (length <= 0) return this;
  391. var newOp = { retain: length };
  392. if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) {
  393. newOp.attributes = attributes;
  394. }
  395. return this.push(newOp);
  396. };
  397. Delta.prototype.push = function (newOp) {
  398. var index = this.ops.length;
  399. var lastOp = this.ops[index - 1];
  400. newOp = extend(true, {}, newOp);
  401. if (typeof lastOp === 'object') {
  402. if (typeof newOp['delete'] === 'number' && typeof lastOp['delete'] === 'number') {
  403. this.ops[index - 1] = { 'delete': lastOp['delete'] + newOp['delete'] };
  404. return this;
  405. }
  406. // Since it does not matter if we insert before or after deleting at the same index,
  407. // always prefer to insert first
  408. if (typeof lastOp['delete'] === 'number' && newOp.insert != null) {
  409. index -= 1;
  410. lastOp = this.ops[index - 1];
  411. if (typeof lastOp !== 'object') {
  412. this.ops.unshift(newOp);
  413. return this;
  414. }
  415. }
  416. if (equal(newOp.attributes, lastOp.attributes)) {
  417. if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') {
  418. this.ops[index - 1] = { insert: lastOp.insert + newOp.insert };
  419. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  420. return this;
  421. } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') {
  422. this.ops[index - 1] = { retain: lastOp.retain + newOp.retain };
  423. if (typeof newOp.attributes === 'object') this.ops[index - 1].attributes = newOp.attributes
  424. return this;
  425. }
  426. }
  427. }
  428. if (index === this.ops.length) {
  429. this.ops.push(newOp);
  430. } else {
  431. this.ops.splice(index, 0, newOp);
  432. }
  433. return this;
  434. };
  435. Delta.prototype.chop = function () {
  436. var lastOp = this.ops[this.ops.length - 1];
  437. if (lastOp && lastOp.retain && !lastOp.attributes) {
  438. this.ops.pop();
  439. }
  440. return this;
  441. };
  442. Delta.prototype.filter = function (predicate) {
  443. return this.ops.filter(predicate);
  444. };
  445. Delta.prototype.forEach = function (predicate) {
  446. this.ops.forEach(predicate);
  447. };
  448. Delta.prototype.map = function (predicate) {
  449. return this.ops.map(predicate);
  450. };
  451. Delta.prototype.partition = function (predicate) {
  452. var passed = [], failed = [];
  453. this.forEach(function(op) {
  454. var target = predicate(op) ? passed : failed;
  455. target.push(op);
  456. });
  457. return [passed, failed];
  458. };
  459. Delta.prototype.reduce = function (predicate, initial) {
  460. return this.ops.reduce(predicate, initial);
  461. };
  462. Delta.prototype.changeLength = function () {
  463. return this.reduce(function (length, elem) {
  464. if (elem.insert) {
  465. return length + op.length(elem);
  466. } else if (elem.delete) {
  467. return length - elem.delete;
  468. }
  469. return length;
  470. }, 0);
  471. };
  472. Delta.prototype.length = function () {
  473. return this.reduce(function (length, elem) {
  474. return length + op.length(elem);
  475. }, 0);
  476. };
  477. Delta.prototype.slice = function (start, end) {
  478. start = start || 0;
  479. if (typeof end !== 'number') end = Infinity;
  480. var ops = [];
  481. var iter = op.iterator(this.ops);
  482. var index = 0;
  483. while (index < end && iter.hasNext()) {
  484. var nextOp;
  485. if (index < start) {
  486. nextOp = iter.next(start - index);
  487. } else {
  488. nextOp = iter.next(end - index);
  489. ops.push(nextOp);
  490. }
  491. index += op.length(nextOp);
  492. }
  493. return new Delta(ops);
  494. };
  495. Delta.prototype.compose = function (other) {
  496. var thisIter = op.iterator(this.ops);
  497. var otherIter = op.iterator(other.ops);
  498. var ops = [];
  499. var firstOther = otherIter.peek();
  500. if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) {
  501. var firstLeft = firstOther.retain;
  502. while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) {
  503. firstLeft -= thisIter.peekLength();
  504. ops.push(thisIter.next());
  505. }
  506. if (firstOther.retain - firstLeft > 0) {
  507. otherIter.next(firstOther.retain - firstLeft);
  508. }
  509. }
  510. var delta = new Delta(ops);
  511. while (thisIter.hasNext() || otherIter.hasNext()) {
  512. if (otherIter.peekType() === 'insert') {
  513. delta.push(otherIter.next());
  514. } else if (thisIter.peekType() === 'delete') {
  515. delta.push(thisIter.next());
  516. } else {
  517. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  518. var thisOp = thisIter.next(length);
  519. var otherOp = otherIter.next(length);
  520. if (typeof otherOp.retain === 'number') {
  521. var newOp = {};
  522. if (typeof thisOp.retain === 'number') {
  523. newOp.retain = length;
  524. } else {
  525. newOp.insert = thisOp.insert;
  526. }
  527. // Preserve null when composing with a retain, otherwise remove it for inserts
  528. var attributes = op.attributes.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number');
  529. if (attributes) newOp.attributes = attributes;
  530. delta.push(newOp);
  531. // Optimization if rest of other is just retain
  532. if (!otherIter.hasNext() && equal(delta.ops[delta.ops.length - 1], newOp)) {
  533. var rest = new Delta(thisIter.rest());
  534. return delta.concat(rest).chop();
  535. }
  536. // Other op should be delete, we could be an insert or retain
  537. // Insert + delete cancels out
  538. } else if (typeof otherOp['delete'] === 'number' && typeof thisOp.retain === 'number') {
  539. delta.push(otherOp);
  540. }
  541. }
  542. }
  543. return delta.chop();
  544. };
  545. Delta.prototype.concat = function (other) {
  546. var delta = new Delta(this.ops.slice());
  547. if (other.ops.length > 0) {
  548. delta.push(other.ops[0]);
  549. delta.ops = delta.ops.concat(other.ops.slice(1));
  550. }
  551. return delta;
  552. };
  553. Delta.prototype.diff = function (other, index) {
  554. if (this.ops === other.ops) {
  555. return new Delta();
  556. }
  557. var strings = [this, other].map(function (delta) {
  558. return delta.map(function (op) {
  559. if (op.insert != null) {
  560. return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER;
  561. }
  562. var prep = (delta === other) ? 'on' : 'with';
  563. throw new Error('diff() called ' + prep + ' non-document');
  564. }).join('');
  565. });
  566. var delta = new Delta();
  567. var diffResult = diff(strings[0], strings[1], index);
  568. var thisIter = op.iterator(this.ops);
  569. var otherIter = op.iterator(other.ops);
  570. diffResult.forEach(function (component) {
  571. var length = component[1].length;
  572. while (length > 0) {
  573. var opLength = 0;
  574. switch (component[0]) {
  575. case diff.INSERT:
  576. opLength = Math.min(otherIter.peekLength(), length);
  577. delta.push(otherIter.next(opLength));
  578. break;
  579. case diff.DELETE:
  580. opLength = Math.min(length, thisIter.peekLength());
  581. thisIter.next(opLength);
  582. delta['delete'](opLength);
  583. break;
  584. case diff.EQUAL:
  585. opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length);
  586. var thisOp = thisIter.next(opLength);
  587. var otherOp = otherIter.next(opLength);
  588. if (equal(thisOp.insert, otherOp.insert)) {
  589. delta.retain(opLength, op.attributes.diff(thisOp.attributes, otherOp.attributes));
  590. } else {
  591. delta.push(otherOp)['delete'](opLength);
  592. }
  593. break;
  594. }
  595. length -= opLength;
  596. }
  597. });
  598. return delta.chop();
  599. };
  600. Delta.prototype.eachLine = function (predicate, newline) {
  601. newline = newline || '\n';
  602. var iter = op.iterator(this.ops);
  603. var line = new Delta();
  604. var i = 0;
  605. while (iter.hasNext()) {
  606. if (iter.peekType() !== 'insert') return;
  607. var thisOp = iter.peek();
  608. var start = op.length(thisOp) - iter.peekLength();
  609. var index = typeof thisOp.insert === 'string' ?
  610. thisOp.insert.indexOf(newline, start) - start : -1;
  611. if (index < 0) {
  612. line.push(iter.next());
  613. } else if (index > 0) {
  614. line.push(iter.next(index));
  615. } else {
  616. if (predicate(line, iter.next(1).attributes || {}, i) === false) {
  617. return;
  618. }
  619. i += 1;
  620. line = new Delta();
  621. }
  622. }
  623. if (line.length() > 0) {
  624. predicate(line, {}, i);
  625. }
  626. };
  627. Delta.prototype.transform = function (other, priority) {
  628. priority = !!priority;
  629. if (typeof other === 'number') {
  630. return this.transformPosition(other, priority);
  631. }
  632. var thisIter = op.iterator(this.ops);
  633. var otherIter = op.iterator(other.ops);
  634. var delta = new Delta();
  635. while (thisIter.hasNext() || otherIter.hasNext()) {
  636. if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) {
  637. delta.retain(op.length(thisIter.next()));
  638. } else if (otherIter.peekType() === 'insert') {
  639. delta.push(otherIter.next());
  640. } else {
  641. var length = Math.min(thisIter.peekLength(), otherIter.peekLength());
  642. var thisOp = thisIter.next(length);
  643. var otherOp = otherIter.next(length);
  644. if (thisOp['delete']) {
  645. // Our delete either makes their delete redundant or removes their retain
  646. continue;
  647. } else if (otherOp['delete']) {
  648. delta.push(otherOp);
  649. } else {
  650. // We retain either their retain or insert
  651. delta.retain(length, op.attributes.transform(thisOp.attributes, otherOp.attributes, priority));
  652. }
  653. }
  654. }
  655. return delta.chop();
  656. };
  657. Delta.prototype.transformPosition = function (index, priority) {
  658. priority = !!priority;
  659. var thisIter = op.iterator(this.ops);
  660. var offset = 0;
  661. while (thisIter.hasNext() && offset <= index) {
  662. var length = thisIter.peekLength();
  663. var nextType = thisIter.peekType();
  664. thisIter.next();
  665. if (nextType === 'delete') {
  666. index -= Math.min(length, index - offset);
  667. continue;
  668. } else if (nextType === 'insert' && (offset < index || !priority)) {
  669. index += length;
  670. }
  671. offset += length;
  672. }
  673. return index;
  674. };
  675. module.exports = Delta;
  676. /***/ }),
  677. /* 3 */
  678. /***/ (function(module, exports) {
  679. 'use strict';
  680. var hasOwn = Object.prototype.hasOwnProperty;
  681. var toStr = Object.prototype.toString;
  682. var defineProperty = Object.defineProperty;
  683. var gOPD = Object.getOwnPropertyDescriptor;
  684. var isArray = function isArray(arr) {
  685. if (typeof Array.isArray === 'function') {
  686. return Array.isArray(arr);
  687. }
  688. return toStr.call(arr) === '[object Array]';
  689. };
  690. var isPlainObject = function isPlainObject(obj) {
  691. if (!obj || toStr.call(obj) !== '[object Object]') {
  692. return false;
  693. }
  694. var hasOwnConstructor = hasOwn.call(obj, 'constructor');
  695. var hasIsPrototypeOf = obj.constructor && obj.constructor.prototype && hasOwn.call(obj.constructor.prototype, 'isPrototypeOf');
  696. // Not own constructor property must be Object
  697. if (obj.constructor && !hasOwnConstructor && !hasIsPrototypeOf) {
  698. return false;
  699. }
  700. // Own properties are enumerated firstly, so to speed up,
  701. // if last one is own, then all properties are own.
  702. var key;
  703. for (key in obj) { /**/ }
  704. return typeof key === 'undefined' || hasOwn.call(obj, key);
  705. };
  706. // If name is '__proto__', and Object.defineProperty is available, define __proto__ as an own property on target
  707. var setProperty = function setProperty(target, options) {
  708. if (defineProperty && options.name === '__proto__') {
  709. defineProperty(target, options.name, {
  710. enumerable: true,
  711. configurable: true,
  712. value: options.newValue,
  713. writable: true
  714. });
  715. } else {
  716. target[options.name] = options.newValue;
  717. }
  718. };
  719. // Return undefined instead of __proto__ if '__proto__' is not an own property
  720. var getProperty = function getProperty(obj, name) {
  721. if (name === '__proto__') {
  722. if (!hasOwn.call(obj, name)) {
  723. return void 0;
  724. } else if (gOPD) {
  725. // In early versions of node, obj['__proto__'] is buggy when obj has
  726. // __proto__ as an own property. Object.getOwnPropertyDescriptor() works.
  727. return gOPD(obj, name).value;
  728. }
  729. }
  730. return obj[name];
  731. };
  732. module.exports = function extend() {
  733. var options, name, src, copy, copyIsArray, clone;
  734. var target = arguments[0];
  735. var i = 1;
  736. var length = arguments.length;
  737. var deep = false;
  738. // Handle a deep copy situation
  739. if (typeof target === 'boolean') {
  740. deep = target;
  741. target = arguments[1] || {};
  742. // skip the boolean and the target
  743. i = 2;
  744. }
  745. if (target == null || (typeof target !== 'object' && typeof target !== 'function')) {
  746. target = {};
  747. }
  748. for (; i < length; ++i) {
  749. options = arguments[i];
  750. // Only deal with non-null/undefined values
  751. if (options != null) {
  752. // Extend the base object
  753. for (name in options) {
  754. src = getProperty(target, name);
  755. copy = getProperty(options, name);
  756. // Prevent never-ending loop
  757. if (target !== copy) {
  758. // Recurse if we're merging plain objects or arrays
  759. if (deep && copy && (isPlainObject(copy) || (copyIsArray = isArray(copy)))) {
  760. if (copyIsArray) {
  761. copyIsArray = false;
  762. clone = src && isArray(src) ? src : [];
  763. } else {
  764. clone = src && isPlainObject(src) ? src : {};
  765. }
  766. // Never move original objects, clone them
  767. setProperty(target, { name: name, newValue: extend(deep, clone, copy) });
  768. // Don't bring in undefined values
  769. } else if (typeof copy !== 'undefined') {
  770. setProperty(target, { name: name, newValue: copy });
  771. }
  772. }
  773. }
  774. }
  775. }
  776. // Return the modified object
  777. return target;
  778. };
  779. /***/ }),
  780. /* 4 */
  781. /***/ (function(module, exports, __webpack_require__) {
  782. "use strict";
  783. Object.defineProperty(exports, "__esModule", {
  784. value: true
  785. });
  786. exports.default = exports.BlockEmbed = exports.bubbleFormats = undefined;
  787. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  788. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  789. var _extend = __webpack_require__(3);
  790. var _extend2 = _interopRequireDefault(_extend);
  791. var _quillDelta = __webpack_require__(2);
  792. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  793. var _parchment = __webpack_require__(0);
  794. var _parchment2 = _interopRequireDefault(_parchment);
  795. var _break = __webpack_require__(16);
  796. var _break2 = _interopRequireDefault(_break);
  797. var _inline = __webpack_require__(6);
  798. var _inline2 = _interopRequireDefault(_inline);
  799. var _text = __webpack_require__(7);
  800. var _text2 = _interopRequireDefault(_text);
  801. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  802. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  803. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  804. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  805. var NEWLINE_LENGTH = 1;
  806. var BlockEmbed = function (_Parchment$Embed) {
  807. _inherits(BlockEmbed, _Parchment$Embed);
  808. function BlockEmbed() {
  809. _classCallCheck(this, BlockEmbed);
  810. return _possibleConstructorReturn(this, (BlockEmbed.__proto__ || Object.getPrototypeOf(BlockEmbed)).apply(this, arguments));
  811. }
  812. _createClass(BlockEmbed, [{
  813. key: 'attach',
  814. value: function attach() {
  815. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'attach', this).call(this);
  816. this.attributes = new _parchment2.default.Attributor.Store(this.domNode);
  817. }
  818. }, {
  819. key: 'delta',
  820. value: function delta() {
  821. return new _quillDelta2.default().insert(this.value(), (0, _extend2.default)(this.formats(), this.attributes.values()));
  822. }
  823. }, {
  824. key: 'format',
  825. value: function format(name, value) {
  826. var attribute = _parchment2.default.query(name, _parchment2.default.Scope.BLOCK_ATTRIBUTE);
  827. if (attribute != null) {
  828. this.attributes.attribute(attribute, value);
  829. }
  830. }
  831. }, {
  832. key: 'formatAt',
  833. value: function formatAt(index, length, name, value) {
  834. this.format(name, value);
  835. }
  836. }, {
  837. key: 'insertAt',
  838. value: function insertAt(index, value, def) {
  839. if (typeof value === 'string' && value.endsWith('\n')) {
  840. var block = _parchment2.default.create(Block.blotName);
  841. this.parent.insertBefore(block, index === 0 ? this : this.next);
  842. block.insertAt(0, value.slice(0, -1));
  843. } else {
  844. _get(BlockEmbed.prototype.__proto__ || Object.getPrototypeOf(BlockEmbed.prototype), 'insertAt', this).call(this, index, value, def);
  845. }
  846. }
  847. }]);
  848. return BlockEmbed;
  849. }(_parchment2.default.Embed);
  850. BlockEmbed.scope = _parchment2.default.Scope.BLOCK_BLOT;
  851. // It is important for cursor behavior BlockEmbeds use tags that are block level elements
  852. var Block = function (_Parchment$Block) {
  853. _inherits(Block, _Parchment$Block);
  854. function Block(domNode) {
  855. _classCallCheck(this, Block);
  856. var _this2 = _possibleConstructorReturn(this, (Block.__proto__ || Object.getPrototypeOf(Block)).call(this, domNode));
  857. _this2.cache = {};
  858. return _this2;
  859. }
  860. _createClass(Block, [{
  861. key: 'delta',
  862. value: function delta() {
  863. if (this.cache.delta == null) {
  864. this.cache.delta = this.descendants(_parchment2.default.Leaf).reduce(function (delta, leaf) {
  865. if (leaf.length() === 0) {
  866. return delta;
  867. } else {
  868. return delta.insert(leaf.value(), bubbleFormats(leaf));
  869. }
  870. }, new _quillDelta2.default()).insert('\n', bubbleFormats(this));
  871. }
  872. return this.cache.delta;
  873. }
  874. }, {
  875. key: 'deleteAt',
  876. value: function deleteAt(index, length) {
  877. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'deleteAt', this).call(this, index, length);
  878. this.cache = {};
  879. }
  880. }, {
  881. key: 'formatAt',
  882. value: function formatAt(index, length, name, value) {
  883. if (length <= 0) return;
  884. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  885. if (index + length === this.length()) {
  886. this.format(name, value);
  887. }
  888. } else {
  889. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'formatAt', this).call(this, index, Math.min(length, this.length() - index - 1), name, value);
  890. }
  891. this.cache = {};
  892. }
  893. }, {
  894. key: 'insertAt',
  895. value: function insertAt(index, value, def) {
  896. if (def != null) return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, index, value, def);
  897. if (value.length === 0) return;
  898. var lines = value.split('\n');
  899. var text = lines.shift();
  900. if (text.length > 0) {
  901. if (index < this.length() - 1 || this.children.tail == null) {
  902. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertAt', this).call(this, Math.min(index, this.length() - 1), text);
  903. } else {
  904. this.children.tail.insertAt(this.children.tail.length(), text);
  905. }
  906. this.cache = {};
  907. }
  908. var block = this;
  909. lines.reduce(function (index, line) {
  910. block = block.split(index, true);
  911. block.insertAt(0, line);
  912. return line.length;
  913. }, index + text.length);
  914. }
  915. }, {
  916. key: 'insertBefore',
  917. value: function insertBefore(blot, ref) {
  918. var head = this.children.head;
  919. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'insertBefore', this).call(this, blot, ref);
  920. if (head instanceof _break2.default) {
  921. head.remove();
  922. }
  923. this.cache = {};
  924. }
  925. }, {
  926. key: 'length',
  927. value: function length() {
  928. if (this.cache.length == null) {
  929. this.cache.length = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'length', this).call(this) + NEWLINE_LENGTH;
  930. }
  931. return this.cache.length;
  932. }
  933. }, {
  934. key: 'moveChildren',
  935. value: function moveChildren(target, ref) {
  936. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'moveChildren', this).call(this, target, ref);
  937. this.cache = {};
  938. }
  939. }, {
  940. key: 'optimize',
  941. value: function optimize(context) {
  942. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'optimize', this).call(this, context);
  943. this.cache = {};
  944. }
  945. }, {
  946. key: 'path',
  947. value: function path(index) {
  948. return _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'path', this).call(this, index, true);
  949. }
  950. }, {
  951. key: 'removeChild',
  952. value: function removeChild(child) {
  953. _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'removeChild', this).call(this, child);
  954. this.cache = {};
  955. }
  956. }, {
  957. key: 'split',
  958. value: function split(index) {
  959. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  960. if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) {
  961. var clone = this.clone();
  962. if (index === 0) {
  963. this.parent.insertBefore(clone, this);
  964. return this;
  965. } else {
  966. this.parent.insertBefore(clone, this.next);
  967. return clone;
  968. }
  969. } else {
  970. var next = _get(Block.prototype.__proto__ || Object.getPrototypeOf(Block.prototype), 'split', this).call(this, index, force);
  971. this.cache = {};
  972. return next;
  973. }
  974. }
  975. }]);
  976. return Block;
  977. }(_parchment2.default.Block);
  978. Block.blotName = 'block';
  979. Block.tagName = 'P';
  980. Block.defaultChild = 'break';
  981. Block.allowedChildren = [_inline2.default, _parchment2.default.Embed, _text2.default];
  982. function bubbleFormats(blot) {
  983. var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  984. if (blot == null) return formats;
  985. if (typeof blot.formats === 'function') {
  986. formats = (0, _extend2.default)(formats, blot.formats());
  987. }
  988. if (blot.parent == null || blot.parent.blotName == 'scroll' || blot.parent.statics.scope !== blot.statics.scope) {
  989. return formats;
  990. }
  991. return bubbleFormats(blot.parent, formats);
  992. }
  993. exports.bubbleFormats = bubbleFormats;
  994. exports.BlockEmbed = BlockEmbed;
  995. exports.default = Block;
  996. /***/ }),
  997. /* 5 */
  998. /***/ (function(module, exports, __webpack_require__) {
  999. "use strict";
  1000. Object.defineProperty(exports, "__esModule", {
  1001. value: true
  1002. });
  1003. exports.default = exports.overload = exports.expandConfig = undefined;
  1004. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  1005. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  1006. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1007. __webpack_require__(50);
  1008. var _quillDelta = __webpack_require__(2);
  1009. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  1010. var _editor = __webpack_require__(14);
  1011. var _editor2 = _interopRequireDefault(_editor);
  1012. var _emitter3 = __webpack_require__(8);
  1013. var _emitter4 = _interopRequireDefault(_emitter3);
  1014. var _module = __webpack_require__(9);
  1015. var _module2 = _interopRequireDefault(_module);
  1016. var _parchment = __webpack_require__(0);
  1017. var _parchment2 = _interopRequireDefault(_parchment);
  1018. var _selection = __webpack_require__(15);
  1019. var _selection2 = _interopRequireDefault(_selection);
  1020. var _extend = __webpack_require__(3);
  1021. var _extend2 = _interopRequireDefault(_extend);
  1022. var _logger = __webpack_require__(10);
  1023. var _logger2 = _interopRequireDefault(_logger);
  1024. var _theme = __webpack_require__(34);
  1025. var _theme2 = _interopRequireDefault(_theme);
  1026. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1027. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  1028. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1029. var debug = (0, _logger2.default)('quill');
  1030. var Quill = function () {
  1031. _createClass(Quill, null, [{
  1032. key: 'debug',
  1033. value: function debug(limit) {
  1034. if (limit === true) {
  1035. limit = 'log';
  1036. }
  1037. _logger2.default.level(limit);
  1038. }
  1039. }, {
  1040. key: 'find',
  1041. value: function find(node) {
  1042. return node.__quill || _parchment2.default.find(node);
  1043. }
  1044. }, {
  1045. key: 'import',
  1046. value: function _import(name) {
  1047. if (this.imports[name] == null) {
  1048. debug.error('Cannot import ' + name + '. Are you sure it was registered?');
  1049. }
  1050. return this.imports[name];
  1051. }
  1052. }, {
  1053. key: 'register',
  1054. value: function register(path, target) {
  1055. var _this = this;
  1056. var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  1057. if (typeof path !== 'string') {
  1058. var name = path.attrName || path.blotName;
  1059. if (typeof name === 'string') {
  1060. // register(Blot | Attributor, overwrite)
  1061. this.register('formats/' + name, path, target);
  1062. } else {
  1063. Object.keys(path).forEach(function (key) {
  1064. _this.register(key, path[key], target);
  1065. });
  1066. }
  1067. } else {
  1068. if (this.imports[path] != null && !overwrite) {
  1069. debug.warn('Overwriting ' + path + ' with', target);
  1070. }
  1071. this.imports[path] = target;
  1072. if ((path.startsWith('blots/') || path.startsWith('formats/')) && target.blotName !== 'abstract') {
  1073. _parchment2.default.register(target);
  1074. } else if (path.startsWith('modules') && typeof target.register === 'function') {
  1075. target.register();
  1076. }
  1077. }
  1078. }
  1079. }]);
  1080. function Quill(container) {
  1081. var _this2 = this;
  1082. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1083. _classCallCheck(this, Quill);
  1084. this.options = expandConfig(container, options);
  1085. this.container = this.options.container;
  1086. if (this.container == null) {
  1087. return debug.error('Invalid Quill container', container);
  1088. }
  1089. if (this.options.debug) {
  1090. Quill.debug(this.options.debug);
  1091. }
  1092. var html = this.container.innerHTML.trim();
  1093. this.container.classList.add('ql-container');
  1094. this.container.innerHTML = '';
  1095. this.container.__quill = this;
  1096. this.root = this.addContainer('ql-editor');
  1097. this.root.classList.add('ql-blank');
  1098. this.root.setAttribute('data-gramm', false);
  1099. this.scrollingContainer = this.options.scrollingContainer || this.root;
  1100. this.emitter = new _emitter4.default();
  1101. this.scroll = _parchment2.default.create(this.root, {
  1102. emitter: this.emitter,
  1103. whitelist: this.options.formats
  1104. });
  1105. this.editor = new _editor2.default(this.scroll);
  1106. this.selection = new _selection2.default(this.scroll, this.emitter);
  1107. this.theme = new this.options.theme(this, this.options);
  1108. this.keyboard = this.theme.addModule('keyboard');
  1109. this.clipboard = this.theme.addModule('clipboard');
  1110. this.history = this.theme.addModule('history');
  1111. this.theme.init();
  1112. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type) {
  1113. if (type === _emitter4.default.events.TEXT_CHANGE) {
  1114. _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank());
  1115. }
  1116. });
  1117. this.emitter.on(_emitter4.default.events.SCROLL_UPDATE, function (source, mutations) {
  1118. var range = _this2.selection.lastRange;
  1119. var index = range && range.length === 0 ? range.index : undefined;
  1120. modify.call(_this2, function () {
  1121. return _this2.editor.update(null, mutations, index);
  1122. }, source);
  1123. });
  1124. var contents = this.clipboard.convert('<div class=\'ql-editor\' style="white-space: normal;">' + html + '<p><br></p></div>');
  1125. this.setContents(contents);
  1126. this.history.clear();
  1127. if (this.options.placeholder) {
  1128. this.root.setAttribute('data-placeholder', this.options.placeholder);
  1129. }
  1130. if (this.options.readOnly) {
  1131. this.disable();
  1132. }
  1133. }
  1134. _createClass(Quill, [{
  1135. key: 'addContainer',
  1136. value: function addContainer(container) {
  1137. var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  1138. if (typeof container === 'string') {
  1139. var className = container;
  1140. container = document.createElement('div');
  1141. container.classList.add(className);
  1142. }
  1143. this.container.insertBefore(container, refNode);
  1144. return container;
  1145. }
  1146. }, {
  1147. key: 'blur',
  1148. value: function blur() {
  1149. this.selection.setRange(null);
  1150. }
  1151. }, {
  1152. key: 'deleteText',
  1153. value: function deleteText(index, length, source) {
  1154. var _this3 = this;
  1155. var _overload = overload(index, length, source);
  1156. var _overload2 = _slicedToArray(_overload, 4);
  1157. index = _overload2[0];
  1158. length = _overload2[1];
  1159. source = _overload2[3];
  1160. return modify.call(this, function () {
  1161. return _this3.editor.deleteText(index, length);
  1162. }, source, index, -1 * length);
  1163. }
  1164. }, {
  1165. key: 'disable',
  1166. value: function disable() {
  1167. this.enable(false);
  1168. }
  1169. }, {
  1170. key: 'enable',
  1171. value: function enable() {
  1172. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  1173. this.scroll.enable(enabled);
  1174. this.container.classList.toggle('ql-disabled', !enabled);
  1175. }
  1176. }, {
  1177. key: 'focus',
  1178. value: function focus() {
  1179. var scrollTop = this.scrollingContainer.scrollTop;
  1180. this.selection.focus();
  1181. this.scrollingContainer.scrollTop = scrollTop;
  1182. this.scrollIntoView();
  1183. }
  1184. }, {
  1185. key: 'format',
  1186. value: function format(name, value) {
  1187. var _this4 = this;
  1188. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  1189. return modify.call(this, function () {
  1190. var range = _this4.getSelection(true);
  1191. var change = new _quillDelta2.default();
  1192. if (range == null) {
  1193. return change;
  1194. } else if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK)) {
  1195. change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value));
  1196. } else if (range.length === 0) {
  1197. _this4.selection.format(name, value);
  1198. return change;
  1199. } else {
  1200. change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value));
  1201. }
  1202. _this4.setSelection(range, _emitter4.default.sources.SILENT);
  1203. return change;
  1204. }, source);
  1205. }
  1206. }, {
  1207. key: 'formatLine',
  1208. value: function formatLine(index, length, name, value, source) {
  1209. var _this5 = this;
  1210. var formats = void 0;
  1211. var _overload3 = overload(index, length, name, value, source);
  1212. var _overload4 = _slicedToArray(_overload3, 4);
  1213. index = _overload4[0];
  1214. length = _overload4[1];
  1215. formats = _overload4[2];
  1216. source = _overload4[3];
  1217. return modify.call(this, function () {
  1218. return _this5.editor.formatLine(index, length, formats);
  1219. }, source, index, 0);
  1220. }
  1221. }, {
  1222. key: 'formatText',
  1223. value: function formatText(index, length, name, value, source) {
  1224. var _this6 = this;
  1225. var formats = void 0;
  1226. var _overload5 = overload(index, length, name, value, source);
  1227. var _overload6 = _slicedToArray(_overload5, 4);
  1228. index = _overload6[0];
  1229. length = _overload6[1];
  1230. formats = _overload6[2];
  1231. source = _overload6[3];
  1232. return modify.call(this, function () {
  1233. return _this6.editor.formatText(index, length, formats);
  1234. }, source, index, 0);
  1235. }
  1236. }, {
  1237. key: 'getBounds',
  1238. value: function getBounds(index) {
  1239. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1240. var bounds = void 0;
  1241. if (typeof index === 'number') {
  1242. bounds = this.selection.getBounds(index, length);
  1243. } else {
  1244. bounds = this.selection.getBounds(index.index, index.length);
  1245. }
  1246. var containerBounds = this.container.getBoundingClientRect();
  1247. return {
  1248. bottom: bounds.bottom - containerBounds.top,
  1249. height: bounds.height,
  1250. left: bounds.left - containerBounds.left,
  1251. right: bounds.right - containerBounds.left,
  1252. top: bounds.top - containerBounds.top,
  1253. width: bounds.width
  1254. };
  1255. }
  1256. }, {
  1257. key: 'getContents',
  1258. value: function getContents() {
  1259. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1260. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1261. var _overload7 = overload(index, length);
  1262. var _overload8 = _slicedToArray(_overload7, 2);
  1263. index = _overload8[0];
  1264. length = _overload8[1];
  1265. return this.editor.getContents(index, length);
  1266. }
  1267. }, {
  1268. key: 'getFormat',
  1269. value: function getFormat() {
  1270. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true);
  1271. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  1272. if (typeof index === 'number') {
  1273. return this.editor.getFormat(index, length);
  1274. } else {
  1275. return this.editor.getFormat(index.index, index.length);
  1276. }
  1277. }
  1278. }, {
  1279. key: 'getIndex',
  1280. value: function getIndex(blot) {
  1281. return blot.offset(this.scroll);
  1282. }
  1283. }, {
  1284. key: 'getLength',
  1285. value: function getLength() {
  1286. return this.scroll.length();
  1287. }
  1288. }, {
  1289. key: 'getLeaf',
  1290. value: function getLeaf(index) {
  1291. return this.scroll.leaf(index);
  1292. }
  1293. }, {
  1294. key: 'getLine',
  1295. value: function getLine(index) {
  1296. return this.scroll.line(index);
  1297. }
  1298. }, {
  1299. key: 'getLines',
  1300. value: function getLines() {
  1301. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1302. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  1303. if (typeof index !== 'number') {
  1304. return this.scroll.lines(index.index, index.length);
  1305. } else {
  1306. return this.scroll.lines(index, length);
  1307. }
  1308. }
  1309. }, {
  1310. key: 'getModule',
  1311. value: function getModule(name) {
  1312. return this.theme.modules[name];
  1313. }
  1314. }, {
  1315. key: 'getSelection',
  1316. value: function getSelection() {
  1317. var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
  1318. if (focus) this.focus();
  1319. this.update(); // Make sure we access getRange with editor in consistent state
  1320. return this.selection.getRange()[0];
  1321. }
  1322. }, {
  1323. key: 'getText',
  1324. value: function getText() {
  1325. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  1326. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index;
  1327. var _overload9 = overload(index, length);
  1328. var _overload10 = _slicedToArray(_overload9, 2);
  1329. index = _overload10[0];
  1330. length = _overload10[1];
  1331. return this.editor.getText(index, length);
  1332. }
  1333. }, {
  1334. key: 'hasFocus',
  1335. value: function hasFocus() {
  1336. return this.selection.hasFocus();
  1337. }
  1338. }, {
  1339. key: 'insertEmbed',
  1340. value: function insertEmbed(index, embed, value) {
  1341. var _this7 = this;
  1342. var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API;
  1343. return modify.call(this, function () {
  1344. return _this7.editor.insertEmbed(index, embed, value);
  1345. }, source, index);
  1346. }
  1347. }, {
  1348. key: 'insertText',
  1349. value: function insertText(index, text, name, value, source) {
  1350. var _this8 = this;
  1351. var formats = void 0;
  1352. var _overload11 = overload(index, 0, name, value, source);
  1353. var _overload12 = _slicedToArray(_overload11, 4);
  1354. index = _overload12[0];
  1355. formats = _overload12[2];
  1356. source = _overload12[3];
  1357. return modify.call(this, function () {
  1358. return _this8.editor.insertText(index, text, formats);
  1359. }, source, index, text.length);
  1360. }
  1361. }, {
  1362. key: 'isEnabled',
  1363. value: function isEnabled() {
  1364. return !this.container.classList.contains('ql-disabled');
  1365. }
  1366. }, {
  1367. key: 'off',
  1368. value: function off() {
  1369. return this.emitter.off.apply(this.emitter, arguments);
  1370. }
  1371. }, {
  1372. key: 'on',
  1373. value: function on() {
  1374. return this.emitter.on.apply(this.emitter, arguments);
  1375. }
  1376. }, {
  1377. key: 'once',
  1378. value: function once() {
  1379. return this.emitter.once.apply(this.emitter, arguments);
  1380. }
  1381. }, {
  1382. key: 'pasteHTML',
  1383. value: function pasteHTML(index, html, source) {
  1384. this.clipboard.dangerouslyPasteHTML(index, html, source);
  1385. }
  1386. }, {
  1387. key: 'removeFormat',
  1388. value: function removeFormat(index, length, source) {
  1389. var _this9 = this;
  1390. var _overload13 = overload(index, length, source);
  1391. var _overload14 = _slicedToArray(_overload13, 4);
  1392. index = _overload14[0];
  1393. length = _overload14[1];
  1394. source = _overload14[3];
  1395. return modify.call(this, function () {
  1396. return _this9.editor.removeFormat(index, length);
  1397. }, source, index);
  1398. }
  1399. }, {
  1400. key: 'scrollIntoView',
  1401. value: function scrollIntoView() {
  1402. this.selection.scrollIntoView(this.scrollingContainer);
  1403. }
  1404. }, {
  1405. key: 'setContents',
  1406. value: function setContents(delta) {
  1407. var _this10 = this;
  1408. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1409. return modify.call(this, function () {
  1410. delta = new _quillDelta2.default(delta);
  1411. var length = _this10.getLength();
  1412. var deleted = _this10.editor.deleteText(0, length);
  1413. var applied = _this10.editor.applyDelta(delta);
  1414. var lastOp = applied.ops[applied.ops.length - 1];
  1415. if (lastOp != null && typeof lastOp.insert === 'string' && lastOp.insert[lastOp.insert.length - 1] === '\n') {
  1416. _this10.editor.deleteText(_this10.getLength() - 1, 1);
  1417. applied.delete(1);
  1418. }
  1419. var ret = deleted.compose(applied);
  1420. return ret;
  1421. }, source);
  1422. }
  1423. }, {
  1424. key: 'setSelection',
  1425. value: function setSelection(index, length, source) {
  1426. if (index == null) {
  1427. this.selection.setRange(null, length || Quill.sources.API);
  1428. } else {
  1429. var _overload15 = overload(index, length, source);
  1430. var _overload16 = _slicedToArray(_overload15, 4);
  1431. index = _overload16[0];
  1432. length = _overload16[1];
  1433. source = _overload16[3];
  1434. this.selection.setRange(new _selection.Range(index, length), source);
  1435. if (source !== _emitter4.default.sources.SILENT) {
  1436. this.selection.scrollIntoView(this.scrollingContainer);
  1437. }
  1438. }
  1439. }
  1440. }, {
  1441. key: 'setText',
  1442. value: function setText(text) {
  1443. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1444. var delta = new _quillDelta2.default().insert(text);
  1445. return this.setContents(delta, source);
  1446. }
  1447. }, {
  1448. key: 'update',
  1449. value: function update() {
  1450. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  1451. var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes
  1452. this.selection.update(source);
  1453. return change;
  1454. }
  1455. }, {
  1456. key: 'updateContents',
  1457. value: function updateContents(delta) {
  1458. var _this11 = this;
  1459. var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter4.default.sources.API;
  1460. return modify.call(this, function () {
  1461. delta = new _quillDelta2.default(delta);
  1462. return _this11.editor.applyDelta(delta, source);
  1463. }, source, true);
  1464. }
  1465. }]);
  1466. return Quill;
  1467. }();
  1468. Quill.DEFAULTS = {
  1469. bounds: null,
  1470. formats: null,
  1471. modules: {},
  1472. placeholder: '',
  1473. readOnly: false,
  1474. scrollingContainer: null,
  1475. strict: true,
  1476. theme: 'default'
  1477. };
  1478. Quill.events = _emitter4.default.events;
  1479. Quill.sources = _emitter4.default.sources;
  1480. // eslint-disable-next-line no-undef
  1481. Quill.version = false ? undefined : "1.3.7";
  1482. Quill.imports = {
  1483. 'delta': _quillDelta2.default,
  1484. 'parchment': _parchment2.default,
  1485. 'core/module': _module2.default,
  1486. 'core/theme': _theme2.default
  1487. };
  1488. function expandConfig(container, userConfig) {
  1489. userConfig = (0, _extend2.default)(true, {
  1490. container: container,
  1491. modules: {
  1492. clipboard: true,
  1493. keyboard: true,
  1494. history: true
  1495. }
  1496. }, userConfig);
  1497. if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) {
  1498. userConfig.theme = _theme2.default;
  1499. } else {
  1500. userConfig.theme = Quill.import('themes/' + userConfig.theme);
  1501. if (userConfig.theme == null) {
  1502. throw new Error('Invalid theme ' + userConfig.theme + '. Did you register it?');
  1503. }
  1504. }
  1505. var themeConfig = (0, _extend2.default)(true, {}, userConfig.theme.DEFAULTS);
  1506. [themeConfig, userConfig].forEach(function (config) {
  1507. config.modules = config.modules || {};
  1508. Object.keys(config.modules).forEach(function (module) {
  1509. if (config.modules[module] === true) {
  1510. config.modules[module] = {};
  1511. }
  1512. });
  1513. });
  1514. var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules));
  1515. var moduleConfig = moduleNames.reduce(function (config, name) {
  1516. var moduleClass = Quill.import('modules/' + name);
  1517. if (moduleClass == null) {
  1518. debug.error('Cannot load ' + name + ' module. Are you sure you registered it?');
  1519. } else {
  1520. config[name] = moduleClass.DEFAULTS || {};
  1521. }
  1522. return config;
  1523. }, {});
  1524. // Special case toolbar shorthand
  1525. if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) {
  1526. userConfig.modules.toolbar = {
  1527. container: userConfig.modules.toolbar
  1528. };
  1529. }
  1530. userConfig = (0, _extend2.default)(true, {}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig);
  1531. ['bounds', 'container', 'scrollingContainer'].forEach(function (key) {
  1532. if (typeof userConfig[key] === 'string') {
  1533. userConfig[key] = document.querySelector(userConfig[key]);
  1534. }
  1535. });
  1536. userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) {
  1537. if (userConfig.modules[name]) {
  1538. config[name] = userConfig.modules[name];
  1539. }
  1540. return config;
  1541. }, {});
  1542. return userConfig;
  1543. }
  1544. // Handle selection preservation and TEXT_CHANGE emission
  1545. // common to modification APIs
  1546. function modify(modifier, source, index, shift) {
  1547. if (this.options.strict && !this.isEnabled() && source === _emitter4.default.sources.USER) {
  1548. return new _quillDelta2.default();
  1549. }
  1550. var range = index == null ? null : this.getSelection();
  1551. var oldDelta = this.editor.delta;
  1552. var change = modifier();
  1553. if (range != null) {
  1554. if (index === true) index = range.index;
  1555. if (shift == null) {
  1556. range = shiftRange(range, change, source);
  1557. } else if (shift !== 0) {
  1558. range = shiftRange(range, index, shift, source);
  1559. }
  1560. this.setSelection(range, _emitter4.default.sources.SILENT);
  1561. }
  1562. if (change.length() > 0) {
  1563. var _emitter;
  1564. var args = [_emitter4.default.events.TEXT_CHANGE, change, oldDelta, source];
  1565. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  1566. if (source !== _emitter4.default.sources.SILENT) {
  1567. var _emitter2;
  1568. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  1569. }
  1570. }
  1571. return change;
  1572. }
  1573. function overload(index, length, name, value, source) {
  1574. var formats = {};
  1575. if (typeof index.index === 'number' && typeof index.length === 'number') {
  1576. // Allow for throwaway end (used by insertText/insertEmbed)
  1577. if (typeof length !== 'number') {
  1578. source = value, value = name, name = length, length = index.length, index = index.index;
  1579. } else {
  1580. length = index.length, index = index.index;
  1581. }
  1582. } else if (typeof length !== 'number') {
  1583. source = value, value = name, name = length, length = 0;
  1584. }
  1585. // Handle format being object, two format name/value strings or excluded
  1586. if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
  1587. formats = name;
  1588. source = value;
  1589. } else if (typeof name === 'string') {
  1590. if (value != null) {
  1591. formats[name] = value;
  1592. } else {
  1593. source = name;
  1594. }
  1595. }
  1596. // Handle optional source
  1597. source = source || _emitter4.default.sources.API;
  1598. return [index, length, formats, source];
  1599. }
  1600. function shiftRange(range, index, length, source) {
  1601. if (range == null) return null;
  1602. var start = void 0,
  1603. end = void 0;
  1604. if (index instanceof _quillDelta2.default) {
  1605. var _map = [range.index, range.index + range.length].map(function (pos) {
  1606. return index.transformPosition(pos, source !== _emitter4.default.sources.USER);
  1607. });
  1608. var _map2 = _slicedToArray(_map, 2);
  1609. start = _map2[0];
  1610. end = _map2[1];
  1611. } else {
  1612. var _map3 = [range.index, range.index + range.length].map(function (pos) {
  1613. if (pos < index || pos === index && source === _emitter4.default.sources.USER) return pos;
  1614. if (length >= 0) {
  1615. return pos + length;
  1616. } else {
  1617. return Math.max(index, pos + length);
  1618. }
  1619. });
  1620. var _map4 = _slicedToArray(_map3, 2);
  1621. start = _map4[0];
  1622. end = _map4[1];
  1623. }
  1624. return new _selection.Range(start, end - start);
  1625. }
  1626. exports.expandConfig = expandConfig;
  1627. exports.overload = overload;
  1628. exports.default = Quill;
  1629. /***/ }),
  1630. /* 6 */
  1631. /***/ (function(module, exports, __webpack_require__) {
  1632. "use strict";
  1633. Object.defineProperty(exports, "__esModule", {
  1634. value: true
  1635. });
  1636. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1637. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1638. var _text = __webpack_require__(7);
  1639. var _text2 = _interopRequireDefault(_text);
  1640. var _parchment = __webpack_require__(0);
  1641. var _parchment2 = _interopRequireDefault(_parchment);
  1642. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1643. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1644. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1645. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1646. var Inline = function (_Parchment$Inline) {
  1647. _inherits(Inline, _Parchment$Inline);
  1648. function Inline() {
  1649. _classCallCheck(this, Inline);
  1650. return _possibleConstructorReturn(this, (Inline.__proto__ || Object.getPrototypeOf(Inline)).apply(this, arguments));
  1651. }
  1652. _createClass(Inline, [{
  1653. key: 'formatAt',
  1654. value: function formatAt(index, length, name, value) {
  1655. if (Inline.compare(this.statics.blotName, name) < 0 && _parchment2.default.query(name, _parchment2.default.Scope.BLOT)) {
  1656. var blot = this.isolate(index, length);
  1657. if (value) {
  1658. blot.wrap(name, value);
  1659. }
  1660. } else {
  1661. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'formatAt', this).call(this, index, length, name, value);
  1662. }
  1663. }
  1664. }, {
  1665. key: 'optimize',
  1666. value: function optimize(context) {
  1667. _get(Inline.prototype.__proto__ || Object.getPrototypeOf(Inline.prototype), 'optimize', this).call(this, context);
  1668. if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) {
  1669. var parent = this.parent.isolate(this.offset(), this.length());
  1670. this.moveChildren(parent);
  1671. parent.wrap(this);
  1672. }
  1673. }
  1674. }], [{
  1675. key: 'compare',
  1676. value: function compare(self, other) {
  1677. var selfIndex = Inline.order.indexOf(self);
  1678. var otherIndex = Inline.order.indexOf(other);
  1679. if (selfIndex >= 0 || otherIndex >= 0) {
  1680. return selfIndex - otherIndex;
  1681. } else if (self === other) {
  1682. return 0;
  1683. } else if (self < other) {
  1684. return -1;
  1685. } else {
  1686. return 1;
  1687. }
  1688. }
  1689. }]);
  1690. return Inline;
  1691. }(_parchment2.default.Inline);
  1692. Inline.allowedChildren = [Inline, _parchment2.default.Embed, _text2.default];
  1693. // Lower index means deeper in the DOM tree, since not found (-1) is for embeds
  1694. Inline.order = ['cursor', 'inline', // Must be lower
  1695. 'underline', 'strike', 'italic', 'bold', 'script', 'link', 'code' // Must be higher
  1696. ];
  1697. exports.default = Inline;
  1698. /***/ }),
  1699. /* 7 */
  1700. /***/ (function(module, exports, __webpack_require__) {
  1701. "use strict";
  1702. Object.defineProperty(exports, "__esModule", {
  1703. value: true
  1704. });
  1705. var _parchment = __webpack_require__(0);
  1706. var _parchment2 = _interopRequireDefault(_parchment);
  1707. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1708. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1709. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1710. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1711. var TextBlot = function (_Parchment$Text) {
  1712. _inherits(TextBlot, _Parchment$Text);
  1713. function TextBlot() {
  1714. _classCallCheck(this, TextBlot);
  1715. return _possibleConstructorReturn(this, (TextBlot.__proto__ || Object.getPrototypeOf(TextBlot)).apply(this, arguments));
  1716. }
  1717. return TextBlot;
  1718. }(_parchment2.default.Text);
  1719. exports.default = TextBlot;
  1720. /***/ }),
  1721. /* 8 */
  1722. /***/ (function(module, exports, __webpack_require__) {
  1723. "use strict";
  1724. Object.defineProperty(exports, "__esModule", {
  1725. value: true
  1726. });
  1727. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  1728. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  1729. var _eventemitter = __webpack_require__(54);
  1730. var _eventemitter2 = _interopRequireDefault(_eventemitter);
  1731. var _logger = __webpack_require__(10);
  1732. var _logger2 = _interopRequireDefault(_logger);
  1733. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  1734. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1735. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  1736. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  1737. var debug = (0, _logger2.default)('quill:events');
  1738. var EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click'];
  1739. EVENTS.forEach(function (eventName) {
  1740. document.addEventListener(eventName, function () {
  1741. for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
  1742. args[_key] = arguments[_key];
  1743. }
  1744. [].slice.call(document.querySelectorAll('.ql-container')).forEach(function (node) {
  1745. // TODO use WeakMap
  1746. if (node.__quill && node.__quill.emitter) {
  1747. var _node$__quill$emitter;
  1748. (_node$__quill$emitter = node.__quill.emitter).handleDOM.apply(_node$__quill$emitter, args);
  1749. }
  1750. });
  1751. });
  1752. });
  1753. var Emitter = function (_EventEmitter) {
  1754. _inherits(Emitter, _EventEmitter);
  1755. function Emitter() {
  1756. _classCallCheck(this, Emitter);
  1757. var _this = _possibleConstructorReturn(this, (Emitter.__proto__ || Object.getPrototypeOf(Emitter)).call(this));
  1758. _this.listeners = {};
  1759. _this.on('error', debug.error);
  1760. return _this;
  1761. }
  1762. _createClass(Emitter, [{
  1763. key: 'emit',
  1764. value: function emit() {
  1765. debug.log.apply(debug, arguments);
  1766. _get(Emitter.prototype.__proto__ || Object.getPrototypeOf(Emitter.prototype), 'emit', this).apply(this, arguments);
  1767. }
  1768. }, {
  1769. key: 'handleDOM',
  1770. value: function handleDOM(event) {
  1771. for (var _len2 = arguments.length, args = Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
  1772. args[_key2 - 1] = arguments[_key2];
  1773. }
  1774. (this.listeners[event.type] || []).forEach(function (_ref) {
  1775. var node = _ref.node,
  1776. handler = _ref.handler;
  1777. if (event.target === node || node.contains(event.target)) {
  1778. handler.apply(undefined, [event].concat(args));
  1779. }
  1780. });
  1781. }
  1782. }, {
  1783. key: 'listenDOM',
  1784. value: function listenDOM(eventName, node, handler) {
  1785. if (!this.listeners[eventName]) {
  1786. this.listeners[eventName] = [];
  1787. }
  1788. this.listeners[eventName].push({ node: node, handler: handler });
  1789. }
  1790. }]);
  1791. return Emitter;
  1792. }(_eventemitter2.default);
  1793. Emitter.events = {
  1794. EDITOR_CHANGE: 'editor-change',
  1795. SCROLL_BEFORE_UPDATE: 'scroll-before-update',
  1796. SCROLL_OPTIMIZE: 'scroll-optimize',
  1797. SCROLL_UPDATE: 'scroll-update',
  1798. SELECTION_CHANGE: 'selection-change',
  1799. TEXT_CHANGE: 'text-change'
  1800. };
  1801. Emitter.sources = {
  1802. API: 'api',
  1803. SILENT: 'silent',
  1804. USER: 'user'
  1805. };
  1806. exports.default = Emitter;
  1807. /***/ }),
  1808. /* 9 */
  1809. /***/ (function(module, exports, __webpack_require__) {
  1810. "use strict";
  1811. Object.defineProperty(exports, "__esModule", {
  1812. value: true
  1813. });
  1814. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  1815. var Module = function Module(quill) {
  1816. var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  1817. _classCallCheck(this, Module);
  1818. this.quill = quill;
  1819. this.options = options;
  1820. };
  1821. Module.DEFAULTS = {};
  1822. exports.default = Module;
  1823. /***/ }),
  1824. /* 10 */
  1825. /***/ (function(module, exports, __webpack_require__) {
  1826. "use strict";
  1827. Object.defineProperty(exports, "__esModule", {
  1828. value: true
  1829. });
  1830. var levels = ['error', 'warn', 'log', 'info'];
  1831. var level = 'warn';
  1832. function debug(method) {
  1833. if (levels.indexOf(method) <= levels.indexOf(level)) {
  1834. var _console;
  1835. for (var _len = arguments.length, args = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  1836. args[_key - 1] = arguments[_key];
  1837. }
  1838. (_console = console)[method].apply(_console, args); // eslint-disable-line no-console
  1839. }
  1840. }
  1841. function namespace(ns) {
  1842. return levels.reduce(function (logger, method) {
  1843. logger[method] = debug.bind(console, method, ns);
  1844. return logger;
  1845. }, {});
  1846. }
  1847. debug.level = namespace.level = function (newLevel) {
  1848. level = newLevel;
  1849. };
  1850. exports.default = namespace;
  1851. /***/ }),
  1852. /* 11 */
  1853. /***/ (function(module, exports, __webpack_require__) {
  1854. var pSlice = Array.prototype.slice;
  1855. var objectKeys = __webpack_require__(52);
  1856. var isArguments = __webpack_require__(53);
  1857. var deepEqual = module.exports = function (actual, expected, opts) {
  1858. if (!opts) opts = {};
  1859. // 7.1. All identical values are equivalent, as determined by ===.
  1860. if (actual === expected) {
  1861. return true;
  1862. } else if (actual instanceof Date && expected instanceof Date) {
  1863. return actual.getTime() === expected.getTime();
  1864. // 7.3. Other pairs that do not both pass typeof value == 'object',
  1865. // equivalence is determined by ==.
  1866. } else if (!actual || !expected || typeof actual != 'object' && typeof expected != 'object') {
  1867. return opts.strict ? actual === expected : actual == expected;
  1868. // 7.4. For all other Object pairs, including Array objects, equivalence is
  1869. // determined by having the same number of owned properties (as verified
  1870. // with Object.prototype.hasOwnProperty.call), the same set of keys
  1871. // (although not necessarily the same order), equivalent values for every
  1872. // corresponding key, and an identical 'prototype' property. Note: this
  1873. // accounts for both named and indexed properties on Arrays.
  1874. } else {
  1875. return objEquiv(actual, expected, opts);
  1876. }
  1877. }
  1878. function isUndefinedOrNull(value) {
  1879. return value === null || value === undefined;
  1880. }
  1881. function isBuffer (x) {
  1882. if (!x || typeof x !== 'object' || typeof x.length !== 'number') return false;
  1883. if (typeof x.copy !== 'function' || typeof x.slice !== 'function') {
  1884. return false;
  1885. }
  1886. if (x.length > 0 && typeof x[0] !== 'number') return false;
  1887. return true;
  1888. }
  1889. function objEquiv(a, b, opts) {
  1890. var i, key;
  1891. if (isUndefinedOrNull(a) || isUndefinedOrNull(b))
  1892. return false;
  1893. // an identical 'prototype' property.
  1894. if (a.prototype !== b.prototype) return false;
  1895. //~~~I've managed to break Object.keys through screwy arguments passing.
  1896. // Converting to array solves the problem.
  1897. if (isArguments(a)) {
  1898. if (!isArguments(b)) {
  1899. return false;
  1900. }
  1901. a = pSlice.call(a);
  1902. b = pSlice.call(b);
  1903. return deepEqual(a, b, opts);
  1904. }
  1905. if (isBuffer(a)) {
  1906. if (!isBuffer(b)) {
  1907. return false;
  1908. }
  1909. if (a.length !== b.length) return false;
  1910. for (i = 0; i < a.length; i++) {
  1911. if (a[i] !== b[i]) return false;
  1912. }
  1913. return true;
  1914. }
  1915. try {
  1916. var ka = objectKeys(a),
  1917. kb = objectKeys(b);
  1918. } catch (e) {//happens when one is a string literal and the other isn't
  1919. return false;
  1920. }
  1921. // having the same number of owned properties (keys incorporates
  1922. // hasOwnProperty)
  1923. if (ka.length != kb.length)
  1924. return false;
  1925. //the same set of keys (although not necessarily the same order),
  1926. ka.sort();
  1927. kb.sort();
  1928. //~~~cheap key test
  1929. for (i = ka.length - 1; i >= 0; i--) {
  1930. if (ka[i] != kb[i])
  1931. return false;
  1932. }
  1933. //equivalent values for every corresponding key, and
  1934. //~~~possibly expensive deep test
  1935. for (i = ka.length - 1; i >= 0; i--) {
  1936. key = ka[i];
  1937. if (!deepEqual(a[key], b[key], opts)) return false;
  1938. }
  1939. return typeof a === typeof b;
  1940. }
  1941. /***/ }),
  1942. /* 12 */
  1943. /***/ (function(module, exports, __webpack_require__) {
  1944. "use strict";
  1945. Object.defineProperty(exports, "__esModule", { value: true });
  1946. var Registry = __webpack_require__(1);
  1947. var Attributor = /** @class */ (function () {
  1948. function Attributor(attrName, keyName, options) {
  1949. if (options === void 0) { options = {}; }
  1950. this.attrName = attrName;
  1951. this.keyName = keyName;
  1952. var attributeBit = Registry.Scope.TYPE & Registry.Scope.ATTRIBUTE;
  1953. if (options.scope != null) {
  1954. // Ignore type bits, force attribute bit
  1955. this.scope = (options.scope & Registry.Scope.LEVEL) | attributeBit;
  1956. }
  1957. else {
  1958. this.scope = Registry.Scope.ATTRIBUTE;
  1959. }
  1960. if (options.whitelist != null)
  1961. this.whitelist = options.whitelist;
  1962. }
  1963. Attributor.keys = function (node) {
  1964. return [].map.call(node.attributes, function (item) {
  1965. return item.name;
  1966. });
  1967. };
  1968. Attributor.prototype.add = function (node, value) {
  1969. if (!this.canAdd(node, value))
  1970. return false;
  1971. node.setAttribute(this.keyName, value);
  1972. return true;
  1973. };
  1974. Attributor.prototype.canAdd = function (node, value) {
  1975. var match = Registry.query(node, Registry.Scope.BLOT & (this.scope | Registry.Scope.TYPE));
  1976. if (match == null)
  1977. return false;
  1978. if (this.whitelist == null)
  1979. return true;
  1980. if (typeof value === 'string') {
  1981. return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1;
  1982. }
  1983. else {
  1984. return this.whitelist.indexOf(value) > -1;
  1985. }
  1986. };
  1987. Attributor.prototype.remove = function (node) {
  1988. node.removeAttribute(this.keyName);
  1989. };
  1990. Attributor.prototype.value = function (node) {
  1991. var value = node.getAttribute(this.keyName);
  1992. if (this.canAdd(node, value) && value) {
  1993. return value;
  1994. }
  1995. return '';
  1996. };
  1997. return Attributor;
  1998. }());
  1999. exports.default = Attributor;
  2000. /***/ }),
  2001. /* 13 */
  2002. /***/ (function(module, exports, __webpack_require__) {
  2003. "use strict";
  2004. Object.defineProperty(exports, "__esModule", {
  2005. value: true
  2006. });
  2007. exports.default = exports.Code = undefined;
  2008. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2009. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2010. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2011. var _quillDelta = __webpack_require__(2);
  2012. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  2013. var _parchment = __webpack_require__(0);
  2014. var _parchment2 = _interopRequireDefault(_parchment);
  2015. var _block = __webpack_require__(4);
  2016. var _block2 = _interopRequireDefault(_block);
  2017. var _inline = __webpack_require__(6);
  2018. var _inline2 = _interopRequireDefault(_inline);
  2019. var _text = __webpack_require__(7);
  2020. var _text2 = _interopRequireDefault(_text);
  2021. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2022. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2023. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2024. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2025. var Code = function (_Inline) {
  2026. _inherits(Code, _Inline);
  2027. function Code() {
  2028. _classCallCheck(this, Code);
  2029. return _possibleConstructorReturn(this, (Code.__proto__ || Object.getPrototypeOf(Code)).apply(this, arguments));
  2030. }
  2031. return Code;
  2032. }(_inline2.default);
  2033. Code.blotName = 'code';
  2034. Code.tagName = 'CODE';
  2035. var CodeBlock = function (_Block) {
  2036. _inherits(CodeBlock, _Block);
  2037. function CodeBlock() {
  2038. _classCallCheck(this, CodeBlock);
  2039. return _possibleConstructorReturn(this, (CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock)).apply(this, arguments));
  2040. }
  2041. _createClass(CodeBlock, [{
  2042. key: 'delta',
  2043. value: function delta() {
  2044. var _this3 = this;
  2045. var text = this.domNode.textContent;
  2046. if (text.endsWith('\n')) {
  2047. // Should always be true
  2048. text = text.slice(0, -1);
  2049. }
  2050. return text.split('\n').reduce(function (delta, frag) {
  2051. return delta.insert(frag).insert('\n', _this3.formats());
  2052. }, new _quillDelta2.default());
  2053. }
  2054. }, {
  2055. key: 'format',
  2056. value: function format(name, value) {
  2057. if (name === this.statics.blotName && value) return;
  2058. var _descendant = this.descendant(_text2.default, this.length() - 1),
  2059. _descendant2 = _slicedToArray(_descendant, 1),
  2060. text = _descendant2[0];
  2061. if (text != null) {
  2062. text.deleteAt(text.length() - 1, 1);
  2063. }
  2064. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'format', this).call(this, name, value);
  2065. }
  2066. }, {
  2067. key: 'formatAt',
  2068. value: function formatAt(index, length, name, value) {
  2069. if (length === 0) return;
  2070. if (_parchment2.default.query(name, _parchment2.default.Scope.BLOCK) == null || name === this.statics.blotName && value === this.statics.formats(this.domNode)) {
  2071. return;
  2072. }
  2073. var nextNewline = this.newlineIndex(index);
  2074. if (nextNewline < 0 || nextNewline >= index + length) return;
  2075. var prevNewline = this.newlineIndex(index, true) + 1;
  2076. var isolateLength = nextNewline - prevNewline + 1;
  2077. var blot = this.isolate(prevNewline, isolateLength);
  2078. var next = blot.next;
  2079. blot.format(name, value);
  2080. if (next instanceof CodeBlock) {
  2081. next.formatAt(0, index - prevNewline + length - isolateLength, name, value);
  2082. }
  2083. }
  2084. }, {
  2085. key: 'insertAt',
  2086. value: function insertAt(index, value, def) {
  2087. if (def != null) return;
  2088. var _descendant3 = this.descendant(_text2.default, index),
  2089. _descendant4 = _slicedToArray(_descendant3, 2),
  2090. text = _descendant4[0],
  2091. offset = _descendant4[1];
  2092. text.insertAt(offset, value);
  2093. }
  2094. }, {
  2095. key: 'length',
  2096. value: function length() {
  2097. var length = this.domNode.textContent.length;
  2098. if (!this.domNode.textContent.endsWith('\n')) {
  2099. return length + 1;
  2100. }
  2101. return length;
  2102. }
  2103. }, {
  2104. key: 'newlineIndex',
  2105. value: function newlineIndex(searchIndex) {
  2106. var reverse = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2107. if (!reverse) {
  2108. var offset = this.domNode.textContent.slice(searchIndex).indexOf('\n');
  2109. return offset > -1 ? searchIndex + offset : -1;
  2110. } else {
  2111. return this.domNode.textContent.slice(0, searchIndex).lastIndexOf('\n');
  2112. }
  2113. }
  2114. }, {
  2115. key: 'optimize',
  2116. value: function optimize(context) {
  2117. if (!this.domNode.textContent.endsWith('\n')) {
  2118. this.appendChild(_parchment2.default.create('text', '\n'));
  2119. }
  2120. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'optimize', this).call(this, context);
  2121. var next = this.next;
  2122. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && this.statics.formats(this.domNode) === next.statics.formats(next.domNode)) {
  2123. next.optimize(context);
  2124. next.moveChildren(this);
  2125. next.remove();
  2126. }
  2127. }
  2128. }, {
  2129. key: 'replace',
  2130. value: function replace(target) {
  2131. _get(CodeBlock.prototype.__proto__ || Object.getPrototypeOf(CodeBlock.prototype), 'replace', this).call(this, target);
  2132. [].slice.call(this.domNode.querySelectorAll('*')).forEach(function (node) {
  2133. var blot = _parchment2.default.find(node);
  2134. if (blot == null) {
  2135. node.parentNode.removeChild(node);
  2136. } else if (blot instanceof _parchment2.default.Embed) {
  2137. blot.remove();
  2138. } else {
  2139. blot.unwrap();
  2140. }
  2141. });
  2142. }
  2143. }], [{
  2144. key: 'create',
  2145. value: function create(value) {
  2146. var domNode = _get(CodeBlock.__proto__ || Object.getPrototypeOf(CodeBlock), 'create', this).call(this, value);
  2147. domNode.setAttribute('spellcheck', false);
  2148. return domNode;
  2149. }
  2150. }, {
  2151. key: 'formats',
  2152. value: function formats() {
  2153. return true;
  2154. }
  2155. }]);
  2156. return CodeBlock;
  2157. }(_block2.default);
  2158. CodeBlock.blotName = 'code-block';
  2159. CodeBlock.tagName = 'PRE';
  2160. CodeBlock.TAB = ' ';
  2161. exports.Code = Code;
  2162. exports.default = CodeBlock;
  2163. /***/ }),
  2164. /* 14 */
  2165. /***/ (function(module, exports, __webpack_require__) {
  2166. "use strict";
  2167. Object.defineProperty(exports, "__esModule", {
  2168. value: true
  2169. });
  2170. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  2171. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2172. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2173. var _quillDelta = __webpack_require__(2);
  2174. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  2175. var _op = __webpack_require__(20);
  2176. var _op2 = _interopRequireDefault(_op);
  2177. var _parchment = __webpack_require__(0);
  2178. var _parchment2 = _interopRequireDefault(_parchment);
  2179. var _code = __webpack_require__(13);
  2180. var _code2 = _interopRequireDefault(_code);
  2181. var _cursor = __webpack_require__(24);
  2182. var _cursor2 = _interopRequireDefault(_cursor);
  2183. var _block = __webpack_require__(4);
  2184. var _block2 = _interopRequireDefault(_block);
  2185. var _break = __webpack_require__(16);
  2186. var _break2 = _interopRequireDefault(_break);
  2187. var _clone = __webpack_require__(21);
  2188. var _clone2 = _interopRequireDefault(_clone);
  2189. var _deepEqual = __webpack_require__(11);
  2190. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2191. var _extend = __webpack_require__(3);
  2192. var _extend2 = _interopRequireDefault(_extend);
  2193. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2194. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  2195. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2196. var ASCII = /^[ -~]*$/;
  2197. var Editor = function () {
  2198. function Editor(scroll) {
  2199. _classCallCheck(this, Editor);
  2200. this.scroll = scroll;
  2201. this.delta = this.getDelta();
  2202. }
  2203. _createClass(Editor, [{
  2204. key: 'applyDelta',
  2205. value: function applyDelta(delta) {
  2206. var _this = this;
  2207. var consumeNextNewline = false;
  2208. this.scroll.update();
  2209. var scrollLength = this.scroll.length();
  2210. this.scroll.batchStart();
  2211. delta = normalizeDelta(delta);
  2212. delta.reduce(function (index, op) {
  2213. var length = op.retain || op.delete || op.insert.length || 1;
  2214. var attributes = op.attributes || {};
  2215. if (op.insert != null) {
  2216. if (typeof op.insert === 'string') {
  2217. var text = op.insert;
  2218. if (text.endsWith('\n') && consumeNextNewline) {
  2219. consumeNextNewline = false;
  2220. text = text.slice(0, -1);
  2221. }
  2222. if (index >= scrollLength && !text.endsWith('\n')) {
  2223. consumeNextNewline = true;
  2224. }
  2225. _this.scroll.insertAt(index, text);
  2226. var _scroll$line = _this.scroll.line(index),
  2227. _scroll$line2 = _slicedToArray(_scroll$line, 2),
  2228. line = _scroll$line2[0],
  2229. offset = _scroll$line2[1];
  2230. var formats = (0, _extend2.default)({}, (0, _block.bubbleFormats)(line));
  2231. if (line instanceof _block2.default) {
  2232. var _line$descendant = line.descendant(_parchment2.default.Leaf, offset),
  2233. _line$descendant2 = _slicedToArray(_line$descendant, 1),
  2234. leaf = _line$descendant2[0];
  2235. formats = (0, _extend2.default)(formats, (0, _block.bubbleFormats)(leaf));
  2236. }
  2237. attributes = _op2.default.attributes.diff(formats, attributes) || {};
  2238. } else if (_typeof(op.insert) === 'object') {
  2239. var key = Object.keys(op.insert)[0]; // There should only be one key
  2240. if (key == null) return index;
  2241. _this.scroll.insertAt(index, key, op.insert[key]);
  2242. }
  2243. scrollLength += length;
  2244. }
  2245. Object.keys(attributes).forEach(function (name) {
  2246. _this.scroll.formatAt(index, length, name, attributes[name]);
  2247. });
  2248. return index + length;
  2249. }, 0);
  2250. delta.reduce(function (index, op) {
  2251. if (typeof op.delete === 'number') {
  2252. _this.scroll.deleteAt(index, op.delete);
  2253. return index;
  2254. }
  2255. return index + (op.retain || op.insert.length || 1);
  2256. }, 0);
  2257. this.scroll.batchEnd();
  2258. return this.update(delta);
  2259. }
  2260. }, {
  2261. key: 'deleteText',
  2262. value: function deleteText(index, length) {
  2263. this.scroll.deleteAt(index, length);
  2264. return this.update(new _quillDelta2.default().retain(index).delete(length));
  2265. }
  2266. }, {
  2267. key: 'formatLine',
  2268. value: function formatLine(index, length) {
  2269. var _this2 = this;
  2270. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2271. this.scroll.update();
  2272. Object.keys(formats).forEach(function (format) {
  2273. if (_this2.scroll.whitelist != null && !_this2.scroll.whitelist[format]) return;
  2274. var lines = _this2.scroll.lines(index, Math.max(length, 1));
  2275. var lengthRemaining = length;
  2276. lines.forEach(function (line) {
  2277. var lineLength = line.length();
  2278. if (!(line instanceof _code2.default)) {
  2279. line.format(format, formats[format]);
  2280. } else {
  2281. var codeIndex = index - line.offset(_this2.scroll);
  2282. var codeLength = line.newlineIndex(codeIndex + lengthRemaining) - codeIndex + 1;
  2283. line.formatAt(codeIndex, codeLength, format, formats[format]);
  2284. }
  2285. lengthRemaining -= lineLength;
  2286. });
  2287. });
  2288. this.scroll.optimize();
  2289. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  2290. }
  2291. }, {
  2292. key: 'formatText',
  2293. value: function formatText(index, length) {
  2294. var _this3 = this;
  2295. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2296. Object.keys(formats).forEach(function (format) {
  2297. _this3.scroll.formatAt(index, length, format, formats[format]);
  2298. });
  2299. return this.update(new _quillDelta2.default().retain(index).retain(length, (0, _clone2.default)(formats)));
  2300. }
  2301. }, {
  2302. key: 'getContents',
  2303. value: function getContents(index, length) {
  2304. return this.delta.slice(index, index + length);
  2305. }
  2306. }, {
  2307. key: 'getDelta',
  2308. value: function getDelta() {
  2309. return this.scroll.lines().reduce(function (delta, line) {
  2310. return delta.concat(line.delta());
  2311. }, new _quillDelta2.default());
  2312. }
  2313. }, {
  2314. key: 'getFormat',
  2315. value: function getFormat(index) {
  2316. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2317. var lines = [],
  2318. leaves = [];
  2319. if (length === 0) {
  2320. this.scroll.path(index).forEach(function (path) {
  2321. var _path = _slicedToArray(path, 1),
  2322. blot = _path[0];
  2323. if (blot instanceof _block2.default) {
  2324. lines.push(blot);
  2325. } else if (blot instanceof _parchment2.default.Leaf) {
  2326. leaves.push(blot);
  2327. }
  2328. });
  2329. } else {
  2330. lines = this.scroll.lines(index, length);
  2331. leaves = this.scroll.descendants(_parchment2.default.Leaf, index, length);
  2332. }
  2333. var formatsArr = [lines, leaves].map(function (blots) {
  2334. if (blots.length === 0) return {};
  2335. var formats = (0, _block.bubbleFormats)(blots.shift());
  2336. while (Object.keys(formats).length > 0) {
  2337. var blot = blots.shift();
  2338. if (blot == null) return formats;
  2339. formats = combineFormats((0, _block.bubbleFormats)(blot), formats);
  2340. }
  2341. return formats;
  2342. });
  2343. return _extend2.default.apply(_extend2.default, formatsArr);
  2344. }
  2345. }, {
  2346. key: 'getText',
  2347. value: function getText(index, length) {
  2348. return this.getContents(index, length).filter(function (op) {
  2349. return typeof op.insert === 'string';
  2350. }).map(function (op) {
  2351. return op.insert;
  2352. }).join('');
  2353. }
  2354. }, {
  2355. key: 'insertEmbed',
  2356. value: function insertEmbed(index, embed, value) {
  2357. this.scroll.insertAt(index, embed, value);
  2358. return this.update(new _quillDelta2.default().retain(index).insert(_defineProperty({}, embed, value)));
  2359. }
  2360. }, {
  2361. key: 'insertText',
  2362. value: function insertText(index, text) {
  2363. var _this4 = this;
  2364. var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  2365. text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2366. this.scroll.insertAt(index, text);
  2367. Object.keys(formats).forEach(function (format) {
  2368. _this4.scroll.formatAt(index, text.length, format, formats[format]);
  2369. });
  2370. return this.update(new _quillDelta2.default().retain(index).insert(text, (0, _clone2.default)(formats)));
  2371. }
  2372. }, {
  2373. key: 'isBlank',
  2374. value: function isBlank() {
  2375. if (this.scroll.children.length == 0) return true;
  2376. if (this.scroll.children.length > 1) return false;
  2377. var block = this.scroll.children.head;
  2378. if (block.statics.blotName !== _block2.default.blotName) return false;
  2379. if (block.children.length > 1) return false;
  2380. return block.children.head instanceof _break2.default;
  2381. }
  2382. }, {
  2383. key: 'removeFormat',
  2384. value: function removeFormat(index, length) {
  2385. var text = this.getText(index, length);
  2386. var _scroll$line3 = this.scroll.line(index + length),
  2387. _scroll$line4 = _slicedToArray(_scroll$line3, 2),
  2388. line = _scroll$line4[0],
  2389. offset = _scroll$line4[1];
  2390. var suffixLength = 0,
  2391. suffix = new _quillDelta2.default();
  2392. if (line != null) {
  2393. if (!(line instanceof _code2.default)) {
  2394. suffixLength = line.length() - offset;
  2395. } else {
  2396. suffixLength = line.newlineIndex(offset) - offset + 1;
  2397. }
  2398. suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n');
  2399. }
  2400. var contents = this.getContents(index, length + suffixLength);
  2401. var diff = contents.diff(new _quillDelta2.default().insert(text).concat(suffix));
  2402. var delta = new _quillDelta2.default().retain(index).concat(diff);
  2403. return this.applyDelta(delta);
  2404. }
  2405. }, {
  2406. key: 'update',
  2407. value: function update(change) {
  2408. var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
  2409. var cursorIndex = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined;
  2410. var oldDelta = this.delta;
  2411. if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && _parchment2.default.find(mutations[0].target)) {
  2412. // Optimization for character changes
  2413. var textBlot = _parchment2.default.find(mutations[0].target);
  2414. var formats = (0, _block.bubbleFormats)(textBlot);
  2415. var index = textBlot.offset(this.scroll);
  2416. var oldValue = mutations[0].oldValue.replace(_cursor2.default.CONTENTS, '');
  2417. var oldText = new _quillDelta2.default().insert(oldValue);
  2418. var newText = new _quillDelta2.default().insert(textBlot.value());
  2419. var diffDelta = new _quillDelta2.default().retain(index).concat(oldText.diff(newText, cursorIndex));
  2420. change = diffDelta.reduce(function (delta, op) {
  2421. if (op.insert) {
  2422. return delta.insert(op.insert, formats);
  2423. } else {
  2424. return delta.push(op);
  2425. }
  2426. }, new _quillDelta2.default());
  2427. this.delta = oldDelta.compose(change);
  2428. } else {
  2429. this.delta = this.getDelta();
  2430. if (!change || !(0, _deepEqual2.default)(oldDelta.compose(change), this.delta)) {
  2431. change = oldDelta.diff(this.delta, cursorIndex);
  2432. }
  2433. }
  2434. return change;
  2435. }
  2436. }]);
  2437. return Editor;
  2438. }();
  2439. function combineFormats(formats, combined) {
  2440. return Object.keys(combined).reduce(function (merged, name) {
  2441. if (formats[name] == null) return merged;
  2442. if (combined[name] === formats[name]) {
  2443. merged[name] = combined[name];
  2444. } else if (Array.isArray(combined[name])) {
  2445. if (combined[name].indexOf(formats[name]) < 0) {
  2446. merged[name] = combined[name].concat([formats[name]]);
  2447. }
  2448. } else {
  2449. merged[name] = [combined[name], formats[name]];
  2450. }
  2451. return merged;
  2452. }, {});
  2453. }
  2454. function normalizeDelta(delta) {
  2455. return delta.reduce(function (delta, op) {
  2456. if (op.insert === 1) {
  2457. var attributes = (0, _clone2.default)(op.attributes);
  2458. delete attributes['image'];
  2459. return delta.insert({ image: op.attributes.image }, attributes);
  2460. }
  2461. if (op.attributes != null && (op.attributes.list === true || op.attributes.bullet === true)) {
  2462. op = (0, _clone2.default)(op);
  2463. if (op.attributes.list) {
  2464. op.attributes.list = 'ordered';
  2465. } else {
  2466. op.attributes.list = 'bullet';
  2467. delete op.attributes.bullet;
  2468. }
  2469. }
  2470. if (typeof op.insert === 'string') {
  2471. var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
  2472. return delta.insert(text, op.attributes);
  2473. }
  2474. return delta.push(op);
  2475. }, new _quillDelta2.default());
  2476. }
  2477. exports.default = Editor;
  2478. /***/ }),
  2479. /* 15 */
  2480. /***/ (function(module, exports, __webpack_require__) {
  2481. "use strict";
  2482. Object.defineProperty(exports, "__esModule", {
  2483. value: true
  2484. });
  2485. exports.default = exports.Range = undefined;
  2486. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  2487. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2488. var _parchment = __webpack_require__(0);
  2489. var _parchment2 = _interopRequireDefault(_parchment);
  2490. var _clone = __webpack_require__(21);
  2491. var _clone2 = _interopRequireDefault(_clone);
  2492. var _deepEqual = __webpack_require__(11);
  2493. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  2494. var _emitter3 = __webpack_require__(8);
  2495. var _emitter4 = _interopRequireDefault(_emitter3);
  2496. var _logger = __webpack_require__(10);
  2497. var _logger2 = _interopRequireDefault(_logger);
  2498. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2499. function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
  2500. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2501. var debug = (0, _logger2.default)('quill:selection');
  2502. var Range = function Range(index) {
  2503. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2504. _classCallCheck(this, Range);
  2505. this.index = index;
  2506. this.length = length;
  2507. };
  2508. var Selection = function () {
  2509. function Selection(scroll, emitter) {
  2510. var _this = this;
  2511. _classCallCheck(this, Selection);
  2512. this.emitter = emitter;
  2513. this.scroll = scroll;
  2514. this.composing = false;
  2515. this.mouseDown = false;
  2516. this.root = this.scroll.domNode;
  2517. this.cursor = _parchment2.default.create('cursor', this);
  2518. // savedRange is last non-null range
  2519. this.lastRange = this.savedRange = new Range(0, 0);
  2520. this.handleComposition();
  2521. this.handleDragging();
  2522. this.emitter.listenDOM('selectionchange', document, function () {
  2523. if (!_this.mouseDown) {
  2524. setTimeout(_this.update.bind(_this, _emitter4.default.sources.USER), 1);
  2525. }
  2526. });
  2527. this.emitter.on(_emitter4.default.events.EDITOR_CHANGE, function (type, delta) {
  2528. if (type === _emitter4.default.events.TEXT_CHANGE && delta.length() > 0) {
  2529. _this.update(_emitter4.default.sources.SILENT);
  2530. }
  2531. });
  2532. this.emitter.on(_emitter4.default.events.SCROLL_BEFORE_UPDATE, function () {
  2533. if (!_this.hasFocus()) return;
  2534. var native = _this.getNativeRange();
  2535. if (native == null) return;
  2536. if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle
  2537. // TODO unclear if this has negative side effects
  2538. _this.emitter.once(_emitter4.default.events.SCROLL_UPDATE, function () {
  2539. try {
  2540. _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset);
  2541. } catch (ignored) {}
  2542. });
  2543. });
  2544. this.emitter.on(_emitter4.default.events.SCROLL_OPTIMIZE, function (mutations, context) {
  2545. if (context.range) {
  2546. var _context$range = context.range,
  2547. startNode = _context$range.startNode,
  2548. startOffset = _context$range.startOffset,
  2549. endNode = _context$range.endNode,
  2550. endOffset = _context$range.endOffset;
  2551. _this.setNativeRange(startNode, startOffset, endNode, endOffset);
  2552. }
  2553. });
  2554. this.update(_emitter4.default.sources.SILENT);
  2555. }
  2556. _createClass(Selection, [{
  2557. key: 'handleComposition',
  2558. value: function handleComposition() {
  2559. var _this2 = this;
  2560. this.root.addEventListener('compositionstart', function () {
  2561. _this2.composing = true;
  2562. });
  2563. this.root.addEventListener('compositionend', function () {
  2564. _this2.composing = false;
  2565. if (_this2.cursor.parent) {
  2566. var range = _this2.cursor.restore();
  2567. if (!range) return;
  2568. setTimeout(function () {
  2569. _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset);
  2570. }, 1);
  2571. }
  2572. });
  2573. }
  2574. }, {
  2575. key: 'handleDragging',
  2576. value: function handleDragging() {
  2577. var _this3 = this;
  2578. this.emitter.listenDOM('mousedown', document.body, function () {
  2579. _this3.mouseDown = true;
  2580. });
  2581. this.emitter.listenDOM('mouseup', document.body, function () {
  2582. _this3.mouseDown = false;
  2583. _this3.update(_emitter4.default.sources.USER);
  2584. });
  2585. }
  2586. }, {
  2587. key: 'focus',
  2588. value: function focus() {
  2589. if (this.hasFocus()) return;
  2590. this.root.focus();
  2591. this.setRange(this.savedRange);
  2592. }
  2593. }, {
  2594. key: 'format',
  2595. value: function format(_format, value) {
  2596. if (this.scroll.whitelist != null && !this.scroll.whitelist[_format]) return;
  2597. this.scroll.update();
  2598. var nativeRange = this.getNativeRange();
  2599. if (nativeRange == null || !nativeRange.native.collapsed || _parchment2.default.query(_format, _parchment2.default.Scope.BLOCK)) return;
  2600. if (nativeRange.start.node !== this.cursor.textNode) {
  2601. var blot = _parchment2.default.find(nativeRange.start.node, false);
  2602. if (blot == null) return;
  2603. // TODO Give blot ability to not split
  2604. if (blot instanceof _parchment2.default.Leaf) {
  2605. var after = blot.split(nativeRange.start.offset);
  2606. blot.parent.insertBefore(this.cursor, after);
  2607. } else {
  2608. blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen
  2609. }
  2610. this.cursor.attach();
  2611. }
  2612. this.cursor.format(_format, value);
  2613. this.scroll.optimize();
  2614. this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length);
  2615. this.update();
  2616. }
  2617. }, {
  2618. key: 'getBounds',
  2619. value: function getBounds(index) {
  2620. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
  2621. var scrollLength = this.scroll.length();
  2622. index = Math.min(index, scrollLength - 1);
  2623. length = Math.min(index + length, scrollLength - 1) - index;
  2624. var node = void 0,
  2625. _scroll$leaf = this.scroll.leaf(index),
  2626. _scroll$leaf2 = _slicedToArray(_scroll$leaf, 2),
  2627. leaf = _scroll$leaf2[0],
  2628. offset = _scroll$leaf2[1];
  2629. if (leaf == null) return null;
  2630. var _leaf$position = leaf.position(offset, true);
  2631. var _leaf$position2 = _slicedToArray(_leaf$position, 2);
  2632. node = _leaf$position2[0];
  2633. offset = _leaf$position2[1];
  2634. var range = document.createRange();
  2635. if (length > 0) {
  2636. range.setStart(node, offset);
  2637. var _scroll$leaf3 = this.scroll.leaf(index + length);
  2638. var _scroll$leaf4 = _slicedToArray(_scroll$leaf3, 2);
  2639. leaf = _scroll$leaf4[0];
  2640. offset = _scroll$leaf4[1];
  2641. if (leaf == null) return null;
  2642. var _leaf$position3 = leaf.position(offset, true);
  2643. var _leaf$position4 = _slicedToArray(_leaf$position3, 2);
  2644. node = _leaf$position4[0];
  2645. offset = _leaf$position4[1];
  2646. range.setEnd(node, offset);
  2647. return range.getBoundingClientRect();
  2648. } else {
  2649. var side = 'left';
  2650. var rect = void 0;
  2651. if (node instanceof Text) {
  2652. if (offset < node.data.length) {
  2653. range.setStart(node, offset);
  2654. range.setEnd(node, offset + 1);
  2655. } else {
  2656. range.setStart(node, offset - 1);
  2657. range.setEnd(node, offset);
  2658. side = 'right';
  2659. }
  2660. rect = range.getBoundingClientRect();
  2661. } else {
  2662. rect = leaf.domNode.getBoundingClientRect();
  2663. if (offset > 0) side = 'right';
  2664. }
  2665. return {
  2666. bottom: rect.top + rect.height,
  2667. height: rect.height,
  2668. left: rect[side],
  2669. right: rect[side],
  2670. top: rect.top,
  2671. width: 0
  2672. };
  2673. }
  2674. }
  2675. }, {
  2676. key: 'getNativeRange',
  2677. value: function getNativeRange() {
  2678. var selection = document.getSelection();
  2679. if (selection == null || selection.rangeCount <= 0) return null;
  2680. var nativeRange = selection.getRangeAt(0);
  2681. if (nativeRange == null) return null;
  2682. var range = this.normalizeNative(nativeRange);
  2683. debug.info('getNativeRange', range);
  2684. return range;
  2685. }
  2686. }, {
  2687. key: 'getRange',
  2688. value: function getRange() {
  2689. var normalized = this.getNativeRange();
  2690. if (normalized == null) return [null, null];
  2691. var range = this.normalizedToRange(normalized);
  2692. return [range, normalized];
  2693. }
  2694. }, {
  2695. key: 'hasFocus',
  2696. value: function hasFocus() {
  2697. return document.activeElement === this.root;
  2698. }
  2699. }, {
  2700. key: 'normalizedToRange',
  2701. value: function normalizedToRange(range) {
  2702. var _this4 = this;
  2703. var positions = [[range.start.node, range.start.offset]];
  2704. if (!range.native.collapsed) {
  2705. positions.push([range.end.node, range.end.offset]);
  2706. }
  2707. var indexes = positions.map(function (position) {
  2708. var _position = _slicedToArray(position, 2),
  2709. node = _position[0],
  2710. offset = _position[1];
  2711. var blot = _parchment2.default.find(node, true);
  2712. var index = blot.offset(_this4.scroll);
  2713. if (offset === 0) {
  2714. return index;
  2715. } else if (blot instanceof _parchment2.default.Container) {
  2716. return index + blot.length();
  2717. } else {
  2718. return index + blot.index(node, offset);
  2719. }
  2720. });
  2721. var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1);
  2722. var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes)));
  2723. return new Range(start, end - start);
  2724. }
  2725. }, {
  2726. key: 'normalizeNative',
  2727. value: function normalizeNative(nativeRange) {
  2728. if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) {
  2729. return null;
  2730. }
  2731. var range = {
  2732. start: { node: nativeRange.startContainer, offset: nativeRange.startOffset },
  2733. end: { node: nativeRange.endContainer, offset: nativeRange.endOffset },
  2734. native: nativeRange
  2735. };
  2736. [range.start, range.end].forEach(function (position) {
  2737. var node = position.node,
  2738. offset = position.offset;
  2739. while (!(node instanceof Text) && node.childNodes.length > 0) {
  2740. if (node.childNodes.length > offset) {
  2741. node = node.childNodes[offset];
  2742. offset = 0;
  2743. } else if (node.childNodes.length === offset) {
  2744. node = node.lastChild;
  2745. offset = node instanceof Text ? node.data.length : node.childNodes.length + 1;
  2746. } else {
  2747. break;
  2748. }
  2749. }
  2750. position.node = node, position.offset = offset;
  2751. });
  2752. return range;
  2753. }
  2754. }, {
  2755. key: 'rangeToNative',
  2756. value: function rangeToNative(range) {
  2757. var _this5 = this;
  2758. var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length];
  2759. var args = [];
  2760. var scrollLength = this.scroll.length();
  2761. indexes.forEach(function (index, i) {
  2762. index = Math.min(scrollLength - 1, index);
  2763. var node = void 0,
  2764. _scroll$leaf5 = _this5.scroll.leaf(index),
  2765. _scroll$leaf6 = _slicedToArray(_scroll$leaf5, 2),
  2766. leaf = _scroll$leaf6[0],
  2767. offset = _scroll$leaf6[1];
  2768. var _leaf$position5 = leaf.position(offset, i !== 0);
  2769. var _leaf$position6 = _slicedToArray(_leaf$position5, 2);
  2770. node = _leaf$position6[0];
  2771. offset = _leaf$position6[1];
  2772. args.push(node, offset);
  2773. });
  2774. if (args.length < 2) {
  2775. args = args.concat(args);
  2776. }
  2777. return args;
  2778. }
  2779. }, {
  2780. key: 'scrollIntoView',
  2781. value: function scrollIntoView(scrollingContainer) {
  2782. var range = this.lastRange;
  2783. if (range == null) return;
  2784. var bounds = this.getBounds(range.index, range.length);
  2785. if (bounds == null) return;
  2786. var limit = this.scroll.length() - 1;
  2787. var _scroll$line = this.scroll.line(Math.min(range.index, limit)),
  2788. _scroll$line2 = _slicedToArray(_scroll$line, 1),
  2789. first = _scroll$line2[0];
  2790. var last = first;
  2791. if (range.length > 0) {
  2792. var _scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit));
  2793. var _scroll$line4 = _slicedToArray(_scroll$line3, 1);
  2794. last = _scroll$line4[0];
  2795. }
  2796. if (first == null || last == null) return;
  2797. var scrollBounds = scrollingContainer.getBoundingClientRect();
  2798. if (bounds.top < scrollBounds.top) {
  2799. scrollingContainer.scrollTop -= scrollBounds.top - bounds.top;
  2800. } else if (bounds.bottom > scrollBounds.bottom) {
  2801. scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom;
  2802. }
  2803. }
  2804. }, {
  2805. key: 'setNativeRange',
  2806. value: function setNativeRange(startNode, startOffset) {
  2807. var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode;
  2808. var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset;
  2809. var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
  2810. debug.info('setNativeRange', startNode, startOffset, endNode, endOffset);
  2811. if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) {
  2812. return;
  2813. }
  2814. var selection = document.getSelection();
  2815. if (selection == null) return;
  2816. if (startNode != null) {
  2817. if (!this.hasFocus()) this.root.focus();
  2818. var native = (this.getNativeRange() || {}).native;
  2819. if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) {
  2820. if (startNode.tagName == "BR") {
  2821. startOffset = [].indexOf.call(startNode.parentNode.childNodes, startNode);
  2822. startNode = startNode.parentNode;
  2823. }
  2824. if (endNode.tagName == "BR") {
  2825. endOffset = [].indexOf.call(endNode.parentNode.childNodes, endNode);
  2826. endNode = endNode.parentNode;
  2827. }
  2828. var range = document.createRange();
  2829. range.setStart(startNode, startOffset);
  2830. range.setEnd(endNode, endOffset);
  2831. selection.removeAllRanges();
  2832. selection.addRange(range);
  2833. }
  2834. } else {
  2835. selection.removeAllRanges();
  2836. this.root.blur();
  2837. document.body.focus(); // root.blur() not enough on IE11+Travis+SauceLabs (but not local VMs)
  2838. }
  2839. }
  2840. }, {
  2841. key: 'setRange',
  2842. value: function setRange(range) {
  2843. var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  2844. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter4.default.sources.API;
  2845. if (typeof force === 'string') {
  2846. source = force;
  2847. force = false;
  2848. }
  2849. debug.info('setRange', range);
  2850. if (range != null) {
  2851. var args = this.rangeToNative(range);
  2852. this.setNativeRange.apply(this, _toConsumableArray(args).concat([force]));
  2853. } else {
  2854. this.setNativeRange(null);
  2855. }
  2856. this.update(source);
  2857. }
  2858. }, {
  2859. key: 'update',
  2860. value: function update() {
  2861. var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter4.default.sources.USER;
  2862. var oldRange = this.lastRange;
  2863. var _getRange = this.getRange(),
  2864. _getRange2 = _slicedToArray(_getRange, 2),
  2865. lastRange = _getRange2[0],
  2866. nativeRange = _getRange2[1];
  2867. this.lastRange = lastRange;
  2868. if (this.lastRange != null) {
  2869. this.savedRange = this.lastRange;
  2870. }
  2871. if (!(0, _deepEqual2.default)(oldRange, this.lastRange)) {
  2872. var _emitter;
  2873. if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) {
  2874. this.cursor.restore();
  2875. }
  2876. var args = [_emitter4.default.events.SELECTION_CHANGE, (0, _clone2.default)(this.lastRange), (0, _clone2.default)(oldRange), source];
  2877. (_emitter = this.emitter).emit.apply(_emitter, [_emitter4.default.events.EDITOR_CHANGE].concat(args));
  2878. if (source !== _emitter4.default.sources.SILENT) {
  2879. var _emitter2;
  2880. (_emitter2 = this.emitter).emit.apply(_emitter2, args);
  2881. }
  2882. }
  2883. }
  2884. }]);
  2885. return Selection;
  2886. }();
  2887. function contains(parent, descendant) {
  2888. try {
  2889. // Firefox inserts inaccessible nodes around video elements
  2890. descendant.parentNode;
  2891. } catch (e) {
  2892. return false;
  2893. }
  2894. // IE11 has bug with Text nodes
  2895. // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect
  2896. if (descendant instanceof Text) {
  2897. descendant = descendant.parentNode;
  2898. }
  2899. return parent.contains(descendant);
  2900. }
  2901. exports.Range = Range;
  2902. exports.default = Selection;
  2903. /***/ }),
  2904. /* 16 */
  2905. /***/ (function(module, exports, __webpack_require__) {
  2906. "use strict";
  2907. Object.defineProperty(exports, "__esModule", {
  2908. value: true
  2909. });
  2910. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  2911. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  2912. var _parchment = __webpack_require__(0);
  2913. var _parchment2 = _interopRequireDefault(_parchment);
  2914. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  2915. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  2916. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  2917. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  2918. var Break = function (_Parchment$Embed) {
  2919. _inherits(Break, _Parchment$Embed);
  2920. function Break() {
  2921. _classCallCheck(this, Break);
  2922. return _possibleConstructorReturn(this, (Break.__proto__ || Object.getPrototypeOf(Break)).apply(this, arguments));
  2923. }
  2924. _createClass(Break, [{
  2925. key: 'insertInto',
  2926. value: function insertInto(parent, ref) {
  2927. if (parent.children.length === 0) {
  2928. _get(Break.prototype.__proto__ || Object.getPrototypeOf(Break.prototype), 'insertInto', this).call(this, parent, ref);
  2929. } else {
  2930. this.remove();
  2931. }
  2932. }
  2933. }, {
  2934. key: 'length',
  2935. value: function length() {
  2936. return 0;
  2937. }
  2938. }, {
  2939. key: 'value',
  2940. value: function value() {
  2941. return '';
  2942. }
  2943. }], [{
  2944. key: 'value',
  2945. value: function value() {
  2946. return undefined;
  2947. }
  2948. }]);
  2949. return Break;
  2950. }(_parchment2.default.Embed);
  2951. Break.blotName = 'break';
  2952. Break.tagName = 'BR';
  2953. exports.default = Break;
  2954. /***/ }),
  2955. /* 17 */
  2956. /***/ (function(module, exports, __webpack_require__) {
  2957. "use strict";
  2958. var __extends = (this && this.__extends) || (function () {
  2959. var extendStatics = Object.setPrototypeOf ||
  2960. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  2961. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  2962. return function (d, b) {
  2963. extendStatics(d, b);
  2964. function __() { this.constructor = d; }
  2965. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  2966. };
  2967. })();
  2968. Object.defineProperty(exports, "__esModule", { value: true });
  2969. var linked_list_1 = __webpack_require__(44);
  2970. var shadow_1 = __webpack_require__(30);
  2971. var Registry = __webpack_require__(1);
  2972. var ContainerBlot = /** @class */ (function (_super) {
  2973. __extends(ContainerBlot, _super);
  2974. function ContainerBlot(domNode) {
  2975. var _this = _super.call(this, domNode) || this;
  2976. _this.build();
  2977. return _this;
  2978. }
  2979. ContainerBlot.prototype.appendChild = function (other) {
  2980. this.insertBefore(other);
  2981. };
  2982. ContainerBlot.prototype.attach = function () {
  2983. _super.prototype.attach.call(this);
  2984. this.children.forEach(function (child) {
  2985. child.attach();
  2986. });
  2987. };
  2988. ContainerBlot.prototype.build = function () {
  2989. var _this = this;
  2990. this.children = new linked_list_1.default();
  2991. // Need to be reversed for if DOM nodes already in order
  2992. [].slice
  2993. .call(this.domNode.childNodes)
  2994. .reverse()
  2995. .forEach(function (node) {
  2996. try {
  2997. var child = makeBlot(node);
  2998. _this.insertBefore(child, _this.children.head || undefined);
  2999. }
  3000. catch (err) {
  3001. if (err instanceof Registry.ParchmentError)
  3002. return;
  3003. else
  3004. throw err;
  3005. }
  3006. });
  3007. };
  3008. ContainerBlot.prototype.deleteAt = function (index, length) {
  3009. if (index === 0 && length === this.length()) {
  3010. return this.remove();
  3011. }
  3012. this.children.forEachAt(index, length, function (child, offset, length) {
  3013. child.deleteAt(offset, length);
  3014. });
  3015. };
  3016. ContainerBlot.prototype.descendant = function (criteria, index) {
  3017. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  3018. if ((criteria.blotName == null && criteria(child)) ||
  3019. (criteria.blotName != null && child instanceof criteria)) {
  3020. return [child, offset];
  3021. }
  3022. else if (child instanceof ContainerBlot) {
  3023. return child.descendant(criteria, offset);
  3024. }
  3025. else {
  3026. return [null, -1];
  3027. }
  3028. };
  3029. ContainerBlot.prototype.descendants = function (criteria, index, length) {
  3030. if (index === void 0) { index = 0; }
  3031. if (length === void 0) { length = Number.MAX_VALUE; }
  3032. var descendants = [];
  3033. var lengthLeft = length;
  3034. this.children.forEachAt(index, length, function (child, index, length) {
  3035. if ((criteria.blotName == null && criteria(child)) ||
  3036. (criteria.blotName != null && child instanceof criteria)) {
  3037. descendants.push(child);
  3038. }
  3039. if (child instanceof ContainerBlot) {
  3040. descendants = descendants.concat(child.descendants(criteria, index, lengthLeft));
  3041. }
  3042. lengthLeft -= length;
  3043. });
  3044. return descendants;
  3045. };
  3046. ContainerBlot.prototype.detach = function () {
  3047. this.children.forEach(function (child) {
  3048. child.detach();
  3049. });
  3050. _super.prototype.detach.call(this);
  3051. };
  3052. ContainerBlot.prototype.formatAt = function (index, length, name, value) {
  3053. this.children.forEachAt(index, length, function (child, offset, length) {
  3054. child.formatAt(offset, length, name, value);
  3055. });
  3056. };
  3057. ContainerBlot.prototype.insertAt = function (index, value, def) {
  3058. var _a = this.children.find(index), child = _a[0], offset = _a[1];
  3059. if (child) {
  3060. child.insertAt(offset, value, def);
  3061. }
  3062. else {
  3063. var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
  3064. this.appendChild(blot);
  3065. }
  3066. };
  3067. ContainerBlot.prototype.insertBefore = function (childBlot, refBlot) {
  3068. if (this.statics.allowedChildren != null &&
  3069. !this.statics.allowedChildren.some(function (child) {
  3070. return childBlot instanceof child;
  3071. })) {
  3072. throw new Registry.ParchmentError("Cannot insert " + childBlot.statics.blotName + " into " + this.statics.blotName);
  3073. }
  3074. childBlot.insertInto(this, refBlot);
  3075. };
  3076. ContainerBlot.prototype.length = function () {
  3077. return this.children.reduce(function (memo, child) {
  3078. return memo + child.length();
  3079. }, 0);
  3080. };
  3081. ContainerBlot.prototype.moveChildren = function (targetParent, refNode) {
  3082. this.children.forEach(function (child) {
  3083. targetParent.insertBefore(child, refNode);
  3084. });
  3085. };
  3086. ContainerBlot.prototype.optimize = function (context) {
  3087. _super.prototype.optimize.call(this, context);
  3088. if (this.children.length === 0) {
  3089. if (this.statics.defaultChild != null) {
  3090. var child = Registry.create(this.statics.defaultChild);
  3091. this.appendChild(child);
  3092. child.optimize(context);
  3093. }
  3094. else {
  3095. this.remove();
  3096. }
  3097. }
  3098. };
  3099. ContainerBlot.prototype.path = function (index, inclusive) {
  3100. if (inclusive === void 0) { inclusive = false; }
  3101. var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1];
  3102. var position = [[this, index]];
  3103. if (child instanceof ContainerBlot) {
  3104. return position.concat(child.path(offset, inclusive));
  3105. }
  3106. else if (child != null) {
  3107. position.push([child, offset]);
  3108. }
  3109. return position;
  3110. };
  3111. ContainerBlot.prototype.removeChild = function (child) {
  3112. this.children.remove(child);
  3113. };
  3114. ContainerBlot.prototype.replace = function (target) {
  3115. if (target instanceof ContainerBlot) {
  3116. target.moveChildren(this);
  3117. }
  3118. _super.prototype.replace.call(this, target);
  3119. };
  3120. ContainerBlot.prototype.split = function (index, force) {
  3121. if (force === void 0) { force = false; }
  3122. if (!force) {
  3123. if (index === 0)
  3124. return this;
  3125. if (index === this.length())
  3126. return this.next;
  3127. }
  3128. var after = this.clone();
  3129. this.parent.insertBefore(after, this.next);
  3130. this.children.forEachAt(index, this.length(), function (child, offset, length) {
  3131. child = child.split(offset, force);
  3132. after.appendChild(child);
  3133. });
  3134. return after;
  3135. };
  3136. ContainerBlot.prototype.unwrap = function () {
  3137. this.moveChildren(this.parent, this.next);
  3138. this.remove();
  3139. };
  3140. ContainerBlot.prototype.update = function (mutations, context) {
  3141. var _this = this;
  3142. var addedNodes = [];
  3143. var removedNodes = [];
  3144. mutations.forEach(function (mutation) {
  3145. if (mutation.target === _this.domNode && mutation.type === 'childList') {
  3146. addedNodes.push.apply(addedNodes, mutation.addedNodes);
  3147. removedNodes.push.apply(removedNodes, mutation.removedNodes);
  3148. }
  3149. });
  3150. removedNodes.forEach(function (node) {
  3151. // Check node has actually been removed
  3152. // One exception is Chrome does not immediately remove IFRAMEs
  3153. // from DOM but MutationRecord is correct in its reported removal
  3154. if (node.parentNode != null &&
  3155. // @ts-ignore
  3156. node.tagName !== 'IFRAME' &&
  3157. document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
  3158. return;
  3159. }
  3160. var blot = Registry.find(node);
  3161. if (blot == null)
  3162. return;
  3163. if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) {
  3164. blot.detach();
  3165. }
  3166. });
  3167. addedNodes
  3168. .filter(function (node) {
  3169. return node.parentNode == _this.domNode;
  3170. })
  3171. .sort(function (a, b) {
  3172. if (a === b)
  3173. return 0;
  3174. if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) {
  3175. return 1;
  3176. }
  3177. return -1;
  3178. })
  3179. .forEach(function (node) {
  3180. var refBlot = null;
  3181. if (node.nextSibling != null) {
  3182. refBlot = Registry.find(node.nextSibling);
  3183. }
  3184. var blot = makeBlot(node);
  3185. if (blot.next != refBlot || blot.next == null) {
  3186. if (blot.parent != null) {
  3187. blot.parent.removeChild(_this);
  3188. }
  3189. _this.insertBefore(blot, refBlot || undefined);
  3190. }
  3191. });
  3192. };
  3193. return ContainerBlot;
  3194. }(shadow_1.default));
  3195. function makeBlot(node) {
  3196. var blot = Registry.find(node);
  3197. if (blot == null) {
  3198. try {
  3199. blot = Registry.create(node);
  3200. }
  3201. catch (e) {
  3202. blot = Registry.create(Registry.Scope.INLINE);
  3203. [].slice.call(node.childNodes).forEach(function (child) {
  3204. // @ts-ignore
  3205. blot.domNode.appendChild(child);
  3206. });
  3207. if (node.parentNode) {
  3208. node.parentNode.replaceChild(blot.domNode, node);
  3209. }
  3210. blot.attach();
  3211. }
  3212. }
  3213. return blot;
  3214. }
  3215. exports.default = ContainerBlot;
  3216. /***/ }),
  3217. /* 18 */
  3218. /***/ (function(module, exports, __webpack_require__) {
  3219. "use strict";
  3220. var __extends = (this && this.__extends) || (function () {
  3221. var extendStatics = Object.setPrototypeOf ||
  3222. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3223. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3224. return function (d, b) {
  3225. extendStatics(d, b);
  3226. function __() { this.constructor = d; }
  3227. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3228. };
  3229. })();
  3230. Object.defineProperty(exports, "__esModule", { value: true });
  3231. var attributor_1 = __webpack_require__(12);
  3232. var store_1 = __webpack_require__(31);
  3233. var container_1 = __webpack_require__(17);
  3234. var Registry = __webpack_require__(1);
  3235. var FormatBlot = /** @class */ (function (_super) {
  3236. __extends(FormatBlot, _super);
  3237. function FormatBlot(domNode) {
  3238. var _this = _super.call(this, domNode) || this;
  3239. _this.attributes = new store_1.default(_this.domNode);
  3240. return _this;
  3241. }
  3242. FormatBlot.formats = function (domNode) {
  3243. if (typeof this.tagName === 'string') {
  3244. return true;
  3245. }
  3246. else if (Array.isArray(this.tagName)) {
  3247. return domNode.tagName.toLowerCase();
  3248. }
  3249. return undefined;
  3250. };
  3251. FormatBlot.prototype.format = function (name, value) {
  3252. var format = Registry.query(name);
  3253. if (format instanceof attributor_1.default) {
  3254. this.attributes.attribute(format, value);
  3255. }
  3256. else if (value) {
  3257. if (format != null && (name !== this.statics.blotName || this.formats()[name] !== value)) {
  3258. this.replaceWith(name, value);
  3259. }
  3260. }
  3261. };
  3262. FormatBlot.prototype.formats = function () {
  3263. var formats = this.attributes.values();
  3264. var format = this.statics.formats(this.domNode);
  3265. if (format != null) {
  3266. formats[this.statics.blotName] = format;
  3267. }
  3268. return formats;
  3269. };
  3270. FormatBlot.prototype.replaceWith = function (name, value) {
  3271. var replacement = _super.prototype.replaceWith.call(this, name, value);
  3272. this.attributes.copy(replacement);
  3273. return replacement;
  3274. };
  3275. FormatBlot.prototype.update = function (mutations, context) {
  3276. var _this = this;
  3277. _super.prototype.update.call(this, mutations, context);
  3278. if (mutations.some(function (mutation) {
  3279. return mutation.target === _this.domNode && mutation.type === 'attributes';
  3280. })) {
  3281. this.attributes.build();
  3282. }
  3283. };
  3284. FormatBlot.prototype.wrap = function (name, value) {
  3285. var wrapper = _super.prototype.wrap.call(this, name, value);
  3286. if (wrapper instanceof FormatBlot && wrapper.statics.scope === this.statics.scope) {
  3287. this.attributes.move(wrapper);
  3288. }
  3289. return wrapper;
  3290. };
  3291. return FormatBlot;
  3292. }(container_1.default));
  3293. exports.default = FormatBlot;
  3294. /***/ }),
  3295. /* 19 */
  3296. /***/ (function(module, exports, __webpack_require__) {
  3297. "use strict";
  3298. var __extends = (this && this.__extends) || (function () {
  3299. var extendStatics = Object.setPrototypeOf ||
  3300. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  3301. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  3302. return function (d, b) {
  3303. extendStatics(d, b);
  3304. function __() { this.constructor = d; }
  3305. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  3306. };
  3307. })();
  3308. Object.defineProperty(exports, "__esModule", { value: true });
  3309. var shadow_1 = __webpack_require__(30);
  3310. var Registry = __webpack_require__(1);
  3311. var LeafBlot = /** @class */ (function (_super) {
  3312. __extends(LeafBlot, _super);
  3313. function LeafBlot() {
  3314. return _super !== null && _super.apply(this, arguments) || this;
  3315. }
  3316. LeafBlot.value = function (domNode) {
  3317. return true;
  3318. };
  3319. LeafBlot.prototype.index = function (node, offset) {
  3320. if (this.domNode === node ||
  3321. this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) {
  3322. return Math.min(offset, 1);
  3323. }
  3324. return -1;
  3325. };
  3326. LeafBlot.prototype.position = function (index, inclusive) {
  3327. var offset = [].indexOf.call(this.parent.domNode.childNodes, this.domNode);
  3328. if (index > 0)
  3329. offset += 1;
  3330. return [this.parent.domNode, offset];
  3331. };
  3332. LeafBlot.prototype.value = function () {
  3333. var _a;
  3334. return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a;
  3335. };
  3336. LeafBlot.scope = Registry.Scope.INLINE_BLOT;
  3337. return LeafBlot;
  3338. }(shadow_1.default));
  3339. exports.default = LeafBlot;
  3340. /***/ }),
  3341. /* 20 */
  3342. /***/ (function(module, exports, __webpack_require__) {
  3343. var equal = __webpack_require__(11);
  3344. var extend = __webpack_require__(3);
  3345. var lib = {
  3346. attributes: {
  3347. compose: function (a, b, keepNull) {
  3348. if (typeof a !== 'object') a = {};
  3349. if (typeof b !== 'object') b = {};
  3350. var attributes = extend(true, {}, b);
  3351. if (!keepNull) {
  3352. attributes = Object.keys(attributes).reduce(function (copy, key) {
  3353. if (attributes[key] != null) {
  3354. copy[key] = attributes[key];
  3355. }
  3356. return copy;
  3357. }, {});
  3358. }
  3359. for (var key in a) {
  3360. if (a[key] !== undefined && b[key] === undefined) {
  3361. attributes[key] = a[key];
  3362. }
  3363. }
  3364. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3365. },
  3366. diff: function(a, b) {
  3367. if (typeof a !== 'object') a = {};
  3368. if (typeof b !== 'object') b = {};
  3369. var attributes = Object.keys(a).concat(Object.keys(b)).reduce(function (attributes, key) {
  3370. if (!equal(a[key], b[key])) {
  3371. attributes[key] = b[key] === undefined ? null : b[key];
  3372. }
  3373. return attributes;
  3374. }, {});
  3375. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3376. },
  3377. transform: function (a, b, priority) {
  3378. if (typeof a !== 'object') return b;
  3379. if (typeof b !== 'object') return undefined;
  3380. if (!priority) return b; // b simply overwrites us without priority
  3381. var attributes = Object.keys(b).reduce(function (attributes, key) {
  3382. if (a[key] === undefined) attributes[key] = b[key]; // null is a valid value
  3383. return attributes;
  3384. }, {});
  3385. return Object.keys(attributes).length > 0 ? attributes : undefined;
  3386. }
  3387. },
  3388. iterator: function (ops) {
  3389. return new Iterator(ops);
  3390. },
  3391. length: function (op) {
  3392. if (typeof op['delete'] === 'number') {
  3393. return op['delete'];
  3394. } else if (typeof op.retain === 'number') {
  3395. return op.retain;
  3396. } else {
  3397. return typeof op.insert === 'string' ? op.insert.length : 1;
  3398. }
  3399. }
  3400. };
  3401. function Iterator(ops) {
  3402. this.ops = ops;
  3403. this.index = 0;
  3404. this.offset = 0;
  3405. };
  3406. Iterator.prototype.hasNext = function () {
  3407. return this.peekLength() < Infinity;
  3408. };
  3409. Iterator.prototype.next = function (length) {
  3410. if (!length) length = Infinity;
  3411. var nextOp = this.ops[this.index];
  3412. if (nextOp) {
  3413. var offset = this.offset;
  3414. var opLength = lib.length(nextOp)
  3415. if (length >= opLength - offset) {
  3416. length = opLength - offset;
  3417. this.index += 1;
  3418. this.offset = 0;
  3419. } else {
  3420. this.offset += length;
  3421. }
  3422. if (typeof nextOp['delete'] === 'number') {
  3423. return { 'delete': length };
  3424. } else {
  3425. var retOp = {};
  3426. if (nextOp.attributes) {
  3427. retOp.attributes = nextOp.attributes;
  3428. }
  3429. if (typeof nextOp.retain === 'number') {
  3430. retOp.retain = length;
  3431. } else if (typeof nextOp.insert === 'string') {
  3432. retOp.insert = nextOp.insert.substr(offset, length);
  3433. } else {
  3434. // offset should === 0, length should === 1
  3435. retOp.insert = nextOp.insert;
  3436. }
  3437. return retOp;
  3438. }
  3439. } else {
  3440. return { retain: Infinity };
  3441. }
  3442. };
  3443. Iterator.prototype.peek = function () {
  3444. return this.ops[this.index];
  3445. };
  3446. Iterator.prototype.peekLength = function () {
  3447. if (this.ops[this.index]) {
  3448. // Should never return 0 if our index is being managed correctly
  3449. return lib.length(this.ops[this.index]) - this.offset;
  3450. } else {
  3451. return Infinity;
  3452. }
  3453. };
  3454. Iterator.prototype.peekType = function () {
  3455. if (this.ops[this.index]) {
  3456. if (typeof this.ops[this.index]['delete'] === 'number') {
  3457. return 'delete';
  3458. } else if (typeof this.ops[this.index].retain === 'number') {
  3459. return 'retain';
  3460. } else {
  3461. return 'insert';
  3462. }
  3463. }
  3464. return 'retain';
  3465. };
  3466. Iterator.prototype.rest = function () {
  3467. if (!this.hasNext()) {
  3468. return [];
  3469. } else if (this.offset === 0) {
  3470. return this.ops.slice(this.index);
  3471. } else {
  3472. var offset = this.offset;
  3473. var index = this.index;
  3474. var next = this.next();
  3475. var rest = this.ops.slice(this.index);
  3476. this.offset = offset;
  3477. this.index = index;
  3478. return [next].concat(rest);
  3479. }
  3480. };
  3481. module.exports = lib;
  3482. /***/ }),
  3483. /* 21 */
  3484. /***/ (function(module, exports) {
  3485. var clone = (function() {
  3486. 'use strict';
  3487. function _instanceof(obj, type) {
  3488. return type != null && obj instanceof type;
  3489. }
  3490. var nativeMap;
  3491. try {
  3492. nativeMap = Map;
  3493. } catch(_) {
  3494. // maybe a reference error because no `Map`. Give it a dummy value that no
  3495. // value will ever be an instanceof.
  3496. nativeMap = function() {};
  3497. }
  3498. var nativeSet;
  3499. try {
  3500. nativeSet = Set;
  3501. } catch(_) {
  3502. nativeSet = function() {};
  3503. }
  3504. var nativePromise;
  3505. try {
  3506. nativePromise = Promise;
  3507. } catch(_) {
  3508. nativePromise = function() {};
  3509. }
  3510. /**
  3511. * Clones (copies) an Object using deep copying.
  3512. *
  3513. * This function supports circular references by default, but if you are certain
  3514. * there are no circular references in your object, you can save some CPU time
  3515. * by calling clone(obj, false).
  3516. *
  3517. * Caution: if `circular` is false and `parent` contains circular references,
  3518. * your program may enter an infinite loop and crash.
  3519. *
  3520. * @param `parent` - the object to be cloned
  3521. * @param `circular` - set to true if the object to be cloned may contain
  3522. * circular references. (optional - true by default)
  3523. * @param `depth` - set to a number if the object is only to be cloned to
  3524. * a particular depth. (optional - defaults to Infinity)
  3525. * @param `prototype` - sets the prototype to be used when cloning an object.
  3526. * (optional - defaults to parent prototype).
  3527. * @param `includeNonEnumerable` - set to true if the non-enumerable properties
  3528. * should be cloned as well. Non-enumerable properties on the prototype
  3529. * chain will be ignored. (optional - false by default)
  3530. */
  3531. function clone(parent, circular, depth, prototype, includeNonEnumerable) {
  3532. if (typeof circular === 'object') {
  3533. depth = circular.depth;
  3534. prototype = circular.prototype;
  3535. includeNonEnumerable = circular.includeNonEnumerable;
  3536. circular = circular.circular;
  3537. }
  3538. // maintain two arrays for circular references, where corresponding parents
  3539. // and children have the same index
  3540. var allParents = [];
  3541. var allChildren = [];
  3542. var useBuffer = typeof Buffer != 'undefined';
  3543. if (typeof circular == 'undefined')
  3544. circular = true;
  3545. if (typeof depth == 'undefined')
  3546. depth = Infinity;
  3547. // recurse this function so we don't reset allParents and allChildren
  3548. function _clone(parent, depth) {
  3549. // cloning null always returns null
  3550. if (parent === null)
  3551. return null;
  3552. if (depth === 0)
  3553. return parent;
  3554. var child;
  3555. var proto;
  3556. if (typeof parent != 'object') {
  3557. return parent;
  3558. }
  3559. if (_instanceof(parent, nativeMap)) {
  3560. child = new nativeMap();
  3561. } else if (_instanceof(parent, nativeSet)) {
  3562. child = new nativeSet();
  3563. } else if (_instanceof(parent, nativePromise)) {
  3564. child = new nativePromise(function (resolve, reject) {
  3565. parent.then(function(value) {
  3566. resolve(_clone(value, depth - 1));
  3567. }, function(err) {
  3568. reject(_clone(err, depth - 1));
  3569. });
  3570. });
  3571. } else if (clone.__isArray(parent)) {
  3572. child = [];
  3573. } else if (clone.__isRegExp(parent)) {
  3574. child = new RegExp(parent.source, __getRegExpFlags(parent));
  3575. if (parent.lastIndex) child.lastIndex = parent.lastIndex;
  3576. } else if (clone.__isDate(parent)) {
  3577. child = new Date(parent.getTime());
  3578. } else if (useBuffer && Buffer.isBuffer(parent)) {
  3579. if (Buffer.allocUnsafe) {
  3580. // Node.js >= 4.5.0
  3581. child = Buffer.allocUnsafe(parent.length);
  3582. } else {
  3583. // Older Node.js versions
  3584. child = new Buffer(parent.length);
  3585. }
  3586. parent.copy(child);
  3587. return child;
  3588. } else if (_instanceof(parent, Error)) {
  3589. child = Object.create(parent);
  3590. } else {
  3591. if (typeof prototype == 'undefined') {
  3592. proto = Object.getPrototypeOf(parent);
  3593. child = Object.create(proto);
  3594. }
  3595. else {
  3596. child = Object.create(prototype);
  3597. proto = prototype;
  3598. }
  3599. }
  3600. if (circular) {
  3601. var index = allParents.indexOf(parent);
  3602. if (index != -1) {
  3603. return allChildren[index];
  3604. }
  3605. allParents.push(parent);
  3606. allChildren.push(child);
  3607. }
  3608. if (_instanceof(parent, nativeMap)) {
  3609. parent.forEach(function(value, key) {
  3610. var keyChild = _clone(key, depth - 1);
  3611. var valueChild = _clone(value, depth - 1);
  3612. child.set(keyChild, valueChild);
  3613. });
  3614. }
  3615. if (_instanceof(parent, nativeSet)) {
  3616. parent.forEach(function(value) {
  3617. var entryChild = _clone(value, depth - 1);
  3618. child.add(entryChild);
  3619. });
  3620. }
  3621. for (var i in parent) {
  3622. var attrs;
  3623. if (proto) {
  3624. attrs = Object.getOwnPropertyDescriptor(proto, i);
  3625. }
  3626. if (attrs && attrs.set == null) {
  3627. continue;
  3628. }
  3629. child[i] = _clone(parent[i], depth - 1);
  3630. }
  3631. if (Object.getOwnPropertySymbols) {
  3632. var symbols = Object.getOwnPropertySymbols(parent);
  3633. for (var i = 0; i < symbols.length; i++) {
  3634. // Don't need to worry about cloning a symbol because it is a primitive,
  3635. // like a number or string.
  3636. var symbol = symbols[i];
  3637. var descriptor = Object.getOwnPropertyDescriptor(parent, symbol);
  3638. if (descriptor && !descriptor.enumerable && !includeNonEnumerable) {
  3639. continue;
  3640. }
  3641. child[symbol] = _clone(parent[symbol], depth - 1);
  3642. if (!descriptor.enumerable) {
  3643. Object.defineProperty(child, symbol, {
  3644. enumerable: false
  3645. });
  3646. }
  3647. }
  3648. }
  3649. if (includeNonEnumerable) {
  3650. var allPropertyNames = Object.getOwnPropertyNames(parent);
  3651. for (var i = 0; i < allPropertyNames.length; i++) {
  3652. var propertyName = allPropertyNames[i];
  3653. var descriptor = Object.getOwnPropertyDescriptor(parent, propertyName);
  3654. if (descriptor && descriptor.enumerable) {
  3655. continue;
  3656. }
  3657. child[propertyName] = _clone(parent[propertyName], depth - 1);
  3658. Object.defineProperty(child, propertyName, {
  3659. enumerable: false
  3660. });
  3661. }
  3662. }
  3663. return child;
  3664. }
  3665. return _clone(parent, depth);
  3666. }
  3667. /**
  3668. * Simple flat clone using prototype, accepts only objects, usefull for property
  3669. * override on FLAT configuration object (no nested props).
  3670. *
  3671. * USE WITH CAUTION! This may not behave as you wish if you do not know how this
  3672. * works.
  3673. */
  3674. clone.clonePrototype = function clonePrototype(parent) {
  3675. if (parent === null)
  3676. return null;
  3677. var c = function () {};
  3678. c.prototype = parent;
  3679. return new c();
  3680. };
  3681. // private utility functions
  3682. function __objToStr(o) {
  3683. return Object.prototype.toString.call(o);
  3684. }
  3685. clone.__objToStr = __objToStr;
  3686. function __isDate(o) {
  3687. return typeof o === 'object' && __objToStr(o) === '[object Date]';
  3688. }
  3689. clone.__isDate = __isDate;
  3690. function __isArray(o) {
  3691. return typeof o === 'object' && __objToStr(o) === '[object Array]';
  3692. }
  3693. clone.__isArray = __isArray;
  3694. function __isRegExp(o) {
  3695. return typeof o === 'object' && __objToStr(o) === '[object RegExp]';
  3696. }
  3697. clone.__isRegExp = __isRegExp;
  3698. function __getRegExpFlags(re) {
  3699. var flags = '';
  3700. if (re.global) flags += 'g';
  3701. if (re.ignoreCase) flags += 'i';
  3702. if (re.multiline) flags += 'm';
  3703. return flags;
  3704. }
  3705. clone.__getRegExpFlags = __getRegExpFlags;
  3706. return clone;
  3707. })();
  3708. if (typeof module === 'object' && module.exports) {
  3709. module.exports = clone;
  3710. }
  3711. /***/ }),
  3712. /* 22 */
  3713. /***/ (function(module, exports, __webpack_require__) {
  3714. "use strict";
  3715. Object.defineProperty(exports, "__esModule", {
  3716. value: true
  3717. });
  3718. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3719. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3720. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  3721. var _parchment = __webpack_require__(0);
  3722. var _parchment2 = _interopRequireDefault(_parchment);
  3723. var _emitter = __webpack_require__(8);
  3724. var _emitter2 = _interopRequireDefault(_emitter);
  3725. var _block = __webpack_require__(4);
  3726. var _block2 = _interopRequireDefault(_block);
  3727. var _break = __webpack_require__(16);
  3728. var _break2 = _interopRequireDefault(_break);
  3729. var _code = __webpack_require__(13);
  3730. var _code2 = _interopRequireDefault(_code);
  3731. var _container = __webpack_require__(25);
  3732. var _container2 = _interopRequireDefault(_container);
  3733. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3734. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3735. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3736. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3737. function isLine(blot) {
  3738. return blot instanceof _block2.default || blot instanceof _block.BlockEmbed;
  3739. }
  3740. var Scroll = function (_Parchment$Scroll) {
  3741. _inherits(Scroll, _Parchment$Scroll);
  3742. function Scroll(domNode, config) {
  3743. _classCallCheck(this, Scroll);
  3744. var _this = _possibleConstructorReturn(this, (Scroll.__proto__ || Object.getPrototypeOf(Scroll)).call(this, domNode));
  3745. _this.emitter = config.emitter;
  3746. if (Array.isArray(config.whitelist)) {
  3747. _this.whitelist = config.whitelist.reduce(function (whitelist, format) {
  3748. whitelist[format] = true;
  3749. return whitelist;
  3750. }, {});
  3751. }
  3752. // Some reason fixes composition issues with character languages in Windows/Chrome, Safari
  3753. _this.domNode.addEventListener('DOMNodeInserted', function () {});
  3754. _this.optimize();
  3755. _this.enable();
  3756. return _this;
  3757. }
  3758. _createClass(Scroll, [{
  3759. key: 'batchStart',
  3760. value: function batchStart() {
  3761. this.batch = true;
  3762. }
  3763. }, {
  3764. key: 'batchEnd',
  3765. value: function batchEnd() {
  3766. this.batch = false;
  3767. this.optimize();
  3768. }
  3769. }, {
  3770. key: 'deleteAt',
  3771. value: function deleteAt(index, length) {
  3772. var _line = this.line(index),
  3773. _line2 = _slicedToArray(_line, 2),
  3774. first = _line2[0],
  3775. offset = _line2[1];
  3776. var _line3 = this.line(index + length),
  3777. _line4 = _slicedToArray(_line3, 1),
  3778. last = _line4[0];
  3779. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'deleteAt', this).call(this, index, length);
  3780. if (last != null && first !== last && offset > 0) {
  3781. if (first instanceof _block.BlockEmbed || last instanceof _block.BlockEmbed) {
  3782. this.optimize();
  3783. return;
  3784. }
  3785. if (first instanceof _code2.default) {
  3786. var newlineIndex = first.newlineIndex(first.length(), true);
  3787. if (newlineIndex > -1) {
  3788. first = first.split(newlineIndex + 1);
  3789. if (first === last) {
  3790. this.optimize();
  3791. return;
  3792. }
  3793. }
  3794. } else if (last instanceof _code2.default) {
  3795. var _newlineIndex = last.newlineIndex(0);
  3796. if (_newlineIndex > -1) {
  3797. last.split(_newlineIndex + 1);
  3798. }
  3799. }
  3800. var ref = last.children.head instanceof _break2.default ? null : last.children.head;
  3801. first.moveChildren(last, ref);
  3802. first.remove();
  3803. }
  3804. this.optimize();
  3805. }
  3806. }, {
  3807. key: 'enable',
  3808. value: function enable() {
  3809. var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
  3810. this.domNode.setAttribute('contenteditable', enabled);
  3811. }
  3812. }, {
  3813. key: 'formatAt',
  3814. value: function formatAt(index, length, format, value) {
  3815. if (this.whitelist != null && !this.whitelist[format]) return;
  3816. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'formatAt', this).call(this, index, length, format, value);
  3817. this.optimize();
  3818. }
  3819. }, {
  3820. key: 'insertAt',
  3821. value: function insertAt(index, value, def) {
  3822. if (def != null && this.whitelist != null && !this.whitelist[value]) return;
  3823. if (index >= this.length()) {
  3824. if (def == null || _parchment2.default.query(value, _parchment2.default.Scope.BLOCK) == null) {
  3825. var blot = _parchment2.default.create(this.statics.defaultChild);
  3826. this.appendChild(blot);
  3827. if (def == null && value.endsWith('\n')) {
  3828. value = value.slice(0, -1);
  3829. }
  3830. blot.insertAt(0, value, def);
  3831. } else {
  3832. var embed = _parchment2.default.create(value, def);
  3833. this.appendChild(embed);
  3834. }
  3835. } else {
  3836. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertAt', this).call(this, index, value, def);
  3837. }
  3838. this.optimize();
  3839. }
  3840. }, {
  3841. key: 'insertBefore',
  3842. value: function insertBefore(blot, ref) {
  3843. if (blot.statics.scope === _parchment2.default.Scope.INLINE_BLOT) {
  3844. var wrapper = _parchment2.default.create(this.statics.defaultChild);
  3845. wrapper.appendChild(blot);
  3846. blot = wrapper;
  3847. }
  3848. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'insertBefore', this).call(this, blot, ref);
  3849. }
  3850. }, {
  3851. key: 'leaf',
  3852. value: function leaf(index) {
  3853. return this.path(index).pop() || [null, -1];
  3854. }
  3855. }, {
  3856. key: 'line',
  3857. value: function line(index) {
  3858. if (index === this.length()) {
  3859. return this.line(index - 1);
  3860. }
  3861. return this.descendant(isLine, index);
  3862. }
  3863. }, {
  3864. key: 'lines',
  3865. value: function lines() {
  3866. var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
  3867. var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE;
  3868. var getLines = function getLines(blot, index, length) {
  3869. var lines = [],
  3870. lengthLeft = length;
  3871. blot.children.forEachAt(index, length, function (child, index, length) {
  3872. if (isLine(child)) {
  3873. lines.push(child);
  3874. } else if (child instanceof _parchment2.default.Container) {
  3875. lines = lines.concat(getLines(child, index, lengthLeft));
  3876. }
  3877. lengthLeft -= length;
  3878. });
  3879. return lines;
  3880. };
  3881. return getLines(this, index, length);
  3882. }
  3883. }, {
  3884. key: 'optimize',
  3885. value: function optimize() {
  3886. var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
  3887. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  3888. if (this.batch === true) return;
  3889. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'optimize', this).call(this, mutations, context);
  3890. if (mutations.length > 0) {
  3891. this.emitter.emit(_emitter2.default.events.SCROLL_OPTIMIZE, mutations, context);
  3892. }
  3893. }
  3894. }, {
  3895. key: 'path',
  3896. value: function path(index) {
  3897. return _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'path', this).call(this, index).slice(1); // Exclude self
  3898. }
  3899. }, {
  3900. key: 'update',
  3901. value: function update(mutations) {
  3902. if (this.batch === true) return;
  3903. var source = _emitter2.default.sources.USER;
  3904. if (typeof mutations === 'string') {
  3905. source = mutations;
  3906. }
  3907. if (!Array.isArray(mutations)) {
  3908. mutations = this.observer.takeRecords();
  3909. }
  3910. if (mutations.length > 0) {
  3911. this.emitter.emit(_emitter2.default.events.SCROLL_BEFORE_UPDATE, source, mutations);
  3912. }
  3913. _get(Scroll.prototype.__proto__ || Object.getPrototypeOf(Scroll.prototype), 'update', this).call(this, mutations.concat([])); // pass copy
  3914. if (mutations.length > 0) {
  3915. this.emitter.emit(_emitter2.default.events.SCROLL_UPDATE, source, mutations);
  3916. }
  3917. }
  3918. }]);
  3919. return Scroll;
  3920. }(_parchment2.default.Scroll);
  3921. Scroll.blotName = 'scroll';
  3922. Scroll.className = 'ql-editor';
  3923. Scroll.tagName = 'DIV';
  3924. Scroll.defaultChild = 'block';
  3925. Scroll.allowedChildren = [_block2.default, _block.BlockEmbed, _container2.default];
  3926. exports.default = Scroll;
  3927. /***/ }),
  3928. /* 23 */
  3929. /***/ (function(module, exports, __webpack_require__) {
  3930. "use strict";
  3931. Object.defineProperty(exports, "__esModule", {
  3932. value: true
  3933. });
  3934. exports.SHORTKEY = exports.default = undefined;
  3935. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  3936. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  3937. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  3938. var _clone = __webpack_require__(21);
  3939. var _clone2 = _interopRequireDefault(_clone);
  3940. var _deepEqual = __webpack_require__(11);
  3941. var _deepEqual2 = _interopRequireDefault(_deepEqual);
  3942. var _extend = __webpack_require__(3);
  3943. var _extend2 = _interopRequireDefault(_extend);
  3944. var _quillDelta = __webpack_require__(2);
  3945. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  3946. var _op = __webpack_require__(20);
  3947. var _op2 = _interopRequireDefault(_op);
  3948. var _parchment = __webpack_require__(0);
  3949. var _parchment2 = _interopRequireDefault(_parchment);
  3950. var _quill = __webpack_require__(5);
  3951. var _quill2 = _interopRequireDefault(_quill);
  3952. var _logger = __webpack_require__(10);
  3953. var _logger2 = _interopRequireDefault(_logger);
  3954. var _module = __webpack_require__(9);
  3955. var _module2 = _interopRequireDefault(_module);
  3956. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  3957. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  3958. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  3959. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  3960. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  3961. var debug = (0, _logger2.default)('quill:keyboard');
  3962. var SHORTKEY = /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey';
  3963. var Keyboard = function (_Module) {
  3964. _inherits(Keyboard, _Module);
  3965. _createClass(Keyboard, null, [{
  3966. key: 'match',
  3967. value: function match(evt, binding) {
  3968. binding = normalize(binding);
  3969. if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) {
  3970. return !!binding[key] !== evt[key] && binding[key] !== null;
  3971. })) {
  3972. return false;
  3973. }
  3974. return binding.key === (evt.which || evt.keyCode);
  3975. }
  3976. }]);
  3977. function Keyboard(quill, options) {
  3978. _classCallCheck(this, Keyboard);
  3979. var _this = _possibleConstructorReturn(this, (Keyboard.__proto__ || Object.getPrototypeOf(Keyboard)).call(this, quill, options));
  3980. _this.bindings = {};
  3981. Object.keys(_this.options.bindings).forEach(function (name) {
  3982. if (name === 'list autofill' && quill.scroll.whitelist != null && !quill.scroll.whitelist['list']) {
  3983. return;
  3984. }
  3985. if (_this.options.bindings[name]) {
  3986. _this.addBinding(_this.options.bindings[name]);
  3987. }
  3988. });
  3989. _this.addBinding({ key: Keyboard.keys.ENTER, shiftKey: null }, handleEnter);
  3990. _this.addBinding({ key: Keyboard.keys.ENTER, metaKey: null, ctrlKey: null, altKey: null }, function () {});
  3991. if (/Firefox/i.test(navigator.userAgent)) {
  3992. // Need to handle delete and backspace for Firefox in the general case #1171
  3993. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true }, handleBackspace);
  3994. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true }, handleDelete);
  3995. } else {
  3996. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: true, prefix: /^.?$/ }, handleBackspace);
  3997. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: true, suffix: /^.?$/ }, handleDelete);
  3998. }
  3999. _this.addBinding({ key: Keyboard.keys.BACKSPACE }, { collapsed: false }, handleDeleteRange);
  4000. _this.addBinding({ key: Keyboard.keys.DELETE }, { collapsed: false }, handleDeleteRange);
  4001. _this.addBinding({ key: Keyboard.keys.BACKSPACE, altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, handleBackspace);
  4002. _this.listen();
  4003. return _this;
  4004. }
  4005. _createClass(Keyboard, [{
  4006. key: 'addBinding',
  4007. value: function addBinding(key) {
  4008. var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
  4009. var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
  4010. var binding = normalize(key);
  4011. if (binding == null || binding.key == null) {
  4012. return debug.warn('Attempted to add invalid keyboard binding', binding);
  4013. }
  4014. if (typeof context === 'function') {
  4015. context = { handler: context };
  4016. }
  4017. if (typeof handler === 'function') {
  4018. handler = { handler: handler };
  4019. }
  4020. binding = (0, _extend2.default)(binding, context, handler);
  4021. this.bindings[binding.key] = this.bindings[binding.key] || [];
  4022. this.bindings[binding.key].push(binding);
  4023. }
  4024. }, {
  4025. key: 'listen',
  4026. value: function listen() {
  4027. var _this2 = this;
  4028. this.quill.root.addEventListener('keydown', function (evt) {
  4029. if (evt.defaultPrevented) return;
  4030. var which = evt.which || evt.keyCode;
  4031. var bindings = (_this2.bindings[which] || []).filter(function (binding) {
  4032. return Keyboard.match(evt, binding);
  4033. });
  4034. if (bindings.length === 0) return;
  4035. var range = _this2.quill.getSelection();
  4036. if (range == null || !_this2.quill.hasFocus()) return;
  4037. var _quill$getLine = _this2.quill.getLine(range.index),
  4038. _quill$getLine2 = _slicedToArray(_quill$getLine, 2),
  4039. line = _quill$getLine2[0],
  4040. offset = _quill$getLine2[1];
  4041. var _quill$getLeaf = _this2.quill.getLeaf(range.index),
  4042. _quill$getLeaf2 = _slicedToArray(_quill$getLeaf, 2),
  4043. leafStart = _quill$getLeaf2[0],
  4044. offsetStart = _quill$getLeaf2[1];
  4045. var _ref = range.length === 0 ? [leafStart, offsetStart] : _this2.quill.getLeaf(range.index + range.length),
  4046. _ref2 = _slicedToArray(_ref, 2),
  4047. leafEnd = _ref2[0],
  4048. offsetEnd = _ref2[1];
  4049. var prefixText = leafStart instanceof _parchment2.default.Text ? leafStart.value().slice(0, offsetStart) : '';
  4050. var suffixText = leafEnd instanceof _parchment2.default.Text ? leafEnd.value().slice(offsetEnd) : '';
  4051. var curContext = {
  4052. collapsed: range.length === 0,
  4053. empty: range.length === 0 && line.length() <= 1,
  4054. format: _this2.quill.getFormat(range),
  4055. offset: offset,
  4056. prefix: prefixText,
  4057. suffix: suffixText
  4058. };
  4059. var prevented = bindings.some(function (binding) {
  4060. if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) return false;
  4061. if (binding.empty != null && binding.empty !== curContext.empty) return false;
  4062. if (binding.offset != null && binding.offset !== curContext.offset) return false;
  4063. if (Array.isArray(binding.format)) {
  4064. // any format is present
  4065. if (binding.format.every(function (name) {
  4066. return curContext.format[name] == null;
  4067. })) {
  4068. return false;
  4069. }
  4070. } else if (_typeof(binding.format) === 'object') {
  4071. // all formats must match
  4072. if (!Object.keys(binding.format).every(function (name) {
  4073. if (binding.format[name] === true) return curContext.format[name] != null;
  4074. if (binding.format[name] === false) return curContext.format[name] == null;
  4075. return (0, _deepEqual2.default)(binding.format[name], curContext.format[name]);
  4076. })) {
  4077. return false;
  4078. }
  4079. }
  4080. if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) return false;
  4081. if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) return false;
  4082. return binding.handler.call(_this2, range, curContext) !== true;
  4083. });
  4084. if (prevented) {
  4085. evt.preventDefault();
  4086. }
  4087. });
  4088. }
  4089. }]);
  4090. return Keyboard;
  4091. }(_module2.default);
  4092. Keyboard.keys = {
  4093. BACKSPACE: 8,
  4094. TAB: 9,
  4095. ENTER: 13,
  4096. ESCAPE: 27,
  4097. LEFT: 37,
  4098. UP: 38,
  4099. RIGHT: 39,
  4100. DOWN: 40,
  4101. DELETE: 46
  4102. };
  4103. Keyboard.DEFAULTS = {
  4104. bindings: {
  4105. 'bold': makeFormatHandler('bold'),
  4106. 'italic': makeFormatHandler('italic'),
  4107. 'underline': makeFormatHandler('underline'),
  4108. 'indent': {
  4109. // highlight tab or tab at beginning of list, indent or blockquote
  4110. key: Keyboard.keys.TAB,
  4111. format: ['blockquote', 'indent', 'list'],
  4112. handler: function handler(range, context) {
  4113. if (context.collapsed && context.offset !== 0) return true;
  4114. this.quill.format('indent', '+1', _quill2.default.sources.USER);
  4115. }
  4116. },
  4117. 'outdent': {
  4118. key: Keyboard.keys.TAB,
  4119. shiftKey: true,
  4120. format: ['blockquote', 'indent', 'list'],
  4121. // highlight tab or tab at beginning of list, indent or blockquote
  4122. handler: function handler(range, context) {
  4123. if (context.collapsed && context.offset !== 0) return true;
  4124. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  4125. }
  4126. },
  4127. 'outdent backspace': {
  4128. key: Keyboard.keys.BACKSPACE,
  4129. collapsed: true,
  4130. shiftKey: null,
  4131. metaKey: null,
  4132. ctrlKey: null,
  4133. altKey: null,
  4134. format: ['indent', 'list'],
  4135. offset: 0,
  4136. handler: function handler(range, context) {
  4137. if (context.format.indent != null) {
  4138. this.quill.format('indent', '-1', _quill2.default.sources.USER);
  4139. } else if (context.format.list != null) {
  4140. this.quill.format('list', false, _quill2.default.sources.USER);
  4141. }
  4142. }
  4143. },
  4144. 'indent code-block': makeCodeBlockHandler(true),
  4145. 'outdent code-block': makeCodeBlockHandler(false),
  4146. 'remove tab': {
  4147. key: Keyboard.keys.TAB,
  4148. shiftKey: true,
  4149. collapsed: true,
  4150. prefix: /\t$/,
  4151. handler: function handler(range) {
  4152. this.quill.deleteText(range.index - 1, 1, _quill2.default.sources.USER);
  4153. }
  4154. },
  4155. 'tab': {
  4156. key: Keyboard.keys.TAB,
  4157. handler: function handler(range) {
  4158. this.quill.history.cutoff();
  4159. var delta = new _quillDelta2.default().retain(range.index).delete(range.length).insert('\t');
  4160. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4161. this.quill.history.cutoff();
  4162. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4163. }
  4164. },
  4165. 'list empty enter': {
  4166. key: Keyboard.keys.ENTER,
  4167. collapsed: true,
  4168. format: ['list'],
  4169. empty: true,
  4170. handler: function handler(range, context) {
  4171. this.quill.format('list', false, _quill2.default.sources.USER);
  4172. if (context.format.indent) {
  4173. this.quill.format('indent', false, _quill2.default.sources.USER);
  4174. }
  4175. }
  4176. },
  4177. 'checklist enter': {
  4178. key: Keyboard.keys.ENTER,
  4179. collapsed: true,
  4180. format: { list: 'checked' },
  4181. handler: function handler(range) {
  4182. var _quill$getLine3 = this.quill.getLine(range.index),
  4183. _quill$getLine4 = _slicedToArray(_quill$getLine3, 2),
  4184. line = _quill$getLine4[0],
  4185. offset = _quill$getLine4[1];
  4186. var formats = (0, _extend2.default)({}, line.formats(), { list: 'checked' });
  4187. var delta = new _quillDelta2.default().retain(range.index).insert('\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' });
  4188. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4189. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4190. this.quill.scrollIntoView();
  4191. }
  4192. },
  4193. 'header enter': {
  4194. key: Keyboard.keys.ENTER,
  4195. collapsed: true,
  4196. format: ['header'],
  4197. suffix: /^$/,
  4198. handler: function handler(range, context) {
  4199. var _quill$getLine5 = this.quill.getLine(range.index),
  4200. _quill$getLine6 = _slicedToArray(_quill$getLine5, 2),
  4201. line = _quill$getLine6[0],
  4202. offset = _quill$getLine6[1];
  4203. var delta = new _quillDelta2.default().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null });
  4204. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4205. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4206. this.quill.scrollIntoView();
  4207. }
  4208. },
  4209. 'list autofill': {
  4210. key: ' ',
  4211. collapsed: true,
  4212. format: { list: false },
  4213. prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/,
  4214. handler: function handler(range, context) {
  4215. var length = context.prefix.length;
  4216. var _quill$getLine7 = this.quill.getLine(range.index),
  4217. _quill$getLine8 = _slicedToArray(_quill$getLine7, 2),
  4218. line = _quill$getLine8[0],
  4219. offset = _quill$getLine8[1];
  4220. if (offset > length) return true;
  4221. var value = void 0;
  4222. switch (context.prefix.trim()) {
  4223. case '[]':case '[ ]':
  4224. value = 'unchecked';
  4225. break;
  4226. case '[x]':
  4227. value = 'checked';
  4228. break;
  4229. case '-':case '*':
  4230. value = 'bullet';
  4231. break;
  4232. default:
  4233. value = 'ordered';
  4234. }
  4235. this.quill.insertText(range.index, ' ', _quill2.default.sources.USER);
  4236. this.quill.history.cutoff();
  4237. var delta = new _quillDelta2.default().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value });
  4238. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4239. this.quill.history.cutoff();
  4240. this.quill.setSelection(range.index - length, _quill2.default.sources.SILENT);
  4241. }
  4242. },
  4243. 'code exit': {
  4244. key: Keyboard.keys.ENTER,
  4245. collapsed: true,
  4246. format: ['code-block'],
  4247. prefix: /\n\n$/,
  4248. suffix: /^\s+$/,
  4249. handler: function handler(range) {
  4250. var _quill$getLine9 = this.quill.getLine(range.index),
  4251. _quill$getLine10 = _slicedToArray(_quill$getLine9, 2),
  4252. line = _quill$getLine10[0],
  4253. offset = _quill$getLine10[1];
  4254. var delta = new _quillDelta2.default().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1);
  4255. this.quill.updateContents(delta, _quill2.default.sources.USER);
  4256. }
  4257. },
  4258. 'embed left': makeEmbedArrowHandler(Keyboard.keys.LEFT, false),
  4259. 'embed left shift': makeEmbedArrowHandler(Keyboard.keys.LEFT, true),
  4260. 'embed right': makeEmbedArrowHandler(Keyboard.keys.RIGHT, false),
  4261. 'embed right shift': makeEmbedArrowHandler(Keyboard.keys.RIGHT, true)
  4262. }
  4263. };
  4264. function makeEmbedArrowHandler(key, shiftKey) {
  4265. var _ref3;
  4266. var where = key === Keyboard.keys.LEFT ? 'prefix' : 'suffix';
  4267. return _ref3 = {
  4268. key: key,
  4269. shiftKey: shiftKey,
  4270. altKey: null
  4271. }, _defineProperty(_ref3, where, /^$/), _defineProperty(_ref3, 'handler', function handler(range) {
  4272. var index = range.index;
  4273. if (key === Keyboard.keys.RIGHT) {
  4274. index += range.length + 1;
  4275. }
  4276. var _quill$getLeaf3 = this.quill.getLeaf(index),
  4277. _quill$getLeaf4 = _slicedToArray(_quill$getLeaf3, 1),
  4278. leaf = _quill$getLeaf4[0];
  4279. if (!(leaf instanceof _parchment2.default.Embed)) return true;
  4280. if (key === Keyboard.keys.LEFT) {
  4281. if (shiftKey) {
  4282. this.quill.setSelection(range.index - 1, range.length + 1, _quill2.default.sources.USER);
  4283. } else {
  4284. this.quill.setSelection(range.index - 1, _quill2.default.sources.USER);
  4285. }
  4286. } else {
  4287. if (shiftKey) {
  4288. this.quill.setSelection(range.index, range.length + 1, _quill2.default.sources.USER);
  4289. } else {
  4290. this.quill.setSelection(range.index + range.length + 1, _quill2.default.sources.USER);
  4291. }
  4292. }
  4293. return false;
  4294. }), _ref3;
  4295. }
  4296. function handleBackspace(range, context) {
  4297. if (range.index === 0 || this.quill.getLength() <= 1) return;
  4298. var _quill$getLine11 = this.quill.getLine(range.index),
  4299. _quill$getLine12 = _slicedToArray(_quill$getLine11, 1),
  4300. line = _quill$getLine12[0];
  4301. var formats = {};
  4302. if (context.offset === 0) {
  4303. var _quill$getLine13 = this.quill.getLine(range.index - 1),
  4304. _quill$getLine14 = _slicedToArray(_quill$getLine13, 1),
  4305. prev = _quill$getLine14[0];
  4306. if (prev != null && prev.length() > 1) {
  4307. var curFormats = line.formats();
  4308. var prevFormats = this.quill.getFormat(range.index - 1, 1);
  4309. formats = _op2.default.attributes.diff(curFormats, prevFormats) || {};
  4310. }
  4311. }
  4312. // Check for astral symbols
  4313. var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1;
  4314. this.quill.deleteText(range.index - length, length, _quill2.default.sources.USER);
  4315. if (Object.keys(formats).length > 0) {
  4316. this.quill.formatLine(range.index - length, length, formats, _quill2.default.sources.USER);
  4317. }
  4318. this.quill.focus();
  4319. }
  4320. function handleDelete(range, context) {
  4321. // Check for astral symbols
  4322. var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1;
  4323. if (range.index >= this.quill.getLength() - length) return;
  4324. var formats = {},
  4325. nextLength = 0;
  4326. var _quill$getLine15 = this.quill.getLine(range.index),
  4327. _quill$getLine16 = _slicedToArray(_quill$getLine15, 1),
  4328. line = _quill$getLine16[0];
  4329. if (context.offset >= line.length() - 1) {
  4330. var _quill$getLine17 = this.quill.getLine(range.index + 1),
  4331. _quill$getLine18 = _slicedToArray(_quill$getLine17, 1),
  4332. next = _quill$getLine18[0];
  4333. if (next) {
  4334. var curFormats = line.formats();
  4335. var nextFormats = this.quill.getFormat(range.index, 1);
  4336. formats = _op2.default.attributes.diff(curFormats, nextFormats) || {};
  4337. nextLength = next.length();
  4338. }
  4339. }
  4340. this.quill.deleteText(range.index, length, _quill2.default.sources.USER);
  4341. if (Object.keys(formats).length > 0) {
  4342. this.quill.formatLine(range.index + nextLength - 1, length, formats, _quill2.default.sources.USER);
  4343. }
  4344. }
  4345. function handleDeleteRange(range) {
  4346. var lines = this.quill.getLines(range);
  4347. var formats = {};
  4348. if (lines.length > 1) {
  4349. var firstFormats = lines[0].formats();
  4350. var lastFormats = lines[lines.length - 1].formats();
  4351. formats = _op2.default.attributes.diff(lastFormats, firstFormats) || {};
  4352. }
  4353. this.quill.deleteText(range, _quill2.default.sources.USER);
  4354. if (Object.keys(formats).length > 0) {
  4355. this.quill.formatLine(range.index, 1, formats, _quill2.default.sources.USER);
  4356. }
  4357. this.quill.setSelection(range.index, _quill2.default.sources.SILENT);
  4358. this.quill.focus();
  4359. }
  4360. function handleEnter(range, context) {
  4361. var _this3 = this;
  4362. if (range.length > 0) {
  4363. this.quill.scroll.deleteAt(range.index, range.length); // So we do not trigger text-change
  4364. }
  4365. var lineFormats = Object.keys(context.format).reduce(function (lineFormats, format) {
  4366. if (_parchment2.default.query(format, _parchment2.default.Scope.BLOCK) && !Array.isArray(context.format[format])) {
  4367. lineFormats[format] = context.format[format];
  4368. }
  4369. return lineFormats;
  4370. }, {});
  4371. this.quill.insertText(range.index, '\n', lineFormats, _quill2.default.sources.USER);
  4372. // Earlier scroll.deleteAt might have messed up our selection,
  4373. // so insertText's built in selection preservation is not reliable
  4374. this.quill.setSelection(range.index + 1, _quill2.default.sources.SILENT);
  4375. this.quill.focus();
  4376. Object.keys(context.format).forEach(function (name) {
  4377. if (lineFormats[name] != null) return;
  4378. if (Array.isArray(context.format[name])) return;
  4379. if (name === 'link') return;
  4380. _this3.quill.format(name, context.format[name], _quill2.default.sources.USER);
  4381. });
  4382. }
  4383. function makeCodeBlockHandler(indent) {
  4384. return {
  4385. key: Keyboard.keys.TAB,
  4386. shiftKey: !indent,
  4387. format: { 'code-block': true },
  4388. handler: function handler(range) {
  4389. var CodeBlock = _parchment2.default.query('code-block');
  4390. var index = range.index,
  4391. length = range.length;
  4392. var _quill$scroll$descend = this.quill.scroll.descendant(CodeBlock, index),
  4393. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  4394. block = _quill$scroll$descend2[0],
  4395. offset = _quill$scroll$descend2[1];
  4396. if (block == null) return;
  4397. var scrollIndex = this.quill.getIndex(block);
  4398. var start = block.newlineIndex(offset, true) + 1;
  4399. var end = block.newlineIndex(scrollIndex + offset + length);
  4400. var lines = block.domNode.textContent.slice(start, end).split('\n');
  4401. offset = 0;
  4402. lines.forEach(function (line, i) {
  4403. if (indent) {
  4404. block.insertAt(start + offset, CodeBlock.TAB);
  4405. offset += CodeBlock.TAB.length;
  4406. if (i === 0) {
  4407. index += CodeBlock.TAB.length;
  4408. } else {
  4409. length += CodeBlock.TAB.length;
  4410. }
  4411. } else if (line.startsWith(CodeBlock.TAB)) {
  4412. block.deleteAt(start + offset, CodeBlock.TAB.length);
  4413. offset -= CodeBlock.TAB.length;
  4414. if (i === 0) {
  4415. index -= CodeBlock.TAB.length;
  4416. } else {
  4417. length -= CodeBlock.TAB.length;
  4418. }
  4419. }
  4420. offset += line.length + 1;
  4421. });
  4422. this.quill.update(_quill2.default.sources.USER);
  4423. this.quill.setSelection(index, length, _quill2.default.sources.SILENT);
  4424. }
  4425. };
  4426. }
  4427. function makeFormatHandler(format) {
  4428. return {
  4429. key: format[0].toUpperCase(),
  4430. shortKey: true,
  4431. handler: function handler(range, context) {
  4432. this.quill.format(format, !context.format[format], _quill2.default.sources.USER);
  4433. }
  4434. };
  4435. }
  4436. function normalize(binding) {
  4437. if (typeof binding === 'string' || typeof binding === 'number') {
  4438. return normalize({ key: binding });
  4439. }
  4440. if ((typeof binding === 'undefined' ? 'undefined' : _typeof(binding)) === 'object') {
  4441. binding = (0, _clone2.default)(binding, false);
  4442. }
  4443. if (typeof binding.key === 'string') {
  4444. if (Keyboard.keys[binding.key.toUpperCase()] != null) {
  4445. binding.key = Keyboard.keys[binding.key.toUpperCase()];
  4446. } else if (binding.key.length === 1) {
  4447. binding.key = binding.key.toUpperCase().charCodeAt(0);
  4448. } else {
  4449. return null;
  4450. }
  4451. }
  4452. if (binding.shortKey) {
  4453. binding[SHORTKEY] = binding.shortKey;
  4454. delete binding.shortKey;
  4455. }
  4456. return binding;
  4457. }
  4458. exports.default = Keyboard;
  4459. exports.SHORTKEY = SHORTKEY;
  4460. /***/ }),
  4461. /* 24 */
  4462. /***/ (function(module, exports, __webpack_require__) {
  4463. "use strict";
  4464. Object.defineProperty(exports, "__esModule", {
  4465. value: true
  4466. });
  4467. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  4468. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4469. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4470. var _parchment = __webpack_require__(0);
  4471. var _parchment2 = _interopRequireDefault(_parchment);
  4472. var _text = __webpack_require__(7);
  4473. var _text2 = _interopRequireDefault(_text);
  4474. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4475. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4476. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4477. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4478. var Cursor = function (_Parchment$Embed) {
  4479. _inherits(Cursor, _Parchment$Embed);
  4480. _createClass(Cursor, null, [{
  4481. key: 'value',
  4482. value: function value() {
  4483. return undefined;
  4484. }
  4485. }]);
  4486. function Cursor(domNode, selection) {
  4487. _classCallCheck(this, Cursor);
  4488. var _this = _possibleConstructorReturn(this, (Cursor.__proto__ || Object.getPrototypeOf(Cursor)).call(this, domNode));
  4489. _this.selection = selection;
  4490. _this.textNode = document.createTextNode(Cursor.CONTENTS);
  4491. _this.domNode.appendChild(_this.textNode);
  4492. _this._length = 0;
  4493. return _this;
  4494. }
  4495. _createClass(Cursor, [{
  4496. key: 'detach',
  4497. value: function detach() {
  4498. // super.detach() will also clear domNode.__blot
  4499. if (this.parent != null) this.parent.removeChild(this);
  4500. }
  4501. }, {
  4502. key: 'format',
  4503. value: function format(name, value) {
  4504. if (this._length !== 0) {
  4505. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'format', this).call(this, name, value);
  4506. }
  4507. var target = this,
  4508. index = 0;
  4509. while (target != null && target.statics.scope !== _parchment2.default.Scope.BLOCK_BLOT) {
  4510. index += target.offset(target.parent);
  4511. target = target.parent;
  4512. }
  4513. if (target != null) {
  4514. this._length = Cursor.CONTENTS.length;
  4515. target.optimize();
  4516. target.formatAt(index, Cursor.CONTENTS.length, name, value);
  4517. this._length = 0;
  4518. }
  4519. }
  4520. }, {
  4521. key: 'index',
  4522. value: function index(node, offset) {
  4523. if (node === this.textNode) return 0;
  4524. return _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'index', this).call(this, node, offset);
  4525. }
  4526. }, {
  4527. key: 'length',
  4528. value: function length() {
  4529. return this._length;
  4530. }
  4531. }, {
  4532. key: 'position',
  4533. value: function position() {
  4534. return [this.textNode, this.textNode.data.length];
  4535. }
  4536. }, {
  4537. key: 'remove',
  4538. value: function remove() {
  4539. _get(Cursor.prototype.__proto__ || Object.getPrototypeOf(Cursor.prototype), 'remove', this).call(this);
  4540. this.parent = null;
  4541. }
  4542. }, {
  4543. key: 'restore',
  4544. value: function restore() {
  4545. if (this.selection.composing || this.parent == null) return;
  4546. var textNode = this.textNode;
  4547. var range = this.selection.getNativeRange();
  4548. var restoreText = void 0,
  4549. start = void 0,
  4550. end = void 0;
  4551. if (range != null && range.start.node === textNode && range.end.node === textNode) {
  4552. var _ref = [textNode, range.start.offset, range.end.offset];
  4553. restoreText = _ref[0];
  4554. start = _ref[1];
  4555. end = _ref[2];
  4556. }
  4557. // Link format will insert text outside of anchor tag
  4558. while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) {
  4559. this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode);
  4560. }
  4561. if (this.textNode.data !== Cursor.CONTENTS) {
  4562. var text = this.textNode.data.split(Cursor.CONTENTS).join('');
  4563. if (this.next instanceof _text2.default) {
  4564. restoreText = this.next.domNode;
  4565. this.next.insertAt(0, text);
  4566. this.textNode.data = Cursor.CONTENTS;
  4567. } else {
  4568. this.textNode.data = text;
  4569. this.parent.insertBefore(_parchment2.default.create(this.textNode), this);
  4570. this.textNode = document.createTextNode(Cursor.CONTENTS);
  4571. this.domNode.appendChild(this.textNode);
  4572. }
  4573. }
  4574. this.remove();
  4575. if (start != null) {
  4576. var _map = [start, end].map(function (offset) {
  4577. return Math.max(0, Math.min(restoreText.data.length, offset - 1));
  4578. });
  4579. var _map2 = _slicedToArray(_map, 2);
  4580. start = _map2[0];
  4581. end = _map2[1];
  4582. return {
  4583. startNode: restoreText,
  4584. startOffset: start,
  4585. endNode: restoreText,
  4586. endOffset: end
  4587. };
  4588. }
  4589. }
  4590. }, {
  4591. key: 'update',
  4592. value: function update(mutations, context) {
  4593. var _this2 = this;
  4594. if (mutations.some(function (mutation) {
  4595. return mutation.type === 'characterData' && mutation.target === _this2.textNode;
  4596. })) {
  4597. var range = this.restore();
  4598. if (range) context.range = range;
  4599. }
  4600. }
  4601. }, {
  4602. key: 'value',
  4603. value: function value() {
  4604. return '';
  4605. }
  4606. }]);
  4607. return Cursor;
  4608. }(_parchment2.default.Embed);
  4609. Cursor.blotName = 'cursor';
  4610. Cursor.className = 'ql-cursor';
  4611. Cursor.tagName = 'span';
  4612. Cursor.CONTENTS = '\uFEFF'; // Zero width no break space
  4613. exports.default = Cursor;
  4614. /***/ }),
  4615. /* 25 */
  4616. /***/ (function(module, exports, __webpack_require__) {
  4617. "use strict";
  4618. Object.defineProperty(exports, "__esModule", {
  4619. value: true
  4620. });
  4621. var _parchment = __webpack_require__(0);
  4622. var _parchment2 = _interopRequireDefault(_parchment);
  4623. var _block = __webpack_require__(4);
  4624. var _block2 = _interopRequireDefault(_block);
  4625. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4626. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4627. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4628. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4629. var Container = function (_Parchment$Container) {
  4630. _inherits(Container, _Parchment$Container);
  4631. function Container() {
  4632. _classCallCheck(this, Container);
  4633. return _possibleConstructorReturn(this, (Container.__proto__ || Object.getPrototypeOf(Container)).apply(this, arguments));
  4634. }
  4635. return Container;
  4636. }(_parchment2.default.Container);
  4637. Container.allowedChildren = [_block2.default, _block.BlockEmbed, Container];
  4638. exports.default = Container;
  4639. /***/ }),
  4640. /* 26 */
  4641. /***/ (function(module, exports, __webpack_require__) {
  4642. "use strict";
  4643. Object.defineProperty(exports, "__esModule", {
  4644. value: true
  4645. });
  4646. exports.ColorStyle = exports.ColorClass = exports.ColorAttributor = undefined;
  4647. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4648. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4649. var _parchment = __webpack_require__(0);
  4650. var _parchment2 = _interopRequireDefault(_parchment);
  4651. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4652. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4653. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4654. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4655. var ColorAttributor = function (_Parchment$Attributor) {
  4656. _inherits(ColorAttributor, _Parchment$Attributor);
  4657. function ColorAttributor() {
  4658. _classCallCheck(this, ColorAttributor);
  4659. return _possibleConstructorReturn(this, (ColorAttributor.__proto__ || Object.getPrototypeOf(ColorAttributor)).apply(this, arguments));
  4660. }
  4661. _createClass(ColorAttributor, [{
  4662. key: 'value',
  4663. value: function value(domNode) {
  4664. var value = _get(ColorAttributor.prototype.__proto__ || Object.getPrototypeOf(ColorAttributor.prototype), 'value', this).call(this, domNode);
  4665. if (!value.startsWith('rgb(')) return value;
  4666. value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, '');
  4667. return '#' + value.split(',').map(function (component) {
  4668. return ('00' + parseInt(component).toString(16)).slice(-2);
  4669. }).join('');
  4670. }
  4671. }]);
  4672. return ColorAttributor;
  4673. }(_parchment2.default.Attributor.Style);
  4674. var ColorClass = new _parchment2.default.Attributor.Class('color', 'ql-color', {
  4675. scope: _parchment2.default.Scope.INLINE
  4676. });
  4677. var ColorStyle = new ColorAttributor('color', 'color', {
  4678. scope: _parchment2.default.Scope.INLINE
  4679. });
  4680. exports.ColorAttributor = ColorAttributor;
  4681. exports.ColorClass = ColorClass;
  4682. exports.ColorStyle = ColorStyle;
  4683. /***/ }),
  4684. /* 27 */
  4685. /***/ (function(module, exports, __webpack_require__) {
  4686. "use strict";
  4687. Object.defineProperty(exports, "__esModule", {
  4688. value: true
  4689. });
  4690. exports.sanitize = exports.default = undefined;
  4691. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4692. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  4693. var _inline = __webpack_require__(6);
  4694. var _inline2 = _interopRequireDefault(_inline);
  4695. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4696. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4697. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  4698. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  4699. var Link = function (_Inline) {
  4700. _inherits(Link, _Inline);
  4701. function Link() {
  4702. _classCallCheck(this, Link);
  4703. return _possibleConstructorReturn(this, (Link.__proto__ || Object.getPrototypeOf(Link)).apply(this, arguments));
  4704. }
  4705. _createClass(Link, [{
  4706. key: 'format',
  4707. value: function format(name, value) {
  4708. if (name !== this.statics.blotName || !value) return _get(Link.prototype.__proto__ || Object.getPrototypeOf(Link.prototype), 'format', this).call(this, name, value);
  4709. value = this.constructor.sanitize(value);
  4710. this.domNode.setAttribute('href', value);
  4711. }
  4712. }], [{
  4713. key: 'create',
  4714. value: function create(value) {
  4715. var node = _get(Link.__proto__ || Object.getPrototypeOf(Link), 'create', this).call(this, value);
  4716. value = this.sanitize(value);
  4717. node.setAttribute('href', value);
  4718. node.setAttribute('rel', 'noopener noreferrer');
  4719. node.setAttribute('target', '_blank');
  4720. return node;
  4721. }
  4722. }, {
  4723. key: 'formats',
  4724. value: function formats(domNode) {
  4725. return domNode.getAttribute('href');
  4726. }
  4727. }, {
  4728. key: 'sanitize',
  4729. value: function sanitize(url) {
  4730. return _sanitize(url, this.PROTOCOL_WHITELIST) ? url : this.SANITIZED_URL;
  4731. }
  4732. }]);
  4733. return Link;
  4734. }(_inline2.default);
  4735. Link.blotName = 'link';
  4736. Link.tagName = 'A';
  4737. Link.SANITIZED_URL = 'about:blank';
  4738. Link.PROTOCOL_WHITELIST = ['http', 'https', 'mailto', 'tel'];
  4739. function _sanitize(url, protocols) {
  4740. var anchor = document.createElement('a');
  4741. anchor.href = url;
  4742. var protocol = anchor.href.slice(0, anchor.href.indexOf(':'));
  4743. return protocols.indexOf(protocol) > -1;
  4744. }
  4745. exports.default = Link;
  4746. exports.sanitize = _sanitize;
  4747. /***/ }),
  4748. /* 28 */
  4749. /***/ (function(module, exports, __webpack_require__) {
  4750. "use strict";
  4751. Object.defineProperty(exports, "__esModule", {
  4752. value: true
  4753. });
  4754. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  4755. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  4756. var _keyboard = __webpack_require__(23);
  4757. var _keyboard2 = _interopRequireDefault(_keyboard);
  4758. var _dropdown = __webpack_require__(107);
  4759. var _dropdown2 = _interopRequireDefault(_dropdown);
  4760. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4761. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  4762. var optionsCounter = 0;
  4763. function toggleAriaAttribute(element, attribute) {
  4764. element.setAttribute(attribute, !(element.getAttribute(attribute) === 'true'));
  4765. }
  4766. var Picker = function () {
  4767. function Picker(select) {
  4768. var _this = this;
  4769. _classCallCheck(this, Picker);
  4770. this.select = select;
  4771. this.container = document.createElement('span');
  4772. this.buildPicker();
  4773. this.select.style.display = 'none';
  4774. this.select.parentNode.insertBefore(this.container, this.select);
  4775. this.label.addEventListener('mousedown', function () {
  4776. _this.togglePicker();
  4777. });
  4778. this.label.addEventListener('keydown', function (event) {
  4779. switch (event.keyCode) {
  4780. // Allows the "Enter" key to open the picker
  4781. case _keyboard2.default.keys.ENTER:
  4782. _this.togglePicker();
  4783. break;
  4784. // Allows the "Escape" key to close the picker
  4785. case _keyboard2.default.keys.ESCAPE:
  4786. _this.escape();
  4787. event.preventDefault();
  4788. break;
  4789. default:
  4790. }
  4791. });
  4792. this.select.addEventListener('change', this.update.bind(this));
  4793. }
  4794. _createClass(Picker, [{
  4795. key: 'togglePicker',
  4796. value: function togglePicker() {
  4797. this.container.classList.toggle('ql-expanded');
  4798. // Toggle aria-expanded and aria-hidden to make the picker accessible
  4799. toggleAriaAttribute(this.label, 'aria-expanded');
  4800. toggleAriaAttribute(this.options, 'aria-hidden');
  4801. }
  4802. }, {
  4803. key: 'buildItem',
  4804. value: function buildItem(option) {
  4805. var _this2 = this;
  4806. var item = document.createElement('span');
  4807. item.tabIndex = '0';
  4808. item.setAttribute('role', 'button');
  4809. item.classList.add('ql-picker-item');
  4810. if (option.hasAttribute('value')) {
  4811. item.setAttribute('data-value', option.getAttribute('value'));
  4812. }
  4813. if (option.textContent) {
  4814. item.setAttribute('data-label', option.textContent);
  4815. }
  4816. item.addEventListener('click', function () {
  4817. _this2.selectItem(item, true);
  4818. });
  4819. item.addEventListener('keydown', function (event) {
  4820. switch (event.keyCode) {
  4821. // Allows the "Enter" key to select an item
  4822. case _keyboard2.default.keys.ENTER:
  4823. _this2.selectItem(item, true);
  4824. event.preventDefault();
  4825. break;
  4826. // Allows the "Escape" key to close the picker
  4827. case _keyboard2.default.keys.ESCAPE:
  4828. _this2.escape();
  4829. event.preventDefault();
  4830. break;
  4831. default:
  4832. }
  4833. });
  4834. return item;
  4835. }
  4836. }, {
  4837. key: 'buildLabel',
  4838. value: function buildLabel() {
  4839. var label = document.createElement('span');
  4840. label.classList.add('ql-picker-label');
  4841. label.innerHTML = _dropdown2.default;
  4842. label.tabIndex = '0';
  4843. label.setAttribute('role', 'button');
  4844. label.setAttribute('aria-expanded', 'false');
  4845. this.container.appendChild(label);
  4846. return label;
  4847. }
  4848. }, {
  4849. key: 'buildOptions',
  4850. value: function buildOptions() {
  4851. var _this3 = this;
  4852. var options = document.createElement('span');
  4853. options.classList.add('ql-picker-options');
  4854. // Don't want screen readers to read this until options are visible
  4855. options.setAttribute('aria-hidden', 'true');
  4856. options.tabIndex = '-1';
  4857. // Need a unique id for aria-controls
  4858. options.id = 'ql-picker-options-' + optionsCounter;
  4859. optionsCounter += 1;
  4860. this.label.setAttribute('aria-controls', options.id);
  4861. this.options = options;
  4862. [].slice.call(this.select.options).forEach(function (option) {
  4863. var item = _this3.buildItem(option);
  4864. options.appendChild(item);
  4865. if (option.selected === true) {
  4866. _this3.selectItem(item);
  4867. }
  4868. });
  4869. this.container.appendChild(options);
  4870. }
  4871. }, {
  4872. key: 'buildPicker',
  4873. value: function buildPicker() {
  4874. var _this4 = this;
  4875. [].slice.call(this.select.attributes).forEach(function (item) {
  4876. _this4.container.setAttribute(item.name, item.value);
  4877. });
  4878. this.container.classList.add('ql-picker');
  4879. this.label = this.buildLabel();
  4880. this.buildOptions();
  4881. }
  4882. }, {
  4883. key: 'escape',
  4884. value: function escape() {
  4885. var _this5 = this;
  4886. // Close menu and return focus to trigger label
  4887. this.close();
  4888. // Need setTimeout for accessibility to ensure that the browser executes
  4889. // focus on the next process thread and after any DOM content changes
  4890. setTimeout(function () {
  4891. return _this5.label.focus();
  4892. }, 1);
  4893. }
  4894. }, {
  4895. key: 'close',
  4896. value: function close() {
  4897. this.container.classList.remove('ql-expanded');
  4898. this.label.setAttribute('aria-expanded', 'false');
  4899. this.options.setAttribute('aria-hidden', 'true');
  4900. }
  4901. }, {
  4902. key: 'selectItem',
  4903. value: function selectItem(item) {
  4904. var trigger = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
  4905. var selected = this.container.querySelector('.ql-selected');
  4906. if (item === selected) return;
  4907. if (selected != null) {
  4908. selected.classList.remove('ql-selected');
  4909. }
  4910. if (item == null) return;
  4911. item.classList.add('ql-selected');
  4912. this.select.selectedIndex = [].indexOf.call(item.parentNode.children, item);
  4913. if (item.hasAttribute('data-value')) {
  4914. this.label.setAttribute('data-value', item.getAttribute('data-value'));
  4915. } else {
  4916. this.label.removeAttribute('data-value');
  4917. }
  4918. if (item.hasAttribute('data-label')) {
  4919. this.label.setAttribute('data-label', item.getAttribute('data-label'));
  4920. } else {
  4921. this.label.removeAttribute('data-label');
  4922. }
  4923. if (trigger) {
  4924. if (typeof Event === 'function') {
  4925. this.select.dispatchEvent(new Event('change'));
  4926. } else if ((typeof Event === 'undefined' ? 'undefined' : _typeof(Event)) === 'object') {
  4927. // IE11
  4928. var event = document.createEvent('Event');
  4929. event.initEvent('change', true, true);
  4930. this.select.dispatchEvent(event);
  4931. }
  4932. this.close();
  4933. }
  4934. }
  4935. }, {
  4936. key: 'update',
  4937. value: function update() {
  4938. var option = void 0;
  4939. if (this.select.selectedIndex > -1) {
  4940. var item = this.container.querySelector('.ql-picker-options').children[this.select.selectedIndex];
  4941. option = this.select.options[this.select.selectedIndex];
  4942. this.selectItem(item);
  4943. } else {
  4944. this.selectItem(null);
  4945. }
  4946. var isActive = option != null && option !== this.select.querySelector('option[selected]');
  4947. this.label.classList.toggle('ql-active', isActive);
  4948. }
  4949. }]);
  4950. return Picker;
  4951. }();
  4952. exports.default = Picker;
  4953. /***/ }),
  4954. /* 29 */
  4955. /***/ (function(module, exports, __webpack_require__) {
  4956. "use strict";
  4957. Object.defineProperty(exports, "__esModule", {
  4958. value: true
  4959. });
  4960. var _parchment = __webpack_require__(0);
  4961. var _parchment2 = _interopRequireDefault(_parchment);
  4962. var _quill = __webpack_require__(5);
  4963. var _quill2 = _interopRequireDefault(_quill);
  4964. var _block = __webpack_require__(4);
  4965. var _block2 = _interopRequireDefault(_block);
  4966. var _break = __webpack_require__(16);
  4967. var _break2 = _interopRequireDefault(_break);
  4968. var _container = __webpack_require__(25);
  4969. var _container2 = _interopRequireDefault(_container);
  4970. var _cursor = __webpack_require__(24);
  4971. var _cursor2 = _interopRequireDefault(_cursor);
  4972. var _embed = __webpack_require__(35);
  4973. var _embed2 = _interopRequireDefault(_embed);
  4974. var _inline = __webpack_require__(6);
  4975. var _inline2 = _interopRequireDefault(_inline);
  4976. var _scroll = __webpack_require__(22);
  4977. var _scroll2 = _interopRequireDefault(_scroll);
  4978. var _text = __webpack_require__(7);
  4979. var _text2 = _interopRequireDefault(_text);
  4980. var _clipboard = __webpack_require__(55);
  4981. var _clipboard2 = _interopRequireDefault(_clipboard);
  4982. var _history = __webpack_require__(42);
  4983. var _history2 = _interopRequireDefault(_history);
  4984. var _keyboard = __webpack_require__(23);
  4985. var _keyboard2 = _interopRequireDefault(_keyboard);
  4986. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  4987. _quill2.default.register({
  4988. 'blots/block': _block2.default,
  4989. 'blots/block/embed': _block.BlockEmbed,
  4990. 'blots/break': _break2.default,
  4991. 'blots/container': _container2.default,
  4992. 'blots/cursor': _cursor2.default,
  4993. 'blots/embed': _embed2.default,
  4994. 'blots/inline': _inline2.default,
  4995. 'blots/scroll': _scroll2.default,
  4996. 'blots/text': _text2.default,
  4997. 'modules/clipboard': _clipboard2.default,
  4998. 'modules/history': _history2.default,
  4999. 'modules/keyboard': _keyboard2.default
  5000. });
  5001. _parchment2.default.register(_block2.default, _break2.default, _cursor2.default, _inline2.default, _scroll2.default, _text2.default);
  5002. exports.default = _quill2.default;
  5003. /***/ }),
  5004. /* 30 */
  5005. /***/ (function(module, exports, __webpack_require__) {
  5006. "use strict";
  5007. Object.defineProperty(exports, "__esModule", { value: true });
  5008. var Registry = __webpack_require__(1);
  5009. var ShadowBlot = /** @class */ (function () {
  5010. function ShadowBlot(domNode) {
  5011. this.domNode = domNode;
  5012. // @ts-ignore
  5013. this.domNode[Registry.DATA_KEY] = { blot: this };
  5014. }
  5015. Object.defineProperty(ShadowBlot.prototype, "statics", {
  5016. // Hack for accessing inherited static methods
  5017. get: function () {
  5018. return this.constructor;
  5019. },
  5020. enumerable: true,
  5021. configurable: true
  5022. });
  5023. ShadowBlot.create = function (value) {
  5024. if (this.tagName == null) {
  5025. throw new Registry.ParchmentError('Blot definition missing tagName');
  5026. }
  5027. var node;
  5028. if (Array.isArray(this.tagName)) {
  5029. if (typeof value === 'string') {
  5030. value = value.toUpperCase();
  5031. if (parseInt(value).toString() === value) {
  5032. value = parseInt(value);
  5033. }
  5034. }
  5035. if (typeof value === 'number') {
  5036. node = document.createElement(this.tagName[value - 1]);
  5037. }
  5038. else if (this.tagName.indexOf(value) > -1) {
  5039. node = document.createElement(value);
  5040. }
  5041. else {
  5042. node = document.createElement(this.tagName[0]);
  5043. }
  5044. }
  5045. else {
  5046. node = document.createElement(this.tagName);
  5047. }
  5048. if (this.className) {
  5049. node.classList.add(this.className);
  5050. }
  5051. return node;
  5052. };
  5053. ShadowBlot.prototype.attach = function () {
  5054. if (this.parent != null) {
  5055. this.scroll = this.parent.scroll;
  5056. }
  5057. };
  5058. ShadowBlot.prototype.clone = function () {
  5059. var domNode = this.domNode.cloneNode(false);
  5060. return Registry.create(domNode);
  5061. };
  5062. ShadowBlot.prototype.detach = function () {
  5063. if (this.parent != null)
  5064. this.parent.removeChild(this);
  5065. // @ts-ignore
  5066. delete this.domNode[Registry.DATA_KEY];
  5067. };
  5068. ShadowBlot.prototype.deleteAt = function (index, length) {
  5069. var blot = this.isolate(index, length);
  5070. blot.remove();
  5071. };
  5072. ShadowBlot.prototype.formatAt = function (index, length, name, value) {
  5073. var blot = this.isolate(index, length);
  5074. if (Registry.query(name, Registry.Scope.BLOT) != null && value) {
  5075. blot.wrap(name, value);
  5076. }
  5077. else if (Registry.query(name, Registry.Scope.ATTRIBUTE) != null) {
  5078. var parent = Registry.create(this.statics.scope);
  5079. blot.wrap(parent);
  5080. parent.format(name, value);
  5081. }
  5082. };
  5083. ShadowBlot.prototype.insertAt = function (index, value, def) {
  5084. var blot = def == null ? Registry.create('text', value) : Registry.create(value, def);
  5085. var ref = this.split(index);
  5086. this.parent.insertBefore(blot, ref);
  5087. };
  5088. ShadowBlot.prototype.insertInto = function (parentBlot, refBlot) {
  5089. if (refBlot === void 0) { refBlot = null; }
  5090. if (this.parent != null) {
  5091. this.parent.children.remove(this);
  5092. }
  5093. var refDomNode = null;
  5094. parentBlot.children.insertBefore(this, refBlot);
  5095. if (refBlot != null) {
  5096. refDomNode = refBlot.domNode;
  5097. }
  5098. if (this.domNode.parentNode != parentBlot.domNode ||
  5099. this.domNode.nextSibling != refDomNode) {
  5100. parentBlot.domNode.insertBefore(this.domNode, refDomNode);
  5101. }
  5102. this.parent = parentBlot;
  5103. this.attach();
  5104. };
  5105. ShadowBlot.prototype.isolate = function (index, length) {
  5106. var target = this.split(index);
  5107. target.split(length);
  5108. return target;
  5109. };
  5110. ShadowBlot.prototype.length = function () {
  5111. return 1;
  5112. };
  5113. ShadowBlot.prototype.offset = function (root) {
  5114. if (root === void 0) { root = this.parent; }
  5115. if (this.parent == null || this == root)
  5116. return 0;
  5117. return this.parent.children.offset(this) + this.parent.offset(root);
  5118. };
  5119. ShadowBlot.prototype.optimize = function (context) {
  5120. // TODO clean up once we use WeakMap
  5121. // @ts-ignore
  5122. if (this.domNode[Registry.DATA_KEY] != null) {
  5123. // @ts-ignore
  5124. delete this.domNode[Registry.DATA_KEY].mutations;
  5125. }
  5126. };
  5127. ShadowBlot.prototype.remove = function () {
  5128. if (this.domNode.parentNode != null) {
  5129. this.domNode.parentNode.removeChild(this.domNode);
  5130. }
  5131. this.detach();
  5132. };
  5133. ShadowBlot.prototype.replace = function (target) {
  5134. if (target.parent == null)
  5135. return;
  5136. target.parent.insertBefore(this, target.next);
  5137. target.remove();
  5138. };
  5139. ShadowBlot.prototype.replaceWith = function (name, value) {
  5140. var replacement = typeof name === 'string' ? Registry.create(name, value) : name;
  5141. replacement.replace(this);
  5142. return replacement;
  5143. };
  5144. ShadowBlot.prototype.split = function (index, force) {
  5145. return index === 0 ? this : this.next;
  5146. };
  5147. ShadowBlot.prototype.update = function (mutations, context) {
  5148. // Nothing to do by default
  5149. };
  5150. ShadowBlot.prototype.wrap = function (name, value) {
  5151. var wrapper = typeof name === 'string' ? Registry.create(name, value) : name;
  5152. if (this.parent != null) {
  5153. this.parent.insertBefore(wrapper, this.next);
  5154. }
  5155. wrapper.appendChild(this);
  5156. return wrapper;
  5157. };
  5158. ShadowBlot.blotName = 'abstract';
  5159. return ShadowBlot;
  5160. }());
  5161. exports.default = ShadowBlot;
  5162. /***/ }),
  5163. /* 31 */
  5164. /***/ (function(module, exports, __webpack_require__) {
  5165. "use strict";
  5166. Object.defineProperty(exports, "__esModule", { value: true });
  5167. var attributor_1 = __webpack_require__(12);
  5168. var class_1 = __webpack_require__(32);
  5169. var style_1 = __webpack_require__(33);
  5170. var Registry = __webpack_require__(1);
  5171. var AttributorStore = /** @class */ (function () {
  5172. function AttributorStore(domNode) {
  5173. this.attributes = {};
  5174. this.domNode = domNode;
  5175. this.build();
  5176. }
  5177. AttributorStore.prototype.attribute = function (attribute, value) {
  5178. // verb
  5179. if (value) {
  5180. if (attribute.add(this.domNode, value)) {
  5181. if (attribute.value(this.domNode) != null) {
  5182. this.attributes[attribute.attrName] = attribute;
  5183. }
  5184. else {
  5185. delete this.attributes[attribute.attrName];
  5186. }
  5187. }
  5188. }
  5189. else {
  5190. attribute.remove(this.domNode);
  5191. delete this.attributes[attribute.attrName];
  5192. }
  5193. };
  5194. AttributorStore.prototype.build = function () {
  5195. var _this = this;
  5196. this.attributes = {};
  5197. var attributes = attributor_1.default.keys(this.domNode);
  5198. var classes = class_1.default.keys(this.domNode);
  5199. var styles = style_1.default.keys(this.domNode);
  5200. attributes
  5201. .concat(classes)
  5202. .concat(styles)
  5203. .forEach(function (name) {
  5204. var attr = Registry.query(name, Registry.Scope.ATTRIBUTE);
  5205. if (attr instanceof attributor_1.default) {
  5206. _this.attributes[attr.attrName] = attr;
  5207. }
  5208. });
  5209. };
  5210. AttributorStore.prototype.copy = function (target) {
  5211. var _this = this;
  5212. Object.keys(this.attributes).forEach(function (key) {
  5213. var value = _this.attributes[key].value(_this.domNode);
  5214. target.format(key, value);
  5215. });
  5216. };
  5217. AttributorStore.prototype.move = function (target) {
  5218. var _this = this;
  5219. this.copy(target);
  5220. Object.keys(this.attributes).forEach(function (key) {
  5221. _this.attributes[key].remove(_this.domNode);
  5222. });
  5223. this.attributes = {};
  5224. };
  5225. AttributorStore.prototype.values = function () {
  5226. var _this = this;
  5227. return Object.keys(this.attributes).reduce(function (attributes, name) {
  5228. attributes[name] = _this.attributes[name].value(_this.domNode);
  5229. return attributes;
  5230. }, {});
  5231. };
  5232. return AttributorStore;
  5233. }());
  5234. exports.default = AttributorStore;
  5235. /***/ }),
  5236. /* 32 */
  5237. /***/ (function(module, exports, __webpack_require__) {
  5238. "use strict";
  5239. var __extends = (this && this.__extends) || (function () {
  5240. var extendStatics = Object.setPrototypeOf ||
  5241. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5242. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5243. return function (d, b) {
  5244. extendStatics(d, b);
  5245. function __() { this.constructor = d; }
  5246. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5247. };
  5248. })();
  5249. Object.defineProperty(exports, "__esModule", { value: true });
  5250. var attributor_1 = __webpack_require__(12);
  5251. function match(node, prefix) {
  5252. var className = node.getAttribute('class') || '';
  5253. return className.split(/\s+/).filter(function (name) {
  5254. return name.indexOf(prefix + "-") === 0;
  5255. });
  5256. }
  5257. var ClassAttributor = /** @class */ (function (_super) {
  5258. __extends(ClassAttributor, _super);
  5259. function ClassAttributor() {
  5260. return _super !== null && _super.apply(this, arguments) || this;
  5261. }
  5262. ClassAttributor.keys = function (node) {
  5263. return (node.getAttribute('class') || '').split(/\s+/).map(function (name) {
  5264. return name
  5265. .split('-')
  5266. .slice(0, -1)
  5267. .join('-');
  5268. });
  5269. };
  5270. ClassAttributor.prototype.add = function (node, value) {
  5271. if (!this.canAdd(node, value))
  5272. return false;
  5273. this.remove(node);
  5274. node.classList.add(this.keyName + "-" + value);
  5275. return true;
  5276. };
  5277. ClassAttributor.prototype.remove = function (node) {
  5278. var matches = match(node, this.keyName);
  5279. matches.forEach(function (name) {
  5280. node.classList.remove(name);
  5281. });
  5282. if (node.classList.length === 0) {
  5283. node.removeAttribute('class');
  5284. }
  5285. };
  5286. ClassAttributor.prototype.value = function (node) {
  5287. var result = match(node, this.keyName)[0] || '';
  5288. var value = result.slice(this.keyName.length + 1); // +1 for hyphen
  5289. return this.canAdd(node, value) ? value : '';
  5290. };
  5291. return ClassAttributor;
  5292. }(attributor_1.default));
  5293. exports.default = ClassAttributor;
  5294. /***/ }),
  5295. /* 33 */
  5296. /***/ (function(module, exports, __webpack_require__) {
  5297. "use strict";
  5298. var __extends = (this && this.__extends) || (function () {
  5299. var extendStatics = Object.setPrototypeOf ||
  5300. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  5301. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  5302. return function (d, b) {
  5303. extendStatics(d, b);
  5304. function __() { this.constructor = d; }
  5305. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  5306. };
  5307. })();
  5308. Object.defineProperty(exports, "__esModule", { value: true });
  5309. var attributor_1 = __webpack_require__(12);
  5310. function camelize(name) {
  5311. var parts = name.split('-');
  5312. var rest = parts
  5313. .slice(1)
  5314. .map(function (part) {
  5315. return part[0].toUpperCase() + part.slice(1);
  5316. })
  5317. .join('');
  5318. return parts[0] + rest;
  5319. }
  5320. var StyleAttributor = /** @class */ (function (_super) {
  5321. __extends(StyleAttributor, _super);
  5322. function StyleAttributor() {
  5323. return _super !== null && _super.apply(this, arguments) || this;
  5324. }
  5325. StyleAttributor.keys = function (node) {
  5326. return (node.getAttribute('style') || '').split(';').map(function (value) {
  5327. var arr = value.split(':');
  5328. return arr[0].trim();
  5329. });
  5330. };
  5331. StyleAttributor.prototype.add = function (node, value) {
  5332. if (!this.canAdd(node, value))
  5333. return false;
  5334. // @ts-ignore
  5335. node.style[camelize(this.keyName)] = value;
  5336. return true;
  5337. };
  5338. StyleAttributor.prototype.remove = function (node) {
  5339. // @ts-ignore
  5340. node.style[camelize(this.keyName)] = '';
  5341. if (!node.getAttribute('style')) {
  5342. node.removeAttribute('style');
  5343. }
  5344. };
  5345. StyleAttributor.prototype.value = function (node) {
  5346. // @ts-ignore
  5347. var value = node.style[camelize(this.keyName)];
  5348. return this.canAdd(node, value) ? value : '';
  5349. };
  5350. return StyleAttributor;
  5351. }(attributor_1.default));
  5352. exports.default = StyleAttributor;
  5353. /***/ }),
  5354. /* 34 */
  5355. /***/ (function(module, exports, __webpack_require__) {
  5356. "use strict";
  5357. Object.defineProperty(exports, "__esModule", {
  5358. value: true
  5359. });
  5360. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5361. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5362. var Theme = function () {
  5363. function Theme(quill, options) {
  5364. _classCallCheck(this, Theme);
  5365. this.quill = quill;
  5366. this.options = options;
  5367. this.modules = {};
  5368. }
  5369. _createClass(Theme, [{
  5370. key: 'init',
  5371. value: function init() {
  5372. var _this = this;
  5373. Object.keys(this.options.modules).forEach(function (name) {
  5374. if (_this.modules[name] == null) {
  5375. _this.addModule(name);
  5376. }
  5377. });
  5378. }
  5379. }, {
  5380. key: 'addModule',
  5381. value: function addModule(name) {
  5382. var moduleClass = this.quill.constructor.import('modules/' + name);
  5383. this.modules[name] = new moduleClass(this.quill, this.options.modules[name] || {});
  5384. return this.modules[name];
  5385. }
  5386. }]);
  5387. return Theme;
  5388. }();
  5389. Theme.DEFAULTS = {
  5390. modules: {}
  5391. };
  5392. Theme.themes = {
  5393. 'default': Theme
  5394. };
  5395. exports.default = Theme;
  5396. /***/ }),
  5397. /* 35 */
  5398. /***/ (function(module, exports, __webpack_require__) {
  5399. "use strict";
  5400. Object.defineProperty(exports, "__esModule", {
  5401. value: true
  5402. });
  5403. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5404. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5405. var _parchment = __webpack_require__(0);
  5406. var _parchment2 = _interopRequireDefault(_parchment);
  5407. var _text = __webpack_require__(7);
  5408. var _text2 = _interopRequireDefault(_text);
  5409. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5410. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5411. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5412. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5413. var GUARD_TEXT = '\uFEFF';
  5414. var Embed = function (_Parchment$Embed) {
  5415. _inherits(Embed, _Parchment$Embed);
  5416. function Embed(node) {
  5417. _classCallCheck(this, Embed);
  5418. var _this = _possibleConstructorReturn(this, (Embed.__proto__ || Object.getPrototypeOf(Embed)).call(this, node));
  5419. _this.contentNode = document.createElement('span');
  5420. _this.contentNode.setAttribute('contenteditable', false);
  5421. [].slice.call(_this.domNode.childNodes).forEach(function (childNode) {
  5422. _this.contentNode.appendChild(childNode);
  5423. });
  5424. _this.leftGuard = document.createTextNode(GUARD_TEXT);
  5425. _this.rightGuard = document.createTextNode(GUARD_TEXT);
  5426. _this.domNode.appendChild(_this.leftGuard);
  5427. _this.domNode.appendChild(_this.contentNode);
  5428. _this.domNode.appendChild(_this.rightGuard);
  5429. return _this;
  5430. }
  5431. _createClass(Embed, [{
  5432. key: 'index',
  5433. value: function index(node, offset) {
  5434. if (node === this.leftGuard) return 0;
  5435. if (node === this.rightGuard) return 1;
  5436. return _get(Embed.prototype.__proto__ || Object.getPrototypeOf(Embed.prototype), 'index', this).call(this, node, offset);
  5437. }
  5438. }, {
  5439. key: 'restore',
  5440. value: function restore(node) {
  5441. var range = void 0,
  5442. textNode = void 0;
  5443. var text = node.data.split(GUARD_TEXT).join('');
  5444. if (node === this.leftGuard) {
  5445. if (this.prev instanceof _text2.default) {
  5446. var prevLength = this.prev.length();
  5447. this.prev.insertAt(prevLength, text);
  5448. range = {
  5449. startNode: this.prev.domNode,
  5450. startOffset: prevLength + text.length
  5451. };
  5452. } else {
  5453. textNode = document.createTextNode(text);
  5454. this.parent.insertBefore(_parchment2.default.create(textNode), this);
  5455. range = {
  5456. startNode: textNode,
  5457. startOffset: text.length
  5458. };
  5459. }
  5460. } else if (node === this.rightGuard) {
  5461. if (this.next instanceof _text2.default) {
  5462. this.next.insertAt(0, text);
  5463. range = {
  5464. startNode: this.next.domNode,
  5465. startOffset: text.length
  5466. };
  5467. } else {
  5468. textNode = document.createTextNode(text);
  5469. this.parent.insertBefore(_parchment2.default.create(textNode), this.next);
  5470. range = {
  5471. startNode: textNode,
  5472. startOffset: text.length
  5473. };
  5474. }
  5475. }
  5476. node.data = GUARD_TEXT;
  5477. return range;
  5478. }
  5479. }, {
  5480. key: 'update',
  5481. value: function update(mutations, context) {
  5482. var _this2 = this;
  5483. mutations.forEach(function (mutation) {
  5484. if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) {
  5485. var range = _this2.restore(mutation.target);
  5486. if (range) context.range = range;
  5487. }
  5488. });
  5489. }
  5490. }]);
  5491. return Embed;
  5492. }(_parchment2.default.Embed);
  5493. exports.default = Embed;
  5494. /***/ }),
  5495. /* 36 */
  5496. /***/ (function(module, exports, __webpack_require__) {
  5497. "use strict";
  5498. Object.defineProperty(exports, "__esModule", {
  5499. value: true
  5500. });
  5501. exports.AlignStyle = exports.AlignClass = exports.AlignAttribute = undefined;
  5502. var _parchment = __webpack_require__(0);
  5503. var _parchment2 = _interopRequireDefault(_parchment);
  5504. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5505. var config = {
  5506. scope: _parchment2.default.Scope.BLOCK,
  5507. whitelist: ['right', 'center', 'justify']
  5508. };
  5509. var AlignAttribute = new _parchment2.default.Attributor.Attribute('align', 'align', config);
  5510. var AlignClass = new _parchment2.default.Attributor.Class('align', 'ql-align', config);
  5511. var AlignStyle = new _parchment2.default.Attributor.Style('align', 'text-align', config);
  5512. exports.AlignAttribute = AlignAttribute;
  5513. exports.AlignClass = AlignClass;
  5514. exports.AlignStyle = AlignStyle;
  5515. /***/ }),
  5516. /* 37 */
  5517. /***/ (function(module, exports, __webpack_require__) {
  5518. "use strict";
  5519. Object.defineProperty(exports, "__esModule", {
  5520. value: true
  5521. });
  5522. exports.BackgroundStyle = exports.BackgroundClass = undefined;
  5523. var _parchment = __webpack_require__(0);
  5524. var _parchment2 = _interopRequireDefault(_parchment);
  5525. var _color = __webpack_require__(26);
  5526. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5527. var BackgroundClass = new _parchment2.default.Attributor.Class('background', 'ql-bg', {
  5528. scope: _parchment2.default.Scope.INLINE
  5529. });
  5530. var BackgroundStyle = new _color.ColorAttributor('background', 'background-color', {
  5531. scope: _parchment2.default.Scope.INLINE
  5532. });
  5533. exports.BackgroundClass = BackgroundClass;
  5534. exports.BackgroundStyle = BackgroundStyle;
  5535. /***/ }),
  5536. /* 38 */
  5537. /***/ (function(module, exports, __webpack_require__) {
  5538. "use strict";
  5539. Object.defineProperty(exports, "__esModule", {
  5540. value: true
  5541. });
  5542. exports.DirectionStyle = exports.DirectionClass = exports.DirectionAttribute = undefined;
  5543. var _parchment = __webpack_require__(0);
  5544. var _parchment2 = _interopRequireDefault(_parchment);
  5545. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5546. var config = {
  5547. scope: _parchment2.default.Scope.BLOCK,
  5548. whitelist: ['rtl']
  5549. };
  5550. var DirectionAttribute = new _parchment2.default.Attributor.Attribute('direction', 'dir', config);
  5551. var DirectionClass = new _parchment2.default.Attributor.Class('direction', 'ql-direction', config);
  5552. var DirectionStyle = new _parchment2.default.Attributor.Style('direction', 'direction', config);
  5553. exports.DirectionAttribute = DirectionAttribute;
  5554. exports.DirectionClass = DirectionClass;
  5555. exports.DirectionStyle = DirectionStyle;
  5556. /***/ }),
  5557. /* 39 */
  5558. /***/ (function(module, exports, __webpack_require__) {
  5559. "use strict";
  5560. Object.defineProperty(exports, "__esModule", {
  5561. value: true
  5562. });
  5563. exports.FontClass = exports.FontStyle = undefined;
  5564. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5565. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5566. var _parchment = __webpack_require__(0);
  5567. var _parchment2 = _interopRequireDefault(_parchment);
  5568. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5569. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5570. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5571. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5572. var config = {
  5573. scope: _parchment2.default.Scope.INLINE,
  5574. whitelist: ['serif', 'monospace']
  5575. };
  5576. var FontClass = new _parchment2.default.Attributor.Class('font', 'ql-font', config);
  5577. var FontStyleAttributor = function (_Parchment$Attributor) {
  5578. _inherits(FontStyleAttributor, _Parchment$Attributor);
  5579. function FontStyleAttributor() {
  5580. _classCallCheck(this, FontStyleAttributor);
  5581. return _possibleConstructorReturn(this, (FontStyleAttributor.__proto__ || Object.getPrototypeOf(FontStyleAttributor)).apply(this, arguments));
  5582. }
  5583. _createClass(FontStyleAttributor, [{
  5584. key: 'value',
  5585. value: function value(node) {
  5586. return _get(FontStyleAttributor.prototype.__proto__ || Object.getPrototypeOf(FontStyleAttributor.prototype), 'value', this).call(this, node).replace(/["']/g, '');
  5587. }
  5588. }]);
  5589. return FontStyleAttributor;
  5590. }(_parchment2.default.Attributor.Style);
  5591. var FontStyle = new FontStyleAttributor('font', 'font-family', config);
  5592. exports.FontStyle = FontStyle;
  5593. exports.FontClass = FontClass;
  5594. /***/ }),
  5595. /* 40 */
  5596. /***/ (function(module, exports, __webpack_require__) {
  5597. "use strict";
  5598. Object.defineProperty(exports, "__esModule", {
  5599. value: true
  5600. });
  5601. exports.SizeStyle = exports.SizeClass = undefined;
  5602. var _parchment = __webpack_require__(0);
  5603. var _parchment2 = _interopRequireDefault(_parchment);
  5604. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5605. var SizeClass = new _parchment2.default.Attributor.Class('size', 'ql-size', {
  5606. scope: _parchment2.default.Scope.INLINE,
  5607. whitelist: ['small', 'large', 'huge']
  5608. });
  5609. var SizeStyle = new _parchment2.default.Attributor.Style('size', 'font-size', {
  5610. scope: _parchment2.default.Scope.INLINE,
  5611. whitelist: ['10px', '18px', '32px']
  5612. });
  5613. exports.SizeClass = SizeClass;
  5614. exports.SizeStyle = SizeStyle;
  5615. /***/ }),
  5616. /* 41 */
  5617. /***/ (function(module, exports, __webpack_require__) {
  5618. "use strict";
  5619. module.exports = {
  5620. 'align': {
  5621. '': __webpack_require__(76),
  5622. 'center': __webpack_require__(77),
  5623. 'right': __webpack_require__(78),
  5624. 'justify': __webpack_require__(79)
  5625. },
  5626. 'background': __webpack_require__(80),
  5627. 'blockquote': __webpack_require__(81),
  5628. 'bold': __webpack_require__(82),
  5629. 'clean': __webpack_require__(83),
  5630. 'code': __webpack_require__(58),
  5631. 'code-block': __webpack_require__(58),
  5632. 'color': __webpack_require__(84),
  5633. 'direction': {
  5634. '': __webpack_require__(85),
  5635. 'rtl': __webpack_require__(86)
  5636. },
  5637. 'float': {
  5638. 'center': __webpack_require__(87),
  5639. 'full': __webpack_require__(88),
  5640. 'left': __webpack_require__(89),
  5641. 'right': __webpack_require__(90)
  5642. },
  5643. 'formula': __webpack_require__(91),
  5644. 'header': {
  5645. '1': __webpack_require__(92),
  5646. '2': __webpack_require__(93)
  5647. },
  5648. 'italic': __webpack_require__(94),
  5649. 'image': __webpack_require__(95),
  5650. 'indent': {
  5651. '+1': __webpack_require__(96),
  5652. '-1': __webpack_require__(97)
  5653. },
  5654. 'link': __webpack_require__(98),
  5655. 'list': {
  5656. 'ordered': __webpack_require__(99),
  5657. 'bullet': __webpack_require__(100),
  5658. 'check': __webpack_require__(101)
  5659. },
  5660. 'script': {
  5661. 'sub': __webpack_require__(102),
  5662. 'super': __webpack_require__(103)
  5663. },
  5664. 'strike': __webpack_require__(104),
  5665. 'underline': __webpack_require__(105),
  5666. 'video': __webpack_require__(106)
  5667. };
  5668. /***/ }),
  5669. /* 42 */
  5670. /***/ (function(module, exports, __webpack_require__) {
  5671. "use strict";
  5672. Object.defineProperty(exports, "__esModule", {
  5673. value: true
  5674. });
  5675. exports.getLastChangeIndex = exports.default = undefined;
  5676. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5677. var _parchment = __webpack_require__(0);
  5678. var _parchment2 = _interopRequireDefault(_parchment);
  5679. var _quill = __webpack_require__(5);
  5680. var _quill2 = _interopRequireDefault(_quill);
  5681. var _module = __webpack_require__(9);
  5682. var _module2 = _interopRequireDefault(_module);
  5683. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5684. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5685. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5686. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5687. var History = function (_Module) {
  5688. _inherits(History, _Module);
  5689. function History(quill, options) {
  5690. _classCallCheck(this, History);
  5691. var _this = _possibleConstructorReturn(this, (History.__proto__ || Object.getPrototypeOf(History)).call(this, quill, options));
  5692. _this.lastRecorded = 0;
  5693. _this.ignoreChange = false;
  5694. _this.clear();
  5695. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) {
  5696. if (eventName !== _quill2.default.events.TEXT_CHANGE || _this.ignoreChange) return;
  5697. if (!_this.options.userOnly || source === _quill2.default.sources.USER) {
  5698. _this.record(delta, oldDelta);
  5699. } else {
  5700. _this.transform(delta);
  5701. }
  5702. });
  5703. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true }, _this.undo.bind(_this));
  5704. _this.quill.keyboard.addBinding({ key: 'Z', shortKey: true, shiftKey: true }, _this.redo.bind(_this));
  5705. if (/Win/i.test(navigator.platform)) {
  5706. _this.quill.keyboard.addBinding({ key: 'Y', shortKey: true }, _this.redo.bind(_this));
  5707. }
  5708. return _this;
  5709. }
  5710. _createClass(History, [{
  5711. key: 'change',
  5712. value: function change(source, dest) {
  5713. if (this.stack[source].length === 0) return;
  5714. var delta = this.stack[source].pop();
  5715. this.stack[dest].push(delta);
  5716. this.lastRecorded = 0;
  5717. this.ignoreChange = true;
  5718. this.quill.updateContents(delta[source], _quill2.default.sources.USER);
  5719. this.ignoreChange = false;
  5720. var index = getLastChangeIndex(delta[source]);
  5721. this.quill.setSelection(index);
  5722. }
  5723. }, {
  5724. key: 'clear',
  5725. value: function clear() {
  5726. this.stack = { undo: [], redo: [] };
  5727. }
  5728. }, {
  5729. key: 'cutoff',
  5730. value: function cutoff() {
  5731. this.lastRecorded = 0;
  5732. }
  5733. }, {
  5734. key: 'record',
  5735. value: function record(changeDelta, oldDelta) {
  5736. if (changeDelta.ops.length === 0) return;
  5737. this.stack.redo = [];
  5738. var undoDelta = this.quill.getContents().diff(oldDelta);
  5739. var timestamp = Date.now();
  5740. if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) {
  5741. var delta = this.stack.undo.pop();
  5742. undoDelta = undoDelta.compose(delta.undo);
  5743. changeDelta = delta.redo.compose(changeDelta);
  5744. } else {
  5745. this.lastRecorded = timestamp;
  5746. }
  5747. this.stack.undo.push({
  5748. redo: changeDelta,
  5749. undo: undoDelta
  5750. });
  5751. if (this.stack.undo.length > this.options.maxStack) {
  5752. this.stack.undo.shift();
  5753. }
  5754. }
  5755. }, {
  5756. key: 'redo',
  5757. value: function redo() {
  5758. this.change('redo', 'undo');
  5759. }
  5760. }, {
  5761. key: 'transform',
  5762. value: function transform(delta) {
  5763. this.stack.undo.forEach(function (change) {
  5764. change.undo = delta.transform(change.undo, true);
  5765. change.redo = delta.transform(change.redo, true);
  5766. });
  5767. this.stack.redo.forEach(function (change) {
  5768. change.undo = delta.transform(change.undo, true);
  5769. change.redo = delta.transform(change.redo, true);
  5770. });
  5771. }
  5772. }, {
  5773. key: 'undo',
  5774. value: function undo() {
  5775. this.change('undo', 'redo');
  5776. }
  5777. }]);
  5778. return History;
  5779. }(_module2.default);
  5780. History.DEFAULTS = {
  5781. delay: 1000,
  5782. maxStack: 100,
  5783. userOnly: false
  5784. };
  5785. function endsWithNewlineChange(delta) {
  5786. var lastOp = delta.ops[delta.ops.length - 1];
  5787. if (lastOp == null) return false;
  5788. if (lastOp.insert != null) {
  5789. return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n');
  5790. }
  5791. if (lastOp.attributes != null) {
  5792. return Object.keys(lastOp.attributes).some(function (attr) {
  5793. return _parchment2.default.query(attr, _parchment2.default.Scope.BLOCK) != null;
  5794. });
  5795. }
  5796. return false;
  5797. }
  5798. function getLastChangeIndex(delta) {
  5799. var deleteLength = delta.reduce(function (length, op) {
  5800. length += op.delete || 0;
  5801. return length;
  5802. }, 0);
  5803. var changeIndex = delta.length() - deleteLength;
  5804. if (endsWithNewlineChange(delta)) {
  5805. changeIndex -= 1;
  5806. }
  5807. return changeIndex;
  5808. }
  5809. exports.default = History;
  5810. exports.getLastChangeIndex = getLastChangeIndex;
  5811. /***/ }),
  5812. /* 43 */
  5813. /***/ (function(module, exports, __webpack_require__) {
  5814. "use strict";
  5815. Object.defineProperty(exports, "__esModule", {
  5816. value: true
  5817. });
  5818. exports.default = exports.BaseTooltip = undefined;
  5819. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  5820. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  5821. var _extend = __webpack_require__(3);
  5822. var _extend2 = _interopRequireDefault(_extend);
  5823. var _quillDelta = __webpack_require__(2);
  5824. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  5825. var _emitter = __webpack_require__(8);
  5826. var _emitter2 = _interopRequireDefault(_emitter);
  5827. var _keyboard = __webpack_require__(23);
  5828. var _keyboard2 = _interopRequireDefault(_keyboard);
  5829. var _theme = __webpack_require__(34);
  5830. var _theme2 = _interopRequireDefault(_theme);
  5831. var _colorPicker = __webpack_require__(59);
  5832. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  5833. var _iconPicker = __webpack_require__(60);
  5834. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  5835. var _picker = __webpack_require__(28);
  5836. var _picker2 = _interopRequireDefault(_picker);
  5837. var _tooltip = __webpack_require__(61);
  5838. var _tooltip2 = _interopRequireDefault(_tooltip);
  5839. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  5840. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  5841. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  5842. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  5843. var ALIGNS = [false, 'center', 'right', 'justify'];
  5844. var COLORS = ["#000000", "#e60000", "#ff9900", "#ffff00", "#008a00", "#0066cc", "#9933ff", "#ffffff", "#facccc", "#ffebcc", "#ffffcc", "#cce8cc", "#cce0f5", "#ebd6ff", "#bbbbbb", "#f06666", "#ffc266", "#ffff66", "#66b966", "#66a3e0", "#c285ff", "#888888", "#a10000", "#b26b00", "#b2b200", "#006100", "#0047b2", "#6b24b2", "#444444", "#5c0000", "#663d00", "#666600", "#003700", "#002966", "#3d1466"];
  5845. var FONTS = [false, 'serif', 'monospace'];
  5846. var HEADERS = ['1', '2', '3', false];
  5847. var SIZES = ['small', false, 'large', 'huge'];
  5848. var BaseTheme = function (_Theme) {
  5849. _inherits(BaseTheme, _Theme);
  5850. function BaseTheme(quill, options) {
  5851. _classCallCheck(this, BaseTheme);
  5852. var _this = _possibleConstructorReturn(this, (BaseTheme.__proto__ || Object.getPrototypeOf(BaseTheme)).call(this, quill, options));
  5853. var listener = function listener(e) {
  5854. if (!document.body.contains(quill.root)) {
  5855. return document.body.removeEventListener('click', listener);
  5856. }
  5857. if (_this.tooltip != null && !_this.tooltip.root.contains(e.target) && document.activeElement !== _this.tooltip.textbox && !_this.quill.hasFocus()) {
  5858. _this.tooltip.hide();
  5859. }
  5860. if (_this.pickers != null) {
  5861. _this.pickers.forEach(function (picker) {
  5862. if (!picker.container.contains(e.target)) {
  5863. picker.close();
  5864. }
  5865. });
  5866. }
  5867. };
  5868. quill.emitter.listenDOM('click', document.body, listener);
  5869. return _this;
  5870. }
  5871. _createClass(BaseTheme, [{
  5872. key: 'addModule',
  5873. value: function addModule(name) {
  5874. var module = _get(BaseTheme.prototype.__proto__ || Object.getPrototypeOf(BaseTheme.prototype), 'addModule', this).call(this, name);
  5875. if (name === 'toolbar') {
  5876. this.extendToolbar(module);
  5877. }
  5878. return module;
  5879. }
  5880. }, {
  5881. key: 'buildButtons',
  5882. value: function buildButtons(buttons, icons) {
  5883. buttons.forEach(function (button) {
  5884. var className = button.getAttribute('class') || '';
  5885. className.split(/\s+/).forEach(function (name) {
  5886. if (!name.startsWith('ql-')) return;
  5887. name = name.slice('ql-'.length);
  5888. if (icons[name] == null) return;
  5889. if (name === 'direction') {
  5890. button.innerHTML = icons[name][''] + icons[name]['rtl'];
  5891. } else if (typeof icons[name] === 'string') {
  5892. button.innerHTML = icons[name];
  5893. } else {
  5894. var value = button.value || '';
  5895. if (value != null && icons[name][value]) {
  5896. button.innerHTML = icons[name][value];
  5897. }
  5898. }
  5899. });
  5900. });
  5901. }
  5902. }, {
  5903. key: 'buildPickers',
  5904. value: function buildPickers(selects, icons) {
  5905. var _this2 = this;
  5906. this.pickers = selects.map(function (select) {
  5907. if (select.classList.contains('ql-align')) {
  5908. if (select.querySelector('option') == null) {
  5909. fillSelect(select, ALIGNS);
  5910. }
  5911. return new _iconPicker2.default(select, icons.align);
  5912. } else if (select.classList.contains('ql-background') || select.classList.contains('ql-color')) {
  5913. var format = select.classList.contains('ql-background') ? 'background' : 'color';
  5914. if (select.querySelector('option') == null) {
  5915. fillSelect(select, COLORS, format === 'background' ? '#ffffff' : '#000000');
  5916. }
  5917. return new _colorPicker2.default(select, icons[format]);
  5918. } else {
  5919. if (select.querySelector('option') == null) {
  5920. if (select.classList.contains('ql-font')) {
  5921. fillSelect(select, FONTS);
  5922. } else if (select.classList.contains('ql-header')) {
  5923. fillSelect(select, HEADERS);
  5924. } else if (select.classList.contains('ql-size')) {
  5925. fillSelect(select, SIZES);
  5926. }
  5927. }
  5928. return new _picker2.default(select);
  5929. }
  5930. });
  5931. var update = function update() {
  5932. _this2.pickers.forEach(function (picker) {
  5933. picker.update();
  5934. });
  5935. };
  5936. this.quill.on(_emitter2.default.events.EDITOR_CHANGE, update);
  5937. }
  5938. }]);
  5939. return BaseTheme;
  5940. }(_theme2.default);
  5941. BaseTheme.DEFAULTS = (0, _extend2.default)(true, {}, _theme2.default.DEFAULTS, {
  5942. modules: {
  5943. toolbar: {
  5944. handlers: {
  5945. formula: function formula() {
  5946. this.quill.theme.tooltip.edit('formula');
  5947. },
  5948. image: function image() {
  5949. var _this3 = this;
  5950. var fileInput = this.container.querySelector('input.ql-image[type=file]');
  5951. if (fileInput == null) {
  5952. fileInput = document.createElement('input');
  5953. fileInput.setAttribute('type', 'file');
  5954. fileInput.setAttribute('accept', 'image/png, image/gif, image/jpeg, image/bmp, image/x-icon');
  5955. fileInput.classList.add('ql-image');
  5956. fileInput.addEventListener('change', function () {
  5957. if (fileInput.files != null && fileInput.files[0] != null) {
  5958. var reader = new FileReader();
  5959. reader.onload = function (e) {
  5960. var range = _this3.quill.getSelection(true);
  5961. _this3.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert({ image: e.target.result }), _emitter2.default.sources.USER);
  5962. _this3.quill.setSelection(range.index + 1, _emitter2.default.sources.SILENT);
  5963. fileInput.value = "";
  5964. };
  5965. reader.readAsDataURL(fileInput.files[0]);
  5966. }
  5967. });
  5968. this.container.appendChild(fileInput);
  5969. }
  5970. fileInput.click();
  5971. },
  5972. video: function video() {
  5973. this.quill.theme.tooltip.edit('video');
  5974. }
  5975. }
  5976. }
  5977. }
  5978. });
  5979. var BaseTooltip = function (_Tooltip) {
  5980. _inherits(BaseTooltip, _Tooltip);
  5981. function BaseTooltip(quill, boundsContainer) {
  5982. _classCallCheck(this, BaseTooltip);
  5983. var _this4 = _possibleConstructorReturn(this, (BaseTooltip.__proto__ || Object.getPrototypeOf(BaseTooltip)).call(this, quill, boundsContainer));
  5984. _this4.textbox = _this4.root.querySelector('input[type="text"]');
  5985. _this4.listen();
  5986. return _this4;
  5987. }
  5988. _createClass(BaseTooltip, [{
  5989. key: 'listen',
  5990. value: function listen() {
  5991. var _this5 = this;
  5992. this.textbox.addEventListener('keydown', function (event) {
  5993. if (_keyboard2.default.match(event, 'enter')) {
  5994. _this5.save();
  5995. event.preventDefault();
  5996. } else if (_keyboard2.default.match(event, 'escape')) {
  5997. _this5.cancel();
  5998. event.preventDefault();
  5999. }
  6000. });
  6001. }
  6002. }, {
  6003. key: 'cancel',
  6004. value: function cancel() {
  6005. this.hide();
  6006. }
  6007. }, {
  6008. key: 'edit',
  6009. value: function edit() {
  6010. var mode = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'link';
  6011. var preview = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
  6012. this.root.classList.remove('ql-hidden');
  6013. this.root.classList.add('ql-editing');
  6014. if (preview != null) {
  6015. this.textbox.value = preview;
  6016. } else if (mode !== this.root.getAttribute('data-mode')) {
  6017. this.textbox.value = '';
  6018. }
  6019. this.position(this.quill.getBounds(this.quill.selection.savedRange));
  6020. this.textbox.select();
  6021. this.textbox.setAttribute('placeholder', this.textbox.getAttribute('data-' + mode) || '');
  6022. this.root.setAttribute('data-mode', mode);
  6023. }
  6024. }, {
  6025. key: 'restoreFocus',
  6026. value: function restoreFocus() {
  6027. var scrollTop = this.quill.scrollingContainer.scrollTop;
  6028. this.quill.focus();
  6029. this.quill.scrollingContainer.scrollTop = scrollTop;
  6030. }
  6031. }, {
  6032. key: 'save',
  6033. value: function save() {
  6034. var value = this.textbox.value;
  6035. switch (this.root.getAttribute('data-mode')) {
  6036. case 'link':
  6037. {
  6038. var scrollTop = this.quill.root.scrollTop;
  6039. if (this.linkRange) {
  6040. this.quill.formatText(this.linkRange, 'link', value, _emitter2.default.sources.USER);
  6041. delete this.linkRange;
  6042. } else {
  6043. this.restoreFocus();
  6044. this.quill.format('link', value, _emitter2.default.sources.USER);
  6045. }
  6046. this.quill.root.scrollTop = scrollTop;
  6047. break;
  6048. }
  6049. case 'video':
  6050. {
  6051. value = extractVideoUrl(value);
  6052. } // eslint-disable-next-line no-fallthrough
  6053. case 'formula':
  6054. {
  6055. if (!value) break;
  6056. var range = this.quill.getSelection(true);
  6057. if (range != null) {
  6058. var index = range.index + range.length;
  6059. this.quill.insertEmbed(index, this.root.getAttribute('data-mode'), value, _emitter2.default.sources.USER);
  6060. if (this.root.getAttribute('data-mode') === 'formula') {
  6061. this.quill.insertText(index + 1, ' ', _emitter2.default.sources.USER);
  6062. }
  6063. this.quill.setSelection(index + 2, _emitter2.default.sources.USER);
  6064. }
  6065. break;
  6066. }
  6067. default:
  6068. }
  6069. this.textbox.value = '';
  6070. this.hide();
  6071. }
  6072. }]);
  6073. return BaseTooltip;
  6074. }(_tooltip2.default);
  6075. function extractVideoUrl(url) {
  6076. var match = url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtube\.com\/watch.*v=([a-zA-Z0-9_-]+)/) || url.match(/^(?:(https?):\/\/)?(?:(?:www|m)\.)?youtu\.be\/([a-zA-Z0-9_-]+)/);
  6077. if (match) {
  6078. return (match[1] || 'https') + '://www.youtube.com/embed/' + match[2] + '?showinfo=0';
  6079. }
  6080. if (match = url.match(/^(?:(https?):\/\/)?(?:www\.)?vimeo\.com\/(\d+)/)) {
  6081. // eslint-disable-line no-cond-assign
  6082. return (match[1] || 'https') + '://player.vimeo.com/video/' + match[2] + '/';
  6083. }
  6084. return url;
  6085. }
  6086. function fillSelect(select, values) {
  6087. var defaultValue = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
  6088. values.forEach(function (value) {
  6089. var option = document.createElement('option');
  6090. if (value === defaultValue) {
  6091. option.setAttribute('selected', 'selected');
  6092. } else {
  6093. option.setAttribute('value', value);
  6094. }
  6095. select.appendChild(option);
  6096. });
  6097. }
  6098. exports.BaseTooltip = BaseTooltip;
  6099. exports.default = BaseTheme;
  6100. /***/ }),
  6101. /* 44 */
  6102. /***/ (function(module, exports, __webpack_require__) {
  6103. "use strict";
  6104. Object.defineProperty(exports, "__esModule", { value: true });
  6105. var LinkedList = /** @class */ (function () {
  6106. function LinkedList() {
  6107. this.head = this.tail = null;
  6108. this.length = 0;
  6109. }
  6110. LinkedList.prototype.append = function () {
  6111. var nodes = [];
  6112. for (var _i = 0; _i < arguments.length; _i++) {
  6113. nodes[_i] = arguments[_i];
  6114. }
  6115. this.insertBefore(nodes[0], null);
  6116. if (nodes.length > 1) {
  6117. this.append.apply(this, nodes.slice(1));
  6118. }
  6119. };
  6120. LinkedList.prototype.contains = function (node) {
  6121. var cur, next = this.iterator();
  6122. while ((cur = next())) {
  6123. if (cur === node)
  6124. return true;
  6125. }
  6126. return false;
  6127. };
  6128. LinkedList.prototype.insertBefore = function (node, refNode) {
  6129. if (!node)
  6130. return;
  6131. node.next = refNode;
  6132. if (refNode != null) {
  6133. node.prev = refNode.prev;
  6134. if (refNode.prev != null) {
  6135. refNode.prev.next = node;
  6136. }
  6137. refNode.prev = node;
  6138. if (refNode === this.head) {
  6139. this.head = node;
  6140. }
  6141. }
  6142. else if (this.tail != null) {
  6143. this.tail.next = node;
  6144. node.prev = this.tail;
  6145. this.tail = node;
  6146. }
  6147. else {
  6148. node.prev = null;
  6149. this.head = this.tail = node;
  6150. }
  6151. this.length += 1;
  6152. };
  6153. LinkedList.prototype.offset = function (target) {
  6154. var index = 0, cur = this.head;
  6155. while (cur != null) {
  6156. if (cur === target)
  6157. return index;
  6158. index += cur.length();
  6159. cur = cur.next;
  6160. }
  6161. return -1;
  6162. };
  6163. LinkedList.prototype.remove = function (node) {
  6164. if (!this.contains(node))
  6165. return;
  6166. if (node.prev != null)
  6167. node.prev.next = node.next;
  6168. if (node.next != null)
  6169. node.next.prev = node.prev;
  6170. if (node === this.head)
  6171. this.head = node.next;
  6172. if (node === this.tail)
  6173. this.tail = node.prev;
  6174. this.length -= 1;
  6175. };
  6176. LinkedList.prototype.iterator = function (curNode) {
  6177. if (curNode === void 0) { curNode = this.head; }
  6178. // TODO use yield when we can
  6179. return function () {
  6180. var ret = curNode;
  6181. if (curNode != null)
  6182. curNode = curNode.next;
  6183. return ret;
  6184. };
  6185. };
  6186. LinkedList.prototype.find = function (index, inclusive) {
  6187. if (inclusive === void 0) { inclusive = false; }
  6188. var cur, next = this.iterator();
  6189. while ((cur = next())) {
  6190. var length = cur.length();
  6191. if (index < length ||
  6192. (inclusive && index === length && (cur.next == null || cur.next.length() !== 0))) {
  6193. return [cur, index];
  6194. }
  6195. index -= length;
  6196. }
  6197. return [null, 0];
  6198. };
  6199. LinkedList.prototype.forEach = function (callback) {
  6200. var cur, next = this.iterator();
  6201. while ((cur = next())) {
  6202. callback(cur);
  6203. }
  6204. };
  6205. LinkedList.prototype.forEachAt = function (index, length, callback) {
  6206. if (length <= 0)
  6207. return;
  6208. var _a = this.find(index), startNode = _a[0], offset = _a[1];
  6209. var cur, curIndex = index - offset, next = this.iterator(startNode);
  6210. while ((cur = next()) && curIndex < index + length) {
  6211. var curLength = cur.length();
  6212. if (index > curIndex) {
  6213. callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index));
  6214. }
  6215. else {
  6216. callback(cur, 0, Math.min(curLength, index + length - curIndex));
  6217. }
  6218. curIndex += curLength;
  6219. }
  6220. };
  6221. LinkedList.prototype.map = function (callback) {
  6222. return this.reduce(function (memo, cur) {
  6223. memo.push(callback(cur));
  6224. return memo;
  6225. }, []);
  6226. };
  6227. LinkedList.prototype.reduce = function (callback, memo) {
  6228. var cur, next = this.iterator();
  6229. while ((cur = next())) {
  6230. memo = callback(memo, cur);
  6231. }
  6232. return memo;
  6233. };
  6234. return LinkedList;
  6235. }());
  6236. exports.default = LinkedList;
  6237. /***/ }),
  6238. /* 45 */
  6239. /***/ (function(module, exports, __webpack_require__) {
  6240. "use strict";
  6241. var __extends = (this && this.__extends) || (function () {
  6242. var extendStatics = Object.setPrototypeOf ||
  6243. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6244. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6245. return function (d, b) {
  6246. extendStatics(d, b);
  6247. function __() { this.constructor = d; }
  6248. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6249. };
  6250. })();
  6251. Object.defineProperty(exports, "__esModule", { value: true });
  6252. var container_1 = __webpack_require__(17);
  6253. var Registry = __webpack_require__(1);
  6254. var OBSERVER_CONFIG = {
  6255. attributes: true,
  6256. characterData: true,
  6257. characterDataOldValue: true,
  6258. childList: true,
  6259. subtree: true,
  6260. };
  6261. var MAX_OPTIMIZE_ITERATIONS = 100;
  6262. var ScrollBlot = /** @class */ (function (_super) {
  6263. __extends(ScrollBlot, _super);
  6264. function ScrollBlot(node) {
  6265. var _this = _super.call(this, node) || this;
  6266. _this.scroll = _this;
  6267. _this.observer = new MutationObserver(function (mutations) {
  6268. _this.update(mutations);
  6269. });
  6270. _this.observer.observe(_this.domNode, OBSERVER_CONFIG);
  6271. _this.attach();
  6272. return _this;
  6273. }
  6274. ScrollBlot.prototype.detach = function () {
  6275. _super.prototype.detach.call(this);
  6276. this.observer.disconnect();
  6277. };
  6278. ScrollBlot.prototype.deleteAt = function (index, length) {
  6279. this.update();
  6280. if (index === 0 && length === this.length()) {
  6281. this.children.forEach(function (child) {
  6282. child.remove();
  6283. });
  6284. }
  6285. else {
  6286. _super.prototype.deleteAt.call(this, index, length);
  6287. }
  6288. };
  6289. ScrollBlot.prototype.formatAt = function (index, length, name, value) {
  6290. this.update();
  6291. _super.prototype.formatAt.call(this, index, length, name, value);
  6292. };
  6293. ScrollBlot.prototype.insertAt = function (index, value, def) {
  6294. this.update();
  6295. _super.prototype.insertAt.call(this, index, value, def);
  6296. };
  6297. ScrollBlot.prototype.optimize = function (mutations, context) {
  6298. var _this = this;
  6299. if (mutations === void 0) { mutations = []; }
  6300. if (context === void 0) { context = {}; }
  6301. _super.prototype.optimize.call(this, context);
  6302. // We must modify mutations directly, cannot make copy and then modify
  6303. var records = [].slice.call(this.observer.takeRecords());
  6304. // Array.push currently seems to be implemented by a non-tail recursive function
  6305. // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords());
  6306. while (records.length > 0)
  6307. mutations.push(records.pop());
  6308. // TODO use WeakMap
  6309. var mark = function (blot, markParent) {
  6310. if (markParent === void 0) { markParent = true; }
  6311. if (blot == null || blot === _this)
  6312. return;
  6313. if (blot.domNode.parentNode == null)
  6314. return;
  6315. // @ts-ignore
  6316. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  6317. // @ts-ignore
  6318. blot.domNode[Registry.DATA_KEY].mutations = [];
  6319. }
  6320. if (markParent)
  6321. mark(blot.parent);
  6322. };
  6323. var optimize = function (blot) {
  6324. // Post-order traversal
  6325. if (
  6326. // @ts-ignore
  6327. blot.domNode[Registry.DATA_KEY] == null ||
  6328. // @ts-ignore
  6329. blot.domNode[Registry.DATA_KEY].mutations == null) {
  6330. return;
  6331. }
  6332. if (blot instanceof container_1.default) {
  6333. blot.children.forEach(optimize);
  6334. }
  6335. blot.optimize(context);
  6336. };
  6337. var remaining = mutations;
  6338. for (var i = 0; remaining.length > 0; i += 1) {
  6339. if (i >= MAX_OPTIMIZE_ITERATIONS) {
  6340. throw new Error('[Parchment] Maximum optimize iterations reached');
  6341. }
  6342. remaining.forEach(function (mutation) {
  6343. var blot = Registry.find(mutation.target, true);
  6344. if (blot == null)
  6345. return;
  6346. if (blot.domNode === mutation.target) {
  6347. if (mutation.type === 'childList') {
  6348. mark(Registry.find(mutation.previousSibling, false));
  6349. [].forEach.call(mutation.addedNodes, function (node) {
  6350. var child = Registry.find(node, false);
  6351. mark(child, false);
  6352. if (child instanceof container_1.default) {
  6353. child.children.forEach(function (grandChild) {
  6354. mark(grandChild, false);
  6355. });
  6356. }
  6357. });
  6358. }
  6359. else if (mutation.type === 'attributes') {
  6360. mark(blot.prev);
  6361. }
  6362. }
  6363. mark(blot);
  6364. });
  6365. this.children.forEach(optimize);
  6366. remaining = [].slice.call(this.observer.takeRecords());
  6367. records = remaining.slice();
  6368. while (records.length > 0)
  6369. mutations.push(records.pop());
  6370. }
  6371. };
  6372. ScrollBlot.prototype.update = function (mutations, context) {
  6373. var _this = this;
  6374. if (context === void 0) { context = {}; }
  6375. mutations = mutations || this.observer.takeRecords();
  6376. // TODO use WeakMap
  6377. mutations
  6378. .map(function (mutation) {
  6379. var blot = Registry.find(mutation.target, true);
  6380. if (blot == null)
  6381. return null;
  6382. // @ts-ignore
  6383. if (blot.domNode[Registry.DATA_KEY].mutations == null) {
  6384. // @ts-ignore
  6385. blot.domNode[Registry.DATA_KEY].mutations = [mutation];
  6386. return blot;
  6387. }
  6388. else {
  6389. // @ts-ignore
  6390. blot.domNode[Registry.DATA_KEY].mutations.push(mutation);
  6391. return null;
  6392. }
  6393. })
  6394. .forEach(function (blot) {
  6395. if (blot == null ||
  6396. blot === _this ||
  6397. //@ts-ignore
  6398. blot.domNode[Registry.DATA_KEY] == null)
  6399. return;
  6400. // @ts-ignore
  6401. blot.update(blot.domNode[Registry.DATA_KEY].mutations || [], context);
  6402. });
  6403. // @ts-ignore
  6404. if (this.domNode[Registry.DATA_KEY].mutations != null) {
  6405. // @ts-ignore
  6406. _super.prototype.update.call(this, this.domNode[Registry.DATA_KEY].mutations, context);
  6407. }
  6408. this.optimize(mutations, context);
  6409. };
  6410. ScrollBlot.blotName = 'scroll';
  6411. ScrollBlot.defaultChild = 'block';
  6412. ScrollBlot.scope = Registry.Scope.BLOCK_BLOT;
  6413. ScrollBlot.tagName = 'DIV';
  6414. return ScrollBlot;
  6415. }(container_1.default));
  6416. exports.default = ScrollBlot;
  6417. /***/ }),
  6418. /* 46 */
  6419. /***/ (function(module, exports, __webpack_require__) {
  6420. "use strict";
  6421. var __extends = (this && this.__extends) || (function () {
  6422. var extendStatics = Object.setPrototypeOf ||
  6423. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6424. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6425. return function (d, b) {
  6426. extendStatics(d, b);
  6427. function __() { this.constructor = d; }
  6428. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6429. };
  6430. })();
  6431. Object.defineProperty(exports, "__esModule", { value: true });
  6432. var format_1 = __webpack_require__(18);
  6433. var Registry = __webpack_require__(1);
  6434. // Shallow object comparison
  6435. function isEqual(obj1, obj2) {
  6436. if (Object.keys(obj1).length !== Object.keys(obj2).length)
  6437. return false;
  6438. // @ts-ignore
  6439. for (var prop in obj1) {
  6440. // @ts-ignore
  6441. if (obj1[prop] !== obj2[prop])
  6442. return false;
  6443. }
  6444. return true;
  6445. }
  6446. var InlineBlot = /** @class */ (function (_super) {
  6447. __extends(InlineBlot, _super);
  6448. function InlineBlot() {
  6449. return _super !== null && _super.apply(this, arguments) || this;
  6450. }
  6451. InlineBlot.formats = function (domNode) {
  6452. if (domNode.tagName === InlineBlot.tagName)
  6453. return undefined;
  6454. return _super.formats.call(this, domNode);
  6455. };
  6456. InlineBlot.prototype.format = function (name, value) {
  6457. var _this = this;
  6458. if (name === this.statics.blotName && !value) {
  6459. this.children.forEach(function (child) {
  6460. if (!(child instanceof format_1.default)) {
  6461. child = child.wrap(InlineBlot.blotName, true);
  6462. }
  6463. _this.attributes.copy(child);
  6464. });
  6465. this.unwrap();
  6466. }
  6467. else {
  6468. _super.prototype.format.call(this, name, value);
  6469. }
  6470. };
  6471. InlineBlot.prototype.formatAt = function (index, length, name, value) {
  6472. if (this.formats()[name] != null || Registry.query(name, Registry.Scope.ATTRIBUTE)) {
  6473. var blot = this.isolate(index, length);
  6474. blot.format(name, value);
  6475. }
  6476. else {
  6477. _super.prototype.formatAt.call(this, index, length, name, value);
  6478. }
  6479. };
  6480. InlineBlot.prototype.optimize = function (context) {
  6481. _super.prototype.optimize.call(this, context);
  6482. var formats = this.formats();
  6483. if (Object.keys(formats).length === 0) {
  6484. return this.unwrap(); // unformatted span
  6485. }
  6486. var next = this.next;
  6487. if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) {
  6488. next.moveChildren(this);
  6489. next.remove();
  6490. }
  6491. };
  6492. InlineBlot.blotName = 'inline';
  6493. InlineBlot.scope = Registry.Scope.INLINE_BLOT;
  6494. InlineBlot.tagName = 'SPAN';
  6495. return InlineBlot;
  6496. }(format_1.default));
  6497. exports.default = InlineBlot;
  6498. /***/ }),
  6499. /* 47 */
  6500. /***/ (function(module, exports, __webpack_require__) {
  6501. "use strict";
  6502. var __extends = (this && this.__extends) || (function () {
  6503. var extendStatics = Object.setPrototypeOf ||
  6504. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6505. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6506. return function (d, b) {
  6507. extendStatics(d, b);
  6508. function __() { this.constructor = d; }
  6509. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6510. };
  6511. })();
  6512. Object.defineProperty(exports, "__esModule", { value: true });
  6513. var format_1 = __webpack_require__(18);
  6514. var Registry = __webpack_require__(1);
  6515. var BlockBlot = /** @class */ (function (_super) {
  6516. __extends(BlockBlot, _super);
  6517. function BlockBlot() {
  6518. return _super !== null && _super.apply(this, arguments) || this;
  6519. }
  6520. BlockBlot.formats = function (domNode) {
  6521. var tagName = Registry.query(BlockBlot.blotName).tagName;
  6522. if (domNode.tagName === tagName)
  6523. return undefined;
  6524. return _super.formats.call(this, domNode);
  6525. };
  6526. BlockBlot.prototype.format = function (name, value) {
  6527. if (Registry.query(name, Registry.Scope.BLOCK) == null) {
  6528. return;
  6529. }
  6530. else if (name === this.statics.blotName && !value) {
  6531. this.replaceWith(BlockBlot.blotName);
  6532. }
  6533. else {
  6534. _super.prototype.format.call(this, name, value);
  6535. }
  6536. };
  6537. BlockBlot.prototype.formatAt = function (index, length, name, value) {
  6538. if (Registry.query(name, Registry.Scope.BLOCK) != null) {
  6539. this.format(name, value);
  6540. }
  6541. else {
  6542. _super.prototype.formatAt.call(this, index, length, name, value);
  6543. }
  6544. };
  6545. BlockBlot.prototype.insertAt = function (index, value, def) {
  6546. if (def == null || Registry.query(value, Registry.Scope.INLINE) != null) {
  6547. // Insert text or inline
  6548. _super.prototype.insertAt.call(this, index, value, def);
  6549. }
  6550. else {
  6551. var after = this.split(index);
  6552. var blot = Registry.create(value, def);
  6553. after.parent.insertBefore(blot, after);
  6554. }
  6555. };
  6556. BlockBlot.prototype.update = function (mutations, context) {
  6557. if (navigator.userAgent.match(/Trident/)) {
  6558. this.build();
  6559. }
  6560. else {
  6561. _super.prototype.update.call(this, mutations, context);
  6562. }
  6563. };
  6564. BlockBlot.blotName = 'block';
  6565. BlockBlot.scope = Registry.Scope.BLOCK_BLOT;
  6566. BlockBlot.tagName = 'P';
  6567. return BlockBlot;
  6568. }(format_1.default));
  6569. exports.default = BlockBlot;
  6570. /***/ }),
  6571. /* 48 */
  6572. /***/ (function(module, exports, __webpack_require__) {
  6573. "use strict";
  6574. var __extends = (this && this.__extends) || (function () {
  6575. var extendStatics = Object.setPrototypeOf ||
  6576. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6577. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6578. return function (d, b) {
  6579. extendStatics(d, b);
  6580. function __() { this.constructor = d; }
  6581. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6582. };
  6583. })();
  6584. Object.defineProperty(exports, "__esModule", { value: true });
  6585. var leaf_1 = __webpack_require__(19);
  6586. var EmbedBlot = /** @class */ (function (_super) {
  6587. __extends(EmbedBlot, _super);
  6588. function EmbedBlot() {
  6589. return _super !== null && _super.apply(this, arguments) || this;
  6590. }
  6591. EmbedBlot.formats = function (domNode) {
  6592. return undefined;
  6593. };
  6594. EmbedBlot.prototype.format = function (name, value) {
  6595. // super.formatAt wraps, which is what we want in general,
  6596. // but this allows subclasses to overwrite for formats
  6597. // that just apply to particular embeds
  6598. _super.prototype.formatAt.call(this, 0, this.length(), name, value);
  6599. };
  6600. EmbedBlot.prototype.formatAt = function (index, length, name, value) {
  6601. if (index === 0 && length === this.length()) {
  6602. this.format(name, value);
  6603. }
  6604. else {
  6605. _super.prototype.formatAt.call(this, index, length, name, value);
  6606. }
  6607. };
  6608. EmbedBlot.prototype.formats = function () {
  6609. return this.statics.formats(this.domNode);
  6610. };
  6611. return EmbedBlot;
  6612. }(leaf_1.default));
  6613. exports.default = EmbedBlot;
  6614. /***/ }),
  6615. /* 49 */
  6616. /***/ (function(module, exports, __webpack_require__) {
  6617. "use strict";
  6618. var __extends = (this && this.__extends) || (function () {
  6619. var extendStatics = Object.setPrototypeOf ||
  6620. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  6621. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  6622. return function (d, b) {
  6623. extendStatics(d, b);
  6624. function __() { this.constructor = d; }
  6625. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  6626. };
  6627. })();
  6628. Object.defineProperty(exports, "__esModule", { value: true });
  6629. var leaf_1 = __webpack_require__(19);
  6630. var Registry = __webpack_require__(1);
  6631. var TextBlot = /** @class */ (function (_super) {
  6632. __extends(TextBlot, _super);
  6633. function TextBlot(node) {
  6634. var _this = _super.call(this, node) || this;
  6635. _this.text = _this.statics.value(_this.domNode);
  6636. return _this;
  6637. }
  6638. TextBlot.create = function (value) {
  6639. return document.createTextNode(value);
  6640. };
  6641. TextBlot.value = function (domNode) {
  6642. var text = domNode.data;
  6643. // @ts-ignore
  6644. if (text['normalize'])
  6645. text = text['normalize']();
  6646. return text;
  6647. };
  6648. TextBlot.prototype.deleteAt = function (index, length) {
  6649. this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length);
  6650. };
  6651. TextBlot.prototype.index = function (node, offset) {
  6652. if (this.domNode === node) {
  6653. return offset;
  6654. }
  6655. return -1;
  6656. };
  6657. TextBlot.prototype.insertAt = function (index, value, def) {
  6658. if (def == null) {
  6659. this.text = this.text.slice(0, index) + value + this.text.slice(index);
  6660. this.domNode.data = this.text;
  6661. }
  6662. else {
  6663. _super.prototype.insertAt.call(this, index, value, def);
  6664. }
  6665. };
  6666. TextBlot.prototype.length = function () {
  6667. return this.text.length;
  6668. };
  6669. TextBlot.prototype.optimize = function (context) {
  6670. _super.prototype.optimize.call(this, context);
  6671. this.text = this.statics.value(this.domNode);
  6672. if (this.text.length === 0) {
  6673. this.remove();
  6674. }
  6675. else if (this.next instanceof TextBlot && this.next.prev === this) {
  6676. this.insertAt(this.length(), this.next.value());
  6677. this.next.remove();
  6678. }
  6679. };
  6680. TextBlot.prototype.position = function (index, inclusive) {
  6681. if (inclusive === void 0) { inclusive = false; }
  6682. return [this.domNode, index];
  6683. };
  6684. TextBlot.prototype.split = function (index, force) {
  6685. if (force === void 0) { force = false; }
  6686. if (!force) {
  6687. if (index === 0)
  6688. return this;
  6689. if (index === this.length())
  6690. return this.next;
  6691. }
  6692. var after = Registry.create(this.domNode.splitText(index));
  6693. this.parent.insertBefore(after, this.next);
  6694. this.text = this.statics.value(this.domNode);
  6695. return after;
  6696. };
  6697. TextBlot.prototype.update = function (mutations, context) {
  6698. var _this = this;
  6699. if (mutations.some(function (mutation) {
  6700. return mutation.type === 'characterData' && mutation.target === _this.domNode;
  6701. })) {
  6702. this.text = this.statics.value(this.domNode);
  6703. }
  6704. };
  6705. TextBlot.prototype.value = function () {
  6706. return this.text;
  6707. };
  6708. TextBlot.blotName = 'text';
  6709. TextBlot.scope = Registry.Scope.INLINE_BLOT;
  6710. return TextBlot;
  6711. }(leaf_1.default));
  6712. exports.default = TextBlot;
  6713. /***/ }),
  6714. /* 50 */
  6715. /***/ (function(module, exports, __webpack_require__) {
  6716. "use strict";
  6717. var elem = document.createElement('div');
  6718. elem.classList.toggle('test-class', false);
  6719. if (elem.classList.contains('test-class')) {
  6720. var _toggle = DOMTokenList.prototype.toggle;
  6721. DOMTokenList.prototype.toggle = function (token, force) {
  6722. if (arguments.length > 1 && !this.contains(token) === !force) {
  6723. return force;
  6724. } else {
  6725. return _toggle.call(this, token);
  6726. }
  6727. };
  6728. }
  6729. if (!String.prototype.startsWith) {
  6730. String.prototype.startsWith = function (searchString, position) {
  6731. position = position || 0;
  6732. return this.substr(position, searchString.length) === searchString;
  6733. };
  6734. }
  6735. if (!String.prototype.endsWith) {
  6736. String.prototype.endsWith = function (searchString, position) {
  6737. var subjectString = this.toString();
  6738. if (typeof position !== 'number' || !isFinite(position) || Math.floor(position) !== position || position > subjectString.length) {
  6739. position = subjectString.length;
  6740. }
  6741. position -= searchString.length;
  6742. var lastIndex = subjectString.indexOf(searchString, position);
  6743. return lastIndex !== -1 && lastIndex === position;
  6744. };
  6745. }
  6746. if (!Array.prototype.find) {
  6747. Object.defineProperty(Array.prototype, "find", {
  6748. value: function value(predicate) {
  6749. if (this === null) {
  6750. throw new TypeError('Array.prototype.find called on null or undefined');
  6751. }
  6752. if (typeof predicate !== 'function') {
  6753. throw new TypeError('predicate must be a function');
  6754. }
  6755. var list = Object(this);
  6756. var length = list.length >>> 0;
  6757. var thisArg = arguments[1];
  6758. var value;
  6759. for (var i = 0; i < length; i++) {
  6760. value = list[i];
  6761. if (predicate.call(thisArg, value, i, list)) {
  6762. return value;
  6763. }
  6764. }
  6765. return undefined;
  6766. }
  6767. });
  6768. }
  6769. document.addEventListener("DOMContentLoaded", function () {
  6770. // Disable resizing in Firefox
  6771. document.execCommand("enableObjectResizing", false, false);
  6772. // Disable automatic linkifying in IE11
  6773. document.execCommand("autoUrlDetect", false, false);
  6774. });
  6775. /***/ }),
  6776. /* 51 */
  6777. /***/ (function(module, exports) {
  6778. /**
  6779. * This library modifies the diff-patch-match library by Neil Fraser
  6780. * by removing the patch and match functionality and certain advanced
  6781. * options in the diff function. The original license is as follows:
  6782. *
  6783. * ===
  6784. *
  6785. * Diff Match and Patch
  6786. *
  6787. * Copyright 2006 Google Inc.
  6788. * http://code.google.com/p/google-diff-match-patch/
  6789. *
  6790. * Licensed under the Apache License, Version 2.0 (the "License");
  6791. * you may not use this file except in compliance with the License.
  6792. * You may obtain a copy of the License at
  6793. *
  6794. * http://www.apache.org/licenses/LICENSE-2.0
  6795. *
  6796. * Unless required by applicable law or agreed to in writing, software
  6797. * distributed under the License is distributed on an "AS IS" BASIS,
  6798. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  6799. * See the License for the specific language governing permissions and
  6800. * limitations under the License.
  6801. */
  6802. /**
  6803. * The data structure representing a diff is an array of tuples:
  6804. * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']]
  6805. * which means: delete 'Hello', add 'Goodbye' and keep ' world.'
  6806. */
  6807. var DIFF_DELETE = -1;
  6808. var DIFF_INSERT = 1;
  6809. var DIFF_EQUAL = 0;
  6810. /**
  6811. * Find the differences between two texts. Simplifies the problem by stripping
  6812. * any common prefix or suffix off the texts before diffing.
  6813. * @param {string} text1 Old string to be diffed.
  6814. * @param {string} text2 New string to be diffed.
  6815. * @param {Int} cursor_pos Expected edit position in text1 (optional)
  6816. * @return {Array} Array of diff tuples.
  6817. */
  6818. function diff_main(text1, text2, cursor_pos) {
  6819. // Check for equality (speedup).
  6820. if (text1 == text2) {
  6821. if (text1) {
  6822. return [[DIFF_EQUAL, text1]];
  6823. }
  6824. return [];
  6825. }
  6826. // Check cursor_pos within bounds
  6827. if (cursor_pos < 0 || text1.length < cursor_pos) {
  6828. cursor_pos = null;
  6829. }
  6830. // Trim off common prefix (speedup).
  6831. var commonlength = diff_commonPrefix(text1, text2);
  6832. var commonprefix = text1.substring(0, commonlength);
  6833. text1 = text1.substring(commonlength);
  6834. text2 = text2.substring(commonlength);
  6835. // Trim off common suffix (speedup).
  6836. commonlength = diff_commonSuffix(text1, text2);
  6837. var commonsuffix = text1.substring(text1.length - commonlength);
  6838. text1 = text1.substring(0, text1.length - commonlength);
  6839. text2 = text2.substring(0, text2.length - commonlength);
  6840. // Compute the diff on the middle block.
  6841. var diffs = diff_compute_(text1, text2);
  6842. // Restore the prefix and suffix.
  6843. if (commonprefix) {
  6844. diffs.unshift([DIFF_EQUAL, commonprefix]);
  6845. }
  6846. if (commonsuffix) {
  6847. diffs.push([DIFF_EQUAL, commonsuffix]);
  6848. }
  6849. diff_cleanupMerge(diffs);
  6850. if (cursor_pos != null) {
  6851. diffs = fix_cursor(diffs, cursor_pos);
  6852. }
  6853. diffs = fix_emoji(diffs);
  6854. return diffs;
  6855. };
  6856. /**
  6857. * Find the differences between two texts. Assumes that the texts do not
  6858. * have any common prefix or suffix.
  6859. * @param {string} text1 Old string to be diffed.
  6860. * @param {string} text2 New string to be diffed.
  6861. * @return {Array} Array of diff tuples.
  6862. */
  6863. function diff_compute_(text1, text2) {
  6864. var diffs;
  6865. if (!text1) {
  6866. // Just add some text (speedup).
  6867. return [[DIFF_INSERT, text2]];
  6868. }
  6869. if (!text2) {
  6870. // Just delete some text (speedup).
  6871. return [[DIFF_DELETE, text1]];
  6872. }
  6873. var longtext = text1.length > text2.length ? text1 : text2;
  6874. var shorttext = text1.length > text2.length ? text2 : text1;
  6875. var i = longtext.indexOf(shorttext);
  6876. if (i != -1) {
  6877. // Shorter text is inside the longer text (speedup).
  6878. diffs = [[DIFF_INSERT, longtext.substring(0, i)],
  6879. [DIFF_EQUAL, shorttext],
  6880. [DIFF_INSERT, longtext.substring(i + shorttext.length)]];
  6881. // Swap insertions for deletions if diff is reversed.
  6882. if (text1.length > text2.length) {
  6883. diffs[0][0] = diffs[2][0] = DIFF_DELETE;
  6884. }
  6885. return diffs;
  6886. }
  6887. if (shorttext.length == 1) {
  6888. // Single character string.
  6889. // After the previous speedup, the character can't be an equality.
  6890. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  6891. }
  6892. // Check to see if the problem can be split in two.
  6893. var hm = diff_halfMatch_(text1, text2);
  6894. if (hm) {
  6895. // A half-match was found, sort out the return data.
  6896. var text1_a = hm[0];
  6897. var text1_b = hm[1];
  6898. var text2_a = hm[2];
  6899. var text2_b = hm[3];
  6900. var mid_common = hm[4];
  6901. // Send both pairs off for separate processing.
  6902. var diffs_a = diff_main(text1_a, text2_a);
  6903. var diffs_b = diff_main(text1_b, text2_b);
  6904. // Merge the results.
  6905. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b);
  6906. }
  6907. return diff_bisect_(text1, text2);
  6908. };
  6909. /**
  6910. * Find the 'middle snake' of a diff, split the problem in two
  6911. * and return the recursively constructed diff.
  6912. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations.
  6913. * @param {string} text1 Old string to be diffed.
  6914. * @param {string} text2 New string to be diffed.
  6915. * @return {Array} Array of diff tuples.
  6916. * @private
  6917. */
  6918. function diff_bisect_(text1, text2) {
  6919. // Cache the text lengths to prevent multiple calls.
  6920. var text1_length = text1.length;
  6921. var text2_length = text2.length;
  6922. var max_d = Math.ceil((text1_length + text2_length) / 2);
  6923. var v_offset = max_d;
  6924. var v_length = 2 * max_d;
  6925. var v1 = new Array(v_length);
  6926. var v2 = new Array(v_length);
  6927. // Setting all elements to -1 is faster in Chrome & Firefox than mixing
  6928. // integers and undefined.
  6929. for (var x = 0; x < v_length; x++) {
  6930. v1[x] = -1;
  6931. v2[x] = -1;
  6932. }
  6933. v1[v_offset + 1] = 0;
  6934. v2[v_offset + 1] = 0;
  6935. var delta = text1_length - text2_length;
  6936. // If the total number of characters is odd, then the front path will collide
  6937. // with the reverse path.
  6938. var front = (delta % 2 != 0);
  6939. // Offsets for start and end of k loop.
  6940. // Prevents mapping of space beyond the grid.
  6941. var k1start = 0;
  6942. var k1end = 0;
  6943. var k2start = 0;
  6944. var k2end = 0;
  6945. for (var d = 0; d < max_d; d++) {
  6946. // Walk the front path one step.
  6947. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) {
  6948. var k1_offset = v_offset + k1;
  6949. var x1;
  6950. if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) {
  6951. x1 = v1[k1_offset + 1];
  6952. } else {
  6953. x1 = v1[k1_offset - 1] + 1;
  6954. }
  6955. var y1 = x1 - k1;
  6956. while (x1 < text1_length && y1 < text2_length &&
  6957. text1.charAt(x1) == text2.charAt(y1)) {
  6958. x1++;
  6959. y1++;
  6960. }
  6961. v1[k1_offset] = x1;
  6962. if (x1 > text1_length) {
  6963. // Ran off the right of the graph.
  6964. k1end += 2;
  6965. } else if (y1 > text2_length) {
  6966. // Ran off the bottom of the graph.
  6967. k1start += 2;
  6968. } else if (front) {
  6969. var k2_offset = v_offset + delta - k1;
  6970. if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) {
  6971. // Mirror x2 onto top-left coordinate system.
  6972. var x2 = text1_length - v2[k2_offset];
  6973. if (x1 >= x2) {
  6974. // Overlap detected.
  6975. return diff_bisectSplit_(text1, text2, x1, y1);
  6976. }
  6977. }
  6978. }
  6979. }
  6980. // Walk the reverse path one step.
  6981. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) {
  6982. var k2_offset = v_offset + k2;
  6983. var x2;
  6984. if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) {
  6985. x2 = v2[k2_offset + 1];
  6986. } else {
  6987. x2 = v2[k2_offset - 1] + 1;
  6988. }
  6989. var y2 = x2 - k2;
  6990. while (x2 < text1_length && y2 < text2_length &&
  6991. text1.charAt(text1_length - x2 - 1) ==
  6992. text2.charAt(text2_length - y2 - 1)) {
  6993. x2++;
  6994. y2++;
  6995. }
  6996. v2[k2_offset] = x2;
  6997. if (x2 > text1_length) {
  6998. // Ran off the left of the graph.
  6999. k2end += 2;
  7000. } else if (y2 > text2_length) {
  7001. // Ran off the top of the graph.
  7002. k2start += 2;
  7003. } else if (!front) {
  7004. var k1_offset = v_offset + delta - k2;
  7005. if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) {
  7006. var x1 = v1[k1_offset];
  7007. var y1 = v_offset + x1 - k1_offset;
  7008. // Mirror x2 onto top-left coordinate system.
  7009. x2 = text1_length - x2;
  7010. if (x1 >= x2) {
  7011. // Overlap detected.
  7012. return diff_bisectSplit_(text1, text2, x1, y1);
  7013. }
  7014. }
  7015. }
  7016. }
  7017. }
  7018. // Diff took too long and hit the deadline or
  7019. // number of diffs equals number of characters, no commonality at all.
  7020. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]];
  7021. };
  7022. /**
  7023. * Given the location of the 'middle snake', split the diff in two parts
  7024. * and recurse.
  7025. * @param {string} text1 Old string to be diffed.
  7026. * @param {string} text2 New string to be diffed.
  7027. * @param {number} x Index of split point in text1.
  7028. * @param {number} y Index of split point in text2.
  7029. * @return {Array} Array of diff tuples.
  7030. */
  7031. function diff_bisectSplit_(text1, text2, x, y) {
  7032. var text1a = text1.substring(0, x);
  7033. var text2a = text2.substring(0, y);
  7034. var text1b = text1.substring(x);
  7035. var text2b = text2.substring(y);
  7036. // Compute both diffs serially.
  7037. var diffs = diff_main(text1a, text2a);
  7038. var diffsb = diff_main(text1b, text2b);
  7039. return diffs.concat(diffsb);
  7040. };
  7041. /**
  7042. * Determine the common prefix of two strings.
  7043. * @param {string} text1 First string.
  7044. * @param {string} text2 Second string.
  7045. * @return {number} The number of characters common to the start of each
  7046. * string.
  7047. */
  7048. function diff_commonPrefix(text1, text2) {
  7049. // Quick check for common null cases.
  7050. if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) {
  7051. return 0;
  7052. }
  7053. // Binary search.
  7054. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  7055. var pointermin = 0;
  7056. var pointermax = Math.min(text1.length, text2.length);
  7057. var pointermid = pointermax;
  7058. var pointerstart = 0;
  7059. while (pointermin < pointermid) {
  7060. if (text1.substring(pointerstart, pointermid) ==
  7061. text2.substring(pointerstart, pointermid)) {
  7062. pointermin = pointermid;
  7063. pointerstart = pointermin;
  7064. } else {
  7065. pointermax = pointermid;
  7066. }
  7067. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  7068. }
  7069. return pointermid;
  7070. };
  7071. /**
  7072. * Determine the common suffix of two strings.
  7073. * @param {string} text1 First string.
  7074. * @param {string} text2 Second string.
  7075. * @return {number} The number of characters common to the end of each string.
  7076. */
  7077. function diff_commonSuffix(text1, text2) {
  7078. // Quick check for common null cases.
  7079. if (!text1 || !text2 ||
  7080. text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) {
  7081. return 0;
  7082. }
  7083. // Binary search.
  7084. // Performance analysis: http://neil.fraser.name/news/2007/10/09/
  7085. var pointermin = 0;
  7086. var pointermax = Math.min(text1.length, text2.length);
  7087. var pointermid = pointermax;
  7088. var pointerend = 0;
  7089. while (pointermin < pointermid) {
  7090. if (text1.substring(text1.length - pointermid, text1.length - pointerend) ==
  7091. text2.substring(text2.length - pointermid, text2.length - pointerend)) {
  7092. pointermin = pointermid;
  7093. pointerend = pointermin;
  7094. } else {
  7095. pointermax = pointermid;
  7096. }
  7097. pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin);
  7098. }
  7099. return pointermid;
  7100. };
  7101. /**
  7102. * Do the two texts share a substring which is at least half the length of the
  7103. * longer text?
  7104. * This speedup can produce non-minimal diffs.
  7105. * @param {string} text1 First string.
  7106. * @param {string} text2 Second string.
  7107. * @return {Array.<string>} Five element Array, containing the prefix of
  7108. * text1, the suffix of text1, the prefix of text2, the suffix of
  7109. * text2 and the common middle. Or null if there was no match.
  7110. */
  7111. function diff_halfMatch_(text1, text2) {
  7112. var longtext = text1.length > text2.length ? text1 : text2;
  7113. var shorttext = text1.length > text2.length ? text2 : text1;
  7114. if (longtext.length < 4 || shorttext.length * 2 < longtext.length) {
  7115. return null; // Pointless.
  7116. }
  7117. /**
  7118. * Does a substring of shorttext exist within longtext such that the substring
  7119. * is at least half the length of longtext?
  7120. * Closure, but does not reference any external variables.
  7121. * @param {string} longtext Longer string.
  7122. * @param {string} shorttext Shorter string.
  7123. * @param {number} i Start index of quarter length substring within longtext.
  7124. * @return {Array.<string>} Five element Array, containing the prefix of
  7125. * longtext, the suffix of longtext, the prefix of shorttext, the suffix
  7126. * of shorttext and the common middle. Or null if there was no match.
  7127. * @private
  7128. */
  7129. function diff_halfMatchI_(longtext, shorttext, i) {
  7130. // Start with a 1/4 length substring at position i as a seed.
  7131. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4));
  7132. var j = -1;
  7133. var best_common = '';
  7134. var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b;
  7135. while ((j = shorttext.indexOf(seed, j + 1)) != -1) {
  7136. var prefixLength = diff_commonPrefix(longtext.substring(i),
  7137. shorttext.substring(j));
  7138. var suffixLength = diff_commonSuffix(longtext.substring(0, i),
  7139. shorttext.substring(0, j));
  7140. if (best_common.length < suffixLength + prefixLength) {
  7141. best_common = shorttext.substring(j - suffixLength, j) +
  7142. shorttext.substring(j, j + prefixLength);
  7143. best_longtext_a = longtext.substring(0, i - suffixLength);
  7144. best_longtext_b = longtext.substring(i + prefixLength);
  7145. best_shorttext_a = shorttext.substring(0, j - suffixLength);
  7146. best_shorttext_b = shorttext.substring(j + prefixLength);
  7147. }
  7148. }
  7149. if (best_common.length * 2 >= longtext.length) {
  7150. return [best_longtext_a, best_longtext_b,
  7151. best_shorttext_a, best_shorttext_b, best_common];
  7152. } else {
  7153. return null;
  7154. }
  7155. }
  7156. // First check if the second quarter is the seed for a half-match.
  7157. var hm1 = diff_halfMatchI_(longtext, shorttext,
  7158. Math.ceil(longtext.length / 4));
  7159. // Check again based on the third quarter.
  7160. var hm2 = diff_halfMatchI_(longtext, shorttext,
  7161. Math.ceil(longtext.length / 2));
  7162. var hm;
  7163. if (!hm1 && !hm2) {
  7164. return null;
  7165. } else if (!hm2) {
  7166. hm = hm1;
  7167. } else if (!hm1) {
  7168. hm = hm2;
  7169. } else {
  7170. // Both matched. Select the longest.
  7171. hm = hm1[4].length > hm2[4].length ? hm1 : hm2;
  7172. }
  7173. // A half-match was found, sort out the return data.
  7174. var text1_a, text1_b, text2_a, text2_b;
  7175. if (text1.length > text2.length) {
  7176. text1_a = hm[0];
  7177. text1_b = hm[1];
  7178. text2_a = hm[2];
  7179. text2_b = hm[3];
  7180. } else {
  7181. text2_a = hm[0];
  7182. text2_b = hm[1];
  7183. text1_a = hm[2];
  7184. text1_b = hm[3];
  7185. }
  7186. var mid_common = hm[4];
  7187. return [text1_a, text1_b, text2_a, text2_b, mid_common];
  7188. };
  7189. /**
  7190. * Reorder and merge like edit sections. Merge equalities.
  7191. * Any edit section can move as long as it doesn't cross an equality.
  7192. * @param {Array} diffs Array of diff tuples.
  7193. */
  7194. function diff_cleanupMerge(diffs) {
  7195. diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end.
  7196. var pointer = 0;
  7197. var count_delete = 0;
  7198. var count_insert = 0;
  7199. var text_delete = '';
  7200. var text_insert = '';
  7201. var commonlength;
  7202. while (pointer < diffs.length) {
  7203. switch (diffs[pointer][0]) {
  7204. case DIFF_INSERT:
  7205. count_insert++;
  7206. text_insert += diffs[pointer][1];
  7207. pointer++;
  7208. break;
  7209. case DIFF_DELETE:
  7210. count_delete++;
  7211. text_delete += diffs[pointer][1];
  7212. pointer++;
  7213. break;
  7214. case DIFF_EQUAL:
  7215. // Upon reaching an equality, check for prior redundancies.
  7216. if (count_delete + count_insert > 1) {
  7217. if (count_delete !== 0 && count_insert !== 0) {
  7218. // Factor out any common prefixies.
  7219. commonlength = diff_commonPrefix(text_insert, text_delete);
  7220. if (commonlength !== 0) {
  7221. if ((pointer - count_delete - count_insert) > 0 &&
  7222. diffs[pointer - count_delete - count_insert - 1][0] ==
  7223. DIFF_EQUAL) {
  7224. diffs[pointer - count_delete - count_insert - 1][1] +=
  7225. text_insert.substring(0, commonlength);
  7226. } else {
  7227. diffs.splice(0, 0, [DIFF_EQUAL,
  7228. text_insert.substring(0, commonlength)]);
  7229. pointer++;
  7230. }
  7231. text_insert = text_insert.substring(commonlength);
  7232. text_delete = text_delete.substring(commonlength);
  7233. }
  7234. // Factor out any common suffixies.
  7235. commonlength = diff_commonSuffix(text_insert, text_delete);
  7236. if (commonlength !== 0) {
  7237. diffs[pointer][1] = text_insert.substring(text_insert.length -
  7238. commonlength) + diffs[pointer][1];
  7239. text_insert = text_insert.substring(0, text_insert.length -
  7240. commonlength);
  7241. text_delete = text_delete.substring(0, text_delete.length -
  7242. commonlength);
  7243. }
  7244. }
  7245. // Delete the offending records and add the merged ones.
  7246. if (count_delete === 0) {
  7247. diffs.splice(pointer - count_insert,
  7248. count_delete + count_insert, [DIFF_INSERT, text_insert]);
  7249. } else if (count_insert === 0) {
  7250. diffs.splice(pointer - count_delete,
  7251. count_delete + count_insert, [DIFF_DELETE, text_delete]);
  7252. } else {
  7253. diffs.splice(pointer - count_delete - count_insert,
  7254. count_delete + count_insert, [DIFF_DELETE, text_delete],
  7255. [DIFF_INSERT, text_insert]);
  7256. }
  7257. pointer = pointer - count_delete - count_insert +
  7258. (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1;
  7259. } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) {
  7260. // Merge this equality with the previous one.
  7261. diffs[pointer - 1][1] += diffs[pointer][1];
  7262. diffs.splice(pointer, 1);
  7263. } else {
  7264. pointer++;
  7265. }
  7266. count_insert = 0;
  7267. count_delete = 0;
  7268. text_delete = '';
  7269. text_insert = '';
  7270. break;
  7271. }
  7272. }
  7273. if (diffs[diffs.length - 1][1] === '') {
  7274. diffs.pop(); // Remove the dummy entry at the end.
  7275. }
  7276. // Second pass: look for single edits surrounded on both sides by equalities
  7277. // which can be shifted sideways to eliminate an equality.
  7278. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC
  7279. var changes = false;
  7280. pointer = 1;
  7281. // Intentionally ignore the first and last element (don't need checking).
  7282. while (pointer < diffs.length - 1) {
  7283. if (diffs[pointer - 1][0] == DIFF_EQUAL &&
  7284. diffs[pointer + 1][0] == DIFF_EQUAL) {
  7285. // This is a single edit surrounded by equalities.
  7286. if (diffs[pointer][1].substring(diffs[pointer][1].length -
  7287. diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) {
  7288. // Shift the edit over the previous equality.
  7289. diffs[pointer][1] = diffs[pointer - 1][1] +
  7290. diffs[pointer][1].substring(0, diffs[pointer][1].length -
  7291. diffs[pointer - 1][1].length);
  7292. diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1];
  7293. diffs.splice(pointer - 1, 1);
  7294. changes = true;
  7295. } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) ==
  7296. diffs[pointer + 1][1]) {
  7297. // Shift the edit over the next equality.
  7298. diffs[pointer - 1][1] += diffs[pointer + 1][1];
  7299. diffs[pointer][1] =
  7300. diffs[pointer][1].substring(diffs[pointer + 1][1].length) +
  7301. diffs[pointer + 1][1];
  7302. diffs.splice(pointer + 1, 1);
  7303. changes = true;
  7304. }
  7305. }
  7306. pointer++;
  7307. }
  7308. // If shifts were made, the diff needs reordering and another shift sweep.
  7309. if (changes) {
  7310. diff_cleanupMerge(diffs);
  7311. }
  7312. };
  7313. var diff = diff_main;
  7314. diff.INSERT = DIFF_INSERT;
  7315. diff.DELETE = DIFF_DELETE;
  7316. diff.EQUAL = DIFF_EQUAL;
  7317. module.exports = diff;
  7318. /*
  7319. * Modify a diff such that the cursor position points to the start of a change:
  7320. * E.g.
  7321. * cursor_normalize_diff([[DIFF_EQUAL, 'abc']], 1)
  7322. * => [1, [[DIFF_EQUAL, 'a'], [DIFF_EQUAL, 'bc']]]
  7323. * cursor_normalize_diff([[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xyz']], 2)
  7324. * => [2, [[DIFF_INSERT, 'new'], [DIFF_DELETE, 'xy'], [DIFF_DELETE, 'z']]]
  7325. *
  7326. * @param {Array} diffs Array of diff tuples
  7327. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7328. * @return {Array} A tuple [cursor location in the modified diff, modified diff]
  7329. */
  7330. function cursor_normalize_diff (diffs, cursor_pos) {
  7331. if (cursor_pos === 0) {
  7332. return [DIFF_EQUAL, diffs];
  7333. }
  7334. for (var current_pos = 0, i = 0; i < diffs.length; i++) {
  7335. var d = diffs[i];
  7336. if (d[0] === DIFF_DELETE || d[0] === DIFF_EQUAL) {
  7337. var next_pos = current_pos + d[1].length;
  7338. if (cursor_pos === next_pos) {
  7339. return [i + 1, diffs];
  7340. } else if (cursor_pos < next_pos) {
  7341. // copy to prevent side effects
  7342. diffs = diffs.slice();
  7343. // split d into two diff changes
  7344. var split_pos = cursor_pos - current_pos;
  7345. var d_left = [d[0], d[1].slice(0, split_pos)];
  7346. var d_right = [d[0], d[1].slice(split_pos)];
  7347. diffs.splice(i, 1, d_left, d_right);
  7348. return [i + 1, diffs];
  7349. } else {
  7350. current_pos = next_pos;
  7351. }
  7352. }
  7353. }
  7354. throw new Error('cursor_pos is out of bounds!')
  7355. }
  7356. /*
  7357. * Modify a diff such that the edit position is "shifted" to the proposed edit location (cursor_position).
  7358. *
  7359. * Case 1)
  7360. * Check if a naive shift is possible:
  7361. * [0, X], [ 1, Y] -> [ 1, Y], [0, X] (if X + Y === Y + X)
  7362. * [0, X], [-1, Y] -> [-1, Y], [0, X] (if X + Y === Y + X) - holds same result
  7363. * Case 2)
  7364. * Check if the following shifts are possible:
  7365. * [0, 'pre'], [ 1, 'prefix'] -> [ 1, 'pre'], [0, 'pre'], [ 1, 'fix']
  7366. * [0, 'pre'], [-1, 'prefix'] -> [-1, 'pre'], [0, 'pre'], [-1, 'fix']
  7367. * ^ ^
  7368. * d d_next
  7369. *
  7370. * @param {Array} diffs Array of diff tuples
  7371. * @param {Int} cursor_pos Suggested edit position. Must not be out of bounds!
  7372. * @return {Array} Array of diff tuples
  7373. */
  7374. function fix_cursor (diffs, cursor_pos) {
  7375. var norm = cursor_normalize_diff(diffs, cursor_pos);
  7376. var ndiffs = norm[1];
  7377. var cursor_pointer = norm[0];
  7378. var d = ndiffs[cursor_pointer];
  7379. var d_next = ndiffs[cursor_pointer + 1];
  7380. if (d == null) {
  7381. // Text was deleted from end of original string,
  7382. // cursor is now out of bounds in new string
  7383. return diffs;
  7384. } else if (d[0] !== DIFF_EQUAL) {
  7385. // A modification happened at the cursor location.
  7386. // This is the expected outcome, so we can return the original diff.
  7387. return diffs;
  7388. } else {
  7389. if (d_next != null && d[1] + d_next[1] === d_next[1] + d[1]) {
  7390. // Case 1)
  7391. // It is possible to perform a naive shift
  7392. ndiffs.splice(cursor_pointer, 2, d_next, d)
  7393. return merge_tuples(ndiffs, cursor_pointer, 2)
  7394. } else if (d_next != null && d_next[1].indexOf(d[1]) === 0) {
  7395. // Case 2)
  7396. // d[1] is a prefix of d_next[1]
  7397. // We can assume that d_next[0] !== 0, since d[0] === 0
  7398. // Shift edit locations..
  7399. ndiffs.splice(cursor_pointer, 2, [d_next[0], d[1]], [0, d[1]]);
  7400. var suffix = d_next[1].slice(d[1].length);
  7401. if (suffix.length > 0) {
  7402. ndiffs.splice(cursor_pointer + 2, 0, [d_next[0], suffix]);
  7403. }
  7404. return merge_tuples(ndiffs, cursor_pointer, 3)
  7405. } else {
  7406. // Not possible to perform any modification
  7407. return diffs;
  7408. }
  7409. }
  7410. }
  7411. /*
  7412. * Check diff did not split surrogate pairs.
  7413. * Ex. [0, '\uD83D'], [-1, '\uDC36'], [1, '\uDC2F'] -> [-1, '\uD83D\uDC36'], [1, '\uD83D\uDC2F']
  7414. * '\uD83D\uDC36' === '🐶', '\uD83D\uDC2F' === '🐯'
  7415. *
  7416. * @param {Array} diffs Array of diff tuples
  7417. * @return {Array} Array of diff tuples
  7418. */
  7419. function fix_emoji (diffs) {
  7420. var compact = false;
  7421. var starts_with_pair_end = function(str) {
  7422. return str.charCodeAt(0) >= 0xDC00 && str.charCodeAt(0) <= 0xDFFF;
  7423. }
  7424. var ends_with_pair_start = function(str) {
  7425. return str.charCodeAt(str.length-1) >= 0xD800 && str.charCodeAt(str.length-1) <= 0xDBFF;
  7426. }
  7427. for (var i = 2; i < diffs.length; i += 1) {
  7428. if (diffs[i-2][0] === DIFF_EQUAL && ends_with_pair_start(diffs[i-2][1]) &&
  7429. diffs[i-1][0] === DIFF_DELETE && starts_with_pair_end(diffs[i-1][1]) &&
  7430. diffs[i][0] === DIFF_INSERT && starts_with_pair_end(diffs[i][1])) {
  7431. compact = true;
  7432. diffs[i-1][1] = diffs[i-2][1].slice(-1) + diffs[i-1][1];
  7433. diffs[i][1] = diffs[i-2][1].slice(-1) + diffs[i][1];
  7434. diffs[i-2][1] = diffs[i-2][1].slice(0, -1);
  7435. }
  7436. }
  7437. if (!compact) {
  7438. return diffs;
  7439. }
  7440. var fixed_diffs = [];
  7441. for (var i = 0; i < diffs.length; i += 1) {
  7442. if (diffs[i][1].length > 0) {
  7443. fixed_diffs.push(diffs[i]);
  7444. }
  7445. }
  7446. return fixed_diffs;
  7447. }
  7448. /*
  7449. * Try to merge tuples with their neigbors in a given range.
  7450. * E.g. [0, 'a'], [0, 'b'] -> [0, 'ab']
  7451. *
  7452. * @param {Array} diffs Array of diff tuples.
  7453. * @param {Int} start Position of the first element to merge (diffs[start] is also merged with diffs[start - 1]).
  7454. * @param {Int} length Number of consecutive elements to check.
  7455. * @return {Array} Array of merged diff tuples.
  7456. */
  7457. function merge_tuples (diffs, start, length) {
  7458. // Check from (start-1) to (start+length).
  7459. for (var i = start + length - 1; i >= 0 && i >= start - 1; i--) {
  7460. if (i + 1 < diffs.length) {
  7461. var left_d = diffs[i];
  7462. var right_d = diffs[i+1];
  7463. if (left_d[0] === right_d[1]) {
  7464. diffs.splice(i, 2, [left_d[0], left_d[1] + right_d[1]]);
  7465. }
  7466. }
  7467. }
  7468. return diffs;
  7469. }
  7470. /***/ }),
  7471. /* 52 */
  7472. /***/ (function(module, exports) {
  7473. exports = module.exports = typeof Object.keys === 'function'
  7474. ? Object.keys : shim;
  7475. exports.shim = shim;
  7476. function shim (obj) {
  7477. var keys = [];
  7478. for (var key in obj) keys.push(key);
  7479. return keys;
  7480. }
  7481. /***/ }),
  7482. /* 53 */
  7483. /***/ (function(module, exports) {
  7484. var supportsArgumentsClass = (function(){
  7485. return Object.prototype.toString.call(arguments)
  7486. })() == '[object Arguments]';
  7487. exports = module.exports = supportsArgumentsClass ? supported : unsupported;
  7488. exports.supported = supported;
  7489. function supported(object) {
  7490. return Object.prototype.toString.call(object) == '[object Arguments]';
  7491. };
  7492. exports.unsupported = unsupported;
  7493. function unsupported(object){
  7494. return object &&
  7495. typeof object == 'object' &&
  7496. typeof object.length == 'number' &&
  7497. Object.prototype.hasOwnProperty.call(object, 'callee') &&
  7498. !Object.prototype.propertyIsEnumerable.call(object, 'callee') ||
  7499. false;
  7500. };
  7501. /***/ }),
  7502. /* 54 */
  7503. /***/ (function(module, exports) {
  7504. 'use strict';
  7505. var has = Object.prototype.hasOwnProperty
  7506. , prefix = '~';
  7507. /**
  7508. * Constructor to create a storage for our `EE` objects.
  7509. * An `Events` instance is a plain object whose properties are event names.
  7510. *
  7511. * @constructor
  7512. * @api private
  7513. */
  7514. function Events() {}
  7515. //
  7516. // We try to not inherit from `Object.prototype`. In some engines creating an
  7517. // instance in this way is faster than calling `Object.create(null)` directly.
  7518. // If `Object.create(null)` is not supported we prefix the event names with a
  7519. // character to make sure that the built-in object properties are not
  7520. // overridden or used as an attack vector.
  7521. //
  7522. if (Object.create) {
  7523. Events.prototype = Object.create(null);
  7524. //
  7525. // This hack is needed because the `__proto__` property is still inherited in
  7526. // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5.
  7527. //
  7528. if (!new Events().__proto__) prefix = false;
  7529. }
  7530. /**
  7531. * Representation of a single event listener.
  7532. *
  7533. * @param {Function} fn The listener function.
  7534. * @param {Mixed} context The context to invoke the listener with.
  7535. * @param {Boolean} [once=false] Specify if the listener is a one-time listener.
  7536. * @constructor
  7537. * @api private
  7538. */
  7539. function EE(fn, context, once) {
  7540. this.fn = fn;
  7541. this.context = context;
  7542. this.once = once || false;
  7543. }
  7544. /**
  7545. * Minimal `EventEmitter` interface that is molded against the Node.js
  7546. * `EventEmitter` interface.
  7547. *
  7548. * @constructor
  7549. * @api public
  7550. */
  7551. function EventEmitter() {
  7552. this._events = new Events();
  7553. this._eventsCount = 0;
  7554. }
  7555. /**
  7556. * Return an array listing the events for which the emitter has registered
  7557. * listeners.
  7558. *
  7559. * @returns {Array}
  7560. * @api public
  7561. */
  7562. EventEmitter.prototype.eventNames = function eventNames() {
  7563. var names = []
  7564. , events
  7565. , name;
  7566. if (this._eventsCount === 0) return names;
  7567. for (name in (events = this._events)) {
  7568. if (has.call(events, name)) names.push(prefix ? name.slice(1) : name);
  7569. }
  7570. if (Object.getOwnPropertySymbols) {
  7571. return names.concat(Object.getOwnPropertySymbols(events));
  7572. }
  7573. return names;
  7574. };
  7575. /**
  7576. * Return the listeners registered for a given event.
  7577. *
  7578. * @param {String|Symbol} event The event name.
  7579. * @param {Boolean} exists Only check if there are listeners.
  7580. * @returns {Array|Boolean}
  7581. * @api public
  7582. */
  7583. EventEmitter.prototype.listeners = function listeners(event, exists) {
  7584. var evt = prefix ? prefix + event : event
  7585. , available = this._events[evt];
  7586. if (exists) return !!available;
  7587. if (!available) return [];
  7588. if (available.fn) return [available.fn];
  7589. for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) {
  7590. ee[i] = available[i].fn;
  7591. }
  7592. return ee;
  7593. };
  7594. /**
  7595. * Calls each of the listeners registered for a given event.
  7596. *
  7597. * @param {String|Symbol} event The event name.
  7598. * @returns {Boolean} `true` if the event had listeners, else `false`.
  7599. * @api public
  7600. */
  7601. EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
  7602. var evt = prefix ? prefix + event : event;
  7603. if (!this._events[evt]) return false;
  7604. var listeners = this._events[evt]
  7605. , len = arguments.length
  7606. , args
  7607. , i;
  7608. if (listeners.fn) {
  7609. if (listeners.once) this.removeListener(event, listeners.fn, undefined, true);
  7610. switch (len) {
  7611. case 1: return listeners.fn.call(listeners.context), true;
  7612. case 2: return listeners.fn.call(listeners.context, a1), true;
  7613. case 3: return listeners.fn.call(listeners.context, a1, a2), true;
  7614. case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true;
  7615. case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
  7616. case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
  7617. }
  7618. for (i = 1, args = new Array(len -1); i < len; i++) {
  7619. args[i - 1] = arguments[i];
  7620. }
  7621. listeners.fn.apply(listeners.context, args);
  7622. } else {
  7623. var length = listeners.length
  7624. , j;
  7625. for (i = 0; i < length; i++) {
  7626. if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true);
  7627. switch (len) {
  7628. case 1: listeners[i].fn.call(listeners[i].context); break;
  7629. case 2: listeners[i].fn.call(listeners[i].context, a1); break;
  7630. case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break;
  7631. case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break;
  7632. default:
  7633. if (!args) for (j = 1, args = new Array(len -1); j < len; j++) {
  7634. args[j - 1] = arguments[j];
  7635. }
  7636. listeners[i].fn.apply(listeners[i].context, args);
  7637. }
  7638. }
  7639. }
  7640. return true;
  7641. };
  7642. /**
  7643. * Add a listener for a given event.
  7644. *
  7645. * @param {String|Symbol} event The event name.
  7646. * @param {Function} fn The listener function.
  7647. * @param {Mixed} [context=this] The context to invoke the listener with.
  7648. * @returns {EventEmitter} `this`.
  7649. * @api public
  7650. */
  7651. EventEmitter.prototype.on = function on(event, fn, context) {
  7652. var listener = new EE(fn, context || this)
  7653. , evt = prefix ? prefix + event : event;
  7654. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  7655. else if (!this._events[evt].fn) this._events[evt].push(listener);
  7656. else this._events[evt] = [this._events[evt], listener];
  7657. return this;
  7658. };
  7659. /**
  7660. * Add a one-time listener for a given event.
  7661. *
  7662. * @param {String|Symbol} event The event name.
  7663. * @param {Function} fn The listener function.
  7664. * @param {Mixed} [context=this] The context to invoke the listener with.
  7665. * @returns {EventEmitter} `this`.
  7666. * @api public
  7667. */
  7668. EventEmitter.prototype.once = function once(event, fn, context) {
  7669. var listener = new EE(fn, context || this, true)
  7670. , evt = prefix ? prefix + event : event;
  7671. if (!this._events[evt]) this._events[evt] = listener, this._eventsCount++;
  7672. else if (!this._events[evt].fn) this._events[evt].push(listener);
  7673. else this._events[evt] = [this._events[evt], listener];
  7674. return this;
  7675. };
  7676. /**
  7677. * Remove the listeners of a given event.
  7678. *
  7679. * @param {String|Symbol} event The event name.
  7680. * @param {Function} fn Only remove the listeners that match this function.
  7681. * @param {Mixed} context Only remove the listeners that have this context.
  7682. * @param {Boolean} once Only remove one-time listeners.
  7683. * @returns {EventEmitter} `this`.
  7684. * @api public
  7685. */
  7686. EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) {
  7687. var evt = prefix ? prefix + event : event;
  7688. if (!this._events[evt]) return this;
  7689. if (!fn) {
  7690. if (--this._eventsCount === 0) this._events = new Events();
  7691. else delete this._events[evt];
  7692. return this;
  7693. }
  7694. var listeners = this._events[evt];
  7695. if (listeners.fn) {
  7696. if (
  7697. listeners.fn === fn
  7698. && (!once || listeners.once)
  7699. && (!context || listeners.context === context)
  7700. ) {
  7701. if (--this._eventsCount === 0) this._events = new Events();
  7702. else delete this._events[evt];
  7703. }
  7704. } else {
  7705. for (var i = 0, events = [], length = listeners.length; i < length; i++) {
  7706. if (
  7707. listeners[i].fn !== fn
  7708. || (once && !listeners[i].once)
  7709. || (context && listeners[i].context !== context)
  7710. ) {
  7711. events.push(listeners[i]);
  7712. }
  7713. }
  7714. //
  7715. // Reset the array, or remove it completely if we have no more listeners.
  7716. //
  7717. if (events.length) this._events[evt] = events.length === 1 ? events[0] : events;
  7718. else if (--this._eventsCount === 0) this._events = new Events();
  7719. else delete this._events[evt];
  7720. }
  7721. return this;
  7722. };
  7723. /**
  7724. * Remove all listeners, or those of the specified event.
  7725. *
  7726. * @param {String|Symbol} [event] The event name.
  7727. * @returns {EventEmitter} `this`.
  7728. * @api public
  7729. */
  7730. EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) {
  7731. var evt;
  7732. if (event) {
  7733. evt = prefix ? prefix + event : event;
  7734. if (this._events[evt]) {
  7735. if (--this._eventsCount === 0) this._events = new Events();
  7736. else delete this._events[evt];
  7737. }
  7738. } else {
  7739. this._events = new Events();
  7740. this._eventsCount = 0;
  7741. }
  7742. return this;
  7743. };
  7744. //
  7745. // Alias methods names because people roll like that.
  7746. //
  7747. EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
  7748. EventEmitter.prototype.addListener = EventEmitter.prototype.on;
  7749. //
  7750. // This function doesn't apply anymore.
  7751. //
  7752. EventEmitter.prototype.setMaxListeners = function setMaxListeners() {
  7753. return this;
  7754. };
  7755. //
  7756. // Expose the prefix.
  7757. //
  7758. EventEmitter.prefixed = prefix;
  7759. //
  7760. // Allow `EventEmitter` to be imported as module namespace.
  7761. //
  7762. EventEmitter.EventEmitter = EventEmitter;
  7763. //
  7764. // Expose the module.
  7765. //
  7766. if ('undefined' !== typeof module) {
  7767. module.exports = EventEmitter;
  7768. }
  7769. /***/ }),
  7770. /* 55 */
  7771. /***/ (function(module, exports, __webpack_require__) {
  7772. "use strict";
  7773. Object.defineProperty(exports, "__esModule", {
  7774. value: true
  7775. });
  7776. exports.matchText = exports.matchSpacing = exports.matchNewline = exports.matchBlot = exports.matchAttributor = exports.default = undefined;
  7777. var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
  7778. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  7779. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  7780. var _extend2 = __webpack_require__(3);
  7781. var _extend3 = _interopRequireDefault(_extend2);
  7782. var _quillDelta = __webpack_require__(2);
  7783. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  7784. var _parchment = __webpack_require__(0);
  7785. var _parchment2 = _interopRequireDefault(_parchment);
  7786. var _quill = __webpack_require__(5);
  7787. var _quill2 = _interopRequireDefault(_quill);
  7788. var _logger = __webpack_require__(10);
  7789. var _logger2 = _interopRequireDefault(_logger);
  7790. var _module = __webpack_require__(9);
  7791. var _module2 = _interopRequireDefault(_module);
  7792. var _align = __webpack_require__(36);
  7793. var _background = __webpack_require__(37);
  7794. var _code = __webpack_require__(13);
  7795. var _code2 = _interopRequireDefault(_code);
  7796. var _color = __webpack_require__(26);
  7797. var _direction = __webpack_require__(38);
  7798. var _font = __webpack_require__(39);
  7799. var _size = __webpack_require__(40);
  7800. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  7801. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  7802. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  7803. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  7804. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  7805. var debug = (0, _logger2.default)('quill:clipboard');
  7806. var DOM_KEY = '__ql-matcher';
  7807. var CLIPBOARD_CONFIG = [[Node.TEXT_NODE, matchText], [Node.TEXT_NODE, matchNewline], ['br', matchBreak], [Node.ELEMENT_NODE, matchNewline], [Node.ELEMENT_NODE, matchBlot], [Node.ELEMENT_NODE, matchSpacing], [Node.ELEMENT_NODE, matchAttributor], [Node.ELEMENT_NODE, matchStyles], ['li', matchIndent], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['style', matchIgnore]];
  7808. var ATTRIBUTE_ATTRIBUTORS = [_align.AlignAttribute, _direction.DirectionAttribute].reduce(function (memo, attr) {
  7809. memo[attr.keyName] = attr;
  7810. return memo;
  7811. }, {});
  7812. var STYLE_ATTRIBUTORS = [_align.AlignStyle, _background.BackgroundStyle, _color.ColorStyle, _direction.DirectionStyle, _font.FontStyle, _size.SizeStyle].reduce(function (memo, attr) {
  7813. memo[attr.keyName] = attr;
  7814. return memo;
  7815. }, {});
  7816. var Clipboard = function (_Module) {
  7817. _inherits(Clipboard, _Module);
  7818. function Clipboard(quill, options) {
  7819. _classCallCheck(this, Clipboard);
  7820. var _this = _possibleConstructorReturn(this, (Clipboard.__proto__ || Object.getPrototypeOf(Clipboard)).call(this, quill, options));
  7821. _this.quill.root.addEventListener('paste', _this.onPaste.bind(_this));
  7822. _this.container = _this.quill.addContainer('ql-clipboard');
  7823. _this.container.setAttribute('contenteditable', true);
  7824. _this.container.setAttribute('tabindex', -1);
  7825. _this.matchers = [];
  7826. CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) {
  7827. var _ref2 = _slicedToArray(_ref, 2),
  7828. selector = _ref2[0],
  7829. matcher = _ref2[1];
  7830. if (!options.matchVisual && matcher === matchSpacing) return;
  7831. _this.addMatcher(selector, matcher);
  7832. });
  7833. return _this;
  7834. }
  7835. _createClass(Clipboard, [{
  7836. key: 'addMatcher',
  7837. value: function addMatcher(selector, matcher) {
  7838. this.matchers.push([selector, matcher]);
  7839. }
  7840. }, {
  7841. key: 'convert',
  7842. value: function convert(html) {
  7843. if (typeof html === 'string') {
  7844. this.container.innerHTML = html.replace(/\>\r?\n +\</g, '><'); // Remove spaces between tags
  7845. return this.convert();
  7846. }
  7847. var formats = this.quill.getFormat(this.quill.selection.savedRange.index);
  7848. if (formats[_code2.default.blotName]) {
  7849. var text = this.container.innerText;
  7850. this.container.innerHTML = '';
  7851. return new _quillDelta2.default().insert(text, _defineProperty({}, _code2.default.blotName, formats[_code2.default.blotName]));
  7852. }
  7853. var _prepareMatching = this.prepareMatching(),
  7854. _prepareMatching2 = _slicedToArray(_prepareMatching, 2),
  7855. elementMatchers = _prepareMatching2[0],
  7856. textMatchers = _prepareMatching2[1];
  7857. var delta = traverse(this.container, elementMatchers, textMatchers);
  7858. // Remove trailing newline
  7859. if (deltaEndsWith(delta, '\n') && delta.ops[delta.ops.length - 1].attributes == null) {
  7860. delta = delta.compose(new _quillDelta2.default().retain(delta.length() - 1).delete(1));
  7861. }
  7862. debug.log('convert', this.container.innerHTML, delta);
  7863. this.container.innerHTML = '';
  7864. return delta;
  7865. }
  7866. }, {
  7867. key: 'dangerouslyPasteHTML',
  7868. value: function dangerouslyPasteHTML(index, html) {
  7869. var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _quill2.default.sources.API;
  7870. if (typeof index === 'string') {
  7871. this.quill.setContents(this.convert(index), html);
  7872. this.quill.setSelection(0, _quill2.default.sources.SILENT);
  7873. } else {
  7874. var paste = this.convert(html);
  7875. this.quill.updateContents(new _quillDelta2.default().retain(index).concat(paste), source);
  7876. this.quill.setSelection(index + paste.length(), _quill2.default.sources.SILENT);
  7877. }
  7878. }
  7879. }, {
  7880. key: 'onPaste',
  7881. value: function onPaste(e) {
  7882. var _this2 = this;
  7883. if (e.defaultPrevented || !this.quill.isEnabled()) return;
  7884. var range = this.quill.getSelection();
  7885. var delta = new _quillDelta2.default().retain(range.index);
  7886. var scrollTop = this.quill.scrollingContainer.scrollTop;
  7887. this.container.focus();
  7888. this.quill.selection.update(_quill2.default.sources.SILENT);
  7889. setTimeout(function () {
  7890. delta = delta.concat(_this2.convert()).delete(range.length);
  7891. _this2.quill.updateContents(delta, _quill2.default.sources.USER);
  7892. // range.length contributes to delta.length()
  7893. _this2.quill.setSelection(delta.length() - range.length, _quill2.default.sources.SILENT);
  7894. _this2.quill.scrollingContainer.scrollTop = scrollTop;
  7895. _this2.quill.focus();
  7896. }, 1);
  7897. }
  7898. }, {
  7899. key: 'prepareMatching',
  7900. value: function prepareMatching() {
  7901. var _this3 = this;
  7902. var elementMatchers = [],
  7903. textMatchers = [];
  7904. this.matchers.forEach(function (pair) {
  7905. var _pair = _slicedToArray(pair, 2),
  7906. selector = _pair[0],
  7907. matcher = _pair[1];
  7908. switch (selector) {
  7909. case Node.TEXT_NODE:
  7910. textMatchers.push(matcher);
  7911. break;
  7912. case Node.ELEMENT_NODE:
  7913. elementMatchers.push(matcher);
  7914. break;
  7915. default:
  7916. [].forEach.call(_this3.container.querySelectorAll(selector), function (node) {
  7917. // TODO use weakmap
  7918. node[DOM_KEY] = node[DOM_KEY] || [];
  7919. node[DOM_KEY].push(matcher);
  7920. });
  7921. break;
  7922. }
  7923. });
  7924. return [elementMatchers, textMatchers];
  7925. }
  7926. }]);
  7927. return Clipboard;
  7928. }(_module2.default);
  7929. Clipboard.DEFAULTS = {
  7930. matchers: [],
  7931. matchVisual: true
  7932. };
  7933. function applyFormat(delta, format, value) {
  7934. if ((typeof format === 'undefined' ? 'undefined' : _typeof(format)) === 'object') {
  7935. return Object.keys(format).reduce(function (delta, key) {
  7936. return applyFormat(delta, key, format[key]);
  7937. }, delta);
  7938. } else {
  7939. return delta.reduce(function (delta, op) {
  7940. if (op.attributes && op.attributes[format]) {
  7941. return delta.push(op);
  7942. } else {
  7943. return delta.insert(op.insert, (0, _extend3.default)({}, _defineProperty({}, format, value), op.attributes));
  7944. }
  7945. }, new _quillDelta2.default());
  7946. }
  7947. }
  7948. function computeStyle(node) {
  7949. if (node.nodeType !== Node.ELEMENT_NODE) return {};
  7950. var DOM_KEY = '__ql-computed-style';
  7951. return node[DOM_KEY] || (node[DOM_KEY] = window.getComputedStyle(node));
  7952. }
  7953. function deltaEndsWith(delta, text) {
  7954. var endText = "";
  7955. for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i) {
  7956. var op = delta.ops[i];
  7957. if (typeof op.insert !== 'string') break;
  7958. endText = op.insert + endText;
  7959. }
  7960. return endText.slice(-1 * text.length) === text;
  7961. }
  7962. function isLine(node) {
  7963. if (node.childNodes.length === 0) return false; // Exclude embed blocks
  7964. var style = computeStyle(node);
  7965. return ['block', 'list-item'].indexOf(style.display) > -1;
  7966. }
  7967. function traverse(node, elementMatchers, textMatchers) {
  7968. // Post-order
  7969. if (node.nodeType === node.TEXT_NODE) {
  7970. return textMatchers.reduce(function (delta, matcher) {
  7971. return matcher(node, delta);
  7972. }, new _quillDelta2.default());
  7973. } else if (node.nodeType === node.ELEMENT_NODE) {
  7974. return [].reduce.call(node.childNodes || [], function (delta, childNode) {
  7975. var childrenDelta = traverse(childNode, elementMatchers, textMatchers);
  7976. if (childNode.nodeType === node.ELEMENT_NODE) {
  7977. childrenDelta = elementMatchers.reduce(function (childrenDelta, matcher) {
  7978. return matcher(childNode, childrenDelta);
  7979. }, childrenDelta);
  7980. childrenDelta = (childNode[DOM_KEY] || []).reduce(function (childrenDelta, matcher) {
  7981. return matcher(childNode, childrenDelta);
  7982. }, childrenDelta);
  7983. }
  7984. return delta.concat(childrenDelta);
  7985. }, new _quillDelta2.default());
  7986. } else {
  7987. return new _quillDelta2.default();
  7988. }
  7989. }
  7990. function matchAlias(format, node, delta) {
  7991. return applyFormat(delta, format, true);
  7992. }
  7993. function matchAttributor(node, delta) {
  7994. var attributes = _parchment2.default.Attributor.Attribute.keys(node);
  7995. var classes = _parchment2.default.Attributor.Class.keys(node);
  7996. var styles = _parchment2.default.Attributor.Style.keys(node);
  7997. var formats = {};
  7998. attributes.concat(classes).concat(styles).forEach(function (name) {
  7999. var attr = _parchment2.default.query(name, _parchment2.default.Scope.ATTRIBUTE);
  8000. if (attr != null) {
  8001. formats[attr.attrName] = attr.value(node);
  8002. if (formats[attr.attrName]) return;
  8003. }
  8004. attr = ATTRIBUTE_ATTRIBUTORS[name];
  8005. if (attr != null && (attr.attrName === name || attr.keyName === name)) {
  8006. formats[attr.attrName] = attr.value(node) || undefined;
  8007. }
  8008. attr = STYLE_ATTRIBUTORS[name];
  8009. if (attr != null && (attr.attrName === name || attr.keyName === name)) {
  8010. attr = STYLE_ATTRIBUTORS[name];
  8011. formats[attr.attrName] = attr.value(node) || undefined;
  8012. }
  8013. });
  8014. if (Object.keys(formats).length > 0) {
  8015. delta = applyFormat(delta, formats);
  8016. }
  8017. return delta;
  8018. }
  8019. function matchBlot(node, delta) {
  8020. var match = _parchment2.default.query(node);
  8021. if (match == null) return delta;
  8022. if (match.prototype instanceof _parchment2.default.Embed) {
  8023. var embed = {};
  8024. var value = match.value(node);
  8025. if (value != null) {
  8026. embed[match.blotName] = value;
  8027. delta = new _quillDelta2.default().insert(embed, match.formats(node));
  8028. }
  8029. } else if (typeof match.formats === 'function') {
  8030. delta = applyFormat(delta, match.blotName, match.formats(node));
  8031. }
  8032. return delta;
  8033. }
  8034. function matchBreak(node, delta) {
  8035. if (!deltaEndsWith(delta, '\n')) {
  8036. delta.insert('\n');
  8037. }
  8038. return delta;
  8039. }
  8040. function matchIgnore() {
  8041. return new _quillDelta2.default();
  8042. }
  8043. function matchIndent(node, delta) {
  8044. var match = _parchment2.default.query(node);
  8045. if (match == null || match.blotName !== 'list-item' || !deltaEndsWith(delta, '\n')) {
  8046. return delta;
  8047. }
  8048. var indent = -1,
  8049. parent = node.parentNode;
  8050. while (!parent.classList.contains('ql-clipboard')) {
  8051. if ((_parchment2.default.query(parent) || {}).blotName === 'list') {
  8052. indent += 1;
  8053. }
  8054. parent = parent.parentNode;
  8055. }
  8056. if (indent <= 0) return delta;
  8057. return delta.compose(new _quillDelta2.default().retain(delta.length() - 1).retain(1, { indent: indent }));
  8058. }
  8059. function matchNewline(node, delta) {
  8060. if (!deltaEndsWith(delta, '\n')) {
  8061. if (isLine(node) || delta.length() > 0 && node.nextSibling && isLine(node.nextSibling)) {
  8062. delta.insert('\n');
  8063. }
  8064. }
  8065. return delta;
  8066. }
  8067. function matchSpacing(node, delta) {
  8068. if (isLine(node) && node.nextElementSibling != null && !deltaEndsWith(delta, '\n\n')) {
  8069. var nodeHeight = node.offsetHeight + parseFloat(computeStyle(node).marginTop) + parseFloat(computeStyle(node).marginBottom);
  8070. if (node.nextElementSibling.offsetTop > node.offsetTop + nodeHeight * 1.5) {
  8071. delta.insert('\n');
  8072. }
  8073. }
  8074. return delta;
  8075. }
  8076. function matchStyles(node, delta) {
  8077. var formats = {};
  8078. var style = node.style || {};
  8079. if (style.fontStyle && computeStyle(node).fontStyle === 'italic') {
  8080. formats.italic = true;
  8081. }
  8082. if (style.fontWeight && (computeStyle(node).fontWeight.startsWith('bold') || parseInt(computeStyle(node).fontWeight) >= 700)) {
  8083. formats.bold = true;
  8084. }
  8085. if (Object.keys(formats).length > 0) {
  8086. delta = applyFormat(delta, formats);
  8087. }
  8088. if (parseFloat(style.textIndent || 0) > 0) {
  8089. // Could be 0.5in
  8090. delta = new _quillDelta2.default().insert('\t').concat(delta);
  8091. }
  8092. return delta;
  8093. }
  8094. function matchText(node, delta) {
  8095. var text = node.data;
  8096. // Word represents empty line with <o:p>&nbsp;</o:p>
  8097. if (node.parentNode.tagName === 'O:P') {
  8098. return delta.insert(text.trim());
  8099. }
  8100. if (text.trim().length === 0 && node.parentNode.classList.contains('ql-clipboard')) {
  8101. return delta;
  8102. }
  8103. if (!computeStyle(node.parentNode).whiteSpace.startsWith('pre')) {
  8104. // eslint-disable-next-line func-style
  8105. var replacer = function replacer(collapse, match) {
  8106. match = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp;
  8107. return match.length < 1 && collapse ? ' ' : match;
  8108. };
  8109. text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' ');
  8110. text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace
  8111. if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) {
  8112. text = text.replace(/^\s+/, replacer.bind(replacer, false));
  8113. }
  8114. if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) {
  8115. text = text.replace(/\s+$/, replacer.bind(replacer, false));
  8116. }
  8117. }
  8118. return delta.insert(text);
  8119. }
  8120. exports.default = Clipboard;
  8121. exports.matchAttributor = matchAttributor;
  8122. exports.matchBlot = matchBlot;
  8123. exports.matchNewline = matchNewline;
  8124. exports.matchSpacing = matchSpacing;
  8125. exports.matchText = matchText;
  8126. /***/ }),
  8127. /* 56 */
  8128. /***/ (function(module, exports, __webpack_require__) {
  8129. "use strict";
  8130. Object.defineProperty(exports, "__esModule", {
  8131. value: true
  8132. });
  8133. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8134. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8135. var _inline = __webpack_require__(6);
  8136. var _inline2 = _interopRequireDefault(_inline);
  8137. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8138. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8139. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8140. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8141. var Bold = function (_Inline) {
  8142. _inherits(Bold, _Inline);
  8143. function Bold() {
  8144. _classCallCheck(this, Bold);
  8145. return _possibleConstructorReturn(this, (Bold.__proto__ || Object.getPrototypeOf(Bold)).apply(this, arguments));
  8146. }
  8147. _createClass(Bold, [{
  8148. key: 'optimize',
  8149. value: function optimize(context) {
  8150. _get(Bold.prototype.__proto__ || Object.getPrototypeOf(Bold.prototype), 'optimize', this).call(this, context);
  8151. if (this.domNode.tagName !== this.statics.tagName[0]) {
  8152. this.replaceWith(this.statics.blotName);
  8153. }
  8154. }
  8155. }], [{
  8156. key: 'create',
  8157. value: function create() {
  8158. return _get(Bold.__proto__ || Object.getPrototypeOf(Bold), 'create', this).call(this);
  8159. }
  8160. }, {
  8161. key: 'formats',
  8162. value: function formats() {
  8163. return true;
  8164. }
  8165. }]);
  8166. return Bold;
  8167. }(_inline2.default);
  8168. Bold.blotName = 'bold';
  8169. Bold.tagName = ['STRONG', 'B'];
  8170. exports.default = Bold;
  8171. /***/ }),
  8172. /* 57 */
  8173. /***/ (function(module, exports, __webpack_require__) {
  8174. "use strict";
  8175. Object.defineProperty(exports, "__esModule", {
  8176. value: true
  8177. });
  8178. exports.addControls = exports.default = undefined;
  8179. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8180. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8181. var _quillDelta = __webpack_require__(2);
  8182. var _quillDelta2 = _interopRequireDefault(_quillDelta);
  8183. var _parchment = __webpack_require__(0);
  8184. var _parchment2 = _interopRequireDefault(_parchment);
  8185. var _quill = __webpack_require__(5);
  8186. var _quill2 = _interopRequireDefault(_quill);
  8187. var _logger = __webpack_require__(10);
  8188. var _logger2 = _interopRequireDefault(_logger);
  8189. var _module = __webpack_require__(9);
  8190. var _module2 = _interopRequireDefault(_module);
  8191. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8192. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  8193. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8194. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8195. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8196. var debug = (0, _logger2.default)('quill:toolbar');
  8197. var Toolbar = function (_Module) {
  8198. _inherits(Toolbar, _Module);
  8199. function Toolbar(quill, options) {
  8200. _classCallCheck(this, Toolbar);
  8201. var _this = _possibleConstructorReturn(this, (Toolbar.__proto__ || Object.getPrototypeOf(Toolbar)).call(this, quill, options));
  8202. if (Array.isArray(_this.options.container)) {
  8203. var container = document.createElement('div');
  8204. addControls(container, _this.options.container);
  8205. quill.container.parentNode.insertBefore(container, quill.container);
  8206. _this.container = container;
  8207. } else if (typeof _this.options.container === 'string') {
  8208. _this.container = document.querySelector(_this.options.container);
  8209. } else {
  8210. _this.container = _this.options.container;
  8211. }
  8212. if (!(_this.container instanceof HTMLElement)) {
  8213. var _ret;
  8214. return _ret = debug.error('Container required for toolbar', _this.options), _possibleConstructorReturn(_this, _ret);
  8215. }
  8216. _this.container.classList.add('ql-toolbar');
  8217. _this.controls = [];
  8218. _this.handlers = {};
  8219. Object.keys(_this.options.handlers).forEach(function (format) {
  8220. _this.addHandler(format, _this.options.handlers[format]);
  8221. });
  8222. [].forEach.call(_this.container.querySelectorAll('button, select'), function (input) {
  8223. _this.attach(input);
  8224. });
  8225. _this.quill.on(_quill2.default.events.EDITOR_CHANGE, function (type, range) {
  8226. if (type === _quill2.default.events.SELECTION_CHANGE) {
  8227. _this.update(range);
  8228. }
  8229. });
  8230. _this.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  8231. var _this$quill$selection = _this.quill.selection.getRange(),
  8232. _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1),
  8233. range = _this$quill$selection2[0]; // quill.getSelection triggers update
  8234. _this.update(range);
  8235. });
  8236. return _this;
  8237. }
  8238. _createClass(Toolbar, [{
  8239. key: 'addHandler',
  8240. value: function addHandler(format, handler) {
  8241. this.handlers[format] = handler;
  8242. }
  8243. }, {
  8244. key: 'attach',
  8245. value: function attach(input) {
  8246. var _this2 = this;
  8247. var format = [].find.call(input.classList, function (className) {
  8248. return className.indexOf('ql-') === 0;
  8249. });
  8250. if (!format) return;
  8251. format = format.slice('ql-'.length);
  8252. if (input.tagName === 'BUTTON') {
  8253. input.setAttribute('type', 'button');
  8254. }
  8255. if (this.handlers[format] == null) {
  8256. if (this.quill.scroll.whitelist != null && this.quill.scroll.whitelist[format] == null) {
  8257. debug.warn('ignoring attaching to disabled format', format, input);
  8258. return;
  8259. }
  8260. if (_parchment2.default.query(format) == null) {
  8261. debug.warn('ignoring attaching to nonexistent format', format, input);
  8262. return;
  8263. }
  8264. }
  8265. var eventName = input.tagName === 'SELECT' ? 'change' : 'click';
  8266. input.addEventListener(eventName, function (e) {
  8267. var value = void 0;
  8268. if (input.tagName === 'SELECT') {
  8269. if (input.selectedIndex < 0) return;
  8270. var selected = input.options[input.selectedIndex];
  8271. if (selected.hasAttribute('selected')) {
  8272. value = false;
  8273. } else {
  8274. value = selected.value || false;
  8275. }
  8276. } else {
  8277. if (input.classList.contains('ql-active')) {
  8278. value = false;
  8279. } else {
  8280. value = input.value || !input.hasAttribute('value');
  8281. }
  8282. e.preventDefault();
  8283. }
  8284. _this2.quill.focus();
  8285. var _quill$selection$getR = _this2.quill.selection.getRange(),
  8286. _quill$selection$getR2 = _slicedToArray(_quill$selection$getR, 1),
  8287. range = _quill$selection$getR2[0];
  8288. if (_this2.handlers[format] != null) {
  8289. _this2.handlers[format].call(_this2, value);
  8290. } else if (_parchment2.default.query(format).prototype instanceof _parchment2.default.Embed) {
  8291. value = prompt('Enter ' + format);
  8292. if (!value) return;
  8293. _this2.quill.updateContents(new _quillDelta2.default().retain(range.index).delete(range.length).insert(_defineProperty({}, format, value)), _quill2.default.sources.USER);
  8294. } else {
  8295. _this2.quill.format(format, value, _quill2.default.sources.USER);
  8296. }
  8297. _this2.update(range);
  8298. });
  8299. // TODO use weakmap
  8300. this.controls.push([format, input]);
  8301. }
  8302. }, {
  8303. key: 'update',
  8304. value: function update(range) {
  8305. var formats = range == null ? {} : this.quill.getFormat(range);
  8306. this.controls.forEach(function (pair) {
  8307. var _pair = _slicedToArray(pair, 2),
  8308. format = _pair[0],
  8309. input = _pair[1];
  8310. if (input.tagName === 'SELECT') {
  8311. var option = void 0;
  8312. if (range == null) {
  8313. option = null;
  8314. } else if (formats[format] == null) {
  8315. option = input.querySelector('option[selected]');
  8316. } else if (!Array.isArray(formats[format])) {
  8317. var value = formats[format];
  8318. if (typeof value === 'string') {
  8319. value = value.replace(/\"/g, '\\"');
  8320. }
  8321. option = input.querySelector('option[value="' + value + '"]');
  8322. }
  8323. if (option == null) {
  8324. input.value = ''; // TODO make configurable?
  8325. input.selectedIndex = -1;
  8326. } else {
  8327. option.selected = true;
  8328. }
  8329. } else {
  8330. if (range == null) {
  8331. input.classList.remove('ql-active');
  8332. } else if (input.hasAttribute('value')) {
  8333. // both being null should match (default values)
  8334. // '1' should match with 1 (headers)
  8335. var isActive = formats[format] === input.getAttribute('value') || formats[format] != null && formats[format].toString() === input.getAttribute('value') || formats[format] == null && !input.getAttribute('value');
  8336. input.classList.toggle('ql-active', isActive);
  8337. } else {
  8338. input.classList.toggle('ql-active', formats[format] != null);
  8339. }
  8340. }
  8341. });
  8342. }
  8343. }]);
  8344. return Toolbar;
  8345. }(_module2.default);
  8346. Toolbar.DEFAULTS = {};
  8347. function addButton(container, format, value) {
  8348. var input = document.createElement('button');
  8349. input.setAttribute('type', 'button');
  8350. input.classList.add('ql-' + format);
  8351. if (value != null) {
  8352. input.value = value;
  8353. }
  8354. container.appendChild(input);
  8355. }
  8356. function addControls(container, groups) {
  8357. if (!Array.isArray(groups[0])) {
  8358. groups = [groups];
  8359. }
  8360. groups.forEach(function (controls) {
  8361. var group = document.createElement('span');
  8362. group.classList.add('ql-formats');
  8363. controls.forEach(function (control) {
  8364. if (typeof control === 'string') {
  8365. addButton(group, control);
  8366. } else {
  8367. var format = Object.keys(control)[0];
  8368. var value = control[format];
  8369. if (Array.isArray(value)) {
  8370. addSelect(group, format, value);
  8371. } else {
  8372. addButton(group, format, value);
  8373. }
  8374. }
  8375. });
  8376. container.appendChild(group);
  8377. });
  8378. }
  8379. function addSelect(container, format, values) {
  8380. var input = document.createElement('select');
  8381. input.classList.add('ql-' + format);
  8382. values.forEach(function (value) {
  8383. var option = document.createElement('option');
  8384. if (value !== false) {
  8385. option.setAttribute('value', value);
  8386. } else {
  8387. option.setAttribute('selected', 'selected');
  8388. }
  8389. input.appendChild(option);
  8390. });
  8391. container.appendChild(input);
  8392. }
  8393. Toolbar.DEFAULTS = {
  8394. container: null,
  8395. handlers: {
  8396. clean: function clean() {
  8397. var _this3 = this;
  8398. var range = this.quill.getSelection();
  8399. if (range == null) return;
  8400. if (range.length == 0) {
  8401. var formats = this.quill.getFormat();
  8402. Object.keys(formats).forEach(function (name) {
  8403. // Clean functionality in existing apps only clean inline formats
  8404. if (_parchment2.default.query(name, _parchment2.default.Scope.INLINE) != null) {
  8405. _this3.quill.format(name, false);
  8406. }
  8407. });
  8408. } else {
  8409. this.quill.removeFormat(range, _quill2.default.sources.USER);
  8410. }
  8411. },
  8412. direction: function direction(value) {
  8413. var align = this.quill.getFormat()['align'];
  8414. if (value === 'rtl' && align == null) {
  8415. this.quill.format('align', 'right', _quill2.default.sources.USER);
  8416. } else if (!value && align === 'right') {
  8417. this.quill.format('align', false, _quill2.default.sources.USER);
  8418. }
  8419. this.quill.format('direction', value, _quill2.default.sources.USER);
  8420. },
  8421. indent: function indent(value) {
  8422. var range = this.quill.getSelection();
  8423. var formats = this.quill.getFormat(range);
  8424. var indent = parseInt(formats.indent || 0);
  8425. if (value === '+1' || value === '-1') {
  8426. var modifier = value === '+1' ? 1 : -1;
  8427. if (formats.direction === 'rtl') modifier *= -1;
  8428. this.quill.format('indent', indent + modifier, _quill2.default.sources.USER);
  8429. }
  8430. },
  8431. link: function link(value) {
  8432. if (value === true) {
  8433. value = prompt('Enter link URL:');
  8434. }
  8435. this.quill.format('link', value, _quill2.default.sources.USER);
  8436. },
  8437. list: function list(value) {
  8438. var range = this.quill.getSelection();
  8439. var formats = this.quill.getFormat(range);
  8440. if (value === 'check') {
  8441. if (formats['list'] === 'checked' || formats['list'] === 'unchecked') {
  8442. this.quill.format('list', false, _quill2.default.sources.USER);
  8443. } else {
  8444. this.quill.format('list', 'unchecked', _quill2.default.sources.USER);
  8445. }
  8446. } else {
  8447. this.quill.format('list', value, _quill2.default.sources.USER);
  8448. }
  8449. }
  8450. }
  8451. };
  8452. exports.default = Toolbar;
  8453. exports.addControls = addControls;
  8454. /***/ }),
  8455. /* 58 */
  8456. /***/ (function(module, exports) {
  8457. module.exports = "<svg viewbox=\"0 0 18 18\"> <polyline class=\"ql-even ql-stroke\" points=\"5 7 3 9 5 11\"></polyline> <polyline class=\"ql-even ql-stroke\" points=\"13 7 15 9 13 11\"></polyline> <line class=ql-stroke x1=10 x2=8 y1=5 y2=13></line> </svg>";
  8458. /***/ }),
  8459. /* 59 */
  8460. /***/ (function(module, exports, __webpack_require__) {
  8461. "use strict";
  8462. Object.defineProperty(exports, "__esModule", {
  8463. value: true
  8464. });
  8465. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8466. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8467. var _picker = __webpack_require__(28);
  8468. var _picker2 = _interopRequireDefault(_picker);
  8469. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8470. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8471. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8472. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8473. var ColorPicker = function (_Picker) {
  8474. _inherits(ColorPicker, _Picker);
  8475. function ColorPicker(select, label) {
  8476. _classCallCheck(this, ColorPicker);
  8477. var _this = _possibleConstructorReturn(this, (ColorPicker.__proto__ || Object.getPrototypeOf(ColorPicker)).call(this, select));
  8478. _this.label.innerHTML = label;
  8479. _this.container.classList.add('ql-color-picker');
  8480. [].slice.call(_this.container.querySelectorAll('.ql-picker-item'), 0, 7).forEach(function (item) {
  8481. item.classList.add('ql-primary');
  8482. });
  8483. return _this;
  8484. }
  8485. _createClass(ColorPicker, [{
  8486. key: 'buildItem',
  8487. value: function buildItem(option) {
  8488. var item = _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'buildItem', this).call(this, option);
  8489. item.style.backgroundColor = option.getAttribute('value') || '';
  8490. return item;
  8491. }
  8492. }, {
  8493. key: 'selectItem',
  8494. value: function selectItem(item, trigger) {
  8495. _get(ColorPicker.prototype.__proto__ || Object.getPrototypeOf(ColorPicker.prototype), 'selectItem', this).call(this, item, trigger);
  8496. var colorLabel = this.label.querySelector('.ql-color-label');
  8497. var value = item ? item.getAttribute('data-value') || '' : '';
  8498. if (colorLabel) {
  8499. if (colorLabel.tagName === 'line') {
  8500. colorLabel.style.stroke = value;
  8501. } else {
  8502. colorLabel.style.fill = value;
  8503. }
  8504. }
  8505. }
  8506. }]);
  8507. return ColorPicker;
  8508. }(_picker2.default);
  8509. exports.default = ColorPicker;
  8510. /***/ }),
  8511. /* 60 */
  8512. /***/ (function(module, exports, __webpack_require__) {
  8513. "use strict";
  8514. Object.defineProperty(exports, "__esModule", {
  8515. value: true
  8516. });
  8517. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8518. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8519. var _picker = __webpack_require__(28);
  8520. var _picker2 = _interopRequireDefault(_picker);
  8521. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8522. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8523. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8524. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8525. var IconPicker = function (_Picker) {
  8526. _inherits(IconPicker, _Picker);
  8527. function IconPicker(select, icons) {
  8528. _classCallCheck(this, IconPicker);
  8529. var _this = _possibleConstructorReturn(this, (IconPicker.__proto__ || Object.getPrototypeOf(IconPicker)).call(this, select));
  8530. _this.container.classList.add('ql-icon-picker');
  8531. [].forEach.call(_this.container.querySelectorAll('.ql-picker-item'), function (item) {
  8532. item.innerHTML = icons[item.getAttribute('data-value') || ''];
  8533. });
  8534. _this.defaultItem = _this.container.querySelector('.ql-selected');
  8535. _this.selectItem(_this.defaultItem);
  8536. return _this;
  8537. }
  8538. _createClass(IconPicker, [{
  8539. key: 'selectItem',
  8540. value: function selectItem(item, trigger) {
  8541. _get(IconPicker.prototype.__proto__ || Object.getPrototypeOf(IconPicker.prototype), 'selectItem', this).call(this, item, trigger);
  8542. item = item || this.defaultItem;
  8543. this.label.innerHTML = item.innerHTML;
  8544. }
  8545. }]);
  8546. return IconPicker;
  8547. }(_picker2.default);
  8548. exports.default = IconPicker;
  8549. /***/ }),
  8550. /* 61 */
  8551. /***/ (function(module, exports, __webpack_require__) {
  8552. "use strict";
  8553. Object.defineProperty(exports, "__esModule", {
  8554. value: true
  8555. });
  8556. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8557. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8558. var Tooltip = function () {
  8559. function Tooltip(quill, boundsContainer) {
  8560. var _this = this;
  8561. _classCallCheck(this, Tooltip);
  8562. this.quill = quill;
  8563. this.boundsContainer = boundsContainer || document.body;
  8564. this.root = quill.addContainer('ql-tooltip');
  8565. this.root.innerHTML = this.constructor.TEMPLATE;
  8566. if (this.quill.root === this.quill.scrollingContainer) {
  8567. this.quill.root.addEventListener('scroll', function () {
  8568. _this.root.style.marginTop = -1 * _this.quill.root.scrollTop + 'px';
  8569. });
  8570. }
  8571. this.hide();
  8572. }
  8573. _createClass(Tooltip, [{
  8574. key: 'hide',
  8575. value: function hide() {
  8576. this.root.classList.add('ql-hidden');
  8577. }
  8578. }, {
  8579. key: 'position',
  8580. value: function position(reference) {
  8581. var left = reference.left + reference.width / 2 - this.root.offsetWidth / 2;
  8582. // root.scrollTop should be 0 if scrollContainer !== root
  8583. var top = reference.bottom + this.quill.root.scrollTop;
  8584. this.root.style.left = left + 'px';
  8585. this.root.style.top = top + 'px';
  8586. this.root.classList.remove('ql-flip');
  8587. var containerBounds = this.boundsContainer.getBoundingClientRect();
  8588. var rootBounds = this.root.getBoundingClientRect();
  8589. var shift = 0;
  8590. if (rootBounds.right > containerBounds.right) {
  8591. shift = containerBounds.right - rootBounds.right;
  8592. this.root.style.left = left + shift + 'px';
  8593. }
  8594. if (rootBounds.left < containerBounds.left) {
  8595. shift = containerBounds.left - rootBounds.left;
  8596. this.root.style.left = left + shift + 'px';
  8597. }
  8598. if (rootBounds.bottom > containerBounds.bottom) {
  8599. var height = rootBounds.bottom - rootBounds.top;
  8600. var verticalShift = reference.bottom - reference.top + height;
  8601. this.root.style.top = top - verticalShift + 'px';
  8602. this.root.classList.add('ql-flip');
  8603. }
  8604. return shift;
  8605. }
  8606. }, {
  8607. key: 'show',
  8608. value: function show() {
  8609. this.root.classList.remove('ql-editing');
  8610. this.root.classList.remove('ql-hidden');
  8611. }
  8612. }]);
  8613. return Tooltip;
  8614. }();
  8615. exports.default = Tooltip;
  8616. /***/ }),
  8617. /* 62 */
  8618. /***/ (function(module, exports, __webpack_require__) {
  8619. "use strict";
  8620. Object.defineProperty(exports, "__esModule", {
  8621. value: true
  8622. });
  8623. var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
  8624. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8625. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8626. var _extend = __webpack_require__(3);
  8627. var _extend2 = _interopRequireDefault(_extend);
  8628. var _emitter = __webpack_require__(8);
  8629. var _emitter2 = _interopRequireDefault(_emitter);
  8630. var _base = __webpack_require__(43);
  8631. var _base2 = _interopRequireDefault(_base);
  8632. var _link = __webpack_require__(27);
  8633. var _link2 = _interopRequireDefault(_link);
  8634. var _selection = __webpack_require__(15);
  8635. var _icons = __webpack_require__(41);
  8636. var _icons2 = _interopRequireDefault(_icons);
  8637. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8638. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8639. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8640. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8641. var TOOLBAR_CONFIG = [[{ header: ['1', '2', '3', false] }], ['bold', 'italic', 'underline', 'link'], [{ list: 'ordered' }, { list: 'bullet' }], ['clean']];
  8642. var SnowTheme = function (_BaseTheme) {
  8643. _inherits(SnowTheme, _BaseTheme);
  8644. function SnowTheme(quill, options) {
  8645. _classCallCheck(this, SnowTheme);
  8646. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  8647. options.modules.toolbar.container = TOOLBAR_CONFIG;
  8648. }
  8649. var _this = _possibleConstructorReturn(this, (SnowTheme.__proto__ || Object.getPrototypeOf(SnowTheme)).call(this, quill, options));
  8650. _this.quill.container.classList.add('ql-snow');
  8651. return _this;
  8652. }
  8653. _createClass(SnowTheme, [{
  8654. key: 'extendToolbar',
  8655. value: function extendToolbar(toolbar) {
  8656. toolbar.container.classList.add('ql-snow');
  8657. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  8658. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  8659. this.tooltip = new SnowTooltip(this.quill, this.options.bounds);
  8660. if (toolbar.container.querySelector('.ql-link')) {
  8661. this.quill.keyboard.addBinding({ key: 'K', shortKey: true }, function (range, context) {
  8662. toolbar.handlers['link'].call(toolbar, !context.format.link);
  8663. });
  8664. }
  8665. }
  8666. }]);
  8667. return SnowTheme;
  8668. }(_base2.default);
  8669. SnowTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  8670. modules: {
  8671. toolbar: {
  8672. handlers: {
  8673. link: function link(value) {
  8674. if (value) {
  8675. var range = this.quill.getSelection();
  8676. if (range == null || range.length == 0) return;
  8677. var preview = this.quill.getText(range);
  8678. if (/^\S+@\S+\.\S+$/.test(preview) && preview.indexOf('mailto:') !== 0) {
  8679. preview = 'mailto:' + preview;
  8680. }
  8681. var tooltip = this.quill.theme.tooltip;
  8682. tooltip.edit('link', preview);
  8683. } else {
  8684. this.quill.format('link', false);
  8685. }
  8686. }
  8687. }
  8688. }
  8689. }
  8690. });
  8691. var SnowTooltip = function (_BaseTooltip) {
  8692. _inherits(SnowTooltip, _BaseTooltip);
  8693. function SnowTooltip(quill, bounds) {
  8694. _classCallCheck(this, SnowTooltip);
  8695. var _this2 = _possibleConstructorReturn(this, (SnowTooltip.__proto__ || Object.getPrototypeOf(SnowTooltip)).call(this, quill, bounds));
  8696. _this2.preview = _this2.root.querySelector('a.ql-preview');
  8697. return _this2;
  8698. }
  8699. _createClass(SnowTooltip, [{
  8700. key: 'listen',
  8701. value: function listen() {
  8702. var _this3 = this;
  8703. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'listen', this).call(this);
  8704. this.root.querySelector('a.ql-action').addEventListener('click', function (event) {
  8705. if (_this3.root.classList.contains('ql-editing')) {
  8706. _this3.save();
  8707. } else {
  8708. _this3.edit('link', _this3.preview.textContent);
  8709. }
  8710. event.preventDefault();
  8711. });
  8712. this.root.querySelector('a.ql-remove').addEventListener('click', function (event) {
  8713. if (_this3.linkRange != null) {
  8714. var range = _this3.linkRange;
  8715. _this3.restoreFocus();
  8716. _this3.quill.formatText(range, 'link', false, _emitter2.default.sources.USER);
  8717. delete _this3.linkRange;
  8718. }
  8719. event.preventDefault();
  8720. _this3.hide();
  8721. });
  8722. this.quill.on(_emitter2.default.events.SELECTION_CHANGE, function (range, oldRange, source) {
  8723. if (range == null) return;
  8724. if (range.length === 0 && source === _emitter2.default.sources.USER) {
  8725. var _quill$scroll$descend = _this3.quill.scroll.descendant(_link2.default, range.index),
  8726. _quill$scroll$descend2 = _slicedToArray(_quill$scroll$descend, 2),
  8727. link = _quill$scroll$descend2[0],
  8728. offset = _quill$scroll$descend2[1];
  8729. if (link != null) {
  8730. _this3.linkRange = new _selection.Range(range.index - offset, link.length());
  8731. var preview = _link2.default.formats(link.domNode);
  8732. _this3.preview.textContent = preview;
  8733. _this3.preview.setAttribute('href', preview);
  8734. _this3.show();
  8735. _this3.position(_this3.quill.getBounds(_this3.linkRange));
  8736. return;
  8737. }
  8738. } else {
  8739. delete _this3.linkRange;
  8740. }
  8741. _this3.hide();
  8742. });
  8743. }
  8744. }, {
  8745. key: 'show',
  8746. value: function show() {
  8747. _get(SnowTooltip.prototype.__proto__ || Object.getPrototypeOf(SnowTooltip.prototype), 'show', this).call(this);
  8748. this.root.removeAttribute('data-mode');
  8749. }
  8750. }]);
  8751. return SnowTooltip;
  8752. }(_base.BaseTooltip);
  8753. SnowTooltip.TEMPLATE = ['<a class="ql-preview" rel="noopener noreferrer" target="_blank" href="about:blank"></a>', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-action"></a>', '<a class="ql-remove"></a>'].join('');
  8754. exports.default = SnowTheme;
  8755. /***/ }),
  8756. /* 63 */
  8757. /***/ (function(module, exports, __webpack_require__) {
  8758. "use strict";
  8759. Object.defineProperty(exports, "__esModule", {
  8760. value: true
  8761. });
  8762. var _core = __webpack_require__(29);
  8763. var _core2 = _interopRequireDefault(_core);
  8764. var _align = __webpack_require__(36);
  8765. var _direction = __webpack_require__(38);
  8766. var _indent = __webpack_require__(64);
  8767. var _blockquote = __webpack_require__(65);
  8768. var _blockquote2 = _interopRequireDefault(_blockquote);
  8769. var _header = __webpack_require__(66);
  8770. var _header2 = _interopRequireDefault(_header);
  8771. var _list = __webpack_require__(67);
  8772. var _list2 = _interopRequireDefault(_list);
  8773. var _background = __webpack_require__(37);
  8774. var _color = __webpack_require__(26);
  8775. var _font = __webpack_require__(39);
  8776. var _size = __webpack_require__(40);
  8777. var _bold = __webpack_require__(56);
  8778. var _bold2 = _interopRequireDefault(_bold);
  8779. var _italic = __webpack_require__(68);
  8780. var _italic2 = _interopRequireDefault(_italic);
  8781. var _link = __webpack_require__(27);
  8782. var _link2 = _interopRequireDefault(_link);
  8783. var _script = __webpack_require__(69);
  8784. var _script2 = _interopRequireDefault(_script);
  8785. var _strike = __webpack_require__(70);
  8786. var _strike2 = _interopRequireDefault(_strike);
  8787. var _underline = __webpack_require__(71);
  8788. var _underline2 = _interopRequireDefault(_underline);
  8789. var _image = __webpack_require__(72);
  8790. var _image2 = _interopRequireDefault(_image);
  8791. var _video = __webpack_require__(73);
  8792. var _video2 = _interopRequireDefault(_video);
  8793. var _code = __webpack_require__(13);
  8794. var _code2 = _interopRequireDefault(_code);
  8795. var _formula = __webpack_require__(74);
  8796. var _formula2 = _interopRequireDefault(_formula);
  8797. var _syntax = __webpack_require__(75);
  8798. var _syntax2 = _interopRequireDefault(_syntax);
  8799. var _toolbar = __webpack_require__(57);
  8800. var _toolbar2 = _interopRequireDefault(_toolbar);
  8801. var _icons = __webpack_require__(41);
  8802. var _icons2 = _interopRequireDefault(_icons);
  8803. var _picker = __webpack_require__(28);
  8804. var _picker2 = _interopRequireDefault(_picker);
  8805. var _colorPicker = __webpack_require__(59);
  8806. var _colorPicker2 = _interopRequireDefault(_colorPicker);
  8807. var _iconPicker = __webpack_require__(60);
  8808. var _iconPicker2 = _interopRequireDefault(_iconPicker);
  8809. var _tooltip = __webpack_require__(61);
  8810. var _tooltip2 = _interopRequireDefault(_tooltip);
  8811. var _bubble = __webpack_require__(108);
  8812. var _bubble2 = _interopRequireDefault(_bubble);
  8813. var _snow = __webpack_require__(62);
  8814. var _snow2 = _interopRequireDefault(_snow);
  8815. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8816. _core2.default.register({
  8817. 'attributors/attribute/direction': _direction.DirectionAttribute,
  8818. 'attributors/class/align': _align.AlignClass,
  8819. 'attributors/class/background': _background.BackgroundClass,
  8820. 'attributors/class/color': _color.ColorClass,
  8821. 'attributors/class/direction': _direction.DirectionClass,
  8822. 'attributors/class/font': _font.FontClass,
  8823. 'attributors/class/size': _size.SizeClass,
  8824. 'attributors/style/align': _align.AlignStyle,
  8825. 'attributors/style/background': _background.BackgroundStyle,
  8826. 'attributors/style/color': _color.ColorStyle,
  8827. 'attributors/style/direction': _direction.DirectionStyle,
  8828. 'attributors/style/font': _font.FontStyle,
  8829. 'attributors/style/size': _size.SizeStyle
  8830. }, true);
  8831. _core2.default.register({
  8832. 'formats/align': _align.AlignClass,
  8833. 'formats/direction': _direction.DirectionClass,
  8834. 'formats/indent': _indent.IndentClass,
  8835. 'formats/background': _background.BackgroundStyle,
  8836. 'formats/color': _color.ColorStyle,
  8837. 'formats/font': _font.FontClass,
  8838. 'formats/size': _size.SizeClass,
  8839. 'formats/blockquote': _blockquote2.default,
  8840. 'formats/code-block': _code2.default,
  8841. 'formats/header': _header2.default,
  8842. 'formats/list': _list2.default,
  8843. 'formats/bold': _bold2.default,
  8844. 'formats/code': _code.Code,
  8845. 'formats/italic': _italic2.default,
  8846. 'formats/link': _link2.default,
  8847. 'formats/script': _script2.default,
  8848. 'formats/strike': _strike2.default,
  8849. 'formats/underline': _underline2.default,
  8850. 'formats/image': _image2.default,
  8851. 'formats/video': _video2.default,
  8852. 'formats/list/item': _list.ListItem,
  8853. 'modules/formula': _formula2.default,
  8854. 'modules/syntax': _syntax2.default,
  8855. 'modules/toolbar': _toolbar2.default,
  8856. 'themes/bubble': _bubble2.default,
  8857. 'themes/snow': _snow2.default,
  8858. 'ui/icons': _icons2.default,
  8859. 'ui/picker': _picker2.default,
  8860. 'ui/icon-picker': _iconPicker2.default,
  8861. 'ui/color-picker': _colorPicker2.default,
  8862. 'ui/tooltip': _tooltip2.default
  8863. }, true);
  8864. exports.default = _core2.default;
  8865. /***/ }),
  8866. /* 64 */
  8867. /***/ (function(module, exports, __webpack_require__) {
  8868. "use strict";
  8869. Object.defineProperty(exports, "__esModule", {
  8870. value: true
  8871. });
  8872. exports.IndentClass = undefined;
  8873. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8874. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8875. var _parchment = __webpack_require__(0);
  8876. var _parchment2 = _interopRequireDefault(_parchment);
  8877. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8878. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8879. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8880. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8881. var IdentAttributor = function (_Parchment$Attributor) {
  8882. _inherits(IdentAttributor, _Parchment$Attributor);
  8883. function IdentAttributor() {
  8884. _classCallCheck(this, IdentAttributor);
  8885. return _possibleConstructorReturn(this, (IdentAttributor.__proto__ || Object.getPrototypeOf(IdentAttributor)).apply(this, arguments));
  8886. }
  8887. _createClass(IdentAttributor, [{
  8888. key: 'add',
  8889. value: function add(node, value) {
  8890. if (value === '+1' || value === '-1') {
  8891. var indent = this.value(node) || 0;
  8892. value = value === '+1' ? indent + 1 : indent - 1;
  8893. }
  8894. if (value === 0) {
  8895. this.remove(node);
  8896. return true;
  8897. } else {
  8898. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'add', this).call(this, node, value);
  8899. }
  8900. }
  8901. }, {
  8902. key: 'canAdd',
  8903. value: function canAdd(node, value) {
  8904. return _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, value) || _get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'canAdd', this).call(this, node, parseInt(value));
  8905. }
  8906. }, {
  8907. key: 'value',
  8908. value: function value(node) {
  8909. return parseInt(_get(IdentAttributor.prototype.__proto__ || Object.getPrototypeOf(IdentAttributor.prototype), 'value', this).call(this, node)) || undefined; // Don't return NaN
  8910. }
  8911. }]);
  8912. return IdentAttributor;
  8913. }(_parchment2.default.Attributor.Class);
  8914. var IndentClass = new IdentAttributor('indent', 'ql-indent', {
  8915. scope: _parchment2.default.Scope.BLOCK,
  8916. whitelist: [1, 2, 3, 4, 5, 6, 7, 8]
  8917. });
  8918. exports.IndentClass = IndentClass;
  8919. /***/ }),
  8920. /* 65 */
  8921. /***/ (function(module, exports, __webpack_require__) {
  8922. "use strict";
  8923. Object.defineProperty(exports, "__esModule", {
  8924. value: true
  8925. });
  8926. var _block = __webpack_require__(4);
  8927. var _block2 = _interopRequireDefault(_block);
  8928. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8929. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8930. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8931. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8932. var Blockquote = function (_Block) {
  8933. _inherits(Blockquote, _Block);
  8934. function Blockquote() {
  8935. _classCallCheck(this, Blockquote);
  8936. return _possibleConstructorReturn(this, (Blockquote.__proto__ || Object.getPrototypeOf(Blockquote)).apply(this, arguments));
  8937. }
  8938. return Blockquote;
  8939. }(_block2.default);
  8940. Blockquote.blotName = 'blockquote';
  8941. Blockquote.tagName = 'blockquote';
  8942. exports.default = Blockquote;
  8943. /***/ }),
  8944. /* 66 */
  8945. /***/ (function(module, exports, __webpack_require__) {
  8946. "use strict";
  8947. Object.defineProperty(exports, "__esModule", {
  8948. value: true
  8949. });
  8950. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8951. var _block = __webpack_require__(4);
  8952. var _block2 = _interopRequireDefault(_block);
  8953. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8954. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8955. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8956. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8957. var Header = function (_Block) {
  8958. _inherits(Header, _Block);
  8959. function Header() {
  8960. _classCallCheck(this, Header);
  8961. return _possibleConstructorReturn(this, (Header.__proto__ || Object.getPrototypeOf(Header)).apply(this, arguments));
  8962. }
  8963. _createClass(Header, null, [{
  8964. key: 'formats',
  8965. value: function formats(domNode) {
  8966. return this.tagName.indexOf(domNode.tagName) + 1;
  8967. }
  8968. }]);
  8969. return Header;
  8970. }(_block2.default);
  8971. Header.blotName = 'header';
  8972. Header.tagName = ['H1', 'H2', 'H3', 'H4', 'H5', 'H6'];
  8973. exports.default = Header;
  8974. /***/ }),
  8975. /* 67 */
  8976. /***/ (function(module, exports, __webpack_require__) {
  8977. "use strict";
  8978. Object.defineProperty(exports, "__esModule", {
  8979. value: true
  8980. });
  8981. exports.default = exports.ListItem = undefined;
  8982. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  8983. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  8984. var _parchment = __webpack_require__(0);
  8985. var _parchment2 = _interopRequireDefault(_parchment);
  8986. var _block = __webpack_require__(4);
  8987. var _block2 = _interopRequireDefault(_block);
  8988. var _container = __webpack_require__(25);
  8989. var _container2 = _interopRequireDefault(_container);
  8990. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8991. function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
  8992. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  8993. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  8994. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  8995. var ListItem = function (_Block) {
  8996. _inherits(ListItem, _Block);
  8997. function ListItem() {
  8998. _classCallCheck(this, ListItem);
  8999. return _possibleConstructorReturn(this, (ListItem.__proto__ || Object.getPrototypeOf(ListItem)).apply(this, arguments));
  9000. }
  9001. _createClass(ListItem, [{
  9002. key: 'format',
  9003. value: function format(name, value) {
  9004. if (name === List.blotName && !value) {
  9005. this.replaceWith(_parchment2.default.create(this.statics.scope));
  9006. } else {
  9007. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'format', this).call(this, name, value);
  9008. }
  9009. }
  9010. }, {
  9011. key: 'remove',
  9012. value: function remove() {
  9013. if (this.prev == null && this.next == null) {
  9014. this.parent.remove();
  9015. } else {
  9016. _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'remove', this).call(this);
  9017. }
  9018. }
  9019. }, {
  9020. key: 'replaceWith',
  9021. value: function replaceWith(name, value) {
  9022. this.parent.isolate(this.offset(this.parent), this.length());
  9023. if (name === this.parent.statics.blotName) {
  9024. this.parent.replaceWith(name, value);
  9025. return this;
  9026. } else {
  9027. this.parent.unwrap();
  9028. return _get(ListItem.prototype.__proto__ || Object.getPrototypeOf(ListItem.prototype), 'replaceWith', this).call(this, name, value);
  9029. }
  9030. }
  9031. }], [{
  9032. key: 'formats',
  9033. value: function formats(domNode) {
  9034. return domNode.tagName === this.tagName ? undefined : _get(ListItem.__proto__ || Object.getPrototypeOf(ListItem), 'formats', this).call(this, domNode);
  9035. }
  9036. }]);
  9037. return ListItem;
  9038. }(_block2.default);
  9039. ListItem.blotName = 'list-item';
  9040. ListItem.tagName = 'LI';
  9041. var List = function (_Container) {
  9042. _inherits(List, _Container);
  9043. _createClass(List, null, [{
  9044. key: 'create',
  9045. value: function create(value) {
  9046. var tagName = value === 'ordered' ? 'OL' : 'UL';
  9047. var node = _get(List.__proto__ || Object.getPrototypeOf(List), 'create', this).call(this, tagName);
  9048. if (value === 'checked' || value === 'unchecked') {
  9049. node.setAttribute('data-checked', value === 'checked');
  9050. }
  9051. return node;
  9052. }
  9053. }, {
  9054. key: 'formats',
  9055. value: function formats(domNode) {
  9056. if (domNode.tagName === 'OL') return 'ordered';
  9057. if (domNode.tagName === 'UL') {
  9058. if (domNode.hasAttribute('data-checked')) {
  9059. return domNode.getAttribute('data-checked') === 'true' ? 'checked' : 'unchecked';
  9060. } else {
  9061. return 'bullet';
  9062. }
  9063. }
  9064. return undefined;
  9065. }
  9066. }]);
  9067. function List(domNode) {
  9068. _classCallCheck(this, List);
  9069. var _this2 = _possibleConstructorReturn(this, (List.__proto__ || Object.getPrototypeOf(List)).call(this, domNode));
  9070. var listEventHandler = function listEventHandler(e) {
  9071. if (e.target.parentNode !== domNode) return;
  9072. var format = _this2.statics.formats(domNode);
  9073. var blot = _parchment2.default.find(e.target);
  9074. if (format === 'checked') {
  9075. blot.format('list', 'unchecked');
  9076. } else if (format === 'unchecked') {
  9077. blot.format('list', 'checked');
  9078. }
  9079. };
  9080. domNode.addEventListener('touchstart', listEventHandler);
  9081. domNode.addEventListener('mousedown', listEventHandler);
  9082. return _this2;
  9083. }
  9084. _createClass(List, [{
  9085. key: 'format',
  9086. value: function format(name, value) {
  9087. if (this.children.length > 0) {
  9088. this.children.tail.format(name, value);
  9089. }
  9090. }
  9091. }, {
  9092. key: 'formats',
  9093. value: function formats() {
  9094. // We don't inherit from FormatBlot
  9095. return _defineProperty({}, this.statics.blotName, this.statics.formats(this.domNode));
  9096. }
  9097. }, {
  9098. key: 'insertBefore',
  9099. value: function insertBefore(blot, ref) {
  9100. if (blot instanceof ListItem) {
  9101. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'insertBefore', this).call(this, blot, ref);
  9102. } else {
  9103. var index = ref == null ? this.length() : ref.offset(this);
  9104. var after = this.split(index);
  9105. after.parent.insertBefore(blot, after);
  9106. }
  9107. }
  9108. }, {
  9109. key: 'optimize',
  9110. value: function optimize(context) {
  9111. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'optimize', this).call(this, context);
  9112. var next = this.next;
  9113. if (next != null && next.prev === this && next.statics.blotName === this.statics.blotName && next.domNode.tagName === this.domNode.tagName && next.domNode.getAttribute('data-checked') === this.domNode.getAttribute('data-checked')) {
  9114. next.moveChildren(this);
  9115. next.remove();
  9116. }
  9117. }
  9118. }, {
  9119. key: 'replace',
  9120. value: function replace(target) {
  9121. if (target.statics.blotName !== this.statics.blotName) {
  9122. var item = _parchment2.default.create(this.statics.defaultChild);
  9123. target.moveChildren(item);
  9124. this.appendChild(item);
  9125. }
  9126. _get(List.prototype.__proto__ || Object.getPrototypeOf(List.prototype), 'replace', this).call(this, target);
  9127. }
  9128. }]);
  9129. return List;
  9130. }(_container2.default);
  9131. List.blotName = 'list';
  9132. List.scope = _parchment2.default.Scope.BLOCK_BLOT;
  9133. List.tagName = ['OL', 'UL'];
  9134. List.defaultChild = 'list-item';
  9135. List.allowedChildren = [ListItem];
  9136. exports.ListItem = ListItem;
  9137. exports.default = List;
  9138. /***/ }),
  9139. /* 68 */
  9140. /***/ (function(module, exports, __webpack_require__) {
  9141. "use strict";
  9142. Object.defineProperty(exports, "__esModule", {
  9143. value: true
  9144. });
  9145. var _bold = __webpack_require__(56);
  9146. var _bold2 = _interopRequireDefault(_bold);
  9147. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9148. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9149. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9150. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9151. var Italic = function (_Bold) {
  9152. _inherits(Italic, _Bold);
  9153. function Italic() {
  9154. _classCallCheck(this, Italic);
  9155. return _possibleConstructorReturn(this, (Italic.__proto__ || Object.getPrototypeOf(Italic)).apply(this, arguments));
  9156. }
  9157. return Italic;
  9158. }(_bold2.default);
  9159. Italic.blotName = 'italic';
  9160. Italic.tagName = ['EM', 'I'];
  9161. exports.default = Italic;
  9162. /***/ }),
  9163. /* 69 */
  9164. /***/ (function(module, exports, __webpack_require__) {
  9165. "use strict";
  9166. Object.defineProperty(exports, "__esModule", {
  9167. value: true
  9168. });
  9169. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9170. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9171. var _inline = __webpack_require__(6);
  9172. var _inline2 = _interopRequireDefault(_inline);
  9173. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9174. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9175. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9176. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9177. var Script = function (_Inline) {
  9178. _inherits(Script, _Inline);
  9179. function Script() {
  9180. _classCallCheck(this, Script);
  9181. return _possibleConstructorReturn(this, (Script.__proto__ || Object.getPrototypeOf(Script)).apply(this, arguments));
  9182. }
  9183. _createClass(Script, null, [{
  9184. key: 'create',
  9185. value: function create(value) {
  9186. if (value === 'super') {
  9187. return document.createElement('sup');
  9188. } else if (value === 'sub') {
  9189. return document.createElement('sub');
  9190. } else {
  9191. return _get(Script.__proto__ || Object.getPrototypeOf(Script), 'create', this).call(this, value);
  9192. }
  9193. }
  9194. }, {
  9195. key: 'formats',
  9196. value: function formats(domNode) {
  9197. if (domNode.tagName === 'SUB') return 'sub';
  9198. if (domNode.tagName === 'SUP') return 'super';
  9199. return undefined;
  9200. }
  9201. }]);
  9202. return Script;
  9203. }(_inline2.default);
  9204. Script.blotName = 'script';
  9205. Script.tagName = ['SUB', 'SUP'];
  9206. exports.default = Script;
  9207. /***/ }),
  9208. /* 70 */
  9209. /***/ (function(module, exports, __webpack_require__) {
  9210. "use strict";
  9211. Object.defineProperty(exports, "__esModule", {
  9212. value: true
  9213. });
  9214. var _inline = __webpack_require__(6);
  9215. var _inline2 = _interopRequireDefault(_inline);
  9216. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9217. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9218. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9219. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9220. var Strike = function (_Inline) {
  9221. _inherits(Strike, _Inline);
  9222. function Strike() {
  9223. _classCallCheck(this, Strike);
  9224. return _possibleConstructorReturn(this, (Strike.__proto__ || Object.getPrototypeOf(Strike)).apply(this, arguments));
  9225. }
  9226. return Strike;
  9227. }(_inline2.default);
  9228. Strike.blotName = 'strike';
  9229. Strike.tagName = 'S';
  9230. exports.default = Strike;
  9231. /***/ }),
  9232. /* 71 */
  9233. /***/ (function(module, exports, __webpack_require__) {
  9234. "use strict";
  9235. Object.defineProperty(exports, "__esModule", {
  9236. value: true
  9237. });
  9238. var _inline = __webpack_require__(6);
  9239. var _inline2 = _interopRequireDefault(_inline);
  9240. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9241. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9242. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9243. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9244. var Underline = function (_Inline) {
  9245. _inherits(Underline, _Inline);
  9246. function Underline() {
  9247. _classCallCheck(this, Underline);
  9248. return _possibleConstructorReturn(this, (Underline.__proto__ || Object.getPrototypeOf(Underline)).apply(this, arguments));
  9249. }
  9250. return Underline;
  9251. }(_inline2.default);
  9252. Underline.blotName = 'underline';
  9253. Underline.tagName = 'U';
  9254. exports.default = Underline;
  9255. /***/ }),
  9256. /* 72 */
  9257. /***/ (function(module, exports, __webpack_require__) {
  9258. "use strict";
  9259. Object.defineProperty(exports, "__esModule", {
  9260. value: true
  9261. });
  9262. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9263. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9264. var _parchment = __webpack_require__(0);
  9265. var _parchment2 = _interopRequireDefault(_parchment);
  9266. var _link = __webpack_require__(27);
  9267. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9268. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9269. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9270. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9271. var ATTRIBUTES = ['alt', 'height', 'width'];
  9272. var Image = function (_Parchment$Embed) {
  9273. _inherits(Image, _Parchment$Embed);
  9274. function Image() {
  9275. _classCallCheck(this, Image);
  9276. return _possibleConstructorReturn(this, (Image.__proto__ || Object.getPrototypeOf(Image)).apply(this, arguments));
  9277. }
  9278. _createClass(Image, [{
  9279. key: 'format',
  9280. value: function format(name, value) {
  9281. if (ATTRIBUTES.indexOf(name) > -1) {
  9282. if (value) {
  9283. this.domNode.setAttribute(name, value);
  9284. } else {
  9285. this.domNode.removeAttribute(name);
  9286. }
  9287. } else {
  9288. _get(Image.prototype.__proto__ || Object.getPrototypeOf(Image.prototype), 'format', this).call(this, name, value);
  9289. }
  9290. }
  9291. }], [{
  9292. key: 'create',
  9293. value: function create(value) {
  9294. var node = _get(Image.__proto__ || Object.getPrototypeOf(Image), 'create', this).call(this, value);
  9295. if (typeof value === 'string') {
  9296. node.setAttribute('src', this.sanitize(value));
  9297. }
  9298. return node;
  9299. }
  9300. }, {
  9301. key: 'formats',
  9302. value: function formats(domNode) {
  9303. return ATTRIBUTES.reduce(function (formats, attribute) {
  9304. if (domNode.hasAttribute(attribute)) {
  9305. formats[attribute] = domNode.getAttribute(attribute);
  9306. }
  9307. return formats;
  9308. }, {});
  9309. }
  9310. }, {
  9311. key: 'match',
  9312. value: function match(url) {
  9313. return (/\.(jpe?g|gif|png)$/.test(url) || /^data:image\/.+;base64/.test(url)
  9314. );
  9315. }
  9316. }, {
  9317. key: 'sanitize',
  9318. value: function sanitize(url) {
  9319. return (0, _link.sanitize)(url, ['http', 'https', 'data']) ? url : '//:0';
  9320. }
  9321. }, {
  9322. key: 'value',
  9323. value: function value(domNode) {
  9324. return domNode.getAttribute('src');
  9325. }
  9326. }]);
  9327. return Image;
  9328. }(_parchment2.default.Embed);
  9329. Image.blotName = 'image';
  9330. Image.tagName = 'IMG';
  9331. exports.default = Image;
  9332. /***/ }),
  9333. /* 73 */
  9334. /***/ (function(module, exports, __webpack_require__) {
  9335. "use strict";
  9336. Object.defineProperty(exports, "__esModule", {
  9337. value: true
  9338. });
  9339. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9340. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9341. var _block = __webpack_require__(4);
  9342. var _link = __webpack_require__(27);
  9343. var _link2 = _interopRequireDefault(_link);
  9344. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9345. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9346. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9347. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9348. var ATTRIBUTES = ['height', 'width'];
  9349. var Video = function (_BlockEmbed) {
  9350. _inherits(Video, _BlockEmbed);
  9351. function Video() {
  9352. _classCallCheck(this, Video);
  9353. return _possibleConstructorReturn(this, (Video.__proto__ || Object.getPrototypeOf(Video)).apply(this, arguments));
  9354. }
  9355. _createClass(Video, [{
  9356. key: 'format',
  9357. value: function format(name, value) {
  9358. if (ATTRIBUTES.indexOf(name) > -1) {
  9359. if (value) {
  9360. this.domNode.setAttribute(name, value);
  9361. } else {
  9362. this.domNode.removeAttribute(name);
  9363. }
  9364. } else {
  9365. _get(Video.prototype.__proto__ || Object.getPrototypeOf(Video.prototype), 'format', this).call(this, name, value);
  9366. }
  9367. }
  9368. }], [{
  9369. key: 'create',
  9370. value: function create(value) {
  9371. var node = _get(Video.__proto__ || Object.getPrototypeOf(Video), 'create', this).call(this, value);
  9372. node.setAttribute('frameborder', '0');
  9373. node.setAttribute('allowfullscreen', true);
  9374. node.setAttribute('src', this.sanitize(value));
  9375. return node;
  9376. }
  9377. }, {
  9378. key: 'formats',
  9379. value: function formats(domNode) {
  9380. return ATTRIBUTES.reduce(function (formats, attribute) {
  9381. if (domNode.hasAttribute(attribute)) {
  9382. formats[attribute] = domNode.getAttribute(attribute);
  9383. }
  9384. return formats;
  9385. }, {});
  9386. }
  9387. }, {
  9388. key: 'sanitize',
  9389. value: function sanitize(url) {
  9390. return _link2.default.sanitize(url);
  9391. }
  9392. }, {
  9393. key: 'value',
  9394. value: function value(domNode) {
  9395. return domNode.getAttribute('src');
  9396. }
  9397. }]);
  9398. return Video;
  9399. }(_block.BlockEmbed);
  9400. Video.blotName = 'video';
  9401. Video.className = 'ql-video';
  9402. Video.tagName = 'IFRAME';
  9403. exports.default = Video;
  9404. /***/ }),
  9405. /* 74 */
  9406. /***/ (function(module, exports, __webpack_require__) {
  9407. "use strict";
  9408. Object.defineProperty(exports, "__esModule", {
  9409. value: true
  9410. });
  9411. exports.default = exports.FormulaBlot = undefined;
  9412. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9413. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9414. var _embed = __webpack_require__(35);
  9415. var _embed2 = _interopRequireDefault(_embed);
  9416. var _quill = __webpack_require__(5);
  9417. var _quill2 = _interopRequireDefault(_quill);
  9418. var _module = __webpack_require__(9);
  9419. var _module2 = _interopRequireDefault(_module);
  9420. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9421. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9422. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9423. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9424. var FormulaBlot = function (_Embed) {
  9425. _inherits(FormulaBlot, _Embed);
  9426. function FormulaBlot() {
  9427. _classCallCheck(this, FormulaBlot);
  9428. return _possibleConstructorReturn(this, (FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot)).apply(this, arguments));
  9429. }
  9430. _createClass(FormulaBlot, null, [{
  9431. key: 'create',
  9432. value: function create(value) {
  9433. var node = _get(FormulaBlot.__proto__ || Object.getPrototypeOf(FormulaBlot), 'create', this).call(this, value);
  9434. if (typeof value === 'string') {
  9435. window.katex.render(value, node, {
  9436. throwOnError: false,
  9437. errorColor: '#f00'
  9438. });
  9439. node.setAttribute('data-value', value);
  9440. }
  9441. return node;
  9442. }
  9443. }, {
  9444. key: 'value',
  9445. value: function value(domNode) {
  9446. return domNode.getAttribute('data-value');
  9447. }
  9448. }]);
  9449. return FormulaBlot;
  9450. }(_embed2.default);
  9451. FormulaBlot.blotName = 'formula';
  9452. FormulaBlot.className = 'ql-formula';
  9453. FormulaBlot.tagName = 'SPAN';
  9454. var Formula = function (_Module) {
  9455. _inherits(Formula, _Module);
  9456. _createClass(Formula, null, [{
  9457. key: 'register',
  9458. value: function register() {
  9459. _quill2.default.register(FormulaBlot, true);
  9460. }
  9461. }]);
  9462. function Formula() {
  9463. _classCallCheck(this, Formula);
  9464. var _this2 = _possibleConstructorReturn(this, (Formula.__proto__ || Object.getPrototypeOf(Formula)).call(this));
  9465. if (window.katex == null) {
  9466. throw new Error('Formula module requires KaTeX.');
  9467. }
  9468. return _this2;
  9469. }
  9470. return Formula;
  9471. }(_module2.default);
  9472. exports.FormulaBlot = FormulaBlot;
  9473. exports.default = Formula;
  9474. /***/ }),
  9475. /* 75 */
  9476. /***/ (function(module, exports, __webpack_require__) {
  9477. "use strict";
  9478. Object.defineProperty(exports, "__esModule", {
  9479. value: true
  9480. });
  9481. exports.default = exports.CodeToken = exports.CodeBlock = undefined;
  9482. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9483. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9484. var _parchment = __webpack_require__(0);
  9485. var _parchment2 = _interopRequireDefault(_parchment);
  9486. var _quill = __webpack_require__(5);
  9487. var _quill2 = _interopRequireDefault(_quill);
  9488. var _module = __webpack_require__(9);
  9489. var _module2 = _interopRequireDefault(_module);
  9490. var _code = __webpack_require__(13);
  9491. var _code2 = _interopRequireDefault(_code);
  9492. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9493. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9494. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9495. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9496. var SyntaxCodeBlock = function (_CodeBlock) {
  9497. _inherits(SyntaxCodeBlock, _CodeBlock);
  9498. function SyntaxCodeBlock() {
  9499. _classCallCheck(this, SyntaxCodeBlock);
  9500. return _possibleConstructorReturn(this, (SyntaxCodeBlock.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock)).apply(this, arguments));
  9501. }
  9502. _createClass(SyntaxCodeBlock, [{
  9503. key: 'replaceWith',
  9504. value: function replaceWith(block) {
  9505. this.domNode.textContent = this.domNode.textContent;
  9506. this.attach();
  9507. _get(SyntaxCodeBlock.prototype.__proto__ || Object.getPrototypeOf(SyntaxCodeBlock.prototype), 'replaceWith', this).call(this, block);
  9508. }
  9509. }, {
  9510. key: 'highlight',
  9511. value: function highlight(_highlight) {
  9512. var text = this.domNode.textContent;
  9513. if (this.cachedText !== text) {
  9514. if (text.trim().length > 0 || this.cachedText == null) {
  9515. this.domNode.innerHTML = _highlight(text);
  9516. this.domNode.normalize();
  9517. this.attach();
  9518. }
  9519. this.cachedText = text;
  9520. }
  9521. }
  9522. }]);
  9523. return SyntaxCodeBlock;
  9524. }(_code2.default);
  9525. SyntaxCodeBlock.className = 'ql-syntax';
  9526. var CodeToken = new _parchment2.default.Attributor.Class('token', 'hljs', {
  9527. scope: _parchment2.default.Scope.INLINE
  9528. });
  9529. var Syntax = function (_Module) {
  9530. _inherits(Syntax, _Module);
  9531. _createClass(Syntax, null, [{
  9532. key: 'register',
  9533. value: function register() {
  9534. _quill2.default.register(CodeToken, true);
  9535. _quill2.default.register(SyntaxCodeBlock, true);
  9536. }
  9537. }]);
  9538. function Syntax(quill, options) {
  9539. _classCallCheck(this, Syntax);
  9540. var _this2 = _possibleConstructorReturn(this, (Syntax.__proto__ || Object.getPrototypeOf(Syntax)).call(this, quill, options));
  9541. if (typeof _this2.options.highlight !== 'function') {
  9542. throw new Error('Syntax module requires highlight.js. Please include the library on the page before Quill.');
  9543. }
  9544. var timer = null;
  9545. _this2.quill.on(_quill2.default.events.SCROLL_OPTIMIZE, function () {
  9546. clearTimeout(timer);
  9547. timer = setTimeout(function () {
  9548. _this2.highlight();
  9549. timer = null;
  9550. }, _this2.options.interval);
  9551. });
  9552. _this2.highlight();
  9553. return _this2;
  9554. }
  9555. _createClass(Syntax, [{
  9556. key: 'highlight',
  9557. value: function highlight() {
  9558. var _this3 = this;
  9559. if (this.quill.selection.composing) return;
  9560. this.quill.update(_quill2.default.sources.USER);
  9561. var range = this.quill.getSelection();
  9562. this.quill.scroll.descendants(SyntaxCodeBlock).forEach(function (code) {
  9563. code.highlight(_this3.options.highlight);
  9564. });
  9565. this.quill.update(_quill2.default.sources.SILENT);
  9566. if (range != null) {
  9567. this.quill.setSelection(range, _quill2.default.sources.SILENT);
  9568. }
  9569. }
  9570. }]);
  9571. return Syntax;
  9572. }(_module2.default);
  9573. Syntax.DEFAULTS = {
  9574. highlight: function () {
  9575. if (window.hljs == null) return null;
  9576. return function (text) {
  9577. var result = window.hljs.highlightAuto(text);
  9578. return result.value;
  9579. };
  9580. }(),
  9581. interval: 1000
  9582. };
  9583. exports.CodeBlock = SyntaxCodeBlock;
  9584. exports.CodeToken = CodeToken;
  9585. exports.default = Syntax;
  9586. /***/ }),
  9587. /* 76 */
  9588. /***/ (function(module, exports) {
  9589. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=13 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=9 y1=4 y2=4></line> </svg>";
  9590. /***/ }),
  9591. /* 77 */
  9592. /***/ (function(module, exports) {
  9593. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=14 x2=4 y1=14 y2=14></line> <line class=ql-stroke x1=12 x2=6 y1=4 y2=4></line> </svg>";
  9594. /***/ }),
  9595. /* 78 */
  9596. /***/ (function(module, exports) {
  9597. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=5 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=9 y1=4 y2=4></line> </svg>";
  9598. /***/ }),
  9599. /* 79 */
  9600. /***/ (function(module, exports) {
  9601. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=15 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=15 x2=3 y1=14 y2=14></line> <line class=ql-stroke x1=15 x2=3 y1=4 y2=4></line> </svg>";
  9602. /***/ }),
  9603. /* 80 */
  9604. /***/ (function(module, exports) {
  9605. module.exports = "<svg viewbox=\"0 0 18 18\"> <g class=\"ql-fill ql-color-label\"> <polygon points=\"6 6.868 6 6 5 6 5 7 5.942 7 6 6.868\"></polygon> <rect height=1 width=1 x=4 y=4></rect> <polygon points=\"6.817 5 6 5 6 6 6.38 6 6.817 5\"></polygon> <rect height=1 width=1 x=2 y=6></rect> <rect height=1 width=1 x=3 y=5></rect> <rect height=1 width=1 x=4 y=7></rect> <polygon points=\"4 11.439 4 11 3 11 3 12 3.755 12 4 11.439\"></polygon> <rect height=1 width=1 x=2 y=12></rect> <rect height=1 width=1 x=2 y=9></rect> <rect height=1 width=1 x=2 y=15></rect> <polygon points=\"4.63 10 4 10 4 11 4.192 11 4.63 10\"></polygon> <rect height=1 width=1 x=3 y=8></rect> <path d=M10.832,4.2L11,4.582V4H10.708A1.948,1.948,0,0,1,10.832,4.2Z></path> <path d=M7,4.582L7.168,4.2A1.929,1.929,0,0,1,7.292,4H7V4.582Z></path> <path d=M8,13H7.683l-0.351.8a1.933,1.933,0,0,1-.124.2H8V13Z></path> <rect height=1 width=1 x=12 y=2></rect> <rect height=1 width=1 x=11 y=3></rect> <path d=M9,3H8V3.282A1.985,1.985,0,0,1,9,3Z></path> <rect height=1 width=1 x=2 y=3></rect> <rect height=1 width=1 x=6 y=2></rect> <rect height=1 width=1 x=3 y=2></rect> <rect height=1 width=1 x=5 y=3></rect> <rect height=1 width=1 x=9 y=2></rect> <rect height=1 width=1 x=15 y=14></rect> <polygon points=\"13.447 10.174 13.469 10.225 13.472 10.232 13.808 11 14 11 14 10 13.37 10 13.447 10.174\"></polygon> <rect height=1 width=1 x=13 y=7></rect> <rect height=1 width=1 x=15 y=5></rect> <rect height=1 width=1 x=14 y=6></rect> <rect height=1 width=1 x=15 y=8></rect> <rect height=1 width=1 x=14 y=9></rect> <path d=M3.775,14H3v1H4V14.314A1.97,1.97,0,0,1,3.775,14Z></path> <rect height=1 width=1 x=14 y=3></rect> <polygon points=\"12 6.868 12 6 11.62 6 12 6.868\"></polygon> <rect height=1 width=1 x=15 y=2></rect> <rect height=1 width=1 x=12 y=5></rect> <rect height=1 width=1 x=13 y=4></rect> <polygon points=\"12.933 9 13 9 13 8 12.495 8 12.933 9\"></polygon> <rect height=1 width=1 x=9 y=14></rect> <rect height=1 width=1 x=8 y=15></rect> <path d=M6,14.926V15H7V14.316A1.993,1.993,0,0,1,6,14.926Z></path> <rect height=1 width=1 x=5 y=15></rect> <path d=M10.668,13.8L10.317,13H10v1h0.792A1.947,1.947,0,0,1,10.668,13.8Z></path> <rect height=1 width=1 x=11 y=15></rect> <path d=M14.332,12.2a1.99,1.99,0,0,1,.166.8H15V12H14.245Z></path> <rect height=1 width=1 x=14 y=15></rect> <rect height=1 width=1 x=15 y=11></rect> </g> <polyline class=ql-stroke points=\"5.5 13 9 5 12.5 13\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=11 y2=11></line> </svg>";
  9606. /***/ }),
  9607. /* 81 */
  9608. /***/ (function(module, exports) {
  9609. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=4 y=5></rect> <rect class=\"ql-fill ql-stroke\" height=3 width=3 x=11 y=5></rect> <path class=\"ql-even ql-fill ql-stroke\" d=M7,8c0,4.031-3,5-3,5></path> <path class=\"ql-even ql-fill ql-stroke\" d=M14,8c0,4.031-3,5-3,5></path> </svg>";
  9610. /***/ }),
  9611. /* 82 */
  9612. /***/ (function(module, exports) {
  9613. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,4H9.5A2.5,2.5,0,0,1,12,6.5v0A2.5,2.5,0,0,1,9.5,9H5A0,0,0,0,1,5,9V4A0,0,0,0,1,5,4Z></path> <path class=ql-stroke d=M5,9h5.5A2.5,2.5,0,0,1,13,11.5v0A2.5,2.5,0,0,1,10.5,14H5a0,0,0,0,1,0,0V9A0,0,0,0,1,5,9Z></path> </svg>";
  9614. /***/ }),
  9615. /* 83 */
  9616. /***/ (function(module, exports) {
  9617. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=5 x2=13 y1=3 y2=3></line> <line class=ql-stroke x1=6 x2=9.35 y1=12 y2=3></line> <line class=ql-stroke x1=11 x2=15 y1=11 y2=15></line> <line class=ql-stroke x1=15 x2=11 y1=11 y2=15></line> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=7 x=2 y=14></rect> </svg>";
  9618. /***/ }),
  9619. /* 84 */
  9620. /***/ (function(module, exports) {
  9621. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-color-label ql-stroke ql-transparent\" x1=3 x2=15 y1=15 y2=15></line> <polyline class=ql-stroke points=\"5.5 11 9 3 12.5 11\"></polyline> <line class=ql-stroke x1=11.63 x2=6.38 y1=9 y2=9></line> </svg>";
  9622. /***/ }),
  9623. /* 85 */
  9624. /***/ (function(module, exports) {
  9625. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"3 11 5 9 3 7 3 11\"></polygon> <line class=\"ql-stroke ql-fill\" x1=15 x2=11 y1=4 y2=4></line> <path class=ql-fill d=M11,3a3,3,0,0,0,0,6h1V3H11Z></path> <rect class=ql-fill height=11 width=1 x=11 y=4></rect> <rect class=ql-fill height=11 width=1 x=13 y=4></rect> </svg>";
  9626. /***/ }),
  9627. /* 86 */
  9628. /***/ (function(module, exports) {
  9629. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=\"ql-stroke ql-fill\" points=\"15 12 13 10 15 8 15 12\"></polygon> <line class=\"ql-stroke ql-fill\" x1=9 x2=5 y1=4 y2=4></line> <path class=ql-fill d=M5,3A3,3,0,0,0,5,9H6V3H5Z></path> <rect class=ql-fill height=11 width=1 x=5 y=4></rect> <rect class=ql-fill height=11 width=1 x=7 y=4></rect> </svg>";
  9630. /***/ }),
  9631. /* 87 */
  9632. /***/ (function(module, exports) {
  9633. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M14,16H4a1,1,0,0,1,0-2H14A1,1,0,0,1,14,16Z /> <path class=ql-fill d=M14,4H4A1,1,0,0,1,4,2H14A1,1,0,0,1,14,4Z /> <rect class=ql-fill x=3 y=6 width=12 height=6 rx=1 ry=1 /> </svg>";
  9634. /***/ }),
  9635. /* 88 */
  9636. /***/ (function(module, exports) {
  9637. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M13,16H5a1,1,0,0,1,0-2h8A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H5A1,1,0,0,1,5,2h8A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=2 y=6 width=14 height=6 rx=1 ry=1 /> </svg>";
  9638. /***/ }),
  9639. /* 89 */
  9640. /***/ (function(module, exports) {
  9641. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15,8H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,8Z /> <path class=ql-fill d=M15,12H13a1,1,0,0,1,0-2h2A1,1,0,0,1,15,12Z /> <path class=ql-fill d=M15,16H5a1,1,0,0,1,0-2H15A1,1,0,0,1,15,16Z /> <path class=ql-fill d=M15,4H5A1,1,0,0,1,5,2H15A1,1,0,0,1,15,4Z /> <rect class=ql-fill x=2 y=6 width=8 height=6 rx=1 ry=1 /> </svg>";
  9642. /***/ }),
  9643. /* 90 */
  9644. /***/ (function(module, exports) {
  9645. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M5,8H3A1,1,0,0,1,3,6H5A1,1,0,0,1,5,8Z /> <path class=ql-fill d=M5,12H3a1,1,0,0,1,0-2H5A1,1,0,0,1,5,12Z /> <path class=ql-fill d=M13,16H3a1,1,0,0,1,0-2H13A1,1,0,0,1,13,16Z /> <path class=ql-fill d=M13,4H3A1,1,0,0,1,3,2H13A1,1,0,0,1,13,4Z /> <rect class=ql-fill x=8 y=6 width=8 height=6 rx=1 ry=1 transform=\"translate(24 18) rotate(-180)\"/> </svg>";
  9646. /***/ }),
  9647. /* 91 */
  9648. /***/ (function(module, exports) {
  9649. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M11.759,2.482a2.561,2.561,0,0,0-3.53.607A7.656,7.656,0,0,0,6.8,6.2C6.109,9.188,5.275,14.677,4.15,14.927a1.545,1.545,0,0,0-1.3-.933A0.922,0.922,0,0,0,2,15.036S1.954,16,4.119,16s3.091-2.691,3.7-5.553c0.177-.826.36-1.726,0.554-2.6L8.775,6.2c0.381-1.421.807-2.521,1.306-2.676a1.014,1.014,0,0,0,1.02.56A0.966,0.966,0,0,0,11.759,2.482Z></path> <rect class=ql-fill height=1.6 rx=0.8 ry=0.8 width=5 x=5.15 y=6.2></rect> <path class=ql-fill d=M13.663,12.027a1.662,1.662,0,0,1,.266-0.276q0.193,0.069.456,0.138a2.1,2.1,0,0,0,.535.069,1.075,1.075,0,0,0,.767-0.3,1.044,1.044,0,0,0,.314-0.8,0.84,0.84,0,0,0-.238-0.619,0.8,0.8,0,0,0-.594-0.239,1.154,1.154,0,0,0-.781.3,4.607,4.607,0,0,0-.781,1q-0.091.15-.218,0.346l-0.246.38c-0.068-.288-0.137-0.582-0.212-0.885-0.459-1.847-2.494-.984-2.941-0.8-0.482.2-.353,0.647-0.094,0.529a0.869,0.869,0,0,1,1.281.585c0.217,0.751.377,1.436,0.527,2.038a5.688,5.688,0,0,1-.362.467,2.69,2.69,0,0,1-.264.271q-0.221-.08-0.471-0.147a2.029,2.029,0,0,0-.522-0.066,1.079,1.079,0,0,0-.768.3A1.058,1.058,0,0,0,9,15.131a0.82,0.82,0,0,0,.832.852,1.134,1.134,0,0,0,.787-0.3,5.11,5.11,0,0,0,.776-0.993q0.141-.219.215-0.34c0.046-.076.122-0.194,0.223-0.346a2.786,2.786,0,0,0,.918,1.726,2.582,2.582,0,0,0,2.376-.185c0.317-.181.212-0.565,0-0.494A0.807,0.807,0,0,1,14.176,15a5.159,5.159,0,0,1-.913-2.446l0,0Q13.487,12.24,13.663,12.027Z></path> </svg>";
  9650. /***/ }),
  9651. /* 92 */
  9652. /***/ (function(module, exports) {
  9653. module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M10,4V14a1,1,0,0,1-2,0V10H3v4a1,1,0,0,1-2,0V4A1,1,0,0,1,3,4V8H8V4a1,1,0,0,1,2,0Zm6.06787,9.209H14.98975V7.59863a.54085.54085,0,0,0-.605-.60547h-.62744a1.01119,1.01119,0,0,0-.748.29688L11.645,8.56641a.5435.5435,0,0,0-.022.8584l.28613.30762a.53861.53861,0,0,0,.84717.0332l.09912-.08789a1.2137,1.2137,0,0,0,.2417-.35254h.02246s-.01123.30859-.01123.60547V13.209H12.041a.54085.54085,0,0,0-.605.60547v.43945a.54085.54085,0,0,0,.605.60547h4.02686a.54085.54085,0,0,0,.605-.60547v-.43945A.54085.54085,0,0,0,16.06787,13.209Z /> </svg>";
  9654. /***/ }),
  9655. /* 93 */
  9656. /***/ (function(module, exports) {
  9657. module.exports = "<svg viewBox=\"0 0 18 18\"> <path class=ql-fill d=M16.73975,13.81445v.43945a.54085.54085,0,0,1-.605.60547H11.855a.58392.58392,0,0,1-.64893-.60547V14.0127c0-2.90527,3.39941-3.42187,3.39941-4.55469a.77675.77675,0,0,0-.84717-.78125,1.17684,1.17684,0,0,0-.83594.38477c-.2749.26367-.561.374-.85791.13184l-.4292-.34082c-.30811-.24219-.38525-.51758-.1543-.81445a2.97155,2.97155,0,0,1,2.45361-1.17676,2.45393,2.45393,0,0,1,2.68408,2.40918c0,2.45312-3.1792,2.92676-3.27832,3.93848h2.79443A.54085.54085,0,0,1,16.73975,13.81445ZM9,3A.99974.99974,0,0,0,8,4V8H3V4A1,1,0,0,0,1,4V14a1,1,0,0,0,2,0V10H8v4a1,1,0,0,0,2,0V4A.99974.99974,0,0,0,9,3Z /> </svg>";
  9658. /***/ }),
  9659. /* 94 */
  9660. /***/ (function(module, exports) {
  9661. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=13 y1=4 y2=4></line> <line class=ql-stroke x1=5 x2=11 y1=14 y2=14></line> <line class=ql-stroke x1=8 x2=10 y1=14 y2=4></line> </svg>";
  9662. /***/ }),
  9663. /* 95 */
  9664. /***/ (function(module, exports) {
  9665. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=10 width=12 x=3 y=4></rect> <circle class=ql-fill cx=6 cy=7 r=1></circle> <polyline class=\"ql-even ql-fill\" points=\"5 12 5 11 7 9 8 10 11 7 13 9 13 12 5 12\"></polyline> </svg>";
  9666. /***/ }),
  9667. /* 96 */
  9668. /***/ (function(module, exports) {
  9669. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=\"ql-fill ql-stroke\" points=\"3 7 3 11 5 9 3 7\"></polyline> </svg>";
  9670. /***/ }),
  9671. /* 97 */
  9672. /***/ (function(module, exports) {
  9673. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=3 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"5 7 5 11 3 9 5 7\"></polyline> </svg>";
  9674. /***/ }),
  9675. /* 98 */
  9676. /***/ (function(module, exports) {
  9677. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=11 y1=7 y2=11></line> <path class=\"ql-even ql-stroke\" d=M8.9,4.577a3.476,3.476,0,0,1,.36,4.679A3.476,3.476,0,0,1,4.577,8.9C3.185,7.5,2.035,6.4,4.217,4.217S7.5,3.185,8.9,4.577Z></path> <path class=\"ql-even ql-stroke\" d=M13.423,9.1a3.476,3.476,0,0,0-4.679-.36,3.476,3.476,0,0,0,.36,4.679c1.392,1.392,2.5,2.542,4.679.36S14.815,10.5,13.423,9.1Z></path> </svg>";
  9678. /***/ }),
  9679. /* 99 */
  9680. /***/ (function(module, exports) {
  9681. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=7 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=7 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=7 x2=15 y1=14 y2=14></line> <line class=\"ql-stroke ql-thin\" x1=2.5 x2=4.5 y1=5.5 y2=5.5></line> <path class=ql-fill d=M3.5,6A0.5,0.5,0,0,1,3,5.5V3.085l-0.276.138A0.5,0.5,0,0,1,2.053,3c-0.124-.247-0.023-0.324.224-0.447l1-.5A0.5,0.5,0,0,1,4,2.5v3A0.5,0.5,0,0,1,3.5,6Z></path> <path class=\"ql-stroke ql-thin\" d=M4.5,10.5h-2c0-.234,1.85-1.076,1.85-2.234A0.959,0.959,0,0,0,2.5,8.156></path> <path class=\"ql-stroke ql-thin\" d=M2.5,14.846a0.959,0.959,0,0,0,1.85-.109A0.7,0.7,0,0,0,3.75,14a0.688,0.688,0,0,0,.6-0.736,0.959,0.959,0,0,0-1.85-.109></path> </svg>";
  9682. /***/ }),
  9683. /* 100 */
  9684. /***/ (function(module, exports) {
  9685. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=6 x2=15 y1=4 y2=4></line> <line class=ql-stroke x1=6 x2=15 y1=9 y2=9></line> <line class=ql-stroke x1=6 x2=15 y1=14 y2=14></line> <line class=ql-stroke x1=3 x2=3 y1=4 y2=4></line> <line class=ql-stroke x1=3 x2=3 y1=9 y2=9></line> <line class=ql-stroke x1=3 x2=3 y1=14 y2=14></line> </svg>";
  9686. /***/ }),
  9687. /* 101 */
  9688. /***/ (function(module, exports) {
  9689. module.exports = "<svg class=\"\" viewbox=\"0 0 18 18\"> <line class=ql-stroke x1=9 x2=15 y1=4 y2=4></line> <polyline class=ql-stroke points=\"3 4 4 5 6 3\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=14 y2=14></line> <polyline class=ql-stroke points=\"3 14 4 15 6 13\"></polyline> <line class=ql-stroke x1=9 x2=15 y1=9 y2=9></line> <polyline class=ql-stroke points=\"3 9 4 10 6 8\"></polyline> </svg>";
  9690. /***/ }),
  9691. /* 102 */
  9692. /***/ (function(module, exports) {
  9693. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,15H13.861a3.858,3.858,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.921,1.921,0,0,0,12.021,11.7a0.50013,0.50013,0,1,0,.957.291h0a0.914,0.914,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.076-1.16971,1.86982-1.93971,2.43082A1.45639,1.45639,0,0,0,12,15.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,15Z /> <path class=ql-fill d=M9.65,5.241a1,1,0,0,0-1.409.108L6,7.964,3.759,5.349A1,1,0,0,0,2.192,6.59178Q2.21541,6.6213,2.241,6.649L4.684,9.5,2.241,12.35A1,1,0,0,0,3.71,13.70722q0.02557-.02768.049-0.05722L6,11.036,8.241,13.65a1,1,0,1,0,1.567-1.24277Q9.78459,12.3777,9.759,12.35L7.316,9.5,9.759,6.651A1,1,0,0,0,9.65,5.241Z /> </svg>";
  9694. /***/ }),
  9695. /* 103 */
  9696. /***/ (function(module, exports) {
  9697. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-fill d=M15.5,7H13.861a4.015,4.015,0,0,0,1.914-2.975,1.8,1.8,0,0,0-1.6-1.751A1.922,1.922,0,0,0,12.021,3.7a0.5,0.5,0,1,0,.957.291,0.917,0.917,0,0,1,1.053-.725,0.81,0.81,0,0,1,.744.762c0,1.077-1.164,1.925-1.934,2.486A1.423,1.423,0,0,0,12,7.5a0.5,0.5,0,0,0,.5.5h3A0.5,0.5,0,0,0,15.5,7Z /> <path class=ql-fill d=M9.651,5.241a1,1,0,0,0-1.41.108L6,7.964,3.759,5.349a1,1,0,1,0-1.519,1.3L4.683,9.5,2.241,12.35a1,1,0,1,0,1.519,1.3L6,11.036,8.241,13.65a1,1,0,0,0,1.519-1.3L7.317,9.5,9.759,6.651A1,1,0,0,0,9.651,5.241Z /> </svg>";
  9698. /***/ }),
  9699. /* 104 */
  9700. /***/ (function(module, exports) {
  9701. module.exports = "<svg viewbox=\"0 0 18 18\"> <line class=\"ql-stroke ql-thin\" x1=15.5 x2=2.5 y1=8.5 y2=9.5></line> <path class=ql-fill d=M9.007,8C6.542,7.791,6,7.519,6,6.5,6,5.792,7.283,5,9,5c1.571,0,2.765.679,2.969,1.309a1,1,0,0,0,1.9-.617C13.356,4.106,11.354,3,9,3,6.2,3,4,4.538,4,6.5a3.2,3.2,0,0,0,.5,1.843Z></path> <path class=ql-fill d=M8.984,10C11.457,10.208,12,10.479,12,11.5c0,0.708-1.283,1.5-3,1.5-1.571,0-2.765-.679-2.969-1.309a1,1,0,1,0-1.9.617C4.644,13.894,6.646,15,9,15c2.8,0,5-1.538,5-3.5a3.2,3.2,0,0,0-.5-1.843Z></path> </svg>";
  9702. /***/ }),
  9703. /* 105 */
  9704. /***/ (function(module, exports) {
  9705. module.exports = "<svg viewbox=\"0 0 18 18\"> <path class=ql-stroke d=M5,3V9a4.012,4.012,0,0,0,4,4H9a4.012,4.012,0,0,0,4-4V3></path> <rect class=ql-fill height=1 rx=0.5 ry=0.5 width=12 x=3 y=15></rect> </svg>";
  9706. /***/ }),
  9707. /* 106 */
  9708. /***/ (function(module, exports) {
  9709. module.exports = "<svg viewbox=\"0 0 18 18\"> <rect class=ql-stroke height=12 width=12 x=3 y=3></rect> <rect class=ql-fill height=12 width=1 x=5 y=3></rect> <rect class=ql-fill height=12 width=1 x=12 y=3></rect> <rect class=ql-fill height=2 width=8 x=5 y=8></rect> <rect class=ql-fill height=1 width=3 x=3 y=5></rect> <rect class=ql-fill height=1 width=3 x=3 y=7></rect> <rect class=ql-fill height=1 width=3 x=3 y=10></rect> <rect class=ql-fill height=1 width=3 x=3 y=12></rect> <rect class=ql-fill height=1 width=3 x=12 y=5></rect> <rect class=ql-fill height=1 width=3 x=12 y=7></rect> <rect class=ql-fill height=1 width=3 x=12 y=10></rect> <rect class=ql-fill height=1 width=3 x=12 y=12></rect> </svg>";
  9710. /***/ }),
  9711. /* 107 */
  9712. /***/ (function(module, exports) {
  9713. module.exports = "<svg viewbox=\"0 0 18 18\"> <polygon class=ql-stroke points=\"7 11 9 13 11 11 7 11\"></polygon> <polygon class=ql-stroke points=\"7 7 9 5 11 7 7 7\"></polygon> </svg>";
  9714. /***/ }),
  9715. /* 108 */
  9716. /***/ (function(module, exports, __webpack_require__) {
  9717. "use strict";
  9718. Object.defineProperty(exports, "__esModule", {
  9719. value: true
  9720. });
  9721. exports.default = exports.BubbleTooltip = undefined;
  9722. var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
  9723. var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
  9724. var _extend = __webpack_require__(3);
  9725. var _extend2 = _interopRequireDefault(_extend);
  9726. var _emitter = __webpack_require__(8);
  9727. var _emitter2 = _interopRequireDefault(_emitter);
  9728. var _base = __webpack_require__(43);
  9729. var _base2 = _interopRequireDefault(_base);
  9730. var _selection = __webpack_require__(15);
  9731. var _icons = __webpack_require__(41);
  9732. var _icons2 = _interopRequireDefault(_icons);
  9733. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9734. function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
  9735. function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
  9736. function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
  9737. var TOOLBAR_CONFIG = [['bold', 'italic', 'link'], [{ header: 1 }, { header: 2 }, 'blockquote']];
  9738. var BubbleTheme = function (_BaseTheme) {
  9739. _inherits(BubbleTheme, _BaseTheme);
  9740. function BubbleTheme(quill, options) {
  9741. _classCallCheck(this, BubbleTheme);
  9742. if (options.modules.toolbar != null && options.modules.toolbar.container == null) {
  9743. options.modules.toolbar.container = TOOLBAR_CONFIG;
  9744. }
  9745. var _this = _possibleConstructorReturn(this, (BubbleTheme.__proto__ || Object.getPrototypeOf(BubbleTheme)).call(this, quill, options));
  9746. _this.quill.container.classList.add('ql-bubble');
  9747. return _this;
  9748. }
  9749. _createClass(BubbleTheme, [{
  9750. key: 'extendToolbar',
  9751. value: function extendToolbar(toolbar) {
  9752. this.tooltip = new BubbleTooltip(this.quill, this.options.bounds);
  9753. this.tooltip.root.appendChild(toolbar.container);
  9754. this.buildButtons([].slice.call(toolbar.container.querySelectorAll('button')), _icons2.default);
  9755. this.buildPickers([].slice.call(toolbar.container.querySelectorAll('select')), _icons2.default);
  9756. }
  9757. }]);
  9758. return BubbleTheme;
  9759. }(_base2.default);
  9760. BubbleTheme.DEFAULTS = (0, _extend2.default)(true, {}, _base2.default.DEFAULTS, {
  9761. modules: {
  9762. toolbar: {
  9763. handlers: {
  9764. link: function link(value) {
  9765. if (!value) {
  9766. this.quill.format('link', false);
  9767. } else {
  9768. this.quill.theme.tooltip.edit();
  9769. }
  9770. }
  9771. }
  9772. }
  9773. }
  9774. });
  9775. var BubbleTooltip = function (_BaseTooltip) {
  9776. _inherits(BubbleTooltip, _BaseTooltip);
  9777. function BubbleTooltip(quill, bounds) {
  9778. _classCallCheck(this, BubbleTooltip);
  9779. var _this2 = _possibleConstructorReturn(this, (BubbleTooltip.__proto__ || Object.getPrototypeOf(BubbleTooltip)).call(this, quill, bounds));
  9780. _this2.quill.on(_emitter2.default.events.EDITOR_CHANGE, function (type, range, oldRange, source) {
  9781. if (type !== _emitter2.default.events.SELECTION_CHANGE) return;
  9782. if (range != null && range.length > 0 && source === _emitter2.default.sources.USER) {
  9783. _this2.show();
  9784. // Lock our width so we will expand beyond our offsetParent boundaries
  9785. _this2.root.style.left = '0px';
  9786. _this2.root.style.width = '';
  9787. _this2.root.style.width = _this2.root.offsetWidth + 'px';
  9788. var lines = _this2.quill.getLines(range.index, range.length);
  9789. if (lines.length === 1) {
  9790. _this2.position(_this2.quill.getBounds(range));
  9791. } else {
  9792. var lastLine = lines[lines.length - 1];
  9793. var index = _this2.quill.getIndex(lastLine);
  9794. var length = Math.min(lastLine.length() - 1, range.index + range.length - index);
  9795. var _bounds = _this2.quill.getBounds(new _selection.Range(index, length));
  9796. _this2.position(_bounds);
  9797. }
  9798. } else if (document.activeElement !== _this2.textbox && _this2.quill.hasFocus()) {
  9799. _this2.hide();
  9800. }
  9801. });
  9802. return _this2;
  9803. }
  9804. _createClass(BubbleTooltip, [{
  9805. key: 'listen',
  9806. value: function listen() {
  9807. var _this3 = this;
  9808. _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'listen', this).call(this);
  9809. this.root.querySelector('.ql-close').addEventListener('click', function () {
  9810. _this3.root.classList.remove('ql-editing');
  9811. });
  9812. this.quill.on(_emitter2.default.events.SCROLL_OPTIMIZE, function () {
  9813. // Let selection be restored by toolbar handlers before repositioning
  9814. setTimeout(function () {
  9815. if (_this3.root.classList.contains('ql-hidden')) return;
  9816. var range = _this3.quill.getSelection();
  9817. if (range != null) {
  9818. _this3.position(_this3.quill.getBounds(range));
  9819. }
  9820. }, 1);
  9821. });
  9822. }
  9823. }, {
  9824. key: 'cancel',
  9825. value: function cancel() {
  9826. this.show();
  9827. }
  9828. }, {
  9829. key: 'position',
  9830. value: function position(reference) {
  9831. var shift = _get(BubbleTooltip.prototype.__proto__ || Object.getPrototypeOf(BubbleTooltip.prototype), 'position', this).call(this, reference);
  9832. var arrow = this.root.querySelector('.ql-tooltip-arrow');
  9833. arrow.style.marginLeft = '';
  9834. if (shift === 0) return shift;
  9835. arrow.style.marginLeft = -1 * shift - arrow.offsetWidth / 2 + 'px';
  9836. }
  9837. }]);
  9838. return BubbleTooltip;
  9839. }(_base.BaseTooltip);
  9840. BubbleTooltip.TEMPLATE = ['<span class="ql-tooltip-arrow"></span>', '<div class="ql-tooltip-editor">', '<input type="text" data-formula="e=mc^2" data-link="https://quilljs.com" data-video="Embed URL">', '<a class="ql-close"></a>', '</div>'].join('');
  9841. exports.BubbleTooltip = BubbleTooltip;
  9842. exports.default = BubbleTheme;
  9843. /***/ }),
  9844. /* 109 */
  9845. /***/ (function(module, exports, __webpack_require__) {
  9846. module.exports = __webpack_require__(63);
  9847. /***/ })
  9848. /******/ ])["default"];
  9849. });
  9850. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("fd40").Buffer))
  9851. /***/ }),
  9852. /***/ "0a60":
  9853. /***/ (function(module, exports) {
  9854. exports.f = Object.getOwnPropertySymbols;
  9855. /***/ }),
  9856. /***/ "0fc1":
  9857. /***/ (function(module, exports, __webpack_require__) {
  9858. var DESCRIPTORS = __webpack_require__("1e2c");
  9859. var definePropertyModule = __webpack_require__("d910");
  9860. var createPropertyDescriptor = __webpack_require__("38b9");
  9861. module.exports = DESCRIPTORS ? function (object, key, value) {
  9862. return definePropertyModule.f(object, key, createPropertyDescriptor(1, value));
  9863. } : function (object, key, value) {
  9864. object[key] = value;
  9865. return object;
  9866. };
  9867. /***/ }),
  9868. /***/ "1025":
  9869. /***/ (function(module, exports, __webpack_require__) {
  9870. var store = __webpack_require__("3a08");
  9871. var functionToString = Function.toString;
  9872. // this helper broken in `3.4.1-3.4.4`, so we can't use `shared` helper
  9873. if (typeof store.inspectSource != 'function') {
  9874. store.inspectSource = function (it) {
  9875. return functionToString.call(it);
  9876. };
  9877. }
  9878. module.exports = store.inspectSource;
  9879. /***/ }),
  9880. /***/ "121a":
  9881. /***/ (function(module, exports, __webpack_require__) {
  9882. // extracted by mini-css-extract-plugin
  9883. /***/ }),
  9884. /***/ "18f6":
  9885. /***/ (function(module, exports) {
  9886. // IE8- don't enum bug keys
  9887. module.exports = [
  9888. 'constructor',
  9889. 'hasOwnProperty',
  9890. 'isPrototypeOf',
  9891. 'propertyIsEnumerable',
  9892. 'toLocaleString',
  9893. 'toString',
  9894. 'valueOf'
  9895. ];
  9896. /***/ }),
  9897. /***/ "1944":
  9898. /***/ (function(module, exports, __webpack_require__) {
  9899. var global = __webpack_require__("d890");
  9900. var createNonEnumerableProperty = __webpack_require__("0fc1");
  9901. var has = __webpack_require__("faa8");
  9902. var setGlobal = __webpack_require__("e4db");
  9903. var inspectSource = __webpack_require__("1025");
  9904. var InternalStateModule = __webpack_require__("b702");
  9905. var getInternalState = InternalStateModule.get;
  9906. var enforceInternalState = InternalStateModule.enforce;
  9907. var TEMPLATE = String(String).split('String');
  9908. (module.exports = function (O, key, value, options) {
  9909. var unsafe = options ? !!options.unsafe : false;
  9910. var simple = options ? !!options.enumerable : false;
  9911. var noTargetGet = options ? !!options.noTargetGet : false;
  9912. if (typeof value == 'function') {
  9913. if (typeof key == 'string' && !has(value, 'name')) createNonEnumerableProperty(value, 'name', key);
  9914. enforceInternalState(value).source = TEMPLATE.join(typeof key == 'string' ? key : '');
  9915. }
  9916. if (O === global) {
  9917. if (simple) O[key] = value;
  9918. else setGlobal(key, value);
  9919. return;
  9920. } else if (!unsafe) {
  9921. delete O[key];
  9922. } else if (!noTargetGet && O[key]) {
  9923. simple = true;
  9924. }
  9925. if (simple) O[key] = value;
  9926. else createNonEnumerableProperty(O, key, value);
  9927. // add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
  9928. })(Function.prototype, 'toString', function toString() {
  9929. return typeof this == 'function' && getInternalState(this).source || inspectSource(this);
  9930. });
  9931. /***/ }),
  9932. /***/ "1b99":
  9933. /***/ (function(module, exports, __webpack_require__) {
  9934. var global = __webpack_require__("d890");
  9935. module.exports = global;
  9936. /***/ }),
  9937. /***/ "1bbd":
  9938. /***/ (function(module, exports, __webpack_require__) {
  9939. "use strict";
  9940. var toPrimitive = __webpack_require__("9f67");
  9941. var definePropertyModule = __webpack_require__("d910");
  9942. var createPropertyDescriptor = __webpack_require__("38b9");
  9943. module.exports = function (object, key, value) {
  9944. var propertyKey = toPrimitive(key);
  9945. if (propertyKey in object) definePropertyModule.f(object, propertyKey, createPropertyDescriptor(0, value));
  9946. else object[propertyKey] = value;
  9947. };
  9948. /***/ }),
  9949. /***/ "1c8b":
  9950. /***/ (function(module, exports, __webpack_require__) {
  9951. var global = __webpack_require__("d890");
  9952. var getOwnPropertyDescriptor = __webpack_require__("aa6b").f;
  9953. var createNonEnumerableProperty = __webpack_require__("0fc1");
  9954. var redefine = __webpack_require__("1944");
  9955. var setGlobal = __webpack_require__("e4db");
  9956. var copyConstructorProperties = __webpack_require__("c69d");
  9957. var isForced = __webpack_require__("e8d6");
  9958. /*
  9959. options.target - name of the target object
  9960. options.global - target is the global object
  9961. options.stat - export as static methods of target
  9962. options.proto - export as prototype methods of target
  9963. options.real - real prototype method for the `pure` version
  9964. options.forced - export even if the native feature is available
  9965. options.bind - bind methods to the target, required for the `pure` version
  9966. options.wrap - wrap constructors to preventing global pollution, required for the `pure` version
  9967. options.unsafe - use the simple assignment of property instead of delete + defineProperty
  9968. options.sham - add a flag to not completely full polyfills
  9969. options.enumerable - export as enumerable property
  9970. options.noTargetGet - prevent calling a getter on target
  9971. */
  9972. module.exports = function (options, source) {
  9973. var TARGET = options.target;
  9974. var GLOBAL = options.global;
  9975. var STATIC = options.stat;
  9976. var FORCED, target, key, targetProperty, sourceProperty, descriptor;
  9977. if (GLOBAL) {
  9978. target = global;
  9979. } else if (STATIC) {
  9980. target = global[TARGET] || setGlobal(TARGET, {});
  9981. } else {
  9982. target = (global[TARGET] || {}).prototype;
  9983. }
  9984. if (target) for (key in source) {
  9985. sourceProperty = source[key];
  9986. if (options.noTargetGet) {
  9987. descriptor = getOwnPropertyDescriptor(target, key);
  9988. targetProperty = descriptor && descriptor.value;
  9989. } else targetProperty = target[key];
  9990. FORCED = isForced(GLOBAL ? key : TARGET + (STATIC ? '.' : '#') + key, options.forced);
  9991. // contained in target
  9992. if (!FORCED && targetProperty !== undefined) {
  9993. if (typeof sourceProperty === typeof targetProperty) continue;
  9994. copyConstructorProperties(sourceProperty, targetProperty);
  9995. }
  9996. // add a flag to not completely full polyfills
  9997. if (options.sham || (targetProperty && targetProperty.sham)) {
  9998. createNonEnumerableProperty(sourceProperty, 'sham', true);
  9999. }
  10000. // extend global
  10001. redefine(target, key, sourceProperty, options);
  10002. }
  10003. };
  10004. /***/ }),
  10005. /***/ "1ca1":
  10006. /***/ (function(module, exports, __webpack_require__) {
  10007. var isObject = __webpack_require__("a719");
  10008. var isArray = __webpack_require__("74e7");
  10009. var wellKnownSymbol = __webpack_require__("90fb");
  10010. var SPECIES = wellKnownSymbol('species');
  10011. // `ArraySpeciesCreate` abstract operation
  10012. // https://tc39.github.io/ecma262/#sec-arrayspeciescreate
  10013. module.exports = function (originalArray, length) {
  10014. var C;
  10015. if (isArray(originalArray)) {
  10016. C = originalArray.constructor;
  10017. // cross-realm fallback
  10018. if (typeof C == 'function' && (C === Array || isArray(C.prototype))) C = undefined;
  10019. else if (isObject(C)) {
  10020. C = C[SPECIES];
  10021. if (C === null) C = undefined;
  10022. }
  10023. } return new (C === undefined ? Array : C)(length === 0 ? 0 : length);
  10024. };
  10025. /***/ }),
  10026. /***/ "1e2c":
  10027. /***/ (function(module, exports, __webpack_require__) {
  10028. var fails = __webpack_require__("efe2");
  10029. // Thank's IE8 for his funny defineProperty
  10030. module.exports = !fails(function () {
  10031. return Object.defineProperty({}, 1, { get: function () { return 7; } })[1] != 7;
  10032. });
  10033. /***/ }),
  10034. /***/ "1ea7":
  10035. /***/ (function(module, exports, __webpack_require__) {
  10036. var fails = __webpack_require__("efe2");
  10037. var wellKnownSymbol = __webpack_require__("90fb");
  10038. var V8_VERSION = __webpack_require__("f594");
  10039. var SPECIES = wellKnownSymbol('species');
  10040. module.exports = function (METHOD_NAME) {
  10041. // We can't use this feature detection in V8 since it causes
  10042. // deoptimization and serious performance degradation
  10043. // https://github.com/zloirock/core-js/issues/677
  10044. return V8_VERSION >= 51 || !fails(function () {
  10045. var array = [];
  10046. var constructor = array.constructor = {};
  10047. constructor[SPECIES] = function () {
  10048. return { foo: 1 };
  10049. };
  10050. return array[METHOD_NAME](Boolean).foo !== 1;
  10051. });
  10052. };
  10053. /***/ }),
  10054. /***/ "2039":
  10055. /***/ (function(module, exports, __webpack_require__) {
  10056. var DESCRIPTORS = __webpack_require__("1e2c");
  10057. var fails = __webpack_require__("efe2");
  10058. var createElement = __webpack_require__("ae25");
  10059. // Thank's IE8 for his funny defineProperty
  10060. module.exports = !DESCRIPTORS && !fails(function () {
  10061. return Object.defineProperty(createElement('div'), 'a', {
  10062. get: function () { return 7; }
  10063. }).a != 7;
  10064. });
  10065. /***/ }),
  10066. /***/ "2118":
  10067. /***/ (function(module, exports) {
  10068. var toString = {}.toString;
  10069. module.exports = function (it) {
  10070. return toString.call(it).slice(8, -1);
  10071. };
  10072. /***/ }),
  10073. /***/ "2732":
  10074. /***/ (function(module, exports) {
  10075. // `RequireObjectCoercible` abstract operation
  10076. // https://tc39.github.io/ecma262/#sec-requireobjectcoercible
  10077. module.exports = function (it) {
  10078. if (it == undefined) throw TypeError("Can't call method on " + it);
  10079. return it;
  10080. };
  10081. /***/ }),
  10082. /***/ "27cd":
  10083. /***/ (function(module, exports, __webpack_require__) {
  10084. "use strict";
  10085. exports.byteLength = byteLength
  10086. exports.toByteArray = toByteArray
  10087. exports.fromByteArray = fromByteArray
  10088. var lookup = []
  10089. var revLookup = []
  10090. var Arr = typeof Uint8Array !== 'undefined' ? Uint8Array : Array
  10091. var code = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
  10092. for (var i = 0, len = code.length; i < len; ++i) {
  10093. lookup[i] = code[i]
  10094. revLookup[code.charCodeAt(i)] = i
  10095. }
  10096. // Support decoding URL-safe base64 strings, as Node.js does.
  10097. // See: https://en.wikipedia.org/wiki/Base64#URL_applications
  10098. revLookup['-'.charCodeAt(0)] = 62
  10099. revLookup['_'.charCodeAt(0)] = 63
  10100. function getLens (b64) {
  10101. var len = b64.length
  10102. if (len % 4 > 0) {
  10103. throw new Error('Invalid string. Length must be a multiple of 4')
  10104. }
  10105. // Trim off extra bytes after placeholder bytes are found
  10106. // See: https://github.com/beatgammit/base64-js/issues/42
  10107. var validLen = b64.indexOf('=')
  10108. if (validLen === -1) validLen = len
  10109. var placeHoldersLen = validLen === len
  10110. ? 0
  10111. : 4 - (validLen % 4)
  10112. return [validLen, placeHoldersLen]
  10113. }
  10114. // base64 is 4/3 + up to two characters of the original data
  10115. function byteLength (b64) {
  10116. var lens = getLens(b64)
  10117. var validLen = lens[0]
  10118. var placeHoldersLen = lens[1]
  10119. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  10120. }
  10121. function _byteLength (b64, validLen, placeHoldersLen) {
  10122. return ((validLen + placeHoldersLen) * 3 / 4) - placeHoldersLen
  10123. }
  10124. function toByteArray (b64) {
  10125. var tmp
  10126. var lens = getLens(b64)
  10127. var validLen = lens[0]
  10128. var placeHoldersLen = lens[1]
  10129. var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen))
  10130. var curByte = 0
  10131. // if there are placeholders, only get up to the last complete 4 chars
  10132. var len = placeHoldersLen > 0
  10133. ? validLen - 4
  10134. : validLen
  10135. var i
  10136. for (i = 0; i < len; i += 4) {
  10137. tmp =
  10138. (revLookup[b64.charCodeAt(i)] << 18) |
  10139. (revLookup[b64.charCodeAt(i + 1)] << 12) |
  10140. (revLookup[b64.charCodeAt(i + 2)] << 6) |
  10141. revLookup[b64.charCodeAt(i + 3)]
  10142. arr[curByte++] = (tmp >> 16) & 0xFF
  10143. arr[curByte++] = (tmp >> 8) & 0xFF
  10144. arr[curByte++] = tmp & 0xFF
  10145. }
  10146. if (placeHoldersLen === 2) {
  10147. tmp =
  10148. (revLookup[b64.charCodeAt(i)] << 2) |
  10149. (revLookup[b64.charCodeAt(i + 1)] >> 4)
  10150. arr[curByte++] = tmp & 0xFF
  10151. }
  10152. if (placeHoldersLen === 1) {
  10153. tmp =
  10154. (revLookup[b64.charCodeAt(i)] << 10) |
  10155. (revLookup[b64.charCodeAt(i + 1)] << 4) |
  10156. (revLookup[b64.charCodeAt(i + 2)] >> 2)
  10157. arr[curByte++] = (tmp >> 8) & 0xFF
  10158. arr[curByte++] = tmp & 0xFF
  10159. }
  10160. return arr
  10161. }
  10162. function tripletToBase64 (num) {
  10163. return lookup[num >> 18 & 0x3F] +
  10164. lookup[num >> 12 & 0x3F] +
  10165. lookup[num >> 6 & 0x3F] +
  10166. lookup[num & 0x3F]
  10167. }
  10168. function encodeChunk (uint8, start, end) {
  10169. var tmp
  10170. var output = []
  10171. for (var i = start; i < end; i += 3) {
  10172. tmp =
  10173. ((uint8[i] << 16) & 0xFF0000) +
  10174. ((uint8[i + 1] << 8) & 0xFF00) +
  10175. (uint8[i + 2] & 0xFF)
  10176. output.push(tripletToBase64(tmp))
  10177. }
  10178. return output.join('')
  10179. }
  10180. function fromByteArray (uint8) {
  10181. var tmp
  10182. var len = uint8.length
  10183. var extraBytes = len % 3 // if we have 1 byte left, pad 2 bytes
  10184. var parts = []
  10185. var maxChunkLength = 16383 // must be multiple of 3
  10186. // go through the array every three bytes, we'll deal with trailing stuff later
  10187. for (var i = 0, len2 = len - extraBytes; i < len2; i += maxChunkLength) {
  10188. parts.push(encodeChunk(
  10189. uint8, i, (i + maxChunkLength) > len2 ? len2 : (i + maxChunkLength)
  10190. ))
  10191. }
  10192. // pad the end with zeros, but make sure to not forget the extra bytes
  10193. if (extraBytes === 1) {
  10194. tmp = uint8[len - 1]
  10195. parts.push(
  10196. lookup[tmp >> 2] +
  10197. lookup[(tmp << 4) & 0x3F] +
  10198. '=='
  10199. )
  10200. } else if (extraBytes === 2) {
  10201. tmp = (uint8[len - 2] << 8) + uint8[len - 1]
  10202. parts.push(
  10203. lookup[tmp >> 10] +
  10204. lookup[(tmp >> 4) & 0x3F] +
  10205. lookup[(tmp << 2) & 0x3F] +
  10206. '='
  10207. )
  10208. }
  10209. return parts.join('')
  10210. }
  10211. /***/ }),
  10212. /***/ "3553":
  10213. /***/ (function(module, exports, __webpack_require__) {
  10214. var requireObjectCoercible = __webpack_require__("2732");
  10215. // `ToObject` abstract operation
  10216. // https://tc39.github.io/ecma262/#sec-toobject
  10217. module.exports = function (argument) {
  10218. return Object(requireObjectCoercible(argument));
  10219. };
  10220. /***/ }),
  10221. /***/ "38b9":
  10222. /***/ (function(module, exports) {
  10223. module.exports = function (bitmap, value) {
  10224. return {
  10225. enumerable: !(bitmap & 1),
  10226. configurable: !(bitmap & 2),
  10227. writable: !(bitmap & 4),
  10228. value: value
  10229. };
  10230. };
  10231. /***/ }),
  10232. /***/ "3a08":
  10233. /***/ (function(module, exports, __webpack_require__) {
  10234. var global = __webpack_require__("d890");
  10235. var setGlobal = __webpack_require__("e4db");
  10236. var SHARED = '__core-js_shared__';
  10237. var store = global[SHARED] || setGlobal(SHARED, {});
  10238. module.exports = store;
  10239. /***/ }),
  10240. /***/ "3da3":
  10241. /***/ (function(module, exports) {
  10242. var ceil = Math.ceil;
  10243. var floor = Math.floor;
  10244. // `ToInteger` abstract operation
  10245. // https://tc39.github.io/ecma262/#sec-tointeger
  10246. module.exports = function (argument) {
  10247. return isNaN(argument = +argument) ? 0 : (argument > 0 ? floor : ceil)(argument);
  10248. };
  10249. /***/ }),
  10250. /***/ "45af":
  10251. /***/ (function(module, exports, __webpack_require__) {
  10252. var toIndexedObject = __webpack_require__("da10");
  10253. var toLength = __webpack_require__("d88d");
  10254. var toAbsoluteIndex = __webpack_require__("e1d6");
  10255. // `Array.prototype.{ indexOf, includes }` methods implementation
  10256. var createMethod = function (IS_INCLUDES) {
  10257. return function ($this, el, fromIndex) {
  10258. var O = toIndexedObject($this);
  10259. var length = toLength(O.length);
  10260. var index = toAbsoluteIndex(fromIndex, length);
  10261. var value;
  10262. // Array#includes uses SameValueZero equality algorithm
  10263. // eslint-disable-next-line no-self-compare
  10264. if (IS_INCLUDES && el != el) while (length > index) {
  10265. value = O[index++];
  10266. // eslint-disable-next-line no-self-compare
  10267. if (value != value) return true;
  10268. // Array#indexOf ignores holes, Array#includes - not
  10269. } else for (;length > index; index++) {
  10270. if ((IS_INCLUDES || index in O) && O[index] === el) return IS_INCLUDES || index || 0;
  10271. } return !IS_INCLUDES && -1;
  10272. };
  10273. };
  10274. module.exports = {
  10275. // `Array.prototype.includes` method
  10276. // https://tc39.github.io/ecma262/#sec-array.prototype.includes
  10277. includes: createMethod(true),
  10278. // `Array.prototype.indexOf` method
  10279. // https://tc39.github.io/ecma262/#sec-array.prototype.indexof
  10280. indexOf: createMethod(false)
  10281. };
  10282. /***/ }),
  10283. /***/ "4fda":
  10284. /***/ (function(module, exports, __webpack_require__) {
  10285. var getBuiltIn = __webpack_require__("6d7a");
  10286. module.exports = getBuiltIn('navigator', 'userAgent') || '';
  10287. /***/ }),
  10288. /***/ "50fb":
  10289. /***/ (function(module, exports, __webpack_require__) {
  10290. var anObject = __webpack_require__("857c");
  10291. var aPossiblePrototype = __webpack_require__("d1fd");
  10292. // `Object.setPrototypeOf` method
  10293. // https://tc39.github.io/ecma262/#sec-object.setprototypeof
  10294. // Works with __proto__ only. Old v8 can't work with null proto objects.
  10295. /* eslint-disable no-proto */
  10296. module.exports = Object.setPrototypeOf || ('__proto__' in {} ? function () {
  10297. var CORRECT_SETTER = false;
  10298. var test = {};
  10299. var setter;
  10300. try {
  10301. setter = Object.getOwnPropertyDescriptor(Object.prototype, '__proto__').set;
  10302. setter.call(test, []);
  10303. CORRECT_SETTER = test instanceof Array;
  10304. } catch (error) { /* empty */ }
  10305. return function setPrototypeOf(O, proto) {
  10306. anObject(O);
  10307. aPossiblePrototype(proto);
  10308. if (CORRECT_SETTER) setter.call(O, proto);
  10309. else O.__proto__ = proto;
  10310. return O;
  10311. };
  10312. }() : undefined);
  10313. /***/ }),
  10314. /***/ "513c":
  10315. /***/ (function(module, exports, __webpack_require__) {
  10316. "use strict";
  10317. var DESCRIPTORS = __webpack_require__("1e2c");
  10318. var global = __webpack_require__("d890");
  10319. var isForced = __webpack_require__("e8d6");
  10320. var redefine = __webpack_require__("1944");
  10321. var has = __webpack_require__("faa8");
  10322. var classof = __webpack_require__("2118");
  10323. var inheritIfRequired = __webpack_require__("7063");
  10324. var toPrimitive = __webpack_require__("9f67");
  10325. var fails = __webpack_require__("efe2");
  10326. var create = __webpack_require__("6d60");
  10327. var getOwnPropertyNames = __webpack_require__("b338").f;
  10328. var getOwnPropertyDescriptor = __webpack_require__("aa6b").f;
  10329. var defineProperty = __webpack_require__("d910").f;
  10330. var trim = __webpack_require__("c10f").trim;
  10331. var NUMBER = 'Number';
  10332. var NativeNumber = global[NUMBER];
  10333. var NumberPrototype = NativeNumber.prototype;
  10334. // Opera ~12 has broken Object#toString
  10335. var BROKEN_CLASSOF = classof(create(NumberPrototype)) == NUMBER;
  10336. // `ToNumber` abstract operation
  10337. // https://tc39.github.io/ecma262/#sec-tonumber
  10338. var toNumber = function (argument) {
  10339. var it = toPrimitive(argument, false);
  10340. var first, third, radix, maxCode, digits, length, index, code;
  10341. if (typeof it == 'string' && it.length > 2) {
  10342. it = trim(it);
  10343. first = it.charCodeAt(0);
  10344. if (first === 43 || first === 45) {
  10345. third = it.charCodeAt(2);
  10346. if (third === 88 || third === 120) return NaN; // Number('+0x1') should be NaN, old V8 fix
  10347. } else if (first === 48) {
  10348. switch (it.charCodeAt(1)) {
  10349. case 66: case 98: radix = 2; maxCode = 49; break; // fast equal of /^0b[01]+$/i
  10350. case 79: case 111: radix = 8; maxCode = 55; break; // fast equal of /^0o[0-7]+$/i
  10351. default: return +it;
  10352. }
  10353. digits = it.slice(2);
  10354. length = digits.length;
  10355. for (index = 0; index < length; index++) {
  10356. code = digits.charCodeAt(index);
  10357. // parseInt parses a string to a first unavailable symbol
  10358. // but ToNumber should return NaN if a string contains unavailable symbols
  10359. if (code < 48 || code > maxCode) return NaN;
  10360. } return parseInt(digits, radix);
  10361. }
  10362. } return +it;
  10363. };
  10364. // `Number` constructor
  10365. // https://tc39.github.io/ecma262/#sec-number-constructor
  10366. if (isForced(NUMBER, !NativeNumber(' 0o1') || !NativeNumber('0b1') || NativeNumber('+0x1'))) {
  10367. var NumberWrapper = function Number(value) {
  10368. var it = arguments.length < 1 ? 0 : value;
  10369. var dummy = this;
  10370. return dummy instanceof NumberWrapper
  10371. // check on 1..constructor(foo) case
  10372. && (BROKEN_CLASSOF ? fails(function () { NumberPrototype.valueOf.call(dummy); }) : classof(dummy) != NUMBER)
  10373. ? inheritIfRequired(new NativeNumber(toNumber(it)), dummy, NumberWrapper) : toNumber(it);
  10374. };
  10375. for (var keys = DESCRIPTORS ? getOwnPropertyNames(NativeNumber) : (
  10376. // ES3:
  10377. 'MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,' +
  10378. // ES2015 (in case, if modules with ES2015 Number statics required before):
  10379. 'EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,' +
  10380. 'MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger'
  10381. ).split(','), j = 0, key; keys.length > j; j++) {
  10382. if (has(NativeNumber, key = keys[j]) && !has(NumberWrapper, key)) {
  10383. defineProperty(NumberWrapper, key, getOwnPropertyDescriptor(NativeNumber, key));
  10384. }
  10385. }
  10386. NumberWrapper.prototype = NumberPrototype;
  10387. NumberPrototype.constructor = NumberWrapper;
  10388. redefine(global, NUMBER, NumberWrapper);
  10389. }
  10390. /***/ }),
  10391. /***/ "571a":
  10392. /***/ (function(module, exports) {
  10393. var toString = {}.toString;
  10394. module.exports = Array.isArray || function (arr) {
  10395. return toString.call(arr) == '[object Array]';
  10396. };
  10397. /***/ }),
  10398. /***/ "604f":
  10399. /***/ (function(module, exports, __webpack_require__) {
  10400. var global = __webpack_require__("d890");
  10401. var inspectSource = __webpack_require__("1025");
  10402. var WeakMap = global.WeakMap;
  10403. module.exports = typeof WeakMap === 'function' && /native code/.test(inspectSource(WeakMap));
  10404. /***/ }),
  10405. /***/ "692f":
  10406. /***/ (function(module, exports, __webpack_require__) {
  10407. var fails = __webpack_require__("efe2");
  10408. var classof = __webpack_require__("2118");
  10409. var split = ''.split;
  10410. // fallback for non-array-like ES3 and non-enumerable old V8 strings
  10411. module.exports = fails(function () {
  10412. // throws an error in rhino, see https://github.com/mozilla/rhino/issues/346
  10413. // eslint-disable-next-line no-prototype-builtins
  10414. return !Object('z').propertyIsEnumerable(0);
  10415. }) ? function (it) {
  10416. return classof(it) == 'String' ? split.call(it, '') : Object(it);
  10417. } : Object;
  10418. /***/ }),
  10419. /***/ "6d28":
  10420. /***/ (function(module, exports, __webpack_require__) {
  10421. var IS_PURE = __webpack_require__("9b9d");
  10422. var store = __webpack_require__("3a08");
  10423. (module.exports = function (key, value) {
  10424. return store[key] || (store[key] = value !== undefined ? value : {});
  10425. })('versions', []).push({
  10426. version: '3.6.5',
  10427. mode: IS_PURE ? 'pure' : 'global',
  10428. copyright: '© 2020 Denis Pushkarev (zloirock.ru)'
  10429. });
  10430. /***/ }),
  10431. /***/ "6d60":
  10432. /***/ (function(module, exports, __webpack_require__) {
  10433. var anObject = __webpack_require__("857c");
  10434. var defineProperties = __webpack_require__("dbe8");
  10435. var enumBugKeys = __webpack_require__("18f6");
  10436. var hiddenKeys = __webpack_require__("d5a8");
  10437. var html = __webpack_require__("6fdf");
  10438. var documentCreateElement = __webpack_require__("ae25");
  10439. var sharedKey = __webpack_require__("7db2");
  10440. var GT = '>';
  10441. var LT = '<';
  10442. var PROTOTYPE = 'prototype';
  10443. var SCRIPT = 'script';
  10444. var IE_PROTO = sharedKey('IE_PROTO');
  10445. var EmptyConstructor = function () { /* empty */ };
  10446. var scriptTag = function (content) {
  10447. return LT + SCRIPT + GT + content + LT + '/' + SCRIPT + GT;
  10448. };
  10449. // Create object with fake `null` prototype: use ActiveX Object with cleared prototype
  10450. var NullProtoObjectViaActiveX = function (activeXDocument) {
  10451. activeXDocument.write(scriptTag(''));
  10452. activeXDocument.close();
  10453. var temp = activeXDocument.parentWindow.Object;
  10454. activeXDocument = null; // avoid memory leak
  10455. return temp;
  10456. };
  10457. // Create object with fake `null` prototype: use iframe Object with cleared prototype
  10458. var NullProtoObjectViaIFrame = function () {
  10459. // Thrash, waste and sodomy: IE GC bug
  10460. var iframe = documentCreateElement('iframe');
  10461. var JS = 'java' + SCRIPT + ':';
  10462. var iframeDocument;
  10463. iframe.style.display = 'none';
  10464. html.appendChild(iframe);
  10465. // https://github.com/zloirock/core-js/issues/475
  10466. iframe.src = String(JS);
  10467. iframeDocument = iframe.contentWindow.document;
  10468. iframeDocument.open();
  10469. iframeDocument.write(scriptTag('document.F=Object'));
  10470. iframeDocument.close();
  10471. return iframeDocument.F;
  10472. };
  10473. // Check for document.domain and active x support
  10474. // No need to use active x approach when document.domain is not set
  10475. // see https://github.com/es-shims/es5-shim/issues/150
  10476. // variation of https://github.com/kitcambridge/es5-shim/commit/4f738ac066346
  10477. // avoid IE GC bug
  10478. var activeXDocument;
  10479. var NullProtoObject = function () {
  10480. try {
  10481. /* global ActiveXObject */
  10482. activeXDocument = document.domain && new ActiveXObject('htmlfile');
  10483. } catch (error) { /* ignore */ }
  10484. NullProtoObject = activeXDocument ? NullProtoObjectViaActiveX(activeXDocument) : NullProtoObjectViaIFrame();
  10485. var length = enumBugKeys.length;
  10486. while (length--) delete NullProtoObject[PROTOTYPE][enumBugKeys[length]];
  10487. return NullProtoObject();
  10488. };
  10489. hiddenKeys[IE_PROTO] = true;
  10490. // `Object.create` method
  10491. // https://tc39.github.io/ecma262/#sec-object.create
  10492. module.exports = Object.create || function create(O, Properties) {
  10493. var result;
  10494. if (O !== null) {
  10495. EmptyConstructor[PROTOTYPE] = anObject(O);
  10496. result = new EmptyConstructor();
  10497. EmptyConstructor[PROTOTYPE] = null;
  10498. // add "__proto__" for Object.getPrototypeOf polyfill
  10499. result[IE_PROTO] = O;
  10500. } else result = NullProtoObject();
  10501. return Properties === undefined ? result : defineProperties(result, Properties);
  10502. };
  10503. /***/ }),
  10504. /***/ "6d7a":
  10505. /***/ (function(module, exports, __webpack_require__) {
  10506. var path = __webpack_require__("1b99");
  10507. var global = __webpack_require__("d890");
  10508. var aFunction = function (variable) {
  10509. return typeof variable == 'function' ? variable : undefined;
  10510. };
  10511. module.exports = function (namespace, method) {
  10512. return arguments.length < 2 ? aFunction(path[namespace]) || aFunction(global[namespace])
  10513. : path[namespace] && path[namespace][method] || global[namespace] && global[namespace][method];
  10514. };
  10515. /***/ }),
  10516. /***/ "6fdf":
  10517. /***/ (function(module, exports, __webpack_require__) {
  10518. var getBuiltIn = __webpack_require__("6d7a");
  10519. module.exports = getBuiltIn('document', 'documentElement');
  10520. /***/ }),
  10521. /***/ "7063":
  10522. /***/ (function(module, exports, __webpack_require__) {
  10523. var isObject = __webpack_require__("a719");
  10524. var setPrototypeOf = __webpack_require__("50fb");
  10525. // makes subclassing work correct for wrapped built-ins
  10526. module.exports = function ($this, dummy, Wrapper) {
  10527. var NewTarget, NewTargetPrototype;
  10528. if (
  10529. // it can work only with native `setPrototypeOf`
  10530. setPrototypeOf &&
  10531. // we haven't completely correct pre-ES6 way for getting `new.target`, so use this
  10532. typeof (NewTarget = dummy.constructor) == 'function' &&
  10533. NewTarget !== Wrapper &&
  10534. isObject(NewTargetPrototype = NewTarget.prototype) &&
  10535. NewTargetPrototype !== Wrapper.prototype
  10536. ) setPrototypeOf($this, NewTargetPrototype);
  10537. return $this;
  10538. };
  10539. /***/ }),
  10540. /***/ "74cb":
  10541. /***/ (function(module, exports, __webpack_require__) {
  10542. var NATIVE_SYMBOL = __webpack_require__("c54b");
  10543. module.exports = NATIVE_SYMBOL
  10544. // eslint-disable-next-line no-undef
  10545. && !Symbol.sham
  10546. // eslint-disable-next-line no-undef
  10547. && typeof Symbol.iterator == 'symbol';
  10548. /***/ }),
  10549. /***/ "74e7":
  10550. /***/ (function(module, exports, __webpack_require__) {
  10551. var classof = __webpack_require__("2118");
  10552. // `IsArray` abstract operation
  10553. // https://tc39.github.io/ecma262/#sec-isarray
  10554. module.exports = Array.isArray || function isArray(arg) {
  10555. return classof(arg) == 'Array';
  10556. };
  10557. /***/ }),
  10558. /***/ "79e4":
  10559. /***/ (function(module, exports, __webpack_require__) {
  10560. var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// addapted from the document.currentScript polyfill by Adam Miller
  10561. // MIT license
  10562. // source: https://github.com/amiller-gh/currentScript-polyfill
  10563. // added support for Firefox https://bugzilla.mozilla.org/show_bug.cgi?id=1620505
  10564. (function (root, factory) {
  10565. if (true) {
  10566. !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),
  10567. __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
  10568. (__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),
  10569. __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
  10570. } else {}
  10571. }(typeof self !== 'undefined' ? self : this, function () {
  10572. function getCurrentScript () {
  10573. var descriptor = Object.getOwnPropertyDescriptor(document, 'currentScript')
  10574. // for chrome
  10575. if (!descriptor && 'currentScript' in document && document.currentScript) {
  10576. return document.currentScript
  10577. }
  10578. // for other browsers with native support for currentScript
  10579. if (descriptor && descriptor.get !== getCurrentScript && document.currentScript) {
  10580. return document.currentScript
  10581. }
  10582. // IE 8-10 support script readyState
  10583. // IE 11+ & Firefox support stack trace
  10584. try {
  10585. throw new Error();
  10586. }
  10587. catch (err) {
  10588. // Find the second match for the "at" string to get file src url from stack.
  10589. var ieStackRegExp = /.*at [^(]*\((.*):(.+):(.+)\)$/ig,
  10590. ffStackRegExp = /@([^@]*):(\d+):(\d+)\s*$/ig,
  10591. stackDetails = ieStackRegExp.exec(err.stack) || ffStackRegExp.exec(err.stack),
  10592. scriptLocation = (stackDetails && stackDetails[1]) || false,
  10593. line = (stackDetails && stackDetails[2]) || false,
  10594. currentLocation = document.location.href.replace(document.location.hash, ''),
  10595. pageSource,
  10596. inlineScriptSourceRegExp,
  10597. inlineScriptSource,
  10598. scripts = document.getElementsByTagName('script'); // Live NodeList collection
  10599. if (scriptLocation === currentLocation) {
  10600. pageSource = document.documentElement.outerHTML;
  10601. inlineScriptSourceRegExp = new RegExp('(?:[^\\n]+?\\n){0,' + (line - 2) + '}[^<]*<script>([\\d\\D]*?)<\\/script>[\\d\\D]*', 'i');
  10602. inlineScriptSource = pageSource.replace(inlineScriptSourceRegExp, '$1').trim();
  10603. }
  10604. for (var i = 0; i < scripts.length; i++) {
  10605. // If ready state is interactive, return the script tag
  10606. if (scripts[i].readyState === 'interactive') {
  10607. return scripts[i];
  10608. }
  10609. // If src matches, return the script tag
  10610. if (scripts[i].src === scriptLocation) {
  10611. return scripts[i];
  10612. }
  10613. // If inline source matches, return the script tag
  10614. if (
  10615. scriptLocation === currentLocation &&
  10616. scripts[i].innerHTML &&
  10617. scripts[i].innerHTML.trim() === inlineScriptSource
  10618. ) {
  10619. return scripts[i];
  10620. }
  10621. }
  10622. // If no match, return null
  10623. return null;
  10624. }
  10625. };
  10626. return getCurrentScript
  10627. }));
  10628. /***/ }),
  10629. /***/ "7db2":
  10630. /***/ (function(module, exports, __webpack_require__) {
  10631. var shared = __webpack_require__("6d28");
  10632. var uid = __webpack_require__("7e8b");
  10633. var keys = shared('keys');
  10634. module.exports = function (key) {
  10635. return keys[key] || (keys[key] = uid(key));
  10636. };
  10637. /***/ }),
  10638. /***/ "7e41":
  10639. /***/ (function(module, exports, __webpack_require__) {
  10640. // extracted by mini-css-extract-plugin
  10641. /***/ }),
  10642. /***/ "7e8b":
  10643. /***/ (function(module, exports) {
  10644. var id = 0;
  10645. var postfix = Math.random();
  10646. module.exports = function (key) {
  10647. return 'Symbol(' + String(key === undefined ? '' : key) + ')_' + (++id + postfix).toString(36);
  10648. };
  10649. /***/ }),
  10650. /***/ "857c":
  10651. /***/ (function(module, exports, __webpack_require__) {
  10652. var isObject = __webpack_require__("a719");
  10653. module.exports = function (it) {
  10654. if (!isObject(it)) {
  10655. throw TypeError(String(it) + ' is not an object');
  10656. } return it;
  10657. };
  10658. /***/ }),
  10659. /***/ "8d44":
  10660. /***/ (function(module, exports, __webpack_require__) {
  10661. var getBuiltIn = __webpack_require__("6d7a");
  10662. var getOwnPropertyNamesModule = __webpack_require__("b338");
  10663. var getOwnPropertySymbolsModule = __webpack_require__("0a60");
  10664. var anObject = __webpack_require__("857c");
  10665. // all object keys, includes non-enumerable and symbols
  10666. module.exports = getBuiltIn('Reflect', 'ownKeys') || function ownKeys(it) {
  10667. var keys = getOwnPropertyNamesModule.f(anObject(it));
  10668. var getOwnPropertySymbols = getOwnPropertySymbolsModule.f;
  10669. return getOwnPropertySymbols ? keys.concat(getOwnPropertySymbols(it)) : keys;
  10670. };
  10671. /***/ }),
  10672. /***/ "90fb":
  10673. /***/ (function(module, exports, __webpack_require__) {
  10674. var global = __webpack_require__("d890");
  10675. var shared = __webpack_require__("6d28");
  10676. var has = __webpack_require__("faa8");
  10677. var uid = __webpack_require__("7e8b");
  10678. var NATIVE_SYMBOL = __webpack_require__("c54b");
  10679. var USE_SYMBOL_AS_UID = __webpack_require__("74cb");
  10680. var WellKnownSymbolsStore = shared('wks');
  10681. var Symbol = global.Symbol;
  10682. var createWellKnownSymbol = USE_SYMBOL_AS_UID ? Symbol : Symbol && Symbol.withoutSetter || uid;
  10683. module.exports = function (name) {
  10684. if (!has(WellKnownSymbolsStore, name)) {
  10685. if (NATIVE_SYMBOL && has(Symbol, name)) WellKnownSymbolsStore[name] = Symbol[name];
  10686. else WellKnownSymbolsStore[name] = createWellKnownSymbol('Symbol.' + name);
  10687. } return WellKnownSymbolsStore[name];
  10688. };
  10689. /***/ }),
  10690. /***/ "96be":
  10691. /***/ (function(module, exports, __webpack_require__) {
  10692. // extracted by mini-css-extract-plugin
  10693. /***/ }),
  10694. /***/ "9896":
  10695. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  10696. "use strict";
  10697. // ESM COMPAT FLAG
  10698. __webpack_require__.r(__webpack_exports__);
  10699. // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/setPublicPath.js
  10700. // This file is imported into lib/wc client bundles.
  10701. if (typeof window !== 'undefined') {
  10702. var currentScript = window.document.currentScript
  10703. if (true) {
  10704. var getCurrentScript = __webpack_require__("79e4")
  10705. currentScript = getCurrentScript()
  10706. // for backward compatibility, because previously we directly included the polyfill
  10707. if (!('currentScript' in document)) {
  10708. Object.defineProperty(document, 'currentScript', { get: getCurrentScript })
  10709. }
  10710. }
  10711. var src = currentScript && currentScript.src.match(/(.+\/)[^/]+\.js(\?.*)?$/)
  10712. if (src) {
  10713. __webpack_require__.p = src[1] // eslint-disable-line
  10714. }
  10715. }
  10716. // Indicate to webpack that this file can be concatenated
  10717. /* harmony default export */ var setPublicPath = (null);
  10718. // CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"5873f86c-vue-loader-template"}!./node_modules/_vue-loader@15.9.3@vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/components/index.vue?vue&type=template&id=0a189f7e&
  10719. var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"vab-quill",class:_vm.classes},[_c('div',{ref:"editor",style:(_vm.styles)})])}
  10720. var staticRenderFns = []
  10721. // CONCATENATED MODULE: ./src/components/index.vue?vue&type=template&id=0a189f7e&
  10722. // EXTERNAL MODULE: ./node_modules/_core-js@3.6.5@core-js/modules/es.array.concat.js
  10723. var es_array_concat = __webpack_require__("b4fb");
  10724. // EXTERNAL MODULE: ./node_modules/_core-js@3.6.5@core-js/modules/es.number.constructor.js
  10725. var es_number_constructor = __webpack_require__("513c");
  10726. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.js
  10727. var quill = __webpack_require__("0126");
  10728. var quill_default = /*#__PURE__*/__webpack_require__.n(quill);
  10729. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.core.css
  10730. var quill_core = __webpack_require__("121a");
  10731. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.snow.css
  10732. var quill_snow = __webpack_require__("7e41");
  10733. // EXTERNAL MODULE: ./node_modules/_quill@1.3.7@quill/dist/quill.bubble.css
  10734. var quill_bubble = __webpack_require__("96be");
  10735. // CONCATENATED MODULE: ./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--12-0!./node_modules/_thread-loader@2.1.3@thread-loader/dist/cjs.js!./node_modules/_babel-loader@8.1.0@babel-loader/lib!./node_modules/_cache-loader@4.1.0@cache-loader/dist/cjs.js??ref--0-0!./node_modules/_vue-loader@15.9.3@vue-loader/lib??vue-loader-options!./src/components/index.vue?vue&type=script&lang=js&
  10736. //
  10737. //
  10738. //
  10739. //
  10740. //
  10741. //
  10742. /* harmony default export */ var componentsvue_type_script_lang_js_ = ({
  10743. name: "VabQuill",
  10744. props: {
  10745. value: {
  10746. type: String,
  10747. default: ""
  10748. },
  10749. border: {
  10750. type: Boolean,
  10751. default: false
  10752. },
  10753. height: {
  10754. type: Number,
  10755. default: null
  10756. },
  10757. minHeight: {
  10758. type: Number,
  10759. default: null
  10760. }
  10761. },
  10762. data: function data() {
  10763. return {
  10764. Quill: null,
  10765. currentValue: "",
  10766. options: {
  10767. theme: "snow",
  10768. bounds: document.body,
  10769. debug: "warn",
  10770. modules: {
  10771. toolbar: [["bold", "italic", "underline", "strike"], [{
  10772. header: [1, 2, 3, 4, 5, 6, false]
  10773. }], [{
  10774. size: ["small", false, "large", "huge"]
  10775. }], [{
  10776. color: []
  10777. }, {
  10778. background: []
  10779. }], ["blockquote", "code-block"], [{
  10780. list: "ordered"
  10781. }, {
  10782. list: "bullet"
  10783. }], [{
  10784. indent: "-1"
  10785. }, {
  10786. indent: "+1"
  10787. }], [{
  10788. align: []
  10789. }], [{
  10790. direction: "rtl"
  10791. }], ["clean"], ["link", "image"]]
  10792. },
  10793. placeholder: "内容...",
  10794. readOnly: false
  10795. }
  10796. };
  10797. },
  10798. computed: {
  10799. classes: function classes() {
  10800. return [{
  10801. "vab-quill-no-border": !this.border
  10802. }];
  10803. },
  10804. styles: function styles() {
  10805. var style = {};
  10806. if (this.minHeight) {
  10807. style.minHeight = "".concat(this.minHeight, "px");
  10808. }
  10809. if (this.height) {
  10810. style.height = "".concat(this.height, "px");
  10811. }
  10812. return style;
  10813. }
  10814. },
  10815. watch: {
  10816. value: {
  10817. handler: function handler(val) {
  10818. if (val !== this.currentValue) {
  10819. this.currentValue = val;
  10820. if (this.Quill) {
  10821. this.Quill.pasteHTML(this.value);
  10822. }
  10823. }
  10824. },
  10825. immediate: true
  10826. }
  10827. },
  10828. mounted: function mounted() {
  10829. this.init();
  10830. },
  10831. beforeDestroy: function beforeDestroy() {
  10832. this.Quill = null;
  10833. },
  10834. methods: {
  10835. init: function init() {
  10836. var _this = this;
  10837. var editor = this.$refs.editor;
  10838. this.Quill = new quill_default.a(editor, this.options);
  10839. this.Quill.pasteHTML(this.currentValue);
  10840. this.Quill.on("text-change", function (delta, oldDelta, source) {
  10841. var html = _this.$refs.editor.children[0].innerHTML;
  10842. var text = _this.Quill.getText();
  10843. var quill = _this.Quill;
  10844. _this.currentValue = html;
  10845. _this.$emit("input", html);
  10846. _this.$emit("on-change", {
  10847. html: html,
  10848. text: text,
  10849. quill: quill
  10850. });
  10851. });
  10852. this.Quill.on("text-change", function (delta, oldDelta, source) {
  10853. _this.$emit("on-text-change", delta, oldDelta, source);
  10854. });
  10855. this.Quill.on("selection-change", function (range, oldRange, source) {
  10856. _this.$emit("on-selection-change", range, oldRange, source);
  10857. });
  10858. this.Quill.on("editor-change", function (eventName) {
  10859. for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
  10860. args[_key - 1] = arguments[_key];
  10861. }
  10862. _this.$emit.apply(_this, ["on-editor-change", eventName].concat(args));
  10863. });
  10864. }
  10865. }
  10866. });
  10867. // CONCATENATED MODULE: ./src/components/index.vue?vue&type=script&lang=js&
  10868. /* harmony default export */ var src_componentsvue_type_script_lang_js_ = (componentsvue_type_script_lang_js_);
  10869. // CONCATENATED MODULE: ./node_modules/_vue-loader@15.9.3@vue-loader/lib/runtime/componentNormalizer.js
  10870. /* globals __VUE_SSR_CONTEXT__ */
  10871. // IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
  10872. // This module is a runtime utility for cleaner component module output and will
  10873. // be included in the final webpack user bundle.
  10874. function normalizeComponent (
  10875. scriptExports,
  10876. render,
  10877. staticRenderFns,
  10878. functionalTemplate,
  10879. injectStyles,
  10880. scopeId,
  10881. moduleIdentifier, /* server only */
  10882. shadowMode /* vue-cli only */
  10883. ) {
  10884. // Vue.extend constructor export interop
  10885. var options = typeof scriptExports === 'function'
  10886. ? scriptExports.options
  10887. : scriptExports
  10888. // render functions
  10889. if (render) {
  10890. options.render = render
  10891. options.staticRenderFns = staticRenderFns
  10892. options._compiled = true
  10893. }
  10894. // functional template
  10895. if (functionalTemplate) {
  10896. options.functional = true
  10897. }
  10898. // scopedId
  10899. if (scopeId) {
  10900. options._scopeId = 'data-v-' + scopeId
  10901. }
  10902. var hook
  10903. if (moduleIdentifier) { // server build
  10904. hook = function (context) {
  10905. // 2.3 injection
  10906. context =
  10907. context || // cached call
  10908. (this.$vnode && this.$vnode.ssrContext) || // stateful
  10909. (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
  10910. // 2.2 with runInNewContext: true
  10911. if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
  10912. context = __VUE_SSR_CONTEXT__
  10913. }
  10914. // inject component styles
  10915. if (injectStyles) {
  10916. injectStyles.call(this, context)
  10917. }
  10918. // register component module identifier for async chunk inferrence
  10919. if (context && context._registeredComponents) {
  10920. context._registeredComponents.add(moduleIdentifier)
  10921. }
  10922. }
  10923. // used by ssr in case component is cached and beforeCreate
  10924. // never gets called
  10925. options._ssrRegister = hook
  10926. } else if (injectStyles) {
  10927. hook = shadowMode
  10928. ? function () {
  10929. injectStyles.call(
  10930. this,
  10931. (options.functional ? this.parent : this).$root.$options.shadowRoot
  10932. )
  10933. }
  10934. : injectStyles
  10935. }
  10936. if (hook) {
  10937. if (options.functional) {
  10938. // for template-only hot-reload because in that case the render fn doesn't
  10939. // go through the normalizer
  10940. options._injectStyles = hook
  10941. // register for functional component in vue file
  10942. var originalRender = options.render
  10943. options.render = function renderWithStyleInjection (h, context) {
  10944. hook.call(context)
  10945. return originalRender(h, context)
  10946. }
  10947. } else {
  10948. // inject component registration as beforeCreate hook
  10949. var existing = options.beforeCreate
  10950. options.beforeCreate = existing
  10951. ? [].concat(existing, hook)
  10952. : [hook]
  10953. }
  10954. }
  10955. return {
  10956. exports: scriptExports,
  10957. options: options
  10958. }
  10959. }
  10960. // CONCATENATED MODULE: ./src/components/index.vue
  10961. /* normalize component */
  10962. var component = normalizeComponent(
  10963. src_componentsvue_type_script_lang_js_,
  10964. render,
  10965. staticRenderFns,
  10966. false,
  10967. null,
  10968. null,
  10969. null
  10970. )
  10971. /* harmony default export */ var components = (component.exports);
  10972. // CONCATENATED MODULE: ./src/components/export.js
  10973. /* harmony default export */ var components_export = (components);
  10974. if (typeof window !== "undefined" && window.Vue) {
  10975. window.Vue.component("zx-quill", components);
  10976. }
  10977. // CONCATENATED MODULE: ./node_modules/_@vue_cli-service@4.4.6@@vue/cli-service/lib/commands/build/entry-lib.js
  10978. /* harmony default export */ var entry_lib = __webpack_exports__["default"] = (components_export);
  10979. /***/ }),
  10980. /***/ "9b9d":
  10981. /***/ (function(module, exports) {
  10982. module.exports = false;
  10983. /***/ }),
  10984. /***/ "9edd":
  10985. /***/ (function(module, exports) {
  10986. var g;
  10987. // This works in non-strict mode
  10988. g = (function() {
  10989. return this;
  10990. })();
  10991. try {
  10992. // This works if eval is allowed (see CSP)
  10993. g = g || new Function("return this")();
  10994. } catch (e) {
  10995. // This works if the window reference is available
  10996. if (typeof window === "object") g = window;
  10997. }
  10998. // g can still be undefined, but nothing to do about it...
  10999. // We return undefined, instead of nothing here, so it's
  11000. // easier to handle this case. if(!global) { ...}
  11001. module.exports = g;
  11002. /***/ }),
  11003. /***/ "9f67":
  11004. /***/ (function(module, exports, __webpack_require__) {
  11005. var isObject = __webpack_require__("a719");
  11006. // `ToPrimitive` abstract operation
  11007. // https://tc39.github.io/ecma262/#sec-toprimitive
  11008. // instead of the ES6 spec version, we didn't implement @@toPrimitive case
  11009. // and the second argument - flag - preferred type is a string
  11010. module.exports = function (input, PREFERRED_STRING) {
  11011. if (!isObject(input)) return input;
  11012. var fn, val;
  11013. if (PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  11014. if (typeof (fn = input.valueOf) == 'function' && !isObject(val = fn.call(input))) return val;
  11015. if (!PREFERRED_STRING && typeof (fn = input.toString) == 'function' && !isObject(val = fn.call(input))) return val;
  11016. throw TypeError("Can't convert object to primitive value");
  11017. };
  11018. /***/ }),
  11019. /***/ "a719":
  11020. /***/ (function(module, exports) {
  11021. module.exports = function (it) {
  11022. return typeof it === 'object' ? it !== null : typeof it === 'function';
  11023. };
  11024. /***/ }),
  11025. /***/ "aa6b":
  11026. /***/ (function(module, exports, __webpack_require__) {
  11027. var DESCRIPTORS = __webpack_require__("1e2c");
  11028. var propertyIsEnumerableModule = __webpack_require__("ef71");
  11029. var createPropertyDescriptor = __webpack_require__("38b9");
  11030. var toIndexedObject = __webpack_require__("da10");
  11031. var toPrimitive = __webpack_require__("9f67");
  11032. var has = __webpack_require__("faa8");
  11033. var IE8_DOM_DEFINE = __webpack_require__("2039");
  11034. var nativeGetOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  11035. // `Object.getOwnPropertyDescriptor` method
  11036. // https://tc39.github.io/ecma262/#sec-object.getownpropertydescriptor
  11037. exports.f = DESCRIPTORS ? nativeGetOwnPropertyDescriptor : function getOwnPropertyDescriptor(O, P) {
  11038. O = toIndexedObject(O);
  11039. P = toPrimitive(P, true);
  11040. if (IE8_DOM_DEFINE) try {
  11041. return nativeGetOwnPropertyDescriptor(O, P);
  11042. } catch (error) { /* empty */ }
  11043. if (has(O, P)) return createPropertyDescriptor(!propertyIsEnumerableModule.f.call(O, P), O[P]);
  11044. };
  11045. /***/ }),
  11046. /***/ "ae25":
  11047. /***/ (function(module, exports, __webpack_require__) {
  11048. var global = __webpack_require__("d890");
  11049. var isObject = __webpack_require__("a719");
  11050. var document = global.document;
  11051. // typeof document.createElement is 'object' in old IE
  11052. var EXISTS = isObject(document) && isObject(document.createElement);
  11053. module.exports = function (it) {
  11054. return EXISTS ? document.createElement(it) : {};
  11055. };
  11056. /***/ }),
  11057. /***/ "b338":
  11058. /***/ (function(module, exports, __webpack_require__) {
  11059. var internalObjectKeys = __webpack_require__("ead4");
  11060. var enumBugKeys = __webpack_require__("18f6");
  11061. var hiddenKeys = enumBugKeys.concat('length', 'prototype');
  11062. // `Object.getOwnPropertyNames` method
  11063. // https://tc39.github.io/ecma262/#sec-object.getownpropertynames
  11064. exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
  11065. return internalObjectKeys(O, hiddenKeys);
  11066. };
  11067. /***/ }),
  11068. /***/ "b4fb":
  11069. /***/ (function(module, exports, __webpack_require__) {
  11070. "use strict";
  11071. var $ = __webpack_require__("1c8b");
  11072. var fails = __webpack_require__("efe2");
  11073. var isArray = __webpack_require__("74e7");
  11074. var isObject = __webpack_require__("a719");
  11075. var toObject = __webpack_require__("3553");
  11076. var toLength = __webpack_require__("d88d");
  11077. var createProperty = __webpack_require__("1bbd");
  11078. var arraySpeciesCreate = __webpack_require__("1ca1");
  11079. var arrayMethodHasSpeciesSupport = __webpack_require__("1ea7");
  11080. var wellKnownSymbol = __webpack_require__("90fb");
  11081. var V8_VERSION = __webpack_require__("f594");
  11082. var IS_CONCAT_SPREADABLE = wellKnownSymbol('isConcatSpreadable');
  11083. var MAX_SAFE_INTEGER = 0x1FFFFFFFFFFFFF;
  11084. var MAXIMUM_ALLOWED_INDEX_EXCEEDED = 'Maximum allowed index exceeded';
  11085. // We can't use this feature detection in V8 since it causes
  11086. // deoptimization and serious performance degradation
  11087. // https://github.com/zloirock/core-js/issues/679
  11088. var IS_CONCAT_SPREADABLE_SUPPORT = V8_VERSION >= 51 || !fails(function () {
  11089. var array = [];
  11090. array[IS_CONCAT_SPREADABLE] = false;
  11091. return array.concat()[0] !== array;
  11092. });
  11093. var SPECIES_SUPPORT = arrayMethodHasSpeciesSupport('concat');
  11094. var isConcatSpreadable = function (O) {
  11095. if (!isObject(O)) return false;
  11096. var spreadable = O[IS_CONCAT_SPREADABLE];
  11097. return spreadable !== undefined ? !!spreadable : isArray(O);
  11098. };
  11099. var FORCED = !IS_CONCAT_SPREADABLE_SUPPORT || !SPECIES_SUPPORT;
  11100. // `Array.prototype.concat` method
  11101. // https://tc39.github.io/ecma262/#sec-array.prototype.concat
  11102. // with adding support of @@isConcatSpreadable and @@species
  11103. $({ target: 'Array', proto: true, forced: FORCED }, {
  11104. concat: function concat(arg) { // eslint-disable-line no-unused-vars
  11105. var O = toObject(this);
  11106. var A = arraySpeciesCreate(O, 0);
  11107. var n = 0;
  11108. var i, k, length, len, E;
  11109. for (i = -1, length = arguments.length; i < length; i++) {
  11110. E = i === -1 ? O : arguments[i];
  11111. if (isConcatSpreadable(E)) {
  11112. len = toLength(E.length);
  11113. if (n + len > MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  11114. for (k = 0; k < len; k++, n++) if (k in E) createProperty(A, n, E[k]);
  11115. } else {
  11116. if (n >= MAX_SAFE_INTEGER) throw TypeError(MAXIMUM_ALLOWED_INDEX_EXCEEDED);
  11117. createProperty(A, n++, E);
  11118. }
  11119. }
  11120. A.length = n;
  11121. return A;
  11122. }
  11123. });
  11124. /***/ }),
  11125. /***/ "b702":
  11126. /***/ (function(module, exports, __webpack_require__) {
  11127. var NATIVE_WEAK_MAP = __webpack_require__("604f");
  11128. var global = __webpack_require__("d890");
  11129. var isObject = __webpack_require__("a719");
  11130. var createNonEnumerableProperty = __webpack_require__("0fc1");
  11131. var objectHas = __webpack_require__("faa8");
  11132. var sharedKey = __webpack_require__("7db2");
  11133. var hiddenKeys = __webpack_require__("d5a8");
  11134. var WeakMap = global.WeakMap;
  11135. var set, get, has;
  11136. var enforce = function (it) {
  11137. return has(it) ? get(it) : set(it, {});
  11138. };
  11139. var getterFor = function (TYPE) {
  11140. return function (it) {
  11141. var state;
  11142. if (!isObject(it) || (state = get(it)).type !== TYPE) {
  11143. throw TypeError('Incompatible receiver, ' + TYPE + ' required');
  11144. } return state;
  11145. };
  11146. };
  11147. if (NATIVE_WEAK_MAP) {
  11148. var store = new WeakMap();
  11149. var wmget = store.get;
  11150. var wmhas = store.has;
  11151. var wmset = store.set;
  11152. set = function (it, metadata) {
  11153. wmset.call(store, it, metadata);
  11154. return metadata;
  11155. };
  11156. get = function (it) {
  11157. return wmget.call(store, it) || {};
  11158. };
  11159. has = function (it) {
  11160. return wmhas.call(store, it);
  11161. };
  11162. } else {
  11163. var STATE = sharedKey('state');
  11164. hiddenKeys[STATE] = true;
  11165. set = function (it, metadata) {
  11166. createNonEnumerableProperty(it, STATE, metadata);
  11167. return metadata;
  11168. };
  11169. get = function (it) {
  11170. return objectHas(it, STATE) ? it[STATE] : {};
  11171. };
  11172. has = function (it) {
  11173. return objectHas(it, STATE);
  11174. };
  11175. }
  11176. module.exports = {
  11177. set: set,
  11178. get: get,
  11179. has: has,
  11180. enforce: enforce,
  11181. getterFor: getterFor
  11182. };
  11183. /***/ }),
  11184. /***/ "c10f":
  11185. /***/ (function(module, exports, __webpack_require__) {
  11186. var requireObjectCoercible = __webpack_require__("2732");
  11187. var whitespaces = __webpack_require__("fc8c");
  11188. var whitespace = '[' + whitespaces + ']';
  11189. var ltrim = RegExp('^' + whitespace + whitespace + '*');
  11190. var rtrim = RegExp(whitespace + whitespace + '*$');
  11191. // `String.prototype.{ trim, trimStart, trimEnd, trimLeft, trimRight }` methods implementation
  11192. var createMethod = function (TYPE) {
  11193. return function ($this) {
  11194. var string = String(requireObjectCoercible($this));
  11195. if (TYPE & 1) string = string.replace(ltrim, '');
  11196. if (TYPE & 2) string = string.replace(rtrim, '');
  11197. return string;
  11198. };
  11199. };
  11200. module.exports = {
  11201. // `String.prototype.{ trimLeft, trimStart }` methods
  11202. // https://tc39.github.io/ecma262/#sec-string.prototype.trimstart
  11203. start: createMethod(1),
  11204. // `String.prototype.{ trimRight, trimEnd }` methods
  11205. // https://tc39.github.io/ecma262/#sec-string.prototype.trimend
  11206. end: createMethod(2),
  11207. // `String.prototype.trim` method
  11208. // https://tc39.github.io/ecma262/#sec-string.prototype.trim
  11209. trim: createMethod(3)
  11210. };
  11211. /***/ }),
  11212. /***/ "c54b":
  11213. /***/ (function(module, exports, __webpack_require__) {
  11214. var fails = __webpack_require__("efe2");
  11215. module.exports = !!Object.getOwnPropertySymbols && !fails(function () {
  11216. // Chrome 38 Symbol has incorrect toString conversion
  11217. // eslint-disable-next-line no-undef
  11218. return !String(Symbol());
  11219. });
  11220. /***/ }),
  11221. /***/ "c69d":
  11222. /***/ (function(module, exports, __webpack_require__) {
  11223. var has = __webpack_require__("faa8");
  11224. var ownKeys = __webpack_require__("8d44");
  11225. var getOwnPropertyDescriptorModule = __webpack_require__("aa6b");
  11226. var definePropertyModule = __webpack_require__("d910");
  11227. module.exports = function (target, source) {
  11228. var keys = ownKeys(source);
  11229. var defineProperty = definePropertyModule.f;
  11230. var getOwnPropertyDescriptor = getOwnPropertyDescriptorModule.f;
  11231. for (var i = 0; i < keys.length; i++) {
  11232. var key = keys[i];
  11233. if (!has(target, key)) defineProperty(target, key, getOwnPropertyDescriptor(source, key));
  11234. }
  11235. };
  11236. /***/ }),
  11237. /***/ "cbab":
  11238. /***/ (function(module, exports, __webpack_require__) {
  11239. var internalObjectKeys = __webpack_require__("ead4");
  11240. var enumBugKeys = __webpack_require__("18f6");
  11241. // `Object.keys` method
  11242. // https://tc39.github.io/ecma262/#sec-object.keys
  11243. module.exports = Object.keys || function keys(O) {
  11244. return internalObjectKeys(O, enumBugKeys);
  11245. };
  11246. /***/ }),
  11247. /***/ "d1fd":
  11248. /***/ (function(module, exports, __webpack_require__) {
  11249. var isObject = __webpack_require__("a719");
  11250. module.exports = function (it) {
  11251. if (!isObject(it) && it !== null) {
  11252. throw TypeError("Can't set " + String(it) + ' as a prototype');
  11253. } return it;
  11254. };
  11255. /***/ }),
  11256. /***/ "d5a8":
  11257. /***/ (function(module, exports) {
  11258. module.exports = {};
  11259. /***/ }),
  11260. /***/ "d88d":
  11261. /***/ (function(module, exports, __webpack_require__) {
  11262. var toInteger = __webpack_require__("3da3");
  11263. var min = Math.min;
  11264. // `ToLength` abstract operation
  11265. // https://tc39.github.io/ecma262/#sec-tolength
  11266. module.exports = function (argument) {
  11267. return argument > 0 ? min(toInteger(argument), 0x1FFFFFFFFFFFFF) : 0; // 2 ** 53 - 1 == 9007199254740991
  11268. };
  11269. /***/ }),
  11270. /***/ "d890":
  11271. /***/ (function(module, exports, __webpack_require__) {
  11272. /* WEBPACK VAR INJECTION */(function(global) {var check = function (it) {
  11273. return it && it.Math == Math && it;
  11274. };
  11275. // https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
  11276. module.exports =
  11277. // eslint-disable-next-line no-undef
  11278. check(typeof globalThis == 'object' && globalThis) ||
  11279. check(typeof window == 'object' && window) ||
  11280. check(typeof self == 'object' && self) ||
  11281. check(typeof global == 'object' && global) ||
  11282. // eslint-disable-next-line no-new-func
  11283. Function('return this')();
  11284. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("9edd")))
  11285. /***/ }),
  11286. /***/ "d910":
  11287. /***/ (function(module, exports, __webpack_require__) {
  11288. var DESCRIPTORS = __webpack_require__("1e2c");
  11289. var IE8_DOM_DEFINE = __webpack_require__("2039");
  11290. var anObject = __webpack_require__("857c");
  11291. var toPrimitive = __webpack_require__("9f67");
  11292. var nativeDefineProperty = Object.defineProperty;
  11293. // `Object.defineProperty` method
  11294. // https://tc39.github.io/ecma262/#sec-object.defineproperty
  11295. exports.f = DESCRIPTORS ? nativeDefineProperty : function defineProperty(O, P, Attributes) {
  11296. anObject(O);
  11297. P = toPrimitive(P, true);
  11298. anObject(Attributes);
  11299. if (IE8_DOM_DEFINE) try {
  11300. return nativeDefineProperty(O, P, Attributes);
  11301. } catch (error) { /* empty */ }
  11302. if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported');
  11303. if ('value' in Attributes) O[P] = Attributes.value;
  11304. return O;
  11305. };
  11306. /***/ }),
  11307. /***/ "da10":
  11308. /***/ (function(module, exports, __webpack_require__) {
  11309. // toObject with fallback for non-array-like ES3 strings
  11310. var IndexedObject = __webpack_require__("692f");
  11311. var requireObjectCoercible = __webpack_require__("2732");
  11312. module.exports = function (it) {
  11313. return IndexedObject(requireObjectCoercible(it));
  11314. };
  11315. /***/ }),
  11316. /***/ "dbe8":
  11317. /***/ (function(module, exports, __webpack_require__) {
  11318. var DESCRIPTORS = __webpack_require__("1e2c");
  11319. var definePropertyModule = __webpack_require__("d910");
  11320. var anObject = __webpack_require__("857c");
  11321. var objectKeys = __webpack_require__("cbab");
  11322. // `Object.defineProperties` method
  11323. // https://tc39.github.io/ecma262/#sec-object.defineproperties
  11324. module.exports = DESCRIPTORS ? Object.defineProperties : function defineProperties(O, Properties) {
  11325. anObject(O);
  11326. var keys = objectKeys(Properties);
  11327. var length = keys.length;
  11328. var index = 0;
  11329. var key;
  11330. while (length > index) definePropertyModule.f(O, key = keys[index++], Properties[key]);
  11331. return O;
  11332. };
  11333. /***/ }),
  11334. /***/ "e1d6":
  11335. /***/ (function(module, exports, __webpack_require__) {
  11336. var toInteger = __webpack_require__("3da3");
  11337. var max = Math.max;
  11338. var min = Math.min;
  11339. // Helper for a popular repeating case of the spec:
  11340. // Let integer be ? ToInteger(index).
  11341. // If integer < 0, let result be max((length + integer), 0); else let result be min(integer, length).
  11342. module.exports = function (index, length) {
  11343. var integer = toInteger(index);
  11344. return integer < 0 ? max(integer + length, 0) : min(integer, length);
  11345. };
  11346. /***/ }),
  11347. /***/ "e4db":
  11348. /***/ (function(module, exports, __webpack_require__) {
  11349. var global = __webpack_require__("d890");
  11350. var createNonEnumerableProperty = __webpack_require__("0fc1");
  11351. module.exports = function (key, value) {
  11352. try {
  11353. createNonEnumerableProperty(global, key, value);
  11354. } catch (error) {
  11355. global[key] = value;
  11356. } return value;
  11357. };
  11358. /***/ }),
  11359. /***/ "e8d6":
  11360. /***/ (function(module, exports, __webpack_require__) {
  11361. var fails = __webpack_require__("efe2");
  11362. var replacement = /#|\.prototype\./;
  11363. var isForced = function (feature, detection) {
  11364. var value = data[normalize(feature)];
  11365. return value == POLYFILL ? true
  11366. : value == NATIVE ? false
  11367. : typeof detection == 'function' ? fails(detection)
  11368. : !!detection;
  11369. };
  11370. var normalize = isForced.normalize = function (string) {
  11371. return String(string).replace(replacement, '.').toLowerCase();
  11372. };
  11373. var data = isForced.data = {};
  11374. var NATIVE = isForced.NATIVE = 'N';
  11375. var POLYFILL = isForced.POLYFILL = 'P';
  11376. module.exports = isForced;
  11377. /***/ }),
  11378. /***/ "ead4":
  11379. /***/ (function(module, exports, __webpack_require__) {
  11380. var has = __webpack_require__("faa8");
  11381. var toIndexedObject = __webpack_require__("da10");
  11382. var indexOf = __webpack_require__("45af").indexOf;
  11383. var hiddenKeys = __webpack_require__("d5a8");
  11384. module.exports = function (object, names) {
  11385. var O = toIndexedObject(object);
  11386. var i = 0;
  11387. var result = [];
  11388. var key;
  11389. for (key in O) !has(hiddenKeys, key) && has(O, key) && result.push(key);
  11390. // Don't enum bug & hidden keys
  11391. while (names.length > i) if (has(O, key = names[i++])) {
  11392. ~indexOf(result, key) || result.push(key);
  11393. }
  11394. return result;
  11395. };
  11396. /***/ }),
  11397. /***/ "ef71":
  11398. /***/ (function(module, exports, __webpack_require__) {
  11399. "use strict";
  11400. var nativePropertyIsEnumerable = {}.propertyIsEnumerable;
  11401. var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
  11402. // Nashorn ~ JDK8 bug
  11403. var NASHORN_BUG = getOwnPropertyDescriptor && !nativePropertyIsEnumerable.call({ 1: 2 }, 1);
  11404. // `Object.prototype.propertyIsEnumerable` method implementation
  11405. // https://tc39.github.io/ecma262/#sec-object.prototype.propertyisenumerable
  11406. exports.f = NASHORN_BUG ? function propertyIsEnumerable(V) {
  11407. var descriptor = getOwnPropertyDescriptor(this, V);
  11408. return !!descriptor && descriptor.enumerable;
  11409. } : nativePropertyIsEnumerable;
  11410. /***/ }),
  11411. /***/ "efe2":
  11412. /***/ (function(module, exports) {
  11413. module.exports = function (exec) {
  11414. try {
  11415. return !!exec();
  11416. } catch (error) {
  11417. return true;
  11418. }
  11419. };
  11420. /***/ }),
  11421. /***/ "f594":
  11422. /***/ (function(module, exports, __webpack_require__) {
  11423. var global = __webpack_require__("d890");
  11424. var userAgent = __webpack_require__("4fda");
  11425. var process = global.process;
  11426. var versions = process && process.versions;
  11427. var v8 = versions && versions.v8;
  11428. var match, version;
  11429. if (v8) {
  11430. match = v8.split('.');
  11431. version = match[0] + match[1];
  11432. } else if (userAgent) {
  11433. match = userAgent.match(/Edge\/(\d+)/);
  11434. if (!match || match[1] >= 74) {
  11435. match = userAgent.match(/Chrome\/(\d+)/);
  11436. if (match) version = match[1];
  11437. }
  11438. }
  11439. module.exports = version && +version;
  11440. /***/ }),
  11441. /***/ "faa8":
  11442. /***/ (function(module, exports) {
  11443. var hasOwnProperty = {}.hasOwnProperty;
  11444. module.exports = function (it, key) {
  11445. return hasOwnProperty.call(it, key);
  11446. };
  11447. /***/ }),
  11448. /***/ "fb22":
  11449. /***/ (function(module, exports) {
  11450. exports.read = function (buffer, offset, isLE, mLen, nBytes) {
  11451. var e, m
  11452. var eLen = (nBytes * 8) - mLen - 1
  11453. var eMax = (1 << eLen) - 1
  11454. var eBias = eMax >> 1
  11455. var nBits = -7
  11456. var i = isLE ? (nBytes - 1) : 0
  11457. var d = isLE ? -1 : 1
  11458. var s = buffer[offset + i]
  11459. i += d
  11460. e = s & ((1 << (-nBits)) - 1)
  11461. s >>= (-nBits)
  11462. nBits += eLen
  11463. for (; nBits > 0; e = (e * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11464. m = e & ((1 << (-nBits)) - 1)
  11465. e >>= (-nBits)
  11466. nBits += mLen
  11467. for (; nBits > 0; m = (m * 256) + buffer[offset + i], i += d, nBits -= 8) {}
  11468. if (e === 0) {
  11469. e = 1 - eBias
  11470. } else if (e === eMax) {
  11471. return m ? NaN : ((s ? -1 : 1) * Infinity)
  11472. } else {
  11473. m = m + Math.pow(2, mLen)
  11474. e = e - eBias
  11475. }
  11476. return (s ? -1 : 1) * m * Math.pow(2, e - mLen)
  11477. }
  11478. exports.write = function (buffer, value, offset, isLE, mLen, nBytes) {
  11479. var e, m, c
  11480. var eLen = (nBytes * 8) - mLen - 1
  11481. var eMax = (1 << eLen) - 1
  11482. var eBias = eMax >> 1
  11483. var rt = (mLen === 23 ? Math.pow(2, -24) - Math.pow(2, -77) : 0)
  11484. var i = isLE ? 0 : (nBytes - 1)
  11485. var d = isLE ? 1 : -1
  11486. var s = value < 0 || (value === 0 && 1 / value < 0) ? 1 : 0
  11487. value = Math.abs(value)
  11488. if (isNaN(value) || value === Infinity) {
  11489. m = isNaN(value) ? 1 : 0
  11490. e = eMax
  11491. } else {
  11492. e = Math.floor(Math.log(value) / Math.LN2)
  11493. if (value * (c = Math.pow(2, -e)) < 1) {
  11494. e--
  11495. c *= 2
  11496. }
  11497. if (e + eBias >= 1) {
  11498. value += rt / c
  11499. } else {
  11500. value += rt * Math.pow(2, 1 - eBias)
  11501. }
  11502. if (value * c >= 2) {
  11503. e++
  11504. c /= 2
  11505. }
  11506. if (e + eBias >= eMax) {
  11507. m = 0
  11508. e = eMax
  11509. } else if (e + eBias >= 1) {
  11510. m = ((value * c) - 1) * Math.pow(2, mLen)
  11511. e = e + eBias
  11512. } else {
  11513. m = value * Math.pow(2, eBias - 1) * Math.pow(2, mLen)
  11514. e = 0
  11515. }
  11516. }
  11517. for (; mLen >= 8; buffer[offset + i] = m & 0xff, i += d, m /= 256, mLen -= 8) {}
  11518. e = (e << mLen) | m
  11519. eLen += mLen
  11520. for (; eLen > 0; buffer[offset + i] = e & 0xff, i += d, e /= 256, eLen -= 8) {}
  11521. buffer[offset + i - d] |= s * 128
  11522. }
  11523. /***/ }),
  11524. /***/ "fc8c":
  11525. /***/ (function(module, exports) {
  11526. // a string of all valid unicode whitespaces
  11527. // eslint-disable-next-line max-len
  11528. module.exports = '\u0009\u000A\u000B\u000C\u000D\u0020\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF';
  11529. /***/ }),
  11530. /***/ "fd40":
  11531. /***/ (function(module, exports, __webpack_require__) {
  11532. "use strict";
  11533. /* WEBPACK VAR INJECTION */(function(global) {/*!
  11534. * The buffer module from node.js, for the browser.
  11535. *
  11536. * @author Feross Aboukhadijeh <http://feross.org>
  11537. * @license MIT
  11538. */
  11539. /* eslint-disable no-proto */
  11540. var base64 = __webpack_require__("27cd")
  11541. var ieee754 = __webpack_require__("fb22")
  11542. var isArray = __webpack_require__("571a")
  11543. exports.Buffer = Buffer
  11544. exports.SlowBuffer = SlowBuffer
  11545. exports.INSPECT_MAX_BYTES = 50
  11546. /**
  11547. * If `Buffer.TYPED_ARRAY_SUPPORT`:
  11548. * === true Use Uint8Array implementation (fastest)
  11549. * === false Use Object implementation (most compatible, even IE6)
  11550. *
  11551. * Browsers that support typed arrays are IE 10+, Firefox 4+, Chrome 7+, Safari 5.1+,
  11552. * Opera 11.6+, iOS 4.2+.
  11553. *
  11554. * Due to various browser bugs, sometimes the Object implementation will be used even
  11555. * when the browser supports typed arrays.
  11556. *
  11557. * Note:
  11558. *
  11559. * - Firefox 4-29 lacks support for adding new properties to `Uint8Array` instances,
  11560. * See: https://bugzilla.mozilla.org/show_bug.cgi?id=695438.
  11561. *
  11562. * - Chrome 9-10 is missing the `TypedArray.prototype.subarray` function.
  11563. *
  11564. * - IE10 has a broken `TypedArray.prototype.subarray` function which returns arrays of
  11565. * incorrect length in some situations.
  11566. * We detect these buggy browsers and set `Buffer.TYPED_ARRAY_SUPPORT` to `false` so they
  11567. * get the Object implementation, which is slower but behaves correctly.
  11568. */
  11569. Buffer.TYPED_ARRAY_SUPPORT = global.TYPED_ARRAY_SUPPORT !== undefined
  11570. ? global.TYPED_ARRAY_SUPPORT
  11571. : typedArraySupport()
  11572. /*
  11573. * Export kMaxLength after typed array support is determined.
  11574. */
  11575. exports.kMaxLength = kMaxLength()
  11576. function typedArraySupport () {
  11577. try {
  11578. var arr = new Uint8Array(1)
  11579. arr.__proto__ = {__proto__: Uint8Array.prototype, foo: function () { return 42 }}
  11580. return arr.foo() === 42 && // typed array instances can be augmented
  11581. typeof arr.subarray === 'function' && // chrome 9-10 lack `subarray`
  11582. arr.subarray(1, 1).byteLength === 0 // ie10 has broken `subarray`
  11583. } catch (e) {
  11584. return false
  11585. }
  11586. }
  11587. function kMaxLength () {
  11588. return Buffer.TYPED_ARRAY_SUPPORT
  11589. ? 0x7fffffff
  11590. : 0x3fffffff
  11591. }
  11592. function createBuffer (that, length) {
  11593. if (kMaxLength() < length) {
  11594. throw new RangeError('Invalid typed array length')
  11595. }
  11596. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11597. // Return an augmented `Uint8Array` instance, for best performance
  11598. that = new Uint8Array(length)
  11599. that.__proto__ = Buffer.prototype
  11600. } else {
  11601. // Fallback: Return an object instance of the Buffer class
  11602. if (that === null) {
  11603. that = new Buffer(length)
  11604. }
  11605. that.length = length
  11606. }
  11607. return that
  11608. }
  11609. /**
  11610. * The Buffer constructor returns instances of `Uint8Array` that have their
  11611. * prototype changed to `Buffer.prototype`. Furthermore, `Buffer` is a subclass of
  11612. * `Uint8Array`, so the returned instances will have all the node `Buffer` methods
  11613. * and the `Uint8Array` methods. Square bracket notation works as expected -- it
  11614. * returns a single octet.
  11615. *
  11616. * The `Uint8Array` prototype remains unmodified.
  11617. */
  11618. function Buffer (arg, encodingOrOffset, length) {
  11619. if (!Buffer.TYPED_ARRAY_SUPPORT && !(this instanceof Buffer)) {
  11620. return new Buffer(arg, encodingOrOffset, length)
  11621. }
  11622. // Common case.
  11623. if (typeof arg === 'number') {
  11624. if (typeof encodingOrOffset === 'string') {
  11625. throw new Error(
  11626. 'If encoding is specified then the first argument must be a string'
  11627. )
  11628. }
  11629. return allocUnsafe(this, arg)
  11630. }
  11631. return from(this, arg, encodingOrOffset, length)
  11632. }
  11633. Buffer.poolSize = 8192 // not used by this implementation
  11634. // TODO: Legacy, not needed anymore. Remove in next major version.
  11635. Buffer._augment = function (arr) {
  11636. arr.__proto__ = Buffer.prototype
  11637. return arr
  11638. }
  11639. function from (that, value, encodingOrOffset, length) {
  11640. if (typeof value === 'number') {
  11641. throw new TypeError('"value" argument must not be a number')
  11642. }
  11643. if (typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer) {
  11644. return fromArrayBuffer(that, value, encodingOrOffset, length)
  11645. }
  11646. if (typeof value === 'string') {
  11647. return fromString(that, value, encodingOrOffset)
  11648. }
  11649. return fromObject(that, value)
  11650. }
  11651. /**
  11652. * Functionally equivalent to Buffer(arg, encoding) but throws a TypeError
  11653. * if value is a number.
  11654. * Buffer.from(str[, encoding])
  11655. * Buffer.from(array)
  11656. * Buffer.from(buffer)
  11657. * Buffer.from(arrayBuffer[, byteOffset[, length]])
  11658. **/
  11659. Buffer.from = function (value, encodingOrOffset, length) {
  11660. return from(null, value, encodingOrOffset, length)
  11661. }
  11662. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11663. Buffer.prototype.__proto__ = Uint8Array.prototype
  11664. Buffer.__proto__ = Uint8Array
  11665. if (typeof Symbol !== 'undefined' && Symbol.species &&
  11666. Buffer[Symbol.species] === Buffer) {
  11667. // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
  11668. Object.defineProperty(Buffer, Symbol.species, {
  11669. value: null,
  11670. configurable: true
  11671. })
  11672. }
  11673. }
  11674. function assertSize (size) {
  11675. if (typeof size !== 'number') {
  11676. throw new TypeError('"size" argument must be a number')
  11677. } else if (size < 0) {
  11678. throw new RangeError('"size" argument must not be negative')
  11679. }
  11680. }
  11681. function alloc (that, size, fill, encoding) {
  11682. assertSize(size)
  11683. if (size <= 0) {
  11684. return createBuffer(that, size)
  11685. }
  11686. if (fill !== undefined) {
  11687. // Only pay attention to encoding if it's a string. This
  11688. // prevents accidentally sending in a number that would
  11689. // be interpretted as a start offset.
  11690. return typeof encoding === 'string'
  11691. ? createBuffer(that, size).fill(fill, encoding)
  11692. : createBuffer(that, size).fill(fill)
  11693. }
  11694. return createBuffer(that, size)
  11695. }
  11696. /**
  11697. * Creates a new filled Buffer instance.
  11698. * alloc(size[, fill[, encoding]])
  11699. **/
  11700. Buffer.alloc = function (size, fill, encoding) {
  11701. return alloc(null, size, fill, encoding)
  11702. }
  11703. function allocUnsafe (that, size) {
  11704. assertSize(size)
  11705. that = createBuffer(that, size < 0 ? 0 : checked(size) | 0)
  11706. if (!Buffer.TYPED_ARRAY_SUPPORT) {
  11707. for (var i = 0; i < size; ++i) {
  11708. that[i] = 0
  11709. }
  11710. }
  11711. return that
  11712. }
  11713. /**
  11714. * Equivalent to Buffer(num), by default creates a non-zero-filled Buffer instance.
  11715. * */
  11716. Buffer.allocUnsafe = function (size) {
  11717. return allocUnsafe(null, size)
  11718. }
  11719. /**
  11720. * Equivalent to SlowBuffer(num), by default creates a non-zero-filled Buffer instance.
  11721. */
  11722. Buffer.allocUnsafeSlow = function (size) {
  11723. return allocUnsafe(null, size)
  11724. }
  11725. function fromString (that, string, encoding) {
  11726. if (typeof encoding !== 'string' || encoding === '') {
  11727. encoding = 'utf8'
  11728. }
  11729. if (!Buffer.isEncoding(encoding)) {
  11730. throw new TypeError('"encoding" must be a valid string encoding')
  11731. }
  11732. var length = byteLength(string, encoding) | 0
  11733. that = createBuffer(that, length)
  11734. var actual = that.write(string, encoding)
  11735. if (actual !== length) {
  11736. // Writing a hex string, for example, that contains invalid characters will
  11737. // cause everything after the first invalid character to be ignored. (e.g.
  11738. // 'abxxcd' will be treated as 'ab')
  11739. that = that.slice(0, actual)
  11740. }
  11741. return that
  11742. }
  11743. function fromArrayLike (that, array) {
  11744. var length = array.length < 0 ? 0 : checked(array.length) | 0
  11745. that = createBuffer(that, length)
  11746. for (var i = 0; i < length; i += 1) {
  11747. that[i] = array[i] & 255
  11748. }
  11749. return that
  11750. }
  11751. function fromArrayBuffer (that, array, byteOffset, length) {
  11752. array.byteLength // this throws if `array` is not a valid ArrayBuffer
  11753. if (byteOffset < 0 || array.byteLength < byteOffset) {
  11754. throw new RangeError('\'offset\' is out of bounds')
  11755. }
  11756. if (array.byteLength < byteOffset + (length || 0)) {
  11757. throw new RangeError('\'length\' is out of bounds')
  11758. }
  11759. if (byteOffset === undefined && length === undefined) {
  11760. array = new Uint8Array(array)
  11761. } else if (length === undefined) {
  11762. array = new Uint8Array(array, byteOffset)
  11763. } else {
  11764. array = new Uint8Array(array, byteOffset, length)
  11765. }
  11766. if (Buffer.TYPED_ARRAY_SUPPORT) {
  11767. // Return an augmented `Uint8Array` instance, for best performance
  11768. that = array
  11769. that.__proto__ = Buffer.prototype
  11770. } else {
  11771. // Fallback: Return an object instance of the Buffer class
  11772. that = fromArrayLike(that, array)
  11773. }
  11774. return that
  11775. }
  11776. function fromObject (that, obj) {
  11777. if (Buffer.isBuffer(obj)) {
  11778. var len = checked(obj.length) | 0
  11779. that = createBuffer(that, len)
  11780. if (that.length === 0) {
  11781. return that
  11782. }
  11783. obj.copy(that, 0, 0, len)
  11784. return that
  11785. }
  11786. if (obj) {
  11787. if ((typeof ArrayBuffer !== 'undefined' &&
  11788. obj.buffer instanceof ArrayBuffer) || 'length' in obj) {
  11789. if (typeof obj.length !== 'number' || isnan(obj.length)) {
  11790. return createBuffer(that, 0)
  11791. }
  11792. return fromArrayLike(that, obj)
  11793. }
  11794. if (obj.type === 'Buffer' && isArray(obj.data)) {
  11795. return fromArrayLike(that, obj.data)
  11796. }
  11797. }
  11798. throw new TypeError('First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.')
  11799. }
  11800. function checked (length) {
  11801. // Note: cannot use `length < kMaxLength()` here because that fails when
  11802. // length is NaN (which is otherwise coerced to zero.)
  11803. if (length >= kMaxLength()) {
  11804. throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
  11805. 'size: 0x' + kMaxLength().toString(16) + ' bytes')
  11806. }
  11807. return length | 0
  11808. }
  11809. function SlowBuffer (length) {
  11810. if (+length != length) { // eslint-disable-line eqeqeq
  11811. length = 0
  11812. }
  11813. return Buffer.alloc(+length)
  11814. }
  11815. Buffer.isBuffer = function isBuffer (b) {
  11816. return !!(b != null && b._isBuffer)
  11817. }
  11818. Buffer.compare = function compare (a, b) {
  11819. if (!Buffer.isBuffer(a) || !Buffer.isBuffer(b)) {
  11820. throw new TypeError('Arguments must be Buffers')
  11821. }
  11822. if (a === b) return 0
  11823. var x = a.length
  11824. var y = b.length
  11825. for (var i = 0, len = Math.min(x, y); i < len; ++i) {
  11826. if (a[i] !== b[i]) {
  11827. x = a[i]
  11828. y = b[i]
  11829. break
  11830. }
  11831. }
  11832. if (x < y) return -1
  11833. if (y < x) return 1
  11834. return 0
  11835. }
  11836. Buffer.isEncoding = function isEncoding (encoding) {
  11837. switch (String(encoding).toLowerCase()) {
  11838. case 'hex':
  11839. case 'utf8':
  11840. case 'utf-8':
  11841. case 'ascii':
  11842. case 'latin1':
  11843. case 'binary':
  11844. case 'base64':
  11845. case 'ucs2':
  11846. case 'ucs-2':
  11847. case 'utf16le':
  11848. case 'utf-16le':
  11849. return true
  11850. default:
  11851. return false
  11852. }
  11853. }
  11854. Buffer.concat = function concat (list, length) {
  11855. if (!isArray(list)) {
  11856. throw new TypeError('"list" argument must be an Array of Buffers')
  11857. }
  11858. if (list.length === 0) {
  11859. return Buffer.alloc(0)
  11860. }
  11861. var i
  11862. if (length === undefined) {
  11863. length = 0
  11864. for (i = 0; i < list.length; ++i) {
  11865. length += list[i].length
  11866. }
  11867. }
  11868. var buffer = Buffer.allocUnsafe(length)
  11869. var pos = 0
  11870. for (i = 0; i < list.length; ++i) {
  11871. var buf = list[i]
  11872. if (!Buffer.isBuffer(buf)) {
  11873. throw new TypeError('"list" argument must be an Array of Buffers')
  11874. }
  11875. buf.copy(buffer, pos)
  11876. pos += buf.length
  11877. }
  11878. return buffer
  11879. }
  11880. function byteLength (string, encoding) {
  11881. if (Buffer.isBuffer(string)) {
  11882. return string.length
  11883. }
  11884. if (typeof ArrayBuffer !== 'undefined' && typeof ArrayBuffer.isView === 'function' &&
  11885. (ArrayBuffer.isView(string) || string instanceof ArrayBuffer)) {
  11886. return string.byteLength
  11887. }
  11888. if (typeof string !== 'string') {
  11889. string = '' + string
  11890. }
  11891. var len = string.length
  11892. if (len === 0) return 0
  11893. // Use a for loop to avoid recursion
  11894. var loweredCase = false
  11895. for (;;) {
  11896. switch (encoding) {
  11897. case 'ascii':
  11898. case 'latin1':
  11899. case 'binary':
  11900. return len
  11901. case 'utf8':
  11902. case 'utf-8':
  11903. case undefined:
  11904. return utf8ToBytes(string).length
  11905. case 'ucs2':
  11906. case 'ucs-2':
  11907. case 'utf16le':
  11908. case 'utf-16le':
  11909. return len * 2
  11910. case 'hex':
  11911. return len >>> 1
  11912. case 'base64':
  11913. return base64ToBytes(string).length
  11914. default:
  11915. if (loweredCase) return utf8ToBytes(string).length // assume utf8
  11916. encoding = ('' + encoding).toLowerCase()
  11917. loweredCase = true
  11918. }
  11919. }
  11920. }
  11921. Buffer.byteLength = byteLength
  11922. function slowToString (encoding, start, end) {
  11923. var loweredCase = false
  11924. // No need to verify that "this.length <= MAX_UINT32" since it's a read-only
  11925. // property of a typed array.
  11926. // This behaves neither like String nor Uint8Array in that we set start/end
  11927. // to their upper/lower bounds if the value passed is out of range.
  11928. // undefined is handled specially as per ECMA-262 6th Edition,
  11929. // Section 13.3.3.7 Runtime Semantics: KeyedBindingInitialization.
  11930. if (start === undefined || start < 0) {
  11931. start = 0
  11932. }
  11933. // Return early if start > this.length. Done here to prevent potential uint32
  11934. // coercion fail below.
  11935. if (start > this.length) {
  11936. return ''
  11937. }
  11938. if (end === undefined || end > this.length) {
  11939. end = this.length
  11940. }
  11941. if (end <= 0) {
  11942. return ''
  11943. }
  11944. // Force coersion to uint32. This will also coerce falsey/NaN values to 0.
  11945. end >>>= 0
  11946. start >>>= 0
  11947. if (end <= start) {
  11948. return ''
  11949. }
  11950. if (!encoding) encoding = 'utf8'
  11951. while (true) {
  11952. switch (encoding) {
  11953. case 'hex':
  11954. return hexSlice(this, start, end)
  11955. case 'utf8':
  11956. case 'utf-8':
  11957. return utf8Slice(this, start, end)
  11958. case 'ascii':
  11959. return asciiSlice(this, start, end)
  11960. case 'latin1':
  11961. case 'binary':
  11962. return latin1Slice(this, start, end)
  11963. case 'base64':
  11964. return base64Slice(this, start, end)
  11965. case 'ucs2':
  11966. case 'ucs-2':
  11967. case 'utf16le':
  11968. case 'utf-16le':
  11969. return utf16leSlice(this, start, end)
  11970. default:
  11971. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  11972. encoding = (encoding + '').toLowerCase()
  11973. loweredCase = true
  11974. }
  11975. }
  11976. }
  11977. // The property is used by `Buffer.isBuffer` and `is-buffer` (in Safari 5-7) to detect
  11978. // Buffer instances.
  11979. Buffer.prototype._isBuffer = true
  11980. function swap (b, n, m) {
  11981. var i = b[n]
  11982. b[n] = b[m]
  11983. b[m] = i
  11984. }
  11985. Buffer.prototype.swap16 = function swap16 () {
  11986. var len = this.length
  11987. if (len % 2 !== 0) {
  11988. throw new RangeError('Buffer size must be a multiple of 16-bits')
  11989. }
  11990. for (var i = 0; i < len; i += 2) {
  11991. swap(this, i, i + 1)
  11992. }
  11993. return this
  11994. }
  11995. Buffer.prototype.swap32 = function swap32 () {
  11996. var len = this.length
  11997. if (len % 4 !== 0) {
  11998. throw new RangeError('Buffer size must be a multiple of 32-bits')
  11999. }
  12000. for (var i = 0; i < len; i += 4) {
  12001. swap(this, i, i + 3)
  12002. swap(this, i + 1, i + 2)
  12003. }
  12004. return this
  12005. }
  12006. Buffer.prototype.swap64 = function swap64 () {
  12007. var len = this.length
  12008. if (len % 8 !== 0) {
  12009. throw new RangeError('Buffer size must be a multiple of 64-bits')
  12010. }
  12011. for (var i = 0; i < len; i += 8) {
  12012. swap(this, i, i + 7)
  12013. swap(this, i + 1, i + 6)
  12014. swap(this, i + 2, i + 5)
  12015. swap(this, i + 3, i + 4)
  12016. }
  12017. return this
  12018. }
  12019. Buffer.prototype.toString = function toString () {
  12020. var length = this.length | 0
  12021. if (length === 0) return ''
  12022. if (arguments.length === 0) return utf8Slice(this, 0, length)
  12023. return slowToString.apply(this, arguments)
  12024. }
  12025. Buffer.prototype.equals = function equals (b) {
  12026. if (!Buffer.isBuffer(b)) throw new TypeError('Argument must be a Buffer')
  12027. if (this === b) return true
  12028. return Buffer.compare(this, b) === 0
  12029. }
  12030. Buffer.prototype.inspect = function inspect () {
  12031. var str = ''
  12032. var max = exports.INSPECT_MAX_BYTES
  12033. if (this.length > 0) {
  12034. str = this.toString('hex', 0, max).match(/.{2}/g).join(' ')
  12035. if (this.length > max) str += ' ... '
  12036. }
  12037. return '<Buffer ' + str + '>'
  12038. }
  12039. Buffer.prototype.compare = function compare (target, start, end, thisStart, thisEnd) {
  12040. if (!Buffer.isBuffer(target)) {
  12041. throw new TypeError('Argument must be a Buffer')
  12042. }
  12043. if (start === undefined) {
  12044. start = 0
  12045. }
  12046. if (end === undefined) {
  12047. end = target ? target.length : 0
  12048. }
  12049. if (thisStart === undefined) {
  12050. thisStart = 0
  12051. }
  12052. if (thisEnd === undefined) {
  12053. thisEnd = this.length
  12054. }
  12055. if (start < 0 || end > target.length || thisStart < 0 || thisEnd > this.length) {
  12056. throw new RangeError('out of range index')
  12057. }
  12058. if (thisStart >= thisEnd && start >= end) {
  12059. return 0
  12060. }
  12061. if (thisStart >= thisEnd) {
  12062. return -1
  12063. }
  12064. if (start >= end) {
  12065. return 1
  12066. }
  12067. start >>>= 0
  12068. end >>>= 0
  12069. thisStart >>>= 0
  12070. thisEnd >>>= 0
  12071. if (this === target) return 0
  12072. var x = thisEnd - thisStart
  12073. var y = end - start
  12074. var len = Math.min(x, y)
  12075. var thisCopy = this.slice(thisStart, thisEnd)
  12076. var targetCopy = target.slice(start, end)
  12077. for (var i = 0; i < len; ++i) {
  12078. if (thisCopy[i] !== targetCopy[i]) {
  12079. x = thisCopy[i]
  12080. y = targetCopy[i]
  12081. break
  12082. }
  12083. }
  12084. if (x < y) return -1
  12085. if (y < x) return 1
  12086. return 0
  12087. }
  12088. // Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
  12089. // OR the last index of `val` in `buffer` at offset <= `byteOffset`.
  12090. //
  12091. // Arguments:
  12092. // - buffer - a Buffer to search
  12093. // - val - a string, Buffer, or number
  12094. // - byteOffset - an index into `buffer`; will be clamped to an int32
  12095. // - encoding - an optional encoding, relevant is val is a string
  12096. // - dir - true for indexOf, false for lastIndexOf
  12097. function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
  12098. // Empty buffer means no match
  12099. if (buffer.length === 0) return -1
  12100. // Normalize byteOffset
  12101. if (typeof byteOffset === 'string') {
  12102. encoding = byteOffset
  12103. byteOffset = 0
  12104. } else if (byteOffset > 0x7fffffff) {
  12105. byteOffset = 0x7fffffff
  12106. } else if (byteOffset < -0x80000000) {
  12107. byteOffset = -0x80000000
  12108. }
  12109. byteOffset = +byteOffset // Coerce to Number.
  12110. if (isNaN(byteOffset)) {
  12111. // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
  12112. byteOffset = dir ? 0 : (buffer.length - 1)
  12113. }
  12114. // Normalize byteOffset: negative offsets start from the end of the buffer
  12115. if (byteOffset < 0) byteOffset = buffer.length + byteOffset
  12116. if (byteOffset >= buffer.length) {
  12117. if (dir) return -1
  12118. else byteOffset = buffer.length - 1
  12119. } else if (byteOffset < 0) {
  12120. if (dir) byteOffset = 0
  12121. else return -1
  12122. }
  12123. // Normalize val
  12124. if (typeof val === 'string') {
  12125. val = Buffer.from(val, encoding)
  12126. }
  12127. // Finally, search either indexOf (if dir is true) or lastIndexOf
  12128. if (Buffer.isBuffer(val)) {
  12129. // Special case: looking for empty string/buffer always fails
  12130. if (val.length === 0) {
  12131. return -1
  12132. }
  12133. return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
  12134. } else if (typeof val === 'number') {
  12135. val = val & 0xFF // Search for a byte value [0-255]
  12136. if (Buffer.TYPED_ARRAY_SUPPORT &&
  12137. typeof Uint8Array.prototype.indexOf === 'function') {
  12138. if (dir) {
  12139. return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
  12140. } else {
  12141. return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
  12142. }
  12143. }
  12144. return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
  12145. }
  12146. throw new TypeError('val must be string, number or Buffer')
  12147. }
  12148. function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
  12149. var indexSize = 1
  12150. var arrLength = arr.length
  12151. var valLength = val.length
  12152. if (encoding !== undefined) {
  12153. encoding = String(encoding).toLowerCase()
  12154. if (encoding === 'ucs2' || encoding === 'ucs-2' ||
  12155. encoding === 'utf16le' || encoding === 'utf-16le') {
  12156. if (arr.length < 2 || val.length < 2) {
  12157. return -1
  12158. }
  12159. indexSize = 2
  12160. arrLength /= 2
  12161. valLength /= 2
  12162. byteOffset /= 2
  12163. }
  12164. }
  12165. function read (buf, i) {
  12166. if (indexSize === 1) {
  12167. return buf[i]
  12168. } else {
  12169. return buf.readUInt16BE(i * indexSize)
  12170. }
  12171. }
  12172. var i
  12173. if (dir) {
  12174. var foundIndex = -1
  12175. for (i = byteOffset; i < arrLength; i++) {
  12176. if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
  12177. if (foundIndex === -1) foundIndex = i
  12178. if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
  12179. } else {
  12180. if (foundIndex !== -1) i -= i - foundIndex
  12181. foundIndex = -1
  12182. }
  12183. }
  12184. } else {
  12185. if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
  12186. for (i = byteOffset; i >= 0; i--) {
  12187. var found = true
  12188. for (var j = 0; j < valLength; j++) {
  12189. if (read(arr, i + j) !== read(val, j)) {
  12190. found = false
  12191. break
  12192. }
  12193. }
  12194. if (found) return i
  12195. }
  12196. }
  12197. return -1
  12198. }
  12199. Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
  12200. return this.indexOf(val, byteOffset, encoding) !== -1
  12201. }
  12202. Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
  12203. return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
  12204. }
  12205. Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
  12206. return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
  12207. }
  12208. function hexWrite (buf, string, offset, length) {
  12209. offset = Number(offset) || 0
  12210. var remaining = buf.length - offset
  12211. if (!length) {
  12212. length = remaining
  12213. } else {
  12214. length = Number(length)
  12215. if (length > remaining) {
  12216. length = remaining
  12217. }
  12218. }
  12219. // must be an even number of digits
  12220. var strLen = string.length
  12221. if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
  12222. if (length > strLen / 2) {
  12223. length = strLen / 2
  12224. }
  12225. for (var i = 0; i < length; ++i) {
  12226. var parsed = parseInt(string.substr(i * 2, 2), 16)
  12227. if (isNaN(parsed)) return i
  12228. buf[offset + i] = parsed
  12229. }
  12230. return i
  12231. }
  12232. function utf8Write (buf, string, offset, length) {
  12233. return blitBuffer(utf8ToBytes(string, buf.length - offset), buf, offset, length)
  12234. }
  12235. function asciiWrite (buf, string, offset, length) {
  12236. return blitBuffer(asciiToBytes(string), buf, offset, length)
  12237. }
  12238. function latin1Write (buf, string, offset, length) {
  12239. return asciiWrite(buf, string, offset, length)
  12240. }
  12241. function base64Write (buf, string, offset, length) {
  12242. return blitBuffer(base64ToBytes(string), buf, offset, length)
  12243. }
  12244. function ucs2Write (buf, string, offset, length) {
  12245. return blitBuffer(utf16leToBytes(string, buf.length - offset), buf, offset, length)
  12246. }
  12247. Buffer.prototype.write = function write (string, offset, length, encoding) {
  12248. // Buffer#write(string)
  12249. if (offset === undefined) {
  12250. encoding = 'utf8'
  12251. length = this.length
  12252. offset = 0
  12253. // Buffer#write(string, encoding)
  12254. } else if (length === undefined && typeof offset === 'string') {
  12255. encoding = offset
  12256. length = this.length
  12257. offset = 0
  12258. // Buffer#write(string, offset[, length][, encoding])
  12259. } else if (isFinite(offset)) {
  12260. offset = offset | 0
  12261. if (isFinite(length)) {
  12262. length = length | 0
  12263. if (encoding === undefined) encoding = 'utf8'
  12264. } else {
  12265. encoding = length
  12266. length = undefined
  12267. }
  12268. // legacy write(string, encoding, offset, length) - remove in v0.13
  12269. } else {
  12270. throw new Error(
  12271. 'Buffer.write(string, encoding, offset[, length]) is no longer supported'
  12272. )
  12273. }
  12274. var remaining = this.length - offset
  12275. if (length === undefined || length > remaining) length = remaining
  12276. if ((string.length > 0 && (length < 0 || offset < 0)) || offset > this.length) {
  12277. throw new RangeError('Attempt to write outside buffer bounds')
  12278. }
  12279. if (!encoding) encoding = 'utf8'
  12280. var loweredCase = false
  12281. for (;;) {
  12282. switch (encoding) {
  12283. case 'hex':
  12284. return hexWrite(this, string, offset, length)
  12285. case 'utf8':
  12286. case 'utf-8':
  12287. return utf8Write(this, string, offset, length)
  12288. case 'ascii':
  12289. return asciiWrite(this, string, offset, length)
  12290. case 'latin1':
  12291. case 'binary':
  12292. return latin1Write(this, string, offset, length)
  12293. case 'base64':
  12294. // Warning: maxLength not taken into account in base64Write
  12295. return base64Write(this, string, offset, length)
  12296. case 'ucs2':
  12297. case 'ucs-2':
  12298. case 'utf16le':
  12299. case 'utf-16le':
  12300. return ucs2Write(this, string, offset, length)
  12301. default:
  12302. if (loweredCase) throw new TypeError('Unknown encoding: ' + encoding)
  12303. encoding = ('' + encoding).toLowerCase()
  12304. loweredCase = true
  12305. }
  12306. }
  12307. }
  12308. Buffer.prototype.toJSON = function toJSON () {
  12309. return {
  12310. type: 'Buffer',
  12311. data: Array.prototype.slice.call(this._arr || this, 0)
  12312. }
  12313. }
  12314. function base64Slice (buf, start, end) {
  12315. if (start === 0 && end === buf.length) {
  12316. return base64.fromByteArray(buf)
  12317. } else {
  12318. return base64.fromByteArray(buf.slice(start, end))
  12319. }
  12320. }
  12321. function utf8Slice (buf, start, end) {
  12322. end = Math.min(buf.length, end)
  12323. var res = []
  12324. var i = start
  12325. while (i < end) {
  12326. var firstByte = buf[i]
  12327. var codePoint = null
  12328. var bytesPerSequence = (firstByte > 0xEF) ? 4
  12329. : (firstByte > 0xDF) ? 3
  12330. : (firstByte > 0xBF) ? 2
  12331. : 1
  12332. if (i + bytesPerSequence <= end) {
  12333. var secondByte, thirdByte, fourthByte, tempCodePoint
  12334. switch (bytesPerSequence) {
  12335. case 1:
  12336. if (firstByte < 0x80) {
  12337. codePoint = firstByte
  12338. }
  12339. break
  12340. case 2:
  12341. secondByte = buf[i + 1]
  12342. if ((secondByte & 0xC0) === 0x80) {
  12343. tempCodePoint = (firstByte & 0x1F) << 0x6 | (secondByte & 0x3F)
  12344. if (tempCodePoint > 0x7F) {
  12345. codePoint = tempCodePoint
  12346. }
  12347. }
  12348. break
  12349. case 3:
  12350. secondByte = buf[i + 1]
  12351. thirdByte = buf[i + 2]
  12352. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80) {
  12353. tempCodePoint = (firstByte & 0xF) << 0xC | (secondByte & 0x3F) << 0x6 | (thirdByte & 0x3F)
  12354. if (tempCodePoint > 0x7FF && (tempCodePoint < 0xD800 || tempCodePoint > 0xDFFF)) {
  12355. codePoint = tempCodePoint
  12356. }
  12357. }
  12358. break
  12359. case 4:
  12360. secondByte = buf[i + 1]
  12361. thirdByte = buf[i + 2]
  12362. fourthByte = buf[i + 3]
  12363. if ((secondByte & 0xC0) === 0x80 && (thirdByte & 0xC0) === 0x80 && (fourthByte & 0xC0) === 0x80) {
  12364. tempCodePoint = (firstByte & 0xF) << 0x12 | (secondByte & 0x3F) << 0xC | (thirdByte & 0x3F) << 0x6 | (fourthByte & 0x3F)
  12365. if (tempCodePoint > 0xFFFF && tempCodePoint < 0x110000) {
  12366. codePoint = tempCodePoint
  12367. }
  12368. }
  12369. }
  12370. }
  12371. if (codePoint === null) {
  12372. // we did not generate a valid codePoint so insert a
  12373. // replacement char (U+FFFD) and advance only 1 byte
  12374. codePoint = 0xFFFD
  12375. bytesPerSequence = 1
  12376. } else if (codePoint > 0xFFFF) {
  12377. // encode to utf16 (surrogate pair dance)
  12378. codePoint -= 0x10000
  12379. res.push(codePoint >>> 10 & 0x3FF | 0xD800)
  12380. codePoint = 0xDC00 | codePoint & 0x3FF
  12381. }
  12382. res.push(codePoint)
  12383. i += bytesPerSequence
  12384. }
  12385. return decodeCodePointsArray(res)
  12386. }
  12387. // Based on http://stackoverflow.com/a/22747272/680742, the browser with
  12388. // the lowest limit is Chrome, with 0x10000 args.
  12389. // We go 1 magnitude less, for safety
  12390. var MAX_ARGUMENTS_LENGTH = 0x1000
  12391. function decodeCodePointsArray (codePoints) {
  12392. var len = codePoints.length
  12393. if (len <= MAX_ARGUMENTS_LENGTH) {
  12394. return String.fromCharCode.apply(String, codePoints) // avoid extra slice()
  12395. }
  12396. // Decode in chunks to avoid "call stack size exceeded".
  12397. var res = ''
  12398. var i = 0
  12399. while (i < len) {
  12400. res += String.fromCharCode.apply(
  12401. String,
  12402. codePoints.slice(i, i += MAX_ARGUMENTS_LENGTH)
  12403. )
  12404. }
  12405. return res
  12406. }
  12407. function asciiSlice (buf, start, end) {
  12408. var ret = ''
  12409. end = Math.min(buf.length, end)
  12410. for (var i = start; i < end; ++i) {
  12411. ret += String.fromCharCode(buf[i] & 0x7F)
  12412. }
  12413. return ret
  12414. }
  12415. function latin1Slice (buf, start, end) {
  12416. var ret = ''
  12417. end = Math.min(buf.length, end)
  12418. for (var i = start; i < end; ++i) {
  12419. ret += String.fromCharCode(buf[i])
  12420. }
  12421. return ret
  12422. }
  12423. function hexSlice (buf, start, end) {
  12424. var len = buf.length
  12425. if (!start || start < 0) start = 0
  12426. if (!end || end < 0 || end > len) end = len
  12427. var out = ''
  12428. for (var i = start; i < end; ++i) {
  12429. out += toHex(buf[i])
  12430. }
  12431. return out
  12432. }
  12433. function utf16leSlice (buf, start, end) {
  12434. var bytes = buf.slice(start, end)
  12435. var res = ''
  12436. for (var i = 0; i < bytes.length; i += 2) {
  12437. res += String.fromCharCode(bytes[i] + bytes[i + 1] * 256)
  12438. }
  12439. return res
  12440. }
  12441. Buffer.prototype.slice = function slice (start, end) {
  12442. var len = this.length
  12443. start = ~~start
  12444. end = end === undefined ? len : ~~end
  12445. if (start < 0) {
  12446. start += len
  12447. if (start < 0) start = 0
  12448. } else if (start > len) {
  12449. start = len
  12450. }
  12451. if (end < 0) {
  12452. end += len
  12453. if (end < 0) end = 0
  12454. } else if (end > len) {
  12455. end = len
  12456. }
  12457. if (end < start) end = start
  12458. var newBuf
  12459. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12460. newBuf = this.subarray(start, end)
  12461. newBuf.__proto__ = Buffer.prototype
  12462. } else {
  12463. var sliceLen = end - start
  12464. newBuf = new Buffer(sliceLen, undefined)
  12465. for (var i = 0; i < sliceLen; ++i) {
  12466. newBuf[i] = this[i + start]
  12467. }
  12468. }
  12469. return newBuf
  12470. }
  12471. /*
  12472. * Need to make sure that buffer isn't trying to write out of bounds.
  12473. */
  12474. function checkOffset (offset, ext, length) {
  12475. if ((offset % 1) !== 0 || offset < 0) throw new RangeError('offset is not uint')
  12476. if (offset + ext > length) throw new RangeError('Trying to access beyond buffer length')
  12477. }
  12478. Buffer.prototype.readUIntLE = function readUIntLE (offset, byteLength, noAssert) {
  12479. offset = offset | 0
  12480. byteLength = byteLength | 0
  12481. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12482. var val = this[offset]
  12483. var mul = 1
  12484. var i = 0
  12485. while (++i < byteLength && (mul *= 0x100)) {
  12486. val += this[offset + i] * mul
  12487. }
  12488. return val
  12489. }
  12490. Buffer.prototype.readUIntBE = function readUIntBE (offset, byteLength, noAssert) {
  12491. offset = offset | 0
  12492. byteLength = byteLength | 0
  12493. if (!noAssert) {
  12494. checkOffset(offset, byteLength, this.length)
  12495. }
  12496. var val = this[offset + --byteLength]
  12497. var mul = 1
  12498. while (byteLength > 0 && (mul *= 0x100)) {
  12499. val += this[offset + --byteLength] * mul
  12500. }
  12501. return val
  12502. }
  12503. Buffer.prototype.readUInt8 = function readUInt8 (offset, noAssert) {
  12504. if (!noAssert) checkOffset(offset, 1, this.length)
  12505. return this[offset]
  12506. }
  12507. Buffer.prototype.readUInt16LE = function readUInt16LE (offset, noAssert) {
  12508. if (!noAssert) checkOffset(offset, 2, this.length)
  12509. return this[offset] | (this[offset + 1] << 8)
  12510. }
  12511. Buffer.prototype.readUInt16BE = function readUInt16BE (offset, noAssert) {
  12512. if (!noAssert) checkOffset(offset, 2, this.length)
  12513. return (this[offset] << 8) | this[offset + 1]
  12514. }
  12515. Buffer.prototype.readUInt32LE = function readUInt32LE (offset, noAssert) {
  12516. if (!noAssert) checkOffset(offset, 4, this.length)
  12517. return ((this[offset]) |
  12518. (this[offset + 1] << 8) |
  12519. (this[offset + 2] << 16)) +
  12520. (this[offset + 3] * 0x1000000)
  12521. }
  12522. Buffer.prototype.readUInt32BE = function readUInt32BE (offset, noAssert) {
  12523. if (!noAssert) checkOffset(offset, 4, this.length)
  12524. return (this[offset] * 0x1000000) +
  12525. ((this[offset + 1] << 16) |
  12526. (this[offset + 2] << 8) |
  12527. this[offset + 3])
  12528. }
  12529. Buffer.prototype.readIntLE = function readIntLE (offset, byteLength, noAssert) {
  12530. offset = offset | 0
  12531. byteLength = byteLength | 0
  12532. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12533. var val = this[offset]
  12534. var mul = 1
  12535. var i = 0
  12536. while (++i < byteLength && (mul *= 0x100)) {
  12537. val += this[offset + i] * mul
  12538. }
  12539. mul *= 0x80
  12540. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  12541. return val
  12542. }
  12543. Buffer.prototype.readIntBE = function readIntBE (offset, byteLength, noAssert) {
  12544. offset = offset | 0
  12545. byteLength = byteLength | 0
  12546. if (!noAssert) checkOffset(offset, byteLength, this.length)
  12547. var i = byteLength
  12548. var mul = 1
  12549. var val = this[offset + --i]
  12550. while (i > 0 && (mul *= 0x100)) {
  12551. val += this[offset + --i] * mul
  12552. }
  12553. mul *= 0x80
  12554. if (val >= mul) val -= Math.pow(2, 8 * byteLength)
  12555. return val
  12556. }
  12557. Buffer.prototype.readInt8 = function readInt8 (offset, noAssert) {
  12558. if (!noAssert) checkOffset(offset, 1, this.length)
  12559. if (!(this[offset] & 0x80)) return (this[offset])
  12560. return ((0xff - this[offset] + 1) * -1)
  12561. }
  12562. Buffer.prototype.readInt16LE = function readInt16LE (offset, noAssert) {
  12563. if (!noAssert) checkOffset(offset, 2, this.length)
  12564. var val = this[offset] | (this[offset + 1] << 8)
  12565. return (val & 0x8000) ? val | 0xFFFF0000 : val
  12566. }
  12567. Buffer.prototype.readInt16BE = function readInt16BE (offset, noAssert) {
  12568. if (!noAssert) checkOffset(offset, 2, this.length)
  12569. var val = this[offset + 1] | (this[offset] << 8)
  12570. return (val & 0x8000) ? val | 0xFFFF0000 : val
  12571. }
  12572. Buffer.prototype.readInt32LE = function readInt32LE (offset, noAssert) {
  12573. if (!noAssert) checkOffset(offset, 4, this.length)
  12574. return (this[offset]) |
  12575. (this[offset + 1] << 8) |
  12576. (this[offset + 2] << 16) |
  12577. (this[offset + 3] << 24)
  12578. }
  12579. Buffer.prototype.readInt32BE = function readInt32BE (offset, noAssert) {
  12580. if (!noAssert) checkOffset(offset, 4, this.length)
  12581. return (this[offset] << 24) |
  12582. (this[offset + 1] << 16) |
  12583. (this[offset + 2] << 8) |
  12584. (this[offset + 3])
  12585. }
  12586. Buffer.prototype.readFloatLE = function readFloatLE (offset, noAssert) {
  12587. if (!noAssert) checkOffset(offset, 4, this.length)
  12588. return ieee754.read(this, offset, true, 23, 4)
  12589. }
  12590. Buffer.prototype.readFloatBE = function readFloatBE (offset, noAssert) {
  12591. if (!noAssert) checkOffset(offset, 4, this.length)
  12592. return ieee754.read(this, offset, false, 23, 4)
  12593. }
  12594. Buffer.prototype.readDoubleLE = function readDoubleLE (offset, noAssert) {
  12595. if (!noAssert) checkOffset(offset, 8, this.length)
  12596. return ieee754.read(this, offset, true, 52, 8)
  12597. }
  12598. Buffer.prototype.readDoubleBE = function readDoubleBE (offset, noAssert) {
  12599. if (!noAssert) checkOffset(offset, 8, this.length)
  12600. return ieee754.read(this, offset, false, 52, 8)
  12601. }
  12602. function checkInt (buf, value, offset, ext, max, min) {
  12603. if (!Buffer.isBuffer(buf)) throw new TypeError('"buffer" argument must be a Buffer instance')
  12604. if (value > max || value < min) throw new RangeError('"value" argument is out of bounds')
  12605. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  12606. }
  12607. Buffer.prototype.writeUIntLE = function writeUIntLE (value, offset, byteLength, noAssert) {
  12608. value = +value
  12609. offset = offset | 0
  12610. byteLength = byteLength | 0
  12611. if (!noAssert) {
  12612. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  12613. checkInt(this, value, offset, byteLength, maxBytes, 0)
  12614. }
  12615. var mul = 1
  12616. var i = 0
  12617. this[offset] = value & 0xFF
  12618. while (++i < byteLength && (mul *= 0x100)) {
  12619. this[offset + i] = (value / mul) & 0xFF
  12620. }
  12621. return offset + byteLength
  12622. }
  12623. Buffer.prototype.writeUIntBE = function writeUIntBE (value, offset, byteLength, noAssert) {
  12624. value = +value
  12625. offset = offset | 0
  12626. byteLength = byteLength | 0
  12627. if (!noAssert) {
  12628. var maxBytes = Math.pow(2, 8 * byteLength) - 1
  12629. checkInt(this, value, offset, byteLength, maxBytes, 0)
  12630. }
  12631. var i = byteLength - 1
  12632. var mul = 1
  12633. this[offset + i] = value & 0xFF
  12634. while (--i >= 0 && (mul *= 0x100)) {
  12635. this[offset + i] = (value / mul) & 0xFF
  12636. }
  12637. return offset + byteLength
  12638. }
  12639. Buffer.prototype.writeUInt8 = function writeUInt8 (value, offset, noAssert) {
  12640. value = +value
  12641. offset = offset | 0
  12642. if (!noAssert) checkInt(this, value, offset, 1, 0xff, 0)
  12643. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  12644. this[offset] = (value & 0xff)
  12645. return offset + 1
  12646. }
  12647. function objectWriteUInt16 (buf, value, offset, littleEndian) {
  12648. if (value < 0) value = 0xffff + value + 1
  12649. for (var i = 0, j = Math.min(buf.length - offset, 2); i < j; ++i) {
  12650. buf[offset + i] = (value & (0xff << (8 * (littleEndian ? i : 1 - i)))) >>>
  12651. (littleEndian ? i : 1 - i) * 8
  12652. }
  12653. }
  12654. Buffer.prototype.writeUInt16LE = function writeUInt16LE (value, offset, noAssert) {
  12655. value = +value
  12656. offset = offset | 0
  12657. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  12658. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12659. this[offset] = (value & 0xff)
  12660. this[offset + 1] = (value >>> 8)
  12661. } else {
  12662. objectWriteUInt16(this, value, offset, true)
  12663. }
  12664. return offset + 2
  12665. }
  12666. Buffer.prototype.writeUInt16BE = function writeUInt16BE (value, offset, noAssert) {
  12667. value = +value
  12668. offset = offset | 0
  12669. if (!noAssert) checkInt(this, value, offset, 2, 0xffff, 0)
  12670. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12671. this[offset] = (value >>> 8)
  12672. this[offset + 1] = (value & 0xff)
  12673. } else {
  12674. objectWriteUInt16(this, value, offset, false)
  12675. }
  12676. return offset + 2
  12677. }
  12678. function objectWriteUInt32 (buf, value, offset, littleEndian) {
  12679. if (value < 0) value = 0xffffffff + value + 1
  12680. for (var i = 0, j = Math.min(buf.length - offset, 4); i < j; ++i) {
  12681. buf[offset + i] = (value >>> (littleEndian ? i : 3 - i) * 8) & 0xff
  12682. }
  12683. }
  12684. Buffer.prototype.writeUInt32LE = function writeUInt32LE (value, offset, noAssert) {
  12685. value = +value
  12686. offset = offset | 0
  12687. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  12688. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12689. this[offset + 3] = (value >>> 24)
  12690. this[offset + 2] = (value >>> 16)
  12691. this[offset + 1] = (value >>> 8)
  12692. this[offset] = (value & 0xff)
  12693. } else {
  12694. objectWriteUInt32(this, value, offset, true)
  12695. }
  12696. return offset + 4
  12697. }
  12698. Buffer.prototype.writeUInt32BE = function writeUInt32BE (value, offset, noAssert) {
  12699. value = +value
  12700. offset = offset | 0
  12701. if (!noAssert) checkInt(this, value, offset, 4, 0xffffffff, 0)
  12702. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12703. this[offset] = (value >>> 24)
  12704. this[offset + 1] = (value >>> 16)
  12705. this[offset + 2] = (value >>> 8)
  12706. this[offset + 3] = (value & 0xff)
  12707. } else {
  12708. objectWriteUInt32(this, value, offset, false)
  12709. }
  12710. return offset + 4
  12711. }
  12712. Buffer.prototype.writeIntLE = function writeIntLE (value, offset, byteLength, noAssert) {
  12713. value = +value
  12714. offset = offset | 0
  12715. if (!noAssert) {
  12716. var limit = Math.pow(2, 8 * byteLength - 1)
  12717. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  12718. }
  12719. var i = 0
  12720. var mul = 1
  12721. var sub = 0
  12722. this[offset] = value & 0xFF
  12723. while (++i < byteLength && (mul *= 0x100)) {
  12724. if (value < 0 && sub === 0 && this[offset + i - 1] !== 0) {
  12725. sub = 1
  12726. }
  12727. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  12728. }
  12729. return offset + byteLength
  12730. }
  12731. Buffer.prototype.writeIntBE = function writeIntBE (value, offset, byteLength, noAssert) {
  12732. value = +value
  12733. offset = offset | 0
  12734. if (!noAssert) {
  12735. var limit = Math.pow(2, 8 * byteLength - 1)
  12736. checkInt(this, value, offset, byteLength, limit - 1, -limit)
  12737. }
  12738. var i = byteLength - 1
  12739. var mul = 1
  12740. var sub = 0
  12741. this[offset + i] = value & 0xFF
  12742. while (--i >= 0 && (mul *= 0x100)) {
  12743. if (value < 0 && sub === 0 && this[offset + i + 1] !== 0) {
  12744. sub = 1
  12745. }
  12746. this[offset + i] = ((value / mul) >> 0) - sub & 0xFF
  12747. }
  12748. return offset + byteLength
  12749. }
  12750. Buffer.prototype.writeInt8 = function writeInt8 (value, offset, noAssert) {
  12751. value = +value
  12752. offset = offset | 0
  12753. if (!noAssert) checkInt(this, value, offset, 1, 0x7f, -0x80)
  12754. if (!Buffer.TYPED_ARRAY_SUPPORT) value = Math.floor(value)
  12755. if (value < 0) value = 0xff + value + 1
  12756. this[offset] = (value & 0xff)
  12757. return offset + 1
  12758. }
  12759. Buffer.prototype.writeInt16LE = function writeInt16LE (value, offset, noAssert) {
  12760. value = +value
  12761. offset = offset | 0
  12762. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  12763. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12764. this[offset] = (value & 0xff)
  12765. this[offset + 1] = (value >>> 8)
  12766. } else {
  12767. objectWriteUInt16(this, value, offset, true)
  12768. }
  12769. return offset + 2
  12770. }
  12771. Buffer.prototype.writeInt16BE = function writeInt16BE (value, offset, noAssert) {
  12772. value = +value
  12773. offset = offset | 0
  12774. if (!noAssert) checkInt(this, value, offset, 2, 0x7fff, -0x8000)
  12775. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12776. this[offset] = (value >>> 8)
  12777. this[offset + 1] = (value & 0xff)
  12778. } else {
  12779. objectWriteUInt16(this, value, offset, false)
  12780. }
  12781. return offset + 2
  12782. }
  12783. Buffer.prototype.writeInt32LE = function writeInt32LE (value, offset, noAssert) {
  12784. value = +value
  12785. offset = offset | 0
  12786. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  12787. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12788. this[offset] = (value & 0xff)
  12789. this[offset + 1] = (value >>> 8)
  12790. this[offset + 2] = (value >>> 16)
  12791. this[offset + 3] = (value >>> 24)
  12792. } else {
  12793. objectWriteUInt32(this, value, offset, true)
  12794. }
  12795. return offset + 4
  12796. }
  12797. Buffer.prototype.writeInt32BE = function writeInt32BE (value, offset, noAssert) {
  12798. value = +value
  12799. offset = offset | 0
  12800. if (!noAssert) checkInt(this, value, offset, 4, 0x7fffffff, -0x80000000)
  12801. if (value < 0) value = 0xffffffff + value + 1
  12802. if (Buffer.TYPED_ARRAY_SUPPORT) {
  12803. this[offset] = (value >>> 24)
  12804. this[offset + 1] = (value >>> 16)
  12805. this[offset + 2] = (value >>> 8)
  12806. this[offset + 3] = (value & 0xff)
  12807. } else {
  12808. objectWriteUInt32(this, value, offset, false)
  12809. }
  12810. return offset + 4
  12811. }
  12812. function checkIEEE754 (buf, value, offset, ext, max, min) {
  12813. if (offset + ext > buf.length) throw new RangeError('Index out of range')
  12814. if (offset < 0) throw new RangeError('Index out of range')
  12815. }
  12816. function writeFloat (buf, value, offset, littleEndian, noAssert) {
  12817. if (!noAssert) {
  12818. checkIEEE754(buf, value, offset, 4, 3.4028234663852886e+38, -3.4028234663852886e+38)
  12819. }
  12820. ieee754.write(buf, value, offset, littleEndian, 23, 4)
  12821. return offset + 4
  12822. }
  12823. Buffer.prototype.writeFloatLE = function writeFloatLE (value, offset, noAssert) {
  12824. return writeFloat(this, value, offset, true, noAssert)
  12825. }
  12826. Buffer.prototype.writeFloatBE = function writeFloatBE (value, offset, noAssert) {
  12827. return writeFloat(this, value, offset, false, noAssert)
  12828. }
  12829. function writeDouble (buf, value, offset, littleEndian, noAssert) {
  12830. if (!noAssert) {
  12831. checkIEEE754(buf, value, offset, 8, 1.7976931348623157E+308, -1.7976931348623157E+308)
  12832. }
  12833. ieee754.write(buf, value, offset, littleEndian, 52, 8)
  12834. return offset + 8
  12835. }
  12836. Buffer.prototype.writeDoubleLE = function writeDoubleLE (value, offset, noAssert) {
  12837. return writeDouble(this, value, offset, true, noAssert)
  12838. }
  12839. Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert) {
  12840. return writeDouble(this, value, offset, false, noAssert)
  12841. }
  12842. // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
  12843. Buffer.prototype.copy = function copy (target, targetStart, start, end) {
  12844. if (!start) start = 0
  12845. if (!end && end !== 0) end = this.length
  12846. if (targetStart >= target.length) targetStart = target.length
  12847. if (!targetStart) targetStart = 0
  12848. if (end > 0 && end < start) end = start
  12849. // Copy 0 bytes; we're done
  12850. if (end === start) return 0
  12851. if (target.length === 0 || this.length === 0) return 0
  12852. // Fatal error conditions
  12853. if (targetStart < 0) {
  12854. throw new RangeError('targetStart out of bounds')
  12855. }
  12856. if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds')
  12857. if (end < 0) throw new RangeError('sourceEnd out of bounds')
  12858. // Are we oob?
  12859. if (end > this.length) end = this.length
  12860. if (target.length - targetStart < end - start) {
  12861. end = target.length - targetStart + start
  12862. }
  12863. var len = end - start
  12864. var i
  12865. if (this === target && start < targetStart && targetStart < end) {
  12866. // descending copy from end
  12867. for (i = len - 1; i >= 0; --i) {
  12868. target[i + targetStart] = this[i + start]
  12869. }
  12870. } else if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) {
  12871. // ascending copy from start
  12872. for (i = 0; i < len; ++i) {
  12873. target[i + targetStart] = this[i + start]
  12874. }
  12875. } else {
  12876. Uint8Array.prototype.set.call(
  12877. target,
  12878. this.subarray(start, start + len),
  12879. targetStart
  12880. )
  12881. }
  12882. return len
  12883. }
  12884. // Usage:
  12885. // buffer.fill(number[, offset[, end]])
  12886. // buffer.fill(buffer[, offset[, end]])
  12887. // buffer.fill(string[, offset[, end]][, encoding])
  12888. Buffer.prototype.fill = function fill (val, start, end, encoding) {
  12889. // Handle string cases:
  12890. if (typeof val === 'string') {
  12891. if (typeof start === 'string') {
  12892. encoding = start
  12893. start = 0
  12894. end = this.length
  12895. } else if (typeof end === 'string') {
  12896. encoding = end
  12897. end = this.length
  12898. }
  12899. if (val.length === 1) {
  12900. var code = val.charCodeAt(0)
  12901. if (code < 256) {
  12902. val = code
  12903. }
  12904. }
  12905. if (encoding !== undefined && typeof encoding !== 'string') {
  12906. throw new TypeError('encoding must be a string')
  12907. }
  12908. if (typeof encoding === 'string' && !Buffer.isEncoding(encoding)) {
  12909. throw new TypeError('Unknown encoding: ' + encoding)
  12910. }
  12911. } else if (typeof val === 'number') {
  12912. val = val & 255
  12913. }
  12914. // Invalid ranges are not set to a default, so can range check early.
  12915. if (start < 0 || this.length < start || this.length < end) {
  12916. throw new RangeError('Out of range index')
  12917. }
  12918. if (end <= start) {
  12919. return this
  12920. }
  12921. start = start >>> 0
  12922. end = end === undefined ? this.length : end >>> 0
  12923. if (!val) val = 0
  12924. var i
  12925. if (typeof val === 'number') {
  12926. for (i = start; i < end; ++i) {
  12927. this[i] = val
  12928. }
  12929. } else {
  12930. var bytes = Buffer.isBuffer(val)
  12931. ? val
  12932. : utf8ToBytes(new Buffer(val, encoding).toString())
  12933. var len = bytes.length
  12934. for (i = 0; i < end - start; ++i) {
  12935. this[i + start] = bytes[i % len]
  12936. }
  12937. }
  12938. return this
  12939. }
  12940. // HELPER FUNCTIONS
  12941. // ================
  12942. var INVALID_BASE64_RE = /[^+\/0-9A-Za-z-_]/g
  12943. function base64clean (str) {
  12944. // Node strips out invalid characters like \n and \t from the string, base64-js does not
  12945. str = stringtrim(str).replace(INVALID_BASE64_RE, '')
  12946. // Node converts strings with length < 2 to ''
  12947. if (str.length < 2) return ''
  12948. // Node allows for non-padded base64 strings (missing trailing ===), base64-js does not
  12949. while (str.length % 4 !== 0) {
  12950. str = str + '='
  12951. }
  12952. return str
  12953. }
  12954. function stringtrim (str) {
  12955. if (str.trim) return str.trim()
  12956. return str.replace(/^\s+|\s+$/g, '')
  12957. }
  12958. function toHex (n) {
  12959. if (n < 16) return '0' + n.toString(16)
  12960. return n.toString(16)
  12961. }
  12962. function utf8ToBytes (string, units) {
  12963. units = units || Infinity
  12964. var codePoint
  12965. var length = string.length
  12966. var leadSurrogate = null
  12967. var bytes = []
  12968. for (var i = 0; i < length; ++i) {
  12969. codePoint = string.charCodeAt(i)
  12970. // is surrogate component
  12971. if (codePoint > 0xD7FF && codePoint < 0xE000) {
  12972. // last char was a lead
  12973. if (!leadSurrogate) {
  12974. // no lead yet
  12975. if (codePoint > 0xDBFF) {
  12976. // unexpected trail
  12977. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  12978. continue
  12979. } else if (i + 1 === length) {
  12980. // unpaired lead
  12981. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  12982. continue
  12983. }
  12984. // valid lead
  12985. leadSurrogate = codePoint
  12986. continue
  12987. }
  12988. // 2 leads in a row
  12989. if (codePoint < 0xDC00) {
  12990. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  12991. leadSurrogate = codePoint
  12992. continue
  12993. }
  12994. // valid surrogate pair
  12995. codePoint = (leadSurrogate - 0xD800 << 10 | codePoint - 0xDC00) + 0x10000
  12996. } else if (leadSurrogate) {
  12997. // valid bmp char, but last char was a lead
  12998. if ((units -= 3) > -1) bytes.push(0xEF, 0xBF, 0xBD)
  12999. }
  13000. leadSurrogate = null
  13001. // encode utf8
  13002. if (codePoint < 0x80) {
  13003. if ((units -= 1) < 0) break
  13004. bytes.push(codePoint)
  13005. } else if (codePoint < 0x800) {
  13006. if ((units -= 2) < 0) break
  13007. bytes.push(
  13008. codePoint >> 0x6 | 0xC0,
  13009. codePoint & 0x3F | 0x80
  13010. )
  13011. } else if (codePoint < 0x10000) {
  13012. if ((units -= 3) < 0) break
  13013. bytes.push(
  13014. codePoint >> 0xC | 0xE0,
  13015. codePoint >> 0x6 & 0x3F | 0x80,
  13016. codePoint & 0x3F | 0x80
  13017. )
  13018. } else if (codePoint < 0x110000) {
  13019. if ((units -= 4) < 0) break
  13020. bytes.push(
  13021. codePoint >> 0x12 | 0xF0,
  13022. codePoint >> 0xC & 0x3F | 0x80,
  13023. codePoint >> 0x6 & 0x3F | 0x80,
  13024. codePoint & 0x3F | 0x80
  13025. )
  13026. } else {
  13027. throw new Error('Invalid code point')
  13028. }
  13029. }
  13030. return bytes
  13031. }
  13032. function asciiToBytes (str) {
  13033. var byteArray = []
  13034. for (var i = 0; i < str.length; ++i) {
  13035. // Node's code seems to be doing this and not & 0x7F..
  13036. byteArray.push(str.charCodeAt(i) & 0xFF)
  13037. }
  13038. return byteArray
  13039. }
  13040. function utf16leToBytes (str, units) {
  13041. var c, hi, lo
  13042. var byteArray = []
  13043. for (var i = 0; i < str.length; ++i) {
  13044. if ((units -= 2) < 0) break
  13045. c = str.charCodeAt(i)
  13046. hi = c >> 8
  13047. lo = c % 256
  13048. byteArray.push(lo)
  13049. byteArray.push(hi)
  13050. }
  13051. return byteArray
  13052. }
  13053. function base64ToBytes (str) {
  13054. return base64.toByteArray(base64clean(str))
  13055. }
  13056. function blitBuffer (src, dst, offset, length) {
  13057. for (var i = 0; i < length; ++i) {
  13058. if ((i + offset >= dst.length) || (i >= src.length)) break
  13059. dst[i + offset] = src[i]
  13060. }
  13061. return i
  13062. }
  13063. function isnan (val) {
  13064. return val !== val // eslint-disable-line no-self-compare
  13065. }
  13066. /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("9edd")))
  13067. /***/ })
  13068. /******/ });