pdf.worker.mjs 2.1 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2024 Mozilla Foundation
  6. *
  7. * Licensed under the Apache License, Version 2.0 (the "License");
  8. * you may not use this file except in compliance with the License.
  9. * You may obtain a copy of the License at
  10. *
  11. * http://www.apache.org/licenses/LICENSE-2.0
  12. *
  13. * Unless required by applicable law or agreed to in writing, software
  14. * distributed under the License is distributed on an "AS IS" BASIS,
  15. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  16. * See the License for the specific language governing permissions and
  17. * limitations under the License.
  18. *
  19. * @licend The above is the entire license notice for the
  20. * JavaScript code in this page
  21. */
  22. /******/ // The require scope
  23. /******/ var __webpack_require__ = {};
  24. /******/
  25. /************************************************************************/
  26. /******/ /* webpack/runtime/define property getters */
  27. /******/ (() => {
  28. /******/ // define getter functions for harmony exports
  29. /******/ __webpack_require__.d = (exports, definition) => {
  30. /******/ for(var key in definition) {
  31. /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
  32. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  33. /******/ }
  34. /******/ }
  35. /******/ };
  36. /******/ })();
  37. /******/
  38. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  39. /******/ (() => {
  40. /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  41. /******/ })();
  42. /******/
  43. /************************************************************************/
  44. var __webpack_exports__ = globalThis.pdfjsWorker = {};
  45. // EXPORTS
  46. __webpack_require__.d(__webpack_exports__, {
  47. WorkerMessageHandler: () => (/* reexport */ WorkerMessageHandler)
  48. });
  49. ;// ./src/shared/util.js
  50. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  51. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  52. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  53. const MAX_IMAGE_SIZE_TO_CACHE = 10e6;
  54. const LINE_FACTOR = 1.35;
  55. const LINE_DESCENT_FACTOR = 0.35;
  56. const BASELINE_FACTOR = LINE_DESCENT_FACTOR / LINE_FACTOR;
  57. const RenderingIntentFlag = {
  58. ANY: 0x01,
  59. DISPLAY: 0x02,
  60. PRINT: 0x04,
  61. SAVE: 0x08,
  62. ANNOTATIONS_FORMS: 0x10,
  63. ANNOTATIONS_STORAGE: 0x20,
  64. ANNOTATIONS_DISABLE: 0x40,
  65. IS_EDITING: 0x80,
  66. OPLIST: 0x100
  67. };
  68. const AnnotationMode = {
  69. DISABLE: 0,
  70. ENABLE: 1,
  71. ENABLE_FORMS: 2,
  72. ENABLE_STORAGE: 3
  73. };
  74. const AnnotationEditorPrefix = "pdfjs_internal_editor_";
  75. const AnnotationEditorType = {
  76. DISABLE: -1,
  77. NONE: 0,
  78. FREETEXT: 3,
  79. HIGHLIGHT: 9,
  80. STAMP: 13,
  81. INK: 15
  82. };
  83. const AnnotationEditorParamsType = {
  84. RESIZE: 1,
  85. CREATE: 2,
  86. FREETEXT_SIZE: 11,
  87. FREETEXT_COLOR: 12,
  88. FREETEXT_OPACITY: 13,
  89. INK_COLOR: 21,
  90. INK_THICKNESS: 22,
  91. INK_OPACITY: 23,
  92. HIGHLIGHT_COLOR: 31,
  93. HIGHLIGHT_DEFAULT_COLOR: 32,
  94. HIGHLIGHT_THICKNESS: 33,
  95. HIGHLIGHT_FREE: 34,
  96. HIGHLIGHT_SHOW_ALL: 35,
  97. DRAW_STEP: 41
  98. };
  99. const PermissionFlag = {
  100. PRINT: 0x04,
  101. MODIFY_CONTENTS: 0x08,
  102. COPY: 0x10,
  103. MODIFY_ANNOTATIONS: 0x20,
  104. FILL_INTERACTIVE_FORMS: 0x100,
  105. COPY_FOR_ACCESSIBILITY: 0x200,
  106. ASSEMBLE: 0x400,
  107. PRINT_HIGH_QUALITY: 0x800
  108. };
  109. const TextRenderingMode = {
  110. FILL: 0,
  111. STROKE: 1,
  112. FILL_STROKE: 2,
  113. INVISIBLE: 3,
  114. FILL_ADD_TO_PATH: 4,
  115. STROKE_ADD_TO_PATH: 5,
  116. FILL_STROKE_ADD_TO_PATH: 6,
  117. ADD_TO_PATH: 7,
  118. FILL_STROKE_MASK: 3,
  119. ADD_TO_PATH_FLAG: 4
  120. };
  121. const ImageKind = {
  122. GRAYSCALE_1BPP: 1,
  123. RGB_24BPP: 2,
  124. RGBA_32BPP: 3
  125. };
  126. const AnnotationType = {
  127. TEXT: 1,
  128. LINK: 2,
  129. FREETEXT: 3,
  130. LINE: 4,
  131. SQUARE: 5,
  132. CIRCLE: 6,
  133. POLYGON: 7,
  134. POLYLINE: 8,
  135. HIGHLIGHT: 9,
  136. UNDERLINE: 10,
  137. SQUIGGLY: 11,
  138. STRIKEOUT: 12,
  139. STAMP: 13,
  140. CARET: 14,
  141. INK: 15,
  142. POPUP: 16,
  143. FILEATTACHMENT: 17,
  144. SOUND: 18,
  145. MOVIE: 19,
  146. WIDGET: 20,
  147. SCREEN: 21,
  148. PRINTERMARK: 22,
  149. TRAPNET: 23,
  150. WATERMARK: 24,
  151. THREED: 25,
  152. REDACT: 26
  153. };
  154. const AnnotationReplyType = {
  155. GROUP: "Group",
  156. REPLY: "R"
  157. };
  158. const AnnotationFlag = {
  159. INVISIBLE: 0x01,
  160. HIDDEN: 0x02,
  161. PRINT: 0x04,
  162. NOZOOM: 0x08,
  163. NOROTATE: 0x10,
  164. NOVIEW: 0x20,
  165. READONLY: 0x40,
  166. LOCKED: 0x80,
  167. TOGGLENOVIEW: 0x100,
  168. LOCKEDCONTENTS: 0x200
  169. };
  170. const AnnotationFieldFlag = {
  171. READONLY: 0x0000001,
  172. REQUIRED: 0x0000002,
  173. NOEXPORT: 0x0000004,
  174. MULTILINE: 0x0001000,
  175. PASSWORD: 0x0002000,
  176. NOTOGGLETOOFF: 0x0004000,
  177. RADIO: 0x0008000,
  178. PUSHBUTTON: 0x0010000,
  179. COMBO: 0x0020000,
  180. EDIT: 0x0040000,
  181. SORT: 0x0080000,
  182. FILESELECT: 0x0100000,
  183. MULTISELECT: 0x0200000,
  184. DONOTSPELLCHECK: 0x0400000,
  185. DONOTSCROLL: 0x0800000,
  186. COMB: 0x1000000,
  187. RICHTEXT: 0x2000000,
  188. RADIOSINUNISON: 0x2000000,
  189. COMMITONSELCHANGE: 0x4000000
  190. };
  191. const AnnotationBorderStyleType = {
  192. SOLID: 1,
  193. DASHED: 2,
  194. BEVELED: 3,
  195. INSET: 4,
  196. UNDERLINE: 5
  197. };
  198. const AnnotationActionEventType = {
  199. E: "Mouse Enter",
  200. X: "Mouse Exit",
  201. D: "Mouse Down",
  202. U: "Mouse Up",
  203. Fo: "Focus",
  204. Bl: "Blur",
  205. PO: "PageOpen",
  206. PC: "PageClose",
  207. PV: "PageVisible",
  208. PI: "PageInvisible",
  209. K: "Keystroke",
  210. F: "Format",
  211. V: "Validate",
  212. C: "Calculate"
  213. };
  214. const DocumentActionEventType = {
  215. WC: "WillClose",
  216. WS: "WillSave",
  217. DS: "DidSave",
  218. WP: "WillPrint",
  219. DP: "DidPrint"
  220. };
  221. const PageActionEventType = {
  222. O: "PageOpen",
  223. C: "PageClose"
  224. };
  225. const VerbosityLevel = {
  226. ERRORS: 0,
  227. WARNINGS: 1,
  228. INFOS: 5
  229. };
  230. const OPS = {
  231. dependency: 1,
  232. setLineWidth: 2,
  233. setLineCap: 3,
  234. setLineJoin: 4,
  235. setMiterLimit: 5,
  236. setDash: 6,
  237. setRenderingIntent: 7,
  238. setFlatness: 8,
  239. setGState: 9,
  240. save: 10,
  241. restore: 11,
  242. transform: 12,
  243. moveTo: 13,
  244. lineTo: 14,
  245. curveTo: 15,
  246. curveTo2: 16,
  247. curveTo3: 17,
  248. closePath: 18,
  249. rectangle: 19,
  250. stroke: 20,
  251. closeStroke: 21,
  252. fill: 22,
  253. eoFill: 23,
  254. fillStroke: 24,
  255. eoFillStroke: 25,
  256. closeFillStroke: 26,
  257. closeEOFillStroke: 27,
  258. endPath: 28,
  259. clip: 29,
  260. eoClip: 30,
  261. beginText: 31,
  262. endText: 32,
  263. setCharSpacing: 33,
  264. setWordSpacing: 34,
  265. setHScale: 35,
  266. setLeading: 36,
  267. setFont: 37,
  268. setTextRenderingMode: 38,
  269. setTextRise: 39,
  270. moveText: 40,
  271. setLeadingMoveText: 41,
  272. setTextMatrix: 42,
  273. nextLine: 43,
  274. showText: 44,
  275. showSpacedText: 45,
  276. nextLineShowText: 46,
  277. nextLineSetSpacingShowText: 47,
  278. setCharWidth: 48,
  279. setCharWidthAndBounds: 49,
  280. setStrokeColorSpace: 50,
  281. setFillColorSpace: 51,
  282. setStrokeColor: 52,
  283. setStrokeColorN: 53,
  284. setFillColor: 54,
  285. setFillColorN: 55,
  286. setStrokeGray: 56,
  287. setFillGray: 57,
  288. setStrokeRGBColor: 58,
  289. setFillRGBColor: 59,
  290. setStrokeCMYKColor: 60,
  291. setFillCMYKColor: 61,
  292. shadingFill: 62,
  293. beginInlineImage: 63,
  294. beginImageData: 64,
  295. endInlineImage: 65,
  296. paintXObject: 66,
  297. markPoint: 67,
  298. markPointProps: 68,
  299. beginMarkedContent: 69,
  300. beginMarkedContentProps: 70,
  301. endMarkedContent: 71,
  302. beginCompat: 72,
  303. endCompat: 73,
  304. paintFormXObjectBegin: 74,
  305. paintFormXObjectEnd: 75,
  306. beginGroup: 76,
  307. endGroup: 77,
  308. beginAnnotation: 80,
  309. endAnnotation: 81,
  310. paintImageMaskXObject: 83,
  311. paintImageMaskXObjectGroup: 84,
  312. paintImageXObject: 85,
  313. paintInlineImageXObject: 86,
  314. paintInlineImageXObjectGroup: 87,
  315. paintImageXObjectRepeat: 88,
  316. paintImageMaskXObjectRepeat: 89,
  317. paintSolidColorImageMask: 90,
  318. constructPath: 91,
  319. setStrokeTransparent: 92,
  320. setFillTransparent: 93
  321. };
  322. const PasswordResponses = {
  323. NEED_PASSWORD: 1,
  324. INCORRECT_PASSWORD: 2
  325. };
  326. let verbosity = VerbosityLevel.WARNINGS;
  327. function setVerbosityLevel(level) {
  328. if (Number.isInteger(level)) {
  329. verbosity = level;
  330. }
  331. }
  332. function getVerbosityLevel() {
  333. return verbosity;
  334. }
  335. function info(msg) {
  336. if (verbosity >= VerbosityLevel.INFOS) {
  337. console.log(`Info: ${msg}`);
  338. }
  339. }
  340. function warn(msg) {
  341. if (verbosity >= VerbosityLevel.WARNINGS) {
  342. console.log(`Warning: ${msg}`);
  343. }
  344. }
  345. function unreachable(msg) {
  346. throw new Error(msg);
  347. }
  348. function assert(cond, msg) {
  349. if (!cond) {
  350. unreachable(msg);
  351. }
  352. }
  353. function _isValidProtocol(url) {
  354. switch (url?.protocol) {
  355. case "http:":
  356. case "https:":
  357. case "ftp:":
  358. case "mailto:":
  359. case "tel:":
  360. return true;
  361. default:
  362. return false;
  363. }
  364. }
  365. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  366. if (!url) {
  367. return null;
  368. }
  369. try {
  370. if (options && typeof url === "string") {
  371. if (options.addDefaultProtocol && url.startsWith("www.")) {
  372. const dots = url.match(/\./g);
  373. if (dots?.length >= 2) {
  374. url = `http://${url}`;
  375. }
  376. }
  377. if (options.tryConvertEncoding) {
  378. try {
  379. url = stringToUTF8String(url);
  380. } catch {}
  381. }
  382. }
  383. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  384. if (_isValidProtocol(absoluteUrl)) {
  385. return absoluteUrl;
  386. }
  387. } catch {}
  388. return null;
  389. }
  390. function shadow(obj, prop, value, nonSerializable = false) {
  391. Object.defineProperty(obj, prop, {
  392. value,
  393. enumerable: !nonSerializable,
  394. configurable: true,
  395. writable: false
  396. });
  397. return value;
  398. }
  399. const BaseException = function BaseExceptionClosure() {
  400. function BaseException(message, name) {
  401. this.message = message;
  402. this.name = name;
  403. }
  404. BaseException.prototype = new Error();
  405. BaseException.constructor = BaseException;
  406. return BaseException;
  407. }();
  408. class PasswordException extends BaseException {
  409. constructor(msg, code) {
  410. super(msg, "PasswordException");
  411. this.code = code;
  412. }
  413. }
  414. class UnknownErrorException extends BaseException {
  415. constructor(msg, details) {
  416. super(msg, "UnknownErrorException");
  417. this.details = details;
  418. }
  419. }
  420. class InvalidPDFException extends BaseException {
  421. constructor(msg) {
  422. super(msg, "InvalidPDFException");
  423. }
  424. }
  425. class MissingPDFException extends BaseException {
  426. constructor(msg) {
  427. super(msg, "MissingPDFException");
  428. }
  429. }
  430. class UnexpectedResponseException extends BaseException {
  431. constructor(msg, status) {
  432. super(msg, "UnexpectedResponseException");
  433. this.status = status;
  434. }
  435. }
  436. class FormatError extends BaseException {
  437. constructor(msg) {
  438. super(msg, "FormatError");
  439. }
  440. }
  441. class AbortException extends BaseException {
  442. constructor(msg) {
  443. super(msg, "AbortException");
  444. }
  445. }
  446. function bytesToString(bytes) {
  447. if (typeof bytes !== "object" || bytes?.length === undefined) {
  448. unreachable("Invalid argument for bytesToString");
  449. }
  450. const length = bytes.length;
  451. const MAX_ARGUMENT_COUNT = 8192;
  452. if (length < MAX_ARGUMENT_COUNT) {
  453. return String.fromCharCode.apply(null, bytes);
  454. }
  455. const strBuf = [];
  456. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  457. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  458. const chunk = bytes.subarray(i, chunkEnd);
  459. strBuf.push(String.fromCharCode.apply(null, chunk));
  460. }
  461. return strBuf.join("");
  462. }
  463. function stringToBytes(str) {
  464. if (typeof str !== "string") {
  465. unreachable("Invalid argument for stringToBytes");
  466. }
  467. const length = str.length;
  468. const bytes = new Uint8Array(length);
  469. for (let i = 0; i < length; ++i) {
  470. bytes[i] = str.charCodeAt(i) & 0xff;
  471. }
  472. return bytes;
  473. }
  474. function string32(value) {
  475. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  476. }
  477. function objectSize(obj) {
  478. return Object.keys(obj).length;
  479. }
  480. function objectFromMap(map) {
  481. const obj = Object.create(null);
  482. for (const [key, value] of map) {
  483. obj[key] = value;
  484. }
  485. return obj;
  486. }
  487. function isLittleEndian() {
  488. const buffer8 = new Uint8Array(4);
  489. buffer8[0] = 1;
  490. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  491. return view32[0] === 1;
  492. }
  493. function isEvalSupported() {
  494. try {
  495. new Function("");
  496. return true;
  497. } catch {
  498. return false;
  499. }
  500. }
  501. class FeatureTest {
  502. static get isLittleEndian() {
  503. return shadow(this, "isLittleEndian", isLittleEndian());
  504. }
  505. static get isEvalSupported() {
  506. return shadow(this, "isEvalSupported", isEvalSupported());
  507. }
  508. static get isOffscreenCanvasSupported() {
  509. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  510. }
  511. static get isImageDecoderSupported() {
  512. return shadow(this, "isImageDecoderSupported", typeof ImageDecoder !== "undefined");
  513. }
  514. static get platform() {
  515. if (typeof navigator !== "undefined" && typeof navigator?.platform === "string") {
  516. return shadow(this, "platform", {
  517. isMac: navigator.platform.includes("Mac"),
  518. isWindows: navigator.platform.includes("Win"),
  519. isFirefox: typeof navigator?.userAgent === "string" && navigator.userAgent.includes("Firefox")
  520. });
  521. }
  522. return shadow(this, "platform", {
  523. isMac: false,
  524. isWindows: false,
  525. isFirefox: false
  526. });
  527. }
  528. static get isCSSRoundSupported() {
  529. return shadow(this, "isCSSRoundSupported", globalThis.CSS?.supports?.("width: round(1.5px, 1px)"));
  530. }
  531. }
  532. const hexNumbers = Array.from(Array(256).keys(), n => n.toString(16).padStart(2, "0"));
  533. class Util {
  534. static makeHexColor(r, g, b) {
  535. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  536. }
  537. static scaleMinMax(transform, minMax) {
  538. let temp;
  539. if (transform[0]) {
  540. if (transform[0] < 0) {
  541. temp = minMax[0];
  542. minMax[0] = minMax[2];
  543. minMax[2] = temp;
  544. }
  545. minMax[0] *= transform[0];
  546. minMax[2] *= transform[0];
  547. if (transform[3] < 0) {
  548. temp = minMax[1];
  549. minMax[1] = minMax[3];
  550. minMax[3] = temp;
  551. }
  552. minMax[1] *= transform[3];
  553. minMax[3] *= transform[3];
  554. } else {
  555. temp = minMax[0];
  556. minMax[0] = minMax[1];
  557. minMax[1] = temp;
  558. temp = minMax[2];
  559. minMax[2] = minMax[3];
  560. minMax[3] = temp;
  561. if (transform[1] < 0) {
  562. temp = minMax[1];
  563. minMax[1] = minMax[3];
  564. minMax[3] = temp;
  565. }
  566. minMax[1] *= transform[1];
  567. minMax[3] *= transform[1];
  568. if (transform[2] < 0) {
  569. temp = minMax[0];
  570. minMax[0] = minMax[2];
  571. minMax[2] = temp;
  572. }
  573. minMax[0] *= transform[2];
  574. minMax[2] *= transform[2];
  575. }
  576. minMax[0] += transform[4];
  577. minMax[1] += transform[5];
  578. minMax[2] += transform[4];
  579. minMax[3] += transform[5];
  580. }
  581. static transform(m1, m2) {
  582. return [m1[0] * m2[0] + m1[2] * m2[1], m1[1] * m2[0] + m1[3] * m2[1], m1[0] * m2[2] + m1[2] * m2[3], m1[1] * m2[2] + m1[3] * m2[3], m1[0] * m2[4] + m1[2] * m2[5] + m1[4], m1[1] * m2[4] + m1[3] * m2[5] + m1[5]];
  583. }
  584. static applyTransform(p, m) {
  585. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  586. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  587. return [xt, yt];
  588. }
  589. static applyInverseTransform(p, m) {
  590. const d = m[0] * m[3] - m[1] * m[2];
  591. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  592. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  593. return [xt, yt];
  594. }
  595. static getAxialAlignedBoundingBox(r, m) {
  596. const p1 = this.applyTransform(r, m);
  597. const p2 = this.applyTransform(r.slice(2, 4), m);
  598. const p3 = this.applyTransform([r[0], r[3]], m);
  599. const p4 = this.applyTransform([r[2], r[1]], m);
  600. return [Math.min(p1[0], p2[0], p3[0], p4[0]), Math.min(p1[1], p2[1], p3[1], p4[1]), Math.max(p1[0], p2[0], p3[0], p4[0]), Math.max(p1[1], p2[1], p3[1], p4[1])];
  601. }
  602. static inverseTransform(m) {
  603. const d = m[0] * m[3] - m[1] * m[2];
  604. return [m[3] / d, -m[1] / d, -m[2] / d, m[0] / d, (m[2] * m[5] - m[4] * m[3]) / d, (m[4] * m[1] - m[5] * m[0]) / d];
  605. }
  606. static singularValueDecompose2dScale(m) {
  607. const transpose = [m[0], m[2], m[1], m[3]];
  608. const a = m[0] * transpose[0] + m[1] * transpose[2];
  609. const b = m[0] * transpose[1] + m[1] * transpose[3];
  610. const c = m[2] * transpose[0] + m[3] * transpose[2];
  611. const d = m[2] * transpose[1] + m[3] * transpose[3];
  612. const first = (a + d) / 2;
  613. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  614. const sx = first + second || 1;
  615. const sy = first - second || 1;
  616. return [Math.sqrt(sx), Math.sqrt(sy)];
  617. }
  618. static normalizeRect(rect) {
  619. const r = rect.slice(0);
  620. if (rect[0] > rect[2]) {
  621. r[0] = rect[2];
  622. r[2] = rect[0];
  623. }
  624. if (rect[1] > rect[3]) {
  625. r[1] = rect[3];
  626. r[3] = rect[1];
  627. }
  628. return r;
  629. }
  630. static intersect(rect1, rect2) {
  631. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  632. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  633. if (xLow > xHigh) {
  634. return null;
  635. }
  636. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  637. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  638. if (yLow > yHigh) {
  639. return null;
  640. }
  641. return [xLow, yLow, xHigh, yHigh];
  642. }
  643. static #getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, t, minMax) {
  644. if (t <= 0 || t >= 1) {
  645. return;
  646. }
  647. const mt = 1 - t;
  648. const tt = t * t;
  649. const ttt = tt * t;
  650. const x = mt * (mt * (mt * x0 + 3 * t * x1) + 3 * tt * x2) + ttt * x3;
  651. const y = mt * (mt * (mt * y0 + 3 * t * y1) + 3 * tt * y2) + ttt * y3;
  652. minMax[0] = Math.min(minMax[0], x);
  653. minMax[1] = Math.min(minMax[1], y);
  654. minMax[2] = Math.max(minMax[2], x);
  655. minMax[3] = Math.max(minMax[3], y);
  656. }
  657. static #getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, a, b, c, minMax) {
  658. if (Math.abs(a) < 1e-12) {
  659. if (Math.abs(b) >= 1e-12) {
  660. this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, -c / b, minMax);
  661. }
  662. return;
  663. }
  664. const delta = b ** 2 - 4 * c * a;
  665. if (delta < 0) {
  666. return;
  667. }
  668. const sqrtDelta = Math.sqrt(delta);
  669. const a2 = 2 * a;
  670. this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b + sqrtDelta) / a2, minMax);
  671. this.#getExtremumOnCurve(x0, x1, x2, x3, y0, y1, y2, y3, (-b - sqrtDelta) / a2, minMax);
  672. }
  673. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3, minMax) {
  674. if (minMax) {
  675. minMax[0] = Math.min(minMax[0], x0, x3);
  676. minMax[1] = Math.min(minMax[1], y0, y3);
  677. minMax[2] = Math.max(minMax[2], x0, x3);
  678. minMax[3] = Math.max(minMax[3], y0, y3);
  679. } else {
  680. minMax = [Math.min(x0, x3), Math.min(y0, y3), Math.max(x0, x3), Math.max(y0, y3)];
  681. }
  682. this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-x0 + 3 * (x1 - x2) + x3), 6 * (x0 - 2 * x1 + x2), 3 * (x1 - x0), minMax);
  683. this.#getExtremum(x0, x1, x2, x3, y0, y1, y2, y3, 3 * (-y0 + 3 * (y1 - y2) + y3), 6 * (y0 - 2 * y1 + y2), 3 * (y1 - y0), minMax);
  684. return minMax;
  685. }
  686. }
  687. const PDFStringTranslateTable = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2d8, 0x2c7, 0x2c6, 0x2d9, 0x2dd, 0x2db, 0x2da, 0x2dc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x2022, 0x2020, 0x2021, 0x2026, 0x2014, 0x2013, 0x192, 0x2044, 0x2039, 0x203a, 0x2212, 0x2030, 0x201e, 0x201c, 0x201d, 0x2018, 0x2019, 0x201a, 0x2122, 0xfb01, 0xfb02, 0x141, 0x152, 0x160, 0x178, 0x17d, 0x131, 0x142, 0x153, 0x161, 0x17e, 0, 0x20ac];
  688. function stringToPDFString(str) {
  689. if (str[0] >= "\xEF") {
  690. let encoding;
  691. if (str[0] === "\xFE" && str[1] === "\xFF") {
  692. encoding = "utf-16be";
  693. if (str.length % 2 === 1) {
  694. str = str.slice(0, -1);
  695. }
  696. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  697. encoding = "utf-16le";
  698. if (str.length % 2 === 1) {
  699. str = str.slice(0, -1);
  700. }
  701. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  702. encoding = "utf-8";
  703. }
  704. if (encoding) {
  705. try {
  706. const decoder = new TextDecoder(encoding, {
  707. fatal: true
  708. });
  709. const buffer = stringToBytes(str);
  710. const decoded = decoder.decode(buffer);
  711. if (!decoded.includes("\x1b")) {
  712. return decoded;
  713. }
  714. return decoded.replaceAll(/\x1b[^\x1b]*(?:\x1b|$)/g, "");
  715. } catch (ex) {
  716. warn(`stringToPDFString: "${ex}".`);
  717. }
  718. }
  719. }
  720. const strBuf = [];
  721. for (let i = 0, ii = str.length; i < ii; i++) {
  722. const charCode = str.charCodeAt(i);
  723. if (charCode === 0x1b) {
  724. while (++i < ii && str.charCodeAt(i) !== 0x1b) {}
  725. continue;
  726. }
  727. const code = PDFStringTranslateTable[charCode];
  728. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  729. }
  730. return strBuf.join("");
  731. }
  732. function stringToUTF8String(str) {
  733. return decodeURIComponent(escape(str));
  734. }
  735. function utf8StringToString(str) {
  736. return unescape(encodeURIComponent(str));
  737. }
  738. function isArrayEqual(arr1, arr2) {
  739. if (arr1.length !== arr2.length) {
  740. return false;
  741. }
  742. for (let i = 0, ii = arr1.length; i < ii; i++) {
  743. if (arr1[i] !== arr2[i]) {
  744. return false;
  745. }
  746. }
  747. return true;
  748. }
  749. function getModificationDate(date = new Date()) {
  750. const buffer = [date.getUTCFullYear().toString(), (date.getUTCMonth() + 1).toString().padStart(2, "0"), date.getUTCDate().toString().padStart(2, "0"), date.getUTCHours().toString().padStart(2, "0"), date.getUTCMinutes().toString().padStart(2, "0"), date.getUTCSeconds().toString().padStart(2, "0")];
  751. return buffer.join("");
  752. }
  753. let NormalizeRegex = null;
  754. let NormalizationMap = null;
  755. function normalizeUnicode(str) {
  756. if (!NormalizeRegex) {
  757. NormalizeRegex = /([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu;
  758. NormalizationMap = new Map([["ſt", "ſt"]]);
  759. }
  760. return str.replaceAll(NormalizeRegex, (_, p1, p2) => p1 ? p1.normalize("NFKC") : NormalizationMap.get(p2));
  761. }
  762. function getUuid() {
  763. if (typeof crypto.randomUUID === "function") {
  764. return crypto.randomUUID();
  765. }
  766. const buf = new Uint8Array(32);
  767. crypto.getRandomValues(buf);
  768. return bytesToString(buf);
  769. }
  770. const AnnotationPrefix = "pdfjs_internal_id_";
  771. function toHexUtil(arr) {
  772. if (Uint8Array.prototype.toHex) {
  773. return arr.toHex();
  774. }
  775. return Array.from(arr, num => hexNumbers[num]).join("");
  776. }
  777. function toBase64Util(arr) {
  778. if (Uint8Array.prototype.toBase64) {
  779. return arr.toBase64();
  780. }
  781. return btoa(bytesToString(arr));
  782. }
  783. function fromBase64Util(str) {
  784. if (Uint8Array.fromBase64) {
  785. return Uint8Array.fromBase64(str);
  786. }
  787. return stringToBytes(atob(str));
  788. }
  789. if (typeof Promise.try !== "function") {
  790. Promise.try = function (fn, ...args) {
  791. return new Promise(resolve => {
  792. resolve(fn(...args));
  793. });
  794. };
  795. }
  796. ;// ./src/core/primitives.js
  797. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  798. const EOF = Symbol("EOF");
  799. let CmdCache = Object.create(null);
  800. let NameCache = Object.create(null);
  801. let RefCache = Object.create(null);
  802. function clearPrimitiveCaches() {
  803. CmdCache = Object.create(null);
  804. NameCache = Object.create(null);
  805. RefCache = Object.create(null);
  806. }
  807. class Name {
  808. constructor(name) {
  809. this.name = name;
  810. }
  811. static get(name) {
  812. return NameCache[name] ||= new Name(name);
  813. }
  814. }
  815. class Cmd {
  816. constructor(cmd) {
  817. this.cmd = cmd;
  818. }
  819. static get(cmd) {
  820. return CmdCache[cmd] ||= new Cmd(cmd);
  821. }
  822. }
  823. const nonSerializable = function nonSerializableClosure() {
  824. return nonSerializable;
  825. };
  826. class Dict {
  827. constructor(xref = null) {
  828. this._map = new Map();
  829. this.xref = xref;
  830. this.objId = null;
  831. this.suppressEncryption = false;
  832. this.__nonSerializable__ = nonSerializable;
  833. }
  834. assignXref(newXref) {
  835. this.xref = newXref;
  836. }
  837. get size() {
  838. return this._map.size;
  839. }
  840. get(key1, key2, key3) {
  841. let value = this._map.get(key1);
  842. if (value === undefined && key2 !== undefined) {
  843. value = this._map.get(key2);
  844. if (value === undefined && key3 !== undefined) {
  845. value = this._map.get(key3);
  846. }
  847. }
  848. if (value instanceof Ref && this.xref) {
  849. return this.xref.fetch(value, this.suppressEncryption);
  850. }
  851. return value;
  852. }
  853. async getAsync(key1, key2, key3) {
  854. let value = this._map.get(key1);
  855. if (value === undefined && key2 !== undefined) {
  856. value = this._map.get(key2);
  857. if (value === undefined && key3 !== undefined) {
  858. value = this._map.get(key3);
  859. }
  860. }
  861. if (value instanceof Ref && this.xref) {
  862. return this.xref.fetchAsync(value, this.suppressEncryption);
  863. }
  864. return value;
  865. }
  866. getArray(key1, key2, key3) {
  867. let value = this._map.get(key1);
  868. if (value === undefined && key2 !== undefined) {
  869. value = this._map.get(key2);
  870. if (value === undefined && key3 !== undefined) {
  871. value = this._map.get(key3);
  872. }
  873. }
  874. if (value instanceof Ref && this.xref) {
  875. value = this.xref.fetch(value, this.suppressEncryption);
  876. }
  877. if (Array.isArray(value)) {
  878. value = value.slice();
  879. for (let i = 0, ii = value.length; i < ii; i++) {
  880. if (value[i] instanceof Ref && this.xref) {
  881. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  882. }
  883. }
  884. }
  885. return value;
  886. }
  887. getRaw(key) {
  888. return this._map.get(key);
  889. }
  890. getKeys() {
  891. return [...this._map.keys()];
  892. }
  893. getRawValues() {
  894. return [...this._map.values()];
  895. }
  896. set(key, value) {
  897. this._map.set(key, value);
  898. }
  899. has(key) {
  900. return this._map.has(key);
  901. }
  902. *[Symbol.iterator]() {
  903. for (const [key, value] of this._map) {
  904. yield [key, value instanceof Ref && this.xref ? this.xref.fetch(value, this.suppressEncryption) : value];
  905. }
  906. }
  907. static get empty() {
  908. const emptyDict = new Dict(null);
  909. emptyDict.set = (key, value) => {
  910. unreachable("Should not call `set` on the empty dictionary.");
  911. };
  912. return shadow(this, "empty", emptyDict);
  913. }
  914. static merge({
  915. xref,
  916. dictArray,
  917. mergeSubDicts = false
  918. }) {
  919. const mergedDict = new Dict(xref),
  920. properties = new Map();
  921. for (const dict of dictArray) {
  922. if (!(dict instanceof Dict)) {
  923. continue;
  924. }
  925. for (const [key, value] of dict._map) {
  926. let property = properties.get(key);
  927. if (property === undefined) {
  928. property = [];
  929. properties.set(key, property);
  930. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  931. continue;
  932. }
  933. property.push(value);
  934. }
  935. }
  936. for (const [name, values] of properties) {
  937. if (values.length === 1 || !(values[0] instanceof Dict)) {
  938. mergedDict._map.set(name, values[0]);
  939. continue;
  940. }
  941. const subDict = new Dict(xref);
  942. for (const dict of values) {
  943. for (const [key, value] of dict._map) {
  944. if (!subDict._map.has(key)) {
  945. subDict._map.set(key, value);
  946. }
  947. }
  948. }
  949. if (subDict.size > 0) {
  950. mergedDict._map.set(name, subDict);
  951. }
  952. }
  953. properties.clear();
  954. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  955. }
  956. clone() {
  957. const dict = new Dict(this.xref);
  958. for (const key of this.getKeys()) {
  959. dict.set(key, this.getRaw(key));
  960. }
  961. return dict;
  962. }
  963. delete(key) {
  964. delete this._map[key];
  965. }
  966. }
  967. class Ref {
  968. constructor(num, gen) {
  969. this.num = num;
  970. this.gen = gen;
  971. }
  972. toString() {
  973. if (this.gen === 0) {
  974. return `${this.num}R`;
  975. }
  976. return `${this.num}R${this.gen}`;
  977. }
  978. static fromString(str) {
  979. const ref = RefCache[str];
  980. if (ref) {
  981. return ref;
  982. }
  983. const m = /^(\d+)R(\d*)$/.exec(str);
  984. if (!m || m[1] === "0") {
  985. return null;
  986. }
  987. return RefCache[str] = new Ref(parseInt(m[1]), !m[2] ? 0 : parseInt(m[2]));
  988. }
  989. static get(num, gen) {
  990. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  991. return RefCache[key] ||= new Ref(num, gen);
  992. }
  993. }
  994. class RefSet {
  995. constructor(parent = null) {
  996. this._set = new Set(parent?._set);
  997. }
  998. has(ref) {
  999. return this._set.has(ref.toString());
  1000. }
  1001. put(ref) {
  1002. this._set.add(ref.toString());
  1003. }
  1004. remove(ref) {
  1005. this._set.delete(ref.toString());
  1006. }
  1007. [Symbol.iterator]() {
  1008. return this._set.values();
  1009. }
  1010. clear() {
  1011. this._set.clear();
  1012. }
  1013. }
  1014. class RefSetCache {
  1015. constructor() {
  1016. this._map = new Map();
  1017. }
  1018. get size() {
  1019. return this._map.size;
  1020. }
  1021. get(ref) {
  1022. return this._map.get(ref.toString());
  1023. }
  1024. has(ref) {
  1025. return this._map.has(ref.toString());
  1026. }
  1027. put(ref, obj) {
  1028. this._map.set(ref.toString(), obj);
  1029. }
  1030. putAlias(ref, aliasRef) {
  1031. this._map.set(ref.toString(), this.get(aliasRef));
  1032. }
  1033. [Symbol.iterator]() {
  1034. return this._map.values();
  1035. }
  1036. clear() {
  1037. this._map.clear();
  1038. }
  1039. *values() {
  1040. yield* this._map.values();
  1041. }
  1042. *items() {
  1043. for (const [ref, value] of this._map) {
  1044. yield [Ref.fromString(ref), value];
  1045. }
  1046. }
  1047. }
  1048. function isName(v, name) {
  1049. return v instanceof Name && (name === undefined || v.name === name);
  1050. }
  1051. function isCmd(v, cmd) {
  1052. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1053. }
  1054. function isDict(v, type) {
  1055. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1056. }
  1057. function isRefsEqual(v1, v2) {
  1058. return v1.num === v2.num && v1.gen === v2.gen;
  1059. }
  1060. ;// ./src/core/base_stream.js
  1061. class BaseStream {
  1062. get length() {
  1063. unreachable("Abstract getter `length` accessed");
  1064. }
  1065. get isEmpty() {
  1066. unreachable("Abstract getter `isEmpty` accessed");
  1067. }
  1068. get isDataLoaded() {
  1069. return shadow(this, "isDataLoaded", true);
  1070. }
  1071. getByte() {
  1072. unreachable("Abstract method `getByte` called");
  1073. }
  1074. getBytes(length) {
  1075. unreachable("Abstract method `getBytes` called");
  1076. }
  1077. async getImageData(length, decoderOptions) {
  1078. return this.getBytes(length, decoderOptions);
  1079. }
  1080. async asyncGetBytes() {
  1081. unreachable("Abstract method `asyncGetBytes` called");
  1082. }
  1083. get isAsync() {
  1084. return false;
  1085. }
  1086. get canAsyncDecodeImageFromBuffer() {
  1087. return false;
  1088. }
  1089. async getTransferableImage() {
  1090. return null;
  1091. }
  1092. peekByte() {
  1093. const peekedByte = this.getByte();
  1094. if (peekedByte !== -1) {
  1095. this.pos--;
  1096. }
  1097. return peekedByte;
  1098. }
  1099. peekBytes(length) {
  1100. const bytes = this.getBytes(length);
  1101. this.pos -= bytes.length;
  1102. return bytes;
  1103. }
  1104. getUint16() {
  1105. const b0 = this.getByte();
  1106. const b1 = this.getByte();
  1107. if (b0 === -1 || b1 === -1) {
  1108. return -1;
  1109. }
  1110. return (b0 << 8) + b1;
  1111. }
  1112. getInt32() {
  1113. const b0 = this.getByte();
  1114. const b1 = this.getByte();
  1115. const b2 = this.getByte();
  1116. const b3 = this.getByte();
  1117. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  1118. }
  1119. getByteRange(begin, end) {
  1120. unreachable("Abstract method `getByteRange` called");
  1121. }
  1122. getString(length) {
  1123. return bytesToString(this.getBytes(length));
  1124. }
  1125. skip(n) {
  1126. this.pos += n || 1;
  1127. }
  1128. reset() {
  1129. unreachable("Abstract method `reset` called");
  1130. }
  1131. moveStart() {
  1132. unreachable("Abstract method `moveStart` called");
  1133. }
  1134. makeSubStream(start, length, dict = null) {
  1135. unreachable("Abstract method `makeSubStream` called");
  1136. }
  1137. getBaseStreams() {
  1138. return null;
  1139. }
  1140. }
  1141. ;// ./src/core/core_utils.js
  1142. const PDF_VERSION_REGEXP = /^[1-9]\.\d$/;
  1143. const MAX_INT_32 = 2 ** 31 - 1;
  1144. const MIN_INT_32 = -(2 ** 31);
  1145. function getLookupTableFactory(initializer) {
  1146. let lookup;
  1147. return function () {
  1148. if (initializer) {
  1149. lookup = Object.create(null);
  1150. initializer(lookup);
  1151. initializer = null;
  1152. }
  1153. return lookup;
  1154. };
  1155. }
  1156. class MissingDataException extends BaseException {
  1157. constructor(begin, end) {
  1158. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  1159. this.begin = begin;
  1160. this.end = end;
  1161. }
  1162. }
  1163. class ParserEOFException extends BaseException {
  1164. constructor(msg) {
  1165. super(msg, "ParserEOFException");
  1166. }
  1167. }
  1168. class XRefEntryException extends BaseException {
  1169. constructor(msg) {
  1170. super(msg, "XRefEntryException");
  1171. }
  1172. }
  1173. class XRefParseException extends BaseException {
  1174. constructor(msg) {
  1175. super(msg, "XRefParseException");
  1176. }
  1177. }
  1178. function arrayBuffersToBytes(arr) {
  1179. const length = arr.length;
  1180. if (length === 0) {
  1181. return new Uint8Array(0);
  1182. }
  1183. if (length === 1) {
  1184. return new Uint8Array(arr[0]);
  1185. }
  1186. let dataLength = 0;
  1187. for (let i = 0; i < length; i++) {
  1188. dataLength += arr[i].byteLength;
  1189. }
  1190. const data = new Uint8Array(dataLength);
  1191. let pos = 0;
  1192. for (let i = 0; i < length; i++) {
  1193. const item = new Uint8Array(arr[i]);
  1194. data.set(item, pos);
  1195. pos += item.byteLength;
  1196. }
  1197. return data;
  1198. }
  1199. function getInheritableProperty({
  1200. dict,
  1201. key,
  1202. getArray = false,
  1203. stopWhenFound = true
  1204. }) {
  1205. let values;
  1206. const visited = new RefSet();
  1207. while (dict instanceof Dict && !(dict.objId && visited.has(dict.objId))) {
  1208. if (dict.objId) {
  1209. visited.put(dict.objId);
  1210. }
  1211. const value = getArray ? dict.getArray(key) : dict.get(key);
  1212. if (value !== undefined) {
  1213. if (stopWhenFound) {
  1214. return value;
  1215. }
  1216. (values ||= []).push(value);
  1217. }
  1218. dict = dict.get("Parent");
  1219. }
  1220. return values;
  1221. }
  1222. function getParentToUpdate(dict, ref, xref) {
  1223. const visited = new RefSet();
  1224. const firstDict = dict;
  1225. const result = {
  1226. dict: null,
  1227. ref: null
  1228. };
  1229. while (dict instanceof Dict && !visited.has(ref)) {
  1230. visited.put(ref);
  1231. if (dict.has("T")) {
  1232. break;
  1233. }
  1234. ref = dict.getRaw("Parent");
  1235. if (!(ref instanceof Ref)) {
  1236. return result;
  1237. }
  1238. dict = xref.fetch(ref);
  1239. }
  1240. if (dict instanceof Dict && dict !== firstDict) {
  1241. result.dict = dict;
  1242. result.ref = ref;
  1243. }
  1244. return result;
  1245. }
  1246. const ROMAN_NUMBER_MAP = ["", "C", "CC", "CCC", "CD", "D", "DC", "DCC", "DCCC", "CM", "", "X", "XX", "XXX", "XL", "L", "LX", "LXX", "LXXX", "XC", "", "I", "II", "III", "IV", "V", "VI", "VII", "VIII", "IX"];
  1247. function toRomanNumerals(number, lowerCase = false) {
  1248. assert(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  1249. const roman = "M".repeat(number / 1000 | 0) + ROMAN_NUMBER_MAP[number % 1000 / 100 | 0] + ROMAN_NUMBER_MAP[10 + (number % 100 / 10 | 0)] + ROMAN_NUMBER_MAP[20 + number % 10];
  1250. return lowerCase ? roman.toLowerCase() : roman;
  1251. }
  1252. function log2(x) {
  1253. return x > 0 ? Math.ceil(Math.log2(x)) : 0;
  1254. }
  1255. function readInt8(data, offset) {
  1256. return data[offset] << 24 >> 24;
  1257. }
  1258. function readUint16(data, offset) {
  1259. return data[offset] << 8 | data[offset + 1];
  1260. }
  1261. function readUint32(data, offset) {
  1262. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  1263. }
  1264. function isWhiteSpace(ch) {
  1265. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  1266. }
  1267. function isBooleanArray(arr, len) {
  1268. return Array.isArray(arr) && (len === null || arr.length === len) && arr.every(x => typeof x === "boolean");
  1269. }
  1270. function isNumberArray(arr, len) {
  1271. if (Array.isArray(arr)) {
  1272. return (len === null || arr.length === len) && arr.every(x => typeof x === "number");
  1273. }
  1274. return ArrayBuffer.isView(arr) && (arr.length === 0 || typeof arr[0] === "number") && (len === null || arr.length === len);
  1275. }
  1276. function lookupMatrix(arr, fallback) {
  1277. return isNumberArray(arr, 6) ? arr : fallback;
  1278. }
  1279. function lookupRect(arr, fallback) {
  1280. return isNumberArray(arr, 4) ? arr : fallback;
  1281. }
  1282. function lookupNormalRect(arr, fallback) {
  1283. return isNumberArray(arr, 4) ? Util.normalizeRect(arr) : fallback;
  1284. }
  1285. function parseXFAPath(path) {
  1286. const positionPattern = /(.+)\[(\d+)\]$/;
  1287. return path.split(".").map(component => {
  1288. const m = component.match(positionPattern);
  1289. if (m) {
  1290. return {
  1291. name: m[1],
  1292. pos: parseInt(m[2], 10)
  1293. };
  1294. }
  1295. return {
  1296. name: component,
  1297. pos: 0
  1298. };
  1299. });
  1300. }
  1301. function escapePDFName(str) {
  1302. const buffer = [];
  1303. let start = 0;
  1304. for (let i = 0, ii = str.length; i < ii; i++) {
  1305. const char = str.charCodeAt(i);
  1306. if (char < 0x21 || char > 0x7e || char === 0x23 || char === 0x28 || char === 0x29 || char === 0x3c || char === 0x3e || char === 0x5b || char === 0x5d || char === 0x7b || char === 0x7d || char === 0x2f || char === 0x25) {
  1307. if (start < i) {
  1308. buffer.push(str.substring(start, i));
  1309. }
  1310. buffer.push(`#${char.toString(16)}`);
  1311. start = i + 1;
  1312. }
  1313. }
  1314. if (buffer.length === 0) {
  1315. return str;
  1316. }
  1317. if (start < str.length) {
  1318. buffer.push(str.substring(start, str.length));
  1319. }
  1320. return buffer.join("");
  1321. }
  1322. function escapeString(str) {
  1323. return str.replaceAll(/([()\\\n\r])/g, match => {
  1324. if (match === "\n") {
  1325. return "\\n";
  1326. } else if (match === "\r") {
  1327. return "\\r";
  1328. }
  1329. return `\\${match}`;
  1330. });
  1331. }
  1332. function _collectJS(entry, xref, list, parents) {
  1333. if (!entry) {
  1334. return;
  1335. }
  1336. let parent = null;
  1337. if (entry instanceof Ref) {
  1338. if (parents.has(entry)) {
  1339. return;
  1340. }
  1341. parent = entry;
  1342. parents.put(parent);
  1343. entry = xref.fetch(entry);
  1344. }
  1345. if (Array.isArray(entry)) {
  1346. for (const element of entry) {
  1347. _collectJS(element, xref, list, parents);
  1348. }
  1349. } else if (entry instanceof Dict) {
  1350. if (isName(entry.get("S"), "JavaScript")) {
  1351. const js = entry.get("JS");
  1352. let code;
  1353. if (js instanceof BaseStream) {
  1354. code = js.getString();
  1355. } else if (typeof js === "string") {
  1356. code = js;
  1357. }
  1358. code &&= stringToPDFString(code).replaceAll("\x00", "");
  1359. if (code) {
  1360. list.push(code);
  1361. }
  1362. }
  1363. _collectJS(entry.getRaw("Next"), xref, list, parents);
  1364. }
  1365. if (parent) {
  1366. parents.remove(parent);
  1367. }
  1368. }
  1369. function collectActions(xref, dict, eventType) {
  1370. const actions = Object.create(null);
  1371. const additionalActionsDicts = getInheritableProperty({
  1372. dict,
  1373. key: "AA",
  1374. stopWhenFound: false
  1375. });
  1376. if (additionalActionsDicts) {
  1377. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  1378. const additionalActions = additionalActionsDicts[i];
  1379. if (!(additionalActions instanceof Dict)) {
  1380. continue;
  1381. }
  1382. for (const key of additionalActions.getKeys()) {
  1383. const action = eventType[key];
  1384. if (!action) {
  1385. continue;
  1386. }
  1387. const actionDict = additionalActions.getRaw(key);
  1388. const parents = new RefSet();
  1389. const list = [];
  1390. _collectJS(actionDict, xref, list, parents);
  1391. if (list.length > 0) {
  1392. actions[action] = list;
  1393. }
  1394. }
  1395. }
  1396. }
  1397. if (dict.has("A")) {
  1398. const actionDict = dict.get("A");
  1399. const parents = new RefSet();
  1400. const list = [];
  1401. _collectJS(actionDict, xref, list, parents);
  1402. if (list.length > 0) {
  1403. actions.Action = list;
  1404. }
  1405. }
  1406. return objectSize(actions) > 0 ? actions : null;
  1407. }
  1408. const XMLEntities = {
  1409. 0x3c: "&lt;",
  1410. 0x3e: "&gt;",
  1411. 0x26: "&amp;",
  1412. 0x22: "&quot;",
  1413. 0x27: "&apos;"
  1414. };
  1415. function* codePointIter(str) {
  1416. for (let i = 0, ii = str.length; i < ii; i++) {
  1417. const char = str.codePointAt(i);
  1418. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  1419. i++;
  1420. }
  1421. yield char;
  1422. }
  1423. }
  1424. function encodeToXmlString(str) {
  1425. const buffer = [];
  1426. let start = 0;
  1427. for (let i = 0, ii = str.length; i < ii; i++) {
  1428. const char = str.codePointAt(i);
  1429. if (0x20 <= char && char <= 0x7e) {
  1430. const entity = XMLEntities[char];
  1431. if (entity) {
  1432. if (start < i) {
  1433. buffer.push(str.substring(start, i));
  1434. }
  1435. buffer.push(entity);
  1436. start = i + 1;
  1437. }
  1438. } else {
  1439. if (start < i) {
  1440. buffer.push(str.substring(start, i));
  1441. }
  1442. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  1443. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  1444. i++;
  1445. }
  1446. start = i + 1;
  1447. }
  1448. }
  1449. if (buffer.length === 0) {
  1450. return str;
  1451. }
  1452. if (start < str.length) {
  1453. buffer.push(str.substring(start, str.length));
  1454. }
  1455. return buffer.join("");
  1456. }
  1457. function validateFontName(fontFamily, mustWarn = false) {
  1458. const m = /^("|').*("|')$/.exec(fontFamily);
  1459. if (m && m[1] === m[2]) {
  1460. const re = new RegExp(`[^\\\\]${m[1]}`);
  1461. if (re.test(fontFamily.slice(1, -1))) {
  1462. if (mustWarn) {
  1463. warn(`FontFamily contains unescaped ${m[1]}: ${fontFamily}.`);
  1464. }
  1465. return false;
  1466. }
  1467. } else {
  1468. for (const ident of fontFamily.split(/[ \t]+/)) {
  1469. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  1470. if (mustWarn) {
  1471. warn(`FontFamily contains invalid <custom-ident>: ${fontFamily}.`);
  1472. }
  1473. return false;
  1474. }
  1475. }
  1476. }
  1477. return true;
  1478. }
  1479. function validateCSSFont(cssFontInfo) {
  1480. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  1481. const DEFAULT_CSS_FONT_WEIGHT = "400";
  1482. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  1483. const {
  1484. fontFamily,
  1485. fontWeight,
  1486. italicAngle
  1487. } = cssFontInfo;
  1488. if (!validateFontName(fontFamily, true)) {
  1489. return false;
  1490. }
  1491. const weight = fontWeight ? fontWeight.toString() : "";
  1492. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  1493. const angle = parseFloat(italicAngle);
  1494. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  1495. return true;
  1496. }
  1497. function recoverJsURL(str) {
  1498. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  1499. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").replaceAll(".", "\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  1500. const jsUrl = regex.exec(str);
  1501. if (jsUrl?.[2]) {
  1502. return {
  1503. url: jsUrl[2],
  1504. newWindow: jsUrl[1] === "app.launchURL" && jsUrl[3] === "true"
  1505. };
  1506. }
  1507. return null;
  1508. }
  1509. function numberToString(value) {
  1510. if (Number.isInteger(value)) {
  1511. return value.toString();
  1512. }
  1513. const roundedValue = Math.round(value * 100);
  1514. if (roundedValue % 100 === 0) {
  1515. return (roundedValue / 100).toString();
  1516. }
  1517. if (roundedValue % 10 === 0) {
  1518. return value.toFixed(1);
  1519. }
  1520. return value.toFixed(2);
  1521. }
  1522. function getNewAnnotationsMap(annotationStorage) {
  1523. if (!annotationStorage) {
  1524. return null;
  1525. }
  1526. const newAnnotationsByPage = new Map();
  1527. for (const [key, value] of annotationStorage) {
  1528. if (!key.startsWith(AnnotationEditorPrefix)) {
  1529. continue;
  1530. }
  1531. let annotations = newAnnotationsByPage.get(value.pageIndex);
  1532. if (!annotations) {
  1533. annotations = [];
  1534. newAnnotationsByPage.set(value.pageIndex, annotations);
  1535. }
  1536. annotations.push(value);
  1537. }
  1538. return newAnnotationsByPage.size > 0 ? newAnnotationsByPage : null;
  1539. }
  1540. function stringToAsciiOrUTF16BE(str) {
  1541. return isAscii(str) ? str : stringToUTF16String(str, true);
  1542. }
  1543. function isAscii(str) {
  1544. return /^[\x00-\x7F]*$/.test(str);
  1545. }
  1546. function stringToUTF16HexString(str) {
  1547. const buf = [];
  1548. for (let i = 0, ii = str.length; i < ii; i++) {
  1549. const char = str.charCodeAt(i);
  1550. buf.push(hexNumbers[char >> 8 & 0xff], hexNumbers[char & 0xff]);
  1551. }
  1552. return buf.join("");
  1553. }
  1554. function stringToUTF16String(str, bigEndian = false) {
  1555. const buf = [];
  1556. if (bigEndian) {
  1557. buf.push("\xFE\xFF");
  1558. }
  1559. for (let i = 0, ii = str.length; i < ii; i++) {
  1560. const char = str.charCodeAt(i);
  1561. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1562. }
  1563. return buf.join("");
  1564. }
  1565. function getRotationMatrix(rotation, width, height) {
  1566. switch (rotation) {
  1567. case 90:
  1568. return [0, 1, -1, 0, width, 0];
  1569. case 180:
  1570. return [-1, 0, 0, -1, width, height];
  1571. case 270:
  1572. return [0, -1, 1, 0, 0, height];
  1573. default:
  1574. throw new Error("Invalid rotation");
  1575. }
  1576. }
  1577. function getSizeInBytes(x) {
  1578. return Math.ceil(Math.ceil(Math.log2(1 + x)) / 8);
  1579. }
  1580. ;// ./src/core/stream.js
  1581. class Stream extends BaseStream {
  1582. constructor(arrayBuffer, start, length, dict) {
  1583. super();
  1584. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  1585. this.start = start || 0;
  1586. this.pos = this.start;
  1587. this.end = start + length || this.bytes.length;
  1588. this.dict = dict;
  1589. }
  1590. get length() {
  1591. return this.end - this.start;
  1592. }
  1593. get isEmpty() {
  1594. return this.length === 0;
  1595. }
  1596. getByte() {
  1597. if (this.pos >= this.end) {
  1598. return -1;
  1599. }
  1600. return this.bytes[this.pos++];
  1601. }
  1602. getBytes(length) {
  1603. const bytes = this.bytes;
  1604. const pos = this.pos;
  1605. const strEnd = this.end;
  1606. if (!length) {
  1607. return bytes.subarray(pos, strEnd);
  1608. }
  1609. let end = pos + length;
  1610. if (end > strEnd) {
  1611. end = strEnd;
  1612. }
  1613. this.pos = end;
  1614. return bytes.subarray(pos, end);
  1615. }
  1616. getByteRange(begin, end) {
  1617. if (begin < 0) {
  1618. begin = 0;
  1619. }
  1620. if (end > this.end) {
  1621. end = this.end;
  1622. }
  1623. return this.bytes.subarray(begin, end);
  1624. }
  1625. reset() {
  1626. this.pos = this.start;
  1627. }
  1628. moveStart() {
  1629. this.start = this.pos;
  1630. }
  1631. makeSubStream(start, length, dict = null) {
  1632. return new Stream(this.bytes.buffer, start, length, dict);
  1633. }
  1634. }
  1635. class StringStream extends Stream {
  1636. constructor(str) {
  1637. super(stringToBytes(str));
  1638. }
  1639. }
  1640. class NullStream extends Stream {
  1641. constructor() {
  1642. super(new Uint8Array(0));
  1643. }
  1644. }
  1645. ;// ./src/core/chunked_stream.js
  1646. class ChunkedStream extends Stream {
  1647. constructor(length, chunkSize, manager) {
  1648. super(new Uint8Array(length), 0, length, null);
  1649. this.chunkSize = chunkSize;
  1650. this._loadedChunks = new Set();
  1651. this.numChunks = Math.ceil(length / chunkSize);
  1652. this.manager = manager;
  1653. this.progressiveDataLength = 0;
  1654. this.lastSuccessfulEnsureByteChunk = -1;
  1655. }
  1656. getMissingChunks() {
  1657. const chunks = [];
  1658. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1659. if (!this._loadedChunks.has(chunk)) {
  1660. chunks.push(chunk);
  1661. }
  1662. }
  1663. return chunks;
  1664. }
  1665. get numChunksLoaded() {
  1666. return this._loadedChunks.size;
  1667. }
  1668. get isDataLoaded() {
  1669. return this.numChunksLoaded === this.numChunks;
  1670. }
  1671. onReceiveData(begin, chunk) {
  1672. const chunkSize = this.chunkSize;
  1673. if (begin % chunkSize !== 0) {
  1674. throw new Error(`Bad begin offset: ${begin}`);
  1675. }
  1676. const end = begin + chunk.byteLength;
  1677. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1678. throw new Error(`Bad end offset: ${end}`);
  1679. }
  1680. this.bytes.set(new Uint8Array(chunk), begin);
  1681. const beginChunk = Math.floor(begin / chunkSize);
  1682. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1683. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1684. this._loadedChunks.add(curChunk);
  1685. }
  1686. }
  1687. onReceiveProgressiveData(data) {
  1688. let position = this.progressiveDataLength;
  1689. const beginChunk = Math.floor(position / this.chunkSize);
  1690. this.bytes.set(new Uint8Array(data), position);
  1691. position += data.byteLength;
  1692. this.progressiveDataLength = position;
  1693. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  1694. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1695. this._loadedChunks.add(curChunk);
  1696. }
  1697. }
  1698. ensureByte(pos) {
  1699. if (pos < this.progressiveDataLength) {
  1700. return;
  1701. }
  1702. const chunk = Math.floor(pos / this.chunkSize);
  1703. if (chunk > this.numChunks) {
  1704. return;
  1705. }
  1706. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  1707. return;
  1708. }
  1709. if (!this._loadedChunks.has(chunk)) {
  1710. throw new MissingDataException(pos, pos + 1);
  1711. }
  1712. this.lastSuccessfulEnsureByteChunk = chunk;
  1713. }
  1714. ensureRange(begin, end) {
  1715. if (begin >= end) {
  1716. return;
  1717. }
  1718. if (end <= this.progressiveDataLength) {
  1719. return;
  1720. }
  1721. const beginChunk = Math.floor(begin / this.chunkSize);
  1722. if (beginChunk > this.numChunks) {
  1723. return;
  1724. }
  1725. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  1726. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1727. if (!this._loadedChunks.has(chunk)) {
  1728. throw new MissingDataException(begin, end);
  1729. }
  1730. }
  1731. }
  1732. nextEmptyChunk(beginChunk) {
  1733. const numChunks = this.numChunks;
  1734. for (let i = 0; i < numChunks; ++i) {
  1735. const chunk = (beginChunk + i) % numChunks;
  1736. if (!this._loadedChunks.has(chunk)) {
  1737. return chunk;
  1738. }
  1739. }
  1740. return null;
  1741. }
  1742. hasChunk(chunk) {
  1743. return this._loadedChunks.has(chunk);
  1744. }
  1745. getByte() {
  1746. const pos = this.pos;
  1747. if (pos >= this.end) {
  1748. return -1;
  1749. }
  1750. if (pos >= this.progressiveDataLength) {
  1751. this.ensureByte(pos);
  1752. }
  1753. return this.bytes[this.pos++];
  1754. }
  1755. getBytes(length) {
  1756. const bytes = this.bytes;
  1757. const pos = this.pos;
  1758. const strEnd = this.end;
  1759. if (!length) {
  1760. if (strEnd > this.progressiveDataLength) {
  1761. this.ensureRange(pos, strEnd);
  1762. }
  1763. return bytes.subarray(pos, strEnd);
  1764. }
  1765. let end = pos + length;
  1766. if (end > strEnd) {
  1767. end = strEnd;
  1768. }
  1769. if (end > this.progressiveDataLength) {
  1770. this.ensureRange(pos, end);
  1771. }
  1772. this.pos = end;
  1773. return bytes.subarray(pos, end);
  1774. }
  1775. getByteRange(begin, end) {
  1776. if (begin < 0) {
  1777. begin = 0;
  1778. }
  1779. if (end > this.end) {
  1780. end = this.end;
  1781. }
  1782. if (end > this.progressiveDataLength) {
  1783. this.ensureRange(begin, end);
  1784. }
  1785. return this.bytes.subarray(begin, end);
  1786. }
  1787. makeSubStream(start, length, dict = null) {
  1788. if (length) {
  1789. if (start + length > this.progressiveDataLength) {
  1790. this.ensureRange(start, start + length);
  1791. }
  1792. } else if (start >= this.progressiveDataLength) {
  1793. this.ensureByte(start);
  1794. }
  1795. function ChunkedStreamSubstream() {}
  1796. ChunkedStreamSubstream.prototype = Object.create(this);
  1797. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  1798. const chunkSize = this.chunkSize;
  1799. const beginChunk = Math.floor(this.start / chunkSize);
  1800. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  1801. const missingChunks = [];
  1802. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1803. if (!this._loadedChunks.has(chunk)) {
  1804. missingChunks.push(chunk);
  1805. }
  1806. }
  1807. return missingChunks;
  1808. };
  1809. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  1810. get() {
  1811. if (this.numChunksLoaded === this.numChunks) {
  1812. return true;
  1813. }
  1814. return this.getMissingChunks().length === 0;
  1815. },
  1816. configurable: true
  1817. });
  1818. const subStream = new ChunkedStreamSubstream();
  1819. subStream.pos = subStream.start = start;
  1820. subStream.end = start + length || this.end;
  1821. subStream.dict = dict;
  1822. return subStream;
  1823. }
  1824. getBaseStreams() {
  1825. return [this];
  1826. }
  1827. }
  1828. class ChunkedStreamManager {
  1829. constructor(pdfNetworkStream, args) {
  1830. this.length = args.length;
  1831. this.chunkSize = args.rangeChunkSize;
  1832. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  1833. this.pdfNetworkStream = pdfNetworkStream;
  1834. this.disableAutoFetch = args.disableAutoFetch;
  1835. this.msgHandler = args.msgHandler;
  1836. this.currRequestId = 0;
  1837. this._chunksNeededByRequest = new Map();
  1838. this._requestsByChunk = new Map();
  1839. this._promisesByRequest = new Map();
  1840. this.progressiveDataLength = 0;
  1841. this.aborted = false;
  1842. this._loadedStreamCapability = Promise.withResolvers();
  1843. }
  1844. sendRequest(begin, end) {
  1845. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  1846. if (!rangeReader.isStreamingSupported) {
  1847. rangeReader.onProgress = this.onProgress.bind(this);
  1848. }
  1849. let chunks = [],
  1850. loaded = 0;
  1851. return new Promise((resolve, reject) => {
  1852. const readChunk = ({
  1853. value,
  1854. done
  1855. }) => {
  1856. try {
  1857. if (done) {
  1858. const chunkData = arrayBuffersToBytes(chunks);
  1859. chunks = null;
  1860. resolve(chunkData);
  1861. return;
  1862. }
  1863. loaded += value.byteLength;
  1864. if (rangeReader.isStreamingSupported) {
  1865. this.onProgress({
  1866. loaded
  1867. });
  1868. }
  1869. chunks.push(value);
  1870. rangeReader.read().then(readChunk, reject);
  1871. } catch (e) {
  1872. reject(e);
  1873. }
  1874. };
  1875. rangeReader.read().then(readChunk, reject);
  1876. }).then(data => {
  1877. if (this.aborted) {
  1878. return;
  1879. }
  1880. this.onReceiveData({
  1881. chunk: data,
  1882. begin
  1883. });
  1884. });
  1885. }
  1886. requestAllChunks(noFetch = false) {
  1887. if (!noFetch) {
  1888. const missingChunks = this.stream.getMissingChunks();
  1889. this._requestChunks(missingChunks);
  1890. }
  1891. return this._loadedStreamCapability.promise;
  1892. }
  1893. _requestChunks(chunks) {
  1894. const requestId = this.currRequestId++;
  1895. const chunksNeeded = new Set();
  1896. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  1897. for (const chunk of chunks) {
  1898. if (!this.stream.hasChunk(chunk)) {
  1899. chunksNeeded.add(chunk);
  1900. }
  1901. }
  1902. if (chunksNeeded.size === 0) {
  1903. return Promise.resolve();
  1904. }
  1905. const capability = Promise.withResolvers();
  1906. this._promisesByRequest.set(requestId, capability);
  1907. const chunksToRequest = [];
  1908. for (const chunk of chunksNeeded) {
  1909. let requestIds = this._requestsByChunk.get(chunk);
  1910. if (!requestIds) {
  1911. requestIds = [];
  1912. this._requestsByChunk.set(chunk, requestIds);
  1913. chunksToRequest.push(chunk);
  1914. }
  1915. requestIds.push(requestId);
  1916. }
  1917. if (chunksToRequest.length > 0) {
  1918. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  1919. for (const groupedChunk of groupedChunksToRequest) {
  1920. const begin = groupedChunk.beginChunk * this.chunkSize;
  1921. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  1922. this.sendRequest(begin, end).catch(capability.reject);
  1923. }
  1924. }
  1925. return capability.promise.catch(reason => {
  1926. if (this.aborted) {
  1927. return;
  1928. }
  1929. throw reason;
  1930. });
  1931. }
  1932. getStream() {
  1933. return this.stream;
  1934. }
  1935. requestRange(begin, end) {
  1936. end = Math.min(end, this.length);
  1937. const beginChunk = this.getBeginChunk(begin);
  1938. const endChunk = this.getEndChunk(end);
  1939. const chunks = [];
  1940. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1941. chunks.push(chunk);
  1942. }
  1943. return this._requestChunks(chunks);
  1944. }
  1945. requestRanges(ranges = []) {
  1946. const chunksToRequest = [];
  1947. for (const range of ranges) {
  1948. const beginChunk = this.getBeginChunk(range.begin);
  1949. const endChunk = this.getEndChunk(range.end);
  1950. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  1951. if (!chunksToRequest.includes(chunk)) {
  1952. chunksToRequest.push(chunk);
  1953. }
  1954. }
  1955. }
  1956. chunksToRequest.sort(function (a, b) {
  1957. return a - b;
  1958. });
  1959. return this._requestChunks(chunksToRequest);
  1960. }
  1961. groupChunks(chunks) {
  1962. const groupedChunks = [];
  1963. let beginChunk = -1;
  1964. let prevChunk = -1;
  1965. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  1966. const chunk = chunks[i];
  1967. if (beginChunk < 0) {
  1968. beginChunk = chunk;
  1969. }
  1970. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  1971. groupedChunks.push({
  1972. beginChunk,
  1973. endChunk: prevChunk + 1
  1974. });
  1975. beginChunk = chunk;
  1976. }
  1977. if (i + 1 === chunks.length) {
  1978. groupedChunks.push({
  1979. beginChunk,
  1980. endChunk: chunk + 1
  1981. });
  1982. }
  1983. prevChunk = chunk;
  1984. }
  1985. return groupedChunks;
  1986. }
  1987. onProgress(args) {
  1988. this.msgHandler.send("DocProgress", {
  1989. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  1990. total: this.length
  1991. });
  1992. }
  1993. onReceiveData(args) {
  1994. const chunk = args.chunk;
  1995. const isProgressive = args.begin === undefined;
  1996. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  1997. const end = begin + chunk.byteLength;
  1998. const beginChunk = Math.floor(begin / this.chunkSize);
  1999. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2000. if (isProgressive) {
  2001. this.stream.onReceiveProgressiveData(chunk);
  2002. this.progressiveDataLength = end;
  2003. } else {
  2004. this.stream.onReceiveData(begin, chunk);
  2005. }
  2006. if (this.stream.isDataLoaded) {
  2007. this._loadedStreamCapability.resolve(this.stream);
  2008. }
  2009. const loadedRequests = [];
  2010. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2011. const requestIds = this._requestsByChunk.get(curChunk);
  2012. if (!requestIds) {
  2013. continue;
  2014. }
  2015. this._requestsByChunk.delete(curChunk);
  2016. for (const requestId of requestIds) {
  2017. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2018. if (chunksNeeded.has(curChunk)) {
  2019. chunksNeeded.delete(curChunk);
  2020. }
  2021. if (chunksNeeded.size > 0) {
  2022. continue;
  2023. }
  2024. loadedRequests.push(requestId);
  2025. }
  2026. }
  2027. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2028. let nextEmptyChunk;
  2029. if (this.stream.numChunksLoaded === 1) {
  2030. const lastChunk = this.stream.numChunks - 1;
  2031. if (!this.stream.hasChunk(lastChunk)) {
  2032. nextEmptyChunk = lastChunk;
  2033. }
  2034. } else {
  2035. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2036. }
  2037. if (Number.isInteger(nextEmptyChunk)) {
  2038. this._requestChunks([nextEmptyChunk]);
  2039. }
  2040. }
  2041. for (const requestId of loadedRequests) {
  2042. const capability = this._promisesByRequest.get(requestId);
  2043. this._promisesByRequest.delete(requestId);
  2044. capability.resolve();
  2045. }
  2046. this.msgHandler.send("DocProgress", {
  2047. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2048. total: this.length
  2049. });
  2050. }
  2051. onError(err) {
  2052. this._loadedStreamCapability.reject(err);
  2053. }
  2054. getBeginChunk(begin) {
  2055. return Math.floor(begin / this.chunkSize);
  2056. }
  2057. getEndChunk(end) {
  2058. return Math.floor((end - 1) / this.chunkSize) + 1;
  2059. }
  2060. abort(reason) {
  2061. this.aborted = true;
  2062. this.pdfNetworkStream?.cancelAllRequests(reason);
  2063. for (const capability of this._promisesByRequest.values()) {
  2064. capability.reject(reason);
  2065. }
  2066. }
  2067. }
  2068. ;// ./src/core/colorspace.js
  2069. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  2070. const COMPONENTS = 3;
  2071. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  2072. const xRatio = w1 / w2;
  2073. const yRatio = h1 / h2;
  2074. let newIndex = 0,
  2075. oldIndex;
  2076. const xScaled = new Uint16Array(w2);
  2077. const w1Scanline = w1 * COMPONENTS;
  2078. for (let i = 0; i < w2; i++) {
  2079. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  2080. }
  2081. for (let i = 0; i < h2; i++) {
  2082. const py = Math.floor(i * yRatio) * w1Scanline;
  2083. for (let j = 0; j < w2; j++) {
  2084. oldIndex = py + xScaled[j];
  2085. dest[newIndex++] = src[oldIndex++];
  2086. dest[newIndex++] = src[oldIndex++];
  2087. dest[newIndex++] = src[oldIndex++];
  2088. newIndex += alpha01;
  2089. }
  2090. }
  2091. }
  2092. function resizeRgbaImage(src, dest, w1, h1, w2, h2, alpha01) {
  2093. const xRatio = w1 / w2;
  2094. const yRatio = h1 / h2;
  2095. let newIndex = 0;
  2096. const xScaled = new Uint16Array(w2);
  2097. if (alpha01 === 1) {
  2098. for (let i = 0; i < w2; i++) {
  2099. xScaled[i] = Math.floor(i * xRatio);
  2100. }
  2101. const src32 = new Uint32Array(src.buffer);
  2102. const dest32 = new Uint32Array(dest.buffer);
  2103. const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00;
  2104. for (let i = 0; i < h2; i++) {
  2105. const buf = src32.subarray(Math.floor(i * yRatio) * w1);
  2106. for (let j = 0; j < w2; j++) {
  2107. dest32[newIndex++] |= buf[xScaled[j]] & rgbMask;
  2108. }
  2109. }
  2110. } else {
  2111. const COMPONENTS = 4;
  2112. const w1Scanline = w1 * COMPONENTS;
  2113. for (let i = 0; i < w2; i++) {
  2114. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  2115. }
  2116. for (let i = 0; i < h2; i++) {
  2117. const buf = src.subarray(Math.floor(i * yRatio) * w1Scanline);
  2118. for (let j = 0; j < w2; j++) {
  2119. const oldIndex = xScaled[j];
  2120. dest[newIndex++] = buf[oldIndex];
  2121. dest[newIndex++] = buf[oldIndex + 1];
  2122. dest[newIndex++] = buf[oldIndex + 2];
  2123. }
  2124. }
  2125. }
  2126. }
  2127. function copyRgbaImage(src, dest, alpha01) {
  2128. if (alpha01 === 1) {
  2129. const src32 = new Uint32Array(src.buffer);
  2130. const dest32 = new Uint32Array(dest.buffer);
  2131. const rgbMask = FeatureTest.isLittleEndian ? 0x00ffffff : 0xffffff00;
  2132. for (let i = 0, ii = src32.length; i < ii; i++) {
  2133. dest32[i] |= src32[i] & rgbMask;
  2134. }
  2135. } else {
  2136. let j = 0;
  2137. for (let i = 0, ii = src.length; i < ii; i += 4) {
  2138. dest[j++] = src[i];
  2139. dest[j++] = src[i + 1];
  2140. dest[j++] = src[i + 2];
  2141. }
  2142. }
  2143. }
  2144. class ColorSpace {
  2145. constructor(name, numComps) {
  2146. this.name = name;
  2147. this.numComps = numComps;
  2148. }
  2149. getRgb(src, srcOffset) {
  2150. const rgb = new Uint8ClampedArray(3);
  2151. this.getRgbItem(src, srcOffset, rgb, 0);
  2152. return rgb;
  2153. }
  2154. getRgbItem(src, srcOffset, dest, destOffset) {
  2155. unreachable("Should not call ColorSpace.getRgbItem");
  2156. }
  2157. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2158. unreachable("Should not call ColorSpace.getRgbBuffer");
  2159. }
  2160. getOutputLength(inputLength, alpha01) {
  2161. unreachable("Should not call ColorSpace.getOutputLength");
  2162. }
  2163. isPassthrough(bits) {
  2164. return false;
  2165. }
  2166. isDefaultDecode(decodeMap, bpc) {
  2167. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  2168. }
  2169. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  2170. const count = originalWidth * originalHeight;
  2171. let rgbBuf = null;
  2172. const numComponentColors = 1 << bpc;
  2173. const needsResizing = originalHeight !== height || originalWidth !== width;
  2174. if (this.isPassthrough(bpc)) {
  2175. rgbBuf = comps;
  2176. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  2177. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  2178. for (let i = 0; i < numComponentColors; i++) {
  2179. allColors[i] = i;
  2180. }
  2181. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  2182. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  2183. if (!needsResizing) {
  2184. let destPos = 0;
  2185. for (let i = 0; i < count; ++i) {
  2186. const key = comps[i] * 3;
  2187. dest[destPos++] = colorMap[key];
  2188. dest[destPos++] = colorMap[key + 1];
  2189. dest[destPos++] = colorMap[key + 2];
  2190. destPos += alpha01;
  2191. }
  2192. } else {
  2193. rgbBuf = new Uint8Array(count * 3);
  2194. let rgbPos = 0;
  2195. for (let i = 0; i < count; ++i) {
  2196. const key = comps[i] * 3;
  2197. rgbBuf[rgbPos++] = colorMap[key];
  2198. rgbBuf[rgbPos++] = colorMap[key + 1];
  2199. rgbBuf[rgbPos++] = colorMap[key + 2];
  2200. }
  2201. }
  2202. } else if (!needsResizing) {
  2203. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  2204. } else {
  2205. rgbBuf = new Uint8ClampedArray(count * 3);
  2206. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  2207. }
  2208. if (rgbBuf) {
  2209. if (needsResizing) {
  2210. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  2211. } else {
  2212. let destPos = 0,
  2213. rgbPos = 0;
  2214. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  2215. dest[destPos++] = rgbBuf[rgbPos++];
  2216. dest[destPos++] = rgbBuf[rgbPos++];
  2217. dest[destPos++] = rgbBuf[rgbPos++];
  2218. destPos += alpha01;
  2219. }
  2220. }
  2221. }
  2222. }
  2223. get usesZeroToOneRange() {
  2224. return shadow(this, "usesZeroToOneRange", true);
  2225. }
  2226. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  2227. if (!localColorSpaceCache) {
  2228. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  2229. }
  2230. if (!parsedColorSpace) {
  2231. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  2232. }
  2233. let csName, csRef;
  2234. if (cacheKey instanceof Ref) {
  2235. csRef = cacheKey;
  2236. cacheKey = xref.fetch(cacheKey);
  2237. }
  2238. if (cacheKey instanceof Name) {
  2239. csName = cacheKey.name;
  2240. }
  2241. if (csName || csRef) {
  2242. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  2243. }
  2244. }
  2245. static getCached(cacheKey, xref, localColorSpaceCache) {
  2246. if (!localColorSpaceCache) {
  2247. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  2248. }
  2249. if (cacheKey instanceof Ref) {
  2250. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  2251. if (localColorSpace) {
  2252. return localColorSpace;
  2253. }
  2254. try {
  2255. cacheKey = xref.fetch(cacheKey);
  2256. } catch (ex) {
  2257. if (ex instanceof MissingDataException) {
  2258. throw ex;
  2259. }
  2260. }
  2261. }
  2262. if (cacheKey instanceof Name) {
  2263. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  2264. if (localColorSpace) {
  2265. return localColorSpace;
  2266. }
  2267. }
  2268. return null;
  2269. }
  2270. static async parseAsync({
  2271. cs,
  2272. xref,
  2273. resources = null,
  2274. pdfFunctionFactory,
  2275. localColorSpaceCache
  2276. }) {
  2277. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  2278. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  2279. return parsedColorSpace;
  2280. }
  2281. static parse({
  2282. cs,
  2283. xref,
  2284. resources = null,
  2285. pdfFunctionFactory,
  2286. localColorSpaceCache
  2287. }) {
  2288. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  2289. if (cachedColorSpace) {
  2290. return cachedColorSpace;
  2291. }
  2292. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  2293. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  2294. return parsedColorSpace;
  2295. }
  2296. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  2297. cs = xref.fetchIfRef(cs);
  2298. if (cs instanceof Name) {
  2299. switch (cs.name) {
  2300. case "G":
  2301. case "DeviceGray":
  2302. return this.singletons.gray;
  2303. case "RGB":
  2304. case "DeviceRGB":
  2305. return this.singletons.rgb;
  2306. case "DeviceRGBA":
  2307. return this.singletons.rgba;
  2308. case "CMYK":
  2309. case "DeviceCMYK":
  2310. return this.singletons.cmyk;
  2311. case "Pattern":
  2312. return new PatternCS(null);
  2313. default:
  2314. if (resources instanceof Dict) {
  2315. const colorSpaces = resources.get("ColorSpace");
  2316. if (colorSpaces instanceof Dict) {
  2317. const resourcesCS = colorSpaces.get(cs.name);
  2318. if (resourcesCS) {
  2319. if (resourcesCS instanceof Name) {
  2320. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  2321. }
  2322. cs = resourcesCS;
  2323. break;
  2324. }
  2325. }
  2326. }
  2327. warn(`Unrecognized ColorSpace: ${cs.name}`);
  2328. return this.singletons.gray;
  2329. }
  2330. }
  2331. if (Array.isArray(cs)) {
  2332. const mode = xref.fetchIfRef(cs[0]).name;
  2333. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  2334. switch (mode) {
  2335. case "G":
  2336. case "DeviceGray":
  2337. return this.singletons.gray;
  2338. case "RGB":
  2339. case "DeviceRGB":
  2340. return this.singletons.rgb;
  2341. case "CMYK":
  2342. case "DeviceCMYK":
  2343. return this.singletons.cmyk;
  2344. case "CalGray":
  2345. params = xref.fetchIfRef(cs[1]);
  2346. whitePoint = params.getArray("WhitePoint");
  2347. blackPoint = params.getArray("BlackPoint");
  2348. gamma = params.get("Gamma");
  2349. return new CalGrayCS(whitePoint, blackPoint, gamma);
  2350. case "CalRGB":
  2351. params = xref.fetchIfRef(cs[1]);
  2352. whitePoint = params.getArray("WhitePoint");
  2353. blackPoint = params.getArray("BlackPoint");
  2354. gamma = params.getArray("Gamma");
  2355. const matrix = params.getArray("Matrix");
  2356. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  2357. case "ICCBased":
  2358. const stream = xref.fetchIfRef(cs[1]);
  2359. const dict = stream.dict;
  2360. numComps = dict.get("N");
  2361. const alt = dict.get("Alternate");
  2362. if (alt) {
  2363. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  2364. if (altCS.numComps === numComps) {
  2365. return altCS;
  2366. }
  2367. warn("ICCBased color space: Ignoring incorrect /Alternate entry.");
  2368. }
  2369. if (numComps === 1) {
  2370. return this.singletons.gray;
  2371. } else if (numComps === 3) {
  2372. return this.singletons.rgb;
  2373. } else if (numComps === 4) {
  2374. return this.singletons.cmyk;
  2375. }
  2376. break;
  2377. case "Pattern":
  2378. baseCS = cs[1] || null;
  2379. if (baseCS) {
  2380. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  2381. }
  2382. return new PatternCS(baseCS);
  2383. case "I":
  2384. case "Indexed":
  2385. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  2386. const hiVal = Math.max(0, Math.min(xref.fetchIfRef(cs[2]), 255));
  2387. const lookup = xref.fetchIfRef(cs[3]);
  2388. return new IndexedCS(baseCS, hiVal, lookup);
  2389. case "Separation":
  2390. case "DeviceN":
  2391. const name = xref.fetchIfRef(cs[1]);
  2392. numComps = Array.isArray(name) ? name.length : 1;
  2393. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  2394. const tintFn = pdfFunctionFactory.create(cs[3]);
  2395. return new AlternateCS(numComps, baseCS, tintFn);
  2396. case "Lab":
  2397. params = xref.fetchIfRef(cs[1]);
  2398. whitePoint = params.getArray("WhitePoint");
  2399. blackPoint = params.getArray("BlackPoint");
  2400. const range = params.getArray("Range");
  2401. return new LabCS(whitePoint, blackPoint, range);
  2402. default:
  2403. warn(`Unimplemented ColorSpace object: ${mode}`);
  2404. return this.singletons.gray;
  2405. }
  2406. }
  2407. warn(`Unrecognized ColorSpace object: ${cs}`);
  2408. return this.singletons.gray;
  2409. }
  2410. static isDefaultDecode(decode, numComps) {
  2411. if (!Array.isArray(decode)) {
  2412. return true;
  2413. }
  2414. if (numComps * 2 !== decode.length) {
  2415. warn("The decode map is not the correct length");
  2416. return true;
  2417. }
  2418. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  2419. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  2420. return false;
  2421. }
  2422. }
  2423. return true;
  2424. }
  2425. static get singletons() {
  2426. return shadow(this, "singletons", {
  2427. get gray() {
  2428. return shadow(this, "gray", new DeviceGrayCS());
  2429. },
  2430. get rgb() {
  2431. return shadow(this, "rgb", new DeviceRgbCS());
  2432. },
  2433. get rgba() {
  2434. return shadow(this, "rgba", new DeviceRgbaCS());
  2435. },
  2436. get cmyk() {
  2437. return shadow(this, "cmyk", new DeviceCmykCS());
  2438. }
  2439. });
  2440. }
  2441. }
  2442. class AlternateCS extends ColorSpace {
  2443. constructor(numComps, base, tintFn) {
  2444. super("Alternate", numComps);
  2445. this.base = base;
  2446. this.tintFn = tintFn;
  2447. this.tmpBuf = new Float32Array(base.numComps);
  2448. }
  2449. getRgbItem(src, srcOffset, dest, destOffset) {
  2450. const tmpBuf = this.tmpBuf;
  2451. this.tintFn(src, srcOffset, tmpBuf, 0);
  2452. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  2453. }
  2454. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2455. const tintFn = this.tintFn;
  2456. const base = this.base;
  2457. const scale = 1 / ((1 << bits) - 1);
  2458. const baseNumComps = base.numComps;
  2459. const usesZeroToOneRange = base.usesZeroToOneRange;
  2460. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  2461. let pos = isPassthrough ? destOffset : 0;
  2462. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  2463. const numComps = this.numComps;
  2464. const scaled = new Float32Array(numComps);
  2465. const tinted = new Float32Array(baseNumComps);
  2466. let i, j;
  2467. for (i = 0; i < count; i++) {
  2468. for (j = 0; j < numComps; j++) {
  2469. scaled[j] = src[srcOffset++] * scale;
  2470. }
  2471. tintFn(scaled, 0, tinted, 0);
  2472. if (usesZeroToOneRange) {
  2473. for (j = 0; j < baseNumComps; j++) {
  2474. baseBuf[pos++] = tinted[j] * 255;
  2475. }
  2476. } else {
  2477. base.getRgbItem(tinted, 0, baseBuf, pos);
  2478. pos += baseNumComps;
  2479. }
  2480. }
  2481. if (!isPassthrough) {
  2482. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  2483. }
  2484. }
  2485. getOutputLength(inputLength, alpha01) {
  2486. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  2487. }
  2488. }
  2489. class PatternCS extends ColorSpace {
  2490. constructor(baseCS) {
  2491. super("Pattern", null);
  2492. this.base = baseCS;
  2493. }
  2494. isDefaultDecode(decodeMap, bpc) {
  2495. unreachable("Should not call PatternCS.isDefaultDecode");
  2496. }
  2497. }
  2498. class IndexedCS extends ColorSpace {
  2499. constructor(base, highVal, lookup) {
  2500. super("Indexed", 1);
  2501. this.base = base;
  2502. const length = base.numComps * (highVal + 1);
  2503. this.lookup = new Uint8Array(length);
  2504. if (lookup instanceof BaseStream) {
  2505. const bytes = lookup.getBytes(length);
  2506. this.lookup.set(bytes);
  2507. } else if (typeof lookup === "string") {
  2508. for (let i = 0; i < length; ++i) {
  2509. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  2510. }
  2511. } else {
  2512. throw new FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  2513. }
  2514. }
  2515. getRgbItem(src, srcOffset, dest, destOffset) {
  2516. const numComps = this.base.numComps;
  2517. const start = src[srcOffset] * numComps;
  2518. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  2519. }
  2520. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2521. const base = this.base;
  2522. const numComps = base.numComps;
  2523. const outputDelta = base.getOutputLength(numComps, alpha01);
  2524. const lookup = this.lookup;
  2525. for (let i = 0; i < count; ++i) {
  2526. const lookupPos = src[srcOffset++] * numComps;
  2527. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  2528. destOffset += outputDelta;
  2529. }
  2530. }
  2531. getOutputLength(inputLength, alpha01) {
  2532. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  2533. }
  2534. isDefaultDecode(decodeMap, bpc) {
  2535. if (!Array.isArray(decodeMap)) {
  2536. return true;
  2537. }
  2538. if (decodeMap.length !== 2) {
  2539. warn("Decode map length is not correct");
  2540. return true;
  2541. }
  2542. if (!Number.isInteger(bpc) || bpc < 1) {
  2543. warn("Bits per component is not correct");
  2544. return true;
  2545. }
  2546. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  2547. }
  2548. }
  2549. class DeviceGrayCS extends ColorSpace {
  2550. constructor() {
  2551. super("DeviceGray", 1);
  2552. }
  2553. getRgbItem(src, srcOffset, dest, destOffset) {
  2554. const c = src[srcOffset] * 255;
  2555. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  2556. }
  2557. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2558. const scale = 255 / ((1 << bits) - 1);
  2559. let j = srcOffset,
  2560. q = destOffset;
  2561. for (let i = 0; i < count; ++i) {
  2562. const c = scale * src[j++];
  2563. dest[q++] = c;
  2564. dest[q++] = c;
  2565. dest[q++] = c;
  2566. q += alpha01;
  2567. }
  2568. }
  2569. getOutputLength(inputLength, alpha01) {
  2570. return inputLength * (3 + alpha01);
  2571. }
  2572. }
  2573. class DeviceRgbCS extends ColorSpace {
  2574. constructor() {
  2575. super("DeviceRGB", 3);
  2576. }
  2577. getRgbItem(src, srcOffset, dest, destOffset) {
  2578. dest[destOffset] = src[srcOffset] * 255;
  2579. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  2580. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  2581. }
  2582. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2583. if (bits === 8 && alpha01 === 0) {
  2584. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  2585. return;
  2586. }
  2587. const scale = 255 / ((1 << bits) - 1);
  2588. let j = srcOffset,
  2589. q = destOffset;
  2590. for (let i = 0; i < count; ++i) {
  2591. dest[q++] = scale * src[j++];
  2592. dest[q++] = scale * src[j++];
  2593. dest[q++] = scale * src[j++];
  2594. q += alpha01;
  2595. }
  2596. }
  2597. getOutputLength(inputLength, alpha01) {
  2598. return inputLength * (3 + alpha01) / 3 | 0;
  2599. }
  2600. isPassthrough(bits) {
  2601. return bits === 8;
  2602. }
  2603. }
  2604. class DeviceRgbaCS extends ColorSpace {
  2605. constructor() {
  2606. super("DeviceRGBA", 4);
  2607. }
  2608. getOutputLength(inputLength, _alpha01) {
  2609. return inputLength * 4;
  2610. }
  2611. isPassthrough(bits) {
  2612. return bits === 8;
  2613. }
  2614. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  2615. if (originalHeight !== height || originalWidth !== width) {
  2616. resizeRgbaImage(comps, dest, originalWidth, originalHeight, width, height, alpha01);
  2617. } else {
  2618. copyRgbaImage(comps, dest, alpha01);
  2619. }
  2620. }
  2621. }
  2622. class DeviceCmykCS extends ColorSpace {
  2623. constructor() {
  2624. super("DeviceCMYK", 4);
  2625. }
  2626. #toRgb(src, srcOffset, srcScale, dest, destOffset) {
  2627. const c = src[srcOffset] * srcScale;
  2628. const m = src[srcOffset + 1] * srcScale;
  2629. const y = src[srcOffset + 2] * srcScale;
  2630. const k = src[srcOffset + 3] * srcScale;
  2631. dest[destOffset] = 255 + c * (-4.387332384609988 * c + 54.48615194189176 * m + 18.82290502165302 * y + 212.25662451639585 * k + -285.2331026137004) + m * (1.7149763477362134 * m - 5.6096736904047315 * y + -17.873870861415444 * k - 5.497006427196366) + y * (-2.5217340131683033 * y - 21.248923337353073 * k + 17.5119270841813) + k * (-21.86122147463605 * k - 189.48180835922747);
  2632. dest[destOffset + 1] = 255 + c * (8.841041422036149 * c + 60.118027045597366 * m + 6.871425592049007 * y + 31.159100130055922 * k + -79.2970844816548) + m * (-15.310361306967817 * m + 17.575251261109482 * y + 131.35250912493976 * k - 190.9453302588951) + y * (4.444339102852739 * y + 9.8632861493405 * k - 24.86741582555878) + k * (-20.737325471181034 * k - 187.80453709719578);
  2633. dest[destOffset + 2] = 255 + c * (0.8842522430003296 * c + 8.078677503112928 * m + 30.89978309703729 * y - 0.23883238689178934 * k + -14.183576799673286) + m * (10.49593273432072 * m + 63.02378494754052 * y + 50.606957656360734 * k - 112.23884253719248) + y * (0.03296041114873217 * y + 115.60384449646641 * k + -193.58209356861505) + k * (-22.33816807309886 * k - 180.12613974708367);
  2634. }
  2635. getRgbItem(src, srcOffset, dest, destOffset) {
  2636. this.#toRgb(src, srcOffset, 1, dest, destOffset);
  2637. }
  2638. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2639. const scale = 1 / ((1 << bits) - 1);
  2640. for (let i = 0; i < count; i++) {
  2641. this.#toRgb(src, srcOffset, scale, dest, destOffset);
  2642. srcOffset += 4;
  2643. destOffset += 3 + alpha01;
  2644. }
  2645. }
  2646. getOutputLength(inputLength, alpha01) {
  2647. return inputLength / 4 * (3 + alpha01) | 0;
  2648. }
  2649. }
  2650. class CalGrayCS extends ColorSpace {
  2651. constructor(whitePoint, blackPoint, gamma) {
  2652. super("CalGray", 1);
  2653. if (!whitePoint) {
  2654. throw new FormatError("WhitePoint missing - required for color space CalGray");
  2655. }
  2656. [this.XW, this.YW, this.ZW] = whitePoint;
  2657. [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
  2658. this.G = gamma || 1;
  2659. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  2660. throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
  2661. }
  2662. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  2663. info(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  2664. this.XB = this.YB = this.ZB = 0;
  2665. }
  2666. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  2667. warn(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  2668. }
  2669. if (this.G < 1) {
  2670. info(`Invalid Gamma: ${this.G} for ${this.name}, falling back to default.`);
  2671. this.G = 1;
  2672. }
  2673. }
  2674. #toRgb(src, srcOffset, dest, destOffset, scale) {
  2675. const A = src[srcOffset] * scale;
  2676. const AG = A ** this.G;
  2677. const L = this.YW * AG;
  2678. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  2679. dest[destOffset] = val;
  2680. dest[destOffset + 1] = val;
  2681. dest[destOffset + 2] = val;
  2682. }
  2683. getRgbItem(src, srcOffset, dest, destOffset) {
  2684. this.#toRgb(src, srcOffset, dest, destOffset, 1);
  2685. }
  2686. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2687. const scale = 1 / ((1 << bits) - 1);
  2688. for (let i = 0; i < count; ++i) {
  2689. this.#toRgb(src, srcOffset, dest, destOffset, scale);
  2690. srcOffset += 1;
  2691. destOffset += 3 + alpha01;
  2692. }
  2693. }
  2694. getOutputLength(inputLength, alpha01) {
  2695. return inputLength * (3 + alpha01);
  2696. }
  2697. }
  2698. class CalRGBCS extends ColorSpace {
  2699. static #BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  2700. static #BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  2701. static #SRGB_D65_XYZ_TO_RGB_MATRIX = new Float32Array([3.2404542, -1.5371385, -0.4985314, -0.9692660, 1.8760108, 0.0415560, 0.0556434, -0.2040259, 1.0572252]);
  2702. static #FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  2703. static #tempNormalizeMatrix = new Float32Array(3);
  2704. static #tempConvertMatrix1 = new Float32Array(3);
  2705. static #tempConvertMatrix2 = new Float32Array(3);
  2706. static #DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  2707. constructor(whitePoint, blackPoint, gamma, matrix) {
  2708. super("CalRGB", 3);
  2709. if (!whitePoint) {
  2710. throw new FormatError("WhitePoint missing - required for color space CalRGB");
  2711. }
  2712. const [XW, YW, ZW] = this.whitePoint = whitePoint;
  2713. const [XB, YB, ZB] = this.blackPoint = blackPoint || new Float32Array(3);
  2714. [this.GR, this.GG, this.GB] = gamma || new Float32Array([1, 1, 1]);
  2715. [this.MXA, this.MYA, this.MZA, this.MXB, this.MYB, this.MZB, this.MXC, this.MYC, this.MZC] = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  2716. if (XW < 0 || ZW < 0 || YW !== 1) {
  2717. throw new FormatError(`Invalid WhitePoint components for ${this.name}, no fallback available`);
  2718. }
  2719. if (XB < 0 || YB < 0 || ZB < 0) {
  2720. info(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  2721. this.blackPoint = new Float32Array(3);
  2722. }
  2723. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  2724. info(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  2725. this.GR = this.GG = this.GB = 1;
  2726. }
  2727. }
  2728. #matrixProduct(a, b, result) {
  2729. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  2730. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  2731. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  2732. }
  2733. #toFlat(sourceWhitePoint, LMS, result) {
  2734. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  2735. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  2736. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  2737. }
  2738. #toD65(sourceWhitePoint, LMS, result) {
  2739. const D65X = 0.95047;
  2740. const D65Y = 1;
  2741. const D65Z = 1.08883;
  2742. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  2743. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  2744. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  2745. }
  2746. #sRGBTransferFunction(color) {
  2747. if (color <= 0.0031308) {
  2748. return this.#adjustToRange(0, 1, 12.92 * color);
  2749. }
  2750. if (color >= 0.99554525) {
  2751. return 1;
  2752. }
  2753. return this.#adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  2754. }
  2755. #adjustToRange(min, max, value) {
  2756. return Math.max(min, Math.min(max, value));
  2757. }
  2758. #decodeL(L) {
  2759. if (L < 0) {
  2760. return -this.#decodeL(-L);
  2761. }
  2762. if (L > 8.0) {
  2763. return ((L + 16) / 116) ** 3;
  2764. }
  2765. return L * CalRGBCS.#DECODE_L_CONSTANT;
  2766. }
  2767. #compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  2768. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  2769. result[0] = XYZ_Flat[0];
  2770. result[1] = XYZ_Flat[1];
  2771. result[2] = XYZ_Flat[2];
  2772. return;
  2773. }
  2774. const zeroDecodeL = this.#decodeL(0);
  2775. const X_DST = zeroDecodeL;
  2776. const X_SRC = this.#decodeL(sourceBlackPoint[0]);
  2777. const Y_DST = zeroDecodeL;
  2778. const Y_SRC = this.#decodeL(sourceBlackPoint[1]);
  2779. const Z_DST = zeroDecodeL;
  2780. const Z_SRC = this.#decodeL(sourceBlackPoint[2]);
  2781. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  2782. const X_Offset = 1 - X_Scale;
  2783. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  2784. const Y_Offset = 1 - Y_Scale;
  2785. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  2786. const Z_Offset = 1 - Z_Scale;
  2787. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  2788. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  2789. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  2790. }
  2791. #normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  2792. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  2793. result[0] = XYZ_In[0];
  2794. result[1] = XYZ_In[1];
  2795. result[2] = XYZ_In[2];
  2796. return;
  2797. }
  2798. const LMS = result;
  2799. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  2800. const LMS_Flat = CalRGBCS.#tempNormalizeMatrix;
  2801. this.#toFlat(sourceWhitePoint, LMS, LMS_Flat);
  2802. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  2803. }
  2804. #normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  2805. const LMS = result;
  2806. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  2807. const LMS_D65 = CalRGBCS.#tempNormalizeMatrix;
  2808. this.#toD65(sourceWhitePoint, LMS, LMS_D65);
  2809. this.#matrixProduct(CalRGBCS.#BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  2810. }
  2811. #toRgb(src, srcOffset, dest, destOffset, scale) {
  2812. const A = this.#adjustToRange(0, 1, src[srcOffset] * scale);
  2813. const B = this.#adjustToRange(0, 1, src[srcOffset + 1] * scale);
  2814. const C = this.#adjustToRange(0, 1, src[srcOffset + 2] * scale);
  2815. const AGR = A === 1 ? 1 : A ** this.GR;
  2816. const BGG = B === 1 ? 1 : B ** this.GG;
  2817. const CGB = C === 1 ? 1 : C ** this.GB;
  2818. const X = this.MXA * AGR + this.MXB * BGG + this.MXC * CGB;
  2819. const Y = this.MYA * AGR + this.MYB * BGG + this.MYC * CGB;
  2820. const Z = this.MZA * AGR + this.MZB * BGG + this.MZC * CGB;
  2821. const XYZ = CalRGBCS.#tempConvertMatrix1;
  2822. XYZ[0] = X;
  2823. XYZ[1] = Y;
  2824. XYZ[2] = Z;
  2825. const XYZ_Flat = CalRGBCS.#tempConvertMatrix2;
  2826. this.#normalizeWhitePointToFlat(this.whitePoint, XYZ, XYZ_Flat);
  2827. const XYZ_Black = CalRGBCS.#tempConvertMatrix1;
  2828. this.#compensateBlackPoint(this.blackPoint, XYZ_Flat, XYZ_Black);
  2829. const XYZ_D65 = CalRGBCS.#tempConvertMatrix2;
  2830. this.#normalizeWhitePointToD65(CalRGBCS.#FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  2831. const SRGB = CalRGBCS.#tempConvertMatrix1;
  2832. this.#matrixProduct(CalRGBCS.#SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  2833. dest[destOffset] = this.#sRGBTransferFunction(SRGB[0]) * 255;
  2834. dest[destOffset + 1] = this.#sRGBTransferFunction(SRGB[1]) * 255;
  2835. dest[destOffset + 2] = this.#sRGBTransferFunction(SRGB[2]) * 255;
  2836. }
  2837. getRgbItem(src, srcOffset, dest, destOffset) {
  2838. this.#toRgb(src, srcOffset, dest, destOffset, 1);
  2839. }
  2840. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2841. const scale = 1 / ((1 << bits) - 1);
  2842. for (let i = 0; i < count; ++i) {
  2843. this.#toRgb(src, srcOffset, dest, destOffset, scale);
  2844. srcOffset += 3;
  2845. destOffset += 3 + alpha01;
  2846. }
  2847. }
  2848. getOutputLength(inputLength, alpha01) {
  2849. return inputLength * (3 + alpha01) / 3 | 0;
  2850. }
  2851. }
  2852. class LabCS extends ColorSpace {
  2853. constructor(whitePoint, blackPoint, range) {
  2854. super("Lab", 3);
  2855. if (!whitePoint) {
  2856. throw new FormatError("WhitePoint missing - required for color space Lab");
  2857. }
  2858. [this.XW, this.YW, this.ZW] = whitePoint;
  2859. [this.amin, this.amax, this.bmin, this.bmax] = range || [-100, 100, -100, 100];
  2860. [this.XB, this.YB, this.ZB] = blackPoint || [0, 0, 0];
  2861. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  2862. throw new FormatError("Invalid WhitePoint components, no fallback available");
  2863. }
  2864. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  2865. info("Invalid BlackPoint, falling back to default");
  2866. this.XB = this.YB = this.ZB = 0;
  2867. }
  2868. if (this.amin > this.amax || this.bmin > this.bmax) {
  2869. info("Invalid Range, falling back to defaults");
  2870. this.amin = -100;
  2871. this.amax = 100;
  2872. this.bmin = -100;
  2873. this.bmax = 100;
  2874. }
  2875. }
  2876. #fn_g(x) {
  2877. return x >= 6 / 29 ? x ** 3 : 108 / 841 * (x - 4 / 29);
  2878. }
  2879. #decode(value, high1, low2, high2) {
  2880. return low2 + value * (high2 - low2) / high1;
  2881. }
  2882. #toRgb(src, srcOffset, maxVal, dest, destOffset) {
  2883. let Ls = src[srcOffset];
  2884. let as = src[srcOffset + 1];
  2885. let bs = src[srcOffset + 2];
  2886. if (maxVal !== false) {
  2887. Ls = this.#decode(Ls, maxVal, 0, 100);
  2888. as = this.#decode(as, maxVal, this.amin, this.amax);
  2889. bs = this.#decode(bs, maxVal, this.bmin, this.bmax);
  2890. }
  2891. if (as > this.amax) {
  2892. as = this.amax;
  2893. } else if (as < this.amin) {
  2894. as = this.amin;
  2895. }
  2896. if (bs > this.bmax) {
  2897. bs = this.bmax;
  2898. } else if (bs < this.bmin) {
  2899. bs = this.bmin;
  2900. }
  2901. const M = (Ls + 16) / 116;
  2902. const L = M + as / 500;
  2903. const N = M - bs / 200;
  2904. const X = this.XW * this.#fn_g(L);
  2905. const Y = this.YW * this.#fn_g(M);
  2906. const Z = this.ZW * this.#fn_g(N);
  2907. let r, g, b;
  2908. if (this.ZW < 1) {
  2909. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  2910. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  2911. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  2912. } else {
  2913. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  2914. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  2915. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  2916. }
  2917. dest[destOffset] = Math.sqrt(r) * 255;
  2918. dest[destOffset + 1] = Math.sqrt(g) * 255;
  2919. dest[destOffset + 2] = Math.sqrt(b) * 255;
  2920. }
  2921. getRgbItem(src, srcOffset, dest, destOffset) {
  2922. this.#toRgb(src, srcOffset, false, dest, destOffset);
  2923. }
  2924. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  2925. const maxVal = (1 << bits) - 1;
  2926. for (let i = 0; i < count; i++) {
  2927. this.#toRgb(src, srcOffset, maxVal, dest, destOffset);
  2928. srcOffset += 3;
  2929. destOffset += 3 + alpha01;
  2930. }
  2931. }
  2932. getOutputLength(inputLength, alpha01) {
  2933. return inputLength * (3 + alpha01) / 3 | 0;
  2934. }
  2935. isDefaultDecode(decodeMap, bpc) {
  2936. return true;
  2937. }
  2938. get usesZeroToOneRange() {
  2939. return shadow(this, "usesZeroToOneRange", false);
  2940. }
  2941. }
  2942. ;// ./src/core/binary_cmap.js
  2943. function hexToInt(a, size) {
  2944. let n = 0;
  2945. for (let i = 0; i <= size; i++) {
  2946. n = n << 8 | a[i];
  2947. }
  2948. return n >>> 0;
  2949. }
  2950. function hexToStr(a, size) {
  2951. if (size === 1) {
  2952. return String.fromCharCode(a[0], a[1]);
  2953. }
  2954. if (size === 3) {
  2955. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  2956. }
  2957. return String.fromCharCode(...a.subarray(0, size + 1));
  2958. }
  2959. function addHex(a, b, size) {
  2960. let c = 0;
  2961. for (let i = size; i >= 0; i--) {
  2962. c += a[i] + b[i];
  2963. a[i] = c & 255;
  2964. c >>= 8;
  2965. }
  2966. }
  2967. function incHex(a, size) {
  2968. let c = 1;
  2969. for (let i = size; i >= 0 && c > 0; i--) {
  2970. c += a[i];
  2971. a[i] = c & 255;
  2972. c >>= 8;
  2973. }
  2974. }
  2975. const MAX_NUM_SIZE = 16;
  2976. const MAX_ENCODED_NUM_SIZE = 19;
  2977. class BinaryCMapStream {
  2978. constructor(data) {
  2979. this.buffer = data;
  2980. this.pos = 0;
  2981. this.end = data.length;
  2982. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  2983. }
  2984. readByte() {
  2985. if (this.pos >= this.end) {
  2986. return -1;
  2987. }
  2988. return this.buffer[this.pos++];
  2989. }
  2990. readNumber() {
  2991. let n = 0;
  2992. let last;
  2993. do {
  2994. const b = this.readByte();
  2995. if (b < 0) {
  2996. throw new FormatError("unexpected EOF in bcmap");
  2997. }
  2998. last = !(b & 0x80);
  2999. n = n << 7 | b & 0x7f;
  3000. } while (!last);
  3001. return n;
  3002. }
  3003. readSigned() {
  3004. const n = this.readNumber();
  3005. return n & 1 ? ~(n >>> 1) : n >>> 1;
  3006. }
  3007. readHex(num, size) {
  3008. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  3009. this.pos += size + 1;
  3010. }
  3011. readHexNumber(num, size) {
  3012. let last;
  3013. const stack = this.tmpBuf;
  3014. let sp = 0;
  3015. do {
  3016. const b = this.readByte();
  3017. if (b < 0) {
  3018. throw new FormatError("unexpected EOF in bcmap");
  3019. }
  3020. last = !(b & 0x80);
  3021. stack[sp++] = b & 0x7f;
  3022. } while (!last);
  3023. let i = size,
  3024. buffer = 0,
  3025. bufferSize = 0;
  3026. while (i >= 0) {
  3027. while (bufferSize < 8 && stack.length > 0) {
  3028. buffer |= stack[--sp] << bufferSize;
  3029. bufferSize += 7;
  3030. }
  3031. num[i] = buffer & 255;
  3032. i--;
  3033. buffer >>= 8;
  3034. bufferSize -= 8;
  3035. }
  3036. }
  3037. readHexSigned(num, size) {
  3038. this.readHexNumber(num, size);
  3039. const sign = num[size] & 1 ? 255 : 0;
  3040. let c = 0;
  3041. for (let i = 0; i <= size; i++) {
  3042. c = (c & 1) << 8 | num[i];
  3043. num[i] = c >> 1 ^ sign;
  3044. }
  3045. }
  3046. readString() {
  3047. const len = this.readNumber(),
  3048. buf = new Array(len);
  3049. for (let i = 0; i < len; i++) {
  3050. buf[i] = this.readNumber();
  3051. }
  3052. return String.fromCharCode(...buf);
  3053. }
  3054. }
  3055. class BinaryCMapReader {
  3056. async process(data, cMap, extend) {
  3057. const stream = new BinaryCMapStream(data);
  3058. const header = stream.readByte();
  3059. cMap.vertical = !!(header & 1);
  3060. let useCMap = null;
  3061. const start = new Uint8Array(MAX_NUM_SIZE);
  3062. const end = new Uint8Array(MAX_NUM_SIZE);
  3063. const char = new Uint8Array(MAX_NUM_SIZE);
  3064. const charCode = new Uint8Array(MAX_NUM_SIZE);
  3065. const tmp = new Uint8Array(MAX_NUM_SIZE);
  3066. let code;
  3067. let b;
  3068. while ((b = stream.readByte()) >= 0) {
  3069. const type = b >> 5;
  3070. if (type === 7) {
  3071. switch (b & 0x1f) {
  3072. case 0:
  3073. stream.readString();
  3074. break;
  3075. case 1:
  3076. useCMap = stream.readString();
  3077. break;
  3078. }
  3079. continue;
  3080. }
  3081. const sequence = !!(b & 0x10);
  3082. const dataSize = b & 15;
  3083. if (dataSize + 1 > MAX_NUM_SIZE) {
  3084. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  3085. }
  3086. const ucs2DataSize = 1;
  3087. const subitemsCount = stream.readNumber();
  3088. switch (type) {
  3089. case 0:
  3090. stream.readHex(start, dataSize);
  3091. stream.readHexNumber(end, dataSize);
  3092. addHex(end, start, dataSize);
  3093. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  3094. for (let i = 1; i < subitemsCount; i++) {
  3095. incHex(end, dataSize);
  3096. stream.readHexNumber(start, dataSize);
  3097. addHex(start, end, dataSize);
  3098. stream.readHexNumber(end, dataSize);
  3099. addHex(end, start, dataSize);
  3100. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  3101. }
  3102. break;
  3103. case 1:
  3104. stream.readHex(start, dataSize);
  3105. stream.readHexNumber(end, dataSize);
  3106. addHex(end, start, dataSize);
  3107. stream.readNumber();
  3108. for (let i = 1; i < subitemsCount; i++) {
  3109. incHex(end, dataSize);
  3110. stream.readHexNumber(start, dataSize);
  3111. addHex(start, end, dataSize);
  3112. stream.readHexNumber(end, dataSize);
  3113. addHex(end, start, dataSize);
  3114. stream.readNumber();
  3115. }
  3116. break;
  3117. case 2:
  3118. stream.readHex(char, dataSize);
  3119. code = stream.readNumber();
  3120. cMap.mapOne(hexToInt(char, dataSize), code);
  3121. for (let i = 1; i < subitemsCount; i++) {
  3122. incHex(char, dataSize);
  3123. if (!sequence) {
  3124. stream.readHexNumber(tmp, dataSize);
  3125. addHex(char, tmp, dataSize);
  3126. }
  3127. code = stream.readSigned() + (code + 1);
  3128. cMap.mapOne(hexToInt(char, dataSize), code);
  3129. }
  3130. break;
  3131. case 3:
  3132. stream.readHex(start, dataSize);
  3133. stream.readHexNumber(end, dataSize);
  3134. addHex(end, start, dataSize);
  3135. code = stream.readNumber();
  3136. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  3137. for (let i = 1; i < subitemsCount; i++) {
  3138. incHex(end, dataSize);
  3139. if (!sequence) {
  3140. stream.readHexNumber(start, dataSize);
  3141. addHex(start, end, dataSize);
  3142. } else {
  3143. start.set(end);
  3144. }
  3145. stream.readHexNumber(end, dataSize);
  3146. addHex(end, start, dataSize);
  3147. code = stream.readNumber();
  3148. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  3149. }
  3150. break;
  3151. case 4:
  3152. stream.readHex(char, ucs2DataSize);
  3153. stream.readHex(charCode, dataSize);
  3154. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  3155. for (let i = 1; i < subitemsCount; i++) {
  3156. incHex(char, ucs2DataSize);
  3157. if (!sequence) {
  3158. stream.readHexNumber(tmp, ucs2DataSize);
  3159. addHex(char, tmp, ucs2DataSize);
  3160. }
  3161. incHex(charCode, dataSize);
  3162. stream.readHexSigned(tmp, dataSize);
  3163. addHex(charCode, tmp, dataSize);
  3164. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  3165. }
  3166. break;
  3167. case 5:
  3168. stream.readHex(start, ucs2DataSize);
  3169. stream.readHexNumber(end, ucs2DataSize);
  3170. addHex(end, start, ucs2DataSize);
  3171. stream.readHex(charCode, dataSize);
  3172. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  3173. for (let i = 1; i < subitemsCount; i++) {
  3174. incHex(end, ucs2DataSize);
  3175. if (!sequence) {
  3176. stream.readHexNumber(start, ucs2DataSize);
  3177. addHex(start, end, ucs2DataSize);
  3178. } else {
  3179. start.set(end);
  3180. }
  3181. stream.readHexNumber(end, ucs2DataSize);
  3182. addHex(end, start, ucs2DataSize);
  3183. stream.readHex(charCode, dataSize);
  3184. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  3185. }
  3186. break;
  3187. default:
  3188. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  3189. }
  3190. }
  3191. if (useCMap) {
  3192. return extend(useCMap);
  3193. }
  3194. return cMap;
  3195. }
  3196. }
  3197. ;// ./src/core/decode_stream.js
  3198. const emptyBuffer = new Uint8Array(0);
  3199. class DecodeStream extends BaseStream {
  3200. constructor(maybeMinBufferLength) {
  3201. super();
  3202. this._rawMinBufferLength = maybeMinBufferLength || 0;
  3203. this.pos = 0;
  3204. this.bufferLength = 0;
  3205. this.eof = false;
  3206. this.buffer = emptyBuffer;
  3207. this.minBufferLength = 512;
  3208. if (maybeMinBufferLength) {
  3209. while (this.minBufferLength < maybeMinBufferLength) {
  3210. this.minBufferLength *= 2;
  3211. }
  3212. }
  3213. }
  3214. get isEmpty() {
  3215. while (!this.eof && this.bufferLength === 0) {
  3216. this.readBlock();
  3217. }
  3218. return this.bufferLength === 0;
  3219. }
  3220. ensureBuffer(requested) {
  3221. const buffer = this.buffer;
  3222. if (requested <= buffer.byteLength) {
  3223. return buffer;
  3224. }
  3225. let size = this.minBufferLength;
  3226. while (size < requested) {
  3227. size *= 2;
  3228. }
  3229. const buffer2 = new Uint8Array(size);
  3230. buffer2.set(buffer);
  3231. return this.buffer = buffer2;
  3232. }
  3233. getByte() {
  3234. const pos = this.pos;
  3235. while (this.bufferLength <= pos) {
  3236. if (this.eof) {
  3237. return -1;
  3238. }
  3239. this.readBlock();
  3240. }
  3241. return this.buffer[this.pos++];
  3242. }
  3243. getBytes(length, decoderOptions = null) {
  3244. const pos = this.pos;
  3245. let end;
  3246. if (length) {
  3247. this.ensureBuffer(pos + length);
  3248. end = pos + length;
  3249. while (!this.eof && this.bufferLength < end) {
  3250. this.readBlock(decoderOptions);
  3251. }
  3252. const bufEnd = this.bufferLength;
  3253. if (end > bufEnd) {
  3254. end = bufEnd;
  3255. }
  3256. } else {
  3257. while (!this.eof) {
  3258. this.readBlock(decoderOptions);
  3259. }
  3260. end = this.bufferLength;
  3261. }
  3262. this.pos = end;
  3263. return this.buffer.subarray(pos, end);
  3264. }
  3265. async getImageData(length, decoderOptions = null) {
  3266. if (!this.canAsyncDecodeImageFromBuffer) {
  3267. return this.getBytes(length, decoderOptions);
  3268. }
  3269. const data = await this.stream.asyncGetBytes();
  3270. return this.decodeImage(data, decoderOptions);
  3271. }
  3272. reset() {
  3273. this.pos = 0;
  3274. }
  3275. makeSubStream(start, length, dict = null) {
  3276. if (length === undefined) {
  3277. while (!this.eof) {
  3278. this.readBlock();
  3279. }
  3280. } else {
  3281. const end = start + length;
  3282. while (this.bufferLength <= end && !this.eof) {
  3283. this.readBlock();
  3284. }
  3285. }
  3286. return new Stream(this.buffer, start, length, dict);
  3287. }
  3288. getBaseStreams() {
  3289. return this.str ? this.str.getBaseStreams() : null;
  3290. }
  3291. }
  3292. class StreamsSequenceStream extends DecodeStream {
  3293. constructor(streams, onError = null) {
  3294. streams = streams.filter(s => s instanceof BaseStream);
  3295. let maybeLength = 0;
  3296. for (const stream of streams) {
  3297. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  3298. }
  3299. super(maybeLength);
  3300. this.streams = streams;
  3301. this._onError = onError;
  3302. }
  3303. readBlock() {
  3304. const streams = this.streams;
  3305. if (streams.length === 0) {
  3306. this.eof = true;
  3307. return;
  3308. }
  3309. const stream = streams.shift();
  3310. let chunk;
  3311. try {
  3312. chunk = stream.getBytes();
  3313. } catch (reason) {
  3314. if (this._onError) {
  3315. this._onError(reason, stream.dict?.objId);
  3316. return;
  3317. }
  3318. throw reason;
  3319. }
  3320. const bufferLength = this.bufferLength;
  3321. const newLength = bufferLength + chunk.length;
  3322. const buffer = this.ensureBuffer(newLength);
  3323. buffer.set(chunk, bufferLength);
  3324. this.bufferLength = newLength;
  3325. }
  3326. getBaseStreams() {
  3327. const baseStreamsBuf = [];
  3328. for (const stream of this.streams) {
  3329. const baseStreams = stream.getBaseStreams();
  3330. if (baseStreams) {
  3331. baseStreamsBuf.push(...baseStreams);
  3332. }
  3333. }
  3334. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  3335. }
  3336. }
  3337. ;// ./src/core/ascii_85_stream.js
  3338. class Ascii85Stream extends DecodeStream {
  3339. constructor(str, maybeLength) {
  3340. if (maybeLength) {
  3341. maybeLength *= 0.8;
  3342. }
  3343. super(maybeLength);
  3344. this.str = str;
  3345. this.dict = str.dict;
  3346. this.input = new Uint8Array(5);
  3347. }
  3348. readBlock() {
  3349. const TILDA_CHAR = 0x7e;
  3350. const Z_LOWER_CHAR = 0x7a;
  3351. const EOF = -1;
  3352. const str = this.str;
  3353. let c = str.getByte();
  3354. while (isWhiteSpace(c)) {
  3355. c = str.getByte();
  3356. }
  3357. if (c === EOF || c === TILDA_CHAR) {
  3358. this.eof = true;
  3359. return;
  3360. }
  3361. const bufferLength = this.bufferLength;
  3362. let buffer, i;
  3363. if (c === Z_LOWER_CHAR) {
  3364. buffer = this.ensureBuffer(bufferLength + 4);
  3365. for (i = 0; i < 4; ++i) {
  3366. buffer[bufferLength + i] = 0;
  3367. }
  3368. this.bufferLength += 4;
  3369. } else {
  3370. const input = this.input;
  3371. input[0] = c;
  3372. for (i = 1; i < 5; ++i) {
  3373. c = str.getByte();
  3374. while (isWhiteSpace(c)) {
  3375. c = str.getByte();
  3376. }
  3377. input[i] = c;
  3378. if (c === EOF || c === TILDA_CHAR) {
  3379. break;
  3380. }
  3381. }
  3382. buffer = this.ensureBuffer(bufferLength + i - 1);
  3383. this.bufferLength += i - 1;
  3384. if (i < 5) {
  3385. for (; i < 5; ++i) {
  3386. input[i] = 0x21 + 84;
  3387. }
  3388. this.eof = true;
  3389. }
  3390. let t = 0;
  3391. for (i = 0; i < 5; ++i) {
  3392. t = t * 85 + (input[i] - 0x21);
  3393. }
  3394. for (i = 3; i >= 0; --i) {
  3395. buffer[bufferLength + i] = t & 0xff;
  3396. t >>= 8;
  3397. }
  3398. }
  3399. }
  3400. }
  3401. ;// ./src/core/ascii_hex_stream.js
  3402. class AsciiHexStream extends DecodeStream {
  3403. constructor(str, maybeLength) {
  3404. if (maybeLength) {
  3405. maybeLength *= 0.5;
  3406. }
  3407. super(maybeLength);
  3408. this.str = str;
  3409. this.dict = str.dict;
  3410. this.firstDigit = -1;
  3411. }
  3412. readBlock() {
  3413. const UPSTREAM_BLOCK_SIZE = 8000;
  3414. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  3415. if (!bytes.length) {
  3416. this.eof = true;
  3417. return;
  3418. }
  3419. const maxDecodeLength = bytes.length + 1 >> 1;
  3420. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  3421. let bufferLength = this.bufferLength;
  3422. let firstDigit = this.firstDigit;
  3423. for (const ch of bytes) {
  3424. let digit;
  3425. if (ch >= 0x30 && ch <= 0x39) {
  3426. digit = ch & 0x0f;
  3427. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  3428. digit = (ch & 0x0f) + 9;
  3429. } else if (ch === 0x3e) {
  3430. this.eof = true;
  3431. break;
  3432. } else {
  3433. continue;
  3434. }
  3435. if (firstDigit < 0) {
  3436. firstDigit = digit;
  3437. } else {
  3438. buffer[bufferLength++] = firstDigit << 4 | digit;
  3439. firstDigit = -1;
  3440. }
  3441. }
  3442. if (firstDigit >= 0 && this.eof) {
  3443. buffer[bufferLength++] = firstDigit << 4;
  3444. firstDigit = -1;
  3445. }
  3446. this.firstDigit = firstDigit;
  3447. this.bufferLength = bufferLength;
  3448. }
  3449. }
  3450. ;// ./src/core/ccitt.js
  3451. const ccittEOL = -2;
  3452. const ccittEOF = -1;
  3453. const twoDimPass = 0;
  3454. const twoDimHoriz = 1;
  3455. const twoDimVert0 = 2;
  3456. const twoDimVertR1 = 3;
  3457. const twoDimVertL1 = 4;
  3458. const twoDimVertR2 = 5;
  3459. const twoDimVertL2 = 6;
  3460. const twoDimVertR3 = 7;
  3461. const twoDimVertL3 = 8;
  3462. const twoDimTable = [[-1, -1], [-1, -1], [7, twoDimVertL3], [7, twoDimVertR3], [6, twoDimVertL2], [6, twoDimVertL2], [6, twoDimVertR2], [6, twoDimVertR2], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [4, twoDimPass], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimHoriz], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertL1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [3, twoDimVertR1], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0], [1, twoDimVert0]];
  3463. const whiteTable1 = [[-1, -1], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [12, 1984], [12, 2048], [12, 2112], [12, 2176], [12, 2240], [12, 2304], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [12, 2368], [12, 2432], [12, 2496], [12, 2560]];
  3464. const whiteTable2 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [8, 29], [8, 29], [8, 30], [8, 30], [8, 45], [8, 45], [8, 46], [8, 46], [7, 22], [7, 22], [7, 22], [7, 22], [7, 23], [7, 23], [7, 23], [7, 23], [8, 47], [8, 47], [8, 48], [8, 48], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [6, 13], [7, 20], [7, 20], [7, 20], [7, 20], [8, 33], [8, 33], [8, 34], [8, 34], [8, 35], [8, 35], [8, 36], [8, 36], [8, 37], [8, 37], [8, 38], [8, 38], [7, 19], [7, 19], [7, 19], [7, 19], [8, 31], [8, 31], [8, 32], [8, 32], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 1], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [6, 12], [8, 53], [8, 53], [8, 54], [8, 54], [7, 26], [7, 26], [7, 26], [7, 26], [8, 39], [8, 39], [8, 40], [8, 40], [8, 41], [8, 41], [8, 42], [8, 42], [8, 43], [8, 43], [8, 44], [8, 44], [7, 21], [7, 21], [7, 21], [7, 21], [7, 28], [7, 28], [7, 28], [7, 28], [8, 61], [8, 61], [8, 62], [8, 62], [8, 63], [8, 63], [8, 0], [8, 0], [8, 320], [8, 320], [8, 384], [8, 384], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 10], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [5, 11], [7, 27], [7, 27], [7, 27], [7, 27], [8, 59], [8, 59], [8, 60], [8, 60], [9, 1472], [9, 1536], [9, 1600], [9, 1728], [7, 18], [7, 18], [7, 18], [7, 18], [7, 24], [7, 24], [7, 24], [7, 24], [8, 49], [8, 49], [8, 50], [8, 50], [8, 51], [8, 51], [8, 52], [8, 52], [7, 25], [7, 25], [7, 25], [7, 25], [8, 55], [8, 55], [8, 56], [8, 56], [8, 57], [8, 57], [8, 58], [8, 58], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 192], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [6, 1664], [8, 448], [8, 448], [8, 512], [8, 512], [9, 704], [9, 768], [8, 640], [8, 640], [8, 576], [8, 576], [9, 832], [9, 896], [9, 960], [9, 1024], [9, 1088], [9, 1152], [9, 1216], [9, 1280], [9, 1344], [9, 1408], [7, 256], [7, 256], [7, 256], [7, 256], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 2], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [4, 3], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 128], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 8], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [5, 9], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 16], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [6, 17], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 4], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [4, 5], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 14], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [6, 15], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [5, 64], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 6], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7], [4, 7]];
  3465. const blackTable1 = [[-1, -1], [-1, -1], [12, ccittEOL], [12, ccittEOL], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [-1, -1], [11, 1792], [11, 1792], [11, 1792], [11, 1792], [12, 1984], [12, 1984], [12, 2048], [12, 2048], [12, 2112], [12, 2112], [12, 2176], [12, 2176], [12, 2240], [12, 2240], [12, 2304], [12, 2304], [11, 1856], [11, 1856], [11, 1856], [11, 1856], [11, 1920], [11, 1920], [11, 1920], [11, 1920], [12, 2368], [12, 2368], [12, 2432], [12, 2432], [12, 2496], [12, 2496], [12, 2560], [12, 2560], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [10, 18], [12, 52], [12, 52], [13, 640], [13, 704], [13, 768], [13, 832], [12, 55], [12, 55], [12, 56], [12, 56], [13, 1280], [13, 1344], [13, 1408], [13, 1472], [12, 59], [12, 59], [12, 60], [12, 60], [13, 1536], [13, 1600], [11, 24], [11, 24], [11, 24], [11, 24], [11, 25], [11, 25], [11, 25], [11, 25], [13, 1664], [13, 1728], [12, 320], [12, 320], [12, 384], [12, 384], [12, 448], [12, 448], [13, 512], [13, 576], [12, 53], [12, 53], [12, 54], [12, 54], [13, 896], [13, 960], [13, 1024], [13, 1088], [13, 1152], [13, 1216], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64], [10, 64]];
  3466. const blackTable2 = [[8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [8, 13], [11, 23], [11, 23], [12, 50], [12, 51], [12, 44], [12, 45], [12, 46], [12, 47], [12, 57], [12, 58], [12, 61], [12, 256], [10, 16], [10, 16], [10, 16], [10, 16], [10, 17], [10, 17], [10, 17], [10, 17], [12, 48], [12, 49], [12, 62], [12, 63], [12, 30], [12, 31], [12, 32], [12, 33], [12, 40], [12, 41], [11, 22], [11, 22], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [8, 14], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 10], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [7, 11], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [9, 15], [12, 128], [12, 192], [12, 26], [12, 27], [12, 28], [12, 29], [11, 19], [11, 19], [11, 20], [11, 20], [12, 34], [12, 35], [12, 36], [12, 37], [12, 38], [12, 39], [11, 21], [11, 21], [12, 42], [12, 43], [10, 0], [10, 0], [10, 0], [10, 0], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12], [7, 12]];
  3467. const blackTable3 = [[-1, -1], [-1, -1], [-1, -1], [-1, -1], [6, 9], [6, 8], [5, 7], [5, 7], [4, 6], [4, 6], [4, 6], [4, 6], [4, 5], [4, 5], [4, 5], [4, 5], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 1], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [3, 4], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 3], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2], [2, 2]];
  3468. class CCITTFaxDecoder {
  3469. constructor(source, options = {}) {
  3470. if (typeof source?.next !== "function") {
  3471. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  3472. }
  3473. this.source = source;
  3474. this.eof = false;
  3475. this.encoding = options.K || 0;
  3476. this.eoline = options.EndOfLine || false;
  3477. this.byteAlign = options.EncodedByteAlign || false;
  3478. this.columns = options.Columns || 1728;
  3479. this.rows = options.Rows || 0;
  3480. this.eoblock = options.EndOfBlock ?? true;
  3481. this.black = options.BlackIs1 || false;
  3482. this.codingLine = new Uint32Array(this.columns + 1);
  3483. this.refLine = new Uint32Array(this.columns + 2);
  3484. this.codingLine[0] = this.columns;
  3485. this.codingPos = 0;
  3486. this.row = 0;
  3487. this.nextLine2D = this.encoding < 0;
  3488. this.inputBits = 0;
  3489. this.inputBuf = 0;
  3490. this.outputBits = 0;
  3491. this.rowsDone = false;
  3492. let code1;
  3493. while ((code1 = this._lookBits(12)) === 0) {
  3494. this._eatBits(1);
  3495. }
  3496. if (code1 === 1) {
  3497. this._eatBits(12);
  3498. }
  3499. if (this.encoding > 0) {
  3500. this.nextLine2D = !this._lookBits(1);
  3501. this._eatBits(1);
  3502. }
  3503. }
  3504. readNextChar() {
  3505. if (this.eof) {
  3506. return -1;
  3507. }
  3508. const refLine = this.refLine;
  3509. const codingLine = this.codingLine;
  3510. const columns = this.columns;
  3511. let refPos, blackPixels, bits, i;
  3512. if (this.outputBits === 0) {
  3513. if (this.rowsDone) {
  3514. this.eof = true;
  3515. }
  3516. if (this.eof) {
  3517. return -1;
  3518. }
  3519. this.err = false;
  3520. let code1, code2, code3;
  3521. if (this.nextLine2D) {
  3522. for (i = 0; codingLine[i] < columns; ++i) {
  3523. refLine[i] = codingLine[i];
  3524. }
  3525. refLine[i++] = columns;
  3526. refLine[i] = columns;
  3527. codingLine[0] = 0;
  3528. this.codingPos = 0;
  3529. refPos = 0;
  3530. blackPixels = 0;
  3531. while (codingLine[this.codingPos] < columns) {
  3532. code1 = this._getTwoDimCode();
  3533. switch (code1) {
  3534. case twoDimPass:
  3535. this._addPixels(refLine[refPos + 1], blackPixels);
  3536. if (refLine[refPos + 1] < columns) {
  3537. refPos += 2;
  3538. }
  3539. break;
  3540. case twoDimHoriz:
  3541. code1 = code2 = 0;
  3542. if (blackPixels) {
  3543. do {
  3544. code1 += code3 = this._getBlackCode();
  3545. } while (code3 >= 64);
  3546. do {
  3547. code2 += code3 = this._getWhiteCode();
  3548. } while (code3 >= 64);
  3549. } else {
  3550. do {
  3551. code1 += code3 = this._getWhiteCode();
  3552. } while (code3 >= 64);
  3553. do {
  3554. code2 += code3 = this._getBlackCode();
  3555. } while (code3 >= 64);
  3556. }
  3557. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  3558. if (codingLine[this.codingPos] < columns) {
  3559. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  3560. }
  3561. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3562. refPos += 2;
  3563. }
  3564. break;
  3565. case twoDimVertR3:
  3566. this._addPixels(refLine[refPos] + 3, blackPixels);
  3567. blackPixels ^= 1;
  3568. if (codingLine[this.codingPos] < columns) {
  3569. ++refPos;
  3570. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3571. refPos += 2;
  3572. }
  3573. }
  3574. break;
  3575. case twoDimVertR2:
  3576. this._addPixels(refLine[refPos] + 2, blackPixels);
  3577. blackPixels ^= 1;
  3578. if (codingLine[this.codingPos] < columns) {
  3579. ++refPos;
  3580. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3581. refPos += 2;
  3582. }
  3583. }
  3584. break;
  3585. case twoDimVertR1:
  3586. this._addPixels(refLine[refPos] + 1, blackPixels);
  3587. blackPixels ^= 1;
  3588. if (codingLine[this.codingPos] < columns) {
  3589. ++refPos;
  3590. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3591. refPos += 2;
  3592. }
  3593. }
  3594. break;
  3595. case twoDimVert0:
  3596. this._addPixels(refLine[refPos], blackPixels);
  3597. blackPixels ^= 1;
  3598. if (codingLine[this.codingPos] < columns) {
  3599. ++refPos;
  3600. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3601. refPos += 2;
  3602. }
  3603. }
  3604. break;
  3605. case twoDimVertL3:
  3606. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  3607. blackPixels ^= 1;
  3608. if (codingLine[this.codingPos] < columns) {
  3609. if (refPos > 0) {
  3610. --refPos;
  3611. } else {
  3612. ++refPos;
  3613. }
  3614. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3615. refPos += 2;
  3616. }
  3617. }
  3618. break;
  3619. case twoDimVertL2:
  3620. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  3621. blackPixels ^= 1;
  3622. if (codingLine[this.codingPos] < columns) {
  3623. if (refPos > 0) {
  3624. --refPos;
  3625. } else {
  3626. ++refPos;
  3627. }
  3628. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3629. refPos += 2;
  3630. }
  3631. }
  3632. break;
  3633. case twoDimVertL1:
  3634. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  3635. blackPixels ^= 1;
  3636. if (codingLine[this.codingPos] < columns) {
  3637. if (refPos > 0) {
  3638. --refPos;
  3639. } else {
  3640. ++refPos;
  3641. }
  3642. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  3643. refPos += 2;
  3644. }
  3645. }
  3646. break;
  3647. case ccittEOF:
  3648. this._addPixels(columns, 0);
  3649. this.eof = true;
  3650. break;
  3651. default:
  3652. info("bad 2d code");
  3653. this._addPixels(columns, 0);
  3654. this.err = true;
  3655. }
  3656. }
  3657. } else {
  3658. codingLine[0] = 0;
  3659. this.codingPos = 0;
  3660. blackPixels = 0;
  3661. while (codingLine[this.codingPos] < columns) {
  3662. code1 = 0;
  3663. if (blackPixels) {
  3664. do {
  3665. code1 += code3 = this._getBlackCode();
  3666. } while (code3 >= 64);
  3667. } else {
  3668. do {
  3669. code1 += code3 = this._getWhiteCode();
  3670. } while (code3 >= 64);
  3671. }
  3672. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  3673. blackPixels ^= 1;
  3674. }
  3675. }
  3676. let gotEOL = false;
  3677. if (this.byteAlign) {
  3678. this.inputBits &= ~7;
  3679. }
  3680. if (!this.eoblock && this.row === this.rows - 1) {
  3681. this.rowsDone = true;
  3682. } else {
  3683. code1 = this._lookBits(12);
  3684. if (this.eoline) {
  3685. while (code1 !== ccittEOF && code1 !== 1) {
  3686. this._eatBits(1);
  3687. code1 = this._lookBits(12);
  3688. }
  3689. } else {
  3690. while (code1 === 0) {
  3691. this._eatBits(1);
  3692. code1 = this._lookBits(12);
  3693. }
  3694. }
  3695. if (code1 === 1) {
  3696. this._eatBits(12);
  3697. gotEOL = true;
  3698. } else if (code1 === ccittEOF) {
  3699. this.eof = true;
  3700. }
  3701. }
  3702. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  3703. this.nextLine2D = !this._lookBits(1);
  3704. this._eatBits(1);
  3705. }
  3706. if (this.eoblock && gotEOL && this.byteAlign) {
  3707. code1 = this._lookBits(12);
  3708. if (code1 === 1) {
  3709. this._eatBits(12);
  3710. if (this.encoding > 0) {
  3711. this._lookBits(1);
  3712. this._eatBits(1);
  3713. }
  3714. if (this.encoding >= 0) {
  3715. for (i = 0; i < 4; ++i) {
  3716. code1 = this._lookBits(12);
  3717. if (code1 !== 1) {
  3718. info("bad rtc code: " + code1);
  3719. }
  3720. this._eatBits(12);
  3721. if (this.encoding > 0) {
  3722. this._lookBits(1);
  3723. this._eatBits(1);
  3724. }
  3725. }
  3726. }
  3727. this.eof = true;
  3728. }
  3729. } else if (this.err && this.eoline) {
  3730. while (true) {
  3731. code1 = this._lookBits(13);
  3732. if (code1 === ccittEOF) {
  3733. this.eof = true;
  3734. return -1;
  3735. }
  3736. if (code1 >> 1 === 1) {
  3737. break;
  3738. }
  3739. this._eatBits(1);
  3740. }
  3741. this._eatBits(12);
  3742. if (this.encoding > 0) {
  3743. this._eatBits(1);
  3744. this.nextLine2D = !(code1 & 1);
  3745. }
  3746. }
  3747. this.outputBits = codingLine[0] > 0 ? codingLine[this.codingPos = 0] : codingLine[this.codingPos = 1];
  3748. this.row++;
  3749. }
  3750. let c;
  3751. if (this.outputBits >= 8) {
  3752. c = this.codingPos & 1 ? 0 : 0xff;
  3753. this.outputBits -= 8;
  3754. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  3755. this.codingPos++;
  3756. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  3757. }
  3758. } else {
  3759. bits = 8;
  3760. c = 0;
  3761. do {
  3762. if (typeof this.outputBits !== "number") {
  3763. throw new FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  3764. }
  3765. if (this.outputBits > bits) {
  3766. c <<= bits;
  3767. if (!(this.codingPos & 1)) {
  3768. c |= 0xff >> 8 - bits;
  3769. }
  3770. this.outputBits -= bits;
  3771. bits = 0;
  3772. } else {
  3773. c <<= this.outputBits;
  3774. if (!(this.codingPos & 1)) {
  3775. c |= 0xff >> 8 - this.outputBits;
  3776. }
  3777. bits -= this.outputBits;
  3778. this.outputBits = 0;
  3779. if (codingLine[this.codingPos] < columns) {
  3780. this.codingPos++;
  3781. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  3782. } else if (bits > 0) {
  3783. c <<= bits;
  3784. bits = 0;
  3785. }
  3786. }
  3787. } while (bits);
  3788. }
  3789. if (this.black) {
  3790. c ^= 0xff;
  3791. }
  3792. return c;
  3793. }
  3794. _addPixels(a1, blackPixels) {
  3795. const codingLine = this.codingLine;
  3796. let codingPos = this.codingPos;
  3797. if (a1 > codingLine[codingPos]) {
  3798. if (a1 > this.columns) {
  3799. info("row is wrong length");
  3800. this.err = true;
  3801. a1 = this.columns;
  3802. }
  3803. if (codingPos & 1 ^ blackPixels) {
  3804. ++codingPos;
  3805. }
  3806. codingLine[codingPos] = a1;
  3807. }
  3808. this.codingPos = codingPos;
  3809. }
  3810. _addPixelsNeg(a1, blackPixels) {
  3811. const codingLine = this.codingLine;
  3812. let codingPos = this.codingPos;
  3813. if (a1 > codingLine[codingPos]) {
  3814. if (a1 > this.columns) {
  3815. info("row is wrong length");
  3816. this.err = true;
  3817. a1 = this.columns;
  3818. }
  3819. if (codingPos & 1 ^ blackPixels) {
  3820. ++codingPos;
  3821. }
  3822. codingLine[codingPos] = a1;
  3823. } else if (a1 < codingLine[codingPos]) {
  3824. if (a1 < 0) {
  3825. info("invalid code");
  3826. this.err = true;
  3827. a1 = 0;
  3828. }
  3829. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  3830. --codingPos;
  3831. }
  3832. codingLine[codingPos] = a1;
  3833. }
  3834. this.codingPos = codingPos;
  3835. }
  3836. _findTableCode(start, end, table, limit) {
  3837. const limitValue = limit || 0;
  3838. for (let i = start; i <= end; ++i) {
  3839. let code = this._lookBits(i);
  3840. if (code === ccittEOF) {
  3841. return [true, 1, false];
  3842. }
  3843. if (i < end) {
  3844. code <<= end - i;
  3845. }
  3846. if (!limitValue || code >= limitValue) {
  3847. const p = table[code - limitValue];
  3848. if (p[0] === i) {
  3849. this._eatBits(i);
  3850. return [true, p[1], true];
  3851. }
  3852. }
  3853. }
  3854. return [false, 0, false];
  3855. }
  3856. _getTwoDimCode() {
  3857. let code = 0;
  3858. let p;
  3859. if (this.eoblock) {
  3860. code = this._lookBits(7);
  3861. p = twoDimTable[code];
  3862. if (p?.[0] > 0) {
  3863. this._eatBits(p[0]);
  3864. return p[1];
  3865. }
  3866. } else {
  3867. const result = this._findTableCode(1, 7, twoDimTable);
  3868. if (result[0] && result[2]) {
  3869. return result[1];
  3870. }
  3871. }
  3872. info("Bad two dim code");
  3873. return ccittEOF;
  3874. }
  3875. _getWhiteCode() {
  3876. let code = 0;
  3877. let p;
  3878. if (this.eoblock) {
  3879. code = this._lookBits(12);
  3880. if (code === ccittEOF) {
  3881. return 1;
  3882. }
  3883. p = code >> 5 === 0 ? whiteTable1[code] : whiteTable2[code >> 3];
  3884. if (p[0] > 0) {
  3885. this._eatBits(p[0]);
  3886. return p[1];
  3887. }
  3888. } else {
  3889. let result = this._findTableCode(1, 9, whiteTable2);
  3890. if (result[0]) {
  3891. return result[1];
  3892. }
  3893. result = this._findTableCode(11, 12, whiteTable1);
  3894. if (result[0]) {
  3895. return result[1];
  3896. }
  3897. }
  3898. info("bad white code");
  3899. this._eatBits(1);
  3900. return 1;
  3901. }
  3902. _getBlackCode() {
  3903. let code, p;
  3904. if (this.eoblock) {
  3905. code = this._lookBits(13);
  3906. if (code === ccittEOF) {
  3907. return 1;
  3908. }
  3909. if (code >> 7 === 0) {
  3910. p = blackTable1[code];
  3911. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  3912. p = blackTable2[(code >> 1) - 64];
  3913. } else {
  3914. p = blackTable3[code >> 7];
  3915. }
  3916. if (p[0] > 0) {
  3917. this._eatBits(p[0]);
  3918. return p[1];
  3919. }
  3920. } else {
  3921. let result = this._findTableCode(2, 6, blackTable3);
  3922. if (result[0]) {
  3923. return result[1];
  3924. }
  3925. result = this._findTableCode(7, 12, blackTable2, 64);
  3926. if (result[0]) {
  3927. return result[1];
  3928. }
  3929. result = this._findTableCode(10, 13, blackTable1);
  3930. if (result[0]) {
  3931. return result[1];
  3932. }
  3933. }
  3934. info("bad black code");
  3935. this._eatBits(1);
  3936. return 1;
  3937. }
  3938. _lookBits(n) {
  3939. let c;
  3940. while (this.inputBits < n) {
  3941. if ((c = this.source.next()) === -1) {
  3942. if (this.inputBits === 0) {
  3943. return ccittEOF;
  3944. }
  3945. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  3946. }
  3947. this.inputBuf = this.inputBuf << 8 | c;
  3948. this.inputBits += 8;
  3949. }
  3950. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  3951. }
  3952. _eatBits(n) {
  3953. if ((this.inputBits -= n) < 0) {
  3954. this.inputBits = 0;
  3955. }
  3956. }
  3957. }
  3958. ;// ./src/core/ccitt_stream.js
  3959. class CCITTFaxStream extends DecodeStream {
  3960. constructor(str, maybeLength, params) {
  3961. super(maybeLength);
  3962. this.str = str;
  3963. this.dict = str.dict;
  3964. if (!(params instanceof Dict)) {
  3965. params = Dict.empty;
  3966. }
  3967. const source = {
  3968. next() {
  3969. return str.getByte();
  3970. }
  3971. };
  3972. this.ccittFaxDecoder = new CCITTFaxDecoder(source, {
  3973. K: params.get("K"),
  3974. EndOfLine: params.get("EndOfLine"),
  3975. EncodedByteAlign: params.get("EncodedByteAlign"),
  3976. Columns: params.get("Columns"),
  3977. Rows: params.get("Rows"),
  3978. EndOfBlock: params.get("EndOfBlock"),
  3979. BlackIs1: params.get("BlackIs1")
  3980. });
  3981. }
  3982. readBlock() {
  3983. while (!this.eof) {
  3984. const c = this.ccittFaxDecoder.readNextChar();
  3985. if (c === -1) {
  3986. this.eof = true;
  3987. return;
  3988. }
  3989. this.ensureBuffer(this.bufferLength + 1);
  3990. this.buffer[this.bufferLength++] = c;
  3991. }
  3992. }
  3993. }
  3994. ;// ./src/core/flate_stream.js
  3995. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  3996. const lengthDecode = new Int32Array([0x00003, 0x00004, 0x00005, 0x00006, 0x00007, 0x00008, 0x00009, 0x0000a, 0x1000b, 0x1000d, 0x1000f, 0x10011, 0x20013, 0x20017, 0x2001b, 0x2001f, 0x30023, 0x3002b, 0x30033, 0x3003b, 0x40043, 0x40053, 0x40063, 0x40073, 0x50083, 0x500a3, 0x500c3, 0x500e3, 0x00102, 0x00102, 0x00102]);
  3997. const distDecode = new Int32Array([0x00001, 0x00002, 0x00003, 0x00004, 0x10005, 0x10007, 0x20009, 0x2000d, 0x30011, 0x30019, 0x40021, 0x40031, 0x50041, 0x50061, 0x60081, 0x600c1, 0x70101, 0x70181, 0x80201, 0x80301, 0x90401, 0x90601, 0xa0801, 0xa0c01, 0xb1001, 0xb1801, 0xc2001, 0xc3001, 0xd4001, 0xd6001]);
  3998. const fixedLitCodeTab = [new Int32Array([0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c0, 0x70108, 0x80060, 0x80020, 0x900a0, 0x80000, 0x80080, 0x80040, 0x900e0, 0x70104, 0x80058, 0x80018, 0x90090, 0x70114, 0x80078, 0x80038, 0x900d0, 0x7010c, 0x80068, 0x80028, 0x900b0, 0x80008, 0x80088, 0x80048, 0x900f0, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c8, 0x7010a, 0x80064, 0x80024, 0x900a8, 0x80004, 0x80084, 0x80044, 0x900e8, 0x70106, 0x8005c, 0x8001c, 0x90098, 0x70116, 0x8007c, 0x8003c, 0x900d8, 0x7010e, 0x8006c, 0x8002c, 0x900b8, 0x8000c, 0x8008c, 0x8004c, 0x900f8, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c4, 0x70109, 0x80062, 0x80022, 0x900a4, 0x80002, 0x80082, 0x80042, 0x900e4, 0x70105, 0x8005a, 0x8001a, 0x90094, 0x70115, 0x8007a, 0x8003a, 0x900d4, 0x7010d, 0x8006a, 0x8002a, 0x900b4, 0x8000a, 0x8008a, 0x8004a, 0x900f4, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cc, 0x7010b, 0x80066, 0x80026, 0x900ac, 0x80006, 0x80086, 0x80046, 0x900ec, 0x70107, 0x8005e, 0x8001e, 0x9009c, 0x70117, 0x8007e, 0x8003e, 0x900dc, 0x7010f, 0x8006e, 0x8002e, 0x900bc, 0x8000e, 0x8008e, 0x8004e, 0x900fc, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c2, 0x70108, 0x80061, 0x80021, 0x900a2, 0x80001, 0x80081, 0x80041, 0x900e2, 0x70104, 0x80059, 0x80019, 0x90092, 0x70114, 0x80079, 0x80039, 0x900d2, 0x7010c, 0x80069, 0x80029, 0x900b2, 0x80009, 0x80089, 0x80049, 0x900f2, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900ca, 0x7010a, 0x80065, 0x80025, 0x900aa, 0x80005, 0x80085, 0x80045, 0x900ea, 0x70106, 0x8005d, 0x8001d, 0x9009a, 0x70116, 0x8007d, 0x8003d, 0x900da, 0x7010e, 0x8006d, 0x8002d, 0x900ba, 0x8000d, 0x8008d, 0x8004d, 0x900fa, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c6, 0x70109, 0x80063, 0x80023, 0x900a6, 0x80003, 0x80083, 0x80043, 0x900e6, 0x70105, 0x8005b, 0x8001b, 0x90096, 0x70115, 0x8007b, 0x8003b, 0x900d6, 0x7010d, 0x8006b, 0x8002b, 0x900b6, 0x8000b, 0x8008b, 0x8004b, 0x900f6, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900ce, 0x7010b, 0x80067, 0x80027, 0x900ae, 0x80007, 0x80087, 0x80047, 0x900ee, 0x70107, 0x8005f, 0x8001f, 0x9009e, 0x70117, 0x8007f, 0x8003f, 0x900de, 0x7010f, 0x8006f, 0x8002f, 0x900be, 0x8000f, 0x8008f, 0x8004f, 0x900fe, 0x70100, 0x80050, 0x80010, 0x80118, 0x70110, 0x80070, 0x80030, 0x900c1, 0x70108, 0x80060, 0x80020, 0x900a1, 0x80000, 0x80080, 0x80040, 0x900e1, 0x70104, 0x80058, 0x80018, 0x90091, 0x70114, 0x80078, 0x80038, 0x900d1, 0x7010c, 0x80068, 0x80028, 0x900b1, 0x80008, 0x80088, 0x80048, 0x900f1, 0x70102, 0x80054, 0x80014, 0x8011c, 0x70112, 0x80074, 0x80034, 0x900c9, 0x7010a, 0x80064, 0x80024, 0x900a9, 0x80004, 0x80084, 0x80044, 0x900e9, 0x70106, 0x8005c, 0x8001c, 0x90099, 0x70116, 0x8007c, 0x8003c, 0x900d9, 0x7010e, 0x8006c, 0x8002c, 0x900b9, 0x8000c, 0x8008c, 0x8004c, 0x900f9, 0x70101, 0x80052, 0x80012, 0x8011a, 0x70111, 0x80072, 0x80032, 0x900c5, 0x70109, 0x80062, 0x80022, 0x900a5, 0x80002, 0x80082, 0x80042, 0x900e5, 0x70105, 0x8005a, 0x8001a, 0x90095, 0x70115, 0x8007a, 0x8003a, 0x900d5, 0x7010d, 0x8006a, 0x8002a, 0x900b5, 0x8000a, 0x8008a, 0x8004a, 0x900f5, 0x70103, 0x80056, 0x80016, 0x8011e, 0x70113, 0x80076, 0x80036, 0x900cd, 0x7010b, 0x80066, 0x80026, 0x900ad, 0x80006, 0x80086, 0x80046, 0x900ed, 0x70107, 0x8005e, 0x8001e, 0x9009d, 0x70117, 0x8007e, 0x8003e, 0x900dd, 0x7010f, 0x8006e, 0x8002e, 0x900bd, 0x8000e, 0x8008e, 0x8004e, 0x900fd, 0x70100, 0x80051, 0x80011, 0x80119, 0x70110, 0x80071, 0x80031, 0x900c3, 0x70108, 0x80061, 0x80021, 0x900a3, 0x80001, 0x80081, 0x80041, 0x900e3, 0x70104, 0x80059, 0x80019, 0x90093, 0x70114, 0x80079, 0x80039, 0x900d3, 0x7010c, 0x80069, 0x80029, 0x900b3, 0x80009, 0x80089, 0x80049, 0x900f3, 0x70102, 0x80055, 0x80015, 0x8011d, 0x70112, 0x80075, 0x80035, 0x900cb, 0x7010a, 0x80065, 0x80025, 0x900ab, 0x80005, 0x80085, 0x80045, 0x900eb, 0x70106, 0x8005d, 0x8001d, 0x9009b, 0x70116, 0x8007d, 0x8003d, 0x900db, 0x7010e, 0x8006d, 0x8002d, 0x900bb, 0x8000d, 0x8008d, 0x8004d, 0x900fb, 0x70101, 0x80053, 0x80013, 0x8011b, 0x70111, 0x80073, 0x80033, 0x900c7, 0x70109, 0x80063, 0x80023, 0x900a7, 0x80003, 0x80083, 0x80043, 0x900e7, 0x70105, 0x8005b, 0x8001b, 0x90097, 0x70115, 0x8007b, 0x8003b, 0x900d7, 0x7010d, 0x8006b, 0x8002b, 0x900b7, 0x8000b, 0x8008b, 0x8004b, 0x900f7, 0x70103, 0x80057, 0x80017, 0x8011f, 0x70113, 0x80077, 0x80037, 0x900cf, 0x7010b, 0x80067, 0x80027, 0x900af, 0x80007, 0x80087, 0x80047, 0x900ef, 0x70107, 0x8005f, 0x8001f, 0x9009f, 0x70117, 0x8007f, 0x8003f, 0x900df, 0x7010f, 0x8006f, 0x8002f, 0x900bf, 0x8000f, 0x8008f, 0x8004f, 0x900ff]), 9];
  3999. const fixedDistCodeTab = [new Int32Array([0x50000, 0x50010, 0x50008, 0x50018, 0x50004, 0x50014, 0x5000c, 0x5001c, 0x50002, 0x50012, 0x5000a, 0x5001a, 0x50006, 0x50016, 0x5000e, 0x00000, 0x50001, 0x50011, 0x50009, 0x50019, 0x50005, 0x50015, 0x5000d, 0x5001d, 0x50003, 0x50013, 0x5000b, 0x5001b, 0x50007, 0x50017, 0x5000f, 0x00000]), 5];
  4000. class FlateStream extends DecodeStream {
  4001. constructor(str, maybeLength) {
  4002. super(maybeLength);
  4003. this.str = str;
  4004. this.dict = str.dict;
  4005. const cmf = str.getByte();
  4006. const flg = str.getByte();
  4007. if (cmf === -1 || flg === -1) {
  4008. throw new FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  4009. }
  4010. if ((cmf & 0x0f) !== 0x08) {
  4011. throw new FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  4012. }
  4013. if (((cmf << 8) + flg) % 31 !== 0) {
  4014. throw new FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  4015. }
  4016. if (flg & 0x20) {
  4017. throw new FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  4018. }
  4019. this.codeSize = 0;
  4020. this.codeBuf = 0;
  4021. }
  4022. async getImageData(length, _decoderOptions) {
  4023. const data = await this.asyncGetBytes();
  4024. return data?.subarray(0, length) || this.getBytes(length);
  4025. }
  4026. async asyncGetBytes() {
  4027. this.str.reset();
  4028. const bytes = this.str.getBytes();
  4029. try {
  4030. const {
  4031. readable,
  4032. writable
  4033. } = new DecompressionStream("deflate");
  4034. const writer = writable.getWriter();
  4035. await writer.ready;
  4036. writer.write(bytes).then(async () => {
  4037. await writer.ready;
  4038. await writer.close();
  4039. }).catch(() => {});
  4040. const chunks = [];
  4041. let totalLength = 0;
  4042. for await (const chunk of readable) {
  4043. chunks.push(chunk);
  4044. totalLength += chunk.byteLength;
  4045. }
  4046. const data = new Uint8Array(totalLength);
  4047. let offset = 0;
  4048. for (const chunk of chunks) {
  4049. data.set(chunk, offset);
  4050. offset += chunk.byteLength;
  4051. }
  4052. return data;
  4053. } catch {
  4054. this.str = new Stream(bytes, 2, bytes.length, this.str.dict);
  4055. this.reset();
  4056. return null;
  4057. }
  4058. }
  4059. get isAsync() {
  4060. return true;
  4061. }
  4062. getBits(bits) {
  4063. const str = this.str;
  4064. let codeSize = this.codeSize;
  4065. let codeBuf = this.codeBuf;
  4066. let b;
  4067. while (codeSize < bits) {
  4068. if ((b = str.getByte()) === -1) {
  4069. throw new FormatError("Bad encoding in flate stream");
  4070. }
  4071. codeBuf |= b << codeSize;
  4072. codeSize += 8;
  4073. }
  4074. b = codeBuf & (1 << bits) - 1;
  4075. this.codeBuf = codeBuf >> bits;
  4076. this.codeSize = codeSize -= bits;
  4077. return b;
  4078. }
  4079. getCode(table) {
  4080. const str = this.str;
  4081. const codes = table[0];
  4082. const maxLen = table[1];
  4083. let codeSize = this.codeSize;
  4084. let codeBuf = this.codeBuf;
  4085. let b;
  4086. while (codeSize < maxLen) {
  4087. if ((b = str.getByte()) === -1) {
  4088. break;
  4089. }
  4090. codeBuf |= b << codeSize;
  4091. codeSize += 8;
  4092. }
  4093. const code = codes[codeBuf & (1 << maxLen) - 1];
  4094. const codeLen = code >> 16;
  4095. const codeVal = code & 0xffff;
  4096. if (codeLen < 1 || codeSize < codeLen) {
  4097. throw new FormatError("Bad encoding in flate stream");
  4098. }
  4099. this.codeBuf = codeBuf >> codeLen;
  4100. this.codeSize = codeSize - codeLen;
  4101. return codeVal;
  4102. }
  4103. generateHuffmanTable(lengths) {
  4104. const n = lengths.length;
  4105. let maxLen = 0;
  4106. let i;
  4107. for (i = 0; i < n; ++i) {
  4108. if (lengths[i] > maxLen) {
  4109. maxLen = lengths[i];
  4110. }
  4111. }
  4112. const size = 1 << maxLen;
  4113. const codes = new Int32Array(size);
  4114. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  4115. for (let val = 0; val < n; ++val) {
  4116. if (lengths[val] === len) {
  4117. let code2 = 0;
  4118. let t = code;
  4119. for (i = 0; i < len; ++i) {
  4120. code2 = code2 << 1 | t & 1;
  4121. t >>= 1;
  4122. }
  4123. for (i = code2; i < size; i += skip) {
  4124. codes[i] = len << 16 | val;
  4125. }
  4126. ++code;
  4127. }
  4128. }
  4129. }
  4130. return [codes, maxLen];
  4131. }
  4132. #endsStreamOnError(err) {
  4133. info(err);
  4134. this.eof = true;
  4135. }
  4136. readBlock() {
  4137. let buffer, hdr, len;
  4138. const str = this.str;
  4139. try {
  4140. hdr = this.getBits(3);
  4141. } catch (ex) {
  4142. this.#endsStreamOnError(ex.message);
  4143. return;
  4144. }
  4145. if (hdr & 1) {
  4146. this.eof = true;
  4147. }
  4148. hdr >>= 1;
  4149. if (hdr === 0) {
  4150. let b;
  4151. if ((b = str.getByte()) === -1) {
  4152. this.#endsStreamOnError("Bad block header in flate stream");
  4153. return;
  4154. }
  4155. let blockLen = b;
  4156. if ((b = str.getByte()) === -1) {
  4157. this.#endsStreamOnError("Bad block header in flate stream");
  4158. return;
  4159. }
  4160. blockLen |= b << 8;
  4161. if ((b = str.getByte()) === -1) {
  4162. this.#endsStreamOnError("Bad block header in flate stream");
  4163. return;
  4164. }
  4165. let check = b;
  4166. if ((b = str.getByte()) === -1) {
  4167. this.#endsStreamOnError("Bad block header in flate stream");
  4168. return;
  4169. }
  4170. check |= b << 8;
  4171. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  4172. throw new FormatError("Bad uncompressed block length in flate stream");
  4173. }
  4174. this.codeBuf = 0;
  4175. this.codeSize = 0;
  4176. const bufferLength = this.bufferLength,
  4177. end = bufferLength + blockLen;
  4178. buffer = this.ensureBuffer(end);
  4179. this.bufferLength = end;
  4180. if (blockLen === 0) {
  4181. if (str.peekByte() === -1) {
  4182. this.eof = true;
  4183. }
  4184. } else {
  4185. const block = str.getBytes(blockLen);
  4186. buffer.set(block, bufferLength);
  4187. if (block.length < blockLen) {
  4188. this.eof = true;
  4189. }
  4190. }
  4191. return;
  4192. }
  4193. let litCodeTable;
  4194. let distCodeTable;
  4195. if (hdr === 1) {
  4196. litCodeTable = fixedLitCodeTab;
  4197. distCodeTable = fixedDistCodeTab;
  4198. } else if (hdr === 2) {
  4199. const numLitCodes = this.getBits(5) + 257;
  4200. const numDistCodes = this.getBits(5) + 1;
  4201. const numCodeLenCodes = this.getBits(4) + 4;
  4202. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  4203. let i;
  4204. for (i = 0; i < numCodeLenCodes; ++i) {
  4205. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  4206. }
  4207. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  4208. len = 0;
  4209. i = 0;
  4210. const codes = numLitCodes + numDistCodes;
  4211. const codeLengths = new Uint8Array(codes);
  4212. let bitsLength, bitsOffset, what;
  4213. while (i < codes) {
  4214. const code = this.getCode(codeLenCodeTab);
  4215. if (code === 16) {
  4216. bitsLength = 2;
  4217. bitsOffset = 3;
  4218. what = len;
  4219. } else if (code === 17) {
  4220. bitsLength = 3;
  4221. bitsOffset = 3;
  4222. what = len = 0;
  4223. } else if (code === 18) {
  4224. bitsLength = 7;
  4225. bitsOffset = 11;
  4226. what = len = 0;
  4227. } else {
  4228. codeLengths[i++] = len = code;
  4229. continue;
  4230. }
  4231. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  4232. while (repeatLength-- > 0) {
  4233. codeLengths[i++] = what;
  4234. }
  4235. }
  4236. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  4237. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  4238. } else {
  4239. throw new FormatError("Unknown block type in flate stream");
  4240. }
  4241. buffer = this.buffer;
  4242. let limit = buffer ? buffer.length : 0;
  4243. let pos = this.bufferLength;
  4244. while (true) {
  4245. let code1 = this.getCode(litCodeTable);
  4246. if (code1 < 256) {
  4247. if (pos + 1 >= limit) {
  4248. buffer = this.ensureBuffer(pos + 1);
  4249. limit = buffer.length;
  4250. }
  4251. buffer[pos++] = code1;
  4252. continue;
  4253. }
  4254. if (code1 === 256) {
  4255. this.bufferLength = pos;
  4256. return;
  4257. }
  4258. code1 -= 257;
  4259. code1 = lengthDecode[code1];
  4260. let code2 = code1 >> 16;
  4261. if (code2 > 0) {
  4262. code2 = this.getBits(code2);
  4263. }
  4264. len = (code1 & 0xffff) + code2;
  4265. code1 = this.getCode(distCodeTable);
  4266. code1 = distDecode[code1];
  4267. code2 = code1 >> 16;
  4268. if (code2 > 0) {
  4269. code2 = this.getBits(code2);
  4270. }
  4271. const dist = (code1 & 0xffff) + code2;
  4272. if (pos + len >= limit) {
  4273. buffer = this.ensureBuffer(pos + len);
  4274. limit = buffer.length;
  4275. }
  4276. for (let k = 0; k < len; ++k, ++pos) {
  4277. buffer[pos] = buffer[pos - dist];
  4278. }
  4279. }
  4280. }
  4281. }
  4282. ;// ./src/core/arithmetic_decoder.js
  4283. const QeTable = [{
  4284. qe: 0x5601,
  4285. nmps: 1,
  4286. nlps: 1,
  4287. switchFlag: 1
  4288. }, {
  4289. qe: 0x3401,
  4290. nmps: 2,
  4291. nlps: 6,
  4292. switchFlag: 0
  4293. }, {
  4294. qe: 0x1801,
  4295. nmps: 3,
  4296. nlps: 9,
  4297. switchFlag: 0
  4298. }, {
  4299. qe: 0x0ac1,
  4300. nmps: 4,
  4301. nlps: 12,
  4302. switchFlag: 0
  4303. }, {
  4304. qe: 0x0521,
  4305. nmps: 5,
  4306. nlps: 29,
  4307. switchFlag: 0
  4308. }, {
  4309. qe: 0x0221,
  4310. nmps: 38,
  4311. nlps: 33,
  4312. switchFlag: 0
  4313. }, {
  4314. qe: 0x5601,
  4315. nmps: 7,
  4316. nlps: 6,
  4317. switchFlag: 1
  4318. }, {
  4319. qe: 0x5401,
  4320. nmps: 8,
  4321. nlps: 14,
  4322. switchFlag: 0
  4323. }, {
  4324. qe: 0x4801,
  4325. nmps: 9,
  4326. nlps: 14,
  4327. switchFlag: 0
  4328. }, {
  4329. qe: 0x3801,
  4330. nmps: 10,
  4331. nlps: 14,
  4332. switchFlag: 0
  4333. }, {
  4334. qe: 0x3001,
  4335. nmps: 11,
  4336. nlps: 17,
  4337. switchFlag: 0
  4338. }, {
  4339. qe: 0x2401,
  4340. nmps: 12,
  4341. nlps: 18,
  4342. switchFlag: 0
  4343. }, {
  4344. qe: 0x1c01,
  4345. nmps: 13,
  4346. nlps: 20,
  4347. switchFlag: 0
  4348. }, {
  4349. qe: 0x1601,
  4350. nmps: 29,
  4351. nlps: 21,
  4352. switchFlag: 0
  4353. }, {
  4354. qe: 0x5601,
  4355. nmps: 15,
  4356. nlps: 14,
  4357. switchFlag: 1
  4358. }, {
  4359. qe: 0x5401,
  4360. nmps: 16,
  4361. nlps: 14,
  4362. switchFlag: 0
  4363. }, {
  4364. qe: 0x5101,
  4365. nmps: 17,
  4366. nlps: 15,
  4367. switchFlag: 0
  4368. }, {
  4369. qe: 0x4801,
  4370. nmps: 18,
  4371. nlps: 16,
  4372. switchFlag: 0
  4373. }, {
  4374. qe: 0x3801,
  4375. nmps: 19,
  4376. nlps: 17,
  4377. switchFlag: 0
  4378. }, {
  4379. qe: 0x3401,
  4380. nmps: 20,
  4381. nlps: 18,
  4382. switchFlag: 0
  4383. }, {
  4384. qe: 0x3001,
  4385. nmps: 21,
  4386. nlps: 19,
  4387. switchFlag: 0
  4388. }, {
  4389. qe: 0x2801,
  4390. nmps: 22,
  4391. nlps: 19,
  4392. switchFlag: 0
  4393. }, {
  4394. qe: 0x2401,
  4395. nmps: 23,
  4396. nlps: 20,
  4397. switchFlag: 0
  4398. }, {
  4399. qe: 0x2201,
  4400. nmps: 24,
  4401. nlps: 21,
  4402. switchFlag: 0
  4403. }, {
  4404. qe: 0x1c01,
  4405. nmps: 25,
  4406. nlps: 22,
  4407. switchFlag: 0
  4408. }, {
  4409. qe: 0x1801,
  4410. nmps: 26,
  4411. nlps: 23,
  4412. switchFlag: 0
  4413. }, {
  4414. qe: 0x1601,
  4415. nmps: 27,
  4416. nlps: 24,
  4417. switchFlag: 0
  4418. }, {
  4419. qe: 0x1401,
  4420. nmps: 28,
  4421. nlps: 25,
  4422. switchFlag: 0
  4423. }, {
  4424. qe: 0x1201,
  4425. nmps: 29,
  4426. nlps: 26,
  4427. switchFlag: 0
  4428. }, {
  4429. qe: 0x1101,
  4430. nmps: 30,
  4431. nlps: 27,
  4432. switchFlag: 0
  4433. }, {
  4434. qe: 0x0ac1,
  4435. nmps: 31,
  4436. nlps: 28,
  4437. switchFlag: 0
  4438. }, {
  4439. qe: 0x09c1,
  4440. nmps: 32,
  4441. nlps: 29,
  4442. switchFlag: 0
  4443. }, {
  4444. qe: 0x08a1,
  4445. nmps: 33,
  4446. nlps: 30,
  4447. switchFlag: 0
  4448. }, {
  4449. qe: 0x0521,
  4450. nmps: 34,
  4451. nlps: 31,
  4452. switchFlag: 0
  4453. }, {
  4454. qe: 0x0441,
  4455. nmps: 35,
  4456. nlps: 32,
  4457. switchFlag: 0
  4458. }, {
  4459. qe: 0x02a1,
  4460. nmps: 36,
  4461. nlps: 33,
  4462. switchFlag: 0
  4463. }, {
  4464. qe: 0x0221,
  4465. nmps: 37,
  4466. nlps: 34,
  4467. switchFlag: 0
  4468. }, {
  4469. qe: 0x0141,
  4470. nmps: 38,
  4471. nlps: 35,
  4472. switchFlag: 0
  4473. }, {
  4474. qe: 0x0111,
  4475. nmps: 39,
  4476. nlps: 36,
  4477. switchFlag: 0
  4478. }, {
  4479. qe: 0x0085,
  4480. nmps: 40,
  4481. nlps: 37,
  4482. switchFlag: 0
  4483. }, {
  4484. qe: 0x0049,
  4485. nmps: 41,
  4486. nlps: 38,
  4487. switchFlag: 0
  4488. }, {
  4489. qe: 0x0025,
  4490. nmps: 42,
  4491. nlps: 39,
  4492. switchFlag: 0
  4493. }, {
  4494. qe: 0x0015,
  4495. nmps: 43,
  4496. nlps: 40,
  4497. switchFlag: 0
  4498. }, {
  4499. qe: 0x0009,
  4500. nmps: 44,
  4501. nlps: 41,
  4502. switchFlag: 0
  4503. }, {
  4504. qe: 0x0005,
  4505. nmps: 45,
  4506. nlps: 42,
  4507. switchFlag: 0
  4508. }, {
  4509. qe: 0x0001,
  4510. nmps: 45,
  4511. nlps: 43,
  4512. switchFlag: 0
  4513. }, {
  4514. qe: 0x5601,
  4515. nmps: 46,
  4516. nlps: 46,
  4517. switchFlag: 0
  4518. }];
  4519. class ArithmeticDecoder {
  4520. constructor(data, start, end) {
  4521. this.data = data;
  4522. this.bp = start;
  4523. this.dataEnd = end;
  4524. this.chigh = data[start];
  4525. this.clow = 0;
  4526. this.byteIn();
  4527. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  4528. this.clow = this.clow << 7 & 0xffff;
  4529. this.ct -= 7;
  4530. this.a = 0x8000;
  4531. }
  4532. byteIn() {
  4533. const data = this.data;
  4534. let bp = this.bp;
  4535. if (data[bp] === 0xff) {
  4536. if (data[bp + 1] > 0x8f) {
  4537. this.clow += 0xff00;
  4538. this.ct = 8;
  4539. } else {
  4540. bp++;
  4541. this.clow += data[bp] << 9;
  4542. this.ct = 7;
  4543. this.bp = bp;
  4544. }
  4545. } else {
  4546. bp++;
  4547. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  4548. this.ct = 8;
  4549. this.bp = bp;
  4550. }
  4551. if (this.clow > 0xffff) {
  4552. this.chigh += this.clow >> 16;
  4553. this.clow &= 0xffff;
  4554. }
  4555. }
  4556. readBit(contexts, pos) {
  4557. let cx_index = contexts[pos] >> 1,
  4558. cx_mps = contexts[pos] & 1;
  4559. const qeTableIcx = QeTable[cx_index];
  4560. const qeIcx = qeTableIcx.qe;
  4561. let d;
  4562. let a = this.a - qeIcx;
  4563. if (this.chigh < qeIcx) {
  4564. if (a < qeIcx) {
  4565. a = qeIcx;
  4566. d = cx_mps;
  4567. cx_index = qeTableIcx.nmps;
  4568. } else {
  4569. a = qeIcx;
  4570. d = 1 ^ cx_mps;
  4571. if (qeTableIcx.switchFlag === 1) {
  4572. cx_mps = d;
  4573. }
  4574. cx_index = qeTableIcx.nlps;
  4575. }
  4576. } else {
  4577. this.chigh -= qeIcx;
  4578. if ((a & 0x8000) !== 0) {
  4579. this.a = a;
  4580. return cx_mps;
  4581. }
  4582. if (a < qeIcx) {
  4583. d = 1 ^ cx_mps;
  4584. if (qeTableIcx.switchFlag === 1) {
  4585. cx_mps = d;
  4586. }
  4587. cx_index = qeTableIcx.nlps;
  4588. } else {
  4589. d = cx_mps;
  4590. cx_index = qeTableIcx.nmps;
  4591. }
  4592. }
  4593. do {
  4594. if (this.ct === 0) {
  4595. this.byteIn();
  4596. }
  4597. a <<= 1;
  4598. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  4599. this.clow = this.clow << 1 & 0xffff;
  4600. this.ct--;
  4601. } while ((a & 0x8000) === 0);
  4602. this.a = a;
  4603. contexts[pos] = cx_index << 1 | cx_mps;
  4604. return d;
  4605. }
  4606. }
  4607. ;// ./src/core/jbig2.js
  4608. class Jbig2Error extends BaseException {
  4609. constructor(msg) {
  4610. super(msg, "Jbig2Error");
  4611. }
  4612. }
  4613. class ContextCache {
  4614. getContexts(id) {
  4615. if (id in this) {
  4616. return this[id];
  4617. }
  4618. return this[id] = new Int8Array(1 << 16);
  4619. }
  4620. }
  4621. class DecodingContext {
  4622. constructor(data, start, end) {
  4623. this.data = data;
  4624. this.start = start;
  4625. this.end = end;
  4626. }
  4627. get decoder() {
  4628. const decoder = new ArithmeticDecoder(this.data, this.start, this.end);
  4629. return shadow(this, "decoder", decoder);
  4630. }
  4631. get contextCache() {
  4632. const cache = new ContextCache();
  4633. return shadow(this, "contextCache", cache);
  4634. }
  4635. }
  4636. function decodeInteger(contextCache, procedure, decoder) {
  4637. const contexts = contextCache.getContexts(procedure);
  4638. let prev = 1;
  4639. function readBits(length) {
  4640. let v = 0;
  4641. for (let i = 0; i < length; i++) {
  4642. const bit = decoder.readBit(contexts, prev);
  4643. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  4644. v = v << 1 | bit;
  4645. }
  4646. return v >>> 0;
  4647. }
  4648. const sign = readBits(1);
  4649. const value = readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(1) ? readBits(32) + 4436 : readBits(12) + 340 : readBits(8) + 84 : readBits(6) + 20 : readBits(4) + 4 : readBits(2);
  4650. let signedValue;
  4651. if (sign === 0) {
  4652. signedValue = value;
  4653. } else if (value > 0) {
  4654. signedValue = -value;
  4655. }
  4656. if (signedValue >= MIN_INT_32 && signedValue <= MAX_INT_32) {
  4657. return signedValue;
  4658. }
  4659. return null;
  4660. }
  4661. function decodeIAID(contextCache, decoder, codeLength) {
  4662. const contexts = contextCache.getContexts("IAID");
  4663. let prev = 1;
  4664. for (let i = 0; i < codeLength; i++) {
  4665. const bit = decoder.readBit(contexts, prev);
  4666. prev = prev << 1 | bit;
  4667. }
  4668. if (codeLength < 31) {
  4669. return prev & (1 << codeLength) - 1;
  4670. }
  4671. return prev & 0x7fffffff;
  4672. }
  4673. const SegmentTypes = ["SymbolDictionary", null, null, null, "IntermediateTextRegion", null, "ImmediateTextRegion", "ImmediateLosslessTextRegion", null, null, null, null, null, null, null, null, "PatternDictionary", null, null, null, "IntermediateHalftoneRegion", null, "ImmediateHalftoneRegion", "ImmediateLosslessHalftoneRegion", null, null, null, null, null, null, null, null, null, null, null, null, "IntermediateGenericRegion", null, "ImmediateGenericRegion", "ImmediateLosslessGenericRegion", "IntermediateGenericRefinementRegion", null, "ImmediateGenericRefinementRegion", "ImmediateLosslessGenericRefinementRegion", null, null, null, null, "PageInformation", "EndOfPage", "EndOfStripe", "EndOfFile", "Profiles", "Tables", null, null, null, null, null, null, null, null, "Extension"];
  4674. const CodingTemplates = [[{
  4675. x: -1,
  4676. y: -2
  4677. }, {
  4678. x: 0,
  4679. y: -2
  4680. }, {
  4681. x: 1,
  4682. y: -2
  4683. }, {
  4684. x: -2,
  4685. y: -1
  4686. }, {
  4687. x: -1,
  4688. y: -1
  4689. }, {
  4690. x: 0,
  4691. y: -1
  4692. }, {
  4693. x: 1,
  4694. y: -1
  4695. }, {
  4696. x: 2,
  4697. y: -1
  4698. }, {
  4699. x: -4,
  4700. y: 0
  4701. }, {
  4702. x: -3,
  4703. y: 0
  4704. }, {
  4705. x: -2,
  4706. y: 0
  4707. }, {
  4708. x: -1,
  4709. y: 0
  4710. }], [{
  4711. x: -1,
  4712. y: -2
  4713. }, {
  4714. x: 0,
  4715. y: -2
  4716. }, {
  4717. x: 1,
  4718. y: -2
  4719. }, {
  4720. x: 2,
  4721. y: -2
  4722. }, {
  4723. x: -2,
  4724. y: -1
  4725. }, {
  4726. x: -1,
  4727. y: -1
  4728. }, {
  4729. x: 0,
  4730. y: -1
  4731. }, {
  4732. x: 1,
  4733. y: -1
  4734. }, {
  4735. x: 2,
  4736. y: -1
  4737. }, {
  4738. x: -3,
  4739. y: 0
  4740. }, {
  4741. x: -2,
  4742. y: 0
  4743. }, {
  4744. x: -1,
  4745. y: 0
  4746. }], [{
  4747. x: -1,
  4748. y: -2
  4749. }, {
  4750. x: 0,
  4751. y: -2
  4752. }, {
  4753. x: 1,
  4754. y: -2
  4755. }, {
  4756. x: -2,
  4757. y: -1
  4758. }, {
  4759. x: -1,
  4760. y: -1
  4761. }, {
  4762. x: 0,
  4763. y: -1
  4764. }, {
  4765. x: 1,
  4766. y: -1
  4767. }, {
  4768. x: -2,
  4769. y: 0
  4770. }, {
  4771. x: -1,
  4772. y: 0
  4773. }], [{
  4774. x: -3,
  4775. y: -1
  4776. }, {
  4777. x: -2,
  4778. y: -1
  4779. }, {
  4780. x: -1,
  4781. y: -1
  4782. }, {
  4783. x: 0,
  4784. y: -1
  4785. }, {
  4786. x: 1,
  4787. y: -1
  4788. }, {
  4789. x: -4,
  4790. y: 0
  4791. }, {
  4792. x: -3,
  4793. y: 0
  4794. }, {
  4795. x: -2,
  4796. y: 0
  4797. }, {
  4798. x: -1,
  4799. y: 0
  4800. }]];
  4801. const RefinementTemplates = [{
  4802. coding: [{
  4803. x: 0,
  4804. y: -1
  4805. }, {
  4806. x: 1,
  4807. y: -1
  4808. }, {
  4809. x: -1,
  4810. y: 0
  4811. }],
  4812. reference: [{
  4813. x: 0,
  4814. y: -1
  4815. }, {
  4816. x: 1,
  4817. y: -1
  4818. }, {
  4819. x: -1,
  4820. y: 0
  4821. }, {
  4822. x: 0,
  4823. y: 0
  4824. }, {
  4825. x: 1,
  4826. y: 0
  4827. }, {
  4828. x: -1,
  4829. y: 1
  4830. }, {
  4831. x: 0,
  4832. y: 1
  4833. }, {
  4834. x: 1,
  4835. y: 1
  4836. }]
  4837. }, {
  4838. coding: [{
  4839. x: -1,
  4840. y: -1
  4841. }, {
  4842. x: 0,
  4843. y: -1
  4844. }, {
  4845. x: 1,
  4846. y: -1
  4847. }, {
  4848. x: -1,
  4849. y: 0
  4850. }],
  4851. reference: [{
  4852. x: 0,
  4853. y: -1
  4854. }, {
  4855. x: -1,
  4856. y: 0
  4857. }, {
  4858. x: 0,
  4859. y: 0
  4860. }, {
  4861. x: 1,
  4862. y: 0
  4863. }, {
  4864. x: 0,
  4865. y: 1
  4866. }, {
  4867. x: 1,
  4868. y: 1
  4869. }]
  4870. }];
  4871. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  4872. const RefinementReusedContexts = [0x0020, 0x0008];
  4873. function decodeBitmapTemplate0(width, height, decodingContext) {
  4874. const decoder = decodingContext.decoder;
  4875. const contexts = decodingContext.contextCache.getContexts("GB");
  4876. const bitmap = [];
  4877. let contextLabel, i, j, pixel, row, row1, row2;
  4878. const OLD_PIXEL_MASK = 0x7bf7;
  4879. for (i = 0; i < height; i++) {
  4880. row = bitmap[i] = new Uint8Array(width);
  4881. row1 = i < 1 ? row : bitmap[i - 1];
  4882. row2 = i < 2 ? row : bitmap[i - 2];
  4883. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  4884. for (j = 0; j < width; j++) {
  4885. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  4886. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  4887. }
  4888. }
  4889. return bitmap;
  4890. }
  4891. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  4892. if (mmr) {
  4893. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  4894. return decodeMMRBitmap(input, width, height, false);
  4895. }
  4896. if (templateIndex === 0 && !skip && !prediction && at.length === 4 && at[0].x === 3 && at[0].y === -1 && at[1].x === -3 && at[1].y === -1 && at[2].x === 2 && at[2].y === -2 && at[3].x === -2 && at[3].y === -2) {
  4897. return decodeBitmapTemplate0(width, height, decodingContext);
  4898. }
  4899. const useskip = !!skip;
  4900. const template = CodingTemplates[templateIndex].concat(at);
  4901. template.sort(function (a, b) {
  4902. return a.y - b.y || a.x - b.x;
  4903. });
  4904. const templateLength = template.length;
  4905. const templateX = new Int8Array(templateLength);
  4906. const templateY = new Int8Array(templateLength);
  4907. const changingTemplateEntries = [];
  4908. let reuseMask = 0,
  4909. minX = 0,
  4910. maxX = 0,
  4911. minY = 0;
  4912. let c, k;
  4913. for (k = 0; k < templateLength; k++) {
  4914. templateX[k] = template[k].x;
  4915. templateY[k] = template[k].y;
  4916. minX = Math.min(minX, template[k].x);
  4917. maxX = Math.max(maxX, template[k].x);
  4918. minY = Math.min(minY, template[k].y);
  4919. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  4920. reuseMask |= 1 << templateLength - 1 - k;
  4921. } else {
  4922. changingTemplateEntries.push(k);
  4923. }
  4924. }
  4925. const changingEntriesLength = changingTemplateEntries.length;
  4926. const changingTemplateX = new Int8Array(changingEntriesLength);
  4927. const changingTemplateY = new Int8Array(changingEntriesLength);
  4928. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  4929. for (c = 0; c < changingEntriesLength; c++) {
  4930. k = changingTemplateEntries[c];
  4931. changingTemplateX[c] = template[k].x;
  4932. changingTemplateY[c] = template[k].y;
  4933. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  4934. }
  4935. const sbb_left = -minX;
  4936. const sbb_top = -minY;
  4937. const sbb_right = width - maxX;
  4938. const pseudoPixelContext = ReusedContexts[templateIndex];
  4939. let row = new Uint8Array(width);
  4940. const bitmap = [];
  4941. const decoder = decodingContext.decoder;
  4942. const contexts = decodingContext.contextCache.getContexts("GB");
  4943. let ltp = 0,
  4944. j,
  4945. i0,
  4946. j0,
  4947. contextLabel = 0,
  4948. bit,
  4949. shift;
  4950. for (let i = 0; i < height; i++) {
  4951. if (prediction) {
  4952. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  4953. ltp ^= sltp;
  4954. if (ltp) {
  4955. bitmap.push(row);
  4956. continue;
  4957. }
  4958. }
  4959. row = new Uint8Array(row);
  4960. bitmap.push(row);
  4961. for (j = 0; j < width; j++) {
  4962. if (useskip && skip[i][j]) {
  4963. row[j] = 0;
  4964. continue;
  4965. }
  4966. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  4967. contextLabel = contextLabel << 1 & reuseMask;
  4968. for (k = 0; k < changingEntriesLength; k++) {
  4969. i0 = i + changingTemplateY[k];
  4970. j0 = j + changingTemplateX[k];
  4971. bit = bitmap[i0][j0];
  4972. if (bit) {
  4973. bit = changingTemplateBit[k];
  4974. contextLabel |= bit;
  4975. }
  4976. }
  4977. } else {
  4978. contextLabel = 0;
  4979. shift = templateLength - 1;
  4980. for (k = 0; k < templateLength; k++, shift--) {
  4981. j0 = j + templateX[k];
  4982. if (j0 >= 0 && j0 < width) {
  4983. i0 = i + templateY[k];
  4984. if (i0 >= 0) {
  4985. bit = bitmap[i0][j0];
  4986. if (bit) {
  4987. contextLabel |= bit << shift;
  4988. }
  4989. }
  4990. }
  4991. }
  4992. }
  4993. const pixel = decoder.readBit(contexts, contextLabel);
  4994. row[j] = pixel;
  4995. }
  4996. }
  4997. return bitmap;
  4998. }
  4999. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  5000. let codingTemplate = RefinementTemplates[templateIndex].coding;
  5001. if (templateIndex === 0) {
  5002. codingTemplate = codingTemplate.concat([at[0]]);
  5003. }
  5004. const codingTemplateLength = codingTemplate.length;
  5005. const codingTemplateX = new Int32Array(codingTemplateLength);
  5006. const codingTemplateY = new Int32Array(codingTemplateLength);
  5007. let k;
  5008. for (k = 0; k < codingTemplateLength; k++) {
  5009. codingTemplateX[k] = codingTemplate[k].x;
  5010. codingTemplateY[k] = codingTemplate[k].y;
  5011. }
  5012. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  5013. if (templateIndex === 0) {
  5014. referenceTemplate = referenceTemplate.concat([at[1]]);
  5015. }
  5016. const referenceTemplateLength = referenceTemplate.length;
  5017. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  5018. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  5019. for (k = 0; k < referenceTemplateLength; k++) {
  5020. referenceTemplateX[k] = referenceTemplate[k].x;
  5021. referenceTemplateY[k] = referenceTemplate[k].y;
  5022. }
  5023. const referenceWidth = referenceBitmap[0].length;
  5024. const referenceHeight = referenceBitmap.length;
  5025. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  5026. const bitmap = [];
  5027. const decoder = decodingContext.decoder;
  5028. const contexts = decodingContext.contextCache.getContexts("GR");
  5029. let ltp = 0;
  5030. for (let i = 0; i < height; i++) {
  5031. if (prediction) {
  5032. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  5033. ltp ^= sltp;
  5034. if (ltp) {
  5035. throw new Jbig2Error("prediction is not supported");
  5036. }
  5037. }
  5038. const row = new Uint8Array(width);
  5039. bitmap.push(row);
  5040. for (let j = 0; j < width; j++) {
  5041. let i0, j0;
  5042. let contextLabel = 0;
  5043. for (k = 0; k < codingTemplateLength; k++) {
  5044. i0 = i + codingTemplateY[k];
  5045. j0 = j + codingTemplateX[k];
  5046. if (i0 < 0 || j0 < 0 || j0 >= width) {
  5047. contextLabel <<= 1;
  5048. } else {
  5049. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  5050. }
  5051. }
  5052. for (k = 0; k < referenceTemplateLength; k++) {
  5053. i0 = i + referenceTemplateY[k] - offsetY;
  5054. j0 = j + referenceTemplateX[k] - offsetX;
  5055. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  5056. contextLabel <<= 1;
  5057. } else {
  5058. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  5059. }
  5060. }
  5061. const pixel = decoder.readBit(contexts, contextLabel);
  5062. row[j] = pixel;
  5063. }
  5064. }
  5065. return bitmap;
  5066. }
  5067. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  5068. if (huffman && refinement) {
  5069. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  5070. }
  5071. const newSymbols = [];
  5072. let currentHeight = 0;
  5073. let symbolCodeLength = log2(symbols.length + numberOfNewSymbols);
  5074. const decoder = decodingContext.decoder;
  5075. const contextCache = decodingContext.contextCache;
  5076. let tableB1, symbolWidths;
  5077. if (huffman) {
  5078. tableB1 = getStandardTable(1);
  5079. symbolWidths = [];
  5080. symbolCodeLength = Math.max(symbolCodeLength, 1);
  5081. }
  5082. while (newSymbols.length < numberOfNewSymbols) {
  5083. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  5084. currentHeight += deltaHeight;
  5085. let currentWidth = 0,
  5086. totalWidth = 0;
  5087. const firstSymbol = huffman ? symbolWidths.length : 0;
  5088. while (true) {
  5089. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  5090. if (deltaWidth === null) {
  5091. break;
  5092. }
  5093. currentWidth += deltaWidth;
  5094. totalWidth += currentWidth;
  5095. let bitmap;
  5096. if (refinement) {
  5097. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  5098. if (numberOfInstances > 1) {
  5099. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  5100. } else {
  5101. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  5102. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  5103. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  5104. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  5105. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  5106. }
  5107. newSymbols.push(bitmap);
  5108. } else if (huffman) {
  5109. symbolWidths.push(currentWidth);
  5110. } else {
  5111. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  5112. newSymbols.push(bitmap);
  5113. }
  5114. }
  5115. if (huffman && !refinement) {
  5116. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  5117. huffmanInput.byteAlign();
  5118. let collectiveBitmap;
  5119. if (bitmapSize === 0) {
  5120. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  5121. } else {
  5122. const originalEnd = huffmanInput.end;
  5123. const bitmapEnd = huffmanInput.position + bitmapSize;
  5124. huffmanInput.end = bitmapEnd;
  5125. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  5126. huffmanInput.end = originalEnd;
  5127. huffmanInput.position = bitmapEnd;
  5128. }
  5129. const numberOfSymbolsDecoded = symbolWidths.length;
  5130. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  5131. newSymbols.push(collectiveBitmap);
  5132. } else {
  5133. let i,
  5134. y,
  5135. xMin = 0,
  5136. xMax,
  5137. bitmapWidth,
  5138. symbolBitmap;
  5139. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  5140. bitmapWidth = symbolWidths[i];
  5141. xMax = xMin + bitmapWidth;
  5142. symbolBitmap = [];
  5143. for (y = 0; y < currentHeight; y++) {
  5144. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  5145. }
  5146. newSymbols.push(symbolBitmap);
  5147. xMin = xMax;
  5148. }
  5149. }
  5150. }
  5151. }
  5152. const exportedSymbols = [],
  5153. flags = [];
  5154. let currentFlag = false,
  5155. i,
  5156. ii;
  5157. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  5158. while (flags.length < totalSymbolsLength) {
  5159. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  5160. while (runLength--) {
  5161. flags.push(currentFlag);
  5162. }
  5163. currentFlag = !currentFlag;
  5164. }
  5165. for (i = 0, ii = symbols.length; i < ii; i++) {
  5166. if (flags[i]) {
  5167. exportedSymbols.push(symbols[i]);
  5168. }
  5169. }
  5170. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  5171. if (flags[i]) {
  5172. exportedSymbols.push(newSymbols[j]);
  5173. }
  5174. }
  5175. return exportedSymbols;
  5176. }
  5177. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  5178. if (huffman && refinement) {
  5179. throw new Jbig2Error("refinement with Huffman is not supported");
  5180. }
  5181. const bitmap = [];
  5182. let i, row;
  5183. for (i = 0; i < height; i++) {
  5184. row = new Uint8Array(width);
  5185. if (defaultPixelValue) {
  5186. for (let j = 0; j < width; j++) {
  5187. row[j] = defaultPixelValue;
  5188. }
  5189. }
  5190. bitmap.push(row);
  5191. }
  5192. const decoder = decodingContext.decoder;
  5193. const contextCache = decodingContext.contextCache;
  5194. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  5195. let firstS = 0;
  5196. i = 0;
  5197. while (i < numberOfSymbolInstances) {
  5198. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  5199. stripT += deltaT;
  5200. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  5201. firstS += deltaFirstS;
  5202. let currentS = firstS;
  5203. do {
  5204. let currentT = 0;
  5205. if (stripSize > 1) {
  5206. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  5207. }
  5208. const t = stripSize * stripT + currentT;
  5209. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  5210. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  5211. let symbolBitmap = inputSymbols[symbolId];
  5212. let symbolWidth = symbolBitmap[0].length;
  5213. let symbolHeight = symbolBitmap.length;
  5214. if (applyRefinement) {
  5215. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  5216. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  5217. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  5218. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  5219. symbolWidth += rdw;
  5220. symbolHeight += rdh;
  5221. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  5222. }
  5223. let increment = 0;
  5224. if (!transposed) {
  5225. if (referenceCorner > 1) {
  5226. currentS += symbolWidth - 1;
  5227. } else {
  5228. increment = symbolWidth - 1;
  5229. }
  5230. } else if (!(referenceCorner & 1)) {
  5231. currentS += symbolHeight - 1;
  5232. } else {
  5233. increment = symbolHeight - 1;
  5234. }
  5235. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  5236. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  5237. let s2, t2, symbolRow;
  5238. if (transposed) {
  5239. for (s2 = 0; s2 < symbolHeight; s2++) {
  5240. row = bitmap[offsetS + s2];
  5241. if (!row) {
  5242. continue;
  5243. }
  5244. symbolRow = symbolBitmap[s2];
  5245. const maxWidth = Math.min(width - offsetT, symbolWidth);
  5246. switch (combinationOperator) {
  5247. case 0:
  5248. for (t2 = 0; t2 < maxWidth; t2++) {
  5249. row[offsetT + t2] |= symbolRow[t2];
  5250. }
  5251. break;
  5252. case 2:
  5253. for (t2 = 0; t2 < maxWidth; t2++) {
  5254. row[offsetT + t2] ^= symbolRow[t2];
  5255. }
  5256. break;
  5257. default:
  5258. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  5259. }
  5260. }
  5261. } else {
  5262. for (t2 = 0; t2 < symbolHeight; t2++) {
  5263. row = bitmap[offsetT + t2];
  5264. if (!row) {
  5265. continue;
  5266. }
  5267. symbolRow = symbolBitmap[t2];
  5268. switch (combinationOperator) {
  5269. case 0:
  5270. for (s2 = 0; s2 < symbolWidth; s2++) {
  5271. row[offsetS + s2] |= symbolRow[s2];
  5272. }
  5273. break;
  5274. case 2:
  5275. for (s2 = 0; s2 < symbolWidth; s2++) {
  5276. row[offsetS + s2] ^= symbolRow[s2];
  5277. }
  5278. break;
  5279. default:
  5280. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  5281. }
  5282. }
  5283. }
  5284. i++;
  5285. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  5286. if (deltaS === null) {
  5287. break;
  5288. }
  5289. currentS += increment + deltaS + dsOffset;
  5290. } while (true);
  5291. }
  5292. return bitmap;
  5293. }
  5294. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  5295. const at = [];
  5296. if (!mmr) {
  5297. at.push({
  5298. x: -patternWidth,
  5299. y: 0
  5300. });
  5301. if (template === 0) {
  5302. at.push({
  5303. x: -3,
  5304. y: -1
  5305. }, {
  5306. x: 2,
  5307. y: -2
  5308. }, {
  5309. x: -2,
  5310. y: -2
  5311. });
  5312. }
  5313. }
  5314. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  5315. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  5316. const patterns = [];
  5317. for (let i = 0; i <= maxPatternIndex; i++) {
  5318. const patternBitmap = [];
  5319. const xMin = patternWidth * i;
  5320. const xMax = xMin + patternWidth;
  5321. for (let y = 0; y < patternHeight; y++) {
  5322. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  5323. }
  5324. patterns.push(patternBitmap);
  5325. }
  5326. return patterns;
  5327. }
  5328. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  5329. const skip = null;
  5330. if (enableSkip) {
  5331. throw new Jbig2Error("skip is not supported");
  5332. }
  5333. if (combinationOperator !== 0) {
  5334. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  5335. }
  5336. const regionBitmap = [];
  5337. let i, j, row;
  5338. for (i = 0; i < regionHeight; i++) {
  5339. row = new Uint8Array(regionWidth);
  5340. if (defaultPixelValue) {
  5341. for (j = 0; j < regionWidth; j++) {
  5342. row[j] = defaultPixelValue;
  5343. }
  5344. }
  5345. regionBitmap.push(row);
  5346. }
  5347. const numberOfPatterns = patterns.length;
  5348. const pattern0 = patterns[0];
  5349. const patternWidth = pattern0[0].length,
  5350. patternHeight = pattern0.length;
  5351. const bitsPerValue = log2(numberOfPatterns);
  5352. const at = [];
  5353. if (!mmr) {
  5354. at.push({
  5355. x: template <= 1 ? 3 : 2,
  5356. y: -1
  5357. });
  5358. if (template === 0) {
  5359. at.push({
  5360. x: -3,
  5361. y: -1
  5362. }, {
  5363. x: 2,
  5364. y: -2
  5365. }, {
  5366. x: -2,
  5367. y: -2
  5368. });
  5369. }
  5370. }
  5371. const grayScaleBitPlanes = [];
  5372. let mmrInput, bitmap;
  5373. if (mmr) {
  5374. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  5375. }
  5376. for (i = bitsPerValue - 1; i >= 0; i--) {
  5377. if (mmr) {
  5378. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  5379. } else {
  5380. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  5381. }
  5382. grayScaleBitPlanes[i] = bitmap;
  5383. }
  5384. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  5385. for (mg = 0; mg < gridHeight; mg++) {
  5386. for (ng = 0; ng < gridWidth; ng++) {
  5387. bit = 0;
  5388. patternIndex = 0;
  5389. for (j = bitsPerValue - 1; j >= 0; j--) {
  5390. bit ^= grayScaleBitPlanes[j][mg][ng];
  5391. patternIndex |= bit << j;
  5392. }
  5393. patternBitmap = patterns[patternIndex];
  5394. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  5395. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  5396. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  5397. for (i = 0; i < patternHeight; i++) {
  5398. regionRow = regionBitmap[y + i];
  5399. patternRow = patternBitmap[i];
  5400. for (j = 0; j < patternWidth; j++) {
  5401. regionRow[x + j] |= patternRow[j];
  5402. }
  5403. }
  5404. } else {
  5405. let regionX, regionY;
  5406. for (i = 0; i < patternHeight; i++) {
  5407. regionY = y + i;
  5408. if (regionY < 0 || regionY >= regionHeight) {
  5409. continue;
  5410. }
  5411. regionRow = regionBitmap[regionY];
  5412. patternRow = patternBitmap[i];
  5413. for (j = 0; j < patternWidth; j++) {
  5414. regionX = x + j;
  5415. if (regionX >= 0 && regionX < regionWidth) {
  5416. regionRow[regionX] |= patternRow[j];
  5417. }
  5418. }
  5419. }
  5420. }
  5421. }
  5422. }
  5423. return regionBitmap;
  5424. }
  5425. function readSegmentHeader(data, start) {
  5426. const segmentHeader = {};
  5427. segmentHeader.number = readUint32(data, start);
  5428. const flags = data[start + 4];
  5429. const segmentType = flags & 0x3f;
  5430. if (!SegmentTypes[segmentType]) {
  5431. throw new Jbig2Error("invalid segment type: " + segmentType);
  5432. }
  5433. segmentHeader.type = segmentType;
  5434. segmentHeader.typeName = SegmentTypes[segmentType];
  5435. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  5436. const pageAssociationFieldSize = !!(flags & 0x40);
  5437. const referredFlags = data[start + 5];
  5438. let referredToCount = referredFlags >> 5 & 7;
  5439. const retainBits = [referredFlags & 31];
  5440. let position = start + 6;
  5441. if (referredFlags === 7) {
  5442. referredToCount = readUint32(data, position - 1) & 0x1fffffff;
  5443. position += 3;
  5444. let bytes = referredToCount + 7 >> 3;
  5445. retainBits[0] = data[position++];
  5446. while (--bytes > 0) {
  5447. retainBits.push(data[position++]);
  5448. }
  5449. } else if (referredFlags === 5 || referredFlags === 6) {
  5450. throw new Jbig2Error("invalid referred-to flags");
  5451. }
  5452. segmentHeader.retainBits = retainBits;
  5453. let referredToSegmentNumberSize = 4;
  5454. if (segmentHeader.number <= 256) {
  5455. referredToSegmentNumberSize = 1;
  5456. } else if (segmentHeader.number <= 65536) {
  5457. referredToSegmentNumberSize = 2;
  5458. }
  5459. const referredTo = [];
  5460. let i, ii;
  5461. for (i = 0; i < referredToCount; i++) {
  5462. let number;
  5463. if (referredToSegmentNumberSize === 1) {
  5464. number = data[position];
  5465. } else if (referredToSegmentNumberSize === 2) {
  5466. number = readUint16(data, position);
  5467. } else {
  5468. number = readUint32(data, position);
  5469. }
  5470. referredTo.push(number);
  5471. position += referredToSegmentNumberSize;
  5472. }
  5473. segmentHeader.referredTo = referredTo;
  5474. if (!pageAssociationFieldSize) {
  5475. segmentHeader.pageAssociation = data[position++];
  5476. } else {
  5477. segmentHeader.pageAssociation = readUint32(data, position);
  5478. position += 4;
  5479. }
  5480. segmentHeader.length = readUint32(data, position);
  5481. position += 4;
  5482. if (segmentHeader.length === 0xffffffff) {
  5483. if (segmentType === 38) {
  5484. const genericRegionInfo = readRegionSegmentInformation(data, position);
  5485. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  5486. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  5487. const searchPatternLength = 6;
  5488. const searchPattern = new Uint8Array(searchPatternLength);
  5489. if (!genericRegionMmr) {
  5490. searchPattern[0] = 0xff;
  5491. searchPattern[1] = 0xac;
  5492. }
  5493. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  5494. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  5495. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  5496. searchPattern[5] = genericRegionInfo.height & 0xff;
  5497. for (i = position, ii = data.length; i < ii; i++) {
  5498. let j = 0;
  5499. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  5500. j++;
  5501. }
  5502. if (j === searchPatternLength) {
  5503. segmentHeader.length = i + searchPatternLength;
  5504. break;
  5505. }
  5506. }
  5507. if (segmentHeader.length === 0xffffffff) {
  5508. throw new Jbig2Error("segment end was not found");
  5509. }
  5510. } else {
  5511. throw new Jbig2Error("invalid unknown segment length");
  5512. }
  5513. }
  5514. segmentHeader.headerEnd = position;
  5515. return segmentHeader;
  5516. }
  5517. function readSegments(header, data, start, end) {
  5518. const segments = [];
  5519. let position = start;
  5520. while (position < end) {
  5521. const segmentHeader = readSegmentHeader(data, position);
  5522. position = segmentHeader.headerEnd;
  5523. const segment = {
  5524. header: segmentHeader,
  5525. data
  5526. };
  5527. if (!header.randomAccess) {
  5528. segment.start = position;
  5529. position += segmentHeader.length;
  5530. segment.end = position;
  5531. }
  5532. segments.push(segment);
  5533. if (segmentHeader.type === 51) {
  5534. break;
  5535. }
  5536. }
  5537. if (header.randomAccess) {
  5538. for (let i = 0, ii = segments.length; i < ii; i++) {
  5539. segments[i].start = position;
  5540. position += segments[i].header.length;
  5541. segments[i].end = position;
  5542. }
  5543. }
  5544. return segments;
  5545. }
  5546. function readRegionSegmentInformation(data, start) {
  5547. return {
  5548. width: readUint32(data, start),
  5549. height: readUint32(data, start + 4),
  5550. x: readUint32(data, start + 8),
  5551. y: readUint32(data, start + 12),
  5552. combinationOperator: data[start + 16] & 7
  5553. };
  5554. }
  5555. const RegionSegmentInformationFieldLength = 17;
  5556. function processSegment(segment, visitor) {
  5557. const header = segment.header;
  5558. const data = segment.data,
  5559. end = segment.end;
  5560. let position = segment.start;
  5561. let args, at, i, atLength;
  5562. switch (header.type) {
  5563. case 0:
  5564. const dictionary = {};
  5565. const dictionaryFlags = readUint16(data, position);
  5566. dictionary.huffman = !!(dictionaryFlags & 1);
  5567. dictionary.refinement = !!(dictionaryFlags & 2);
  5568. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  5569. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  5570. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  5571. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  5572. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  5573. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  5574. dictionary.template = dictionaryFlags >> 10 & 3;
  5575. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  5576. position += 2;
  5577. if (!dictionary.huffman) {
  5578. atLength = dictionary.template === 0 ? 4 : 1;
  5579. at = [];
  5580. for (i = 0; i < atLength; i++) {
  5581. at.push({
  5582. x: readInt8(data, position),
  5583. y: readInt8(data, position + 1)
  5584. });
  5585. position += 2;
  5586. }
  5587. dictionary.at = at;
  5588. }
  5589. if (dictionary.refinement && !dictionary.refinementTemplate) {
  5590. at = [];
  5591. for (i = 0; i < 2; i++) {
  5592. at.push({
  5593. x: readInt8(data, position),
  5594. y: readInt8(data, position + 1)
  5595. });
  5596. position += 2;
  5597. }
  5598. dictionary.refinementAt = at;
  5599. }
  5600. dictionary.numberOfExportedSymbols = readUint32(data, position);
  5601. position += 4;
  5602. dictionary.numberOfNewSymbols = readUint32(data, position);
  5603. position += 4;
  5604. args = [dictionary, header.number, header.referredTo, data, position, end];
  5605. break;
  5606. case 6:
  5607. case 7:
  5608. const textRegion = {};
  5609. textRegion.info = readRegionSegmentInformation(data, position);
  5610. position += RegionSegmentInformationFieldLength;
  5611. const textRegionSegmentFlags = readUint16(data, position);
  5612. position += 2;
  5613. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  5614. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  5615. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  5616. textRegion.stripSize = 1 << textRegion.logStripSize;
  5617. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  5618. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  5619. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  5620. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  5621. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  5622. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  5623. if (textRegion.huffman) {
  5624. const textRegionHuffmanFlags = readUint16(data, position);
  5625. position += 2;
  5626. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  5627. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  5628. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  5629. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  5630. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  5631. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  5632. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  5633. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  5634. }
  5635. if (textRegion.refinement && !textRegion.refinementTemplate) {
  5636. at = [];
  5637. for (i = 0; i < 2; i++) {
  5638. at.push({
  5639. x: readInt8(data, position),
  5640. y: readInt8(data, position + 1)
  5641. });
  5642. position += 2;
  5643. }
  5644. textRegion.refinementAt = at;
  5645. }
  5646. textRegion.numberOfSymbolInstances = readUint32(data, position);
  5647. position += 4;
  5648. args = [textRegion, header.referredTo, data, position, end];
  5649. break;
  5650. case 16:
  5651. const patternDictionary = {};
  5652. const patternDictionaryFlags = data[position++];
  5653. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  5654. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  5655. patternDictionary.patternWidth = data[position++];
  5656. patternDictionary.patternHeight = data[position++];
  5657. patternDictionary.maxPatternIndex = readUint32(data, position);
  5658. position += 4;
  5659. args = [patternDictionary, header.number, data, position, end];
  5660. break;
  5661. case 22:
  5662. case 23:
  5663. const halftoneRegion = {};
  5664. halftoneRegion.info = readRegionSegmentInformation(data, position);
  5665. position += RegionSegmentInformationFieldLength;
  5666. const halftoneRegionFlags = data[position++];
  5667. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  5668. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  5669. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  5670. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  5671. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  5672. halftoneRegion.gridWidth = readUint32(data, position);
  5673. position += 4;
  5674. halftoneRegion.gridHeight = readUint32(data, position);
  5675. position += 4;
  5676. halftoneRegion.gridOffsetX = readUint32(data, position) & 0xffffffff;
  5677. position += 4;
  5678. halftoneRegion.gridOffsetY = readUint32(data, position) & 0xffffffff;
  5679. position += 4;
  5680. halftoneRegion.gridVectorX = readUint16(data, position);
  5681. position += 2;
  5682. halftoneRegion.gridVectorY = readUint16(data, position);
  5683. position += 2;
  5684. args = [halftoneRegion, header.referredTo, data, position, end];
  5685. break;
  5686. case 38:
  5687. case 39:
  5688. const genericRegion = {};
  5689. genericRegion.info = readRegionSegmentInformation(data, position);
  5690. position += RegionSegmentInformationFieldLength;
  5691. const genericRegionSegmentFlags = data[position++];
  5692. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  5693. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  5694. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  5695. if (!genericRegion.mmr) {
  5696. atLength = genericRegion.template === 0 ? 4 : 1;
  5697. at = [];
  5698. for (i = 0; i < atLength; i++) {
  5699. at.push({
  5700. x: readInt8(data, position),
  5701. y: readInt8(data, position + 1)
  5702. });
  5703. position += 2;
  5704. }
  5705. genericRegion.at = at;
  5706. }
  5707. args = [genericRegion, data, position, end];
  5708. break;
  5709. case 48:
  5710. const pageInfo = {
  5711. width: readUint32(data, position),
  5712. height: readUint32(data, position + 4),
  5713. resolutionX: readUint32(data, position + 8),
  5714. resolutionY: readUint32(data, position + 12)
  5715. };
  5716. if (pageInfo.height === 0xffffffff) {
  5717. delete pageInfo.height;
  5718. }
  5719. const pageSegmentFlags = data[position + 16];
  5720. readUint16(data, position + 17);
  5721. pageInfo.lossless = !!(pageSegmentFlags & 1);
  5722. pageInfo.refinement = !!(pageSegmentFlags & 2);
  5723. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  5724. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  5725. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  5726. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  5727. args = [pageInfo];
  5728. break;
  5729. case 49:
  5730. break;
  5731. case 50:
  5732. break;
  5733. case 51:
  5734. break;
  5735. case 53:
  5736. args = [header.number, data, position, end];
  5737. break;
  5738. case 62:
  5739. break;
  5740. default:
  5741. throw new Jbig2Error(`segment type ${header.typeName}(${header.type}) is not implemented`);
  5742. }
  5743. const callbackName = "on" + header.typeName;
  5744. if (callbackName in visitor) {
  5745. visitor[callbackName].apply(visitor, args);
  5746. }
  5747. }
  5748. function processSegments(segments, visitor) {
  5749. for (let i = 0, ii = segments.length; i < ii; i++) {
  5750. processSegment(segments[i], visitor);
  5751. }
  5752. }
  5753. function parseJbig2Chunks(chunks) {
  5754. const visitor = new SimpleSegmentVisitor();
  5755. for (let i = 0, ii = chunks.length; i < ii; i++) {
  5756. const chunk = chunks[i];
  5757. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  5758. processSegments(segments, visitor);
  5759. }
  5760. return visitor.buffer;
  5761. }
  5762. function parseJbig2(data) {
  5763. throw new Error("Not implemented: parseJbig2");
  5764. }
  5765. class SimpleSegmentVisitor {
  5766. onPageInformation(info) {
  5767. this.currentPageInfo = info;
  5768. const rowSize = info.width + 7 >> 3;
  5769. const buffer = new Uint8ClampedArray(rowSize * info.height);
  5770. if (info.defaultPixelValue) {
  5771. buffer.fill(0xff);
  5772. }
  5773. this.buffer = buffer;
  5774. }
  5775. drawBitmap(regionInfo, bitmap) {
  5776. const pageInfo = this.currentPageInfo;
  5777. const width = regionInfo.width,
  5778. height = regionInfo.height;
  5779. const rowSize = pageInfo.width + 7 >> 3;
  5780. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  5781. const buffer = this.buffer;
  5782. const mask0 = 128 >> (regionInfo.x & 7);
  5783. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  5784. let i, j, mask, offset;
  5785. switch (combinationOperator) {
  5786. case 0:
  5787. for (i = 0; i < height; i++) {
  5788. mask = mask0;
  5789. offset = offset0;
  5790. for (j = 0; j < width; j++) {
  5791. if (bitmap[i][j]) {
  5792. buffer[offset] |= mask;
  5793. }
  5794. mask >>= 1;
  5795. if (!mask) {
  5796. mask = 128;
  5797. offset++;
  5798. }
  5799. }
  5800. offset0 += rowSize;
  5801. }
  5802. break;
  5803. case 2:
  5804. for (i = 0; i < height; i++) {
  5805. mask = mask0;
  5806. offset = offset0;
  5807. for (j = 0; j < width; j++) {
  5808. if (bitmap[i][j]) {
  5809. buffer[offset] ^= mask;
  5810. }
  5811. mask >>= 1;
  5812. if (!mask) {
  5813. mask = 128;
  5814. offset++;
  5815. }
  5816. }
  5817. offset0 += rowSize;
  5818. }
  5819. break;
  5820. default:
  5821. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  5822. }
  5823. }
  5824. onImmediateGenericRegion(region, data, start, end) {
  5825. const regionInfo = region.info;
  5826. const decodingContext = new DecodingContext(data, start, end);
  5827. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  5828. this.drawBitmap(regionInfo, bitmap);
  5829. }
  5830. onImmediateLosslessGenericRegion() {
  5831. this.onImmediateGenericRegion(...arguments);
  5832. }
  5833. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  5834. let huffmanTables, huffmanInput;
  5835. if (dictionary.huffman) {
  5836. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  5837. huffmanInput = new Reader(data, start, end);
  5838. }
  5839. let symbols = this.symbols;
  5840. if (!symbols) {
  5841. this.symbols = symbols = {};
  5842. }
  5843. const inputSymbols = [];
  5844. for (const referredSegment of referredSegments) {
  5845. const referredSymbols = symbols[referredSegment];
  5846. if (referredSymbols) {
  5847. inputSymbols.push(...referredSymbols);
  5848. }
  5849. }
  5850. const decodingContext = new DecodingContext(data, start, end);
  5851. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  5852. }
  5853. onImmediateTextRegion(region, referredSegments, data, start, end) {
  5854. const regionInfo = region.info;
  5855. let huffmanTables, huffmanInput;
  5856. const symbols = this.symbols;
  5857. const inputSymbols = [];
  5858. for (const referredSegment of referredSegments) {
  5859. const referredSymbols = symbols[referredSegment];
  5860. if (referredSymbols) {
  5861. inputSymbols.push(...referredSymbols);
  5862. }
  5863. }
  5864. const symbolCodeLength = log2(inputSymbols.length);
  5865. if (region.huffman) {
  5866. huffmanInput = new Reader(data, start, end);
  5867. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  5868. }
  5869. const decodingContext = new DecodingContext(data, start, end);
  5870. const bitmap = decodeTextRegion(region.huffman, region.refinement, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.numberOfSymbolInstances, region.stripSize, inputSymbols, symbolCodeLength, region.transposed, region.dsOffset, region.referenceCorner, region.combinationOperator, huffmanTables, region.refinementTemplate, region.refinementAt, decodingContext, region.logStripSize, huffmanInput);
  5871. this.drawBitmap(regionInfo, bitmap);
  5872. }
  5873. onImmediateLosslessTextRegion() {
  5874. this.onImmediateTextRegion(...arguments);
  5875. }
  5876. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  5877. let patterns = this.patterns;
  5878. if (!patterns) {
  5879. this.patterns = patterns = {};
  5880. }
  5881. const decodingContext = new DecodingContext(data, start, end);
  5882. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  5883. }
  5884. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  5885. const patterns = this.patterns[referredSegments[0]];
  5886. const regionInfo = region.info;
  5887. const decodingContext = new DecodingContext(data, start, end);
  5888. const bitmap = decodeHalftoneRegion(region.mmr, patterns, region.template, regionInfo.width, regionInfo.height, region.defaultPixelValue, region.enableSkip, region.combinationOperator, region.gridWidth, region.gridHeight, region.gridOffsetX, region.gridOffsetY, region.gridVectorX, region.gridVectorY, decodingContext);
  5889. this.drawBitmap(regionInfo, bitmap);
  5890. }
  5891. onImmediateLosslessHalftoneRegion() {
  5892. this.onImmediateHalftoneRegion(...arguments);
  5893. }
  5894. onTables(currentSegment, data, start, end) {
  5895. let customTables = this.customTables;
  5896. if (!customTables) {
  5897. this.customTables = customTables = {};
  5898. }
  5899. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  5900. }
  5901. }
  5902. class HuffmanLine {
  5903. constructor(lineData) {
  5904. if (lineData.length === 2) {
  5905. this.isOOB = true;
  5906. this.rangeLow = 0;
  5907. this.prefixLength = lineData[0];
  5908. this.rangeLength = 0;
  5909. this.prefixCode = lineData[1];
  5910. this.isLowerRange = false;
  5911. } else {
  5912. this.isOOB = false;
  5913. this.rangeLow = lineData[0];
  5914. this.prefixLength = lineData[1];
  5915. this.rangeLength = lineData[2];
  5916. this.prefixCode = lineData[3];
  5917. this.isLowerRange = lineData[4] === "lower";
  5918. }
  5919. }
  5920. }
  5921. class HuffmanTreeNode {
  5922. constructor(line) {
  5923. this.children = [];
  5924. if (line) {
  5925. this.isLeaf = true;
  5926. this.rangeLength = line.rangeLength;
  5927. this.rangeLow = line.rangeLow;
  5928. this.isLowerRange = line.isLowerRange;
  5929. this.isOOB = line.isOOB;
  5930. } else {
  5931. this.isLeaf = false;
  5932. }
  5933. }
  5934. buildTree(line, shift) {
  5935. const bit = line.prefixCode >> shift & 1;
  5936. if (shift <= 0) {
  5937. this.children[bit] = new HuffmanTreeNode(line);
  5938. } else {
  5939. let node = this.children[bit];
  5940. if (!node) {
  5941. this.children[bit] = node = new HuffmanTreeNode(null);
  5942. }
  5943. node.buildTree(line, shift - 1);
  5944. }
  5945. }
  5946. decodeNode(reader) {
  5947. if (this.isLeaf) {
  5948. if (this.isOOB) {
  5949. return null;
  5950. }
  5951. const htOffset = reader.readBits(this.rangeLength);
  5952. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  5953. }
  5954. const node = this.children[reader.readBit()];
  5955. if (!node) {
  5956. throw new Jbig2Error("invalid Huffman data");
  5957. }
  5958. return node.decodeNode(reader);
  5959. }
  5960. }
  5961. class HuffmanTable {
  5962. constructor(lines, prefixCodesDone) {
  5963. if (!prefixCodesDone) {
  5964. this.assignPrefixCodes(lines);
  5965. }
  5966. this.rootNode = new HuffmanTreeNode(null);
  5967. for (let i = 0, ii = lines.length; i < ii; i++) {
  5968. const line = lines[i];
  5969. if (line.prefixLength > 0) {
  5970. this.rootNode.buildTree(line, line.prefixLength - 1);
  5971. }
  5972. }
  5973. }
  5974. decode(reader) {
  5975. return this.rootNode.decodeNode(reader);
  5976. }
  5977. assignPrefixCodes(lines) {
  5978. const linesLength = lines.length;
  5979. let prefixLengthMax = 0;
  5980. for (let i = 0; i < linesLength; i++) {
  5981. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  5982. }
  5983. const histogram = new Uint32Array(prefixLengthMax + 1);
  5984. for (let i = 0; i < linesLength; i++) {
  5985. histogram[lines[i].prefixLength]++;
  5986. }
  5987. let currentLength = 1,
  5988. firstCode = 0,
  5989. currentCode,
  5990. currentTemp,
  5991. line;
  5992. histogram[0] = 0;
  5993. while (currentLength <= prefixLengthMax) {
  5994. firstCode = firstCode + histogram[currentLength - 1] << 1;
  5995. currentCode = firstCode;
  5996. currentTemp = 0;
  5997. while (currentTemp < linesLength) {
  5998. line = lines[currentTemp];
  5999. if (line.prefixLength === currentLength) {
  6000. line.prefixCode = currentCode;
  6001. currentCode++;
  6002. }
  6003. currentTemp++;
  6004. }
  6005. currentLength++;
  6006. }
  6007. }
  6008. }
  6009. function decodeTablesSegment(data, start, end) {
  6010. const flags = data[start];
  6011. const lowestValue = readUint32(data, start + 1) & 0xffffffff;
  6012. const highestValue = readUint32(data, start + 5) & 0xffffffff;
  6013. const reader = new Reader(data, start + 9, end);
  6014. const prefixSizeBits = (flags >> 1 & 7) + 1;
  6015. const rangeSizeBits = (flags >> 4 & 7) + 1;
  6016. const lines = [];
  6017. let prefixLength,
  6018. rangeLength,
  6019. currentRangeLow = lowestValue;
  6020. do {
  6021. prefixLength = reader.readBits(prefixSizeBits);
  6022. rangeLength = reader.readBits(rangeSizeBits);
  6023. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  6024. currentRangeLow += 1 << rangeLength;
  6025. } while (currentRangeLow < highestValue);
  6026. prefixLength = reader.readBits(prefixSizeBits);
  6027. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  6028. prefixLength = reader.readBits(prefixSizeBits);
  6029. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  6030. if (flags & 1) {
  6031. prefixLength = reader.readBits(prefixSizeBits);
  6032. lines.push(new HuffmanLine([prefixLength, 0]));
  6033. }
  6034. return new HuffmanTable(lines, false);
  6035. }
  6036. const standardTablesCache = {};
  6037. function getStandardTable(number) {
  6038. let table = standardTablesCache[number];
  6039. if (table) {
  6040. return table;
  6041. }
  6042. let lines;
  6043. switch (number) {
  6044. case 1:
  6045. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  6046. break;
  6047. case 2:
  6048. lines = [[0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [75, 6, 32, 0x3e], [6, 0x3f]];
  6049. break;
  6050. case 3:
  6051. lines = [[-256, 8, 8, 0xfe], [0, 1, 0, 0x0], [1, 2, 0, 0x2], [2, 3, 0, 0x6], [3, 4, 3, 0xe], [11, 5, 6, 0x1e], [-257, 8, 32, 0xff, "lower"], [75, 7, 32, 0x7e], [6, 0x3e]];
  6052. break;
  6053. case 4:
  6054. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [76, 5, 32, 0x1f]];
  6055. break;
  6056. case 5:
  6057. lines = [[-255, 7, 8, 0x7e], [1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 0, 0x6], [4, 4, 3, 0xe], [12, 5, 6, 0x1e], [-256, 7, 32, 0x7f, "lower"], [76, 6, 32, 0x3e]];
  6058. break;
  6059. case 6:
  6060. lines = [[-2048, 5, 10, 0x1c], [-1024, 4, 9, 0x8], [-512, 4, 8, 0x9], [-256, 4, 7, 0xa], [-128, 5, 6, 0x1d], [-64, 5, 5, 0x1e], [-32, 4, 5, 0xb], [0, 2, 7, 0x0], [128, 3, 7, 0x2], [256, 3, 8, 0x3], [512, 4, 9, 0xc], [1024, 4, 10, 0xd], [-2049, 6, 32, 0x3e, "lower"], [2048, 6, 32, 0x3f]];
  6061. break;
  6062. case 7:
  6063. lines = [[-1024, 4, 9, 0x8], [-512, 3, 8, 0x0], [-256, 4, 7, 0x9], [-128, 5, 6, 0x1a], [-64, 5, 5, 0x1b], [-32, 4, 5, 0xa], [0, 4, 5, 0xb], [32, 5, 5, 0x1c], [64, 5, 6, 0x1d], [128, 4, 7, 0xc], [256, 3, 8, 0x1], [512, 3, 9, 0x2], [1024, 3, 10, 0x3], [-1025, 5, 32, 0x1e, "lower"], [2048, 5, 32, 0x1f]];
  6064. break;
  6065. case 8:
  6066. lines = [[-15, 8, 3, 0xfc], [-7, 9, 1, 0x1fc], [-5, 8, 1, 0xfd], [-3, 9, 0, 0x1fd], [-2, 7, 0, 0x7c], [-1, 4, 0, 0xa], [0, 2, 1, 0x0], [2, 5, 0, 0x1a], [3, 6, 0, 0x3a], [4, 3, 4, 0x4], [20, 6, 1, 0x3b], [22, 4, 4, 0xb], [38, 4, 5, 0xc], [70, 5, 6, 0x1b], [134, 5, 7, 0x1c], [262, 6, 7, 0x3c], [390, 7, 8, 0x7d], [646, 6, 10, 0x3d], [-16, 9, 32, 0x1fe, "lower"], [1670, 9, 32, 0x1ff], [2, 0x1]];
  6067. break;
  6068. case 9:
  6069. lines = [[-31, 8, 4, 0xfc], [-15, 9, 2, 0x1fc], [-11, 8, 2, 0xfd], [-7, 9, 1, 0x1fd], [-5, 7, 1, 0x7c], [-3, 4, 1, 0xa], [-1, 3, 1, 0x2], [1, 3, 1, 0x3], [3, 5, 1, 0x1a], [5, 6, 1, 0x3a], [7, 3, 5, 0x4], [39, 6, 2, 0x3b], [43, 4, 5, 0xb], [75, 4, 6, 0xc], [139, 5, 7, 0x1b], [267, 5, 8, 0x1c], [523, 6, 8, 0x3c], [779, 7, 9, 0x7d], [1291, 6, 11, 0x3d], [-32, 9, 32, 0x1fe, "lower"], [3339, 9, 32, 0x1ff], [2, 0x0]];
  6070. break;
  6071. case 10:
  6072. lines = [[-21, 7, 4, 0x7a], [-5, 8, 0, 0xfc], [-4, 7, 0, 0x7b], [-3, 5, 0, 0x18], [-2, 2, 2, 0x0], [2, 5, 0, 0x19], [3, 6, 0, 0x36], [4, 7, 0, 0x7c], [5, 8, 0, 0xfd], [6, 2, 6, 0x1], [70, 5, 5, 0x1a], [102, 6, 5, 0x37], [134, 6, 6, 0x38], [198, 6, 7, 0x39], [326, 6, 8, 0x3a], [582, 6, 9, 0x3b], [1094, 6, 10, 0x3c], [2118, 7, 11, 0x7d], [-22, 8, 32, 0xfe, "lower"], [4166, 8, 32, 0xff], [2, 0x2]];
  6073. break;
  6074. case 11:
  6075. lines = [[1, 1, 0, 0x0], [2, 2, 1, 0x2], [4, 4, 0, 0xc], [5, 4, 1, 0xd], [7, 5, 1, 0x1c], [9, 5, 2, 0x1d], [13, 6, 2, 0x3c], [17, 7, 2, 0x7a], [21, 7, 3, 0x7b], [29, 7, 4, 0x7c], [45, 7, 5, 0x7d], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  6076. break;
  6077. case 12:
  6078. lines = [[1, 1, 0, 0x0], [2, 2, 0, 0x2], [3, 3, 1, 0x6], [5, 5, 0, 0x1c], [6, 5, 1, 0x1d], [8, 6, 1, 0x3c], [10, 7, 0, 0x7a], [11, 7, 1, 0x7b], [13, 7, 2, 0x7c], [17, 7, 3, 0x7d], [25, 7, 4, 0x7e], [41, 8, 5, 0xfe], [73, 8, 32, 0xff]];
  6079. break;
  6080. case 13:
  6081. lines = [[1, 1, 0, 0x0], [2, 3, 0, 0x4], [3, 4, 0, 0xc], [4, 5, 0, 0x1c], [5, 4, 1, 0xd], [7, 3, 3, 0x5], [15, 6, 1, 0x3a], [17, 6, 2, 0x3b], [21, 6, 3, 0x3c], [29, 6, 4, 0x3d], [45, 6, 5, 0x3e], [77, 7, 6, 0x7e], [141, 7, 32, 0x7f]];
  6082. break;
  6083. case 14:
  6084. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  6085. break;
  6086. case 15:
  6087. lines = [[-24, 7, 4, 0x7c], [-8, 6, 2, 0x3c], [-4, 5, 1, 0x1c], [-2, 4, 0, 0xc], [-1, 3, 0, 0x4], [0, 1, 0, 0x0], [1, 3, 0, 0x5], [2, 4, 0, 0xd], [3, 5, 1, 0x1d], [5, 6, 2, 0x3d], [9, 7, 4, 0x7d], [-25, 7, 32, 0x7e, "lower"], [25, 7, 32, 0x7f]];
  6088. break;
  6089. default:
  6090. throw new Jbig2Error(`standard table B.${number} does not exist`);
  6091. }
  6092. for (let i = 0, ii = lines.length; i < ii; i++) {
  6093. lines[i] = new HuffmanLine(lines[i]);
  6094. }
  6095. table = new HuffmanTable(lines, true);
  6096. standardTablesCache[number] = table;
  6097. return table;
  6098. }
  6099. class Reader {
  6100. constructor(data, start, end) {
  6101. this.data = data;
  6102. this.start = start;
  6103. this.end = end;
  6104. this.position = start;
  6105. this.shift = -1;
  6106. this.currentByte = 0;
  6107. }
  6108. readBit() {
  6109. if (this.shift < 0) {
  6110. if (this.position >= this.end) {
  6111. throw new Jbig2Error("end of data while reading bit");
  6112. }
  6113. this.currentByte = this.data[this.position++];
  6114. this.shift = 7;
  6115. }
  6116. const bit = this.currentByte >> this.shift & 1;
  6117. this.shift--;
  6118. return bit;
  6119. }
  6120. readBits(numBits) {
  6121. let result = 0,
  6122. i;
  6123. for (i = numBits - 1; i >= 0; i--) {
  6124. result |= this.readBit() << i;
  6125. }
  6126. return result;
  6127. }
  6128. byteAlign() {
  6129. this.shift = -1;
  6130. }
  6131. next() {
  6132. if (this.position >= this.end) {
  6133. return -1;
  6134. }
  6135. return this.data[this.position++];
  6136. }
  6137. }
  6138. function getCustomHuffmanTable(index, referredTo, customTables) {
  6139. let currentIndex = 0;
  6140. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  6141. const table = customTables[referredTo[i]];
  6142. if (table) {
  6143. if (index === currentIndex) {
  6144. return table;
  6145. }
  6146. currentIndex++;
  6147. }
  6148. }
  6149. throw new Jbig2Error("can't find custom Huffman table");
  6150. }
  6151. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  6152. const codes = [];
  6153. for (let i = 0; i <= 34; i++) {
  6154. const codeLength = reader.readBits(4);
  6155. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  6156. }
  6157. const runCodesTable = new HuffmanTable(codes, false);
  6158. codes.length = 0;
  6159. for (let i = 0; i < numberOfSymbols;) {
  6160. const codeLength = runCodesTable.decode(reader);
  6161. if (codeLength >= 32) {
  6162. let repeatedLength, numberOfRepeats, j;
  6163. switch (codeLength) {
  6164. case 32:
  6165. if (i === 0) {
  6166. throw new Jbig2Error("no previous value in symbol ID table");
  6167. }
  6168. numberOfRepeats = reader.readBits(2) + 3;
  6169. repeatedLength = codes[i - 1].prefixLength;
  6170. break;
  6171. case 33:
  6172. numberOfRepeats = reader.readBits(3) + 3;
  6173. repeatedLength = 0;
  6174. break;
  6175. case 34:
  6176. numberOfRepeats = reader.readBits(7) + 11;
  6177. repeatedLength = 0;
  6178. break;
  6179. default:
  6180. throw new Jbig2Error("invalid code length in symbol ID table");
  6181. }
  6182. for (j = 0; j < numberOfRepeats; j++) {
  6183. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  6184. i++;
  6185. }
  6186. } else {
  6187. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  6188. i++;
  6189. }
  6190. }
  6191. reader.byteAlign();
  6192. const symbolIDTable = new HuffmanTable(codes, false);
  6193. let customIndex = 0,
  6194. tableFirstS,
  6195. tableDeltaS,
  6196. tableDeltaT;
  6197. switch (textRegion.huffmanFS) {
  6198. case 0:
  6199. case 1:
  6200. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  6201. break;
  6202. case 3:
  6203. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6204. customIndex++;
  6205. break;
  6206. default:
  6207. throw new Jbig2Error("invalid Huffman FS selector");
  6208. }
  6209. switch (textRegion.huffmanDS) {
  6210. case 0:
  6211. case 1:
  6212. case 2:
  6213. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  6214. break;
  6215. case 3:
  6216. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6217. customIndex++;
  6218. break;
  6219. default:
  6220. throw new Jbig2Error("invalid Huffman DS selector");
  6221. }
  6222. switch (textRegion.huffmanDT) {
  6223. case 0:
  6224. case 1:
  6225. case 2:
  6226. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  6227. break;
  6228. case 3:
  6229. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6230. customIndex++;
  6231. break;
  6232. default:
  6233. throw new Jbig2Error("invalid Huffman DT selector");
  6234. }
  6235. if (textRegion.refinement) {
  6236. throw new Jbig2Error("refinement with Huffman is not supported");
  6237. }
  6238. return {
  6239. symbolIDTable,
  6240. tableFirstS,
  6241. tableDeltaS,
  6242. tableDeltaT
  6243. };
  6244. }
  6245. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  6246. let customIndex = 0,
  6247. tableDeltaHeight,
  6248. tableDeltaWidth;
  6249. switch (dictionary.huffmanDHSelector) {
  6250. case 0:
  6251. case 1:
  6252. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  6253. break;
  6254. case 3:
  6255. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6256. customIndex++;
  6257. break;
  6258. default:
  6259. throw new Jbig2Error("invalid Huffman DH selector");
  6260. }
  6261. switch (dictionary.huffmanDWSelector) {
  6262. case 0:
  6263. case 1:
  6264. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  6265. break;
  6266. case 3:
  6267. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6268. customIndex++;
  6269. break;
  6270. default:
  6271. throw new Jbig2Error("invalid Huffman DW selector");
  6272. }
  6273. let tableBitmapSize, tableAggregateInstances;
  6274. if (dictionary.bitmapSizeSelector) {
  6275. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6276. customIndex++;
  6277. } else {
  6278. tableBitmapSize = getStandardTable(1);
  6279. }
  6280. if (dictionary.aggregationInstancesSelector) {
  6281. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  6282. } else {
  6283. tableAggregateInstances = getStandardTable(1);
  6284. }
  6285. return {
  6286. tableDeltaHeight,
  6287. tableDeltaWidth,
  6288. tableBitmapSize,
  6289. tableAggregateInstances
  6290. };
  6291. }
  6292. function readUncompressedBitmap(reader, width, height) {
  6293. const bitmap = [];
  6294. for (let y = 0; y < height; y++) {
  6295. const row = new Uint8Array(width);
  6296. bitmap.push(row);
  6297. for (let x = 0; x < width; x++) {
  6298. row[x] = reader.readBit();
  6299. }
  6300. reader.byteAlign();
  6301. }
  6302. return bitmap;
  6303. }
  6304. function decodeMMRBitmap(input, width, height, endOfBlock) {
  6305. const params = {
  6306. K: -1,
  6307. Columns: width,
  6308. Rows: height,
  6309. BlackIs1: true,
  6310. EndOfBlock: endOfBlock
  6311. };
  6312. const decoder = new CCITTFaxDecoder(input, params);
  6313. const bitmap = [];
  6314. let currentByte,
  6315. eof = false;
  6316. for (let y = 0; y < height; y++) {
  6317. const row = new Uint8Array(width);
  6318. bitmap.push(row);
  6319. let shift = -1;
  6320. for (let x = 0; x < width; x++) {
  6321. if (shift < 0) {
  6322. currentByte = decoder.readNextChar();
  6323. if (currentByte === -1) {
  6324. currentByte = 0;
  6325. eof = true;
  6326. }
  6327. shift = 7;
  6328. }
  6329. row[x] = currentByte >> shift & 1;
  6330. shift--;
  6331. }
  6332. }
  6333. if (endOfBlock && !eof) {
  6334. const lookForEOFLimit = 5;
  6335. for (let i = 0; i < lookForEOFLimit; i++) {
  6336. if (decoder.readNextChar() === -1) {
  6337. break;
  6338. }
  6339. }
  6340. }
  6341. return bitmap;
  6342. }
  6343. class Jbig2Image {
  6344. parseChunks(chunks) {
  6345. return parseJbig2Chunks(chunks);
  6346. }
  6347. parse(data) {
  6348. throw new Error("Not implemented: Jbig2Image.parse");
  6349. }
  6350. }
  6351. ;// ./src/core/jbig2_stream.js
  6352. class Jbig2Stream extends DecodeStream {
  6353. constructor(stream, maybeLength, params) {
  6354. super(maybeLength);
  6355. this.stream = stream;
  6356. this.dict = stream.dict;
  6357. this.maybeLength = maybeLength;
  6358. this.params = params;
  6359. }
  6360. get bytes() {
  6361. return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
  6362. }
  6363. ensureBuffer(requested) {}
  6364. readBlock() {
  6365. this.decodeImage();
  6366. }
  6367. decodeImage(bytes) {
  6368. if (this.eof) {
  6369. return this.buffer;
  6370. }
  6371. bytes ||= this.bytes;
  6372. const jbig2Image = new Jbig2Image();
  6373. const chunks = [];
  6374. if (this.params instanceof Dict) {
  6375. const globalsStream = this.params.get("JBIG2Globals");
  6376. if (globalsStream instanceof BaseStream) {
  6377. const globals = globalsStream.getBytes();
  6378. chunks.push({
  6379. data: globals,
  6380. start: 0,
  6381. end: globals.length
  6382. });
  6383. }
  6384. }
  6385. chunks.push({
  6386. data: bytes,
  6387. start: 0,
  6388. end: bytes.length
  6389. });
  6390. const data = jbig2Image.parseChunks(chunks);
  6391. const dataLength = data.length;
  6392. for (let i = 0; i < dataLength; i++) {
  6393. data[i] ^= 0xff;
  6394. }
  6395. this.buffer = data;
  6396. this.bufferLength = dataLength;
  6397. this.eof = true;
  6398. return this.buffer;
  6399. }
  6400. get canAsyncDecodeImageFromBuffer() {
  6401. return this.stream.isAsync;
  6402. }
  6403. }
  6404. ;// ./src/shared/image_utils.js
  6405. function convertToRGBA(params) {
  6406. switch (params.kind) {
  6407. case ImageKind.GRAYSCALE_1BPP:
  6408. return convertBlackAndWhiteToRGBA(params);
  6409. case ImageKind.RGB_24BPP:
  6410. return convertRGBToRGBA(params);
  6411. }
  6412. return null;
  6413. }
  6414. function convertBlackAndWhiteToRGBA({
  6415. src,
  6416. srcPos = 0,
  6417. dest,
  6418. width,
  6419. height,
  6420. nonBlackColor = 0xffffffff,
  6421. inverseDecode = false
  6422. }) {
  6423. const black = FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  6424. const [zeroMapping, oneMapping] = inverseDecode ? [nonBlackColor, black] : [black, nonBlackColor];
  6425. const widthInSource = width >> 3;
  6426. const widthRemainder = width & 7;
  6427. const srcLength = src.length;
  6428. dest = new Uint32Array(dest.buffer);
  6429. let destPos = 0;
  6430. for (let i = 0; i < height; i++) {
  6431. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  6432. const elem = srcPos < srcLength ? src[srcPos] : 255;
  6433. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  6434. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  6435. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  6436. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  6437. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  6438. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  6439. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  6440. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  6441. }
  6442. if (widthRemainder === 0) {
  6443. continue;
  6444. }
  6445. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  6446. for (let j = 0; j < widthRemainder; j++) {
  6447. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  6448. }
  6449. }
  6450. return {
  6451. srcPos,
  6452. destPos
  6453. };
  6454. }
  6455. function convertRGBToRGBA({
  6456. src,
  6457. srcPos = 0,
  6458. dest,
  6459. destPos = 0,
  6460. width,
  6461. height
  6462. }) {
  6463. let i = 0;
  6464. const len = width * height * 3;
  6465. const len32 = len >> 2;
  6466. const src32 = new Uint32Array(src.buffer, srcPos, len32);
  6467. if (FeatureTest.isLittleEndian) {
  6468. for (; i < len32 - 2; i += 3, destPos += 4) {
  6469. const s1 = src32[i];
  6470. const s2 = src32[i + 1];
  6471. const s3 = src32[i + 2];
  6472. dest[destPos] = s1 | 0xff000000;
  6473. dest[destPos + 1] = s1 >>> 24 | s2 << 8 | 0xff000000;
  6474. dest[destPos + 2] = s2 >>> 16 | s3 << 16 | 0xff000000;
  6475. dest[destPos + 3] = s3 >>> 8 | 0xff000000;
  6476. }
  6477. for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {
  6478. dest[destPos++] = src[j] | src[j + 1] << 8 | src[j + 2] << 16 | 0xff000000;
  6479. }
  6480. } else {
  6481. for (; i < len32 - 2; i += 3, destPos += 4) {
  6482. const s1 = src32[i];
  6483. const s2 = src32[i + 1];
  6484. const s3 = src32[i + 2];
  6485. dest[destPos] = s1 | 0xff;
  6486. dest[destPos + 1] = s1 << 24 | s2 >>> 8 | 0xff;
  6487. dest[destPos + 2] = s2 << 16 | s3 >>> 16 | 0xff;
  6488. dest[destPos + 3] = s3 << 8 | 0xff;
  6489. }
  6490. for (let j = i * 4, jj = srcPos + len; j < jj; j += 3) {
  6491. dest[destPos++] = src[j] << 24 | src[j + 1] << 16 | src[j + 2] << 8 | 0xff;
  6492. }
  6493. }
  6494. return {
  6495. srcPos: srcPos + len,
  6496. destPos
  6497. };
  6498. }
  6499. function grayToRGBA(src, dest) {
  6500. if (FeatureTest.isLittleEndian) {
  6501. for (let i = 0, ii = src.length; i < ii; i++) {
  6502. dest[i] = src[i] * 0x10101 | 0xff000000;
  6503. }
  6504. } else {
  6505. for (let i = 0, ii = src.length; i < ii; i++) {
  6506. dest[i] = src[i] * 0x1010100 | 0x000000ff;
  6507. }
  6508. }
  6509. }
  6510. ;// ./src/core/jpg.js
  6511. class JpegError extends BaseException {
  6512. constructor(msg) {
  6513. super(msg, "JpegError");
  6514. }
  6515. }
  6516. class DNLMarkerError extends BaseException {
  6517. constructor(message, scanLines) {
  6518. super(message, "DNLMarkerError");
  6519. this.scanLines = scanLines;
  6520. }
  6521. }
  6522. class EOIMarkerError extends BaseException {
  6523. constructor(msg) {
  6524. super(msg, "EOIMarkerError");
  6525. }
  6526. }
  6527. const dctZigZag = new Uint8Array([0, 1, 8, 16, 9, 2, 3, 10, 17, 24, 32, 25, 18, 11, 4, 5, 12, 19, 26, 33, 40, 48, 41, 34, 27, 20, 13, 6, 7, 14, 21, 28, 35, 42, 49, 56, 57, 50, 43, 36, 29, 22, 15, 23, 30, 37, 44, 51, 58, 59, 52, 45, 38, 31, 39, 46, 53, 60, 61, 54, 47, 55, 62, 63]);
  6528. const dctCos1 = 4017;
  6529. const dctSin1 = 799;
  6530. const dctCos3 = 3406;
  6531. const dctSin3 = 2276;
  6532. const dctCos6 = 1567;
  6533. const dctSin6 = 3784;
  6534. const dctSqrt2 = 5793;
  6535. const dctSqrt1d2 = 2896;
  6536. function buildHuffmanTable(codeLengths, values) {
  6537. let k = 0,
  6538. i,
  6539. j,
  6540. length = 16;
  6541. while (length > 0 && !codeLengths[length - 1]) {
  6542. length--;
  6543. }
  6544. const code = [{
  6545. children: [],
  6546. index: 0
  6547. }];
  6548. let p = code[0],
  6549. q;
  6550. for (i = 0; i < length; i++) {
  6551. for (j = 0; j < codeLengths[i]; j++) {
  6552. p = code.pop();
  6553. p.children[p.index] = values[k];
  6554. while (p.index > 0) {
  6555. p = code.pop();
  6556. }
  6557. p.index++;
  6558. code.push(p);
  6559. while (code.length <= i) {
  6560. code.push(q = {
  6561. children: [],
  6562. index: 0
  6563. });
  6564. p.children[p.index] = q.children;
  6565. p = q;
  6566. }
  6567. k++;
  6568. }
  6569. if (i + 1 < length) {
  6570. code.push(q = {
  6571. children: [],
  6572. index: 0
  6573. });
  6574. p.children[p.index] = q.children;
  6575. p = q;
  6576. }
  6577. }
  6578. return code[0].children;
  6579. }
  6580. function getBlockBufferOffset(component, row, col) {
  6581. return 64 * ((component.blocksPerLine + 1) * row + col);
  6582. }
  6583. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  6584. const mcusPerLine = frame.mcusPerLine;
  6585. const progressive = frame.progressive;
  6586. const startOffset = offset;
  6587. let bitsData = 0,
  6588. bitsCount = 0;
  6589. function readBit() {
  6590. if (bitsCount > 0) {
  6591. bitsCount--;
  6592. return bitsData >> bitsCount & 1;
  6593. }
  6594. bitsData = data[offset++];
  6595. if (bitsData === 0xff) {
  6596. const nextByte = data[offset++];
  6597. if (nextByte) {
  6598. if (nextByte === 0xdc && parseDNLMarker) {
  6599. offset += 2;
  6600. const scanLines = readUint16(data, offset);
  6601. offset += 2;
  6602. if (scanLines > 0 && scanLines !== frame.scanLines) {
  6603. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  6604. }
  6605. } else if (nextByte === 0xd9) {
  6606. if (parseDNLMarker) {
  6607. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  6608. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 5) {
  6609. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  6610. }
  6611. }
  6612. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  6613. }
  6614. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  6615. }
  6616. }
  6617. bitsCount = 7;
  6618. return bitsData >>> 7;
  6619. }
  6620. function decodeHuffman(tree) {
  6621. let node = tree;
  6622. while (true) {
  6623. node = node[readBit()];
  6624. switch (typeof node) {
  6625. case "number":
  6626. return node;
  6627. case "object":
  6628. continue;
  6629. }
  6630. throw new JpegError("invalid huffman sequence");
  6631. }
  6632. }
  6633. function receive(length) {
  6634. let n = 0;
  6635. while (length > 0) {
  6636. n = n << 1 | readBit();
  6637. length--;
  6638. }
  6639. return n;
  6640. }
  6641. function receiveAndExtend(length) {
  6642. if (length === 1) {
  6643. return readBit() === 1 ? 1 : -1;
  6644. }
  6645. const n = receive(length);
  6646. if (n >= 1 << length - 1) {
  6647. return n;
  6648. }
  6649. return n + (-1 << length) + 1;
  6650. }
  6651. function decodeBaseline(component, blockOffset) {
  6652. const t = decodeHuffman(component.huffmanTableDC);
  6653. const diff = t === 0 ? 0 : receiveAndExtend(t);
  6654. component.blockData[blockOffset] = component.pred += diff;
  6655. let k = 1;
  6656. while (k < 64) {
  6657. const rs = decodeHuffman(component.huffmanTableAC);
  6658. const s = rs & 15,
  6659. r = rs >> 4;
  6660. if (s === 0) {
  6661. if (r < 15) {
  6662. break;
  6663. }
  6664. k += 16;
  6665. continue;
  6666. }
  6667. k += r;
  6668. const z = dctZigZag[k];
  6669. component.blockData[blockOffset + z] = receiveAndExtend(s);
  6670. k++;
  6671. }
  6672. }
  6673. function decodeDCFirst(component, blockOffset) {
  6674. const t = decodeHuffman(component.huffmanTableDC);
  6675. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  6676. component.blockData[blockOffset] = component.pred += diff;
  6677. }
  6678. function decodeDCSuccessive(component, blockOffset) {
  6679. component.blockData[blockOffset] |= readBit() << successive;
  6680. }
  6681. let eobrun = 0;
  6682. function decodeACFirst(component, blockOffset) {
  6683. if (eobrun > 0) {
  6684. eobrun--;
  6685. return;
  6686. }
  6687. let k = spectralStart;
  6688. const e = spectralEnd;
  6689. while (k <= e) {
  6690. const rs = decodeHuffman(component.huffmanTableAC);
  6691. const s = rs & 15,
  6692. r = rs >> 4;
  6693. if (s === 0) {
  6694. if (r < 15) {
  6695. eobrun = receive(r) + (1 << r) - 1;
  6696. break;
  6697. }
  6698. k += 16;
  6699. continue;
  6700. }
  6701. k += r;
  6702. const z = dctZigZag[k];
  6703. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  6704. k++;
  6705. }
  6706. }
  6707. let successiveACState = 0,
  6708. successiveACNextValue;
  6709. function decodeACSuccessive(component, blockOffset) {
  6710. let k = spectralStart;
  6711. const e = spectralEnd;
  6712. let r = 0;
  6713. let s;
  6714. let rs;
  6715. while (k <= e) {
  6716. const offsetZ = blockOffset + dctZigZag[k];
  6717. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  6718. switch (successiveACState) {
  6719. case 0:
  6720. rs = decodeHuffman(component.huffmanTableAC);
  6721. s = rs & 15;
  6722. r = rs >> 4;
  6723. if (s === 0) {
  6724. if (r < 15) {
  6725. eobrun = receive(r) + (1 << r);
  6726. successiveACState = 4;
  6727. } else {
  6728. r = 16;
  6729. successiveACState = 1;
  6730. }
  6731. } else {
  6732. if (s !== 1) {
  6733. throw new JpegError("invalid ACn encoding");
  6734. }
  6735. successiveACNextValue = receiveAndExtend(s);
  6736. successiveACState = r ? 2 : 3;
  6737. }
  6738. continue;
  6739. case 1:
  6740. case 2:
  6741. if (component.blockData[offsetZ]) {
  6742. component.blockData[offsetZ] += sign * (readBit() << successive);
  6743. } else {
  6744. r--;
  6745. if (r === 0) {
  6746. successiveACState = successiveACState === 2 ? 3 : 0;
  6747. }
  6748. }
  6749. break;
  6750. case 3:
  6751. if (component.blockData[offsetZ]) {
  6752. component.blockData[offsetZ] += sign * (readBit() << successive);
  6753. } else {
  6754. component.blockData[offsetZ] = successiveACNextValue << successive;
  6755. successiveACState = 0;
  6756. }
  6757. break;
  6758. case 4:
  6759. if (component.blockData[offsetZ]) {
  6760. component.blockData[offsetZ] += sign * (readBit() << successive);
  6761. }
  6762. break;
  6763. }
  6764. k++;
  6765. }
  6766. if (successiveACState === 4) {
  6767. eobrun--;
  6768. if (eobrun === 0) {
  6769. successiveACState = 0;
  6770. }
  6771. }
  6772. }
  6773. let blockRow = 0;
  6774. function decodeMcu(component, decode, mcu, row, col) {
  6775. const mcuRow = mcu / mcusPerLine | 0;
  6776. const mcuCol = mcu % mcusPerLine;
  6777. blockRow = mcuRow * component.v + row;
  6778. const blockCol = mcuCol * component.h + col;
  6779. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  6780. decode(component, blockOffset);
  6781. }
  6782. function decodeBlock(component, decode, mcu) {
  6783. blockRow = mcu / component.blocksPerLine | 0;
  6784. const blockCol = mcu % component.blocksPerLine;
  6785. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  6786. decode(component, blockOffset);
  6787. }
  6788. const componentsLength = components.length;
  6789. let component, i, j, k, n;
  6790. let decodeFn;
  6791. if (progressive) {
  6792. if (spectralStart === 0) {
  6793. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  6794. } else {
  6795. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  6796. }
  6797. } else {
  6798. decodeFn = decodeBaseline;
  6799. }
  6800. let mcu = 0,
  6801. fileMarker;
  6802. const mcuExpected = componentsLength === 1 ? components[0].blocksPerLine * components[0].blocksPerColumn : mcusPerLine * frame.mcusPerColumn;
  6803. let h, v;
  6804. while (mcu <= mcuExpected) {
  6805. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  6806. if (mcuToRead > 0) {
  6807. for (i = 0; i < componentsLength; i++) {
  6808. components[i].pred = 0;
  6809. }
  6810. eobrun = 0;
  6811. if (componentsLength === 1) {
  6812. component = components[0];
  6813. for (n = 0; n < mcuToRead; n++) {
  6814. decodeBlock(component, decodeFn, mcu);
  6815. mcu++;
  6816. }
  6817. } else {
  6818. for (n = 0; n < mcuToRead; n++) {
  6819. for (i = 0; i < componentsLength; i++) {
  6820. component = components[i];
  6821. h = component.h;
  6822. v = component.v;
  6823. for (j = 0; j < v; j++) {
  6824. for (k = 0; k < h; k++) {
  6825. decodeMcu(component, decodeFn, mcu, j, k);
  6826. }
  6827. }
  6828. }
  6829. mcu++;
  6830. }
  6831. }
  6832. }
  6833. bitsCount = 0;
  6834. fileMarker = findNextFileMarker(data, offset);
  6835. if (!fileMarker) {
  6836. break;
  6837. }
  6838. if (fileMarker.invalid) {
  6839. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  6840. warn(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  6841. offset = fileMarker.offset;
  6842. }
  6843. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  6844. offset += 2;
  6845. } else {
  6846. break;
  6847. }
  6848. }
  6849. return offset - startOffset;
  6850. }
  6851. function quantizeAndInverse(component, blockBufferOffset, p) {
  6852. const qt = component.quantizationTable,
  6853. blockData = component.blockData;
  6854. let v0, v1, v2, v3, v4, v5, v6, v7;
  6855. let p0, p1, p2, p3, p4, p5, p6, p7;
  6856. let t;
  6857. if (!qt) {
  6858. throw new JpegError("missing required Quantization Table.");
  6859. }
  6860. for (let row = 0; row < 64; row += 8) {
  6861. p0 = blockData[blockBufferOffset + row];
  6862. p1 = blockData[blockBufferOffset + row + 1];
  6863. p2 = blockData[blockBufferOffset + row + 2];
  6864. p3 = blockData[blockBufferOffset + row + 3];
  6865. p4 = blockData[blockBufferOffset + row + 4];
  6866. p5 = blockData[blockBufferOffset + row + 5];
  6867. p6 = blockData[blockBufferOffset + row + 6];
  6868. p7 = blockData[blockBufferOffset + row + 7];
  6869. p0 *= qt[row];
  6870. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  6871. t = dctSqrt2 * p0 + 512 >> 10;
  6872. p[row] = t;
  6873. p[row + 1] = t;
  6874. p[row + 2] = t;
  6875. p[row + 3] = t;
  6876. p[row + 4] = t;
  6877. p[row + 5] = t;
  6878. p[row + 6] = t;
  6879. p[row + 7] = t;
  6880. continue;
  6881. }
  6882. p1 *= qt[row + 1];
  6883. p2 *= qt[row + 2];
  6884. p3 *= qt[row + 3];
  6885. p4 *= qt[row + 4];
  6886. p5 *= qt[row + 5];
  6887. p6 *= qt[row + 6];
  6888. p7 *= qt[row + 7];
  6889. v0 = dctSqrt2 * p0 + 128 >> 8;
  6890. v1 = dctSqrt2 * p4 + 128 >> 8;
  6891. v2 = p2;
  6892. v3 = p6;
  6893. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  6894. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  6895. v5 = p3 << 4;
  6896. v6 = p5 << 4;
  6897. v0 = v0 + v1 + 1 >> 1;
  6898. v1 = v0 - v1;
  6899. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  6900. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  6901. v3 = t;
  6902. v4 = v4 + v6 + 1 >> 1;
  6903. v6 = v4 - v6;
  6904. v7 = v7 + v5 + 1 >> 1;
  6905. v5 = v7 - v5;
  6906. v0 = v0 + v3 + 1 >> 1;
  6907. v3 = v0 - v3;
  6908. v1 = v1 + v2 + 1 >> 1;
  6909. v2 = v1 - v2;
  6910. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  6911. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  6912. v7 = t;
  6913. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  6914. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  6915. v6 = t;
  6916. p[row] = v0 + v7;
  6917. p[row + 7] = v0 - v7;
  6918. p[row + 1] = v1 + v6;
  6919. p[row + 6] = v1 - v6;
  6920. p[row + 2] = v2 + v5;
  6921. p[row + 5] = v2 - v5;
  6922. p[row + 3] = v3 + v4;
  6923. p[row + 4] = v3 - v4;
  6924. }
  6925. for (let col = 0; col < 8; ++col) {
  6926. p0 = p[col];
  6927. p1 = p[col + 8];
  6928. p2 = p[col + 16];
  6929. p3 = p[col + 24];
  6930. p4 = p[col + 32];
  6931. p5 = p[col + 40];
  6932. p6 = p[col + 48];
  6933. p7 = p[col + 56];
  6934. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  6935. t = dctSqrt2 * p0 + 8192 >> 14;
  6936. if (t < -2040) {
  6937. t = 0;
  6938. } else if (t >= 2024) {
  6939. t = 255;
  6940. } else {
  6941. t = t + 2056 >> 4;
  6942. }
  6943. blockData[blockBufferOffset + col] = t;
  6944. blockData[blockBufferOffset + col + 8] = t;
  6945. blockData[blockBufferOffset + col + 16] = t;
  6946. blockData[blockBufferOffset + col + 24] = t;
  6947. blockData[blockBufferOffset + col + 32] = t;
  6948. blockData[blockBufferOffset + col + 40] = t;
  6949. blockData[blockBufferOffset + col + 48] = t;
  6950. blockData[blockBufferOffset + col + 56] = t;
  6951. continue;
  6952. }
  6953. v0 = dctSqrt2 * p0 + 2048 >> 12;
  6954. v1 = dctSqrt2 * p4 + 2048 >> 12;
  6955. v2 = p2;
  6956. v3 = p6;
  6957. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  6958. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  6959. v5 = p3;
  6960. v6 = p5;
  6961. v0 = (v0 + v1 + 1 >> 1) + 4112;
  6962. v1 = v0 - v1;
  6963. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  6964. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  6965. v3 = t;
  6966. v4 = v4 + v6 + 1 >> 1;
  6967. v6 = v4 - v6;
  6968. v7 = v7 + v5 + 1 >> 1;
  6969. v5 = v7 - v5;
  6970. v0 = v0 + v3 + 1 >> 1;
  6971. v3 = v0 - v3;
  6972. v1 = v1 + v2 + 1 >> 1;
  6973. v2 = v1 - v2;
  6974. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  6975. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  6976. v7 = t;
  6977. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  6978. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  6979. v6 = t;
  6980. p0 = v0 + v7;
  6981. p7 = v0 - v7;
  6982. p1 = v1 + v6;
  6983. p6 = v1 - v6;
  6984. p2 = v2 + v5;
  6985. p5 = v2 - v5;
  6986. p3 = v3 + v4;
  6987. p4 = v3 - v4;
  6988. if (p0 < 16) {
  6989. p0 = 0;
  6990. } else if (p0 >= 4080) {
  6991. p0 = 255;
  6992. } else {
  6993. p0 >>= 4;
  6994. }
  6995. if (p1 < 16) {
  6996. p1 = 0;
  6997. } else if (p1 >= 4080) {
  6998. p1 = 255;
  6999. } else {
  7000. p1 >>= 4;
  7001. }
  7002. if (p2 < 16) {
  7003. p2 = 0;
  7004. } else if (p2 >= 4080) {
  7005. p2 = 255;
  7006. } else {
  7007. p2 >>= 4;
  7008. }
  7009. if (p3 < 16) {
  7010. p3 = 0;
  7011. } else if (p3 >= 4080) {
  7012. p3 = 255;
  7013. } else {
  7014. p3 >>= 4;
  7015. }
  7016. if (p4 < 16) {
  7017. p4 = 0;
  7018. } else if (p4 >= 4080) {
  7019. p4 = 255;
  7020. } else {
  7021. p4 >>= 4;
  7022. }
  7023. if (p5 < 16) {
  7024. p5 = 0;
  7025. } else if (p5 >= 4080) {
  7026. p5 = 255;
  7027. } else {
  7028. p5 >>= 4;
  7029. }
  7030. if (p6 < 16) {
  7031. p6 = 0;
  7032. } else if (p6 >= 4080) {
  7033. p6 = 255;
  7034. } else {
  7035. p6 >>= 4;
  7036. }
  7037. if (p7 < 16) {
  7038. p7 = 0;
  7039. } else if (p7 >= 4080) {
  7040. p7 = 255;
  7041. } else {
  7042. p7 >>= 4;
  7043. }
  7044. blockData[blockBufferOffset + col] = p0;
  7045. blockData[blockBufferOffset + col + 8] = p1;
  7046. blockData[blockBufferOffset + col + 16] = p2;
  7047. blockData[blockBufferOffset + col + 24] = p3;
  7048. blockData[blockBufferOffset + col + 32] = p4;
  7049. blockData[blockBufferOffset + col + 40] = p5;
  7050. blockData[blockBufferOffset + col + 48] = p6;
  7051. blockData[blockBufferOffset + col + 56] = p7;
  7052. }
  7053. }
  7054. function buildComponentData(frame, component) {
  7055. const blocksPerLine = component.blocksPerLine;
  7056. const blocksPerColumn = component.blocksPerColumn;
  7057. const computationBuffer = new Int16Array(64);
  7058. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  7059. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  7060. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  7061. quantizeAndInverse(component, offset, computationBuffer);
  7062. }
  7063. }
  7064. return component.blockData;
  7065. }
  7066. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  7067. const maxPos = data.length - 1;
  7068. let newPos = startPos < currentPos ? startPos : currentPos;
  7069. if (currentPos >= maxPos) {
  7070. return null;
  7071. }
  7072. const currentMarker = readUint16(data, currentPos);
  7073. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  7074. return {
  7075. invalid: null,
  7076. marker: currentMarker,
  7077. offset: currentPos
  7078. };
  7079. }
  7080. let newMarker = readUint16(data, newPos);
  7081. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  7082. if (++newPos >= maxPos) {
  7083. return null;
  7084. }
  7085. newMarker = readUint16(data, newPos);
  7086. }
  7087. return {
  7088. invalid: currentMarker.toString(16),
  7089. marker: newMarker,
  7090. offset: newPos
  7091. };
  7092. }
  7093. function prepareComponents(frame) {
  7094. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  7095. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  7096. for (const component of frame.components) {
  7097. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  7098. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  7099. const blocksPerLineForMcu = mcusPerLine * component.h;
  7100. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  7101. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  7102. component.blockData = new Int16Array(blocksBufferSize);
  7103. component.blocksPerLine = blocksPerLine;
  7104. component.blocksPerColumn = blocksPerColumn;
  7105. }
  7106. frame.mcusPerLine = mcusPerLine;
  7107. frame.mcusPerColumn = mcusPerColumn;
  7108. }
  7109. function readDataBlock(data, offset) {
  7110. const length = readUint16(data, offset);
  7111. offset += 2;
  7112. let endOffset = offset + length - 2;
  7113. const fileMarker = findNextFileMarker(data, endOffset, offset);
  7114. if (fileMarker?.invalid) {
  7115. warn("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  7116. endOffset = fileMarker.offset;
  7117. }
  7118. const array = data.subarray(offset, endOffset);
  7119. offset += array.length;
  7120. return {
  7121. appData: array,
  7122. newOffset: offset
  7123. };
  7124. }
  7125. function skipData(data, offset) {
  7126. const length = readUint16(data, offset);
  7127. offset += 2;
  7128. const endOffset = offset + length - 2;
  7129. const fileMarker = findNextFileMarker(data, endOffset, offset);
  7130. if (fileMarker?.invalid) {
  7131. return fileMarker.offset;
  7132. }
  7133. return endOffset;
  7134. }
  7135. class JpegImage {
  7136. constructor({
  7137. decodeTransform = null,
  7138. colorTransform = -1
  7139. } = {}) {
  7140. this._decodeTransform = decodeTransform;
  7141. this._colorTransform = colorTransform;
  7142. }
  7143. static canUseImageDecoder(data, colorTransform = -1) {
  7144. let offset = 0;
  7145. let numComponents = null;
  7146. let fileMarker = readUint16(data, offset);
  7147. offset += 2;
  7148. if (fileMarker !== 0xffd8) {
  7149. throw new JpegError("SOI not found");
  7150. }
  7151. fileMarker = readUint16(data, offset);
  7152. offset += 2;
  7153. markerLoop: while (fileMarker !== 0xffd9) {
  7154. switch (fileMarker) {
  7155. case 0xffc0:
  7156. case 0xffc1:
  7157. case 0xffc2:
  7158. numComponents = data[offset + (2 + 1 + 2 + 2)];
  7159. break markerLoop;
  7160. case 0xffff:
  7161. if (data[offset] !== 0xff) {
  7162. offset--;
  7163. }
  7164. break;
  7165. }
  7166. offset = skipData(data, offset);
  7167. fileMarker = readUint16(data, offset);
  7168. offset += 2;
  7169. }
  7170. if (numComponents === 4) {
  7171. return false;
  7172. }
  7173. if (numComponents === 3 && colorTransform === 0) {
  7174. return false;
  7175. }
  7176. return true;
  7177. }
  7178. parse(data, {
  7179. dnlScanLines = null
  7180. } = {}) {
  7181. let offset = 0;
  7182. let jfif = null;
  7183. let adobe = null;
  7184. let frame, resetInterval;
  7185. let numSOSMarkers = 0;
  7186. const quantizationTables = [];
  7187. const huffmanTablesAC = [],
  7188. huffmanTablesDC = [];
  7189. let fileMarker = readUint16(data, offset);
  7190. offset += 2;
  7191. if (fileMarker !== 0xffd8) {
  7192. throw new JpegError("SOI not found");
  7193. }
  7194. fileMarker = readUint16(data, offset);
  7195. offset += 2;
  7196. markerLoop: while (fileMarker !== 0xffd9) {
  7197. let i, j, l;
  7198. switch (fileMarker) {
  7199. case 0xffe0:
  7200. case 0xffe1:
  7201. case 0xffe2:
  7202. case 0xffe3:
  7203. case 0xffe4:
  7204. case 0xffe5:
  7205. case 0xffe6:
  7206. case 0xffe7:
  7207. case 0xffe8:
  7208. case 0xffe9:
  7209. case 0xffea:
  7210. case 0xffeb:
  7211. case 0xffec:
  7212. case 0xffed:
  7213. case 0xffee:
  7214. case 0xffef:
  7215. case 0xfffe:
  7216. const {
  7217. appData,
  7218. newOffset
  7219. } = readDataBlock(data, offset);
  7220. offset = newOffset;
  7221. if (fileMarker === 0xffe0) {
  7222. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  7223. jfif = {
  7224. version: {
  7225. major: appData[5],
  7226. minor: appData[6]
  7227. },
  7228. densityUnits: appData[7],
  7229. xDensity: appData[8] << 8 | appData[9],
  7230. yDensity: appData[10] << 8 | appData[11],
  7231. thumbWidth: appData[12],
  7232. thumbHeight: appData[13],
  7233. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  7234. };
  7235. }
  7236. }
  7237. if (fileMarker === 0xffee) {
  7238. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  7239. adobe = {
  7240. version: appData[5] << 8 | appData[6],
  7241. flags0: appData[7] << 8 | appData[8],
  7242. flags1: appData[9] << 8 | appData[10],
  7243. transformCode: appData[11]
  7244. };
  7245. }
  7246. }
  7247. break;
  7248. case 0xffdb:
  7249. const quantizationTablesLength = readUint16(data, offset);
  7250. offset += 2;
  7251. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  7252. let z;
  7253. while (offset < quantizationTablesEnd) {
  7254. const quantizationTableSpec = data[offset++];
  7255. const tableData = new Uint16Array(64);
  7256. if (quantizationTableSpec >> 4 === 0) {
  7257. for (j = 0; j < 64; j++) {
  7258. z = dctZigZag[j];
  7259. tableData[z] = data[offset++];
  7260. }
  7261. } else if (quantizationTableSpec >> 4 === 1) {
  7262. for (j = 0; j < 64; j++) {
  7263. z = dctZigZag[j];
  7264. tableData[z] = readUint16(data, offset);
  7265. offset += 2;
  7266. }
  7267. } else {
  7268. throw new JpegError("DQT - invalid table spec");
  7269. }
  7270. quantizationTables[quantizationTableSpec & 15] = tableData;
  7271. }
  7272. break;
  7273. case 0xffc0:
  7274. case 0xffc1:
  7275. case 0xffc2:
  7276. if (frame) {
  7277. throw new JpegError("Only single frame JPEGs supported");
  7278. }
  7279. offset += 2;
  7280. frame = {};
  7281. frame.extended = fileMarker === 0xffc1;
  7282. frame.progressive = fileMarker === 0xffc2;
  7283. frame.precision = data[offset++];
  7284. const sofScanLines = readUint16(data, offset);
  7285. offset += 2;
  7286. frame.scanLines = dnlScanLines || sofScanLines;
  7287. frame.samplesPerLine = readUint16(data, offset);
  7288. offset += 2;
  7289. frame.components = [];
  7290. frame.componentIds = {};
  7291. const componentsCount = data[offset++];
  7292. let maxH = 0,
  7293. maxV = 0;
  7294. for (i = 0; i < componentsCount; i++) {
  7295. const componentId = data[offset];
  7296. const h = data[offset + 1] >> 4;
  7297. const v = data[offset + 1] & 15;
  7298. if (maxH < h) {
  7299. maxH = h;
  7300. }
  7301. if (maxV < v) {
  7302. maxV = v;
  7303. }
  7304. const qId = data[offset + 2];
  7305. l = frame.components.push({
  7306. h,
  7307. v,
  7308. quantizationId: qId,
  7309. quantizationTable: null
  7310. });
  7311. frame.componentIds[componentId] = l - 1;
  7312. offset += 3;
  7313. }
  7314. frame.maxH = maxH;
  7315. frame.maxV = maxV;
  7316. prepareComponents(frame);
  7317. break;
  7318. case 0xffc4:
  7319. const huffmanLength = readUint16(data, offset);
  7320. offset += 2;
  7321. for (i = 2; i < huffmanLength;) {
  7322. const huffmanTableSpec = data[offset++];
  7323. const codeLengths = new Uint8Array(16);
  7324. let codeLengthSum = 0;
  7325. for (j = 0; j < 16; j++, offset++) {
  7326. codeLengthSum += codeLengths[j] = data[offset];
  7327. }
  7328. const huffmanValues = new Uint8Array(codeLengthSum);
  7329. for (j = 0; j < codeLengthSum; j++, offset++) {
  7330. huffmanValues[j] = data[offset];
  7331. }
  7332. i += 17 + codeLengthSum;
  7333. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  7334. }
  7335. break;
  7336. case 0xffdd:
  7337. offset += 2;
  7338. resetInterval = readUint16(data, offset);
  7339. offset += 2;
  7340. break;
  7341. case 0xffda:
  7342. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  7343. offset += 2;
  7344. const selectorsCount = data[offset++],
  7345. components = [];
  7346. for (i = 0; i < selectorsCount; i++) {
  7347. const index = data[offset++];
  7348. const componentIndex = frame.componentIds[index];
  7349. const component = frame.components[componentIndex];
  7350. component.index = index;
  7351. const tableSpec = data[offset++];
  7352. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  7353. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  7354. components.push(component);
  7355. }
  7356. const spectralStart = data[offset++],
  7357. spectralEnd = data[offset++],
  7358. successiveApproximation = data[offset++];
  7359. try {
  7360. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  7361. offset += processed;
  7362. } catch (ex) {
  7363. if (ex instanceof DNLMarkerError) {
  7364. warn(`${ex.message} -- attempting to re-parse the JPEG image.`);
  7365. return this.parse(data, {
  7366. dnlScanLines: ex.scanLines
  7367. });
  7368. } else if (ex instanceof EOIMarkerError) {
  7369. warn(`${ex.message} -- ignoring the rest of the image data.`);
  7370. break markerLoop;
  7371. }
  7372. throw ex;
  7373. }
  7374. break;
  7375. case 0xffdc:
  7376. offset += 4;
  7377. break;
  7378. case 0xffff:
  7379. if (data[offset] !== 0xff) {
  7380. offset--;
  7381. }
  7382. break;
  7383. default:
  7384. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  7385. if (nextFileMarker?.invalid) {
  7386. warn("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  7387. offset = nextFileMarker.offset;
  7388. break;
  7389. }
  7390. if (!nextFileMarker || offset >= data.length - 1) {
  7391. warn("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  7392. break markerLoop;
  7393. }
  7394. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  7395. }
  7396. fileMarker = readUint16(data, offset);
  7397. offset += 2;
  7398. }
  7399. if (!frame) {
  7400. throw new JpegError("JpegImage.parse - no frame data found.");
  7401. }
  7402. this.width = frame.samplesPerLine;
  7403. this.height = frame.scanLines;
  7404. this.jfif = jfif;
  7405. this.adobe = adobe;
  7406. this.components = [];
  7407. for (const component of frame.components) {
  7408. const quantizationTable = quantizationTables[component.quantizationId];
  7409. if (quantizationTable) {
  7410. component.quantizationTable = quantizationTable;
  7411. }
  7412. this.components.push({
  7413. index: component.index,
  7414. output: buildComponentData(frame, component),
  7415. scaleX: component.h / frame.maxH,
  7416. scaleY: component.v / frame.maxV,
  7417. blocksPerLine: component.blocksPerLine,
  7418. blocksPerColumn: component.blocksPerColumn
  7419. });
  7420. }
  7421. this.numComponents = this.components.length;
  7422. return undefined;
  7423. }
  7424. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  7425. const scaleX = this.width / width,
  7426. scaleY = this.height / height;
  7427. let component, componentScaleX, componentScaleY, blocksPerScanline;
  7428. let x, y, i, j, k;
  7429. let index;
  7430. let offset = 0;
  7431. let output;
  7432. const numComponents = this.components.length;
  7433. const dataLength = width * height * numComponents;
  7434. const data = new Uint8ClampedArray(dataLength);
  7435. const xScaleBlockOffset = new Uint32Array(width);
  7436. const mask3LSB = 0xfffffff8;
  7437. let lastComponentScaleX;
  7438. for (i = 0; i < numComponents; i++) {
  7439. component = this.components[i];
  7440. componentScaleX = component.scaleX * scaleX;
  7441. componentScaleY = component.scaleY * scaleY;
  7442. offset = i;
  7443. output = component.output;
  7444. blocksPerScanline = component.blocksPerLine + 1 << 3;
  7445. if (componentScaleX !== lastComponentScaleX) {
  7446. for (x = 0; x < width; x++) {
  7447. j = 0 | x * componentScaleX;
  7448. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  7449. }
  7450. lastComponentScaleX = componentScaleX;
  7451. }
  7452. for (y = 0; y < height; y++) {
  7453. j = 0 | y * componentScaleY;
  7454. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  7455. for (x = 0; x < width; x++) {
  7456. data[offset] = output[index + xScaleBlockOffset[x]];
  7457. offset += numComponents;
  7458. }
  7459. }
  7460. }
  7461. let transform = this._decodeTransform;
  7462. if (!isSourcePDF && numComponents === 4 && !transform) {
  7463. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  7464. }
  7465. if (transform) {
  7466. for (i = 0; i < dataLength;) {
  7467. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  7468. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  7469. }
  7470. }
  7471. }
  7472. return data;
  7473. }
  7474. get _isColorConversionNeeded() {
  7475. if (this.adobe) {
  7476. return !!this.adobe.transformCode;
  7477. }
  7478. if (this.numComponents === 3) {
  7479. if (this._colorTransform === 0) {
  7480. return false;
  7481. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  7482. return false;
  7483. }
  7484. return true;
  7485. }
  7486. if (this._colorTransform === 1) {
  7487. return true;
  7488. }
  7489. return false;
  7490. }
  7491. _convertYccToRgb(data) {
  7492. let Y, Cb, Cr;
  7493. for (let i = 0, length = data.length; i < length; i += 3) {
  7494. Y = data[i];
  7495. Cb = data[i + 1];
  7496. Cr = data[i + 2];
  7497. data[i] = Y - 179.456 + 1.402 * Cr;
  7498. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  7499. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  7500. }
  7501. return data;
  7502. }
  7503. _convertYccToRgba(data, out) {
  7504. for (let i = 0, j = 0, length = data.length; i < length; i += 3, j += 4) {
  7505. const Y = data[i];
  7506. const Cb = data[i + 1];
  7507. const Cr = data[i + 2];
  7508. out[j] = Y - 179.456 + 1.402 * Cr;
  7509. out[j + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  7510. out[j + 2] = Y - 226.816 + 1.772 * Cb;
  7511. out[j + 3] = 255;
  7512. }
  7513. return out;
  7514. }
  7515. _convertYcckToRgb(data) {
  7516. let Y, Cb, Cr, k;
  7517. let offset = 0;
  7518. for (let i = 0, length = data.length; i < length; i += 4) {
  7519. Y = data[i];
  7520. Cb = data[i + 1];
  7521. Cr = data[i + 2];
  7522. k = data[i + 3];
  7523. data[offset++] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  7524. data[offset++] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  7525. data[offset++] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  7526. }
  7527. return data.subarray(0, offset);
  7528. }
  7529. _convertYcckToRgba(data) {
  7530. for (let i = 0, length = data.length; i < length; i += 4) {
  7531. const Y = data[i];
  7532. const Cb = data[i + 1];
  7533. const Cr = data[i + 2];
  7534. const k = data[i + 3];
  7535. data[i] = -122.67195406894 + Cb * (-6.60635669420364e-5 * Cb + 0.000437130475926232 * Cr - 5.4080610064599e-5 * Y + 0.00048449797120281 * k - 0.154362151871126) + Cr * (-0.000957964378445773 * Cr + 0.000817076911346625 * Y - 0.00477271405408747 * k + 1.53380253221734) + Y * (0.000961250184130688 * Y - 0.00266257332283933 * k + 0.48357088451265) + k * (-0.000336197177618394 * k + 0.484791561490776);
  7536. data[i + 1] = 107.268039397724 + Cb * (2.19927104525741e-5 * Cb - 0.000640992018297945 * Cr + 0.000659397001245577 * Y + 0.000426105652938837 * k - 0.176491792462875) + Cr * (-0.000778269941513683 * Cr + 0.00130872261408275 * Y + 0.000770482631801132 * k - 0.151051492775562) + Y * (0.00126935368114843 * Y - 0.00265090189010898 * k + 0.25802910206845) + k * (-0.000318913117588328 * k - 0.213742400323665);
  7537. data[i + 2] = -20.810012546947 + Cb * (-0.000570115196973677 * Cb - 2.63409051004589e-5 * Cr + 0.0020741088115012 * Y - 0.00288260236853442 * k + 0.814272968359295) + Cr * (-1.53496057440975e-5 * Cr - 0.000132689043961446 * Y + 0.000560833691242812 * k - 0.195152027534049) + Y * (0.00174418132927582 * Y - 0.00255243321439347 * k + 0.116935020465145) + k * (-0.000343531996510555 * k + 0.24165260232407);
  7538. data[i + 3] = 255;
  7539. }
  7540. return data;
  7541. }
  7542. _convertYcckToCmyk(data) {
  7543. let Y, Cb, Cr;
  7544. for (let i = 0, length = data.length; i < length; i += 4) {
  7545. Y = data[i];
  7546. Cb = data[i + 1];
  7547. Cr = data[i + 2];
  7548. data[i] = 434.456 - Y - 1.402 * Cr;
  7549. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  7550. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  7551. }
  7552. return data;
  7553. }
  7554. _convertCmykToRgb(data) {
  7555. let c, m, y, k;
  7556. let offset = 0;
  7557. for (let i = 0, length = data.length; i < length; i += 4) {
  7558. c = data[i];
  7559. m = data[i + 1];
  7560. y = data[i + 2];
  7561. k = data[i + 3];
  7562. data[offset++] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  7563. data[offset++] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
  7564. data[offset++] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  7565. }
  7566. return data.subarray(0, offset);
  7567. }
  7568. _convertCmykToRgba(data) {
  7569. for (let i = 0, length = data.length; i < length; i += 4) {
  7570. const c = data[i];
  7571. const m = data[i + 1];
  7572. const y = data[i + 2];
  7573. const k = data[i + 3];
  7574. data[i] = 255 + c * (-0.00006747147073602441 * c + 0.0008379262121013727 * m + 0.0002894718188643294 * y + 0.003264231057537806 * k - 1.1185611867203937) + m * (0.000026374107616089405 * m - 0.00008626949158638572 * y - 0.0002748769067499491 * k - 0.02155688794978967) + y * (-0.00003878099212869363 * y - 0.0003267808279485286 * k + 0.0686742238595345) - k * (0.0003361971776183937 * k + 0.7430659151342254);
  7575. data[i + 1] = 255 + c * (0.00013596372813588848 * c + 0.000924537132573585 * m + 0.00010567359618683593 * y + 0.0004791864687436512 * k - 0.3109689587515875) + m * (-0.00023545346108370344 * m + 0.0002702845253534714 * y + 0.0020200308977307156 * k - 0.7488052167015494) + y * (0.00006834815998235662 * y + 0.00015168452363460973 * k - 0.09751927774728933) - k * (0.0003189131175883281 * k + 0.7364883807733168);
  7576. data[i + 2] = 255 + c * (0.000013598650411385307 * c + 0.00012423956175490851 * m + 0.0004751985097583589 * y - 0.0000036729317476630422 * k - 0.05562186980264034) + m * (0.00016141380598724676 * m + 0.0009692239130725186 * y + 0.0007782692450036253 * k - 0.44015232367526463) + y * (5.068882914068769e-7 * y + 0.0017778369011375071 * k - 0.7591454649749609) - k * (0.0003435319965105553 * k + 0.7063770186160144);
  7577. data[i + 3] = 255;
  7578. }
  7579. return data;
  7580. }
  7581. getData({
  7582. width,
  7583. height,
  7584. forceRGBA = false,
  7585. forceRGB = false,
  7586. isSourcePDF = false
  7587. }) {
  7588. if (this.numComponents > 4) {
  7589. throw new JpegError("Unsupported color mode");
  7590. }
  7591. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  7592. if (this.numComponents === 1 && (forceRGBA || forceRGB)) {
  7593. const len = data.length * (forceRGBA ? 4 : 3);
  7594. const rgbaData = new Uint8ClampedArray(len);
  7595. let offset = 0;
  7596. if (forceRGBA) {
  7597. grayToRGBA(data, new Uint32Array(rgbaData.buffer));
  7598. } else {
  7599. for (const grayColor of data) {
  7600. rgbaData[offset++] = grayColor;
  7601. rgbaData[offset++] = grayColor;
  7602. rgbaData[offset++] = grayColor;
  7603. }
  7604. }
  7605. return rgbaData;
  7606. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  7607. if (forceRGBA) {
  7608. const rgbaData = new Uint8ClampedArray(data.length / 3 * 4);
  7609. return this._convertYccToRgba(data, rgbaData);
  7610. }
  7611. return this._convertYccToRgb(data);
  7612. } else if (this.numComponents === 4) {
  7613. if (this._isColorConversionNeeded) {
  7614. if (forceRGBA) {
  7615. return this._convertYcckToRgba(data);
  7616. }
  7617. if (forceRGB) {
  7618. return this._convertYcckToRgb(data);
  7619. }
  7620. return this._convertYcckToCmyk(data);
  7621. } else if (forceRGBA) {
  7622. return this._convertCmykToRgba(data);
  7623. } else if (forceRGB) {
  7624. return this._convertCmykToRgb(data);
  7625. }
  7626. }
  7627. return data;
  7628. }
  7629. }
  7630. ;// ./src/core/jpeg_stream.js
  7631. class JpegStream extends DecodeStream {
  7632. static #isImageDecoderSupported = FeatureTest.isImageDecoderSupported;
  7633. constructor(stream, maybeLength, params) {
  7634. super(maybeLength);
  7635. this.stream = stream;
  7636. this.dict = stream.dict;
  7637. this.maybeLength = maybeLength;
  7638. this.params = params;
  7639. }
  7640. static get canUseImageDecoder() {
  7641. return shadow(this, "canUseImageDecoder", this.#isImageDecoderSupported ? ImageDecoder.isTypeSupported("image/jpeg") : Promise.resolve(false));
  7642. }
  7643. static setOptions({
  7644. isImageDecoderSupported = false
  7645. }) {
  7646. this.#isImageDecoderSupported = isImageDecoderSupported;
  7647. }
  7648. get bytes() {
  7649. return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
  7650. }
  7651. ensureBuffer(requested) {}
  7652. readBlock() {
  7653. this.decodeImage();
  7654. }
  7655. get jpegOptions() {
  7656. const jpegOptions = {
  7657. decodeTransform: undefined,
  7658. colorTransform: undefined
  7659. };
  7660. const decodeArr = this.dict.getArray("D", "Decode");
  7661. if ((this.forceRGBA || this.forceRGB) && Array.isArray(decodeArr)) {
  7662. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  7663. const decodeArrLength = decodeArr.length;
  7664. const transform = new Int32Array(decodeArrLength);
  7665. let transformNeeded = false;
  7666. const maxValue = (1 << bitsPerComponent) - 1;
  7667. for (let i = 0; i < decodeArrLength; i += 2) {
  7668. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  7669. transform[i + 1] = decodeArr[i] * maxValue | 0;
  7670. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  7671. transformNeeded = true;
  7672. }
  7673. }
  7674. if (transformNeeded) {
  7675. jpegOptions.decodeTransform = transform;
  7676. }
  7677. }
  7678. if (this.params instanceof Dict) {
  7679. const colorTransform = this.params.get("ColorTransform");
  7680. if (Number.isInteger(colorTransform)) {
  7681. jpegOptions.colorTransform = colorTransform;
  7682. }
  7683. }
  7684. return shadow(this, "jpegOptions", jpegOptions);
  7685. }
  7686. #skipUselessBytes(data) {
  7687. for (let i = 0, ii = data.length - 1; i < ii; i++) {
  7688. if (data[i] === 0xff && data[i + 1] === 0xd8) {
  7689. if (i > 0) {
  7690. data = data.subarray(i);
  7691. }
  7692. break;
  7693. }
  7694. }
  7695. return data;
  7696. }
  7697. decodeImage(bytes) {
  7698. if (this.eof) {
  7699. return this.buffer;
  7700. }
  7701. bytes = this.#skipUselessBytes(bytes || this.bytes);
  7702. const jpegImage = new JpegImage(this.jpegOptions);
  7703. jpegImage.parse(bytes);
  7704. const data = jpegImage.getData({
  7705. width: this.drawWidth,
  7706. height: this.drawHeight,
  7707. forceRGBA: this.forceRGBA,
  7708. forceRGB: this.forceRGB,
  7709. isSourcePDF: true
  7710. });
  7711. this.buffer = data;
  7712. this.bufferLength = data.length;
  7713. this.eof = true;
  7714. return this.buffer;
  7715. }
  7716. get canAsyncDecodeImageFromBuffer() {
  7717. return this.stream.isAsync;
  7718. }
  7719. async getTransferableImage() {
  7720. if (!(await JpegStream.canUseImageDecoder)) {
  7721. return null;
  7722. }
  7723. const jpegOptions = this.jpegOptions;
  7724. if (jpegOptions.decodeTransform) {
  7725. return null;
  7726. }
  7727. let decoder;
  7728. try {
  7729. const bytes = this.canAsyncDecodeImageFromBuffer && (await this.stream.asyncGetBytes()) || this.bytes;
  7730. if (!bytes) {
  7731. return null;
  7732. }
  7733. const data = this.#skipUselessBytes(bytes);
  7734. if (!JpegImage.canUseImageDecoder(data, jpegOptions.colorTransform)) {
  7735. return null;
  7736. }
  7737. decoder = new ImageDecoder({
  7738. data,
  7739. type: "image/jpeg",
  7740. preferAnimation: false
  7741. });
  7742. return (await decoder.decode()).image;
  7743. } catch (reason) {
  7744. warn(`getTransferableImage - failed: "${reason}".`);
  7745. return null;
  7746. } finally {
  7747. decoder?.close();
  7748. }
  7749. }
  7750. }
  7751. ;// ./external/openjpeg/openjpeg.js
  7752. var OpenJPEG = (() => {
  7753. var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
  7754. return function (moduleArg = {}) {
  7755. var moduleRtn;
  7756. var Module = moduleArg;
  7757. var readyPromiseResolve, readyPromiseReject;
  7758. var readyPromise = new Promise((resolve, reject) => {
  7759. readyPromiseResolve = resolve;
  7760. readyPromiseReject = reject;
  7761. });
  7762. var ENVIRONMENT_IS_WEB = true;
  7763. var ENVIRONMENT_IS_WORKER = false;
  7764. Module.decode = function (bytes, {
  7765. numComponents = 4,
  7766. isIndexedColormap = false,
  7767. smaskInData = false
  7768. }) {
  7769. const size = bytes.length;
  7770. const ptr = Module._malloc(size);
  7771. Module.HEAPU8.set(bytes, ptr);
  7772. const ret = Module._jp2_decode(ptr, size, numComponents > 0 ? numComponents : 0, !!isIndexedColormap, !!smaskInData);
  7773. Module._free(ptr);
  7774. if (ret) {
  7775. const {
  7776. errorMessages
  7777. } = Module;
  7778. if (errorMessages) {
  7779. delete Module.errorMessages;
  7780. return errorMessages;
  7781. }
  7782. return "Unknown error";
  7783. }
  7784. const {
  7785. imageData
  7786. } = Module;
  7787. Module.imageData = null;
  7788. return imageData;
  7789. };
  7790. var moduleOverrides = Object.assign({}, Module);
  7791. var arguments_ = [];
  7792. var thisProgram = "./this.program";
  7793. var quit_ = (status, toThrow) => {
  7794. throw toThrow;
  7795. };
  7796. var scriptDirectory = "";
  7797. var readAsync, readBinary;
  7798. if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
  7799. if (ENVIRONMENT_IS_WORKER) {
  7800. scriptDirectory = self.location.href;
  7801. } else if (typeof document != "undefined" && document.currentScript) {
  7802. scriptDirectory = document.currentScript.src;
  7803. }
  7804. if (_scriptName) {
  7805. scriptDirectory = _scriptName;
  7806. }
  7807. if (scriptDirectory.startsWith("blob:")) {
  7808. scriptDirectory = "";
  7809. } else {
  7810. scriptDirectory = scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
  7811. }
  7812. readAsync = url => fetch(url, {
  7813. credentials: "same-origin"
  7814. }).then(response => {
  7815. if (response.ok) {
  7816. return response.arrayBuffer();
  7817. }
  7818. return Promise.reject(new Error(response.status + " : " + response.url));
  7819. });
  7820. } else {}
  7821. var out = Module["print"] || console.log.bind(console);
  7822. var err = Module["printErr"] || console.error.bind(console);
  7823. Object.assign(Module, moduleOverrides);
  7824. moduleOverrides = null;
  7825. if (Module["arguments"]) arguments_ = Module["arguments"];
  7826. if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
  7827. var wasmBinary = Module["wasmBinary"];
  7828. function intArrayFromBase64(s) {
  7829. var decoded = atob(s);
  7830. var bytes = new Uint8Array(decoded.length);
  7831. for (var i = 0; i < decoded.length; ++i) {
  7832. bytes[i] = decoded.charCodeAt(i);
  7833. }
  7834. return bytes;
  7835. }
  7836. function tryParseAsDataURI(filename) {
  7837. if (!isDataURI(filename)) {
  7838. return;
  7839. }
  7840. return intArrayFromBase64(filename.slice(dataURIPrefix.length));
  7841. }
  7842. var wasmMemory;
  7843. var ABORT = false;
  7844. var EXITSTATUS;
  7845. var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
  7846. function updateMemoryViews() {
  7847. var b = wasmMemory.buffer;
  7848. Module["HEAP8"] = HEAP8 = new Int8Array(b);
  7849. Module["HEAP16"] = HEAP16 = new Int16Array(b);
  7850. Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
  7851. Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
  7852. Module["HEAP32"] = HEAP32 = new Int32Array(b);
  7853. Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
  7854. Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
  7855. Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
  7856. }
  7857. var __ATPRERUN__ = [];
  7858. var __ATINIT__ = [];
  7859. var __ATPOSTRUN__ = [];
  7860. var runtimeInitialized = false;
  7861. function preRun() {
  7862. if (Module["preRun"]) {
  7863. if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
  7864. while (Module["preRun"].length) {
  7865. addOnPreRun(Module["preRun"].shift());
  7866. }
  7867. }
  7868. callRuntimeCallbacks(__ATPRERUN__);
  7869. }
  7870. function initRuntime() {
  7871. runtimeInitialized = true;
  7872. callRuntimeCallbacks(__ATINIT__);
  7873. }
  7874. function postRun() {
  7875. if (Module["postRun"]) {
  7876. if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
  7877. while (Module["postRun"].length) {
  7878. addOnPostRun(Module["postRun"].shift());
  7879. }
  7880. }
  7881. callRuntimeCallbacks(__ATPOSTRUN__);
  7882. }
  7883. function addOnPreRun(cb) {
  7884. __ATPRERUN__.unshift(cb);
  7885. }
  7886. function addOnInit(cb) {
  7887. __ATINIT__.unshift(cb);
  7888. }
  7889. function addOnPostRun(cb) {
  7890. __ATPOSTRUN__.unshift(cb);
  7891. }
  7892. var runDependencies = 0;
  7893. var runDependencyWatcher = null;
  7894. var dependenciesFulfilled = null;
  7895. function addRunDependency(id) {
  7896. runDependencies++;
  7897. Module["monitorRunDependencies"]?.(runDependencies);
  7898. }
  7899. function removeRunDependency(id) {
  7900. runDependencies--;
  7901. Module["monitorRunDependencies"]?.(runDependencies);
  7902. if (runDependencies == 0) {
  7903. if (runDependencyWatcher !== null) {
  7904. clearInterval(runDependencyWatcher);
  7905. runDependencyWatcher = null;
  7906. }
  7907. if (dependenciesFulfilled) {
  7908. var callback = dependenciesFulfilled;
  7909. dependenciesFulfilled = null;
  7910. callback();
  7911. }
  7912. }
  7913. }
  7914. function abort(what) {
  7915. Module["onAbort"]?.(what);
  7916. what = "Aborted(" + what + ")";
  7917. err(what);
  7918. ABORT = true;
  7919. what += ". Build with -sASSERTIONS for more info.";
  7920. var e = new WebAssembly.RuntimeError(what);
  7921. readyPromiseReject(e);
  7922. throw e;
  7923. }
  7924. var dataURIPrefix = "data:application/octet-stream;base64,";
  7925. var isDataURI = filename => filename.startsWith(dataURIPrefix);
  7926. function findWasmBinary() {
  7927. var f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IARBAWohBCABQQFqIQEgAEEBaiIAIAZHDQALCyAFIAJrQXxLDQADQCADQQFrIAEtAAA6AAAgA0ECayABLQABOgAAIANBA2sgAS0AAjoAACADQQRrIgMgAS0AAzoAACABQQRqIQEgBEEEaiIEIAJHDQALCwuCBAEDfyACQYAETwRAIAAgASACEAIgAA8LIAAgAmohAwJAIAAgAXNBA3FFBEACQCAAQQNxRQRAIAAhAgwBCyACRQRAIAAhAgwBCyAAIQIDQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAkEDcUUNASACIANJDQALCyADQXxxIQQCQCADQcAASQ0AIAIgBEFAaiIFSw0AA0AgAiABKAIANgIAIAIgASgCBDYCBCACIAEoAgg2AgggAiABKAIMNgIMIAIgASgCEDYCECACIAEoAhQ2AhQgAiABKAIYNgIYIAIgASgCHDYCHCACIAEoAiA2AiAgAiABKAIkNgIkIAIgASgCKDYCKCACIAEoAiw2AiwgAiABKAIwNgIwIAIgASgCNDYCNCACIAEoAjg2AjggAiABKAI8NgI8IAFBQGshASACQUBrIgIgBU0NAAsLIAIgBE8NAQNAIAIgASgCADYCACABQQRqIQEgAkEEaiICIARJDQALDAELIANBBEkEQCAAIQIMAQsgA0EEayIEIABJBEAgACECDAELIAAhAgNAIAIgAS0AADoAACACIAEtAAE6AAEgAiABLQACOgACIAIgAS0AAzoAAyABQQRqIQEgAkEEaiICIARNDQALCyACIANJBEADQCACIAEtAAA6AAAgAUEBaiEBIAJBAWoiAiADRw0ACwsgAAswAQF/AkAgAEUNACABRQ0AQQggACABbCIBECkiAARAIABBACABEBkaCyAAIQILIAILEQAgAEUEQEEADwtBCCAAECkL8gICAn8BfgJAIAJFDQAgACABOgAAIAAgAmoiA0EBayABOgAAIAJBA0kNACAAIAE6AAIgACABOgABIANBA2sgAToAACADQQJrIAE6AAAgAkEHSQ0AIAAgAToAAyADQQRrIAE6AAAgAkEJSQ0AIABBACAAa0EDcSIEaiIDIAFB/wFxQYGChAhsIgE2AgAgAyACIARrQXxxIgRq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BAXRBAXIhBSACIARBAWoiBGshAyAErSEOIAFBAWtBACABQQFKGwshASAAIAM2AhAgACABNgIcIAAgDSAOhjcDCCAAIAApAyhC//////9AgyAFrUIjhoQ3AyhBBiECIANBBkgNACAAKAIcIgFBAnRB4KEBaigCACEEAn8gACkDCCINQgBTBEAgA0EBayECQX8gBHRBf3NBAXQhBUIBIQ5BDCABQQFqIAFBC04bDAELIA1BPyAEa62Ip0F/IAR0QX9zcUEBdEEBciEFIAMgBEEBaiIEayECIAStIQ4gAUEBa0EAIAFBAUobCyEBIAAgAjYCECAAIAE2AhwgACANIA6GNwMIIAAgACkDKEL///////9AgyAFrUIqhoQ3AyggAkEGSARAQQchAgwBCyAAKAIcIgFBAnRB4KEBaigCACEDAn4gACkDCCINQgBTBEBBDCABQQFqIAFBC04bIQQgAkEBayECQX8gA3RBf3NBAXQhAUIBDAELIAFBAWtBACABQQFKGyEEIA1BPyADa62Ip0F/IAN0QX9zcUEBdEEBciEBIAIgA0EBaiIDayECIAOtCyEOIAAgAjYCECAAIAQ2AhwgACANIA6GNwMIIAAgACkDKEL/////////QIMgAa1CMYaENwMoQQghAgsgACACQQFrNgIgIAAgACkDKCIOQgeINwMoIA6nQf8AcQsiAQF/IAAEQCAAKAIMIgEEQCABEBQgAEEANgIMCyAAEBQLC4IBAgF+A38CQCAAQoCAgIAQVARAIAAhAgwBCwNAIAFBAWsiASAAQgqAIgJC9gF+IAB8p0EwcjoAACAAQv////+fAVYgAiEADQALCyACQgBSBEAgAqchAwNAIAFBAWsiASADQQpuIgRB9gFsIANqQTByOgAAIANBCUsgBCEDDQALCyABC08BAX8gAEEANgIwIAAgACgCIDYCJCABIAAoAgAgACgCHBELACAAKAJEIQJFBEAgACACQQRyNgJEQQAPCyAAIAE3AzggACACQXtxNgJEQQEL3t4BBHB/BnsIfgF9IwBBEGsiTCQAAkAgAC0ACEGAAXFFDQAgASAAKALkAUcNACAAKAK0ASABQYwsbGoiTSgC3CsiF0UEQCBNEDQMAQsgAC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GoiICAgKAIAIAEgIWooAgAgCCAhaigCAGpBAmpBAnVrNgIAICUgMGoiICAgKAIAIAEgJWooAgAgCCAlaigCAGpBAmpBAnVrNgIAIAEgKWooAgAgCCApaigCAGpBAmoLIQEgKSAGQQJ0aiIGIAYoAgAgAUECdWs2AgAgB0EBaiIHICNHDQALCyAXIB9ODQAgDSAXIgEiB0oEQANAIBIgAUEFdGoiByAH/QACICAH/QACAP2uAUEB/awBIAf9AAIQ/a4B/QsCECABQQFqIgEgDUcNAAsgDSEHCyAHIB9ODQADQCApIAdBA3QiAUEEciIGQQJ0aiIqAn8gB0EASARAIBIoAgAhASAHQX9HBEAgEiAGQQJ0IgZqIgggCCgCACABajYCACAGICFqIgEgASgCACAhKAIAajYCACAGICVqIgEgASgCACAlKAIAajYCACApKAIADAILIBIgBkECdCIGaiIIIAgoAgAgUygCACABakEBdWo2AgAgBiAhaiIBIAEoAgAgUigCACAhKAIAakEBdWo2AgAgBiAlaiIBIAEoAgAgUSgCACAlKAIAakEBdWo2AgAgSygCACApKAIAakEBdQwBCyASIAEgMiAHIBZIG0ECdGoiASgCACEIIBYgB0EBaiIwTARAIBIgBkECdCIGaiIgICAoAgAgaSgCACAIakEBdWo2AgAgBiAhaiIIIAgoAgAgaCgCACABKAIEakEBdWo2AgAgBiAlaiIGIAYoAgAgZygCACABKAIIakEBdWo2AgAgZigCACABKAIMakEBdQwBCyASIAZBAnQiIGoiBiAGKAIAIAggEiAwQQV0aiIGKAIAakEBdWo2AgAgICAhaiIIIAgoAgAgBigCBCABKAIEakEBdWo2AgAgICAlaiIIIAgoAgAgBigCCCABKAIIakEBdWo2AgAgBigCDCABKAIMakEBdQsgKigCAGo2AgAgB0EBaiIHIB9HDQALCyA5IBEgWSAPID4gWkEBQQRBABAqDQALCwwCCyASEBRBASEHCyA5ICtBEGsoAgAiASBdKAIAIgZrICtBDGsoAgAgXigCACIIayArQQhrKAIAIgkgBmsgK0EEaygCACAIayAOKAI0QQEgCSABaxAiIDkQJw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8FIAALC7wCAAJAAkACQAJAAkACQAJAAkACQAJAAkAgAUEJaw4SAAgJCggJAQIDBAoJCgoICQUGBwsgAiACKAIAIgFBBGo2AgAgACABKAIANgIADwsgAiACKAIAIgFBBGo2AgAgACABMgEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMwEANwMADwsgAiACKAIAIgFBBGo2AgAgACABMAAANwMADwsgAiACKAIAIgFBBGo2AgAgACABMQAANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKwMAOQMADwsgACACIAMRAwALDwsgAiACKAIAIgFBBGo2AgAgACABNAIANwMADwsgAiACKAIAIgFBBGo2AgAgACABNQIANwMADwsgAiACKAIAQQdqQXhxIgFBCGo2AgAgACABKQMANwMAC28BBX8gACgCACIDLAAAQTBrIgFBCUsEQEEADwsDQEF/IQQgAkHMmbPmAE0EQEF/IAEgAkEKbCIFaiABIAVB/////wdzSxshBAsgACADQQFqIgU2AgAgAywAASAEIQIgBSEDQTBrIgFBCkkNAAsgAgtJAQF/AkBBAUEsEBciAQRAIAFBADYCEAJAIABBAEwEQCABQQFBCBAXIgA2AiQgAEUNAQwDCyABQQA2AgwLIAEQFAtBACEBCyABC64UAhJ/An4jAEFAaiIIJAAgCCABNgI8IAhBJ2ohFyAIQShqIRICQAJAAkACQANAQQAhBwNAIAEhDSAHIA5B/////wdzSg0CIAcgDmohDgJAAkACQAJAIAEiBy0AACIMBEADQAJAAkAgDEH/AXEiAUUEQCAHIQEMAQsgAUElRw0BIAchDANAIAwtAAFBJUcEQCAMIQEMAgsgB0EBaiEHIAwtAAIgDEECaiIBIQxBJUYNAAsLIAcgDWsiByAOQf////8HcyIYSg0JIAAEQCAAIA0gBxAeCyAHDQcgCCABNgI8IAFBAWohB0F/IRECQCABLAABQTBrIgtBCUsNACABLQACQSRHDQAgAUEDaiEHQQEhEyALIRELIAggBzYCPEEAIQkCQCAHLAAAIgxBIGsiAUEfSwRAIAchCwwBCyAHIQtBASABdCIBQYnRBHFFDQADQCAII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gAhAwDQFBACEGIAJBAUGbKkEAEBMMAwsgAyAHNgIEIAMgBTYCACACQQJBq+oAIAMQE0EAIQYgACADQcgAakEAIANBxABqIANBQGsgA0E8aiADQThqIANBNGogA0HMAGogASACECwNAQwCCwsgACACEH8hBgsgA0HQAGokACAGC4YUAw5/An4BeyMAQdAAayIJJAAgCUEBNgJMAkACQCAAKAKAAUEBRw0AIAAoAoQBQQFHDQAgACgCbA0AIAAoAnANACAAKAJkIgMoAgANACADKAIEDQAgAygCCCAAKAJ0Rw0AIAMoAgwgACgCeEcNAEEAIQMgACAJQcgAakEAIAlBxABqIAlBQGsgCUE8aiAJQThqIAlBNGogCUHMAGogASACECxFDQECQAJAIAkoAkxFDQAgACAJKAJIQQBBACABIAIQMUUNACAAKAJkIgEoAhANAUEBIQMMAwsgAkEBQaPEAEEAEBMMAgsgASgCGCEFA0AgBSAEQTRsIgFqKAIsEBQgACgCZCICKAIYIgUgAWoiAyAAKALoASIHKAIUKAIAKAIUIARBzABsaiIGKAIkNgIsIAMgBygCGCgCGCABaigCJDYCJCAGQQA2AiRBASEDIARBAWoiBCACKAIQSQ0ACwwBCyAAQgA3A1AgACgCWBAUIABBADYCWAJAAkAgACgCHA0AIAAoAiANACAAKAIkIAAoAoABRw0AQgIhESAAKAIoIAAoAoQBRg0BC0ICIREgACgCTA0AIAEoAhxBAkYNACAAKAKAASINIAAoAoQBbCIDBH4gA0EBcSEEIAAoAuABKAIoIQcCQCADQQFGBEBBACEDQgAhEQwBCyADQX5xIQZBACEDQgAhEQNAIAcgA0EobGoiCCgCBCIKBEAgCCgCECAKQRhsakEIaykDACISIBEgESASUxshEQsgByADQQFyQShsaiIIKAIEIgoEQCAIKAIQIApBGGxqQQhrKQMAIhIgESARIBJTGyERCyADQQJqIQMgBUECaiIFIAZHDQALCwJAIARFDQAgByADQShsaiIDKAIEIgVFDQAgAygCECAFQRhsakEIaykDACISIBEgESASUxshEQsgEUICfAVCAgshEUEAIQQCQCAAKAIgIgYgACgCK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AAACwAAAB3/wAAFAAAAC0AAAAAAAAAFABBwMQBCzUuAAAALwAAADAAAAAxAAAAMgAAADMAAAA0AAAANQAAACAgUGo3AAAAcHl0ZjgAAABoMnBqOQBBgMUBCzJyZGhpOgAAAHJsb2M7AAAAY2NwYjwAAABybGNwPQAAAHBhbWM+AAAAZmVkYz8AAABAZgBBwMUBC0EZAAsAGRkZAAAAAAUAAAAAAAAJAAAAAAsAAAAAAAAAABkACgoZGRkDCgcAAQAJCxgAAAkGCwAACwAGGQAAABkZGQBBkcYBCyEOAAAAAAAAAAAZAAsNGRkZAA0AAAIACQ4AAAAJAA4AAA4AQcvGAQsBDABB18YBCxUTAAAAABMAAAAACQwAAAAAAAwAAAwAQYXHAQsBEABBkccBCxUPAAAABA8AAAAACRAAAAAAABAAABAAQb/HAQsBEgBBy8cBCx4RAAAAABEAAAAACRIAAAAAABIAABIAABoAAAAaGhoAQYLIAQsOGgAAABoaGgAAAAAAAAkAQbPIAQsBFABBv8gBCxUXAAAAABcAAAAACRQAAAAAABQAABQAQe3IAQsBFgBB+cgBC2QVAAAAABUAAAAACRYAAAAAABYAABYAADAxMjM0NTY3ODlBQkNERUYAAAAAcAAAAHAAAABxAAAAcQAAAHEAAABxAAAAcQAAAHEAAABwAAAAcAAAAHEAAABwAAAAcAAAAHAAAABwAEGAygELHXEAAABxAAAAcAAAAHAAAAAAAAAAcAAAAAAAAABxAEGoywELCVBwAQAAAAAABQBBvMsBCwFrAEHUywELCmwAAABtAAAAuGsAQezLAQsBAgBB/MsBCwj//////////wBBwMwBCwEFAEHMzAELAW4AQeTMAQsObAAAAG8AAADIawAAAAQAQfzMAQsBAQBBjM0BCwX/////Cg==";
  7928. return f;
  7929. }
  7930. var wasmBinaryFile;
  7931. function getBinarySync(file) {
  7932. if (file == wasmBinaryFile && wasmBinary) {
  7933. return new Uint8Array(wasmBinary);
  7934. }
  7935. var binary = tryParseAsDataURI(file);
  7936. if (binary) {
  7937. return binary;
  7938. }
  7939. if (readBinary) {
  7940. return readBinary(file);
  7941. }
  7942. throw 'sync fetching of the wasm failed: you can preload it to Module["wasmBinary"] manually, or emcc.py will do that for you when generating HTML (but not JS)';
  7943. }
  7944. function instantiateSync(file, info) {
  7945. var module;
  7946. var binary = getBinarySync(file);
  7947. module = new WebAssembly.Module(binary);
  7948. var instance = new WebAssembly.Instance(module, info);
  7949. return [instance, module];
  7950. }
  7951. function getWasmImports() {
  7952. return {
  7953. a: wasmImports
  7954. };
  7955. }
  7956. function createWasm() {
  7957. function receiveInstance(instance, module) {
  7958. wasmExports = instance.exports;
  7959. wasmMemory = wasmExports["t"];
  7960. updateMemoryViews();
  7961. addOnInit(wasmExports["u"]);
  7962. removeRunDependency("wasm-instantiate");
  7963. return wasmExports;
  7964. }
  7965. addRunDependency("wasm-instantiate");
  7966. var info = getWasmImports();
  7967. if (Module["instantiateWasm"]) {
  7968. try {
  7969. return Module["instantiateWasm"](info, receiveInstance);
  7970. } catch (e) {
  7971. err(`Module.instantiateWasm callback failed with error: ${e}`);
  7972. readyPromiseReject(e);
  7973. }
  7974. }
  7975. wasmBinaryFile ??= findWasmBinary();
  7976. var result = instantiateSync(wasmBinaryFile, info);
  7977. return receiveInstance(result[0]);
  7978. }
  7979. class ExitStatus {
  7980. name = "ExitStatus";
  7981. constructor(status) {
  7982. this.message = `Program terminated with exit(${status})`;
  7983. this.status = status;
  7984. }
  7985. }
  7986. var callRuntimeCallbacks = callbacks => {
  7987. while (callbacks.length > 0) {
  7988. callbacks.shift()(Module);
  7989. }
  7990. };
  7991. var noExitRuntime = Module["noExitRuntime"] || true;
  7992. var __abort_js = () => abort("");
  7993. var __emscripten_memcpy_js = (dest, src, num) => HEAPU8.copyWithin(dest, src, src + num);
  7994. var runtimeKeepaliveCounter = 0;
  7995. var __emscripten_runtime_keepalive_clear = () => {
  7996. noExitRuntime = false;
  7997. runtimeKeepaliveCounter = 0;
  7998. };
  7999. var timers = {};
  8000. var handleException = e => {
  8001. if (e instanceof ExitStatus || e == "unwind") {
  8002. return EXITSTATUS;
  8003. }
  8004. quit_(1, e);
  8005. };
  8006. var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
  8007. var _proc_exit = code => {
  8008. EXITSTATUS = code;
  8009. if (!keepRuntimeAlive()) {
  8010. Module["onExit"]?.(code);
  8011. ABORT = true;
  8012. }
  8013. quit_(code, new ExitStatus(code));
  8014. };
  8015. var exitJS = (status, implicit) => {
  8016. EXITSTATUS = status;
  8017. _proc_exit(status);
  8018. };
  8019. var _exit = exitJS;
  8020. var maybeExit = () => {
  8021. if (!keepRuntimeAlive()) {
  8022. try {
  8023. _exit(EXITSTATUS);
  8024. } catch (e) {
  8025. handleException(e);
  8026. }
  8027. }
  8028. };
  8029. var callUserCallback = func => {
  8030. if (ABORT) {
  8031. return;
  8032. }
  8033. try {
  8034. func();
  8035. maybeExit();
  8036. } catch (e) {
  8037. handleException(e);
  8038. }
  8039. };
  8040. var _emscripten_get_now = () => performance.now();
  8041. var __setitimer_js = (which, timeout_ms) => {
  8042. if (timers[which]) {
  8043. clearTimeout(timers[which].id);
  8044. delete timers[which];
  8045. }
  8046. if (!timeout_ms) return 0;
  8047. var id = setTimeout(() => {
  8048. delete timers[which];
  8049. callUserCallback(() => __emscripten_timeout(which, _emscripten_get_now()));
  8050. }, timeout_ms);
  8051. timers[which] = {
  8052. id,
  8053. timeout_ms
  8054. };
  8055. return 0;
  8056. };
  8057. function _copy_pixels_1(compG_ptr, nb_pixels) {
  8058. compG_ptr >>= 2;
  8059. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels);
  8060. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8061. imageData.set(compG);
  8062. }
  8063. function _copy_pixels_3(compR_ptr, compG_ptr, compB_ptr, nb_pixels) {
  8064. compR_ptr >>= 2;
  8065. compG_ptr >>= 2;
  8066. compB_ptr >>= 2;
  8067. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 3);
  8068. const compR = Module.HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
  8069. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8070. const compB = Module.HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
  8071. for (let i = 0; i < nb_pixels; i++) {
  8072. imageData[3 * i] = compR[i];
  8073. imageData[3 * i + 1] = compG[i];
  8074. imageData[3 * i + 2] = compB[i];
  8075. }
  8076. }
  8077. function _copy_pixels_4(compR_ptr, compG_ptr, compB_ptr, compA_ptr, nb_pixels) {
  8078. compR_ptr >>= 2;
  8079. compG_ptr >>= 2;
  8080. compB_ptr >>= 2;
  8081. compA_ptr >>= 2;
  8082. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8083. const compR = Module.HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
  8084. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8085. const compB = Module.HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
  8086. const compA = Module.HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels);
  8087. for (let i = 0; i < nb_pixels; i++) {
  8088. imageData[4 * i] = compR[i];
  8089. imageData[4 * i + 1] = compG[i];
  8090. imageData[4 * i + 2] = compB[i];
  8091. imageData[4 * i + 3] = compA[i];
  8092. }
  8093. }
  8094. var getHeapMax = () => 2147483648;
  8095. var alignMemory = (size, alignment) => Math.ceil(size / alignment) * alignment;
  8096. var growMemory = size => {
  8097. var b = wasmMemory.buffer;
  8098. var pages = (size - b.byteLength + 65535) / 65536 | 0;
  8099. try {
  8100. wasmMemory.grow(pages);
  8101. updateMemoryViews();
  8102. return 1;
  8103. } catch (e) {}
  8104. };
  8105. var _emscripten_resize_heap = requestedSize => {
  8106. var oldSize = HEAPU8.length;
  8107. requestedSize >>>= 0;
  8108. var maxHeapSize = getHeapMax();
  8109. if (requestedSize > maxHeapSize) {
  8110. return false;
  8111. }
  8112. for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
  8113. var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
  8114. overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
  8115. var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
  8116. var replacement = growMemory(newSize);
  8117. if (replacement) {
  8118. return true;
  8119. }
  8120. }
  8121. return false;
  8122. };
  8123. var ENV = {};
  8124. var getExecutableName = () => thisProgram || "./this.program";
  8125. var getEnvStrings = () => {
  8126. if (!getEnvStrings.strings) {
  8127. var lang = (typeof navigator == "object" && navigator.languages && navigator.languages[0] || "C").replace("-", "_") + ".UTF-8";
  8128. var env = {
  8129. USER: "web_user",
  8130. LOGNAME: "web_user",
  8131. PATH: "/",
  8132. PWD: "/",
  8133. HOME: "/home/web_user",
  8134. LANG: lang,
  8135. _: getExecutableName()
  8136. };
  8137. for (var x in ENV) {
  8138. if (ENV[x] === undefined) delete env[x];else env[x] = ENV[x];
  8139. }
  8140. var strings = [];
  8141. for (var x in env) {
  8142. strings.push(`${x}=${env[x]}`);
  8143. }
  8144. getEnvStrings.strings = strings;
  8145. }
  8146. return getEnvStrings.strings;
  8147. };
  8148. var stringToAscii = (str, buffer) => {
  8149. for (var i = 0; i < str.length; ++i) {
  8150. HEAP8[buffer++] = str.charCodeAt(i);
  8151. }
  8152. HEAP8[buffer] = 0;
  8153. };
  8154. var _environ_get = (__environ, environ_buf) => {
  8155. var bufSize = 0;
  8156. getEnvStrings().forEach((string, i) => {
  8157. var ptr = environ_buf + bufSize;
  8158. HEAPU32[__environ + i * 4 >> 2] = ptr;
  8159. stringToAscii(string, ptr);
  8160. bufSize += string.length + 1;
  8161. });
  8162. return 0;
  8163. };
  8164. var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
  8165. var strings = getEnvStrings();
  8166. HEAPU32[penviron_count >> 2] = strings.length;
  8167. var bufSize = 0;
  8168. strings.forEach(string => bufSize += string.length + 1);
  8169. HEAPU32[penviron_buf_size >> 2] = bufSize;
  8170. return 0;
  8171. };
  8172. var _fd_close = fd => 52;
  8173. var convertI32PairToI53Checked = (lo, hi) => hi + 2097152 >>> 0 < 4194305 - !!lo ? (lo >>> 0) + hi * 4294967296 : NaN;
  8174. function _fd_seek(fd, offset_low, offset_high, whence, newOffset) {
  8175. var offset = convertI32PairToI53Checked(offset_low, offset_high);
  8176. return 70;
  8177. }
  8178. var printCharBuffers = [null, [], []];
  8179. var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder() : undefined;
  8180. var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => {
  8181. var endIdx = idx + maxBytesToRead;
  8182. var endPtr = idx;
  8183. while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
  8184. if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
  8185. return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
  8186. }
  8187. var str = "";
  8188. while (idx < endPtr) {
  8189. var u0 = heapOrArray[idx++];
  8190. if (!(u0 & 128)) {
  8191. str += String.fromCharCode(u0);
  8192. continue;
  8193. }
  8194. var u1 = heapOrArray[idx++] & 63;
  8195. if ((u0 & 224) == 192) {
  8196. str += String.fromCharCode((u0 & 31) << 6 | u1);
  8197. continue;
  8198. }
  8199. var u2 = heapOrArray[idx++] & 63;
  8200. if ((u0 & 240) == 224) {
  8201. u0 = (u0 & 15) << 12 | u1 << 6 | u2;
  8202. } else {
  8203. u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
  8204. }
  8205. if (u0 < 65536) {
  8206. str += String.fromCharCode(u0);
  8207. } else {
  8208. var ch = u0 - 65536;
  8209. str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
  8210. }
  8211. }
  8212. return str;
  8213. };
  8214. var printChar = (stream, curr) => {
  8215. var buffer = printCharBuffers[stream];
  8216. if (curr === 0 || curr === 10) {
  8217. (stream === 1 ? out : err)(UTF8ArrayToString(buffer));
  8218. buffer.length = 0;
  8219. } else {
  8220. buffer.push(curr);
  8221. }
  8222. };
  8223. var UTF8ToString = (ptr, maxBytesToRead) => ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
  8224. var _fd_write = (fd, iov, iovcnt, pnum) => {
  8225. var num = 0;
  8226. for (var i = 0; i < iovcnt; i++) {
  8227. var ptr = HEAPU32[iov >> 2];
  8228. var len = HEAPU32[iov + 4 >> 2];
  8229. iov += 8;
  8230. for (var j = 0; j < len; j++) {
  8231. printChar(fd, HEAPU8[ptr + j]);
  8232. }
  8233. num += len;
  8234. }
  8235. HEAPU32[pnum >> 2] = num;
  8236. return 0;
  8237. };
  8238. function _gray_to_rgba(compG_ptr, nb_pixels) {
  8239. compG_ptr >>= 2;
  8240. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8241. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8242. for (let i = 0; i < nb_pixels; i++) {
  8243. imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i];
  8244. imageData[4 * i + 3] = 255;
  8245. }
  8246. }
  8247. function _graya_to_rgba(compG_ptr, compA_ptr, nb_pixels) {
  8248. compG_ptr >>= 2;
  8249. compA_ptr >>= 2;
  8250. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8251. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8252. const compA = Module.HEAP32.subarray(compA_ptr, compA_ptr + nb_pixels);
  8253. for (let i = 0; i < nb_pixels; i++) {
  8254. imageData[4 * i] = imageData[4 * i + 1] = imageData[4 * i + 2] = compG[i];
  8255. imageData[4 * i + 3] = compA[i];
  8256. }
  8257. }
  8258. function _jsPrintWarning(message_ptr) {
  8259. const message = UTF8ToString(message_ptr);
  8260. (Module.warn || console.warn)(`OpenJPEG: ${message}`);
  8261. }
  8262. function _rgb_to_rgba(compR_ptr, compG_ptr, compB_ptr, nb_pixels) {
  8263. compR_ptr >>= 2;
  8264. compG_ptr >>= 2;
  8265. compB_ptr >>= 2;
  8266. const imageData = Module.imageData = new Uint8ClampedArray(nb_pixels * 4);
  8267. const compR = Module.HEAP32.subarray(compR_ptr, compR_ptr + nb_pixels);
  8268. const compG = Module.HEAP32.subarray(compG_ptr, compG_ptr + nb_pixels);
  8269. const compB = Module.HEAP32.subarray(compB_ptr, compB_ptr + nb_pixels);
  8270. for (let i = 0; i < nb_pixels; i++) {
  8271. imageData[4 * i] = compR[i];
  8272. imageData[4 * i + 1] = compG[i];
  8273. imageData[4 * i + 2] = compB[i];
  8274. imageData[4 * i + 3] = 255;
  8275. }
  8276. }
  8277. function _storeErrorMessage(message_ptr) {
  8278. const message = UTF8ToString(message_ptr);
  8279. if (!Module.errorMessages) {
  8280. Module.errorMessages = message;
  8281. } else {
  8282. Module.errorMessages += "\n" + message;
  8283. }
  8284. }
  8285. var wasmImports = {
  8286. m: __abort_js,
  8287. c: __emscripten_memcpy_js,
  8288. l: __emscripten_runtime_keepalive_clear,
  8289. n: __setitimer_js,
  8290. g: _copy_pixels_1,
  8291. f: _copy_pixels_3,
  8292. e: _copy_pixels_4,
  8293. o: _emscripten_resize_heap,
  8294. p: _environ_get,
  8295. q: _environ_sizes_get,
  8296. r: _fd_close,
  8297. j: _fd_seek,
  8298. b: _fd_write,
  8299. s: _gray_to_rgba,
  8300. i: _graya_to_rgba,
  8301. d: _jsPrintWarning,
  8302. k: _proc_exit,
  8303. h: _rgb_to_rgba,
  8304. a: _storeErrorMessage
  8305. };
  8306. var wasmExports = createWasm();
  8307. var ___wasm_call_ctors = wasmExports["u"];
  8308. var _malloc = Module["_malloc"] = wasmExports["v"];
  8309. var _free = Module["_free"] = wasmExports["w"];
  8310. var _jp2_decode = Module["_jp2_decode"] = wasmExports["y"];
  8311. var __emscripten_timeout = wasmExports["z"];
  8312. var calledRun;
  8313. dependenciesFulfilled = function runCaller() {
  8314. if (!calledRun) run();
  8315. if (!calledRun) dependenciesFulfilled = runCaller;
  8316. };
  8317. function run() {
  8318. if (runDependencies > 0) {
  8319. return;
  8320. }
  8321. preRun();
  8322. if (runDependencies > 0) {
  8323. return;
  8324. }
  8325. function doRun() {
  8326. if (calledRun) return;
  8327. calledRun = true;
  8328. Module["calledRun"] = true;
  8329. if (ABORT) return;
  8330. initRuntime();
  8331. readyPromiseResolve(Module);
  8332. Module["onRuntimeInitialized"]?.();
  8333. postRun();
  8334. }
  8335. if (Module["setStatus"]) {
  8336. Module["setStatus"]("Running...");
  8337. setTimeout(() => {
  8338. setTimeout(() => Module["setStatus"](""), 1);
  8339. doRun();
  8340. }, 1);
  8341. } else {
  8342. doRun();
  8343. }
  8344. }
  8345. if (Module["preInit"]) {
  8346. if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
  8347. while (Module["preInit"].length > 0) {
  8348. Module["preInit"].pop()();
  8349. }
  8350. }
  8351. run();
  8352. moduleRtn = Module;
  8353. return moduleRtn;
  8354. };
  8355. })();
  8356. /* harmony default export */ const openjpeg = (OpenJPEG);
  8357. ;// ./src/core/jpx.js
  8358. class JpxError extends BaseException {
  8359. constructor(msg) {
  8360. super(msg, "JpxError");
  8361. }
  8362. }
  8363. class JpxImage {
  8364. static #module = null;
  8365. static decode(data, decoderOptions) {
  8366. decoderOptions ||= {};
  8367. this.#module ||= openjpeg({
  8368. warn: warn
  8369. });
  8370. const imageData = this.#module.decode(data, decoderOptions);
  8371. if (typeof imageData === "string") {
  8372. throw new JpxError(imageData);
  8373. }
  8374. return imageData;
  8375. }
  8376. static cleanup() {
  8377. this.#module = null;
  8378. }
  8379. static parseImageProperties(stream) {
  8380. let newByte = stream.getByte();
  8381. while (newByte >= 0) {
  8382. const oldByte = newByte;
  8383. newByte = stream.getByte();
  8384. const code = oldByte << 8 | newByte;
  8385. if (code === 0xff51) {
  8386. stream.skip(4);
  8387. const Xsiz = stream.getInt32() >>> 0;
  8388. const Ysiz = stream.getInt32() >>> 0;
  8389. const XOsiz = stream.getInt32() >>> 0;
  8390. const YOsiz = stream.getInt32() >>> 0;
  8391. stream.skip(16);
  8392. const Csiz = stream.getUint16();
  8393. return {
  8394. width: Xsiz - XOsiz,
  8395. height: Ysiz - YOsiz,
  8396. bitsPerComponent: 8,
  8397. componentsCount: Csiz
  8398. };
  8399. }
  8400. }
  8401. throw new JpxError("No size marker found in JPX stream");
  8402. }
  8403. }
  8404. ;// ./src/core/jpx_stream.js
  8405. class JpxStream extends DecodeStream {
  8406. constructor(stream, maybeLength, params) {
  8407. super(maybeLength);
  8408. this.stream = stream;
  8409. this.dict = stream.dict;
  8410. this.maybeLength = maybeLength;
  8411. this.params = params;
  8412. }
  8413. get bytes() {
  8414. return shadow(this, "bytes", this.stream.getBytes(this.maybeLength));
  8415. }
  8416. ensureBuffer(requested) {}
  8417. readBlock(decoderOptions) {
  8418. this.decodeImage(null, decoderOptions);
  8419. }
  8420. decodeImage(bytes, decoderOptions) {
  8421. if (this.eof) {
  8422. return this.buffer;
  8423. }
  8424. bytes ||= this.bytes;
  8425. this.buffer = JpxImage.decode(bytes, decoderOptions);
  8426. this.bufferLength = this.buffer.length;
  8427. this.eof = true;
  8428. return this.buffer;
  8429. }
  8430. get canAsyncDecodeImageFromBuffer() {
  8431. return this.stream.isAsync;
  8432. }
  8433. }
  8434. ;// ./src/core/lzw_stream.js
  8435. class LZWStream extends DecodeStream {
  8436. constructor(str, maybeLength, earlyChange) {
  8437. super(maybeLength);
  8438. this.str = str;
  8439. this.dict = str.dict;
  8440. this.cachedData = 0;
  8441. this.bitsCached = 0;
  8442. const maxLzwDictionarySize = 4096;
  8443. const lzwState = {
  8444. earlyChange,
  8445. codeLength: 9,
  8446. nextCode: 258,
  8447. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  8448. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  8449. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  8450. currentSequence: new Uint8Array(maxLzwDictionarySize),
  8451. currentSequenceLength: 0
  8452. };
  8453. for (let i = 0; i < 256; ++i) {
  8454. lzwState.dictionaryValues[i] = i;
  8455. lzwState.dictionaryLengths[i] = 1;
  8456. }
  8457. this.lzwState = lzwState;
  8458. }
  8459. readBits(n) {
  8460. let bitsCached = this.bitsCached;
  8461. let cachedData = this.cachedData;
  8462. while (bitsCached < n) {
  8463. const c = this.str.getByte();
  8464. if (c === -1) {
  8465. this.eof = true;
  8466. return null;
  8467. }
  8468. cachedData = cachedData << 8 | c;
  8469. bitsCached += 8;
  8470. }
  8471. this.bitsCached = bitsCached -= n;
  8472. this.cachedData = cachedData;
  8473. this.lastCode = null;
  8474. return cachedData >>> bitsCached & (1 << n) - 1;
  8475. }
  8476. readBlock() {
  8477. const blockSize = 512,
  8478. decodedSizeDelta = blockSize;
  8479. let estimatedDecodedSize = blockSize * 2;
  8480. let i, j, q;
  8481. const lzwState = this.lzwState;
  8482. if (!lzwState) {
  8483. return;
  8484. }
  8485. const earlyChange = lzwState.earlyChange;
  8486. let nextCode = lzwState.nextCode;
  8487. const dictionaryValues = lzwState.dictionaryValues;
  8488. const dictionaryLengths = lzwState.dictionaryLengths;
  8489. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  8490. let codeLength = lzwState.codeLength;
  8491. let prevCode = lzwState.prevCode;
  8492. const currentSequence = lzwState.currentSequence;
  8493. let currentSequenceLength = lzwState.currentSequenceLength;
  8494. let decodedLength = 0;
  8495. let currentBufferLength = this.bufferLength;
  8496. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8497. for (i = 0; i < blockSize; i++) {
  8498. const code = this.readBits(codeLength);
  8499. const hasPrev = currentSequenceLength > 0;
  8500. if (code < 256) {
  8501. currentSequence[0] = code;
  8502. currentSequenceLength = 1;
  8503. } else if (code >= 258) {
  8504. if (code < nextCode) {
  8505. currentSequenceLength = dictionaryLengths[code];
  8506. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  8507. currentSequence[j] = dictionaryValues[q];
  8508. q = dictionaryPrevCodes[q];
  8509. }
  8510. } else {
  8511. currentSequence[currentSequenceLength++] = currentSequence[0];
  8512. }
  8513. } else if (code === 256) {
  8514. codeLength = 9;
  8515. nextCode = 258;
  8516. currentSequenceLength = 0;
  8517. continue;
  8518. } else {
  8519. this.eof = true;
  8520. delete this.lzwState;
  8521. break;
  8522. }
  8523. if (hasPrev) {
  8524. dictionaryPrevCodes[nextCode] = prevCode;
  8525. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  8526. dictionaryValues[nextCode] = currentSequence[0];
  8527. nextCode++;
  8528. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  8529. }
  8530. prevCode = code;
  8531. decodedLength += currentSequenceLength;
  8532. if (estimatedDecodedSize < decodedLength) {
  8533. do {
  8534. estimatedDecodedSize += decodedSizeDelta;
  8535. } while (estimatedDecodedSize < decodedLength);
  8536. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  8537. }
  8538. for (j = 0; j < currentSequenceLength; j++) {
  8539. buffer[currentBufferLength++] = currentSequence[j];
  8540. }
  8541. }
  8542. lzwState.nextCode = nextCode;
  8543. lzwState.codeLength = codeLength;
  8544. lzwState.prevCode = prevCode;
  8545. lzwState.currentSequenceLength = currentSequenceLength;
  8546. this.bufferLength = currentBufferLength;
  8547. }
  8548. }
  8549. ;// ./src/core/predictor_stream.js
  8550. class PredictorStream extends DecodeStream {
  8551. constructor(str, maybeLength, params) {
  8552. super(maybeLength);
  8553. if (!(params instanceof Dict)) {
  8554. return str;
  8555. }
  8556. const predictor = this.predictor = params.get("Predictor") || 1;
  8557. if (predictor <= 1) {
  8558. return str;
  8559. }
  8560. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  8561. throw new FormatError(`Unsupported predictor: ${predictor}`);
  8562. }
  8563. this.readBlock = predictor === 2 ? this.readBlockTiff : this.readBlockPng;
  8564. this.str = str;
  8565. this.dict = str.dict;
  8566. const colors = this.colors = params.get("Colors") || 1;
  8567. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  8568. const columns = this.columns = params.get("Columns") || 1;
  8569. this.pixBytes = colors * bits + 7 >> 3;
  8570. this.rowBytes = columns * colors * bits + 7 >> 3;
  8571. return this;
  8572. }
  8573. readBlockTiff() {
  8574. const rowBytes = this.rowBytes;
  8575. const bufferLength = this.bufferLength;
  8576. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  8577. const bits = this.bits;
  8578. const colors = this.colors;
  8579. const rawBytes = this.str.getBytes(rowBytes);
  8580. this.eof = !rawBytes.length;
  8581. if (this.eof) {
  8582. return;
  8583. }
  8584. let inbuf = 0,
  8585. outbuf = 0;
  8586. let inbits = 0,
  8587. outbits = 0;
  8588. let pos = bufferLength;
  8589. let i;
  8590. if (bits === 1 && colors === 1) {
  8591. for (i = 0; i < rowBytes; ++i) {
  8592. let c = rawBytes[i] ^ inbuf;
  8593. c ^= c >> 1;
  8594. c ^= c >> 2;
  8595. c ^= c >> 4;
  8596. inbuf = (c & 1) << 7;
  8597. buffer[pos++] = c;
  8598. }
  8599. } else if (bits === 8) {
  8600. for (i = 0; i < colors; ++i) {
  8601. buffer[pos++] = rawBytes[i];
  8602. }
  8603. for (; i < rowBytes; ++i) {
  8604. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  8605. pos++;
  8606. }
  8607. } else if (bits === 16) {
  8608. const bytesPerPixel = colors * 2;
  8609. for (i = 0; i < bytesPerPixel; ++i) {
  8610. buffer[pos++] = rawBytes[i];
  8611. }
  8612. for (; i < rowBytes; i += 2) {
  8613. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  8614. buffer[pos++] = sum >> 8 & 0xff;
  8615. buffer[pos++] = sum & 0xff;
  8616. }
  8617. } else {
  8618. const compArray = new Uint8Array(colors + 1);
  8619. const bitMask = (1 << bits) - 1;
  8620. let j = 0,
  8621. k = bufferLength;
  8622. const columns = this.columns;
  8623. for (i = 0; i < columns; ++i) {
  8624. for (let kk = 0; kk < colors; ++kk) {
  8625. if (inbits < bits) {
  8626. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  8627. inbits += 8;
  8628. }
  8629. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  8630. inbits -= bits;
  8631. outbuf = outbuf << bits | compArray[kk];
  8632. outbits += bits;
  8633. if (outbits >= 8) {
  8634. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  8635. outbits -= 8;
  8636. }
  8637. }
  8638. }
  8639. if (outbits > 0) {
  8640. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  8641. }
  8642. }
  8643. this.bufferLength += rowBytes;
  8644. }
  8645. readBlockPng() {
  8646. const rowBytes = this.rowBytes;
  8647. const pixBytes = this.pixBytes;
  8648. const predictor = this.str.getByte();
  8649. const rawBytes = this.str.getBytes(rowBytes);
  8650. this.eof = !rawBytes.length;
  8651. if (this.eof) {
  8652. return;
  8653. }
  8654. const bufferLength = this.bufferLength;
  8655. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  8656. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  8657. if (prevRow.length === 0) {
  8658. prevRow = new Uint8Array(rowBytes);
  8659. }
  8660. let i,
  8661. j = bufferLength,
  8662. up,
  8663. c;
  8664. switch (predictor) {
  8665. case 0:
  8666. for (i = 0; i < rowBytes; ++i) {
  8667. buffer[j++] = rawBytes[i];
  8668. }
  8669. break;
  8670. case 1:
  8671. for (i = 0; i < pixBytes; ++i) {
  8672. buffer[j++] = rawBytes[i];
  8673. }
  8674. for (; i < rowBytes; ++i) {
  8675. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  8676. j++;
  8677. }
  8678. break;
  8679. case 2:
  8680. for (i = 0; i < rowBytes; ++i) {
  8681. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  8682. }
  8683. break;
  8684. case 3:
  8685. for (i = 0; i < pixBytes; ++i) {
  8686. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  8687. }
  8688. for (; i < rowBytes; ++i) {
  8689. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  8690. j++;
  8691. }
  8692. break;
  8693. case 4:
  8694. for (i = 0; i < pixBytes; ++i) {
  8695. up = prevRow[i];
  8696. c = rawBytes[i];
  8697. buffer[j++] = up + c;
  8698. }
  8699. for (; i < rowBytes; ++i) {
  8700. up = prevRow[i];
  8701. const upLeft = prevRow[i - pixBytes];
  8702. const left = buffer[j - pixBytes];
  8703. const p = left + up - upLeft;
  8704. let pa = p - left;
  8705. if (pa < 0) {
  8706. pa = -pa;
  8707. }
  8708. let pb = p - up;
  8709. if (pb < 0) {
  8710. pb = -pb;
  8711. }
  8712. let pc = p - upLeft;
  8713. if (pc < 0) {
  8714. pc = -pc;
  8715. }
  8716. c = rawBytes[i];
  8717. if (pa <= pb && pa <= pc) {
  8718. buffer[j++] = left + c;
  8719. } else if (pb <= pc) {
  8720. buffer[j++] = up + c;
  8721. } else {
  8722. buffer[j++] = upLeft + c;
  8723. }
  8724. }
  8725. break;
  8726. default:
  8727. throw new FormatError(`Unsupported predictor: ${predictor}`);
  8728. }
  8729. this.bufferLength += rowBytes;
  8730. }
  8731. }
  8732. ;// ./src/core/run_length_stream.js
  8733. class RunLengthStream extends DecodeStream {
  8734. constructor(str, maybeLength) {
  8735. super(maybeLength);
  8736. this.str = str;
  8737. this.dict = str.dict;
  8738. }
  8739. readBlock() {
  8740. const repeatHeader = this.str.getBytes(2);
  8741. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  8742. this.eof = true;
  8743. return;
  8744. }
  8745. let buffer;
  8746. let bufferLength = this.bufferLength;
  8747. let n = repeatHeader[0];
  8748. if (n < 128) {
  8749. buffer = this.ensureBuffer(bufferLength + n + 1);
  8750. buffer[bufferLength++] = repeatHeader[1];
  8751. if (n > 0) {
  8752. const source = this.str.getBytes(n);
  8753. buffer.set(source, bufferLength);
  8754. bufferLength += n;
  8755. }
  8756. } else {
  8757. n = 257 - n;
  8758. const b = repeatHeader[1];
  8759. buffer = this.ensureBuffer(bufferLength + n + 1);
  8760. for (let i = 0; i < n; i++) {
  8761. buffer[bufferLength++] = b;
  8762. }
  8763. }
  8764. this.bufferLength = bufferLength;
  8765. }
  8766. }
  8767. ;// ./src/core/parser.js
  8768. const MAX_LENGTH_TO_CACHE = 1000;
  8769. function getInlineImageCacheKey(bytes) {
  8770. const strBuf = [],
  8771. ii = bytes.length;
  8772. let i = 0;
  8773. while (i < ii - 1) {
  8774. strBuf.push(bytes[i++] << 8 | bytes[i++]);
  8775. }
  8776. if (i < ii) {
  8777. strBuf.push(bytes[i]);
  8778. }
  8779. return ii + "_" + String.fromCharCode.apply(null, strBuf);
  8780. }
  8781. class Parser {
  8782. constructor({
  8783. lexer,
  8784. xref,
  8785. allowStreams = false,
  8786. recoveryMode = false
  8787. }) {
  8788. this.lexer = lexer;
  8789. this.xref = xref;
  8790. this.allowStreams = allowStreams;
  8791. this.recoveryMode = recoveryMode;
  8792. this.imageCache = Object.create(null);
  8793. this._imageId = 0;
  8794. this.refill();
  8795. }
  8796. refill() {
  8797. this.buf1 = this.lexer.getObj();
  8798. this.buf2 = this.lexer.getObj();
  8799. }
  8800. shift() {
  8801. if (this.buf2 instanceof Cmd && this.buf2.cmd === "ID") {
  8802. this.buf1 = this.buf2;
  8803. this.buf2 = null;
  8804. } else {
  8805. this.buf1 = this.buf2;
  8806. this.buf2 = this.lexer.getObj();
  8807. }
  8808. }
  8809. tryShift() {
  8810. try {
  8811. this.shift();
  8812. return true;
  8813. } catch (e) {
  8814. if (e instanceof MissingDataException) {
  8815. throw e;
  8816. }
  8817. return false;
  8818. }
  8819. }
  8820. getObj(cipherTransform = null) {
  8821. const buf1 = this.buf1;
  8822. this.shift();
  8823. if (buf1 instanceof Cmd) {
  8824. switch (buf1.cmd) {
  8825. case "BI":
  8826. return this.makeInlineImage(cipherTransform);
  8827. case "[":
  8828. const array = [];
  8829. while (!isCmd(this.buf1, "]") && this.buf1 !== EOF) {
  8830. array.push(this.getObj(cipherTransform));
  8831. }
  8832. if (this.buf1 === EOF) {
  8833. if (this.recoveryMode) {
  8834. return array;
  8835. }
  8836. throw new ParserEOFException("End of file inside array.");
  8837. }
  8838. this.shift();
  8839. return array;
  8840. case "<<":
  8841. const dict = new Dict(this.xref);
  8842. while (!isCmd(this.buf1, ">>") && this.buf1 !== EOF) {
  8843. if (!(this.buf1 instanceof Name)) {
  8844. info("Malformed dictionary: key must be a name object");
  8845. this.shift();
  8846. continue;
  8847. }
  8848. const key = this.buf1.name;
  8849. this.shift();
  8850. if (this.buf1 === EOF) {
  8851. break;
  8852. }
  8853. dict.set(key, this.getObj(cipherTransform));
  8854. }
  8855. if (this.buf1 === EOF) {
  8856. if (this.recoveryMode) {
  8857. return dict;
  8858. }
  8859. throw new ParserEOFException("End of file inside dictionary.");
  8860. }
  8861. if (isCmd(this.buf2, "stream")) {
  8862. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  8863. }
  8864. this.shift();
  8865. return dict;
  8866. default:
  8867. return buf1;
  8868. }
  8869. }
  8870. if (Number.isInteger(buf1)) {
  8871. if (Number.isInteger(this.buf1) && isCmd(this.buf2, "R")) {
  8872. const ref = Ref.get(buf1, this.buf1);
  8873. this.shift();
  8874. this.shift();
  8875. return ref;
  8876. }
  8877. return buf1;
  8878. }
  8879. if (typeof buf1 === "string") {
  8880. if (cipherTransform) {
  8881. return cipherTransform.decryptString(buf1);
  8882. }
  8883. return buf1;
  8884. }
  8885. return buf1;
  8886. }
  8887. findDefaultInlineStreamEnd(stream) {
  8888. const E = 0x45,
  8889. I = 0x49,
  8890. SPACE = 0x20,
  8891. LF = 0xa,
  8892. CR = 0xd,
  8893. NUL = 0x0;
  8894. const {
  8895. knownCommands
  8896. } = this.lexer,
  8897. startPos = stream.pos,
  8898. n = 15;
  8899. let state = 0,
  8900. ch,
  8901. maybeEIPos;
  8902. while ((ch = stream.getByte()) !== -1) {
  8903. if (state === 0) {
  8904. state = ch === E ? 1 : 0;
  8905. } else if (state === 1) {
  8906. state = ch === I ? 2 : 0;
  8907. } else {
  8908. if (ch === SPACE || ch === LF || ch === CR) {
  8909. maybeEIPos = stream.pos;
  8910. const followingBytes = stream.peekBytes(n);
  8911. const ii = followingBytes.length;
  8912. if (ii === 0) {
  8913. break;
  8914. }
  8915. for (let i = 0; i < ii; i++) {
  8916. ch = followingBytes[i];
  8917. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  8918. continue;
  8919. }
  8920. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  8921. state = 0;
  8922. break;
  8923. }
  8924. }
  8925. if (state !== 2) {
  8926. continue;
  8927. }
  8928. if (!knownCommands) {
  8929. warn("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  8930. continue;
  8931. }
  8932. const tmpLexer = new Lexer(new Stream(followingBytes.slice()), knownCommands);
  8933. tmpLexer._hexStringWarn = () => {};
  8934. let numArgs = 0;
  8935. while (true) {
  8936. const nextObj = tmpLexer.getObj();
  8937. if (nextObj === EOF) {
  8938. state = 0;
  8939. break;
  8940. }
  8941. if (nextObj instanceof Cmd) {
  8942. const knownCommand = knownCommands[nextObj.cmd];
  8943. if (!knownCommand) {
  8944. state = 0;
  8945. break;
  8946. } else if (knownCommand.variableArgs ? numArgs <= knownCommand.numArgs : numArgs === knownCommand.numArgs) {
  8947. break;
  8948. }
  8949. numArgs = 0;
  8950. continue;
  8951. }
  8952. numArgs++;
  8953. }
  8954. if (state === 2) {
  8955. break;
  8956. }
  8957. } else {
  8958. state = 0;
  8959. }
  8960. }
  8961. }
  8962. if (ch === -1) {
  8963. warn("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  8964. if (maybeEIPos) {
  8965. warn('... trying to recover by using the last "EI" occurrence.');
  8966. stream.skip(-(stream.pos - maybeEIPos));
  8967. }
  8968. }
  8969. let endOffset = 4;
  8970. stream.skip(-endOffset);
  8971. ch = stream.peekByte();
  8972. stream.skip(endOffset);
  8973. if (!isWhiteSpace(ch)) {
  8974. endOffset--;
  8975. }
  8976. return stream.pos - endOffset - startPos;
  8977. }
  8978. findDCTDecodeInlineStreamEnd(stream) {
  8979. const startPos = stream.pos;
  8980. let foundEOI = false,
  8981. b,
  8982. markerLength;
  8983. while ((b = stream.getByte()) !== -1) {
  8984. if (b !== 0xff) {
  8985. continue;
  8986. }
  8987. switch (stream.getByte()) {
  8988. case 0x00:
  8989. break;
  8990. case 0xff:
  8991. stream.skip(-1);
  8992. break;
  8993. case 0xd9:
  8994. foundEOI = true;
  8995. break;
  8996. case 0xc0:
  8997. case 0xc1:
  8998. case 0xc2:
  8999. case 0xc3:
  9000. case 0xc5:
  9001. case 0xc6:
  9002. case 0xc7:
  9003. case 0xc9:
  9004. case 0xca:
  9005. case 0xcb:
  9006. case 0xcd:
  9007. case 0xce:
  9008. case 0xcf:
  9009. case 0xc4:
  9010. case 0xcc:
  9011. case 0xda:
  9012. case 0xdb:
  9013. case 0xdc:
  9014. case 0xdd:
  9015. case 0xde:
  9016. case 0xdf:
  9017. case 0xe0:
  9018. case 0xe1:
  9019. case 0xe2:
  9020. case 0xe3:
  9021. case 0xe4:
  9022. case 0xe5:
  9023. case 0xe6:
  9024. case 0xe7:
  9025. case 0xe8:
  9026. case 0xe9:
  9027. case 0xea:
  9028. case 0xeb:
  9029. case 0xec:
  9030. case 0xed:
  9031. case 0xee:
  9032. case 0xef:
  9033. case 0xfe:
  9034. markerLength = stream.getUint16();
  9035. if (markerLength > 2) {
  9036. stream.skip(markerLength - 2);
  9037. } else {
  9038. stream.skip(-2);
  9039. }
  9040. break;
  9041. }
  9042. if (foundEOI) {
  9043. break;
  9044. }
  9045. }
  9046. const length = stream.pos - startPos;
  9047. if (b === -1) {
  9048. warn("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  9049. stream.skip(-length);
  9050. return this.findDefaultInlineStreamEnd(stream);
  9051. }
  9052. this.inlineStreamSkipEI(stream);
  9053. return length;
  9054. }
  9055. findASCII85DecodeInlineStreamEnd(stream) {
  9056. const TILDE = 0x7e,
  9057. GT = 0x3e;
  9058. const startPos = stream.pos;
  9059. let ch;
  9060. while ((ch = stream.getByte()) !== -1) {
  9061. if (ch === TILDE) {
  9062. const tildePos = stream.pos;
  9063. ch = stream.peekByte();
  9064. while (isWhiteSpace(ch)) {
  9065. stream.skip();
  9066. ch = stream.peekByte();
  9067. }
  9068. if (ch === GT) {
  9069. stream.skip();
  9070. break;
  9071. }
  9072. if (stream.pos > tildePos) {
  9073. const maybeEI = stream.peekBytes(2);
  9074. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  9075. break;
  9076. }
  9077. }
  9078. }
  9079. }
  9080. const length = stream.pos - startPos;
  9081. if (ch === -1) {
  9082. warn("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  9083. stream.skip(-length);
  9084. return this.findDefaultInlineStreamEnd(stream);
  9085. }
  9086. this.inlineStreamSkipEI(stream);
  9087. return length;
  9088. }
  9089. findASCIIHexDecodeInlineStreamEnd(stream) {
  9090. const GT = 0x3e;
  9091. const startPos = stream.pos;
  9092. let ch;
  9093. while ((ch = stream.getByte()) !== -1) {
  9094. if (ch === GT) {
  9095. break;
  9096. }
  9097. }
  9098. const length = stream.pos - startPos;
  9099. if (ch === -1) {
  9100. warn("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  9101. stream.skip(-length);
  9102. return this.findDefaultInlineStreamEnd(stream);
  9103. }
  9104. this.inlineStreamSkipEI(stream);
  9105. return length;
  9106. }
  9107. inlineStreamSkipEI(stream) {
  9108. const E = 0x45,
  9109. I = 0x49;
  9110. let state = 0,
  9111. ch;
  9112. while ((ch = stream.getByte()) !== -1) {
  9113. if (state === 0) {
  9114. state = ch === E ? 1 : 0;
  9115. } else if (state === 1) {
  9116. state = ch === I ? 2 : 0;
  9117. } else if (state === 2) {
  9118. break;
  9119. }
  9120. }
  9121. }
  9122. makeInlineImage(cipherTransform) {
  9123. const lexer = this.lexer;
  9124. const stream = lexer.stream;
  9125. const dictMap = Object.create(null);
  9126. let dictLength;
  9127. while (!isCmd(this.buf1, "ID") && this.buf1 !== EOF) {
  9128. if (!(this.buf1 instanceof Name)) {
  9129. throw new FormatError("Dictionary key must be a name object");
  9130. }
  9131. const key = this.buf1.name;
  9132. this.shift();
  9133. if (this.buf1 === EOF) {
  9134. break;
  9135. }
  9136. dictMap[key] = this.getObj(cipherTransform);
  9137. }
  9138. if (lexer.beginInlineImagePos !== -1) {
  9139. dictLength = stream.pos - lexer.beginInlineImagePos;
  9140. }
  9141. const filter = this.xref.fetchIfRef(dictMap.F || dictMap.Filter);
  9142. let filterName;
  9143. if (filter instanceof Name) {
  9144. filterName = filter.name;
  9145. } else if (Array.isArray(filter)) {
  9146. const filterZero = this.xref.fetchIfRef(filter[0]);
  9147. if (filterZero instanceof Name) {
  9148. filterName = filterZero.name;
  9149. }
  9150. }
  9151. const startPos = stream.pos;
  9152. let length;
  9153. switch (filterName) {
  9154. case "DCT":
  9155. case "DCTDecode":
  9156. length = this.findDCTDecodeInlineStreamEnd(stream);
  9157. break;
  9158. case "A85":
  9159. case "ASCII85Decode":
  9160. length = this.findASCII85DecodeInlineStreamEnd(stream);
  9161. break;
  9162. case "AHx":
  9163. case "ASCIIHexDecode":
  9164. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  9165. break;
  9166. default:
  9167. length = this.findDefaultInlineStreamEnd(stream);
  9168. }
  9169. let cacheKey;
  9170. if (length < MAX_LENGTH_TO_CACHE && dictLength > 0) {
  9171. const initialStreamPos = stream.pos;
  9172. stream.pos = lexer.beginInlineImagePos;
  9173. cacheKey = getInlineImageCacheKey(stream.getBytes(dictLength + length));
  9174. stream.pos = initialStreamPos;
  9175. const cacheEntry = this.imageCache[cacheKey];
  9176. if (cacheEntry !== undefined) {
  9177. this.buf2 = Cmd.get("EI");
  9178. this.shift();
  9179. cacheEntry.reset();
  9180. return cacheEntry;
  9181. }
  9182. }
  9183. const dict = new Dict(this.xref);
  9184. for (const key in dictMap) {
  9185. dict.set(key, dictMap[key]);
  9186. }
  9187. let imageStream = stream.makeSubStream(startPos, length, dict);
  9188. if (cipherTransform) {
  9189. imageStream = cipherTransform.createStream(imageStream, length);
  9190. }
  9191. imageStream = this.filter(imageStream, dict, length);
  9192. imageStream.dict = dict;
  9193. if (cacheKey !== undefined) {
  9194. imageStream.cacheKey = `inline_img_${++this._imageId}`;
  9195. this.imageCache[cacheKey] = imageStream;
  9196. }
  9197. this.buf2 = Cmd.get("EI");
  9198. this.shift();
  9199. return imageStream;
  9200. }
  9201. #findStreamLength(startPos) {
  9202. const {
  9203. stream
  9204. } = this.lexer;
  9205. stream.pos = startPos;
  9206. const SCAN_BLOCK_LENGTH = 2048;
  9207. const signatureLength = "endstream".length;
  9208. const END_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64]);
  9209. const endLength = END_SIGNATURE.length;
  9210. const PARTIAL_SIGNATURE = [new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x65, 0x61, 0x6d]), new Uint8Array([0x73, 0x74, 0x72, 0x65, 0x61])];
  9211. const normalLength = signatureLength - endLength;
  9212. while (stream.pos < stream.end) {
  9213. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  9214. const scanLength = scanBytes.length - signatureLength;
  9215. if (scanLength <= 0) {
  9216. break;
  9217. }
  9218. let pos = 0;
  9219. while (pos < scanLength) {
  9220. let j = 0;
  9221. while (j < endLength && scanBytes[pos + j] === END_SIGNATURE[j]) {
  9222. j++;
  9223. }
  9224. if (j >= endLength) {
  9225. let found = false;
  9226. for (const part of PARTIAL_SIGNATURE) {
  9227. const partLen = part.length;
  9228. let k = 0;
  9229. while (k < partLen && scanBytes[pos + j + k] === part[k]) {
  9230. k++;
  9231. }
  9232. if (k >= normalLength) {
  9233. found = true;
  9234. break;
  9235. }
  9236. if (k >= partLen) {
  9237. const lastByte = scanBytes[pos + j + k];
  9238. if (isWhiteSpace(lastByte)) {
  9239. info(`Found "${bytesToString([...END_SIGNATURE, ...part])}" when ` + "searching for endstream command.");
  9240. found = true;
  9241. }
  9242. break;
  9243. }
  9244. }
  9245. if (found) {
  9246. stream.pos += pos;
  9247. return stream.pos - startPos;
  9248. }
  9249. }
  9250. pos++;
  9251. }
  9252. stream.pos += scanLength;
  9253. }
  9254. return -1;
  9255. }
  9256. makeStream(dict, cipherTransform) {
  9257. const lexer = this.lexer;
  9258. let stream = lexer.stream;
  9259. lexer.skipToNextLine();
  9260. const startPos = stream.pos - 1;
  9261. let length = dict.get("Length");
  9262. if (!Number.isInteger(length)) {
  9263. info(`Bad length "${length && length.toString()}" in stream.`);
  9264. length = 0;
  9265. }
  9266. stream.pos = startPos + length;
  9267. lexer.nextChar();
  9268. if (this.tryShift() && isCmd(this.buf2, "endstream")) {
  9269. this.shift();
  9270. } else {
  9271. length = this.#findStreamLength(startPos);
  9272. if (length < 0) {
  9273. throw new FormatError("Missing endstream command.");
  9274. }
  9275. lexer.nextChar();
  9276. this.shift();
  9277. this.shift();
  9278. }
  9279. this.shift();
  9280. stream = stream.makeSubStream(startPos, length, dict);
  9281. if (cipherTransform) {
  9282. stream = cipherTransform.createStream(stream, length);
  9283. }
  9284. stream = this.filter(stream, dict, length);
  9285. stream.dict = dict;
  9286. return stream;
  9287. }
  9288. filter(stream, dict, length) {
  9289. let filter = dict.get("F", "Filter");
  9290. let params = dict.get("DP", "DecodeParms");
  9291. if (filter instanceof Name) {
  9292. if (Array.isArray(params)) {
  9293. warn("/DecodeParms should not be an Array, when /Filter is a Name.");
  9294. }
  9295. return this.makeFilter(stream, filter.name, length, params);
  9296. }
  9297. let maybeLength = length;
  9298. if (Array.isArray(filter)) {
  9299. const filterArray = filter;
  9300. const paramsArray = params;
  9301. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  9302. filter = this.xref.fetchIfRef(filterArray[i]);
  9303. if (!(filter instanceof Name)) {
  9304. throw new FormatError(`Bad filter name "${filter}"`);
  9305. }
  9306. params = null;
  9307. if (Array.isArray(paramsArray) && i in paramsArray) {
  9308. params = this.xref.fetchIfRef(paramsArray[i]);
  9309. }
  9310. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  9311. maybeLength = null;
  9312. }
  9313. }
  9314. return stream;
  9315. }
  9316. makeFilter(stream, name, maybeLength, params) {
  9317. if (maybeLength === 0) {
  9318. warn(`Empty "${name}" stream.`);
  9319. return new NullStream();
  9320. }
  9321. try {
  9322. switch (name) {
  9323. case "Fl":
  9324. case "FlateDecode":
  9325. if (params) {
  9326. return new PredictorStream(new FlateStream(stream, maybeLength), maybeLength, params);
  9327. }
  9328. return new FlateStream(stream, maybeLength);
  9329. case "LZW":
  9330. case "LZWDecode":
  9331. let earlyChange = 1;
  9332. if (params) {
  9333. if (params.has("EarlyChange")) {
  9334. earlyChange = params.get("EarlyChange");
  9335. }
  9336. return new PredictorStream(new LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  9337. }
  9338. return new LZWStream(stream, maybeLength, earlyChange);
  9339. case "DCT":
  9340. case "DCTDecode":
  9341. return new JpegStream(stream, maybeLength, params);
  9342. case "JPX":
  9343. case "JPXDecode":
  9344. return new JpxStream(stream, maybeLength, params);
  9345. case "A85":
  9346. case "ASCII85Decode":
  9347. return new Ascii85Stream(stream, maybeLength);
  9348. case "AHx":
  9349. case "ASCIIHexDecode":
  9350. return new AsciiHexStream(stream, maybeLength);
  9351. case "CCF":
  9352. case "CCITTFaxDecode":
  9353. return new CCITTFaxStream(stream, maybeLength, params);
  9354. case "RL":
  9355. case "RunLengthDecode":
  9356. return new RunLengthStream(stream, maybeLength);
  9357. case "JBIG2Decode":
  9358. return new Jbig2Stream(stream, maybeLength, params);
  9359. }
  9360. warn(`Filter "${name}" is not supported.`);
  9361. return stream;
  9362. } catch (ex) {
  9363. if (ex instanceof MissingDataException) {
  9364. throw ex;
  9365. }
  9366. warn(`Invalid stream: "${ex}"`);
  9367. return new NullStream();
  9368. }
  9369. }
  9370. }
  9371. const specialChars = [1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 2, 0, 0, 2, 2, 0, 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
  9372. function toHexDigit(ch) {
  9373. if (ch >= 0x30 && ch <= 0x39) {
  9374. return ch & 0x0f;
  9375. }
  9376. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  9377. return (ch & 0x0f) + 9;
  9378. }
  9379. return -1;
  9380. }
  9381. class Lexer {
  9382. constructor(stream, knownCommands = null) {
  9383. this.stream = stream;
  9384. this.nextChar();
  9385. this.strBuf = [];
  9386. this.knownCommands = knownCommands;
  9387. this._hexStringNumWarn = 0;
  9388. this.beginInlineImagePos = -1;
  9389. }
  9390. nextChar() {
  9391. return this.currentChar = this.stream.getByte();
  9392. }
  9393. peekChar() {
  9394. return this.stream.peekByte();
  9395. }
  9396. getNumber() {
  9397. let ch = this.currentChar;
  9398. let eNotation = false;
  9399. let divideBy = 0;
  9400. let sign = 1;
  9401. if (ch === 0x2d) {
  9402. sign = -1;
  9403. ch = this.nextChar();
  9404. if (ch === 0x2d) {
  9405. ch = this.nextChar();
  9406. }
  9407. } else if (ch === 0x2b) {
  9408. ch = this.nextChar();
  9409. }
  9410. if (ch === 0x0a || ch === 0x0d) {
  9411. do {
  9412. ch = this.nextChar();
  9413. } while (ch === 0x0a || ch === 0x0d);
  9414. }
  9415. if (ch === 0x2e) {
  9416. divideBy = 10;
  9417. ch = this.nextChar();
  9418. }
  9419. if (ch < 0x30 || ch > 0x39) {
  9420. const msg = `Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`;
  9421. if (isWhiteSpace(ch) || ch === -1) {
  9422. info(`Lexer.getNumber - "${msg}".`);
  9423. return 0;
  9424. }
  9425. throw new FormatError(msg);
  9426. }
  9427. let baseValue = ch - 0x30;
  9428. let powerValue = 0;
  9429. let powerValueSign = 1;
  9430. while ((ch = this.nextChar()) >= 0) {
  9431. if (ch >= 0x30 && ch <= 0x39) {
  9432. const currentDigit = ch - 0x30;
  9433. if (eNotation) {
  9434. powerValue = powerValue * 10 + currentDigit;
  9435. } else {
  9436. if (divideBy !== 0) {
  9437. divideBy *= 10;
  9438. }
  9439. baseValue = baseValue * 10 + currentDigit;
  9440. }
  9441. } else if (ch === 0x2e) {
  9442. if (divideBy === 0) {
  9443. divideBy = 1;
  9444. } else {
  9445. break;
  9446. }
  9447. } else if (ch === 0x2d) {
  9448. warn("Badly formatted number: minus sign in the middle");
  9449. } else if (ch === 0x45 || ch === 0x65) {
  9450. ch = this.peekChar();
  9451. if (ch === 0x2b || ch === 0x2d) {
  9452. powerValueSign = ch === 0x2d ? -1 : 1;
  9453. this.nextChar();
  9454. } else if (ch < 0x30 || ch > 0x39) {
  9455. break;
  9456. }
  9457. eNotation = true;
  9458. } else {
  9459. break;
  9460. }
  9461. }
  9462. if (divideBy !== 0) {
  9463. baseValue /= divideBy;
  9464. }
  9465. if (eNotation) {
  9466. baseValue *= 10 ** (powerValueSign * powerValue);
  9467. }
  9468. return sign * baseValue;
  9469. }
  9470. getString() {
  9471. let numParen = 1;
  9472. let done = false;
  9473. const strBuf = this.strBuf;
  9474. strBuf.length = 0;
  9475. let ch = this.nextChar();
  9476. while (true) {
  9477. let charBuffered = false;
  9478. switch (ch | 0) {
  9479. case -1:
  9480. warn("Unterminated string");
  9481. done = true;
  9482. break;
  9483. case 0x28:
  9484. ++numParen;
  9485. strBuf.push("(");
  9486. break;
  9487. case 0x29:
  9488. if (--numParen === 0) {
  9489. this.nextChar();
  9490. done = true;
  9491. } else {
  9492. strBuf.push(")");
  9493. }
  9494. break;
  9495. case 0x5c:
  9496. ch = this.nextChar();
  9497. switch (ch) {
  9498. case -1:
  9499. warn("Unterminated string");
  9500. done = true;
  9501. break;
  9502. case 0x6e:
  9503. strBuf.push("\n");
  9504. break;
  9505. case 0x72:
  9506. strBuf.push("\r");
  9507. break;
  9508. case 0x74:
  9509. strBuf.push("\t");
  9510. break;
  9511. case 0x62:
  9512. strBuf.push("\b");
  9513. break;
  9514. case 0x66:
  9515. strBuf.push("\f");
  9516. break;
  9517. case 0x5c:
  9518. case 0x28:
  9519. case 0x29:
  9520. strBuf.push(String.fromCharCode(ch));
  9521. break;
  9522. case 0x30:
  9523. case 0x31:
  9524. case 0x32:
  9525. case 0x33:
  9526. case 0x34:
  9527. case 0x35:
  9528. case 0x36:
  9529. case 0x37:
  9530. let x = ch & 0x0f;
  9531. ch = this.nextChar();
  9532. charBuffered = true;
  9533. if (ch >= 0x30 && ch <= 0x37) {
  9534. x = (x << 3) + (ch & 0x0f);
  9535. ch = this.nextChar();
  9536. if (ch >= 0x30 && ch <= 0x37) {
  9537. charBuffered = false;
  9538. x = (x << 3) + (ch & 0x0f);
  9539. }
  9540. }
  9541. strBuf.push(String.fromCharCode(x));
  9542. break;
  9543. case 0x0d:
  9544. if (this.peekChar() === 0x0a) {
  9545. this.nextChar();
  9546. }
  9547. break;
  9548. case 0x0a:
  9549. break;
  9550. default:
  9551. strBuf.push(String.fromCharCode(ch));
  9552. break;
  9553. }
  9554. break;
  9555. default:
  9556. strBuf.push(String.fromCharCode(ch));
  9557. break;
  9558. }
  9559. if (done) {
  9560. break;
  9561. }
  9562. if (!charBuffered) {
  9563. ch = this.nextChar();
  9564. }
  9565. }
  9566. return strBuf.join("");
  9567. }
  9568. getName() {
  9569. let ch, previousCh;
  9570. const strBuf = this.strBuf;
  9571. strBuf.length = 0;
  9572. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  9573. if (ch === 0x23) {
  9574. ch = this.nextChar();
  9575. if (specialChars[ch]) {
  9576. warn("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  9577. strBuf.push("#");
  9578. break;
  9579. }
  9580. const x = toHexDigit(ch);
  9581. if (x !== -1) {
  9582. previousCh = ch;
  9583. ch = this.nextChar();
  9584. const x2 = toHexDigit(ch);
  9585. if (x2 === -1) {
  9586. warn(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  9587. strBuf.push("#", String.fromCharCode(previousCh));
  9588. if (specialChars[ch]) {
  9589. break;
  9590. }
  9591. strBuf.push(String.fromCharCode(ch));
  9592. continue;
  9593. }
  9594. strBuf.push(String.fromCharCode(x << 4 | x2));
  9595. } else {
  9596. strBuf.push("#", String.fromCharCode(ch));
  9597. }
  9598. } else {
  9599. strBuf.push(String.fromCharCode(ch));
  9600. }
  9601. }
  9602. if (strBuf.length > 127) {
  9603. warn(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  9604. }
  9605. return Name.get(strBuf.join(""));
  9606. }
  9607. _hexStringWarn(ch) {
  9608. const MAX_HEX_STRING_NUM_WARN = 5;
  9609. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  9610. warn("getHexString - ignoring additional invalid characters.");
  9611. return;
  9612. }
  9613. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  9614. return;
  9615. }
  9616. warn(`getHexString - ignoring invalid character: ${ch}`);
  9617. }
  9618. getHexString() {
  9619. const strBuf = this.strBuf;
  9620. strBuf.length = 0;
  9621. let ch = this.currentChar;
  9622. let firstDigit = -1,
  9623. digit = -1;
  9624. this._hexStringNumWarn = 0;
  9625. while (true) {
  9626. if (ch < 0) {
  9627. warn("Unterminated hex string");
  9628. break;
  9629. } else if (ch === 0x3e) {
  9630. this.nextChar();
  9631. break;
  9632. } else if (specialChars[ch] === 1) {
  9633. ch = this.nextChar();
  9634. continue;
  9635. } else {
  9636. digit = toHexDigit(ch);
  9637. if (digit === -1) {
  9638. this._hexStringWarn(ch);
  9639. } else if (firstDigit === -1) {
  9640. firstDigit = digit;
  9641. } else {
  9642. strBuf.push(String.fromCharCode(firstDigit << 4 | digit));
  9643. firstDigit = -1;
  9644. }
  9645. ch = this.nextChar();
  9646. }
  9647. }
  9648. if (firstDigit !== -1) {
  9649. strBuf.push(String.fromCharCode(firstDigit << 4));
  9650. }
  9651. return strBuf.join("");
  9652. }
  9653. getObj() {
  9654. let comment = false;
  9655. let ch = this.currentChar;
  9656. while (true) {
  9657. if (ch < 0) {
  9658. return EOF;
  9659. }
  9660. if (comment) {
  9661. if (ch === 0x0a || ch === 0x0d) {
  9662. comment = false;
  9663. }
  9664. } else if (ch === 0x25) {
  9665. comment = true;
  9666. } else if (specialChars[ch] !== 1) {
  9667. break;
  9668. }
  9669. ch = this.nextChar();
  9670. }
  9671. switch (ch | 0) {
  9672. case 0x30:
  9673. case 0x31:
  9674. case 0x32:
  9675. case 0x33:
  9676. case 0x34:
  9677. case 0x35:
  9678. case 0x36:
  9679. case 0x37:
  9680. case 0x38:
  9681. case 0x39:
  9682. case 0x2b:
  9683. case 0x2d:
  9684. case 0x2e:
  9685. return this.getNumber();
  9686. case 0x28:
  9687. return this.getString();
  9688. case 0x2f:
  9689. return this.getName();
  9690. case 0x5b:
  9691. this.nextChar();
  9692. return Cmd.get("[");
  9693. case 0x5d:
  9694. this.nextChar();
  9695. return Cmd.get("]");
  9696. case 0x3c:
  9697. ch = this.nextChar();
  9698. if (ch === 0x3c) {
  9699. this.nextChar();
  9700. return Cmd.get("<<");
  9701. }
  9702. return this.getHexString();
  9703. case 0x3e:
  9704. ch = this.nextChar();
  9705. if (ch === 0x3e) {
  9706. this.nextChar();
  9707. return Cmd.get(">>");
  9708. }
  9709. return Cmd.get(">");
  9710. case 0x7b:
  9711. this.nextChar();
  9712. return Cmd.get("{");
  9713. case 0x7d:
  9714. this.nextChar();
  9715. return Cmd.get("}");
  9716. case 0x29:
  9717. this.nextChar();
  9718. throw new FormatError(`Illegal character: ${ch}`);
  9719. }
  9720. let str = String.fromCharCode(ch);
  9721. if (ch < 0x20 || ch > 0x7f) {
  9722. const nextCh = this.peekChar();
  9723. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  9724. this.nextChar();
  9725. return Cmd.get(str);
  9726. }
  9727. }
  9728. const knownCommands = this.knownCommands;
  9729. let knownCommandFound = knownCommands?.[str] !== undefined;
  9730. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  9731. const possibleCommand = str + String.fromCharCode(ch);
  9732. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  9733. break;
  9734. }
  9735. if (str.length === 128) {
  9736. throw new FormatError(`Command token too long: ${str.length}`);
  9737. }
  9738. str = possibleCommand;
  9739. knownCommandFound = knownCommands?.[str] !== undefined;
  9740. }
  9741. if (str === "true") {
  9742. return true;
  9743. }
  9744. if (str === "false") {
  9745. return false;
  9746. }
  9747. if (str === "null") {
  9748. return null;
  9749. }
  9750. if (str === "BI") {
  9751. this.beginInlineImagePos = this.stream.pos;
  9752. }
  9753. return Cmd.get(str);
  9754. }
  9755. skipToNextLine() {
  9756. let ch = this.currentChar;
  9757. while (ch >= 0) {
  9758. if (ch === 0x0d) {
  9759. ch = this.nextChar();
  9760. if (ch === 0x0a) {
  9761. this.nextChar();
  9762. }
  9763. break;
  9764. } else if (ch === 0x0a) {
  9765. this.nextChar();
  9766. break;
  9767. }
  9768. ch = this.nextChar();
  9769. }
  9770. }
  9771. }
  9772. class Linearization {
  9773. static create(stream) {
  9774. function getInt(linDict, name, allowZeroValue = false) {
  9775. const obj = linDict.get(name);
  9776. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  9777. return obj;
  9778. }
  9779. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  9780. }
  9781. function getHints(linDict) {
  9782. const hints = linDict.get("H");
  9783. let hintsLength;
  9784. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  9785. for (let index = 0; index < hintsLength; index++) {
  9786. const hint = hints[index];
  9787. if (!(Number.isInteger(hint) && hint > 0)) {
  9788. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  9789. }
  9790. }
  9791. return hints;
  9792. }
  9793. throw new Error("Hint array in the linearization dictionary is invalid.");
  9794. }
  9795. const parser = new Parser({
  9796. lexer: new Lexer(stream),
  9797. xref: null
  9798. });
  9799. const obj1 = parser.getObj();
  9800. const obj2 = parser.getObj();
  9801. const obj3 = parser.getObj();
  9802. const linDict = parser.getObj();
  9803. let obj, length;
  9804. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && isCmd(obj3, "obj") && linDict instanceof Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  9805. return null;
  9806. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  9807. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  9808. }
  9809. return {
  9810. length,
  9811. hints: getHints(linDict),
  9812. objectNumberFirst: getInt(linDict, "O"),
  9813. endFirst: getInt(linDict, "E"),
  9814. numPages: getInt(linDict, "N"),
  9815. mainXRefEntriesOffset: getInt(linDict, "T"),
  9816. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  9817. };
  9818. }
  9819. }
  9820. ;// ./src/core/cmap.js
  9821. const BUILT_IN_CMAPS = ["Adobe-GB1-UCS2", "Adobe-CNS1-UCS2", "Adobe-Japan1-UCS2", "Adobe-Korea1-UCS2", "78-EUC-H", "78-EUC-V", "78-H", "78-RKSJ-H", "78-RKSJ-V", "78-V", "78ms-RKSJ-H", "78ms-RKSJ-V", "83pv-RKSJ-H", "90ms-RKSJ-H", "90ms-RKSJ-V", "90msp-RKSJ-H", "90msp-RKSJ-V", "90pv-RKSJ-H", "90pv-RKSJ-V", "Add-H", "Add-RKSJ-H", "Add-RKSJ-V", "Add-V", "Adobe-CNS1-0", "Adobe-CNS1-1", "Adobe-CNS1-2", "Adobe-CNS1-3", "Adobe-CNS1-4", "Adobe-CNS1-5", "Adobe-CNS1-6", "Adobe-GB1-0", "Adobe-GB1-1", "Adobe-GB1-2", "Adobe-GB1-3", "Adobe-GB1-4", "Adobe-GB1-5", "Adobe-Japan1-0", "Adobe-Japan1-1", "Adobe-Japan1-2", "Adobe-Japan1-3", "Adobe-Japan1-4", "Adobe-Japan1-5", "Adobe-Japan1-6", "Adobe-Korea1-0", "Adobe-Korea1-1", "Adobe-Korea1-2", "B5-H", "B5-V", "B5pc-H", "B5pc-V", "CNS-EUC-H", "CNS-EUC-V", "CNS1-H", "CNS1-V", "CNS2-H", "CNS2-V", "ETHK-B5-H", "ETHK-B5-V", "ETen-B5-H", "ETen-B5-V", "ETenms-B5-H", "ETenms-B5-V", "EUC-H", "EUC-V", "Ext-H", "Ext-RKSJ-H", "Ext-RKSJ-V", "Ext-V", "GB-EUC-H", "GB-EUC-V", "GB-H", "GB-V", "GBK-EUC-H", "GBK-EUC-V", "GBK2K-H", "GBK2K-V", "GBKp-EUC-H", "GBKp-EUC-V", "GBT-EUC-H", "GBT-EUC-V", "GBT-H", "GBT-V", "GBTpc-EUC-H", "GBTpc-EUC-V", "GBpc-EUC-H", "GBpc-EUC-V", "H", "HKdla-B5-H", "HKdla-B5-V", "HKdlb-B5-H", "HKdlb-B5-V", "HKgccs-B5-H", "HKgccs-B5-V", "HKm314-B5-H", "HKm314-B5-V", "HKm471-B5-H", "HKm471-B5-V", "HKscs-B5-H", "HKscs-B5-V", "Hankaku", "Hiragana", "KSC-EUC-H", "KSC-EUC-V", "KSC-H", "KSC-Johab-H", "KSC-Johab-V", "KSC-V", "KSCms-UHC-H", "KSCms-UHC-HW-H", "KSCms-UHC-HW-V", "KSCms-UHC-V", "KSCpc-EUC-H", "KSCpc-EUC-V", "Katakana", "NWP-H", "NWP-V", "RKSJ-H", "RKSJ-V", "Roman", "UniCNS-UCS2-H", "UniCNS-UCS2-V", "UniCNS-UTF16-H", "UniCNS-UTF16-V", "UniCNS-UTF32-H", "UniCNS-UTF32-V", "UniCNS-UTF8-H", "UniCNS-UTF8-V", "UniGB-UCS2-H", "UniGB-UCS2-V", "UniGB-UTF16-H", "UniGB-UTF16-V", "UniGB-UTF32-H", "UniGB-UTF32-V", "UniGB-UTF8-H", "UniGB-UTF8-V", "UniJIS-UCS2-H", "UniJIS-UCS2-HW-H", "UniJIS-UCS2-HW-V", "UniJIS-UCS2-V", "UniJIS-UTF16-H", "UniJIS-UTF16-V", "UniJIS-UTF32-H", "UniJIS-UTF32-V", "UniJIS-UTF8-H", "UniJIS-UTF8-V", "UniJIS2004-UTF16-H", "UniJIS2004-UTF16-V", "UniJIS2004-UTF32-H", "UniJIS2004-UTF32-V", "UniJIS2004-UTF8-H", "UniJIS2004-UTF8-V", "UniJISPro-UCS2-HW-V", "UniJISPro-UCS2-V", "UniJISPro-UTF8-V", "UniJISX0213-UTF32-H", "UniJISX0213-UTF32-V", "UniJISX02132004-UTF32-H", "UniJISX02132004-UTF32-V", "UniKS-UCS2-H", "UniKS-UCS2-V", "UniKS-UTF16-H", "UniKS-UTF16-V", "UniKS-UTF32-H", "UniKS-UTF32-V", "UniKS-UTF8-H", "UniKS-UTF8-V", "V", "WP-Symbol"];
  9822. const MAX_MAP_RANGE = 2 ** 24 - 1;
  9823. class CMap {
  9824. constructor(builtInCMap = false) {
  9825. this.codespaceRanges = [[], [], [], []];
  9826. this.numCodespaceRanges = 0;
  9827. this._map = [];
  9828. this.name = "";
  9829. this.vertical = false;
  9830. this.useCMap = null;
  9831. this.builtInCMap = builtInCMap;
  9832. }
  9833. addCodespaceRange(n, low, high) {
  9834. this.codespaceRanges[n - 1].push(low, high);
  9835. this.numCodespaceRanges++;
  9836. }
  9837. mapCidRange(low, high, dstLow) {
  9838. if (high - low > MAX_MAP_RANGE) {
  9839. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  9840. }
  9841. while (low <= high) {
  9842. this._map[low++] = dstLow++;
  9843. }
  9844. }
  9845. mapBfRange(low, high, dstLow) {
  9846. if (high - low > MAX_MAP_RANGE) {
  9847. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  9848. }
  9849. const lastByte = dstLow.length - 1;
  9850. while (low <= high) {
  9851. this._map[low++] = dstLow;
  9852. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  9853. if (nextCharCode > 0xff) {
  9854. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  9855. continue;
  9856. }
  9857. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  9858. }
  9859. }
  9860. mapBfRangeToArray(low, high, array) {
  9861. if (high - low > MAX_MAP_RANGE) {
  9862. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  9863. }
  9864. const ii = array.length;
  9865. let i = 0;
  9866. while (low <= high && i < ii) {
  9867. this._map[low] = array[i++];
  9868. ++low;
  9869. }
  9870. }
  9871. mapOne(src, dst) {
  9872. this._map[src] = dst;
  9873. }
  9874. lookup(code) {
  9875. return this._map[code];
  9876. }
  9877. contains(code) {
  9878. return this._map[code] !== undefined;
  9879. }
  9880. forEach(callback) {
  9881. const map = this._map;
  9882. const length = map.length;
  9883. if (length <= 0x10000) {
  9884. for (let i = 0; i < length; i++) {
  9885. if (map[i] !== undefined) {
  9886. callback(i, map[i]);
  9887. }
  9888. }
  9889. } else {
  9890. for (const i in map) {
  9891. callback(i, map[i]);
  9892. }
  9893. }
  9894. }
  9895. charCodeOf(value) {
  9896. const map = this._map;
  9897. if (map.length <= 0x10000) {
  9898. return map.indexOf(value);
  9899. }
  9900. for (const charCode in map) {
  9901. if (map[charCode] === value) {
  9902. return charCode | 0;
  9903. }
  9904. }
  9905. return -1;
  9906. }
  9907. getMap() {
  9908. return this._map;
  9909. }
  9910. readCharCode(str, offset, out) {
  9911. let c = 0;
  9912. const codespaceRanges = this.codespaceRanges;
  9913. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  9914. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  9915. const codespaceRange = codespaceRanges[n];
  9916. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  9917. const low = codespaceRange[k++];
  9918. const high = codespaceRange[k++];
  9919. if (c >= low && c <= high) {
  9920. out.charcode = c;
  9921. out.length = n + 1;
  9922. return;
  9923. }
  9924. }
  9925. }
  9926. out.charcode = 0;
  9927. out.length = 1;
  9928. }
  9929. getCharCodeLength(charCode) {
  9930. const codespaceRanges = this.codespaceRanges;
  9931. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  9932. const codespaceRange = codespaceRanges[n];
  9933. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  9934. const low = codespaceRange[k++];
  9935. const high = codespaceRange[k++];
  9936. if (charCode >= low && charCode <= high) {
  9937. return n + 1;
  9938. }
  9939. }
  9940. }
  9941. return 1;
  9942. }
  9943. get length() {
  9944. return this._map.length;
  9945. }
  9946. get isIdentityCMap() {
  9947. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  9948. return false;
  9949. }
  9950. if (this._map.length !== 0x10000) {
  9951. return false;
  9952. }
  9953. for (let i = 0; i < 0x10000; i++) {
  9954. if (this._map[i] !== i) {
  9955. return false;
  9956. }
  9957. }
  9958. return true;
  9959. }
  9960. }
  9961. class IdentityCMap extends CMap {
  9962. constructor(vertical, n) {
  9963. super();
  9964. this.vertical = vertical;
  9965. this.addCodespaceRange(n, 0, 0xffff);
  9966. }
  9967. mapCidRange(low, high, dstLow) {
  9968. unreachable("should not call mapCidRange");
  9969. }
  9970. mapBfRange(low, high, dstLow) {
  9971. unreachable("should not call mapBfRange");
  9972. }
  9973. mapBfRangeToArray(low, high, array) {
  9974. unreachable("should not call mapBfRangeToArray");
  9975. }
  9976. mapOne(src, dst) {
  9977. unreachable("should not call mapCidOne");
  9978. }
  9979. lookup(code) {
  9980. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  9981. }
  9982. contains(code) {
  9983. return Number.isInteger(code) && code <= 0xffff;
  9984. }
  9985. forEach(callback) {
  9986. for (let i = 0; i <= 0xffff; i++) {
  9987. callback(i, i);
  9988. }
  9989. }
  9990. charCodeOf(value) {
  9991. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  9992. }
  9993. getMap() {
  9994. const map = new Array(0x10000);
  9995. for (let i = 0; i <= 0xffff; i++) {
  9996. map[i] = i;
  9997. }
  9998. return map;
  9999. }
  10000. get length() {
  10001. return 0x10000;
  10002. }
  10003. get isIdentityCMap() {
  10004. unreachable("should not access .isIdentityCMap");
  10005. }
  10006. }
  10007. function strToInt(str) {
  10008. let a = 0;
  10009. for (let i = 0; i < str.length; i++) {
  10010. a = a << 8 | str.charCodeAt(i);
  10011. }
  10012. return a >>> 0;
  10013. }
  10014. function expectString(obj) {
  10015. if (typeof obj !== "string") {
  10016. throw new FormatError("Malformed CMap: expected string.");
  10017. }
  10018. }
  10019. function expectInt(obj) {
  10020. if (!Number.isInteger(obj)) {
  10021. throw new FormatError("Malformed CMap: expected int.");
  10022. }
  10023. }
  10024. function parseBfChar(cMap, lexer) {
  10025. while (true) {
  10026. let obj = lexer.getObj();
  10027. if (obj === EOF) {
  10028. break;
  10029. }
  10030. if (isCmd(obj, "endbfchar")) {
  10031. return;
  10032. }
  10033. expectString(obj);
  10034. const src = strToInt(obj);
  10035. obj = lexer.getObj();
  10036. expectString(obj);
  10037. const dst = obj;
  10038. cMap.mapOne(src, dst);
  10039. }
  10040. }
  10041. function parseBfRange(cMap, lexer) {
  10042. while (true) {
  10043. let obj = lexer.getObj();
  10044. if (obj === EOF) {
  10045. break;
  10046. }
  10047. if (isCmd(obj, "endbfrange")) {
  10048. return;
  10049. }
  10050. expectString(obj);
  10051. const low = strToInt(obj);
  10052. obj = lexer.getObj();
  10053. expectString(obj);
  10054. const high = strToInt(obj);
  10055. obj = lexer.getObj();
  10056. if (Number.isInteger(obj) || typeof obj === "string") {
  10057. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  10058. cMap.mapBfRange(low, high, dstLow);
  10059. } else if (isCmd(obj, "[")) {
  10060. obj = lexer.getObj();
  10061. const array = [];
  10062. while (!isCmd(obj, "]") && obj !== EOF) {
  10063. array.push(obj);
  10064. obj = lexer.getObj();
  10065. }
  10066. cMap.mapBfRangeToArray(low, high, array);
  10067. } else {
  10068. break;
  10069. }
  10070. }
  10071. throw new FormatError("Invalid bf range.");
  10072. }
  10073. function parseCidChar(cMap, lexer) {
  10074. while (true) {
  10075. let obj = lexer.getObj();
  10076. if (obj === EOF) {
  10077. break;
  10078. }
  10079. if (isCmd(obj, "endcidchar")) {
  10080. return;
  10081. }
  10082. expectString(obj);
  10083. const src = strToInt(obj);
  10084. obj = lexer.getObj();
  10085. expectInt(obj);
  10086. const dst = obj;
  10087. cMap.mapOne(src, dst);
  10088. }
  10089. }
  10090. function parseCidRange(cMap, lexer) {
  10091. while (true) {
  10092. let obj = lexer.getObj();
  10093. if (obj === EOF) {
  10094. break;
  10095. }
  10096. if (isCmd(obj, "endcidrange")) {
  10097. return;
  10098. }
  10099. expectString(obj);
  10100. const low = strToInt(obj);
  10101. obj = lexer.getObj();
  10102. expectString(obj);
  10103. const high = strToInt(obj);
  10104. obj = lexer.getObj();
  10105. expectInt(obj);
  10106. const dstLow = obj;
  10107. cMap.mapCidRange(low, high, dstLow);
  10108. }
  10109. }
  10110. function parseCodespaceRange(cMap, lexer) {
  10111. while (true) {
  10112. let obj = lexer.getObj();
  10113. if (obj === EOF) {
  10114. break;
  10115. }
  10116. if (isCmd(obj, "endcodespacerange")) {
  10117. return;
  10118. }
  10119. if (typeof obj !== "string") {
  10120. break;
  10121. }
  10122. const low = strToInt(obj);
  10123. obj = lexer.getObj();
  10124. if (typeof obj !== "string") {
  10125. break;
  10126. }
  10127. const high = strToInt(obj);
  10128. cMap.addCodespaceRange(obj.length, low, high);
  10129. }
  10130. throw new FormatError("Invalid codespace range.");
  10131. }
  10132. function parseWMode(cMap, lexer) {
  10133. const obj = lexer.getObj();
  10134. if (Number.isInteger(obj)) {
  10135. cMap.vertical = !!obj;
  10136. }
  10137. }
  10138. function parseCMapName(cMap, lexer) {
  10139. const obj = lexer.getObj();
  10140. if (obj instanceof Name) {
  10141. cMap.name = obj.name;
  10142. }
  10143. }
  10144. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  10145. let previous, embeddedUseCMap;
  10146. objLoop: while (true) {
  10147. try {
  10148. const obj = lexer.getObj();
  10149. if (obj === EOF) {
  10150. break;
  10151. } else if (obj instanceof Name) {
  10152. if (obj.name === "WMode") {
  10153. parseWMode(cMap, lexer);
  10154. } else if (obj.name === "CMapName") {
  10155. parseCMapName(cMap, lexer);
  10156. }
  10157. previous = obj;
  10158. } else if (obj instanceof Cmd) {
  10159. switch (obj.cmd) {
  10160. case "endcmap":
  10161. break objLoop;
  10162. case "usecmap":
  10163. if (previous instanceof Name) {
  10164. embeddedUseCMap = previous.name;
  10165. }
  10166. break;
  10167. case "begincodespacerange":
  10168. parseCodespaceRange(cMap, lexer);
  10169. break;
  10170. case "beginbfchar":
  10171. parseBfChar(cMap, lexer);
  10172. break;
  10173. case "begincidchar":
  10174. parseCidChar(cMap, lexer);
  10175. break;
  10176. case "beginbfrange":
  10177. parseBfRange(cMap, lexer);
  10178. break;
  10179. case "begincidrange":
  10180. parseCidRange(cMap, lexer);
  10181. break;
  10182. }
  10183. }
  10184. } catch (ex) {
  10185. if (ex instanceof MissingDataException) {
  10186. throw ex;
  10187. }
  10188. warn("Invalid cMap data: " + ex);
  10189. continue;
  10190. }
  10191. }
  10192. if (!useCMap && embeddedUseCMap) {
  10193. useCMap = embeddedUseCMap;
  10194. }
  10195. if (useCMap) {
  10196. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  10197. }
  10198. return cMap;
  10199. }
  10200. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  10201. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  10202. if (cMap.numCodespaceRanges === 0) {
  10203. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  10204. for (let i = 0; i < useCodespaceRanges.length; i++) {
  10205. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  10206. }
  10207. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  10208. }
  10209. cMap.useCMap.forEach(function (key, value) {
  10210. if (!cMap.contains(key)) {
  10211. cMap.mapOne(key, value);
  10212. }
  10213. });
  10214. return cMap;
  10215. }
  10216. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  10217. if (name === "Identity-H") {
  10218. return new IdentityCMap(false, 2);
  10219. } else if (name === "Identity-V") {
  10220. return new IdentityCMap(true, 2);
  10221. }
  10222. if (!BUILT_IN_CMAPS.includes(name)) {
  10223. throw new Error("Unknown CMap name: " + name);
  10224. }
  10225. if (!fetchBuiltInCMap) {
  10226. throw new Error("Built-in CMap parameters are not provided.");
  10227. }
  10228. const {
  10229. cMapData,
  10230. isCompressed
  10231. } = await fetchBuiltInCMap(name);
  10232. const cMap = new CMap(true);
  10233. if (isCompressed) {
  10234. return new BinaryCMapReader().process(cMapData, cMap, useCMap => extendCMap(cMap, fetchBuiltInCMap, useCMap));
  10235. }
  10236. const lexer = new Lexer(new Stream(cMapData));
  10237. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  10238. }
  10239. class CMapFactory {
  10240. static async create({
  10241. encoding,
  10242. fetchBuiltInCMap,
  10243. useCMap
  10244. }) {
  10245. if (encoding instanceof Name) {
  10246. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  10247. } else if (encoding instanceof BaseStream) {
  10248. const parsedCMap = await parseCMap(new CMap(), new Lexer(encoding), fetchBuiltInCMap, useCMap);
  10249. if (parsedCMap.isIdentityCMap) {
  10250. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  10251. }
  10252. return parsedCMap;
  10253. }
  10254. throw new Error("Encoding required.");
  10255. }
  10256. }
  10257. ;// ./src/core/charsets.js
  10258. const ISOAdobeCharset = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron"];
  10259. const ExpertCharset = [".notdef", "space", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  10260. const ExpertSubsetCharset = [".notdef", "space", "dollaroldstyle", "dollarsuperior", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "hyphensuperior", "colonmonetary", "onefitted", "rupiah", "centoldstyle", "figuredash", "hypheninferior", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior"];
  10261. ;// ./src/core/encodings.js
  10262. const ExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "", "", "", "isuperior", "", "", "lsuperior", "msuperior", "nsuperior", "osuperior", "", "", "rsuperior", "ssuperior", "tsuperior", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdownsmall", "centoldstyle", "Lslashsmall", "", "", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "", "Dotaccentsmall", "", "", "Macronsmall", "", "", "figuredash", "hypheninferior", "", "", "Ogoneksmall", "Ringsmall", "Cedillasmall", "", "", "", "onequarter", "onehalf", "threequarters", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "zerosuperior", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall"];
  10263. const MacExpertEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclamsmall", "Hungarumlautsmall", "centoldstyle", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "comma", "hyphen", "period", "fraction", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "colon", "semicolon", "", "threequartersemdash", "", "questionsmall", "", "", "", "", "Ethsmall", "", "", "onequarter", "onehalf", "threequarters", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "", "", "", "", "", "", "ff", "fi", "fl", "ffi", "ffl", "parenleftinferior", "", "parenrightinferior", "Circumflexsmall", "hypheninferior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "", "", "asuperior", "centsuperior", "", "", "", "", "Aacutesmall", "Agravesmall", "Acircumflexsmall", "Adieresissmall", "Atildesmall", "Aringsmall", "Ccedillasmall", "Eacutesmall", "Egravesmall", "Ecircumflexsmall", "Edieresissmall", "Iacutesmall", "Igravesmall", "Icircumflexsmall", "Idieresissmall", "Ntildesmall", "Oacutesmall", "Ogravesmall", "Ocircumflexsmall", "Odieresissmall", "Otildesmall", "Uacutesmall", "Ugravesmall", "Ucircumflexsmall", "Udieresissmall", "", "eightsuperior", "fourinferior", "threeinferior", "sixinferior", "eightinferior", "seveninferior", "Scaronsmall", "", "centinferior", "twoinferior", "", "Dieresissmall", "", "Caronsmall", "osuperior", "fiveinferior", "", "commainferior", "periodinferior", "Yacutesmall", "", "dollarinferior", "", "", "Thornsmall", "", "nineinferior", "zeroinferior", "Zcaronsmall", "AEsmall", "Oslashsmall", "questiondownsmall", "oneinferior", "Lslashsmall", "", "", "", "", "", "", "Cedillasmall", "", "", "", "", "", "OEsmall", "figuredash", "hyphensuperior", "", "", "", "", "exclamdownsmall", "", "Ydieresissmall", "", "onesuperior", "twosuperior", "threesuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "ninesuperior", "zerosuperior", "", "esuperior", "rsuperior", "tsuperior", "", "", "isuperior", "ssuperior", "dsuperior", "", "", "", "", "", "lsuperior", "Ogoneksmall", "Brevesmall", "Macronsmall", "bsuperior", "nsuperior", "msuperior", "commasuperior", "periodsuperior", "Dotaccentsmall", "Ringsmall", "", "", "", ""];
  10264. const MacRomanEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "space", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron"];
  10265. const StandardEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "", "endash", "dagger", "daggerdbl", "periodcentered", "", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "", "questiondown", "", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "", "ring", "cedilla", "", "hungarumlaut", "ogonek", "caron", "emdash", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "AE", "", "ordfeminine", "", "", "", "", "Lslash", "Oslash", "OE", "ordmasculine", "", "", "", "", "", "ae", "", "", "", "dotlessi", "", "", "lslash", "oslash", "oe", "germandbls", "", "", "", ""];
  10266. const WinAnsiEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "bullet", "Euro", "bullet", "quotesinglbase", "florin", "quotedblbase", "ellipsis", "dagger", "daggerdbl", "circumflex", "perthousand", "Scaron", "guilsinglleft", "OE", "bullet", "Zcaron", "bullet", "bullet", "quoteleft", "quoteright", "quotedblleft", "quotedblright", "bullet", "endash", "emdash", "tilde", "trademark", "scaron", "guilsinglright", "oe", "bullet", "zcaron", "Ydieresis", "space", "exclamdown", "cent", "sterling", "currency", "yen", "brokenbar", "section", "dieresis", "copyright", "ordfeminine", "guillemotleft", "logicalnot", "hyphen", "registered", "macron", "degree", "plusminus", "twosuperior", "threesuperior", "acute", "mu", "paragraph", "periodcentered", "cedilla", "onesuperior", "ordmasculine", "guillemotright", "onequarter", "onehalf", "threequarters", "questiondown", "Agrave", "Aacute", "Acircumflex", "Atilde", "Adieresis", "Aring", "AE", "Ccedilla", "Egrave", "Eacute", "Ecircumflex", "Edieresis", "Igrave", "Iacute", "Icircumflex", "Idieresis", "Eth", "Ntilde", "Ograve", "Oacute", "Ocircumflex", "Otilde", "Odieresis", "multiply", "Oslash", "Ugrave", "Uacute", "Ucircumflex", "Udieresis", "Yacute", "Thorn", "germandbls", "agrave", "aacute", "acircumflex", "atilde", "adieresis", "aring", "ae", "ccedilla", "egrave", "eacute", "ecircumflex", "edieresis", "igrave", "iacute", "icircumflex", "idieresis", "eth", "ntilde", "ograve", "oacute", "ocircumflex", "otilde", "odieresis", "divide", "oslash", "ugrave", "uacute", "ucircumflex", "udieresis", "yacute", "thorn", "ydieresis"];
  10267. const SymbolSetEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "exclam", "universal", "numbersign", "existential", "percent", "ampersand", "suchthat", "parenleft", "parenright", "asteriskmath", "plus", "comma", "minus", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "congruent", "Alpha", "Beta", "Chi", "Delta", "Epsilon", "Phi", "Gamma", "Eta", "Iota", "theta1", "Kappa", "Lambda", "Mu", "Nu", "Omicron", "Pi", "Theta", "Rho", "Sigma", "Tau", "Upsilon", "sigma1", "Omega", "Xi", "Psi", "Zeta", "bracketleft", "therefore", "bracketright", "perpendicular", "underscore", "radicalex", "alpha", "beta", "chi", "delta", "epsilon", "phi", "gamma", "eta", "iota", "phi1", "kappa", "lambda", "mu", "nu", "omicron", "pi", "theta", "rho", "sigma", "tau", "upsilon", "omega1", "omega", "xi", "psi", "zeta", "braceleft", "bar", "braceright", "similar", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "Euro", "Upsilon1", "minute", "lessequal", "fraction", "infinity", "florin", "club", "diamond", "heart", "spade", "arrowboth", "arrowleft", "arrowup", "arrowright", "arrowdown", "degree", "plusminus", "second", "greaterequal", "multiply", "proportional", "partialdiff", "bullet", "divide", "notequal", "equivalence", "approxequal", "ellipsis", "arrowvertex", "arrowhorizex", "carriagereturn", "aleph", "Ifraktur", "Rfraktur", "weierstrass", "circlemultiply", "circleplus", "emptyset", "intersection", "union", "propersuperset", "reflexsuperset", "notsubset", "propersubset", "reflexsubset", "element", "notelement", "angle", "gradient", "registerserif", "copyrightserif", "trademarkserif", "product", "radical", "dotmath", "logicalnot", "logicaland", "logicalor", "arrowdblboth", "arrowdblleft", "arrowdblup", "arrowdblright", "arrowdbldown", "lozenge", "angleleft", "registersans", "copyrightsans", "trademarksans", "summation", "parenlefttp", "parenleftex", "parenleftbt", "bracketlefttp", "bracketleftex", "bracketleftbt", "bracelefttp", "braceleftmid", "braceleftbt", "braceex", "", "angleright", "integral", "integraltp", "integralex", "integralbt", "parenrighttp", "parenrightex", "parenrightbt", "bracketrighttp", "bracketrightex", "bracketrightbt", "bracerighttp", "bracerightmid", "bracerightbt", ""];
  10268. const ZapfDingbatsEncoding = ["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "space", "a1", "a2", "a202", "a3", "a4", "a5", "a119", "a118", "a117", "a11", "a12", "a13", "a14", "a15", "a16", "a105", "a17", "a18", "a19", "a20", "a21", "a22", "a23", "a24", "a25", "a26", "a27", "a28", "a6", "a7", "a8", "a9", "a10", "a29", "a30", "a31", "a32", "a33", "a34", "a35", "a36", "a37", "a38", "a39", "a40", "a41", "a42", "a43", "a44", "a45", "a46", "a47", "a48", "a49", "a50", "a51", "a52", "a53", "a54", "a55", "a56", "a57", "a58", "a59", "a60", "a61", "a62", "a63", "a64", "a65", "a66", "a67", "a68", "a69", "a70", "a71", "a72", "a73", "a74", "a203", "a75", "a204", "a76", "a77", "a78", "a79", "a81", "a82", "a83", "a84", "a97", "a98", "a99", "a100", "", "a89", "a90", "a93", "a94", "a91", "a92", "a205", "a85", "a206", "a86", "a87", "a88", "a95", "a96", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "a101", "a102", "a103", "a104", "a106", "a107", "a108", "a112", "a111", "a110", "a109", "a120", "a121", "a122", "a123", "a124", "a125", "a126", "a127", "a128", "a129", "a130", "a131", "a132", "a133", "a134", "a135", "a136", "a137", "a138", "a139", "a140", "a141", "a142", "a143", "a144", "a145", "a146", "a147", "a148", "a149", "a150", "a151", "a152", "a153", "a154", "a155", "a156", "a157", "a158", "a159", "a160", "a161", "a163", "a164", "a196", "a165", "a192", "a166", "a167", "a168", "a169", "a170", "a171", "a172", "a173", "a162", "a174", "a175", "a176", "a177", "a178", "a179", "a193", "a180", "a199", "a181", "a200", "a182", "", "a201", "a183", "a184", "a197", "a185", "a194", "a198", "a186", "a195", "a187", "a188", "a189", "a190", "a191", ""];
  10269. function getEncoding(encodingName) {
  10270. switch (encodingName) {
  10271. case "WinAnsiEncoding":
  10272. return WinAnsiEncoding;
  10273. case "StandardEncoding":
  10274. return StandardEncoding;
  10275. case "MacRomanEncoding":
  10276. return MacRomanEncoding;
  10277. case "SymbolSetEncoding":
  10278. return SymbolSetEncoding;
  10279. case "ZapfDingbatsEncoding":
  10280. return ZapfDingbatsEncoding;
  10281. case "ExpertEncoding":
  10282. return ExpertEncoding;
  10283. case "MacExpertEncoding":
  10284. return MacExpertEncoding;
  10285. default:
  10286. return null;
  10287. }
  10288. }
  10289. ;// ./src/core/cff_parser.js
  10290. const MAX_SUBR_NESTING = 10;
  10291. const CFFStandardStrings = [".notdef", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quoteright", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "quoteleft", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "exclamdown", "cent", "sterling", "fraction", "yen", "florin", "section", "currency", "quotesingle", "quotedblleft", "guillemotleft", "guilsinglleft", "guilsinglright", "fi", "fl", "endash", "dagger", "daggerdbl", "periodcentered", "paragraph", "bullet", "quotesinglbase", "quotedblbase", "quotedblright", "guillemotright", "ellipsis", "perthousand", "questiondown", "grave", "acute", "circumflex", "tilde", "macron", "breve", "dotaccent", "dieresis", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "emdash", "AE", "ordfeminine", "Lslash", "Oslash", "OE", "ordmasculine", "ae", "dotlessi", "lslash", "oslash", "oe", "germandbls", "onesuperior", "logicalnot", "mu", "trademark", "Eth", "onehalf", "plusminus", "Thorn", "onequarter", "divide", "brokenbar", "degree", "thorn", "threequarters", "twosuperior", "registered", "minus", "eth", "multiply", "threesuperior", "copyright", "Aacute", "Acircumflex", "Adieresis", "Agrave", "Aring", "Atilde", "Ccedilla", "Eacute", "Ecircumflex", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Ntilde", "Oacute", "Ocircumflex", "Odieresis", "Ograve", "Otilde", "Scaron", "Uacute", "Ucircumflex", "Udieresis", "Ugrave", "Yacute", "Ydieresis", "Zcaron", "aacute", "acircumflex", "adieresis", "agrave", "aring", "atilde", "ccedilla", "eacute", "ecircumflex", "edieresis", "egrave", "iacute", "icircumflex", "idieresis", "igrave", "ntilde", "oacute", "ocircumflex", "odieresis", "ograve", "otilde", "scaron", "uacute", "ucircumflex", "udieresis", "ugrave", "yacute", "ydieresis", "zcaron", "exclamsmall", "Hungarumlautsmall", "dollaroldstyle", "dollarsuperior", "ampersandsmall", "Acutesmall", "parenleftsuperior", "parenrightsuperior", "twodotenleader", "onedotenleader", "zerooldstyle", "oneoldstyle", "twooldstyle", "threeoldstyle", "fouroldstyle", "fiveoldstyle", "sixoldstyle", "sevenoldstyle", "eightoldstyle", "nineoldstyle", "commasuperior", "threequartersemdash", "periodsuperior", "questionsmall", "asuperior", "bsuperior", "centsuperior", "dsuperior", "esuperior", "isuperior", "lsuperior", "msuperior", "nsuperior", "osuperior", "rsuperior", "ssuperior", "tsuperior", "ff", "ffi", "ffl", "parenleftinferior", "parenrightinferior", "Circumflexsmall", "hyphensuperior", "Gravesmall", "Asmall", "Bsmall", "Csmall", "Dsmall", "Esmall", "Fsmall", "Gsmall", "Hsmall", "Ismall", "Jsmall", "Ksmall", "Lsmall", "Msmall", "Nsmall", "Osmall", "Psmall", "Qsmall", "Rsmall", "Ssmall", "Tsmall", "Usmall", "Vsmall", "Wsmall", "Xsmall", "Ysmall", "Zsmall", "colonmonetary", "onefitted", "rupiah", "Tildesmall", "exclamdownsmall", "centoldstyle", "Lslashsmall", "Scaronsmall", "Zcaronsmall", "Dieresissmall", "Brevesmall", "Caronsmall", "Dotaccentsmall", "Macronsmall", "figuredash", "hypheninferior", "Ogoneksmall", "Ringsmall", "Cedillasmall", "questiondownsmall", "oneeighth", "threeeighths", "fiveeighths", "seveneighths", "onethird", "twothirds", "zerosuperior", "foursuperior", "fivesuperior", "sixsuperior", "sevensuperior", "eightsuperior", "ninesuperior", "zeroinferior", "oneinferior", "twoinferior", "threeinferior", "fourinferior", "fiveinferior", "sixinferior", "seveninferior", "eightinferior", "nineinferior", "centinferior", "dollarinferior", "periodinferior", "commainferior", "Agravesmall", "Aacutesmall", "Acircumflexsmall", "Atildesmall", "Adieresissmall", "Aringsmall", "AEsmall", "Ccedillasmall", "Egravesmall", "Eacutesmall", "Ecircumflexsmall", "Edieresissmall", "Igravesmall", "Iacutesmall", "Icircumflexsmall", "Idieresissmall", "Ethsmall", "Ntildesmall", "Ogravesmall", "Oacutesmall", "Ocircumflexsmall", "Otildesmall", "Odieresissmall", "OEsmall", "Oslashsmall", "Ugravesmall", "Uacutesmall", "Ucircumflexsmall", "Udieresissmall", "Yacutesmall", "Thornsmall", "Ydieresissmall", "001.000", "001.001", "001.002", "001.003", "Black", "Bold", "Book", "Light", "Medium", "Regular", "Roman", "Semibold"];
  10292. const NUM_STANDARD_CFF_STRINGS = 391;
  10293. const CharstringValidationData = [null, {
  10294. id: "hstem",
  10295. min: 2,
  10296. stackClearing: true,
  10297. stem: true
  10298. }, null, {
  10299. id: "vstem",
  10300. min: 2,
  10301. stackClearing: true,
  10302. stem: true
  10303. }, {
  10304. id: "vmoveto",
  10305. min: 1,
  10306. stackClearing: true
  10307. }, {
  10308. id: "rlineto",
  10309. min: 2,
  10310. resetStack: true
  10311. }, {
  10312. id: "hlineto",
  10313. min: 1,
  10314. resetStack: true
  10315. }, {
  10316. id: "vlineto",
  10317. min: 1,
  10318. resetStack: true
  10319. }, {
  10320. id: "rrcurveto",
  10321. min: 6,
  10322. resetStack: true
  10323. }, null, {
  10324. id: "callsubr",
  10325. min: 1,
  10326. undefStack: true
  10327. }, {
  10328. id: "return",
  10329. min: 0,
  10330. undefStack: true
  10331. }, null, null, {
  10332. id: "endchar",
  10333. min: 0,
  10334. stackClearing: true
  10335. }, null, null, null, {
  10336. id: "hstemhm",
  10337. min: 2,
  10338. stackClearing: true,
  10339. stem: true
  10340. }, {
  10341. id: "hintmask",
  10342. min: 0,
  10343. stackClearing: true
  10344. }, {
  10345. id: "cntrmask",
  10346. min: 0,
  10347. stackClearing: true
  10348. }, {
  10349. id: "rmoveto",
  10350. min: 2,
  10351. stackClearing: true
  10352. }, {
  10353. id: "hmoveto",
  10354. min: 1,
  10355. stackClearing: true
  10356. }, {
  10357. id: "vstemhm",
  10358. min: 2,
  10359. stackClearing: true,
  10360. stem: true
  10361. }, {
  10362. id: "rcurveline",
  10363. min: 8,
  10364. resetStack: true
  10365. }, {
  10366. id: "rlinecurve",
  10367. min: 8,
  10368. resetStack: true
  10369. }, {
  10370. id: "vvcurveto",
  10371. min: 4,
  10372. resetStack: true
  10373. }, {
  10374. id: "hhcurveto",
  10375. min: 4,
  10376. resetStack: true
  10377. }, null, {
  10378. id: "callgsubr",
  10379. min: 1,
  10380. undefStack: true
  10381. }, {
  10382. id: "vhcurveto",
  10383. min: 4,
  10384. resetStack: true
  10385. }, {
  10386. id: "hvcurveto",
  10387. min: 4,
  10388. resetStack: true
  10389. }];
  10390. const CharstringValidationData12 = [null, null, null, {
  10391. id: "and",
  10392. min: 2,
  10393. stackDelta: -1
  10394. }, {
  10395. id: "or",
  10396. min: 2,
  10397. stackDelta: -1
  10398. }, {
  10399. id: "not",
  10400. min: 1,
  10401. stackDelta: 0
  10402. }, null, null, null, {
  10403. id: "abs",
  10404. min: 1,
  10405. stackDelta: 0
  10406. }, {
  10407. id: "add",
  10408. min: 2,
  10409. stackDelta: -1,
  10410. stackFn(stack, index) {
  10411. stack[index - 2] = stack[index - 2] + stack[index - 1];
  10412. }
  10413. }, {
  10414. id: "sub",
  10415. min: 2,
  10416. stackDelta: -1,
  10417. stackFn(stack, index) {
  10418. stack[index - 2] = stack[index - 2] - stack[index - 1];
  10419. }
  10420. }, {
  10421. id: "div",
  10422. min: 2,
  10423. stackDelta: -1,
  10424. stackFn(stack, index) {
  10425. stack[index - 2] = stack[index - 2] / stack[index - 1];
  10426. }
  10427. }, null, {
  10428. id: "neg",
  10429. min: 1,
  10430. stackDelta: 0,
  10431. stackFn(stack, index) {
  10432. stack[index - 1] = -stack[index - 1];
  10433. }
  10434. }, {
  10435. id: "eq",
  10436. min: 2,
  10437. stackDelta: -1
  10438. }, null, null, {
  10439. id: "drop",
  10440. min: 1,
  10441. stackDelta: -1
  10442. }, null, {
  10443. id: "put",
  10444. min: 2,
  10445. stackDelta: -2
  10446. }, {
  10447. id: "get",
  10448. min: 1,
  10449. stackDelta: 0
  10450. }, {
  10451. id: "ifelse",
  10452. min: 4,
  10453. stackDelta: -3
  10454. }, {
  10455. id: "random",
  10456. min: 0,
  10457. stackDelta: 1
  10458. }, {
  10459. id: "mul",
  10460. min: 2,
  10461. stackDelta: -1,
  10462. stackFn(stack, index) {
  10463. stack[index - 2] = stack[index - 2] * stack[index - 1];
  10464. }
  10465. }, null, {
  10466. id: "sqrt",
  10467. min: 1,
  10468. stackDelta: 0
  10469. }, {
  10470. id: "dup",
  10471. min: 1,
  10472. stackDelta: 1
  10473. }, {
  10474. id: "exch",
  10475. min: 2,
  10476. stackDelta: 0
  10477. }, {
  10478. id: "index",
  10479. min: 2,
  10480. stackDelta: 0
  10481. }, {
  10482. id: "roll",
  10483. min: 3,
  10484. stackDelta: -2
  10485. }, null, null, null, {
  10486. id: "hflex",
  10487. min: 7,
  10488. resetStack: true
  10489. }, {
  10490. id: "flex",
  10491. min: 13,
  10492. resetStack: true
  10493. }, {
  10494. id: "hflex1",
  10495. min: 9,
  10496. resetStack: true
  10497. }, {
  10498. id: "flex1",
  10499. min: 11,
  10500. resetStack: true
  10501. }];
  10502. class CFFParser {
  10503. constructor(file, properties, seacAnalysisEnabled) {
  10504. this.bytes = file.getBytes();
  10505. this.properties = properties;
  10506. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  10507. }
  10508. parse() {
  10509. const properties = this.properties;
  10510. const cff = new CFF();
  10511. this.cff = cff;
  10512. const header = this.parseHeader();
  10513. const nameIndex = this.parseIndex(header.endPos);
  10514. const topDictIndex = this.parseIndex(nameIndex.endPos);
  10515. const stringIndex = this.parseIndex(topDictIndex.endPos);
  10516. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  10517. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  10518. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  10519. cff.header = header.obj;
  10520. cff.names = this.parseNameIndex(nameIndex.obj);
  10521. cff.strings = this.parseStringIndex(stringIndex.obj);
  10522. cff.topDict = topDict;
  10523. cff.globalSubrIndex = globalSubrIndex.obj;
  10524. this.parsePrivateDict(cff.topDict);
  10525. cff.isCIDFont = topDict.hasName("ROS");
  10526. const charStringOffset = topDict.getByName("CharStrings");
  10527. const charStringIndex = this.parseIndex(charStringOffset).obj;
  10528. const fontMatrix = topDict.getByName("FontMatrix");
  10529. if (fontMatrix) {
  10530. properties.fontMatrix = fontMatrix;
  10531. }
  10532. const fontBBox = topDict.getByName("FontBBox");
  10533. if (fontBBox) {
  10534. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  10535. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  10536. properties.ascentScaled = true;
  10537. }
  10538. let charset, encoding;
  10539. if (cff.isCIDFont) {
  10540. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  10541. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  10542. const dictRaw = fdArrayIndex.get(i);
  10543. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  10544. this.parsePrivateDict(fontDict);
  10545. cff.fdArray.push(fontDict);
  10546. }
  10547. encoding = null;
  10548. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  10549. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  10550. } else {
  10551. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  10552. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  10553. }
  10554. cff.charset = charset;
  10555. cff.encoding = encoding;
  10556. const charStringsAndSeacs = this.parseCharStrings({
  10557. charStrings: charStringIndex,
  10558. localSubrIndex: topDict.privateDict.subrsIndex,
  10559. globalSubrIndex: globalSubrIndex.obj,
  10560. fdSelect: cff.fdSelect,
  10561. fdArray: cff.fdArray,
  10562. privateDict: topDict.privateDict
  10563. });
  10564. cff.charStrings = charStringsAndSeacs.charStrings;
  10565. cff.seacs = charStringsAndSeacs.seacs;
  10566. cff.widths = charStringsAndSeacs.widths;
  10567. return cff;
  10568. }
  10569. parseHeader() {
  10570. let bytes = this.bytes;
  10571. const bytesLength = bytes.length;
  10572. let offset = 0;
  10573. while (offset < bytesLength && bytes[offset] !== 1) {
  10574. ++offset;
  10575. }
  10576. if (offset >= bytesLength) {
  10577. throw new FormatError("Invalid CFF header");
  10578. }
  10579. if (offset !== 0) {
  10580. info("cff data is shifted");
  10581. bytes = bytes.subarray(offset);
  10582. this.bytes = bytes;
  10583. }
  10584. const major = bytes[0];
  10585. const minor = bytes[1];
  10586. const hdrSize = bytes[2];
  10587. const offSize = bytes[3];
  10588. const header = new CFFHeader(major, minor, hdrSize, offSize);
  10589. return {
  10590. obj: header,
  10591. endPos: hdrSize
  10592. };
  10593. }
  10594. parseDict(dict) {
  10595. let pos = 0;
  10596. function parseOperand() {
  10597. let value = dict[pos++];
  10598. if (value === 30) {
  10599. return parseFloatOperand();
  10600. } else if (value === 28) {
  10601. value = dict[pos++];
  10602. value = (value << 24 | dict[pos++] << 16) >> 16;
  10603. return value;
  10604. } else if (value === 29) {
  10605. value = dict[pos++];
  10606. value = value << 8 | dict[pos++];
  10607. value = value << 8 | dict[pos++];
  10608. value = value << 8 | dict[pos++];
  10609. return value;
  10610. } else if (value >= 32 && value <= 246) {
  10611. return value - 139;
  10612. } else if (value >= 247 && value <= 250) {
  10613. return (value - 247) * 256 + dict[pos++] + 108;
  10614. } else if (value >= 251 && value <= 254) {
  10615. return -((value - 251) * 256) - dict[pos++] - 108;
  10616. }
  10617. warn('CFFParser_parseDict: "' + value + '" is a reserved command.');
  10618. return NaN;
  10619. }
  10620. function parseFloatOperand() {
  10621. let str = "";
  10622. const eof = 15;
  10623. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  10624. const length = dict.length;
  10625. while (pos < length) {
  10626. const b = dict[pos++];
  10627. const b1 = b >> 4;
  10628. const b2 = b & 15;
  10629. if (b1 === eof) {
  10630. break;
  10631. }
  10632. str += lookup[b1];
  10633. if (b2 === eof) {
  10634. break;
  10635. }
  10636. str += lookup[b2];
  10637. }
  10638. return parseFloat(str);
  10639. }
  10640. let operands = [];
  10641. const entries = [];
  10642. pos = 0;
  10643. const end = dict.length;
  10644. while (pos < end) {
  10645. let b = dict[pos];
  10646. if (b <= 21) {
  10647. if (b === 12) {
  10648. b = b << 8 | dict[++pos];
  10649. }
  10650. entries.push([b, operands]);
  10651. operands = [];
  10652. ++pos;
  10653. } else {
  10654. operands.push(parseOperand());
  10655. }
  10656. }
  10657. return entries;
  10658. }
  10659. parseIndex(pos) {
  10660. const cffIndex = new CFFIndex();
  10661. const bytes = this.bytes;
  10662. const count = bytes[pos++] << 8 | bytes[pos++];
  10663. const offsets = [];
  10664. let end = pos;
  10665. let i, ii;
  10666. if (count !== 0) {
  10667. const offsetSize = bytes[pos++];
  10668. const startPos = pos + (count + 1) * offsetSize - 1;
  10669. for (i = 0, ii = count + 1; i < ii; ++i) {
  10670. let offset = 0;
  10671. for (let j = 0; j < offsetSize; ++j) {
  10672. offset <<= 8;
  10673. offset += bytes[pos++];
  10674. }
  10675. offsets.push(startPos + offset);
  10676. }
  10677. end = offsets[count];
  10678. }
  10679. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  10680. const offsetStart = offsets[i];
  10681. const offsetEnd = offsets[i + 1];
  10682. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  10683. }
  10684. return {
  10685. obj: cffIndex,
  10686. endPos: end
  10687. };
  10688. }
  10689. parseNameIndex(index) {
  10690. const names = [];
  10691. for (let i = 0, ii = index.count; i < ii; ++i) {
  10692. const name = index.get(i);
  10693. names.push(bytesToString(name));
  10694. }
  10695. return names;
  10696. }
  10697. parseStringIndex(index) {
  10698. const strings = new CFFStrings();
  10699. for (let i = 0, ii = index.count; i < ii; ++i) {
  10700. const data = index.get(i);
  10701. strings.add(bytesToString(data));
  10702. }
  10703. return strings;
  10704. }
  10705. createDict(Type, dict, strings) {
  10706. const cffDict = new Type(strings);
  10707. for (const [key, value] of dict) {
  10708. cffDict.setByKey(key, value);
  10709. }
  10710. return cffDict;
  10711. }
  10712. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  10713. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  10714. return false;
  10715. }
  10716. let stackSize = state.stackSize;
  10717. const stack = state.stack;
  10718. let length = data.length;
  10719. for (let j = 0; j < length;) {
  10720. const value = data[j++];
  10721. let validationCommand = null;
  10722. if (value === 12) {
  10723. const q = data[j++];
  10724. if (q === 0) {
  10725. data[j - 2] = 139;
  10726. data[j - 1] = 22;
  10727. stackSize = 0;
  10728. } else {
  10729. validationCommand = CharstringValidationData12[q];
  10730. }
  10731. } else if (value === 28) {
  10732. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  10733. j += 2;
  10734. stackSize++;
  10735. } else if (value === 14) {
  10736. if (stackSize >= 4) {
  10737. stackSize -= 4;
  10738. if (this.seacAnalysisEnabled) {
  10739. state.seac = stack.slice(stackSize, stackSize + 4);
  10740. return false;
  10741. }
  10742. }
  10743. validationCommand = CharstringValidationData[value];
  10744. } else if (value >= 32 && value <= 246) {
  10745. stack[stackSize] = value - 139;
  10746. stackSize++;
  10747. } else if (value >= 247 && value <= 254) {
  10748. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  10749. j++;
  10750. stackSize++;
  10751. } else if (value === 255) {
  10752. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  10753. j += 4;
  10754. stackSize++;
  10755. } else if (value === 19 || value === 20) {
  10756. state.hints += stackSize >> 1;
  10757. if (state.hints === 0) {
  10758. data.copyWithin(j - 1, j, -1);
  10759. j -= 1;
  10760. length -= 1;
  10761. continue;
  10762. }
  10763. j += state.hints + 7 >> 3;
  10764. stackSize %= 2;
  10765. validationCommand = CharstringValidationData[value];
  10766. } else if (value === 10 || value === 29) {
  10767. const subrsIndex = value === 10 ? localSubrIndex : globalSubrIndex;
  10768. if (!subrsIndex) {
  10769. validationCommand = CharstringValidationData[value];
  10770. warn("Missing subrsIndex for " + validationCommand.id);
  10771. return false;
  10772. }
  10773. let bias = 32768;
  10774. if (subrsIndex.count < 1240) {
  10775. bias = 107;
  10776. } else if (subrsIndex.count < 33900) {
  10777. bias = 1131;
  10778. }
  10779. const subrNumber = stack[--stackSize] + bias;
  10780. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  10781. validationCommand = CharstringValidationData[value];
  10782. warn("Out of bounds subrIndex for " + validationCommand.id);
  10783. return false;
  10784. }
  10785. state.stackSize = stackSize;
  10786. state.callDepth++;
  10787. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  10788. if (!valid) {
  10789. return false;
  10790. }
  10791. state.callDepth--;
  10792. stackSize = state.stackSize;
  10793. continue;
  10794. } else if (value === 11) {
  10795. state.stackSize = stackSize;
  10796. return true;
  10797. } else if (value === 0 && j === data.length) {
  10798. data[j - 1] = 14;
  10799. validationCommand = CharstringValidationData[14];
  10800. } else if (value === 9) {
  10801. data.copyWithin(j - 1, j, -1);
  10802. j -= 1;
  10803. length -= 1;
  10804. continue;
  10805. } else {
  10806. validationCommand = CharstringValidationData[value];
  10807. }
  10808. if (validationCommand) {
  10809. if (validationCommand.stem) {
  10810. state.hints += stackSize >> 1;
  10811. if (value === 3 || value === 23) {
  10812. state.hasVStems = true;
  10813. } else if (state.hasVStems && (value === 1 || value === 18)) {
  10814. warn("CFF stem hints are in wrong order");
  10815. data[j - 1] = value === 1 ? 3 : 23;
  10816. }
  10817. }
  10818. if ("min" in validationCommand) {
  10819. if (!state.undefStack && stackSize < validationCommand.min) {
  10820. warn("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  10821. if (stackSize === 0) {
  10822. data[j - 1] = 14;
  10823. return true;
  10824. }
  10825. return false;
  10826. }
  10827. }
  10828. if (state.firstStackClearing && validationCommand.stackClearing) {
  10829. state.firstStackClearing = false;
  10830. stackSize -= validationCommand.min;
  10831. if (stackSize >= 2 && validationCommand.stem) {
  10832. stackSize %= 2;
  10833. } else if (stackSize > 1) {
  10834. warn("Found too many parameters for stack-clearing command");
  10835. }
  10836. if (stackSize > 0) {
  10837. state.width = stack[stackSize - 1];
  10838. }
  10839. }
  10840. if ("stackDelta" in validationCommand) {
  10841. if ("stackFn" in validationCommand) {
  10842. validationCommand.stackFn(stack, stackSize);
  10843. }
  10844. stackSize += validationCommand.stackDelta;
  10845. } else if (validationCommand.stackClearing) {
  10846. stackSize = 0;
  10847. } else if (validationCommand.resetStack) {
  10848. stackSize = 0;
  10849. state.undefStack = false;
  10850. } else if (validationCommand.undefStack) {
  10851. stackSize = 0;
  10852. state.undefStack = true;
  10853. state.firstStackClearing = false;
  10854. }
  10855. }
  10856. }
  10857. if (length < data.length) {
  10858. data.fill(14, length);
  10859. }
  10860. state.stackSize = stackSize;
  10861. return true;
  10862. }
  10863. parseCharStrings({
  10864. charStrings,
  10865. localSubrIndex,
  10866. globalSubrIndex,
  10867. fdSelect,
  10868. fdArray,
  10869. privateDict
  10870. }) {
  10871. const seacs = [];
  10872. const widths = [];
  10873. const count = charStrings.count;
  10874. for (let i = 0; i < count; i++) {
  10875. const charstring = charStrings.get(i);
  10876. const state = {
  10877. callDepth: 0,
  10878. stackSize: 0,
  10879. stack: [],
  10880. undefStack: true,
  10881. hints: 0,
  10882. firstStackClearing: true,
  10883. seac: null,
  10884. width: null,
  10885. hasVStems: false
  10886. };
  10887. let valid = true;
  10888. let localSubrToUse = null;
  10889. let privateDictToUse = privateDict;
  10890. if (fdSelect && fdArray.length) {
  10891. const fdIndex = fdSelect.getFDIndex(i);
  10892. if (fdIndex === -1) {
  10893. warn("Glyph index is not in fd select.");
  10894. valid = false;
  10895. }
  10896. if (fdIndex >= fdArray.length) {
  10897. warn("Invalid fd index for glyph index.");
  10898. valid = false;
  10899. }
  10900. if (valid) {
  10901. privateDictToUse = fdArray[fdIndex].privateDict;
  10902. localSubrToUse = privateDictToUse.subrsIndex;
  10903. }
  10904. } else if (localSubrIndex) {
  10905. localSubrToUse = localSubrIndex;
  10906. }
  10907. if (valid) {
  10908. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  10909. }
  10910. if (state.width !== null) {
  10911. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  10912. widths[i] = nominalWidth + state.width;
  10913. } else {
  10914. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  10915. widths[i] = defaultWidth;
  10916. }
  10917. if (state.seac !== null) {
  10918. seacs[i] = state.seac;
  10919. }
  10920. if (!valid) {
  10921. charStrings.set(i, new Uint8Array([14]));
  10922. }
  10923. }
  10924. return {
  10925. charStrings,
  10926. seacs,
  10927. widths
  10928. };
  10929. }
  10930. emptyPrivateDictionary(parentDict) {
  10931. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  10932. parentDict.setByKey(18, [0, 0]);
  10933. parentDict.privateDict = privateDict;
  10934. }
  10935. parsePrivateDict(parentDict) {
  10936. if (!parentDict.hasName("Private")) {
  10937. this.emptyPrivateDictionary(parentDict);
  10938. return;
  10939. }
  10940. const privateOffset = parentDict.getByName("Private");
  10941. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  10942. parentDict.removeByName("Private");
  10943. return;
  10944. }
  10945. const size = privateOffset[0];
  10946. const offset = privateOffset[1];
  10947. if (size === 0 || offset >= this.bytes.length) {
  10948. this.emptyPrivateDictionary(parentDict);
  10949. return;
  10950. }
  10951. const privateDictEnd = offset + size;
  10952. const dictData = this.bytes.subarray(offset, privateDictEnd);
  10953. const dict = this.parseDict(dictData);
  10954. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  10955. parentDict.privateDict = privateDict;
  10956. if (privateDict.getByName("ExpansionFactor") === 0) {
  10957. privateDict.setByName("ExpansionFactor", 0.06);
  10958. }
  10959. if (!privateDict.getByName("Subrs")) {
  10960. return;
  10961. }
  10962. const subrsOffset = privateDict.getByName("Subrs");
  10963. const relativeOffset = offset + subrsOffset;
  10964. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  10965. this.emptyPrivateDictionary(parentDict);
  10966. return;
  10967. }
  10968. const subrsIndex = this.parseIndex(relativeOffset);
  10969. privateDict.subrsIndex = subrsIndex.obj;
  10970. }
  10971. parseCharsets(pos, length, strings, cid) {
  10972. if (pos === 0) {
  10973. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, ISOAdobeCharset);
  10974. } else if (pos === 1) {
  10975. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, ExpertCharset);
  10976. } else if (pos === 2) {
  10977. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, ExpertSubsetCharset);
  10978. }
  10979. const bytes = this.bytes;
  10980. const start = pos;
  10981. const format = bytes[pos++];
  10982. const charset = [cid ? 0 : ".notdef"];
  10983. let id, count, i;
  10984. length -= 1;
  10985. switch (format) {
  10986. case 0:
  10987. for (i = 0; i < length; i++) {
  10988. id = bytes[pos++] << 8 | bytes[pos++];
  10989. charset.push(cid ? id : strings.get(id));
  10990. }
  10991. break;
  10992. case 1:
  10993. while (charset.length <= length) {
  10994. id = bytes[pos++] << 8 | bytes[pos++];
  10995. count = bytes[pos++];
  10996. for (i = 0; i <= count; i++) {
  10997. charset.push(cid ? id++ : strings.get(id++));
  10998. }
  10999. }
  11000. break;
  11001. case 2:
  11002. while (charset.length <= length) {
  11003. id = bytes[pos++] << 8 | bytes[pos++];
  11004. count = bytes[pos++] << 8 | bytes[pos++];
  11005. for (i = 0; i <= count; i++) {
  11006. charset.push(cid ? id++ : strings.get(id++));
  11007. }
  11008. }
  11009. break;
  11010. default:
  11011. throw new FormatError("Unknown charset format");
  11012. }
  11013. const end = pos;
  11014. const raw = bytes.subarray(start, end);
  11015. return new CFFCharset(false, format, charset, raw);
  11016. }
  11017. parseEncoding(pos, properties, strings, charset) {
  11018. const encoding = Object.create(null);
  11019. const bytes = this.bytes;
  11020. let predefined = false;
  11021. let format, i, ii;
  11022. let raw = null;
  11023. function readSupplement() {
  11024. const supplementsCount = bytes[pos++];
  11025. for (i = 0; i < supplementsCount; i++) {
  11026. const code = bytes[pos++];
  11027. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  11028. encoding[code] = charset.indexOf(strings.get(sid));
  11029. }
  11030. }
  11031. if (pos === 0 || pos === 1) {
  11032. predefined = true;
  11033. format = pos;
  11034. const baseEncoding = pos ? ExpertEncoding : StandardEncoding;
  11035. for (i = 0, ii = charset.length; i < ii; i++) {
  11036. const index = baseEncoding.indexOf(charset[i]);
  11037. if (index !== -1) {
  11038. encoding[index] = i;
  11039. }
  11040. }
  11041. } else {
  11042. const dataStart = pos;
  11043. format = bytes[pos++];
  11044. switch (format & 0x7f) {
  11045. case 0:
  11046. const glyphsCount = bytes[pos++];
  11047. for (i = 1; i <= glyphsCount; i++) {
  11048. encoding[bytes[pos++]] = i;
  11049. }
  11050. break;
  11051. case 1:
  11052. const rangesCount = bytes[pos++];
  11053. let gid = 1;
  11054. for (i = 0; i < rangesCount; i++) {
  11055. const start = bytes[pos++];
  11056. const left = bytes[pos++];
  11057. for (let j = start; j <= start + left; j++) {
  11058. encoding[j] = gid++;
  11059. }
  11060. }
  11061. break;
  11062. default:
  11063. throw new FormatError(`Unknown encoding format: ${format} in CFF`);
  11064. }
  11065. const dataEnd = pos;
  11066. if (format & 0x80) {
  11067. bytes[dataStart] &= 0x7f;
  11068. readSupplement();
  11069. }
  11070. raw = bytes.subarray(dataStart, dataEnd);
  11071. }
  11072. format &= 0x7f;
  11073. return new CFFEncoding(predefined, format, encoding, raw);
  11074. }
  11075. parseFDSelect(pos, length) {
  11076. const bytes = this.bytes;
  11077. const format = bytes[pos++];
  11078. const fdSelect = [];
  11079. let i;
  11080. switch (format) {
  11081. case 0:
  11082. for (i = 0; i < length; ++i) {
  11083. const id = bytes[pos++];
  11084. fdSelect.push(id);
  11085. }
  11086. break;
  11087. case 3:
  11088. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  11089. for (i = 0; i < rangesCount; ++i) {
  11090. let first = bytes[pos++] << 8 | bytes[pos++];
  11091. if (i === 0 && first !== 0) {
  11092. warn("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  11093. first = 0;
  11094. }
  11095. const fdIndex = bytes[pos++];
  11096. const next = bytes[pos] << 8 | bytes[pos + 1];
  11097. for (let j = first; j < next; ++j) {
  11098. fdSelect.push(fdIndex);
  11099. }
  11100. }
  11101. pos += 2;
  11102. break;
  11103. default:
  11104. throw new FormatError(`parseFDSelect: Unknown format "${format}".`);
  11105. }
  11106. if (fdSelect.length !== length) {
  11107. throw new FormatError("parseFDSelect: Invalid font data.");
  11108. }
  11109. return new CFFFDSelect(format, fdSelect);
  11110. }
  11111. }
  11112. class CFF {
  11113. constructor() {
  11114. this.header = null;
  11115. this.names = [];
  11116. this.topDict = null;
  11117. this.strings = new CFFStrings();
  11118. this.globalSubrIndex = null;
  11119. this.encoding = null;
  11120. this.charset = null;
  11121. this.charStrings = null;
  11122. this.fdArray = [];
  11123. this.fdSelect = null;
  11124. this.isCIDFont = false;
  11125. }
  11126. duplicateFirstGlyph() {
  11127. if (this.charStrings.count >= 65535) {
  11128. warn("Not enough space in charstrings to duplicate first glyph.");
  11129. return;
  11130. }
  11131. const glyphZero = this.charStrings.get(0);
  11132. this.charStrings.add(glyphZero);
  11133. if (this.isCIDFont) {
  11134. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  11135. }
  11136. }
  11137. hasGlyphId(id) {
  11138. if (id < 0 || id >= this.charStrings.count) {
  11139. return false;
  11140. }
  11141. const glyph = this.charStrings.get(id);
  11142. return glyph.length > 0;
  11143. }
  11144. }
  11145. class CFFHeader {
  11146. constructor(major, minor, hdrSize, offSize) {
  11147. this.major = major;
  11148. this.minor = minor;
  11149. this.hdrSize = hdrSize;
  11150. this.offSize = offSize;
  11151. }
  11152. }
  11153. class CFFStrings {
  11154. constructor() {
  11155. this.strings = [];
  11156. }
  11157. get(index) {
  11158. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  11159. return CFFStandardStrings[index];
  11160. }
  11161. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  11162. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  11163. }
  11164. return CFFStandardStrings[0];
  11165. }
  11166. getSID(str) {
  11167. let index = CFFStandardStrings.indexOf(str);
  11168. if (index !== -1) {
  11169. return index;
  11170. }
  11171. index = this.strings.indexOf(str);
  11172. if (index !== -1) {
  11173. return index + NUM_STANDARD_CFF_STRINGS;
  11174. }
  11175. return -1;
  11176. }
  11177. add(value) {
  11178. this.strings.push(value);
  11179. }
  11180. get count() {
  11181. return this.strings.length;
  11182. }
  11183. }
  11184. class CFFIndex {
  11185. constructor() {
  11186. this.objects = [];
  11187. this.length = 0;
  11188. }
  11189. add(data) {
  11190. this.length += data.length;
  11191. this.objects.push(data);
  11192. }
  11193. set(index, data) {
  11194. this.length += data.length - this.objects[index].length;
  11195. this.objects[index] = data;
  11196. }
  11197. get(index) {
  11198. return this.objects[index];
  11199. }
  11200. get count() {
  11201. return this.objects.length;
  11202. }
  11203. }
  11204. class CFFDict {
  11205. constructor(tables, strings) {
  11206. this.keyToNameMap = tables.keyToNameMap;
  11207. this.nameToKeyMap = tables.nameToKeyMap;
  11208. this.defaults = tables.defaults;
  11209. this.types = tables.types;
  11210. this.opcodes = tables.opcodes;
  11211. this.order = tables.order;
  11212. this.strings = strings;
  11213. this.values = Object.create(null);
  11214. }
  11215. setByKey(key, value) {
  11216. if (!(key in this.keyToNameMap)) {
  11217. return false;
  11218. }
  11219. if (value.length === 0) {
  11220. return true;
  11221. }
  11222. for (const val of value) {
  11223. if (isNaN(val)) {
  11224. warn(`Invalid CFFDict value: "${value}" for key "${key}".`);
  11225. return true;
  11226. }
  11227. }
  11228. const type = this.types[key];
  11229. if (type === "num" || type === "sid" || type === "offset") {
  11230. value = value[0];
  11231. }
  11232. this.values[key] = value;
  11233. return true;
  11234. }
  11235. setByName(name, value) {
  11236. if (!(name in this.nameToKeyMap)) {
  11237. throw new FormatError(`Invalid dictionary name "${name}"`);
  11238. }
  11239. this.values[this.nameToKeyMap[name]] = value;
  11240. }
  11241. hasName(name) {
  11242. return this.nameToKeyMap[name] in this.values;
  11243. }
  11244. getByName(name) {
  11245. if (!(name in this.nameToKeyMap)) {
  11246. throw new FormatError(`Invalid dictionary name ${name}"`);
  11247. }
  11248. const key = this.nameToKeyMap[name];
  11249. if (!(key in this.values)) {
  11250. return this.defaults[key];
  11251. }
  11252. return this.values[key];
  11253. }
  11254. removeByName(name) {
  11255. delete this.values[this.nameToKeyMap[name]];
  11256. }
  11257. static createTables(layout) {
  11258. const tables = {
  11259. keyToNameMap: {},
  11260. nameToKeyMap: {},
  11261. defaults: {},
  11262. types: {},
  11263. opcodes: {},
  11264. order: []
  11265. };
  11266. for (const entry of layout) {
  11267. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  11268. tables.keyToNameMap[key] = entry[1];
  11269. tables.nameToKeyMap[entry[1]] = key;
  11270. tables.types[key] = entry[2];
  11271. tables.defaults[key] = entry[3];
  11272. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  11273. tables.order.push(key);
  11274. }
  11275. return tables;
  11276. }
  11277. }
  11278. const CFFTopDictLayout = [[[12, 30], "ROS", ["sid", "sid", "num"], null], [[12, 20], "SyntheticBase", "num", null], [0, "version", "sid", null], [1, "Notice", "sid", null], [[12, 0], "Copyright", "sid", null], [2, "FullName", "sid", null], [3, "FamilyName", "sid", null], [4, "Weight", "sid", null], [[12, 1], "isFixedPitch", "num", 0], [[12, 2], "ItalicAngle", "num", 0], [[12, 3], "UnderlinePosition", "num", -100], [[12, 4], "UnderlineThickness", "num", 50], [[12, 5], "PaintType", "num", 0], [[12, 6], "CharstringType", "num", 2], [[12, 7], "FontMatrix", ["num", "num", "num", "num", "num", "num"], [0.001, 0, 0, 0.001, 0, 0]], [13, "UniqueID", "num", null], [5, "FontBBox", ["num", "num", "num", "num"], [0, 0, 0, 0]], [[12, 8], "StrokeWidth", "num", 0], [14, "XUID", "array", null], [15, "charset", "offset", 0], [16, "Encoding", "offset", 0], [17, "CharStrings", "offset", 0], [18, "Private", ["offset", "offset"], null], [[12, 21], "PostScript", "sid", null], [[12, 22], "BaseFontName", "sid", null], [[12, 23], "BaseFontBlend", "delta", null], [[12, 31], "CIDFontVersion", "num", 0], [[12, 32], "CIDFontRevision", "num", 0], [[12, 33], "CIDFontType", "num", 0], [[12, 34], "CIDCount", "num", 8720], [[12, 35], "UIDBase", "num", null], [[12, 37], "FDSelect", "offset", null], [[12, 36], "FDArray", "offset", null], [[12, 38], "FontName", "sid", null]];
  11279. class CFFTopDict extends CFFDict {
  11280. static get tables() {
  11281. return shadow(this, "tables", this.createTables(CFFTopDictLayout));
  11282. }
  11283. constructor(strings) {
  11284. super(CFFTopDict.tables, strings);
  11285. this.privateDict = null;
  11286. }
  11287. }
  11288. const CFFPrivateDictLayout = [[6, "BlueValues", "delta", null], [7, "OtherBlues", "delta", null], [8, "FamilyBlues", "delta", null], [9, "FamilyOtherBlues", "delta", null], [[12, 9], "BlueScale", "num", 0.039625], [[12, 10], "BlueShift", "num", 7], [[12, 11], "BlueFuzz", "num", 1], [10, "StdHW", "num", null], [11, "StdVW", "num", null], [[12, 12], "StemSnapH", "delta", null], [[12, 13], "StemSnapV", "delta", null], [[12, 14], "ForceBold", "num", 0], [[12, 17], "LanguageGroup", "num", 0], [[12, 18], "ExpansionFactor", "num", 0.06], [[12, 19], "initialRandomSeed", "num", 0], [20, "defaultWidthX", "num", 0], [21, "nominalWidthX", "num", 0], [19, "Subrs", "offset", null]];
  11289. class CFFPrivateDict extends CFFDict {
  11290. static get tables() {
  11291. return shadow(this, "tables", this.createTables(CFFPrivateDictLayout));
  11292. }
  11293. constructor(strings) {
  11294. super(CFFPrivateDict.tables, strings);
  11295. this.subrsIndex = null;
  11296. }
  11297. }
  11298. const CFFCharsetPredefinedTypes = {
  11299. ISO_ADOBE: 0,
  11300. EXPERT: 1,
  11301. EXPERT_SUBSET: 2
  11302. };
  11303. class CFFCharset {
  11304. constructor(predefined, format, charset, raw) {
  11305. this.predefined = predefined;
  11306. this.format = format;
  11307. this.charset = charset;
  11308. this.raw = raw;
  11309. }
  11310. }
  11311. class CFFEncoding {
  11312. constructor(predefined, format, encoding, raw) {
  11313. this.predefined = predefined;
  11314. this.format = format;
  11315. this.encoding = encoding;
  11316. this.raw = raw;
  11317. }
  11318. }
  11319. class CFFFDSelect {
  11320. constructor(format, fdSelect) {
  11321. this.format = format;
  11322. this.fdSelect = fdSelect;
  11323. }
  11324. getFDIndex(glyphIndex) {
  11325. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  11326. return -1;
  11327. }
  11328. return this.fdSelect[glyphIndex];
  11329. }
  11330. }
  11331. class CFFOffsetTracker {
  11332. constructor() {
  11333. this.offsets = Object.create(null);
  11334. }
  11335. isTracking(key) {
  11336. return key in this.offsets;
  11337. }
  11338. track(key, location) {
  11339. if (key in this.offsets) {
  11340. throw new FormatError(`Already tracking location of ${key}`);
  11341. }
  11342. this.offsets[key] = location;
  11343. }
  11344. offset(value) {
  11345. for (const key in this.offsets) {
  11346. this.offsets[key] += value;
  11347. }
  11348. }
  11349. setEntryLocation(key, values, output) {
  11350. if (!(key in this.offsets)) {
  11351. throw new FormatError(`Not tracking location of ${key}`);
  11352. }
  11353. const data = output.data;
  11354. const dataOffset = this.offsets[key];
  11355. const size = 5;
  11356. for (let i = 0, ii = values.length; i < ii; ++i) {
  11357. const offset0 = i * size + dataOffset;
  11358. const offset1 = offset0 + 1;
  11359. const offset2 = offset0 + 2;
  11360. const offset3 = offset0 + 3;
  11361. const offset4 = offset0 + 4;
  11362. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  11363. throw new FormatError("writing to an offset that is not empty");
  11364. }
  11365. const value = values[i];
  11366. data[offset0] = 0x1d;
  11367. data[offset1] = value >> 24 & 0xff;
  11368. data[offset2] = value >> 16 & 0xff;
  11369. data[offset3] = value >> 8 & 0xff;
  11370. data[offset4] = value & 0xff;
  11371. }
  11372. }
  11373. }
  11374. class CFFCompiler {
  11375. constructor(cff) {
  11376. this.cff = cff;
  11377. }
  11378. compile() {
  11379. const cff = this.cff;
  11380. const output = {
  11381. data: [],
  11382. length: 0,
  11383. add(data) {
  11384. try {
  11385. this.data.push(...data);
  11386. } catch {
  11387. this.data = this.data.concat(data);
  11388. }
  11389. this.length = this.data.length;
  11390. }
  11391. };
  11392. const header = this.compileHeader(cff.header);
  11393. output.add(header);
  11394. const nameIndex = this.compileNameIndex(cff.names);
  11395. output.add(nameIndex);
  11396. if (cff.isCIDFont) {
  11397. if (cff.topDict.hasName("FontMatrix")) {
  11398. const base = cff.topDict.getByName("FontMatrix");
  11399. cff.topDict.removeByName("FontMatrix");
  11400. for (const subDict of cff.fdArray) {
  11401. let matrix = base.slice(0);
  11402. if (subDict.hasName("FontMatrix")) {
  11403. matrix = Util.transform(matrix, subDict.getByName("FontMatrix"));
  11404. }
  11405. subDict.setByName("FontMatrix", matrix);
  11406. }
  11407. }
  11408. }
  11409. const xuid = cff.topDict.getByName("XUID");
  11410. if (xuid?.length > 16) {
  11411. cff.topDict.removeByName("XUID");
  11412. }
  11413. cff.topDict.setByName("charset", 0);
  11414. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  11415. output.add(compiled.output);
  11416. const topDictTracker = compiled.trackers[0];
  11417. const stringIndex = this.compileStringIndex(cff.strings.strings);
  11418. output.add(stringIndex);
  11419. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  11420. output.add(globalSubrIndex);
  11421. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  11422. if (cff.encoding.predefined) {
  11423. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  11424. } else {
  11425. const encoding = this.compileEncoding(cff.encoding);
  11426. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  11427. output.add(encoding);
  11428. }
  11429. }
  11430. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  11431. topDictTracker.setEntryLocation("charset", [output.length], output);
  11432. output.add(charset);
  11433. const charStrings = this.compileCharStrings(cff.charStrings);
  11434. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  11435. output.add(charStrings);
  11436. if (cff.isCIDFont) {
  11437. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  11438. const fdSelect = this.compileFDSelect(cff.fdSelect);
  11439. output.add(fdSelect);
  11440. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  11441. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  11442. output.add(compiled.output);
  11443. const fontDictTrackers = compiled.trackers;
  11444. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  11445. }
  11446. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  11447. output.add([0]);
  11448. return output.data;
  11449. }
  11450. encodeNumber(value) {
  11451. if (Number.isInteger(value)) {
  11452. return this.encodeInteger(value);
  11453. }
  11454. return this.encodeFloat(value);
  11455. }
  11456. static get EncodeFloatRegExp() {
  11457. return shadow(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  11458. }
  11459. encodeFloat(num) {
  11460. let value = num.toString();
  11461. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  11462. if (m) {
  11463. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  11464. value = (Math.round(num * epsilon) / epsilon).toString();
  11465. }
  11466. let nibbles = "";
  11467. let i, ii;
  11468. for (i = 0, ii = value.length; i < ii; ++i) {
  11469. const a = value[i];
  11470. if (a === "e") {
  11471. nibbles += value[++i] === "-" ? "c" : "b";
  11472. } else if (a === ".") {
  11473. nibbles += "a";
  11474. } else if (a === "-") {
  11475. nibbles += "e";
  11476. } else {
  11477. nibbles += a;
  11478. }
  11479. }
  11480. nibbles += nibbles.length & 1 ? "f" : "ff";
  11481. const out = [30];
  11482. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  11483. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  11484. }
  11485. return out;
  11486. }
  11487. encodeInteger(value) {
  11488. let code;
  11489. if (value >= -107 && value <= 107) {
  11490. code = [value + 139];
  11491. } else if (value >= 108 && value <= 1131) {
  11492. value -= 108;
  11493. code = [(value >> 8) + 247, value & 0xff];
  11494. } else if (value >= -1131 && value <= -108) {
  11495. value = -value - 108;
  11496. code = [(value >> 8) + 251, value & 0xff];
  11497. } else if (value >= -32768 && value <= 32767) {
  11498. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  11499. } else {
  11500. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  11501. }
  11502. return code;
  11503. }
  11504. compileHeader(header) {
  11505. return [header.major, header.minor, 4, header.offSize];
  11506. }
  11507. compileNameIndex(names) {
  11508. const nameIndex = new CFFIndex();
  11509. for (const name of names) {
  11510. const length = Math.min(name.length, 127);
  11511. let sanitizedName = new Array(length);
  11512. for (let j = 0; j < length; j++) {
  11513. let char = name[j];
  11514. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  11515. char = "_";
  11516. }
  11517. sanitizedName[j] = char;
  11518. }
  11519. sanitizedName = sanitizedName.join("");
  11520. if (sanitizedName === "") {
  11521. sanitizedName = "Bad_Font_Name";
  11522. }
  11523. nameIndex.add(stringToBytes(sanitizedName));
  11524. }
  11525. return this.compileIndex(nameIndex);
  11526. }
  11527. compileTopDicts(dicts, length, removeCidKeys) {
  11528. const fontDictTrackers = [];
  11529. let fdArrayIndex = new CFFIndex();
  11530. for (const fontDict of dicts) {
  11531. if (removeCidKeys) {
  11532. fontDict.removeByName("CIDFontVersion");
  11533. fontDict.removeByName("CIDFontRevision");
  11534. fontDict.removeByName("CIDFontType");
  11535. fontDict.removeByName("CIDCount");
  11536. fontDict.removeByName("UIDBase");
  11537. }
  11538. const fontDictTracker = new CFFOffsetTracker();
  11539. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  11540. fontDictTrackers.push(fontDictTracker);
  11541. fdArrayIndex.add(fontDictData);
  11542. fontDictTracker.offset(length);
  11543. }
  11544. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  11545. return {
  11546. trackers: fontDictTrackers,
  11547. output: fdArrayIndex
  11548. };
  11549. }
  11550. compilePrivateDicts(dicts, trackers, output) {
  11551. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  11552. const fontDict = dicts[i];
  11553. const privateDict = fontDict.privateDict;
  11554. if (!privateDict || !fontDict.hasName("Private")) {
  11555. throw new FormatError("There must be a private dictionary.");
  11556. }
  11557. const privateDictTracker = new CFFOffsetTracker();
  11558. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  11559. let outputLength = output.length;
  11560. privateDictTracker.offset(outputLength);
  11561. if (!privateDictData.length) {
  11562. outputLength = 0;
  11563. }
  11564. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  11565. output.add(privateDictData);
  11566. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  11567. const subrs = this.compileIndex(privateDict.subrsIndex);
  11568. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  11569. output.add(subrs);
  11570. }
  11571. }
  11572. }
  11573. compileDict(dict, offsetTracker) {
  11574. const out = [];
  11575. for (const key of dict.order) {
  11576. if (!(key in dict.values)) {
  11577. continue;
  11578. }
  11579. let values = dict.values[key];
  11580. let types = dict.types[key];
  11581. if (!Array.isArray(types)) {
  11582. types = [types];
  11583. }
  11584. if (!Array.isArray(values)) {
  11585. values = [values];
  11586. }
  11587. if (values.length === 0) {
  11588. continue;
  11589. }
  11590. for (let j = 0, jj = types.length; j < jj; ++j) {
  11591. const type = types[j];
  11592. const value = values[j];
  11593. switch (type) {
  11594. case "num":
  11595. case "sid":
  11596. out.push(...this.encodeNumber(value));
  11597. break;
  11598. case "offset":
  11599. const name = dict.keyToNameMap[key];
  11600. if (!offsetTracker.isTracking(name)) {
  11601. offsetTracker.track(name, out.length);
  11602. }
  11603. out.push(0x1d, 0, 0, 0, 0);
  11604. break;
  11605. case "array":
  11606. case "delta":
  11607. out.push(...this.encodeNumber(value));
  11608. for (let k = 1, kk = values.length; k < kk; ++k) {
  11609. out.push(...this.encodeNumber(values[k]));
  11610. }
  11611. break;
  11612. default:
  11613. throw new FormatError(`Unknown data type of ${type}`);
  11614. }
  11615. }
  11616. out.push(...dict.opcodes[key]);
  11617. }
  11618. return out;
  11619. }
  11620. compileStringIndex(strings) {
  11621. const stringIndex = new CFFIndex();
  11622. for (const string of strings) {
  11623. stringIndex.add(stringToBytes(string));
  11624. }
  11625. return this.compileIndex(stringIndex);
  11626. }
  11627. compileCharStrings(charStrings) {
  11628. const charStringsIndex = new CFFIndex();
  11629. for (let i = 0; i < charStrings.count; i++) {
  11630. const glyph = charStrings.get(i);
  11631. if (glyph.length === 0) {
  11632. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  11633. continue;
  11634. }
  11635. charStringsIndex.add(glyph);
  11636. }
  11637. return this.compileIndex(charStringsIndex);
  11638. }
  11639. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  11640. let out;
  11641. const numGlyphsLessNotDef = numGlyphs - 1;
  11642. if (isCIDFont) {
  11643. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  11644. } else {
  11645. const length = 1 + numGlyphsLessNotDef * 2;
  11646. out = new Uint8Array(length);
  11647. out[0] = 0;
  11648. let charsetIndex = 0;
  11649. const numCharsets = charset.charset.length;
  11650. let warned = false;
  11651. for (let i = 1; i < out.length; i += 2) {
  11652. let sid = 0;
  11653. if (charsetIndex < numCharsets) {
  11654. const name = charset.charset[charsetIndex++];
  11655. sid = strings.getSID(name);
  11656. if (sid === -1) {
  11657. sid = 0;
  11658. if (!warned) {
  11659. warned = true;
  11660. warn(`Couldn't find ${name} in CFF strings`);
  11661. }
  11662. }
  11663. }
  11664. out[i] = sid >> 8 & 0xff;
  11665. out[i + 1] = sid & 0xff;
  11666. }
  11667. }
  11668. return this.compileTypedArray(out);
  11669. }
  11670. compileEncoding(encoding) {
  11671. return this.compileTypedArray(encoding.raw);
  11672. }
  11673. compileFDSelect(fdSelect) {
  11674. const format = fdSelect.format;
  11675. let out, i;
  11676. switch (format) {
  11677. case 0:
  11678. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  11679. out[0] = format;
  11680. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  11681. out[i + 1] = fdSelect.fdSelect[i];
  11682. }
  11683. break;
  11684. case 3:
  11685. const start = 0;
  11686. let lastFD = fdSelect.fdSelect[0];
  11687. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  11688. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  11689. const currentFD = fdSelect.fdSelect[i];
  11690. if (currentFD !== lastFD) {
  11691. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  11692. lastFD = currentFD;
  11693. }
  11694. }
  11695. const numRanges = (ranges.length - 3) / 3;
  11696. ranges[1] = numRanges >> 8 & 0xff;
  11697. ranges[2] = numRanges & 0xff;
  11698. ranges.push(i >> 8 & 0xff, i & 0xff);
  11699. out = new Uint8Array(ranges);
  11700. break;
  11701. }
  11702. return this.compileTypedArray(out);
  11703. }
  11704. compileTypedArray(data) {
  11705. return Array.from(data);
  11706. }
  11707. compileIndex(index, trackers = []) {
  11708. const objects = index.objects;
  11709. const count = objects.length;
  11710. if (count === 0) {
  11711. return [0, 0];
  11712. }
  11713. const data = [count >> 8 & 0xff, count & 0xff];
  11714. let lastOffset = 1,
  11715. i;
  11716. for (i = 0; i < count; ++i) {
  11717. lastOffset += objects[i].length;
  11718. }
  11719. let offsetSize;
  11720. if (lastOffset < 0x100) {
  11721. offsetSize = 1;
  11722. } else if (lastOffset < 0x10000) {
  11723. offsetSize = 2;
  11724. } else if (lastOffset < 0x1000000) {
  11725. offsetSize = 3;
  11726. } else {
  11727. offsetSize = 4;
  11728. }
  11729. data.push(offsetSize);
  11730. let relativeOffset = 1;
  11731. for (i = 0; i < count + 1; i++) {
  11732. if (offsetSize === 1) {
  11733. data.push(relativeOffset & 0xff);
  11734. } else if (offsetSize === 2) {
  11735. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  11736. } else if (offsetSize === 3) {
  11737. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  11738. } else {
  11739. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  11740. }
  11741. if (objects[i]) {
  11742. relativeOffset += objects[i].length;
  11743. }
  11744. }
  11745. for (i = 0; i < count; i++) {
  11746. if (trackers[i]) {
  11747. trackers[i].offset(data.length);
  11748. }
  11749. data.push(...objects[i]);
  11750. }
  11751. return data;
  11752. }
  11753. }
  11754. ;// ./src/core/glyphlist.js
  11755. const getGlyphsUnicode = getLookupTableFactory(function (t) {
  11756. t.A = 0x0041;
  11757. t.AE = 0x00c6;
  11758. t.AEacute = 0x01fc;
  11759. t.AEmacron = 0x01e2;
  11760. t.AEsmall = 0xf7e6;
  11761. t.Aacute = 0x00c1;
  11762. t.Aacutesmall = 0xf7e1;
  11763. t.Abreve = 0x0102;
  11764. t.Abreveacute = 0x1eae;
  11765. t.Abrevecyrillic = 0x04d0;
  11766. t.Abrevedotbelow = 0x1eb6;
  11767. t.Abrevegrave = 0x1eb0;
  11768. t.Abrevehookabove = 0x1eb2;
  11769. t.Abrevetilde = 0x1eb4;
  11770. t.Acaron = 0x01cd;
  11771. t.Acircle = 0x24b6;
  11772. t.Acircumflex = 0x00c2;
  11773. t.Acircumflexacute = 0x1ea4;
  11774. t.Acircumflexdotbelow = 0x1eac;
  11775. t.Acircumflexgrave = 0x1ea6;
  11776. t.Acircumflexhookabove = 0x1ea8;
  11777. t.Acircumflexsmall = 0xf7e2;
  11778. t.Acircumflextilde = 0x1eaa;
  11779. t.Acute = 0xf6c9;
  11780. t.Acutesmall = 0xf7b4;
  11781. t.Acyrillic = 0x0410;
  11782. t.Adblgrave = 0x0200;
  11783. t.Adieresis = 0x00c4;
  11784. t.Adieresiscyrillic = 0x04d2;
  11785. t.Adieresismacron = 0x01de;
  11786. t.Adieresissmall = 0xf7e4;
  11787. t.Adotbelow = 0x1ea0;
  11788. t.Adotmacron = 0x01e0;
  11789. t.Agrave = 0x00c0;
  11790. t.Agravesmall = 0xf7e0;
  11791. t.Ahookabove = 0x1ea2;
  11792. t.Aiecyrillic = 0x04d4;
  11793. t.Ainvertedbreve = 0x0202;
  11794. t.Alpha = 0x0391;
  11795. t.Alphatonos = 0x0386;
  11796. t.Amacron = 0x0100;
  11797. t.Amonospace = 0xff21;
  11798. t.Aogonek = 0x0104;
  11799. t.Aring = 0x00c5;
  11800. t.Aringacute = 0x01fa;
  11801. t.Aringbelow = 0x1e00;
  11802. t.Aringsmall = 0xf7e5;
  11803. t.Asmall = 0xf761;
  11804. t.Atilde = 0x00c3;
  11805. t.Atildesmall = 0xf7e3;
  11806. t.Aybarmenian = 0x0531;
  11807. t.B = 0x0042;
  11808. t.Bcircle = 0x24b7;
  11809. t.Bdotaccent = 0x1e02;
  11810. t.Bdotbelow = 0x1e04;
  11811. t.Becyrillic = 0x0411;
  11812. t.Benarmenian = 0x0532;
  11813. t.Beta = 0x0392;
  11814. t.Bhook = 0x0181;
  11815. t.Blinebelow = 0x1e06;
  11816. t.Bmonospace = 0xff22;
  11817. t.Brevesmall = 0xf6f4;
  11818. t.Bsmall = 0xf762;
  11819. t.Btopbar = 0x0182;
  11820. t.C = 0x0043;
  11821. t.Caarmenian = 0x053e;
  11822. t.Cacute = 0x0106;
  11823. t.Caron = 0xf6ca;
  11824. t.Caronsmall = 0xf6f5;
  11825. t.Ccaron = 0x010c;
  11826. t.Ccedilla = 0x00c7;
  11827. t.Ccedillaacute = 0x1e08;
  11828. t.Ccedillasmall = 0xf7e7;
  11829. t.Ccircle = 0x24b8;
  11830. t.Ccircumflex = 0x0108;
  11831. t.Cdot = 0x010a;
  11832. t.Cdotaccent = 0x010a;
  11833. t.Cedillasmall = 0xf7b8;
  11834. t.Chaarmenian = 0x0549;
  11835. t.Cheabkhasiancyrillic = 0x04bc;
  11836. t.Checyrillic = 0x0427;
  11837. t.Chedescenderabkhasiancyrillic = 0x04be;
  11838. t.Chedescendercyrillic = 0x04b6;
  11839. t.Chedieresiscyrillic = 0x04f4;
  11840. t.Cheharmenian = 0x0543;
  11841. t.Chekhakassiancyrillic = 0x04cb;
  11842. t.Cheverticalstrokecyrillic = 0x04b8;
  11843. t.Chi = 0x03a7;
  11844. t.Chook = 0x0187;
  11845. t.Circumflexsmall = 0xf6f6;
  11846. t.Cmonospace = 0xff23;
  11847. t.Coarmenian = 0x0551;
  11848. t.Csmall = 0xf763;
  11849. t.D = 0x0044;
  11850. t.DZ = 0x01f1;
  11851. t.DZcaron = 0x01c4;
  11852. t.Daarmenian = 0x0534;
  11853. t.Dafrican = 0x0189;
  11854. t.Dcaron = 0x010e;
  11855. t.Dcedilla = 0x1e10;
  11856. t.Dcircle = 0x24b9;
  11857. t.Dcircumflexbelow = 0x1e12;
  11858. t.Dcroat = 0x0110;
  11859. t.Ddotaccent = 0x1e0a;
  11860. t.Ddotbelow = 0x1e0c;
  11861. t.Decyrillic = 0x0414;
  11862. t.Deicoptic = 0x03ee;
  11863. t.Delta = 0x2206;
  11864. t.Deltagreek = 0x0394;
  11865. t.Dhook = 0x018a;
  11866. t.Dieresis = 0xf6cb;
  11867. t.DieresisAcute = 0xf6cc;
  11868. t.DieresisGrave = 0xf6cd;
  11869. t.Dieresissmall = 0xf7a8;
  11870. t.Digammagreek = 0x03dc;
  11871. t.Djecyrillic = 0x0402;
  11872. t.Dlinebelow = 0x1e0e;
  11873. t.Dmonospace = 0xff24;
  11874. t.Dotaccentsmall = 0xf6f7;
  11875. t.Dslash = 0x0110;
  11876. t.Dsmall = 0xf764;
  11877. t.Dtopbar = 0x018b;
  11878. t.Dz = 0x01f2;
  11879. t.Dzcaron = 0x01c5;
  11880. t.Dzeabkhasiancyrillic = 0x04e0;
  11881. t.Dzecyrillic = 0x0405;
  11882. t.Dzhecyrillic = 0x040f;
  11883. t.E = 0x0045;
  11884. t.Eacute = 0x00c9;
  11885. t.Eacutesmall = 0xf7e9;
  11886. t.Ebreve = 0x0114;
  11887. t.Ecaron = 0x011a;
  11888. t.Ecedillabreve = 0x1e1c;
  11889. t.Echarmenian = 0x0535;
  11890. t.Ecircle = 0x24ba;
  11891. t.Ecircumflex = 0x00ca;
  11892. t.Ecircumflexacute = 0x1ebe;
  11893. t.Ecircumflexbelow = 0x1e18;
  11894. t.Ecircumflexdotbelow = 0x1ec6;
  11895. t.Ecircumflexgrave = 0x1ec0;
  11896. t.Ecircumflexhookabove = 0x1ec2;
  11897. t.Ecircumflexsmall = 0xf7ea;
  11898. t.Ecircumflextilde = 0x1ec4;
  11899. t.Ecyrillic = 0x0404;
  11900. t.Edblgrave = 0x0204;
  11901. t.Edieresis = 0x00cb;
  11902. t.Edieresissmall = 0xf7eb;
  11903. t.Edot = 0x0116;
  11904. t.Edotaccent = 0x0116;
  11905. t.Edotbelow = 0x1eb8;
  11906. t.Efcyrillic = 0x0424;
  11907. t.Egrave = 0x00c8;
  11908. t.Egravesmall = 0xf7e8;
  11909. t.Eharmenian = 0x0537;
  11910. t.Ehookabove = 0x1eba;
  11911. t.Eightroman = 0x2167;
  11912. t.Einvertedbreve = 0x0206;
  11913. t.Eiotifiedcyrillic = 0x0464;
  11914. t.Elcyrillic = 0x041b;
  11915. t.Elevenroman = 0x216a;
  11916. t.Emacron = 0x0112;
  11917. t.Emacronacute = 0x1e16;
  11918. t.Emacrongrave = 0x1e14;
  11919. t.Emcyrillic = 0x041c;
  11920. t.Emonospace = 0xff25;
  11921. t.Encyrillic = 0x041d;
  11922. t.Endescendercyrillic = 0x04a2;
  11923. t.Eng = 0x014a;
  11924. t.Enghecyrillic = 0x04a4;
  11925. t.Enhookcyrillic = 0x04c7;
  11926. t.Eogonek = 0x0118;
  11927. t.Eopen = 0x0190;
  11928. t.Epsilon = 0x0395;
  11929. t.Epsilontonos = 0x0388;
  11930. t.Ercyrillic = 0x0420;
  11931. t.Ereversed = 0x018e;
  11932. t.Ereversedcyrillic = 0x042d;
  11933. t.Escyrillic = 0x0421;
  11934. t.Esdescendercyrillic = 0x04aa;
  11935. t.Esh = 0x01a9;
  11936. t.Esmall = 0xf765;
  11937. t.Eta = 0x0397;
  11938. t.Etarmenian = 0x0538;
  11939. t.Etatonos = 0x0389;
  11940. t.Eth = 0x00d0;
  11941. t.Ethsmall = 0xf7f0;
  11942. t.Etilde = 0x1ebc;
  11943. t.Etildebelow = 0x1e1a;
  11944. t.Euro = 0x20ac;
  11945. t.Ezh = 0x01b7;
  11946. t.Ezhcaron = 0x01ee;
  11947. t.Ezhreversed = 0x01b8;
  11948. t.F = 0x0046;
  11949. t.Fcircle = 0x24bb;
  11950. t.Fdotaccent = 0x1e1e;
  11951. t.Feharmenian = 0x0556;
  11952. t.Feicoptic = 0x03e4;
  11953. t.Fhook = 0x0191;
  11954. t.Fitacyrillic = 0x0472;
  11955. t.Fiveroman = 0x2164;
  11956. t.Fmonospace = 0xff26;
  11957. t.Fourroman = 0x2163;
  11958. t.Fsmall = 0xf766;
  11959. t.G = 0x0047;
  11960. t.GBsquare = 0x3387;
  11961. t.Gacute = 0x01f4;
  11962. t.Gamma = 0x0393;
  11963. t.Gammaafrican = 0x0194;
  11964. t.Gangiacoptic = 0x03ea;
  11965. t.Gbreve = 0x011e;
  11966. t.Gcaron = 0x01e6;
  11967. t.Gcedilla = 0x0122;
  11968. t.Gcircle = 0x24bc;
  11969. t.Gcircumflex = 0x011c;
  11970. t.Gcommaaccent = 0x0122;
  11971. t.Gdot = 0x0120;
  11972. t.Gdotaccent = 0x0120;
  11973. t.Gecyrillic = 0x0413;
  11974. t.Ghadarmenian = 0x0542;
  11975. t.Ghemiddlehookcyrillic = 0x0494;
  11976. t.Ghestrokecyrillic = 0x0492;
  11977. t.Gheupturncyrillic = 0x0490;
  11978. t.Ghook = 0x0193;
  11979. t.Gimarmenian = 0x0533;
  11980. t.Gjecyrillic = 0x0403;
  11981. t.Gmacron = 0x1e20;
  11982. t.Gmonospace = 0xff27;
  11983. t.Grave = 0xf6ce;
  11984. t.Gravesmall = 0xf760;
  11985. t.Gsmall = 0xf767;
  11986. t.Gsmallhook = 0x029b;
  11987. t.Gstroke = 0x01e4;
  11988. t.H = 0x0048;
  11989. t.H18533 = 0x25cf;
  11990. t.H18543 = 0x25aa;
  11991. t.H18551 = 0x25ab;
  11992. t.H22073 = 0x25a1;
  11993. t.HPsquare = 0x33cb;
  11994. t.Haabkhasiancyrillic = 0x04a8;
  11995. t.Hadescendercyrillic = 0x04b2;
  11996. t.Hardsigncyrillic = 0x042a;
  11997. t.Hbar = 0x0126;
  11998. t.Hbrevebelow = 0x1e2a;
  11999. t.Hcedilla = 0x1e28;
  12000. t.Hcircle = 0x24bd;
  12001. t.Hcircumflex = 0x0124;
  12002. t.Hdieresis = 0x1e26;
  12003. t.Hdotaccent = 0x1e22;
  12004. t.Hdotbelow = 0x1e24;
  12005. t.Hmonospace = 0xff28;
  12006. t.Hoarmenian = 0x0540;
  12007. t.Horicoptic = 0x03e8;
  12008. t.Hsmall = 0xf768;
  12009. t.Hungarumlaut = 0xf6cf;
  12010. t.Hungarumlautsmall = 0xf6f8;
  12011. t.Hzsquare = 0x3390;
  12012. t.I = 0x0049;
  12013. t.IAcyrillic = 0x042f;
  12014. t.IJ = 0x0132;
  12015. t.IUcyrillic = 0x042e;
  12016. t.Iacute = 0x00cd;
  12017. t.Iacutesmall = 0xf7ed;
  12018. t.Ibreve = 0x012c;
  12019. t.Icaron = 0x01cf;
  12020. t.Icircle = 0x24be;
  12021. t.Icircumflex = 0x00ce;
  12022. t.Icircumflexsmall = 0xf7ee;
  12023. t.Icyrillic = 0x0406;
  12024. t.Idblgrave = 0x0208;
  12025. t.Idieresis = 0x00cf;
  12026. t.Idieresisacute = 0x1e2e;
  12027. t.Idieresiscyrillic = 0x04e4;
  12028. t.Idieresissmall = 0xf7ef;
  12029. t.Idot = 0x0130;
  12030. t.Idotaccent = 0x0130;
  12031. t.Idotbelow = 0x1eca;
  12032. t.Iebrevecyrillic = 0x04d6;
  12033. t.Iecyrillic = 0x0415;
  12034. t.Ifraktur = 0x2111;
  12035. t.Igrave = 0x00cc;
  12036. t.Igravesmall = 0xf7ec;
  12037. t.Ihookabove = 0x1ec8;
  12038. t.Iicyrillic = 0x0418;
  12039. t.Iinvertedbreve = 0x020a;
  12040. t.Iishortcyrillic = 0x0419;
  12041. t.Imacron = 0x012a;
  12042. t.Imacroncyrillic = 0x04e2;
  12043. t.Imonospace = 0xff29;
  12044. t.Iniarmenian = 0x053b;
  12045. t.Iocyrillic = 0x0401;
  12046. t.Iogonek = 0x012e;
  12047. t.Iota = 0x0399;
  12048. t.Iotaafrican = 0x0196;
  12049. t.Iotadieresis = 0x03aa;
  12050. t.Iotatonos = 0x038a;
  12051. t.Ismall = 0xf769;
  12052. t.Istroke = 0x0197;
  12053. t.Itilde = 0x0128;
  12054. t.Itildebelow = 0x1e2c;
  12055. t.Izhitsacyrillic = 0x0474;
  12056. t.Izhitsadblgravecyrillic = 0x0476;
  12057. t.J = 0x004a;
  12058. t.Jaarmenian = 0x0541;
  12059. t.Jcircle = 0x24bf;
  12060. t.Jcircumflex = 0x0134;
  12061. t.Jecyrillic = 0x0408;
  12062. t.Jheharmenian = 0x054b;
  12063. t.Jmonospace = 0xff2a;
  12064. t.Jsmall = 0xf76a;
  12065. t.K = 0x004b;
  12066. t.KBsquare = 0x3385;
  12067. t.KKsquare = 0x33cd;
  12068. t.Kabashkircyrillic = 0x04a0;
  12069. t.Kacute = 0x1e30;
  12070. t.Kacyrillic = 0x041a;
  12071. t.Kadescendercyrillic = 0x049a;
  12072. t.Kahookcyrillic = 0x04c3;
  12073. t.Kappa = 0x039a;
  12074. t.Kastrokecyrillic = 0x049e;
  12075. t.Kaverticalstrokecyrillic = 0x049c;
  12076. t.Kcaron = 0x01e8;
  12077. t.Kcedilla = 0x0136;
  12078. t.Kcircle = 0x24c0;
  12079. t.Kcommaaccent = 0x0136;
  12080. t.Kdotbelow = 0x1e32;
  12081. t.Keharmenian = 0x0554;
  12082. t.Kenarmenian = 0x053f;
  12083. t.Khacyrillic = 0x0425;
  12084. t.Kheicoptic = 0x03e6;
  12085. t.Khook = 0x0198;
  12086. t.Kjecyrillic = 0x040c;
  12087. t.Klinebelow = 0x1e34;
  12088. t.Kmonospace = 0xff2b;
  12089. t.Koppacyrillic = 0x0480;
  12090. t.Koppagreek = 0x03de;
  12091. t.Ksicyrillic = 0x046e;
  12092. t.Ksmall = 0xf76b;
  12093. t.L = 0x004c;
  12094. t.LJ = 0x01c7;
  12095. t.LL = 0xf6bf;
  12096. t.Lacute = 0x0139;
  12097. t.Lambda = 0x039b;
  12098. t.Lcaron = 0x013d;
  12099. t.Lcedilla = 0x013b;
  12100. t.Lcircle = 0x24c1;
  12101. t.Lcircumflexbelow = 0x1e3c;
  12102. t.Lcommaaccent = 0x013b;
  12103. t.Ldot = 0x013f;
  12104. t.Ldotaccent = 0x013f;
  12105. t.Ldotbelow = 0x1e36;
  12106. t.Ldotbelowmacron = 0x1e38;
  12107. t.Liwnarmenian = 0x053c;
  12108. t.Lj = 0x01c8;
  12109. t.Ljecyrillic = 0x0409;
  12110. t.Llinebelow = 0x1e3a;
  12111. t.Lmonospace = 0xff2c;
  12112. t.Lslash = 0x0141;
  12113. t.Lslashsmall = 0xf6f9;
  12114. t.Lsmall = 0xf76c;
  12115. t.M = 0x004d;
  12116. t.MBsquare = 0x3386;
  12117. t.Macron = 0xf6d0;
  12118. t.Macronsmall = 0xf7af;
  12119. t.Macute = 0x1e3e;
  12120. t.Mcircle = 0x24c2;
  12121. t.Mdotaccent = 0x1e40;
  12122. t.Mdotbelow = 0x1e42;
  12123. t.Menarmenian = 0x0544;
  12124. t.Mmonospace = 0xff2d;
  12125. t.Msmall = 0xf76d;
  12126. t.Mturned = 0x019c;
  12127. t.Mu = 0x039c;
  12128. t.N = 0x004e;
  12129. t.NJ = 0x01ca;
  12130. t.Nacute = 0x0143;
  12131. t.Ncaron = 0x0147;
  12132. t.Ncedilla = 0x0145;
  12133. t.Ncircle = 0x24c3;
  12134. t.Ncircumflexbelow = 0x1e4a;
  12135. t.Ncommaaccent = 0x0145;
  12136. t.Ndotaccent = 0x1e44;
  12137. t.Ndotbelow = 0x1e46;
  12138. t.Nhookleft = 0x019d;
  12139. t.Nineroman = 0x2168;
  12140. t.Nj = 0x01cb;
  12141. t.Njecyrillic = 0x040a;
  12142. t.Nlinebelow = 0x1e48;
  12143. t.Nmonospace = 0xff2e;
  12144. t.Nowarmenian = 0x0546;
  12145. t.Nsmall = 0xf76e;
  12146. t.Ntilde = 0x00d1;
  12147. t.Ntildesmall = 0xf7f1;
  12148. t.Nu = 0x039d;
  12149. t.O = 0x004f;
  12150. t.OE = 0x0152;
  12151. t.OEsmall = 0xf6fa;
  12152. t.Oacute = 0x00d3;
  12153. t.Oacutesmall = 0xf7f3;
  12154. t.Obarredcyrillic = 0x04e8;
  12155. t.Obarreddieresiscyrillic = 0x04ea;
  12156. t.Obreve = 0x014e;
  12157. t.Ocaron = 0x01d1;
  12158. t.Ocenteredtilde = 0x019f;
  12159. t.Ocircle = 0x24c4;
  12160. t.Ocircumflex = 0x00d4;
  12161. t.Ocircumflexacute = 0x1ed0;
  12162. t.Ocircumflexdotbelow = 0x1ed8;
  12163. t.Ocircumflexgrave = 0x1ed2;
  12164. t.Ocircumflexhookabove = 0x1ed4;
  12165. t.Ocircumflexsmall = 0xf7f4;
  12166. t.Ocircumflextilde = 0x1ed6;
  12167. t.Ocyrillic = 0x041e;
  12168. t.Odblacute = 0x0150;
  12169. t.Odblgrave = 0x020c;
  12170. t.Odieresis = 0x00d6;
  12171. t.Odieresiscyrillic = 0x04e6;
  12172. t.Odieresissmall = 0xf7f6;
  12173. t.Odotbelow = 0x1ecc;
  12174. t.Ogoneksmall = 0xf6fb;
  12175. t.Ograve = 0x00d2;
  12176. t.Ogravesmall = 0xf7f2;
  12177. t.Oharmenian = 0x0555;
  12178. t.Ohm = 0x2126;
  12179. t.Ohookabove = 0x1ece;
  12180. t.Ohorn = 0x01a0;
  12181. t.Ohornacute = 0x1eda;
  12182. t.Ohorndotbelow = 0x1ee2;
  12183. t.Ohorngrave = 0x1edc;
  12184. t.Ohornhookabove = 0x1ede;
  12185. t.Ohorntilde = 0x1ee0;
  12186. t.Ohungarumlaut = 0x0150;
  12187. t.Oi = 0x01a2;
  12188. t.Oinvertedbreve = 0x020e;
  12189. t.Omacron = 0x014c;
  12190. t.Omacronacute = 0x1e52;
  12191. t.Omacrongrave = 0x1e50;
  12192. t.Omega = 0x2126;
  12193. t.Omegacyrillic = 0x0460;
  12194. t.Omegagreek = 0x03a9;
  12195. t.Omegaroundcyrillic = 0x047a;
  12196. t.Omegatitlocyrillic = 0x047c;
  12197. t.Omegatonos = 0x038f;
  12198. t.Omicron = 0x039f;
  12199. t.Omicrontonos = 0x038c;
  12200. t.Omonospace = 0xff2f;
  12201. t.Oneroman = 0x2160;
  12202. t.Oogonek = 0x01ea;
  12203. t.Oogonekmacron = 0x01ec;
  12204. t.Oopen = 0x0186;
  12205. t.Oslash = 0x00d8;
  12206. t.Oslashacute = 0x01fe;
  12207. t.Oslashsmall = 0xf7f8;
  12208. t.Osmall = 0xf76f;
  12209. t.Ostrokeacute = 0x01fe;
  12210. t.Otcyrillic = 0x047e;
  12211. t.Otilde = 0x00d5;
  12212. t.Otildeacute = 0x1e4c;
  12213. t.Otildedieresis = 0x1e4e;
  12214. t.Otildesmall = 0xf7f5;
  12215. t.P = 0x0050;
  12216. t.Pacute = 0x1e54;
  12217. t.Pcircle = 0x24c5;
  12218. t.Pdotaccent = 0x1e56;
  12219. t.Pecyrillic = 0x041f;
  12220. t.Peharmenian = 0x054a;
  12221. t.Pemiddlehookcyrillic = 0x04a6;
  12222. t.Phi = 0x03a6;
  12223. t.Phook = 0x01a4;
  12224. t.Pi = 0x03a0;
  12225. t.Piwrarmenian = 0x0553;
  12226. t.Pmonospace = 0xff30;
  12227. t.Psi = 0x03a8;
  12228. t.Psicyrillic = 0x0470;
  12229. t.Psmall = 0xf770;
  12230. t.Q = 0x0051;
  12231. t.Qcircle = 0x24c6;
  12232. t.Qmonospace = 0xff31;
  12233. t.Qsmall = 0xf771;
  12234. t.R = 0x0052;
  12235. t.Raarmenian = 0x054c;
  12236. t.Racute = 0x0154;
  12237. t.Rcaron = 0x0158;
  12238. t.Rcedilla = 0x0156;
  12239. t.Rcircle = 0x24c7;
  12240. t.Rcommaaccent = 0x0156;
  12241. t.Rdblgrave = 0x0210;
  12242. t.Rdotaccent = 0x1e58;
  12243. t.Rdotbelow = 0x1e5a;
  12244. t.Rdotbelowmacron = 0x1e5c;
  12245. t.Reharmenian = 0x0550;
  12246. t.Rfraktur = 0x211c;
  12247. t.Rho = 0x03a1;
  12248. t.Ringsmall = 0xf6fc;
  12249. t.Rinvertedbreve = 0x0212;
  12250. t.Rlinebelow = 0x1e5e;
  12251. t.Rmonospace = 0xff32;
  12252. t.Rsmall = 0xf772;
  12253. t.Rsmallinverted = 0x0281;
  12254. t.Rsmallinvertedsuperior = 0x02b6;
  12255. t.S = 0x0053;
  12256. t.SF010000 = 0x250c;
  12257. t.SF020000 = 0x2514;
  12258. t.SF030000 = 0x2510;
  12259. t.SF040000 = 0x2518;
  12260. t.SF050000 = 0x253c;
  12261. t.SF060000 = 0x252c;
  12262. t.SF070000 = 0x2534;
  12263. t.SF080000 = 0x251c;
  12264. t.SF090000 = 0x2524;
  12265. t.SF100000 = 0x2500;
  12266. t.SF110000 = 0x2502;
  12267. t.SF190000 = 0x2561;
  12268. t.SF200000 = 0x2562;
  12269. t.SF210000 = 0x2556;
  12270. t.SF220000 = 0x2555;
  12271. t.SF230000 = 0x2563;
  12272. t.SF240000 = 0x2551;
  12273. t.SF250000 = 0x2557;
  12274. t.SF260000 = 0x255d;
  12275. t.SF270000 = 0x255c;
  12276. t.SF280000 = 0x255b;
  12277. t.SF360000 = 0x255e;
  12278. t.SF370000 = 0x255f;
  12279. t.SF380000 = 0x255a;
  12280. t.SF390000 = 0x2554;
  12281. t.SF400000 = 0x2569;
  12282. t.SF410000 = 0x2566;
  12283. t.SF420000 = 0x2560;
  12284. t.SF430000 = 0x2550;
  12285. t.SF440000 = 0x256c;
  12286. t.SF450000 = 0x2567;
  12287. t.SF460000 = 0x2568;
  12288. t.SF470000 = 0x2564;
  12289. t.SF480000 = 0x2565;
  12290. t.SF490000 = 0x2559;
  12291. t.SF500000 = 0x2558;
  12292. t.SF510000 = 0x2552;
  12293. t.SF520000 = 0x2553;
  12294. t.SF530000 = 0x256b;
  12295. t.SF540000 = 0x256a;
  12296. t.Sacute = 0x015a;
  12297. t.Sacutedotaccent = 0x1e64;
  12298. t.Sampigreek = 0x03e0;
  12299. t.Scaron = 0x0160;
  12300. t.Scarondotaccent = 0x1e66;
  12301. t.Scaronsmall = 0xf6fd;
  12302. t.Scedilla = 0x015e;
  12303. t.Schwa = 0x018f;
  12304. t.Schwacyrillic = 0x04d8;
  12305. t.Schwadieresiscyrillic = 0x04da;
  12306. t.Scircle = 0x24c8;
  12307. t.Scircumflex = 0x015c;
  12308. t.Scommaaccent = 0x0218;
  12309. t.Sdotaccent = 0x1e60;
  12310. t.Sdotbelow = 0x1e62;
  12311. t.Sdotbelowdotaccent = 0x1e68;
  12312. t.Seharmenian = 0x054d;
  12313. t.Sevenroman = 0x2166;
  12314. t.Shaarmenian = 0x0547;
  12315. t.Shacyrillic = 0x0428;
  12316. t.Shchacyrillic = 0x0429;
  12317. t.Sheicoptic = 0x03e2;
  12318. t.Shhacyrillic = 0x04ba;
  12319. t.Shimacoptic = 0x03ec;
  12320. t.Sigma = 0x03a3;
  12321. t.Sixroman = 0x2165;
  12322. t.Smonospace = 0xff33;
  12323. t.Softsigncyrillic = 0x042c;
  12324. t.Ssmall = 0xf773;
  12325. t.Stigmagreek = 0x03da;
  12326. t.T = 0x0054;
  12327. t.Tau = 0x03a4;
  12328. t.Tbar = 0x0166;
  12329. t.Tcaron = 0x0164;
  12330. t.Tcedilla = 0x0162;
  12331. t.Tcircle = 0x24c9;
  12332. t.Tcircumflexbelow = 0x1e70;
  12333. t.Tcommaaccent = 0x0162;
  12334. t.Tdotaccent = 0x1e6a;
  12335. t.Tdotbelow = 0x1e6c;
  12336. t.Tecyrillic = 0x0422;
  12337. t.Tedescendercyrillic = 0x04ac;
  12338. t.Tenroman = 0x2169;
  12339. t.Tetsecyrillic = 0x04b4;
  12340. t.Theta = 0x0398;
  12341. t.Thook = 0x01ac;
  12342. t.Thorn = 0x00de;
  12343. t.Thornsmall = 0xf7fe;
  12344. t.Threeroman = 0x2162;
  12345. t.Tildesmall = 0xf6fe;
  12346. t.Tiwnarmenian = 0x054f;
  12347. t.Tlinebelow = 0x1e6e;
  12348. t.Tmonospace = 0xff34;
  12349. t.Toarmenian = 0x0539;
  12350. t.Tonefive = 0x01bc;
  12351. t.Tonesix = 0x0184;
  12352. t.Tonetwo = 0x01a7;
  12353. t.Tretroflexhook = 0x01ae;
  12354. t.Tsecyrillic = 0x0426;
  12355. t.Tshecyrillic = 0x040b;
  12356. t.Tsmall = 0xf774;
  12357. t.Twelveroman = 0x216b;
  12358. t.Tworoman = 0x2161;
  12359. t.U = 0x0055;
  12360. t.Uacute = 0x00da;
  12361. t.Uacutesmall = 0xf7fa;
  12362. t.Ubreve = 0x016c;
  12363. t.Ucaron = 0x01d3;
  12364. t.Ucircle = 0x24ca;
  12365. t.Ucircumflex = 0x00db;
  12366. t.Ucircumflexbelow = 0x1e76;
  12367. t.Ucircumflexsmall = 0xf7fb;
  12368. t.Ucyrillic = 0x0423;
  12369. t.Udblacute = 0x0170;
  12370. t.Udblgrave = 0x0214;
  12371. t.Udieresis = 0x00dc;
  12372. t.Udieresisacute = 0x01d7;
  12373. t.Udieresisbelow = 0x1e72;
  12374. t.Udieresiscaron = 0x01d9;
  12375. t.Udieresiscyrillic = 0x04f0;
  12376. t.Udieresisgrave = 0x01db;
  12377. t.Udieresismacron = 0x01d5;
  12378. t.Udieresissmall = 0xf7fc;
  12379. t.Udotbelow = 0x1ee4;
  12380. t.Ugrave = 0x00d9;
  12381. t.Ugravesmall = 0xf7f9;
  12382. t.Uhookabove = 0x1ee6;
  12383. t.Uhorn = 0x01af;
  12384. t.Uhornacute = 0x1ee8;
  12385. t.Uhorndotbelow = 0x1ef0;
  12386. t.Uhorngrave = 0x1eea;
  12387. t.Uhornhookabove = 0x1eec;
  12388. t.Uhorntilde = 0x1eee;
  12389. t.Uhungarumlaut = 0x0170;
  12390. t.Uhungarumlautcyrillic = 0x04f2;
  12391. t.Uinvertedbreve = 0x0216;
  12392. t.Ukcyrillic = 0x0478;
  12393. t.Umacron = 0x016a;
  12394. t.Umacroncyrillic = 0x04ee;
  12395. t.Umacrondieresis = 0x1e7a;
  12396. t.Umonospace = 0xff35;
  12397. t.Uogonek = 0x0172;
  12398. t.Upsilon = 0x03a5;
  12399. t.Upsilon1 = 0x03d2;
  12400. t.Upsilonacutehooksymbolgreek = 0x03d3;
  12401. t.Upsilonafrican = 0x01b1;
  12402. t.Upsilondieresis = 0x03ab;
  12403. t.Upsilondieresishooksymbolgreek = 0x03d4;
  12404. t.Upsilonhooksymbol = 0x03d2;
  12405. t.Upsilontonos = 0x038e;
  12406. t.Uring = 0x016e;
  12407. t.Ushortcyrillic = 0x040e;
  12408. t.Usmall = 0xf775;
  12409. t.Ustraightcyrillic = 0x04ae;
  12410. t.Ustraightstrokecyrillic = 0x04b0;
  12411. t.Utilde = 0x0168;
  12412. t.Utildeacute = 0x1e78;
  12413. t.Utildebelow = 0x1e74;
  12414. t.V = 0x0056;
  12415. t.Vcircle = 0x24cb;
  12416. t.Vdotbelow = 0x1e7e;
  12417. t.Vecyrillic = 0x0412;
  12418. t.Vewarmenian = 0x054e;
  12419. t.Vhook = 0x01b2;
  12420. t.Vmonospace = 0xff36;
  12421. t.Voarmenian = 0x0548;
  12422. t.Vsmall = 0xf776;
  12423. t.Vtilde = 0x1e7c;
  12424. t.W = 0x0057;
  12425. t.Wacute = 0x1e82;
  12426. t.Wcircle = 0x24cc;
  12427. t.Wcircumflex = 0x0174;
  12428. t.Wdieresis = 0x1e84;
  12429. t.Wdotaccent = 0x1e86;
  12430. t.Wdotbelow = 0x1e88;
  12431. t.Wgrave = 0x1e80;
  12432. t.Wmonospace = 0xff37;
  12433. t.Wsmall = 0xf777;
  12434. t.X = 0x0058;
  12435. t.Xcircle = 0x24cd;
  12436. t.Xdieresis = 0x1e8c;
  12437. t.Xdotaccent = 0x1e8a;
  12438. t.Xeharmenian = 0x053d;
  12439. t.Xi = 0x039e;
  12440. t.Xmonospace = 0xff38;
  12441. t.Xsmall = 0xf778;
  12442. t.Y = 0x0059;
  12443. t.Yacute = 0x00dd;
  12444. t.Yacutesmall = 0xf7fd;
  12445. t.Yatcyrillic = 0x0462;
  12446. t.Ycircle = 0x24ce;
  12447. t.Ycircumflex = 0x0176;
  12448. t.Ydieresis = 0x0178;
  12449. t.Ydieresissmall = 0xf7ff;
  12450. t.Ydotaccent = 0x1e8e;
  12451. t.Ydotbelow = 0x1ef4;
  12452. t.Yericyrillic = 0x042b;
  12453. t.Yerudieresiscyrillic = 0x04f8;
  12454. t.Ygrave = 0x1ef2;
  12455. t.Yhook = 0x01b3;
  12456. t.Yhookabove = 0x1ef6;
  12457. t.Yiarmenian = 0x0545;
  12458. t.Yicyrillic = 0x0407;
  12459. t.Yiwnarmenian = 0x0552;
  12460. t.Ymonospace = 0xff39;
  12461. t.Ysmall = 0xf779;
  12462. t.Ytilde = 0x1ef8;
  12463. t.Yusbigcyrillic = 0x046a;
  12464. t.Yusbigiotifiedcyrillic = 0x046c;
  12465. t.Yuslittlecyrillic = 0x0466;
  12466. t.Yuslittleiotifiedcyrillic = 0x0468;
  12467. t.Z = 0x005a;
  12468. t.Zaarmenian = 0x0536;
  12469. t.Zacute = 0x0179;
  12470. t.Zcaron = 0x017d;
  12471. t.Zcaronsmall = 0xf6ff;
  12472. t.Zcircle = 0x24cf;
  12473. t.Zcircumflex = 0x1e90;
  12474. t.Zdot = 0x017b;
  12475. t.Zdotaccent = 0x017b;
  12476. t.Zdotbelow = 0x1e92;
  12477. t.Zecyrillic = 0x0417;
  12478. t.Zedescendercyrillic = 0x0498;
  12479. t.Zedieresiscyrillic = 0x04de;
  12480. t.Zeta = 0x0396;
  12481. t.Zhearmenian = 0x053a;
  12482. t.Zhebrevecyrillic = 0x04c1;
  12483. t.Zhecyrillic = 0x0416;
  12484. t.Zhedescendercyrillic = 0x0496;
  12485. t.Zhedieresiscyrillic = 0x04dc;
  12486. t.Zlinebelow = 0x1e94;
  12487. t.Zmonospace = 0xff3a;
  12488. t.Zsmall = 0xf77a;
  12489. t.Zstroke = 0x01b5;
  12490. t.a = 0x0061;
  12491. t.aabengali = 0x0986;
  12492. t.aacute = 0x00e1;
  12493. t.aadeva = 0x0906;
  12494. t.aagujarati = 0x0a86;
  12495. t.aagurmukhi = 0x0a06;
  12496. t.aamatragurmukhi = 0x0a3e;
  12497. t.aarusquare = 0x3303;
  12498. t.aavowelsignbengali = 0x09be;
  12499. t.aavowelsigndeva = 0x093e;
  12500. t.aavowelsigngujarati = 0x0abe;
  12501. t.abbreviationmarkarmenian = 0x055f;
  12502. t.abbreviationsigndeva = 0x0970;
  12503. t.abengali = 0x0985;
  12504. t.abopomofo = 0x311a;
  12505. t.abreve = 0x0103;
  12506. t.abreveacute = 0x1eaf;
  12507. t.abrevecyrillic = 0x04d1;
  12508. t.abrevedotbelow = 0x1eb7;
  12509. t.abrevegrave = 0x1eb1;
  12510. t.abrevehookabove = 0x1eb3;
  12511. t.abrevetilde = 0x1eb5;
  12512. t.acaron = 0x01ce;
  12513. t.acircle = 0x24d0;
  12514. t.acircumflex = 0x00e2;
  12515. t.acircumflexacute = 0x1ea5;
  12516. t.acircumflexdotbelow = 0x1ead;
  12517. t.acircumflexgrave = 0x1ea7;
  12518. t.acircumflexhookabove = 0x1ea9;
  12519. t.acircumflextilde = 0x1eab;
  12520. t.acute = 0x00b4;
  12521. t.acutebelowcmb = 0x0317;
  12522. t.acutecmb = 0x0301;
  12523. t.acutecomb = 0x0301;
  12524. t.acutedeva = 0x0954;
  12525. t.acutelowmod = 0x02cf;
  12526. t.acutetonecmb = 0x0341;
  12527. t.acyrillic = 0x0430;
  12528. t.adblgrave = 0x0201;
  12529. t.addakgurmukhi = 0x0a71;
  12530. t.adeva = 0x0905;
  12531. t.adieresis = 0x00e4;
  12532. t.adieresiscyrillic = 0x04d3;
  12533. t.adieresismacron = 0x01df;
  12534. t.adotbelow = 0x1ea1;
  12535. t.adotmacron = 0x01e1;
  12536. t.ae = 0x00e6;
  12537. t.aeacute = 0x01fd;
  12538. t.aekorean = 0x3150;
  12539. t.aemacron = 0x01e3;
  12540. t.afii00208 = 0x2015;
  12541. t.afii08941 = 0x20a4;
  12542. t.afii10017 = 0x0410;
  12543. t.afii10018 = 0x0411;
  12544. t.afii10019 = 0x0412;
  12545. t.afii10020 = 0x0413;
  12546. t.afii10021 = 0x0414;
  12547. t.afii10022 = 0x0415;
  12548. t.afii10023 = 0x0401;
  12549. t.afii10024 = 0x0416;
  12550. t.afii10025 = 0x0417;
  12551. t.afii10026 = 0x0418;
  12552. t.afii10027 = 0x0419;
  12553. t.afii10028 = 0x041a;
  12554. t.afii10029 = 0x041b;
  12555. t.afii10030 = 0x041c;
  12556. t.afii10031 = 0x041d;
  12557. t.afii10032 = 0x041e;
  12558. t.afii10033 = 0x041f;
  12559. t.afii10034 = 0x0420;
  12560. t.afii10035 = 0x0421;
  12561. t.afii10036 = 0x0422;
  12562. t.afii10037 = 0x0423;
  12563. t.afii10038 = 0x0424;
  12564. t.afii10039 = 0x0425;
  12565. t.afii10040 = 0x0426;
  12566. t.afii10041 = 0x0427;
  12567. t.afii10042 = 0x0428;
  12568. t.afii10043 = 0x0429;
  12569. t.afii10044 = 0x042a;
  12570. t.afii10045 = 0x042b;
  12571. t.afii10046 = 0x042c;
  12572. t.afii10047 = 0x042d;
  12573. t.afii10048 = 0x042e;
  12574. t.afii10049 = 0x042f;
  12575. t.afii10050 = 0x0490;
  12576. t.afii10051 = 0x0402;
  12577. t.afii10052 = 0x0403;
  12578. t.afii10053 = 0x0404;
  12579. t.afii10054 = 0x0405;
  12580. t.afii10055 = 0x0406;
  12581. t.afii10056 = 0x0407;
  12582. t.afii10057 = 0x0408;
  12583. t.afii10058 = 0x0409;
  12584. t.afii10059 = 0x040a;
  12585. t.afii10060 = 0x040b;
  12586. t.afii10061 = 0x040c;
  12587. t.afii10062 = 0x040e;
  12588. t.afii10063 = 0xf6c4;
  12589. t.afii10064 = 0xf6c5;
  12590. t.afii10065 = 0x0430;
  12591. t.afii10066 = 0x0431;
  12592. t.afii10067 = 0x0432;
  12593. t.afii10068 = 0x0433;
  12594. t.afii10069 = 0x0434;
  12595. t.afii10070 = 0x0435;
  12596. t.afii10071 = 0x0451;
  12597. t.afii10072 = 0x0436;
  12598. t.afii10073 = 0x0437;
  12599. t.afii10074 = 0x0438;
  12600. t.afii10075 = 0x0439;
  12601. t.afii10076 = 0x043a;
  12602. t.afii10077 = 0x043b;
  12603. t.afii10078 = 0x043c;
  12604. t.afii10079 = 0x043d;
  12605. t.afii10080 = 0x043e;
  12606. t.afii10081 = 0x043f;
  12607. t.afii10082 = 0x0440;
  12608. t.afii10083 = 0x0441;
  12609. t.afii10084 = 0x0442;
  12610. t.afii10085 = 0x0443;
  12611. t.afii10086 = 0x0444;
  12612. t.afii10087 = 0x0445;
  12613. t.afii10088 = 0x0446;
  12614. t.afii10089 = 0x0447;
  12615. t.afii10090 = 0x0448;
  12616. t.afii10091 = 0x0449;
  12617. t.afii10092 = 0x044a;
  12618. t.afii10093 = 0x044b;
  12619. t.afii10094 = 0x044c;
  12620. t.afii10095 = 0x044d;
  12621. t.afii10096 = 0x044e;
  12622. t.afii10097 = 0x044f;
  12623. t.afii10098 = 0x0491;
  12624. t.afii10099 = 0x0452;
  12625. t.afii10100 = 0x0453;
  12626. t.afii10101 = 0x0454;
  12627. t.afii10102 = 0x0455;
  12628. t.afii10103 = 0x0456;
  12629. t.afii10104 = 0x0457;
  12630. t.afii10105 = 0x0458;
  12631. t.afii10106 = 0x0459;
  12632. t.afii10107 = 0x045a;
  12633. t.afii10108 = 0x045b;
  12634. t.afii10109 = 0x045c;
  12635. t.afii10110 = 0x045e;
  12636. t.afii10145 = 0x040f;
  12637. t.afii10146 = 0x0462;
  12638. t.afii10147 = 0x0472;
  12639. t.afii10148 = 0x0474;
  12640. t.afii10192 = 0xf6c6;
  12641. t.afii10193 = 0x045f;
  12642. t.afii10194 = 0x0463;
  12643. t.afii10195 = 0x0473;
  12644. t.afii10196 = 0x0475;
  12645. t.afii10831 = 0xf6c7;
  12646. t.afii10832 = 0xf6c8;
  12647. t.afii10846 = 0x04d9;
  12648. t.afii299 = 0x200e;
  12649. t.afii300 = 0x200f;
  12650. t.afii301 = 0x200d;
  12651. t.afii57381 = 0x066a;
  12652. t.afii57388 = 0x060c;
  12653. t.afii57392 = 0x0660;
  12654. t.afii57393 = 0x0661;
  12655. t.afii57394 = 0x0662;
  12656. t.afii57395 = 0x0663;
  12657. t.afii57396 = 0x0664;
  12658. t.afii57397 = 0x0665;
  12659. t.afii57398 = 0x0666;
  12660. t.afii57399 = 0x0667;
  12661. t.afii57400 = 0x0668;
  12662. t.afii57401 = 0x0669;
  12663. t.afii57403 = 0x061b;
  12664. t.afii57407 = 0x061f;
  12665. t.afii57409 = 0x0621;
  12666. t.afii57410 = 0x0622;
  12667. t.afii57411 = 0x0623;
  12668. t.afii57412 = 0x0624;
  12669. t.afii57413 = 0x0625;
  12670. t.afii57414 = 0x0626;
  12671. t.afii57415 = 0x0627;
  12672. t.afii57416 = 0x0628;
  12673. t.afii57417 = 0x0629;
  12674. t.afii57418 = 0x062a;
  12675. t.afii57419 = 0x062b;
  12676. t.afii57420 = 0x062c;
  12677. t.afii57421 = 0x062d;
  12678. t.afii57422 = 0x062e;
  12679. t.afii57423 = 0x062f;
  12680. t.afii57424 = 0x0630;
  12681. t.afii57425 = 0x0631;
  12682. t.afii57426 = 0x0632;
  12683. t.afii57427 = 0x0633;
  12684. t.afii57428 = 0x0634;
  12685. t.afii57429 = 0x0635;
  12686. t.afii57430 = 0x0636;
  12687. t.afii57431 = 0x0637;
  12688. t.afii57432 = 0x0638;
  12689. t.afii57433 = 0x0639;
  12690. t.afii57434 = 0x063a;
  12691. t.afii57440 = 0x0640;
  12692. t.afii57441 = 0x0641;
  12693. t.afii57442 = 0x0642;
  12694. t.afii57443 = 0x0643;
  12695. t.afii57444 = 0x0644;
  12696. t.afii57445 = 0x0645;
  12697. t.afii57446 = 0x0646;
  12698. t.afii57448 = 0x0648;
  12699. t.afii57449 = 0x0649;
  12700. t.afii57450 = 0x064a;
  12701. t.afii57451 = 0x064b;
  12702. t.afii57452 = 0x064c;
  12703. t.afii57453 = 0x064d;
  12704. t.afii57454 = 0x064e;
  12705. t.afii57455 = 0x064f;
  12706. t.afii57456 = 0x0650;
  12707. t.afii57457 = 0x0651;
  12708. t.afii57458 = 0x0652;
  12709. t.afii57470 = 0x0647;
  12710. t.afii57505 = 0x06a4;
  12711. t.afii57506 = 0x067e;
  12712. t.afii57507 = 0x0686;
  12713. t.afii57508 = 0x0698;
  12714. t.afii57509 = 0x06af;
  12715. t.afii57511 = 0x0679;
  12716. t.afii57512 = 0x0688;
  12717. t.afii57513 = 0x0691;
  12718. t.afii57514 = 0x06ba;
  12719. t.afii57519 = 0x06d2;
  12720. t.afii57534 = 0x06d5;
  12721. t.afii57636 = 0x20aa;
  12722. t.afii57645 = 0x05be;
  12723. t.afii57658 = 0x05c3;
  12724. t.afii57664 = 0x05d0;
  12725. t.afii57665 = 0x05d1;
  12726. t.afii57666 = 0x05d2;
  12727. t.afii57667 = 0x05d3;
  12728. t.afii57668 = 0x05d4;
  12729. t.afii57669 = 0x05d5;
  12730. t.afii57670 = 0x05d6;
  12731. t.afii57671 = 0x05d7;
  12732. t.afii57672 = 0x05d8;
  12733. t.afii57673 = 0x05d9;
  12734. t.afii57674 = 0x05da;
  12735. t.afii57675 = 0x05db;
  12736. t.afii57676 = 0x05dc;
  12737. t.afii57677 = 0x05dd;
  12738. t.afii57678 = 0x05de;
  12739. t.afii57679 = 0x05df;
  12740. t.afii57680 = 0x05e0;
  12741. t.afii57681 = 0x05e1;
  12742. t.afii57682 = 0x05e2;
  12743. t.afii57683 = 0x05e3;
  12744. t.afii57684 = 0x05e4;
  12745. t.afii57685 = 0x05e5;
  12746. t.afii57686 = 0x05e6;
  12747. t.afii57687 = 0x05e7;
  12748. t.afii57688 = 0x05e8;
  12749. t.afii57689 = 0x05e9;
  12750. t.afii57690 = 0x05ea;
  12751. t.afii57694 = 0xfb2a;
  12752. t.afii57695 = 0xfb2b;
  12753. t.afii57700 = 0xfb4b;
  12754. t.afii57705 = 0xfb1f;
  12755. t.afii57716 = 0x05f0;
  12756. t.afii57717 = 0x05f1;
  12757. t.afii57718 = 0x05f2;
  12758. t.afii57723 = 0xfb35;
  12759. t.afii57793 = 0x05b4;
  12760. t.afii57794 = 0x05b5;
  12761. t.afii57795 = 0x05b6;
  12762. t.afii57796 = 0x05bb;
  12763. t.afii57797 = 0x05b8;
  12764. t.afii57798 = 0x05b7;
  12765. t.afii57799 = 0x05b0;
  12766. t.afii57800 = 0x05b2;
  12767. t.afii57801 = 0x05b1;
  12768. t.afii57802 = 0x05b3;
  12769. t.afii57803 = 0x05c2;
  12770. t.afii57804 = 0x05c1;
  12771. t.afii57806 = 0x05b9;
  12772. t.afii57807 = 0x05bc;
  12773. t.afii57839 = 0x05bd;
  12774. t.afii57841 = 0x05bf;
  12775. t.afii57842 = 0x05c0;
  12776. t.afii57929 = 0x02bc;
  12777. t.afii61248 = 0x2105;
  12778. t.afii61289 = 0x2113;
  12779. t.afii61352 = 0x2116;
  12780. t.afii61573 = 0x202c;
  12781. t.afii61574 = 0x202d;
  12782. t.afii61575 = 0x202e;
  12783. t.afii61664 = 0x200c;
  12784. t.afii63167 = 0x066d;
  12785. t.afii64937 = 0x02bd;
  12786. t.agrave = 0x00e0;
  12787. t.agujarati = 0x0a85;
  12788. t.agurmukhi = 0x0a05;
  12789. t.ahiragana = 0x3042;
  12790. t.ahookabove = 0x1ea3;
  12791. t.aibengali = 0x0990;
  12792. t.aibopomofo = 0x311e;
  12793. t.aideva = 0x0910;
  12794. t.aiecyrillic = 0x04d5;
  12795. t.aigujarati = 0x0a90;
  12796. t.aigurmukhi = 0x0a10;
  12797. t.aimatragurmukhi = 0x0a48;
  12798. t.ainarabic = 0x0639;
  12799. t.ainfinalarabic = 0xfeca;
  12800. t.aininitialarabic = 0xfecb;
  12801. t.ainmedialarabic = 0xfecc;
  12802. t.ainvertedbreve = 0x0203;
  12803. t.aivowelsignbengali = 0x09c8;
  12804. t.aivowelsigndeva = 0x0948;
  12805. t.aivowelsigngujarati = 0x0ac8;
  12806. t.akatakana = 0x30a2;
  12807. t.akatakanahalfwidth = 0xff71;
  12808. t.akorean = 0x314f;
  12809. t.alef = 0x05d0;
  12810. t.alefarabic = 0x0627;
  12811. t.alefdageshhebrew = 0xfb30;
  12812. t.aleffinalarabic = 0xfe8e;
  12813. t.alefhamzaabovearabic = 0x0623;
  12814. t.alefhamzaabovefinalarabic = 0xfe84;
  12815. t.alefhamzabelowarabic = 0x0625;
  12816. t.alefhamzabelowfinalarabic = 0xfe88;
  12817. t.alefhebrew = 0x05d0;
  12818. t.aleflamedhebrew = 0xfb4f;
  12819. t.alefmaddaabovearabic = 0x0622;
  12820. t.alefmaddaabovefinalarabic = 0xfe82;
  12821. t.alefmaksuraarabic = 0x0649;
  12822. t.alefmaksurafinalarabic = 0xfef0;
  12823. t.alefmaksurainitialarabic = 0xfef3;
  12824. t.alefmaksuramedialarabic = 0xfef4;
  12825. t.alefpatahhebrew = 0xfb2e;
  12826. t.alefqamatshebrew = 0xfb2f;
  12827. t.aleph = 0x2135;
  12828. t.allequal = 0x224c;
  12829. t.alpha = 0x03b1;
  12830. t.alphatonos = 0x03ac;
  12831. t.amacron = 0x0101;
  12832. t.amonospace = 0xff41;
  12833. t.ampersand = 0x0026;
  12834. t.ampersandmonospace = 0xff06;
  12835. t.ampersandsmall = 0xf726;
  12836. t.amsquare = 0x33c2;
  12837. t.anbopomofo = 0x3122;
  12838. t.angbopomofo = 0x3124;
  12839. t.angbracketleft = 0x3008;
  12840. t.angbracketright = 0x3009;
  12841. t.angkhankhuthai = 0x0e5a;
  12842. t.angle = 0x2220;
  12843. t.anglebracketleft = 0x3008;
  12844. t.anglebracketleftvertical = 0xfe3f;
  12845. t.anglebracketright = 0x3009;
  12846. t.anglebracketrightvertical = 0xfe40;
  12847. t.angleleft = 0x2329;
  12848. t.angleright = 0x232a;
  12849. t.angstrom = 0x212b;
  12850. t.anoteleia = 0x0387;
  12851. t.anudattadeva = 0x0952;
  12852. t.anusvarabengali = 0x0982;
  12853. t.anusvaradeva = 0x0902;
  12854. t.anusvaragujarati = 0x0a82;
  12855. t.aogonek = 0x0105;
  12856. t.apaatosquare = 0x3300;
  12857. t.aparen = 0x249c;
  12858. t.apostrophearmenian = 0x055a;
  12859. t.apostrophemod = 0x02bc;
  12860. t.apple = 0xf8ff;
  12861. t.approaches = 0x2250;
  12862. t.approxequal = 0x2248;
  12863. t.approxequalorimage = 0x2252;
  12864. t.approximatelyequal = 0x2245;
  12865. t.araeaekorean = 0x318e;
  12866. t.araeakorean = 0x318d;
  12867. t.arc = 0x2312;
  12868. t.arighthalfring = 0x1e9a;
  12869. t.aring = 0x00e5;
  12870. t.aringacute = 0x01fb;
  12871. t.aringbelow = 0x1e01;
  12872. t.arrowboth = 0x2194;
  12873. t.arrowdashdown = 0x21e3;
  12874. t.arrowdashleft = 0x21e0;
  12875. t.arrowdashright = 0x21e2;
  12876. t.arrowdashup = 0x21e1;
  12877. t.arrowdblboth = 0x21d4;
  12878. t.arrowdbldown = 0x21d3;
  12879. t.arrowdblleft = 0x21d0;
  12880. t.arrowdblright = 0x21d2;
  12881. t.arrowdblup = 0x21d1;
  12882. t.arrowdown = 0x2193;
  12883. t.arrowdownleft = 0x2199;
  12884. t.arrowdownright = 0x2198;
  12885. t.arrowdownwhite = 0x21e9;
  12886. t.arrowheaddownmod = 0x02c5;
  12887. t.arrowheadleftmod = 0x02c2;
  12888. t.arrowheadrightmod = 0x02c3;
  12889. t.arrowheadupmod = 0x02c4;
  12890. t.arrowhorizex = 0xf8e7;
  12891. t.arrowleft = 0x2190;
  12892. t.arrowleftdbl = 0x21d0;
  12893. t.arrowleftdblstroke = 0x21cd;
  12894. t.arrowleftoverright = 0x21c6;
  12895. t.arrowleftwhite = 0x21e6;
  12896. t.arrowright = 0x2192;
  12897. t.arrowrightdblstroke = 0x21cf;
  12898. t.arrowrightheavy = 0x279e;
  12899. t.arrowrightoverleft = 0x21c4;
  12900. t.arrowrightwhite = 0x21e8;
  12901. t.arrowtableft = 0x21e4;
  12902. t.arrowtabright = 0x21e5;
  12903. t.arrowup = 0x2191;
  12904. t.arrowupdn = 0x2195;
  12905. t.arrowupdnbse = 0x21a8;
  12906. t.arrowupdownbase = 0x21a8;
  12907. t.arrowupleft = 0x2196;
  12908. t.arrowupleftofdown = 0x21c5;
  12909. t.arrowupright = 0x2197;
  12910. t.arrowupwhite = 0x21e7;
  12911. t.arrowvertex = 0xf8e6;
  12912. t.asciicircum = 0x005e;
  12913. t.asciicircummonospace = 0xff3e;
  12914. t.asciitilde = 0x007e;
  12915. t.asciitildemonospace = 0xff5e;
  12916. t.ascript = 0x0251;
  12917. t.ascriptturned = 0x0252;
  12918. t.asmallhiragana = 0x3041;
  12919. t.asmallkatakana = 0x30a1;
  12920. t.asmallkatakanahalfwidth = 0xff67;
  12921. t.asterisk = 0x002a;
  12922. t.asteriskaltonearabic = 0x066d;
  12923. t.asteriskarabic = 0x066d;
  12924. t.asteriskmath = 0x2217;
  12925. t.asteriskmonospace = 0xff0a;
  12926. t.asterisksmall = 0xfe61;
  12927. t.asterism = 0x2042;
  12928. t.asuperior = 0xf6e9;
  12929. t.asymptoticallyequal = 0x2243;
  12930. t.at = 0x0040;
  12931. t.atilde = 0x00e3;
  12932. t.atmonospace = 0xff20;
  12933. t.atsmall = 0xfe6b;
  12934. t.aturned = 0x0250;
  12935. t.aubengali = 0x0994;
  12936. t.aubopomofo = 0x3120;
  12937. t.audeva = 0x0914;
  12938. t.augujarati = 0x0a94;
  12939. t.augurmukhi = 0x0a14;
  12940. t.aulengthmarkbengali = 0x09d7;
  12941. t.aumatragurmukhi = 0x0a4c;
  12942. t.auvowelsignbengali = 0x09cc;
  12943. t.auvowelsigndeva = 0x094c;
  12944. t.auvowelsigngujarati = 0x0acc;
  12945. t.avagrahadeva = 0x093d;
  12946. t.aybarmenian = 0x0561;
  12947. t.ayin = 0x05e2;
  12948. t.ayinaltonehebrew = 0xfb20;
  12949. t.ayinhebrew = 0x05e2;
  12950. t.b = 0x0062;
  12951. t.babengali = 0x09ac;
  12952. t.backslash = 0x005c;
  12953. t.backslashmonospace = 0xff3c;
  12954. t.badeva = 0x092c;
  12955. t.bagujarati = 0x0aac;
  12956. t.bagurmukhi = 0x0a2c;
  12957. t.bahiragana = 0x3070;
  12958. t.bahtthai = 0x0e3f;
  12959. t.bakatakana = 0x30d0;
  12960. t.bar = 0x007c;
  12961. t.barmonospace = 0xff5c;
  12962. t.bbopomofo = 0x3105;
  12963. t.bcircle = 0x24d1;
  12964. t.bdotaccent = 0x1e03;
  12965. t.bdotbelow = 0x1e05;
  12966. t.beamedsixteenthnotes = 0x266c;
  12967. t.because = 0x2235;
  12968. t.becyrillic = 0x0431;
  12969. t.beharabic = 0x0628;
  12970. t.behfinalarabic = 0xfe90;
  12971. t.behinitialarabic = 0xfe91;
  12972. t.behiragana = 0x3079;
  12973. t.behmedialarabic = 0xfe92;
  12974. t.behmeeminitialarabic = 0xfc9f;
  12975. t.behmeemisolatedarabic = 0xfc08;
  12976. t.behnoonfinalarabic = 0xfc6d;
  12977. t.bekatakana = 0x30d9;
  12978. t.benarmenian = 0x0562;
  12979. t.bet = 0x05d1;
  12980. t.beta = 0x03b2;
  12981. t.betasymbolgreek = 0x03d0;
  12982. t.betdagesh = 0xfb31;
  12983. t.betdageshhebrew = 0xfb31;
  12984. t.bethebrew = 0x05d1;
  12985. t.betrafehebrew = 0xfb4c;
  12986. t.bhabengali = 0x09ad;
  12987. t.bhadeva = 0x092d;
  12988. t.bhagujarati = 0x0aad;
  12989. t.bhagurmukhi = 0x0a2d;
  12990. t.bhook = 0x0253;
  12991. t.bihiragana = 0x3073;
  12992. t.bikatakana = 0x30d3;
  12993. t.bilabialclick = 0x0298;
  12994. t.bindigurmukhi = 0x0a02;
  12995. t.birusquare = 0x3331;
  12996. t.blackcircle = 0x25cf;
  12997. t.blackdiamond = 0x25c6;
  12998. t.blackdownpointingtriangle = 0x25bc;
  12999. t.blackleftpointingpointer = 0x25c4;
  13000. t.blackleftpointingtriangle = 0x25c0;
  13001. t.blacklenticularbracketleft = 0x3010;
  13002. t.blacklenticularbracketleftvertical = 0xfe3b;
  13003. t.blacklenticularbracketright = 0x3011;
  13004. t.blacklenticularbracketrightvertical = 0xfe3c;
  13005. t.blacklowerlefttriangle = 0x25e3;
  13006. t.blacklowerrighttriangle = 0x25e2;
  13007. t.blackrectangle = 0x25ac;
  13008. t.blackrightpointingpointer = 0x25ba;
  13009. t.blackrightpointingtriangle = 0x25b6;
  13010. t.blacksmallsquare = 0x25aa;
  13011. t.blacksmilingface = 0x263b;
  13012. t.blacksquare = 0x25a0;
  13013. t.blackstar = 0x2605;
  13014. t.blackupperlefttriangle = 0x25e4;
  13015. t.blackupperrighttriangle = 0x25e5;
  13016. t.blackuppointingsmalltriangle = 0x25b4;
  13017. t.blackuppointingtriangle = 0x25b2;
  13018. t.blank = 0x2423;
  13019. t.blinebelow = 0x1e07;
  13020. t.block = 0x2588;
  13021. t.bmonospace = 0xff42;
  13022. t.bobaimaithai = 0x0e1a;
  13023. t.bohiragana = 0x307c;
  13024. t.bokatakana = 0x30dc;
  13025. t.bparen = 0x249d;
  13026. t.bqsquare = 0x33c3;
  13027. t.braceex = 0xf8f4;
  13028. t.braceleft = 0x007b;
  13029. t.braceleftbt = 0xf8f3;
  13030. t.braceleftmid = 0xf8f2;
  13031. t.braceleftmonospace = 0xff5b;
  13032. t.braceleftsmall = 0xfe5b;
  13033. t.bracelefttp = 0xf8f1;
  13034. t.braceleftvertical = 0xfe37;
  13035. t.braceright = 0x007d;
  13036. t.bracerightbt = 0xf8fe;
  13037. t.bracerightmid = 0xf8fd;
  13038. t.bracerightmonospace = 0xff5d;
  13039. t.bracerightsmall = 0xfe5c;
  13040. t.bracerighttp = 0xf8fc;
  13041. t.bracerightvertical = 0xfe38;
  13042. t.bracketleft = 0x005b;
  13043. t.bracketleftbt = 0xf8f0;
  13044. t.bracketleftex = 0xf8ef;
  13045. t.bracketleftmonospace = 0xff3b;
  13046. t.bracketlefttp = 0xf8ee;
  13047. t.bracketright = 0x005d;
  13048. t.bracketrightbt = 0xf8fb;
  13049. t.bracketrightex = 0xf8fa;
  13050. t.bracketrightmonospace = 0xff3d;
  13051. t.bracketrighttp = 0xf8f9;
  13052. t.breve = 0x02d8;
  13053. t.brevebelowcmb = 0x032e;
  13054. t.brevecmb = 0x0306;
  13055. t.breveinvertedbelowcmb = 0x032f;
  13056. t.breveinvertedcmb = 0x0311;
  13057. t.breveinverteddoublecmb = 0x0361;
  13058. t.bridgebelowcmb = 0x032a;
  13059. t.bridgeinvertedbelowcmb = 0x033a;
  13060. t.brokenbar = 0x00a6;
  13061. t.bstroke = 0x0180;
  13062. t.bsuperior = 0xf6ea;
  13063. t.btopbar = 0x0183;
  13064. t.buhiragana = 0x3076;
  13065. t.bukatakana = 0x30d6;
  13066. t.bullet = 0x2022;
  13067. t.bulletinverse = 0x25d8;
  13068. t.bulletoperator = 0x2219;
  13069. t.bullseye = 0x25ce;
  13070. t.c = 0x0063;
  13071. t.caarmenian = 0x056e;
  13072. t.cabengali = 0x099a;
  13073. t.cacute = 0x0107;
  13074. t.cadeva = 0x091a;
  13075. t.cagujarati = 0x0a9a;
  13076. t.cagurmukhi = 0x0a1a;
  13077. t.calsquare = 0x3388;
  13078. t.candrabindubengali = 0x0981;
  13079. t.candrabinducmb = 0x0310;
  13080. t.candrabindudeva = 0x0901;
  13081. t.candrabindugujarati = 0x0a81;
  13082. t.capslock = 0x21ea;
  13083. t.careof = 0x2105;
  13084. t.caron = 0x02c7;
  13085. t.caronbelowcmb = 0x032c;
  13086. t.caroncmb = 0x030c;
  13087. t.carriagereturn = 0x21b5;
  13088. t.cbopomofo = 0x3118;
  13089. t.ccaron = 0x010d;
  13090. t.ccedilla = 0x00e7;
  13091. t.ccedillaacute = 0x1e09;
  13092. t.ccircle = 0x24d2;
  13093. t.ccircumflex = 0x0109;
  13094. t.ccurl = 0x0255;
  13095. t.cdot = 0x010b;
  13096. t.cdotaccent = 0x010b;
  13097. t.cdsquare = 0x33c5;
  13098. t.cedilla = 0x00b8;
  13099. t.cedillacmb = 0x0327;
  13100. t.cent = 0x00a2;
  13101. t.centigrade = 0x2103;
  13102. t.centinferior = 0xf6df;
  13103. t.centmonospace = 0xffe0;
  13104. t.centoldstyle = 0xf7a2;
  13105. t.centsuperior = 0xf6e0;
  13106. t.chaarmenian = 0x0579;
  13107. t.chabengali = 0x099b;
  13108. t.chadeva = 0x091b;
  13109. t.chagujarati = 0x0a9b;
  13110. t.chagurmukhi = 0x0a1b;
  13111. t.chbopomofo = 0x3114;
  13112. t.cheabkhasiancyrillic = 0x04bd;
  13113. t.checkmark = 0x2713;
  13114. t.checyrillic = 0x0447;
  13115. t.chedescenderabkhasiancyrillic = 0x04bf;
  13116. t.chedescendercyrillic = 0x04b7;
  13117. t.chedieresiscyrillic = 0x04f5;
  13118. t.cheharmenian = 0x0573;
  13119. t.chekhakassiancyrillic = 0x04cc;
  13120. t.cheverticalstrokecyrillic = 0x04b9;
  13121. t.chi = 0x03c7;
  13122. t.chieuchacirclekorean = 0x3277;
  13123. t.chieuchaparenkorean = 0x3217;
  13124. t.chieuchcirclekorean = 0x3269;
  13125. t.chieuchkorean = 0x314a;
  13126. t.chieuchparenkorean = 0x3209;
  13127. t.chochangthai = 0x0e0a;
  13128. t.chochanthai = 0x0e08;
  13129. t.chochingthai = 0x0e09;
  13130. t.chochoethai = 0x0e0c;
  13131. t.chook = 0x0188;
  13132. t.cieucacirclekorean = 0x3276;
  13133. t.cieucaparenkorean = 0x3216;
  13134. t.cieuccirclekorean = 0x3268;
  13135. t.cieuckorean = 0x3148;
  13136. t.cieucparenkorean = 0x3208;
  13137. t.cieucuparenkorean = 0x321c;
  13138. t.circle = 0x25cb;
  13139. t.circlecopyrt = 0x00a9;
  13140. t.circlemultiply = 0x2297;
  13141. t.circleot = 0x2299;
  13142. t.circleplus = 0x2295;
  13143. t.circlepostalmark = 0x3036;
  13144. t.circlewithlefthalfblack = 0x25d0;
  13145. t.circlewithrighthalfblack = 0x25d1;
  13146. t.circumflex = 0x02c6;
  13147. t.circumflexbelowcmb = 0x032d;
  13148. t.circumflexcmb = 0x0302;
  13149. t.clear = 0x2327;
  13150. t.clickalveolar = 0x01c2;
  13151. t.clickdental = 0x01c0;
  13152. t.clicklateral = 0x01c1;
  13153. t.clickretroflex = 0x01c3;
  13154. t.club = 0x2663;
  13155. t.clubsuitblack = 0x2663;
  13156. t.clubsuitwhite = 0x2667;
  13157. t.cmcubedsquare = 0x33a4;
  13158. t.cmonospace = 0xff43;
  13159. t.cmsquaredsquare = 0x33a0;
  13160. t.coarmenian = 0x0581;
  13161. t.colon = 0x003a;
  13162. t.colonmonetary = 0x20a1;
  13163. t.colonmonospace = 0xff1a;
  13164. t.colonsign = 0x20a1;
  13165. t.colonsmall = 0xfe55;
  13166. t.colontriangularhalfmod = 0x02d1;
  13167. t.colontriangularmod = 0x02d0;
  13168. t.comma = 0x002c;
  13169. t.commaabovecmb = 0x0313;
  13170. t.commaaboverightcmb = 0x0315;
  13171. t.commaaccent = 0xf6c3;
  13172. t.commaarabic = 0x060c;
  13173. t.commaarmenian = 0x055d;
  13174. t.commainferior = 0xf6e1;
  13175. t.commamonospace = 0xff0c;
  13176. t.commareversedabovecmb = 0x0314;
  13177. t.commareversedmod = 0x02bd;
  13178. t.commasmall = 0xfe50;
  13179. t.commasuperior = 0xf6e2;
  13180. t.commaturnedabovecmb = 0x0312;
  13181. t.commaturnedmod = 0x02bb;
  13182. t.compass = 0x263c;
  13183. t.congruent = 0x2245;
  13184. t.contourintegral = 0x222e;
  13185. t.control = 0x2303;
  13186. t.controlACK = 0x0006;
  13187. t.controlBEL = 0x0007;
  13188. t.controlBS = 0x0008;
  13189. t.controlCAN = 0x0018;
  13190. t.controlCR = 0x000d;
  13191. t.controlDC1 = 0x0011;
  13192. t.controlDC2 = 0x0012;
  13193. t.controlDC3 = 0x0013;
  13194. t.controlDC4 = 0x0014;
  13195. t.controlDEL = 0x007f;
  13196. t.controlDLE = 0x0010;
  13197. t.controlEM = 0x0019;
  13198. t.controlENQ = 0x0005;
  13199. t.controlEOT = 0x0004;
  13200. t.controlESC = 0x001b;
  13201. t.controlETB = 0x0017;
  13202. t.controlETX = 0x0003;
  13203. t.controlFF = 0x000c;
  13204. t.controlFS = 0x001c;
  13205. t.controlGS = 0x001d;
  13206. t.controlHT = 0x0009;
  13207. t.controlLF = 0x000a;
  13208. t.controlNAK = 0x0015;
  13209. t.controlNULL = 0x0000;
  13210. t.controlRS = 0x001e;
  13211. t.controlSI = 0x000f;
  13212. t.controlSO = 0x000e;
  13213. t.controlSOT = 0x0002;
  13214. t.controlSTX = 0x0001;
  13215. t.controlSUB = 0x001a;
  13216. t.controlSYN = 0x0016;
  13217. t.controlUS = 0x001f;
  13218. t.controlVT = 0x000b;
  13219. t.copyright = 0x00a9;
  13220. t.copyrightsans = 0xf8e9;
  13221. t.copyrightserif = 0xf6d9;
  13222. t.cornerbracketleft = 0x300c;
  13223. t.cornerbracketlefthalfwidth = 0xff62;
  13224. t.cornerbracketleftvertical = 0xfe41;
  13225. t.cornerbracketright = 0x300d;
  13226. t.cornerbracketrighthalfwidth = 0xff63;
  13227. t.cornerbracketrightvertical = 0xfe42;
  13228. t.corporationsquare = 0x337f;
  13229. t.cosquare = 0x33c7;
  13230. t.coverkgsquare = 0x33c6;
  13231. t.cparen = 0x249e;
  13232. t.cruzeiro = 0x20a2;
  13233. t.cstretched = 0x0297;
  13234. t.curlyand = 0x22cf;
  13235. t.curlyor = 0x22ce;
  13236. t.currency = 0x00a4;
  13237. t.cyrBreve = 0xf6d1;
  13238. t.cyrFlex = 0xf6d2;
  13239. t.cyrbreve = 0xf6d4;
  13240. t.cyrflex = 0xf6d5;
  13241. t.d = 0x0064;
  13242. t.daarmenian = 0x0564;
  13243. t.dabengali = 0x09a6;
  13244. t.dadarabic = 0x0636;
  13245. t.dadeva = 0x0926;
  13246. t.dadfinalarabic = 0xfebe;
  13247. t.dadinitialarabic = 0xfebf;
  13248. t.dadmedialarabic = 0xfec0;
  13249. t.dagesh = 0x05bc;
  13250. t.dageshhebrew = 0x05bc;
  13251. t.dagger = 0x2020;
  13252. t.daggerdbl = 0x2021;
  13253. t.dagujarati = 0x0aa6;
  13254. t.dagurmukhi = 0x0a26;
  13255. t.dahiragana = 0x3060;
  13256. t.dakatakana = 0x30c0;
  13257. t.dalarabic = 0x062f;
  13258. t.dalet = 0x05d3;
  13259. t.daletdagesh = 0xfb33;
  13260. t.daletdageshhebrew = 0xfb33;
  13261. t.dalethebrew = 0x05d3;
  13262. t.dalfinalarabic = 0xfeaa;
  13263. t.dammaarabic = 0x064f;
  13264. t.dammalowarabic = 0x064f;
  13265. t.dammatanaltonearabic = 0x064c;
  13266. t.dammatanarabic = 0x064c;
  13267. t.danda = 0x0964;
  13268. t.dargahebrew = 0x05a7;
  13269. t.dargalefthebrew = 0x05a7;
  13270. t.dasiapneumatacyrilliccmb = 0x0485;
  13271. t.dblGrave = 0xf6d3;
  13272. t.dblanglebracketleft = 0x300a;
  13273. t.dblanglebracketleftvertical = 0xfe3d;
  13274. t.dblanglebracketright = 0x300b;
  13275. t.dblanglebracketrightvertical = 0xfe3e;
  13276. t.dblarchinvertedbelowcmb = 0x032b;
  13277. t.dblarrowleft = 0x21d4;
  13278. t.dblarrowright = 0x21d2;
  13279. t.dbldanda = 0x0965;
  13280. t.dblgrave = 0xf6d6;
  13281. t.dblgravecmb = 0x030f;
  13282. t.dblintegral = 0x222c;
  13283. t.dbllowline = 0x2017;
  13284. t.dbllowlinecmb = 0x0333;
  13285. t.dbloverlinecmb = 0x033f;
  13286. t.dblprimemod = 0x02ba;
  13287. t.dblverticalbar = 0x2016;
  13288. t.dblverticallineabovecmb = 0x030e;
  13289. t.dbopomofo = 0x3109;
  13290. t.dbsquare = 0x33c8;
  13291. t.dcaron = 0x010f;
  13292. t.dcedilla = 0x1e11;
  13293. t.dcircle = 0x24d3;
  13294. t.dcircumflexbelow = 0x1e13;
  13295. t.dcroat = 0x0111;
  13296. t.ddabengali = 0x09a1;
  13297. t.ddadeva = 0x0921;
  13298. t.ddagujarati = 0x0aa1;
  13299. t.ddagurmukhi = 0x0a21;
  13300. t.ddalarabic = 0x0688;
  13301. t.ddalfinalarabic = 0xfb89;
  13302. t.dddhadeva = 0x095c;
  13303. t.ddhabengali = 0x09a2;
  13304. t.ddhadeva = 0x0922;
  13305. t.ddhagujarati = 0x0aa2;
  13306. t.ddhagurmukhi = 0x0a22;
  13307. t.ddotaccent = 0x1e0b;
  13308. t.ddotbelow = 0x1e0d;
  13309. t.decimalseparatorarabic = 0x066b;
  13310. t.decimalseparatorpersian = 0x066b;
  13311. t.decyrillic = 0x0434;
  13312. t.degree = 0x00b0;
  13313. t.dehihebrew = 0x05ad;
  13314. t.dehiragana = 0x3067;
  13315. t.deicoptic = 0x03ef;
  13316. t.dekatakana = 0x30c7;
  13317. t.deleteleft = 0x232b;
  13318. t.deleteright = 0x2326;
  13319. t.delta = 0x03b4;
  13320. t.deltaturned = 0x018d;
  13321. t.denominatorminusonenumeratorbengali = 0x09f8;
  13322. t.dezh = 0x02a4;
  13323. t.dhabengali = 0x09a7;
  13324. t.dhadeva = 0x0927;
  13325. t.dhagujarati = 0x0aa7;
  13326. t.dhagurmukhi = 0x0a27;
  13327. t.dhook = 0x0257;
  13328. t.dialytikatonos = 0x0385;
  13329. t.dialytikatonoscmb = 0x0344;
  13330. t.diamond = 0x2666;
  13331. t.diamondsuitwhite = 0x2662;
  13332. t.dieresis = 0x00a8;
  13333. t.dieresisacute = 0xf6d7;
  13334. t.dieresisbelowcmb = 0x0324;
  13335. t.dieresiscmb = 0x0308;
  13336. t.dieresisgrave = 0xf6d8;
  13337. t.dieresistonos = 0x0385;
  13338. t.dihiragana = 0x3062;
  13339. t.dikatakana = 0x30c2;
  13340. t.dittomark = 0x3003;
  13341. t.divide = 0x00f7;
  13342. t.divides = 0x2223;
  13343. t.divisionslash = 0x2215;
  13344. t.djecyrillic = 0x0452;
  13345. t.dkshade = 0x2593;
  13346. t.dlinebelow = 0x1e0f;
  13347. t.dlsquare = 0x3397;
  13348. t.dmacron = 0x0111;
  13349. t.dmonospace = 0xff44;
  13350. t.dnblock = 0x2584;
  13351. t.dochadathai = 0x0e0e;
  13352. t.dodekthai = 0x0e14;
  13353. t.dohiragana = 0x3069;
  13354. t.dokatakana = 0x30c9;
  13355. t.dollar = 0x0024;
  13356. t.dollarinferior = 0xf6e3;
  13357. t.dollarmonospace = 0xff04;
  13358. t.dollaroldstyle = 0xf724;
  13359. t.dollarsmall = 0xfe69;
  13360. t.dollarsuperior = 0xf6e4;
  13361. t.dong = 0x20ab;
  13362. t.dorusquare = 0x3326;
  13363. t.dotaccent = 0x02d9;
  13364. t.dotaccentcmb = 0x0307;
  13365. t.dotbelowcmb = 0x0323;
  13366. t.dotbelowcomb = 0x0323;
  13367. t.dotkatakana = 0x30fb;
  13368. t.dotlessi = 0x0131;
  13369. t.dotlessj = 0xf6be;
  13370. t.dotlessjstrokehook = 0x0284;
  13371. t.dotmath = 0x22c5;
  13372. t.dottedcircle = 0x25cc;
  13373. t.doubleyodpatah = 0xfb1f;
  13374. t.doubleyodpatahhebrew = 0xfb1f;
  13375. t.downtackbelowcmb = 0x031e;
  13376. t.downtackmod = 0x02d5;
  13377. t.dparen = 0x249f;
  13378. t.dsuperior = 0xf6eb;
  13379. t.dtail = 0x0256;
  13380. t.dtopbar = 0x018c;
  13381. t.duhiragana = 0x3065;
  13382. t.dukatakana = 0x30c5;
  13383. t.dz = 0x01f3;
  13384. t.dzaltone = 0x02a3;
  13385. t.dzcaron = 0x01c6;
  13386. t.dzcurl = 0x02a5;
  13387. t.dzeabkhasiancyrillic = 0x04e1;
  13388. t.dzecyrillic = 0x0455;
  13389. t.dzhecyrillic = 0x045f;
  13390. t.e = 0x0065;
  13391. t.eacute = 0x00e9;
  13392. t.earth = 0x2641;
  13393. t.ebengali = 0x098f;
  13394. t.ebopomofo = 0x311c;
  13395. t.ebreve = 0x0115;
  13396. t.ecandradeva = 0x090d;
  13397. t.ecandragujarati = 0x0a8d;
  13398. t.ecandravowelsigndeva = 0x0945;
  13399. t.ecandravowelsigngujarati = 0x0ac5;
  13400. t.ecaron = 0x011b;
  13401. t.ecedillabreve = 0x1e1d;
  13402. t.echarmenian = 0x0565;
  13403. t.echyiwnarmenian = 0x0587;
  13404. t.ecircle = 0x24d4;
  13405. t.ecircumflex = 0x00ea;
  13406. t.ecircumflexacute = 0x1ebf;
  13407. t.ecircumflexbelow = 0x1e19;
  13408. t.ecircumflexdotbelow = 0x1ec7;
  13409. t.ecircumflexgrave = 0x1ec1;
  13410. t.ecircumflexhookabove = 0x1ec3;
  13411. t.ecircumflextilde = 0x1ec5;
  13412. t.ecyrillic = 0x0454;
  13413. t.edblgrave = 0x0205;
  13414. t.edeva = 0x090f;
  13415. t.edieresis = 0x00eb;
  13416. t.edot = 0x0117;
  13417. t.edotaccent = 0x0117;
  13418. t.edotbelow = 0x1eb9;
  13419. t.eegurmukhi = 0x0a0f;
  13420. t.eematragurmukhi = 0x0a47;
  13421. t.efcyrillic = 0x0444;
  13422. t.egrave = 0x00e8;
  13423. t.egujarati = 0x0a8f;
  13424. t.eharmenian = 0x0567;
  13425. t.ehbopomofo = 0x311d;
  13426. t.ehiragana = 0x3048;
  13427. t.ehookabove = 0x1ebb;
  13428. t.eibopomofo = 0x311f;
  13429. t.eight = 0x0038;
  13430. t.eightarabic = 0x0668;
  13431. t.eightbengali = 0x09ee;
  13432. t.eightcircle = 0x2467;
  13433. t.eightcircleinversesansserif = 0x2791;
  13434. t.eightdeva = 0x096e;
  13435. t.eighteencircle = 0x2471;
  13436. t.eighteenparen = 0x2485;
  13437. t.eighteenperiod = 0x2499;
  13438. t.eightgujarati = 0x0aee;
  13439. t.eightgurmukhi = 0x0a6e;
  13440. t.eighthackarabic = 0x0668;
  13441. t.eighthangzhou = 0x3028;
  13442. t.eighthnotebeamed = 0x266b;
  13443. t.eightideographicparen = 0x3227;
  13444. t.eightinferior = 0x2088;
  13445. t.eightmonospace = 0xff18;
  13446. t.eightoldstyle = 0xf738;
  13447. t.eightparen = 0x247b;
  13448. t.eightperiod = 0x248f;
  13449. t.eightpersian = 0x06f8;
  13450. t.eightroman = 0x2177;
  13451. t.eightsuperior = 0x2078;
  13452. t.eightthai = 0x0e58;
  13453. t.einvertedbreve = 0x0207;
  13454. t.eiotifiedcyrillic = 0x0465;
  13455. t.ekatakana = 0x30a8;
  13456. t.ekatakanahalfwidth = 0xff74;
  13457. t.ekonkargurmukhi = 0x0a74;
  13458. t.ekorean = 0x3154;
  13459. t.elcyrillic = 0x043b;
  13460. t.element = 0x2208;
  13461. t.elevencircle = 0x246a;
  13462. t.elevenparen = 0x247e;
  13463. t.elevenperiod = 0x2492;
  13464. t.elevenroman = 0x217a;
  13465. t.ellipsis = 0x2026;
  13466. t.ellipsisvertical = 0x22ee;
  13467. t.emacron = 0x0113;
  13468. t.emacronacute = 0x1e17;
  13469. t.emacrongrave = 0x1e15;
  13470. t.emcyrillic = 0x043c;
  13471. t.emdash = 0x2014;
  13472. t.emdashvertical = 0xfe31;
  13473. t.emonospace = 0xff45;
  13474. t.emphasismarkarmenian = 0x055b;
  13475. t.emptyset = 0x2205;
  13476. t.enbopomofo = 0x3123;
  13477. t.encyrillic = 0x043d;
  13478. t.endash = 0x2013;
  13479. t.endashvertical = 0xfe32;
  13480. t.endescendercyrillic = 0x04a3;
  13481. t.eng = 0x014b;
  13482. t.engbopomofo = 0x3125;
  13483. t.enghecyrillic = 0x04a5;
  13484. t.enhookcyrillic = 0x04c8;
  13485. t.enspace = 0x2002;
  13486. t.eogonek = 0x0119;
  13487. t.eokorean = 0x3153;
  13488. t.eopen = 0x025b;
  13489. t.eopenclosed = 0x029a;
  13490. t.eopenreversed = 0x025c;
  13491. t.eopenreversedclosed = 0x025e;
  13492. t.eopenreversedhook = 0x025d;
  13493. t.eparen = 0x24a0;
  13494. t.epsilon = 0x03b5;
  13495. t.epsilontonos = 0x03ad;
  13496. t.equal = 0x003d;
  13497. t.equalmonospace = 0xff1d;
  13498. t.equalsmall = 0xfe66;
  13499. t.equalsuperior = 0x207c;
  13500. t.equivalence = 0x2261;
  13501. t.erbopomofo = 0x3126;
  13502. t.ercyrillic = 0x0440;
  13503. t.ereversed = 0x0258;
  13504. t.ereversedcyrillic = 0x044d;
  13505. t.escyrillic = 0x0441;
  13506. t.esdescendercyrillic = 0x04ab;
  13507. t.esh = 0x0283;
  13508. t.eshcurl = 0x0286;
  13509. t.eshortdeva = 0x090e;
  13510. t.eshortvowelsigndeva = 0x0946;
  13511. t.eshreversedloop = 0x01aa;
  13512. t.eshsquatreversed = 0x0285;
  13513. t.esmallhiragana = 0x3047;
  13514. t.esmallkatakana = 0x30a7;
  13515. t.esmallkatakanahalfwidth = 0xff6a;
  13516. t.estimated = 0x212e;
  13517. t.esuperior = 0xf6ec;
  13518. t.eta = 0x03b7;
  13519. t.etarmenian = 0x0568;
  13520. t.etatonos = 0x03ae;
  13521. t.eth = 0x00f0;
  13522. t.etilde = 0x1ebd;
  13523. t.etildebelow = 0x1e1b;
  13524. t.etnahtafoukhhebrew = 0x0591;
  13525. t.etnahtafoukhlefthebrew = 0x0591;
  13526. t.etnahtahebrew = 0x0591;
  13527. t.etnahtalefthebrew = 0x0591;
  13528. t.eturned = 0x01dd;
  13529. t.eukorean = 0x3161;
  13530. t.euro = 0x20ac;
  13531. t.evowelsignbengali = 0x09c7;
  13532. t.evowelsigndeva = 0x0947;
  13533. t.evowelsigngujarati = 0x0ac7;
  13534. t.exclam = 0x0021;
  13535. t.exclamarmenian = 0x055c;
  13536. t.exclamdbl = 0x203c;
  13537. t.exclamdown = 0x00a1;
  13538. t.exclamdownsmall = 0xf7a1;
  13539. t.exclammonospace = 0xff01;
  13540. t.exclamsmall = 0xf721;
  13541. t.existential = 0x2203;
  13542. t.ezh = 0x0292;
  13543. t.ezhcaron = 0x01ef;
  13544. t.ezhcurl = 0x0293;
  13545. t.ezhreversed = 0x01b9;
  13546. t.ezhtail = 0x01ba;
  13547. t.f = 0x0066;
  13548. t.fadeva = 0x095e;
  13549. t.fagurmukhi = 0x0a5e;
  13550. t.fahrenheit = 0x2109;
  13551. t.fathaarabic = 0x064e;
  13552. t.fathalowarabic = 0x064e;
  13553. t.fathatanarabic = 0x064b;
  13554. t.fbopomofo = 0x3108;
  13555. t.fcircle = 0x24d5;
  13556. t.fdotaccent = 0x1e1f;
  13557. t.feharabic = 0x0641;
  13558. t.feharmenian = 0x0586;
  13559. t.fehfinalarabic = 0xfed2;
  13560. t.fehinitialarabic = 0xfed3;
  13561. t.fehmedialarabic = 0xfed4;
  13562. t.feicoptic = 0x03e5;
  13563. t.female = 0x2640;
  13564. t.ff = 0xfb00;
  13565. t.f_f = 0xfb00;
  13566. t.ffi = 0xfb03;
  13567. t.f_f_i = 0xfb03;
  13568. t.ffl = 0xfb04;
  13569. t.f_f_l = 0xfb04;
  13570. t.fi = 0xfb01;
  13571. t.f_i = 0xfb01;
  13572. t.fifteencircle = 0x246e;
  13573. t.fifteenparen = 0x2482;
  13574. t.fifteenperiod = 0x2496;
  13575. t.figuredash = 0x2012;
  13576. t.filledbox = 0x25a0;
  13577. t.filledrect = 0x25ac;
  13578. t.finalkaf = 0x05da;
  13579. t.finalkafdagesh = 0xfb3a;
  13580. t.finalkafdageshhebrew = 0xfb3a;
  13581. t.finalkafhebrew = 0x05da;
  13582. t.finalmem = 0x05dd;
  13583. t.finalmemhebrew = 0x05dd;
  13584. t.finalnun = 0x05df;
  13585. t.finalnunhebrew = 0x05df;
  13586. t.finalpe = 0x05e3;
  13587. t.finalpehebrew = 0x05e3;
  13588. t.finaltsadi = 0x05e5;
  13589. t.finaltsadihebrew = 0x05e5;
  13590. t.firsttonechinese = 0x02c9;
  13591. t.fisheye = 0x25c9;
  13592. t.fitacyrillic = 0x0473;
  13593. t.five = 0x0035;
  13594. t.fivearabic = 0x0665;
  13595. t.fivebengali = 0x09eb;
  13596. t.fivecircle = 0x2464;
  13597. t.fivecircleinversesansserif = 0x278e;
  13598. t.fivedeva = 0x096b;
  13599. t.fiveeighths = 0x215d;
  13600. t.fivegujarati = 0x0aeb;
  13601. t.fivegurmukhi = 0x0a6b;
  13602. t.fivehackarabic = 0x0665;
  13603. t.fivehangzhou = 0x3025;
  13604. t.fiveideographicparen = 0x3224;
  13605. t.fiveinferior = 0x2085;
  13606. t.fivemonospace = 0xff15;
  13607. t.fiveoldstyle = 0xf735;
  13608. t.fiveparen = 0x2478;
  13609. t.fiveperiod = 0x248c;
  13610. t.fivepersian = 0x06f5;
  13611. t.fiveroman = 0x2174;
  13612. t.fivesuperior = 0x2075;
  13613. t.fivethai = 0x0e55;
  13614. t.fl = 0xfb02;
  13615. t.f_l = 0xfb02;
  13616. t.florin = 0x0192;
  13617. t.fmonospace = 0xff46;
  13618. t.fmsquare = 0x3399;
  13619. t.fofanthai = 0x0e1f;
  13620. t.fofathai = 0x0e1d;
  13621. t.fongmanthai = 0x0e4f;
  13622. t.forall = 0x2200;
  13623. t.four = 0x0034;
  13624. t.fourarabic = 0x0664;
  13625. t.fourbengali = 0x09ea;
  13626. t.fourcircle = 0x2463;
  13627. t.fourcircleinversesansserif = 0x278d;
  13628. t.fourdeva = 0x096a;
  13629. t.fourgujarati = 0x0aea;
  13630. t.fourgurmukhi = 0x0a6a;
  13631. t.fourhackarabic = 0x0664;
  13632. t.fourhangzhou = 0x3024;
  13633. t.fourideographicparen = 0x3223;
  13634. t.fourinferior = 0x2084;
  13635. t.fourmonospace = 0xff14;
  13636. t.fournumeratorbengali = 0x09f7;
  13637. t.fouroldstyle = 0xf734;
  13638. t.fourparen = 0x2477;
  13639. t.fourperiod = 0x248b;
  13640. t.fourpersian = 0x06f4;
  13641. t.fourroman = 0x2173;
  13642. t.foursuperior = 0x2074;
  13643. t.fourteencircle = 0x246d;
  13644. t.fourteenparen = 0x2481;
  13645. t.fourteenperiod = 0x2495;
  13646. t.fourthai = 0x0e54;
  13647. t.fourthtonechinese = 0x02cb;
  13648. t.fparen = 0x24a1;
  13649. t.fraction = 0x2044;
  13650. t.franc = 0x20a3;
  13651. t.g = 0x0067;
  13652. t.gabengali = 0x0997;
  13653. t.gacute = 0x01f5;
  13654. t.gadeva = 0x0917;
  13655. t.gafarabic = 0x06af;
  13656. t.gaffinalarabic = 0xfb93;
  13657. t.gafinitialarabic = 0xfb94;
  13658. t.gafmedialarabic = 0xfb95;
  13659. t.gagujarati = 0x0a97;
  13660. t.gagurmukhi = 0x0a17;
  13661. t.gahiragana = 0x304c;
  13662. t.gakatakana = 0x30ac;
  13663. t.gamma = 0x03b3;
  13664. t.gammalatinsmall = 0x0263;
  13665. t.gammasuperior = 0x02e0;
  13666. t.gangiacoptic = 0x03eb;
  13667. t.gbopomofo = 0x310d;
  13668. t.gbreve = 0x011f;
  13669. t.gcaron = 0x01e7;
  13670. t.gcedilla = 0x0123;
  13671. t.gcircle = 0x24d6;
  13672. t.gcircumflex = 0x011d;
  13673. t.gcommaaccent = 0x0123;
  13674. t.gdot = 0x0121;
  13675. t.gdotaccent = 0x0121;
  13676. t.gecyrillic = 0x0433;
  13677. t.gehiragana = 0x3052;
  13678. t.gekatakana = 0x30b2;
  13679. t.geometricallyequal = 0x2251;
  13680. t.gereshaccenthebrew = 0x059c;
  13681. t.gereshhebrew = 0x05f3;
  13682. t.gereshmuqdamhebrew = 0x059d;
  13683. t.germandbls = 0x00df;
  13684. t.gershayimaccenthebrew = 0x059e;
  13685. t.gershayimhebrew = 0x05f4;
  13686. t.getamark = 0x3013;
  13687. t.ghabengali = 0x0998;
  13688. t.ghadarmenian = 0x0572;
  13689. t.ghadeva = 0x0918;
  13690. t.ghagujarati = 0x0a98;
  13691. t.ghagurmukhi = 0x0a18;
  13692. t.ghainarabic = 0x063a;
  13693. t.ghainfinalarabic = 0xfece;
  13694. t.ghaininitialarabic = 0xfecf;
  13695. t.ghainmedialarabic = 0xfed0;
  13696. t.ghemiddlehookcyrillic = 0x0495;
  13697. t.ghestrokecyrillic = 0x0493;
  13698. t.gheupturncyrillic = 0x0491;
  13699. t.ghhadeva = 0x095a;
  13700. t.ghhagurmukhi = 0x0a5a;
  13701. t.ghook = 0x0260;
  13702. t.ghzsquare = 0x3393;
  13703. t.gihiragana = 0x304e;
  13704. t.gikatakana = 0x30ae;
  13705. t.gimarmenian = 0x0563;
  13706. t.gimel = 0x05d2;
  13707. t.gimeldagesh = 0xfb32;
  13708. t.gimeldageshhebrew = 0xfb32;
  13709. t.gimelhebrew = 0x05d2;
  13710. t.gjecyrillic = 0x0453;
  13711. t.glottalinvertedstroke = 0x01be;
  13712. t.glottalstop = 0x0294;
  13713. t.glottalstopinverted = 0x0296;
  13714. t.glottalstopmod = 0x02c0;
  13715. t.glottalstopreversed = 0x0295;
  13716. t.glottalstopreversedmod = 0x02c1;
  13717. t.glottalstopreversedsuperior = 0x02e4;
  13718. t.glottalstopstroke = 0x02a1;
  13719. t.glottalstopstrokereversed = 0x02a2;
  13720. t.gmacron = 0x1e21;
  13721. t.gmonospace = 0xff47;
  13722. t.gohiragana = 0x3054;
  13723. t.gokatakana = 0x30b4;
  13724. t.gparen = 0x24a2;
  13725. t.gpasquare = 0x33ac;
  13726. t.gradient = 0x2207;
  13727. t.grave = 0x0060;
  13728. t.gravebelowcmb = 0x0316;
  13729. t.gravecmb = 0x0300;
  13730. t.gravecomb = 0x0300;
  13731. t.gravedeva = 0x0953;
  13732. t.gravelowmod = 0x02ce;
  13733. t.gravemonospace = 0xff40;
  13734. t.gravetonecmb = 0x0340;
  13735. t.greater = 0x003e;
  13736. t.greaterequal = 0x2265;
  13737. t.greaterequalorless = 0x22db;
  13738. t.greatermonospace = 0xff1e;
  13739. t.greaterorequivalent = 0x2273;
  13740. t.greaterorless = 0x2277;
  13741. t.greateroverequal = 0x2267;
  13742. t.greatersmall = 0xfe65;
  13743. t.gscript = 0x0261;
  13744. t.gstroke = 0x01e5;
  13745. t.guhiragana = 0x3050;
  13746. t.guillemotleft = 0x00ab;
  13747. t.guillemotright = 0x00bb;
  13748. t.guilsinglleft = 0x2039;
  13749. t.guilsinglright = 0x203a;
  13750. t.gukatakana = 0x30b0;
  13751. t.guramusquare = 0x3318;
  13752. t.gysquare = 0x33c9;
  13753. t.h = 0x0068;
  13754. t.haabkhasiancyrillic = 0x04a9;
  13755. t.haaltonearabic = 0x06c1;
  13756. t.habengali = 0x09b9;
  13757. t.hadescendercyrillic = 0x04b3;
  13758. t.hadeva = 0x0939;
  13759. t.hagujarati = 0x0ab9;
  13760. t.hagurmukhi = 0x0a39;
  13761. t.haharabic = 0x062d;
  13762. t.hahfinalarabic = 0xfea2;
  13763. t.hahinitialarabic = 0xfea3;
  13764. t.hahiragana = 0x306f;
  13765. t.hahmedialarabic = 0xfea4;
  13766. t.haitusquare = 0x332a;
  13767. t.hakatakana = 0x30cf;
  13768. t.hakatakanahalfwidth = 0xff8a;
  13769. t.halantgurmukhi = 0x0a4d;
  13770. t.hamzaarabic = 0x0621;
  13771. t.hamzalowarabic = 0x0621;
  13772. t.hangulfiller = 0x3164;
  13773. t.hardsigncyrillic = 0x044a;
  13774. t.harpoonleftbarbup = 0x21bc;
  13775. t.harpoonrightbarbup = 0x21c0;
  13776. t.hasquare = 0x33ca;
  13777. t.hatafpatah = 0x05b2;
  13778. t.hatafpatah16 = 0x05b2;
  13779. t.hatafpatah23 = 0x05b2;
  13780. t.hatafpatah2f = 0x05b2;
  13781. t.hatafpatahhebrew = 0x05b2;
  13782. t.hatafpatahnarrowhebrew = 0x05b2;
  13783. t.hatafpatahquarterhebrew = 0x05b2;
  13784. t.hatafpatahwidehebrew = 0x05b2;
  13785. t.hatafqamats = 0x05b3;
  13786. t.hatafqamats1b = 0x05b3;
  13787. t.hatafqamats28 = 0x05b3;
  13788. t.hatafqamats34 = 0x05b3;
  13789. t.hatafqamatshebrew = 0x05b3;
  13790. t.hatafqamatsnarrowhebrew = 0x05b3;
  13791. t.hatafqamatsquarterhebrew = 0x05b3;
  13792. t.hatafqamatswidehebrew = 0x05b3;
  13793. t.hatafsegol = 0x05b1;
  13794. t.hatafsegol17 = 0x05b1;
  13795. t.hatafsegol24 = 0x05b1;
  13796. t.hatafsegol30 = 0x05b1;
  13797. t.hatafsegolhebrew = 0x05b1;
  13798. t.hatafsegolnarrowhebrew = 0x05b1;
  13799. t.hatafsegolquarterhebrew = 0x05b1;
  13800. t.hatafsegolwidehebrew = 0x05b1;
  13801. t.hbar = 0x0127;
  13802. t.hbopomofo = 0x310f;
  13803. t.hbrevebelow = 0x1e2b;
  13804. t.hcedilla = 0x1e29;
  13805. t.hcircle = 0x24d7;
  13806. t.hcircumflex = 0x0125;
  13807. t.hdieresis = 0x1e27;
  13808. t.hdotaccent = 0x1e23;
  13809. t.hdotbelow = 0x1e25;
  13810. t.he = 0x05d4;
  13811. t.heart = 0x2665;
  13812. t.heartsuitblack = 0x2665;
  13813. t.heartsuitwhite = 0x2661;
  13814. t.hedagesh = 0xfb34;
  13815. t.hedageshhebrew = 0xfb34;
  13816. t.hehaltonearabic = 0x06c1;
  13817. t.heharabic = 0x0647;
  13818. t.hehebrew = 0x05d4;
  13819. t.hehfinalaltonearabic = 0xfba7;
  13820. t.hehfinalalttwoarabic = 0xfeea;
  13821. t.hehfinalarabic = 0xfeea;
  13822. t.hehhamzaabovefinalarabic = 0xfba5;
  13823. t.hehhamzaaboveisolatedarabic = 0xfba4;
  13824. t.hehinitialaltonearabic = 0xfba8;
  13825. t.hehinitialarabic = 0xfeeb;
  13826. t.hehiragana = 0x3078;
  13827. t.hehmedialaltonearabic = 0xfba9;
  13828. t.hehmedialarabic = 0xfeec;
  13829. t.heiseierasquare = 0x337b;
  13830. t.hekatakana = 0x30d8;
  13831. t.hekatakanahalfwidth = 0xff8d;
  13832. t.hekutaarusquare = 0x3336;
  13833. t.henghook = 0x0267;
  13834. t.herutusquare = 0x3339;
  13835. t.het = 0x05d7;
  13836. t.hethebrew = 0x05d7;
  13837. t.hhook = 0x0266;
  13838. t.hhooksuperior = 0x02b1;
  13839. t.hieuhacirclekorean = 0x327b;
  13840. t.hieuhaparenkorean = 0x321b;
  13841. t.hieuhcirclekorean = 0x326d;
  13842. t.hieuhkorean = 0x314e;
  13843. t.hieuhparenkorean = 0x320d;
  13844. t.hihiragana = 0x3072;
  13845. t.hikatakana = 0x30d2;
  13846. t.hikatakanahalfwidth = 0xff8b;
  13847. t.hiriq = 0x05b4;
  13848. t.hiriq14 = 0x05b4;
  13849. t.hiriq21 = 0x05b4;
  13850. t.hiriq2d = 0x05b4;
  13851. t.hiriqhebrew = 0x05b4;
  13852. t.hiriqnarrowhebrew = 0x05b4;
  13853. t.hiriqquarterhebrew = 0x05b4;
  13854. t.hiriqwidehebrew = 0x05b4;
  13855. t.hlinebelow = 0x1e96;
  13856. t.hmonospace = 0xff48;
  13857. t.hoarmenian = 0x0570;
  13858. t.hohipthai = 0x0e2b;
  13859. t.hohiragana = 0x307b;
  13860. t.hokatakana = 0x30db;
  13861. t.hokatakanahalfwidth = 0xff8e;
  13862. t.holam = 0x05b9;
  13863. t.holam19 = 0x05b9;
  13864. t.holam26 = 0x05b9;
  13865. t.holam32 = 0x05b9;
  13866. t.holamhebrew = 0x05b9;
  13867. t.holamnarrowhebrew = 0x05b9;
  13868. t.holamquarterhebrew = 0x05b9;
  13869. t.holamwidehebrew = 0x05b9;
  13870. t.honokhukthai = 0x0e2e;
  13871. t.hookabovecomb = 0x0309;
  13872. t.hookcmb = 0x0309;
  13873. t.hookpalatalizedbelowcmb = 0x0321;
  13874. t.hookretroflexbelowcmb = 0x0322;
  13875. t.hoonsquare = 0x3342;
  13876. t.horicoptic = 0x03e9;
  13877. t.horizontalbar = 0x2015;
  13878. t.horncmb = 0x031b;
  13879. t.hotsprings = 0x2668;
  13880. t.house = 0x2302;
  13881. t.hparen = 0x24a3;
  13882. t.hsuperior = 0x02b0;
  13883. t.hturned = 0x0265;
  13884. t.huhiragana = 0x3075;
  13885. t.huiitosquare = 0x3333;
  13886. t.hukatakana = 0x30d5;
  13887. t.hukatakanahalfwidth = 0xff8c;
  13888. t.hungarumlaut = 0x02dd;
  13889. t.hungarumlautcmb = 0x030b;
  13890. t.hv = 0x0195;
  13891. t.hyphen = 0x002d;
  13892. t.hypheninferior = 0xf6e5;
  13893. t.hyphenmonospace = 0xff0d;
  13894. t.hyphensmall = 0xfe63;
  13895. t.hyphensuperior = 0xf6e6;
  13896. t.hyphentwo = 0x2010;
  13897. t.i = 0x0069;
  13898. t.iacute = 0x00ed;
  13899. t.iacyrillic = 0x044f;
  13900. t.ibengali = 0x0987;
  13901. t.ibopomofo = 0x3127;
  13902. t.ibreve = 0x012d;
  13903. t.icaron = 0x01d0;
  13904. t.icircle = 0x24d8;
  13905. t.icircumflex = 0x00ee;
  13906. t.icyrillic = 0x0456;
  13907. t.idblgrave = 0x0209;
  13908. t.ideographearthcircle = 0x328f;
  13909. t.ideographfirecircle = 0x328b;
  13910. t.ideographicallianceparen = 0x323f;
  13911. t.ideographiccallparen = 0x323a;
  13912. t.ideographiccentrecircle = 0x32a5;
  13913. t.ideographicclose = 0x3006;
  13914. t.ideographiccomma = 0x3001;
  13915. t.ideographiccommaleft = 0xff64;
  13916. t.ideographiccongratulationparen = 0x3237;
  13917. t.ideographiccorrectcircle = 0x32a3;
  13918. t.ideographicearthparen = 0x322f;
  13919. t.ideographicenterpriseparen = 0x323d;
  13920. t.ideographicexcellentcircle = 0x329d;
  13921. t.ideographicfestivalparen = 0x3240;
  13922. t.ideographicfinancialcircle = 0x3296;
  13923. t.ideographicfinancialparen = 0x3236;
  13924. t.ideographicfireparen = 0x322b;
  13925. t.ideographichaveparen = 0x3232;
  13926. t.ideographichighcircle = 0x32a4;
  13927. t.ideographiciterationmark = 0x3005;
  13928. t.ideographiclaborcircle = 0x3298;
  13929. t.ideographiclaborparen = 0x3238;
  13930. t.ideographicleftcircle = 0x32a7;
  13931. t.ideographiclowcircle = 0x32a6;
  13932. t.ideographicmedicinecircle = 0x32a9;
  13933. t.ideographicmetalparen = 0x322e;
  13934. t.ideographicmoonparen = 0x322a;
  13935. t.ideographicnameparen = 0x3234;
  13936. t.ideographicperiod = 0x3002;
  13937. t.ideographicprintcircle = 0x329e;
  13938. t.ideographicreachparen = 0x3243;
  13939. t.ideographicrepresentparen = 0x3239;
  13940. t.ideographicresourceparen = 0x323e;
  13941. t.ideographicrightcircle = 0x32a8;
  13942. t.ideographicsecretcircle = 0x3299;
  13943. t.ideographicselfparen = 0x3242;
  13944. t.ideographicsocietyparen = 0x3233;
  13945. t.ideographicspace = 0x3000;
  13946. t.ideographicspecialparen = 0x3235;
  13947. t.ideographicstockparen = 0x3231;
  13948. t.ideographicstudyparen = 0x323b;
  13949. t.ideographicsunparen = 0x3230;
  13950. t.ideographicsuperviseparen = 0x323c;
  13951. t.ideographicwaterparen = 0x322c;
  13952. t.ideographicwoodparen = 0x322d;
  13953. t.ideographiczero = 0x3007;
  13954. t.ideographmetalcircle = 0x328e;
  13955. t.ideographmooncircle = 0x328a;
  13956. t.ideographnamecircle = 0x3294;
  13957. t.ideographsuncircle = 0x3290;
  13958. t.ideographwatercircle = 0x328c;
  13959. t.ideographwoodcircle = 0x328d;
  13960. t.ideva = 0x0907;
  13961. t.idieresis = 0x00ef;
  13962. t.idieresisacute = 0x1e2f;
  13963. t.idieresiscyrillic = 0x04e5;
  13964. t.idotbelow = 0x1ecb;
  13965. t.iebrevecyrillic = 0x04d7;
  13966. t.iecyrillic = 0x0435;
  13967. t.ieungacirclekorean = 0x3275;
  13968. t.ieungaparenkorean = 0x3215;
  13969. t.ieungcirclekorean = 0x3267;
  13970. t.ieungkorean = 0x3147;
  13971. t.ieungparenkorean = 0x3207;
  13972. t.igrave = 0x00ec;
  13973. t.igujarati = 0x0a87;
  13974. t.igurmukhi = 0x0a07;
  13975. t.ihiragana = 0x3044;
  13976. t.ihookabove = 0x1ec9;
  13977. t.iibengali = 0x0988;
  13978. t.iicyrillic = 0x0438;
  13979. t.iideva = 0x0908;
  13980. t.iigujarati = 0x0a88;
  13981. t.iigurmukhi = 0x0a08;
  13982. t.iimatragurmukhi = 0x0a40;
  13983. t.iinvertedbreve = 0x020b;
  13984. t.iishortcyrillic = 0x0439;
  13985. t.iivowelsignbengali = 0x09c0;
  13986. t.iivowelsigndeva = 0x0940;
  13987. t.iivowelsigngujarati = 0x0ac0;
  13988. t.ij = 0x0133;
  13989. t.ikatakana = 0x30a4;
  13990. t.ikatakanahalfwidth = 0xff72;
  13991. t.ikorean = 0x3163;
  13992. t.ilde = 0x02dc;
  13993. t.iluyhebrew = 0x05ac;
  13994. t.imacron = 0x012b;
  13995. t.imacroncyrillic = 0x04e3;
  13996. t.imageorapproximatelyequal = 0x2253;
  13997. t.imatragurmukhi = 0x0a3f;
  13998. t.imonospace = 0xff49;
  13999. t.increment = 0x2206;
  14000. t.infinity = 0x221e;
  14001. t.iniarmenian = 0x056b;
  14002. t.integral = 0x222b;
  14003. t.integralbottom = 0x2321;
  14004. t.integralbt = 0x2321;
  14005. t.integralex = 0xf8f5;
  14006. t.integraltop = 0x2320;
  14007. t.integraltp = 0x2320;
  14008. t.intersection = 0x2229;
  14009. t.intisquare = 0x3305;
  14010. t.invbullet = 0x25d8;
  14011. t.invcircle = 0x25d9;
  14012. t.invsmileface = 0x263b;
  14013. t.iocyrillic = 0x0451;
  14014. t.iogonek = 0x012f;
  14015. t.iota = 0x03b9;
  14016. t.iotadieresis = 0x03ca;
  14017. t.iotadieresistonos = 0x0390;
  14018. t.iotalatin = 0x0269;
  14019. t.iotatonos = 0x03af;
  14020. t.iparen = 0x24a4;
  14021. t.irigurmukhi = 0x0a72;
  14022. t.ismallhiragana = 0x3043;
  14023. t.ismallkatakana = 0x30a3;
  14024. t.ismallkatakanahalfwidth = 0xff68;
  14025. t.issharbengali = 0x09fa;
  14026. t.istroke = 0x0268;
  14027. t.isuperior = 0xf6ed;
  14028. t.iterationhiragana = 0x309d;
  14029. t.iterationkatakana = 0x30fd;
  14030. t.itilde = 0x0129;
  14031. t.itildebelow = 0x1e2d;
  14032. t.iubopomofo = 0x3129;
  14033. t.iucyrillic = 0x044e;
  14034. t.ivowelsignbengali = 0x09bf;
  14035. t.ivowelsigndeva = 0x093f;
  14036. t.ivowelsigngujarati = 0x0abf;
  14037. t.izhitsacyrillic = 0x0475;
  14038. t.izhitsadblgravecyrillic = 0x0477;
  14039. t.j = 0x006a;
  14040. t.jaarmenian = 0x0571;
  14041. t.jabengali = 0x099c;
  14042. t.jadeva = 0x091c;
  14043. t.jagujarati = 0x0a9c;
  14044. t.jagurmukhi = 0x0a1c;
  14045. t.jbopomofo = 0x3110;
  14046. t.jcaron = 0x01f0;
  14047. t.jcircle = 0x24d9;
  14048. t.jcircumflex = 0x0135;
  14049. t.jcrossedtail = 0x029d;
  14050. t.jdotlessstroke = 0x025f;
  14051. t.jecyrillic = 0x0458;
  14052. t.jeemarabic = 0x062c;
  14053. t.jeemfinalarabic = 0xfe9e;
  14054. t.jeeminitialarabic = 0xfe9f;
  14055. t.jeemmedialarabic = 0xfea0;
  14056. t.jeharabic = 0x0698;
  14057. t.jehfinalarabic = 0xfb8b;
  14058. t.jhabengali = 0x099d;
  14059. t.jhadeva = 0x091d;
  14060. t.jhagujarati = 0x0a9d;
  14061. t.jhagurmukhi = 0x0a1d;
  14062. t.jheharmenian = 0x057b;
  14063. t.jis = 0x3004;
  14064. t.jmonospace = 0xff4a;
  14065. t.jparen = 0x24a5;
  14066. t.jsuperior = 0x02b2;
  14067. t.k = 0x006b;
  14068. t.kabashkircyrillic = 0x04a1;
  14069. t.kabengali = 0x0995;
  14070. t.kacute = 0x1e31;
  14071. t.kacyrillic = 0x043a;
  14072. t.kadescendercyrillic = 0x049b;
  14073. t.kadeva = 0x0915;
  14074. t.kaf = 0x05db;
  14075. t.kafarabic = 0x0643;
  14076. t.kafdagesh = 0xfb3b;
  14077. t.kafdageshhebrew = 0xfb3b;
  14078. t.kaffinalarabic = 0xfeda;
  14079. t.kafhebrew = 0x05db;
  14080. t.kafinitialarabic = 0xfedb;
  14081. t.kafmedialarabic = 0xfedc;
  14082. t.kafrafehebrew = 0xfb4d;
  14083. t.kagujarati = 0x0a95;
  14084. t.kagurmukhi = 0x0a15;
  14085. t.kahiragana = 0x304b;
  14086. t.kahookcyrillic = 0x04c4;
  14087. t.kakatakana = 0x30ab;
  14088. t.kakatakanahalfwidth = 0xff76;
  14089. t.kappa = 0x03ba;
  14090. t.kappasymbolgreek = 0x03f0;
  14091. t.kapyeounmieumkorean = 0x3171;
  14092. t.kapyeounphieuphkorean = 0x3184;
  14093. t.kapyeounpieupkorean = 0x3178;
  14094. t.kapyeounssangpieupkorean = 0x3179;
  14095. t.karoriisquare = 0x330d;
  14096. t.kashidaautoarabic = 0x0640;
  14097. t.kashidaautonosidebearingarabic = 0x0640;
  14098. t.kasmallkatakana = 0x30f5;
  14099. t.kasquare = 0x3384;
  14100. t.kasraarabic = 0x0650;
  14101. t.kasratanarabic = 0x064d;
  14102. t.kastrokecyrillic = 0x049f;
  14103. t.katahiraprolongmarkhalfwidth = 0xff70;
  14104. t.kaverticalstrokecyrillic = 0x049d;
  14105. t.kbopomofo = 0x310e;
  14106. t.kcalsquare = 0x3389;
  14107. t.kcaron = 0x01e9;
  14108. t.kcedilla = 0x0137;
  14109. t.kcircle = 0x24da;
  14110. t.kcommaaccent = 0x0137;
  14111. t.kdotbelow = 0x1e33;
  14112. t.keharmenian = 0x0584;
  14113. t.kehiragana = 0x3051;
  14114. t.kekatakana = 0x30b1;
  14115. t.kekatakanahalfwidth = 0xff79;
  14116. t.kenarmenian = 0x056f;
  14117. t.kesmallkatakana = 0x30f6;
  14118. t.kgreenlandic = 0x0138;
  14119. t.khabengali = 0x0996;
  14120. t.khacyrillic = 0x0445;
  14121. t.khadeva = 0x0916;
  14122. t.khagujarati = 0x0a96;
  14123. t.khagurmukhi = 0x0a16;
  14124. t.khaharabic = 0x062e;
  14125. t.khahfinalarabic = 0xfea6;
  14126. t.khahinitialarabic = 0xfea7;
  14127. t.khahmedialarabic = 0xfea8;
  14128. t.kheicoptic = 0x03e7;
  14129. t.khhadeva = 0x0959;
  14130. t.khhagurmukhi = 0x0a59;
  14131. t.khieukhacirclekorean = 0x3278;
  14132. t.khieukhaparenkorean = 0x3218;
  14133. t.khieukhcirclekorean = 0x326a;
  14134. t.khieukhkorean = 0x314b;
  14135. t.khieukhparenkorean = 0x320a;
  14136. t.khokhaithai = 0x0e02;
  14137. t.khokhonthai = 0x0e05;
  14138. t.khokhuatthai = 0x0e03;
  14139. t.khokhwaithai = 0x0e04;
  14140. t.khomutthai = 0x0e5b;
  14141. t.khook = 0x0199;
  14142. t.khorakhangthai = 0x0e06;
  14143. t.khzsquare = 0x3391;
  14144. t.kihiragana = 0x304d;
  14145. t.kikatakana = 0x30ad;
  14146. t.kikatakanahalfwidth = 0xff77;
  14147. t.kiroguramusquare = 0x3315;
  14148. t.kiromeetorusquare = 0x3316;
  14149. t.kirosquare = 0x3314;
  14150. t.kiyeokacirclekorean = 0x326e;
  14151. t.kiyeokaparenkorean = 0x320e;
  14152. t.kiyeokcirclekorean = 0x3260;
  14153. t.kiyeokkorean = 0x3131;
  14154. t.kiyeokparenkorean = 0x3200;
  14155. t.kiyeoksioskorean = 0x3133;
  14156. t.kjecyrillic = 0x045c;
  14157. t.klinebelow = 0x1e35;
  14158. t.klsquare = 0x3398;
  14159. t.kmcubedsquare = 0x33a6;
  14160. t.kmonospace = 0xff4b;
  14161. t.kmsquaredsquare = 0x33a2;
  14162. t.kohiragana = 0x3053;
  14163. t.kohmsquare = 0x33c0;
  14164. t.kokaithai = 0x0e01;
  14165. t.kokatakana = 0x30b3;
  14166. t.kokatakanahalfwidth = 0xff7a;
  14167. t.kooposquare = 0x331e;
  14168. t.koppacyrillic = 0x0481;
  14169. t.koreanstandardsymbol = 0x327f;
  14170. t.koroniscmb = 0x0343;
  14171. t.kparen = 0x24a6;
  14172. t.kpasquare = 0x33aa;
  14173. t.ksicyrillic = 0x046f;
  14174. t.ktsquare = 0x33cf;
  14175. t.kturned = 0x029e;
  14176. t.kuhiragana = 0x304f;
  14177. t.kukatakana = 0x30af;
  14178. t.kukatakanahalfwidth = 0xff78;
  14179. t.kvsquare = 0x33b8;
  14180. t.kwsquare = 0x33be;
  14181. t.l = 0x006c;
  14182. t.labengali = 0x09b2;
  14183. t.lacute = 0x013a;
  14184. t.ladeva = 0x0932;
  14185. t.lagujarati = 0x0ab2;
  14186. t.lagurmukhi = 0x0a32;
  14187. t.lakkhangyaothai = 0x0e45;
  14188. t.lamaleffinalarabic = 0xfefc;
  14189. t.lamalefhamzaabovefinalarabic = 0xfef8;
  14190. t.lamalefhamzaaboveisolatedarabic = 0xfef7;
  14191. t.lamalefhamzabelowfinalarabic = 0xfefa;
  14192. t.lamalefhamzabelowisolatedarabic = 0xfef9;
  14193. t.lamalefisolatedarabic = 0xfefb;
  14194. t.lamalefmaddaabovefinalarabic = 0xfef6;
  14195. t.lamalefmaddaaboveisolatedarabic = 0xfef5;
  14196. t.lamarabic = 0x0644;
  14197. t.lambda = 0x03bb;
  14198. t.lambdastroke = 0x019b;
  14199. t.lamed = 0x05dc;
  14200. t.lameddagesh = 0xfb3c;
  14201. t.lameddageshhebrew = 0xfb3c;
  14202. t.lamedhebrew = 0x05dc;
  14203. t.lamfinalarabic = 0xfede;
  14204. t.lamhahinitialarabic = 0xfcca;
  14205. t.laminitialarabic = 0xfedf;
  14206. t.lamjeeminitialarabic = 0xfcc9;
  14207. t.lamkhahinitialarabic = 0xfccb;
  14208. t.lamlamhehisolatedarabic = 0xfdf2;
  14209. t.lammedialarabic = 0xfee0;
  14210. t.lammeemhahinitialarabic = 0xfd88;
  14211. t.lammeeminitialarabic = 0xfccc;
  14212. t.largecircle = 0x25ef;
  14213. t.lbar = 0x019a;
  14214. t.lbelt = 0x026c;
  14215. t.lbopomofo = 0x310c;
  14216. t.lcaron = 0x013e;
  14217. t.lcedilla = 0x013c;
  14218. t.lcircle = 0x24db;
  14219. t.lcircumflexbelow = 0x1e3d;
  14220. t.lcommaaccent = 0x013c;
  14221. t.ldot = 0x0140;
  14222. t.ldotaccent = 0x0140;
  14223. t.ldotbelow = 0x1e37;
  14224. t.ldotbelowmacron = 0x1e39;
  14225. t.leftangleabovecmb = 0x031a;
  14226. t.lefttackbelowcmb = 0x0318;
  14227. t.less = 0x003c;
  14228. t.lessequal = 0x2264;
  14229. t.lessequalorgreater = 0x22da;
  14230. t.lessmonospace = 0xff1c;
  14231. t.lessorequivalent = 0x2272;
  14232. t.lessorgreater = 0x2276;
  14233. t.lessoverequal = 0x2266;
  14234. t.lesssmall = 0xfe64;
  14235. t.lezh = 0x026e;
  14236. t.lfblock = 0x258c;
  14237. t.lhookretroflex = 0x026d;
  14238. t.lira = 0x20a4;
  14239. t.liwnarmenian = 0x056c;
  14240. t.lj = 0x01c9;
  14241. t.ljecyrillic = 0x0459;
  14242. t.ll = 0xf6c0;
  14243. t.lladeva = 0x0933;
  14244. t.llagujarati = 0x0ab3;
  14245. t.llinebelow = 0x1e3b;
  14246. t.llladeva = 0x0934;
  14247. t.llvocalicbengali = 0x09e1;
  14248. t.llvocalicdeva = 0x0961;
  14249. t.llvocalicvowelsignbengali = 0x09e3;
  14250. t.llvocalicvowelsigndeva = 0x0963;
  14251. t.lmiddletilde = 0x026b;
  14252. t.lmonospace = 0xff4c;
  14253. t.lmsquare = 0x33d0;
  14254. t.lochulathai = 0x0e2c;
  14255. t.logicaland = 0x2227;
  14256. t.logicalnot = 0x00ac;
  14257. t.logicalnotreversed = 0x2310;
  14258. t.logicalor = 0x2228;
  14259. t.lolingthai = 0x0e25;
  14260. t.longs = 0x017f;
  14261. t.lowlinecenterline = 0xfe4e;
  14262. t.lowlinecmb = 0x0332;
  14263. t.lowlinedashed = 0xfe4d;
  14264. t.lozenge = 0x25ca;
  14265. t.lparen = 0x24a7;
  14266. t.lslash = 0x0142;
  14267. t.lsquare = 0x2113;
  14268. t.lsuperior = 0xf6ee;
  14269. t.ltshade = 0x2591;
  14270. t.luthai = 0x0e26;
  14271. t.lvocalicbengali = 0x098c;
  14272. t.lvocalicdeva = 0x090c;
  14273. t.lvocalicvowelsignbengali = 0x09e2;
  14274. t.lvocalicvowelsigndeva = 0x0962;
  14275. t.lxsquare = 0x33d3;
  14276. t.m = 0x006d;
  14277. t.mabengali = 0x09ae;
  14278. t.macron = 0x00af;
  14279. t.macronbelowcmb = 0x0331;
  14280. t.macroncmb = 0x0304;
  14281. t.macronlowmod = 0x02cd;
  14282. t.macronmonospace = 0xffe3;
  14283. t.macute = 0x1e3f;
  14284. t.madeva = 0x092e;
  14285. t.magujarati = 0x0aae;
  14286. t.magurmukhi = 0x0a2e;
  14287. t.mahapakhhebrew = 0x05a4;
  14288. t.mahapakhlefthebrew = 0x05a4;
  14289. t.mahiragana = 0x307e;
  14290. t.maichattawalowleftthai = 0xf895;
  14291. t.maichattawalowrightthai = 0xf894;
  14292. t.maichattawathai = 0x0e4b;
  14293. t.maichattawaupperleftthai = 0xf893;
  14294. t.maieklowleftthai = 0xf88c;
  14295. t.maieklowrightthai = 0xf88b;
  14296. t.maiekthai = 0x0e48;
  14297. t.maiekupperleftthai = 0xf88a;
  14298. t.maihanakatleftthai = 0xf884;
  14299. t.maihanakatthai = 0x0e31;
  14300. t.maitaikhuleftthai = 0xf889;
  14301. t.maitaikhuthai = 0x0e47;
  14302. t.maitholowleftthai = 0xf88f;
  14303. t.maitholowrightthai = 0xf88e;
  14304. t.maithothai = 0x0e49;
  14305. t.maithoupperleftthai = 0xf88d;
  14306. t.maitrilowleftthai = 0xf892;
  14307. t.maitrilowrightthai = 0xf891;
  14308. t.maitrithai = 0x0e4a;
  14309. t.maitriupperleftthai = 0xf890;
  14310. t.maiyamokthai = 0x0e46;
  14311. t.makatakana = 0x30de;
  14312. t.makatakanahalfwidth = 0xff8f;
  14313. t.male = 0x2642;
  14314. t.mansyonsquare = 0x3347;
  14315. t.maqafhebrew = 0x05be;
  14316. t.mars = 0x2642;
  14317. t.masoracirclehebrew = 0x05af;
  14318. t.masquare = 0x3383;
  14319. t.mbopomofo = 0x3107;
  14320. t.mbsquare = 0x33d4;
  14321. t.mcircle = 0x24dc;
  14322. t.mcubedsquare = 0x33a5;
  14323. t.mdotaccent = 0x1e41;
  14324. t.mdotbelow = 0x1e43;
  14325. t.meemarabic = 0x0645;
  14326. t.meemfinalarabic = 0xfee2;
  14327. t.meeminitialarabic = 0xfee3;
  14328. t.meemmedialarabic = 0xfee4;
  14329. t.meemmeeminitialarabic = 0xfcd1;
  14330. t.meemmeemisolatedarabic = 0xfc48;
  14331. t.meetorusquare = 0x334d;
  14332. t.mehiragana = 0x3081;
  14333. t.meizierasquare = 0x337e;
  14334. t.mekatakana = 0x30e1;
  14335. t.mekatakanahalfwidth = 0xff92;
  14336. t.mem = 0x05de;
  14337. t.memdagesh = 0xfb3e;
  14338. t.memdageshhebrew = 0xfb3e;
  14339. t.memhebrew = 0x05de;
  14340. t.menarmenian = 0x0574;
  14341. t.merkhahebrew = 0x05a5;
  14342. t.merkhakefulahebrew = 0x05a6;
  14343. t.merkhakefulalefthebrew = 0x05a6;
  14344. t.merkhalefthebrew = 0x05a5;
  14345. t.mhook = 0x0271;
  14346. t.mhzsquare = 0x3392;
  14347. t.middledotkatakanahalfwidth = 0xff65;
  14348. t.middot = 0x00b7;
  14349. t.mieumacirclekorean = 0x3272;
  14350. t.mieumaparenkorean = 0x3212;
  14351. t.mieumcirclekorean = 0x3264;
  14352. t.mieumkorean = 0x3141;
  14353. t.mieumpansioskorean = 0x3170;
  14354. t.mieumparenkorean = 0x3204;
  14355. t.mieumpieupkorean = 0x316e;
  14356. t.mieumsioskorean = 0x316f;
  14357. t.mihiragana = 0x307f;
  14358. t.mikatakana = 0x30df;
  14359. t.mikatakanahalfwidth = 0xff90;
  14360. t.minus = 0x2212;
  14361. t.minusbelowcmb = 0x0320;
  14362. t.minuscircle = 0x2296;
  14363. t.minusmod = 0x02d7;
  14364. t.minusplus = 0x2213;
  14365. t.minute = 0x2032;
  14366. t.miribaarusquare = 0x334a;
  14367. t.mirisquare = 0x3349;
  14368. t.mlonglegturned = 0x0270;
  14369. t.mlsquare = 0x3396;
  14370. t.mmcubedsquare = 0x33a3;
  14371. t.mmonospace = 0xff4d;
  14372. t.mmsquaredsquare = 0x339f;
  14373. t.mohiragana = 0x3082;
  14374. t.mohmsquare = 0x33c1;
  14375. t.mokatakana = 0x30e2;
  14376. t.mokatakanahalfwidth = 0xff93;
  14377. t.molsquare = 0x33d6;
  14378. t.momathai = 0x0e21;
  14379. t.moverssquare = 0x33a7;
  14380. t.moverssquaredsquare = 0x33a8;
  14381. t.mparen = 0x24a8;
  14382. t.mpasquare = 0x33ab;
  14383. t.mssquare = 0x33b3;
  14384. t.msuperior = 0xf6ef;
  14385. t.mturned = 0x026f;
  14386. t.mu = 0x00b5;
  14387. t.mu1 = 0x00b5;
  14388. t.muasquare = 0x3382;
  14389. t.muchgreater = 0x226b;
  14390. t.muchless = 0x226a;
  14391. t.mufsquare = 0x338c;
  14392. t.mugreek = 0x03bc;
  14393. t.mugsquare = 0x338d;
  14394. t.muhiragana = 0x3080;
  14395. t.mukatakana = 0x30e0;
  14396. t.mukatakanahalfwidth = 0xff91;
  14397. t.mulsquare = 0x3395;
  14398. t.multiply = 0x00d7;
  14399. t.mumsquare = 0x339b;
  14400. t.munahhebrew = 0x05a3;
  14401. t.munahlefthebrew = 0x05a3;
  14402. t.musicalnote = 0x266a;
  14403. t.musicalnotedbl = 0x266b;
  14404. t.musicflatsign = 0x266d;
  14405. t.musicsharpsign = 0x266f;
  14406. t.mussquare = 0x33b2;
  14407. t.muvsquare = 0x33b6;
  14408. t.muwsquare = 0x33bc;
  14409. t.mvmegasquare = 0x33b9;
  14410. t.mvsquare = 0x33b7;
  14411. t.mwmegasquare = 0x33bf;
  14412. t.mwsquare = 0x33bd;
  14413. t.n = 0x006e;
  14414. t.nabengali = 0x09a8;
  14415. t.nabla = 0x2207;
  14416. t.nacute = 0x0144;
  14417. t.nadeva = 0x0928;
  14418. t.nagujarati = 0x0aa8;
  14419. t.nagurmukhi = 0x0a28;
  14420. t.nahiragana = 0x306a;
  14421. t.nakatakana = 0x30ca;
  14422. t.nakatakanahalfwidth = 0xff85;
  14423. t.napostrophe = 0x0149;
  14424. t.nasquare = 0x3381;
  14425. t.nbopomofo = 0x310b;
  14426. t.nbspace = 0x00a0;
  14427. t.ncaron = 0x0148;
  14428. t.ncedilla = 0x0146;
  14429. t.ncircle = 0x24dd;
  14430. t.ncircumflexbelow = 0x1e4b;
  14431. t.ncommaaccent = 0x0146;
  14432. t.ndotaccent = 0x1e45;
  14433. t.ndotbelow = 0x1e47;
  14434. t.nehiragana = 0x306d;
  14435. t.nekatakana = 0x30cd;
  14436. t.nekatakanahalfwidth = 0xff88;
  14437. t.newsheqelsign = 0x20aa;
  14438. t.nfsquare = 0x338b;
  14439. t.ngabengali = 0x0999;
  14440. t.ngadeva = 0x0919;
  14441. t.ngagujarati = 0x0a99;
  14442. t.ngagurmukhi = 0x0a19;
  14443. t.ngonguthai = 0x0e07;
  14444. t.nhiragana = 0x3093;
  14445. t.nhookleft = 0x0272;
  14446. t.nhookretroflex = 0x0273;
  14447. t.nieunacirclekorean = 0x326f;
  14448. t.nieunaparenkorean = 0x320f;
  14449. t.nieuncieuckorean = 0x3135;
  14450. t.nieuncirclekorean = 0x3261;
  14451. t.nieunhieuhkorean = 0x3136;
  14452. t.nieunkorean = 0x3134;
  14453. t.nieunpansioskorean = 0x3168;
  14454. t.nieunparenkorean = 0x3201;
  14455. t.nieunsioskorean = 0x3167;
  14456. t.nieuntikeutkorean = 0x3166;
  14457. t.nihiragana = 0x306b;
  14458. t.nikatakana = 0x30cb;
  14459. t.nikatakanahalfwidth = 0xff86;
  14460. t.nikhahitleftthai = 0xf899;
  14461. t.nikhahitthai = 0x0e4d;
  14462. t.nine = 0x0039;
  14463. t.ninearabic = 0x0669;
  14464. t.ninebengali = 0x09ef;
  14465. t.ninecircle = 0x2468;
  14466. t.ninecircleinversesansserif = 0x2792;
  14467. t.ninedeva = 0x096f;
  14468. t.ninegujarati = 0x0aef;
  14469. t.ninegurmukhi = 0x0a6f;
  14470. t.ninehackarabic = 0x0669;
  14471. t.ninehangzhou = 0x3029;
  14472. t.nineideographicparen = 0x3228;
  14473. t.nineinferior = 0x2089;
  14474. t.ninemonospace = 0xff19;
  14475. t.nineoldstyle = 0xf739;
  14476. t.nineparen = 0x247c;
  14477. t.nineperiod = 0x2490;
  14478. t.ninepersian = 0x06f9;
  14479. t.nineroman = 0x2178;
  14480. t.ninesuperior = 0x2079;
  14481. t.nineteencircle = 0x2472;
  14482. t.nineteenparen = 0x2486;
  14483. t.nineteenperiod = 0x249a;
  14484. t.ninethai = 0x0e59;
  14485. t.nj = 0x01cc;
  14486. t.njecyrillic = 0x045a;
  14487. t.nkatakana = 0x30f3;
  14488. t.nkatakanahalfwidth = 0xff9d;
  14489. t.nlegrightlong = 0x019e;
  14490. t.nlinebelow = 0x1e49;
  14491. t.nmonospace = 0xff4e;
  14492. t.nmsquare = 0x339a;
  14493. t.nnabengali = 0x09a3;
  14494. t.nnadeva = 0x0923;
  14495. t.nnagujarati = 0x0aa3;
  14496. t.nnagurmukhi = 0x0a23;
  14497. t.nnnadeva = 0x0929;
  14498. t.nohiragana = 0x306e;
  14499. t.nokatakana = 0x30ce;
  14500. t.nokatakanahalfwidth = 0xff89;
  14501. t.nonbreakingspace = 0x00a0;
  14502. t.nonenthai = 0x0e13;
  14503. t.nonuthai = 0x0e19;
  14504. t.noonarabic = 0x0646;
  14505. t.noonfinalarabic = 0xfee6;
  14506. t.noonghunnaarabic = 0x06ba;
  14507. t.noonghunnafinalarabic = 0xfb9f;
  14508. t.nooninitialarabic = 0xfee7;
  14509. t.noonjeeminitialarabic = 0xfcd2;
  14510. t.noonjeemisolatedarabic = 0xfc4b;
  14511. t.noonmedialarabic = 0xfee8;
  14512. t.noonmeeminitialarabic = 0xfcd5;
  14513. t.noonmeemisolatedarabic = 0xfc4e;
  14514. t.noonnoonfinalarabic = 0xfc8d;
  14515. t.notcontains = 0x220c;
  14516. t.notelement = 0x2209;
  14517. t.notelementof = 0x2209;
  14518. t.notequal = 0x2260;
  14519. t.notgreater = 0x226f;
  14520. t.notgreaternorequal = 0x2271;
  14521. t.notgreaternorless = 0x2279;
  14522. t.notidentical = 0x2262;
  14523. t.notless = 0x226e;
  14524. t.notlessnorequal = 0x2270;
  14525. t.notparallel = 0x2226;
  14526. t.notprecedes = 0x2280;
  14527. t.notsubset = 0x2284;
  14528. t.notsucceeds = 0x2281;
  14529. t.notsuperset = 0x2285;
  14530. t.nowarmenian = 0x0576;
  14531. t.nparen = 0x24a9;
  14532. t.nssquare = 0x33b1;
  14533. t.nsuperior = 0x207f;
  14534. t.ntilde = 0x00f1;
  14535. t.nu = 0x03bd;
  14536. t.nuhiragana = 0x306c;
  14537. t.nukatakana = 0x30cc;
  14538. t.nukatakanahalfwidth = 0xff87;
  14539. t.nuktabengali = 0x09bc;
  14540. t.nuktadeva = 0x093c;
  14541. t.nuktagujarati = 0x0abc;
  14542. t.nuktagurmukhi = 0x0a3c;
  14543. t.numbersign = 0x0023;
  14544. t.numbersignmonospace = 0xff03;
  14545. t.numbersignsmall = 0xfe5f;
  14546. t.numeralsigngreek = 0x0374;
  14547. t.numeralsignlowergreek = 0x0375;
  14548. t.numero = 0x2116;
  14549. t.nun = 0x05e0;
  14550. t.nundagesh = 0xfb40;
  14551. t.nundageshhebrew = 0xfb40;
  14552. t.nunhebrew = 0x05e0;
  14553. t.nvsquare = 0x33b5;
  14554. t.nwsquare = 0x33bb;
  14555. t.nyabengali = 0x099e;
  14556. t.nyadeva = 0x091e;
  14557. t.nyagujarati = 0x0a9e;
  14558. t.nyagurmukhi = 0x0a1e;
  14559. t.o = 0x006f;
  14560. t.oacute = 0x00f3;
  14561. t.oangthai = 0x0e2d;
  14562. t.obarred = 0x0275;
  14563. t.obarredcyrillic = 0x04e9;
  14564. t.obarreddieresiscyrillic = 0x04eb;
  14565. t.obengali = 0x0993;
  14566. t.obopomofo = 0x311b;
  14567. t.obreve = 0x014f;
  14568. t.ocandradeva = 0x0911;
  14569. t.ocandragujarati = 0x0a91;
  14570. t.ocandravowelsigndeva = 0x0949;
  14571. t.ocandravowelsigngujarati = 0x0ac9;
  14572. t.ocaron = 0x01d2;
  14573. t.ocircle = 0x24de;
  14574. t.ocircumflex = 0x00f4;
  14575. t.ocircumflexacute = 0x1ed1;
  14576. t.ocircumflexdotbelow = 0x1ed9;
  14577. t.ocircumflexgrave = 0x1ed3;
  14578. t.ocircumflexhookabove = 0x1ed5;
  14579. t.ocircumflextilde = 0x1ed7;
  14580. t.ocyrillic = 0x043e;
  14581. t.odblacute = 0x0151;
  14582. t.odblgrave = 0x020d;
  14583. t.odeva = 0x0913;
  14584. t.odieresis = 0x00f6;
  14585. t.odieresiscyrillic = 0x04e7;
  14586. t.odotbelow = 0x1ecd;
  14587. t.oe = 0x0153;
  14588. t.oekorean = 0x315a;
  14589. t.ogonek = 0x02db;
  14590. t.ogonekcmb = 0x0328;
  14591. t.ograve = 0x00f2;
  14592. t.ogujarati = 0x0a93;
  14593. t.oharmenian = 0x0585;
  14594. t.ohiragana = 0x304a;
  14595. t.ohookabove = 0x1ecf;
  14596. t.ohorn = 0x01a1;
  14597. t.ohornacute = 0x1edb;
  14598. t.ohorndotbelow = 0x1ee3;
  14599. t.ohorngrave = 0x1edd;
  14600. t.ohornhookabove = 0x1edf;
  14601. t.ohorntilde = 0x1ee1;
  14602. t.ohungarumlaut = 0x0151;
  14603. t.oi = 0x01a3;
  14604. t.oinvertedbreve = 0x020f;
  14605. t.okatakana = 0x30aa;
  14606. t.okatakanahalfwidth = 0xff75;
  14607. t.okorean = 0x3157;
  14608. t.olehebrew = 0x05ab;
  14609. t.omacron = 0x014d;
  14610. t.omacronacute = 0x1e53;
  14611. t.omacrongrave = 0x1e51;
  14612. t.omdeva = 0x0950;
  14613. t.omega = 0x03c9;
  14614. t.omega1 = 0x03d6;
  14615. t.omegacyrillic = 0x0461;
  14616. t.omegalatinclosed = 0x0277;
  14617. t.omegaroundcyrillic = 0x047b;
  14618. t.omegatitlocyrillic = 0x047d;
  14619. t.omegatonos = 0x03ce;
  14620. t.omgujarati = 0x0ad0;
  14621. t.omicron = 0x03bf;
  14622. t.omicrontonos = 0x03cc;
  14623. t.omonospace = 0xff4f;
  14624. t.one = 0x0031;
  14625. t.onearabic = 0x0661;
  14626. t.onebengali = 0x09e7;
  14627. t.onecircle = 0x2460;
  14628. t.onecircleinversesansserif = 0x278a;
  14629. t.onedeva = 0x0967;
  14630. t.onedotenleader = 0x2024;
  14631. t.oneeighth = 0x215b;
  14632. t.onefitted = 0xf6dc;
  14633. t.onegujarati = 0x0ae7;
  14634. t.onegurmukhi = 0x0a67;
  14635. t.onehackarabic = 0x0661;
  14636. t.onehalf = 0x00bd;
  14637. t.onehangzhou = 0x3021;
  14638. t.oneideographicparen = 0x3220;
  14639. t.oneinferior = 0x2081;
  14640. t.onemonospace = 0xff11;
  14641. t.onenumeratorbengali = 0x09f4;
  14642. t.oneoldstyle = 0xf731;
  14643. t.oneparen = 0x2474;
  14644. t.oneperiod = 0x2488;
  14645. t.onepersian = 0x06f1;
  14646. t.onequarter = 0x00bc;
  14647. t.oneroman = 0x2170;
  14648. t.onesuperior = 0x00b9;
  14649. t.onethai = 0x0e51;
  14650. t.onethird = 0x2153;
  14651. t.oogonek = 0x01eb;
  14652. t.oogonekmacron = 0x01ed;
  14653. t.oogurmukhi = 0x0a13;
  14654. t.oomatragurmukhi = 0x0a4b;
  14655. t.oopen = 0x0254;
  14656. t.oparen = 0x24aa;
  14657. t.openbullet = 0x25e6;
  14658. t.option = 0x2325;
  14659. t.ordfeminine = 0x00aa;
  14660. t.ordmasculine = 0x00ba;
  14661. t.orthogonal = 0x221f;
  14662. t.oshortdeva = 0x0912;
  14663. t.oshortvowelsigndeva = 0x094a;
  14664. t.oslash = 0x00f8;
  14665. t.oslashacute = 0x01ff;
  14666. t.osmallhiragana = 0x3049;
  14667. t.osmallkatakana = 0x30a9;
  14668. t.osmallkatakanahalfwidth = 0xff6b;
  14669. t.ostrokeacute = 0x01ff;
  14670. t.osuperior = 0xf6f0;
  14671. t.otcyrillic = 0x047f;
  14672. t.otilde = 0x00f5;
  14673. t.otildeacute = 0x1e4d;
  14674. t.otildedieresis = 0x1e4f;
  14675. t.oubopomofo = 0x3121;
  14676. t.overline = 0x203e;
  14677. t.overlinecenterline = 0xfe4a;
  14678. t.overlinecmb = 0x0305;
  14679. t.overlinedashed = 0xfe49;
  14680. t.overlinedblwavy = 0xfe4c;
  14681. t.overlinewavy = 0xfe4b;
  14682. t.overscore = 0x00af;
  14683. t.ovowelsignbengali = 0x09cb;
  14684. t.ovowelsigndeva = 0x094b;
  14685. t.ovowelsigngujarati = 0x0acb;
  14686. t.p = 0x0070;
  14687. t.paampssquare = 0x3380;
  14688. t.paasentosquare = 0x332b;
  14689. t.pabengali = 0x09aa;
  14690. t.pacute = 0x1e55;
  14691. t.padeva = 0x092a;
  14692. t.pagedown = 0x21df;
  14693. t.pageup = 0x21de;
  14694. t.pagujarati = 0x0aaa;
  14695. t.pagurmukhi = 0x0a2a;
  14696. t.pahiragana = 0x3071;
  14697. t.paiyannoithai = 0x0e2f;
  14698. t.pakatakana = 0x30d1;
  14699. t.palatalizationcyrilliccmb = 0x0484;
  14700. t.palochkacyrillic = 0x04c0;
  14701. t.pansioskorean = 0x317f;
  14702. t.paragraph = 0x00b6;
  14703. t.parallel = 0x2225;
  14704. t.parenleft = 0x0028;
  14705. t.parenleftaltonearabic = 0xfd3e;
  14706. t.parenleftbt = 0xf8ed;
  14707. t.parenleftex = 0xf8ec;
  14708. t.parenleftinferior = 0x208d;
  14709. t.parenleftmonospace = 0xff08;
  14710. t.parenleftsmall = 0xfe59;
  14711. t.parenleftsuperior = 0x207d;
  14712. t.parenlefttp = 0xf8eb;
  14713. t.parenleftvertical = 0xfe35;
  14714. t.parenright = 0x0029;
  14715. t.parenrightaltonearabic = 0xfd3f;
  14716. t.parenrightbt = 0xf8f8;
  14717. t.parenrightex = 0xf8f7;
  14718. t.parenrightinferior = 0x208e;
  14719. t.parenrightmonospace = 0xff09;
  14720. t.parenrightsmall = 0xfe5a;
  14721. t.parenrightsuperior = 0x207e;
  14722. t.parenrighttp = 0xf8f6;
  14723. t.parenrightvertical = 0xfe36;
  14724. t.partialdiff = 0x2202;
  14725. t.paseqhebrew = 0x05c0;
  14726. t.pashtahebrew = 0x0599;
  14727. t.pasquare = 0x33a9;
  14728. t.patah = 0x05b7;
  14729. t.patah11 = 0x05b7;
  14730. t.patah1d = 0x05b7;
  14731. t.patah2a = 0x05b7;
  14732. t.patahhebrew = 0x05b7;
  14733. t.patahnarrowhebrew = 0x05b7;
  14734. t.patahquarterhebrew = 0x05b7;
  14735. t.patahwidehebrew = 0x05b7;
  14736. t.pazerhebrew = 0x05a1;
  14737. t.pbopomofo = 0x3106;
  14738. t.pcircle = 0x24df;
  14739. t.pdotaccent = 0x1e57;
  14740. t.pe = 0x05e4;
  14741. t.pecyrillic = 0x043f;
  14742. t.pedagesh = 0xfb44;
  14743. t.pedageshhebrew = 0xfb44;
  14744. t.peezisquare = 0x333b;
  14745. t.pefinaldageshhebrew = 0xfb43;
  14746. t.peharabic = 0x067e;
  14747. t.peharmenian = 0x057a;
  14748. t.pehebrew = 0x05e4;
  14749. t.pehfinalarabic = 0xfb57;
  14750. t.pehinitialarabic = 0xfb58;
  14751. t.pehiragana = 0x307a;
  14752. t.pehmedialarabic = 0xfb59;
  14753. t.pekatakana = 0x30da;
  14754. t.pemiddlehookcyrillic = 0x04a7;
  14755. t.perafehebrew = 0xfb4e;
  14756. t.percent = 0x0025;
  14757. t.percentarabic = 0x066a;
  14758. t.percentmonospace = 0xff05;
  14759. t.percentsmall = 0xfe6a;
  14760. t.period = 0x002e;
  14761. t.periodarmenian = 0x0589;
  14762. t.periodcentered = 0x00b7;
  14763. t.periodhalfwidth = 0xff61;
  14764. t.periodinferior = 0xf6e7;
  14765. t.periodmonospace = 0xff0e;
  14766. t.periodsmall = 0xfe52;
  14767. t.periodsuperior = 0xf6e8;
  14768. t.perispomenigreekcmb = 0x0342;
  14769. t.perpendicular = 0x22a5;
  14770. t.perthousand = 0x2030;
  14771. t.peseta = 0x20a7;
  14772. t.pfsquare = 0x338a;
  14773. t.phabengali = 0x09ab;
  14774. t.phadeva = 0x092b;
  14775. t.phagujarati = 0x0aab;
  14776. t.phagurmukhi = 0x0a2b;
  14777. t.phi = 0x03c6;
  14778. t.phi1 = 0x03d5;
  14779. t.phieuphacirclekorean = 0x327a;
  14780. t.phieuphaparenkorean = 0x321a;
  14781. t.phieuphcirclekorean = 0x326c;
  14782. t.phieuphkorean = 0x314d;
  14783. t.phieuphparenkorean = 0x320c;
  14784. t.philatin = 0x0278;
  14785. t.phinthuthai = 0x0e3a;
  14786. t.phisymbolgreek = 0x03d5;
  14787. t.phook = 0x01a5;
  14788. t.phophanthai = 0x0e1e;
  14789. t.phophungthai = 0x0e1c;
  14790. t.phosamphaothai = 0x0e20;
  14791. t.pi = 0x03c0;
  14792. t.pieupacirclekorean = 0x3273;
  14793. t.pieupaparenkorean = 0x3213;
  14794. t.pieupcieuckorean = 0x3176;
  14795. t.pieupcirclekorean = 0x3265;
  14796. t.pieupkiyeokkorean = 0x3172;
  14797. t.pieupkorean = 0x3142;
  14798. t.pieupparenkorean = 0x3205;
  14799. t.pieupsioskiyeokkorean = 0x3174;
  14800. t.pieupsioskorean = 0x3144;
  14801. t.pieupsiostikeutkorean = 0x3175;
  14802. t.pieupthieuthkorean = 0x3177;
  14803. t.pieuptikeutkorean = 0x3173;
  14804. t.pihiragana = 0x3074;
  14805. t.pikatakana = 0x30d4;
  14806. t.pisymbolgreek = 0x03d6;
  14807. t.piwrarmenian = 0x0583;
  14808. t.planckover2pi = 0x210f;
  14809. t.planckover2pi1 = 0x210f;
  14810. t.plus = 0x002b;
  14811. t.plusbelowcmb = 0x031f;
  14812. t.pluscircle = 0x2295;
  14813. t.plusminus = 0x00b1;
  14814. t.plusmod = 0x02d6;
  14815. t.plusmonospace = 0xff0b;
  14816. t.plussmall = 0xfe62;
  14817. t.plussuperior = 0x207a;
  14818. t.pmonospace = 0xff50;
  14819. t.pmsquare = 0x33d8;
  14820. t.pohiragana = 0x307d;
  14821. t.pointingindexdownwhite = 0x261f;
  14822. t.pointingindexleftwhite = 0x261c;
  14823. t.pointingindexrightwhite = 0x261e;
  14824. t.pointingindexupwhite = 0x261d;
  14825. t.pokatakana = 0x30dd;
  14826. t.poplathai = 0x0e1b;
  14827. t.postalmark = 0x3012;
  14828. t.postalmarkface = 0x3020;
  14829. t.pparen = 0x24ab;
  14830. t.precedes = 0x227a;
  14831. t.prescription = 0x211e;
  14832. t.primemod = 0x02b9;
  14833. t.primereversed = 0x2035;
  14834. t.product = 0x220f;
  14835. t.projective = 0x2305;
  14836. t.prolongedkana = 0x30fc;
  14837. t.propellor = 0x2318;
  14838. t.propersubset = 0x2282;
  14839. t.propersuperset = 0x2283;
  14840. t.proportion = 0x2237;
  14841. t.proportional = 0x221d;
  14842. t.psi = 0x03c8;
  14843. t.psicyrillic = 0x0471;
  14844. t.psilipneumatacyrilliccmb = 0x0486;
  14845. t.pssquare = 0x33b0;
  14846. t.puhiragana = 0x3077;
  14847. t.pukatakana = 0x30d7;
  14848. t.pvsquare = 0x33b4;
  14849. t.pwsquare = 0x33ba;
  14850. t.q = 0x0071;
  14851. t.qadeva = 0x0958;
  14852. t.qadmahebrew = 0x05a8;
  14853. t.qafarabic = 0x0642;
  14854. t.qaffinalarabic = 0xfed6;
  14855. t.qafinitialarabic = 0xfed7;
  14856. t.qafmedialarabic = 0xfed8;
  14857. t.qamats = 0x05b8;
  14858. t.qamats10 = 0x05b8;
  14859. t.qamats1a = 0x05b8;
  14860. t.qamats1c = 0x05b8;
  14861. t.qamats27 = 0x05b8;
  14862. t.qamats29 = 0x05b8;
  14863. t.qamats33 = 0x05b8;
  14864. t.qamatsde = 0x05b8;
  14865. t.qamatshebrew = 0x05b8;
  14866. t.qamatsnarrowhebrew = 0x05b8;
  14867. t.qamatsqatanhebrew = 0x05b8;
  14868. t.qamatsqatannarrowhebrew = 0x05b8;
  14869. t.qamatsqatanquarterhebrew = 0x05b8;
  14870. t.qamatsqatanwidehebrew = 0x05b8;
  14871. t.qamatsquarterhebrew = 0x05b8;
  14872. t.qamatswidehebrew = 0x05b8;
  14873. t.qarneyparahebrew = 0x059f;
  14874. t.qbopomofo = 0x3111;
  14875. t.qcircle = 0x24e0;
  14876. t.qhook = 0x02a0;
  14877. t.qmonospace = 0xff51;
  14878. t.qof = 0x05e7;
  14879. t.qofdagesh = 0xfb47;
  14880. t.qofdageshhebrew = 0xfb47;
  14881. t.qofhebrew = 0x05e7;
  14882. t.qparen = 0x24ac;
  14883. t.quarternote = 0x2669;
  14884. t.qubuts = 0x05bb;
  14885. t.qubuts18 = 0x05bb;
  14886. t.qubuts25 = 0x05bb;
  14887. t.qubuts31 = 0x05bb;
  14888. t.qubutshebrew = 0x05bb;
  14889. t.qubutsnarrowhebrew = 0x05bb;
  14890. t.qubutsquarterhebrew = 0x05bb;
  14891. t.qubutswidehebrew = 0x05bb;
  14892. t.question = 0x003f;
  14893. t.questionarabic = 0x061f;
  14894. t.questionarmenian = 0x055e;
  14895. t.questiondown = 0x00bf;
  14896. t.questiondownsmall = 0xf7bf;
  14897. t.questiongreek = 0x037e;
  14898. t.questionmonospace = 0xff1f;
  14899. t.questionsmall = 0xf73f;
  14900. t.quotedbl = 0x0022;
  14901. t.quotedblbase = 0x201e;
  14902. t.quotedblleft = 0x201c;
  14903. t.quotedblmonospace = 0xff02;
  14904. t.quotedblprime = 0x301e;
  14905. t.quotedblprimereversed = 0x301d;
  14906. t.quotedblright = 0x201d;
  14907. t.quoteleft = 0x2018;
  14908. t.quoteleftreversed = 0x201b;
  14909. t.quotereversed = 0x201b;
  14910. t.quoteright = 0x2019;
  14911. t.quoterightn = 0x0149;
  14912. t.quotesinglbase = 0x201a;
  14913. t.quotesingle = 0x0027;
  14914. t.quotesinglemonospace = 0xff07;
  14915. t.r = 0x0072;
  14916. t.raarmenian = 0x057c;
  14917. t.rabengali = 0x09b0;
  14918. t.racute = 0x0155;
  14919. t.radeva = 0x0930;
  14920. t.radical = 0x221a;
  14921. t.radicalex = 0xf8e5;
  14922. t.radoverssquare = 0x33ae;
  14923. t.radoverssquaredsquare = 0x33af;
  14924. t.radsquare = 0x33ad;
  14925. t.rafe = 0x05bf;
  14926. t.rafehebrew = 0x05bf;
  14927. t.ragujarati = 0x0ab0;
  14928. t.ragurmukhi = 0x0a30;
  14929. t.rahiragana = 0x3089;
  14930. t.rakatakana = 0x30e9;
  14931. t.rakatakanahalfwidth = 0xff97;
  14932. t.ralowerdiagonalbengali = 0x09f1;
  14933. t.ramiddlediagonalbengali = 0x09f0;
  14934. t.ramshorn = 0x0264;
  14935. t.ratio = 0x2236;
  14936. t.rbopomofo = 0x3116;
  14937. t.rcaron = 0x0159;
  14938. t.rcedilla = 0x0157;
  14939. t.rcircle = 0x24e1;
  14940. t.rcommaaccent = 0x0157;
  14941. t.rdblgrave = 0x0211;
  14942. t.rdotaccent = 0x1e59;
  14943. t.rdotbelow = 0x1e5b;
  14944. t.rdotbelowmacron = 0x1e5d;
  14945. t.referencemark = 0x203b;
  14946. t.reflexsubset = 0x2286;
  14947. t.reflexsuperset = 0x2287;
  14948. t.registered = 0x00ae;
  14949. t.registersans = 0xf8e8;
  14950. t.registerserif = 0xf6da;
  14951. t.reharabic = 0x0631;
  14952. t.reharmenian = 0x0580;
  14953. t.rehfinalarabic = 0xfeae;
  14954. t.rehiragana = 0x308c;
  14955. t.rekatakana = 0x30ec;
  14956. t.rekatakanahalfwidth = 0xff9a;
  14957. t.resh = 0x05e8;
  14958. t.reshdageshhebrew = 0xfb48;
  14959. t.reshhebrew = 0x05e8;
  14960. t.reversedtilde = 0x223d;
  14961. t.reviahebrew = 0x0597;
  14962. t.reviamugrashhebrew = 0x0597;
  14963. t.revlogicalnot = 0x2310;
  14964. t.rfishhook = 0x027e;
  14965. t.rfishhookreversed = 0x027f;
  14966. t.rhabengali = 0x09dd;
  14967. t.rhadeva = 0x095d;
  14968. t.rho = 0x03c1;
  14969. t.rhook = 0x027d;
  14970. t.rhookturned = 0x027b;
  14971. t.rhookturnedsuperior = 0x02b5;
  14972. t.rhosymbolgreek = 0x03f1;
  14973. t.rhotichookmod = 0x02de;
  14974. t.rieulacirclekorean = 0x3271;
  14975. t.rieulaparenkorean = 0x3211;
  14976. t.rieulcirclekorean = 0x3263;
  14977. t.rieulhieuhkorean = 0x3140;
  14978. t.rieulkiyeokkorean = 0x313a;
  14979. t.rieulkiyeoksioskorean = 0x3169;
  14980. t.rieulkorean = 0x3139;
  14981. t.rieulmieumkorean = 0x313b;
  14982. t.rieulpansioskorean = 0x316c;
  14983. t.rieulparenkorean = 0x3203;
  14984. t.rieulphieuphkorean = 0x313f;
  14985. t.rieulpieupkorean = 0x313c;
  14986. t.rieulpieupsioskorean = 0x316b;
  14987. t.rieulsioskorean = 0x313d;
  14988. t.rieulthieuthkorean = 0x313e;
  14989. t.rieultikeutkorean = 0x316a;
  14990. t.rieulyeorinhieuhkorean = 0x316d;
  14991. t.rightangle = 0x221f;
  14992. t.righttackbelowcmb = 0x0319;
  14993. t.righttriangle = 0x22bf;
  14994. t.rihiragana = 0x308a;
  14995. t.rikatakana = 0x30ea;
  14996. t.rikatakanahalfwidth = 0xff98;
  14997. t.ring = 0x02da;
  14998. t.ringbelowcmb = 0x0325;
  14999. t.ringcmb = 0x030a;
  15000. t.ringhalfleft = 0x02bf;
  15001. t.ringhalfleftarmenian = 0x0559;
  15002. t.ringhalfleftbelowcmb = 0x031c;
  15003. t.ringhalfleftcentered = 0x02d3;
  15004. t.ringhalfright = 0x02be;
  15005. t.ringhalfrightbelowcmb = 0x0339;
  15006. t.ringhalfrightcentered = 0x02d2;
  15007. t.rinvertedbreve = 0x0213;
  15008. t.rittorusquare = 0x3351;
  15009. t.rlinebelow = 0x1e5f;
  15010. t.rlongleg = 0x027c;
  15011. t.rlonglegturned = 0x027a;
  15012. t.rmonospace = 0xff52;
  15013. t.rohiragana = 0x308d;
  15014. t.rokatakana = 0x30ed;
  15015. t.rokatakanahalfwidth = 0xff9b;
  15016. t.roruathai = 0x0e23;
  15017. t.rparen = 0x24ad;
  15018. t.rrabengali = 0x09dc;
  15019. t.rradeva = 0x0931;
  15020. t.rragurmukhi = 0x0a5c;
  15021. t.rreharabic = 0x0691;
  15022. t.rrehfinalarabic = 0xfb8d;
  15023. t.rrvocalicbengali = 0x09e0;
  15024. t.rrvocalicdeva = 0x0960;
  15025. t.rrvocalicgujarati = 0x0ae0;
  15026. t.rrvocalicvowelsignbengali = 0x09c4;
  15027. t.rrvocalicvowelsigndeva = 0x0944;
  15028. t.rrvocalicvowelsigngujarati = 0x0ac4;
  15029. t.rsuperior = 0xf6f1;
  15030. t.rtblock = 0x2590;
  15031. t.rturned = 0x0279;
  15032. t.rturnedsuperior = 0x02b4;
  15033. t.ruhiragana = 0x308b;
  15034. t.rukatakana = 0x30eb;
  15035. t.rukatakanahalfwidth = 0xff99;
  15036. t.rupeemarkbengali = 0x09f2;
  15037. t.rupeesignbengali = 0x09f3;
  15038. t.rupiah = 0xf6dd;
  15039. t.ruthai = 0x0e24;
  15040. t.rvocalicbengali = 0x098b;
  15041. t.rvocalicdeva = 0x090b;
  15042. t.rvocalicgujarati = 0x0a8b;
  15043. t.rvocalicvowelsignbengali = 0x09c3;
  15044. t.rvocalicvowelsigndeva = 0x0943;
  15045. t.rvocalicvowelsigngujarati = 0x0ac3;
  15046. t.s = 0x0073;
  15047. t.sabengali = 0x09b8;
  15048. t.sacute = 0x015b;
  15049. t.sacutedotaccent = 0x1e65;
  15050. t.sadarabic = 0x0635;
  15051. t.sadeva = 0x0938;
  15052. t.sadfinalarabic = 0xfeba;
  15053. t.sadinitialarabic = 0xfebb;
  15054. t.sadmedialarabic = 0xfebc;
  15055. t.sagujarati = 0x0ab8;
  15056. t.sagurmukhi = 0x0a38;
  15057. t.sahiragana = 0x3055;
  15058. t.sakatakana = 0x30b5;
  15059. t.sakatakanahalfwidth = 0xff7b;
  15060. t.sallallahoualayhewasallamarabic = 0xfdfa;
  15061. t.samekh = 0x05e1;
  15062. t.samekhdagesh = 0xfb41;
  15063. t.samekhdageshhebrew = 0xfb41;
  15064. t.samekhhebrew = 0x05e1;
  15065. t.saraaathai = 0x0e32;
  15066. t.saraaethai = 0x0e41;
  15067. t.saraaimaimalaithai = 0x0e44;
  15068. t.saraaimaimuanthai = 0x0e43;
  15069. t.saraamthai = 0x0e33;
  15070. t.saraathai = 0x0e30;
  15071. t.saraethai = 0x0e40;
  15072. t.saraiileftthai = 0xf886;
  15073. t.saraiithai = 0x0e35;
  15074. t.saraileftthai = 0xf885;
  15075. t.saraithai = 0x0e34;
  15076. t.saraothai = 0x0e42;
  15077. t.saraueeleftthai = 0xf888;
  15078. t.saraueethai = 0x0e37;
  15079. t.saraueleftthai = 0xf887;
  15080. t.sarauethai = 0x0e36;
  15081. t.sarauthai = 0x0e38;
  15082. t.sarauuthai = 0x0e39;
  15083. t.sbopomofo = 0x3119;
  15084. t.scaron = 0x0161;
  15085. t.scarondotaccent = 0x1e67;
  15086. t.scedilla = 0x015f;
  15087. t.schwa = 0x0259;
  15088. t.schwacyrillic = 0x04d9;
  15089. t.schwadieresiscyrillic = 0x04db;
  15090. t.schwahook = 0x025a;
  15091. t.scircle = 0x24e2;
  15092. t.scircumflex = 0x015d;
  15093. t.scommaaccent = 0x0219;
  15094. t.sdotaccent = 0x1e61;
  15095. t.sdotbelow = 0x1e63;
  15096. t.sdotbelowdotaccent = 0x1e69;
  15097. t.seagullbelowcmb = 0x033c;
  15098. t.second = 0x2033;
  15099. t.secondtonechinese = 0x02ca;
  15100. t.section = 0x00a7;
  15101. t.seenarabic = 0x0633;
  15102. t.seenfinalarabic = 0xfeb2;
  15103. t.seeninitialarabic = 0xfeb3;
  15104. t.seenmedialarabic = 0xfeb4;
  15105. t.segol = 0x05b6;
  15106. t.segol13 = 0x05b6;
  15107. t.segol1f = 0x05b6;
  15108. t.segol2c = 0x05b6;
  15109. t.segolhebrew = 0x05b6;
  15110. t.segolnarrowhebrew = 0x05b6;
  15111. t.segolquarterhebrew = 0x05b6;
  15112. t.segoltahebrew = 0x0592;
  15113. t.segolwidehebrew = 0x05b6;
  15114. t.seharmenian = 0x057d;
  15115. t.sehiragana = 0x305b;
  15116. t.sekatakana = 0x30bb;
  15117. t.sekatakanahalfwidth = 0xff7e;
  15118. t.semicolon = 0x003b;
  15119. t.semicolonarabic = 0x061b;
  15120. t.semicolonmonospace = 0xff1b;
  15121. t.semicolonsmall = 0xfe54;
  15122. t.semivoicedmarkkana = 0x309c;
  15123. t.semivoicedmarkkanahalfwidth = 0xff9f;
  15124. t.sentisquare = 0x3322;
  15125. t.sentosquare = 0x3323;
  15126. t.seven = 0x0037;
  15127. t.sevenarabic = 0x0667;
  15128. t.sevenbengali = 0x09ed;
  15129. t.sevencircle = 0x2466;
  15130. t.sevencircleinversesansserif = 0x2790;
  15131. t.sevendeva = 0x096d;
  15132. t.seveneighths = 0x215e;
  15133. t.sevengujarati = 0x0aed;
  15134. t.sevengurmukhi = 0x0a6d;
  15135. t.sevenhackarabic = 0x0667;
  15136. t.sevenhangzhou = 0x3027;
  15137. t.sevenideographicparen = 0x3226;
  15138. t.seveninferior = 0x2087;
  15139. t.sevenmonospace = 0xff17;
  15140. t.sevenoldstyle = 0xf737;
  15141. t.sevenparen = 0x247a;
  15142. t.sevenperiod = 0x248e;
  15143. t.sevenpersian = 0x06f7;
  15144. t.sevenroman = 0x2176;
  15145. t.sevensuperior = 0x2077;
  15146. t.seventeencircle = 0x2470;
  15147. t.seventeenparen = 0x2484;
  15148. t.seventeenperiod = 0x2498;
  15149. t.seventhai = 0x0e57;
  15150. t.sfthyphen = 0x00ad;
  15151. t.shaarmenian = 0x0577;
  15152. t.shabengali = 0x09b6;
  15153. t.shacyrillic = 0x0448;
  15154. t.shaddaarabic = 0x0651;
  15155. t.shaddadammaarabic = 0xfc61;
  15156. t.shaddadammatanarabic = 0xfc5e;
  15157. t.shaddafathaarabic = 0xfc60;
  15158. t.shaddakasraarabic = 0xfc62;
  15159. t.shaddakasratanarabic = 0xfc5f;
  15160. t.shade = 0x2592;
  15161. t.shadedark = 0x2593;
  15162. t.shadelight = 0x2591;
  15163. t.shademedium = 0x2592;
  15164. t.shadeva = 0x0936;
  15165. t.shagujarati = 0x0ab6;
  15166. t.shagurmukhi = 0x0a36;
  15167. t.shalshelethebrew = 0x0593;
  15168. t.shbopomofo = 0x3115;
  15169. t.shchacyrillic = 0x0449;
  15170. t.sheenarabic = 0x0634;
  15171. t.sheenfinalarabic = 0xfeb6;
  15172. t.sheeninitialarabic = 0xfeb7;
  15173. t.sheenmedialarabic = 0xfeb8;
  15174. t.sheicoptic = 0x03e3;
  15175. t.sheqel = 0x20aa;
  15176. t.sheqelhebrew = 0x20aa;
  15177. t.sheva = 0x05b0;
  15178. t.sheva115 = 0x05b0;
  15179. t.sheva15 = 0x05b0;
  15180. t.sheva22 = 0x05b0;
  15181. t.sheva2e = 0x05b0;
  15182. t.shevahebrew = 0x05b0;
  15183. t.shevanarrowhebrew = 0x05b0;
  15184. t.shevaquarterhebrew = 0x05b0;
  15185. t.shevawidehebrew = 0x05b0;
  15186. t.shhacyrillic = 0x04bb;
  15187. t.shimacoptic = 0x03ed;
  15188. t.shin = 0x05e9;
  15189. t.shindagesh = 0xfb49;
  15190. t.shindageshhebrew = 0xfb49;
  15191. t.shindageshshindot = 0xfb2c;
  15192. t.shindageshshindothebrew = 0xfb2c;
  15193. t.shindageshsindot = 0xfb2d;
  15194. t.shindageshsindothebrew = 0xfb2d;
  15195. t.shindothebrew = 0x05c1;
  15196. t.shinhebrew = 0x05e9;
  15197. t.shinshindot = 0xfb2a;
  15198. t.shinshindothebrew = 0xfb2a;
  15199. t.shinsindot = 0xfb2b;
  15200. t.shinsindothebrew = 0xfb2b;
  15201. t.shook = 0x0282;
  15202. t.sigma = 0x03c3;
  15203. t.sigma1 = 0x03c2;
  15204. t.sigmafinal = 0x03c2;
  15205. t.sigmalunatesymbolgreek = 0x03f2;
  15206. t.sihiragana = 0x3057;
  15207. t.sikatakana = 0x30b7;
  15208. t.sikatakanahalfwidth = 0xff7c;
  15209. t.siluqhebrew = 0x05bd;
  15210. t.siluqlefthebrew = 0x05bd;
  15211. t.similar = 0x223c;
  15212. t.sindothebrew = 0x05c2;
  15213. t.siosacirclekorean = 0x3274;
  15214. t.siosaparenkorean = 0x3214;
  15215. t.sioscieuckorean = 0x317e;
  15216. t.sioscirclekorean = 0x3266;
  15217. t.sioskiyeokkorean = 0x317a;
  15218. t.sioskorean = 0x3145;
  15219. t.siosnieunkorean = 0x317b;
  15220. t.siosparenkorean = 0x3206;
  15221. t.siospieupkorean = 0x317d;
  15222. t.siostikeutkorean = 0x317c;
  15223. t.six = 0x0036;
  15224. t.sixarabic = 0x0666;
  15225. t.sixbengali = 0x09ec;
  15226. t.sixcircle = 0x2465;
  15227. t.sixcircleinversesansserif = 0x278f;
  15228. t.sixdeva = 0x096c;
  15229. t.sixgujarati = 0x0aec;
  15230. t.sixgurmukhi = 0x0a6c;
  15231. t.sixhackarabic = 0x0666;
  15232. t.sixhangzhou = 0x3026;
  15233. t.sixideographicparen = 0x3225;
  15234. t.sixinferior = 0x2086;
  15235. t.sixmonospace = 0xff16;
  15236. t.sixoldstyle = 0xf736;
  15237. t.sixparen = 0x2479;
  15238. t.sixperiod = 0x248d;
  15239. t.sixpersian = 0x06f6;
  15240. t.sixroman = 0x2175;
  15241. t.sixsuperior = 0x2076;
  15242. t.sixteencircle = 0x246f;
  15243. t.sixteencurrencydenominatorbengali = 0x09f9;
  15244. t.sixteenparen = 0x2483;
  15245. t.sixteenperiod = 0x2497;
  15246. t.sixthai = 0x0e56;
  15247. t.slash = 0x002f;
  15248. t.slashmonospace = 0xff0f;
  15249. t.slong = 0x017f;
  15250. t.slongdotaccent = 0x1e9b;
  15251. t.smileface = 0x263a;
  15252. t.smonospace = 0xff53;
  15253. t.sofpasuqhebrew = 0x05c3;
  15254. t.softhyphen = 0x00ad;
  15255. t.softsigncyrillic = 0x044c;
  15256. t.sohiragana = 0x305d;
  15257. t.sokatakana = 0x30bd;
  15258. t.sokatakanahalfwidth = 0xff7f;
  15259. t.soliduslongoverlaycmb = 0x0338;
  15260. t.solidusshortoverlaycmb = 0x0337;
  15261. t.sorusithai = 0x0e29;
  15262. t.sosalathai = 0x0e28;
  15263. t.sosothai = 0x0e0b;
  15264. t.sosuathai = 0x0e2a;
  15265. t.space = 0x0020;
  15266. t.spacehackarabic = 0x0020;
  15267. t.spade = 0x2660;
  15268. t.spadesuitblack = 0x2660;
  15269. t.spadesuitwhite = 0x2664;
  15270. t.sparen = 0x24ae;
  15271. t.squarebelowcmb = 0x033b;
  15272. t.squarecc = 0x33c4;
  15273. t.squarecm = 0x339d;
  15274. t.squarediagonalcrosshatchfill = 0x25a9;
  15275. t.squarehorizontalfill = 0x25a4;
  15276. t.squarekg = 0x338f;
  15277. t.squarekm = 0x339e;
  15278. t.squarekmcapital = 0x33ce;
  15279. t.squareln = 0x33d1;
  15280. t.squarelog = 0x33d2;
  15281. t.squaremg = 0x338e;
  15282. t.squaremil = 0x33d5;
  15283. t.squaremm = 0x339c;
  15284. t.squaremsquared = 0x33a1;
  15285. t.squareorthogonalcrosshatchfill = 0x25a6;
  15286. t.squareupperlefttolowerrightfill = 0x25a7;
  15287. t.squareupperrighttolowerleftfill = 0x25a8;
  15288. t.squareverticalfill = 0x25a5;
  15289. t.squarewhitewithsmallblack = 0x25a3;
  15290. t.srsquare = 0x33db;
  15291. t.ssabengali = 0x09b7;
  15292. t.ssadeva = 0x0937;
  15293. t.ssagujarati = 0x0ab7;
  15294. t.ssangcieuckorean = 0x3149;
  15295. t.ssanghieuhkorean = 0x3185;
  15296. t.ssangieungkorean = 0x3180;
  15297. t.ssangkiyeokkorean = 0x3132;
  15298. t.ssangnieunkorean = 0x3165;
  15299. t.ssangpieupkorean = 0x3143;
  15300. t.ssangsioskorean = 0x3146;
  15301. t.ssangtikeutkorean = 0x3138;
  15302. t.ssuperior = 0xf6f2;
  15303. t.sterling = 0x00a3;
  15304. t.sterlingmonospace = 0xffe1;
  15305. t.strokelongoverlaycmb = 0x0336;
  15306. t.strokeshortoverlaycmb = 0x0335;
  15307. t.subset = 0x2282;
  15308. t.subsetnotequal = 0x228a;
  15309. t.subsetorequal = 0x2286;
  15310. t.succeeds = 0x227b;
  15311. t.suchthat = 0x220b;
  15312. t.suhiragana = 0x3059;
  15313. t.sukatakana = 0x30b9;
  15314. t.sukatakanahalfwidth = 0xff7d;
  15315. t.sukunarabic = 0x0652;
  15316. t.summation = 0x2211;
  15317. t.sun = 0x263c;
  15318. t.superset = 0x2283;
  15319. t.supersetnotequal = 0x228b;
  15320. t.supersetorequal = 0x2287;
  15321. t.svsquare = 0x33dc;
  15322. t.syouwaerasquare = 0x337c;
  15323. t.t = 0x0074;
  15324. t.tabengali = 0x09a4;
  15325. t.tackdown = 0x22a4;
  15326. t.tackleft = 0x22a3;
  15327. t.tadeva = 0x0924;
  15328. t.tagujarati = 0x0aa4;
  15329. t.tagurmukhi = 0x0a24;
  15330. t.taharabic = 0x0637;
  15331. t.tahfinalarabic = 0xfec2;
  15332. t.tahinitialarabic = 0xfec3;
  15333. t.tahiragana = 0x305f;
  15334. t.tahmedialarabic = 0xfec4;
  15335. t.taisyouerasquare = 0x337d;
  15336. t.takatakana = 0x30bf;
  15337. t.takatakanahalfwidth = 0xff80;
  15338. t.tatweelarabic = 0x0640;
  15339. t.tau = 0x03c4;
  15340. t.tav = 0x05ea;
  15341. t.tavdages = 0xfb4a;
  15342. t.tavdagesh = 0xfb4a;
  15343. t.tavdageshhebrew = 0xfb4a;
  15344. t.tavhebrew = 0x05ea;
  15345. t.tbar = 0x0167;
  15346. t.tbopomofo = 0x310a;
  15347. t.tcaron = 0x0165;
  15348. t.tccurl = 0x02a8;
  15349. t.tcedilla = 0x0163;
  15350. t.tcheharabic = 0x0686;
  15351. t.tchehfinalarabic = 0xfb7b;
  15352. t.tchehinitialarabic = 0xfb7c;
  15353. t.tchehmedialarabic = 0xfb7d;
  15354. t.tcircle = 0x24e3;
  15355. t.tcircumflexbelow = 0x1e71;
  15356. t.tcommaaccent = 0x0163;
  15357. t.tdieresis = 0x1e97;
  15358. t.tdotaccent = 0x1e6b;
  15359. t.tdotbelow = 0x1e6d;
  15360. t.tecyrillic = 0x0442;
  15361. t.tedescendercyrillic = 0x04ad;
  15362. t.teharabic = 0x062a;
  15363. t.tehfinalarabic = 0xfe96;
  15364. t.tehhahinitialarabic = 0xfca2;
  15365. t.tehhahisolatedarabic = 0xfc0c;
  15366. t.tehinitialarabic = 0xfe97;
  15367. t.tehiragana = 0x3066;
  15368. t.tehjeeminitialarabic = 0xfca1;
  15369. t.tehjeemisolatedarabic = 0xfc0b;
  15370. t.tehmarbutaarabic = 0x0629;
  15371. t.tehmarbutafinalarabic = 0xfe94;
  15372. t.tehmedialarabic = 0xfe98;
  15373. t.tehmeeminitialarabic = 0xfca4;
  15374. t.tehmeemisolatedarabic = 0xfc0e;
  15375. t.tehnoonfinalarabic = 0xfc73;
  15376. t.tekatakana = 0x30c6;
  15377. t.tekatakanahalfwidth = 0xff83;
  15378. t.telephone = 0x2121;
  15379. t.telephoneblack = 0x260e;
  15380. t.telishagedolahebrew = 0x05a0;
  15381. t.telishaqetanahebrew = 0x05a9;
  15382. t.tencircle = 0x2469;
  15383. t.tenideographicparen = 0x3229;
  15384. t.tenparen = 0x247d;
  15385. t.tenperiod = 0x2491;
  15386. t.tenroman = 0x2179;
  15387. t.tesh = 0x02a7;
  15388. t.tet = 0x05d8;
  15389. t.tetdagesh = 0xfb38;
  15390. t.tetdageshhebrew = 0xfb38;
  15391. t.tethebrew = 0x05d8;
  15392. t.tetsecyrillic = 0x04b5;
  15393. t.tevirhebrew = 0x059b;
  15394. t.tevirlefthebrew = 0x059b;
  15395. t.thabengali = 0x09a5;
  15396. t.thadeva = 0x0925;
  15397. t.thagujarati = 0x0aa5;
  15398. t.thagurmukhi = 0x0a25;
  15399. t.thalarabic = 0x0630;
  15400. t.thalfinalarabic = 0xfeac;
  15401. t.thanthakhatlowleftthai = 0xf898;
  15402. t.thanthakhatlowrightthai = 0xf897;
  15403. t.thanthakhatthai = 0x0e4c;
  15404. t.thanthakhatupperleftthai = 0xf896;
  15405. t.theharabic = 0x062b;
  15406. t.thehfinalarabic = 0xfe9a;
  15407. t.thehinitialarabic = 0xfe9b;
  15408. t.thehmedialarabic = 0xfe9c;
  15409. t.thereexists = 0x2203;
  15410. t.therefore = 0x2234;
  15411. t.theta = 0x03b8;
  15412. t.theta1 = 0x03d1;
  15413. t.thetasymbolgreek = 0x03d1;
  15414. t.thieuthacirclekorean = 0x3279;
  15415. t.thieuthaparenkorean = 0x3219;
  15416. t.thieuthcirclekorean = 0x326b;
  15417. t.thieuthkorean = 0x314c;
  15418. t.thieuthparenkorean = 0x320b;
  15419. t.thirteencircle = 0x246c;
  15420. t.thirteenparen = 0x2480;
  15421. t.thirteenperiod = 0x2494;
  15422. t.thonangmonthothai = 0x0e11;
  15423. t.thook = 0x01ad;
  15424. t.thophuthaothai = 0x0e12;
  15425. t.thorn = 0x00fe;
  15426. t.thothahanthai = 0x0e17;
  15427. t.thothanthai = 0x0e10;
  15428. t.thothongthai = 0x0e18;
  15429. t.thothungthai = 0x0e16;
  15430. t.thousandcyrillic = 0x0482;
  15431. t.thousandsseparatorarabic = 0x066c;
  15432. t.thousandsseparatorpersian = 0x066c;
  15433. t.three = 0x0033;
  15434. t.threearabic = 0x0663;
  15435. t.threebengali = 0x09e9;
  15436. t.threecircle = 0x2462;
  15437. t.threecircleinversesansserif = 0x278c;
  15438. t.threedeva = 0x0969;
  15439. t.threeeighths = 0x215c;
  15440. t.threegujarati = 0x0ae9;
  15441. t.threegurmukhi = 0x0a69;
  15442. t.threehackarabic = 0x0663;
  15443. t.threehangzhou = 0x3023;
  15444. t.threeideographicparen = 0x3222;
  15445. t.threeinferior = 0x2083;
  15446. t.threemonospace = 0xff13;
  15447. t.threenumeratorbengali = 0x09f6;
  15448. t.threeoldstyle = 0xf733;
  15449. t.threeparen = 0x2476;
  15450. t.threeperiod = 0x248a;
  15451. t.threepersian = 0x06f3;
  15452. t.threequarters = 0x00be;
  15453. t.threequartersemdash = 0xf6de;
  15454. t.threeroman = 0x2172;
  15455. t.threesuperior = 0x00b3;
  15456. t.threethai = 0x0e53;
  15457. t.thzsquare = 0x3394;
  15458. t.tihiragana = 0x3061;
  15459. t.tikatakana = 0x30c1;
  15460. t.tikatakanahalfwidth = 0xff81;
  15461. t.tikeutacirclekorean = 0x3270;
  15462. t.tikeutaparenkorean = 0x3210;
  15463. t.tikeutcirclekorean = 0x3262;
  15464. t.tikeutkorean = 0x3137;
  15465. t.tikeutparenkorean = 0x3202;
  15466. t.tilde = 0x02dc;
  15467. t.tildebelowcmb = 0x0330;
  15468. t.tildecmb = 0x0303;
  15469. t.tildecomb = 0x0303;
  15470. t.tildedoublecmb = 0x0360;
  15471. t.tildeoperator = 0x223c;
  15472. t.tildeoverlaycmb = 0x0334;
  15473. t.tildeverticalcmb = 0x033e;
  15474. t.timescircle = 0x2297;
  15475. t.tipehahebrew = 0x0596;
  15476. t.tipehalefthebrew = 0x0596;
  15477. t.tippigurmukhi = 0x0a70;
  15478. t.titlocyrilliccmb = 0x0483;
  15479. t.tiwnarmenian = 0x057f;
  15480. t.tlinebelow = 0x1e6f;
  15481. t.tmonospace = 0xff54;
  15482. t.toarmenian = 0x0569;
  15483. t.tohiragana = 0x3068;
  15484. t.tokatakana = 0x30c8;
  15485. t.tokatakanahalfwidth = 0xff84;
  15486. t.tonebarextrahighmod = 0x02e5;
  15487. t.tonebarextralowmod = 0x02e9;
  15488. t.tonebarhighmod = 0x02e6;
  15489. t.tonebarlowmod = 0x02e8;
  15490. t.tonebarmidmod = 0x02e7;
  15491. t.tonefive = 0x01bd;
  15492. t.tonesix = 0x0185;
  15493. t.tonetwo = 0x01a8;
  15494. t.tonos = 0x0384;
  15495. t.tonsquare = 0x3327;
  15496. t.topatakthai = 0x0e0f;
  15497. t.tortoiseshellbracketleft = 0x3014;
  15498. t.tortoiseshellbracketleftsmall = 0xfe5d;
  15499. t.tortoiseshellbracketleftvertical = 0xfe39;
  15500. t.tortoiseshellbracketright = 0x3015;
  15501. t.tortoiseshellbracketrightsmall = 0xfe5e;
  15502. t.tortoiseshellbracketrightvertical = 0xfe3a;
  15503. t.totaothai = 0x0e15;
  15504. t.tpalatalhook = 0x01ab;
  15505. t.tparen = 0x24af;
  15506. t.trademark = 0x2122;
  15507. t.trademarksans = 0xf8ea;
  15508. t.trademarkserif = 0xf6db;
  15509. t.tretroflexhook = 0x0288;
  15510. t.triagdn = 0x25bc;
  15511. t.triaglf = 0x25c4;
  15512. t.triagrt = 0x25ba;
  15513. t.triagup = 0x25b2;
  15514. t.ts = 0x02a6;
  15515. t.tsadi = 0x05e6;
  15516. t.tsadidagesh = 0xfb46;
  15517. t.tsadidageshhebrew = 0xfb46;
  15518. t.tsadihebrew = 0x05e6;
  15519. t.tsecyrillic = 0x0446;
  15520. t.tsere = 0x05b5;
  15521. t.tsere12 = 0x05b5;
  15522. t.tsere1e = 0x05b5;
  15523. t.tsere2b = 0x05b5;
  15524. t.tserehebrew = 0x05b5;
  15525. t.tserenarrowhebrew = 0x05b5;
  15526. t.tserequarterhebrew = 0x05b5;
  15527. t.tserewidehebrew = 0x05b5;
  15528. t.tshecyrillic = 0x045b;
  15529. t.tsuperior = 0xf6f3;
  15530. t.ttabengali = 0x099f;
  15531. t.ttadeva = 0x091f;
  15532. t.ttagujarati = 0x0a9f;
  15533. t.ttagurmukhi = 0x0a1f;
  15534. t.tteharabic = 0x0679;
  15535. t.ttehfinalarabic = 0xfb67;
  15536. t.ttehinitialarabic = 0xfb68;
  15537. t.ttehmedialarabic = 0xfb69;
  15538. t.tthabengali = 0x09a0;
  15539. t.tthadeva = 0x0920;
  15540. t.tthagujarati = 0x0aa0;
  15541. t.tthagurmukhi = 0x0a20;
  15542. t.tturned = 0x0287;
  15543. t.tuhiragana = 0x3064;
  15544. t.tukatakana = 0x30c4;
  15545. t.tukatakanahalfwidth = 0xff82;
  15546. t.tusmallhiragana = 0x3063;
  15547. t.tusmallkatakana = 0x30c3;
  15548. t.tusmallkatakanahalfwidth = 0xff6f;
  15549. t.twelvecircle = 0x246b;
  15550. t.twelveparen = 0x247f;
  15551. t.twelveperiod = 0x2493;
  15552. t.twelveroman = 0x217b;
  15553. t.twentycircle = 0x2473;
  15554. t.twentyhangzhou = 0x5344;
  15555. t.twentyparen = 0x2487;
  15556. t.twentyperiod = 0x249b;
  15557. t.two = 0x0032;
  15558. t.twoarabic = 0x0662;
  15559. t.twobengali = 0x09e8;
  15560. t.twocircle = 0x2461;
  15561. t.twocircleinversesansserif = 0x278b;
  15562. t.twodeva = 0x0968;
  15563. t.twodotenleader = 0x2025;
  15564. t.twodotleader = 0x2025;
  15565. t.twodotleadervertical = 0xfe30;
  15566. t.twogujarati = 0x0ae8;
  15567. t.twogurmukhi = 0x0a68;
  15568. t.twohackarabic = 0x0662;
  15569. t.twohangzhou = 0x3022;
  15570. t.twoideographicparen = 0x3221;
  15571. t.twoinferior = 0x2082;
  15572. t.twomonospace = 0xff12;
  15573. t.twonumeratorbengali = 0x09f5;
  15574. t.twooldstyle = 0xf732;
  15575. t.twoparen = 0x2475;
  15576. t.twoperiod = 0x2489;
  15577. t.twopersian = 0x06f2;
  15578. t.tworoman = 0x2171;
  15579. t.twostroke = 0x01bb;
  15580. t.twosuperior = 0x00b2;
  15581. t.twothai = 0x0e52;
  15582. t.twothirds = 0x2154;
  15583. t.u = 0x0075;
  15584. t.uacute = 0x00fa;
  15585. t.ubar = 0x0289;
  15586. t.ubengali = 0x0989;
  15587. t.ubopomofo = 0x3128;
  15588. t.ubreve = 0x016d;
  15589. t.ucaron = 0x01d4;
  15590. t.ucircle = 0x24e4;
  15591. t.ucircumflex = 0x00fb;
  15592. t.ucircumflexbelow = 0x1e77;
  15593. t.ucyrillic = 0x0443;
  15594. t.udattadeva = 0x0951;
  15595. t.udblacute = 0x0171;
  15596. t.udblgrave = 0x0215;
  15597. t.udeva = 0x0909;
  15598. t.udieresis = 0x00fc;
  15599. t.udieresisacute = 0x01d8;
  15600. t.udieresisbelow = 0x1e73;
  15601. t.udieresiscaron = 0x01da;
  15602. t.udieresiscyrillic = 0x04f1;
  15603. t.udieresisgrave = 0x01dc;
  15604. t.udieresismacron = 0x01d6;
  15605. t.udotbelow = 0x1ee5;
  15606. t.ugrave = 0x00f9;
  15607. t.ugujarati = 0x0a89;
  15608. t.ugurmukhi = 0x0a09;
  15609. t.uhiragana = 0x3046;
  15610. t.uhookabove = 0x1ee7;
  15611. t.uhorn = 0x01b0;
  15612. t.uhornacute = 0x1ee9;
  15613. t.uhorndotbelow = 0x1ef1;
  15614. t.uhorngrave = 0x1eeb;
  15615. t.uhornhookabove = 0x1eed;
  15616. t.uhorntilde = 0x1eef;
  15617. t.uhungarumlaut = 0x0171;
  15618. t.uhungarumlautcyrillic = 0x04f3;
  15619. t.uinvertedbreve = 0x0217;
  15620. t.ukatakana = 0x30a6;
  15621. t.ukatakanahalfwidth = 0xff73;
  15622. t.ukcyrillic = 0x0479;
  15623. t.ukorean = 0x315c;
  15624. t.umacron = 0x016b;
  15625. t.umacroncyrillic = 0x04ef;
  15626. t.umacrondieresis = 0x1e7b;
  15627. t.umatragurmukhi = 0x0a41;
  15628. t.umonospace = 0xff55;
  15629. t.underscore = 0x005f;
  15630. t.underscoredbl = 0x2017;
  15631. t.underscoremonospace = 0xff3f;
  15632. t.underscorevertical = 0xfe33;
  15633. t.underscorewavy = 0xfe4f;
  15634. t.union = 0x222a;
  15635. t.universal = 0x2200;
  15636. t.uogonek = 0x0173;
  15637. t.uparen = 0x24b0;
  15638. t.upblock = 0x2580;
  15639. t.upperdothebrew = 0x05c4;
  15640. t.upsilon = 0x03c5;
  15641. t.upsilondieresis = 0x03cb;
  15642. t.upsilondieresistonos = 0x03b0;
  15643. t.upsilonlatin = 0x028a;
  15644. t.upsilontonos = 0x03cd;
  15645. t.uptackbelowcmb = 0x031d;
  15646. t.uptackmod = 0x02d4;
  15647. t.uragurmukhi = 0x0a73;
  15648. t.uring = 0x016f;
  15649. t.ushortcyrillic = 0x045e;
  15650. t.usmallhiragana = 0x3045;
  15651. t.usmallkatakana = 0x30a5;
  15652. t.usmallkatakanahalfwidth = 0xff69;
  15653. t.ustraightcyrillic = 0x04af;
  15654. t.ustraightstrokecyrillic = 0x04b1;
  15655. t.utilde = 0x0169;
  15656. t.utildeacute = 0x1e79;
  15657. t.utildebelow = 0x1e75;
  15658. t.uubengali = 0x098a;
  15659. t.uudeva = 0x090a;
  15660. t.uugujarati = 0x0a8a;
  15661. t.uugurmukhi = 0x0a0a;
  15662. t.uumatragurmukhi = 0x0a42;
  15663. t.uuvowelsignbengali = 0x09c2;
  15664. t.uuvowelsigndeva = 0x0942;
  15665. t.uuvowelsigngujarati = 0x0ac2;
  15666. t.uvowelsignbengali = 0x09c1;
  15667. t.uvowelsigndeva = 0x0941;
  15668. t.uvowelsigngujarati = 0x0ac1;
  15669. t.v = 0x0076;
  15670. t.vadeva = 0x0935;
  15671. t.vagujarati = 0x0ab5;
  15672. t.vagurmukhi = 0x0a35;
  15673. t.vakatakana = 0x30f7;
  15674. t.vav = 0x05d5;
  15675. t.vavdagesh = 0xfb35;
  15676. t.vavdagesh65 = 0xfb35;
  15677. t.vavdageshhebrew = 0xfb35;
  15678. t.vavhebrew = 0x05d5;
  15679. t.vavholam = 0xfb4b;
  15680. t.vavholamhebrew = 0xfb4b;
  15681. t.vavvavhebrew = 0x05f0;
  15682. t.vavyodhebrew = 0x05f1;
  15683. t.vcircle = 0x24e5;
  15684. t.vdotbelow = 0x1e7f;
  15685. t.vecyrillic = 0x0432;
  15686. t.veharabic = 0x06a4;
  15687. t.vehfinalarabic = 0xfb6b;
  15688. t.vehinitialarabic = 0xfb6c;
  15689. t.vehmedialarabic = 0xfb6d;
  15690. t.vekatakana = 0x30f9;
  15691. t.venus = 0x2640;
  15692. t.verticalbar = 0x007c;
  15693. t.verticallineabovecmb = 0x030d;
  15694. t.verticallinebelowcmb = 0x0329;
  15695. t.verticallinelowmod = 0x02cc;
  15696. t.verticallinemod = 0x02c8;
  15697. t.vewarmenian = 0x057e;
  15698. t.vhook = 0x028b;
  15699. t.vikatakana = 0x30f8;
  15700. t.viramabengali = 0x09cd;
  15701. t.viramadeva = 0x094d;
  15702. t.viramagujarati = 0x0acd;
  15703. t.visargabengali = 0x0983;
  15704. t.visargadeva = 0x0903;
  15705. t.visargagujarati = 0x0a83;
  15706. t.vmonospace = 0xff56;
  15707. t.voarmenian = 0x0578;
  15708. t.voicediterationhiragana = 0x309e;
  15709. t.voicediterationkatakana = 0x30fe;
  15710. t.voicedmarkkana = 0x309b;
  15711. t.voicedmarkkanahalfwidth = 0xff9e;
  15712. t.vokatakana = 0x30fa;
  15713. t.vparen = 0x24b1;
  15714. t.vtilde = 0x1e7d;
  15715. t.vturned = 0x028c;
  15716. t.vuhiragana = 0x3094;
  15717. t.vukatakana = 0x30f4;
  15718. t.w = 0x0077;
  15719. t.wacute = 0x1e83;
  15720. t.waekorean = 0x3159;
  15721. t.wahiragana = 0x308f;
  15722. t.wakatakana = 0x30ef;
  15723. t.wakatakanahalfwidth = 0xff9c;
  15724. t.wakorean = 0x3158;
  15725. t.wasmallhiragana = 0x308e;
  15726. t.wasmallkatakana = 0x30ee;
  15727. t.wattosquare = 0x3357;
  15728. t.wavedash = 0x301c;
  15729. t.wavyunderscorevertical = 0xfe34;
  15730. t.wawarabic = 0x0648;
  15731. t.wawfinalarabic = 0xfeee;
  15732. t.wawhamzaabovearabic = 0x0624;
  15733. t.wawhamzaabovefinalarabic = 0xfe86;
  15734. t.wbsquare = 0x33dd;
  15735. t.wcircle = 0x24e6;
  15736. t.wcircumflex = 0x0175;
  15737. t.wdieresis = 0x1e85;
  15738. t.wdotaccent = 0x1e87;
  15739. t.wdotbelow = 0x1e89;
  15740. t.wehiragana = 0x3091;
  15741. t.weierstrass = 0x2118;
  15742. t.wekatakana = 0x30f1;
  15743. t.wekorean = 0x315e;
  15744. t.weokorean = 0x315d;
  15745. t.wgrave = 0x1e81;
  15746. t.whitebullet = 0x25e6;
  15747. t.whitecircle = 0x25cb;
  15748. t.whitecircleinverse = 0x25d9;
  15749. t.whitecornerbracketleft = 0x300e;
  15750. t.whitecornerbracketleftvertical = 0xfe43;
  15751. t.whitecornerbracketright = 0x300f;
  15752. t.whitecornerbracketrightvertical = 0xfe44;
  15753. t.whitediamond = 0x25c7;
  15754. t.whitediamondcontainingblacksmalldiamond = 0x25c8;
  15755. t.whitedownpointingsmalltriangle = 0x25bf;
  15756. t.whitedownpointingtriangle = 0x25bd;
  15757. t.whiteleftpointingsmalltriangle = 0x25c3;
  15758. t.whiteleftpointingtriangle = 0x25c1;
  15759. t.whitelenticularbracketleft = 0x3016;
  15760. t.whitelenticularbracketright = 0x3017;
  15761. t.whiterightpointingsmalltriangle = 0x25b9;
  15762. t.whiterightpointingtriangle = 0x25b7;
  15763. t.whitesmallsquare = 0x25ab;
  15764. t.whitesmilingface = 0x263a;
  15765. t.whitesquare = 0x25a1;
  15766. t.whitestar = 0x2606;
  15767. t.whitetelephone = 0x260f;
  15768. t.whitetortoiseshellbracketleft = 0x3018;
  15769. t.whitetortoiseshellbracketright = 0x3019;
  15770. t.whiteuppointingsmalltriangle = 0x25b5;
  15771. t.whiteuppointingtriangle = 0x25b3;
  15772. t.wihiragana = 0x3090;
  15773. t.wikatakana = 0x30f0;
  15774. t.wikorean = 0x315f;
  15775. t.wmonospace = 0xff57;
  15776. t.wohiragana = 0x3092;
  15777. t.wokatakana = 0x30f2;
  15778. t.wokatakanahalfwidth = 0xff66;
  15779. t.won = 0x20a9;
  15780. t.wonmonospace = 0xffe6;
  15781. t.wowaenthai = 0x0e27;
  15782. t.wparen = 0x24b2;
  15783. t.wring = 0x1e98;
  15784. t.wsuperior = 0x02b7;
  15785. t.wturned = 0x028d;
  15786. t.wynn = 0x01bf;
  15787. t.x = 0x0078;
  15788. t.xabovecmb = 0x033d;
  15789. t.xbopomofo = 0x3112;
  15790. t.xcircle = 0x24e7;
  15791. t.xdieresis = 0x1e8d;
  15792. t.xdotaccent = 0x1e8b;
  15793. t.xeharmenian = 0x056d;
  15794. t.xi = 0x03be;
  15795. t.xmonospace = 0xff58;
  15796. t.xparen = 0x24b3;
  15797. t.xsuperior = 0x02e3;
  15798. t.y = 0x0079;
  15799. t.yaadosquare = 0x334e;
  15800. t.yabengali = 0x09af;
  15801. t.yacute = 0x00fd;
  15802. t.yadeva = 0x092f;
  15803. t.yaekorean = 0x3152;
  15804. t.yagujarati = 0x0aaf;
  15805. t.yagurmukhi = 0x0a2f;
  15806. t.yahiragana = 0x3084;
  15807. t.yakatakana = 0x30e4;
  15808. t.yakatakanahalfwidth = 0xff94;
  15809. t.yakorean = 0x3151;
  15810. t.yamakkanthai = 0x0e4e;
  15811. t.yasmallhiragana = 0x3083;
  15812. t.yasmallkatakana = 0x30e3;
  15813. t.yasmallkatakanahalfwidth = 0xff6c;
  15814. t.yatcyrillic = 0x0463;
  15815. t.ycircle = 0x24e8;
  15816. t.ycircumflex = 0x0177;
  15817. t.ydieresis = 0x00ff;
  15818. t.ydotaccent = 0x1e8f;
  15819. t.ydotbelow = 0x1ef5;
  15820. t.yeharabic = 0x064a;
  15821. t.yehbarreearabic = 0x06d2;
  15822. t.yehbarreefinalarabic = 0xfbaf;
  15823. t.yehfinalarabic = 0xfef2;
  15824. t.yehhamzaabovearabic = 0x0626;
  15825. t.yehhamzaabovefinalarabic = 0xfe8a;
  15826. t.yehhamzaaboveinitialarabic = 0xfe8b;
  15827. t.yehhamzaabovemedialarabic = 0xfe8c;
  15828. t.yehinitialarabic = 0xfef3;
  15829. t.yehmedialarabic = 0xfef4;
  15830. t.yehmeeminitialarabic = 0xfcdd;
  15831. t.yehmeemisolatedarabic = 0xfc58;
  15832. t.yehnoonfinalarabic = 0xfc94;
  15833. t.yehthreedotsbelowarabic = 0x06d1;
  15834. t.yekorean = 0x3156;
  15835. t.yen = 0x00a5;
  15836. t.yenmonospace = 0xffe5;
  15837. t.yeokorean = 0x3155;
  15838. t.yeorinhieuhkorean = 0x3186;
  15839. t.yerahbenyomohebrew = 0x05aa;
  15840. t.yerahbenyomolefthebrew = 0x05aa;
  15841. t.yericyrillic = 0x044b;
  15842. t.yerudieresiscyrillic = 0x04f9;
  15843. t.yesieungkorean = 0x3181;
  15844. t.yesieungpansioskorean = 0x3183;
  15845. t.yesieungsioskorean = 0x3182;
  15846. t.yetivhebrew = 0x059a;
  15847. t.ygrave = 0x1ef3;
  15848. t.yhook = 0x01b4;
  15849. t.yhookabove = 0x1ef7;
  15850. t.yiarmenian = 0x0575;
  15851. t.yicyrillic = 0x0457;
  15852. t.yikorean = 0x3162;
  15853. t.yinyang = 0x262f;
  15854. t.yiwnarmenian = 0x0582;
  15855. t.ymonospace = 0xff59;
  15856. t.yod = 0x05d9;
  15857. t.yoddagesh = 0xfb39;
  15858. t.yoddageshhebrew = 0xfb39;
  15859. t.yodhebrew = 0x05d9;
  15860. t.yodyodhebrew = 0x05f2;
  15861. t.yodyodpatahhebrew = 0xfb1f;
  15862. t.yohiragana = 0x3088;
  15863. t.yoikorean = 0x3189;
  15864. t.yokatakana = 0x30e8;
  15865. t.yokatakanahalfwidth = 0xff96;
  15866. t.yokorean = 0x315b;
  15867. t.yosmallhiragana = 0x3087;
  15868. t.yosmallkatakana = 0x30e7;
  15869. t.yosmallkatakanahalfwidth = 0xff6e;
  15870. t.yotgreek = 0x03f3;
  15871. t.yoyaekorean = 0x3188;
  15872. t.yoyakorean = 0x3187;
  15873. t.yoyakthai = 0x0e22;
  15874. t.yoyingthai = 0x0e0d;
  15875. t.yparen = 0x24b4;
  15876. t.ypogegrammeni = 0x037a;
  15877. t.ypogegrammenigreekcmb = 0x0345;
  15878. t.yr = 0x01a6;
  15879. t.yring = 0x1e99;
  15880. t.ysuperior = 0x02b8;
  15881. t.ytilde = 0x1ef9;
  15882. t.yturned = 0x028e;
  15883. t.yuhiragana = 0x3086;
  15884. t.yuikorean = 0x318c;
  15885. t.yukatakana = 0x30e6;
  15886. t.yukatakanahalfwidth = 0xff95;
  15887. t.yukorean = 0x3160;
  15888. t.yusbigcyrillic = 0x046b;
  15889. t.yusbigiotifiedcyrillic = 0x046d;
  15890. t.yuslittlecyrillic = 0x0467;
  15891. t.yuslittleiotifiedcyrillic = 0x0469;
  15892. t.yusmallhiragana = 0x3085;
  15893. t.yusmallkatakana = 0x30e5;
  15894. t.yusmallkatakanahalfwidth = 0xff6d;
  15895. t.yuyekorean = 0x318b;
  15896. t.yuyeokorean = 0x318a;
  15897. t.yyabengali = 0x09df;
  15898. t.yyadeva = 0x095f;
  15899. t.z = 0x007a;
  15900. t.zaarmenian = 0x0566;
  15901. t.zacute = 0x017a;
  15902. t.zadeva = 0x095b;
  15903. t.zagurmukhi = 0x0a5b;
  15904. t.zaharabic = 0x0638;
  15905. t.zahfinalarabic = 0xfec6;
  15906. t.zahinitialarabic = 0xfec7;
  15907. t.zahiragana = 0x3056;
  15908. t.zahmedialarabic = 0xfec8;
  15909. t.zainarabic = 0x0632;
  15910. t.zainfinalarabic = 0xfeb0;
  15911. t.zakatakana = 0x30b6;
  15912. t.zaqefgadolhebrew = 0x0595;
  15913. t.zaqefqatanhebrew = 0x0594;
  15914. t.zarqahebrew = 0x0598;
  15915. t.zayin = 0x05d6;
  15916. t.zayindagesh = 0xfb36;
  15917. t.zayindageshhebrew = 0xfb36;
  15918. t.zayinhebrew = 0x05d6;
  15919. t.zbopomofo = 0x3117;
  15920. t.zcaron = 0x017e;
  15921. t.zcircle = 0x24e9;
  15922. t.zcircumflex = 0x1e91;
  15923. t.zcurl = 0x0291;
  15924. t.zdot = 0x017c;
  15925. t.zdotaccent = 0x017c;
  15926. t.zdotbelow = 0x1e93;
  15927. t.zecyrillic = 0x0437;
  15928. t.zedescendercyrillic = 0x0499;
  15929. t.zedieresiscyrillic = 0x04df;
  15930. t.zehiragana = 0x305c;
  15931. t.zekatakana = 0x30bc;
  15932. t.zero = 0x0030;
  15933. t.zeroarabic = 0x0660;
  15934. t.zerobengali = 0x09e6;
  15935. t.zerodeva = 0x0966;
  15936. t.zerogujarati = 0x0ae6;
  15937. t.zerogurmukhi = 0x0a66;
  15938. t.zerohackarabic = 0x0660;
  15939. t.zeroinferior = 0x2080;
  15940. t.zeromonospace = 0xff10;
  15941. t.zerooldstyle = 0xf730;
  15942. t.zeropersian = 0x06f0;
  15943. t.zerosuperior = 0x2070;
  15944. t.zerothai = 0x0e50;
  15945. t.zerowidthjoiner = 0xfeff;
  15946. t.zerowidthnonjoiner = 0x200c;
  15947. t.zerowidthspace = 0x200b;
  15948. t.zeta = 0x03b6;
  15949. t.zhbopomofo = 0x3113;
  15950. t.zhearmenian = 0x056a;
  15951. t.zhebrevecyrillic = 0x04c2;
  15952. t.zhecyrillic = 0x0436;
  15953. t.zhedescendercyrillic = 0x0497;
  15954. t.zhedieresiscyrillic = 0x04dd;
  15955. t.zihiragana = 0x3058;
  15956. t.zikatakana = 0x30b8;
  15957. t.zinorhebrew = 0x05ae;
  15958. t.zlinebelow = 0x1e95;
  15959. t.zmonospace = 0xff5a;
  15960. t.zohiragana = 0x305e;
  15961. t.zokatakana = 0x30be;
  15962. t.zparen = 0x24b5;
  15963. t.zretroflexhook = 0x0290;
  15964. t.zstroke = 0x01b6;
  15965. t.zuhiragana = 0x305a;
  15966. t.zukatakana = 0x30ba;
  15967. t[".notdef"] = 0x0000;
  15968. t.angbracketleftbig = 0x2329;
  15969. t.angbracketleftBig = 0x2329;
  15970. t.angbracketleftbigg = 0x2329;
  15971. t.angbracketleftBigg = 0x2329;
  15972. t.angbracketrightBig = 0x232a;
  15973. t.angbracketrightbig = 0x232a;
  15974. t.angbracketrightBigg = 0x232a;
  15975. t.angbracketrightbigg = 0x232a;
  15976. t.arrowhookleft = 0x21aa;
  15977. t.arrowhookright = 0x21a9;
  15978. t.arrowlefttophalf = 0x21bc;
  15979. t.arrowleftbothalf = 0x21bd;
  15980. t.arrownortheast = 0x2197;
  15981. t.arrownorthwest = 0x2196;
  15982. t.arrowrighttophalf = 0x21c0;
  15983. t.arrowrightbothalf = 0x21c1;
  15984. t.arrowsoutheast = 0x2198;
  15985. t.arrowsouthwest = 0x2199;
  15986. t.backslashbig = 0x2216;
  15987. t.backslashBig = 0x2216;
  15988. t.backslashBigg = 0x2216;
  15989. t.backslashbigg = 0x2216;
  15990. t.bardbl = 0x2016;
  15991. t.bracehtipdownleft = 0xfe37;
  15992. t.bracehtipdownright = 0xfe37;
  15993. t.bracehtipupleft = 0xfe38;
  15994. t.bracehtipupright = 0xfe38;
  15995. t.braceleftBig = 0x007b;
  15996. t.braceleftbig = 0x007b;
  15997. t.braceleftbigg = 0x007b;
  15998. t.braceleftBigg = 0x007b;
  15999. t.bracerightBig = 0x007d;
  16000. t.bracerightbig = 0x007d;
  16001. t.bracerightbigg = 0x007d;
  16002. t.bracerightBigg = 0x007d;
  16003. t.bracketleftbig = 0x005b;
  16004. t.bracketleftBig = 0x005b;
  16005. t.bracketleftbigg = 0x005b;
  16006. t.bracketleftBigg = 0x005b;
  16007. t.bracketrightBig = 0x005d;
  16008. t.bracketrightbig = 0x005d;
  16009. t.bracketrightbigg = 0x005d;
  16010. t.bracketrightBigg = 0x005d;
  16011. t.ceilingleftbig = 0x2308;
  16012. t.ceilingleftBig = 0x2308;
  16013. t.ceilingleftBigg = 0x2308;
  16014. t.ceilingleftbigg = 0x2308;
  16015. t.ceilingrightbig = 0x2309;
  16016. t.ceilingrightBig = 0x2309;
  16017. t.ceilingrightbigg = 0x2309;
  16018. t.ceilingrightBigg = 0x2309;
  16019. t.circledotdisplay = 0x2299;
  16020. t.circledottext = 0x2299;
  16021. t.circlemultiplydisplay = 0x2297;
  16022. t.circlemultiplytext = 0x2297;
  16023. t.circleplusdisplay = 0x2295;
  16024. t.circleplustext = 0x2295;
  16025. t.contintegraldisplay = 0x222e;
  16026. t.contintegraltext = 0x222e;
  16027. t.coproductdisplay = 0x2210;
  16028. t.coproducttext = 0x2210;
  16029. t.floorleftBig = 0x230a;
  16030. t.floorleftbig = 0x230a;
  16031. t.floorleftbigg = 0x230a;
  16032. t.floorleftBigg = 0x230a;
  16033. t.floorrightbig = 0x230b;
  16034. t.floorrightBig = 0x230b;
  16035. t.floorrightBigg = 0x230b;
  16036. t.floorrightbigg = 0x230b;
  16037. t.hatwide = 0x0302;
  16038. t.hatwider = 0x0302;
  16039. t.hatwidest = 0x0302;
  16040. t.intercal = 0x1d40;
  16041. t.integraldisplay = 0x222b;
  16042. t.integraltext = 0x222b;
  16043. t.intersectiondisplay = 0x22c2;
  16044. t.intersectiontext = 0x22c2;
  16045. t.logicalanddisplay = 0x2227;
  16046. t.logicalandtext = 0x2227;
  16047. t.logicalordisplay = 0x2228;
  16048. t.logicalortext = 0x2228;
  16049. t.parenleftBig = 0x0028;
  16050. t.parenleftbig = 0x0028;
  16051. t.parenleftBigg = 0x0028;
  16052. t.parenleftbigg = 0x0028;
  16053. t.parenrightBig = 0x0029;
  16054. t.parenrightbig = 0x0029;
  16055. t.parenrightBigg = 0x0029;
  16056. t.parenrightbigg = 0x0029;
  16057. t.prime = 0x2032;
  16058. t.productdisplay = 0x220f;
  16059. t.producttext = 0x220f;
  16060. t.radicalbig = 0x221a;
  16061. t.radicalBig = 0x221a;
  16062. t.radicalBigg = 0x221a;
  16063. t.radicalbigg = 0x221a;
  16064. t.radicalbt = 0x221a;
  16065. t.radicaltp = 0x221a;
  16066. t.radicalvertex = 0x221a;
  16067. t.slashbig = 0x002f;
  16068. t.slashBig = 0x002f;
  16069. t.slashBigg = 0x002f;
  16070. t.slashbigg = 0x002f;
  16071. t.summationdisplay = 0x2211;
  16072. t.summationtext = 0x2211;
  16073. t.tildewide = 0x02dc;
  16074. t.tildewider = 0x02dc;
  16075. t.tildewidest = 0x02dc;
  16076. t.uniondisplay = 0x22c3;
  16077. t.unionmultidisplay = 0x228e;
  16078. t.unionmultitext = 0x228e;
  16079. t.unionsqdisplay = 0x2294;
  16080. t.unionsqtext = 0x2294;
  16081. t.uniontext = 0x22c3;
  16082. t.vextenddouble = 0x2225;
  16083. t.vextendsingle = 0x2223;
  16084. });
  16085. const getDingbatsGlyphsUnicode = getLookupTableFactory(function (t) {
  16086. t.space = 0x0020;
  16087. t.a1 = 0x2701;
  16088. t.a2 = 0x2702;
  16089. t.a202 = 0x2703;
  16090. t.a3 = 0x2704;
  16091. t.a4 = 0x260e;
  16092. t.a5 = 0x2706;
  16093. t.a119 = 0x2707;
  16094. t.a118 = 0x2708;
  16095. t.a117 = 0x2709;
  16096. t.a11 = 0x261b;
  16097. t.a12 = 0x261e;
  16098. t.a13 = 0x270c;
  16099. t.a14 = 0x270d;
  16100. t.a15 = 0x270e;
  16101. t.a16 = 0x270f;
  16102. t.a105 = 0x2710;
  16103. t.a17 = 0x2711;
  16104. t.a18 = 0x2712;
  16105. t.a19 = 0x2713;
  16106. t.a20 = 0x2714;
  16107. t.a21 = 0x2715;
  16108. t.a22 = 0x2716;
  16109. t.a23 = 0x2717;
  16110. t.a24 = 0x2718;
  16111. t.a25 = 0x2719;
  16112. t.a26 = 0x271a;
  16113. t.a27 = 0x271b;
  16114. t.a28 = 0x271c;
  16115. t.a6 = 0x271d;
  16116. t.a7 = 0x271e;
  16117. t.a8 = 0x271f;
  16118. t.a9 = 0x2720;
  16119. t.a10 = 0x2721;
  16120. t.a29 = 0x2722;
  16121. t.a30 = 0x2723;
  16122. t.a31 = 0x2724;
  16123. t.a32 = 0x2725;
  16124. t.a33 = 0x2726;
  16125. t.a34 = 0x2727;
  16126. t.a35 = 0x2605;
  16127. t.a36 = 0x2729;
  16128. t.a37 = 0x272a;
  16129. t.a38 = 0x272b;
  16130. t.a39 = 0x272c;
  16131. t.a40 = 0x272d;
  16132. t.a41 = 0x272e;
  16133. t.a42 = 0x272f;
  16134. t.a43 = 0x2730;
  16135. t.a44 = 0x2731;
  16136. t.a45 = 0x2732;
  16137. t.a46 = 0x2733;
  16138. t.a47 = 0x2734;
  16139. t.a48 = 0x2735;
  16140. t.a49 = 0x2736;
  16141. t.a50 = 0x2737;
  16142. t.a51 = 0x2738;
  16143. t.a52 = 0x2739;
  16144. t.a53 = 0x273a;
  16145. t.a54 = 0x273b;
  16146. t.a55 = 0x273c;
  16147. t.a56 = 0x273d;
  16148. t.a57 = 0x273e;
  16149. t.a58 = 0x273f;
  16150. t.a59 = 0x2740;
  16151. t.a60 = 0x2741;
  16152. t.a61 = 0x2742;
  16153. t.a62 = 0x2743;
  16154. t.a63 = 0x2744;
  16155. t.a64 = 0x2745;
  16156. t.a65 = 0x2746;
  16157. t.a66 = 0x2747;
  16158. t.a67 = 0x2748;
  16159. t.a68 = 0x2749;
  16160. t.a69 = 0x274a;
  16161. t.a70 = 0x274b;
  16162. t.a71 = 0x25cf;
  16163. t.a72 = 0x274d;
  16164. t.a73 = 0x25a0;
  16165. t.a74 = 0x274f;
  16166. t.a203 = 0x2750;
  16167. t.a75 = 0x2751;
  16168. t.a204 = 0x2752;
  16169. t.a76 = 0x25b2;
  16170. t.a77 = 0x25bc;
  16171. t.a78 = 0x25c6;
  16172. t.a79 = 0x2756;
  16173. t.a81 = 0x25d7;
  16174. t.a82 = 0x2758;
  16175. t.a83 = 0x2759;
  16176. t.a84 = 0x275a;
  16177. t.a97 = 0x275b;
  16178. t.a98 = 0x275c;
  16179. t.a99 = 0x275d;
  16180. t.a100 = 0x275e;
  16181. t.a101 = 0x2761;
  16182. t.a102 = 0x2762;
  16183. t.a103 = 0x2763;
  16184. t.a104 = 0x2764;
  16185. t.a106 = 0x2765;
  16186. t.a107 = 0x2766;
  16187. t.a108 = 0x2767;
  16188. t.a112 = 0x2663;
  16189. t.a111 = 0x2666;
  16190. t.a110 = 0x2665;
  16191. t.a109 = 0x2660;
  16192. t.a120 = 0x2460;
  16193. t.a121 = 0x2461;
  16194. t.a122 = 0x2462;
  16195. t.a123 = 0x2463;
  16196. t.a124 = 0x2464;
  16197. t.a125 = 0x2465;
  16198. t.a126 = 0x2466;
  16199. t.a127 = 0x2467;
  16200. t.a128 = 0x2468;
  16201. t.a129 = 0x2469;
  16202. t.a130 = 0x2776;
  16203. t.a131 = 0x2777;
  16204. t.a132 = 0x2778;
  16205. t.a133 = 0x2779;
  16206. t.a134 = 0x277a;
  16207. t.a135 = 0x277b;
  16208. t.a136 = 0x277c;
  16209. t.a137 = 0x277d;
  16210. t.a138 = 0x277e;
  16211. t.a139 = 0x277f;
  16212. t.a140 = 0x2780;
  16213. t.a141 = 0x2781;
  16214. t.a142 = 0x2782;
  16215. t.a143 = 0x2783;
  16216. t.a144 = 0x2784;
  16217. t.a145 = 0x2785;
  16218. t.a146 = 0x2786;
  16219. t.a147 = 0x2787;
  16220. t.a148 = 0x2788;
  16221. t.a149 = 0x2789;
  16222. t.a150 = 0x278a;
  16223. t.a151 = 0x278b;
  16224. t.a152 = 0x278c;
  16225. t.a153 = 0x278d;
  16226. t.a154 = 0x278e;
  16227. t.a155 = 0x278f;
  16228. t.a156 = 0x2790;
  16229. t.a157 = 0x2791;
  16230. t.a158 = 0x2792;
  16231. t.a159 = 0x2793;
  16232. t.a160 = 0x2794;
  16233. t.a161 = 0x2192;
  16234. t.a163 = 0x2194;
  16235. t.a164 = 0x2195;
  16236. t.a196 = 0x2798;
  16237. t.a165 = 0x2799;
  16238. t.a192 = 0x279a;
  16239. t.a166 = 0x279b;
  16240. t.a167 = 0x279c;
  16241. t.a168 = 0x279d;
  16242. t.a169 = 0x279e;
  16243. t.a170 = 0x279f;
  16244. t.a171 = 0x27a0;
  16245. t.a172 = 0x27a1;
  16246. t.a173 = 0x27a2;
  16247. t.a162 = 0x27a3;
  16248. t.a174 = 0x27a4;
  16249. t.a175 = 0x27a5;
  16250. t.a176 = 0x27a6;
  16251. t.a177 = 0x27a7;
  16252. t.a178 = 0x27a8;
  16253. t.a179 = 0x27a9;
  16254. t.a193 = 0x27aa;
  16255. t.a180 = 0x27ab;
  16256. t.a199 = 0x27ac;
  16257. t.a181 = 0x27ad;
  16258. t.a200 = 0x27ae;
  16259. t.a182 = 0x27af;
  16260. t.a201 = 0x27b1;
  16261. t.a183 = 0x27b2;
  16262. t.a184 = 0x27b3;
  16263. t.a197 = 0x27b4;
  16264. t.a185 = 0x27b5;
  16265. t.a194 = 0x27b6;
  16266. t.a198 = 0x27b7;
  16267. t.a186 = 0x27b8;
  16268. t.a195 = 0x27b9;
  16269. t.a187 = 0x27ba;
  16270. t.a188 = 0x27bb;
  16271. t.a189 = 0x27bc;
  16272. t.a190 = 0x27bd;
  16273. t.a191 = 0x27be;
  16274. t.a89 = 0x2768;
  16275. t.a90 = 0x2769;
  16276. t.a93 = 0x276a;
  16277. t.a94 = 0x276b;
  16278. t.a91 = 0x276c;
  16279. t.a92 = 0x276d;
  16280. t.a205 = 0x276e;
  16281. t.a85 = 0x276f;
  16282. t.a206 = 0x2770;
  16283. t.a86 = 0x2771;
  16284. t.a87 = 0x2772;
  16285. t.a88 = 0x2773;
  16286. t.a95 = 0x2774;
  16287. t.a96 = 0x2775;
  16288. t[".notdef"] = 0x0000;
  16289. });
  16290. ;// ./src/core/unicode.js
  16291. const getSpecialPUASymbols = getLookupTableFactory(function (t) {
  16292. t[63721] = 0x00a9;
  16293. t[63193] = 0x00a9;
  16294. t[63720] = 0x00ae;
  16295. t[63194] = 0x00ae;
  16296. t[63722] = 0x2122;
  16297. t[63195] = 0x2122;
  16298. t[63729] = 0x23a7;
  16299. t[63730] = 0x23a8;
  16300. t[63731] = 0x23a9;
  16301. t[63740] = 0x23ab;
  16302. t[63741] = 0x23ac;
  16303. t[63742] = 0x23ad;
  16304. t[63726] = 0x23a1;
  16305. t[63727] = 0x23a2;
  16306. t[63728] = 0x23a3;
  16307. t[63737] = 0x23a4;
  16308. t[63738] = 0x23a5;
  16309. t[63739] = 0x23a6;
  16310. t[63723] = 0x239b;
  16311. t[63724] = 0x239c;
  16312. t[63725] = 0x239d;
  16313. t[63734] = 0x239e;
  16314. t[63735] = 0x239f;
  16315. t[63736] = 0x23a0;
  16316. });
  16317. function mapSpecialUnicodeValues(code) {
  16318. if (code >= 0xfff0 && code <= 0xffff) {
  16319. return 0;
  16320. } else if (code >= 0xf600 && code <= 0xf8ff) {
  16321. return getSpecialPUASymbols()[code] || code;
  16322. } else if (code === 0x00ad) {
  16323. return 0x002d;
  16324. }
  16325. return code;
  16326. }
  16327. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  16328. let unicode = glyphsUnicodeMap[name];
  16329. if (unicode !== undefined) {
  16330. return unicode;
  16331. }
  16332. if (!name) {
  16333. return -1;
  16334. }
  16335. if (name[0] === "u") {
  16336. const nameLen = name.length;
  16337. let hexStr;
  16338. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  16339. hexStr = name.substring(3);
  16340. } else if (nameLen >= 5 && nameLen <= 7) {
  16341. hexStr = name.substring(1);
  16342. } else {
  16343. return -1;
  16344. }
  16345. if (hexStr === hexStr.toUpperCase()) {
  16346. unicode = parseInt(hexStr, 16);
  16347. if (unicode >= 0) {
  16348. return unicode;
  16349. }
  16350. }
  16351. }
  16352. return -1;
  16353. }
  16354. const UnicodeRanges = [[0x0000, 0x007f], [0x0080, 0x00ff], [0x0100, 0x017f], [0x0180, 0x024f], [0x0250, 0x02af, 0x1d00, 0x1d7f, 0x1d80, 0x1dbf], [0x02b0, 0x02ff, 0xa700, 0xa71f], [0x0300, 0x036f, 0x1dc0, 0x1dff], [0x0370, 0x03ff], [0x2c80, 0x2cff], [0x0400, 0x04ff, 0x0500, 0x052f, 0x2de0, 0x2dff, 0xa640, 0xa69f], [0x0530, 0x058f], [0x0590, 0x05ff], [0xa500, 0xa63f], [0x0600, 0x06ff, 0x0750, 0x077f], [0x07c0, 0x07ff], [0x0900, 0x097f], [0x0980, 0x09ff], [0x0a00, 0x0a7f], [0x0a80, 0x0aff], [0x0b00, 0x0b7f], [0x0b80, 0x0bff], [0x0c00, 0x0c7f], [0x0c80, 0x0cff], [0x0d00, 0x0d7f], [0x0e00, 0x0e7f], [0x0e80, 0x0eff], [0x10a0, 0x10ff, 0x2d00, 0x2d2f], [0x1b00, 0x1b7f], [0x1100, 0x11ff], [0x1e00, 0x1eff, 0x2c60, 0x2c7f, 0xa720, 0xa7ff], [0x1f00, 0x1fff], [0x2000, 0x206f, 0x2e00, 0x2e7f], [0x2070, 0x209f], [0x20a0, 0x20cf], [0x20d0, 0x20ff], [0x2100, 0x214f], [0x2150, 0x218f], [0x2190, 0x21ff, 0x27f0, 0x27ff, 0x2900, 0x297f, 0x2b00, 0x2bff], [0x2200, 0x22ff, 0x2a00, 0x2aff, 0x27c0, 0x27ef, 0x2980, 0x29ff], [0x2300, 0x23ff], [0x2400, 0x243f], [0x2440, 0x245f], [0x2460, 0x24ff], [0x2500, 0x257f], [0x2580, 0x259f], [0x25a0, 0x25ff], [0x2600, 0x26ff], [0x2700, 0x27bf], [0x3000, 0x303f], [0x3040, 0x309f], [0x30a0, 0x30ff, 0x31f0, 0x31ff], [0x3100, 0x312f, 0x31a0, 0x31bf], [0x3130, 0x318f], [0xa840, 0xa87f], [0x3200, 0x32ff], [0x3300, 0x33ff], [0xac00, 0xd7af], [0xd800, 0xdfff], [0x10900, 0x1091f], [0x4e00, 0x9fff, 0x2e80, 0x2eff, 0x2f00, 0x2fdf, 0x2ff0, 0x2fff, 0x3400, 0x4dbf, 0x20000, 0x2a6df, 0x3190, 0x319f], [0xe000, 0xf8ff], [0x31c0, 0x31ef, 0xf900, 0xfaff, 0x2f800, 0x2fa1f], [0xfb00, 0xfb4f], [0xfb50, 0xfdff], [0xfe20, 0xfe2f], [0xfe10, 0xfe1f], [0xfe50, 0xfe6f], [0xfe70, 0xfeff], [0xff00, 0xffef], [0xfff0, 0xffff], [0x0f00, 0x0fff], [0x0700, 0x074f], [0x0780, 0x07bf], [0x0d80, 0x0dff], [0x1000, 0x109f], [0x1200, 0x137f, 0x1380, 0x139f, 0x2d80, 0x2ddf], [0x13a0, 0x13ff], [0x1400, 0x167f], [0x1680, 0x169f], [0x16a0, 0x16ff], [0x1780, 0x17ff], [0x1800, 0x18af], [0x2800, 0x28ff], [0xa000, 0xa48f], [0x1700, 0x171f, 0x1720, 0x173f, 0x1740, 0x175f, 0x1760, 0x177f], [0x10300, 0x1032f], [0x10330, 0x1034f], [0x10400, 0x1044f], [0x1d000, 0x1d0ff, 0x1d100, 0x1d1ff, 0x1d200, 0x1d24f], [0x1d400, 0x1d7ff], [0xff000, 0xffffd], [0xfe00, 0xfe0f, 0xe0100, 0xe01ef], [0xe0000, 0xe007f], [0x1900, 0x194f], [0x1950, 0x197f], [0x1980, 0x19df], [0x1a00, 0x1a1f], [0x2c00, 0x2c5f], [0x2d30, 0x2d7f], [0x4dc0, 0x4dff], [0xa800, 0xa82f], [0x10000, 0x1007f, 0x10080, 0x100ff, 0x10100, 0x1013f], [0x10140, 0x1018f], [0x10380, 0x1039f], [0x103a0, 0x103df], [0x10450, 0x1047f], [0x10480, 0x104af], [0x10800, 0x1083f], [0x10a00, 0x10a5f], [0x1d300, 0x1d35f], [0x12000, 0x123ff, 0x12400, 0x1247f], [0x1d360, 0x1d37f], [0x1b80, 0x1bbf], [0x1c00, 0x1c4f], [0x1c50, 0x1c7f], [0xa880, 0xa8df], [0xa900, 0xa92f], [0xa930, 0xa95f], [0xaa00, 0xaa5f], [0x10190, 0x101cf], [0x101d0, 0x101ff], [0x102a0, 0x102df, 0x10280, 0x1029f, 0x10920, 0x1093f], [0x1f030, 0x1f09f, 0x1f000, 0x1f02f]];
  16355. function getUnicodeRangeFor(value, lastPosition = -1) {
  16356. if (lastPosition !== -1) {
  16357. const range = UnicodeRanges[lastPosition];
  16358. for (let i = 0, ii = range.length; i < ii; i += 2) {
  16359. if (value >= range[i] && value <= range[i + 1]) {
  16360. return lastPosition;
  16361. }
  16362. }
  16363. }
  16364. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  16365. const range = UnicodeRanges[i];
  16366. for (let j = 0, jj = range.length; j < jj; j += 2) {
  16367. if (value >= range[j] && value <= range[j + 1]) {
  16368. return i;
  16369. }
  16370. }
  16371. }
  16372. return -1;
  16373. }
  16374. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  16375. const CategoryCache = new Map();
  16376. function getCharUnicodeCategory(char) {
  16377. const cachedCategory = CategoryCache.get(char);
  16378. if (cachedCategory) {
  16379. return cachedCategory;
  16380. }
  16381. const groups = char.match(SpecialCharRegExp);
  16382. const category = {
  16383. isWhitespace: !!groups?.[1],
  16384. isZeroWidthDiacritic: !!groups?.[2],
  16385. isInvisibleFormatMark: !!groups?.[3]
  16386. };
  16387. CategoryCache.set(char, category);
  16388. return category;
  16389. }
  16390. function clearUnicodeCaches() {
  16391. CategoryCache.clear();
  16392. }
  16393. ;// ./src/core/fonts_utils.js
  16394. const SEAC_ANALYSIS_ENABLED = true;
  16395. const FontFlags = {
  16396. FixedPitch: 1,
  16397. Serif: 2,
  16398. Symbolic: 4,
  16399. Script: 8,
  16400. Nonsymbolic: 32,
  16401. Italic: 64,
  16402. AllCap: 65536,
  16403. SmallCap: 131072,
  16404. ForceBold: 262144
  16405. };
  16406. const MacStandardGlyphOrdering = [".notdef", ".null", "nonmarkingreturn", "space", "exclam", "quotedbl", "numbersign", "dollar", "percent", "ampersand", "quotesingle", "parenleft", "parenright", "asterisk", "plus", "comma", "hyphen", "period", "slash", "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "colon", "semicolon", "less", "equal", "greater", "question", "at", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "bracketleft", "backslash", "bracketright", "asciicircum", "underscore", "grave", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "braceleft", "bar", "braceright", "asciitilde", "Adieresis", "Aring", "Ccedilla", "Eacute", "Ntilde", "Odieresis", "Udieresis", "aacute", "agrave", "acircumflex", "adieresis", "atilde", "aring", "ccedilla", "eacute", "egrave", "ecircumflex", "edieresis", "iacute", "igrave", "icircumflex", "idieresis", "ntilde", "oacute", "ograve", "ocircumflex", "odieresis", "otilde", "uacute", "ugrave", "ucircumflex", "udieresis", "dagger", "degree", "cent", "sterling", "section", "bullet", "paragraph", "germandbls", "registered", "copyright", "trademark", "acute", "dieresis", "notequal", "AE", "Oslash", "infinity", "plusminus", "lessequal", "greaterequal", "yen", "mu", "partialdiff", "summation", "product", "pi", "integral", "ordfeminine", "ordmasculine", "Omega", "ae", "oslash", "questiondown", "exclamdown", "logicalnot", "radical", "florin", "approxequal", "Delta", "guillemotleft", "guillemotright", "ellipsis", "nonbreakingspace", "Agrave", "Atilde", "Otilde", "OE", "oe", "endash", "emdash", "quotedblleft", "quotedblright", "quoteleft", "quoteright", "divide", "lozenge", "ydieresis", "Ydieresis", "fraction", "currency", "guilsinglleft", "guilsinglright", "fi", "fl", "daggerdbl", "periodcentered", "quotesinglbase", "quotedblbase", "perthousand", "Acircumflex", "Ecircumflex", "Aacute", "Edieresis", "Egrave", "Iacute", "Icircumflex", "Idieresis", "Igrave", "Oacute", "Ocircumflex", "apple", "Ograve", "Uacute", "Ucircumflex", "Ugrave", "dotlessi", "circumflex", "tilde", "macron", "breve", "dotaccent", "ring", "cedilla", "hungarumlaut", "ogonek", "caron", "Lslash", "lslash", "Scaron", "scaron", "Zcaron", "zcaron", "brokenbar", "Eth", "eth", "Yacute", "yacute", "Thorn", "thorn", "minus", "multiply", "onesuperior", "twosuperior", "threesuperior", "onehalf", "onequarter", "threequarters", "franc", "Gbreve", "gbreve", "Idotaccent", "Scedilla", "scedilla", "Cacute", "cacute", "Ccaron", "ccaron", "dcroat"];
  16407. function recoverGlyphName(name, glyphsUnicodeMap) {
  16408. if (glyphsUnicodeMap[name] !== undefined) {
  16409. return name;
  16410. }
  16411. const unicode = getUnicodeForGlyph(name, glyphsUnicodeMap);
  16412. if (unicode !== -1) {
  16413. for (const key in glyphsUnicodeMap) {
  16414. if (glyphsUnicodeMap[key] === unicode) {
  16415. return key;
  16416. }
  16417. }
  16418. }
  16419. info("Unable to recover a standard glyph name for: " + name);
  16420. return name;
  16421. }
  16422. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  16423. const charCodeToGlyphId = Object.create(null);
  16424. let glyphId, charCode, baseEncoding;
  16425. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  16426. if (properties.isInternalFont) {
  16427. baseEncoding = builtInEncoding;
  16428. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  16429. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  16430. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16431. }
  16432. } else if (properties.baseEncodingName) {
  16433. baseEncoding = getEncoding(properties.baseEncodingName);
  16434. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  16435. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  16436. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16437. }
  16438. } else if (isSymbolicFont) {
  16439. for (charCode in builtInEncoding) {
  16440. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  16441. }
  16442. } else {
  16443. baseEncoding = StandardEncoding;
  16444. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  16445. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  16446. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16447. }
  16448. }
  16449. const differences = properties.differences;
  16450. let glyphsUnicodeMap;
  16451. if (differences) {
  16452. for (charCode in differences) {
  16453. const glyphName = differences[charCode];
  16454. glyphId = glyphNames.indexOf(glyphName);
  16455. if (glyphId === -1) {
  16456. if (!glyphsUnicodeMap) {
  16457. glyphsUnicodeMap = getGlyphsUnicode();
  16458. }
  16459. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  16460. if (standardGlyphName !== glyphName) {
  16461. glyphId = glyphNames.indexOf(standardGlyphName);
  16462. }
  16463. }
  16464. charCodeToGlyphId[charCode] = glyphId >= 0 ? glyphId : 0;
  16465. }
  16466. }
  16467. return charCodeToGlyphId;
  16468. }
  16469. function normalizeFontName(name) {
  16470. return name.replaceAll(/[,_]/g, "-").replaceAll(/\s/g, "");
  16471. }
  16472. const getVerticalPresentationForm = getLookupTableFactory(t => {
  16473. t[0x2013] = 0xfe32;
  16474. t[0x2014] = 0xfe31;
  16475. t[0x2025] = 0xfe30;
  16476. t[0x2026] = 0xfe19;
  16477. t[0x3001] = 0xfe11;
  16478. t[0x3002] = 0xfe12;
  16479. t[0x3008] = 0xfe3f;
  16480. t[0x3009] = 0xfe40;
  16481. t[0x300a] = 0xfe3d;
  16482. t[0x300b] = 0xfe3e;
  16483. t[0x300c] = 0xfe41;
  16484. t[0x300d] = 0xfe42;
  16485. t[0x300e] = 0xfe43;
  16486. t[0x300f] = 0xfe44;
  16487. t[0x3010] = 0xfe3b;
  16488. t[0x3011] = 0xfe3c;
  16489. t[0x3014] = 0xfe39;
  16490. t[0x3015] = 0xfe3a;
  16491. t[0x3016] = 0xfe17;
  16492. t[0x3017] = 0xfe18;
  16493. t[0xfe4f] = 0xfe34;
  16494. t[0xff01] = 0xfe15;
  16495. t[0xff08] = 0xfe35;
  16496. t[0xff09] = 0xfe36;
  16497. t[0xff0c] = 0xfe10;
  16498. t[0xff1a] = 0xfe13;
  16499. t[0xff1b] = 0xfe14;
  16500. t[0xff1f] = 0xfe16;
  16501. t[0xff3b] = 0xfe47;
  16502. t[0xff3d] = 0xfe48;
  16503. t[0xff3f] = 0xfe33;
  16504. t[0xff5b] = 0xfe37;
  16505. t[0xff5d] = 0xfe38;
  16506. });
  16507. ;// ./src/core/standard_fonts.js
  16508. const getStdFontMap = getLookupTableFactory(function (t) {
  16509. t["Times-Roman"] = "Times-Roman";
  16510. t.Helvetica = "Helvetica";
  16511. t.Courier = "Courier";
  16512. t.Symbol = "Symbol";
  16513. t["Times-Bold"] = "Times-Bold";
  16514. t["Helvetica-Bold"] = "Helvetica-Bold";
  16515. t["Courier-Bold"] = "Courier-Bold";
  16516. t.ZapfDingbats = "ZapfDingbats";
  16517. t["Times-Italic"] = "Times-Italic";
  16518. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  16519. t["Courier-Oblique"] = "Courier-Oblique";
  16520. t["Times-BoldItalic"] = "Times-BoldItalic";
  16521. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  16522. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  16523. t.ArialNarrow = "Helvetica";
  16524. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  16525. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  16526. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  16527. t.ArialBlack = "Helvetica";
  16528. t["ArialBlack-Bold"] = "Helvetica-Bold";
  16529. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  16530. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  16531. t["Arial-Black"] = "Helvetica";
  16532. t["Arial-Black-Bold"] = "Helvetica-Bold";
  16533. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  16534. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  16535. t.Arial = "Helvetica";
  16536. t["Arial-Bold"] = "Helvetica-Bold";
  16537. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  16538. t["Arial-Italic"] = "Helvetica-Oblique";
  16539. t.ArialMT = "Helvetica";
  16540. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  16541. t["Arial-BoldMT"] = "Helvetica-Bold";
  16542. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  16543. t["Arial-BoldItalicMT-BoldItalic"] = "Helvetica-BoldOblique";
  16544. t["Arial-BoldMT-Bold"] = "Helvetica-Bold";
  16545. t["Arial-ItalicMT-Italic"] = "Helvetica-Oblique";
  16546. t.ArialUnicodeMS = "Helvetica";
  16547. t["ArialUnicodeMS-Bold"] = "Helvetica-Bold";
  16548. t["ArialUnicodeMS-BoldItalic"] = "Helvetica-BoldOblique";
  16549. t["ArialUnicodeMS-Italic"] = "Helvetica-Oblique";
  16550. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  16551. t["Courier-Italic"] = "Courier-Oblique";
  16552. t.CourierNew = "Courier";
  16553. t["CourierNew-Bold"] = "Courier-Bold";
  16554. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  16555. t["CourierNew-Italic"] = "Courier-Oblique";
  16556. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  16557. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  16558. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  16559. t.CourierNewPSMT = "Courier";
  16560. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  16561. t["Helvetica-Italic"] = "Helvetica-Oblique";
  16562. t["HelveticaLTStd-Bold"] = "Helvetica-Bold";
  16563. t["Symbol-Bold"] = "Symbol";
  16564. t["Symbol-BoldItalic"] = "Symbol";
  16565. t["Symbol-Italic"] = "Symbol";
  16566. t.TimesNewRoman = "Times-Roman";
  16567. t["TimesNewRoman-Bold"] = "Times-Bold";
  16568. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  16569. t["TimesNewRoman-Italic"] = "Times-Italic";
  16570. t.TimesNewRomanPS = "Times-Roman";
  16571. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  16572. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  16573. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  16574. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  16575. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  16576. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  16577. t.TimesNewRomanPSMT = "Times-Roman";
  16578. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  16579. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  16580. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  16581. });
  16582. const getFontNameToFileMap = getLookupTableFactory(function (t) {
  16583. t.Courier = "FoxitFixed.pfb";
  16584. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  16585. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  16586. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  16587. t.Helvetica = "LiberationSans-Regular.ttf";
  16588. t["Helvetica-Bold"] = "LiberationSans-Bold.ttf";
  16589. t["Helvetica-BoldOblique"] = "LiberationSans-BoldItalic.ttf";
  16590. t["Helvetica-Oblique"] = "LiberationSans-Italic.ttf";
  16591. t["Times-Roman"] = "FoxitSerif.pfb";
  16592. t["Times-Bold"] = "FoxitSerifBold.pfb";
  16593. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  16594. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  16595. t.Symbol = "FoxitSymbol.pfb";
  16596. t.ZapfDingbats = "FoxitDingbats.pfb";
  16597. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  16598. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  16599. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  16600. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  16601. });
  16602. const getNonStdFontMap = getLookupTableFactory(function (t) {
  16603. t.Calibri = "Helvetica";
  16604. t["Calibri-Bold"] = "Helvetica-Bold";
  16605. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  16606. t["Calibri-Italic"] = "Helvetica-Oblique";
  16607. t.CenturyGothic = "Helvetica";
  16608. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  16609. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  16610. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  16611. t.ComicSansMS = "Comic Sans MS";
  16612. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  16613. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  16614. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  16615. t.GillSansMT = "Helvetica";
  16616. t["GillSansMT-Bold"] = "Helvetica-Bold";
  16617. t["GillSansMT-BoldItalic"] = "Helvetica-BoldOblique";
  16618. t["GillSansMT-Italic"] = "Helvetica-Oblique";
  16619. t.Impact = "Helvetica";
  16620. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  16621. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  16622. t["ItcSymbol-Book"] = "Helvetica";
  16623. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  16624. t["ItcSymbol-Medium"] = "Helvetica";
  16625. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  16626. t.LucidaConsole = "Courier";
  16627. t["LucidaConsole-Bold"] = "Courier-Bold";
  16628. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  16629. t["LucidaConsole-Italic"] = "Courier-Oblique";
  16630. t["LucidaSans-Demi"] = "Helvetica-Bold";
  16631. t["MS-Gothic"] = "MS Gothic";
  16632. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  16633. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  16634. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  16635. t["MS-Mincho"] = "MS Mincho";
  16636. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  16637. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  16638. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  16639. t["MS-PGothic"] = "MS PGothic";
  16640. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  16641. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  16642. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  16643. t["MS-PMincho"] = "MS PMincho";
  16644. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  16645. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  16646. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  16647. t.NuptialScript = "Times-Italic";
  16648. t.SegoeUISymbol = "Helvetica";
  16649. });
  16650. const getSerifFonts = getLookupTableFactory(function (t) {
  16651. t["Adobe Jenson"] = true;
  16652. t["Adobe Text"] = true;
  16653. t.Albertus = true;
  16654. t.Aldus = true;
  16655. t.Alexandria = true;
  16656. t.Algerian = true;
  16657. t["American Typewriter"] = true;
  16658. t.Antiqua = true;
  16659. t.Apex = true;
  16660. t.Arno = true;
  16661. t.Aster = true;
  16662. t.Aurora = true;
  16663. t.Baskerville = true;
  16664. t.Bell = true;
  16665. t.Bembo = true;
  16666. t["Bembo Schoolbook"] = true;
  16667. t.Benguiat = true;
  16668. t["Berkeley Old Style"] = true;
  16669. t["Bernhard Modern"] = true;
  16670. t["Berthold City"] = true;
  16671. t.Bodoni = true;
  16672. t["Bauer Bodoni"] = true;
  16673. t["Book Antiqua"] = true;
  16674. t.Bookman = true;
  16675. t["Bordeaux Roman"] = true;
  16676. t["Californian FB"] = true;
  16677. t.Calisto = true;
  16678. t.Calvert = true;
  16679. t.Capitals = true;
  16680. t.Cambria = true;
  16681. t.Cartier = true;
  16682. t.Caslon = true;
  16683. t.Catull = true;
  16684. t.Centaur = true;
  16685. t["Century Old Style"] = true;
  16686. t["Century Schoolbook"] = true;
  16687. t.Chaparral = true;
  16688. t["Charis SIL"] = true;
  16689. t.Cheltenham = true;
  16690. t["Cholla Slab"] = true;
  16691. t.Clarendon = true;
  16692. t.Clearface = true;
  16693. t.Cochin = true;
  16694. t.Colonna = true;
  16695. t["Computer Modern"] = true;
  16696. t["Concrete Roman"] = true;
  16697. t.Constantia = true;
  16698. t["Cooper Black"] = true;
  16699. t.Corona = true;
  16700. t.Ecotype = true;
  16701. t.Egyptienne = true;
  16702. t.Elephant = true;
  16703. t.Excelsior = true;
  16704. t.Fairfield = true;
  16705. t["FF Scala"] = true;
  16706. t.Folkard = true;
  16707. t.Footlight = true;
  16708. t.FreeSerif = true;
  16709. t["Friz Quadrata"] = true;
  16710. t.Garamond = true;
  16711. t.Gentium = true;
  16712. t.Georgia = true;
  16713. t.Gloucester = true;
  16714. t["Goudy Old Style"] = true;
  16715. t["Goudy Schoolbook"] = true;
  16716. t["Goudy Pro Font"] = true;
  16717. t.Granjon = true;
  16718. t["Guardian Egyptian"] = true;
  16719. t.Heather = true;
  16720. t.Hercules = true;
  16721. t["High Tower Text"] = true;
  16722. t.Hiroshige = true;
  16723. t["Hoefler Text"] = true;
  16724. t["Humana Serif"] = true;
  16725. t.Imprint = true;
  16726. t["Ionic No. 5"] = true;
  16727. t.Janson = true;
  16728. t.Joanna = true;
  16729. t.Korinna = true;
  16730. t.Lexicon = true;
  16731. t.LiberationSerif = true;
  16732. t["Liberation Serif"] = true;
  16733. t["Linux Libertine"] = true;
  16734. t.Literaturnaya = true;
  16735. t.Lucida = true;
  16736. t["Lucida Bright"] = true;
  16737. t.Melior = true;
  16738. t.Memphis = true;
  16739. t.Miller = true;
  16740. t.Minion = true;
  16741. t.Modern = true;
  16742. t["Mona Lisa"] = true;
  16743. t["Mrs Eaves"] = true;
  16744. t["MS Serif"] = true;
  16745. t["Museo Slab"] = true;
  16746. t["New York"] = true;
  16747. t["Nimbus Roman"] = true;
  16748. t["NPS Rawlinson Roadway"] = true;
  16749. t.NuptialScript = true;
  16750. t.Palatino = true;
  16751. t.Perpetua = true;
  16752. t.Plantin = true;
  16753. t["Plantin Schoolbook"] = true;
  16754. t.Playbill = true;
  16755. t["Poor Richard"] = true;
  16756. t["Rawlinson Roadway"] = true;
  16757. t.Renault = true;
  16758. t.Requiem = true;
  16759. t.Rockwell = true;
  16760. t.Roman = true;
  16761. t["Rotis Serif"] = true;
  16762. t.Sabon = true;
  16763. t.Scala = true;
  16764. t.Seagull = true;
  16765. t.Sistina = true;
  16766. t.Souvenir = true;
  16767. t.STIX = true;
  16768. t["Stone Informal"] = true;
  16769. t["Stone Serif"] = true;
  16770. t.Sylfaen = true;
  16771. t.Times = true;
  16772. t.Trajan = true;
  16773. t["Trinité"] = true;
  16774. t["Trump Mediaeval"] = true;
  16775. t.Utopia = true;
  16776. t["Vale Type"] = true;
  16777. t["Bitstream Vera"] = true;
  16778. t["Vera Serif"] = true;
  16779. t.Versailles = true;
  16780. t.Wanted = true;
  16781. t.Weiss = true;
  16782. t["Wide Latin"] = true;
  16783. t.Windsor = true;
  16784. t.XITS = true;
  16785. });
  16786. const getSymbolsFonts = getLookupTableFactory(function (t) {
  16787. t.Dingbats = true;
  16788. t.Symbol = true;
  16789. t.ZapfDingbats = true;
  16790. t.Wingdings = true;
  16791. t["Wingdings-Bold"] = true;
  16792. t["Wingdings-Regular"] = true;
  16793. });
  16794. const getGlyphMapForStandardFonts = getLookupTableFactory(function (t) {
  16795. t[2] = 10;
  16796. t[3] = 32;
  16797. t[4] = 33;
  16798. t[5] = 34;
  16799. t[6] = 35;
  16800. t[7] = 36;
  16801. t[8] = 37;
  16802. t[9] = 38;
  16803. t[10] = 39;
  16804. t[11] = 40;
  16805. t[12] = 41;
  16806. t[13] = 42;
  16807. t[14] = 43;
  16808. t[15] = 44;
  16809. t[16] = 45;
  16810. t[17] = 46;
  16811. t[18] = 47;
  16812. t[19] = 48;
  16813. t[20] = 49;
  16814. t[21] = 50;
  16815. t[22] = 51;
  16816. t[23] = 52;
  16817. t[24] = 53;
  16818. t[25] = 54;
  16819. t[26] = 55;
  16820. t[27] = 56;
  16821. t[28] = 57;
  16822. t[29] = 58;
  16823. t[30] = 894;
  16824. t[31] = 60;
  16825. t[32] = 61;
  16826. t[33] = 62;
  16827. t[34] = 63;
  16828. t[35] = 64;
  16829. t[36] = 65;
  16830. t[37] = 66;
  16831. t[38] = 67;
  16832. t[39] = 68;
  16833. t[40] = 69;
  16834. t[41] = 70;
  16835. t[42] = 71;
  16836. t[43] = 72;
  16837. t[44] = 73;
  16838. t[45] = 74;
  16839. t[46] = 75;
  16840. t[47] = 76;
  16841. t[48] = 77;
  16842. t[49] = 78;
  16843. t[50] = 79;
  16844. t[51] = 80;
  16845. t[52] = 81;
  16846. t[53] = 82;
  16847. t[54] = 83;
  16848. t[55] = 84;
  16849. t[56] = 85;
  16850. t[57] = 86;
  16851. t[58] = 87;
  16852. t[59] = 88;
  16853. t[60] = 89;
  16854. t[61] = 90;
  16855. t[62] = 91;
  16856. t[63] = 92;
  16857. t[64] = 93;
  16858. t[65] = 94;
  16859. t[66] = 95;
  16860. t[67] = 96;
  16861. t[68] = 97;
  16862. t[69] = 98;
  16863. t[70] = 99;
  16864. t[71] = 100;
  16865. t[72] = 101;
  16866. t[73] = 102;
  16867. t[74] = 103;
  16868. t[75] = 104;
  16869. t[76] = 105;
  16870. t[77] = 106;
  16871. t[78] = 107;
  16872. t[79] = 108;
  16873. t[80] = 109;
  16874. t[81] = 110;
  16875. t[82] = 111;
  16876. t[83] = 112;
  16877. t[84] = 113;
  16878. t[85] = 114;
  16879. t[86] = 115;
  16880. t[87] = 116;
  16881. t[88] = 117;
  16882. t[89] = 118;
  16883. t[90] = 119;
  16884. t[91] = 120;
  16885. t[92] = 121;
  16886. t[93] = 122;
  16887. t[94] = 123;
  16888. t[95] = 124;
  16889. t[96] = 125;
  16890. t[97] = 126;
  16891. t[98] = 196;
  16892. t[99] = 197;
  16893. t[100] = 199;
  16894. t[101] = 201;
  16895. t[102] = 209;
  16896. t[103] = 214;
  16897. t[104] = 220;
  16898. t[105] = 225;
  16899. t[106] = 224;
  16900. t[107] = 226;
  16901. t[108] = 228;
  16902. t[109] = 227;
  16903. t[110] = 229;
  16904. t[111] = 231;
  16905. t[112] = 233;
  16906. t[113] = 232;
  16907. t[114] = 234;
  16908. t[115] = 235;
  16909. t[116] = 237;
  16910. t[117] = 236;
  16911. t[118] = 238;
  16912. t[119] = 239;
  16913. t[120] = 241;
  16914. t[121] = 243;
  16915. t[122] = 242;
  16916. t[123] = 244;
  16917. t[124] = 246;
  16918. t[125] = 245;
  16919. t[126] = 250;
  16920. t[127] = 249;
  16921. t[128] = 251;
  16922. t[129] = 252;
  16923. t[130] = 8224;
  16924. t[131] = 176;
  16925. t[132] = 162;
  16926. t[133] = 163;
  16927. t[134] = 167;
  16928. t[135] = 8226;
  16929. t[136] = 182;
  16930. t[137] = 223;
  16931. t[138] = 174;
  16932. t[139] = 169;
  16933. t[140] = 8482;
  16934. t[141] = 180;
  16935. t[142] = 168;
  16936. t[143] = 8800;
  16937. t[144] = 198;
  16938. t[145] = 216;
  16939. t[146] = 8734;
  16940. t[147] = 177;
  16941. t[148] = 8804;
  16942. t[149] = 8805;
  16943. t[150] = 165;
  16944. t[151] = 181;
  16945. t[152] = 8706;
  16946. t[153] = 8721;
  16947. t[154] = 8719;
  16948. t[156] = 8747;
  16949. t[157] = 170;
  16950. t[158] = 186;
  16951. t[159] = 8486;
  16952. t[160] = 230;
  16953. t[161] = 248;
  16954. t[162] = 191;
  16955. t[163] = 161;
  16956. t[164] = 172;
  16957. t[165] = 8730;
  16958. t[166] = 402;
  16959. t[167] = 8776;
  16960. t[168] = 8710;
  16961. t[169] = 171;
  16962. t[170] = 187;
  16963. t[171] = 8230;
  16964. t[179] = 8220;
  16965. t[180] = 8221;
  16966. t[181] = 8216;
  16967. t[182] = 8217;
  16968. t[200] = 193;
  16969. t[203] = 205;
  16970. t[207] = 211;
  16971. t[210] = 218;
  16972. t[223] = 711;
  16973. t[224] = 321;
  16974. t[225] = 322;
  16975. t[226] = 352;
  16976. t[227] = 353;
  16977. t[228] = 381;
  16978. t[229] = 382;
  16979. t[233] = 221;
  16980. t[234] = 253;
  16981. t[252] = 263;
  16982. t[253] = 268;
  16983. t[254] = 269;
  16984. t[258] = 258;
  16985. t[260] = 260;
  16986. t[261] = 261;
  16987. t[265] = 280;
  16988. t[266] = 281;
  16989. t[267] = 282;
  16990. t[268] = 283;
  16991. t[269] = 313;
  16992. t[275] = 323;
  16993. t[276] = 324;
  16994. t[278] = 328;
  16995. t[283] = 344;
  16996. t[284] = 345;
  16997. t[285] = 346;
  16998. t[286] = 347;
  16999. t[292] = 367;
  17000. t[295] = 377;
  17001. t[296] = 378;
  17002. t[298] = 380;
  17003. t[305] = 963;
  17004. t[306] = 964;
  17005. t[307] = 966;
  17006. t[308] = 8215;
  17007. t[309] = 8252;
  17008. t[310] = 8319;
  17009. t[311] = 8359;
  17010. t[312] = 8592;
  17011. t[313] = 8593;
  17012. t[337] = 9552;
  17013. t[493] = 1039;
  17014. t[494] = 1040;
  17015. t[672] = 1488;
  17016. t[673] = 1489;
  17017. t[674] = 1490;
  17018. t[675] = 1491;
  17019. t[676] = 1492;
  17020. t[677] = 1493;
  17021. t[678] = 1494;
  17022. t[679] = 1495;
  17023. t[680] = 1496;
  17024. t[681] = 1497;
  17025. t[682] = 1498;
  17026. t[683] = 1499;
  17027. t[684] = 1500;
  17028. t[685] = 1501;
  17029. t[686] = 1502;
  17030. t[687] = 1503;
  17031. t[688] = 1504;
  17032. t[689] = 1505;
  17033. t[690] = 1506;
  17034. t[691] = 1507;
  17035. t[692] = 1508;
  17036. t[693] = 1509;
  17037. t[694] = 1510;
  17038. t[695] = 1511;
  17039. t[696] = 1512;
  17040. t[697] = 1513;
  17041. t[698] = 1514;
  17042. t[705] = 1524;
  17043. t[706] = 8362;
  17044. t[710] = 64288;
  17045. t[711] = 64298;
  17046. t[759] = 1617;
  17047. t[761] = 1776;
  17048. t[763] = 1778;
  17049. t[775] = 1652;
  17050. t[777] = 1764;
  17051. t[778] = 1780;
  17052. t[779] = 1781;
  17053. t[780] = 1782;
  17054. t[782] = 771;
  17055. t[783] = 64726;
  17056. t[786] = 8363;
  17057. t[788] = 8532;
  17058. t[790] = 768;
  17059. t[791] = 769;
  17060. t[792] = 768;
  17061. t[795] = 803;
  17062. t[797] = 64336;
  17063. t[798] = 64337;
  17064. t[799] = 64342;
  17065. t[800] = 64343;
  17066. t[801] = 64344;
  17067. t[802] = 64345;
  17068. t[803] = 64362;
  17069. t[804] = 64363;
  17070. t[805] = 64364;
  17071. t[2424] = 7821;
  17072. t[2425] = 7822;
  17073. t[2426] = 7823;
  17074. t[2427] = 7824;
  17075. t[2428] = 7825;
  17076. t[2429] = 7826;
  17077. t[2430] = 7827;
  17078. t[2433] = 7682;
  17079. t[2678] = 8045;
  17080. t[2679] = 8046;
  17081. t[2830] = 1552;
  17082. t[2838] = 686;
  17083. t[2840] = 751;
  17084. t[2842] = 753;
  17085. t[2843] = 754;
  17086. t[2844] = 755;
  17087. t[2846] = 757;
  17088. t[2856] = 767;
  17089. t[2857] = 848;
  17090. t[2858] = 849;
  17091. t[2862] = 853;
  17092. t[2863] = 854;
  17093. t[2864] = 855;
  17094. t[2865] = 861;
  17095. t[2866] = 862;
  17096. t[2906] = 7460;
  17097. t[2908] = 7462;
  17098. t[2909] = 7463;
  17099. t[2910] = 7464;
  17100. t[2912] = 7466;
  17101. t[2913] = 7467;
  17102. t[2914] = 7468;
  17103. t[2916] = 7470;
  17104. t[2917] = 7471;
  17105. t[2918] = 7472;
  17106. t[2920] = 7474;
  17107. t[2921] = 7475;
  17108. t[2922] = 7476;
  17109. t[2924] = 7478;
  17110. t[2925] = 7479;
  17111. t[2926] = 7480;
  17112. t[2928] = 7482;
  17113. t[2929] = 7483;
  17114. t[2930] = 7484;
  17115. t[2932] = 7486;
  17116. t[2933] = 7487;
  17117. t[2934] = 7488;
  17118. t[2936] = 7490;
  17119. t[2937] = 7491;
  17120. t[2938] = 7492;
  17121. t[2940] = 7494;
  17122. t[2941] = 7495;
  17123. t[2942] = 7496;
  17124. t[2944] = 7498;
  17125. t[2946] = 7500;
  17126. t[2948] = 7502;
  17127. t[2950] = 7504;
  17128. t[2951] = 7505;
  17129. t[2952] = 7506;
  17130. t[2954] = 7508;
  17131. t[2955] = 7509;
  17132. t[2956] = 7510;
  17133. t[2958] = 7512;
  17134. t[2959] = 7513;
  17135. t[2960] = 7514;
  17136. t[2962] = 7516;
  17137. t[2963] = 7517;
  17138. t[2964] = 7518;
  17139. t[2966] = 7520;
  17140. t[2967] = 7521;
  17141. t[2968] = 7522;
  17142. t[2970] = 7524;
  17143. t[2971] = 7525;
  17144. t[2972] = 7526;
  17145. t[2974] = 7528;
  17146. t[2975] = 7529;
  17147. t[2976] = 7530;
  17148. t[2978] = 1537;
  17149. t[2979] = 1538;
  17150. t[2980] = 1539;
  17151. t[2982] = 1549;
  17152. t[2983] = 1551;
  17153. t[2984] = 1552;
  17154. t[2986] = 1554;
  17155. t[2987] = 1555;
  17156. t[2988] = 1556;
  17157. t[2990] = 1623;
  17158. t[2991] = 1624;
  17159. t[2995] = 1775;
  17160. t[2999] = 1791;
  17161. t[3002] = 64290;
  17162. t[3003] = 64291;
  17163. t[3004] = 64292;
  17164. t[3006] = 64294;
  17165. t[3007] = 64295;
  17166. t[3008] = 64296;
  17167. t[3011] = 1900;
  17168. t[3014] = 8223;
  17169. t[3015] = 8244;
  17170. t[3017] = 7532;
  17171. t[3018] = 7533;
  17172. t[3019] = 7534;
  17173. t[3075] = 7590;
  17174. t[3076] = 7591;
  17175. t[3079] = 7594;
  17176. t[3080] = 7595;
  17177. t[3083] = 7598;
  17178. t[3084] = 7599;
  17179. t[3087] = 7602;
  17180. t[3088] = 7603;
  17181. t[3091] = 7606;
  17182. t[3092] = 7607;
  17183. t[3095] = 7610;
  17184. t[3096] = 7611;
  17185. t[3099] = 7614;
  17186. t[3100] = 7615;
  17187. t[3103] = 7618;
  17188. t[3104] = 7619;
  17189. t[3107] = 8337;
  17190. t[3108] = 8338;
  17191. t[3116] = 1884;
  17192. t[3119] = 1885;
  17193. t[3120] = 1885;
  17194. t[3123] = 1886;
  17195. t[3124] = 1886;
  17196. t[3127] = 1887;
  17197. t[3128] = 1887;
  17198. t[3131] = 1888;
  17199. t[3132] = 1888;
  17200. t[3135] = 1889;
  17201. t[3136] = 1889;
  17202. t[3139] = 1890;
  17203. t[3140] = 1890;
  17204. t[3143] = 1891;
  17205. t[3144] = 1891;
  17206. t[3147] = 1892;
  17207. t[3148] = 1892;
  17208. t[3153] = 580;
  17209. t[3154] = 581;
  17210. t[3157] = 584;
  17211. t[3158] = 585;
  17212. t[3161] = 588;
  17213. t[3162] = 589;
  17214. t[3165] = 891;
  17215. t[3166] = 892;
  17216. t[3169] = 1274;
  17217. t[3170] = 1275;
  17218. t[3173] = 1278;
  17219. t[3174] = 1279;
  17220. t[3181] = 7622;
  17221. t[3182] = 7623;
  17222. t[3282] = 11799;
  17223. t[3316] = 578;
  17224. t[3379] = 42785;
  17225. t[3393] = 1159;
  17226. t[3416] = 8377;
  17227. });
  17228. const getSupplementalGlyphMapForArialBlack = getLookupTableFactory(function (t) {
  17229. t[227] = 322;
  17230. t[264] = 261;
  17231. t[291] = 346;
  17232. });
  17233. const getSupplementalGlyphMapForCalibri = getLookupTableFactory(function (t) {
  17234. t[1] = 32;
  17235. t[4] = 65;
  17236. t[5] = 192;
  17237. t[6] = 193;
  17238. t[9] = 196;
  17239. t[17] = 66;
  17240. t[18] = 67;
  17241. t[21] = 268;
  17242. t[24] = 68;
  17243. t[28] = 69;
  17244. t[29] = 200;
  17245. t[30] = 201;
  17246. t[32] = 282;
  17247. t[38] = 70;
  17248. t[39] = 71;
  17249. t[44] = 72;
  17250. t[47] = 73;
  17251. t[48] = 204;
  17252. t[49] = 205;
  17253. t[58] = 74;
  17254. t[60] = 75;
  17255. t[62] = 76;
  17256. t[68] = 77;
  17257. t[69] = 78;
  17258. t[75] = 79;
  17259. t[76] = 210;
  17260. t[80] = 214;
  17261. t[87] = 80;
  17262. t[89] = 81;
  17263. t[90] = 82;
  17264. t[92] = 344;
  17265. t[94] = 83;
  17266. t[97] = 352;
  17267. t[100] = 84;
  17268. t[104] = 85;
  17269. t[109] = 220;
  17270. t[115] = 86;
  17271. t[116] = 87;
  17272. t[121] = 88;
  17273. t[122] = 89;
  17274. t[124] = 221;
  17275. t[127] = 90;
  17276. t[129] = 381;
  17277. t[258] = 97;
  17278. t[259] = 224;
  17279. t[260] = 225;
  17280. t[263] = 228;
  17281. t[268] = 261;
  17282. t[271] = 98;
  17283. t[272] = 99;
  17284. t[273] = 263;
  17285. t[275] = 269;
  17286. t[282] = 100;
  17287. t[286] = 101;
  17288. t[287] = 232;
  17289. t[288] = 233;
  17290. t[290] = 283;
  17291. t[295] = 281;
  17292. t[296] = 102;
  17293. t[336] = 103;
  17294. t[346] = 104;
  17295. t[349] = 105;
  17296. t[350] = 236;
  17297. t[351] = 237;
  17298. t[361] = 106;
  17299. t[364] = 107;
  17300. t[367] = 108;
  17301. t[371] = 322;
  17302. t[373] = 109;
  17303. t[374] = 110;
  17304. t[381] = 111;
  17305. t[382] = 242;
  17306. t[383] = 243;
  17307. t[386] = 246;
  17308. t[393] = 112;
  17309. t[395] = 113;
  17310. t[396] = 114;
  17311. t[398] = 345;
  17312. t[400] = 115;
  17313. t[401] = 347;
  17314. t[403] = 353;
  17315. t[410] = 116;
  17316. t[437] = 117;
  17317. t[442] = 252;
  17318. t[448] = 118;
  17319. t[449] = 119;
  17320. t[454] = 120;
  17321. t[455] = 121;
  17322. t[457] = 253;
  17323. t[460] = 122;
  17324. t[462] = 382;
  17325. t[463] = 380;
  17326. t[853] = 44;
  17327. t[855] = 58;
  17328. t[856] = 46;
  17329. t[876] = 47;
  17330. t[878] = 45;
  17331. t[882] = 45;
  17332. t[894] = 40;
  17333. t[895] = 41;
  17334. t[896] = 91;
  17335. t[897] = 93;
  17336. t[923] = 64;
  17337. t[1004] = 48;
  17338. t[1005] = 49;
  17339. t[1006] = 50;
  17340. t[1007] = 51;
  17341. t[1008] = 52;
  17342. t[1009] = 53;
  17343. t[1010] = 54;
  17344. t[1011] = 55;
  17345. t[1012] = 56;
  17346. t[1013] = 57;
  17347. t[1081] = 37;
  17348. t[1085] = 43;
  17349. t[1086] = 45;
  17350. });
  17351. function getStandardFontName(name) {
  17352. const fontName = normalizeFontName(name);
  17353. const stdFontMap = getStdFontMap();
  17354. return stdFontMap[fontName];
  17355. }
  17356. function isKnownFontName(name) {
  17357. const fontName = normalizeFontName(name);
  17358. return !!(getStdFontMap()[fontName] || getNonStdFontMap()[fontName] || getSerifFonts()[fontName] || getSymbolsFonts()[fontName]);
  17359. }
  17360. ;// ./src/core/to_unicode_map.js
  17361. class ToUnicodeMap {
  17362. constructor(cmap = []) {
  17363. this._map = cmap;
  17364. }
  17365. get length() {
  17366. return this._map.length;
  17367. }
  17368. forEach(callback) {
  17369. for (const charCode in this._map) {
  17370. callback(charCode, this._map[charCode].codePointAt(0));
  17371. }
  17372. }
  17373. has(i) {
  17374. return this._map[i] !== undefined;
  17375. }
  17376. get(i) {
  17377. return this._map[i];
  17378. }
  17379. charCodeOf(value) {
  17380. const map = this._map;
  17381. if (map.length <= 0x10000) {
  17382. return map.indexOf(value);
  17383. }
  17384. for (const charCode in map) {
  17385. if (map[charCode] === value) {
  17386. return charCode | 0;
  17387. }
  17388. }
  17389. return -1;
  17390. }
  17391. amend(map) {
  17392. for (const charCode in map) {
  17393. this._map[charCode] = map[charCode];
  17394. }
  17395. }
  17396. }
  17397. class IdentityToUnicodeMap {
  17398. constructor(firstChar, lastChar) {
  17399. this.firstChar = firstChar;
  17400. this.lastChar = lastChar;
  17401. }
  17402. get length() {
  17403. return this.lastChar + 1 - this.firstChar;
  17404. }
  17405. forEach(callback) {
  17406. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  17407. callback(i, i);
  17408. }
  17409. }
  17410. has(i) {
  17411. return this.firstChar <= i && i <= this.lastChar;
  17412. }
  17413. get(i) {
  17414. if (this.firstChar <= i && i <= this.lastChar) {
  17415. return String.fromCharCode(i);
  17416. }
  17417. return undefined;
  17418. }
  17419. charCodeOf(v) {
  17420. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  17421. }
  17422. amend(map) {
  17423. unreachable("Should not call amend()");
  17424. }
  17425. }
  17426. ;// ./src/core/cff_font.js
  17427. class CFFFont {
  17428. constructor(file, properties) {
  17429. this.properties = properties;
  17430. const parser = new CFFParser(file, properties, SEAC_ANALYSIS_ENABLED);
  17431. this.cff = parser.parse();
  17432. this.cff.duplicateFirstGlyph();
  17433. const compiler = new CFFCompiler(this.cff);
  17434. this.seacs = this.cff.seacs;
  17435. try {
  17436. this.data = compiler.compile();
  17437. } catch {
  17438. warn("Failed to compile font " + properties.loadedName);
  17439. this.data = file;
  17440. }
  17441. this._createBuiltInEncoding();
  17442. }
  17443. get numGlyphs() {
  17444. return this.cff.charStrings.count;
  17445. }
  17446. getCharset() {
  17447. return this.cff.charset.charset;
  17448. }
  17449. getGlyphMapping() {
  17450. const cff = this.cff;
  17451. const properties = this.properties;
  17452. const {
  17453. cidToGidMap,
  17454. cMap
  17455. } = properties;
  17456. const charsets = cff.charset.charset;
  17457. let charCodeToGlyphId;
  17458. let glyphId;
  17459. if (properties.composite) {
  17460. let invCidToGidMap;
  17461. if (cidToGidMap?.length > 0) {
  17462. invCidToGidMap = Object.create(null);
  17463. for (let i = 0, ii = cidToGidMap.length; i < ii; i++) {
  17464. const gid = cidToGidMap[i];
  17465. if (gid !== undefined) {
  17466. invCidToGidMap[gid] = i;
  17467. }
  17468. }
  17469. }
  17470. charCodeToGlyphId = Object.create(null);
  17471. let charCode;
  17472. if (cff.isCIDFont) {
  17473. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  17474. const cid = charsets[glyphId];
  17475. charCode = cMap.charCodeOf(cid);
  17476. if (invCidToGidMap?.[charCode] !== undefined) {
  17477. charCode = invCidToGidMap[charCode];
  17478. }
  17479. charCodeToGlyphId[charCode] = glyphId;
  17480. }
  17481. } else {
  17482. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  17483. charCode = cMap.charCodeOf(glyphId);
  17484. charCodeToGlyphId[charCode] = glyphId;
  17485. }
  17486. }
  17487. return charCodeToGlyphId;
  17488. }
  17489. let encoding = cff.encoding ? cff.encoding.encoding : null;
  17490. if (properties.isInternalFont) {
  17491. encoding = properties.defaultEncoding;
  17492. }
  17493. charCodeToGlyphId = type1FontGlyphMapping(properties, encoding, charsets);
  17494. return charCodeToGlyphId;
  17495. }
  17496. hasGlyphId(id) {
  17497. return this.cff.hasGlyphId(id);
  17498. }
  17499. _createBuiltInEncoding() {
  17500. const {
  17501. charset,
  17502. encoding
  17503. } = this.cff;
  17504. if (!charset || !encoding) {
  17505. return;
  17506. }
  17507. const charsets = charset.charset,
  17508. encodings = encoding.encoding;
  17509. const map = [];
  17510. for (const charCode in encodings) {
  17511. const glyphId = encodings[charCode];
  17512. if (glyphId >= 0) {
  17513. const glyphName = charsets[glyphId];
  17514. if (glyphName) {
  17515. map[charCode] = glyphName;
  17516. }
  17517. }
  17518. }
  17519. if (map.length > 0) {
  17520. this.properties.builtInEncoding = map;
  17521. }
  17522. }
  17523. }
  17524. ;// ./src/core/font_renderer.js
  17525. function getUint32(data, offset) {
  17526. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  17527. }
  17528. function getUint16(data, offset) {
  17529. return data[offset] << 8 | data[offset + 1];
  17530. }
  17531. function getInt16(data, offset) {
  17532. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  17533. }
  17534. function getInt8(data, offset) {
  17535. return data[offset] << 24 >> 24;
  17536. }
  17537. function getFloat214(data, offset) {
  17538. return getInt16(data, offset) / 16384;
  17539. }
  17540. function getSubroutineBias(subrs) {
  17541. const numSubrs = subrs.length;
  17542. let bias = 32768;
  17543. if (numSubrs < 1240) {
  17544. bias = 107;
  17545. } else if (numSubrs < 33900) {
  17546. bias = 1131;
  17547. }
  17548. return bias;
  17549. }
  17550. function parseCmap(data, start, end) {
  17551. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  17552. const format = getUint16(data, start + offset);
  17553. let ranges, p, i;
  17554. if (format === 4) {
  17555. getUint16(data, start + offset + 2);
  17556. const segCount = getUint16(data, start + offset + 6) >> 1;
  17557. p = start + offset + 14;
  17558. ranges = [];
  17559. for (i = 0; i < segCount; i++, p += 2) {
  17560. ranges[i] = {
  17561. end: getUint16(data, p)
  17562. };
  17563. }
  17564. p += 2;
  17565. for (i = 0; i < segCount; i++, p += 2) {
  17566. ranges[i].start = getUint16(data, p);
  17567. }
  17568. for (i = 0; i < segCount; i++, p += 2) {
  17569. ranges[i].idDelta = getUint16(data, p);
  17570. }
  17571. for (i = 0; i < segCount; i++, p += 2) {
  17572. let idOffset = getUint16(data, p);
  17573. if (idOffset === 0) {
  17574. continue;
  17575. }
  17576. ranges[i].ids = [];
  17577. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  17578. ranges[i].ids[j] = getUint16(data, p + idOffset);
  17579. idOffset += 2;
  17580. }
  17581. }
  17582. return ranges;
  17583. } else if (format === 12) {
  17584. const groups = getUint32(data, start + offset + 12);
  17585. p = start + offset + 16;
  17586. ranges = [];
  17587. for (i = 0; i < groups; i++) {
  17588. start = getUint32(data, p);
  17589. ranges.push({
  17590. start,
  17591. end: getUint32(data, p + 4),
  17592. idDelta: getUint32(data, p + 8) - start
  17593. });
  17594. p += 12;
  17595. }
  17596. return ranges;
  17597. }
  17598. throw new FormatError(`unsupported cmap: ${format}`);
  17599. }
  17600. function parseCff(data, start, end, seacAnalysisEnabled) {
  17601. const properties = {};
  17602. const parser = new CFFParser(new Stream(data, start, end - start), properties, seacAnalysisEnabled);
  17603. const cff = parser.parse();
  17604. return {
  17605. glyphs: cff.charStrings.objects,
  17606. subrs: cff.topDict.privateDict?.subrsIndex?.objects,
  17607. gsubrs: cff.globalSubrIndex?.objects,
  17608. isCFFCIDFont: cff.isCIDFont,
  17609. fdSelect: cff.fdSelect,
  17610. fdArray: cff.fdArray
  17611. };
  17612. }
  17613. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  17614. let itemSize, itemDecode;
  17615. if (isGlyphLocationsLong) {
  17616. itemSize = 4;
  17617. itemDecode = getUint32;
  17618. } else {
  17619. itemSize = 2;
  17620. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  17621. }
  17622. const glyphs = [];
  17623. let startOffset = itemDecode(loca, 0);
  17624. for (let j = itemSize; j < loca.length; j += itemSize) {
  17625. const endOffset = itemDecode(loca, j);
  17626. glyphs.push(glyf.subarray(startOffset, endOffset));
  17627. startOffset = endOffset;
  17628. }
  17629. return glyphs;
  17630. }
  17631. function lookupCmap(ranges, unicode) {
  17632. const code = unicode.codePointAt(0);
  17633. let gid = 0,
  17634. l = 0,
  17635. r = ranges.length - 1;
  17636. while (l < r) {
  17637. const c = l + r + 1 >> 1;
  17638. if (code < ranges[c].start) {
  17639. r = c - 1;
  17640. } else {
  17641. l = c;
  17642. }
  17643. }
  17644. if (ranges[l].start <= code && code <= ranges[l].end) {
  17645. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  17646. }
  17647. return {
  17648. charCode: code,
  17649. glyphId: gid
  17650. };
  17651. }
  17652. function compileGlyf(code, cmds, font) {
  17653. function moveTo(x, y) {
  17654. cmds.add("M", [x, y]);
  17655. }
  17656. function lineTo(x, y) {
  17657. cmds.add("L", [x, y]);
  17658. }
  17659. function quadraticCurveTo(xa, ya, x, y) {
  17660. cmds.add("Q", [xa, ya, x, y]);
  17661. }
  17662. let i = 0;
  17663. const numberOfContours = getInt16(code, i);
  17664. let flags;
  17665. let x = 0,
  17666. y = 0;
  17667. i += 10;
  17668. if (numberOfContours < 0) {
  17669. do {
  17670. flags = getUint16(code, i);
  17671. const glyphIndex = getUint16(code, i + 2);
  17672. i += 4;
  17673. let arg1, arg2;
  17674. if (flags & 0x01) {
  17675. if (flags & 0x02) {
  17676. arg1 = getInt16(code, i);
  17677. arg2 = getInt16(code, i + 2);
  17678. } else {
  17679. arg1 = getUint16(code, i);
  17680. arg2 = getUint16(code, i + 2);
  17681. }
  17682. i += 4;
  17683. } else if (flags & 0x02) {
  17684. arg1 = getInt8(code, i++);
  17685. arg2 = getInt8(code, i++);
  17686. } else {
  17687. arg1 = code[i++];
  17688. arg2 = code[i++];
  17689. }
  17690. if (flags & 0x02) {
  17691. x = arg1;
  17692. y = arg2;
  17693. } else {
  17694. x = 0;
  17695. y = 0;
  17696. }
  17697. let scaleX = 1,
  17698. scaleY = 1,
  17699. scale01 = 0,
  17700. scale10 = 0;
  17701. if (flags & 0x08) {
  17702. scaleX = scaleY = getFloat214(code, i);
  17703. i += 2;
  17704. } else if (flags & 0x40) {
  17705. scaleX = getFloat214(code, i);
  17706. scaleY = getFloat214(code, i + 2);
  17707. i += 4;
  17708. } else if (flags & 0x80) {
  17709. scaleX = getFloat214(code, i);
  17710. scale01 = getFloat214(code, i + 2);
  17711. scale10 = getFloat214(code, i + 4);
  17712. scaleY = getFloat214(code, i + 6);
  17713. i += 8;
  17714. }
  17715. const subglyph = font.glyphs[glyphIndex];
  17716. if (subglyph) {
  17717. cmds.save();
  17718. cmds.transform([scaleX, scale01, scale10, scaleY, x, y]);
  17719. if (!(flags & 0x02)) {}
  17720. compileGlyf(subglyph, cmds, font);
  17721. cmds.restore();
  17722. }
  17723. } while (flags & 0x20);
  17724. } else {
  17725. const endPtsOfContours = [];
  17726. let j, jj;
  17727. for (j = 0; j < numberOfContours; j++) {
  17728. endPtsOfContours.push(getUint16(code, i));
  17729. i += 2;
  17730. }
  17731. const instructionLength = getUint16(code, i);
  17732. i += 2 + instructionLength;
  17733. const numberOfPoints = endPtsOfContours.at(-1) + 1;
  17734. const points = [];
  17735. while (points.length < numberOfPoints) {
  17736. flags = code[i++];
  17737. let repeat = 1;
  17738. if (flags & 0x08) {
  17739. repeat += code[i++];
  17740. }
  17741. while (repeat-- > 0) {
  17742. points.push({
  17743. flags
  17744. });
  17745. }
  17746. }
  17747. for (j = 0; j < numberOfPoints; j++) {
  17748. switch (points[j].flags & 0x12) {
  17749. case 0x00:
  17750. x += getInt16(code, i);
  17751. i += 2;
  17752. break;
  17753. case 0x02:
  17754. x -= code[i++];
  17755. break;
  17756. case 0x12:
  17757. x += code[i++];
  17758. break;
  17759. }
  17760. points[j].x = x;
  17761. }
  17762. for (j = 0; j < numberOfPoints; j++) {
  17763. switch (points[j].flags & 0x24) {
  17764. case 0x00:
  17765. y += getInt16(code, i);
  17766. i += 2;
  17767. break;
  17768. case 0x04:
  17769. y -= code[i++];
  17770. break;
  17771. case 0x24:
  17772. y += code[i++];
  17773. break;
  17774. }
  17775. points[j].y = y;
  17776. }
  17777. let startPoint = 0;
  17778. for (i = 0; i < numberOfContours; i++) {
  17779. const endPoint = endPtsOfContours[i];
  17780. const contour = points.slice(startPoint, endPoint + 1);
  17781. if (contour[0].flags & 1) {
  17782. contour.push(contour[0]);
  17783. } else if (contour.at(-1).flags & 1) {
  17784. contour.unshift(contour.at(-1));
  17785. } else {
  17786. const p = {
  17787. flags: 1,
  17788. x: (contour[0].x + contour.at(-1).x) / 2,
  17789. y: (contour[0].y + contour.at(-1).y) / 2
  17790. };
  17791. contour.unshift(p);
  17792. contour.push(p);
  17793. }
  17794. moveTo(contour[0].x, contour[0].y);
  17795. for (j = 1, jj = contour.length; j < jj; j++) {
  17796. if (contour[j].flags & 1) {
  17797. lineTo(contour[j].x, contour[j].y);
  17798. } else if (contour[j + 1].flags & 1) {
  17799. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  17800. j++;
  17801. } else {
  17802. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  17803. }
  17804. }
  17805. startPoint = endPoint + 1;
  17806. }
  17807. }
  17808. }
  17809. function compileCharString(charStringCode, cmds, font, glyphId) {
  17810. function moveTo(x, y) {
  17811. cmds.add("M", [x, y]);
  17812. }
  17813. function lineTo(x, y) {
  17814. cmds.add("L", [x, y]);
  17815. }
  17816. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  17817. cmds.add("C", [x1, y1, x2, y2, x, y]);
  17818. }
  17819. const stack = [];
  17820. let x = 0,
  17821. y = 0;
  17822. let stems = 0;
  17823. function parse(code) {
  17824. let i = 0;
  17825. while (i < code.length) {
  17826. let stackClean = false;
  17827. let v = code[i++];
  17828. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  17829. switch (v) {
  17830. case 1:
  17831. stems += stack.length >> 1;
  17832. stackClean = true;
  17833. break;
  17834. case 3:
  17835. stems += stack.length >> 1;
  17836. stackClean = true;
  17837. break;
  17838. case 4:
  17839. y += stack.pop();
  17840. moveTo(x, y);
  17841. stackClean = true;
  17842. break;
  17843. case 5:
  17844. while (stack.length > 0) {
  17845. x += stack.shift();
  17846. y += stack.shift();
  17847. lineTo(x, y);
  17848. }
  17849. break;
  17850. case 6:
  17851. while (stack.length > 0) {
  17852. x += stack.shift();
  17853. lineTo(x, y);
  17854. if (stack.length === 0) {
  17855. break;
  17856. }
  17857. y += stack.shift();
  17858. lineTo(x, y);
  17859. }
  17860. break;
  17861. case 7:
  17862. while (stack.length > 0) {
  17863. y += stack.shift();
  17864. lineTo(x, y);
  17865. if (stack.length === 0) {
  17866. break;
  17867. }
  17868. x += stack.shift();
  17869. lineTo(x, y);
  17870. }
  17871. break;
  17872. case 8:
  17873. while (stack.length > 0) {
  17874. xa = x + stack.shift();
  17875. ya = y + stack.shift();
  17876. xb = xa + stack.shift();
  17877. yb = ya + stack.shift();
  17878. x = xb + stack.shift();
  17879. y = yb + stack.shift();
  17880. bezierCurveTo(xa, ya, xb, yb, x, y);
  17881. }
  17882. break;
  17883. case 10:
  17884. n = stack.pop();
  17885. subrCode = null;
  17886. if (font.isCFFCIDFont) {
  17887. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  17888. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  17889. const fontDict = font.fdArray[fdIndex];
  17890. let subrs;
  17891. if (fontDict.privateDict?.subrsIndex) {
  17892. subrs = fontDict.privateDict.subrsIndex.objects;
  17893. }
  17894. if (subrs) {
  17895. n += getSubroutineBias(subrs);
  17896. subrCode = subrs[n];
  17897. }
  17898. } else {
  17899. warn("Invalid fd index for glyph index.");
  17900. }
  17901. } else {
  17902. subrCode = font.subrs[n + font.subrsBias];
  17903. }
  17904. if (subrCode) {
  17905. parse(subrCode);
  17906. }
  17907. break;
  17908. case 11:
  17909. return;
  17910. case 12:
  17911. v = code[i++];
  17912. switch (v) {
  17913. case 34:
  17914. xa = x + stack.shift();
  17915. xb = xa + stack.shift();
  17916. y1 = y + stack.shift();
  17917. x = xb + stack.shift();
  17918. bezierCurveTo(xa, y, xb, y1, x, y1);
  17919. xa = x + stack.shift();
  17920. xb = xa + stack.shift();
  17921. x = xb + stack.shift();
  17922. bezierCurveTo(xa, y1, xb, y, x, y);
  17923. break;
  17924. case 35:
  17925. xa = x + stack.shift();
  17926. ya = y + stack.shift();
  17927. xb = xa + stack.shift();
  17928. yb = ya + stack.shift();
  17929. x = xb + stack.shift();
  17930. y = yb + stack.shift();
  17931. bezierCurveTo(xa, ya, xb, yb, x, y);
  17932. xa = x + stack.shift();
  17933. ya = y + stack.shift();
  17934. xb = xa + stack.shift();
  17935. yb = ya + stack.shift();
  17936. x = xb + stack.shift();
  17937. y = yb + stack.shift();
  17938. bezierCurveTo(xa, ya, xb, yb, x, y);
  17939. stack.pop();
  17940. break;
  17941. case 36:
  17942. xa = x + stack.shift();
  17943. y1 = y + stack.shift();
  17944. xb = xa + stack.shift();
  17945. y2 = y1 + stack.shift();
  17946. x = xb + stack.shift();
  17947. bezierCurveTo(xa, y1, xb, y2, x, y2);
  17948. xa = x + stack.shift();
  17949. xb = xa + stack.shift();
  17950. y3 = y2 + stack.shift();
  17951. x = xb + stack.shift();
  17952. bezierCurveTo(xa, y2, xb, y3, x, y);
  17953. break;
  17954. case 37:
  17955. const x0 = x,
  17956. y0 = y;
  17957. xa = x + stack.shift();
  17958. ya = y + stack.shift();
  17959. xb = xa + stack.shift();
  17960. yb = ya + stack.shift();
  17961. x = xb + stack.shift();
  17962. y = yb + stack.shift();
  17963. bezierCurveTo(xa, ya, xb, yb, x, y);
  17964. xa = x + stack.shift();
  17965. ya = y + stack.shift();
  17966. xb = xa + stack.shift();
  17967. yb = ya + stack.shift();
  17968. x = xb;
  17969. y = yb;
  17970. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  17971. x += stack.shift();
  17972. } else {
  17973. y += stack.shift();
  17974. }
  17975. bezierCurveTo(xa, ya, xb, yb, x, y);
  17976. break;
  17977. default:
  17978. throw new FormatError(`unknown operator: 12 ${v}`);
  17979. }
  17980. break;
  17981. case 14:
  17982. if (stack.length >= 4) {
  17983. const achar = stack.pop();
  17984. const bchar = stack.pop();
  17985. y = stack.pop();
  17986. x = stack.pop();
  17987. cmds.save();
  17988. cmds.translate(x, y);
  17989. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[achar]]));
  17990. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  17991. cmds.restore();
  17992. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[StandardEncoding[bchar]]));
  17993. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  17994. }
  17995. return;
  17996. case 18:
  17997. stems += stack.length >> 1;
  17998. stackClean = true;
  17999. break;
  18000. case 19:
  18001. stems += stack.length >> 1;
  18002. i += stems + 7 >> 3;
  18003. stackClean = true;
  18004. break;
  18005. case 20:
  18006. stems += stack.length >> 1;
  18007. i += stems + 7 >> 3;
  18008. stackClean = true;
  18009. break;
  18010. case 21:
  18011. y += stack.pop();
  18012. x += stack.pop();
  18013. moveTo(x, y);
  18014. stackClean = true;
  18015. break;
  18016. case 22:
  18017. x += stack.pop();
  18018. moveTo(x, y);
  18019. stackClean = true;
  18020. break;
  18021. case 23:
  18022. stems += stack.length >> 1;
  18023. stackClean = true;
  18024. break;
  18025. case 24:
  18026. while (stack.length > 2) {
  18027. xa = x + stack.shift();
  18028. ya = y + stack.shift();
  18029. xb = xa + stack.shift();
  18030. yb = ya + stack.shift();
  18031. x = xb + stack.shift();
  18032. y = yb + stack.shift();
  18033. bezierCurveTo(xa, ya, xb, yb, x, y);
  18034. }
  18035. x += stack.shift();
  18036. y += stack.shift();
  18037. lineTo(x, y);
  18038. break;
  18039. case 25:
  18040. while (stack.length > 6) {
  18041. x += stack.shift();
  18042. y += stack.shift();
  18043. lineTo(x, y);
  18044. }
  18045. xa = x + stack.shift();
  18046. ya = y + stack.shift();
  18047. xb = xa + stack.shift();
  18048. yb = ya + stack.shift();
  18049. x = xb + stack.shift();
  18050. y = yb + stack.shift();
  18051. bezierCurveTo(xa, ya, xb, yb, x, y);
  18052. break;
  18053. case 26:
  18054. if (stack.length % 2) {
  18055. x += stack.shift();
  18056. }
  18057. while (stack.length > 0) {
  18058. xa = x;
  18059. ya = y + stack.shift();
  18060. xb = xa + stack.shift();
  18061. yb = ya + stack.shift();
  18062. x = xb;
  18063. y = yb + stack.shift();
  18064. bezierCurveTo(xa, ya, xb, yb, x, y);
  18065. }
  18066. break;
  18067. case 27:
  18068. if (stack.length % 2) {
  18069. y += stack.shift();
  18070. }
  18071. while (stack.length > 0) {
  18072. xa = x + stack.shift();
  18073. ya = y;
  18074. xb = xa + stack.shift();
  18075. yb = ya + stack.shift();
  18076. x = xb + stack.shift();
  18077. y = yb;
  18078. bezierCurveTo(xa, ya, xb, yb, x, y);
  18079. }
  18080. break;
  18081. case 28:
  18082. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  18083. i += 2;
  18084. break;
  18085. case 29:
  18086. n = stack.pop() + font.gsubrsBias;
  18087. subrCode = font.gsubrs[n];
  18088. if (subrCode) {
  18089. parse(subrCode);
  18090. }
  18091. break;
  18092. case 30:
  18093. while (stack.length > 0) {
  18094. xa = x;
  18095. ya = y + stack.shift();
  18096. xb = xa + stack.shift();
  18097. yb = ya + stack.shift();
  18098. x = xb + stack.shift();
  18099. y = yb + (stack.length === 1 ? stack.shift() : 0);
  18100. bezierCurveTo(xa, ya, xb, yb, x, y);
  18101. if (stack.length === 0) {
  18102. break;
  18103. }
  18104. xa = x + stack.shift();
  18105. ya = y;
  18106. xb = xa + stack.shift();
  18107. yb = ya + stack.shift();
  18108. y = yb + stack.shift();
  18109. x = xb + (stack.length === 1 ? stack.shift() : 0);
  18110. bezierCurveTo(xa, ya, xb, yb, x, y);
  18111. }
  18112. break;
  18113. case 31:
  18114. while (stack.length > 0) {
  18115. xa = x + stack.shift();
  18116. ya = y;
  18117. xb = xa + stack.shift();
  18118. yb = ya + stack.shift();
  18119. y = yb + stack.shift();
  18120. x = xb + (stack.length === 1 ? stack.shift() : 0);
  18121. bezierCurveTo(xa, ya, xb, yb, x, y);
  18122. if (stack.length === 0) {
  18123. break;
  18124. }
  18125. xa = x;
  18126. ya = y + stack.shift();
  18127. xb = xa + stack.shift();
  18128. yb = ya + stack.shift();
  18129. x = xb + stack.shift();
  18130. y = yb + (stack.length === 1 ? stack.shift() : 0);
  18131. bezierCurveTo(xa, ya, xb, yb, x, y);
  18132. }
  18133. break;
  18134. default:
  18135. if (v < 32) {
  18136. throw new FormatError(`unknown operator: ${v}`);
  18137. }
  18138. if (v < 247) {
  18139. stack.push(v - 139);
  18140. } else if (v < 251) {
  18141. stack.push((v - 247) * 256 + code[i++] + 108);
  18142. } else if (v < 255) {
  18143. stack.push(-(v - 251) * 256 - code[i++] - 108);
  18144. } else {
  18145. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  18146. i += 4;
  18147. }
  18148. break;
  18149. }
  18150. if (stackClean) {
  18151. stack.length = 0;
  18152. }
  18153. }
  18154. }
  18155. parse(charStringCode);
  18156. }
  18157. const NOOP = "";
  18158. class Commands {
  18159. cmds = [];
  18160. transformStack = [];
  18161. currentTransform = [1, 0, 0, 1, 0, 0];
  18162. add(cmd, args) {
  18163. if (args) {
  18164. const [a, b, c, d, e, f] = this.currentTransform;
  18165. for (let i = 0, ii = args.length; i < ii; i += 2) {
  18166. const x = args[i];
  18167. const y = args[i + 1];
  18168. args[i] = a * x + c * y + e;
  18169. args[i + 1] = b * x + d * y + f;
  18170. }
  18171. this.cmds.push(`${cmd}${args.join(" ")}`);
  18172. } else {
  18173. this.cmds.push(cmd);
  18174. }
  18175. }
  18176. transform(transf) {
  18177. this.currentTransform = Util.transform(this.currentTransform, transf);
  18178. }
  18179. translate(x, y) {
  18180. this.transform([1, 0, 0, 1, x, y]);
  18181. }
  18182. save() {
  18183. this.transformStack.push(this.currentTransform.slice());
  18184. }
  18185. restore() {
  18186. this.currentTransform = this.transformStack.pop() || [1, 0, 0, 1, 0, 0];
  18187. }
  18188. getSVG() {
  18189. return this.cmds.join("");
  18190. }
  18191. }
  18192. class CompiledFont {
  18193. constructor(fontMatrix) {
  18194. this.fontMatrix = fontMatrix;
  18195. this.compiledGlyphs = Object.create(null);
  18196. this.compiledCharCodeToGlyphId = Object.create(null);
  18197. }
  18198. getPathJs(unicode) {
  18199. const {
  18200. charCode,
  18201. glyphId
  18202. } = lookupCmap(this.cmap, unicode);
  18203. let fn = this.compiledGlyphs[glyphId],
  18204. compileEx;
  18205. if (fn === undefined) {
  18206. try {
  18207. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  18208. } catch (ex) {
  18209. fn = NOOP;
  18210. compileEx = ex;
  18211. }
  18212. this.compiledGlyphs[glyphId] = fn;
  18213. }
  18214. this.compiledCharCodeToGlyphId[charCode] ??= glyphId;
  18215. if (compileEx) {
  18216. throw compileEx;
  18217. }
  18218. return fn;
  18219. }
  18220. compileGlyph(code, glyphId) {
  18221. if (!code?.length || code[0] === 14) {
  18222. return NOOP;
  18223. }
  18224. let fontMatrix = this.fontMatrix;
  18225. if (this.isCFFCIDFont) {
  18226. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  18227. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  18228. const fontDict = this.fdArray[fdIndex];
  18229. fontMatrix = fontDict.getByName("FontMatrix") || FONT_IDENTITY_MATRIX;
  18230. } else {
  18231. warn("Invalid fd index for glyph index.");
  18232. }
  18233. }
  18234. assert(isNumberArray(fontMatrix, 6), "Expected a valid fontMatrix.");
  18235. const cmds = new Commands();
  18236. cmds.transform(fontMatrix.slice());
  18237. this.compileGlyphImpl(code, cmds, glyphId);
  18238. cmds.add("Z");
  18239. return cmds.getSVG();
  18240. }
  18241. compileGlyphImpl() {
  18242. unreachable("Children classes should implement this.");
  18243. }
  18244. hasBuiltPath(unicode) {
  18245. const {
  18246. charCode,
  18247. glyphId
  18248. } = lookupCmap(this.cmap, unicode);
  18249. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  18250. }
  18251. }
  18252. class TrueTypeCompiled extends CompiledFont {
  18253. constructor(glyphs, cmap, fontMatrix) {
  18254. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  18255. this.glyphs = glyphs;
  18256. this.cmap = cmap;
  18257. }
  18258. compileGlyphImpl(code, cmds) {
  18259. compileGlyf(code, cmds, this);
  18260. }
  18261. }
  18262. class Type2Compiled extends CompiledFont {
  18263. constructor(cffInfo, cmap, fontMatrix) {
  18264. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  18265. this.glyphs = cffInfo.glyphs;
  18266. this.gsubrs = cffInfo.gsubrs || [];
  18267. this.subrs = cffInfo.subrs || [];
  18268. this.cmap = cmap;
  18269. this.glyphNameMap = getGlyphsUnicode();
  18270. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  18271. this.subrsBias = getSubroutineBias(this.subrs);
  18272. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  18273. this.fdSelect = cffInfo.fdSelect;
  18274. this.fdArray = cffInfo.fdArray;
  18275. }
  18276. compileGlyphImpl(code, cmds, glyphId) {
  18277. compileCharString(code, cmds, this, glyphId);
  18278. }
  18279. }
  18280. class FontRendererFactory {
  18281. static create(font, seacAnalysisEnabled) {
  18282. const data = new Uint8Array(font.data);
  18283. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  18284. const numTables = getUint16(data, 4);
  18285. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  18286. const tag = bytesToString(data.subarray(p, p + 4));
  18287. const offset = getUint32(data, p + 8);
  18288. const length = getUint32(data, p + 12);
  18289. switch (tag) {
  18290. case "cmap":
  18291. cmap = parseCmap(data, offset, offset + length);
  18292. break;
  18293. case "glyf":
  18294. glyf = data.subarray(offset, offset + length);
  18295. break;
  18296. case "loca":
  18297. loca = data.subarray(offset, offset + length);
  18298. break;
  18299. case "head":
  18300. unitsPerEm = getUint16(data, offset + 18);
  18301. indexToLocFormat = getUint16(data, offset + 50);
  18302. break;
  18303. case "CFF ":
  18304. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  18305. break;
  18306. }
  18307. }
  18308. if (glyf) {
  18309. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  18310. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  18311. }
  18312. return new Type2Compiled(cff, cmap, font.fontMatrix);
  18313. }
  18314. }
  18315. ;// ./src/core/metrics.js
  18316. const getMetrics = getLookupTableFactory(function (t) {
  18317. t.Courier = 600;
  18318. t["Courier-Bold"] = 600;
  18319. t["Courier-BoldOblique"] = 600;
  18320. t["Courier-Oblique"] = 600;
  18321. t.Helvetica = getLookupTableFactory(function (t) {
  18322. t.space = 278;
  18323. t.exclam = 278;
  18324. t.quotedbl = 355;
  18325. t.numbersign = 556;
  18326. t.dollar = 556;
  18327. t.percent = 889;
  18328. t.ampersand = 667;
  18329. t.quoteright = 222;
  18330. t.parenleft = 333;
  18331. t.parenright = 333;
  18332. t.asterisk = 389;
  18333. t.plus = 584;
  18334. t.comma = 278;
  18335. t.hyphen = 333;
  18336. t.period = 278;
  18337. t.slash = 278;
  18338. t.zero = 556;
  18339. t.one = 556;
  18340. t.two = 556;
  18341. t.three = 556;
  18342. t.four = 556;
  18343. t.five = 556;
  18344. t.six = 556;
  18345. t.seven = 556;
  18346. t.eight = 556;
  18347. t.nine = 556;
  18348. t.colon = 278;
  18349. t.semicolon = 278;
  18350. t.less = 584;
  18351. t.equal = 584;
  18352. t.greater = 584;
  18353. t.question = 556;
  18354. t.at = 1015;
  18355. t.A = 667;
  18356. t.B = 667;
  18357. t.C = 722;
  18358. t.D = 722;
  18359. t.E = 667;
  18360. t.F = 611;
  18361. t.G = 778;
  18362. t.H = 722;
  18363. t.I = 278;
  18364. t.J = 500;
  18365. t.K = 667;
  18366. t.L = 556;
  18367. t.M = 833;
  18368. t.N = 722;
  18369. t.O = 778;
  18370. t.P = 667;
  18371. t.Q = 778;
  18372. t.R = 722;
  18373. t.S = 667;
  18374. t.T = 611;
  18375. t.U = 722;
  18376. t.V = 667;
  18377. t.W = 944;
  18378. t.X = 667;
  18379. t.Y = 667;
  18380. t.Z = 611;
  18381. t.bracketleft = 278;
  18382. t.backslash = 278;
  18383. t.bracketright = 278;
  18384. t.asciicircum = 469;
  18385. t.underscore = 556;
  18386. t.quoteleft = 222;
  18387. t.a = 556;
  18388. t.b = 556;
  18389. t.c = 500;
  18390. t.d = 556;
  18391. t.e = 556;
  18392. t.f = 278;
  18393. t.g = 556;
  18394. t.h = 556;
  18395. t.i = 222;
  18396. t.j = 222;
  18397. t.k = 500;
  18398. t.l = 222;
  18399. t.m = 833;
  18400. t.n = 556;
  18401. t.o = 556;
  18402. t.p = 556;
  18403. t.q = 556;
  18404. t.r = 333;
  18405. t.s = 500;
  18406. t.t = 278;
  18407. t.u = 556;
  18408. t.v = 500;
  18409. t.w = 722;
  18410. t.x = 500;
  18411. t.y = 500;
  18412. t.z = 500;
  18413. t.braceleft = 334;
  18414. t.bar = 260;
  18415. t.braceright = 334;
  18416. t.asciitilde = 584;
  18417. t.exclamdown = 333;
  18418. t.cent = 556;
  18419. t.sterling = 556;
  18420. t.fraction = 167;
  18421. t.yen = 556;
  18422. t.florin = 556;
  18423. t.section = 556;
  18424. t.currency = 556;
  18425. t.quotesingle = 191;
  18426. t.quotedblleft = 333;
  18427. t.guillemotleft = 556;
  18428. t.guilsinglleft = 333;
  18429. t.guilsinglright = 333;
  18430. t.fi = 500;
  18431. t.fl = 500;
  18432. t.endash = 556;
  18433. t.dagger = 556;
  18434. t.daggerdbl = 556;
  18435. t.periodcentered = 278;
  18436. t.paragraph = 537;
  18437. t.bullet = 350;
  18438. t.quotesinglbase = 222;
  18439. t.quotedblbase = 333;
  18440. t.quotedblright = 333;
  18441. t.guillemotright = 556;
  18442. t.ellipsis = 1000;
  18443. t.perthousand = 1000;
  18444. t.questiondown = 611;
  18445. t.grave = 333;
  18446. t.acute = 333;
  18447. t.circumflex = 333;
  18448. t.tilde = 333;
  18449. t.macron = 333;
  18450. t.breve = 333;
  18451. t.dotaccent = 333;
  18452. t.dieresis = 333;
  18453. t.ring = 333;
  18454. t.cedilla = 333;
  18455. t.hungarumlaut = 333;
  18456. t.ogonek = 333;
  18457. t.caron = 333;
  18458. t.emdash = 1000;
  18459. t.AE = 1000;
  18460. t.ordfeminine = 370;
  18461. t.Lslash = 556;
  18462. t.Oslash = 778;
  18463. t.OE = 1000;
  18464. t.ordmasculine = 365;
  18465. t.ae = 889;
  18466. t.dotlessi = 278;
  18467. t.lslash = 222;
  18468. t.oslash = 611;
  18469. t.oe = 944;
  18470. t.germandbls = 611;
  18471. t.Idieresis = 278;
  18472. t.eacute = 556;
  18473. t.abreve = 556;
  18474. t.uhungarumlaut = 556;
  18475. t.ecaron = 556;
  18476. t.Ydieresis = 667;
  18477. t.divide = 584;
  18478. t.Yacute = 667;
  18479. t.Acircumflex = 667;
  18480. t.aacute = 556;
  18481. t.Ucircumflex = 722;
  18482. t.yacute = 500;
  18483. t.scommaaccent = 500;
  18484. t.ecircumflex = 556;
  18485. t.Uring = 722;
  18486. t.Udieresis = 722;
  18487. t.aogonek = 556;
  18488. t.Uacute = 722;
  18489. t.uogonek = 556;
  18490. t.Edieresis = 667;
  18491. t.Dcroat = 722;
  18492. t.commaaccent = 250;
  18493. t.copyright = 737;
  18494. t.Emacron = 667;
  18495. t.ccaron = 500;
  18496. t.aring = 556;
  18497. t.Ncommaaccent = 722;
  18498. t.lacute = 222;
  18499. t.agrave = 556;
  18500. t.Tcommaaccent = 611;
  18501. t.Cacute = 722;
  18502. t.atilde = 556;
  18503. t.Edotaccent = 667;
  18504. t.scaron = 500;
  18505. t.scedilla = 500;
  18506. t.iacute = 278;
  18507. t.lozenge = 471;
  18508. t.Rcaron = 722;
  18509. t.Gcommaaccent = 778;
  18510. t.ucircumflex = 556;
  18511. t.acircumflex = 556;
  18512. t.Amacron = 667;
  18513. t.rcaron = 333;
  18514. t.ccedilla = 500;
  18515. t.Zdotaccent = 611;
  18516. t.Thorn = 667;
  18517. t.Omacron = 778;
  18518. t.Racute = 722;
  18519. t.Sacute = 667;
  18520. t.dcaron = 643;
  18521. t.Umacron = 722;
  18522. t.uring = 556;
  18523. t.threesuperior = 333;
  18524. t.Ograve = 778;
  18525. t.Agrave = 667;
  18526. t.Abreve = 667;
  18527. t.multiply = 584;
  18528. t.uacute = 556;
  18529. t.Tcaron = 611;
  18530. t.partialdiff = 476;
  18531. t.ydieresis = 500;
  18532. t.Nacute = 722;
  18533. t.icircumflex = 278;
  18534. t.Ecircumflex = 667;
  18535. t.adieresis = 556;
  18536. t.edieresis = 556;
  18537. t.cacute = 500;
  18538. t.nacute = 556;
  18539. t.umacron = 556;
  18540. t.Ncaron = 722;
  18541. t.Iacute = 278;
  18542. t.plusminus = 584;
  18543. t.brokenbar = 260;
  18544. t.registered = 737;
  18545. t.Gbreve = 778;
  18546. t.Idotaccent = 278;
  18547. t.summation = 600;
  18548. t.Egrave = 667;
  18549. t.racute = 333;
  18550. t.omacron = 556;
  18551. t.Zacute = 611;
  18552. t.Zcaron = 611;
  18553. t.greaterequal = 549;
  18554. t.Eth = 722;
  18555. t.Ccedilla = 722;
  18556. t.lcommaaccent = 222;
  18557. t.tcaron = 317;
  18558. t.eogonek = 556;
  18559. t.Uogonek = 722;
  18560. t.Aacute = 667;
  18561. t.Adieresis = 667;
  18562. t.egrave = 556;
  18563. t.zacute = 500;
  18564. t.iogonek = 222;
  18565. t.Oacute = 778;
  18566. t.oacute = 556;
  18567. t.amacron = 556;
  18568. t.sacute = 500;
  18569. t.idieresis = 278;
  18570. t.Ocircumflex = 778;
  18571. t.Ugrave = 722;
  18572. t.Delta = 612;
  18573. t.thorn = 556;
  18574. t.twosuperior = 333;
  18575. t.Odieresis = 778;
  18576. t.mu = 556;
  18577. t.igrave = 278;
  18578. t.ohungarumlaut = 556;
  18579. t.Eogonek = 667;
  18580. t.dcroat = 556;
  18581. t.threequarters = 834;
  18582. t.Scedilla = 667;
  18583. t.lcaron = 299;
  18584. t.Kcommaaccent = 667;
  18585. t.Lacute = 556;
  18586. t.trademark = 1000;
  18587. t.edotaccent = 556;
  18588. t.Igrave = 278;
  18589. t.Imacron = 278;
  18590. t.Lcaron = 556;
  18591. t.onehalf = 834;
  18592. t.lessequal = 549;
  18593. t.ocircumflex = 556;
  18594. t.ntilde = 556;
  18595. t.Uhungarumlaut = 722;
  18596. t.Eacute = 667;
  18597. t.emacron = 556;
  18598. t.gbreve = 556;
  18599. t.onequarter = 834;
  18600. t.Scaron = 667;
  18601. t.Scommaaccent = 667;
  18602. t.Ohungarumlaut = 778;
  18603. t.degree = 400;
  18604. t.ograve = 556;
  18605. t.Ccaron = 722;
  18606. t.ugrave = 556;
  18607. t.radical = 453;
  18608. t.Dcaron = 722;
  18609. t.rcommaaccent = 333;
  18610. t.Ntilde = 722;
  18611. t.otilde = 556;
  18612. t.Rcommaaccent = 722;
  18613. t.Lcommaaccent = 556;
  18614. t.Atilde = 667;
  18615. t.Aogonek = 667;
  18616. t.Aring = 667;
  18617. t.Otilde = 778;
  18618. t.zdotaccent = 500;
  18619. t.Ecaron = 667;
  18620. t.Iogonek = 278;
  18621. t.kcommaaccent = 500;
  18622. t.minus = 584;
  18623. t.Icircumflex = 278;
  18624. t.ncaron = 556;
  18625. t.tcommaaccent = 278;
  18626. t.logicalnot = 584;
  18627. t.odieresis = 556;
  18628. t.udieresis = 556;
  18629. t.notequal = 549;
  18630. t.gcommaaccent = 556;
  18631. t.eth = 556;
  18632. t.zcaron = 500;
  18633. t.ncommaaccent = 556;
  18634. t.onesuperior = 333;
  18635. t.imacron = 278;
  18636. t.Euro = 556;
  18637. });
  18638. t["Helvetica-Bold"] = getLookupTableFactory(function (t) {
  18639. t.space = 278;
  18640. t.exclam = 333;
  18641. t.quotedbl = 474;
  18642. t.numbersign = 556;
  18643. t.dollar = 556;
  18644. t.percent = 889;
  18645. t.ampersand = 722;
  18646. t.quoteright = 278;
  18647. t.parenleft = 333;
  18648. t.parenright = 333;
  18649. t.asterisk = 389;
  18650. t.plus = 584;
  18651. t.comma = 278;
  18652. t.hyphen = 333;
  18653. t.period = 278;
  18654. t.slash = 278;
  18655. t.zero = 556;
  18656. t.one = 556;
  18657. t.two = 556;
  18658. t.three = 556;
  18659. t.four = 556;
  18660. t.five = 556;
  18661. t.six = 556;
  18662. t.seven = 556;
  18663. t.eight = 556;
  18664. t.nine = 556;
  18665. t.colon = 333;
  18666. t.semicolon = 333;
  18667. t.less = 584;
  18668. t.equal = 584;
  18669. t.greater = 584;
  18670. t.question = 611;
  18671. t.at = 975;
  18672. t.A = 722;
  18673. t.B = 722;
  18674. t.C = 722;
  18675. t.D = 722;
  18676. t.E = 667;
  18677. t.F = 611;
  18678. t.G = 778;
  18679. t.H = 722;
  18680. t.I = 278;
  18681. t.J = 556;
  18682. t.K = 722;
  18683. t.L = 611;
  18684. t.M = 833;
  18685. t.N = 722;
  18686. t.O = 778;
  18687. t.P = 667;
  18688. t.Q = 778;
  18689. t.R = 722;
  18690. t.S = 667;
  18691. t.T = 611;
  18692. t.U = 722;
  18693. t.V = 667;
  18694. t.W = 944;
  18695. t.X = 667;
  18696. t.Y = 667;
  18697. t.Z = 611;
  18698. t.bracketleft = 333;
  18699. t.backslash = 278;
  18700. t.bracketright = 333;
  18701. t.asciicircum = 584;
  18702. t.underscore = 556;
  18703. t.quoteleft = 278;
  18704. t.a = 556;
  18705. t.b = 611;
  18706. t.c = 556;
  18707. t.d = 611;
  18708. t.e = 556;
  18709. t.f = 333;
  18710. t.g = 611;
  18711. t.h = 611;
  18712. t.i = 278;
  18713. t.j = 278;
  18714. t.k = 556;
  18715. t.l = 278;
  18716. t.m = 889;
  18717. t.n = 611;
  18718. t.o = 611;
  18719. t.p = 611;
  18720. t.q = 611;
  18721. t.r = 389;
  18722. t.s = 556;
  18723. t.t = 333;
  18724. t.u = 611;
  18725. t.v = 556;
  18726. t.w = 778;
  18727. t.x = 556;
  18728. t.y = 556;
  18729. t.z = 500;
  18730. t.braceleft = 389;
  18731. t.bar = 280;
  18732. t.braceright = 389;
  18733. t.asciitilde = 584;
  18734. t.exclamdown = 333;
  18735. t.cent = 556;
  18736. t.sterling = 556;
  18737. t.fraction = 167;
  18738. t.yen = 556;
  18739. t.florin = 556;
  18740. t.section = 556;
  18741. t.currency = 556;
  18742. t.quotesingle = 238;
  18743. t.quotedblleft = 500;
  18744. t.guillemotleft = 556;
  18745. t.guilsinglleft = 333;
  18746. t.guilsinglright = 333;
  18747. t.fi = 611;
  18748. t.fl = 611;
  18749. t.endash = 556;
  18750. t.dagger = 556;
  18751. t.daggerdbl = 556;
  18752. t.periodcentered = 278;
  18753. t.paragraph = 556;
  18754. t.bullet = 350;
  18755. t.quotesinglbase = 278;
  18756. t.quotedblbase = 500;
  18757. t.quotedblright = 500;
  18758. t.guillemotright = 556;
  18759. t.ellipsis = 1000;
  18760. t.perthousand = 1000;
  18761. t.questiondown = 611;
  18762. t.grave = 333;
  18763. t.acute = 333;
  18764. t.circumflex = 333;
  18765. t.tilde = 333;
  18766. t.macron = 333;
  18767. t.breve = 333;
  18768. t.dotaccent = 333;
  18769. t.dieresis = 333;
  18770. t.ring = 333;
  18771. t.cedilla = 333;
  18772. t.hungarumlaut = 333;
  18773. t.ogonek = 333;
  18774. t.caron = 333;
  18775. t.emdash = 1000;
  18776. t.AE = 1000;
  18777. t.ordfeminine = 370;
  18778. t.Lslash = 611;
  18779. t.Oslash = 778;
  18780. t.OE = 1000;
  18781. t.ordmasculine = 365;
  18782. t.ae = 889;
  18783. t.dotlessi = 278;
  18784. t.lslash = 278;
  18785. t.oslash = 611;
  18786. t.oe = 944;
  18787. t.germandbls = 611;
  18788. t.Idieresis = 278;
  18789. t.eacute = 556;
  18790. t.abreve = 556;
  18791. t.uhungarumlaut = 611;
  18792. t.ecaron = 556;
  18793. t.Ydieresis = 667;
  18794. t.divide = 584;
  18795. t.Yacute = 667;
  18796. t.Acircumflex = 722;
  18797. t.aacute = 556;
  18798. t.Ucircumflex = 722;
  18799. t.yacute = 556;
  18800. t.scommaaccent = 556;
  18801. t.ecircumflex = 556;
  18802. t.Uring = 722;
  18803. t.Udieresis = 722;
  18804. t.aogonek = 556;
  18805. t.Uacute = 722;
  18806. t.uogonek = 611;
  18807. t.Edieresis = 667;
  18808. t.Dcroat = 722;
  18809. t.commaaccent = 250;
  18810. t.copyright = 737;
  18811. t.Emacron = 667;
  18812. t.ccaron = 556;
  18813. t.aring = 556;
  18814. t.Ncommaaccent = 722;
  18815. t.lacute = 278;
  18816. t.agrave = 556;
  18817. t.Tcommaaccent = 611;
  18818. t.Cacute = 722;
  18819. t.atilde = 556;
  18820. t.Edotaccent = 667;
  18821. t.scaron = 556;
  18822. t.scedilla = 556;
  18823. t.iacute = 278;
  18824. t.lozenge = 494;
  18825. t.Rcaron = 722;
  18826. t.Gcommaaccent = 778;
  18827. t.ucircumflex = 611;
  18828. t.acircumflex = 556;
  18829. t.Amacron = 722;
  18830. t.rcaron = 389;
  18831. t.ccedilla = 556;
  18832. t.Zdotaccent = 611;
  18833. t.Thorn = 667;
  18834. t.Omacron = 778;
  18835. t.Racute = 722;
  18836. t.Sacute = 667;
  18837. t.dcaron = 743;
  18838. t.Umacron = 722;
  18839. t.uring = 611;
  18840. t.threesuperior = 333;
  18841. t.Ograve = 778;
  18842. t.Agrave = 722;
  18843. t.Abreve = 722;
  18844. t.multiply = 584;
  18845. t.uacute = 611;
  18846. t.Tcaron = 611;
  18847. t.partialdiff = 494;
  18848. t.ydieresis = 556;
  18849. t.Nacute = 722;
  18850. t.icircumflex = 278;
  18851. t.Ecircumflex = 667;
  18852. t.adieresis = 556;
  18853. t.edieresis = 556;
  18854. t.cacute = 556;
  18855. t.nacute = 611;
  18856. t.umacron = 611;
  18857. t.Ncaron = 722;
  18858. t.Iacute = 278;
  18859. t.plusminus = 584;
  18860. t.brokenbar = 280;
  18861. t.registered = 737;
  18862. t.Gbreve = 778;
  18863. t.Idotaccent = 278;
  18864. t.summation = 600;
  18865. t.Egrave = 667;
  18866. t.racute = 389;
  18867. t.omacron = 611;
  18868. t.Zacute = 611;
  18869. t.Zcaron = 611;
  18870. t.greaterequal = 549;
  18871. t.Eth = 722;
  18872. t.Ccedilla = 722;
  18873. t.lcommaaccent = 278;
  18874. t.tcaron = 389;
  18875. t.eogonek = 556;
  18876. t.Uogonek = 722;
  18877. t.Aacute = 722;
  18878. t.Adieresis = 722;
  18879. t.egrave = 556;
  18880. t.zacute = 500;
  18881. t.iogonek = 278;
  18882. t.Oacute = 778;
  18883. t.oacute = 611;
  18884. t.amacron = 556;
  18885. t.sacute = 556;
  18886. t.idieresis = 278;
  18887. t.Ocircumflex = 778;
  18888. t.Ugrave = 722;
  18889. t.Delta = 612;
  18890. t.thorn = 611;
  18891. t.twosuperior = 333;
  18892. t.Odieresis = 778;
  18893. t.mu = 611;
  18894. t.igrave = 278;
  18895. t.ohungarumlaut = 611;
  18896. t.Eogonek = 667;
  18897. t.dcroat = 611;
  18898. t.threequarters = 834;
  18899. t.Scedilla = 667;
  18900. t.lcaron = 400;
  18901. t.Kcommaaccent = 722;
  18902. t.Lacute = 611;
  18903. t.trademark = 1000;
  18904. t.edotaccent = 556;
  18905. t.Igrave = 278;
  18906. t.Imacron = 278;
  18907. t.Lcaron = 611;
  18908. t.onehalf = 834;
  18909. t.lessequal = 549;
  18910. t.ocircumflex = 611;
  18911. t.ntilde = 611;
  18912. t.Uhungarumlaut = 722;
  18913. t.Eacute = 667;
  18914. t.emacron = 556;
  18915. t.gbreve = 611;
  18916. t.onequarter = 834;
  18917. t.Scaron = 667;
  18918. t.Scommaaccent = 667;
  18919. t.Ohungarumlaut = 778;
  18920. t.degree = 400;
  18921. t.ograve = 611;
  18922. t.Ccaron = 722;
  18923. t.ugrave = 611;
  18924. t.radical = 549;
  18925. t.Dcaron = 722;
  18926. t.rcommaaccent = 389;
  18927. t.Ntilde = 722;
  18928. t.otilde = 611;
  18929. t.Rcommaaccent = 722;
  18930. t.Lcommaaccent = 611;
  18931. t.Atilde = 722;
  18932. t.Aogonek = 722;
  18933. t.Aring = 722;
  18934. t.Otilde = 778;
  18935. t.zdotaccent = 500;
  18936. t.Ecaron = 667;
  18937. t.Iogonek = 278;
  18938. t.kcommaaccent = 556;
  18939. t.minus = 584;
  18940. t.Icircumflex = 278;
  18941. t.ncaron = 611;
  18942. t.tcommaaccent = 333;
  18943. t.logicalnot = 584;
  18944. t.odieresis = 611;
  18945. t.udieresis = 611;
  18946. t.notequal = 549;
  18947. t.gcommaaccent = 611;
  18948. t.eth = 611;
  18949. t.zcaron = 500;
  18950. t.ncommaaccent = 611;
  18951. t.onesuperior = 333;
  18952. t.imacron = 278;
  18953. t.Euro = 556;
  18954. });
  18955. t["Helvetica-BoldOblique"] = getLookupTableFactory(function (t) {
  18956. t.space = 278;
  18957. t.exclam = 333;
  18958. t.quotedbl = 474;
  18959. t.numbersign = 556;
  18960. t.dollar = 556;
  18961. t.percent = 889;
  18962. t.ampersand = 722;
  18963. t.quoteright = 278;
  18964. t.parenleft = 333;
  18965. t.parenright = 333;
  18966. t.asterisk = 389;
  18967. t.plus = 584;
  18968. t.comma = 278;
  18969. t.hyphen = 333;
  18970. t.period = 278;
  18971. t.slash = 278;
  18972. t.zero = 556;
  18973. t.one = 556;
  18974. t.two = 556;
  18975. t.three = 556;
  18976. t.four = 556;
  18977. t.five = 556;
  18978. t.six = 556;
  18979. t.seven = 556;
  18980. t.eight = 556;
  18981. t.nine = 556;
  18982. t.colon = 333;
  18983. t.semicolon = 333;
  18984. t.less = 584;
  18985. t.equal = 584;
  18986. t.greater = 584;
  18987. t.question = 611;
  18988. t.at = 975;
  18989. t.A = 722;
  18990. t.B = 722;
  18991. t.C = 722;
  18992. t.D = 722;
  18993. t.E = 667;
  18994. t.F = 611;
  18995. t.G = 778;
  18996. t.H = 722;
  18997. t.I = 278;
  18998. t.J = 556;
  18999. t.K = 722;
  19000. t.L = 611;
  19001. t.M = 833;
  19002. t.N = 722;
  19003. t.O = 778;
  19004. t.P = 667;
  19005. t.Q = 778;
  19006. t.R = 722;
  19007. t.S = 667;
  19008. t.T = 611;
  19009. t.U = 722;
  19010. t.V = 667;
  19011. t.W = 944;
  19012. t.X = 667;
  19013. t.Y = 667;
  19014. t.Z = 611;
  19015. t.bracketleft = 333;
  19016. t.backslash = 278;
  19017. t.bracketright = 333;
  19018. t.asciicircum = 584;
  19019. t.underscore = 556;
  19020. t.quoteleft = 278;
  19021. t.a = 556;
  19022. t.b = 611;
  19023. t.c = 556;
  19024. t.d = 611;
  19025. t.e = 556;
  19026. t.f = 333;
  19027. t.g = 611;
  19028. t.h = 611;
  19029. t.i = 278;
  19030. t.j = 278;
  19031. t.k = 556;
  19032. t.l = 278;
  19033. t.m = 889;
  19034. t.n = 611;
  19035. t.o = 611;
  19036. t.p = 611;
  19037. t.q = 611;
  19038. t.r = 389;
  19039. t.s = 556;
  19040. t.t = 333;
  19041. t.u = 611;
  19042. t.v = 556;
  19043. t.w = 778;
  19044. t.x = 556;
  19045. t.y = 556;
  19046. t.z = 500;
  19047. t.braceleft = 389;
  19048. t.bar = 280;
  19049. t.braceright = 389;
  19050. t.asciitilde = 584;
  19051. t.exclamdown = 333;
  19052. t.cent = 556;
  19053. t.sterling = 556;
  19054. t.fraction = 167;
  19055. t.yen = 556;
  19056. t.florin = 556;
  19057. t.section = 556;
  19058. t.currency = 556;
  19059. t.quotesingle = 238;
  19060. t.quotedblleft = 500;
  19061. t.guillemotleft = 556;
  19062. t.guilsinglleft = 333;
  19063. t.guilsinglright = 333;
  19064. t.fi = 611;
  19065. t.fl = 611;
  19066. t.endash = 556;
  19067. t.dagger = 556;
  19068. t.daggerdbl = 556;
  19069. t.periodcentered = 278;
  19070. t.paragraph = 556;
  19071. t.bullet = 350;
  19072. t.quotesinglbase = 278;
  19073. t.quotedblbase = 500;
  19074. t.quotedblright = 500;
  19075. t.guillemotright = 556;
  19076. t.ellipsis = 1000;
  19077. t.perthousand = 1000;
  19078. t.questiondown = 611;
  19079. t.grave = 333;
  19080. t.acute = 333;
  19081. t.circumflex = 333;
  19082. t.tilde = 333;
  19083. t.macron = 333;
  19084. t.breve = 333;
  19085. t.dotaccent = 333;
  19086. t.dieresis = 333;
  19087. t.ring = 333;
  19088. t.cedilla = 333;
  19089. t.hungarumlaut = 333;
  19090. t.ogonek = 333;
  19091. t.caron = 333;
  19092. t.emdash = 1000;
  19093. t.AE = 1000;
  19094. t.ordfeminine = 370;
  19095. t.Lslash = 611;
  19096. t.Oslash = 778;
  19097. t.OE = 1000;
  19098. t.ordmasculine = 365;
  19099. t.ae = 889;
  19100. t.dotlessi = 278;
  19101. t.lslash = 278;
  19102. t.oslash = 611;
  19103. t.oe = 944;
  19104. t.germandbls = 611;
  19105. t.Idieresis = 278;
  19106. t.eacute = 556;
  19107. t.abreve = 556;
  19108. t.uhungarumlaut = 611;
  19109. t.ecaron = 556;
  19110. t.Ydieresis = 667;
  19111. t.divide = 584;
  19112. t.Yacute = 667;
  19113. t.Acircumflex = 722;
  19114. t.aacute = 556;
  19115. t.Ucircumflex = 722;
  19116. t.yacute = 556;
  19117. t.scommaaccent = 556;
  19118. t.ecircumflex = 556;
  19119. t.Uring = 722;
  19120. t.Udieresis = 722;
  19121. t.aogonek = 556;
  19122. t.Uacute = 722;
  19123. t.uogonek = 611;
  19124. t.Edieresis = 667;
  19125. t.Dcroat = 722;
  19126. t.commaaccent = 250;
  19127. t.copyright = 737;
  19128. t.Emacron = 667;
  19129. t.ccaron = 556;
  19130. t.aring = 556;
  19131. t.Ncommaaccent = 722;
  19132. t.lacute = 278;
  19133. t.agrave = 556;
  19134. t.Tcommaaccent = 611;
  19135. t.Cacute = 722;
  19136. t.atilde = 556;
  19137. t.Edotaccent = 667;
  19138. t.scaron = 556;
  19139. t.scedilla = 556;
  19140. t.iacute = 278;
  19141. t.lozenge = 494;
  19142. t.Rcaron = 722;
  19143. t.Gcommaaccent = 778;
  19144. t.ucircumflex = 611;
  19145. t.acircumflex = 556;
  19146. t.Amacron = 722;
  19147. t.rcaron = 389;
  19148. t.ccedilla = 556;
  19149. t.Zdotaccent = 611;
  19150. t.Thorn = 667;
  19151. t.Omacron = 778;
  19152. t.Racute = 722;
  19153. t.Sacute = 667;
  19154. t.dcaron = 743;
  19155. t.Umacron = 722;
  19156. t.uring = 611;
  19157. t.threesuperior = 333;
  19158. t.Ograve = 778;
  19159. t.Agrave = 722;
  19160. t.Abreve = 722;
  19161. t.multiply = 584;
  19162. t.uacute = 611;
  19163. t.Tcaron = 611;
  19164. t.partialdiff = 494;
  19165. t.ydieresis = 556;
  19166. t.Nacute = 722;
  19167. t.icircumflex = 278;
  19168. t.Ecircumflex = 667;
  19169. t.adieresis = 556;
  19170. t.edieresis = 556;
  19171. t.cacute = 556;
  19172. t.nacute = 611;
  19173. t.umacron = 611;
  19174. t.Ncaron = 722;
  19175. t.Iacute = 278;
  19176. t.plusminus = 584;
  19177. t.brokenbar = 280;
  19178. t.registered = 737;
  19179. t.Gbreve = 778;
  19180. t.Idotaccent = 278;
  19181. t.summation = 600;
  19182. t.Egrave = 667;
  19183. t.racute = 389;
  19184. t.omacron = 611;
  19185. t.Zacute = 611;
  19186. t.Zcaron = 611;
  19187. t.greaterequal = 549;
  19188. t.Eth = 722;
  19189. t.Ccedilla = 722;
  19190. t.lcommaaccent = 278;
  19191. t.tcaron = 389;
  19192. t.eogonek = 556;
  19193. t.Uogonek = 722;
  19194. t.Aacute = 722;
  19195. t.Adieresis = 722;
  19196. t.egrave = 556;
  19197. t.zacute = 500;
  19198. t.iogonek = 278;
  19199. t.Oacute = 778;
  19200. t.oacute = 611;
  19201. t.amacron = 556;
  19202. t.sacute = 556;
  19203. t.idieresis = 278;
  19204. t.Ocircumflex = 778;
  19205. t.Ugrave = 722;
  19206. t.Delta = 612;
  19207. t.thorn = 611;
  19208. t.twosuperior = 333;
  19209. t.Odieresis = 778;
  19210. t.mu = 611;
  19211. t.igrave = 278;
  19212. t.ohungarumlaut = 611;
  19213. t.Eogonek = 667;
  19214. t.dcroat = 611;
  19215. t.threequarters = 834;
  19216. t.Scedilla = 667;
  19217. t.lcaron = 400;
  19218. t.Kcommaaccent = 722;
  19219. t.Lacute = 611;
  19220. t.trademark = 1000;
  19221. t.edotaccent = 556;
  19222. t.Igrave = 278;
  19223. t.Imacron = 278;
  19224. t.Lcaron = 611;
  19225. t.onehalf = 834;
  19226. t.lessequal = 549;
  19227. t.ocircumflex = 611;
  19228. t.ntilde = 611;
  19229. t.Uhungarumlaut = 722;
  19230. t.Eacute = 667;
  19231. t.emacron = 556;
  19232. t.gbreve = 611;
  19233. t.onequarter = 834;
  19234. t.Scaron = 667;
  19235. t.Scommaaccent = 667;
  19236. t.Ohungarumlaut = 778;
  19237. t.degree = 400;
  19238. t.ograve = 611;
  19239. t.Ccaron = 722;
  19240. t.ugrave = 611;
  19241. t.radical = 549;
  19242. t.Dcaron = 722;
  19243. t.rcommaaccent = 389;
  19244. t.Ntilde = 722;
  19245. t.otilde = 611;
  19246. t.Rcommaaccent = 722;
  19247. t.Lcommaaccent = 611;
  19248. t.Atilde = 722;
  19249. t.Aogonek = 722;
  19250. t.Aring = 722;
  19251. t.Otilde = 778;
  19252. t.zdotaccent = 500;
  19253. t.Ecaron = 667;
  19254. t.Iogonek = 278;
  19255. t.kcommaaccent = 556;
  19256. t.minus = 584;
  19257. t.Icircumflex = 278;
  19258. t.ncaron = 611;
  19259. t.tcommaaccent = 333;
  19260. t.logicalnot = 584;
  19261. t.odieresis = 611;
  19262. t.udieresis = 611;
  19263. t.notequal = 549;
  19264. t.gcommaaccent = 611;
  19265. t.eth = 611;
  19266. t.zcaron = 500;
  19267. t.ncommaaccent = 611;
  19268. t.onesuperior = 333;
  19269. t.imacron = 278;
  19270. t.Euro = 556;
  19271. });
  19272. t["Helvetica-Oblique"] = getLookupTableFactory(function (t) {
  19273. t.space = 278;
  19274. t.exclam = 278;
  19275. t.quotedbl = 355;
  19276. t.numbersign = 556;
  19277. t.dollar = 556;
  19278. t.percent = 889;
  19279. t.ampersand = 667;
  19280. t.quoteright = 222;
  19281. t.parenleft = 333;
  19282. t.parenright = 333;
  19283. t.asterisk = 389;
  19284. t.plus = 584;
  19285. t.comma = 278;
  19286. t.hyphen = 333;
  19287. t.period = 278;
  19288. t.slash = 278;
  19289. t.zero = 556;
  19290. t.one = 556;
  19291. t.two = 556;
  19292. t.three = 556;
  19293. t.four = 556;
  19294. t.five = 556;
  19295. t.six = 556;
  19296. t.seven = 556;
  19297. t.eight = 556;
  19298. t.nine = 556;
  19299. t.colon = 278;
  19300. t.semicolon = 278;
  19301. t.less = 584;
  19302. t.equal = 584;
  19303. t.greater = 584;
  19304. t.question = 556;
  19305. t.at = 1015;
  19306. t.A = 667;
  19307. t.B = 667;
  19308. t.C = 722;
  19309. t.D = 722;
  19310. t.E = 667;
  19311. t.F = 611;
  19312. t.G = 778;
  19313. t.H = 722;
  19314. t.I = 278;
  19315. t.J = 500;
  19316. t.K = 667;
  19317. t.L = 556;
  19318. t.M = 833;
  19319. t.N = 722;
  19320. t.O = 778;
  19321. t.P = 667;
  19322. t.Q = 778;
  19323. t.R = 722;
  19324. t.S = 667;
  19325. t.T = 611;
  19326. t.U = 722;
  19327. t.V = 667;
  19328. t.W = 944;
  19329. t.X = 667;
  19330. t.Y = 667;
  19331. t.Z = 611;
  19332. t.bracketleft = 278;
  19333. t.backslash = 278;
  19334. t.bracketright = 278;
  19335. t.asciicircum = 469;
  19336. t.underscore = 556;
  19337. t.quoteleft = 222;
  19338. t.a = 556;
  19339. t.b = 556;
  19340. t.c = 500;
  19341. t.d = 556;
  19342. t.e = 556;
  19343. t.f = 278;
  19344. t.g = 556;
  19345. t.h = 556;
  19346. t.i = 222;
  19347. t.j = 222;
  19348. t.k = 500;
  19349. t.l = 222;
  19350. t.m = 833;
  19351. t.n = 556;
  19352. t.o = 556;
  19353. t.p = 556;
  19354. t.q = 556;
  19355. t.r = 333;
  19356. t.s = 500;
  19357. t.t = 278;
  19358. t.u = 556;
  19359. t.v = 500;
  19360. t.w = 722;
  19361. t.x = 500;
  19362. t.y = 500;
  19363. t.z = 500;
  19364. t.braceleft = 334;
  19365. t.bar = 260;
  19366. t.braceright = 334;
  19367. t.asciitilde = 584;
  19368. t.exclamdown = 333;
  19369. t.cent = 556;
  19370. t.sterling = 556;
  19371. t.fraction = 167;
  19372. t.yen = 556;
  19373. t.florin = 556;
  19374. t.section = 556;
  19375. t.currency = 556;
  19376. t.quotesingle = 191;
  19377. t.quotedblleft = 333;
  19378. t.guillemotleft = 556;
  19379. t.guilsinglleft = 333;
  19380. t.guilsinglright = 333;
  19381. t.fi = 500;
  19382. t.fl = 500;
  19383. t.endash = 556;
  19384. t.dagger = 556;
  19385. t.daggerdbl = 556;
  19386. t.periodcentered = 278;
  19387. t.paragraph = 537;
  19388. t.bullet = 350;
  19389. t.quotesinglbase = 222;
  19390. t.quotedblbase = 333;
  19391. t.quotedblright = 333;
  19392. t.guillemotright = 556;
  19393. t.ellipsis = 1000;
  19394. t.perthousand = 1000;
  19395. t.questiondown = 611;
  19396. t.grave = 333;
  19397. t.acute = 333;
  19398. t.circumflex = 333;
  19399. t.tilde = 333;
  19400. t.macron = 333;
  19401. t.breve = 333;
  19402. t.dotaccent = 333;
  19403. t.dieresis = 333;
  19404. t.ring = 333;
  19405. t.cedilla = 333;
  19406. t.hungarumlaut = 333;
  19407. t.ogonek = 333;
  19408. t.caron = 333;
  19409. t.emdash = 1000;
  19410. t.AE = 1000;
  19411. t.ordfeminine = 370;
  19412. t.Lslash = 556;
  19413. t.Oslash = 778;
  19414. t.OE = 1000;
  19415. t.ordmasculine = 365;
  19416. t.ae = 889;
  19417. t.dotlessi = 278;
  19418. t.lslash = 222;
  19419. t.oslash = 611;
  19420. t.oe = 944;
  19421. t.germandbls = 611;
  19422. t.Idieresis = 278;
  19423. t.eacute = 556;
  19424. t.abreve = 556;
  19425. t.uhungarumlaut = 556;
  19426. t.ecaron = 556;
  19427. t.Ydieresis = 667;
  19428. t.divide = 584;
  19429. t.Yacute = 667;
  19430. t.Acircumflex = 667;
  19431. t.aacute = 556;
  19432. t.Ucircumflex = 722;
  19433. t.yacute = 500;
  19434. t.scommaaccent = 500;
  19435. t.ecircumflex = 556;
  19436. t.Uring = 722;
  19437. t.Udieresis = 722;
  19438. t.aogonek = 556;
  19439. t.Uacute = 722;
  19440. t.uogonek = 556;
  19441. t.Edieresis = 667;
  19442. t.Dcroat = 722;
  19443. t.commaaccent = 250;
  19444. t.copyright = 737;
  19445. t.Emacron = 667;
  19446. t.ccaron = 500;
  19447. t.aring = 556;
  19448. t.Ncommaaccent = 722;
  19449. t.lacute = 222;
  19450. t.agrave = 556;
  19451. t.Tcommaaccent = 611;
  19452. t.Cacute = 722;
  19453. t.atilde = 556;
  19454. t.Edotaccent = 667;
  19455. t.scaron = 500;
  19456. t.scedilla = 500;
  19457. t.iacute = 278;
  19458. t.lozenge = 471;
  19459. t.Rcaron = 722;
  19460. t.Gcommaaccent = 778;
  19461. t.ucircumflex = 556;
  19462. t.acircumflex = 556;
  19463. t.Amacron = 667;
  19464. t.rcaron = 333;
  19465. t.ccedilla = 500;
  19466. t.Zdotaccent = 611;
  19467. t.Thorn = 667;
  19468. t.Omacron = 778;
  19469. t.Racute = 722;
  19470. t.Sacute = 667;
  19471. t.dcaron = 643;
  19472. t.Umacron = 722;
  19473. t.uring = 556;
  19474. t.threesuperior = 333;
  19475. t.Ograve = 778;
  19476. t.Agrave = 667;
  19477. t.Abreve = 667;
  19478. t.multiply = 584;
  19479. t.uacute = 556;
  19480. t.Tcaron = 611;
  19481. t.partialdiff = 476;
  19482. t.ydieresis = 500;
  19483. t.Nacute = 722;
  19484. t.icircumflex = 278;
  19485. t.Ecircumflex = 667;
  19486. t.adieresis = 556;
  19487. t.edieresis = 556;
  19488. t.cacute = 500;
  19489. t.nacute = 556;
  19490. t.umacron = 556;
  19491. t.Ncaron = 722;
  19492. t.Iacute = 278;
  19493. t.plusminus = 584;
  19494. t.brokenbar = 260;
  19495. t.registered = 737;
  19496. t.Gbreve = 778;
  19497. t.Idotaccent = 278;
  19498. t.summation = 600;
  19499. t.Egrave = 667;
  19500. t.racute = 333;
  19501. t.omacron = 556;
  19502. t.Zacute = 611;
  19503. t.Zcaron = 611;
  19504. t.greaterequal = 549;
  19505. t.Eth = 722;
  19506. t.Ccedilla = 722;
  19507. t.lcommaaccent = 222;
  19508. t.tcaron = 317;
  19509. t.eogonek = 556;
  19510. t.Uogonek = 722;
  19511. t.Aacute = 667;
  19512. t.Adieresis = 667;
  19513. t.egrave = 556;
  19514. t.zacute = 500;
  19515. t.iogonek = 222;
  19516. t.Oacute = 778;
  19517. t.oacute = 556;
  19518. t.amacron = 556;
  19519. t.sacute = 500;
  19520. t.idieresis = 278;
  19521. t.Ocircumflex = 778;
  19522. t.Ugrave = 722;
  19523. t.Delta = 612;
  19524. t.thorn = 556;
  19525. t.twosuperior = 333;
  19526. t.Odieresis = 778;
  19527. t.mu = 556;
  19528. t.igrave = 278;
  19529. t.ohungarumlaut = 556;
  19530. t.Eogonek = 667;
  19531. t.dcroat = 556;
  19532. t.threequarters = 834;
  19533. t.Scedilla = 667;
  19534. t.lcaron = 299;
  19535. t.Kcommaaccent = 667;
  19536. t.Lacute = 556;
  19537. t.trademark = 1000;
  19538. t.edotaccent = 556;
  19539. t.Igrave = 278;
  19540. t.Imacron = 278;
  19541. t.Lcaron = 556;
  19542. t.onehalf = 834;
  19543. t.lessequal = 549;
  19544. t.ocircumflex = 556;
  19545. t.ntilde = 556;
  19546. t.Uhungarumlaut = 722;
  19547. t.Eacute = 667;
  19548. t.emacron = 556;
  19549. t.gbreve = 556;
  19550. t.onequarter = 834;
  19551. t.Scaron = 667;
  19552. t.Scommaaccent = 667;
  19553. t.Ohungarumlaut = 778;
  19554. t.degree = 400;
  19555. t.ograve = 556;
  19556. t.Ccaron = 722;
  19557. t.ugrave = 556;
  19558. t.radical = 453;
  19559. t.Dcaron = 722;
  19560. t.rcommaaccent = 333;
  19561. t.Ntilde = 722;
  19562. t.otilde = 556;
  19563. t.Rcommaaccent = 722;
  19564. t.Lcommaaccent = 556;
  19565. t.Atilde = 667;
  19566. t.Aogonek = 667;
  19567. t.Aring = 667;
  19568. t.Otilde = 778;
  19569. t.zdotaccent = 500;
  19570. t.Ecaron = 667;
  19571. t.Iogonek = 278;
  19572. t.kcommaaccent = 500;
  19573. t.minus = 584;
  19574. t.Icircumflex = 278;
  19575. t.ncaron = 556;
  19576. t.tcommaaccent = 278;
  19577. t.logicalnot = 584;
  19578. t.odieresis = 556;
  19579. t.udieresis = 556;
  19580. t.notequal = 549;
  19581. t.gcommaaccent = 556;
  19582. t.eth = 556;
  19583. t.zcaron = 500;
  19584. t.ncommaaccent = 556;
  19585. t.onesuperior = 333;
  19586. t.imacron = 278;
  19587. t.Euro = 556;
  19588. });
  19589. t.Symbol = getLookupTableFactory(function (t) {
  19590. t.space = 250;
  19591. t.exclam = 333;
  19592. t.universal = 713;
  19593. t.numbersign = 500;
  19594. t.existential = 549;
  19595. t.percent = 833;
  19596. t.ampersand = 778;
  19597. t.suchthat = 439;
  19598. t.parenleft = 333;
  19599. t.parenright = 333;
  19600. t.asteriskmath = 500;
  19601. t.plus = 549;
  19602. t.comma = 250;
  19603. t.minus = 549;
  19604. t.period = 250;
  19605. t.slash = 278;
  19606. t.zero = 500;
  19607. t.one = 500;
  19608. t.two = 500;
  19609. t.three = 500;
  19610. t.four = 500;
  19611. t.five = 500;
  19612. t.six = 500;
  19613. t.seven = 500;
  19614. t.eight = 500;
  19615. t.nine = 500;
  19616. t.colon = 278;
  19617. t.semicolon = 278;
  19618. t.less = 549;
  19619. t.equal = 549;
  19620. t.greater = 549;
  19621. t.question = 444;
  19622. t.congruent = 549;
  19623. t.Alpha = 722;
  19624. t.Beta = 667;
  19625. t.Chi = 722;
  19626. t.Delta = 612;
  19627. t.Epsilon = 611;
  19628. t.Phi = 763;
  19629. t.Gamma = 603;
  19630. t.Eta = 722;
  19631. t.Iota = 333;
  19632. t.theta1 = 631;
  19633. t.Kappa = 722;
  19634. t.Lambda = 686;
  19635. t.Mu = 889;
  19636. t.Nu = 722;
  19637. t.Omicron = 722;
  19638. t.Pi = 768;
  19639. t.Theta = 741;
  19640. t.Rho = 556;
  19641. t.Sigma = 592;
  19642. t.Tau = 611;
  19643. t.Upsilon = 690;
  19644. t.sigma1 = 439;
  19645. t.Omega = 768;
  19646. t.Xi = 645;
  19647. t.Psi = 795;
  19648. t.Zeta = 611;
  19649. t.bracketleft = 333;
  19650. t.therefore = 863;
  19651. t.bracketright = 333;
  19652. t.perpendicular = 658;
  19653. t.underscore = 500;
  19654. t.radicalex = 500;
  19655. t.alpha = 631;
  19656. t.beta = 549;
  19657. t.chi = 549;
  19658. t.delta = 494;
  19659. t.epsilon = 439;
  19660. t.phi = 521;
  19661. t.gamma = 411;
  19662. t.eta = 603;
  19663. t.iota = 329;
  19664. t.phi1 = 603;
  19665. t.kappa = 549;
  19666. t.lambda = 549;
  19667. t.mu = 576;
  19668. t.nu = 521;
  19669. t.omicron = 549;
  19670. t.pi = 549;
  19671. t.theta = 521;
  19672. t.rho = 549;
  19673. t.sigma = 603;
  19674. t.tau = 439;
  19675. t.upsilon = 576;
  19676. t.omega1 = 713;
  19677. t.omega = 686;
  19678. t.xi = 493;
  19679. t.psi = 686;
  19680. t.zeta = 494;
  19681. t.braceleft = 480;
  19682. t.bar = 200;
  19683. t.braceright = 480;
  19684. t.similar = 549;
  19685. t.Euro = 750;
  19686. t.Upsilon1 = 620;
  19687. t.minute = 247;
  19688. t.lessequal = 549;
  19689. t.fraction = 167;
  19690. t.infinity = 713;
  19691. t.florin = 500;
  19692. t.club = 753;
  19693. t.diamond = 753;
  19694. t.heart = 753;
  19695. t.spade = 753;
  19696. t.arrowboth = 1042;
  19697. t.arrowleft = 987;
  19698. t.arrowup = 603;
  19699. t.arrowright = 987;
  19700. t.arrowdown = 603;
  19701. t.degree = 400;
  19702. t.plusminus = 549;
  19703. t.second = 411;
  19704. t.greaterequal = 549;
  19705. t.multiply = 549;
  19706. t.proportional = 713;
  19707. t.partialdiff = 494;
  19708. t.bullet = 460;
  19709. t.divide = 549;
  19710. t.notequal = 549;
  19711. t.equivalence = 549;
  19712. t.approxequal = 549;
  19713. t.ellipsis = 1000;
  19714. t.arrowvertex = 603;
  19715. t.arrowhorizex = 1000;
  19716. t.carriagereturn = 658;
  19717. t.aleph = 823;
  19718. t.Ifraktur = 686;
  19719. t.Rfraktur = 795;
  19720. t.weierstrass = 987;
  19721. t.circlemultiply = 768;
  19722. t.circleplus = 768;
  19723. t.emptyset = 823;
  19724. t.intersection = 768;
  19725. t.union = 768;
  19726. t.propersuperset = 713;
  19727. t.reflexsuperset = 713;
  19728. t.notsubset = 713;
  19729. t.propersubset = 713;
  19730. t.reflexsubset = 713;
  19731. t.element = 713;
  19732. t.notelement = 713;
  19733. t.angle = 768;
  19734. t.gradient = 713;
  19735. t.registerserif = 790;
  19736. t.copyrightserif = 790;
  19737. t.trademarkserif = 890;
  19738. t.product = 823;
  19739. t.radical = 549;
  19740. t.dotmath = 250;
  19741. t.logicalnot = 713;
  19742. t.logicaland = 603;
  19743. t.logicalor = 603;
  19744. t.arrowdblboth = 1042;
  19745. t.arrowdblleft = 987;
  19746. t.arrowdblup = 603;
  19747. t.arrowdblright = 987;
  19748. t.arrowdbldown = 603;
  19749. t.lozenge = 494;
  19750. t.angleleft = 329;
  19751. t.registersans = 790;
  19752. t.copyrightsans = 790;
  19753. t.trademarksans = 786;
  19754. t.summation = 713;
  19755. t.parenlefttp = 384;
  19756. t.parenleftex = 384;
  19757. t.parenleftbt = 384;
  19758. t.bracketlefttp = 384;
  19759. t.bracketleftex = 384;
  19760. t.bracketleftbt = 384;
  19761. t.bracelefttp = 494;
  19762. t.braceleftmid = 494;
  19763. t.braceleftbt = 494;
  19764. t.braceex = 494;
  19765. t.angleright = 329;
  19766. t.integral = 274;
  19767. t.integraltp = 686;
  19768. t.integralex = 686;
  19769. t.integralbt = 686;
  19770. t.parenrighttp = 384;
  19771. t.parenrightex = 384;
  19772. t.parenrightbt = 384;
  19773. t.bracketrighttp = 384;
  19774. t.bracketrightex = 384;
  19775. t.bracketrightbt = 384;
  19776. t.bracerighttp = 494;
  19777. t.bracerightmid = 494;
  19778. t.bracerightbt = 494;
  19779. t.apple = 790;
  19780. });
  19781. t["Times-Roman"] = getLookupTableFactory(function (t) {
  19782. t.space = 250;
  19783. t.exclam = 333;
  19784. t.quotedbl = 408;
  19785. t.numbersign = 500;
  19786. t.dollar = 500;
  19787. t.percent = 833;
  19788. t.ampersand = 778;
  19789. t.quoteright = 333;
  19790. t.parenleft = 333;
  19791. t.parenright = 333;
  19792. t.asterisk = 500;
  19793. t.plus = 564;
  19794. t.comma = 250;
  19795. t.hyphen = 333;
  19796. t.period = 250;
  19797. t.slash = 278;
  19798. t.zero = 500;
  19799. t.one = 500;
  19800. t.two = 500;
  19801. t.three = 500;
  19802. t.four = 500;
  19803. t.five = 500;
  19804. t.six = 500;
  19805. t.seven = 500;
  19806. t.eight = 500;
  19807. t.nine = 500;
  19808. t.colon = 278;
  19809. t.semicolon = 278;
  19810. t.less = 564;
  19811. t.equal = 564;
  19812. t.greater = 564;
  19813. t.question = 444;
  19814. t.at = 921;
  19815. t.A = 722;
  19816. t.B = 667;
  19817. t.C = 667;
  19818. t.D = 722;
  19819. t.E = 611;
  19820. t.F = 556;
  19821. t.G = 722;
  19822. t.H = 722;
  19823. t.I = 333;
  19824. t.J = 389;
  19825. t.K = 722;
  19826. t.L = 611;
  19827. t.M = 889;
  19828. t.N = 722;
  19829. t.O = 722;
  19830. t.P = 556;
  19831. t.Q = 722;
  19832. t.R = 667;
  19833. t.S = 556;
  19834. t.T = 611;
  19835. t.U = 722;
  19836. t.V = 722;
  19837. t.W = 944;
  19838. t.X = 722;
  19839. t.Y = 722;
  19840. t.Z = 611;
  19841. t.bracketleft = 333;
  19842. t.backslash = 278;
  19843. t.bracketright = 333;
  19844. t.asciicircum = 469;
  19845. t.underscore = 500;
  19846. t.quoteleft = 333;
  19847. t.a = 444;
  19848. t.b = 500;
  19849. t.c = 444;
  19850. t.d = 500;
  19851. t.e = 444;
  19852. t.f = 333;
  19853. t.g = 500;
  19854. t.h = 500;
  19855. t.i = 278;
  19856. t.j = 278;
  19857. t.k = 500;
  19858. t.l = 278;
  19859. t.m = 778;
  19860. t.n = 500;
  19861. t.o = 500;
  19862. t.p = 500;
  19863. t.q = 500;
  19864. t.r = 333;
  19865. t.s = 389;
  19866. t.t = 278;
  19867. t.u = 500;
  19868. t.v = 500;
  19869. t.w = 722;
  19870. t.x = 500;
  19871. t.y = 500;
  19872. t.z = 444;
  19873. t.braceleft = 480;
  19874. t.bar = 200;
  19875. t.braceright = 480;
  19876. t.asciitilde = 541;
  19877. t.exclamdown = 333;
  19878. t.cent = 500;
  19879. t.sterling = 500;
  19880. t.fraction = 167;
  19881. t.yen = 500;
  19882. t.florin = 500;
  19883. t.section = 500;
  19884. t.currency = 500;
  19885. t.quotesingle = 180;
  19886. t.quotedblleft = 444;
  19887. t.guillemotleft = 500;
  19888. t.guilsinglleft = 333;
  19889. t.guilsinglright = 333;
  19890. t.fi = 556;
  19891. t.fl = 556;
  19892. t.endash = 500;
  19893. t.dagger = 500;
  19894. t.daggerdbl = 500;
  19895. t.periodcentered = 250;
  19896. t.paragraph = 453;
  19897. t.bullet = 350;
  19898. t.quotesinglbase = 333;
  19899. t.quotedblbase = 444;
  19900. t.quotedblright = 444;
  19901. t.guillemotright = 500;
  19902. t.ellipsis = 1000;
  19903. t.perthousand = 1000;
  19904. t.questiondown = 444;
  19905. t.grave = 333;
  19906. t.acute = 333;
  19907. t.circumflex = 333;
  19908. t.tilde = 333;
  19909. t.macron = 333;
  19910. t.breve = 333;
  19911. t.dotaccent = 333;
  19912. t.dieresis = 333;
  19913. t.ring = 333;
  19914. t.cedilla = 333;
  19915. t.hungarumlaut = 333;
  19916. t.ogonek = 333;
  19917. t.caron = 333;
  19918. t.emdash = 1000;
  19919. t.AE = 889;
  19920. t.ordfeminine = 276;
  19921. t.Lslash = 611;
  19922. t.Oslash = 722;
  19923. t.OE = 889;
  19924. t.ordmasculine = 310;
  19925. t.ae = 667;
  19926. t.dotlessi = 278;
  19927. t.lslash = 278;
  19928. t.oslash = 500;
  19929. t.oe = 722;
  19930. t.germandbls = 500;
  19931. t.Idieresis = 333;
  19932. t.eacute = 444;
  19933. t.abreve = 444;
  19934. t.uhungarumlaut = 500;
  19935. t.ecaron = 444;
  19936. t.Ydieresis = 722;
  19937. t.divide = 564;
  19938. t.Yacute = 722;
  19939. t.Acircumflex = 722;
  19940. t.aacute = 444;
  19941. t.Ucircumflex = 722;
  19942. t.yacute = 500;
  19943. t.scommaaccent = 389;
  19944. t.ecircumflex = 444;
  19945. t.Uring = 722;
  19946. t.Udieresis = 722;
  19947. t.aogonek = 444;
  19948. t.Uacute = 722;
  19949. t.uogonek = 500;
  19950. t.Edieresis = 611;
  19951. t.Dcroat = 722;
  19952. t.commaaccent = 250;
  19953. t.copyright = 760;
  19954. t.Emacron = 611;
  19955. t.ccaron = 444;
  19956. t.aring = 444;
  19957. t.Ncommaaccent = 722;
  19958. t.lacute = 278;
  19959. t.agrave = 444;
  19960. t.Tcommaaccent = 611;
  19961. t.Cacute = 667;
  19962. t.atilde = 444;
  19963. t.Edotaccent = 611;
  19964. t.scaron = 389;
  19965. t.scedilla = 389;
  19966. t.iacute = 278;
  19967. t.lozenge = 471;
  19968. t.Rcaron = 667;
  19969. t.Gcommaaccent = 722;
  19970. t.ucircumflex = 500;
  19971. t.acircumflex = 444;
  19972. t.Amacron = 722;
  19973. t.rcaron = 333;
  19974. t.ccedilla = 444;
  19975. t.Zdotaccent = 611;
  19976. t.Thorn = 556;
  19977. t.Omacron = 722;
  19978. t.Racute = 667;
  19979. t.Sacute = 556;
  19980. t.dcaron = 588;
  19981. t.Umacron = 722;
  19982. t.uring = 500;
  19983. t.threesuperior = 300;
  19984. t.Ograve = 722;
  19985. t.Agrave = 722;
  19986. t.Abreve = 722;
  19987. t.multiply = 564;
  19988. t.uacute = 500;
  19989. t.Tcaron = 611;
  19990. t.partialdiff = 476;
  19991. t.ydieresis = 500;
  19992. t.Nacute = 722;
  19993. t.icircumflex = 278;
  19994. t.Ecircumflex = 611;
  19995. t.adieresis = 444;
  19996. t.edieresis = 444;
  19997. t.cacute = 444;
  19998. t.nacute = 500;
  19999. t.umacron = 500;
  20000. t.Ncaron = 722;
  20001. t.Iacute = 333;
  20002. t.plusminus = 564;
  20003. t.brokenbar = 200;
  20004. t.registered = 760;
  20005. t.Gbreve = 722;
  20006. t.Idotaccent = 333;
  20007. t.summation = 600;
  20008. t.Egrave = 611;
  20009. t.racute = 333;
  20010. t.omacron = 500;
  20011. t.Zacute = 611;
  20012. t.Zcaron = 611;
  20013. t.greaterequal = 549;
  20014. t.Eth = 722;
  20015. t.Ccedilla = 667;
  20016. t.lcommaaccent = 278;
  20017. t.tcaron = 326;
  20018. t.eogonek = 444;
  20019. t.Uogonek = 722;
  20020. t.Aacute = 722;
  20021. t.Adieresis = 722;
  20022. t.egrave = 444;
  20023. t.zacute = 444;
  20024. t.iogonek = 278;
  20025. t.Oacute = 722;
  20026. t.oacute = 500;
  20027. t.amacron = 444;
  20028. t.sacute = 389;
  20029. t.idieresis = 278;
  20030. t.Ocircumflex = 722;
  20031. t.Ugrave = 722;
  20032. t.Delta = 612;
  20033. t.thorn = 500;
  20034. t.twosuperior = 300;
  20035. t.Odieresis = 722;
  20036. t.mu = 500;
  20037. t.igrave = 278;
  20038. t.ohungarumlaut = 500;
  20039. t.Eogonek = 611;
  20040. t.dcroat = 500;
  20041. t.threequarters = 750;
  20042. t.Scedilla = 556;
  20043. t.lcaron = 344;
  20044. t.Kcommaaccent = 722;
  20045. t.Lacute = 611;
  20046. t.trademark = 980;
  20047. t.edotaccent = 444;
  20048. t.Igrave = 333;
  20049. t.Imacron = 333;
  20050. t.Lcaron = 611;
  20051. t.onehalf = 750;
  20052. t.lessequal = 549;
  20053. t.ocircumflex = 500;
  20054. t.ntilde = 500;
  20055. t.Uhungarumlaut = 722;
  20056. t.Eacute = 611;
  20057. t.emacron = 444;
  20058. t.gbreve = 500;
  20059. t.onequarter = 750;
  20060. t.Scaron = 556;
  20061. t.Scommaaccent = 556;
  20062. t.Ohungarumlaut = 722;
  20063. t.degree = 400;
  20064. t.ograve = 500;
  20065. t.Ccaron = 667;
  20066. t.ugrave = 500;
  20067. t.radical = 453;
  20068. t.Dcaron = 722;
  20069. t.rcommaaccent = 333;
  20070. t.Ntilde = 722;
  20071. t.otilde = 500;
  20072. t.Rcommaaccent = 667;
  20073. t.Lcommaaccent = 611;
  20074. t.Atilde = 722;
  20075. t.Aogonek = 722;
  20076. t.Aring = 722;
  20077. t.Otilde = 722;
  20078. t.zdotaccent = 444;
  20079. t.Ecaron = 611;
  20080. t.Iogonek = 333;
  20081. t.kcommaaccent = 500;
  20082. t.minus = 564;
  20083. t.Icircumflex = 333;
  20084. t.ncaron = 500;
  20085. t.tcommaaccent = 278;
  20086. t.logicalnot = 564;
  20087. t.odieresis = 500;
  20088. t.udieresis = 500;
  20089. t.notequal = 549;
  20090. t.gcommaaccent = 500;
  20091. t.eth = 500;
  20092. t.zcaron = 444;
  20093. t.ncommaaccent = 500;
  20094. t.onesuperior = 300;
  20095. t.imacron = 278;
  20096. t.Euro = 500;
  20097. });
  20098. t["Times-Bold"] = getLookupTableFactory(function (t) {
  20099. t.space = 250;
  20100. t.exclam = 333;
  20101. t.quotedbl = 555;
  20102. t.numbersign = 500;
  20103. t.dollar = 500;
  20104. t.percent = 1000;
  20105. t.ampersand = 833;
  20106. t.quoteright = 333;
  20107. t.parenleft = 333;
  20108. t.parenright = 333;
  20109. t.asterisk = 500;
  20110. t.plus = 570;
  20111. t.comma = 250;
  20112. t.hyphen = 333;
  20113. t.period = 250;
  20114. t.slash = 278;
  20115. t.zero = 500;
  20116. t.one = 500;
  20117. t.two = 500;
  20118. t.three = 500;
  20119. t.four = 500;
  20120. t.five = 500;
  20121. t.six = 500;
  20122. t.seven = 500;
  20123. t.eight = 500;
  20124. t.nine = 500;
  20125. t.colon = 333;
  20126. t.semicolon = 333;
  20127. t.less = 570;
  20128. t.equal = 570;
  20129. t.greater = 570;
  20130. t.question = 500;
  20131. t.at = 930;
  20132. t.A = 722;
  20133. t.B = 667;
  20134. t.C = 722;
  20135. t.D = 722;
  20136. t.E = 667;
  20137. t.F = 611;
  20138. t.G = 778;
  20139. t.H = 778;
  20140. t.I = 389;
  20141. t.J = 500;
  20142. t.K = 778;
  20143. t.L = 667;
  20144. t.M = 944;
  20145. t.N = 722;
  20146. t.O = 778;
  20147. t.P = 611;
  20148. t.Q = 778;
  20149. t.R = 722;
  20150. t.S = 556;
  20151. t.T = 667;
  20152. t.U = 722;
  20153. t.V = 722;
  20154. t.W = 1000;
  20155. t.X = 722;
  20156. t.Y = 722;
  20157. t.Z = 667;
  20158. t.bracketleft = 333;
  20159. t.backslash = 278;
  20160. t.bracketright = 333;
  20161. t.asciicircum = 581;
  20162. t.underscore = 500;
  20163. t.quoteleft = 333;
  20164. t.a = 500;
  20165. t.b = 556;
  20166. t.c = 444;
  20167. t.d = 556;
  20168. t.e = 444;
  20169. t.f = 333;
  20170. t.g = 500;
  20171. t.h = 556;
  20172. t.i = 278;
  20173. t.j = 333;
  20174. t.k = 556;
  20175. t.l = 278;
  20176. t.m = 833;
  20177. t.n = 556;
  20178. t.o = 500;
  20179. t.p = 556;
  20180. t.q = 556;
  20181. t.r = 444;
  20182. t.s = 389;
  20183. t.t = 333;
  20184. t.u = 556;
  20185. t.v = 500;
  20186. t.w = 722;
  20187. t.x = 500;
  20188. t.y = 500;
  20189. t.z = 444;
  20190. t.braceleft = 394;
  20191. t.bar = 220;
  20192. t.braceright = 394;
  20193. t.asciitilde = 520;
  20194. t.exclamdown = 333;
  20195. t.cent = 500;
  20196. t.sterling = 500;
  20197. t.fraction = 167;
  20198. t.yen = 500;
  20199. t.florin = 500;
  20200. t.section = 500;
  20201. t.currency = 500;
  20202. t.quotesingle = 278;
  20203. t.quotedblleft = 500;
  20204. t.guillemotleft = 500;
  20205. t.guilsinglleft = 333;
  20206. t.guilsinglright = 333;
  20207. t.fi = 556;
  20208. t.fl = 556;
  20209. t.endash = 500;
  20210. t.dagger = 500;
  20211. t.daggerdbl = 500;
  20212. t.periodcentered = 250;
  20213. t.paragraph = 540;
  20214. t.bullet = 350;
  20215. t.quotesinglbase = 333;
  20216. t.quotedblbase = 500;
  20217. t.quotedblright = 500;
  20218. t.guillemotright = 500;
  20219. t.ellipsis = 1000;
  20220. t.perthousand = 1000;
  20221. t.questiondown = 500;
  20222. t.grave = 333;
  20223. t.acute = 333;
  20224. t.circumflex = 333;
  20225. t.tilde = 333;
  20226. t.macron = 333;
  20227. t.breve = 333;
  20228. t.dotaccent = 333;
  20229. t.dieresis = 333;
  20230. t.ring = 333;
  20231. t.cedilla = 333;
  20232. t.hungarumlaut = 333;
  20233. t.ogonek = 333;
  20234. t.caron = 333;
  20235. t.emdash = 1000;
  20236. t.AE = 1000;
  20237. t.ordfeminine = 300;
  20238. t.Lslash = 667;
  20239. t.Oslash = 778;
  20240. t.OE = 1000;
  20241. t.ordmasculine = 330;
  20242. t.ae = 722;
  20243. t.dotlessi = 278;
  20244. t.lslash = 278;
  20245. t.oslash = 500;
  20246. t.oe = 722;
  20247. t.germandbls = 556;
  20248. t.Idieresis = 389;
  20249. t.eacute = 444;
  20250. t.abreve = 500;
  20251. t.uhungarumlaut = 556;
  20252. t.ecaron = 444;
  20253. t.Ydieresis = 722;
  20254. t.divide = 570;
  20255. t.Yacute = 722;
  20256. t.Acircumflex = 722;
  20257. t.aacute = 500;
  20258. t.Ucircumflex = 722;
  20259. t.yacute = 500;
  20260. t.scommaaccent = 389;
  20261. t.ecircumflex = 444;
  20262. t.Uring = 722;
  20263. t.Udieresis = 722;
  20264. t.aogonek = 500;
  20265. t.Uacute = 722;
  20266. t.uogonek = 556;
  20267. t.Edieresis = 667;
  20268. t.Dcroat = 722;
  20269. t.commaaccent = 250;
  20270. t.copyright = 747;
  20271. t.Emacron = 667;
  20272. t.ccaron = 444;
  20273. t.aring = 500;
  20274. t.Ncommaaccent = 722;
  20275. t.lacute = 278;
  20276. t.agrave = 500;
  20277. t.Tcommaaccent = 667;
  20278. t.Cacute = 722;
  20279. t.atilde = 500;
  20280. t.Edotaccent = 667;
  20281. t.scaron = 389;
  20282. t.scedilla = 389;
  20283. t.iacute = 278;
  20284. t.lozenge = 494;
  20285. t.Rcaron = 722;
  20286. t.Gcommaaccent = 778;
  20287. t.ucircumflex = 556;
  20288. t.acircumflex = 500;
  20289. t.Amacron = 722;
  20290. t.rcaron = 444;
  20291. t.ccedilla = 444;
  20292. t.Zdotaccent = 667;
  20293. t.Thorn = 611;
  20294. t.Omacron = 778;
  20295. t.Racute = 722;
  20296. t.Sacute = 556;
  20297. t.dcaron = 672;
  20298. t.Umacron = 722;
  20299. t.uring = 556;
  20300. t.threesuperior = 300;
  20301. t.Ograve = 778;
  20302. t.Agrave = 722;
  20303. t.Abreve = 722;
  20304. t.multiply = 570;
  20305. t.uacute = 556;
  20306. t.Tcaron = 667;
  20307. t.partialdiff = 494;
  20308. t.ydieresis = 500;
  20309. t.Nacute = 722;
  20310. t.icircumflex = 278;
  20311. t.Ecircumflex = 667;
  20312. t.adieresis = 500;
  20313. t.edieresis = 444;
  20314. t.cacute = 444;
  20315. t.nacute = 556;
  20316. t.umacron = 556;
  20317. t.Ncaron = 722;
  20318. t.Iacute = 389;
  20319. t.plusminus = 570;
  20320. t.brokenbar = 220;
  20321. t.registered = 747;
  20322. t.Gbreve = 778;
  20323. t.Idotaccent = 389;
  20324. t.summation = 600;
  20325. t.Egrave = 667;
  20326. t.racute = 444;
  20327. t.omacron = 500;
  20328. t.Zacute = 667;
  20329. t.Zcaron = 667;
  20330. t.greaterequal = 549;
  20331. t.Eth = 722;
  20332. t.Ccedilla = 722;
  20333. t.lcommaaccent = 278;
  20334. t.tcaron = 416;
  20335. t.eogonek = 444;
  20336. t.Uogonek = 722;
  20337. t.Aacute = 722;
  20338. t.Adieresis = 722;
  20339. t.egrave = 444;
  20340. t.zacute = 444;
  20341. t.iogonek = 278;
  20342. t.Oacute = 778;
  20343. t.oacute = 500;
  20344. t.amacron = 500;
  20345. t.sacute = 389;
  20346. t.idieresis = 278;
  20347. t.Ocircumflex = 778;
  20348. t.Ugrave = 722;
  20349. t.Delta = 612;
  20350. t.thorn = 556;
  20351. t.twosuperior = 300;
  20352. t.Odieresis = 778;
  20353. t.mu = 556;
  20354. t.igrave = 278;
  20355. t.ohungarumlaut = 500;
  20356. t.Eogonek = 667;
  20357. t.dcroat = 556;
  20358. t.threequarters = 750;
  20359. t.Scedilla = 556;
  20360. t.lcaron = 394;
  20361. t.Kcommaaccent = 778;
  20362. t.Lacute = 667;
  20363. t.trademark = 1000;
  20364. t.edotaccent = 444;
  20365. t.Igrave = 389;
  20366. t.Imacron = 389;
  20367. t.Lcaron = 667;
  20368. t.onehalf = 750;
  20369. t.lessequal = 549;
  20370. t.ocircumflex = 500;
  20371. t.ntilde = 556;
  20372. t.Uhungarumlaut = 722;
  20373. t.Eacute = 667;
  20374. t.emacron = 444;
  20375. t.gbreve = 500;
  20376. t.onequarter = 750;
  20377. t.Scaron = 556;
  20378. t.Scommaaccent = 556;
  20379. t.Ohungarumlaut = 778;
  20380. t.degree = 400;
  20381. t.ograve = 500;
  20382. t.Ccaron = 722;
  20383. t.ugrave = 556;
  20384. t.radical = 549;
  20385. t.Dcaron = 722;
  20386. t.rcommaaccent = 444;
  20387. t.Ntilde = 722;
  20388. t.otilde = 500;
  20389. t.Rcommaaccent = 722;
  20390. t.Lcommaaccent = 667;
  20391. t.Atilde = 722;
  20392. t.Aogonek = 722;
  20393. t.Aring = 722;
  20394. t.Otilde = 778;
  20395. t.zdotaccent = 444;
  20396. t.Ecaron = 667;
  20397. t.Iogonek = 389;
  20398. t.kcommaaccent = 556;
  20399. t.minus = 570;
  20400. t.Icircumflex = 389;
  20401. t.ncaron = 556;
  20402. t.tcommaaccent = 333;
  20403. t.logicalnot = 570;
  20404. t.odieresis = 500;
  20405. t.udieresis = 556;
  20406. t.notequal = 549;
  20407. t.gcommaaccent = 500;
  20408. t.eth = 500;
  20409. t.zcaron = 444;
  20410. t.ncommaaccent = 556;
  20411. t.onesuperior = 300;
  20412. t.imacron = 278;
  20413. t.Euro = 500;
  20414. });
  20415. t["Times-BoldItalic"] = getLookupTableFactory(function (t) {
  20416. t.space = 250;
  20417. t.exclam = 389;
  20418. t.quotedbl = 555;
  20419. t.numbersign = 500;
  20420. t.dollar = 500;
  20421. t.percent = 833;
  20422. t.ampersand = 778;
  20423. t.quoteright = 333;
  20424. t.parenleft = 333;
  20425. t.parenright = 333;
  20426. t.asterisk = 500;
  20427. t.plus = 570;
  20428. t.comma = 250;
  20429. t.hyphen = 333;
  20430. t.period = 250;
  20431. t.slash = 278;
  20432. t.zero = 500;
  20433. t.one = 500;
  20434. t.two = 500;
  20435. t.three = 500;
  20436. t.four = 500;
  20437. t.five = 500;
  20438. t.six = 500;
  20439. t.seven = 500;
  20440. t.eight = 500;
  20441. t.nine = 500;
  20442. t.colon = 333;
  20443. t.semicolon = 333;
  20444. t.less = 570;
  20445. t.equal = 570;
  20446. t.greater = 570;
  20447. t.question = 500;
  20448. t.at = 832;
  20449. t.A = 667;
  20450. t.B = 667;
  20451. t.C = 667;
  20452. t.D = 722;
  20453. t.E = 667;
  20454. t.F = 667;
  20455. t.G = 722;
  20456. t.H = 778;
  20457. t.I = 389;
  20458. t.J = 500;
  20459. t.K = 667;
  20460. t.L = 611;
  20461. t.M = 889;
  20462. t.N = 722;
  20463. t.O = 722;
  20464. t.P = 611;
  20465. t.Q = 722;
  20466. t.R = 667;
  20467. t.S = 556;
  20468. t.T = 611;
  20469. t.U = 722;
  20470. t.V = 667;
  20471. t.W = 889;
  20472. t.X = 667;
  20473. t.Y = 611;
  20474. t.Z = 611;
  20475. t.bracketleft = 333;
  20476. t.backslash = 278;
  20477. t.bracketright = 333;
  20478. t.asciicircum = 570;
  20479. t.underscore = 500;
  20480. t.quoteleft = 333;
  20481. t.a = 500;
  20482. t.b = 500;
  20483. t.c = 444;
  20484. t.d = 500;
  20485. t.e = 444;
  20486. t.f = 333;
  20487. t.g = 500;
  20488. t.h = 556;
  20489. t.i = 278;
  20490. t.j = 278;
  20491. t.k = 500;
  20492. t.l = 278;
  20493. t.m = 778;
  20494. t.n = 556;
  20495. t.o = 500;
  20496. t.p = 500;
  20497. t.q = 500;
  20498. t.r = 389;
  20499. t.s = 389;
  20500. t.t = 278;
  20501. t.u = 556;
  20502. t.v = 444;
  20503. t.w = 667;
  20504. t.x = 500;
  20505. t.y = 444;
  20506. t.z = 389;
  20507. t.braceleft = 348;
  20508. t.bar = 220;
  20509. t.braceright = 348;
  20510. t.asciitilde = 570;
  20511. t.exclamdown = 389;
  20512. t.cent = 500;
  20513. t.sterling = 500;
  20514. t.fraction = 167;
  20515. t.yen = 500;
  20516. t.florin = 500;
  20517. t.section = 500;
  20518. t.currency = 500;
  20519. t.quotesingle = 278;
  20520. t.quotedblleft = 500;
  20521. t.guillemotleft = 500;
  20522. t.guilsinglleft = 333;
  20523. t.guilsinglright = 333;
  20524. t.fi = 556;
  20525. t.fl = 556;
  20526. t.endash = 500;
  20527. t.dagger = 500;
  20528. t.daggerdbl = 500;
  20529. t.periodcentered = 250;
  20530. t.paragraph = 500;
  20531. t.bullet = 350;
  20532. t.quotesinglbase = 333;
  20533. t.quotedblbase = 500;
  20534. t.quotedblright = 500;
  20535. t.guillemotright = 500;
  20536. t.ellipsis = 1000;
  20537. t.perthousand = 1000;
  20538. t.questiondown = 500;
  20539. t.grave = 333;
  20540. t.acute = 333;
  20541. t.circumflex = 333;
  20542. t.tilde = 333;
  20543. t.macron = 333;
  20544. t.breve = 333;
  20545. t.dotaccent = 333;
  20546. t.dieresis = 333;
  20547. t.ring = 333;
  20548. t.cedilla = 333;
  20549. t.hungarumlaut = 333;
  20550. t.ogonek = 333;
  20551. t.caron = 333;
  20552. t.emdash = 1000;
  20553. t.AE = 944;
  20554. t.ordfeminine = 266;
  20555. t.Lslash = 611;
  20556. t.Oslash = 722;
  20557. t.OE = 944;
  20558. t.ordmasculine = 300;
  20559. t.ae = 722;
  20560. t.dotlessi = 278;
  20561. t.lslash = 278;
  20562. t.oslash = 500;
  20563. t.oe = 722;
  20564. t.germandbls = 500;
  20565. t.Idieresis = 389;
  20566. t.eacute = 444;
  20567. t.abreve = 500;
  20568. t.uhungarumlaut = 556;
  20569. t.ecaron = 444;
  20570. t.Ydieresis = 611;
  20571. t.divide = 570;
  20572. t.Yacute = 611;
  20573. t.Acircumflex = 667;
  20574. t.aacute = 500;
  20575. t.Ucircumflex = 722;
  20576. t.yacute = 444;
  20577. t.scommaaccent = 389;
  20578. t.ecircumflex = 444;
  20579. t.Uring = 722;
  20580. t.Udieresis = 722;
  20581. t.aogonek = 500;
  20582. t.Uacute = 722;
  20583. t.uogonek = 556;
  20584. t.Edieresis = 667;
  20585. t.Dcroat = 722;
  20586. t.commaaccent = 250;
  20587. t.copyright = 747;
  20588. t.Emacron = 667;
  20589. t.ccaron = 444;
  20590. t.aring = 500;
  20591. t.Ncommaaccent = 722;
  20592. t.lacute = 278;
  20593. t.agrave = 500;
  20594. t.Tcommaaccent = 611;
  20595. t.Cacute = 667;
  20596. t.atilde = 500;
  20597. t.Edotaccent = 667;
  20598. t.scaron = 389;
  20599. t.scedilla = 389;
  20600. t.iacute = 278;
  20601. t.lozenge = 494;
  20602. t.Rcaron = 667;
  20603. t.Gcommaaccent = 722;
  20604. t.ucircumflex = 556;
  20605. t.acircumflex = 500;
  20606. t.Amacron = 667;
  20607. t.rcaron = 389;
  20608. t.ccedilla = 444;
  20609. t.Zdotaccent = 611;
  20610. t.Thorn = 611;
  20611. t.Omacron = 722;
  20612. t.Racute = 667;
  20613. t.Sacute = 556;
  20614. t.dcaron = 608;
  20615. t.Umacron = 722;
  20616. t.uring = 556;
  20617. t.threesuperior = 300;
  20618. t.Ograve = 722;
  20619. t.Agrave = 667;
  20620. t.Abreve = 667;
  20621. t.multiply = 570;
  20622. t.uacute = 556;
  20623. t.Tcaron = 611;
  20624. t.partialdiff = 494;
  20625. t.ydieresis = 444;
  20626. t.Nacute = 722;
  20627. t.icircumflex = 278;
  20628. t.Ecircumflex = 667;
  20629. t.adieresis = 500;
  20630. t.edieresis = 444;
  20631. t.cacute = 444;
  20632. t.nacute = 556;
  20633. t.umacron = 556;
  20634. t.Ncaron = 722;
  20635. t.Iacute = 389;
  20636. t.plusminus = 570;
  20637. t.brokenbar = 220;
  20638. t.registered = 747;
  20639. t.Gbreve = 722;
  20640. t.Idotaccent = 389;
  20641. t.summation = 600;
  20642. t.Egrave = 667;
  20643. t.racute = 389;
  20644. t.omacron = 500;
  20645. t.Zacute = 611;
  20646. t.Zcaron = 611;
  20647. t.greaterequal = 549;
  20648. t.Eth = 722;
  20649. t.Ccedilla = 667;
  20650. t.lcommaaccent = 278;
  20651. t.tcaron = 366;
  20652. t.eogonek = 444;
  20653. t.Uogonek = 722;
  20654. t.Aacute = 667;
  20655. t.Adieresis = 667;
  20656. t.egrave = 444;
  20657. t.zacute = 389;
  20658. t.iogonek = 278;
  20659. t.Oacute = 722;
  20660. t.oacute = 500;
  20661. t.amacron = 500;
  20662. t.sacute = 389;
  20663. t.idieresis = 278;
  20664. t.Ocircumflex = 722;
  20665. t.Ugrave = 722;
  20666. t.Delta = 612;
  20667. t.thorn = 500;
  20668. t.twosuperior = 300;
  20669. t.Odieresis = 722;
  20670. t.mu = 576;
  20671. t.igrave = 278;
  20672. t.ohungarumlaut = 500;
  20673. t.Eogonek = 667;
  20674. t.dcroat = 500;
  20675. t.threequarters = 750;
  20676. t.Scedilla = 556;
  20677. t.lcaron = 382;
  20678. t.Kcommaaccent = 667;
  20679. t.Lacute = 611;
  20680. t.trademark = 1000;
  20681. t.edotaccent = 444;
  20682. t.Igrave = 389;
  20683. t.Imacron = 389;
  20684. t.Lcaron = 611;
  20685. t.onehalf = 750;
  20686. t.lessequal = 549;
  20687. t.ocircumflex = 500;
  20688. t.ntilde = 556;
  20689. t.Uhungarumlaut = 722;
  20690. t.Eacute = 667;
  20691. t.emacron = 444;
  20692. t.gbreve = 500;
  20693. t.onequarter = 750;
  20694. t.Scaron = 556;
  20695. t.Scommaaccent = 556;
  20696. t.Ohungarumlaut = 722;
  20697. t.degree = 400;
  20698. t.ograve = 500;
  20699. t.Ccaron = 667;
  20700. t.ugrave = 556;
  20701. t.radical = 549;
  20702. t.Dcaron = 722;
  20703. t.rcommaaccent = 389;
  20704. t.Ntilde = 722;
  20705. t.otilde = 500;
  20706. t.Rcommaaccent = 667;
  20707. t.Lcommaaccent = 611;
  20708. t.Atilde = 667;
  20709. t.Aogonek = 667;
  20710. t.Aring = 667;
  20711. t.Otilde = 722;
  20712. t.zdotaccent = 389;
  20713. t.Ecaron = 667;
  20714. t.Iogonek = 389;
  20715. t.kcommaaccent = 500;
  20716. t.minus = 606;
  20717. t.Icircumflex = 389;
  20718. t.ncaron = 556;
  20719. t.tcommaaccent = 278;
  20720. t.logicalnot = 606;
  20721. t.odieresis = 500;
  20722. t.udieresis = 556;
  20723. t.notequal = 549;
  20724. t.gcommaaccent = 500;
  20725. t.eth = 500;
  20726. t.zcaron = 389;
  20727. t.ncommaaccent = 556;
  20728. t.onesuperior = 300;
  20729. t.imacron = 278;
  20730. t.Euro = 500;
  20731. });
  20732. t["Times-Italic"] = getLookupTableFactory(function (t) {
  20733. t.space = 250;
  20734. t.exclam = 333;
  20735. t.quotedbl = 420;
  20736. t.numbersign = 500;
  20737. t.dollar = 500;
  20738. t.percent = 833;
  20739. t.ampersand = 778;
  20740. t.quoteright = 333;
  20741. t.parenleft = 333;
  20742. t.parenright = 333;
  20743. t.asterisk = 500;
  20744. t.plus = 675;
  20745. t.comma = 250;
  20746. t.hyphen = 333;
  20747. t.period = 250;
  20748. t.slash = 278;
  20749. t.zero = 500;
  20750. t.one = 500;
  20751. t.two = 500;
  20752. t.three = 500;
  20753. t.four = 500;
  20754. t.five = 500;
  20755. t.six = 500;
  20756. t.seven = 500;
  20757. t.eight = 500;
  20758. t.nine = 500;
  20759. t.colon = 333;
  20760. t.semicolon = 333;
  20761. t.less = 675;
  20762. t.equal = 675;
  20763. t.greater = 675;
  20764. t.question = 500;
  20765. t.at = 920;
  20766. t.A = 611;
  20767. t.B = 611;
  20768. t.C = 667;
  20769. t.D = 722;
  20770. t.E = 611;
  20771. t.F = 611;
  20772. t.G = 722;
  20773. t.H = 722;
  20774. t.I = 333;
  20775. t.J = 444;
  20776. t.K = 667;
  20777. t.L = 556;
  20778. t.M = 833;
  20779. t.N = 667;
  20780. t.O = 722;
  20781. t.P = 611;
  20782. t.Q = 722;
  20783. t.R = 611;
  20784. t.S = 500;
  20785. t.T = 556;
  20786. t.U = 722;
  20787. t.V = 611;
  20788. t.W = 833;
  20789. t.X = 611;
  20790. t.Y = 556;
  20791. t.Z = 556;
  20792. t.bracketleft = 389;
  20793. t.backslash = 278;
  20794. t.bracketright = 389;
  20795. t.asciicircum = 422;
  20796. t.underscore = 500;
  20797. t.quoteleft = 333;
  20798. t.a = 500;
  20799. t.b = 500;
  20800. t.c = 444;
  20801. t.d = 500;
  20802. t.e = 444;
  20803. t.f = 278;
  20804. t.g = 500;
  20805. t.h = 500;
  20806. t.i = 278;
  20807. t.j = 278;
  20808. t.k = 444;
  20809. t.l = 278;
  20810. t.m = 722;
  20811. t.n = 500;
  20812. t.o = 500;
  20813. t.p = 500;
  20814. t.q = 500;
  20815. t.r = 389;
  20816. t.s = 389;
  20817. t.t = 278;
  20818. t.u = 500;
  20819. t.v = 444;
  20820. t.w = 667;
  20821. t.x = 444;
  20822. t.y = 444;
  20823. t.z = 389;
  20824. t.braceleft = 400;
  20825. t.bar = 275;
  20826. t.braceright = 400;
  20827. t.asciitilde = 541;
  20828. t.exclamdown = 389;
  20829. t.cent = 500;
  20830. t.sterling = 500;
  20831. t.fraction = 167;
  20832. t.yen = 500;
  20833. t.florin = 500;
  20834. t.section = 500;
  20835. t.currency = 500;
  20836. t.quotesingle = 214;
  20837. t.quotedblleft = 556;
  20838. t.guillemotleft = 500;
  20839. t.guilsinglleft = 333;
  20840. t.guilsinglright = 333;
  20841. t.fi = 500;
  20842. t.fl = 500;
  20843. t.endash = 500;
  20844. t.dagger = 500;
  20845. t.daggerdbl = 500;
  20846. t.periodcentered = 250;
  20847. t.paragraph = 523;
  20848. t.bullet = 350;
  20849. t.quotesinglbase = 333;
  20850. t.quotedblbase = 556;
  20851. t.quotedblright = 556;
  20852. t.guillemotright = 500;
  20853. t.ellipsis = 889;
  20854. t.perthousand = 1000;
  20855. t.questiondown = 500;
  20856. t.grave = 333;
  20857. t.acute = 333;
  20858. t.circumflex = 333;
  20859. t.tilde = 333;
  20860. t.macron = 333;
  20861. t.breve = 333;
  20862. t.dotaccent = 333;
  20863. t.dieresis = 333;
  20864. t.ring = 333;
  20865. t.cedilla = 333;
  20866. t.hungarumlaut = 333;
  20867. t.ogonek = 333;
  20868. t.caron = 333;
  20869. t.emdash = 889;
  20870. t.AE = 889;
  20871. t.ordfeminine = 276;
  20872. t.Lslash = 556;
  20873. t.Oslash = 722;
  20874. t.OE = 944;
  20875. t.ordmasculine = 310;
  20876. t.ae = 667;
  20877. t.dotlessi = 278;
  20878. t.lslash = 278;
  20879. t.oslash = 500;
  20880. t.oe = 667;
  20881. t.germandbls = 500;
  20882. t.Idieresis = 333;
  20883. t.eacute = 444;
  20884. t.abreve = 500;
  20885. t.uhungarumlaut = 500;
  20886. t.ecaron = 444;
  20887. t.Ydieresis = 556;
  20888. t.divide = 675;
  20889. t.Yacute = 556;
  20890. t.Acircumflex = 611;
  20891. t.aacute = 500;
  20892. t.Ucircumflex = 722;
  20893. t.yacute = 444;
  20894. t.scommaaccent = 389;
  20895. t.ecircumflex = 444;
  20896. t.Uring = 722;
  20897. t.Udieresis = 722;
  20898. t.aogonek = 500;
  20899. t.Uacute = 722;
  20900. t.uogonek = 500;
  20901. t.Edieresis = 611;
  20902. t.Dcroat = 722;
  20903. t.commaaccent = 250;
  20904. t.copyright = 760;
  20905. t.Emacron = 611;
  20906. t.ccaron = 444;
  20907. t.aring = 500;
  20908. t.Ncommaaccent = 667;
  20909. t.lacute = 278;
  20910. t.agrave = 500;
  20911. t.Tcommaaccent = 556;
  20912. t.Cacute = 667;
  20913. t.atilde = 500;
  20914. t.Edotaccent = 611;
  20915. t.scaron = 389;
  20916. t.scedilla = 389;
  20917. t.iacute = 278;
  20918. t.lozenge = 471;
  20919. t.Rcaron = 611;
  20920. t.Gcommaaccent = 722;
  20921. t.ucircumflex = 500;
  20922. t.acircumflex = 500;
  20923. t.Amacron = 611;
  20924. t.rcaron = 389;
  20925. t.ccedilla = 444;
  20926. t.Zdotaccent = 556;
  20927. t.Thorn = 611;
  20928. t.Omacron = 722;
  20929. t.Racute = 611;
  20930. t.Sacute = 500;
  20931. t.dcaron = 544;
  20932. t.Umacron = 722;
  20933. t.uring = 500;
  20934. t.threesuperior = 300;
  20935. t.Ograve = 722;
  20936. t.Agrave = 611;
  20937. t.Abreve = 611;
  20938. t.multiply = 675;
  20939. t.uacute = 500;
  20940. t.Tcaron = 556;
  20941. t.partialdiff = 476;
  20942. t.ydieresis = 444;
  20943. t.Nacute = 667;
  20944. t.icircumflex = 278;
  20945. t.Ecircumflex = 611;
  20946. t.adieresis = 500;
  20947. t.edieresis = 444;
  20948. t.cacute = 444;
  20949. t.nacute = 500;
  20950. t.umacron = 500;
  20951. t.Ncaron = 667;
  20952. t.Iacute = 333;
  20953. t.plusminus = 675;
  20954. t.brokenbar = 275;
  20955. t.registered = 760;
  20956. t.Gbreve = 722;
  20957. t.Idotaccent = 333;
  20958. t.summation = 600;
  20959. t.Egrave = 611;
  20960. t.racute = 389;
  20961. t.omacron = 500;
  20962. t.Zacute = 556;
  20963. t.Zcaron = 556;
  20964. t.greaterequal = 549;
  20965. t.Eth = 722;
  20966. t.Ccedilla = 667;
  20967. t.lcommaaccent = 278;
  20968. t.tcaron = 300;
  20969. t.eogonek = 444;
  20970. t.Uogonek = 722;
  20971. t.Aacute = 611;
  20972. t.Adieresis = 611;
  20973. t.egrave = 444;
  20974. t.zacute = 389;
  20975. t.iogonek = 278;
  20976. t.Oacute = 722;
  20977. t.oacute = 500;
  20978. t.amacron = 500;
  20979. t.sacute = 389;
  20980. t.idieresis = 278;
  20981. t.Ocircumflex = 722;
  20982. t.Ugrave = 722;
  20983. t.Delta = 612;
  20984. t.thorn = 500;
  20985. t.twosuperior = 300;
  20986. t.Odieresis = 722;
  20987. t.mu = 500;
  20988. t.igrave = 278;
  20989. t.ohungarumlaut = 500;
  20990. t.Eogonek = 611;
  20991. t.dcroat = 500;
  20992. t.threequarters = 750;
  20993. t.Scedilla = 500;
  20994. t.lcaron = 300;
  20995. t.Kcommaaccent = 667;
  20996. t.Lacute = 556;
  20997. t.trademark = 980;
  20998. t.edotaccent = 444;
  20999. t.Igrave = 333;
  21000. t.Imacron = 333;
  21001. t.Lcaron = 611;
  21002. t.onehalf = 750;
  21003. t.lessequal = 549;
  21004. t.ocircumflex = 500;
  21005. t.ntilde = 500;
  21006. t.Uhungarumlaut = 722;
  21007. t.Eacute = 611;
  21008. t.emacron = 444;
  21009. t.gbreve = 500;
  21010. t.onequarter = 750;
  21011. t.Scaron = 500;
  21012. t.Scommaaccent = 500;
  21013. t.Ohungarumlaut = 722;
  21014. t.degree = 400;
  21015. t.ograve = 500;
  21016. t.Ccaron = 667;
  21017. t.ugrave = 500;
  21018. t.radical = 453;
  21019. t.Dcaron = 722;
  21020. t.rcommaaccent = 389;
  21021. t.Ntilde = 667;
  21022. t.otilde = 500;
  21023. t.Rcommaaccent = 611;
  21024. t.Lcommaaccent = 556;
  21025. t.Atilde = 611;
  21026. t.Aogonek = 611;
  21027. t.Aring = 611;
  21028. t.Otilde = 722;
  21029. t.zdotaccent = 389;
  21030. t.Ecaron = 611;
  21031. t.Iogonek = 333;
  21032. t.kcommaaccent = 444;
  21033. t.minus = 675;
  21034. t.Icircumflex = 333;
  21035. t.ncaron = 500;
  21036. t.tcommaaccent = 278;
  21037. t.logicalnot = 675;
  21038. t.odieresis = 500;
  21039. t.udieresis = 500;
  21040. t.notequal = 549;
  21041. t.gcommaaccent = 500;
  21042. t.eth = 500;
  21043. t.zcaron = 389;
  21044. t.ncommaaccent = 500;
  21045. t.onesuperior = 300;
  21046. t.imacron = 278;
  21047. t.Euro = 500;
  21048. });
  21049. t.ZapfDingbats = getLookupTableFactory(function (t) {
  21050. t.space = 278;
  21051. t.a1 = 974;
  21052. t.a2 = 961;
  21053. t.a202 = 974;
  21054. t.a3 = 980;
  21055. t.a4 = 719;
  21056. t.a5 = 789;
  21057. t.a119 = 790;
  21058. t.a118 = 791;
  21059. t.a117 = 690;
  21060. t.a11 = 960;
  21061. t.a12 = 939;
  21062. t.a13 = 549;
  21063. t.a14 = 855;
  21064. t.a15 = 911;
  21065. t.a16 = 933;
  21066. t.a105 = 911;
  21067. t.a17 = 945;
  21068. t.a18 = 974;
  21069. t.a19 = 755;
  21070. t.a20 = 846;
  21071. t.a21 = 762;
  21072. t.a22 = 761;
  21073. t.a23 = 571;
  21074. t.a24 = 677;
  21075. t.a25 = 763;
  21076. t.a26 = 760;
  21077. t.a27 = 759;
  21078. t.a28 = 754;
  21079. t.a6 = 494;
  21080. t.a7 = 552;
  21081. t.a8 = 537;
  21082. t.a9 = 577;
  21083. t.a10 = 692;
  21084. t.a29 = 786;
  21085. t.a30 = 788;
  21086. t.a31 = 788;
  21087. t.a32 = 790;
  21088. t.a33 = 793;
  21089. t.a34 = 794;
  21090. t.a35 = 816;
  21091. t.a36 = 823;
  21092. t.a37 = 789;
  21093. t.a38 = 841;
  21094. t.a39 = 823;
  21095. t.a40 = 833;
  21096. t.a41 = 816;
  21097. t.a42 = 831;
  21098. t.a43 = 923;
  21099. t.a44 = 744;
  21100. t.a45 = 723;
  21101. t.a46 = 749;
  21102. t.a47 = 790;
  21103. t.a48 = 792;
  21104. t.a49 = 695;
  21105. t.a50 = 776;
  21106. t.a51 = 768;
  21107. t.a52 = 792;
  21108. t.a53 = 759;
  21109. t.a54 = 707;
  21110. t.a55 = 708;
  21111. t.a56 = 682;
  21112. t.a57 = 701;
  21113. t.a58 = 826;
  21114. t.a59 = 815;
  21115. t.a60 = 789;
  21116. t.a61 = 789;
  21117. t.a62 = 707;
  21118. t.a63 = 687;
  21119. t.a64 = 696;
  21120. t.a65 = 689;
  21121. t.a66 = 786;
  21122. t.a67 = 787;
  21123. t.a68 = 713;
  21124. t.a69 = 791;
  21125. t.a70 = 785;
  21126. t.a71 = 791;
  21127. t.a72 = 873;
  21128. t.a73 = 761;
  21129. t.a74 = 762;
  21130. t.a203 = 762;
  21131. t.a75 = 759;
  21132. t.a204 = 759;
  21133. t.a76 = 892;
  21134. t.a77 = 892;
  21135. t.a78 = 788;
  21136. t.a79 = 784;
  21137. t.a81 = 438;
  21138. t.a82 = 138;
  21139. t.a83 = 277;
  21140. t.a84 = 415;
  21141. t.a97 = 392;
  21142. t.a98 = 392;
  21143. t.a99 = 668;
  21144. t.a100 = 668;
  21145. t.a89 = 390;
  21146. t.a90 = 390;
  21147. t.a93 = 317;
  21148. t.a94 = 317;
  21149. t.a91 = 276;
  21150. t.a92 = 276;
  21151. t.a205 = 509;
  21152. t.a85 = 509;
  21153. t.a206 = 410;
  21154. t.a86 = 410;
  21155. t.a87 = 234;
  21156. t.a88 = 234;
  21157. t.a95 = 334;
  21158. t.a96 = 334;
  21159. t.a101 = 732;
  21160. t.a102 = 544;
  21161. t.a103 = 544;
  21162. t.a104 = 910;
  21163. t.a106 = 667;
  21164. t.a107 = 760;
  21165. t.a108 = 760;
  21166. t.a112 = 776;
  21167. t.a111 = 595;
  21168. t.a110 = 694;
  21169. t.a109 = 626;
  21170. t.a120 = 788;
  21171. t.a121 = 788;
  21172. t.a122 = 788;
  21173. t.a123 = 788;
  21174. t.a124 = 788;
  21175. t.a125 = 788;
  21176. t.a126 = 788;
  21177. t.a127 = 788;
  21178. t.a128 = 788;
  21179. t.a129 = 788;
  21180. t.a130 = 788;
  21181. t.a131 = 788;
  21182. t.a132 = 788;
  21183. t.a133 = 788;
  21184. t.a134 = 788;
  21185. t.a135 = 788;
  21186. t.a136 = 788;
  21187. t.a137 = 788;
  21188. t.a138 = 788;
  21189. t.a139 = 788;
  21190. t.a140 = 788;
  21191. t.a141 = 788;
  21192. t.a142 = 788;
  21193. t.a143 = 788;
  21194. t.a144 = 788;
  21195. t.a145 = 788;
  21196. t.a146 = 788;
  21197. t.a147 = 788;
  21198. t.a148 = 788;
  21199. t.a149 = 788;
  21200. t.a150 = 788;
  21201. t.a151 = 788;
  21202. t.a152 = 788;
  21203. t.a153 = 788;
  21204. t.a154 = 788;
  21205. t.a155 = 788;
  21206. t.a156 = 788;
  21207. t.a157 = 788;
  21208. t.a158 = 788;
  21209. t.a159 = 788;
  21210. t.a160 = 894;
  21211. t.a161 = 838;
  21212. t.a163 = 1016;
  21213. t.a164 = 458;
  21214. t.a196 = 748;
  21215. t.a165 = 924;
  21216. t.a192 = 748;
  21217. t.a166 = 918;
  21218. t.a167 = 927;
  21219. t.a168 = 928;
  21220. t.a169 = 928;
  21221. t.a170 = 834;
  21222. t.a171 = 873;
  21223. t.a172 = 828;
  21224. t.a173 = 924;
  21225. t.a162 = 924;
  21226. t.a174 = 917;
  21227. t.a175 = 930;
  21228. t.a176 = 931;
  21229. t.a177 = 463;
  21230. t.a178 = 883;
  21231. t.a179 = 836;
  21232. t.a193 = 836;
  21233. t.a180 = 867;
  21234. t.a199 = 867;
  21235. t.a181 = 696;
  21236. t.a200 = 696;
  21237. t.a182 = 874;
  21238. t.a201 = 874;
  21239. t.a183 = 760;
  21240. t.a184 = 946;
  21241. t.a197 = 771;
  21242. t.a185 = 865;
  21243. t.a194 = 771;
  21244. t.a198 = 888;
  21245. t.a186 = 967;
  21246. t.a195 = 888;
  21247. t.a187 = 831;
  21248. t.a188 = 873;
  21249. t.a189 = 927;
  21250. t.a190 = 970;
  21251. t.a191 = 918;
  21252. });
  21253. });
  21254. const getFontBasicMetrics = getLookupTableFactory(function (t) {
  21255. t.Courier = {
  21256. ascent: 629,
  21257. descent: -157,
  21258. capHeight: 562,
  21259. xHeight: -426
  21260. };
  21261. t["Courier-Bold"] = {
  21262. ascent: 629,
  21263. descent: -157,
  21264. capHeight: 562,
  21265. xHeight: 439
  21266. };
  21267. t["Courier-Oblique"] = {
  21268. ascent: 629,
  21269. descent: -157,
  21270. capHeight: 562,
  21271. xHeight: 426
  21272. };
  21273. t["Courier-BoldOblique"] = {
  21274. ascent: 629,
  21275. descent: -157,
  21276. capHeight: 562,
  21277. xHeight: 426
  21278. };
  21279. t.Helvetica = {
  21280. ascent: 718,
  21281. descent: -207,
  21282. capHeight: 718,
  21283. xHeight: 523
  21284. };
  21285. t["Helvetica-Bold"] = {
  21286. ascent: 718,
  21287. descent: -207,
  21288. capHeight: 718,
  21289. xHeight: 532
  21290. };
  21291. t["Helvetica-Oblique"] = {
  21292. ascent: 718,
  21293. descent: -207,
  21294. capHeight: 718,
  21295. xHeight: 523
  21296. };
  21297. t["Helvetica-BoldOblique"] = {
  21298. ascent: 718,
  21299. descent: -207,
  21300. capHeight: 718,
  21301. xHeight: 532
  21302. };
  21303. t["Times-Roman"] = {
  21304. ascent: 683,
  21305. descent: -217,
  21306. capHeight: 662,
  21307. xHeight: 450
  21308. };
  21309. t["Times-Bold"] = {
  21310. ascent: 683,
  21311. descent: -217,
  21312. capHeight: 676,
  21313. xHeight: 461
  21314. };
  21315. t["Times-Italic"] = {
  21316. ascent: 683,
  21317. descent: -217,
  21318. capHeight: 653,
  21319. xHeight: 441
  21320. };
  21321. t["Times-BoldItalic"] = {
  21322. ascent: 683,
  21323. descent: -217,
  21324. capHeight: 669,
  21325. xHeight: 462
  21326. };
  21327. t.Symbol = {
  21328. ascent: Math.NaN,
  21329. descent: Math.NaN,
  21330. capHeight: Math.NaN,
  21331. xHeight: Math.NaN
  21332. };
  21333. t.ZapfDingbats = {
  21334. ascent: Math.NaN,
  21335. descent: Math.NaN,
  21336. capHeight: Math.NaN,
  21337. xHeight: Math.NaN
  21338. };
  21339. });
  21340. ;// ./src/core/glyf.js
  21341. const ON_CURVE_POINT = 1 << 0;
  21342. const X_SHORT_VECTOR = 1 << 1;
  21343. const Y_SHORT_VECTOR = 1 << 2;
  21344. const REPEAT_FLAG = 1 << 3;
  21345. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  21346. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  21347. const OVERLAP_SIMPLE = 1 << 6;
  21348. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  21349. const ARGS_ARE_XY_VALUES = 1 << 1;
  21350. const WE_HAVE_A_SCALE = 1 << 3;
  21351. const MORE_COMPONENTS = 1 << 5;
  21352. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  21353. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  21354. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  21355. class GlyfTable {
  21356. constructor({
  21357. glyfTable,
  21358. isGlyphLocationsLong,
  21359. locaTable,
  21360. numGlyphs
  21361. }) {
  21362. this.glyphs = [];
  21363. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  21364. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  21365. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  21366. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  21367. let pos = 0;
  21368. for (let i = 0; i < numGlyphs; i++) {
  21369. pos += offsetSize;
  21370. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  21371. if (next === prev) {
  21372. this.glyphs.push(new Glyph({}));
  21373. continue;
  21374. }
  21375. const glyph = Glyph.parse(prev, glyf);
  21376. this.glyphs.push(glyph);
  21377. prev = next;
  21378. }
  21379. }
  21380. getSize() {
  21381. return this.glyphs.reduce((a, g) => {
  21382. const size = g.getSize();
  21383. return a + (size + 3 & ~3);
  21384. }, 0);
  21385. }
  21386. write() {
  21387. const totalSize = this.getSize();
  21388. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  21389. const isLocationLong = totalSize > 0x1fffe;
  21390. const offsetSize = isLocationLong ? 4 : 2;
  21391. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  21392. if (isLocationLong) {
  21393. locaTable.setUint32(0, 0);
  21394. } else {
  21395. locaTable.setUint16(0, 0);
  21396. }
  21397. let pos = 0;
  21398. let locaIndex = 0;
  21399. for (const glyph of this.glyphs) {
  21400. pos += glyph.write(pos, glyfTable);
  21401. pos = pos + 3 & ~3;
  21402. locaIndex += offsetSize;
  21403. if (isLocationLong) {
  21404. locaTable.setUint32(locaIndex, pos);
  21405. } else {
  21406. locaTable.setUint16(locaIndex, pos >> 1);
  21407. }
  21408. }
  21409. return {
  21410. isLocationLong,
  21411. loca: new Uint8Array(locaTable.buffer),
  21412. glyf: new Uint8Array(glyfTable.buffer)
  21413. };
  21414. }
  21415. scale(factors) {
  21416. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  21417. this.glyphs[i].scale(factors[i]);
  21418. }
  21419. }
  21420. }
  21421. class Glyph {
  21422. constructor({
  21423. header = null,
  21424. simple = null,
  21425. composites = null
  21426. }) {
  21427. this.header = header;
  21428. this.simple = simple;
  21429. this.composites = composites;
  21430. }
  21431. static parse(pos, glyf) {
  21432. const [read, header] = GlyphHeader.parse(pos, glyf);
  21433. pos += read;
  21434. if (header.numberOfContours < 0) {
  21435. const composites = [];
  21436. while (true) {
  21437. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  21438. pos += n;
  21439. composites.push(composite);
  21440. if (!(composite.flags & MORE_COMPONENTS)) {
  21441. break;
  21442. }
  21443. }
  21444. return new Glyph({
  21445. header,
  21446. composites
  21447. });
  21448. }
  21449. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  21450. return new Glyph({
  21451. header,
  21452. simple
  21453. });
  21454. }
  21455. getSize() {
  21456. if (!this.header) {
  21457. return 0;
  21458. }
  21459. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  21460. return this.header.getSize() + size;
  21461. }
  21462. write(pos, buf) {
  21463. if (!this.header) {
  21464. return 0;
  21465. }
  21466. const spos = pos;
  21467. pos += this.header.write(pos, buf);
  21468. if (this.simple) {
  21469. pos += this.simple.write(pos, buf);
  21470. } else {
  21471. for (const composite of this.composites) {
  21472. pos += composite.write(pos, buf);
  21473. }
  21474. }
  21475. return pos - spos;
  21476. }
  21477. scale(factor) {
  21478. if (!this.header) {
  21479. return;
  21480. }
  21481. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  21482. this.header.scale(xMiddle, factor);
  21483. if (this.simple) {
  21484. this.simple.scale(xMiddle, factor);
  21485. } else {
  21486. for (const composite of this.composites) {
  21487. composite.scale(xMiddle, factor);
  21488. }
  21489. }
  21490. }
  21491. }
  21492. class GlyphHeader {
  21493. constructor({
  21494. numberOfContours,
  21495. xMin,
  21496. yMin,
  21497. xMax,
  21498. yMax
  21499. }) {
  21500. this.numberOfContours = numberOfContours;
  21501. this.xMin = xMin;
  21502. this.yMin = yMin;
  21503. this.xMax = xMax;
  21504. this.yMax = yMax;
  21505. }
  21506. static parse(pos, glyf) {
  21507. return [10, new GlyphHeader({
  21508. numberOfContours: glyf.getInt16(pos),
  21509. xMin: glyf.getInt16(pos + 2),
  21510. yMin: glyf.getInt16(pos + 4),
  21511. xMax: glyf.getInt16(pos + 6),
  21512. yMax: glyf.getInt16(pos + 8)
  21513. })];
  21514. }
  21515. getSize() {
  21516. return 10;
  21517. }
  21518. write(pos, buf) {
  21519. buf.setInt16(pos, this.numberOfContours);
  21520. buf.setInt16(pos + 2, this.xMin);
  21521. buf.setInt16(pos + 4, this.yMin);
  21522. buf.setInt16(pos + 6, this.xMax);
  21523. buf.setInt16(pos + 8, this.yMax);
  21524. return 10;
  21525. }
  21526. scale(x, factor) {
  21527. this.xMin = Math.round(x + (this.xMin - x) * factor);
  21528. this.xMax = Math.round(x + (this.xMax - x) * factor);
  21529. }
  21530. }
  21531. class Contour {
  21532. constructor({
  21533. flags,
  21534. xCoordinates,
  21535. yCoordinates
  21536. }) {
  21537. this.xCoordinates = xCoordinates;
  21538. this.yCoordinates = yCoordinates;
  21539. this.flags = flags;
  21540. }
  21541. }
  21542. class SimpleGlyph {
  21543. constructor({
  21544. contours,
  21545. instructions
  21546. }) {
  21547. this.contours = contours;
  21548. this.instructions = instructions;
  21549. }
  21550. static parse(pos, glyf, numberOfContours) {
  21551. const endPtsOfContours = [];
  21552. for (let i = 0; i < numberOfContours; i++) {
  21553. const endPt = glyf.getUint16(pos);
  21554. pos += 2;
  21555. endPtsOfContours.push(endPt);
  21556. }
  21557. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  21558. const instructionLength = glyf.getUint16(pos);
  21559. pos += 2;
  21560. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  21561. pos += instructionLength;
  21562. const flags = [];
  21563. for (let i = 0; i < numberOfPt; pos++, i++) {
  21564. let flag = glyf.getUint8(pos);
  21565. flags.push(flag);
  21566. if (flag & REPEAT_FLAG) {
  21567. const count = glyf.getUint8(++pos);
  21568. flag ^= REPEAT_FLAG;
  21569. for (let m = 0; m < count; m++) {
  21570. flags.push(flag);
  21571. }
  21572. i += count;
  21573. }
  21574. }
  21575. const allXCoordinates = [];
  21576. let xCoordinates = [];
  21577. let yCoordinates = [];
  21578. let pointFlags = [];
  21579. const contours = [];
  21580. let endPtsOfContoursIndex = 0;
  21581. let lastCoordinate = 0;
  21582. for (let i = 0; i < numberOfPt; i++) {
  21583. const flag = flags[i];
  21584. if (flag & X_SHORT_VECTOR) {
  21585. const x = glyf.getUint8(pos++);
  21586. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  21587. xCoordinates.push(lastCoordinate);
  21588. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  21589. xCoordinates.push(lastCoordinate);
  21590. } else {
  21591. lastCoordinate += glyf.getInt16(pos);
  21592. pos += 2;
  21593. xCoordinates.push(lastCoordinate);
  21594. }
  21595. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  21596. endPtsOfContoursIndex++;
  21597. allXCoordinates.push(xCoordinates);
  21598. xCoordinates = [];
  21599. }
  21600. }
  21601. lastCoordinate = 0;
  21602. endPtsOfContoursIndex = 0;
  21603. for (let i = 0; i < numberOfPt; i++) {
  21604. const flag = flags[i];
  21605. if (flag & Y_SHORT_VECTOR) {
  21606. const y = glyf.getUint8(pos++);
  21607. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  21608. yCoordinates.push(lastCoordinate);
  21609. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  21610. yCoordinates.push(lastCoordinate);
  21611. } else {
  21612. lastCoordinate += glyf.getInt16(pos);
  21613. pos += 2;
  21614. yCoordinates.push(lastCoordinate);
  21615. }
  21616. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  21617. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  21618. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  21619. endPtsOfContoursIndex++;
  21620. contours.push(new Contour({
  21621. flags: pointFlags,
  21622. xCoordinates,
  21623. yCoordinates
  21624. }));
  21625. yCoordinates = [];
  21626. pointFlags = [];
  21627. }
  21628. }
  21629. return new SimpleGlyph({
  21630. contours,
  21631. instructions
  21632. });
  21633. }
  21634. getSize() {
  21635. let size = this.contours.length * 2 + 2 + this.instructions.length;
  21636. let lastX = 0;
  21637. let lastY = 0;
  21638. for (const contour of this.contours) {
  21639. size += contour.flags.length;
  21640. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  21641. const x = contour.xCoordinates[i];
  21642. const y = contour.yCoordinates[i];
  21643. let abs = Math.abs(x - lastX);
  21644. if (abs > 255) {
  21645. size += 2;
  21646. } else if (abs > 0) {
  21647. size += 1;
  21648. }
  21649. lastX = x;
  21650. abs = Math.abs(y - lastY);
  21651. if (abs > 255) {
  21652. size += 2;
  21653. } else if (abs > 0) {
  21654. size += 1;
  21655. }
  21656. lastY = y;
  21657. }
  21658. }
  21659. return size;
  21660. }
  21661. write(pos, buf) {
  21662. const spos = pos;
  21663. const xCoordinates = [];
  21664. const yCoordinates = [];
  21665. const flags = [];
  21666. let lastX = 0;
  21667. let lastY = 0;
  21668. for (const contour of this.contours) {
  21669. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  21670. let flag = contour.flags[i];
  21671. const x = contour.xCoordinates[i];
  21672. let delta = x - lastX;
  21673. if (delta === 0) {
  21674. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  21675. xCoordinates.push(0);
  21676. } else {
  21677. const abs = Math.abs(delta);
  21678. if (abs <= 255) {
  21679. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  21680. xCoordinates.push(abs);
  21681. } else {
  21682. xCoordinates.push(delta);
  21683. }
  21684. }
  21685. lastX = x;
  21686. const y = contour.yCoordinates[i];
  21687. delta = y - lastY;
  21688. if (delta === 0) {
  21689. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  21690. yCoordinates.push(0);
  21691. } else {
  21692. const abs = Math.abs(delta);
  21693. if (abs <= 255) {
  21694. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  21695. yCoordinates.push(abs);
  21696. } else {
  21697. yCoordinates.push(delta);
  21698. }
  21699. }
  21700. lastY = y;
  21701. flags.push(flag);
  21702. }
  21703. buf.setUint16(pos, xCoordinates.length - 1);
  21704. pos += 2;
  21705. }
  21706. buf.setUint16(pos, this.instructions.length);
  21707. pos += 2;
  21708. if (this.instructions.length) {
  21709. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  21710. pos += this.instructions.length;
  21711. }
  21712. for (const flag of flags) {
  21713. buf.setUint8(pos++, flag);
  21714. }
  21715. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  21716. const x = xCoordinates[i];
  21717. const flag = flags[i];
  21718. if (flag & X_SHORT_VECTOR) {
  21719. buf.setUint8(pos++, x);
  21720. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  21721. buf.setInt16(pos, x);
  21722. pos += 2;
  21723. }
  21724. }
  21725. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  21726. const y = yCoordinates[i];
  21727. const flag = flags[i];
  21728. if (flag & Y_SHORT_VECTOR) {
  21729. buf.setUint8(pos++, y);
  21730. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  21731. buf.setInt16(pos, y);
  21732. pos += 2;
  21733. }
  21734. }
  21735. return pos - spos;
  21736. }
  21737. scale(x, factor) {
  21738. for (const contour of this.contours) {
  21739. if (contour.xCoordinates.length === 0) {
  21740. continue;
  21741. }
  21742. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  21743. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  21744. }
  21745. }
  21746. }
  21747. }
  21748. class CompositeGlyph {
  21749. constructor({
  21750. flags,
  21751. glyphIndex,
  21752. argument1,
  21753. argument2,
  21754. transf,
  21755. instructions
  21756. }) {
  21757. this.flags = flags;
  21758. this.glyphIndex = glyphIndex;
  21759. this.argument1 = argument1;
  21760. this.argument2 = argument2;
  21761. this.transf = transf;
  21762. this.instructions = instructions;
  21763. }
  21764. static parse(pos, glyf) {
  21765. const spos = pos;
  21766. const transf = [];
  21767. let flags = glyf.getUint16(pos);
  21768. const glyphIndex = glyf.getUint16(pos + 2);
  21769. pos += 4;
  21770. let argument1, argument2;
  21771. if (flags & ARG_1_AND_2_ARE_WORDS) {
  21772. if (flags & ARGS_ARE_XY_VALUES) {
  21773. argument1 = glyf.getInt16(pos);
  21774. argument2 = glyf.getInt16(pos + 2);
  21775. } else {
  21776. argument1 = glyf.getUint16(pos);
  21777. argument2 = glyf.getUint16(pos + 2);
  21778. }
  21779. pos += 4;
  21780. flags ^= ARG_1_AND_2_ARE_WORDS;
  21781. } else {
  21782. if (flags & ARGS_ARE_XY_VALUES) {
  21783. argument1 = glyf.getInt8(pos);
  21784. argument2 = glyf.getInt8(pos + 1);
  21785. } else {
  21786. argument1 = glyf.getUint8(pos);
  21787. argument2 = glyf.getUint8(pos + 1);
  21788. }
  21789. pos += 2;
  21790. }
  21791. if (flags & WE_HAVE_A_SCALE) {
  21792. transf.push(glyf.getUint16(pos));
  21793. pos += 2;
  21794. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  21795. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  21796. pos += 4;
  21797. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  21798. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  21799. pos += 8;
  21800. }
  21801. let instructions = null;
  21802. if (flags & WE_HAVE_INSTRUCTIONS) {
  21803. const instructionLength = glyf.getUint16(pos);
  21804. pos += 2;
  21805. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  21806. pos += instructionLength;
  21807. }
  21808. return [pos - spos, new CompositeGlyph({
  21809. flags,
  21810. glyphIndex,
  21811. argument1,
  21812. argument2,
  21813. transf,
  21814. instructions
  21815. })];
  21816. }
  21817. getSize() {
  21818. let size = 2 + 2 + this.transf.length * 2;
  21819. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  21820. size += 2 + this.instructions.length;
  21821. }
  21822. size += 2;
  21823. if (this.flags & 2) {
  21824. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  21825. size += 2;
  21826. }
  21827. } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  21828. size += 2;
  21829. }
  21830. return size;
  21831. }
  21832. write(pos, buf) {
  21833. const spos = pos;
  21834. if (this.flags & ARGS_ARE_XY_VALUES) {
  21835. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  21836. this.flags |= ARG_1_AND_2_ARE_WORDS;
  21837. }
  21838. } else if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  21839. this.flags |= ARG_1_AND_2_ARE_WORDS;
  21840. }
  21841. buf.setUint16(pos, this.flags);
  21842. buf.setUint16(pos + 2, this.glyphIndex);
  21843. pos += 4;
  21844. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  21845. if (this.flags & ARGS_ARE_XY_VALUES) {
  21846. buf.setInt16(pos, this.argument1);
  21847. buf.setInt16(pos + 2, this.argument2);
  21848. } else {
  21849. buf.setUint16(pos, this.argument1);
  21850. buf.setUint16(pos + 2, this.argument2);
  21851. }
  21852. pos += 4;
  21853. } else {
  21854. buf.setUint8(pos, this.argument1);
  21855. buf.setUint8(pos + 1, this.argument2);
  21856. pos += 2;
  21857. }
  21858. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  21859. buf.setUint16(pos, this.instructions.length);
  21860. pos += 2;
  21861. if (this.instructions.length) {
  21862. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  21863. pos += this.instructions.length;
  21864. }
  21865. }
  21866. return pos - spos;
  21867. }
  21868. scale(x, factor) {}
  21869. }
  21870. ;// ./src/core/opentype_file_builder.js
  21871. function writeInt16(dest, offset, num) {
  21872. dest[offset] = num >> 8 & 0xff;
  21873. dest[offset + 1] = num & 0xff;
  21874. }
  21875. function writeInt32(dest, offset, num) {
  21876. dest[offset] = num >> 24 & 0xff;
  21877. dest[offset + 1] = num >> 16 & 0xff;
  21878. dest[offset + 2] = num >> 8 & 0xff;
  21879. dest[offset + 3] = num & 0xff;
  21880. }
  21881. function writeData(dest, offset, data) {
  21882. if (data instanceof Uint8Array) {
  21883. dest.set(data, offset);
  21884. } else if (typeof data === "string") {
  21885. for (let i = 0, ii = data.length; i < ii; i++) {
  21886. dest[offset++] = data.charCodeAt(i) & 0xff;
  21887. }
  21888. } else {
  21889. for (const num of data) {
  21890. dest[offset++] = num & 0xff;
  21891. }
  21892. }
  21893. }
  21894. const OTF_HEADER_SIZE = 12;
  21895. const OTF_TABLE_ENTRY_SIZE = 16;
  21896. class OpenTypeFileBuilder {
  21897. constructor(sfnt) {
  21898. this.sfnt = sfnt;
  21899. this.tables = Object.create(null);
  21900. }
  21901. static getSearchParams(entriesCount, entrySize) {
  21902. let maxPower2 = 1,
  21903. log2 = 0;
  21904. while ((maxPower2 ^ entriesCount) > maxPower2) {
  21905. maxPower2 <<= 1;
  21906. log2++;
  21907. }
  21908. const searchRange = maxPower2 * entrySize;
  21909. return {
  21910. range: searchRange,
  21911. entry: log2,
  21912. rangeShift: entrySize * entriesCount - searchRange
  21913. };
  21914. }
  21915. toArray() {
  21916. let sfnt = this.sfnt;
  21917. const tables = this.tables;
  21918. const tablesNames = Object.keys(tables);
  21919. tablesNames.sort();
  21920. const numTables = tablesNames.length;
  21921. let i, j, jj, table, tableName;
  21922. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  21923. const tableOffsets = [offset];
  21924. for (i = 0; i < numTables; i++) {
  21925. table = tables[tablesNames[i]];
  21926. const paddedLength = (table.length + 3 & ~3) >>> 0;
  21927. offset += paddedLength;
  21928. tableOffsets.push(offset);
  21929. }
  21930. const file = new Uint8Array(offset);
  21931. for (i = 0; i < numTables; i++) {
  21932. table = tables[tablesNames[i]];
  21933. writeData(file, tableOffsets[i], table);
  21934. }
  21935. if (sfnt === "true") {
  21936. sfnt = string32(0x00010000);
  21937. }
  21938. file[0] = sfnt.charCodeAt(0) & 0xff;
  21939. file[1] = sfnt.charCodeAt(1) & 0xff;
  21940. file[2] = sfnt.charCodeAt(2) & 0xff;
  21941. file[3] = sfnt.charCodeAt(3) & 0xff;
  21942. writeInt16(file, 4, numTables);
  21943. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  21944. writeInt16(file, 6, searchParams.range);
  21945. writeInt16(file, 8, searchParams.entry);
  21946. writeInt16(file, 10, searchParams.rangeShift);
  21947. offset = OTF_HEADER_SIZE;
  21948. for (i = 0; i < numTables; i++) {
  21949. tableName = tablesNames[i];
  21950. file[offset] = tableName.charCodeAt(0) & 0xff;
  21951. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  21952. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  21953. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  21954. let checksum = 0;
  21955. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  21956. const quad = readUint32(file, j);
  21957. checksum = checksum + quad >>> 0;
  21958. }
  21959. writeInt32(file, offset + 4, checksum);
  21960. writeInt32(file, offset + 8, tableOffsets[i]);
  21961. writeInt32(file, offset + 12, tables[tableName].length);
  21962. offset += OTF_TABLE_ENTRY_SIZE;
  21963. }
  21964. return file;
  21965. }
  21966. addTable(tag, data) {
  21967. if (tag in this.tables) {
  21968. throw new Error("Table " + tag + " already exists");
  21969. }
  21970. this.tables[tag] = data;
  21971. }
  21972. }
  21973. ;// ./src/core/type1_parser.js
  21974. const HINTING_ENABLED = false;
  21975. const COMMAND_MAP = {
  21976. hstem: [1],
  21977. vstem: [3],
  21978. vmoveto: [4],
  21979. rlineto: [5],
  21980. hlineto: [6],
  21981. vlineto: [7],
  21982. rrcurveto: [8],
  21983. callsubr: [10],
  21984. flex: [12, 35],
  21985. drop: [12, 18],
  21986. endchar: [14],
  21987. rmoveto: [21],
  21988. hmoveto: [22],
  21989. vhcurveto: [30],
  21990. hvcurveto: [31]
  21991. };
  21992. class Type1CharString {
  21993. constructor() {
  21994. this.width = 0;
  21995. this.lsb = 0;
  21996. this.flexing = false;
  21997. this.output = [];
  21998. this.stack = [];
  21999. }
  22000. convert(encoded, subrs, seacAnalysisEnabled) {
  22001. const count = encoded.length;
  22002. let error = false;
  22003. let wx, sbx, subrNumber;
  22004. for (let i = 0; i < count; i++) {
  22005. let value = encoded[i];
  22006. if (value < 32) {
  22007. if (value === 12) {
  22008. value = (value << 8) + encoded[++i];
  22009. }
  22010. switch (value) {
  22011. case 1:
  22012. if (!HINTING_ENABLED) {
  22013. this.stack = [];
  22014. break;
  22015. }
  22016. error = this.executeCommand(2, COMMAND_MAP.hstem);
  22017. break;
  22018. case 3:
  22019. if (!HINTING_ENABLED) {
  22020. this.stack = [];
  22021. break;
  22022. }
  22023. error = this.executeCommand(2, COMMAND_MAP.vstem);
  22024. break;
  22025. case 4:
  22026. if (this.flexing) {
  22027. if (this.stack.length < 1) {
  22028. error = true;
  22029. break;
  22030. }
  22031. const dy = this.stack.pop();
  22032. this.stack.push(0, dy);
  22033. break;
  22034. }
  22035. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  22036. break;
  22037. case 5:
  22038. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  22039. break;
  22040. case 6:
  22041. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  22042. break;
  22043. case 7:
  22044. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  22045. break;
  22046. case 8:
  22047. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  22048. break;
  22049. case 9:
  22050. this.stack = [];
  22051. break;
  22052. case 10:
  22053. if (this.stack.length < 1) {
  22054. error = true;
  22055. break;
  22056. }
  22057. subrNumber = this.stack.pop();
  22058. if (!subrs[subrNumber]) {
  22059. error = true;
  22060. break;
  22061. }
  22062. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  22063. break;
  22064. case 11:
  22065. return error;
  22066. case 13:
  22067. if (this.stack.length < 2) {
  22068. error = true;
  22069. break;
  22070. }
  22071. wx = this.stack.pop();
  22072. sbx = this.stack.pop();
  22073. this.lsb = sbx;
  22074. this.width = wx;
  22075. this.stack.push(wx, sbx);
  22076. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  22077. break;
  22078. case 14:
  22079. this.output.push(COMMAND_MAP.endchar[0]);
  22080. break;
  22081. case 21:
  22082. if (this.flexing) {
  22083. break;
  22084. }
  22085. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  22086. break;
  22087. case 22:
  22088. if (this.flexing) {
  22089. this.stack.push(0);
  22090. break;
  22091. }
  22092. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  22093. break;
  22094. case 30:
  22095. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  22096. break;
  22097. case 31:
  22098. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  22099. break;
  22100. case (12 << 8) + 0:
  22101. this.stack = [];
  22102. break;
  22103. case (12 << 8) + 1:
  22104. if (!HINTING_ENABLED) {
  22105. this.stack = [];
  22106. break;
  22107. }
  22108. error = this.executeCommand(2, COMMAND_MAP.vstem);
  22109. break;
  22110. case (12 << 8) + 2:
  22111. if (!HINTING_ENABLED) {
  22112. this.stack = [];
  22113. break;
  22114. }
  22115. error = this.executeCommand(2, COMMAND_MAP.hstem);
  22116. break;
  22117. case (12 << 8) + 6:
  22118. if (seacAnalysisEnabled) {
  22119. const asb = this.stack.at(-5);
  22120. this.seac = this.stack.splice(-4, 4);
  22121. this.seac[0] += this.lsb - asb;
  22122. error = this.executeCommand(0, COMMAND_MAP.endchar);
  22123. } else {
  22124. error = this.executeCommand(4, COMMAND_MAP.endchar);
  22125. }
  22126. break;
  22127. case (12 << 8) + 7:
  22128. if (this.stack.length < 4) {
  22129. error = true;
  22130. break;
  22131. }
  22132. this.stack.pop();
  22133. wx = this.stack.pop();
  22134. const sby = this.stack.pop();
  22135. sbx = this.stack.pop();
  22136. this.lsb = sbx;
  22137. this.width = wx;
  22138. this.stack.push(wx, sbx, sby);
  22139. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  22140. break;
  22141. case (12 << 8) + 12:
  22142. if (this.stack.length < 2) {
  22143. error = true;
  22144. break;
  22145. }
  22146. const num2 = this.stack.pop();
  22147. const num1 = this.stack.pop();
  22148. this.stack.push(num1 / num2);
  22149. break;
  22150. case (12 << 8) + 16:
  22151. if (this.stack.length < 2) {
  22152. error = true;
  22153. break;
  22154. }
  22155. subrNumber = this.stack.pop();
  22156. const numArgs = this.stack.pop();
  22157. if (subrNumber === 0 && numArgs === 3) {
  22158. const flexArgs = this.stack.splice(-17, 17);
  22159. this.stack.push(flexArgs[2] + flexArgs[0], flexArgs[3] + flexArgs[1], flexArgs[4], flexArgs[5], flexArgs[6], flexArgs[7], flexArgs[8], flexArgs[9], flexArgs[10], flexArgs[11], flexArgs[12], flexArgs[13], flexArgs[14]);
  22160. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  22161. this.flexing = false;
  22162. this.stack.push(flexArgs[15], flexArgs[16]);
  22163. } else if (subrNumber === 1 && numArgs === 0) {
  22164. this.flexing = true;
  22165. }
  22166. break;
  22167. case (12 << 8) + 17:
  22168. break;
  22169. case (12 << 8) + 33:
  22170. this.stack = [];
  22171. break;
  22172. default:
  22173. warn('Unknown type 1 charstring command of "' + value + '"');
  22174. break;
  22175. }
  22176. if (error) {
  22177. break;
  22178. }
  22179. continue;
  22180. } else if (value <= 246) {
  22181. value -= 139;
  22182. } else if (value <= 250) {
  22183. value = (value - 247) * 256 + encoded[++i] + 108;
  22184. } else if (value <= 254) {
  22185. value = -((value - 251) * 256) - encoded[++i] - 108;
  22186. } else {
  22187. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  22188. }
  22189. this.stack.push(value);
  22190. }
  22191. return error;
  22192. }
  22193. executeCommand(howManyArgs, command, keepStack) {
  22194. const stackLength = this.stack.length;
  22195. if (howManyArgs > stackLength) {
  22196. return true;
  22197. }
  22198. const start = stackLength - howManyArgs;
  22199. for (let i = start; i < stackLength; i++) {
  22200. let value = this.stack[i];
  22201. if (Number.isInteger(value)) {
  22202. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  22203. } else {
  22204. value = 65536 * value | 0;
  22205. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  22206. }
  22207. }
  22208. this.output.push(...command);
  22209. if (keepStack) {
  22210. this.stack.splice(start, howManyArgs);
  22211. } else {
  22212. this.stack.length = 0;
  22213. }
  22214. return false;
  22215. }
  22216. }
  22217. const EEXEC_ENCRYPT_KEY = 55665;
  22218. const CHAR_STRS_ENCRYPT_KEY = 4330;
  22219. function isHexDigit(code) {
  22220. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  22221. }
  22222. function decrypt(data, key, discardNumber) {
  22223. if (discardNumber >= data.length) {
  22224. return new Uint8Array(0);
  22225. }
  22226. const c1 = 52845,
  22227. c2 = 22719;
  22228. let r = key | 0,
  22229. i,
  22230. j;
  22231. for (i = 0; i < discardNumber; i++) {
  22232. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  22233. }
  22234. const count = data.length - discardNumber;
  22235. const decrypted = new Uint8Array(count);
  22236. for (i = discardNumber, j = 0; j < count; i++, j++) {
  22237. const value = data[i];
  22238. decrypted[j] = value ^ r >> 8;
  22239. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  22240. }
  22241. return decrypted;
  22242. }
  22243. function decryptAscii(data, key, discardNumber) {
  22244. const c1 = 52845,
  22245. c2 = 22719;
  22246. let r = key | 0;
  22247. const count = data.length,
  22248. maybeLength = count >>> 1;
  22249. const decrypted = new Uint8Array(maybeLength);
  22250. let i, j;
  22251. for (i = 0, j = 0; i < count; i++) {
  22252. const digit1 = data[i];
  22253. if (!isHexDigit(digit1)) {
  22254. continue;
  22255. }
  22256. i++;
  22257. let digit2;
  22258. while (i < count && !isHexDigit(digit2 = data[i])) {
  22259. i++;
  22260. }
  22261. if (i < count) {
  22262. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  22263. decrypted[j++] = value ^ r >> 8;
  22264. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  22265. }
  22266. }
  22267. return decrypted.slice(discardNumber, j);
  22268. }
  22269. function isSpecial(c) {
  22270. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  22271. }
  22272. class Type1Parser {
  22273. constructor(stream, encrypted, seacAnalysisEnabled) {
  22274. if (encrypted) {
  22275. const data = stream.getBytes();
  22276. const isBinary = !((isHexDigit(data[0]) || isWhiteSpace(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
  22277. stream = new Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  22278. }
  22279. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  22280. this.stream = stream;
  22281. this.nextChar();
  22282. }
  22283. readNumberArray() {
  22284. this.getToken();
  22285. const array = [];
  22286. while (true) {
  22287. const token = this.getToken();
  22288. if (token === null || token === "]" || token === "}") {
  22289. break;
  22290. }
  22291. array.push(parseFloat(token || 0));
  22292. }
  22293. return array;
  22294. }
  22295. readNumber() {
  22296. const token = this.getToken();
  22297. return parseFloat(token || 0);
  22298. }
  22299. readInt() {
  22300. const token = this.getToken();
  22301. return parseInt(token || 0, 10) | 0;
  22302. }
  22303. readBoolean() {
  22304. const token = this.getToken();
  22305. return token === "true" ? 1 : 0;
  22306. }
  22307. nextChar() {
  22308. return this.currentChar = this.stream.getByte();
  22309. }
  22310. prevChar() {
  22311. this.stream.skip(-2);
  22312. return this.currentChar = this.stream.getByte();
  22313. }
  22314. getToken() {
  22315. let comment = false;
  22316. let ch = this.currentChar;
  22317. while (true) {
  22318. if (ch === -1) {
  22319. return null;
  22320. }
  22321. if (comment) {
  22322. if (ch === 0x0a || ch === 0x0d) {
  22323. comment = false;
  22324. }
  22325. } else if (ch === 0x25) {
  22326. comment = true;
  22327. } else if (!isWhiteSpace(ch)) {
  22328. break;
  22329. }
  22330. ch = this.nextChar();
  22331. }
  22332. if (isSpecial(ch)) {
  22333. this.nextChar();
  22334. return String.fromCharCode(ch);
  22335. }
  22336. let token = "";
  22337. do {
  22338. token += String.fromCharCode(ch);
  22339. ch = this.nextChar();
  22340. } while (ch >= 0 && !isWhiteSpace(ch) && !isSpecial(ch));
  22341. return token;
  22342. }
  22343. readCharStrings(bytes, lenIV) {
  22344. if (lenIV === -1) {
  22345. return bytes;
  22346. }
  22347. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  22348. }
  22349. extractFontProgram(properties) {
  22350. const stream = this.stream;
  22351. const subrs = [],
  22352. charstrings = [];
  22353. const privateData = Object.create(null);
  22354. privateData.lenIV = 4;
  22355. const program = {
  22356. subrs: [],
  22357. charstrings: [],
  22358. properties: {
  22359. privateData
  22360. }
  22361. };
  22362. let token, length, data, lenIV;
  22363. while ((token = this.getToken()) !== null) {
  22364. if (token !== "/") {
  22365. continue;
  22366. }
  22367. token = this.getToken();
  22368. switch (token) {
  22369. case "CharStrings":
  22370. this.getToken();
  22371. this.getToken();
  22372. this.getToken();
  22373. this.getToken();
  22374. while (true) {
  22375. token = this.getToken();
  22376. if (token === null || token === "end") {
  22377. break;
  22378. }
  22379. if (token !== "/") {
  22380. continue;
  22381. }
  22382. const glyph = this.getToken();
  22383. length = this.readInt();
  22384. this.getToken();
  22385. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  22386. lenIV = program.properties.privateData.lenIV;
  22387. const encoded = this.readCharStrings(data, lenIV);
  22388. this.nextChar();
  22389. token = this.getToken();
  22390. if (token === "noaccess") {
  22391. this.getToken();
  22392. } else if (token === "/") {
  22393. this.prevChar();
  22394. }
  22395. charstrings.push({
  22396. glyph,
  22397. encoded
  22398. });
  22399. }
  22400. break;
  22401. case "Subrs":
  22402. this.readInt();
  22403. this.getToken();
  22404. while (this.getToken() === "dup") {
  22405. const index = this.readInt();
  22406. length = this.readInt();
  22407. this.getToken();
  22408. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  22409. lenIV = program.properties.privateData.lenIV;
  22410. const encoded = this.readCharStrings(data, lenIV);
  22411. this.nextChar();
  22412. token = this.getToken();
  22413. if (token === "noaccess") {
  22414. this.getToken();
  22415. }
  22416. subrs[index] = encoded;
  22417. }
  22418. break;
  22419. case "BlueValues":
  22420. case "OtherBlues":
  22421. case "FamilyBlues":
  22422. case "FamilyOtherBlues":
  22423. const blueArray = this.readNumberArray();
  22424. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  22425. program.properties.privateData[token] = blueArray;
  22426. }
  22427. break;
  22428. case "StemSnapH":
  22429. case "StemSnapV":
  22430. program.properties.privateData[token] = this.readNumberArray();
  22431. break;
  22432. case "StdHW":
  22433. case "StdVW":
  22434. program.properties.privateData[token] = this.readNumberArray()[0];
  22435. break;
  22436. case "BlueShift":
  22437. case "lenIV":
  22438. case "BlueFuzz":
  22439. case "BlueScale":
  22440. case "LanguageGroup":
  22441. program.properties.privateData[token] = this.readNumber();
  22442. break;
  22443. case "ExpansionFactor":
  22444. program.properties.privateData[token] = this.readNumber() || 0.06;
  22445. break;
  22446. case "ForceBold":
  22447. program.properties.privateData[token] = this.readBoolean();
  22448. break;
  22449. }
  22450. }
  22451. for (const {
  22452. encoded,
  22453. glyph
  22454. } of charstrings) {
  22455. const charString = new Type1CharString();
  22456. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  22457. let output = charString.output;
  22458. if (error) {
  22459. output = [14];
  22460. }
  22461. const charStringObject = {
  22462. glyphName: glyph,
  22463. charstring: output,
  22464. width: charString.width,
  22465. lsb: charString.lsb,
  22466. seac: charString.seac
  22467. };
  22468. if (glyph === ".notdef") {
  22469. program.charstrings.unshift(charStringObject);
  22470. } else {
  22471. program.charstrings.push(charStringObject);
  22472. }
  22473. if (properties.builtInEncoding) {
  22474. const index = properties.builtInEncoding.indexOf(glyph);
  22475. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  22476. properties.widths[index] = charString.width;
  22477. }
  22478. }
  22479. }
  22480. return program;
  22481. }
  22482. extractFontHeader(properties) {
  22483. let token;
  22484. while ((token = this.getToken()) !== null) {
  22485. if (token !== "/") {
  22486. continue;
  22487. }
  22488. token = this.getToken();
  22489. switch (token) {
  22490. case "FontMatrix":
  22491. const matrix = this.readNumberArray();
  22492. properties.fontMatrix = matrix;
  22493. break;
  22494. case "Encoding":
  22495. const encodingArg = this.getToken();
  22496. let encoding;
  22497. if (!/^\d+$/.test(encodingArg)) {
  22498. encoding = getEncoding(encodingArg);
  22499. } else {
  22500. encoding = [];
  22501. const size = parseInt(encodingArg, 10) | 0;
  22502. this.getToken();
  22503. for (let j = 0; j < size; j++) {
  22504. token = this.getToken();
  22505. while (token !== "dup" && token !== "def") {
  22506. token = this.getToken();
  22507. if (token === null) {
  22508. return;
  22509. }
  22510. }
  22511. if (token === "def") {
  22512. break;
  22513. }
  22514. const index = this.readInt();
  22515. this.getToken();
  22516. const glyph = this.getToken();
  22517. encoding[index] = glyph;
  22518. this.getToken();
  22519. }
  22520. }
  22521. properties.builtInEncoding = encoding;
  22522. break;
  22523. case "FontBBox":
  22524. const fontBBox = this.readNumberArray();
  22525. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  22526. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  22527. properties.ascentScaled = true;
  22528. break;
  22529. }
  22530. }
  22531. }
  22532. }
  22533. ;// ./src/core/type1_font.js
  22534. function findBlock(streamBytes, signature, startIndex) {
  22535. const streamBytesLength = streamBytes.length;
  22536. const signatureLength = signature.length;
  22537. const scanLength = streamBytesLength - signatureLength;
  22538. let i = startIndex,
  22539. found = false;
  22540. while (i < scanLength) {
  22541. let j = 0;
  22542. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  22543. j++;
  22544. }
  22545. if (j >= signatureLength) {
  22546. i += j;
  22547. while (i < streamBytesLength && isWhiteSpace(streamBytes[i])) {
  22548. i++;
  22549. }
  22550. found = true;
  22551. break;
  22552. }
  22553. i++;
  22554. }
  22555. return {
  22556. found,
  22557. length: i
  22558. };
  22559. }
  22560. function getHeaderBlock(stream, suggestedLength) {
  22561. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  22562. const streamStartPos = stream.pos;
  22563. let headerBytes, headerBytesLength, block;
  22564. try {
  22565. headerBytes = stream.getBytes(suggestedLength);
  22566. headerBytesLength = headerBytes.length;
  22567. } catch {}
  22568. if (headerBytesLength === suggestedLength) {
  22569. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  22570. if (block.found && block.length === suggestedLength) {
  22571. return {
  22572. stream: new Stream(headerBytes),
  22573. length: suggestedLength
  22574. };
  22575. }
  22576. }
  22577. warn('Invalid "Length1" property in Type1 font -- trying to recover.');
  22578. stream.pos = streamStartPos;
  22579. const SCAN_BLOCK_LENGTH = 2048;
  22580. let actualLength;
  22581. while (true) {
  22582. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  22583. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  22584. if (block.length === 0) {
  22585. break;
  22586. }
  22587. stream.pos += block.length;
  22588. if (block.found) {
  22589. actualLength = stream.pos - streamStartPos;
  22590. break;
  22591. }
  22592. }
  22593. stream.pos = streamStartPos;
  22594. if (actualLength) {
  22595. return {
  22596. stream: new Stream(stream.getBytes(actualLength)),
  22597. length: actualLength
  22598. };
  22599. }
  22600. warn('Unable to recover "Length1" property in Type1 font -- using as is.');
  22601. return {
  22602. stream: new Stream(stream.getBytes(suggestedLength)),
  22603. length: suggestedLength
  22604. };
  22605. }
  22606. function getEexecBlock(stream, suggestedLength) {
  22607. const eexecBytes = stream.getBytes();
  22608. if (eexecBytes.length === 0) {
  22609. throw new FormatError("getEexecBlock - no font program found.");
  22610. }
  22611. return {
  22612. stream: new Stream(eexecBytes),
  22613. length: eexecBytes.length
  22614. };
  22615. }
  22616. class Type1Font {
  22617. constructor(name, file, properties) {
  22618. const PFB_HEADER_SIZE = 6;
  22619. let headerBlockLength = properties.length1;
  22620. let eexecBlockLength = properties.length2;
  22621. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  22622. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  22623. if (pfbHeaderPresent) {
  22624. file.skip(PFB_HEADER_SIZE);
  22625. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22626. }
  22627. const headerBlock = getHeaderBlock(file, headerBlockLength);
  22628. const headerBlockParser = new Type1Parser(headerBlock.stream, false, SEAC_ANALYSIS_ENABLED);
  22629. headerBlockParser.extractFontHeader(properties);
  22630. if (pfbHeaderPresent) {
  22631. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  22632. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  22633. }
  22634. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  22635. const eexecBlockParser = new Type1Parser(eexecBlock.stream, true, SEAC_ANALYSIS_ENABLED);
  22636. const data = eexecBlockParser.extractFontProgram(properties);
  22637. for (const key in data.properties) {
  22638. properties[key] = data.properties[key];
  22639. }
  22640. const charstrings = data.charstrings;
  22641. const type2Charstrings = this.getType2Charstrings(charstrings);
  22642. const subrs = this.getType2Subrs(data.subrs);
  22643. this.charstrings = charstrings;
  22644. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  22645. this.seacs = this.getSeacs(data.charstrings);
  22646. }
  22647. get numGlyphs() {
  22648. return this.charstrings.length + 1;
  22649. }
  22650. getCharset() {
  22651. const charset = [".notdef"];
  22652. for (const {
  22653. glyphName
  22654. } of this.charstrings) {
  22655. charset.push(glyphName);
  22656. }
  22657. return charset;
  22658. }
  22659. getGlyphMapping(properties) {
  22660. const charstrings = this.charstrings;
  22661. if (properties.composite) {
  22662. const charCodeToGlyphId = Object.create(null);
  22663. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  22664. const charCode = properties.cMap.charCodeOf(glyphId);
  22665. charCodeToGlyphId[charCode] = glyphId + 1;
  22666. }
  22667. return charCodeToGlyphId;
  22668. }
  22669. const glyphNames = [".notdef"];
  22670. let builtInEncoding, glyphId;
  22671. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  22672. glyphNames.push(charstrings[glyphId].glyphName);
  22673. }
  22674. const encoding = properties.builtInEncoding;
  22675. if (encoding) {
  22676. builtInEncoding = Object.create(null);
  22677. for (const charCode in encoding) {
  22678. glyphId = glyphNames.indexOf(encoding[charCode]);
  22679. if (glyphId >= 0) {
  22680. builtInEncoding[charCode] = glyphId;
  22681. }
  22682. }
  22683. }
  22684. return type1FontGlyphMapping(properties, builtInEncoding, glyphNames);
  22685. }
  22686. hasGlyphId(id) {
  22687. if (id < 0 || id >= this.numGlyphs) {
  22688. return false;
  22689. }
  22690. if (id === 0) {
  22691. return true;
  22692. }
  22693. const glyph = this.charstrings[id - 1];
  22694. return glyph.charstring.length > 0;
  22695. }
  22696. getSeacs(charstrings) {
  22697. const seacMap = [];
  22698. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  22699. const charstring = charstrings[i];
  22700. if (charstring.seac) {
  22701. seacMap[i + 1] = charstring.seac;
  22702. }
  22703. }
  22704. return seacMap;
  22705. }
  22706. getType2Charstrings(type1Charstrings) {
  22707. const type2Charstrings = [];
  22708. for (const type1Charstring of type1Charstrings) {
  22709. type2Charstrings.push(type1Charstring.charstring);
  22710. }
  22711. return type2Charstrings;
  22712. }
  22713. getType2Subrs(type1Subrs) {
  22714. let bias = 0;
  22715. const count = type1Subrs.length;
  22716. if (count < 1133) {
  22717. bias = 107;
  22718. } else if (count < 33769) {
  22719. bias = 1131;
  22720. } else {
  22721. bias = 32768;
  22722. }
  22723. const type2Subrs = [];
  22724. let i;
  22725. for (i = 0; i < bias; i++) {
  22726. type2Subrs.push([0x0b]);
  22727. }
  22728. for (i = 0; i < count; i++) {
  22729. type2Subrs.push(type1Subrs[i]);
  22730. }
  22731. return type2Subrs;
  22732. }
  22733. wrap(name, glyphs, charstrings, subrs, properties) {
  22734. const cff = new CFF();
  22735. cff.header = new CFFHeader(1, 0, 4, 4);
  22736. cff.names = [name];
  22737. const topDict = new CFFTopDict();
  22738. topDict.setByName("version", 391);
  22739. topDict.setByName("Notice", 392);
  22740. topDict.setByName("FullName", 393);
  22741. topDict.setByName("FamilyName", 394);
  22742. topDict.setByName("Weight", 395);
  22743. topDict.setByName("Encoding", null);
  22744. topDict.setByName("FontMatrix", properties.fontMatrix);
  22745. topDict.setByName("FontBBox", properties.bbox);
  22746. topDict.setByName("charset", null);
  22747. topDict.setByName("CharStrings", null);
  22748. topDict.setByName("Private", null);
  22749. cff.topDict = topDict;
  22750. const strings = new CFFStrings();
  22751. strings.add("Version 0.11");
  22752. strings.add("See original notice");
  22753. strings.add(name);
  22754. strings.add(name);
  22755. strings.add("Medium");
  22756. cff.strings = strings;
  22757. cff.globalSubrIndex = new CFFIndex();
  22758. const count = glyphs.length;
  22759. const charsetArray = [".notdef"];
  22760. let i, ii;
  22761. for (i = 0; i < count; i++) {
  22762. const glyphName = charstrings[i].glyphName;
  22763. const index = CFFStandardStrings.indexOf(glyphName);
  22764. if (index === -1) {
  22765. strings.add(glyphName);
  22766. }
  22767. charsetArray.push(glyphName);
  22768. }
  22769. cff.charset = new CFFCharset(false, 0, charsetArray);
  22770. const charStringsIndex = new CFFIndex();
  22771. charStringsIndex.add([0x8b, 0x0e]);
  22772. for (i = 0; i < count; i++) {
  22773. charStringsIndex.add(glyphs[i]);
  22774. }
  22775. cff.charStrings = charStringsIndex;
  22776. const privateDict = new CFFPrivateDict();
  22777. privateDict.setByName("Subrs", null);
  22778. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  22779. for (i = 0, ii = fields.length; i < ii; i++) {
  22780. const field = fields[i];
  22781. if (!(field in properties.privateData)) {
  22782. continue;
  22783. }
  22784. const value = properties.privateData[field];
  22785. if (Array.isArray(value)) {
  22786. for (let j = value.length - 1; j > 0; j--) {
  22787. value[j] -= value[j - 1];
  22788. }
  22789. }
  22790. privateDict.setByName(field, value);
  22791. }
  22792. cff.topDict.privateDict = privateDict;
  22793. const subrIndex = new CFFIndex();
  22794. for (i = 0, ii = subrs.length; i < ii; i++) {
  22795. subrIndex.add(subrs[i]);
  22796. }
  22797. privateDict.subrsIndex = subrIndex;
  22798. const compiler = new CFFCompiler(cff);
  22799. return compiler.compile();
  22800. }
  22801. }
  22802. ;// ./src/core/fonts.js
  22803. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  22804. const PDF_GLYPH_SPACE_UNITS = 1000;
  22805. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "isInvalidPDFjsFont", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "systemFontInfo", "type", "vertical"];
  22806. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  22807. function adjustWidths(properties) {
  22808. if (!properties.fontMatrix) {
  22809. return;
  22810. }
  22811. if (properties.fontMatrix[0] === FONT_IDENTITY_MATRIX[0]) {
  22812. return;
  22813. }
  22814. const scale = 0.001 / properties.fontMatrix[0];
  22815. const glyphsWidths = properties.widths;
  22816. for (const glyph in glyphsWidths) {
  22817. glyphsWidths[glyph] *= scale;
  22818. }
  22819. properties.defaultWidth *= scale;
  22820. }
  22821. function adjustTrueTypeToUnicode(properties, isSymbolicFont, nameRecords) {
  22822. if (properties.isInternalFont) {
  22823. return;
  22824. }
  22825. if (properties.hasIncludedToUnicodeMap) {
  22826. return;
  22827. }
  22828. if (properties.hasEncoding) {
  22829. return;
  22830. }
  22831. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22832. return;
  22833. }
  22834. if (!isSymbolicFont) {
  22835. return;
  22836. }
  22837. if (nameRecords.length === 0) {
  22838. return;
  22839. }
  22840. if (properties.defaultEncoding === WinAnsiEncoding) {
  22841. return;
  22842. }
  22843. for (const r of nameRecords) {
  22844. if (!isWinNameRecord(r)) {
  22845. return;
  22846. }
  22847. }
  22848. const encoding = WinAnsiEncoding;
  22849. const toUnicode = [],
  22850. glyphsUnicodeMap = getGlyphsUnicode();
  22851. for (const charCode in encoding) {
  22852. const glyphName = encoding[charCode];
  22853. if (glyphName === "") {
  22854. continue;
  22855. }
  22856. const unicode = glyphsUnicodeMap[glyphName];
  22857. if (unicode === undefined) {
  22858. continue;
  22859. }
  22860. toUnicode[charCode] = String.fromCharCode(unicode);
  22861. }
  22862. if (toUnicode.length > 0) {
  22863. properties.toUnicode.amend(toUnicode);
  22864. }
  22865. }
  22866. function adjustType1ToUnicode(properties, builtInEncoding) {
  22867. if (properties.isInternalFont) {
  22868. return;
  22869. }
  22870. if (properties.hasIncludedToUnicodeMap) {
  22871. return;
  22872. }
  22873. if (builtInEncoding === properties.defaultEncoding) {
  22874. return;
  22875. }
  22876. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22877. return;
  22878. }
  22879. const toUnicode = [],
  22880. glyphsUnicodeMap = getGlyphsUnicode();
  22881. for (const charCode in builtInEncoding) {
  22882. if (properties.hasEncoding) {
  22883. if (properties.baseEncodingName || properties.differences[charCode] !== undefined) {
  22884. continue;
  22885. }
  22886. }
  22887. const glyphName = builtInEncoding[charCode];
  22888. const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  22889. if (unicode !== -1) {
  22890. toUnicode[charCode] = String.fromCharCode(unicode);
  22891. }
  22892. }
  22893. if (toUnicode.length > 0) {
  22894. properties.toUnicode.amend(toUnicode);
  22895. }
  22896. }
  22897. function amendFallbackToUnicode(properties) {
  22898. if (!properties.fallbackToUnicode) {
  22899. return;
  22900. }
  22901. if (properties.toUnicode instanceof IdentityToUnicodeMap) {
  22902. return;
  22903. }
  22904. const toUnicode = [];
  22905. for (const charCode in properties.fallbackToUnicode) {
  22906. if (properties.toUnicode.has(charCode)) {
  22907. continue;
  22908. }
  22909. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  22910. }
  22911. if (toUnicode.length > 0) {
  22912. properties.toUnicode.amend(toUnicode);
  22913. }
  22914. }
  22915. class fonts_Glyph {
  22916. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  22917. this.originalCharCode = originalCharCode;
  22918. this.fontChar = fontChar;
  22919. this.unicode = unicode;
  22920. this.accent = accent;
  22921. this.width = width;
  22922. this.vmetric = vmetric;
  22923. this.operatorListId = operatorListId;
  22924. this.isSpace = isSpace;
  22925. this.isInFont = isInFont;
  22926. }
  22927. get category() {
  22928. return shadow(this, "category", getCharUnicodeCategory(this.unicode), true);
  22929. }
  22930. }
  22931. function int16(b0, b1) {
  22932. return (b0 << 8) + b1;
  22933. }
  22934. function writeSignedInt16(bytes, index, value) {
  22935. bytes[index + 1] = value;
  22936. bytes[index] = value >>> 8;
  22937. }
  22938. function signedInt16(b0, b1) {
  22939. const value = (b0 << 8) + b1;
  22940. return value & 1 << 15 ? value - 0x10000 : value;
  22941. }
  22942. function writeUint32(bytes, index, value) {
  22943. bytes[index + 3] = value & 0xff;
  22944. bytes[index + 2] = value >>> 8;
  22945. bytes[index + 1] = value >>> 16;
  22946. bytes[index] = value >>> 24;
  22947. }
  22948. function int32(b0, b1, b2, b3) {
  22949. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  22950. }
  22951. function string16(value) {
  22952. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  22953. }
  22954. function safeString16(value) {
  22955. if (value > 0x7fff) {
  22956. value = 0x7fff;
  22957. } else if (value < -0x8000) {
  22958. value = -0x8000;
  22959. }
  22960. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  22961. }
  22962. function isTrueTypeFile(file) {
  22963. const header = file.peekBytes(4);
  22964. return readUint32(header, 0) === 0x00010000 || bytesToString(header) === "true";
  22965. }
  22966. function isTrueTypeCollectionFile(file) {
  22967. const header = file.peekBytes(4);
  22968. return bytesToString(header) === "ttcf";
  22969. }
  22970. function isOpenTypeFile(file) {
  22971. const header = file.peekBytes(4);
  22972. return bytesToString(header) === "OTTO";
  22973. }
  22974. function isType1File(file) {
  22975. const header = file.peekBytes(2);
  22976. if (header[0] === 0x25 && header[1] === 0x21) {
  22977. return true;
  22978. }
  22979. if (header[0] === 0x80 && header[1] === 0x01) {
  22980. return true;
  22981. }
  22982. return false;
  22983. }
  22984. function isCFFFile(file) {
  22985. const header = file.peekBytes(4);
  22986. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  22987. return true;
  22988. }
  22989. return false;
  22990. }
  22991. function getFontFileType(file, {
  22992. type,
  22993. subtype,
  22994. composite
  22995. }) {
  22996. let fileType, fileSubtype;
  22997. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  22998. fileType = composite ? "CIDFontType2" : "TrueType";
  22999. } else if (isOpenTypeFile(file)) {
  23000. fileType = composite ? "CIDFontType2" : "OpenType";
  23001. } else if (isType1File(file)) {
  23002. if (composite) {
  23003. fileType = "CIDFontType0";
  23004. } else {
  23005. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23006. }
  23007. } else if (isCFFFile(file)) {
  23008. if (composite) {
  23009. fileType = "CIDFontType0";
  23010. fileSubtype = "CIDFontType0C";
  23011. } else {
  23012. fileType = type === "MMType1" ? "MMType1" : "Type1";
  23013. fileSubtype = "Type1C";
  23014. }
  23015. } else {
  23016. warn("getFontFileType: Unable to detect correct font file Type/Subtype.");
  23017. fileType = type;
  23018. fileSubtype = subtype;
  23019. }
  23020. return [fileType, fileSubtype];
  23021. }
  23022. function applyStandardFontGlyphMap(map, glyphMap) {
  23023. for (const charCode in glyphMap) {
  23024. map[+charCode] = glyphMap[charCode];
  23025. }
  23026. }
  23027. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  23028. const toFontChar = [];
  23029. let unicode;
  23030. for (let i = 0, ii = encoding.length; i < ii; i++) {
  23031. unicode = getUnicodeForGlyph(encoding[i], glyphsUnicodeMap);
  23032. if (unicode !== -1) {
  23033. toFontChar[i] = unicode;
  23034. }
  23035. }
  23036. for (const charCode in differences) {
  23037. unicode = getUnicodeForGlyph(differences[charCode], glyphsUnicodeMap);
  23038. if (unicode !== -1) {
  23039. toFontChar[+charCode] = unicode;
  23040. }
  23041. }
  23042. return toFontChar;
  23043. }
  23044. function isMacNameRecord(r) {
  23045. return r.platform === 1 && r.encoding === 0 && r.language === 0;
  23046. }
  23047. function isWinNameRecord(r) {
  23048. return r.platform === 3 && r.encoding === 1 && r.language === 0x409;
  23049. }
  23050. function convertCidString(charCode, cid, shouldThrow = false) {
  23051. switch (cid.length) {
  23052. case 1:
  23053. return cid.charCodeAt(0);
  23054. case 2:
  23055. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  23056. }
  23057. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  23058. if (shouldThrow) {
  23059. throw new FormatError(msg);
  23060. }
  23061. warn(msg);
  23062. return cid;
  23063. }
  23064. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId, toUnicode) {
  23065. const newMap = Object.create(null);
  23066. const toUnicodeExtraMap = new Map();
  23067. const toFontChar = [];
  23068. const usedGlyphIds = new Set();
  23069. let privateUseAreaIndex = 0;
  23070. const privateUseOffetStart = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23071. let nextAvailableFontCharCode = privateUseOffetStart;
  23072. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23073. const isInPrivateArea = code => PRIVATE_USE_AREAS[0][0] <= code && code <= PRIVATE_USE_AREAS[0][1] || PRIVATE_USE_AREAS[1][0] <= code && code <= PRIVATE_USE_AREAS[1][1];
  23074. for (const originalCharCode in charCodeToGlyphId) {
  23075. let glyphId = charCodeToGlyphId[originalCharCode];
  23076. if (!hasGlyph(glyphId)) {
  23077. continue;
  23078. }
  23079. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  23080. privateUseAreaIndex++;
  23081. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  23082. warn("Ran out of space in font private use area.");
  23083. break;
  23084. }
  23085. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  23086. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  23087. }
  23088. const fontCharCode = nextAvailableFontCharCode++;
  23089. if (glyphId === 0) {
  23090. glyphId = newGlyphZeroId;
  23091. }
  23092. let unicode = toUnicode.get(originalCharCode);
  23093. if (typeof unicode === "string") {
  23094. unicode = unicode.codePointAt(0);
  23095. }
  23096. if (unicode && !isInPrivateArea(unicode) && !usedGlyphIds.has(glyphId)) {
  23097. toUnicodeExtraMap.set(unicode, glyphId);
  23098. usedGlyphIds.add(glyphId);
  23099. }
  23100. newMap[fontCharCode] = glyphId;
  23101. toFontChar[originalCharCode] = fontCharCode;
  23102. }
  23103. return {
  23104. toFontChar,
  23105. charCodeToGlyphId: newMap,
  23106. toUnicodeExtraMap,
  23107. nextAvailableFontCharCode
  23108. };
  23109. }
  23110. function getRanges(glyphs, toUnicodeExtraMap, numGlyphs) {
  23111. const codes = [];
  23112. for (const charCode in glyphs) {
  23113. if (glyphs[charCode] >= numGlyphs) {
  23114. continue;
  23115. }
  23116. codes.push({
  23117. fontCharCode: charCode | 0,
  23118. glyphId: glyphs[charCode]
  23119. });
  23120. }
  23121. if (toUnicodeExtraMap) {
  23122. for (const [unicode, glyphId] of toUnicodeExtraMap) {
  23123. if (glyphId >= numGlyphs) {
  23124. continue;
  23125. }
  23126. codes.push({
  23127. fontCharCode: unicode,
  23128. glyphId
  23129. });
  23130. }
  23131. }
  23132. if (codes.length === 0) {
  23133. codes.push({
  23134. fontCharCode: 0,
  23135. glyphId: 0
  23136. });
  23137. }
  23138. codes.sort(function fontGetRangesSort(a, b) {
  23139. return a.fontCharCode - b.fontCharCode;
  23140. });
  23141. const ranges = [];
  23142. const length = codes.length;
  23143. for (let n = 0; n < length;) {
  23144. const start = codes[n].fontCharCode;
  23145. const codeIndices = [codes[n].glyphId];
  23146. ++n;
  23147. let end = start;
  23148. while (n < length && end + 1 === codes[n].fontCharCode) {
  23149. codeIndices.push(codes[n].glyphId);
  23150. ++end;
  23151. ++n;
  23152. if (end === 0xffff) {
  23153. break;
  23154. }
  23155. }
  23156. ranges.push([start, end, codeIndices]);
  23157. }
  23158. return ranges;
  23159. }
  23160. function createCmapTable(glyphs, toUnicodeExtraMap, numGlyphs) {
  23161. const ranges = getRanges(glyphs, toUnicodeExtraMap, numGlyphs);
  23162. const numTables = ranges.at(-1)[1] > 0xffff ? 2 : 1;
  23163. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + string32(4 + numTables * 8);
  23164. let i, ii, j, jj;
  23165. for (i = ranges.length - 1; i >= 0; --i) {
  23166. if (ranges[i][0] <= 0xffff) {
  23167. break;
  23168. }
  23169. }
  23170. const bmpLength = i + 1;
  23171. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  23172. ranges[i][1] = 0xfffe;
  23173. }
  23174. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  23175. const segCount = bmpLength + trailingRangesCount;
  23176. const searchParams = OpenTypeFileBuilder.getSearchParams(segCount, 2);
  23177. let startCount = "";
  23178. let endCount = "";
  23179. let idDeltas = "";
  23180. let idRangeOffsets = "";
  23181. let glyphsIds = "";
  23182. let bias = 0;
  23183. let range, start, end, codes;
  23184. for (i = 0, ii = bmpLength; i < ii; i++) {
  23185. range = ranges[i];
  23186. start = range[0];
  23187. end = range[1];
  23188. startCount += string16(start);
  23189. endCount += string16(end);
  23190. codes = range[2];
  23191. let contiguous = true;
  23192. for (j = 1, jj = codes.length; j < jj; ++j) {
  23193. if (codes[j] !== codes[j - 1] + 1) {
  23194. contiguous = false;
  23195. break;
  23196. }
  23197. }
  23198. if (!contiguous) {
  23199. const offset = (segCount - i) * 2 + bias * 2;
  23200. bias += end - start + 1;
  23201. idDeltas += string16(0);
  23202. idRangeOffsets += string16(offset);
  23203. for (j = 0, jj = codes.length; j < jj; ++j) {
  23204. glyphsIds += string16(codes[j]);
  23205. }
  23206. } else {
  23207. const startCode = codes[0];
  23208. idDeltas += string16(startCode - start & 0xffff);
  23209. idRangeOffsets += string16(0);
  23210. }
  23211. }
  23212. if (trailingRangesCount > 0) {
  23213. endCount += "\xFF\xFF";
  23214. startCount += "\xFF\xFF";
  23215. idDeltas += "\x00\x01";
  23216. idRangeOffsets += "\x00\x00";
  23217. }
  23218. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  23219. let format31012 = "";
  23220. let header31012 = "";
  23221. if (numTables > 1) {
  23222. cmap += "\x00\x03" + "\x00\x0A" + string32(4 + numTables * 8 + 4 + format314.length);
  23223. format31012 = "";
  23224. for (i = 0, ii = ranges.length; i < ii; i++) {
  23225. range = ranges[i];
  23226. start = range[0];
  23227. codes = range[2];
  23228. let code = codes[0];
  23229. for (j = 1, jj = codes.length; j < jj; ++j) {
  23230. if (codes[j] !== codes[j - 1] + 1) {
  23231. end = range[0] + j - 1;
  23232. format31012 += string32(start) + string32(end) + string32(code);
  23233. start = end + 1;
  23234. code = codes[j];
  23235. }
  23236. }
  23237. format31012 += string32(start) + string32(range[1]) + string32(code);
  23238. }
  23239. header31012 = "\x00\x0C" + "\x00\x00" + string32(format31012.length + 16) + "\x00\x00\x00\x00" + string32(format31012.length / 12);
  23240. }
  23241. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  23242. }
  23243. function validateOS2Table(os2, file) {
  23244. file.pos = (file.start || 0) + os2.offset;
  23245. const version = file.getUint16();
  23246. file.skip(60);
  23247. const selection = file.getUint16();
  23248. if (version < 4 && selection & 0x0300) {
  23249. return false;
  23250. }
  23251. const firstChar = file.getUint16();
  23252. const lastChar = file.getUint16();
  23253. if (firstChar > lastChar) {
  23254. return false;
  23255. }
  23256. file.skip(6);
  23257. const usWinAscent = file.getUint16();
  23258. if (usWinAscent === 0) {
  23259. return false;
  23260. }
  23261. os2.data[8] = os2.data[9] = 0;
  23262. return true;
  23263. }
  23264. function createOS2Table(properties, charstrings, override) {
  23265. override ||= {
  23266. unitsPerEm: 0,
  23267. yMax: 0,
  23268. yMin: 0,
  23269. ascent: 0,
  23270. descent: 0
  23271. };
  23272. let ulUnicodeRange1 = 0;
  23273. let ulUnicodeRange2 = 0;
  23274. let ulUnicodeRange3 = 0;
  23275. let ulUnicodeRange4 = 0;
  23276. let firstCharIndex = null;
  23277. let lastCharIndex = 0;
  23278. let position = -1;
  23279. if (charstrings) {
  23280. for (let code in charstrings) {
  23281. code |= 0;
  23282. if (firstCharIndex > code || !firstCharIndex) {
  23283. firstCharIndex = code;
  23284. }
  23285. if (lastCharIndex < code) {
  23286. lastCharIndex = code;
  23287. }
  23288. position = getUnicodeRangeFor(code, position);
  23289. if (position < 32) {
  23290. ulUnicodeRange1 |= 1 << position;
  23291. } else if (position < 64) {
  23292. ulUnicodeRange2 |= 1 << position - 32;
  23293. } else if (position < 96) {
  23294. ulUnicodeRange3 |= 1 << position - 64;
  23295. } else if (position < 123) {
  23296. ulUnicodeRange4 |= 1 << position - 96;
  23297. } else {
  23298. throw new FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  23299. }
  23300. }
  23301. if (lastCharIndex > 0xffff) {
  23302. lastCharIndex = 0xffff;
  23303. }
  23304. } else {
  23305. firstCharIndex = 0;
  23306. lastCharIndex = 255;
  23307. }
  23308. const bbox = properties.bbox || [0, 0, 0, 0];
  23309. const unitsPerEm = override.unitsPerEm || (properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000);
  23310. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  23311. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  23312. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  23313. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  23314. typoDescent = -typoDescent;
  23315. }
  23316. const winAscent = override.yMax || typoAscent;
  23317. const winDescent = -override.yMin || -typoDescent;
  23318. return "\x00\x03" + "\x02\x24" + "\x01\xF4" + "\x00\x05" + "\x00\x00" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x00\x8C" + "\x02\x8A" + "\x02\xBB" + "\x00\x00" + "\x01\xDF" + "\x00\x31" + "\x01\x02" + "\x00\x00" + "\x00\x00\x06" + String.fromCharCode(properties.fixedPitch ? 0x09 : 0x00) + "\x00\x00\x00\x00\x00\x00" + string32(ulUnicodeRange1) + string32(ulUnicodeRange2) + string32(ulUnicodeRange3) + string32(ulUnicodeRange4) + "\x2A\x32\x31\x2A" + string16(properties.italicAngle ? 1 : 0) + string16(firstCharIndex || properties.firstChar) + string16(lastCharIndex || properties.lastChar) + string16(typoAscent) + string16(typoDescent) + "\x00\x64" + string16(winAscent) + string16(winDescent) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + string16(properties.xHeight) + string16(properties.capHeight) + string16(0) + string16(firstCharIndex || properties.firstChar) + "\x00\x03";
  23319. }
  23320. function createPostTable(properties) {
  23321. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  23322. return "\x00\x03\x00\x00" + string32(angle) + "\x00\x00" + "\x00\x00" + string32(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  23323. }
  23324. function createPostscriptName(name) {
  23325. return name.replaceAll(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  23326. }
  23327. function createNameTable(name, proto) {
  23328. if (!proto) {
  23329. proto = [[], []];
  23330. }
  23331. const strings = [proto[0][0] || "Original licence", proto[0][1] || name, proto[0][2] || "Unknown", proto[0][3] || "uniqueID", proto[0][4] || name, proto[0][5] || "Version 0.11", proto[0][6] || createPostscriptName(name), proto[0][7] || "Unknown", proto[0][8] || "Unknown", proto[0][9] || "Unknown"];
  23332. const stringsUnicode = [];
  23333. let i, ii, j, jj, str;
  23334. for (i = 0, ii = strings.length; i < ii; i++) {
  23335. str = proto[1][i] || strings[i];
  23336. const strBufUnicode = [];
  23337. for (j = 0, jj = str.length; j < jj; j++) {
  23338. strBufUnicode.push(string16(str.charCodeAt(j)));
  23339. }
  23340. stringsUnicode.push(strBufUnicode.join(""));
  23341. }
  23342. const names = [strings, stringsUnicode];
  23343. const platforms = ["\x00\x01", "\x00\x03"];
  23344. const encodings = ["\x00\x00", "\x00\x01"];
  23345. const languages = ["\x00\x00", "\x04\x09"];
  23346. const namesRecordCount = strings.length * platforms.length;
  23347. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  23348. let strOffset = 0;
  23349. for (i = 0, ii = platforms.length; i < ii; i++) {
  23350. const strs = names[i];
  23351. for (j = 0, jj = strs.length; j < jj; j++) {
  23352. str = strs[j];
  23353. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  23354. nameTable += nameRecord;
  23355. strOffset += str.length;
  23356. }
  23357. }
  23358. nameTable += strings.join("") + stringsUnicode.join("");
  23359. return nameTable;
  23360. }
  23361. class Font {
  23362. constructor(name, file, properties) {
  23363. this.name = name;
  23364. this.psName = null;
  23365. this.mimetype = null;
  23366. this.disableFontFace = false;
  23367. this.loadedName = properties.loadedName;
  23368. this.isType3Font = properties.isType3Font;
  23369. this.missingFile = false;
  23370. this.cssFontInfo = properties.cssFontInfo;
  23371. this._charsCache = Object.create(null);
  23372. this._glyphCache = Object.create(null);
  23373. let isSerifFont = !!(properties.flags & FontFlags.Serif);
  23374. if (!isSerifFont && !properties.isSimulatedFlags) {
  23375. const baseName = name.replaceAll(/[,_]/g, "-").split("-", 1)[0],
  23376. serifFonts = getSerifFonts();
  23377. for (const namePart of baseName.split("+")) {
  23378. if (serifFonts[namePart]) {
  23379. isSerifFont = true;
  23380. break;
  23381. }
  23382. }
  23383. }
  23384. this.isSerifFont = isSerifFont;
  23385. this.isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  23386. this.isMonospace = !!(properties.flags & FontFlags.FixedPitch);
  23387. let {
  23388. type,
  23389. subtype
  23390. } = properties;
  23391. this.type = type;
  23392. this.subtype = subtype;
  23393. this.systemFontInfo = properties.systemFontInfo;
  23394. const matches = name.match(/^InvalidPDFjsFont_(.*)_\d+$/);
  23395. this.isInvalidPDFjsFont = !!matches;
  23396. if (this.isInvalidPDFjsFont) {
  23397. this.fallbackName = matches[1];
  23398. } else if (this.isMonospace) {
  23399. this.fallbackName = "monospace";
  23400. } else if (this.isSerifFont) {
  23401. this.fallbackName = "serif";
  23402. } else {
  23403. this.fallbackName = "sans-serif";
  23404. }
  23405. if (this.systemFontInfo?.guessFallback) {
  23406. this.systemFontInfo.guessFallback = false;
  23407. this.systemFontInfo.css += `,${this.fallbackName}`;
  23408. }
  23409. this.differences = properties.differences;
  23410. this.widths = properties.widths;
  23411. this.defaultWidth = properties.defaultWidth;
  23412. this.composite = properties.composite;
  23413. this.cMap = properties.cMap;
  23414. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  23415. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  23416. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  23417. this.lineHeight = this.ascent - this.descent;
  23418. this.fontMatrix = properties.fontMatrix;
  23419. this.bbox = properties.bbox;
  23420. this.defaultEncoding = properties.defaultEncoding;
  23421. this.toUnicode = properties.toUnicode;
  23422. this.toFontChar = [];
  23423. if (properties.type === "Type3") {
  23424. for (let charCode = 0; charCode < 256; charCode++) {
  23425. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  23426. }
  23427. return;
  23428. }
  23429. this.cidEncoding = properties.cidEncoding || "";
  23430. this.vertical = !!properties.vertical;
  23431. if (this.vertical) {
  23432. this.vmetrics = properties.vmetrics;
  23433. this.defaultVMetrics = properties.defaultVMetrics;
  23434. }
  23435. if (!file || file.isEmpty) {
  23436. if (file) {
  23437. warn('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  23438. }
  23439. this.fallbackToSystemFont(properties);
  23440. return;
  23441. }
  23442. [type, subtype] = getFontFileType(file, properties);
  23443. if (type !== this.type || subtype !== this.subtype) {
  23444. info("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  23445. }
  23446. let data;
  23447. try {
  23448. switch (type) {
  23449. case "MMType1":
  23450. info("MMType1 font (" + name + "), falling back to Type1.");
  23451. case "Type1":
  23452. case "CIDFontType0":
  23453. this.mimetype = "font/opentype";
  23454. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new CFFFont(file, properties) : new Type1Font(name, file, properties);
  23455. adjustWidths(properties);
  23456. data = this.convert(name, cff, properties);
  23457. break;
  23458. case "OpenType":
  23459. case "TrueType":
  23460. case "CIDFontType2":
  23461. this.mimetype = "font/opentype";
  23462. data = this.checkAndRepair(name, file, properties);
  23463. if (this.isOpenType) {
  23464. adjustWidths(properties);
  23465. type = "OpenType";
  23466. }
  23467. break;
  23468. default:
  23469. throw new FormatError(`Font ${type} is not supported`);
  23470. }
  23471. } catch (e) {
  23472. warn(e);
  23473. this.fallbackToSystemFont(properties);
  23474. return;
  23475. }
  23476. amendFallbackToUnicode(properties);
  23477. this.data = data;
  23478. this.type = type;
  23479. this.subtype = subtype;
  23480. this.fontMatrix = properties.fontMatrix;
  23481. this.widths = properties.widths;
  23482. this.defaultWidth = properties.defaultWidth;
  23483. this.toUnicode = properties.toUnicode;
  23484. this.seacMap = properties.seacMap;
  23485. }
  23486. get renderer() {
  23487. const renderer = FontRendererFactory.create(this, SEAC_ANALYSIS_ENABLED);
  23488. return shadow(this, "renderer", renderer);
  23489. }
  23490. exportData(extraProperties = false) {
  23491. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  23492. const data = Object.create(null);
  23493. let property, value;
  23494. for (property of exportDataProperties) {
  23495. value = this[property];
  23496. if (value !== undefined) {
  23497. data[property] = value;
  23498. }
  23499. }
  23500. return data;
  23501. }
  23502. fallbackToSystemFont(properties) {
  23503. this.missingFile = true;
  23504. const {
  23505. name,
  23506. type
  23507. } = this;
  23508. let fontName = normalizeFontName(name);
  23509. const stdFontMap = getStdFontMap(),
  23510. nonStdFontMap = getNonStdFontMap();
  23511. const isStandardFont = !!stdFontMap[fontName];
  23512. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  23513. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  23514. const fontBasicMetricsMap = getFontBasicMetrics();
  23515. const metrics = fontBasicMetricsMap[fontName];
  23516. if (metrics) {
  23517. if (isNaN(this.ascent)) {
  23518. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  23519. }
  23520. if (isNaN(this.descent)) {
  23521. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  23522. }
  23523. if (isNaN(this.capHeight)) {
  23524. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  23525. }
  23526. }
  23527. this.bold = /bold/gi.test(fontName);
  23528. this.italic = /oblique|italic/gi.test(fontName);
  23529. this.black = /Black/g.test(name);
  23530. const isNarrow = /Narrow/g.test(name);
  23531. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  23532. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  23533. const cidToGidMap = properties.cidToGidMap;
  23534. const map = [];
  23535. applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
  23536. if (/Arial-?Black/i.test(name)) {
  23537. applyStandardFontGlyphMap(map, getSupplementalGlyphMapForArialBlack());
  23538. } else if (/Calibri/i.test(name)) {
  23539. applyStandardFontGlyphMap(map, getSupplementalGlyphMapForCalibri());
  23540. }
  23541. if (cidToGidMap) {
  23542. for (const charCode in map) {
  23543. const cid = map[charCode];
  23544. if (cidToGidMap[cid] !== undefined) {
  23545. map[+charCode] = cidToGidMap[cid];
  23546. }
  23547. }
  23548. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof IdentityToUnicodeMap) {
  23549. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23550. const cid = map[charCode];
  23551. if (cidToGidMap[cid] === undefined) {
  23552. map[+charCode] = unicodeCharCode;
  23553. }
  23554. });
  23555. }
  23556. }
  23557. if (!(this.toUnicode instanceof IdentityToUnicodeMap)) {
  23558. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23559. map[+charCode] = unicodeCharCode;
  23560. });
  23561. }
  23562. this.toFontChar = map;
  23563. this.toUnicode = new ToUnicodeMap(map);
  23564. } else if (/Symbol/i.test(fontName)) {
  23565. this.toFontChar = buildToFontChar(SymbolSetEncoding, getGlyphsUnicode(), this.differences);
  23566. } else if (/Dingbats/i.test(fontName)) {
  23567. this.toFontChar = buildToFontChar(ZapfDingbatsEncoding, getDingbatsGlyphsUnicode(), this.differences);
  23568. } else if (isStandardFont || isMappedToStandardFont) {
  23569. const map = buildToFontChar(this.defaultEncoding, getGlyphsUnicode(), this.differences);
  23570. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
  23571. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  23572. map[+charCode] = unicodeCharCode;
  23573. });
  23574. }
  23575. this.toFontChar = map;
  23576. } else {
  23577. const glyphsUnicodeMap = getGlyphsUnicode();
  23578. const map = [];
  23579. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  23580. if (!this.composite) {
  23581. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  23582. const unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  23583. if (unicode !== -1) {
  23584. unicodeCharCode = unicode;
  23585. }
  23586. }
  23587. map[+charCode] = unicodeCharCode;
  23588. });
  23589. if (this.composite && this.toUnicode instanceof IdentityToUnicodeMap) {
  23590. if (/Tahoma|Verdana/i.test(name)) {
  23591. applyStandardFontGlyphMap(map, getGlyphMapForStandardFonts());
  23592. }
  23593. }
  23594. this.toFontChar = map;
  23595. }
  23596. amendFallbackToUnicode(properties);
  23597. this.loadedName = fontName.split("-", 1)[0];
  23598. }
  23599. checkAndRepair(name, font, properties) {
  23600. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  23601. function readTables(file, numTables) {
  23602. const tables = Object.create(null);
  23603. tables["OS/2"] = null;
  23604. tables.cmap = null;
  23605. tables.head = null;
  23606. tables.hhea = null;
  23607. tables.hmtx = null;
  23608. tables.maxp = null;
  23609. tables.name = null;
  23610. tables.post = null;
  23611. for (let i = 0; i < numTables; i++) {
  23612. const table = readTableEntry(file);
  23613. if (!VALID_TABLES.includes(table.tag)) {
  23614. continue;
  23615. }
  23616. if (table.length === 0) {
  23617. continue;
  23618. }
  23619. tables[table.tag] = table;
  23620. }
  23621. return tables;
  23622. }
  23623. function readTableEntry(file) {
  23624. const tag = file.getString(4);
  23625. const checksum = file.getInt32() >>> 0;
  23626. const offset = file.getInt32() >>> 0;
  23627. const length = file.getInt32() >>> 0;
  23628. const previousPosition = file.pos;
  23629. file.pos = file.start || 0;
  23630. file.skip(offset);
  23631. const data = file.getBytes(length);
  23632. file.pos = previousPosition;
  23633. if (tag === "head") {
  23634. data[8] = data[9] = data[10] = data[11] = 0;
  23635. data[17] |= 0x20;
  23636. }
  23637. return {
  23638. tag,
  23639. checksum,
  23640. length,
  23641. offset,
  23642. data
  23643. };
  23644. }
  23645. function readOpenTypeHeader(ttf) {
  23646. return {
  23647. version: ttf.getString(4),
  23648. numTables: ttf.getUint16(),
  23649. searchRange: ttf.getUint16(),
  23650. entrySelector: ttf.getUint16(),
  23651. rangeShift: ttf.getUint16()
  23652. };
  23653. }
  23654. function readTrueTypeCollectionHeader(ttc) {
  23655. const ttcTag = ttc.getString(4);
  23656. assert(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  23657. const majorVersion = ttc.getUint16();
  23658. const minorVersion = ttc.getUint16();
  23659. const numFonts = ttc.getInt32() >>> 0;
  23660. const offsetTable = [];
  23661. for (let i = 0; i < numFonts; i++) {
  23662. offsetTable.push(ttc.getInt32() >>> 0);
  23663. }
  23664. const header = {
  23665. ttcTag,
  23666. majorVersion,
  23667. minorVersion,
  23668. numFonts,
  23669. offsetTable
  23670. };
  23671. switch (majorVersion) {
  23672. case 1:
  23673. return header;
  23674. case 2:
  23675. header.dsigTag = ttc.getInt32() >>> 0;
  23676. header.dsigLength = ttc.getInt32() >>> 0;
  23677. header.dsigOffset = ttc.getInt32() >>> 0;
  23678. return header;
  23679. }
  23680. throw new FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  23681. }
  23682. function readTrueTypeCollectionData(ttc, fontName) {
  23683. const {
  23684. numFonts,
  23685. offsetTable
  23686. } = readTrueTypeCollectionHeader(ttc);
  23687. const fontNameParts = fontName.split("+");
  23688. let fallbackData;
  23689. for (let i = 0; i < numFonts; i++) {
  23690. ttc.pos = (ttc.start || 0) + offsetTable[i];
  23691. const potentialHeader = readOpenTypeHeader(ttc);
  23692. const potentialTables = readTables(ttc, potentialHeader.numTables);
  23693. if (!potentialTables.name) {
  23694. throw new FormatError('TrueType Collection font must contain a "name" table.');
  23695. }
  23696. const [nameTable] = readNameTable(potentialTables.name);
  23697. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  23698. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  23699. const nameEntry = nameTable[j][k]?.replaceAll(/\s/g, "");
  23700. if (!nameEntry) {
  23701. continue;
  23702. }
  23703. if (nameEntry === fontName) {
  23704. return {
  23705. header: potentialHeader,
  23706. tables: potentialTables
  23707. };
  23708. }
  23709. if (fontNameParts.length < 2) {
  23710. continue;
  23711. }
  23712. for (const part of fontNameParts) {
  23713. if (nameEntry === part) {
  23714. fallbackData = {
  23715. name: part,
  23716. header: potentialHeader,
  23717. tables: potentialTables
  23718. };
  23719. }
  23720. }
  23721. }
  23722. }
  23723. }
  23724. if (fallbackData) {
  23725. warn(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  23726. return {
  23727. header: fallbackData.header,
  23728. tables: fallbackData.tables
  23729. };
  23730. }
  23731. throw new FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  23732. }
  23733. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  23734. if (!cmap) {
  23735. warn("No cmap table available.");
  23736. return {
  23737. platformId: -1,
  23738. encodingId: -1,
  23739. mappings: [],
  23740. hasShortCmap: false
  23741. };
  23742. }
  23743. let segment;
  23744. let start = (file.start || 0) + cmap.offset;
  23745. file.pos = start;
  23746. file.skip(2);
  23747. const numTables = file.getUint16();
  23748. let potentialTable;
  23749. let canBreak = false;
  23750. for (let i = 0; i < numTables; i++) {
  23751. const platformId = file.getUint16();
  23752. const encodingId = file.getUint16();
  23753. const offset = file.getInt32() >>> 0;
  23754. let useTable = false;
  23755. if (potentialTable?.platformId === platformId && potentialTable?.encodingId === encodingId) {
  23756. continue;
  23757. }
  23758. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  23759. useTable = true;
  23760. } else if (platformId === 1 && encodingId === 0) {
  23761. useTable = true;
  23762. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  23763. useTable = true;
  23764. if (!isSymbolicFont) {
  23765. canBreak = true;
  23766. }
  23767. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  23768. useTable = true;
  23769. let correctlySorted = true;
  23770. if (i < numTables - 1) {
  23771. const nextBytes = file.peekBytes(2),
  23772. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  23773. if (nextPlatformId < platformId) {
  23774. correctlySorted = false;
  23775. }
  23776. }
  23777. if (correctlySorted) {
  23778. canBreak = true;
  23779. }
  23780. }
  23781. if (useTable) {
  23782. potentialTable = {
  23783. platformId,
  23784. encodingId,
  23785. offset
  23786. };
  23787. }
  23788. if (canBreak) {
  23789. break;
  23790. }
  23791. }
  23792. if (potentialTable) {
  23793. file.pos = start + potentialTable.offset;
  23794. }
  23795. if (!potentialTable || file.peekByte() === -1) {
  23796. warn("Could not find a preferred cmap table.");
  23797. return {
  23798. platformId: -1,
  23799. encodingId: -1,
  23800. mappings: [],
  23801. hasShortCmap: false
  23802. };
  23803. }
  23804. const format = file.getUint16();
  23805. let hasShortCmap = false;
  23806. const mappings = [];
  23807. let j, glyphId;
  23808. if (format === 0) {
  23809. file.skip(2 + 2);
  23810. for (j = 0; j < 256; j++) {
  23811. const index = file.getByte();
  23812. if (!index) {
  23813. continue;
  23814. }
  23815. mappings.push({
  23816. charCode: j,
  23817. glyphId: index
  23818. });
  23819. }
  23820. hasShortCmap = true;
  23821. } else if (format === 2) {
  23822. file.skip(2 + 2);
  23823. const subHeaderKeys = [];
  23824. let maxSubHeaderKey = 0;
  23825. for (let i = 0; i < 256; i++) {
  23826. const subHeaderKey = file.getUint16() >> 3;
  23827. subHeaderKeys.push(subHeaderKey);
  23828. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  23829. }
  23830. const subHeaders = [];
  23831. for (let i = 0; i <= maxSubHeaderKey; i++) {
  23832. subHeaders.push({
  23833. firstCode: file.getUint16(),
  23834. entryCount: file.getUint16(),
  23835. idDelta: signedInt16(file.getByte(), file.getByte()),
  23836. idRangePos: file.pos + file.getUint16()
  23837. });
  23838. }
  23839. for (let i = 0; i < 256; i++) {
  23840. if (subHeaderKeys[i] === 0) {
  23841. file.pos = subHeaders[0].idRangePos + 2 * i;
  23842. glyphId = file.getUint16();
  23843. mappings.push({
  23844. charCode: i,
  23845. glyphId
  23846. });
  23847. } else {
  23848. const s = subHeaders[subHeaderKeys[i]];
  23849. for (j = 0; j < s.entryCount; j++) {
  23850. const charCode = (i << 8) + j + s.firstCode;
  23851. file.pos = s.idRangePos + 2 * j;
  23852. glyphId = file.getUint16();
  23853. if (glyphId !== 0) {
  23854. glyphId = (glyphId + s.idDelta) % 65536;
  23855. }
  23856. mappings.push({
  23857. charCode,
  23858. glyphId
  23859. });
  23860. }
  23861. }
  23862. }
  23863. } else if (format === 4) {
  23864. file.skip(2 + 2);
  23865. const segCount = file.getUint16() >> 1;
  23866. file.skip(6);
  23867. const segments = [];
  23868. let segIndex;
  23869. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23870. segments.push({
  23871. end: file.getUint16()
  23872. });
  23873. }
  23874. file.skip(2);
  23875. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23876. segments[segIndex].start = file.getUint16();
  23877. }
  23878. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23879. segments[segIndex].delta = file.getUint16();
  23880. }
  23881. let offsetsCount = 0,
  23882. offsetIndex;
  23883. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23884. segment = segments[segIndex];
  23885. const rangeOffset = file.getUint16();
  23886. if (!rangeOffset) {
  23887. segment.offsetIndex = -1;
  23888. continue;
  23889. }
  23890. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  23891. segment.offsetIndex = offsetIndex;
  23892. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  23893. }
  23894. const offsets = [];
  23895. for (j = 0; j < offsetsCount; j++) {
  23896. offsets.push(file.getUint16());
  23897. }
  23898. for (segIndex = 0; segIndex < segCount; segIndex++) {
  23899. segment = segments[segIndex];
  23900. start = segment.start;
  23901. const end = segment.end;
  23902. const delta = segment.delta;
  23903. offsetIndex = segment.offsetIndex;
  23904. for (j = start; j <= end; j++) {
  23905. if (j === 0xffff) {
  23906. continue;
  23907. }
  23908. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  23909. glyphId = glyphId + delta & 0xffff;
  23910. mappings.push({
  23911. charCode: j,
  23912. glyphId
  23913. });
  23914. }
  23915. }
  23916. } else if (format === 6) {
  23917. file.skip(2 + 2);
  23918. const firstCode = file.getUint16();
  23919. const entryCount = file.getUint16();
  23920. for (j = 0; j < entryCount; j++) {
  23921. glyphId = file.getUint16();
  23922. const charCode = firstCode + j;
  23923. mappings.push({
  23924. charCode,
  23925. glyphId
  23926. });
  23927. }
  23928. } else if (format === 12) {
  23929. file.skip(2 + 4 + 4);
  23930. const nGroups = file.getInt32() >>> 0;
  23931. for (j = 0; j < nGroups; j++) {
  23932. const startCharCode = file.getInt32() >>> 0;
  23933. const endCharCode = file.getInt32() >>> 0;
  23934. let glyphCode = file.getInt32() >>> 0;
  23935. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  23936. mappings.push({
  23937. charCode,
  23938. glyphId: glyphCode++
  23939. });
  23940. }
  23941. }
  23942. } else {
  23943. warn("cmap table has unsupported format: " + format);
  23944. return {
  23945. platformId: -1,
  23946. encodingId: -1,
  23947. mappings: [],
  23948. hasShortCmap: false
  23949. };
  23950. }
  23951. mappings.sort(function (a, b) {
  23952. return a.charCode - b.charCode;
  23953. });
  23954. for (let i = 1; i < mappings.length; i++) {
  23955. if (mappings[i - 1].charCode === mappings[i].charCode) {
  23956. mappings.splice(i, 1);
  23957. i--;
  23958. }
  23959. }
  23960. return {
  23961. platformId: potentialTable.platformId,
  23962. encodingId: potentialTable.encodingId,
  23963. mappings,
  23964. hasShortCmap
  23965. };
  23966. }
  23967. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  23968. if (!header) {
  23969. if (metrics) {
  23970. metrics.data = null;
  23971. }
  23972. return;
  23973. }
  23974. file.pos = (file.start || 0) + header.offset;
  23975. file.pos += 4;
  23976. file.pos += 2;
  23977. file.pos += 2;
  23978. file.pos += 2;
  23979. file.pos += 2;
  23980. file.pos += 2;
  23981. file.pos += 2;
  23982. file.pos += 2;
  23983. file.pos += 2;
  23984. file.pos += 2;
  23985. const caretOffset = file.getUint16();
  23986. file.pos += 8;
  23987. file.pos += 2;
  23988. let numOfMetrics = file.getUint16();
  23989. if (caretOffset !== 0) {
  23990. const macStyle = int16(headTable.data[44], headTable.data[45]);
  23991. if (!(macStyle & 2)) {
  23992. header.data[22] = 0;
  23993. header.data[23] = 0;
  23994. }
  23995. }
  23996. if (numOfMetrics > numGlyphs) {
  23997. info(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  23998. numOfMetrics = numGlyphs;
  23999. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  24000. header.data[35] = numOfMetrics & 0x00ff;
  24001. }
  24002. const numOfSidebearings = numGlyphs - numOfMetrics;
  24003. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  24004. if (numMissing > 0) {
  24005. const entries = new Uint8Array(metrics.length + numMissing * 2);
  24006. entries.set(metrics.data);
  24007. if (dupFirstEntry) {
  24008. entries[metrics.length] = metrics.data[2];
  24009. entries[metrics.length + 1] = metrics.data[3];
  24010. }
  24011. metrics.data = entries;
  24012. }
  24013. }
  24014. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  24015. const glyphProfile = {
  24016. length: 0,
  24017. sizeOfInstructions: 0
  24018. };
  24019. if (sourceStart < 0 || sourceStart >= source.length || sourceEnd > source.length || sourceEnd - sourceStart <= 12) {
  24020. return glyphProfile;
  24021. }
  24022. const glyf = source.subarray(sourceStart, sourceEnd);
  24023. const xMin = signedInt16(glyf[2], glyf[3]);
  24024. const yMin = signedInt16(glyf[4], glyf[5]);
  24025. const xMax = signedInt16(glyf[6], glyf[7]);
  24026. const yMax = signedInt16(glyf[8], glyf[9]);
  24027. if (xMin > xMax) {
  24028. writeSignedInt16(glyf, 2, xMax);
  24029. writeSignedInt16(glyf, 6, xMin);
  24030. }
  24031. if (yMin > yMax) {
  24032. writeSignedInt16(glyf, 4, yMax);
  24033. writeSignedInt16(glyf, 8, yMin);
  24034. }
  24035. const contoursCount = signedInt16(glyf[0], glyf[1]);
  24036. if (contoursCount < 0) {
  24037. if (contoursCount < -1) {
  24038. return glyphProfile;
  24039. }
  24040. dest.set(glyf, destStart);
  24041. glyphProfile.length = glyf.length;
  24042. return glyphProfile;
  24043. }
  24044. let i,
  24045. j = 10,
  24046. flagsCount = 0;
  24047. for (i = 0; i < contoursCount; i++) {
  24048. const endPoint = glyf[j] << 8 | glyf[j + 1];
  24049. flagsCount = endPoint + 1;
  24050. j += 2;
  24051. }
  24052. const instructionsStart = j;
  24053. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  24054. glyphProfile.sizeOfInstructions = instructionsLength;
  24055. j += 2 + instructionsLength;
  24056. const instructionsEnd = j;
  24057. let coordinatesLength = 0;
  24058. for (i = 0; i < flagsCount; i++) {
  24059. const flag = glyf[j++];
  24060. if (flag & 0xc0) {
  24061. glyf[j - 1] = flag & 0x3f;
  24062. }
  24063. let xLength = 2;
  24064. if (flag & 2) {
  24065. xLength = 1;
  24066. } else if (flag & 16) {
  24067. xLength = 0;
  24068. }
  24069. let yLength = 2;
  24070. if (flag & 4) {
  24071. yLength = 1;
  24072. } else if (flag & 32) {
  24073. yLength = 0;
  24074. }
  24075. const xyLength = xLength + yLength;
  24076. coordinatesLength += xyLength;
  24077. if (flag & 8) {
  24078. const repeat = glyf[j++];
  24079. if (repeat === 0) {
  24080. glyf[j - 1] ^= 8;
  24081. }
  24082. i += repeat;
  24083. coordinatesLength += repeat * xyLength;
  24084. }
  24085. }
  24086. if (coordinatesLength === 0) {
  24087. return glyphProfile;
  24088. }
  24089. let glyphDataLength = j + coordinatesLength;
  24090. if (glyphDataLength > glyf.length) {
  24091. return glyphProfile;
  24092. }
  24093. if (!hintsValid && instructionsLength > 0) {
  24094. dest.set(glyf.subarray(0, instructionsStart), destStart);
  24095. dest.set([0, 0], destStart + instructionsStart);
  24096. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  24097. glyphDataLength -= instructionsLength;
  24098. if (glyf.length - glyphDataLength > 3) {
  24099. glyphDataLength = glyphDataLength + 3 & ~3;
  24100. }
  24101. glyphProfile.length = glyphDataLength;
  24102. return glyphProfile;
  24103. }
  24104. if (glyf.length - glyphDataLength > 3) {
  24105. glyphDataLength = glyphDataLength + 3 & ~3;
  24106. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  24107. glyphProfile.length = glyphDataLength;
  24108. return glyphProfile;
  24109. }
  24110. dest.set(glyf, destStart);
  24111. glyphProfile.length = glyf.length;
  24112. return glyphProfile;
  24113. }
  24114. function sanitizeHead(head, numGlyphs, locaLength) {
  24115. const data = head.data;
  24116. const version = int32(data[0], data[1], data[2], data[3]);
  24117. if (version >> 16 !== 1) {
  24118. info("Attempting to fix invalid version in head table: " + version);
  24119. data[0] = 0;
  24120. data[1] = 1;
  24121. data[2] = 0;
  24122. data[3] = 0;
  24123. }
  24124. const indexToLocFormat = int16(data[50], data[51]);
  24125. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  24126. info("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  24127. const numGlyphsPlusOne = numGlyphs + 1;
  24128. if (locaLength === numGlyphsPlusOne << 1) {
  24129. data[50] = 0;
  24130. data[51] = 0;
  24131. } else if (locaLength === numGlyphsPlusOne << 2) {
  24132. data[50] = 0;
  24133. data[51] = 1;
  24134. } else {
  24135. throw new FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  24136. }
  24137. }
  24138. }
  24139. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  24140. let itemSize, itemDecode, itemEncode;
  24141. if (isGlyphLocationsLong) {
  24142. itemSize = 4;
  24143. itemDecode = function fontItemDecodeLong(data, offset) {
  24144. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  24145. };
  24146. itemEncode = function fontItemEncodeLong(data, offset, value) {
  24147. data[offset] = value >>> 24 & 0xff;
  24148. data[offset + 1] = value >> 16 & 0xff;
  24149. data[offset + 2] = value >> 8 & 0xff;
  24150. data[offset + 3] = value & 0xff;
  24151. };
  24152. } else {
  24153. itemSize = 2;
  24154. itemDecode = function fontItemDecode(data, offset) {
  24155. return data[offset] << 9 | data[offset + 1] << 1;
  24156. };
  24157. itemEncode = function fontItemEncode(data, offset, value) {
  24158. data[offset] = value >> 9 & 0xff;
  24159. data[offset + 1] = value >> 1 & 0xff;
  24160. };
  24161. }
  24162. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  24163. const locaDataSize = itemSize * (1 + numGlyphsOut);
  24164. const locaData = new Uint8Array(locaDataSize);
  24165. locaData.set(loca.data.subarray(0, locaDataSize));
  24166. loca.data = locaData;
  24167. const oldGlyfData = glyf.data;
  24168. const oldGlyfDataLength = oldGlyfData.length;
  24169. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  24170. let i, j;
  24171. const locaEntries = [];
  24172. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  24173. let offset = itemDecode(locaData, j);
  24174. if (offset > oldGlyfDataLength) {
  24175. offset = oldGlyfDataLength;
  24176. }
  24177. locaEntries.push({
  24178. index: i,
  24179. offset,
  24180. endOffset: 0
  24181. });
  24182. }
  24183. locaEntries.sort((a, b) => a.offset - b.offset);
  24184. for (i = 0; i < numGlyphs; i++) {
  24185. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  24186. }
  24187. locaEntries.sort((a, b) => a.index - b.index);
  24188. for (i = 0; i < numGlyphs; i++) {
  24189. const {
  24190. offset,
  24191. endOffset
  24192. } = locaEntries[i];
  24193. if (offset !== 0 || endOffset !== 0) {
  24194. break;
  24195. }
  24196. const nextOffset = locaEntries[i + 1].offset;
  24197. if (nextOffset === 0) {
  24198. continue;
  24199. }
  24200. locaEntries[i].endOffset = nextOffset;
  24201. break;
  24202. }
  24203. const last = locaEntries.at(-2);
  24204. if (last.offset !== 0 && last.endOffset === 0) {
  24205. last.endOffset = oldGlyfDataLength;
  24206. }
  24207. const missingGlyphs = Object.create(null);
  24208. let writeOffset = 0;
  24209. itemEncode(locaData, 0, writeOffset);
  24210. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  24211. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  24212. const newLength = glyphProfile.length;
  24213. if (newLength === 0) {
  24214. missingGlyphs[i] = true;
  24215. }
  24216. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  24217. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  24218. }
  24219. writeOffset += newLength;
  24220. itemEncode(locaData, j, writeOffset);
  24221. }
  24222. if (writeOffset === 0) {
  24223. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  24224. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  24225. itemEncode(locaData, j, simpleGlyph.length);
  24226. }
  24227. glyf.data = simpleGlyph;
  24228. } else if (dupFirstEntry) {
  24229. const firstEntryLength = itemDecode(locaData, itemSize);
  24230. if (newGlyfData.length > firstEntryLength + writeOffset) {
  24231. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  24232. } else {
  24233. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  24234. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  24235. }
  24236. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  24237. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  24238. } else {
  24239. glyf.data = newGlyfData.subarray(0, writeOffset);
  24240. }
  24241. return {
  24242. missingGlyphs,
  24243. maxSizeOfInstructions
  24244. };
  24245. }
  24246. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  24247. const start = (font.start || 0) + post.offset;
  24248. font.pos = start;
  24249. const length = post.length,
  24250. end = start + length;
  24251. const version = font.getInt32();
  24252. font.skip(28);
  24253. let glyphNames;
  24254. let valid = true;
  24255. let i;
  24256. switch (version) {
  24257. case 0x00010000:
  24258. glyphNames = MacStandardGlyphOrdering;
  24259. break;
  24260. case 0x00020000:
  24261. const numGlyphs = font.getUint16();
  24262. if (numGlyphs !== maxpNumGlyphs) {
  24263. valid = false;
  24264. break;
  24265. }
  24266. const glyphNameIndexes = [];
  24267. for (i = 0; i < numGlyphs; ++i) {
  24268. const index = font.getUint16();
  24269. if (index >= 32768) {
  24270. valid = false;
  24271. break;
  24272. }
  24273. glyphNameIndexes.push(index);
  24274. }
  24275. if (!valid) {
  24276. break;
  24277. }
  24278. const customNames = [],
  24279. strBuf = [];
  24280. while (font.pos < end) {
  24281. const stringLength = font.getByte();
  24282. strBuf.length = stringLength;
  24283. for (i = 0; i < stringLength; ++i) {
  24284. strBuf[i] = String.fromCharCode(font.getByte());
  24285. }
  24286. customNames.push(strBuf.join(""));
  24287. }
  24288. glyphNames = [];
  24289. for (i = 0; i < numGlyphs; ++i) {
  24290. const j = glyphNameIndexes[i];
  24291. if (j < 258) {
  24292. glyphNames.push(MacStandardGlyphOrdering[j]);
  24293. continue;
  24294. }
  24295. glyphNames.push(customNames[j - 258]);
  24296. }
  24297. break;
  24298. case 0x00030000:
  24299. break;
  24300. default:
  24301. warn("Unknown/unsupported post table version " + version);
  24302. valid = false;
  24303. if (propertiesObj.defaultEncoding) {
  24304. glyphNames = propertiesObj.defaultEncoding;
  24305. }
  24306. break;
  24307. }
  24308. propertiesObj.glyphNames = glyphNames;
  24309. return valid;
  24310. }
  24311. function readNameTable(nameTable) {
  24312. const start = (font.start || 0) + nameTable.offset;
  24313. font.pos = start;
  24314. const names = [[], []],
  24315. records = [];
  24316. const length = nameTable.length,
  24317. end = start + length;
  24318. const format = font.getUint16();
  24319. const FORMAT_0_HEADER_LENGTH = 6;
  24320. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  24321. return [names, records];
  24322. }
  24323. const numRecords = font.getUint16();
  24324. const stringsStart = font.getUint16();
  24325. const NAME_RECORD_LENGTH = 12;
  24326. let i, ii;
  24327. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  24328. const r = {
  24329. platform: font.getUint16(),
  24330. encoding: font.getUint16(),
  24331. language: font.getUint16(),
  24332. name: font.getUint16(),
  24333. length: font.getUint16(),
  24334. offset: font.getUint16()
  24335. };
  24336. if (isMacNameRecord(r) || isWinNameRecord(r)) {
  24337. records.push(r);
  24338. }
  24339. }
  24340. for (i = 0, ii = records.length; i < ii; i++) {
  24341. const record = records[i];
  24342. if (record.length <= 0) {
  24343. continue;
  24344. }
  24345. const pos = start + stringsStart + record.offset;
  24346. if (pos + record.length > end) {
  24347. continue;
  24348. }
  24349. font.pos = pos;
  24350. const nameIndex = record.name;
  24351. if (record.encoding) {
  24352. let str = "";
  24353. for (let j = 0, jj = record.length; j < jj; j += 2) {
  24354. str += String.fromCharCode(font.getUint16());
  24355. }
  24356. names[1][nameIndex] = str;
  24357. } else {
  24358. names[0][nameIndex] = font.getString(record.length);
  24359. }
  24360. }
  24361. return [names, records];
  24362. }
  24363. const TTOpsStackDeltas = [0, 0, 0, 0, 0, 0, 0, 0, -2, -2, -2, -2, 0, 0, -2, -5, -1, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, -1, -1, 1, -1, -999, 0, 1, 0, -1, -2, 0, -1, -2, -1, -1, 0, -1, -1, 0, 0, -999, -999, -1, -1, -1, -1, -2, -999, -2, -2, -999, 0, -2, -2, 0, 0, -2, 0, -2, 0, 0, 0, -2, -1, -1, 1, 1, 0, 0, -1, -1, -1, -1, -1, -1, -1, 0, 0, -1, 0, -1, -1, 0, -999, -1, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -2, -999, -999, -999, -999, -999, -1, -1, -2, -2, 0, 0, 0, 0, -1, -1, -999, -2, -2, 0, 0, -1, -2, -2, 0, 0, 0, -1, -1, -1, -2];
  24364. function sanitizeTTProgram(table, ttContext) {
  24365. let data = table.data;
  24366. let i = 0,
  24367. j,
  24368. n,
  24369. b,
  24370. funcId,
  24371. pc,
  24372. lastEndf = 0,
  24373. lastDeff = 0;
  24374. const stack = [];
  24375. const callstack = [];
  24376. const functionsCalled = [];
  24377. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  24378. let inFDEF = false,
  24379. ifLevel = 0,
  24380. inELSE = 0;
  24381. for (let ii = data.length; i < ii;) {
  24382. const op = data[i++];
  24383. if (op === 0x40) {
  24384. n = data[i++];
  24385. if (inFDEF || inELSE) {
  24386. i += n;
  24387. } else {
  24388. for (j = 0; j < n; j++) {
  24389. stack.push(data[i++]);
  24390. }
  24391. }
  24392. } else if (op === 0x41) {
  24393. n = data[i++];
  24394. if (inFDEF || inELSE) {
  24395. i += n * 2;
  24396. } else {
  24397. for (j = 0; j < n; j++) {
  24398. b = data[i++];
  24399. stack.push(b << 8 | data[i++]);
  24400. }
  24401. }
  24402. } else if ((op & 0xf8) === 0xb0) {
  24403. n = op - 0xb0 + 1;
  24404. if (inFDEF || inELSE) {
  24405. i += n;
  24406. } else {
  24407. for (j = 0; j < n; j++) {
  24408. stack.push(data[i++]);
  24409. }
  24410. }
  24411. } else if ((op & 0xf8) === 0xb8) {
  24412. n = op - 0xb8 + 1;
  24413. if (inFDEF || inELSE) {
  24414. i += n * 2;
  24415. } else {
  24416. for (j = 0; j < n; j++) {
  24417. b = data[i++];
  24418. stack.push(signedInt16(b, data[i++]));
  24419. }
  24420. }
  24421. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  24422. if (!inFDEF && !inELSE) {
  24423. funcId = stack.at(-1);
  24424. if (isNaN(funcId)) {
  24425. info("TT: CALL empty stack (or invalid entry).");
  24426. } else {
  24427. ttContext.functionsUsed[funcId] = true;
  24428. if (funcId in ttContext.functionsStackDeltas) {
  24429. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  24430. if (newStackLength < 0) {
  24431. warn("TT: CALL invalid functions stack delta.");
  24432. ttContext.hintsValid = false;
  24433. return;
  24434. }
  24435. stack.length = newStackLength;
  24436. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  24437. callstack.push({
  24438. data,
  24439. i,
  24440. stackTop: stack.length - 1
  24441. });
  24442. functionsCalled.push(funcId);
  24443. pc = ttContext.functionsDefined[funcId];
  24444. if (!pc) {
  24445. warn("TT: CALL non-existent function");
  24446. ttContext.hintsValid = false;
  24447. return;
  24448. }
  24449. data = pc.data;
  24450. i = pc.i;
  24451. }
  24452. }
  24453. }
  24454. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  24455. if (inFDEF || inELSE) {
  24456. warn("TT: nested FDEFs not allowed");
  24457. tooComplexToFollowFunctions = true;
  24458. }
  24459. inFDEF = true;
  24460. lastDeff = i;
  24461. funcId = stack.pop();
  24462. ttContext.functionsDefined[funcId] = {
  24463. data,
  24464. i
  24465. };
  24466. } else if (op === 0x2d) {
  24467. if (inFDEF) {
  24468. inFDEF = false;
  24469. lastEndf = i;
  24470. } else {
  24471. pc = callstack.pop();
  24472. if (!pc) {
  24473. warn("TT: ENDF bad stack");
  24474. ttContext.hintsValid = false;
  24475. return;
  24476. }
  24477. funcId = functionsCalled.pop();
  24478. data = pc.data;
  24479. i = pc.i;
  24480. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  24481. }
  24482. } else if (op === 0x89) {
  24483. if (inFDEF || inELSE) {
  24484. warn("TT: nested IDEFs not allowed");
  24485. tooComplexToFollowFunctions = true;
  24486. }
  24487. inFDEF = true;
  24488. lastDeff = i;
  24489. } else if (op === 0x58) {
  24490. ++ifLevel;
  24491. } else if (op === 0x1b) {
  24492. inELSE = ifLevel;
  24493. } else if (op === 0x59) {
  24494. if (inELSE === ifLevel) {
  24495. inELSE = 0;
  24496. }
  24497. --ifLevel;
  24498. } else if (op === 0x1c) {
  24499. if (!inFDEF && !inELSE) {
  24500. const offset = stack.at(-1);
  24501. if (offset > 0) {
  24502. i += offset - 1;
  24503. }
  24504. }
  24505. }
  24506. if (!inFDEF && !inELSE) {
  24507. let stackDelta = 0;
  24508. if (op <= 0x8e) {
  24509. stackDelta = TTOpsStackDeltas[op];
  24510. } else if (op >= 0xc0 && op <= 0xdf) {
  24511. stackDelta = -1;
  24512. } else if (op >= 0xe0) {
  24513. stackDelta = -2;
  24514. }
  24515. if (op >= 0x71 && op <= 0x75) {
  24516. n = stack.pop();
  24517. if (!isNaN(n)) {
  24518. stackDelta = -n * 2;
  24519. }
  24520. }
  24521. while (stackDelta < 0 && stack.length > 0) {
  24522. stack.pop();
  24523. stackDelta++;
  24524. }
  24525. while (stackDelta > 0) {
  24526. stack.push(NaN);
  24527. stackDelta--;
  24528. }
  24529. }
  24530. }
  24531. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  24532. const content = [data];
  24533. if (i > data.length) {
  24534. content.push(new Uint8Array(i - data.length));
  24535. }
  24536. if (lastDeff > lastEndf) {
  24537. warn("TT: complementing a missing function tail");
  24538. content.push(new Uint8Array([0x22, 0x2d]));
  24539. }
  24540. foldTTTable(table, content);
  24541. }
  24542. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  24543. if (ttContext.tooComplexToFollowFunctions) {
  24544. return;
  24545. }
  24546. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  24547. warn("TT: more functions defined than expected");
  24548. ttContext.hintsValid = false;
  24549. return;
  24550. }
  24551. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  24552. if (j > maxFunctionDefs) {
  24553. warn("TT: invalid function id: " + j);
  24554. ttContext.hintsValid = false;
  24555. return;
  24556. }
  24557. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  24558. warn("TT: undefined function: " + j);
  24559. ttContext.hintsValid = false;
  24560. return;
  24561. }
  24562. }
  24563. }
  24564. function foldTTTable(table, content) {
  24565. if (content.length > 1) {
  24566. let newLength = 0;
  24567. let j, jj;
  24568. for (j = 0, jj = content.length; j < jj; j++) {
  24569. newLength += content[j].length;
  24570. }
  24571. newLength = newLength + 3 & ~3;
  24572. const result = new Uint8Array(newLength);
  24573. let pos = 0;
  24574. for (j = 0, jj = content.length; j < jj; j++) {
  24575. result.set(content[j], pos);
  24576. pos += content[j].length;
  24577. }
  24578. table.data = result;
  24579. table.length = newLength;
  24580. }
  24581. }
  24582. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  24583. const ttContext = {
  24584. functionsDefined: [],
  24585. functionsUsed: [],
  24586. functionsStackDeltas: [],
  24587. tooComplexToFollowFunctions: false,
  24588. hintsValid: true
  24589. };
  24590. if (fpgm) {
  24591. sanitizeTTProgram(fpgm, ttContext);
  24592. }
  24593. if (prep) {
  24594. sanitizeTTProgram(prep, ttContext);
  24595. }
  24596. if (fpgm) {
  24597. checkInvalidFunctions(ttContext, maxFunctionDefs);
  24598. }
  24599. if (cvt && cvt.length & 1) {
  24600. const cvtData = new Uint8Array(cvt.length + 1);
  24601. cvtData.set(cvt.data);
  24602. cvt.data = cvtData;
  24603. }
  24604. return ttContext.hintsValid;
  24605. }
  24606. font = new Stream(new Uint8Array(font.getBytes()));
  24607. let header, tables;
  24608. if (isTrueTypeCollectionFile(font)) {
  24609. const ttcData = readTrueTypeCollectionData(font, this.name);
  24610. header = ttcData.header;
  24611. tables = ttcData.tables;
  24612. } else {
  24613. header = readOpenTypeHeader(font);
  24614. tables = readTables(font, header.numTables);
  24615. }
  24616. let cff, cffFile;
  24617. const isTrueType = !tables["CFF "];
  24618. if (!isTrueType) {
  24619. const isComposite = properties.composite && (properties.cidToGidMap?.length > 0 || !(properties.cMap instanceof IdentityCMap));
  24620. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  24621. cffFile = new Stream(tables["CFF "].data);
  24622. cff = new CFFFont(cffFile, properties);
  24623. adjustWidths(properties);
  24624. return this.convert(name, cff, properties);
  24625. }
  24626. delete tables.glyf;
  24627. delete tables.loca;
  24628. delete tables.fpgm;
  24629. delete tables.prep;
  24630. delete tables["cvt "];
  24631. this.isOpenType = true;
  24632. } else {
  24633. if (!tables.loca) {
  24634. throw new FormatError('Required "loca" table is not found');
  24635. }
  24636. if (!tables.glyf) {
  24637. warn('Required "glyf" table is not found -- trying to recover.');
  24638. tables.glyf = {
  24639. tag: "glyf",
  24640. data: new Uint8Array(0)
  24641. };
  24642. }
  24643. this.isOpenType = false;
  24644. }
  24645. if (!tables.maxp) {
  24646. throw new FormatError('Required "maxp" table is not found');
  24647. }
  24648. font.pos = (font.start || 0) + tables.maxp.offset;
  24649. let version = font.getInt32();
  24650. const numGlyphs = font.getUint16();
  24651. if (version !== 0x00010000 && version !== 0x00005000) {
  24652. if (tables.maxp.length === 6) {
  24653. version = 0x0005000;
  24654. } else if (tables.maxp.length >= 32) {
  24655. version = 0x00010000;
  24656. } else {
  24657. throw new FormatError(`"maxp" table has a wrong version number`);
  24658. }
  24659. writeUint32(tables.maxp.data, 0, version);
  24660. }
  24661. if (properties.scaleFactors?.length === numGlyphs && isTrueType) {
  24662. const {
  24663. scaleFactors
  24664. } = properties;
  24665. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  24666. const glyphs = new GlyfTable({
  24667. glyfTable: tables.glyf.data,
  24668. isGlyphLocationsLong,
  24669. locaTable: tables.loca.data,
  24670. numGlyphs
  24671. });
  24672. glyphs.scale(scaleFactors);
  24673. const {
  24674. glyf,
  24675. loca,
  24676. isLocationLong
  24677. } = glyphs.write();
  24678. tables.glyf.data = glyf;
  24679. tables.loca.data = loca;
  24680. if (isLocationLong !== !!isGlyphLocationsLong) {
  24681. tables.head.data[50] = 0;
  24682. tables.head.data[51] = isLocationLong ? 1 : 0;
  24683. }
  24684. const metrics = tables.hmtx.data;
  24685. for (let i = 0; i < numGlyphs; i++) {
  24686. const j = 4 * i;
  24687. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  24688. metrics[j] = advanceWidth >> 8 & 0xff;
  24689. metrics[j + 1] = advanceWidth & 0xff;
  24690. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  24691. writeSignedInt16(metrics, j + 2, lsb);
  24692. }
  24693. }
  24694. let numGlyphsOut = numGlyphs + 1;
  24695. let dupFirstEntry = true;
  24696. if (numGlyphsOut > 0xffff) {
  24697. dupFirstEntry = false;
  24698. numGlyphsOut = numGlyphs;
  24699. warn("Not enough space in glyfs to duplicate first glyph.");
  24700. }
  24701. let maxFunctionDefs = 0;
  24702. let maxSizeOfInstructions = 0;
  24703. if (version >= 0x00010000 && tables.maxp.length >= 32) {
  24704. font.pos += 8;
  24705. const maxZones = font.getUint16();
  24706. if (maxZones > 2) {
  24707. tables.maxp.data[14] = 0;
  24708. tables.maxp.data[15] = 2;
  24709. }
  24710. font.pos += 4;
  24711. maxFunctionDefs = font.getUint16();
  24712. font.pos += 4;
  24713. maxSizeOfInstructions = font.getUint16();
  24714. }
  24715. tables.maxp.data[4] = numGlyphsOut >> 8;
  24716. tables.maxp.data[5] = numGlyphsOut & 255;
  24717. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  24718. if (!hintsValid) {
  24719. delete tables.fpgm;
  24720. delete tables.prep;
  24721. delete tables["cvt "];
  24722. }
  24723. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  24724. if (!tables.head) {
  24725. throw new FormatError('Required "head" table is not found');
  24726. }
  24727. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  24728. let missingGlyphs = Object.create(null);
  24729. if (isTrueType) {
  24730. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  24731. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  24732. missingGlyphs = glyphsInfo.missingGlyphs;
  24733. if (version >= 0x00010000 && tables.maxp.length >= 32) {
  24734. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  24735. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  24736. }
  24737. }
  24738. if (!tables.hhea) {
  24739. throw new FormatError('Required "hhea" table is not found');
  24740. }
  24741. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  24742. tables.hhea.data[10] = 0xff;
  24743. tables.hhea.data[11] = 0xff;
  24744. }
  24745. const metricsOverride = {
  24746. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  24747. yMax: signedInt16(tables.head.data[42], tables.head.data[43]),
  24748. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  24749. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  24750. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  24751. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  24752. };
  24753. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  24754. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  24755. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  24756. if (this.cssFontInfo?.lineHeight) {
  24757. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  24758. this.lineGap = this.cssFontInfo.metrics.lineGap;
  24759. } else {
  24760. this.lineHeight = this.ascent - this.descent + this.lineGap;
  24761. }
  24762. if (tables.post) {
  24763. readPostScriptTable(tables.post, properties, numGlyphs);
  24764. }
  24765. tables.post = {
  24766. tag: "post",
  24767. data: createPostTable(properties)
  24768. };
  24769. const charCodeToGlyphId = Object.create(null);
  24770. function hasGlyph(glyphId) {
  24771. return !missingGlyphs[glyphId];
  24772. }
  24773. if (properties.composite) {
  24774. const cidToGidMap = properties.cidToGidMap || [];
  24775. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  24776. properties.cMap.forEach(function (charCode, cid) {
  24777. if (typeof cid === "string") {
  24778. cid = convertCidString(charCode, cid, true);
  24779. }
  24780. if (cid > 0xffff) {
  24781. throw new FormatError("Max size of CID is 65,535");
  24782. }
  24783. let glyphId = -1;
  24784. if (isCidToGidMapEmpty) {
  24785. glyphId = cid;
  24786. } else if (cidToGidMap[cid] !== undefined) {
  24787. glyphId = cidToGidMap[cid];
  24788. }
  24789. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  24790. charCodeToGlyphId[charCode] = glyphId;
  24791. }
  24792. });
  24793. } else {
  24794. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  24795. const cmapPlatformId = cmapTable.platformId;
  24796. const cmapEncodingId = cmapTable.encodingId;
  24797. const cmapMappings = cmapTable.mappings;
  24798. let baseEncoding = [],
  24799. forcePostTable = false;
  24800. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  24801. baseEncoding = getEncoding(properties.baseEncodingName);
  24802. }
  24803. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  24804. const glyphsUnicodeMap = getGlyphsUnicode();
  24805. for (let charCode = 0; charCode < 256; charCode++) {
  24806. let glyphName;
  24807. if (this.differences[charCode] !== undefined) {
  24808. glyphName = this.differences[charCode];
  24809. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  24810. glyphName = baseEncoding[charCode];
  24811. } else {
  24812. glyphName = StandardEncoding[charCode];
  24813. }
  24814. if (!glyphName) {
  24815. continue;
  24816. }
  24817. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  24818. let unicodeOrCharCode;
  24819. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  24820. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  24821. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  24822. unicodeOrCharCode = MacRomanEncoding.indexOf(standardGlyphName);
  24823. }
  24824. if (unicodeOrCharCode === undefined) {
  24825. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof IdentityToUnicodeMap)) {
  24826. const unicode = this.toUnicode.get(charCode);
  24827. if (unicode) {
  24828. unicodeOrCharCode = unicode.codePointAt(0);
  24829. }
  24830. }
  24831. if (unicodeOrCharCode === undefined) {
  24832. continue;
  24833. }
  24834. }
  24835. for (const mapping of cmapMappings) {
  24836. if (mapping.charCode !== unicodeOrCharCode) {
  24837. continue;
  24838. }
  24839. charCodeToGlyphId[charCode] = mapping.glyphId;
  24840. break;
  24841. }
  24842. }
  24843. } else if (cmapPlatformId === 0) {
  24844. for (const mapping of cmapMappings) {
  24845. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  24846. }
  24847. forcePostTable = true;
  24848. } else if (cmapPlatformId === 3 && cmapEncodingId === 0) {
  24849. for (const mapping of cmapMappings) {
  24850. let charCode = mapping.charCode;
  24851. if (charCode >= 0xf000 && charCode <= 0xf0ff) {
  24852. charCode &= 0xff;
  24853. }
  24854. charCodeToGlyphId[charCode] = mapping.glyphId;
  24855. }
  24856. } else {
  24857. for (const mapping of cmapMappings) {
  24858. charCodeToGlyphId[mapping.charCode] = mapping.glyphId;
  24859. }
  24860. }
  24861. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  24862. for (let i = 0; i < 256; ++i) {
  24863. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  24864. continue;
  24865. }
  24866. const glyphName = this.differences[i] || baseEncoding[i];
  24867. if (!glyphName) {
  24868. continue;
  24869. }
  24870. const glyphId = properties.glyphNames.indexOf(glyphName);
  24871. if (glyphId > 0 && hasGlyph(glyphId)) {
  24872. charCodeToGlyphId[i] = glyphId;
  24873. }
  24874. }
  24875. }
  24876. }
  24877. if (charCodeToGlyphId.length === 0) {
  24878. charCodeToGlyphId[0] = 0;
  24879. }
  24880. let glyphZeroId = numGlyphsOut - 1;
  24881. if (!dupFirstEntry) {
  24882. glyphZeroId = 0;
  24883. }
  24884. if (!properties.cssFontInfo) {
  24885. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId, this.toUnicode);
  24886. this.toFontChar = newMapping.toFontChar;
  24887. tables.cmap = {
  24888. tag: "cmap",
  24889. data: createCmapTable(newMapping.charCodeToGlyphId, newMapping.toUnicodeExtraMap, numGlyphsOut)
  24890. };
  24891. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  24892. tables["OS/2"] = {
  24893. tag: "OS/2",
  24894. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  24895. };
  24896. }
  24897. }
  24898. if (!isTrueType) {
  24899. try {
  24900. cffFile = new Stream(tables["CFF "].data);
  24901. const parser = new CFFParser(cffFile, properties, SEAC_ANALYSIS_ENABLED);
  24902. cff = parser.parse();
  24903. cff.duplicateFirstGlyph();
  24904. const compiler = new CFFCompiler(cff);
  24905. tables["CFF "].data = compiler.compile();
  24906. } catch {
  24907. warn("Failed to compile font " + properties.loadedName);
  24908. }
  24909. }
  24910. if (!tables.name) {
  24911. tables.name = {
  24912. tag: "name",
  24913. data: createNameTable(this.name)
  24914. };
  24915. } else {
  24916. const [namePrototype, nameRecords] = readNameTable(tables.name);
  24917. tables.name.data = createNameTable(name, namePrototype);
  24918. this.psName = namePrototype[0][6] || null;
  24919. if (!properties.composite) {
  24920. adjustTrueTypeToUnicode(properties, this.isSymbolicFont, nameRecords);
  24921. }
  24922. }
  24923. const builder = new OpenTypeFileBuilder(header.version);
  24924. for (const tableTag in tables) {
  24925. builder.addTable(tableTag, tables[tableTag].data);
  24926. }
  24927. return builder.toArray();
  24928. }
  24929. convert(fontName, font, properties) {
  24930. properties.fixedPitch = false;
  24931. if (properties.builtInEncoding) {
  24932. adjustType1ToUnicode(properties, properties.builtInEncoding);
  24933. }
  24934. let glyphZeroId = 1;
  24935. if (font instanceof CFFFont) {
  24936. glyphZeroId = font.numGlyphs - 1;
  24937. }
  24938. const mapping = font.getGlyphMapping(properties);
  24939. let newMapping = null;
  24940. let newCharCodeToGlyphId = mapping;
  24941. let toUnicodeExtraMap = null;
  24942. if (!properties.cssFontInfo) {
  24943. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId, this.toUnicode);
  24944. this.toFontChar = newMapping.toFontChar;
  24945. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  24946. toUnicodeExtraMap = newMapping.toUnicodeExtraMap;
  24947. }
  24948. const numGlyphs = font.numGlyphs;
  24949. function getCharCodes(charCodeToGlyphId, glyphId) {
  24950. let charCodes = null;
  24951. for (const charCode in charCodeToGlyphId) {
  24952. if (glyphId === charCodeToGlyphId[charCode]) {
  24953. (charCodes ||= []).push(charCode | 0);
  24954. }
  24955. }
  24956. return charCodes;
  24957. }
  24958. function createCharCode(charCodeToGlyphId, glyphId) {
  24959. for (const charCode in charCodeToGlyphId) {
  24960. if (glyphId === charCodeToGlyphId[charCode]) {
  24961. return charCode | 0;
  24962. }
  24963. }
  24964. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  24965. return newMapping.nextAvailableFontCharCode++;
  24966. }
  24967. const seacs = font.seacs;
  24968. if (newMapping && SEAC_ANALYSIS_ENABLED && seacs?.length) {
  24969. const matrix = properties.fontMatrix || FONT_IDENTITY_MATRIX;
  24970. const charset = font.getCharset();
  24971. const seacMap = Object.create(null);
  24972. for (let glyphId in seacs) {
  24973. glyphId |= 0;
  24974. const seac = seacs[glyphId];
  24975. const baseGlyphName = StandardEncoding[seac[2]];
  24976. const accentGlyphName = StandardEncoding[seac[3]];
  24977. const baseGlyphId = charset.indexOf(baseGlyphName);
  24978. const accentGlyphId = charset.indexOf(accentGlyphName);
  24979. if (baseGlyphId < 0 || accentGlyphId < 0) {
  24980. continue;
  24981. }
  24982. const accentOffset = {
  24983. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  24984. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  24985. };
  24986. const charCodes = getCharCodes(mapping, glyphId);
  24987. if (!charCodes) {
  24988. continue;
  24989. }
  24990. for (const charCode of charCodes) {
  24991. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  24992. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  24993. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  24994. seacMap[charCode] = {
  24995. baseFontCharCode,
  24996. accentFontCharCode,
  24997. accentOffset
  24998. };
  24999. }
  25000. }
  25001. properties.seacMap = seacMap;
  25002. }
  25003. const unitsPerEm = properties.fontMatrix ? 1 / Math.max(...properties.fontMatrix.slice(0, 4).map(Math.abs)) : 1000;
  25004. const builder = new OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  25005. builder.addTable("CFF ", font.data);
  25006. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  25007. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, toUnicodeExtraMap, numGlyphs));
  25008. builder.addTable("head", "\x00\x01\x00\x00" + "\x00\x00\x10\x00" + "\x00\x00\x00\x00" + "\x5F\x0F\x3C\xF5" + "\x00\x00" + safeString16(unitsPerEm) + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00\x00\x00\x9e\x0b\x7e\x27" + "\x00\x00" + safeString16(properties.descent) + "\x0F\xFF" + safeString16(properties.ascent) + string16(properties.italicAngle ? 2 : 0) + "\x00\x11" + "\x00\x00" + "\x00\x00" + "\x00\x00");
  25009. builder.addTable("hhea", "\x00\x01\x00\x00" + safeString16(properties.ascent) + safeString16(properties.descent) + "\x00\x00" + "\xFF\xFF" + "\x00\x00" + "\x00\x00" + "\x00\x00" + safeString16(properties.capHeight) + safeString16(Math.tan(properties.italicAngle) * properties.xHeight) + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + "\x00\x00" + string16(numGlyphs));
  25010. builder.addTable("hmtx", function fontFieldsHmtx() {
  25011. const charstrings = font.charstrings;
  25012. const cffWidths = font.cff ? font.cff.widths : null;
  25013. let hmtx = "\x00\x00\x00\x00";
  25014. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  25015. let width = 0;
  25016. if (charstrings) {
  25017. const charstring = charstrings[i - 1];
  25018. width = "width" in charstring ? charstring.width : 0;
  25019. } else if (cffWidths) {
  25020. width = Math.ceil(cffWidths[i] || 0);
  25021. }
  25022. hmtx += string16(width) + string16(0);
  25023. }
  25024. return hmtx;
  25025. }());
  25026. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  25027. builder.addTable("name", createNameTable(fontName));
  25028. builder.addTable("post", createPostTable(properties));
  25029. return builder.toArray();
  25030. }
  25031. get _spaceWidth() {
  25032. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  25033. let width;
  25034. for (const glyphName of possibleSpaceReplacements) {
  25035. if (glyphName in this.widths) {
  25036. width = this.widths[glyphName];
  25037. break;
  25038. }
  25039. const glyphsUnicodeMap = getGlyphsUnicode();
  25040. const glyphUnicode = glyphsUnicodeMap[glyphName];
  25041. let charcode = 0;
  25042. if (this.composite && this.cMap.contains(glyphUnicode)) {
  25043. charcode = this.cMap.lookup(glyphUnicode);
  25044. if (typeof charcode === "string") {
  25045. charcode = convertCidString(glyphUnicode, charcode);
  25046. }
  25047. }
  25048. if (!charcode && this.toUnicode) {
  25049. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  25050. }
  25051. if (charcode <= 0) {
  25052. charcode = glyphUnicode;
  25053. }
  25054. width = this.widths[charcode];
  25055. if (width) {
  25056. break;
  25057. }
  25058. }
  25059. return shadow(this, "_spaceWidth", width || this.defaultWidth);
  25060. }
  25061. _charToGlyph(charcode, isSpace = false) {
  25062. let glyph = this._glyphCache[charcode];
  25063. if (glyph?.isSpace === isSpace) {
  25064. return glyph;
  25065. }
  25066. let fontCharCode, width, operatorListId;
  25067. let widthCode = charcode;
  25068. if (this.cMap?.contains(charcode)) {
  25069. widthCode = this.cMap.lookup(charcode);
  25070. if (typeof widthCode === "string") {
  25071. widthCode = convertCidString(charcode, widthCode);
  25072. }
  25073. }
  25074. width = this.widths[widthCode];
  25075. if (typeof width !== "number") {
  25076. width = this.defaultWidth;
  25077. }
  25078. const vmetric = this.vmetrics?.[widthCode];
  25079. let unicode = this.toUnicode.get(charcode) || charcode;
  25080. if (typeof unicode === "number") {
  25081. unicode = String.fromCharCode(unicode);
  25082. }
  25083. let isInFont = this.toFontChar[charcode] !== undefined;
  25084. fontCharCode = this.toFontChar[charcode] || charcode;
  25085. if (this.missingFile) {
  25086. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  25087. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  25088. fontCharCode = 0x20;
  25089. if (glyphName === "") {
  25090. width ||= this._spaceWidth;
  25091. unicode = String.fromCharCode(fontCharCode);
  25092. }
  25093. }
  25094. fontCharCode = mapSpecialUnicodeValues(fontCharCode);
  25095. }
  25096. if (this.isType3Font) {
  25097. operatorListId = fontCharCode;
  25098. }
  25099. let accent = null;
  25100. if (this.seacMap?.[charcode]) {
  25101. isInFont = true;
  25102. const seac = this.seacMap[charcode];
  25103. fontCharCode = seac.baseFontCharCode;
  25104. accent = {
  25105. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  25106. offset: seac.accentOffset
  25107. };
  25108. }
  25109. let fontChar = "";
  25110. if (typeof fontCharCode === "number") {
  25111. if (fontCharCode <= 0x10ffff) {
  25112. fontChar = String.fromCodePoint(fontCharCode);
  25113. } else {
  25114. warn(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  25115. }
  25116. }
  25117. if (this.missingFile && this.vertical && fontChar.length === 1) {
  25118. const vertical = getVerticalPresentationForm()[fontChar.charCodeAt(0)];
  25119. if (vertical) {
  25120. fontChar = unicode = String.fromCharCode(vertical);
  25121. }
  25122. }
  25123. glyph = new fonts_Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  25124. return this._glyphCache[charcode] = glyph;
  25125. }
  25126. charsToGlyphs(chars) {
  25127. let glyphs = this._charsCache[chars];
  25128. if (glyphs) {
  25129. return glyphs;
  25130. }
  25131. glyphs = [];
  25132. if (this.cMap) {
  25133. const c = Object.create(null),
  25134. ii = chars.length;
  25135. let i = 0;
  25136. while (i < ii) {
  25137. this.cMap.readCharCode(chars, i, c);
  25138. const {
  25139. charcode,
  25140. length
  25141. } = c;
  25142. i += length;
  25143. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  25144. glyphs.push(glyph);
  25145. }
  25146. } else {
  25147. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25148. const charcode = chars.charCodeAt(i);
  25149. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  25150. glyphs.push(glyph);
  25151. }
  25152. }
  25153. return this._charsCache[chars] = glyphs;
  25154. }
  25155. getCharPositions(chars) {
  25156. const positions = [];
  25157. if (this.cMap) {
  25158. const c = Object.create(null);
  25159. let i = 0;
  25160. while (i < chars.length) {
  25161. this.cMap.readCharCode(chars, i, c);
  25162. const length = c.length;
  25163. positions.push([i, i + length]);
  25164. i += length;
  25165. }
  25166. } else {
  25167. for (let i = 0, ii = chars.length; i < ii; ++i) {
  25168. positions.push([i, i + 1]);
  25169. }
  25170. }
  25171. return positions;
  25172. }
  25173. get glyphCacheValues() {
  25174. return Object.values(this._glyphCache);
  25175. }
  25176. encodeString(str) {
  25177. const buffers = [];
  25178. const currentBuf = [];
  25179. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  25180. const getCharCode = this.toUnicode instanceof IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  25181. for (let i = 0, ii = str.length; i < ii; i++) {
  25182. const unicode = str.codePointAt(i);
  25183. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  25184. i++;
  25185. }
  25186. if (this.toUnicode) {
  25187. const charCode = getCharCode(unicode);
  25188. if (charCode !== -1) {
  25189. if (hasCurrentBufErrors()) {
  25190. buffers.push(currentBuf.join(""));
  25191. currentBuf.length = 0;
  25192. }
  25193. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  25194. for (let j = charCodeLength - 1; j >= 0; j--) {
  25195. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  25196. }
  25197. continue;
  25198. }
  25199. }
  25200. if (!hasCurrentBufErrors()) {
  25201. buffers.push(currentBuf.join(""));
  25202. currentBuf.length = 0;
  25203. }
  25204. currentBuf.push(String.fromCodePoint(unicode));
  25205. }
  25206. buffers.push(currentBuf.join(""));
  25207. return buffers;
  25208. }
  25209. }
  25210. class ErrorFont {
  25211. constructor(error) {
  25212. this.error = error;
  25213. this.loadedName = "g_font_error";
  25214. this.missingFile = true;
  25215. }
  25216. charsToGlyphs() {
  25217. return [];
  25218. }
  25219. encodeString(chars) {
  25220. return [chars];
  25221. }
  25222. exportData(extraProperties = false) {
  25223. return {
  25224. error: this.error
  25225. };
  25226. }
  25227. }
  25228. ;// ./src/core/pattern.js
  25229. const ShadingType = {
  25230. FUNCTION_BASED: 1,
  25231. AXIAL: 2,
  25232. RADIAL: 3,
  25233. FREE_FORM_MESH: 4,
  25234. LATTICE_FORM_MESH: 5,
  25235. COONS_PATCH_MESH: 6,
  25236. TENSOR_PATCH_MESH: 7
  25237. };
  25238. class Pattern {
  25239. constructor() {
  25240. unreachable("Cannot initialize Pattern.");
  25241. }
  25242. static parseShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache) {
  25243. const dict = shading instanceof BaseStream ? shading.dict : shading;
  25244. const type = dict.get("ShadingType");
  25245. try {
  25246. switch (type) {
  25247. case ShadingType.AXIAL:
  25248. case ShadingType.RADIAL:
  25249. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  25250. case ShadingType.FREE_FORM_MESH:
  25251. case ShadingType.LATTICE_FORM_MESH:
  25252. case ShadingType.COONS_PATCH_MESH:
  25253. case ShadingType.TENSOR_PATCH_MESH:
  25254. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  25255. default:
  25256. throw new FormatError("Unsupported ShadingType: " + type);
  25257. }
  25258. } catch (ex) {
  25259. if (ex instanceof MissingDataException) {
  25260. throw ex;
  25261. }
  25262. warn(ex);
  25263. return new DummyShading();
  25264. }
  25265. }
  25266. }
  25267. class BaseShading {
  25268. static SMALL_NUMBER = 1e-6;
  25269. getIR() {
  25270. unreachable("Abstract method `getIR` called.");
  25271. }
  25272. }
  25273. class RadialAxialShading extends BaseShading {
  25274. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  25275. super();
  25276. this.shadingType = dict.get("ShadingType");
  25277. let coordsLen = 0;
  25278. if (this.shadingType === ShadingType.AXIAL) {
  25279. coordsLen = 4;
  25280. } else if (this.shadingType === ShadingType.RADIAL) {
  25281. coordsLen = 6;
  25282. }
  25283. this.coordsArr = dict.getArray("Coords");
  25284. if (!isNumberArray(this.coordsArr, coordsLen)) {
  25285. throw new FormatError("RadialAxialShading: Invalid /Coords array.");
  25286. }
  25287. const cs = ColorSpace.parse({
  25288. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  25289. xref,
  25290. resources,
  25291. pdfFunctionFactory,
  25292. localColorSpaceCache
  25293. });
  25294. this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
  25295. let t0 = 0.0,
  25296. t1 = 1.0;
  25297. const domainArr = dict.getArray("Domain");
  25298. if (isNumberArray(domainArr, 2)) {
  25299. [t0, t1] = domainArr;
  25300. }
  25301. let extendStart = false,
  25302. extendEnd = false;
  25303. const extendArr = dict.getArray("Extend");
  25304. if (isBooleanArray(extendArr, 2)) {
  25305. [extendStart, extendEnd] = extendArr;
  25306. }
  25307. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  25308. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  25309. const distance = Math.hypot(x1 - x2, y1 - y2);
  25310. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  25311. warn("Unsupported radial gradient.");
  25312. }
  25313. }
  25314. this.extendStart = extendStart;
  25315. this.extendEnd = extendEnd;
  25316. const fnObj = dict.getRaw("Function");
  25317. const fn = pdfFunctionFactory.createFromArray(fnObj);
  25318. const NUMBER_OF_SAMPLES = 840;
  25319. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  25320. const colorStops = this.colorStops = [];
  25321. if (t0 >= t1 || step <= 0) {
  25322. info("Bad shading domain.");
  25323. return;
  25324. }
  25325. const color = new Float32Array(cs.numComps),
  25326. ratio = new Float32Array(1);
  25327. let rgbColor;
  25328. let iBase = 0;
  25329. ratio[0] = t0;
  25330. fn(ratio, 0, color, 0);
  25331. let rgbBase = cs.getRgb(color, 0);
  25332. const cssColorBase = Util.makeHexColor(rgbBase[0], rgbBase[1], rgbBase[2]);
  25333. colorStops.push([0, cssColorBase]);
  25334. let iPrev = 1;
  25335. ratio[0] = t0 + step;
  25336. fn(ratio, 0, color, 0);
  25337. let rgbPrev = cs.getRgb(color, 0);
  25338. let maxSlopeR = rgbPrev[0] - rgbBase[0] + 1;
  25339. let maxSlopeG = rgbPrev[1] - rgbBase[1] + 1;
  25340. let maxSlopeB = rgbPrev[2] - rgbBase[2] + 1;
  25341. let minSlopeR = rgbPrev[0] - rgbBase[0] - 1;
  25342. let minSlopeG = rgbPrev[1] - rgbBase[1] - 1;
  25343. let minSlopeB = rgbPrev[2] - rgbBase[2] - 1;
  25344. for (let i = 2; i < NUMBER_OF_SAMPLES; i++) {
  25345. ratio[0] = t0 + i * step;
  25346. fn(ratio, 0, color, 0);
  25347. rgbColor = cs.getRgb(color, 0);
  25348. const run = i - iBase;
  25349. maxSlopeR = Math.min(maxSlopeR, (rgbColor[0] - rgbBase[0] + 1) / run);
  25350. maxSlopeG = Math.min(maxSlopeG, (rgbColor[1] - rgbBase[1] + 1) / run);
  25351. maxSlopeB = Math.min(maxSlopeB, (rgbColor[2] - rgbBase[2] + 1) / run);
  25352. minSlopeR = Math.max(minSlopeR, (rgbColor[0] - rgbBase[0] - 1) / run);
  25353. minSlopeG = Math.max(minSlopeG, (rgbColor[1] - rgbBase[1] - 1) / run);
  25354. minSlopeB = Math.max(minSlopeB, (rgbColor[2] - rgbBase[2] - 1) / run);
  25355. const slopesExist = minSlopeR <= maxSlopeR && minSlopeG <= maxSlopeG && minSlopeB <= maxSlopeB;
  25356. if (!slopesExist) {
  25357. const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
  25358. colorStops.push([iPrev / NUMBER_OF_SAMPLES, cssColor]);
  25359. maxSlopeR = rgbColor[0] - rgbPrev[0] + 1;
  25360. maxSlopeG = rgbColor[1] - rgbPrev[1] + 1;
  25361. maxSlopeB = rgbColor[2] - rgbPrev[2] + 1;
  25362. minSlopeR = rgbColor[0] - rgbPrev[0] - 1;
  25363. minSlopeG = rgbColor[1] - rgbPrev[1] - 1;
  25364. minSlopeB = rgbColor[2] - rgbPrev[2] - 1;
  25365. iBase = iPrev;
  25366. rgbBase = rgbPrev;
  25367. }
  25368. iPrev = i;
  25369. rgbPrev = rgbColor;
  25370. }
  25371. const cssColor = Util.makeHexColor(rgbPrev[0], rgbPrev[1], rgbPrev[2]);
  25372. colorStops.push([1, cssColor]);
  25373. let background = "transparent";
  25374. if (dict.has("Background")) {
  25375. rgbColor = cs.getRgb(dict.get("Background"), 0);
  25376. background = Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  25377. }
  25378. if (!extendStart) {
  25379. colorStops.unshift([0, background]);
  25380. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  25381. }
  25382. if (!extendEnd) {
  25383. colorStops.at(-1)[0] -= BaseShading.SMALL_NUMBER;
  25384. colorStops.push([1, background]);
  25385. }
  25386. this.colorStops = colorStops;
  25387. }
  25388. getIR() {
  25389. const {
  25390. coordsArr,
  25391. shadingType
  25392. } = this;
  25393. let type, p0, p1, r0, r1;
  25394. if (shadingType === ShadingType.AXIAL) {
  25395. p0 = [coordsArr[0], coordsArr[1]];
  25396. p1 = [coordsArr[2], coordsArr[3]];
  25397. r0 = null;
  25398. r1 = null;
  25399. type = "axial";
  25400. } else if (shadingType === ShadingType.RADIAL) {
  25401. p0 = [coordsArr[0], coordsArr[1]];
  25402. p1 = [coordsArr[3], coordsArr[4]];
  25403. r0 = coordsArr[2];
  25404. r1 = coordsArr[5];
  25405. type = "radial";
  25406. } else {
  25407. unreachable(`getPattern type unknown: ${shadingType}`);
  25408. }
  25409. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  25410. }
  25411. }
  25412. class MeshStreamReader {
  25413. constructor(stream, context) {
  25414. this.stream = stream;
  25415. this.context = context;
  25416. this.buffer = 0;
  25417. this.bufferLength = 0;
  25418. const numComps = context.numComps;
  25419. this.tmpCompsBuf = new Float32Array(numComps);
  25420. const csNumComps = context.colorSpace.numComps;
  25421. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  25422. }
  25423. get hasData() {
  25424. if (this.stream.end) {
  25425. return this.stream.pos < this.stream.end;
  25426. }
  25427. if (this.bufferLength > 0) {
  25428. return true;
  25429. }
  25430. const nextByte = this.stream.getByte();
  25431. if (nextByte < 0) {
  25432. return false;
  25433. }
  25434. this.buffer = nextByte;
  25435. this.bufferLength = 8;
  25436. return true;
  25437. }
  25438. readBits(n) {
  25439. let buffer = this.buffer;
  25440. let bufferLength = this.bufferLength;
  25441. if (n === 32) {
  25442. if (bufferLength === 0) {
  25443. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  25444. }
  25445. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  25446. const nextByte = this.stream.getByte();
  25447. this.buffer = nextByte & (1 << bufferLength) - 1;
  25448. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  25449. }
  25450. if (n === 8 && bufferLength === 0) {
  25451. return this.stream.getByte();
  25452. }
  25453. while (bufferLength < n) {
  25454. buffer = buffer << 8 | this.stream.getByte();
  25455. bufferLength += 8;
  25456. }
  25457. bufferLength -= n;
  25458. this.bufferLength = bufferLength;
  25459. this.buffer = buffer & (1 << bufferLength) - 1;
  25460. return buffer >> bufferLength;
  25461. }
  25462. align() {
  25463. this.buffer = 0;
  25464. this.bufferLength = 0;
  25465. }
  25466. readFlag() {
  25467. return this.readBits(this.context.bitsPerFlag);
  25468. }
  25469. readCoordinate() {
  25470. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  25471. const xi = this.readBits(bitsPerCoordinate);
  25472. const yi = this.readBits(bitsPerCoordinate);
  25473. const decode = this.context.decode;
  25474. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  25475. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  25476. }
  25477. readComponents() {
  25478. const numComps = this.context.numComps;
  25479. const bitsPerComponent = this.context.bitsPerComponent;
  25480. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  25481. const decode = this.context.decode;
  25482. const components = this.tmpCompsBuf;
  25483. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  25484. const ci = this.readBits(bitsPerComponent);
  25485. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  25486. }
  25487. const color = this.tmpCsCompsBuf;
  25488. if (this.context.colorFn) {
  25489. this.context.colorFn(components, 0, color, 0);
  25490. }
  25491. return this.context.colorSpace.getRgb(color, 0);
  25492. }
  25493. }
  25494. let bCache = Object.create(null);
  25495. function buildB(count) {
  25496. const lut = [];
  25497. for (let i = 0; i <= count; i++) {
  25498. const t = i / count,
  25499. t_ = 1 - t;
  25500. lut.push(new Float32Array([t_ ** 3, 3 * t * t_ ** 2, 3 * t ** 2 * t_, t ** 3]));
  25501. }
  25502. return lut;
  25503. }
  25504. function getB(count) {
  25505. return bCache[count] ||= buildB(count);
  25506. }
  25507. function clearPatternCaches() {
  25508. bCache = Object.create(null);
  25509. }
  25510. class MeshShading extends BaseShading {
  25511. static MIN_SPLIT_PATCH_CHUNKS_AMOUNT = 3;
  25512. static MAX_SPLIT_PATCH_CHUNKS_AMOUNT = 20;
  25513. static TRIANGLE_DENSITY = 20;
  25514. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  25515. super();
  25516. if (!(stream instanceof BaseStream)) {
  25517. throw new FormatError("Mesh data is not a stream");
  25518. }
  25519. const dict = stream.dict;
  25520. this.shadingType = dict.get("ShadingType");
  25521. this.bbox = lookupNormalRect(dict.getArray("BBox"), null);
  25522. const cs = ColorSpace.parse({
  25523. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  25524. xref,
  25525. resources,
  25526. pdfFunctionFactory,
  25527. localColorSpaceCache
  25528. });
  25529. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  25530. const fnObj = dict.getRaw("Function");
  25531. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  25532. this.coords = [];
  25533. this.colors = [];
  25534. this.figures = [];
  25535. const decodeContext = {
  25536. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  25537. bitsPerComponent: dict.get("BitsPerComponent"),
  25538. bitsPerFlag: dict.get("BitsPerFlag"),
  25539. decode: dict.getArray("Decode"),
  25540. colorFn: fn,
  25541. colorSpace: cs,
  25542. numComps: fn ? 1 : cs.numComps
  25543. };
  25544. const reader = new MeshStreamReader(stream, decodeContext);
  25545. let patchMesh = false;
  25546. switch (this.shadingType) {
  25547. case ShadingType.FREE_FORM_MESH:
  25548. this._decodeType4Shading(reader);
  25549. break;
  25550. case ShadingType.LATTICE_FORM_MESH:
  25551. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  25552. if (verticesPerRow < 2) {
  25553. throw new FormatError("Invalid VerticesPerRow");
  25554. }
  25555. this._decodeType5Shading(reader, verticesPerRow);
  25556. break;
  25557. case ShadingType.COONS_PATCH_MESH:
  25558. this._decodeType6Shading(reader);
  25559. patchMesh = true;
  25560. break;
  25561. case ShadingType.TENSOR_PATCH_MESH:
  25562. this._decodeType7Shading(reader);
  25563. patchMesh = true;
  25564. break;
  25565. default:
  25566. unreachable("Unsupported mesh type.");
  25567. break;
  25568. }
  25569. if (patchMesh) {
  25570. this._updateBounds();
  25571. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  25572. this._buildFigureFromPatch(i);
  25573. }
  25574. }
  25575. this._updateBounds();
  25576. this._packData();
  25577. }
  25578. _decodeType4Shading(reader) {
  25579. const coords = this.coords;
  25580. const colors = this.colors;
  25581. const operators = [];
  25582. const ps = [];
  25583. let verticesLeft = 0;
  25584. while (reader.hasData) {
  25585. const f = reader.readFlag();
  25586. const coord = reader.readCoordinate();
  25587. const color = reader.readComponents();
  25588. if (verticesLeft === 0) {
  25589. if (!(0 <= f && f <= 2)) {
  25590. throw new FormatError("Unknown type4 flag");
  25591. }
  25592. switch (f) {
  25593. case 0:
  25594. verticesLeft = 3;
  25595. break;
  25596. case 1:
  25597. ps.push(ps.at(-2), ps.at(-1));
  25598. verticesLeft = 1;
  25599. break;
  25600. case 2:
  25601. ps.push(ps.at(-3), ps.at(-1));
  25602. verticesLeft = 1;
  25603. break;
  25604. }
  25605. operators.push(f);
  25606. }
  25607. ps.push(coords.length);
  25608. coords.push(coord);
  25609. colors.push(color);
  25610. verticesLeft--;
  25611. reader.align();
  25612. }
  25613. this.figures.push({
  25614. type: "triangles",
  25615. coords: new Int32Array(ps),
  25616. colors: new Int32Array(ps)
  25617. });
  25618. }
  25619. _decodeType5Shading(reader, verticesPerRow) {
  25620. const coords = this.coords;
  25621. const colors = this.colors;
  25622. const ps = [];
  25623. while (reader.hasData) {
  25624. const coord = reader.readCoordinate();
  25625. const color = reader.readComponents();
  25626. ps.push(coords.length);
  25627. coords.push(coord);
  25628. colors.push(color);
  25629. }
  25630. this.figures.push({
  25631. type: "lattice",
  25632. coords: new Int32Array(ps),
  25633. colors: new Int32Array(ps),
  25634. verticesPerRow
  25635. });
  25636. }
  25637. _decodeType6Shading(reader) {
  25638. const coords = this.coords;
  25639. const colors = this.colors;
  25640. const ps = new Int32Array(16);
  25641. const cs = new Int32Array(4);
  25642. while (reader.hasData) {
  25643. const f = reader.readFlag();
  25644. if (!(0 <= f && f <= 3)) {
  25645. throw new FormatError("Unknown type6 flag");
  25646. }
  25647. const pi = coords.length;
  25648. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  25649. coords.push(reader.readCoordinate());
  25650. }
  25651. const ci = colors.length;
  25652. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  25653. colors.push(reader.readComponents());
  25654. }
  25655. let tmp1, tmp2, tmp3, tmp4;
  25656. switch (f) {
  25657. case 0:
  25658. ps[12] = pi + 3;
  25659. ps[13] = pi + 4;
  25660. ps[14] = pi + 5;
  25661. ps[15] = pi + 6;
  25662. ps[8] = pi + 2;
  25663. ps[11] = pi + 7;
  25664. ps[4] = pi + 1;
  25665. ps[7] = pi + 8;
  25666. ps[0] = pi;
  25667. ps[1] = pi + 11;
  25668. ps[2] = pi + 10;
  25669. ps[3] = pi + 9;
  25670. cs[2] = ci + 1;
  25671. cs[3] = ci + 2;
  25672. cs[0] = ci;
  25673. cs[1] = ci + 3;
  25674. break;
  25675. case 1:
  25676. tmp1 = ps[12];
  25677. tmp2 = ps[13];
  25678. tmp3 = ps[14];
  25679. tmp4 = ps[15];
  25680. ps[12] = tmp4;
  25681. ps[13] = pi + 0;
  25682. ps[14] = pi + 1;
  25683. ps[15] = pi + 2;
  25684. ps[8] = tmp3;
  25685. ps[11] = pi + 3;
  25686. ps[4] = tmp2;
  25687. ps[7] = pi + 4;
  25688. ps[0] = tmp1;
  25689. ps[1] = pi + 7;
  25690. ps[2] = pi + 6;
  25691. ps[3] = pi + 5;
  25692. tmp1 = cs[2];
  25693. tmp2 = cs[3];
  25694. cs[2] = tmp2;
  25695. cs[3] = ci;
  25696. cs[0] = tmp1;
  25697. cs[1] = ci + 1;
  25698. break;
  25699. case 2:
  25700. tmp1 = ps[15];
  25701. tmp2 = ps[11];
  25702. ps[12] = ps[3];
  25703. ps[13] = pi + 0;
  25704. ps[14] = pi + 1;
  25705. ps[15] = pi + 2;
  25706. ps[8] = ps[7];
  25707. ps[11] = pi + 3;
  25708. ps[4] = tmp2;
  25709. ps[7] = pi + 4;
  25710. ps[0] = tmp1;
  25711. ps[1] = pi + 7;
  25712. ps[2] = pi + 6;
  25713. ps[3] = pi + 5;
  25714. tmp1 = cs[3];
  25715. cs[2] = cs[1];
  25716. cs[3] = ci;
  25717. cs[0] = tmp1;
  25718. cs[1] = ci + 1;
  25719. break;
  25720. case 3:
  25721. ps[12] = ps[0];
  25722. ps[13] = pi + 0;
  25723. ps[14] = pi + 1;
  25724. ps[15] = pi + 2;
  25725. ps[8] = ps[1];
  25726. ps[11] = pi + 3;
  25727. ps[4] = ps[2];
  25728. ps[7] = pi + 4;
  25729. ps[0] = ps[3];
  25730. ps[1] = pi + 7;
  25731. ps[2] = pi + 6;
  25732. ps[3] = pi + 5;
  25733. cs[2] = cs[0];
  25734. cs[3] = ci;
  25735. cs[0] = cs[1];
  25736. cs[1] = ci + 1;
  25737. break;
  25738. }
  25739. ps[5] = coords.length;
  25740. coords.push([(-4 * coords[ps[0]][0] - coords[ps[15]][0] + 6 * (coords[ps[4]][0] + coords[ps[1]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[13]][0] + coords[ps[7]][0])) / 9, (-4 * coords[ps[0]][1] - coords[ps[15]][1] + 6 * (coords[ps[4]][1] + coords[ps[1]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[13]][1] + coords[ps[7]][1])) / 9]);
  25741. ps[6] = coords.length;
  25742. coords.push([(-4 * coords[ps[3]][0] - coords[ps[12]][0] + 6 * (coords[ps[2]][0] + coords[ps[7]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[4]][0] + coords[ps[14]][0])) / 9, (-4 * coords[ps[3]][1] - coords[ps[12]][1] + 6 * (coords[ps[2]][1] + coords[ps[7]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[4]][1] + coords[ps[14]][1])) / 9]);
  25743. ps[9] = coords.length;
  25744. coords.push([(-4 * coords[ps[12]][0] - coords[ps[3]][0] + 6 * (coords[ps[8]][0] + coords[ps[13]][0]) - 2 * (coords[ps[0]][0] + coords[ps[15]][0]) + 3 * (coords[ps[11]][0] + coords[ps[1]][0])) / 9, (-4 * coords[ps[12]][1] - coords[ps[3]][1] + 6 * (coords[ps[8]][1] + coords[ps[13]][1]) - 2 * (coords[ps[0]][1] + coords[ps[15]][1]) + 3 * (coords[ps[11]][1] + coords[ps[1]][1])) / 9]);
  25745. ps[10] = coords.length;
  25746. coords.push([(-4 * coords[ps[15]][0] - coords[ps[0]][0] + 6 * (coords[ps[11]][0] + coords[ps[14]][0]) - 2 * (coords[ps[12]][0] + coords[ps[3]][0]) + 3 * (coords[ps[2]][0] + coords[ps[8]][0])) / 9, (-4 * coords[ps[15]][1] - coords[ps[0]][1] + 6 * (coords[ps[11]][1] + coords[ps[14]][1]) - 2 * (coords[ps[12]][1] + coords[ps[3]][1]) + 3 * (coords[ps[2]][1] + coords[ps[8]][1])) / 9]);
  25747. this.figures.push({
  25748. type: "patch",
  25749. coords: new Int32Array(ps),
  25750. colors: new Int32Array(cs)
  25751. });
  25752. }
  25753. }
  25754. _decodeType7Shading(reader) {
  25755. const coords = this.coords;
  25756. const colors = this.colors;
  25757. const ps = new Int32Array(16);
  25758. const cs = new Int32Array(4);
  25759. while (reader.hasData) {
  25760. const f = reader.readFlag();
  25761. if (!(0 <= f && f <= 3)) {
  25762. throw new FormatError("Unknown type7 flag");
  25763. }
  25764. const pi = coords.length;
  25765. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  25766. coords.push(reader.readCoordinate());
  25767. }
  25768. const ci = colors.length;
  25769. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  25770. colors.push(reader.readComponents());
  25771. }
  25772. let tmp1, tmp2, tmp3, tmp4;
  25773. switch (f) {
  25774. case 0:
  25775. ps[12] = pi + 3;
  25776. ps[13] = pi + 4;
  25777. ps[14] = pi + 5;
  25778. ps[15] = pi + 6;
  25779. ps[8] = pi + 2;
  25780. ps[9] = pi + 13;
  25781. ps[10] = pi + 14;
  25782. ps[11] = pi + 7;
  25783. ps[4] = pi + 1;
  25784. ps[5] = pi + 12;
  25785. ps[6] = pi + 15;
  25786. ps[7] = pi + 8;
  25787. ps[0] = pi;
  25788. ps[1] = pi + 11;
  25789. ps[2] = pi + 10;
  25790. ps[3] = pi + 9;
  25791. cs[2] = ci + 1;
  25792. cs[3] = ci + 2;
  25793. cs[0] = ci;
  25794. cs[1] = ci + 3;
  25795. break;
  25796. case 1:
  25797. tmp1 = ps[12];
  25798. tmp2 = ps[13];
  25799. tmp3 = ps[14];
  25800. tmp4 = ps[15];
  25801. ps[12] = tmp4;
  25802. ps[13] = pi + 0;
  25803. ps[14] = pi + 1;
  25804. ps[15] = pi + 2;
  25805. ps[8] = tmp3;
  25806. ps[9] = pi + 9;
  25807. ps[10] = pi + 10;
  25808. ps[11] = pi + 3;
  25809. ps[4] = tmp2;
  25810. ps[5] = pi + 8;
  25811. ps[6] = pi + 11;
  25812. ps[7] = pi + 4;
  25813. ps[0] = tmp1;
  25814. ps[1] = pi + 7;
  25815. ps[2] = pi + 6;
  25816. ps[3] = pi + 5;
  25817. tmp1 = cs[2];
  25818. tmp2 = cs[3];
  25819. cs[2] = tmp2;
  25820. cs[3] = ci;
  25821. cs[0] = tmp1;
  25822. cs[1] = ci + 1;
  25823. break;
  25824. case 2:
  25825. tmp1 = ps[15];
  25826. tmp2 = ps[11];
  25827. ps[12] = ps[3];
  25828. ps[13] = pi + 0;
  25829. ps[14] = pi + 1;
  25830. ps[15] = pi + 2;
  25831. ps[8] = ps[7];
  25832. ps[9] = pi + 9;
  25833. ps[10] = pi + 10;
  25834. ps[11] = pi + 3;
  25835. ps[4] = tmp2;
  25836. ps[5] = pi + 8;
  25837. ps[6] = pi + 11;
  25838. ps[7] = pi + 4;
  25839. ps[0] = tmp1;
  25840. ps[1] = pi + 7;
  25841. ps[2] = pi + 6;
  25842. ps[3] = pi + 5;
  25843. tmp1 = cs[3];
  25844. cs[2] = cs[1];
  25845. cs[3] = ci;
  25846. cs[0] = tmp1;
  25847. cs[1] = ci + 1;
  25848. break;
  25849. case 3:
  25850. ps[12] = ps[0];
  25851. ps[13] = pi + 0;
  25852. ps[14] = pi + 1;
  25853. ps[15] = pi + 2;
  25854. ps[8] = ps[1];
  25855. ps[9] = pi + 9;
  25856. ps[10] = pi + 10;
  25857. ps[11] = pi + 3;
  25858. ps[4] = ps[2];
  25859. ps[5] = pi + 8;
  25860. ps[6] = pi + 11;
  25861. ps[7] = pi + 4;
  25862. ps[0] = ps[3];
  25863. ps[1] = pi + 7;
  25864. ps[2] = pi + 6;
  25865. ps[3] = pi + 5;
  25866. cs[2] = cs[0];
  25867. cs[3] = ci;
  25868. cs[0] = cs[1];
  25869. cs[1] = ci + 1;
  25870. break;
  25871. }
  25872. this.figures.push({
  25873. type: "patch",
  25874. coords: new Int32Array(ps),
  25875. colors: new Int32Array(cs)
  25876. });
  25877. }
  25878. }
  25879. _buildFigureFromPatch(index) {
  25880. const figure = this.figures[index];
  25881. assert(figure.type === "patch", "Unexpected patch mesh figure");
  25882. const coords = this.coords,
  25883. colors = this.colors;
  25884. const pi = figure.coords;
  25885. const ci = figure.colors;
  25886. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  25887. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  25888. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  25889. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  25890. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  25891. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  25892. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  25893. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  25894. const verticesPerRow = splitXBy + 1;
  25895. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  25896. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  25897. let k = 0;
  25898. const cl = new Uint8Array(3),
  25899. cr = new Uint8Array(3);
  25900. const c0 = colors[ci[0]],
  25901. c1 = colors[ci[1]],
  25902. c2 = colors[ci[2]],
  25903. c3 = colors[ci[3]];
  25904. const bRow = getB(splitYBy),
  25905. bCol = getB(splitXBy);
  25906. for (let row = 0; row <= splitYBy; row++) {
  25907. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  25908. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  25909. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  25910. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  25911. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  25912. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  25913. for (let col = 0; col <= splitXBy; col++, k++) {
  25914. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  25915. continue;
  25916. }
  25917. let x = 0,
  25918. y = 0;
  25919. let q = 0;
  25920. for (let i = 0; i <= 3; i++) {
  25921. for (let j = 0; j <= 3; j++, q++) {
  25922. const m = bRow[row][i] * bCol[col][j];
  25923. x += coords[pi[q]][0] * m;
  25924. y += coords[pi[q]][1] * m;
  25925. }
  25926. }
  25927. figureCoords[k] = coords.length;
  25928. coords.push([x, y]);
  25929. figureColors[k] = colors.length;
  25930. const newColor = new Uint8Array(3);
  25931. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  25932. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  25933. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  25934. colors.push(newColor);
  25935. }
  25936. }
  25937. figureCoords[0] = pi[0];
  25938. figureColors[0] = ci[0];
  25939. figureCoords[splitXBy] = pi[3];
  25940. figureColors[splitXBy] = ci[1];
  25941. figureCoords[verticesPerRow * splitYBy] = pi[12];
  25942. figureColors[verticesPerRow * splitYBy] = ci[2];
  25943. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  25944. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  25945. this.figures[index] = {
  25946. type: "lattice",
  25947. coords: figureCoords,
  25948. colors: figureColors,
  25949. verticesPerRow
  25950. };
  25951. }
  25952. _updateBounds() {
  25953. let minX = this.coords[0][0],
  25954. minY = this.coords[0][1],
  25955. maxX = minX,
  25956. maxY = minY;
  25957. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  25958. const x = this.coords[i][0],
  25959. y = this.coords[i][1];
  25960. minX = minX > x ? x : minX;
  25961. minY = minY > y ? y : minY;
  25962. maxX = maxX < x ? x : maxX;
  25963. maxY = maxY < y ? y : maxY;
  25964. }
  25965. this.bounds = [minX, minY, maxX, maxY];
  25966. }
  25967. _packData() {
  25968. let i, ii, j, jj;
  25969. const coords = this.coords;
  25970. const coordsPacked = new Float32Array(coords.length * 2);
  25971. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  25972. const xy = coords[i];
  25973. coordsPacked[j++] = xy[0];
  25974. coordsPacked[j++] = xy[1];
  25975. }
  25976. this.coords = coordsPacked;
  25977. const colors = this.colors;
  25978. const colorsPacked = new Uint8Array(colors.length * 3);
  25979. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  25980. const c = colors[i];
  25981. colorsPacked[j++] = c[0];
  25982. colorsPacked[j++] = c[1];
  25983. colorsPacked[j++] = c[2];
  25984. }
  25985. this.colors = colorsPacked;
  25986. const figures = this.figures;
  25987. for (i = 0, ii = figures.length; i < ii; i++) {
  25988. const figure = figures[i],
  25989. ps = figure.coords,
  25990. cs = figure.colors;
  25991. for (j = 0, jj = ps.length; j < jj; j++) {
  25992. ps[j] *= 2;
  25993. cs[j] *= 3;
  25994. }
  25995. }
  25996. }
  25997. getIR() {
  25998. const {
  25999. bounds
  26000. } = this;
  26001. if (bounds[2] - bounds[0] === 0 || bounds[3] - bounds[1] === 0) {
  26002. throw new FormatError(`Invalid MeshShading bounds: [${bounds}].`);
  26003. }
  26004. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, bounds, this.bbox, this.background];
  26005. }
  26006. }
  26007. class DummyShading extends BaseShading {
  26008. getIR() {
  26009. return ["Dummy"];
  26010. }
  26011. }
  26012. function getTilingPatternIR(operatorList, dict, color) {
  26013. const matrix = lookupMatrix(dict.getArray("Matrix"), IDENTITY_MATRIX);
  26014. const bbox = lookupNormalRect(dict.getArray("BBox"), null);
  26015. if (!bbox || bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  26016. throw new FormatError(`Invalid getTilingPatternIR /BBox array.`);
  26017. }
  26018. const xstep = dict.get("XStep");
  26019. if (typeof xstep !== "number") {
  26020. throw new FormatError(`Invalid getTilingPatternIR /XStep value.`);
  26021. }
  26022. const ystep = dict.get("YStep");
  26023. if (typeof ystep !== "number") {
  26024. throw new FormatError(`Invalid getTilingPatternIR /YStep value.`);
  26025. }
  26026. const paintType = dict.get("PaintType");
  26027. if (!Number.isInteger(paintType)) {
  26028. throw new FormatError(`Invalid getTilingPatternIR /PaintType value.`);
  26029. }
  26030. const tilingType = dict.get("TilingType");
  26031. if (!Number.isInteger(tilingType)) {
  26032. throw new FormatError(`Invalid getTilingPatternIR /TilingType value.`);
  26033. }
  26034. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  26035. }
  26036. ;// ./src/core/calibri_factors.js
  26037. const CalibriBoldFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.54657, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.73293, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.9121, 0.86943, 0.79795, 0.88198, 0.77958, 0.70864, 0.81055, 0.90399, 0.88653, 0.96017, 0.82577, 0.77892, 0.78257, 0.97507, 1.54657, 0.97507, 0.85284, 0.89552, 0.90176, 0.88762, 0.8785, 0.75241, 0.8785, 0.90518, 0.95015, 0.77618, 0.8785, 0.88401, 0.91916, 0.86304, 0.88401, 0.91488, 0.8785, 0.8801, 0.8785, 0.8785, 0.91343, 0.7173, 1.04106, 0.8785, 0.85075, 0.95794, 0.82616, 0.85162, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.12401, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.73293, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.9121, 0.86943, 0.86943, 0.86943, 0.86943, 0.86943, 0.85284, 0.87508, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.88762, 0.8715, 0.75241, 0.90518, 0.90518, 0.90518, 0.90518, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.8785, 0.8801, 0.8801, 0.8801, 0.8801, 0.8801, 0.90747, 0.89049, 0.8785, 0.8785, 0.8785, 0.8785, 0.85162, 0.8785, 0.85162, 0.83908, 0.88762, 0.83908, 0.88762, 0.83908, 0.88762, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.73293, 0.75241, 0.87289, 0.83016, 0.88506, 0.93125, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.73133, 0.90518, 0.81921, 0.77618, 0.81921, 0.77618, 0.81921, 0.77618, 1, 1, 0.87356, 0.8785, 0.91075, 0.89608, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76229, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.79468, 0.91926, 0.88175, 0.70823, 0.94903, 0.9121, 0.8785, 1, 1, 0.9121, 0.8785, 0.87802, 0.88656, 0.8785, 0.86943, 0.8801, 0.86943, 0.8801, 0.86943, 0.8801, 0.87402, 0.89291, 0.77958, 0.91343, 1, 1, 0.77958, 0.91343, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 0.70864, 0.7173, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.90399, 0.8785, 0.96017, 0.95794, 0.77892, 0.85162, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.88762, 0.77539, 0.8715, 0.87508, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70674, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.06303, 0.83908, 0.80352, 0.57184, 0.6965, 0.56289, 0.82001, 0.56029, 0.81235, 1.02988, 0.83908, 0.7762, 0.68156, 0.80367, 0.73133, 0.78257, 0.87356, 0.86943, 0.95958, 0.75727, 0.89019, 1.04924, 0.9121, 0.7648, 0.86943, 0.87356, 0.79795, 0.78275, 0.81055, 0.77892, 0.9762, 0.82577, 0.99819, 0.84896, 0.95958, 0.77892, 0.96108, 1.01407, 0.89049, 1.02988, 0.94211, 0.96108, 0.8936, 0.84021, 0.87842, 0.96399, 0.79109, 0.89049, 1.00813, 1.02988, 0.86077, 0.87445, 0.92099, 0.84723, 0.86513, 0.8801, 0.75638, 0.85714, 0.78216, 0.79586, 0.87965, 0.94211, 0.97747, 0.78287, 0.97926, 0.84971, 1.02988, 0.94211, 0.8801, 0.94211, 0.84971, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90264, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90518, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90548, 1, 1, 1, 1, 1, 1, 0.96017, 0.95794, 0.96017, 0.95794, 0.96017, 0.95794, 0.77892, 0.85162, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.92794, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71143, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.93835, 0.83406, 0.91133, 0.84107, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90527, 1.81055, 0.90527, 1.81055, 1.31006, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26038. const CalibriBoldMetrics = {
  26039. lineHeight: 1.2207,
  26040. lineGap: 0.2207
  26041. };
  26042. const CalibriBoldItalicFactors = [1.3877, 1, 1, 1, 0.97801, 0.92482, 0.89552, 0.91133, 0.81988, 0.97566, 0.98152, 0.93548, 0.93548, 1.2798, 0.85284, 0.92794, 1, 0.96134, 1.56239, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.82845, 0.82845, 0.85284, 0.85284, 0.85284, 0.75859, 0.92138, 0.83908, 0.7762, 0.71805, 0.87289, 0.73133, 0.7514, 0.81921, 0.87356, 0.95958, 0.59526, 0.75727, 0.69225, 1.04924, 0.90872, 0.85938, 0.79795, 0.87068, 0.77958, 0.69766, 0.81055, 0.90399, 0.88653, 0.96068, 0.82577, 0.77892, 0.78257, 0.97507, 1.529, 0.97507, 0.85284, 0.89552, 0.90176, 0.94908, 0.86411, 0.74012, 0.86411, 0.88323, 0.95015, 0.86411, 0.86331, 0.88401, 0.91916, 0.86304, 0.88401, 0.9039, 0.86331, 0.86331, 0.86411, 0.86411, 0.90464, 0.70852, 1.04106, 0.86331, 0.84372, 0.95794, 0.82616, 0.84548, 0.79492, 0.88331, 1.69808, 0.88331, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.7801, 0.89552, 1.24487, 1.13254, 1.19129, 0.96839, 0.85284, 0.68787, 0.70645, 0.85592, 0.90747, 1.01466, 1.0088, 0.90323, 1, 1.07463, 1, 0.91056, 0.75806, 1.19118, 0.96839, 0.78864, 0.82845, 0.84133, 0.75859, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.83908, 0.77539, 0.71805, 0.73133, 0.73133, 0.73133, 0.73133, 0.95958, 0.95958, 0.95958, 0.95958, 0.88506, 0.90872, 0.85938, 0.85938, 0.85938, 0.85938, 0.85938, 0.85284, 0.87068, 0.90399, 0.90399, 0.90399, 0.90399, 0.77892, 0.79795, 0.90807, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.94908, 0.85887, 0.74012, 0.88323, 0.88323, 0.88323, 0.88323, 0.88401, 0.88401, 0.88401, 0.88401, 0.8785, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.86331, 0.90747, 0.89049, 0.86331, 0.86331, 0.86331, 0.86331, 0.84548, 0.86411, 0.84548, 0.83908, 0.94908, 0.83908, 0.94908, 0.83908, 0.94908, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.71805, 0.74012, 0.87289, 0.79538, 0.88506, 0.92726, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.73133, 0.88323, 0.81921, 0.86411, 0.81921, 0.86411, 0.81921, 0.86411, 1, 1, 0.87356, 0.86331, 0.91075, 0.8777, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.95958, 0.88401, 0.76467, 0.90167, 0.59526, 0.91916, 1, 1, 0.86304, 0.69225, 0.88401, 1, 1, 0.70424, 0.77312, 0.91926, 0.88175, 0.70823, 0.94903, 0.90872, 0.86331, 1, 1, 0.90872, 0.86331, 0.86906, 0.88116, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.85938, 0.86331, 0.87402, 0.86549, 0.77958, 0.90464, 1, 1, 0.77958, 0.90464, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 0.69766, 0.70852, 1, 1, 0.81055, 0.75841, 0.81055, 1.06452, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.90399, 0.86331, 0.96068, 0.95794, 0.77892, 0.84548, 0.77892, 0.78257, 0.79492, 0.78257, 0.79492, 0.78257, 0.79492, 0.9297, 0.56892, 0.83908, 0.94908, 0.77539, 0.85887, 0.87068, 0.89049, 1, 1, 0.81055, 1.04106, 1.20528, 1.20528, 1, 1.15543, 0.70088, 0.98387, 0.94721, 1.33431, 1.45894, 0.95161, 1.48387, 0.83908, 0.80352, 0.57118, 0.6965, 0.56347, 0.79179, 0.55853, 0.80346, 1.02988, 0.83908, 0.7762, 0.67174, 0.86036, 0.73133, 0.78257, 0.87356, 0.86441, 0.95958, 0.75727, 0.89019, 1.04924, 0.90872, 0.74889, 0.85938, 0.87891, 0.79795, 0.7957, 0.81055, 0.77892, 0.97447, 0.82577, 0.97466, 0.87179, 0.95958, 0.77892, 0.94252, 0.95612, 0.8753, 1.02988, 0.92733, 0.94252, 0.87411, 0.84021, 0.8728, 0.95612, 0.74081, 0.8753, 1.02189, 1.02988, 0.84814, 0.87445, 0.91822, 0.84723, 0.85668, 0.86331, 0.81344, 0.87581, 0.76422, 0.82046, 0.96057, 0.92733, 0.99375, 0.78022, 0.95452, 0.86015, 1.02988, 0.92733, 0.86331, 0.92733, 0.86015, 0.73133, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90631, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88323, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85174, 1, 1, 1, 1, 1, 1, 0.96068, 0.95794, 0.96068, 0.95794, 0.96068, 0.95794, 0.77892, 0.84548, 1, 1, 0.89552, 0.90527, 1, 0.90363, 0.92794, 0.92794, 0.92794, 0.89807, 0.87012, 0.87012, 0.87012, 0.89552, 0.89552, 1.42259, 0.71094, 1.06152, 1, 1, 1.03372, 1.03372, 0.97171, 1.4956, 2.2807, 0.92972, 0.83406, 0.91133, 0.83326, 0.91133, 1, 1, 1, 0.72021, 1, 1.23108, 0.83489, 0.88525, 0.88525, 0.81499, 0.90616, 1.81055, 0.90527, 1.81055, 1.3107, 1.53711, 0.94434, 1.08696, 1, 0.95018, 0.77192, 0.85284, 0.90747, 1.17534, 0.69825, 0.9716, 1.37077, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.08004, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90727, 0.90727, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26043. const CalibriBoldItalicMetrics = {
  26044. lineHeight: 1.2207,
  26045. lineGap: 0.2207
  26046. };
  26047. const CalibriItalicFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39543, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.72346, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89249, 0.84118, 0.77452, 0.85374, 0.75186, 0.67789, 0.79776, 0.88844, 0.85066, 0.94309, 0.77818, 0.7306, 0.76659, 1.10369, 1.38313, 1.10369, 1.06139, 0.89552, 0.8739, 0.9245, 0.9245, 0.83203, 0.9245, 0.85865, 1.09842, 0.9245, 0.9245, 1.03297, 1.07692, 0.90918, 1.03297, 0.94959, 0.9245, 0.92274, 0.9245, 0.9245, 1.02933, 0.77832, 1.20562, 0.9245, 0.8916, 0.98986, 0.86621, 0.89453, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.16359, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.72346, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89249, 0.84118, 0.84118, 0.84118, 0.84118, 0.84118, 0.85284, 0.84557, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.9245, 0.84843, 0.83203, 0.85865, 0.85865, 0.85865, 0.85865, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.9245, 0.92274, 0.92274, 0.92274, 0.92274, 0.92274, 0.90747, 0.86651, 0.9245, 0.9245, 0.9245, 0.9245, 0.89453, 0.9245, 0.89453, 0.8675, 0.9245, 0.8675, 0.9245, 0.8675, 0.9245, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.72346, 0.83203, 0.85193, 0.8875, 0.86477, 0.99034, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.73206, 0.85865, 0.81105, 0.9245, 0.81105, 0.9245, 0.81105, 0.9245, 1, 1, 0.86275, 0.9245, 0.90872, 0.93591, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77896, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.9375, 0.98156, 0.93407, 0.77261, 1.11429, 0.89249, 0.9245, 1, 1, 0.89249, 0.9245, 0.92534, 0.86698, 0.9245, 0.84118, 0.92274, 0.84118, 0.92274, 0.84118, 0.92274, 0.8667, 0.86291, 0.75186, 1.02933, 1, 1, 0.75186, 1.02933, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 0.67789, 0.77832, 1, 1, 0.79776, 0.97655, 0.79776, 1.23023, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.88844, 0.9245, 0.94309, 0.98986, 0.7306, 0.89453, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.9245, 0.76318, 0.84843, 0.84557, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67009, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.8675, 0.90861, 0.6192, 0.7363, 0.64824, 0.82411, 0.56321, 0.85696, 1.23516, 0.8675, 0.81552, 0.7286, 0.84134, 0.73206, 0.76659, 0.86275, 0.84369, 0.90685, 0.77892, 0.85871, 1.02638, 0.89249, 0.75828, 0.84118, 0.85984, 0.77452, 0.76466, 0.79776, 0.7306, 0.90782, 0.77818, 0.903, 0.87291, 0.90685, 0.7306, 0.99058, 1.03667, 0.94635, 1.23516, 0.9849, 0.99058, 0.92393, 0.8916, 0.942, 1.03667, 0.75026, 0.94635, 1.0297, 1.23516, 0.90918, 0.94048, 0.98217, 0.89746, 0.84153, 0.92274, 0.82507, 0.88832, 0.84438, 0.88178, 1.03525, 0.9849, 1.00225, 0.78086, 0.97248, 0.89404, 1.23516, 0.9849, 0.92274, 0.9849, 0.89404, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89693, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.85865, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.90933, 1, 1, 1, 1, 1, 1, 0.94309, 0.98986, 0.94309, 0.98986, 0.94309, 0.98986, 0.7306, 0.89453, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.68994, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.97858, 0.82616, 0.91133, 0.83437, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90572, 1.81055, 0.90749, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85284, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26048. const CalibriItalicMetrics = {
  26049. lineHeight: 1.2207,
  26050. lineGap: 0.2207
  26051. };
  26052. const CalibriRegularFactors = [1.3877, 1, 1, 1, 1.17223, 1.1293, 0.89552, 0.91133, 0.80395, 1.02269, 1.15601, 0.91056, 0.91056, 1.2798, 0.85284, 0.89807, 1, 0.90861, 1.39016, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.91133, 0.96309, 0.96309, 0.85284, 0.85284, 0.85284, 0.83319, 0.88071, 0.8675, 0.81552, 0.73834, 0.85193, 0.73206, 0.7522, 0.81105, 0.86275, 0.90685, 0.6377, 0.77892, 0.75593, 1.02638, 0.89385, 0.85122, 0.77452, 0.86503, 0.75186, 0.68887, 0.79776, 0.88844, 0.85066, 0.94258, 0.77818, 0.7306, 0.76659, 1.10369, 1.39016, 1.10369, 1.06139, 0.89552, 0.8739, 0.86128, 0.94469, 0.8457, 0.94469, 0.89464, 1.09842, 0.84636, 0.94469, 1.03297, 1.07692, 0.90918, 1.03297, 0.95897, 0.94469, 0.9482, 0.94469, 0.94469, 1.04692, 0.78223, 1.20562, 0.94469, 0.90332, 0.98986, 0.86621, 0.90527, 0.79004, 0.94152, 1.77256, 0.94152, 0.85284, 0.97801, 0.89552, 0.91133, 0.89552, 0.91133, 1.91729, 0.89552, 1.17889, 1.13254, 1.08707, 0.92098, 0.85284, 0.68787, 0.71353, 0.84737, 0.90747, 1.0088, 1.0044, 0.87683, 1, 1.09091, 1, 0.92229, 0.739, 1.15642, 0.92098, 0.76288, 0.80504, 0.80972, 0.75859, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.8675, 0.76318, 0.73834, 0.73206, 0.73206, 0.73206, 0.73206, 0.90685, 0.90685, 0.90685, 0.90685, 0.86477, 0.89385, 0.85122, 0.85122, 0.85122, 0.85122, 0.85122, 0.85284, 0.85311, 0.88844, 0.88844, 0.88844, 0.88844, 0.7306, 0.77452, 0.86331, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.86128, 0.8693, 0.8457, 0.89464, 0.89464, 0.89464, 0.89464, 0.82601, 0.82601, 0.82601, 0.82601, 0.94469, 0.94469, 0.9482, 0.9482, 0.9482, 0.9482, 0.9482, 0.90747, 0.86651, 0.94469, 0.94469, 0.94469, 0.94469, 0.90527, 0.94469, 0.90527, 0.8675, 0.86128, 0.8675, 0.86128, 0.8675, 0.86128, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.73834, 0.8457, 0.85193, 0.92454, 0.86477, 0.9921, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.73206, 0.89464, 0.81105, 0.84636, 0.81105, 0.84636, 0.81105, 0.84636, 1, 1, 0.86275, 0.94469, 0.90872, 0.95786, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 0.82601, 0.90685, 1.03297, 0.90685, 0.82601, 0.77741, 1.05611, 0.6377, 1.07692, 1, 1, 0.90918, 0.75593, 1.03297, 1, 1, 0.76032, 0.90452, 0.98156, 1.11842, 0.77261, 1.11429, 0.89385, 0.94469, 1, 1, 0.89385, 0.94469, 0.95877, 0.86901, 0.94469, 0.85122, 0.9482, 0.85122, 0.9482, 0.85122, 0.9482, 0.8667, 0.90016, 0.75186, 1.04692, 1, 1, 0.75186, 1.04692, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 0.68887, 0.78223, 1, 1, 0.79776, 0.92188, 0.79776, 1.23023, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.88844, 0.94469, 0.94258, 0.98986, 0.7306, 0.90527, 0.7306, 0.76659, 0.79004, 0.76659, 0.79004, 0.76659, 0.79004, 1.09231, 0.54873, 0.8675, 0.86128, 0.76318, 0.8693, 0.85311, 0.86651, 1, 1, 0.79776, 1.20562, 1.18622, 1.18622, 1, 1.1437, 0.67742, 0.96334, 0.93695, 1.35191, 1.40909, 0.95161, 1.48387, 0.86686, 0.90861, 0.62267, 0.74359, 0.65649, 0.85498, 0.56963, 0.88254, 1.23516, 0.8675, 0.81552, 0.75443, 0.84503, 0.73206, 0.76659, 0.86275, 0.85122, 0.90685, 0.77892, 0.85746, 1.02638, 0.89385, 0.75657, 0.85122, 0.86275, 0.77452, 0.74171, 0.79776, 0.7306, 0.95165, 0.77818, 0.89772, 0.88831, 0.90685, 0.7306, 0.98142, 1.02191, 0.96576, 1.23516, 0.99018, 0.98142, 0.9236, 0.89258, 0.94035, 1.02191, 0.78848, 0.96576, 0.9561, 1.23516, 0.90918, 0.92578, 0.95424, 0.89746, 0.83969, 0.9482, 0.80113, 0.89442, 0.85208, 0.86155, 0.98022, 0.99018, 1.00452, 0.81209, 0.99247, 0.89181, 1.23516, 0.99018, 0.9482, 0.99018, 0.89181, 0.73206, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.88844, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89464, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96766, 1, 1, 1, 1, 1, 1, 0.94258, 0.98986, 0.94258, 0.98986, 0.94258, 0.98986, 0.7306, 0.90527, 1, 1, 0.89552, 0.90527, 1, 0.90186, 1.12308, 1.12308, 1.12308, 1.12308, 1.2566, 1.2566, 1.2566, 0.89552, 0.89552, 1.42259, 0.69043, 1.03809, 1, 1, 1.0176, 1.0176, 1.11523, 1.4956, 2.01462, 0.99331, 0.82616, 0.91133, 0.84286, 0.91133, 1, 1, 1, 0.70508, 1, 1.23108, 0.79801, 0.84426, 0.84426, 0.774, 0.90527, 1.81055, 0.90527, 1.81055, 1.28809, 1.55469, 0.94434, 1.07806, 1, 0.97094, 0.7589, 0.85284, 0.90747, 1.19658, 0.69825, 0.97622, 1.33512, 0.90747, 0.90747, 0.85356, 0.90747, 0.90747, 1.44947, 0.85284, 0.8941, 0.8941, 0.70572, 0.8, 0.70572, 0.70572, 0.70572, 0.70572, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.99862, 0.99862, 1, 1, 1, 1, 1, 1.0336, 0.91027, 1, 1, 1, 0.99862, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05859, 1.05859, 1, 1, 1, 1.07185, 0.99413, 0.96334, 1.08065, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26053. const CalibriRegularMetrics = {
  26054. lineHeight: 1.2207,
  26055. lineGap: 0.2207
  26056. };
  26057. ;// ./src/core/helvetica_factors.js
  26058. const HelveticaBoldFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.03374, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.00042, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.03828, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00034, 0.99977, 1, 0.99997, 1.00026, 1.00078, 1.00036, 0.99973, 1.00013, 1.0006, 0.99977, 0.99977, 0.99988, 0.85148, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 1.00069, 1.00022, 0.99977, 1.00001, 0.99984, 1.00026, 1.00001, 1.00024, 1.00001, 0.9999, 1, 1.0006, 1.00001, 1.00041, 0.99962, 1.00026, 1.0006, 0.99995, 1.00041, 0.99942, 0.99973, 0.99927, 1.00082, 0.99902, 1.00026, 1.00087, 1.0006, 1.00069, 0.99973, 0.99867, 0.99973, 0.9993, 1.00026, 1.00049, 1.00056, 1, 0.99988, 0.99935, 0.99995, 0.99954, 1.00055, 0.99945, 1.00032, 1.0006, 0.99995, 1.00026, 0.99995, 1.00032, 1.00001, 1.00008, 0.99971, 1.00019, 0.9994, 1.00001, 1.0006, 1.00044, 0.99973, 1.00023, 1.00047, 1, 0.99942, 0.99561, 0.99989, 1.00035, 0.99977, 1.00035, 0.99977, 1.00019, 0.99944, 1.00001, 1.00021, 0.99926, 1.00035, 1.00035, 0.99942, 1.00048, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.99989, 1.00057, 1.00001, 0.99936, 1.00052, 1.00012, 0.99996, 1.00043, 1, 1.00035, 0.9994, 0.99976, 1.00035, 0.99973, 1.00052, 1.00041, 1.00119, 1.00037, 0.99973, 1.00002, 0.99986, 1.00041, 1.00041, 0.99902, 0.9996, 1.00034, 0.99999, 1.00026, 0.99999, 1.00026, 0.99973, 1.00052, 0.99973, 1, 0.99973, 1.00041, 1.00075, 0.9994, 1.0003, 0.99999, 1, 1.00041, 0.99955, 1, 0.99915, 0.99973, 0.99973, 1.00026, 1.00119, 0.99955, 0.99973, 1.0006, 0.99911, 1.0006, 1.00026, 0.99972, 1.00026, 0.99902, 1.00041, 0.99973, 0.99999, 1, 1, 1.00038, 1.0005, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 1.00047, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26059. const HelveticaBoldMetrics = {
  26060. lineHeight: 1.2,
  26061. lineGap: 0.2
  26062. };
  26063. const HelveticaBoldItalicFactors = [0.76116, 1, 1, 1.0006, 0.99998, 0.99974, 0.99973, 0.99973, 0.99982, 0.99977, 1.00087, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.00003, 1.00003, 1.00003, 1.00026, 0.9999, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 0.99973, 0.99977, 1.00026, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 0.99998, 1.0006, 0.99998, 1.00003, 0.99973, 0.99998, 0.99973, 1.00026, 0.99973, 1.00026, 0.99973, 0.99998, 1.00026, 1.00026, 1.0006, 1.0006, 0.99973, 1.0006, 0.99982, 1.00026, 1.00026, 1.00026, 1.00026, 0.99959, 0.99973, 0.99998, 1.00026, 0.99973, 1.00022, 0.99973, 0.99973, 1, 0.99959, 1.00077, 0.99959, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.00077, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.99973, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 0.99977, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 1.06409, 1.00026, 1.00026, 1.00026, 1.00026, 1.00026, 0.99973, 1.00026, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 1.0044, 0.99977, 1.00026, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99971, 0.99973, 0.99973, 1.0006, 0.99977, 0.99973, 0.99973, 1.00026, 1.0006, 1.00026, 1.0006, 1.00026, 1.01011, 1.00026, 0.99999, 1.00026, 1.0006, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.9993, 0.9998, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1.00022, 1.00026, 1, 1.00016, 0.99977, 0.99959, 0.99977, 0.99959, 0.99977, 0.99959, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00026, 0.99998, 1.00026, 0.8121, 1.00026, 0.99998, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 0.99977, 1.00026, 1.00016, 1.00022, 1.00001, 0.99973, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 1.0006, 0.99973, 0.99977, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 0.99973, 1.00026, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99977, 1, 1, 1.00026, 0.99969, 0.99972, 0.99981, 0.9998, 1.0006, 0.99977, 0.99977, 1.00022, 0.91155, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 0.99977, 1.00001, 0.99999, 0.99977, 0.99966, 1.00022, 1.00032, 1.00001, 0.99944, 1.00026, 1.00001, 0.99968, 1.00001, 1.00047, 1, 1.0006, 1.00001, 0.99981, 1.00101, 1.00026, 1.0006, 0.99948, 0.99981, 1.00064, 0.99973, 0.99942, 1.00101, 1.00061, 1.00026, 1.00069, 1.0006, 1.00014, 0.99973, 1.01322, 0.99973, 1.00065, 1.00026, 1.00012, 0.99923, 1, 1.00064, 1.00076, 0.99948, 1.00055, 1.00063, 1.00007, 0.99943, 1.0006, 0.99948, 1.00026, 0.99948, 0.99943, 1.00001, 1.00001, 1.00029, 1.00038, 1.00035, 1.00001, 1.0006, 1.0006, 0.99973, 0.99978, 1.00001, 1.00057, 0.99989, 0.99967, 0.99964, 0.99967, 0.99977, 0.99999, 0.99977, 1.00038, 0.99977, 1.00001, 0.99973, 1.00066, 0.99967, 0.99967, 1.00041, 0.99998, 0.99999, 0.99977, 1.00022, 0.99967, 1.00001, 0.99977, 1.00026, 0.99964, 1.00031, 1.00001, 0.99999, 0.99999, 1, 1.00023, 1, 1, 0.99999, 1.00035, 1.00001, 0.99999, 0.99973, 0.99977, 0.99999, 1.00058, 0.99973, 0.99973, 0.99955, 0.9995, 1.00026, 1.00026, 1.00032, 0.99989, 1.00034, 0.99999, 1.00026, 1.00026, 1.00026, 0.99973, 0.45998, 0.99973, 1.00026, 0.99973, 1.00001, 0.99999, 0.99982, 0.99994, 0.99996, 1, 1.00042, 1.00044, 1.00029, 1.00023, 0.99973, 0.99973, 1.00026, 0.99949, 1.00002, 0.99973, 1.0006, 1.0006, 1.0006, 0.99975, 1.00026, 1.00026, 1.00032, 0.98685, 0.99973, 1.00026, 1, 1, 0.99966, 1.00044, 1.00016, 1.00022, 1.00016, 1.00022, 1.00016, 1.00022, 1.00001, 0.99973, 1, 1, 0.99973, 1, 1, 0.99955, 1.0006, 1.0006, 1.0006, 1.0006, 1, 1, 1, 0.99973, 0.99973, 0.99972, 1, 1, 1.00106, 0.99999, 0.99998, 0.99998, 0.99999, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1, 0.99973, 0.99971, 0.99978, 1, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00098, 1, 1, 1, 1.00049, 1, 1, 0.99972, 1, 1.20985, 1.39713, 1.00003, 1.00031, 1.00015, 1, 0.99561, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.99972, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26064. const HelveticaBoldItalicMetrics = {
  26065. lineHeight: 1.35,
  26066. lineGap: 0.2
  26067. };
  26068. const HelveticaItalicFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.0288, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 0.99946, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.06311, 0.99973, 1.00024, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00041, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.89547, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 1.00001, 1, 1.00054, 0.99977, 1.00084, 1.00007, 0.99973, 1.00013, 0.99924, 1.00001, 1.00001, 0.99945, 0.91221, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00001, 0.99999, 0.99977, 0.99933, 1.00022, 1.00054, 1.00001, 1.00065, 1.00026, 1.00001, 1.0001, 1.00001, 1.00052, 1, 1.0006, 1.00001, 0.99945, 0.99897, 0.99968, 0.99924, 1.00036, 0.99945, 0.99949, 1, 1.0006, 0.99897, 0.99918, 0.99968, 0.99911, 0.99924, 1, 0.99962, 1.01487, 1, 1.0005, 0.99973, 1.00012, 1.00043, 1, 0.99995, 0.99994, 1.00036, 0.99947, 1.00019, 1.00063, 1.00025, 0.99924, 1.00036, 0.99973, 1.00036, 1.00025, 1.00001, 1.00001, 1.00027, 1.0001, 1.00068, 1.00001, 1.0006, 1.0006, 1, 1.00008, 0.99957, 0.99972, 0.9994, 0.99954, 0.99975, 1.00051, 1.00001, 1.00019, 1.00001, 1.0001, 0.99986, 1.00001, 1.00001, 1.00038, 0.99954, 0.99954, 0.9994, 1.00066, 0.99999, 0.99977, 1.00022, 1.00054, 1.00001, 0.99977, 1.00026, 0.99975, 1.0001, 1.00001, 0.99993, 0.9995, 0.99955, 1.00016, 0.99978, 0.99974, 1.00019, 1.00022, 0.99955, 1.00053, 0.99973, 1.00089, 1.00005, 0.99967, 1.00048, 0.99973, 1.00002, 1.00034, 0.99973, 0.99973, 0.99964, 1.00006, 1.00066, 0.99947, 0.99973, 0.98894, 0.99973, 1, 0.44898, 1, 0.99946, 1, 1.00039, 1.00082, 0.99991, 0.99991, 0.99985, 1.00022, 1.00023, 1.00061, 1.00006, 0.99966, 0.99973, 0.99973, 0.99973, 1.00019, 1.0008, 1, 0.99924, 0.99924, 0.99924, 0.99983, 1.00044, 0.99973, 0.99964, 0.98332, 1, 0.99973, 1, 1, 0.99962, 0.99895, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 1.00423, 0.99925, 0.99999, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1.00049, 1, 1.00245, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 1.00003, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 0.99998, 0.99998, 0.99998, 0.99998, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26069. const HelveticaItalicMetrics = {
  26070. lineHeight: 1.35,
  26071. lineGap: 0.2
  26072. };
  26073. const HelveticaRegularFactors = [0.76116, 1, 1, 1.0006, 1.0006, 1.00006, 0.99973, 0.99973, 0.99982, 1.00001, 1.00043, 0.99998, 0.99998, 0.99959, 1.00003, 1.0006, 0.99998, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1, 1.00003, 1.00003, 1.00003, 0.99973, 0.99987, 1.00001, 1.00001, 0.99977, 0.99977, 1.00001, 1.00026, 1.00022, 0.99977, 1.0006, 1, 1.00001, 0.99973, 0.99999, 0.99977, 1.00022, 1.00001, 1.00022, 0.99977, 1.00001, 1.00026, 0.99977, 1.00001, 1.00016, 1.00001, 1.00001, 1.00026, 1.0006, 1.0006, 1.0006, 0.99949, 0.99973, 0.99998, 0.99973, 0.99973, 1, 0.99973, 0.99973, 1.0006, 0.99973, 0.99973, 0.99924, 0.99924, 1, 0.99924, 0.99999, 0.99973, 0.99973, 0.99973, 0.99973, 0.99998, 1, 1.0006, 0.99973, 1, 0.99977, 1, 1, 1, 1.00005, 1.0009, 1.00005, 1.00003, 0.99998, 0.99973, 0.99973, 0.99973, 0.99973, 1.0009, 0.99973, 0.99998, 1.00025, 0.99968, 0.99973, 1.00003, 1.00025, 0.60299, 1.00024, 1.06409, 1, 1, 0.99998, 1, 0.9998, 1.0006, 0.99998, 1, 0.99936, 0.99973, 1.00002, 1.00002, 1.00002, 1.00026, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1.00001, 1, 0.99977, 1.00001, 1.00001, 1.00001, 1.00001, 1.0006, 1.0006, 1.0006, 1.0006, 0.99977, 0.99977, 1.00022, 1.00022, 1.00022, 1.00022, 1.00022, 1.00003, 1.00022, 0.99977, 0.99977, 0.99977, 0.99977, 1.00001, 1.00001, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99982, 1, 0.99973, 0.99973, 0.99973, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 0.99973, 1.06409, 1.00026, 0.99973, 0.99973, 0.99973, 0.99973, 1, 0.99973, 1, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1, 0.99977, 1.04596, 0.99977, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00001, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 1.0006, 0.99924, 1.0006, 1.0006, 1.00019, 1.00034, 1, 0.99924, 1.00001, 1, 1, 0.99973, 0.99924, 0.99973, 0.99924, 0.99973, 1.02572, 0.99973, 1.00005, 0.99973, 0.99924, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99999, 0.9998, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1.00022, 0.99973, 1, 1.00016, 0.99977, 0.99998, 0.99977, 0.99998, 0.99977, 0.99998, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00001, 1, 1.00026, 1.0006, 1.00026, 0.84533, 1.00026, 1.0006, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 0.99977, 0.99973, 1.00016, 0.99977, 1.00001, 1, 1.00001, 1.00026, 1, 1.00026, 1, 1.00026, 1, 0.99924, 0.99973, 1.00001, 0.99973, 1, 0.99982, 1.00022, 1.00026, 1.00001, 1, 1.00026, 1.0006, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99998, 0.99928, 1, 0.99977, 1.00013, 1.00055, 0.99947, 0.99945, 0.99941, 0.99924, 1.00001, 1.00001, 1.0004, 0.91621, 1.00001, 1.00026, 0.99977, 1.00022, 1.0006, 1.00001, 1.00005, 0.99999, 0.99977, 1.00015, 1.00022, 0.99977, 1.00001, 0.99973, 1.00026, 1.00001, 1.00019, 1.00001, 0.99946, 1, 1.0006, 1.00001, 0.99978, 1.00045, 0.99973, 0.99924, 1.00023, 0.99978, 0.99966, 1, 1.00065, 1.00045, 1.00019, 0.99973, 0.99973, 0.99924, 1, 1, 0.96499, 1, 1.00055, 0.99973, 1.00008, 1.00027, 1, 0.9997, 0.99995, 1.00023, 0.99933, 1.00019, 1.00015, 1.00031, 0.99924, 1.00023, 0.99973, 1.00023, 1.00031, 1.00001, 0.99928, 1.00029, 1.00092, 1.00035, 1.00001, 1.0006, 1.0006, 1, 0.99988, 0.99975, 1, 1.00082, 0.99561, 0.9996, 1.00035, 1.00001, 0.99962, 1.00001, 1.00092, 0.99964, 1.00001, 0.99963, 0.99999, 1.00035, 1.00035, 1.00082, 0.99962, 0.99999, 0.99977, 1.00022, 1.00035, 1.00001, 0.99977, 1.00026, 0.9996, 0.99967, 1.00001, 1.00034, 1.00074, 1.00054, 1.00053, 1.00063, 0.99971, 0.99962, 1.00035, 0.99975, 0.99977, 0.99973, 1.00043, 0.99953, 1.0007, 0.99915, 0.99973, 1.00008, 0.99892, 1.00073, 1.00073, 1.00114, 0.99915, 1.00073, 0.99955, 0.99973, 1.00092, 0.99973, 1, 0.99998, 1, 1.0003, 1, 1.00043, 1.00001, 0.99969, 1.0003, 1, 1.00035, 1.00001, 0.9995, 1, 1.00092, 0.99973, 0.99973, 0.99973, 1.0007, 0.9995, 1, 0.99924, 1.0006, 0.99924, 0.99972, 1.00062, 0.99973, 1.00114, 1.00073, 1, 0.99955, 1, 1, 1.00047, 0.99968, 1.00016, 0.99977, 1.00016, 0.99977, 1.00016, 0.99977, 1.00001, 1, 1, 1, 0.99973, 1, 1, 0.99955, 0.99924, 0.99924, 0.99924, 0.99924, 0.99998, 0.99998, 0.99998, 0.99973, 0.99973, 0.99972, 1, 1, 1.00267, 0.99999, 0.99998, 0.99998, 1, 0.99998, 1.66475, 1, 0.99973, 0.99973, 1.00023, 0.99973, 0.99971, 0.99925, 1.00023, 1, 0.99991, 0.99984, 1.00002, 1.00002, 1.00002, 1.00002, 1, 1, 1, 1, 1, 1, 1, 0.96329, 1, 1.20985, 1.39713, 1.00003, 0.8254, 1.00015, 1, 1.00035, 1.00027, 1.00031, 1.00031, 0.99915, 1.00031, 1.00031, 0.99999, 1.00003, 0.99999, 0.99999, 1.41144, 1.6, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.41144, 1.40579, 1.40579, 1.36625, 0.99999, 1, 0.99861, 0.99861, 1, 1.00026, 1.00026, 1.00026, 1.00026, 0.95317, 0.99999, 0.99999, 0.99999, 0.99999, 1.40483, 1, 0.99977, 1.00054, 1, 1, 0.99953, 0.99962, 1.00042, 0.9995, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26074. const HelveticaRegularMetrics = {
  26075. lineHeight: 1.2,
  26076. lineGap: 0.2
  26077. };
  26078. ;// ./src/core/liberationsans_widths.js
  26079. const LiberationSansBoldWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 719, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 785, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 385, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 465, 722, 333, 853, 906, 474, 825, 927, 838, 278, 722, 722, 601, 719, 667, 611, 722, 778, 278, 722, 667, 833, 722, 644, 778, 722, 667, 600, 611, 667, 821, 667, 809, 802, 278, 667, 615, 451, 611, 278, 582, 615, 610, 556, 606, 475, 460, 611, 541, 278, 558, 556, 612, 556, 445, 611, 766, 619, 520, 684, 446, 582, 715, 576, 753, 845, 278, 582, 611, 582, 845, 667, 669, 885, 567, 711, 667, 278, 276, 556, 1094, 1062, 875, 610, 722, 622, 719, 722, 719, 722, 567, 712, 667, 904, 626, 719, 719, 610, 702, 833, 722, 778, 719, 667, 722, 611, 622, 854, 667, 730, 703, 1005, 1019, 870, 979, 719, 711, 1031, 719, 556, 618, 615, 417, 635, 556, 709, 497, 615, 615, 500, 635, 740, 604, 611, 604, 611, 556, 490, 556, 875, 556, 615, 581, 833, 844, 729, 854, 615, 552, 854, 583, 556, 556, 611, 417, 552, 556, 278, 281, 278, 969, 906, 611, 500, 615, 556, 604, 778, 611, 487, 447, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1094, 556, 885, 489, 1115, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  26080. const LiberationSansBoldMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  26081. const LiberationSansBoldItalicWidths = [365, 0, 333, 278, 333, 474, 556, 556, 889, 722, 238, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 333, 333, 584, 584, 584, 611, 975, 722, 722, 722, 722, 667, 611, 778, 722, 278, 556, 722, 611, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 333, 278, 333, 584, 556, 333, 556, 611, 556, 611, 556, 333, 611, 611, 278, 278, 556, 278, 889, 611, 611, 611, 611, 389, 556, 333, 611, 556, 778, 556, 556, 500, 389, 280, 389, 584, 333, 556, 556, 556, 556, 280, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 556, 278, 333, 333, 365, 556, 834, 834, 834, 611, 722, 722, 722, 722, 722, 722, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 556, 556, 556, 556, 556, 278, 278, 278, 278, 611, 611, 611, 611, 611, 611, 611, 549, 611, 611, 611, 611, 611, 556, 611, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 740, 722, 611, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 611, 778, 611, 778, 611, 778, 611, 722, 611, 722, 611, 278, 278, 278, 278, 278, 278, 278, 278, 278, 278, 782, 556, 556, 278, 722, 556, 556, 611, 278, 611, 278, 611, 396, 611, 479, 611, 278, 722, 611, 722, 611, 722, 611, 708, 723, 611, 778, 611, 778, 611, 778, 611, 1000, 944, 722, 389, 722, 389, 722, 389, 667, 556, 667, 556, 667, 556, 667, 556, 611, 333, 611, 479, 611, 333, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 722, 611, 944, 778, 667, 556, 667, 611, 500, 611, 500, 611, 500, 278, 556, 722, 556, 1000, 889, 778, 611, 667, 556, 611, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 722, 333, 854, 906, 473, 844, 930, 847, 278, 722, 722, 610, 671, 667, 611, 722, 778, 278, 722, 667, 833, 722, 657, 778, 718, 667, 590, 611, 667, 822, 667, 829, 781, 278, 667, 620, 479, 611, 278, 591, 620, 621, 556, 610, 479, 492, 611, 558, 278, 566, 556, 603, 556, 450, 611, 712, 605, 532, 664, 409, 591, 704, 578, 773, 834, 278, 591, 611, 591, 834, 667, 667, 886, 614, 719, 667, 278, 278, 556, 1094, 1042, 854, 622, 719, 677, 719, 722, 708, 722, 614, 722, 667, 927, 643, 719, 719, 615, 687, 833, 722, 778, 719, 667, 722, 611, 677, 781, 667, 729, 708, 979, 989, 854, 1000, 708, 719, 1042, 729, 556, 619, 604, 534, 618, 556, 736, 510, 611, 611, 507, 622, 740, 604, 611, 611, 611, 556, 889, 556, 885, 556, 646, 583, 889, 935, 707, 854, 594, 552, 865, 589, 556, 556, 611, 469, 563, 556, 278, 278, 278, 969, 906, 611, 507, 619, 556, 611, 778, 611, 575, 467, 944, 778, 944, 778, 944, 778, 667, 556, 333, 333, 556, 1000, 1000, 552, 278, 278, 278, 278, 500, 500, 500, 556, 556, 350, 1000, 1000, 240, 479, 333, 333, 604, 333, 167, 396, 556, 556, 1104, 556, 885, 516, 1146, 1000, 768, 600, 834, 834, 834, 834, 999, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 722, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 611, 611, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 333, 333, 333, 333, 333, 333, 333, 333];
  26082. const LiberationSansBoldItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  26083. const LiberationSansItalicWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 625, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 733, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 281, 556, 400, 556, 222, 722, 556, 722, 556, 722, 556, 615, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 354, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 789, 846, 389, 794, 865, 775, 222, 667, 667, 570, 671, 667, 611, 722, 778, 278, 667, 667, 833, 722, 648, 778, 725, 667, 600, 611, 667, 837, 667, 831, 761, 278, 667, 570, 439, 555, 222, 550, 570, 571, 500, 556, 439, 463, 555, 542, 222, 500, 492, 548, 500, 447, 556, 670, 573, 486, 603, 374, 550, 652, 546, 728, 779, 222, 550, 556, 550, 779, 667, 667, 843, 544, 708, 667, 278, 278, 500, 1066, 982, 844, 589, 715, 639, 724, 667, 651, 667, 544, 704, 667, 917, 614, 715, 715, 589, 686, 833, 722, 778, 725, 667, 722, 611, 639, 795, 667, 727, 673, 920, 923, 805, 886, 651, 694, 1022, 682, 556, 562, 522, 493, 553, 556, 688, 465, 556, 556, 472, 564, 686, 550, 556, 556, 556, 500, 833, 500, 835, 500, 572, 518, 830, 851, 621, 736, 526, 492, 752, 534, 556, 556, 556, 378, 496, 500, 222, 222, 222, 910, 828, 556, 472, 565, 500, 556, 778, 556, 492, 339, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1083, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 998, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 584, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  26084. const LiberationSansItalicMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  26085. const LiberationSansRegularWidths = [365, 0, 333, 278, 278, 355, 556, 556, 889, 667, 191, 333, 333, 389, 584, 278, 333, 278, 278, 556, 556, 556, 556, 556, 556, 556, 556, 556, 556, 278, 278, 584, 584, 584, 556, 1015, 667, 667, 722, 722, 667, 611, 778, 722, 278, 500, 667, 556, 833, 722, 778, 667, 778, 722, 667, 611, 722, 667, 944, 667, 667, 611, 278, 278, 278, 469, 556, 333, 556, 556, 500, 556, 556, 278, 556, 556, 222, 222, 500, 222, 833, 556, 556, 556, 556, 333, 500, 278, 556, 500, 722, 500, 500, 500, 334, 260, 334, 584, 333, 556, 556, 556, 556, 260, 556, 333, 737, 370, 556, 584, 737, 552, 400, 549, 333, 333, 333, 576, 537, 278, 333, 333, 365, 556, 834, 834, 834, 611, 667, 667, 667, 667, 667, 667, 1000, 722, 667, 667, 667, 667, 278, 278, 278, 278, 722, 722, 778, 778, 778, 778, 778, 584, 778, 722, 722, 722, 722, 667, 667, 611, 556, 556, 556, 556, 556, 556, 889, 500, 556, 556, 556, 556, 278, 278, 278, 278, 556, 556, 556, 556, 556, 556, 556, 549, 611, 556, 556, 556, 556, 500, 556, 500, 667, 556, 667, 556, 667, 556, 722, 500, 722, 500, 722, 500, 722, 500, 722, 615, 722, 556, 667, 556, 667, 556, 667, 556, 667, 556, 667, 556, 778, 556, 778, 556, 778, 556, 778, 556, 722, 556, 722, 556, 278, 278, 278, 278, 278, 278, 278, 222, 278, 278, 735, 444, 500, 222, 667, 500, 500, 556, 222, 556, 222, 556, 292, 556, 334, 556, 222, 722, 556, 722, 556, 722, 556, 604, 723, 556, 778, 556, 778, 556, 778, 556, 1000, 944, 722, 333, 722, 333, 722, 333, 667, 500, 667, 500, 667, 500, 667, 500, 611, 278, 611, 375, 611, 278, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 722, 556, 944, 722, 667, 500, 667, 611, 500, 611, 500, 611, 500, 222, 556, 667, 556, 1000, 889, 778, 611, 667, 500, 611, 278, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 333, 667, 278, 784, 838, 384, 774, 855, 752, 222, 667, 667, 551, 668, 667, 611, 722, 778, 278, 667, 668, 833, 722, 650, 778, 722, 667, 618, 611, 667, 798, 667, 835, 748, 278, 667, 578, 446, 556, 222, 547, 578, 575, 500, 557, 446, 441, 556, 556, 222, 500, 500, 576, 500, 448, 556, 690, 569, 482, 617, 395, 547, 648, 525, 713, 781, 222, 547, 556, 547, 781, 667, 667, 865, 542, 719, 667, 278, 278, 500, 1057, 1010, 854, 583, 722, 635, 719, 667, 656, 667, 542, 677, 667, 923, 604, 719, 719, 583, 656, 833, 722, 778, 719, 667, 722, 611, 635, 760, 667, 740, 667, 917, 938, 792, 885, 656, 719, 1010, 722, 556, 573, 531, 365, 583, 556, 669, 458, 559, 559, 438, 583, 688, 552, 556, 542, 556, 500, 458, 500, 823, 500, 573, 521, 802, 823, 625, 719, 521, 510, 750, 542, 556, 556, 556, 365, 510, 500, 222, 278, 222, 906, 812, 556, 438, 559, 500, 552, 778, 556, 489, 411, 944, 722, 944, 722, 944, 722, 667, 500, 333, 333, 556, 1000, 1000, 552, 222, 222, 222, 222, 333, 333, 333, 556, 556, 350, 1000, 1000, 188, 354, 333, 333, 500, 333, 167, 365, 556, 556, 1094, 556, 885, 323, 1073, 1000, 768, 600, 834, 834, 834, 834, 1000, 500, 1000, 500, 1000, 500, 500, 494, 612, 823, 713, 584, 549, 713, 979, 719, 274, 549, 549, 583, 549, 549, 604, 584, 604, 604, 708, 625, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 708, 729, 604, 604, 354, 354, 1000, 990, 990, 990, 990, 494, 604, 604, 604, 604, 354, 1021, 1052, 917, 750, 750, 531, 656, 594, 510, 500, 750, 750, 500, 500, 333, 333, 333, 333, 333, 333, 333, 333, 222, 222, 294, 294, 324, 324, 316, 328, 398, 285];
  26086. const LiberationSansRegularMapping = [-1, -1, -1, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 256, 257, 258, 259, 260, 261, 262, 263, 264, 265, 266, 267, 268, 269, 270, 271, 272, 273, 274, 275, 276, 277, 278, 279, 280, 281, 282, 283, 284, 285, 286, 287, 288, 289, 290, 291, 292, 293, 294, 295, 296, 297, 298, 299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312, 313, 314, 315, 316, 317, 318, 319, 320, 321, 322, 323, 324, 325, 326, 327, 328, 329, 330, 331, 332, 333, 334, 335, 336, 337, 338, 339, 340, 341, 342, 343, 344, 345, 346, 347, 348, 349, 350, 351, 352, 353, 354, 355, 356, 357, 358, 359, 360, 361, 362, 363, 364, 365, 366, 367, 368, 369, 370, 371, 372, 373, 374, 375, 376, 377, 378, 379, 380, 381, 382, 383, 402, 506, 507, 508, 509, 510, 511, 536, 537, 538, 539, 710, 711, 713, 728, 729, 730, 731, 732, 733, 900, 901, 902, 903, 904, 905, 906, 908, 910, 911, 912, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 938, 939, 940, 941, 942, 943, 944, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 970, 971, 972, 973, 974, 1024, 1025, 1026, 1027, 1028, 1029, 1030, 1031, 1032, 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, 1041, 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1093, 1094, 1095, 1096, 1097, 1098, 1099, 1100, 1101, 1102, 1103, 1104, 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, 1113, 1114, 1115, 1116, 1117, 1118, 1119, 1138, 1139, 1168, 1169, 7808, 7809, 7810, 7811, 7812, 7813, 7922, 7923, 8208, 8209, 8211, 8212, 8213, 8215, 8216, 8217, 8218, 8219, 8220, 8221, 8222, 8224, 8225, 8226, 8230, 8240, 8242, 8243, 8249, 8250, 8252, 8254, 8260, 8319, 8355, 8356, 8359, 8364, 8453, 8467, 8470, 8482, 8486, 8494, 8539, 8540, 8541, 8542, 8592, 8593, 8594, 8595, 8596, 8597, 8616, 8706, 8710, 8719, 8721, 8722, 8730, 8734, 8735, 8745, 8747, 8776, 8800, 8801, 8804, 8805, 8962, 8976, 8992, 8993, 9472, 9474, 9484, 9488, 9492, 9496, 9500, 9508, 9516, 9524, 9532, 9552, 9553, 9554, 9555, 9556, 9557, 9558, 9559, 9560, 9561, 9562, 9563, 9564, 9565, 9566, 9567, 9568, 9569, 9570, 9571, 9572, 9573, 9574, 9575, 9576, 9577, 9578, 9579, 9580, 9600, 9604, 9608, 9612, 9616, 9617, 9618, 9619, 9632, 9633, 9642, 9643, 9644, 9650, 9658, 9660, 9668, 9674, 9675, 9679, 9688, 9689, 9702, 9786, 9787, 9788, 9792, 9794, 9824, 9827, 9829, 9830, 9834, 9835, 9836, 61441, 61442, 61445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1];
  26087. ;// ./src/core/myriadpro_factors.js
  26088. const MyriadProBoldFactors = [1.36898, 1, 1, 0.72706, 0.80479, 0.83734, 0.98894, 0.99793, 0.9897, 0.93884, 0.86209, 0.94292, 0.94292, 1.16661, 1.02058, 0.93582, 0.96694, 0.93582, 1.19137, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.99793, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.72851, 0.78966, 0.90838, 0.83637, 0.82391, 0.96376, 0.80061, 0.86275, 0.8768, 0.95407, 1.0258, 0.73901, 0.85022, 0.83655, 1.0156, 0.95546, 0.92179, 0.87107, 0.92179, 0.82114, 0.8096, 0.89713, 0.94438, 0.95353, 0.94083, 0.91905, 0.90406, 0.9446, 0.94292, 1.18777, 0.94292, 1.02058, 0.89903, 0.90088, 0.94938, 0.97898, 0.81093, 0.97571, 0.94938, 1.024, 0.9577, 0.95933, 0.98621, 1.0474, 0.97455, 0.98981, 0.9672, 0.95933, 0.9446, 0.97898, 0.97407, 0.97646, 0.78036, 1.10208, 0.95442, 0.95298, 0.97579, 0.9332, 0.94039, 0.938, 0.80687, 1.01149, 0.80687, 1.02058, 0.80479, 0.99793, 0.99793, 0.99793, 0.99793, 1.01149, 1.00872, 0.90088, 0.91882, 1.0213, 0.8361, 1.02058, 0.62295, 0.54324, 0.89022, 1.08595, 1, 1, 0.90088, 1, 0.97455, 0.93582, 0.90088, 1, 1.05686, 0.8361, 0.99642, 0.99642, 0.99642, 0.72851, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.90838, 0.868, 0.82391, 0.80061, 0.80061, 0.80061, 0.80061, 1.0258, 1.0258, 1.0258, 1.0258, 0.97484, 0.95546, 0.92179, 0.92179, 0.92179, 0.92179, 0.92179, 1.02058, 0.92179, 0.94438, 0.94438, 0.94438, 0.94438, 0.90406, 0.86958, 0.98225, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.94938, 0.9031, 0.81093, 0.94938, 0.94938, 0.94938, 0.94938, 0.98621, 0.98621, 0.98621, 0.98621, 0.93969, 0.95933, 0.9446, 0.9446, 0.9446, 0.9446, 0.9446, 1.08595, 0.9446, 0.95442, 0.95442, 0.95442, 0.95442, 0.94039, 0.97898, 0.94039, 0.90838, 0.94938, 0.90838, 0.94938, 0.90838, 0.94938, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.82391, 0.81093, 0.96376, 0.84313, 0.97484, 0.97571, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.80061, 0.94938, 0.8768, 0.9577, 0.8768, 0.9577, 0.8768, 0.9577, 1, 1, 0.95407, 0.95933, 0.97069, 0.95933, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 1.0258, 0.98621, 0.887, 1.01591, 0.73901, 1.0474, 1, 1, 0.97455, 0.83655, 0.98981, 1, 1, 0.83655, 0.73977, 0.83655, 0.73903, 0.84638, 1.033, 0.95546, 0.95933, 1, 1, 0.95546, 0.95933, 0.8271, 0.95417, 0.95933, 0.92179, 0.9446, 0.92179, 0.9446, 0.92179, 0.9446, 0.936, 0.91964, 0.82114, 0.97646, 1, 1, 0.82114, 0.97646, 0.8096, 0.78036, 0.8096, 0.78036, 1, 1, 0.8096, 0.78036, 1, 1, 0.89713, 0.77452, 0.89713, 1.10208, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94438, 0.95442, 0.94083, 0.97579, 0.90406, 0.94039, 0.90406, 0.9446, 0.938, 0.9446, 0.938, 0.9446, 0.938, 1, 0.99793, 0.90838, 0.94938, 0.868, 0.9031, 0.92179, 0.9446, 1, 1, 0.89713, 1.10208, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90989, 0.9358, 0.91945, 0.83181, 0.75261, 0.87992, 0.82976, 0.96034, 0.83689, 0.97268, 1.0078, 0.90838, 0.83637, 0.8019, 0.90157, 0.80061, 0.9446, 0.95407, 0.92436, 1.0258, 0.85022, 0.97153, 1.0156, 0.95546, 0.89192, 0.92179, 0.92361, 0.87107, 0.96318, 0.89713, 0.93704, 0.95638, 0.91905, 0.91709, 0.92796, 1.0258, 0.93704, 0.94836, 1.0373, 0.95933, 1.0078, 0.95871, 0.94836, 0.96174, 0.92601, 0.9498, 0.98607, 0.95776, 0.95933, 1.05453, 1.0078, 0.98275, 0.9314, 0.95617, 0.91701, 1.05993, 0.9446, 0.78367, 0.9553, 1, 0.86832, 1.0128, 0.95871, 0.99394, 0.87548, 0.96361, 0.86774, 1.0078, 0.95871, 0.9446, 0.95871, 0.86774, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.94083, 0.97579, 0.94083, 0.97579, 0.94083, 0.97579, 0.90406, 0.94039, 0.96694, 1, 0.89903, 1, 1, 1, 0.93582, 0.93582, 0.93582, 1, 0.908, 0.908, 0.918, 0.94219, 0.94219, 0.96544, 1, 1.285, 1, 1, 0.81079, 0.81079, 1, 1, 0.74854, 1, 1, 1, 1, 0.99793, 1, 1, 1, 0.65, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.17173, 1, 0.80535, 0.76169, 1.02058, 1.0732, 1.05486, 1, 1, 1.30692, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.16161, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26089. const MyriadProBoldMetrics = {
  26090. lineHeight: 1.2,
  26091. lineGap: 0.2
  26092. };
  26093. const MyriadProBoldItalicFactors = [1.36898, 1, 1, 0.66227, 0.80779, 0.81625, 0.97276, 0.97276, 0.97733, 0.92222, 0.83266, 0.94292, 0.94292, 1.16148, 1.02058, 0.93582, 0.96694, 0.93582, 1.17337, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.97276, 0.78076, 0.78076, 1.02058, 1.02058, 1.02058, 0.71541, 0.76813, 0.85576, 0.80591, 0.80729, 0.94299, 0.77512, 0.83655, 0.86523, 0.92222, 0.98621, 0.71743, 0.81698, 0.79726, 0.98558, 0.92222, 0.90637, 0.83809, 0.90637, 0.80729, 0.76463, 0.86275, 0.90699, 0.91605, 0.9154, 0.85308, 0.85458, 0.90531, 0.94292, 1.21296, 0.94292, 1.02058, 0.89903, 1.18616, 0.99613, 0.91677, 0.78216, 0.91677, 0.90083, 0.98796, 0.9135, 0.92168, 0.95381, 0.98981, 0.95298, 0.95381, 0.93459, 0.92168, 0.91513, 0.92004, 0.91677, 0.95077, 0.748, 1.04502, 0.91677, 0.92061, 0.94236, 0.89544, 0.89364, 0.9, 0.80687, 0.8578, 0.80687, 1.02058, 0.80779, 0.97276, 0.97276, 0.97276, 0.97276, 0.8578, 0.99973, 1.18616, 0.91339, 1.08074, 0.82891, 1.02058, 0.55509, 0.71526, 0.89022, 1.08595, 1, 1, 1.18616, 1, 0.96736, 0.93582, 1.18616, 1, 1.04864, 0.82711, 0.99043, 0.99043, 0.99043, 0.71541, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.85576, 0.845, 0.80729, 0.77512, 0.77512, 0.77512, 0.77512, 0.98621, 0.98621, 0.98621, 0.98621, 0.95961, 0.92222, 0.90637, 0.90637, 0.90637, 0.90637, 0.90637, 1.02058, 0.90251, 0.90699, 0.90699, 0.90699, 0.90699, 0.85458, 0.83659, 0.94951, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.99613, 0.85811, 0.78216, 0.90083, 0.90083, 0.90083, 0.90083, 0.95381, 0.95381, 0.95381, 0.95381, 0.9135, 0.92168, 0.91513, 0.91513, 0.91513, 0.91513, 0.91513, 1.08595, 0.91677, 0.91677, 0.91677, 0.91677, 0.91677, 0.89364, 0.92332, 0.89364, 0.85576, 0.99613, 0.85576, 0.99613, 0.85576, 0.99613, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.80729, 0.78216, 0.94299, 0.76783, 0.95961, 0.91677, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.77512, 0.90083, 0.86523, 0.9135, 0.86523, 0.9135, 0.86523, 0.9135, 1, 1, 0.92222, 0.92168, 0.92222, 0.92168, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.98621, 0.95381, 0.86036, 0.97096, 0.71743, 0.98981, 1, 1, 0.95298, 0.79726, 0.95381, 1, 1, 0.79726, 0.6894, 0.79726, 0.74321, 0.81691, 1.0006, 0.92222, 0.92168, 1, 1, 0.92222, 0.92168, 0.79464, 0.92098, 0.92168, 0.90637, 0.91513, 0.90637, 0.91513, 0.90637, 0.91513, 0.909, 0.87514, 0.80729, 0.95077, 1, 1, 0.80729, 0.95077, 0.76463, 0.748, 0.76463, 0.748, 1, 1, 0.76463, 0.748, 1, 1, 0.86275, 0.72651, 0.86275, 1.04502, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.90699, 0.91677, 0.9154, 0.94236, 0.85458, 0.89364, 0.85458, 0.90531, 0.9, 0.90531, 0.9, 0.90531, 0.9, 1, 0.97276, 0.85576, 0.99613, 0.845, 0.85811, 0.90251, 0.91677, 1, 1, 0.86275, 1.04502, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.18616, 1.00899, 1.30628, 0.85576, 0.80178, 0.66862, 0.7927, 0.69323, 0.88127, 0.72459, 0.89711, 0.95381, 0.85576, 0.80591, 0.7805, 0.94729, 0.77512, 0.90531, 0.92222, 0.90637, 0.98621, 0.81698, 0.92655, 0.98558, 0.92222, 0.85359, 0.90637, 0.90976, 0.83809, 0.94523, 0.86275, 0.83509, 0.93157, 0.85308, 0.83392, 0.92346, 0.98621, 0.83509, 0.92886, 0.91324, 0.92168, 0.95381, 0.90646, 0.92886, 0.90557, 0.86847, 0.90276, 0.91324, 0.86842, 0.92168, 0.99531, 0.95381, 0.9224, 0.85408, 0.92699, 0.86847, 1.0051, 0.91513, 0.80487, 0.93481, 1, 0.88159, 1.05214, 0.90646, 0.97355, 0.81539, 0.89398, 0.85923, 0.95381, 0.90646, 0.91513, 0.90646, 0.85923, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9154, 0.94236, 0.9154, 0.94236, 0.9154, 0.94236, 0.85458, 0.89364, 0.96694, 1, 0.89903, 1, 1, 1, 0.91782, 0.91782, 0.91782, 1, 0.896, 0.896, 0.896, 0.9332, 0.9332, 0.95973, 1, 1.26, 1, 1, 0.80479, 0.80178, 1, 1, 0.85633, 1, 1, 1, 1, 0.97276, 1, 1, 1, 0.698, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.14542, 1, 0.79199, 0.78694, 1.02058, 1.03493, 1.05486, 1, 1, 1.23026, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.20006, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26094. const MyriadProBoldItalicMetrics = {
  26095. lineHeight: 1.2,
  26096. lineGap: 0.2
  26097. };
  26098. const MyriadProItalicFactors = [1.36898, 1, 1, 0.65507, 0.84943, 0.85639, 0.88465, 0.88465, 0.86936, 0.88307, 0.86948, 0.85283, 0.85283, 1.06383, 1.02058, 0.75945, 0.9219, 0.75945, 1.17337, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.88465, 0.75945, 0.75945, 1.02058, 1.02058, 1.02058, 0.69046, 0.70926, 0.85158, 0.77812, 0.76852, 0.89591, 0.70466, 0.76125, 0.80094, 0.86822, 0.83864, 0.728, 0.77212, 0.79475, 0.93637, 0.87514, 0.8588, 0.76013, 0.8588, 0.72421, 0.69866, 0.77598, 0.85991, 0.80811, 0.87832, 0.78112, 0.77512, 0.8562, 1.0222, 1.18417, 1.0222, 1.27014, 0.89903, 1.15012, 0.93859, 0.94399, 0.846, 0.94399, 0.81453, 1.0186, 0.94219, 0.96017, 1.03075, 1.02175, 0.912, 1.03075, 0.96998, 0.96017, 0.93859, 0.94399, 0.94399, 0.95493, 0.746, 1.12658, 0.94578, 0.91, 0.979, 0.882, 0.882, 0.83, 0.85034, 0.83537, 0.85034, 1.02058, 0.70869, 0.88465, 0.88465, 0.88465, 0.88465, 0.83537, 0.90083, 1.15012, 0.9161, 0.94565, 0.73541, 1.02058, 0.53609, 0.69353, 0.79519, 1.08595, 1, 1, 1.15012, 1, 0.91974, 0.75945, 1.15012, 1, 0.9446, 0.73361, 0.9005, 0.9005, 0.9005, 0.62864, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.85158, 0.773, 0.76852, 0.70466, 0.70466, 0.70466, 0.70466, 0.83864, 0.83864, 0.83864, 0.83864, 0.90561, 0.87514, 0.8588, 0.8588, 0.8588, 0.8588, 0.8588, 1.02058, 0.85751, 0.85991, 0.85991, 0.85991, 0.85991, 0.77512, 0.76013, 0.88075, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 0.8075, 0.846, 0.81453, 0.81453, 0.81453, 0.81453, 0.82424, 0.82424, 0.82424, 0.82424, 0.9278, 0.96017, 0.93859, 0.93859, 0.93859, 0.93859, 0.93859, 1.08595, 0.8562, 0.94578, 0.94578, 0.94578, 0.94578, 0.882, 0.94578, 0.882, 0.85158, 0.93859, 0.85158, 0.93859, 0.85158, 0.93859, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.76852, 0.846, 0.89591, 0.8544, 0.90561, 0.94399, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.70466, 0.81453, 0.80094, 0.94219, 0.80094, 0.94219, 0.80094, 0.94219, 1, 1, 0.86822, 0.96017, 0.86822, 0.96017, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 0.82424, 0.83864, 1.03075, 0.83864, 0.82424, 0.81402, 1.02738, 0.728, 1.02175, 1, 1, 0.912, 0.79475, 1.03075, 1, 1, 0.79475, 0.83911, 0.79475, 0.66266, 0.80553, 1.06676, 0.87514, 0.96017, 1, 1, 0.87514, 0.96017, 0.86865, 0.87396, 0.96017, 0.8588, 0.93859, 0.8588, 0.93859, 0.8588, 0.93859, 0.867, 0.84759, 0.72421, 0.95493, 1, 1, 0.72421, 0.95493, 0.69866, 0.746, 0.69866, 0.746, 1, 1, 0.69866, 0.746, 1, 1, 0.77598, 0.88417, 0.77598, 1.12658, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.85991, 0.94578, 0.87832, 0.979, 0.77512, 0.882, 0.77512, 0.8562, 0.83, 0.8562, 0.83, 0.8562, 0.83, 1, 0.88465, 0.85158, 0.93859, 0.773, 0.8075, 0.85751, 0.8562, 1, 1, 0.77598, 1.12658, 1.15012, 1.15012, 1.15012, 1.15012, 1.15012, 1.15313, 1.15012, 1.15012, 1.15012, 1.08106, 1.03901, 0.85158, 0.77025, 0.62264, 0.7646, 0.65351, 0.86026, 0.69461, 0.89947, 1.03075, 0.85158, 0.77812, 0.76449, 0.88836, 0.70466, 0.8562, 0.86822, 0.8588, 0.83864, 0.77212, 0.85308, 0.93637, 0.87514, 0.82352, 0.8588, 0.85701, 0.76013, 0.89058, 0.77598, 0.8156, 0.82565, 0.78112, 0.77899, 0.89386, 0.83864, 0.8156, 0.9486, 0.92388, 0.96186, 1.03075, 0.91123, 0.9486, 0.93298, 0.878, 0.93942, 0.92388, 0.84596, 0.96186, 0.95119, 1.03075, 0.922, 0.88787, 0.95829, 0.88, 0.93559, 0.93859, 0.78815, 0.93758, 1, 0.89217, 1.03737, 0.91123, 0.93969, 0.77487, 0.85769, 0.86799, 1.03075, 0.91123, 0.93859, 0.91123, 0.86799, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87832, 0.979, 0.87832, 0.979, 0.87832, 0.979, 0.77512, 0.882, 0.9219, 1, 0.89903, 1, 1, 1, 0.87321, 0.87321, 0.87321, 1, 1.027, 1.027, 1.027, 0.86847, 0.86847, 0.79121, 1, 1.124, 1, 1, 0.73572, 0.73572, 1, 1, 0.85034, 1, 1, 1, 1, 0.88465, 1, 1, 1, 0.669, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04828, 1, 0.74948, 0.75187, 1.02058, 0.98391, 1.02119, 1, 1, 1.06233, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05233, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26099. const MyriadProItalicMetrics = {
  26100. lineHeight: 1.2,
  26101. lineGap: 0.2
  26102. };
  26103. const MyriadProRegularFactors = [1.36898, 1, 1, 0.76305, 0.82784, 0.94935, 0.89364, 0.92241, 0.89073, 0.90706, 0.98472, 0.85283, 0.85283, 1.0664, 1.02058, 0.74505, 0.9219, 0.74505, 1.23456, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.92241, 0.74505, 0.74505, 1.02058, 1.02058, 1.02058, 0.73002, 0.72601, 0.91755, 0.8126, 0.80314, 0.92222, 0.73764, 0.79726, 0.83051, 0.90284, 0.86023, 0.74, 0.8126, 0.84869, 0.96518, 0.91115, 0.8858, 0.79761, 0.8858, 0.74498, 0.73914, 0.81363, 0.89591, 0.83659, 0.89633, 0.85608, 0.8111, 0.90531, 1.0222, 1.22736, 1.0222, 1.27014, 0.89903, 0.90088, 0.86667, 1.0231, 0.896, 1.01411, 0.90083, 1.05099, 1.00512, 0.99793, 1.05326, 1.09377, 0.938, 1.06226, 1.00119, 0.99793, 0.98714, 1.0231, 1.01231, 0.98196, 0.792, 1.19137, 0.99074, 0.962, 1.01915, 0.926, 0.942, 0.856, 0.85034, 0.92006, 0.85034, 1.02058, 0.69067, 0.92241, 0.92241, 0.92241, 0.92241, 0.92006, 0.9332, 0.90088, 0.91882, 0.93484, 0.75339, 1.02058, 0.56866, 0.54324, 0.79519, 1.08595, 1, 1, 0.90088, 1, 0.95325, 0.74505, 0.90088, 1, 0.97198, 0.75339, 0.91009, 0.91009, 0.91009, 0.66466, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.91755, 0.788, 0.80314, 0.73764, 0.73764, 0.73764, 0.73764, 0.86023, 0.86023, 0.86023, 0.86023, 0.92915, 0.91115, 0.8858, 0.8858, 0.8858, 0.8858, 0.8858, 1.02058, 0.8858, 0.89591, 0.89591, 0.89591, 0.89591, 0.8111, 0.79611, 0.89713, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86667, 0.86936, 0.896, 0.90083, 0.90083, 0.90083, 0.90083, 0.84224, 0.84224, 0.84224, 0.84224, 0.97276, 0.99793, 0.98714, 0.98714, 0.98714, 0.98714, 0.98714, 1.08595, 0.89876, 0.99074, 0.99074, 0.99074, 0.99074, 0.942, 1.0231, 0.942, 0.91755, 0.86667, 0.91755, 0.86667, 0.91755, 0.86667, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.80314, 0.896, 0.92222, 0.93372, 0.92915, 1.01411, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.73764, 0.90083, 0.83051, 1.00512, 0.83051, 1.00512, 0.83051, 1.00512, 1, 1, 0.90284, 0.99793, 0.90976, 0.99793, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 0.84224, 0.86023, 1.05326, 0.86023, 0.84224, 0.82873, 1.07469, 0.74, 1.09377, 1, 1, 0.938, 0.84869, 1.06226, 1, 1, 0.84869, 0.83704, 0.84869, 0.81441, 0.85588, 1.08927, 0.91115, 0.99793, 1, 1, 0.91115, 0.99793, 0.91887, 0.90991, 0.99793, 0.8858, 0.98714, 0.8858, 0.98714, 0.8858, 0.98714, 0.894, 0.91434, 0.74498, 0.98196, 1, 1, 0.74498, 0.98196, 0.73914, 0.792, 0.73914, 0.792, 1, 1, 0.73914, 0.792, 1, 1, 0.81363, 0.904, 0.81363, 1.19137, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89591, 0.99074, 0.89633, 1.01915, 0.8111, 0.942, 0.8111, 0.90531, 0.856, 0.90531, 0.856, 0.90531, 0.856, 1, 0.92241, 0.91755, 0.86667, 0.788, 0.86936, 0.8858, 0.89876, 1, 1, 0.81363, 1.19137, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90088, 0.90388, 1.03901, 0.92138, 0.78105, 0.7154, 0.86169, 0.80513, 0.94007, 0.82528, 0.98612, 1.06226, 0.91755, 0.8126, 0.81884, 0.92819, 0.73764, 0.90531, 0.90284, 0.8858, 0.86023, 0.8126, 0.91172, 0.96518, 0.91115, 0.83089, 0.8858, 0.87791, 0.79761, 0.89297, 0.81363, 0.88157, 0.89992, 0.85608, 0.81992, 0.94307, 0.86023, 0.88157, 0.95308, 0.98699, 0.99793, 1.06226, 0.95817, 0.95308, 0.97358, 0.928, 0.98088, 0.98699, 0.92761, 0.99793, 0.96017, 1.06226, 0.986, 0.944, 0.95978, 0.938, 0.96705, 0.98714, 0.80442, 0.98972, 1, 0.89762, 1.04552, 0.95817, 0.99007, 0.87064, 0.91879, 0.88888, 1.06226, 0.95817, 0.98714, 0.95817, 0.88888, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.89633, 1.01915, 0.89633, 1.01915, 0.89633, 1.01915, 0.8111, 0.942, 0.9219, 1, 0.89903, 1, 1, 1, 0.93173, 0.93173, 0.93173, 1, 1.06304, 1.06304, 1.06904, 0.89903, 0.89903, 0.80549, 1, 1.156, 1, 1, 0.76575, 0.76575, 1, 1, 0.72458, 1, 1, 1, 1, 0.92241, 1, 1, 1, 0.619, 1, 1.36145, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.07257, 1, 0.74705, 0.71119, 1.02058, 1.024, 1.02119, 1, 1, 1.1536, 1.08595, 1.08595, 1, 1.08595, 1.08595, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.05638, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26104. const MyriadProRegularMetrics = {
  26105. lineHeight: 1.2,
  26106. lineGap: 0.2
  26107. };
  26108. ;// ./src/core/segoeui_factors.js
  26109. const SegoeuiBoldFactors = [1.76738, 1, 1, 0.99297, 0.9824, 1.04016, 1.06497, 1.03424, 0.97529, 1.17647, 1.23203, 1.1085, 1.1085, 1.16939, 1.2107, 0.9754, 1.21408, 0.9754, 1.59578, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 1.03424, 0.81378, 0.81378, 1.2107, 1.2107, 1.2107, 0.71703, 0.97847, 0.97363, 0.88776, 0.8641, 1.02096, 0.79795, 0.85132, 0.914, 1.06085, 1.1406, 0.8007, 0.89858, 0.83693, 1.14889, 1.09398, 0.97489, 0.92094, 0.97489, 0.90399, 0.84041, 0.95923, 1.00135, 1, 1.06467, 0.98243, 0.90996, 0.99361, 1.1085, 1.56942, 1.1085, 1.2107, 0.74627, 0.94282, 0.96752, 1.01519, 0.86304, 1.01359, 0.97278, 1.15103, 1.01359, 0.98561, 1.02285, 1.02285, 1.00527, 1.02285, 1.0302, 0.99041, 1.0008, 1.01519, 1.01359, 1.02258, 0.79104, 1.16862, 0.99041, 0.97454, 1.02511, 0.99298, 0.96752, 0.95801, 0.94856, 1.16579, 0.94856, 1.2107, 0.9824, 1.03424, 1.03424, 1, 1.03424, 1.16579, 0.8727, 1.3871, 1.18622, 1.10818, 1.04478, 1.2107, 1.18622, 0.75155, 0.94994, 1.28826, 1.21408, 1.21408, 0.91056, 1, 0.91572, 0.9754, 0.64663, 1.18328, 1.24866, 1.04478, 1.14169, 1.15749, 1.17389, 0.71703, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.93506, 0.8641, 0.79795, 0.79795, 0.79795, 0.79795, 1.1406, 1.1406, 1.1406, 1.1406, 1.02096, 1.09398, 0.97426, 0.97426, 0.97426, 0.97426, 0.97426, 1.2107, 0.97489, 1.00135, 1.00135, 1.00135, 1.00135, 0.90996, 0.92094, 1.02798, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.96752, 0.93136, 0.86304, 0.97278, 0.97278, 0.97278, 0.97278, 1.02285, 1.02285, 1.02285, 1.02285, 0.97122, 0.99041, 1, 1, 1, 1, 1, 1.28826, 1.0008, 0.99041, 0.99041, 0.99041, 0.99041, 0.96752, 1.01519, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.97363, 0.96752, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 0.8641, 0.86304, 1.02096, 1.03057, 1.02096, 1.03517, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.79795, 0.97278, 0.914, 1.01359, 0.914, 1.01359, 0.914, 1.01359, 1, 1, 1.06085, 0.98561, 1.06085, 1.00879, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 1.1406, 1.02285, 0.97138, 1.08692, 0.8007, 1.02285, 1, 1, 1.00527, 0.83693, 1.02285, 1, 1, 0.83693, 0.9455, 0.83693, 0.90418, 0.83693, 1.13005, 1.09398, 0.99041, 1, 1, 1.09398, 0.99041, 0.96692, 1.09251, 0.99041, 0.97489, 1.0008, 0.97489, 1.0008, 0.97489, 1.0008, 0.93994, 0.97931, 0.90399, 1.02258, 1, 1, 0.90399, 1.02258, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 0.84041, 0.79104, 1, 1, 0.95923, 1.07034, 0.95923, 1.16862, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.00135, 0.99041, 1.06467, 1.02511, 0.90996, 0.96752, 0.90996, 0.99361, 0.95801, 0.99361, 0.95801, 0.99361, 0.95801, 1.07733, 1.03424, 0.97363, 0.96752, 0.93506, 0.93136, 0.97489, 1.0008, 1, 1, 0.95923, 1.16862, 1.15103, 1.15103, 1.01173, 1.03959, 0.75953, 0.81378, 0.79912, 1.15103, 1.21994, 0.95161, 0.87815, 1.01149, 0.81525, 0.7676, 0.98167, 1.01134, 1.02546, 0.84097, 1.03089, 1.18102, 0.97363, 0.88776, 0.85134, 0.97826, 0.79795, 0.99361, 1.06085, 0.97489, 1.1406, 0.89858, 1.0388, 1.14889, 1.09398, 0.86039, 0.97489, 1.0595, 0.92094, 0.94793, 0.95923, 0.90996, 0.99346, 0.98243, 1.02112, 0.95493, 1.1406, 0.90996, 1.03574, 1.02597, 1.0008, 1.18102, 1.06628, 1.03574, 1.0192, 1.01932, 1.00886, 0.97531, 1.0106, 1.0008, 1.13189, 1.18102, 1.02277, 0.98683, 1.0016, 0.99561, 1.07237, 1.0008, 0.90434, 0.99921, 0.93803, 0.8965, 1.23085, 1.06628, 1.04983, 0.96268, 1.0499, 0.98439, 1.18102, 1.06628, 1.0008, 1.06628, 0.98439, 0.79795, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09466, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.97278, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.02065, 1, 1, 1, 1, 1, 1, 1.06467, 1.02511, 1.06467, 1.02511, 1.06467, 1.02511, 0.90996, 0.96752, 1, 1.21408, 0.89903, 1, 1, 0.75155, 1.04394, 1.04394, 1.04394, 1.04394, 0.98633, 0.98633, 0.98633, 0.73047, 0.73047, 1.20642, 0.91211, 1.25635, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.12454, 0.93503, 1.03424, 1.19687, 1.03424, 1, 1, 1, 0.771, 1, 1, 1.15749, 1.15749, 1.15749, 1.10948, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.16897, 1, 0.96085, 0.90137, 1.2107, 1.18416, 1.13973, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21172, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18874, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.09193, 1.09193, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26110. const SegoeuiBoldMetrics = {
  26111. lineHeight: 1.33008,
  26112. lineGap: 0
  26113. };
  26114. const SegoeuiBoldItalicFactors = [1.76738, 1, 1, 0.98946, 1.03959, 1.04016, 1.02809, 1.036, 0.97639, 1.10953, 1.23203, 1.11144, 1.11144, 1.16939, 1.21237, 0.9754, 1.21261, 0.9754, 1.59754, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 1.036, 0.81378, 0.81378, 1.21237, 1.21237, 1.21237, 0.73541, 0.97847, 0.97363, 0.89723, 0.87897, 1.0426, 0.79429, 0.85292, 0.91149, 1.05815, 1.1406, 0.79631, 0.90128, 0.83853, 1.04396, 1.10615, 0.97552, 0.94436, 0.97552, 0.88641, 0.80527, 0.96083, 1.00135, 1, 1.06777, 0.9817, 0.91142, 0.99361, 1.11144, 1.57293, 1.11144, 1.21237, 0.74627, 1.31818, 1.06585, 0.97042, 0.83055, 0.97042, 0.93503, 1.1261, 0.97042, 0.97922, 1.14236, 0.94552, 1.01054, 1.14236, 1.02471, 0.97922, 0.94165, 0.97042, 0.97042, 1.0276, 0.78929, 1.1261, 0.97922, 0.95874, 1.02197, 0.98507, 0.96752, 0.97168, 0.95107, 1.16579, 0.95107, 1.21237, 1.03959, 1.036, 1.036, 1, 1.036, 1.16579, 0.87357, 1.31818, 1.18754, 1.26781, 1.05356, 1.21237, 1.18622, 0.79487, 0.94994, 1.29004, 1.24047, 1.24047, 1.31818, 1, 0.91484, 0.9754, 1.31818, 1.1349, 1.24866, 1.05356, 1.13934, 1.15574, 1.17389, 0.73541, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.97363, 0.94385, 0.87897, 0.79429, 0.79429, 0.79429, 0.79429, 1.1406, 1.1406, 1.1406, 1.1406, 1.0426, 1.10615, 0.97552, 0.97552, 0.97552, 0.97552, 0.97552, 1.21237, 0.97552, 1.00135, 1.00135, 1.00135, 1.00135, 0.91142, 0.94436, 0.98721, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 1.06585, 0.96705, 0.83055, 0.93503, 0.93503, 0.93503, 0.93503, 1.14236, 1.14236, 1.14236, 1.14236, 0.93125, 0.97922, 0.94165, 0.94165, 0.94165, 0.94165, 0.94165, 1.29004, 0.94165, 0.97922, 0.97922, 0.97922, 0.97922, 0.96752, 0.97042, 0.96752, 0.97363, 1.06585, 0.97363, 1.06585, 0.97363, 1.06585, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 0.87897, 0.83055, 1.0426, 1.0033, 1.0426, 0.97042, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.79429, 0.93503, 0.91149, 0.97042, 0.91149, 0.97042, 0.91149, 0.97042, 1, 1, 1.05815, 0.97922, 1.05815, 0.97922, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 1.1406, 1.14236, 0.97441, 1.04302, 0.79631, 1.01582, 1, 1, 1.01054, 0.83853, 1.14236, 1, 1, 0.83853, 1.09125, 0.83853, 0.90418, 0.83853, 1.19508, 1.10615, 0.97922, 1, 1, 1.10615, 0.97922, 1.01034, 1.10466, 0.97922, 0.97552, 0.94165, 0.97552, 0.94165, 0.97552, 0.94165, 0.91602, 0.91981, 0.88641, 1.0276, 1, 1, 0.88641, 1.0276, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 0.80527, 0.78929, 1, 1, 0.96083, 1.05403, 0.95923, 1.16862, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.00135, 0.97922, 1.06777, 1.02197, 0.91142, 0.96752, 0.91142, 0.99361, 0.97168, 0.99361, 0.97168, 0.99361, 0.97168, 1.23199, 1.036, 0.97363, 1.06585, 0.94385, 0.96705, 0.97552, 0.94165, 1, 1, 0.96083, 1.1261, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 1.31818, 0.95161, 1.27126, 1.00811, 0.83284, 0.77702, 0.99137, 0.95253, 1.0347, 0.86142, 1.07205, 1.14236, 0.97363, 0.89723, 0.86869, 1.09818, 0.79429, 0.99361, 1.05815, 0.97552, 1.1406, 0.90128, 1.06662, 1.04396, 1.10615, 0.84918, 0.97552, 1.04694, 0.94436, 0.98015, 0.96083, 0.91142, 1.00356, 0.9817, 1.01945, 0.98999, 1.1406, 0.91142, 1.04961, 0.9898, 1.00639, 1.14236, 1.07514, 1.04961, 0.99607, 1.02897, 1.008, 0.9898, 0.95134, 1.00639, 1.11121, 1.14236, 1.00518, 0.97981, 1.02186, 1, 1.08578, 0.94165, 0.99314, 0.98387, 0.93028, 0.93377, 1.35125, 1.07514, 1.10687, 0.93491, 1.04232, 1.00351, 1.14236, 1.07514, 0.94165, 1.07514, 1.00351, 0.79429, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.09097, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.93503, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.96609, 1, 1, 1, 1, 1, 1, 1.06777, 1.02197, 1.06777, 1.02197, 1.06777, 1.02197, 0.91142, 0.96752, 1, 1.21261, 0.89903, 1, 1, 0.75155, 1.04745, 1.04745, 1.04745, 1.04394, 0.98633, 0.98633, 0.98633, 0.72959, 0.72959, 1.20502, 0.91406, 1.26514, 1.222, 1.02956, 1.03372, 1.03372, 0.96039, 1.24633, 1, 1.09125, 0.93327, 1.03336, 1.16541, 1.036, 1, 1, 1, 0.771, 1, 1, 1.15574, 1.15574, 1.15574, 1.15574, 0.86364, 0.94434, 0.86279, 0.94434, 0.86224, 1, 1, 1.16798, 1, 0.96085, 0.90068, 1.21237, 1.18416, 1.13904, 0.69825, 0.9716, 2.10339, 1.29004, 1.29004, 1.21339, 1.29004, 1.29004, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18775, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.13269, 1.13269, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26115. const SegoeuiBoldItalicMetrics = {
  26116. lineHeight: 1.33008,
  26117. lineGap: 0
  26118. };
  26119. const SegoeuiItalicFactors = [1.76738, 1, 1, 0.98946, 1.14763, 1.05365, 1.06234, 0.96927, 0.92586, 1.15373, 1.18414, 0.91349, 0.91349, 1.07403, 1.17308, 0.78383, 1.20088, 0.78383, 1.42531, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78383, 0.78383, 1.17308, 1.17308, 1.17308, 0.77349, 0.94565, 0.94729, 0.85944, 0.88506, 0.9858, 0.74817, 0.80016, 0.88449, 0.98039, 0.95782, 0.69238, 0.89898, 0.83231, 0.98183, 1.03989, 0.96924, 0.86237, 0.96924, 0.80595, 0.74524, 0.86091, 0.95402, 0.94143, 0.98448, 0.8858, 0.83089, 0.93285, 1.0949, 1.39016, 1.0949, 1.45994, 0.74627, 1.04839, 0.97454, 0.97454, 0.87207, 0.97454, 0.87533, 1.06151, 0.97454, 1.00176, 1.16484, 1.08132, 0.98047, 1.16484, 1.02989, 1.01054, 0.96225, 0.97454, 0.97454, 1.06598, 0.79004, 1.16344, 1.00351, 0.94629, 0.9973, 0.91016, 0.96777, 0.9043, 0.91082, 0.92481, 0.91082, 1.17308, 0.95748, 0.96927, 0.96927, 1, 0.96927, 0.92481, 0.80597, 1.04839, 1.23393, 1.1781, 0.9245, 1.17308, 1.20808, 0.63218, 0.94261, 1.24822, 1.09971, 1.09971, 1.04839, 1, 0.85273, 0.78032, 1.04839, 1.09971, 1.22326, 0.9245, 1.09836, 1.13525, 1.15222, 0.70424, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.94729, 0.85498, 0.88506, 0.74817, 0.74817, 0.74817, 0.74817, 0.95782, 0.95782, 0.95782, 0.95782, 0.9858, 1.03989, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.17308, 0.96924, 0.95402, 0.95402, 0.95402, 0.95402, 0.83089, 0.86237, 0.88409, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.97454, 0.92916, 0.87207, 0.87533, 0.87533, 0.87533, 0.87533, 0.93146, 0.93146, 0.93146, 0.93146, 0.93854, 1.01054, 0.96225, 0.96225, 0.96225, 0.96225, 0.96225, 1.24822, 0.8761, 1.00351, 1.00351, 1.00351, 1.00351, 0.96777, 0.97454, 0.96777, 0.94729, 0.97454, 0.94729, 0.97454, 0.94729, 0.97454, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.88506, 0.87207, 0.9858, 0.95391, 0.9858, 0.97454, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.74817, 0.87533, 0.88449, 0.97454, 0.88449, 0.97454, 0.88449, 0.97454, 1, 1, 0.98039, 1.00176, 0.98039, 1.00176, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 0.93146, 0.95782, 1.16484, 0.95782, 0.93146, 0.84421, 1.12761, 0.69238, 1.08132, 1, 1, 0.98047, 0.83231, 1.16484, 1, 1, 0.84723, 1.04861, 0.84723, 0.78755, 0.83231, 1.23736, 1.03989, 1.01054, 1, 1, 1.03989, 1.01054, 0.9857, 1.03849, 1.01054, 0.96924, 0.96225, 0.96924, 0.96225, 0.96924, 0.96225, 0.92383, 0.90171, 0.80595, 1.06598, 1, 1, 0.80595, 1.06598, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 0.74524, 0.79004, 1, 1, 0.86091, 1.02759, 0.85771, 1.16344, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.95402, 1.00351, 0.98448, 0.9973, 0.83089, 0.96777, 0.83089, 0.93285, 0.9043, 0.93285, 0.9043, 0.93285, 0.9043, 1.31868, 0.96927, 0.94729, 0.97454, 0.85498, 0.92916, 0.96924, 0.8761, 1, 1, 0.86091, 1.16344, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 1.04839, 0.81965, 0.81965, 0.94729, 0.78032, 0.71022, 0.90883, 0.84171, 0.99877, 0.77596, 1.05734, 1.2, 0.94729, 0.85944, 0.82791, 0.9607, 0.74817, 0.93285, 0.98039, 0.96924, 0.95782, 0.89898, 0.98316, 0.98183, 1.03989, 0.78614, 0.96924, 0.97642, 0.86237, 0.86075, 0.86091, 0.83089, 0.90082, 0.8858, 0.97296, 1.01284, 0.95782, 0.83089, 1.0976, 1.04, 1.03342, 1.2, 1.0675, 1.0976, 0.98205, 1.03809, 1.05097, 1.04, 0.95364, 1.03342, 1.05401, 1.2, 1.02148, 1.0119, 1.04724, 1.0127, 1.02732, 0.96225, 0.8965, 0.97783, 0.93574, 0.94818, 1.30679, 1.0675, 1.11826, 0.99821, 1.0557, 1.0326, 1.2, 1.0675, 0.96225, 1.0675, 1.0326, 0.74817, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03754, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.87533, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.98705, 1, 1, 1, 1, 1, 1, 0.98448, 0.9973, 0.98448, 0.9973, 0.98448, 0.9973, 0.83089, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 0.94945, 0.94945, 0.94945, 0.94945, 1.12317, 1.12317, 1.12317, 0.67603, 0.67603, 1.15621, 0.73584, 1.21191, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87709, 0.96927, 1.01473, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.09836, 1.09836, 1.09836, 1.01522, 0.86321, 0.94434, 0.8649, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86438, 1.17308, 1.18416, 1.14589, 0.69825, 0.97622, 1.96791, 1.24822, 1.24822, 1.17308, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.17984, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10742, 1.10742, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26120. const SegoeuiItalicMetrics = {
  26121. lineHeight: 1.33008,
  26122. lineGap: 0
  26123. };
  26124. const SegoeuiRegularFactors = [1.76738, 1, 1, 0.98594, 1.02285, 1.10454, 1.06234, 0.96927, 0.92037, 1.19985, 1.2046, 0.90616, 0.90616, 1.07152, 1.1714, 0.78032, 1.20088, 0.78032, 1.40246, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.96927, 0.78032, 0.78032, 1.1714, 1.1714, 1.1714, 0.80597, 0.94084, 0.96706, 0.85944, 0.85734, 0.97093, 0.75842, 0.79936, 0.88198, 0.9831, 0.95782, 0.71387, 0.86969, 0.84636, 1.07796, 1.03584, 0.96924, 0.83968, 0.96924, 0.82826, 0.79649, 0.85771, 0.95132, 0.93119, 0.98965, 0.88433, 0.8287, 0.93365, 1.08612, 1.3638, 1.08612, 1.45786, 0.74627, 0.80499, 0.91484, 1.05707, 0.92383, 1.05882, 0.9403, 1.12654, 1.05882, 1.01756, 1.09011, 1.09011, 0.99414, 1.09011, 1.034, 1.01756, 1.05356, 1.05707, 1.05882, 1.04399, 0.84863, 1.21968, 1.01756, 0.95801, 1.00068, 0.91797, 0.96777, 0.9043, 0.90351, 0.92105, 0.90351, 1.1714, 0.85337, 0.96927, 0.96927, 0.99912, 0.96927, 0.92105, 0.80597, 1.2434, 1.20808, 1.05937, 0.90957, 1.1714, 1.20808, 0.75155, 0.94261, 1.24644, 1.09971, 1.09971, 0.84751, 1, 0.85273, 0.78032, 0.61584, 1.05425, 1.17914, 0.90957, 1.08665, 1.11593, 1.14169, 0.73381, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.96706, 0.86035, 0.85734, 0.75842, 0.75842, 0.75842, 0.75842, 0.95782, 0.95782, 0.95782, 0.95782, 0.97093, 1.03584, 0.96924, 0.96924, 0.96924, 0.96924, 0.96924, 1.1714, 0.96924, 0.95132, 0.95132, 0.95132, 0.95132, 0.8287, 0.83968, 0.89049, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.91484, 0.93575, 0.92383, 0.9403, 0.9403, 0.9403, 0.9403, 0.8717, 0.8717, 0.8717, 0.8717, 1.00527, 1.01756, 1.05356, 1.05356, 1.05356, 1.05356, 1.05356, 1.24644, 0.95923, 1.01756, 1.01756, 1.01756, 1.01756, 0.96777, 1.05707, 0.96777, 0.96706, 0.91484, 0.96706, 0.91484, 0.96706, 0.91484, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.85734, 0.92383, 0.97093, 1.0969, 0.97093, 1.05882, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.75842, 0.9403, 0.88198, 1.05882, 0.88198, 1.05882, 0.88198, 1.05882, 1, 1, 0.9831, 1.01756, 0.9831, 1.01756, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 0.8717, 0.95782, 1.09011, 0.95782, 0.8717, 0.84784, 1.11551, 0.71387, 1.09011, 1, 1, 0.99414, 0.84636, 1.09011, 1, 1, 0.84636, 1.0536, 0.84636, 0.94298, 0.84636, 1.23297, 1.03584, 1.01756, 1, 1, 1.03584, 1.01756, 1.00323, 1.03444, 1.01756, 0.96924, 1.05356, 0.96924, 1.05356, 0.96924, 1.05356, 0.93066, 0.98293, 0.82826, 1.04399, 1, 1, 0.82826, 1.04399, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 0.79649, 0.84863, 1, 1, 0.85771, 1.17318, 0.85771, 1.21968, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.95132, 1.01756, 0.98965, 1.00068, 0.8287, 0.96777, 0.8287, 0.93365, 0.9043, 0.93365, 0.9043, 0.93365, 0.9043, 1.08571, 0.96927, 0.96706, 0.91484, 0.86035, 0.93575, 0.96924, 0.95923, 1, 1, 0.85771, 1.21968, 1.11437, 1.11437, 0.93109, 0.91202, 0.60411, 0.84164, 0.55572, 1.01173, 0.97361, 0.81818, 0.81818, 0.96635, 0.78032, 0.72727, 0.92366, 0.98601, 1.03405, 0.77968, 1.09799, 1.2, 0.96706, 0.85944, 0.85638, 0.96491, 0.75842, 0.93365, 0.9831, 0.96924, 0.95782, 0.86969, 0.94152, 1.07796, 1.03584, 0.78437, 0.96924, 0.98715, 0.83968, 0.83491, 0.85771, 0.8287, 0.94492, 0.88433, 0.9287, 1.0098, 0.95782, 0.8287, 1.0625, 0.98248, 1.03424, 1.2, 1.01071, 1.0625, 0.95246, 1.03809, 1.04912, 0.98248, 1.00221, 1.03424, 1.05443, 1.2, 1.04785, 0.99609, 1.00169, 1.05176, 0.99346, 1.05356, 0.9087, 1.03004, 0.95542, 0.93117, 1.23362, 1.01071, 1.07831, 1.02512, 1.05205, 1.03502, 1.2, 1.01071, 1.05356, 1.01071, 1.03502, 0.75842, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.03719, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0.9403, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.04021, 1, 1, 1, 1, 1, 1, 0.98965, 1.00068, 0.98965, 1.00068, 0.98965, 1.00068, 0.8287, 0.96777, 1, 1.20088, 0.89903, 1, 1, 0.75155, 1.03077, 1.03077, 1.03077, 1.03077, 1.13196, 1.13196, 1.13196, 0.67428, 0.67428, 1.16039, 0.73291, 1.20996, 1.22135, 1.06483, 0.94868, 0.94868, 0.95996, 1.24633, 1, 1.07497, 0.87796, 0.96927, 1.01518, 0.96927, 1, 1, 1, 0.77295, 1, 1, 1.10539, 1.10539, 1.11358, 1.06967, 0.86279, 0.94434, 0.86279, 0.94434, 0.86182, 1, 1, 1.083, 1, 0.91578, 0.86507, 1.1714, 1.18416, 1.14589, 0.69825, 0.97622, 1.9697, 1.24822, 1.24822, 1.17238, 1.24822, 1.24822, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.42603, 1, 0.99862, 0.99862, 1, 0.87025, 0.87025, 0.87025, 0.87025, 1.18083, 1.42603, 1, 1.42603, 1.42603, 0.99862, 1, 1, 1, 1, 1, 1.2886, 1.04315, 1.15296, 1.34163, 1, 1, 1, 1.10938, 1.10938, 1, 1, 1, 1.05425, 1.09971, 1.09971, 1.09971, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
  26125. const SegoeuiRegularMetrics = {
  26126. lineHeight: 1.33008,
  26127. lineGap: 0
  26128. };
  26129. ;// ./src/core/xfa_fonts.js
  26130. const getXFAFontMap = getLookupTableFactory(function (t) {
  26131. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  26132. name: "LiberationSans-Regular",
  26133. factors: MyriadProRegularFactors,
  26134. baseWidths: LiberationSansRegularWidths,
  26135. baseMapping: LiberationSansRegularMapping,
  26136. metrics: MyriadProRegularMetrics
  26137. };
  26138. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  26139. name: "LiberationSans-Bold",
  26140. factors: MyriadProBoldFactors,
  26141. baseWidths: LiberationSansBoldWidths,
  26142. baseMapping: LiberationSansBoldMapping,
  26143. metrics: MyriadProBoldMetrics
  26144. };
  26145. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  26146. name: "LiberationSans-Italic",
  26147. factors: MyriadProItalicFactors,
  26148. baseWidths: LiberationSansItalicWidths,
  26149. baseMapping: LiberationSansItalicMapping,
  26150. metrics: MyriadProItalicMetrics
  26151. };
  26152. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  26153. name: "LiberationSans-BoldItalic",
  26154. factors: MyriadProBoldItalicFactors,
  26155. baseWidths: LiberationSansBoldItalicWidths,
  26156. baseMapping: LiberationSansBoldItalicMapping,
  26157. metrics: MyriadProBoldItalicMetrics
  26158. };
  26159. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  26160. name: "LiberationSans-Regular",
  26161. baseWidths: LiberationSansRegularWidths,
  26162. baseMapping: LiberationSansRegularMapping
  26163. };
  26164. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  26165. name: "LiberationSans-Bold",
  26166. baseWidths: LiberationSansBoldWidths,
  26167. baseMapping: LiberationSansBoldMapping
  26168. };
  26169. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  26170. name: "LiberationSans-Italic",
  26171. baseWidths: LiberationSansItalicWidths,
  26172. baseMapping: LiberationSansItalicMapping
  26173. };
  26174. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  26175. name: "LiberationSans-BoldItalic",
  26176. baseWidths: LiberationSansBoldItalicWidths,
  26177. baseMapping: LiberationSansBoldItalicMapping
  26178. };
  26179. t["Calibri-Regular"] = {
  26180. name: "LiberationSans-Regular",
  26181. factors: CalibriRegularFactors,
  26182. baseWidths: LiberationSansRegularWidths,
  26183. baseMapping: LiberationSansRegularMapping,
  26184. metrics: CalibriRegularMetrics
  26185. };
  26186. t["Calibri-Bold"] = {
  26187. name: "LiberationSans-Bold",
  26188. factors: CalibriBoldFactors,
  26189. baseWidths: LiberationSansBoldWidths,
  26190. baseMapping: LiberationSansBoldMapping,
  26191. metrics: CalibriBoldMetrics
  26192. };
  26193. t["Calibri-Italic"] = {
  26194. name: "LiberationSans-Italic",
  26195. factors: CalibriItalicFactors,
  26196. baseWidths: LiberationSansItalicWidths,
  26197. baseMapping: LiberationSansItalicMapping,
  26198. metrics: CalibriItalicMetrics
  26199. };
  26200. t["Calibri-BoldItalic"] = {
  26201. name: "LiberationSans-BoldItalic",
  26202. factors: CalibriBoldItalicFactors,
  26203. baseWidths: LiberationSansBoldItalicWidths,
  26204. baseMapping: LiberationSansBoldItalicMapping,
  26205. metrics: CalibriBoldItalicMetrics
  26206. };
  26207. t["Segoeui-Regular"] = {
  26208. name: "LiberationSans-Regular",
  26209. factors: SegoeuiRegularFactors,
  26210. baseWidths: LiberationSansRegularWidths,
  26211. baseMapping: LiberationSansRegularMapping,
  26212. metrics: SegoeuiRegularMetrics
  26213. };
  26214. t["Segoeui-Bold"] = {
  26215. name: "LiberationSans-Bold",
  26216. factors: SegoeuiBoldFactors,
  26217. baseWidths: LiberationSansBoldWidths,
  26218. baseMapping: LiberationSansBoldMapping,
  26219. metrics: SegoeuiBoldMetrics
  26220. };
  26221. t["Segoeui-Italic"] = {
  26222. name: "LiberationSans-Italic",
  26223. factors: SegoeuiItalicFactors,
  26224. baseWidths: LiberationSansItalicWidths,
  26225. baseMapping: LiberationSansItalicMapping,
  26226. metrics: SegoeuiItalicMetrics
  26227. };
  26228. t["Segoeui-BoldItalic"] = {
  26229. name: "LiberationSans-BoldItalic",
  26230. factors: SegoeuiBoldItalicFactors,
  26231. baseWidths: LiberationSansBoldItalicWidths,
  26232. baseMapping: LiberationSansBoldItalicMapping,
  26233. metrics: SegoeuiBoldItalicMetrics
  26234. };
  26235. t["Helvetica-Regular"] = t.Helvetica = {
  26236. name: "LiberationSans-Regular",
  26237. factors: HelveticaRegularFactors,
  26238. baseWidths: LiberationSansRegularWidths,
  26239. baseMapping: LiberationSansRegularMapping,
  26240. metrics: HelveticaRegularMetrics
  26241. };
  26242. t["Helvetica-Bold"] = {
  26243. name: "LiberationSans-Bold",
  26244. factors: HelveticaBoldFactors,
  26245. baseWidths: LiberationSansBoldWidths,
  26246. baseMapping: LiberationSansBoldMapping,
  26247. metrics: HelveticaBoldMetrics
  26248. };
  26249. t["Helvetica-Italic"] = {
  26250. name: "LiberationSans-Italic",
  26251. factors: HelveticaItalicFactors,
  26252. baseWidths: LiberationSansItalicWidths,
  26253. baseMapping: LiberationSansItalicMapping,
  26254. metrics: HelveticaItalicMetrics
  26255. };
  26256. t["Helvetica-BoldItalic"] = {
  26257. name: "LiberationSans-BoldItalic",
  26258. factors: HelveticaBoldItalicFactors,
  26259. baseWidths: LiberationSansBoldItalicWidths,
  26260. baseMapping: LiberationSansBoldItalicMapping,
  26261. metrics: HelveticaBoldItalicMetrics
  26262. };
  26263. });
  26264. function getXfaFontName(name) {
  26265. const fontName = normalizeFontName(name);
  26266. const fontMap = getXFAFontMap();
  26267. return fontMap[fontName];
  26268. }
  26269. function getXfaFontWidths(name) {
  26270. const info = getXfaFontName(name);
  26271. if (!info) {
  26272. return null;
  26273. }
  26274. const {
  26275. baseWidths,
  26276. baseMapping,
  26277. factors
  26278. } = info;
  26279. const rescaledBaseWidths = !factors ? baseWidths : baseWidths.map((w, i) => w * factors[i]);
  26280. let currentCode = -2;
  26281. let currentArray;
  26282. const newWidths = [];
  26283. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  26284. if (unicode === -1) {
  26285. continue;
  26286. }
  26287. if (unicode === currentCode + 1) {
  26288. currentArray.push(rescaledBaseWidths[glyphIndex]);
  26289. currentCode += 1;
  26290. } else {
  26291. currentCode = unicode;
  26292. currentArray = [rescaledBaseWidths[glyphIndex]];
  26293. newWidths.push(unicode, currentArray);
  26294. }
  26295. }
  26296. return newWidths;
  26297. }
  26298. function getXfaFontDict(name) {
  26299. const widths = getXfaFontWidths(name);
  26300. const dict = new Dict(null);
  26301. dict.set("BaseFont", Name.get(name));
  26302. dict.set("Type", Name.get("Font"));
  26303. dict.set("Subtype", Name.get("CIDFontType2"));
  26304. dict.set("Encoding", Name.get("Identity-H"));
  26305. dict.set("CIDToGIDMap", Name.get("Identity"));
  26306. dict.set("W", widths);
  26307. dict.set("FirstChar", widths[0]);
  26308. dict.set("LastChar", widths.at(-2) + widths.at(-1).length - 1);
  26309. const descriptor = new Dict(null);
  26310. dict.set("FontDescriptor", descriptor);
  26311. const systemInfo = new Dict(null);
  26312. systemInfo.set("Ordering", "Identity");
  26313. systemInfo.set("Registry", "Adobe");
  26314. systemInfo.set("Supplement", 0);
  26315. dict.set("CIDSystemInfo", systemInfo);
  26316. return dict;
  26317. }
  26318. ;// ./src/core/ps_parser.js
  26319. class PostScriptParser {
  26320. constructor(lexer) {
  26321. this.lexer = lexer;
  26322. this.operators = [];
  26323. this.token = null;
  26324. this.prev = null;
  26325. }
  26326. nextToken() {
  26327. this.prev = this.token;
  26328. this.token = this.lexer.getToken();
  26329. }
  26330. accept(type) {
  26331. if (this.token.type === type) {
  26332. this.nextToken();
  26333. return true;
  26334. }
  26335. return false;
  26336. }
  26337. expect(type) {
  26338. if (this.accept(type)) {
  26339. return true;
  26340. }
  26341. throw new FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  26342. }
  26343. parse() {
  26344. this.nextToken();
  26345. this.expect(PostScriptTokenTypes.LBRACE);
  26346. this.parseBlock();
  26347. this.expect(PostScriptTokenTypes.RBRACE);
  26348. return this.operators;
  26349. }
  26350. parseBlock() {
  26351. while (true) {
  26352. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  26353. this.operators.push(this.prev.value);
  26354. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  26355. this.operators.push(this.prev.value);
  26356. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  26357. this.parseCondition();
  26358. } else {
  26359. return;
  26360. }
  26361. }
  26362. }
  26363. parseCondition() {
  26364. const conditionLocation = this.operators.length;
  26365. this.operators.push(null, null);
  26366. this.parseBlock();
  26367. this.expect(PostScriptTokenTypes.RBRACE);
  26368. if (this.accept(PostScriptTokenTypes.IF)) {
  26369. this.operators[conditionLocation] = this.operators.length;
  26370. this.operators[conditionLocation + 1] = "jz";
  26371. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  26372. const jumpLocation = this.operators.length;
  26373. this.operators.push(null, null);
  26374. const endOfTrue = this.operators.length;
  26375. this.parseBlock();
  26376. this.expect(PostScriptTokenTypes.RBRACE);
  26377. this.expect(PostScriptTokenTypes.IFELSE);
  26378. this.operators[jumpLocation] = this.operators.length;
  26379. this.operators[jumpLocation + 1] = "j";
  26380. this.operators[conditionLocation] = endOfTrue;
  26381. this.operators[conditionLocation + 1] = "jz";
  26382. } else {
  26383. throw new FormatError("PS Function: error parsing conditional.");
  26384. }
  26385. }
  26386. }
  26387. const PostScriptTokenTypes = {
  26388. LBRACE: 0,
  26389. RBRACE: 1,
  26390. NUMBER: 2,
  26391. OPERATOR: 3,
  26392. IF: 4,
  26393. IFELSE: 5
  26394. };
  26395. class PostScriptToken {
  26396. static get opCache() {
  26397. return shadow(this, "opCache", Object.create(null));
  26398. }
  26399. constructor(type, value) {
  26400. this.type = type;
  26401. this.value = value;
  26402. }
  26403. static getOperator(op) {
  26404. return PostScriptToken.opCache[op] ||= new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  26405. }
  26406. static get LBRACE() {
  26407. return shadow(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  26408. }
  26409. static get RBRACE() {
  26410. return shadow(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  26411. }
  26412. static get IF() {
  26413. return shadow(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  26414. }
  26415. static get IFELSE() {
  26416. return shadow(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  26417. }
  26418. }
  26419. class PostScriptLexer {
  26420. constructor(stream) {
  26421. this.stream = stream;
  26422. this.nextChar();
  26423. this.strBuf = [];
  26424. }
  26425. nextChar() {
  26426. return this.currentChar = this.stream.getByte();
  26427. }
  26428. getToken() {
  26429. let comment = false;
  26430. let ch = this.currentChar;
  26431. while (true) {
  26432. if (ch < 0) {
  26433. return EOF;
  26434. }
  26435. if (comment) {
  26436. if (ch === 0x0a || ch === 0x0d) {
  26437. comment = false;
  26438. }
  26439. } else if (ch === 0x25) {
  26440. comment = true;
  26441. } else if (!isWhiteSpace(ch)) {
  26442. break;
  26443. }
  26444. ch = this.nextChar();
  26445. }
  26446. switch (ch | 0) {
  26447. case 0x30:
  26448. case 0x31:
  26449. case 0x32:
  26450. case 0x33:
  26451. case 0x34:
  26452. case 0x35:
  26453. case 0x36:
  26454. case 0x37:
  26455. case 0x38:
  26456. case 0x39:
  26457. case 0x2b:
  26458. case 0x2d:
  26459. case 0x2e:
  26460. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  26461. case 0x7b:
  26462. this.nextChar();
  26463. return PostScriptToken.LBRACE;
  26464. case 0x7d:
  26465. this.nextChar();
  26466. return PostScriptToken.RBRACE;
  26467. }
  26468. const strBuf = this.strBuf;
  26469. strBuf.length = 0;
  26470. strBuf[0] = String.fromCharCode(ch);
  26471. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  26472. strBuf.push(String.fromCharCode(ch));
  26473. }
  26474. const str = strBuf.join("");
  26475. switch (str.toLowerCase()) {
  26476. case "if":
  26477. return PostScriptToken.IF;
  26478. case "ifelse":
  26479. return PostScriptToken.IFELSE;
  26480. default:
  26481. return PostScriptToken.getOperator(str);
  26482. }
  26483. }
  26484. getNumber() {
  26485. let ch = this.currentChar;
  26486. const strBuf = this.strBuf;
  26487. strBuf.length = 0;
  26488. strBuf[0] = String.fromCharCode(ch);
  26489. while ((ch = this.nextChar()) >= 0) {
  26490. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  26491. strBuf.push(String.fromCharCode(ch));
  26492. } else {
  26493. break;
  26494. }
  26495. }
  26496. const value = parseFloat(strBuf.join(""));
  26497. if (isNaN(value)) {
  26498. throw new FormatError(`Invalid floating point number: ${value}`);
  26499. }
  26500. return value;
  26501. }
  26502. }
  26503. ;// ./src/core/image_utils.js
  26504. class BaseLocalCache {
  26505. constructor(options) {
  26506. this._onlyRefs = options?.onlyRefs === true;
  26507. if (!this._onlyRefs) {
  26508. this._nameRefMap = new Map();
  26509. this._imageMap = new Map();
  26510. }
  26511. this._imageCache = new RefSetCache();
  26512. }
  26513. getByName(name) {
  26514. if (this._onlyRefs) {
  26515. unreachable("Should not call `getByName` method.");
  26516. }
  26517. const ref = this._nameRefMap.get(name);
  26518. if (ref) {
  26519. return this.getByRef(ref);
  26520. }
  26521. return this._imageMap.get(name) || null;
  26522. }
  26523. getByRef(ref) {
  26524. return this._imageCache.get(ref) || null;
  26525. }
  26526. set(name, ref, data) {
  26527. unreachable("Abstract method `set` called.");
  26528. }
  26529. }
  26530. class LocalImageCache extends BaseLocalCache {
  26531. set(name, ref = null, data) {
  26532. if (typeof name !== "string") {
  26533. throw new Error('LocalImageCache.set - expected "name" argument.');
  26534. }
  26535. if (ref) {
  26536. if (this._imageCache.has(ref)) {
  26537. return;
  26538. }
  26539. this._nameRefMap.set(name, ref);
  26540. this._imageCache.put(ref, data);
  26541. return;
  26542. }
  26543. if (this._imageMap.has(name)) {
  26544. return;
  26545. }
  26546. this._imageMap.set(name, data);
  26547. }
  26548. }
  26549. class LocalColorSpaceCache extends BaseLocalCache {
  26550. set(name = null, ref = null, data) {
  26551. if (typeof name !== "string" && !ref) {
  26552. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  26553. }
  26554. if (ref) {
  26555. if (this._imageCache.has(ref)) {
  26556. return;
  26557. }
  26558. if (name !== null) {
  26559. this._nameRefMap.set(name, ref);
  26560. }
  26561. this._imageCache.put(ref, data);
  26562. return;
  26563. }
  26564. if (this._imageMap.has(name)) {
  26565. return;
  26566. }
  26567. this._imageMap.set(name, data);
  26568. }
  26569. }
  26570. class LocalFunctionCache extends BaseLocalCache {
  26571. constructor(options) {
  26572. super({
  26573. onlyRefs: true
  26574. });
  26575. }
  26576. set(name = null, ref, data) {
  26577. if (!ref) {
  26578. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  26579. }
  26580. if (this._imageCache.has(ref)) {
  26581. return;
  26582. }
  26583. this._imageCache.put(ref, data);
  26584. }
  26585. }
  26586. class LocalGStateCache extends BaseLocalCache {
  26587. set(name, ref = null, data) {
  26588. if (typeof name !== "string") {
  26589. throw new Error('LocalGStateCache.set - expected "name" argument.');
  26590. }
  26591. if (ref) {
  26592. if (this._imageCache.has(ref)) {
  26593. return;
  26594. }
  26595. this._nameRefMap.set(name, ref);
  26596. this._imageCache.put(ref, data);
  26597. return;
  26598. }
  26599. if (this._imageMap.has(name)) {
  26600. return;
  26601. }
  26602. this._imageMap.set(name, data);
  26603. }
  26604. }
  26605. class LocalTilingPatternCache extends BaseLocalCache {
  26606. constructor(options) {
  26607. super({
  26608. onlyRefs: true
  26609. });
  26610. }
  26611. set(name = null, ref, data) {
  26612. if (!ref) {
  26613. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  26614. }
  26615. if (this._imageCache.has(ref)) {
  26616. return;
  26617. }
  26618. this._imageCache.put(ref, data);
  26619. }
  26620. }
  26621. class RegionalImageCache extends BaseLocalCache {
  26622. constructor(options) {
  26623. super({
  26624. onlyRefs: true
  26625. });
  26626. }
  26627. set(name = null, ref, data) {
  26628. if (!ref) {
  26629. throw new Error('RegionalImageCache.set - expected "ref" argument.');
  26630. }
  26631. if (this._imageCache.has(ref)) {
  26632. return;
  26633. }
  26634. this._imageCache.put(ref, data);
  26635. }
  26636. }
  26637. class GlobalImageCache {
  26638. static NUM_PAGES_THRESHOLD = 2;
  26639. static MIN_IMAGES_TO_CACHE = 10;
  26640. static MAX_BYTE_SIZE = 5 * MAX_IMAGE_SIZE_TO_CACHE;
  26641. #decodeFailedSet = new RefSet();
  26642. constructor() {
  26643. this._refCache = new RefSetCache();
  26644. this._imageCache = new RefSetCache();
  26645. }
  26646. get #byteSize() {
  26647. let byteSize = 0;
  26648. for (const imageData of this._imageCache) {
  26649. byteSize += imageData.byteSize;
  26650. }
  26651. return byteSize;
  26652. }
  26653. get #cacheLimitReached() {
  26654. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  26655. return false;
  26656. }
  26657. if (this.#byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  26658. return false;
  26659. }
  26660. return true;
  26661. }
  26662. shouldCache(ref, pageIndex) {
  26663. let pageIndexSet = this._refCache.get(ref);
  26664. if (!pageIndexSet) {
  26665. pageIndexSet = new Set();
  26666. this._refCache.put(ref, pageIndexSet);
  26667. }
  26668. pageIndexSet.add(pageIndex);
  26669. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  26670. return false;
  26671. }
  26672. if (!this._imageCache.has(ref) && this.#cacheLimitReached) {
  26673. return false;
  26674. }
  26675. return true;
  26676. }
  26677. addDecodeFailed(ref) {
  26678. this.#decodeFailedSet.put(ref);
  26679. }
  26680. hasDecodeFailed(ref) {
  26681. return this.#decodeFailedSet.has(ref);
  26682. }
  26683. addByteSize(ref, byteSize) {
  26684. const imageData = this._imageCache.get(ref);
  26685. if (!imageData) {
  26686. return;
  26687. }
  26688. if (imageData.byteSize) {
  26689. return;
  26690. }
  26691. imageData.byteSize = byteSize;
  26692. }
  26693. getData(ref, pageIndex) {
  26694. const pageIndexSet = this._refCache.get(ref);
  26695. if (!pageIndexSet) {
  26696. return null;
  26697. }
  26698. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  26699. return null;
  26700. }
  26701. const imageData = this._imageCache.get(ref);
  26702. if (!imageData) {
  26703. return null;
  26704. }
  26705. pageIndexSet.add(pageIndex);
  26706. return imageData;
  26707. }
  26708. setData(ref, data) {
  26709. if (!this._refCache.has(ref)) {
  26710. throw new Error('GlobalImageCache.setData - expected "shouldCache" to have been called.');
  26711. }
  26712. if (this._imageCache.has(ref)) {
  26713. return;
  26714. }
  26715. if (this.#cacheLimitReached) {
  26716. warn("GlobalImageCache.setData - cache limit reached.");
  26717. return;
  26718. }
  26719. this._imageCache.put(ref, data);
  26720. }
  26721. clear(onlyData = false) {
  26722. if (!onlyData) {
  26723. this.#decodeFailedSet.clear();
  26724. this._refCache.clear();
  26725. }
  26726. this._imageCache.clear();
  26727. }
  26728. }
  26729. ;// ./src/core/function.js
  26730. class PDFFunctionFactory {
  26731. constructor({
  26732. xref,
  26733. isEvalSupported = true
  26734. }) {
  26735. this.xref = xref;
  26736. this.isEvalSupported = isEvalSupported !== false;
  26737. }
  26738. create(fn) {
  26739. const cachedFunction = this.getCached(fn);
  26740. if (cachedFunction) {
  26741. return cachedFunction;
  26742. }
  26743. const parsedFunction = PDFFunction.parse({
  26744. xref: this.xref,
  26745. isEvalSupported: this.isEvalSupported,
  26746. fn: fn instanceof Ref ? this.xref.fetch(fn) : fn
  26747. });
  26748. this._cache(fn, parsedFunction);
  26749. return parsedFunction;
  26750. }
  26751. createFromArray(fnObj) {
  26752. const cachedFunction = this.getCached(fnObj);
  26753. if (cachedFunction) {
  26754. return cachedFunction;
  26755. }
  26756. const parsedFunction = PDFFunction.parseArray({
  26757. xref: this.xref,
  26758. isEvalSupported: this.isEvalSupported,
  26759. fnObj: fnObj instanceof Ref ? this.xref.fetch(fnObj) : fnObj
  26760. });
  26761. this._cache(fnObj, parsedFunction);
  26762. return parsedFunction;
  26763. }
  26764. getCached(cacheKey) {
  26765. let fnRef;
  26766. if (cacheKey instanceof Ref) {
  26767. fnRef = cacheKey;
  26768. } else if (cacheKey instanceof Dict) {
  26769. fnRef = cacheKey.objId;
  26770. } else if (cacheKey instanceof BaseStream) {
  26771. fnRef = cacheKey.dict?.objId;
  26772. }
  26773. if (fnRef) {
  26774. const localFunction = this._localFunctionCache.getByRef(fnRef);
  26775. if (localFunction) {
  26776. return localFunction;
  26777. }
  26778. }
  26779. return null;
  26780. }
  26781. _cache(cacheKey, parsedFunction) {
  26782. if (!parsedFunction) {
  26783. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  26784. }
  26785. let fnRef;
  26786. if (cacheKey instanceof Ref) {
  26787. fnRef = cacheKey;
  26788. } else if (cacheKey instanceof Dict) {
  26789. fnRef = cacheKey.objId;
  26790. } else if (cacheKey instanceof BaseStream) {
  26791. fnRef = cacheKey.dict?.objId;
  26792. }
  26793. if (fnRef) {
  26794. this._localFunctionCache.set(null, fnRef, parsedFunction);
  26795. }
  26796. }
  26797. get _localFunctionCache() {
  26798. return shadow(this, "_localFunctionCache", new LocalFunctionCache());
  26799. }
  26800. }
  26801. function toNumberArray(arr) {
  26802. if (!Array.isArray(arr)) {
  26803. return null;
  26804. }
  26805. if (!isNumberArray(arr, null)) {
  26806. return arr.map(x => +x);
  26807. }
  26808. return arr;
  26809. }
  26810. class PDFFunction {
  26811. static getSampleArray(size, outputSize, bps, stream) {
  26812. let i, ii;
  26813. let length = 1;
  26814. for (i = 0, ii = size.length; i < ii; i++) {
  26815. length *= size[i];
  26816. }
  26817. length *= outputSize;
  26818. const array = new Array(length);
  26819. let codeSize = 0;
  26820. let codeBuf = 0;
  26821. const sampleMul = 1.0 / (2.0 ** bps - 1);
  26822. const strBytes = stream.getBytes((length * bps + 7) / 8);
  26823. let strIdx = 0;
  26824. for (i = 0; i < length; i++) {
  26825. while (codeSize < bps) {
  26826. codeBuf <<= 8;
  26827. codeBuf |= strBytes[strIdx++];
  26828. codeSize += 8;
  26829. }
  26830. codeSize -= bps;
  26831. array[i] = (codeBuf >> codeSize) * sampleMul;
  26832. codeBuf &= (1 << codeSize) - 1;
  26833. }
  26834. return array;
  26835. }
  26836. static parse({
  26837. xref,
  26838. isEvalSupported,
  26839. fn
  26840. }) {
  26841. const dict = fn.dict || fn;
  26842. const typeNum = dict.get("FunctionType");
  26843. switch (typeNum) {
  26844. case 0:
  26845. return this.constructSampled({
  26846. xref,
  26847. isEvalSupported,
  26848. fn,
  26849. dict
  26850. });
  26851. case 1:
  26852. break;
  26853. case 2:
  26854. return this.constructInterpolated({
  26855. xref,
  26856. isEvalSupported,
  26857. dict
  26858. });
  26859. case 3:
  26860. return this.constructStiched({
  26861. xref,
  26862. isEvalSupported,
  26863. dict
  26864. });
  26865. case 4:
  26866. return this.constructPostScript({
  26867. xref,
  26868. isEvalSupported,
  26869. fn,
  26870. dict
  26871. });
  26872. }
  26873. throw new FormatError("Unknown type of function");
  26874. }
  26875. static parseArray({
  26876. xref,
  26877. isEvalSupported,
  26878. fnObj
  26879. }) {
  26880. if (!Array.isArray(fnObj)) {
  26881. return this.parse({
  26882. xref,
  26883. isEvalSupported,
  26884. fn: fnObj
  26885. });
  26886. }
  26887. const fnArray = [];
  26888. for (const fn of fnObj) {
  26889. fnArray.push(this.parse({
  26890. xref,
  26891. isEvalSupported,
  26892. fn: xref.fetchIfRef(fn)
  26893. }));
  26894. }
  26895. return function (src, srcOffset, dest, destOffset) {
  26896. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  26897. fnArray[i](src, srcOffset, dest, destOffset + i);
  26898. }
  26899. };
  26900. }
  26901. static constructSampled({
  26902. xref,
  26903. isEvalSupported,
  26904. fn,
  26905. dict
  26906. }) {
  26907. function toMultiArray(arr) {
  26908. const inputLength = arr.length;
  26909. const out = [];
  26910. let index = 0;
  26911. for (let i = 0; i < inputLength; i += 2) {
  26912. out[index++] = [arr[i], arr[i + 1]];
  26913. }
  26914. return out;
  26915. }
  26916. function interpolate(x, xmin, xmax, ymin, ymax) {
  26917. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  26918. }
  26919. let domain = toNumberArray(dict.getArray("Domain"));
  26920. let range = toNumberArray(dict.getArray("Range"));
  26921. if (!domain || !range) {
  26922. throw new FormatError("No domain or range");
  26923. }
  26924. const inputSize = domain.length / 2;
  26925. const outputSize = range.length / 2;
  26926. domain = toMultiArray(domain);
  26927. range = toMultiArray(range);
  26928. const size = toNumberArray(dict.getArray("Size"));
  26929. const bps = dict.get("BitsPerSample");
  26930. const order = dict.get("Order") || 1;
  26931. if (order !== 1) {
  26932. info("No support for cubic spline interpolation: " + order);
  26933. }
  26934. let encode = toNumberArray(dict.getArray("Encode"));
  26935. if (!encode) {
  26936. encode = [];
  26937. for (let i = 0; i < inputSize; ++i) {
  26938. encode.push([0, size[i] - 1]);
  26939. }
  26940. } else {
  26941. encode = toMultiArray(encode);
  26942. }
  26943. let decode = toNumberArray(dict.getArray("Decode"));
  26944. decode = !decode ? range : toMultiArray(decode);
  26945. const samples = this.getSampleArray(size, outputSize, bps, fn);
  26946. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  26947. const cubeVertices = 1 << inputSize;
  26948. const cubeN = new Float64Array(cubeVertices);
  26949. const cubeVertex = new Uint32Array(cubeVertices);
  26950. let i, j;
  26951. for (j = 0; j < cubeVertices; j++) {
  26952. cubeN[j] = 1;
  26953. }
  26954. let k = outputSize,
  26955. pos = 1;
  26956. for (i = 0; i < inputSize; ++i) {
  26957. const domain_2i = domain[i][0];
  26958. const domain_2i_1 = domain[i][1];
  26959. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  26960. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  26961. const size_i = size[i];
  26962. e = Math.min(Math.max(e, 0), size_i - 1);
  26963. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  26964. const n0 = e0 + 1 - e;
  26965. const n1 = e - e0;
  26966. const offset0 = e0 * k;
  26967. const offset1 = offset0 + k;
  26968. for (j = 0; j < cubeVertices; j++) {
  26969. if (j & pos) {
  26970. cubeN[j] *= n1;
  26971. cubeVertex[j] += offset1;
  26972. } else {
  26973. cubeN[j] *= n0;
  26974. cubeVertex[j] += offset0;
  26975. }
  26976. }
  26977. k *= size_i;
  26978. pos <<= 1;
  26979. }
  26980. for (j = 0; j < outputSize; ++j) {
  26981. let rj = 0;
  26982. for (i = 0; i < cubeVertices; i++) {
  26983. rj += samples[cubeVertex[i] + j] * cubeN[i];
  26984. }
  26985. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  26986. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  26987. }
  26988. };
  26989. }
  26990. static constructInterpolated({
  26991. xref,
  26992. isEvalSupported,
  26993. dict
  26994. }) {
  26995. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  26996. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  26997. const n = dict.get("N");
  26998. const diff = [];
  26999. for (let i = 0, ii = c0.length; i < ii; ++i) {
  27000. diff.push(c1[i] - c0[i]);
  27001. }
  27002. const length = diff.length;
  27003. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  27004. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  27005. for (let j = 0; j < length; ++j) {
  27006. dest[destOffset + j] = c0[j] + x * diff[j];
  27007. }
  27008. };
  27009. }
  27010. static constructStiched({
  27011. xref,
  27012. isEvalSupported,
  27013. dict
  27014. }) {
  27015. const domain = toNumberArray(dict.getArray("Domain"));
  27016. if (!domain) {
  27017. throw new FormatError("No domain");
  27018. }
  27019. const inputSize = domain.length / 2;
  27020. if (inputSize !== 1) {
  27021. throw new FormatError("Bad domain for stiched function");
  27022. }
  27023. const fns = [];
  27024. for (const fn of dict.get("Functions")) {
  27025. fns.push(this.parse({
  27026. xref,
  27027. isEvalSupported,
  27028. fn: xref.fetchIfRef(fn)
  27029. }));
  27030. }
  27031. const bounds = toNumberArray(dict.getArray("Bounds"));
  27032. const encode = toNumberArray(dict.getArray("Encode"));
  27033. const tmpBuf = new Float32Array(1);
  27034. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  27035. const clip = function constructStichedFromIRClip(v, min, max) {
  27036. if (v > max) {
  27037. v = max;
  27038. } else if (v < min) {
  27039. v = min;
  27040. }
  27041. return v;
  27042. };
  27043. const v = clip(src[srcOffset], domain[0], domain[1]);
  27044. const length = bounds.length;
  27045. let i;
  27046. for (i = 0; i < length; ++i) {
  27047. if (v < bounds[i]) {
  27048. break;
  27049. }
  27050. }
  27051. let dmin = domain[0];
  27052. if (i > 0) {
  27053. dmin = bounds[i - 1];
  27054. }
  27055. let dmax = domain[1];
  27056. if (i < bounds.length) {
  27057. dmax = bounds[i];
  27058. }
  27059. const rmin = encode[2 * i];
  27060. const rmax = encode[2 * i + 1];
  27061. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  27062. fns[i](tmpBuf, 0, dest, destOffset);
  27063. };
  27064. }
  27065. static constructPostScript({
  27066. xref,
  27067. isEvalSupported,
  27068. fn,
  27069. dict
  27070. }) {
  27071. const domain = toNumberArray(dict.getArray("Domain"));
  27072. const range = toNumberArray(dict.getArray("Range"));
  27073. if (!domain) {
  27074. throw new FormatError("No domain.");
  27075. }
  27076. if (!range) {
  27077. throw new FormatError("No range.");
  27078. }
  27079. const lexer = new PostScriptLexer(fn);
  27080. const parser = new PostScriptParser(lexer);
  27081. const code = parser.parse();
  27082. if (isEvalSupported && FeatureTest.isEvalSupported) {
  27083. const compiled = new PostScriptCompiler().compile(code, domain, range);
  27084. if (compiled) {
  27085. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  27086. }
  27087. }
  27088. info("Unable to compile PS function");
  27089. const numOutputs = range.length >> 1;
  27090. const numInputs = domain.length >> 1;
  27091. const evaluator = new PostScriptEvaluator(code);
  27092. const cache = Object.create(null);
  27093. const MAX_CACHE_SIZE = 2048 * 4;
  27094. let cache_available = MAX_CACHE_SIZE;
  27095. const tmpBuf = new Float32Array(numInputs);
  27096. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  27097. let i, value;
  27098. let key = "";
  27099. const input = tmpBuf;
  27100. for (i = 0; i < numInputs; i++) {
  27101. value = src[srcOffset + i];
  27102. input[i] = value;
  27103. key += value + "_";
  27104. }
  27105. const cachedValue = cache[key];
  27106. if (cachedValue !== undefined) {
  27107. dest.set(cachedValue, destOffset);
  27108. return;
  27109. }
  27110. const output = new Float32Array(numOutputs);
  27111. const stack = evaluator.execute(input);
  27112. const stackIndex = stack.length - numOutputs;
  27113. for (i = 0; i < numOutputs; i++) {
  27114. value = stack[stackIndex + i];
  27115. let bound = range[i * 2];
  27116. if (value < bound) {
  27117. value = bound;
  27118. } else {
  27119. bound = range[i * 2 + 1];
  27120. if (value > bound) {
  27121. value = bound;
  27122. }
  27123. }
  27124. output[i] = value;
  27125. }
  27126. if (cache_available > 0) {
  27127. cache_available--;
  27128. cache[key] = output;
  27129. }
  27130. dest.set(output, destOffset);
  27131. };
  27132. }
  27133. }
  27134. function isPDFFunction(v) {
  27135. let fnDict;
  27136. if (v instanceof Dict) {
  27137. fnDict = v;
  27138. } else if (v instanceof BaseStream) {
  27139. fnDict = v.dict;
  27140. } else {
  27141. return false;
  27142. }
  27143. return fnDict.has("FunctionType");
  27144. }
  27145. class PostScriptStack {
  27146. static MAX_STACK_SIZE = 100;
  27147. constructor(initialStack) {
  27148. this.stack = initialStack ? Array.from(initialStack) : [];
  27149. }
  27150. push(value) {
  27151. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  27152. throw new Error("PostScript function stack overflow.");
  27153. }
  27154. this.stack.push(value);
  27155. }
  27156. pop() {
  27157. if (this.stack.length <= 0) {
  27158. throw new Error("PostScript function stack underflow.");
  27159. }
  27160. return this.stack.pop();
  27161. }
  27162. copy(n) {
  27163. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  27164. throw new Error("PostScript function stack overflow.");
  27165. }
  27166. const stack = this.stack;
  27167. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  27168. stack.push(stack[i]);
  27169. }
  27170. }
  27171. index(n) {
  27172. this.push(this.stack[this.stack.length - n - 1]);
  27173. }
  27174. roll(n, p) {
  27175. const stack = this.stack;
  27176. const l = stack.length - n;
  27177. const r = stack.length - 1;
  27178. const c = l + (p - Math.floor(p / n) * n);
  27179. for (let i = l, j = r; i < j; i++, j--) {
  27180. const t = stack[i];
  27181. stack[i] = stack[j];
  27182. stack[j] = t;
  27183. }
  27184. for (let i = l, j = c - 1; i < j; i++, j--) {
  27185. const t = stack[i];
  27186. stack[i] = stack[j];
  27187. stack[j] = t;
  27188. }
  27189. for (let i = c, j = r; i < j; i++, j--) {
  27190. const t = stack[i];
  27191. stack[i] = stack[j];
  27192. stack[j] = t;
  27193. }
  27194. }
  27195. }
  27196. class PostScriptEvaluator {
  27197. constructor(operators) {
  27198. this.operators = operators;
  27199. }
  27200. execute(initialStack) {
  27201. const stack = new PostScriptStack(initialStack);
  27202. let counter = 0;
  27203. const operators = this.operators;
  27204. const length = operators.length;
  27205. let operator, a, b;
  27206. while (counter < length) {
  27207. operator = operators[counter++];
  27208. if (typeof operator === "number") {
  27209. stack.push(operator);
  27210. continue;
  27211. }
  27212. switch (operator) {
  27213. case "jz":
  27214. b = stack.pop();
  27215. a = stack.pop();
  27216. if (!a) {
  27217. counter = b;
  27218. }
  27219. break;
  27220. case "j":
  27221. a = stack.pop();
  27222. counter = a;
  27223. break;
  27224. case "abs":
  27225. a = stack.pop();
  27226. stack.push(Math.abs(a));
  27227. break;
  27228. case "add":
  27229. b = stack.pop();
  27230. a = stack.pop();
  27231. stack.push(a + b);
  27232. break;
  27233. case "and":
  27234. b = stack.pop();
  27235. a = stack.pop();
  27236. if (typeof a === "boolean" && typeof b === "boolean") {
  27237. stack.push(a && b);
  27238. } else {
  27239. stack.push(a & b);
  27240. }
  27241. break;
  27242. case "atan":
  27243. b = stack.pop();
  27244. a = stack.pop();
  27245. a = Math.atan2(a, b) / Math.PI * 180;
  27246. if (a < 0) {
  27247. a += 360;
  27248. }
  27249. stack.push(a);
  27250. break;
  27251. case "bitshift":
  27252. b = stack.pop();
  27253. a = stack.pop();
  27254. if (a > 0) {
  27255. stack.push(a << b);
  27256. } else {
  27257. stack.push(a >> b);
  27258. }
  27259. break;
  27260. case "ceiling":
  27261. a = stack.pop();
  27262. stack.push(Math.ceil(a));
  27263. break;
  27264. case "copy":
  27265. a = stack.pop();
  27266. stack.copy(a);
  27267. break;
  27268. case "cos":
  27269. a = stack.pop();
  27270. stack.push(Math.cos(a % 360 / 180 * Math.PI));
  27271. break;
  27272. case "cvi":
  27273. a = stack.pop() | 0;
  27274. stack.push(a);
  27275. break;
  27276. case "cvr":
  27277. break;
  27278. case "div":
  27279. b = stack.pop();
  27280. a = stack.pop();
  27281. stack.push(a / b);
  27282. break;
  27283. case "dup":
  27284. stack.copy(1);
  27285. break;
  27286. case "eq":
  27287. b = stack.pop();
  27288. a = stack.pop();
  27289. stack.push(a === b);
  27290. break;
  27291. case "exch":
  27292. stack.roll(2, 1);
  27293. break;
  27294. case "exp":
  27295. b = stack.pop();
  27296. a = stack.pop();
  27297. stack.push(a ** b);
  27298. break;
  27299. case "false":
  27300. stack.push(false);
  27301. break;
  27302. case "floor":
  27303. a = stack.pop();
  27304. stack.push(Math.floor(a));
  27305. break;
  27306. case "ge":
  27307. b = stack.pop();
  27308. a = stack.pop();
  27309. stack.push(a >= b);
  27310. break;
  27311. case "gt":
  27312. b = stack.pop();
  27313. a = stack.pop();
  27314. stack.push(a > b);
  27315. break;
  27316. case "idiv":
  27317. b = stack.pop();
  27318. a = stack.pop();
  27319. stack.push(a / b | 0);
  27320. break;
  27321. case "index":
  27322. a = stack.pop();
  27323. stack.index(a);
  27324. break;
  27325. case "le":
  27326. b = stack.pop();
  27327. a = stack.pop();
  27328. stack.push(a <= b);
  27329. break;
  27330. case "ln":
  27331. a = stack.pop();
  27332. stack.push(Math.log(a));
  27333. break;
  27334. case "log":
  27335. a = stack.pop();
  27336. stack.push(Math.log10(a));
  27337. break;
  27338. case "lt":
  27339. b = stack.pop();
  27340. a = stack.pop();
  27341. stack.push(a < b);
  27342. break;
  27343. case "mod":
  27344. b = stack.pop();
  27345. a = stack.pop();
  27346. stack.push(a % b);
  27347. break;
  27348. case "mul":
  27349. b = stack.pop();
  27350. a = stack.pop();
  27351. stack.push(a * b);
  27352. break;
  27353. case "ne":
  27354. b = stack.pop();
  27355. a = stack.pop();
  27356. stack.push(a !== b);
  27357. break;
  27358. case "neg":
  27359. a = stack.pop();
  27360. stack.push(-a);
  27361. break;
  27362. case "not":
  27363. a = stack.pop();
  27364. if (typeof a === "boolean") {
  27365. stack.push(!a);
  27366. } else {
  27367. stack.push(~a);
  27368. }
  27369. break;
  27370. case "or":
  27371. b = stack.pop();
  27372. a = stack.pop();
  27373. if (typeof a === "boolean" && typeof b === "boolean") {
  27374. stack.push(a || b);
  27375. } else {
  27376. stack.push(a | b);
  27377. }
  27378. break;
  27379. case "pop":
  27380. stack.pop();
  27381. break;
  27382. case "roll":
  27383. b = stack.pop();
  27384. a = stack.pop();
  27385. stack.roll(a, b);
  27386. break;
  27387. case "round":
  27388. a = stack.pop();
  27389. stack.push(Math.round(a));
  27390. break;
  27391. case "sin":
  27392. a = stack.pop();
  27393. stack.push(Math.sin(a % 360 / 180 * Math.PI));
  27394. break;
  27395. case "sqrt":
  27396. a = stack.pop();
  27397. stack.push(Math.sqrt(a));
  27398. break;
  27399. case "sub":
  27400. b = stack.pop();
  27401. a = stack.pop();
  27402. stack.push(a - b);
  27403. break;
  27404. case "true":
  27405. stack.push(true);
  27406. break;
  27407. case "truncate":
  27408. a = stack.pop();
  27409. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  27410. stack.push(a);
  27411. break;
  27412. case "xor":
  27413. b = stack.pop();
  27414. a = stack.pop();
  27415. if (typeof a === "boolean" && typeof b === "boolean") {
  27416. stack.push(a !== b);
  27417. } else {
  27418. stack.push(a ^ b);
  27419. }
  27420. break;
  27421. default:
  27422. throw new FormatError(`Unknown operator ${operator}`);
  27423. }
  27424. }
  27425. return stack.stack;
  27426. }
  27427. }
  27428. class AstNode {
  27429. constructor(type) {
  27430. this.type = type;
  27431. }
  27432. visit(visitor) {
  27433. unreachable("abstract method");
  27434. }
  27435. }
  27436. class AstArgument extends AstNode {
  27437. constructor(index, min, max) {
  27438. super("args");
  27439. this.index = index;
  27440. this.min = min;
  27441. this.max = max;
  27442. }
  27443. visit(visitor) {
  27444. visitor.visitArgument(this);
  27445. }
  27446. }
  27447. class AstLiteral extends AstNode {
  27448. constructor(number) {
  27449. super("literal");
  27450. this.number = number;
  27451. this.min = number;
  27452. this.max = number;
  27453. }
  27454. visit(visitor) {
  27455. visitor.visitLiteral(this);
  27456. }
  27457. }
  27458. class AstBinaryOperation extends AstNode {
  27459. constructor(op, arg1, arg2, min, max) {
  27460. super("binary");
  27461. this.op = op;
  27462. this.arg1 = arg1;
  27463. this.arg2 = arg2;
  27464. this.min = min;
  27465. this.max = max;
  27466. }
  27467. visit(visitor) {
  27468. visitor.visitBinaryOperation(this);
  27469. }
  27470. }
  27471. class AstMin extends AstNode {
  27472. constructor(arg, max) {
  27473. super("max");
  27474. this.arg = arg;
  27475. this.min = arg.min;
  27476. this.max = max;
  27477. }
  27478. visit(visitor) {
  27479. visitor.visitMin(this);
  27480. }
  27481. }
  27482. class AstVariable extends AstNode {
  27483. constructor(index, min, max) {
  27484. super("var");
  27485. this.index = index;
  27486. this.min = min;
  27487. this.max = max;
  27488. }
  27489. visit(visitor) {
  27490. visitor.visitVariable(this);
  27491. }
  27492. }
  27493. class AstVariableDefinition extends AstNode {
  27494. constructor(variable, arg) {
  27495. super("definition");
  27496. this.variable = variable;
  27497. this.arg = arg;
  27498. }
  27499. visit(visitor) {
  27500. visitor.visitVariableDefinition(this);
  27501. }
  27502. }
  27503. class ExpressionBuilderVisitor {
  27504. constructor() {
  27505. this.parts = [];
  27506. }
  27507. visitArgument(arg) {
  27508. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  27509. }
  27510. visitVariable(variable) {
  27511. this.parts.push("v", variable.index);
  27512. }
  27513. visitLiteral(literal) {
  27514. this.parts.push(literal.number);
  27515. }
  27516. visitBinaryOperation(operation) {
  27517. this.parts.push("(");
  27518. operation.arg1.visit(this);
  27519. this.parts.push(" ", operation.op, " ");
  27520. operation.arg2.visit(this);
  27521. this.parts.push(")");
  27522. }
  27523. visitVariableDefinition(definition) {
  27524. this.parts.push("var ");
  27525. definition.variable.visit(this);
  27526. this.parts.push(" = ");
  27527. definition.arg.visit(this);
  27528. this.parts.push(";");
  27529. }
  27530. visitMin(max) {
  27531. this.parts.push("Math.min(");
  27532. max.arg.visit(this);
  27533. this.parts.push(", ", max.max, ")");
  27534. }
  27535. toString() {
  27536. return this.parts.join("");
  27537. }
  27538. }
  27539. function buildAddOperation(num1, num2) {
  27540. if (num2.type === "literal" && num2.number === 0) {
  27541. return num1;
  27542. }
  27543. if (num1.type === "literal" && num1.number === 0) {
  27544. return num2;
  27545. }
  27546. if (num2.type === "literal" && num1.type === "literal") {
  27547. return new AstLiteral(num1.number + num2.number);
  27548. }
  27549. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  27550. }
  27551. function buildMulOperation(num1, num2) {
  27552. if (num2.type === "literal") {
  27553. if (num2.number === 0) {
  27554. return new AstLiteral(0);
  27555. } else if (num2.number === 1) {
  27556. return num1;
  27557. } else if (num1.type === "literal") {
  27558. return new AstLiteral(num1.number * num2.number);
  27559. }
  27560. }
  27561. if (num1.type === "literal") {
  27562. if (num1.number === 0) {
  27563. return new AstLiteral(0);
  27564. } else if (num1.number === 1) {
  27565. return num2;
  27566. }
  27567. }
  27568. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  27569. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  27570. return new AstBinaryOperation("*", num1, num2, min, max);
  27571. }
  27572. function buildSubOperation(num1, num2) {
  27573. if (num2.type === "literal") {
  27574. if (num2.number === 0) {
  27575. return num1;
  27576. } else if (num1.type === "literal") {
  27577. return new AstLiteral(num1.number - num2.number);
  27578. }
  27579. }
  27580. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  27581. return num2.arg2;
  27582. }
  27583. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  27584. }
  27585. function buildMinOperation(num1, max) {
  27586. if (num1.min >= max) {
  27587. return new AstLiteral(max);
  27588. } else if (num1.max <= max) {
  27589. return num1;
  27590. }
  27591. return new AstMin(num1, max);
  27592. }
  27593. class PostScriptCompiler {
  27594. compile(code, domain, range) {
  27595. const stack = [];
  27596. const instructions = [];
  27597. const inputSize = domain.length >> 1,
  27598. outputSize = range.length >> 1;
  27599. let lastRegister = 0;
  27600. let n, j;
  27601. let num1, num2, ast1, ast2, tmpVar, item;
  27602. for (let i = 0; i < inputSize; i++) {
  27603. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  27604. }
  27605. for (let i = 0, ii = code.length; i < ii; i++) {
  27606. item = code[i];
  27607. if (typeof item === "number") {
  27608. stack.push(new AstLiteral(item));
  27609. continue;
  27610. }
  27611. switch (item) {
  27612. case "add":
  27613. if (stack.length < 2) {
  27614. return null;
  27615. }
  27616. num2 = stack.pop();
  27617. num1 = stack.pop();
  27618. stack.push(buildAddOperation(num1, num2));
  27619. break;
  27620. case "cvr":
  27621. if (stack.length < 1) {
  27622. return null;
  27623. }
  27624. break;
  27625. case "mul":
  27626. if (stack.length < 2) {
  27627. return null;
  27628. }
  27629. num2 = stack.pop();
  27630. num1 = stack.pop();
  27631. stack.push(buildMulOperation(num1, num2));
  27632. break;
  27633. case "sub":
  27634. if (stack.length < 2) {
  27635. return null;
  27636. }
  27637. num2 = stack.pop();
  27638. num1 = stack.pop();
  27639. stack.push(buildSubOperation(num1, num2));
  27640. break;
  27641. case "exch":
  27642. if (stack.length < 2) {
  27643. return null;
  27644. }
  27645. ast1 = stack.pop();
  27646. ast2 = stack.pop();
  27647. stack.push(ast1, ast2);
  27648. break;
  27649. case "pop":
  27650. if (stack.length < 1) {
  27651. return null;
  27652. }
  27653. stack.pop();
  27654. break;
  27655. case "index":
  27656. if (stack.length < 1) {
  27657. return null;
  27658. }
  27659. num1 = stack.pop();
  27660. if (num1.type !== "literal") {
  27661. return null;
  27662. }
  27663. n = num1.number;
  27664. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  27665. return null;
  27666. }
  27667. ast1 = stack[stack.length - n - 1];
  27668. if (ast1.type === "literal" || ast1.type === "var") {
  27669. stack.push(ast1);
  27670. break;
  27671. }
  27672. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  27673. stack[stack.length - n - 1] = tmpVar;
  27674. stack.push(tmpVar);
  27675. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  27676. break;
  27677. case "dup":
  27678. if (stack.length < 1) {
  27679. return null;
  27680. }
  27681. if (typeof code[i + 1] === "number" && code[i + 2] === "gt" && code[i + 3] === i + 7 && code[i + 4] === "jz" && code[i + 5] === "pop" && code[i + 6] === code[i + 1]) {
  27682. num1 = stack.pop();
  27683. stack.push(buildMinOperation(num1, code[i + 1]));
  27684. i += 6;
  27685. break;
  27686. }
  27687. ast1 = stack.at(-1);
  27688. if (ast1.type === "literal" || ast1.type === "var") {
  27689. stack.push(ast1);
  27690. break;
  27691. }
  27692. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  27693. stack[stack.length - 1] = tmpVar;
  27694. stack.push(tmpVar);
  27695. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  27696. break;
  27697. case "roll":
  27698. if (stack.length < 2) {
  27699. return null;
  27700. }
  27701. num2 = stack.pop();
  27702. num1 = stack.pop();
  27703. if (num2.type !== "literal" || num1.type !== "literal") {
  27704. return null;
  27705. }
  27706. j = num2.number;
  27707. n = num1.number;
  27708. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  27709. return null;
  27710. }
  27711. j = (j % n + n) % n;
  27712. if (j === 0) {
  27713. break;
  27714. }
  27715. stack.push(...stack.splice(stack.length - n, n - j));
  27716. break;
  27717. default:
  27718. return null;
  27719. }
  27720. }
  27721. if (stack.length !== outputSize) {
  27722. return null;
  27723. }
  27724. const result = [];
  27725. for (const instruction of instructions) {
  27726. const statementBuilder = new ExpressionBuilderVisitor();
  27727. instruction.visit(statementBuilder);
  27728. result.push(statementBuilder.toString());
  27729. }
  27730. for (let i = 0, ii = stack.length; i < ii; i++) {
  27731. const expr = stack[i],
  27732. statementBuilder = new ExpressionBuilderVisitor();
  27733. expr.visit(statementBuilder);
  27734. const min = range[i * 2],
  27735. max = range[i * 2 + 1];
  27736. const out = [statementBuilder.toString()];
  27737. if (min > expr.min) {
  27738. out.unshift("Math.max(", min, ", ");
  27739. out.push(")");
  27740. }
  27741. if (max < expr.max) {
  27742. out.unshift("Math.min(", max, ", ");
  27743. out.push(")");
  27744. }
  27745. out.unshift("dest[destOffset + ", i, "] = ");
  27746. out.push(";");
  27747. result.push(out.join(""));
  27748. }
  27749. return result.join("\n");
  27750. }
  27751. }
  27752. ;// ./src/core/bidi.js
  27753. const baseTypes = ["BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "S", "B", "S", "WS", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "B", "B", "B", "S", "WS", "ON", "ON", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "ON", "ES", "CS", "ES", "CS", "CS", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "CS", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "ON", "ON", "ON", "BN", "BN", "BN", "BN", "BN", "BN", "B", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "BN", "CS", "ON", "ET", "ET", "ET", "ET", "ON", "ON", "ON", "ON", "L", "ON", "ON", "BN", "ON", "ON", "ET", "ET", "EN", "EN", "ON", "L", "ON", "ON", "ON", "EN", "L", "ON", "ON", "ON", "ON", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "L", "ON", "L", "L", "L", "L", "L", "L", "L", "L"];
  27754. const arabicTypes = ["AN", "AN", "AN", "AN", "AN", "AN", "ON", "ON", "AL", "ET", "ET", "AL", "CS", "AL", "ON", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "AN", "ET", "AN", "AN", "AL", "AL", "AL", "NSM", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "AL", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AN", "ON", "NSM", "NSM", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "NSM", "NSM", "ON", "NSM", "NSM", "NSM", "NSM", "AL", "AL", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "EN", "AL", "AL", "AL", "AL", "AL", "AL"];
  27755. function isOdd(i) {
  27756. return (i & 1) !== 0;
  27757. }
  27758. function isEven(i) {
  27759. return (i & 1) === 0;
  27760. }
  27761. function findUnequal(arr, start, value) {
  27762. let j, jj;
  27763. for (j = start, jj = arr.length; j < jj; ++j) {
  27764. if (arr[j] !== value) {
  27765. return j;
  27766. }
  27767. }
  27768. return j;
  27769. }
  27770. function setValues(arr, start, end, value) {
  27771. for (let j = start; j < end; ++j) {
  27772. arr[j] = value;
  27773. }
  27774. }
  27775. function reverseValues(arr, start, end) {
  27776. for (let i = start, j = end - 1; i < j; ++i, --j) {
  27777. const temp = arr[i];
  27778. arr[i] = arr[j];
  27779. arr[j] = temp;
  27780. }
  27781. }
  27782. function createBidiText(str, isLTR, vertical = false) {
  27783. let dir = "ltr";
  27784. if (vertical) {
  27785. dir = "ttb";
  27786. } else if (!isLTR) {
  27787. dir = "rtl";
  27788. }
  27789. return {
  27790. str,
  27791. dir
  27792. };
  27793. }
  27794. const chars = [];
  27795. const types = [];
  27796. function bidi(str, startLevel = -1, vertical = false) {
  27797. let isLTR = true;
  27798. const strLength = str.length;
  27799. if (strLength === 0 || vertical) {
  27800. return createBidiText(str, isLTR, vertical);
  27801. }
  27802. chars.length = strLength;
  27803. types.length = strLength;
  27804. let numBidi = 0;
  27805. let i, ii;
  27806. for (i = 0; i < strLength; ++i) {
  27807. chars[i] = str.charAt(i);
  27808. const charCode = str.charCodeAt(i);
  27809. let charType = "L";
  27810. if (charCode <= 0x00ff) {
  27811. charType = baseTypes[charCode];
  27812. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  27813. charType = "R";
  27814. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  27815. charType = arabicTypes[charCode & 0xff];
  27816. if (!charType) {
  27817. warn("Bidi: invalid Unicode character " + charCode.toString(16));
  27818. }
  27819. } else if (0x0700 <= charCode && charCode <= 0x08ac || 0xfb50 <= charCode && charCode <= 0xfdff || 0xfe70 <= charCode && charCode <= 0xfeff) {
  27820. charType = "AL";
  27821. }
  27822. if (charType === "R" || charType === "AL" || charType === "AN") {
  27823. numBidi++;
  27824. }
  27825. types[i] = charType;
  27826. }
  27827. if (numBidi === 0) {
  27828. isLTR = true;
  27829. return createBidiText(str, isLTR);
  27830. }
  27831. if (startLevel === -1) {
  27832. if (numBidi / strLength < 0.3 && strLength > 4) {
  27833. isLTR = true;
  27834. startLevel = 0;
  27835. } else {
  27836. isLTR = false;
  27837. startLevel = 1;
  27838. }
  27839. }
  27840. const levels = [];
  27841. for (i = 0; i < strLength; ++i) {
  27842. levels[i] = startLevel;
  27843. }
  27844. const e = isOdd(startLevel) ? "R" : "L";
  27845. const sor = e;
  27846. const eor = sor;
  27847. let lastType = sor;
  27848. for (i = 0; i < strLength; ++i) {
  27849. if (types[i] === "NSM") {
  27850. types[i] = lastType;
  27851. } else {
  27852. lastType = types[i];
  27853. }
  27854. }
  27855. lastType = sor;
  27856. let t;
  27857. for (i = 0; i < strLength; ++i) {
  27858. t = types[i];
  27859. if (t === "EN") {
  27860. types[i] = lastType === "AL" ? "AN" : "EN";
  27861. } else if (t === "R" || t === "L" || t === "AL") {
  27862. lastType = t;
  27863. }
  27864. }
  27865. for (i = 0; i < strLength; ++i) {
  27866. t = types[i];
  27867. if (t === "AL") {
  27868. types[i] = "R";
  27869. }
  27870. }
  27871. for (i = 1; i < strLength - 1; ++i) {
  27872. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  27873. types[i] = "EN";
  27874. }
  27875. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  27876. types[i] = types[i - 1];
  27877. }
  27878. }
  27879. for (i = 0; i < strLength; ++i) {
  27880. if (types[i] === "EN") {
  27881. for (let j = i - 1; j >= 0; --j) {
  27882. if (types[j] !== "ET") {
  27883. break;
  27884. }
  27885. types[j] = "EN";
  27886. }
  27887. for (let j = i + 1; j < strLength; ++j) {
  27888. if (types[j] !== "ET") {
  27889. break;
  27890. }
  27891. types[j] = "EN";
  27892. }
  27893. }
  27894. }
  27895. for (i = 0; i < strLength; ++i) {
  27896. t = types[i];
  27897. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  27898. types[i] = "ON";
  27899. }
  27900. }
  27901. lastType = sor;
  27902. for (i = 0; i < strLength; ++i) {
  27903. t = types[i];
  27904. if (t === "EN") {
  27905. types[i] = lastType === "L" ? "L" : "EN";
  27906. } else if (t === "R" || t === "L") {
  27907. lastType = t;
  27908. }
  27909. }
  27910. for (i = 0; i < strLength; ++i) {
  27911. if (types[i] === "ON") {
  27912. const end = findUnequal(types, i + 1, "ON");
  27913. let before = sor;
  27914. if (i > 0) {
  27915. before = types[i - 1];
  27916. }
  27917. let after = eor;
  27918. if (end + 1 < strLength) {
  27919. after = types[end + 1];
  27920. }
  27921. if (before !== "L") {
  27922. before = "R";
  27923. }
  27924. if (after !== "L") {
  27925. after = "R";
  27926. }
  27927. if (before === after) {
  27928. setValues(types, i, end, before);
  27929. }
  27930. i = end - 1;
  27931. }
  27932. }
  27933. for (i = 0; i < strLength; ++i) {
  27934. if (types[i] === "ON") {
  27935. types[i] = e;
  27936. }
  27937. }
  27938. for (i = 0; i < strLength; ++i) {
  27939. t = types[i];
  27940. if (isEven(levels[i])) {
  27941. if (t === "R") {
  27942. levels[i] += 1;
  27943. } else if (t === "AN" || t === "EN") {
  27944. levels[i] += 2;
  27945. }
  27946. } else if (t === "L" || t === "AN" || t === "EN") {
  27947. levels[i] += 1;
  27948. }
  27949. }
  27950. let highestLevel = -1;
  27951. let lowestOddLevel = 99;
  27952. let level;
  27953. for (i = 0, ii = levels.length; i < ii; ++i) {
  27954. level = levels[i];
  27955. if (highestLevel < level) {
  27956. highestLevel = level;
  27957. }
  27958. if (lowestOddLevel > level && isOdd(level)) {
  27959. lowestOddLevel = level;
  27960. }
  27961. }
  27962. for (level = highestLevel; level >= lowestOddLevel; --level) {
  27963. let start = -1;
  27964. for (i = 0, ii = levels.length; i < ii; ++i) {
  27965. if (levels[i] < level) {
  27966. if (start >= 0) {
  27967. reverseValues(chars, start, i);
  27968. start = -1;
  27969. }
  27970. } else if (start < 0) {
  27971. start = i;
  27972. }
  27973. }
  27974. if (start >= 0) {
  27975. reverseValues(chars, start, levels.length);
  27976. }
  27977. }
  27978. for (i = 0, ii = chars.length; i < ii; ++i) {
  27979. const ch = chars[i];
  27980. if (ch === "<" || ch === ">") {
  27981. chars[i] = "";
  27982. }
  27983. }
  27984. return createBidiText(chars.join(""), isLTR);
  27985. }
  27986. ;// ./src/core/font_substitutions.js
  27987. const NORMAL = {
  27988. style: "normal",
  27989. weight: "normal"
  27990. };
  27991. const BOLD = {
  27992. style: "normal",
  27993. weight: "bold"
  27994. };
  27995. const ITALIC = {
  27996. style: "italic",
  27997. weight: "normal"
  27998. };
  27999. const BOLDITALIC = {
  28000. style: "italic",
  28001. weight: "bold"
  28002. };
  28003. const substitutionMap = new Map([["Times-Roman", {
  28004. local: ["Times New Roman", "Times-Roman", "Times", "Liberation Serif", "Nimbus Roman", "Nimbus Roman L", "Tinos", "Thorndale", "TeX Gyre Termes", "FreeSerif", "Linux Libertine O", "Libertinus Serif", "DejaVu Serif", "Bitstream Vera Serif", "Ubuntu"],
  28005. style: NORMAL,
  28006. ultimate: "serif"
  28007. }], ["Times-Bold", {
  28008. alias: "Times-Roman",
  28009. style: BOLD,
  28010. ultimate: "serif"
  28011. }], ["Times-Italic", {
  28012. alias: "Times-Roman",
  28013. style: ITALIC,
  28014. ultimate: "serif"
  28015. }], ["Times-BoldItalic", {
  28016. alias: "Times-Roman",
  28017. style: BOLDITALIC,
  28018. ultimate: "serif"
  28019. }], ["Helvetica", {
  28020. local: ["Helvetica", "Helvetica Neue", "Arial", "Arial Nova", "Liberation Sans", "Arimo", "Nimbus Sans", "Nimbus Sans L", "A030", "TeX Gyre Heros", "FreeSans", "DejaVu Sans", "Albany", "Bitstream Vera Sans", "Arial Unicode MS", "Microsoft Sans Serif", "Apple Symbols", "Cantarell"],
  28021. path: "LiberationSans-Regular.ttf",
  28022. style: NORMAL,
  28023. ultimate: "sans-serif"
  28024. }], ["Helvetica-Bold", {
  28025. alias: "Helvetica",
  28026. path: "LiberationSans-Bold.ttf",
  28027. style: BOLD,
  28028. ultimate: "sans-serif"
  28029. }], ["Helvetica-Oblique", {
  28030. alias: "Helvetica",
  28031. path: "LiberationSans-Italic.ttf",
  28032. style: ITALIC,
  28033. ultimate: "sans-serif"
  28034. }], ["Helvetica-BoldOblique", {
  28035. alias: "Helvetica",
  28036. path: "LiberationSans-BoldItalic.ttf",
  28037. style: BOLDITALIC,
  28038. ultimate: "sans-serif"
  28039. }], ["Courier", {
  28040. local: ["Courier", "Courier New", "Liberation Mono", "Nimbus Mono", "Nimbus Mono L", "Cousine", "Cumberland", "TeX Gyre Cursor", "FreeMono", "Linux Libertine Mono O", "Libertinus Mono"],
  28041. style: NORMAL,
  28042. ultimate: "monospace"
  28043. }], ["Courier-Bold", {
  28044. alias: "Courier",
  28045. style: BOLD,
  28046. ultimate: "monospace"
  28047. }], ["Courier-Oblique", {
  28048. alias: "Courier",
  28049. style: ITALIC,
  28050. ultimate: "monospace"
  28051. }], ["Courier-BoldOblique", {
  28052. alias: "Courier",
  28053. style: BOLDITALIC,
  28054. ultimate: "monospace"
  28055. }], ["ArialBlack", {
  28056. local: ["Arial Black"],
  28057. style: {
  28058. style: "normal",
  28059. weight: "900"
  28060. },
  28061. fallback: "Helvetica-Bold"
  28062. }], ["ArialBlack-Bold", {
  28063. alias: "ArialBlack"
  28064. }], ["ArialBlack-Italic", {
  28065. alias: "ArialBlack",
  28066. style: {
  28067. style: "italic",
  28068. weight: "900"
  28069. },
  28070. fallback: "Helvetica-BoldOblique"
  28071. }], ["ArialBlack-BoldItalic", {
  28072. alias: "ArialBlack-Italic"
  28073. }], ["ArialNarrow", {
  28074. local: ["Arial Narrow", "Liberation Sans Narrow", "Helvetica Condensed", "Nimbus Sans Narrow", "TeX Gyre Heros Cn"],
  28075. style: NORMAL,
  28076. fallback: "Helvetica"
  28077. }], ["ArialNarrow-Bold", {
  28078. alias: "ArialNarrow",
  28079. style: BOLD,
  28080. fallback: "Helvetica-Bold"
  28081. }], ["ArialNarrow-Italic", {
  28082. alias: "ArialNarrow",
  28083. style: ITALIC,
  28084. fallback: "Helvetica-Oblique"
  28085. }], ["ArialNarrow-BoldItalic", {
  28086. alias: "ArialNarrow",
  28087. style: BOLDITALIC,
  28088. fallback: "Helvetica-BoldOblique"
  28089. }], ["Calibri", {
  28090. local: ["Calibri", "Carlito"],
  28091. style: NORMAL,
  28092. fallback: "Helvetica"
  28093. }], ["Calibri-Bold", {
  28094. alias: "Calibri",
  28095. style: BOLD,
  28096. fallback: "Helvetica-Bold"
  28097. }], ["Calibri-Italic", {
  28098. alias: "Calibri",
  28099. style: ITALIC,
  28100. fallback: "Helvetica-Oblique"
  28101. }], ["Calibri-BoldItalic", {
  28102. alias: "Calibri",
  28103. style: BOLDITALIC,
  28104. fallback: "Helvetica-BoldOblique"
  28105. }], ["Wingdings", {
  28106. local: ["Wingdings", "URW Dingbats"],
  28107. style: NORMAL
  28108. }], ["Wingdings-Regular", {
  28109. alias: "Wingdings"
  28110. }], ["Wingdings-Bold", {
  28111. alias: "Wingdings"
  28112. }]]);
  28113. const fontAliases = new Map([["Arial-Black", "ArialBlack"]]);
  28114. function getStyleToAppend(style) {
  28115. switch (style) {
  28116. case BOLD:
  28117. return "Bold";
  28118. case ITALIC:
  28119. return "Italic";
  28120. case BOLDITALIC:
  28121. return "Bold Italic";
  28122. default:
  28123. if (style?.weight === "bold") {
  28124. return "Bold";
  28125. }
  28126. if (style?.style === "italic") {
  28127. return "Italic";
  28128. }
  28129. }
  28130. return "";
  28131. }
  28132. function getFamilyName(str) {
  28133. const keywords = new Set(["thin", "extralight", "ultralight", "demilight", "semilight", "light", "book", "regular", "normal", "medium", "demibold", "semibold", "bold", "extrabold", "ultrabold", "black", "heavy", "extrablack", "ultrablack", "roman", "italic", "oblique", "ultracondensed", "extracondensed", "condensed", "semicondensed", "normal", "semiexpanded", "expanded", "extraexpanded", "ultraexpanded", "bolditalic"]);
  28134. return str.split(/[- ,+]+/g).filter(tok => !keywords.has(tok.toLowerCase())).join(" ");
  28135. }
  28136. function generateFont({
  28137. alias,
  28138. local,
  28139. path,
  28140. fallback,
  28141. style,
  28142. ultimate
  28143. }, src, localFontPath, useFallback = true, usePath = true, append = "") {
  28144. const result = {
  28145. style: null,
  28146. ultimate: null
  28147. };
  28148. if (local) {
  28149. const extra = append ? ` ${append}` : "";
  28150. for (const name of local) {
  28151. src.push(`local(${name}${extra})`);
  28152. }
  28153. }
  28154. if (alias) {
  28155. const substitution = substitutionMap.get(alias);
  28156. const aliasAppend = append || getStyleToAppend(style);
  28157. Object.assign(result, generateFont(substitution, src, localFontPath, useFallback && !fallback, usePath && !path, aliasAppend));
  28158. }
  28159. if (style) {
  28160. result.style = style;
  28161. }
  28162. if (ultimate) {
  28163. result.ultimate = ultimate;
  28164. }
  28165. if (useFallback && fallback) {
  28166. const fallbackInfo = substitutionMap.get(fallback);
  28167. const {
  28168. ultimate: fallbackUltimate
  28169. } = generateFont(fallbackInfo, src, localFontPath, useFallback, usePath && !path, append);
  28170. result.ultimate ||= fallbackUltimate;
  28171. }
  28172. if (usePath && path && localFontPath) {
  28173. src.push(`url(${localFontPath}${path})`);
  28174. }
  28175. return result;
  28176. }
  28177. function getFontSubstitution(systemFontCache, idFactory, localFontPath, baseFontName, standardFontName, type) {
  28178. if (baseFontName.startsWith("InvalidPDFjsFont_")) {
  28179. return null;
  28180. }
  28181. if ((type === "TrueType" || type === "Type1") && /^[A-Z]{6}\+/.test(baseFontName)) {
  28182. baseFontName = baseFontName.slice(7);
  28183. }
  28184. baseFontName = normalizeFontName(baseFontName);
  28185. const key = baseFontName;
  28186. let substitutionInfo = systemFontCache.get(key);
  28187. if (substitutionInfo) {
  28188. return substitutionInfo;
  28189. }
  28190. let substitution = substitutionMap.get(baseFontName);
  28191. if (!substitution) {
  28192. for (const [alias, subst] of fontAliases) {
  28193. if (baseFontName.startsWith(alias)) {
  28194. baseFontName = `${subst}${baseFontName.substring(alias.length)}`;
  28195. substitution = substitutionMap.get(baseFontName);
  28196. break;
  28197. }
  28198. }
  28199. }
  28200. let mustAddBaseFont = false;
  28201. if (!substitution) {
  28202. substitution = substitutionMap.get(standardFontName);
  28203. mustAddBaseFont = true;
  28204. }
  28205. const loadedName = `${idFactory.getDocId()}_s${idFactory.createFontId()}`;
  28206. if (!substitution) {
  28207. if (!validateFontName(baseFontName)) {
  28208. warn(`Cannot substitute the font because of its name: ${baseFontName}`);
  28209. systemFontCache.set(key, null);
  28210. return null;
  28211. }
  28212. const bold = /bold/gi.test(baseFontName);
  28213. const italic = /oblique|italic/gi.test(baseFontName);
  28214. const style = bold && italic && BOLDITALIC || bold && BOLD || italic && ITALIC || NORMAL;
  28215. substitutionInfo = {
  28216. css: `"${getFamilyName(baseFontName)}",${loadedName}`,
  28217. guessFallback: true,
  28218. loadedName,
  28219. baseFontName,
  28220. src: `local(${baseFontName})`,
  28221. style
  28222. };
  28223. systemFontCache.set(key, substitutionInfo);
  28224. return substitutionInfo;
  28225. }
  28226. const src = [];
  28227. if (mustAddBaseFont && validateFontName(baseFontName)) {
  28228. src.push(`local(${baseFontName})`);
  28229. }
  28230. const {
  28231. style,
  28232. ultimate
  28233. } = generateFont(substitution, src, localFontPath);
  28234. const guessFallback = ultimate === null;
  28235. const fallback = guessFallback ? "" : `,${ultimate}`;
  28236. substitutionInfo = {
  28237. css: `"${getFamilyName(baseFontName)}",${loadedName}${fallback}`,
  28238. guessFallback,
  28239. loadedName,
  28240. baseFontName,
  28241. src: src.join(","),
  28242. style
  28243. };
  28244. systemFontCache.set(key, substitutionInfo);
  28245. return substitutionInfo;
  28246. }
  28247. ;// ./src/core/image_resizer.js
  28248. const MIN_IMAGE_DIM = 2048;
  28249. const MAX_IMAGE_DIM = 65537;
  28250. const MAX_ERROR = 128;
  28251. class ImageResizer {
  28252. static #goodSquareLength = MIN_IMAGE_DIM;
  28253. static #isImageDecoderSupported = FeatureTest.isImageDecoderSupported;
  28254. constructor(imgData, isMask) {
  28255. this._imgData = imgData;
  28256. this._isMask = isMask;
  28257. }
  28258. static get canUseImageDecoder() {
  28259. return shadow(this, "canUseImageDecoder", this.#isImageDecoderSupported ? ImageDecoder.isTypeSupported("image/bmp") : Promise.resolve(false));
  28260. }
  28261. static needsToBeResized(width, height) {
  28262. if (width <= this.#goodSquareLength && height <= this.#goodSquareLength) {
  28263. return false;
  28264. }
  28265. const {
  28266. MAX_DIM
  28267. } = this;
  28268. if (width > MAX_DIM || height > MAX_DIM) {
  28269. return true;
  28270. }
  28271. const area = width * height;
  28272. if (this._hasMaxArea) {
  28273. return area > this.MAX_AREA;
  28274. }
  28275. if (area < this.#goodSquareLength ** 2) {
  28276. return false;
  28277. }
  28278. if (this._areGoodDims(width, height)) {
  28279. this.#goodSquareLength = Math.max(this.#goodSquareLength, Math.floor(Math.sqrt(width * height)));
  28280. return false;
  28281. }
  28282. this.#goodSquareLength = this._guessMax(this.#goodSquareLength, MAX_DIM, MAX_ERROR, 0);
  28283. const maxArea = this.MAX_AREA = this.#goodSquareLength ** 2;
  28284. return area > maxArea;
  28285. }
  28286. static get MAX_DIM() {
  28287. return shadow(this, "MAX_DIM", this._guessMax(MIN_IMAGE_DIM, MAX_IMAGE_DIM, 0, 1));
  28288. }
  28289. static get MAX_AREA() {
  28290. this._hasMaxArea = true;
  28291. return shadow(this, "MAX_AREA", this._guessMax(this.#goodSquareLength, this.MAX_DIM, MAX_ERROR, 0) ** 2);
  28292. }
  28293. static set MAX_AREA(area) {
  28294. if (area >= 0) {
  28295. this._hasMaxArea = true;
  28296. shadow(this, "MAX_AREA", area);
  28297. }
  28298. }
  28299. static setOptions({
  28300. canvasMaxAreaInBytes = -1,
  28301. isImageDecoderSupported = false
  28302. }) {
  28303. if (!this._hasMaxArea) {
  28304. this.MAX_AREA = canvasMaxAreaInBytes >> 2;
  28305. }
  28306. this.#isImageDecoderSupported = isImageDecoderSupported;
  28307. }
  28308. static _areGoodDims(width, height) {
  28309. try {
  28310. const canvas = new OffscreenCanvas(width, height);
  28311. const ctx = canvas.getContext("2d");
  28312. ctx.fillRect(0, 0, 1, 1);
  28313. const opacity = ctx.getImageData(0, 0, 1, 1).data[3];
  28314. canvas.width = canvas.height = 1;
  28315. return opacity !== 0;
  28316. } catch {
  28317. return false;
  28318. }
  28319. }
  28320. static _guessMax(start, end, tolerance, defaultHeight) {
  28321. while (start + tolerance + 1 < end) {
  28322. const middle = Math.floor((start + end) / 2);
  28323. const height = defaultHeight || middle;
  28324. if (this._areGoodDims(middle, height)) {
  28325. start = middle;
  28326. } else {
  28327. end = middle;
  28328. }
  28329. }
  28330. return start;
  28331. }
  28332. static async createImage(imgData, isMask = false) {
  28333. return new ImageResizer(imgData, isMask)._createImage();
  28334. }
  28335. async _createImage() {
  28336. const {
  28337. _imgData: imgData
  28338. } = this;
  28339. const {
  28340. width,
  28341. height
  28342. } = imgData;
  28343. if (width * height * 4 > MAX_INT_32) {
  28344. const result = this.#rescaleImageData();
  28345. if (result) {
  28346. return result;
  28347. }
  28348. }
  28349. const data = this._encodeBMP();
  28350. let decoder, imagePromise;
  28351. if (await ImageResizer.canUseImageDecoder) {
  28352. decoder = new ImageDecoder({
  28353. data,
  28354. type: "image/bmp",
  28355. preferAnimation: false,
  28356. transfer: [data.buffer]
  28357. });
  28358. imagePromise = decoder.decode().catch(reason => {
  28359. warn(`BMP image decoding failed: ${reason}`);
  28360. return createImageBitmap(new Blob([this._encodeBMP().buffer], {
  28361. type: "image/bmp"
  28362. }));
  28363. }).finally(() => {
  28364. decoder.close();
  28365. });
  28366. } else {
  28367. imagePromise = createImageBitmap(new Blob([data.buffer], {
  28368. type: "image/bmp"
  28369. }));
  28370. }
  28371. const {
  28372. MAX_AREA,
  28373. MAX_DIM
  28374. } = ImageResizer;
  28375. const minFactor = Math.max(width / MAX_DIM, height / MAX_DIM, Math.sqrt(width * height / MAX_AREA));
  28376. const firstFactor = Math.max(minFactor, 2);
  28377. const factor = Math.round(10 * (minFactor + 1.25)) / 10 / firstFactor;
  28378. const N = Math.floor(Math.log2(factor));
  28379. const steps = new Array(N + 2).fill(2);
  28380. steps[0] = firstFactor;
  28381. steps.splice(-1, 1, factor / (1 << N));
  28382. let newWidth = width;
  28383. let newHeight = height;
  28384. const result = await imagePromise;
  28385. let bitmap = result.image || result;
  28386. for (const step of steps) {
  28387. const prevWidth = newWidth;
  28388. const prevHeight = newHeight;
  28389. newWidth = Math.floor(newWidth / step) - 1;
  28390. newHeight = Math.floor(newHeight / step) - 1;
  28391. const canvas = new OffscreenCanvas(newWidth, newHeight);
  28392. const ctx = canvas.getContext("2d");
  28393. ctx.drawImage(bitmap, 0, 0, prevWidth, prevHeight, 0, 0, newWidth, newHeight);
  28394. bitmap.close();
  28395. bitmap = canvas.transferToImageBitmap();
  28396. }
  28397. imgData.data = null;
  28398. imgData.bitmap = bitmap;
  28399. imgData.width = newWidth;
  28400. imgData.height = newHeight;
  28401. return imgData;
  28402. }
  28403. #rescaleImageData() {
  28404. const {
  28405. _imgData: imgData
  28406. } = this;
  28407. const {
  28408. data,
  28409. width,
  28410. height,
  28411. kind
  28412. } = imgData;
  28413. const rgbaSize = width * height * 4;
  28414. const K = Math.ceil(Math.log2(rgbaSize / MAX_INT_32));
  28415. const newWidth = width >> K;
  28416. const newHeight = height >> K;
  28417. let rgbaData;
  28418. let maxHeight = height;
  28419. try {
  28420. rgbaData = new Uint8Array(rgbaSize);
  28421. } catch {
  28422. let n = Math.floor(Math.log2(rgbaSize + 1));
  28423. while (true) {
  28424. try {
  28425. rgbaData = new Uint8Array(2 ** n - 1);
  28426. break;
  28427. } catch {
  28428. n -= 1;
  28429. }
  28430. }
  28431. maxHeight = Math.floor((2 ** n - 1) / (width * 4));
  28432. const newSize = width * maxHeight * 4;
  28433. if (newSize < rgbaData.length) {
  28434. rgbaData = new Uint8Array(newSize);
  28435. }
  28436. }
  28437. const src32 = new Uint32Array(rgbaData.buffer);
  28438. const dest32 = new Uint32Array(newWidth * newHeight);
  28439. let srcPos = 0;
  28440. let newIndex = 0;
  28441. const step = Math.ceil(height / maxHeight);
  28442. const remainder = height % maxHeight === 0 ? height : height % maxHeight;
  28443. for (let k = 0; k < step; k++) {
  28444. const h = k < step - 1 ? maxHeight : remainder;
  28445. ({
  28446. srcPos
  28447. } = convertToRGBA({
  28448. kind,
  28449. src: data,
  28450. dest: src32,
  28451. width,
  28452. height: h,
  28453. inverseDecode: this._isMask,
  28454. srcPos
  28455. }));
  28456. for (let i = 0, ii = h >> K; i < ii; i++) {
  28457. const buf = src32.subarray((i << K) * width);
  28458. for (let j = 0; j < newWidth; j++) {
  28459. dest32[newIndex++] = buf[j << K];
  28460. }
  28461. }
  28462. }
  28463. if (ImageResizer.needsToBeResized(newWidth, newHeight)) {
  28464. imgData.data = dest32;
  28465. imgData.width = newWidth;
  28466. imgData.height = newHeight;
  28467. imgData.kind = ImageKind.RGBA_32BPP;
  28468. return null;
  28469. }
  28470. const canvas = new OffscreenCanvas(newWidth, newHeight);
  28471. const ctx = canvas.getContext("2d", {
  28472. willReadFrequently: true
  28473. });
  28474. ctx.putImageData(new ImageData(new Uint8ClampedArray(dest32.buffer), newWidth, newHeight), 0, 0);
  28475. imgData.data = null;
  28476. imgData.bitmap = canvas.transferToImageBitmap();
  28477. imgData.width = newWidth;
  28478. imgData.height = newHeight;
  28479. return imgData;
  28480. }
  28481. _encodeBMP() {
  28482. const {
  28483. width,
  28484. height,
  28485. kind
  28486. } = this._imgData;
  28487. let data = this._imgData.data;
  28488. let bitPerPixel;
  28489. let colorTable = new Uint8Array(0);
  28490. let maskTable = colorTable;
  28491. let compression = 0;
  28492. switch (kind) {
  28493. case ImageKind.GRAYSCALE_1BPP:
  28494. {
  28495. bitPerPixel = 1;
  28496. colorTable = new Uint8Array(this._isMask ? [255, 255, 255, 255, 0, 0, 0, 0] : [0, 0, 0, 0, 255, 255, 255, 255]);
  28497. const rowLen = width + 7 >> 3;
  28498. const rowSize = rowLen + 3 & -4;
  28499. if (rowLen !== rowSize) {
  28500. const newData = new Uint8Array(rowSize * height);
  28501. let k = 0;
  28502. for (let i = 0, ii = height * rowLen; i < ii; i += rowLen, k += rowSize) {
  28503. newData.set(data.subarray(i, i + rowLen), k);
  28504. }
  28505. data = newData;
  28506. }
  28507. break;
  28508. }
  28509. case ImageKind.RGB_24BPP:
  28510. {
  28511. bitPerPixel = 24;
  28512. if (width & 3) {
  28513. const rowLen = 3 * width;
  28514. const rowSize = rowLen + 3 & -4;
  28515. const extraLen = rowSize - rowLen;
  28516. const newData = new Uint8Array(rowSize * height);
  28517. let k = 0;
  28518. for (let i = 0, ii = height * rowLen; i < ii; i += rowLen) {
  28519. const row = data.subarray(i, i + rowLen);
  28520. for (let j = 0; j < rowLen; j += 3) {
  28521. newData[k++] = row[j + 2];
  28522. newData[k++] = row[j + 1];
  28523. newData[k++] = row[j];
  28524. }
  28525. k += extraLen;
  28526. }
  28527. data = newData;
  28528. } else {
  28529. for (let i = 0, ii = data.length; i < ii; i += 3) {
  28530. const tmp = data[i];
  28531. data[i] = data[i + 2];
  28532. data[i + 2] = tmp;
  28533. }
  28534. }
  28535. break;
  28536. }
  28537. case ImageKind.RGBA_32BPP:
  28538. bitPerPixel = 32;
  28539. compression = 3;
  28540. maskTable = new Uint8Array(4 + 4 + 4 + 4 + 52);
  28541. const view = new DataView(maskTable.buffer);
  28542. if (FeatureTest.isLittleEndian) {
  28543. view.setUint32(0, 0x000000ff, true);
  28544. view.setUint32(4, 0x0000ff00, true);
  28545. view.setUint32(8, 0x00ff0000, true);
  28546. view.setUint32(12, 0xff000000, true);
  28547. } else {
  28548. view.setUint32(0, 0xff000000, true);
  28549. view.setUint32(4, 0x00ff0000, true);
  28550. view.setUint32(8, 0x0000ff00, true);
  28551. view.setUint32(12, 0x000000ff, true);
  28552. }
  28553. break;
  28554. default:
  28555. throw new Error("invalid format");
  28556. }
  28557. let i = 0;
  28558. const headerLength = 40 + maskTable.length;
  28559. const fileLength = 14 + headerLength + colorTable.length + data.length;
  28560. const bmpData = new Uint8Array(fileLength);
  28561. const view = new DataView(bmpData.buffer);
  28562. view.setUint16(i, 0x4d42, true);
  28563. i += 2;
  28564. view.setUint32(i, fileLength, true);
  28565. i += 4;
  28566. view.setUint32(i, 0, true);
  28567. i += 4;
  28568. view.setUint32(i, 14 + headerLength + colorTable.length, true);
  28569. i += 4;
  28570. view.setUint32(i, headerLength, true);
  28571. i += 4;
  28572. view.setInt32(i, width, true);
  28573. i += 4;
  28574. view.setInt32(i, -height, true);
  28575. i += 4;
  28576. view.setUint16(i, 1, true);
  28577. i += 2;
  28578. view.setUint16(i, bitPerPixel, true);
  28579. i += 2;
  28580. view.setUint32(i, compression, true);
  28581. i += 4;
  28582. view.setUint32(i, 0, true);
  28583. i += 4;
  28584. view.setInt32(i, 0, true);
  28585. i += 4;
  28586. view.setInt32(i, 0, true);
  28587. i += 4;
  28588. view.setUint32(i, colorTable.length / 4, true);
  28589. i += 4;
  28590. view.setUint32(i, 0, true);
  28591. i += 4;
  28592. bmpData.set(maskTable, i);
  28593. i += maskTable.length;
  28594. bmpData.set(colorTable, i);
  28595. i += colorTable.length;
  28596. bmpData.set(data, i);
  28597. return bmpData;
  28598. }
  28599. }
  28600. ;// ./src/shared/murmurhash3.js
  28601. const SEED = 0xc3d2e1f0;
  28602. const MASK_HIGH = 0xffff0000;
  28603. const MASK_LOW = 0xffff;
  28604. class MurmurHash3_64 {
  28605. constructor(seed) {
  28606. this.h1 = seed ? seed & 0xffffffff : SEED;
  28607. this.h2 = seed ? seed & 0xffffffff : SEED;
  28608. }
  28609. update(input) {
  28610. let data, length;
  28611. if (typeof input === "string") {
  28612. data = new Uint8Array(input.length * 2);
  28613. length = 0;
  28614. for (let i = 0, ii = input.length; i < ii; i++) {
  28615. const code = input.charCodeAt(i);
  28616. if (code <= 0xff) {
  28617. data[length++] = code;
  28618. } else {
  28619. data[length++] = code >>> 8;
  28620. data[length++] = code & 0xff;
  28621. }
  28622. }
  28623. } else if (ArrayBuffer.isView(input)) {
  28624. data = input.slice();
  28625. length = data.byteLength;
  28626. } else {
  28627. throw new Error("Invalid data format, must be a string or TypedArray.");
  28628. }
  28629. const blockCounts = length >> 2;
  28630. const tailLength = length - blockCounts * 4;
  28631. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  28632. let k1 = 0,
  28633. k2 = 0;
  28634. let h1 = this.h1,
  28635. h2 = this.h2;
  28636. const C1 = 0xcc9e2d51,
  28637. C2 = 0x1b873593;
  28638. const C1_LOW = C1 & MASK_LOW,
  28639. C2_LOW = C2 & MASK_LOW;
  28640. for (let i = 0; i < blockCounts; i++) {
  28641. if (i & 1) {
  28642. k1 = dataUint32[i];
  28643. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  28644. k1 = k1 << 15 | k1 >>> 17;
  28645. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  28646. h1 ^= k1;
  28647. h1 = h1 << 13 | h1 >>> 19;
  28648. h1 = h1 * 5 + 0xe6546b64;
  28649. } else {
  28650. k2 = dataUint32[i];
  28651. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  28652. k2 = k2 << 15 | k2 >>> 17;
  28653. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  28654. h2 ^= k2;
  28655. h2 = h2 << 13 | h2 >>> 19;
  28656. h2 = h2 * 5 + 0xe6546b64;
  28657. }
  28658. }
  28659. k1 = 0;
  28660. switch (tailLength) {
  28661. case 3:
  28662. k1 ^= data[blockCounts * 4 + 2] << 16;
  28663. case 2:
  28664. k1 ^= data[blockCounts * 4 + 1] << 8;
  28665. case 1:
  28666. k1 ^= data[blockCounts * 4];
  28667. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  28668. k1 = k1 << 15 | k1 >>> 17;
  28669. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  28670. if (blockCounts & 1) {
  28671. h1 ^= k1;
  28672. } else {
  28673. h2 ^= k1;
  28674. }
  28675. }
  28676. this.h1 = h1;
  28677. this.h2 = h2;
  28678. }
  28679. hexdigest() {
  28680. let h1 = this.h1,
  28681. h2 = this.h2;
  28682. h1 ^= h2 >>> 1;
  28683. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  28684. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  28685. h1 ^= h2 >>> 1;
  28686. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  28687. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  28688. h1 ^= h2 >>> 1;
  28689. return (h1 >>> 0).toString(16).padStart(8, "0") + (h2 >>> 0).toString(16).padStart(8, "0");
  28690. }
  28691. }
  28692. ;// ./src/core/operator_list.js
  28693. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  28694. let state = parentState;
  28695. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  28696. const item = pattern[i];
  28697. state = state[item] ||= [];
  28698. }
  28699. state[pattern.at(-1)] = {
  28700. checkFn,
  28701. iterateFn,
  28702. processFn
  28703. };
  28704. }
  28705. const InitialState = [];
  28706. addState(InitialState, [OPS.save, OPS.transform, OPS.paintInlineImageXObject, OPS.restore], null, function iterateInlineImageGroup(context, i) {
  28707. const fnArray = context.fnArray;
  28708. const iFirstSave = context.iCurr - 3;
  28709. const pos = (i - iFirstSave) % 4;
  28710. switch (pos) {
  28711. case 0:
  28712. return fnArray[i] === OPS.save;
  28713. case 1:
  28714. return fnArray[i] === OPS.transform;
  28715. case 2:
  28716. return fnArray[i] === OPS.paintInlineImageXObject;
  28717. case 3:
  28718. return fnArray[i] === OPS.restore;
  28719. }
  28720. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  28721. }, function foundInlineImageGroup(context, i) {
  28722. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  28723. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  28724. const MAX_WIDTH = 1000;
  28725. const IMAGE_PADDING = 1;
  28726. const fnArray = context.fnArray,
  28727. argsArray = context.argsArray;
  28728. const curr = context.iCurr;
  28729. const iFirstSave = curr - 3;
  28730. const iFirstTransform = curr - 2;
  28731. const iFirstPIIXO = curr - 1;
  28732. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  28733. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  28734. return i - (i - iFirstSave) % 4;
  28735. }
  28736. let maxX = 0;
  28737. const map = [];
  28738. let maxLineHeight = 0;
  28739. let currentX = IMAGE_PADDING,
  28740. currentY = IMAGE_PADDING;
  28741. for (let q = 0; q < count; q++) {
  28742. const transform = argsArray[iFirstTransform + (q << 2)];
  28743. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  28744. if (currentX + img.width > MAX_WIDTH) {
  28745. maxX = Math.max(maxX, currentX);
  28746. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  28747. currentX = 0;
  28748. maxLineHeight = 0;
  28749. }
  28750. map.push({
  28751. transform,
  28752. x: currentX,
  28753. y: currentY,
  28754. w: img.width,
  28755. h: img.height
  28756. });
  28757. currentX += img.width + 2 * IMAGE_PADDING;
  28758. maxLineHeight = Math.max(maxLineHeight, img.height);
  28759. }
  28760. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  28761. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  28762. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  28763. const imgRowSize = imgWidth << 2;
  28764. for (let q = 0; q < count; q++) {
  28765. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  28766. const rowSize = map[q].w << 2;
  28767. let dataOffset = 0;
  28768. let offset = map[q].x + map[q].y * imgWidth << 2;
  28769. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  28770. for (let k = 0, kk = map[q].h; k < kk; k++) {
  28771. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  28772. dataOffset += rowSize;
  28773. offset += imgRowSize;
  28774. }
  28775. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  28776. while (offset >= 0) {
  28777. data[offset - 4] = data[offset];
  28778. data[offset - 3] = data[offset + 1];
  28779. data[offset - 2] = data[offset + 2];
  28780. data[offset - 1] = data[offset + 3];
  28781. data[offset + rowSize] = data[offset + rowSize - 4];
  28782. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  28783. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  28784. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  28785. offset -= imgRowSize;
  28786. }
  28787. }
  28788. const img = {
  28789. width: imgWidth,
  28790. height: imgHeight
  28791. };
  28792. if (context.isOffscreenCanvasSupported) {
  28793. const canvas = new OffscreenCanvas(imgWidth, imgHeight);
  28794. const ctx = canvas.getContext("2d");
  28795. ctx.putImageData(new ImageData(new Uint8ClampedArray(imgData.buffer), imgWidth, imgHeight), 0, 0);
  28796. img.bitmap = canvas.transferToImageBitmap();
  28797. img.data = null;
  28798. } else {
  28799. img.kind = ImageKind.RGBA_32BPP;
  28800. img.data = imgData;
  28801. }
  28802. fnArray.splice(iFirstSave, count * 4, OPS.paintInlineImageXObjectGroup);
  28803. argsArray.splice(iFirstSave, count * 4, [img, map]);
  28804. return iFirstSave + 1;
  28805. });
  28806. addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageMaskXObject, OPS.restore], null, function iterateImageMaskGroup(context, i) {
  28807. const fnArray = context.fnArray;
  28808. const iFirstSave = context.iCurr - 3;
  28809. const pos = (i - iFirstSave) % 4;
  28810. switch (pos) {
  28811. case 0:
  28812. return fnArray[i] === OPS.save;
  28813. case 1:
  28814. return fnArray[i] === OPS.transform;
  28815. case 2:
  28816. return fnArray[i] === OPS.paintImageMaskXObject;
  28817. case 3:
  28818. return fnArray[i] === OPS.restore;
  28819. }
  28820. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  28821. }, function foundImageMaskGroup(context, i) {
  28822. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  28823. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  28824. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  28825. const fnArray = context.fnArray,
  28826. argsArray = context.argsArray;
  28827. const curr = context.iCurr;
  28828. const iFirstSave = curr - 3;
  28829. const iFirstTransform = curr - 2;
  28830. const iFirstPIMXO = curr - 1;
  28831. let count = Math.floor((i - iFirstSave) / 4);
  28832. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  28833. return i - (i - iFirstSave) % 4;
  28834. }
  28835. let isSameImage = false;
  28836. let iTransform, transformArgs;
  28837. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  28838. const firstTransformArg0 = argsArray[iFirstTransform][0],
  28839. firstTransformArg1 = argsArray[iFirstTransform][1],
  28840. firstTransformArg2 = argsArray[iFirstTransform][2],
  28841. firstTransformArg3 = argsArray[iFirstTransform][3];
  28842. if (firstTransformArg1 === firstTransformArg2) {
  28843. isSameImage = true;
  28844. iTransform = iFirstTransform + 4;
  28845. let iPIMXO = iFirstPIMXO + 4;
  28846. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  28847. transformArgs = argsArray[iTransform];
  28848. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  28849. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  28850. isSameImage = false;
  28851. } else {
  28852. count = q;
  28853. }
  28854. break;
  28855. }
  28856. }
  28857. }
  28858. if (isSameImage) {
  28859. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  28860. const positions = new Float32Array(count * 2);
  28861. iTransform = iFirstTransform;
  28862. for (let q = 0; q < count; q++, iTransform += 4) {
  28863. transformArgs = argsArray[iTransform];
  28864. positions[q << 1] = transformArgs[4];
  28865. positions[(q << 1) + 1] = transformArgs[5];
  28866. }
  28867. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectRepeat);
  28868. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  28869. } else {
  28870. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  28871. const images = [];
  28872. for (let q = 0; q < count; q++) {
  28873. transformArgs = argsArray[iFirstTransform + (q << 2)];
  28874. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  28875. images.push({
  28876. data: maskParams.data,
  28877. width: maskParams.width,
  28878. height: maskParams.height,
  28879. interpolate: maskParams.interpolate,
  28880. count: maskParams.count,
  28881. transform: transformArgs
  28882. });
  28883. }
  28884. fnArray.splice(iFirstSave, count * 4, OPS.paintImageMaskXObjectGroup);
  28885. argsArray.splice(iFirstSave, count * 4, [images]);
  28886. }
  28887. return iFirstSave + 1;
  28888. });
  28889. addState(InitialState, [OPS.save, OPS.transform, OPS.paintImageXObject, OPS.restore], function (context) {
  28890. const argsArray = context.argsArray;
  28891. const iFirstTransform = context.iCurr - 2;
  28892. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  28893. }, function iterateImageGroup(context, i) {
  28894. const fnArray = context.fnArray,
  28895. argsArray = context.argsArray;
  28896. const iFirstSave = context.iCurr - 3;
  28897. const pos = (i - iFirstSave) % 4;
  28898. switch (pos) {
  28899. case 0:
  28900. return fnArray[i] === OPS.save;
  28901. case 1:
  28902. if (fnArray[i] !== OPS.transform) {
  28903. return false;
  28904. }
  28905. const iFirstTransform = context.iCurr - 2;
  28906. const firstTransformArg0 = argsArray[iFirstTransform][0];
  28907. const firstTransformArg3 = argsArray[iFirstTransform][3];
  28908. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  28909. return false;
  28910. }
  28911. return true;
  28912. case 2:
  28913. if (fnArray[i] !== OPS.paintImageXObject) {
  28914. return false;
  28915. }
  28916. const iFirstPIXO = context.iCurr - 1;
  28917. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28918. if (argsArray[i][0] !== firstPIXOArg0) {
  28919. return false;
  28920. }
  28921. return true;
  28922. case 3:
  28923. return fnArray[i] === OPS.restore;
  28924. }
  28925. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  28926. }, function (context, i) {
  28927. const MIN_IMAGES_IN_BLOCK = 3;
  28928. const MAX_IMAGES_IN_BLOCK = 1000;
  28929. const fnArray = context.fnArray,
  28930. argsArray = context.argsArray;
  28931. const curr = context.iCurr;
  28932. const iFirstSave = curr - 3;
  28933. const iFirstTransform = curr - 2;
  28934. const iFirstPIXO = curr - 1;
  28935. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  28936. const firstTransformArg0 = argsArray[iFirstTransform][0];
  28937. const firstTransformArg3 = argsArray[iFirstTransform][3];
  28938. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  28939. if (count < MIN_IMAGES_IN_BLOCK) {
  28940. return i - (i - iFirstSave) % 4;
  28941. }
  28942. const positions = new Float32Array(count * 2);
  28943. let iTransform = iFirstTransform;
  28944. for (let q = 0; q < count; q++, iTransform += 4) {
  28945. const transformArgs = argsArray[iTransform];
  28946. positions[q << 1] = transformArgs[4];
  28947. positions[(q << 1) + 1] = transformArgs[5];
  28948. }
  28949. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  28950. fnArray.splice(iFirstSave, count * 4, OPS.paintImageXObjectRepeat);
  28951. argsArray.splice(iFirstSave, count * 4, args);
  28952. return iFirstSave + 1;
  28953. });
  28954. addState(InitialState, [OPS.beginText, OPS.setFont, OPS.setTextMatrix, OPS.showText, OPS.endText], null, function iterateShowTextGroup(context, i) {
  28955. const fnArray = context.fnArray,
  28956. argsArray = context.argsArray;
  28957. const iFirstSave = context.iCurr - 4;
  28958. const pos = (i - iFirstSave) % 5;
  28959. switch (pos) {
  28960. case 0:
  28961. return fnArray[i] === OPS.beginText;
  28962. case 1:
  28963. return fnArray[i] === OPS.setFont;
  28964. case 2:
  28965. return fnArray[i] === OPS.setTextMatrix;
  28966. case 3:
  28967. if (fnArray[i] !== OPS.showText) {
  28968. return false;
  28969. }
  28970. const iFirstSetFont = context.iCurr - 3;
  28971. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28972. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28973. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  28974. return false;
  28975. }
  28976. return true;
  28977. case 4:
  28978. return fnArray[i] === OPS.endText;
  28979. }
  28980. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  28981. }, function (context, i) {
  28982. const MIN_CHARS_IN_BLOCK = 3;
  28983. const MAX_CHARS_IN_BLOCK = 1000;
  28984. const fnArray = context.fnArray,
  28985. argsArray = context.argsArray;
  28986. const curr = context.iCurr;
  28987. const iFirstBeginText = curr - 4;
  28988. const iFirstSetFont = curr - 3;
  28989. const iFirstSetTextMatrix = curr - 2;
  28990. const iFirstShowText = curr - 1;
  28991. const iFirstEndText = curr;
  28992. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  28993. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  28994. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  28995. if (count < MIN_CHARS_IN_BLOCK) {
  28996. return i - (i - iFirstBeginText) % 5;
  28997. }
  28998. let iFirst = iFirstBeginText;
  28999. if (iFirstBeginText >= 4 && fnArray[iFirstBeginText - 4] === fnArray[iFirstSetFont] && fnArray[iFirstBeginText - 3] === fnArray[iFirstSetTextMatrix] && fnArray[iFirstBeginText - 2] === fnArray[iFirstShowText] && fnArray[iFirstBeginText - 1] === fnArray[iFirstEndText] && argsArray[iFirstBeginText - 4][0] === firstSetFontArg0 && argsArray[iFirstBeginText - 4][1] === firstSetFontArg1) {
  29000. count++;
  29001. iFirst -= 5;
  29002. }
  29003. let iEndText = iFirst + 4;
  29004. for (let q = 1; q < count; q++) {
  29005. fnArray.splice(iEndText, 3);
  29006. argsArray.splice(iEndText, 3);
  29007. iEndText += 2;
  29008. }
  29009. return iEndText + 1;
  29010. });
  29011. class NullOptimizer {
  29012. constructor(queue) {
  29013. this.queue = queue;
  29014. }
  29015. _optimize() {}
  29016. push(fn, args) {
  29017. this.queue.fnArray.push(fn);
  29018. this.queue.argsArray.push(args);
  29019. this._optimize();
  29020. }
  29021. flush() {}
  29022. reset() {}
  29023. }
  29024. class QueueOptimizer extends NullOptimizer {
  29025. constructor(queue) {
  29026. super(queue);
  29027. this.state = null;
  29028. this.context = {
  29029. iCurr: 0,
  29030. fnArray: queue.fnArray,
  29031. argsArray: queue.argsArray,
  29032. isOffscreenCanvasSupported: false
  29033. };
  29034. this.match = null;
  29035. this.lastProcessed = 0;
  29036. }
  29037. set isOffscreenCanvasSupported(value) {
  29038. this.context.isOffscreenCanvasSupported = value;
  29039. }
  29040. _optimize() {
  29041. const fnArray = this.queue.fnArray;
  29042. let i = this.lastProcessed,
  29043. ii = fnArray.length;
  29044. let state = this.state;
  29045. let match = this.match;
  29046. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  29047. this.lastProcessed = ii;
  29048. return;
  29049. }
  29050. const context = this.context;
  29051. while (i < ii) {
  29052. if (match) {
  29053. const iterate = (0, match.iterateFn)(context, i);
  29054. if (iterate) {
  29055. i++;
  29056. continue;
  29057. }
  29058. i = (0, match.processFn)(context, i + 1);
  29059. ii = fnArray.length;
  29060. match = null;
  29061. state = null;
  29062. if (i >= ii) {
  29063. break;
  29064. }
  29065. }
  29066. state = (state || InitialState)[fnArray[i]];
  29067. if (!state || Array.isArray(state)) {
  29068. i++;
  29069. continue;
  29070. }
  29071. context.iCurr = i;
  29072. i++;
  29073. if (state.checkFn && !(0, state.checkFn)(context)) {
  29074. state = null;
  29075. continue;
  29076. }
  29077. match = state;
  29078. state = null;
  29079. }
  29080. this.state = state;
  29081. this.match = match;
  29082. this.lastProcessed = i;
  29083. }
  29084. flush() {
  29085. while (this.match) {
  29086. const length = this.queue.fnArray.length;
  29087. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  29088. this.match = null;
  29089. this.state = null;
  29090. this._optimize();
  29091. }
  29092. }
  29093. reset() {
  29094. this.state = null;
  29095. this.match = null;
  29096. this.lastProcessed = 0;
  29097. }
  29098. }
  29099. class OperatorList {
  29100. static CHUNK_SIZE = 1000;
  29101. static CHUNK_SIZE_ABOUT = this.CHUNK_SIZE - 5;
  29102. constructor(intent = 0, streamSink) {
  29103. this._streamSink = streamSink;
  29104. this.fnArray = [];
  29105. this.argsArray = [];
  29106. this.optimizer = streamSink && !(intent & RenderingIntentFlag.OPLIST) ? new QueueOptimizer(this) : new NullOptimizer(this);
  29107. this.dependencies = new Set();
  29108. this._totalLength = 0;
  29109. this.weight = 0;
  29110. this._resolved = streamSink ? null : Promise.resolve();
  29111. }
  29112. set isOffscreenCanvasSupported(value) {
  29113. this.optimizer.isOffscreenCanvasSupported = value;
  29114. }
  29115. get length() {
  29116. return this.argsArray.length;
  29117. }
  29118. get ready() {
  29119. return this._resolved || this._streamSink.ready;
  29120. }
  29121. get totalLength() {
  29122. return this._totalLength + this.length;
  29123. }
  29124. addOp(fn, args) {
  29125. this.optimizer.push(fn, args);
  29126. this.weight++;
  29127. if (this._streamSink) {
  29128. if (this.weight >= OperatorList.CHUNK_SIZE) {
  29129. this.flush();
  29130. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === OPS.restore || fn === OPS.endText)) {
  29131. this.flush();
  29132. }
  29133. }
  29134. }
  29135. addImageOps(fn, args, optionalContent, hasMask = false) {
  29136. if (hasMask) {
  29137. this.addOp(OPS.save);
  29138. this.addOp(OPS.setGState, [[["SMask", false]]]);
  29139. }
  29140. if (optionalContent !== undefined) {
  29141. this.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  29142. }
  29143. this.addOp(fn, args);
  29144. if (optionalContent !== undefined) {
  29145. this.addOp(OPS.endMarkedContent, []);
  29146. }
  29147. if (hasMask) {
  29148. this.addOp(OPS.restore);
  29149. }
  29150. }
  29151. addDependency(dependency) {
  29152. if (this.dependencies.has(dependency)) {
  29153. return;
  29154. }
  29155. this.dependencies.add(dependency);
  29156. this.addOp(OPS.dependency, [dependency]);
  29157. }
  29158. addDependencies(dependencies) {
  29159. for (const dependency of dependencies) {
  29160. this.addDependency(dependency);
  29161. }
  29162. }
  29163. addOpList(opList) {
  29164. if (!(opList instanceof OperatorList)) {
  29165. warn('addOpList - ignoring invalid "opList" parameter.');
  29166. return;
  29167. }
  29168. for (const dependency of opList.dependencies) {
  29169. this.dependencies.add(dependency);
  29170. }
  29171. for (let i = 0, ii = opList.length; i < ii; i++) {
  29172. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  29173. }
  29174. }
  29175. getIR() {
  29176. return {
  29177. fnArray: this.fnArray,
  29178. argsArray: this.argsArray,
  29179. length: this.length
  29180. };
  29181. }
  29182. get _transfers() {
  29183. const transfers = [];
  29184. const {
  29185. fnArray,
  29186. argsArray,
  29187. length
  29188. } = this;
  29189. for (let i = 0; i < length; i++) {
  29190. switch (fnArray[i]) {
  29191. case OPS.paintInlineImageXObject:
  29192. case OPS.paintInlineImageXObjectGroup:
  29193. case OPS.paintImageMaskXObject:
  29194. const arg = argsArray[i][0];
  29195. if (!arg.cached && arg.data?.buffer instanceof ArrayBuffer) {
  29196. transfers.push(arg.data.buffer);
  29197. }
  29198. break;
  29199. }
  29200. }
  29201. return transfers;
  29202. }
  29203. flush(lastChunk = false, separateAnnots = null) {
  29204. this.optimizer.flush();
  29205. const length = this.length;
  29206. this._totalLength += length;
  29207. this._streamSink.enqueue({
  29208. fnArray: this.fnArray,
  29209. argsArray: this.argsArray,
  29210. lastChunk,
  29211. separateAnnots,
  29212. length
  29213. }, 1, this._transfers);
  29214. this.dependencies.clear();
  29215. this.fnArray.length = 0;
  29216. this.argsArray.length = 0;
  29217. this.weight = 0;
  29218. this.optimizer.reset();
  29219. }
  29220. }
  29221. ;// ./src/core/image.js
  29222. function decodeAndClamp(value, addend, coefficient, max) {
  29223. value = addend + value * coefficient;
  29224. if (value < 0) {
  29225. value = 0;
  29226. } else if (value > max) {
  29227. value = max;
  29228. }
  29229. return value;
  29230. }
  29231. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  29232. const length = w2 * h2;
  29233. let dest;
  29234. if (bpc <= 8) {
  29235. dest = new Uint8Array(length);
  29236. } else if (bpc <= 16) {
  29237. dest = new Uint16Array(length);
  29238. } else {
  29239. dest = new Uint32Array(length);
  29240. }
  29241. const xRatio = w1 / w2;
  29242. const yRatio = h1 / h2;
  29243. let i,
  29244. j,
  29245. py,
  29246. newIndex = 0,
  29247. oldIndex;
  29248. const xScaled = new Uint16Array(w2);
  29249. const w1Scanline = w1;
  29250. for (i = 0; i < w2; i++) {
  29251. xScaled[i] = Math.floor(i * xRatio);
  29252. }
  29253. for (i = 0; i < h2; i++) {
  29254. py = Math.floor(i * yRatio) * w1Scanline;
  29255. for (j = 0; j < w2; j++) {
  29256. oldIndex = py + xScaled[j];
  29257. dest[newIndex++] = src[oldIndex];
  29258. }
  29259. }
  29260. return dest;
  29261. }
  29262. class PDFImage {
  29263. constructor({
  29264. xref,
  29265. res,
  29266. image,
  29267. isInline = false,
  29268. smask = null,
  29269. mask = null,
  29270. isMask = false,
  29271. pdfFunctionFactory,
  29272. localColorSpaceCache
  29273. }) {
  29274. this.image = image;
  29275. const dict = image.dict;
  29276. const filter = dict.get("F", "Filter");
  29277. let filterName;
  29278. if (filter instanceof Name) {
  29279. filterName = filter.name;
  29280. } else if (Array.isArray(filter)) {
  29281. const filterZero = xref.fetchIfRef(filter[0]);
  29282. if (filterZero instanceof Name) {
  29283. filterName = filterZero.name;
  29284. }
  29285. }
  29286. switch (filterName) {
  29287. case "JPXDecode":
  29288. ({
  29289. width: image.width,
  29290. height: image.height,
  29291. componentsCount: image.numComps,
  29292. bitsPerComponent: image.bitsPerComponent
  29293. } = JpxImage.parseImageProperties(image.stream));
  29294. image.stream.reset();
  29295. this.jpxDecoderOptions = {
  29296. numComponents: 0,
  29297. isIndexedColormap: false,
  29298. smaskInData: dict.has("SMaskInData")
  29299. };
  29300. break;
  29301. case "JBIG2Decode":
  29302. image.bitsPerComponent = 1;
  29303. image.numComps = 1;
  29304. break;
  29305. }
  29306. let width = dict.get("W", "Width");
  29307. let height = dict.get("H", "Height");
  29308. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  29309. warn("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  29310. width = image.width;
  29311. height = image.height;
  29312. }
  29313. if (width < 1 || height < 1) {
  29314. throw new FormatError(`Invalid image width: ${width} or height: ${height}`);
  29315. }
  29316. this.width = width;
  29317. this.height = height;
  29318. this.interpolate = dict.get("I", "Interpolate");
  29319. this.imageMask = dict.get("IM", "ImageMask") || false;
  29320. this.matte = dict.get("Matte") || false;
  29321. let bitsPerComponent = image.bitsPerComponent;
  29322. if (!bitsPerComponent) {
  29323. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  29324. if (!bitsPerComponent) {
  29325. if (this.imageMask) {
  29326. bitsPerComponent = 1;
  29327. } else {
  29328. throw new FormatError(`Bits per component missing in image: ${this.imageMask}`);
  29329. }
  29330. }
  29331. }
  29332. this.bpc = bitsPerComponent;
  29333. if (!this.imageMask) {
  29334. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  29335. const hasColorSpace = !!colorSpace;
  29336. if (!hasColorSpace) {
  29337. if (this.jpxDecoderOptions) {
  29338. colorSpace = Name.get("DeviceRGBA");
  29339. } else {
  29340. switch (image.numComps) {
  29341. case 1:
  29342. colorSpace = Name.get("DeviceGray");
  29343. break;
  29344. case 3:
  29345. colorSpace = Name.get("DeviceRGB");
  29346. break;
  29347. case 4:
  29348. colorSpace = Name.get("DeviceCMYK");
  29349. break;
  29350. default:
  29351. throw new Error(`Images with ${image.numComps} color components not supported.`);
  29352. }
  29353. }
  29354. } else if (this.jpxDecoderOptions?.smaskInData) {
  29355. colorSpace = Name.get("DeviceRGBA");
  29356. }
  29357. this.colorSpace = ColorSpace.parse({
  29358. cs: colorSpace,
  29359. xref,
  29360. resources: isInline ? res : null,
  29361. pdfFunctionFactory,
  29362. localColorSpaceCache
  29363. });
  29364. this.numComps = this.colorSpace.numComps;
  29365. if (this.jpxDecoderOptions) {
  29366. this.jpxDecoderOptions.numComponents = hasColorSpace ? this.numComp : 0;
  29367. this.jpxDecoderOptions.isIndexedColormap = this.colorSpace.name === "Indexed";
  29368. }
  29369. }
  29370. this.decode = dict.getArray("D", "Decode");
  29371. this.needsDecode = false;
  29372. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !ColorSpace.isDefaultDecode(this.decode, 1))) {
  29373. this.needsDecode = true;
  29374. const max = (1 << bitsPerComponent) - 1;
  29375. this.decodeCoefficients = [];
  29376. this.decodeAddends = [];
  29377. const isIndexed = this.colorSpace?.name === "Indexed";
  29378. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  29379. const dmin = this.decode[i];
  29380. const dmax = this.decode[i + 1];
  29381. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  29382. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  29383. }
  29384. }
  29385. if (smask) {
  29386. this.smask = new PDFImage({
  29387. xref,
  29388. res,
  29389. image: smask,
  29390. isInline,
  29391. pdfFunctionFactory,
  29392. localColorSpaceCache
  29393. });
  29394. } else if (mask) {
  29395. if (mask instanceof BaseStream) {
  29396. const maskDict = mask.dict,
  29397. imageMask = maskDict.get("IM", "ImageMask");
  29398. if (!imageMask) {
  29399. warn("Ignoring /Mask in image without /ImageMask.");
  29400. } else {
  29401. this.mask = new PDFImage({
  29402. xref,
  29403. res,
  29404. image: mask,
  29405. isInline,
  29406. isMask: true,
  29407. pdfFunctionFactory,
  29408. localColorSpaceCache
  29409. });
  29410. }
  29411. } else {
  29412. this.mask = mask;
  29413. }
  29414. }
  29415. }
  29416. static async buildImage({
  29417. xref,
  29418. res,
  29419. image,
  29420. isInline = false,
  29421. pdfFunctionFactory,
  29422. localColorSpaceCache
  29423. }) {
  29424. const imageData = image;
  29425. let smaskData = null;
  29426. let maskData = null;
  29427. const smask = image.dict.get("SMask");
  29428. const mask = image.dict.get("Mask");
  29429. if (smask) {
  29430. if (smask instanceof BaseStream) {
  29431. smaskData = smask;
  29432. } else {
  29433. warn("Unsupported /SMask format.");
  29434. }
  29435. } else if (mask) {
  29436. if (mask instanceof BaseStream || Array.isArray(mask)) {
  29437. maskData = mask;
  29438. } else {
  29439. warn("Unsupported /Mask format.");
  29440. }
  29441. }
  29442. return new PDFImage({
  29443. xref,
  29444. res,
  29445. image: imageData,
  29446. isInline,
  29447. smask: smaskData,
  29448. mask: maskData,
  29449. pdfFunctionFactory,
  29450. localColorSpaceCache
  29451. });
  29452. }
  29453. static createRawMask({
  29454. imgArray,
  29455. width,
  29456. height,
  29457. imageIsFromDecodeStream,
  29458. inverseDecode,
  29459. interpolate
  29460. }) {
  29461. const computedLength = (width + 7 >> 3) * height;
  29462. const actualLength = imgArray.byteLength;
  29463. const haveFullData = computedLength === actualLength;
  29464. let data, i;
  29465. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  29466. data = imgArray;
  29467. } else if (!inverseDecode) {
  29468. data = new Uint8Array(imgArray);
  29469. } else {
  29470. data = new Uint8Array(computedLength);
  29471. data.set(imgArray);
  29472. data.fill(0xff, actualLength);
  29473. }
  29474. if (inverseDecode) {
  29475. for (i = 0; i < actualLength; i++) {
  29476. data[i] ^= 0xff;
  29477. }
  29478. }
  29479. return {
  29480. data,
  29481. width,
  29482. height,
  29483. interpolate
  29484. };
  29485. }
  29486. static async createMask({
  29487. imgArray,
  29488. width,
  29489. height,
  29490. imageIsFromDecodeStream,
  29491. inverseDecode,
  29492. interpolate,
  29493. isOffscreenCanvasSupported = false
  29494. }) {
  29495. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  29496. if (isSingleOpaquePixel) {
  29497. return {
  29498. isSingleOpaquePixel
  29499. };
  29500. }
  29501. if (isOffscreenCanvasSupported) {
  29502. if (ImageResizer.needsToBeResized(width, height)) {
  29503. const data = new Uint8ClampedArray(width * height * 4);
  29504. convertBlackAndWhiteToRGBA({
  29505. src: imgArray,
  29506. dest: data,
  29507. width,
  29508. height,
  29509. nonBlackColor: 0,
  29510. inverseDecode
  29511. });
  29512. return ImageResizer.createImage({
  29513. kind: ImageKind.RGBA_32BPP,
  29514. data,
  29515. width,
  29516. height,
  29517. interpolate
  29518. });
  29519. }
  29520. const canvas = new OffscreenCanvas(width, height);
  29521. const ctx = canvas.getContext("2d");
  29522. const imgData = ctx.createImageData(width, height);
  29523. convertBlackAndWhiteToRGBA({
  29524. src: imgArray,
  29525. dest: imgData.data,
  29526. width,
  29527. height,
  29528. nonBlackColor: 0,
  29529. inverseDecode
  29530. });
  29531. ctx.putImageData(imgData, 0, 0);
  29532. const bitmap = canvas.transferToImageBitmap();
  29533. return {
  29534. data: null,
  29535. width,
  29536. height,
  29537. interpolate,
  29538. bitmap
  29539. };
  29540. }
  29541. return this.createRawMask({
  29542. imgArray,
  29543. width,
  29544. height,
  29545. inverseDecode,
  29546. imageIsFromDecodeStream,
  29547. interpolate
  29548. });
  29549. }
  29550. get drawWidth() {
  29551. return Math.max(this.width, this.smask?.width || 0, this.mask?.width || 0);
  29552. }
  29553. get drawHeight() {
  29554. return Math.max(this.height, this.smask?.height || 0, this.mask?.height || 0);
  29555. }
  29556. decodeBuffer(buffer) {
  29557. const bpc = this.bpc;
  29558. const numComps = this.numComps;
  29559. const decodeAddends = this.decodeAddends;
  29560. const decodeCoefficients = this.decodeCoefficients;
  29561. const max = (1 << bpc) - 1;
  29562. let i, ii;
  29563. if (bpc === 1) {
  29564. for (i = 0, ii = buffer.length; i < ii; i++) {
  29565. buffer[i] = +!buffer[i];
  29566. }
  29567. return;
  29568. }
  29569. let index = 0;
  29570. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  29571. for (let j = 0; j < numComps; j++) {
  29572. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  29573. index++;
  29574. }
  29575. }
  29576. }
  29577. getComponents(buffer) {
  29578. const bpc = this.bpc;
  29579. if (bpc === 8) {
  29580. return buffer;
  29581. }
  29582. const width = this.width;
  29583. const height = this.height;
  29584. const numComps = this.numComps;
  29585. const length = width * height * numComps;
  29586. let bufferPos = 0;
  29587. let output;
  29588. if (bpc <= 8) {
  29589. output = new Uint8Array(length);
  29590. } else if (bpc <= 16) {
  29591. output = new Uint16Array(length);
  29592. } else {
  29593. output = new Uint32Array(length);
  29594. }
  29595. const rowComps = width * numComps;
  29596. const max = (1 << bpc) - 1;
  29597. let i = 0,
  29598. ii,
  29599. buf;
  29600. if (bpc === 1) {
  29601. let mask, loop1End, loop2End;
  29602. for (let j = 0; j < height; j++) {
  29603. loop1End = i + (rowComps & ~7);
  29604. loop2End = i + rowComps;
  29605. while (i < loop1End) {
  29606. buf = buffer[bufferPos++];
  29607. output[i] = buf >> 7 & 1;
  29608. output[i + 1] = buf >> 6 & 1;
  29609. output[i + 2] = buf >> 5 & 1;
  29610. output[i + 3] = buf >> 4 & 1;
  29611. output[i + 4] = buf >> 3 & 1;
  29612. output[i + 5] = buf >> 2 & 1;
  29613. output[i + 6] = buf >> 1 & 1;
  29614. output[i + 7] = buf & 1;
  29615. i += 8;
  29616. }
  29617. if (i < loop2End) {
  29618. buf = buffer[bufferPos++];
  29619. mask = 128;
  29620. while (i < loop2End) {
  29621. output[i++] = +!!(buf & mask);
  29622. mask >>= 1;
  29623. }
  29624. }
  29625. }
  29626. } else {
  29627. let bits = 0;
  29628. buf = 0;
  29629. for (i = 0, ii = length; i < ii; ++i) {
  29630. if (i % rowComps === 0) {
  29631. buf = 0;
  29632. bits = 0;
  29633. }
  29634. while (bits < bpc) {
  29635. buf = buf << 8 | buffer[bufferPos++];
  29636. bits += 8;
  29637. }
  29638. const remainingBits = bits - bpc;
  29639. let value = buf >> remainingBits;
  29640. if (value < 0) {
  29641. value = 0;
  29642. } else if (value > max) {
  29643. value = max;
  29644. }
  29645. output[i] = value;
  29646. buf &= (1 << remainingBits) - 1;
  29647. bits = remainingBits;
  29648. }
  29649. }
  29650. return output;
  29651. }
  29652. async fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  29653. const smask = this.smask;
  29654. const mask = this.mask;
  29655. let alphaBuf, sw, sh, i, ii, j;
  29656. if (smask) {
  29657. sw = smask.width;
  29658. sh = smask.height;
  29659. alphaBuf = new Uint8ClampedArray(sw * sh);
  29660. await smask.fillGrayBuffer(alphaBuf);
  29661. if (sw !== width || sh !== height) {
  29662. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  29663. }
  29664. } else if (mask) {
  29665. if (mask instanceof PDFImage) {
  29666. sw = mask.width;
  29667. sh = mask.height;
  29668. alphaBuf = new Uint8ClampedArray(sw * sh);
  29669. mask.numComps = 1;
  29670. await mask.fillGrayBuffer(alphaBuf);
  29671. for (i = 0, ii = sw * sh; i < ii; ++i) {
  29672. alphaBuf[i] = 255 - alphaBuf[i];
  29673. }
  29674. if (sw !== width || sh !== height) {
  29675. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  29676. }
  29677. } else if (Array.isArray(mask)) {
  29678. alphaBuf = new Uint8ClampedArray(width * height);
  29679. const numComps = this.numComps;
  29680. for (i = 0, ii = width * height; i < ii; ++i) {
  29681. let opacity = 0;
  29682. const imageOffset = i * numComps;
  29683. for (j = 0; j < numComps; ++j) {
  29684. const color = image[imageOffset + j];
  29685. const maskOffset = j * 2;
  29686. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  29687. opacity = 255;
  29688. break;
  29689. }
  29690. }
  29691. alphaBuf[i] = opacity;
  29692. }
  29693. } else {
  29694. throw new FormatError("Unknown mask format.");
  29695. }
  29696. }
  29697. if (alphaBuf) {
  29698. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  29699. rgbaBuf[j] = alphaBuf[i];
  29700. }
  29701. } else {
  29702. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  29703. rgbaBuf[j] = 255;
  29704. }
  29705. }
  29706. }
  29707. undoPreblend(buffer, width, height) {
  29708. const matte = this.smask?.matte;
  29709. if (!matte) {
  29710. return;
  29711. }
  29712. const matteRgb = this.colorSpace.getRgb(matte, 0);
  29713. const matteR = matteRgb[0];
  29714. const matteG = matteRgb[1];
  29715. const matteB = matteRgb[2];
  29716. const length = width * height * 4;
  29717. for (let i = 0; i < length; i += 4) {
  29718. const alpha = buffer[i + 3];
  29719. if (alpha === 0) {
  29720. buffer[i] = 255;
  29721. buffer[i + 1] = 255;
  29722. buffer[i + 2] = 255;
  29723. continue;
  29724. }
  29725. const k = 255 / alpha;
  29726. buffer[i] = (buffer[i] - matteR) * k + matteR;
  29727. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  29728. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  29729. }
  29730. }
  29731. async createImageData(forceRGBA = false, isOffscreenCanvasSupported = false) {
  29732. const drawWidth = this.drawWidth;
  29733. const drawHeight = this.drawHeight;
  29734. const imgData = {
  29735. width: drawWidth,
  29736. height: drawHeight,
  29737. interpolate: this.interpolate,
  29738. kind: 0,
  29739. data: null
  29740. };
  29741. const numComps = this.numComps;
  29742. const originalWidth = this.width;
  29743. const originalHeight = this.height;
  29744. const bpc = this.bpc;
  29745. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  29746. const mustBeResized = isOffscreenCanvasSupported && ImageResizer.needsToBeResized(drawWidth, drawHeight);
  29747. if (!this.smask && !this.mask && this.colorSpace.name === "DeviceRGBA") {
  29748. imgData.kind = ImageKind.RGBA_32BPP;
  29749. const imgArray = imgData.data = await this.getImageBytes(originalHeight * originalWidth * 4, {});
  29750. if (isOffscreenCanvasSupported) {
  29751. if (!mustBeResized) {
  29752. return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, imgArray);
  29753. }
  29754. return ImageResizer.createImage(imgData, false);
  29755. }
  29756. return imgData;
  29757. }
  29758. if (!forceRGBA) {
  29759. let kind;
  29760. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  29761. kind = ImageKind.GRAYSCALE_1BPP;
  29762. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  29763. kind = ImageKind.RGB_24BPP;
  29764. }
  29765. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  29766. const image = await this.#getImage(originalWidth, originalHeight);
  29767. if (image) {
  29768. return image;
  29769. }
  29770. const data = await this.getImageBytes(originalHeight * rowBytes, {});
  29771. if (isOffscreenCanvasSupported) {
  29772. if (mustBeResized) {
  29773. return ImageResizer.createImage({
  29774. data,
  29775. kind,
  29776. width: drawWidth,
  29777. height: drawHeight,
  29778. interpolate: this.interpolate
  29779. }, this.needsDecode);
  29780. }
  29781. return this.createBitmap(kind, originalWidth, originalHeight, data);
  29782. }
  29783. imgData.kind = kind;
  29784. imgData.data = data;
  29785. if (this.needsDecode) {
  29786. assert(kind === ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  29787. const buffer = imgData.data;
  29788. for (let i = 0, ii = buffer.length; i < ii; i++) {
  29789. buffer[i] ^= 0xff;
  29790. }
  29791. }
  29792. return imgData;
  29793. }
  29794. if (this.image instanceof JpegStream && !this.smask && !this.mask && !this.needsDecode) {
  29795. let imageLength = originalHeight * rowBytes;
  29796. if (isOffscreenCanvasSupported && !mustBeResized) {
  29797. let isHandled = false;
  29798. switch (this.colorSpace.name) {
  29799. case "DeviceGray":
  29800. imageLength *= 4;
  29801. isHandled = true;
  29802. break;
  29803. case "DeviceRGB":
  29804. imageLength = imageLength / 3 * 4;
  29805. isHandled = true;
  29806. break;
  29807. case "DeviceCMYK":
  29808. isHandled = true;
  29809. break;
  29810. }
  29811. if (isHandled) {
  29812. const image = await this.#getImage(drawWidth, drawHeight);
  29813. if (image) {
  29814. return image;
  29815. }
  29816. const rgba = await this.getImageBytes(imageLength, {
  29817. drawWidth,
  29818. drawHeight,
  29819. forceRGBA: true
  29820. });
  29821. return this.createBitmap(ImageKind.RGBA_32BPP, drawWidth, drawHeight, rgba);
  29822. }
  29823. } else {
  29824. switch (this.colorSpace.name) {
  29825. case "DeviceGray":
  29826. imageLength *= 3;
  29827. case "DeviceRGB":
  29828. case "DeviceCMYK":
  29829. imgData.kind = ImageKind.RGB_24BPP;
  29830. imgData.data = await this.getImageBytes(imageLength, {
  29831. drawWidth,
  29832. drawHeight,
  29833. forceRGB: true
  29834. });
  29835. if (mustBeResized) {
  29836. return ImageResizer.createImage(imgData);
  29837. }
  29838. return imgData;
  29839. }
  29840. }
  29841. }
  29842. }
  29843. const imgArray = await this.getImageBytes(originalHeight * rowBytes, {
  29844. internal: true
  29845. });
  29846. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  29847. const comps = this.getComponents(imgArray);
  29848. let alpha01, maybeUndoPreblend;
  29849. let canvas, ctx, canvasImgData, data;
  29850. if (isOffscreenCanvasSupported && !mustBeResized) {
  29851. canvas = new OffscreenCanvas(drawWidth, drawHeight);
  29852. ctx = canvas.getContext("2d");
  29853. canvasImgData = ctx.createImageData(drawWidth, drawHeight);
  29854. data = canvasImgData.data;
  29855. }
  29856. imgData.kind = ImageKind.RGBA_32BPP;
  29857. if (!forceRGBA && !this.smask && !this.mask) {
  29858. if (!isOffscreenCanvasSupported || mustBeResized) {
  29859. imgData.kind = ImageKind.RGB_24BPP;
  29860. data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  29861. alpha01 = 0;
  29862. } else {
  29863. const arr = new Uint32Array(data.buffer);
  29864. arr.fill(FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff);
  29865. alpha01 = 1;
  29866. }
  29867. maybeUndoPreblend = false;
  29868. } else {
  29869. if (!isOffscreenCanvasSupported || mustBeResized) {
  29870. data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  29871. }
  29872. alpha01 = 1;
  29873. maybeUndoPreblend = true;
  29874. await this.fillOpacity(data, drawWidth, drawHeight, actualHeight, comps);
  29875. }
  29876. if (this.needsDecode) {
  29877. this.decodeBuffer(comps);
  29878. }
  29879. this.colorSpace.fillRgb(data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  29880. if (maybeUndoPreblend) {
  29881. this.undoPreblend(data, drawWidth, actualHeight);
  29882. }
  29883. if (isOffscreenCanvasSupported && !mustBeResized) {
  29884. ctx.putImageData(canvasImgData, 0, 0);
  29885. const bitmap = canvas.transferToImageBitmap();
  29886. return {
  29887. data: null,
  29888. width: drawWidth,
  29889. height: drawHeight,
  29890. bitmap,
  29891. interpolate: this.interpolate
  29892. };
  29893. }
  29894. imgData.data = data;
  29895. if (mustBeResized) {
  29896. return ImageResizer.createImage(imgData);
  29897. }
  29898. return imgData;
  29899. }
  29900. async fillGrayBuffer(buffer) {
  29901. const numComps = this.numComps;
  29902. if (numComps !== 1) {
  29903. throw new FormatError(`Reading gray scale from a color image: ${numComps}`);
  29904. }
  29905. const width = this.width;
  29906. const height = this.height;
  29907. const bpc = this.bpc;
  29908. const rowBytes = width * numComps * bpc + 7 >> 3;
  29909. const imgArray = await this.getImageBytes(height * rowBytes, {
  29910. internal: true
  29911. });
  29912. const comps = this.getComponents(imgArray);
  29913. let i, length;
  29914. if (bpc === 1) {
  29915. length = width * height;
  29916. if (this.needsDecode) {
  29917. for (i = 0; i < length; ++i) {
  29918. buffer[i] = comps[i] - 1 & 255;
  29919. }
  29920. } else {
  29921. for (i = 0; i < length; ++i) {
  29922. buffer[i] = -comps[i] & 255;
  29923. }
  29924. }
  29925. return;
  29926. }
  29927. if (this.needsDecode) {
  29928. this.decodeBuffer(comps);
  29929. }
  29930. length = width * height;
  29931. const scale = 255 / ((1 << bpc) - 1);
  29932. for (i = 0; i < length; ++i) {
  29933. buffer[i] = scale * comps[i];
  29934. }
  29935. }
  29936. createBitmap(kind, width, height, src) {
  29937. const canvas = new OffscreenCanvas(width, height);
  29938. const ctx = canvas.getContext("2d");
  29939. let imgData;
  29940. if (kind === ImageKind.RGBA_32BPP) {
  29941. imgData = new ImageData(src, width, height);
  29942. } else {
  29943. imgData = ctx.createImageData(width, height);
  29944. convertToRGBA({
  29945. kind,
  29946. src,
  29947. dest: new Uint32Array(imgData.data.buffer),
  29948. width,
  29949. height,
  29950. inverseDecode: this.needsDecode
  29951. });
  29952. }
  29953. ctx.putImageData(imgData, 0, 0);
  29954. const bitmap = canvas.transferToImageBitmap();
  29955. return {
  29956. data: null,
  29957. width,
  29958. height,
  29959. bitmap,
  29960. interpolate: this.interpolate
  29961. };
  29962. }
  29963. async #getImage(width, height) {
  29964. const bitmap = await this.image.getTransferableImage();
  29965. if (!bitmap) {
  29966. return null;
  29967. }
  29968. return {
  29969. data: null,
  29970. width,
  29971. height,
  29972. bitmap,
  29973. interpolate: this.interpolate
  29974. };
  29975. }
  29976. async getImageBytes(length, {
  29977. drawWidth,
  29978. drawHeight,
  29979. forceRGBA = false,
  29980. forceRGB = false,
  29981. internal = false
  29982. }) {
  29983. this.image.reset();
  29984. this.image.drawWidth = drawWidth || this.width;
  29985. this.image.drawHeight = drawHeight || this.height;
  29986. this.image.forceRGBA = !!forceRGBA;
  29987. this.image.forceRGB = !!forceRGB;
  29988. const imageBytes = await this.image.getImageData(length, this.jpxDecoderOptions);
  29989. if (internal || this.image instanceof DecodeStream) {
  29990. return imageBytes;
  29991. }
  29992. assert(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  29993. return new Uint8Array(imageBytes);
  29994. }
  29995. }
  29996. ;// ./src/core/evaluator.js
  29997. const DefaultPartialEvaluatorOptions = Object.freeze({
  29998. maxImageSize: -1,
  29999. disableFontFace: false,
  30000. ignoreErrors: false,
  30001. isEvalSupported: true,
  30002. isOffscreenCanvasSupported: false,
  30003. isImageDecoderSupported: false,
  30004. canvasMaxAreaInBytes: -1,
  30005. fontExtraProperties: false,
  30006. useSystemFonts: true,
  30007. cMapUrl: null,
  30008. standardFontDataUrl: null
  30009. });
  30010. const PatternType = {
  30011. TILING: 1,
  30012. SHADING: 2
  30013. };
  30014. const TEXT_CHUNK_BATCH_SIZE = 10;
  30015. const deferred = Promise.resolve();
  30016. function normalizeBlendMode(value, parsingArray = false) {
  30017. if (Array.isArray(value)) {
  30018. for (const val of value) {
  30019. const maybeBM = normalizeBlendMode(val, true);
  30020. if (maybeBM) {
  30021. return maybeBM;
  30022. }
  30023. }
  30024. warn(`Unsupported blend mode Array: ${value}`);
  30025. return "source-over";
  30026. }
  30027. if (!(value instanceof Name)) {
  30028. if (parsingArray) {
  30029. return null;
  30030. }
  30031. return "source-over";
  30032. }
  30033. switch (value.name) {
  30034. case "Normal":
  30035. case "Compatible":
  30036. return "source-over";
  30037. case "Multiply":
  30038. return "multiply";
  30039. case "Screen":
  30040. return "screen";
  30041. case "Overlay":
  30042. return "overlay";
  30043. case "Darken":
  30044. return "darken";
  30045. case "Lighten":
  30046. return "lighten";
  30047. case "ColorDodge":
  30048. return "color-dodge";
  30049. case "ColorBurn":
  30050. return "color-burn";
  30051. case "HardLight":
  30052. return "hard-light";
  30053. case "SoftLight":
  30054. return "soft-light";
  30055. case "Difference":
  30056. return "difference";
  30057. case "Exclusion":
  30058. return "exclusion";
  30059. case "Hue":
  30060. return "hue";
  30061. case "Saturation":
  30062. return "saturation";
  30063. case "Color":
  30064. return "color";
  30065. case "Luminosity":
  30066. return "luminosity";
  30067. }
  30068. if (parsingArray) {
  30069. return null;
  30070. }
  30071. warn(`Unsupported blend mode: ${value.name}`);
  30072. return "source-over";
  30073. }
  30074. function addLocallyCachedImageOps(opList, data) {
  30075. if (data.objId) {
  30076. opList.addDependency(data.objId);
  30077. }
  30078. opList.addImageOps(data.fn, data.args, data.optionalContent, data.hasMask);
  30079. if (data.fn === OPS.paintImageMaskXObject && data.args[0]?.count > 0) {
  30080. data.args[0].count++;
  30081. }
  30082. }
  30083. class TimeSlotManager {
  30084. static TIME_SLOT_DURATION_MS = 20;
  30085. static CHECK_TIME_EVERY = 100;
  30086. constructor() {
  30087. this.reset();
  30088. }
  30089. check() {
  30090. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  30091. return false;
  30092. }
  30093. this.checked = 0;
  30094. return this.endTime <= Date.now();
  30095. }
  30096. reset() {
  30097. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  30098. this.checked = 0;
  30099. }
  30100. }
  30101. class PartialEvaluator {
  30102. constructor({
  30103. xref,
  30104. handler,
  30105. pageIndex,
  30106. idFactory,
  30107. fontCache,
  30108. builtInCMapCache,
  30109. standardFontDataCache,
  30110. globalImageCache,
  30111. systemFontCache,
  30112. options = null
  30113. }) {
  30114. this.xref = xref;
  30115. this.handler = handler;
  30116. this.pageIndex = pageIndex;
  30117. this.idFactory = idFactory;
  30118. this.fontCache = fontCache;
  30119. this.builtInCMapCache = builtInCMapCache;
  30120. this.standardFontDataCache = standardFontDataCache;
  30121. this.globalImageCache = globalImageCache;
  30122. this.systemFontCache = systemFontCache;
  30123. this.options = options || DefaultPartialEvaluatorOptions;
  30124. this.type3FontRefs = null;
  30125. this._regionalImageCache = new RegionalImageCache();
  30126. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  30127. ImageResizer.setOptions(this.options);
  30128. JpegStream.setOptions(this.options);
  30129. }
  30130. get _pdfFunctionFactory() {
  30131. const pdfFunctionFactory = new PDFFunctionFactory({
  30132. xref: this.xref,
  30133. isEvalSupported: this.options.isEvalSupported
  30134. });
  30135. return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
  30136. }
  30137. get parsingType3Font() {
  30138. return !!this.type3FontRefs;
  30139. }
  30140. clone(newOptions = null) {
  30141. const newEvaluator = Object.create(this);
  30142. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  30143. return newEvaluator;
  30144. }
  30145. hasBlendModes(resources, nonBlendModesSet) {
  30146. if (!(resources instanceof Dict)) {
  30147. return false;
  30148. }
  30149. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  30150. return false;
  30151. }
  30152. const processed = new RefSet(nonBlendModesSet);
  30153. if (resources.objId) {
  30154. processed.put(resources.objId);
  30155. }
  30156. const nodes = [resources],
  30157. xref = this.xref;
  30158. while (nodes.length) {
  30159. const node = nodes.shift();
  30160. const graphicStates = node.get("ExtGState");
  30161. if (graphicStates instanceof Dict) {
  30162. for (let graphicState of graphicStates.getRawValues()) {
  30163. if (graphicState instanceof Ref) {
  30164. if (processed.has(graphicState)) {
  30165. continue;
  30166. }
  30167. try {
  30168. graphicState = xref.fetch(graphicState);
  30169. } catch (ex) {
  30170. processed.put(graphicState);
  30171. info(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  30172. continue;
  30173. }
  30174. }
  30175. if (!(graphicState instanceof Dict)) {
  30176. continue;
  30177. }
  30178. if (graphicState.objId) {
  30179. processed.put(graphicState.objId);
  30180. }
  30181. const bm = graphicState.get("BM");
  30182. if (bm instanceof Name) {
  30183. if (bm.name !== "Normal") {
  30184. return true;
  30185. }
  30186. continue;
  30187. }
  30188. if (bm !== undefined && Array.isArray(bm)) {
  30189. for (const element of bm) {
  30190. if (element instanceof Name && element.name !== "Normal") {
  30191. return true;
  30192. }
  30193. }
  30194. }
  30195. }
  30196. }
  30197. const xObjects = node.get("XObject");
  30198. if (!(xObjects instanceof Dict)) {
  30199. continue;
  30200. }
  30201. for (let xObject of xObjects.getRawValues()) {
  30202. if (xObject instanceof Ref) {
  30203. if (processed.has(xObject)) {
  30204. continue;
  30205. }
  30206. try {
  30207. xObject = xref.fetch(xObject);
  30208. } catch (ex) {
  30209. processed.put(xObject);
  30210. info(`hasBlendModes - ignoring XObject: "${ex}".`);
  30211. continue;
  30212. }
  30213. }
  30214. if (!(xObject instanceof BaseStream)) {
  30215. continue;
  30216. }
  30217. if (xObject.dict.objId) {
  30218. processed.put(xObject.dict.objId);
  30219. }
  30220. const xResources = xObject.dict.get("Resources");
  30221. if (!(xResources instanceof Dict)) {
  30222. continue;
  30223. }
  30224. if (xResources.objId && processed.has(xResources.objId)) {
  30225. continue;
  30226. }
  30227. nodes.push(xResources);
  30228. if (xResources.objId) {
  30229. processed.put(xResources.objId);
  30230. }
  30231. }
  30232. }
  30233. for (const ref of processed) {
  30234. nonBlendModesSet.put(ref);
  30235. }
  30236. return false;
  30237. }
  30238. async #fetchData(url) {
  30239. const response = await fetch(url);
  30240. if (!response.ok) {
  30241. throw new Error(`Failed to fetch file "${url}" with "${response.statusText}".`);
  30242. }
  30243. return new Uint8Array(await response.arrayBuffer());
  30244. }
  30245. async fetchBuiltInCMap(name) {
  30246. const cachedData = this.builtInCMapCache.get(name);
  30247. if (cachedData) {
  30248. return cachedData;
  30249. }
  30250. let data;
  30251. if (this.options.cMapUrl !== null) {
  30252. const cMapData = await this.#fetchData(`${this.options.cMapUrl}${name}.bcmap`);
  30253. data = {
  30254. cMapData,
  30255. isCompressed: true
  30256. };
  30257. } else {
  30258. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  30259. name
  30260. });
  30261. }
  30262. this.builtInCMapCache.set(name, data);
  30263. return data;
  30264. }
  30265. async fetchStandardFontData(name) {
  30266. const cachedData = this.standardFontDataCache.get(name);
  30267. if (cachedData) {
  30268. return new Stream(cachedData);
  30269. }
  30270. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  30271. return null;
  30272. }
  30273. const standardFontNameToFileName = getFontNameToFileMap(),
  30274. filename = standardFontNameToFileName[name];
  30275. let data;
  30276. try {
  30277. if (this.options.standardFontDataUrl !== null) {
  30278. data = await this.#fetchData(`${this.options.standardFontDataUrl}${filename}`);
  30279. } else {
  30280. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  30281. filename
  30282. });
  30283. }
  30284. } catch (ex) {
  30285. warn(ex);
  30286. return null;
  30287. }
  30288. this.standardFontDataCache.set(name, data);
  30289. return new Stream(data);
  30290. }
  30291. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  30292. const dict = xobj.dict;
  30293. const matrix = lookupMatrix(dict.getArray("Matrix"), null);
  30294. const bbox = lookupNormalRect(dict.getArray("BBox"), null);
  30295. let optionalContent, groupOptions;
  30296. if (dict.has("OC")) {
  30297. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  30298. }
  30299. if (optionalContent !== undefined) {
  30300. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  30301. }
  30302. const group = dict.get("Group");
  30303. if (group) {
  30304. groupOptions = {
  30305. matrix,
  30306. bbox,
  30307. smask,
  30308. isolated: false,
  30309. knockout: false
  30310. };
  30311. const groupSubtype = group.get("S");
  30312. let colorSpace = null;
  30313. if (isName(groupSubtype, "Transparency")) {
  30314. groupOptions.isolated = group.get("I") || false;
  30315. groupOptions.knockout = group.get("K") || false;
  30316. if (group.has("CS")) {
  30317. const cs = group.getRaw("CS");
  30318. const cachedColorSpace = ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  30319. if (cachedColorSpace) {
  30320. colorSpace = cachedColorSpace;
  30321. } else {
  30322. colorSpace = await this.parseColorSpace({
  30323. cs,
  30324. resources,
  30325. localColorSpaceCache
  30326. });
  30327. }
  30328. }
  30329. }
  30330. if (smask?.backdrop) {
  30331. colorSpace ||= ColorSpace.singletons.rgb;
  30332. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  30333. }
  30334. operatorList.addOp(OPS.beginGroup, [groupOptions]);
  30335. }
  30336. const args = group ? [matrix, null] : [matrix, bbox];
  30337. operatorList.addOp(OPS.paintFormXObjectBegin, args);
  30338. await this.getOperatorList({
  30339. stream: xobj,
  30340. task,
  30341. resources: dict.get("Resources") || resources,
  30342. operatorList,
  30343. initialState
  30344. });
  30345. operatorList.addOp(OPS.paintFormXObjectEnd, []);
  30346. if (group) {
  30347. operatorList.addOp(OPS.endGroup, [groupOptions]);
  30348. }
  30349. if (optionalContent !== undefined) {
  30350. operatorList.addOp(OPS.endMarkedContent, []);
  30351. }
  30352. }
  30353. _sendImgData(objId, imgData, cacheGlobally = false) {
  30354. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  30355. if (this.parsingType3Font || cacheGlobally) {
  30356. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  30357. }
  30358. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  30359. }
  30360. async buildPaintImageXObject({
  30361. resources,
  30362. image,
  30363. isInline = false,
  30364. operatorList,
  30365. cacheKey,
  30366. localImageCache,
  30367. localColorSpaceCache
  30368. }) {
  30369. const dict = image.dict;
  30370. const imageRef = dict.objId;
  30371. const w = dict.get("W", "Width");
  30372. const h = dict.get("H", "Height");
  30373. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  30374. warn("Image dimensions are missing, or not numbers.");
  30375. return;
  30376. }
  30377. const maxImageSize = this.options.maxImageSize;
  30378. if (maxImageSize !== -1 && w * h > maxImageSize) {
  30379. const msg = "Image exceeded maximum allowed size and was removed.";
  30380. if (this.options.ignoreErrors) {
  30381. warn(msg);
  30382. return;
  30383. }
  30384. throw new Error(msg);
  30385. }
  30386. let optionalContent;
  30387. if (dict.has("OC")) {
  30388. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  30389. }
  30390. const imageMask = dict.get("IM", "ImageMask") || false;
  30391. let imgData, args;
  30392. if (imageMask) {
  30393. const interpolate = dict.get("I", "Interpolate");
  30394. const bitStrideLength = w + 7 >> 3;
  30395. const imgArray = image.getBytes(bitStrideLength * h);
  30396. const decode = dict.getArray("D", "Decode");
  30397. if (this.parsingType3Font) {
  30398. imgData = PDFImage.createRawMask({
  30399. imgArray,
  30400. width: w,
  30401. height: h,
  30402. imageIsFromDecodeStream: image instanceof DecodeStream,
  30403. inverseDecode: decode?.[0] > 0,
  30404. interpolate
  30405. });
  30406. imgData.cached = !!cacheKey;
  30407. args = [imgData];
  30408. operatorList.addImageOps(OPS.paintImageMaskXObject, args, optionalContent);
  30409. if (cacheKey) {
  30410. const cacheData = {
  30411. fn: OPS.paintImageMaskXObject,
  30412. args,
  30413. optionalContent
  30414. };
  30415. localImageCache.set(cacheKey, imageRef, cacheData);
  30416. if (imageRef) {
  30417. this._regionalImageCache.set(null, imageRef, cacheData);
  30418. }
  30419. }
  30420. return;
  30421. }
  30422. imgData = await PDFImage.createMask({
  30423. imgArray,
  30424. width: w,
  30425. height: h,
  30426. imageIsFromDecodeStream: image instanceof DecodeStream,
  30427. inverseDecode: decode?.[0] > 0,
  30428. interpolate,
  30429. isOffscreenCanvasSupported: this.options.isOffscreenCanvasSupported
  30430. });
  30431. if (imgData.isSingleOpaquePixel) {
  30432. operatorList.addImageOps(OPS.paintSolidColorImageMask, [], optionalContent);
  30433. if (cacheKey) {
  30434. const cacheData = {
  30435. fn: OPS.paintSolidColorImageMask,
  30436. args: [],
  30437. optionalContent
  30438. };
  30439. localImageCache.set(cacheKey, imageRef, cacheData);
  30440. if (imageRef) {
  30441. this._regionalImageCache.set(null, imageRef, cacheData);
  30442. }
  30443. }
  30444. return;
  30445. }
  30446. const objId = `mask_${this.idFactory.createObjId()}`;
  30447. operatorList.addDependency(objId);
  30448. imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
  30449. this._sendImgData(objId, imgData);
  30450. args = [{
  30451. data: objId,
  30452. width: imgData.width,
  30453. height: imgData.height,
  30454. interpolate: imgData.interpolate,
  30455. count: 1
  30456. }];
  30457. operatorList.addImageOps(OPS.paintImageMaskXObject, args, optionalContent);
  30458. if (cacheKey) {
  30459. const cacheData = {
  30460. objId,
  30461. fn: OPS.paintImageMaskXObject,
  30462. args,
  30463. optionalContent
  30464. };
  30465. localImageCache.set(cacheKey, imageRef, cacheData);
  30466. if (imageRef) {
  30467. this._regionalImageCache.set(null, imageRef, cacheData);
  30468. }
  30469. }
  30470. return;
  30471. }
  30472. const SMALL_IMAGE_DIMENSIONS = 200;
  30473. const hasMask = dict.has("SMask") || dict.has("Mask");
  30474. if (isInline && w + h < SMALL_IMAGE_DIMENSIONS && !hasMask) {
  30475. try {
  30476. const imageObj = new PDFImage({
  30477. xref: this.xref,
  30478. res: resources,
  30479. image,
  30480. isInline,
  30481. pdfFunctionFactory: this._pdfFunctionFactory,
  30482. localColorSpaceCache
  30483. });
  30484. imgData = await imageObj.createImageData(true, false);
  30485. operatorList.isOffscreenCanvasSupported = this.options.isOffscreenCanvasSupported;
  30486. operatorList.addImageOps(OPS.paintInlineImageXObject, [imgData], optionalContent);
  30487. } catch (reason) {
  30488. const msg = `Unable to decode inline image: "${reason}".`;
  30489. if (!this.options.ignoreErrors) {
  30490. throw new Error(msg);
  30491. }
  30492. warn(msg);
  30493. }
  30494. return;
  30495. }
  30496. let objId = `img_${this.idFactory.createObjId()}`,
  30497. cacheGlobally = false;
  30498. if (this.parsingType3Font) {
  30499. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  30500. } else if (cacheKey && imageRef) {
  30501. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  30502. if (cacheGlobally) {
  30503. assert(!isInline, "Cannot cache an inline image globally.");
  30504. objId = `${this.idFactory.getDocId()}_${objId}`;
  30505. }
  30506. }
  30507. operatorList.addDependency(objId);
  30508. args = [objId, w, h];
  30509. operatorList.addImageOps(OPS.paintImageXObject, args, optionalContent, hasMask);
  30510. if (cacheGlobally) {
  30511. if (this.globalImageCache.hasDecodeFailed(imageRef)) {
  30512. this.globalImageCache.setData(imageRef, {
  30513. objId,
  30514. fn: OPS.paintImageXObject,
  30515. args,
  30516. optionalContent,
  30517. hasMask,
  30518. byteSize: 0
  30519. });
  30520. this._sendImgData(objId, null, cacheGlobally);
  30521. return;
  30522. }
  30523. if (w * h > 250000 || hasMask) {
  30524. const localLength = await this.handler.sendWithPromise("commonobj", [objId, "CopyLocalImage", {
  30525. imageRef
  30526. }]);
  30527. if (localLength) {
  30528. this.globalImageCache.setData(imageRef, {
  30529. objId,
  30530. fn: OPS.paintImageXObject,
  30531. args,
  30532. optionalContent,
  30533. hasMask,
  30534. byteSize: 0
  30535. });
  30536. this.globalImageCache.addByteSize(imageRef, localLength);
  30537. return;
  30538. }
  30539. }
  30540. }
  30541. PDFImage.buildImage({
  30542. xref: this.xref,
  30543. res: resources,
  30544. image,
  30545. isInline,
  30546. pdfFunctionFactory: this._pdfFunctionFactory,
  30547. localColorSpaceCache
  30548. }).then(async imageObj => {
  30549. imgData = await imageObj.createImageData(false, this.options.isOffscreenCanvasSupported);
  30550. imgData.dataLen = imgData.bitmap ? imgData.width * imgData.height * 4 : imgData.data.length;
  30551. imgData.ref = imageRef;
  30552. if (cacheGlobally) {
  30553. this.globalImageCache.addByteSize(imageRef, imgData.dataLen);
  30554. }
  30555. return this._sendImgData(objId, imgData, cacheGlobally);
  30556. }).catch(reason => {
  30557. warn(`Unable to decode image "${objId}": "${reason}".`);
  30558. if (imageRef) {
  30559. this.globalImageCache.addDecodeFailed(imageRef);
  30560. }
  30561. return this._sendImgData(objId, null, cacheGlobally);
  30562. });
  30563. if (cacheKey) {
  30564. const cacheData = {
  30565. objId,
  30566. fn: OPS.paintImageXObject,
  30567. args,
  30568. optionalContent,
  30569. hasMask
  30570. };
  30571. localImageCache.set(cacheKey, imageRef, cacheData);
  30572. if (imageRef) {
  30573. this._regionalImageCache.set(null, imageRef, cacheData);
  30574. if (cacheGlobally) {
  30575. this.globalImageCache.setData(imageRef, {
  30576. objId,
  30577. fn: OPS.paintImageXObject,
  30578. args,
  30579. optionalContent,
  30580. hasMask,
  30581. byteSize: 0
  30582. });
  30583. }
  30584. }
  30585. }
  30586. }
  30587. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  30588. const smaskContent = smask.get("G");
  30589. const smaskOptions = {
  30590. subtype: smask.get("S").name,
  30591. backdrop: smask.get("BC")
  30592. };
  30593. const transferObj = smask.get("TR");
  30594. if (isPDFFunction(transferObj)) {
  30595. const transferFn = this._pdfFunctionFactory.create(transferObj);
  30596. const transferMap = new Uint8Array(256);
  30597. const tmp = new Float32Array(1);
  30598. for (let i = 0; i < 256; i++) {
  30599. tmp[0] = i / 255;
  30600. transferFn(tmp, 0, tmp, 0);
  30601. transferMap[i] = tmp[0] * 255 | 0;
  30602. }
  30603. smaskOptions.transferMap = transferMap;
  30604. }
  30605. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  30606. }
  30607. handleTransferFunction(tr) {
  30608. let transferArray;
  30609. if (Array.isArray(tr)) {
  30610. transferArray = tr;
  30611. } else if (isPDFFunction(tr)) {
  30612. transferArray = [tr];
  30613. } else {
  30614. return null;
  30615. }
  30616. const transferMaps = [];
  30617. let numFns = 0,
  30618. numEffectfulFns = 0;
  30619. for (const entry of transferArray) {
  30620. const transferObj = this.xref.fetchIfRef(entry);
  30621. numFns++;
  30622. if (isName(transferObj, "Identity")) {
  30623. transferMaps.push(null);
  30624. continue;
  30625. } else if (!isPDFFunction(transferObj)) {
  30626. return null;
  30627. }
  30628. const transferFn = this._pdfFunctionFactory.create(transferObj);
  30629. const transferMap = new Uint8Array(256),
  30630. tmp = new Float32Array(1);
  30631. for (let j = 0; j < 256; j++) {
  30632. tmp[0] = j / 255;
  30633. transferFn(tmp, 0, tmp, 0);
  30634. transferMap[j] = tmp[0] * 255 | 0;
  30635. }
  30636. transferMaps.push(transferMap);
  30637. numEffectfulFns++;
  30638. }
  30639. if (!(numFns === 1 || numFns === 4)) {
  30640. return null;
  30641. }
  30642. if (numEffectfulFns === 0) {
  30643. return null;
  30644. }
  30645. return transferMaps;
  30646. }
  30647. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  30648. const tilingOpList = new OperatorList();
  30649. const patternResources = Dict.merge({
  30650. xref: this.xref,
  30651. dictArray: [patternDict.get("Resources"), resources]
  30652. });
  30653. return this.getOperatorList({
  30654. stream: pattern,
  30655. task,
  30656. resources: patternResources,
  30657. operatorList: tilingOpList
  30658. }).then(function () {
  30659. const operatorListIR = tilingOpList.getIR();
  30660. const tilingPatternIR = getTilingPatternIR(operatorListIR, patternDict, color);
  30661. operatorList.addDependencies(tilingOpList.dependencies);
  30662. operatorList.addOp(fn, tilingPatternIR);
  30663. if (patternDict.objId) {
  30664. localTilingPatternCache.set(null, patternDict.objId, {
  30665. operatorListIR,
  30666. dict: patternDict
  30667. });
  30668. }
  30669. }).catch(reason => {
  30670. if (reason instanceof AbortException) {
  30671. return;
  30672. }
  30673. if (this.options.ignoreErrors) {
  30674. warn(`handleTilingType - ignoring pattern: "${reason}".`);
  30675. return;
  30676. }
  30677. throw reason;
  30678. });
  30679. }
  30680. async handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  30681. const fontName = fontArgs?.[0] instanceof Name ? fontArgs[0].name : null;
  30682. let translated = await this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo);
  30683. if (translated.font.isType3Font) {
  30684. try {
  30685. await translated.loadType3Data(this, resources, task);
  30686. operatorList.addDependencies(translated.type3Dependencies);
  30687. } catch (reason) {
  30688. translated = new TranslatedFont({
  30689. loadedName: "g_font_error",
  30690. font: new ErrorFont(`Type3 font load error: ${reason}`),
  30691. dict: translated.font,
  30692. evaluatorOptions: this.options
  30693. });
  30694. }
  30695. }
  30696. state.font = translated.font;
  30697. translated.send(this.handler);
  30698. return translated.loadedName;
  30699. }
  30700. handleText(chars, state) {
  30701. const font = state.font;
  30702. const glyphs = font.charsToGlyphs(chars);
  30703. if (font.data) {
  30704. const isAddToPathSet = !!(state.textRenderingMode & TextRenderingMode.ADD_TO_PATH_FLAG);
  30705. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  30706. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  30707. }
  30708. }
  30709. return glyphs;
  30710. }
  30711. ensureStateFont(state) {
  30712. if (state.font) {
  30713. return;
  30714. }
  30715. const reason = new FormatError("Missing setFont (Tf) operator before text rendering operator.");
  30716. if (this.options.ignoreErrors) {
  30717. warn(`ensureStateFont: "${reason}".`);
  30718. return;
  30719. }
  30720. throw reason;
  30721. }
  30722. async setGState({
  30723. resources,
  30724. gState,
  30725. operatorList,
  30726. cacheKey,
  30727. task,
  30728. stateManager,
  30729. localGStateCache,
  30730. localColorSpaceCache
  30731. }) {
  30732. const gStateRef = gState.objId;
  30733. let isSimpleGState = true;
  30734. const gStateObj = [];
  30735. let promise = Promise.resolve();
  30736. for (const key of gState.getKeys()) {
  30737. const value = gState.get(key);
  30738. switch (key) {
  30739. case "Type":
  30740. break;
  30741. case "LW":
  30742. case "LC":
  30743. case "LJ":
  30744. case "ML":
  30745. case "D":
  30746. case "RI":
  30747. case "FL":
  30748. case "CA":
  30749. case "ca":
  30750. gStateObj.push([key, value]);
  30751. break;
  30752. case "Font":
  30753. isSimpleGState = false;
  30754. promise = promise.then(() => this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  30755. operatorList.addDependency(loadedName);
  30756. gStateObj.push([key, [loadedName, value[1]]]);
  30757. }));
  30758. break;
  30759. case "BM":
  30760. gStateObj.push([key, normalizeBlendMode(value)]);
  30761. break;
  30762. case "SMask":
  30763. if (isName(value, "None")) {
  30764. gStateObj.push([key, false]);
  30765. break;
  30766. }
  30767. if (value instanceof Dict) {
  30768. isSimpleGState = false;
  30769. promise = promise.then(() => this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache));
  30770. gStateObj.push([key, true]);
  30771. } else {
  30772. warn("Unsupported SMask type");
  30773. }
  30774. break;
  30775. case "TR":
  30776. const transferMaps = this.handleTransferFunction(value);
  30777. gStateObj.push([key, transferMaps]);
  30778. break;
  30779. case "OP":
  30780. case "op":
  30781. case "OPM":
  30782. case "BG":
  30783. case "BG2":
  30784. case "UCR":
  30785. case "UCR2":
  30786. case "TR2":
  30787. case "HT":
  30788. case "SM":
  30789. case "SA":
  30790. case "AIS":
  30791. case "TK":
  30792. info("graphic state operator " + key);
  30793. break;
  30794. default:
  30795. info("Unknown graphic state operator " + key);
  30796. break;
  30797. }
  30798. }
  30799. await promise;
  30800. if (gStateObj.length > 0) {
  30801. operatorList.addOp(OPS.setGState, [gStateObj]);
  30802. }
  30803. if (isSimpleGState) {
  30804. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  30805. }
  30806. }
  30807. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  30808. const errorFont = async () => {
  30809. return new TranslatedFont({
  30810. loadedName: "g_font_error",
  30811. font: new ErrorFont(`Font "${fontName}" is not available.`),
  30812. dict: font,
  30813. evaluatorOptions: this.options
  30814. });
  30815. };
  30816. let fontRef;
  30817. if (font) {
  30818. if (font instanceof Ref) {
  30819. fontRef = font;
  30820. }
  30821. } else {
  30822. const fontRes = resources.get("Font");
  30823. if (fontRes) {
  30824. fontRef = fontRes.getRaw(fontName);
  30825. }
  30826. }
  30827. if (fontRef) {
  30828. if (this.type3FontRefs?.has(fontRef)) {
  30829. return errorFont();
  30830. }
  30831. if (this.fontCache.has(fontRef)) {
  30832. return this.fontCache.get(fontRef);
  30833. }
  30834. try {
  30835. font = this.xref.fetchIfRef(fontRef);
  30836. } catch (ex) {
  30837. warn(`loadFont - lookup failed: "${ex}".`);
  30838. }
  30839. }
  30840. if (!(font instanceof Dict)) {
  30841. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  30842. warn(`Font "${fontName}" is not available.`);
  30843. return errorFont();
  30844. }
  30845. warn(`Font "${fontName}" is not available -- attempting to fallback to a default font.`);
  30846. font = fallbackFontDict || PartialEvaluator.fallbackFontDict;
  30847. }
  30848. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  30849. return this.fontCache.get(font.cacheKey);
  30850. }
  30851. const {
  30852. promise,
  30853. resolve
  30854. } = Promise.withResolvers();
  30855. let preEvaluatedFont;
  30856. try {
  30857. preEvaluatedFont = this.preEvaluateFont(font);
  30858. preEvaluatedFont.cssFontInfo = cssFontInfo;
  30859. } catch (reason) {
  30860. warn(`loadFont - preEvaluateFont failed: "${reason}".`);
  30861. return errorFont();
  30862. }
  30863. const {
  30864. descriptor,
  30865. hash
  30866. } = preEvaluatedFont;
  30867. const fontRefIsRef = fontRef instanceof Ref;
  30868. let fontID;
  30869. if (hash && descriptor instanceof Dict) {
  30870. const fontAliases = descriptor.fontAliases ||= Object.create(null);
  30871. if (fontAliases[hash]) {
  30872. const aliasFontRef = fontAliases[hash].aliasRef;
  30873. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  30874. this.fontCache.putAlias(fontRef, aliasFontRef);
  30875. return this.fontCache.get(fontRef);
  30876. }
  30877. } else {
  30878. fontAliases[hash] = {
  30879. fontID: this.idFactory.createFontId()
  30880. };
  30881. }
  30882. if (fontRefIsRef) {
  30883. fontAliases[hash].aliasRef = fontRef;
  30884. }
  30885. fontID = fontAliases[hash].fontID;
  30886. } else {
  30887. fontID = this.idFactory.createFontId();
  30888. }
  30889. assert(fontID?.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  30890. if (fontRefIsRef) {
  30891. this.fontCache.put(fontRef, promise);
  30892. } else {
  30893. font.cacheKey = `cacheKey_${fontID}`;
  30894. this.fontCache.put(font.cacheKey, promise);
  30895. }
  30896. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  30897. this.translateFont(preEvaluatedFont).then(translatedFont => {
  30898. resolve(new TranslatedFont({
  30899. loadedName: font.loadedName,
  30900. font: translatedFont,
  30901. dict: font,
  30902. evaluatorOptions: this.options
  30903. }));
  30904. }).catch(reason => {
  30905. warn(`loadFont - translateFont failed: "${reason}".`);
  30906. resolve(new TranslatedFont({
  30907. loadedName: font.loadedName,
  30908. font: new ErrorFont(reason instanceof Error ? reason.message : reason),
  30909. dict: font,
  30910. evaluatorOptions: this.options
  30911. }));
  30912. });
  30913. return promise;
  30914. }
  30915. buildPath(operatorList, fn, args, parsingText = false) {
  30916. const lastIndex = operatorList.length - 1;
  30917. if (!args) {
  30918. args = [];
  30919. }
  30920. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== OPS.constructPath) {
  30921. if (parsingText) {
  30922. warn(`Encountered path operator "${fn}" inside of a text object.`);
  30923. operatorList.addOp(OPS.save, null);
  30924. }
  30925. let minMax;
  30926. switch (fn) {
  30927. case OPS.rectangle:
  30928. const x = args[0] + args[2];
  30929. const y = args[1] + args[3];
  30930. minMax = [Math.min(args[0], x), Math.min(args[1], y), Math.max(args[0], x), Math.max(args[1], y)];
  30931. break;
  30932. case OPS.moveTo:
  30933. case OPS.lineTo:
  30934. minMax = [args[0], args[1], args[0], args[1]];
  30935. break;
  30936. default:
  30937. minMax = [Infinity, Infinity, -Infinity, -Infinity];
  30938. break;
  30939. }
  30940. operatorList.addOp(OPS.constructPath, [[fn], args, minMax]);
  30941. if (parsingText) {
  30942. operatorList.addOp(OPS.restore, null);
  30943. }
  30944. } else {
  30945. const opArgs = operatorList.argsArray[lastIndex];
  30946. opArgs[0].push(fn);
  30947. opArgs[1].push(...args);
  30948. const minMax = opArgs[2];
  30949. switch (fn) {
  30950. case OPS.rectangle:
  30951. const x = args[0] + args[2];
  30952. const y = args[1] + args[3];
  30953. minMax[0] = Math.min(minMax[0], args[0], x);
  30954. minMax[1] = Math.min(minMax[1], args[1], y);
  30955. minMax[2] = Math.max(minMax[2], args[0], x);
  30956. minMax[3] = Math.max(minMax[3], args[1], y);
  30957. break;
  30958. case OPS.moveTo:
  30959. case OPS.lineTo:
  30960. minMax[0] = Math.min(minMax[0], args[0]);
  30961. minMax[1] = Math.min(minMax[1], args[1]);
  30962. minMax[2] = Math.max(minMax[2], args[0]);
  30963. minMax[3] = Math.max(minMax[3], args[1]);
  30964. break;
  30965. }
  30966. }
  30967. }
  30968. parseColorSpace({
  30969. cs,
  30970. resources,
  30971. localColorSpaceCache
  30972. }) {
  30973. return ColorSpace.parseAsync({
  30974. cs,
  30975. xref: this.xref,
  30976. resources,
  30977. pdfFunctionFactory: this._pdfFunctionFactory,
  30978. localColorSpaceCache
  30979. }).catch(reason => {
  30980. if (reason instanceof AbortException) {
  30981. return null;
  30982. }
  30983. if (this.options.ignoreErrors) {
  30984. warn(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  30985. return null;
  30986. }
  30987. throw reason;
  30988. });
  30989. }
  30990. parseShading({
  30991. shading,
  30992. resources,
  30993. localColorSpaceCache,
  30994. localShadingPatternCache
  30995. }) {
  30996. let id = localShadingPatternCache.get(shading);
  30997. if (id) {
  30998. return id;
  30999. }
  31000. let patternIR;
  31001. try {
  31002. const shadingFill = Pattern.parseShading(shading, this.xref, resources, this._pdfFunctionFactory, localColorSpaceCache);
  31003. patternIR = shadingFill.getIR();
  31004. } catch (reason) {
  31005. if (reason instanceof AbortException) {
  31006. return null;
  31007. }
  31008. if (this.options.ignoreErrors) {
  31009. warn(`parseShading - ignoring shading: "${reason}".`);
  31010. localShadingPatternCache.set(shading, null);
  31011. return null;
  31012. }
  31013. throw reason;
  31014. }
  31015. id = `pattern_${this.idFactory.createObjId()}`;
  31016. if (this.parsingType3Font) {
  31017. id = `${this.idFactory.getDocId()}_type3_${id}`;
  31018. }
  31019. localShadingPatternCache.set(shading, id);
  31020. if (this.parsingType3Font) {
  31021. this.handler.send("commonobj", [id, "Pattern", patternIR]);
  31022. } else {
  31023. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  31024. }
  31025. return id;
  31026. }
  31027. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  31028. const patternName = args.pop();
  31029. if (patternName instanceof Name) {
  31030. const rawPattern = patterns.getRaw(patternName.name);
  31031. const localTilingPattern = rawPattern instanceof Ref && localTilingPatternCache.getByRef(rawPattern);
  31032. if (localTilingPattern) {
  31033. try {
  31034. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  31035. const tilingPatternIR = getTilingPatternIR(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  31036. operatorList.addOp(fn, tilingPatternIR);
  31037. return undefined;
  31038. } catch {}
  31039. }
  31040. const pattern = this.xref.fetchIfRef(rawPattern);
  31041. if (pattern) {
  31042. const dict = pattern instanceof BaseStream ? pattern.dict : pattern;
  31043. const typeNum = dict.get("PatternType");
  31044. if (typeNum === PatternType.TILING) {
  31045. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  31046. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  31047. } else if (typeNum === PatternType.SHADING) {
  31048. const shading = dict.get("Shading");
  31049. const objId = this.parseShading({
  31050. shading,
  31051. resources,
  31052. localColorSpaceCache,
  31053. localShadingPatternCache
  31054. });
  31055. if (objId) {
  31056. const matrix = lookupMatrix(dict.getArray("Matrix"), null);
  31057. operatorList.addOp(fn, ["Shading", objId, matrix]);
  31058. }
  31059. return undefined;
  31060. }
  31061. throw new FormatError(`Unknown PatternType: ${typeNum}`);
  31062. }
  31063. }
  31064. throw new FormatError(`Unknown PatternName: ${patternName}`);
  31065. }
  31066. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  31067. const MAX_NESTING = 10;
  31068. if (++nestingCounter > MAX_NESTING) {
  31069. warn("Visibility expression is too deeply nested");
  31070. return;
  31071. }
  31072. const length = array.length;
  31073. const operator = this.xref.fetchIfRef(array[0]);
  31074. if (length < 2 || !(operator instanceof Name)) {
  31075. warn("Invalid visibility expression");
  31076. return;
  31077. }
  31078. switch (operator.name) {
  31079. case "And":
  31080. case "Or":
  31081. case "Not":
  31082. currentResult.push(operator.name);
  31083. break;
  31084. default:
  31085. warn(`Invalid operator ${operator.name} in visibility expression`);
  31086. return;
  31087. }
  31088. for (let i = 1; i < length; i++) {
  31089. const raw = array[i];
  31090. const object = this.xref.fetchIfRef(raw);
  31091. if (Array.isArray(object)) {
  31092. const nestedResult = [];
  31093. currentResult.push(nestedResult);
  31094. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  31095. } else if (raw instanceof Ref) {
  31096. currentResult.push(raw.toString());
  31097. }
  31098. }
  31099. }
  31100. async parseMarkedContentProps(contentProperties, resources) {
  31101. let optionalContent;
  31102. if (contentProperties instanceof Name) {
  31103. const properties = resources.get("Properties");
  31104. optionalContent = properties.get(contentProperties.name);
  31105. } else if (contentProperties instanceof Dict) {
  31106. optionalContent = contentProperties;
  31107. } else {
  31108. throw new FormatError("Optional content properties malformed.");
  31109. }
  31110. const optionalContentType = optionalContent.get("Type")?.name;
  31111. if (optionalContentType === "OCG") {
  31112. return {
  31113. type: optionalContentType,
  31114. id: optionalContent.objId
  31115. };
  31116. } else if (optionalContentType === "OCMD") {
  31117. const expression = optionalContent.get("VE");
  31118. if (Array.isArray(expression)) {
  31119. const result = [];
  31120. this._parseVisibilityExpression(expression, 0, result);
  31121. if (result.length > 0) {
  31122. return {
  31123. type: "OCMD",
  31124. expression: result
  31125. };
  31126. }
  31127. }
  31128. const optionalContentGroups = optionalContent.get("OCGs");
  31129. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof Dict) {
  31130. const groupIds = [];
  31131. if (Array.isArray(optionalContentGroups)) {
  31132. for (const ocg of optionalContentGroups) {
  31133. groupIds.push(ocg.toString());
  31134. }
  31135. } else {
  31136. groupIds.push(optionalContentGroups.objId);
  31137. }
  31138. return {
  31139. type: optionalContentType,
  31140. ids: groupIds,
  31141. policy: optionalContent.get("P") instanceof Name ? optionalContent.get("P").name : null,
  31142. expression: null
  31143. };
  31144. } else if (optionalContentGroups instanceof Ref) {
  31145. return {
  31146. type: optionalContentType,
  31147. id: optionalContentGroups.toString()
  31148. };
  31149. }
  31150. }
  31151. return null;
  31152. }
  31153. getOperatorList({
  31154. stream,
  31155. task,
  31156. resources,
  31157. operatorList,
  31158. initialState = null,
  31159. fallbackFontDict = null
  31160. }) {
  31161. resources ||= Dict.empty;
  31162. initialState ||= new EvalState();
  31163. if (!operatorList) {
  31164. throw new Error('getOperatorList: missing "operatorList" parameter');
  31165. }
  31166. const self = this;
  31167. const xref = this.xref;
  31168. let parsingText = false;
  31169. const localImageCache = new LocalImageCache();
  31170. const localColorSpaceCache = new LocalColorSpaceCache();
  31171. const localGStateCache = new LocalGStateCache();
  31172. const localTilingPatternCache = new LocalTilingPatternCache();
  31173. const localShadingPatternCache = new Map();
  31174. const xobjs = resources.get("XObject") || Dict.empty;
  31175. const patterns = resources.get("Pattern") || Dict.empty;
  31176. const stateManager = new StateManager(initialState);
  31177. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  31178. const timeSlotManager = new TimeSlotManager();
  31179. function closePendingRestoreOPS(argument) {
  31180. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  31181. operatorList.addOp(OPS.restore, []);
  31182. }
  31183. }
  31184. return new Promise(function promiseBody(resolve, reject) {
  31185. const next = function (promise) {
  31186. Promise.all([promise, operatorList.ready]).then(function () {
  31187. try {
  31188. promiseBody(resolve, reject);
  31189. } catch (ex) {
  31190. reject(ex);
  31191. }
  31192. }, reject);
  31193. };
  31194. task.ensureNotTerminated();
  31195. timeSlotManager.reset();
  31196. const operation = {};
  31197. let stop, i, ii, cs, name, isValidName;
  31198. while (!(stop = timeSlotManager.check())) {
  31199. operation.args = null;
  31200. if (!preprocessor.read(operation)) {
  31201. break;
  31202. }
  31203. let args = operation.args;
  31204. let fn = operation.fn;
  31205. switch (fn | 0) {
  31206. case OPS.paintXObject:
  31207. isValidName = args[0] instanceof Name;
  31208. name = args[0].name;
  31209. if (isValidName) {
  31210. const localImage = localImageCache.getByName(name);
  31211. if (localImage) {
  31212. addLocallyCachedImageOps(operatorList, localImage);
  31213. args = null;
  31214. continue;
  31215. }
  31216. }
  31217. next(new Promise(function (resolveXObject, rejectXObject) {
  31218. if (!isValidName) {
  31219. throw new FormatError("XObject must be referred to by name.");
  31220. }
  31221. let xobj = xobjs.getRaw(name);
  31222. if (xobj instanceof Ref) {
  31223. const localImage = localImageCache.getByRef(xobj) || self._regionalImageCache.getByRef(xobj);
  31224. if (localImage) {
  31225. addLocallyCachedImageOps(operatorList, localImage);
  31226. resolveXObject();
  31227. return;
  31228. }
  31229. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  31230. if (globalImage) {
  31231. operatorList.addDependency(globalImage.objId);
  31232. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent, globalImage.hasMask);
  31233. resolveXObject();
  31234. return;
  31235. }
  31236. xobj = xref.fetch(xobj);
  31237. }
  31238. if (!(xobj instanceof BaseStream)) {
  31239. throw new FormatError("XObject should be a stream");
  31240. }
  31241. const type = xobj.dict.get("Subtype");
  31242. if (!(type instanceof Name)) {
  31243. throw new FormatError("XObject should have a Name subtype");
  31244. }
  31245. if (type.name === "Form") {
  31246. stateManager.save();
  31247. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  31248. stateManager.restore();
  31249. resolveXObject();
  31250. }, rejectXObject);
  31251. return;
  31252. } else if (type.name === "Image") {
  31253. self.buildPaintImageXObject({
  31254. resources,
  31255. image: xobj,
  31256. operatorList,
  31257. cacheKey: name,
  31258. localImageCache,
  31259. localColorSpaceCache
  31260. }).then(resolveXObject, rejectXObject);
  31261. return;
  31262. } else if (type.name === "PS") {
  31263. info("Ignored XObject subtype PS");
  31264. } else {
  31265. throw new FormatError(`Unhandled XObject subtype ${type.name}`);
  31266. }
  31267. resolveXObject();
  31268. }).catch(function (reason) {
  31269. if (reason instanceof AbortException) {
  31270. return;
  31271. }
  31272. if (self.options.ignoreErrors) {
  31273. warn(`getOperatorList - ignoring XObject: "${reason}".`);
  31274. return;
  31275. }
  31276. throw reason;
  31277. }));
  31278. return;
  31279. case OPS.setFont:
  31280. const fontSize = args[1];
  31281. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  31282. operatorList.addDependency(loadedName);
  31283. operatorList.addOp(OPS.setFont, [loadedName, fontSize]);
  31284. }));
  31285. return;
  31286. case OPS.beginText:
  31287. parsingText = true;
  31288. break;
  31289. case OPS.endText:
  31290. parsingText = false;
  31291. break;
  31292. case OPS.endInlineImage:
  31293. const cacheKey = args[0].cacheKey;
  31294. if (cacheKey) {
  31295. const localImage = localImageCache.getByName(cacheKey);
  31296. if (localImage) {
  31297. addLocallyCachedImageOps(operatorList, localImage);
  31298. args = null;
  31299. continue;
  31300. }
  31301. }
  31302. next(self.buildPaintImageXObject({
  31303. resources,
  31304. image: args[0],
  31305. isInline: true,
  31306. operatorList,
  31307. cacheKey,
  31308. localImageCache,
  31309. localColorSpaceCache
  31310. }));
  31311. return;
  31312. case OPS.showText:
  31313. if (!stateManager.state.font) {
  31314. self.ensureStateFont(stateManager.state);
  31315. continue;
  31316. }
  31317. args[0] = self.handleText(args[0], stateManager.state);
  31318. break;
  31319. case OPS.showSpacedText:
  31320. if (!stateManager.state.font) {
  31321. self.ensureStateFont(stateManager.state);
  31322. continue;
  31323. }
  31324. const combinedGlyphs = [],
  31325. state = stateManager.state;
  31326. for (const arrItem of args[0]) {
  31327. if (typeof arrItem === "string") {
  31328. combinedGlyphs.push(...self.handleText(arrItem, state));
  31329. } else if (typeof arrItem === "number") {
  31330. combinedGlyphs.push(arrItem);
  31331. }
  31332. }
  31333. args[0] = combinedGlyphs;
  31334. fn = OPS.showText;
  31335. break;
  31336. case OPS.nextLineShowText:
  31337. if (!stateManager.state.font) {
  31338. self.ensureStateFont(stateManager.state);
  31339. continue;
  31340. }
  31341. operatorList.addOp(OPS.nextLine);
  31342. args[0] = self.handleText(args[0], stateManager.state);
  31343. fn = OPS.showText;
  31344. break;
  31345. case OPS.nextLineSetSpacingShowText:
  31346. if (!stateManager.state.font) {
  31347. self.ensureStateFont(stateManager.state);
  31348. continue;
  31349. }
  31350. operatorList.addOp(OPS.nextLine);
  31351. operatorList.addOp(OPS.setWordSpacing, [args.shift()]);
  31352. operatorList.addOp(OPS.setCharSpacing, [args.shift()]);
  31353. args[0] = self.handleText(args[0], stateManager.state);
  31354. fn = OPS.showText;
  31355. break;
  31356. case OPS.setTextRenderingMode:
  31357. stateManager.state.textRenderingMode = args[0];
  31358. break;
  31359. case OPS.setFillColorSpace:
  31360. {
  31361. const cachedColorSpace = ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  31362. if (cachedColorSpace) {
  31363. stateManager.state.fillColorSpace = cachedColorSpace;
  31364. continue;
  31365. }
  31366. next(self.parseColorSpace({
  31367. cs: args[0],
  31368. resources,
  31369. localColorSpaceCache
  31370. }).then(function (colorSpace) {
  31371. stateManager.state.fillColorSpace = colorSpace || ColorSpace.singletons.gray;
  31372. }));
  31373. return;
  31374. }
  31375. case OPS.setStrokeColorSpace:
  31376. {
  31377. const cachedColorSpace = ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  31378. if (cachedColorSpace) {
  31379. stateManager.state.strokeColorSpace = cachedColorSpace;
  31380. continue;
  31381. }
  31382. next(self.parseColorSpace({
  31383. cs: args[0],
  31384. resources,
  31385. localColorSpaceCache
  31386. }).then(function (colorSpace) {
  31387. stateManager.state.strokeColorSpace = colorSpace || ColorSpace.singletons.gray;
  31388. }));
  31389. return;
  31390. }
  31391. case OPS.setFillColor:
  31392. cs = stateManager.state.fillColorSpace;
  31393. args = cs.getRgb(args, 0);
  31394. fn = OPS.setFillRGBColor;
  31395. break;
  31396. case OPS.setStrokeColor:
  31397. cs = stateManager.state.strokeColorSpace;
  31398. args = cs.getRgb(args, 0);
  31399. fn = OPS.setStrokeRGBColor;
  31400. break;
  31401. case OPS.setFillGray:
  31402. stateManager.state.fillColorSpace = ColorSpace.singletons.gray;
  31403. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31404. fn = OPS.setFillRGBColor;
  31405. break;
  31406. case OPS.setStrokeGray:
  31407. stateManager.state.strokeColorSpace = ColorSpace.singletons.gray;
  31408. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31409. fn = OPS.setStrokeRGBColor;
  31410. break;
  31411. case OPS.setFillCMYKColor:
  31412. stateManager.state.fillColorSpace = ColorSpace.singletons.cmyk;
  31413. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  31414. fn = OPS.setFillRGBColor;
  31415. break;
  31416. case OPS.setStrokeCMYKColor:
  31417. stateManager.state.strokeColorSpace = ColorSpace.singletons.cmyk;
  31418. args = ColorSpace.singletons.cmyk.getRgb(args, 0);
  31419. fn = OPS.setStrokeRGBColor;
  31420. break;
  31421. case OPS.setFillRGBColor:
  31422. stateManager.state.fillColorSpace = ColorSpace.singletons.rgb;
  31423. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  31424. break;
  31425. case OPS.setStrokeRGBColor:
  31426. stateManager.state.strokeColorSpace = ColorSpace.singletons.rgb;
  31427. args = ColorSpace.singletons.rgb.getRgb(args, 0);
  31428. break;
  31429. case OPS.setFillColorN:
  31430. cs = stateManager.state.patternFillColorSpace;
  31431. if (!cs) {
  31432. if (isNumberArray(args, null)) {
  31433. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31434. fn = OPS.setFillRGBColor;
  31435. break;
  31436. }
  31437. args = [];
  31438. fn = OPS.setFillTransparent;
  31439. break;
  31440. }
  31441. if (cs.name === "Pattern") {
  31442. next(self.handleColorN(operatorList, OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  31443. return;
  31444. }
  31445. args = cs.getRgb(args, 0);
  31446. fn = OPS.setFillRGBColor;
  31447. break;
  31448. case OPS.setStrokeColorN:
  31449. cs = stateManager.state.patternStrokeColorSpace;
  31450. if (!cs) {
  31451. if (isNumberArray(args, null)) {
  31452. args = ColorSpace.singletons.gray.getRgb(args, 0);
  31453. fn = OPS.setStrokeRGBColor;
  31454. break;
  31455. }
  31456. args = [];
  31457. fn = OPS.setStrokeTransparent;
  31458. break;
  31459. }
  31460. if (cs.name === "Pattern") {
  31461. next(self.handleColorN(operatorList, OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  31462. return;
  31463. }
  31464. args = cs.getRgb(args, 0);
  31465. fn = OPS.setStrokeRGBColor;
  31466. break;
  31467. case OPS.shadingFill:
  31468. let shading;
  31469. try {
  31470. const shadingRes = resources.get("Shading");
  31471. if (!shadingRes) {
  31472. throw new FormatError("No shading resource found");
  31473. }
  31474. shading = shadingRes.get(args[0].name);
  31475. if (!shading) {
  31476. throw new FormatError("No shading object found");
  31477. }
  31478. } catch (reason) {
  31479. if (reason instanceof AbortException) {
  31480. continue;
  31481. }
  31482. if (self.options.ignoreErrors) {
  31483. warn(`getOperatorList - ignoring Shading: "${reason}".`);
  31484. continue;
  31485. }
  31486. throw reason;
  31487. }
  31488. const patternId = self.parseShading({
  31489. shading,
  31490. resources,
  31491. localColorSpaceCache,
  31492. localShadingPatternCache
  31493. });
  31494. if (!patternId) {
  31495. continue;
  31496. }
  31497. args = [patternId];
  31498. fn = OPS.shadingFill;
  31499. break;
  31500. case OPS.setGState:
  31501. isValidName = args[0] instanceof Name;
  31502. name = args[0].name;
  31503. if (isValidName) {
  31504. const localGStateObj = localGStateCache.getByName(name);
  31505. if (localGStateObj) {
  31506. if (localGStateObj.length > 0) {
  31507. operatorList.addOp(OPS.setGState, [localGStateObj]);
  31508. }
  31509. args = null;
  31510. continue;
  31511. }
  31512. }
  31513. next(new Promise(function (resolveGState, rejectGState) {
  31514. if (!isValidName) {
  31515. throw new FormatError("GState must be referred to by name.");
  31516. }
  31517. const extGState = resources.get("ExtGState");
  31518. if (!(extGState instanceof Dict)) {
  31519. throw new FormatError("ExtGState should be a dictionary.");
  31520. }
  31521. const gState = extGState.get(name);
  31522. if (!(gState instanceof Dict)) {
  31523. throw new FormatError("GState should be a dictionary.");
  31524. }
  31525. self.setGState({
  31526. resources,
  31527. gState,
  31528. operatorList,
  31529. cacheKey: name,
  31530. task,
  31531. stateManager,
  31532. localGStateCache,
  31533. localColorSpaceCache
  31534. }).then(resolveGState, rejectGState);
  31535. }).catch(function (reason) {
  31536. if (reason instanceof AbortException) {
  31537. return;
  31538. }
  31539. if (self.options.ignoreErrors) {
  31540. warn(`getOperatorList - ignoring ExtGState: "${reason}".`);
  31541. return;
  31542. }
  31543. throw reason;
  31544. }));
  31545. return;
  31546. case OPS.moveTo:
  31547. case OPS.lineTo:
  31548. case OPS.curveTo:
  31549. case OPS.curveTo2:
  31550. case OPS.curveTo3:
  31551. case OPS.closePath:
  31552. case OPS.rectangle:
  31553. self.buildPath(operatorList, fn, args, parsingText);
  31554. continue;
  31555. case OPS.markPoint:
  31556. case OPS.markPointProps:
  31557. case OPS.beginCompat:
  31558. case OPS.endCompat:
  31559. continue;
  31560. case OPS.beginMarkedContentProps:
  31561. if (!(args[0] instanceof Name)) {
  31562. warn(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  31563. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
  31564. continue;
  31565. }
  31566. if (args[0].name === "OC") {
  31567. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  31568. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", data]);
  31569. }).catch(reason => {
  31570. if (reason instanceof AbortException) {
  31571. return;
  31572. }
  31573. if (self.options.ignoreErrors) {
  31574. warn(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  31575. operatorList.addOp(OPS.beginMarkedContentProps, ["OC", null]);
  31576. return;
  31577. }
  31578. throw reason;
  31579. }));
  31580. return;
  31581. }
  31582. args = [args[0].name, args[1] instanceof Dict ? args[1].get("MCID") : null];
  31583. break;
  31584. case OPS.beginMarkedContent:
  31585. case OPS.endMarkedContent:
  31586. default:
  31587. if (args !== null) {
  31588. for (i = 0, ii = args.length; i < ii; i++) {
  31589. if (args[i] instanceof Dict) {
  31590. break;
  31591. }
  31592. }
  31593. if (i < ii) {
  31594. warn("getOperatorList - ignoring operator: " + fn);
  31595. continue;
  31596. }
  31597. }
  31598. }
  31599. operatorList.addOp(fn, args);
  31600. }
  31601. if (stop) {
  31602. next(deferred);
  31603. return;
  31604. }
  31605. closePendingRestoreOPS();
  31606. resolve();
  31607. }).catch(reason => {
  31608. if (reason instanceof AbortException) {
  31609. return;
  31610. }
  31611. if (this.options.ignoreErrors) {
  31612. warn(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  31613. closePendingRestoreOPS();
  31614. return;
  31615. }
  31616. throw reason;
  31617. });
  31618. }
  31619. getTextContent({
  31620. stream,
  31621. task,
  31622. resources,
  31623. stateManager = null,
  31624. includeMarkedContent = false,
  31625. sink,
  31626. seenStyles = new Set(),
  31627. viewBox,
  31628. lang = null,
  31629. markedContentData = null,
  31630. disableNormalization = false,
  31631. keepWhiteSpace = false
  31632. }) {
  31633. resources ||= Dict.empty;
  31634. stateManager ||= new StateManager(new TextState());
  31635. if (includeMarkedContent) {
  31636. markedContentData ||= {
  31637. level: 0
  31638. };
  31639. }
  31640. const textContent = {
  31641. items: [],
  31642. styles: Object.create(null),
  31643. lang
  31644. };
  31645. const textContentItem = {
  31646. initialized: false,
  31647. str: [],
  31648. totalWidth: 0,
  31649. totalHeight: 0,
  31650. width: 0,
  31651. height: 0,
  31652. vertical: false,
  31653. prevTransform: null,
  31654. textAdvanceScale: 0,
  31655. spaceInFlowMin: 0,
  31656. spaceInFlowMax: 0,
  31657. trackingSpaceMin: Infinity,
  31658. negativeSpaceMax: -Infinity,
  31659. notASpace: -Infinity,
  31660. transform: null,
  31661. fontName: null,
  31662. hasEOL: false
  31663. };
  31664. const twoLastChars = [" ", " "];
  31665. let twoLastCharsPos = 0;
  31666. function saveLastChar(char) {
  31667. const nextPos = (twoLastCharsPos + 1) % 2;
  31668. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  31669. twoLastChars[twoLastCharsPos] = char;
  31670. twoLastCharsPos = nextPos;
  31671. return !keepWhiteSpace && ret;
  31672. }
  31673. function shouldAddWhitepsace() {
  31674. return !keepWhiteSpace && twoLastChars[twoLastCharsPos] !== " " && twoLastChars[(twoLastCharsPos + 1) % 2] === " ";
  31675. }
  31676. function resetLastChars() {
  31677. twoLastChars[0] = twoLastChars[1] = " ";
  31678. twoLastCharsPos = 0;
  31679. }
  31680. const TRACKING_SPACE_FACTOR = 0.102;
  31681. const NOT_A_SPACE_FACTOR = 0.03;
  31682. const NEGATIVE_SPACE_FACTOR = -0.2;
  31683. const SPACE_IN_FLOW_MIN_FACTOR = 0.102;
  31684. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  31685. const VERTICAL_SHIFT_RATIO = 0.25;
  31686. const self = this;
  31687. const xref = this.xref;
  31688. const showSpacedTextBuffer = [];
  31689. let xobjs = null;
  31690. const emptyXObjectCache = new LocalImageCache();
  31691. const emptyGStateCache = new LocalGStateCache();
  31692. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  31693. let textState;
  31694. function pushWhitespace({
  31695. width = 0,
  31696. height = 0,
  31697. transform = textContentItem.prevTransform,
  31698. fontName = textContentItem.fontName
  31699. }) {
  31700. textContent.items.push({
  31701. str: " ",
  31702. dir: "ltr",
  31703. width,
  31704. height,
  31705. transform,
  31706. fontName,
  31707. hasEOL: false
  31708. });
  31709. }
  31710. function getCurrentTextTransform() {
  31711. const font = textState.font;
  31712. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  31713. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !isArrayEqual(textState.fontMatrix, FONT_IDENTITY_MATRIX)) {
  31714. const glyphHeight = font.bbox[3] - font.bbox[1];
  31715. if (glyphHeight > 0) {
  31716. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  31717. }
  31718. }
  31719. return Util.transform(textState.ctm, Util.transform(textState.textMatrix, tsm));
  31720. }
  31721. function ensureTextContentItem() {
  31722. if (textContentItem.initialized) {
  31723. return textContentItem;
  31724. }
  31725. const {
  31726. font,
  31727. loadedName
  31728. } = textState;
  31729. if (!seenStyles.has(loadedName)) {
  31730. seenStyles.add(loadedName);
  31731. textContent.styles[loadedName] = {
  31732. fontFamily: font.fallbackName,
  31733. ascent: font.ascent,
  31734. descent: font.descent,
  31735. vertical: font.vertical
  31736. };
  31737. if (self.options.fontExtraProperties && font.systemFontInfo) {
  31738. const style = textContent.styles[loadedName];
  31739. style.fontSubstitution = font.systemFontInfo.css;
  31740. style.fontSubstitutionLoadedName = font.systemFontInfo.loadedName;
  31741. }
  31742. }
  31743. textContentItem.fontName = loadedName;
  31744. const trm = textContentItem.transform = getCurrentTextTransform();
  31745. if (!font.vertical) {
  31746. textContentItem.width = textContentItem.totalWidth = 0;
  31747. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  31748. textContentItem.vertical = false;
  31749. } else {
  31750. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  31751. textContentItem.height = textContentItem.totalHeight = 0;
  31752. textContentItem.vertical = true;
  31753. }
  31754. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  31755. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  31756. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  31757. const {
  31758. fontSize
  31759. } = textState;
  31760. textContentItem.trackingSpaceMin = fontSize * TRACKING_SPACE_FACTOR;
  31761. textContentItem.notASpace = fontSize * NOT_A_SPACE_FACTOR;
  31762. textContentItem.negativeSpaceMax = fontSize * NEGATIVE_SPACE_FACTOR;
  31763. textContentItem.spaceInFlowMin = fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  31764. textContentItem.spaceInFlowMax = fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  31765. textContentItem.hasEOL = false;
  31766. textContentItem.initialized = true;
  31767. return textContentItem;
  31768. }
  31769. function updateAdvanceScale() {
  31770. if (!textContentItem.initialized) {
  31771. return;
  31772. }
  31773. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  31774. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  31775. const scaleFactor = scaleCtmX * scaleLineX;
  31776. if (scaleFactor === textContentItem.textAdvanceScale) {
  31777. return;
  31778. }
  31779. if (!textContentItem.vertical) {
  31780. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  31781. textContentItem.width = 0;
  31782. } else {
  31783. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  31784. textContentItem.height = 0;
  31785. }
  31786. textContentItem.textAdvanceScale = scaleFactor;
  31787. }
  31788. function runBidiTransform(textChunk) {
  31789. let text = textChunk.str.join("");
  31790. if (!disableNormalization) {
  31791. text = normalizeUnicode(text);
  31792. }
  31793. const bidiResult = bidi(text, -1, textChunk.vertical);
  31794. return {
  31795. str: bidiResult.str,
  31796. dir: bidiResult.dir,
  31797. width: Math.abs(textChunk.totalWidth),
  31798. height: Math.abs(textChunk.totalHeight),
  31799. transform: textChunk.transform,
  31800. fontName: textChunk.fontName,
  31801. hasEOL: textChunk.hasEOL
  31802. };
  31803. }
  31804. async function handleSetFont(fontName, fontRef) {
  31805. const translated = await self.loadFont(fontName, fontRef, resources);
  31806. if (translated.font.isType3Font) {
  31807. try {
  31808. await translated.loadType3Data(self, resources, task);
  31809. } catch {}
  31810. }
  31811. textState.loadedName = translated.loadedName;
  31812. textState.font = translated.font;
  31813. textState.fontMatrix = translated.font.fontMatrix || FONT_IDENTITY_MATRIX;
  31814. }
  31815. function applyInverseRotation(x, y, matrix) {
  31816. const scale = Math.hypot(matrix[0], matrix[1]);
  31817. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  31818. }
  31819. function compareWithLastPosition(glyphWidth) {
  31820. const currentTransform = getCurrentTextTransform();
  31821. let posX = currentTransform[4];
  31822. let posY = currentTransform[5];
  31823. if (textState.font?.vertical) {
  31824. if (posX < viewBox[0] || posX > viewBox[2] || posY + glyphWidth < viewBox[1] || posY > viewBox[3]) {
  31825. return false;
  31826. }
  31827. } else if (posX + glyphWidth < viewBox[0] || posX > viewBox[2] || posY < viewBox[1] || posY > viewBox[3]) {
  31828. return false;
  31829. }
  31830. if (!textState.font || !textContentItem.prevTransform) {
  31831. return true;
  31832. }
  31833. let lastPosX = textContentItem.prevTransform[4];
  31834. let lastPosY = textContentItem.prevTransform[5];
  31835. if (lastPosX === posX && lastPosY === posY) {
  31836. return true;
  31837. }
  31838. let rotate = -1;
  31839. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  31840. rotate = currentTransform[0] > 0 ? 0 : 180;
  31841. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  31842. rotate = currentTransform[1] > 0 ? 90 : 270;
  31843. }
  31844. switch (rotate) {
  31845. case 0:
  31846. break;
  31847. case 90:
  31848. [posX, posY] = [posY, posX];
  31849. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  31850. break;
  31851. case 180:
  31852. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  31853. break;
  31854. case 270:
  31855. [posX, posY] = [-posY, -posX];
  31856. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  31857. break;
  31858. default:
  31859. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  31860. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  31861. }
  31862. if (textState.font.vertical) {
  31863. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  31864. const advanceX = posX - lastPosX;
  31865. const textOrientation = Math.sign(textContentItem.height);
  31866. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  31867. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  31868. appendEOL();
  31869. return true;
  31870. }
  31871. resetLastChars();
  31872. flushTextContentItem();
  31873. return true;
  31874. }
  31875. if (Math.abs(advanceX) > textContentItem.width) {
  31876. appendEOL();
  31877. return true;
  31878. }
  31879. if (advanceY <= textOrientation * textContentItem.notASpace) {
  31880. resetLastChars();
  31881. }
  31882. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  31883. if (shouldAddWhitepsace()) {
  31884. resetLastChars();
  31885. flushTextContentItem();
  31886. pushWhitespace({
  31887. height: Math.abs(advanceY)
  31888. });
  31889. } else {
  31890. textContentItem.height += advanceY;
  31891. }
  31892. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  31893. if (textContentItem.str.length === 0) {
  31894. resetLastChars();
  31895. pushWhitespace({
  31896. height: Math.abs(advanceY)
  31897. });
  31898. } else {
  31899. textContentItem.height += advanceY;
  31900. }
  31901. }
  31902. if (Math.abs(advanceX) > textContentItem.width * VERTICAL_SHIFT_RATIO) {
  31903. flushTextContentItem();
  31904. }
  31905. return true;
  31906. }
  31907. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  31908. const advanceY = posY - lastPosY;
  31909. const textOrientation = Math.sign(textContentItem.width);
  31910. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  31911. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  31912. appendEOL();
  31913. return true;
  31914. }
  31915. resetLastChars();
  31916. flushTextContentItem();
  31917. return true;
  31918. }
  31919. if (Math.abs(advanceY) > textContentItem.height) {
  31920. appendEOL();
  31921. return true;
  31922. }
  31923. if (advanceX <= textOrientation * textContentItem.notASpace) {
  31924. resetLastChars();
  31925. }
  31926. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  31927. if (shouldAddWhitepsace()) {
  31928. resetLastChars();
  31929. flushTextContentItem();
  31930. pushWhitespace({
  31931. width: Math.abs(advanceX)
  31932. });
  31933. } else {
  31934. textContentItem.width += advanceX;
  31935. }
  31936. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  31937. if (textContentItem.str.length === 0) {
  31938. resetLastChars();
  31939. pushWhitespace({
  31940. width: Math.abs(advanceX)
  31941. });
  31942. } else {
  31943. textContentItem.width += advanceX;
  31944. }
  31945. }
  31946. if (Math.abs(advanceY) > textContentItem.height * VERTICAL_SHIFT_RATIO) {
  31947. flushTextContentItem();
  31948. }
  31949. return true;
  31950. }
  31951. function buildTextContentItem({
  31952. chars,
  31953. extraSpacing
  31954. }) {
  31955. const font = textState.font;
  31956. if (!chars) {
  31957. const charSpacing = textState.charSpacing + extraSpacing;
  31958. if (charSpacing) {
  31959. if (!font.vertical) {
  31960. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  31961. } else {
  31962. textState.translateTextMatrix(0, -charSpacing);
  31963. }
  31964. }
  31965. if (keepWhiteSpace) {
  31966. compareWithLastPosition(0);
  31967. }
  31968. return;
  31969. }
  31970. const glyphs = font.charsToGlyphs(chars);
  31971. const scale = textState.fontMatrix[0] * textState.fontSize;
  31972. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  31973. const glyph = glyphs[i];
  31974. const {
  31975. category
  31976. } = glyph;
  31977. if (category.isInvisibleFormatMark) {
  31978. continue;
  31979. }
  31980. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  31981. let glyphWidth = glyph.width;
  31982. if (font.vertical) {
  31983. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  31984. }
  31985. let scaledDim = glyphWidth * scale;
  31986. if (!keepWhiteSpace && category.isWhitespace) {
  31987. if (!font.vertical) {
  31988. charSpacing += scaledDim + textState.wordSpacing;
  31989. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  31990. } else {
  31991. charSpacing += -scaledDim + textState.wordSpacing;
  31992. textState.translateTextMatrix(0, -charSpacing);
  31993. }
  31994. saveLastChar(" ");
  31995. continue;
  31996. }
  31997. if (!category.isZeroWidthDiacritic && !compareWithLastPosition(scaledDim)) {
  31998. if (!font.vertical) {
  31999. textState.translateTextMatrix(scaledDim * textState.textHScale, 0);
  32000. } else {
  32001. textState.translateTextMatrix(0, scaledDim);
  32002. }
  32003. continue;
  32004. }
  32005. const textChunk = ensureTextContentItem();
  32006. if (category.isZeroWidthDiacritic) {
  32007. scaledDim = 0;
  32008. }
  32009. if (!font.vertical) {
  32010. scaledDim *= textState.textHScale;
  32011. textState.translateTextMatrix(scaledDim, 0);
  32012. textChunk.width += scaledDim;
  32013. } else {
  32014. textState.translateTextMatrix(0, scaledDim);
  32015. scaledDim = Math.abs(scaledDim);
  32016. textChunk.height += scaledDim;
  32017. }
  32018. if (scaledDim) {
  32019. textChunk.prevTransform = getCurrentTextTransform();
  32020. }
  32021. const glyphUnicode = glyph.unicode;
  32022. if (saveLastChar(glyphUnicode)) {
  32023. textChunk.str.push(" ");
  32024. }
  32025. textChunk.str.push(glyphUnicode);
  32026. if (charSpacing) {
  32027. if (!font.vertical) {
  32028. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  32029. } else {
  32030. textState.translateTextMatrix(0, -charSpacing);
  32031. }
  32032. }
  32033. }
  32034. }
  32035. function appendEOL() {
  32036. resetLastChars();
  32037. if (textContentItem.initialized) {
  32038. textContentItem.hasEOL = true;
  32039. flushTextContentItem();
  32040. } else {
  32041. textContent.items.push({
  32042. str: "",
  32043. dir: "ltr",
  32044. width: 0,
  32045. height: 0,
  32046. transform: getCurrentTextTransform(),
  32047. fontName: textState.loadedName,
  32048. hasEOL: true
  32049. });
  32050. }
  32051. }
  32052. function addFakeSpaces(width, transf, textOrientation) {
  32053. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  32054. if (textContentItem.initialized) {
  32055. resetLastChars();
  32056. textContentItem.str.push(" ");
  32057. }
  32058. return false;
  32059. }
  32060. const fontName = textContentItem.fontName;
  32061. let height = 0;
  32062. if (textContentItem.vertical) {
  32063. height = width;
  32064. width = 0;
  32065. }
  32066. flushTextContentItem();
  32067. resetLastChars();
  32068. pushWhitespace({
  32069. width: Math.abs(width),
  32070. height: Math.abs(height),
  32071. transform: transf || getCurrentTextTransform(),
  32072. fontName
  32073. });
  32074. return true;
  32075. }
  32076. function flushTextContentItem() {
  32077. if (!textContentItem.initialized || !textContentItem.str) {
  32078. return;
  32079. }
  32080. if (!textContentItem.vertical) {
  32081. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  32082. } else {
  32083. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  32084. }
  32085. textContent.items.push(runBidiTransform(textContentItem));
  32086. textContentItem.initialized = false;
  32087. textContentItem.str.length = 0;
  32088. }
  32089. function enqueueChunk(batch = false) {
  32090. const length = textContent.items.length;
  32091. if (length === 0) {
  32092. return;
  32093. }
  32094. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  32095. return;
  32096. }
  32097. sink.enqueue(textContent, length);
  32098. textContent.items = [];
  32099. textContent.styles = Object.create(null);
  32100. }
  32101. const timeSlotManager = new TimeSlotManager();
  32102. return new Promise(function promiseBody(resolve, reject) {
  32103. const next = function (promise) {
  32104. enqueueChunk(true);
  32105. Promise.all([promise, sink.ready]).then(function () {
  32106. try {
  32107. promiseBody(resolve, reject);
  32108. } catch (ex) {
  32109. reject(ex);
  32110. }
  32111. }, reject);
  32112. };
  32113. task.ensureNotTerminated();
  32114. timeSlotManager.reset();
  32115. const operation = {};
  32116. let stop,
  32117. name,
  32118. isValidName,
  32119. args = [];
  32120. while (!(stop = timeSlotManager.check())) {
  32121. args.length = 0;
  32122. operation.args = args;
  32123. if (!preprocessor.read(operation)) {
  32124. break;
  32125. }
  32126. const previousState = textState;
  32127. textState = stateManager.state;
  32128. const fn = operation.fn;
  32129. args = operation.args;
  32130. switch (fn | 0) {
  32131. case OPS.setFont:
  32132. const fontNameArg = args[0].name,
  32133. fontSizeArg = args[1];
  32134. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  32135. break;
  32136. }
  32137. flushTextContentItem();
  32138. textState.fontName = fontNameArg;
  32139. textState.fontSize = fontSizeArg;
  32140. next(handleSetFont(fontNameArg, null));
  32141. return;
  32142. case OPS.setTextRise:
  32143. textState.textRise = args[0];
  32144. break;
  32145. case OPS.setHScale:
  32146. textState.textHScale = args[0] / 100;
  32147. break;
  32148. case OPS.setLeading:
  32149. textState.leading = args[0];
  32150. break;
  32151. case OPS.moveText:
  32152. textState.translateTextLineMatrix(args[0], args[1]);
  32153. textState.textMatrix = textState.textLineMatrix.slice();
  32154. break;
  32155. case OPS.setLeadingMoveText:
  32156. textState.leading = -args[1];
  32157. textState.translateTextLineMatrix(args[0], args[1]);
  32158. textState.textMatrix = textState.textLineMatrix.slice();
  32159. break;
  32160. case OPS.nextLine:
  32161. textState.carriageReturn();
  32162. break;
  32163. case OPS.setTextMatrix:
  32164. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  32165. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  32166. updateAdvanceScale();
  32167. break;
  32168. case OPS.setCharSpacing:
  32169. textState.charSpacing = args[0];
  32170. break;
  32171. case OPS.setWordSpacing:
  32172. textState.wordSpacing = args[0];
  32173. break;
  32174. case OPS.beginText:
  32175. textState.textMatrix = IDENTITY_MATRIX.slice();
  32176. textState.textLineMatrix = IDENTITY_MATRIX.slice();
  32177. break;
  32178. case OPS.showSpacedText:
  32179. if (!stateManager.state.font) {
  32180. self.ensureStateFont(stateManager.state);
  32181. continue;
  32182. }
  32183. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  32184. const elements = args[0];
  32185. for (let i = 0, ii = elements.length; i < ii; i++) {
  32186. const item = elements[i];
  32187. if (typeof item === "string") {
  32188. showSpacedTextBuffer.push(item);
  32189. } else if (typeof item === "number" && item !== 0) {
  32190. const str = showSpacedTextBuffer.join("");
  32191. showSpacedTextBuffer.length = 0;
  32192. buildTextContentItem({
  32193. chars: str,
  32194. extraSpacing: item * spaceFactor
  32195. });
  32196. }
  32197. }
  32198. if (showSpacedTextBuffer.length > 0) {
  32199. const str = showSpacedTextBuffer.join("");
  32200. showSpacedTextBuffer.length = 0;
  32201. buildTextContentItem({
  32202. chars: str,
  32203. extraSpacing: 0
  32204. });
  32205. }
  32206. break;
  32207. case OPS.showText:
  32208. if (!stateManager.state.font) {
  32209. self.ensureStateFont(stateManager.state);
  32210. continue;
  32211. }
  32212. buildTextContentItem({
  32213. chars: args[0],
  32214. extraSpacing: 0
  32215. });
  32216. break;
  32217. case OPS.nextLineShowText:
  32218. if (!stateManager.state.font) {
  32219. self.ensureStateFont(stateManager.state);
  32220. continue;
  32221. }
  32222. textState.carriageReturn();
  32223. buildTextContentItem({
  32224. chars: args[0],
  32225. extraSpacing: 0
  32226. });
  32227. break;
  32228. case OPS.nextLineSetSpacingShowText:
  32229. if (!stateManager.state.font) {
  32230. self.ensureStateFont(stateManager.state);
  32231. continue;
  32232. }
  32233. textState.wordSpacing = args[0];
  32234. textState.charSpacing = args[1];
  32235. textState.carriageReturn();
  32236. buildTextContentItem({
  32237. chars: args[2],
  32238. extraSpacing: 0
  32239. });
  32240. break;
  32241. case OPS.paintXObject:
  32242. flushTextContentItem();
  32243. xobjs ??= resources.get("XObject") || Dict.empty;
  32244. isValidName = args[0] instanceof Name;
  32245. name = args[0].name;
  32246. if (isValidName && emptyXObjectCache.getByName(name)) {
  32247. break;
  32248. }
  32249. next(new Promise(function (resolveXObject, rejectXObject) {
  32250. if (!isValidName) {
  32251. throw new FormatError("XObject must be referred to by name.");
  32252. }
  32253. let xobj = xobjs.getRaw(name);
  32254. if (xobj instanceof Ref) {
  32255. if (emptyXObjectCache.getByRef(xobj)) {
  32256. resolveXObject();
  32257. return;
  32258. }
  32259. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  32260. if (globalImage) {
  32261. resolveXObject();
  32262. return;
  32263. }
  32264. xobj = xref.fetch(xobj);
  32265. }
  32266. if (!(xobj instanceof BaseStream)) {
  32267. throw new FormatError("XObject should be a stream");
  32268. }
  32269. const type = xobj.dict.get("Subtype");
  32270. if (!(type instanceof Name)) {
  32271. throw new FormatError("XObject should have a Name subtype");
  32272. }
  32273. if (type.name !== "Form") {
  32274. emptyXObjectCache.set(name, xobj.dict.objId, true);
  32275. resolveXObject();
  32276. return;
  32277. }
  32278. const currentState = stateManager.state.clone();
  32279. const xObjStateManager = new StateManager(currentState);
  32280. const matrix = lookupMatrix(xobj.dict.getArray("Matrix"), null);
  32281. if (matrix) {
  32282. xObjStateManager.transform(matrix);
  32283. }
  32284. enqueueChunk();
  32285. const sinkWrapper = {
  32286. enqueueInvoked: false,
  32287. enqueue(chunk, size) {
  32288. this.enqueueInvoked = true;
  32289. sink.enqueue(chunk, size);
  32290. },
  32291. get desiredSize() {
  32292. return sink.desiredSize;
  32293. },
  32294. get ready() {
  32295. return sink.ready;
  32296. }
  32297. };
  32298. self.getTextContent({
  32299. stream: xobj,
  32300. task,
  32301. resources: xobj.dict.get("Resources") || resources,
  32302. stateManager: xObjStateManager,
  32303. includeMarkedContent,
  32304. sink: sinkWrapper,
  32305. seenStyles,
  32306. viewBox,
  32307. lang,
  32308. markedContentData,
  32309. disableNormalization,
  32310. keepWhiteSpace
  32311. }).then(function () {
  32312. if (!sinkWrapper.enqueueInvoked) {
  32313. emptyXObjectCache.set(name, xobj.dict.objId, true);
  32314. }
  32315. resolveXObject();
  32316. }, rejectXObject);
  32317. }).catch(function (reason) {
  32318. if (reason instanceof AbortException) {
  32319. return;
  32320. }
  32321. if (self.options.ignoreErrors) {
  32322. warn(`getTextContent - ignoring XObject: "${reason}".`);
  32323. return;
  32324. }
  32325. throw reason;
  32326. }));
  32327. return;
  32328. case OPS.setGState:
  32329. isValidName = args[0] instanceof Name;
  32330. name = args[0].name;
  32331. if (isValidName && emptyGStateCache.getByName(name)) {
  32332. break;
  32333. }
  32334. next(new Promise(function (resolveGState, rejectGState) {
  32335. if (!isValidName) {
  32336. throw new FormatError("GState must be referred to by name.");
  32337. }
  32338. const extGState = resources.get("ExtGState");
  32339. if (!(extGState instanceof Dict)) {
  32340. throw new FormatError("ExtGState should be a dictionary.");
  32341. }
  32342. const gState = extGState.get(name);
  32343. if (!(gState instanceof Dict)) {
  32344. throw new FormatError("GState should be a dictionary.");
  32345. }
  32346. const gStateFont = gState.get("Font");
  32347. if (!gStateFont) {
  32348. emptyGStateCache.set(name, gState.objId, true);
  32349. resolveGState();
  32350. return;
  32351. }
  32352. flushTextContentItem();
  32353. textState.fontName = null;
  32354. textState.fontSize = gStateFont[1];
  32355. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  32356. }).catch(function (reason) {
  32357. if (reason instanceof AbortException) {
  32358. return;
  32359. }
  32360. if (self.options.ignoreErrors) {
  32361. warn(`getTextContent - ignoring ExtGState: "${reason}".`);
  32362. return;
  32363. }
  32364. throw reason;
  32365. }));
  32366. return;
  32367. case OPS.beginMarkedContent:
  32368. flushTextContentItem();
  32369. if (includeMarkedContent) {
  32370. markedContentData.level++;
  32371. textContent.items.push({
  32372. type: "beginMarkedContent",
  32373. tag: args[0] instanceof Name ? args[0].name : null
  32374. });
  32375. }
  32376. break;
  32377. case OPS.beginMarkedContentProps:
  32378. flushTextContentItem();
  32379. if (includeMarkedContent) {
  32380. markedContentData.level++;
  32381. let mcid = null;
  32382. if (args[1] instanceof Dict) {
  32383. mcid = args[1].get("MCID");
  32384. }
  32385. textContent.items.push({
  32386. type: "beginMarkedContentProps",
  32387. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mc${mcid}` : null,
  32388. tag: args[0] instanceof Name ? args[0].name : null
  32389. });
  32390. }
  32391. break;
  32392. case OPS.endMarkedContent:
  32393. flushTextContentItem();
  32394. if (includeMarkedContent) {
  32395. if (markedContentData.level === 0) {
  32396. break;
  32397. }
  32398. markedContentData.level--;
  32399. textContent.items.push({
  32400. type: "endMarkedContent"
  32401. });
  32402. }
  32403. break;
  32404. case OPS.restore:
  32405. if (previousState && (previousState.font !== textState.font || previousState.fontSize !== textState.fontSize || previousState.fontName !== textState.fontName)) {
  32406. flushTextContentItem();
  32407. }
  32408. break;
  32409. }
  32410. if (textContent.items.length >= sink.desiredSize) {
  32411. stop = true;
  32412. break;
  32413. }
  32414. }
  32415. if (stop) {
  32416. next(deferred);
  32417. return;
  32418. }
  32419. flushTextContentItem();
  32420. enqueueChunk();
  32421. resolve();
  32422. }).catch(reason => {
  32423. if (reason instanceof AbortException) {
  32424. return;
  32425. }
  32426. if (this.options.ignoreErrors) {
  32427. warn(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  32428. flushTextContentItem();
  32429. enqueueChunk();
  32430. return;
  32431. }
  32432. throw reason;
  32433. });
  32434. }
  32435. async extractDataStructures(dict, properties) {
  32436. const xref = this.xref;
  32437. let cidToGidBytes;
  32438. const toUnicodePromise = this.readToUnicode(properties.toUnicode);
  32439. if (properties.composite) {
  32440. const cidSystemInfo = dict.get("CIDSystemInfo");
  32441. if (cidSystemInfo instanceof Dict) {
  32442. properties.cidSystemInfo = {
  32443. registry: stringToPDFString(cidSystemInfo.get("Registry")),
  32444. ordering: stringToPDFString(cidSystemInfo.get("Ordering")),
  32445. supplement: cidSystemInfo.get("Supplement")
  32446. };
  32447. }
  32448. try {
  32449. const cidToGidMap = dict.get("CIDToGIDMap");
  32450. if (cidToGidMap instanceof BaseStream) {
  32451. cidToGidBytes = cidToGidMap.getBytes();
  32452. }
  32453. } catch (ex) {
  32454. if (!this.options.ignoreErrors) {
  32455. throw ex;
  32456. }
  32457. warn(`extractDataStructures - ignoring CIDToGIDMap data: "${ex}".`);
  32458. }
  32459. }
  32460. const differences = [];
  32461. let baseEncodingName = null;
  32462. let encoding;
  32463. if (dict.has("Encoding")) {
  32464. encoding = dict.get("Encoding");
  32465. if (encoding instanceof Dict) {
  32466. baseEncodingName = encoding.get("BaseEncoding");
  32467. baseEncodingName = baseEncodingName instanceof Name ? baseEncodingName.name : null;
  32468. if (encoding.has("Differences")) {
  32469. const diffEncoding = encoding.get("Differences");
  32470. let index = 0;
  32471. for (const entry of diffEncoding) {
  32472. const data = xref.fetchIfRef(entry);
  32473. if (typeof data === "number") {
  32474. index = data;
  32475. } else if (data instanceof Name) {
  32476. differences[index++] = data.name;
  32477. } else {
  32478. throw new FormatError(`Invalid entry in 'Differences' array: ${data}`);
  32479. }
  32480. }
  32481. }
  32482. } else if (encoding instanceof Name) {
  32483. baseEncodingName = encoding.name;
  32484. } else {
  32485. const msg = "Encoding is not a Name nor a Dict";
  32486. if (!this.options.ignoreErrors) {
  32487. throw new FormatError(msg);
  32488. }
  32489. warn(msg);
  32490. }
  32491. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  32492. baseEncodingName = null;
  32493. }
  32494. }
  32495. const nonEmbeddedFont = !properties.file || properties.isInternalFont,
  32496. isSymbolsFontName = getSymbolsFonts()[properties.name];
  32497. if (baseEncodingName && nonEmbeddedFont && isSymbolsFontName) {
  32498. baseEncodingName = null;
  32499. }
  32500. if (baseEncodingName) {
  32501. properties.defaultEncoding = getEncoding(baseEncodingName);
  32502. } else {
  32503. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  32504. const isNonsymbolicFont = !!(properties.flags & FontFlags.Nonsymbolic);
  32505. encoding = StandardEncoding;
  32506. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  32507. encoding = WinAnsiEncoding;
  32508. }
  32509. if (isSymbolicFont || isSymbolsFontName) {
  32510. encoding = MacRomanEncoding;
  32511. if (nonEmbeddedFont) {
  32512. if (/Symbol/i.test(properties.name)) {
  32513. encoding = SymbolSetEncoding;
  32514. } else if (/Dingbats/i.test(properties.name)) {
  32515. encoding = ZapfDingbatsEncoding;
  32516. } else if (/Wingdings/i.test(properties.name)) {
  32517. encoding = WinAnsiEncoding;
  32518. }
  32519. }
  32520. }
  32521. properties.defaultEncoding = encoding;
  32522. }
  32523. properties.differences = differences;
  32524. properties.baseEncodingName = baseEncodingName;
  32525. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  32526. properties.dict = dict;
  32527. properties.toUnicode = await toUnicodePromise;
  32528. const builtToUnicode = await this.buildToUnicode(properties);
  32529. properties.toUnicode = builtToUnicode;
  32530. if (cidToGidBytes) {
  32531. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  32532. }
  32533. return properties;
  32534. }
  32535. _simpleFontToUnicode(properties, forceGlyphs = false) {
  32536. assert(!properties.composite, "Must be a simple font.");
  32537. const toUnicode = [];
  32538. const encoding = properties.defaultEncoding.slice();
  32539. const baseEncodingName = properties.baseEncodingName;
  32540. const differences = properties.differences;
  32541. for (const charcode in differences) {
  32542. const glyphName = differences[charcode];
  32543. if (glyphName === ".notdef") {
  32544. continue;
  32545. }
  32546. encoding[charcode] = glyphName;
  32547. }
  32548. const glyphsUnicodeMap = getGlyphsUnicode();
  32549. for (const charcode in encoding) {
  32550. let glyphName = encoding[charcode];
  32551. if (glyphName === "") {
  32552. continue;
  32553. }
  32554. let unicode = glyphsUnicodeMap[glyphName];
  32555. if (unicode !== undefined) {
  32556. toUnicode[charcode] = String.fromCharCode(unicode);
  32557. continue;
  32558. }
  32559. let code = 0;
  32560. switch (glyphName[0]) {
  32561. case "G":
  32562. if (glyphName.length === 3) {
  32563. code = parseInt(glyphName.substring(1), 16);
  32564. }
  32565. break;
  32566. case "g":
  32567. if (glyphName.length === 5) {
  32568. code = parseInt(glyphName.substring(1), 16);
  32569. }
  32570. break;
  32571. case "C":
  32572. case "c":
  32573. if (glyphName.length >= 3 && glyphName.length <= 4) {
  32574. const codeStr = glyphName.substring(1);
  32575. if (forceGlyphs) {
  32576. code = parseInt(codeStr, 16);
  32577. break;
  32578. }
  32579. code = +codeStr;
  32580. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  32581. return this._simpleFontToUnicode(properties, true);
  32582. }
  32583. }
  32584. break;
  32585. case "u":
  32586. unicode = getUnicodeForGlyph(glyphName, glyphsUnicodeMap);
  32587. if (unicode !== -1) {
  32588. code = unicode;
  32589. }
  32590. break;
  32591. default:
  32592. switch (glyphName) {
  32593. case "f_h":
  32594. case "f_t":
  32595. case "T_h":
  32596. toUnicode[charcode] = glyphName.replaceAll("_", "");
  32597. continue;
  32598. }
  32599. break;
  32600. }
  32601. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  32602. if (baseEncodingName && code === +charcode) {
  32603. const baseEncoding = getEncoding(baseEncodingName);
  32604. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  32605. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  32606. continue;
  32607. }
  32608. }
  32609. toUnicode[charcode] = String.fromCodePoint(code);
  32610. }
  32611. }
  32612. return toUnicode;
  32613. }
  32614. async buildToUnicode(properties) {
  32615. properties.hasIncludedToUnicodeMap = properties.toUnicode?.length > 0;
  32616. if (properties.hasIncludedToUnicodeMap) {
  32617. if (!properties.composite && properties.hasEncoding) {
  32618. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  32619. }
  32620. return properties.toUnicode;
  32621. }
  32622. if (!properties.composite) {
  32623. return new ToUnicodeMap(this._simpleFontToUnicode(properties));
  32624. }
  32625. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof IdentityCMap) || properties.cidSystemInfo?.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
  32626. const {
  32627. registry,
  32628. ordering
  32629. } = properties.cidSystemInfo;
  32630. const ucs2CMapName = Name.get(`${registry}-${ordering}-UCS2`);
  32631. const ucs2CMap = await CMapFactory.create({
  32632. encoding: ucs2CMapName,
  32633. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  32634. useCMap: null
  32635. });
  32636. const toUnicode = [],
  32637. buf = [];
  32638. properties.cMap.forEach(function (charcode, cid) {
  32639. if (cid > 0xffff) {
  32640. throw new FormatError("Max size of CID is 65,535");
  32641. }
  32642. const ucs2 = ucs2CMap.lookup(cid);
  32643. if (ucs2) {
  32644. buf.length = 0;
  32645. for (let i = 0, ii = ucs2.length; i < ii; i += 2) {
  32646. buf.push((ucs2.charCodeAt(i) << 8) + ucs2.charCodeAt(i + 1));
  32647. }
  32648. toUnicode[charcode] = String.fromCharCode(...buf);
  32649. }
  32650. });
  32651. return new ToUnicodeMap(toUnicode);
  32652. }
  32653. return new IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  32654. }
  32655. async readToUnicode(cmapObj) {
  32656. if (!cmapObj) {
  32657. return null;
  32658. }
  32659. if (cmapObj instanceof Name) {
  32660. const cmap = await CMapFactory.create({
  32661. encoding: cmapObj,
  32662. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  32663. useCMap: null
  32664. });
  32665. if (cmap instanceof IdentityCMap) {
  32666. return new IdentityToUnicodeMap(0, 0xffff);
  32667. }
  32668. return new ToUnicodeMap(cmap.getMap());
  32669. }
  32670. if (cmapObj instanceof BaseStream) {
  32671. try {
  32672. const cmap = await CMapFactory.create({
  32673. encoding: cmapObj,
  32674. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  32675. useCMap: null
  32676. });
  32677. if (cmap instanceof IdentityCMap) {
  32678. return new IdentityToUnicodeMap(0, 0xffff);
  32679. }
  32680. const map = new Array(cmap.length);
  32681. cmap.forEach(function (charCode, token) {
  32682. if (typeof token === "number") {
  32683. map[charCode] = String.fromCodePoint(token);
  32684. return;
  32685. }
  32686. if (token.length % 2 !== 0) {
  32687. token = "\u0000" + token;
  32688. }
  32689. const str = [];
  32690. for (let k = 0; k < token.length; k += 2) {
  32691. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  32692. if ((w1 & 0xf800) !== 0xd800) {
  32693. str.push(w1);
  32694. continue;
  32695. }
  32696. k += 2;
  32697. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  32698. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  32699. }
  32700. map[charCode] = String.fromCodePoint(...str);
  32701. });
  32702. return new ToUnicodeMap(map);
  32703. } catch (reason) {
  32704. if (reason instanceof AbortException) {
  32705. return null;
  32706. }
  32707. if (this.options.ignoreErrors) {
  32708. warn(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  32709. return null;
  32710. }
  32711. throw reason;
  32712. }
  32713. }
  32714. return null;
  32715. }
  32716. readCidToGidMap(glyphsData, toUnicode) {
  32717. const result = [];
  32718. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  32719. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  32720. const code = j >> 1;
  32721. if (glyphID === 0 && !toUnicode.has(code)) {
  32722. continue;
  32723. }
  32724. result[code] = glyphID;
  32725. }
  32726. return result;
  32727. }
  32728. extractWidths(dict, descriptor, properties) {
  32729. const xref = this.xref;
  32730. let glyphsWidths = [];
  32731. let defaultWidth = 0;
  32732. const glyphsVMetrics = [];
  32733. let defaultVMetrics;
  32734. if (properties.composite) {
  32735. const dw = dict.get("DW");
  32736. defaultWidth = typeof dw === "number" ? Math.ceil(dw) : 1000;
  32737. const widths = dict.get("W");
  32738. if (Array.isArray(widths)) {
  32739. for (let i = 0, ii = widths.length; i < ii; i++) {
  32740. let start = xref.fetchIfRef(widths[i++]);
  32741. if (!Number.isInteger(start)) {
  32742. break;
  32743. }
  32744. const code = xref.fetchIfRef(widths[i]);
  32745. if (Array.isArray(code)) {
  32746. for (const c of code) {
  32747. const width = xref.fetchIfRef(c);
  32748. if (typeof width === "number") {
  32749. glyphsWidths[start] = width;
  32750. }
  32751. start++;
  32752. }
  32753. } else if (Number.isInteger(code)) {
  32754. const width = xref.fetchIfRef(widths[++i]);
  32755. if (typeof width !== "number") {
  32756. continue;
  32757. }
  32758. for (let j = start; j <= code; j++) {
  32759. glyphsWidths[j] = width;
  32760. }
  32761. } else {
  32762. break;
  32763. }
  32764. }
  32765. }
  32766. if (properties.vertical) {
  32767. const dw2 = dict.getArray("DW2");
  32768. let vmetrics = isNumberArray(dw2, 2) ? dw2 : [880, -1000];
  32769. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  32770. vmetrics = dict.get("W2");
  32771. if (Array.isArray(vmetrics)) {
  32772. for (let i = 0, ii = vmetrics.length; i < ii; i++) {
  32773. let start = xref.fetchIfRef(vmetrics[i++]);
  32774. if (!Number.isInteger(start)) {
  32775. break;
  32776. }
  32777. const code = xref.fetchIfRef(vmetrics[i]);
  32778. if (Array.isArray(code)) {
  32779. for (let j = 0, jj = code.length; j < jj; j++) {
  32780. const vmetric = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  32781. if (isNumberArray(vmetric, null)) {
  32782. glyphsVMetrics[start] = vmetric;
  32783. }
  32784. start++;
  32785. }
  32786. } else if (Number.isInteger(code)) {
  32787. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  32788. if (!isNumberArray(vmetric, null)) {
  32789. continue;
  32790. }
  32791. for (let j = start; j <= code; j++) {
  32792. glyphsVMetrics[j] = vmetric;
  32793. }
  32794. } else {
  32795. break;
  32796. }
  32797. }
  32798. }
  32799. }
  32800. } else {
  32801. const widths = dict.get("Widths");
  32802. if (Array.isArray(widths)) {
  32803. let j = properties.firstChar;
  32804. for (const w of widths) {
  32805. const width = xref.fetchIfRef(w);
  32806. if (typeof width === "number") {
  32807. glyphsWidths[j] = width;
  32808. }
  32809. j++;
  32810. }
  32811. const missingWidth = descriptor.get("MissingWidth");
  32812. defaultWidth = typeof missingWidth === "number" ? missingWidth : 0;
  32813. } else {
  32814. const baseFontName = dict.get("BaseFont");
  32815. if (baseFontName instanceof Name) {
  32816. const metrics = this.getBaseFontMetrics(baseFontName.name);
  32817. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  32818. defaultWidth = metrics.defaultWidth;
  32819. }
  32820. }
  32821. }
  32822. let isMonospace = true;
  32823. let firstWidth = defaultWidth;
  32824. for (const glyph in glyphsWidths) {
  32825. const glyphWidth = glyphsWidths[glyph];
  32826. if (!glyphWidth) {
  32827. continue;
  32828. }
  32829. if (!firstWidth) {
  32830. firstWidth = glyphWidth;
  32831. continue;
  32832. }
  32833. if (firstWidth !== glyphWidth) {
  32834. isMonospace = false;
  32835. break;
  32836. }
  32837. }
  32838. if (isMonospace) {
  32839. properties.flags |= FontFlags.FixedPitch;
  32840. } else {
  32841. properties.flags &= ~FontFlags.FixedPitch;
  32842. }
  32843. properties.defaultWidth = defaultWidth;
  32844. properties.widths = glyphsWidths;
  32845. properties.defaultVMetrics = defaultVMetrics;
  32846. properties.vmetrics = glyphsVMetrics;
  32847. }
  32848. isSerifFont(baseFontName) {
  32849. const fontNameWoStyle = baseFontName.split("-", 1)[0];
  32850. return fontNameWoStyle in getSerifFonts() || /serif/gi.test(fontNameWoStyle);
  32851. }
  32852. getBaseFontMetrics(name) {
  32853. let defaultWidth = 0;
  32854. let widths = Object.create(null);
  32855. let monospace = false;
  32856. const stdFontMap = getStdFontMap();
  32857. let lookupName = stdFontMap[name] || name;
  32858. const Metrics = getMetrics();
  32859. if (!(lookupName in Metrics)) {
  32860. lookupName = this.isSerifFont(name) ? "Times-Roman" : "Helvetica";
  32861. }
  32862. const glyphWidths = Metrics[lookupName];
  32863. if (typeof glyphWidths === "number") {
  32864. defaultWidth = glyphWidths;
  32865. monospace = true;
  32866. } else {
  32867. widths = glyphWidths();
  32868. }
  32869. return {
  32870. defaultWidth,
  32871. monospace,
  32872. widths
  32873. };
  32874. }
  32875. buildCharCodeToWidth(widthsByGlyphName, properties) {
  32876. const widths = Object.create(null);
  32877. const differences = properties.differences;
  32878. const encoding = properties.defaultEncoding;
  32879. for (let charCode = 0; charCode < 256; charCode++) {
  32880. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  32881. widths[charCode] = widthsByGlyphName[differences[charCode]];
  32882. continue;
  32883. }
  32884. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  32885. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  32886. continue;
  32887. }
  32888. }
  32889. return widths;
  32890. }
  32891. preEvaluateFont(dict) {
  32892. const baseDict = dict;
  32893. let type = dict.get("Subtype");
  32894. if (!(type instanceof Name)) {
  32895. throw new FormatError("invalid font Subtype");
  32896. }
  32897. let composite = false;
  32898. let hash;
  32899. if (type.name === "Type0") {
  32900. const df = dict.get("DescendantFonts");
  32901. if (!df) {
  32902. throw new FormatError("Descendant fonts are not specified");
  32903. }
  32904. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  32905. if (!(dict instanceof Dict)) {
  32906. throw new FormatError("Descendant font is not a dictionary.");
  32907. }
  32908. type = dict.get("Subtype");
  32909. if (!(type instanceof Name)) {
  32910. throw new FormatError("invalid font Subtype");
  32911. }
  32912. composite = true;
  32913. }
  32914. let firstChar = dict.get("FirstChar");
  32915. if (!Number.isInteger(firstChar)) {
  32916. firstChar = 0;
  32917. }
  32918. let lastChar = dict.get("LastChar");
  32919. if (!Number.isInteger(lastChar)) {
  32920. lastChar = composite ? 0xffff : 0xff;
  32921. }
  32922. const descriptor = dict.get("FontDescriptor");
  32923. const toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  32924. if (descriptor) {
  32925. hash = new MurmurHash3_64();
  32926. const encoding = baseDict.getRaw("Encoding");
  32927. if (encoding instanceof Name) {
  32928. hash.update(encoding.name);
  32929. } else if (encoding instanceof Ref) {
  32930. hash.update(encoding.toString());
  32931. } else if (encoding instanceof Dict) {
  32932. for (const entry of encoding.getRawValues()) {
  32933. if (entry instanceof Name) {
  32934. hash.update(entry.name);
  32935. } else if (entry instanceof Ref) {
  32936. hash.update(entry.toString());
  32937. } else if (Array.isArray(entry)) {
  32938. const diffLength = entry.length,
  32939. diffBuf = new Array(diffLength);
  32940. for (let j = 0; j < diffLength; j++) {
  32941. const diffEntry = entry[j];
  32942. if (diffEntry instanceof Name) {
  32943. diffBuf[j] = diffEntry.name;
  32944. } else if (typeof diffEntry === "number" || diffEntry instanceof Ref) {
  32945. diffBuf[j] = diffEntry.toString();
  32946. }
  32947. }
  32948. hash.update(diffBuf.join());
  32949. }
  32950. }
  32951. }
  32952. hash.update(`${firstChar}-${lastChar}`);
  32953. if (toUnicode instanceof BaseStream) {
  32954. const stream = toUnicode.str || toUnicode;
  32955. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  32956. hash.update(uint8array);
  32957. } else if (toUnicode instanceof Name) {
  32958. hash.update(toUnicode.name);
  32959. }
  32960. const widths = dict.get("Widths") || baseDict.get("Widths");
  32961. if (Array.isArray(widths)) {
  32962. const widthsBuf = [];
  32963. for (const entry of widths) {
  32964. if (typeof entry === "number" || entry instanceof Ref) {
  32965. widthsBuf.push(entry.toString());
  32966. }
  32967. }
  32968. hash.update(widthsBuf.join());
  32969. }
  32970. if (composite) {
  32971. hash.update("compositeFont");
  32972. const compositeWidths = dict.get("W") || baseDict.get("W");
  32973. if (Array.isArray(compositeWidths)) {
  32974. const widthsBuf = [];
  32975. for (const entry of compositeWidths) {
  32976. if (typeof entry === "number" || entry instanceof Ref) {
  32977. widthsBuf.push(entry.toString());
  32978. } else if (Array.isArray(entry)) {
  32979. const subWidthsBuf = [];
  32980. for (const element of entry) {
  32981. if (typeof element === "number" || element instanceof Ref) {
  32982. subWidthsBuf.push(element.toString());
  32983. }
  32984. }
  32985. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  32986. }
  32987. }
  32988. hash.update(widthsBuf.join());
  32989. }
  32990. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  32991. if (cidToGidMap instanceof Name) {
  32992. hash.update(cidToGidMap.name);
  32993. } else if (cidToGidMap instanceof Ref) {
  32994. hash.update(cidToGidMap.toString());
  32995. } else if (cidToGidMap instanceof BaseStream) {
  32996. hash.update(cidToGidMap.peekBytes());
  32997. }
  32998. }
  32999. }
  33000. return {
  33001. descriptor,
  33002. dict,
  33003. baseDict,
  33004. composite,
  33005. type: type.name,
  33006. firstChar,
  33007. lastChar,
  33008. toUnicode,
  33009. hash: hash ? hash.hexdigest() : ""
  33010. };
  33011. }
  33012. async translateFont({
  33013. descriptor,
  33014. dict,
  33015. baseDict,
  33016. composite,
  33017. type,
  33018. firstChar,
  33019. lastChar,
  33020. toUnicode,
  33021. cssFontInfo
  33022. }) {
  33023. const isType3Font = type === "Type3";
  33024. if (!descriptor) {
  33025. if (isType3Font) {
  33026. const bbox = lookupNormalRect(dict.getArray("FontBBox"), [0, 0, 0, 0]);
  33027. descriptor = new Dict(null);
  33028. descriptor.set("FontName", Name.get(type));
  33029. descriptor.set("FontBBox", bbox);
  33030. } else {
  33031. let baseFontName = dict.get("BaseFont");
  33032. if (!(baseFontName instanceof Name)) {
  33033. throw new FormatError("Base font is not specified");
  33034. }
  33035. baseFontName = baseFontName.name.replaceAll(/[,_]/g, "-");
  33036. const metrics = this.getBaseFontMetrics(baseFontName);
  33037. const fontNameWoStyle = baseFontName.split("-", 1)[0];
  33038. const flags = (this.isSerifFont(fontNameWoStyle) ? FontFlags.Serif : 0) | (metrics.monospace ? FontFlags.FixedPitch : 0) | (getSymbolsFonts()[fontNameWoStyle] ? FontFlags.Symbolic : FontFlags.Nonsymbolic);
  33039. const properties = {
  33040. type,
  33041. name: baseFontName,
  33042. loadedName: baseDict.loadedName,
  33043. systemFontInfo: null,
  33044. widths: metrics.widths,
  33045. defaultWidth: metrics.defaultWidth,
  33046. isSimulatedFlags: true,
  33047. flags,
  33048. firstChar,
  33049. lastChar,
  33050. toUnicode,
  33051. xHeight: 0,
  33052. capHeight: 0,
  33053. italicAngle: 0,
  33054. isType3Font
  33055. };
  33056. const widths = dict.get("Widths");
  33057. const standardFontName = getStandardFontName(baseFontName);
  33058. let file = null;
  33059. if (standardFontName) {
  33060. file = await this.fetchStandardFontData(standardFontName);
  33061. properties.isInternalFont = !!file;
  33062. }
  33063. if (!properties.isInternalFont && this.options.useSystemFonts) {
  33064. properties.systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, baseFontName, standardFontName, type);
  33065. }
  33066. const newProperties = await this.extractDataStructures(dict, properties);
  33067. if (Array.isArray(widths)) {
  33068. const glyphWidths = [];
  33069. let j = firstChar;
  33070. for (const w of widths) {
  33071. const width = this.xref.fetchIfRef(w);
  33072. if (typeof width === "number") {
  33073. glyphWidths[j] = width;
  33074. }
  33075. j++;
  33076. }
  33077. newProperties.widths = glyphWidths;
  33078. } else {
  33079. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  33080. }
  33081. return new Font(baseFontName, file, newProperties);
  33082. }
  33083. }
  33084. let fontName = descriptor.get("FontName");
  33085. let baseFont = dict.get("BaseFont");
  33086. if (typeof fontName === "string") {
  33087. fontName = Name.get(fontName);
  33088. }
  33089. if (typeof baseFont === "string") {
  33090. baseFont = Name.get(baseFont);
  33091. }
  33092. const fontNameStr = fontName?.name;
  33093. const baseFontStr = baseFont?.name;
  33094. if (!isType3Font && fontNameStr !== baseFontStr) {
  33095. info(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  33096. if (fontNameStr && baseFontStr && (baseFontStr.startsWith(fontNameStr) || !isKnownFontName(fontNameStr) && isKnownFontName(baseFontStr))) {
  33097. fontName = null;
  33098. }
  33099. }
  33100. fontName ||= baseFont;
  33101. if (!(fontName instanceof Name)) {
  33102. throw new FormatError("invalid font name");
  33103. }
  33104. let fontFile, subtype, length1, length2, length3;
  33105. try {
  33106. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  33107. if (fontFile) {
  33108. if (!(fontFile instanceof BaseStream)) {
  33109. throw new FormatError("FontFile should be a stream");
  33110. } else if (fontFile.isEmpty) {
  33111. throw new FormatError("FontFile is empty");
  33112. }
  33113. }
  33114. } catch (ex) {
  33115. if (!this.options.ignoreErrors) {
  33116. throw ex;
  33117. }
  33118. warn(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  33119. fontFile = null;
  33120. }
  33121. let isInternalFont = false;
  33122. let glyphScaleFactors = null;
  33123. let systemFontInfo = null;
  33124. if (fontFile) {
  33125. if (fontFile.dict) {
  33126. const subtypeEntry = fontFile.dict.get("Subtype");
  33127. if (subtypeEntry instanceof Name) {
  33128. subtype = subtypeEntry.name;
  33129. }
  33130. length1 = fontFile.dict.get("Length1");
  33131. length2 = fontFile.dict.get("Length2");
  33132. length3 = fontFile.dict.get("Length3");
  33133. }
  33134. } else if (cssFontInfo) {
  33135. const standardFontName = getXfaFontName(fontName.name);
  33136. if (standardFontName) {
  33137. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  33138. cssFontInfo.metrics = standardFontName.metrics || null;
  33139. glyphScaleFactors = standardFontName.factors || null;
  33140. fontFile = await this.fetchStandardFontData(standardFontName.name);
  33141. isInternalFont = !!fontFile;
  33142. baseDict = dict = getXfaFontDict(fontName.name);
  33143. composite = true;
  33144. }
  33145. } else if (!isType3Font) {
  33146. const standardFontName = getStandardFontName(fontName.name);
  33147. if (standardFontName) {
  33148. fontFile = await this.fetchStandardFontData(standardFontName);
  33149. isInternalFont = !!fontFile;
  33150. }
  33151. if (!isInternalFont && this.options.useSystemFonts) {
  33152. systemFontInfo = getFontSubstitution(this.systemFontCache, this.idFactory, this.options.standardFontDataUrl, fontName.name, standardFontName, type);
  33153. }
  33154. }
  33155. const fontMatrix = lookupMatrix(dict.getArray("FontMatrix"), FONT_IDENTITY_MATRIX);
  33156. const bbox = lookupNormalRect(descriptor.getArray("FontBBox") || dict.getArray("FontBBox"), undefined);
  33157. let ascent = descriptor.get("Ascent");
  33158. if (typeof ascent !== "number") {
  33159. ascent = undefined;
  33160. }
  33161. let descent = descriptor.get("Descent");
  33162. if (typeof descent !== "number") {
  33163. descent = undefined;
  33164. }
  33165. let xHeight = descriptor.get("XHeight");
  33166. if (typeof xHeight !== "number") {
  33167. xHeight = 0;
  33168. }
  33169. let capHeight = descriptor.get("CapHeight");
  33170. if (typeof capHeight !== "number") {
  33171. capHeight = 0;
  33172. }
  33173. let flags = descriptor.get("Flags");
  33174. if (!Number.isInteger(flags)) {
  33175. flags = 0;
  33176. }
  33177. let italicAngle = descriptor.get("ItalicAngle");
  33178. if (typeof italicAngle !== "number") {
  33179. italicAngle = 0;
  33180. }
  33181. const properties = {
  33182. type,
  33183. name: fontName.name,
  33184. subtype,
  33185. file: fontFile,
  33186. length1,
  33187. length2,
  33188. length3,
  33189. isInternalFont,
  33190. loadedName: baseDict.loadedName,
  33191. composite,
  33192. fixedPitch: false,
  33193. fontMatrix,
  33194. firstChar,
  33195. lastChar,
  33196. toUnicode,
  33197. bbox,
  33198. ascent,
  33199. descent,
  33200. xHeight,
  33201. capHeight,
  33202. flags,
  33203. italicAngle,
  33204. isType3Font,
  33205. cssFontInfo,
  33206. scaleFactors: glyphScaleFactors,
  33207. systemFontInfo
  33208. };
  33209. if (composite) {
  33210. const cidEncoding = baseDict.get("Encoding");
  33211. if (cidEncoding instanceof Name) {
  33212. properties.cidEncoding = cidEncoding.name;
  33213. }
  33214. const cMap = await CMapFactory.create({
  33215. encoding: cidEncoding,
  33216. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  33217. useCMap: null
  33218. });
  33219. properties.cMap = cMap;
  33220. properties.vertical = properties.cMap.vertical;
  33221. }
  33222. const newProperties = await this.extractDataStructures(dict, properties);
  33223. this.extractWidths(dict, descriptor, newProperties);
  33224. return new Font(fontName.name, fontFile, newProperties);
  33225. }
  33226. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  33227. function buildPath(fontChar) {
  33228. const glyphName = `${font.loadedName}_path_${fontChar}`;
  33229. try {
  33230. if (font.renderer.hasBuiltPath(fontChar)) {
  33231. return;
  33232. }
  33233. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  33234. } catch (reason) {
  33235. if (evaluatorOptions.ignoreErrors) {
  33236. warn(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  33237. return;
  33238. }
  33239. throw reason;
  33240. }
  33241. }
  33242. for (const glyph of glyphs) {
  33243. buildPath(glyph.fontChar);
  33244. const accent = glyph.accent;
  33245. if (accent?.fontChar) {
  33246. buildPath(accent.fontChar);
  33247. }
  33248. }
  33249. }
  33250. static get fallbackFontDict() {
  33251. const dict = new Dict();
  33252. dict.set("BaseFont", Name.get("Helvetica"));
  33253. dict.set("Type", Name.get("FallbackType"));
  33254. dict.set("Subtype", Name.get("FallbackType"));
  33255. dict.set("Encoding", Name.get("WinAnsiEncoding"));
  33256. return shadow(this, "fallbackFontDict", dict);
  33257. }
  33258. }
  33259. class TranslatedFont {
  33260. constructor({
  33261. loadedName,
  33262. font,
  33263. dict,
  33264. evaluatorOptions
  33265. }) {
  33266. this.loadedName = loadedName;
  33267. this.font = font;
  33268. this.dict = dict;
  33269. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  33270. this.type3Loaded = null;
  33271. this.type3Dependencies = font.isType3Font ? new Set() : null;
  33272. this.sent = false;
  33273. }
  33274. send(handler) {
  33275. if (this.sent) {
  33276. return;
  33277. }
  33278. this.sent = true;
  33279. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  33280. }
  33281. fallback(handler) {
  33282. if (!this.font.data) {
  33283. return;
  33284. }
  33285. this.font.disableFontFace = true;
  33286. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  33287. }
  33288. loadType3Data(evaluator, resources, task) {
  33289. if (this.type3Loaded) {
  33290. return this.type3Loaded;
  33291. }
  33292. if (!this.font.isType3Font) {
  33293. throw new Error("Must be a Type3 font.");
  33294. }
  33295. const type3Evaluator = evaluator.clone({
  33296. ignoreErrors: false
  33297. });
  33298. const type3FontRefs = new RefSet(evaluator.type3FontRefs);
  33299. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  33300. type3FontRefs.put(this.dict.objId);
  33301. }
  33302. type3Evaluator.type3FontRefs = type3FontRefs;
  33303. const translatedFont = this.font,
  33304. type3Dependencies = this.type3Dependencies;
  33305. let loadCharProcsPromise = Promise.resolve();
  33306. const charProcs = this.dict.get("CharProcs");
  33307. const fontResources = this.dict.get("Resources") || resources;
  33308. const charProcOperatorList = Object.create(null);
  33309. const fontBBox = Util.normalizeRect(translatedFont.bbox || [0, 0, 0, 0]),
  33310. width = fontBBox[2] - fontBBox[0],
  33311. height = fontBBox[3] - fontBBox[1];
  33312. const fontBBoxSize = Math.hypot(width, height);
  33313. for (const key of charProcs.getKeys()) {
  33314. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  33315. const glyphStream = charProcs.get(key);
  33316. const operatorList = new OperatorList();
  33317. return type3Evaluator.getOperatorList({
  33318. stream: glyphStream,
  33319. task,
  33320. resources: fontResources,
  33321. operatorList
  33322. }).then(() => {
  33323. if (operatorList.fnArray[0] === OPS.setCharWidthAndBounds) {
  33324. this._removeType3ColorOperators(operatorList, fontBBoxSize);
  33325. }
  33326. charProcOperatorList[key] = operatorList.getIR();
  33327. for (const dependency of operatorList.dependencies) {
  33328. type3Dependencies.add(dependency);
  33329. }
  33330. }).catch(function (reason) {
  33331. warn(`Type3 font resource "${key}" is not available.`);
  33332. const dummyOperatorList = new OperatorList();
  33333. charProcOperatorList[key] = dummyOperatorList.getIR();
  33334. });
  33335. });
  33336. }
  33337. this.type3Loaded = loadCharProcsPromise.then(() => {
  33338. translatedFont.charProcOperatorList = charProcOperatorList;
  33339. if (this._bbox) {
  33340. translatedFont.isCharBBox = true;
  33341. translatedFont.bbox = this._bbox;
  33342. }
  33343. });
  33344. return this.type3Loaded;
  33345. }
  33346. _removeType3ColorOperators(operatorList, fontBBoxSize = NaN) {
  33347. const charBBox = Util.normalizeRect(operatorList.argsArray[0].slice(2)),
  33348. width = charBBox[2] - charBBox[0],
  33349. height = charBBox[3] - charBBox[1];
  33350. const charBBoxSize = Math.hypot(width, height);
  33351. if (width === 0 || height === 0) {
  33352. operatorList.fnArray.splice(0, 1);
  33353. operatorList.argsArray.splice(0, 1);
  33354. } else if (fontBBoxSize === 0 || Math.round(charBBoxSize / fontBBoxSize) >= 10) {
  33355. if (!this._bbox) {
  33356. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  33357. }
  33358. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  33359. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  33360. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  33361. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  33362. }
  33363. let i = 0,
  33364. ii = operatorList.length;
  33365. while (i < ii) {
  33366. switch (operatorList.fnArray[i]) {
  33367. case OPS.setCharWidthAndBounds:
  33368. break;
  33369. case OPS.setStrokeColorSpace:
  33370. case OPS.setFillColorSpace:
  33371. case OPS.setStrokeColor:
  33372. case OPS.setStrokeColorN:
  33373. case OPS.setFillColor:
  33374. case OPS.setFillColorN:
  33375. case OPS.setStrokeGray:
  33376. case OPS.setFillGray:
  33377. case OPS.setStrokeRGBColor:
  33378. case OPS.setFillRGBColor:
  33379. case OPS.setStrokeCMYKColor:
  33380. case OPS.setFillCMYKColor:
  33381. case OPS.shadingFill:
  33382. case OPS.setRenderingIntent:
  33383. operatorList.fnArray.splice(i, 1);
  33384. operatorList.argsArray.splice(i, 1);
  33385. ii--;
  33386. continue;
  33387. case OPS.setGState:
  33388. const [gStateObj] = operatorList.argsArray[i];
  33389. let j = 0,
  33390. jj = gStateObj.length;
  33391. while (j < jj) {
  33392. const [gStateKey] = gStateObj[j];
  33393. switch (gStateKey) {
  33394. case "TR":
  33395. case "TR2":
  33396. case "HT":
  33397. case "BG":
  33398. case "BG2":
  33399. case "UCR":
  33400. case "UCR2":
  33401. gStateObj.splice(j, 1);
  33402. jj--;
  33403. continue;
  33404. }
  33405. j++;
  33406. }
  33407. break;
  33408. }
  33409. i++;
  33410. }
  33411. }
  33412. }
  33413. class StateManager {
  33414. constructor(initialState = new EvalState()) {
  33415. this.state = initialState;
  33416. this.stateStack = [];
  33417. }
  33418. save() {
  33419. const old = this.state;
  33420. this.stateStack.push(this.state);
  33421. this.state = old.clone();
  33422. }
  33423. restore() {
  33424. const prev = this.stateStack.pop();
  33425. if (prev) {
  33426. this.state = prev;
  33427. }
  33428. }
  33429. transform(args) {
  33430. this.state.ctm = Util.transform(this.state.ctm, args);
  33431. }
  33432. }
  33433. class TextState {
  33434. constructor() {
  33435. this.ctm = new Float32Array(IDENTITY_MATRIX);
  33436. this.fontName = null;
  33437. this.fontSize = 0;
  33438. this.loadedName = null;
  33439. this.font = null;
  33440. this.fontMatrix = FONT_IDENTITY_MATRIX;
  33441. this.textMatrix = IDENTITY_MATRIX.slice();
  33442. this.textLineMatrix = IDENTITY_MATRIX.slice();
  33443. this.charSpacing = 0;
  33444. this.wordSpacing = 0;
  33445. this.leading = 0;
  33446. this.textHScale = 1;
  33447. this.textRise = 0;
  33448. }
  33449. setTextMatrix(a, b, c, d, e, f) {
  33450. const m = this.textMatrix;
  33451. m[0] = a;
  33452. m[1] = b;
  33453. m[2] = c;
  33454. m[3] = d;
  33455. m[4] = e;
  33456. m[5] = f;
  33457. }
  33458. setTextLineMatrix(a, b, c, d, e, f) {
  33459. const m = this.textLineMatrix;
  33460. m[0] = a;
  33461. m[1] = b;
  33462. m[2] = c;
  33463. m[3] = d;
  33464. m[4] = e;
  33465. m[5] = f;
  33466. }
  33467. translateTextMatrix(x, y) {
  33468. const m = this.textMatrix;
  33469. m[4] = m[0] * x + m[2] * y + m[4];
  33470. m[5] = m[1] * x + m[3] * y + m[5];
  33471. }
  33472. translateTextLineMatrix(x, y) {
  33473. const m = this.textLineMatrix;
  33474. m[4] = m[0] * x + m[2] * y + m[4];
  33475. m[5] = m[1] * x + m[3] * y + m[5];
  33476. }
  33477. carriageReturn() {
  33478. this.translateTextLineMatrix(0, -this.leading);
  33479. this.textMatrix = this.textLineMatrix.slice();
  33480. }
  33481. clone() {
  33482. const clone = Object.create(this);
  33483. clone.textMatrix = this.textMatrix.slice();
  33484. clone.textLineMatrix = this.textLineMatrix.slice();
  33485. clone.fontMatrix = this.fontMatrix.slice();
  33486. return clone;
  33487. }
  33488. }
  33489. class EvalState {
  33490. constructor() {
  33491. this.ctm = new Float32Array(IDENTITY_MATRIX);
  33492. this.font = null;
  33493. this.textRenderingMode = TextRenderingMode.FILL;
  33494. this._fillColorSpace = ColorSpace.singletons.gray;
  33495. this._strokeColorSpace = ColorSpace.singletons.gray;
  33496. this.patternFillColorSpace = null;
  33497. this.patternStrokeColorSpace = null;
  33498. }
  33499. get fillColorSpace() {
  33500. return this._fillColorSpace;
  33501. }
  33502. set fillColorSpace(colorSpace) {
  33503. this._fillColorSpace = this.patternFillColorSpace = colorSpace;
  33504. }
  33505. get strokeColorSpace() {
  33506. return this._strokeColorSpace;
  33507. }
  33508. set strokeColorSpace(colorSpace) {
  33509. this._strokeColorSpace = this.patternStrokeColorSpace = colorSpace;
  33510. }
  33511. clone() {
  33512. return Object.create(this);
  33513. }
  33514. }
  33515. class EvaluatorPreprocessor {
  33516. static get opMap() {
  33517. return shadow(this, "opMap", Object.assign(Object.create(null), {
  33518. w: {
  33519. id: OPS.setLineWidth,
  33520. numArgs: 1,
  33521. variableArgs: false
  33522. },
  33523. J: {
  33524. id: OPS.setLineCap,
  33525. numArgs: 1,
  33526. variableArgs: false
  33527. },
  33528. j: {
  33529. id: OPS.setLineJoin,
  33530. numArgs: 1,
  33531. variableArgs: false
  33532. },
  33533. M: {
  33534. id: OPS.setMiterLimit,
  33535. numArgs: 1,
  33536. variableArgs: false
  33537. },
  33538. d: {
  33539. id: OPS.setDash,
  33540. numArgs: 2,
  33541. variableArgs: false
  33542. },
  33543. ri: {
  33544. id: OPS.setRenderingIntent,
  33545. numArgs: 1,
  33546. variableArgs: false
  33547. },
  33548. i: {
  33549. id: OPS.setFlatness,
  33550. numArgs: 1,
  33551. variableArgs: false
  33552. },
  33553. gs: {
  33554. id: OPS.setGState,
  33555. numArgs: 1,
  33556. variableArgs: false
  33557. },
  33558. q: {
  33559. id: OPS.save,
  33560. numArgs: 0,
  33561. variableArgs: false
  33562. },
  33563. Q: {
  33564. id: OPS.restore,
  33565. numArgs: 0,
  33566. variableArgs: false
  33567. },
  33568. cm: {
  33569. id: OPS.transform,
  33570. numArgs: 6,
  33571. variableArgs: false
  33572. },
  33573. m: {
  33574. id: OPS.moveTo,
  33575. numArgs: 2,
  33576. variableArgs: false
  33577. },
  33578. l: {
  33579. id: OPS.lineTo,
  33580. numArgs: 2,
  33581. variableArgs: false
  33582. },
  33583. c: {
  33584. id: OPS.curveTo,
  33585. numArgs: 6,
  33586. variableArgs: false
  33587. },
  33588. v: {
  33589. id: OPS.curveTo2,
  33590. numArgs: 4,
  33591. variableArgs: false
  33592. },
  33593. y: {
  33594. id: OPS.curveTo3,
  33595. numArgs: 4,
  33596. variableArgs: false
  33597. },
  33598. h: {
  33599. id: OPS.closePath,
  33600. numArgs: 0,
  33601. variableArgs: false
  33602. },
  33603. re: {
  33604. id: OPS.rectangle,
  33605. numArgs: 4,
  33606. variableArgs: false
  33607. },
  33608. S: {
  33609. id: OPS.stroke,
  33610. numArgs: 0,
  33611. variableArgs: false
  33612. },
  33613. s: {
  33614. id: OPS.closeStroke,
  33615. numArgs: 0,
  33616. variableArgs: false
  33617. },
  33618. f: {
  33619. id: OPS.fill,
  33620. numArgs: 0,
  33621. variableArgs: false
  33622. },
  33623. F: {
  33624. id: OPS.fill,
  33625. numArgs: 0,
  33626. variableArgs: false
  33627. },
  33628. "f*": {
  33629. id: OPS.eoFill,
  33630. numArgs: 0,
  33631. variableArgs: false
  33632. },
  33633. B: {
  33634. id: OPS.fillStroke,
  33635. numArgs: 0,
  33636. variableArgs: false
  33637. },
  33638. "B*": {
  33639. id: OPS.eoFillStroke,
  33640. numArgs: 0,
  33641. variableArgs: false
  33642. },
  33643. b: {
  33644. id: OPS.closeFillStroke,
  33645. numArgs: 0,
  33646. variableArgs: false
  33647. },
  33648. "b*": {
  33649. id: OPS.closeEOFillStroke,
  33650. numArgs: 0,
  33651. variableArgs: false
  33652. },
  33653. n: {
  33654. id: OPS.endPath,
  33655. numArgs: 0,
  33656. variableArgs: false
  33657. },
  33658. W: {
  33659. id: OPS.clip,
  33660. numArgs: 0,
  33661. variableArgs: false
  33662. },
  33663. "W*": {
  33664. id: OPS.eoClip,
  33665. numArgs: 0,
  33666. variableArgs: false
  33667. },
  33668. BT: {
  33669. id: OPS.beginText,
  33670. numArgs: 0,
  33671. variableArgs: false
  33672. },
  33673. ET: {
  33674. id: OPS.endText,
  33675. numArgs: 0,
  33676. variableArgs: false
  33677. },
  33678. Tc: {
  33679. id: OPS.setCharSpacing,
  33680. numArgs: 1,
  33681. variableArgs: false
  33682. },
  33683. Tw: {
  33684. id: OPS.setWordSpacing,
  33685. numArgs: 1,
  33686. variableArgs: false
  33687. },
  33688. Tz: {
  33689. id: OPS.setHScale,
  33690. numArgs: 1,
  33691. variableArgs: false
  33692. },
  33693. TL: {
  33694. id: OPS.setLeading,
  33695. numArgs: 1,
  33696. variableArgs: false
  33697. },
  33698. Tf: {
  33699. id: OPS.setFont,
  33700. numArgs: 2,
  33701. variableArgs: false
  33702. },
  33703. Tr: {
  33704. id: OPS.setTextRenderingMode,
  33705. numArgs: 1,
  33706. variableArgs: false
  33707. },
  33708. Ts: {
  33709. id: OPS.setTextRise,
  33710. numArgs: 1,
  33711. variableArgs: false
  33712. },
  33713. Td: {
  33714. id: OPS.moveText,
  33715. numArgs: 2,
  33716. variableArgs: false
  33717. },
  33718. TD: {
  33719. id: OPS.setLeadingMoveText,
  33720. numArgs: 2,
  33721. variableArgs: false
  33722. },
  33723. Tm: {
  33724. id: OPS.setTextMatrix,
  33725. numArgs: 6,
  33726. variableArgs: false
  33727. },
  33728. "T*": {
  33729. id: OPS.nextLine,
  33730. numArgs: 0,
  33731. variableArgs: false
  33732. },
  33733. Tj: {
  33734. id: OPS.showText,
  33735. numArgs: 1,
  33736. variableArgs: false
  33737. },
  33738. TJ: {
  33739. id: OPS.showSpacedText,
  33740. numArgs: 1,
  33741. variableArgs: false
  33742. },
  33743. "'": {
  33744. id: OPS.nextLineShowText,
  33745. numArgs: 1,
  33746. variableArgs: false
  33747. },
  33748. '"': {
  33749. id: OPS.nextLineSetSpacingShowText,
  33750. numArgs: 3,
  33751. variableArgs: false
  33752. },
  33753. d0: {
  33754. id: OPS.setCharWidth,
  33755. numArgs: 2,
  33756. variableArgs: false
  33757. },
  33758. d1: {
  33759. id: OPS.setCharWidthAndBounds,
  33760. numArgs: 6,
  33761. variableArgs: false
  33762. },
  33763. CS: {
  33764. id: OPS.setStrokeColorSpace,
  33765. numArgs: 1,
  33766. variableArgs: false
  33767. },
  33768. cs: {
  33769. id: OPS.setFillColorSpace,
  33770. numArgs: 1,
  33771. variableArgs: false
  33772. },
  33773. SC: {
  33774. id: OPS.setStrokeColor,
  33775. numArgs: 4,
  33776. variableArgs: true
  33777. },
  33778. SCN: {
  33779. id: OPS.setStrokeColorN,
  33780. numArgs: 33,
  33781. variableArgs: true
  33782. },
  33783. sc: {
  33784. id: OPS.setFillColor,
  33785. numArgs: 4,
  33786. variableArgs: true
  33787. },
  33788. scn: {
  33789. id: OPS.setFillColorN,
  33790. numArgs: 33,
  33791. variableArgs: true
  33792. },
  33793. G: {
  33794. id: OPS.setStrokeGray,
  33795. numArgs: 1,
  33796. variableArgs: false
  33797. },
  33798. g: {
  33799. id: OPS.setFillGray,
  33800. numArgs: 1,
  33801. variableArgs: false
  33802. },
  33803. RG: {
  33804. id: OPS.setStrokeRGBColor,
  33805. numArgs: 3,
  33806. variableArgs: false
  33807. },
  33808. rg: {
  33809. id: OPS.setFillRGBColor,
  33810. numArgs: 3,
  33811. variableArgs: false
  33812. },
  33813. K: {
  33814. id: OPS.setStrokeCMYKColor,
  33815. numArgs: 4,
  33816. variableArgs: false
  33817. },
  33818. k: {
  33819. id: OPS.setFillCMYKColor,
  33820. numArgs: 4,
  33821. variableArgs: false
  33822. },
  33823. sh: {
  33824. id: OPS.shadingFill,
  33825. numArgs: 1,
  33826. variableArgs: false
  33827. },
  33828. BI: {
  33829. id: OPS.beginInlineImage,
  33830. numArgs: 0,
  33831. variableArgs: false
  33832. },
  33833. ID: {
  33834. id: OPS.beginImageData,
  33835. numArgs: 0,
  33836. variableArgs: false
  33837. },
  33838. EI: {
  33839. id: OPS.endInlineImage,
  33840. numArgs: 1,
  33841. variableArgs: false
  33842. },
  33843. Do: {
  33844. id: OPS.paintXObject,
  33845. numArgs: 1,
  33846. variableArgs: false
  33847. },
  33848. MP: {
  33849. id: OPS.markPoint,
  33850. numArgs: 1,
  33851. variableArgs: false
  33852. },
  33853. DP: {
  33854. id: OPS.markPointProps,
  33855. numArgs: 2,
  33856. variableArgs: false
  33857. },
  33858. BMC: {
  33859. id: OPS.beginMarkedContent,
  33860. numArgs: 1,
  33861. variableArgs: false
  33862. },
  33863. BDC: {
  33864. id: OPS.beginMarkedContentProps,
  33865. numArgs: 2,
  33866. variableArgs: false
  33867. },
  33868. EMC: {
  33869. id: OPS.endMarkedContent,
  33870. numArgs: 0,
  33871. variableArgs: false
  33872. },
  33873. BX: {
  33874. id: OPS.beginCompat,
  33875. numArgs: 0,
  33876. variableArgs: false
  33877. },
  33878. EX: {
  33879. id: OPS.endCompat,
  33880. numArgs: 0,
  33881. variableArgs: false
  33882. },
  33883. BM: null,
  33884. BD: null,
  33885. true: null,
  33886. fa: null,
  33887. fal: null,
  33888. fals: null,
  33889. false: null,
  33890. nu: null,
  33891. nul: null,
  33892. null: null
  33893. }));
  33894. }
  33895. static MAX_INVALID_PATH_OPS = 10;
  33896. constructor(stream, xref, stateManager = new StateManager()) {
  33897. this.parser = new Parser({
  33898. lexer: new Lexer(stream, EvaluatorPreprocessor.opMap),
  33899. xref
  33900. });
  33901. this.stateManager = stateManager;
  33902. this.nonProcessedArgs = [];
  33903. this._isPathOp = false;
  33904. this._numInvalidPathOPS = 0;
  33905. }
  33906. get savedStatesDepth() {
  33907. return this.stateManager.stateStack.length;
  33908. }
  33909. read(operation) {
  33910. let args = operation.args;
  33911. while (true) {
  33912. const obj = this.parser.getObj();
  33913. if (obj instanceof Cmd) {
  33914. const cmd = obj.cmd;
  33915. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  33916. if (!opSpec) {
  33917. warn(`Unknown command "${cmd}".`);
  33918. continue;
  33919. }
  33920. const fn = opSpec.id;
  33921. const numArgs = opSpec.numArgs;
  33922. let argsLength = args !== null ? args.length : 0;
  33923. if (!this._isPathOp) {
  33924. this._numInvalidPathOPS = 0;
  33925. }
  33926. this._isPathOp = fn >= OPS.moveTo && fn <= OPS.endPath;
  33927. if (!opSpec.variableArgs) {
  33928. if (argsLength !== numArgs) {
  33929. const nonProcessedArgs = this.nonProcessedArgs;
  33930. while (argsLength > numArgs) {
  33931. nonProcessedArgs.push(args.shift());
  33932. argsLength--;
  33933. }
  33934. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  33935. if (args === null) {
  33936. args = [];
  33937. }
  33938. args.unshift(nonProcessedArgs.pop());
  33939. argsLength++;
  33940. }
  33941. }
  33942. if (argsLength < numArgs) {
  33943. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  33944. if (this._isPathOp && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  33945. throw new FormatError(`Invalid ${partialMsg}`);
  33946. }
  33947. warn(`Skipping ${partialMsg}`);
  33948. if (args !== null) {
  33949. args.length = 0;
  33950. }
  33951. continue;
  33952. }
  33953. } else if (argsLength > numArgs) {
  33954. info(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  33955. }
  33956. this.preprocessCommand(fn, args);
  33957. operation.fn = fn;
  33958. operation.args = args;
  33959. return true;
  33960. }
  33961. if (obj === EOF) {
  33962. return false;
  33963. }
  33964. if (obj !== null) {
  33965. if (args === null) {
  33966. args = [];
  33967. }
  33968. args.push(obj);
  33969. if (args.length > 33) {
  33970. throw new FormatError("Too many arguments");
  33971. }
  33972. }
  33973. }
  33974. }
  33975. preprocessCommand(fn, args) {
  33976. switch (fn | 0) {
  33977. case OPS.save:
  33978. this.stateManager.save();
  33979. break;
  33980. case OPS.restore:
  33981. this.stateManager.restore();
  33982. break;
  33983. case OPS.transform:
  33984. this.stateManager.transform(args);
  33985. break;
  33986. }
  33987. }
  33988. }
  33989. ;// ./src/core/default_appearance.js
  33990. class DefaultAppearanceEvaluator extends EvaluatorPreprocessor {
  33991. constructor(str) {
  33992. super(new StringStream(str));
  33993. }
  33994. parse() {
  33995. const operation = {
  33996. fn: 0,
  33997. args: []
  33998. };
  33999. const result = {
  34000. fontSize: 0,
  34001. fontName: "",
  34002. fontColor: new Uint8ClampedArray(3)
  34003. };
  34004. try {
  34005. while (true) {
  34006. operation.args.length = 0;
  34007. if (!this.read(operation)) {
  34008. break;
  34009. }
  34010. if (this.savedStatesDepth !== 0) {
  34011. continue;
  34012. }
  34013. const {
  34014. fn,
  34015. args
  34016. } = operation;
  34017. switch (fn | 0) {
  34018. case OPS.setFont:
  34019. const [fontName, fontSize] = args;
  34020. if (fontName instanceof Name) {
  34021. result.fontName = fontName.name;
  34022. }
  34023. if (typeof fontSize === "number" && fontSize > 0) {
  34024. result.fontSize = fontSize;
  34025. }
  34026. break;
  34027. case OPS.setFillRGBColor:
  34028. ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  34029. break;
  34030. case OPS.setFillGray:
  34031. ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  34032. break;
  34033. case OPS.setFillCMYKColor:
  34034. ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  34035. break;
  34036. }
  34037. }
  34038. } catch (reason) {
  34039. warn(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  34040. }
  34041. return result;
  34042. }
  34043. }
  34044. function parseDefaultAppearance(str) {
  34045. return new DefaultAppearanceEvaluator(str).parse();
  34046. }
  34047. class AppearanceStreamEvaluator extends EvaluatorPreprocessor {
  34048. constructor(stream, evaluatorOptions, xref) {
  34049. super(stream);
  34050. this.stream = stream;
  34051. this.evaluatorOptions = evaluatorOptions;
  34052. this.xref = xref;
  34053. this.resources = stream.dict?.get("Resources");
  34054. }
  34055. parse() {
  34056. const operation = {
  34057. fn: 0,
  34058. args: []
  34059. };
  34060. let result = {
  34061. scaleFactor: 1,
  34062. fontSize: 0,
  34063. fontName: "",
  34064. fontColor: new Uint8ClampedArray(3),
  34065. fillColorSpace: ColorSpace.singletons.gray
  34066. };
  34067. let breakLoop = false;
  34068. const stack = [];
  34069. try {
  34070. while (true) {
  34071. operation.args.length = 0;
  34072. if (breakLoop || !this.read(operation)) {
  34073. break;
  34074. }
  34075. const {
  34076. fn,
  34077. args
  34078. } = operation;
  34079. switch (fn | 0) {
  34080. case OPS.save:
  34081. stack.push({
  34082. scaleFactor: result.scaleFactor,
  34083. fontSize: result.fontSize,
  34084. fontName: result.fontName,
  34085. fontColor: result.fontColor.slice(),
  34086. fillColorSpace: result.fillColorSpace
  34087. });
  34088. break;
  34089. case OPS.restore:
  34090. result = stack.pop() || result;
  34091. break;
  34092. case OPS.setTextMatrix:
  34093. result.scaleFactor *= Math.hypot(args[0], args[1]);
  34094. break;
  34095. case OPS.setFont:
  34096. const [fontName, fontSize] = args;
  34097. if (fontName instanceof Name) {
  34098. result.fontName = fontName.name;
  34099. }
  34100. if (typeof fontSize === "number" && fontSize > 0) {
  34101. result.fontSize = fontSize * result.scaleFactor;
  34102. }
  34103. break;
  34104. case OPS.setFillColorSpace:
  34105. result.fillColorSpace = ColorSpace.parse({
  34106. cs: args[0],
  34107. xref: this.xref,
  34108. resources: this.resources,
  34109. pdfFunctionFactory: this._pdfFunctionFactory,
  34110. localColorSpaceCache: this._localColorSpaceCache
  34111. });
  34112. break;
  34113. case OPS.setFillColor:
  34114. const cs = result.fillColorSpace;
  34115. cs.getRgbItem(args, 0, result.fontColor, 0);
  34116. break;
  34117. case OPS.setFillRGBColor:
  34118. ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  34119. break;
  34120. case OPS.setFillGray:
  34121. ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  34122. break;
  34123. case OPS.setFillCMYKColor:
  34124. ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  34125. break;
  34126. case OPS.showText:
  34127. case OPS.showSpacedText:
  34128. case OPS.nextLineShowText:
  34129. case OPS.nextLineSetSpacingShowText:
  34130. breakLoop = true;
  34131. break;
  34132. }
  34133. }
  34134. } catch (reason) {
  34135. warn(`parseAppearanceStream - ignoring errors: "${reason}".`);
  34136. }
  34137. this.stream.reset();
  34138. delete result.scaleFactor;
  34139. delete result.fillColorSpace;
  34140. return result;
  34141. }
  34142. get _localColorSpaceCache() {
  34143. return shadow(this, "_localColorSpaceCache", new LocalColorSpaceCache());
  34144. }
  34145. get _pdfFunctionFactory() {
  34146. const pdfFunctionFactory = new PDFFunctionFactory({
  34147. xref: this.xref,
  34148. isEvalSupported: this.evaluatorOptions.isEvalSupported
  34149. });
  34150. return shadow(this, "_pdfFunctionFactory", pdfFunctionFactory);
  34151. }
  34152. }
  34153. function parseAppearanceStream(stream, evaluatorOptions, xref) {
  34154. return new AppearanceStreamEvaluator(stream, evaluatorOptions, xref).parse();
  34155. }
  34156. function getPdfColor(color, isFill) {
  34157. if (color[0] === color[1] && color[1] === color[2]) {
  34158. const gray = color[0] / 255;
  34159. return `${numberToString(gray)} ${isFill ? "g" : "G"}`;
  34160. }
  34161. return Array.from(color, c => numberToString(c / 255)).join(" ") + ` ${isFill ? "rg" : "RG"}`;
  34162. }
  34163. function createDefaultAppearance({
  34164. fontSize,
  34165. fontName,
  34166. fontColor
  34167. }) {
  34168. return `/${escapePDFName(fontName)} ${fontSize} Tf ${getPdfColor(fontColor, true)}`;
  34169. }
  34170. class FakeUnicodeFont {
  34171. constructor(xref, fontFamily) {
  34172. this.xref = xref;
  34173. this.widths = null;
  34174. this.firstChar = Infinity;
  34175. this.lastChar = -Infinity;
  34176. this.fontFamily = fontFamily;
  34177. const canvas = new OffscreenCanvas(1, 1);
  34178. this.ctxMeasure = canvas.getContext("2d", {
  34179. willReadFrequently: true
  34180. });
  34181. if (!FakeUnicodeFont._fontNameId) {
  34182. FakeUnicodeFont._fontNameId = 1;
  34183. }
  34184. this.fontName = Name.get(`InvalidPDFjsFont_${fontFamily}_${FakeUnicodeFont._fontNameId++}`);
  34185. }
  34186. get fontDescriptorRef() {
  34187. if (!FakeUnicodeFont._fontDescriptorRef) {
  34188. const fontDescriptor = new Dict(this.xref);
  34189. fontDescriptor.set("Type", Name.get("FontDescriptor"));
  34190. fontDescriptor.set("FontName", this.fontName);
  34191. fontDescriptor.set("FontFamily", "MyriadPro Regular");
  34192. fontDescriptor.set("FontBBox", [0, 0, 0, 0]);
  34193. fontDescriptor.set("FontStretch", Name.get("Normal"));
  34194. fontDescriptor.set("FontWeight", 400);
  34195. fontDescriptor.set("ItalicAngle", 0);
  34196. FakeUnicodeFont._fontDescriptorRef = this.xref.getNewPersistentRef(fontDescriptor);
  34197. }
  34198. return FakeUnicodeFont._fontDescriptorRef;
  34199. }
  34200. get descendantFontRef() {
  34201. const descendantFont = new Dict(this.xref);
  34202. descendantFont.set("BaseFont", this.fontName);
  34203. descendantFont.set("Type", Name.get("Font"));
  34204. descendantFont.set("Subtype", Name.get("CIDFontType0"));
  34205. descendantFont.set("CIDToGIDMap", Name.get("Identity"));
  34206. descendantFont.set("FirstChar", this.firstChar);
  34207. descendantFont.set("LastChar", this.lastChar);
  34208. descendantFont.set("FontDescriptor", this.fontDescriptorRef);
  34209. descendantFont.set("DW", 1000);
  34210. const widths = [];
  34211. const chars = [...this.widths.entries()].sort();
  34212. let currentChar = null;
  34213. let currentWidths = null;
  34214. for (const [char, width] of chars) {
  34215. if (!currentChar) {
  34216. currentChar = char;
  34217. currentWidths = [width];
  34218. continue;
  34219. }
  34220. if (char === currentChar + currentWidths.length) {
  34221. currentWidths.push(width);
  34222. } else {
  34223. widths.push(currentChar, currentWidths);
  34224. currentChar = char;
  34225. currentWidths = [width];
  34226. }
  34227. }
  34228. if (currentChar) {
  34229. widths.push(currentChar, currentWidths);
  34230. }
  34231. descendantFont.set("W", widths);
  34232. const cidSystemInfo = new Dict(this.xref);
  34233. cidSystemInfo.set("Ordering", "Identity");
  34234. cidSystemInfo.set("Registry", "Adobe");
  34235. cidSystemInfo.set("Supplement", 0);
  34236. descendantFont.set("CIDSystemInfo", cidSystemInfo);
  34237. return this.xref.getNewPersistentRef(descendantFont);
  34238. }
  34239. get baseFontRef() {
  34240. const baseFont = new Dict(this.xref);
  34241. baseFont.set("BaseFont", this.fontName);
  34242. baseFont.set("Type", Name.get("Font"));
  34243. baseFont.set("Subtype", Name.get("Type0"));
  34244. baseFont.set("Encoding", Name.get("Identity-H"));
  34245. baseFont.set("DescendantFonts", [this.descendantFontRef]);
  34246. baseFont.set("ToUnicode", Name.get("Identity-H"));
  34247. return this.xref.getNewPersistentRef(baseFont);
  34248. }
  34249. get resources() {
  34250. const resources = new Dict(this.xref);
  34251. const font = new Dict(this.xref);
  34252. font.set(this.fontName.name, this.baseFontRef);
  34253. resources.set("Font", font);
  34254. return resources;
  34255. }
  34256. _createContext() {
  34257. this.widths = new Map();
  34258. this.ctxMeasure.font = `1000px ${this.fontFamily}`;
  34259. return this.ctxMeasure;
  34260. }
  34261. createFontResources(text) {
  34262. const ctx = this._createContext();
  34263. for (const line of text.split(/\r\n?|\n/)) {
  34264. for (const char of line.split("")) {
  34265. const code = char.charCodeAt(0);
  34266. if (this.widths.has(code)) {
  34267. continue;
  34268. }
  34269. const metrics = ctx.measureText(char);
  34270. const width = Math.ceil(metrics.width);
  34271. this.widths.set(code, width);
  34272. this.firstChar = Math.min(code, this.firstChar);
  34273. this.lastChar = Math.max(code, this.lastChar);
  34274. }
  34275. }
  34276. return this.resources;
  34277. }
  34278. static getFirstPositionInfo(rect, rotation, fontSize) {
  34279. const [x1, y1, x2, y2] = rect;
  34280. let w = x2 - x1;
  34281. let h = y2 - y1;
  34282. if (rotation % 180 !== 0) {
  34283. [w, h] = [h, w];
  34284. }
  34285. const lineHeight = LINE_FACTOR * fontSize;
  34286. const lineDescent = LINE_DESCENT_FACTOR * fontSize;
  34287. return {
  34288. coords: [0, h + lineDescent - lineHeight],
  34289. bbox: [0, 0, w, h],
  34290. matrix: rotation !== 0 ? getRotationMatrix(rotation, h, lineHeight) : undefined
  34291. };
  34292. }
  34293. createAppearance(text, rect, rotation, fontSize, bgColor, strokeAlpha) {
  34294. const ctx = this._createContext();
  34295. const lines = [];
  34296. let maxWidth = -Infinity;
  34297. for (const line of text.split(/\r\n?|\n/)) {
  34298. lines.push(line);
  34299. const lineWidth = ctx.measureText(line).width;
  34300. maxWidth = Math.max(maxWidth, lineWidth);
  34301. for (const code of codePointIter(line)) {
  34302. const char = String.fromCodePoint(code);
  34303. let width = this.widths.get(code);
  34304. if (width === undefined) {
  34305. const metrics = ctx.measureText(char);
  34306. width = Math.ceil(metrics.width);
  34307. this.widths.set(code, width);
  34308. this.firstChar = Math.min(code, this.firstChar);
  34309. this.lastChar = Math.max(code, this.lastChar);
  34310. }
  34311. }
  34312. }
  34313. maxWidth *= fontSize / 1000;
  34314. const [x1, y1, x2, y2] = rect;
  34315. let w = x2 - x1;
  34316. let h = y2 - y1;
  34317. if (rotation % 180 !== 0) {
  34318. [w, h] = [h, w];
  34319. }
  34320. let hscale = 1;
  34321. if (maxWidth > w) {
  34322. hscale = w / maxWidth;
  34323. }
  34324. let vscale = 1;
  34325. const lineHeight = LINE_FACTOR * fontSize;
  34326. const lineDescent = LINE_DESCENT_FACTOR * fontSize;
  34327. const maxHeight = lineHeight * lines.length;
  34328. if (maxHeight > h) {
  34329. vscale = h / maxHeight;
  34330. }
  34331. const fscale = Math.min(hscale, vscale);
  34332. const newFontSize = fontSize * fscale;
  34333. const buffer = ["q", `0 0 ${numberToString(w)} ${numberToString(h)} re W n`, `BT`, `1 0 0 1 0 ${numberToString(h + lineDescent)} Tm 0 Tc ${getPdfColor(bgColor, true)}`, `/${this.fontName.name} ${numberToString(newFontSize)} Tf`];
  34334. const {
  34335. resources
  34336. } = this;
  34337. strokeAlpha = typeof strokeAlpha === "number" && strokeAlpha >= 0 && strokeAlpha <= 1 ? strokeAlpha : 1;
  34338. if (strokeAlpha !== 1) {
  34339. buffer.push("/R0 gs");
  34340. const extGState = new Dict(this.xref);
  34341. const r0 = new Dict(this.xref);
  34342. r0.set("ca", strokeAlpha);
  34343. r0.set("CA", strokeAlpha);
  34344. r0.set("Type", Name.get("ExtGState"));
  34345. extGState.set("R0", r0);
  34346. resources.set("ExtGState", extGState);
  34347. }
  34348. const vShift = numberToString(lineHeight);
  34349. for (const line of lines) {
  34350. buffer.push(`0 -${vShift} Td <${stringToUTF16HexString(line)}> Tj`);
  34351. }
  34352. buffer.push("ET", "Q");
  34353. const appearance = buffer.join("\n");
  34354. const appearanceStreamDict = new Dict(this.xref);
  34355. appearanceStreamDict.set("Subtype", Name.get("Form"));
  34356. appearanceStreamDict.set("Type", Name.get("XObject"));
  34357. appearanceStreamDict.set("BBox", [0, 0, w, h]);
  34358. appearanceStreamDict.set("Length", appearance.length);
  34359. appearanceStreamDict.set("Resources", resources);
  34360. if (rotation) {
  34361. const matrix = getRotationMatrix(rotation, w, h);
  34362. appearanceStreamDict.set("Matrix", matrix);
  34363. }
  34364. const ap = new StringStream(appearance);
  34365. ap.dict = appearanceStreamDict;
  34366. return ap;
  34367. }
  34368. }
  34369. ;// ./src/core/name_number_tree.js
  34370. class NameOrNumberTree {
  34371. constructor(root, xref, type) {
  34372. this.root = root;
  34373. this.xref = xref;
  34374. this._type = type;
  34375. }
  34376. getAll() {
  34377. const map = new Map();
  34378. if (!this.root) {
  34379. return map;
  34380. }
  34381. const xref = this.xref;
  34382. const processed = new RefSet();
  34383. processed.put(this.root);
  34384. const queue = [this.root];
  34385. while (queue.length > 0) {
  34386. const obj = xref.fetchIfRef(queue.shift());
  34387. if (!(obj instanceof Dict)) {
  34388. continue;
  34389. }
  34390. if (obj.has("Kids")) {
  34391. const kids = obj.get("Kids");
  34392. if (!Array.isArray(kids)) {
  34393. continue;
  34394. }
  34395. for (const kid of kids) {
  34396. if (processed.has(kid)) {
  34397. throw new FormatError(`Duplicate entry in "${this._type}" tree.`);
  34398. }
  34399. queue.push(kid);
  34400. processed.put(kid);
  34401. }
  34402. continue;
  34403. }
  34404. const entries = obj.get(this._type);
  34405. if (!Array.isArray(entries)) {
  34406. continue;
  34407. }
  34408. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  34409. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  34410. }
  34411. }
  34412. return map;
  34413. }
  34414. getRaw(key) {
  34415. if (!this.root) {
  34416. return null;
  34417. }
  34418. const xref = this.xref;
  34419. let kidsOrEntries = xref.fetchIfRef(this.root);
  34420. let loopCount = 0;
  34421. const MAX_LEVELS = 10;
  34422. while (kidsOrEntries.has("Kids")) {
  34423. if (++loopCount > MAX_LEVELS) {
  34424. warn(`Search depth limit reached for "${this._type}" tree.`);
  34425. return null;
  34426. }
  34427. const kids = kidsOrEntries.get("Kids");
  34428. if (!Array.isArray(kids)) {
  34429. return null;
  34430. }
  34431. let l = 0,
  34432. r = kids.length - 1;
  34433. while (l <= r) {
  34434. const m = l + r >> 1;
  34435. const kid = xref.fetchIfRef(kids[m]);
  34436. const limits = kid.get("Limits");
  34437. if (key < xref.fetchIfRef(limits[0])) {
  34438. r = m - 1;
  34439. } else if (key > xref.fetchIfRef(limits[1])) {
  34440. l = m + 1;
  34441. } else {
  34442. kidsOrEntries = kid;
  34443. break;
  34444. }
  34445. }
  34446. if (l > r) {
  34447. return null;
  34448. }
  34449. }
  34450. const entries = kidsOrEntries.get(this._type);
  34451. if (Array.isArray(entries)) {
  34452. let l = 0,
  34453. r = entries.length - 2;
  34454. while (l <= r) {
  34455. const tmp = l + r >> 1,
  34456. m = tmp + (tmp & 1);
  34457. const currentKey = xref.fetchIfRef(entries[m]);
  34458. if (key < currentKey) {
  34459. r = m - 2;
  34460. } else if (key > currentKey) {
  34461. l = m + 2;
  34462. } else {
  34463. return entries[m + 1];
  34464. }
  34465. }
  34466. }
  34467. return null;
  34468. }
  34469. get(key) {
  34470. return this.xref.fetchIfRef(this.getRaw(key));
  34471. }
  34472. }
  34473. class NameTree extends NameOrNumberTree {
  34474. constructor(root, xref) {
  34475. super(root, xref, "Names");
  34476. }
  34477. }
  34478. class NumberTree extends NameOrNumberTree {
  34479. constructor(root, xref) {
  34480. super(root, xref, "Nums");
  34481. }
  34482. }
  34483. ;// ./src/core/cleanup_helper.js
  34484. function clearGlobalCaches() {
  34485. clearPatternCaches();
  34486. clearPrimitiveCaches();
  34487. clearUnicodeCaches();
  34488. JpxImage.cleanup();
  34489. }
  34490. ;// ./src/core/file_spec.js
  34491. function pickPlatformItem(dict) {
  34492. if (!(dict instanceof Dict)) {
  34493. return null;
  34494. }
  34495. if (dict.has("UF")) {
  34496. return dict.get("UF");
  34497. } else if (dict.has("F")) {
  34498. return dict.get("F");
  34499. } else if (dict.has("Unix")) {
  34500. return dict.get("Unix");
  34501. } else if (dict.has("Mac")) {
  34502. return dict.get("Mac");
  34503. } else if (dict.has("DOS")) {
  34504. return dict.get("DOS");
  34505. }
  34506. return null;
  34507. }
  34508. function stripPath(str) {
  34509. return str.substring(str.lastIndexOf("/") + 1);
  34510. }
  34511. class FileSpec {
  34512. #contentAvailable = false;
  34513. constructor(root, xref, skipContent = false) {
  34514. if (!(root instanceof Dict)) {
  34515. return;
  34516. }
  34517. this.xref = xref;
  34518. this.root = root;
  34519. if (root.has("FS")) {
  34520. this.fs = root.get("FS");
  34521. }
  34522. if (root.has("RF")) {
  34523. warn("Related file specifications are not supported");
  34524. }
  34525. if (!skipContent) {
  34526. if (root.has("EF")) {
  34527. this.#contentAvailable = true;
  34528. } else {
  34529. warn("Non-embedded file specifications are not supported");
  34530. }
  34531. }
  34532. }
  34533. get filename() {
  34534. let filename = "";
  34535. const item = pickPlatformItem(this.root);
  34536. if (item && typeof item === "string") {
  34537. filename = stringToPDFString(item).replaceAll("\\\\", "\\").replaceAll("\\/", "/").replaceAll("\\", "/");
  34538. }
  34539. return shadow(this, "filename", filename || "unnamed");
  34540. }
  34541. get content() {
  34542. if (!this.#contentAvailable) {
  34543. return null;
  34544. }
  34545. this._contentRef ||= pickPlatformItem(this.root?.get("EF"));
  34546. let content = null;
  34547. if (this._contentRef) {
  34548. const fileObj = this.xref.fetchIfRef(this._contentRef);
  34549. if (fileObj instanceof BaseStream) {
  34550. content = fileObj.getBytes();
  34551. } else {
  34552. warn("Embedded file specification points to non-existing/invalid content");
  34553. }
  34554. } else {
  34555. warn("Embedded file specification does not have any content");
  34556. }
  34557. return content;
  34558. }
  34559. get description() {
  34560. let description = "";
  34561. const desc = this.root?.get("Desc");
  34562. if (desc && typeof desc === "string") {
  34563. description = stringToPDFString(desc);
  34564. }
  34565. return shadow(this, "description", description);
  34566. }
  34567. get serializable() {
  34568. return {
  34569. rawFilename: this.filename,
  34570. filename: stripPath(this.filename),
  34571. content: this.content,
  34572. description: this.description
  34573. };
  34574. }
  34575. }
  34576. ;// ./src/core/xml_parser.js
  34577. const XMLParserErrorCode = {
  34578. NoError: 0,
  34579. EndOfDocument: -1,
  34580. UnterminatedCdat: -2,
  34581. UnterminatedXmlDeclaration: -3,
  34582. UnterminatedDoctypeDeclaration: -4,
  34583. UnterminatedComment: -5,
  34584. MalformedElement: -6,
  34585. OutOfMemory: -7,
  34586. UnterminatedAttributeValue: -8,
  34587. UnterminatedElement: -9,
  34588. ElementNeverBegun: -10
  34589. };
  34590. function isWhitespace(s, index) {
  34591. const ch = s[index];
  34592. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  34593. }
  34594. function isWhitespaceString(s) {
  34595. for (let i = 0, ii = s.length; i < ii; i++) {
  34596. if (!isWhitespace(s, i)) {
  34597. return false;
  34598. }
  34599. }
  34600. return true;
  34601. }
  34602. class XMLParserBase {
  34603. _resolveEntities(s) {
  34604. return s.replaceAll(/&([^;]+);/g, (all, entity) => {
  34605. if (entity.substring(0, 2) === "#x") {
  34606. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  34607. } else if (entity.substring(0, 1) === "#") {
  34608. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  34609. }
  34610. switch (entity) {
  34611. case "lt":
  34612. return "<";
  34613. case "gt":
  34614. return ">";
  34615. case "amp":
  34616. return "&";
  34617. case "quot":
  34618. return '"';
  34619. case "apos":
  34620. return "'";
  34621. }
  34622. return this.onResolveEntity(entity);
  34623. });
  34624. }
  34625. _parseContent(s, start) {
  34626. const attributes = [];
  34627. let pos = start;
  34628. function skipWs() {
  34629. while (pos < s.length && isWhitespace(s, pos)) {
  34630. ++pos;
  34631. }
  34632. }
  34633. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  34634. ++pos;
  34635. }
  34636. const name = s.substring(start, pos);
  34637. skipWs();
  34638. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  34639. skipWs();
  34640. let attrName = "",
  34641. attrValue = "";
  34642. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  34643. attrName += s[pos];
  34644. ++pos;
  34645. }
  34646. skipWs();
  34647. if (s[pos] !== "=") {
  34648. return null;
  34649. }
  34650. ++pos;
  34651. skipWs();
  34652. const attrEndChar = s[pos];
  34653. if (attrEndChar !== '"' && attrEndChar !== "'") {
  34654. return null;
  34655. }
  34656. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  34657. if (attrEndIndex < 0) {
  34658. return null;
  34659. }
  34660. attrValue = s.substring(pos, attrEndIndex);
  34661. attributes.push({
  34662. name: attrName,
  34663. value: this._resolveEntities(attrValue)
  34664. });
  34665. pos = attrEndIndex + 1;
  34666. skipWs();
  34667. }
  34668. return {
  34669. name,
  34670. attributes,
  34671. parsed: pos - start
  34672. };
  34673. }
  34674. _parseProcessingInstruction(s, start) {
  34675. let pos = start;
  34676. function skipWs() {
  34677. while (pos < s.length && isWhitespace(s, pos)) {
  34678. ++pos;
  34679. }
  34680. }
  34681. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  34682. ++pos;
  34683. }
  34684. const name = s.substring(start, pos);
  34685. skipWs();
  34686. const attrStart = pos;
  34687. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  34688. ++pos;
  34689. }
  34690. const value = s.substring(attrStart, pos);
  34691. return {
  34692. name,
  34693. value,
  34694. parsed: pos - start
  34695. };
  34696. }
  34697. parseXml(s) {
  34698. let i = 0;
  34699. while (i < s.length) {
  34700. const ch = s[i];
  34701. let j = i;
  34702. if (ch === "<") {
  34703. ++j;
  34704. const ch2 = s[j];
  34705. let q;
  34706. switch (ch2) {
  34707. case "/":
  34708. ++j;
  34709. q = s.indexOf(">", j);
  34710. if (q < 0) {
  34711. this.onError(XMLParserErrorCode.UnterminatedElement);
  34712. return;
  34713. }
  34714. this.onEndElement(s.substring(j, q));
  34715. j = q + 1;
  34716. break;
  34717. case "?":
  34718. ++j;
  34719. const pi = this._parseProcessingInstruction(s, j);
  34720. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  34721. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  34722. return;
  34723. }
  34724. this.onPi(pi.name, pi.value);
  34725. j += pi.parsed + 2;
  34726. break;
  34727. case "!":
  34728. if (s.substring(j + 1, j + 3) === "--") {
  34729. q = s.indexOf("-->", j + 3);
  34730. if (q < 0) {
  34731. this.onError(XMLParserErrorCode.UnterminatedComment);
  34732. return;
  34733. }
  34734. this.onComment(s.substring(j + 3, q));
  34735. j = q + 3;
  34736. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  34737. q = s.indexOf("]]>", j + 8);
  34738. if (q < 0) {
  34739. this.onError(XMLParserErrorCode.UnterminatedCdat);
  34740. return;
  34741. }
  34742. this.onCdata(s.substring(j + 8, q));
  34743. j = q + 3;
  34744. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  34745. const q2 = s.indexOf("[", j + 8);
  34746. let complexDoctype = false;
  34747. q = s.indexOf(">", j + 8);
  34748. if (q < 0) {
  34749. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  34750. return;
  34751. }
  34752. if (q2 > 0 && q > q2) {
  34753. q = s.indexOf("]>", j + 8);
  34754. if (q < 0) {
  34755. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  34756. return;
  34757. }
  34758. complexDoctype = true;
  34759. }
  34760. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  34761. this.onDoctype(doctypeContent);
  34762. j = q + (complexDoctype ? 2 : 1);
  34763. } else {
  34764. this.onError(XMLParserErrorCode.MalformedElement);
  34765. return;
  34766. }
  34767. break;
  34768. default:
  34769. const content = this._parseContent(s, j);
  34770. if (content === null) {
  34771. this.onError(XMLParserErrorCode.MalformedElement);
  34772. return;
  34773. }
  34774. let isClosed = false;
  34775. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  34776. isClosed = true;
  34777. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  34778. this.onError(XMLParserErrorCode.UnterminatedElement);
  34779. return;
  34780. }
  34781. this.onBeginElement(content.name, content.attributes, isClosed);
  34782. j += content.parsed + (isClosed ? 2 : 1);
  34783. break;
  34784. }
  34785. } else {
  34786. while (j < s.length && s[j] !== "<") {
  34787. j++;
  34788. }
  34789. const text = s.substring(i, j);
  34790. this.onText(this._resolveEntities(text));
  34791. }
  34792. i = j;
  34793. }
  34794. }
  34795. onResolveEntity(name) {
  34796. return `&${name};`;
  34797. }
  34798. onPi(name, value) {}
  34799. onComment(text) {}
  34800. onCdata(text) {}
  34801. onDoctype(doctypeContent) {}
  34802. onText(text) {}
  34803. onBeginElement(name, attributes, isEmpty) {}
  34804. onEndElement(name) {}
  34805. onError(code) {}
  34806. }
  34807. class SimpleDOMNode {
  34808. constructor(nodeName, nodeValue) {
  34809. this.nodeName = nodeName;
  34810. this.nodeValue = nodeValue;
  34811. Object.defineProperty(this, "parentNode", {
  34812. value: null,
  34813. writable: true
  34814. });
  34815. }
  34816. get firstChild() {
  34817. return this.childNodes?.[0];
  34818. }
  34819. get nextSibling() {
  34820. const childNodes = this.parentNode.childNodes;
  34821. if (!childNodes) {
  34822. return undefined;
  34823. }
  34824. const index = childNodes.indexOf(this);
  34825. if (index === -1) {
  34826. return undefined;
  34827. }
  34828. return childNodes[index + 1];
  34829. }
  34830. get textContent() {
  34831. if (!this.childNodes) {
  34832. return this.nodeValue || "";
  34833. }
  34834. return this.childNodes.map(function (child) {
  34835. return child.textContent;
  34836. }).join("");
  34837. }
  34838. get children() {
  34839. return this.childNodes || [];
  34840. }
  34841. hasChildNodes() {
  34842. return this.childNodes?.length > 0;
  34843. }
  34844. searchNode(paths, pos) {
  34845. if (pos >= paths.length) {
  34846. return this;
  34847. }
  34848. const component = paths[pos];
  34849. if (component.name.startsWith("#") && pos < paths.length - 1) {
  34850. return this.searchNode(paths, pos + 1);
  34851. }
  34852. const stack = [];
  34853. let node = this;
  34854. while (true) {
  34855. if (component.name === node.nodeName) {
  34856. if (component.pos === 0) {
  34857. const res = node.searchNode(paths, pos + 1);
  34858. if (res !== null) {
  34859. return res;
  34860. }
  34861. } else if (stack.length === 0) {
  34862. return null;
  34863. } else {
  34864. const [parent] = stack.pop();
  34865. let siblingPos = 0;
  34866. for (const child of parent.childNodes) {
  34867. if (component.name === child.nodeName) {
  34868. if (siblingPos === component.pos) {
  34869. return child.searchNode(paths, pos + 1);
  34870. }
  34871. siblingPos++;
  34872. }
  34873. }
  34874. return node.searchNode(paths, pos + 1);
  34875. }
  34876. }
  34877. if (node.childNodes?.length > 0) {
  34878. stack.push([node, 0]);
  34879. node = node.childNodes[0];
  34880. } else if (stack.length === 0) {
  34881. return null;
  34882. } else {
  34883. while (stack.length !== 0) {
  34884. const [parent, currentPos] = stack.pop();
  34885. const newPos = currentPos + 1;
  34886. if (newPos < parent.childNodes.length) {
  34887. stack.push([parent, newPos]);
  34888. node = parent.childNodes[newPos];
  34889. break;
  34890. }
  34891. }
  34892. if (stack.length === 0) {
  34893. return null;
  34894. }
  34895. }
  34896. }
  34897. }
  34898. dump(buffer) {
  34899. if (this.nodeName === "#text") {
  34900. buffer.push(encodeToXmlString(this.nodeValue));
  34901. return;
  34902. }
  34903. buffer.push(`<${this.nodeName}`);
  34904. if (this.attributes) {
  34905. for (const attribute of this.attributes) {
  34906. buffer.push(` ${attribute.name}="${encodeToXmlString(attribute.value)}"`);
  34907. }
  34908. }
  34909. if (this.hasChildNodes()) {
  34910. buffer.push(">");
  34911. for (const child of this.childNodes) {
  34912. child.dump(buffer);
  34913. }
  34914. buffer.push(`</${this.nodeName}>`);
  34915. } else if (this.nodeValue) {
  34916. buffer.push(`>${encodeToXmlString(this.nodeValue)}</${this.nodeName}>`);
  34917. } else {
  34918. buffer.push("/>");
  34919. }
  34920. }
  34921. }
  34922. class SimpleXMLParser extends XMLParserBase {
  34923. constructor({
  34924. hasAttributes = false,
  34925. lowerCaseName = false
  34926. }) {
  34927. super();
  34928. this._currentFragment = null;
  34929. this._stack = null;
  34930. this._errorCode = XMLParserErrorCode.NoError;
  34931. this._hasAttributes = hasAttributes;
  34932. this._lowerCaseName = lowerCaseName;
  34933. }
  34934. parseFromString(data) {
  34935. this._currentFragment = [];
  34936. this._stack = [];
  34937. this._errorCode = XMLParserErrorCode.NoError;
  34938. this.parseXml(data);
  34939. if (this._errorCode !== XMLParserErrorCode.NoError) {
  34940. return undefined;
  34941. }
  34942. const [documentElement] = this._currentFragment;
  34943. if (!documentElement) {
  34944. return undefined;
  34945. }
  34946. return {
  34947. documentElement
  34948. };
  34949. }
  34950. onText(text) {
  34951. if (isWhitespaceString(text)) {
  34952. return;
  34953. }
  34954. const node = new SimpleDOMNode("#text", text);
  34955. this._currentFragment.push(node);
  34956. }
  34957. onCdata(text) {
  34958. const node = new SimpleDOMNode("#text", text);
  34959. this._currentFragment.push(node);
  34960. }
  34961. onBeginElement(name, attributes, isEmpty) {
  34962. if (this._lowerCaseName) {
  34963. name = name.toLowerCase();
  34964. }
  34965. const node = new SimpleDOMNode(name);
  34966. node.childNodes = [];
  34967. if (this._hasAttributes) {
  34968. node.attributes = attributes;
  34969. }
  34970. this._currentFragment.push(node);
  34971. if (isEmpty) {
  34972. return;
  34973. }
  34974. this._stack.push(this._currentFragment);
  34975. this._currentFragment = node.childNodes;
  34976. }
  34977. onEndElement(name) {
  34978. this._currentFragment = this._stack.pop() || [];
  34979. const lastElement = this._currentFragment.at(-1);
  34980. if (!lastElement) {
  34981. return null;
  34982. }
  34983. for (const childNode of lastElement.childNodes) {
  34984. childNode.parentNode = lastElement;
  34985. }
  34986. return lastElement;
  34987. }
  34988. onError(code) {
  34989. this._errorCode = code;
  34990. }
  34991. }
  34992. ;// ./src/core/metadata_parser.js
  34993. class MetadataParser {
  34994. constructor(data) {
  34995. data = this._repair(data);
  34996. const parser = new SimpleXMLParser({
  34997. lowerCaseName: true
  34998. });
  34999. const xmlDocument = parser.parseFromString(data);
  35000. this._metadataMap = new Map();
  35001. this._data = data;
  35002. if (xmlDocument) {
  35003. this._parse(xmlDocument);
  35004. }
  35005. }
  35006. _repair(data) {
  35007. return data.replace(/^[^<]+/, "").replaceAll(/>\\376\\377([^<]+)/g, function (all, codes) {
  35008. const bytes = codes.replaceAll(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  35009. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  35010. }).replaceAll(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  35011. switch (name) {
  35012. case "amp":
  35013. return "&";
  35014. case "apos":
  35015. return "'";
  35016. case "gt":
  35017. return ">";
  35018. case "lt":
  35019. return "<";
  35020. case "quot":
  35021. return '"';
  35022. }
  35023. throw new Error(`_repair: ${name} isn't defined.`);
  35024. });
  35025. const charBuf = [">"];
  35026. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  35027. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  35028. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  35029. charBuf.push(String.fromCharCode(code));
  35030. } else {
  35031. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  35032. }
  35033. }
  35034. return charBuf.join("");
  35035. });
  35036. }
  35037. _getSequence(entry) {
  35038. const name = entry.nodeName;
  35039. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  35040. return null;
  35041. }
  35042. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  35043. }
  35044. _parseArray(entry) {
  35045. if (!entry.hasChildNodes()) {
  35046. return;
  35047. }
  35048. const [seqNode] = entry.childNodes;
  35049. const sequence = this._getSequence(seqNode) || [];
  35050. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  35051. }
  35052. _parse(xmlDocument) {
  35053. let rdf = xmlDocument.documentElement;
  35054. if (rdf.nodeName !== "rdf:rdf") {
  35055. rdf = rdf.firstChild;
  35056. while (rdf && rdf.nodeName !== "rdf:rdf") {
  35057. rdf = rdf.nextSibling;
  35058. }
  35059. }
  35060. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  35061. return;
  35062. }
  35063. for (const desc of rdf.childNodes) {
  35064. if (desc.nodeName !== "rdf:description") {
  35065. continue;
  35066. }
  35067. for (const entry of desc.childNodes) {
  35068. const name = entry.nodeName;
  35069. switch (name) {
  35070. case "#text":
  35071. continue;
  35072. case "dc:creator":
  35073. case "dc:subject":
  35074. this._parseArray(entry);
  35075. continue;
  35076. }
  35077. this._metadataMap.set(name, entry.textContent.trim());
  35078. }
  35079. }
  35080. }
  35081. get serializable() {
  35082. return {
  35083. parsedData: this._metadataMap,
  35084. rawData: this._data
  35085. };
  35086. }
  35087. }
  35088. ;// ./src/core/struct_tree.js
  35089. const MAX_DEPTH = 40;
  35090. const StructElementType = {
  35091. PAGE_CONTENT: 1,
  35092. STREAM_CONTENT: 2,
  35093. OBJECT: 3,
  35094. ANNOTATION: 4,
  35095. ELEMENT: 5
  35096. };
  35097. class StructTreeRoot {
  35098. constructor(rootDict, rootRef) {
  35099. this.dict = rootDict;
  35100. this.ref = rootRef instanceof Ref ? rootRef : null;
  35101. this.roleMap = new Map();
  35102. this.structParentIds = null;
  35103. }
  35104. init() {
  35105. this.readRoleMap();
  35106. }
  35107. #addIdToPage(pageRef, id, type) {
  35108. if (!(pageRef instanceof Ref) || id < 0) {
  35109. return;
  35110. }
  35111. this.structParentIds ||= new RefSetCache();
  35112. let ids = this.structParentIds.get(pageRef);
  35113. if (!ids) {
  35114. ids = [];
  35115. this.structParentIds.put(pageRef, ids);
  35116. }
  35117. ids.push([id, type]);
  35118. }
  35119. addAnnotationIdToPage(pageRef, id) {
  35120. this.#addIdToPage(pageRef, id, StructElementType.ANNOTATION);
  35121. }
  35122. readRoleMap() {
  35123. const roleMapDict = this.dict.get("RoleMap");
  35124. if (!(roleMapDict instanceof Dict)) {
  35125. return;
  35126. }
  35127. for (const [key, value] of roleMapDict) {
  35128. if (value instanceof Name) {
  35129. this.roleMap.set(key, value.name);
  35130. }
  35131. }
  35132. }
  35133. static async canCreateStructureTree({
  35134. catalogRef,
  35135. pdfManager,
  35136. newAnnotationsByPage
  35137. }) {
  35138. if (!(catalogRef instanceof Ref)) {
  35139. warn("Cannot save the struct tree: no catalog reference.");
  35140. return false;
  35141. }
  35142. let nextKey = 0;
  35143. let hasNothingToUpdate = true;
  35144. for (const [pageIndex, elements] of newAnnotationsByPage) {
  35145. const {
  35146. ref: pageRef
  35147. } = await pdfManager.getPage(pageIndex);
  35148. if (!(pageRef instanceof Ref)) {
  35149. warn(`Cannot save the struct tree: page ${pageIndex} has no ref.`);
  35150. hasNothingToUpdate = true;
  35151. break;
  35152. }
  35153. for (const element of elements) {
  35154. if (element.accessibilityData?.type) {
  35155. element.parentTreeId = nextKey++;
  35156. hasNothingToUpdate = false;
  35157. }
  35158. }
  35159. }
  35160. if (hasNothingToUpdate) {
  35161. for (const elements of newAnnotationsByPage.values()) {
  35162. for (const element of elements) {
  35163. delete element.parentTreeId;
  35164. }
  35165. }
  35166. return false;
  35167. }
  35168. return true;
  35169. }
  35170. static async createStructureTree({
  35171. newAnnotationsByPage,
  35172. xref,
  35173. catalogRef,
  35174. pdfManager,
  35175. changes
  35176. }) {
  35177. const root = pdfManager.catalog.cloneDict();
  35178. const cache = new RefSetCache();
  35179. cache.put(catalogRef, root);
  35180. const structTreeRootRef = xref.getNewTemporaryRef();
  35181. root.set("StructTreeRoot", structTreeRootRef);
  35182. const structTreeRoot = new Dict(xref);
  35183. structTreeRoot.set("Type", Name.get("StructTreeRoot"));
  35184. const parentTreeRef = xref.getNewTemporaryRef();
  35185. structTreeRoot.set("ParentTree", parentTreeRef);
  35186. const kids = [];
  35187. structTreeRoot.set("K", kids);
  35188. cache.put(structTreeRootRef, structTreeRoot);
  35189. const parentTree = new Dict(xref);
  35190. const nums = [];
  35191. parentTree.set("Nums", nums);
  35192. const nextKey = await this.#writeKids({
  35193. newAnnotationsByPage,
  35194. structTreeRootRef,
  35195. structTreeRoot: null,
  35196. kids,
  35197. nums,
  35198. xref,
  35199. pdfManager,
  35200. changes,
  35201. cache
  35202. });
  35203. structTreeRoot.set("ParentTreeNextKey", nextKey);
  35204. cache.put(parentTreeRef, parentTree);
  35205. for (const [ref, obj] of cache.items()) {
  35206. changes.put(ref, {
  35207. data: obj
  35208. });
  35209. }
  35210. }
  35211. async canUpdateStructTree({
  35212. pdfManager,
  35213. xref,
  35214. newAnnotationsByPage
  35215. }) {
  35216. if (!this.ref) {
  35217. warn("Cannot update the struct tree: no root reference.");
  35218. return false;
  35219. }
  35220. let nextKey = this.dict.get("ParentTreeNextKey");
  35221. if (!Number.isInteger(nextKey) || nextKey < 0) {
  35222. warn("Cannot update the struct tree: invalid next key.");
  35223. return false;
  35224. }
  35225. const parentTree = this.dict.get("ParentTree");
  35226. if (!(parentTree instanceof Dict)) {
  35227. warn("Cannot update the struct tree: ParentTree isn't a dict.");
  35228. return false;
  35229. }
  35230. const nums = parentTree.get("Nums");
  35231. if (!Array.isArray(nums)) {
  35232. warn("Cannot update the struct tree: nums isn't an array.");
  35233. return false;
  35234. }
  35235. const numberTree = new NumberTree(parentTree, xref);
  35236. for (const pageIndex of newAnnotationsByPage.keys()) {
  35237. const {
  35238. pageDict
  35239. } = await pdfManager.getPage(pageIndex);
  35240. if (!pageDict.has("StructParents")) {
  35241. continue;
  35242. }
  35243. const id = pageDict.get("StructParents");
  35244. if (!Number.isInteger(id) || !Array.isArray(numberTree.get(id))) {
  35245. warn(`Cannot save the struct tree: page ${pageIndex} has a wrong id.`);
  35246. return false;
  35247. }
  35248. }
  35249. let hasNothingToUpdate = true;
  35250. for (const [pageIndex, elements] of newAnnotationsByPage) {
  35251. const {
  35252. pageDict
  35253. } = await pdfManager.getPage(pageIndex);
  35254. StructTreeRoot.#collectParents({
  35255. elements,
  35256. xref: this.dict.xref,
  35257. pageDict,
  35258. numberTree
  35259. });
  35260. for (const element of elements) {
  35261. if (element.accessibilityData?.type) {
  35262. if (!(element.accessibilityData.structParent >= 0)) {
  35263. element.parentTreeId = nextKey++;
  35264. }
  35265. hasNothingToUpdate = false;
  35266. }
  35267. }
  35268. }
  35269. if (hasNothingToUpdate) {
  35270. for (const elements of newAnnotationsByPage.values()) {
  35271. for (const element of elements) {
  35272. delete element.parentTreeId;
  35273. delete element.structTreeParent;
  35274. }
  35275. }
  35276. return false;
  35277. }
  35278. return true;
  35279. }
  35280. async updateStructureTree({
  35281. newAnnotationsByPage,
  35282. pdfManager,
  35283. changes
  35284. }) {
  35285. const xref = this.dict.xref;
  35286. const structTreeRoot = this.dict.clone();
  35287. const structTreeRootRef = this.ref;
  35288. const cache = new RefSetCache();
  35289. cache.put(structTreeRootRef, structTreeRoot);
  35290. let parentTreeRef = structTreeRoot.getRaw("ParentTree");
  35291. let parentTree;
  35292. if (parentTreeRef instanceof Ref) {
  35293. parentTree = xref.fetch(parentTreeRef);
  35294. } else {
  35295. parentTree = parentTreeRef;
  35296. parentTreeRef = xref.getNewTemporaryRef();
  35297. structTreeRoot.set("ParentTree", parentTreeRef);
  35298. }
  35299. parentTree = parentTree.clone();
  35300. cache.put(parentTreeRef, parentTree);
  35301. let nums = parentTree.getRaw("Nums");
  35302. let numsRef = null;
  35303. if (nums instanceof Ref) {
  35304. numsRef = nums;
  35305. nums = xref.fetch(numsRef);
  35306. }
  35307. nums = nums.slice();
  35308. if (!numsRef) {
  35309. parentTree.set("Nums", nums);
  35310. }
  35311. const newNextKey = await StructTreeRoot.#writeKids({
  35312. newAnnotationsByPage,
  35313. structTreeRootRef,
  35314. structTreeRoot: this,
  35315. kids: null,
  35316. nums,
  35317. xref,
  35318. pdfManager,
  35319. changes,
  35320. cache
  35321. });
  35322. if (newNextKey === -1) {
  35323. return;
  35324. }
  35325. structTreeRoot.set("ParentTreeNextKey", newNextKey);
  35326. if (numsRef) {
  35327. cache.put(numsRef, nums);
  35328. }
  35329. for (const [ref, obj] of cache.items()) {
  35330. changes.put(ref, {
  35331. data: obj
  35332. });
  35333. }
  35334. }
  35335. static async #writeKids({
  35336. newAnnotationsByPage,
  35337. structTreeRootRef,
  35338. structTreeRoot,
  35339. kids,
  35340. nums,
  35341. xref,
  35342. pdfManager,
  35343. changes,
  35344. cache
  35345. }) {
  35346. const objr = Name.get("OBJR");
  35347. let nextKey = -1;
  35348. let structTreePageObjs;
  35349. for (const [pageIndex, elements] of newAnnotationsByPage) {
  35350. const page = await pdfManager.getPage(pageIndex);
  35351. const {
  35352. ref: pageRef
  35353. } = page;
  35354. const isPageRef = pageRef instanceof Ref;
  35355. for (const {
  35356. accessibilityData,
  35357. ref,
  35358. parentTreeId,
  35359. structTreeParent
  35360. } of elements) {
  35361. if (!accessibilityData?.type) {
  35362. continue;
  35363. }
  35364. const {
  35365. structParent
  35366. } = accessibilityData;
  35367. if (structTreeRoot && Number.isInteger(structParent) && structParent >= 0) {
  35368. let objs = (structTreePageObjs ||= new Map()).get(pageIndex);
  35369. if (objs === undefined) {
  35370. const structTreePage = new StructTreePage(structTreeRoot, page.pageDict);
  35371. objs = structTreePage.collectObjects(pageRef);
  35372. structTreePageObjs.set(pageIndex, objs);
  35373. }
  35374. const objRef = objs?.get(structParent);
  35375. if (objRef) {
  35376. const tagDict = xref.fetch(objRef).clone();
  35377. StructTreeRoot.#writeProperties(tagDict, accessibilityData);
  35378. changes.put(objRef, {
  35379. data: tagDict
  35380. });
  35381. continue;
  35382. }
  35383. }
  35384. nextKey = Math.max(nextKey, parentTreeId);
  35385. const tagRef = xref.getNewTemporaryRef();
  35386. const tagDict = new Dict(xref);
  35387. StructTreeRoot.#writeProperties(tagDict, accessibilityData);
  35388. await this.#updateParentTag({
  35389. structTreeParent,
  35390. tagDict,
  35391. newTagRef: tagRef,
  35392. structTreeRootRef,
  35393. fallbackKids: kids,
  35394. xref,
  35395. cache
  35396. });
  35397. const objDict = new Dict(xref);
  35398. tagDict.set("K", objDict);
  35399. objDict.set("Type", objr);
  35400. if (isPageRef) {
  35401. objDict.set("Pg", pageRef);
  35402. }
  35403. objDict.set("Obj", ref);
  35404. cache.put(tagRef, tagDict);
  35405. nums.push(parentTreeId, tagRef);
  35406. }
  35407. }
  35408. return nextKey + 1;
  35409. }
  35410. static #writeProperties(tagDict, {
  35411. type,
  35412. title,
  35413. lang,
  35414. alt,
  35415. expanded,
  35416. actualText
  35417. }) {
  35418. tagDict.set("S", Name.get(type));
  35419. if (title) {
  35420. tagDict.set("T", stringToAsciiOrUTF16BE(title));
  35421. }
  35422. if (lang) {
  35423. tagDict.set("Lang", stringToAsciiOrUTF16BE(lang));
  35424. }
  35425. if (alt) {
  35426. tagDict.set("Alt", stringToAsciiOrUTF16BE(alt));
  35427. }
  35428. if (expanded) {
  35429. tagDict.set("E", stringToAsciiOrUTF16BE(expanded));
  35430. }
  35431. if (actualText) {
  35432. tagDict.set("ActualText", stringToAsciiOrUTF16BE(actualText));
  35433. }
  35434. }
  35435. static #collectParents({
  35436. elements,
  35437. xref,
  35438. pageDict,
  35439. numberTree
  35440. }) {
  35441. const idToElements = new Map();
  35442. for (const element of elements) {
  35443. if (element.structTreeParentId) {
  35444. const id = parseInt(element.structTreeParentId.split("_mc")[1], 10);
  35445. let elems = idToElements.get(id);
  35446. if (!elems) {
  35447. elems = [];
  35448. idToElements.set(id, elems);
  35449. }
  35450. elems.push(element);
  35451. }
  35452. }
  35453. const id = pageDict.get("StructParents");
  35454. if (!Number.isInteger(id)) {
  35455. return;
  35456. }
  35457. const parentArray = numberTree.get(id);
  35458. const updateElement = (kid, pageKid, kidRef) => {
  35459. const elems = idToElements.get(kid);
  35460. if (elems) {
  35461. const parentRef = pageKid.getRaw("P");
  35462. const parentDict = xref.fetchIfRef(parentRef);
  35463. if (parentRef instanceof Ref && parentDict instanceof Dict) {
  35464. const params = {
  35465. ref: kidRef,
  35466. dict: pageKid
  35467. };
  35468. for (const element of elems) {
  35469. element.structTreeParent = params;
  35470. }
  35471. }
  35472. return true;
  35473. }
  35474. return false;
  35475. };
  35476. for (const kidRef of parentArray) {
  35477. if (!(kidRef instanceof Ref)) {
  35478. continue;
  35479. }
  35480. const pageKid = xref.fetch(kidRef);
  35481. const k = pageKid.get("K");
  35482. if (Number.isInteger(k)) {
  35483. updateElement(k, pageKid, kidRef);
  35484. continue;
  35485. }
  35486. if (!Array.isArray(k)) {
  35487. continue;
  35488. }
  35489. for (let kid of k) {
  35490. kid = xref.fetchIfRef(kid);
  35491. if (Number.isInteger(kid) && updateElement(kid, pageKid, kidRef)) {
  35492. break;
  35493. }
  35494. if (!(kid instanceof Dict)) {
  35495. continue;
  35496. }
  35497. if (!isName(kid.get("Type"), "MCR")) {
  35498. break;
  35499. }
  35500. const mcid = kid.get("MCID");
  35501. if (Number.isInteger(mcid) && updateElement(mcid, pageKid, kidRef)) {
  35502. break;
  35503. }
  35504. }
  35505. }
  35506. }
  35507. static async #updateParentTag({
  35508. structTreeParent,
  35509. tagDict,
  35510. newTagRef,
  35511. structTreeRootRef,
  35512. fallbackKids,
  35513. xref,
  35514. cache
  35515. }) {
  35516. let ref = null;
  35517. let parentRef;
  35518. if (structTreeParent) {
  35519. ({
  35520. ref
  35521. } = structTreeParent);
  35522. parentRef = structTreeParent.dict.getRaw("P") || structTreeRootRef;
  35523. } else {
  35524. parentRef = structTreeRootRef;
  35525. }
  35526. tagDict.set("P", parentRef);
  35527. const parentDict = xref.fetchIfRef(parentRef);
  35528. if (!parentDict) {
  35529. fallbackKids.push(newTagRef);
  35530. return;
  35531. }
  35532. let cachedParentDict = cache.get(parentRef);
  35533. if (!cachedParentDict) {
  35534. cachedParentDict = parentDict.clone();
  35535. cache.put(parentRef, cachedParentDict);
  35536. }
  35537. const parentKidsRaw = cachedParentDict.getRaw("K");
  35538. let cachedParentKids = parentKidsRaw instanceof Ref ? cache.get(parentKidsRaw) : null;
  35539. if (!cachedParentKids) {
  35540. cachedParentKids = xref.fetchIfRef(parentKidsRaw);
  35541. cachedParentKids = Array.isArray(cachedParentKids) ? cachedParentKids.slice() : [parentKidsRaw];
  35542. const parentKidsRef = xref.getNewTemporaryRef();
  35543. cachedParentDict.set("K", parentKidsRef);
  35544. cache.put(parentKidsRef, cachedParentKids);
  35545. }
  35546. const index = cachedParentKids.indexOf(ref);
  35547. cachedParentKids.splice(index >= 0 ? index + 1 : cachedParentKids.length, 0, newTagRef);
  35548. }
  35549. }
  35550. class StructElementNode {
  35551. constructor(tree, dict) {
  35552. this.tree = tree;
  35553. this.dict = dict;
  35554. this.kids = [];
  35555. this.parseKids();
  35556. }
  35557. get role() {
  35558. const nameObj = this.dict.get("S");
  35559. const name = nameObj instanceof Name ? nameObj.name : "";
  35560. const {
  35561. root
  35562. } = this.tree;
  35563. if (root.roleMap.has(name)) {
  35564. return root.roleMap.get(name);
  35565. }
  35566. return name;
  35567. }
  35568. parseKids() {
  35569. let pageObjId = null;
  35570. const objRef = this.dict.getRaw("Pg");
  35571. if (objRef instanceof Ref) {
  35572. pageObjId = objRef.toString();
  35573. }
  35574. const kids = this.dict.get("K");
  35575. if (Array.isArray(kids)) {
  35576. for (const kid of kids) {
  35577. const element = this.parseKid(pageObjId, kid);
  35578. if (element) {
  35579. this.kids.push(element);
  35580. }
  35581. }
  35582. } else {
  35583. const element = this.parseKid(pageObjId, kids);
  35584. if (element) {
  35585. this.kids.push(element);
  35586. }
  35587. }
  35588. }
  35589. parseKid(pageObjId, kid) {
  35590. if (Number.isInteger(kid)) {
  35591. if (this.tree.pageDict.objId !== pageObjId) {
  35592. return null;
  35593. }
  35594. return new StructElement({
  35595. type: StructElementType.PAGE_CONTENT,
  35596. mcid: kid,
  35597. pageObjId
  35598. });
  35599. }
  35600. let kidDict = null;
  35601. if (kid instanceof Ref) {
  35602. kidDict = this.dict.xref.fetch(kid);
  35603. } else if (kid instanceof Dict) {
  35604. kidDict = kid;
  35605. }
  35606. if (!kidDict) {
  35607. return null;
  35608. }
  35609. const pageRef = kidDict.getRaw("Pg");
  35610. if (pageRef instanceof Ref) {
  35611. pageObjId = pageRef.toString();
  35612. }
  35613. const type = kidDict.get("Type") instanceof Name ? kidDict.get("Type").name : null;
  35614. if (type === "MCR") {
  35615. if (this.tree.pageDict.objId !== pageObjId) {
  35616. return null;
  35617. }
  35618. const kidRef = kidDict.getRaw("Stm");
  35619. return new StructElement({
  35620. type: StructElementType.STREAM_CONTENT,
  35621. refObjId: kidRef instanceof Ref ? kidRef.toString() : null,
  35622. pageObjId,
  35623. mcid: kidDict.get("MCID")
  35624. });
  35625. }
  35626. if (type === "OBJR") {
  35627. if (this.tree.pageDict.objId !== pageObjId) {
  35628. return null;
  35629. }
  35630. const kidRef = kidDict.getRaw("Obj");
  35631. return new StructElement({
  35632. type: StructElementType.OBJECT,
  35633. refObjId: kidRef instanceof Ref ? kidRef.toString() : null,
  35634. pageObjId
  35635. });
  35636. }
  35637. return new StructElement({
  35638. type: StructElementType.ELEMENT,
  35639. dict: kidDict
  35640. });
  35641. }
  35642. }
  35643. class StructElement {
  35644. constructor({
  35645. type,
  35646. dict = null,
  35647. mcid = null,
  35648. pageObjId = null,
  35649. refObjId = null
  35650. }) {
  35651. this.type = type;
  35652. this.dict = dict;
  35653. this.mcid = mcid;
  35654. this.pageObjId = pageObjId;
  35655. this.refObjId = refObjId;
  35656. this.parentNode = null;
  35657. }
  35658. }
  35659. class StructTreePage {
  35660. constructor(structTreeRoot, pageDict) {
  35661. this.root = structTreeRoot;
  35662. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  35663. this.pageDict = pageDict;
  35664. this.nodes = [];
  35665. }
  35666. collectObjects(pageRef) {
  35667. if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) {
  35668. return null;
  35669. }
  35670. const parentTree = this.rootDict.get("ParentTree");
  35671. if (!parentTree) {
  35672. return null;
  35673. }
  35674. const ids = this.root.structParentIds?.get(pageRef);
  35675. if (!ids) {
  35676. return null;
  35677. }
  35678. const map = new Map();
  35679. const numberTree = new NumberTree(parentTree, this.rootDict.xref);
  35680. for (const [elemId] of ids) {
  35681. const obj = numberTree.getRaw(elemId);
  35682. if (obj instanceof Ref) {
  35683. map.set(elemId, obj);
  35684. }
  35685. }
  35686. return map;
  35687. }
  35688. parse(pageRef) {
  35689. if (!this.root || !this.rootDict || !(pageRef instanceof Ref)) {
  35690. return;
  35691. }
  35692. const parentTree = this.rootDict.get("ParentTree");
  35693. if (!parentTree) {
  35694. return;
  35695. }
  35696. const id = this.pageDict.get("StructParents");
  35697. const ids = this.root.structParentIds?.get(pageRef);
  35698. if (!Number.isInteger(id) && !ids) {
  35699. return;
  35700. }
  35701. const map = new Map();
  35702. const numberTree = new NumberTree(parentTree, this.rootDict.xref);
  35703. if (Number.isInteger(id)) {
  35704. const parentArray = numberTree.get(id);
  35705. if (Array.isArray(parentArray)) {
  35706. for (const ref of parentArray) {
  35707. if (ref instanceof Ref) {
  35708. this.addNode(this.rootDict.xref.fetch(ref), map);
  35709. }
  35710. }
  35711. }
  35712. }
  35713. if (!ids) {
  35714. return;
  35715. }
  35716. for (const [elemId, type] of ids) {
  35717. const obj = numberTree.get(elemId);
  35718. if (obj) {
  35719. const elem = this.addNode(this.rootDict.xref.fetchIfRef(obj), map);
  35720. if (elem?.kids?.length === 1 && elem.kids[0].type === StructElementType.OBJECT) {
  35721. elem.kids[0].type = type;
  35722. }
  35723. }
  35724. }
  35725. }
  35726. addNode(dict, map, level = 0) {
  35727. if (level > MAX_DEPTH) {
  35728. warn("StructTree MAX_DEPTH reached.");
  35729. return null;
  35730. }
  35731. if (!(dict instanceof Dict)) {
  35732. return null;
  35733. }
  35734. if (map.has(dict)) {
  35735. return map.get(dict);
  35736. }
  35737. const element = new StructElementNode(this, dict);
  35738. map.set(dict, element);
  35739. const parent = dict.get("P");
  35740. if (!parent || isName(parent.get("Type"), "StructTreeRoot")) {
  35741. if (!this.addTopLevelNode(dict, element)) {
  35742. map.delete(dict);
  35743. }
  35744. return element;
  35745. }
  35746. const parentNode = this.addNode(parent, map, level + 1);
  35747. if (!parentNode) {
  35748. return element;
  35749. }
  35750. let save = false;
  35751. for (const kid of parentNode.kids) {
  35752. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  35753. kid.parentNode = element;
  35754. save = true;
  35755. }
  35756. }
  35757. if (!save) {
  35758. map.delete(dict);
  35759. }
  35760. return element;
  35761. }
  35762. addTopLevelNode(dict, element) {
  35763. const obj = this.rootDict.get("K");
  35764. if (!obj) {
  35765. return false;
  35766. }
  35767. if (obj instanceof Dict) {
  35768. if (obj.objId !== dict.objId) {
  35769. return false;
  35770. }
  35771. this.nodes[0] = element;
  35772. return true;
  35773. }
  35774. if (!Array.isArray(obj)) {
  35775. return true;
  35776. }
  35777. let save = false;
  35778. for (let i = 0; i < obj.length; i++) {
  35779. const kidRef = obj[i];
  35780. if (kidRef?.toString() === dict.objId) {
  35781. this.nodes[i] = element;
  35782. save = true;
  35783. }
  35784. }
  35785. return save;
  35786. }
  35787. get serializable() {
  35788. function nodeToSerializable(node, parent, level = 0) {
  35789. if (level > MAX_DEPTH) {
  35790. warn("StructTree too deep to be fully serialized.");
  35791. return;
  35792. }
  35793. const obj = Object.create(null);
  35794. obj.role = node.role;
  35795. obj.children = [];
  35796. parent.children.push(obj);
  35797. let alt = node.dict.get("Alt");
  35798. if (typeof alt !== "string") {
  35799. alt = node.dict.get("ActualText");
  35800. }
  35801. if (typeof alt === "string") {
  35802. obj.alt = stringToPDFString(alt);
  35803. }
  35804. const a = node.dict.get("A");
  35805. if (a instanceof Dict) {
  35806. const bbox = lookupNormalRect(a.getArray("BBox"), null);
  35807. if (bbox) {
  35808. obj.bbox = bbox;
  35809. } else {
  35810. const width = a.get("Width");
  35811. const height = a.get("Height");
  35812. if (typeof width === "number" && width > 0 && typeof height === "number" && height > 0) {
  35813. obj.bbox = [0, 0, width, height];
  35814. }
  35815. }
  35816. }
  35817. const lang = node.dict.get("Lang");
  35818. if (typeof lang === "string") {
  35819. obj.lang = stringToPDFString(lang);
  35820. }
  35821. for (const kid of node.kids) {
  35822. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  35823. if (kidElement) {
  35824. nodeToSerializable(kidElement, obj, level + 1);
  35825. continue;
  35826. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  35827. obj.children.push({
  35828. type: "content",
  35829. id: `p${kid.pageObjId}_mc${kid.mcid}`
  35830. });
  35831. } else if (kid.type === StructElementType.OBJECT) {
  35832. obj.children.push({
  35833. type: "object",
  35834. id: kid.refObjId
  35835. });
  35836. } else if (kid.type === StructElementType.ANNOTATION) {
  35837. obj.children.push({
  35838. type: "annotation",
  35839. id: `${AnnotationPrefix}${kid.refObjId}`
  35840. });
  35841. }
  35842. }
  35843. }
  35844. const root = Object.create(null);
  35845. root.children = [];
  35846. root.role = "Root";
  35847. for (const child of this.nodes) {
  35848. if (!child) {
  35849. continue;
  35850. }
  35851. nodeToSerializable(child, root);
  35852. }
  35853. return root;
  35854. }
  35855. }
  35856. ;// ./src/core/catalog.js
  35857. function isValidExplicitDest(dest) {
  35858. if (!Array.isArray(dest) || dest.length < 2) {
  35859. return false;
  35860. }
  35861. const [page, zoom, ...args] = dest;
  35862. if (!(page instanceof Ref) && !Number.isInteger(page)) {
  35863. return false;
  35864. }
  35865. if (!(zoom instanceof Name)) {
  35866. return false;
  35867. }
  35868. const argsLen = args.length;
  35869. let allowNull = true;
  35870. switch (zoom.name) {
  35871. case "XYZ":
  35872. if (argsLen < 2 || argsLen > 3) {
  35873. return false;
  35874. }
  35875. break;
  35876. case "Fit":
  35877. case "FitB":
  35878. return argsLen === 0;
  35879. case "FitH":
  35880. case "FitBH":
  35881. case "FitV":
  35882. case "FitBV":
  35883. if (argsLen > 1) {
  35884. return false;
  35885. }
  35886. break;
  35887. case "FitR":
  35888. if (argsLen !== 4) {
  35889. return false;
  35890. }
  35891. allowNull = false;
  35892. break;
  35893. default:
  35894. return false;
  35895. }
  35896. for (const arg of args) {
  35897. if (!(typeof arg === "number" || allowNull && arg === null)) {
  35898. return false;
  35899. }
  35900. }
  35901. return true;
  35902. }
  35903. function fetchDest(dest) {
  35904. if (dest instanceof Dict) {
  35905. dest = dest.get("D");
  35906. }
  35907. return isValidExplicitDest(dest) ? dest : null;
  35908. }
  35909. function fetchRemoteDest(action) {
  35910. let dest = action.get("D");
  35911. if (dest) {
  35912. if (dest instanceof Name) {
  35913. dest = dest.name;
  35914. }
  35915. if (typeof dest === "string") {
  35916. return stringToPDFString(dest);
  35917. } else if (isValidExplicitDest(dest)) {
  35918. return JSON.stringify(dest);
  35919. }
  35920. }
  35921. return null;
  35922. }
  35923. class Catalog {
  35924. constructor(pdfManager, xref) {
  35925. this.pdfManager = pdfManager;
  35926. this.xref = xref;
  35927. this._catDict = xref.getCatalogObj();
  35928. if (!(this._catDict instanceof Dict)) {
  35929. throw new FormatError("Catalog object is not a dictionary.");
  35930. }
  35931. this.toplevelPagesDict;
  35932. this._actualNumPages = null;
  35933. this.fontCache = new RefSetCache();
  35934. this.builtInCMapCache = new Map();
  35935. this.standardFontDataCache = new Map();
  35936. this.globalImageCache = new GlobalImageCache();
  35937. this.pageKidsCountCache = new RefSetCache();
  35938. this.pageIndexCache = new RefSetCache();
  35939. this.pageDictCache = new RefSetCache();
  35940. this.nonBlendModesSet = new RefSet();
  35941. this.systemFontCache = new Map();
  35942. }
  35943. cloneDict() {
  35944. return this._catDict.clone();
  35945. }
  35946. get version() {
  35947. const version = this._catDict.get("Version");
  35948. if (version instanceof Name) {
  35949. if (PDF_VERSION_REGEXP.test(version.name)) {
  35950. return shadow(this, "version", version.name);
  35951. }
  35952. warn(`Invalid PDF catalog version: ${version.name}`);
  35953. }
  35954. return shadow(this, "version", null);
  35955. }
  35956. get lang() {
  35957. const lang = this._catDict.get("Lang");
  35958. return shadow(this, "lang", lang && typeof lang === "string" ? stringToPDFString(lang) : null);
  35959. }
  35960. get needsRendering() {
  35961. const needsRendering = this._catDict.get("NeedsRendering");
  35962. return shadow(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  35963. }
  35964. get collection() {
  35965. let collection = null;
  35966. try {
  35967. const obj = this._catDict.get("Collection");
  35968. if (obj instanceof Dict && obj.size > 0) {
  35969. collection = obj;
  35970. }
  35971. } catch (ex) {
  35972. if (ex instanceof MissingDataException) {
  35973. throw ex;
  35974. }
  35975. info("Cannot fetch Collection entry; assuming no collection is present.");
  35976. }
  35977. return shadow(this, "collection", collection);
  35978. }
  35979. get acroForm() {
  35980. let acroForm = null;
  35981. try {
  35982. const obj = this._catDict.get("AcroForm");
  35983. if (obj instanceof Dict && obj.size > 0) {
  35984. acroForm = obj;
  35985. }
  35986. } catch (ex) {
  35987. if (ex instanceof MissingDataException) {
  35988. throw ex;
  35989. }
  35990. info("Cannot fetch AcroForm entry; assuming no forms are present.");
  35991. }
  35992. return shadow(this, "acroForm", acroForm);
  35993. }
  35994. get acroFormRef() {
  35995. const value = this._catDict.getRaw("AcroForm");
  35996. return shadow(this, "acroFormRef", value instanceof Ref ? value : null);
  35997. }
  35998. get metadata() {
  35999. const streamRef = this._catDict.getRaw("Metadata");
  36000. if (!(streamRef instanceof Ref)) {
  36001. return shadow(this, "metadata", null);
  36002. }
  36003. let metadata = null;
  36004. try {
  36005. const stream = this.xref.fetch(streamRef, !this.xref.encrypt?.encryptMetadata);
  36006. if (stream instanceof BaseStream && stream.dict instanceof Dict) {
  36007. const type = stream.dict.get("Type");
  36008. const subtype = stream.dict.get("Subtype");
  36009. if (isName(type, "Metadata") && isName(subtype, "XML")) {
  36010. const data = stringToUTF8String(stream.getString());
  36011. if (data) {
  36012. metadata = new MetadataParser(data).serializable;
  36013. }
  36014. }
  36015. }
  36016. } catch (ex) {
  36017. if (ex instanceof MissingDataException) {
  36018. throw ex;
  36019. }
  36020. info(`Skipping invalid Metadata: "${ex}".`);
  36021. }
  36022. return shadow(this, "metadata", metadata);
  36023. }
  36024. get markInfo() {
  36025. let markInfo = null;
  36026. try {
  36027. markInfo = this._readMarkInfo();
  36028. } catch (ex) {
  36029. if (ex instanceof MissingDataException) {
  36030. throw ex;
  36031. }
  36032. warn("Unable to read mark info.");
  36033. }
  36034. return shadow(this, "markInfo", markInfo);
  36035. }
  36036. _readMarkInfo() {
  36037. const obj = this._catDict.get("MarkInfo");
  36038. if (!(obj instanceof Dict)) {
  36039. return null;
  36040. }
  36041. const markInfo = {
  36042. Marked: false,
  36043. UserProperties: false,
  36044. Suspects: false
  36045. };
  36046. for (const key in markInfo) {
  36047. const value = obj.get(key);
  36048. if (typeof value === "boolean") {
  36049. markInfo[key] = value;
  36050. }
  36051. }
  36052. return markInfo;
  36053. }
  36054. get structTreeRoot() {
  36055. let structTree = null;
  36056. try {
  36057. structTree = this._readStructTreeRoot();
  36058. } catch (ex) {
  36059. if (ex instanceof MissingDataException) {
  36060. throw ex;
  36061. }
  36062. warn("Unable read to structTreeRoot info.");
  36063. }
  36064. return shadow(this, "structTreeRoot", structTree);
  36065. }
  36066. _readStructTreeRoot() {
  36067. const rawObj = this._catDict.getRaw("StructTreeRoot");
  36068. const obj = this.xref.fetchIfRef(rawObj);
  36069. if (!(obj instanceof Dict)) {
  36070. return null;
  36071. }
  36072. const root = new StructTreeRoot(obj, rawObj);
  36073. root.init();
  36074. return root;
  36075. }
  36076. get toplevelPagesDict() {
  36077. const pagesObj = this._catDict.get("Pages");
  36078. if (!(pagesObj instanceof Dict)) {
  36079. throw new FormatError("Invalid top-level pages dictionary.");
  36080. }
  36081. return shadow(this, "toplevelPagesDict", pagesObj);
  36082. }
  36083. get documentOutline() {
  36084. let obj = null;
  36085. try {
  36086. obj = this._readDocumentOutline();
  36087. } catch (ex) {
  36088. if (ex instanceof MissingDataException) {
  36089. throw ex;
  36090. }
  36091. warn("Unable to read document outline.");
  36092. }
  36093. return shadow(this, "documentOutline", obj);
  36094. }
  36095. _readDocumentOutline() {
  36096. let obj = this._catDict.get("Outlines");
  36097. if (!(obj instanceof Dict)) {
  36098. return null;
  36099. }
  36100. obj = obj.getRaw("First");
  36101. if (!(obj instanceof Ref)) {
  36102. return null;
  36103. }
  36104. const root = {
  36105. items: []
  36106. };
  36107. const queue = [{
  36108. obj,
  36109. parent: root
  36110. }];
  36111. const processed = new RefSet();
  36112. processed.put(obj);
  36113. const xref = this.xref,
  36114. blackColor = new Uint8ClampedArray(3);
  36115. while (queue.length > 0) {
  36116. const i = queue.shift();
  36117. const outlineDict = xref.fetchIfRef(i.obj);
  36118. if (outlineDict === null) {
  36119. continue;
  36120. }
  36121. if (!outlineDict.has("Title")) {
  36122. warn("Invalid outline item encountered.");
  36123. }
  36124. const data = {
  36125. url: null,
  36126. dest: null,
  36127. action: null
  36128. };
  36129. Catalog.parseDestDictionary({
  36130. destDict: outlineDict,
  36131. resultObj: data,
  36132. docBaseUrl: this.baseUrl,
  36133. docAttachments: this.attachments
  36134. });
  36135. const title = outlineDict.get("Title");
  36136. const flags = outlineDict.get("F") || 0;
  36137. const color = outlineDict.getArray("C");
  36138. const count = outlineDict.get("Count");
  36139. let rgbColor = blackColor;
  36140. if (isNumberArray(color, 3) && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  36141. rgbColor = ColorSpace.singletons.rgb.getRgb(color, 0);
  36142. }
  36143. const outlineItem = {
  36144. action: data.action,
  36145. attachment: data.attachment,
  36146. dest: data.dest,
  36147. url: data.url,
  36148. unsafeUrl: data.unsafeUrl,
  36149. newWindow: data.newWindow,
  36150. setOCGState: data.setOCGState,
  36151. title: typeof title === "string" ? stringToPDFString(title) : "",
  36152. color: rgbColor,
  36153. count: Number.isInteger(count) ? count : undefined,
  36154. bold: !!(flags & 2),
  36155. italic: !!(flags & 1),
  36156. items: []
  36157. };
  36158. i.parent.items.push(outlineItem);
  36159. obj = outlineDict.getRaw("First");
  36160. if (obj instanceof Ref && !processed.has(obj)) {
  36161. queue.push({
  36162. obj,
  36163. parent: outlineItem
  36164. });
  36165. processed.put(obj);
  36166. }
  36167. obj = outlineDict.getRaw("Next");
  36168. if (obj instanceof Ref && !processed.has(obj)) {
  36169. queue.push({
  36170. obj,
  36171. parent: i.parent
  36172. });
  36173. processed.put(obj);
  36174. }
  36175. }
  36176. return root.items.length > 0 ? root.items : null;
  36177. }
  36178. get permissions() {
  36179. let permissions = null;
  36180. try {
  36181. permissions = this._readPermissions();
  36182. } catch (ex) {
  36183. if (ex instanceof MissingDataException) {
  36184. throw ex;
  36185. }
  36186. warn("Unable to read permissions.");
  36187. }
  36188. return shadow(this, "permissions", permissions);
  36189. }
  36190. _readPermissions() {
  36191. const encrypt = this.xref.trailer.get("Encrypt");
  36192. if (!(encrypt instanceof Dict)) {
  36193. return null;
  36194. }
  36195. let flags = encrypt.get("P");
  36196. if (typeof flags !== "number") {
  36197. return null;
  36198. }
  36199. flags += 2 ** 32;
  36200. const permissions = [];
  36201. for (const key in PermissionFlag) {
  36202. const value = PermissionFlag[key];
  36203. if (flags & value) {
  36204. permissions.push(value);
  36205. }
  36206. }
  36207. return permissions;
  36208. }
  36209. get optionalContentConfig() {
  36210. let config = null;
  36211. try {
  36212. const properties = this._catDict.get("OCProperties");
  36213. if (!properties) {
  36214. return shadow(this, "optionalContentConfig", null);
  36215. }
  36216. const defaultConfig = properties.get("D");
  36217. if (!defaultConfig) {
  36218. return shadow(this, "optionalContentConfig", null);
  36219. }
  36220. const groupsData = properties.get("OCGs");
  36221. if (!Array.isArray(groupsData)) {
  36222. return shadow(this, "optionalContentConfig", null);
  36223. }
  36224. const groupRefCache = new RefSetCache();
  36225. for (const groupRef of groupsData) {
  36226. if (!(groupRef instanceof Ref) || groupRefCache.has(groupRef)) {
  36227. continue;
  36228. }
  36229. groupRefCache.put(groupRef, this.#readOptionalContentGroup(groupRef));
  36230. }
  36231. config = this.#readOptionalContentConfig(defaultConfig, groupRefCache);
  36232. } catch (ex) {
  36233. if (ex instanceof MissingDataException) {
  36234. throw ex;
  36235. }
  36236. warn(`Unable to read optional content config: ${ex}`);
  36237. }
  36238. return shadow(this, "optionalContentConfig", config);
  36239. }
  36240. #readOptionalContentGroup(groupRef) {
  36241. const group = this.xref.fetch(groupRef);
  36242. const obj = {
  36243. id: groupRef.toString(),
  36244. name: null,
  36245. intent: null,
  36246. usage: {
  36247. print: null,
  36248. view: null
  36249. },
  36250. rbGroups: []
  36251. };
  36252. const name = group.get("Name");
  36253. if (typeof name === "string") {
  36254. obj.name = stringToPDFString(name);
  36255. }
  36256. let intent = group.getArray("Intent");
  36257. if (!Array.isArray(intent)) {
  36258. intent = [intent];
  36259. }
  36260. if (intent.every(i => i instanceof Name)) {
  36261. obj.intent = intent.map(i => i.name);
  36262. }
  36263. const usage = group.get("Usage");
  36264. if (!(usage instanceof Dict)) {
  36265. return obj;
  36266. }
  36267. const usageObj = obj.usage;
  36268. const print = usage.get("Print");
  36269. if (print instanceof Dict) {
  36270. const printState = print.get("PrintState");
  36271. if (printState instanceof Name) {
  36272. switch (printState.name) {
  36273. case "ON":
  36274. case "OFF":
  36275. usageObj.print = {
  36276. printState: printState.name
  36277. };
  36278. }
  36279. }
  36280. }
  36281. const view = usage.get("View");
  36282. if (view instanceof Dict) {
  36283. const viewState = view.get("ViewState");
  36284. if (viewState instanceof Name) {
  36285. switch (viewState.name) {
  36286. case "ON":
  36287. case "OFF":
  36288. usageObj.view = {
  36289. viewState: viewState.name
  36290. };
  36291. }
  36292. }
  36293. }
  36294. return obj;
  36295. }
  36296. #readOptionalContentConfig(config, groupRefCache) {
  36297. function parseOnOff(refs) {
  36298. const onParsed = [];
  36299. if (Array.isArray(refs)) {
  36300. for (const value of refs) {
  36301. if (value instanceof Ref && groupRefCache.has(value)) {
  36302. onParsed.push(value.toString());
  36303. }
  36304. }
  36305. }
  36306. return onParsed;
  36307. }
  36308. function parseOrder(refs, nestedLevels = 0) {
  36309. if (!Array.isArray(refs)) {
  36310. return null;
  36311. }
  36312. const order = [];
  36313. for (const value of refs) {
  36314. if (value instanceof Ref && groupRefCache.has(value)) {
  36315. parsedOrderRefs.put(value);
  36316. order.push(value.toString());
  36317. continue;
  36318. }
  36319. const nestedOrder = parseNestedOrder(value, nestedLevels);
  36320. if (nestedOrder) {
  36321. order.push(nestedOrder);
  36322. }
  36323. }
  36324. if (nestedLevels > 0) {
  36325. return order;
  36326. }
  36327. const hiddenGroups = [];
  36328. for (const [groupRef] of groupRefCache.items()) {
  36329. if (parsedOrderRefs.has(groupRef)) {
  36330. continue;
  36331. }
  36332. hiddenGroups.push(groupRef.toString());
  36333. }
  36334. if (hiddenGroups.length) {
  36335. order.push({
  36336. name: null,
  36337. order: hiddenGroups
  36338. });
  36339. }
  36340. return order;
  36341. }
  36342. function parseNestedOrder(ref, nestedLevels) {
  36343. if (++nestedLevels > MAX_NESTED_LEVELS) {
  36344. warn("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  36345. return null;
  36346. }
  36347. const value = xref.fetchIfRef(ref);
  36348. if (!Array.isArray(value)) {
  36349. return null;
  36350. }
  36351. const nestedName = xref.fetchIfRef(value[0]);
  36352. if (typeof nestedName !== "string") {
  36353. return null;
  36354. }
  36355. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  36356. if (!nestedOrder?.length) {
  36357. return null;
  36358. }
  36359. return {
  36360. name: stringToPDFString(nestedName),
  36361. order: nestedOrder
  36362. };
  36363. }
  36364. function parseRBGroups(rbGroups) {
  36365. if (!Array.isArray(rbGroups)) {
  36366. return;
  36367. }
  36368. for (const value of rbGroups) {
  36369. const rbGroup = xref.fetchIfRef(value);
  36370. if (!Array.isArray(rbGroup) || !rbGroup.length) {
  36371. continue;
  36372. }
  36373. const parsedRbGroup = new Set();
  36374. for (const ref of rbGroup) {
  36375. if (ref instanceof Ref && groupRefCache.has(ref) && !parsedRbGroup.has(ref.toString())) {
  36376. parsedRbGroup.add(ref.toString());
  36377. groupRefCache.get(ref).rbGroups.push(parsedRbGroup);
  36378. }
  36379. }
  36380. }
  36381. }
  36382. const xref = this.xref,
  36383. parsedOrderRefs = new RefSet(),
  36384. MAX_NESTED_LEVELS = 10;
  36385. parseRBGroups(config.get("RBGroups"));
  36386. return {
  36387. name: typeof config.get("Name") === "string" ? stringToPDFString(config.get("Name")) : null,
  36388. creator: typeof config.get("Creator") === "string" ? stringToPDFString(config.get("Creator")) : null,
  36389. baseState: config.get("BaseState") instanceof Name ? config.get("BaseState").name : null,
  36390. on: parseOnOff(config.get("ON")),
  36391. off: parseOnOff(config.get("OFF")),
  36392. order: parseOrder(config.get("Order")),
  36393. groups: [...groupRefCache]
  36394. };
  36395. }
  36396. setActualNumPages(num = null) {
  36397. this._actualNumPages = num;
  36398. }
  36399. get hasActualNumPages() {
  36400. return this._actualNumPages !== null;
  36401. }
  36402. get _pagesCount() {
  36403. const obj = this.toplevelPagesDict.get("Count");
  36404. if (!Number.isInteger(obj)) {
  36405. throw new FormatError("Page count in top-level pages dictionary is not an integer.");
  36406. }
  36407. return shadow(this, "_pagesCount", obj);
  36408. }
  36409. get numPages() {
  36410. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  36411. }
  36412. get destinations() {
  36413. const obj = this._readDests(),
  36414. dests = Object.create(null);
  36415. if (obj instanceof NameTree) {
  36416. for (const [key, value] of obj.getAll()) {
  36417. const dest = fetchDest(value);
  36418. if (dest) {
  36419. dests[stringToPDFString(key)] = dest;
  36420. }
  36421. }
  36422. } else if (obj instanceof Dict) {
  36423. for (const [key, value] of obj) {
  36424. const dest = fetchDest(value);
  36425. if (dest) {
  36426. dests[key] = dest;
  36427. }
  36428. }
  36429. }
  36430. return shadow(this, "destinations", dests);
  36431. }
  36432. getDestination(id) {
  36433. const obj = this._readDests();
  36434. if (obj instanceof NameTree) {
  36435. const dest = fetchDest(obj.get(id));
  36436. if (dest) {
  36437. return dest;
  36438. }
  36439. const allDest = this.destinations[id];
  36440. if (allDest) {
  36441. warn(`Found "${id}" at an incorrect position in the NameTree.`);
  36442. return allDest;
  36443. }
  36444. } else if (obj instanceof Dict) {
  36445. const dest = fetchDest(obj.get(id));
  36446. if (dest) {
  36447. return dest;
  36448. }
  36449. }
  36450. return null;
  36451. }
  36452. _readDests() {
  36453. const obj = this._catDict.get("Names");
  36454. if (obj?.has("Dests")) {
  36455. return new NameTree(obj.getRaw("Dests"), this.xref);
  36456. } else if (this._catDict.has("Dests")) {
  36457. return this._catDict.get("Dests");
  36458. }
  36459. return undefined;
  36460. }
  36461. get pageLabels() {
  36462. let obj = null;
  36463. try {
  36464. obj = this._readPageLabels();
  36465. } catch (ex) {
  36466. if (ex instanceof MissingDataException) {
  36467. throw ex;
  36468. }
  36469. warn("Unable to read page labels.");
  36470. }
  36471. return shadow(this, "pageLabels", obj);
  36472. }
  36473. _readPageLabels() {
  36474. const obj = this._catDict.getRaw("PageLabels");
  36475. if (!obj) {
  36476. return null;
  36477. }
  36478. const pageLabels = new Array(this.numPages);
  36479. let style = null,
  36480. prefix = "";
  36481. const numberTree = new NumberTree(obj, this.xref);
  36482. const nums = numberTree.getAll();
  36483. let currentLabel = "",
  36484. currentIndex = 1;
  36485. for (let i = 0, ii = this.numPages; i < ii; i++) {
  36486. const labelDict = nums.get(i);
  36487. if (labelDict !== undefined) {
  36488. if (!(labelDict instanceof Dict)) {
  36489. throw new FormatError("PageLabel is not a dictionary.");
  36490. }
  36491. if (labelDict.has("Type") && !isName(labelDict.get("Type"), "PageLabel")) {
  36492. throw new FormatError("Invalid type in PageLabel dictionary.");
  36493. }
  36494. if (labelDict.has("S")) {
  36495. const s = labelDict.get("S");
  36496. if (!(s instanceof Name)) {
  36497. throw new FormatError("Invalid style in PageLabel dictionary.");
  36498. }
  36499. style = s.name;
  36500. } else {
  36501. style = null;
  36502. }
  36503. if (labelDict.has("P")) {
  36504. const p = labelDict.get("P");
  36505. if (typeof p !== "string") {
  36506. throw new FormatError("Invalid prefix in PageLabel dictionary.");
  36507. }
  36508. prefix = stringToPDFString(p);
  36509. } else {
  36510. prefix = "";
  36511. }
  36512. if (labelDict.has("St")) {
  36513. const st = labelDict.get("St");
  36514. if (!(Number.isInteger(st) && st >= 1)) {
  36515. throw new FormatError("Invalid start in PageLabel dictionary.");
  36516. }
  36517. currentIndex = st;
  36518. } else {
  36519. currentIndex = 1;
  36520. }
  36521. }
  36522. switch (style) {
  36523. case "D":
  36524. currentLabel = currentIndex;
  36525. break;
  36526. case "R":
  36527. case "r":
  36528. currentLabel = toRomanNumerals(currentIndex, style === "r");
  36529. break;
  36530. case "A":
  36531. case "a":
  36532. const LIMIT = 26;
  36533. const A_UPPER_CASE = 0x41,
  36534. A_LOWER_CASE = 0x61;
  36535. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  36536. const letterIndex = currentIndex - 1;
  36537. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  36538. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  36539. break;
  36540. default:
  36541. if (style) {
  36542. throw new FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  36543. }
  36544. currentLabel = "";
  36545. }
  36546. pageLabels[i] = prefix + currentLabel;
  36547. currentIndex++;
  36548. }
  36549. return pageLabels;
  36550. }
  36551. get pageLayout() {
  36552. const obj = this._catDict.get("PageLayout");
  36553. let pageLayout = "";
  36554. if (obj instanceof Name) {
  36555. switch (obj.name) {
  36556. case "SinglePage":
  36557. case "OneColumn":
  36558. case "TwoColumnLeft":
  36559. case "TwoColumnRight":
  36560. case "TwoPageLeft":
  36561. case "TwoPageRight":
  36562. pageLayout = obj.name;
  36563. }
  36564. }
  36565. return shadow(this, "pageLayout", pageLayout);
  36566. }
  36567. get pageMode() {
  36568. const obj = this._catDict.get("PageMode");
  36569. let pageMode = "UseNone";
  36570. if (obj instanceof Name) {
  36571. switch (obj.name) {
  36572. case "UseNone":
  36573. case "UseOutlines":
  36574. case "UseThumbs":
  36575. case "FullScreen":
  36576. case "UseOC":
  36577. case "UseAttachments":
  36578. pageMode = obj.name;
  36579. }
  36580. }
  36581. return shadow(this, "pageMode", pageMode);
  36582. }
  36583. get viewerPreferences() {
  36584. const obj = this._catDict.get("ViewerPreferences");
  36585. if (!(obj instanceof Dict)) {
  36586. return shadow(this, "viewerPreferences", null);
  36587. }
  36588. let prefs = null;
  36589. for (const key of obj.getKeys()) {
  36590. const value = obj.get(key);
  36591. let prefValue;
  36592. switch (key) {
  36593. case "HideToolbar":
  36594. case "HideMenubar":
  36595. case "HideWindowUI":
  36596. case "FitWindow":
  36597. case "CenterWindow":
  36598. case "DisplayDocTitle":
  36599. case "PickTrayByPDFSize":
  36600. if (typeof value === "boolean") {
  36601. prefValue = value;
  36602. }
  36603. break;
  36604. case "NonFullScreenPageMode":
  36605. if (value instanceof Name) {
  36606. switch (value.name) {
  36607. case "UseNone":
  36608. case "UseOutlines":
  36609. case "UseThumbs":
  36610. case "UseOC":
  36611. prefValue = value.name;
  36612. break;
  36613. default:
  36614. prefValue = "UseNone";
  36615. }
  36616. }
  36617. break;
  36618. case "Direction":
  36619. if (value instanceof Name) {
  36620. switch (value.name) {
  36621. case "L2R":
  36622. case "R2L":
  36623. prefValue = value.name;
  36624. break;
  36625. default:
  36626. prefValue = "L2R";
  36627. }
  36628. }
  36629. break;
  36630. case "ViewArea":
  36631. case "ViewClip":
  36632. case "PrintArea":
  36633. case "PrintClip":
  36634. if (value instanceof Name) {
  36635. switch (value.name) {
  36636. case "MediaBox":
  36637. case "CropBox":
  36638. case "BleedBox":
  36639. case "TrimBox":
  36640. case "ArtBox":
  36641. prefValue = value.name;
  36642. break;
  36643. default:
  36644. prefValue = "CropBox";
  36645. }
  36646. }
  36647. break;
  36648. case "PrintScaling":
  36649. if (value instanceof Name) {
  36650. switch (value.name) {
  36651. case "None":
  36652. case "AppDefault":
  36653. prefValue = value.name;
  36654. break;
  36655. default:
  36656. prefValue = "AppDefault";
  36657. }
  36658. }
  36659. break;
  36660. case "Duplex":
  36661. if (value instanceof Name) {
  36662. switch (value.name) {
  36663. case "Simplex":
  36664. case "DuplexFlipShortEdge":
  36665. case "DuplexFlipLongEdge":
  36666. prefValue = value.name;
  36667. break;
  36668. default:
  36669. prefValue = "None";
  36670. }
  36671. }
  36672. break;
  36673. case "PrintPageRange":
  36674. if (Array.isArray(value) && value.length % 2 === 0) {
  36675. const isValid = value.every((page, i, arr) => Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages);
  36676. if (isValid) {
  36677. prefValue = value;
  36678. }
  36679. }
  36680. break;
  36681. case "NumCopies":
  36682. if (Number.isInteger(value) && value > 0) {
  36683. prefValue = value;
  36684. }
  36685. break;
  36686. default:
  36687. warn(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  36688. continue;
  36689. }
  36690. if (prefValue === undefined) {
  36691. warn(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  36692. continue;
  36693. }
  36694. if (!prefs) {
  36695. prefs = Object.create(null);
  36696. }
  36697. prefs[key] = prefValue;
  36698. }
  36699. return shadow(this, "viewerPreferences", prefs);
  36700. }
  36701. get openAction() {
  36702. const obj = this._catDict.get("OpenAction");
  36703. const openAction = Object.create(null);
  36704. if (obj instanceof Dict) {
  36705. const destDict = new Dict(this.xref);
  36706. destDict.set("A", obj);
  36707. const resultObj = {
  36708. url: null,
  36709. dest: null,
  36710. action: null
  36711. };
  36712. Catalog.parseDestDictionary({
  36713. destDict,
  36714. resultObj
  36715. });
  36716. if (Array.isArray(resultObj.dest)) {
  36717. openAction.dest = resultObj.dest;
  36718. } else if (resultObj.action) {
  36719. openAction.action = resultObj.action;
  36720. }
  36721. } else if (Array.isArray(obj)) {
  36722. openAction.dest = obj;
  36723. }
  36724. return shadow(this, "openAction", objectSize(openAction) > 0 ? openAction : null);
  36725. }
  36726. get attachments() {
  36727. const obj = this._catDict.get("Names");
  36728. let attachments = null;
  36729. if (obj instanceof Dict && obj.has("EmbeddedFiles")) {
  36730. const nameTree = new NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  36731. for (const [key, value] of nameTree.getAll()) {
  36732. const fs = new FileSpec(value, this.xref);
  36733. if (!attachments) {
  36734. attachments = Object.create(null);
  36735. }
  36736. attachments[stringToPDFString(key)] = fs.serializable;
  36737. }
  36738. }
  36739. return shadow(this, "attachments", attachments);
  36740. }
  36741. get xfaImages() {
  36742. const obj = this._catDict.get("Names");
  36743. let xfaImages = null;
  36744. if (obj instanceof Dict && obj.has("XFAImages")) {
  36745. const nameTree = new NameTree(obj.getRaw("XFAImages"), this.xref);
  36746. for (const [key, value] of nameTree.getAll()) {
  36747. if (!xfaImages) {
  36748. xfaImages = new Dict(this.xref);
  36749. }
  36750. xfaImages.set(stringToPDFString(key), value);
  36751. }
  36752. }
  36753. return shadow(this, "xfaImages", xfaImages);
  36754. }
  36755. _collectJavaScript() {
  36756. const obj = this._catDict.get("Names");
  36757. let javaScript = null;
  36758. function appendIfJavaScriptDict(name, jsDict) {
  36759. if (!(jsDict instanceof Dict)) {
  36760. return;
  36761. }
  36762. if (!isName(jsDict.get("S"), "JavaScript")) {
  36763. return;
  36764. }
  36765. let js = jsDict.get("JS");
  36766. if (js instanceof BaseStream) {
  36767. js = js.getString();
  36768. } else if (typeof js !== "string") {
  36769. return;
  36770. }
  36771. js = stringToPDFString(js).replaceAll("\x00", "");
  36772. if (js) {
  36773. (javaScript ||= new Map()).set(name, js);
  36774. }
  36775. }
  36776. if (obj instanceof Dict && obj.has("JavaScript")) {
  36777. const nameTree = new NameTree(obj.getRaw("JavaScript"), this.xref);
  36778. for (const [key, value] of nameTree.getAll()) {
  36779. appendIfJavaScriptDict(stringToPDFString(key), value);
  36780. }
  36781. }
  36782. const openAction = this._catDict.get("OpenAction");
  36783. if (openAction) {
  36784. appendIfJavaScriptDict("OpenAction", openAction);
  36785. }
  36786. return javaScript;
  36787. }
  36788. get jsActions() {
  36789. const javaScript = this._collectJavaScript();
  36790. let actions = collectActions(this.xref, this._catDict, DocumentActionEventType);
  36791. if (javaScript) {
  36792. actions ||= Object.create(null);
  36793. for (const [key, val] of javaScript) {
  36794. if (key in actions) {
  36795. actions[key].push(val);
  36796. } else {
  36797. actions[key] = [val];
  36798. }
  36799. }
  36800. }
  36801. return shadow(this, "jsActions", actions);
  36802. }
  36803. async fontFallback(id, handler) {
  36804. const translatedFonts = await Promise.all(this.fontCache);
  36805. for (const translatedFont of translatedFonts) {
  36806. if (translatedFont.loadedName === id) {
  36807. translatedFont.fallback(handler);
  36808. return;
  36809. }
  36810. }
  36811. }
  36812. async cleanup(manuallyTriggered = false) {
  36813. clearGlobalCaches();
  36814. this.globalImageCache.clear(manuallyTriggered);
  36815. this.pageKidsCountCache.clear();
  36816. this.pageIndexCache.clear();
  36817. this.pageDictCache.clear();
  36818. this.nonBlendModesSet.clear();
  36819. const translatedFonts = await Promise.all(this.fontCache);
  36820. for (const {
  36821. dict
  36822. } of translatedFonts) {
  36823. delete dict.cacheKey;
  36824. }
  36825. this.fontCache.clear();
  36826. this.builtInCMapCache.clear();
  36827. this.standardFontDataCache.clear();
  36828. this.systemFontCache.clear();
  36829. }
  36830. async getPageDict(pageIndex) {
  36831. const nodesToVisit = [this.toplevelPagesDict];
  36832. const visitedNodes = new RefSet();
  36833. const pagesRef = this._catDict.getRaw("Pages");
  36834. if (pagesRef instanceof Ref) {
  36835. visitedNodes.put(pagesRef);
  36836. }
  36837. const xref = this.xref,
  36838. pageKidsCountCache = this.pageKidsCountCache,
  36839. pageIndexCache = this.pageIndexCache,
  36840. pageDictCache = this.pageDictCache;
  36841. let currentPageIndex = 0;
  36842. while (nodesToVisit.length) {
  36843. const currentNode = nodesToVisit.pop();
  36844. if (currentNode instanceof Ref) {
  36845. const count = pageKidsCountCache.get(currentNode);
  36846. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  36847. currentPageIndex += count;
  36848. continue;
  36849. }
  36850. if (visitedNodes.has(currentNode)) {
  36851. throw new FormatError("Pages tree contains circular reference.");
  36852. }
  36853. visitedNodes.put(currentNode);
  36854. const obj = await (pageDictCache.get(currentNode) || xref.fetchAsync(currentNode));
  36855. if (obj instanceof Dict) {
  36856. let type = obj.getRaw("Type");
  36857. if (type instanceof Ref) {
  36858. type = await xref.fetchAsync(type);
  36859. }
  36860. if (isName(type, "Page") || !obj.has("Kids")) {
  36861. if (!pageKidsCountCache.has(currentNode)) {
  36862. pageKidsCountCache.put(currentNode, 1);
  36863. }
  36864. if (!pageIndexCache.has(currentNode)) {
  36865. pageIndexCache.put(currentNode, currentPageIndex);
  36866. }
  36867. if (currentPageIndex === pageIndex) {
  36868. return [obj, currentNode];
  36869. }
  36870. currentPageIndex++;
  36871. continue;
  36872. }
  36873. }
  36874. nodesToVisit.push(obj);
  36875. continue;
  36876. }
  36877. if (!(currentNode instanceof Dict)) {
  36878. throw new FormatError("Page dictionary kid reference points to wrong type of object.");
  36879. }
  36880. const {
  36881. objId
  36882. } = currentNode;
  36883. let count = currentNode.getRaw("Count");
  36884. if (count instanceof Ref) {
  36885. count = await xref.fetchAsync(count);
  36886. }
  36887. if (Number.isInteger(count) && count >= 0) {
  36888. if (objId && !pageKidsCountCache.has(objId)) {
  36889. pageKidsCountCache.put(objId, count);
  36890. }
  36891. if (currentPageIndex + count <= pageIndex) {
  36892. currentPageIndex += count;
  36893. continue;
  36894. }
  36895. }
  36896. let kids = currentNode.getRaw("Kids");
  36897. if (kids instanceof Ref) {
  36898. kids = await xref.fetchAsync(kids);
  36899. }
  36900. if (!Array.isArray(kids)) {
  36901. let type = currentNode.getRaw("Type");
  36902. if (type instanceof Ref) {
  36903. type = await xref.fetchAsync(type);
  36904. }
  36905. if (isName(type, "Page") || !currentNode.has("Kids")) {
  36906. if (currentPageIndex === pageIndex) {
  36907. return [currentNode, null];
  36908. }
  36909. currentPageIndex++;
  36910. continue;
  36911. }
  36912. throw new FormatError("Page dictionary kids object is not an array.");
  36913. }
  36914. for (let last = kids.length - 1; last >= 0; last--) {
  36915. const lastKid = kids[last];
  36916. nodesToVisit.push(lastKid);
  36917. if (currentNode === this.toplevelPagesDict && lastKid instanceof Ref && !pageDictCache.has(lastKid)) {
  36918. pageDictCache.put(lastKid, xref.fetchAsync(lastKid));
  36919. }
  36920. }
  36921. }
  36922. throw new Error(`Page index ${pageIndex} not found.`);
  36923. }
  36924. async getAllPageDicts(recoveryMode = false) {
  36925. const {
  36926. ignoreErrors
  36927. } = this.pdfManager.evaluatorOptions;
  36928. const queue = [{
  36929. currentNode: this.toplevelPagesDict,
  36930. posInKids: 0
  36931. }];
  36932. const visitedNodes = new RefSet();
  36933. const pagesRef = this._catDict.getRaw("Pages");
  36934. if (pagesRef instanceof Ref) {
  36935. visitedNodes.put(pagesRef);
  36936. }
  36937. const map = new Map(),
  36938. xref = this.xref,
  36939. pageIndexCache = this.pageIndexCache;
  36940. let pageIndex = 0;
  36941. function addPageDict(pageDict, pageRef) {
  36942. if (pageRef && !pageIndexCache.has(pageRef)) {
  36943. pageIndexCache.put(pageRef, pageIndex);
  36944. }
  36945. map.set(pageIndex++, [pageDict, pageRef]);
  36946. }
  36947. function addPageError(error) {
  36948. if (error instanceof XRefEntryException && !recoveryMode) {
  36949. throw error;
  36950. }
  36951. if (recoveryMode && ignoreErrors && pageIndex === 0) {
  36952. warn(`getAllPageDicts - Skipping invalid first page: "${error}".`);
  36953. error = Dict.empty;
  36954. }
  36955. map.set(pageIndex++, [error, null]);
  36956. }
  36957. while (queue.length > 0) {
  36958. const queueItem = queue.at(-1);
  36959. const {
  36960. currentNode,
  36961. posInKids
  36962. } = queueItem;
  36963. let kids = currentNode.getRaw("Kids");
  36964. if (kids instanceof Ref) {
  36965. try {
  36966. kids = await xref.fetchAsync(kids);
  36967. } catch (ex) {
  36968. addPageError(ex);
  36969. break;
  36970. }
  36971. }
  36972. if (!Array.isArray(kids)) {
  36973. addPageError(new FormatError("Page dictionary kids object is not an array."));
  36974. break;
  36975. }
  36976. if (posInKids >= kids.length) {
  36977. queue.pop();
  36978. continue;
  36979. }
  36980. const kidObj = kids[posInKids];
  36981. let obj;
  36982. if (kidObj instanceof Ref) {
  36983. if (visitedNodes.has(kidObj)) {
  36984. addPageError(new FormatError("Pages tree contains circular reference."));
  36985. break;
  36986. }
  36987. visitedNodes.put(kidObj);
  36988. try {
  36989. obj = await xref.fetchAsync(kidObj);
  36990. } catch (ex) {
  36991. addPageError(ex);
  36992. break;
  36993. }
  36994. } else {
  36995. obj = kidObj;
  36996. }
  36997. if (!(obj instanceof Dict)) {
  36998. addPageError(new FormatError("Page dictionary kid reference points to wrong type of object."));
  36999. break;
  37000. }
  37001. let type = obj.getRaw("Type");
  37002. if (type instanceof Ref) {
  37003. try {
  37004. type = await xref.fetchAsync(type);
  37005. } catch (ex) {
  37006. addPageError(ex);
  37007. break;
  37008. }
  37009. }
  37010. if (isName(type, "Page") || !obj.has("Kids")) {
  37011. addPageDict(obj, kidObj instanceof Ref ? kidObj : null);
  37012. } else {
  37013. queue.push({
  37014. currentNode: obj,
  37015. posInKids: 0
  37016. });
  37017. }
  37018. queueItem.posInKids++;
  37019. }
  37020. return map;
  37021. }
  37022. getPageIndex(pageRef) {
  37023. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  37024. if (cachedPageIndex !== undefined) {
  37025. return Promise.resolve(cachedPageIndex);
  37026. }
  37027. const xref = this.xref;
  37028. function pagesBeforeRef(kidRef) {
  37029. let total = 0,
  37030. parentRef;
  37031. return xref.fetchAsync(kidRef).then(function (node) {
  37032. if (isRefsEqual(kidRef, pageRef) && !isDict(node, "Page") && !(node instanceof Dict && !node.has("Type") && node.has("Contents"))) {
  37033. throw new FormatError("The reference does not point to a /Page dictionary.");
  37034. }
  37035. if (!node) {
  37036. return null;
  37037. }
  37038. if (!(node instanceof Dict)) {
  37039. throw new FormatError("Node must be a dictionary.");
  37040. }
  37041. parentRef = node.getRaw("Parent");
  37042. return node.getAsync("Parent");
  37043. }).then(function (parent) {
  37044. if (!parent) {
  37045. return null;
  37046. }
  37047. if (!(parent instanceof Dict)) {
  37048. throw new FormatError("Parent must be a dictionary.");
  37049. }
  37050. return parent.getAsync("Kids");
  37051. }).then(function (kids) {
  37052. if (!kids) {
  37053. return null;
  37054. }
  37055. const kidPromises = [];
  37056. let found = false;
  37057. for (const kid of kids) {
  37058. if (!(kid instanceof Ref)) {
  37059. throw new FormatError("Kid must be a reference.");
  37060. }
  37061. if (isRefsEqual(kid, kidRef)) {
  37062. found = true;
  37063. break;
  37064. }
  37065. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  37066. if (!(obj instanceof Dict)) {
  37067. throw new FormatError("Kid node must be a dictionary.");
  37068. }
  37069. if (obj.has("Count")) {
  37070. total += obj.get("Count");
  37071. } else {
  37072. total++;
  37073. }
  37074. }));
  37075. }
  37076. if (!found) {
  37077. throw new FormatError("Kid reference not found in parent's kids.");
  37078. }
  37079. return Promise.all(kidPromises).then(function () {
  37080. return [total, parentRef];
  37081. });
  37082. });
  37083. }
  37084. let total = 0;
  37085. const next = ref => pagesBeforeRef(ref).then(args => {
  37086. if (!args) {
  37087. this.pageIndexCache.put(pageRef, total);
  37088. return total;
  37089. }
  37090. const [count, parentRef] = args;
  37091. total += count;
  37092. return next(parentRef);
  37093. });
  37094. return next(pageRef);
  37095. }
  37096. get baseUrl() {
  37097. const uri = this._catDict.get("URI");
  37098. if (uri instanceof Dict) {
  37099. const base = uri.get("Base");
  37100. if (typeof base === "string") {
  37101. const absoluteUrl = createValidAbsoluteUrl(base, null, {
  37102. tryConvertEncoding: true
  37103. });
  37104. if (absoluteUrl) {
  37105. return shadow(this, "baseUrl", absoluteUrl.href);
  37106. }
  37107. }
  37108. }
  37109. return shadow(this, "baseUrl", this.pdfManager.docBaseUrl);
  37110. }
  37111. static parseDestDictionary({
  37112. destDict,
  37113. resultObj,
  37114. docBaseUrl = null,
  37115. docAttachments = null
  37116. }) {
  37117. if (!(destDict instanceof Dict)) {
  37118. warn("parseDestDictionary: `destDict` must be a dictionary.");
  37119. return;
  37120. }
  37121. let action = destDict.get("A"),
  37122. url,
  37123. dest;
  37124. if (!(action instanceof Dict)) {
  37125. if (destDict.has("Dest")) {
  37126. action = destDict.get("Dest");
  37127. } else {
  37128. action = destDict.get("AA");
  37129. if (action instanceof Dict) {
  37130. if (action.has("D")) {
  37131. action = action.get("D");
  37132. } else if (action.has("U")) {
  37133. action = action.get("U");
  37134. }
  37135. }
  37136. }
  37137. }
  37138. if (action instanceof Dict) {
  37139. const actionType = action.get("S");
  37140. if (!(actionType instanceof Name)) {
  37141. warn("parseDestDictionary: Invalid type in Action dictionary.");
  37142. return;
  37143. }
  37144. const actionName = actionType.name;
  37145. switch (actionName) {
  37146. case "ResetForm":
  37147. const flags = action.get("Flags");
  37148. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  37149. const fields = [];
  37150. const refs = [];
  37151. for (const obj of action.get("Fields") || []) {
  37152. if (obj instanceof Ref) {
  37153. refs.push(obj.toString());
  37154. } else if (typeof obj === "string") {
  37155. fields.push(stringToPDFString(obj));
  37156. }
  37157. }
  37158. resultObj.resetForm = {
  37159. fields,
  37160. refs,
  37161. include
  37162. };
  37163. break;
  37164. case "URI":
  37165. url = action.get("URI");
  37166. if (url instanceof Name) {
  37167. url = "/" + url.name;
  37168. }
  37169. break;
  37170. case "GoTo":
  37171. dest = action.get("D");
  37172. break;
  37173. case "Launch":
  37174. case "GoToR":
  37175. const urlDict = action.get("F");
  37176. if (urlDict instanceof Dict) {
  37177. const fs = new FileSpec(urlDict, null, true);
  37178. const {
  37179. rawFilename
  37180. } = fs.serializable;
  37181. url = rawFilename;
  37182. } else if (typeof urlDict === "string") {
  37183. url = urlDict;
  37184. }
  37185. const remoteDest = fetchRemoteDest(action);
  37186. if (remoteDest && typeof url === "string") {
  37187. url = url.split("#", 1)[0] + "#" + remoteDest;
  37188. }
  37189. const newWindow = action.get("NewWindow");
  37190. if (typeof newWindow === "boolean") {
  37191. resultObj.newWindow = newWindow;
  37192. }
  37193. break;
  37194. case "GoToE":
  37195. const target = action.get("T");
  37196. let attachment;
  37197. if (docAttachments && target instanceof Dict) {
  37198. const relationship = target.get("R");
  37199. const name = target.get("N");
  37200. if (isName(relationship, "C") && typeof name === "string") {
  37201. attachment = docAttachments[stringToPDFString(name)];
  37202. }
  37203. }
  37204. if (attachment) {
  37205. resultObj.attachment = attachment;
  37206. const attachmentDest = fetchRemoteDest(action);
  37207. if (attachmentDest) {
  37208. resultObj.attachmentDest = attachmentDest;
  37209. }
  37210. } else {
  37211. warn(`parseDestDictionary - unimplemented "GoToE" action.`);
  37212. }
  37213. break;
  37214. case "Named":
  37215. const namedAction = action.get("N");
  37216. if (namedAction instanceof Name) {
  37217. resultObj.action = namedAction.name;
  37218. }
  37219. break;
  37220. case "SetOCGState":
  37221. const state = action.get("State");
  37222. const preserveRB = action.get("PreserveRB");
  37223. if (!Array.isArray(state) || state.length === 0) {
  37224. break;
  37225. }
  37226. const stateArr = [];
  37227. for (const elem of state) {
  37228. if (elem instanceof Name) {
  37229. switch (elem.name) {
  37230. case "ON":
  37231. case "OFF":
  37232. case "Toggle":
  37233. stateArr.push(elem.name);
  37234. break;
  37235. }
  37236. } else if (elem instanceof Ref) {
  37237. stateArr.push(elem.toString());
  37238. }
  37239. }
  37240. if (stateArr.length !== state.length) {
  37241. break;
  37242. }
  37243. resultObj.setOCGState = {
  37244. state: stateArr,
  37245. preserveRB: typeof preserveRB === "boolean" ? preserveRB : true
  37246. };
  37247. break;
  37248. case "JavaScript":
  37249. const jsAction = action.get("JS");
  37250. let js;
  37251. if (jsAction instanceof BaseStream) {
  37252. js = jsAction.getString();
  37253. } else if (typeof jsAction === "string") {
  37254. js = jsAction;
  37255. }
  37256. const jsURL = js && recoverJsURL(stringToPDFString(js));
  37257. if (jsURL) {
  37258. url = jsURL.url;
  37259. resultObj.newWindow = jsURL.newWindow;
  37260. break;
  37261. }
  37262. default:
  37263. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  37264. break;
  37265. }
  37266. warn(`parseDestDictionary - unsupported action: "${actionName}".`);
  37267. break;
  37268. }
  37269. } else if (destDict.has("Dest")) {
  37270. dest = destDict.get("Dest");
  37271. }
  37272. if (typeof url === "string") {
  37273. const absoluteUrl = createValidAbsoluteUrl(url, docBaseUrl, {
  37274. addDefaultProtocol: true,
  37275. tryConvertEncoding: true
  37276. });
  37277. if (absoluteUrl) {
  37278. resultObj.url = absoluteUrl.href;
  37279. }
  37280. resultObj.unsafeUrl = url;
  37281. }
  37282. if (dest) {
  37283. if (dest instanceof Name) {
  37284. dest = dest.name;
  37285. }
  37286. if (typeof dest === "string") {
  37287. resultObj.dest = stringToPDFString(dest);
  37288. } else if (isValidExplicitDest(dest)) {
  37289. resultObj.dest = dest;
  37290. }
  37291. }
  37292. }
  37293. }
  37294. ;// ./src/core/object_loader.js
  37295. function mayHaveChildren(value) {
  37296. return value instanceof Ref || value instanceof Dict || value instanceof BaseStream || Array.isArray(value);
  37297. }
  37298. function addChildren(node, nodesToVisit) {
  37299. if (node instanceof Dict) {
  37300. node = node.getRawValues();
  37301. } else if (node instanceof BaseStream) {
  37302. node = node.dict.getRawValues();
  37303. } else if (!Array.isArray(node)) {
  37304. return;
  37305. }
  37306. for (const rawValue of node) {
  37307. if (mayHaveChildren(rawValue)) {
  37308. nodesToVisit.push(rawValue);
  37309. }
  37310. }
  37311. }
  37312. class ObjectLoader {
  37313. constructor(dict, keys, xref) {
  37314. this.dict = dict;
  37315. this.keys = keys;
  37316. this.xref = xref;
  37317. this.refSet = null;
  37318. }
  37319. async load() {
  37320. if (this.xref.stream.isDataLoaded) {
  37321. return undefined;
  37322. }
  37323. const {
  37324. keys,
  37325. dict
  37326. } = this;
  37327. this.refSet = new RefSet();
  37328. const nodesToVisit = [];
  37329. for (const key of keys) {
  37330. const rawValue = dict.getRaw(key);
  37331. if (rawValue !== undefined) {
  37332. nodesToVisit.push(rawValue);
  37333. }
  37334. }
  37335. return this._walk(nodesToVisit);
  37336. }
  37337. async _walk(nodesToVisit) {
  37338. const nodesToRevisit = [];
  37339. const pendingRequests = [];
  37340. while (nodesToVisit.length) {
  37341. let currentNode = nodesToVisit.pop();
  37342. if (currentNode instanceof Ref) {
  37343. if (this.refSet.has(currentNode)) {
  37344. continue;
  37345. }
  37346. try {
  37347. this.refSet.put(currentNode);
  37348. currentNode = this.xref.fetch(currentNode);
  37349. } catch (ex) {
  37350. if (!(ex instanceof MissingDataException)) {
  37351. warn(`ObjectLoader._walk - requesting all data: "${ex}".`);
  37352. this.refSet = null;
  37353. const {
  37354. manager
  37355. } = this.xref.stream;
  37356. return manager.requestAllChunks();
  37357. }
  37358. nodesToRevisit.push(currentNode);
  37359. pendingRequests.push({
  37360. begin: ex.begin,
  37361. end: ex.end
  37362. });
  37363. }
  37364. }
  37365. if (currentNode instanceof BaseStream) {
  37366. const baseStreams = currentNode.getBaseStreams();
  37367. if (baseStreams) {
  37368. let foundMissingData = false;
  37369. for (const stream of baseStreams) {
  37370. if (stream.isDataLoaded) {
  37371. continue;
  37372. }
  37373. foundMissingData = true;
  37374. pendingRequests.push({
  37375. begin: stream.start,
  37376. end: stream.end
  37377. });
  37378. }
  37379. if (foundMissingData) {
  37380. nodesToRevisit.push(currentNode);
  37381. }
  37382. }
  37383. }
  37384. addChildren(currentNode, nodesToVisit);
  37385. }
  37386. if (pendingRequests.length) {
  37387. await this.xref.stream.manager.requestRanges(pendingRequests);
  37388. for (const node of nodesToRevisit) {
  37389. if (node instanceof Ref) {
  37390. this.refSet.remove(node);
  37391. }
  37392. }
  37393. return this._walk(nodesToRevisit);
  37394. }
  37395. this.refSet = null;
  37396. return undefined;
  37397. }
  37398. }
  37399. ;// ./src/core/xfa/symbol_utils.js
  37400. const $acceptWhitespace = Symbol();
  37401. const $addHTML = Symbol();
  37402. const $appendChild = Symbol();
  37403. const $childrenToHTML = Symbol();
  37404. const $clean = Symbol();
  37405. const $cleanPage = Symbol();
  37406. const $cleanup = Symbol();
  37407. const $clone = Symbol();
  37408. const $consumed = Symbol();
  37409. const $content = Symbol("content");
  37410. const $data = Symbol("data");
  37411. const $dump = Symbol();
  37412. const $extra = Symbol("extra");
  37413. const $finalize = Symbol();
  37414. const $flushHTML = Symbol();
  37415. const $getAttributeIt = Symbol();
  37416. const $getAttributes = Symbol();
  37417. const $getAvailableSpace = Symbol();
  37418. const $getChildrenByClass = Symbol();
  37419. const $getChildrenByName = Symbol();
  37420. const $getChildrenByNameIt = Symbol();
  37421. const $getDataValue = Symbol();
  37422. const $getExtra = Symbol();
  37423. const $getRealChildrenByNameIt = Symbol();
  37424. const $getChildren = Symbol();
  37425. const $getContainedChildren = Symbol();
  37426. const $getNextPage = Symbol();
  37427. const $getSubformParent = Symbol();
  37428. const $getParent = Symbol();
  37429. const $getTemplateRoot = Symbol();
  37430. const $globalData = Symbol();
  37431. const $hasSettableValue = Symbol();
  37432. const $ids = Symbol();
  37433. const $indexOf = Symbol();
  37434. const $insertAt = Symbol();
  37435. const $isCDATAXml = Symbol();
  37436. const $isBindable = Symbol();
  37437. const $isDataValue = Symbol();
  37438. const $isDescendent = Symbol();
  37439. const $isNsAgnostic = Symbol();
  37440. const $isSplittable = Symbol();
  37441. const $isThereMoreWidth = Symbol();
  37442. const $isTransparent = Symbol();
  37443. const $isUsable = Symbol();
  37444. const $lastAttribute = Symbol();
  37445. const $namespaceId = Symbol("namespaceId");
  37446. const $nodeName = Symbol("nodeName");
  37447. const $nsAttributes = Symbol();
  37448. const $onChild = Symbol();
  37449. const $onChildCheck = Symbol();
  37450. const $onText = Symbol();
  37451. const $pushGlyphs = Symbol();
  37452. const $popPara = Symbol();
  37453. const $pushPara = Symbol();
  37454. const $removeChild = Symbol();
  37455. const $root = Symbol("root");
  37456. const $resolvePrototypes = Symbol();
  37457. const $searchNode = Symbol();
  37458. const $setId = Symbol();
  37459. const $setSetAttributes = Symbol();
  37460. const $setValue = Symbol();
  37461. const $tabIndex = Symbol();
  37462. const $text = Symbol();
  37463. const $toPages = Symbol();
  37464. const $toHTML = Symbol();
  37465. const $toString = Symbol();
  37466. const $toStyle = Symbol();
  37467. const $uid = Symbol("uid");
  37468. ;// ./src/core/xfa/namespaces.js
  37469. const $buildXFAObject = Symbol();
  37470. const NamespaceIds = {
  37471. config: {
  37472. id: 0,
  37473. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  37474. },
  37475. connectionSet: {
  37476. id: 1,
  37477. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  37478. },
  37479. datasets: {
  37480. id: 2,
  37481. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  37482. },
  37483. form: {
  37484. id: 3,
  37485. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  37486. },
  37487. localeSet: {
  37488. id: 4,
  37489. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  37490. },
  37491. pdf: {
  37492. id: 5,
  37493. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  37494. },
  37495. signature: {
  37496. id: 6,
  37497. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  37498. },
  37499. sourceSet: {
  37500. id: 7,
  37501. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  37502. },
  37503. stylesheet: {
  37504. id: 8,
  37505. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  37506. },
  37507. template: {
  37508. id: 9,
  37509. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  37510. },
  37511. xdc: {
  37512. id: 10,
  37513. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  37514. },
  37515. xdp: {
  37516. id: 11,
  37517. check: ns => ns === "http://ns.adobe.com/xdp/"
  37518. },
  37519. xfdf: {
  37520. id: 12,
  37521. check: ns => ns === "http://ns.adobe.com/xfdf/"
  37522. },
  37523. xhtml: {
  37524. id: 13,
  37525. check: ns => ns === "http://www.w3.org/1999/xhtml"
  37526. },
  37527. xmpmeta: {
  37528. id: 14,
  37529. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  37530. }
  37531. };
  37532. ;// ./src/core/xfa/utils.js
  37533. const dimConverters = {
  37534. pt: x => x,
  37535. cm: x => x / 2.54 * 72,
  37536. mm: x => x / (10 * 2.54) * 72,
  37537. in: x => x * 72,
  37538. px: x => x
  37539. };
  37540. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  37541. function stripQuotes(str) {
  37542. if (str.startsWith("'") || str.startsWith('"')) {
  37543. return str.slice(1, -1);
  37544. }
  37545. return str;
  37546. }
  37547. function getInteger({
  37548. data,
  37549. defaultValue,
  37550. validate
  37551. }) {
  37552. if (!data) {
  37553. return defaultValue;
  37554. }
  37555. data = data.trim();
  37556. const n = parseInt(data, 10);
  37557. if (!isNaN(n) && validate(n)) {
  37558. return n;
  37559. }
  37560. return defaultValue;
  37561. }
  37562. function getFloat({
  37563. data,
  37564. defaultValue,
  37565. validate
  37566. }) {
  37567. if (!data) {
  37568. return defaultValue;
  37569. }
  37570. data = data.trim();
  37571. const n = parseFloat(data);
  37572. if (!isNaN(n) && validate(n)) {
  37573. return n;
  37574. }
  37575. return defaultValue;
  37576. }
  37577. function getKeyword({
  37578. data,
  37579. defaultValue,
  37580. validate
  37581. }) {
  37582. if (!data) {
  37583. return defaultValue;
  37584. }
  37585. data = data.trim();
  37586. if (validate(data)) {
  37587. return data;
  37588. }
  37589. return defaultValue;
  37590. }
  37591. function getStringOption(data, options) {
  37592. return getKeyword({
  37593. data,
  37594. defaultValue: options[0],
  37595. validate: k => options.includes(k)
  37596. });
  37597. }
  37598. function getMeasurement(str, def = "0") {
  37599. def ||= "0";
  37600. if (!str) {
  37601. return getMeasurement(def);
  37602. }
  37603. const match = str.trim().match(measurementPattern);
  37604. if (!match) {
  37605. return getMeasurement(def);
  37606. }
  37607. const [, valueStr, unit] = match;
  37608. const value = parseFloat(valueStr);
  37609. if (isNaN(value)) {
  37610. return getMeasurement(def);
  37611. }
  37612. if (value === 0) {
  37613. return 0;
  37614. }
  37615. const conv = dimConverters[unit];
  37616. if (conv) {
  37617. return conv(value);
  37618. }
  37619. return value;
  37620. }
  37621. function getRatio(data) {
  37622. if (!data) {
  37623. return {
  37624. num: 1,
  37625. den: 1
  37626. };
  37627. }
  37628. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  37629. if (ratio.length === 1) {
  37630. ratio.push(1);
  37631. }
  37632. if (ratio.length === 0) {
  37633. return {
  37634. num: 1,
  37635. den: 1
  37636. };
  37637. }
  37638. const [num, den] = ratio;
  37639. return {
  37640. num,
  37641. den
  37642. };
  37643. }
  37644. function getRelevant(data) {
  37645. if (!data) {
  37646. return [];
  37647. }
  37648. return data.trim().split(/\s+/).map(e => ({
  37649. excluded: e[0] === "-",
  37650. viewname: e.substring(1)
  37651. }));
  37652. }
  37653. function getColor(data, def = [0, 0, 0]) {
  37654. let [r, g, b] = def;
  37655. if (!data) {
  37656. return {
  37657. r,
  37658. g,
  37659. b
  37660. };
  37661. }
  37662. const color = data.trim().split(/\s*,\s*/).map(c => Math.min(Math.max(0, parseInt(c.trim(), 10)), 255)).map(c => isNaN(c) ? 0 : c);
  37663. if (color.length < 3) {
  37664. return {
  37665. r,
  37666. g,
  37667. b
  37668. };
  37669. }
  37670. [r, g, b] = color;
  37671. return {
  37672. r,
  37673. g,
  37674. b
  37675. };
  37676. }
  37677. function getBBox(data) {
  37678. const def = -1;
  37679. if (!data) {
  37680. return {
  37681. x: def,
  37682. y: def,
  37683. width: def,
  37684. height: def
  37685. };
  37686. }
  37687. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  37688. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  37689. return {
  37690. x: def,
  37691. y: def,
  37692. width: def,
  37693. height: def
  37694. };
  37695. }
  37696. const [x, y, width, height] = bbox;
  37697. return {
  37698. x,
  37699. y,
  37700. width,
  37701. height
  37702. };
  37703. }
  37704. class HTMLResult {
  37705. static get FAILURE() {
  37706. return shadow(this, "FAILURE", new HTMLResult(false, null, null, null));
  37707. }
  37708. static get EMPTY() {
  37709. return shadow(this, "EMPTY", new HTMLResult(true, null, null, null));
  37710. }
  37711. constructor(success, html, bbox, breakNode) {
  37712. this.success = success;
  37713. this.html = html;
  37714. this.bbox = bbox;
  37715. this.breakNode = breakNode;
  37716. }
  37717. isBreak() {
  37718. return !!this.breakNode;
  37719. }
  37720. static breakNode(node) {
  37721. return new HTMLResult(false, null, null, node);
  37722. }
  37723. static success(html, bbox = null) {
  37724. return new HTMLResult(true, html, bbox, null);
  37725. }
  37726. }
  37727. ;// ./src/core/xfa/fonts.js
  37728. class FontFinder {
  37729. constructor(pdfFonts) {
  37730. this.fonts = new Map();
  37731. this.cache = new Map();
  37732. this.warned = new Set();
  37733. this.defaultFont = null;
  37734. this.add(pdfFonts);
  37735. }
  37736. add(pdfFonts, reallyMissingFonts = null) {
  37737. for (const pdfFont of pdfFonts) {
  37738. this.addPdfFont(pdfFont);
  37739. }
  37740. for (const pdfFont of this.fonts.values()) {
  37741. if (!pdfFont.regular) {
  37742. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  37743. }
  37744. }
  37745. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  37746. return;
  37747. }
  37748. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  37749. for (const missing of reallyMissingFonts) {
  37750. this.fonts.set(missing, myriad);
  37751. }
  37752. }
  37753. addPdfFont(pdfFont) {
  37754. const cssFontInfo = pdfFont.cssFontInfo;
  37755. const name = cssFontInfo.fontFamily;
  37756. let font = this.fonts.get(name);
  37757. if (!font) {
  37758. font = Object.create(null);
  37759. this.fonts.set(name, font);
  37760. if (!this.defaultFont) {
  37761. this.defaultFont = font;
  37762. }
  37763. }
  37764. let property = "";
  37765. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  37766. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  37767. property = fontWeight >= 700 ? "bolditalic" : "italic";
  37768. } else if (fontWeight >= 700) {
  37769. property = "bold";
  37770. }
  37771. if (!property) {
  37772. if (pdfFont.name.includes("Bold") || pdfFont.psName?.includes("Bold")) {
  37773. property = "bold";
  37774. }
  37775. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName?.includes("Italic") || pdfFont.psName?.endsWith("It")) {
  37776. property += "italic";
  37777. }
  37778. }
  37779. if (!property) {
  37780. property = "regular";
  37781. }
  37782. font[property] = pdfFont;
  37783. }
  37784. getDefault() {
  37785. return this.defaultFont;
  37786. }
  37787. find(fontName, mustWarn = true) {
  37788. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  37789. if (font) {
  37790. return font;
  37791. }
  37792. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  37793. let name = fontName.replaceAll(pattern, "");
  37794. font = this.fonts.get(name);
  37795. if (font) {
  37796. this.cache.set(fontName, font);
  37797. return font;
  37798. }
  37799. name = name.toLowerCase();
  37800. const maybe = [];
  37801. for (const [family, pdfFont] of this.fonts.entries()) {
  37802. if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  37803. maybe.push(pdfFont);
  37804. }
  37805. }
  37806. if (maybe.length === 0) {
  37807. for (const [, pdfFont] of this.fonts.entries()) {
  37808. if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  37809. maybe.push(pdfFont);
  37810. }
  37811. }
  37812. }
  37813. if (maybe.length === 0) {
  37814. name = name.replaceAll(/psmt|mt/gi, "");
  37815. for (const [family, pdfFont] of this.fonts.entries()) {
  37816. if (family.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  37817. maybe.push(pdfFont);
  37818. }
  37819. }
  37820. }
  37821. if (maybe.length === 0) {
  37822. for (const pdfFont of this.fonts.values()) {
  37823. if (pdfFont.regular.name?.replaceAll(pattern, "").toLowerCase().startsWith(name)) {
  37824. maybe.push(pdfFont);
  37825. }
  37826. }
  37827. }
  37828. if (maybe.length >= 1) {
  37829. if (maybe.length !== 1 && mustWarn) {
  37830. warn(`XFA - Too many choices to guess the correct font: ${fontName}`);
  37831. }
  37832. this.cache.set(fontName, maybe[0]);
  37833. return maybe[0];
  37834. }
  37835. if (mustWarn && !this.warned.has(fontName)) {
  37836. this.warned.add(fontName);
  37837. warn(`XFA - Cannot find the font: ${fontName}`);
  37838. }
  37839. return null;
  37840. }
  37841. }
  37842. function selectFont(xfaFont, typeface) {
  37843. if (xfaFont.posture === "italic") {
  37844. if (xfaFont.weight === "bold") {
  37845. return typeface.bolditalic;
  37846. }
  37847. return typeface.italic;
  37848. } else if (xfaFont.weight === "bold") {
  37849. return typeface.bold;
  37850. }
  37851. return typeface.regular;
  37852. }
  37853. function fonts_getMetrics(xfaFont, real = false) {
  37854. let pdfFont = null;
  37855. if (xfaFont) {
  37856. const name = stripQuotes(xfaFont.typeface);
  37857. const typeface = xfaFont[$globalData].fontFinder.find(name);
  37858. pdfFont = selectFont(xfaFont, typeface);
  37859. }
  37860. if (!pdfFont) {
  37861. return {
  37862. lineHeight: 12,
  37863. lineGap: 2,
  37864. lineNoGap: 10
  37865. };
  37866. }
  37867. const size = xfaFont.size || 10;
  37868. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  37869. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  37870. return {
  37871. lineHeight: lineHeight * size,
  37872. lineGap: lineGap * size,
  37873. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  37874. };
  37875. }
  37876. ;// ./src/core/xfa/text.js
  37877. const WIDTH_FACTOR = 1.02;
  37878. class FontInfo {
  37879. constructor(xfaFont, margin, lineHeight, fontFinder) {
  37880. this.lineHeight = lineHeight;
  37881. this.paraMargin = margin || {
  37882. top: 0,
  37883. bottom: 0,
  37884. left: 0,
  37885. right: 0
  37886. };
  37887. if (!xfaFont) {
  37888. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  37889. return;
  37890. }
  37891. this.xfaFont = {
  37892. typeface: xfaFont.typeface,
  37893. posture: xfaFont.posture,
  37894. weight: xfaFont.weight,
  37895. size: xfaFont.size,
  37896. letterSpacing: xfaFont.letterSpacing
  37897. };
  37898. const typeface = fontFinder.find(xfaFont.typeface);
  37899. if (!typeface) {
  37900. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  37901. return;
  37902. }
  37903. this.pdfFont = selectFont(xfaFont, typeface);
  37904. if (!this.pdfFont) {
  37905. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  37906. }
  37907. }
  37908. defaultFont(fontFinder) {
  37909. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  37910. if (font?.regular) {
  37911. const pdfFont = font.regular;
  37912. const info = pdfFont.cssFontInfo;
  37913. const xfaFont = {
  37914. typeface: info.fontFamily,
  37915. posture: "normal",
  37916. weight: "normal",
  37917. size: 10,
  37918. letterSpacing: 0
  37919. };
  37920. return [pdfFont, xfaFont];
  37921. }
  37922. const xfaFont = {
  37923. typeface: "Courier",
  37924. posture: "normal",
  37925. weight: "normal",
  37926. size: 10,
  37927. letterSpacing: 0
  37928. };
  37929. return [null, xfaFont];
  37930. }
  37931. }
  37932. class FontSelector {
  37933. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  37934. this.fontFinder = fontFinder;
  37935. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  37936. }
  37937. pushData(xfaFont, margin, lineHeight) {
  37938. const lastFont = this.stack.at(-1);
  37939. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  37940. if (!xfaFont[name]) {
  37941. xfaFont[name] = lastFont.xfaFont[name];
  37942. }
  37943. }
  37944. for (const name of ["top", "bottom", "left", "right"]) {
  37945. if (isNaN(margin[name])) {
  37946. margin[name] = lastFont.paraMargin[name];
  37947. }
  37948. }
  37949. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  37950. if (!fontInfo.pdfFont) {
  37951. fontInfo.pdfFont = lastFont.pdfFont;
  37952. }
  37953. this.stack.push(fontInfo);
  37954. }
  37955. popFont() {
  37956. this.stack.pop();
  37957. }
  37958. topFont() {
  37959. return this.stack.at(-1);
  37960. }
  37961. }
  37962. class TextMeasure {
  37963. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  37964. this.glyphs = [];
  37965. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  37966. this.extraHeight = 0;
  37967. }
  37968. pushData(xfaFont, margin, lineHeight) {
  37969. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  37970. }
  37971. popFont(xfaFont) {
  37972. return this.fontSelector.popFont();
  37973. }
  37974. addPara() {
  37975. const lastFont = this.fontSelector.topFont();
  37976. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  37977. }
  37978. addString(str) {
  37979. if (!str) {
  37980. return;
  37981. }
  37982. const lastFont = this.fontSelector.topFont();
  37983. const fontSize = lastFont.xfaFont.size;
  37984. if (lastFont.pdfFont) {
  37985. const letterSpacing = lastFont.xfaFont.letterSpacing;
  37986. const pdfFont = lastFont.pdfFont;
  37987. const fontLineHeight = pdfFont.lineHeight || 1.2;
  37988. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  37989. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  37990. const noGap = fontLineHeight - lineGap;
  37991. const firstLineHeight = Math.max(1, noGap) * fontSize;
  37992. const scale = fontSize / 1000;
  37993. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  37994. for (const line of str.split(/[\u2029\n]/)) {
  37995. const encodedLine = pdfFont.encodeString(line).join("");
  37996. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  37997. for (const glyph of glyphs) {
  37998. const width = glyph.width || fallbackWidth;
  37999. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  38000. }
  38001. this.glyphs.push([0, 0, 0, "\n", true]);
  38002. }
  38003. this.glyphs.pop();
  38004. return;
  38005. }
  38006. for (const line of str.split(/[\u2029\n]/)) {
  38007. for (const char of line.split("")) {
  38008. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  38009. }
  38010. this.glyphs.push([0, 0, 0, "\n", true]);
  38011. }
  38012. this.glyphs.pop();
  38013. }
  38014. compute(maxWidth) {
  38015. let lastSpacePos = -1,
  38016. lastSpaceWidth = 0,
  38017. width = 0,
  38018. height = 0,
  38019. currentLineWidth = 0,
  38020. currentLineHeight = 0;
  38021. let isBroken = false;
  38022. let isFirstLine = true;
  38023. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  38024. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  38025. const isSpace = char === " ";
  38026. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  38027. if (isEOL) {
  38028. width = Math.max(width, currentLineWidth);
  38029. currentLineWidth = 0;
  38030. height += currentLineHeight;
  38031. currentLineHeight = glyphHeight;
  38032. lastSpacePos = -1;
  38033. lastSpaceWidth = 0;
  38034. isFirstLine = false;
  38035. continue;
  38036. }
  38037. if (isSpace) {
  38038. if (currentLineWidth + glyphWidth > maxWidth) {
  38039. width = Math.max(width, currentLineWidth);
  38040. currentLineWidth = 0;
  38041. height += currentLineHeight;
  38042. currentLineHeight = glyphHeight;
  38043. lastSpacePos = -1;
  38044. lastSpaceWidth = 0;
  38045. isBroken = true;
  38046. isFirstLine = false;
  38047. } else {
  38048. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  38049. lastSpaceWidth = currentLineWidth;
  38050. currentLineWidth += glyphWidth;
  38051. lastSpacePos = i;
  38052. }
  38053. continue;
  38054. }
  38055. if (currentLineWidth + glyphWidth > maxWidth) {
  38056. height += currentLineHeight;
  38057. currentLineHeight = glyphHeight;
  38058. if (lastSpacePos !== -1) {
  38059. i = lastSpacePos;
  38060. width = Math.max(width, lastSpaceWidth);
  38061. currentLineWidth = 0;
  38062. lastSpacePos = -1;
  38063. lastSpaceWidth = 0;
  38064. } else {
  38065. width = Math.max(width, currentLineWidth);
  38066. currentLineWidth = glyphWidth;
  38067. }
  38068. isBroken = true;
  38069. isFirstLine = false;
  38070. continue;
  38071. }
  38072. currentLineWidth += glyphWidth;
  38073. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  38074. }
  38075. width = Math.max(width, currentLineWidth);
  38076. height += currentLineHeight + this.extraHeight;
  38077. return {
  38078. width: WIDTH_FACTOR * width,
  38079. height,
  38080. isBroken
  38081. };
  38082. }
  38083. }
  38084. ;// ./src/core/xfa/som.js
  38085. const namePattern = /^[^.[]+/;
  38086. const indexPattern = /^[^\]]+/;
  38087. const operators = {
  38088. dot: 0,
  38089. dotDot: 1,
  38090. dotHash: 2,
  38091. dotBracket: 3,
  38092. dotParen: 4
  38093. };
  38094. const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[$getChildren]()[0]], ["$template", (root, current) => root.template], ["$connectionSet", (root, current) => root.connectionSet], ["$form", (root, current) => root.form], ["$layout", (root, current) => root.layout], ["$host", (root, current) => root.host], ["$dataWindow", (root, current) => root.dataWindow], ["$event", (root, current) => root.event], ["!", (root, current) => root.datasets], ["$xfa", (root, current) => root], ["xfa", (root, current) => root], ["$", (root, current) => current]]);
  38095. const somCache = new WeakMap();
  38096. function parseIndex(index) {
  38097. index = index.trim();
  38098. if (index === "*") {
  38099. return Infinity;
  38100. }
  38101. return parseInt(index, 10) || 0;
  38102. }
  38103. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  38104. let match = expr.match(namePattern);
  38105. if (!match) {
  38106. return null;
  38107. }
  38108. let [name] = match;
  38109. const parsed = [{
  38110. name,
  38111. cacheName: "." + name,
  38112. index: 0,
  38113. js: null,
  38114. formCalc: null,
  38115. operator: operators.dot
  38116. }];
  38117. let pos = name.length;
  38118. while (pos < expr.length) {
  38119. const spos = pos;
  38120. const char = expr.charAt(pos++);
  38121. if (char === "[") {
  38122. match = expr.slice(pos).match(indexPattern);
  38123. if (!match) {
  38124. warn("XFA - Invalid index in SOM expression");
  38125. return null;
  38126. }
  38127. parsed.at(-1).index = parseIndex(match[0]);
  38128. pos += match[0].length + 1;
  38129. continue;
  38130. }
  38131. let operator;
  38132. switch (expr.charAt(pos)) {
  38133. case ".":
  38134. if (!dotDotAllowed) {
  38135. return null;
  38136. }
  38137. pos++;
  38138. operator = operators.dotDot;
  38139. break;
  38140. case "#":
  38141. pos++;
  38142. operator = operators.dotHash;
  38143. break;
  38144. case "[":
  38145. if (noExpr) {
  38146. warn("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  38147. return null;
  38148. }
  38149. operator = operators.dotBracket;
  38150. break;
  38151. case "(":
  38152. if (noExpr) {
  38153. warn("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  38154. return null;
  38155. }
  38156. operator = operators.dotParen;
  38157. break;
  38158. default:
  38159. operator = operators.dot;
  38160. break;
  38161. }
  38162. match = expr.slice(pos).match(namePattern);
  38163. if (!match) {
  38164. break;
  38165. }
  38166. [name] = match;
  38167. pos += name.length;
  38168. parsed.push({
  38169. name,
  38170. cacheName: expr.slice(spos, pos),
  38171. operator,
  38172. index: 0,
  38173. js: null,
  38174. formCalc: null
  38175. });
  38176. }
  38177. return parsed;
  38178. }
  38179. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  38180. const parsed = parseExpression(expr, dotDotAllowed);
  38181. if (!parsed) {
  38182. return null;
  38183. }
  38184. const fn = shortcuts.get(parsed[0].name);
  38185. let i = 0;
  38186. let isQualified;
  38187. if (fn) {
  38188. isQualified = true;
  38189. root = [fn(root, container)];
  38190. i = 1;
  38191. } else {
  38192. isQualified = container === null;
  38193. root = [container || root];
  38194. }
  38195. for (let ii = parsed.length; i < ii; i++) {
  38196. const {
  38197. name,
  38198. cacheName,
  38199. operator,
  38200. index
  38201. } = parsed[i];
  38202. const nodes = [];
  38203. for (const node of root) {
  38204. if (!node.isXFAObject) {
  38205. continue;
  38206. }
  38207. let children, cached;
  38208. if (useCache) {
  38209. cached = somCache.get(node);
  38210. if (!cached) {
  38211. cached = new Map();
  38212. somCache.set(node, cached);
  38213. }
  38214. children = cached.get(cacheName);
  38215. }
  38216. if (!children) {
  38217. switch (operator) {
  38218. case operators.dot:
  38219. children = node[$getChildrenByName](name, false);
  38220. break;
  38221. case operators.dotDot:
  38222. children = node[$getChildrenByName](name, true);
  38223. break;
  38224. case operators.dotHash:
  38225. children = node[$getChildrenByClass](name);
  38226. children = children.isXFAObjectArray ? children.children : [children];
  38227. break;
  38228. default:
  38229. break;
  38230. }
  38231. if (useCache) {
  38232. cached.set(cacheName, children);
  38233. }
  38234. }
  38235. if (children.length > 0) {
  38236. nodes.push(children);
  38237. }
  38238. }
  38239. if (nodes.length === 0 && !isQualified && i === 0) {
  38240. const parent = container[$getParent]();
  38241. container = parent;
  38242. if (!container) {
  38243. return null;
  38244. }
  38245. i = -1;
  38246. root = [container];
  38247. continue;
  38248. }
  38249. root = isFinite(index) ? nodes.filter(node => index < node.length).map(node => node[index]) : nodes.flat();
  38250. }
  38251. if (root.length === 0) {
  38252. return null;
  38253. }
  38254. return root;
  38255. }
  38256. function createDataNode(root, container, expr) {
  38257. const parsed = parseExpression(expr);
  38258. if (!parsed) {
  38259. return null;
  38260. }
  38261. if (parsed.some(x => x.operator === operators.dotDot)) {
  38262. return null;
  38263. }
  38264. const fn = shortcuts.get(parsed[0].name);
  38265. let i = 0;
  38266. if (fn) {
  38267. root = fn(root, container);
  38268. i = 1;
  38269. } else {
  38270. root = container || root;
  38271. }
  38272. for (let ii = parsed.length; i < ii; i++) {
  38273. const {
  38274. name,
  38275. operator,
  38276. index
  38277. } = parsed[i];
  38278. if (!isFinite(index)) {
  38279. parsed[i].index = 0;
  38280. return root.createNodes(parsed.slice(i));
  38281. }
  38282. let children;
  38283. switch (operator) {
  38284. case operators.dot:
  38285. children = root[$getChildrenByName](name, false);
  38286. break;
  38287. case operators.dotDot:
  38288. children = root[$getChildrenByName](name, true);
  38289. break;
  38290. case operators.dotHash:
  38291. children = root[$getChildrenByClass](name);
  38292. children = children.isXFAObjectArray ? children.children : [children];
  38293. break;
  38294. default:
  38295. break;
  38296. }
  38297. if (children.length === 0) {
  38298. return root.createNodes(parsed.slice(i));
  38299. }
  38300. if (index < children.length) {
  38301. const child = children[index];
  38302. if (!child.isXFAObject) {
  38303. warn(`XFA - Cannot create a node.`);
  38304. return null;
  38305. }
  38306. root = child;
  38307. } else {
  38308. parsed[i].index = index - children.length;
  38309. return root.createNodes(parsed.slice(i));
  38310. }
  38311. }
  38312. return null;
  38313. }
  38314. ;// ./src/core/xfa/xfa_object.js
  38315. const _applyPrototype = Symbol();
  38316. const _attributes = Symbol();
  38317. const _attributeNames = Symbol();
  38318. const _children = Symbol("_children");
  38319. const _cloneAttribute = Symbol();
  38320. const _dataValue = Symbol();
  38321. const _defaultValue = Symbol();
  38322. const _filteredChildrenGenerator = Symbol();
  38323. const _getPrototype = Symbol();
  38324. const _getUnsetAttributes = Symbol();
  38325. const _hasChildren = Symbol();
  38326. const _max = Symbol();
  38327. const _options = Symbol();
  38328. const _parent = Symbol("parent");
  38329. const _resolvePrototypesHelper = Symbol();
  38330. const _setAttributes = Symbol();
  38331. const _validator = Symbol();
  38332. let uid = 0;
  38333. const NS_DATASETS = NamespaceIds.datasets.id;
  38334. class XFAObject {
  38335. constructor(nsId, name, hasChildren = false) {
  38336. this[$namespaceId] = nsId;
  38337. this[$nodeName] = name;
  38338. this[_hasChildren] = hasChildren;
  38339. this[_parent] = null;
  38340. this[_children] = [];
  38341. this[$uid] = `${name}${uid++}`;
  38342. this[$globalData] = null;
  38343. }
  38344. get isXFAObject() {
  38345. return true;
  38346. }
  38347. get isXFAObjectArray() {
  38348. return false;
  38349. }
  38350. createNodes(path) {
  38351. let root = this,
  38352. node = null;
  38353. for (const {
  38354. name,
  38355. index
  38356. } of path) {
  38357. for (let i = 0, ii = isFinite(index) ? index : 0; i <= ii; i++) {
  38358. const nsId = root[$namespaceId] === NS_DATASETS ? -1 : root[$namespaceId];
  38359. node = new XmlObject(nsId, name);
  38360. root[$appendChild](node);
  38361. }
  38362. root = node;
  38363. }
  38364. return node;
  38365. }
  38366. [$onChild](child) {
  38367. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  38368. return false;
  38369. }
  38370. const name = child[$nodeName];
  38371. const node = this[name];
  38372. if (node instanceof XFAObjectArray) {
  38373. if (node.push(child)) {
  38374. this[$appendChild](child);
  38375. return true;
  38376. }
  38377. } else {
  38378. if (node !== null) {
  38379. this[$removeChild](node);
  38380. }
  38381. this[name] = child;
  38382. this[$appendChild](child);
  38383. return true;
  38384. }
  38385. let id = "";
  38386. if (this.id) {
  38387. id = ` (id: ${this.id})`;
  38388. } else if (this.name) {
  38389. id = ` (name: ${this.name} ${this.h.value})`;
  38390. }
  38391. warn(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  38392. return false;
  38393. }
  38394. [$onChildCheck](child) {
  38395. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  38396. }
  38397. [$isNsAgnostic]() {
  38398. return false;
  38399. }
  38400. [$acceptWhitespace]() {
  38401. return false;
  38402. }
  38403. [$isCDATAXml]() {
  38404. return false;
  38405. }
  38406. [$isBindable]() {
  38407. return false;
  38408. }
  38409. [$popPara]() {
  38410. if (this.para) {
  38411. this[$getTemplateRoot]()[$extra].paraStack.pop();
  38412. }
  38413. }
  38414. [$pushPara]() {
  38415. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  38416. }
  38417. [$setId](ids) {
  38418. if (this.id && this[$namespaceId] === NamespaceIds.template.id) {
  38419. ids.set(this.id, this);
  38420. }
  38421. }
  38422. [$getTemplateRoot]() {
  38423. return this[$globalData].template;
  38424. }
  38425. [$isSplittable]() {
  38426. return false;
  38427. }
  38428. [$isThereMoreWidth]() {
  38429. return false;
  38430. }
  38431. [$appendChild](child) {
  38432. child[_parent] = this;
  38433. this[_children].push(child);
  38434. if (!child[$globalData] && this[$globalData]) {
  38435. child[$globalData] = this[$globalData];
  38436. }
  38437. }
  38438. [$removeChild](child) {
  38439. const i = this[_children].indexOf(child);
  38440. this[_children].splice(i, 1);
  38441. }
  38442. [$hasSettableValue]() {
  38443. return this.hasOwnProperty("value");
  38444. }
  38445. [$setValue](_) {}
  38446. [$onText](_) {}
  38447. [$finalize]() {}
  38448. [$clean](builder) {
  38449. delete this[_hasChildren];
  38450. if (this[$cleanup]) {
  38451. builder.clean(this[$cleanup]);
  38452. delete this[$cleanup];
  38453. }
  38454. }
  38455. [$indexOf](child) {
  38456. return this[_children].indexOf(child);
  38457. }
  38458. [$insertAt](i, child) {
  38459. child[_parent] = this;
  38460. this[_children].splice(i, 0, child);
  38461. if (!child[$globalData] && this[$globalData]) {
  38462. child[$globalData] = this[$globalData];
  38463. }
  38464. }
  38465. [$isTransparent]() {
  38466. return !this.name;
  38467. }
  38468. [$lastAttribute]() {
  38469. return "";
  38470. }
  38471. [$text]() {
  38472. if (this[_children].length === 0) {
  38473. return this[$content];
  38474. }
  38475. return this[_children].map(c => c[$text]()).join("");
  38476. }
  38477. get [_attributeNames]() {
  38478. const proto = Object.getPrototypeOf(this);
  38479. if (!proto._attributes) {
  38480. const attributes = proto._attributes = new Set();
  38481. for (const name of Object.getOwnPropertyNames(this)) {
  38482. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  38483. break;
  38484. }
  38485. attributes.add(name);
  38486. }
  38487. }
  38488. return shadow(this, _attributeNames, proto._attributes);
  38489. }
  38490. [$isDescendent](parent) {
  38491. let node = this;
  38492. while (node) {
  38493. if (node === parent) {
  38494. return true;
  38495. }
  38496. node = node[$getParent]();
  38497. }
  38498. return false;
  38499. }
  38500. [$getParent]() {
  38501. return this[_parent];
  38502. }
  38503. [$getSubformParent]() {
  38504. return this[$getParent]();
  38505. }
  38506. [$getChildren](name = null) {
  38507. if (!name) {
  38508. return this[_children];
  38509. }
  38510. return this[name];
  38511. }
  38512. [$dump]() {
  38513. const dumped = Object.create(null);
  38514. if (this[$content]) {
  38515. dumped.$content = this[$content];
  38516. }
  38517. for (const name of Object.getOwnPropertyNames(this)) {
  38518. const value = this[name];
  38519. if (value === null) {
  38520. continue;
  38521. }
  38522. if (value instanceof XFAObject) {
  38523. dumped[name] = value[$dump]();
  38524. } else if (value instanceof XFAObjectArray) {
  38525. if (!value.isEmpty()) {
  38526. dumped[name] = value.dump();
  38527. }
  38528. } else {
  38529. dumped[name] = value;
  38530. }
  38531. }
  38532. return dumped;
  38533. }
  38534. [$toStyle]() {
  38535. return null;
  38536. }
  38537. [$toHTML]() {
  38538. return HTMLResult.EMPTY;
  38539. }
  38540. *[$getContainedChildren]() {
  38541. for (const node of this[$getChildren]()) {
  38542. yield node;
  38543. }
  38544. }
  38545. *[_filteredChildrenGenerator](filter, include) {
  38546. for (const node of this[$getContainedChildren]()) {
  38547. if (!filter || include === filter.has(node[$nodeName])) {
  38548. const availableSpace = this[$getAvailableSpace]();
  38549. const res = node[$toHTML](availableSpace);
  38550. if (!res.success) {
  38551. this[$extra].failingNode = node;
  38552. }
  38553. yield res;
  38554. }
  38555. }
  38556. }
  38557. [$flushHTML]() {
  38558. return null;
  38559. }
  38560. [$addHTML](html, bbox) {
  38561. this[$extra].children.push(html);
  38562. }
  38563. [$getAvailableSpace]() {}
  38564. [$childrenToHTML]({
  38565. filter = null,
  38566. include = true
  38567. }) {
  38568. if (!this[$extra].generator) {
  38569. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  38570. } else {
  38571. const availableSpace = this[$getAvailableSpace]();
  38572. const res = this[$extra].failingNode[$toHTML](availableSpace);
  38573. if (!res.success) {
  38574. return res;
  38575. }
  38576. if (res.html) {
  38577. this[$addHTML](res.html, res.bbox);
  38578. }
  38579. delete this[$extra].failingNode;
  38580. }
  38581. while (true) {
  38582. const gen = this[$extra].generator.next();
  38583. if (gen.done) {
  38584. break;
  38585. }
  38586. const res = gen.value;
  38587. if (!res.success) {
  38588. return res;
  38589. }
  38590. if (res.html) {
  38591. this[$addHTML](res.html, res.bbox);
  38592. }
  38593. }
  38594. this[$extra].generator = null;
  38595. return HTMLResult.EMPTY;
  38596. }
  38597. [$setSetAttributes](attributes) {
  38598. this[_setAttributes] = new Set(Object.keys(attributes));
  38599. }
  38600. [_getUnsetAttributes](protoAttributes) {
  38601. const allAttr = this[_attributeNames];
  38602. const setAttr = this[_setAttributes];
  38603. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  38604. }
  38605. [$resolvePrototypes](ids, ancestors = new Set()) {
  38606. for (const child of this[_children]) {
  38607. child[_resolvePrototypesHelper](ids, ancestors);
  38608. }
  38609. }
  38610. [_resolvePrototypesHelper](ids, ancestors) {
  38611. const proto = this[_getPrototype](ids, ancestors);
  38612. if (proto) {
  38613. this[_applyPrototype](proto, ids, ancestors);
  38614. } else {
  38615. this[$resolvePrototypes](ids, ancestors);
  38616. }
  38617. }
  38618. [_getPrototype](ids, ancestors) {
  38619. const {
  38620. use,
  38621. usehref
  38622. } = this;
  38623. if (!use && !usehref) {
  38624. return null;
  38625. }
  38626. let proto = null;
  38627. let somExpression = null;
  38628. let id = null;
  38629. let ref = use;
  38630. if (usehref) {
  38631. ref = usehref;
  38632. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  38633. somExpression = usehref.slice("#som(".length, -1);
  38634. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  38635. somExpression = usehref.slice(".#som(".length, -1);
  38636. } else if (usehref.startsWith("#")) {
  38637. id = usehref.slice(1);
  38638. } else if (usehref.startsWith(".#")) {
  38639. id = usehref.slice(2);
  38640. }
  38641. } else if (use.startsWith("#")) {
  38642. id = use.slice(1);
  38643. } else {
  38644. somExpression = use;
  38645. }
  38646. this.use = this.usehref = "";
  38647. if (id) {
  38648. proto = ids.get(id);
  38649. } else {
  38650. proto = searchNode(ids.get($root), this, somExpression, true, false);
  38651. if (proto) {
  38652. proto = proto[0];
  38653. }
  38654. }
  38655. if (!proto) {
  38656. warn(`XFA - Invalid prototype reference: ${ref}.`);
  38657. return null;
  38658. }
  38659. if (proto[$nodeName] !== this[$nodeName]) {
  38660. warn(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  38661. return null;
  38662. }
  38663. if (ancestors.has(proto)) {
  38664. warn(`XFA - Cycle detected in prototypes use.`);
  38665. return null;
  38666. }
  38667. ancestors.add(proto);
  38668. const protoProto = proto[_getPrototype](ids, ancestors);
  38669. if (protoProto) {
  38670. proto[_applyPrototype](protoProto, ids, ancestors);
  38671. }
  38672. proto[$resolvePrototypes](ids, ancestors);
  38673. ancestors.delete(proto);
  38674. return proto;
  38675. }
  38676. [_applyPrototype](proto, ids, ancestors) {
  38677. if (ancestors.has(proto)) {
  38678. warn(`XFA - Cycle detected in prototypes use.`);
  38679. return;
  38680. }
  38681. if (!this[$content] && proto[$content]) {
  38682. this[$content] = proto[$content];
  38683. }
  38684. const newAncestors = new Set(ancestors);
  38685. newAncestors.add(proto);
  38686. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  38687. this[unsetAttrName] = proto[unsetAttrName];
  38688. if (this[_setAttributes]) {
  38689. this[_setAttributes].add(unsetAttrName);
  38690. }
  38691. }
  38692. for (const name of Object.getOwnPropertyNames(this)) {
  38693. if (this[_attributeNames].has(name)) {
  38694. continue;
  38695. }
  38696. const value = this[name];
  38697. const protoValue = proto[name];
  38698. if (value instanceof XFAObjectArray) {
  38699. for (const child of value[_children]) {
  38700. child[_resolvePrototypesHelper](ids, ancestors);
  38701. }
  38702. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  38703. const child = proto[_children][i][$clone]();
  38704. if (value.push(child)) {
  38705. child[_parent] = this;
  38706. this[_children].push(child);
  38707. child[_resolvePrototypesHelper](ids, ancestors);
  38708. } else {
  38709. break;
  38710. }
  38711. }
  38712. continue;
  38713. }
  38714. if (value !== null) {
  38715. value[$resolvePrototypes](ids, ancestors);
  38716. if (protoValue) {
  38717. value[_applyPrototype](protoValue, ids, ancestors);
  38718. }
  38719. continue;
  38720. }
  38721. if (protoValue !== null) {
  38722. const child = protoValue[$clone]();
  38723. child[_parent] = this;
  38724. this[name] = child;
  38725. this[_children].push(child);
  38726. child[_resolvePrototypesHelper](ids, ancestors);
  38727. }
  38728. }
  38729. }
  38730. static [_cloneAttribute](obj) {
  38731. if (Array.isArray(obj)) {
  38732. return obj.map(x => XFAObject[_cloneAttribute](x));
  38733. }
  38734. if (typeof obj === "object" && obj !== null) {
  38735. return Object.assign({}, obj);
  38736. }
  38737. return obj;
  38738. }
  38739. [$clone]() {
  38740. const clone = Object.create(Object.getPrototypeOf(this));
  38741. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  38742. try {
  38743. clone[$symbol] = this[$symbol];
  38744. } catch {
  38745. shadow(clone, $symbol, this[$symbol]);
  38746. }
  38747. }
  38748. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  38749. clone[_children] = [];
  38750. for (const name of Object.getOwnPropertyNames(this)) {
  38751. if (this[_attributeNames].has(name)) {
  38752. clone[name] = XFAObject[_cloneAttribute](this[name]);
  38753. continue;
  38754. }
  38755. const value = this[name];
  38756. clone[name] = value instanceof XFAObjectArray ? new XFAObjectArray(value[_max]) : null;
  38757. }
  38758. for (const child of this[_children]) {
  38759. const name = child[$nodeName];
  38760. const clonedChild = child[$clone]();
  38761. clone[_children].push(clonedChild);
  38762. clonedChild[_parent] = clone;
  38763. if (clone[name] === null) {
  38764. clone[name] = clonedChild;
  38765. } else {
  38766. clone[name][_children].push(clonedChild);
  38767. }
  38768. }
  38769. return clone;
  38770. }
  38771. [$getChildren](name = null) {
  38772. if (!name) {
  38773. return this[_children];
  38774. }
  38775. return this[_children].filter(c => c[$nodeName] === name);
  38776. }
  38777. [$getChildrenByClass](name) {
  38778. return this[name];
  38779. }
  38780. [$getChildrenByName](name, allTransparent, first = true) {
  38781. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  38782. }
  38783. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  38784. if (name === "parent") {
  38785. yield this[_parent];
  38786. return;
  38787. }
  38788. for (const child of this[_children]) {
  38789. if (child[$nodeName] === name) {
  38790. yield child;
  38791. }
  38792. if (child.name === name) {
  38793. yield child;
  38794. }
  38795. if (allTransparent || child[$isTransparent]()) {
  38796. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  38797. }
  38798. }
  38799. if (first && this[_attributeNames].has(name)) {
  38800. yield new XFAAttribute(this, name, this[name]);
  38801. }
  38802. }
  38803. }
  38804. class XFAObjectArray {
  38805. constructor(max = Infinity) {
  38806. this[_max] = max;
  38807. this[_children] = [];
  38808. }
  38809. get isXFAObject() {
  38810. return false;
  38811. }
  38812. get isXFAObjectArray() {
  38813. return true;
  38814. }
  38815. push(child) {
  38816. const len = this[_children].length;
  38817. if (len <= this[_max]) {
  38818. this[_children].push(child);
  38819. return true;
  38820. }
  38821. warn(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  38822. return false;
  38823. }
  38824. isEmpty() {
  38825. return this[_children].length === 0;
  38826. }
  38827. dump() {
  38828. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  38829. }
  38830. [$clone]() {
  38831. const clone = new XFAObjectArray(this[_max]);
  38832. clone[_children] = this[_children].map(c => c[$clone]());
  38833. return clone;
  38834. }
  38835. get children() {
  38836. return this[_children];
  38837. }
  38838. clear() {
  38839. this[_children].length = 0;
  38840. }
  38841. }
  38842. class XFAAttribute {
  38843. constructor(node, name, value) {
  38844. this[_parent] = node;
  38845. this[$nodeName] = name;
  38846. this[$content] = value;
  38847. this[$consumed] = false;
  38848. this[$uid] = `attribute${uid++}`;
  38849. }
  38850. [$getParent]() {
  38851. return this[_parent];
  38852. }
  38853. [$isDataValue]() {
  38854. return true;
  38855. }
  38856. [$getDataValue]() {
  38857. return this[$content].trim();
  38858. }
  38859. [$setValue](value) {
  38860. value = value.value || "";
  38861. this[$content] = value.toString();
  38862. }
  38863. [$text]() {
  38864. return this[$content];
  38865. }
  38866. [$isDescendent](parent) {
  38867. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  38868. }
  38869. }
  38870. class XmlObject extends XFAObject {
  38871. constructor(nsId, name, attributes = {}) {
  38872. super(nsId, name);
  38873. this[$content] = "";
  38874. this[_dataValue] = null;
  38875. if (name !== "#text") {
  38876. const map = new Map();
  38877. this[_attributes] = map;
  38878. for (const [attrName, value] of Object.entries(attributes)) {
  38879. map.set(attrName, new XFAAttribute(this, attrName, value));
  38880. }
  38881. if (attributes.hasOwnProperty($nsAttributes)) {
  38882. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  38883. if (dataNode !== undefined) {
  38884. if (dataNode === "dataGroup") {
  38885. this[_dataValue] = false;
  38886. } else if (dataNode === "dataValue") {
  38887. this[_dataValue] = true;
  38888. }
  38889. }
  38890. }
  38891. }
  38892. this[$consumed] = false;
  38893. }
  38894. [$toString](buf) {
  38895. const tagName = this[$nodeName];
  38896. if (tagName === "#text") {
  38897. buf.push(encodeToXmlString(this[$content]));
  38898. return;
  38899. }
  38900. const utf8TagName = utf8StringToString(tagName);
  38901. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  38902. buf.push(`<${prefix}${utf8TagName}`);
  38903. for (const [name, value] of this[_attributes].entries()) {
  38904. const utf8Name = utf8StringToString(name);
  38905. buf.push(` ${utf8Name}="${encodeToXmlString(value[$content])}"`);
  38906. }
  38907. if (this[_dataValue] !== null) {
  38908. if (this[_dataValue]) {
  38909. buf.push(` xfa:dataNode="dataValue"`);
  38910. } else {
  38911. buf.push(` xfa:dataNode="dataGroup"`);
  38912. }
  38913. }
  38914. if (!this[$content] && this[_children].length === 0) {
  38915. buf.push("/>");
  38916. return;
  38917. }
  38918. buf.push(">");
  38919. if (this[$content]) {
  38920. if (typeof this[$content] === "string") {
  38921. buf.push(encodeToXmlString(this[$content]));
  38922. } else {
  38923. this[$content][$toString](buf);
  38924. }
  38925. } else {
  38926. for (const child of this[_children]) {
  38927. child[$toString](buf);
  38928. }
  38929. }
  38930. buf.push(`</${prefix}${utf8TagName}>`);
  38931. }
  38932. [$onChild](child) {
  38933. if (this[$content]) {
  38934. const node = new XmlObject(this[$namespaceId], "#text");
  38935. this[$appendChild](node);
  38936. node[$content] = this[$content];
  38937. this[$content] = "";
  38938. }
  38939. this[$appendChild](child);
  38940. return true;
  38941. }
  38942. [$onText](str) {
  38943. this[$content] += str;
  38944. }
  38945. [$finalize]() {
  38946. if (this[$content] && this[_children].length > 0) {
  38947. const node = new XmlObject(this[$namespaceId], "#text");
  38948. this[$appendChild](node);
  38949. node[$content] = this[$content];
  38950. delete this[$content];
  38951. }
  38952. }
  38953. [$toHTML]() {
  38954. if (this[$nodeName] === "#text") {
  38955. return HTMLResult.success({
  38956. name: "#text",
  38957. value: this[$content]
  38958. });
  38959. }
  38960. return HTMLResult.EMPTY;
  38961. }
  38962. [$getChildren](name = null) {
  38963. if (!name) {
  38964. return this[_children];
  38965. }
  38966. return this[_children].filter(c => c[$nodeName] === name);
  38967. }
  38968. [$getAttributes]() {
  38969. return this[_attributes];
  38970. }
  38971. [$getChildrenByClass](name) {
  38972. const value = this[_attributes].get(name);
  38973. if (value !== undefined) {
  38974. return value;
  38975. }
  38976. return this[$getChildren](name);
  38977. }
  38978. *[$getChildrenByNameIt](name, allTransparent) {
  38979. const value = this[_attributes].get(name);
  38980. if (value) {
  38981. yield value;
  38982. }
  38983. for (const child of this[_children]) {
  38984. if (child[$nodeName] === name) {
  38985. yield child;
  38986. }
  38987. if (allTransparent) {
  38988. yield* child[$getChildrenByNameIt](name, allTransparent);
  38989. }
  38990. }
  38991. }
  38992. *[$getAttributeIt](name, skipConsumed) {
  38993. const value = this[_attributes].get(name);
  38994. if (value && (!skipConsumed || !value[$consumed])) {
  38995. yield value;
  38996. }
  38997. for (const child of this[_children]) {
  38998. yield* child[$getAttributeIt](name, skipConsumed);
  38999. }
  39000. }
  39001. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  39002. for (const child of this[_children]) {
  39003. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  39004. yield child;
  39005. }
  39006. if (allTransparent) {
  39007. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  39008. }
  39009. }
  39010. }
  39011. [$isDataValue]() {
  39012. if (this[_dataValue] === null) {
  39013. return this[_children].length === 0 || this[_children][0][$namespaceId] === NamespaceIds.xhtml.id;
  39014. }
  39015. return this[_dataValue];
  39016. }
  39017. [$getDataValue]() {
  39018. if (this[_dataValue] === null) {
  39019. if (this[_children].length === 0) {
  39020. return this[$content].trim();
  39021. }
  39022. if (this[_children][0][$namespaceId] === NamespaceIds.xhtml.id) {
  39023. return this[_children][0][$text]().trim();
  39024. }
  39025. return null;
  39026. }
  39027. return this[$content].trim();
  39028. }
  39029. [$setValue](value) {
  39030. value = value.value || "";
  39031. this[$content] = value.toString();
  39032. }
  39033. [$dump](hasNS = false) {
  39034. const dumped = Object.create(null);
  39035. if (hasNS) {
  39036. dumped.$ns = this[$namespaceId];
  39037. }
  39038. if (this[$content]) {
  39039. dumped.$content = this[$content];
  39040. }
  39041. dumped.$name = this[$nodeName];
  39042. dumped.children = [];
  39043. for (const child of this[_children]) {
  39044. dumped.children.push(child[$dump](hasNS));
  39045. }
  39046. dumped.attributes = Object.create(null);
  39047. for (const [name, value] of this[_attributes]) {
  39048. dumped.attributes[name] = value[$content];
  39049. }
  39050. return dumped;
  39051. }
  39052. }
  39053. class ContentObject extends XFAObject {
  39054. constructor(nsId, name) {
  39055. super(nsId, name);
  39056. this[$content] = "";
  39057. }
  39058. [$onText](text) {
  39059. this[$content] += text;
  39060. }
  39061. [$finalize]() {}
  39062. }
  39063. class OptionObject extends ContentObject {
  39064. constructor(nsId, name, options) {
  39065. super(nsId, name);
  39066. this[_options] = options;
  39067. }
  39068. [$finalize]() {
  39069. this[$content] = getKeyword({
  39070. data: this[$content],
  39071. defaultValue: this[_options][0],
  39072. validate: k => this[_options].includes(k)
  39073. });
  39074. }
  39075. [$clean](builder) {
  39076. super[$clean](builder);
  39077. delete this[_options];
  39078. }
  39079. }
  39080. class StringObject extends ContentObject {
  39081. [$finalize]() {
  39082. this[$content] = this[$content].trim();
  39083. }
  39084. }
  39085. class IntegerObject extends ContentObject {
  39086. constructor(nsId, name, defaultValue, validator) {
  39087. super(nsId, name);
  39088. this[_defaultValue] = defaultValue;
  39089. this[_validator] = validator;
  39090. }
  39091. [$finalize]() {
  39092. this[$content] = getInteger({
  39093. data: this[$content],
  39094. defaultValue: this[_defaultValue],
  39095. validate: this[_validator]
  39096. });
  39097. }
  39098. [$clean](builder) {
  39099. super[$clean](builder);
  39100. delete this[_defaultValue];
  39101. delete this[_validator];
  39102. }
  39103. }
  39104. class Option01 extends IntegerObject {
  39105. constructor(nsId, name) {
  39106. super(nsId, name, 0, n => n === 1);
  39107. }
  39108. }
  39109. class Option10 extends IntegerObject {
  39110. constructor(nsId, name) {
  39111. super(nsId, name, 1, n => n === 0);
  39112. }
  39113. }
  39114. ;// ./src/core/xfa/html_utils.js
  39115. function measureToString(m) {
  39116. if (typeof m === "string") {
  39117. return "0px";
  39118. }
  39119. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  39120. }
  39121. const converters = {
  39122. anchorType(node, style) {
  39123. const parent = node[$getSubformParent]();
  39124. if (!parent || parent.layout && parent.layout !== "position") {
  39125. return;
  39126. }
  39127. if (!("transform" in style)) {
  39128. style.transform = "";
  39129. }
  39130. switch (node.anchorType) {
  39131. case "bottomCenter":
  39132. style.transform += "translate(-50%, -100%)";
  39133. break;
  39134. case "bottomLeft":
  39135. style.transform += "translate(0,-100%)";
  39136. break;
  39137. case "bottomRight":
  39138. style.transform += "translate(-100%,-100%)";
  39139. break;
  39140. case "middleCenter":
  39141. style.transform += "translate(-50%,-50%)";
  39142. break;
  39143. case "middleLeft":
  39144. style.transform += "translate(0,-50%)";
  39145. break;
  39146. case "middleRight":
  39147. style.transform += "translate(-100%,-50%)";
  39148. break;
  39149. case "topCenter":
  39150. style.transform += "translate(-50%,0)";
  39151. break;
  39152. case "topRight":
  39153. style.transform += "translate(-100%,0)";
  39154. break;
  39155. }
  39156. },
  39157. dimensions(node, style) {
  39158. const parent = node[$getSubformParent]();
  39159. let width = node.w;
  39160. const height = node.h;
  39161. if (parent.layout?.includes("row")) {
  39162. const extra = parent[$extra];
  39163. const colSpan = node.colSpan;
  39164. let w;
  39165. if (colSpan === -1) {
  39166. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  39167. extra.currentColumn = 0;
  39168. } else {
  39169. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  39170. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  39171. }
  39172. if (!isNaN(w)) {
  39173. width = node.w = w;
  39174. }
  39175. }
  39176. style.width = width !== "" ? measureToString(width) : "auto";
  39177. style.height = height !== "" ? measureToString(height) : "auto";
  39178. },
  39179. position(node, style) {
  39180. const parent = node[$getSubformParent]();
  39181. if (parent?.layout && parent.layout !== "position") {
  39182. return;
  39183. }
  39184. style.position = "absolute";
  39185. style.left = measureToString(node.x);
  39186. style.top = measureToString(node.y);
  39187. },
  39188. rotate(node, style) {
  39189. if (node.rotate) {
  39190. if (!("transform" in style)) {
  39191. style.transform = "";
  39192. }
  39193. style.transform += `rotate(-${node.rotate}deg)`;
  39194. style.transformOrigin = "top left";
  39195. }
  39196. },
  39197. presence(node, style) {
  39198. switch (node.presence) {
  39199. case "invisible":
  39200. style.visibility = "hidden";
  39201. break;
  39202. case "hidden":
  39203. case "inactive":
  39204. style.display = "none";
  39205. break;
  39206. }
  39207. },
  39208. hAlign(node, style) {
  39209. if (node[$nodeName] === "para") {
  39210. switch (node.hAlign) {
  39211. case "justifyAll":
  39212. style.textAlign = "justify-all";
  39213. break;
  39214. case "radix":
  39215. style.textAlign = "left";
  39216. break;
  39217. default:
  39218. style.textAlign = node.hAlign;
  39219. }
  39220. } else {
  39221. switch (node.hAlign) {
  39222. case "left":
  39223. style.alignSelf = "start";
  39224. break;
  39225. case "center":
  39226. style.alignSelf = "center";
  39227. break;
  39228. case "right":
  39229. style.alignSelf = "end";
  39230. break;
  39231. }
  39232. }
  39233. },
  39234. margin(node, style) {
  39235. if (node.margin) {
  39236. style.margin = node.margin[$toStyle]().margin;
  39237. }
  39238. }
  39239. };
  39240. function setMinMaxDimensions(node, style) {
  39241. const parent = node[$getSubformParent]();
  39242. if (parent.layout === "position") {
  39243. if (node.minW > 0) {
  39244. style.minWidth = measureToString(node.minW);
  39245. }
  39246. if (node.maxW > 0) {
  39247. style.maxWidth = measureToString(node.maxW);
  39248. }
  39249. if (node.minH > 0) {
  39250. style.minHeight = measureToString(node.minH);
  39251. }
  39252. if (node.maxH > 0) {
  39253. style.maxHeight = measureToString(node.maxH);
  39254. }
  39255. }
  39256. }
  39257. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  39258. const measure = new TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  39259. if (typeof text === "string") {
  39260. measure.addString(text);
  39261. } else {
  39262. text[$pushGlyphs](measure);
  39263. }
  39264. return measure.compute(width);
  39265. }
  39266. function layoutNode(node, availableSpace) {
  39267. let height = null;
  39268. let width = null;
  39269. let isBroken = false;
  39270. if ((!node.w || !node.h) && node.value) {
  39271. let marginH = 0;
  39272. let marginV = 0;
  39273. if (node.margin) {
  39274. marginH = node.margin.leftInset + node.margin.rightInset;
  39275. marginV = node.margin.topInset + node.margin.bottomInset;
  39276. }
  39277. let lineHeight = null;
  39278. let margin = null;
  39279. if (node.para) {
  39280. margin = Object.create(null);
  39281. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  39282. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  39283. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  39284. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  39285. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  39286. }
  39287. let font = node.font;
  39288. if (!font) {
  39289. const root = node[$getTemplateRoot]();
  39290. let parent = node[$getParent]();
  39291. while (parent && parent !== root) {
  39292. if (parent.font) {
  39293. font = parent.font;
  39294. break;
  39295. }
  39296. parent = parent[$getParent]();
  39297. }
  39298. }
  39299. const maxWidth = (node.w || availableSpace.width) - marginH;
  39300. const fontFinder = node[$globalData].fontFinder;
  39301. if (node.value.exData && node.value.exData[$content] && node.value.exData.contentType === "text/html") {
  39302. const res = layoutText(node.value.exData[$content], font, margin, lineHeight, fontFinder, maxWidth);
  39303. width = res.width;
  39304. height = res.height;
  39305. isBroken = res.isBroken;
  39306. } else {
  39307. const text = node.value[$text]();
  39308. if (text) {
  39309. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  39310. width = res.width;
  39311. height = res.height;
  39312. isBroken = res.isBroken;
  39313. }
  39314. }
  39315. if (width !== null && !node.w) {
  39316. width += marginH;
  39317. }
  39318. if (height !== null && !node.h) {
  39319. height += marginV;
  39320. }
  39321. }
  39322. return {
  39323. w: width,
  39324. h: height,
  39325. isBroken
  39326. };
  39327. }
  39328. function computeBbox(node, html, availableSpace) {
  39329. let bbox;
  39330. if (node.w !== "" && node.h !== "") {
  39331. bbox = [node.x, node.y, node.w, node.h];
  39332. } else {
  39333. if (!availableSpace) {
  39334. return null;
  39335. }
  39336. let width = node.w;
  39337. if (width === "") {
  39338. if (node.maxW === 0) {
  39339. const parent = node[$getSubformParent]();
  39340. width = parent.layout === "position" && parent.w !== "" ? 0 : node.minW;
  39341. } else {
  39342. width = Math.min(node.maxW, availableSpace.width);
  39343. }
  39344. html.attributes.style.width = measureToString(width);
  39345. }
  39346. let height = node.h;
  39347. if (height === "") {
  39348. if (node.maxH === 0) {
  39349. const parent = node[$getSubformParent]();
  39350. height = parent.layout === "position" && parent.h !== "" ? 0 : node.minH;
  39351. } else {
  39352. height = Math.min(node.maxH, availableSpace.height);
  39353. }
  39354. html.attributes.style.height = measureToString(height);
  39355. }
  39356. bbox = [node.x, node.y, width, height];
  39357. }
  39358. return bbox;
  39359. }
  39360. function fixDimensions(node) {
  39361. const parent = node[$getSubformParent]();
  39362. if (parent.layout?.includes("row")) {
  39363. const extra = parent[$extra];
  39364. const colSpan = node.colSpan;
  39365. let width;
  39366. if (colSpan === -1) {
  39367. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  39368. } else {
  39369. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  39370. }
  39371. if (!isNaN(width)) {
  39372. node.w = width;
  39373. }
  39374. }
  39375. if (parent.layout && parent.layout !== "position") {
  39376. node.x = node.y = 0;
  39377. }
  39378. if (node.layout === "table") {
  39379. if (node.w === "" && Array.isArray(node.columnWidths)) {
  39380. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  39381. }
  39382. }
  39383. }
  39384. function layoutClass(node) {
  39385. switch (node.layout) {
  39386. case "position":
  39387. return "xfaPosition";
  39388. case "lr-tb":
  39389. return "xfaLrTb";
  39390. case "rl-row":
  39391. return "xfaRlRow";
  39392. case "rl-tb":
  39393. return "xfaRlTb";
  39394. case "row":
  39395. return "xfaRow";
  39396. case "table":
  39397. return "xfaTable";
  39398. case "tb":
  39399. return "xfaTb";
  39400. default:
  39401. return "xfaPosition";
  39402. }
  39403. }
  39404. function toStyle(node, ...names) {
  39405. const style = Object.create(null);
  39406. for (const name of names) {
  39407. const value = node[name];
  39408. if (value === null) {
  39409. continue;
  39410. }
  39411. if (converters.hasOwnProperty(name)) {
  39412. converters[name](node, style);
  39413. continue;
  39414. }
  39415. if (value instanceof XFAObject) {
  39416. const newStyle = value[$toStyle]();
  39417. if (newStyle) {
  39418. Object.assign(style, newStyle);
  39419. } else {
  39420. warn(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  39421. }
  39422. }
  39423. }
  39424. return style;
  39425. }
  39426. function createWrapper(node, html) {
  39427. const {
  39428. attributes
  39429. } = html;
  39430. const {
  39431. style
  39432. } = attributes;
  39433. const wrapper = {
  39434. name: "div",
  39435. attributes: {
  39436. class: ["xfaWrapper"],
  39437. style: Object.create(null)
  39438. },
  39439. children: []
  39440. };
  39441. attributes.class.push("xfaWrapped");
  39442. if (node.border) {
  39443. const {
  39444. widths,
  39445. insets
  39446. } = node.border[$extra];
  39447. let width, height;
  39448. let top = insets[0];
  39449. let left = insets[3];
  39450. const insetsH = insets[0] + insets[2];
  39451. const insetsW = insets[1] + insets[3];
  39452. switch (node.border.hand) {
  39453. case "even":
  39454. top -= widths[0] / 2;
  39455. left -= widths[3] / 2;
  39456. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  39457. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  39458. break;
  39459. case "left":
  39460. top -= widths[0];
  39461. left -= widths[3];
  39462. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  39463. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  39464. break;
  39465. case "right":
  39466. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  39467. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  39468. break;
  39469. }
  39470. const classNames = ["xfaBorder"];
  39471. if (isPrintOnly(node.border)) {
  39472. classNames.push("xfaPrintOnly");
  39473. }
  39474. const border = {
  39475. name: "div",
  39476. attributes: {
  39477. class: classNames,
  39478. style: {
  39479. top: `${top}px`,
  39480. left: `${left}px`,
  39481. width,
  39482. height
  39483. }
  39484. },
  39485. children: []
  39486. };
  39487. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  39488. if (style[key] !== undefined) {
  39489. border.attributes.style[key] = style[key];
  39490. delete style[key];
  39491. }
  39492. }
  39493. wrapper.children.push(border, html);
  39494. } else {
  39495. wrapper.children.push(html);
  39496. }
  39497. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  39498. if (style[key] !== undefined) {
  39499. wrapper.attributes.style[key] = style[key];
  39500. delete style[key];
  39501. }
  39502. }
  39503. wrapper.attributes.style.position = style.position === "absolute" ? "absolute" : "relative";
  39504. delete style.position;
  39505. if (style.alignSelf) {
  39506. wrapper.attributes.style.alignSelf = style.alignSelf;
  39507. delete style.alignSelf;
  39508. }
  39509. return wrapper;
  39510. }
  39511. function fixTextIndent(styles) {
  39512. const indent = getMeasurement(styles.textIndent, "0px");
  39513. if (indent >= 0) {
  39514. return;
  39515. }
  39516. const align = styles.textAlign === "right" ? "right" : "left";
  39517. const name = "padding" + (align === "left" ? "Left" : "Right");
  39518. const padding = getMeasurement(styles[name], "0px");
  39519. styles[name] = `${padding - indent}px`;
  39520. }
  39521. function setAccess(node, classNames) {
  39522. switch (node.access) {
  39523. case "nonInteractive":
  39524. classNames.push("xfaNonInteractive");
  39525. break;
  39526. case "readOnly":
  39527. classNames.push("xfaReadOnly");
  39528. break;
  39529. case "protected":
  39530. classNames.push("xfaDisabled");
  39531. break;
  39532. }
  39533. }
  39534. function isPrintOnly(node) {
  39535. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  39536. }
  39537. function getCurrentPara(node) {
  39538. const stack = node[$getTemplateRoot]()[$extra].paraStack;
  39539. return stack.length ? stack.at(-1) : null;
  39540. }
  39541. function setPara(node, nodeStyle, value) {
  39542. if (value.attributes.class?.includes("xfaRich")) {
  39543. if (nodeStyle) {
  39544. if (node.h === "") {
  39545. nodeStyle.height = "auto";
  39546. }
  39547. if (node.w === "") {
  39548. nodeStyle.width = "auto";
  39549. }
  39550. }
  39551. const para = getCurrentPara(node);
  39552. if (para) {
  39553. const valueStyle = value.attributes.style;
  39554. valueStyle.display = "flex";
  39555. valueStyle.flexDirection = "column";
  39556. switch (para.vAlign) {
  39557. case "top":
  39558. valueStyle.justifyContent = "start";
  39559. break;
  39560. case "bottom":
  39561. valueStyle.justifyContent = "end";
  39562. break;
  39563. case "middle":
  39564. valueStyle.justifyContent = "center";
  39565. break;
  39566. }
  39567. const paraStyle = para[$toStyle]();
  39568. for (const [key, val] of Object.entries(paraStyle)) {
  39569. if (!(key in valueStyle)) {
  39570. valueStyle[key] = val;
  39571. }
  39572. }
  39573. }
  39574. }
  39575. }
  39576. function setFontFamily(xfaFont, node, fontFinder, style) {
  39577. if (!fontFinder) {
  39578. delete style.fontFamily;
  39579. return;
  39580. }
  39581. const name = stripQuotes(xfaFont.typeface);
  39582. style.fontFamily = `"${name}"`;
  39583. const typeface = fontFinder.find(name);
  39584. if (typeface) {
  39585. const {
  39586. fontFamily
  39587. } = typeface.regular.cssFontInfo;
  39588. if (fontFamily !== name) {
  39589. style.fontFamily = `"${fontFamily}"`;
  39590. }
  39591. const para = getCurrentPara(node);
  39592. if (para && para.lineHeight !== "") {
  39593. return;
  39594. }
  39595. if (style.lineHeight) {
  39596. return;
  39597. }
  39598. const pdfFont = selectFont(xfaFont, typeface);
  39599. if (pdfFont) {
  39600. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  39601. }
  39602. }
  39603. }
  39604. function fixURL(str) {
  39605. const absoluteUrl = createValidAbsoluteUrl(str, null, {
  39606. addDefaultProtocol: true,
  39607. tryConvertEncoding: true
  39608. });
  39609. return absoluteUrl ? absoluteUrl.href : null;
  39610. }
  39611. ;// ./src/core/xfa/layout.js
  39612. function createLine(node, children) {
  39613. return {
  39614. name: "div",
  39615. attributes: {
  39616. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  39617. },
  39618. children
  39619. };
  39620. }
  39621. function flushHTML(node) {
  39622. if (!node[$extra]) {
  39623. return null;
  39624. }
  39625. const attributes = node[$extra].attributes;
  39626. const html = {
  39627. name: "div",
  39628. attributes,
  39629. children: node[$extra].children
  39630. };
  39631. if (node[$extra].failingNode) {
  39632. const htmlFromFailing = node[$extra].failingNode[$flushHTML]();
  39633. if (htmlFromFailing) {
  39634. if (node.layout.endsWith("-tb")) {
  39635. html.children.push(createLine(node, [htmlFromFailing]));
  39636. } else {
  39637. html.children.push(htmlFromFailing);
  39638. }
  39639. }
  39640. }
  39641. if (html.children.length === 0) {
  39642. return null;
  39643. }
  39644. return html;
  39645. }
  39646. function addHTML(node, html, bbox) {
  39647. const extra = node[$extra];
  39648. const availableSpace = extra.availableSpace;
  39649. const [x, y, w, h] = bbox;
  39650. switch (node.layout) {
  39651. case "position":
  39652. {
  39653. extra.width = Math.max(extra.width, x + w);
  39654. extra.height = Math.max(extra.height, y + h);
  39655. extra.children.push(html);
  39656. break;
  39657. }
  39658. case "lr-tb":
  39659. case "rl-tb":
  39660. if (!extra.line || extra.attempt === 1) {
  39661. extra.line = createLine(node, []);
  39662. extra.children.push(extra.line);
  39663. extra.numberInLine = 0;
  39664. }
  39665. extra.numberInLine += 1;
  39666. extra.line.children.push(html);
  39667. if (extra.attempt === 0) {
  39668. extra.currentWidth += w;
  39669. extra.height = Math.max(extra.height, extra.prevHeight + h);
  39670. } else {
  39671. extra.currentWidth = w;
  39672. extra.prevHeight = extra.height;
  39673. extra.height += h;
  39674. extra.attempt = 0;
  39675. }
  39676. extra.width = Math.max(extra.width, extra.currentWidth);
  39677. break;
  39678. case "rl-row":
  39679. case "row":
  39680. {
  39681. extra.children.push(html);
  39682. extra.width += w;
  39683. extra.height = Math.max(extra.height, h);
  39684. const height = measureToString(extra.height);
  39685. for (const child of extra.children) {
  39686. child.attributes.style.height = height;
  39687. }
  39688. break;
  39689. }
  39690. case "table":
  39691. {
  39692. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  39693. extra.height += h;
  39694. extra.children.push(html);
  39695. break;
  39696. }
  39697. case "tb":
  39698. {
  39699. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  39700. extra.height += h;
  39701. extra.children.push(html);
  39702. break;
  39703. }
  39704. }
  39705. }
  39706. function getAvailableSpace(node) {
  39707. const availableSpace = node[$extra].availableSpace;
  39708. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  39709. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  39710. switch (node.layout) {
  39711. case "lr-tb":
  39712. case "rl-tb":
  39713. if (node[$extra].attempt === 0) {
  39714. return {
  39715. width: availableSpace.width - marginH - node[$extra].currentWidth,
  39716. height: availableSpace.height - marginV - node[$extra].prevHeight
  39717. };
  39718. }
  39719. return {
  39720. width: availableSpace.width - marginH,
  39721. height: availableSpace.height - marginV - node[$extra].height
  39722. };
  39723. case "rl-row":
  39724. case "row":
  39725. const width = node[$extra].columnWidths.slice(node[$extra].currentColumn).reduce((a, x) => a + x);
  39726. return {
  39727. width,
  39728. height: availableSpace.height - marginH
  39729. };
  39730. case "table":
  39731. case "tb":
  39732. return {
  39733. width: availableSpace.width - marginH,
  39734. height: availableSpace.height - marginV - node[$extra].height
  39735. };
  39736. case "position":
  39737. default:
  39738. return availableSpace;
  39739. }
  39740. }
  39741. function getTransformedBBox(node) {
  39742. let w = node.w === "" ? NaN : node.w;
  39743. let h = node.h === "" ? NaN : node.h;
  39744. let [centerX, centerY] = [0, 0];
  39745. switch (node.anchorType || "") {
  39746. case "bottomCenter":
  39747. [centerX, centerY] = [w / 2, h];
  39748. break;
  39749. case "bottomLeft":
  39750. [centerX, centerY] = [0, h];
  39751. break;
  39752. case "bottomRight":
  39753. [centerX, centerY] = [w, h];
  39754. break;
  39755. case "middleCenter":
  39756. [centerX, centerY] = [w / 2, h / 2];
  39757. break;
  39758. case "middleLeft":
  39759. [centerX, centerY] = [0, h / 2];
  39760. break;
  39761. case "middleRight":
  39762. [centerX, centerY] = [w, h / 2];
  39763. break;
  39764. case "topCenter":
  39765. [centerX, centerY] = [w / 2, 0];
  39766. break;
  39767. case "topRight":
  39768. [centerX, centerY] = [w, 0];
  39769. break;
  39770. }
  39771. let x, y;
  39772. switch (node.rotate || 0) {
  39773. case 0:
  39774. [x, y] = [-centerX, -centerY];
  39775. break;
  39776. case 90:
  39777. [x, y] = [-centerY, centerX];
  39778. [w, h] = [h, -w];
  39779. break;
  39780. case 180:
  39781. [x, y] = [centerX, centerY];
  39782. [w, h] = [-w, -h];
  39783. break;
  39784. case 270:
  39785. [x, y] = [centerY, -centerX];
  39786. [w, h] = [-h, w];
  39787. break;
  39788. }
  39789. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  39790. }
  39791. function checkDimensions(node, space) {
  39792. if (node[$getTemplateRoot]()[$extra].firstUnsplittable === null) {
  39793. return true;
  39794. }
  39795. if (node.w === 0 || node.h === 0) {
  39796. return true;
  39797. }
  39798. const ERROR = 2;
  39799. const parent = node[$getSubformParent]();
  39800. const attempt = parent[$extra]?.attempt || 0;
  39801. const [, y, w, h] = getTransformedBBox(node);
  39802. switch (parent.layout) {
  39803. case "lr-tb":
  39804. case "rl-tb":
  39805. if (attempt === 0) {
  39806. if (!node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  39807. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  39808. return false;
  39809. }
  39810. if (node.w !== "") {
  39811. if (Math.round(w - space.width) <= ERROR) {
  39812. return true;
  39813. }
  39814. if (parent[$extra].numberInLine === 0) {
  39815. return space.height > ERROR;
  39816. }
  39817. return false;
  39818. }
  39819. return space.width > ERROR;
  39820. }
  39821. if (node.w !== "") {
  39822. return Math.round(w - space.width) <= ERROR;
  39823. }
  39824. return space.width > ERROR;
  39825. }
  39826. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  39827. return true;
  39828. }
  39829. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  39830. return false;
  39831. }
  39832. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  39833. return space.height > ERROR;
  39834. }
  39835. if (parent[$isThereMoreWidth]()) {
  39836. return false;
  39837. }
  39838. return space.height > ERROR;
  39839. case "table":
  39840. case "tb":
  39841. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  39842. return true;
  39843. }
  39844. if (node.h !== "" && !node[$isSplittable]()) {
  39845. return Math.round(h - space.height) <= ERROR;
  39846. }
  39847. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  39848. return space.height > ERROR;
  39849. }
  39850. if (parent[$isThereMoreWidth]()) {
  39851. return false;
  39852. }
  39853. return space.height > ERROR;
  39854. case "position":
  39855. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  39856. return true;
  39857. }
  39858. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  39859. return true;
  39860. }
  39861. const area = node[$getTemplateRoot]()[$extra].currentContentArea;
  39862. return h + y > area.h;
  39863. case "rl-row":
  39864. case "row":
  39865. if (node[$getTemplateRoot]()[$extra].noLayoutFailure) {
  39866. return true;
  39867. }
  39868. if (node.h !== "") {
  39869. return Math.round(h - space.height) <= ERROR;
  39870. }
  39871. return true;
  39872. default:
  39873. return true;
  39874. }
  39875. }
  39876. ;// ./src/core/xfa/template.js
  39877. const TEMPLATE_NS_ID = NamespaceIds.template.id;
  39878. const SVG_NS = "http://www.w3.org/2000/svg";
  39879. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  39880. const MAX_EMPTY_PAGES = 3;
  39881. const DEFAULT_TAB_INDEX = 5000;
  39882. const HEADING_PATTERN = /^H(\d+)$/;
  39883. const MIMES = new Set(["image/gif", "image/jpeg", "image/jpg", "image/pjpeg", "image/png", "image/apng", "image/x-png", "image/bmp", "image/x-ms-bmp", "image/tiff", "image/tif", "application/octet-stream"]);
  39884. const IMAGES_HEADERS = [[[0x42, 0x4d], "image/bmp"], [[0xff, 0xd8, 0xff], "image/jpeg"], [[0x49, 0x49, 0x2a, 0x00], "image/tiff"], [[0x4d, 0x4d, 0x00, 0x2a], "image/tiff"], [[0x47, 0x49, 0x46, 0x38, 0x39, 0x61], "image/gif"], [[0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a], "image/png"]];
  39885. function getBorderDims(node) {
  39886. if (!node || !node.border) {
  39887. return {
  39888. w: 0,
  39889. h: 0
  39890. };
  39891. }
  39892. const borderExtra = node.border[$getExtra]();
  39893. if (!borderExtra) {
  39894. return {
  39895. w: 0,
  39896. h: 0
  39897. };
  39898. }
  39899. return {
  39900. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  39901. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  39902. };
  39903. }
  39904. function hasMargin(node) {
  39905. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  39906. }
  39907. function _setValue(templateNode, value) {
  39908. if (!templateNode.value) {
  39909. const nodeValue = new Value({});
  39910. templateNode[$appendChild](nodeValue);
  39911. templateNode.value = nodeValue;
  39912. }
  39913. templateNode.value[$setValue](value);
  39914. }
  39915. function* getContainedChildren(node) {
  39916. for (const child of node[$getChildren]()) {
  39917. if (child instanceof SubformSet) {
  39918. yield* child[$getContainedChildren]();
  39919. continue;
  39920. }
  39921. yield child;
  39922. }
  39923. }
  39924. function isRequired(node) {
  39925. return node.validate?.nullTest === "error";
  39926. }
  39927. function setTabIndex(node) {
  39928. while (node) {
  39929. if (!node.traversal) {
  39930. node[$tabIndex] = node[$getParent]()[$tabIndex];
  39931. return;
  39932. }
  39933. if (node[$tabIndex]) {
  39934. return;
  39935. }
  39936. let next = null;
  39937. for (const child of node.traversal[$getChildren]()) {
  39938. if (child.operation === "next") {
  39939. next = child;
  39940. break;
  39941. }
  39942. }
  39943. if (!next || !next.ref) {
  39944. node[$tabIndex] = node[$getParent]()[$tabIndex];
  39945. return;
  39946. }
  39947. const root = node[$getTemplateRoot]();
  39948. node[$tabIndex] = ++root[$tabIndex];
  39949. const ref = root[$searchNode](next.ref, node);
  39950. if (!ref) {
  39951. return;
  39952. }
  39953. node = ref[0];
  39954. }
  39955. }
  39956. function applyAssist(obj, attributes) {
  39957. const assist = obj.assist;
  39958. if (assist) {
  39959. const assistTitle = assist[$toHTML]();
  39960. if (assistTitle) {
  39961. attributes.title = assistTitle;
  39962. }
  39963. const role = assist.role;
  39964. const match = role.match(HEADING_PATTERN);
  39965. if (match) {
  39966. const ariaRole = "heading";
  39967. const ariaLevel = match[1];
  39968. attributes.role = ariaRole;
  39969. attributes["aria-level"] = ariaLevel;
  39970. }
  39971. }
  39972. if (obj.layout === "table") {
  39973. attributes.role = "table";
  39974. } else if (obj.layout === "row") {
  39975. attributes.role = "row";
  39976. } else {
  39977. const parent = obj[$getParent]();
  39978. if (parent.layout === "row") {
  39979. attributes.role = parent.assist?.role === "TH" ? "columnheader" : "cell";
  39980. }
  39981. }
  39982. }
  39983. function ariaLabel(obj) {
  39984. if (!obj.assist) {
  39985. return null;
  39986. }
  39987. const assist = obj.assist;
  39988. if (assist.speak && assist.speak[$content] !== "") {
  39989. return assist.speak[$content];
  39990. }
  39991. if (assist.toolTip) {
  39992. return assist.toolTip[$content];
  39993. }
  39994. return null;
  39995. }
  39996. function valueToHtml(value) {
  39997. return HTMLResult.success({
  39998. name: "div",
  39999. attributes: {
  40000. class: ["xfaRich"],
  40001. style: Object.create(null)
  40002. },
  40003. children: [{
  40004. name: "span",
  40005. attributes: {
  40006. style: Object.create(null)
  40007. },
  40008. value
  40009. }]
  40010. });
  40011. }
  40012. function setFirstUnsplittable(node) {
  40013. const root = node[$getTemplateRoot]();
  40014. if (root[$extra].firstUnsplittable === null) {
  40015. root[$extra].firstUnsplittable = node;
  40016. root[$extra].noLayoutFailure = true;
  40017. }
  40018. }
  40019. function unsetFirstUnsplittable(node) {
  40020. const root = node[$getTemplateRoot]();
  40021. if (root[$extra].firstUnsplittable === node) {
  40022. root[$extra].noLayoutFailure = false;
  40023. }
  40024. }
  40025. function handleBreak(node) {
  40026. if (node[$extra]) {
  40027. return false;
  40028. }
  40029. node[$extra] = Object.create(null);
  40030. if (node.targetType === "auto") {
  40031. return false;
  40032. }
  40033. const root = node[$getTemplateRoot]();
  40034. let target = null;
  40035. if (node.target) {
  40036. target = root[$searchNode](node.target, node[$getParent]());
  40037. if (!target) {
  40038. return false;
  40039. }
  40040. target = target[0];
  40041. }
  40042. const {
  40043. currentPageArea,
  40044. currentContentArea
  40045. } = root[$extra];
  40046. if (node.targetType === "pageArea") {
  40047. if (!(target instanceof PageArea)) {
  40048. target = null;
  40049. }
  40050. if (node.startNew) {
  40051. node[$extra].target = target || currentPageArea;
  40052. return true;
  40053. } else if (target && target !== currentPageArea) {
  40054. node[$extra].target = target;
  40055. return true;
  40056. }
  40057. return false;
  40058. }
  40059. if (!(target instanceof ContentArea)) {
  40060. target = null;
  40061. }
  40062. const pageArea = target && target[$getParent]();
  40063. let index;
  40064. let nextPageArea = pageArea;
  40065. if (node.startNew) {
  40066. if (target) {
  40067. const contentAreas = pageArea.contentArea.children;
  40068. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  40069. const indexForTarget = contentAreas.indexOf(target);
  40070. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  40071. nextPageArea = null;
  40072. }
  40073. index = indexForTarget - 1;
  40074. } else {
  40075. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  40076. }
  40077. } else if (target && target !== currentContentArea) {
  40078. const contentAreas = pageArea.contentArea.children;
  40079. index = contentAreas.indexOf(target) - 1;
  40080. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  40081. } else {
  40082. return false;
  40083. }
  40084. node[$extra].target = nextPageArea;
  40085. node[$extra].index = index;
  40086. return true;
  40087. }
  40088. function handleOverflow(node, extraNode, space) {
  40089. const root = node[$getTemplateRoot]();
  40090. const saved = root[$extra].noLayoutFailure;
  40091. const savedMethod = extraNode[$getSubformParent];
  40092. extraNode[$getSubformParent] = () => node;
  40093. root[$extra].noLayoutFailure = true;
  40094. const res = extraNode[$toHTML](space);
  40095. node[$addHTML](res.html, res.bbox);
  40096. root[$extra].noLayoutFailure = saved;
  40097. extraNode[$getSubformParent] = savedMethod;
  40098. }
  40099. class AppearanceFilter extends StringObject {
  40100. constructor(attributes) {
  40101. super(TEMPLATE_NS_ID, "appearanceFilter");
  40102. this.id = attributes.id || "";
  40103. this.type = getStringOption(attributes.type, ["optional", "required"]);
  40104. this.use = attributes.use || "";
  40105. this.usehref = attributes.usehref || "";
  40106. }
  40107. }
  40108. class Arc extends XFAObject {
  40109. constructor(attributes) {
  40110. super(TEMPLATE_NS_ID, "arc", true);
  40111. this.circular = getInteger({
  40112. data: attributes.circular,
  40113. defaultValue: 0,
  40114. validate: x => x === 1
  40115. });
  40116. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  40117. this.id = attributes.id || "";
  40118. this.startAngle = getFloat({
  40119. data: attributes.startAngle,
  40120. defaultValue: 0,
  40121. validate: x => true
  40122. });
  40123. this.sweepAngle = getFloat({
  40124. data: attributes.sweepAngle,
  40125. defaultValue: 360,
  40126. validate: x => true
  40127. });
  40128. this.use = attributes.use || "";
  40129. this.usehref = attributes.usehref || "";
  40130. this.edge = null;
  40131. this.fill = null;
  40132. }
  40133. [$toHTML]() {
  40134. const edge = this.edge || new Edge({});
  40135. const edgeStyle = edge[$toStyle]();
  40136. const style = Object.create(null);
  40137. if (this.fill?.presence === "visible") {
  40138. Object.assign(style, this.fill[$toStyle]());
  40139. } else {
  40140. style.fill = "transparent";
  40141. }
  40142. style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
  40143. style.stroke = edgeStyle.color;
  40144. let arc;
  40145. const attributes = {
  40146. xmlns: SVG_NS,
  40147. style: {
  40148. width: "100%",
  40149. height: "100%",
  40150. overflow: "visible"
  40151. }
  40152. };
  40153. if (this.sweepAngle === 360) {
  40154. arc = {
  40155. name: "ellipse",
  40156. attributes: {
  40157. xmlns: SVG_NS,
  40158. cx: "50%",
  40159. cy: "50%",
  40160. rx: "50%",
  40161. ry: "50%",
  40162. style
  40163. }
  40164. };
  40165. } else {
  40166. const startAngle = this.startAngle * Math.PI / 180;
  40167. const sweepAngle = this.sweepAngle * Math.PI / 180;
  40168. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  40169. const [x1, y1, x2, y2] = [50 * (1 + Math.cos(startAngle)), 50 * (1 - Math.sin(startAngle)), 50 * (1 + Math.cos(startAngle + sweepAngle)), 50 * (1 - Math.sin(startAngle + sweepAngle))];
  40170. arc = {
  40171. name: "path",
  40172. attributes: {
  40173. xmlns: SVG_NS,
  40174. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  40175. vectorEffect: "non-scaling-stroke",
  40176. style
  40177. }
  40178. };
  40179. Object.assign(attributes, {
  40180. viewBox: "0 0 100 100",
  40181. preserveAspectRatio: "none"
  40182. });
  40183. }
  40184. const svg = {
  40185. name: "svg",
  40186. children: [arc],
  40187. attributes
  40188. };
  40189. const parent = this[$getParent]()[$getParent]();
  40190. if (hasMargin(parent)) {
  40191. return HTMLResult.success({
  40192. name: "div",
  40193. attributes: {
  40194. style: {
  40195. display: "inline",
  40196. width: "100%",
  40197. height: "100%"
  40198. }
  40199. },
  40200. children: [svg]
  40201. });
  40202. }
  40203. svg.attributes.style.position = "absolute";
  40204. return HTMLResult.success(svg);
  40205. }
  40206. }
  40207. class Area extends XFAObject {
  40208. constructor(attributes) {
  40209. super(TEMPLATE_NS_ID, "area", true);
  40210. this.colSpan = getInteger({
  40211. data: attributes.colSpan,
  40212. defaultValue: 1,
  40213. validate: n => n >= 1 || n === -1
  40214. });
  40215. this.id = attributes.id || "";
  40216. this.name = attributes.name || "";
  40217. this.relevant = getRelevant(attributes.relevant);
  40218. this.use = attributes.use || "";
  40219. this.usehref = attributes.usehref || "";
  40220. this.x = getMeasurement(attributes.x, "0pt");
  40221. this.y = getMeasurement(attributes.y, "0pt");
  40222. this.desc = null;
  40223. this.extras = null;
  40224. this.area = new XFAObjectArray();
  40225. this.draw = new XFAObjectArray();
  40226. this.exObject = new XFAObjectArray();
  40227. this.exclGroup = new XFAObjectArray();
  40228. this.field = new XFAObjectArray();
  40229. this.subform = new XFAObjectArray();
  40230. this.subformSet = new XFAObjectArray();
  40231. }
  40232. *[$getContainedChildren]() {
  40233. yield* getContainedChildren(this);
  40234. }
  40235. [$isTransparent]() {
  40236. return true;
  40237. }
  40238. [$isBindable]() {
  40239. return true;
  40240. }
  40241. [$addHTML](html, bbox) {
  40242. const [x, y, w, h] = bbox;
  40243. this[$extra].width = Math.max(this[$extra].width, x + w);
  40244. this[$extra].height = Math.max(this[$extra].height, y + h);
  40245. this[$extra].children.push(html);
  40246. }
  40247. [$getAvailableSpace]() {
  40248. return this[$extra].availableSpace;
  40249. }
  40250. [$toHTML](availableSpace) {
  40251. const style = toStyle(this, "position");
  40252. const attributes = {
  40253. style,
  40254. id: this[$uid],
  40255. class: ["xfaArea"]
  40256. };
  40257. if (isPrintOnly(this)) {
  40258. attributes.class.push("xfaPrintOnly");
  40259. }
  40260. if (this.name) {
  40261. attributes.xfaName = this.name;
  40262. }
  40263. const children = [];
  40264. this[$extra] = {
  40265. children,
  40266. width: 0,
  40267. height: 0,
  40268. availableSpace
  40269. };
  40270. const result = this[$childrenToHTML]({
  40271. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  40272. include: true
  40273. });
  40274. if (!result.success) {
  40275. if (result.isBreak()) {
  40276. return result;
  40277. }
  40278. delete this[$extra];
  40279. return HTMLResult.FAILURE;
  40280. }
  40281. style.width = measureToString(this[$extra].width);
  40282. style.height = measureToString(this[$extra].height);
  40283. const html = {
  40284. name: "div",
  40285. attributes,
  40286. children
  40287. };
  40288. const bbox = [this.x, this.y, this[$extra].width, this[$extra].height];
  40289. delete this[$extra];
  40290. return HTMLResult.success(html, bbox);
  40291. }
  40292. }
  40293. class Assist extends XFAObject {
  40294. constructor(attributes) {
  40295. super(TEMPLATE_NS_ID, "assist", true);
  40296. this.id = attributes.id || "";
  40297. this.role = attributes.role || "";
  40298. this.use = attributes.use || "";
  40299. this.usehref = attributes.usehref || "";
  40300. this.speak = null;
  40301. this.toolTip = null;
  40302. }
  40303. [$toHTML]() {
  40304. return this.toolTip?.[$content] || null;
  40305. }
  40306. }
  40307. class Barcode extends XFAObject {
  40308. constructor(attributes) {
  40309. super(TEMPLATE_NS_ID, "barcode", true);
  40310. this.charEncoding = getKeyword({
  40311. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  40312. defaultValue: "",
  40313. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
  40314. });
  40315. this.checksum = getStringOption(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  40316. this.dataColumnCount = getInteger({
  40317. data: attributes.dataColumnCount,
  40318. defaultValue: -1,
  40319. validate: x => x >= 0
  40320. });
  40321. this.dataLength = getInteger({
  40322. data: attributes.dataLength,
  40323. defaultValue: -1,
  40324. validate: x => x >= 0
  40325. });
  40326. this.dataPrep = getStringOption(attributes.dataPrep, ["none", "flateCompress"]);
  40327. this.dataRowCount = getInteger({
  40328. data: attributes.dataRowCount,
  40329. defaultValue: -1,
  40330. validate: x => x >= 0
  40331. });
  40332. this.endChar = attributes.endChar || "";
  40333. this.errorCorrectionLevel = getInteger({
  40334. data: attributes.errorCorrectionLevel,
  40335. defaultValue: -1,
  40336. validate: x => x >= 0 && x <= 8
  40337. });
  40338. this.id = attributes.id || "";
  40339. this.moduleHeight = getMeasurement(attributes.moduleHeight, "5mm");
  40340. this.moduleWidth = getMeasurement(attributes.moduleWidth, "0.25mm");
  40341. this.printCheckDigit = getInteger({
  40342. data: attributes.printCheckDigit,
  40343. defaultValue: 0,
  40344. validate: x => x === 1
  40345. });
  40346. this.rowColumnRatio = getRatio(attributes.rowColumnRatio);
  40347. this.startChar = attributes.startChar || "";
  40348. this.textLocation = getStringOption(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  40349. this.truncate = getInteger({
  40350. data: attributes.truncate,
  40351. defaultValue: 0,
  40352. validate: x => x === 1
  40353. });
  40354. this.type = getStringOption(attributes.type ? attributes.type.toLowerCase() : "", ["aztec", "codabar", "code2of5industrial", "code2of5interleaved", "code2of5matrix", "code2of5standard", "code3of9", "code3of9extended", "code11", "code49", "code93", "code128", "code128a", "code128b", "code128c", "code128sscc", "datamatrix", "ean8", "ean8add2", "ean8add5", "ean13", "ean13add2", "ean13add5", "ean13pwcd", "fim", "logmars", "maxicode", "msi", "pdf417", "pdf417macro", "plessey", "postauscust2", "postauscust3", "postausreplypaid", "postausstandard", "postukrm4scc", "postusdpbc", "postusimb", "postusstandard", "postus5zip", "qrcode", "rfid", "rss14", "rss14expanded", "rss14limited", "rss14stacked", "rss14stackedomni", "rss14truncated", "telepen", "ucc128", "ucc128random", "ucc128sscc", "upca", "upcaadd2", "upcaadd5", "upcapwcd", "upce", "upceadd2", "upceadd5", "upcean2", "upcean5", "upsmaxicode"]);
  40355. this.upsMode = getStringOption(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  40356. this.use = attributes.use || "";
  40357. this.usehref = attributes.usehref || "";
  40358. this.wideNarrowRatio = getRatio(attributes.wideNarrowRatio);
  40359. this.encrypt = null;
  40360. this.extras = null;
  40361. }
  40362. }
  40363. class Bind extends XFAObject {
  40364. constructor(attributes) {
  40365. super(TEMPLATE_NS_ID, "bind", true);
  40366. this.match = getStringOption(attributes.match, ["once", "dataRef", "global", "none"]);
  40367. this.ref = attributes.ref || "";
  40368. this.picture = null;
  40369. }
  40370. }
  40371. class BindItems extends XFAObject {
  40372. constructor(attributes) {
  40373. super(TEMPLATE_NS_ID, "bindItems");
  40374. this.connection = attributes.connection || "";
  40375. this.labelRef = attributes.labelRef || "";
  40376. this.ref = attributes.ref || "";
  40377. this.valueRef = attributes.valueRef || "";
  40378. }
  40379. }
  40380. class Bookend extends XFAObject {
  40381. constructor(attributes) {
  40382. super(TEMPLATE_NS_ID, "bookend");
  40383. this.id = attributes.id || "";
  40384. this.leader = attributes.leader || "";
  40385. this.trailer = attributes.trailer || "";
  40386. this.use = attributes.use || "";
  40387. this.usehref = attributes.usehref || "";
  40388. }
  40389. }
  40390. class BooleanElement extends Option01 {
  40391. constructor(attributes) {
  40392. super(TEMPLATE_NS_ID, "boolean");
  40393. this.id = attributes.id || "";
  40394. this.name = attributes.name || "";
  40395. this.use = attributes.use || "";
  40396. this.usehref = attributes.usehref || "";
  40397. }
  40398. [$toHTML](availableSpace) {
  40399. return valueToHtml(this[$content] === 1 ? "1" : "0");
  40400. }
  40401. }
  40402. class Border extends XFAObject {
  40403. constructor(attributes) {
  40404. super(TEMPLATE_NS_ID, "border", true);
  40405. this.break = getStringOption(attributes.break, ["close", "open"]);
  40406. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  40407. this.id = attributes.id || "";
  40408. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  40409. this.relevant = getRelevant(attributes.relevant);
  40410. this.use = attributes.use || "";
  40411. this.usehref = attributes.usehref || "";
  40412. this.corner = new XFAObjectArray(4);
  40413. this.edge = new XFAObjectArray(4);
  40414. this.extras = null;
  40415. this.fill = null;
  40416. this.margin = null;
  40417. }
  40418. [$getExtra]() {
  40419. if (!this[$extra]) {
  40420. const edges = this.edge.children.slice();
  40421. if (edges.length < 4) {
  40422. const defaultEdge = edges.at(-1) || new Edge({});
  40423. for (let i = edges.length; i < 4; i++) {
  40424. edges.push(defaultEdge);
  40425. }
  40426. }
  40427. const widths = edges.map(edge => edge.thickness);
  40428. const insets = [0, 0, 0, 0];
  40429. if (this.margin) {
  40430. insets[0] = this.margin.topInset;
  40431. insets[1] = this.margin.rightInset;
  40432. insets[2] = this.margin.bottomInset;
  40433. insets[3] = this.margin.leftInset;
  40434. }
  40435. this[$extra] = {
  40436. widths,
  40437. insets,
  40438. edges
  40439. };
  40440. }
  40441. return this[$extra];
  40442. }
  40443. [$toStyle]() {
  40444. const {
  40445. edges
  40446. } = this[$getExtra]();
  40447. const edgeStyles = edges.map(node => {
  40448. const style = node[$toStyle]();
  40449. style.color ||= "#000000";
  40450. return style;
  40451. });
  40452. const style = Object.create(null);
  40453. if (this.margin) {
  40454. Object.assign(style, this.margin[$toStyle]());
  40455. }
  40456. if (this.fill?.presence === "visible") {
  40457. Object.assign(style, this.fill[$toStyle]());
  40458. }
  40459. if (this.corner.children.some(node => node.radius !== 0)) {
  40460. const cornerStyles = this.corner.children.map(node => node[$toStyle]());
  40461. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  40462. const last = cornerStyles.at(-1);
  40463. for (let i = cornerStyles.length; i < 4; i++) {
  40464. cornerStyles.push(last);
  40465. }
  40466. }
  40467. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  40468. }
  40469. switch (this.presence) {
  40470. case "invisible":
  40471. case "hidden":
  40472. style.borderStyle = "";
  40473. break;
  40474. case "inactive":
  40475. style.borderStyle = "none";
  40476. break;
  40477. default:
  40478. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  40479. break;
  40480. }
  40481. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  40482. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  40483. return style;
  40484. }
  40485. }
  40486. class Break extends XFAObject {
  40487. constructor(attributes) {
  40488. super(TEMPLATE_NS_ID, "break", true);
  40489. this.after = getStringOption(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  40490. this.afterTarget = attributes.afterTarget || "";
  40491. this.before = getStringOption(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  40492. this.beforeTarget = attributes.beforeTarget || "";
  40493. this.bookendLeader = attributes.bookendLeader || "";
  40494. this.bookendTrailer = attributes.bookendTrailer || "";
  40495. this.id = attributes.id || "";
  40496. this.overflowLeader = attributes.overflowLeader || "";
  40497. this.overflowTarget = attributes.overflowTarget || "";
  40498. this.overflowTrailer = attributes.overflowTrailer || "";
  40499. this.startNew = getInteger({
  40500. data: attributes.startNew,
  40501. defaultValue: 0,
  40502. validate: x => x === 1
  40503. });
  40504. this.use = attributes.use || "";
  40505. this.usehref = attributes.usehref || "";
  40506. this.extras = null;
  40507. }
  40508. }
  40509. class BreakAfter extends XFAObject {
  40510. constructor(attributes) {
  40511. super(TEMPLATE_NS_ID, "breakAfter", true);
  40512. this.id = attributes.id || "";
  40513. this.leader = attributes.leader || "";
  40514. this.startNew = getInteger({
  40515. data: attributes.startNew,
  40516. defaultValue: 0,
  40517. validate: x => x === 1
  40518. });
  40519. this.target = attributes.target || "";
  40520. this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  40521. this.trailer = attributes.trailer || "";
  40522. this.use = attributes.use || "";
  40523. this.usehref = attributes.usehref || "";
  40524. this.script = null;
  40525. }
  40526. }
  40527. class BreakBefore extends XFAObject {
  40528. constructor(attributes) {
  40529. super(TEMPLATE_NS_ID, "breakBefore", true);
  40530. this.id = attributes.id || "";
  40531. this.leader = attributes.leader || "";
  40532. this.startNew = getInteger({
  40533. data: attributes.startNew,
  40534. defaultValue: 0,
  40535. validate: x => x === 1
  40536. });
  40537. this.target = attributes.target || "";
  40538. this.targetType = getStringOption(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  40539. this.trailer = attributes.trailer || "";
  40540. this.use = attributes.use || "";
  40541. this.usehref = attributes.usehref || "";
  40542. this.script = null;
  40543. }
  40544. [$toHTML](availableSpace) {
  40545. this[$extra] = {};
  40546. return HTMLResult.FAILURE;
  40547. }
  40548. }
  40549. class Button extends XFAObject {
  40550. constructor(attributes) {
  40551. super(TEMPLATE_NS_ID, "button", true);
  40552. this.highlight = getStringOption(attributes.highlight, ["inverted", "none", "outline", "push"]);
  40553. this.id = attributes.id || "";
  40554. this.use = attributes.use || "";
  40555. this.usehref = attributes.usehref || "";
  40556. this.extras = null;
  40557. }
  40558. [$toHTML](availableSpace) {
  40559. const parent = this[$getParent]();
  40560. const grandpa = parent[$getParent]();
  40561. const htmlButton = {
  40562. name: "button",
  40563. attributes: {
  40564. id: this[$uid],
  40565. class: ["xfaButton"],
  40566. style: {}
  40567. },
  40568. children: []
  40569. };
  40570. for (const event of grandpa.event.children) {
  40571. if (event.activity !== "click" || !event.script) {
  40572. continue;
  40573. }
  40574. const jsURL = recoverJsURL(event.script[$content]);
  40575. if (!jsURL) {
  40576. continue;
  40577. }
  40578. const href = fixURL(jsURL.url);
  40579. if (!href) {
  40580. continue;
  40581. }
  40582. htmlButton.children.push({
  40583. name: "a",
  40584. attributes: {
  40585. id: "link" + this[$uid],
  40586. href,
  40587. newWindow: jsURL.newWindow,
  40588. class: ["xfaLink"],
  40589. style: {}
  40590. },
  40591. children: []
  40592. });
  40593. }
  40594. return HTMLResult.success(htmlButton);
  40595. }
  40596. }
  40597. class Calculate extends XFAObject {
  40598. constructor(attributes) {
  40599. super(TEMPLATE_NS_ID, "calculate", true);
  40600. this.id = attributes.id || "";
  40601. this.override = getStringOption(attributes.override, ["disabled", "error", "ignore", "warning"]);
  40602. this.use = attributes.use || "";
  40603. this.usehref = attributes.usehref || "";
  40604. this.extras = null;
  40605. this.message = null;
  40606. this.script = null;
  40607. }
  40608. }
  40609. class Caption extends XFAObject {
  40610. constructor(attributes) {
  40611. super(TEMPLATE_NS_ID, "caption", true);
  40612. this.id = attributes.id || "";
  40613. this.placement = getStringOption(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  40614. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  40615. this.reserve = Math.ceil(getMeasurement(attributes.reserve));
  40616. this.use = attributes.use || "";
  40617. this.usehref = attributes.usehref || "";
  40618. this.extras = null;
  40619. this.font = null;
  40620. this.margin = null;
  40621. this.para = null;
  40622. this.value = null;
  40623. }
  40624. [$setValue](value) {
  40625. _setValue(this, value);
  40626. }
  40627. [$getExtra](availableSpace) {
  40628. if (!this[$extra]) {
  40629. let {
  40630. width,
  40631. height
  40632. } = availableSpace;
  40633. switch (this.placement) {
  40634. case "left":
  40635. case "right":
  40636. case "inline":
  40637. width = this.reserve <= 0 ? width : this.reserve;
  40638. break;
  40639. case "top":
  40640. case "bottom":
  40641. height = this.reserve <= 0 ? height : this.reserve;
  40642. break;
  40643. }
  40644. this[$extra] = layoutNode(this, {
  40645. width,
  40646. height
  40647. });
  40648. }
  40649. return this[$extra];
  40650. }
  40651. [$toHTML](availableSpace) {
  40652. if (!this.value) {
  40653. return HTMLResult.EMPTY;
  40654. }
  40655. this[$pushPara]();
  40656. const value = this.value[$toHTML](availableSpace).html;
  40657. if (!value) {
  40658. this[$popPara]();
  40659. return HTMLResult.EMPTY;
  40660. }
  40661. const savedReserve = this.reserve;
  40662. if (this.reserve <= 0) {
  40663. const {
  40664. w,
  40665. h
  40666. } = this[$getExtra](availableSpace);
  40667. switch (this.placement) {
  40668. case "left":
  40669. case "right":
  40670. case "inline":
  40671. this.reserve = w;
  40672. break;
  40673. case "top":
  40674. case "bottom":
  40675. this.reserve = h;
  40676. break;
  40677. }
  40678. }
  40679. const children = [];
  40680. if (typeof value === "string") {
  40681. children.push({
  40682. name: "#text",
  40683. value
  40684. });
  40685. } else {
  40686. children.push(value);
  40687. }
  40688. const style = toStyle(this, "font", "margin", "visibility");
  40689. switch (this.placement) {
  40690. case "left":
  40691. case "right":
  40692. if (this.reserve > 0) {
  40693. style.width = measureToString(this.reserve);
  40694. }
  40695. break;
  40696. case "top":
  40697. case "bottom":
  40698. if (this.reserve > 0) {
  40699. style.height = measureToString(this.reserve);
  40700. }
  40701. break;
  40702. }
  40703. setPara(this, null, value);
  40704. this[$popPara]();
  40705. this.reserve = savedReserve;
  40706. return HTMLResult.success({
  40707. name: "div",
  40708. attributes: {
  40709. style,
  40710. class: ["xfaCaption"]
  40711. },
  40712. children
  40713. });
  40714. }
  40715. }
  40716. class Certificate extends StringObject {
  40717. constructor(attributes) {
  40718. super(TEMPLATE_NS_ID, "certificate");
  40719. this.id = attributes.id || "";
  40720. this.name = attributes.name || "";
  40721. this.use = attributes.use || "";
  40722. this.usehref = attributes.usehref || "";
  40723. }
  40724. }
  40725. class Certificates extends XFAObject {
  40726. constructor(attributes) {
  40727. super(TEMPLATE_NS_ID, "certificates", true);
  40728. this.credentialServerPolicy = getStringOption(attributes.credentialServerPolicy, ["optional", "required"]);
  40729. this.id = attributes.id || "";
  40730. this.url = attributes.url || "";
  40731. this.urlPolicy = attributes.urlPolicy || "";
  40732. this.use = attributes.use || "";
  40733. this.usehref = attributes.usehref || "";
  40734. this.encryption = null;
  40735. this.issuers = null;
  40736. this.keyUsage = null;
  40737. this.oids = null;
  40738. this.signing = null;
  40739. this.subjectDNs = null;
  40740. }
  40741. }
  40742. class CheckButton extends XFAObject {
  40743. constructor(attributes) {
  40744. super(TEMPLATE_NS_ID, "checkButton", true);
  40745. this.id = attributes.id || "";
  40746. this.mark = getStringOption(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  40747. this.shape = getStringOption(attributes.shape, ["square", "round"]);
  40748. this.size = getMeasurement(attributes.size, "10pt");
  40749. this.use = attributes.use || "";
  40750. this.usehref = attributes.usehref || "";
  40751. this.border = null;
  40752. this.extras = null;
  40753. this.margin = null;
  40754. }
  40755. [$toHTML](availableSpace) {
  40756. const style = toStyle("margin");
  40757. const size = measureToString(this.size);
  40758. style.width = style.height = size;
  40759. let type;
  40760. let className;
  40761. let groupId;
  40762. const field = this[$getParent]()[$getParent]();
  40763. const items = field.items.children.length && field.items.children[0][$toHTML]().html || [];
  40764. const exportedValue = {
  40765. on: (items[0] !== undefined ? items[0] : "on").toString(),
  40766. off: (items[1] !== undefined ? items[1] : "off").toString()
  40767. };
  40768. const value = field.value?.[$text]() || "off";
  40769. const checked = value === exportedValue.on || undefined;
  40770. const container = field[$getSubformParent]();
  40771. const fieldId = field[$uid];
  40772. let dataId;
  40773. if (container instanceof ExclGroup) {
  40774. groupId = container[$uid];
  40775. type = "radio";
  40776. className = "xfaRadio";
  40777. dataId = container[$data]?.[$uid] || container[$uid];
  40778. } else {
  40779. type = "checkbox";
  40780. className = "xfaCheckbox";
  40781. dataId = field[$data]?.[$uid] || field[$uid];
  40782. }
  40783. const input = {
  40784. name: "input",
  40785. attributes: {
  40786. class: [className],
  40787. style,
  40788. fieldId,
  40789. dataId,
  40790. type,
  40791. checked,
  40792. xfaOn: exportedValue.on,
  40793. xfaOff: exportedValue.off,
  40794. "aria-label": ariaLabel(field),
  40795. "aria-required": false
  40796. }
  40797. };
  40798. if (groupId) {
  40799. input.attributes.name = groupId;
  40800. }
  40801. if (isRequired(field)) {
  40802. input.attributes["aria-required"] = true;
  40803. input.attributes.required = true;
  40804. }
  40805. return HTMLResult.success({
  40806. name: "label",
  40807. attributes: {
  40808. class: ["xfaLabel"]
  40809. },
  40810. children: [input]
  40811. });
  40812. }
  40813. }
  40814. class ChoiceList extends XFAObject {
  40815. constructor(attributes) {
  40816. super(TEMPLATE_NS_ID, "choiceList", true);
  40817. this.commitOn = getStringOption(attributes.commitOn, ["select", "exit"]);
  40818. this.id = attributes.id || "";
  40819. this.open = getStringOption(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  40820. this.textEntry = getInteger({
  40821. data: attributes.textEntry,
  40822. defaultValue: 0,
  40823. validate: x => x === 1
  40824. });
  40825. this.use = attributes.use || "";
  40826. this.usehref = attributes.usehref || "";
  40827. this.border = null;
  40828. this.extras = null;
  40829. this.margin = null;
  40830. }
  40831. [$toHTML](availableSpace) {
  40832. const style = toStyle(this, "border", "margin");
  40833. const ui = this[$getParent]();
  40834. const field = ui[$getParent]();
  40835. const fontSize = field.font?.size || 10;
  40836. const optionStyle = {
  40837. fontSize: `calc(${fontSize}px * var(--scale-factor))`
  40838. };
  40839. const children = [];
  40840. if (field.items.children.length > 0) {
  40841. const items = field.items;
  40842. let displayedIndex = 0;
  40843. let saveIndex = 0;
  40844. if (items.children.length === 2) {
  40845. displayedIndex = items.children[0].save;
  40846. saveIndex = 1 - displayedIndex;
  40847. }
  40848. const displayed = items.children[displayedIndex][$toHTML]().html;
  40849. const values = items.children[saveIndex][$toHTML]().html;
  40850. let selected = false;
  40851. const value = field.value?.[$text]() || "";
  40852. for (let i = 0, ii = displayed.length; i < ii; i++) {
  40853. const option = {
  40854. name: "option",
  40855. attributes: {
  40856. value: values[i] || displayed[i],
  40857. style: optionStyle
  40858. },
  40859. value: displayed[i]
  40860. };
  40861. if (values[i] === value) {
  40862. option.attributes.selected = selected = true;
  40863. }
  40864. children.push(option);
  40865. }
  40866. if (!selected) {
  40867. children.splice(0, 0, {
  40868. name: "option",
  40869. attributes: {
  40870. hidden: true,
  40871. selected: true
  40872. },
  40873. value: " "
  40874. });
  40875. }
  40876. }
  40877. const selectAttributes = {
  40878. class: ["xfaSelect"],
  40879. fieldId: field[$uid],
  40880. dataId: field[$data]?.[$uid] || field[$uid],
  40881. style,
  40882. "aria-label": ariaLabel(field),
  40883. "aria-required": false
  40884. };
  40885. if (isRequired(field)) {
  40886. selectAttributes["aria-required"] = true;
  40887. selectAttributes.required = true;
  40888. }
  40889. if (this.open === "multiSelect") {
  40890. selectAttributes.multiple = true;
  40891. }
  40892. return HTMLResult.success({
  40893. name: "label",
  40894. attributes: {
  40895. class: ["xfaLabel"]
  40896. },
  40897. children: [{
  40898. name: "select",
  40899. children,
  40900. attributes: selectAttributes
  40901. }]
  40902. });
  40903. }
  40904. }
  40905. class Color extends XFAObject {
  40906. constructor(attributes) {
  40907. super(TEMPLATE_NS_ID, "color", true);
  40908. this.cSpace = getStringOption(attributes.cSpace, ["SRGB"]);
  40909. this.id = attributes.id || "";
  40910. this.use = attributes.use || "";
  40911. this.usehref = attributes.usehref || "";
  40912. this.value = attributes.value ? getColor(attributes.value) : "";
  40913. this.extras = null;
  40914. }
  40915. [$hasSettableValue]() {
  40916. return false;
  40917. }
  40918. [$toStyle]() {
  40919. return this.value ? Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  40920. }
  40921. }
  40922. class Comb extends XFAObject {
  40923. constructor(attributes) {
  40924. super(TEMPLATE_NS_ID, "comb");
  40925. this.id = attributes.id || "";
  40926. this.numberOfCells = getInteger({
  40927. data: attributes.numberOfCells,
  40928. defaultValue: 0,
  40929. validate: x => x >= 0
  40930. });
  40931. this.use = attributes.use || "";
  40932. this.usehref = attributes.usehref || "";
  40933. }
  40934. }
  40935. class Connect extends XFAObject {
  40936. constructor(attributes) {
  40937. super(TEMPLATE_NS_ID, "connect", true);
  40938. this.connection = attributes.connection || "";
  40939. this.id = attributes.id || "";
  40940. this.ref = attributes.ref || "";
  40941. this.usage = getStringOption(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  40942. this.use = attributes.use || "";
  40943. this.usehref = attributes.usehref || "";
  40944. this.picture = null;
  40945. }
  40946. }
  40947. class ContentArea extends XFAObject {
  40948. constructor(attributes) {
  40949. super(TEMPLATE_NS_ID, "contentArea", true);
  40950. this.h = getMeasurement(attributes.h);
  40951. this.id = attributes.id || "";
  40952. this.name = attributes.name || "";
  40953. this.relevant = getRelevant(attributes.relevant);
  40954. this.use = attributes.use || "";
  40955. this.usehref = attributes.usehref || "";
  40956. this.w = getMeasurement(attributes.w);
  40957. this.x = getMeasurement(attributes.x, "0pt");
  40958. this.y = getMeasurement(attributes.y, "0pt");
  40959. this.desc = null;
  40960. this.extras = null;
  40961. }
  40962. [$toHTML](availableSpace) {
  40963. const left = measureToString(this.x);
  40964. const top = measureToString(this.y);
  40965. const style = {
  40966. left,
  40967. top,
  40968. width: measureToString(this.w),
  40969. height: measureToString(this.h)
  40970. };
  40971. const classNames = ["xfaContentarea"];
  40972. if (isPrintOnly(this)) {
  40973. classNames.push("xfaPrintOnly");
  40974. }
  40975. return HTMLResult.success({
  40976. name: "div",
  40977. children: [],
  40978. attributes: {
  40979. style,
  40980. class: classNames,
  40981. id: this[$uid]
  40982. }
  40983. });
  40984. }
  40985. }
  40986. class Corner extends XFAObject {
  40987. constructor(attributes) {
  40988. super(TEMPLATE_NS_ID, "corner", true);
  40989. this.id = attributes.id || "";
  40990. this.inverted = getInteger({
  40991. data: attributes.inverted,
  40992. defaultValue: 0,
  40993. validate: x => x === 1
  40994. });
  40995. this.join = getStringOption(attributes.join, ["square", "round"]);
  40996. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  40997. this.radius = getMeasurement(attributes.radius);
  40998. this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  40999. this.thickness = getMeasurement(attributes.thickness, "0.5pt");
  41000. this.use = attributes.use || "";
  41001. this.usehref = attributes.usehref || "";
  41002. this.color = null;
  41003. this.extras = null;
  41004. }
  41005. [$toStyle]() {
  41006. const style = toStyle(this, "visibility");
  41007. style.radius = measureToString(this.join === "square" ? 0 : this.radius);
  41008. return style;
  41009. }
  41010. }
  41011. class DateElement extends ContentObject {
  41012. constructor(attributes) {
  41013. super(TEMPLATE_NS_ID, "date");
  41014. this.id = attributes.id || "";
  41015. this.name = attributes.name || "";
  41016. this.use = attributes.use || "";
  41017. this.usehref = attributes.usehref || "";
  41018. }
  41019. [$finalize]() {
  41020. const date = this[$content].trim();
  41021. this[$content] = date ? new Date(date) : null;
  41022. }
  41023. [$toHTML](availableSpace) {
  41024. return valueToHtml(this[$content] ? this[$content].toString() : "");
  41025. }
  41026. }
  41027. class DateTime extends ContentObject {
  41028. constructor(attributes) {
  41029. super(TEMPLATE_NS_ID, "dateTime");
  41030. this.id = attributes.id || "";
  41031. this.name = attributes.name || "";
  41032. this.use = attributes.use || "";
  41033. this.usehref = attributes.usehref || "";
  41034. }
  41035. [$finalize]() {
  41036. const date = this[$content].trim();
  41037. this[$content] = date ? new Date(date) : null;
  41038. }
  41039. [$toHTML](availableSpace) {
  41040. return valueToHtml(this[$content] ? this[$content].toString() : "");
  41041. }
  41042. }
  41043. class DateTimeEdit extends XFAObject {
  41044. constructor(attributes) {
  41045. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  41046. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  41047. this.id = attributes.id || "";
  41048. this.picker = getStringOption(attributes.picker, ["host", "none"]);
  41049. this.use = attributes.use || "";
  41050. this.usehref = attributes.usehref || "";
  41051. this.border = null;
  41052. this.comb = null;
  41053. this.extras = null;
  41054. this.margin = null;
  41055. }
  41056. [$toHTML](availableSpace) {
  41057. const style = toStyle(this, "border", "font", "margin");
  41058. const field = this[$getParent]()[$getParent]();
  41059. const html = {
  41060. name: "input",
  41061. attributes: {
  41062. type: "text",
  41063. fieldId: field[$uid],
  41064. dataId: field[$data]?.[$uid] || field[$uid],
  41065. class: ["xfaTextfield"],
  41066. style,
  41067. "aria-label": ariaLabel(field),
  41068. "aria-required": false
  41069. }
  41070. };
  41071. if (isRequired(field)) {
  41072. html.attributes["aria-required"] = true;
  41073. html.attributes.required = true;
  41074. }
  41075. return HTMLResult.success({
  41076. name: "label",
  41077. attributes: {
  41078. class: ["xfaLabel"]
  41079. },
  41080. children: [html]
  41081. });
  41082. }
  41083. }
  41084. class Decimal extends ContentObject {
  41085. constructor(attributes) {
  41086. super(TEMPLATE_NS_ID, "decimal");
  41087. this.fracDigits = getInteger({
  41088. data: attributes.fracDigits,
  41089. defaultValue: 2,
  41090. validate: x => true
  41091. });
  41092. this.id = attributes.id || "";
  41093. this.leadDigits = getInteger({
  41094. data: attributes.leadDigits,
  41095. defaultValue: -1,
  41096. validate: x => true
  41097. });
  41098. this.name = attributes.name || "";
  41099. this.use = attributes.use || "";
  41100. this.usehref = attributes.usehref || "";
  41101. }
  41102. [$finalize]() {
  41103. const number = parseFloat(this[$content].trim());
  41104. this[$content] = isNaN(number) ? null : number;
  41105. }
  41106. [$toHTML](availableSpace) {
  41107. return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
  41108. }
  41109. }
  41110. class DefaultUi extends XFAObject {
  41111. constructor(attributes) {
  41112. super(TEMPLATE_NS_ID, "defaultUi", true);
  41113. this.id = attributes.id || "";
  41114. this.use = attributes.use || "";
  41115. this.usehref = attributes.usehref || "";
  41116. this.extras = null;
  41117. }
  41118. }
  41119. class Desc extends XFAObject {
  41120. constructor(attributes) {
  41121. super(TEMPLATE_NS_ID, "desc", true);
  41122. this.id = attributes.id || "";
  41123. this.use = attributes.use || "";
  41124. this.usehref = attributes.usehref || "";
  41125. this.boolean = new XFAObjectArray();
  41126. this.date = new XFAObjectArray();
  41127. this.dateTime = new XFAObjectArray();
  41128. this.decimal = new XFAObjectArray();
  41129. this.exData = new XFAObjectArray();
  41130. this.float = new XFAObjectArray();
  41131. this.image = new XFAObjectArray();
  41132. this.integer = new XFAObjectArray();
  41133. this.text = new XFAObjectArray();
  41134. this.time = new XFAObjectArray();
  41135. }
  41136. }
  41137. class DigestMethod extends OptionObject {
  41138. constructor(attributes) {
  41139. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  41140. this.id = attributes.id || "";
  41141. this.use = attributes.use || "";
  41142. this.usehref = attributes.usehref || "";
  41143. }
  41144. }
  41145. class DigestMethods extends XFAObject {
  41146. constructor(attributes) {
  41147. super(TEMPLATE_NS_ID, "digestMethods", true);
  41148. this.id = attributes.id || "";
  41149. this.type = getStringOption(attributes.type, ["optional", "required"]);
  41150. this.use = attributes.use || "";
  41151. this.usehref = attributes.usehref || "";
  41152. this.digestMethod = new XFAObjectArray();
  41153. }
  41154. }
  41155. class Draw extends XFAObject {
  41156. constructor(attributes) {
  41157. super(TEMPLATE_NS_ID, "draw", true);
  41158. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  41159. this.colSpan = getInteger({
  41160. data: attributes.colSpan,
  41161. defaultValue: 1,
  41162. validate: n => n >= 1 || n === -1
  41163. });
  41164. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  41165. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  41166. this.id = attributes.id || "";
  41167. this.locale = attributes.locale || "";
  41168. this.maxH = getMeasurement(attributes.maxH, "0pt");
  41169. this.maxW = getMeasurement(attributes.maxW, "0pt");
  41170. this.minH = getMeasurement(attributes.minH, "0pt");
  41171. this.minW = getMeasurement(attributes.minW, "0pt");
  41172. this.name = attributes.name || "";
  41173. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  41174. this.relevant = getRelevant(attributes.relevant);
  41175. this.rotate = getInteger({
  41176. data: attributes.rotate,
  41177. defaultValue: 0,
  41178. validate: x => x % 90 === 0
  41179. });
  41180. this.use = attributes.use || "";
  41181. this.usehref = attributes.usehref || "";
  41182. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  41183. this.x = getMeasurement(attributes.x, "0pt");
  41184. this.y = getMeasurement(attributes.y, "0pt");
  41185. this.assist = null;
  41186. this.border = null;
  41187. this.caption = null;
  41188. this.desc = null;
  41189. this.extras = null;
  41190. this.font = null;
  41191. this.keep = null;
  41192. this.margin = null;
  41193. this.para = null;
  41194. this.traversal = null;
  41195. this.ui = null;
  41196. this.value = null;
  41197. this.setProperty = new XFAObjectArray();
  41198. }
  41199. [$setValue](value) {
  41200. _setValue(this, value);
  41201. }
  41202. [$toHTML](availableSpace) {
  41203. setTabIndex(this);
  41204. if (this.presence === "hidden" || this.presence === "inactive") {
  41205. return HTMLResult.EMPTY;
  41206. }
  41207. fixDimensions(this);
  41208. this[$pushPara]();
  41209. const savedW = this.w;
  41210. const savedH = this.h;
  41211. const {
  41212. w,
  41213. h,
  41214. isBroken
  41215. } = layoutNode(this, availableSpace);
  41216. if (w && this.w === "") {
  41217. if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
  41218. this[$popPara]();
  41219. return HTMLResult.FAILURE;
  41220. }
  41221. this.w = w;
  41222. }
  41223. if (h && this.h === "") {
  41224. this.h = h;
  41225. }
  41226. setFirstUnsplittable(this);
  41227. if (!checkDimensions(this, availableSpace)) {
  41228. this.w = savedW;
  41229. this.h = savedH;
  41230. this[$popPara]();
  41231. return HTMLResult.FAILURE;
  41232. }
  41233. unsetFirstUnsplittable(this);
  41234. const style = toStyle(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  41235. setMinMaxDimensions(this, style);
  41236. if (style.margin) {
  41237. style.padding = style.margin;
  41238. delete style.margin;
  41239. }
  41240. const classNames = ["xfaDraw"];
  41241. if (this.font) {
  41242. classNames.push("xfaFont");
  41243. }
  41244. if (isPrintOnly(this)) {
  41245. classNames.push("xfaPrintOnly");
  41246. }
  41247. const attributes = {
  41248. style,
  41249. id: this[$uid],
  41250. class: classNames
  41251. };
  41252. if (this.name) {
  41253. attributes.xfaName = this.name;
  41254. }
  41255. const html = {
  41256. name: "div",
  41257. attributes,
  41258. children: []
  41259. };
  41260. applyAssist(this, attributes);
  41261. const bbox = computeBbox(this, html, availableSpace);
  41262. const value = this.value ? this.value[$toHTML](availableSpace).html : null;
  41263. if (value === null) {
  41264. this.w = savedW;
  41265. this.h = savedH;
  41266. this[$popPara]();
  41267. return HTMLResult.success(createWrapper(this, html), bbox);
  41268. }
  41269. html.children.push(value);
  41270. setPara(this, style, value);
  41271. this.w = savedW;
  41272. this.h = savedH;
  41273. this[$popPara]();
  41274. return HTMLResult.success(createWrapper(this, html), bbox);
  41275. }
  41276. }
  41277. class Edge extends XFAObject {
  41278. constructor(attributes) {
  41279. super(TEMPLATE_NS_ID, "edge", true);
  41280. this.cap = getStringOption(attributes.cap, ["square", "butt", "round"]);
  41281. this.id = attributes.id || "";
  41282. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  41283. this.stroke = getStringOption(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  41284. this.thickness = getMeasurement(attributes.thickness, "0.5pt");
  41285. this.use = attributes.use || "";
  41286. this.usehref = attributes.usehref || "";
  41287. this.color = null;
  41288. this.extras = null;
  41289. }
  41290. [$toStyle]() {
  41291. const style = toStyle(this, "visibility");
  41292. Object.assign(style, {
  41293. linecap: this.cap,
  41294. width: measureToString(this.thickness),
  41295. color: this.color ? this.color[$toStyle]() : "#000000",
  41296. style: ""
  41297. });
  41298. if (this.presence !== "visible") {
  41299. style.style = "none";
  41300. } else {
  41301. switch (this.stroke) {
  41302. case "solid":
  41303. style.style = "solid";
  41304. break;
  41305. case "dashDot":
  41306. style.style = "dashed";
  41307. break;
  41308. case "dashDotDot":
  41309. style.style = "dashed";
  41310. break;
  41311. case "dashed":
  41312. style.style = "dashed";
  41313. break;
  41314. case "dotted":
  41315. style.style = "dotted";
  41316. break;
  41317. case "embossed":
  41318. style.style = "ridge";
  41319. break;
  41320. case "etched":
  41321. style.style = "groove";
  41322. break;
  41323. case "lowered":
  41324. style.style = "inset";
  41325. break;
  41326. case "raised":
  41327. style.style = "outset";
  41328. break;
  41329. }
  41330. }
  41331. return style;
  41332. }
  41333. }
  41334. class Encoding extends OptionObject {
  41335. constructor(attributes) {
  41336. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  41337. this.id = attributes.id || "";
  41338. this.use = attributes.use || "";
  41339. this.usehref = attributes.usehref || "";
  41340. }
  41341. }
  41342. class Encodings extends XFAObject {
  41343. constructor(attributes) {
  41344. super(TEMPLATE_NS_ID, "encodings", true);
  41345. this.id = attributes.id || "";
  41346. this.type = getStringOption(attributes.type, ["optional", "required"]);
  41347. this.use = attributes.use || "";
  41348. this.usehref = attributes.usehref || "";
  41349. this.encoding = new XFAObjectArray();
  41350. }
  41351. }
  41352. class Encrypt extends XFAObject {
  41353. constructor(attributes) {
  41354. super(TEMPLATE_NS_ID, "encrypt", true);
  41355. this.id = attributes.id || "";
  41356. this.use = attributes.use || "";
  41357. this.usehref = attributes.usehref || "";
  41358. this.certificate = null;
  41359. }
  41360. }
  41361. class EncryptData extends XFAObject {
  41362. constructor(attributes) {
  41363. super(TEMPLATE_NS_ID, "encryptData", true);
  41364. this.id = attributes.id || "";
  41365. this.operation = getStringOption(attributes.operation, ["encrypt", "decrypt"]);
  41366. this.target = attributes.target || "";
  41367. this.use = attributes.use || "";
  41368. this.usehref = attributes.usehref || "";
  41369. this.filter = null;
  41370. this.manifest = null;
  41371. }
  41372. }
  41373. class Encryption extends XFAObject {
  41374. constructor(attributes) {
  41375. super(TEMPLATE_NS_ID, "encryption", true);
  41376. this.id = attributes.id || "";
  41377. this.type = getStringOption(attributes.type, ["optional", "required"]);
  41378. this.use = attributes.use || "";
  41379. this.usehref = attributes.usehref || "";
  41380. this.certificate = new XFAObjectArray();
  41381. }
  41382. }
  41383. class EncryptionMethod extends OptionObject {
  41384. constructor(attributes) {
  41385. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  41386. this.id = attributes.id || "";
  41387. this.use = attributes.use || "";
  41388. this.usehref = attributes.usehref || "";
  41389. }
  41390. }
  41391. class EncryptionMethods extends XFAObject {
  41392. constructor(attributes) {
  41393. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  41394. this.id = attributes.id || "";
  41395. this.type = getStringOption(attributes.type, ["optional", "required"]);
  41396. this.use = attributes.use || "";
  41397. this.usehref = attributes.usehref || "";
  41398. this.encryptionMethod = new XFAObjectArray();
  41399. }
  41400. }
  41401. class Event extends XFAObject {
  41402. constructor(attributes) {
  41403. super(TEMPLATE_NS_ID, "event", true);
  41404. this.activity = getStringOption(attributes.activity, ["click", "change", "docClose", "docReady", "enter", "exit", "full", "indexChange", "initialize", "mouseDown", "mouseEnter", "mouseExit", "mouseUp", "postExecute", "postOpen", "postPrint", "postSave", "postSign", "postSubmit", "preExecute", "preOpen", "prePrint", "preSave", "preSign", "preSubmit", "ready", "validationState"]);
  41405. this.id = attributes.id || "";
  41406. this.listen = getStringOption(attributes.listen, ["refOnly", "refAndDescendents"]);
  41407. this.name = attributes.name || "";
  41408. this.ref = attributes.ref || "";
  41409. this.use = attributes.use || "";
  41410. this.usehref = attributes.usehref || "";
  41411. this.extras = null;
  41412. this.encryptData = null;
  41413. this.execute = null;
  41414. this.script = null;
  41415. this.signData = null;
  41416. this.submit = null;
  41417. }
  41418. }
  41419. class ExData extends ContentObject {
  41420. constructor(attributes) {
  41421. super(TEMPLATE_NS_ID, "exData");
  41422. this.contentType = attributes.contentType || "";
  41423. this.href = attributes.href || "";
  41424. this.id = attributes.id || "";
  41425. this.maxLength = getInteger({
  41426. data: attributes.maxLength,
  41427. defaultValue: -1,
  41428. validate: x => x >= -1
  41429. });
  41430. this.name = attributes.name || "";
  41431. this.rid = attributes.rid || "";
  41432. this.transferEncoding = getStringOption(attributes.transferEncoding, ["none", "base64", "package"]);
  41433. this.use = attributes.use || "";
  41434. this.usehref = attributes.usehref || "";
  41435. }
  41436. [$isCDATAXml]() {
  41437. return this.contentType === "text/html";
  41438. }
  41439. [$onChild](child) {
  41440. if (this.contentType === "text/html" && child[$namespaceId] === NamespaceIds.xhtml.id) {
  41441. this[$content] = child;
  41442. return true;
  41443. }
  41444. if (this.contentType === "text/xml") {
  41445. this[$content] = child;
  41446. return true;
  41447. }
  41448. return false;
  41449. }
  41450. [$toHTML](availableSpace) {
  41451. if (this.contentType !== "text/html" || !this[$content]) {
  41452. return HTMLResult.EMPTY;
  41453. }
  41454. return this[$content][$toHTML](availableSpace);
  41455. }
  41456. }
  41457. class ExObject extends XFAObject {
  41458. constructor(attributes) {
  41459. super(TEMPLATE_NS_ID, "exObject", true);
  41460. this.archive = attributes.archive || "";
  41461. this.classId = attributes.classId || "";
  41462. this.codeBase = attributes.codeBase || "";
  41463. this.codeType = attributes.codeType || "";
  41464. this.id = attributes.id || "";
  41465. this.name = attributes.name || "";
  41466. this.use = attributes.use || "";
  41467. this.usehref = attributes.usehref || "";
  41468. this.extras = null;
  41469. this.boolean = new XFAObjectArray();
  41470. this.date = new XFAObjectArray();
  41471. this.dateTime = new XFAObjectArray();
  41472. this.decimal = new XFAObjectArray();
  41473. this.exData = new XFAObjectArray();
  41474. this.exObject = new XFAObjectArray();
  41475. this.float = new XFAObjectArray();
  41476. this.image = new XFAObjectArray();
  41477. this.integer = new XFAObjectArray();
  41478. this.text = new XFAObjectArray();
  41479. this.time = new XFAObjectArray();
  41480. }
  41481. }
  41482. class ExclGroup extends XFAObject {
  41483. constructor(attributes) {
  41484. super(TEMPLATE_NS_ID, "exclGroup", true);
  41485. this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  41486. this.accessKey = attributes.accessKey || "";
  41487. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  41488. this.colSpan = getInteger({
  41489. data: attributes.colSpan,
  41490. defaultValue: 1,
  41491. validate: n => n >= 1 || n === -1
  41492. });
  41493. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  41494. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  41495. this.id = attributes.id || "";
  41496. this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  41497. this.maxH = getMeasurement(attributes.maxH, "0pt");
  41498. this.maxW = getMeasurement(attributes.maxW, "0pt");
  41499. this.minH = getMeasurement(attributes.minH, "0pt");
  41500. this.minW = getMeasurement(attributes.minW, "0pt");
  41501. this.name = attributes.name || "";
  41502. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  41503. this.relevant = getRelevant(attributes.relevant);
  41504. this.use = attributes.use || "";
  41505. this.usehref = attributes.usehref || "";
  41506. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  41507. this.x = getMeasurement(attributes.x, "0pt");
  41508. this.y = getMeasurement(attributes.y, "0pt");
  41509. this.assist = null;
  41510. this.bind = null;
  41511. this.border = null;
  41512. this.calculate = null;
  41513. this.caption = null;
  41514. this.desc = null;
  41515. this.extras = null;
  41516. this.margin = null;
  41517. this.para = null;
  41518. this.traversal = null;
  41519. this.validate = null;
  41520. this.connect = new XFAObjectArray();
  41521. this.event = new XFAObjectArray();
  41522. this.field = new XFAObjectArray();
  41523. this.setProperty = new XFAObjectArray();
  41524. }
  41525. [$isBindable]() {
  41526. return true;
  41527. }
  41528. [$hasSettableValue]() {
  41529. return true;
  41530. }
  41531. [$setValue](value) {
  41532. for (const field of this.field.children) {
  41533. if (!field.value) {
  41534. const nodeValue = new Value({});
  41535. field[$appendChild](nodeValue);
  41536. field.value = nodeValue;
  41537. }
  41538. field.value[$setValue](value);
  41539. }
  41540. }
  41541. [$isThereMoreWidth]() {
  41542. return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth]();
  41543. }
  41544. [$isSplittable]() {
  41545. const parent = this[$getSubformParent]();
  41546. if (!parent[$isSplittable]()) {
  41547. return false;
  41548. }
  41549. if (this[$extra]._isSplittable !== undefined) {
  41550. return this[$extra]._isSplittable;
  41551. }
  41552. if (this.layout === "position" || this.layout.includes("row")) {
  41553. this[$extra]._isSplittable = false;
  41554. return false;
  41555. }
  41556. if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) {
  41557. return false;
  41558. }
  41559. this[$extra]._isSplittable = true;
  41560. return true;
  41561. }
  41562. [$flushHTML]() {
  41563. return flushHTML(this);
  41564. }
  41565. [$addHTML](html, bbox) {
  41566. addHTML(this, html, bbox);
  41567. }
  41568. [$getAvailableSpace]() {
  41569. return getAvailableSpace(this);
  41570. }
  41571. [$toHTML](availableSpace) {
  41572. setTabIndex(this);
  41573. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  41574. return HTMLResult.EMPTY;
  41575. }
  41576. fixDimensions(this);
  41577. const children = [];
  41578. const attributes = {
  41579. id: this[$uid],
  41580. class: []
  41581. };
  41582. setAccess(this, attributes.class);
  41583. if (!this[$extra]) {
  41584. this[$extra] = Object.create(null);
  41585. }
  41586. Object.assign(this[$extra], {
  41587. children,
  41588. attributes,
  41589. attempt: 0,
  41590. line: null,
  41591. numberInLine: 0,
  41592. availableSpace: {
  41593. width: Math.min(this.w || Infinity, availableSpace.width),
  41594. height: Math.min(this.h || Infinity, availableSpace.height)
  41595. },
  41596. width: 0,
  41597. height: 0,
  41598. prevHeight: 0,
  41599. currentWidth: 0
  41600. });
  41601. const isSplittable = this[$isSplittable]();
  41602. if (!isSplittable) {
  41603. setFirstUnsplittable(this);
  41604. }
  41605. if (!checkDimensions(this, availableSpace)) {
  41606. return HTMLResult.FAILURE;
  41607. }
  41608. const filter = new Set(["field"]);
  41609. if (this.layout.includes("row")) {
  41610. const columnWidths = this[$getSubformParent]().columnWidths;
  41611. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  41612. this[$extra].columnWidths = columnWidths;
  41613. this[$extra].currentColumn = 0;
  41614. }
  41615. }
  41616. const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  41617. const classNames = ["xfaExclgroup"];
  41618. const cl = layoutClass(this);
  41619. if (cl) {
  41620. classNames.push(cl);
  41621. }
  41622. if (isPrintOnly(this)) {
  41623. classNames.push("xfaPrintOnly");
  41624. }
  41625. attributes.style = style;
  41626. attributes.class = classNames;
  41627. if (this.name) {
  41628. attributes.xfaName = this.name;
  41629. }
  41630. this[$pushPara]();
  41631. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  41632. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  41633. for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {
  41634. if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  41635. this[$extra].numberInLine = 0;
  41636. }
  41637. const result = this[$childrenToHTML]({
  41638. filter,
  41639. include: true
  41640. });
  41641. if (result.success) {
  41642. break;
  41643. }
  41644. if (result.isBreak()) {
  41645. this[$popPara]();
  41646. return result;
  41647. }
  41648. if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !this[$getTemplateRoot]()[$extra].noLayoutFailure) {
  41649. this[$extra].attempt = maxRun;
  41650. break;
  41651. }
  41652. }
  41653. this[$popPara]();
  41654. if (!isSplittable) {
  41655. unsetFirstUnsplittable(this);
  41656. }
  41657. if (this[$extra].attempt === maxRun) {
  41658. if (!isSplittable) {
  41659. delete this[$extra];
  41660. }
  41661. return HTMLResult.FAILURE;
  41662. }
  41663. let marginH = 0;
  41664. let marginV = 0;
  41665. if (this.margin) {
  41666. marginH = this.margin.leftInset + this.margin.rightInset;
  41667. marginV = this.margin.topInset + this.margin.bottomInset;
  41668. }
  41669. const width = Math.max(this[$extra].width + marginH, this.w || 0);
  41670. const height = Math.max(this[$extra].height + marginV, this.h || 0);
  41671. const bbox = [this.x, this.y, width, height];
  41672. if (this.w === "") {
  41673. style.width = measureToString(width);
  41674. }
  41675. if (this.h === "") {
  41676. style.height = measureToString(height);
  41677. }
  41678. const html = {
  41679. name: "div",
  41680. attributes,
  41681. children
  41682. };
  41683. applyAssist(this, attributes);
  41684. delete this[$extra];
  41685. return HTMLResult.success(createWrapper(this, html), bbox);
  41686. }
  41687. }
  41688. class Execute extends XFAObject {
  41689. constructor(attributes) {
  41690. super(TEMPLATE_NS_ID, "execute");
  41691. this.connection = attributes.connection || "";
  41692. this.executeType = getStringOption(attributes.executeType, ["import", "remerge"]);
  41693. this.id = attributes.id || "";
  41694. this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
  41695. this.use = attributes.use || "";
  41696. this.usehref = attributes.usehref || "";
  41697. }
  41698. }
  41699. class Extras extends XFAObject {
  41700. constructor(attributes) {
  41701. super(TEMPLATE_NS_ID, "extras", true);
  41702. this.id = attributes.id || "";
  41703. this.name = attributes.name || "";
  41704. this.use = attributes.use || "";
  41705. this.usehref = attributes.usehref || "";
  41706. this.boolean = new XFAObjectArray();
  41707. this.date = new XFAObjectArray();
  41708. this.dateTime = new XFAObjectArray();
  41709. this.decimal = new XFAObjectArray();
  41710. this.exData = new XFAObjectArray();
  41711. this.extras = new XFAObjectArray();
  41712. this.float = new XFAObjectArray();
  41713. this.image = new XFAObjectArray();
  41714. this.integer = new XFAObjectArray();
  41715. this.text = new XFAObjectArray();
  41716. this.time = new XFAObjectArray();
  41717. }
  41718. }
  41719. class Field extends XFAObject {
  41720. constructor(attributes) {
  41721. super(TEMPLATE_NS_ID, "field", true);
  41722. this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  41723. this.accessKey = attributes.accessKey || "";
  41724. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  41725. this.colSpan = getInteger({
  41726. data: attributes.colSpan,
  41727. defaultValue: 1,
  41728. validate: n => n >= 1 || n === -1
  41729. });
  41730. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  41731. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  41732. this.id = attributes.id || "";
  41733. this.locale = attributes.locale || "";
  41734. this.maxH = getMeasurement(attributes.maxH, "0pt");
  41735. this.maxW = getMeasurement(attributes.maxW, "0pt");
  41736. this.minH = getMeasurement(attributes.minH, "0pt");
  41737. this.minW = getMeasurement(attributes.minW, "0pt");
  41738. this.name = attributes.name || "";
  41739. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  41740. this.relevant = getRelevant(attributes.relevant);
  41741. this.rotate = getInteger({
  41742. data: attributes.rotate,
  41743. defaultValue: 0,
  41744. validate: x => x % 90 === 0
  41745. });
  41746. this.use = attributes.use || "";
  41747. this.usehref = attributes.usehref || "";
  41748. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  41749. this.x = getMeasurement(attributes.x, "0pt");
  41750. this.y = getMeasurement(attributes.y, "0pt");
  41751. this.assist = null;
  41752. this.bind = null;
  41753. this.border = null;
  41754. this.calculate = null;
  41755. this.caption = null;
  41756. this.desc = null;
  41757. this.extras = null;
  41758. this.font = null;
  41759. this.format = null;
  41760. this.items = new XFAObjectArray(2);
  41761. this.keep = null;
  41762. this.margin = null;
  41763. this.para = null;
  41764. this.traversal = null;
  41765. this.ui = null;
  41766. this.validate = null;
  41767. this.value = null;
  41768. this.bindItems = new XFAObjectArray();
  41769. this.connect = new XFAObjectArray();
  41770. this.event = new XFAObjectArray();
  41771. this.setProperty = new XFAObjectArray();
  41772. }
  41773. [$isBindable]() {
  41774. return true;
  41775. }
  41776. [$setValue](value) {
  41777. _setValue(this, value);
  41778. }
  41779. [$toHTML](availableSpace) {
  41780. setTabIndex(this);
  41781. if (!this.ui) {
  41782. this.ui = new Ui({});
  41783. this.ui[$globalData] = this[$globalData];
  41784. this[$appendChild](this.ui);
  41785. let node;
  41786. switch (this.items.children.length) {
  41787. case 0:
  41788. node = new TextEdit({});
  41789. this.ui.textEdit = node;
  41790. break;
  41791. case 1:
  41792. node = new CheckButton({});
  41793. this.ui.checkButton = node;
  41794. break;
  41795. case 2:
  41796. node = new ChoiceList({});
  41797. this.ui.choiceList = node;
  41798. break;
  41799. }
  41800. this.ui[$appendChild](node);
  41801. }
  41802. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  41803. return HTMLResult.EMPTY;
  41804. }
  41805. if (this.caption) {
  41806. delete this.caption[$extra];
  41807. }
  41808. this[$pushPara]();
  41809. const caption = this.caption ? this.caption[$toHTML](availableSpace).html : null;
  41810. const savedW = this.w;
  41811. const savedH = this.h;
  41812. let marginH = 0;
  41813. let marginV = 0;
  41814. if (this.margin) {
  41815. marginH = this.margin.leftInset + this.margin.rightInset;
  41816. marginV = this.margin.topInset + this.margin.bottomInset;
  41817. }
  41818. let borderDims = null;
  41819. if (this.w === "" || this.h === "") {
  41820. let width = null;
  41821. let height = null;
  41822. let uiW = 0;
  41823. let uiH = 0;
  41824. if (this.ui.checkButton) {
  41825. uiW = uiH = this.ui.checkButton.size;
  41826. } else {
  41827. const {
  41828. w,
  41829. h
  41830. } = layoutNode(this, availableSpace);
  41831. if (w !== null) {
  41832. uiW = w;
  41833. uiH = h;
  41834. } else {
  41835. uiH = fonts_getMetrics(this.font, true).lineNoGap;
  41836. }
  41837. }
  41838. borderDims = getBorderDims(this.ui[$getExtra]());
  41839. uiW += borderDims.w;
  41840. uiH += borderDims.h;
  41841. if (this.caption) {
  41842. const {
  41843. w,
  41844. h,
  41845. isBroken
  41846. } = this.caption[$getExtra](availableSpace);
  41847. if (isBroken && this[$getSubformParent]()[$isThereMoreWidth]()) {
  41848. this[$popPara]();
  41849. return HTMLResult.FAILURE;
  41850. }
  41851. width = w;
  41852. height = h;
  41853. switch (this.caption.placement) {
  41854. case "left":
  41855. case "right":
  41856. case "inline":
  41857. width += uiW;
  41858. break;
  41859. case "top":
  41860. case "bottom":
  41861. height += uiH;
  41862. break;
  41863. }
  41864. } else {
  41865. width = uiW;
  41866. height = uiH;
  41867. }
  41868. if (width && this.w === "") {
  41869. width += marginH;
  41870. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  41871. }
  41872. if (height && this.h === "") {
  41873. height += marginV;
  41874. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  41875. }
  41876. }
  41877. this[$popPara]();
  41878. fixDimensions(this);
  41879. setFirstUnsplittable(this);
  41880. if (!checkDimensions(this, availableSpace)) {
  41881. this.w = savedW;
  41882. this.h = savedH;
  41883. this[$popPara]();
  41884. return HTMLResult.FAILURE;
  41885. }
  41886. unsetFirstUnsplittable(this);
  41887. const style = toStyle(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  41888. setMinMaxDimensions(this, style);
  41889. const classNames = ["xfaField"];
  41890. if (this.font) {
  41891. classNames.push("xfaFont");
  41892. }
  41893. if (isPrintOnly(this)) {
  41894. classNames.push("xfaPrintOnly");
  41895. }
  41896. const attributes = {
  41897. style,
  41898. id: this[$uid],
  41899. class: classNames
  41900. };
  41901. if (style.margin) {
  41902. style.padding = style.margin;
  41903. delete style.margin;
  41904. }
  41905. setAccess(this, classNames);
  41906. if (this.name) {
  41907. attributes.xfaName = this.name;
  41908. }
  41909. const children = [];
  41910. const html = {
  41911. name: "div",
  41912. attributes,
  41913. children
  41914. };
  41915. applyAssist(this, attributes);
  41916. const borderStyle = this.border ? this.border[$toStyle]() : null;
  41917. const bbox = computeBbox(this, html, availableSpace);
  41918. const ui = this.ui[$toHTML]().html;
  41919. if (!ui) {
  41920. Object.assign(style, borderStyle);
  41921. return HTMLResult.success(createWrapper(this, html), bbox);
  41922. }
  41923. if (this[$tabIndex]) {
  41924. if (ui.children?.[0]) {
  41925. ui.children[0].attributes.tabindex = this[$tabIndex];
  41926. } else {
  41927. ui.attributes.tabindex = this[$tabIndex];
  41928. }
  41929. }
  41930. if (!ui.attributes.style) {
  41931. ui.attributes.style = Object.create(null);
  41932. }
  41933. let aElement = null;
  41934. if (this.ui.button) {
  41935. if (ui.children.length === 1) {
  41936. [aElement] = ui.children.splice(0, 1);
  41937. }
  41938. Object.assign(ui.attributes.style, borderStyle);
  41939. } else {
  41940. Object.assign(style, borderStyle);
  41941. }
  41942. children.push(ui);
  41943. if (this.value) {
  41944. if (this.ui.imageEdit) {
  41945. ui.children.push(this.value[$toHTML]().html);
  41946. } else if (!this.ui.button) {
  41947. let value = "";
  41948. if (this.value.exData) {
  41949. value = this.value.exData[$text]();
  41950. } else if (this.value.text) {
  41951. value = this.value.text[$getExtra]();
  41952. } else {
  41953. const htmlValue = this.value[$toHTML]().html;
  41954. if (htmlValue !== null) {
  41955. value = htmlValue.children[0].value;
  41956. }
  41957. }
  41958. if (this.ui.textEdit && this.value.text?.maxChars) {
  41959. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  41960. }
  41961. if (value) {
  41962. if (this.ui.numericEdit) {
  41963. value = parseFloat(value);
  41964. value = isNaN(value) ? "" : value.toString();
  41965. }
  41966. if (ui.children[0].name === "textarea") {
  41967. ui.children[0].attributes.textContent = value;
  41968. } else {
  41969. ui.children[0].attributes.value = value;
  41970. }
  41971. }
  41972. }
  41973. }
  41974. if (!this.ui.imageEdit && ui.children?.[0] && this.h) {
  41975. borderDims = borderDims || getBorderDims(this.ui[$getExtra]());
  41976. let captionHeight = 0;
  41977. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  41978. captionHeight = this.caption.reserve;
  41979. if (captionHeight <= 0) {
  41980. captionHeight = this.caption[$getExtra](availableSpace).h;
  41981. }
  41982. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  41983. ui.children[0].attributes.style.height = measureToString(inputHeight);
  41984. } else {
  41985. ui.children[0].attributes.style.height = "100%";
  41986. }
  41987. }
  41988. if (aElement) {
  41989. ui.children.push(aElement);
  41990. }
  41991. if (!caption) {
  41992. if (ui.attributes.class) {
  41993. ui.attributes.class.push("xfaLeft");
  41994. }
  41995. this.w = savedW;
  41996. this.h = savedH;
  41997. return HTMLResult.success(createWrapper(this, html), bbox);
  41998. }
  41999. if (this.ui.button) {
  42000. if (style.padding) {
  42001. delete style.padding;
  42002. }
  42003. if (caption.name === "div") {
  42004. caption.name = "span";
  42005. }
  42006. ui.children.push(caption);
  42007. return HTMLResult.success(html, bbox);
  42008. } else if (this.ui.checkButton) {
  42009. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  42010. }
  42011. if (!ui.attributes.class) {
  42012. ui.attributes.class = [];
  42013. }
  42014. ui.children.splice(0, 0, caption);
  42015. switch (this.caption.placement) {
  42016. case "left":
  42017. ui.attributes.class.push("xfaLeft");
  42018. break;
  42019. case "right":
  42020. ui.attributes.class.push("xfaRight");
  42021. break;
  42022. case "top":
  42023. ui.attributes.class.push("xfaTop");
  42024. break;
  42025. case "bottom":
  42026. ui.attributes.class.push("xfaBottom");
  42027. break;
  42028. case "inline":
  42029. ui.attributes.class.push("xfaLeft");
  42030. break;
  42031. }
  42032. this.w = savedW;
  42033. this.h = savedH;
  42034. return HTMLResult.success(createWrapper(this, html), bbox);
  42035. }
  42036. }
  42037. class Fill extends XFAObject {
  42038. constructor(attributes) {
  42039. super(TEMPLATE_NS_ID, "fill", true);
  42040. this.id = attributes.id || "";
  42041. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  42042. this.use = attributes.use || "";
  42043. this.usehref = attributes.usehref || "";
  42044. this.color = null;
  42045. this.extras = null;
  42046. this.linear = null;
  42047. this.pattern = null;
  42048. this.radial = null;
  42049. this.solid = null;
  42050. this.stipple = null;
  42051. }
  42052. [$toStyle]() {
  42053. const parent = this[$getParent]();
  42054. const grandpa = parent[$getParent]();
  42055. const ggrandpa = grandpa[$getParent]();
  42056. const style = Object.create(null);
  42057. let propName = "color";
  42058. let altPropName = propName;
  42059. if (parent instanceof Border) {
  42060. propName = "background-color";
  42061. altPropName = "background";
  42062. if (ggrandpa instanceof Ui) {
  42063. style.backgroundColor = "white";
  42064. }
  42065. }
  42066. if (parent instanceof Rectangle || parent instanceof Arc) {
  42067. propName = altPropName = "fill";
  42068. style.fill = "white";
  42069. }
  42070. for (const name of Object.getOwnPropertyNames(this)) {
  42071. if (name === "extras" || name === "color") {
  42072. continue;
  42073. }
  42074. const obj = this[name];
  42075. if (!(obj instanceof XFAObject)) {
  42076. continue;
  42077. }
  42078. const color = obj[$toStyle](this.color);
  42079. if (color) {
  42080. style[color.startsWith("#") ? propName : altPropName] = color;
  42081. }
  42082. return style;
  42083. }
  42084. if (this.color?.value) {
  42085. const color = this.color[$toStyle]();
  42086. style[color.startsWith("#") ? propName : altPropName] = color;
  42087. }
  42088. return style;
  42089. }
  42090. }
  42091. class Filter extends XFAObject {
  42092. constructor(attributes) {
  42093. super(TEMPLATE_NS_ID, "filter", true);
  42094. this.addRevocationInfo = getStringOption(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  42095. this.id = attributes.id || "";
  42096. this.name = attributes.name || "";
  42097. this.use = attributes.use || "";
  42098. this.usehref = attributes.usehref || "";
  42099. this.version = getInteger({
  42100. data: this.version,
  42101. defaultValue: 5,
  42102. validate: x => x >= 1 && x <= 5
  42103. });
  42104. this.appearanceFilter = null;
  42105. this.certificates = null;
  42106. this.digestMethods = null;
  42107. this.encodings = null;
  42108. this.encryptionMethods = null;
  42109. this.handler = null;
  42110. this.lockDocument = null;
  42111. this.mdp = null;
  42112. this.reasons = null;
  42113. this.timeStamp = null;
  42114. }
  42115. }
  42116. class Float extends ContentObject {
  42117. constructor(attributes) {
  42118. super(TEMPLATE_NS_ID, "float");
  42119. this.id = attributes.id || "";
  42120. this.name = attributes.name || "";
  42121. this.use = attributes.use || "";
  42122. this.usehref = attributes.usehref || "";
  42123. }
  42124. [$finalize]() {
  42125. const number = parseFloat(this[$content].trim());
  42126. this[$content] = isNaN(number) ? null : number;
  42127. }
  42128. [$toHTML](availableSpace) {
  42129. return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
  42130. }
  42131. }
  42132. class template_Font extends XFAObject {
  42133. constructor(attributes) {
  42134. super(TEMPLATE_NS_ID, "font", true);
  42135. this.baselineShift = getMeasurement(attributes.baselineShift);
  42136. this.fontHorizontalScale = getFloat({
  42137. data: attributes.fontHorizontalScale,
  42138. defaultValue: 100,
  42139. validate: x => x >= 0
  42140. });
  42141. this.fontVerticalScale = getFloat({
  42142. data: attributes.fontVerticalScale,
  42143. defaultValue: 100,
  42144. validate: x => x >= 0
  42145. });
  42146. this.id = attributes.id || "";
  42147. this.kerningMode = getStringOption(attributes.kerningMode, ["none", "pair"]);
  42148. this.letterSpacing = getMeasurement(attributes.letterSpacing, "0");
  42149. this.lineThrough = getInteger({
  42150. data: attributes.lineThrough,
  42151. defaultValue: 0,
  42152. validate: x => x === 1 || x === 2
  42153. });
  42154. this.lineThroughPeriod = getStringOption(attributes.lineThroughPeriod, ["all", "word"]);
  42155. this.overline = getInteger({
  42156. data: attributes.overline,
  42157. defaultValue: 0,
  42158. validate: x => x === 1 || x === 2
  42159. });
  42160. this.overlinePeriod = getStringOption(attributes.overlinePeriod, ["all", "word"]);
  42161. this.posture = getStringOption(attributes.posture, ["normal", "italic"]);
  42162. this.size = getMeasurement(attributes.size, "10pt");
  42163. this.typeface = attributes.typeface || "Courier";
  42164. this.underline = getInteger({
  42165. data: attributes.underline,
  42166. defaultValue: 0,
  42167. validate: x => x === 1 || x === 2
  42168. });
  42169. this.underlinePeriod = getStringOption(attributes.underlinePeriod, ["all", "word"]);
  42170. this.use = attributes.use || "";
  42171. this.usehref = attributes.usehref || "";
  42172. this.weight = getStringOption(attributes.weight, ["normal", "bold"]);
  42173. this.extras = null;
  42174. this.fill = null;
  42175. }
  42176. [$clean](builder) {
  42177. super[$clean](builder);
  42178. this[$globalData].usedTypefaces.add(this.typeface);
  42179. }
  42180. [$toStyle]() {
  42181. const style = toStyle(this, "fill");
  42182. const color = style.color;
  42183. if (color) {
  42184. if (color === "#000000") {
  42185. delete style.color;
  42186. } else if (!color.startsWith("#")) {
  42187. style.background = color;
  42188. style.backgroundClip = "text";
  42189. style.color = "transparent";
  42190. }
  42191. }
  42192. if (this.baselineShift) {
  42193. style.verticalAlign = measureToString(this.baselineShift);
  42194. }
  42195. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  42196. style.letterSpacing = measureToString(this.letterSpacing);
  42197. if (this.lineThrough !== 0) {
  42198. style.textDecoration = "line-through";
  42199. if (this.lineThrough === 2) {
  42200. style.textDecorationStyle = "double";
  42201. }
  42202. }
  42203. if (this.overline !== 0) {
  42204. style.textDecoration = "overline";
  42205. if (this.overline === 2) {
  42206. style.textDecorationStyle = "double";
  42207. }
  42208. }
  42209. style.fontStyle = this.posture;
  42210. style.fontSize = measureToString(0.99 * this.size);
  42211. setFontFamily(this, this, this[$globalData].fontFinder, style);
  42212. if (this.underline !== 0) {
  42213. style.textDecoration = "underline";
  42214. if (this.underline === 2) {
  42215. style.textDecorationStyle = "double";
  42216. }
  42217. }
  42218. style.fontWeight = this.weight;
  42219. return style;
  42220. }
  42221. }
  42222. class Format extends XFAObject {
  42223. constructor(attributes) {
  42224. super(TEMPLATE_NS_ID, "format", true);
  42225. this.id = attributes.id || "";
  42226. this.use = attributes.use || "";
  42227. this.usehref = attributes.usehref || "";
  42228. this.extras = null;
  42229. this.picture = null;
  42230. }
  42231. }
  42232. class Handler extends StringObject {
  42233. constructor(attributes) {
  42234. super(TEMPLATE_NS_ID, "handler");
  42235. this.id = attributes.id || "";
  42236. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42237. this.use = attributes.use || "";
  42238. this.usehref = attributes.usehref || "";
  42239. }
  42240. }
  42241. class Hyphenation extends XFAObject {
  42242. constructor(attributes) {
  42243. super(TEMPLATE_NS_ID, "hyphenation");
  42244. this.excludeAllCaps = getInteger({
  42245. data: attributes.excludeAllCaps,
  42246. defaultValue: 0,
  42247. validate: x => x === 1
  42248. });
  42249. this.excludeInitialCap = getInteger({
  42250. data: attributes.excludeInitialCap,
  42251. defaultValue: 0,
  42252. validate: x => x === 1
  42253. });
  42254. this.hyphenate = getInteger({
  42255. data: attributes.hyphenate,
  42256. defaultValue: 0,
  42257. validate: x => x === 1
  42258. });
  42259. this.id = attributes.id || "";
  42260. this.pushCharacterCount = getInteger({
  42261. data: attributes.pushCharacterCount,
  42262. defaultValue: 3,
  42263. validate: x => x >= 0
  42264. });
  42265. this.remainCharacterCount = getInteger({
  42266. data: attributes.remainCharacterCount,
  42267. defaultValue: 3,
  42268. validate: x => x >= 0
  42269. });
  42270. this.use = attributes.use || "";
  42271. this.usehref = attributes.usehref || "";
  42272. this.wordCharacterCount = getInteger({
  42273. data: attributes.wordCharacterCount,
  42274. defaultValue: 7,
  42275. validate: x => x >= 0
  42276. });
  42277. }
  42278. }
  42279. class Image extends StringObject {
  42280. constructor(attributes) {
  42281. super(TEMPLATE_NS_ID, "image");
  42282. this.aspect = getStringOption(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  42283. this.contentType = attributes.contentType || "";
  42284. this.href = attributes.href || "";
  42285. this.id = attributes.id || "";
  42286. this.name = attributes.name || "";
  42287. this.transferEncoding = getStringOption(attributes.transferEncoding, ["base64", "none", "package"]);
  42288. this.use = attributes.use || "";
  42289. this.usehref = attributes.usehref || "";
  42290. }
  42291. [$toHTML]() {
  42292. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  42293. return HTMLResult.EMPTY;
  42294. }
  42295. let buffer = this[$globalData].images && this[$globalData].images.get(this.href);
  42296. if (!buffer && (this.href || !this[$content])) {
  42297. return HTMLResult.EMPTY;
  42298. }
  42299. if (!buffer && this.transferEncoding === "base64") {
  42300. buffer = fromBase64Util(this[$content]);
  42301. }
  42302. if (!buffer) {
  42303. return HTMLResult.EMPTY;
  42304. }
  42305. if (!this.contentType) {
  42306. for (const [header, type] of IMAGES_HEADERS) {
  42307. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  42308. this.contentType = type;
  42309. break;
  42310. }
  42311. }
  42312. if (!this.contentType) {
  42313. return HTMLResult.EMPTY;
  42314. }
  42315. }
  42316. const blob = new Blob([buffer], {
  42317. type: this.contentType
  42318. });
  42319. let style;
  42320. switch (this.aspect) {
  42321. case "fit":
  42322. case "actual":
  42323. break;
  42324. case "height":
  42325. style = {
  42326. height: "100%",
  42327. objectFit: "fill"
  42328. };
  42329. break;
  42330. case "none":
  42331. style = {
  42332. width: "100%",
  42333. height: "100%",
  42334. objectFit: "fill"
  42335. };
  42336. break;
  42337. case "width":
  42338. style = {
  42339. width: "100%",
  42340. objectFit: "fill"
  42341. };
  42342. break;
  42343. }
  42344. const parent = this[$getParent]();
  42345. return HTMLResult.success({
  42346. name: "img",
  42347. attributes: {
  42348. class: ["xfaImage"],
  42349. style,
  42350. src: URL.createObjectURL(blob),
  42351. alt: parent ? ariaLabel(parent[$getParent]()) : null
  42352. }
  42353. });
  42354. }
  42355. }
  42356. class ImageEdit extends XFAObject {
  42357. constructor(attributes) {
  42358. super(TEMPLATE_NS_ID, "imageEdit", true);
  42359. this.data = getStringOption(attributes.data, ["link", "embed"]);
  42360. this.id = attributes.id || "";
  42361. this.use = attributes.use || "";
  42362. this.usehref = attributes.usehref || "";
  42363. this.border = null;
  42364. this.extras = null;
  42365. this.margin = null;
  42366. }
  42367. [$toHTML](availableSpace) {
  42368. if (this.data === "embed") {
  42369. return HTMLResult.success({
  42370. name: "div",
  42371. children: [],
  42372. attributes: {}
  42373. });
  42374. }
  42375. return HTMLResult.EMPTY;
  42376. }
  42377. }
  42378. class Integer extends ContentObject {
  42379. constructor(attributes) {
  42380. super(TEMPLATE_NS_ID, "integer");
  42381. this.id = attributes.id || "";
  42382. this.name = attributes.name || "";
  42383. this.use = attributes.use || "";
  42384. this.usehref = attributes.usehref || "";
  42385. }
  42386. [$finalize]() {
  42387. const number = parseInt(this[$content].trim(), 10);
  42388. this[$content] = isNaN(number) ? null : number;
  42389. }
  42390. [$toHTML](availableSpace) {
  42391. return valueToHtml(this[$content] !== null ? this[$content].toString() : "");
  42392. }
  42393. }
  42394. class Issuers extends XFAObject {
  42395. constructor(attributes) {
  42396. super(TEMPLATE_NS_ID, "issuers", true);
  42397. this.id = attributes.id || "";
  42398. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42399. this.use = attributes.use || "";
  42400. this.usehref = attributes.usehref || "";
  42401. this.certificate = new XFAObjectArray();
  42402. }
  42403. }
  42404. class Items extends XFAObject {
  42405. constructor(attributes) {
  42406. super(TEMPLATE_NS_ID, "items", true);
  42407. this.id = attributes.id || "";
  42408. this.name = attributes.name || "";
  42409. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  42410. this.ref = attributes.ref || "";
  42411. this.save = getInteger({
  42412. data: attributes.save,
  42413. defaultValue: 0,
  42414. validate: x => x === 1
  42415. });
  42416. this.use = attributes.use || "";
  42417. this.usehref = attributes.usehref || "";
  42418. this.boolean = new XFAObjectArray();
  42419. this.date = new XFAObjectArray();
  42420. this.dateTime = new XFAObjectArray();
  42421. this.decimal = new XFAObjectArray();
  42422. this.exData = new XFAObjectArray();
  42423. this.float = new XFAObjectArray();
  42424. this.image = new XFAObjectArray();
  42425. this.integer = new XFAObjectArray();
  42426. this.text = new XFAObjectArray();
  42427. this.time = new XFAObjectArray();
  42428. }
  42429. [$toHTML]() {
  42430. const output = [];
  42431. for (const child of this[$getChildren]()) {
  42432. output.push(child[$text]());
  42433. }
  42434. return HTMLResult.success(output);
  42435. }
  42436. }
  42437. class Keep extends XFAObject {
  42438. constructor(attributes) {
  42439. super(TEMPLATE_NS_ID, "keep", true);
  42440. this.id = attributes.id || "";
  42441. const options = ["none", "contentArea", "pageArea"];
  42442. this.intact = getStringOption(attributes.intact, options);
  42443. this.next = getStringOption(attributes.next, options);
  42444. this.previous = getStringOption(attributes.previous, options);
  42445. this.use = attributes.use || "";
  42446. this.usehref = attributes.usehref || "";
  42447. this.extras = null;
  42448. }
  42449. }
  42450. class KeyUsage extends XFAObject {
  42451. constructor(attributes) {
  42452. super(TEMPLATE_NS_ID, "keyUsage");
  42453. const options = ["", "yes", "no"];
  42454. this.crlSign = getStringOption(attributes.crlSign, options);
  42455. this.dataEncipherment = getStringOption(attributes.dataEncipherment, options);
  42456. this.decipherOnly = getStringOption(attributes.decipherOnly, options);
  42457. this.digitalSignature = getStringOption(attributes.digitalSignature, options);
  42458. this.encipherOnly = getStringOption(attributes.encipherOnly, options);
  42459. this.id = attributes.id || "";
  42460. this.keyAgreement = getStringOption(attributes.keyAgreement, options);
  42461. this.keyCertSign = getStringOption(attributes.keyCertSign, options);
  42462. this.keyEncipherment = getStringOption(attributes.keyEncipherment, options);
  42463. this.nonRepudiation = getStringOption(attributes.nonRepudiation, options);
  42464. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42465. this.use = attributes.use || "";
  42466. this.usehref = attributes.usehref || "";
  42467. }
  42468. }
  42469. class Line extends XFAObject {
  42470. constructor(attributes) {
  42471. super(TEMPLATE_NS_ID, "line", true);
  42472. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  42473. this.id = attributes.id || "";
  42474. this.slope = getStringOption(attributes.slope, ["\\", "/"]);
  42475. this.use = attributes.use || "";
  42476. this.usehref = attributes.usehref || "";
  42477. this.edge = null;
  42478. }
  42479. [$toHTML]() {
  42480. const parent = this[$getParent]()[$getParent]();
  42481. const edge = this.edge || new Edge({});
  42482. const edgeStyle = edge[$toStyle]();
  42483. const style = Object.create(null);
  42484. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  42485. style.strokeWidth = measureToString(thickness);
  42486. style.stroke = edgeStyle.color;
  42487. let x1, y1, x2, y2;
  42488. let width = "100%";
  42489. let height = "100%";
  42490. if (parent.w <= thickness) {
  42491. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  42492. width = style.strokeWidth;
  42493. } else if (parent.h <= thickness) {
  42494. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  42495. height = style.strokeWidth;
  42496. } else if (this.slope === "\\") {
  42497. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  42498. } else {
  42499. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  42500. }
  42501. const line = {
  42502. name: "line",
  42503. attributes: {
  42504. xmlns: SVG_NS,
  42505. x1,
  42506. y1,
  42507. x2,
  42508. y2,
  42509. style
  42510. }
  42511. };
  42512. const svg = {
  42513. name: "svg",
  42514. children: [line],
  42515. attributes: {
  42516. xmlns: SVG_NS,
  42517. width,
  42518. height,
  42519. style: {
  42520. overflow: "visible"
  42521. }
  42522. }
  42523. };
  42524. if (hasMargin(parent)) {
  42525. return HTMLResult.success({
  42526. name: "div",
  42527. attributes: {
  42528. style: {
  42529. display: "inline",
  42530. width: "100%",
  42531. height: "100%"
  42532. }
  42533. },
  42534. children: [svg]
  42535. });
  42536. }
  42537. svg.attributes.style.position = "absolute";
  42538. return HTMLResult.success(svg);
  42539. }
  42540. }
  42541. class Linear extends XFAObject {
  42542. constructor(attributes) {
  42543. super(TEMPLATE_NS_ID, "linear", true);
  42544. this.id = attributes.id || "";
  42545. this.type = getStringOption(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  42546. this.use = attributes.use || "";
  42547. this.usehref = attributes.usehref || "";
  42548. this.color = null;
  42549. this.extras = null;
  42550. }
  42551. [$toStyle](startColor) {
  42552. startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
  42553. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  42554. const endColor = this.color ? this.color[$toStyle]() : "#000000";
  42555. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  42556. }
  42557. }
  42558. class LockDocument extends ContentObject {
  42559. constructor(attributes) {
  42560. super(TEMPLATE_NS_ID, "lockDocument");
  42561. this.id = attributes.id || "";
  42562. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42563. this.use = attributes.use || "";
  42564. this.usehref = attributes.usehref || "";
  42565. }
  42566. [$finalize]() {
  42567. this[$content] = getStringOption(this[$content], ["auto", "0", "1"]);
  42568. }
  42569. }
  42570. class Manifest extends XFAObject {
  42571. constructor(attributes) {
  42572. super(TEMPLATE_NS_ID, "manifest", true);
  42573. this.action = getStringOption(attributes.action, ["include", "all", "exclude"]);
  42574. this.id = attributes.id || "";
  42575. this.name = attributes.name || "";
  42576. this.use = attributes.use || "";
  42577. this.usehref = attributes.usehref || "";
  42578. this.extras = null;
  42579. this.ref = new XFAObjectArray();
  42580. }
  42581. }
  42582. class Margin extends XFAObject {
  42583. constructor(attributes) {
  42584. super(TEMPLATE_NS_ID, "margin", true);
  42585. this.bottomInset = getMeasurement(attributes.bottomInset, "0");
  42586. this.id = attributes.id || "";
  42587. this.leftInset = getMeasurement(attributes.leftInset, "0");
  42588. this.rightInset = getMeasurement(attributes.rightInset, "0");
  42589. this.topInset = getMeasurement(attributes.topInset, "0");
  42590. this.use = attributes.use || "";
  42591. this.usehref = attributes.usehref || "";
  42592. this.extras = null;
  42593. }
  42594. [$toStyle]() {
  42595. return {
  42596. margin: measureToString(this.topInset) + " " + measureToString(this.rightInset) + " " + measureToString(this.bottomInset) + " " + measureToString(this.leftInset)
  42597. };
  42598. }
  42599. }
  42600. class Mdp extends XFAObject {
  42601. constructor(attributes) {
  42602. super(TEMPLATE_NS_ID, "mdp");
  42603. this.id = attributes.id || "";
  42604. this.permissions = getInteger({
  42605. data: attributes.permissions,
  42606. defaultValue: 2,
  42607. validate: x => x === 1 || x === 3
  42608. });
  42609. this.signatureType = getStringOption(attributes.signatureType, ["filler", "author"]);
  42610. this.use = attributes.use || "";
  42611. this.usehref = attributes.usehref || "";
  42612. }
  42613. }
  42614. class Medium extends XFAObject {
  42615. constructor(attributes) {
  42616. super(TEMPLATE_NS_ID, "medium");
  42617. this.id = attributes.id || "";
  42618. this.imagingBBox = getBBox(attributes.imagingBBox);
  42619. this.long = getMeasurement(attributes.long);
  42620. this.orientation = getStringOption(attributes.orientation, ["portrait", "landscape"]);
  42621. this.short = getMeasurement(attributes.short);
  42622. this.stock = attributes.stock || "";
  42623. this.trayIn = getStringOption(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  42624. this.trayOut = getStringOption(attributes.trayOut, ["auto", "delegate"]);
  42625. this.use = attributes.use || "";
  42626. this.usehref = attributes.usehref || "";
  42627. }
  42628. }
  42629. class Message extends XFAObject {
  42630. constructor(attributes) {
  42631. super(TEMPLATE_NS_ID, "message", true);
  42632. this.id = attributes.id || "";
  42633. this.use = attributes.use || "";
  42634. this.usehref = attributes.usehref || "";
  42635. this.text = new XFAObjectArray();
  42636. }
  42637. }
  42638. class NumericEdit extends XFAObject {
  42639. constructor(attributes) {
  42640. super(TEMPLATE_NS_ID, "numericEdit", true);
  42641. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  42642. this.id = attributes.id || "";
  42643. this.use = attributes.use || "";
  42644. this.usehref = attributes.usehref || "";
  42645. this.border = null;
  42646. this.comb = null;
  42647. this.extras = null;
  42648. this.margin = null;
  42649. }
  42650. [$toHTML](availableSpace) {
  42651. const style = toStyle(this, "border", "font", "margin");
  42652. const field = this[$getParent]()[$getParent]();
  42653. const html = {
  42654. name: "input",
  42655. attributes: {
  42656. type: "text",
  42657. fieldId: field[$uid],
  42658. dataId: field[$data]?.[$uid] || field[$uid],
  42659. class: ["xfaTextfield"],
  42660. style,
  42661. "aria-label": ariaLabel(field),
  42662. "aria-required": false
  42663. }
  42664. };
  42665. if (isRequired(field)) {
  42666. html.attributes["aria-required"] = true;
  42667. html.attributes.required = true;
  42668. }
  42669. return HTMLResult.success({
  42670. name: "label",
  42671. attributes: {
  42672. class: ["xfaLabel"]
  42673. },
  42674. children: [html]
  42675. });
  42676. }
  42677. }
  42678. class Occur extends XFAObject {
  42679. constructor(attributes) {
  42680. super(TEMPLATE_NS_ID, "occur", true);
  42681. this.id = attributes.id || "";
  42682. this.initial = attributes.initial !== "" ? getInteger({
  42683. data: attributes.initial,
  42684. defaultValue: "",
  42685. validate: x => true
  42686. }) : "";
  42687. this.max = attributes.max !== "" ? getInteger({
  42688. data: attributes.max,
  42689. defaultValue: 1,
  42690. validate: x => true
  42691. }) : "";
  42692. this.min = attributes.min !== "" ? getInteger({
  42693. data: attributes.min,
  42694. defaultValue: 1,
  42695. validate: x => true
  42696. }) : "";
  42697. this.use = attributes.use || "";
  42698. this.usehref = attributes.usehref || "";
  42699. this.extras = null;
  42700. }
  42701. [$clean]() {
  42702. const parent = this[$getParent]();
  42703. const originalMin = this.min;
  42704. if (this.min === "") {
  42705. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  42706. }
  42707. if (this.max === "") {
  42708. if (originalMin === "") {
  42709. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  42710. } else {
  42711. this.max = this.min;
  42712. }
  42713. }
  42714. if (this.max !== -1 && this.max < this.min) {
  42715. this.max = this.min;
  42716. }
  42717. if (this.initial === "") {
  42718. this.initial = parent instanceof Template ? 1 : this.min;
  42719. }
  42720. }
  42721. }
  42722. class Oid extends StringObject {
  42723. constructor(attributes) {
  42724. super(TEMPLATE_NS_ID, "oid");
  42725. this.id = attributes.id || "";
  42726. this.name = attributes.name || "";
  42727. this.use = attributes.use || "";
  42728. this.usehref = attributes.usehref || "";
  42729. }
  42730. }
  42731. class Oids extends XFAObject {
  42732. constructor(attributes) {
  42733. super(TEMPLATE_NS_ID, "oids", true);
  42734. this.id = attributes.id || "";
  42735. this.type = getStringOption(attributes.type, ["optional", "required"]);
  42736. this.use = attributes.use || "";
  42737. this.usehref = attributes.usehref || "";
  42738. this.oid = new XFAObjectArray();
  42739. }
  42740. }
  42741. class Overflow extends XFAObject {
  42742. constructor(attributes) {
  42743. super(TEMPLATE_NS_ID, "overflow");
  42744. this.id = attributes.id || "";
  42745. this.leader = attributes.leader || "";
  42746. this.target = attributes.target || "";
  42747. this.trailer = attributes.trailer || "";
  42748. this.use = attributes.use || "";
  42749. this.usehref = attributes.usehref || "";
  42750. }
  42751. [$getExtra]() {
  42752. if (!this[$extra]) {
  42753. const parent = this[$getParent]();
  42754. const root = this[$getTemplateRoot]();
  42755. const target = root[$searchNode](this.target, parent);
  42756. const leader = root[$searchNode](this.leader, parent);
  42757. const trailer = root[$searchNode](this.trailer, parent);
  42758. this[$extra] = {
  42759. target: target?.[0] || null,
  42760. leader: leader?.[0] || null,
  42761. trailer: trailer?.[0] || null,
  42762. addLeader: false,
  42763. addTrailer: false
  42764. };
  42765. }
  42766. return this[$extra];
  42767. }
  42768. }
  42769. class PageArea extends XFAObject {
  42770. constructor(attributes) {
  42771. super(TEMPLATE_NS_ID, "pageArea", true);
  42772. this.blankOrNotBlank = getStringOption(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  42773. this.id = attributes.id || "";
  42774. this.initialNumber = getInteger({
  42775. data: attributes.initialNumber,
  42776. defaultValue: 1,
  42777. validate: x => true
  42778. });
  42779. this.name = attributes.name || "";
  42780. this.numbered = getInteger({
  42781. data: attributes.numbered,
  42782. defaultValue: 1,
  42783. validate: x => true
  42784. });
  42785. this.oddOrEven = getStringOption(attributes.oddOrEven, ["any", "even", "odd"]);
  42786. this.pagePosition = getStringOption(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  42787. this.relevant = getRelevant(attributes.relevant);
  42788. this.use = attributes.use || "";
  42789. this.usehref = attributes.usehref || "";
  42790. this.desc = null;
  42791. this.extras = null;
  42792. this.medium = null;
  42793. this.occur = null;
  42794. this.area = new XFAObjectArray();
  42795. this.contentArea = new XFAObjectArray();
  42796. this.draw = new XFAObjectArray();
  42797. this.exclGroup = new XFAObjectArray();
  42798. this.field = new XFAObjectArray();
  42799. this.subform = new XFAObjectArray();
  42800. }
  42801. [$isUsable]() {
  42802. if (!this[$extra]) {
  42803. this[$extra] = {
  42804. numberOfUse: 0
  42805. };
  42806. return true;
  42807. }
  42808. return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
  42809. }
  42810. [$cleanPage]() {
  42811. delete this[$extra];
  42812. }
  42813. [$getNextPage]() {
  42814. if (!this[$extra]) {
  42815. this[$extra] = {
  42816. numberOfUse: 0
  42817. };
  42818. }
  42819. const parent = this[$getParent]();
  42820. if (parent.relation === "orderedOccurrence") {
  42821. if (this[$isUsable]()) {
  42822. this[$extra].numberOfUse += 1;
  42823. return this;
  42824. }
  42825. }
  42826. return parent[$getNextPage]();
  42827. }
  42828. [$getAvailableSpace]() {
  42829. return this[$extra].space || {
  42830. width: 0,
  42831. height: 0
  42832. };
  42833. }
  42834. [$toHTML]() {
  42835. if (!this[$extra]) {
  42836. this[$extra] = {
  42837. numberOfUse: 1
  42838. };
  42839. }
  42840. const children = [];
  42841. this[$extra].children = children;
  42842. const style = Object.create(null);
  42843. if (this.medium && this.medium.short && this.medium.long) {
  42844. style.width = measureToString(this.medium.short);
  42845. style.height = measureToString(this.medium.long);
  42846. this[$extra].space = {
  42847. width: this.medium.short,
  42848. height: this.medium.long
  42849. };
  42850. if (this.medium.orientation === "landscape") {
  42851. const x = style.width;
  42852. style.width = style.height;
  42853. style.height = x;
  42854. this[$extra].space = {
  42855. width: this.medium.long,
  42856. height: this.medium.short
  42857. };
  42858. }
  42859. } else {
  42860. warn("XFA - No medium specified in pageArea: please file a bug.");
  42861. }
  42862. this[$childrenToHTML]({
  42863. filter: new Set(["area", "draw", "field", "subform"]),
  42864. include: true
  42865. });
  42866. this[$childrenToHTML]({
  42867. filter: new Set(["contentArea"]),
  42868. include: true
  42869. });
  42870. return HTMLResult.success({
  42871. name: "div",
  42872. children,
  42873. attributes: {
  42874. class: ["xfaPage"],
  42875. id: this[$uid],
  42876. style,
  42877. xfaName: this.name
  42878. }
  42879. });
  42880. }
  42881. }
  42882. class PageSet extends XFAObject {
  42883. constructor(attributes) {
  42884. super(TEMPLATE_NS_ID, "pageSet", true);
  42885. this.duplexImposition = getStringOption(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  42886. this.id = attributes.id || "";
  42887. this.name = attributes.name || "";
  42888. this.relation = getStringOption(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  42889. this.relevant = getRelevant(attributes.relevant);
  42890. this.use = attributes.use || "";
  42891. this.usehref = attributes.usehref || "";
  42892. this.extras = null;
  42893. this.occur = null;
  42894. this.pageArea = new XFAObjectArray();
  42895. this.pageSet = new XFAObjectArray();
  42896. }
  42897. [$cleanPage]() {
  42898. for (const page of this.pageArea.children) {
  42899. page[$cleanPage]();
  42900. }
  42901. for (const page of this.pageSet.children) {
  42902. page[$cleanPage]();
  42903. }
  42904. }
  42905. [$isUsable]() {
  42906. return !this.occur || this.occur.max === -1 || this[$extra].numberOfUse < this.occur.max;
  42907. }
  42908. [$getNextPage]() {
  42909. if (!this[$extra]) {
  42910. this[$extra] = {
  42911. numberOfUse: 1,
  42912. pageIndex: -1,
  42913. pageSetIndex: -1
  42914. };
  42915. }
  42916. if (this.relation === "orderedOccurrence") {
  42917. if (this[$extra].pageIndex + 1 < this.pageArea.children.length) {
  42918. this[$extra].pageIndex += 1;
  42919. const pageArea = this.pageArea.children[this[$extra].pageIndex];
  42920. return pageArea[$getNextPage]();
  42921. }
  42922. if (this[$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  42923. this[$extra].pageSetIndex += 1;
  42924. return this.pageSet.children[this[$extra].pageSetIndex][$getNextPage]();
  42925. }
  42926. if (this[$isUsable]()) {
  42927. this[$extra].numberOfUse += 1;
  42928. this[$extra].pageIndex = -1;
  42929. this[$extra].pageSetIndex = -1;
  42930. return this[$getNextPage]();
  42931. }
  42932. const parent = this[$getParent]();
  42933. if (parent instanceof PageSet) {
  42934. return parent[$getNextPage]();
  42935. }
  42936. this[$cleanPage]();
  42937. return this[$getNextPage]();
  42938. }
  42939. const pageNumber = this[$getTemplateRoot]()[$extra].pageNumber;
  42940. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  42941. const position = pageNumber === 0 ? "first" : "rest";
  42942. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  42943. if (page) {
  42944. return page;
  42945. }
  42946. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  42947. if (page) {
  42948. return page;
  42949. }
  42950. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  42951. if (page) {
  42952. return page;
  42953. }
  42954. return this.pageArea.children[0];
  42955. }
  42956. }
  42957. class Para extends XFAObject {
  42958. constructor(attributes) {
  42959. super(TEMPLATE_NS_ID, "para", true);
  42960. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  42961. this.id = attributes.id || "";
  42962. this.lineHeight = attributes.lineHeight ? getMeasurement(attributes.lineHeight, "0pt") : "";
  42963. this.marginLeft = attributes.marginLeft ? getMeasurement(attributes.marginLeft, "0pt") : "";
  42964. this.marginRight = attributes.marginRight ? getMeasurement(attributes.marginRight, "0pt") : "";
  42965. this.orphans = getInteger({
  42966. data: attributes.orphans,
  42967. defaultValue: 0,
  42968. validate: x => x >= 0
  42969. });
  42970. this.preserve = attributes.preserve || "";
  42971. this.radixOffset = attributes.radixOffset ? getMeasurement(attributes.radixOffset, "0pt") : "";
  42972. this.spaceAbove = attributes.spaceAbove ? getMeasurement(attributes.spaceAbove, "0pt") : "";
  42973. this.spaceBelow = attributes.spaceBelow ? getMeasurement(attributes.spaceBelow, "0pt") : "";
  42974. this.tabDefault = attributes.tabDefault ? getMeasurement(this.tabDefault) : "";
  42975. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? getMeasurement(x) : x);
  42976. this.textIndent = attributes.textIndent ? getMeasurement(attributes.textIndent, "0pt") : "";
  42977. this.use = attributes.use || "";
  42978. this.usehref = attributes.usehref || "";
  42979. this.vAlign = getStringOption(attributes.vAlign, ["top", "bottom", "middle"]);
  42980. this.widows = getInteger({
  42981. data: attributes.widows,
  42982. defaultValue: 0,
  42983. validate: x => x >= 0
  42984. });
  42985. this.hyphenation = null;
  42986. }
  42987. [$toStyle]() {
  42988. const style = toStyle(this, "hAlign");
  42989. if (this.marginLeft !== "") {
  42990. style.paddingLeft = measureToString(this.marginLeft);
  42991. }
  42992. if (this.marginRight !== "") {
  42993. style.paddingRight = measureToString(this.marginRight);
  42994. }
  42995. if (this.spaceAbove !== "") {
  42996. style.paddingTop = measureToString(this.spaceAbove);
  42997. }
  42998. if (this.spaceBelow !== "") {
  42999. style.paddingBottom = measureToString(this.spaceBelow);
  43000. }
  43001. if (this.textIndent !== "") {
  43002. style.textIndent = measureToString(this.textIndent);
  43003. fixTextIndent(style);
  43004. }
  43005. if (this.lineHeight > 0) {
  43006. style.lineHeight = measureToString(this.lineHeight);
  43007. }
  43008. if (this.tabDefault !== "") {
  43009. style.tabSize = measureToString(this.tabDefault);
  43010. }
  43011. if (this.tabStops.length > 0) {}
  43012. if (this.hyphenatation) {
  43013. Object.assign(style, this.hyphenatation[$toStyle]());
  43014. }
  43015. return style;
  43016. }
  43017. }
  43018. class PasswordEdit extends XFAObject {
  43019. constructor(attributes) {
  43020. super(TEMPLATE_NS_ID, "passwordEdit", true);
  43021. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  43022. this.id = attributes.id || "";
  43023. this.passwordChar = attributes.passwordChar || "*";
  43024. this.use = attributes.use || "";
  43025. this.usehref = attributes.usehref || "";
  43026. this.border = null;
  43027. this.extras = null;
  43028. this.margin = null;
  43029. }
  43030. }
  43031. class template_Pattern extends XFAObject {
  43032. constructor(attributes) {
  43033. super(TEMPLATE_NS_ID, "pattern", true);
  43034. this.id = attributes.id || "";
  43035. this.type = getStringOption(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  43036. this.use = attributes.use || "";
  43037. this.usehref = attributes.usehref || "";
  43038. this.color = null;
  43039. this.extras = null;
  43040. }
  43041. [$toStyle](startColor) {
  43042. startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
  43043. const endColor = this.color ? this.color[$toStyle]() : "#000000";
  43044. const width = 5;
  43045. const cmd = "repeating-linear-gradient";
  43046. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  43047. switch (this.type) {
  43048. case "crossHatch":
  43049. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  43050. case "crossDiagonal":
  43051. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  43052. case "diagonalLeft":
  43053. return `${cmd}(45deg,${colors})`;
  43054. case "diagonalRight":
  43055. return `${cmd}(-45deg,${colors})`;
  43056. case "horizontal":
  43057. return `${cmd}(to top,${colors})`;
  43058. case "vertical":
  43059. return `${cmd}(to right,${colors})`;
  43060. }
  43061. return "";
  43062. }
  43063. }
  43064. class Picture extends StringObject {
  43065. constructor(attributes) {
  43066. super(TEMPLATE_NS_ID, "picture");
  43067. this.id = attributes.id || "";
  43068. this.use = attributes.use || "";
  43069. this.usehref = attributes.usehref || "";
  43070. }
  43071. }
  43072. class Proto extends XFAObject {
  43073. constructor(attributes) {
  43074. super(TEMPLATE_NS_ID, "proto", true);
  43075. this.appearanceFilter = new XFAObjectArray();
  43076. this.arc = new XFAObjectArray();
  43077. this.area = new XFAObjectArray();
  43078. this.assist = new XFAObjectArray();
  43079. this.barcode = new XFAObjectArray();
  43080. this.bindItems = new XFAObjectArray();
  43081. this.bookend = new XFAObjectArray();
  43082. this.boolean = new XFAObjectArray();
  43083. this.border = new XFAObjectArray();
  43084. this.break = new XFAObjectArray();
  43085. this.breakAfter = new XFAObjectArray();
  43086. this.breakBefore = new XFAObjectArray();
  43087. this.button = new XFAObjectArray();
  43088. this.calculate = new XFAObjectArray();
  43089. this.caption = new XFAObjectArray();
  43090. this.certificate = new XFAObjectArray();
  43091. this.certificates = new XFAObjectArray();
  43092. this.checkButton = new XFAObjectArray();
  43093. this.choiceList = new XFAObjectArray();
  43094. this.color = new XFAObjectArray();
  43095. this.comb = new XFAObjectArray();
  43096. this.connect = new XFAObjectArray();
  43097. this.contentArea = new XFAObjectArray();
  43098. this.corner = new XFAObjectArray();
  43099. this.date = new XFAObjectArray();
  43100. this.dateTime = new XFAObjectArray();
  43101. this.dateTimeEdit = new XFAObjectArray();
  43102. this.decimal = new XFAObjectArray();
  43103. this.defaultUi = new XFAObjectArray();
  43104. this.desc = new XFAObjectArray();
  43105. this.digestMethod = new XFAObjectArray();
  43106. this.digestMethods = new XFAObjectArray();
  43107. this.draw = new XFAObjectArray();
  43108. this.edge = new XFAObjectArray();
  43109. this.encoding = new XFAObjectArray();
  43110. this.encodings = new XFAObjectArray();
  43111. this.encrypt = new XFAObjectArray();
  43112. this.encryptData = new XFAObjectArray();
  43113. this.encryption = new XFAObjectArray();
  43114. this.encryptionMethod = new XFAObjectArray();
  43115. this.encryptionMethods = new XFAObjectArray();
  43116. this.event = new XFAObjectArray();
  43117. this.exData = new XFAObjectArray();
  43118. this.exObject = new XFAObjectArray();
  43119. this.exclGroup = new XFAObjectArray();
  43120. this.execute = new XFAObjectArray();
  43121. this.extras = new XFAObjectArray();
  43122. this.field = new XFAObjectArray();
  43123. this.fill = new XFAObjectArray();
  43124. this.filter = new XFAObjectArray();
  43125. this.float = new XFAObjectArray();
  43126. this.font = new XFAObjectArray();
  43127. this.format = new XFAObjectArray();
  43128. this.handler = new XFAObjectArray();
  43129. this.hyphenation = new XFAObjectArray();
  43130. this.image = new XFAObjectArray();
  43131. this.imageEdit = new XFAObjectArray();
  43132. this.integer = new XFAObjectArray();
  43133. this.issuers = new XFAObjectArray();
  43134. this.items = new XFAObjectArray();
  43135. this.keep = new XFAObjectArray();
  43136. this.keyUsage = new XFAObjectArray();
  43137. this.line = new XFAObjectArray();
  43138. this.linear = new XFAObjectArray();
  43139. this.lockDocument = new XFAObjectArray();
  43140. this.manifest = new XFAObjectArray();
  43141. this.margin = new XFAObjectArray();
  43142. this.mdp = new XFAObjectArray();
  43143. this.medium = new XFAObjectArray();
  43144. this.message = new XFAObjectArray();
  43145. this.numericEdit = new XFAObjectArray();
  43146. this.occur = new XFAObjectArray();
  43147. this.oid = new XFAObjectArray();
  43148. this.oids = new XFAObjectArray();
  43149. this.overflow = new XFAObjectArray();
  43150. this.pageArea = new XFAObjectArray();
  43151. this.pageSet = new XFAObjectArray();
  43152. this.para = new XFAObjectArray();
  43153. this.passwordEdit = new XFAObjectArray();
  43154. this.pattern = new XFAObjectArray();
  43155. this.picture = new XFAObjectArray();
  43156. this.radial = new XFAObjectArray();
  43157. this.reason = new XFAObjectArray();
  43158. this.reasons = new XFAObjectArray();
  43159. this.rectangle = new XFAObjectArray();
  43160. this.ref = new XFAObjectArray();
  43161. this.script = new XFAObjectArray();
  43162. this.setProperty = new XFAObjectArray();
  43163. this.signData = new XFAObjectArray();
  43164. this.signature = new XFAObjectArray();
  43165. this.signing = new XFAObjectArray();
  43166. this.solid = new XFAObjectArray();
  43167. this.speak = new XFAObjectArray();
  43168. this.stipple = new XFAObjectArray();
  43169. this.subform = new XFAObjectArray();
  43170. this.subformSet = new XFAObjectArray();
  43171. this.subjectDN = new XFAObjectArray();
  43172. this.subjectDNs = new XFAObjectArray();
  43173. this.submit = new XFAObjectArray();
  43174. this.text = new XFAObjectArray();
  43175. this.textEdit = new XFAObjectArray();
  43176. this.time = new XFAObjectArray();
  43177. this.timeStamp = new XFAObjectArray();
  43178. this.toolTip = new XFAObjectArray();
  43179. this.traversal = new XFAObjectArray();
  43180. this.traverse = new XFAObjectArray();
  43181. this.ui = new XFAObjectArray();
  43182. this.validate = new XFAObjectArray();
  43183. this.value = new XFAObjectArray();
  43184. this.variables = new XFAObjectArray();
  43185. }
  43186. }
  43187. class Radial extends XFAObject {
  43188. constructor(attributes) {
  43189. super(TEMPLATE_NS_ID, "radial", true);
  43190. this.id = attributes.id || "";
  43191. this.type = getStringOption(attributes.type, ["toEdge", "toCenter"]);
  43192. this.use = attributes.use || "";
  43193. this.usehref = attributes.usehref || "";
  43194. this.color = null;
  43195. this.extras = null;
  43196. }
  43197. [$toStyle](startColor) {
  43198. startColor = startColor ? startColor[$toStyle]() : "#FFFFFF";
  43199. const endColor = this.color ? this.color[$toStyle]() : "#000000";
  43200. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  43201. return `radial-gradient(circle at center, ${colors})`;
  43202. }
  43203. }
  43204. class Reason extends StringObject {
  43205. constructor(attributes) {
  43206. super(TEMPLATE_NS_ID, "reason");
  43207. this.id = attributes.id || "";
  43208. this.name = attributes.name || "";
  43209. this.use = attributes.use || "";
  43210. this.usehref = attributes.usehref || "";
  43211. }
  43212. }
  43213. class Reasons extends XFAObject {
  43214. constructor(attributes) {
  43215. super(TEMPLATE_NS_ID, "reasons", true);
  43216. this.id = attributes.id || "";
  43217. this.type = getStringOption(attributes.type, ["optional", "required"]);
  43218. this.use = attributes.use || "";
  43219. this.usehref = attributes.usehref || "";
  43220. this.reason = new XFAObjectArray();
  43221. }
  43222. }
  43223. class Rectangle extends XFAObject {
  43224. constructor(attributes) {
  43225. super(TEMPLATE_NS_ID, "rectangle", true);
  43226. this.hand = getStringOption(attributes.hand, ["even", "left", "right"]);
  43227. this.id = attributes.id || "";
  43228. this.use = attributes.use || "";
  43229. this.usehref = attributes.usehref || "";
  43230. this.corner = new XFAObjectArray(4);
  43231. this.edge = new XFAObjectArray(4);
  43232. this.fill = null;
  43233. }
  43234. [$toHTML]() {
  43235. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  43236. const edgeStyle = edge[$toStyle]();
  43237. const style = Object.create(null);
  43238. if (this.fill?.presence === "visible") {
  43239. Object.assign(style, this.fill[$toStyle]());
  43240. } else {
  43241. style.fill = "transparent";
  43242. }
  43243. style.strokeWidth = measureToString(edge.presence === "visible" ? edge.thickness : 0);
  43244. style.stroke = edgeStyle.color;
  43245. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  43246. const cornerStyle = corner[$toStyle]();
  43247. const rect = {
  43248. name: "rect",
  43249. attributes: {
  43250. xmlns: SVG_NS,
  43251. width: "100%",
  43252. height: "100%",
  43253. x: 0,
  43254. y: 0,
  43255. rx: cornerStyle.radius,
  43256. ry: cornerStyle.radius,
  43257. style
  43258. }
  43259. };
  43260. const svg = {
  43261. name: "svg",
  43262. children: [rect],
  43263. attributes: {
  43264. xmlns: SVG_NS,
  43265. style: {
  43266. overflow: "visible"
  43267. },
  43268. width: "100%",
  43269. height: "100%"
  43270. }
  43271. };
  43272. const parent = this[$getParent]()[$getParent]();
  43273. if (hasMargin(parent)) {
  43274. return HTMLResult.success({
  43275. name: "div",
  43276. attributes: {
  43277. style: {
  43278. display: "inline",
  43279. width: "100%",
  43280. height: "100%"
  43281. }
  43282. },
  43283. children: [svg]
  43284. });
  43285. }
  43286. svg.attributes.style.position = "absolute";
  43287. return HTMLResult.success(svg);
  43288. }
  43289. }
  43290. class RefElement extends StringObject {
  43291. constructor(attributes) {
  43292. super(TEMPLATE_NS_ID, "ref");
  43293. this.id = attributes.id || "";
  43294. this.use = attributes.use || "";
  43295. this.usehref = attributes.usehref || "";
  43296. }
  43297. }
  43298. class Script extends StringObject {
  43299. constructor(attributes) {
  43300. super(TEMPLATE_NS_ID, "script");
  43301. this.binding = attributes.binding || "";
  43302. this.contentType = attributes.contentType || "";
  43303. this.id = attributes.id || "";
  43304. this.name = attributes.name || "";
  43305. this.runAt = getStringOption(attributes.runAt, ["client", "both", "server"]);
  43306. this.use = attributes.use || "";
  43307. this.usehref = attributes.usehref || "";
  43308. }
  43309. }
  43310. class SetProperty extends XFAObject {
  43311. constructor(attributes) {
  43312. super(TEMPLATE_NS_ID, "setProperty");
  43313. this.connection = attributes.connection || "";
  43314. this.ref = attributes.ref || "";
  43315. this.target = attributes.target || "";
  43316. }
  43317. }
  43318. class SignData extends XFAObject {
  43319. constructor(attributes) {
  43320. super(TEMPLATE_NS_ID, "signData", true);
  43321. this.id = attributes.id || "";
  43322. this.operation = getStringOption(attributes.operation, ["sign", "clear", "verify"]);
  43323. this.ref = attributes.ref || "";
  43324. this.target = attributes.target || "";
  43325. this.use = attributes.use || "";
  43326. this.usehref = attributes.usehref || "";
  43327. this.filter = null;
  43328. this.manifest = null;
  43329. }
  43330. }
  43331. class Signature extends XFAObject {
  43332. constructor(attributes) {
  43333. super(TEMPLATE_NS_ID, "signature", true);
  43334. this.id = attributes.id || "";
  43335. this.type = getStringOption(attributes.type, ["PDF1.3", "PDF1.6"]);
  43336. this.use = attributes.use || "";
  43337. this.usehref = attributes.usehref || "";
  43338. this.border = null;
  43339. this.extras = null;
  43340. this.filter = null;
  43341. this.manifest = null;
  43342. this.margin = null;
  43343. }
  43344. }
  43345. class Signing extends XFAObject {
  43346. constructor(attributes) {
  43347. super(TEMPLATE_NS_ID, "signing", true);
  43348. this.id = attributes.id || "";
  43349. this.type = getStringOption(attributes.type, ["optional", "required"]);
  43350. this.use = attributes.use || "";
  43351. this.usehref = attributes.usehref || "";
  43352. this.certificate = new XFAObjectArray();
  43353. }
  43354. }
  43355. class Solid extends XFAObject {
  43356. constructor(attributes) {
  43357. super(TEMPLATE_NS_ID, "solid", true);
  43358. this.id = attributes.id || "";
  43359. this.use = attributes.use || "";
  43360. this.usehref = attributes.usehref || "";
  43361. this.extras = null;
  43362. }
  43363. [$toStyle](startColor) {
  43364. return startColor ? startColor[$toStyle]() : "#FFFFFF";
  43365. }
  43366. }
  43367. class Speak extends StringObject {
  43368. constructor(attributes) {
  43369. super(TEMPLATE_NS_ID, "speak");
  43370. this.disable = getInteger({
  43371. data: attributes.disable,
  43372. defaultValue: 0,
  43373. validate: x => x === 1
  43374. });
  43375. this.id = attributes.id || "";
  43376. this.priority = getStringOption(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  43377. this.rid = attributes.rid || "";
  43378. this.use = attributes.use || "";
  43379. this.usehref = attributes.usehref || "";
  43380. }
  43381. }
  43382. class Stipple extends XFAObject {
  43383. constructor(attributes) {
  43384. super(TEMPLATE_NS_ID, "stipple", true);
  43385. this.id = attributes.id || "";
  43386. this.rate = getInteger({
  43387. data: attributes.rate,
  43388. defaultValue: 50,
  43389. validate: x => x >= 0 && x <= 100
  43390. });
  43391. this.use = attributes.use || "";
  43392. this.usehref = attributes.usehref || "";
  43393. this.color = null;
  43394. this.extras = null;
  43395. }
  43396. [$toStyle](bgColor) {
  43397. const alpha = this.rate / 100;
  43398. return Util.makeHexColor(Math.round(bgColor.value.r * (1 - alpha) + this.value.r * alpha), Math.round(bgColor.value.g * (1 - alpha) + this.value.g * alpha), Math.round(bgColor.value.b * (1 - alpha) + this.value.b * alpha));
  43399. }
  43400. }
  43401. class Subform extends XFAObject {
  43402. constructor(attributes) {
  43403. super(TEMPLATE_NS_ID, "subform", true);
  43404. this.access = getStringOption(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  43405. this.allowMacro = getInteger({
  43406. data: attributes.allowMacro,
  43407. defaultValue: 0,
  43408. validate: x => x === 1
  43409. });
  43410. this.anchorType = getStringOption(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  43411. this.colSpan = getInteger({
  43412. data: attributes.colSpan,
  43413. defaultValue: 1,
  43414. validate: n => n >= 1 || n === -1
  43415. });
  43416. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : getMeasurement(x));
  43417. this.h = attributes.h ? getMeasurement(attributes.h) : "";
  43418. this.hAlign = getStringOption(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  43419. this.id = attributes.id || "";
  43420. this.layout = getStringOption(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  43421. this.locale = attributes.locale || "";
  43422. this.maxH = getMeasurement(attributes.maxH, "0pt");
  43423. this.maxW = getMeasurement(attributes.maxW, "0pt");
  43424. this.mergeMode = getStringOption(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  43425. this.minH = getMeasurement(attributes.minH, "0pt");
  43426. this.minW = getMeasurement(attributes.minW, "0pt");
  43427. this.name = attributes.name || "";
  43428. this.presence = getStringOption(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  43429. this.relevant = getRelevant(attributes.relevant);
  43430. this.restoreState = getStringOption(attributes.restoreState, ["manual", "auto"]);
  43431. this.scope = getStringOption(attributes.scope, ["name", "none"]);
  43432. this.use = attributes.use || "";
  43433. this.usehref = attributes.usehref || "";
  43434. this.w = attributes.w ? getMeasurement(attributes.w) : "";
  43435. this.x = getMeasurement(attributes.x, "0pt");
  43436. this.y = getMeasurement(attributes.y, "0pt");
  43437. this.assist = null;
  43438. this.bind = null;
  43439. this.bookend = null;
  43440. this.border = null;
  43441. this.break = null;
  43442. this.calculate = null;
  43443. this.desc = null;
  43444. this.extras = null;
  43445. this.keep = null;
  43446. this.margin = null;
  43447. this.occur = null;
  43448. this.overflow = null;
  43449. this.pageSet = null;
  43450. this.para = null;
  43451. this.traversal = null;
  43452. this.validate = null;
  43453. this.variables = null;
  43454. this.area = new XFAObjectArray();
  43455. this.breakAfter = new XFAObjectArray();
  43456. this.breakBefore = new XFAObjectArray();
  43457. this.connect = new XFAObjectArray();
  43458. this.draw = new XFAObjectArray();
  43459. this.event = new XFAObjectArray();
  43460. this.exObject = new XFAObjectArray();
  43461. this.exclGroup = new XFAObjectArray();
  43462. this.field = new XFAObjectArray();
  43463. this.proto = new XFAObjectArray();
  43464. this.setProperty = new XFAObjectArray();
  43465. this.subform = new XFAObjectArray();
  43466. this.subformSet = new XFAObjectArray();
  43467. }
  43468. [$getSubformParent]() {
  43469. const parent = this[$getParent]();
  43470. if (parent instanceof SubformSet) {
  43471. return parent[$getSubformParent]();
  43472. }
  43473. return parent;
  43474. }
  43475. [$isBindable]() {
  43476. return true;
  43477. }
  43478. [$isThereMoreWidth]() {
  43479. return this.layout.endsWith("-tb") && this[$extra].attempt === 0 && this[$extra].numberInLine > 0 || this[$getParent]()[$isThereMoreWidth]();
  43480. }
  43481. *[$getContainedChildren]() {
  43482. yield* getContainedChildren(this);
  43483. }
  43484. [$flushHTML]() {
  43485. return flushHTML(this);
  43486. }
  43487. [$addHTML](html, bbox) {
  43488. addHTML(this, html, bbox);
  43489. }
  43490. [$getAvailableSpace]() {
  43491. return getAvailableSpace(this);
  43492. }
  43493. [$isSplittable]() {
  43494. const parent = this[$getSubformParent]();
  43495. if (!parent[$isSplittable]()) {
  43496. return false;
  43497. }
  43498. if (this[$extra]._isSplittable !== undefined) {
  43499. return this[$extra]._isSplittable;
  43500. }
  43501. if (this.layout === "position" || this.layout.includes("row")) {
  43502. this[$extra]._isSplittable = false;
  43503. return false;
  43504. }
  43505. if (this.keep && this.keep.intact !== "none") {
  43506. this[$extra]._isSplittable = false;
  43507. return false;
  43508. }
  43509. if (parent.layout?.endsWith("-tb") && parent[$extra].numberInLine !== 0) {
  43510. return false;
  43511. }
  43512. this[$extra]._isSplittable = true;
  43513. return true;
  43514. }
  43515. [$toHTML](availableSpace) {
  43516. setTabIndex(this);
  43517. if (this.break) {
  43518. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  43519. const node = new BreakAfter({
  43520. targetType: this.break.after,
  43521. target: this.break.afterTarget,
  43522. startNew: this.break.startNew.toString()
  43523. });
  43524. node[$globalData] = this[$globalData];
  43525. this[$appendChild](node);
  43526. this.breakAfter.push(node);
  43527. }
  43528. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  43529. const node = new BreakBefore({
  43530. targetType: this.break.before,
  43531. target: this.break.beforeTarget,
  43532. startNew: this.break.startNew.toString()
  43533. });
  43534. node[$globalData] = this[$globalData];
  43535. this[$appendChild](node);
  43536. this.breakBefore.push(node);
  43537. }
  43538. if (this.break.overflowTarget !== "") {
  43539. const node = new Overflow({
  43540. target: this.break.overflowTarget,
  43541. leader: this.break.overflowLeader,
  43542. trailer: this.break.overflowTrailer
  43543. });
  43544. node[$globalData] = this[$globalData];
  43545. this[$appendChild](node);
  43546. this.overflow.push(node);
  43547. }
  43548. this[$removeChild](this.break);
  43549. this.break = null;
  43550. }
  43551. if (this.presence === "hidden" || this.presence === "inactive") {
  43552. return HTMLResult.EMPTY;
  43553. }
  43554. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  43555. warn("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  43556. }
  43557. if (this.breakBefore.children.length >= 1) {
  43558. const breakBefore = this.breakBefore.children[0];
  43559. if (handleBreak(breakBefore)) {
  43560. return HTMLResult.breakNode(breakBefore);
  43561. }
  43562. }
  43563. if (this[$extra]?.afterBreakAfter) {
  43564. return HTMLResult.EMPTY;
  43565. }
  43566. fixDimensions(this);
  43567. const children = [];
  43568. const attributes = {
  43569. id: this[$uid],
  43570. class: []
  43571. };
  43572. setAccess(this, attributes.class);
  43573. if (!this[$extra]) {
  43574. this[$extra] = Object.create(null);
  43575. }
  43576. Object.assign(this[$extra], {
  43577. children,
  43578. line: null,
  43579. attributes,
  43580. attempt: 0,
  43581. numberInLine: 0,
  43582. availableSpace: {
  43583. width: Math.min(this.w || Infinity, availableSpace.width),
  43584. height: Math.min(this.h || Infinity, availableSpace.height)
  43585. },
  43586. width: 0,
  43587. height: 0,
  43588. prevHeight: 0,
  43589. currentWidth: 0
  43590. });
  43591. const root = this[$getTemplateRoot]();
  43592. const savedNoLayoutFailure = root[$extra].noLayoutFailure;
  43593. const isSplittable = this[$isSplittable]();
  43594. if (!isSplittable) {
  43595. setFirstUnsplittable(this);
  43596. }
  43597. if (!checkDimensions(this, availableSpace)) {
  43598. return HTMLResult.FAILURE;
  43599. }
  43600. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  43601. if (this.layout.includes("row")) {
  43602. const columnWidths = this[$getSubformParent]().columnWidths;
  43603. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  43604. this[$extra].columnWidths = columnWidths;
  43605. this[$extra].currentColumn = 0;
  43606. }
  43607. }
  43608. const style = toStyle(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  43609. const classNames = ["xfaSubform"];
  43610. const cl = layoutClass(this);
  43611. if (cl) {
  43612. classNames.push(cl);
  43613. }
  43614. attributes.style = style;
  43615. attributes.class = classNames;
  43616. if (this.name) {
  43617. attributes.xfaName = this.name;
  43618. }
  43619. if (this.overflow) {
  43620. const overflowExtra = this.overflow[$getExtra]();
  43621. if (overflowExtra.addLeader) {
  43622. overflowExtra.addLeader = false;
  43623. handleOverflow(this, overflowExtra.leader, availableSpace);
  43624. }
  43625. }
  43626. this[$pushPara]();
  43627. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  43628. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  43629. for (; this[$extra].attempt < maxRun; this[$extra].attempt++) {
  43630. if (isLrTb && this[$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  43631. this[$extra].numberInLine = 0;
  43632. }
  43633. const result = this[$childrenToHTML]({
  43634. filter,
  43635. include: true
  43636. });
  43637. if (result.success) {
  43638. break;
  43639. }
  43640. if (result.isBreak()) {
  43641. this[$popPara]();
  43642. return result;
  43643. }
  43644. if (isLrTb && this[$extra].attempt === 0 && this[$extra].numberInLine === 0 && !root[$extra].noLayoutFailure) {
  43645. this[$extra].attempt = maxRun;
  43646. break;
  43647. }
  43648. }
  43649. this[$popPara]();
  43650. if (!isSplittable) {
  43651. unsetFirstUnsplittable(this);
  43652. }
  43653. root[$extra].noLayoutFailure = savedNoLayoutFailure;
  43654. if (this[$extra].attempt === maxRun) {
  43655. if (this.overflow) {
  43656. this[$getTemplateRoot]()[$extra].overflowNode = this.overflow;
  43657. }
  43658. if (!isSplittable) {
  43659. delete this[$extra];
  43660. }
  43661. return HTMLResult.FAILURE;
  43662. }
  43663. if (this.overflow) {
  43664. const overflowExtra = this.overflow[$getExtra]();
  43665. if (overflowExtra.addTrailer) {
  43666. overflowExtra.addTrailer = false;
  43667. handleOverflow(this, overflowExtra.trailer, availableSpace);
  43668. }
  43669. }
  43670. let marginH = 0;
  43671. let marginV = 0;
  43672. if (this.margin) {
  43673. marginH = this.margin.leftInset + this.margin.rightInset;
  43674. marginV = this.margin.topInset + this.margin.bottomInset;
  43675. }
  43676. const width = Math.max(this[$extra].width + marginH, this.w || 0);
  43677. const height = Math.max(this[$extra].height + marginV, this.h || 0);
  43678. const bbox = [this.x, this.y, width, height];
  43679. if (this.w === "") {
  43680. style.width = measureToString(width);
  43681. }
  43682. if (this.h === "") {
  43683. style.height = measureToString(height);
  43684. }
  43685. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  43686. return HTMLResult.EMPTY;
  43687. }
  43688. const html = {
  43689. name: "div",
  43690. attributes,
  43691. children
  43692. };
  43693. applyAssist(this, attributes);
  43694. const result = HTMLResult.success(createWrapper(this, html), bbox);
  43695. if (this.breakAfter.children.length >= 1) {
  43696. const breakAfter = this.breakAfter.children[0];
  43697. if (handleBreak(breakAfter)) {
  43698. this[$extra].afterBreakAfter = result;
  43699. return HTMLResult.breakNode(breakAfter);
  43700. }
  43701. }
  43702. delete this[$extra];
  43703. return result;
  43704. }
  43705. }
  43706. class SubformSet extends XFAObject {
  43707. constructor(attributes) {
  43708. super(TEMPLATE_NS_ID, "subformSet", true);
  43709. this.id = attributes.id || "";
  43710. this.name = attributes.name || "";
  43711. this.relation = getStringOption(attributes.relation, ["ordered", "choice", "unordered"]);
  43712. this.relevant = getRelevant(attributes.relevant);
  43713. this.use = attributes.use || "";
  43714. this.usehref = attributes.usehref || "";
  43715. this.bookend = null;
  43716. this.break = null;
  43717. this.desc = null;
  43718. this.extras = null;
  43719. this.occur = null;
  43720. this.overflow = null;
  43721. this.breakAfter = new XFAObjectArray();
  43722. this.breakBefore = new XFAObjectArray();
  43723. this.subform = new XFAObjectArray();
  43724. this.subformSet = new XFAObjectArray();
  43725. }
  43726. *[$getContainedChildren]() {
  43727. yield* getContainedChildren(this);
  43728. }
  43729. [$getSubformParent]() {
  43730. let parent = this[$getParent]();
  43731. while (!(parent instanceof Subform)) {
  43732. parent = parent[$getParent]();
  43733. }
  43734. return parent;
  43735. }
  43736. [$isBindable]() {
  43737. return true;
  43738. }
  43739. }
  43740. class SubjectDN extends ContentObject {
  43741. constructor(attributes) {
  43742. super(TEMPLATE_NS_ID, "subjectDN");
  43743. this.delimiter = attributes.delimiter || ",";
  43744. this.id = attributes.id || "";
  43745. this.name = attributes.name || "";
  43746. this.use = attributes.use || "";
  43747. this.usehref = attributes.usehref || "";
  43748. }
  43749. [$finalize]() {
  43750. this[$content] = new Map(this[$content].split(this.delimiter).map(kv => {
  43751. kv = kv.split("=", 2);
  43752. kv[0] = kv[0].trim();
  43753. return kv;
  43754. }));
  43755. }
  43756. }
  43757. class SubjectDNs extends XFAObject {
  43758. constructor(attributes) {
  43759. super(TEMPLATE_NS_ID, "subjectDNs", true);
  43760. this.id = attributes.id || "";
  43761. this.type = getStringOption(attributes.type, ["optional", "required"]);
  43762. this.use = attributes.use || "";
  43763. this.usehref = attributes.usehref || "";
  43764. this.subjectDN = new XFAObjectArray();
  43765. }
  43766. }
  43767. class Submit extends XFAObject {
  43768. constructor(attributes) {
  43769. super(TEMPLATE_NS_ID, "submit", true);
  43770. this.embedPDF = getInteger({
  43771. data: attributes.embedPDF,
  43772. defaultValue: 0,
  43773. validate: x => x === 1
  43774. });
  43775. this.format = getStringOption(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  43776. this.id = attributes.id || "";
  43777. this.target = attributes.target || "";
  43778. this.textEncoding = getKeyword({
  43779. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  43780. defaultValue: "",
  43781. validate: k => ["utf-8", "big-five", "fontspecific", "gbk", "gb-18030", "gb-2312", "ksc-5601", "none", "shift-jis", "ucs-2", "utf-16"].includes(k) || k.match(/iso-8859-\d{2}/)
  43782. });
  43783. this.use = attributes.use || "";
  43784. this.usehref = attributes.usehref || "";
  43785. this.xdpContent = attributes.xdpContent || "";
  43786. this.encrypt = null;
  43787. this.encryptData = new XFAObjectArray();
  43788. this.signData = new XFAObjectArray();
  43789. }
  43790. }
  43791. class Template extends XFAObject {
  43792. constructor(attributes) {
  43793. super(TEMPLATE_NS_ID, "template", true);
  43794. this.baseProfile = getStringOption(attributes.baseProfile, ["full", "interactiveForms"]);
  43795. this.extras = null;
  43796. this.subform = new XFAObjectArray();
  43797. }
  43798. [$finalize]() {
  43799. if (this.subform.children.length === 0) {
  43800. warn("XFA - No subforms in template node.");
  43801. }
  43802. if (this.subform.children.length >= 2) {
  43803. warn("XFA - Several subforms in template node: please file a bug.");
  43804. }
  43805. this[$tabIndex] = DEFAULT_TAB_INDEX;
  43806. }
  43807. [$isSplittable]() {
  43808. return true;
  43809. }
  43810. [$searchNode](expr, container) {
  43811. if (expr.startsWith("#")) {
  43812. return [this[$ids].get(expr.slice(1))];
  43813. }
  43814. return searchNode(this, container, expr, true, true);
  43815. }
  43816. *[$toPages]() {
  43817. if (!this.subform.children.length) {
  43818. return HTMLResult.success({
  43819. name: "div",
  43820. children: []
  43821. });
  43822. }
  43823. this[$extra] = {
  43824. overflowNode: null,
  43825. firstUnsplittable: null,
  43826. currentContentArea: null,
  43827. currentPageArea: null,
  43828. noLayoutFailure: false,
  43829. pageNumber: 1,
  43830. pagePosition: "first",
  43831. oddOrEven: "odd",
  43832. blankOrNotBlank: "nonBlank",
  43833. paraStack: []
  43834. };
  43835. const root = this.subform.children[0];
  43836. root.pageSet[$cleanPage]();
  43837. const pageAreas = root.pageSet.pageArea.children;
  43838. const mainHtml = {
  43839. name: "div",
  43840. children: []
  43841. };
  43842. let pageArea = null;
  43843. let breakBefore = null;
  43844. let breakBeforeTarget = null;
  43845. if (root.breakBefore.children.length >= 1) {
  43846. breakBefore = root.breakBefore.children[0];
  43847. breakBeforeTarget = breakBefore.target;
  43848. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  43849. breakBefore = root.subform.children[0].breakBefore.children[0];
  43850. breakBeforeTarget = breakBefore.target;
  43851. } else if (root.break?.beforeTarget) {
  43852. breakBefore = root.break;
  43853. breakBeforeTarget = breakBefore.beforeTarget;
  43854. } else if (root.subform.children.length >= 1 && root.subform.children[0].break?.beforeTarget) {
  43855. breakBefore = root.subform.children[0].break;
  43856. breakBeforeTarget = breakBefore.beforeTarget;
  43857. }
  43858. if (breakBefore) {
  43859. const target = this[$searchNode](breakBeforeTarget, breakBefore[$getParent]());
  43860. if (target instanceof PageArea) {
  43861. pageArea = target;
  43862. breakBefore[$extra] = {};
  43863. }
  43864. }
  43865. if (!pageArea) {
  43866. pageArea = pageAreas[0];
  43867. }
  43868. pageArea[$extra] = {
  43869. numberOfUse: 1
  43870. };
  43871. const pageAreaParent = pageArea[$getParent]();
  43872. pageAreaParent[$extra] = {
  43873. numberOfUse: 1,
  43874. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  43875. pageSetIndex: 0
  43876. };
  43877. let targetPageArea;
  43878. let leader = null;
  43879. let trailer = null;
  43880. let hasSomething = true;
  43881. let hasSomethingCounter = 0;
  43882. let startIndex = 0;
  43883. while (true) {
  43884. if (!hasSomething) {
  43885. mainHtml.children.pop();
  43886. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  43887. warn("XFA - Something goes wrong: please file a bug.");
  43888. return mainHtml;
  43889. }
  43890. } else {
  43891. hasSomethingCounter = 0;
  43892. }
  43893. targetPageArea = null;
  43894. this[$extra].currentPageArea = pageArea;
  43895. const page = pageArea[$toHTML]().html;
  43896. mainHtml.children.push(page);
  43897. if (leader) {
  43898. this[$extra].noLayoutFailure = true;
  43899. page.children.push(leader[$toHTML](pageArea[$extra].space).html);
  43900. leader = null;
  43901. }
  43902. if (trailer) {
  43903. this[$extra].noLayoutFailure = true;
  43904. page.children.push(trailer[$toHTML](pageArea[$extra].space).html);
  43905. trailer = null;
  43906. }
  43907. const contentAreas = pageArea.contentArea.children;
  43908. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  43909. hasSomething = false;
  43910. this[$extra].firstUnsplittable = null;
  43911. this[$extra].noLayoutFailure = false;
  43912. const flush = index => {
  43913. const html = root[$flushHTML]();
  43914. if (html) {
  43915. hasSomething ||= html.children?.length > 0;
  43916. htmlContentAreas[index].children.push(html);
  43917. }
  43918. };
  43919. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  43920. const contentArea = this[$extra].currentContentArea = contentAreas[i];
  43921. const space = {
  43922. width: contentArea.w,
  43923. height: contentArea.h
  43924. };
  43925. startIndex = 0;
  43926. if (leader) {
  43927. htmlContentAreas[i].children.push(leader[$toHTML](space).html);
  43928. leader = null;
  43929. }
  43930. if (trailer) {
  43931. htmlContentAreas[i].children.push(trailer[$toHTML](space).html);
  43932. trailer = null;
  43933. }
  43934. const html = root[$toHTML](space);
  43935. if (html.success) {
  43936. if (html.html) {
  43937. hasSomething ||= html.html.children?.length > 0;
  43938. htmlContentAreas[i].children.push(html.html);
  43939. } else if (!hasSomething && mainHtml.children.length > 1) {
  43940. mainHtml.children.pop();
  43941. }
  43942. return mainHtml;
  43943. }
  43944. if (html.isBreak()) {
  43945. const node = html.breakNode;
  43946. flush(i);
  43947. if (node.targetType === "auto") {
  43948. continue;
  43949. }
  43950. if (node.leader) {
  43951. leader = this[$searchNode](node.leader, node[$getParent]());
  43952. leader = leader ? leader[0] : null;
  43953. }
  43954. if (node.trailer) {
  43955. trailer = this[$searchNode](node.trailer, node[$getParent]());
  43956. trailer = trailer ? trailer[0] : null;
  43957. }
  43958. if (node.targetType === "pageArea") {
  43959. targetPageArea = node[$extra].target;
  43960. i = Infinity;
  43961. } else if (!node[$extra].target) {
  43962. i = node[$extra].index;
  43963. } else {
  43964. targetPageArea = node[$extra].target;
  43965. startIndex = node[$extra].index + 1;
  43966. i = Infinity;
  43967. }
  43968. continue;
  43969. }
  43970. if (this[$extra].overflowNode) {
  43971. const node = this[$extra].overflowNode;
  43972. this[$extra].overflowNode = null;
  43973. const overflowExtra = node[$getExtra]();
  43974. const target = overflowExtra.target;
  43975. overflowExtra.addLeader = overflowExtra.leader !== null;
  43976. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  43977. flush(i);
  43978. const currentIndex = i;
  43979. i = Infinity;
  43980. if (target instanceof PageArea) {
  43981. targetPageArea = target;
  43982. } else if (target instanceof ContentArea) {
  43983. const index = contentAreas.indexOf(target);
  43984. if (index !== -1) {
  43985. if (index > currentIndex) {
  43986. i = index - 1;
  43987. } else {
  43988. startIndex = index;
  43989. }
  43990. } else {
  43991. targetPageArea = target[$getParent]();
  43992. startIndex = targetPageArea.contentArea.children.indexOf(target);
  43993. }
  43994. }
  43995. continue;
  43996. }
  43997. flush(i);
  43998. }
  43999. this[$extra].pageNumber += 1;
  44000. if (targetPageArea) {
  44001. if (targetPageArea[$isUsable]()) {
  44002. targetPageArea[$extra].numberOfUse += 1;
  44003. } else {
  44004. targetPageArea = null;
  44005. }
  44006. }
  44007. pageArea = targetPageArea || pageArea[$getNextPage]();
  44008. yield null;
  44009. }
  44010. }
  44011. }
  44012. class Text extends ContentObject {
  44013. constructor(attributes) {
  44014. super(TEMPLATE_NS_ID, "text");
  44015. this.id = attributes.id || "";
  44016. this.maxChars = getInteger({
  44017. data: attributes.maxChars,
  44018. defaultValue: 0,
  44019. validate: x => x >= 0
  44020. });
  44021. this.name = attributes.name || "";
  44022. this.rid = attributes.rid || "";
  44023. this.use = attributes.use || "";
  44024. this.usehref = attributes.usehref || "";
  44025. }
  44026. [$acceptWhitespace]() {
  44027. return true;
  44028. }
  44029. [$onChild](child) {
  44030. if (child[$namespaceId] === NamespaceIds.xhtml.id) {
  44031. this[$content] = child;
  44032. return true;
  44033. }
  44034. warn(`XFA - Invalid content in Text: ${child[$nodeName]}.`);
  44035. return false;
  44036. }
  44037. [$onText](str) {
  44038. if (this[$content] instanceof XFAObject) {
  44039. return;
  44040. }
  44041. super[$onText](str);
  44042. }
  44043. [$finalize]() {
  44044. if (typeof this[$content] === "string") {
  44045. this[$content] = this[$content].replaceAll("\r\n", "\n");
  44046. }
  44047. }
  44048. [$getExtra]() {
  44049. if (typeof this[$content] === "string") {
  44050. return this[$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  44051. if (line) {
  44052. acc.push(line);
  44053. }
  44054. return acc;
  44055. }, []).join("\n");
  44056. }
  44057. return this[$content][$text]();
  44058. }
  44059. [$toHTML](availableSpace) {
  44060. if (typeof this[$content] === "string") {
  44061. const html = valueToHtml(this[$content]).html;
  44062. if (this[$content].includes("\u2029")) {
  44063. html.name = "div";
  44064. html.children = [];
  44065. this[$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  44066. acc.push({
  44067. name: "span",
  44068. value: line
  44069. }, {
  44070. name: "br"
  44071. });
  44072. return acc;
  44073. }, [])).forEach(lines => {
  44074. html.children.push({
  44075. name: "p",
  44076. children: lines
  44077. });
  44078. });
  44079. } else if (/[\u2028\n]/.test(this[$content])) {
  44080. html.name = "div";
  44081. html.children = [];
  44082. this[$content].split(/[\u2028\n]/).forEach(line => {
  44083. html.children.push({
  44084. name: "span",
  44085. value: line
  44086. }, {
  44087. name: "br"
  44088. });
  44089. });
  44090. }
  44091. return HTMLResult.success(html);
  44092. }
  44093. return this[$content][$toHTML](availableSpace);
  44094. }
  44095. }
  44096. class TextEdit extends XFAObject {
  44097. constructor(attributes) {
  44098. super(TEMPLATE_NS_ID, "textEdit", true);
  44099. this.allowRichText = getInteger({
  44100. data: attributes.allowRichText,
  44101. defaultValue: 0,
  44102. validate: x => x === 1
  44103. });
  44104. this.hScrollPolicy = getStringOption(attributes.hScrollPolicy, ["auto", "off", "on"]);
  44105. this.id = attributes.id || "";
  44106. this.multiLine = getInteger({
  44107. data: attributes.multiLine,
  44108. defaultValue: "",
  44109. validate: x => x === 0 || x === 1
  44110. });
  44111. this.use = attributes.use || "";
  44112. this.usehref = attributes.usehref || "";
  44113. this.vScrollPolicy = getStringOption(attributes.vScrollPolicy, ["auto", "off", "on"]);
  44114. this.border = null;
  44115. this.comb = null;
  44116. this.extras = null;
  44117. this.margin = null;
  44118. }
  44119. [$toHTML](availableSpace) {
  44120. const style = toStyle(this, "border", "font", "margin");
  44121. let html;
  44122. const field = this[$getParent]()[$getParent]();
  44123. if (this.multiLine === "") {
  44124. this.multiLine = field instanceof Draw ? 1 : 0;
  44125. }
  44126. if (this.multiLine === 1) {
  44127. html = {
  44128. name: "textarea",
  44129. attributes: {
  44130. dataId: field[$data]?.[$uid] || field[$uid],
  44131. fieldId: field[$uid],
  44132. class: ["xfaTextfield"],
  44133. style,
  44134. "aria-label": ariaLabel(field),
  44135. "aria-required": false
  44136. }
  44137. };
  44138. } else {
  44139. html = {
  44140. name: "input",
  44141. attributes: {
  44142. type: "text",
  44143. dataId: field[$data]?.[$uid] || field[$uid],
  44144. fieldId: field[$uid],
  44145. class: ["xfaTextfield"],
  44146. style,
  44147. "aria-label": ariaLabel(field),
  44148. "aria-required": false
  44149. }
  44150. };
  44151. }
  44152. if (isRequired(field)) {
  44153. html.attributes["aria-required"] = true;
  44154. html.attributes.required = true;
  44155. }
  44156. return HTMLResult.success({
  44157. name: "label",
  44158. attributes: {
  44159. class: ["xfaLabel"]
  44160. },
  44161. children: [html]
  44162. });
  44163. }
  44164. }
  44165. class Time extends StringObject {
  44166. constructor(attributes) {
  44167. super(TEMPLATE_NS_ID, "time");
  44168. this.id = attributes.id || "";
  44169. this.name = attributes.name || "";
  44170. this.use = attributes.use || "";
  44171. this.usehref = attributes.usehref || "";
  44172. }
  44173. [$finalize]() {
  44174. const date = this[$content].trim();
  44175. this[$content] = date ? new Date(date) : null;
  44176. }
  44177. [$toHTML](availableSpace) {
  44178. return valueToHtml(this[$content] ? this[$content].toString() : "");
  44179. }
  44180. }
  44181. class TimeStamp extends XFAObject {
  44182. constructor(attributes) {
  44183. super(TEMPLATE_NS_ID, "timeStamp");
  44184. this.id = attributes.id || "";
  44185. this.server = attributes.server || "";
  44186. this.type = getStringOption(attributes.type, ["optional", "required"]);
  44187. this.use = attributes.use || "";
  44188. this.usehref = attributes.usehref || "";
  44189. }
  44190. }
  44191. class ToolTip extends StringObject {
  44192. constructor(attributes) {
  44193. super(TEMPLATE_NS_ID, "toolTip");
  44194. this.id = attributes.id || "";
  44195. this.rid = attributes.rid || "";
  44196. this.use = attributes.use || "";
  44197. this.usehref = attributes.usehref || "";
  44198. }
  44199. }
  44200. class Traversal extends XFAObject {
  44201. constructor(attributes) {
  44202. super(TEMPLATE_NS_ID, "traversal", true);
  44203. this.id = attributes.id || "";
  44204. this.use = attributes.use || "";
  44205. this.usehref = attributes.usehref || "";
  44206. this.extras = null;
  44207. this.traverse = new XFAObjectArray();
  44208. }
  44209. }
  44210. class Traverse extends XFAObject {
  44211. constructor(attributes) {
  44212. super(TEMPLATE_NS_ID, "traverse", true);
  44213. this.id = attributes.id || "";
  44214. this.operation = getStringOption(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  44215. this.ref = attributes.ref || "";
  44216. this.use = attributes.use || "";
  44217. this.usehref = attributes.usehref || "";
  44218. this.extras = null;
  44219. this.script = null;
  44220. }
  44221. get name() {
  44222. return this.operation;
  44223. }
  44224. [$isTransparent]() {
  44225. return false;
  44226. }
  44227. }
  44228. class Ui extends XFAObject {
  44229. constructor(attributes) {
  44230. super(TEMPLATE_NS_ID, "ui", true);
  44231. this.id = attributes.id || "";
  44232. this.use = attributes.use || "";
  44233. this.usehref = attributes.usehref || "";
  44234. this.extras = null;
  44235. this.picture = null;
  44236. this.barcode = null;
  44237. this.button = null;
  44238. this.checkButton = null;
  44239. this.choiceList = null;
  44240. this.dateTimeEdit = null;
  44241. this.defaultUi = null;
  44242. this.imageEdit = null;
  44243. this.numericEdit = null;
  44244. this.passwordEdit = null;
  44245. this.signature = null;
  44246. this.textEdit = null;
  44247. }
  44248. [$getExtra]() {
  44249. if (this[$extra] === undefined) {
  44250. for (const name of Object.getOwnPropertyNames(this)) {
  44251. if (name === "extras" || name === "picture") {
  44252. continue;
  44253. }
  44254. const obj = this[name];
  44255. if (!(obj instanceof XFAObject)) {
  44256. continue;
  44257. }
  44258. this[$extra] = obj;
  44259. return obj;
  44260. }
  44261. this[$extra] = null;
  44262. }
  44263. return this[$extra];
  44264. }
  44265. [$toHTML](availableSpace) {
  44266. const obj = this[$getExtra]();
  44267. if (obj) {
  44268. return obj[$toHTML](availableSpace);
  44269. }
  44270. return HTMLResult.EMPTY;
  44271. }
  44272. }
  44273. class Validate extends XFAObject {
  44274. constructor(attributes) {
  44275. super(TEMPLATE_NS_ID, "validate", true);
  44276. this.formatTest = getStringOption(attributes.formatTest, ["warning", "disabled", "error"]);
  44277. this.id = attributes.id || "";
  44278. this.nullTest = getStringOption(attributes.nullTest, ["disabled", "error", "warning"]);
  44279. this.scriptTest = getStringOption(attributes.scriptTest, ["error", "disabled", "warning"]);
  44280. this.use = attributes.use || "";
  44281. this.usehref = attributes.usehref || "";
  44282. this.extras = null;
  44283. this.message = null;
  44284. this.picture = null;
  44285. this.script = null;
  44286. }
  44287. }
  44288. class Value extends XFAObject {
  44289. constructor(attributes) {
  44290. super(TEMPLATE_NS_ID, "value", true);
  44291. this.id = attributes.id || "";
  44292. this.override = getInteger({
  44293. data: attributes.override,
  44294. defaultValue: 0,
  44295. validate: x => x === 1
  44296. });
  44297. this.relevant = getRelevant(attributes.relevant);
  44298. this.use = attributes.use || "";
  44299. this.usehref = attributes.usehref || "";
  44300. this.arc = null;
  44301. this.boolean = null;
  44302. this.date = null;
  44303. this.dateTime = null;
  44304. this.decimal = null;
  44305. this.exData = null;
  44306. this.float = null;
  44307. this.image = null;
  44308. this.integer = null;
  44309. this.line = null;
  44310. this.rectangle = null;
  44311. this.text = null;
  44312. this.time = null;
  44313. }
  44314. [$setValue](value) {
  44315. const parent = this[$getParent]();
  44316. if (parent instanceof Field) {
  44317. if (parent.ui?.imageEdit) {
  44318. if (!this.image) {
  44319. this.image = new Image({});
  44320. this[$appendChild](this.image);
  44321. }
  44322. this.image[$content] = value[$content];
  44323. return;
  44324. }
  44325. }
  44326. const valueName = value[$nodeName];
  44327. if (this[valueName] !== null) {
  44328. this[valueName][$content] = value[$content];
  44329. return;
  44330. }
  44331. for (const name of Object.getOwnPropertyNames(this)) {
  44332. const obj = this[name];
  44333. if (obj instanceof XFAObject) {
  44334. this[name] = null;
  44335. this[$removeChild](obj);
  44336. }
  44337. }
  44338. this[value[$nodeName]] = value;
  44339. this[$appendChild](value);
  44340. }
  44341. [$text]() {
  44342. if (this.exData) {
  44343. if (typeof this.exData[$content] === "string") {
  44344. return this.exData[$content].trim();
  44345. }
  44346. return this.exData[$content][$text]().trim();
  44347. }
  44348. for (const name of Object.getOwnPropertyNames(this)) {
  44349. if (name === "image") {
  44350. continue;
  44351. }
  44352. const obj = this[name];
  44353. if (obj instanceof XFAObject) {
  44354. return (obj[$content] || "").toString().trim();
  44355. }
  44356. }
  44357. return null;
  44358. }
  44359. [$toHTML](availableSpace) {
  44360. for (const name of Object.getOwnPropertyNames(this)) {
  44361. const obj = this[name];
  44362. if (!(obj instanceof XFAObject)) {
  44363. continue;
  44364. }
  44365. return obj[$toHTML](availableSpace);
  44366. }
  44367. return HTMLResult.EMPTY;
  44368. }
  44369. }
  44370. class Variables extends XFAObject {
  44371. constructor(attributes) {
  44372. super(TEMPLATE_NS_ID, "variables", true);
  44373. this.id = attributes.id || "";
  44374. this.use = attributes.use || "";
  44375. this.usehref = attributes.usehref || "";
  44376. this.boolean = new XFAObjectArray();
  44377. this.date = new XFAObjectArray();
  44378. this.dateTime = new XFAObjectArray();
  44379. this.decimal = new XFAObjectArray();
  44380. this.exData = new XFAObjectArray();
  44381. this.float = new XFAObjectArray();
  44382. this.image = new XFAObjectArray();
  44383. this.integer = new XFAObjectArray();
  44384. this.manifest = new XFAObjectArray();
  44385. this.script = new XFAObjectArray();
  44386. this.text = new XFAObjectArray();
  44387. this.time = new XFAObjectArray();
  44388. }
  44389. [$isTransparent]() {
  44390. return true;
  44391. }
  44392. }
  44393. class TemplateNamespace {
  44394. static [$buildXFAObject](name, attributes) {
  44395. if (TemplateNamespace.hasOwnProperty(name)) {
  44396. const node = TemplateNamespace[name](attributes);
  44397. node[$setSetAttributes](attributes);
  44398. return node;
  44399. }
  44400. return undefined;
  44401. }
  44402. static appearanceFilter(attrs) {
  44403. return new AppearanceFilter(attrs);
  44404. }
  44405. static arc(attrs) {
  44406. return new Arc(attrs);
  44407. }
  44408. static area(attrs) {
  44409. return new Area(attrs);
  44410. }
  44411. static assist(attrs) {
  44412. return new Assist(attrs);
  44413. }
  44414. static barcode(attrs) {
  44415. return new Barcode(attrs);
  44416. }
  44417. static bind(attrs) {
  44418. return new Bind(attrs);
  44419. }
  44420. static bindItems(attrs) {
  44421. return new BindItems(attrs);
  44422. }
  44423. static bookend(attrs) {
  44424. return new Bookend(attrs);
  44425. }
  44426. static boolean(attrs) {
  44427. return new BooleanElement(attrs);
  44428. }
  44429. static border(attrs) {
  44430. return new Border(attrs);
  44431. }
  44432. static break(attrs) {
  44433. return new Break(attrs);
  44434. }
  44435. static breakAfter(attrs) {
  44436. return new BreakAfter(attrs);
  44437. }
  44438. static breakBefore(attrs) {
  44439. return new BreakBefore(attrs);
  44440. }
  44441. static button(attrs) {
  44442. return new Button(attrs);
  44443. }
  44444. static calculate(attrs) {
  44445. return new Calculate(attrs);
  44446. }
  44447. static caption(attrs) {
  44448. return new Caption(attrs);
  44449. }
  44450. static certificate(attrs) {
  44451. return new Certificate(attrs);
  44452. }
  44453. static certificates(attrs) {
  44454. return new Certificates(attrs);
  44455. }
  44456. static checkButton(attrs) {
  44457. return new CheckButton(attrs);
  44458. }
  44459. static choiceList(attrs) {
  44460. return new ChoiceList(attrs);
  44461. }
  44462. static color(attrs) {
  44463. return new Color(attrs);
  44464. }
  44465. static comb(attrs) {
  44466. return new Comb(attrs);
  44467. }
  44468. static connect(attrs) {
  44469. return new Connect(attrs);
  44470. }
  44471. static contentArea(attrs) {
  44472. return new ContentArea(attrs);
  44473. }
  44474. static corner(attrs) {
  44475. return new Corner(attrs);
  44476. }
  44477. static date(attrs) {
  44478. return new DateElement(attrs);
  44479. }
  44480. static dateTime(attrs) {
  44481. return new DateTime(attrs);
  44482. }
  44483. static dateTimeEdit(attrs) {
  44484. return new DateTimeEdit(attrs);
  44485. }
  44486. static decimal(attrs) {
  44487. return new Decimal(attrs);
  44488. }
  44489. static defaultUi(attrs) {
  44490. return new DefaultUi(attrs);
  44491. }
  44492. static desc(attrs) {
  44493. return new Desc(attrs);
  44494. }
  44495. static digestMethod(attrs) {
  44496. return new DigestMethod(attrs);
  44497. }
  44498. static digestMethods(attrs) {
  44499. return new DigestMethods(attrs);
  44500. }
  44501. static draw(attrs) {
  44502. return new Draw(attrs);
  44503. }
  44504. static edge(attrs) {
  44505. return new Edge(attrs);
  44506. }
  44507. static encoding(attrs) {
  44508. return new Encoding(attrs);
  44509. }
  44510. static encodings(attrs) {
  44511. return new Encodings(attrs);
  44512. }
  44513. static encrypt(attrs) {
  44514. return new Encrypt(attrs);
  44515. }
  44516. static encryptData(attrs) {
  44517. return new EncryptData(attrs);
  44518. }
  44519. static encryption(attrs) {
  44520. return new Encryption(attrs);
  44521. }
  44522. static encryptionMethod(attrs) {
  44523. return new EncryptionMethod(attrs);
  44524. }
  44525. static encryptionMethods(attrs) {
  44526. return new EncryptionMethods(attrs);
  44527. }
  44528. static event(attrs) {
  44529. return new Event(attrs);
  44530. }
  44531. static exData(attrs) {
  44532. return new ExData(attrs);
  44533. }
  44534. static exObject(attrs) {
  44535. return new ExObject(attrs);
  44536. }
  44537. static exclGroup(attrs) {
  44538. return new ExclGroup(attrs);
  44539. }
  44540. static execute(attrs) {
  44541. return new Execute(attrs);
  44542. }
  44543. static extras(attrs) {
  44544. return new Extras(attrs);
  44545. }
  44546. static field(attrs) {
  44547. return new Field(attrs);
  44548. }
  44549. static fill(attrs) {
  44550. return new Fill(attrs);
  44551. }
  44552. static filter(attrs) {
  44553. return new Filter(attrs);
  44554. }
  44555. static float(attrs) {
  44556. return new Float(attrs);
  44557. }
  44558. static font(attrs) {
  44559. return new template_Font(attrs);
  44560. }
  44561. static format(attrs) {
  44562. return new Format(attrs);
  44563. }
  44564. static handler(attrs) {
  44565. return new Handler(attrs);
  44566. }
  44567. static hyphenation(attrs) {
  44568. return new Hyphenation(attrs);
  44569. }
  44570. static image(attrs) {
  44571. return new Image(attrs);
  44572. }
  44573. static imageEdit(attrs) {
  44574. return new ImageEdit(attrs);
  44575. }
  44576. static integer(attrs) {
  44577. return new Integer(attrs);
  44578. }
  44579. static issuers(attrs) {
  44580. return new Issuers(attrs);
  44581. }
  44582. static items(attrs) {
  44583. return new Items(attrs);
  44584. }
  44585. static keep(attrs) {
  44586. return new Keep(attrs);
  44587. }
  44588. static keyUsage(attrs) {
  44589. return new KeyUsage(attrs);
  44590. }
  44591. static line(attrs) {
  44592. return new Line(attrs);
  44593. }
  44594. static linear(attrs) {
  44595. return new Linear(attrs);
  44596. }
  44597. static lockDocument(attrs) {
  44598. return new LockDocument(attrs);
  44599. }
  44600. static manifest(attrs) {
  44601. return new Manifest(attrs);
  44602. }
  44603. static margin(attrs) {
  44604. return new Margin(attrs);
  44605. }
  44606. static mdp(attrs) {
  44607. return new Mdp(attrs);
  44608. }
  44609. static medium(attrs) {
  44610. return new Medium(attrs);
  44611. }
  44612. static message(attrs) {
  44613. return new Message(attrs);
  44614. }
  44615. static numericEdit(attrs) {
  44616. return new NumericEdit(attrs);
  44617. }
  44618. static occur(attrs) {
  44619. return new Occur(attrs);
  44620. }
  44621. static oid(attrs) {
  44622. return new Oid(attrs);
  44623. }
  44624. static oids(attrs) {
  44625. return new Oids(attrs);
  44626. }
  44627. static overflow(attrs) {
  44628. return new Overflow(attrs);
  44629. }
  44630. static pageArea(attrs) {
  44631. return new PageArea(attrs);
  44632. }
  44633. static pageSet(attrs) {
  44634. return new PageSet(attrs);
  44635. }
  44636. static para(attrs) {
  44637. return new Para(attrs);
  44638. }
  44639. static passwordEdit(attrs) {
  44640. return new PasswordEdit(attrs);
  44641. }
  44642. static pattern(attrs) {
  44643. return new template_Pattern(attrs);
  44644. }
  44645. static picture(attrs) {
  44646. return new Picture(attrs);
  44647. }
  44648. static proto(attrs) {
  44649. return new Proto(attrs);
  44650. }
  44651. static radial(attrs) {
  44652. return new Radial(attrs);
  44653. }
  44654. static reason(attrs) {
  44655. return new Reason(attrs);
  44656. }
  44657. static reasons(attrs) {
  44658. return new Reasons(attrs);
  44659. }
  44660. static rectangle(attrs) {
  44661. return new Rectangle(attrs);
  44662. }
  44663. static ref(attrs) {
  44664. return new RefElement(attrs);
  44665. }
  44666. static script(attrs) {
  44667. return new Script(attrs);
  44668. }
  44669. static setProperty(attrs) {
  44670. return new SetProperty(attrs);
  44671. }
  44672. static signData(attrs) {
  44673. return new SignData(attrs);
  44674. }
  44675. static signature(attrs) {
  44676. return new Signature(attrs);
  44677. }
  44678. static signing(attrs) {
  44679. return new Signing(attrs);
  44680. }
  44681. static solid(attrs) {
  44682. return new Solid(attrs);
  44683. }
  44684. static speak(attrs) {
  44685. return new Speak(attrs);
  44686. }
  44687. static stipple(attrs) {
  44688. return new Stipple(attrs);
  44689. }
  44690. static subform(attrs) {
  44691. return new Subform(attrs);
  44692. }
  44693. static subformSet(attrs) {
  44694. return new SubformSet(attrs);
  44695. }
  44696. static subjectDN(attrs) {
  44697. return new SubjectDN(attrs);
  44698. }
  44699. static subjectDNs(attrs) {
  44700. return new SubjectDNs(attrs);
  44701. }
  44702. static submit(attrs) {
  44703. return new Submit(attrs);
  44704. }
  44705. static template(attrs) {
  44706. return new Template(attrs);
  44707. }
  44708. static text(attrs) {
  44709. return new Text(attrs);
  44710. }
  44711. static textEdit(attrs) {
  44712. return new TextEdit(attrs);
  44713. }
  44714. static time(attrs) {
  44715. return new Time(attrs);
  44716. }
  44717. static timeStamp(attrs) {
  44718. return new TimeStamp(attrs);
  44719. }
  44720. static toolTip(attrs) {
  44721. return new ToolTip(attrs);
  44722. }
  44723. static traversal(attrs) {
  44724. return new Traversal(attrs);
  44725. }
  44726. static traverse(attrs) {
  44727. return new Traverse(attrs);
  44728. }
  44729. static ui(attrs) {
  44730. return new Ui(attrs);
  44731. }
  44732. static validate(attrs) {
  44733. return new Validate(attrs);
  44734. }
  44735. static value(attrs) {
  44736. return new Value(attrs);
  44737. }
  44738. static variables(attrs) {
  44739. return new Variables(attrs);
  44740. }
  44741. }
  44742. ;// ./src/core/xfa/bind.js
  44743. const bind_NS_DATASETS = NamespaceIds.datasets.id;
  44744. function createText(content) {
  44745. const node = new Text({});
  44746. node[$content] = content;
  44747. return node;
  44748. }
  44749. class Binder {
  44750. constructor(root) {
  44751. this.root = root;
  44752. this.datasets = root.datasets;
  44753. this.data = root.datasets?.data || new XmlObject(NamespaceIds.datasets.id, "data");
  44754. this.emptyMerge = this.data[$getChildren]().length === 0;
  44755. this.root.form = this.form = root.template[$clone]();
  44756. }
  44757. _isConsumeData() {
  44758. return !this.emptyMerge && this._mergeMode;
  44759. }
  44760. _isMatchTemplate() {
  44761. return !this._isConsumeData();
  44762. }
  44763. bind() {
  44764. this._bindElement(this.form, this.data);
  44765. return this.form;
  44766. }
  44767. getData() {
  44768. return this.data;
  44769. }
  44770. _bindValue(formNode, data, picture) {
  44771. formNode[$data] = data;
  44772. if (formNode[$hasSettableValue]()) {
  44773. if (data[$isDataValue]()) {
  44774. const value = data[$getDataValue]();
  44775. formNode[$setValue](createText(value));
  44776. } else if (formNode instanceof Field && formNode.ui?.choiceList?.open === "multiSelect") {
  44777. const value = data[$getChildren]().map(child => child[$content].trim()).join("\n");
  44778. formNode[$setValue](createText(value));
  44779. } else if (this._isConsumeData()) {
  44780. warn(`XFA - Nodes haven't the same type.`);
  44781. }
  44782. } else if (!data[$isDataValue]() || this._isMatchTemplate()) {
  44783. this._bindElement(formNode, data);
  44784. } else {
  44785. warn(`XFA - Nodes haven't the same type.`);
  44786. }
  44787. }
  44788. _findDataByNameToConsume(name, isValue, dataNode, global) {
  44789. if (!name) {
  44790. return null;
  44791. }
  44792. let generator, match;
  44793. for (let i = 0; i < 3; i++) {
  44794. generator = dataNode[$getRealChildrenByNameIt](name, false, true);
  44795. while (true) {
  44796. match = generator.next().value;
  44797. if (!match) {
  44798. break;
  44799. }
  44800. if (isValue === match[$isDataValue]()) {
  44801. return match;
  44802. }
  44803. }
  44804. if (dataNode[$namespaceId] === NamespaceIds.datasets.id && dataNode[$nodeName] === "data") {
  44805. break;
  44806. }
  44807. dataNode = dataNode[$getParent]();
  44808. }
  44809. if (!global) {
  44810. return null;
  44811. }
  44812. generator = this.data[$getRealChildrenByNameIt](name, true, false);
  44813. match = generator.next().value;
  44814. if (match) {
  44815. return match;
  44816. }
  44817. generator = this.data[$getAttributeIt](name, true);
  44818. match = generator.next().value;
  44819. if (match?.[$isDataValue]()) {
  44820. return match;
  44821. }
  44822. return null;
  44823. }
  44824. _setProperties(formNode, dataNode) {
  44825. if (!formNode.hasOwnProperty("setProperty")) {
  44826. return;
  44827. }
  44828. for (const {
  44829. ref,
  44830. target,
  44831. connection
  44832. } of formNode.setProperty.children) {
  44833. if (connection) {
  44834. continue;
  44835. }
  44836. if (!ref) {
  44837. continue;
  44838. }
  44839. const nodes = searchNode(this.root, dataNode, ref, false, false);
  44840. if (!nodes) {
  44841. warn(`XFA - Invalid reference: ${ref}.`);
  44842. continue;
  44843. }
  44844. const [node] = nodes;
  44845. if (!node[$isDescendent](this.data)) {
  44846. warn(`XFA - Invalid node: must be a data node.`);
  44847. continue;
  44848. }
  44849. const targetNodes = searchNode(this.root, formNode, target, false, false);
  44850. if (!targetNodes) {
  44851. warn(`XFA - Invalid target: ${target}.`);
  44852. continue;
  44853. }
  44854. const [targetNode] = targetNodes;
  44855. if (!targetNode[$isDescendent](formNode)) {
  44856. warn(`XFA - Invalid target: must be a property or subproperty.`);
  44857. continue;
  44858. }
  44859. const targetParent = targetNode[$getParent]();
  44860. if (targetNode instanceof SetProperty || targetParent instanceof SetProperty) {
  44861. warn(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  44862. continue;
  44863. }
  44864. if (targetNode instanceof BindItems || targetParent instanceof BindItems) {
  44865. warn(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  44866. continue;
  44867. }
  44868. const content = node[$text]();
  44869. const name = targetNode[$nodeName];
  44870. if (targetNode instanceof XFAAttribute) {
  44871. const attrs = Object.create(null);
  44872. attrs[name] = content;
  44873. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  44874. targetParent[name] = obj[name];
  44875. continue;
  44876. }
  44877. if (!targetNode.hasOwnProperty($content)) {
  44878. warn(`XFA - Invalid node to use in setProperty`);
  44879. continue;
  44880. }
  44881. targetNode[$data] = node;
  44882. targetNode[$content] = content;
  44883. targetNode[$finalize]();
  44884. }
  44885. }
  44886. _bindItems(formNode, dataNode) {
  44887. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  44888. return;
  44889. }
  44890. for (const item of formNode.items.children) {
  44891. formNode[$removeChild](item);
  44892. }
  44893. formNode.items.clear();
  44894. const labels = new Items({});
  44895. const values = new Items({});
  44896. formNode[$appendChild](labels);
  44897. formNode.items.push(labels);
  44898. formNode[$appendChild](values);
  44899. formNode.items.push(values);
  44900. for (const {
  44901. ref,
  44902. labelRef,
  44903. valueRef,
  44904. connection
  44905. } of formNode.bindItems.children) {
  44906. if (connection) {
  44907. continue;
  44908. }
  44909. if (!ref) {
  44910. continue;
  44911. }
  44912. const nodes = searchNode(this.root, dataNode, ref, false, false);
  44913. if (!nodes) {
  44914. warn(`XFA - Invalid reference: ${ref}.`);
  44915. continue;
  44916. }
  44917. for (const node of nodes) {
  44918. if (!node[$isDescendent](this.datasets)) {
  44919. warn(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  44920. continue;
  44921. }
  44922. const labelNodes = searchNode(this.root, node, labelRef, true, false);
  44923. if (!labelNodes) {
  44924. warn(`XFA - Invalid label: ${labelRef}.`);
  44925. continue;
  44926. }
  44927. const [labelNode] = labelNodes;
  44928. if (!labelNode[$isDescendent](this.datasets)) {
  44929. warn(`XFA - Invalid label: must be a datasets child.`);
  44930. continue;
  44931. }
  44932. const valueNodes = searchNode(this.root, node, valueRef, true, false);
  44933. if (!valueNodes) {
  44934. warn(`XFA - Invalid value: ${valueRef}.`);
  44935. continue;
  44936. }
  44937. const [valueNode] = valueNodes;
  44938. if (!valueNode[$isDescendent](this.datasets)) {
  44939. warn(`XFA - Invalid value: must be a datasets child.`);
  44940. continue;
  44941. }
  44942. const label = createText(labelNode[$text]());
  44943. const value = createText(valueNode[$text]());
  44944. labels[$appendChild](label);
  44945. labels.text.push(label);
  44946. values[$appendChild](value);
  44947. values.text.push(value);
  44948. }
  44949. }
  44950. }
  44951. _bindOccurrences(formNode, matches, picture) {
  44952. let baseClone;
  44953. if (matches.length > 1) {
  44954. baseClone = formNode[$clone]();
  44955. baseClone[$removeChild](baseClone.occur);
  44956. baseClone.occur = null;
  44957. }
  44958. this._bindValue(formNode, matches[0], picture);
  44959. this._setProperties(formNode, matches[0]);
  44960. this._bindItems(formNode, matches[0]);
  44961. if (matches.length === 1) {
  44962. return;
  44963. }
  44964. const parent = formNode[$getParent]();
  44965. const name = formNode[$nodeName];
  44966. const pos = parent[$indexOf](formNode);
  44967. for (let i = 1, ii = matches.length; i < ii; i++) {
  44968. const match = matches[i];
  44969. const clone = baseClone[$clone]();
  44970. parent[name].push(clone);
  44971. parent[$insertAt](pos + i, clone);
  44972. this._bindValue(clone, match, picture);
  44973. this._setProperties(clone, match);
  44974. this._bindItems(clone, match);
  44975. }
  44976. }
  44977. _createOccurrences(formNode) {
  44978. if (!this.emptyMerge) {
  44979. return;
  44980. }
  44981. const {
  44982. occur
  44983. } = formNode;
  44984. if (!occur || occur.initial <= 1) {
  44985. return;
  44986. }
  44987. const parent = formNode[$getParent]();
  44988. const name = formNode[$nodeName];
  44989. if (!(parent[name] instanceof XFAObjectArray)) {
  44990. return;
  44991. }
  44992. let currentNumber;
  44993. if (formNode.name) {
  44994. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  44995. } else {
  44996. currentNumber = parent[name].children.length;
  44997. }
  44998. const pos = parent[$indexOf](formNode) + 1;
  44999. const ii = occur.initial - currentNumber;
  45000. if (ii) {
  45001. const nodeClone = formNode[$clone]();
  45002. nodeClone[$removeChild](nodeClone.occur);
  45003. nodeClone.occur = null;
  45004. parent[name].push(nodeClone);
  45005. parent[$insertAt](pos, nodeClone);
  45006. for (let i = 1; i < ii; i++) {
  45007. const clone = nodeClone[$clone]();
  45008. parent[name].push(clone);
  45009. parent[$insertAt](pos + i, clone);
  45010. }
  45011. }
  45012. }
  45013. _getOccurInfo(formNode) {
  45014. const {
  45015. name,
  45016. occur
  45017. } = formNode;
  45018. if (!occur || !name) {
  45019. return [1, 1];
  45020. }
  45021. const max = occur.max === -1 ? Infinity : occur.max;
  45022. return [occur.min, max];
  45023. }
  45024. _setAndBind(formNode, dataNode) {
  45025. this._setProperties(formNode, dataNode);
  45026. this._bindItems(formNode, dataNode);
  45027. this._bindElement(formNode, dataNode);
  45028. }
  45029. _bindElement(formNode, dataNode) {
  45030. const uselessNodes = [];
  45031. this._createOccurrences(formNode);
  45032. for (const child of formNode[$getChildren]()) {
  45033. if (child[$data]) {
  45034. continue;
  45035. }
  45036. if (this._mergeMode === undefined && child[$nodeName] === "subform") {
  45037. this._mergeMode = child.mergeMode === "consumeData";
  45038. const dataChildren = dataNode[$getChildren]();
  45039. if (dataChildren.length > 0) {
  45040. this._bindOccurrences(child, [dataChildren[0]], null);
  45041. } else if (this.emptyMerge) {
  45042. const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId];
  45043. const dataChild = child[$data] = new XmlObject(nsId, child.name || "root");
  45044. dataNode[$appendChild](dataChild);
  45045. this._bindElement(child, dataChild);
  45046. }
  45047. continue;
  45048. }
  45049. if (!child[$isBindable]()) {
  45050. continue;
  45051. }
  45052. let global = false;
  45053. let picture = null;
  45054. let ref = null;
  45055. let match = null;
  45056. if (child.bind) {
  45057. switch (child.bind.match) {
  45058. case "none":
  45059. this._setAndBind(child, dataNode);
  45060. continue;
  45061. case "global":
  45062. global = true;
  45063. break;
  45064. case "dataRef":
  45065. if (!child.bind.ref) {
  45066. warn(`XFA - ref is empty in node ${child[$nodeName]}.`);
  45067. this._setAndBind(child, dataNode);
  45068. continue;
  45069. }
  45070. ref = child.bind.ref;
  45071. break;
  45072. default:
  45073. break;
  45074. }
  45075. if (child.bind.picture) {
  45076. picture = child.bind.picture[$content];
  45077. }
  45078. }
  45079. const [min, max] = this._getOccurInfo(child);
  45080. if (ref) {
  45081. match = searchNode(this.root, dataNode, ref, true, false);
  45082. if (match === null) {
  45083. match = createDataNode(this.data, dataNode, ref);
  45084. if (!match) {
  45085. continue;
  45086. }
  45087. if (this._isConsumeData()) {
  45088. match[$consumed] = true;
  45089. }
  45090. this._setAndBind(child, match);
  45091. continue;
  45092. } else {
  45093. if (this._isConsumeData()) {
  45094. match = match.filter(node => !node[$consumed]);
  45095. }
  45096. if (match.length > max) {
  45097. match = match.slice(0, max);
  45098. } else if (match.length === 0) {
  45099. match = null;
  45100. }
  45101. if (match && this._isConsumeData()) {
  45102. match.forEach(node => {
  45103. node[$consumed] = true;
  45104. });
  45105. }
  45106. }
  45107. } else {
  45108. if (!child.name) {
  45109. this._setAndBind(child, dataNode);
  45110. continue;
  45111. }
  45112. if (this._isConsumeData()) {
  45113. const matches = [];
  45114. while (matches.length < max) {
  45115. const found = this._findDataByNameToConsume(child.name, child[$hasSettableValue](), dataNode, global);
  45116. if (!found) {
  45117. break;
  45118. }
  45119. found[$consumed] = true;
  45120. matches.push(found);
  45121. }
  45122. match = matches.length > 0 ? matches : null;
  45123. } else {
  45124. match = dataNode[$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  45125. if (!match) {
  45126. if (min === 0) {
  45127. uselessNodes.push(child);
  45128. continue;
  45129. }
  45130. const nsId = dataNode[$namespaceId] === bind_NS_DATASETS ? -1 : dataNode[$namespaceId];
  45131. match = child[$data] = new XmlObject(nsId, child.name);
  45132. if (this.emptyMerge) {
  45133. match[$consumed] = true;
  45134. }
  45135. dataNode[$appendChild](match);
  45136. this._setAndBind(child, match);
  45137. continue;
  45138. }
  45139. if (this.emptyMerge) {
  45140. match[$consumed] = true;
  45141. }
  45142. match = [match];
  45143. }
  45144. }
  45145. if (match) {
  45146. this._bindOccurrences(child, match, picture);
  45147. } else if (min > 0) {
  45148. this._setAndBind(child, dataNode);
  45149. } else {
  45150. uselessNodes.push(child);
  45151. }
  45152. }
  45153. uselessNodes.forEach(node => node[$getParent]()[$removeChild](node));
  45154. }
  45155. }
  45156. ;// ./src/core/xfa/data.js
  45157. class DataHandler {
  45158. constructor(root, data) {
  45159. this.data = data;
  45160. this.dataset = root.datasets || null;
  45161. }
  45162. serialize(storage) {
  45163. const stack = [[-1, this.data[$getChildren]()]];
  45164. while (stack.length > 0) {
  45165. const last = stack.at(-1);
  45166. const [i, children] = last;
  45167. if (i + 1 === children.length) {
  45168. stack.pop();
  45169. continue;
  45170. }
  45171. const child = children[++last[0]];
  45172. const storageEntry = storage.get(child[$uid]);
  45173. if (storageEntry) {
  45174. child[$setValue](storageEntry);
  45175. } else {
  45176. const attributes = child[$getAttributes]();
  45177. for (const value of attributes.values()) {
  45178. const entry = storage.get(value[$uid]);
  45179. if (entry) {
  45180. value[$setValue](entry);
  45181. break;
  45182. }
  45183. }
  45184. }
  45185. const nodes = child[$getChildren]();
  45186. if (nodes.length > 0) {
  45187. stack.push([-1, nodes]);
  45188. }
  45189. }
  45190. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  45191. if (this.dataset) {
  45192. for (const child of this.dataset[$getChildren]()) {
  45193. if (child[$nodeName] !== "data") {
  45194. child[$toString](buf);
  45195. }
  45196. }
  45197. }
  45198. this.data[$toString](buf);
  45199. buf.push("</xfa:datasets>");
  45200. return buf.join("");
  45201. }
  45202. }
  45203. ;// ./src/core/xfa/config.js
  45204. const CONFIG_NS_ID = NamespaceIds.config.id;
  45205. class Acrobat extends XFAObject {
  45206. constructor(attributes) {
  45207. super(CONFIG_NS_ID, "acrobat", true);
  45208. this.acrobat7 = null;
  45209. this.autoSave = null;
  45210. this.common = null;
  45211. this.validate = null;
  45212. this.validateApprovalSignatures = null;
  45213. this.submitUrl = new XFAObjectArray();
  45214. }
  45215. }
  45216. class Acrobat7 extends XFAObject {
  45217. constructor(attributes) {
  45218. super(CONFIG_NS_ID, "acrobat7", true);
  45219. this.dynamicRender = null;
  45220. }
  45221. }
  45222. class ADBE_JSConsole extends OptionObject {
  45223. constructor(attributes) {
  45224. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  45225. }
  45226. }
  45227. class ADBE_JSDebugger extends OptionObject {
  45228. constructor(attributes) {
  45229. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  45230. }
  45231. }
  45232. class AddSilentPrint extends Option01 {
  45233. constructor(attributes) {
  45234. super(CONFIG_NS_ID, "addSilentPrint");
  45235. }
  45236. }
  45237. class AddViewerPreferences extends Option01 {
  45238. constructor(attributes) {
  45239. super(CONFIG_NS_ID, "addViewerPreferences");
  45240. }
  45241. }
  45242. class AdjustData extends Option10 {
  45243. constructor(attributes) {
  45244. super(CONFIG_NS_ID, "adjustData");
  45245. }
  45246. }
  45247. class AdobeExtensionLevel extends IntegerObject {
  45248. constructor(attributes) {
  45249. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  45250. }
  45251. }
  45252. class Agent extends XFAObject {
  45253. constructor(attributes) {
  45254. super(CONFIG_NS_ID, "agent", true);
  45255. this.name = attributes.name ? attributes.name.trim() : "";
  45256. this.common = new XFAObjectArray();
  45257. }
  45258. }
  45259. class AlwaysEmbed extends ContentObject {
  45260. constructor(attributes) {
  45261. super(CONFIG_NS_ID, "alwaysEmbed");
  45262. }
  45263. }
  45264. class Amd extends StringObject {
  45265. constructor(attributes) {
  45266. super(CONFIG_NS_ID, "amd");
  45267. }
  45268. }
  45269. class config_Area extends XFAObject {
  45270. constructor(attributes) {
  45271. super(CONFIG_NS_ID, "area");
  45272. this.level = getInteger({
  45273. data: attributes.level,
  45274. defaultValue: 0,
  45275. validate: n => n >= 1 && n <= 3
  45276. });
  45277. this.name = getStringOption(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  45278. }
  45279. }
  45280. class Attributes extends OptionObject {
  45281. constructor(attributes) {
  45282. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  45283. }
  45284. }
  45285. class AutoSave extends OptionObject {
  45286. constructor(attributes) {
  45287. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  45288. }
  45289. }
  45290. class Base extends StringObject {
  45291. constructor(attributes) {
  45292. super(CONFIG_NS_ID, "base");
  45293. }
  45294. }
  45295. class BatchOutput extends XFAObject {
  45296. constructor(attributes) {
  45297. super(CONFIG_NS_ID, "batchOutput");
  45298. this.format = getStringOption(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  45299. }
  45300. }
  45301. class BehaviorOverride extends ContentObject {
  45302. constructor(attributes) {
  45303. super(CONFIG_NS_ID, "behaviorOverride");
  45304. }
  45305. [$finalize]() {
  45306. this[$content] = new Map(this[$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  45307. }
  45308. }
  45309. class Cache extends XFAObject {
  45310. constructor(attributes) {
  45311. super(CONFIG_NS_ID, "cache", true);
  45312. this.templateCache = null;
  45313. }
  45314. }
  45315. class Change extends Option01 {
  45316. constructor(attributes) {
  45317. super(CONFIG_NS_ID, "change");
  45318. }
  45319. }
  45320. class Common extends XFAObject {
  45321. constructor(attributes) {
  45322. super(CONFIG_NS_ID, "common", true);
  45323. this.data = null;
  45324. this.locale = null;
  45325. this.localeSet = null;
  45326. this.messaging = null;
  45327. this.suppressBanner = null;
  45328. this.template = null;
  45329. this.validationMessaging = null;
  45330. this.versionControl = null;
  45331. this.log = new XFAObjectArray();
  45332. }
  45333. }
  45334. class Compress extends XFAObject {
  45335. constructor(attributes) {
  45336. super(CONFIG_NS_ID, "compress");
  45337. this.scope = getStringOption(attributes.scope, ["imageOnly", "document"]);
  45338. }
  45339. }
  45340. class CompressLogicalStructure extends Option01 {
  45341. constructor(attributes) {
  45342. super(CONFIG_NS_ID, "compressLogicalStructure");
  45343. }
  45344. }
  45345. class CompressObjectStream extends Option10 {
  45346. constructor(attributes) {
  45347. super(CONFIG_NS_ID, "compressObjectStream");
  45348. }
  45349. }
  45350. class Compression extends XFAObject {
  45351. constructor(attributes) {
  45352. super(CONFIG_NS_ID, "compression", true);
  45353. this.compressLogicalStructure = null;
  45354. this.compressObjectStream = null;
  45355. this.level = null;
  45356. this.type = null;
  45357. }
  45358. }
  45359. class Config extends XFAObject {
  45360. constructor(attributes) {
  45361. super(CONFIG_NS_ID, "config", true);
  45362. this.acrobat = null;
  45363. this.present = null;
  45364. this.trace = null;
  45365. this.agent = new XFAObjectArray();
  45366. }
  45367. }
  45368. class Conformance extends OptionObject {
  45369. constructor(attributes) {
  45370. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  45371. }
  45372. }
  45373. class ContentCopy extends Option01 {
  45374. constructor(attributes) {
  45375. super(CONFIG_NS_ID, "contentCopy");
  45376. }
  45377. }
  45378. class Copies extends IntegerObject {
  45379. constructor(attributes) {
  45380. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  45381. }
  45382. }
  45383. class Creator extends StringObject {
  45384. constructor(attributes) {
  45385. super(CONFIG_NS_ID, "creator");
  45386. }
  45387. }
  45388. class CurrentPage extends IntegerObject {
  45389. constructor(attributes) {
  45390. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  45391. }
  45392. }
  45393. class Data extends XFAObject {
  45394. constructor(attributes) {
  45395. super(CONFIG_NS_ID, "data", true);
  45396. this.adjustData = null;
  45397. this.attributes = null;
  45398. this.incrementalLoad = null;
  45399. this.outputXSL = null;
  45400. this.range = null;
  45401. this.record = null;
  45402. this.startNode = null;
  45403. this.uri = null;
  45404. this.window = null;
  45405. this.xsl = null;
  45406. this.excludeNS = new XFAObjectArray();
  45407. this.transform = new XFAObjectArray();
  45408. }
  45409. }
  45410. class Debug extends XFAObject {
  45411. constructor(attributes) {
  45412. super(CONFIG_NS_ID, "debug", true);
  45413. this.uri = null;
  45414. }
  45415. }
  45416. class DefaultTypeface extends ContentObject {
  45417. constructor(attributes) {
  45418. super(CONFIG_NS_ID, "defaultTypeface");
  45419. this.writingScript = getStringOption(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  45420. }
  45421. }
  45422. class Destination extends OptionObject {
  45423. constructor(attributes) {
  45424. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  45425. }
  45426. }
  45427. class DocumentAssembly extends Option01 {
  45428. constructor(attributes) {
  45429. super(CONFIG_NS_ID, "documentAssembly");
  45430. }
  45431. }
  45432. class Driver extends XFAObject {
  45433. constructor(attributes) {
  45434. super(CONFIG_NS_ID, "driver", true);
  45435. this.name = attributes.name ? attributes.name.trim() : "";
  45436. this.fontInfo = null;
  45437. this.xdc = null;
  45438. }
  45439. }
  45440. class DuplexOption extends OptionObject {
  45441. constructor(attributes) {
  45442. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  45443. }
  45444. }
  45445. class DynamicRender extends OptionObject {
  45446. constructor(attributes) {
  45447. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  45448. }
  45449. }
  45450. class Embed extends Option01 {
  45451. constructor(attributes) {
  45452. super(CONFIG_NS_ID, "embed");
  45453. }
  45454. }
  45455. class config_Encrypt extends Option01 {
  45456. constructor(attributes) {
  45457. super(CONFIG_NS_ID, "encrypt");
  45458. }
  45459. }
  45460. class config_Encryption extends XFAObject {
  45461. constructor(attributes) {
  45462. super(CONFIG_NS_ID, "encryption", true);
  45463. this.encrypt = null;
  45464. this.encryptionLevel = null;
  45465. this.permissions = null;
  45466. }
  45467. }
  45468. class EncryptionLevel extends OptionObject {
  45469. constructor(attributes) {
  45470. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  45471. }
  45472. }
  45473. class Enforce extends StringObject {
  45474. constructor(attributes) {
  45475. super(CONFIG_NS_ID, "enforce");
  45476. }
  45477. }
  45478. class Equate extends XFAObject {
  45479. constructor(attributes) {
  45480. super(CONFIG_NS_ID, "equate");
  45481. this.force = getInteger({
  45482. data: attributes.force,
  45483. defaultValue: 1,
  45484. validate: n => n === 0
  45485. });
  45486. this.from = attributes.from || "";
  45487. this.to = attributes.to || "";
  45488. }
  45489. }
  45490. class EquateRange extends XFAObject {
  45491. constructor(attributes) {
  45492. super(CONFIG_NS_ID, "equateRange");
  45493. this.from = attributes.from || "";
  45494. this.to = attributes.to || "";
  45495. this._unicodeRange = attributes.unicodeRange || "";
  45496. }
  45497. get unicodeRange() {
  45498. const ranges = [];
  45499. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  45500. const unicodeRange = this._unicodeRange;
  45501. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  45502. range = range.split("-", 2).map(x => {
  45503. const found = x.match(unicodeRegex);
  45504. if (!found) {
  45505. return 0;
  45506. }
  45507. return parseInt(found[1], 16);
  45508. });
  45509. if (range.length === 1) {
  45510. range.push(range[0]);
  45511. }
  45512. ranges.push(range);
  45513. }
  45514. return shadow(this, "unicodeRange", ranges);
  45515. }
  45516. }
  45517. class Exclude extends ContentObject {
  45518. constructor(attributes) {
  45519. super(CONFIG_NS_ID, "exclude");
  45520. }
  45521. [$finalize]() {
  45522. this[$content] = this[$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  45523. }
  45524. }
  45525. class ExcludeNS extends StringObject {
  45526. constructor(attributes) {
  45527. super(CONFIG_NS_ID, "excludeNS");
  45528. }
  45529. }
  45530. class FlipLabel extends OptionObject {
  45531. constructor(attributes) {
  45532. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  45533. }
  45534. }
  45535. class config_FontInfo extends XFAObject {
  45536. constructor(attributes) {
  45537. super(CONFIG_NS_ID, "fontInfo", true);
  45538. this.embed = null;
  45539. this.map = null;
  45540. this.subsetBelow = null;
  45541. this.alwaysEmbed = new XFAObjectArray();
  45542. this.defaultTypeface = new XFAObjectArray();
  45543. this.neverEmbed = new XFAObjectArray();
  45544. }
  45545. }
  45546. class FormFieldFilling extends Option01 {
  45547. constructor(attributes) {
  45548. super(CONFIG_NS_ID, "formFieldFilling");
  45549. }
  45550. }
  45551. class GroupParent extends StringObject {
  45552. constructor(attributes) {
  45553. super(CONFIG_NS_ID, "groupParent");
  45554. }
  45555. }
  45556. class IfEmpty extends OptionObject {
  45557. constructor(attributes) {
  45558. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  45559. }
  45560. }
  45561. class IncludeXDPContent extends StringObject {
  45562. constructor(attributes) {
  45563. super(CONFIG_NS_ID, "includeXDPContent");
  45564. }
  45565. }
  45566. class IncrementalLoad extends OptionObject {
  45567. constructor(attributes) {
  45568. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  45569. }
  45570. }
  45571. class IncrementalMerge extends Option01 {
  45572. constructor(attributes) {
  45573. super(CONFIG_NS_ID, "incrementalMerge");
  45574. }
  45575. }
  45576. class Interactive extends Option01 {
  45577. constructor(attributes) {
  45578. super(CONFIG_NS_ID, "interactive");
  45579. }
  45580. }
  45581. class Jog extends OptionObject {
  45582. constructor(attributes) {
  45583. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  45584. }
  45585. }
  45586. class LabelPrinter extends XFAObject {
  45587. constructor(attributes) {
  45588. super(CONFIG_NS_ID, "labelPrinter", true);
  45589. this.name = getStringOption(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  45590. this.batchOutput = null;
  45591. this.flipLabel = null;
  45592. this.fontInfo = null;
  45593. this.xdc = null;
  45594. }
  45595. }
  45596. class Layout extends OptionObject {
  45597. constructor(attributes) {
  45598. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  45599. }
  45600. }
  45601. class Level extends IntegerObject {
  45602. constructor(attributes) {
  45603. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  45604. }
  45605. }
  45606. class Linearized extends Option01 {
  45607. constructor(attributes) {
  45608. super(CONFIG_NS_ID, "linearized");
  45609. }
  45610. }
  45611. class Locale extends StringObject {
  45612. constructor(attributes) {
  45613. super(CONFIG_NS_ID, "locale");
  45614. }
  45615. }
  45616. class LocaleSet extends StringObject {
  45617. constructor(attributes) {
  45618. super(CONFIG_NS_ID, "localeSet");
  45619. }
  45620. }
  45621. class Log extends XFAObject {
  45622. constructor(attributes) {
  45623. super(CONFIG_NS_ID, "log", true);
  45624. this.mode = null;
  45625. this.threshold = null;
  45626. this.to = null;
  45627. this.uri = null;
  45628. }
  45629. }
  45630. class MapElement extends XFAObject {
  45631. constructor(attributes) {
  45632. super(CONFIG_NS_ID, "map", true);
  45633. this.equate = new XFAObjectArray();
  45634. this.equateRange = new XFAObjectArray();
  45635. }
  45636. }
  45637. class MediumInfo extends XFAObject {
  45638. constructor(attributes) {
  45639. super(CONFIG_NS_ID, "mediumInfo", true);
  45640. this.map = null;
  45641. }
  45642. }
  45643. class config_Message extends XFAObject {
  45644. constructor(attributes) {
  45645. super(CONFIG_NS_ID, "message", true);
  45646. this.msgId = null;
  45647. this.severity = null;
  45648. }
  45649. }
  45650. class Messaging extends XFAObject {
  45651. constructor(attributes) {
  45652. super(CONFIG_NS_ID, "messaging", true);
  45653. this.message = new XFAObjectArray();
  45654. }
  45655. }
  45656. class Mode extends OptionObject {
  45657. constructor(attributes) {
  45658. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  45659. }
  45660. }
  45661. class ModifyAnnots extends Option01 {
  45662. constructor(attributes) {
  45663. super(CONFIG_NS_ID, "modifyAnnots");
  45664. }
  45665. }
  45666. class MsgId extends IntegerObject {
  45667. constructor(attributes) {
  45668. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  45669. }
  45670. }
  45671. class NameAttr extends StringObject {
  45672. constructor(attributes) {
  45673. super(CONFIG_NS_ID, "nameAttr");
  45674. }
  45675. }
  45676. class NeverEmbed extends ContentObject {
  45677. constructor(attributes) {
  45678. super(CONFIG_NS_ID, "neverEmbed");
  45679. }
  45680. }
  45681. class NumberOfCopies extends IntegerObject {
  45682. constructor(attributes) {
  45683. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  45684. }
  45685. }
  45686. class OpenAction extends XFAObject {
  45687. constructor(attributes) {
  45688. super(CONFIG_NS_ID, "openAction", true);
  45689. this.destination = null;
  45690. }
  45691. }
  45692. class Output extends XFAObject {
  45693. constructor(attributes) {
  45694. super(CONFIG_NS_ID, "output", true);
  45695. this.to = null;
  45696. this.type = null;
  45697. this.uri = null;
  45698. }
  45699. }
  45700. class OutputBin extends StringObject {
  45701. constructor(attributes) {
  45702. super(CONFIG_NS_ID, "outputBin");
  45703. }
  45704. }
  45705. class OutputXSL extends XFAObject {
  45706. constructor(attributes) {
  45707. super(CONFIG_NS_ID, "outputXSL", true);
  45708. this.uri = null;
  45709. }
  45710. }
  45711. class Overprint extends OptionObject {
  45712. constructor(attributes) {
  45713. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  45714. }
  45715. }
  45716. class Packets extends StringObject {
  45717. constructor(attributes) {
  45718. super(CONFIG_NS_ID, "packets");
  45719. }
  45720. [$finalize]() {
  45721. if (this[$content] === "*") {
  45722. return;
  45723. }
  45724. this[$content] = this[$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  45725. }
  45726. }
  45727. class PageOffset extends XFAObject {
  45728. constructor(attributes) {
  45729. super(CONFIG_NS_ID, "pageOffset");
  45730. this.x = getInteger({
  45731. data: attributes.x,
  45732. defaultValue: "useXDCSetting",
  45733. validate: n => true
  45734. });
  45735. this.y = getInteger({
  45736. data: attributes.y,
  45737. defaultValue: "useXDCSetting",
  45738. validate: n => true
  45739. });
  45740. }
  45741. }
  45742. class PageRange extends StringObject {
  45743. constructor(attributes) {
  45744. super(CONFIG_NS_ID, "pageRange");
  45745. }
  45746. [$finalize]() {
  45747. const numbers = this[$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  45748. const ranges = [];
  45749. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  45750. ranges.push(numbers.slice(i, i + 2));
  45751. }
  45752. this[$content] = ranges;
  45753. }
  45754. }
  45755. class Pagination extends OptionObject {
  45756. constructor(attributes) {
  45757. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  45758. }
  45759. }
  45760. class PaginationOverride extends OptionObject {
  45761. constructor(attributes) {
  45762. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  45763. }
  45764. }
  45765. class Part extends IntegerObject {
  45766. constructor(attributes) {
  45767. super(CONFIG_NS_ID, "part", 1, n => false);
  45768. }
  45769. }
  45770. class Pcl extends XFAObject {
  45771. constructor(attributes) {
  45772. super(CONFIG_NS_ID, "pcl", true);
  45773. this.name = attributes.name || "";
  45774. this.batchOutput = null;
  45775. this.fontInfo = null;
  45776. this.jog = null;
  45777. this.mediumInfo = null;
  45778. this.outputBin = null;
  45779. this.pageOffset = null;
  45780. this.staple = null;
  45781. this.xdc = null;
  45782. }
  45783. }
  45784. class Pdf extends XFAObject {
  45785. constructor(attributes) {
  45786. super(CONFIG_NS_ID, "pdf", true);
  45787. this.name = attributes.name || "";
  45788. this.adobeExtensionLevel = null;
  45789. this.batchOutput = null;
  45790. this.compression = null;
  45791. this.creator = null;
  45792. this.encryption = null;
  45793. this.fontInfo = null;
  45794. this.interactive = null;
  45795. this.linearized = null;
  45796. this.openAction = null;
  45797. this.pdfa = null;
  45798. this.producer = null;
  45799. this.renderPolicy = null;
  45800. this.scriptModel = null;
  45801. this.silentPrint = null;
  45802. this.submitFormat = null;
  45803. this.tagged = null;
  45804. this.version = null;
  45805. this.viewerPreferences = null;
  45806. this.xdc = null;
  45807. }
  45808. }
  45809. class Pdfa extends XFAObject {
  45810. constructor(attributes) {
  45811. super(CONFIG_NS_ID, "pdfa", true);
  45812. this.amd = null;
  45813. this.conformance = null;
  45814. this.includeXDPContent = null;
  45815. this.part = null;
  45816. }
  45817. }
  45818. class Permissions extends XFAObject {
  45819. constructor(attributes) {
  45820. super(CONFIG_NS_ID, "permissions", true);
  45821. this.accessibleContent = null;
  45822. this.change = null;
  45823. this.contentCopy = null;
  45824. this.documentAssembly = null;
  45825. this.formFieldFilling = null;
  45826. this.modifyAnnots = null;
  45827. this.plaintextMetadata = null;
  45828. this.print = null;
  45829. this.printHighQuality = null;
  45830. }
  45831. }
  45832. class PickTrayByPDFSize extends Option01 {
  45833. constructor(attributes) {
  45834. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  45835. }
  45836. }
  45837. class config_Picture extends StringObject {
  45838. constructor(attributes) {
  45839. super(CONFIG_NS_ID, "picture");
  45840. }
  45841. }
  45842. class PlaintextMetadata extends Option01 {
  45843. constructor(attributes) {
  45844. super(CONFIG_NS_ID, "plaintextMetadata");
  45845. }
  45846. }
  45847. class Presence extends OptionObject {
  45848. constructor(attributes) {
  45849. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  45850. }
  45851. }
  45852. class Present extends XFAObject {
  45853. constructor(attributes) {
  45854. super(CONFIG_NS_ID, "present", true);
  45855. this.behaviorOverride = null;
  45856. this.cache = null;
  45857. this.common = null;
  45858. this.copies = null;
  45859. this.destination = null;
  45860. this.incrementalMerge = null;
  45861. this.layout = null;
  45862. this.output = null;
  45863. this.overprint = null;
  45864. this.pagination = null;
  45865. this.paginationOverride = null;
  45866. this.script = null;
  45867. this.validate = null;
  45868. this.xdp = null;
  45869. this.driver = new XFAObjectArray();
  45870. this.labelPrinter = new XFAObjectArray();
  45871. this.pcl = new XFAObjectArray();
  45872. this.pdf = new XFAObjectArray();
  45873. this.ps = new XFAObjectArray();
  45874. this.submitUrl = new XFAObjectArray();
  45875. this.webClient = new XFAObjectArray();
  45876. this.zpl = new XFAObjectArray();
  45877. }
  45878. }
  45879. class Print extends Option01 {
  45880. constructor(attributes) {
  45881. super(CONFIG_NS_ID, "print");
  45882. }
  45883. }
  45884. class PrintHighQuality extends Option01 {
  45885. constructor(attributes) {
  45886. super(CONFIG_NS_ID, "printHighQuality");
  45887. }
  45888. }
  45889. class PrintScaling extends OptionObject {
  45890. constructor(attributes) {
  45891. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  45892. }
  45893. }
  45894. class PrinterName extends StringObject {
  45895. constructor(attributes) {
  45896. super(CONFIG_NS_ID, "printerName");
  45897. }
  45898. }
  45899. class Producer extends StringObject {
  45900. constructor(attributes) {
  45901. super(CONFIG_NS_ID, "producer");
  45902. }
  45903. }
  45904. class Ps extends XFAObject {
  45905. constructor(attributes) {
  45906. super(CONFIG_NS_ID, "ps", true);
  45907. this.name = attributes.name || "";
  45908. this.batchOutput = null;
  45909. this.fontInfo = null;
  45910. this.jog = null;
  45911. this.mediumInfo = null;
  45912. this.outputBin = null;
  45913. this.staple = null;
  45914. this.xdc = null;
  45915. }
  45916. }
  45917. class Range extends ContentObject {
  45918. constructor(attributes) {
  45919. super(CONFIG_NS_ID, "range");
  45920. }
  45921. [$finalize]() {
  45922. this[$content] = this[$content].trim().split(/\s*,\s*/, 2).map(range => range.split("-").map(x => parseInt(x.trim(), 10))).filter(range => range.every(x => !isNaN(x))).map(range => {
  45923. if (range.length === 1) {
  45924. range.push(range[0]);
  45925. }
  45926. return range;
  45927. });
  45928. }
  45929. }
  45930. class Record extends ContentObject {
  45931. constructor(attributes) {
  45932. super(CONFIG_NS_ID, "record");
  45933. }
  45934. [$finalize]() {
  45935. this[$content] = this[$content].trim();
  45936. const n = parseInt(this[$content], 10);
  45937. if (!isNaN(n) && n >= 0) {
  45938. this[$content] = n;
  45939. }
  45940. }
  45941. }
  45942. class Relevant extends ContentObject {
  45943. constructor(attributes) {
  45944. super(CONFIG_NS_ID, "relevant");
  45945. }
  45946. [$finalize]() {
  45947. this[$content] = this[$content].trim().split(/\s+/);
  45948. }
  45949. }
  45950. class Rename extends ContentObject {
  45951. constructor(attributes) {
  45952. super(CONFIG_NS_ID, "rename");
  45953. }
  45954. [$finalize]() {
  45955. this[$content] = this[$content].trim();
  45956. if (this[$content].toLowerCase().startsWith("xml") || new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u").test(this[$content])) {
  45957. warn("XFA - Rename: invalid XFA name");
  45958. }
  45959. }
  45960. }
  45961. class RenderPolicy extends OptionObject {
  45962. constructor(attributes) {
  45963. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  45964. }
  45965. }
  45966. class RunScripts extends OptionObject {
  45967. constructor(attributes) {
  45968. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  45969. }
  45970. }
  45971. class config_Script extends XFAObject {
  45972. constructor(attributes) {
  45973. super(CONFIG_NS_ID, "script", true);
  45974. this.currentPage = null;
  45975. this.exclude = null;
  45976. this.runScripts = null;
  45977. }
  45978. }
  45979. class ScriptModel extends OptionObject {
  45980. constructor(attributes) {
  45981. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  45982. }
  45983. }
  45984. class Severity extends OptionObject {
  45985. constructor(attributes) {
  45986. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  45987. }
  45988. }
  45989. class SilentPrint extends XFAObject {
  45990. constructor(attributes) {
  45991. super(CONFIG_NS_ID, "silentPrint", true);
  45992. this.addSilentPrint = null;
  45993. this.printerName = null;
  45994. }
  45995. }
  45996. class Staple extends XFAObject {
  45997. constructor(attributes) {
  45998. super(CONFIG_NS_ID, "staple");
  45999. this.mode = getStringOption(attributes.mode, ["usePrinterSetting", "on", "off"]);
  46000. }
  46001. }
  46002. class StartNode extends StringObject {
  46003. constructor(attributes) {
  46004. super(CONFIG_NS_ID, "startNode");
  46005. }
  46006. }
  46007. class StartPage extends IntegerObject {
  46008. constructor(attributes) {
  46009. super(CONFIG_NS_ID, "startPage", 0, n => true);
  46010. }
  46011. }
  46012. class SubmitFormat extends OptionObject {
  46013. constructor(attributes) {
  46014. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  46015. }
  46016. }
  46017. class SubmitUrl extends StringObject {
  46018. constructor(attributes) {
  46019. super(CONFIG_NS_ID, "submitUrl");
  46020. }
  46021. }
  46022. class SubsetBelow extends IntegerObject {
  46023. constructor(attributes) {
  46024. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  46025. }
  46026. }
  46027. class SuppressBanner extends Option01 {
  46028. constructor(attributes) {
  46029. super(CONFIG_NS_ID, "suppressBanner");
  46030. }
  46031. }
  46032. class Tagged extends Option01 {
  46033. constructor(attributes) {
  46034. super(CONFIG_NS_ID, "tagged");
  46035. }
  46036. }
  46037. class config_Template extends XFAObject {
  46038. constructor(attributes) {
  46039. super(CONFIG_NS_ID, "template", true);
  46040. this.base = null;
  46041. this.relevant = null;
  46042. this.startPage = null;
  46043. this.uri = null;
  46044. this.xsl = null;
  46045. }
  46046. }
  46047. class Threshold extends OptionObject {
  46048. constructor(attributes) {
  46049. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  46050. }
  46051. }
  46052. class To extends OptionObject {
  46053. constructor(attributes) {
  46054. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  46055. }
  46056. }
  46057. class TemplateCache extends XFAObject {
  46058. constructor(attributes) {
  46059. super(CONFIG_NS_ID, "templateCache");
  46060. this.maxEntries = getInteger({
  46061. data: attributes.maxEntries,
  46062. defaultValue: 5,
  46063. validate: n => n >= 0
  46064. });
  46065. }
  46066. }
  46067. class Trace extends XFAObject {
  46068. constructor(attributes) {
  46069. super(CONFIG_NS_ID, "trace", true);
  46070. this.area = new XFAObjectArray();
  46071. }
  46072. }
  46073. class Transform extends XFAObject {
  46074. constructor(attributes) {
  46075. super(CONFIG_NS_ID, "transform", true);
  46076. this.groupParent = null;
  46077. this.ifEmpty = null;
  46078. this.nameAttr = null;
  46079. this.picture = null;
  46080. this.presence = null;
  46081. this.rename = null;
  46082. this.whitespace = null;
  46083. }
  46084. }
  46085. class Type extends OptionObject {
  46086. constructor(attributes) {
  46087. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  46088. }
  46089. }
  46090. class Uri extends StringObject {
  46091. constructor(attributes) {
  46092. super(CONFIG_NS_ID, "uri");
  46093. }
  46094. }
  46095. class config_Validate extends OptionObject {
  46096. constructor(attributes) {
  46097. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  46098. }
  46099. }
  46100. class ValidateApprovalSignatures extends ContentObject {
  46101. constructor(attributes) {
  46102. super(CONFIG_NS_ID, "validateApprovalSignatures");
  46103. }
  46104. [$finalize]() {
  46105. this[$content] = this[$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  46106. }
  46107. }
  46108. class ValidationMessaging extends OptionObject {
  46109. constructor(attributes) {
  46110. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  46111. }
  46112. }
  46113. class Version extends OptionObject {
  46114. constructor(attributes) {
  46115. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  46116. }
  46117. }
  46118. class VersionControl extends XFAObject {
  46119. constructor(attributes) {
  46120. super(CONFIG_NS_ID, "VersionControl");
  46121. this.outputBelow = getStringOption(attributes.outputBelow, ["warn", "error", "update"]);
  46122. this.sourceAbove = getStringOption(attributes.sourceAbove, ["warn", "error"]);
  46123. this.sourceBelow = getStringOption(attributes.sourceBelow, ["update", "maintain"]);
  46124. }
  46125. }
  46126. class ViewerPreferences extends XFAObject {
  46127. constructor(attributes) {
  46128. super(CONFIG_NS_ID, "viewerPreferences", true);
  46129. this.ADBE_JSConsole = null;
  46130. this.ADBE_JSDebugger = null;
  46131. this.addViewerPreferences = null;
  46132. this.duplexOption = null;
  46133. this.enforce = null;
  46134. this.numberOfCopies = null;
  46135. this.pageRange = null;
  46136. this.pickTrayByPDFSize = null;
  46137. this.printScaling = null;
  46138. }
  46139. }
  46140. class WebClient extends XFAObject {
  46141. constructor(attributes) {
  46142. super(CONFIG_NS_ID, "webClient", true);
  46143. this.name = attributes.name ? attributes.name.trim() : "";
  46144. this.fontInfo = null;
  46145. this.xdc = null;
  46146. }
  46147. }
  46148. class Whitespace extends OptionObject {
  46149. constructor(attributes) {
  46150. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  46151. }
  46152. }
  46153. class Window extends ContentObject {
  46154. constructor(attributes) {
  46155. super(CONFIG_NS_ID, "window");
  46156. }
  46157. [$finalize]() {
  46158. const pair = this[$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  46159. if (pair.some(x => isNaN(x))) {
  46160. this[$content] = [0, 0];
  46161. return;
  46162. }
  46163. if (pair.length === 1) {
  46164. pair.push(pair[0]);
  46165. }
  46166. this[$content] = pair;
  46167. }
  46168. }
  46169. class Xdc extends XFAObject {
  46170. constructor(attributes) {
  46171. super(CONFIG_NS_ID, "xdc", true);
  46172. this.uri = new XFAObjectArray();
  46173. this.xsl = new XFAObjectArray();
  46174. }
  46175. }
  46176. class Xdp extends XFAObject {
  46177. constructor(attributes) {
  46178. super(CONFIG_NS_ID, "xdp", true);
  46179. this.packets = null;
  46180. }
  46181. }
  46182. class Xsl extends XFAObject {
  46183. constructor(attributes) {
  46184. super(CONFIG_NS_ID, "xsl", true);
  46185. this.debug = null;
  46186. this.uri = null;
  46187. }
  46188. }
  46189. class Zpl extends XFAObject {
  46190. constructor(attributes) {
  46191. super(CONFIG_NS_ID, "zpl", true);
  46192. this.name = attributes.name ? attributes.name.trim() : "";
  46193. this.batchOutput = null;
  46194. this.flipLabel = null;
  46195. this.fontInfo = null;
  46196. this.xdc = null;
  46197. }
  46198. }
  46199. class ConfigNamespace {
  46200. static [$buildXFAObject](name, attributes) {
  46201. if (ConfigNamespace.hasOwnProperty(name)) {
  46202. return ConfigNamespace[name](attributes);
  46203. }
  46204. return undefined;
  46205. }
  46206. static acrobat(attrs) {
  46207. return new Acrobat(attrs);
  46208. }
  46209. static acrobat7(attrs) {
  46210. return new Acrobat7(attrs);
  46211. }
  46212. static ADBE_JSConsole(attrs) {
  46213. return new ADBE_JSConsole(attrs);
  46214. }
  46215. static ADBE_JSDebugger(attrs) {
  46216. return new ADBE_JSDebugger(attrs);
  46217. }
  46218. static addSilentPrint(attrs) {
  46219. return new AddSilentPrint(attrs);
  46220. }
  46221. static addViewerPreferences(attrs) {
  46222. return new AddViewerPreferences(attrs);
  46223. }
  46224. static adjustData(attrs) {
  46225. return new AdjustData(attrs);
  46226. }
  46227. static adobeExtensionLevel(attrs) {
  46228. return new AdobeExtensionLevel(attrs);
  46229. }
  46230. static agent(attrs) {
  46231. return new Agent(attrs);
  46232. }
  46233. static alwaysEmbed(attrs) {
  46234. return new AlwaysEmbed(attrs);
  46235. }
  46236. static amd(attrs) {
  46237. return new Amd(attrs);
  46238. }
  46239. static area(attrs) {
  46240. return new config_Area(attrs);
  46241. }
  46242. static attributes(attrs) {
  46243. return new Attributes(attrs);
  46244. }
  46245. static autoSave(attrs) {
  46246. return new AutoSave(attrs);
  46247. }
  46248. static base(attrs) {
  46249. return new Base(attrs);
  46250. }
  46251. static batchOutput(attrs) {
  46252. return new BatchOutput(attrs);
  46253. }
  46254. static behaviorOverride(attrs) {
  46255. return new BehaviorOverride(attrs);
  46256. }
  46257. static cache(attrs) {
  46258. return new Cache(attrs);
  46259. }
  46260. static change(attrs) {
  46261. return new Change(attrs);
  46262. }
  46263. static common(attrs) {
  46264. return new Common(attrs);
  46265. }
  46266. static compress(attrs) {
  46267. return new Compress(attrs);
  46268. }
  46269. static compressLogicalStructure(attrs) {
  46270. return new CompressLogicalStructure(attrs);
  46271. }
  46272. static compressObjectStream(attrs) {
  46273. return new CompressObjectStream(attrs);
  46274. }
  46275. static compression(attrs) {
  46276. return new Compression(attrs);
  46277. }
  46278. static config(attrs) {
  46279. return new Config(attrs);
  46280. }
  46281. static conformance(attrs) {
  46282. return new Conformance(attrs);
  46283. }
  46284. static contentCopy(attrs) {
  46285. return new ContentCopy(attrs);
  46286. }
  46287. static copies(attrs) {
  46288. return new Copies(attrs);
  46289. }
  46290. static creator(attrs) {
  46291. return new Creator(attrs);
  46292. }
  46293. static currentPage(attrs) {
  46294. return new CurrentPage(attrs);
  46295. }
  46296. static data(attrs) {
  46297. return new Data(attrs);
  46298. }
  46299. static debug(attrs) {
  46300. return new Debug(attrs);
  46301. }
  46302. static defaultTypeface(attrs) {
  46303. return new DefaultTypeface(attrs);
  46304. }
  46305. static destination(attrs) {
  46306. return new Destination(attrs);
  46307. }
  46308. static documentAssembly(attrs) {
  46309. return new DocumentAssembly(attrs);
  46310. }
  46311. static driver(attrs) {
  46312. return new Driver(attrs);
  46313. }
  46314. static duplexOption(attrs) {
  46315. return new DuplexOption(attrs);
  46316. }
  46317. static dynamicRender(attrs) {
  46318. return new DynamicRender(attrs);
  46319. }
  46320. static embed(attrs) {
  46321. return new Embed(attrs);
  46322. }
  46323. static encrypt(attrs) {
  46324. return new config_Encrypt(attrs);
  46325. }
  46326. static encryption(attrs) {
  46327. return new config_Encryption(attrs);
  46328. }
  46329. static encryptionLevel(attrs) {
  46330. return new EncryptionLevel(attrs);
  46331. }
  46332. static enforce(attrs) {
  46333. return new Enforce(attrs);
  46334. }
  46335. static equate(attrs) {
  46336. return new Equate(attrs);
  46337. }
  46338. static equateRange(attrs) {
  46339. return new EquateRange(attrs);
  46340. }
  46341. static exclude(attrs) {
  46342. return new Exclude(attrs);
  46343. }
  46344. static excludeNS(attrs) {
  46345. return new ExcludeNS(attrs);
  46346. }
  46347. static flipLabel(attrs) {
  46348. return new FlipLabel(attrs);
  46349. }
  46350. static fontInfo(attrs) {
  46351. return new config_FontInfo(attrs);
  46352. }
  46353. static formFieldFilling(attrs) {
  46354. return new FormFieldFilling(attrs);
  46355. }
  46356. static groupParent(attrs) {
  46357. return new GroupParent(attrs);
  46358. }
  46359. static ifEmpty(attrs) {
  46360. return new IfEmpty(attrs);
  46361. }
  46362. static includeXDPContent(attrs) {
  46363. return new IncludeXDPContent(attrs);
  46364. }
  46365. static incrementalLoad(attrs) {
  46366. return new IncrementalLoad(attrs);
  46367. }
  46368. static incrementalMerge(attrs) {
  46369. return new IncrementalMerge(attrs);
  46370. }
  46371. static interactive(attrs) {
  46372. return new Interactive(attrs);
  46373. }
  46374. static jog(attrs) {
  46375. return new Jog(attrs);
  46376. }
  46377. static labelPrinter(attrs) {
  46378. return new LabelPrinter(attrs);
  46379. }
  46380. static layout(attrs) {
  46381. return new Layout(attrs);
  46382. }
  46383. static level(attrs) {
  46384. return new Level(attrs);
  46385. }
  46386. static linearized(attrs) {
  46387. return new Linearized(attrs);
  46388. }
  46389. static locale(attrs) {
  46390. return new Locale(attrs);
  46391. }
  46392. static localeSet(attrs) {
  46393. return new LocaleSet(attrs);
  46394. }
  46395. static log(attrs) {
  46396. return new Log(attrs);
  46397. }
  46398. static map(attrs) {
  46399. return new MapElement(attrs);
  46400. }
  46401. static mediumInfo(attrs) {
  46402. return new MediumInfo(attrs);
  46403. }
  46404. static message(attrs) {
  46405. return new config_Message(attrs);
  46406. }
  46407. static messaging(attrs) {
  46408. return new Messaging(attrs);
  46409. }
  46410. static mode(attrs) {
  46411. return new Mode(attrs);
  46412. }
  46413. static modifyAnnots(attrs) {
  46414. return new ModifyAnnots(attrs);
  46415. }
  46416. static msgId(attrs) {
  46417. return new MsgId(attrs);
  46418. }
  46419. static nameAttr(attrs) {
  46420. return new NameAttr(attrs);
  46421. }
  46422. static neverEmbed(attrs) {
  46423. return new NeverEmbed(attrs);
  46424. }
  46425. static numberOfCopies(attrs) {
  46426. return new NumberOfCopies(attrs);
  46427. }
  46428. static openAction(attrs) {
  46429. return new OpenAction(attrs);
  46430. }
  46431. static output(attrs) {
  46432. return new Output(attrs);
  46433. }
  46434. static outputBin(attrs) {
  46435. return new OutputBin(attrs);
  46436. }
  46437. static outputXSL(attrs) {
  46438. return new OutputXSL(attrs);
  46439. }
  46440. static overprint(attrs) {
  46441. return new Overprint(attrs);
  46442. }
  46443. static packets(attrs) {
  46444. return new Packets(attrs);
  46445. }
  46446. static pageOffset(attrs) {
  46447. return new PageOffset(attrs);
  46448. }
  46449. static pageRange(attrs) {
  46450. return new PageRange(attrs);
  46451. }
  46452. static pagination(attrs) {
  46453. return new Pagination(attrs);
  46454. }
  46455. static paginationOverride(attrs) {
  46456. return new PaginationOverride(attrs);
  46457. }
  46458. static part(attrs) {
  46459. return new Part(attrs);
  46460. }
  46461. static pcl(attrs) {
  46462. return new Pcl(attrs);
  46463. }
  46464. static pdf(attrs) {
  46465. return new Pdf(attrs);
  46466. }
  46467. static pdfa(attrs) {
  46468. return new Pdfa(attrs);
  46469. }
  46470. static permissions(attrs) {
  46471. return new Permissions(attrs);
  46472. }
  46473. static pickTrayByPDFSize(attrs) {
  46474. return new PickTrayByPDFSize(attrs);
  46475. }
  46476. static picture(attrs) {
  46477. return new config_Picture(attrs);
  46478. }
  46479. static plaintextMetadata(attrs) {
  46480. return new PlaintextMetadata(attrs);
  46481. }
  46482. static presence(attrs) {
  46483. return new Presence(attrs);
  46484. }
  46485. static present(attrs) {
  46486. return new Present(attrs);
  46487. }
  46488. static print(attrs) {
  46489. return new Print(attrs);
  46490. }
  46491. static printHighQuality(attrs) {
  46492. return new PrintHighQuality(attrs);
  46493. }
  46494. static printScaling(attrs) {
  46495. return new PrintScaling(attrs);
  46496. }
  46497. static printerName(attrs) {
  46498. return new PrinterName(attrs);
  46499. }
  46500. static producer(attrs) {
  46501. return new Producer(attrs);
  46502. }
  46503. static ps(attrs) {
  46504. return new Ps(attrs);
  46505. }
  46506. static range(attrs) {
  46507. return new Range(attrs);
  46508. }
  46509. static record(attrs) {
  46510. return new Record(attrs);
  46511. }
  46512. static relevant(attrs) {
  46513. return new Relevant(attrs);
  46514. }
  46515. static rename(attrs) {
  46516. return new Rename(attrs);
  46517. }
  46518. static renderPolicy(attrs) {
  46519. return new RenderPolicy(attrs);
  46520. }
  46521. static runScripts(attrs) {
  46522. return new RunScripts(attrs);
  46523. }
  46524. static script(attrs) {
  46525. return new config_Script(attrs);
  46526. }
  46527. static scriptModel(attrs) {
  46528. return new ScriptModel(attrs);
  46529. }
  46530. static severity(attrs) {
  46531. return new Severity(attrs);
  46532. }
  46533. static silentPrint(attrs) {
  46534. return new SilentPrint(attrs);
  46535. }
  46536. static staple(attrs) {
  46537. return new Staple(attrs);
  46538. }
  46539. static startNode(attrs) {
  46540. return new StartNode(attrs);
  46541. }
  46542. static startPage(attrs) {
  46543. return new StartPage(attrs);
  46544. }
  46545. static submitFormat(attrs) {
  46546. return new SubmitFormat(attrs);
  46547. }
  46548. static submitUrl(attrs) {
  46549. return new SubmitUrl(attrs);
  46550. }
  46551. static subsetBelow(attrs) {
  46552. return new SubsetBelow(attrs);
  46553. }
  46554. static suppressBanner(attrs) {
  46555. return new SuppressBanner(attrs);
  46556. }
  46557. static tagged(attrs) {
  46558. return new Tagged(attrs);
  46559. }
  46560. static template(attrs) {
  46561. return new config_Template(attrs);
  46562. }
  46563. static templateCache(attrs) {
  46564. return new TemplateCache(attrs);
  46565. }
  46566. static threshold(attrs) {
  46567. return new Threshold(attrs);
  46568. }
  46569. static to(attrs) {
  46570. return new To(attrs);
  46571. }
  46572. static trace(attrs) {
  46573. return new Trace(attrs);
  46574. }
  46575. static transform(attrs) {
  46576. return new Transform(attrs);
  46577. }
  46578. static type(attrs) {
  46579. return new Type(attrs);
  46580. }
  46581. static uri(attrs) {
  46582. return new Uri(attrs);
  46583. }
  46584. static validate(attrs) {
  46585. return new config_Validate(attrs);
  46586. }
  46587. static validateApprovalSignatures(attrs) {
  46588. return new ValidateApprovalSignatures(attrs);
  46589. }
  46590. static validationMessaging(attrs) {
  46591. return new ValidationMessaging(attrs);
  46592. }
  46593. static version(attrs) {
  46594. return new Version(attrs);
  46595. }
  46596. static versionControl(attrs) {
  46597. return new VersionControl(attrs);
  46598. }
  46599. static viewerPreferences(attrs) {
  46600. return new ViewerPreferences(attrs);
  46601. }
  46602. static webClient(attrs) {
  46603. return new WebClient(attrs);
  46604. }
  46605. static whitespace(attrs) {
  46606. return new Whitespace(attrs);
  46607. }
  46608. static window(attrs) {
  46609. return new Window(attrs);
  46610. }
  46611. static xdc(attrs) {
  46612. return new Xdc(attrs);
  46613. }
  46614. static xdp(attrs) {
  46615. return new Xdp(attrs);
  46616. }
  46617. static xsl(attrs) {
  46618. return new Xsl(attrs);
  46619. }
  46620. static zpl(attrs) {
  46621. return new Zpl(attrs);
  46622. }
  46623. }
  46624. ;// ./src/core/xfa/connection_set.js
  46625. const CONNECTION_SET_NS_ID = NamespaceIds.connectionSet.id;
  46626. class ConnectionSet extends XFAObject {
  46627. constructor(attributes) {
  46628. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  46629. this.wsdlConnection = new XFAObjectArray();
  46630. this.xmlConnection = new XFAObjectArray();
  46631. this.xsdConnection = new XFAObjectArray();
  46632. }
  46633. }
  46634. class EffectiveInputPolicy extends XFAObject {
  46635. constructor(attributes) {
  46636. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  46637. this.id = attributes.id || "";
  46638. this.name = attributes.name || "";
  46639. this.use = attributes.use || "";
  46640. this.usehref = attributes.usehref || "";
  46641. }
  46642. }
  46643. class EffectiveOutputPolicy extends XFAObject {
  46644. constructor(attributes) {
  46645. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  46646. this.id = attributes.id || "";
  46647. this.name = attributes.name || "";
  46648. this.use = attributes.use || "";
  46649. this.usehref = attributes.usehref || "";
  46650. }
  46651. }
  46652. class Operation extends StringObject {
  46653. constructor(attributes) {
  46654. super(CONNECTION_SET_NS_ID, "operation");
  46655. this.id = attributes.id || "";
  46656. this.input = attributes.input || "";
  46657. this.name = attributes.name || "";
  46658. this.output = attributes.output || "";
  46659. this.use = attributes.use || "";
  46660. this.usehref = attributes.usehref || "";
  46661. }
  46662. }
  46663. class RootElement extends StringObject {
  46664. constructor(attributes) {
  46665. super(CONNECTION_SET_NS_ID, "rootElement");
  46666. this.id = attributes.id || "";
  46667. this.name = attributes.name || "";
  46668. this.use = attributes.use || "";
  46669. this.usehref = attributes.usehref || "";
  46670. }
  46671. }
  46672. class SoapAction extends StringObject {
  46673. constructor(attributes) {
  46674. super(CONNECTION_SET_NS_ID, "soapAction");
  46675. this.id = attributes.id || "";
  46676. this.name = attributes.name || "";
  46677. this.use = attributes.use || "";
  46678. this.usehref = attributes.usehref || "";
  46679. }
  46680. }
  46681. class SoapAddress extends StringObject {
  46682. constructor(attributes) {
  46683. super(CONNECTION_SET_NS_ID, "soapAddress");
  46684. this.id = attributes.id || "";
  46685. this.name = attributes.name || "";
  46686. this.use = attributes.use || "";
  46687. this.usehref = attributes.usehref || "";
  46688. }
  46689. }
  46690. class connection_set_Uri extends StringObject {
  46691. constructor(attributes) {
  46692. super(CONNECTION_SET_NS_ID, "uri");
  46693. this.id = attributes.id || "";
  46694. this.name = attributes.name || "";
  46695. this.use = attributes.use || "";
  46696. this.usehref = attributes.usehref || "";
  46697. }
  46698. }
  46699. class WsdlAddress extends StringObject {
  46700. constructor(attributes) {
  46701. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  46702. this.id = attributes.id || "";
  46703. this.name = attributes.name || "";
  46704. this.use = attributes.use || "";
  46705. this.usehref = attributes.usehref || "";
  46706. }
  46707. }
  46708. class WsdlConnection extends XFAObject {
  46709. constructor(attributes) {
  46710. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  46711. this.dataDescription = attributes.dataDescription || "";
  46712. this.name = attributes.name || "";
  46713. this.effectiveInputPolicy = null;
  46714. this.effectiveOutputPolicy = null;
  46715. this.operation = null;
  46716. this.soapAction = null;
  46717. this.soapAddress = null;
  46718. this.wsdlAddress = null;
  46719. }
  46720. }
  46721. class XmlConnection extends XFAObject {
  46722. constructor(attributes) {
  46723. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  46724. this.dataDescription = attributes.dataDescription || "";
  46725. this.name = attributes.name || "";
  46726. this.uri = null;
  46727. }
  46728. }
  46729. class XsdConnection extends XFAObject {
  46730. constructor(attributes) {
  46731. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  46732. this.dataDescription = attributes.dataDescription || "";
  46733. this.name = attributes.name || "";
  46734. this.rootElement = null;
  46735. this.uri = null;
  46736. }
  46737. }
  46738. class ConnectionSetNamespace {
  46739. static [$buildXFAObject](name, attributes) {
  46740. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  46741. return ConnectionSetNamespace[name](attributes);
  46742. }
  46743. return undefined;
  46744. }
  46745. static connectionSet(attrs) {
  46746. return new ConnectionSet(attrs);
  46747. }
  46748. static effectiveInputPolicy(attrs) {
  46749. return new EffectiveInputPolicy(attrs);
  46750. }
  46751. static effectiveOutputPolicy(attrs) {
  46752. return new EffectiveOutputPolicy(attrs);
  46753. }
  46754. static operation(attrs) {
  46755. return new Operation(attrs);
  46756. }
  46757. static rootElement(attrs) {
  46758. return new RootElement(attrs);
  46759. }
  46760. static soapAction(attrs) {
  46761. return new SoapAction(attrs);
  46762. }
  46763. static soapAddress(attrs) {
  46764. return new SoapAddress(attrs);
  46765. }
  46766. static uri(attrs) {
  46767. return new connection_set_Uri(attrs);
  46768. }
  46769. static wsdlAddress(attrs) {
  46770. return new WsdlAddress(attrs);
  46771. }
  46772. static wsdlConnection(attrs) {
  46773. return new WsdlConnection(attrs);
  46774. }
  46775. static xmlConnection(attrs) {
  46776. return new XmlConnection(attrs);
  46777. }
  46778. static xsdConnection(attrs) {
  46779. return new XsdConnection(attrs);
  46780. }
  46781. }
  46782. ;// ./src/core/xfa/datasets.js
  46783. const DATASETS_NS_ID = NamespaceIds.datasets.id;
  46784. class datasets_Data extends XmlObject {
  46785. constructor(attributes) {
  46786. super(DATASETS_NS_ID, "data", attributes);
  46787. }
  46788. [$isNsAgnostic]() {
  46789. return true;
  46790. }
  46791. }
  46792. class Datasets extends XFAObject {
  46793. constructor(attributes) {
  46794. super(DATASETS_NS_ID, "datasets", true);
  46795. this.data = null;
  46796. this.Signature = null;
  46797. }
  46798. [$onChild](child) {
  46799. const name = child[$nodeName];
  46800. if (name === "data" && child[$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[$namespaceId] === NamespaceIds.signature.id) {
  46801. this[name] = child;
  46802. }
  46803. this[$appendChild](child);
  46804. }
  46805. }
  46806. class DatasetsNamespace {
  46807. static [$buildXFAObject](name, attributes) {
  46808. if (DatasetsNamespace.hasOwnProperty(name)) {
  46809. return DatasetsNamespace[name](attributes);
  46810. }
  46811. return undefined;
  46812. }
  46813. static datasets(attributes) {
  46814. return new Datasets(attributes);
  46815. }
  46816. static data(attributes) {
  46817. return new datasets_Data(attributes);
  46818. }
  46819. }
  46820. ;// ./src/core/xfa/locale_set.js
  46821. const LOCALE_SET_NS_ID = NamespaceIds.localeSet.id;
  46822. class CalendarSymbols extends XFAObject {
  46823. constructor(attributes) {
  46824. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  46825. this.name = "gregorian";
  46826. this.dayNames = new XFAObjectArray(2);
  46827. this.eraNames = null;
  46828. this.meridiemNames = null;
  46829. this.monthNames = new XFAObjectArray(2);
  46830. }
  46831. }
  46832. class CurrencySymbol extends StringObject {
  46833. constructor(attributes) {
  46834. super(LOCALE_SET_NS_ID, "currencySymbol");
  46835. this.name = getStringOption(attributes.name, ["symbol", "isoname", "decimal"]);
  46836. }
  46837. }
  46838. class CurrencySymbols extends XFAObject {
  46839. constructor(attributes) {
  46840. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  46841. this.currencySymbol = new XFAObjectArray(3);
  46842. }
  46843. }
  46844. class DatePattern extends StringObject {
  46845. constructor(attributes) {
  46846. super(LOCALE_SET_NS_ID, "datePattern");
  46847. this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
  46848. }
  46849. }
  46850. class DatePatterns extends XFAObject {
  46851. constructor(attributes) {
  46852. super(LOCALE_SET_NS_ID, "datePatterns", true);
  46853. this.datePattern = new XFAObjectArray(4);
  46854. }
  46855. }
  46856. class DateTimeSymbols extends ContentObject {
  46857. constructor(attributes) {
  46858. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  46859. }
  46860. }
  46861. class Day extends StringObject {
  46862. constructor(attributes) {
  46863. super(LOCALE_SET_NS_ID, "day");
  46864. }
  46865. }
  46866. class DayNames extends XFAObject {
  46867. constructor(attributes) {
  46868. super(LOCALE_SET_NS_ID, "dayNames", true);
  46869. this.abbr = getInteger({
  46870. data: attributes.abbr,
  46871. defaultValue: 0,
  46872. validate: x => x === 1
  46873. });
  46874. this.day = new XFAObjectArray(7);
  46875. }
  46876. }
  46877. class Era extends StringObject {
  46878. constructor(attributes) {
  46879. super(LOCALE_SET_NS_ID, "era");
  46880. }
  46881. }
  46882. class EraNames extends XFAObject {
  46883. constructor(attributes) {
  46884. super(LOCALE_SET_NS_ID, "eraNames", true);
  46885. this.era = new XFAObjectArray(2);
  46886. }
  46887. }
  46888. class locale_set_Locale extends XFAObject {
  46889. constructor(attributes) {
  46890. super(LOCALE_SET_NS_ID, "locale", true);
  46891. this.desc = attributes.desc || "";
  46892. this.name = "isoname";
  46893. this.calendarSymbols = null;
  46894. this.currencySymbols = null;
  46895. this.datePatterns = null;
  46896. this.dateTimeSymbols = null;
  46897. this.numberPatterns = null;
  46898. this.numberSymbols = null;
  46899. this.timePatterns = null;
  46900. this.typeFaces = null;
  46901. }
  46902. }
  46903. class locale_set_LocaleSet extends XFAObject {
  46904. constructor(attributes) {
  46905. super(LOCALE_SET_NS_ID, "localeSet", true);
  46906. this.locale = new XFAObjectArray();
  46907. }
  46908. }
  46909. class Meridiem extends StringObject {
  46910. constructor(attributes) {
  46911. super(LOCALE_SET_NS_ID, "meridiem");
  46912. }
  46913. }
  46914. class MeridiemNames extends XFAObject {
  46915. constructor(attributes) {
  46916. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  46917. this.meridiem = new XFAObjectArray(2);
  46918. }
  46919. }
  46920. class Month extends StringObject {
  46921. constructor(attributes) {
  46922. super(LOCALE_SET_NS_ID, "month");
  46923. }
  46924. }
  46925. class MonthNames extends XFAObject {
  46926. constructor(attributes) {
  46927. super(LOCALE_SET_NS_ID, "monthNames", true);
  46928. this.abbr = getInteger({
  46929. data: attributes.abbr,
  46930. defaultValue: 0,
  46931. validate: x => x === 1
  46932. });
  46933. this.month = new XFAObjectArray(12);
  46934. }
  46935. }
  46936. class NumberPattern extends StringObject {
  46937. constructor(attributes) {
  46938. super(LOCALE_SET_NS_ID, "numberPattern");
  46939. this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
  46940. }
  46941. }
  46942. class NumberPatterns extends XFAObject {
  46943. constructor(attributes) {
  46944. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  46945. this.numberPattern = new XFAObjectArray(4);
  46946. }
  46947. }
  46948. class NumberSymbol extends StringObject {
  46949. constructor(attributes) {
  46950. super(LOCALE_SET_NS_ID, "numberSymbol");
  46951. this.name = getStringOption(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  46952. }
  46953. }
  46954. class NumberSymbols extends XFAObject {
  46955. constructor(attributes) {
  46956. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  46957. this.numberSymbol = new XFAObjectArray(5);
  46958. }
  46959. }
  46960. class TimePattern extends StringObject {
  46961. constructor(attributes) {
  46962. super(LOCALE_SET_NS_ID, "timePattern");
  46963. this.name = getStringOption(attributes.name, ["full", "long", "med", "short"]);
  46964. }
  46965. }
  46966. class TimePatterns extends XFAObject {
  46967. constructor(attributes) {
  46968. super(LOCALE_SET_NS_ID, "timePatterns", true);
  46969. this.timePattern = new XFAObjectArray(4);
  46970. }
  46971. }
  46972. class TypeFace extends XFAObject {
  46973. constructor(attributes) {
  46974. super(LOCALE_SET_NS_ID, "typeFace", true);
  46975. this.name = attributes.name | "";
  46976. }
  46977. }
  46978. class TypeFaces extends XFAObject {
  46979. constructor(attributes) {
  46980. super(LOCALE_SET_NS_ID, "typeFaces", true);
  46981. this.typeFace = new XFAObjectArray();
  46982. }
  46983. }
  46984. class LocaleSetNamespace {
  46985. static [$buildXFAObject](name, attributes) {
  46986. if (LocaleSetNamespace.hasOwnProperty(name)) {
  46987. return LocaleSetNamespace[name](attributes);
  46988. }
  46989. return undefined;
  46990. }
  46991. static calendarSymbols(attrs) {
  46992. return new CalendarSymbols(attrs);
  46993. }
  46994. static currencySymbol(attrs) {
  46995. return new CurrencySymbol(attrs);
  46996. }
  46997. static currencySymbols(attrs) {
  46998. return new CurrencySymbols(attrs);
  46999. }
  47000. static datePattern(attrs) {
  47001. return new DatePattern(attrs);
  47002. }
  47003. static datePatterns(attrs) {
  47004. return new DatePatterns(attrs);
  47005. }
  47006. static dateTimeSymbols(attrs) {
  47007. return new DateTimeSymbols(attrs);
  47008. }
  47009. static day(attrs) {
  47010. return new Day(attrs);
  47011. }
  47012. static dayNames(attrs) {
  47013. return new DayNames(attrs);
  47014. }
  47015. static era(attrs) {
  47016. return new Era(attrs);
  47017. }
  47018. static eraNames(attrs) {
  47019. return new EraNames(attrs);
  47020. }
  47021. static locale(attrs) {
  47022. return new locale_set_Locale(attrs);
  47023. }
  47024. static localeSet(attrs) {
  47025. return new locale_set_LocaleSet(attrs);
  47026. }
  47027. static meridiem(attrs) {
  47028. return new Meridiem(attrs);
  47029. }
  47030. static meridiemNames(attrs) {
  47031. return new MeridiemNames(attrs);
  47032. }
  47033. static month(attrs) {
  47034. return new Month(attrs);
  47035. }
  47036. static monthNames(attrs) {
  47037. return new MonthNames(attrs);
  47038. }
  47039. static numberPattern(attrs) {
  47040. return new NumberPattern(attrs);
  47041. }
  47042. static numberPatterns(attrs) {
  47043. return new NumberPatterns(attrs);
  47044. }
  47045. static numberSymbol(attrs) {
  47046. return new NumberSymbol(attrs);
  47047. }
  47048. static numberSymbols(attrs) {
  47049. return new NumberSymbols(attrs);
  47050. }
  47051. static timePattern(attrs) {
  47052. return new TimePattern(attrs);
  47053. }
  47054. static timePatterns(attrs) {
  47055. return new TimePatterns(attrs);
  47056. }
  47057. static typeFace(attrs) {
  47058. return new TypeFace(attrs);
  47059. }
  47060. static typeFaces(attrs) {
  47061. return new TypeFaces(attrs);
  47062. }
  47063. }
  47064. ;// ./src/core/xfa/signature.js
  47065. const SIGNATURE_NS_ID = NamespaceIds.signature.id;
  47066. class signature_Signature extends XFAObject {
  47067. constructor(attributes) {
  47068. super(SIGNATURE_NS_ID, "signature", true);
  47069. }
  47070. }
  47071. class SignatureNamespace {
  47072. static [$buildXFAObject](name, attributes) {
  47073. if (SignatureNamespace.hasOwnProperty(name)) {
  47074. return SignatureNamespace[name](attributes);
  47075. }
  47076. return undefined;
  47077. }
  47078. static signature(attributes) {
  47079. return new signature_Signature(attributes);
  47080. }
  47081. }
  47082. ;// ./src/core/xfa/stylesheet.js
  47083. const STYLESHEET_NS_ID = NamespaceIds.stylesheet.id;
  47084. class Stylesheet extends XFAObject {
  47085. constructor(attributes) {
  47086. super(STYLESHEET_NS_ID, "stylesheet", true);
  47087. }
  47088. }
  47089. class StylesheetNamespace {
  47090. static [$buildXFAObject](name, attributes) {
  47091. if (StylesheetNamespace.hasOwnProperty(name)) {
  47092. return StylesheetNamespace[name](attributes);
  47093. }
  47094. return undefined;
  47095. }
  47096. static stylesheet(attributes) {
  47097. return new Stylesheet(attributes);
  47098. }
  47099. }
  47100. ;// ./src/core/xfa/xdp.js
  47101. const XDP_NS_ID = NamespaceIds.xdp.id;
  47102. class xdp_Xdp extends XFAObject {
  47103. constructor(attributes) {
  47104. super(XDP_NS_ID, "xdp", true);
  47105. this.uuid = attributes.uuid || "";
  47106. this.timeStamp = attributes.timeStamp || "";
  47107. this.config = null;
  47108. this.connectionSet = null;
  47109. this.datasets = null;
  47110. this.localeSet = null;
  47111. this.stylesheet = new XFAObjectArray();
  47112. this.template = null;
  47113. }
  47114. [$onChildCheck](child) {
  47115. const ns = NamespaceIds[child[$nodeName]];
  47116. return ns && child[$namespaceId] === ns.id;
  47117. }
  47118. }
  47119. class XdpNamespace {
  47120. static [$buildXFAObject](name, attributes) {
  47121. if (XdpNamespace.hasOwnProperty(name)) {
  47122. return XdpNamespace[name](attributes);
  47123. }
  47124. return undefined;
  47125. }
  47126. static xdp(attributes) {
  47127. return new xdp_Xdp(attributes);
  47128. }
  47129. }
  47130. ;// ./src/core/xfa/xhtml.js
  47131. const XHTML_NS_ID = NamespaceIds.xhtml.id;
  47132. const $richText = Symbol();
  47133. const VALID_STYLES = new Set(["color", "font", "font-family", "font-size", "font-stretch", "font-style", "font-weight", "margin", "margin-bottom", "margin-left", "margin-right", "margin-top", "letter-spacing", "line-height", "orphans", "page-break-after", "page-break-before", "page-break-inside", "tab-interval", "tab-stop", "text-align", "text-decoration", "text-indent", "vertical-align", "widows", "kerning-mode", "xfa-font-horizontal-scale", "xfa-font-vertical-scale", "xfa-spacerun", "xfa-tab-stops"]);
  47134. const StyleMapping = new Map([["page-break-after", "breakAfter"], ["page-break-before", "breakBefore"], ["page-break-inside", "breakInside"], ["kerning-mode", value => value === "none" ? "none" : "normal"], ["xfa-font-horizontal-scale", value => `scaleX(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-font-vertical-scale", value => `scaleY(${Math.max(0, Math.min(parseInt(value) / 100)).toFixed(2)})`], ["xfa-spacerun", ""], ["xfa-tab-stops", ""], ["font-size", (value, original) => {
  47135. value = original.fontSize = Math.abs(getMeasurement(value));
  47136. return measureToString(0.99 * value);
  47137. }], ["letter-spacing", value => measureToString(getMeasurement(value))], ["line-height", value => measureToString(getMeasurement(value))], ["margin", value => measureToString(getMeasurement(value))], ["margin-bottom", value => measureToString(getMeasurement(value))], ["margin-left", value => measureToString(getMeasurement(value))], ["margin-right", value => measureToString(getMeasurement(value))], ["margin-top", value => measureToString(getMeasurement(value))], ["text-indent", value => measureToString(getMeasurement(value))], ["font-family", value => value], ["vertical-align", value => measureToString(getMeasurement(value))]]);
  47138. const spacesRegExp = /\s+/g;
  47139. const crlfRegExp = /[\r\n]+/g;
  47140. const crlfForRichTextRegExp = /\r\n?/g;
  47141. function mapStyle(styleStr, node, richText) {
  47142. const style = Object.create(null);
  47143. if (!styleStr) {
  47144. return style;
  47145. }
  47146. const original = Object.create(null);
  47147. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  47148. const mapping = StyleMapping.get(key);
  47149. if (mapping === "") {
  47150. continue;
  47151. }
  47152. let newValue = value;
  47153. if (mapping) {
  47154. newValue = typeof mapping === "string" ? mapping : mapping(value, original);
  47155. }
  47156. if (key.endsWith("scale")) {
  47157. style.transform = style.transform ? `${style[key]} ${newValue}` : newValue;
  47158. } else {
  47159. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  47160. }
  47161. }
  47162. if (style.fontFamily) {
  47163. setFontFamily({
  47164. typeface: style.fontFamily,
  47165. weight: style.fontWeight || "normal",
  47166. posture: style.fontStyle || "normal",
  47167. size: original.fontSize || 0
  47168. }, node, node[$globalData].fontFinder, style);
  47169. }
  47170. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  47171. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  47172. const VERTICAL_FACTOR = 0.333;
  47173. const fontSize = getMeasurement(style.fontSize);
  47174. style.fontSize = measureToString(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  47175. style.verticalAlign = measureToString(Math.sign(getMeasurement(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  47176. }
  47177. if (richText && style.fontSize) {
  47178. style.fontSize = `calc(${style.fontSize} * var(--scale-factor))`;
  47179. }
  47180. fixTextIndent(style);
  47181. return style;
  47182. }
  47183. function checkStyle(node) {
  47184. if (!node.style) {
  47185. return "";
  47186. }
  47187. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  47188. if (key === "font-family") {
  47189. node[$globalData].usedTypefaces.add(value);
  47190. }
  47191. return VALID_STYLES.has(key);
  47192. }).map(kv => kv.join(":")).join(";");
  47193. }
  47194. const NoWhites = new Set(["body", "html"]);
  47195. class XhtmlObject extends XmlObject {
  47196. constructor(attributes, name) {
  47197. super(XHTML_NS_ID, name);
  47198. this[$richText] = false;
  47199. this.style = attributes.style || "";
  47200. }
  47201. [$clean](builder) {
  47202. super[$clean](builder);
  47203. this.style = checkStyle(this);
  47204. }
  47205. [$acceptWhitespace]() {
  47206. return !NoWhites.has(this[$nodeName]);
  47207. }
  47208. [$onText](str, richText = false) {
  47209. if (!richText) {
  47210. str = str.replaceAll(crlfRegExp, "");
  47211. if (!this.style.includes("xfa-spacerun:yes")) {
  47212. str = str.replaceAll(spacesRegExp, " ");
  47213. }
  47214. } else {
  47215. this[$richText] = true;
  47216. }
  47217. if (str) {
  47218. this[$content] += str;
  47219. }
  47220. }
  47221. [$pushGlyphs](measure, mustPop = true) {
  47222. const xfaFont = Object.create(null);
  47223. const margin = {
  47224. top: NaN,
  47225. bottom: NaN,
  47226. left: NaN,
  47227. right: NaN
  47228. };
  47229. let lineHeight = null;
  47230. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  47231. switch (key) {
  47232. case "font-family":
  47233. xfaFont.typeface = stripQuotes(value);
  47234. break;
  47235. case "font-size":
  47236. xfaFont.size = getMeasurement(value);
  47237. break;
  47238. case "font-weight":
  47239. xfaFont.weight = value;
  47240. break;
  47241. case "font-style":
  47242. xfaFont.posture = value;
  47243. break;
  47244. case "letter-spacing":
  47245. xfaFont.letterSpacing = getMeasurement(value);
  47246. break;
  47247. case "margin":
  47248. const values = value.split(/ \t/).map(x => getMeasurement(x));
  47249. switch (values.length) {
  47250. case 1:
  47251. margin.top = margin.bottom = margin.left = margin.right = values[0];
  47252. break;
  47253. case 2:
  47254. margin.top = margin.bottom = values[0];
  47255. margin.left = margin.right = values[1];
  47256. break;
  47257. case 3:
  47258. margin.top = values[0];
  47259. margin.bottom = values[2];
  47260. margin.left = margin.right = values[1];
  47261. break;
  47262. case 4:
  47263. margin.top = values[0];
  47264. margin.left = values[1];
  47265. margin.bottom = values[2];
  47266. margin.right = values[3];
  47267. break;
  47268. }
  47269. break;
  47270. case "margin-top":
  47271. margin.top = getMeasurement(value);
  47272. break;
  47273. case "margin-bottom":
  47274. margin.bottom = getMeasurement(value);
  47275. break;
  47276. case "margin-left":
  47277. margin.left = getMeasurement(value);
  47278. break;
  47279. case "margin-right":
  47280. margin.right = getMeasurement(value);
  47281. break;
  47282. case "line-height":
  47283. lineHeight = getMeasurement(value);
  47284. break;
  47285. }
  47286. }
  47287. measure.pushData(xfaFont, margin, lineHeight);
  47288. if (this[$content]) {
  47289. measure.addString(this[$content]);
  47290. } else {
  47291. for (const child of this[$getChildren]()) {
  47292. if (child[$nodeName] === "#text") {
  47293. measure.addString(child[$content]);
  47294. continue;
  47295. }
  47296. child[$pushGlyphs](measure);
  47297. }
  47298. }
  47299. if (mustPop) {
  47300. measure.popFont();
  47301. }
  47302. }
  47303. [$toHTML](availableSpace) {
  47304. const children = [];
  47305. this[$extra] = {
  47306. children
  47307. };
  47308. this[$childrenToHTML]({});
  47309. if (children.length === 0 && !this[$content]) {
  47310. return HTMLResult.EMPTY;
  47311. }
  47312. let value;
  47313. if (this[$richText]) {
  47314. value = this[$content] ? this[$content].replaceAll(crlfForRichTextRegExp, "\n") : undefined;
  47315. } else {
  47316. value = this[$content] || undefined;
  47317. }
  47318. return HTMLResult.success({
  47319. name: this[$nodeName],
  47320. attributes: {
  47321. href: this.href,
  47322. style: mapStyle(this.style, this, this[$richText])
  47323. },
  47324. children,
  47325. value
  47326. });
  47327. }
  47328. }
  47329. class A extends XhtmlObject {
  47330. constructor(attributes) {
  47331. super(attributes, "a");
  47332. this.href = fixURL(attributes.href) || "";
  47333. }
  47334. }
  47335. class B extends XhtmlObject {
  47336. constructor(attributes) {
  47337. super(attributes, "b");
  47338. }
  47339. [$pushGlyphs](measure) {
  47340. measure.pushFont({
  47341. weight: "bold"
  47342. });
  47343. super[$pushGlyphs](measure);
  47344. measure.popFont();
  47345. }
  47346. }
  47347. class Body extends XhtmlObject {
  47348. constructor(attributes) {
  47349. super(attributes, "body");
  47350. }
  47351. [$toHTML](availableSpace) {
  47352. const res = super[$toHTML](availableSpace);
  47353. const {
  47354. html
  47355. } = res;
  47356. if (!html) {
  47357. return HTMLResult.EMPTY;
  47358. }
  47359. html.name = "div";
  47360. html.attributes.class = ["xfaRich"];
  47361. return res;
  47362. }
  47363. }
  47364. class Br extends XhtmlObject {
  47365. constructor(attributes) {
  47366. super(attributes, "br");
  47367. }
  47368. [$text]() {
  47369. return "\n";
  47370. }
  47371. [$pushGlyphs](measure) {
  47372. measure.addString("\n");
  47373. }
  47374. [$toHTML](availableSpace) {
  47375. return HTMLResult.success({
  47376. name: "br"
  47377. });
  47378. }
  47379. }
  47380. class Html extends XhtmlObject {
  47381. constructor(attributes) {
  47382. super(attributes, "html");
  47383. }
  47384. [$toHTML](availableSpace) {
  47385. const children = [];
  47386. this[$extra] = {
  47387. children
  47388. };
  47389. this[$childrenToHTML]({});
  47390. if (children.length === 0) {
  47391. return HTMLResult.success({
  47392. name: "div",
  47393. attributes: {
  47394. class: ["xfaRich"],
  47395. style: {}
  47396. },
  47397. value: this[$content] || ""
  47398. });
  47399. }
  47400. if (children.length === 1) {
  47401. const child = children[0];
  47402. if (child.attributes?.class.includes("xfaRich")) {
  47403. return HTMLResult.success(child);
  47404. }
  47405. }
  47406. return HTMLResult.success({
  47407. name: "div",
  47408. attributes: {
  47409. class: ["xfaRich"],
  47410. style: {}
  47411. },
  47412. children
  47413. });
  47414. }
  47415. }
  47416. class I extends XhtmlObject {
  47417. constructor(attributes) {
  47418. super(attributes, "i");
  47419. }
  47420. [$pushGlyphs](measure) {
  47421. measure.pushFont({
  47422. posture: "italic"
  47423. });
  47424. super[$pushGlyphs](measure);
  47425. measure.popFont();
  47426. }
  47427. }
  47428. class Li extends XhtmlObject {
  47429. constructor(attributes) {
  47430. super(attributes, "li");
  47431. }
  47432. }
  47433. class Ol extends XhtmlObject {
  47434. constructor(attributes) {
  47435. super(attributes, "ol");
  47436. }
  47437. }
  47438. class P extends XhtmlObject {
  47439. constructor(attributes) {
  47440. super(attributes, "p");
  47441. }
  47442. [$pushGlyphs](measure) {
  47443. super[$pushGlyphs](measure, false);
  47444. measure.addString("\n");
  47445. measure.addPara();
  47446. measure.popFont();
  47447. }
  47448. [$text]() {
  47449. const siblings = this[$getParent]()[$getChildren]();
  47450. if (siblings.at(-1) === this) {
  47451. return super[$text]();
  47452. }
  47453. return super[$text]() + "\n";
  47454. }
  47455. }
  47456. class Span extends XhtmlObject {
  47457. constructor(attributes) {
  47458. super(attributes, "span");
  47459. }
  47460. }
  47461. class Sub extends XhtmlObject {
  47462. constructor(attributes) {
  47463. super(attributes, "sub");
  47464. }
  47465. }
  47466. class Sup extends XhtmlObject {
  47467. constructor(attributes) {
  47468. super(attributes, "sup");
  47469. }
  47470. }
  47471. class Ul extends XhtmlObject {
  47472. constructor(attributes) {
  47473. super(attributes, "ul");
  47474. }
  47475. }
  47476. class XhtmlNamespace {
  47477. static [$buildXFAObject](name, attributes) {
  47478. if (XhtmlNamespace.hasOwnProperty(name)) {
  47479. return XhtmlNamespace[name](attributes);
  47480. }
  47481. return undefined;
  47482. }
  47483. static a(attributes) {
  47484. return new A(attributes);
  47485. }
  47486. static b(attributes) {
  47487. return new B(attributes);
  47488. }
  47489. static body(attributes) {
  47490. return new Body(attributes);
  47491. }
  47492. static br(attributes) {
  47493. return new Br(attributes);
  47494. }
  47495. static html(attributes) {
  47496. return new Html(attributes);
  47497. }
  47498. static i(attributes) {
  47499. return new I(attributes);
  47500. }
  47501. static li(attributes) {
  47502. return new Li(attributes);
  47503. }
  47504. static ol(attributes) {
  47505. return new Ol(attributes);
  47506. }
  47507. static p(attributes) {
  47508. return new P(attributes);
  47509. }
  47510. static span(attributes) {
  47511. return new Span(attributes);
  47512. }
  47513. static sub(attributes) {
  47514. return new Sub(attributes);
  47515. }
  47516. static sup(attributes) {
  47517. return new Sup(attributes);
  47518. }
  47519. static ul(attributes) {
  47520. return new Ul(attributes);
  47521. }
  47522. }
  47523. ;// ./src/core/xfa/setup.js
  47524. const NamespaceSetUp = {
  47525. config: ConfigNamespace,
  47526. connection: ConnectionSetNamespace,
  47527. datasets: DatasetsNamespace,
  47528. localeSet: LocaleSetNamespace,
  47529. signature: SignatureNamespace,
  47530. stylesheet: StylesheetNamespace,
  47531. template: TemplateNamespace,
  47532. xdp: XdpNamespace,
  47533. xhtml: XhtmlNamespace
  47534. };
  47535. ;// ./src/core/xfa/unknown.js
  47536. class UnknownNamespace {
  47537. constructor(nsId) {
  47538. this.namespaceId = nsId;
  47539. }
  47540. [$buildXFAObject](name, attributes) {
  47541. return new XmlObject(this.namespaceId, name, attributes);
  47542. }
  47543. }
  47544. ;// ./src/core/xfa/builder.js
  47545. class Root extends XFAObject {
  47546. constructor(ids) {
  47547. super(-1, "root", Object.create(null));
  47548. this.element = null;
  47549. this[$ids] = ids;
  47550. }
  47551. [$onChild](child) {
  47552. this.element = child;
  47553. return true;
  47554. }
  47555. [$finalize]() {
  47556. super[$finalize]();
  47557. if (this.element.template instanceof Template) {
  47558. this[$ids].set($root, this.element);
  47559. this.element.template[$resolvePrototypes](this[$ids]);
  47560. this.element.template[$ids] = this[$ids];
  47561. }
  47562. }
  47563. }
  47564. class Empty extends XFAObject {
  47565. constructor() {
  47566. super(-1, "", Object.create(null));
  47567. }
  47568. [$onChild](_) {
  47569. return false;
  47570. }
  47571. }
  47572. class Builder {
  47573. constructor(rootNameSpace = null) {
  47574. this._namespaceStack = [];
  47575. this._nsAgnosticLevel = 0;
  47576. this._namespacePrefixes = new Map();
  47577. this._namespaces = new Map();
  47578. this._nextNsId = Math.max(...Object.values(NamespaceIds).map(({
  47579. id
  47580. }) => id));
  47581. this._currentNamespace = rootNameSpace || new UnknownNamespace(++this._nextNsId);
  47582. }
  47583. buildRoot(ids) {
  47584. return new Root(ids);
  47585. }
  47586. build({
  47587. nsPrefix,
  47588. name,
  47589. attributes,
  47590. namespace,
  47591. prefixes
  47592. }) {
  47593. const hasNamespaceDef = namespace !== null;
  47594. if (hasNamespaceDef) {
  47595. this._namespaceStack.push(this._currentNamespace);
  47596. this._currentNamespace = this._searchNamespace(namespace);
  47597. }
  47598. if (prefixes) {
  47599. this._addNamespacePrefix(prefixes);
  47600. }
  47601. if (attributes.hasOwnProperty($nsAttributes)) {
  47602. const dataTemplate = NamespaceSetUp.datasets;
  47603. const nsAttrs = attributes[$nsAttributes];
  47604. let xfaAttrs = null;
  47605. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  47606. const nsToUse = this._getNamespaceToUse(ns);
  47607. if (nsToUse === dataTemplate) {
  47608. xfaAttrs = {
  47609. xfa: attrs
  47610. };
  47611. break;
  47612. }
  47613. }
  47614. if (xfaAttrs) {
  47615. attributes[$nsAttributes] = xfaAttrs;
  47616. } else {
  47617. delete attributes[$nsAttributes];
  47618. }
  47619. }
  47620. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  47621. const node = namespaceToUse?.[$buildXFAObject](name, attributes) || new Empty();
  47622. if (node[$isNsAgnostic]()) {
  47623. this._nsAgnosticLevel++;
  47624. }
  47625. if (hasNamespaceDef || prefixes || node[$isNsAgnostic]()) {
  47626. node[$cleanup] = {
  47627. hasNamespace: hasNamespaceDef,
  47628. prefixes,
  47629. nsAgnostic: node[$isNsAgnostic]()
  47630. };
  47631. }
  47632. return node;
  47633. }
  47634. isNsAgnostic() {
  47635. return this._nsAgnosticLevel > 0;
  47636. }
  47637. _searchNamespace(nsName) {
  47638. let ns = this._namespaces.get(nsName);
  47639. if (ns) {
  47640. return ns;
  47641. }
  47642. for (const [name, {
  47643. check
  47644. }] of Object.entries(NamespaceIds)) {
  47645. if (check(nsName)) {
  47646. ns = NamespaceSetUp[name];
  47647. if (ns) {
  47648. this._namespaces.set(nsName, ns);
  47649. return ns;
  47650. }
  47651. break;
  47652. }
  47653. }
  47654. ns = new UnknownNamespace(++this._nextNsId);
  47655. this._namespaces.set(nsName, ns);
  47656. return ns;
  47657. }
  47658. _addNamespacePrefix(prefixes) {
  47659. for (const {
  47660. prefix,
  47661. value
  47662. } of prefixes) {
  47663. const namespace = this._searchNamespace(value);
  47664. let prefixStack = this._namespacePrefixes.get(prefix);
  47665. if (!prefixStack) {
  47666. prefixStack = [];
  47667. this._namespacePrefixes.set(prefix, prefixStack);
  47668. }
  47669. prefixStack.push(namespace);
  47670. }
  47671. }
  47672. _getNamespaceToUse(prefix) {
  47673. if (!prefix) {
  47674. return this._currentNamespace;
  47675. }
  47676. const prefixStack = this._namespacePrefixes.get(prefix);
  47677. if (prefixStack?.length > 0) {
  47678. return prefixStack.at(-1);
  47679. }
  47680. warn(`Unknown namespace prefix: ${prefix}.`);
  47681. return null;
  47682. }
  47683. clean(data) {
  47684. const {
  47685. hasNamespace,
  47686. prefixes,
  47687. nsAgnostic
  47688. } = data;
  47689. if (hasNamespace) {
  47690. this._currentNamespace = this._namespaceStack.pop();
  47691. }
  47692. if (prefixes) {
  47693. prefixes.forEach(({
  47694. prefix
  47695. }) => {
  47696. this._namespacePrefixes.get(prefix).pop();
  47697. });
  47698. }
  47699. if (nsAgnostic) {
  47700. this._nsAgnosticLevel--;
  47701. }
  47702. }
  47703. }
  47704. ;// ./src/core/xfa/parser.js
  47705. class XFAParser extends XMLParserBase {
  47706. constructor(rootNameSpace = null, richText = false) {
  47707. super();
  47708. this._builder = new Builder(rootNameSpace);
  47709. this._stack = [];
  47710. this._globalData = {
  47711. usedTypefaces: new Set()
  47712. };
  47713. this._ids = new Map();
  47714. this._current = this._builder.buildRoot(this._ids);
  47715. this._errorCode = XMLParserErrorCode.NoError;
  47716. this._whiteRegex = /^\s+$/;
  47717. this._nbsps = /\xa0+/g;
  47718. this._richText = richText;
  47719. }
  47720. parse(data) {
  47721. this.parseXml(data);
  47722. if (this._errorCode !== XMLParserErrorCode.NoError) {
  47723. return undefined;
  47724. }
  47725. this._current[$finalize]();
  47726. return this._current.element;
  47727. }
  47728. onText(text) {
  47729. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  47730. if (this._richText || this._current[$acceptWhitespace]()) {
  47731. this._current[$onText](text, this._richText);
  47732. return;
  47733. }
  47734. if (this._whiteRegex.test(text)) {
  47735. return;
  47736. }
  47737. this._current[$onText](text.trim());
  47738. }
  47739. onCdata(text) {
  47740. this._current[$onText](text);
  47741. }
  47742. _mkAttributes(attributes, tagName) {
  47743. let namespace = null;
  47744. let prefixes = null;
  47745. const attributeObj = Object.create({});
  47746. for (const {
  47747. name,
  47748. value
  47749. } of attributes) {
  47750. if (name === "xmlns") {
  47751. if (!namespace) {
  47752. namespace = value;
  47753. } else {
  47754. warn(`XFA - multiple namespace definition in <${tagName}>`);
  47755. }
  47756. } else if (name.startsWith("xmlns:")) {
  47757. const prefix = name.substring("xmlns:".length);
  47758. if (!prefixes) {
  47759. prefixes = [];
  47760. }
  47761. prefixes.push({
  47762. prefix,
  47763. value
  47764. });
  47765. } else {
  47766. const i = name.indexOf(":");
  47767. if (i === -1) {
  47768. attributeObj[name] = value;
  47769. } else {
  47770. let nsAttrs = attributeObj[$nsAttributes];
  47771. if (!nsAttrs) {
  47772. nsAttrs = attributeObj[$nsAttributes] = Object.create(null);
  47773. }
  47774. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  47775. const attrs = nsAttrs[ns] ||= Object.create(null);
  47776. attrs[attrName] = value;
  47777. }
  47778. }
  47779. }
  47780. return [namespace, prefixes, attributeObj];
  47781. }
  47782. _getNameAndPrefix(name, nsAgnostic) {
  47783. const i = name.indexOf(":");
  47784. if (i === -1) {
  47785. return [name, null];
  47786. }
  47787. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  47788. }
  47789. onBeginElement(tagName, attributes, isEmpty) {
  47790. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  47791. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  47792. const node = this._builder.build({
  47793. nsPrefix,
  47794. name,
  47795. attributes: attributesObj,
  47796. namespace,
  47797. prefixes
  47798. });
  47799. node[$globalData] = this._globalData;
  47800. if (isEmpty) {
  47801. node[$finalize]();
  47802. if (this._current[$onChild](node)) {
  47803. node[$setId](this._ids);
  47804. }
  47805. node[$clean](this._builder);
  47806. return;
  47807. }
  47808. this._stack.push(this._current);
  47809. this._current = node;
  47810. }
  47811. onEndElement(name) {
  47812. const node = this._current;
  47813. if (node[$isCDATAXml]() && typeof node[$content] === "string") {
  47814. const parser = new XFAParser();
  47815. parser._globalData = this._globalData;
  47816. const root = parser.parse(node[$content]);
  47817. node[$content] = null;
  47818. node[$onChild](root);
  47819. }
  47820. node[$finalize]();
  47821. this._current = this._stack.pop();
  47822. if (this._current[$onChild](node)) {
  47823. node[$setId](this._ids);
  47824. }
  47825. node[$clean](this._builder);
  47826. }
  47827. onError(code) {
  47828. this._errorCode = code;
  47829. }
  47830. }
  47831. ;// ./src/core/xfa/factory.js
  47832. class XFAFactory {
  47833. constructor(data) {
  47834. try {
  47835. this.root = new XFAParser().parse(XFAFactory._createDocument(data));
  47836. const binder = new Binder(this.root);
  47837. this.form = binder.bind();
  47838. this.dataHandler = new DataHandler(this.root, binder.getData());
  47839. this.form[$globalData].template = this.form;
  47840. } catch (e) {
  47841. warn(`XFA - an error occurred during parsing and binding: ${e}`);
  47842. }
  47843. }
  47844. isValid() {
  47845. return this.root && this.form;
  47846. }
  47847. _createPagesHelper() {
  47848. const iterator = this.form[$toPages]();
  47849. return new Promise((resolve, reject) => {
  47850. const nextIteration = () => {
  47851. try {
  47852. const value = iterator.next();
  47853. if (value.done) {
  47854. resolve(value.value);
  47855. } else {
  47856. setTimeout(nextIteration, 0);
  47857. }
  47858. } catch (e) {
  47859. reject(e);
  47860. }
  47861. };
  47862. setTimeout(nextIteration, 0);
  47863. });
  47864. }
  47865. async _createPages() {
  47866. try {
  47867. this.pages = await this._createPagesHelper();
  47868. this.dims = this.pages.children.map(c => {
  47869. const {
  47870. width,
  47871. height
  47872. } = c.attributes.style;
  47873. return [0, 0, parseInt(width), parseInt(height)];
  47874. });
  47875. } catch (e) {
  47876. warn(`XFA - an error occurred during layout: ${e}`);
  47877. }
  47878. }
  47879. getBoundingBox(pageIndex) {
  47880. return this.dims[pageIndex];
  47881. }
  47882. async getNumPages() {
  47883. if (!this.pages) {
  47884. await this._createPages();
  47885. }
  47886. return this.dims.length;
  47887. }
  47888. setImages(images) {
  47889. this.form[$globalData].images = images;
  47890. }
  47891. setFonts(fonts) {
  47892. this.form[$globalData].fontFinder = new FontFinder(fonts);
  47893. const missingFonts = [];
  47894. for (let typeface of this.form[$globalData].usedTypefaces) {
  47895. typeface = stripQuotes(typeface);
  47896. const font = this.form[$globalData].fontFinder.find(typeface);
  47897. if (!font) {
  47898. missingFonts.push(typeface);
  47899. }
  47900. }
  47901. if (missingFonts.length > 0) {
  47902. return missingFonts;
  47903. }
  47904. return null;
  47905. }
  47906. appendFonts(fonts, reallyMissingFonts) {
  47907. this.form[$globalData].fontFinder.add(fonts, reallyMissingFonts);
  47908. }
  47909. async getPages() {
  47910. if (!this.pages) {
  47911. await this._createPages();
  47912. }
  47913. const pages = this.pages;
  47914. this.pages = null;
  47915. return pages;
  47916. }
  47917. serializeData(storage) {
  47918. return this.dataHandler.serialize(storage);
  47919. }
  47920. static _createDocument(data) {
  47921. if (!data["/xdp:xdp"]) {
  47922. return data["xdp:xdp"];
  47923. }
  47924. return Object.values(data).join("");
  47925. }
  47926. static getRichTextAsHtml(rc) {
  47927. if (!rc || typeof rc !== "string") {
  47928. return null;
  47929. }
  47930. try {
  47931. let root = new XFAParser(XhtmlNamespace, true).parse(rc);
  47932. if (!["body", "xhtml"].includes(root[$nodeName])) {
  47933. const newRoot = XhtmlNamespace.body({});
  47934. newRoot[$appendChild](root);
  47935. root = newRoot;
  47936. }
  47937. const result = root[$toHTML]();
  47938. if (!result.success) {
  47939. return null;
  47940. }
  47941. const {
  47942. html
  47943. } = result;
  47944. const {
  47945. attributes
  47946. } = html;
  47947. if (attributes) {
  47948. if (attributes.class) {
  47949. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  47950. }
  47951. attributes.dir = "auto";
  47952. }
  47953. return {
  47954. html,
  47955. str: root[$text]()
  47956. };
  47957. } catch (e) {
  47958. warn(`XFA - an error occurred during parsing of rich text: ${e}`);
  47959. }
  47960. return null;
  47961. }
  47962. }
  47963. ;// ./src/core/annotation.js
  47964. class AnnotationFactory {
  47965. static createGlobals(pdfManager) {
  47966. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureDoc("xfaDatasets"), pdfManager.ensureCatalog("structTreeRoot"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureCatalog("attachments")]).then(([acroForm, xfaDatasets, structTreeRoot, baseUrl, attachments]) => {
  47967. return {
  47968. pdfManager,
  47969. acroForm: acroForm instanceof Dict ? acroForm : Dict.empty,
  47970. xfaDatasets,
  47971. structTreeRoot,
  47972. baseUrl,
  47973. attachments
  47974. };
  47975. }, reason => {
  47976. warn(`createGlobals: "${reason}".`);
  47977. return null;
  47978. });
  47979. }
  47980. static async create(xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, pageRef) {
  47981. const pageIndex = collectFields ? await this._getPageIndex(xref, ref, annotationGlobals.pdfManager) : null;
  47982. return annotationGlobals.pdfManager.ensure(this, "_create", [xref, ref, annotationGlobals, idFactory, collectFields, orphanFields, pageIndex, pageRef]);
  47983. }
  47984. static _create(xref, ref, annotationGlobals, idFactory, collectFields = false, orphanFields = null, pageIndex = null, pageRef = null) {
  47985. const dict = xref.fetchIfRef(ref);
  47986. if (!(dict instanceof Dict)) {
  47987. return undefined;
  47988. }
  47989. const {
  47990. acroForm,
  47991. pdfManager
  47992. } = annotationGlobals;
  47993. const id = ref instanceof Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  47994. let subtype = dict.get("Subtype");
  47995. subtype = subtype instanceof Name ? subtype.name : null;
  47996. const parameters = {
  47997. xref,
  47998. ref,
  47999. dict,
  48000. subtype,
  48001. id,
  48002. annotationGlobals,
  48003. collectFields,
  48004. orphanFields,
  48005. needAppearances: !collectFields && acroForm.get("NeedAppearances") === true,
  48006. pageIndex,
  48007. evaluatorOptions: pdfManager.evaluatorOptions,
  48008. pageRef
  48009. };
  48010. switch (subtype) {
  48011. case "Link":
  48012. return new LinkAnnotation(parameters);
  48013. case "Text":
  48014. return new TextAnnotation(parameters);
  48015. case "Widget":
  48016. let fieldType = getInheritableProperty({
  48017. dict,
  48018. key: "FT"
  48019. });
  48020. fieldType = fieldType instanceof Name ? fieldType.name : null;
  48021. switch (fieldType) {
  48022. case "Tx":
  48023. return new TextWidgetAnnotation(parameters);
  48024. case "Btn":
  48025. return new ButtonWidgetAnnotation(parameters);
  48026. case "Ch":
  48027. return new ChoiceWidgetAnnotation(parameters);
  48028. case "Sig":
  48029. return new SignatureWidgetAnnotation(parameters);
  48030. }
  48031. warn(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  48032. return new WidgetAnnotation(parameters);
  48033. case "Popup":
  48034. return new PopupAnnotation(parameters);
  48035. case "FreeText":
  48036. return new FreeTextAnnotation(parameters);
  48037. case "Line":
  48038. return new LineAnnotation(parameters);
  48039. case "Square":
  48040. return new SquareAnnotation(parameters);
  48041. case "Circle":
  48042. return new CircleAnnotation(parameters);
  48043. case "PolyLine":
  48044. return new PolylineAnnotation(parameters);
  48045. case "Polygon":
  48046. return new PolygonAnnotation(parameters);
  48047. case "Caret":
  48048. return new CaretAnnotation(parameters);
  48049. case "Ink":
  48050. return new InkAnnotation(parameters);
  48051. case "Highlight":
  48052. return new HighlightAnnotation(parameters);
  48053. case "Underline":
  48054. return new UnderlineAnnotation(parameters);
  48055. case "Squiggly":
  48056. return new SquigglyAnnotation(parameters);
  48057. case "StrikeOut":
  48058. return new StrikeOutAnnotation(parameters);
  48059. case "Stamp":
  48060. return new StampAnnotation(parameters);
  48061. case "FileAttachment":
  48062. return new FileAttachmentAnnotation(parameters);
  48063. default:
  48064. if (!collectFields) {
  48065. if (!subtype) {
  48066. warn("Annotation is missing the required /Subtype.");
  48067. } else {
  48068. warn(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  48069. }
  48070. }
  48071. return new Annotation(parameters);
  48072. }
  48073. }
  48074. static async _getPageIndex(xref, ref, pdfManager) {
  48075. try {
  48076. const annotDict = await xref.fetchIfRefAsync(ref);
  48077. if (!(annotDict instanceof Dict)) {
  48078. return -1;
  48079. }
  48080. const pageRef = annotDict.getRaw("P");
  48081. if (pageRef instanceof Ref) {
  48082. try {
  48083. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  48084. return pageIndex;
  48085. } catch (ex) {
  48086. info(`_getPageIndex -- not a valid page reference: "${ex}".`);
  48087. }
  48088. }
  48089. if (annotDict.has("Kids")) {
  48090. return -1;
  48091. }
  48092. const numPages = await pdfManager.ensureDoc("numPages");
  48093. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  48094. const page = await pdfManager.getPage(pageIndex);
  48095. const annotations = await pdfManager.ensure(page, "annotations");
  48096. for (const annotRef of annotations) {
  48097. if (annotRef instanceof Ref && isRefsEqual(annotRef, ref)) {
  48098. return pageIndex;
  48099. }
  48100. }
  48101. }
  48102. } catch (ex) {
  48103. warn(`_getPageIndex: "${ex}".`);
  48104. }
  48105. return -1;
  48106. }
  48107. static generateImages(annotations, xref, isOffscreenCanvasSupported) {
  48108. if (!isOffscreenCanvasSupported) {
  48109. warn("generateImages: OffscreenCanvas is not supported, cannot save or print some annotations with images.");
  48110. return null;
  48111. }
  48112. let imagePromises;
  48113. for (const {
  48114. bitmapId,
  48115. bitmap
  48116. } of annotations) {
  48117. if (!bitmap) {
  48118. continue;
  48119. }
  48120. imagePromises ||= new Map();
  48121. imagePromises.set(bitmapId, StampAnnotation.createImage(bitmap, xref));
  48122. }
  48123. return imagePromises;
  48124. }
  48125. static async saveNewAnnotations(evaluator, task, annotations, imagePromises, changes) {
  48126. const xref = evaluator.xref;
  48127. let baseFontRef;
  48128. const promises = [];
  48129. const {
  48130. isOffscreenCanvasSupported
  48131. } = evaluator.options;
  48132. for (const annotation of annotations) {
  48133. if (annotation.deleted) {
  48134. continue;
  48135. }
  48136. switch (annotation.annotationType) {
  48137. case AnnotationEditorType.FREETEXT:
  48138. if (!baseFontRef) {
  48139. const baseFont = new Dict(xref);
  48140. baseFont.set("BaseFont", Name.get("Helvetica"));
  48141. baseFont.set("Type", Name.get("Font"));
  48142. baseFont.set("Subtype", Name.get("Type1"));
  48143. baseFont.set("Encoding", Name.get("WinAnsiEncoding"));
  48144. baseFontRef = xref.getNewTemporaryRef();
  48145. changes.put(baseFontRef, {
  48146. data: baseFont
  48147. });
  48148. }
  48149. promises.push(FreeTextAnnotation.createNewAnnotation(xref, annotation, changes, {
  48150. evaluator,
  48151. task,
  48152. baseFontRef
  48153. }));
  48154. break;
  48155. case AnnotationEditorType.HIGHLIGHT:
  48156. if (annotation.quadPoints) {
  48157. promises.push(HighlightAnnotation.createNewAnnotation(xref, annotation, changes));
  48158. } else {
  48159. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, changes));
  48160. }
  48161. break;
  48162. case AnnotationEditorType.INK:
  48163. promises.push(InkAnnotation.createNewAnnotation(xref, annotation, changes));
  48164. break;
  48165. case AnnotationEditorType.STAMP:
  48166. const image = isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null;
  48167. if (image?.imageStream) {
  48168. const {
  48169. imageStream,
  48170. smaskStream
  48171. } = image;
  48172. if (smaskStream) {
  48173. const smaskRef = xref.getNewTemporaryRef();
  48174. changes.put(smaskRef, {
  48175. data: smaskStream
  48176. });
  48177. imageStream.dict.set("SMask", smaskRef);
  48178. }
  48179. const imageRef = image.imageRef = xref.getNewTemporaryRef();
  48180. changes.put(imageRef, {
  48181. data: imageStream
  48182. });
  48183. image.imageStream = image.smaskStream = null;
  48184. }
  48185. promises.push(StampAnnotation.createNewAnnotation(xref, annotation, changes, {
  48186. image
  48187. }));
  48188. break;
  48189. }
  48190. }
  48191. return {
  48192. annotations: await Promise.all(promises)
  48193. };
  48194. }
  48195. static async printNewAnnotations(annotationGlobals, evaluator, task, annotations, imagePromises) {
  48196. if (!annotations) {
  48197. return null;
  48198. }
  48199. const {
  48200. options,
  48201. xref
  48202. } = evaluator;
  48203. const promises = [];
  48204. for (const annotation of annotations) {
  48205. if (annotation.deleted) {
  48206. continue;
  48207. }
  48208. switch (annotation.annotationType) {
  48209. case AnnotationEditorType.FREETEXT:
  48210. promises.push(FreeTextAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  48211. evaluator,
  48212. task,
  48213. evaluatorOptions: options
  48214. }));
  48215. break;
  48216. case AnnotationEditorType.HIGHLIGHT:
  48217. if (annotation.quadPoints) {
  48218. promises.push(HighlightAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  48219. evaluatorOptions: options
  48220. }));
  48221. } else {
  48222. promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  48223. evaluatorOptions: options
  48224. }));
  48225. }
  48226. break;
  48227. case AnnotationEditorType.INK:
  48228. promises.push(InkAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  48229. evaluatorOptions: options
  48230. }));
  48231. break;
  48232. case AnnotationEditorType.STAMP:
  48233. const image = options.isOffscreenCanvasSupported ? await imagePromises?.get(annotation.bitmapId) : null;
  48234. if (image?.imageStream) {
  48235. const {
  48236. imageStream,
  48237. smaskStream
  48238. } = image;
  48239. if (smaskStream) {
  48240. imageStream.dict.set("SMask", smaskStream);
  48241. }
  48242. image.imageRef = new JpegStream(imageStream, imageStream.length);
  48243. image.imageStream = image.smaskStream = null;
  48244. }
  48245. promises.push(StampAnnotation.createNewPrintAnnotation(annotationGlobals, xref, annotation, {
  48246. image,
  48247. evaluatorOptions: options
  48248. }));
  48249. break;
  48250. }
  48251. }
  48252. return Promise.all(promises);
  48253. }
  48254. }
  48255. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  48256. if (!Array.isArray(color)) {
  48257. return defaultColor;
  48258. }
  48259. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  48260. switch (color.length) {
  48261. case 0:
  48262. return null;
  48263. case 1:
  48264. ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  48265. return rgbColor;
  48266. case 3:
  48267. ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  48268. return rgbColor;
  48269. case 4:
  48270. ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  48271. return rgbColor;
  48272. default:
  48273. return defaultColor;
  48274. }
  48275. }
  48276. function getPdfColorArray(color) {
  48277. return Array.from(color, c => c / 255);
  48278. }
  48279. function getQuadPoints(dict, rect) {
  48280. const quadPoints = dict.getArray("QuadPoints");
  48281. if (!isNumberArray(quadPoints, null) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  48282. return null;
  48283. }
  48284. const newQuadPoints = new Float32Array(quadPoints.length);
  48285. for (let i = 0, ii = quadPoints.length; i < ii; i += 8) {
  48286. const [x1, y1, x2, y2, x3, y3, x4, y4] = quadPoints.slice(i, i + 8);
  48287. const minX = Math.min(x1, x2, x3, x4);
  48288. const maxX = Math.max(x1, x2, x3, x4);
  48289. const minY = Math.min(y1, y2, y3, y4);
  48290. const maxY = Math.max(y1, y2, y3, y4);
  48291. if (rect !== null && (minX < rect[0] || maxX > rect[2] || minY < rect[1] || maxY > rect[3])) {
  48292. return null;
  48293. }
  48294. newQuadPoints.set([minX, maxY, maxX, maxY, minX, minY, maxX, minY], i);
  48295. }
  48296. return newQuadPoints;
  48297. }
  48298. function getTransformMatrix(rect, bbox, matrix) {
  48299. const [minX, minY, maxX, maxY] = Util.getAxialAlignedBoundingBox(bbox, matrix);
  48300. if (minX === maxX || minY === maxY) {
  48301. return [1, 0, 0, 1, rect[0], rect[1]];
  48302. }
  48303. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  48304. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  48305. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  48306. }
  48307. class Annotation {
  48308. constructor(params) {
  48309. const {
  48310. dict,
  48311. xref,
  48312. annotationGlobals,
  48313. ref,
  48314. orphanFields
  48315. } = params;
  48316. const parentRef = orphanFields?.get(ref);
  48317. if (parentRef) {
  48318. dict.set("Parent", parentRef);
  48319. }
  48320. this.setTitle(dict.get("T"));
  48321. this.setContents(dict.get("Contents"));
  48322. this.setModificationDate(dict.get("M"));
  48323. this.setFlags(dict.get("F"));
  48324. this.setRectangle(dict.getArray("Rect"));
  48325. this.setColor(dict.getArray("C"));
  48326. this.setBorderStyle(dict);
  48327. this.setAppearance(dict);
  48328. this.setOptionalContent(dict);
  48329. const MK = dict.get("MK");
  48330. this.setBorderAndBackgroundColors(MK);
  48331. this.setRotation(MK, dict);
  48332. this.ref = params.ref instanceof Ref ? params.ref : null;
  48333. this._streams = [];
  48334. if (this.appearance) {
  48335. this._streams.push(this.appearance);
  48336. }
  48337. const isLocked = !!(this.flags & AnnotationFlag.LOCKED);
  48338. const isContentLocked = !!(this.flags & AnnotationFlag.LOCKEDCONTENTS);
  48339. this.data = {
  48340. annotationFlags: this.flags,
  48341. borderStyle: this.borderStyle,
  48342. color: this.color,
  48343. backgroundColor: this.backgroundColor,
  48344. borderColor: this.borderColor,
  48345. rotation: this.rotation,
  48346. contentsObj: this._contents,
  48347. hasAppearance: !!this.appearance,
  48348. id: params.id,
  48349. modificationDate: this.modificationDate,
  48350. rect: this.rectangle,
  48351. subtype: params.subtype,
  48352. hasOwnCanvas: false,
  48353. noRotate: !!(this.flags & AnnotationFlag.NOROTATE),
  48354. noHTML: isLocked && isContentLocked,
  48355. isEditable: false,
  48356. structParent: -1
  48357. };
  48358. if (annotationGlobals.structTreeRoot) {
  48359. let structParent = dict.get("StructParent");
  48360. this.data.structParent = structParent = Number.isInteger(structParent) && structParent >= 0 ? structParent : -1;
  48361. annotationGlobals.structTreeRoot.addAnnotationIdToPage(params.pageRef, structParent);
  48362. }
  48363. if (params.collectFields) {
  48364. const kids = dict.get("Kids");
  48365. if (Array.isArray(kids)) {
  48366. const kidIds = [];
  48367. for (const kid of kids) {
  48368. if (kid instanceof Ref) {
  48369. kidIds.push(kid.toString());
  48370. }
  48371. }
  48372. if (kidIds.length !== 0) {
  48373. this.data.kidIds = kidIds;
  48374. }
  48375. }
  48376. this.data.actions = collectActions(xref, dict, AnnotationActionEventType);
  48377. this.data.fieldName = this._constructFieldName(dict);
  48378. this.data.pageIndex = params.pageIndex;
  48379. }
  48380. const it = dict.get("IT");
  48381. if (it instanceof Name) {
  48382. this.data.it = it.name;
  48383. }
  48384. this._isOffscreenCanvasSupported = params.evaluatorOptions.isOffscreenCanvasSupported;
  48385. this._fallbackFontDict = null;
  48386. this._needAppearances = false;
  48387. }
  48388. _hasFlag(flags, flag) {
  48389. return !!(flags & flag);
  48390. }
  48391. _buildFlags(noView, noPrint) {
  48392. let {
  48393. flags
  48394. } = this;
  48395. if (noView === undefined) {
  48396. if (noPrint === undefined) {
  48397. return undefined;
  48398. }
  48399. if (noPrint) {
  48400. return flags & ~AnnotationFlag.PRINT;
  48401. }
  48402. return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.PRINT;
  48403. }
  48404. if (noView) {
  48405. flags |= AnnotationFlag.PRINT;
  48406. if (noPrint) {
  48407. return flags & ~AnnotationFlag.NOVIEW | AnnotationFlag.HIDDEN;
  48408. }
  48409. return flags & ~AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW;
  48410. }
  48411. flags &= ~(AnnotationFlag.HIDDEN | AnnotationFlag.NOVIEW);
  48412. if (noPrint) {
  48413. return flags & ~AnnotationFlag.PRINT;
  48414. }
  48415. return flags | AnnotationFlag.PRINT;
  48416. }
  48417. _isViewable(flags) {
  48418. return !this._hasFlag(flags, AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, AnnotationFlag.NOVIEW);
  48419. }
  48420. _isPrintable(flags) {
  48421. return this._hasFlag(flags, AnnotationFlag.PRINT) && !this._hasFlag(flags, AnnotationFlag.HIDDEN) && !this._hasFlag(flags, AnnotationFlag.INVISIBLE);
  48422. }
  48423. mustBeViewed(annotationStorage, _renderForms) {
  48424. const noView = annotationStorage?.get(this.data.id)?.noView;
  48425. if (noView !== undefined) {
  48426. return !noView;
  48427. }
  48428. return this.viewable && !this._hasFlag(this.flags, AnnotationFlag.HIDDEN);
  48429. }
  48430. mustBePrinted(annotationStorage) {
  48431. const noPrint = annotationStorage?.get(this.data.id)?.noPrint;
  48432. if (noPrint !== undefined) {
  48433. return !noPrint;
  48434. }
  48435. return this.printable;
  48436. }
  48437. mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
  48438. return isEditing ? !this.data.isEditable : !modifiedIds?.has(this.data.id);
  48439. }
  48440. get viewable() {
  48441. if (this.data.quadPoints === null) {
  48442. return false;
  48443. }
  48444. if (this.flags === 0) {
  48445. return true;
  48446. }
  48447. return this._isViewable(this.flags);
  48448. }
  48449. get printable() {
  48450. if (this.data.quadPoints === null) {
  48451. return false;
  48452. }
  48453. if (this.flags === 0) {
  48454. return false;
  48455. }
  48456. return this._isPrintable(this.flags);
  48457. }
  48458. _parseStringHelper(data) {
  48459. const str = typeof data === "string" ? stringToPDFString(data) : "";
  48460. const dir = str && bidi(str).dir === "rtl" ? "rtl" : "ltr";
  48461. return {
  48462. str,
  48463. dir
  48464. };
  48465. }
  48466. setDefaultAppearance(params) {
  48467. const {
  48468. dict,
  48469. annotationGlobals
  48470. } = params;
  48471. const defaultAppearance = getInheritableProperty({
  48472. dict,
  48473. key: "DA"
  48474. }) || annotationGlobals.acroForm.get("DA");
  48475. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  48476. this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance);
  48477. }
  48478. setTitle(title) {
  48479. this._title = this._parseStringHelper(title);
  48480. }
  48481. setContents(contents) {
  48482. this._contents = this._parseStringHelper(contents);
  48483. }
  48484. setModificationDate(modificationDate) {
  48485. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  48486. }
  48487. setFlags(flags) {
  48488. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  48489. if (this.flags & AnnotationFlag.INVISIBLE && this.constructor.name !== "Annotation") {
  48490. this.flags ^= AnnotationFlag.INVISIBLE;
  48491. }
  48492. }
  48493. hasFlag(flag) {
  48494. return this._hasFlag(this.flags, flag);
  48495. }
  48496. setRectangle(rectangle) {
  48497. this.rectangle = lookupNormalRect(rectangle, [0, 0, 0, 0]);
  48498. }
  48499. setColor(color) {
  48500. this.color = getRgbColor(color);
  48501. }
  48502. setLineEndings(lineEndings) {
  48503. this.lineEndings = ["None", "None"];
  48504. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  48505. for (let i = 0; i < 2; i++) {
  48506. const obj = lineEndings[i];
  48507. if (obj instanceof Name) {
  48508. switch (obj.name) {
  48509. case "None":
  48510. continue;
  48511. case "Square":
  48512. case "Circle":
  48513. case "Diamond":
  48514. case "OpenArrow":
  48515. case "ClosedArrow":
  48516. case "Butt":
  48517. case "ROpenArrow":
  48518. case "RClosedArrow":
  48519. case "Slash":
  48520. this.lineEndings[i] = obj.name;
  48521. continue;
  48522. }
  48523. }
  48524. warn(`Ignoring invalid lineEnding: ${obj}`);
  48525. }
  48526. }
  48527. }
  48528. setRotation(mk, dict) {
  48529. this.rotation = 0;
  48530. let angle = mk instanceof Dict ? mk.get("R") || 0 : dict.get("Rotate") || 0;
  48531. if (Number.isInteger(angle) && angle !== 0) {
  48532. angle %= 360;
  48533. if (angle < 0) {
  48534. angle += 360;
  48535. }
  48536. if (angle % 90 === 0) {
  48537. this.rotation = angle;
  48538. }
  48539. }
  48540. }
  48541. setBorderAndBackgroundColors(mk) {
  48542. if (mk instanceof Dict) {
  48543. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  48544. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  48545. } else {
  48546. this.borderColor = this.backgroundColor = null;
  48547. }
  48548. }
  48549. setBorderStyle(borderStyle) {
  48550. this.borderStyle = new AnnotationBorderStyle();
  48551. if (!(borderStyle instanceof Dict)) {
  48552. return;
  48553. }
  48554. if (borderStyle.has("BS")) {
  48555. const dict = borderStyle.get("BS");
  48556. if (dict instanceof Dict) {
  48557. const dictType = dict.get("Type");
  48558. if (!dictType || isName(dictType, "Border")) {
  48559. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  48560. this.borderStyle.setStyle(dict.get("S"));
  48561. this.borderStyle.setDashArray(dict.getArray("D"));
  48562. }
  48563. }
  48564. } else if (borderStyle.has("Border")) {
  48565. const array = borderStyle.getArray("Border");
  48566. if (Array.isArray(array) && array.length >= 3) {
  48567. this.borderStyle.setHorizontalCornerRadius(array[0]);
  48568. this.borderStyle.setVerticalCornerRadius(array[1]);
  48569. this.borderStyle.setWidth(array[2], this.rectangle);
  48570. if (array.length === 4) {
  48571. this.borderStyle.setDashArray(array[3], true);
  48572. }
  48573. }
  48574. } else {
  48575. this.borderStyle.setWidth(0);
  48576. }
  48577. }
  48578. setAppearance(dict) {
  48579. this.appearance = null;
  48580. const appearanceStates = dict.get("AP");
  48581. if (!(appearanceStates instanceof Dict)) {
  48582. return;
  48583. }
  48584. const normalAppearanceState = appearanceStates.get("N");
  48585. if (normalAppearanceState instanceof BaseStream) {
  48586. this.appearance = normalAppearanceState;
  48587. return;
  48588. }
  48589. if (!(normalAppearanceState instanceof Dict)) {
  48590. return;
  48591. }
  48592. const as = dict.get("AS");
  48593. if (!(as instanceof Name) || !normalAppearanceState.has(as.name)) {
  48594. return;
  48595. }
  48596. const appearance = normalAppearanceState.get(as.name);
  48597. if (appearance instanceof BaseStream) {
  48598. this.appearance = appearance;
  48599. }
  48600. }
  48601. setOptionalContent(dict) {
  48602. this.oc = null;
  48603. const oc = dict.get("OC");
  48604. if (oc instanceof Name) {
  48605. warn("setOptionalContent: Support for /Name-entry is not implemented.");
  48606. } else if (oc instanceof Dict) {
  48607. this.oc = oc;
  48608. }
  48609. }
  48610. loadResources(keys, appearance) {
  48611. return appearance.dict.getAsync("Resources").then(resources => {
  48612. if (!resources) {
  48613. return undefined;
  48614. }
  48615. const objectLoader = new ObjectLoader(resources, keys, resources.xref);
  48616. return objectLoader.load().then(function () {
  48617. return resources;
  48618. });
  48619. });
  48620. }
  48621. async getOperatorList(evaluator, task, intent, annotationStorage) {
  48622. const {
  48623. hasOwnCanvas,
  48624. id,
  48625. rect
  48626. } = this.data;
  48627. let appearance = this.appearance;
  48628. const isUsingOwnCanvas = !!(hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
  48629. if (isUsingOwnCanvas && (rect[0] === rect[2] || rect[1] === rect[3])) {
  48630. this.data.hasOwnCanvas = false;
  48631. return {
  48632. opList: new OperatorList(),
  48633. separateForm: false,
  48634. separateCanvas: false
  48635. };
  48636. }
  48637. if (!appearance) {
  48638. if (!isUsingOwnCanvas) {
  48639. return {
  48640. opList: new OperatorList(),
  48641. separateForm: false,
  48642. separateCanvas: false
  48643. };
  48644. }
  48645. appearance = new StringStream("");
  48646. appearance.dict = new Dict();
  48647. }
  48648. const appearanceDict = appearance.dict;
  48649. const resources = await this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  48650. const bbox = lookupRect(appearanceDict.getArray("BBox"), [0, 0, 1, 1]);
  48651. const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), IDENTITY_MATRIX);
  48652. const transform = getTransformMatrix(rect, bbox, matrix);
  48653. const opList = new OperatorList();
  48654. let optionalContent;
  48655. if (this.oc) {
  48656. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  48657. }
  48658. if (optionalContent !== undefined) {
  48659. opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  48660. }
  48661. opList.addOp(OPS.beginAnnotation, [id, rect, transform, matrix, isUsingOwnCanvas]);
  48662. await evaluator.getOperatorList({
  48663. stream: appearance,
  48664. task,
  48665. resources,
  48666. operatorList: opList,
  48667. fallbackFontDict: this._fallbackFontDict
  48668. });
  48669. opList.addOp(OPS.endAnnotation, []);
  48670. if (optionalContent !== undefined) {
  48671. opList.addOp(OPS.endMarkedContent, []);
  48672. }
  48673. this.reset();
  48674. return {
  48675. opList,
  48676. separateForm: false,
  48677. separateCanvas: isUsingOwnCanvas
  48678. };
  48679. }
  48680. async save(evaluator, task, annotationStorage, changes) {
  48681. return null;
  48682. }
  48683. get hasTextContent() {
  48684. return false;
  48685. }
  48686. async extractTextContent(evaluator, task, viewBox) {
  48687. if (!this.appearance) {
  48688. return;
  48689. }
  48690. const resources = await this.loadResources(["ExtGState", "Font", "Properties", "XObject"], this.appearance);
  48691. const text = [];
  48692. const buffer = [];
  48693. let firstPosition = null;
  48694. const sink = {
  48695. desiredSize: Math.Infinity,
  48696. ready: true,
  48697. enqueue(chunk, size) {
  48698. for (const item of chunk.items) {
  48699. if (item.str === undefined) {
  48700. continue;
  48701. }
  48702. firstPosition ||= item.transform.slice(-2);
  48703. buffer.push(item.str);
  48704. if (item.hasEOL) {
  48705. text.push(buffer.join("").trimEnd());
  48706. buffer.length = 0;
  48707. }
  48708. }
  48709. }
  48710. };
  48711. await evaluator.getTextContent({
  48712. stream: this.appearance,
  48713. task,
  48714. resources,
  48715. includeMarkedContent: true,
  48716. keepWhiteSpace: true,
  48717. sink,
  48718. viewBox
  48719. });
  48720. this.reset();
  48721. if (buffer.length) {
  48722. text.push(buffer.join("").trimEnd());
  48723. }
  48724. if (text.length > 1 || text[0]) {
  48725. const appearanceDict = this.appearance.dict;
  48726. const bbox = lookupRect(appearanceDict.getArray("BBox"), null);
  48727. const matrix = lookupMatrix(appearanceDict.getArray("Matrix"), null);
  48728. this.data.textPosition = this._transformPoint(firstPosition, bbox, matrix);
  48729. this.data.textContent = text;
  48730. }
  48731. }
  48732. _transformPoint(coords, bbox, matrix) {
  48733. const {
  48734. rect
  48735. } = this.data;
  48736. bbox ||= [0, 0, 1, 1];
  48737. matrix ||= [1, 0, 0, 1, 0, 0];
  48738. const transform = getTransformMatrix(rect, bbox, matrix);
  48739. transform[4] -= rect[0];
  48740. transform[5] -= rect[1];
  48741. coords = Util.applyTransform(coords, transform);
  48742. return Util.applyTransform(coords, matrix);
  48743. }
  48744. getFieldObject() {
  48745. if (this.data.kidIds) {
  48746. return {
  48747. id: this.data.id,
  48748. actions: this.data.actions,
  48749. name: this.data.fieldName,
  48750. strokeColor: this.data.borderColor,
  48751. fillColor: this.data.backgroundColor,
  48752. type: "",
  48753. kidIds: this.data.kidIds,
  48754. page: this.data.pageIndex,
  48755. rotation: this.rotation
  48756. };
  48757. }
  48758. return null;
  48759. }
  48760. reset() {
  48761. for (const stream of this._streams) {
  48762. stream.reset();
  48763. }
  48764. }
  48765. _constructFieldName(dict) {
  48766. if (!dict.has("T") && !dict.has("Parent")) {
  48767. warn("Unknown field name, falling back to empty field name.");
  48768. return "";
  48769. }
  48770. if (!dict.has("Parent")) {
  48771. return stringToPDFString(dict.get("T"));
  48772. }
  48773. const fieldName = [];
  48774. if (dict.has("T")) {
  48775. fieldName.unshift(stringToPDFString(dict.get("T")));
  48776. }
  48777. let loopDict = dict;
  48778. const visited = new RefSet();
  48779. if (dict.objId) {
  48780. visited.put(dict.objId);
  48781. }
  48782. while (loopDict.has("Parent")) {
  48783. loopDict = loopDict.get("Parent");
  48784. if (!(loopDict instanceof Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  48785. break;
  48786. }
  48787. if (loopDict.objId) {
  48788. visited.put(loopDict.objId);
  48789. }
  48790. if (loopDict.has("T")) {
  48791. fieldName.unshift(stringToPDFString(loopDict.get("T")));
  48792. }
  48793. }
  48794. return fieldName.join(".");
  48795. }
  48796. }
  48797. class AnnotationBorderStyle {
  48798. constructor() {
  48799. this.width = 1;
  48800. this.rawWidth = 1;
  48801. this.style = AnnotationBorderStyleType.SOLID;
  48802. this.dashArray = [3];
  48803. this.horizontalCornerRadius = 0;
  48804. this.verticalCornerRadius = 0;
  48805. }
  48806. setWidth(width, rect = [0, 0, 0, 0]) {
  48807. if (width instanceof Name) {
  48808. this.width = 0;
  48809. return;
  48810. }
  48811. if (typeof width === "number") {
  48812. if (width > 0) {
  48813. this.rawWidth = width;
  48814. const maxWidth = (rect[2] - rect[0]) / 2;
  48815. const maxHeight = (rect[3] - rect[1]) / 2;
  48816. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  48817. warn(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  48818. width = 1;
  48819. }
  48820. }
  48821. this.width = width;
  48822. }
  48823. }
  48824. setStyle(style) {
  48825. if (!(style instanceof Name)) {
  48826. return;
  48827. }
  48828. switch (style.name) {
  48829. case "S":
  48830. this.style = AnnotationBorderStyleType.SOLID;
  48831. break;
  48832. case "D":
  48833. this.style = AnnotationBorderStyleType.DASHED;
  48834. break;
  48835. case "B":
  48836. this.style = AnnotationBorderStyleType.BEVELED;
  48837. break;
  48838. case "I":
  48839. this.style = AnnotationBorderStyleType.INSET;
  48840. break;
  48841. case "U":
  48842. this.style = AnnotationBorderStyleType.UNDERLINE;
  48843. break;
  48844. default:
  48845. break;
  48846. }
  48847. }
  48848. setDashArray(dashArray, forceStyle = false) {
  48849. if (Array.isArray(dashArray)) {
  48850. let isValid = true;
  48851. let allZeros = true;
  48852. for (const element of dashArray) {
  48853. const validNumber = +element >= 0;
  48854. if (!validNumber) {
  48855. isValid = false;
  48856. break;
  48857. } else if (element > 0) {
  48858. allZeros = false;
  48859. }
  48860. }
  48861. if (dashArray.length === 0 || isValid && !allZeros) {
  48862. this.dashArray = dashArray;
  48863. if (forceStyle) {
  48864. this.setStyle(Name.get("D"));
  48865. }
  48866. } else {
  48867. this.width = 0;
  48868. }
  48869. } else if (dashArray) {
  48870. this.width = 0;
  48871. }
  48872. }
  48873. setHorizontalCornerRadius(radius) {
  48874. if (Number.isInteger(radius)) {
  48875. this.horizontalCornerRadius = radius;
  48876. }
  48877. }
  48878. setVerticalCornerRadius(radius) {
  48879. if (Number.isInteger(radius)) {
  48880. this.verticalCornerRadius = radius;
  48881. }
  48882. }
  48883. }
  48884. class MarkupAnnotation extends Annotation {
  48885. constructor(params) {
  48886. super(params);
  48887. const {
  48888. dict
  48889. } = params;
  48890. if (dict.has("IRT")) {
  48891. const rawIRT = dict.getRaw("IRT");
  48892. this.data.inReplyTo = rawIRT instanceof Ref ? rawIRT.toString() : null;
  48893. const rt = dict.get("RT");
  48894. this.data.replyType = rt instanceof Name ? rt.name : AnnotationReplyType.REPLY;
  48895. }
  48896. let popupRef = null;
  48897. if (this.data.replyType === AnnotationReplyType.GROUP) {
  48898. const parent = dict.get("IRT");
  48899. this.setTitle(parent.get("T"));
  48900. this.data.titleObj = this._title;
  48901. this.setContents(parent.get("Contents"));
  48902. this.data.contentsObj = this._contents;
  48903. if (!parent.has("CreationDate")) {
  48904. this.data.creationDate = null;
  48905. } else {
  48906. this.setCreationDate(parent.get("CreationDate"));
  48907. this.data.creationDate = this.creationDate;
  48908. }
  48909. if (!parent.has("M")) {
  48910. this.data.modificationDate = null;
  48911. } else {
  48912. this.setModificationDate(parent.get("M"));
  48913. this.data.modificationDate = this.modificationDate;
  48914. }
  48915. popupRef = parent.getRaw("Popup");
  48916. if (!parent.has("C")) {
  48917. this.data.color = null;
  48918. } else {
  48919. this.setColor(parent.getArray("C"));
  48920. this.data.color = this.color;
  48921. }
  48922. } else {
  48923. this.data.titleObj = this._title;
  48924. this.setCreationDate(dict.get("CreationDate"));
  48925. this.data.creationDate = this.creationDate;
  48926. popupRef = dict.getRaw("Popup");
  48927. if (!dict.has("C")) {
  48928. this.data.color = null;
  48929. }
  48930. }
  48931. this.data.popupRef = popupRef instanceof Ref ? popupRef.toString() : null;
  48932. if (dict.has("RC")) {
  48933. this.data.richText = XFAFactory.getRichTextAsHtml(dict.get("RC"));
  48934. }
  48935. }
  48936. setCreationDate(creationDate) {
  48937. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  48938. }
  48939. _setDefaultAppearance({
  48940. xref,
  48941. extra,
  48942. strokeColor,
  48943. fillColor,
  48944. blendMode,
  48945. strokeAlpha,
  48946. fillAlpha,
  48947. pointsCallback
  48948. }) {
  48949. let minX = Number.MAX_VALUE;
  48950. let minY = Number.MAX_VALUE;
  48951. let maxX = Number.MIN_VALUE;
  48952. let maxY = Number.MIN_VALUE;
  48953. const buffer = ["q"];
  48954. if (extra) {
  48955. buffer.push(extra);
  48956. }
  48957. if (strokeColor) {
  48958. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  48959. }
  48960. if (fillColor) {
  48961. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  48962. }
  48963. const pointsArray = this.data.quadPoints || Float32Array.from([this.rectangle[0], this.rectangle[3], this.rectangle[2], this.rectangle[3], this.rectangle[0], this.rectangle[1], this.rectangle[2], this.rectangle[1]]);
  48964. for (let i = 0, ii = pointsArray.length; i < ii; i += 8) {
  48965. const [mX, MX, mY, MY] = pointsCallback(buffer, pointsArray.subarray(i, i + 8));
  48966. minX = Math.min(minX, mX);
  48967. maxX = Math.max(maxX, MX);
  48968. minY = Math.min(minY, mY);
  48969. maxY = Math.max(maxY, MY);
  48970. }
  48971. buffer.push("Q");
  48972. const formDict = new Dict(xref);
  48973. const appearanceStreamDict = new Dict(xref);
  48974. appearanceStreamDict.set("Subtype", Name.get("Form"));
  48975. const appearanceStream = new StringStream(buffer.join(" "));
  48976. appearanceStream.dict = appearanceStreamDict;
  48977. formDict.set("Fm0", appearanceStream);
  48978. const gsDict = new Dict(xref);
  48979. if (blendMode) {
  48980. gsDict.set("BM", Name.get(blendMode));
  48981. }
  48982. if (typeof strokeAlpha === "number") {
  48983. gsDict.set("CA", strokeAlpha);
  48984. }
  48985. if (typeof fillAlpha === "number") {
  48986. gsDict.set("ca", fillAlpha);
  48987. }
  48988. const stateDict = new Dict(xref);
  48989. stateDict.set("GS0", gsDict);
  48990. const resources = new Dict(xref);
  48991. resources.set("ExtGState", stateDict);
  48992. resources.set("XObject", formDict);
  48993. const appearanceDict = new Dict(xref);
  48994. appearanceDict.set("Resources", resources);
  48995. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  48996. appearanceDict.set("BBox", bbox);
  48997. this.appearance = new StringStream("/GS0 gs /Fm0 Do");
  48998. this.appearance.dict = appearanceDict;
  48999. this._streams.push(this.appearance, appearanceStream);
  49000. }
  49001. static async createNewAnnotation(xref, annotation, changes, params) {
  49002. const annotationRef = annotation.ref ||= xref.getNewTemporaryRef();
  49003. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  49004. let annotationDict;
  49005. if (ap) {
  49006. const apRef = xref.getNewTemporaryRef();
  49007. annotationDict = this.createNewDict(annotation, xref, {
  49008. apRef
  49009. });
  49010. changes.put(apRef, {
  49011. data: ap
  49012. });
  49013. } else {
  49014. annotationDict = this.createNewDict(annotation, xref, {});
  49015. }
  49016. if (Number.isInteger(annotation.parentTreeId)) {
  49017. annotationDict.set("StructParent", annotation.parentTreeId);
  49018. }
  49019. changes.put(annotationRef, {
  49020. data: annotationDict
  49021. });
  49022. return {
  49023. ref: annotationRef
  49024. };
  49025. }
  49026. static async createNewPrintAnnotation(annotationGlobals, xref, annotation, params) {
  49027. const ap = await this.createNewAppearanceStream(annotation, xref, params);
  49028. const annotationDict = this.createNewDict(annotation, xref, ap ? {
  49029. ap
  49030. } : {});
  49031. const newAnnotation = new this.prototype.constructor({
  49032. dict: annotationDict,
  49033. xref,
  49034. annotationGlobals,
  49035. evaluatorOptions: params.evaluatorOptions
  49036. });
  49037. if (annotation.ref) {
  49038. newAnnotation.ref = newAnnotation.refToReplace = annotation.ref;
  49039. }
  49040. return newAnnotation;
  49041. }
  49042. }
  49043. class WidgetAnnotation extends Annotation {
  49044. constructor(params) {
  49045. super(params);
  49046. const {
  49047. dict,
  49048. xref,
  49049. annotationGlobals
  49050. } = params;
  49051. const data = this.data;
  49052. this._needAppearances = params.needAppearances;
  49053. data.annotationType = AnnotationType.WIDGET;
  49054. if (data.fieldName === undefined) {
  49055. data.fieldName = this._constructFieldName(dict);
  49056. }
  49057. if (data.actions === undefined) {
  49058. data.actions = collectActions(xref, dict, AnnotationActionEventType);
  49059. }
  49060. let fieldValue = getInheritableProperty({
  49061. dict,
  49062. key: "V",
  49063. getArray: true
  49064. });
  49065. data.fieldValue = this._decodeFormValue(fieldValue);
  49066. const defaultFieldValue = getInheritableProperty({
  49067. dict,
  49068. key: "DV",
  49069. getArray: true
  49070. });
  49071. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  49072. if (fieldValue === undefined && annotationGlobals.xfaDatasets) {
  49073. const path = this._title.str;
  49074. if (path) {
  49075. this._hasValueFromXFA = true;
  49076. data.fieldValue = fieldValue = annotationGlobals.xfaDatasets.getValue(path);
  49077. }
  49078. }
  49079. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  49080. data.fieldValue = data.defaultFieldValue;
  49081. }
  49082. data.alternativeText = stringToPDFString(dict.get("TU") || "");
  49083. this.setDefaultAppearance(params);
  49084. data.hasAppearance ||= this._needAppearances && data.fieldValue !== undefined && data.fieldValue !== null;
  49085. const fieldType = getInheritableProperty({
  49086. dict,
  49087. key: "FT"
  49088. });
  49089. data.fieldType = fieldType instanceof Name ? fieldType.name : null;
  49090. const localResources = getInheritableProperty({
  49091. dict,
  49092. key: "DR"
  49093. });
  49094. const acroFormResources = annotationGlobals.acroForm.get("DR");
  49095. const appearanceResources = this.appearance?.dict.get("Resources");
  49096. this._fieldResources = {
  49097. localResources,
  49098. acroFormResources,
  49099. appearanceResources,
  49100. mergedResources: Dict.merge({
  49101. xref,
  49102. dictArray: [localResources, appearanceResources, acroFormResources],
  49103. mergeSubDicts: true
  49104. })
  49105. };
  49106. data.fieldFlags = getInheritableProperty({
  49107. dict,
  49108. key: "Ff"
  49109. });
  49110. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  49111. data.fieldFlags = 0;
  49112. }
  49113. data.readOnly = this.hasFieldFlag(AnnotationFieldFlag.READONLY);
  49114. data.required = this.hasFieldFlag(AnnotationFieldFlag.REQUIRED);
  49115. data.hidden = this._hasFlag(data.annotationFlags, AnnotationFlag.HIDDEN) || this._hasFlag(data.annotationFlags, AnnotationFlag.NOVIEW);
  49116. }
  49117. _decodeFormValue(formValue) {
  49118. if (Array.isArray(formValue)) {
  49119. return formValue.filter(item => typeof item === "string").map(item => stringToPDFString(item));
  49120. } else if (formValue instanceof Name) {
  49121. return stringToPDFString(formValue.name);
  49122. } else if (typeof formValue === "string") {
  49123. return stringToPDFString(formValue);
  49124. }
  49125. return null;
  49126. }
  49127. hasFieldFlag(flag) {
  49128. return !!(this.data.fieldFlags & flag);
  49129. }
  49130. _isViewable(flags) {
  49131. return true;
  49132. }
  49133. mustBeViewed(annotationStorage, renderForms) {
  49134. if (renderForms) {
  49135. return this.viewable;
  49136. }
  49137. return super.mustBeViewed(annotationStorage, renderForms) && !this._hasFlag(this.flags, AnnotationFlag.NOVIEW);
  49138. }
  49139. getRotationMatrix(annotationStorage) {
  49140. let rotation = annotationStorage?.get(this.data.id)?.rotation;
  49141. if (rotation === undefined) {
  49142. rotation = this.rotation;
  49143. }
  49144. if (rotation === 0) {
  49145. return IDENTITY_MATRIX;
  49146. }
  49147. const width = this.data.rect[2] - this.data.rect[0];
  49148. const height = this.data.rect[3] - this.data.rect[1];
  49149. return getRotationMatrix(rotation, width, height);
  49150. }
  49151. getBorderAndBackgroundAppearances(annotationStorage) {
  49152. let rotation = annotationStorage?.get(this.data.id)?.rotation;
  49153. if (rotation === undefined) {
  49154. rotation = this.rotation;
  49155. }
  49156. if (!this.backgroundColor && !this.borderColor) {
  49157. return "";
  49158. }
  49159. const width = this.data.rect[2] - this.data.rect[0];
  49160. const height = this.data.rect[3] - this.data.rect[1];
  49161. const rect = rotation === 0 || rotation === 180 ? `0 0 ${width} ${height} re` : `0 0 ${height} ${width} re`;
  49162. let str = "";
  49163. if (this.backgroundColor) {
  49164. str = `${getPdfColor(this.backgroundColor, true)} ${rect} f `;
  49165. }
  49166. if (this.borderColor) {
  49167. const borderWidth = this.borderStyle.width || 1;
  49168. str += `${borderWidth} w ${getPdfColor(this.borderColor, false)} ${rect} S `;
  49169. }
  49170. return str;
  49171. }
  49172. async getOperatorList(evaluator, task, intent, annotationStorage) {
  49173. if (intent & RenderingIntentFlag.ANNOTATIONS_FORMS && !(this instanceof SignatureWidgetAnnotation) && !this.data.noHTML && !this.data.hasOwnCanvas) {
  49174. return {
  49175. opList: new OperatorList(),
  49176. separateForm: true,
  49177. separateCanvas: false
  49178. };
  49179. }
  49180. if (!this._hasText) {
  49181. return super.getOperatorList(evaluator, task, intent, annotationStorage);
  49182. }
  49183. const content = await this._getAppearance(evaluator, task, intent, annotationStorage);
  49184. if (this.appearance && content === null) {
  49185. return super.getOperatorList(evaluator, task, intent, annotationStorage);
  49186. }
  49187. const opList = new OperatorList();
  49188. if (!this._defaultAppearance || content === null) {
  49189. return {
  49190. opList,
  49191. separateForm: false,
  49192. separateCanvas: false
  49193. };
  49194. }
  49195. const isUsingOwnCanvas = !!(this.data.hasOwnCanvas && intent & RenderingIntentFlag.DISPLAY);
  49196. const matrix = [1, 0, 0, 1, 0, 0];
  49197. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  49198. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  49199. let optionalContent;
  49200. if (this.oc) {
  49201. optionalContent = await evaluator.parseMarkedContentProps(this.oc, null);
  49202. }
  49203. if (optionalContent !== undefined) {
  49204. opList.addOp(OPS.beginMarkedContentProps, ["OC", optionalContent]);
  49205. }
  49206. opList.addOp(OPS.beginAnnotation, [this.data.id, this.data.rect, transform, this.getRotationMatrix(annotationStorage), isUsingOwnCanvas]);
  49207. const stream = new StringStream(content);
  49208. await evaluator.getOperatorList({
  49209. stream,
  49210. task,
  49211. resources: this._fieldResources.mergedResources,
  49212. operatorList: opList
  49213. });
  49214. opList.addOp(OPS.endAnnotation, []);
  49215. if (optionalContent !== undefined) {
  49216. opList.addOp(OPS.endMarkedContent, []);
  49217. }
  49218. return {
  49219. opList,
  49220. separateForm: false,
  49221. separateCanvas: isUsingOwnCanvas
  49222. };
  49223. }
  49224. _getMKDict(rotation) {
  49225. const mk = new Dict(null);
  49226. if (rotation) {
  49227. mk.set("R", rotation);
  49228. }
  49229. if (this.borderColor) {
  49230. mk.set("BC", getPdfColorArray(this.borderColor));
  49231. }
  49232. if (this.backgroundColor) {
  49233. mk.set("BG", getPdfColorArray(this.backgroundColor));
  49234. }
  49235. return mk.size > 0 ? mk : null;
  49236. }
  49237. amendSavedDict(annotationStorage, dict) {}
  49238. setValue(dict, value, xref, changes) {
  49239. const {
  49240. dict: parentDict,
  49241. ref: parentRef
  49242. } = getParentToUpdate(dict, this.ref, xref);
  49243. if (!parentDict) {
  49244. dict.set("V", value);
  49245. } else if (!changes.has(parentRef)) {
  49246. const newParentDict = parentDict.clone();
  49247. newParentDict.set("V", value);
  49248. changes.put(parentRef, {
  49249. data: newParentDict
  49250. });
  49251. return newParentDict;
  49252. }
  49253. return null;
  49254. }
  49255. async save(evaluator, task, annotationStorage, changes) {
  49256. const storageEntry = annotationStorage?.get(this.data.id);
  49257. const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
  49258. let value = storageEntry?.value,
  49259. rotation = storageEntry?.rotation;
  49260. if (value === this.data.fieldValue || value === undefined) {
  49261. if (!this._hasValueFromXFA && rotation === undefined && flags === undefined) {
  49262. return;
  49263. }
  49264. value ||= this.data.fieldValue;
  49265. }
  49266. if (rotation === undefined && !this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && isArrayEqual(value, this.data.fieldValue) && flags === undefined) {
  49267. return;
  49268. }
  49269. if (rotation === undefined) {
  49270. rotation = this.rotation;
  49271. }
  49272. let appearance = null;
  49273. if (!this._needAppearances) {
  49274. appearance = await this._getAppearance(evaluator, task, RenderingIntentFlag.SAVE, annotationStorage);
  49275. if (appearance === null && flags === undefined) {
  49276. return;
  49277. }
  49278. } else {}
  49279. let needAppearances = false;
  49280. if (appearance?.needAppearances) {
  49281. needAppearances = true;
  49282. appearance = null;
  49283. }
  49284. const {
  49285. xref
  49286. } = evaluator;
  49287. const originalDict = xref.fetchIfRef(this.ref);
  49288. if (!(originalDict instanceof Dict)) {
  49289. return;
  49290. }
  49291. const dict = new Dict(xref);
  49292. for (const key of originalDict.getKeys()) {
  49293. if (key !== "AP") {
  49294. dict.set(key, originalDict.getRaw(key));
  49295. }
  49296. }
  49297. if (flags !== undefined) {
  49298. dict.set("F", flags);
  49299. if (appearance === null && !needAppearances) {
  49300. const ap = originalDict.getRaw("AP");
  49301. if (ap) {
  49302. dict.set("AP", ap);
  49303. }
  49304. }
  49305. }
  49306. const xfa = {
  49307. path: this.data.fieldName,
  49308. value
  49309. };
  49310. const newParentDict = this.setValue(dict, Array.isArray(value) ? value.map(stringToAsciiOrUTF16BE) : stringToAsciiOrUTF16BE(value), xref, changes);
  49311. this.amendSavedDict(annotationStorage, newParentDict || dict);
  49312. const maybeMK = this._getMKDict(rotation);
  49313. if (maybeMK) {
  49314. dict.set("MK", maybeMK);
  49315. }
  49316. changes.put(this.ref, {
  49317. data: dict,
  49318. xfa,
  49319. needAppearances
  49320. });
  49321. if (appearance !== null) {
  49322. const newRef = xref.getNewTemporaryRef();
  49323. const AP = new Dict(xref);
  49324. dict.set("AP", AP);
  49325. AP.set("N", newRef);
  49326. const resources = this._getSaveFieldResources(xref);
  49327. const appearanceStream = new StringStream(appearance);
  49328. const appearanceDict = appearanceStream.dict = new Dict(xref);
  49329. appearanceDict.set("Subtype", Name.get("Form"));
  49330. appearanceDict.set("Resources", resources);
  49331. appearanceDict.set("BBox", [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]]);
  49332. const rotationMatrix = this.getRotationMatrix(annotationStorage);
  49333. if (rotationMatrix !== IDENTITY_MATRIX) {
  49334. appearanceDict.set("Matrix", rotationMatrix);
  49335. }
  49336. changes.put(newRef, {
  49337. data: appearanceStream,
  49338. xfa: null,
  49339. needAppearances: false
  49340. });
  49341. }
  49342. dict.set("M", `D:${getModificationDate()}`);
  49343. }
  49344. async _getAppearance(evaluator, task, intent, annotationStorage) {
  49345. const isPassword = this.hasFieldFlag(AnnotationFieldFlag.PASSWORD);
  49346. if (isPassword) {
  49347. return null;
  49348. }
  49349. const storageEntry = annotationStorage?.get(this.data.id);
  49350. let value, rotation;
  49351. if (storageEntry) {
  49352. value = storageEntry.formattedValue || storageEntry.value;
  49353. rotation = storageEntry.rotation;
  49354. }
  49355. if (rotation === undefined && value === undefined && !this._needAppearances) {
  49356. if (!this._hasValueFromXFA || this.appearance) {
  49357. return null;
  49358. }
  49359. }
  49360. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  49361. if (value === undefined) {
  49362. value = this.data.fieldValue;
  49363. if (!value) {
  49364. return `/Tx BMC q ${colors}Q EMC`;
  49365. }
  49366. }
  49367. if (Array.isArray(value) && value.length === 1) {
  49368. value = value[0];
  49369. }
  49370. assert(typeof value === "string", "Expected `value` to be a string.");
  49371. value = value.trimEnd();
  49372. if (this.data.combo) {
  49373. const option = this.data.options.find(({
  49374. exportValue
  49375. }) => value === exportValue);
  49376. value = option?.displayValue || value;
  49377. }
  49378. if (value === "") {
  49379. return `/Tx BMC q ${colors}Q EMC`;
  49380. }
  49381. if (rotation === undefined) {
  49382. rotation = this.rotation;
  49383. }
  49384. let lineCount = -1;
  49385. let lines;
  49386. if (this.data.multiLine) {
  49387. lines = value.split(/\r\n?|\n/).map(line => line.normalize("NFC"));
  49388. lineCount = lines.length;
  49389. } else {
  49390. lines = [value.replace(/\r\n?|\n/, "").normalize("NFC")];
  49391. }
  49392. const defaultPadding = 1;
  49393. const defaultHPadding = 2;
  49394. let totalHeight = this.data.rect[3] - this.data.rect[1];
  49395. let totalWidth = this.data.rect[2] - this.data.rect[0];
  49396. if (rotation === 90 || rotation === 270) {
  49397. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  49398. }
  49399. if (!this._defaultAppearance) {
  49400. this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  49401. }
  49402. let font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  49403. let defaultAppearance, fontSize, lineHeight;
  49404. const encodedLines = [];
  49405. let encodingError = false;
  49406. for (const line of lines) {
  49407. const encodedString = font.encodeString(line);
  49408. if (encodedString.length > 1) {
  49409. encodingError = true;
  49410. }
  49411. encodedLines.push(encodedString.join(""));
  49412. }
  49413. if (encodingError && intent & RenderingIntentFlag.SAVE) {
  49414. return {
  49415. needAppearances: true
  49416. };
  49417. }
  49418. if (encodingError && this._isOffscreenCanvasSupported) {
  49419. const fontFamily = this.data.comb ? "monospace" : "sans-serif";
  49420. const fakeUnicodeFont = new FakeUnicodeFont(evaluator.xref, fontFamily);
  49421. const resources = fakeUnicodeFont.createFontResources(lines.join(""));
  49422. const newFont = resources.getRaw("Font");
  49423. if (this._fieldResources.mergedResources.has("Font")) {
  49424. const oldFont = this._fieldResources.mergedResources.get("Font");
  49425. for (const key of newFont.getKeys()) {
  49426. oldFont.set(key, newFont.getRaw(key));
  49427. }
  49428. } else {
  49429. this._fieldResources.mergedResources.set("Font", newFont);
  49430. }
  49431. const fontName = fakeUnicodeFont.fontName.name;
  49432. font = await WidgetAnnotation._getFontData(evaluator, task, {
  49433. fontName,
  49434. fontSize: 0
  49435. }, resources);
  49436. for (let i = 0, ii = encodedLines.length; i < ii; i++) {
  49437. encodedLines[i] = stringToUTF16String(lines[i]);
  49438. }
  49439. const savedDefaultAppearance = Object.assign(Object.create(null), this.data.defaultAppearanceData);
  49440. this.data.defaultAppearanceData.fontSize = 0;
  49441. this.data.defaultAppearanceData.fontName = fontName;
  49442. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  49443. this.data.defaultAppearanceData = savedDefaultAppearance;
  49444. } else {
  49445. if (!this._isOffscreenCanvasSupported) {
  49446. warn("_getAppearance: OffscreenCanvas is not supported, annotation may not render correctly.");
  49447. }
  49448. [defaultAppearance, fontSize, lineHeight] = this._computeFontSize(totalHeight - 2 * defaultPadding, totalWidth - 2 * defaultHPadding, value, font, lineCount);
  49449. }
  49450. let descent = font.descent;
  49451. if (isNaN(descent)) {
  49452. descent = BASELINE_FACTOR * lineHeight;
  49453. } else {
  49454. descent = Math.max(BASELINE_FACTOR * lineHeight, Math.abs(descent) * fontSize);
  49455. }
  49456. const defaultVPadding = Math.min(Math.floor((totalHeight - fontSize) / 2), defaultPadding);
  49457. const alignment = this.data.textAlignment;
  49458. if (this.data.multiLine) {
  49459. return this._getMultilineAppearance(defaultAppearance, encodedLines, font, fontSize, totalWidth, totalHeight, alignment, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  49460. }
  49461. if (this.data.comb) {
  49462. return this._getCombAppearance(defaultAppearance, font, encodedLines[0], fontSize, totalWidth, totalHeight, defaultHPadding, defaultVPadding, descent, lineHeight, annotationStorage);
  49463. }
  49464. const bottomPadding = defaultVPadding + descent;
  49465. if (alignment === 0 || alignment > 2) {
  49466. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(defaultHPadding)} ${numberToString(bottomPadding)} Tm (${escapeString(encodedLines[0])}) Tj` + " ET Q EMC";
  49467. }
  49468. const prevInfo = {
  49469. shift: 0
  49470. };
  49471. const renderedText = this._renderText(encodedLines[0], font, fontSize, totalWidth, alignment, prevInfo, defaultHPadding, bottomPadding);
  49472. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  49473. }
  49474. static async _getFontData(evaluator, task, appearanceData, resources) {
  49475. const operatorList = new OperatorList();
  49476. const initialState = {
  49477. font: null,
  49478. clone() {
  49479. return this;
  49480. }
  49481. };
  49482. const {
  49483. fontName,
  49484. fontSize
  49485. } = appearanceData;
  49486. await evaluator.handleSetFont(resources, [fontName && Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  49487. return initialState.font;
  49488. }
  49489. _getTextWidth(text, font) {
  49490. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  49491. }
  49492. _computeFontSize(height, width, text, font, lineCount) {
  49493. let {
  49494. fontSize
  49495. } = this.data.defaultAppearanceData;
  49496. let lineHeight = (fontSize || 12) * LINE_FACTOR,
  49497. numberOfLines = Math.round(height / lineHeight);
  49498. if (!fontSize) {
  49499. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  49500. if (lineCount === -1) {
  49501. const textWidth = this._getTextWidth(text, font);
  49502. fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth));
  49503. numberOfLines = 1;
  49504. } else {
  49505. const lines = text.split(/\r\n?|\n/);
  49506. const cachedLines = [];
  49507. for (const line of lines) {
  49508. const encoded = font.encodeString(line).join("");
  49509. const glyphs = font.charsToGlyphs(encoded);
  49510. const positions = font.getCharPositions(encoded);
  49511. cachedLines.push({
  49512. line: encoded,
  49513. glyphs,
  49514. positions
  49515. });
  49516. }
  49517. const isTooBig = fsize => {
  49518. let totalHeight = 0;
  49519. for (const cache of cachedLines) {
  49520. const chunks = this._splitLine(null, font, fsize, width, cache);
  49521. totalHeight += chunks.length * fsize;
  49522. if (totalHeight > height) {
  49523. return true;
  49524. }
  49525. }
  49526. return false;
  49527. };
  49528. numberOfLines = Math.max(numberOfLines, lineCount);
  49529. while (true) {
  49530. lineHeight = height / numberOfLines;
  49531. fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR);
  49532. if (isTooBig(fontSize)) {
  49533. numberOfLines++;
  49534. continue;
  49535. }
  49536. break;
  49537. }
  49538. }
  49539. const {
  49540. fontName,
  49541. fontColor
  49542. } = this.data.defaultAppearanceData;
  49543. this._defaultAppearance = createDefaultAppearance({
  49544. fontSize,
  49545. fontName,
  49546. fontColor
  49547. });
  49548. }
  49549. return [this._defaultAppearance, fontSize, height / numberOfLines];
  49550. }
  49551. _renderText(text, font, fontSize, totalWidth, alignment, prevInfo, hPadding, vPadding) {
  49552. let shift;
  49553. if (alignment === 1) {
  49554. const width = this._getTextWidth(text, font) * fontSize;
  49555. shift = (totalWidth - width) / 2;
  49556. } else if (alignment === 2) {
  49557. const width = this._getTextWidth(text, font) * fontSize;
  49558. shift = totalWidth - width - hPadding;
  49559. } else {
  49560. shift = hPadding;
  49561. }
  49562. const shiftStr = numberToString(shift - prevInfo.shift);
  49563. prevInfo.shift = shift;
  49564. vPadding = numberToString(vPadding);
  49565. return `${shiftStr} ${vPadding} Td (${escapeString(text)}) Tj`;
  49566. }
  49567. _getSaveFieldResources(xref) {
  49568. const {
  49569. localResources,
  49570. appearanceResources,
  49571. acroFormResources
  49572. } = this._fieldResources;
  49573. const fontName = this.data.defaultAppearanceData?.fontName;
  49574. if (!fontName) {
  49575. return localResources || Dict.empty;
  49576. }
  49577. for (const resources of [localResources, appearanceResources]) {
  49578. if (resources instanceof Dict) {
  49579. const localFont = resources.get("Font");
  49580. if (localFont instanceof Dict && localFont.has(fontName)) {
  49581. return resources;
  49582. }
  49583. }
  49584. }
  49585. if (acroFormResources instanceof Dict) {
  49586. const acroFormFont = acroFormResources.get("Font");
  49587. if (acroFormFont instanceof Dict && acroFormFont.has(fontName)) {
  49588. const subFontDict = new Dict(xref);
  49589. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  49590. const subResourcesDict = new Dict(xref);
  49591. subResourcesDict.set("Font", subFontDict);
  49592. return Dict.merge({
  49593. xref,
  49594. dictArray: [subResourcesDict, localResources],
  49595. mergeSubDicts: true
  49596. });
  49597. }
  49598. }
  49599. return localResources || Dict.empty;
  49600. }
  49601. getFieldObject() {
  49602. return null;
  49603. }
  49604. }
  49605. class TextWidgetAnnotation extends WidgetAnnotation {
  49606. constructor(params) {
  49607. super(params);
  49608. const {
  49609. dict
  49610. } = params;
  49611. if (dict.has("PMD")) {
  49612. this.flags |= AnnotationFlag.HIDDEN;
  49613. this.data.hidden = true;
  49614. warn("Barcodes are not supported");
  49615. }
  49616. this.data.hasOwnCanvas = this.data.readOnly && !this.data.noHTML;
  49617. this._hasText = true;
  49618. if (typeof this.data.fieldValue !== "string") {
  49619. this.data.fieldValue = "";
  49620. }
  49621. let alignment = getInheritableProperty({
  49622. dict,
  49623. key: "Q"
  49624. });
  49625. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  49626. alignment = null;
  49627. }
  49628. this.data.textAlignment = alignment;
  49629. let maximumLength = getInheritableProperty({
  49630. dict,
  49631. key: "MaxLen"
  49632. });
  49633. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  49634. maximumLength = 0;
  49635. }
  49636. this.data.maxLen = maximumLength;
  49637. this.data.multiLine = this.hasFieldFlag(AnnotationFieldFlag.MULTILINE);
  49638. this.data.comb = this.hasFieldFlag(AnnotationFieldFlag.COMB) && !this.hasFieldFlag(AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== 0;
  49639. this.data.doNotScroll = this.hasFieldFlag(AnnotationFieldFlag.DONOTSCROLL);
  49640. }
  49641. get hasTextContent() {
  49642. return !!this.appearance && !this._needAppearances;
  49643. }
  49644. _getCombAppearance(defaultAppearance, font, text, fontSize, width, height, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  49645. const combWidth = width / this.data.maxLen;
  49646. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  49647. const buf = [];
  49648. const positions = font.getCharPositions(text);
  49649. for (const [start, end] of positions) {
  49650. buf.push(`(${escapeString(text.substring(start, end))}) Tj`);
  49651. }
  49652. const renderedComb = buf.join(` ${numberToString(combWidth)} 0 Td `);
  49653. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 ${numberToString(hPadding)} ${numberToString(vPadding + descent)} Tm ${renderedComb}` + " ET Q EMC";
  49654. }
  49655. _getMultilineAppearance(defaultAppearance, lines, font, fontSize, width, height, alignment, hPadding, vPadding, descent, lineHeight, annotationStorage) {
  49656. const buf = [];
  49657. const totalWidth = width - 2 * hPadding;
  49658. const prevInfo = {
  49659. shift: 0
  49660. };
  49661. for (let i = 0, ii = lines.length; i < ii; i++) {
  49662. const line = lines[i];
  49663. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  49664. for (let j = 0, jj = chunks.length; j < jj; j++) {
  49665. const chunk = chunks[j];
  49666. const vShift = i === 0 && j === 0 ? -vPadding - (lineHeight - descent) : -lineHeight;
  49667. buf.push(this._renderText(chunk, font, fontSize, width, alignment, prevInfo, hPadding, vShift));
  49668. }
  49669. }
  49670. const colors = this.getBorderAndBackgroundAppearances(annotationStorage);
  49671. const renderedText = buf.join("\n");
  49672. return `/Tx BMC q ${colors}BT ` + defaultAppearance + ` 1 0 0 1 0 ${numberToString(height)} Tm ${renderedText}` + " ET Q EMC";
  49673. }
  49674. _splitLine(line, font, fontSize, width, cache = {}) {
  49675. line = cache.line || line;
  49676. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  49677. if (glyphs.length <= 1) {
  49678. return [line];
  49679. }
  49680. const positions = cache.positions || font.getCharPositions(line);
  49681. const scale = fontSize / 1000;
  49682. const chunks = [];
  49683. let lastSpacePosInStringStart = -1,
  49684. lastSpacePosInStringEnd = -1,
  49685. lastSpacePos = -1,
  49686. startChunk = 0,
  49687. currentWidth = 0;
  49688. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  49689. const [start, end] = positions[i];
  49690. const glyph = glyphs[i];
  49691. const glyphWidth = glyph.width * scale;
  49692. if (glyph.unicode === " ") {
  49693. if (currentWidth + glyphWidth > width) {
  49694. chunks.push(line.substring(startChunk, start));
  49695. startChunk = start;
  49696. currentWidth = glyphWidth;
  49697. lastSpacePosInStringStart = -1;
  49698. lastSpacePos = -1;
  49699. } else {
  49700. currentWidth += glyphWidth;
  49701. lastSpacePosInStringStart = start;
  49702. lastSpacePosInStringEnd = end;
  49703. lastSpacePos = i;
  49704. }
  49705. } else if (currentWidth + glyphWidth > width) {
  49706. if (lastSpacePosInStringStart !== -1) {
  49707. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  49708. startChunk = lastSpacePosInStringEnd;
  49709. i = lastSpacePos + 1;
  49710. lastSpacePosInStringStart = -1;
  49711. currentWidth = 0;
  49712. } else {
  49713. chunks.push(line.substring(startChunk, start));
  49714. startChunk = start;
  49715. currentWidth = glyphWidth;
  49716. }
  49717. } else {
  49718. currentWidth += glyphWidth;
  49719. }
  49720. }
  49721. if (startChunk < line.length) {
  49722. chunks.push(line.substring(startChunk, line.length));
  49723. }
  49724. return chunks;
  49725. }
  49726. async extractTextContent(evaluator, task, viewBox) {
  49727. await super.extractTextContent(evaluator, task, viewBox);
  49728. const text = this.data.textContent;
  49729. if (!text) {
  49730. return;
  49731. }
  49732. const allText = text.join("\n");
  49733. if (allText === this.data.fieldValue) {
  49734. return;
  49735. }
  49736. const regex = allText.replaceAll(/([.*+?^${}()|[\]\\])|(\s+)/g, (_m, p1) => p1 ? `\\${p1}` : "\\s+");
  49737. if (new RegExp(`^\\s*${regex}\\s*$`).test(this.data.fieldValue)) {
  49738. this.data.textContent = this.data.fieldValue.split("\n");
  49739. }
  49740. }
  49741. getFieldObject() {
  49742. return {
  49743. id: this.data.id,
  49744. value: this.data.fieldValue,
  49745. defaultValue: this.data.defaultFieldValue || "",
  49746. multiline: this.data.multiLine,
  49747. password: this.hasFieldFlag(AnnotationFieldFlag.PASSWORD),
  49748. charLimit: this.data.maxLen,
  49749. comb: this.data.comb,
  49750. editable: !this.data.readOnly,
  49751. hidden: this.data.hidden,
  49752. name: this.data.fieldName,
  49753. rect: this.data.rect,
  49754. actions: this.data.actions,
  49755. page: this.data.pageIndex,
  49756. strokeColor: this.data.borderColor,
  49757. fillColor: this.data.backgroundColor,
  49758. rotation: this.rotation,
  49759. type: "text"
  49760. };
  49761. }
  49762. }
  49763. class ButtonWidgetAnnotation extends WidgetAnnotation {
  49764. constructor(params) {
  49765. super(params);
  49766. this.checkedAppearance = null;
  49767. this.uncheckedAppearance = null;
  49768. this.data.checkBox = !this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  49769. this.data.radioButton = this.hasFieldFlag(AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  49770. this.data.pushButton = this.hasFieldFlag(AnnotationFieldFlag.PUSHBUTTON);
  49771. this.data.isTooltipOnly = false;
  49772. if (this.data.checkBox) {
  49773. this._processCheckBox(params);
  49774. } else if (this.data.radioButton) {
  49775. this._processRadioButton(params);
  49776. } else if (this.data.pushButton) {
  49777. this.data.hasOwnCanvas = true;
  49778. this.data.noHTML = false;
  49779. this._processPushButton(params);
  49780. } else {
  49781. warn("Invalid field flags for button widget annotation");
  49782. }
  49783. }
  49784. async getOperatorList(evaluator, task, intent, annotationStorage) {
  49785. if (this.data.pushButton) {
  49786. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  49787. }
  49788. let value = null;
  49789. let rotation = null;
  49790. if (annotationStorage) {
  49791. const storageEntry = annotationStorage.get(this.data.id);
  49792. value = storageEntry ? storageEntry.value : null;
  49793. rotation = storageEntry ? storageEntry.rotation : null;
  49794. }
  49795. if (value === null && this.appearance) {
  49796. return super.getOperatorList(evaluator, task, intent, annotationStorage);
  49797. }
  49798. if (value === null || value === undefined) {
  49799. value = this.data.checkBox ? this.data.fieldValue === this.data.exportValue : this.data.fieldValue === this.data.buttonValue;
  49800. }
  49801. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  49802. if (appearance) {
  49803. const savedAppearance = this.appearance;
  49804. const savedMatrix = lookupMatrix(appearance.dict.getArray("Matrix"), IDENTITY_MATRIX);
  49805. if (rotation) {
  49806. appearance.dict.set("Matrix", this.getRotationMatrix(annotationStorage));
  49807. }
  49808. this.appearance = appearance;
  49809. const operatorList = super.getOperatorList(evaluator, task, intent, annotationStorage);
  49810. this.appearance = savedAppearance;
  49811. appearance.dict.set("Matrix", savedMatrix);
  49812. return operatorList;
  49813. }
  49814. return {
  49815. opList: new OperatorList(),
  49816. separateForm: false,
  49817. separateCanvas: false
  49818. };
  49819. }
  49820. async save(evaluator, task, annotationStorage, changes) {
  49821. if (this.data.checkBox) {
  49822. this._saveCheckbox(evaluator, task, annotationStorage, changes);
  49823. return;
  49824. }
  49825. if (this.data.radioButton) {
  49826. this._saveRadioButton(evaluator, task, annotationStorage, changes);
  49827. }
  49828. }
  49829. async _saveCheckbox(evaluator, task, annotationStorage, changes) {
  49830. if (!annotationStorage) {
  49831. return;
  49832. }
  49833. const storageEntry = annotationStorage.get(this.data.id);
  49834. const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
  49835. let rotation = storageEntry?.rotation,
  49836. value = storageEntry?.value;
  49837. if (rotation === undefined && flags === undefined) {
  49838. if (value === undefined) {
  49839. return;
  49840. }
  49841. const defaultValue = this.data.fieldValue === this.data.exportValue;
  49842. if (defaultValue === value) {
  49843. return;
  49844. }
  49845. }
  49846. let dict = evaluator.xref.fetchIfRef(this.ref);
  49847. if (!(dict instanceof Dict)) {
  49848. return;
  49849. }
  49850. dict = dict.clone();
  49851. if (rotation === undefined) {
  49852. rotation = this.rotation;
  49853. }
  49854. if (value === undefined) {
  49855. value = this.data.fieldValue === this.data.exportValue;
  49856. }
  49857. const xfa = {
  49858. path: this.data.fieldName,
  49859. value: value ? this.data.exportValue : ""
  49860. };
  49861. const name = Name.get(value ? this.data.exportValue : "Off");
  49862. this.setValue(dict, name, evaluator.xref, changes);
  49863. dict.set("AS", name);
  49864. dict.set("M", `D:${getModificationDate()}`);
  49865. if (flags !== undefined) {
  49866. dict.set("F", flags);
  49867. }
  49868. const maybeMK = this._getMKDict(rotation);
  49869. if (maybeMK) {
  49870. dict.set("MK", maybeMK);
  49871. }
  49872. changes.put(this.ref, {
  49873. data: dict,
  49874. xfa,
  49875. needAppearances: false
  49876. });
  49877. }
  49878. async _saveRadioButton(evaluator, task, annotationStorage, changes) {
  49879. if (!annotationStorage) {
  49880. return;
  49881. }
  49882. const storageEntry = annotationStorage.get(this.data.id);
  49883. const flags = this._buildFlags(storageEntry?.noView, storageEntry?.noPrint);
  49884. let rotation = storageEntry?.rotation,
  49885. value = storageEntry?.value;
  49886. if (rotation === undefined && flags === undefined) {
  49887. if (value === undefined) {
  49888. return;
  49889. }
  49890. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  49891. if (defaultValue === value) {
  49892. return;
  49893. }
  49894. }
  49895. let dict = evaluator.xref.fetchIfRef(this.ref);
  49896. if (!(dict instanceof Dict)) {
  49897. return;
  49898. }
  49899. dict = dict.clone();
  49900. if (value === undefined) {
  49901. value = this.data.fieldValue === this.data.buttonValue;
  49902. }
  49903. if (rotation === undefined) {
  49904. rotation = this.rotation;
  49905. }
  49906. const xfa = {
  49907. path: this.data.fieldName,
  49908. value: value ? this.data.buttonValue : ""
  49909. };
  49910. const name = Name.get(value ? this.data.buttonValue : "Off");
  49911. if (value) {
  49912. this.setValue(dict, name, evaluator.xref, changes);
  49913. }
  49914. dict.set("AS", name);
  49915. dict.set("M", `D:${getModificationDate()}`);
  49916. if (flags !== undefined) {
  49917. dict.set("F", flags);
  49918. }
  49919. const maybeMK = this._getMKDict(rotation);
  49920. if (maybeMK) {
  49921. dict.set("MK", maybeMK);
  49922. }
  49923. changes.put(this.ref, {
  49924. data: dict,
  49925. xfa,
  49926. needAppearances: false
  49927. });
  49928. }
  49929. _getDefaultCheckedAppearance(params, type) {
  49930. const width = this.data.rect[2] - this.data.rect[0];
  49931. const height = this.data.rect[3] - this.data.rect[1];
  49932. const bbox = [0, 0, width, height];
  49933. const FONT_RATIO = 0.8;
  49934. const fontSize = Math.min(width, height) * FONT_RATIO;
  49935. let metrics, char;
  49936. if (type === "check") {
  49937. metrics = {
  49938. width: 0.755 * fontSize,
  49939. height: 0.705 * fontSize
  49940. };
  49941. char = "\x33";
  49942. } else if (type === "disc") {
  49943. metrics = {
  49944. width: 0.791 * fontSize,
  49945. height: 0.705 * fontSize
  49946. };
  49947. char = "\x6C";
  49948. } else {
  49949. unreachable(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  49950. }
  49951. const xShift = numberToString((width - metrics.width) / 2);
  49952. const yShift = numberToString((height - metrics.height) / 2);
  49953. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  49954. const appearanceStreamDict = new Dict(params.xref);
  49955. appearanceStreamDict.set("FormType", 1);
  49956. appearanceStreamDict.set("Subtype", Name.get("Form"));
  49957. appearanceStreamDict.set("Type", Name.get("XObject"));
  49958. appearanceStreamDict.set("BBox", bbox);
  49959. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  49960. appearanceStreamDict.set("Length", appearance.length);
  49961. const resources = new Dict(params.xref);
  49962. const font = new Dict(params.xref);
  49963. font.set("PdfJsZaDb", this.fallbackFontDict);
  49964. resources.set("Font", font);
  49965. appearanceStreamDict.set("Resources", resources);
  49966. this.checkedAppearance = new StringStream(appearance);
  49967. this.checkedAppearance.dict = appearanceStreamDict;
  49968. this._streams.push(this.checkedAppearance);
  49969. }
  49970. _processCheckBox(params) {
  49971. const customAppearance = params.dict.get("AP");
  49972. if (!(customAppearance instanceof Dict)) {
  49973. return;
  49974. }
  49975. const normalAppearance = customAppearance.get("N");
  49976. if (!(normalAppearance instanceof Dict)) {
  49977. return;
  49978. }
  49979. const asValue = this._decodeFormValue(params.dict.get("AS"));
  49980. if (typeof asValue === "string") {
  49981. this.data.fieldValue = asValue;
  49982. }
  49983. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  49984. const exportValues = normalAppearance.getKeys();
  49985. if (exportValues.length === 0) {
  49986. exportValues.push("Off", yes);
  49987. } else if (exportValues.length === 1) {
  49988. if (exportValues[0] === "Off") {
  49989. exportValues.push(yes);
  49990. } else {
  49991. exportValues.unshift("Off");
  49992. }
  49993. } else if (exportValues.includes(yes)) {
  49994. exportValues.length = 0;
  49995. exportValues.push("Off", yes);
  49996. } else {
  49997. const otherYes = exportValues.find(v => v !== "Off");
  49998. exportValues.length = 0;
  49999. exportValues.push("Off", otherYes);
  50000. }
  50001. if (!exportValues.includes(this.data.fieldValue)) {
  50002. this.data.fieldValue = "Off";
  50003. }
  50004. this.data.exportValue = exportValues[1];
  50005. const checkedAppearance = normalAppearance.get(this.data.exportValue);
  50006. this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
  50007. const uncheckedAppearance = normalAppearance.get("Off");
  50008. this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
  50009. if (this.checkedAppearance) {
  50010. this._streams.push(this.checkedAppearance);
  50011. } else {
  50012. this._getDefaultCheckedAppearance(params, "check");
  50013. }
  50014. if (this.uncheckedAppearance) {
  50015. this._streams.push(this.uncheckedAppearance);
  50016. }
  50017. this._fallbackFontDict = this.fallbackFontDict;
  50018. if (this.data.defaultFieldValue === null) {
  50019. this.data.defaultFieldValue = "Off";
  50020. }
  50021. }
  50022. _processRadioButton(params) {
  50023. this.data.buttonValue = null;
  50024. const fieldParent = params.dict.get("Parent");
  50025. if (fieldParent instanceof Dict) {
  50026. this.parent = params.dict.getRaw("Parent");
  50027. const fieldParentValue = fieldParent.get("V");
  50028. if (fieldParentValue instanceof Name) {
  50029. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  50030. }
  50031. }
  50032. const appearanceStates = params.dict.get("AP");
  50033. if (!(appearanceStates instanceof Dict)) {
  50034. return;
  50035. }
  50036. const normalAppearance = appearanceStates.get("N");
  50037. if (!(normalAppearance instanceof Dict)) {
  50038. return;
  50039. }
  50040. for (const key of normalAppearance.getKeys()) {
  50041. if (key !== "Off") {
  50042. this.data.buttonValue = this._decodeFormValue(key);
  50043. break;
  50044. }
  50045. }
  50046. const checkedAppearance = normalAppearance.get(this.data.buttonValue);
  50047. this.checkedAppearance = checkedAppearance instanceof BaseStream ? checkedAppearance : null;
  50048. const uncheckedAppearance = normalAppearance.get("Off");
  50049. this.uncheckedAppearance = uncheckedAppearance instanceof BaseStream ? uncheckedAppearance : null;
  50050. if (this.checkedAppearance) {
  50051. this._streams.push(this.checkedAppearance);
  50052. } else {
  50053. this._getDefaultCheckedAppearance(params, "disc");
  50054. }
  50055. if (this.uncheckedAppearance) {
  50056. this._streams.push(this.uncheckedAppearance);
  50057. }
  50058. this._fallbackFontDict = this.fallbackFontDict;
  50059. if (this.data.defaultFieldValue === null) {
  50060. this.data.defaultFieldValue = "Off";
  50061. }
  50062. }
  50063. _processPushButton(params) {
  50064. const {
  50065. dict,
  50066. annotationGlobals
  50067. } = params;
  50068. if (!dict.has("A") && !dict.has("AA") && !this.data.alternativeText) {
  50069. warn("Push buttons without action dictionaries are not supported");
  50070. return;
  50071. }
  50072. this.data.isTooltipOnly = !dict.has("A") && !dict.has("AA");
  50073. Catalog.parseDestDictionary({
  50074. destDict: dict,
  50075. resultObj: this.data,
  50076. docBaseUrl: annotationGlobals.baseUrl,
  50077. docAttachments: annotationGlobals.attachments
  50078. });
  50079. }
  50080. getFieldObject() {
  50081. let type = "button";
  50082. let exportValues;
  50083. if (this.data.checkBox) {
  50084. type = "checkbox";
  50085. exportValues = this.data.exportValue;
  50086. } else if (this.data.radioButton) {
  50087. type = "radiobutton";
  50088. exportValues = this.data.buttonValue;
  50089. }
  50090. return {
  50091. id: this.data.id,
  50092. value: this.data.fieldValue || "Off",
  50093. defaultValue: this.data.defaultFieldValue,
  50094. exportValues,
  50095. editable: !this.data.readOnly,
  50096. name: this.data.fieldName,
  50097. rect: this.data.rect,
  50098. hidden: this.data.hidden,
  50099. actions: this.data.actions,
  50100. page: this.data.pageIndex,
  50101. strokeColor: this.data.borderColor,
  50102. fillColor: this.data.backgroundColor,
  50103. rotation: this.rotation,
  50104. type
  50105. };
  50106. }
  50107. get fallbackFontDict() {
  50108. const dict = new Dict();
  50109. dict.set("BaseFont", Name.get("ZapfDingbats"));
  50110. dict.set("Type", Name.get("FallbackType"));
  50111. dict.set("Subtype", Name.get("FallbackType"));
  50112. dict.set("Encoding", Name.get("ZapfDingbatsEncoding"));
  50113. return shadow(this, "fallbackFontDict", dict);
  50114. }
  50115. }
  50116. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  50117. constructor(params) {
  50118. super(params);
  50119. const {
  50120. dict,
  50121. xref
  50122. } = params;
  50123. this.indices = dict.getArray("I");
  50124. this.hasIndices = Array.isArray(this.indices) && this.indices.length > 0;
  50125. this.data.options = [];
  50126. const options = getInheritableProperty({
  50127. dict,
  50128. key: "Opt"
  50129. });
  50130. if (Array.isArray(options)) {
  50131. for (let i = 0, ii = options.length; i < ii; i++) {
  50132. const option = xref.fetchIfRef(options[i]);
  50133. const isOptionArray = Array.isArray(option);
  50134. this.data.options[i] = {
  50135. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  50136. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  50137. };
  50138. }
  50139. }
  50140. if (!this.hasIndices) {
  50141. if (typeof this.data.fieldValue === "string") {
  50142. this.data.fieldValue = [this.data.fieldValue];
  50143. } else if (!this.data.fieldValue) {
  50144. this.data.fieldValue = [];
  50145. }
  50146. } else {
  50147. this.data.fieldValue = [];
  50148. const ii = this.data.options.length;
  50149. for (const i of this.indices) {
  50150. if (Number.isInteger(i) && i >= 0 && i < ii) {
  50151. this.data.fieldValue.push(this.data.options[i].exportValue);
  50152. }
  50153. }
  50154. }
  50155. if (this.data.options.length === 0 && this.data.fieldValue.length > 0) {
  50156. this.data.options = this.data.fieldValue.map(value => ({
  50157. exportValue: value,
  50158. displayValue: value
  50159. }));
  50160. }
  50161. this.data.combo = this.hasFieldFlag(AnnotationFieldFlag.COMBO);
  50162. this.data.multiSelect = this.hasFieldFlag(AnnotationFieldFlag.MULTISELECT);
  50163. this._hasText = true;
  50164. }
  50165. getFieldObject() {
  50166. const type = this.data.combo ? "combobox" : "listbox";
  50167. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  50168. return {
  50169. id: this.data.id,
  50170. value,
  50171. defaultValue: this.data.defaultFieldValue,
  50172. editable: !this.data.readOnly,
  50173. name: this.data.fieldName,
  50174. rect: this.data.rect,
  50175. numItems: this.data.fieldValue.length,
  50176. multipleSelection: this.data.multiSelect,
  50177. hidden: this.data.hidden,
  50178. actions: this.data.actions,
  50179. items: this.data.options,
  50180. page: this.data.pageIndex,
  50181. strokeColor: this.data.borderColor,
  50182. fillColor: this.data.backgroundColor,
  50183. rotation: this.rotation,
  50184. type
  50185. };
  50186. }
  50187. amendSavedDict(annotationStorage, dict) {
  50188. if (!this.hasIndices) {
  50189. return;
  50190. }
  50191. let values = annotationStorage?.get(this.data.id)?.value;
  50192. if (!Array.isArray(values)) {
  50193. values = [values];
  50194. }
  50195. const indices = [];
  50196. const {
  50197. options
  50198. } = this.data;
  50199. for (let i = 0, j = 0, ii = options.length; i < ii; i++) {
  50200. if (options[i].exportValue === values[j]) {
  50201. indices.push(i);
  50202. j += 1;
  50203. }
  50204. }
  50205. dict.set("I", indices);
  50206. }
  50207. async _getAppearance(evaluator, task, intent, annotationStorage) {
  50208. if (this.data.combo) {
  50209. return super._getAppearance(evaluator, task, intent, annotationStorage);
  50210. }
  50211. let exportedValue, rotation;
  50212. const storageEntry = annotationStorage?.get(this.data.id);
  50213. if (storageEntry) {
  50214. rotation = storageEntry.rotation;
  50215. exportedValue = storageEntry.value;
  50216. }
  50217. if (rotation === undefined && exportedValue === undefined && !this._needAppearances) {
  50218. return null;
  50219. }
  50220. if (exportedValue === undefined) {
  50221. exportedValue = this.data.fieldValue;
  50222. } else if (!Array.isArray(exportedValue)) {
  50223. exportedValue = [exportedValue];
  50224. }
  50225. const defaultPadding = 1;
  50226. const defaultHPadding = 2;
  50227. let totalHeight = this.data.rect[3] - this.data.rect[1];
  50228. let totalWidth = this.data.rect[2] - this.data.rect[0];
  50229. if (rotation === 90 || rotation === 270) {
  50230. [totalWidth, totalHeight] = [totalHeight, totalWidth];
  50231. }
  50232. const lineCount = this.data.options.length;
  50233. const valueIndices = [];
  50234. for (let i = 0; i < lineCount; i++) {
  50235. const {
  50236. exportValue
  50237. } = this.data.options[i];
  50238. if (exportedValue.includes(exportValue)) {
  50239. valueIndices.push(i);
  50240. }
  50241. }
  50242. if (!this._defaultAppearance) {
  50243. this.data.defaultAppearanceData = parseDefaultAppearance(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  50244. }
  50245. const font = await WidgetAnnotation._getFontData(evaluator, task, this.data.defaultAppearanceData, this._fieldResources.mergedResources);
  50246. let defaultAppearance;
  50247. let {
  50248. fontSize
  50249. } = this.data.defaultAppearanceData;
  50250. if (!fontSize) {
  50251. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  50252. let lineWidth = -1;
  50253. let value;
  50254. for (const {
  50255. displayValue
  50256. } of this.data.options) {
  50257. const width = this._getTextWidth(displayValue, font);
  50258. if (width > lineWidth) {
  50259. lineWidth = width;
  50260. value = displayValue;
  50261. }
  50262. }
  50263. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * defaultHPadding, value, font, -1);
  50264. } else {
  50265. defaultAppearance = this._defaultAppearance;
  50266. }
  50267. const lineHeight = fontSize * LINE_FACTOR;
  50268. const vPadding = (lineHeight - fontSize) / 2;
  50269. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  50270. let firstIndex = 0;
  50271. if (valueIndices.length > 0) {
  50272. const minIndex = Math.min(...valueIndices);
  50273. const maxIndex = Math.max(...valueIndices);
  50274. firstIndex = Math.max(0, maxIndex - numberOfVisibleLines + 1);
  50275. if (firstIndex > minIndex) {
  50276. firstIndex = minIndex;
  50277. }
  50278. }
  50279. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  50280. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  50281. if (valueIndices.length) {
  50282. buf.push("0.600006 0.756866 0.854904 rg");
  50283. for (const index of valueIndices) {
  50284. if (firstIndex <= index && index < end) {
  50285. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  50286. }
  50287. }
  50288. }
  50289. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  50290. const prevInfo = {
  50291. shift: 0
  50292. };
  50293. for (let i = firstIndex; i < end; i++) {
  50294. const {
  50295. displayValue
  50296. } = this.data.options[i];
  50297. const vpadding = i === firstIndex ? vPadding : 0;
  50298. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, prevInfo, defaultHPadding, -lineHeight + vpadding));
  50299. }
  50300. buf.push("ET Q EMC");
  50301. return buf.join("\n");
  50302. }
  50303. }
  50304. class SignatureWidgetAnnotation extends WidgetAnnotation {
  50305. constructor(params) {
  50306. super(params);
  50307. this.data.fieldValue = null;
  50308. this.data.hasOwnCanvas = this.data.noRotate;
  50309. this.data.noHTML = !this.data.hasOwnCanvas;
  50310. }
  50311. getFieldObject() {
  50312. return {
  50313. id: this.data.id,
  50314. value: null,
  50315. page: this.data.pageIndex,
  50316. type: "signature"
  50317. };
  50318. }
  50319. }
  50320. class TextAnnotation extends MarkupAnnotation {
  50321. constructor(params) {
  50322. const DEFAULT_ICON_SIZE = 22;
  50323. super(params);
  50324. this.data.noRotate = true;
  50325. this.data.hasOwnCanvas = this.data.noRotate;
  50326. this.data.noHTML = false;
  50327. const {
  50328. dict
  50329. } = params;
  50330. this.data.annotationType = AnnotationType.TEXT;
  50331. if (this.data.hasAppearance) {
  50332. this.data.name = "NoIcon";
  50333. } else {
  50334. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  50335. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  50336. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  50337. }
  50338. if (dict.has("State")) {
  50339. this.data.state = dict.get("State") || null;
  50340. this.data.stateModel = dict.get("StateModel") || null;
  50341. } else {
  50342. this.data.state = null;
  50343. this.data.stateModel = null;
  50344. }
  50345. }
  50346. }
  50347. class LinkAnnotation extends Annotation {
  50348. constructor(params) {
  50349. super(params);
  50350. const {
  50351. dict,
  50352. annotationGlobals
  50353. } = params;
  50354. this.data.annotationType = AnnotationType.LINK;
  50355. this.data.noHTML = false;
  50356. const quadPoints = getQuadPoints(dict, this.rectangle);
  50357. if (quadPoints) {
  50358. this.data.quadPoints = quadPoints;
  50359. }
  50360. this.data.borderColor ||= this.data.color;
  50361. Catalog.parseDestDictionary({
  50362. destDict: dict,
  50363. resultObj: this.data,
  50364. docBaseUrl: annotationGlobals.baseUrl,
  50365. docAttachments: annotationGlobals.attachments
  50366. });
  50367. }
  50368. }
  50369. class PopupAnnotation extends Annotation {
  50370. constructor(params) {
  50371. super(params);
  50372. const {
  50373. dict
  50374. } = params;
  50375. this.data.annotationType = AnnotationType.POPUP;
  50376. this.data.noHTML = false;
  50377. if (this.data.rect[0] === this.data.rect[2] || this.data.rect[1] === this.data.rect[3]) {
  50378. this.data.rect = null;
  50379. }
  50380. let parentItem = dict.get("Parent");
  50381. if (!parentItem) {
  50382. warn("Popup annotation has a missing or invalid parent annotation.");
  50383. return;
  50384. }
  50385. this.data.parentRect = lookupNormalRect(parentItem.getArray("Rect"), null);
  50386. const rt = parentItem.get("RT");
  50387. if (isName(rt, AnnotationReplyType.GROUP)) {
  50388. parentItem = parentItem.get("IRT");
  50389. }
  50390. if (!parentItem.has("M")) {
  50391. this.data.modificationDate = null;
  50392. } else {
  50393. this.setModificationDate(parentItem.get("M"));
  50394. this.data.modificationDate = this.modificationDate;
  50395. }
  50396. if (!parentItem.has("C")) {
  50397. this.data.color = null;
  50398. } else {
  50399. this.setColor(parentItem.getArray("C"));
  50400. this.data.color = this.color;
  50401. }
  50402. if (!this.viewable) {
  50403. const parentFlags = parentItem.get("F");
  50404. if (this._isViewable(parentFlags)) {
  50405. this.setFlags(parentFlags);
  50406. }
  50407. }
  50408. this.setTitle(parentItem.get("T"));
  50409. this.data.titleObj = this._title;
  50410. this.setContents(parentItem.get("Contents"));
  50411. this.data.contentsObj = this._contents;
  50412. if (parentItem.has("RC")) {
  50413. this.data.richText = XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  50414. }
  50415. this.data.open = !!dict.get("Open");
  50416. }
  50417. }
  50418. class FreeTextAnnotation extends MarkupAnnotation {
  50419. constructor(params) {
  50420. super(params);
  50421. this.data.hasOwnCanvas = this.data.noRotate;
  50422. this.data.isEditable = !this.data.noHTML;
  50423. this.data.noHTML = false;
  50424. const {
  50425. evaluatorOptions,
  50426. xref
  50427. } = params;
  50428. this.data.annotationType = AnnotationType.FREETEXT;
  50429. this.setDefaultAppearance(params);
  50430. this._hasAppearance = !!this.appearance;
  50431. if (this._hasAppearance) {
  50432. const {
  50433. fontColor,
  50434. fontSize
  50435. } = parseAppearanceStream(this.appearance, evaluatorOptions, xref);
  50436. this.data.defaultAppearanceData.fontColor = fontColor;
  50437. this.data.defaultAppearanceData.fontSize = fontSize || 10;
  50438. } else {
  50439. this.data.defaultAppearanceData.fontSize ||= 10;
  50440. const {
  50441. fontColor,
  50442. fontSize
  50443. } = this.data.defaultAppearanceData;
  50444. if (this._contents.str) {
  50445. this.data.textContent = this._contents.str.split(/\r\n?|\n/).map(line => line.trimEnd());
  50446. const {
  50447. coords,
  50448. bbox,
  50449. matrix
  50450. } = FakeUnicodeFont.getFirstPositionInfo(this.rectangle, this.rotation, fontSize);
  50451. this.data.textPosition = this._transformPoint(coords, bbox, matrix);
  50452. }
  50453. if (this._isOffscreenCanvasSupported) {
  50454. const strokeAlpha = params.dict.get("CA");
  50455. const fakeUnicodeFont = new FakeUnicodeFont(xref, "sans-serif");
  50456. this.appearance = fakeUnicodeFont.createAppearance(this._contents.str, this.rectangle, this.rotation, fontSize, fontColor, strokeAlpha);
  50457. this._streams.push(this.appearance);
  50458. } else {
  50459. warn("FreeTextAnnotation: OffscreenCanvas is not supported, annotation may not render correctly.");
  50460. }
  50461. }
  50462. }
  50463. get hasTextContent() {
  50464. return this._hasAppearance;
  50465. }
  50466. static createNewDict(annotation, xref, {
  50467. apRef,
  50468. ap
  50469. }) {
  50470. const {
  50471. color,
  50472. fontSize,
  50473. oldAnnotation,
  50474. rect,
  50475. rotation,
  50476. user,
  50477. value
  50478. } = annotation;
  50479. const freetext = oldAnnotation || new Dict(xref);
  50480. freetext.set("Type", Name.get("Annot"));
  50481. freetext.set("Subtype", Name.get("FreeText"));
  50482. if (oldAnnotation) {
  50483. freetext.set("M", `D:${getModificationDate()}`);
  50484. freetext.delete("RC");
  50485. } else {
  50486. freetext.set("CreationDate", `D:${getModificationDate()}`);
  50487. }
  50488. freetext.set("Rect", rect);
  50489. const da = `/Helv ${fontSize} Tf ${getPdfColor(color, true)}`;
  50490. freetext.set("DA", da);
  50491. freetext.set("Contents", stringToAsciiOrUTF16BE(value));
  50492. freetext.set("F", 4);
  50493. freetext.set("Border", [0, 0, 0]);
  50494. freetext.set("Rotate", rotation);
  50495. if (user) {
  50496. freetext.set("T", stringToAsciiOrUTF16BE(user));
  50497. }
  50498. if (apRef || ap) {
  50499. const n = new Dict(xref);
  50500. freetext.set("AP", n);
  50501. if (apRef) {
  50502. n.set("N", apRef);
  50503. } else {
  50504. n.set("N", ap);
  50505. }
  50506. }
  50507. return freetext;
  50508. }
  50509. static async createNewAppearanceStream(annotation, xref, params) {
  50510. const {
  50511. baseFontRef,
  50512. evaluator,
  50513. task
  50514. } = params;
  50515. const {
  50516. color,
  50517. fontSize,
  50518. rect,
  50519. rotation,
  50520. value
  50521. } = annotation;
  50522. const resources = new Dict(xref);
  50523. const font = new Dict(xref);
  50524. if (baseFontRef) {
  50525. font.set("Helv", baseFontRef);
  50526. } else {
  50527. const baseFont = new Dict(xref);
  50528. baseFont.set("BaseFont", Name.get("Helvetica"));
  50529. baseFont.set("Type", Name.get("Font"));
  50530. baseFont.set("Subtype", Name.get("Type1"));
  50531. baseFont.set("Encoding", Name.get("WinAnsiEncoding"));
  50532. font.set("Helv", baseFont);
  50533. }
  50534. resources.set("Font", font);
  50535. const helv = await WidgetAnnotation._getFontData(evaluator, task, {
  50536. fontName: "Helv",
  50537. fontSize
  50538. }, resources);
  50539. const [x1, y1, x2, y2] = rect;
  50540. let w = x2 - x1;
  50541. let h = y2 - y1;
  50542. if (rotation % 180 !== 0) {
  50543. [w, h] = [h, w];
  50544. }
  50545. const lines = value.split("\n");
  50546. const scale = fontSize / 1000;
  50547. let totalWidth = -Infinity;
  50548. const encodedLines = [];
  50549. for (let line of lines) {
  50550. const encoded = helv.encodeString(line);
  50551. if (encoded.length > 1) {
  50552. return null;
  50553. }
  50554. line = encoded.join("");
  50555. encodedLines.push(line);
  50556. let lineWidth = 0;
  50557. const glyphs = helv.charsToGlyphs(line);
  50558. for (const glyph of glyphs) {
  50559. lineWidth += glyph.width * scale;
  50560. }
  50561. totalWidth = Math.max(totalWidth, lineWidth);
  50562. }
  50563. let hscale = 1;
  50564. if (totalWidth > w) {
  50565. hscale = w / totalWidth;
  50566. }
  50567. let vscale = 1;
  50568. const lineHeight = LINE_FACTOR * fontSize;
  50569. const lineAscent = (LINE_FACTOR - LINE_DESCENT_FACTOR) * fontSize;
  50570. const totalHeight = lineHeight * lines.length;
  50571. if (totalHeight > h) {
  50572. vscale = h / totalHeight;
  50573. }
  50574. const fscale = Math.min(hscale, vscale);
  50575. const newFontSize = fontSize * fscale;
  50576. let firstPoint, clipBox, matrix;
  50577. switch (rotation) {
  50578. case 0:
  50579. matrix = [1, 0, 0, 1];
  50580. clipBox = [rect[0], rect[1], w, h];
  50581. firstPoint = [rect[0], rect[3] - lineAscent];
  50582. break;
  50583. case 90:
  50584. matrix = [0, 1, -1, 0];
  50585. clipBox = [rect[1], -rect[2], w, h];
  50586. firstPoint = [rect[1], -rect[0] - lineAscent];
  50587. break;
  50588. case 180:
  50589. matrix = [-1, 0, 0, -1];
  50590. clipBox = [-rect[2], -rect[3], w, h];
  50591. firstPoint = [-rect[2], -rect[1] - lineAscent];
  50592. break;
  50593. case 270:
  50594. matrix = [0, -1, 1, 0];
  50595. clipBox = [-rect[3], rect[0], w, h];
  50596. firstPoint = [-rect[3], rect[2] - lineAscent];
  50597. break;
  50598. }
  50599. const buffer = ["q", `${matrix.join(" ")} 0 0 cm`, `${clipBox.join(" ")} re W n`, `BT`, `${getPdfColor(color, true)}`, `0 Tc /Helv ${numberToString(newFontSize)} Tf`];
  50600. buffer.push(`${firstPoint.join(" ")} Td (${escapeString(encodedLines[0])}) Tj`);
  50601. const vShift = numberToString(lineHeight);
  50602. for (let i = 1, ii = encodedLines.length; i < ii; i++) {
  50603. const line = encodedLines[i];
  50604. buffer.push(`0 -${vShift} Td (${escapeString(line)}) Tj`);
  50605. }
  50606. buffer.push("ET", "Q");
  50607. const appearance = buffer.join("\n");
  50608. const appearanceStreamDict = new Dict(xref);
  50609. appearanceStreamDict.set("FormType", 1);
  50610. appearanceStreamDict.set("Subtype", Name.get("Form"));
  50611. appearanceStreamDict.set("Type", Name.get("XObject"));
  50612. appearanceStreamDict.set("BBox", rect);
  50613. appearanceStreamDict.set("Resources", resources);
  50614. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, -rect[0], -rect[1]]);
  50615. const ap = new StringStream(appearance);
  50616. ap.dict = appearanceStreamDict;
  50617. return ap;
  50618. }
  50619. }
  50620. class LineAnnotation extends MarkupAnnotation {
  50621. constructor(params) {
  50622. super(params);
  50623. const {
  50624. dict,
  50625. xref
  50626. } = params;
  50627. this.data.annotationType = AnnotationType.LINE;
  50628. this.data.hasOwnCanvas = this.data.noRotate;
  50629. this.data.noHTML = false;
  50630. const lineCoordinates = lookupRect(dict.getArray("L"), [0, 0, 0, 0]);
  50631. this.data.lineCoordinates = Util.normalizeRect(lineCoordinates);
  50632. this.setLineEndings(dict.getArray("LE"));
  50633. this.data.lineEndings = this.lineEndings;
  50634. if (!this.appearance) {
  50635. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  50636. const strokeAlpha = dict.get("CA");
  50637. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  50638. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  50639. const fillAlpha = fillColor ? strokeAlpha : null;
  50640. const borderWidth = this.borderStyle.width || 1,
  50641. borderAdjust = 2 * borderWidth;
  50642. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  50643. if (!Util.intersect(this.rectangle, bbox)) {
  50644. this.rectangle = bbox;
  50645. }
  50646. this._setDefaultAppearance({
  50647. xref,
  50648. extra: `${borderWidth} w`,
  50649. strokeColor,
  50650. fillColor,
  50651. strokeAlpha,
  50652. fillAlpha,
  50653. pointsCallback: (buffer, points) => {
  50654. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  50655. return [points[0] - borderWidth, points[2] + borderWidth, points[7] - borderWidth, points[3] + borderWidth];
  50656. }
  50657. });
  50658. }
  50659. }
  50660. }
  50661. class SquareAnnotation extends MarkupAnnotation {
  50662. constructor(params) {
  50663. super(params);
  50664. const {
  50665. dict,
  50666. xref
  50667. } = params;
  50668. this.data.annotationType = AnnotationType.SQUARE;
  50669. this.data.hasOwnCanvas = this.data.noRotate;
  50670. this.data.noHTML = false;
  50671. if (!this.appearance) {
  50672. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  50673. const strokeAlpha = dict.get("CA");
  50674. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  50675. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  50676. const fillAlpha = fillColor ? strokeAlpha : null;
  50677. if (this.borderStyle.width === 0 && !fillColor) {
  50678. return;
  50679. }
  50680. this._setDefaultAppearance({
  50681. xref,
  50682. extra: `${this.borderStyle.width} w`,
  50683. strokeColor,
  50684. fillColor,
  50685. strokeAlpha,
  50686. fillAlpha,
  50687. pointsCallback: (buffer, points) => {
  50688. const x = points[4] + this.borderStyle.width / 2;
  50689. const y = points[5] + this.borderStyle.width / 2;
  50690. const width = points[6] - points[4] - this.borderStyle.width;
  50691. const height = points[3] - points[7] - this.borderStyle.width;
  50692. buffer.push(`${x} ${y} ${width} ${height} re`);
  50693. if (fillColor) {
  50694. buffer.push("B");
  50695. } else {
  50696. buffer.push("S");
  50697. }
  50698. return [points[0], points[2], points[7], points[3]];
  50699. }
  50700. });
  50701. }
  50702. }
  50703. }
  50704. class CircleAnnotation extends MarkupAnnotation {
  50705. constructor(params) {
  50706. super(params);
  50707. const {
  50708. dict,
  50709. xref
  50710. } = params;
  50711. this.data.annotationType = AnnotationType.CIRCLE;
  50712. if (!this.appearance) {
  50713. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  50714. const strokeAlpha = dict.get("CA");
  50715. const interiorColor = getRgbColor(dict.getArray("IC"), null);
  50716. const fillColor = interiorColor ? getPdfColorArray(interiorColor) : null;
  50717. const fillAlpha = fillColor ? strokeAlpha : null;
  50718. if (this.borderStyle.width === 0 && !fillColor) {
  50719. return;
  50720. }
  50721. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  50722. this._setDefaultAppearance({
  50723. xref,
  50724. extra: `${this.borderStyle.width} w`,
  50725. strokeColor,
  50726. fillColor,
  50727. strokeAlpha,
  50728. fillAlpha,
  50729. pointsCallback: (buffer, points) => {
  50730. const x0 = points[0] + this.borderStyle.width / 2;
  50731. const y0 = points[1] - this.borderStyle.width / 2;
  50732. const x1 = points[6] - this.borderStyle.width / 2;
  50733. const y1 = points[7] + this.borderStyle.width / 2;
  50734. const xMid = x0 + (x1 - x0) / 2;
  50735. const yMid = y0 + (y1 - y0) / 2;
  50736. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  50737. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  50738. buffer.push(`${xMid} ${y1} m`, `${xMid + xOffset} ${y1} ${x1} ${yMid + yOffset} ${x1} ${yMid} c`, `${x1} ${yMid - yOffset} ${xMid + xOffset} ${y0} ${xMid} ${y0} c`, `${xMid - xOffset} ${y0} ${x0} ${yMid - yOffset} ${x0} ${yMid} c`, `${x0} ${yMid + yOffset} ${xMid - xOffset} ${y1} ${xMid} ${y1} c`, "h");
  50739. if (fillColor) {
  50740. buffer.push("B");
  50741. } else {
  50742. buffer.push("S");
  50743. }
  50744. return [points[0], points[2], points[7], points[3]];
  50745. }
  50746. });
  50747. }
  50748. }
  50749. }
  50750. class PolylineAnnotation extends MarkupAnnotation {
  50751. constructor(params) {
  50752. super(params);
  50753. const {
  50754. dict,
  50755. xref
  50756. } = params;
  50757. this.data.annotationType = AnnotationType.POLYLINE;
  50758. this.data.hasOwnCanvas = this.data.noRotate;
  50759. this.data.noHTML = false;
  50760. this.data.vertices = null;
  50761. if (!(this instanceof PolygonAnnotation)) {
  50762. this.setLineEndings(dict.getArray("LE"));
  50763. this.data.lineEndings = this.lineEndings;
  50764. }
  50765. const rawVertices = dict.getArray("Vertices");
  50766. if (!isNumberArray(rawVertices, null)) {
  50767. return;
  50768. }
  50769. const vertices = this.data.vertices = Float32Array.from(rawVertices);
  50770. if (!this.appearance) {
  50771. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  50772. const strokeAlpha = dict.get("CA");
  50773. const borderWidth = this.borderStyle.width || 1,
  50774. borderAdjust = 2 * borderWidth;
  50775. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  50776. for (let i = 0, ii = vertices.length; i < ii; i += 2) {
  50777. bbox[0] = Math.min(bbox[0], vertices[i] - borderAdjust);
  50778. bbox[1] = Math.min(bbox[1], vertices[i + 1] - borderAdjust);
  50779. bbox[2] = Math.max(bbox[2], vertices[i] + borderAdjust);
  50780. bbox[3] = Math.max(bbox[3], vertices[i + 1] + borderAdjust);
  50781. }
  50782. if (!Util.intersect(this.rectangle, bbox)) {
  50783. this.rectangle = bbox;
  50784. }
  50785. this._setDefaultAppearance({
  50786. xref,
  50787. extra: `${borderWidth} w`,
  50788. strokeColor,
  50789. strokeAlpha,
  50790. pointsCallback: (buffer, points) => {
  50791. for (let i = 0, ii = vertices.length; i < ii; i += 2) {
  50792. buffer.push(`${vertices[i]} ${vertices[i + 1]} ${i === 0 ? "m" : "l"}`);
  50793. }
  50794. buffer.push("S");
  50795. return [points[0], points[2], points[7], points[3]];
  50796. }
  50797. });
  50798. }
  50799. }
  50800. }
  50801. class PolygonAnnotation extends PolylineAnnotation {
  50802. constructor(params) {
  50803. super(params);
  50804. this.data.annotationType = AnnotationType.POLYGON;
  50805. }
  50806. }
  50807. class CaretAnnotation extends MarkupAnnotation {
  50808. constructor(params) {
  50809. super(params);
  50810. this.data.annotationType = AnnotationType.CARET;
  50811. }
  50812. }
  50813. class InkAnnotation extends MarkupAnnotation {
  50814. constructor(params) {
  50815. super(params);
  50816. this.data.hasOwnCanvas = this.data.noRotate;
  50817. this.data.noHTML = false;
  50818. const {
  50819. dict,
  50820. xref
  50821. } = params;
  50822. this.data.annotationType = AnnotationType.INK;
  50823. this.data.inkLists = [];
  50824. this.data.isEditable = !this.data.noHTML;
  50825. this.data.noHTML = false;
  50826. this.data.opacity = dict.get("CA") || 1;
  50827. const rawInkLists = dict.getArray("InkList");
  50828. if (!Array.isArray(rawInkLists)) {
  50829. return;
  50830. }
  50831. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  50832. if (!Array.isArray(rawInkLists[i])) {
  50833. continue;
  50834. }
  50835. const inkList = new Float32Array(rawInkLists[i].length);
  50836. this.data.inkLists.push(inkList);
  50837. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  50838. const x = xref.fetchIfRef(rawInkLists[i][j]),
  50839. y = xref.fetchIfRef(rawInkLists[i][j + 1]);
  50840. if (typeof x === "number" && typeof y === "number") {
  50841. inkList[j] = x;
  50842. inkList[j + 1] = y;
  50843. }
  50844. }
  50845. }
  50846. if (!this.appearance) {
  50847. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  50848. const strokeAlpha = dict.get("CA");
  50849. const borderWidth = this.borderStyle.width || 1,
  50850. borderAdjust = 2 * borderWidth;
  50851. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  50852. for (const inkList of this.data.inkLists) {
  50853. for (let i = 0, ii = inkList.length; i < ii; i += 2) {
  50854. bbox[0] = Math.min(bbox[0], inkList[i] - borderAdjust);
  50855. bbox[1] = Math.min(bbox[1], inkList[i + 1] - borderAdjust);
  50856. bbox[2] = Math.max(bbox[2], inkList[i] + borderAdjust);
  50857. bbox[3] = Math.max(bbox[3], inkList[i + 1] + borderAdjust);
  50858. }
  50859. }
  50860. if (!Util.intersect(this.rectangle, bbox)) {
  50861. this.rectangle = bbox;
  50862. }
  50863. this._setDefaultAppearance({
  50864. xref,
  50865. extra: `${borderWidth} w`,
  50866. strokeColor,
  50867. strokeAlpha,
  50868. pointsCallback: (buffer, points) => {
  50869. for (const inkList of this.data.inkLists) {
  50870. for (let i = 0, ii = inkList.length; i < ii; i += 2) {
  50871. buffer.push(`${inkList[i]} ${inkList[i + 1]} ${i === 0 ? "m" : "l"}`);
  50872. }
  50873. buffer.push("S");
  50874. }
  50875. return [points[0], points[2], points[7], points[3]];
  50876. }
  50877. });
  50878. }
  50879. }
  50880. static createNewDict(annotation, xref, {
  50881. apRef,
  50882. ap
  50883. }) {
  50884. const {
  50885. oldAnnotation,
  50886. color,
  50887. opacity,
  50888. paths,
  50889. outlines,
  50890. rect,
  50891. rotation,
  50892. thickness,
  50893. user
  50894. } = annotation;
  50895. const ink = oldAnnotation || new Dict(xref);
  50896. ink.set("Type", Name.get("Annot"));
  50897. ink.set("Subtype", Name.get("Ink"));
  50898. ink.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate()}`);
  50899. ink.set("Rect", rect);
  50900. ink.set("InkList", outlines?.points || paths.points);
  50901. ink.set("F", 4);
  50902. ink.set("Rotate", rotation);
  50903. if (user) {
  50904. ink.set("T", stringToAsciiOrUTF16BE(user));
  50905. }
  50906. if (outlines) {
  50907. ink.set("IT", Name.get("InkHighlight"));
  50908. }
  50909. const bs = new Dict(xref);
  50910. ink.set("BS", bs);
  50911. bs.set("W", thickness);
  50912. ink.set("C", Array.from(color, c => c / 255));
  50913. ink.set("CA", opacity);
  50914. const n = new Dict(xref);
  50915. ink.set("AP", n);
  50916. if (apRef) {
  50917. n.set("N", apRef);
  50918. } else {
  50919. n.set("N", ap);
  50920. }
  50921. return ink;
  50922. }
  50923. static async createNewAppearanceStream(annotation, xref, params) {
  50924. if (annotation.outlines) {
  50925. return this.createNewAppearanceStreamForHighlight(annotation, xref, params);
  50926. }
  50927. const {
  50928. color,
  50929. rect,
  50930. paths,
  50931. thickness,
  50932. opacity
  50933. } = annotation;
  50934. const appearanceBuffer = [`${thickness} w 1 J 1 j`, `${getPdfColor(color, false)}`];
  50935. if (opacity !== 1) {
  50936. appearanceBuffer.push("/R0 gs");
  50937. }
  50938. for (const outline of paths.lines) {
  50939. appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`);
  50940. for (let i = 6, ii = outline.length; i < ii; i += 6) {
  50941. if (isNaN(outline[i])) {
  50942. appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`);
  50943. } else {
  50944. const [c1x, c1y, c2x, c2y, x, y] = outline.slice(i, i + 6);
  50945. appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c");
  50946. }
  50947. }
  50948. if (outline.length === 6) {
  50949. appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} l`);
  50950. }
  50951. }
  50952. appearanceBuffer.push("S");
  50953. const appearance = appearanceBuffer.join("\n");
  50954. const appearanceStreamDict = new Dict(xref);
  50955. appearanceStreamDict.set("FormType", 1);
  50956. appearanceStreamDict.set("Subtype", Name.get("Form"));
  50957. appearanceStreamDict.set("Type", Name.get("XObject"));
  50958. appearanceStreamDict.set("BBox", rect);
  50959. appearanceStreamDict.set("Length", appearance.length);
  50960. if (opacity !== 1) {
  50961. const resources = new Dict(xref);
  50962. const extGState = new Dict(xref);
  50963. const r0 = new Dict(xref);
  50964. r0.set("CA", opacity);
  50965. r0.set("Type", Name.get("ExtGState"));
  50966. extGState.set("R0", r0);
  50967. resources.set("ExtGState", extGState);
  50968. appearanceStreamDict.set("Resources", resources);
  50969. }
  50970. const ap = new StringStream(appearance);
  50971. ap.dict = appearanceStreamDict;
  50972. return ap;
  50973. }
  50974. static async createNewAppearanceStreamForHighlight(annotation, xref, params) {
  50975. const {
  50976. color,
  50977. rect,
  50978. outlines: {
  50979. outline
  50980. },
  50981. opacity
  50982. } = annotation;
  50983. const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"];
  50984. appearanceBuffer.push(`${numberToString(outline[4])} ${numberToString(outline[5])} m`);
  50985. for (let i = 6, ii = outline.length; i < ii; i += 6) {
  50986. if (isNaN(outline[i])) {
  50987. appearanceBuffer.push(`${numberToString(outline[i + 4])} ${numberToString(outline[i + 5])} l`);
  50988. } else {
  50989. const [c1x, c1y, c2x, c2y, x, y] = outline.slice(i, i + 6);
  50990. appearanceBuffer.push([c1x, c1y, c2x, c2y, x, y].map(numberToString).join(" ") + " c");
  50991. }
  50992. }
  50993. appearanceBuffer.push("h f");
  50994. const appearance = appearanceBuffer.join("\n");
  50995. const appearanceStreamDict = new Dict(xref);
  50996. appearanceStreamDict.set("FormType", 1);
  50997. appearanceStreamDict.set("Subtype", Name.get("Form"));
  50998. appearanceStreamDict.set("Type", Name.get("XObject"));
  50999. appearanceStreamDict.set("BBox", rect);
  51000. appearanceStreamDict.set("Length", appearance.length);
  51001. const resources = new Dict(xref);
  51002. const extGState = new Dict(xref);
  51003. resources.set("ExtGState", extGState);
  51004. appearanceStreamDict.set("Resources", resources);
  51005. const r0 = new Dict(xref);
  51006. extGState.set("R0", r0);
  51007. r0.set("BM", Name.get("Multiply"));
  51008. if (opacity !== 1) {
  51009. r0.set("ca", opacity);
  51010. r0.set("Type", Name.get("ExtGState"));
  51011. }
  51012. const ap = new StringStream(appearance);
  51013. ap.dict = appearanceStreamDict;
  51014. return ap;
  51015. }
  51016. }
  51017. class HighlightAnnotation extends MarkupAnnotation {
  51018. constructor(params) {
  51019. super(params);
  51020. const {
  51021. dict,
  51022. xref
  51023. } = params;
  51024. this.data.annotationType = AnnotationType.HIGHLIGHT;
  51025. this.data.isEditable = !this.data.noHTML;
  51026. this.data.noHTML = false;
  51027. this.data.opacity = dict.get("CA") || 1;
  51028. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  51029. if (quadPoints) {
  51030. const resources = this.appearance?.dict.get("Resources");
  51031. if (!this.appearance || !resources?.has("ExtGState")) {
  51032. if (this.appearance) {
  51033. warn("HighlightAnnotation - ignoring built-in appearance stream.");
  51034. }
  51035. const fillColor = this.color ? getPdfColorArray(this.color) : [1, 1, 0];
  51036. const fillAlpha = dict.get("CA");
  51037. this._setDefaultAppearance({
  51038. xref,
  51039. fillColor,
  51040. blendMode: "Multiply",
  51041. fillAlpha,
  51042. pointsCallback: (buffer, points) => {
  51043. buffer.push(`${points[0]} ${points[1]} m`, `${points[2]} ${points[3]} l`, `${points[6]} ${points[7]} l`, `${points[4]} ${points[5]} l`, "f");
  51044. return [points[0], points[2], points[7], points[3]];
  51045. }
  51046. });
  51047. }
  51048. } else {
  51049. this.data.popupRef = null;
  51050. }
  51051. }
  51052. static createNewDict(annotation, xref, {
  51053. apRef,
  51054. ap
  51055. }) {
  51056. const {
  51057. color,
  51058. oldAnnotation,
  51059. opacity,
  51060. rect,
  51061. rotation,
  51062. user,
  51063. quadPoints
  51064. } = annotation;
  51065. const highlight = oldAnnotation || new Dict(xref);
  51066. highlight.set("Type", Name.get("Annot"));
  51067. highlight.set("Subtype", Name.get("Highlight"));
  51068. highlight.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate()}`);
  51069. highlight.set("CreationDate", `D:${getModificationDate()}`);
  51070. highlight.set("Rect", rect);
  51071. highlight.set("F", 4);
  51072. highlight.set("Border", [0, 0, 0]);
  51073. highlight.set("Rotate", rotation);
  51074. highlight.set("QuadPoints", quadPoints);
  51075. highlight.set("C", Array.from(color, c => c / 255));
  51076. highlight.set("CA", opacity);
  51077. if (user) {
  51078. highlight.set("T", stringToAsciiOrUTF16BE(user));
  51079. }
  51080. if (apRef || ap) {
  51081. const n = new Dict(xref);
  51082. highlight.set("AP", n);
  51083. n.set("N", apRef || ap);
  51084. }
  51085. return highlight;
  51086. }
  51087. static async createNewAppearanceStream(annotation, xref, params) {
  51088. const {
  51089. color,
  51090. rect,
  51091. outlines,
  51092. opacity
  51093. } = annotation;
  51094. const appearanceBuffer = [`${getPdfColor(color, true)}`, "/R0 gs"];
  51095. const buffer = [];
  51096. for (const outline of outlines) {
  51097. buffer.length = 0;
  51098. buffer.push(`${numberToString(outline[0])} ${numberToString(outline[1])} m`);
  51099. for (let i = 2, ii = outline.length; i < ii; i += 2) {
  51100. buffer.push(`${numberToString(outline[i])} ${numberToString(outline[i + 1])} l`);
  51101. }
  51102. buffer.push("h");
  51103. appearanceBuffer.push(buffer.join("\n"));
  51104. }
  51105. appearanceBuffer.push("f*");
  51106. const appearance = appearanceBuffer.join("\n");
  51107. const appearanceStreamDict = new Dict(xref);
  51108. appearanceStreamDict.set("FormType", 1);
  51109. appearanceStreamDict.set("Subtype", Name.get("Form"));
  51110. appearanceStreamDict.set("Type", Name.get("XObject"));
  51111. appearanceStreamDict.set("BBox", rect);
  51112. appearanceStreamDict.set("Length", appearance.length);
  51113. const resources = new Dict(xref);
  51114. const extGState = new Dict(xref);
  51115. resources.set("ExtGState", extGState);
  51116. appearanceStreamDict.set("Resources", resources);
  51117. const r0 = new Dict(xref);
  51118. extGState.set("R0", r0);
  51119. r0.set("BM", Name.get("Multiply"));
  51120. if (opacity !== 1) {
  51121. r0.set("ca", opacity);
  51122. r0.set("Type", Name.get("ExtGState"));
  51123. }
  51124. const ap = new StringStream(appearance);
  51125. ap.dict = appearanceStreamDict;
  51126. return ap;
  51127. }
  51128. }
  51129. class UnderlineAnnotation extends MarkupAnnotation {
  51130. constructor(params) {
  51131. super(params);
  51132. const {
  51133. dict,
  51134. xref
  51135. } = params;
  51136. this.data.annotationType = AnnotationType.UNDERLINE;
  51137. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  51138. if (quadPoints) {
  51139. if (!this.appearance) {
  51140. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  51141. const strokeAlpha = dict.get("CA");
  51142. this._setDefaultAppearance({
  51143. xref,
  51144. extra: "[] 0 d 0.571 w",
  51145. strokeColor,
  51146. strokeAlpha,
  51147. pointsCallback: (buffer, points) => {
  51148. buffer.push(`${points[4]} ${points[5] + 1.3} m`, `${points[6]} ${points[7] + 1.3} l`, "S");
  51149. return [points[0], points[2], points[7], points[3]];
  51150. }
  51151. });
  51152. }
  51153. } else {
  51154. this.data.popupRef = null;
  51155. }
  51156. }
  51157. }
  51158. class SquigglyAnnotation extends MarkupAnnotation {
  51159. constructor(params) {
  51160. super(params);
  51161. const {
  51162. dict,
  51163. xref
  51164. } = params;
  51165. this.data.annotationType = AnnotationType.SQUIGGLY;
  51166. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  51167. if (quadPoints) {
  51168. if (!this.appearance) {
  51169. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  51170. const strokeAlpha = dict.get("CA");
  51171. this._setDefaultAppearance({
  51172. xref,
  51173. extra: "[] 0 d 1 w",
  51174. strokeColor,
  51175. strokeAlpha,
  51176. pointsCallback: (buffer, points) => {
  51177. const dy = (points[1] - points[5]) / 6;
  51178. let shift = dy;
  51179. let x = points[4];
  51180. const y = points[5];
  51181. const xEnd = points[6];
  51182. buffer.push(`${x} ${y + shift} m`);
  51183. do {
  51184. x += 2;
  51185. shift = shift === 0 ? dy : 0;
  51186. buffer.push(`${x} ${y + shift} l`);
  51187. } while (x < xEnd);
  51188. buffer.push("S");
  51189. return [points[4], xEnd, y - 2 * dy, y + 2 * dy];
  51190. }
  51191. });
  51192. }
  51193. } else {
  51194. this.data.popupRef = null;
  51195. }
  51196. }
  51197. }
  51198. class StrikeOutAnnotation extends MarkupAnnotation {
  51199. constructor(params) {
  51200. super(params);
  51201. const {
  51202. dict,
  51203. xref
  51204. } = params;
  51205. this.data.annotationType = AnnotationType.STRIKEOUT;
  51206. const quadPoints = this.data.quadPoints = getQuadPoints(dict, null);
  51207. if (quadPoints) {
  51208. if (!this.appearance) {
  51209. const strokeColor = this.color ? getPdfColorArray(this.color) : [0, 0, 0];
  51210. const strokeAlpha = dict.get("CA");
  51211. this._setDefaultAppearance({
  51212. xref,
  51213. extra: "[] 0 d 1 w",
  51214. strokeColor,
  51215. strokeAlpha,
  51216. pointsCallback: (buffer, points) => {
  51217. buffer.push(`${(points[0] + points[4]) / 2} ` + `${(points[1] + points[5]) / 2} m`, `${(points[2] + points[6]) / 2} ` + `${(points[3] + points[7]) / 2} l`, "S");
  51218. return [points[0], points[2], points[7], points[3]];
  51219. }
  51220. });
  51221. }
  51222. } else {
  51223. this.data.popupRef = null;
  51224. }
  51225. }
  51226. }
  51227. class StampAnnotation extends MarkupAnnotation {
  51228. #savedHasOwnCanvas;
  51229. constructor(params) {
  51230. super(params);
  51231. this.data.annotationType = AnnotationType.STAMP;
  51232. this.#savedHasOwnCanvas = this.data.hasOwnCanvas = this.data.noRotate;
  51233. this.data.isEditable = !this.data.noHTML;
  51234. this.data.noHTML = false;
  51235. }
  51236. mustBeViewedWhenEditing(isEditing, modifiedIds = null) {
  51237. if (isEditing) {
  51238. if (!this.data.isEditable) {
  51239. return false;
  51240. }
  51241. this.#savedHasOwnCanvas = this.data.hasOwnCanvas;
  51242. this.data.hasOwnCanvas = true;
  51243. return true;
  51244. }
  51245. this.data.hasOwnCanvas = this.#savedHasOwnCanvas;
  51246. return !modifiedIds?.has(this.data.id);
  51247. }
  51248. static async createImage(bitmap, xref) {
  51249. const {
  51250. width,
  51251. height
  51252. } = bitmap;
  51253. const canvas = new OffscreenCanvas(width, height);
  51254. const ctx = canvas.getContext("2d", {
  51255. alpha: true
  51256. });
  51257. ctx.drawImage(bitmap, 0, 0);
  51258. const data = ctx.getImageData(0, 0, width, height).data;
  51259. const buf32 = new Uint32Array(data.buffer);
  51260. const hasAlpha = buf32.some(FeatureTest.isLittleEndian ? x => x >>> 24 !== 0xff : x => (x & 0xff) !== 0xff);
  51261. if (hasAlpha) {
  51262. ctx.fillStyle = "white";
  51263. ctx.fillRect(0, 0, width, height);
  51264. ctx.drawImage(bitmap, 0, 0);
  51265. }
  51266. const jpegBufferPromise = canvas.convertToBlob({
  51267. type: "image/jpeg",
  51268. quality: 1
  51269. }).then(blob => blob.arrayBuffer());
  51270. const xobjectName = Name.get("XObject");
  51271. const imageName = Name.get("Image");
  51272. const image = new Dict(xref);
  51273. image.set("Type", xobjectName);
  51274. image.set("Subtype", imageName);
  51275. image.set("BitsPerComponent", 8);
  51276. image.set("ColorSpace", Name.get("DeviceRGB"));
  51277. image.set("Filter", Name.get("DCTDecode"));
  51278. image.set("BBox", [0, 0, width, height]);
  51279. image.set("Width", width);
  51280. image.set("Height", height);
  51281. let smaskStream = null;
  51282. if (hasAlpha) {
  51283. const alphaBuffer = new Uint8Array(buf32.length);
  51284. if (FeatureTest.isLittleEndian) {
  51285. for (let i = 0, ii = buf32.length; i < ii; i++) {
  51286. alphaBuffer[i] = buf32[i] >>> 24;
  51287. }
  51288. } else {
  51289. for (let i = 0, ii = buf32.length; i < ii; i++) {
  51290. alphaBuffer[i] = buf32[i] & 0xff;
  51291. }
  51292. }
  51293. const smask = new Dict(xref);
  51294. smask.set("Type", xobjectName);
  51295. smask.set("Subtype", imageName);
  51296. smask.set("BitsPerComponent", 8);
  51297. smask.set("ColorSpace", Name.get("DeviceGray"));
  51298. smask.set("Width", width);
  51299. smask.set("Height", height);
  51300. smaskStream = new Stream(alphaBuffer, 0, 0, smask);
  51301. }
  51302. const imageStream = new Stream(await jpegBufferPromise, 0, 0, image);
  51303. return {
  51304. imageStream,
  51305. smaskStream,
  51306. width,
  51307. height
  51308. };
  51309. }
  51310. static createNewDict(annotation, xref, {
  51311. apRef,
  51312. ap
  51313. }) {
  51314. const {
  51315. oldAnnotation,
  51316. rect,
  51317. rotation,
  51318. user
  51319. } = annotation;
  51320. const stamp = oldAnnotation || new Dict(xref);
  51321. stamp.set("Type", Name.get("Annot"));
  51322. stamp.set("Subtype", Name.get("Stamp"));
  51323. stamp.set(oldAnnotation ? "M" : "CreationDate", `D:${getModificationDate()}`);
  51324. stamp.set("Rect", rect);
  51325. stamp.set("F", 4);
  51326. stamp.set("Border", [0, 0, 0]);
  51327. stamp.set("Rotate", rotation);
  51328. if (user) {
  51329. stamp.set("T", stringToAsciiOrUTF16BE(user));
  51330. }
  51331. if (apRef || ap) {
  51332. const n = new Dict(xref);
  51333. stamp.set("AP", n);
  51334. if (apRef) {
  51335. n.set("N", apRef);
  51336. } else {
  51337. n.set("N", ap);
  51338. }
  51339. }
  51340. return stamp;
  51341. }
  51342. static async createNewAppearanceStream(annotation, xref, params) {
  51343. if (annotation.oldAnnotation) {
  51344. return null;
  51345. }
  51346. const {
  51347. rotation
  51348. } = annotation;
  51349. const {
  51350. imageRef,
  51351. width,
  51352. height
  51353. } = params.image;
  51354. const resources = new Dict(xref);
  51355. const xobject = new Dict(xref);
  51356. resources.set("XObject", xobject);
  51357. xobject.set("Im0", imageRef);
  51358. const appearance = `q ${width} 0 0 ${height} 0 0 cm /Im0 Do Q`;
  51359. const appearanceStreamDict = new Dict(xref);
  51360. appearanceStreamDict.set("FormType", 1);
  51361. appearanceStreamDict.set("Subtype", Name.get("Form"));
  51362. appearanceStreamDict.set("Type", Name.get("XObject"));
  51363. appearanceStreamDict.set("BBox", [0, 0, width, height]);
  51364. appearanceStreamDict.set("Resources", resources);
  51365. if (rotation) {
  51366. const matrix = getRotationMatrix(rotation, width, height);
  51367. appearanceStreamDict.set("Matrix", matrix);
  51368. }
  51369. const ap = new StringStream(appearance);
  51370. ap.dict = appearanceStreamDict;
  51371. return ap;
  51372. }
  51373. }
  51374. class FileAttachmentAnnotation extends MarkupAnnotation {
  51375. constructor(params) {
  51376. super(params);
  51377. const {
  51378. dict,
  51379. xref
  51380. } = params;
  51381. const file = new FileSpec(dict.get("FS"), xref);
  51382. this.data.annotationType = AnnotationType.FILEATTACHMENT;
  51383. this.data.hasOwnCanvas = this.data.noRotate;
  51384. this.data.noHTML = false;
  51385. this.data.file = file.serializable;
  51386. const name = dict.get("Name");
  51387. this.data.name = name instanceof Name ? stringToPDFString(name.name) : "PushPin";
  51388. const fillAlpha = dict.get("ca");
  51389. this.data.fillAlpha = typeof fillAlpha === "number" && fillAlpha >= 0 && fillAlpha <= 1 ? fillAlpha : null;
  51390. }
  51391. }
  51392. ;// ./src/core/decrypt_stream.js
  51393. const chunkSize = 512;
  51394. class DecryptStream extends DecodeStream {
  51395. constructor(str, maybeLength, decrypt) {
  51396. super(maybeLength);
  51397. this.str = str;
  51398. this.dict = str.dict;
  51399. this.decrypt = decrypt;
  51400. this.nextChunk = null;
  51401. this.initialized = false;
  51402. }
  51403. readBlock() {
  51404. let chunk;
  51405. if (this.initialized) {
  51406. chunk = this.nextChunk;
  51407. } else {
  51408. chunk = this.str.getBytes(chunkSize);
  51409. this.initialized = true;
  51410. }
  51411. if (!chunk?.length) {
  51412. this.eof = true;
  51413. return;
  51414. }
  51415. this.nextChunk = this.str.getBytes(chunkSize);
  51416. const hasMoreData = this.nextChunk?.length > 0;
  51417. const decrypt = this.decrypt;
  51418. chunk = decrypt(chunk, !hasMoreData);
  51419. const bufferLength = this.bufferLength,
  51420. newLength = bufferLength + chunk.length,
  51421. buffer = this.ensureBuffer(newLength);
  51422. buffer.set(chunk, bufferLength);
  51423. this.bufferLength = newLength;
  51424. }
  51425. }
  51426. ;// ./src/core/crypto.js
  51427. class ARCFourCipher {
  51428. constructor(key) {
  51429. this.a = 0;
  51430. this.b = 0;
  51431. const s = new Uint8Array(256);
  51432. const keyLength = key.length;
  51433. for (let i = 0; i < 256; ++i) {
  51434. s[i] = i;
  51435. }
  51436. for (let i = 0, j = 0; i < 256; ++i) {
  51437. const tmp = s[i];
  51438. j = j + tmp + key[i % keyLength] & 0xff;
  51439. s[i] = s[j];
  51440. s[j] = tmp;
  51441. }
  51442. this.s = s;
  51443. }
  51444. encryptBlock(data) {
  51445. let a = this.a,
  51446. b = this.b;
  51447. const s = this.s;
  51448. const n = data.length;
  51449. const output = new Uint8Array(n);
  51450. for (let i = 0; i < n; ++i) {
  51451. a = a + 1 & 0xff;
  51452. const tmp = s[a];
  51453. b = b + tmp & 0xff;
  51454. const tmp2 = s[b];
  51455. s[a] = tmp2;
  51456. s[b] = tmp;
  51457. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  51458. }
  51459. this.a = a;
  51460. this.b = b;
  51461. return output;
  51462. }
  51463. decryptBlock(data) {
  51464. return this.encryptBlock(data);
  51465. }
  51466. encrypt(data) {
  51467. return this.encryptBlock(data);
  51468. }
  51469. }
  51470. const calculateMD5 = function calculateMD5Closure() {
  51471. const r = new Uint8Array([7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]);
  51472. const k = new Int32Array([-680876936, -389564586, 606105819, -1044525330, -176418897, 1200080426, -1473231341, -45705983, 1770035416, -1958414417, -42063, -1990404162, 1804603682, -40341101, -1502002290, 1236535329, -165796510, -1069501632, 643717713, -373897302, -701558691, 38016083, -660478335, -405537848, 568446438, -1019803690, -187363961, 1163531501, -1444681467, -51403784, 1735328473, -1926607734, -378558, -2022574463, 1839030562, -35309556, -1530992060, 1272893353, -155497632, -1094730640, 681279174, -358537222, -722521979, 76029189, -640364487, -421815835, 530742520, -995338651, -198630844, 1126891415, -1416354905, -57434055, 1700485571, -1894986606, -1051523, -2054922799, 1873313359, -30611744, -1560198380, 1309151649, -145523070, -1120210379, 718787259, -343485551]);
  51473. function hash(data, offset, length) {
  51474. let h0 = 1732584193,
  51475. h1 = -271733879,
  51476. h2 = -1732584194,
  51477. h3 = 271733878;
  51478. const paddedLength = length + 72 & ~63;
  51479. const padded = new Uint8Array(paddedLength);
  51480. let i, j;
  51481. for (i = 0; i < length; ++i) {
  51482. padded[i] = data[offset++];
  51483. }
  51484. padded[i++] = 0x80;
  51485. const n = paddedLength - 8;
  51486. while (i < n) {
  51487. padded[i++] = 0;
  51488. }
  51489. padded[i++] = length << 3 & 0xff;
  51490. padded[i++] = length >> 5 & 0xff;
  51491. padded[i++] = length >> 13 & 0xff;
  51492. padded[i++] = length >> 21 & 0xff;
  51493. padded[i++] = length >>> 29 & 0xff;
  51494. padded[i++] = 0;
  51495. padded[i++] = 0;
  51496. padded[i++] = 0;
  51497. const w = new Int32Array(16);
  51498. for (i = 0; i < paddedLength;) {
  51499. for (j = 0; j < 16; ++j, i += 4) {
  51500. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  51501. }
  51502. let a = h0,
  51503. b = h1,
  51504. c = h2,
  51505. d = h3,
  51506. f,
  51507. g;
  51508. for (j = 0; j < 64; ++j) {
  51509. if (j < 16) {
  51510. f = b & c | ~b & d;
  51511. g = j;
  51512. } else if (j < 32) {
  51513. f = d & b | ~d & c;
  51514. g = 5 * j + 1 & 15;
  51515. } else if (j < 48) {
  51516. f = b ^ c ^ d;
  51517. g = 3 * j + 5 & 15;
  51518. } else {
  51519. f = c ^ (b | ~d);
  51520. g = 7 * j & 15;
  51521. }
  51522. const tmp = d,
  51523. rotateArg = a + f + k[j] + w[g] | 0,
  51524. rotate = r[j];
  51525. d = c;
  51526. c = b;
  51527. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  51528. a = tmp;
  51529. }
  51530. h0 = h0 + a | 0;
  51531. h1 = h1 + b | 0;
  51532. h2 = h2 + c | 0;
  51533. h3 = h3 + d | 0;
  51534. }
  51535. return new Uint8Array([h0 & 0xFF, h0 >> 8 & 0xFF, h0 >> 16 & 0xFF, h0 >>> 24 & 0xFF, h1 & 0xFF, h1 >> 8 & 0xFF, h1 >> 16 & 0xFF, h1 >>> 24 & 0xFF, h2 & 0xFF, h2 >> 8 & 0xFF, h2 >> 16 & 0xFF, h2 >>> 24 & 0xFF, h3 & 0xFF, h3 >> 8 & 0xFF, h3 >> 16 & 0xFF, h3 >>> 24 & 0xFF]);
  51536. }
  51537. return hash;
  51538. }();
  51539. class Word64 {
  51540. constructor(highInteger, lowInteger) {
  51541. this.high = highInteger | 0;
  51542. this.low = lowInteger | 0;
  51543. }
  51544. and(word) {
  51545. this.high &= word.high;
  51546. this.low &= word.low;
  51547. }
  51548. xor(word) {
  51549. this.high ^= word.high;
  51550. this.low ^= word.low;
  51551. }
  51552. or(word) {
  51553. this.high |= word.high;
  51554. this.low |= word.low;
  51555. }
  51556. shiftRight(places) {
  51557. if (places >= 32) {
  51558. this.low = this.high >>> places - 32 | 0;
  51559. this.high = 0;
  51560. } else {
  51561. this.low = this.low >>> places | this.high << 32 - places;
  51562. this.high = this.high >>> places | 0;
  51563. }
  51564. }
  51565. shiftLeft(places) {
  51566. if (places >= 32) {
  51567. this.high = this.low << places - 32;
  51568. this.low = 0;
  51569. } else {
  51570. this.high = this.high << places | this.low >>> 32 - places;
  51571. this.low <<= places;
  51572. }
  51573. }
  51574. rotateRight(places) {
  51575. let low, high;
  51576. if (places & 32) {
  51577. high = this.low;
  51578. low = this.high;
  51579. } else {
  51580. low = this.low;
  51581. high = this.high;
  51582. }
  51583. places &= 31;
  51584. this.low = low >>> places | high << 32 - places;
  51585. this.high = high >>> places | low << 32 - places;
  51586. }
  51587. not() {
  51588. this.high = ~this.high;
  51589. this.low = ~this.low;
  51590. }
  51591. add(word) {
  51592. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  51593. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  51594. if (lowAdd > 0xffffffff) {
  51595. highAdd += 1;
  51596. }
  51597. this.low = lowAdd | 0;
  51598. this.high = highAdd | 0;
  51599. }
  51600. copyTo(bytes, offset) {
  51601. bytes[offset] = this.high >>> 24 & 0xff;
  51602. bytes[offset + 1] = this.high >> 16 & 0xff;
  51603. bytes[offset + 2] = this.high >> 8 & 0xff;
  51604. bytes[offset + 3] = this.high & 0xff;
  51605. bytes[offset + 4] = this.low >>> 24 & 0xff;
  51606. bytes[offset + 5] = this.low >> 16 & 0xff;
  51607. bytes[offset + 6] = this.low >> 8 & 0xff;
  51608. bytes[offset + 7] = this.low & 0xff;
  51609. }
  51610. assign(word) {
  51611. this.high = word.high;
  51612. this.low = word.low;
  51613. }
  51614. }
  51615. const calculateSHA256 = function calculateSHA256Closure() {
  51616. function rotr(x, n) {
  51617. return x >>> n | x << 32 - n;
  51618. }
  51619. function ch(x, y, z) {
  51620. return x & y ^ ~x & z;
  51621. }
  51622. function maj(x, y, z) {
  51623. return x & y ^ x & z ^ y & z;
  51624. }
  51625. function sigma(x) {
  51626. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  51627. }
  51628. function sigmaPrime(x) {
  51629. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  51630. }
  51631. function littleSigma(x) {
  51632. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  51633. }
  51634. function littleSigmaPrime(x) {
  51635. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  51636. }
  51637. const k = [0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2];
  51638. function hash(data, offset, length) {
  51639. let h0 = 0x6a09e667,
  51640. h1 = 0xbb67ae85,
  51641. h2 = 0x3c6ef372,
  51642. h3 = 0xa54ff53a,
  51643. h4 = 0x510e527f,
  51644. h5 = 0x9b05688c,
  51645. h6 = 0x1f83d9ab,
  51646. h7 = 0x5be0cd19;
  51647. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  51648. const padded = new Uint8Array(paddedLength);
  51649. let i, j;
  51650. for (i = 0; i < length; ++i) {
  51651. padded[i] = data[offset++];
  51652. }
  51653. padded[i++] = 0x80;
  51654. const n = paddedLength - 8;
  51655. while (i < n) {
  51656. padded[i++] = 0;
  51657. }
  51658. padded[i++] = 0;
  51659. padded[i++] = 0;
  51660. padded[i++] = 0;
  51661. padded[i++] = length >>> 29 & 0xff;
  51662. padded[i++] = length >> 21 & 0xff;
  51663. padded[i++] = length >> 13 & 0xff;
  51664. padded[i++] = length >> 5 & 0xff;
  51665. padded[i++] = length << 3 & 0xff;
  51666. const w = new Uint32Array(64);
  51667. for (i = 0; i < paddedLength;) {
  51668. for (j = 0; j < 16; ++j) {
  51669. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51670. i += 4;
  51671. }
  51672. for (j = 16; j < 64; ++j) {
  51673. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  51674. }
  51675. let a = h0,
  51676. b = h1,
  51677. c = h2,
  51678. d = h3,
  51679. e = h4,
  51680. f = h5,
  51681. g = h6,
  51682. h = h7,
  51683. t1,
  51684. t2;
  51685. for (j = 0; j < 64; ++j) {
  51686. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  51687. t2 = sigma(a) + maj(a, b, c);
  51688. h = g;
  51689. g = f;
  51690. f = e;
  51691. e = d + t1 | 0;
  51692. d = c;
  51693. c = b;
  51694. b = a;
  51695. a = t1 + t2 | 0;
  51696. }
  51697. h0 = h0 + a | 0;
  51698. h1 = h1 + b | 0;
  51699. h2 = h2 + c | 0;
  51700. h3 = h3 + d | 0;
  51701. h4 = h4 + e | 0;
  51702. h5 = h5 + f | 0;
  51703. h6 = h6 + g | 0;
  51704. h7 = h7 + h | 0;
  51705. }
  51706. return new Uint8Array([h0 >> 24 & 0xFF, h0 >> 16 & 0xFF, h0 >> 8 & 0xFF, h0 & 0xFF, h1 >> 24 & 0xFF, h1 >> 16 & 0xFF, h1 >> 8 & 0xFF, h1 & 0xFF, h2 >> 24 & 0xFF, h2 >> 16 & 0xFF, h2 >> 8 & 0xFF, h2 & 0xFF, h3 >> 24 & 0xFF, h3 >> 16 & 0xFF, h3 >> 8 & 0xFF, h3 & 0xFF, h4 >> 24 & 0xFF, h4 >> 16 & 0xFF, h4 >> 8 & 0xFF, h4 & 0xFF, h5 >> 24 & 0xFF, h5 >> 16 & 0xFF, h5 >> 8 & 0xFF, h5 & 0xFF, h6 >> 24 & 0xFF, h6 >> 16 & 0xFF, h6 >> 8 & 0xFF, h6 & 0xFF, h7 >> 24 & 0xFF, h7 >> 16 & 0xFF, h7 >> 8 & 0xFF, h7 & 0xFF]);
  51707. }
  51708. return hash;
  51709. }();
  51710. const calculateSHA512 = function calculateSHA512Closure() {
  51711. function ch(result, x, y, z, tmp) {
  51712. result.assign(x);
  51713. result.and(y);
  51714. tmp.assign(x);
  51715. tmp.not();
  51716. tmp.and(z);
  51717. result.xor(tmp);
  51718. }
  51719. function maj(result, x, y, z, tmp) {
  51720. result.assign(x);
  51721. result.and(y);
  51722. tmp.assign(x);
  51723. tmp.and(z);
  51724. result.xor(tmp);
  51725. tmp.assign(y);
  51726. tmp.and(z);
  51727. result.xor(tmp);
  51728. }
  51729. function sigma(result, x, tmp) {
  51730. result.assign(x);
  51731. result.rotateRight(28);
  51732. tmp.assign(x);
  51733. tmp.rotateRight(34);
  51734. result.xor(tmp);
  51735. tmp.assign(x);
  51736. tmp.rotateRight(39);
  51737. result.xor(tmp);
  51738. }
  51739. function sigmaPrime(result, x, tmp) {
  51740. result.assign(x);
  51741. result.rotateRight(14);
  51742. tmp.assign(x);
  51743. tmp.rotateRight(18);
  51744. result.xor(tmp);
  51745. tmp.assign(x);
  51746. tmp.rotateRight(41);
  51747. result.xor(tmp);
  51748. }
  51749. function littleSigma(result, x, tmp) {
  51750. result.assign(x);
  51751. result.rotateRight(1);
  51752. tmp.assign(x);
  51753. tmp.rotateRight(8);
  51754. result.xor(tmp);
  51755. tmp.assign(x);
  51756. tmp.shiftRight(7);
  51757. result.xor(tmp);
  51758. }
  51759. function littleSigmaPrime(result, x, tmp) {
  51760. result.assign(x);
  51761. result.rotateRight(19);
  51762. tmp.assign(x);
  51763. tmp.rotateRight(61);
  51764. result.xor(tmp);
  51765. tmp.assign(x);
  51766. tmp.shiftRight(6);
  51767. result.xor(tmp);
  51768. }
  51769. const k = [new Word64(0x428a2f98, 0xd728ae22), new Word64(0x71374491, 0x23ef65cd), new Word64(0xb5c0fbcf, 0xec4d3b2f), new Word64(0xe9b5dba5, 0x8189dbbc), new Word64(0x3956c25b, 0xf348b538), new Word64(0x59f111f1, 0xb605d019), new Word64(0x923f82a4, 0xaf194f9b), new Word64(0xab1c5ed5, 0xda6d8118), new Word64(0xd807aa98, 0xa3030242), new Word64(0x12835b01, 0x45706fbe), new Word64(0x243185be, 0x4ee4b28c), new Word64(0x550c7dc3, 0xd5ffb4e2), new Word64(0x72be5d74, 0xf27b896f), new Word64(0x80deb1fe, 0x3b1696b1), new Word64(0x9bdc06a7, 0x25c71235), new Word64(0xc19bf174, 0xcf692694), new Word64(0xe49b69c1, 0x9ef14ad2), new Word64(0xefbe4786, 0x384f25e3), new Word64(0x0fc19dc6, 0x8b8cd5b5), new Word64(0x240ca1cc, 0x77ac9c65), new Word64(0x2de92c6f, 0x592b0275), new Word64(0x4a7484aa, 0x6ea6e483), new Word64(0x5cb0a9dc, 0xbd41fbd4), new Word64(0x76f988da, 0x831153b5), new Word64(0x983e5152, 0xee66dfab), new Word64(0xa831c66d, 0x2db43210), new Word64(0xb00327c8, 0x98fb213f), new Word64(0xbf597fc7, 0xbeef0ee4), new Word64(0xc6e00bf3, 0x3da88fc2), new Word64(0xd5a79147, 0x930aa725), new Word64(0x06ca6351, 0xe003826f), new Word64(0x14292967, 0x0a0e6e70), new Word64(0x27b70a85, 0x46d22ffc), new Word64(0x2e1b2138, 0x5c26c926), new Word64(0x4d2c6dfc, 0x5ac42aed), new Word64(0x53380d13, 0x9d95b3df), new Word64(0x650a7354, 0x8baf63de), new Word64(0x766a0abb, 0x3c77b2a8), new Word64(0x81c2c92e, 0x47edaee6), new Word64(0x92722c85, 0x1482353b), new Word64(0xa2bfe8a1, 0x4cf10364), new Word64(0xa81a664b, 0xbc423001), new Word64(0xc24b8b70, 0xd0f89791), new Word64(0xc76c51a3, 0x0654be30), new Word64(0xd192e819, 0xd6ef5218), new Word64(0xd6990624, 0x5565a910), new Word64(0xf40e3585, 0x5771202a), new Word64(0x106aa070, 0x32bbd1b8), new Word64(0x19a4c116, 0xb8d2d0c8), new Word64(0x1e376c08, 0x5141ab53), new Word64(0x2748774c, 0xdf8eeb99), new Word64(0x34b0bcb5, 0xe19b48a8), new Word64(0x391c0cb3, 0xc5c95a63), new Word64(0x4ed8aa4a, 0xe3418acb), new Word64(0x5b9cca4f, 0x7763e373), new Word64(0x682e6ff3, 0xd6b2b8a3), new Word64(0x748f82ee, 0x5defb2fc), new Word64(0x78a5636f, 0x43172f60), new Word64(0x84c87814, 0xa1f0ab72), new Word64(0x8cc70208, 0x1a6439ec), new Word64(0x90befffa, 0x23631e28), new Word64(0xa4506ceb, 0xde82bde9), new Word64(0xbef9a3f7, 0xb2c67915), new Word64(0xc67178f2, 0xe372532b), new Word64(0xca273ece, 0xea26619c), new Word64(0xd186b8c7, 0x21c0c207), new Word64(0xeada7dd6, 0xcde0eb1e), new Word64(0xf57d4f7f, 0xee6ed178), new Word64(0x06f067aa, 0x72176fba), new Word64(0x0a637dc5, 0xa2c898a6), new Word64(0x113f9804, 0xbef90dae), new Word64(0x1b710b35, 0x131c471b), new Word64(0x28db77f5, 0x23047d84), new Word64(0x32caab7b, 0x40c72493), new Word64(0x3c9ebe0a, 0x15c9bebc), new Word64(0x431d67c4, 0x9c100d4c), new Word64(0x4cc5d4be, 0xcb3e42b6), new Word64(0x597f299c, 0xfc657e2a), new Word64(0x5fcb6fab, 0x3ad6faec), new Word64(0x6c44198c, 0x4a475817)];
  51770. function hash(data, offset, length, mode384 = false) {
  51771. let h0, h1, h2, h3, h4, h5, h6, h7;
  51772. if (!mode384) {
  51773. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  51774. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  51775. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  51776. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  51777. h4 = new Word64(0x510e527f, 0xade682d1);
  51778. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  51779. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  51780. h7 = new Word64(0x5be0cd19, 0x137e2179);
  51781. } else {
  51782. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  51783. h1 = new Word64(0x629a292a, 0x367cd507);
  51784. h2 = new Word64(0x9159015a, 0x3070dd17);
  51785. h3 = new Word64(0x152fecd8, 0xf70e5939);
  51786. h4 = new Word64(0x67332667, 0xffc00b31);
  51787. h5 = new Word64(0x8eb44a87, 0x68581511);
  51788. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  51789. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  51790. }
  51791. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  51792. const padded = new Uint8Array(paddedLength);
  51793. let i, j;
  51794. for (i = 0; i < length; ++i) {
  51795. padded[i] = data[offset++];
  51796. }
  51797. padded[i++] = 0x80;
  51798. const n = paddedLength - 16;
  51799. while (i < n) {
  51800. padded[i++] = 0;
  51801. }
  51802. padded[i++] = 0;
  51803. padded[i++] = 0;
  51804. padded[i++] = 0;
  51805. padded[i++] = 0;
  51806. padded[i++] = 0;
  51807. padded[i++] = 0;
  51808. padded[i++] = 0;
  51809. padded[i++] = 0;
  51810. padded[i++] = 0;
  51811. padded[i++] = 0;
  51812. padded[i++] = 0;
  51813. padded[i++] = length >>> 29 & 0xff;
  51814. padded[i++] = length >> 21 & 0xff;
  51815. padded[i++] = length >> 13 & 0xff;
  51816. padded[i++] = length >> 5 & 0xff;
  51817. padded[i++] = length << 3 & 0xff;
  51818. const w = new Array(80);
  51819. for (i = 0; i < 80; i++) {
  51820. w[i] = new Word64(0, 0);
  51821. }
  51822. let a = new Word64(0, 0),
  51823. b = new Word64(0, 0),
  51824. c = new Word64(0, 0);
  51825. let d = new Word64(0, 0),
  51826. e = new Word64(0, 0),
  51827. f = new Word64(0, 0);
  51828. let g = new Word64(0, 0),
  51829. h = new Word64(0, 0);
  51830. const t1 = new Word64(0, 0),
  51831. t2 = new Word64(0, 0);
  51832. const tmp1 = new Word64(0, 0),
  51833. tmp2 = new Word64(0, 0);
  51834. let tmp3;
  51835. for (i = 0; i < paddedLength;) {
  51836. for (j = 0; j < 16; ++j) {
  51837. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  51838. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  51839. i += 8;
  51840. }
  51841. for (j = 16; j < 80; ++j) {
  51842. tmp3 = w[j];
  51843. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  51844. tmp3.add(w[j - 7]);
  51845. littleSigma(tmp1, w[j - 15], tmp2);
  51846. tmp3.add(tmp1);
  51847. tmp3.add(w[j - 16]);
  51848. }
  51849. a.assign(h0);
  51850. b.assign(h1);
  51851. c.assign(h2);
  51852. d.assign(h3);
  51853. e.assign(h4);
  51854. f.assign(h5);
  51855. g.assign(h6);
  51856. h.assign(h7);
  51857. for (j = 0; j < 80; ++j) {
  51858. t1.assign(h);
  51859. sigmaPrime(tmp1, e, tmp2);
  51860. t1.add(tmp1);
  51861. ch(tmp1, e, f, g, tmp2);
  51862. t1.add(tmp1);
  51863. t1.add(k[j]);
  51864. t1.add(w[j]);
  51865. sigma(t2, a, tmp2);
  51866. maj(tmp1, a, b, c, tmp2);
  51867. t2.add(tmp1);
  51868. tmp3 = h;
  51869. h = g;
  51870. g = f;
  51871. f = e;
  51872. d.add(t1);
  51873. e = d;
  51874. d = c;
  51875. c = b;
  51876. b = a;
  51877. tmp3.assign(t1);
  51878. tmp3.add(t2);
  51879. a = tmp3;
  51880. }
  51881. h0.add(a);
  51882. h1.add(b);
  51883. h2.add(c);
  51884. h3.add(d);
  51885. h4.add(e);
  51886. h5.add(f);
  51887. h6.add(g);
  51888. h7.add(h);
  51889. }
  51890. let result;
  51891. if (!mode384) {
  51892. result = new Uint8Array(64);
  51893. h0.copyTo(result, 0);
  51894. h1.copyTo(result, 8);
  51895. h2.copyTo(result, 16);
  51896. h3.copyTo(result, 24);
  51897. h4.copyTo(result, 32);
  51898. h5.copyTo(result, 40);
  51899. h6.copyTo(result, 48);
  51900. h7.copyTo(result, 56);
  51901. } else {
  51902. result = new Uint8Array(48);
  51903. h0.copyTo(result, 0);
  51904. h1.copyTo(result, 8);
  51905. h2.copyTo(result, 16);
  51906. h3.copyTo(result, 24);
  51907. h4.copyTo(result, 32);
  51908. h5.copyTo(result, 40);
  51909. }
  51910. return result;
  51911. }
  51912. return hash;
  51913. }();
  51914. function calculateSHA384(data, offset, length) {
  51915. return calculateSHA512(data, offset, length, true);
  51916. }
  51917. class NullCipher {
  51918. decryptBlock(data) {
  51919. return data;
  51920. }
  51921. encrypt(data) {
  51922. return data;
  51923. }
  51924. }
  51925. class AESBaseCipher {
  51926. constructor() {
  51927. this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b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ae, 0x08, 0xba, 0x78, 0x25, 0x2e, 0x1c, 0xa6, 0xb4, 0xc6, 0xe8, 0xdd, 0x74, 0x1f, 0x4b, 0xbd, 0x8b, 0x8a, 0x70, 0x3e, 0xb5, 0x66, 0x48, 0x03, 0xf6, 0x0e, 0x61, 0x35, 0x57, 0xb9, 0x86, 0xc1, 0x1d, 0x9e, 0xe1, 0xf8, 0x98, 0x11, 0x69, 0xd9, 0x8e, 0x94, 0x9b, 0x1e, 0x87, 0xe9, 0xce, 0x55, 0x28, 0xdf, 0x8c, 0xa1, 0x89, 0x0d, 0xbf, 0xe6, 0x42, 0x68, 0x41, 0x99, 0x2d, 0x0f, 0xb0, 0x54, 0xbb, 0x16]);
  51928. this._inv_s = new Uint8Array([0x52, 0x09, 0x6a, 0xd5, 0x30, 0x36, 0xa5, 0x38, 0xbf, 0x40, 0xa3, 0x9e, 0x81, 0xf3, 0xd7, 0xfb, 0x7c, 0xe3, 0x39, 0x82, 0x9b, 0x2f, 0xff, 0x87, 0x34, 0x8e, 0x43, 0x44, 0xc4, 0xde, 0xe9, 0xcb, 0x54, 0x7b, 0x94, 0x32, 0xa6, 0xc2, 0x23, 0x3d, 0xee, 0x4c, 0x95, 0x0b, 0x42, 0xfa, 0xc3, 0x4e, 0x08, 0x2e, 0xa1, 0x66, 0x28, 0xd9, 0x24, 0xb2, 0x76, 0x5b, 0xa2, 0x49, 0x6d, 0x8b, 0xd1, 0x25, 0x72, 0xf8, 0xf6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xd4, 0xa4, 0x5c, 0xcc, 0x5d, 0x65, 0xb6, 0x92, 0x6c, 0x70, 0x48, 0x50, 0xfd, 0xed, 0xb9, 0xda, 0x5e, 0x15, 0x46, 0x57, 0xa7, 0x8d, 0x9d, 0x84, 0x90, 0xd8, 0xab, 0x00, 0x8c, 0xbc, 0xd3, 0x0a, 0xf7, 0xe4, 0x58, 0x05, 0xb8, 0xb3, 0x45, 0x06, 0xd0, 0x2c, 0x1e, 0x8f, 0xca, 0x3f, 0x0f, 0x02, 0xc1, 0xaf, 0xbd, 0x03, 0x01, 0x13, 0x8a, 0x6b, 0x3a, 0x91, 0x11, 0x41, 0x4f, 0x67, 0xdc, 0xea, 0x97, 0xf2, 0xcf, 0xce, 0xf0, 0xb4, 0xe6, 0x73, 0x96, 0xac, 0x74, 0x22, 0xe7, 0xad, 0x35, 0x85, 0xe2, 0xf9, 0x37, 0xe8, 0x1c, 0x75, 0xdf, 0x6e, 0x47, 0xf1, 0x1a, 0x71, 0x1d, 0x29, 0xc5, 0x89, 0x6f, 0xb7, 0x62, 0x0e, 0xaa, 0x18, 0xbe, 0x1b, 0xfc, 0x56, 0x3e, 0x4b, 0xc6, 0xd2, 0x79, 0x20, 0x9a, 0xdb, 0xc0, 0xfe, 0x78, 0xcd, 0x5a, 0xf4, 0x1f, 0xdd, 0xa8, 0x33, 0x88, 0x07, 0xc7, 0x31, 0xb1, 0x12, 0x10, 0x59, 0x27, 0x80, 0xec, 0x5f, 0x60, 0x51, 0x7f, 0xa9, 0x19, 0xb5, 0x4a, 0x0d, 0x2d, 0xe5, 0x7a, 0x9f, 0x93, 0xc9, 0x9c, 0xef, 0xa0, 0xe0, 0x3b, 0x4d, 0xae, 0x2a, 0xf5, 0xb0, 0xc8, 0xeb, 0xbb, 0x3c, 0x83, 0x53, 0x99, 0x61, 0x17, 0x2b, 0x04, 0x7e, 0xba, 0x77, 0xd6, 0x26, 0xe1, 0x69, 0x14, 0x63, 0x55, 0x21, 0x0c, 0x7d]);
  51929. this._mix = new Uint32Array([0x00000000, 0x0e090d0b, 0x1c121a16, 0x121b171d, 0x3824342c, 0x362d3927, 0x24362e3a, 0x2a3f2331, 0x70486858, 0x7e416553, 0x6c5a724e, 0x62537f45, 0x486c5c74, 0x4665517f, 0x547e4662, 0x5a774b69, 0xe090d0b0, 0xee99ddbb, 0xfc82caa6, 0xf28bc7ad, 0xd8b4e49c, 0xd6bde997, 0xc4a6fe8a, 0xcaaff381, 0x90d8b8e8, 0x9ed1b5e3, 0x8ccaa2fe, 0x82c3aff5, 0xa8fc8cc4, 0xa6f581cf, 0xb4ee96d2, 0xbae79bd9, 0xdb3bbb7b, 0xd532b670, 0xc729a16d, 0xc920ac66, 0xe31f8f57, 0xed16825c, 0xff0d9541, 0xf104984a, 0xab73d323, 0xa57ade28, 0xb761c935, 0xb968c43e, 0x9357e70f, 0x9d5eea04, 0x8f45fd19, 0x814cf012, 0x3bab6bcb, 0x35a266c0, 0x27b971dd, 0x29b07cd6, 0x038f5fe7, 0x0d8652ec, 0x1f9d45f1, 0x119448fa, 0x4be30393, 0x45ea0e98, 0x57f11985, 0x59f8148e, 0x73c737bf, 0x7dce3ab4, 0x6fd52da9, 0x61dc20a2, 0xad766df6, 0xa37f60fd, 0xb16477e0, 0xbf6d7aeb, 0x955259da, 0x9b5b54d1, 0x894043cc, 0x87494ec7, 0xdd3e05ae, 0xd33708a5, 0xc12c1fb8, 0xcf2512b3, 0xe51a3182, 0xeb133c89, 0xf9082b94, 0xf701269f, 0x4de6bd46, 0x43efb04d, 0x51f4a750, 0x5ffdaa5b, 0x75c2896a, 0x7bcb8461, 0x69d0937c, 0x67d99e77, 0x3daed51e, 0x33a7d815, 0x21bccf08, 0x2fb5c203, 0x058ae132, 0x0b83ec39, 0x1998fb24, 0x1791f62f, 0x764dd68d, 0x7844db86, 0x6a5fcc9b, 0x6456c190, 0x4e69e2a1, 0x4060efaa, 0x527bf8b7, 0x5c72f5bc, 0x0605bed5, 0x080cb3de, 0x1a17a4c3, 0x141ea9c8, 0x3e218af9, 0x302887f2, 0x223390ef, 0x2c3a9de4, 0x96dd063d, 0x98d40b36, 0x8acf1c2b, 0x84c61120, 0xaef93211, 0xa0f03f1a, 0xb2eb2807, 0xbce2250c, 0xe6956e65, 0xe89c636e, 0xfa877473, 0xf48e7978, 0xdeb15a49, 0xd0b85742, 0xc2a3405f, 0xccaa4d54, 0x41ecdaf7, 0x4fe5d7fc, 0x5dfec0e1, 0x53f7cdea, 0x79c8eedb, 0x77c1e3d0, 0x65daf4cd, 0x6bd3f9c6, 0x31a4b2af, 0x3fadbfa4, 0x2db6a8b9, 0x23bfa5b2, 0x09808683, 0x07898b88, 0x15929c95, 0x1b9b919e, 0xa17c0a47, 0xaf75074c, 0xbd6e1051, 0xb3671d5a, 0x99583e6b, 0x97513360, 0x854a247d, 0x8b432976, 0xd134621f, 0xdf3d6f14, 0xcd267809, 0xc32f7502, 0xe9105633, 0xe7195b38, 0xf5024c25, 0xfb0b412e, 0x9ad7618c, 0x94de6c87, 0x86c57b9a, 0x88cc7691, 0xa2f355a0, 0xacfa58ab, 0xbee14fb6, 0xb0e842bd, 0xea9f09d4, 0xe49604df, 0xf68d13c2, 0xf8841ec9, 0xd2bb3df8, 0xdcb230f3, 0xcea927ee, 0xc0a02ae5, 0x7a47b13c, 0x744ebc37, 0x6655ab2a, 0x685ca621, 0x42638510, 0x4c6a881b, 0x5e719f06, 0x5078920d, 0x0a0fd964, 0x0406d46f, 0x161dc372, 0x1814ce79, 0x322bed48, 0x3c22e043, 0x2e39f75e, 0x2030fa55, 0xec9ab701, 0xe293ba0a, 0xf088ad17, 0xfe81a01c, 0xd4be832d, 0xdab78e26, 0xc8ac993b, 0xc6a59430, 0x9cd2df59, 0x92dbd252, 0x80c0c54f, 0x8ec9c844, 0xa4f6eb75, 0xaaffe67e, 0xb8e4f163, 0xb6edfc68, 0x0c0a67b1, 0x02036aba, 0x10187da7, 0x1e1170ac, 0x342e539d, 0x3a275e96, 0x283c498b, 0x26354480, 0x7c420fe9, 0x724b02e2, 0x605015ff, 0x6e5918f4, 0x44663bc5, 0x4a6f36ce, 0x587421d3, 0x567d2cd8, 0x37a10c7a, 0x39a80171, 0x2bb3166c, 0x25ba1b67, 0x0f853856, 0x018c355d, 0x13972240, 0x1d9e2f4b, 0x47e96422, 0x49e06929, 0x5bfb7e34, 0x55f2733f, 0x7fcd500e, 0x71c45d05, 0x63df4a18, 0x6dd64713, 0xd731dcca, 0xd938d1c1, 0xcb23c6dc, 0xc52acbd7, 0xef15e8e6, 0xe11ce5ed, 0xf307f2f0, 0xfd0efffb, 0xa779b492, 0xa970b999, 0xbb6bae84, 0xb562a38f, 0x9f5d80be, 0x91548db5, 0x834f9aa8, 0x8d4697a3]);
  51930. this._mixCol = new Uint8Array(256);
  51931. for (let i = 0; i < 256; i++) {
  51932. this._mixCol[i] = i < 128 ? i << 1 : i << 1 ^ 0x1b;
  51933. }
  51934. this.buffer = new Uint8Array(16);
  51935. this.bufferPosition = 0;
  51936. }
  51937. _expandKey(cipherKey) {
  51938. unreachable("Cannot call `_expandKey` on the base class");
  51939. }
  51940. _decrypt(input, key) {
  51941. let t, u, v;
  51942. const state = new Uint8Array(16);
  51943. state.set(input);
  51944. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  51945. state[j] ^= key[k];
  51946. }
  51947. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  51948. t = state[13];
  51949. state[13] = state[9];
  51950. state[9] = state[5];
  51951. state[5] = state[1];
  51952. state[1] = t;
  51953. t = state[14];
  51954. u = state[10];
  51955. state[14] = state[6];
  51956. state[10] = state[2];
  51957. state[6] = t;
  51958. state[2] = u;
  51959. t = state[15];
  51960. u = state[11];
  51961. v = state[7];
  51962. state[15] = state[3];
  51963. state[11] = t;
  51964. state[7] = u;
  51965. state[3] = v;
  51966. for (let j = 0; j < 16; ++j) {
  51967. state[j] = this._inv_s[state[j]];
  51968. }
  51969. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  51970. state[j] ^= key[k];
  51971. }
  51972. for (let j = 0; j < 16; j += 4) {
  51973. const s0 = this._mix[state[j]];
  51974. const s1 = this._mix[state[j + 1]];
  51975. const s2 = this._mix[state[j + 2]];
  51976. const s3 = this._mix[state[j + 3]];
  51977. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  51978. state[j] = t >>> 24 & 0xff;
  51979. state[j + 1] = t >> 16 & 0xff;
  51980. state[j + 2] = t >> 8 & 0xff;
  51981. state[j + 3] = t & 0xff;
  51982. }
  51983. }
  51984. t = state[13];
  51985. state[13] = state[9];
  51986. state[9] = state[5];
  51987. state[5] = state[1];
  51988. state[1] = t;
  51989. t = state[14];
  51990. u = state[10];
  51991. state[14] = state[6];
  51992. state[10] = state[2];
  51993. state[6] = t;
  51994. state[2] = u;
  51995. t = state[15];
  51996. u = state[11];
  51997. v = state[7];
  51998. state[15] = state[3];
  51999. state[11] = t;
  52000. state[7] = u;
  52001. state[3] = v;
  52002. for (let j = 0; j < 16; ++j) {
  52003. state[j] = this._inv_s[state[j]];
  52004. state[j] ^= key[j];
  52005. }
  52006. return state;
  52007. }
  52008. _encrypt(input, key) {
  52009. const s = this._s;
  52010. let t, u, v;
  52011. const state = new Uint8Array(16);
  52012. state.set(input);
  52013. for (let j = 0; j < 16; ++j) {
  52014. state[j] ^= key[j];
  52015. }
  52016. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  52017. for (let j = 0; j < 16; ++j) {
  52018. state[j] = s[state[j]];
  52019. }
  52020. v = state[1];
  52021. state[1] = state[5];
  52022. state[5] = state[9];
  52023. state[9] = state[13];
  52024. state[13] = v;
  52025. v = state[2];
  52026. u = state[6];
  52027. state[2] = state[10];
  52028. state[6] = state[14];
  52029. state[10] = v;
  52030. state[14] = u;
  52031. v = state[3];
  52032. u = state[7];
  52033. t = state[11];
  52034. state[3] = state[15];
  52035. state[7] = v;
  52036. state[11] = u;
  52037. state[15] = t;
  52038. for (let j = 0; j < 16; j += 4) {
  52039. const s0 = state[j + 0];
  52040. const s1 = state[j + 1];
  52041. const s2 = state[j + 2];
  52042. const s3 = state[j + 3];
  52043. t = s0 ^ s1 ^ s2 ^ s3;
  52044. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  52045. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  52046. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  52047. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  52048. }
  52049. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  52050. state[j] ^= key[k];
  52051. }
  52052. }
  52053. for (let j = 0; j < 16; ++j) {
  52054. state[j] = s[state[j]];
  52055. }
  52056. v = state[1];
  52057. state[1] = state[5];
  52058. state[5] = state[9];
  52059. state[9] = state[13];
  52060. state[13] = v;
  52061. v = state[2];
  52062. u = state[6];
  52063. state[2] = state[10];
  52064. state[6] = state[14];
  52065. state[10] = v;
  52066. state[14] = u;
  52067. v = state[3];
  52068. u = state[7];
  52069. t = state[11];
  52070. state[3] = state[15];
  52071. state[7] = v;
  52072. state[11] = u;
  52073. state[15] = t;
  52074. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  52075. state[j] ^= key[k];
  52076. }
  52077. return state;
  52078. }
  52079. _decryptBlock2(data, finalize) {
  52080. const sourceLength = data.length;
  52081. let buffer = this.buffer,
  52082. bufferLength = this.bufferPosition;
  52083. const result = [];
  52084. let iv = this.iv;
  52085. for (let i = 0; i < sourceLength; ++i) {
  52086. buffer[bufferLength] = data[i];
  52087. ++bufferLength;
  52088. if (bufferLength < 16) {
  52089. continue;
  52090. }
  52091. const plain = this._decrypt(buffer, this._key);
  52092. for (let j = 0; j < 16; ++j) {
  52093. plain[j] ^= iv[j];
  52094. }
  52095. iv = buffer;
  52096. result.push(plain);
  52097. buffer = new Uint8Array(16);
  52098. bufferLength = 0;
  52099. }
  52100. this.buffer = buffer;
  52101. this.bufferLength = bufferLength;
  52102. this.iv = iv;
  52103. if (result.length === 0) {
  52104. return new Uint8Array(0);
  52105. }
  52106. let outputLength = 16 * result.length;
  52107. if (finalize) {
  52108. const lastBlock = result.at(-1);
  52109. let psLen = lastBlock[15];
  52110. if (psLen <= 16) {
  52111. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  52112. if (lastBlock[i] !== psLen) {
  52113. psLen = 0;
  52114. break;
  52115. }
  52116. }
  52117. outputLength -= psLen;
  52118. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  52119. }
  52120. }
  52121. const output = new Uint8Array(outputLength);
  52122. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52123. output.set(result[i], j);
  52124. }
  52125. return output;
  52126. }
  52127. decryptBlock(data, finalize, iv = null) {
  52128. const sourceLength = data.length;
  52129. const buffer = this.buffer;
  52130. let bufferLength = this.bufferPosition;
  52131. if (iv) {
  52132. this.iv = iv;
  52133. } else {
  52134. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  52135. buffer[bufferLength] = data[i];
  52136. }
  52137. if (bufferLength < 16) {
  52138. this.bufferLength = bufferLength;
  52139. return new Uint8Array(0);
  52140. }
  52141. this.iv = buffer;
  52142. data = data.subarray(16);
  52143. }
  52144. this.buffer = new Uint8Array(16);
  52145. this.bufferLength = 0;
  52146. this.decryptBlock = this._decryptBlock2;
  52147. return this.decryptBlock(data, finalize);
  52148. }
  52149. encrypt(data, iv) {
  52150. const sourceLength = data.length;
  52151. let buffer = this.buffer,
  52152. bufferLength = this.bufferPosition;
  52153. const result = [];
  52154. if (!iv) {
  52155. iv = new Uint8Array(16);
  52156. }
  52157. for (let i = 0; i < sourceLength; ++i) {
  52158. buffer[bufferLength] = data[i];
  52159. ++bufferLength;
  52160. if (bufferLength < 16) {
  52161. continue;
  52162. }
  52163. for (let j = 0; j < 16; ++j) {
  52164. buffer[j] ^= iv[j];
  52165. }
  52166. const cipher = this._encrypt(buffer, this._key);
  52167. iv = cipher;
  52168. result.push(cipher);
  52169. buffer = new Uint8Array(16);
  52170. bufferLength = 0;
  52171. }
  52172. this.buffer = buffer;
  52173. this.bufferLength = bufferLength;
  52174. this.iv = iv;
  52175. if (result.length === 0) {
  52176. return new Uint8Array(0);
  52177. }
  52178. const outputLength = 16 * result.length;
  52179. const output = new Uint8Array(outputLength);
  52180. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  52181. output.set(result[i], j);
  52182. }
  52183. return output;
  52184. }
  52185. }
  52186. class AES128Cipher extends AESBaseCipher {
  52187. constructor(key) {
  52188. super();
  52189. this._cyclesOfRepetition = 10;
  52190. this._keySize = 160;
  52191. this._rcon = new Uint8Array([0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1b, 0x36, 0x6c, 0xd8, 0xab, 0x4d, 0x9a, 0x2f, 0x5e, 0xbc, 0x63, 0xc6, 0x97, 0x35, 0x6a, 0xd4, 0xb3, 0x7d, 0xfa, 0xef, 0xc5, 0x91, 0x39, 0x72, 0xe4, 0xd3, 0xbd, 0x61, 0xc2, 0x9f, 0x25, 0x4a, 0x94, 0x33, 0x66, 0xcc, 0x83, 0x1d, 0x3a, 0x74, 0xe8, 0xcb, 0x8d]);
  52192. this._key = this._expandKey(key);
  52193. }
  52194. _expandKey(cipherKey) {
  52195. const b = 176;
  52196. const s = this._s;
  52197. const rcon = this._rcon;
  52198. const result = new Uint8Array(b);
  52199. result.set(cipherKey);
  52200. for (let j = 16, i = 1; j < b; ++i) {
  52201. let t1 = result[j - 3];
  52202. let t2 = result[j - 2];
  52203. let t3 = result[j - 1];
  52204. let t4 = result[j - 4];
  52205. t1 = s[t1];
  52206. t2 = s[t2];
  52207. t3 = s[t3];
  52208. t4 = s[t4];
  52209. t1 ^= rcon[i];
  52210. for (let n = 0; n < 4; ++n) {
  52211. result[j] = t1 ^= result[j - 16];
  52212. j++;
  52213. result[j] = t2 ^= result[j - 16];
  52214. j++;
  52215. result[j] = t3 ^= result[j - 16];
  52216. j++;
  52217. result[j] = t4 ^= result[j - 16];
  52218. j++;
  52219. }
  52220. }
  52221. return result;
  52222. }
  52223. }
  52224. class AES256Cipher extends AESBaseCipher {
  52225. constructor(key) {
  52226. super();
  52227. this._cyclesOfRepetition = 14;
  52228. this._keySize = 224;
  52229. this._key = this._expandKey(key);
  52230. }
  52231. _expandKey(cipherKey) {
  52232. const b = 240;
  52233. const s = this._s;
  52234. const result = new Uint8Array(b);
  52235. result.set(cipherKey);
  52236. let r = 1;
  52237. let t1, t2, t3, t4;
  52238. for (let j = 32, i = 1; j < b; ++i) {
  52239. if (j % 32 === 16) {
  52240. t1 = s[t1];
  52241. t2 = s[t2];
  52242. t3 = s[t3];
  52243. t4 = s[t4];
  52244. } else if (j % 32 === 0) {
  52245. t1 = result[j - 3];
  52246. t2 = result[j - 2];
  52247. t3 = result[j - 1];
  52248. t4 = result[j - 4];
  52249. t1 = s[t1];
  52250. t2 = s[t2];
  52251. t3 = s[t3];
  52252. t4 = s[t4];
  52253. t1 ^= r;
  52254. if ((r <<= 1) >= 256) {
  52255. r = (r ^ 0x1b) & 0xff;
  52256. }
  52257. }
  52258. for (let n = 0; n < 4; ++n) {
  52259. result[j] = t1 ^= result[j - 32];
  52260. j++;
  52261. result[j] = t2 ^= result[j - 32];
  52262. j++;
  52263. result[j] = t3 ^= result[j - 32];
  52264. j++;
  52265. result[j] = t4 ^= result[j - 32];
  52266. j++;
  52267. }
  52268. }
  52269. return result;
  52270. }
  52271. }
  52272. class PDF17 {
  52273. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52274. const hashData = new Uint8Array(password.length + 56);
  52275. hashData.set(password, 0);
  52276. hashData.set(ownerValidationSalt, password.length);
  52277. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52278. const result = calculateSHA256(hashData, 0, hashData.length);
  52279. return isArrayEqual(result, ownerPassword);
  52280. }
  52281. checkUserPassword(password, userValidationSalt, userPassword) {
  52282. const hashData = new Uint8Array(password.length + 8);
  52283. hashData.set(password, 0);
  52284. hashData.set(userValidationSalt, password.length);
  52285. const result = calculateSHA256(hashData, 0, hashData.length);
  52286. return isArrayEqual(result, userPassword);
  52287. }
  52288. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52289. const hashData = new Uint8Array(password.length + 56);
  52290. hashData.set(password, 0);
  52291. hashData.set(ownerKeySalt, password.length);
  52292. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52293. const key = calculateSHA256(hashData, 0, hashData.length);
  52294. const cipher = new AES256Cipher(key);
  52295. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52296. }
  52297. getUserKey(password, userKeySalt, userEncryption) {
  52298. const hashData = new Uint8Array(password.length + 8);
  52299. hashData.set(password, 0);
  52300. hashData.set(userKeySalt, password.length);
  52301. const key = calculateSHA256(hashData, 0, hashData.length);
  52302. const cipher = new AES256Cipher(key);
  52303. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52304. }
  52305. }
  52306. class PDF20 {
  52307. _hash(password, input, userBytes) {
  52308. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  52309. let e = [0];
  52310. let i = 0;
  52311. while (i < 64 || e.at(-1) > i - 32) {
  52312. const combinedLength = password.length + k.length + userBytes.length,
  52313. combinedArray = new Uint8Array(combinedLength);
  52314. let writeOffset = 0;
  52315. combinedArray.set(password, writeOffset);
  52316. writeOffset += password.length;
  52317. combinedArray.set(k, writeOffset);
  52318. writeOffset += k.length;
  52319. combinedArray.set(userBytes, writeOffset);
  52320. const k1 = new Uint8Array(combinedLength * 64);
  52321. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  52322. k1.set(combinedArray, pos);
  52323. }
  52324. const cipher = new AES128Cipher(k.subarray(0, 16));
  52325. e = cipher.encrypt(k1, k.subarray(16, 32));
  52326. const remainder = e.slice(0, 16).reduce((a, b) => a + b, 0) % 3;
  52327. if (remainder === 0) {
  52328. k = calculateSHA256(e, 0, e.length);
  52329. } else if (remainder === 1) {
  52330. k = calculateSHA384(e, 0, e.length);
  52331. } else if (remainder === 2) {
  52332. k = calculateSHA512(e, 0, e.length);
  52333. }
  52334. i++;
  52335. }
  52336. return k.subarray(0, 32);
  52337. }
  52338. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  52339. const hashData = new Uint8Array(password.length + 56);
  52340. hashData.set(password, 0);
  52341. hashData.set(ownerValidationSalt, password.length);
  52342. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  52343. const result = this._hash(password, hashData, userBytes);
  52344. return isArrayEqual(result, ownerPassword);
  52345. }
  52346. checkUserPassword(password, userValidationSalt, userPassword) {
  52347. const hashData = new Uint8Array(password.length + 8);
  52348. hashData.set(password, 0);
  52349. hashData.set(userValidationSalt, password.length);
  52350. const result = this._hash(password, hashData, []);
  52351. return isArrayEqual(result, userPassword);
  52352. }
  52353. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  52354. const hashData = new Uint8Array(password.length + 56);
  52355. hashData.set(password, 0);
  52356. hashData.set(ownerKeySalt, password.length);
  52357. hashData.set(userBytes, password.length + ownerKeySalt.length);
  52358. const key = this._hash(password, hashData, userBytes);
  52359. const cipher = new AES256Cipher(key);
  52360. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  52361. }
  52362. getUserKey(password, userKeySalt, userEncryption) {
  52363. const hashData = new Uint8Array(password.length + 8);
  52364. hashData.set(password, 0);
  52365. hashData.set(userKeySalt, password.length);
  52366. const key = this._hash(password, hashData, []);
  52367. const cipher = new AES256Cipher(key);
  52368. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  52369. }
  52370. }
  52371. class CipherTransform {
  52372. constructor(stringCipherConstructor, streamCipherConstructor) {
  52373. this.StringCipherConstructor = stringCipherConstructor;
  52374. this.StreamCipherConstructor = streamCipherConstructor;
  52375. }
  52376. createStream(stream, length) {
  52377. const cipher = new this.StreamCipherConstructor();
  52378. return new DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  52379. return cipher.decryptBlock(data, finalize);
  52380. });
  52381. }
  52382. decryptString(s) {
  52383. const cipher = new this.StringCipherConstructor();
  52384. let data = stringToBytes(s);
  52385. data = cipher.decryptBlock(data, true);
  52386. return bytesToString(data);
  52387. }
  52388. encryptString(s) {
  52389. const cipher = new this.StringCipherConstructor();
  52390. if (cipher instanceof AESBaseCipher) {
  52391. const strLen = s.length;
  52392. const pad = 16 - strLen % 16;
  52393. s += String.fromCharCode(pad).repeat(pad);
  52394. const iv = new Uint8Array(16);
  52395. if (typeof crypto !== "undefined") {
  52396. crypto.getRandomValues(iv);
  52397. } else {
  52398. for (let i = 0; i < 16; i++) {
  52399. iv[i] = Math.floor(256 * Math.random());
  52400. }
  52401. }
  52402. let data = stringToBytes(s);
  52403. data = cipher.encrypt(data, iv);
  52404. const buf = new Uint8Array(16 + data.length);
  52405. buf.set(iv);
  52406. buf.set(data, 16);
  52407. return bytesToString(buf);
  52408. }
  52409. let data = stringToBytes(s);
  52410. data = cipher.encrypt(data);
  52411. return bytesToString(data);
  52412. }
  52413. }
  52414. class CipherTransformFactory {
  52415. static #defaultPasswordBytes = new Uint8Array([0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41, 0x64, 0x00, 0x4e, 0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68, 0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a]);
  52416. #createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  52417. if (password) {
  52418. const passwordLength = Math.min(127, password.length);
  52419. password = password.subarray(0, passwordLength);
  52420. } else {
  52421. password = [];
  52422. }
  52423. const pdfAlgorithm = revision === 6 ? new PDF20() : new PDF17();
  52424. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  52425. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  52426. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  52427. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  52428. }
  52429. return null;
  52430. }
  52431. #prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  52432. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  52433. const hashData = new Uint8Array(hashDataSize);
  52434. let i = 0,
  52435. j,
  52436. n;
  52437. if (password) {
  52438. n = Math.min(32, password.length);
  52439. for (; i < n; ++i) {
  52440. hashData[i] = password[i];
  52441. }
  52442. }
  52443. j = 0;
  52444. while (i < 32) {
  52445. hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++];
  52446. }
  52447. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  52448. hashData[i++] = ownerPassword[j];
  52449. }
  52450. hashData[i++] = flags & 0xff;
  52451. hashData[i++] = flags >> 8 & 0xff;
  52452. hashData[i++] = flags >> 16 & 0xff;
  52453. hashData[i++] = flags >>> 24 & 0xff;
  52454. for (j = 0, n = fileId.length; j < n; ++j) {
  52455. hashData[i++] = fileId[j];
  52456. }
  52457. if (revision >= 4 && !encryptMetadata) {
  52458. hashData[i++] = 0xff;
  52459. hashData[i++] = 0xff;
  52460. hashData[i++] = 0xff;
  52461. hashData[i++] = 0xff;
  52462. }
  52463. let hash = calculateMD5(hashData, 0, i);
  52464. const keyLengthInBytes = keyLength >> 3;
  52465. if (revision >= 3) {
  52466. for (j = 0; j < 50; ++j) {
  52467. hash = calculateMD5(hash, 0, keyLengthInBytes);
  52468. }
  52469. }
  52470. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  52471. let cipher, checkData;
  52472. if (revision >= 3) {
  52473. for (i = 0; i < 32; ++i) {
  52474. hashData[i] = CipherTransformFactory.#defaultPasswordBytes[i];
  52475. }
  52476. for (j = 0, n = fileId.length; j < n; ++j) {
  52477. hashData[i++] = fileId[j];
  52478. }
  52479. cipher = new ARCFourCipher(encryptionKey);
  52480. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  52481. n = encryptionKey.length;
  52482. const derivedKey = new Uint8Array(n);
  52483. for (j = 1; j <= 19; ++j) {
  52484. for (let k = 0; k < n; ++k) {
  52485. derivedKey[k] = encryptionKey[k] ^ j;
  52486. }
  52487. cipher = new ARCFourCipher(derivedKey);
  52488. checkData = cipher.encryptBlock(checkData);
  52489. }
  52490. for (j = 0, n = checkData.length; j < n; ++j) {
  52491. if (userPassword[j] !== checkData[j]) {
  52492. return null;
  52493. }
  52494. }
  52495. } else {
  52496. cipher = new ARCFourCipher(encryptionKey);
  52497. checkData = cipher.encryptBlock(CipherTransformFactory.#defaultPasswordBytes);
  52498. for (j = 0, n = checkData.length; j < n; ++j) {
  52499. if (userPassword[j] !== checkData[j]) {
  52500. return null;
  52501. }
  52502. }
  52503. }
  52504. return encryptionKey;
  52505. }
  52506. #decodeUserPassword(password, ownerPassword, revision, keyLength) {
  52507. const hashData = new Uint8Array(32);
  52508. let i = 0;
  52509. const n = Math.min(32, password.length);
  52510. for (; i < n; ++i) {
  52511. hashData[i] = password[i];
  52512. }
  52513. let j = 0;
  52514. while (i < 32) {
  52515. hashData[i++] = CipherTransformFactory.#defaultPasswordBytes[j++];
  52516. }
  52517. let hash = calculateMD5(hashData, 0, i);
  52518. const keyLengthInBytes = keyLength >> 3;
  52519. if (revision >= 3) {
  52520. for (j = 0; j < 50; ++j) {
  52521. hash = calculateMD5(hash, 0, hash.length);
  52522. }
  52523. }
  52524. let cipher, userPassword;
  52525. if (revision >= 3) {
  52526. userPassword = ownerPassword;
  52527. const derivedKey = new Uint8Array(keyLengthInBytes);
  52528. for (j = 19; j >= 0; j--) {
  52529. for (let k = 0; k < keyLengthInBytes; ++k) {
  52530. derivedKey[k] = hash[k] ^ j;
  52531. }
  52532. cipher = new ARCFourCipher(derivedKey);
  52533. userPassword = cipher.encryptBlock(userPassword);
  52534. }
  52535. } else {
  52536. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  52537. userPassword = cipher.encryptBlock(ownerPassword);
  52538. }
  52539. return userPassword;
  52540. }
  52541. #buildObjectKey(num, gen, encryptionKey, isAes = false) {
  52542. const key = new Uint8Array(encryptionKey.length + 9);
  52543. const n = encryptionKey.length;
  52544. let i;
  52545. for (i = 0; i < n; ++i) {
  52546. key[i] = encryptionKey[i];
  52547. }
  52548. key[i++] = num & 0xff;
  52549. key[i++] = num >> 8 & 0xff;
  52550. key[i++] = num >> 16 & 0xff;
  52551. key[i++] = gen & 0xff;
  52552. key[i++] = gen >> 8 & 0xff;
  52553. if (isAes) {
  52554. key[i++] = 0x73;
  52555. key[i++] = 0x41;
  52556. key[i++] = 0x6c;
  52557. key[i++] = 0x54;
  52558. }
  52559. const hash = calculateMD5(key, 0, i);
  52560. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  52561. }
  52562. #buildCipherConstructor(cf, name, num, gen, key) {
  52563. if (!(name instanceof Name)) {
  52564. throw new FormatError("Invalid crypt filter name.");
  52565. }
  52566. const self = this;
  52567. const cryptFilter = cf.get(name.name);
  52568. const cfm = cryptFilter?.get("CFM");
  52569. if (!cfm || cfm.name === "None") {
  52570. return function () {
  52571. return new NullCipher();
  52572. };
  52573. }
  52574. if (cfm.name === "V2") {
  52575. return function () {
  52576. return new ARCFourCipher(self.#buildObjectKey(num, gen, key, false));
  52577. };
  52578. }
  52579. if (cfm.name === "AESV2") {
  52580. return function () {
  52581. return new AES128Cipher(self.#buildObjectKey(num, gen, key, true));
  52582. };
  52583. }
  52584. if (cfm.name === "AESV3") {
  52585. return function () {
  52586. return new AES256Cipher(key);
  52587. };
  52588. }
  52589. throw new FormatError("Unknown crypto method");
  52590. }
  52591. constructor(dict, fileId, password) {
  52592. const filter = dict.get("Filter");
  52593. if (!isName(filter, "Standard")) {
  52594. throw new FormatError("unknown encryption method");
  52595. }
  52596. this.filterName = filter.name;
  52597. this.dict = dict;
  52598. const algorithm = dict.get("V");
  52599. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  52600. throw new FormatError("unsupported encryption algorithm");
  52601. }
  52602. this.algorithm = algorithm;
  52603. let keyLength = dict.get("Length");
  52604. if (!keyLength) {
  52605. if (algorithm <= 3) {
  52606. keyLength = 40;
  52607. } else {
  52608. const cfDict = dict.get("CF");
  52609. const streamCryptoName = dict.get("StmF");
  52610. if (cfDict instanceof Dict && streamCryptoName instanceof Name) {
  52611. cfDict.suppressEncryption = true;
  52612. const handlerDict = cfDict.get(streamCryptoName.name);
  52613. keyLength = handlerDict?.get("Length") || 128;
  52614. if (keyLength < 40) {
  52615. keyLength <<= 3;
  52616. }
  52617. }
  52618. }
  52619. }
  52620. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  52621. throw new FormatError("invalid key length");
  52622. }
  52623. const ownerBytes = stringToBytes(dict.get("O")),
  52624. userBytes = stringToBytes(dict.get("U"));
  52625. const ownerPassword = ownerBytes.subarray(0, 32);
  52626. const userPassword = userBytes.subarray(0, 32);
  52627. const flags = dict.get("P");
  52628. const revision = dict.get("R");
  52629. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  52630. this.encryptMetadata = encryptMetadata;
  52631. const fileIdBytes = stringToBytes(fileId);
  52632. let passwordBytes;
  52633. if (password) {
  52634. if (revision === 6) {
  52635. try {
  52636. password = utf8StringToString(password);
  52637. } catch {
  52638. warn("CipherTransformFactory: Unable to convert UTF8 encoded password.");
  52639. }
  52640. }
  52641. passwordBytes = stringToBytes(password);
  52642. }
  52643. let encryptionKey;
  52644. if (algorithm !== 5) {
  52645. encryptionKey = this.#prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52646. } else {
  52647. const ownerValidationSalt = ownerBytes.subarray(32, 40);
  52648. const ownerKeySalt = ownerBytes.subarray(40, 48);
  52649. const uBytes = userBytes.subarray(0, 48);
  52650. const userValidationSalt = userBytes.subarray(32, 40);
  52651. const userKeySalt = userBytes.subarray(40, 48);
  52652. const ownerEncryption = stringToBytes(dict.get("OE"));
  52653. const userEncryption = stringToBytes(dict.get("UE"));
  52654. const perms = stringToBytes(dict.get("Perms"));
  52655. encryptionKey = this.#createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  52656. }
  52657. if (!encryptionKey && !password) {
  52658. throw new PasswordException("No password given", PasswordResponses.NEED_PASSWORD);
  52659. } else if (!encryptionKey && password) {
  52660. const decodedPassword = this.#decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  52661. encryptionKey = this.#prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  52662. }
  52663. if (!encryptionKey) {
  52664. throw new PasswordException("Incorrect Password", PasswordResponses.INCORRECT_PASSWORD);
  52665. }
  52666. this.encryptionKey = encryptionKey;
  52667. if (algorithm >= 4) {
  52668. const cf = dict.get("CF");
  52669. if (cf instanceof Dict) {
  52670. cf.suppressEncryption = true;
  52671. }
  52672. this.cf = cf;
  52673. this.stmf = dict.get("StmF") || Name.get("Identity");
  52674. this.strf = dict.get("StrF") || Name.get("Identity");
  52675. this.eff = dict.get("EFF") || this.stmf;
  52676. }
  52677. }
  52678. createCipherTransform(num, gen) {
  52679. if (this.algorithm === 4 || this.algorithm === 5) {
  52680. return new CipherTransform(this.#buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey), this.#buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey));
  52681. }
  52682. const key = this.#buildObjectKey(num, gen, this.encryptionKey, false);
  52683. const cipherConstructor = function () {
  52684. return new ARCFourCipher(key);
  52685. };
  52686. return new CipherTransform(cipherConstructor, cipherConstructor);
  52687. }
  52688. }
  52689. ;// ./src/core/dataset_reader.js
  52690. function decodeString(str) {
  52691. try {
  52692. return stringToUTF8String(str);
  52693. } catch (ex) {
  52694. warn(`UTF-8 decoding failed: "${ex}".`);
  52695. return str;
  52696. }
  52697. }
  52698. class DatasetXMLParser extends SimpleXMLParser {
  52699. constructor(options) {
  52700. super(options);
  52701. this.node = null;
  52702. }
  52703. onEndElement(name) {
  52704. const node = super.onEndElement(name);
  52705. if (node && name === "xfa:datasets") {
  52706. this.node = node;
  52707. throw new Error("Aborting DatasetXMLParser.");
  52708. }
  52709. }
  52710. }
  52711. class DatasetReader {
  52712. constructor(data) {
  52713. if (data.datasets) {
  52714. this.node = new SimpleXMLParser({
  52715. hasAttributes: true
  52716. }).parseFromString(data.datasets).documentElement;
  52717. } else {
  52718. const parser = new DatasetXMLParser({
  52719. hasAttributes: true
  52720. });
  52721. try {
  52722. parser.parseFromString(data["xdp:xdp"]);
  52723. } catch {}
  52724. this.node = parser.node;
  52725. }
  52726. }
  52727. getValue(path) {
  52728. if (!this.node || !path) {
  52729. return "";
  52730. }
  52731. const node = this.node.searchNode(parseXFAPath(path), 0);
  52732. if (!node) {
  52733. return "";
  52734. }
  52735. const first = node.firstChild;
  52736. if (first?.nodeName === "value") {
  52737. return node.children.map(child => decodeString(child.textContent));
  52738. }
  52739. return decodeString(node.textContent);
  52740. }
  52741. }
  52742. ;// ./src/core/xref.js
  52743. class XRef {
  52744. #firstXRefStmPos = null;
  52745. constructor(stream, pdfManager) {
  52746. this.stream = stream;
  52747. this.pdfManager = pdfManager;
  52748. this.entries = [];
  52749. this._xrefStms = new Set();
  52750. this._cacheMap = new Map();
  52751. this._pendingRefs = new RefSet();
  52752. this._newPersistentRefNum = null;
  52753. this._newTemporaryRefNum = null;
  52754. this._persistentRefsCache = null;
  52755. }
  52756. getNewPersistentRef(obj) {
  52757. if (this._newPersistentRefNum === null) {
  52758. this._newPersistentRefNum = this.entries.length || 1;
  52759. }
  52760. const num = this._newPersistentRefNum++;
  52761. this._cacheMap.set(num, obj);
  52762. return Ref.get(num, 0);
  52763. }
  52764. getNewTemporaryRef() {
  52765. if (this._newTemporaryRefNum === null) {
  52766. this._newTemporaryRefNum = this.entries.length || 1;
  52767. if (this._newPersistentRefNum) {
  52768. this._persistentRefsCache = new Map();
  52769. for (let i = this._newTemporaryRefNum; i < this._newPersistentRefNum; i++) {
  52770. this._persistentRefsCache.set(i, this._cacheMap.get(i));
  52771. this._cacheMap.delete(i);
  52772. }
  52773. }
  52774. }
  52775. return Ref.get(this._newTemporaryRefNum++, 0);
  52776. }
  52777. resetNewTemporaryRef() {
  52778. this._newTemporaryRefNum = null;
  52779. if (this._persistentRefsCache) {
  52780. for (const [num, obj] of this._persistentRefsCache) {
  52781. this._cacheMap.set(num, obj);
  52782. }
  52783. }
  52784. this._persistentRefsCache = null;
  52785. }
  52786. setStartXRef(startXRef) {
  52787. this.startXRefQueue = [startXRef];
  52788. }
  52789. parse(recoveryMode = false) {
  52790. let trailerDict;
  52791. if (!recoveryMode) {
  52792. trailerDict = this.readXRef();
  52793. } else {
  52794. warn("Indexing all PDF objects");
  52795. trailerDict = this.indexObjects();
  52796. }
  52797. trailerDict.assignXref(this);
  52798. this.trailer = trailerDict;
  52799. let encrypt;
  52800. try {
  52801. encrypt = trailerDict.get("Encrypt");
  52802. } catch (ex) {
  52803. if (ex instanceof MissingDataException) {
  52804. throw ex;
  52805. }
  52806. warn(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  52807. }
  52808. if (encrypt instanceof Dict) {
  52809. const ids = trailerDict.get("ID");
  52810. const fileId = ids?.length ? ids[0] : "";
  52811. encrypt.suppressEncryption = true;
  52812. this.encrypt = new CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  52813. }
  52814. let root;
  52815. try {
  52816. root = trailerDict.get("Root");
  52817. } catch (ex) {
  52818. if (ex instanceof MissingDataException) {
  52819. throw ex;
  52820. }
  52821. warn(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  52822. }
  52823. if (root instanceof Dict) {
  52824. try {
  52825. const pages = root.get("Pages");
  52826. if (pages instanceof Dict) {
  52827. this.root = root;
  52828. return;
  52829. }
  52830. } catch (ex) {
  52831. if (ex instanceof MissingDataException) {
  52832. throw ex;
  52833. }
  52834. warn(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  52835. }
  52836. }
  52837. if (!recoveryMode) {
  52838. throw new XRefParseException();
  52839. }
  52840. throw new InvalidPDFException("Invalid Root reference.");
  52841. }
  52842. processXRefTable(parser) {
  52843. if (!("tableState" in this)) {
  52844. this.tableState = {
  52845. entryNum: 0,
  52846. streamPos: parser.lexer.stream.pos,
  52847. parserBuf1: parser.buf1,
  52848. parserBuf2: parser.buf2
  52849. };
  52850. }
  52851. const obj = this.readXRefTable(parser);
  52852. if (!isCmd(obj, "trailer")) {
  52853. throw new FormatError("Invalid XRef table: could not find trailer dictionary");
  52854. }
  52855. let dict = parser.getObj();
  52856. if (!(dict instanceof Dict) && dict.dict) {
  52857. dict = dict.dict;
  52858. }
  52859. if (!(dict instanceof Dict)) {
  52860. throw new FormatError("Invalid XRef table: could not parse trailer dictionary");
  52861. }
  52862. delete this.tableState;
  52863. return dict;
  52864. }
  52865. readXRefTable(parser) {
  52866. const stream = parser.lexer.stream;
  52867. const tableState = this.tableState;
  52868. stream.pos = tableState.streamPos;
  52869. parser.buf1 = tableState.parserBuf1;
  52870. parser.buf2 = tableState.parserBuf2;
  52871. let obj;
  52872. while (true) {
  52873. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  52874. if (isCmd(obj = parser.getObj(), "trailer")) {
  52875. break;
  52876. }
  52877. tableState.firstEntryNum = obj;
  52878. tableState.entryCount = parser.getObj();
  52879. }
  52880. let first = tableState.firstEntryNum;
  52881. const count = tableState.entryCount;
  52882. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  52883. throw new FormatError("Invalid XRef table: wrong types in subsection header");
  52884. }
  52885. for (let i = tableState.entryNum; i < count; i++) {
  52886. tableState.streamPos = stream.pos;
  52887. tableState.entryNum = i;
  52888. tableState.parserBuf1 = parser.buf1;
  52889. tableState.parserBuf2 = parser.buf2;
  52890. const entry = {};
  52891. entry.offset = parser.getObj();
  52892. entry.gen = parser.getObj();
  52893. const type = parser.getObj();
  52894. if (type instanceof Cmd) {
  52895. switch (type.cmd) {
  52896. case "f":
  52897. entry.free = true;
  52898. break;
  52899. case "n":
  52900. entry.uncompressed = true;
  52901. break;
  52902. }
  52903. }
  52904. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  52905. throw new FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  52906. }
  52907. if (i === 0 && entry.free && first === 1) {
  52908. first = 0;
  52909. }
  52910. if (!this.entries[i + first]) {
  52911. this.entries[i + first] = entry;
  52912. }
  52913. }
  52914. tableState.entryNum = 0;
  52915. tableState.streamPos = stream.pos;
  52916. tableState.parserBuf1 = parser.buf1;
  52917. tableState.parserBuf2 = parser.buf2;
  52918. delete tableState.firstEntryNum;
  52919. delete tableState.entryCount;
  52920. }
  52921. if (this.entries[0] && !this.entries[0].free) {
  52922. throw new FormatError("Invalid XRef table: unexpected first object");
  52923. }
  52924. return obj;
  52925. }
  52926. processXRefStream(stream) {
  52927. if (!("streamState" in this)) {
  52928. const {
  52929. dict,
  52930. pos
  52931. } = stream;
  52932. const byteWidths = dict.get("W");
  52933. const range = dict.get("Index") || [0, dict.get("Size")];
  52934. this.streamState = {
  52935. entryRanges: range,
  52936. byteWidths,
  52937. entryNum: 0,
  52938. streamPos: pos
  52939. };
  52940. }
  52941. this.readXRefStream(stream);
  52942. delete this.streamState;
  52943. return stream.dict;
  52944. }
  52945. readXRefStream(stream) {
  52946. const streamState = this.streamState;
  52947. stream.pos = streamState.streamPos;
  52948. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  52949. const entryRanges = streamState.entryRanges;
  52950. while (entryRanges.length > 0) {
  52951. const [first, n] = entryRanges;
  52952. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  52953. throw new FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  52954. }
  52955. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  52956. throw new FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  52957. }
  52958. for (let i = streamState.entryNum; i < n; ++i) {
  52959. streamState.entryNum = i;
  52960. streamState.streamPos = stream.pos;
  52961. let type = 0,
  52962. offset = 0,
  52963. generation = 0;
  52964. for (let j = 0; j < typeFieldWidth; ++j) {
  52965. const typeByte = stream.getByte();
  52966. if (typeByte === -1) {
  52967. throw new FormatError("Invalid XRef byteWidths 'type'.");
  52968. }
  52969. type = type << 8 | typeByte;
  52970. }
  52971. if (typeFieldWidth === 0) {
  52972. type = 1;
  52973. }
  52974. for (let j = 0; j < offsetFieldWidth; ++j) {
  52975. const offsetByte = stream.getByte();
  52976. if (offsetByte === -1) {
  52977. throw new FormatError("Invalid XRef byteWidths 'offset'.");
  52978. }
  52979. offset = offset << 8 | offsetByte;
  52980. }
  52981. for (let j = 0; j < generationFieldWidth; ++j) {
  52982. const generationByte = stream.getByte();
  52983. if (generationByte === -1) {
  52984. throw new FormatError("Invalid XRef byteWidths 'generation'.");
  52985. }
  52986. generation = generation << 8 | generationByte;
  52987. }
  52988. const entry = {};
  52989. entry.offset = offset;
  52990. entry.gen = generation;
  52991. switch (type) {
  52992. case 0:
  52993. entry.free = true;
  52994. break;
  52995. case 1:
  52996. entry.uncompressed = true;
  52997. break;
  52998. case 2:
  52999. break;
  53000. default:
  53001. throw new FormatError(`Invalid XRef entry type: ${type}`);
  53002. }
  53003. if (!this.entries[first + i]) {
  53004. this.entries[first + i] = entry;
  53005. }
  53006. }
  53007. streamState.entryNum = 0;
  53008. streamState.streamPos = stream.pos;
  53009. entryRanges.splice(0, 2);
  53010. }
  53011. }
  53012. indexObjects() {
  53013. const TAB = 0x9,
  53014. LF = 0xa,
  53015. CR = 0xd,
  53016. SPACE = 0x20;
  53017. const PERCENT = 0x25,
  53018. LT = 0x3c;
  53019. function readToken(data, offset) {
  53020. let token = "",
  53021. ch = data[offset];
  53022. while (ch !== LF && ch !== CR && ch !== LT) {
  53023. if (++offset >= data.length) {
  53024. break;
  53025. }
  53026. token += String.fromCharCode(ch);
  53027. ch = data[offset];
  53028. }
  53029. return token;
  53030. }
  53031. function skipUntil(data, offset, what) {
  53032. const length = what.length,
  53033. dataLength = data.length;
  53034. let skipped = 0;
  53035. while (offset < dataLength) {
  53036. let i = 0;
  53037. while (i < length && data[offset + i] === what[i]) {
  53038. ++i;
  53039. }
  53040. if (i >= length) {
  53041. break;
  53042. }
  53043. offset++;
  53044. skipped++;
  53045. }
  53046. return skipped;
  53047. }
  53048. const gEndobjRegExp = /\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g;
  53049. const gStartxrefRegExp = /\b(startxref|\d+\s+\d+\s+obj)\b/g;
  53050. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  53051. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  53052. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  53053. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  53054. this.entries.length = 0;
  53055. this._cacheMap.clear();
  53056. const stream = this.stream;
  53057. stream.pos = 0;
  53058. const buffer = stream.getBytes(),
  53059. bufferStr = bytesToString(buffer),
  53060. length = buffer.length;
  53061. let position = stream.start;
  53062. const trailers = [],
  53063. xrefStms = [];
  53064. while (position < length) {
  53065. let ch = buffer[position];
  53066. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  53067. ++position;
  53068. continue;
  53069. }
  53070. if (ch === PERCENT) {
  53071. do {
  53072. ++position;
  53073. if (position >= length) {
  53074. break;
  53075. }
  53076. ch = buffer[position];
  53077. } while (ch !== LF && ch !== CR);
  53078. continue;
  53079. }
  53080. const token = readToken(buffer, position);
  53081. let m;
  53082. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  53083. position += skipUntil(buffer, position, trailerBytes);
  53084. trailers.push(position);
  53085. position += skipUntil(buffer, position, startxrefBytes);
  53086. } else if (m = objRegExp.exec(token)) {
  53087. const num = m[1] | 0,
  53088. gen = m[2] | 0;
  53089. const startPos = position + token.length;
  53090. let contentLength,
  53091. updateEntries = false;
  53092. if (!this.entries[num]) {
  53093. updateEntries = true;
  53094. } else if (this.entries[num].gen === gen) {
  53095. try {
  53096. const parser = new Parser({
  53097. lexer: new Lexer(stream.makeSubStream(startPos))
  53098. });
  53099. parser.getObj();
  53100. updateEntries = true;
  53101. } catch (ex) {
  53102. if (ex instanceof ParserEOFException) {
  53103. warn(`indexObjects -- checking object (${token}): "${ex}".`);
  53104. } else {
  53105. updateEntries = true;
  53106. }
  53107. }
  53108. }
  53109. if (updateEntries) {
  53110. this.entries[num] = {
  53111. offset: position - stream.start,
  53112. gen,
  53113. uncompressed: true
  53114. };
  53115. }
  53116. gEndobjRegExp.lastIndex = startPos;
  53117. const match = gEndobjRegExp.exec(bufferStr);
  53118. if (match) {
  53119. const endPos = gEndobjRegExp.lastIndex + 1;
  53120. contentLength = endPos - position;
  53121. if (match[1] !== "endobj") {
  53122. warn(`indexObjects: Found "${match[1]}" inside of another "obj", ` + 'caused by missing "endobj" -- trying to recover.');
  53123. contentLength -= match[1].length + 1;
  53124. }
  53125. } else {
  53126. contentLength = length - position;
  53127. }
  53128. const content = buffer.subarray(position, position + contentLength);
  53129. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  53130. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  53131. xrefStms.push(position - stream.start);
  53132. this._xrefStms.add(position - stream.start);
  53133. }
  53134. position += contentLength;
  53135. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  53136. trailers.push(position);
  53137. const startPos = position + token.length;
  53138. let contentLength;
  53139. gStartxrefRegExp.lastIndex = startPos;
  53140. const match = gStartxrefRegExp.exec(bufferStr);
  53141. if (match) {
  53142. const endPos = gStartxrefRegExp.lastIndex + 1;
  53143. contentLength = endPos - position;
  53144. if (match[1] !== "startxref") {
  53145. warn(`indexObjects: Found "${match[1]}" after "trailer", ` + 'caused by missing "startxref" -- trying to recover.');
  53146. contentLength -= match[1].length + 1;
  53147. }
  53148. } else {
  53149. contentLength = length - position;
  53150. }
  53151. position += contentLength;
  53152. } else {
  53153. position += token.length + 1;
  53154. }
  53155. }
  53156. for (const xrefStm of xrefStms) {
  53157. this.startXRefQueue.push(xrefStm);
  53158. this.readXRef(true);
  53159. }
  53160. const trailerDicts = [];
  53161. let isEncrypted = false;
  53162. for (const trailer of trailers) {
  53163. stream.pos = trailer;
  53164. const parser = new Parser({
  53165. lexer: new Lexer(stream),
  53166. xref: this,
  53167. allowStreams: true,
  53168. recoveryMode: true
  53169. });
  53170. const obj = parser.getObj();
  53171. if (!isCmd(obj, "trailer")) {
  53172. continue;
  53173. }
  53174. const dict = parser.getObj();
  53175. if (!(dict instanceof Dict)) {
  53176. continue;
  53177. }
  53178. trailerDicts.push(dict);
  53179. if (dict.has("Encrypt")) {
  53180. isEncrypted = true;
  53181. }
  53182. }
  53183. let trailerDict, trailerError;
  53184. for (const dict of [...trailerDicts, "genFallback", ...trailerDicts]) {
  53185. if (dict === "genFallback") {
  53186. if (!trailerError) {
  53187. break;
  53188. }
  53189. this._generationFallback = true;
  53190. continue;
  53191. }
  53192. let validPagesDict = false;
  53193. try {
  53194. const rootDict = dict.get("Root");
  53195. if (!(rootDict instanceof Dict)) {
  53196. continue;
  53197. }
  53198. const pagesDict = rootDict.get("Pages");
  53199. if (!(pagesDict instanceof Dict)) {
  53200. continue;
  53201. }
  53202. const pagesCount = pagesDict.get("Count");
  53203. if (Number.isInteger(pagesCount)) {
  53204. validPagesDict = true;
  53205. }
  53206. } catch (ex) {
  53207. trailerError = ex;
  53208. continue;
  53209. }
  53210. if (validPagesDict && (!isEncrypted || dict.has("Encrypt")) && dict.has("ID")) {
  53211. return dict;
  53212. }
  53213. trailerDict = dict;
  53214. }
  53215. if (trailerDict) {
  53216. return trailerDict;
  53217. }
  53218. if (this.topDict) {
  53219. return this.topDict;
  53220. }
  53221. if (!trailerDicts.length) {
  53222. for (const [num, entry] of this.entries.entries()) {
  53223. if (!entry) {
  53224. continue;
  53225. }
  53226. const ref = Ref.get(num, entry.gen);
  53227. let obj;
  53228. try {
  53229. obj = this.fetch(ref);
  53230. } catch {
  53231. continue;
  53232. }
  53233. if (obj instanceof BaseStream) {
  53234. obj = obj.dict;
  53235. }
  53236. if (obj instanceof Dict && obj.has("Root")) {
  53237. return obj;
  53238. }
  53239. }
  53240. }
  53241. throw new InvalidPDFException("Invalid PDF structure.");
  53242. }
  53243. readXRef(recoveryMode = false) {
  53244. const stream = this.stream;
  53245. const startXRefParsedCache = new Set();
  53246. while (this.startXRefQueue.length) {
  53247. try {
  53248. const startXRef = this.startXRefQueue[0];
  53249. if (startXRefParsedCache.has(startXRef)) {
  53250. warn("readXRef - skipping XRef table since it was already parsed.");
  53251. this.startXRefQueue.shift();
  53252. continue;
  53253. }
  53254. startXRefParsedCache.add(startXRef);
  53255. stream.pos = startXRef + stream.start;
  53256. const parser = new Parser({
  53257. lexer: new Lexer(stream),
  53258. xref: this,
  53259. allowStreams: true
  53260. });
  53261. let obj = parser.getObj();
  53262. let dict;
  53263. if (isCmd(obj, "xref")) {
  53264. dict = this.processXRefTable(parser);
  53265. if (!this.topDict) {
  53266. this.topDict = dict;
  53267. }
  53268. obj = dict.get("XRefStm");
  53269. if (Number.isInteger(obj) && !this._xrefStms.has(obj)) {
  53270. this._xrefStms.add(obj);
  53271. this.startXRefQueue.push(obj);
  53272. this.#firstXRefStmPos ??= obj;
  53273. }
  53274. } else if (Number.isInteger(obj)) {
  53275. if (!Number.isInteger(parser.getObj()) || !isCmd(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof BaseStream)) {
  53276. throw new FormatError("Invalid XRef stream");
  53277. }
  53278. dict = this.processXRefStream(obj);
  53279. if (!this.topDict) {
  53280. this.topDict = dict;
  53281. }
  53282. if (!dict) {
  53283. throw new FormatError("Failed to read XRef stream");
  53284. }
  53285. } else {
  53286. throw new FormatError("Invalid XRef stream header");
  53287. }
  53288. obj = dict.get("Prev");
  53289. if (Number.isInteger(obj)) {
  53290. this.startXRefQueue.push(obj);
  53291. } else if (obj instanceof Ref) {
  53292. this.startXRefQueue.push(obj.num);
  53293. }
  53294. } catch (e) {
  53295. if (e instanceof MissingDataException) {
  53296. throw e;
  53297. }
  53298. info("(while reading XRef): " + e);
  53299. }
  53300. this.startXRefQueue.shift();
  53301. }
  53302. if (this.topDict) {
  53303. return this.topDict;
  53304. }
  53305. if (recoveryMode) {
  53306. return undefined;
  53307. }
  53308. throw new XRefParseException();
  53309. }
  53310. get lastXRefStreamPos() {
  53311. return this.#firstXRefStmPos ?? (this._xrefStms.size > 0 ? Math.max(...this._xrefStms) : null);
  53312. }
  53313. getEntry(i) {
  53314. const xrefEntry = this.entries[i];
  53315. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  53316. return xrefEntry;
  53317. }
  53318. return null;
  53319. }
  53320. fetchIfRef(obj, suppressEncryption = false) {
  53321. if (obj instanceof Ref) {
  53322. return this.fetch(obj, suppressEncryption);
  53323. }
  53324. return obj;
  53325. }
  53326. fetch(ref, suppressEncryption = false) {
  53327. if (!(ref instanceof Ref)) {
  53328. throw new Error("ref object is not a reference");
  53329. }
  53330. const num = ref.num;
  53331. const cacheEntry = this._cacheMap.get(num);
  53332. if (cacheEntry !== undefined) {
  53333. if (cacheEntry instanceof Dict && !cacheEntry.objId) {
  53334. cacheEntry.objId = ref.toString();
  53335. }
  53336. return cacheEntry;
  53337. }
  53338. let xrefEntry = this.getEntry(num);
  53339. if (xrefEntry === null) {
  53340. this._cacheMap.set(num, xrefEntry);
  53341. return xrefEntry;
  53342. }
  53343. if (this._pendingRefs.has(ref)) {
  53344. this._pendingRefs.remove(ref);
  53345. warn(`Ignoring circular reference: ${ref}.`);
  53346. return CIRCULAR_REF;
  53347. }
  53348. this._pendingRefs.put(ref);
  53349. try {
  53350. xrefEntry = xrefEntry.uncompressed ? this.fetchUncompressed(ref, xrefEntry, suppressEncryption) : this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  53351. this._pendingRefs.remove(ref);
  53352. } catch (ex) {
  53353. this._pendingRefs.remove(ref);
  53354. throw ex;
  53355. }
  53356. if (xrefEntry instanceof Dict) {
  53357. xrefEntry.objId = ref.toString();
  53358. } else if (xrefEntry instanceof BaseStream) {
  53359. xrefEntry.dict.objId = ref.toString();
  53360. }
  53361. return xrefEntry;
  53362. }
  53363. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  53364. const gen = ref.gen;
  53365. let num = ref.num;
  53366. if (xrefEntry.gen !== gen) {
  53367. const msg = `Inconsistent generation in XRef: ${ref}`;
  53368. if (this._generationFallback && xrefEntry.gen < gen) {
  53369. warn(msg);
  53370. return this.fetchUncompressed(Ref.get(num, xrefEntry.gen), xrefEntry, suppressEncryption);
  53371. }
  53372. throw new XRefEntryException(msg);
  53373. }
  53374. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  53375. const parser = new Parser({
  53376. lexer: new Lexer(stream),
  53377. xref: this,
  53378. allowStreams: true
  53379. });
  53380. const obj1 = parser.getObj();
  53381. const obj2 = parser.getObj();
  53382. const obj3 = parser.getObj();
  53383. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof Cmd)) {
  53384. throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  53385. }
  53386. if (obj3.cmd !== "obj") {
  53387. if (obj3.cmd.startsWith("obj")) {
  53388. num = parseInt(obj3.cmd.substring(3), 10);
  53389. if (!Number.isNaN(num)) {
  53390. return num;
  53391. }
  53392. }
  53393. throw new XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  53394. }
  53395. xrefEntry = this.encrypt && !suppressEncryption ? parser.getObj(this.encrypt.createCipherTransform(num, gen)) : parser.getObj();
  53396. if (!(xrefEntry instanceof BaseStream)) {
  53397. this._cacheMap.set(num, xrefEntry);
  53398. }
  53399. return xrefEntry;
  53400. }
  53401. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  53402. const tableOffset = xrefEntry.offset;
  53403. const stream = this.fetch(Ref.get(tableOffset, 0));
  53404. if (!(stream instanceof BaseStream)) {
  53405. throw new FormatError("bad ObjStm stream");
  53406. }
  53407. const first = stream.dict.get("First");
  53408. const n = stream.dict.get("N");
  53409. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  53410. throw new FormatError("invalid first and n parameters for ObjStm stream");
  53411. }
  53412. let parser = new Parser({
  53413. lexer: new Lexer(stream),
  53414. xref: this,
  53415. allowStreams: true
  53416. });
  53417. const nums = new Array(n);
  53418. const offsets = new Array(n);
  53419. for (let i = 0; i < n; ++i) {
  53420. const num = parser.getObj();
  53421. if (!Number.isInteger(num)) {
  53422. throw new FormatError(`invalid object number in the ObjStm stream: ${num}`);
  53423. }
  53424. const offset = parser.getObj();
  53425. if (!Number.isInteger(offset)) {
  53426. throw new FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  53427. }
  53428. nums[i] = num;
  53429. offsets[i] = offset;
  53430. }
  53431. const start = (stream.start || 0) + first;
  53432. const entries = new Array(n);
  53433. for (let i = 0; i < n; ++i) {
  53434. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  53435. if (length < 0) {
  53436. throw new FormatError("Invalid offset in the ObjStm stream.");
  53437. }
  53438. parser = new Parser({
  53439. lexer: new Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  53440. xref: this,
  53441. allowStreams: true
  53442. });
  53443. const obj = parser.getObj();
  53444. entries[i] = obj;
  53445. if (obj instanceof BaseStream) {
  53446. continue;
  53447. }
  53448. const num = nums[i],
  53449. entry = this.entries[num];
  53450. if (entry && entry.offset === tableOffset && entry.gen === i) {
  53451. this._cacheMap.set(num, obj);
  53452. }
  53453. }
  53454. xrefEntry = entries[xrefEntry.gen];
  53455. if (xrefEntry === undefined) {
  53456. throw new XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  53457. }
  53458. return xrefEntry;
  53459. }
  53460. async fetchIfRefAsync(obj, suppressEncryption) {
  53461. if (obj instanceof Ref) {
  53462. return this.fetchAsync(obj, suppressEncryption);
  53463. }
  53464. return obj;
  53465. }
  53466. async fetchAsync(ref, suppressEncryption) {
  53467. try {
  53468. return this.fetch(ref, suppressEncryption);
  53469. } catch (ex) {
  53470. if (!(ex instanceof MissingDataException)) {
  53471. throw ex;
  53472. }
  53473. await this.pdfManager.requestRange(ex.begin, ex.end);
  53474. return this.fetchAsync(ref, suppressEncryption);
  53475. }
  53476. }
  53477. getCatalogObj() {
  53478. return this.root;
  53479. }
  53480. }
  53481. ;// ./src/core/document.js
  53482. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  53483. class Page {
  53484. constructor({
  53485. pdfManager,
  53486. xref,
  53487. pageIndex,
  53488. pageDict,
  53489. ref,
  53490. globalIdFactory,
  53491. fontCache,
  53492. builtInCMapCache,
  53493. standardFontDataCache,
  53494. globalImageCache,
  53495. systemFontCache,
  53496. nonBlendModesSet,
  53497. xfaFactory
  53498. }) {
  53499. this.pdfManager = pdfManager;
  53500. this.pageIndex = pageIndex;
  53501. this.pageDict = pageDict;
  53502. this.xref = xref;
  53503. this.ref = ref;
  53504. this.fontCache = fontCache;
  53505. this.builtInCMapCache = builtInCMapCache;
  53506. this.standardFontDataCache = standardFontDataCache;
  53507. this.globalImageCache = globalImageCache;
  53508. this.systemFontCache = systemFontCache;
  53509. this.nonBlendModesSet = nonBlendModesSet;
  53510. this.evaluatorOptions = pdfManager.evaluatorOptions;
  53511. this.resourcesPromise = null;
  53512. this.xfaFactory = xfaFactory;
  53513. const idCounters = {
  53514. obj: 0
  53515. };
  53516. this._localIdFactory = class extends globalIdFactory {
  53517. static createObjId() {
  53518. return `p${pageIndex}_${++idCounters.obj}`;
  53519. }
  53520. static getPageObjId() {
  53521. return `p${ref.toString()}`;
  53522. }
  53523. };
  53524. }
  53525. _getInheritableProperty(key, getArray = false) {
  53526. const value = getInheritableProperty({
  53527. dict: this.pageDict,
  53528. key,
  53529. getArray,
  53530. stopWhenFound: false
  53531. });
  53532. if (!Array.isArray(value)) {
  53533. return value;
  53534. }
  53535. if (value.length === 1 || !(value[0] instanceof Dict)) {
  53536. return value[0];
  53537. }
  53538. return Dict.merge({
  53539. xref: this.xref,
  53540. dictArray: value
  53541. });
  53542. }
  53543. get content() {
  53544. return this.pageDict.getArray("Contents");
  53545. }
  53546. get resources() {
  53547. const resources = this._getInheritableProperty("Resources");
  53548. return shadow(this, "resources", resources instanceof Dict ? resources : Dict.empty);
  53549. }
  53550. _getBoundingBox(name) {
  53551. if (this.xfaData) {
  53552. return this.xfaData.bbox;
  53553. }
  53554. const box = lookupNormalRect(this._getInheritableProperty(name, true), null);
  53555. if (box) {
  53556. if (box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  53557. return box;
  53558. }
  53559. warn(`Empty, or invalid, /${name} entry.`);
  53560. }
  53561. return null;
  53562. }
  53563. get mediaBox() {
  53564. return shadow(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  53565. }
  53566. get cropBox() {
  53567. return shadow(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  53568. }
  53569. get userUnit() {
  53570. const obj = this.pageDict.get("UserUnit");
  53571. return shadow(this, "userUnit", typeof obj === "number" && obj > 0 ? obj : 1.0);
  53572. }
  53573. get view() {
  53574. const {
  53575. cropBox,
  53576. mediaBox
  53577. } = this;
  53578. if (cropBox !== mediaBox && !isArrayEqual(cropBox, mediaBox)) {
  53579. const box = Util.intersect(cropBox, mediaBox);
  53580. if (box && box[2] - box[0] > 0 && box[3] - box[1] > 0) {
  53581. return shadow(this, "view", box);
  53582. }
  53583. warn("Empty /CropBox and /MediaBox intersection.");
  53584. }
  53585. return shadow(this, "view", mediaBox);
  53586. }
  53587. get rotate() {
  53588. let rotate = this._getInheritableProperty("Rotate") || 0;
  53589. if (rotate % 90 !== 0) {
  53590. rotate = 0;
  53591. } else if (rotate >= 360) {
  53592. rotate %= 360;
  53593. } else if (rotate < 0) {
  53594. rotate = (rotate % 360 + 360) % 360;
  53595. }
  53596. return shadow(this, "rotate", rotate);
  53597. }
  53598. _onSubStreamError(reason, objId) {
  53599. if (this.evaluatorOptions.ignoreErrors) {
  53600. warn(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  53601. return;
  53602. }
  53603. throw reason;
  53604. }
  53605. getContentStream() {
  53606. return this.pdfManager.ensure(this, "content").then(content => {
  53607. if (content instanceof BaseStream) {
  53608. return content;
  53609. }
  53610. if (Array.isArray(content)) {
  53611. return new StreamsSequenceStream(content, this._onSubStreamError.bind(this));
  53612. }
  53613. return new NullStream();
  53614. });
  53615. }
  53616. get xfaData() {
  53617. return shadow(this, "xfaData", this.xfaFactory ? {
  53618. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  53619. } : null);
  53620. }
  53621. async #replaceIdByRef(annotations, deletedAnnotations, existingAnnotations) {
  53622. const promises = [];
  53623. for (const annotation of annotations) {
  53624. if (annotation.id) {
  53625. const ref = Ref.fromString(annotation.id);
  53626. if (!ref) {
  53627. warn(`A non-linked annotation cannot be modified: ${annotation.id}`);
  53628. continue;
  53629. }
  53630. if (annotation.deleted) {
  53631. deletedAnnotations.put(ref, ref);
  53632. if (annotation.popupRef) {
  53633. const popupRef = Ref.fromString(annotation.popupRef);
  53634. if (popupRef) {
  53635. deletedAnnotations.put(popupRef, popupRef);
  53636. }
  53637. }
  53638. continue;
  53639. }
  53640. existingAnnotations?.put(ref);
  53641. annotation.ref = ref;
  53642. promises.push(this.xref.fetchAsync(ref).then(obj => {
  53643. if (obj instanceof Dict) {
  53644. annotation.oldAnnotation = obj.clone();
  53645. }
  53646. }, () => {
  53647. warn(`Cannot fetch \`oldAnnotation\` for: ${ref}.`);
  53648. }));
  53649. delete annotation.id;
  53650. }
  53651. }
  53652. await Promise.all(promises);
  53653. }
  53654. async saveNewAnnotations(handler, task, annotations, imagePromises, changes) {
  53655. if (this.xfaFactory) {
  53656. throw new Error("XFA: Cannot save new annotations.");
  53657. }
  53658. const partialEvaluator = new PartialEvaluator({
  53659. xref: this.xref,
  53660. handler,
  53661. pageIndex: this.pageIndex,
  53662. idFactory: this._localIdFactory,
  53663. fontCache: this.fontCache,
  53664. builtInCMapCache: this.builtInCMapCache,
  53665. standardFontDataCache: this.standardFontDataCache,
  53666. globalImageCache: this.globalImageCache,
  53667. systemFontCache: this.systemFontCache,
  53668. options: this.evaluatorOptions
  53669. });
  53670. const deletedAnnotations = new RefSetCache();
  53671. const existingAnnotations = new RefSet();
  53672. await this.#replaceIdByRef(annotations, deletedAnnotations, existingAnnotations);
  53673. const pageDict = this.pageDict;
  53674. const annotationsArray = this.annotations.filter(a => !(a instanceof Ref && deletedAnnotations.has(a)));
  53675. const newData = await AnnotationFactory.saveNewAnnotations(partialEvaluator, task, annotations, imagePromises, changes);
  53676. for (const {
  53677. ref
  53678. } of newData.annotations) {
  53679. if (ref instanceof Ref && !existingAnnotations.has(ref)) {
  53680. annotationsArray.push(ref);
  53681. }
  53682. }
  53683. const dict = pageDict.clone();
  53684. dict.set("Annots", annotationsArray);
  53685. changes.put(this.ref, {
  53686. data: dict
  53687. });
  53688. for (const deletedRef of deletedAnnotations) {
  53689. changes.put(deletedRef, {
  53690. data: null
  53691. });
  53692. }
  53693. }
  53694. save(handler, task, annotationStorage, changes) {
  53695. const partialEvaluator = new PartialEvaluator({
  53696. xref: this.xref,
  53697. handler,
  53698. pageIndex: this.pageIndex,
  53699. idFactory: this._localIdFactory,
  53700. fontCache: this.fontCache,
  53701. builtInCMapCache: this.builtInCMapCache,
  53702. standardFontDataCache: this.standardFontDataCache,
  53703. globalImageCache: this.globalImageCache,
  53704. systemFontCache: this.systemFontCache,
  53705. options: this.evaluatorOptions
  53706. });
  53707. return this._parsedAnnotations.then(function (annotations) {
  53708. const promises = [];
  53709. for (const annotation of annotations) {
  53710. promises.push(annotation.save(partialEvaluator, task, annotationStorage, changes).catch(function (reason) {
  53711. warn("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  53712. return null;
  53713. }));
  53714. }
  53715. return Promise.all(promises);
  53716. });
  53717. }
  53718. loadResources(keys) {
  53719. this.resourcesPromise ||= this.pdfManager.ensure(this, "resources");
  53720. return this.resourcesPromise.then(() => {
  53721. const objectLoader = new ObjectLoader(this.resources, keys, this.xref);
  53722. return objectLoader.load();
  53723. });
  53724. }
  53725. getOperatorList({
  53726. handler,
  53727. sink,
  53728. task,
  53729. intent,
  53730. cacheKey,
  53731. annotationStorage = null,
  53732. modifiedIds = null
  53733. }) {
  53734. const contentStreamPromise = this.getContentStream();
  53735. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  53736. const partialEvaluator = new PartialEvaluator({
  53737. xref: this.xref,
  53738. handler,
  53739. pageIndex: this.pageIndex,
  53740. idFactory: this._localIdFactory,
  53741. fontCache: this.fontCache,
  53742. builtInCMapCache: this.builtInCMapCache,
  53743. standardFontDataCache: this.standardFontDataCache,
  53744. globalImageCache: this.globalImageCache,
  53745. systemFontCache: this.systemFontCache,
  53746. options: this.evaluatorOptions
  53747. });
  53748. const newAnnotsByPage = !this.xfaFactory ? getNewAnnotationsMap(annotationStorage) : null;
  53749. const newAnnots = newAnnotsByPage?.get(this.pageIndex);
  53750. let newAnnotationsPromise = Promise.resolve(null);
  53751. let deletedAnnotations = null;
  53752. if (newAnnots) {
  53753. const annotationGlobalsPromise = this.pdfManager.ensureDoc("annotationGlobals");
  53754. let imagePromises;
  53755. const missingBitmaps = new Set();
  53756. for (const {
  53757. bitmapId,
  53758. bitmap
  53759. } of newAnnots) {
  53760. if (bitmapId && !bitmap && !missingBitmaps.has(bitmapId)) {
  53761. missingBitmaps.add(bitmapId);
  53762. }
  53763. }
  53764. const {
  53765. isOffscreenCanvasSupported
  53766. } = this.evaluatorOptions;
  53767. if (missingBitmaps.size > 0) {
  53768. const annotationWithBitmaps = newAnnots.slice();
  53769. for (const [key, annotation] of annotationStorage) {
  53770. if (!key.startsWith(AnnotationEditorPrefix)) {
  53771. continue;
  53772. }
  53773. if (annotation.bitmap && missingBitmaps.has(annotation.bitmapId)) {
  53774. annotationWithBitmaps.push(annotation);
  53775. }
  53776. }
  53777. imagePromises = AnnotationFactory.generateImages(annotationWithBitmaps, this.xref, isOffscreenCanvasSupported);
  53778. } else {
  53779. imagePromises = AnnotationFactory.generateImages(newAnnots, this.xref, isOffscreenCanvasSupported);
  53780. }
  53781. deletedAnnotations = new RefSet();
  53782. newAnnotationsPromise = Promise.all([annotationGlobalsPromise, this.#replaceIdByRef(newAnnots, deletedAnnotations, null)]).then(([annotationGlobals]) => {
  53783. if (!annotationGlobals) {
  53784. return null;
  53785. }
  53786. return AnnotationFactory.printNewAnnotations(annotationGlobals, partialEvaluator, task, newAnnots, imagePromises);
  53787. });
  53788. }
  53789. const pageListPromise = Promise.all([contentStreamPromise, resourcesPromise]).then(([contentStream]) => {
  53790. const opList = new OperatorList(intent, sink);
  53791. handler.send("StartRenderPage", {
  53792. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  53793. pageIndex: this.pageIndex,
  53794. cacheKey
  53795. });
  53796. return partialEvaluator.getOperatorList({
  53797. stream: contentStream,
  53798. task,
  53799. resources: this.resources,
  53800. operatorList: opList
  53801. }).then(function () {
  53802. return opList;
  53803. });
  53804. });
  53805. return Promise.all([pageListPromise, this._parsedAnnotations, newAnnotationsPromise]).then(function ([pageOpList, annotations, newAnnotations]) {
  53806. if (newAnnotations) {
  53807. annotations = annotations.filter(a => !(a.ref && deletedAnnotations.has(a.ref)));
  53808. for (let i = 0, ii = newAnnotations.length; i < ii; i++) {
  53809. const newAnnotation = newAnnotations[i];
  53810. if (newAnnotation.refToReplace) {
  53811. const j = annotations.findIndex(a => a.ref && isRefsEqual(a.ref, newAnnotation.refToReplace));
  53812. if (j >= 0) {
  53813. annotations.splice(j, 1, newAnnotation);
  53814. newAnnotations.splice(i--, 1);
  53815. ii--;
  53816. }
  53817. }
  53818. }
  53819. annotations = annotations.concat(newAnnotations);
  53820. }
  53821. if (annotations.length === 0 || intent & RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  53822. pageOpList.flush(true);
  53823. return {
  53824. length: pageOpList.totalLength
  53825. };
  53826. }
  53827. const renderForms = !!(intent & RenderingIntentFlag.ANNOTATIONS_FORMS),
  53828. isEditing = !!(intent & RenderingIntentFlag.IS_EDITING),
  53829. intentAny = !!(intent & RenderingIntentFlag.ANY),
  53830. intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
  53831. intentPrint = !!(intent & RenderingIntentFlag.PRINT);
  53832. const opListPromises = [];
  53833. for (const annotation of annotations) {
  53834. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage, renderForms) && annotation.mustBeViewedWhenEditing(isEditing, modifiedIds) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  53835. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, annotationStorage).catch(function (reason) {
  53836. warn("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  53837. return {
  53838. opList: null,
  53839. separateForm: false,
  53840. separateCanvas: false
  53841. };
  53842. }));
  53843. }
  53844. }
  53845. return Promise.all(opListPromises).then(function (opLists) {
  53846. let form = false,
  53847. canvas = false;
  53848. for (const {
  53849. opList,
  53850. separateForm,
  53851. separateCanvas
  53852. } of opLists) {
  53853. pageOpList.addOpList(opList);
  53854. form ||= separateForm;
  53855. canvas ||= separateCanvas;
  53856. }
  53857. pageOpList.flush(true, {
  53858. form,
  53859. canvas
  53860. });
  53861. return {
  53862. length: pageOpList.totalLength
  53863. };
  53864. });
  53865. });
  53866. }
  53867. async extractTextContent({
  53868. handler,
  53869. task,
  53870. includeMarkedContent,
  53871. disableNormalization,
  53872. sink
  53873. }) {
  53874. const contentStreamPromise = this.getContentStream();
  53875. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  53876. const langPromise = this.pdfManager.ensureCatalog("lang");
  53877. const [contentStream,, lang] = await Promise.all([contentStreamPromise, resourcesPromise, langPromise]);
  53878. const partialEvaluator = new PartialEvaluator({
  53879. xref: this.xref,
  53880. handler,
  53881. pageIndex: this.pageIndex,
  53882. idFactory: this._localIdFactory,
  53883. fontCache: this.fontCache,
  53884. builtInCMapCache: this.builtInCMapCache,
  53885. standardFontDataCache: this.standardFontDataCache,
  53886. globalImageCache: this.globalImageCache,
  53887. systemFontCache: this.systemFontCache,
  53888. options: this.evaluatorOptions
  53889. });
  53890. return partialEvaluator.getTextContent({
  53891. stream: contentStream,
  53892. task,
  53893. resources: this.resources,
  53894. includeMarkedContent,
  53895. disableNormalization,
  53896. sink,
  53897. viewBox: this.view,
  53898. lang
  53899. });
  53900. }
  53901. async getStructTree() {
  53902. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  53903. if (!structTreeRoot) {
  53904. return null;
  53905. }
  53906. await this._parsedAnnotations;
  53907. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  53908. return this.pdfManager.ensure(structTree, "serializable");
  53909. }
  53910. _parseStructTree(structTreeRoot) {
  53911. const tree = new StructTreePage(structTreeRoot, this.pageDict);
  53912. tree.parse(this.ref);
  53913. return tree;
  53914. }
  53915. async getAnnotationsData(handler, task, intent) {
  53916. const annotations = await this._parsedAnnotations;
  53917. if (annotations.length === 0) {
  53918. return annotations;
  53919. }
  53920. const annotationsData = [],
  53921. textContentPromises = [];
  53922. let partialEvaluator;
  53923. const intentAny = !!(intent & RenderingIntentFlag.ANY),
  53924. intentDisplay = !!(intent & RenderingIntentFlag.DISPLAY),
  53925. intentPrint = !!(intent & RenderingIntentFlag.PRINT);
  53926. for (const annotation of annotations) {
  53927. const isVisible = intentAny || intentDisplay && annotation.viewable;
  53928. if (isVisible || intentPrint && annotation.printable) {
  53929. annotationsData.push(annotation.data);
  53930. }
  53931. if (annotation.hasTextContent && isVisible) {
  53932. partialEvaluator ||= new PartialEvaluator({
  53933. xref: this.xref,
  53934. handler,
  53935. pageIndex: this.pageIndex,
  53936. idFactory: this._localIdFactory,
  53937. fontCache: this.fontCache,
  53938. builtInCMapCache: this.builtInCMapCache,
  53939. standardFontDataCache: this.standardFontDataCache,
  53940. globalImageCache: this.globalImageCache,
  53941. systemFontCache: this.systemFontCache,
  53942. options: this.evaluatorOptions
  53943. });
  53944. textContentPromises.push(annotation.extractTextContent(partialEvaluator, task, [-Infinity, -Infinity, Infinity, Infinity]).catch(function (reason) {
  53945. warn(`getAnnotationsData - ignoring textContent during "${task.name}" task: "${reason}".`);
  53946. }));
  53947. }
  53948. }
  53949. await Promise.all(textContentPromises);
  53950. return annotationsData;
  53951. }
  53952. get annotations() {
  53953. const annots = this._getInheritableProperty("Annots");
  53954. return shadow(this, "annotations", Array.isArray(annots) ? annots : []);
  53955. }
  53956. get _parsedAnnotations() {
  53957. const promise = this.pdfManager.ensure(this, "annotations").then(async annots => {
  53958. if (annots.length === 0) {
  53959. return annots;
  53960. }
  53961. const [annotationGlobals, fieldObjects] = await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"), this.pdfManager.ensureDoc("fieldObjects")]);
  53962. if (!annotationGlobals) {
  53963. return [];
  53964. }
  53965. const orphanFields = fieldObjects?.orphanFields;
  53966. const annotationPromises = [];
  53967. for (const annotationRef of annots) {
  53968. annotationPromises.push(AnnotationFactory.create(this.xref, annotationRef, annotationGlobals, this._localIdFactory, false, orphanFields, this.ref).catch(function (reason) {
  53969. warn(`_parsedAnnotations: "${reason}".`);
  53970. return null;
  53971. }));
  53972. }
  53973. const sortedAnnotations = [];
  53974. let popupAnnotations, widgetAnnotations;
  53975. for (const annotation of await Promise.all(annotationPromises)) {
  53976. if (!annotation) {
  53977. continue;
  53978. }
  53979. if (annotation instanceof WidgetAnnotation) {
  53980. (widgetAnnotations ||= []).push(annotation);
  53981. continue;
  53982. }
  53983. if (annotation instanceof PopupAnnotation) {
  53984. (popupAnnotations ||= []).push(annotation);
  53985. continue;
  53986. }
  53987. sortedAnnotations.push(annotation);
  53988. }
  53989. if (widgetAnnotations) {
  53990. sortedAnnotations.push(...widgetAnnotations);
  53991. }
  53992. if (popupAnnotations) {
  53993. sortedAnnotations.push(...popupAnnotations);
  53994. }
  53995. return sortedAnnotations;
  53996. });
  53997. return shadow(this, "_parsedAnnotations", promise);
  53998. }
  53999. get jsActions() {
  54000. const actions = collectActions(this.xref, this.pageDict, PageActionEventType);
  54001. return shadow(this, "jsActions", actions);
  54002. }
  54003. }
  54004. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  54005. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  54006. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  54007. function find(stream, signature, limit = 1024, backwards = false) {
  54008. const signatureLength = signature.length;
  54009. const scanBytes = stream.peekBytes(limit);
  54010. const scanLength = scanBytes.length - signatureLength;
  54011. if (scanLength <= 0) {
  54012. return false;
  54013. }
  54014. if (backwards) {
  54015. const signatureEnd = signatureLength - 1;
  54016. let pos = scanBytes.length - 1;
  54017. while (pos >= signatureEnd) {
  54018. let j = 0;
  54019. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  54020. j++;
  54021. }
  54022. if (j >= signatureLength) {
  54023. stream.pos += pos - signatureEnd;
  54024. return true;
  54025. }
  54026. pos--;
  54027. }
  54028. } else {
  54029. let pos = 0;
  54030. while (pos <= scanLength) {
  54031. let j = 0;
  54032. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  54033. j++;
  54034. }
  54035. if (j >= signatureLength) {
  54036. stream.pos += pos;
  54037. return true;
  54038. }
  54039. pos++;
  54040. }
  54041. }
  54042. return false;
  54043. }
  54044. class PDFDocument {
  54045. constructor(pdfManager, stream) {
  54046. if (stream.length <= 0) {
  54047. throw new InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  54048. }
  54049. this.pdfManager = pdfManager;
  54050. this.stream = stream;
  54051. this.xref = new XRef(stream, pdfManager);
  54052. this._pagePromises = new Map();
  54053. this._version = null;
  54054. const idCounters = {
  54055. font: 0
  54056. };
  54057. this._globalIdFactory = class {
  54058. static getDocId() {
  54059. return `g_${pdfManager.docId}`;
  54060. }
  54061. static createFontId() {
  54062. return `f${++idCounters.font}`;
  54063. }
  54064. static createObjId() {
  54065. unreachable("Abstract method `createObjId` called.");
  54066. }
  54067. static getPageObjId() {
  54068. unreachable("Abstract method `getPageObjId` called.");
  54069. }
  54070. };
  54071. }
  54072. parse(recoveryMode) {
  54073. this.xref.parse(recoveryMode);
  54074. this.catalog = new Catalog(this.pdfManager, this.xref);
  54075. }
  54076. get linearization() {
  54077. let linearization = null;
  54078. try {
  54079. linearization = Linearization.create(this.stream);
  54080. } catch (err) {
  54081. if (err instanceof MissingDataException) {
  54082. throw err;
  54083. }
  54084. info(err);
  54085. }
  54086. return shadow(this, "linearization", linearization);
  54087. }
  54088. get startXRef() {
  54089. const stream = this.stream;
  54090. let startXRef = 0;
  54091. if (this.linearization) {
  54092. stream.reset();
  54093. if (find(stream, ENDOBJ_SIGNATURE)) {
  54094. stream.skip(6);
  54095. let ch = stream.peekByte();
  54096. while (isWhiteSpace(ch)) {
  54097. stream.pos++;
  54098. ch = stream.peekByte();
  54099. }
  54100. startXRef = stream.pos - stream.start;
  54101. }
  54102. } else {
  54103. const step = 1024;
  54104. const startXRefLength = STARTXREF_SIGNATURE.length;
  54105. let found = false,
  54106. pos = stream.end;
  54107. while (!found && pos > 0) {
  54108. pos -= step - startXRefLength;
  54109. if (pos < 0) {
  54110. pos = 0;
  54111. }
  54112. stream.pos = pos;
  54113. found = find(stream, STARTXREF_SIGNATURE, step, true);
  54114. }
  54115. if (found) {
  54116. stream.skip(9);
  54117. let ch;
  54118. do {
  54119. ch = stream.getByte();
  54120. } while (isWhiteSpace(ch));
  54121. let str = "";
  54122. while (ch >= 0x20 && ch <= 0x39) {
  54123. str += String.fromCharCode(ch);
  54124. ch = stream.getByte();
  54125. }
  54126. startXRef = parseInt(str, 10);
  54127. if (isNaN(startXRef)) {
  54128. startXRef = 0;
  54129. }
  54130. }
  54131. }
  54132. return shadow(this, "startXRef", startXRef);
  54133. }
  54134. checkHeader() {
  54135. const stream = this.stream;
  54136. stream.reset();
  54137. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  54138. return;
  54139. }
  54140. stream.moveStart();
  54141. stream.skip(PDF_HEADER_SIGNATURE.length);
  54142. let version = "",
  54143. ch;
  54144. while ((ch = stream.getByte()) > 0x20 && version.length < 7) {
  54145. version += String.fromCharCode(ch);
  54146. }
  54147. if (PDF_VERSION_REGEXP.test(version)) {
  54148. this._version = version;
  54149. } else {
  54150. warn(`Invalid PDF header version: ${version}`);
  54151. }
  54152. }
  54153. parseStartXRef() {
  54154. this.xref.setStartXRef(this.startXRef);
  54155. }
  54156. get numPages() {
  54157. let num = 0;
  54158. if (this.catalog.hasActualNumPages) {
  54159. num = this.catalog.numPages;
  54160. } else if (this.xfaFactory) {
  54161. num = this.xfaFactory.getNumPages();
  54162. } else if (this.linearization) {
  54163. num = this.linearization.numPages;
  54164. } else {
  54165. num = this.catalog.numPages;
  54166. }
  54167. return shadow(this, "numPages", num);
  54168. }
  54169. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  54170. const RECURSION_LIMIT = 10;
  54171. if (!Array.isArray(fields)) {
  54172. return false;
  54173. }
  54174. return fields.every(field => {
  54175. field = this.xref.fetchIfRef(field);
  54176. if (!(field instanceof Dict)) {
  54177. return false;
  54178. }
  54179. if (field.has("Kids")) {
  54180. if (++recursionDepth > RECURSION_LIMIT) {
  54181. warn("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  54182. return false;
  54183. }
  54184. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  54185. }
  54186. const isSignature = isName(field.get("FT"), "Sig");
  54187. const rectangle = field.get("Rect");
  54188. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  54189. return isSignature && isInvisible;
  54190. });
  54191. }
  54192. get _xfaStreams() {
  54193. const acroForm = this.catalog.acroForm;
  54194. if (!acroForm) {
  54195. return null;
  54196. }
  54197. const xfa = acroForm.get("XFA");
  54198. const entries = {
  54199. "xdp:xdp": "",
  54200. template: "",
  54201. datasets: "",
  54202. config: "",
  54203. connectionSet: "",
  54204. localeSet: "",
  54205. stylesheet: "",
  54206. "/xdp:xdp": ""
  54207. };
  54208. if (xfa instanceof BaseStream && !xfa.isEmpty) {
  54209. entries["xdp:xdp"] = xfa;
  54210. return entries;
  54211. }
  54212. if (!Array.isArray(xfa) || xfa.length === 0) {
  54213. return null;
  54214. }
  54215. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  54216. let name;
  54217. if (i === 0) {
  54218. name = "xdp:xdp";
  54219. } else if (i === ii - 2) {
  54220. name = "/xdp:xdp";
  54221. } else {
  54222. name = xfa[i];
  54223. }
  54224. if (!entries.hasOwnProperty(name)) {
  54225. continue;
  54226. }
  54227. const data = this.xref.fetchIfRef(xfa[i + 1]);
  54228. if (!(data instanceof BaseStream) || data.isEmpty) {
  54229. continue;
  54230. }
  54231. entries[name] = data;
  54232. }
  54233. return entries;
  54234. }
  54235. get xfaDatasets() {
  54236. const streams = this._xfaStreams;
  54237. if (!streams) {
  54238. return shadow(this, "xfaDatasets", null);
  54239. }
  54240. for (const key of ["datasets", "xdp:xdp"]) {
  54241. const stream = streams[key];
  54242. if (!stream) {
  54243. continue;
  54244. }
  54245. try {
  54246. const str = stringToUTF8String(stream.getString());
  54247. const data = {
  54248. [key]: str
  54249. };
  54250. return shadow(this, "xfaDatasets", new DatasetReader(data));
  54251. } catch {
  54252. warn("XFA - Invalid utf-8 string.");
  54253. break;
  54254. }
  54255. }
  54256. return shadow(this, "xfaDatasets", null);
  54257. }
  54258. get xfaData() {
  54259. const streams = this._xfaStreams;
  54260. if (!streams) {
  54261. return null;
  54262. }
  54263. const data = Object.create(null);
  54264. for (const [key, stream] of Object.entries(streams)) {
  54265. if (!stream) {
  54266. continue;
  54267. }
  54268. try {
  54269. data[key] = stringToUTF8String(stream.getString());
  54270. } catch {
  54271. warn("XFA - Invalid utf-8 string.");
  54272. return null;
  54273. }
  54274. }
  54275. return data;
  54276. }
  54277. get xfaFactory() {
  54278. let data;
  54279. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  54280. data = this.xfaData;
  54281. }
  54282. return shadow(this, "xfaFactory", data ? new XFAFactory(data) : null);
  54283. }
  54284. get isPureXfa() {
  54285. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  54286. }
  54287. get htmlForXfa() {
  54288. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  54289. }
  54290. async loadXfaImages() {
  54291. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  54292. if (!xfaImagesDict) {
  54293. return;
  54294. }
  54295. const keys = xfaImagesDict.getKeys();
  54296. const objectLoader = new ObjectLoader(xfaImagesDict, keys, this.xref);
  54297. await objectLoader.load();
  54298. const xfaImages = new Map();
  54299. for (const key of keys) {
  54300. const stream = xfaImagesDict.get(key);
  54301. if (stream instanceof BaseStream) {
  54302. xfaImages.set(key, stream.getBytes());
  54303. }
  54304. }
  54305. this.xfaFactory.setImages(xfaImages);
  54306. }
  54307. async loadXfaFonts(handler, task) {
  54308. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  54309. if (!acroForm) {
  54310. return;
  54311. }
  54312. const resources = await acroForm.getAsync("DR");
  54313. if (!(resources instanceof Dict)) {
  54314. return;
  54315. }
  54316. const objectLoader = new ObjectLoader(resources, ["Font"], this.xref);
  54317. await objectLoader.load();
  54318. const fontRes = resources.get("Font");
  54319. if (!(fontRes instanceof Dict)) {
  54320. return;
  54321. }
  54322. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  54323. options.useSystemFonts = false;
  54324. const partialEvaluator = new PartialEvaluator({
  54325. xref: this.xref,
  54326. handler,
  54327. pageIndex: -1,
  54328. idFactory: this._globalIdFactory,
  54329. fontCache: this.catalog.fontCache,
  54330. builtInCMapCache: this.catalog.builtInCMapCache,
  54331. standardFontDataCache: this.catalog.standardFontDataCache,
  54332. options
  54333. });
  54334. const operatorList = new OperatorList();
  54335. const pdfFonts = [];
  54336. const initialState = {
  54337. get font() {
  54338. return pdfFonts.at(-1);
  54339. },
  54340. set font(font) {
  54341. pdfFonts.push(font);
  54342. },
  54343. clone() {
  54344. return this;
  54345. }
  54346. };
  54347. const promises = [];
  54348. for (const [fontName, font] of fontRes) {
  54349. const descriptor = font.get("FontDescriptor");
  54350. if (!(descriptor instanceof Dict)) {
  54351. continue;
  54352. }
  54353. let fontFamily = descriptor.get("FontFamily");
  54354. fontFamily = fontFamily.replaceAll(/[ ]+(\d)/g, "$1");
  54355. const fontWeight = descriptor.get("FontWeight");
  54356. const italicAngle = -descriptor.get("ItalicAngle");
  54357. const cssFontInfo = {
  54358. fontFamily,
  54359. fontWeight,
  54360. italicAngle
  54361. };
  54362. if (!validateCSSFont(cssFontInfo)) {
  54363. continue;
  54364. }
  54365. promises.push(partialEvaluator.handleSetFont(resources, [Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  54366. warn(`loadXfaFonts: "${reason}".`);
  54367. return null;
  54368. }));
  54369. }
  54370. await Promise.all(promises);
  54371. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  54372. if (!missingFonts) {
  54373. return;
  54374. }
  54375. options.ignoreErrors = true;
  54376. promises.length = 0;
  54377. pdfFonts.length = 0;
  54378. const reallyMissingFonts = new Set();
  54379. for (const missing of missingFonts) {
  54380. if (!getXfaFontName(`${missing}-Regular`)) {
  54381. reallyMissingFonts.add(missing);
  54382. }
  54383. }
  54384. if (reallyMissingFonts.size) {
  54385. missingFonts.push("PdfJS-Fallback");
  54386. }
  54387. for (const missing of missingFonts) {
  54388. if (reallyMissingFonts.has(missing)) {
  54389. continue;
  54390. }
  54391. for (const fontInfo of [{
  54392. name: "Regular",
  54393. fontWeight: 400,
  54394. italicAngle: 0
  54395. }, {
  54396. name: "Bold",
  54397. fontWeight: 700,
  54398. italicAngle: 0
  54399. }, {
  54400. name: "Italic",
  54401. fontWeight: 400,
  54402. italicAngle: 12
  54403. }, {
  54404. name: "BoldItalic",
  54405. fontWeight: 700,
  54406. italicAngle: 12
  54407. }]) {
  54408. const name = `${missing}-${fontInfo.name}`;
  54409. const dict = getXfaFontDict(name);
  54410. promises.push(partialEvaluator.handleSetFont(resources, [Name.get(name), 1], null, operatorList, task, initialState, dict, {
  54411. fontFamily: missing,
  54412. fontWeight: fontInfo.fontWeight,
  54413. italicAngle: fontInfo.italicAngle
  54414. }).catch(function (reason) {
  54415. warn(`loadXfaFonts: "${reason}".`);
  54416. return null;
  54417. }));
  54418. }
  54419. }
  54420. await Promise.all(promises);
  54421. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  54422. }
  54423. async serializeXfaData(annotationStorage) {
  54424. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  54425. }
  54426. get version() {
  54427. return this.catalog.version || this._version;
  54428. }
  54429. get formInfo() {
  54430. const formInfo = {
  54431. hasFields: false,
  54432. hasAcroForm: false,
  54433. hasXfa: false,
  54434. hasSignatures: false
  54435. };
  54436. const acroForm = this.catalog.acroForm;
  54437. if (!acroForm) {
  54438. return shadow(this, "formInfo", formInfo);
  54439. }
  54440. try {
  54441. const fields = acroForm.get("Fields");
  54442. const hasFields = Array.isArray(fields) && fields.length > 0;
  54443. formInfo.hasFields = hasFields;
  54444. const xfa = acroForm.get("XFA");
  54445. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof BaseStream && !xfa.isEmpty;
  54446. const sigFlags = acroForm.get("SigFlags");
  54447. const hasSignatures = !!(sigFlags & 0x1);
  54448. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  54449. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  54450. formInfo.hasSignatures = hasSignatures;
  54451. } catch (ex) {
  54452. if (ex instanceof MissingDataException) {
  54453. throw ex;
  54454. }
  54455. warn(`Cannot fetch form information: "${ex}".`);
  54456. }
  54457. return shadow(this, "formInfo", formInfo);
  54458. }
  54459. get documentInfo() {
  54460. const docInfo = {
  54461. PDFFormatVersion: this.version,
  54462. Language: this.catalog.lang,
  54463. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  54464. IsLinearized: !!this.linearization,
  54465. IsAcroFormPresent: this.formInfo.hasAcroForm,
  54466. IsXFAPresent: this.formInfo.hasXfa,
  54467. IsCollectionPresent: !!this.catalog.collection,
  54468. IsSignaturesPresent: this.formInfo.hasSignatures
  54469. };
  54470. let infoDict;
  54471. try {
  54472. infoDict = this.xref.trailer.get("Info");
  54473. } catch (err) {
  54474. if (err instanceof MissingDataException) {
  54475. throw err;
  54476. }
  54477. info("The document information dictionary is invalid.");
  54478. }
  54479. if (!(infoDict instanceof Dict)) {
  54480. return shadow(this, "documentInfo", docInfo);
  54481. }
  54482. for (const key of infoDict.getKeys()) {
  54483. const value = infoDict.get(key);
  54484. switch (key) {
  54485. case "Title":
  54486. case "Author":
  54487. case "Subject":
  54488. case "Keywords":
  54489. case "Creator":
  54490. case "Producer":
  54491. case "CreationDate":
  54492. case "ModDate":
  54493. if (typeof value === "string") {
  54494. docInfo[key] = stringToPDFString(value);
  54495. continue;
  54496. }
  54497. break;
  54498. case "Trapped":
  54499. if (value instanceof Name) {
  54500. docInfo[key] = value;
  54501. continue;
  54502. }
  54503. break;
  54504. default:
  54505. let customValue;
  54506. switch (typeof value) {
  54507. case "string":
  54508. customValue = stringToPDFString(value);
  54509. break;
  54510. case "number":
  54511. case "boolean":
  54512. customValue = value;
  54513. break;
  54514. default:
  54515. if (value instanceof Name) {
  54516. customValue = value;
  54517. }
  54518. break;
  54519. }
  54520. if (customValue === undefined) {
  54521. warn(`Bad value, for custom key "${key}", in Info: ${value}.`);
  54522. continue;
  54523. }
  54524. if (!docInfo.Custom) {
  54525. docInfo.Custom = Object.create(null);
  54526. }
  54527. docInfo.Custom[key] = customValue;
  54528. continue;
  54529. }
  54530. warn(`Bad value, for key "${key}", in Info: ${value}.`);
  54531. }
  54532. return shadow(this, "documentInfo", docInfo);
  54533. }
  54534. get fingerprints() {
  54535. const FINGERPRINT_FIRST_BYTES = 1024;
  54536. const EMPTY_FINGERPRINT = "\x00".repeat(16);
  54537. function validate(data) {
  54538. return typeof data === "string" && data.length === 16 && data !== EMPTY_FINGERPRINT;
  54539. }
  54540. const id = this.xref.trailer.get("ID");
  54541. let hashOriginal, hashModified;
  54542. if (Array.isArray(id) && validate(id[0])) {
  54543. hashOriginal = stringToBytes(id[0]);
  54544. if (id[1] !== id[0] && validate(id[1])) {
  54545. hashModified = stringToBytes(id[1]);
  54546. }
  54547. } else {
  54548. hashOriginal = calculateMD5(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  54549. }
  54550. return shadow(this, "fingerprints", [toHexUtil(hashOriginal), hashModified ? toHexUtil(hashModified) : null]);
  54551. }
  54552. async _getLinearizationPage(pageIndex) {
  54553. const {
  54554. catalog,
  54555. linearization,
  54556. xref
  54557. } = this;
  54558. const ref = Ref.get(linearization.objectNumberFirst, 0);
  54559. try {
  54560. const obj = await xref.fetchAsync(ref);
  54561. if (obj instanceof Dict) {
  54562. let type = obj.getRaw("Type");
  54563. if (type instanceof Ref) {
  54564. type = await xref.fetchAsync(type);
  54565. }
  54566. if (isName(type, "Page") || !obj.has("Type") && !obj.has("Kids") && obj.has("Contents")) {
  54567. if (!catalog.pageKidsCountCache.has(ref)) {
  54568. catalog.pageKidsCountCache.put(ref, 1);
  54569. }
  54570. if (!catalog.pageIndexCache.has(ref)) {
  54571. catalog.pageIndexCache.put(ref, 0);
  54572. }
  54573. return [obj, ref];
  54574. }
  54575. }
  54576. throw new FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  54577. } catch (reason) {
  54578. warn(`_getLinearizationPage: "${reason.message}".`);
  54579. return catalog.getPageDict(pageIndex);
  54580. }
  54581. }
  54582. getPage(pageIndex) {
  54583. const cachedPromise = this._pagePromises.get(pageIndex);
  54584. if (cachedPromise) {
  54585. return cachedPromise;
  54586. }
  54587. const {
  54588. catalog,
  54589. linearization,
  54590. xfaFactory
  54591. } = this;
  54592. let promise;
  54593. if (xfaFactory) {
  54594. promise = Promise.resolve([Dict.empty, null]);
  54595. } else if (linearization?.pageFirst === pageIndex) {
  54596. promise = this._getLinearizationPage(pageIndex);
  54597. } else {
  54598. promise = catalog.getPageDict(pageIndex);
  54599. }
  54600. promise = promise.then(([pageDict, ref]) => {
  54601. return new Page({
  54602. pdfManager: this.pdfManager,
  54603. xref: this.xref,
  54604. pageIndex,
  54605. pageDict,
  54606. ref,
  54607. globalIdFactory: this._globalIdFactory,
  54608. fontCache: catalog.fontCache,
  54609. builtInCMapCache: catalog.builtInCMapCache,
  54610. standardFontDataCache: catalog.standardFontDataCache,
  54611. globalImageCache: catalog.globalImageCache,
  54612. systemFontCache: catalog.systemFontCache,
  54613. nonBlendModesSet: catalog.nonBlendModesSet,
  54614. xfaFactory
  54615. });
  54616. });
  54617. this._pagePromises.set(pageIndex, promise);
  54618. return promise;
  54619. }
  54620. async checkFirstPage(recoveryMode = false) {
  54621. if (recoveryMode) {
  54622. return;
  54623. }
  54624. try {
  54625. await this.getPage(0);
  54626. } catch (reason) {
  54627. if (reason instanceof XRefEntryException) {
  54628. this._pagePromises.delete(0);
  54629. await this.cleanup();
  54630. throw new XRefParseException();
  54631. }
  54632. }
  54633. }
  54634. async checkLastPage(recoveryMode = false) {
  54635. const {
  54636. catalog,
  54637. pdfManager
  54638. } = this;
  54639. catalog.setActualNumPages();
  54640. let numPages;
  54641. try {
  54642. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  54643. if (this.xfaFactory) {
  54644. return;
  54645. } else if (this.linearization) {
  54646. numPages = this.linearization.numPages;
  54647. } else {
  54648. numPages = catalog.numPages;
  54649. }
  54650. if (!Number.isInteger(numPages)) {
  54651. throw new FormatError("Page count is not an integer.");
  54652. } else if (numPages <= 1) {
  54653. return;
  54654. }
  54655. await this.getPage(numPages - 1);
  54656. } catch (reason) {
  54657. this._pagePromises.delete(numPages - 1);
  54658. await this.cleanup();
  54659. if (reason instanceof XRefEntryException && !recoveryMode) {
  54660. throw new XRefParseException();
  54661. }
  54662. warn(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  54663. let pagesTree;
  54664. try {
  54665. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  54666. } catch (reasonAll) {
  54667. if (reasonAll instanceof XRefEntryException && !recoveryMode) {
  54668. throw new XRefParseException();
  54669. }
  54670. catalog.setActualNumPages(1);
  54671. return;
  54672. }
  54673. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  54674. let promise;
  54675. if (pageDict instanceof Error) {
  54676. promise = Promise.reject(pageDict);
  54677. promise.catch(() => {});
  54678. } else {
  54679. promise = Promise.resolve(new Page({
  54680. pdfManager,
  54681. xref: this.xref,
  54682. pageIndex,
  54683. pageDict,
  54684. ref,
  54685. globalIdFactory: this._globalIdFactory,
  54686. fontCache: catalog.fontCache,
  54687. builtInCMapCache: catalog.builtInCMapCache,
  54688. standardFontDataCache: catalog.standardFontDataCache,
  54689. globalImageCache: catalog.globalImageCache,
  54690. systemFontCache: catalog.systemFontCache,
  54691. nonBlendModesSet: catalog.nonBlendModesSet,
  54692. xfaFactory: null
  54693. }));
  54694. }
  54695. this._pagePromises.set(pageIndex, promise);
  54696. }
  54697. catalog.setActualNumPages(pagesTree.size);
  54698. }
  54699. }
  54700. fontFallback(id, handler) {
  54701. return this.catalog.fontFallback(id, handler);
  54702. }
  54703. async cleanup(manuallyTriggered = false) {
  54704. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : clearGlobalCaches();
  54705. }
  54706. async #collectFieldObjects(name, parentRef, fieldRef, promises, annotationGlobals, visitedRefs, orphanFields) {
  54707. const {
  54708. xref
  54709. } = this;
  54710. if (!(fieldRef instanceof Ref) || visitedRefs.has(fieldRef)) {
  54711. return;
  54712. }
  54713. visitedRefs.put(fieldRef);
  54714. const field = await xref.fetchAsync(fieldRef);
  54715. if (!(field instanceof Dict)) {
  54716. return;
  54717. }
  54718. if (field.has("T")) {
  54719. const partName = stringToPDFString(await field.getAsync("T"));
  54720. name = name === "" ? partName : `${name}.${partName}`;
  54721. } else {
  54722. let obj = field;
  54723. while (true) {
  54724. obj = obj.getRaw("Parent") || parentRef;
  54725. if (obj instanceof Ref) {
  54726. if (visitedRefs.has(obj)) {
  54727. break;
  54728. }
  54729. obj = await xref.fetchAsync(obj);
  54730. }
  54731. if (!(obj instanceof Dict)) {
  54732. break;
  54733. }
  54734. if (obj.has("T")) {
  54735. const partName = stringToPDFString(await obj.getAsync("T"));
  54736. name = name === "" ? partName : `${name}.${partName}`;
  54737. break;
  54738. }
  54739. }
  54740. }
  54741. if (parentRef && !field.has("Parent") && isName(field.get("Subtype"), "Widget")) {
  54742. orphanFields.put(fieldRef, parentRef);
  54743. }
  54744. if (!promises.has(name)) {
  54745. promises.set(name, []);
  54746. }
  54747. promises.get(name).push(AnnotationFactory.create(xref, fieldRef, annotationGlobals, null, true, orphanFields, null).then(annotation => annotation?.getFieldObject()).catch(function (reason) {
  54748. warn(`#collectFieldObjects: "${reason}".`);
  54749. return null;
  54750. }));
  54751. if (!field.has("Kids")) {
  54752. return;
  54753. }
  54754. const kids = await field.getAsync("Kids");
  54755. if (Array.isArray(kids)) {
  54756. for (const kid of kids) {
  54757. await this.#collectFieldObjects(name, fieldRef, kid, promises, annotationGlobals, visitedRefs, orphanFields);
  54758. }
  54759. }
  54760. }
  54761. get fieldObjects() {
  54762. const promise = this.pdfManager.ensureDoc("formInfo").then(async formInfo => {
  54763. if (!formInfo.hasFields) {
  54764. return null;
  54765. }
  54766. const [annotationGlobals, acroForm] = await Promise.all([this.pdfManager.ensureDoc("annotationGlobals"), this.pdfManager.ensureCatalog("acroForm")]);
  54767. if (!annotationGlobals) {
  54768. return null;
  54769. }
  54770. const visitedRefs = new RefSet();
  54771. const allFields = Object.create(null);
  54772. const fieldPromises = new Map();
  54773. const orphanFields = new RefSetCache();
  54774. for (const fieldRef of await acroForm.getAsync("Fields")) {
  54775. await this.#collectFieldObjects("", null, fieldRef, fieldPromises, annotationGlobals, visitedRefs, orphanFields);
  54776. }
  54777. const allPromises = [];
  54778. for (const [name, promises] of fieldPromises) {
  54779. allPromises.push(Promise.all(promises).then(fields => {
  54780. fields = fields.filter(field => !!field);
  54781. if (fields.length > 0) {
  54782. allFields[name] = fields;
  54783. }
  54784. }));
  54785. }
  54786. await Promise.all(allPromises);
  54787. return {
  54788. allFields,
  54789. orphanFields
  54790. };
  54791. });
  54792. return shadow(this, "fieldObjects", promise);
  54793. }
  54794. get hasJSActions() {
  54795. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  54796. return shadow(this, "hasJSActions", promise);
  54797. }
  54798. async _parseHasJSActions() {
  54799. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  54800. if (catalogJsActions) {
  54801. return true;
  54802. }
  54803. if (fieldObjects) {
  54804. return Object.values(fieldObjects.allFields).some(fieldObject => fieldObject.some(object => object.actions !== null));
  54805. }
  54806. return false;
  54807. }
  54808. get calculationOrderIds() {
  54809. const calculationOrder = this.catalog.acroForm?.get("CO");
  54810. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  54811. return shadow(this, "calculationOrderIds", null);
  54812. }
  54813. const ids = [];
  54814. for (const id of calculationOrder) {
  54815. if (id instanceof Ref) {
  54816. ids.push(id.toString());
  54817. }
  54818. }
  54819. return shadow(this, "calculationOrderIds", ids.length ? ids : null);
  54820. }
  54821. get annotationGlobals() {
  54822. return shadow(this, "annotationGlobals", AnnotationFactory.createGlobals(this.pdfManager));
  54823. }
  54824. }
  54825. ;// ./src/core/pdf_manager.js
  54826. function parseDocBaseUrl(url) {
  54827. if (url) {
  54828. const absoluteUrl = createValidAbsoluteUrl(url);
  54829. if (absoluteUrl) {
  54830. return absoluteUrl.href;
  54831. }
  54832. warn(`Invalid absolute docBaseUrl: "${url}".`);
  54833. }
  54834. return null;
  54835. }
  54836. class BasePdfManager {
  54837. constructor(args) {
  54838. this._docBaseUrl = parseDocBaseUrl(args.docBaseUrl);
  54839. this._docId = args.docId;
  54840. this._password = args.password;
  54841. this.enableXfa = args.enableXfa;
  54842. args.evaluatorOptions.isOffscreenCanvasSupported &&= FeatureTest.isOffscreenCanvasSupported;
  54843. args.evaluatorOptions.isImageDecoderSupported &&= FeatureTest.isImageDecoderSupported;
  54844. this.evaluatorOptions = Object.freeze(args.evaluatorOptions);
  54845. }
  54846. get docId() {
  54847. return this._docId;
  54848. }
  54849. get password() {
  54850. return this._password;
  54851. }
  54852. get docBaseUrl() {
  54853. return this._docBaseUrl;
  54854. }
  54855. get catalog() {
  54856. return this.pdfDocument.catalog;
  54857. }
  54858. ensureDoc(prop, args) {
  54859. return this.ensure(this.pdfDocument, prop, args);
  54860. }
  54861. ensureXRef(prop, args) {
  54862. return this.ensure(this.pdfDocument.xref, prop, args);
  54863. }
  54864. ensureCatalog(prop, args) {
  54865. return this.ensure(this.pdfDocument.catalog, prop, args);
  54866. }
  54867. getPage(pageIndex) {
  54868. return this.pdfDocument.getPage(pageIndex);
  54869. }
  54870. fontFallback(id, handler) {
  54871. return this.pdfDocument.fontFallback(id, handler);
  54872. }
  54873. loadXfaFonts(handler, task) {
  54874. return this.pdfDocument.loadXfaFonts(handler, task);
  54875. }
  54876. loadXfaImages() {
  54877. return this.pdfDocument.loadXfaImages();
  54878. }
  54879. serializeXfaData(annotationStorage) {
  54880. return this.pdfDocument.serializeXfaData(annotationStorage);
  54881. }
  54882. cleanup(manuallyTriggered = false) {
  54883. return this.pdfDocument.cleanup(manuallyTriggered);
  54884. }
  54885. async ensure(obj, prop, args) {
  54886. unreachable("Abstract method `ensure` called");
  54887. }
  54888. requestRange(begin, end) {
  54889. unreachable("Abstract method `requestRange` called");
  54890. }
  54891. requestLoadedStream(noFetch = false) {
  54892. unreachable("Abstract method `requestLoadedStream` called");
  54893. }
  54894. sendProgressiveData(chunk) {
  54895. unreachable("Abstract method `sendProgressiveData` called");
  54896. }
  54897. updatePassword(password) {
  54898. this._password = password;
  54899. }
  54900. terminate(reason) {
  54901. unreachable("Abstract method `terminate` called");
  54902. }
  54903. }
  54904. class LocalPdfManager extends BasePdfManager {
  54905. constructor(args) {
  54906. super(args);
  54907. const stream = new Stream(args.source);
  54908. this.pdfDocument = new PDFDocument(this, stream);
  54909. this._loadedStreamPromise = Promise.resolve(stream);
  54910. }
  54911. async ensure(obj, prop, args) {
  54912. const value = obj[prop];
  54913. if (typeof value === "function") {
  54914. return value.apply(obj, args);
  54915. }
  54916. return value;
  54917. }
  54918. requestRange(begin, end) {
  54919. return Promise.resolve();
  54920. }
  54921. requestLoadedStream(noFetch = false) {
  54922. return this._loadedStreamPromise;
  54923. }
  54924. terminate(reason) {}
  54925. }
  54926. class NetworkPdfManager extends BasePdfManager {
  54927. constructor(args) {
  54928. super(args);
  54929. this.streamManager = new ChunkedStreamManager(args.source, {
  54930. msgHandler: args.handler,
  54931. length: args.length,
  54932. disableAutoFetch: args.disableAutoFetch,
  54933. rangeChunkSize: args.rangeChunkSize
  54934. });
  54935. this.pdfDocument = new PDFDocument(this, this.streamManager.getStream());
  54936. }
  54937. async ensure(obj, prop, args) {
  54938. try {
  54939. const value = obj[prop];
  54940. if (typeof value === "function") {
  54941. return value.apply(obj, args);
  54942. }
  54943. return value;
  54944. } catch (ex) {
  54945. if (!(ex instanceof MissingDataException)) {
  54946. throw ex;
  54947. }
  54948. await this.requestRange(ex.begin, ex.end);
  54949. return this.ensure(obj, prop, args);
  54950. }
  54951. }
  54952. requestRange(begin, end) {
  54953. return this.streamManager.requestRange(begin, end);
  54954. }
  54955. requestLoadedStream(noFetch = false) {
  54956. return this.streamManager.requestAllChunks(noFetch);
  54957. }
  54958. sendProgressiveData(chunk) {
  54959. this.streamManager.onReceiveData({
  54960. chunk
  54961. });
  54962. }
  54963. terminate(reason) {
  54964. this.streamManager.abort(reason);
  54965. }
  54966. }
  54967. ;// ./src/shared/message_handler.js
  54968. const CallbackKind = {
  54969. DATA: 1,
  54970. ERROR: 2
  54971. };
  54972. const StreamKind = {
  54973. CANCEL: 1,
  54974. CANCEL_COMPLETE: 2,
  54975. CLOSE: 3,
  54976. ENQUEUE: 4,
  54977. ERROR: 5,
  54978. PULL: 6,
  54979. PULL_COMPLETE: 7,
  54980. START_COMPLETE: 8
  54981. };
  54982. function onFn() {}
  54983. function wrapReason(ex) {
  54984. if (ex instanceof AbortException || ex instanceof InvalidPDFException || ex instanceof MissingPDFException || ex instanceof PasswordException || ex instanceof UnexpectedResponseException || ex instanceof UnknownErrorException) {
  54985. return ex;
  54986. }
  54987. if (!(ex instanceof Error || typeof ex === "object" && ex !== null)) {
  54988. unreachable('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  54989. }
  54990. switch (ex.name) {
  54991. case "AbortException":
  54992. return new AbortException(ex.message);
  54993. case "InvalidPDFException":
  54994. return new InvalidPDFException(ex.message);
  54995. case "MissingPDFException":
  54996. return new MissingPDFException(ex.message);
  54997. case "PasswordException":
  54998. return new PasswordException(ex.message, ex.code);
  54999. case "UnexpectedResponseException":
  55000. return new UnexpectedResponseException(ex.message, ex.status);
  55001. case "UnknownErrorException":
  55002. return new UnknownErrorException(ex.message, ex.details);
  55003. }
  55004. return new UnknownErrorException(ex.message, ex.toString());
  55005. }
  55006. class MessageHandler {
  55007. #messageAC = new AbortController();
  55008. constructor(sourceName, targetName, comObj) {
  55009. this.sourceName = sourceName;
  55010. this.targetName = targetName;
  55011. this.comObj = comObj;
  55012. this.callbackId = 1;
  55013. this.streamId = 1;
  55014. this.streamSinks = Object.create(null);
  55015. this.streamControllers = Object.create(null);
  55016. this.callbackCapabilities = Object.create(null);
  55017. this.actionHandler = Object.create(null);
  55018. comObj.addEventListener("message", this.#onMessage.bind(this), {
  55019. signal: this.#messageAC.signal
  55020. });
  55021. }
  55022. #onMessage({
  55023. data
  55024. }) {
  55025. if (data.targetName !== this.sourceName) {
  55026. return;
  55027. }
  55028. if (data.stream) {
  55029. this.#processStreamMessage(data);
  55030. return;
  55031. }
  55032. if (data.callback) {
  55033. const callbackId = data.callbackId;
  55034. const capability = this.callbackCapabilities[callbackId];
  55035. if (!capability) {
  55036. throw new Error(`Cannot resolve callback ${callbackId}`);
  55037. }
  55038. delete this.callbackCapabilities[callbackId];
  55039. if (data.callback === CallbackKind.DATA) {
  55040. capability.resolve(data.data);
  55041. } else if (data.callback === CallbackKind.ERROR) {
  55042. capability.reject(wrapReason(data.reason));
  55043. } else {
  55044. throw new Error("Unexpected callback case");
  55045. }
  55046. return;
  55047. }
  55048. const action = this.actionHandler[data.action];
  55049. if (!action) {
  55050. throw new Error(`Unknown action from worker: ${data.action}`);
  55051. }
  55052. if (data.callbackId) {
  55053. const sourceName = this.sourceName,
  55054. targetName = data.sourceName,
  55055. comObj = this.comObj;
  55056. Promise.try(action, data.data).then(function (result) {
  55057. comObj.postMessage({
  55058. sourceName,
  55059. targetName,
  55060. callback: CallbackKind.DATA,
  55061. callbackId: data.callbackId,
  55062. data: result
  55063. });
  55064. }, function (reason) {
  55065. comObj.postMessage({
  55066. sourceName,
  55067. targetName,
  55068. callback: CallbackKind.ERROR,
  55069. callbackId: data.callbackId,
  55070. reason: wrapReason(reason)
  55071. });
  55072. });
  55073. return;
  55074. }
  55075. if (data.streamId) {
  55076. this.#createStreamSink(data);
  55077. return;
  55078. }
  55079. action(data.data);
  55080. }
  55081. on(actionName, handler) {
  55082. const ah = this.actionHandler;
  55083. if (ah[actionName]) {
  55084. throw new Error(`There is already an actionName called "${actionName}"`);
  55085. }
  55086. ah[actionName] = handler;
  55087. }
  55088. send(actionName, data, transfers) {
  55089. this.comObj.postMessage({
  55090. sourceName: this.sourceName,
  55091. targetName: this.targetName,
  55092. action: actionName,
  55093. data
  55094. }, transfers);
  55095. }
  55096. sendWithPromise(actionName, data, transfers) {
  55097. const callbackId = this.callbackId++;
  55098. const capability = Promise.withResolvers();
  55099. this.callbackCapabilities[callbackId] = capability;
  55100. try {
  55101. this.comObj.postMessage({
  55102. sourceName: this.sourceName,
  55103. targetName: this.targetName,
  55104. action: actionName,
  55105. callbackId,
  55106. data
  55107. }, transfers);
  55108. } catch (ex) {
  55109. capability.reject(ex);
  55110. }
  55111. return capability.promise;
  55112. }
  55113. sendWithStream(actionName, data, queueingStrategy, transfers) {
  55114. const streamId = this.streamId++,
  55115. sourceName = this.sourceName,
  55116. targetName = this.targetName,
  55117. comObj = this.comObj;
  55118. return new ReadableStream({
  55119. start: controller => {
  55120. const startCapability = Promise.withResolvers();
  55121. this.streamControllers[streamId] = {
  55122. controller,
  55123. startCall: startCapability,
  55124. pullCall: null,
  55125. cancelCall: null,
  55126. isClosed: false
  55127. };
  55128. comObj.postMessage({
  55129. sourceName,
  55130. targetName,
  55131. action: actionName,
  55132. streamId,
  55133. data,
  55134. desiredSize: controller.desiredSize
  55135. }, transfers);
  55136. return startCapability.promise;
  55137. },
  55138. pull: controller => {
  55139. const pullCapability = Promise.withResolvers();
  55140. this.streamControllers[streamId].pullCall = pullCapability;
  55141. comObj.postMessage({
  55142. sourceName,
  55143. targetName,
  55144. stream: StreamKind.PULL,
  55145. streamId,
  55146. desiredSize: controller.desiredSize
  55147. });
  55148. return pullCapability.promise;
  55149. },
  55150. cancel: reason => {
  55151. assert(reason instanceof Error, "cancel must have a valid reason");
  55152. const cancelCapability = Promise.withResolvers();
  55153. this.streamControllers[streamId].cancelCall = cancelCapability;
  55154. this.streamControllers[streamId].isClosed = true;
  55155. comObj.postMessage({
  55156. sourceName,
  55157. targetName,
  55158. stream: StreamKind.CANCEL,
  55159. streamId,
  55160. reason: wrapReason(reason)
  55161. });
  55162. return cancelCapability.promise;
  55163. }
  55164. }, queueingStrategy);
  55165. }
  55166. #createStreamSink(data) {
  55167. const streamId = data.streamId,
  55168. sourceName = this.sourceName,
  55169. targetName = data.sourceName,
  55170. comObj = this.comObj;
  55171. const self = this,
  55172. action = this.actionHandler[data.action];
  55173. const streamSink = {
  55174. enqueue(chunk, size = 1, transfers) {
  55175. if (this.isCancelled) {
  55176. return;
  55177. }
  55178. const lastDesiredSize = this.desiredSize;
  55179. this.desiredSize -= size;
  55180. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  55181. this.sinkCapability = Promise.withResolvers();
  55182. this.ready = this.sinkCapability.promise;
  55183. }
  55184. comObj.postMessage({
  55185. sourceName,
  55186. targetName,
  55187. stream: StreamKind.ENQUEUE,
  55188. streamId,
  55189. chunk
  55190. }, transfers);
  55191. },
  55192. close() {
  55193. if (this.isCancelled) {
  55194. return;
  55195. }
  55196. this.isCancelled = true;
  55197. comObj.postMessage({
  55198. sourceName,
  55199. targetName,
  55200. stream: StreamKind.CLOSE,
  55201. streamId
  55202. });
  55203. delete self.streamSinks[streamId];
  55204. },
  55205. error(reason) {
  55206. assert(reason instanceof Error, "error must have a valid reason");
  55207. if (this.isCancelled) {
  55208. return;
  55209. }
  55210. this.isCancelled = true;
  55211. comObj.postMessage({
  55212. sourceName,
  55213. targetName,
  55214. stream: StreamKind.ERROR,
  55215. streamId,
  55216. reason: wrapReason(reason)
  55217. });
  55218. },
  55219. sinkCapability: Promise.withResolvers(),
  55220. onPull: null,
  55221. onCancel: null,
  55222. isCancelled: false,
  55223. desiredSize: data.desiredSize,
  55224. ready: null
  55225. };
  55226. streamSink.sinkCapability.resolve();
  55227. streamSink.ready = streamSink.sinkCapability.promise;
  55228. this.streamSinks[streamId] = streamSink;
  55229. Promise.try(action, data.data, streamSink).then(function () {
  55230. comObj.postMessage({
  55231. sourceName,
  55232. targetName,
  55233. stream: StreamKind.START_COMPLETE,
  55234. streamId,
  55235. success: true
  55236. });
  55237. }, function (reason) {
  55238. comObj.postMessage({
  55239. sourceName,
  55240. targetName,
  55241. stream: StreamKind.START_COMPLETE,
  55242. streamId,
  55243. reason: wrapReason(reason)
  55244. });
  55245. });
  55246. }
  55247. #processStreamMessage(data) {
  55248. const streamId = data.streamId,
  55249. sourceName = this.sourceName,
  55250. targetName = data.sourceName,
  55251. comObj = this.comObj;
  55252. const streamController = this.streamControllers[streamId],
  55253. streamSink = this.streamSinks[streamId];
  55254. switch (data.stream) {
  55255. case StreamKind.START_COMPLETE:
  55256. if (data.success) {
  55257. streamController.startCall.resolve();
  55258. } else {
  55259. streamController.startCall.reject(wrapReason(data.reason));
  55260. }
  55261. break;
  55262. case StreamKind.PULL_COMPLETE:
  55263. if (data.success) {
  55264. streamController.pullCall.resolve();
  55265. } else {
  55266. streamController.pullCall.reject(wrapReason(data.reason));
  55267. }
  55268. break;
  55269. case StreamKind.PULL:
  55270. if (!streamSink) {
  55271. comObj.postMessage({
  55272. sourceName,
  55273. targetName,
  55274. stream: StreamKind.PULL_COMPLETE,
  55275. streamId,
  55276. success: true
  55277. });
  55278. break;
  55279. }
  55280. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  55281. streamSink.sinkCapability.resolve();
  55282. }
  55283. streamSink.desiredSize = data.desiredSize;
  55284. Promise.try(streamSink.onPull || onFn).then(function () {
  55285. comObj.postMessage({
  55286. sourceName,
  55287. targetName,
  55288. stream: StreamKind.PULL_COMPLETE,
  55289. streamId,
  55290. success: true
  55291. });
  55292. }, function (reason) {
  55293. comObj.postMessage({
  55294. sourceName,
  55295. targetName,
  55296. stream: StreamKind.PULL_COMPLETE,
  55297. streamId,
  55298. reason: wrapReason(reason)
  55299. });
  55300. });
  55301. break;
  55302. case StreamKind.ENQUEUE:
  55303. assert(streamController, "enqueue should have stream controller");
  55304. if (streamController.isClosed) {
  55305. break;
  55306. }
  55307. streamController.controller.enqueue(data.chunk);
  55308. break;
  55309. case StreamKind.CLOSE:
  55310. assert(streamController, "close should have stream controller");
  55311. if (streamController.isClosed) {
  55312. break;
  55313. }
  55314. streamController.isClosed = true;
  55315. streamController.controller.close();
  55316. this.#deleteStreamController(streamController, streamId);
  55317. break;
  55318. case StreamKind.ERROR:
  55319. assert(streamController, "error should have stream controller");
  55320. streamController.controller.error(wrapReason(data.reason));
  55321. this.#deleteStreamController(streamController, streamId);
  55322. break;
  55323. case StreamKind.CANCEL_COMPLETE:
  55324. if (data.success) {
  55325. streamController.cancelCall.resolve();
  55326. } else {
  55327. streamController.cancelCall.reject(wrapReason(data.reason));
  55328. }
  55329. this.#deleteStreamController(streamController, streamId);
  55330. break;
  55331. case StreamKind.CANCEL:
  55332. if (!streamSink) {
  55333. break;
  55334. }
  55335. const dataReason = wrapReason(data.reason);
  55336. Promise.try(streamSink.onCancel || onFn, dataReason).then(function () {
  55337. comObj.postMessage({
  55338. sourceName,
  55339. targetName,
  55340. stream: StreamKind.CANCEL_COMPLETE,
  55341. streamId,
  55342. success: true
  55343. });
  55344. }, function (reason) {
  55345. comObj.postMessage({
  55346. sourceName,
  55347. targetName,
  55348. stream: StreamKind.CANCEL_COMPLETE,
  55349. streamId,
  55350. reason: wrapReason(reason)
  55351. });
  55352. });
  55353. streamSink.sinkCapability.reject(dataReason);
  55354. streamSink.isCancelled = true;
  55355. delete this.streamSinks[streamId];
  55356. break;
  55357. default:
  55358. throw new Error("Unexpected stream case");
  55359. }
  55360. }
  55361. async #deleteStreamController(streamController, streamId) {
  55362. await Promise.allSettled([streamController.startCall?.promise, streamController.pullCall?.promise, streamController.cancelCall?.promise]);
  55363. delete this.streamControllers[streamId];
  55364. }
  55365. destroy() {
  55366. this.#messageAC?.abort();
  55367. this.#messageAC = null;
  55368. }
  55369. }
  55370. ;// ./src/core/writer.js
  55371. async function writeObject(ref, obj, buffer, {
  55372. encrypt = null
  55373. }) {
  55374. const transform = encrypt?.createCipherTransform(ref.num, ref.gen);
  55375. buffer.push(`${ref.num} ${ref.gen} obj\n`);
  55376. if (obj instanceof Dict) {
  55377. await writeDict(obj, buffer, transform);
  55378. } else if (obj instanceof BaseStream) {
  55379. await writeStream(obj, buffer, transform);
  55380. } else if (Array.isArray(obj) || ArrayBuffer.isView(obj)) {
  55381. await writeArray(obj, buffer, transform);
  55382. }
  55383. buffer.push("\nendobj\n");
  55384. }
  55385. async function writeDict(dict, buffer, transform) {
  55386. buffer.push("<<");
  55387. for (const key of dict.getKeys()) {
  55388. buffer.push(` /${escapePDFName(key)} `);
  55389. await writeValue(dict.getRaw(key), buffer, transform);
  55390. }
  55391. buffer.push(">>");
  55392. }
  55393. async function writeStream(stream, buffer, transform) {
  55394. let bytes = stream.getBytes();
  55395. const {
  55396. dict
  55397. } = stream;
  55398. const [filter, params] = await Promise.all([dict.getAsync("Filter"), dict.getAsync("DecodeParms")]);
  55399. const filterZero = Array.isArray(filter) ? await dict.xref.fetchIfRefAsync(filter[0]) : filter;
  55400. const isFilterZeroFlateDecode = isName(filterZero, "FlateDecode");
  55401. const MIN_LENGTH_FOR_COMPRESSING = 256;
  55402. if (bytes.length >= MIN_LENGTH_FOR_COMPRESSING || isFilterZeroFlateDecode) {
  55403. try {
  55404. const cs = new CompressionStream("deflate");
  55405. const writer = cs.writable.getWriter();
  55406. await writer.ready;
  55407. writer.write(bytes).then(async () => {
  55408. await writer.ready;
  55409. await writer.close();
  55410. }).catch(() => {});
  55411. const buf = await new Response(cs.readable).arrayBuffer();
  55412. bytes = new Uint8Array(buf);
  55413. let newFilter, newParams;
  55414. if (!filter) {
  55415. newFilter = Name.get("FlateDecode");
  55416. } else if (!isFilterZeroFlateDecode) {
  55417. newFilter = Array.isArray(filter) ? [Name.get("FlateDecode"), ...filter] : [Name.get("FlateDecode"), filter];
  55418. if (params) {
  55419. newParams = Array.isArray(params) ? [null, ...params] : [null, params];
  55420. }
  55421. }
  55422. if (newFilter) {
  55423. dict.set("Filter", newFilter);
  55424. }
  55425. if (newParams) {
  55426. dict.set("DecodeParms", newParams);
  55427. }
  55428. } catch (ex) {
  55429. info(`writeStream - cannot compress data: "${ex}".`);
  55430. }
  55431. }
  55432. let string = bytesToString(bytes);
  55433. if (transform) {
  55434. string = transform.encryptString(string);
  55435. }
  55436. dict.set("Length", string.length);
  55437. await writeDict(dict, buffer, transform);
  55438. buffer.push(" stream\n", string, "\nendstream");
  55439. }
  55440. async function writeArray(array, buffer, transform) {
  55441. buffer.push("[");
  55442. let first = true;
  55443. for (const val of array) {
  55444. if (!first) {
  55445. buffer.push(" ");
  55446. } else {
  55447. first = false;
  55448. }
  55449. await writeValue(val, buffer, transform);
  55450. }
  55451. buffer.push("]");
  55452. }
  55453. async function writeValue(value, buffer, transform) {
  55454. if (value instanceof Name) {
  55455. buffer.push(`/${escapePDFName(value.name)}`);
  55456. } else if (value instanceof Ref) {
  55457. buffer.push(`${value.num} ${value.gen} R`);
  55458. } else if (Array.isArray(value) || ArrayBuffer.isView(value)) {
  55459. await writeArray(value, buffer, transform);
  55460. } else if (typeof value === "string") {
  55461. if (transform) {
  55462. value = transform.encryptString(value);
  55463. }
  55464. buffer.push(`(${escapeString(value)})`);
  55465. } else if (typeof value === "number") {
  55466. buffer.push(numberToString(value));
  55467. } else if (typeof value === "boolean") {
  55468. buffer.push(value.toString());
  55469. } else if (value instanceof Dict) {
  55470. await writeDict(value, buffer, transform);
  55471. } else if (value instanceof BaseStream) {
  55472. await writeStream(value, buffer, transform);
  55473. } else if (value === null) {
  55474. buffer.push("null");
  55475. } else {
  55476. warn(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  55477. }
  55478. }
  55479. function writeInt(number, size, offset, buffer) {
  55480. for (let i = size + offset - 1; i > offset - 1; i--) {
  55481. buffer[i] = number & 0xff;
  55482. number >>= 8;
  55483. }
  55484. return offset + size;
  55485. }
  55486. function writeString(string, offset, buffer) {
  55487. for (let i = 0, len = string.length; i < len; i++) {
  55488. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  55489. }
  55490. }
  55491. function computeMD5(filesize, xrefInfo) {
  55492. const time = Math.floor(Date.now() / 1000);
  55493. const filename = xrefInfo.filename || "";
  55494. const md5Buffer = [time.toString(), filename, filesize.toString()];
  55495. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  55496. for (const value of Object.values(xrefInfo.info)) {
  55497. md5Buffer.push(value);
  55498. md5BufferLen += value.length;
  55499. }
  55500. const array = new Uint8Array(md5BufferLen);
  55501. let offset = 0;
  55502. for (const str of md5Buffer) {
  55503. writeString(str, offset, array);
  55504. offset += str.length;
  55505. }
  55506. return bytesToString(calculateMD5(array));
  55507. }
  55508. function writeXFADataForAcroform(str, changes) {
  55509. const xml = new SimpleXMLParser({
  55510. hasAttributes: true
  55511. }).parseFromString(str);
  55512. for (const {
  55513. xfa
  55514. } of changes) {
  55515. if (!xfa) {
  55516. continue;
  55517. }
  55518. const {
  55519. path,
  55520. value
  55521. } = xfa;
  55522. if (!path) {
  55523. continue;
  55524. }
  55525. const nodePath = parseXFAPath(path);
  55526. let node = xml.documentElement.searchNode(nodePath, 0);
  55527. if (!node && nodePath.length > 1) {
  55528. node = xml.documentElement.searchNode([nodePath.at(-1)], 0);
  55529. }
  55530. if (node) {
  55531. node.childNodes = Array.isArray(value) ? value.map(val => new SimpleDOMNode("value", val)) : [new SimpleDOMNode("#text", value)];
  55532. } else {
  55533. warn(`Node not found for path: ${path}`);
  55534. }
  55535. }
  55536. const buffer = [];
  55537. xml.documentElement.dump(buffer);
  55538. return buffer.join("");
  55539. }
  55540. async function updateAcroform({
  55541. xref,
  55542. acroForm,
  55543. acroFormRef,
  55544. hasXfa,
  55545. hasXfaDatasetsEntry,
  55546. xfaDatasetsRef,
  55547. needAppearances,
  55548. changes
  55549. }) {
  55550. if (hasXfa && !hasXfaDatasetsEntry && !xfaDatasetsRef) {
  55551. warn("XFA - Cannot save it");
  55552. }
  55553. if (!needAppearances && (!hasXfa || !xfaDatasetsRef || hasXfaDatasetsEntry)) {
  55554. return;
  55555. }
  55556. const dict = acroForm.clone();
  55557. if (hasXfa && !hasXfaDatasetsEntry) {
  55558. const newXfa = acroForm.get("XFA").slice();
  55559. newXfa.splice(2, 0, "datasets");
  55560. newXfa.splice(3, 0, xfaDatasetsRef);
  55561. dict.set("XFA", newXfa);
  55562. }
  55563. if (needAppearances) {
  55564. dict.set("NeedAppearances", true);
  55565. }
  55566. changes.put(acroFormRef, {
  55567. data: dict
  55568. });
  55569. }
  55570. function updateXFA({
  55571. xfaData,
  55572. xfaDatasetsRef,
  55573. changes,
  55574. xref
  55575. }) {
  55576. if (xfaData === null) {
  55577. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  55578. xfaData = writeXFADataForAcroform(datasets.getString(), changes);
  55579. }
  55580. const xfaDataStream = new StringStream(xfaData);
  55581. xfaDataStream.dict = new Dict(xref);
  55582. xfaDataStream.dict.set("Type", Name.get("EmbeddedFile"));
  55583. changes.put(xfaDatasetsRef, {
  55584. data: xfaDataStream
  55585. });
  55586. }
  55587. async function getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer) {
  55588. buffer.push("xref\n");
  55589. const indexes = getIndexes(newRefs);
  55590. let indexesPosition = 0;
  55591. for (const {
  55592. ref,
  55593. data
  55594. } of newRefs) {
  55595. if (ref.num === indexes[indexesPosition]) {
  55596. buffer.push(`${indexes[indexesPosition]} ${indexes[indexesPosition + 1]}\n`);
  55597. indexesPosition += 2;
  55598. }
  55599. if (data !== null) {
  55600. buffer.push(`${baseOffset.toString().padStart(10, "0")} ${Math.min(ref.gen, 0xffff).toString().padStart(5, "0")} n\r\n`);
  55601. baseOffset += data.length;
  55602. } else {
  55603. buffer.push(`0000000000 ${Math.min(ref.gen + 1, 0xffff).toString().padStart(5, "0")} f\r\n`);
  55604. }
  55605. }
  55606. computeIDs(baseOffset, xrefInfo, newXref);
  55607. buffer.push("trailer\n");
  55608. await writeDict(newXref, buffer);
  55609. buffer.push("\nstartxref\n", baseOffset.toString(), "\n%%EOF\n");
  55610. }
  55611. function getIndexes(newRefs) {
  55612. const indexes = [];
  55613. for (const {
  55614. ref
  55615. } of newRefs) {
  55616. if (ref.num === indexes.at(-2) + indexes.at(-1)) {
  55617. indexes[indexes.length - 1] += 1;
  55618. } else {
  55619. indexes.push(ref.num, 1);
  55620. }
  55621. }
  55622. return indexes;
  55623. }
  55624. async function getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) {
  55625. const xrefTableData = [];
  55626. let maxOffset = 0;
  55627. let maxGen = 0;
  55628. for (const {
  55629. ref,
  55630. data
  55631. } of newRefs) {
  55632. let gen;
  55633. maxOffset = Math.max(maxOffset, baseOffset);
  55634. if (data !== null) {
  55635. gen = Math.min(ref.gen, 0xffff);
  55636. xrefTableData.push([1, baseOffset, gen]);
  55637. baseOffset += data.length;
  55638. } else {
  55639. gen = Math.min(ref.gen + 1, 0xffff);
  55640. xrefTableData.push([0, 0, gen]);
  55641. }
  55642. maxGen = Math.max(maxGen, gen);
  55643. }
  55644. newXref.set("Index", getIndexes(newRefs));
  55645. const offsetSize = getSizeInBytes(maxOffset);
  55646. const maxGenSize = getSizeInBytes(maxGen);
  55647. const sizes = [1, offsetSize, maxGenSize];
  55648. newXref.set("W", sizes);
  55649. computeIDs(baseOffset, xrefInfo, newXref);
  55650. const structSize = sizes.reduce((a, x) => a + x, 0);
  55651. const data = new Uint8Array(structSize * xrefTableData.length);
  55652. const stream = new Stream(data);
  55653. stream.dict = newXref;
  55654. let offset = 0;
  55655. for (const [type, objOffset, gen] of xrefTableData) {
  55656. offset = writeInt(type, sizes[0], offset, data);
  55657. offset = writeInt(objOffset, sizes[1], offset, data);
  55658. offset = writeInt(gen, sizes[2], offset, data);
  55659. }
  55660. await writeObject(xrefInfo.newRef, stream, buffer, {});
  55661. buffer.push("startxref\n", baseOffset.toString(), "\n%%EOF\n");
  55662. }
  55663. function computeIDs(baseOffset, xrefInfo, newXref) {
  55664. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  55665. const md5 = computeMD5(baseOffset, xrefInfo);
  55666. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  55667. }
  55668. }
  55669. function getTrailerDict(xrefInfo, changes, useXrefStream) {
  55670. const newXref = new Dict(null);
  55671. newXref.set("Prev", xrefInfo.startXRef);
  55672. const refForXrefTable = xrefInfo.newRef;
  55673. if (useXrefStream) {
  55674. changes.put(refForXrefTable, {
  55675. data: ""
  55676. });
  55677. newXref.set("Size", refForXrefTable.num + 1);
  55678. newXref.set("Type", Name.get("XRef"));
  55679. } else {
  55680. newXref.set("Size", refForXrefTable.num);
  55681. }
  55682. if (xrefInfo.rootRef !== null) {
  55683. newXref.set("Root", xrefInfo.rootRef);
  55684. }
  55685. if (xrefInfo.infoRef !== null) {
  55686. newXref.set("Info", xrefInfo.infoRef);
  55687. }
  55688. if (xrefInfo.encryptRef !== null) {
  55689. newXref.set("Encrypt", xrefInfo.encryptRef);
  55690. }
  55691. return newXref;
  55692. }
  55693. async function writeChanges(changes, xref, buffer = []) {
  55694. const newRefs = [];
  55695. for (const [ref, {
  55696. data
  55697. }] of changes.items()) {
  55698. if (data === null || typeof data === "string") {
  55699. newRefs.push({
  55700. ref,
  55701. data
  55702. });
  55703. continue;
  55704. }
  55705. await writeObject(ref, data, buffer, xref);
  55706. newRefs.push({
  55707. ref,
  55708. data: buffer.join("")
  55709. });
  55710. buffer.length = 0;
  55711. }
  55712. return newRefs.sort((a, b) => a.ref.num - b.ref.num);
  55713. }
  55714. async function incrementalUpdate({
  55715. originalData,
  55716. xrefInfo,
  55717. changes,
  55718. xref = null,
  55719. hasXfa = false,
  55720. xfaDatasetsRef = null,
  55721. hasXfaDatasetsEntry = false,
  55722. needAppearances,
  55723. acroFormRef = null,
  55724. acroForm = null,
  55725. xfaData = null,
  55726. useXrefStream = false
  55727. }) {
  55728. await updateAcroform({
  55729. xref,
  55730. acroForm,
  55731. acroFormRef,
  55732. hasXfa,
  55733. hasXfaDatasetsEntry,
  55734. xfaDatasetsRef,
  55735. needAppearances,
  55736. changes
  55737. });
  55738. if (hasXfa) {
  55739. updateXFA({
  55740. xfaData,
  55741. xfaDatasetsRef,
  55742. changes,
  55743. xref
  55744. });
  55745. }
  55746. const newXref = getTrailerDict(xrefInfo, changes, useXrefStream);
  55747. const buffer = [];
  55748. const newRefs = await writeChanges(changes, xref, buffer);
  55749. let baseOffset = originalData.length;
  55750. const lastByte = originalData.at(-1);
  55751. if (lastByte !== 0x0a && lastByte !== 0x0d) {
  55752. buffer.push("\n");
  55753. baseOffset += 1;
  55754. }
  55755. for (const {
  55756. data
  55757. } of newRefs) {
  55758. if (data !== null) {
  55759. buffer.push(data);
  55760. }
  55761. }
  55762. await (useXrefStream ? getXRefStreamTable(xrefInfo, baseOffset, newRefs, newXref, buffer) : getXRefTable(xrefInfo, baseOffset, newRefs, newXref, buffer));
  55763. const totalLength = buffer.reduce((a, str) => a + str.length, originalData.length);
  55764. const array = new Uint8Array(totalLength);
  55765. array.set(originalData);
  55766. let offset = originalData.length;
  55767. for (const str of buffer) {
  55768. writeString(str, offset, array);
  55769. offset += str.length;
  55770. }
  55771. return array;
  55772. }
  55773. ;// ./src/core/worker_stream.js
  55774. class PDFWorkerStream {
  55775. constructor(msgHandler) {
  55776. this._msgHandler = msgHandler;
  55777. this._contentLength = null;
  55778. this._fullRequestReader = null;
  55779. this._rangeRequestReaders = [];
  55780. }
  55781. getFullReader() {
  55782. assert(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  55783. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  55784. return this._fullRequestReader;
  55785. }
  55786. getRangeReader(begin, end) {
  55787. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  55788. this._rangeRequestReaders.push(reader);
  55789. return reader;
  55790. }
  55791. cancelAllRequests(reason) {
  55792. this._fullRequestReader?.cancel(reason);
  55793. for (const reader of this._rangeRequestReaders.slice(0)) {
  55794. reader.cancel(reason);
  55795. }
  55796. }
  55797. }
  55798. class PDFWorkerStreamReader {
  55799. constructor(msgHandler) {
  55800. this._msgHandler = msgHandler;
  55801. this.onProgress = null;
  55802. this._contentLength = null;
  55803. this._isRangeSupported = false;
  55804. this._isStreamingSupported = false;
  55805. const readableStream = this._msgHandler.sendWithStream("GetReader");
  55806. this._reader = readableStream.getReader();
  55807. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  55808. this._isStreamingSupported = data.isStreamingSupported;
  55809. this._isRangeSupported = data.isRangeSupported;
  55810. this._contentLength = data.contentLength;
  55811. });
  55812. }
  55813. get headersReady() {
  55814. return this._headersReady;
  55815. }
  55816. get contentLength() {
  55817. return this._contentLength;
  55818. }
  55819. get isStreamingSupported() {
  55820. return this._isStreamingSupported;
  55821. }
  55822. get isRangeSupported() {
  55823. return this._isRangeSupported;
  55824. }
  55825. async read() {
  55826. const {
  55827. value,
  55828. done
  55829. } = await this._reader.read();
  55830. if (done) {
  55831. return {
  55832. value: undefined,
  55833. done: true
  55834. };
  55835. }
  55836. return {
  55837. value: value.buffer,
  55838. done: false
  55839. };
  55840. }
  55841. cancel(reason) {
  55842. this._reader.cancel(reason);
  55843. }
  55844. }
  55845. class PDFWorkerStreamRangeReader {
  55846. constructor(begin, end, msgHandler) {
  55847. this._msgHandler = msgHandler;
  55848. this.onProgress = null;
  55849. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  55850. begin,
  55851. end
  55852. });
  55853. this._reader = readableStream.getReader();
  55854. }
  55855. get isStreamingSupported() {
  55856. return false;
  55857. }
  55858. async read() {
  55859. const {
  55860. value,
  55861. done
  55862. } = await this._reader.read();
  55863. if (done) {
  55864. return {
  55865. value: undefined,
  55866. done: true
  55867. };
  55868. }
  55869. return {
  55870. value: value.buffer,
  55871. done: false
  55872. };
  55873. }
  55874. cancel(reason) {
  55875. this._reader.cancel(reason);
  55876. }
  55877. }
  55878. ;// ./src/core/worker.js
  55879. class WorkerTask {
  55880. constructor(name) {
  55881. this.name = name;
  55882. this.terminated = false;
  55883. this._capability = Promise.withResolvers();
  55884. }
  55885. get finished() {
  55886. return this._capability.promise;
  55887. }
  55888. finish() {
  55889. this._capability.resolve();
  55890. }
  55891. terminate() {
  55892. this.terminated = true;
  55893. }
  55894. ensureNotTerminated() {
  55895. if (this.terminated) {
  55896. throw new Error("Worker task was terminated");
  55897. }
  55898. }
  55899. }
  55900. class WorkerMessageHandler {
  55901. static {
  55902. if (typeof window === "undefined" && !isNodeJS && typeof self !== "undefined" && typeof self.postMessage === "function" && "onmessage" in self) {
  55903. this.initializeFromPort(self);
  55904. }
  55905. }
  55906. static setup(handler, port) {
  55907. let testMessageProcessed = false;
  55908. handler.on("test", data => {
  55909. if (testMessageProcessed) {
  55910. return;
  55911. }
  55912. testMessageProcessed = true;
  55913. handler.send("test", data instanceof Uint8Array);
  55914. });
  55915. handler.on("configure", data => {
  55916. setVerbosityLevel(data.verbosity);
  55917. });
  55918. handler.on("GetDocRequest", data => this.createDocumentHandler(data, port));
  55919. }
  55920. static createDocumentHandler(docParams, port) {
  55921. let pdfManager;
  55922. let terminated = false;
  55923. let cancelXHRs = null;
  55924. const WorkerTasks = new Set();
  55925. const verbosity = getVerbosityLevel();
  55926. const {
  55927. docId,
  55928. apiVersion
  55929. } = docParams;
  55930. const workerVersion = "4.10.38";
  55931. if (apiVersion !== workerVersion) {
  55932. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  55933. }
  55934. const enumerableProperties = [];
  55935. for (const property in []) {
  55936. enumerableProperties.push(property);
  55937. }
  55938. if (enumerableProperties.length) {
  55939. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  55940. }
  55941. const workerHandlerName = docId + "_worker";
  55942. let handler = new MessageHandler(workerHandlerName, docId, port);
  55943. function ensureNotTerminated() {
  55944. if (terminated) {
  55945. throw new Error("Worker was terminated");
  55946. }
  55947. }
  55948. function startWorkerTask(task) {
  55949. WorkerTasks.add(task);
  55950. }
  55951. function finishWorkerTask(task) {
  55952. task.finish();
  55953. WorkerTasks.delete(task);
  55954. }
  55955. async function loadDocument(recoveryMode) {
  55956. await pdfManager.ensureDoc("checkHeader");
  55957. await pdfManager.ensureDoc("parseStartXRef");
  55958. await pdfManager.ensureDoc("parse", [recoveryMode]);
  55959. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  55960. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  55961. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  55962. if (isPureXfa) {
  55963. const task = new WorkerTask("loadXfaFonts");
  55964. startWorkerTask(task);
  55965. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  55966. }
  55967. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  55968. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  55969. return {
  55970. numPages,
  55971. fingerprints,
  55972. htmlForXfa
  55973. };
  55974. }
  55975. async function getPdfManager({
  55976. data,
  55977. password,
  55978. disableAutoFetch,
  55979. rangeChunkSize,
  55980. length,
  55981. docBaseUrl,
  55982. enableXfa,
  55983. evaluatorOptions
  55984. }) {
  55985. const pdfManagerArgs = {
  55986. source: null,
  55987. disableAutoFetch,
  55988. docBaseUrl,
  55989. docId,
  55990. enableXfa,
  55991. evaluatorOptions,
  55992. handler,
  55993. length,
  55994. password,
  55995. rangeChunkSize
  55996. };
  55997. if (data) {
  55998. pdfManagerArgs.source = data;
  55999. return new LocalPdfManager(pdfManagerArgs);
  56000. }
  56001. const pdfStream = new PDFWorkerStream(handler),
  56002. fullRequest = pdfStream.getFullReader();
  56003. const pdfManagerCapability = Promise.withResolvers();
  56004. let newPdfManager,
  56005. cachedChunks = [],
  56006. loaded = 0;
  56007. fullRequest.headersReady.then(function () {
  56008. if (!fullRequest.isRangeSupported) {
  56009. return;
  56010. }
  56011. pdfManagerArgs.source = pdfStream;
  56012. pdfManagerArgs.length = fullRequest.contentLength;
  56013. pdfManagerArgs.disableAutoFetch ||= fullRequest.isStreamingSupported;
  56014. newPdfManager = new NetworkPdfManager(pdfManagerArgs);
  56015. for (const chunk of cachedChunks) {
  56016. newPdfManager.sendProgressiveData(chunk);
  56017. }
  56018. cachedChunks = [];
  56019. pdfManagerCapability.resolve(newPdfManager);
  56020. cancelXHRs = null;
  56021. }).catch(function (reason) {
  56022. pdfManagerCapability.reject(reason);
  56023. cancelXHRs = null;
  56024. });
  56025. new Promise(function (resolve, reject) {
  56026. const readChunk = function ({
  56027. value,
  56028. done
  56029. }) {
  56030. try {
  56031. ensureNotTerminated();
  56032. if (done) {
  56033. if (!newPdfManager) {
  56034. const pdfFile = arrayBuffersToBytes(cachedChunks);
  56035. cachedChunks = [];
  56036. if (length && pdfFile.length !== length) {
  56037. warn("reported HTTP length is different from actual");
  56038. }
  56039. pdfManagerArgs.source = pdfFile;
  56040. newPdfManager = new LocalPdfManager(pdfManagerArgs);
  56041. pdfManagerCapability.resolve(newPdfManager);
  56042. }
  56043. cancelXHRs = null;
  56044. return;
  56045. }
  56046. loaded += value.byteLength;
  56047. if (!fullRequest.isStreamingSupported) {
  56048. handler.send("DocProgress", {
  56049. loaded,
  56050. total: Math.max(loaded, fullRequest.contentLength || 0)
  56051. });
  56052. }
  56053. if (newPdfManager) {
  56054. newPdfManager.sendProgressiveData(value);
  56055. } else {
  56056. cachedChunks.push(value);
  56057. }
  56058. fullRequest.read().then(readChunk, reject);
  56059. } catch (e) {
  56060. reject(e);
  56061. }
  56062. };
  56063. fullRequest.read().then(readChunk, reject);
  56064. }).catch(function (e) {
  56065. pdfManagerCapability.reject(e);
  56066. cancelXHRs = null;
  56067. });
  56068. cancelXHRs = reason => {
  56069. pdfStream.cancelAllRequests(reason);
  56070. };
  56071. return pdfManagerCapability.promise;
  56072. }
  56073. function setupDoc(data) {
  56074. function onSuccess(doc) {
  56075. ensureNotTerminated();
  56076. handler.send("GetDoc", {
  56077. pdfInfo: doc
  56078. });
  56079. }
  56080. function onFailure(ex) {
  56081. ensureNotTerminated();
  56082. if (ex instanceof PasswordException) {
  56083. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  56084. startWorkerTask(task);
  56085. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  56086. password
  56087. }) {
  56088. finishWorkerTask(task);
  56089. pdfManager.updatePassword(password);
  56090. pdfManagerReady();
  56091. }).catch(function () {
  56092. finishWorkerTask(task);
  56093. handler.send("DocException", ex);
  56094. });
  56095. } else {
  56096. handler.send("DocException", wrapReason(ex));
  56097. }
  56098. }
  56099. function pdfManagerReady() {
  56100. ensureNotTerminated();
  56101. loadDocument(false).then(onSuccess, function (reason) {
  56102. ensureNotTerminated();
  56103. if (!(reason instanceof XRefParseException)) {
  56104. onFailure(reason);
  56105. return;
  56106. }
  56107. pdfManager.requestLoadedStream().then(function () {
  56108. ensureNotTerminated();
  56109. loadDocument(true).then(onSuccess, onFailure);
  56110. });
  56111. });
  56112. }
  56113. ensureNotTerminated();
  56114. getPdfManager(data).then(function (newPdfManager) {
  56115. if (terminated) {
  56116. newPdfManager.terminate(new AbortException("Worker was terminated."));
  56117. throw new Error("Worker was terminated");
  56118. }
  56119. pdfManager = newPdfManager;
  56120. pdfManager.requestLoadedStream(true).then(stream => {
  56121. handler.send("DataLoaded", {
  56122. length: stream.bytes.byteLength
  56123. });
  56124. });
  56125. }).then(pdfManagerReady, onFailure);
  56126. }
  56127. handler.on("GetPage", function (data) {
  56128. return pdfManager.getPage(data.pageIndex).then(function (page) {
  56129. return Promise.all([pdfManager.ensure(page, "rotate"), pdfManager.ensure(page, "ref"), pdfManager.ensure(page, "userUnit"), pdfManager.ensure(page, "view")]).then(function ([rotate, ref, userUnit, view]) {
  56130. return {
  56131. rotate,
  56132. ref,
  56133. refStr: ref?.toString() ?? null,
  56134. userUnit,
  56135. view
  56136. };
  56137. });
  56138. });
  56139. });
  56140. handler.on("GetPageIndex", function (data) {
  56141. const pageRef = Ref.get(data.num, data.gen);
  56142. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  56143. });
  56144. handler.on("GetDestinations", function (data) {
  56145. return pdfManager.ensureCatalog("destinations");
  56146. });
  56147. handler.on("GetDestination", function (data) {
  56148. return pdfManager.ensureCatalog("getDestination", [data.id]);
  56149. });
  56150. handler.on("GetPageLabels", function (data) {
  56151. return pdfManager.ensureCatalog("pageLabels");
  56152. });
  56153. handler.on("GetPageLayout", function (data) {
  56154. return pdfManager.ensureCatalog("pageLayout");
  56155. });
  56156. handler.on("GetPageMode", function (data) {
  56157. return pdfManager.ensureCatalog("pageMode");
  56158. });
  56159. handler.on("GetViewerPreferences", function (data) {
  56160. return pdfManager.ensureCatalog("viewerPreferences");
  56161. });
  56162. handler.on("GetOpenAction", function (data) {
  56163. return pdfManager.ensureCatalog("openAction");
  56164. });
  56165. handler.on("GetAttachments", function (data) {
  56166. return pdfManager.ensureCatalog("attachments");
  56167. });
  56168. handler.on("GetDocJSActions", function (data) {
  56169. return pdfManager.ensureCatalog("jsActions");
  56170. });
  56171. handler.on("GetPageJSActions", function ({
  56172. pageIndex
  56173. }) {
  56174. return pdfManager.getPage(pageIndex).then(function (page) {
  56175. return pdfManager.ensure(page, "jsActions");
  56176. });
  56177. });
  56178. handler.on("GetOutline", function (data) {
  56179. return pdfManager.ensureCatalog("documentOutline");
  56180. });
  56181. handler.on("GetOptionalContentConfig", function (data) {
  56182. return pdfManager.ensureCatalog("optionalContentConfig");
  56183. });
  56184. handler.on("GetPermissions", function (data) {
  56185. return pdfManager.ensureCatalog("permissions");
  56186. });
  56187. handler.on("GetMetadata", function (data) {
  56188. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  56189. });
  56190. handler.on("GetMarkInfo", function (data) {
  56191. return pdfManager.ensureCatalog("markInfo");
  56192. });
  56193. handler.on("GetData", function (data) {
  56194. return pdfManager.requestLoadedStream().then(function (stream) {
  56195. return stream.bytes;
  56196. });
  56197. });
  56198. handler.on("GetAnnotations", function ({
  56199. pageIndex,
  56200. intent
  56201. }) {
  56202. return pdfManager.getPage(pageIndex).then(function (page) {
  56203. const task = new WorkerTask(`GetAnnotations: page ${pageIndex}`);
  56204. startWorkerTask(task);
  56205. return page.getAnnotationsData(handler, task, intent).then(data => {
  56206. finishWorkerTask(task);
  56207. return data;
  56208. }, reason => {
  56209. finishWorkerTask(task);
  56210. throw reason;
  56211. });
  56212. });
  56213. });
  56214. handler.on("GetFieldObjects", function (data) {
  56215. return pdfManager.ensureDoc("fieldObjects").then(fieldObjects => fieldObjects?.allFields || null);
  56216. });
  56217. handler.on("HasJSActions", function (data) {
  56218. return pdfManager.ensureDoc("hasJSActions");
  56219. });
  56220. handler.on("GetCalculationOrderIds", function (data) {
  56221. return pdfManager.ensureDoc("calculationOrderIds");
  56222. });
  56223. handler.on("SaveDocument", async function ({
  56224. isPureXfa,
  56225. numPages,
  56226. annotationStorage,
  56227. filename
  56228. }) {
  56229. const globalPromises = [pdfManager.requestLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("startXRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("structTreeRoot")];
  56230. const changes = new RefSetCache();
  56231. const promises = [];
  56232. const newAnnotationsByPage = !isPureXfa ? getNewAnnotationsMap(annotationStorage) : null;
  56233. const [stream, acroForm, acroFormRef, startXRef, xref, linearization, _structTreeRoot] = await Promise.all(globalPromises);
  56234. const catalogRef = xref.trailer.getRaw("Root") || null;
  56235. let structTreeRoot;
  56236. if (newAnnotationsByPage) {
  56237. if (!_structTreeRoot) {
  56238. if (await StructTreeRoot.canCreateStructureTree({
  56239. catalogRef,
  56240. pdfManager,
  56241. newAnnotationsByPage
  56242. })) {
  56243. structTreeRoot = null;
  56244. }
  56245. } else if (await _structTreeRoot.canUpdateStructTree({
  56246. pdfManager,
  56247. xref,
  56248. newAnnotationsByPage
  56249. })) {
  56250. structTreeRoot = _structTreeRoot;
  56251. }
  56252. const imagePromises = AnnotationFactory.generateImages(annotationStorage.values(), xref, pdfManager.evaluatorOptions.isOffscreenCanvasSupported);
  56253. const newAnnotationPromises = structTreeRoot === undefined ? promises : [];
  56254. for (const [pageIndex, annotations] of newAnnotationsByPage) {
  56255. newAnnotationPromises.push(pdfManager.getPage(pageIndex).then(page => {
  56256. const task = new WorkerTask(`Save (editor): page ${pageIndex}`);
  56257. startWorkerTask(task);
  56258. return page.saveNewAnnotations(handler, task, annotations, imagePromises, changes).finally(function () {
  56259. finishWorkerTask(task);
  56260. });
  56261. }));
  56262. }
  56263. if (structTreeRoot === null) {
  56264. promises.push(Promise.all(newAnnotationPromises).then(async () => {
  56265. await StructTreeRoot.createStructureTree({
  56266. newAnnotationsByPage,
  56267. xref,
  56268. catalogRef,
  56269. pdfManager,
  56270. changes
  56271. });
  56272. }));
  56273. } else if (structTreeRoot) {
  56274. promises.push(Promise.all(newAnnotationPromises).then(async () => {
  56275. await structTreeRoot.updateStructureTree({
  56276. newAnnotationsByPage,
  56277. pdfManager,
  56278. changes
  56279. });
  56280. }));
  56281. }
  56282. }
  56283. if (isPureXfa) {
  56284. promises.push(pdfManager.serializeXfaData(annotationStorage));
  56285. } else {
  56286. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  56287. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  56288. const task = new WorkerTask(`Save: page ${pageIndex}`);
  56289. startWorkerTask(task);
  56290. return page.save(handler, task, annotationStorage, changes).finally(function () {
  56291. finishWorkerTask(task);
  56292. });
  56293. }));
  56294. }
  56295. }
  56296. const refs = await Promise.all(promises);
  56297. let xfaData = null;
  56298. if (isPureXfa) {
  56299. xfaData = refs[0];
  56300. if (!xfaData) {
  56301. return stream.bytes;
  56302. }
  56303. } else if (changes.size === 0) {
  56304. return stream.bytes;
  56305. }
  56306. const needAppearances = acroFormRef && acroForm instanceof Dict && changes.values().some(ref => ref.needAppearances);
  56307. const xfa = acroForm instanceof Dict && acroForm.get("XFA") || null;
  56308. let xfaDatasetsRef = null;
  56309. let hasXfaDatasetsEntry = false;
  56310. if (Array.isArray(xfa)) {
  56311. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  56312. if (xfa[i] === "datasets") {
  56313. xfaDatasetsRef = xfa[i + 1];
  56314. hasXfaDatasetsEntry = true;
  56315. }
  56316. }
  56317. if (xfaDatasetsRef === null) {
  56318. xfaDatasetsRef = xref.getNewTemporaryRef();
  56319. }
  56320. } else if (xfa) {
  56321. warn("Unsupported XFA type.");
  56322. }
  56323. let newXrefInfo = Object.create(null);
  56324. if (xref.trailer) {
  56325. const infoObj = Object.create(null);
  56326. const xrefInfo = xref.trailer.get("Info") || null;
  56327. if (xrefInfo instanceof Dict) {
  56328. for (const [key, value] of xrefInfo) {
  56329. if (typeof value === "string") {
  56330. infoObj[key] = stringToPDFString(value);
  56331. }
  56332. }
  56333. }
  56334. newXrefInfo = {
  56335. rootRef: catalogRef,
  56336. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  56337. newRef: xref.getNewTemporaryRef(),
  56338. infoRef: xref.trailer.getRaw("Info") || null,
  56339. info: infoObj,
  56340. fileIds: xref.trailer.get("ID") || null,
  56341. startXRef: linearization ? startXRef : xref.lastXRefStreamPos ?? startXRef,
  56342. filename
  56343. };
  56344. }
  56345. return incrementalUpdate({
  56346. originalData: stream.bytes,
  56347. xrefInfo: newXrefInfo,
  56348. changes,
  56349. xref,
  56350. hasXfa: !!xfa,
  56351. xfaDatasetsRef,
  56352. hasXfaDatasetsEntry,
  56353. needAppearances,
  56354. acroFormRef,
  56355. acroForm,
  56356. xfaData,
  56357. useXrefStream: isDict(xref.topDict, "XRef")
  56358. }).finally(() => {
  56359. xref.resetNewTemporaryRef();
  56360. });
  56361. });
  56362. handler.on("GetOperatorList", function (data, sink) {
  56363. const pageIndex = data.pageIndex;
  56364. pdfManager.getPage(pageIndex).then(function (page) {
  56365. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  56366. startWorkerTask(task);
  56367. const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
  56368. page.getOperatorList({
  56369. handler,
  56370. sink,
  56371. task,
  56372. intent: data.intent,
  56373. cacheKey: data.cacheKey,
  56374. annotationStorage: data.annotationStorage,
  56375. modifiedIds: data.modifiedIds
  56376. }).then(function (operatorListInfo) {
  56377. finishWorkerTask(task);
  56378. if (start) {
  56379. info(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  56380. }
  56381. sink.close();
  56382. }, function (reason) {
  56383. finishWorkerTask(task);
  56384. if (task.terminated) {
  56385. return;
  56386. }
  56387. sink.error(reason);
  56388. });
  56389. });
  56390. });
  56391. handler.on("GetTextContent", function (data, sink) {
  56392. const {
  56393. pageIndex,
  56394. includeMarkedContent,
  56395. disableNormalization
  56396. } = data;
  56397. pdfManager.getPage(pageIndex).then(function (page) {
  56398. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  56399. startWorkerTask(task);
  56400. const start = verbosity >= VerbosityLevel.INFOS ? Date.now() : 0;
  56401. page.extractTextContent({
  56402. handler,
  56403. task,
  56404. sink,
  56405. includeMarkedContent,
  56406. disableNormalization
  56407. }).then(function () {
  56408. finishWorkerTask(task);
  56409. if (start) {
  56410. info(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  56411. }
  56412. sink.close();
  56413. }, function (reason) {
  56414. finishWorkerTask(task);
  56415. if (task.terminated) {
  56416. return;
  56417. }
  56418. sink.error(reason);
  56419. });
  56420. });
  56421. });
  56422. handler.on("GetStructTree", function (data) {
  56423. return pdfManager.getPage(data.pageIndex).then(function (page) {
  56424. return pdfManager.ensure(page, "getStructTree");
  56425. });
  56426. });
  56427. handler.on("FontFallback", function (data) {
  56428. return pdfManager.fontFallback(data.id, handler);
  56429. });
  56430. handler.on("Cleanup", function (data) {
  56431. return pdfManager.cleanup(true);
  56432. });
  56433. handler.on("Terminate", function (data) {
  56434. terminated = true;
  56435. const waitOn = [];
  56436. if (pdfManager) {
  56437. pdfManager.terminate(new AbortException("Worker was terminated."));
  56438. const cleanupPromise = pdfManager.cleanup();
  56439. waitOn.push(cleanupPromise);
  56440. pdfManager = null;
  56441. } else {
  56442. clearGlobalCaches();
  56443. }
  56444. cancelXHRs?.(new AbortException("Worker was terminated."));
  56445. for (const task of WorkerTasks) {
  56446. waitOn.push(task.finished);
  56447. task.terminate();
  56448. }
  56449. return Promise.all(waitOn).then(function () {
  56450. handler.destroy();
  56451. handler = null;
  56452. });
  56453. });
  56454. handler.on("Ready", function (data) {
  56455. setupDoc(docParams);
  56456. docParams = null;
  56457. });
  56458. return workerHandlerName;
  56459. }
  56460. static initializeFromPort(port) {
  56461. const handler = new MessageHandler("worker", "main", port);
  56462. this.setup(handler, port);
  56463. handler.send("ready", null);
  56464. }
  56465. }
  56466. ;// ./src/pdf.worker.js
  56467. const pdfjsVersion = "4.10.38";
  56468. const pdfjsBuild = "f9bea397f";
  56469. var __webpack_exports__WorkerMessageHandler = __webpack_exports__.WorkerMessageHandler;
  56470. export { __webpack_exports__WorkerMessageHandler as WorkerMessageHandler };
  56471. //# sourceMappingURL=pdf.worker.mjs.map