12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496 |
- (function webpackUniversalModuleDefinition(root, factory) {
- if(typeof exports === 'object' && typeof module === 'object')
- module.exports = factory(require("jszip"));
- else if(typeof define === 'function' && define.amd)
- define(["jszip"], factory);
- else if(typeof exports === 'object')
- exports["docx"] = factory(require("jszip"));
- else
- root["docx"] = factory(root["JSZip"]);
- })(globalThis, (__WEBPACK_EXTERNAL_MODULE_jszip__) => {
- return /******/ (() => { // webpackBootstrap
- /******/ "use strict";
- /******/ var __webpack_modules__ = ({
- /***/ "./src/mathml.scss":
- /*!*************************!*\
- !*** ./src/mathml.scss ***!
- \*************************/
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
- __webpack_require__.r(__webpack_exports__);
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
- /* harmony export */ });
- /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/sourceMaps.js */ "./node_modules/css-loader/dist/runtime/sourceMaps.js");
- /* harmony import */ var _node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0__);
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/api.js */ "./node_modules/css-loader/dist/runtime/api.js");
- /* harmony import */ var _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1__);
- /* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../node_modules/css-loader/dist/runtime/getUrl.js */ "./node_modules/css-loader/dist/runtime/getUrl.js");
- /* harmony import */ var _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2__);
- // Imports
- var ___CSS_LOADER_URL_IMPORT_0___ = new URL(/* asset import */ __webpack_require__(/*! data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 100%27 preserveAspectRatio=%27none%27%3E%3Cpath d=%27m0,75 l5,0 l5,25 l10,-100%27 stroke=%27black%27 fill=%27none%27 vector-effect=%27non-scaling-stroke%27/%3E%3C/svg%3E */ "data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 100%27 preserveAspectRatio=%27none%27%3E%3Cpath d=%27m0,75 l5,0 l5,25 l10,-100%27 stroke=%27black%27 fill=%27none%27 vector-effect=%27non-scaling-stroke%27/%3E%3C/svg%3E"), __webpack_require__.b);
- var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
- var ___CSS_LOADER_URL_REPLACEMENT_0___ = _node_modules_css_loader_dist_runtime_getUrl_js__WEBPACK_IMPORTED_MODULE_2___default()(___CSS_LOADER_URL_IMPORT_0___);
- // Module
- ___CSS_LOADER_EXPORT___.push([module.id, "@namespace \"http://www.w3.org/1998/Math/MathML\";\nmath {\n display: inline-block;\n line-height: initial;\n}\n\nmfrac {\n display: inline-block;\n vertical-align: -50%;\n text-align: center;\n}\nmfrac > :first-child {\n border-bottom: solid thin currentColor;\n}\nmfrac > * {\n display: block;\n}\n\nmsub > :nth-child(2) {\n font-size: smaller;\n vertical-align: sub;\n}\n\nmsup > :nth-child(2) {\n font-size: smaller;\n vertical-align: super;\n}\n\nmunder, mover, munderover {\n display: inline-flex;\n flex-flow: column nowrap;\n vertical-align: middle;\n text-align: center;\n}\nmunder > :not(:first-child), mover > :not(:first-child), munderover > :not(:first-child) {\n font-size: smaller;\n}\n\nmunderover > :last-child {\n order: -1;\n}\n\nmroot, msqrt {\n position: relative;\n display: inline-block;\n border-top: solid thin currentColor;\n margin-top: 0.5px;\n vertical-align: middle;\n margin-left: 1ch;\n}\nmroot:before, msqrt:before {\n content: \"\";\n display: inline-block;\n position: absolute;\n width: 1ch;\n left: -1ch;\n top: -1px;\n bottom: 0;\n background-image: url(" + ___CSS_LOADER_URL_REPLACEMENT_0___ + ");\n}", "",{"version":3,"sources":["webpack://./src/mathml.scss"],"names":[],"mappings":"AAAA,+CAAA;AAEA;EACI,qBAAA;EACA,oBAAA;AAAJ;;AAGA;EACI,qBAAA;EACA,oBAAA;EACA,kBAAA;AAAJ;AAEI;EACI,sCAAA;AAAR;AAGI;EACI,cAAA;AADR;;AAMI;EACI,kBAAA;EACA,mBAAA;AAHR;;AAQI;EACI,kBAAA;EACA,qBAAA;AALR;;AASA;EACI,oBAAA;EACA,wBAAA;EACA,sBAAA;EACA,kBAAA;AANJ;AAQI;EACI,kBAAA;AANR;;AAWI;EAAgB,SAAA;AAPpB;;AAUA;EACI,kBAAA;EACA,qBAAA;EACA,mCAAA;EACA,iBAAA;EACA,sBAAA;EACA,gBAAA;AAPJ;AASI;EACI,WAAA;EACA,qBAAA;EACA,kBAAA;EACA,UAAA;EACA,UAAA;EACA,SAAA;EACA,SAAA;EACA,yDAAA;AAPR","sourcesContent":["@namespace \"http://www.w3.org/1998/Math/MathML\";\r\n\r\nmath {\r\n display: inline-block;\r\n line-height: initial;\r\n}\r\n\r\nmfrac {\r\n display: inline-block;\r\n vertical-align: -50%;\r\n text-align: center;\r\n\r\n &>:first-child {\r\n border-bottom: solid thin currentColor;\r\n }\r\n\r\n &>* {\r\n display: block;\r\n }\r\n}\r\n\r\nmsub {\r\n &>:nth-child(2) {\r\n font-size: smaller;\r\n vertical-align: sub;\r\n }\r\n}\r\n\r\nmsup {\r\n &>:nth-child(2) {\r\n font-size: smaller;\r\n vertical-align: super;\r\n }\r\n}\r\n\r\nmunder, mover, munderover {\r\n display: inline-flex;\r\n flex-flow: column nowrap;\r\n vertical-align: middle;\r\n text-align: center;\r\n\r\n &>:not(:first-child) {\r\n font-size: smaller;\r\n }\r\n}\r\n\r\nmunderover {\r\n &>:last-child { order: -1; }\r\n}\r\n\r\nmroot, msqrt {\r\n position: relative;\r\n display: inline-block;\r\n border-top: solid thin currentColor; \r\n margin-top: 0.5px;\r\n vertical-align: middle; \r\n margin-left: 1ch; \r\n\r\n &:before {\r\n content: \"\";\r\n display: inline-block;\r\n position: absolute;\r\n width: 1ch;\r\n left: -1ch;\r\n top: -1px;\r\n bottom: 0;\r\n background-image: url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 100' preserveAspectRatio='none'%3E%3Cpath d='m0,75 l5,0 l5,25 l10,-100' stroke='black' fill='none' vector-effect='non-scaling-stroke'/%3E%3C/svg%3E\");\r\n }\r\n}"],"sourceRoot":""}]);
- // Exports
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___.toString());
- /***/ }),
- /***/ "./node_modules/css-loader/dist/runtime/api.js":
- /*!*****************************************************!*\
- !*** ./node_modules/css-loader/dist/runtime/api.js ***!
- \*****************************************************/
- /***/ ((module) => {
- /*
- MIT License http://www.opensource.org/licenses/mit-license.php
- Author Tobias Koppers @sokra
- */
- module.exports = function (cssWithMappingToString) {
- var list = [];
- // return the list of modules as css string
- list.toString = function toString() {
- return this.map(function (item) {
- var content = "";
- var needLayer = typeof item[5] !== "undefined";
- if (item[4]) {
- content += "@supports (".concat(item[4], ") {");
- }
- if (item[2]) {
- content += "@media ".concat(item[2], " {");
- }
- if (needLayer) {
- content += "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {");
- }
- content += cssWithMappingToString(item);
- if (needLayer) {
- content += "}";
- }
- if (item[2]) {
- content += "}";
- }
- if (item[4]) {
- content += "}";
- }
- return content;
- }).join("");
- };
- // import a list of modules into the list
- list.i = function i(modules, media, dedupe, supports, layer) {
- if (typeof modules === "string") {
- modules = [[null, modules, undefined]];
- }
- var alreadyImportedModules = {};
- if (dedupe) {
- for (var k = 0; k < this.length; k++) {
- var id = this[k][0];
- if (id != null) {
- alreadyImportedModules[id] = true;
- }
- }
- }
- for (var _k = 0; _k < modules.length; _k++) {
- var item = [].concat(modules[_k]);
- if (dedupe && alreadyImportedModules[item[0]]) {
- continue;
- }
- if (typeof layer !== "undefined") {
- if (typeof item[5] === "undefined") {
- item[5] = layer;
- } else {
- item[1] = "@layer".concat(item[5].length > 0 ? " ".concat(item[5]) : "", " {").concat(item[1], "}");
- item[5] = layer;
- }
- }
- if (media) {
- if (!item[2]) {
- item[2] = media;
- } else {
- item[1] = "@media ".concat(item[2], " {").concat(item[1], "}");
- item[2] = media;
- }
- }
- if (supports) {
- if (!item[4]) {
- item[4] = "".concat(supports);
- } else {
- item[1] = "@supports (".concat(item[4], ") {").concat(item[1], "}");
- item[4] = supports;
- }
- }
- list.push(item);
- }
- };
- return list;
- };
- /***/ }),
- /***/ "./node_modules/css-loader/dist/runtime/getUrl.js":
- /*!********************************************************!*\
- !*** ./node_modules/css-loader/dist/runtime/getUrl.js ***!
- \********************************************************/
- /***/ ((module) => {
- module.exports = function (url, options) {
- if (!options) {
- options = {};
- }
- if (!url) {
- return url;
- }
- url = String(url.__esModule ? url.default : url);
- // If url is already wrapped in quotes, remove them
- if (/^['"].*['"]$/.test(url)) {
- url = url.slice(1, -1);
- }
- if (options.hash) {
- url += options.hash;
- }
- // Should url be wrapped?
- // See https://drafts.csswg.org/css-values-3/#urls
- if (/["'() \t\n]|(%20)/.test(url) || options.needQuotes) {
- return "\"".concat(url.replace(/"/g, '\\"').replace(/\n/g, "\\n"), "\"");
- }
- return url;
- };
- /***/ }),
- /***/ "./node_modules/css-loader/dist/runtime/sourceMaps.js":
- /*!************************************************************!*\
- !*** ./node_modules/css-loader/dist/runtime/sourceMaps.js ***!
- \************************************************************/
- /***/ ((module) => {
- module.exports = function (item) {
- var content = item[1];
- var cssMapping = item[3];
- if (!cssMapping) {
- return content;
- }
- if (typeof btoa === "function") {
- var base64 = btoa(unescape(encodeURIComponent(JSON.stringify(cssMapping))));
- var data = "sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(base64);
- var sourceMapping = "/*# ".concat(data, " */");
- return [content].concat([sourceMapping]).join("\n");
- }
- return [content].join("\n");
- };
- /***/ }),
- /***/ "./src/common/open-xml-package.ts":
- /*!****************************************!*\
- !*** ./src/common/open-xml-package.ts ***!
- \****************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.OpenXmlPackage = void 0;
- const JSZip = __webpack_require__(/*! jszip */ "jszip");
- const xml_parser_1 = __webpack_require__(/*! ../parser/xml-parser */ "./src/parser/xml-parser.ts");
- const utils_1 = __webpack_require__(/*! ../utils */ "./src/utils.ts");
- const relationship_1 = __webpack_require__(/*! ./relationship */ "./src/common/relationship.ts");
- class OpenXmlPackage {
- constructor(_zip, options) {
- this._zip = _zip;
- this.options = options;
- this.xmlParser = new xml_parser_1.XmlParser();
- }
- get(path) {
- return this._zip.files[normalizePath(path)];
- }
- update(path, content) {
- this._zip.file(path, content);
- }
- static load(input, options) {
- return JSZip.loadAsync(input).then(zip => new OpenXmlPackage(zip, options));
- }
- save(type = "blob") {
- return this._zip.generateAsync({ type });
- }
- load(path, type = "string") {
- var _a, _b;
- return (_b = (_a = this.get(path)) === null || _a === void 0 ? void 0 : _a.async(type)) !== null && _b !== void 0 ? _b : Promise.resolve(null);
- }
- loadRelationships(path = null) {
- let relsPath = `_rels/.rels`;
- if (path != null) {
- const [f, fn] = (0, utils_1.splitPath)(path);
- relsPath = `${f}_rels/${fn}.rels`;
- }
- return this.load(relsPath)
- .then(txt => txt ? (0, relationship_1.parseRelationships)(this.parseXmlDocument(txt).firstElementChild, this.xmlParser) : null);
- }
- parseXmlDocument(txt) {
- return (0, xml_parser_1.parseXmlString)(txt, this.options.trimXmlDeclaration);
- }
- }
- exports.OpenXmlPackage = OpenXmlPackage;
- function normalizePath(path) {
- return path.startsWith('/') ? path.substr(1) : path;
- }
- /***/ }),
- /***/ "./src/common/part.ts":
- /*!****************************!*\
- !*** ./src/common/part.ts ***!
- \****************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.Part = void 0;
- const xml_parser_1 = __webpack_require__(/*! ../parser/xml-parser */ "./src/parser/xml-parser.ts");
- class Part {
- constructor(_package, path) {
- this._package = _package;
- this.path = path;
- }
- load() {
- return Promise.all([
- this._package.loadRelationships(this.path).then(rels => {
- this.rels = rels;
- }),
- this._package.load(this.path).then(text => {
- const xmlDoc = this._package.parseXmlDocument(text);
- if (this._package.options.keepOrigin) {
- this._xmlDocument = xmlDoc;
- }
- this.parseXml(xmlDoc.firstElementChild);
- })
- ]);
- }
- save() {
- this._package.update(this.path, (0, xml_parser_1.serializeXmlString)(this._xmlDocument));
- }
- parseXml(root) {
- }
- }
- exports.Part = Part;
- /***/ }),
- /***/ "./src/common/relationship.ts":
- /*!************************************!*\
- !*** ./src/common/relationship.ts ***!
- \************************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseRelationships = exports.RelationshipTypes = void 0;
- var RelationshipTypes;
- (function (RelationshipTypes) {
- RelationshipTypes["OfficeDocument"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument";
- RelationshipTypes["FontTable"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable";
- RelationshipTypes["Image"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image";
- RelationshipTypes["Numbering"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/numbering";
- RelationshipTypes["Styles"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles";
- RelationshipTypes["StylesWithEffects"] = "http://schemas.microsoft.com/office/2007/relationships/stylesWithEffects";
- RelationshipTypes["Theme"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme";
- RelationshipTypes["Settings"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings";
- RelationshipTypes["WebSettings"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/webSettings";
- RelationshipTypes["Hyperlink"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink";
- RelationshipTypes["Footnotes"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footnotes";
- RelationshipTypes["Endnotes"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/endnotes";
- RelationshipTypes["Footer"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/footer";
- RelationshipTypes["Header"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/header";
- RelationshipTypes["ExtendedProperties"] = "http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties";
- RelationshipTypes["CoreProperties"] = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties";
- RelationshipTypes["CustomProperties"] = "http://schemas.openxmlformats.org/package/2006/relationships/metadata/custom-properties";
- })(RelationshipTypes = exports.RelationshipTypes || (exports.RelationshipTypes = {}));
- function parseRelationships(root, xml) {
- return xml.elements(root).map(e => ({
- id: xml.attr(e, "Id"),
- type: xml.attr(e, "Type"),
- target: xml.attr(e, "Target"),
- targetMode: xml.attr(e, "TargetMode")
- }));
- }
- exports.parseRelationships = parseRelationships;
- /***/ }),
- /***/ "./src/document-parser.ts":
- /*!********************************!*\
- !*** ./src/document-parser.ts ***!
- \********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.DocumentParser = exports.autos = void 0;
- const dom_1 = __webpack_require__(/*! ./document/dom */ "./src/document/dom.ts");
- const paragraph_1 = __webpack_require__(/*! ./document/paragraph */ "./src/document/paragraph.ts");
- const section_1 = __webpack_require__(/*! ./document/section */ "./src/document/section.ts");
- const xml_parser_1 = __webpack_require__(/*! ./parser/xml-parser */ "./src/parser/xml-parser.ts");
- const run_1 = __webpack_require__(/*! ./document/run */ "./src/document/run.ts");
- const bookmarks_1 = __webpack_require__(/*! ./document/bookmarks */ "./src/document/bookmarks.ts");
- const common_1 = __webpack_require__(/*! ./document/common */ "./src/document/common.ts");
- const vml_1 = __webpack_require__(/*! ./vml/vml */ "./src/vml/vml.ts");
- exports.autos = {
- shd: "inherit",
- color: "black",
- borderColor: "black",
- highlight: "transparent"
- };
- const supportedNamespaceURIs = [];
- const mmlTagMap = {
- "oMath": dom_1.DomType.MmlMath,
- "oMathPara": dom_1.DomType.MmlMathParagraph,
- "f": dom_1.DomType.MmlFraction,
- "num": dom_1.DomType.MmlNumerator,
- "den": dom_1.DomType.MmlDenominator,
- "rad": dom_1.DomType.MmlRadical,
- "deg": dom_1.DomType.MmlDegree,
- "e": dom_1.DomType.MmlBase,
- "sSup": dom_1.DomType.MmlSuperscript,
- "sSub": dom_1.DomType.MmlSubscript,
- "sup": dom_1.DomType.MmlSuperArgument,
- "sub": dom_1.DomType.MmlSubArgument,
- "d": dom_1.DomType.MmlDelimiter,
- "nary": dom_1.DomType.MmlNary,
- };
- class DocumentParser {
- constructor(options) {
- this.options = Object.assign({ ignoreWidth: false, debug: false }, options);
- }
- parseNotes(xmlDoc, elemName, elemClass) {
- var result = [];
- for (let el of xml_parser_1.default.elements(xmlDoc, elemName)) {
- const node = new elemClass();
- node.id = xml_parser_1.default.attr(el, "id");
- node.noteType = xml_parser_1.default.attr(el, "type");
- node.children = this.parseBodyElements(el);
- result.push(node);
- }
- return result;
- }
- parseDocumentFile(xmlDoc) {
- var xbody = xml_parser_1.default.element(xmlDoc, "body");
- var background = xml_parser_1.default.element(xmlDoc, "background");
- var sectPr = xml_parser_1.default.element(xbody, "sectPr");
- return {
- type: dom_1.DomType.Document,
- children: this.parseBodyElements(xbody),
- props: sectPr ? (0, section_1.parseSectionProperties)(sectPr, xml_parser_1.default) : {},
- cssStyle: background ? this.parseBackground(background) : {},
- };
- }
- parseBackground(elem) {
- var result = {};
- var color = xmlUtil.colorAttr(elem, "color");
- if (color) {
- result["background-color"] = color;
- }
- return result;
- }
- parseBodyElements(element) {
- var children = [];
- for (let elem of xml_parser_1.default.elements(element)) {
- switch (elem.localName) {
- case "p":
- children.push(this.parseParagraph(elem));
- break;
- case "tbl":
- children.push(this.parseTable(elem));
- break;
- case "sdt":
- children.push(...this.parseSdt(elem, e => this.parseBodyElements(e)));
- break;
- }
- }
- return children;
- }
- parseStylesFile(xstyles) {
- var result = [];
- xmlUtil.foreach(xstyles, n => {
- switch (n.localName) {
- case "style":
- result.push(this.parseStyle(n));
- break;
- case "docDefaults":
- result.push(this.parseDefaultStyles(n));
- break;
- }
- });
- return result;
- }
- parseDefaultStyles(node) {
- var result = {
- id: null,
- name: null,
- target: null,
- basedOn: null,
- styles: []
- };
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "rPrDefault":
- var rPr = xml_parser_1.default.element(c, "rPr");
- if (rPr)
- result.styles.push({
- target: "span",
- values: this.parseDefaultProperties(rPr, {})
- });
- break;
- case "pPrDefault":
- var pPr = xml_parser_1.default.element(c, "pPr");
- if (pPr)
- result.styles.push({
- target: "p",
- values: this.parseDefaultProperties(pPr, {})
- });
- break;
- }
- });
- return result;
- }
- parseStyle(node) {
- var result = {
- id: xml_parser_1.default.attr(node, "styleId"),
- isDefault: xml_parser_1.default.boolAttr(node, "default"),
- name: null,
- target: null,
- basedOn: null,
- styles: [],
- linked: null
- };
- switch (xml_parser_1.default.attr(node, "type")) {
- case "paragraph":
- result.target = "p";
- break;
- case "table":
- result.target = "table";
- break;
- case "character":
- result.target = "span";
- break;
- }
- xmlUtil.foreach(node, n => {
- switch (n.localName) {
- case "basedOn":
- result.basedOn = xml_parser_1.default.attr(n, "val");
- break;
- case "name":
- result.name = xml_parser_1.default.attr(n, "val");
- break;
- case "link":
- result.linked = xml_parser_1.default.attr(n, "val");
- break;
- case "next":
- result.next = xml_parser_1.default.attr(n, "val");
- break;
- case "aliases":
- result.aliases = xml_parser_1.default.attr(n, "val").split(",");
- break;
- case "pPr":
- result.styles.push({
- target: "p",
- values: this.parseDefaultProperties(n, {})
- });
- result.paragraphProps = (0, paragraph_1.parseParagraphProperties)(n, xml_parser_1.default);
- break;
- case "rPr":
- result.styles.push({
- target: "span",
- values: this.parseDefaultProperties(n, {})
- });
- result.runProps = (0, run_1.parseRunProperties)(n, xml_parser_1.default);
- break;
- case "tblPr":
- case "tcPr":
- result.styles.push({
- target: "td",
- values: this.parseDefaultProperties(n, {})
- });
- break;
- case "tblStylePr":
- for (let s of this.parseTableStyle(n))
- result.styles.push(s);
- break;
- case "rsid":
- case "qFormat":
- case "hidden":
- case "semiHidden":
- case "unhideWhenUsed":
- case "autoRedefine":
- case "uiPriority":
- break;
- default:
- this.options.debug && console.warn(`DOCX: Unknown style element: ${n.localName}`);
- }
- });
- return result;
- }
- parseTableStyle(node) {
- var result = [];
- var type = xml_parser_1.default.attr(node, "type");
- var selector = "";
- var modificator = "";
- switch (type) {
- case "firstRow":
- modificator = ".first-row";
- selector = "tr.first-row td";
- break;
- case "lastRow":
- modificator = ".last-row";
- selector = "tr.last-row td";
- break;
- case "firstCol":
- modificator = ".first-col";
- selector = "td.first-col";
- break;
- case "lastCol":
- modificator = ".last-col";
- selector = "td.last-col";
- break;
- case "band1Vert":
- modificator = ":not(.no-vband)";
- selector = "td.odd-col";
- break;
- case "band2Vert":
- modificator = ":not(.no-vband)";
- selector = "td.even-col";
- break;
- case "band1Horz":
- modificator = ":not(.no-hband)";
- selector = "tr.odd-row";
- break;
- case "band2Horz":
- modificator = ":not(.no-hband)";
- selector = "tr.even-row";
- break;
- default: return [];
- }
- xmlUtil.foreach(node, n => {
- switch (n.localName) {
- case "pPr":
- result.push({
- target: `${selector} p`,
- mod: modificator,
- values: this.parseDefaultProperties(n, {})
- });
- break;
- case "rPr":
- result.push({
- target: `${selector} span`,
- mod: modificator,
- values: this.parseDefaultProperties(n, {})
- });
- break;
- case "tblPr":
- case "tcPr":
- result.push({
- target: selector,
- mod: modificator,
- values: this.parseDefaultProperties(n, {})
- });
- break;
- }
- });
- return result;
- }
- parseNumberingFile(xnums) {
- var result = [];
- var mapping = {};
- var bullets = [];
- xmlUtil.foreach(xnums, n => {
- switch (n.localName) {
- case "abstractNum":
- this.parseAbstractNumbering(n, bullets)
- .forEach(x => result.push(x));
- break;
- case "numPicBullet":
- bullets.push(this.parseNumberingPicBullet(n));
- break;
- case "num":
- var numId = xml_parser_1.default.attr(n, "numId");
- var abstractNumId = xml_parser_1.default.elementAttr(n, "abstractNumId", "val");
- mapping[abstractNumId] = numId;
- break;
- }
- });
- result.forEach(x => x.id = mapping[x.id]);
- return result;
- }
- parseNumberingPicBullet(elem) {
- var pict = xml_parser_1.default.element(elem, "pict");
- var shape = pict && xml_parser_1.default.element(pict, "shape");
- var imagedata = shape && xml_parser_1.default.element(shape, "imagedata");
- return imagedata ? {
- id: xml_parser_1.default.intAttr(elem, "numPicBulletId"),
- src: xml_parser_1.default.attr(imagedata, "id"),
- style: xml_parser_1.default.attr(shape, "style")
- } : null;
- }
- parseAbstractNumbering(node, bullets) {
- var result = [];
- var id = xml_parser_1.default.attr(node, "abstractNumId");
- xmlUtil.foreach(node, n => {
- switch (n.localName) {
- case "lvl":
- result.push(this.parseNumberingLevel(id, n, bullets));
- break;
- }
- });
- return result;
- }
- parseNumberingLevel(id, node, bullets) {
- var result = {
- id: id,
- level: xml_parser_1.default.intAttr(node, "ilvl"),
- pStyleName: undefined,
- pStyle: {},
- rStyle: {},
- suff: "tab"
- };
- xmlUtil.foreach(node, n => {
- switch (n.localName) {
- case "pPr":
- this.parseDefaultProperties(n, result.pStyle);
- break;
- case "rPr":
- this.parseDefaultProperties(n, result.rStyle);
- break;
- case "lvlPicBulletId":
- var id = xml_parser_1.default.intAttr(n, "val");
- result.bullet = bullets.find(x => x.id == id);
- break;
- case "lvlText":
- result.levelText = xml_parser_1.default.attr(n, "val");
- break;
- case "pStyle":
- result.pStyleName = xml_parser_1.default.attr(n, "val");
- break;
- case "numFmt":
- result.format = xml_parser_1.default.attr(n, "val");
- break;
- case "suff":
- result.suff = xml_parser_1.default.attr(n, "val");
- break;
- }
- });
- return result;
- }
- parseSdt(node, parser) {
- const sdtContent = xml_parser_1.default.element(node, "sdtContent");
- return sdtContent ? parser(sdtContent) : [];
- }
- parseInserted(node, parentParser) {
- var _a, _b;
- return {
- type: dom_1.DomType.Inserted,
- children: (_b = (_a = parentParser(node)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []
- };
- }
- parseDeleted(node, parentParser) {
- var _a, _b;
- return {
- type: dom_1.DomType.Deleted,
- children: (_b = (_a = parentParser(node)) === null || _a === void 0 ? void 0 : _a.children) !== null && _b !== void 0 ? _b : []
- };
- }
- parseParagraph(node) {
- var result = { type: dom_1.DomType.Paragraph, children: [] };
- for (let el of xml_parser_1.default.elements(node)) {
- switch (el.localName) {
- case "pPr":
- this.parseParagraphProperties(el, result);
- break;
- case "r":
- result.children.push(this.parseRun(el, result));
- break;
- case "hyperlink":
- result.children.push(this.parseHyperlink(el, result));
- break;
- case "bookmarkStart":
- result.children.push((0, bookmarks_1.parseBookmarkStart)(el, xml_parser_1.default));
- break;
- case "bookmarkEnd":
- result.children.push((0, bookmarks_1.parseBookmarkEnd)(el, xml_parser_1.default));
- break;
- case "oMath":
- case "oMathPara":
- result.children.push(this.parseMathElement(el));
- break;
- case "sdt":
- result.children.push(...this.parseSdt(el, e => this.parseParagraph(e).children));
- break;
- case "ins":
- result.children.push(this.parseInserted(el, e => this.parseParagraph(e)));
- break;
- case "del":
- result.children.push(this.parseDeleted(el, e => this.parseParagraph(e)));
- break;
- }
- }
- return result;
- }
- parseParagraphProperties(elem, paragraph) {
- this.parseDefaultProperties(elem, paragraph.cssStyle = {}, null, c => {
- if ((0, paragraph_1.parseParagraphProperty)(c, paragraph, xml_parser_1.default))
- return true;
- switch (c.localName) {
- case "pStyle":
- paragraph.styleName = xml_parser_1.default.attr(c, "val");
- break;
- case "cnfStyle":
- paragraph.className = values.classNameOfCnfStyle(c);
- break;
- case "framePr":
- this.parseFrame(c, paragraph);
- break;
- case "rPr":
- break;
- default:
- return false;
- }
- return true;
- });
- }
- parseFrame(node, paragraph) {
- var dropCap = xml_parser_1.default.attr(node, "dropCap");
- if (dropCap == "drop")
- paragraph.cssStyle["float"] = "left";
- }
- parseHyperlink(node, parent) {
- var result = { type: dom_1.DomType.Hyperlink, parent: parent, children: [] };
- var anchor = xml_parser_1.default.attr(node, "anchor");
- var relId = xml_parser_1.default.attr(node, "id");
- if (anchor)
- result.href = "#" + anchor;
- if (relId)
- result.id = relId;
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "r":
- result.children.push(this.parseRun(c, result));
- break;
- }
- });
- return result;
- }
- parseRun(node, parent) {
- var result = { type: dom_1.DomType.Run, parent: parent, children: [] };
- xmlUtil.foreach(node, c => {
- c = this.checkAlternateContent(c);
- switch (c.localName) {
- case "t":
- result.children.push({
- type: dom_1.DomType.Text,
- text: c.textContent
- });
- break;
- case "delText":
- result.children.push({
- type: dom_1.DomType.DeletedText,
- text: c.textContent
- });
- break;
- case "fldSimple":
- result.children.push({
- type: dom_1.DomType.SimpleField,
- instruction: xml_parser_1.default.attr(c, "instr"),
- lock: xml_parser_1.default.boolAttr(c, "lock", false),
- dirty: xml_parser_1.default.boolAttr(c, "dirty", false)
- });
- break;
- case "instrText":
- result.fieldRun = true;
- result.children.push({
- type: dom_1.DomType.Instruction,
- text: c.textContent
- });
- break;
- case "fldChar":
- result.fieldRun = true;
- result.children.push({
- type: dom_1.DomType.ComplexField,
- charType: xml_parser_1.default.attr(c, "fldCharType"),
- lock: xml_parser_1.default.boolAttr(c, "lock", false),
- dirty: xml_parser_1.default.boolAttr(c, "dirty", false)
- });
- break;
- case "noBreakHyphen":
- result.children.push({ type: dom_1.DomType.NoBreakHyphen });
- break;
- case "br":
- result.children.push({
- type: dom_1.DomType.Break,
- break: xml_parser_1.default.attr(c, "type") || "textWrapping"
- });
- break;
- case "lastRenderedPageBreak":
- result.children.push({
- type: dom_1.DomType.Break,
- break: "lastRenderedPageBreak"
- });
- break;
- case "sym":
- result.children.push({
- type: dom_1.DomType.Symbol,
- font: xml_parser_1.default.attr(c, "font"),
- char: xml_parser_1.default.attr(c, "char")
- });
- break;
- case "tab":
- result.children.push({ type: dom_1.DomType.Tab });
- break;
- case "footnoteReference":
- result.children.push({
- type: dom_1.DomType.FootnoteReference,
- id: xml_parser_1.default.attr(c, "id")
- });
- break;
- case "endnoteReference":
- result.children.push({
- type: dom_1.DomType.EndnoteReference,
- id: xml_parser_1.default.attr(c, "id")
- });
- break;
- case "drawing":
- let d = this.parseDrawing(c);
- if (d)
- result.children = [d];
- break;
- case "pict":
- result.children.push(this.parseVmlPicture(c));
- break;
- case "rPr":
- this.parseRunProperties(c, result);
- break;
- }
- });
- return result;
- }
- parseMathElement(elem) {
- const propsTag = `${elem.localName}Pr`;
- const result = { type: mmlTagMap[elem.localName], children: [] };
- for (const el of xml_parser_1.default.elements(elem)) {
- const childType = mmlTagMap[el.localName];
- if (childType) {
- result.children.push(this.parseMathElement(el));
- }
- else if (el.localName == "r") {
- var run = this.parseRun(el);
- run.type = dom_1.DomType.MmlRun;
- result.children.push(run);
- }
- else if (el.localName == propsTag) {
- result.props = this.parseMathProperies(el);
- }
- }
- return result;
- }
- parseMathProperies(elem) {
- const result = {};
- for (const el of xml_parser_1.default.elements(elem)) {
- switch (el.localName) {
- case "chr":
- result.char = xml_parser_1.default.attr(el, "val");
- break;
- case "degHide":
- result.hideDegree = xml_parser_1.default.boolAttr(el, "val");
- break;
- case "begChr":
- result.beginChar = xml_parser_1.default.attr(el, "val");
- break;
- case "endChr":
- result.endChar = xml_parser_1.default.attr(el, "val");
- break;
- }
- }
- return result;
- }
- parseRunProperties(elem, run) {
- this.parseDefaultProperties(elem, run.cssStyle = {}, null, c => {
- switch (c.localName) {
- case "rStyle":
- run.styleName = xml_parser_1.default.attr(c, "val");
- break;
- case "vertAlign":
- run.verticalAlign = values.valueOfVertAlign(c, true);
- break;
- default:
- return false;
- }
- return true;
- });
- }
- parseVmlPicture(elem) {
- const result = { type: dom_1.DomType.VmlPicture, children: [] };
- for (const el of xml_parser_1.default.elements(elem)) {
- const child = (0, vml_1.parseVmlElement)(el);
- child && result.children.push(child);
- }
- return result;
- }
- checkAlternateContent(elem) {
- var _a;
- if (elem.localName != 'AlternateContent')
- return elem;
- var choice = xml_parser_1.default.element(elem, "Choice");
- if (choice) {
- var requires = xml_parser_1.default.attr(choice, "Requires");
- var namespaceURI = elem.lookupNamespaceURI(requires);
- if (supportedNamespaceURIs.includes(namespaceURI))
- return choice.firstElementChild;
- }
- return (_a = xml_parser_1.default.element(elem, "Fallback")) === null || _a === void 0 ? void 0 : _a.firstElementChild;
- }
- parseDrawing(node) {
- for (var n of xml_parser_1.default.elements(node)) {
- switch (n.localName) {
- case "inline":
- case "anchor":
- return this.parseDrawingWrapper(n);
- }
- }
- }
- parseDrawingWrapper(node) {
- var _a;
- var result = { type: dom_1.DomType.Drawing, children: [], cssStyle: {} };
- var isAnchor = node.localName == "anchor";
- let wrapType = null;
- let simplePos = xml_parser_1.default.boolAttr(node, "simplePos");
- let posX = { relative: "page", align: "left", offset: "0" };
- let posY = { relative: "page", align: "top", offset: "0" };
- for (var n of xml_parser_1.default.elements(node)) {
- switch (n.localName) {
- case "simplePos":
- if (simplePos) {
- posX.offset = xml_parser_1.default.lengthAttr(n, "x", common_1.LengthUsage.Emu);
- posY.offset = xml_parser_1.default.lengthAttr(n, "y", common_1.LengthUsage.Emu);
- }
- break;
- case "extent":
- result.cssStyle["width"] = xml_parser_1.default.lengthAttr(n, "cx", common_1.LengthUsage.Emu);
- result.cssStyle["height"] = xml_parser_1.default.lengthAttr(n, "cy", common_1.LengthUsage.Emu);
- break;
- case "positionH":
- case "positionV":
- if (!simplePos) {
- let pos = n.localName == "positionH" ? posX : posY;
- var alignNode = xml_parser_1.default.element(n, "align");
- var offsetNode = xml_parser_1.default.element(n, "posOffset");
- pos.relative = (_a = xml_parser_1.default.attr(n, "relativeFrom")) !== null && _a !== void 0 ? _a : pos.relative;
- if (alignNode)
- pos.align = alignNode.textContent;
- if (offsetNode)
- pos.offset = xmlUtil.sizeValue(offsetNode, common_1.LengthUsage.Emu);
- }
- break;
- case "wrapTopAndBottom":
- wrapType = "wrapTopAndBottom";
- break;
- case "wrapNone":
- wrapType = "wrapNone";
- break;
- case "graphic":
- var g = this.parseGraphic(n);
- if (g)
- result.children.push(g);
- break;
- }
- }
- if (wrapType == "wrapTopAndBottom") {
- result.cssStyle['display'] = 'block';
- if (posX.align) {
- result.cssStyle['text-align'] = posX.align;
- result.cssStyle['width'] = "100%";
- }
- }
- else if (wrapType == "wrapNone") {
- result.cssStyle['display'] = 'block';
- result.cssStyle['position'] = 'relative';
- result.cssStyle["width"] = "0px";
- result.cssStyle["height"] = "0px";
- if (posX.offset)
- result.cssStyle["left"] = posX.offset;
- if (posY.offset)
- result.cssStyle["top"] = posY.offset;
- }
- else if (isAnchor && (posX.align == 'left' || posX.align == 'right')) {
- result.cssStyle["float"] = posX.align;
- }
- return result;
- }
- parseGraphic(elem) {
- var graphicData = xml_parser_1.default.element(elem, "graphicData");
- for (let n of xml_parser_1.default.elements(graphicData)) {
- switch (n.localName) {
- case "pic":
- return this.parsePicture(n);
- }
- }
- return null;
- }
- parsePicture(elem) {
- var result = { type: dom_1.DomType.Image, src: "", cssStyle: {} };
- var blipFill = xml_parser_1.default.element(elem, "blipFill");
- var blip = xml_parser_1.default.element(blipFill, "blip");
- result.src = xml_parser_1.default.attr(blip, "embed");
- var spPr = xml_parser_1.default.element(elem, "spPr");
- var xfrm = xml_parser_1.default.element(spPr, "xfrm");
- result.cssStyle["position"] = "relative";
- for (var n of xml_parser_1.default.elements(xfrm)) {
- switch (n.localName) {
- case "ext":
- result.cssStyle["width"] = xml_parser_1.default.lengthAttr(n, "cx", common_1.LengthUsage.Emu);
- result.cssStyle["height"] = xml_parser_1.default.lengthAttr(n, "cy", common_1.LengthUsage.Emu);
- break;
- case "off":
- result.cssStyle["left"] = xml_parser_1.default.lengthAttr(n, "x", common_1.LengthUsage.Emu);
- result.cssStyle["top"] = xml_parser_1.default.lengthAttr(n, "y", common_1.LengthUsage.Emu);
- break;
- }
- }
- return result;
- }
- parseTable(node) {
- var result = { type: dom_1.DomType.Table, children: [] };
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "tr":
- result.children.push(this.parseTableRow(c));
- break;
- case "tblGrid":
- result.columns = this.parseTableColumns(c);
- break;
- case "tblPr":
- this.parseTableProperties(c, result);
- break;
- }
- });
- return result;
- }
- parseTableColumns(node) {
- var result = [];
- xmlUtil.foreach(node, n => {
- switch (n.localName) {
- case "gridCol":
- result.push({ width: xml_parser_1.default.lengthAttr(n, "w") });
- break;
- }
- });
- return result;
- }
- parseTableProperties(elem, table) {
- table.cssStyle = {};
- table.cellStyle = {};
- this.parseDefaultProperties(elem, table.cssStyle, table.cellStyle, c => {
- switch (c.localName) {
- case "tblStyle":
- table.styleName = xml_parser_1.default.attr(c, "val");
- break;
- case "tblLook":
- table.className = values.classNameOftblLook(c);
- break;
- case "tblpPr":
- this.parseTablePosition(c, table);
- break;
- case "tblStyleColBandSize":
- table.colBandSize = xml_parser_1.default.intAttr(c, "val");
- break;
- case "tblStyleRowBandSize":
- table.rowBandSize = xml_parser_1.default.intAttr(c, "val");
- break;
- default:
- return false;
- }
- return true;
- });
- switch (table.cssStyle["text-align"]) {
- case "center":
- delete table.cssStyle["text-align"];
- table.cssStyle["margin-left"] = "auto";
- table.cssStyle["margin-right"] = "auto";
- break;
- case "right":
- delete table.cssStyle["text-align"];
- table.cssStyle["margin-left"] = "auto";
- break;
- }
- }
- parseTablePosition(node, table) {
- var topFromText = xml_parser_1.default.lengthAttr(node, "topFromText");
- var bottomFromText = xml_parser_1.default.lengthAttr(node, "bottomFromText");
- var rightFromText = xml_parser_1.default.lengthAttr(node, "rightFromText");
- var leftFromText = xml_parser_1.default.lengthAttr(node, "leftFromText");
- table.cssStyle["float"] = 'left';
- table.cssStyle["margin-bottom"] = values.addSize(table.cssStyle["margin-bottom"], bottomFromText);
- table.cssStyle["margin-left"] = values.addSize(table.cssStyle["margin-left"], leftFromText);
- table.cssStyle["margin-right"] = values.addSize(table.cssStyle["margin-right"], rightFromText);
- table.cssStyle["margin-top"] = values.addSize(table.cssStyle["margin-top"], topFromText);
- }
- parseTableRow(node) {
- var result = { type: dom_1.DomType.Row, children: [] };
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "tc":
- result.children.push(this.parseTableCell(c));
- break;
- case "trPr":
- this.parseTableRowProperties(c, result);
- break;
- }
- });
- return result;
- }
- parseTableRowProperties(elem, row) {
- row.cssStyle = this.parseDefaultProperties(elem, {}, null, c => {
- switch (c.localName) {
- case "cnfStyle":
- row.className = values.classNameOfCnfStyle(c);
- break;
- case "tblHeader":
- row.isHeader = xml_parser_1.default.boolAttr(c, "val");
- break;
- default:
- return false;
- }
- return true;
- });
- }
- parseTableCell(node) {
- var result = { type: dom_1.DomType.Cell, children: [] };
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "tbl":
- result.children.push(this.parseTable(c));
- break;
- case "p":
- result.children.push(this.parseParagraph(c));
- break;
- case "tcPr":
- this.parseTableCellProperties(c, result);
- break;
- }
- });
- return result;
- }
- parseTableCellProperties(elem, cell) {
- cell.cssStyle = this.parseDefaultProperties(elem, {}, null, c => {
- var _a;
- switch (c.localName) {
- case "gridSpan":
- cell.span = xml_parser_1.default.intAttr(c, "val", null);
- break;
- case "vMerge":
- cell.verticalMerge = (_a = xml_parser_1.default.attr(c, "val")) !== null && _a !== void 0 ? _a : "continue";
- break;
- case "cnfStyle":
- cell.className = values.classNameOfCnfStyle(c);
- break;
- default:
- return false;
- }
- return true;
- });
- }
- parseDefaultProperties(elem, style = null, childStyle = null, handler = null) {
- style = style || {};
- xmlUtil.foreach(elem, c => {
- if (handler === null || handler === void 0 ? void 0 : handler(c))
- return;
- switch (c.localName) {
- case "jc":
- style["text-align"] = values.valueOfJc(c);
- break;
- case "textAlignment":
- style["vertical-align"] = values.valueOfTextAlignment(c);
- break;
- case "color":
- style["color"] = xmlUtil.colorAttr(c, "val", null, exports.autos.color);
- break;
- case "sz":
- style["font-size"] = style["min-height"] = xml_parser_1.default.lengthAttr(c, "val", common_1.LengthUsage.FontSize);
- break;
- case "shd":
- style["background-color"] = xmlUtil.colorAttr(c, "fill", null, exports.autos.shd);
- break;
- case "highlight":
- style["background-color"] = xmlUtil.colorAttr(c, "val", null, exports.autos.highlight);
- break;
- case "vertAlign":
- break;
- case "position":
- style.verticalAlign = xml_parser_1.default.lengthAttr(c, "val", common_1.LengthUsage.FontSize);
- break;
- case "tcW":
- if (this.options.ignoreWidth)
- break;
- case "tblW":
- style["width"] = values.valueOfSize(c, "w");
- break;
- case "trHeight":
- this.parseTrHeight(c, style);
- break;
- case "strike":
- style["text-decoration"] = xml_parser_1.default.boolAttr(c, "val", true) ? "line-through" : "none";
- break;
- case "b":
- style["font-weight"] = xml_parser_1.default.boolAttr(c, "val", true) ? "bold" : "normal";
- break;
- case "i":
- style["font-style"] = xml_parser_1.default.boolAttr(c, "val", true) ? "italic" : "normal";
- break;
- case "caps":
- style["text-transform"] = xml_parser_1.default.boolAttr(c, "val", true) ? "uppercase" : "none";
- break;
- case "smallCaps":
- style["text-transform"] = xml_parser_1.default.boolAttr(c, "val", true) ? "lowercase" : "none";
- break;
- case "u":
- this.parseUnderline(c, style);
- break;
- case "ind":
- case "tblInd":
- this.parseIndentation(c, style);
- break;
- case "rFonts":
- this.parseFont(c, style);
- break;
- case "tblBorders":
- this.parseBorderProperties(c, childStyle || style);
- break;
- case "tblCellSpacing":
- style["border-spacing"] = values.valueOfMargin(c);
- style["border-collapse"] = "separate";
- break;
- case "pBdr":
- this.parseBorderProperties(c, style);
- break;
- case "bdr":
- style["border"] = values.valueOfBorder(c);
- break;
- case "tcBorders":
- this.parseBorderProperties(c, style);
- break;
- case "vanish":
- if (xml_parser_1.default.boolAttr(c, "val", true))
- style["display"] = "none";
- break;
- case "kern":
- break;
- case "noWrap":
- break;
- case "tblCellMar":
- case "tcMar":
- this.parseMarginProperties(c, childStyle || style);
- break;
- case "tblLayout":
- style["table-layout"] = values.valueOfTblLayout(c);
- break;
- case "vAlign":
- style["vertical-align"] = values.valueOfTextAlignment(c);
- break;
- case "spacing":
- if (elem.localName == "pPr")
- this.parseSpacing(c, style);
- break;
- case "wordWrap":
- if (xml_parser_1.default.boolAttr(c, "val"))
- style["overflow-wrap"] = "break-word";
- break;
- case "bCs":
- case "iCs":
- case "szCs":
- case "tabs":
- case "outlineLvl":
- case "contextualSpacing":
- case "tblStyleColBandSize":
- case "tblStyleRowBandSize":
- case "webHidden":
- case "pageBreakBefore":
- case "suppressLineNumbers":
- case "keepLines":
- case "keepNext":
- case "lang":
- case "widowControl":
- case "bidi":
- case "rtl":
- case "noProof":
- break;
- default:
- if (this.options.debug)
- console.warn(`DOCX: Unknown document element: ${elem.localName}.${c.localName}`);
- break;
- }
- });
- return style;
- }
- parseUnderline(node, style) {
- var val = xml_parser_1.default.attr(node, "val");
- if (val == null)
- return;
- switch (val) {
- case "dash":
- case "dashDotDotHeavy":
- case "dashDotHeavy":
- case "dashedHeavy":
- case "dashLong":
- case "dashLongHeavy":
- case "dotDash":
- case "dotDotDash":
- style["text-decoration-style"] = "dashed";
- break;
- case "dotted":
- case "dottedHeavy":
- style["text-decoration-style"] = "dotted";
- break;
- case "double":
- style["text-decoration-style"] = "double";
- break;
- case "single":
- case "thick":
- style["text-decoration"] = "underline";
- break;
- case "wave":
- case "wavyDouble":
- case "wavyHeavy":
- style["text-decoration-style"] = "wavy";
- break;
- case "words":
- style["text-decoration"] = "underline";
- break;
- case "none":
- style["text-decoration"] = "none";
- break;
- }
- var col = xmlUtil.colorAttr(node, "color");
- if (col)
- style["text-decoration-color"] = col;
- }
- parseFont(node, style) {
- var ascii = xml_parser_1.default.attr(node, "ascii");
- var asciiTheme = values.themeValue(node, "asciiTheme");
- var fonts = [ascii, asciiTheme].filter(x => x).join(', ');
- if (fonts.length > 0)
- style["font-family"] = fonts;
- }
- parseIndentation(node, style) {
- var firstLine = xml_parser_1.default.lengthAttr(node, "firstLine");
- var hanging = xml_parser_1.default.lengthAttr(node, "hanging");
- var left = xml_parser_1.default.lengthAttr(node, "left");
- var start = xml_parser_1.default.lengthAttr(node, "start");
- var right = xml_parser_1.default.lengthAttr(node, "right");
- var end = xml_parser_1.default.lengthAttr(node, "end");
- if (firstLine)
- style["text-indent"] = firstLine;
- if (hanging)
- style["text-indent"] = `-${hanging}`;
- if (left || start)
- style["margin-left"] = left || start;
- if (right || end)
- style["margin-right"] = right || end;
- }
- parseSpacing(node, style) {
- var before = xml_parser_1.default.lengthAttr(node, "before");
- var after = xml_parser_1.default.lengthAttr(node, "after");
- var line = xml_parser_1.default.intAttr(node, "line", null);
- var lineRule = xml_parser_1.default.attr(node, "lineRule");
- if (before)
- style["margin-top"] = before;
- if (after)
- style["margin-bottom"] = after;
- if (line !== null) {
- switch (lineRule) {
- case "auto":
- style["line-height"] = `${(line / 240).toFixed(2)}`;
- break;
- case "atLeast":
- style["line-height"] = `calc(100% + ${line / 20}pt)`;
- break;
- default:
- style["line-height"] = style["min-height"] = `${line / 20}pt`;
- break;
- }
- }
- }
- parseMarginProperties(node, output) {
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "left":
- output["padding-left"] = values.valueOfMargin(c);
- break;
- case "right":
- output["padding-right"] = values.valueOfMargin(c);
- break;
- case "top":
- output["padding-top"] = values.valueOfMargin(c);
- break;
- case "bottom":
- output["padding-bottom"] = values.valueOfMargin(c);
- break;
- }
- });
- }
- parseTrHeight(node, output) {
- switch (xml_parser_1.default.attr(node, "hRule")) {
- case "exact":
- output["height"] = xml_parser_1.default.lengthAttr(node, "val");
- break;
- case "atLeast":
- default:
- output["height"] = xml_parser_1.default.lengthAttr(node, "val");
- break;
- }
- }
- parseBorderProperties(node, output) {
- xmlUtil.foreach(node, c => {
- switch (c.localName) {
- case "start":
- case "left":
- output["border-left"] = values.valueOfBorder(c);
- break;
- case "end":
- case "right":
- output["border-right"] = values.valueOfBorder(c);
- break;
- case "top":
- output["border-top"] = values.valueOfBorder(c);
- break;
- case "bottom":
- output["border-bottom"] = values.valueOfBorder(c);
- break;
- }
- });
- }
- }
- exports.DocumentParser = DocumentParser;
- const knownColors = ['black', 'blue', 'cyan', 'darkBlue', 'darkCyan', 'darkGray', 'darkGreen', 'darkMagenta', 'darkRed', 'darkYellow', 'green', 'lightGray', 'magenta', 'none', 'red', 'white', 'yellow'];
- class xmlUtil {
- static foreach(node, cb) {
- for (var i = 0; i < node.childNodes.length; i++) {
- let n = node.childNodes[i];
- if (n.nodeType == Node.ELEMENT_NODE)
- cb(n);
- }
- }
- static colorAttr(node, attrName, defValue = null, autoColor = 'black') {
- var v = xml_parser_1.default.attr(node, attrName);
- if (v) {
- if (v == "auto") {
- return autoColor;
- }
- else if (knownColors.includes(v)) {
- return v;
- }
- return `#${v}`;
- }
- var themeColor = xml_parser_1.default.attr(node, "themeColor");
- return themeColor ? `var(--docx-${themeColor}-color)` : defValue;
- }
- static sizeValue(node, type = common_1.LengthUsage.Dxa) {
- return (0, common_1.convertLength)(node.textContent, type);
- }
- }
- class values {
- static themeValue(c, attr) {
- var val = xml_parser_1.default.attr(c, attr);
- return val ? `var(--docx-${val}-font)` : null;
- }
- static valueOfSize(c, attr) {
- var type = common_1.LengthUsage.Dxa;
- switch (xml_parser_1.default.attr(c, "type")) {
- case "dxa": break;
- case "pct":
- type = common_1.LengthUsage.Percent;
- break;
- case "auto": return "auto";
- }
- return xml_parser_1.default.lengthAttr(c, attr, type);
- }
- static valueOfMargin(c) {
- return xml_parser_1.default.lengthAttr(c, "w");
- }
- static valueOfBorder(c) {
- var type = xml_parser_1.default.attr(c, "val");
- if (type == "nil")
- return "none";
- var color = xmlUtil.colorAttr(c, "color");
- var size = xml_parser_1.default.lengthAttr(c, "sz", common_1.LengthUsage.Border);
- return `${size} solid ${color == "auto" ? exports.autos.borderColor : color}`;
- }
- static valueOfTblLayout(c) {
- var type = xml_parser_1.default.attr(c, "val");
- return type == "fixed" ? "fixed" : "auto";
- }
- static classNameOfCnfStyle(c) {
- const val = xml_parser_1.default.attr(c, "val");
- const classes = [
- 'first-row', 'last-row', 'first-col', 'last-col',
- 'odd-col', 'even-col', 'odd-row', 'even-row',
- 'ne-cell', 'nw-cell', 'se-cell', 'sw-cell'
- ];
- return classes.filter((_, i) => val[i] == '1').join(' ');
- }
- static valueOfJc(c) {
- var type = xml_parser_1.default.attr(c, "val");
- switch (type) {
- case "start":
- case "left": return "left";
- case "center": return "center";
- case "end":
- case "right": return "right";
- case "both": return "justify";
- }
- return type;
- }
- static valueOfVertAlign(c, asTagName = false) {
- var type = xml_parser_1.default.attr(c, "val");
- switch (type) {
- case "subscript": return "sub";
- case "superscript": return asTagName ? "sup" : "super";
- }
- return asTagName ? null : type;
- }
- static valueOfTextAlignment(c) {
- var type = xml_parser_1.default.attr(c, "val");
- switch (type) {
- case "auto":
- case "baseline": return "baseline";
- case "top": return "top";
- case "center": return "middle";
- case "bottom": return "bottom";
- }
- return type;
- }
- static addSize(a, b) {
- if (a == null)
- return b;
- if (b == null)
- return a;
- return `calc(${a} + ${b})`;
- }
- static classNameOftblLook(c) {
- const val = xml_parser_1.default.hexAttr(c, "val", 0);
- let className = "";
- if (xml_parser_1.default.boolAttr(c, "firstRow") || (val & 0x0020))
- className += " first-row";
- if (xml_parser_1.default.boolAttr(c, "lastRow") || (val & 0x0040))
- className += " last-row";
- if (xml_parser_1.default.boolAttr(c, "firstColumn") || (val & 0x0080))
- className += " first-col";
- if (xml_parser_1.default.boolAttr(c, "lastColumn") || (val & 0x0100))
- className += " last-col";
- if (xml_parser_1.default.boolAttr(c, "noHBand") || (val & 0x0200))
- className += " no-hband";
- if (xml_parser_1.default.boolAttr(c, "noVBand") || (val & 0x0400))
- className += " no-vband";
- return className.trim();
- }
- }
- /***/ }),
- /***/ "./src/document-props/core-props-part.ts":
- /*!***********************************************!*\
- !*** ./src/document-props/core-props-part.ts ***!
- \***********************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.CorePropsPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const core_props_1 = __webpack_require__(/*! ./core-props */ "./src/document-props/core-props.ts");
- class CorePropsPart extends part_1.Part {
- parseXml(root) {
- this.props = (0, core_props_1.parseCoreProps)(root, this._package.xmlParser);
- }
- }
- exports.CorePropsPart = CorePropsPart;
- /***/ }),
- /***/ "./src/document-props/core-props.ts":
- /*!******************************************!*\
- !*** ./src/document-props/core-props.ts ***!
- \******************************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseCoreProps = void 0;
- function parseCoreProps(root, xmlParser) {
- const result = {};
- for (let el of xmlParser.elements(root)) {
- switch (el.localName) {
- case "title":
- result.title = el.textContent;
- break;
- case "description":
- result.description = el.textContent;
- break;
- case "subject":
- result.subject = el.textContent;
- break;
- case "creator":
- result.creator = el.textContent;
- break;
- case "keywords":
- result.keywords = el.textContent;
- break;
- case "language":
- result.language = el.textContent;
- break;
- case "lastModifiedBy":
- result.lastModifiedBy = el.textContent;
- break;
- case "revision":
- el.textContent && (result.revision = parseInt(el.textContent));
- break;
- }
- }
- return result;
- }
- exports.parseCoreProps = parseCoreProps;
- /***/ }),
- /***/ "./src/document-props/custom-props-part.ts":
- /*!*************************************************!*\
- !*** ./src/document-props/custom-props-part.ts ***!
- \*************************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.CustomPropsPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const custom_props_1 = __webpack_require__(/*! ./custom-props */ "./src/document-props/custom-props.ts");
- class CustomPropsPart extends part_1.Part {
- parseXml(root) {
- this.props = (0, custom_props_1.parseCustomProps)(root, this._package.xmlParser);
- }
- }
- exports.CustomPropsPart = CustomPropsPart;
- /***/ }),
- /***/ "./src/document-props/custom-props.ts":
- /*!********************************************!*\
- !*** ./src/document-props/custom-props.ts ***!
- \********************************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseCustomProps = void 0;
- function parseCustomProps(root, xml) {
- return xml.elements(root, "property").map(e => {
- const firstChild = e.firstChild;
- return {
- formatId: xml.attr(e, "fmtid"),
- name: xml.attr(e, "name"),
- type: firstChild.nodeName,
- value: firstChild.textContent
- };
- });
- }
- exports.parseCustomProps = parseCustomProps;
- /***/ }),
- /***/ "./src/document-props/extended-props-part.ts":
- /*!***************************************************!*\
- !*** ./src/document-props/extended-props-part.ts ***!
- \***************************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.ExtendedPropsPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const extended_props_1 = __webpack_require__(/*! ./extended-props */ "./src/document-props/extended-props.ts");
- class ExtendedPropsPart extends part_1.Part {
- parseXml(root) {
- this.props = (0, extended_props_1.parseExtendedProps)(root, this._package.xmlParser);
- }
- }
- exports.ExtendedPropsPart = ExtendedPropsPart;
- /***/ }),
- /***/ "./src/document-props/extended-props.ts":
- /*!**********************************************!*\
- !*** ./src/document-props/extended-props.ts ***!
- \**********************************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseExtendedProps = void 0;
- function parseExtendedProps(root, xmlParser) {
- const result = {};
- for (let el of xmlParser.elements(root)) {
- switch (el.localName) {
- case "Template":
- result.template = el.textContent;
- break;
- case "Pages":
- result.pages = safeParseToInt(el.textContent);
- break;
- case "Words":
- result.words = safeParseToInt(el.textContent);
- break;
- case "Characters":
- result.characters = safeParseToInt(el.textContent);
- break;
- case "Application":
- result.application = el.textContent;
- break;
- case "Lines":
- result.lines = safeParseToInt(el.textContent);
- break;
- case "Paragraphs":
- result.paragraphs = safeParseToInt(el.textContent);
- break;
- case "Company":
- result.company = el.textContent;
- break;
- case "AppVersion":
- result.appVersion = el.textContent;
- break;
- }
- }
- return result;
- }
- exports.parseExtendedProps = parseExtendedProps;
- function safeParseToInt(value) {
- if (typeof value === 'undefined')
- return;
- return parseInt(value);
- }
- /***/ }),
- /***/ "./src/document/bookmarks.ts":
- /*!***********************************!*\
- !*** ./src/document/bookmarks.ts ***!
- \***********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseBookmarkEnd = exports.parseBookmarkStart = void 0;
- const dom_1 = __webpack_require__(/*! ./dom */ "./src/document/dom.ts");
- function parseBookmarkStart(elem, xml) {
- return {
- type: dom_1.DomType.BookmarkStart,
- id: xml.attr(elem, "id"),
- name: xml.attr(elem, "name"),
- colFirst: xml.intAttr(elem, "colFirst"),
- colLast: xml.intAttr(elem, "colLast")
- };
- }
- exports.parseBookmarkStart = parseBookmarkStart;
- function parseBookmarkEnd(elem, xml) {
- return {
- type: dom_1.DomType.BookmarkEnd,
- id: xml.attr(elem, "id")
- };
- }
- exports.parseBookmarkEnd = parseBookmarkEnd;
- /***/ }),
- /***/ "./src/document/border.ts":
- /*!********************************!*\
- !*** ./src/document/border.ts ***!
- \********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseBorders = exports.parseBorder = void 0;
- const common_1 = __webpack_require__(/*! ./common */ "./src/document/common.ts");
- function parseBorder(elem, xml) {
- return {
- type: xml.attr(elem, "val"),
- color: xml.attr(elem, "color"),
- size: xml.lengthAttr(elem, "sz", common_1.LengthUsage.Border),
- offset: xml.lengthAttr(elem, "space", common_1.LengthUsage.Point),
- frame: xml.boolAttr(elem, 'frame'),
- shadow: xml.boolAttr(elem, 'shadow')
- };
- }
- exports.parseBorder = parseBorder;
- function parseBorders(elem, xml) {
- var result = {};
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "left":
- result.left = parseBorder(e, xml);
- break;
- case "top":
- result.top = parseBorder(e, xml);
- break;
- case "right":
- result.right = parseBorder(e, xml);
- break;
- case "bottom":
- result.bottom = parseBorder(e, xml);
- break;
- }
- }
- return result;
- }
- exports.parseBorders = parseBorders;
- /***/ }),
- /***/ "./src/document/common.ts":
- /*!********************************!*\
- !*** ./src/document/common.ts ***!
- \********************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseCommonProperty = exports.convertPercentage = exports.convertBoolean = exports.convertLength = exports.LengthUsage = exports.ns = void 0;
- exports.ns = {
- wordml: "http://schemas.openxmlformats.org/wordprocessingml/2006/main",
- drawingml: "http://schemas.openxmlformats.org/drawingml/2006/main",
- picture: "http://schemas.openxmlformats.org/drawingml/2006/picture",
- compatibility: "http://schemas.openxmlformats.org/markup-compatibility/2006",
- math: "http://schemas.openxmlformats.org/officeDocument/2006/math"
- };
- exports.LengthUsage = {
- Dxa: { mul: 0.05, unit: "pt" },
- Emu: { mul: 1 / 12700, unit: "pt" },
- FontSize: { mul: 0.5, unit: "pt" },
- Border: { mul: 0.125, unit: "pt" },
- Point: { mul: 1, unit: "pt" },
- Percent: { mul: 0.02, unit: "%" },
- LineHeight: { mul: 1 / 240, unit: "" },
- VmlEmu: { mul: 1 / 12700, unit: "" },
- };
- function convertLength(val, usage = exports.LengthUsage.Dxa) {
- if (val == null || /.+(p[xt]|[%])$/.test(val)) {
- return val;
- }
- return `${(parseInt(val) * usage.mul).toFixed(2)}${usage.unit}`;
- }
- exports.convertLength = convertLength;
- function convertBoolean(v, defaultValue = false) {
- switch (v) {
- case "1": return true;
- case "0": return false;
- case "on": return true;
- case "off": return false;
- case "true": return true;
- case "false": return false;
- default: return defaultValue;
- }
- }
- exports.convertBoolean = convertBoolean;
- function convertPercentage(val) {
- return val ? parseInt(val) / 100 : null;
- }
- exports.convertPercentage = convertPercentage;
- function parseCommonProperty(elem, props, xml) {
- if (elem.namespaceURI != exports.ns.wordml)
- return false;
- switch (elem.localName) {
- case "color":
- props.color = xml.attr(elem, "val");
- break;
- case "sz":
- props.fontSize = xml.lengthAttr(elem, "val", exports.LengthUsage.FontSize);
- break;
- default:
- return false;
- }
- return true;
- }
- exports.parseCommonProperty = parseCommonProperty;
- /***/ }),
- /***/ "./src/document/document-part.ts":
- /*!***************************************!*\
- !*** ./src/document/document-part.ts ***!
- \***************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.DocumentPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- class DocumentPart extends part_1.Part {
- constructor(pkg, path, parser) {
- super(pkg, path);
- this._documentParser = parser;
- }
- parseXml(root) {
- this.body = this._documentParser.parseDocumentFile(root);
- }
- }
- exports.DocumentPart = DocumentPart;
- /***/ }),
- /***/ "./src/document/dom.ts":
- /*!*****************************!*\
- !*** ./src/document/dom.ts ***!
- \*****************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.DomType = void 0;
- var DomType;
- (function (DomType) {
- DomType["Document"] = "document";
- DomType["Paragraph"] = "paragraph";
- DomType["Run"] = "run";
- DomType["Break"] = "break";
- DomType["NoBreakHyphen"] = "noBreakHyphen";
- DomType["Table"] = "table";
- DomType["Row"] = "row";
- DomType["Cell"] = "cell";
- DomType["Hyperlink"] = "hyperlink";
- DomType["Drawing"] = "drawing";
- DomType["Image"] = "image";
- DomType["Text"] = "text";
- DomType["Tab"] = "tab";
- DomType["Symbol"] = "symbol";
- DomType["BookmarkStart"] = "bookmarkStart";
- DomType["BookmarkEnd"] = "bookmarkEnd";
- DomType["Footer"] = "footer";
- DomType["Header"] = "header";
- DomType["FootnoteReference"] = "footnoteReference";
- DomType["EndnoteReference"] = "endnoteReference";
- DomType["Footnote"] = "footnote";
- DomType["Endnote"] = "endnote";
- DomType["SimpleField"] = "simpleField";
- DomType["ComplexField"] = "complexField";
- DomType["Instruction"] = "instruction";
- DomType["VmlPicture"] = "vmlPicture";
- DomType["MmlMath"] = "mmlMath";
- DomType["MmlMathParagraph"] = "mmlMathParagraph";
- DomType["MmlFraction"] = "mmlFraction";
- DomType["MmlNumerator"] = "mmlNumerator";
- DomType["MmlDenominator"] = "mmlDenominator";
- DomType["MmlRadical"] = "mmlRadical";
- DomType["MmlBase"] = "mmlBase";
- DomType["MmlDegree"] = "mmlDegree";
- DomType["MmlSuperscript"] = "mmlSuperscript";
- DomType["MmlSubscript"] = "mmlSubscript";
- DomType["MmlSubArgument"] = "mmlSubArgument";
- DomType["MmlSuperArgument"] = "mmlSuperArgument";
- DomType["MmlNary"] = "mmlNary";
- DomType["MmlDelimiter"] = "mmlDelimiter";
- DomType["MmlRun"] = "mmlRun";
- DomType["VmlElement"] = "vmlElement";
- DomType["Inserted"] = "inserted";
- DomType["Deleted"] = "deleted";
- DomType["DeletedText"] = "deletedText";
- })(DomType = exports.DomType || (exports.DomType = {}));
- /***/ }),
- /***/ "./src/document/line-spacing.ts":
- /*!**************************************!*\
- !*** ./src/document/line-spacing.ts ***!
- \**************************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseLineSpacing = void 0;
- function parseLineSpacing(elem, xml) {
- return {
- before: xml.lengthAttr(elem, "before"),
- after: xml.lengthAttr(elem, "after"),
- line: xml.intAttr(elem, "line"),
- lineRule: xml.attr(elem, "lineRule")
- };
- }
- exports.parseLineSpacing = parseLineSpacing;
- /***/ }),
- /***/ "./src/document/paragraph.ts":
- /*!***********************************!*\
- !*** ./src/document/paragraph.ts ***!
- \***********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseNumbering = exports.parseTabs = exports.parseParagraphProperty = exports.parseParagraphProperties = void 0;
- const common_1 = __webpack_require__(/*! ./common */ "./src/document/common.ts");
- const section_1 = __webpack_require__(/*! ./section */ "./src/document/section.ts");
- const line_spacing_1 = __webpack_require__(/*! ./line-spacing */ "./src/document/line-spacing.ts");
- const run_1 = __webpack_require__(/*! ./run */ "./src/document/run.ts");
- function parseParagraphProperties(elem, xml) {
- let result = {};
- for (let el of xml.elements(elem)) {
- parseParagraphProperty(el, result, xml);
- }
- return result;
- }
- exports.parseParagraphProperties = parseParagraphProperties;
- function parseParagraphProperty(elem, props, xml) {
- if (elem.namespaceURI != common_1.ns.wordml)
- return false;
- if ((0, common_1.parseCommonProperty)(elem, props, xml))
- return true;
- switch (elem.localName) {
- case "tabs":
- props.tabs = parseTabs(elem, xml);
- break;
- case "sectPr":
- props.sectionProps = (0, section_1.parseSectionProperties)(elem, xml);
- break;
- case "numPr":
- props.numbering = parseNumbering(elem, xml);
- break;
- case "spacing":
- props.lineSpacing = (0, line_spacing_1.parseLineSpacing)(elem, xml);
- return false;
- break;
- case "textAlignment":
- props.textAlignment = xml.attr(elem, "val");
- return false;
- break;
- case "keepNext":
- props.keepLines = xml.boolAttr(elem, "val", true);
- break;
- case "keepNext":
- props.keepNext = xml.boolAttr(elem, "val", true);
- break;
- case "pageBreakBefore":
- props.pageBreakBefore = xml.boolAttr(elem, "val", true);
- break;
- case "outlineLvl":
- props.outlineLevel = xml.intAttr(elem, "val");
- break;
- case "pStyle":
- props.styleName = xml.attr(elem, "val");
- break;
- case "rPr":
- props.runProps = (0, run_1.parseRunProperties)(elem, xml);
- break;
- default:
- return false;
- }
- return true;
- }
- exports.parseParagraphProperty = parseParagraphProperty;
- function parseTabs(elem, xml) {
- return xml.elements(elem, "tab")
- .map(e => ({
- position: xml.lengthAttr(e, "pos"),
- leader: xml.attr(e, "leader"),
- style: xml.attr(e, "val")
- }));
- }
- exports.parseTabs = parseTabs;
- function parseNumbering(elem, xml) {
- var result = {};
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "numId":
- result.id = xml.attr(e, "val");
- break;
- case "ilvl":
- result.level = xml.intAttr(e, "val");
- break;
- }
- }
- return result;
- }
- exports.parseNumbering = parseNumbering;
- /***/ }),
- /***/ "./src/document/run.ts":
- /*!*****************************!*\
- !*** ./src/document/run.ts ***!
- \*****************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseRunProperty = exports.parseRunProperties = void 0;
- const common_1 = __webpack_require__(/*! ./common */ "./src/document/common.ts");
- function parseRunProperties(elem, xml) {
- let result = {};
- for (let el of xml.elements(elem)) {
- parseRunProperty(el, result, xml);
- }
- return result;
- }
- exports.parseRunProperties = parseRunProperties;
- function parseRunProperty(elem, props, xml) {
- if ((0, common_1.parseCommonProperty)(elem, props, xml))
- return true;
- return false;
- }
- exports.parseRunProperty = parseRunProperty;
- /***/ }),
- /***/ "./src/document/section.ts":
- /*!*********************************!*\
- !*** ./src/document/section.ts ***!
- \*********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseSectionProperties = exports.SectionType = void 0;
- const xml_parser_1 = __webpack_require__(/*! ../parser/xml-parser */ "./src/parser/xml-parser.ts");
- const border_1 = __webpack_require__(/*! ./border */ "./src/document/border.ts");
- var SectionType;
- (function (SectionType) {
- SectionType["Continuous"] = "continuous";
- SectionType["NextPage"] = "nextPage";
- SectionType["NextColumn"] = "nextColumn";
- SectionType["EvenPage"] = "evenPage";
- SectionType["OddPage"] = "oddPage";
- })(SectionType = exports.SectionType || (exports.SectionType = {}));
- function parseSectionProperties(elem, xml = xml_parser_1.default) {
- var _a, _b;
- var section = {};
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "pgSz":
- section.pageSize = {
- width: xml.lengthAttr(e, "w"),
- height: xml.lengthAttr(e, "h"),
- orientation: xml.attr(e, "orient")
- };
- break;
- case "type":
- section.type = xml.attr(e, "val");
- break;
- case "pgMar":
- section.pageMargins = {
- left: xml.lengthAttr(e, "left"),
- right: xml.lengthAttr(e, "right"),
- top: xml.lengthAttr(e, "top"),
- bottom: xml.lengthAttr(e, "bottom"),
- header: xml.lengthAttr(e, "header"),
- footer: xml.lengthAttr(e, "footer"),
- gutter: xml.lengthAttr(e, "gutter"),
- };
- break;
- case "cols":
- section.columns = parseColumns(e, xml);
- break;
- case "headerReference":
- ((_a = section.headerRefs) !== null && _a !== void 0 ? _a : (section.headerRefs = [])).push(parseFooterHeaderReference(e, xml));
- break;
- case "footerReference":
- ((_b = section.footerRefs) !== null && _b !== void 0 ? _b : (section.footerRefs = [])).push(parseFooterHeaderReference(e, xml));
- break;
- case "titlePg":
- section.titlePage = xml.boolAttr(e, "val", true);
- break;
- case "pgBorders":
- section.pageBorders = (0, border_1.parseBorders)(e, xml);
- break;
- case "pgNumType":
- section.pageNumber = parsePageNumber(e, xml);
- break;
- }
- }
- return section;
- }
- exports.parseSectionProperties = parseSectionProperties;
- function parseColumns(elem, xml) {
- return {
- numberOfColumns: xml.intAttr(elem, "num"),
- space: xml.lengthAttr(elem, "space"),
- separator: xml.boolAttr(elem, "sep"),
- equalWidth: xml.boolAttr(elem, "equalWidth", true),
- columns: xml.elements(elem, "col")
- .map(e => ({
- width: xml.lengthAttr(e, "w"),
- space: xml.lengthAttr(e, "space")
- }))
- };
- }
- function parsePageNumber(elem, xml) {
- return {
- chapSep: xml.attr(elem, "chapSep"),
- chapStyle: xml.attr(elem, "chapStyle"),
- format: xml.attr(elem, "fmt"),
- start: xml.intAttr(elem, "start")
- };
- }
- function parseFooterHeaderReference(elem, xml) {
- return {
- id: xml.attr(elem, "id"),
- type: xml.attr(elem, "type"),
- };
- }
- /***/ }),
- /***/ "./src/docx-preview.ts":
- /*!*****************************!*\
- !*** ./src/docx-preview.ts ***!
- \*****************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.renderAsync = exports.praseAsync = exports.defaultOptions = void 0;
- const word_document_1 = __webpack_require__(/*! ./word-document */ "./src/word-document.ts");
- const document_parser_1 = __webpack_require__(/*! ./document-parser */ "./src/document-parser.ts");
- const html_renderer_1 = __webpack_require__(/*! ./html-renderer */ "./src/html-renderer.ts");
- exports.defaultOptions = {
- ignoreHeight: false,
- ignoreWidth: false,
- ignoreFonts: false,
- breakPages: true,
- debug: false,
- experimental: false,
- className: "docx",
- inWrapper: true,
- trimXmlDeclaration: true,
- ignoreLastRenderedPageBreak: true,
- renderHeaders: true,
- renderFooters: true,
- renderFootnotes: true,
- renderEndnotes: true,
- useBase64URL: false,
- useMathMLPolyfill: false,
- renderChanges: false
- };
- function praseAsync(data, userOptions = null) {
- const ops = Object.assign(Object.assign({}, exports.defaultOptions), userOptions);
- return word_document_1.WordDocument.load(data, new document_parser_1.DocumentParser(ops), ops);
- }
- exports.praseAsync = praseAsync;
- function renderAsync(data, bodyContainer, styleContainer = null, userOptions = null) {
- const ops = Object.assign(Object.assign({}, exports.defaultOptions), userOptions);
- const renderer = new html_renderer_1.HtmlRenderer(window.document);
- return word_document_1.WordDocument
- .load(data, new document_parser_1.DocumentParser(ops), ops)
- .then(doc => {
- renderer.render(doc, bodyContainer, styleContainer, ops);
- return doc;
- });
- }
- exports.renderAsync = renderAsync;
- /***/ }),
- /***/ "./src/font-table/font-table.ts":
- /*!**************************************!*\
- !*** ./src/font-table/font-table.ts ***!
- \**************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.FontTablePart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const fonts_1 = __webpack_require__(/*! ./fonts */ "./src/font-table/fonts.ts");
- class FontTablePart extends part_1.Part {
- parseXml(root) {
- this.fonts = (0, fonts_1.parseFonts)(root, this._package.xmlParser);
- }
- }
- exports.FontTablePart = FontTablePart;
- /***/ }),
- /***/ "./src/font-table/fonts.ts":
- /*!*********************************!*\
- !*** ./src/font-table/fonts.ts ***!
- \*********************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseEmbedFontRef = exports.parseFont = exports.parseFonts = void 0;
- const embedFontTypeMap = {
- embedRegular: 'regular',
- embedBold: 'bold',
- embedItalic: 'italic',
- embedBoldItalic: 'boldItalic',
- };
- function parseFonts(root, xml) {
- return xml.elements(root).map(el => parseFont(el, xml));
- }
- exports.parseFonts = parseFonts;
- function parseFont(elem, xml) {
- let result = {
- name: xml.attr(elem, "name"),
- embedFontRefs: []
- };
- for (let el of xml.elements(elem)) {
- switch (el.localName) {
- case "family":
- result.family = xml.attr(el, "val");
- break;
- case "altName":
- result.altName = xml.attr(el, "val");
- break;
- case "embedRegular":
- case "embedBold":
- case "embedItalic":
- case "embedBoldItalic":
- result.embedFontRefs.push(parseEmbedFontRef(el, xml));
- break;
- }
- }
- return result;
- }
- exports.parseFont = parseFont;
- function parseEmbedFontRef(elem, xml) {
- return {
- id: xml.attr(elem, "id"),
- key: xml.attr(elem, "fontKey"),
- type: embedFontTypeMap[elem.localName]
- };
- }
- exports.parseEmbedFontRef = parseEmbedFontRef;
- /***/ }),
- /***/ "./src/header-footer/elements.ts":
- /*!***************************************!*\
- !*** ./src/header-footer/elements.ts ***!
- \***************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.WmlFooter = exports.WmlHeader = void 0;
- const dom_1 = __webpack_require__(/*! ../document/dom */ "./src/document/dom.ts");
- class WmlHeader {
- constructor() {
- this.type = dom_1.DomType.Header;
- this.children = [];
- this.cssStyle = {};
- }
- }
- exports.WmlHeader = WmlHeader;
- class WmlFooter {
- constructor() {
- this.type = dom_1.DomType.Footer;
- this.children = [];
- this.cssStyle = {};
- }
- }
- exports.WmlFooter = WmlFooter;
- /***/ }),
- /***/ "./src/header-footer/parts.ts":
- /*!************************************!*\
- !*** ./src/header-footer/parts.ts ***!
- \************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.FooterPart = exports.HeaderPart = exports.BaseHeaderFooterPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const elements_1 = __webpack_require__(/*! ./elements */ "./src/header-footer/elements.ts");
- class BaseHeaderFooterPart extends part_1.Part {
- constructor(pkg, path, parser) {
- super(pkg, path);
- this._documentParser = parser;
- }
- parseXml(root) {
- this.rootElement = this.createRootElement();
- this.rootElement.children = this._documentParser.parseBodyElements(root);
- }
- }
- exports.BaseHeaderFooterPart = BaseHeaderFooterPart;
- class HeaderPart extends BaseHeaderFooterPart {
- createRootElement() {
- return new elements_1.WmlHeader();
- }
- }
- exports.HeaderPart = HeaderPart;
- class FooterPart extends BaseHeaderFooterPart {
- createRootElement() {
- return new elements_1.WmlFooter();
- }
- }
- exports.FooterPart = FooterPart;
- /***/ }),
- /***/ "./src/html-renderer.ts":
- /*!******************************!*\
- !*** ./src/html-renderer.ts ***!
- \******************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.HtmlRenderer = void 0;
- const dom_1 = __webpack_require__(/*! ./document/dom */ "./src/document/dom.ts");
- const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
- const javascript_1 = __webpack_require__(/*! ./javascript */ "./src/javascript.ts");
- const mathml_scss_1 = __webpack_require__(/*! ./mathml.scss */ "./src/mathml.scss");
- const ns = {
- svg: "http://www.w3.org/2000/svg",
- mathML: "http://www.w3.org/1998/Math/MathML"
- };
- class HtmlRenderer {
- constructor(htmlDocument) {
- this.htmlDocument = htmlDocument;
- this.className = "docx";
- this.styleMap = {};
- this.currentPart = null;
- this.tableVerticalMerges = [];
- this.currentVerticalMerge = null;
- this.tableCellPositions = [];
- this.currentCellPosition = null;
- this.footnoteMap = {};
- this.endnoteMap = {};
- this.currentEndnoteIds = [];
- this.usedHederFooterParts = [];
- this.currentTabs = [];
- this.tabsTimeout = 0;
- this.createElement = createElement;
- }
- render(document, bodyContainer, styleContainer = null, options) {
- var _a;
- this.document = document;
- this.options = options;
- this.className = options.className;
- this.rootSelector = options.inWrapper ? `.${this.className}-wrapper` : ':root';
- this.styleMap = null;
- styleContainer = styleContainer || bodyContainer;
- removeAllElements(styleContainer);
- removeAllElements(bodyContainer);
- appendComment(styleContainer, "docxjs library predefined styles");
- styleContainer.appendChild(this.renderDefaultStyle());
- if (!window.MathMLElement && options.useMathMLPolyfill) {
- appendComment(styleContainer, "docxjs mathml polyfill styles");
- styleContainer.appendChild(createStyleElement(mathml_scss_1.default));
- }
- if (document.themePart) {
- appendComment(styleContainer, "docxjs document theme values");
- this.renderTheme(document.themePart, styleContainer);
- }
- if (document.stylesPart != null) {
- this.styleMap = this.processStyles(document.stylesPart.styles);
- appendComment(styleContainer, "docxjs document styles");
- styleContainer.appendChild(this.renderStyles(document.stylesPart.styles));
- }
- if (document.numberingPart) {
- this.prodessNumberings(document.numberingPart.domNumberings);
- appendComment(styleContainer, "docxjs document numbering styles");
- styleContainer.appendChild(this.renderNumbering(document.numberingPart.domNumberings, styleContainer));
- }
- if (document.footnotesPart) {
- this.footnoteMap = (0, utils_1.keyBy)(document.footnotesPart.notes, x => x.id);
- }
- if (document.endnotesPart) {
- this.endnoteMap = (0, utils_1.keyBy)(document.endnotesPart.notes, x => x.id);
- }
- if (document.settingsPart) {
- this.defaultTabSize = (_a = document.settingsPart.settings) === null || _a === void 0 ? void 0 : _a.defaultTabStop;
- }
- if (!options.ignoreFonts && document.fontTablePart)
- this.renderFontTable(document.fontTablePart, styleContainer);
- var sectionElements = this.renderSections(document.documentPart.body);
- if (this.options.inWrapper) {
- bodyContainer.appendChild(this.renderWrapper(sectionElements));
- }
- else {
- appendChildren(bodyContainer, sectionElements);
- }
- this.refreshTabStops();
- }
- renderTheme(themePart, styleContainer) {
- var _a, _b;
- const variables = {};
- const fontScheme = (_a = themePart.theme) === null || _a === void 0 ? void 0 : _a.fontScheme;
- if (fontScheme) {
- if (fontScheme.majorFont) {
- variables['--docx-majorHAnsi-font'] = fontScheme.majorFont.latinTypeface;
- }
- if (fontScheme.minorFont) {
- variables['--docx-minorHAnsi-font'] = fontScheme.minorFont.latinTypeface;
- }
- }
- const colorScheme = (_b = themePart.theme) === null || _b === void 0 ? void 0 : _b.colorScheme;
- if (colorScheme) {
- for (let [k, v] of Object.entries(colorScheme.colors)) {
- variables[`--docx-${k}-color`] = `#${v}`;
- }
- }
- const cssText = this.styleToString(`.${this.className}`, variables);
- styleContainer.appendChild(createStyleElement(cssText));
- }
- renderFontTable(fontsPart, styleContainer) {
- for (let f of fontsPart.fonts) {
- for (let ref of f.embedFontRefs) {
- this.document.loadFont(ref.id, ref.key).then(fontData => {
- const cssValues = {
- 'font-family': f.name,
- 'src': `url(${fontData})`
- };
- if (ref.type == "bold" || ref.type == "boldItalic") {
- cssValues['font-weight'] = 'bold';
- }
- if (ref.type == "italic" || ref.type == "boldItalic") {
- cssValues['font-style'] = 'italic';
- }
- appendComment(styleContainer, `docxjs ${f.name} font`);
- const cssText = this.styleToString("@font-face", cssValues);
- styleContainer.appendChild(createStyleElement(cssText));
- this.refreshTabStops();
- });
- }
- }
- }
- processStyleName(className) {
- return className ? `${this.className}_${(0, utils_1.escapeClassName)(className)}` : this.className;
- }
- processStyles(styles) {
- const stylesMap = (0, utils_1.keyBy)(styles.filter(x => x.id != null), x => x.id);
- for (const style of styles.filter(x => x.basedOn)) {
- var baseStyle = stylesMap[style.basedOn];
- if (baseStyle) {
- style.paragraphProps = (0, utils_1.mergeDeep)(style.paragraphProps, baseStyle.paragraphProps);
- style.runProps = (0, utils_1.mergeDeep)(style.runProps, baseStyle.runProps);
- for (const baseValues of baseStyle.styles) {
- const styleValues = style.styles.find(x => x.target == baseValues.target);
- if (styleValues) {
- this.copyStyleProperties(baseValues.values, styleValues.values);
- }
- else {
- style.styles.push(Object.assign(Object.assign({}, baseValues), { values: Object.assign({}, baseValues.values) }));
- }
- }
- }
- else if (this.options.debug)
- console.warn(`Can't find base style ${style.basedOn}`);
- }
- for (let style of styles) {
- style.cssName = this.processStyleName(style.id);
- }
- return stylesMap;
- }
- prodessNumberings(numberings) {
- var _a;
- for (let num of numberings.filter(n => n.pStyleName)) {
- const style = this.findStyle(num.pStyleName);
- if ((_a = style === null || style === void 0 ? void 0 : style.paragraphProps) === null || _a === void 0 ? void 0 : _a.numbering) {
- style.paragraphProps.numbering.level = num.level;
- }
- }
- }
- processElement(element) {
- if (element.children) {
- for (var e of element.children) {
- e.parent = element;
- if (e.type == dom_1.DomType.Table) {
- this.processTable(e);
- }
- else {
- this.processElement(e);
- }
- }
- }
- }
- processTable(table) {
- for (var r of table.children) {
- for (var c of r.children) {
- c.cssStyle = this.copyStyleProperties(table.cellStyle, c.cssStyle, [
- "border-left", "border-right", "border-top", "border-bottom",
- "padding-left", "padding-right", "padding-top", "padding-bottom"
- ]);
- this.processElement(c);
- }
- }
- }
- copyStyleProperties(input, output, attrs = null) {
- if (!input)
- return output;
- if (output == null)
- output = {};
- if (attrs == null)
- attrs = Object.getOwnPropertyNames(input);
- for (var key of attrs) {
- if (input.hasOwnProperty(key) && !output.hasOwnProperty(key))
- output[key] = input[key];
- }
- return output;
- }
- createSection(className, props) {
- var elem = this.createElement("section", { className });
- if (props) {
- if (props.pageMargins) {
- elem.style.paddingLeft = props.pageMargins.left;
- elem.style.paddingRight = props.pageMargins.right;
- elem.style.paddingTop = props.pageMargins.top;
- elem.style.paddingBottom = props.pageMargins.bottom;
- }
- if (props.pageSize) {
- if (!this.options.ignoreWidth)
- elem.style.width = props.pageSize.width;
- if (!this.options.ignoreHeight)
- elem.style.minHeight = props.pageSize.height;
- }
- if (props.columns && props.columns.numberOfColumns) {
- elem.style.columnCount = `${props.columns.numberOfColumns}`;
- elem.style.columnGap = props.columns.space;
- if (props.columns.separator) {
- elem.style.columnRule = "1px solid black";
- }
- }
- }
- return elem;
- }
- renderSections(document) {
- const result = [];
- this.processElement(document);
- const sections = this.splitBySection(document.children);
- let prevProps = null;
- for (let i = 0, l = sections.length; i < l; i++) {
- this.currentFootnoteIds = [];
- const section = sections[i];
- const props = section.sectProps || document.props;
- const sectionElement = this.createSection(this.className, props);
- this.renderStyleValues(document.cssStyle, sectionElement);
- this.options.renderHeaders && this.renderHeaderFooter(props.headerRefs, props, result.length, prevProps != props, sectionElement);
- var contentElement = this.createElement("article");
- this.renderElements(section.elements, contentElement);
- sectionElement.appendChild(contentElement);
- if (this.options.renderFootnotes) {
- this.renderNotes(this.currentFootnoteIds, this.footnoteMap, sectionElement);
- }
- if (this.options.renderEndnotes && i == l - 1) {
- this.renderNotes(this.currentEndnoteIds, this.endnoteMap, sectionElement);
- }
- this.options.renderFooters && this.renderHeaderFooter(props.footerRefs, props, result.length, prevProps != props, sectionElement);
- result.push(sectionElement);
- prevProps = props;
- }
- return result;
- }
- renderHeaderFooter(refs, props, page, firstOfSection, into) {
- var _a, _b;
- if (!refs)
- return;
- var ref = (_b = (_a = (props.titlePage && firstOfSection ? refs.find(x => x.type == "first") : null)) !== null && _a !== void 0 ? _a : (page % 2 == 1 ? refs.find(x => x.type == "even") : null)) !== null && _b !== void 0 ? _b : refs.find(x => x.type == "default");
- var part = ref && this.document.findPartByRelId(ref.id, this.document.documentPart);
- if (part) {
- this.currentPart = part;
- if (!this.usedHederFooterParts.includes(part.path)) {
- this.processElement(part.rootElement);
- this.usedHederFooterParts.push(part.path);
- }
- this.renderElements([part.rootElement], into);
- this.currentPart = null;
- }
- }
- isPageBreakElement(elem) {
- if (elem.type != dom_1.DomType.Break)
- return false;
- if (elem.break == "lastRenderedPageBreak")
- return !this.options.ignoreLastRenderedPageBreak;
- return elem.break == "page";
- }
- splitBySection(elements) {
- var _a;
- var current = { sectProps: null, elements: [] };
- var result = [current];
- for (let elem of elements) {
- if (elem.type == dom_1.DomType.Paragraph) {
- const s = this.findStyle(elem.styleName);
- if ((_a = s === null || s === void 0 ? void 0 : s.paragraphProps) === null || _a === void 0 ? void 0 : _a.pageBreakBefore) {
- current.sectProps = sectProps;
- current = { sectProps: null, elements: [] };
- result.push(current);
- }
- }
- current.elements.push(elem);
- if (elem.type == dom_1.DomType.Paragraph) {
- const p = elem;
- var sectProps = p.sectionProps;
- var pBreakIndex = -1;
- var rBreakIndex = -1;
- if (this.options.breakPages && p.children) {
- pBreakIndex = p.children.findIndex(r => {
- var _a, _b;
- rBreakIndex = (_b = (_a = r.children) === null || _a === void 0 ? void 0 : _a.findIndex(this.isPageBreakElement.bind(this))) !== null && _b !== void 0 ? _b : -1;
- return rBreakIndex != -1;
- });
- }
- if (sectProps || pBreakIndex != -1) {
- current.sectProps = sectProps;
- current = { sectProps: null, elements: [] };
- result.push(current);
- }
- if (pBreakIndex != -1) {
- let breakRun = p.children[pBreakIndex];
- let splitRun = rBreakIndex < breakRun.children.length - 1;
- if (pBreakIndex < p.children.length - 1 || splitRun) {
- var children = elem.children;
- var newParagraph = Object.assign(Object.assign({}, elem), { children: children.slice(pBreakIndex) });
- elem.children = children.slice(0, pBreakIndex);
- current.elements.push(newParagraph);
- if (splitRun) {
- let runChildren = breakRun.children;
- let newRun = Object.assign(Object.assign({}, breakRun), { children: runChildren.slice(0, rBreakIndex) });
- elem.children.push(newRun);
- breakRun.children = runChildren.slice(rBreakIndex);
- }
- }
- }
- }
- }
- let currentSectProps = null;
- for (let i = result.length - 1; i >= 0; i--) {
- if (result[i].sectProps == null) {
- result[i].sectProps = currentSectProps;
- }
- else {
- currentSectProps = result[i].sectProps;
- }
- }
- return result;
- }
- renderWrapper(children) {
- return this.createElement("div", { className: `${this.className}-wrapper` }, children);
- }
- renderDefaultStyle() {
- var c = this.className;
- var styleText = `
- .${c}-wrapper { background: gray; padding: 30px; padding-bottom: 0px; display: flex; flex-flow: column; align-items: center; }
- .${c}-wrapper>section.${c} { background: white; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); margin-bottom: 30px; }
- .${c} { color: black; }
- section.${c} { box-sizing: border-box; display: flex; flex-flow: column nowrap; position: relative; overflow: hidden; }
- section.${c}>article { margin-bottom: auto; }
- .${c} table { border-collapse: collapse; }
- .${c} table td, .${c} table th { vertical-align: top; }
- .${c} p { margin: 0pt; min-height: 1em; }
- .${c} span { white-space: pre-wrap; overflow-wrap: break-word; }
- .${c} a { color: inherit; text-decoration: inherit; }
- `;
- return createStyleElement(styleText);
- }
- renderNumbering(numberings, styleContainer) {
- var styleText = "";
- var rootCounters = [];
- for (var num of numberings) {
- var selector = `p.${this.numberingClass(num.id, num.level)}`;
- var listStyleType = "none";
- if (num.bullet) {
- let valiable = `--${this.className}-${num.bullet.src}`.toLowerCase();
- styleText += this.styleToString(`${selector}:before`, {
- "content": "' '",
- "display": "inline-block",
- "background": `var(${valiable})`
- }, num.bullet.style);
- this.document.loadNumberingImage(num.bullet.src).then(data => {
- var text = `${this.rootSelector} { ${valiable}: url(${data}) }`;
- styleContainer.appendChild(createStyleElement(text));
- });
- }
- else if (num.levelText) {
- let counter = this.numberingCounter(num.id, num.level);
- if (num.level > 0) {
- styleText += this.styleToString(`p.${this.numberingClass(num.id, num.level - 1)}`, {
- "counter-reset": counter
- });
- }
- else {
- rootCounters.push(counter);
- }
- styleText += this.styleToString(`${selector}:before`, Object.assign({ "content": this.levelTextToContent(num.levelText, num.suff, num.id, this.numFormatToCssValue(num.format)), "counter-increment": counter }, num.rStyle));
- }
- else {
- listStyleType = this.numFormatToCssValue(num.format);
- }
- styleText += this.styleToString(selector, Object.assign({ "display": "list-item", "list-style-position": "inside", "list-style-type": listStyleType }, num.pStyle));
- }
- if (rootCounters.length > 0) {
- styleText += this.styleToString(this.rootSelector, {
- "counter-reset": rootCounters.join(" ")
- });
- }
- return createStyleElement(styleText);
- }
- renderStyles(styles) {
- var _a;
- var styleText = "";
- const stylesMap = this.styleMap;
- const defautStyles = (0, utils_1.keyBy)(styles.filter(s => s.isDefault), s => s.target);
- for (const style of styles) {
- var subStyles = style.styles;
- if (style.linked) {
- var linkedStyle = style.linked && stylesMap[style.linked];
- if (linkedStyle)
- subStyles = subStyles.concat(linkedStyle.styles);
- else if (this.options.debug)
- console.warn(`Can't find linked style ${style.linked}`);
- }
- for (const subStyle of subStyles) {
- var selector = `${(_a = style.target) !== null && _a !== void 0 ? _a : ''}.${style.cssName}`;
- if (style.target != subStyle.target)
- selector += ` ${subStyle.target}`;
- if (defautStyles[style.target] == style)
- selector = `.${this.className} ${style.target}, ` + selector;
- styleText += this.styleToString(selector, subStyle.values);
- }
- }
- return createStyleElement(styleText);
- }
- renderNotes(noteIds, notesMap, into) {
- var notes = noteIds.map(id => notesMap[id]).filter(x => x);
- if (notes.length > 0) {
- var result = this.createElement("ol", null, this.renderElements(notes));
- into.appendChild(result);
- }
- }
- renderElement(elem) {
- switch (elem.type) {
- case dom_1.DomType.Paragraph:
- return this.renderParagraph(elem);
- case dom_1.DomType.BookmarkStart:
- return this.renderBookmarkStart(elem);
- case dom_1.DomType.BookmarkEnd:
- return null;
- case dom_1.DomType.Run:
- return this.renderRun(elem);
- case dom_1.DomType.Table:
- return this.renderTable(elem);
- case dom_1.DomType.Row:
- return this.renderTableRow(elem);
- case dom_1.DomType.Cell:
- return this.renderTableCell(elem);
- case dom_1.DomType.Hyperlink:
- return this.renderHyperlink(elem);
- case dom_1.DomType.Drawing:
- return this.renderDrawing(elem);
- case dom_1.DomType.Image:
- return this.renderImage(elem);
- case dom_1.DomType.Text:
- return this.renderText(elem);
- case dom_1.DomType.Text:
- return this.renderText(elem);
- case dom_1.DomType.DeletedText:
- return this.renderDeletedText(elem);
- case dom_1.DomType.Tab:
- return this.renderTab(elem);
- case dom_1.DomType.Symbol:
- return this.renderSymbol(elem);
- case dom_1.DomType.Break:
- return this.renderBreak(elem);
- case dom_1.DomType.Footer:
- return this.renderContainer(elem, "footer");
- case dom_1.DomType.Header:
- return this.renderContainer(elem, "header");
- case dom_1.DomType.Footnote:
- case dom_1.DomType.Endnote:
- return this.renderContainer(elem, "li");
- case dom_1.DomType.FootnoteReference:
- return this.renderFootnoteReference(elem);
- case dom_1.DomType.EndnoteReference:
- return this.renderEndnoteReference(elem);
- case dom_1.DomType.NoBreakHyphen:
- return this.createElement("wbr");
- case dom_1.DomType.VmlPicture:
- return this.renderVmlPicture(elem);
- case dom_1.DomType.VmlElement:
- return this.renderVmlElement(elem);
- case dom_1.DomType.MmlMath:
- return this.renderContainerNS(elem, ns.mathML, "math", { xmlns: ns.mathML });
- case dom_1.DomType.MmlMathParagraph:
- return this.renderContainer(elem, "span");
- case dom_1.DomType.MmlFraction:
- return this.renderContainerNS(elem, ns.mathML, "mfrac");
- case dom_1.DomType.MmlNumerator:
- case dom_1.DomType.MmlDenominator:
- return this.renderContainerNS(elem, ns.mathML, "mrow");
- case dom_1.DomType.MmlRadical:
- return this.renderMmlRadical(elem);
- case dom_1.DomType.MmlDegree:
- return this.renderContainerNS(elem, ns.mathML, "mn");
- case dom_1.DomType.MmlSuperscript:
- return this.renderContainerNS(elem, ns.mathML, "msup");
- case dom_1.DomType.MmlSubscript:
- return this.renderContainerNS(elem, ns.mathML, "msub");
- case dom_1.DomType.MmlBase:
- return this.renderContainerNS(elem, ns.mathML, "mrow");
- case dom_1.DomType.MmlSuperArgument:
- return this.renderContainerNS(elem, ns.mathML, "mn");
- case dom_1.DomType.MmlSubArgument:
- return this.renderContainerNS(elem, ns.mathML, "mn");
- case dom_1.DomType.MmlDelimiter:
- return this.renderMmlDelimiter(elem);
- case dom_1.DomType.MmlRun:
- return this.renderMmlRun(elem);
- case dom_1.DomType.MmlNary:
- return this.renderMmlNary(elem);
- case dom_1.DomType.Inserted:
- return this.renderInserted(elem);
- case dom_1.DomType.Deleted:
- return this.renderDeleted(elem);
- }
- return null;
- }
- renderChildren(elem, into) {
- return this.renderElements(elem.children, into);
- }
- renderElements(elems, into) {
- if (elems == null)
- return null;
- var result = elems.flatMap(e => this.renderElement(e)).filter(e => e != null);
- if (into)
- appendChildren(into, result);
- return result;
- }
- renderContainer(elem, tagName, props) {
- return this.createElement(tagName, props, this.renderChildren(elem));
- }
- renderContainerNS(elem, ns, tagName, props) {
- return createElementNS(ns, tagName, props, this.renderChildren(elem));
- }
- renderParagraph(elem) {
- var _a, _b, _c, _d;
- var result = this.createElement("p");
- const style = this.findStyle(elem.styleName);
- (_a = elem.tabs) !== null && _a !== void 0 ? _a : (elem.tabs = (_b = style === null || style === void 0 ? void 0 : style.paragraphProps) === null || _b === void 0 ? void 0 : _b.tabs);
- this.renderClass(elem, result);
- this.renderChildren(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- this.renderCommonProperties(result.style, elem);
- const numbering = (_c = elem.numbering) !== null && _c !== void 0 ? _c : (_d = style === null || style === void 0 ? void 0 : style.paragraphProps) === null || _d === void 0 ? void 0 : _d.numbering;
- if (numbering) {
- result.classList.add(this.numberingClass(numbering.id, numbering.level));
- }
- return result;
- }
- renderRunProperties(style, props) {
- this.renderCommonProperties(style, props);
- }
- renderCommonProperties(style, props) {
- if (props == null)
- return;
- if (props.color) {
- style["color"] = props.color;
- }
- if (props.fontSize) {
- style["font-size"] = props.fontSize;
- }
- }
- renderHyperlink(elem) {
- var result = this.createElement("a");
- this.renderChildren(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- if (elem.href) {
- result.href = elem.href;
- }
- else if (elem.id) {
- const rel = this.document.documentPart.rels
- .find(it => it.id == elem.id && it.targetMode === "External");
- result.href = rel === null || rel === void 0 ? void 0 : rel.target;
- }
- return result;
- }
- renderDrawing(elem) {
- var result = this.createElement("div");
- result.style.display = "inline-block";
- result.style.position = "relative";
- result.style.textIndent = "0px";
- this.renderChildren(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- return result;
- }
- renderImage(elem) {
- let result = this.createElement("img");
- this.renderStyleValues(elem.cssStyle, result);
- if (this.document) {
- this.document.loadDocumentImage(elem.src, this.currentPart).then(x => {
- result.src = x;
- });
- }
- return result;
- }
- renderText(elem) {
- return this.htmlDocument.createTextNode(elem.text);
- }
- renderDeletedText(elem) {
- return this.options.renderEndnotes ? this.htmlDocument.createTextNode(elem.text) : null;
- }
- renderBreak(elem) {
- if (elem.break == "textWrapping") {
- return this.createElement("br");
- }
- return null;
- }
- renderInserted(elem) {
- if (this.options.renderChanges)
- return this.renderContainer(elem, "ins");
- return this.renderChildren(elem);
- }
- renderDeleted(elem) {
- if (this.options.renderChanges)
- return this.renderContainer(elem, "del");
- return null;
- }
- renderSymbol(elem) {
- var span = this.createElement("span");
- span.style.fontFamily = elem.font;
- span.innerHTML = `&#x${elem.char};`;
- return span;
- }
- renderFootnoteReference(elem) {
- var result = this.createElement("sup");
- this.currentFootnoteIds.push(elem.id);
- result.textContent = `${this.currentFootnoteIds.length}`;
- return result;
- }
- renderEndnoteReference(elem) {
- var result = this.createElement("sup");
- this.currentEndnoteIds.push(elem.id);
- result.textContent = `${this.currentEndnoteIds.length}`;
- return result;
- }
- renderTab(elem) {
- var _a;
- var tabSpan = this.createElement("span");
- tabSpan.innerHTML = " ";
- if (this.options.experimental) {
- tabSpan.className = this.tabStopClass();
- var stops = (_a = findParent(elem, dom_1.DomType.Paragraph)) === null || _a === void 0 ? void 0 : _a.tabs;
- this.currentTabs.push({ stops, span: tabSpan });
- }
- return tabSpan;
- }
- renderBookmarkStart(elem) {
- var result = this.createElement("span");
- result.id = elem.name;
- return result;
- }
- renderRun(elem) {
- if (elem.fieldRun)
- return null;
- const result = this.createElement("span");
- if (elem.id)
- result.id = elem.id;
- this.renderClass(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- if (elem.verticalAlign) {
- const wrapper = this.createElement(elem.verticalAlign);
- this.renderChildren(elem, wrapper);
- result.appendChild(wrapper);
- }
- else {
- this.renderChildren(elem, result);
- }
- return result;
- }
- renderTable(elem) {
- let result = this.createElement("table");
- this.tableCellPositions.push(this.currentCellPosition);
- this.tableVerticalMerges.push(this.currentVerticalMerge);
- this.currentVerticalMerge = {};
- this.currentCellPosition = { col: 0, row: 0 };
- if (elem.columns)
- result.appendChild(this.renderTableColumns(elem.columns));
- this.renderClass(elem, result);
- this.renderChildren(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- this.currentVerticalMerge = this.tableVerticalMerges.pop();
- this.currentCellPosition = this.tableCellPositions.pop();
- return result;
- }
- renderTableColumns(columns) {
- let result = this.createElement("colgroup");
- for (let col of columns) {
- let colElem = this.createElement("col");
- if (col.width)
- colElem.style.width = col.width;
- result.appendChild(colElem);
- }
- return result;
- }
- renderTableRow(elem) {
- let result = this.createElement("tr");
- this.currentCellPosition.col = 0;
- this.renderClass(elem, result);
- this.renderChildren(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- this.currentCellPosition.row++;
- return result;
- }
- renderTableCell(elem) {
- let result = this.createElement("td");
- const key = this.currentCellPosition.col;
- if (elem.verticalMerge) {
- if (elem.verticalMerge == "restart") {
- this.currentVerticalMerge[key] = result;
- result.rowSpan = 1;
- }
- else if (this.currentVerticalMerge[key]) {
- this.currentVerticalMerge[key].rowSpan += 1;
- result.style.display = "none";
- }
- }
- else {
- this.currentVerticalMerge[key] = null;
- }
- this.renderClass(elem, result);
- this.renderChildren(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- if (elem.span)
- result.colSpan = elem.span;
- this.currentCellPosition.col += result.colSpan;
- return result;
- }
- renderVmlPicture(elem) {
- var result = createElement("div");
- this.renderChildren(elem, result);
- return result;
- }
- renderVmlElement(elem) {
- var _a, _b;
- var container = createSvgElement("svg");
- container.setAttribute("style", elem.cssStyleText);
- const result = createSvgElement(elem.tagName);
- Object.entries(elem.attrs).forEach(([k, v]) => result.setAttribute(k, v));
- if ((_a = elem.imageHref) === null || _a === void 0 ? void 0 : _a.id) {
- (_b = this.document) === null || _b === void 0 ? void 0 : _b.loadDocumentImage(elem.imageHref.id, this.currentPart).then(x => result.setAttribute("href", x));
- }
- container.appendChild(result);
- setTimeout(() => {
- const bb = container.firstElementChild.getBBox();
- container.setAttribute("width", `${Math.ceil(bb.x + bb.width)}`);
- container.setAttribute("height", `${Math.ceil(bb.y + bb.height)}`);
- }, 0);
- return container;
- }
- renderMmlRadical(elem) {
- var _a;
- const base = elem.children.find(el => el.type == dom_1.DomType.MmlBase);
- if ((_a = elem.props) === null || _a === void 0 ? void 0 : _a.hideDegree) {
- return createElementNS(ns.mathML, "msqrt", null, this.renderElements([base]));
- }
- const degree = elem.children.find(el => el.type == dom_1.DomType.MmlDegree);
- return createElementNS(ns.mathML, "mroot", null, this.renderElements([base, degree]));
- }
- renderMmlDelimiter(elem) {
- var _a, _b;
- const children = [];
- children.push(createElementNS(ns.mathML, "mo", null, [(_a = elem.props.beginChar) !== null && _a !== void 0 ? _a : '(']));
- children.push(...this.renderElements(elem.children));
- children.push(createElementNS(ns.mathML, "mo", null, [(_b = elem.props.endChar) !== null && _b !== void 0 ? _b : ')']));
- return createElementNS(ns.mathML, "mrow", null, children);
- }
- renderMmlNary(elem) {
- var _a;
- const children = [];
- const grouped = (0, utils_1.keyBy)(elem.children, x => x.type);
- const sup = grouped[dom_1.DomType.MmlSuperArgument];
- const sub = grouped[dom_1.DomType.MmlSubArgument];
- const supElem = sup ? createElementNS(ns.mathML, "mo", null, (0, utils_1.asArray)(this.renderElement(sup))) : null;
- const subElem = sub ? createElementNS(ns.mathML, "mo", null, (0, utils_1.asArray)(this.renderElement(sub))) : null;
- if ((_a = elem.props) === null || _a === void 0 ? void 0 : _a.char) {
- const charElem = createElementNS(ns.mathML, "mo", null, [elem.props.char]);
- if (supElem || subElem) {
- children.push(createElementNS(ns.mathML, "munderover", null, [charElem, subElem, supElem]));
- }
- else if (supElem) {
- children.push(createElementNS(ns.mathML, "mover", null, [charElem, supElem]));
- }
- else if (subElem) {
- children.push(createElementNS(ns.mathML, "munder", null, [charElem, subElem]));
- }
- else {
- children.push(charElem);
- }
- }
- children.push(...this.renderElements(grouped[dom_1.DomType.MmlBase].children));
- return createElementNS(ns.mathML, "mrow", null, children);
- }
- renderMmlRun(elem) {
- const result = createElementNS(ns.mathML, "ms");
- this.renderClass(elem, result);
- this.renderStyleValues(elem.cssStyle, result);
- this.renderChildren(elem, result);
- return result;
- }
- renderStyleValues(style, ouput) {
- Object.assign(ouput.style, style);
- }
- renderClass(input, ouput) {
- if (input.className)
- ouput.className = input.className;
- if (input.styleName)
- ouput.classList.add(this.processStyleName(input.styleName));
- }
- findStyle(styleName) {
- var _a;
- return styleName && ((_a = this.styleMap) === null || _a === void 0 ? void 0 : _a[styleName]);
- }
- numberingClass(id, lvl) {
- return `${this.className}-num-${id}-${lvl}`;
- }
- tabStopClass() {
- return `${this.className}-tab-stop`;
- }
- styleToString(selectors, values, cssText = null) {
- let result = `${selectors} {\r\n`;
- for (const key in values) {
- result += ` ${key}: ${values[key]};\r\n`;
- }
- if (cssText)
- result += cssText;
- return result + "}\r\n";
- }
- numberingCounter(id, lvl) {
- return `${this.className}-num-${id}-${lvl}`;
- }
- levelTextToContent(text, suff, id, numformat) {
- var _a;
- const suffMap = {
- "tab": "\\9",
- "space": "\\a0",
- };
- var result = text.replace(/%\d*/g, s => {
- let lvl = parseInt(s.substring(1), 10) - 1;
- return `"counter(${this.numberingCounter(id, lvl)}, ${numformat})"`;
- });
- return `"${result}${(_a = suffMap[suff]) !== null && _a !== void 0 ? _a : ""}"`;
- }
- numFormatToCssValue(format) {
- var mapping = {
- "none": "none",
- "bullet": "disc",
- "decimal": "decimal",
- "lowerLetter": "lower-alpha",
- "upperLetter": "upper-alpha",
- "lowerRoman": "lower-roman",
- "upperRoman": "upper-roman",
- };
- return mapping[format] || format;
- }
- refreshTabStops() {
- if (!this.options.experimental)
- return;
- clearTimeout(this.tabsTimeout);
- this.tabsTimeout = setTimeout(() => {
- const pixelToPoint = (0, javascript_1.computePixelToPoint)();
- for (let tab of this.currentTabs) {
- (0, javascript_1.updateTabStop)(tab.span, tab.stops, this.defaultTabSize, pixelToPoint);
- }
- }, 500);
- }
- }
- exports.HtmlRenderer = HtmlRenderer;
- function createElement(tagName, props, children) {
- return createElementNS(undefined, tagName, props, children);
- }
- function createSvgElement(tagName, props, children) {
- return createElementNS(ns.svg, tagName, props, children);
- }
- function createElementNS(ns, tagName, props, children) {
- var result = ns ? document.createElementNS(ns, tagName) : document.createElement(tagName);
- Object.assign(result, props);
- children && appendChildren(result, children);
- return result;
- }
- function removeAllElements(elem) {
- elem.innerHTML = '';
- }
- function appendChildren(elem, children) {
- children.forEach(c => elem.appendChild((0, utils_1.isString)(c) ? document.createTextNode(c) : c));
- }
- function createStyleElement(cssText) {
- return createElement("style", { innerHTML: cssText });
- }
- function appendComment(elem, comment) {
- elem.appendChild(document.createComment(comment));
- }
- function findParent(elem, type) {
- var parent = elem.parent;
- while (parent != null && parent.type != type)
- parent = parent.parent;
- return parent;
- }
- /***/ }),
- /***/ "./src/javascript.ts":
- /*!***************************!*\
- !*** ./src/javascript.ts ***!
- \***************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.updateTabStop = exports.computePixelToPoint = void 0;
- const defaultTab = { pos: 0, leader: "none", style: "left" };
- const maxTabs = 50;
- function computePixelToPoint(container = document.body) {
- const temp = document.createElement("div");
- temp.style.width = '100pt';
- container.appendChild(temp);
- const result = 100 / temp.offsetWidth;
- container.removeChild(temp);
- return result;
- }
- exports.computePixelToPoint = computePixelToPoint;
- function updateTabStop(elem, tabs, defaultTabSize, pixelToPoint = 72 / 96) {
- const p = elem.closest("p");
- const ebb = elem.getBoundingClientRect();
- const pbb = p.getBoundingClientRect();
- const pcs = getComputedStyle(p);
- const tabStops = (tabs === null || tabs === void 0 ? void 0 : tabs.length) > 0 ? tabs.map(t => ({
- pos: lengthToPoint(t.position),
- leader: t.leader,
- style: t.style
- })).sort((a, b) => a.pos - b.pos) : [defaultTab];
- const lastTab = tabStops[tabStops.length - 1];
- const pWidthPt = pbb.width * pixelToPoint;
- const size = lengthToPoint(defaultTabSize);
- let pos = lastTab.pos + size;
- if (pos < pWidthPt) {
- for (; pos < pWidthPt && tabStops.length < maxTabs; pos += size) {
- tabStops.push(Object.assign(Object.assign({}, defaultTab), { pos: pos }));
- }
- }
- const marginLeft = parseFloat(pcs.marginLeft);
- const pOffset = pbb.left + marginLeft;
- const left = (ebb.left - pOffset) * pixelToPoint;
- const tab = tabStops.find(t => t.style != "clear" && t.pos > left);
- if (tab == null)
- return;
- let width = 1;
- if (tab.style == "right" || tab.style == "center") {
- const tabStops = Array.from(p.querySelectorAll(`.${elem.className}`));
- const nextIdx = tabStops.indexOf(elem) + 1;
- const range = document.createRange();
- range.setStart(elem, 1);
- if (nextIdx < tabStops.length) {
- range.setEndBefore(tabStops[nextIdx]);
- }
- else {
- range.setEndAfter(p);
- }
- const mul = tab.style == "center" ? 0.5 : 1;
- const nextBB = range.getBoundingClientRect();
- const offset = nextBB.left + mul * nextBB.width - (pbb.left - marginLeft);
- width = tab.pos - offset * pixelToPoint;
- }
- else {
- width = tab.pos - left;
- }
- elem.innerHTML = " ";
- elem.style.textDecoration = "inherit";
- elem.style.wordSpacing = `${width.toFixed(0)}pt`;
- switch (tab.leader) {
- case "dot":
- case "middleDot":
- elem.style.textDecoration = "underline";
- elem.style.textDecorationStyle = "dotted";
- break;
- case "hyphen":
- case "heavy":
- case "underscore":
- elem.style.textDecoration = "underline";
- break;
- }
- }
- exports.updateTabStop = updateTabStop;
- function lengthToPoint(length) {
- return parseFloat(length);
- }
- /***/ }),
- /***/ "./src/notes/elements.ts":
- /*!*******************************!*\
- !*** ./src/notes/elements.ts ***!
- \*******************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.WmlEndnote = exports.WmlFootnote = exports.WmlBaseNote = void 0;
- const dom_1 = __webpack_require__(/*! ../document/dom */ "./src/document/dom.ts");
- class WmlBaseNote {
- constructor() {
- this.children = [];
- this.cssStyle = {};
- }
- }
- exports.WmlBaseNote = WmlBaseNote;
- class WmlFootnote extends WmlBaseNote {
- constructor() {
- super(...arguments);
- this.type = dom_1.DomType.Footnote;
- }
- }
- exports.WmlFootnote = WmlFootnote;
- class WmlEndnote extends WmlBaseNote {
- constructor() {
- super(...arguments);
- this.type = dom_1.DomType.Endnote;
- }
- }
- exports.WmlEndnote = WmlEndnote;
- /***/ }),
- /***/ "./src/notes/parts.ts":
- /*!****************************!*\
- !*** ./src/notes/parts.ts ***!
- \****************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.EndnotesPart = exports.FootnotesPart = exports.BaseNotePart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const elements_1 = __webpack_require__(/*! ./elements */ "./src/notes/elements.ts");
- class BaseNotePart extends part_1.Part {
- constructor(pkg, path, parser) {
- super(pkg, path);
- this._documentParser = parser;
- }
- }
- exports.BaseNotePart = BaseNotePart;
- class FootnotesPart extends BaseNotePart {
- constructor(pkg, path, parser) {
- super(pkg, path, parser);
- }
- parseXml(root) {
- this.notes = this._documentParser.parseNotes(root, "footnote", elements_1.WmlFootnote);
- }
- }
- exports.FootnotesPart = FootnotesPart;
- class EndnotesPart extends BaseNotePart {
- constructor(pkg, path, parser) {
- super(pkg, path, parser);
- }
- parseXml(root) {
- this.notes = this._documentParser.parseNotes(root, "endnote", elements_1.WmlEndnote);
- }
- }
- exports.EndnotesPart = EndnotesPart;
- /***/ }),
- /***/ "./src/numbering/numbering-part.ts":
- /*!*****************************************!*\
- !*** ./src/numbering/numbering-part.ts ***!
- \*****************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.NumberingPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const numbering_1 = __webpack_require__(/*! ./numbering */ "./src/numbering/numbering.ts");
- class NumberingPart extends part_1.Part {
- constructor(pkg, path, parser) {
- super(pkg, path);
- this._documentParser = parser;
- }
- parseXml(root) {
- Object.assign(this, (0, numbering_1.parseNumberingPart)(root, this._package.xmlParser));
- this.domNumberings = this._documentParser.parseNumberingFile(root);
- }
- }
- exports.NumberingPart = NumberingPart;
- /***/ }),
- /***/ "./src/numbering/numbering.ts":
- /*!************************************!*\
- !*** ./src/numbering/numbering.ts ***!
- \************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseNumberingBulletPicture = exports.parseNumberingLevelOverrride = exports.parseNumberingLevel = exports.parseAbstractNumbering = exports.parseNumbering = exports.parseNumberingPart = void 0;
- const paragraph_1 = __webpack_require__(/*! ../document/paragraph */ "./src/document/paragraph.ts");
- const run_1 = __webpack_require__(/*! ../document/run */ "./src/document/run.ts");
- function parseNumberingPart(elem, xml) {
- let result = {
- numberings: [],
- abstractNumberings: [],
- bulletPictures: []
- };
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "num":
- result.numberings.push(parseNumbering(e, xml));
- break;
- case "abstractNum":
- result.abstractNumberings.push(parseAbstractNumbering(e, xml));
- break;
- case "numPicBullet":
- result.bulletPictures.push(parseNumberingBulletPicture(e, xml));
- break;
- }
- }
- return result;
- }
- exports.parseNumberingPart = parseNumberingPart;
- function parseNumbering(elem, xml) {
- let result = {
- id: xml.attr(elem, 'numId'),
- overrides: []
- };
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "abstractNumId":
- result.abstractId = xml.attr(e, "val");
- break;
- case "lvlOverride":
- result.overrides.push(parseNumberingLevelOverrride(e, xml));
- break;
- }
- }
- return result;
- }
- exports.parseNumbering = parseNumbering;
- function parseAbstractNumbering(elem, xml) {
- let result = {
- id: xml.attr(elem, 'abstractNumId'),
- levels: []
- };
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "name":
- result.name = xml.attr(e, "val");
- break;
- case "multiLevelType":
- result.multiLevelType = xml.attr(e, "val");
- break;
- case "numStyleLink":
- result.numberingStyleLink = xml.attr(e, "val");
- break;
- case "styleLink":
- result.styleLink = xml.attr(e, "val");
- break;
- case "lvl":
- result.levels.push(parseNumberingLevel(e, xml));
- break;
- }
- }
- return result;
- }
- exports.parseAbstractNumbering = parseAbstractNumbering;
- function parseNumberingLevel(elem, xml) {
- let result = {
- level: xml.intAttr(elem, 'ilvl')
- };
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "start":
- result.start = xml.attr(e, "val");
- break;
- case "lvlRestart":
- result.restart = xml.intAttr(e, "val");
- break;
- case "numFmt":
- result.format = xml.attr(e, "val");
- break;
- case "lvlText":
- result.text = xml.attr(e, "val");
- break;
- case "lvlJc":
- result.justification = xml.attr(e, "val");
- break;
- case "lvlPicBulletId":
- result.bulletPictureId = xml.attr(e, "val");
- break;
- case "pStyle":
- result.paragraphStyle = xml.attr(e, "val");
- break;
- case "pPr":
- result.paragraphProps = (0, paragraph_1.parseParagraphProperties)(e, xml);
- break;
- case "rPr":
- result.runProps = (0, run_1.parseRunProperties)(e, xml);
- break;
- }
- }
- return result;
- }
- exports.parseNumberingLevel = parseNumberingLevel;
- function parseNumberingLevelOverrride(elem, xml) {
- let result = {
- level: xml.intAttr(elem, 'ilvl')
- };
- for (let e of xml.elements(elem)) {
- switch (e.localName) {
- case "startOverride":
- result.start = xml.intAttr(e, "val");
- break;
- case "lvl":
- result.numberingLevel = parseNumberingLevel(e, xml);
- break;
- }
- }
- return result;
- }
- exports.parseNumberingLevelOverrride = parseNumberingLevelOverrride;
- function parseNumberingBulletPicture(elem, xml) {
- var pict = xml.element(elem, "pict");
- var shape = pict && xml.element(pict, "shape");
- var imagedata = shape && xml.element(shape, "imagedata");
- return imagedata ? {
- id: xml.attr(elem, "numPicBulletId"),
- referenceId: xml.attr(imagedata, "id"),
- style: xml.attr(shape, "style")
- } : null;
- }
- exports.parseNumberingBulletPicture = parseNumberingBulletPicture;
- /***/ }),
- /***/ "./src/parser/xml-parser.ts":
- /*!**********************************!*\
- !*** ./src/parser/xml-parser.ts ***!
- \**********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.XmlParser = exports.serializeXmlString = exports.parseXmlString = void 0;
- const common_1 = __webpack_require__(/*! ../document/common */ "./src/document/common.ts");
- function parseXmlString(xmlString, trimXmlDeclaration = false) {
- if (trimXmlDeclaration)
- xmlString = xmlString.replace(/<[?].*[?]>/, "");
- const result = new DOMParser().parseFromString(xmlString, "application/xml");
- const errorText = hasXmlParserError(result);
- if (errorText)
- throw new Error(errorText);
- return result;
- }
- exports.parseXmlString = parseXmlString;
- function hasXmlParserError(doc) {
- var _a;
- return (_a = doc.getElementsByTagName("parsererror")[0]) === null || _a === void 0 ? void 0 : _a.textContent;
- }
- function serializeXmlString(elem) {
- return new XMLSerializer().serializeToString(elem);
- }
- exports.serializeXmlString = serializeXmlString;
- class XmlParser {
- elements(elem, localName = null) {
- const result = [];
- for (let i = 0, l = elem.childNodes.length; i < l; i++) {
- let c = elem.childNodes.item(i);
- if (c.nodeType == 1 && (localName == null || c.localName == localName))
- result.push(c);
- }
- return result;
- }
- element(elem, localName) {
- for (let i = 0, l = elem.childNodes.length; i < l; i++) {
- let c = elem.childNodes.item(i);
- if (c.nodeType == 1 && c.localName == localName)
- return c;
- }
- return null;
- }
- elementAttr(elem, localName, attrLocalName) {
- var el = this.element(elem, localName);
- return el ? this.attr(el, attrLocalName) : undefined;
- }
- attrs(elem) {
- return Array.from(elem.attributes);
- }
- attr(elem, localName) {
- for (let i = 0, l = elem.attributes.length; i < l; i++) {
- let a = elem.attributes.item(i);
- if (a.localName == localName)
- return a.value;
- }
- return null;
- }
- intAttr(node, attrName, defaultValue = null) {
- var val = this.attr(node, attrName);
- return val ? parseInt(val) : defaultValue;
- }
- hexAttr(node, attrName, defaultValue = null) {
- var val = this.attr(node, attrName);
- return val ? parseInt(val, 16) : defaultValue;
- }
- floatAttr(node, attrName, defaultValue = null) {
- var val = this.attr(node, attrName);
- return val ? parseFloat(val) : defaultValue;
- }
- boolAttr(node, attrName, defaultValue = null) {
- return (0, common_1.convertBoolean)(this.attr(node, attrName), defaultValue);
- }
- lengthAttr(node, attrName, usage = common_1.LengthUsage.Dxa) {
- return (0, common_1.convertLength)(this.attr(node, attrName), usage);
- }
- }
- exports.XmlParser = XmlParser;
- const globalXmlParser = new XmlParser();
- exports["default"] = globalXmlParser;
- /***/ }),
- /***/ "./src/settings/settings-part.ts":
- /*!***************************************!*\
- !*** ./src/settings/settings-part.ts ***!
- \***************************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.SettingsPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const settings_1 = __webpack_require__(/*! ./settings */ "./src/settings/settings.ts");
- class SettingsPart extends part_1.Part {
- constructor(pkg, path) {
- super(pkg, path);
- }
- parseXml(root) {
- this.settings = (0, settings_1.parseSettings)(root, this._package.xmlParser);
- }
- }
- exports.SettingsPart = SettingsPart;
- /***/ }),
- /***/ "./src/settings/settings.ts":
- /*!**********************************!*\
- !*** ./src/settings/settings.ts ***!
- \**********************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseNoteProperties = exports.parseSettings = void 0;
- function parseSettings(elem, xml) {
- var result = {};
- for (let el of xml.elements(elem)) {
- switch (el.localName) {
- case "defaultTabStop":
- result.defaultTabStop = xml.lengthAttr(el, "val");
- break;
- case "footnotePr":
- result.footnoteProps = parseNoteProperties(el, xml);
- break;
- case "endnotePr":
- result.endnoteProps = parseNoteProperties(el, xml);
- break;
- case "autoHyphenation":
- result.autoHyphenation = xml.boolAttr(el, "val");
- break;
- }
- }
- return result;
- }
- exports.parseSettings = parseSettings;
- function parseNoteProperties(elem, xml) {
- var result = {
- defaultNoteIds: []
- };
- for (let el of xml.elements(elem)) {
- switch (el.localName) {
- case "numFmt":
- result.nummeringFormat = xml.attr(el, "val");
- break;
- case "footnote":
- case "endnote":
- result.defaultNoteIds.push(xml.attr(el, "id"));
- break;
- }
- }
- return result;
- }
- exports.parseNoteProperties = parseNoteProperties;
- /***/ }),
- /***/ "./src/styles/styles-part.ts":
- /*!***********************************!*\
- !*** ./src/styles/styles-part.ts ***!
- \***********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.StylesPart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- class StylesPart extends part_1.Part {
- constructor(pkg, path, parser) {
- super(pkg, path);
- this._documentParser = parser;
- }
- parseXml(root) {
- this.styles = this._documentParser.parseStylesFile(root);
- }
- }
- exports.StylesPart = StylesPart;
- /***/ }),
- /***/ "./src/theme/theme-part.ts":
- /*!*********************************!*\
- !*** ./src/theme/theme-part.ts ***!
- \*********************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.ThemePart = void 0;
- const part_1 = __webpack_require__(/*! ../common/part */ "./src/common/part.ts");
- const theme_1 = __webpack_require__(/*! ./theme */ "./src/theme/theme.ts");
- class ThemePart extends part_1.Part {
- constructor(pkg, path) {
- super(pkg, path);
- }
- parseXml(root) {
- this.theme = (0, theme_1.parseTheme)(root, this._package.xmlParser);
- }
- }
- exports.ThemePart = ThemePart;
- /***/ }),
- /***/ "./src/theme/theme.ts":
- /*!****************************!*\
- !*** ./src/theme/theme.ts ***!
- \****************************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseFontInfo = exports.parseFontScheme = exports.parseColorScheme = exports.parseTheme = exports.DmlTheme = void 0;
- class DmlTheme {
- }
- exports.DmlTheme = DmlTheme;
- function parseTheme(elem, xml) {
- var result = new DmlTheme();
- var themeElements = xml.element(elem, "themeElements");
- for (let el of xml.elements(themeElements)) {
- switch (el.localName) {
- case "clrScheme":
- result.colorScheme = parseColorScheme(el, xml);
- break;
- case "fontScheme":
- result.fontScheme = parseFontScheme(el, xml);
- break;
- }
- }
- return result;
- }
- exports.parseTheme = parseTheme;
- function parseColorScheme(elem, xml) {
- var result = {
- name: xml.attr(elem, "name"),
- colors: {}
- };
- for (let el of xml.elements(elem)) {
- var srgbClr = xml.element(el, "srgbClr");
- var sysClr = xml.element(el, "sysClr");
- if (srgbClr) {
- result.colors[el.localName] = xml.attr(srgbClr, "val");
- }
- else if (sysClr) {
- result.colors[el.localName] = xml.attr(sysClr, "lastClr");
- }
- }
- return result;
- }
- exports.parseColorScheme = parseColorScheme;
- function parseFontScheme(elem, xml) {
- var result = {
- name: xml.attr(elem, "name"),
- };
- for (let el of xml.elements(elem)) {
- switch (el.localName) {
- case "majorFont":
- result.majorFont = parseFontInfo(el, xml);
- break;
- case "minorFont":
- result.minorFont = parseFontInfo(el, xml);
- break;
- }
- }
- return result;
- }
- exports.parseFontScheme = parseFontScheme;
- function parseFontInfo(elem, xml) {
- return {
- latinTypeface: xml.elementAttr(elem, "latin", "typeface"),
- eaTypeface: xml.elementAttr(elem, "ea", "typeface"),
- csTypeface: xml.elementAttr(elem, "cs", "typeface"),
- };
- }
- exports.parseFontInfo = parseFontInfo;
- /***/ }),
- /***/ "./src/utils.ts":
- /*!**********************!*\
- !*** ./src/utils.ts ***!
- \**********************/
- /***/ ((__unused_webpack_module, exports) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.asArray = exports.formatCssRules = exports.parseCssRules = exports.mergeDeep = exports.isString = exports.isObject = exports.blobToBase64 = exports.keyBy = exports.resolvePath = exports.splitPath = exports.escapeClassName = void 0;
- function escapeClassName(className) {
- return className === null || className === void 0 ? void 0 : className.replace(/[ .]+/g, '-').replace(/[&]+/g, 'and').toLowerCase();
- }
- exports.escapeClassName = escapeClassName;
- function splitPath(path) {
- let si = path.lastIndexOf('/') + 1;
- let folder = si == 0 ? "" : path.substring(0, si);
- let fileName = si == 0 ? path : path.substring(si);
- return [folder, fileName];
- }
- exports.splitPath = splitPath;
- function resolvePath(path, base) {
- try {
- const prefix = "http://docx/";
- const url = new URL(path, prefix + base).toString();
- return url.substring(prefix.length);
- }
- catch (_a) {
- return `${base}${path}`;
- }
- }
- exports.resolvePath = resolvePath;
- function keyBy(array, by) {
- return array.reduce((a, x) => {
- a[by(x)] = x;
- return a;
- }, {});
- }
- exports.keyBy = keyBy;
- function blobToBase64(blob) {
- return new Promise((resolve, _) => {
- const reader = new FileReader();
- reader.onloadend = () => resolve(reader.result);
- reader.readAsDataURL(blob);
- });
- }
- exports.blobToBase64 = blobToBase64;
- function isObject(item) {
- return item && typeof item === 'object' && !Array.isArray(item);
- }
- exports.isObject = isObject;
- function isString(item) {
- return item && typeof item === 'string' || item instanceof String;
- }
- exports.isString = isString;
- function mergeDeep(target, ...sources) {
- var _a;
- if (!sources.length)
- return target;
- const source = sources.shift();
- if (isObject(target) && isObject(source)) {
- for (const key in source) {
- if (isObject(source[key])) {
- const val = (_a = target[key]) !== null && _a !== void 0 ? _a : (target[key] = {});
- mergeDeep(val, source[key]);
- }
- else {
- target[key] = source[key];
- }
- }
- }
- return mergeDeep(target, ...sources);
- }
- exports.mergeDeep = mergeDeep;
- function parseCssRules(text) {
- const result = {};
- for (const rule of text.split(';')) {
- const [key, val] = rule.split(':');
- result[key] = val;
- }
- return result;
- }
- exports.parseCssRules = parseCssRules;
- function formatCssRules(style) {
- return Object.entries(style).map((k, v) => `${k}: ${v}`).join(';');
- }
- exports.formatCssRules = formatCssRules;
- function asArray(val) {
- return Array.isArray(val) ? val : [val];
- }
- exports.asArray = asArray;
- /***/ }),
- /***/ "./src/vml/vml.ts":
- /*!************************!*\
- !*** ./src/vml/vml.ts ***!
- \************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.parseVmlElement = exports.VmlElement = void 0;
- const common_1 = __webpack_require__(/*! ../document/common */ "./src/document/common.ts");
- const dom_1 = __webpack_require__(/*! ../document/dom */ "./src/document/dom.ts");
- const xml_parser_1 = __webpack_require__(/*! ../parser/xml-parser */ "./src/parser/xml-parser.ts");
- class VmlElement {
- constructor() {
- this.type = dom_1.DomType.VmlElement;
- this.attrs = {};
- this.chidren = [];
- }
- }
- exports.VmlElement = VmlElement;
- function parseVmlElement(elem) {
- var result = new VmlElement();
- switch (elem.localName) {
- case "rect":
- result.tagName = "rect";
- Object.assign(result.attrs, { width: '100%', height: '100%' });
- break;
- case "oval":
- result.tagName = "ellipse";
- Object.assign(result.attrs, { cx: "50%", cy: "50%", rx: "50%", ry: "50%" });
- break;
- case "line":
- result.tagName = "line";
- break;
- case "shape":
- result.tagName = "g";
- break;
- default:
- return null;
- }
- for (const at of xml_parser_1.default.attrs(elem)) {
- switch (at.localName) {
- case "style":
- result.cssStyleText = at.value;
- break;
- case "fillcolor":
- result.attrs.fill = at.value;
- break;
- case "from":
- const [x1, y1] = parsePoint(at.value);
- Object.assign(result.attrs, { x1, y1 });
- break;
- case "to":
- const [x2, y2] = parsePoint(at.value);
- Object.assign(result.attrs, { x2, y2 });
- break;
- }
- }
- for (const el of xml_parser_1.default.elements(elem)) {
- switch (el.localName) {
- case "stroke":
- Object.assign(result.attrs, parseStroke(el));
- break;
- case "fill":
- Object.assign(result.attrs, parseFill(el));
- break;
- case "imagedata":
- result.tagName = "image";
- Object.assign(result.attrs, { width: '100%', height: '100%' });
- result.imageHref = {
- id: xml_parser_1.default.attr(el, "id"),
- title: xml_parser_1.default.attr(el, "title"),
- };
- break;
- default:
- const child = parseVmlElement(el);
- child && result.chidren.push(child);
- break;
- }
- }
- return result;
- }
- exports.parseVmlElement = parseVmlElement;
- function parseStroke(el) {
- var _a;
- return {
- 'stroke': xml_parser_1.default.attr(el, "color"),
- 'stroke-width': (_a = xml_parser_1.default.lengthAttr(el, "weight", common_1.LengthUsage.Emu)) !== null && _a !== void 0 ? _a : '1px'
- };
- }
- function parseFill(el) {
- return {};
- }
- function parsePoint(val) {
- return val.split(",");
- }
- function convertPath(path) {
- return path.replace(/([mlxe])|([-\d]+)|([,])/g, (m) => {
- if (/[-\d]/.test(m))
- return (0, common_1.convertLength)(m, common_1.LengthUsage.VmlEmu);
- if (/[ml,]/.test(m))
- return m;
- return '';
- });
- }
- /***/ }),
- /***/ "./src/word-document.ts":
- /*!******************************!*\
- !*** ./src/word-document.ts ***!
- \******************************/
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
- Object.defineProperty(exports, "__esModule", ({ value: true }));
- exports.deobfuscate = exports.WordDocument = void 0;
- const relationship_1 = __webpack_require__(/*! ./common/relationship */ "./src/common/relationship.ts");
- const font_table_1 = __webpack_require__(/*! ./font-table/font-table */ "./src/font-table/font-table.ts");
- const open_xml_package_1 = __webpack_require__(/*! ./common/open-xml-package */ "./src/common/open-xml-package.ts");
- const document_part_1 = __webpack_require__(/*! ./document/document-part */ "./src/document/document-part.ts");
- const utils_1 = __webpack_require__(/*! ./utils */ "./src/utils.ts");
- const numbering_part_1 = __webpack_require__(/*! ./numbering/numbering-part */ "./src/numbering/numbering-part.ts");
- const styles_part_1 = __webpack_require__(/*! ./styles/styles-part */ "./src/styles/styles-part.ts");
- const parts_1 = __webpack_require__(/*! ./header-footer/parts */ "./src/header-footer/parts.ts");
- const extended_props_part_1 = __webpack_require__(/*! ./document-props/extended-props-part */ "./src/document-props/extended-props-part.ts");
- const core_props_part_1 = __webpack_require__(/*! ./document-props/core-props-part */ "./src/document-props/core-props-part.ts");
- const theme_part_1 = __webpack_require__(/*! ./theme/theme-part */ "./src/theme/theme-part.ts");
- const parts_2 = __webpack_require__(/*! ./notes/parts */ "./src/notes/parts.ts");
- const settings_part_1 = __webpack_require__(/*! ./settings/settings-part */ "./src/settings/settings-part.ts");
- const custom_props_part_1 = __webpack_require__(/*! ./document-props/custom-props-part */ "./src/document-props/custom-props-part.ts");
- const topLevelRels = [
- { type: relationship_1.RelationshipTypes.OfficeDocument, target: "word/document.xml" },
- { type: relationship_1.RelationshipTypes.ExtendedProperties, target: "docProps/app.xml" },
- { type: relationship_1.RelationshipTypes.CoreProperties, target: "docProps/core.xml" },
- { type: relationship_1.RelationshipTypes.CustomProperties, target: "docProps/custom.xml" },
- ];
- class WordDocument {
- constructor() {
- this.parts = [];
- this.partsMap = {};
- }
- static load(blob, parser, options) {
- var d = new WordDocument();
- d._options = options;
- d._parser = parser;
- return open_xml_package_1.OpenXmlPackage.load(blob, options)
- .then(pkg => {
- d._package = pkg;
- return d._package.loadRelationships();
- }).then(rels => {
- d.rels = rels;
- const tasks = topLevelRels.map(rel => {
- var _a;
- const r = (_a = rels.find(x => x.type === rel.type)) !== null && _a !== void 0 ? _a : rel;
- return d.loadRelationshipPart(r.target, r.type);
- });
- return Promise.all(tasks);
- }).then(() => d);
- }
- save(type = "blob") {
- return this._package.save(type);
- }
- loadRelationshipPart(path, type) {
- if (this.partsMap[path])
- return Promise.resolve(this.partsMap[path]);
- if (!this._package.get(path))
- return Promise.resolve(null);
- let part = null;
- switch (type) {
- case relationship_1.RelationshipTypes.OfficeDocument:
- this.documentPart = part = new document_part_1.DocumentPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.FontTable:
- this.fontTablePart = part = new font_table_1.FontTablePart(this._package, path);
- break;
- case relationship_1.RelationshipTypes.Numbering:
- this.numberingPart = part = new numbering_part_1.NumberingPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.Styles:
- this.stylesPart = part = new styles_part_1.StylesPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.Theme:
- this.themePart = part = new theme_part_1.ThemePart(this._package, path);
- break;
- case relationship_1.RelationshipTypes.Footnotes:
- this.footnotesPart = part = new parts_2.FootnotesPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.Endnotes:
- this.endnotesPart = part = new parts_2.EndnotesPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.Footer:
- part = new parts_1.FooterPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.Header:
- part = new parts_1.HeaderPart(this._package, path, this._parser);
- break;
- case relationship_1.RelationshipTypes.CoreProperties:
- this.corePropsPart = part = new core_props_part_1.CorePropsPart(this._package, path);
- break;
- case relationship_1.RelationshipTypes.ExtendedProperties:
- this.extendedPropsPart = part = new extended_props_part_1.ExtendedPropsPart(this._package, path);
- break;
- case relationship_1.RelationshipTypes.CustomProperties:
- part = new custom_props_part_1.CustomPropsPart(this._package, path);
- break;
- case relationship_1.RelationshipTypes.Settings:
- this.settingsPart = part = new settings_part_1.SettingsPart(this._package, path);
- break;
- }
- if (part == null)
- return Promise.resolve(null);
- this.partsMap[path] = part;
- this.parts.push(part);
- return part.load().then(() => {
- if (part.rels == null || part.rels.length == 0)
- return part;
- const [folder] = (0, utils_1.splitPath)(part.path);
- const rels = part.rels.map(rel => {
- return this.loadRelationshipPart((0, utils_1.resolvePath)(rel.target, folder), rel.type);
- });
- return Promise.all(rels).then(() => part);
- });
- }
- loadDocumentImage(id, part) {
- return this.loadResource(part !== null && part !== void 0 ? part : this.documentPart, id, "blob")
- .then(x => this.blobToURL(x));
- }
- loadNumberingImage(id) {
- return this.loadResource(this.numberingPart, id, "blob")
- .then(x => this.blobToURL(x));
- }
- loadFont(id, key) {
- return this.loadResource(this.fontTablePart, id, "uint8array")
- .then(x => x ? this.blobToURL(new Blob([deobfuscate(x, key)])) : x);
- }
- blobToURL(blob) {
- if (!blob)
- return null;
- if (this._options.useBase64URL) {
- return (0, utils_1.blobToBase64)(blob);
- }
- return URL.createObjectURL(blob);
- }
- findPartByRelId(id, basePart = null) {
- var _a;
- var rel = ((_a = basePart.rels) !== null && _a !== void 0 ? _a : this.rels).find(r => r.id == id);
- const folder = basePart ? (0, utils_1.splitPath)(basePart.path)[0] : '';
- return rel ? this.partsMap[(0, utils_1.resolvePath)(rel.target, folder)] : null;
- }
- getPathById(part, id) {
- const rel = part.rels.find(x => x.id == id);
- const [folder] = (0, utils_1.splitPath)(part.path);
- return rel ? (0, utils_1.resolvePath)(rel.target, folder) : null;
- }
- loadResource(part, id, outputType) {
- const path = this.getPathById(part, id);
- return path ? this._package.load(path, outputType) : Promise.resolve(null);
- }
- }
- exports.WordDocument = WordDocument;
- function deobfuscate(data, guidKey) {
- const len = 16;
- const trimmed = guidKey.replace(/{|}|-/g, "");
- const numbers = new Array(len);
- for (let i = 0; i < len; i++)
- numbers[len - i - 1] = parseInt(trimmed.substr(i * 2, 2), 16);
- for (let i = 0; i < 32; i++)
- data[i] = data[i] ^ numbers[i % len];
- return data;
- }
- exports.deobfuscate = deobfuscate;
- /***/ }),
- /***/ "data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 100%27 preserveAspectRatio=%27none%27%3E%3Cpath d=%27m0,75 l5,0 l5,25 l10,-100%27 stroke=%27black%27 fill=%27none%27 vector-effect=%27non-scaling-stroke%27/%3E%3C/svg%3E":
- /*!********************************************************************************************************************************************************************************************************************************************************************!*\
- !*** data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 100%27 preserveAspectRatio=%27none%27%3E%3Cpath d=%27m0,75 l5,0 l5,25 l10,-100%27 stroke=%27black%27 fill=%27none%27 vector-effect=%27non-scaling-stroke%27/%3E%3C/svg%3E ***!
- \********************************************************************************************************************************************************************************************************************************************************************/
- /***/ ((module) => {
- module.exports = "data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 viewBox=%270 0 20 100%27 preserveAspectRatio=%27none%27%3E%3Cpath d=%27m0,75 l5,0 l5,25 l10,-100%27 stroke=%27black%27 fill=%27none%27 vector-effect=%27non-scaling-stroke%27/%3E%3C/svg%3E";
- /***/ }),
- /***/ "jszip":
- /*!**************************************************************************************!*\
- !*** external {"root":"JSZip","commonjs":"jszip","commonjs2":"jszip","amd":"jszip"} ***!
- \**************************************************************************************/
- /***/ ((module) => {
- module.exports = __WEBPACK_EXTERNAL_MODULE_jszip__;
- /***/ })
- /******/ });
- /************************************************************************/
- /******/ // The module cache
- /******/ var __webpack_module_cache__ = {};
- /******/
- /******/ // The require function
- /******/ function __webpack_require__(moduleId) {
- /******/ // Check if module is in cache
- /******/ var cachedModule = __webpack_module_cache__[moduleId];
- /******/ if (cachedModule !== undefined) {
- /******/ return cachedModule.exports;
- /******/ }
- /******/ // Create a new module (and put it into the cache)
- /******/ var module = __webpack_module_cache__[moduleId] = {
- /******/ id: moduleId,
- /******/ // no module.loaded needed
- /******/ exports: {}
- /******/ };
- /******/
- /******/ // Execute the module function
- /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
- /******/
- /******/ // Return the exports of the module
- /******/ return module.exports;
- /******/ }
- /******/
- /******/ // expose the modules object (__webpack_modules__)
- /******/ __webpack_require__.m = __webpack_modules__;
- /******/
- /************************************************************************/
- /******/ /* webpack/runtime/compat get default export */
- /******/ (() => {
- /******/ // getDefaultExport function for compatibility with non-harmony modules
- /******/ __webpack_require__.n = (module) => {
- /******/ var getter = module && module.__esModule ?
- /******/ () => (module['default']) :
- /******/ () => (module);
- /******/ __webpack_require__.d(getter, { a: getter });
- /******/ return getter;
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/define property getters */
- /******/ (() => {
- /******/ // define getter functions for harmony exports
- /******/ __webpack_require__.d = (exports, definition) => {
- /******/ for(var key in definition) {
- /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
- /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
- /******/ }
- /******/ }
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/hasOwnProperty shorthand */
- /******/ (() => {
- /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
- /******/ })();
- /******/
- /******/ /* webpack/runtime/make namespace object */
- /******/ (() => {
- /******/ // define __esModule on exports
- /******/ __webpack_require__.r = (exports) => {
- /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
- /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
- /******/ }
- /******/ Object.defineProperty(exports, '__esModule', { value: true });
- /******/ };
- /******/ })();
- /******/
- /******/ /* webpack/runtime/jsonp chunk loading */
- /******/ (() => {
- /******/ __webpack_require__.b = document.baseURI || self.location.href;
- /******/
- /******/ // object to store loaded and loading chunks
- /******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
- /******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
- /******/ var installedChunks = {
- /******/ "docx-preview": 0
- /******/ };
- /******/
- /******/ // no chunk on demand loading
- /******/
- /******/ // no prefetching
- /******/
- /******/ // no preloaded
- /******/
- /******/ // no HMR
- /******/
- /******/ // no HMR manifest
- /******/
- /******/ // no on chunks loaded
- /******/
- /******/ // no jsonp function
- /******/ })();
- /******/
- /************************************************************************/
- /******/
- /******/ // startup
- /******/ // Load entry module and return exports
- /******/ // This entry module is referenced by other modules so it can't be inlined
- /******/ var __webpack_exports__ = __webpack_require__("./src/docx-preview.ts");
- /******/
- /******/ return __webpack_exports__;
- /******/ })()
- ;
- });
- //# sourceMappingURL=docx-preview.js.map
|