pdf.worker.js 1.9 MB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366636763686369637063716372637363746375637663776378637963806381638263836384638563866387638863896390639163926393639463956396639763986399640064016402640364046405640664076408640964106411641264136414641564166417641864196420642164226423642464256426642764286429643064316432643364346435643664376438643964406441644264436444644564466447644864496450645164526453645464556456645764586459646064616462646364646465646664676468646964706471647264736474647564766477647864796480648164826483648464856486648764886489649064916492649364946495649664976498649965006501650265036504650565066507650865096510651165126513651465156516651765186519652065216522652365246525652665276528652965306531653265336534653565366537653865396540654165426543654465456546654765486549655065516552655365546555655665576558655965606561656265636564656565666567656865696570657165726573657465756576657765786579658065816582658365846585658665876588658965906591659265936594659565966597659865996600660166026603660466056606660766086609661066116612661366146615661666176618661966206621662266236624662566266627662866296630663166326633663466356636663766386639664066416642664366446645664666476648664966506651665266536654665566566657665866596660666166626663666466656666666766686669667066716672667366746675667666776678667966806681668266836684668566866687668866896690669166926693669466956696669766986699670067016702670367046705670667076708670967106711671267136714671567166717671867196720672167226723672467256726672767286729673067316732673367346735673667376738673967406741674267436744674567466747674867496750675167526753675467556756675767586759676067616762676367646765676667676768676967706771677267736774677567766777677867796780678167826783678467856786678767886789679067916792679367946795679667976798679968006801680268036804680568066807680868096810681168126813681468156816681768186819682068216822682368246825682668276828682968306831683268336834683568366837683868396840684168426843684468456846684768486849685068516852685368546855685668576858685968606861686268636864686568666867686868696870687168726873687468756876687768786879688068816882688368846885688668876888688968906891689268936894689568966897689868996900690169026903690469056906690769086909691069116912691369146915691669176918691969206921692269236924692569266927692869296930693169326933693469356936693769386939694069416942694369446945694669476948694969506951695269536954695569566957695869596960696169626963696469656966696769686969697069716972697369746975697669776978697969806981698269836984698569866987698869896990699169926993699469956996699769986999700070017002700370047005700670077008700970107011701270137014701570167017701870197020702170227023702470257026702770287029703070317032703370347035703670377038703970407041704270437044704570467047704870497050705170527053705470557056705770587059706070617062706370647065706670677068706970707071707270737074707570767077707870797080708170827083708470857086708770887089709070917092709370947095709670977098709971007101710271037104710571067107710871097110711171127113711471157116711771187119712071217122712371247125712671277128712971307131713271337134713571367137713871397140714171427143714471457146714771487149715071517152715371547155715671577158715971607161716271637164716571667167716871697170717171727173717471757176717771787179718071817182718371847185718671877188718971907191719271937194719571967197719871997200720172027203720472057206720772087209721072117212721372147215721672177218721972207221722272237224722572267227722872297230723172327233723472357236723772387239724072417242724372447245724672477248724972507251725272537254725572567257725872597260726172627263726472657266726772687269727072717272727372747275727672777278727972807281728272837284728572867287728872897290729172927293729472957296729772987299730073017302730373047305730673077308730973107311731273137314731573167317731873197320732173227323732473257326732773287329733073317332733373347335733673377338733973407341734273437344734573467347734873497350735173527353735473557356735773587359736073617362736373647365736673677368736973707371737273737374737573767377737873797380738173827383738473857386738773887389739073917392739373947395739673977398739974007401740274037404740574067407740874097410741174127413741474157416741774187419742074217422742374247425742674277428742974307431743274337434743574367437743874397440744174427443744474457446744774487449745074517452745374547455745674577458745974607461746274637464746574667467746874697470747174727473747474757476747774787479748074817482748374847485748674877488748974907491749274937494749574967497749874997500750175027503750475057506750775087509751075117512751375147515751675177518751975207521752275237524752575267527752875297530753175327533753475357536753775387539754075417542754375447545754675477548754975507551755275537554755575567557755875597560756175627563756475657566756775687569757075717572757375747575757675777578757975807581758275837584758575867587758875897590759175927593759475957596759775987599760076017602760376047605760676077608760976107611761276137614761576167617761876197620762176227623762476257626762776287629763076317632763376347635763676377638763976407641764276437644764576467647764876497650765176527653765476557656765776587659766076617662766376647665766676677668766976707671767276737674767576767677767876797680768176827683768476857686768776887689769076917692769376947695769676977698769977007701770277037704770577067707770877097710771177127713771477157716771777187719772077217722772377247725772677277728772977307731773277337734773577367737773877397740774177427743774477457746774777487749775077517752775377547755775677577758775977607761776277637764776577667767776877697770777177727773777477757776777777787779778077817782778377847785778677877788778977907791779277937794779577967797779877997800780178027803780478057806780778087809781078117812781378147815781678177818781978207821782278237824782578267827782878297830783178327833783478357836783778387839784078417842784378447845784678477848784978507851785278537854785578567857785878597860786178627863786478657866786778687869787078717872787378747875787678777878787978807881788278837884788578867887788878897890789178927893789478957896789778987899790079017902790379047905790679077908790979107911791279137914791579167917791879197920792179227923792479257926792779287929793079317932793379347935793679377938793979407941794279437944794579467947794879497950795179527953795479557956795779587959796079617962796379647965796679677968796979707971797279737974797579767977797879797980798179827983798479857986798779887989799079917992799379947995799679977998799980008001800280038004800580068007800880098010801180128013801480158016801780188019802080218022802380248025802680278028802980308031803280338034803580368037803880398040804180428043804480458046804780488049805080518052805380548055805680578058805980608061806280638064806580668067806880698070807180728073807480758076807780788079808080818082808380848085808680878088808980908091809280938094809580968097809880998100810181028103810481058106810781088109811081118112811381148115811681178118811981208121812281238124812581268127812881298130813181328133813481358136813781388139814081418142814381448145814681478148814981508151815281538154815581568157815881598160816181628163816481658166816781688169817081718172817381748175817681778178817981808181818281838184818581868187818881898190819181928193819481958196819781988199820082018202820382048205820682078208820982108211821282138214821582168217821882198220822182228223822482258226822782288229823082318232823382348235823682378238823982408241824282438244824582468247824882498250825182528253825482558256825782588259826082618262826382648265826682678268826982708271827282738274827582768277827882798280828182828283828482858286828782888289829082918292829382948295829682978298829983008301830283038304830583068307830883098310831183128313831483158316831783188319832083218322832383248325832683278328832983308331833283338334833583368337833883398340834183428343834483458346834783488349835083518352835383548355835683578358835983608361836283638364836583668367836883698370837183728373837483758376837783788379838083818382838383848385838683878388838983908391839283938394839583968397839883998400840184028403840484058406840784088409841084118412841384148415841684178418841984208421842284238424842584268427842884298430843184328433843484358436843784388439844084418442844384448445844684478448844984508451845284538454845584568457845884598460846184628463846484658466846784688469847084718472847384748475847684778478847984808481848284838484848584868487848884898490849184928493849484958496849784988499850085018502850385048505850685078508850985108511851285138514851585168517851885198520852185228523852485258526852785288529853085318532853385348535853685378538853985408541854285438544854585468547854885498550855185528553855485558556855785588559856085618562856385648565856685678568856985708571857285738574857585768577857885798580858185828583858485858586858785888589859085918592859385948595859685978598859986008601860286038604860586068607860886098610861186128613861486158616861786188619862086218622862386248625862686278628862986308631863286338634863586368637863886398640864186428643864486458646864786488649865086518652865386548655865686578658865986608661866286638664866586668667866886698670867186728673867486758676867786788679868086818682868386848685868686878688868986908691869286938694869586968697869886998700870187028703870487058706870787088709871087118712871387148715871687178718871987208721872287238724872587268727872887298730873187328733873487358736873787388739874087418742874387448745874687478748874987508751875287538754875587568757875887598760876187628763876487658766876787688769877087718772877387748775877687778778877987808781878287838784878587868787878887898790879187928793879487958796879787988799880088018802880388048805880688078808880988108811881288138814881588168817881888198820882188228823882488258826882788288829883088318832883388348835883688378838883988408841884288438844884588468847884888498850885188528853885488558856885788588859886088618862886388648865886688678868886988708871887288738874887588768877887888798880888188828883888488858886888788888889889088918892889388948895889688978898889989008901890289038904890589068907890889098910891189128913891489158916891789188919892089218922892389248925892689278928892989308931893289338934893589368937893889398940894189428943894489458946894789488949895089518952895389548955895689578958895989608961896289638964896589668967896889698970897189728973897489758976897789788979898089818982898389848985898689878988898989908991899289938994899589968997899889999000900190029003900490059006900790089009901090119012901390149015901690179018901990209021902290239024902590269027902890299030903190329033903490359036903790389039904090419042904390449045904690479048904990509051905290539054905590569057905890599060906190629063906490659066906790689069907090719072907390749075907690779078907990809081908290839084908590869087908890899090909190929093909490959096909790989099910091019102910391049105910691079108910991109111911291139114911591169117911891199120912191229123912491259126912791289129913091319132913391349135913691379138913991409141914291439144914591469147914891499150915191529153915491559156915791589159916091619162916391649165916691679168916991709171917291739174917591769177917891799180918191829183918491859186918791889189919091919192919391949195919691979198919992009201920292039204920592069207920892099210921192129213921492159216921792189219922092219222922392249225922692279228922992309231923292339234923592369237923892399240924192429243924492459246924792489249925092519252925392549255925692579258925992609261926292639264926592669267926892699270927192729273927492759276927792789279928092819282928392849285928692879288928992909291929292939294929592969297929892999300930193029303930493059306930793089309931093119312931393149315931693179318931993209321932293239324932593269327932893299330933193329333933493359336933793389339934093419342934393449345934693479348934993509351935293539354935593569357935893599360936193629363936493659366936793689369937093719372937393749375937693779378937993809381938293839384938593869387938893899390939193929393939493959396939793989399940094019402940394049405940694079408940994109411941294139414941594169417941894199420942194229423942494259426942794289429943094319432943394349435943694379438943994409441944294439444944594469447944894499450945194529453945494559456945794589459946094619462946394649465946694679468946994709471947294739474947594769477947894799480948194829483948494859486948794889489949094919492949394949495949694979498949995009501950295039504950595069507950895099510951195129513951495159516951795189519952095219522952395249525952695279528952995309531953295339534953595369537953895399540954195429543954495459546954795489549955095519552955395549555955695579558955995609561956295639564956595669567956895699570957195729573957495759576957795789579958095819582958395849585958695879588958995909591959295939594959595969597959895999600960196029603960496059606960796089609961096119612961396149615961696179618961996209621962296239624962596269627962896299630963196329633963496359636963796389639964096419642964396449645964696479648964996509651965296539654965596569657965896599660966196629663966496659666966796689669967096719672967396749675967696779678967996809681968296839684968596869687968896899690969196929693969496959696969796989699970097019702970397049705970697079708970997109711971297139714971597169717971897199720972197229723972497259726972797289729973097319732973397349735973697379738973997409741974297439744974597469747974897499750975197529753975497559756975797589759976097619762976397649765976697679768976997709771977297739774977597769777977897799780978197829783978497859786978797889789979097919792979397949795979697979798979998009801980298039804980598069807980898099810981198129813981498159816981798189819982098219822982398249825982698279828982998309831983298339834983598369837983898399840984198429843984498459846984798489849985098519852985398549855985698579858985998609861986298639864986598669867986898699870987198729873987498759876987798789879988098819882988398849885988698879888988998909891989298939894989598969897989898999900990199029903990499059906990799089909991099119912991399149915991699179918991999209921992299239924992599269927992899299930993199329933993499359936993799389939994099419942994399449945994699479948994999509951995299539954995599569957995899599960996199629963996499659966996799689969997099719972997399749975997699779978997999809981998299839984998599869987998899899990999199929993999499959996999799989999100001000110002100031000410005100061000710008100091001010011100121001310014100151001610017100181001910020100211002210023100241002510026100271002810029100301003110032100331003410035100361003710038100391004010041100421004310044100451004610047100481004910050100511005210053100541005510056100571005810059100601006110062100631006410065100661006710068100691007010071100721007310074100751007610077100781007910080100811008210083100841008510086100871008810089100901009110092100931009410095100961009710098100991010010101101021010310104101051010610107101081010910110101111011210113101141011510116101171011810119101201012110122101231012410125101261012710128101291013010131101321013310134101351013610137101381013910140101411014210143101441014510146101471014810149101501015110152101531015410155101561015710158101591016010161101621016310164101651016610167101681016910170101711017210173101741017510176101771017810179101801018110182101831018410185101861018710188101891019010191101921019310194101951019610197101981019910200102011020210203102041020510206102071020810209102101021110212102131021410215102161021710218102191022010221102221022310224102251022610227102281022910230102311023210233102341023510236102371023810239102401024110242102431024410245102461024710248102491025010251102521025310254102551025610257102581025910260102611026210263102641026510266102671026810269102701027110272102731027410275102761027710278102791028010281102821028310284102851028610287102881028910290102911029210293102941029510296102971029810299103001030110302103031030410305103061030710308103091031010311103121031310314103151031610317103181031910320103211032210323103241032510326103271032810329103301033110332103331033410335103361033710338103391034010341103421034310344103451034610347103481034910350103511035210353103541035510356103571035810359103601036110362103631036410365103661036710368103691037010371103721037310374103751037610377103781037910380103811038210383103841038510386103871038810389103901039110392103931039410395103961039710398103991040010401104021040310404104051040610407104081040910410104111041210413104141041510416104171041810419104201042110422104231042410425104261042710428104291043010431104321043310434104351043610437104381043910440104411044210443104441044510446104471044810449104501045110452104531045410455104561045710458104591046010461104621046310464104651046610467104681046910470104711047210473104741047510476104771047810479104801048110482104831048410485104861048710488104891049010491104921049310494104951049610497104981049910500105011050210503105041050510506105071050810509105101051110512105131051410515105161051710518105191052010521105221052310524105251052610527105281052910530105311053210533105341053510536105371053810539105401054110542105431054410545105461054710548105491055010551105521055310554105551055610557105581055910560105611056210563105641056510566105671056810569105701057110572105731057410575105761057710578105791058010581105821058310584105851058610587105881058910590105911059210593105941059510596105971059810599106001060110602106031060410605106061060710608106091061010611106121061310614106151061610617106181061910620106211062210623106241062510626106271062810629106301063110632106331063410635106361063710638106391064010641106421064310644106451064610647106481064910650106511065210653106541065510656106571065810659106601066110662106631066410665106661066710668106691067010671106721067310674106751067610677106781067910680106811068210683106841068510686106871068810689106901069110692106931069410695106961069710698106991070010701107021070310704107051070610707107081070910710107111071210713107141071510716107171071810719107201072110722107231072410725107261072710728107291073010731107321073310734107351073610737107381073910740107411074210743107441074510746107471074810749107501075110752107531075410755107561075710758107591076010761107621076310764107651076610767107681076910770107711077210773107741077510776107771077810779107801078110782107831078410785107861078710788107891079010791107921079310794107951079610797107981079910800108011080210803108041080510806108071080810809108101081110812108131081410815108161081710818108191082010821108221082310824108251082610827108281082910830108311083210833108341083510836108371083810839108401084110842108431084410845108461084710848108491085010851108521085310854108551085610857108581085910860108611086210863108641086510866108671086810869108701087110872108731087410875108761087710878108791088010881108821088310884108851088610887108881088910890108911089210893108941089510896108971089810899109001090110902109031090410905109061090710908109091091010911109121091310914109151091610917109181091910920109211092210923109241092510926109271092810929109301093110932109331093410935109361093710938109391094010941109421094310944109451094610947109481094910950109511095210953109541095510956109571095810959109601096110962109631096410965109661096710968109691097010971109721097310974109751097610977109781097910980109811098210983109841098510986109871098810989109901099110992109931099410995109961099710998109991100011001110021100311004110051100611007110081100911010110111101211013110141101511016110171101811019110201102111022110231102411025110261102711028110291103011031110321103311034110351103611037110381103911040110411104211043110441104511046110471104811049110501105111052110531105411055110561105711058110591106011061110621106311064110651106611067110681106911070110711107211073110741107511076110771107811079110801108111082110831108411085110861108711088110891109011091110921109311094110951109611097110981109911100111011110211103111041110511106111071110811109111101111111112111131111411115111161111711118111191112011121111221112311124111251112611127111281112911130111311113211133111341113511136111371113811139111401114111142111431114411145111461114711148111491115011151111521115311154111551115611157111581115911160111611116211163111641116511166111671116811169111701117111172111731117411175111761117711178111791118011181111821118311184111851118611187111881118911190111911119211193111941119511196111971119811199112001120111202112031120411205112061120711208112091121011211112121121311214112151121611217112181121911220112211122211223112241122511226112271122811229112301123111232112331123411235112361123711238112391124011241112421124311244112451124611247112481124911250112511125211253112541125511256112571125811259112601126111262112631126411265112661126711268112691127011271112721127311274112751127611277112781127911280112811128211283112841128511286112871128811289112901129111292112931129411295112961129711298112991130011301113021130311304113051130611307113081130911310113111131211313113141131511316113171131811319113201132111322113231132411325113261132711328113291133011331113321133311334113351133611337113381133911340113411134211343113441134511346113471134811349113501135111352113531135411355113561135711358113591136011361113621136311364113651136611367113681136911370113711137211373113741137511376113771137811379113801138111382113831138411385113861138711388113891139011391113921139311394113951139611397113981139911400114011140211403114041140511406114071140811409114101141111412114131141411415114161141711418114191142011421114221142311424114251142611427114281142911430114311143211433114341143511436114371143811439114401144111442114431144411445114461144711448114491145011451114521145311454114551145611457114581145911460114611146211463114641146511466114671146811469114701147111472114731147411475114761147711478114791148011481114821148311484114851148611487114881148911490114911149211493114941149511496114971149811499115001150111502115031150411505115061150711508115091151011511115121151311514115151151611517115181151911520115211152211523115241152511526115271152811529115301153111532115331153411535115361153711538115391154011541115421154311544115451154611547115481154911550115511155211553115541155511556115571155811559115601156111562115631156411565115661156711568115691157011571115721157311574115751157611577115781157911580115811158211583115841158511586115871158811589115901159111592115931159411595115961159711598115991160011601116021160311604116051160611607116081160911610116111161211613116141161511616116171161811619116201162111622116231162411625116261162711628116291163011631116321163311634116351163611637116381163911640116411164211643116441164511646116471164811649116501165111652116531165411655116561165711658116591166011661116621166311664116651166611667116681166911670116711167211673116741167511676116771167811679116801168111682116831168411685116861168711688116891169011691116921169311694116951169611697116981169911700117011170211703117041170511706117071170811709117101171111712117131171411715117161171711718117191172011721117221172311724117251172611727117281172911730117311173211733117341173511736117371173811739117401174111742117431174411745117461174711748117491175011751117521175311754117551175611757117581175911760117611176211763117641176511766117671176811769117701177111772117731177411775117761177711778117791178011781117821178311784117851178611787117881178911790117911179211793117941179511796117971179811799118001180111802118031180411805118061180711808118091181011811118121181311814118151181611817118181181911820118211182211823118241182511826118271182811829118301183111832118331183411835118361183711838118391184011841118421184311844118451184611847118481184911850118511185211853118541185511856118571185811859118601186111862118631186411865118661186711868118691187011871118721187311874118751187611877118781187911880118811188211883118841188511886118871188811889118901189111892118931189411895118961189711898118991190011901119021190311904119051190611907119081190911910119111191211913119141191511916119171191811919119201192111922119231192411925119261192711928119291193011931119321193311934119351193611937119381193911940119411194211943119441194511946119471194811949119501195111952119531195411955119561195711958119591196011961119621196311964119651196611967119681196911970119711197211973119741197511976119771197811979119801198111982119831198411985119861198711988119891199011991119921199311994119951199611997119981199912000120011200212003120041200512006120071200812009120101201112012120131201412015120161201712018120191202012021120221202312024120251202612027120281202912030120311203212033120341203512036120371203812039120401204112042120431204412045120461204712048120491205012051120521205312054120551205612057120581205912060120611206212063120641206512066120671206812069120701207112072120731207412075120761207712078120791208012081120821208312084120851208612087120881208912090120911209212093120941209512096120971209812099121001210112102121031210412105121061210712108121091211012111121121211312114121151211612117121181211912120121211212212123121241212512126121271212812129121301213112132121331213412135121361213712138121391214012141121421214312144121451214612147121481214912150121511215212153121541215512156121571215812159121601216112162121631216412165121661216712168121691217012171121721217312174121751217612177121781217912180121811218212183121841218512186121871218812189121901219112192121931219412195121961219712198121991220012201122021220312204122051220612207122081220912210122111221212213122141221512216122171221812219122201222112222122231222412225122261222712228122291223012231122321223312234122351223612237122381223912240122411224212243122441224512246122471224812249122501225112252122531225412255122561225712258122591226012261122621226312264122651226612267122681226912270122711227212273122741227512276122771227812279122801228112282122831228412285122861228712288122891229012291122921229312294122951229612297122981229912300123011230212303123041230512306123071230812309123101231112312123131231412315123161231712318123191232012321123221232312324123251232612327123281232912330123311233212333123341233512336123371233812339123401234112342123431234412345123461234712348123491235012351123521235312354123551235612357123581235912360123611236212363123641236512366123671236812369123701237112372123731237412375123761237712378123791238012381123821238312384123851238612387123881238912390123911239212393123941239512396123971239812399124001240112402124031240412405124061240712408124091241012411124121241312414124151241612417124181241912420124211242212423124241242512426124271242812429124301243112432124331243412435124361243712438124391244012441124421244312444124451244612447124481244912450124511245212453124541245512456124571245812459124601246112462124631246412465124661246712468124691247012471124721247312474124751247612477124781247912480124811248212483124841248512486124871248812489124901249112492124931249412495124961249712498124991250012501125021250312504125051250612507125081250912510125111251212513125141251512516125171251812519125201252112522125231252412525125261252712528125291253012531125321253312534125351253612537125381253912540125411254212543125441254512546125471254812549125501255112552125531255412555125561255712558125591256012561125621256312564125651256612567125681256912570125711257212573125741257512576125771257812579125801258112582125831258412585125861258712588125891259012591125921259312594125951259612597125981259912600126011260212603126041260512606126071260812609126101261112612126131261412615126161261712618126191262012621126221262312624126251262612627126281262912630126311263212633126341263512636126371263812639126401264112642126431264412645126461264712648126491265012651126521265312654126551265612657126581265912660126611266212663126641266512666126671266812669126701267112672126731267412675126761267712678126791268012681126821268312684126851268612687126881268912690126911269212693126941269512696126971269812699127001270112702127031270412705127061270712708127091271012711127121271312714127151271612717127181271912720127211272212723127241272512726127271272812729127301273112732127331273412735127361273712738127391274012741127421274312744127451274612747127481274912750127511275212753127541275512756127571275812759127601276112762127631276412765127661276712768127691277012771127721277312774127751277612777127781277912780127811278212783127841278512786127871278812789127901279112792127931279412795127961279712798127991280012801128021280312804128051280612807128081280912810128111281212813128141281512816128171281812819128201282112822128231282412825128261282712828128291283012831128321283312834128351283612837128381283912840128411284212843128441284512846128471284812849128501285112852128531285412855128561285712858128591286012861128621286312864128651286612867128681286912870128711287212873128741287512876128771287812879128801288112882128831288412885128861288712888128891289012891128921289312894128951289612897128981289912900129011290212903129041290512906129071290812909129101291112912129131291412915129161291712918129191292012921129221292312924129251292612927129281292912930129311293212933129341293512936129371293812939129401294112942129431294412945129461294712948129491295012951129521295312954129551295612957129581295912960129611296212963129641296512966129671296812969129701297112972129731297412975129761297712978129791298012981129821298312984129851298612987129881298912990129911299212993129941299512996129971299812999130001300113002130031300413005130061300713008130091301013011130121301313014130151301613017130181301913020130211302213023130241302513026130271302813029130301303113032130331303413035130361303713038130391304013041130421304313044130451304613047130481304913050130511305213053130541305513056130571305813059130601306113062130631306413065130661306713068130691307013071130721307313074130751307613077130781307913080130811308213083130841308513086130871308813089130901309113092130931309413095130961309713098130991310013101131021310313104131051310613107131081310913110131111311213113131141311513116131171311813119131201312113122131231312413125131261312713128131291313013131131321313313134131351313613137131381313913140131411314213143131441314513146131471314813149131501315113152131531315413155131561315713158131591316013161131621316313164131651316613167131681316913170131711317213173131741317513176131771317813179131801318113182131831318413185131861318713188131891319013191131921319313194131951319613197131981319913200132011320213203132041320513206132071320813209132101321113212132131321413215132161321713218132191322013221132221322313224132251322613227132281322913230132311323213233132341323513236132371323813239132401324113242132431324413245132461324713248132491325013251132521325313254132551325613257132581325913260132611326213263132641326513266132671326813269132701327113272132731327413275132761327713278132791328013281132821328313284132851328613287132881328913290132911329213293132941329513296132971329813299133001330113302133031330413305133061330713308133091331013311133121331313314133151331613317133181331913320133211332213323133241332513326133271332813329133301333113332133331333413335133361333713338133391334013341133421334313344133451334613347133481334913350133511335213353133541335513356133571335813359133601336113362133631336413365133661336713368133691337013371133721337313374133751337613377133781337913380133811338213383133841338513386133871338813389133901339113392133931339413395133961339713398133991340013401134021340313404134051340613407134081340913410134111341213413134141341513416134171341813419134201342113422134231342413425134261342713428134291343013431134321343313434134351343613437134381343913440134411344213443134441344513446134471344813449134501345113452134531345413455134561345713458134591346013461134621346313464134651346613467134681346913470134711347213473134741347513476134771347813479134801348113482134831348413485134861348713488134891349013491134921349313494134951349613497134981349913500135011350213503135041350513506135071350813509135101351113512135131351413515135161351713518135191352013521135221352313524135251352613527135281352913530135311353213533135341353513536135371353813539135401354113542135431354413545135461354713548135491355013551135521355313554135551355613557135581355913560135611356213563135641356513566135671356813569135701357113572135731357413575135761357713578135791358013581135821358313584135851358613587135881358913590135911359213593135941359513596135971359813599136001360113602136031360413605136061360713608136091361013611136121361313614136151361613617136181361913620136211362213623136241362513626136271362813629136301363113632136331363413635136361363713638136391364013641136421364313644136451364613647136481364913650136511365213653136541365513656136571365813659136601366113662136631366413665136661366713668136691367013671136721367313674136751367613677136781367913680136811368213683136841368513686136871368813689136901369113692136931369413695136961369713698136991370013701137021370313704137051370613707137081370913710137111371213713137141371513716137171371813719137201372113722137231372413725137261372713728137291373013731137321373313734137351373613737137381373913740137411374213743137441374513746137471374813749137501375113752137531375413755137561375713758137591376013761137621376313764137651376613767137681376913770137711377213773137741377513776137771377813779137801378113782137831378413785137861378713788137891379013791137921379313794137951379613797137981379913800138011380213803138041380513806138071380813809138101381113812138131381413815138161381713818138191382013821138221382313824138251382613827138281382913830138311383213833138341383513836138371383813839138401384113842138431384413845138461384713848138491385013851138521385313854138551385613857138581385913860138611386213863138641386513866138671386813869138701387113872138731387413875138761387713878138791388013881138821388313884138851388613887138881388913890138911389213893138941389513896138971389813899139001390113902139031390413905139061390713908139091391013911139121391313914139151391613917139181391913920139211392213923139241392513926139271392813929139301393113932139331393413935139361393713938139391394013941139421394313944139451394613947139481394913950139511395213953139541395513956139571395813959139601396113962139631396413965139661396713968139691397013971139721397313974139751397613977139781397913980139811398213983139841398513986139871398813989139901399113992139931399413995139961399713998139991400014001140021400314004140051400614007140081400914010140111401214013140141401514016140171401814019140201402114022140231402414025140261402714028140291403014031140321403314034140351403614037140381403914040140411404214043140441404514046140471404814049140501405114052140531405414055140561405714058140591406014061140621406314064140651406614067140681406914070140711407214073140741407514076140771407814079140801408114082140831408414085140861408714088140891409014091140921409314094140951409614097140981409914100141011410214103141041410514106141071410814109141101411114112141131411414115141161411714118141191412014121141221412314124141251412614127141281412914130141311413214133141341413514136141371413814139141401414114142141431414414145141461414714148141491415014151141521415314154141551415614157141581415914160141611416214163141641416514166141671416814169141701417114172141731417414175141761417714178141791418014181141821418314184141851418614187141881418914190141911419214193141941419514196141971419814199142001420114202142031420414205142061420714208142091421014211142121421314214142151421614217142181421914220142211422214223142241422514226142271422814229142301423114232142331423414235142361423714238142391424014241142421424314244142451424614247142481424914250142511425214253142541425514256142571425814259142601426114262142631426414265142661426714268142691427014271142721427314274142751427614277142781427914280142811428214283142841428514286142871428814289142901429114292142931429414295142961429714298142991430014301143021430314304143051430614307143081430914310143111431214313143141431514316143171431814319143201432114322143231432414325143261432714328143291433014331143321433314334143351433614337143381433914340143411434214343143441434514346143471434814349143501435114352143531435414355143561435714358143591436014361143621436314364143651436614367143681436914370143711437214373143741437514376143771437814379143801438114382143831438414385143861438714388143891439014391143921439314394143951439614397143981439914400144011440214403144041440514406144071440814409144101441114412144131441414415144161441714418144191442014421144221442314424144251442614427144281442914430144311443214433144341443514436144371443814439144401444114442144431444414445144461444714448144491445014451144521445314454144551445614457144581445914460144611446214463144641446514466144671446814469144701447114472144731447414475144761447714478144791448014481144821448314484144851448614487144881448914490144911449214493144941449514496144971449814499145001450114502145031450414505145061450714508145091451014511145121451314514145151451614517145181451914520145211452214523145241452514526145271452814529145301453114532145331453414535145361453714538145391454014541145421454314544145451454614547145481454914550145511455214553145541455514556145571455814559145601456114562145631456414565145661456714568145691457014571145721457314574145751457614577145781457914580145811458214583145841458514586145871458814589145901459114592145931459414595145961459714598145991460014601146021460314604146051460614607146081460914610146111461214613146141461514616146171461814619146201462114622146231462414625146261462714628146291463014631146321463314634146351463614637146381463914640146411464214643146441464514646146471464814649146501465114652146531465414655146561465714658146591466014661146621466314664146651466614667146681466914670146711467214673146741467514676146771467814679146801468114682146831468414685146861468714688146891469014691146921469314694146951469614697146981469914700147011470214703147041470514706147071470814709147101471114712147131471414715147161471714718147191472014721147221472314724147251472614727147281472914730147311473214733147341473514736147371473814739147401474114742147431474414745147461474714748147491475014751147521475314754147551475614757147581475914760147611476214763147641476514766147671476814769147701477114772147731477414775147761477714778147791478014781147821478314784147851478614787147881478914790147911479214793147941479514796147971479814799148001480114802148031480414805148061480714808148091481014811148121481314814148151481614817148181481914820148211482214823148241482514826148271482814829148301483114832148331483414835148361483714838148391484014841148421484314844148451484614847148481484914850148511485214853148541485514856148571485814859148601486114862148631486414865148661486714868148691487014871148721487314874148751487614877148781487914880148811488214883148841488514886148871488814889148901489114892148931489414895148961489714898148991490014901149021490314904149051490614907149081490914910149111491214913149141491514916149171491814919149201492114922149231492414925149261492714928149291493014931149321493314934149351493614937149381493914940149411494214943149441494514946149471494814949149501495114952149531495414955149561495714958149591496014961149621496314964149651496614967149681496914970149711497214973149741497514976149771497814979149801498114982149831498414985149861498714988149891499014991149921499314994149951499614997149981499915000150011500215003150041500515006150071500815009150101501115012150131501415015150161501715018150191502015021150221502315024150251502615027150281502915030150311503215033150341503515036150371503815039150401504115042150431504415045150461504715048150491505015051150521505315054150551505615057150581505915060150611506215063150641506515066150671506815069150701507115072150731507415075150761507715078150791508015081150821508315084150851508615087150881508915090150911509215093150941509515096150971509815099151001510115102151031510415105151061510715108151091511015111151121511315114151151511615117151181511915120151211512215123151241512515126151271512815129151301513115132151331513415135151361513715138151391514015141151421514315144151451514615147151481514915150151511515215153151541515515156151571515815159151601516115162151631516415165151661516715168151691517015171151721517315174151751517615177151781517915180151811518215183151841518515186151871518815189151901519115192151931519415195151961519715198151991520015201152021520315204152051520615207152081520915210152111521215213152141521515216152171521815219152201522115222152231522415225152261522715228152291523015231152321523315234152351523615237152381523915240152411524215243152441524515246152471524815249152501525115252152531525415255152561525715258152591526015261152621526315264152651526615267152681526915270152711527215273152741527515276152771527815279152801528115282152831528415285152861528715288152891529015291152921529315294152951529615297152981529915300153011530215303153041530515306153071530815309153101531115312153131531415315153161531715318153191532015321153221532315324153251532615327153281532915330153311533215333153341533515336153371533815339153401534115342153431534415345153461534715348153491535015351153521535315354153551535615357153581535915360153611536215363153641536515366153671536815369153701537115372153731537415375153761537715378153791538015381153821538315384153851538615387153881538915390153911539215393153941539515396153971539815399154001540115402154031540415405154061540715408154091541015411154121541315414154151541615417154181541915420154211542215423154241542515426154271542815429154301543115432154331543415435154361543715438154391544015441154421544315444154451544615447154481544915450154511545215453154541545515456154571545815459154601546115462154631546415465154661546715468154691547015471154721547315474154751547615477154781547915480154811548215483154841548515486154871548815489154901549115492154931549415495154961549715498154991550015501155021550315504155051550615507155081550915510155111551215513155141551515516155171551815519155201552115522155231552415525155261552715528155291553015531155321553315534155351553615537155381553915540155411554215543155441554515546155471554815549155501555115552155531555415555155561555715558155591556015561155621556315564155651556615567155681556915570155711557215573155741557515576155771557815579155801558115582155831558415585155861558715588155891559015591155921559315594155951559615597155981559915600156011560215603156041560515606156071560815609156101561115612156131561415615156161561715618156191562015621156221562315624156251562615627156281562915630156311563215633156341563515636156371563815639156401564115642156431564415645156461564715648156491565015651156521565315654156551565615657156581565915660156611566215663156641566515666156671566815669156701567115672156731567415675156761567715678156791568015681156821568315684156851568615687156881568915690156911569215693156941569515696156971569815699157001570115702157031570415705157061570715708157091571015711157121571315714157151571615717157181571915720157211572215723157241572515726157271572815729157301573115732157331573415735157361573715738157391574015741157421574315744157451574615747157481574915750157511575215753157541575515756157571575815759157601576115762157631576415765157661576715768157691577015771157721577315774157751577615777157781577915780157811578215783157841578515786157871578815789157901579115792157931579415795157961579715798157991580015801158021580315804158051580615807158081580915810158111581215813158141581515816158171581815819158201582115822158231582415825158261582715828158291583015831158321583315834158351583615837158381583915840158411584215843158441584515846158471584815849158501585115852158531585415855158561585715858158591586015861158621586315864158651586615867158681586915870158711587215873158741587515876158771587815879158801588115882158831588415885158861588715888158891589015891158921589315894158951589615897158981589915900159011590215903159041590515906159071590815909159101591115912159131591415915159161591715918159191592015921159221592315924159251592615927159281592915930159311593215933159341593515936159371593815939159401594115942159431594415945159461594715948159491595015951159521595315954159551595615957159581595915960159611596215963159641596515966159671596815969159701597115972159731597415975159761597715978159791598015981159821598315984159851598615987159881598915990159911599215993159941599515996159971599815999160001600116002160031600416005160061600716008160091601016011160121601316014160151601616017160181601916020160211602216023160241602516026160271602816029160301603116032160331603416035160361603716038160391604016041160421604316044160451604616047160481604916050160511605216053160541605516056160571605816059160601606116062160631606416065160661606716068160691607016071160721607316074160751607616077160781607916080160811608216083160841608516086160871608816089160901609116092160931609416095160961609716098160991610016101161021610316104161051610616107161081610916110161111611216113161141611516116161171611816119161201612116122161231612416125161261612716128161291613016131161321613316134161351613616137161381613916140161411614216143161441614516146161471614816149161501615116152161531615416155161561615716158161591616016161161621616316164161651616616167161681616916170161711617216173161741617516176161771617816179161801618116182161831618416185161861618716188161891619016191161921619316194161951619616197161981619916200162011620216203162041620516206162071620816209162101621116212162131621416215162161621716218162191622016221162221622316224162251622616227162281622916230162311623216233162341623516236162371623816239162401624116242162431624416245162461624716248162491625016251162521625316254162551625616257162581625916260162611626216263162641626516266162671626816269162701627116272162731627416275162761627716278162791628016281162821628316284162851628616287162881628916290162911629216293162941629516296162971629816299163001630116302163031630416305163061630716308163091631016311163121631316314163151631616317163181631916320163211632216323163241632516326163271632816329163301633116332163331633416335163361633716338163391634016341163421634316344163451634616347163481634916350163511635216353163541635516356163571635816359163601636116362163631636416365163661636716368163691637016371163721637316374163751637616377163781637916380163811638216383163841638516386163871638816389163901639116392163931639416395163961639716398163991640016401164021640316404164051640616407164081640916410164111641216413164141641516416164171641816419164201642116422164231642416425164261642716428164291643016431164321643316434164351643616437164381643916440164411644216443164441644516446164471644816449164501645116452164531645416455164561645716458164591646016461164621646316464164651646616467164681646916470164711647216473164741647516476164771647816479164801648116482164831648416485164861648716488164891649016491164921649316494164951649616497164981649916500165011650216503165041650516506165071650816509165101651116512165131651416515165161651716518165191652016521165221652316524165251652616527165281652916530165311653216533165341653516536165371653816539165401654116542165431654416545165461654716548165491655016551165521655316554165551655616557165581655916560165611656216563165641656516566165671656816569165701657116572165731657416575165761657716578165791658016581165821658316584165851658616587165881658916590165911659216593165941659516596165971659816599166001660116602166031660416605166061660716608166091661016611166121661316614166151661616617166181661916620166211662216623166241662516626166271662816629166301663116632166331663416635166361663716638166391664016641166421664316644166451664616647166481664916650166511665216653166541665516656166571665816659166601666116662166631666416665166661666716668166691667016671166721667316674166751667616677166781667916680166811668216683166841668516686166871668816689166901669116692166931669416695166961669716698166991670016701167021670316704167051670616707167081670916710167111671216713167141671516716167171671816719167201672116722167231672416725167261672716728167291673016731167321673316734167351673616737167381673916740167411674216743167441674516746167471674816749167501675116752167531675416755167561675716758167591676016761167621676316764167651676616767167681676916770167711677216773167741677516776167771677816779167801678116782167831678416785167861678716788167891679016791167921679316794167951679616797167981679916800168011680216803168041680516806168071680816809168101681116812168131681416815168161681716818168191682016821168221682316824168251682616827168281682916830168311683216833168341683516836168371683816839168401684116842168431684416845168461684716848168491685016851168521685316854168551685616857168581685916860168611686216863168641686516866168671686816869168701687116872168731687416875168761687716878168791688016881168821688316884168851688616887168881688916890168911689216893168941689516896168971689816899169001690116902169031690416905169061690716908169091691016911169121691316914169151691616917169181691916920169211692216923169241692516926169271692816929169301693116932169331693416935169361693716938169391694016941169421694316944169451694616947169481694916950169511695216953169541695516956169571695816959169601696116962169631696416965169661696716968169691697016971169721697316974169751697616977169781697916980169811698216983169841698516986169871698816989169901699116992169931699416995169961699716998169991700017001170021700317004170051700617007170081700917010170111701217013170141701517016170171701817019170201702117022170231702417025170261702717028170291703017031170321703317034170351703617037170381703917040170411704217043170441704517046170471704817049170501705117052170531705417055170561705717058170591706017061170621706317064170651706617067170681706917070170711707217073170741707517076170771707817079170801708117082170831708417085170861708717088170891709017091170921709317094170951709617097170981709917100171011710217103171041710517106171071710817109171101711117112171131711417115171161711717118171191712017121171221712317124171251712617127171281712917130171311713217133171341713517136171371713817139171401714117142171431714417145171461714717148171491715017151171521715317154171551715617157171581715917160171611716217163171641716517166171671716817169171701717117172171731717417175171761717717178171791718017181171821718317184171851718617187171881718917190171911719217193171941719517196171971719817199172001720117202172031720417205172061720717208172091721017211172121721317214172151721617217172181721917220172211722217223172241722517226172271722817229172301723117232172331723417235172361723717238172391724017241172421724317244172451724617247172481724917250172511725217253172541725517256172571725817259172601726117262172631726417265172661726717268172691727017271172721727317274172751727617277172781727917280172811728217283172841728517286172871728817289172901729117292172931729417295172961729717298172991730017301173021730317304173051730617307173081730917310173111731217313173141731517316173171731817319173201732117322173231732417325173261732717328173291733017331173321733317334173351733617337173381733917340173411734217343173441734517346173471734817349173501735117352173531735417355173561735717358173591736017361173621736317364173651736617367173681736917370173711737217373173741737517376173771737817379173801738117382173831738417385173861738717388173891739017391173921739317394173951739617397173981739917400174011740217403174041740517406174071740817409174101741117412174131741417415174161741717418174191742017421174221742317424174251742617427174281742917430174311743217433174341743517436174371743817439174401744117442174431744417445174461744717448174491745017451174521745317454174551745617457174581745917460174611746217463174641746517466174671746817469174701747117472174731747417475174761747717478174791748017481174821748317484174851748617487174881748917490174911749217493174941749517496174971749817499175001750117502175031750417505175061750717508175091751017511175121751317514175151751617517175181751917520175211752217523175241752517526175271752817529175301753117532175331753417535175361753717538175391754017541175421754317544175451754617547175481754917550175511755217553175541755517556175571755817559175601756117562175631756417565175661756717568175691757017571175721757317574175751757617577175781757917580175811758217583175841758517586175871758817589175901759117592175931759417595175961759717598175991760017601176021760317604176051760617607176081760917610176111761217613176141761517616176171761817619176201762117622176231762417625176261762717628176291763017631176321763317634176351763617637176381763917640176411764217643176441764517646176471764817649176501765117652176531765417655176561765717658176591766017661176621766317664176651766617667176681766917670176711767217673176741767517676176771767817679176801768117682176831768417685176861768717688176891769017691176921769317694176951769617697176981769917700177011770217703177041770517706177071770817709177101771117712177131771417715177161771717718177191772017721177221772317724177251772617727177281772917730177311773217733177341773517736177371773817739177401774117742177431774417745177461774717748177491775017751177521775317754177551775617757177581775917760177611776217763177641776517766177671776817769177701777117772177731777417775177761777717778177791778017781177821778317784177851778617787177881778917790177911779217793177941779517796177971779817799178001780117802178031780417805178061780717808178091781017811178121781317814178151781617817178181781917820178211782217823178241782517826178271782817829178301783117832178331783417835178361783717838178391784017841178421784317844178451784617847178481784917850178511785217853178541785517856178571785817859178601786117862178631786417865178661786717868178691787017871178721787317874178751787617877178781787917880178811788217883178841788517886178871788817889178901789117892178931789417895178961789717898178991790017901179021790317904179051790617907179081790917910179111791217913179141791517916179171791817919179201792117922179231792417925179261792717928179291793017931179321793317934179351793617937179381793917940179411794217943179441794517946179471794817949179501795117952179531795417955179561795717958179591796017961179621796317964179651796617967179681796917970179711797217973179741797517976179771797817979179801798117982179831798417985179861798717988179891799017991179921799317994179951799617997179981799918000180011800218003180041800518006180071800818009180101801118012180131801418015180161801718018180191802018021180221802318024180251802618027180281802918030180311803218033180341803518036180371803818039180401804118042180431804418045180461804718048180491805018051180521805318054180551805618057180581805918060180611806218063180641806518066180671806818069180701807118072180731807418075180761807718078180791808018081180821808318084180851808618087180881808918090180911809218093180941809518096180971809818099181001810118102181031810418105181061810718108181091811018111181121811318114181151811618117181181811918120181211812218123181241812518126181271812818129181301813118132181331813418135181361813718138181391814018141181421814318144181451814618147181481814918150181511815218153181541815518156181571815818159181601816118162181631816418165181661816718168181691817018171181721817318174181751817618177181781817918180181811818218183181841818518186181871818818189181901819118192181931819418195181961819718198181991820018201182021820318204182051820618207182081820918210182111821218213182141821518216182171821818219182201822118222182231822418225182261822718228182291823018231182321823318234182351823618237182381823918240182411824218243182441824518246182471824818249182501825118252182531825418255182561825718258182591826018261182621826318264182651826618267182681826918270182711827218273182741827518276182771827818279182801828118282182831828418285182861828718288182891829018291182921829318294182951829618297182981829918300183011830218303183041830518306183071830818309183101831118312183131831418315183161831718318183191832018321183221832318324183251832618327183281832918330183311833218333183341833518336183371833818339183401834118342183431834418345183461834718348183491835018351183521835318354183551835618357183581835918360183611836218363183641836518366183671836818369183701837118372183731837418375183761837718378183791838018381183821838318384183851838618387183881838918390183911839218393183941839518396183971839818399184001840118402184031840418405184061840718408184091841018411184121841318414184151841618417184181841918420184211842218423184241842518426184271842818429184301843118432184331843418435184361843718438184391844018441184421844318444184451844618447184481844918450184511845218453184541845518456184571845818459184601846118462184631846418465184661846718468184691847018471184721847318474184751847618477184781847918480184811848218483184841848518486184871848818489184901849118492184931849418495184961849718498184991850018501185021850318504185051850618507185081850918510185111851218513185141851518516185171851818519185201852118522185231852418525185261852718528185291853018531185321853318534185351853618537185381853918540185411854218543185441854518546185471854818549185501855118552185531855418555185561855718558185591856018561185621856318564185651856618567185681856918570185711857218573185741857518576185771857818579185801858118582185831858418585185861858718588185891859018591185921859318594185951859618597185981859918600186011860218603186041860518606186071860818609186101861118612186131861418615186161861718618186191862018621186221862318624186251862618627186281862918630186311863218633186341863518636186371863818639186401864118642186431864418645186461864718648186491865018651186521865318654186551865618657186581865918660186611866218663186641866518666186671866818669186701867118672186731867418675186761867718678186791868018681186821868318684186851868618687186881868918690186911869218693186941869518696186971869818699187001870118702187031870418705187061870718708187091871018711187121871318714187151871618717187181871918720187211872218723187241872518726187271872818729187301873118732187331873418735187361873718738187391874018741187421874318744187451874618747187481874918750187511875218753187541875518756187571875818759187601876118762187631876418765187661876718768187691877018771187721877318774187751877618777187781877918780187811878218783187841878518786187871878818789187901879118792187931879418795187961879718798187991880018801188021880318804188051880618807188081880918810188111881218813188141881518816188171881818819188201882118822188231882418825188261882718828188291883018831188321883318834188351883618837188381883918840188411884218843188441884518846188471884818849188501885118852188531885418855188561885718858188591886018861188621886318864188651886618867188681886918870188711887218873188741887518876188771887818879188801888118882188831888418885188861888718888188891889018891188921889318894188951889618897188981889918900189011890218903189041890518906189071890818909189101891118912189131891418915189161891718918189191892018921189221892318924189251892618927189281892918930189311893218933189341893518936189371893818939189401894118942189431894418945189461894718948189491895018951189521895318954189551895618957189581895918960189611896218963189641896518966189671896818969189701897118972189731897418975189761897718978189791898018981189821898318984189851898618987189881898918990189911899218993189941899518996189971899818999190001900119002190031900419005190061900719008190091901019011190121901319014190151901619017190181901919020190211902219023190241902519026190271902819029190301903119032190331903419035190361903719038190391904019041190421904319044190451904619047190481904919050190511905219053190541905519056190571905819059190601906119062190631906419065190661906719068190691907019071190721907319074190751907619077190781907919080190811908219083190841908519086190871908819089190901909119092190931909419095190961909719098190991910019101191021910319104191051910619107191081910919110191111911219113191141911519116191171911819119191201912119122191231912419125191261912719128191291913019131191321913319134191351913619137191381913919140191411914219143191441914519146191471914819149191501915119152191531915419155191561915719158191591916019161191621916319164191651916619167191681916919170191711917219173191741917519176191771917819179191801918119182191831918419185191861918719188191891919019191191921919319194191951919619197191981919919200192011920219203192041920519206192071920819209192101921119212192131921419215192161921719218192191922019221192221922319224192251922619227192281922919230192311923219233192341923519236192371923819239192401924119242192431924419245192461924719248192491925019251192521925319254192551925619257192581925919260192611926219263192641926519266192671926819269192701927119272192731927419275192761927719278192791928019281192821928319284192851928619287192881928919290192911929219293192941929519296192971929819299193001930119302193031930419305193061930719308193091931019311193121931319314193151931619317193181931919320193211932219323193241932519326193271932819329193301933119332193331933419335193361933719338193391934019341193421934319344193451934619347193481934919350193511935219353193541935519356193571935819359193601936119362193631936419365193661936719368193691937019371193721937319374193751937619377193781937919380193811938219383193841938519386193871938819389193901939119392193931939419395193961939719398193991940019401194021940319404194051940619407194081940919410194111941219413194141941519416194171941819419194201942119422194231942419425194261942719428194291943019431194321943319434194351943619437194381943919440194411944219443194441944519446194471944819449194501945119452194531945419455194561945719458194591946019461194621946319464194651946619467194681946919470194711947219473194741947519476194771947819479194801948119482194831948419485194861948719488194891949019491194921949319494194951949619497194981949919500195011950219503195041950519506195071950819509195101951119512195131951419515195161951719518195191952019521195221952319524195251952619527195281952919530195311953219533195341953519536195371953819539195401954119542195431954419545195461954719548195491955019551195521955319554195551955619557195581955919560195611956219563195641956519566195671956819569195701957119572195731957419575195761957719578195791958019581195821958319584195851958619587195881958919590195911959219593195941959519596195971959819599196001960119602196031960419605196061960719608196091961019611196121961319614196151961619617196181961919620196211962219623196241962519626196271962819629196301963119632196331963419635196361963719638196391964019641196421964319644196451964619647196481964919650196511965219653196541965519656196571965819659196601966119662196631966419665196661966719668196691967019671196721967319674196751967619677196781967919680196811968219683196841968519686196871968819689196901969119692196931969419695196961969719698196991970019701197021970319704197051970619707197081970919710197111971219713197141971519716197171971819719197201972119722197231972419725197261972719728197291973019731197321973319734197351973619737197381973919740197411974219743197441974519746197471974819749197501975119752197531975419755197561975719758197591976019761197621976319764197651976619767197681976919770197711977219773197741977519776197771977819779197801978119782197831978419785197861978719788197891979019791197921979319794197951979619797197981979919800198011980219803198041980519806198071980819809198101981119812198131981419815198161981719818198191982019821198221982319824198251982619827198281982919830198311983219833198341983519836198371983819839198401984119842198431984419845198461984719848198491985019851198521985319854198551985619857198581985919860198611986219863198641986519866198671986819869198701987119872198731987419875198761987719878198791988019881198821988319884198851988619887198881988919890198911989219893198941989519896198971989819899199001990119902199031990419905199061990719908199091991019911199121991319914199151991619917199181991919920199211992219923199241992519926199271992819929199301993119932199331993419935199361993719938199391994019941199421994319944199451994619947199481994919950199511995219953199541995519956199571995819959199601996119962199631996419965199661996719968199691997019971199721997319974199751997619977199781997919980199811998219983199841998519986199871998819989199901999119992199931999419995199961999719998199992000020001200022000320004200052000620007200082000920010200112001220013200142001520016200172001820019200202002120022200232002420025200262002720028200292003020031200322003320034200352003620037200382003920040200412004220043200442004520046200472004820049200502005120052200532005420055200562005720058200592006020061200622006320064200652006620067200682006920070200712007220073200742007520076200772007820079200802008120082200832008420085200862008720088200892009020091200922009320094200952009620097200982009920100201012010220103201042010520106201072010820109201102011120112201132011420115201162011720118201192012020121201222012320124201252012620127201282012920130201312013220133201342013520136201372013820139201402014120142201432014420145201462014720148201492015020151201522015320154201552015620157201582015920160201612016220163201642016520166201672016820169201702017120172201732017420175201762017720178201792018020181201822018320184201852018620187201882018920190201912019220193201942019520196201972019820199202002020120202202032020420205202062020720208202092021020211202122021320214202152021620217202182021920220202212022220223202242022520226202272022820229202302023120232202332023420235202362023720238202392024020241202422024320244202452024620247202482024920250202512025220253202542025520256202572025820259202602026120262202632026420265202662026720268202692027020271202722027320274202752027620277202782027920280202812028220283202842028520286202872028820289202902029120292202932029420295202962029720298202992030020301203022030320304203052030620307203082030920310203112031220313203142031520316203172031820319203202032120322203232032420325203262032720328203292033020331203322033320334203352033620337203382033920340203412034220343203442034520346203472034820349203502035120352203532035420355203562035720358203592036020361203622036320364203652036620367203682036920370203712037220373203742037520376203772037820379203802038120382203832038420385203862038720388203892039020391203922039320394203952039620397203982039920400204012040220403204042040520406204072040820409204102041120412204132041420415204162041720418204192042020421204222042320424204252042620427204282042920430204312043220433204342043520436204372043820439204402044120442204432044420445204462044720448204492045020451204522045320454204552045620457204582045920460204612046220463204642046520466204672046820469204702047120472204732047420475204762047720478204792048020481204822048320484204852048620487204882048920490204912049220493204942049520496204972049820499205002050120502205032050420505205062050720508205092051020511205122051320514205152051620517205182051920520205212052220523205242052520526205272052820529205302053120532205332053420535205362053720538205392054020541205422054320544205452054620547205482054920550205512055220553205542055520556205572055820559205602056120562205632056420565205662056720568205692057020571205722057320574205752057620577205782057920580205812058220583205842058520586205872058820589205902059120592205932059420595205962059720598205992060020601206022060320604206052060620607206082060920610206112061220613206142061520616206172061820619206202062120622206232062420625206262062720628206292063020631206322063320634206352063620637206382063920640206412064220643206442064520646206472064820649206502065120652206532065420655206562065720658206592066020661206622066320664206652066620667206682066920670206712067220673206742067520676206772067820679206802068120682206832068420685206862068720688206892069020691206922069320694206952069620697206982069920700207012070220703207042070520706207072070820709207102071120712207132071420715207162071720718207192072020721207222072320724207252072620727207282072920730207312073220733207342073520736207372073820739207402074120742207432074420745207462074720748207492075020751207522075320754207552075620757207582075920760207612076220763207642076520766207672076820769207702077120772207732077420775207762077720778207792078020781207822078320784207852078620787207882078920790207912079220793207942079520796207972079820799208002080120802208032080420805208062080720808208092081020811208122081320814208152081620817208182081920820208212082220823208242082520826208272082820829208302083120832208332083420835208362083720838208392084020841208422084320844208452084620847208482084920850208512085220853208542085520856208572085820859208602086120862208632086420865208662086720868208692087020871208722087320874208752087620877208782087920880208812088220883208842088520886208872088820889208902089120892208932089420895208962089720898208992090020901209022090320904209052090620907209082090920910209112091220913209142091520916209172091820919209202092120922209232092420925209262092720928209292093020931209322093320934209352093620937209382093920940209412094220943209442094520946209472094820949209502095120952209532095420955209562095720958209592096020961209622096320964209652096620967209682096920970209712097220973209742097520976209772097820979209802098120982209832098420985209862098720988209892099020991209922099320994209952099620997209982099921000210012100221003210042100521006210072100821009210102101121012210132101421015210162101721018210192102021021210222102321024210252102621027210282102921030210312103221033210342103521036210372103821039210402104121042210432104421045210462104721048210492105021051210522105321054210552105621057210582105921060210612106221063210642106521066210672106821069210702107121072210732107421075210762107721078210792108021081210822108321084210852108621087210882108921090210912109221093210942109521096210972109821099211002110121102211032110421105211062110721108211092111021111211122111321114211152111621117211182111921120211212112221123211242112521126211272112821129211302113121132211332113421135211362113721138211392114021141211422114321144211452114621147211482114921150211512115221153211542115521156211572115821159211602116121162211632116421165211662116721168211692117021171211722117321174211752117621177211782117921180211812118221183211842118521186211872118821189211902119121192211932119421195211962119721198211992120021201212022120321204212052120621207212082120921210212112121221213212142121521216212172121821219212202122121222212232122421225212262122721228212292123021231212322123321234212352123621237212382123921240212412124221243212442124521246212472124821249212502125121252212532125421255212562125721258212592126021261212622126321264212652126621267212682126921270212712127221273212742127521276212772127821279212802128121282212832128421285212862128721288212892129021291212922129321294212952129621297212982129921300213012130221303213042130521306213072130821309213102131121312213132131421315213162131721318213192132021321213222132321324213252132621327213282132921330213312133221333213342133521336213372133821339213402134121342213432134421345213462134721348213492135021351213522135321354213552135621357213582135921360213612136221363213642136521366213672136821369213702137121372213732137421375213762137721378213792138021381213822138321384213852138621387213882138921390213912139221393213942139521396213972139821399214002140121402214032140421405214062140721408214092141021411214122141321414214152141621417214182141921420214212142221423214242142521426214272142821429214302143121432214332143421435214362143721438214392144021441214422144321444214452144621447214482144921450214512145221453214542145521456214572145821459214602146121462214632146421465214662146721468214692147021471214722147321474214752147621477214782147921480214812148221483214842148521486214872148821489214902149121492214932149421495214962149721498214992150021501215022150321504215052150621507215082150921510215112151221513215142151521516215172151821519215202152121522215232152421525215262152721528215292153021531215322153321534215352153621537215382153921540215412154221543215442154521546215472154821549215502155121552215532155421555215562155721558215592156021561215622156321564215652156621567215682156921570215712157221573215742157521576215772157821579215802158121582215832158421585215862158721588215892159021591215922159321594215952159621597215982159921600216012160221603216042160521606216072160821609216102161121612216132161421615216162161721618216192162021621216222162321624216252162621627216282162921630216312163221633216342163521636216372163821639216402164121642216432164421645216462164721648216492165021651216522165321654216552165621657216582165921660216612166221663216642166521666216672166821669216702167121672216732167421675216762167721678216792168021681216822168321684216852168621687216882168921690216912169221693216942169521696216972169821699217002170121702217032170421705217062170721708217092171021711217122171321714217152171621717217182171921720217212172221723217242172521726217272172821729217302173121732217332173421735217362173721738217392174021741217422174321744217452174621747217482174921750217512175221753217542175521756217572175821759217602176121762217632176421765217662176721768217692177021771217722177321774217752177621777217782177921780217812178221783217842178521786217872178821789217902179121792217932179421795217962179721798217992180021801218022180321804218052180621807218082180921810218112181221813218142181521816218172181821819218202182121822218232182421825218262182721828218292183021831218322183321834218352183621837218382183921840218412184221843218442184521846218472184821849218502185121852218532185421855218562185721858218592186021861218622186321864218652186621867218682186921870218712187221873218742187521876218772187821879218802188121882218832188421885218862188721888218892189021891218922189321894218952189621897218982189921900219012190221903219042190521906219072190821909219102191121912219132191421915219162191721918219192192021921219222192321924219252192621927219282192921930219312193221933219342193521936219372193821939219402194121942219432194421945219462194721948219492195021951219522195321954219552195621957219582195921960219612196221963219642196521966219672196821969219702197121972219732197421975219762197721978219792198021981219822198321984219852198621987219882198921990219912199221993219942199521996219972199821999220002200122002220032200422005220062200722008220092201022011220122201322014220152201622017220182201922020220212202222023220242202522026220272202822029220302203122032220332203422035220362203722038220392204022041220422204322044220452204622047220482204922050220512205222053220542205522056220572205822059220602206122062220632206422065220662206722068220692207022071220722207322074220752207622077220782207922080220812208222083220842208522086220872208822089220902209122092220932209422095220962209722098220992210022101221022210322104221052210622107221082210922110221112211222113221142211522116221172211822119221202212122122221232212422125221262212722128221292213022131221322213322134221352213622137221382213922140221412214222143221442214522146221472214822149221502215122152221532215422155221562215722158221592216022161221622216322164221652216622167221682216922170221712217222173221742217522176221772217822179221802218122182221832218422185221862218722188221892219022191221922219322194221952219622197221982219922200222012220222203222042220522206222072220822209222102221122212222132221422215222162221722218222192222022221222222222322224222252222622227222282222922230222312223222233222342223522236222372223822239222402224122242222432224422245222462224722248222492225022251222522225322254222552225622257222582225922260222612226222263222642226522266222672226822269222702227122272222732227422275222762227722278222792228022281222822228322284222852228622287222882228922290222912229222293222942229522296222972229822299223002230122302223032230422305223062230722308223092231022311223122231322314223152231622317223182231922320223212232222323223242232522326223272232822329223302233122332223332233422335223362233722338223392234022341223422234322344223452234622347223482234922350223512235222353223542235522356223572235822359223602236122362223632236422365223662236722368223692237022371223722237322374223752237622377223782237922380223812238222383223842238522386223872238822389223902239122392223932239422395223962239722398223992240022401224022240322404224052240622407224082240922410224112241222413224142241522416224172241822419224202242122422224232242422425224262242722428224292243022431224322243322434224352243622437224382243922440224412244222443224442244522446224472244822449224502245122452224532245422455224562245722458224592246022461224622246322464224652246622467224682246922470224712247222473224742247522476224772247822479224802248122482224832248422485224862248722488224892249022491224922249322494224952249622497224982249922500225012250222503225042250522506225072250822509225102251122512225132251422515225162251722518225192252022521225222252322524225252252622527225282252922530225312253222533225342253522536225372253822539225402254122542225432254422545225462254722548225492255022551225522255322554225552255622557225582255922560225612256222563225642256522566225672256822569225702257122572225732257422575225762257722578225792258022581225822258322584225852258622587225882258922590225912259222593225942259522596225972259822599226002260122602226032260422605226062260722608226092261022611226122261322614226152261622617226182261922620226212262222623226242262522626226272262822629226302263122632226332263422635226362263722638226392264022641226422264322644226452264622647226482264922650226512265222653226542265522656226572265822659226602266122662226632266422665226662266722668226692267022671226722267322674226752267622677226782267922680226812268222683226842268522686226872268822689226902269122692226932269422695226962269722698226992270022701227022270322704227052270622707227082270922710227112271222713227142271522716227172271822719227202272122722227232272422725227262272722728227292273022731227322273322734227352273622737227382273922740227412274222743227442274522746227472274822749227502275122752227532275422755227562275722758227592276022761227622276322764227652276622767227682276922770227712277222773227742277522776227772277822779227802278122782227832278422785227862278722788227892279022791227922279322794227952279622797227982279922800228012280222803228042280522806228072280822809228102281122812228132281422815228162281722818228192282022821228222282322824228252282622827228282282922830228312283222833228342283522836228372283822839228402284122842228432284422845228462284722848228492285022851228522285322854228552285622857228582285922860228612286222863228642286522866228672286822869228702287122872228732287422875228762287722878228792288022881228822288322884228852288622887228882288922890228912289222893228942289522896228972289822899229002290122902229032290422905229062290722908229092291022911229122291322914229152291622917229182291922920229212292222923229242292522926229272292822929229302293122932229332293422935229362293722938229392294022941229422294322944229452294622947229482294922950229512295222953229542295522956229572295822959229602296122962229632296422965229662296722968229692297022971229722297322974229752297622977229782297922980229812298222983229842298522986229872298822989229902299122992229932299422995229962299722998229992300023001230022300323004230052300623007230082300923010230112301223013230142301523016230172301823019230202302123022230232302423025230262302723028230292303023031230322303323034230352303623037230382303923040230412304223043230442304523046230472304823049230502305123052230532305423055230562305723058230592306023061230622306323064230652306623067230682306923070230712307223073230742307523076230772307823079230802308123082230832308423085230862308723088230892309023091230922309323094230952309623097230982309923100231012310223103231042310523106231072310823109231102311123112231132311423115231162311723118231192312023121231222312323124231252312623127231282312923130231312313223133231342313523136231372313823139231402314123142231432314423145231462314723148231492315023151231522315323154231552315623157231582315923160231612316223163231642316523166231672316823169231702317123172231732317423175231762317723178231792318023181231822318323184231852318623187231882318923190231912319223193231942319523196231972319823199232002320123202232032320423205232062320723208232092321023211232122321323214232152321623217232182321923220232212322223223232242322523226232272322823229232302323123232232332323423235232362323723238232392324023241232422324323244232452324623247232482324923250232512325223253232542325523256232572325823259232602326123262232632326423265232662326723268232692327023271232722327323274232752327623277232782327923280232812328223283232842328523286232872328823289232902329123292232932329423295232962329723298232992330023301233022330323304233052330623307233082330923310233112331223313233142331523316233172331823319233202332123322233232332423325233262332723328233292333023331233322333323334233352333623337233382333923340233412334223343233442334523346233472334823349233502335123352233532335423355233562335723358233592336023361233622336323364233652336623367233682336923370233712337223373233742337523376233772337823379233802338123382233832338423385233862338723388233892339023391233922339323394233952339623397233982339923400234012340223403234042340523406234072340823409234102341123412234132341423415234162341723418234192342023421234222342323424234252342623427234282342923430234312343223433234342343523436234372343823439234402344123442234432344423445234462344723448234492345023451234522345323454234552345623457234582345923460234612346223463234642346523466234672346823469234702347123472234732347423475234762347723478234792348023481234822348323484234852348623487234882348923490234912349223493234942349523496234972349823499235002350123502235032350423505235062350723508235092351023511235122351323514235152351623517235182351923520235212352223523235242352523526235272352823529235302353123532235332353423535235362353723538235392354023541235422354323544235452354623547235482354923550235512355223553235542355523556235572355823559235602356123562235632356423565235662356723568235692357023571235722357323574235752357623577235782357923580235812358223583235842358523586235872358823589235902359123592235932359423595235962359723598235992360023601236022360323604236052360623607236082360923610236112361223613236142361523616236172361823619236202362123622236232362423625236262362723628236292363023631236322363323634236352363623637236382363923640236412364223643236442364523646236472364823649236502365123652236532365423655236562365723658236592366023661236622366323664236652366623667236682366923670236712367223673236742367523676236772367823679236802368123682236832368423685236862368723688236892369023691236922369323694236952369623697236982369923700237012370223703237042370523706237072370823709237102371123712237132371423715237162371723718237192372023721237222372323724237252372623727237282372923730237312373223733237342373523736237372373823739237402374123742237432374423745237462374723748237492375023751237522375323754237552375623757237582375923760237612376223763237642376523766237672376823769237702377123772237732377423775237762377723778237792378023781237822378323784237852378623787237882378923790237912379223793237942379523796237972379823799238002380123802238032380423805238062380723808238092381023811238122381323814238152381623817238182381923820238212382223823238242382523826238272382823829238302383123832238332383423835238362383723838238392384023841238422384323844238452384623847238482384923850238512385223853238542385523856238572385823859238602386123862238632386423865238662386723868238692387023871238722387323874238752387623877238782387923880238812388223883238842388523886238872388823889238902389123892238932389423895238962389723898238992390023901239022390323904239052390623907239082390923910239112391223913239142391523916239172391823919239202392123922239232392423925239262392723928239292393023931239322393323934239352393623937239382393923940239412394223943239442394523946239472394823949239502395123952239532395423955239562395723958239592396023961239622396323964239652396623967239682396923970239712397223973239742397523976239772397823979239802398123982239832398423985239862398723988239892399023991239922399323994239952399623997239982399924000240012400224003240042400524006240072400824009240102401124012240132401424015240162401724018240192402024021240222402324024240252402624027240282402924030240312403224033240342403524036240372403824039240402404124042240432404424045240462404724048240492405024051240522405324054240552405624057240582405924060240612406224063240642406524066240672406824069240702407124072240732407424075240762407724078240792408024081240822408324084240852408624087240882408924090240912409224093240942409524096240972409824099241002410124102241032410424105241062410724108241092411024111241122411324114241152411624117241182411924120241212412224123241242412524126241272412824129241302413124132241332413424135241362413724138241392414024141241422414324144241452414624147241482414924150241512415224153241542415524156241572415824159241602416124162241632416424165241662416724168241692417024171241722417324174241752417624177241782417924180241812418224183241842418524186241872418824189241902419124192241932419424195241962419724198241992420024201242022420324204242052420624207242082420924210242112421224213242142421524216242172421824219242202422124222242232422424225242262422724228242292423024231242322423324234242352423624237242382423924240242412424224243242442424524246242472424824249242502425124252242532425424255242562425724258242592426024261242622426324264242652426624267242682426924270242712427224273242742427524276242772427824279242802428124282242832428424285242862428724288242892429024291242922429324294242952429624297242982429924300243012430224303243042430524306243072430824309243102431124312243132431424315243162431724318243192432024321243222432324324243252432624327243282432924330243312433224333243342433524336243372433824339243402434124342243432434424345243462434724348243492435024351243522435324354243552435624357243582435924360243612436224363243642436524366243672436824369243702437124372243732437424375243762437724378243792438024381243822438324384243852438624387243882438924390243912439224393243942439524396243972439824399244002440124402244032440424405244062440724408244092441024411244122441324414244152441624417244182441924420244212442224423244242442524426244272442824429244302443124432244332443424435244362443724438244392444024441244422444324444244452444624447244482444924450244512445224453244542445524456244572445824459244602446124462244632446424465244662446724468244692447024471244722447324474244752447624477244782447924480244812448224483244842448524486244872448824489244902449124492244932449424495244962449724498244992450024501245022450324504245052450624507245082450924510245112451224513245142451524516245172451824519245202452124522245232452424525245262452724528245292453024531245322453324534245352453624537245382453924540245412454224543245442454524546245472454824549245502455124552245532455424555245562455724558245592456024561245622456324564245652456624567245682456924570245712457224573245742457524576245772457824579245802458124582245832458424585245862458724588245892459024591245922459324594245952459624597245982459924600246012460224603246042460524606246072460824609246102461124612246132461424615246162461724618246192462024621246222462324624246252462624627246282462924630246312463224633246342463524636246372463824639246402464124642246432464424645246462464724648246492465024651246522465324654246552465624657246582465924660246612466224663246642466524666246672466824669246702467124672246732467424675246762467724678246792468024681246822468324684246852468624687246882468924690246912469224693246942469524696246972469824699247002470124702247032470424705247062470724708247092471024711247122471324714247152471624717247182471924720247212472224723247242472524726247272472824729247302473124732247332473424735247362473724738247392474024741247422474324744247452474624747247482474924750247512475224753247542475524756247572475824759247602476124762247632476424765247662476724768247692477024771247722477324774247752477624777247782477924780247812478224783247842478524786247872478824789247902479124792247932479424795247962479724798247992480024801248022480324804248052480624807248082480924810248112481224813248142481524816248172481824819248202482124822248232482424825248262482724828248292483024831248322483324834248352483624837248382483924840248412484224843248442484524846248472484824849248502485124852248532485424855248562485724858248592486024861248622486324864248652486624867248682486924870248712487224873248742487524876248772487824879248802488124882248832488424885248862488724888248892489024891248922489324894248952489624897248982489924900249012490224903249042490524906249072490824909249102491124912249132491424915249162491724918249192492024921249222492324924249252492624927249282492924930249312493224933249342493524936249372493824939249402494124942249432494424945249462494724948249492495024951249522495324954249552495624957249582495924960249612496224963249642496524966249672496824969249702497124972249732497424975249762497724978249792498024981249822498324984249852498624987249882498924990249912499224993249942499524996249972499824999250002500125002250032500425005250062500725008250092501025011250122501325014250152501625017250182501925020250212502225023250242502525026250272502825029250302503125032250332503425035250362503725038250392504025041250422504325044250452504625047250482504925050250512505225053250542505525056250572505825059250602506125062250632506425065250662506725068250692507025071250722507325074250752507625077250782507925080250812508225083250842508525086250872508825089250902509125092250932509425095250962509725098250992510025101251022510325104251052510625107251082510925110251112511225113251142511525116251172511825119251202512125122251232512425125251262512725128251292513025131251322513325134251352513625137251382513925140251412514225143251442514525146251472514825149251502515125152251532515425155251562515725158251592516025161251622516325164251652516625167251682516925170251712517225173251742517525176251772517825179251802518125182251832518425185251862518725188251892519025191251922519325194251952519625197251982519925200252012520225203252042520525206252072520825209252102521125212252132521425215252162521725218252192522025221252222522325224252252522625227252282522925230252312523225233252342523525236252372523825239252402524125242252432524425245252462524725248252492525025251252522525325254252552525625257252582525925260252612526225263252642526525266252672526825269252702527125272252732527425275252762527725278252792528025281252822528325284252852528625287252882528925290252912529225293252942529525296252972529825299253002530125302253032530425305253062530725308253092531025311253122531325314253152531625317253182531925320253212532225323253242532525326253272532825329253302533125332253332533425335253362533725338253392534025341253422534325344253452534625347253482534925350253512535225353253542535525356253572535825359253602536125362253632536425365253662536725368253692537025371253722537325374253752537625377253782537925380253812538225383253842538525386253872538825389253902539125392253932539425395253962539725398253992540025401254022540325404254052540625407254082540925410254112541225413254142541525416254172541825419254202542125422254232542425425254262542725428254292543025431254322543325434254352543625437254382543925440254412544225443254442544525446254472544825449254502545125452254532545425455254562545725458254592546025461254622546325464254652546625467254682546925470254712547225473254742547525476254772547825479254802548125482254832548425485254862548725488254892549025491254922549325494254952549625497254982549925500255012550225503255042550525506255072550825509255102551125512255132551425515255162551725518255192552025521255222552325524255252552625527255282552925530255312553225533255342553525536255372553825539255402554125542255432554425545255462554725548255492555025551255522555325554255552555625557255582555925560255612556225563255642556525566255672556825569255702557125572255732557425575255762557725578255792558025581255822558325584255852558625587255882558925590255912559225593255942559525596255972559825599256002560125602256032560425605256062560725608256092561025611256122561325614256152561625617256182561925620256212562225623256242562525626256272562825629256302563125632256332563425635256362563725638256392564025641256422564325644256452564625647256482564925650256512565225653256542565525656256572565825659256602566125662256632566425665256662566725668256692567025671256722567325674256752567625677256782567925680256812568225683256842568525686256872568825689256902569125692256932569425695256962569725698256992570025701257022570325704257052570625707257082570925710257112571225713257142571525716257172571825719257202572125722257232572425725257262572725728257292573025731257322573325734257352573625737257382573925740257412574225743257442574525746257472574825749257502575125752257532575425755257562575725758257592576025761257622576325764257652576625767257682576925770257712577225773257742577525776257772577825779257802578125782257832578425785257862578725788257892579025791257922579325794257952579625797257982579925800258012580225803258042580525806258072580825809258102581125812258132581425815258162581725818258192582025821258222582325824258252582625827258282582925830258312583225833258342583525836258372583825839258402584125842258432584425845258462584725848258492585025851258522585325854258552585625857258582585925860258612586225863258642586525866258672586825869258702587125872258732587425875258762587725878258792588025881258822588325884258852588625887258882588925890258912589225893258942589525896258972589825899259002590125902259032590425905259062590725908259092591025911259122591325914259152591625917259182591925920259212592225923259242592525926259272592825929259302593125932259332593425935259362593725938259392594025941259422594325944259452594625947259482594925950259512595225953259542595525956259572595825959259602596125962259632596425965259662596725968259692597025971259722597325974259752597625977259782597925980259812598225983259842598525986259872598825989259902599125992259932599425995259962599725998259992600026001260022600326004260052600626007260082600926010260112601226013260142601526016260172601826019260202602126022260232602426025260262602726028260292603026031260322603326034260352603626037260382603926040260412604226043260442604526046260472604826049260502605126052260532605426055260562605726058260592606026061260622606326064260652606626067260682606926070260712607226073260742607526076260772607826079260802608126082260832608426085260862608726088260892609026091260922609326094260952609626097260982609926100261012610226103261042610526106261072610826109261102611126112261132611426115261162611726118261192612026121261222612326124261252612626127261282612926130261312613226133261342613526136261372613826139261402614126142261432614426145261462614726148261492615026151261522615326154261552615626157261582615926160261612616226163261642616526166261672616826169261702617126172261732617426175261762617726178261792618026181261822618326184261852618626187261882618926190261912619226193261942619526196261972619826199262002620126202262032620426205262062620726208262092621026211262122621326214262152621626217262182621926220262212622226223262242622526226262272622826229262302623126232262332623426235262362623726238262392624026241262422624326244262452624626247262482624926250262512625226253262542625526256262572625826259262602626126262262632626426265262662626726268262692627026271262722627326274262752627626277262782627926280262812628226283262842628526286262872628826289262902629126292262932629426295262962629726298262992630026301263022630326304263052630626307263082630926310263112631226313263142631526316263172631826319263202632126322263232632426325263262632726328263292633026331263322633326334263352633626337263382633926340263412634226343263442634526346263472634826349263502635126352263532635426355263562635726358263592636026361263622636326364263652636626367263682636926370263712637226373263742637526376263772637826379263802638126382263832638426385263862638726388263892639026391263922639326394263952639626397263982639926400264012640226403264042640526406264072640826409264102641126412264132641426415264162641726418264192642026421264222642326424264252642626427264282642926430264312643226433264342643526436264372643826439264402644126442264432644426445264462644726448264492645026451264522645326454264552645626457264582645926460264612646226463264642646526466264672646826469264702647126472264732647426475264762647726478264792648026481264822648326484264852648626487264882648926490264912649226493264942649526496264972649826499265002650126502265032650426505265062650726508265092651026511265122651326514265152651626517265182651926520265212652226523265242652526526265272652826529265302653126532265332653426535265362653726538265392654026541265422654326544265452654626547265482654926550265512655226553265542655526556265572655826559265602656126562265632656426565265662656726568265692657026571265722657326574265752657626577265782657926580265812658226583265842658526586265872658826589265902659126592265932659426595265962659726598265992660026601266022660326604266052660626607266082660926610266112661226613266142661526616266172661826619266202662126622266232662426625266262662726628266292663026631266322663326634266352663626637266382663926640266412664226643266442664526646266472664826649266502665126652266532665426655266562665726658266592666026661266622666326664266652666626667266682666926670266712667226673266742667526676266772667826679266802668126682266832668426685266862668726688266892669026691266922669326694266952669626697266982669926700267012670226703267042670526706267072670826709267102671126712267132671426715267162671726718267192672026721267222672326724267252672626727267282672926730267312673226733267342673526736267372673826739267402674126742267432674426745267462674726748267492675026751267522675326754267552675626757267582675926760267612676226763267642676526766267672676826769267702677126772267732677426775267762677726778267792678026781267822678326784267852678626787267882678926790267912679226793267942679526796267972679826799268002680126802268032680426805268062680726808268092681026811268122681326814268152681626817268182681926820268212682226823268242682526826268272682826829268302683126832268332683426835268362683726838268392684026841268422684326844268452684626847268482684926850268512685226853268542685526856268572685826859268602686126862268632686426865268662686726868268692687026871268722687326874268752687626877268782687926880268812688226883268842688526886268872688826889268902689126892268932689426895268962689726898268992690026901269022690326904269052690626907269082690926910269112691226913269142691526916269172691826919269202692126922269232692426925269262692726928269292693026931269322693326934269352693626937269382693926940269412694226943269442694526946269472694826949269502695126952269532695426955269562695726958269592696026961269622696326964269652696626967269682696926970269712697226973269742697526976269772697826979269802698126982269832698426985269862698726988269892699026991269922699326994269952699626997269982699927000270012700227003270042700527006270072700827009270102701127012270132701427015270162701727018270192702027021270222702327024270252702627027270282702927030270312703227033270342703527036270372703827039270402704127042270432704427045270462704727048270492705027051270522705327054270552705627057270582705927060270612706227063270642706527066270672706827069270702707127072270732707427075270762707727078270792708027081270822708327084270852708627087270882708927090270912709227093270942709527096270972709827099271002710127102271032710427105271062710727108271092711027111271122711327114271152711627117271182711927120271212712227123271242712527126271272712827129271302713127132271332713427135271362713727138271392714027141271422714327144271452714627147271482714927150271512715227153271542715527156271572715827159271602716127162271632716427165271662716727168271692717027171271722717327174271752717627177271782717927180271812718227183271842718527186271872718827189271902719127192271932719427195271962719727198271992720027201272022720327204272052720627207272082720927210272112721227213272142721527216272172721827219272202722127222272232722427225272262722727228272292723027231272322723327234272352723627237272382723927240272412724227243272442724527246272472724827249272502725127252272532725427255272562725727258272592726027261272622726327264272652726627267272682726927270272712727227273272742727527276272772727827279272802728127282272832728427285272862728727288272892729027291272922729327294272952729627297272982729927300273012730227303273042730527306273072730827309273102731127312273132731427315273162731727318273192732027321273222732327324273252732627327273282732927330273312733227333273342733527336273372733827339273402734127342273432734427345273462734727348273492735027351273522735327354273552735627357273582735927360273612736227363273642736527366273672736827369273702737127372273732737427375273762737727378273792738027381273822738327384273852738627387273882738927390273912739227393273942739527396273972739827399274002740127402274032740427405274062740727408274092741027411274122741327414274152741627417274182741927420274212742227423274242742527426274272742827429274302743127432274332743427435274362743727438274392744027441274422744327444274452744627447274482744927450274512745227453274542745527456274572745827459274602746127462274632746427465274662746727468274692747027471274722747327474274752747627477274782747927480274812748227483274842748527486274872748827489274902749127492274932749427495274962749727498274992750027501275022750327504275052750627507275082750927510275112751227513275142751527516275172751827519275202752127522275232752427525275262752727528275292753027531275322753327534275352753627537275382753927540275412754227543275442754527546275472754827549275502755127552275532755427555275562755727558275592756027561275622756327564275652756627567275682756927570275712757227573275742757527576275772757827579275802758127582275832758427585275862758727588275892759027591275922759327594275952759627597275982759927600276012760227603276042760527606276072760827609276102761127612276132761427615276162761727618276192762027621276222762327624276252762627627276282762927630276312763227633276342763527636276372763827639276402764127642276432764427645276462764727648276492765027651276522765327654276552765627657276582765927660276612766227663276642766527666276672766827669276702767127672276732767427675276762767727678276792768027681276822768327684276852768627687276882768927690276912769227693276942769527696276972769827699277002770127702277032770427705277062770727708277092771027711277122771327714277152771627717277182771927720277212772227723277242772527726277272772827729277302773127732277332773427735277362773727738277392774027741277422774327744277452774627747277482774927750277512775227753277542775527756277572775827759277602776127762277632776427765277662776727768277692777027771277722777327774277752777627777277782777927780277812778227783277842778527786277872778827789277902779127792277932779427795277962779727798277992780027801278022780327804278052780627807278082780927810278112781227813278142781527816278172781827819278202782127822278232782427825278262782727828278292783027831278322783327834278352783627837278382783927840278412784227843278442784527846278472784827849278502785127852278532785427855278562785727858278592786027861278622786327864278652786627867278682786927870278712787227873278742787527876278772787827879278802788127882278832788427885278862788727888278892789027891278922789327894278952789627897278982789927900279012790227903279042790527906279072790827909279102791127912279132791427915279162791727918279192792027921279222792327924279252792627927279282792927930279312793227933279342793527936279372793827939279402794127942279432794427945279462794727948279492795027951279522795327954279552795627957279582795927960279612796227963279642796527966279672796827969279702797127972279732797427975279762797727978279792798027981279822798327984279852798627987279882798927990279912799227993279942799527996279972799827999280002800128002280032800428005280062800728008280092801028011280122801328014280152801628017280182801928020280212802228023280242802528026280272802828029280302803128032280332803428035280362803728038280392804028041280422804328044280452804628047280482804928050280512805228053280542805528056280572805828059280602806128062280632806428065280662806728068280692807028071280722807328074280752807628077280782807928080280812808228083280842808528086280872808828089280902809128092280932809428095280962809728098280992810028101281022810328104281052810628107281082810928110281112811228113281142811528116281172811828119281202812128122281232812428125281262812728128281292813028131281322813328134281352813628137281382813928140281412814228143281442814528146281472814828149281502815128152281532815428155281562815728158281592816028161281622816328164281652816628167281682816928170281712817228173281742817528176281772817828179281802818128182281832818428185281862818728188281892819028191281922819328194281952819628197281982819928200282012820228203282042820528206282072820828209282102821128212282132821428215282162821728218282192822028221282222822328224282252822628227282282822928230282312823228233282342823528236282372823828239282402824128242282432824428245282462824728248282492825028251282522825328254282552825628257282582825928260282612826228263282642826528266282672826828269282702827128272282732827428275282762827728278282792828028281282822828328284282852828628287282882828928290282912829228293282942829528296282972829828299283002830128302283032830428305283062830728308283092831028311283122831328314283152831628317283182831928320283212832228323283242832528326283272832828329283302833128332283332833428335283362833728338283392834028341283422834328344283452834628347283482834928350283512835228353283542835528356283572835828359283602836128362283632836428365283662836728368283692837028371283722837328374283752837628377283782837928380283812838228383283842838528386283872838828389283902839128392283932839428395283962839728398283992840028401284022840328404284052840628407284082840928410284112841228413284142841528416284172841828419284202842128422284232842428425284262842728428284292843028431284322843328434284352843628437284382843928440284412844228443284442844528446284472844828449284502845128452284532845428455284562845728458284592846028461284622846328464284652846628467284682846928470284712847228473284742847528476284772847828479284802848128482284832848428485284862848728488284892849028491284922849328494284952849628497284982849928500285012850228503285042850528506285072850828509285102851128512285132851428515285162851728518285192852028521285222852328524285252852628527285282852928530285312853228533285342853528536285372853828539285402854128542285432854428545285462854728548285492855028551285522855328554285552855628557285582855928560285612856228563285642856528566285672856828569285702857128572285732857428575285762857728578285792858028581285822858328584285852858628587285882858928590285912859228593285942859528596285972859828599286002860128602286032860428605286062860728608286092861028611286122861328614286152861628617286182861928620286212862228623286242862528626286272862828629286302863128632286332863428635286362863728638286392864028641286422864328644286452864628647286482864928650286512865228653286542865528656286572865828659286602866128662286632866428665286662866728668286692867028671286722867328674286752867628677286782867928680286812868228683286842868528686286872868828689286902869128692286932869428695286962869728698286992870028701287022870328704287052870628707287082870928710287112871228713287142871528716287172871828719287202872128722287232872428725287262872728728287292873028731287322873328734287352873628737287382873928740287412874228743287442874528746287472874828749287502875128752287532875428755287562875728758287592876028761287622876328764287652876628767287682876928770287712877228773287742877528776287772877828779287802878128782287832878428785287862878728788287892879028791287922879328794287952879628797287982879928800288012880228803288042880528806288072880828809288102881128812288132881428815288162881728818288192882028821288222882328824288252882628827288282882928830288312883228833288342883528836288372883828839288402884128842288432884428845288462884728848288492885028851288522885328854288552885628857288582885928860288612886228863288642886528866288672886828869288702887128872288732887428875288762887728878288792888028881288822888328884288852888628887288882888928890288912889228893288942889528896288972889828899289002890128902289032890428905289062890728908289092891028911289122891328914289152891628917289182891928920289212892228923289242892528926289272892828929289302893128932289332893428935289362893728938289392894028941289422894328944289452894628947289482894928950289512895228953289542895528956289572895828959289602896128962289632896428965289662896728968289692897028971289722897328974289752897628977289782897928980289812898228983289842898528986289872898828989289902899128992289932899428995289962899728998289992900029001290022900329004290052900629007290082900929010290112901229013290142901529016290172901829019290202902129022290232902429025290262902729028290292903029031290322903329034290352903629037290382903929040290412904229043290442904529046290472904829049290502905129052290532905429055290562905729058290592906029061290622906329064290652906629067290682906929070290712907229073290742907529076290772907829079290802908129082290832908429085290862908729088290892909029091290922909329094290952909629097290982909929100291012910229103291042910529106291072910829109291102911129112291132911429115291162911729118291192912029121291222912329124291252912629127291282912929130291312913229133291342913529136291372913829139291402914129142291432914429145291462914729148291492915029151291522915329154291552915629157291582915929160291612916229163291642916529166291672916829169291702917129172291732917429175291762917729178291792918029181291822918329184291852918629187291882918929190291912919229193291942919529196291972919829199292002920129202292032920429205292062920729208292092921029211292122921329214292152921629217292182921929220292212922229223292242922529226292272922829229292302923129232292332923429235292362923729238292392924029241292422924329244292452924629247292482924929250292512925229253292542925529256292572925829259292602926129262292632926429265292662926729268292692927029271292722927329274292752927629277292782927929280292812928229283292842928529286292872928829289292902929129292292932929429295292962929729298292992930029301293022930329304293052930629307293082930929310293112931229313293142931529316293172931829319293202932129322293232932429325293262932729328293292933029331293322933329334293352933629337293382933929340293412934229343293442934529346293472934829349293502935129352293532935429355293562935729358293592936029361293622936329364293652936629367293682936929370293712937229373293742937529376293772937829379293802938129382293832938429385293862938729388293892939029391293922939329394293952939629397293982939929400294012940229403294042940529406294072940829409294102941129412294132941429415294162941729418294192942029421294222942329424294252942629427294282942929430294312943229433294342943529436294372943829439294402944129442294432944429445294462944729448294492945029451294522945329454294552945629457294582945929460294612946229463294642946529466294672946829469294702947129472294732947429475294762947729478294792948029481294822948329484294852948629487294882948929490294912949229493294942949529496294972949829499295002950129502295032950429505295062950729508295092951029511295122951329514295152951629517295182951929520295212952229523295242952529526295272952829529295302953129532295332953429535295362953729538295392954029541295422954329544295452954629547295482954929550295512955229553295542955529556295572955829559295602956129562295632956429565295662956729568295692957029571295722957329574295752957629577295782957929580295812958229583295842958529586295872958829589295902959129592295932959429595295962959729598295992960029601296022960329604296052960629607296082960929610296112961229613296142961529616296172961829619296202962129622296232962429625296262962729628296292963029631296322963329634296352963629637296382963929640296412964229643296442964529646296472964829649296502965129652296532965429655296562965729658296592966029661296622966329664296652966629667296682966929670296712967229673296742967529676296772967829679296802968129682296832968429685296862968729688296892969029691296922969329694296952969629697296982969929700297012970229703297042970529706297072970829709297102971129712297132971429715297162971729718297192972029721297222972329724297252972629727297282972929730297312973229733297342973529736297372973829739297402974129742297432974429745297462974729748297492975029751297522975329754297552975629757297582975929760297612976229763297642976529766297672976829769297702977129772297732977429775297762977729778297792978029781297822978329784297852978629787297882978929790297912979229793297942979529796297972979829799298002980129802298032980429805298062980729808298092981029811298122981329814298152981629817298182981929820298212982229823298242982529826298272982829829298302983129832298332983429835298362983729838298392984029841298422984329844298452984629847298482984929850298512985229853298542985529856298572985829859298602986129862298632986429865298662986729868298692987029871298722987329874298752987629877298782987929880298812988229883298842988529886298872988829889298902989129892298932989429895298962989729898298992990029901299022990329904299052990629907299082990929910299112991229913299142991529916299172991829919299202992129922299232992429925299262992729928299292993029931299322993329934299352993629937299382993929940299412994229943299442994529946299472994829949299502995129952299532995429955299562995729958299592996029961299622996329964299652996629967299682996929970299712997229973299742997529976299772997829979299802998129982299832998429985299862998729988299892999029991299922999329994299952999629997299982999930000300013000230003300043000530006300073000830009300103001130012300133001430015300163001730018300193002030021300223002330024300253002630027300283002930030300313003230033300343003530036300373003830039300403004130042300433004430045300463004730048300493005030051300523005330054300553005630057300583005930060300613006230063300643006530066300673006830069300703007130072300733007430075300763007730078300793008030081300823008330084300853008630087300883008930090300913009230093300943009530096300973009830099301003010130102301033010430105301063010730108301093011030111301123011330114301153011630117301183011930120301213012230123301243012530126301273012830129301303013130132301333013430135301363013730138301393014030141301423014330144301453014630147301483014930150301513015230153301543015530156301573015830159301603016130162301633016430165301663016730168301693017030171301723017330174301753017630177301783017930180301813018230183301843018530186301873018830189301903019130192301933019430195301963019730198301993020030201302023020330204302053020630207302083020930210302113021230213302143021530216302173021830219302203022130222302233022430225302263022730228302293023030231302323023330234302353023630237302383023930240302413024230243302443024530246302473024830249302503025130252302533025430255302563025730258302593026030261302623026330264302653026630267302683026930270302713027230273302743027530276302773027830279302803028130282302833028430285302863028730288302893029030291302923029330294302953029630297302983029930300303013030230303303043030530306303073030830309303103031130312303133031430315303163031730318303193032030321303223032330324303253032630327303283032930330303313033230333303343033530336303373033830339303403034130342303433034430345303463034730348303493035030351303523035330354303553035630357303583035930360303613036230363303643036530366303673036830369303703037130372303733037430375303763037730378303793038030381303823038330384303853038630387303883038930390303913039230393303943039530396303973039830399304003040130402304033040430405304063040730408304093041030411304123041330414304153041630417304183041930420304213042230423304243042530426304273042830429304303043130432304333043430435304363043730438304393044030441304423044330444304453044630447304483044930450304513045230453304543045530456304573045830459304603046130462304633046430465304663046730468304693047030471304723047330474304753047630477304783047930480304813048230483304843048530486304873048830489304903049130492304933049430495304963049730498304993050030501305023050330504305053050630507305083050930510305113051230513305143051530516305173051830519305203052130522305233052430525305263052730528305293053030531305323053330534305353053630537305383053930540305413054230543305443054530546305473054830549305503055130552305533055430555305563055730558305593056030561305623056330564305653056630567305683056930570305713057230573305743057530576305773057830579305803058130582305833058430585305863058730588305893059030591305923059330594305953059630597305983059930600306013060230603306043060530606306073060830609306103061130612306133061430615306163061730618306193062030621306223062330624306253062630627306283062930630306313063230633306343063530636306373063830639306403064130642306433064430645306463064730648306493065030651306523065330654306553065630657306583065930660306613066230663306643066530666306673066830669306703067130672306733067430675306763067730678306793068030681306823068330684306853068630687306883068930690306913069230693306943069530696306973069830699307003070130702307033070430705307063070730708307093071030711307123071330714307153071630717307183071930720307213072230723307243072530726307273072830729307303073130732307333073430735307363073730738307393074030741307423074330744307453074630747307483074930750307513075230753307543075530756307573075830759307603076130762307633076430765307663076730768307693077030771307723077330774307753077630777307783077930780307813078230783307843078530786307873078830789307903079130792307933079430795307963079730798307993080030801308023080330804308053080630807308083080930810308113081230813308143081530816308173081830819308203082130822308233082430825308263082730828308293083030831308323083330834308353083630837308383083930840308413084230843308443084530846308473084830849308503085130852308533085430855308563085730858308593086030861308623086330864308653086630867308683086930870308713087230873308743087530876308773087830879308803088130882308833088430885308863088730888308893089030891308923089330894308953089630897308983089930900309013090230903309043090530906309073090830909309103091130912309133091430915309163091730918309193092030921309223092330924309253092630927309283092930930309313093230933309343093530936309373093830939309403094130942309433094430945309463094730948309493095030951309523095330954309553095630957309583095930960309613096230963309643096530966309673096830969309703097130972309733097430975309763097730978309793098030981309823098330984309853098630987309883098930990309913099230993309943099530996309973099830999310003100131002310033100431005310063100731008310093101031011310123101331014310153101631017310183101931020310213102231023310243102531026310273102831029310303103131032310333103431035310363103731038310393104031041310423104331044310453104631047310483104931050310513105231053310543105531056310573105831059310603106131062310633106431065310663106731068310693107031071310723107331074310753107631077310783107931080310813108231083310843108531086310873108831089310903109131092310933109431095310963109731098310993110031101311023110331104311053110631107311083110931110311113111231113311143111531116311173111831119311203112131122311233112431125311263112731128311293113031131311323113331134311353113631137311383113931140311413114231143311443114531146311473114831149311503115131152311533115431155311563115731158311593116031161311623116331164311653116631167311683116931170311713117231173311743117531176311773117831179311803118131182311833118431185311863118731188311893119031191311923119331194311953119631197311983119931200312013120231203312043120531206312073120831209312103121131212312133121431215312163121731218312193122031221312223122331224312253122631227312283122931230312313123231233312343123531236312373123831239312403124131242312433124431245312463124731248312493125031251312523125331254312553125631257312583125931260312613126231263312643126531266312673126831269312703127131272312733127431275312763127731278312793128031281312823128331284312853128631287312883128931290312913129231293312943129531296312973129831299313003130131302313033130431305313063130731308313093131031311313123131331314313153131631317313183131931320313213132231323313243132531326313273132831329313303133131332313333133431335313363133731338313393134031341313423134331344313453134631347313483134931350313513135231353313543135531356313573135831359313603136131362313633136431365313663136731368313693137031371313723137331374313753137631377313783137931380313813138231383313843138531386313873138831389313903139131392313933139431395313963139731398313993140031401314023140331404314053140631407314083140931410314113141231413314143141531416314173141831419314203142131422314233142431425314263142731428314293143031431314323143331434314353143631437314383143931440314413144231443314443144531446314473144831449314503145131452314533145431455314563145731458314593146031461314623146331464314653146631467314683146931470314713147231473314743147531476314773147831479314803148131482314833148431485314863148731488314893149031491314923149331494314953149631497314983149931500315013150231503315043150531506315073150831509315103151131512315133151431515315163151731518315193152031521315223152331524315253152631527315283152931530315313153231533315343153531536315373153831539315403154131542315433154431545315463154731548315493155031551315523155331554315553155631557315583155931560315613156231563315643156531566315673156831569315703157131572315733157431575315763157731578315793158031581315823158331584315853158631587315883158931590315913159231593315943159531596315973159831599316003160131602316033160431605316063160731608316093161031611316123161331614316153161631617316183161931620316213162231623316243162531626316273162831629316303163131632316333163431635316363163731638316393164031641316423164331644316453164631647316483164931650316513165231653316543165531656316573165831659316603166131662316633166431665316663166731668316693167031671316723167331674316753167631677316783167931680316813168231683316843168531686316873168831689316903169131692316933169431695316963169731698316993170031701317023170331704317053170631707317083170931710317113171231713317143171531716317173171831719317203172131722317233172431725317263172731728317293173031731317323173331734317353173631737317383173931740317413174231743317443174531746317473174831749317503175131752317533175431755317563175731758317593176031761317623176331764317653176631767317683176931770317713177231773317743177531776317773177831779317803178131782317833178431785317863178731788317893179031791317923179331794317953179631797317983179931800318013180231803318043180531806318073180831809318103181131812318133181431815318163181731818318193182031821318223182331824318253182631827318283182931830318313183231833318343183531836318373183831839318403184131842318433184431845318463184731848318493185031851318523185331854318553185631857318583185931860318613186231863318643186531866318673186831869318703187131872318733187431875318763187731878318793188031881318823188331884318853188631887318883188931890318913189231893318943189531896318973189831899319003190131902319033190431905319063190731908319093191031911319123191331914319153191631917319183191931920319213192231923319243192531926319273192831929319303193131932319333193431935319363193731938319393194031941319423194331944319453194631947319483194931950319513195231953319543195531956319573195831959319603196131962319633196431965319663196731968319693197031971319723197331974319753197631977319783197931980319813198231983319843198531986319873198831989319903199131992319933199431995319963199731998319993200032001320023200332004320053200632007320083200932010320113201232013320143201532016320173201832019320203202132022320233202432025320263202732028320293203032031320323203332034320353203632037320383203932040320413204232043320443204532046320473204832049320503205132052320533205432055320563205732058320593206032061320623206332064320653206632067320683206932070320713207232073320743207532076320773207832079320803208132082320833208432085320863208732088320893209032091320923209332094320953209632097320983209932100321013210232103321043210532106321073210832109321103211132112321133211432115321163211732118321193212032121321223212332124321253212632127321283212932130321313213232133321343213532136321373213832139321403214132142321433214432145321463214732148321493215032151321523215332154321553215632157321583215932160321613216232163321643216532166321673216832169321703217132172321733217432175321763217732178321793218032181321823218332184321853218632187321883218932190321913219232193321943219532196321973219832199322003220132202322033220432205322063220732208322093221032211322123221332214322153221632217322183221932220322213222232223322243222532226322273222832229322303223132232322333223432235322363223732238322393224032241322423224332244322453224632247322483224932250322513225232253322543225532256322573225832259322603226132262322633226432265322663226732268322693227032271322723227332274322753227632277322783227932280322813228232283322843228532286322873228832289322903229132292322933229432295322963229732298322993230032301323023230332304323053230632307323083230932310323113231232313323143231532316323173231832319323203232132322323233232432325323263232732328323293233032331323323233332334323353233632337323383233932340323413234232343323443234532346323473234832349323503235132352323533235432355323563235732358323593236032361323623236332364323653236632367323683236932370323713237232373323743237532376323773237832379323803238132382323833238432385323863238732388323893239032391323923239332394323953239632397323983239932400324013240232403324043240532406324073240832409324103241132412324133241432415324163241732418324193242032421324223242332424324253242632427324283242932430324313243232433324343243532436324373243832439324403244132442324433244432445324463244732448324493245032451324523245332454324553245632457324583245932460324613246232463324643246532466324673246832469324703247132472324733247432475324763247732478324793248032481324823248332484324853248632487324883248932490324913249232493324943249532496324973249832499325003250132502325033250432505325063250732508325093251032511325123251332514325153251632517325183251932520325213252232523325243252532526325273252832529325303253132532325333253432535325363253732538325393254032541325423254332544325453254632547325483254932550325513255232553325543255532556325573255832559325603256132562325633256432565325663256732568325693257032571325723257332574325753257632577325783257932580325813258232583325843258532586325873258832589325903259132592325933259432595325963259732598325993260032601326023260332604326053260632607326083260932610326113261232613326143261532616326173261832619326203262132622326233262432625326263262732628326293263032631326323263332634326353263632637326383263932640326413264232643326443264532646326473264832649326503265132652326533265432655326563265732658326593266032661326623266332664326653266632667326683266932670326713267232673326743267532676326773267832679326803268132682326833268432685326863268732688326893269032691326923269332694326953269632697326983269932700327013270232703327043270532706327073270832709327103271132712327133271432715327163271732718327193272032721327223272332724327253272632727327283272932730327313273232733327343273532736327373273832739327403274132742327433274432745327463274732748327493275032751327523275332754327553275632757327583275932760327613276232763327643276532766327673276832769327703277132772327733277432775327763277732778327793278032781327823278332784327853278632787327883278932790327913279232793327943279532796327973279832799328003280132802328033280432805328063280732808328093281032811328123281332814328153281632817328183281932820328213282232823328243282532826328273282832829328303283132832328333283432835328363283732838328393284032841328423284332844328453284632847328483284932850328513285232853328543285532856328573285832859328603286132862328633286432865328663286732868328693287032871328723287332874328753287632877328783287932880328813288232883328843288532886328873288832889328903289132892328933289432895328963289732898328993290032901329023290332904329053290632907329083290932910329113291232913329143291532916329173291832919329203292132922329233292432925329263292732928329293293032931329323293332934329353293632937329383293932940329413294232943329443294532946329473294832949329503295132952329533295432955329563295732958329593296032961329623296332964329653296632967329683296932970329713297232973329743297532976329773297832979329803298132982329833298432985329863298732988329893299032991329923299332994329953299632997329983299933000330013300233003330043300533006330073300833009330103301133012330133301433015330163301733018330193302033021330223302333024330253302633027330283302933030330313303233033330343303533036330373303833039330403304133042330433304433045330463304733048330493305033051330523305333054330553305633057330583305933060330613306233063330643306533066330673306833069330703307133072330733307433075330763307733078330793308033081330823308333084330853308633087330883308933090330913309233093330943309533096330973309833099331003310133102331033310433105331063310733108331093311033111331123311333114331153311633117331183311933120331213312233123331243312533126331273312833129331303313133132331333313433135331363313733138331393314033141331423314333144331453314633147331483314933150331513315233153331543315533156331573315833159331603316133162331633316433165331663316733168331693317033171331723317333174331753317633177331783317933180331813318233183331843318533186331873318833189331903319133192331933319433195331963319733198331993320033201332023320333204332053320633207332083320933210332113321233213332143321533216332173321833219332203322133222332233322433225332263322733228332293323033231332323323333234332353323633237332383323933240332413324233243332443324533246332473324833249332503325133252332533325433255332563325733258332593326033261332623326333264332653326633267332683326933270332713327233273332743327533276332773327833279332803328133282332833328433285332863328733288332893329033291332923329333294332953329633297332983329933300333013330233303333043330533306333073330833309333103331133312333133331433315333163331733318333193332033321333223332333324333253332633327333283332933330333313333233333333343333533336333373333833339333403334133342333433334433345333463334733348333493335033351333523335333354333553335633357333583335933360333613336233363333643336533366333673336833369333703337133372333733337433375333763337733378333793338033381333823338333384333853338633387333883338933390333913339233393333943339533396333973339833399334003340133402334033340433405334063340733408334093341033411334123341333414334153341633417334183341933420334213342233423334243342533426334273342833429334303343133432334333343433435334363343733438334393344033441334423344333444334453344633447334483344933450334513345233453334543345533456334573345833459334603346133462334633346433465334663346733468334693347033471334723347333474334753347633477334783347933480334813348233483334843348533486334873348833489334903349133492334933349433495334963349733498334993350033501335023350333504335053350633507335083350933510335113351233513335143351533516335173351833519335203352133522335233352433525335263352733528335293353033531335323353333534335353353633537335383353933540335413354233543335443354533546335473354833549335503355133552335533355433555335563355733558335593356033561335623356333564335653356633567335683356933570335713357233573335743357533576335773357833579335803358133582335833358433585335863358733588335893359033591335923359333594335953359633597335983359933600336013360233603336043360533606336073360833609336103361133612336133361433615336163361733618336193362033621336223362333624336253362633627336283362933630336313363233633336343363533636336373363833639336403364133642336433364433645336463364733648336493365033651336523365333654336553365633657336583365933660336613366233663336643366533666336673366833669336703367133672336733367433675336763367733678336793368033681336823368333684336853368633687336883368933690336913369233693336943369533696336973369833699337003370133702337033370433705337063370733708337093371033711337123371333714337153371633717337183371933720337213372233723337243372533726337273372833729337303373133732337333373433735337363373733738337393374033741337423374333744337453374633747337483374933750337513375233753337543375533756337573375833759337603376133762337633376433765337663376733768337693377033771337723377333774337753377633777337783377933780337813378233783337843378533786337873378833789337903379133792337933379433795337963379733798337993380033801338023380333804338053380633807338083380933810338113381233813338143381533816338173381833819338203382133822338233382433825338263382733828338293383033831338323383333834338353383633837338383383933840338413384233843338443384533846338473384833849338503385133852338533385433855338563385733858338593386033861338623386333864338653386633867338683386933870338713387233873338743387533876338773387833879338803388133882338833388433885338863388733888338893389033891338923389333894338953389633897338983389933900339013390233903339043390533906339073390833909339103391133912339133391433915339163391733918339193392033921339223392333924339253392633927339283392933930339313393233933339343393533936339373393833939339403394133942339433394433945339463394733948339493395033951339523395333954339553395633957339583395933960339613396233963339643396533966339673396833969339703397133972339733397433975339763397733978339793398033981339823398333984339853398633987339883398933990339913399233993339943399533996339973399833999340003400134002340033400434005340063400734008340093401034011340123401334014340153401634017340183401934020340213402234023340243402534026340273402834029340303403134032340333403434035340363403734038340393404034041340423404334044340453404634047340483404934050340513405234053340543405534056340573405834059340603406134062340633406434065340663406734068340693407034071340723407334074340753407634077340783407934080340813408234083340843408534086340873408834089340903409134092340933409434095340963409734098340993410034101341023410334104341053410634107341083410934110341113411234113341143411534116341173411834119341203412134122341233412434125341263412734128341293413034131341323413334134341353413634137341383413934140341413414234143341443414534146341473414834149341503415134152341533415434155341563415734158341593416034161341623416334164341653416634167341683416934170341713417234173341743417534176341773417834179341803418134182341833418434185341863418734188341893419034191341923419334194341953419634197341983419934200342013420234203342043420534206342073420834209342103421134212342133421434215342163421734218342193422034221342223422334224342253422634227342283422934230342313423234233342343423534236342373423834239342403424134242342433424434245342463424734248342493425034251342523425334254342553425634257342583425934260342613426234263342643426534266342673426834269342703427134272342733427434275342763427734278342793428034281342823428334284342853428634287342883428934290342913429234293342943429534296342973429834299343003430134302343033430434305343063430734308343093431034311343123431334314343153431634317343183431934320343213432234323343243432534326343273432834329343303433134332343333433434335343363433734338343393434034341343423434334344343453434634347343483434934350343513435234353343543435534356343573435834359343603436134362343633436434365343663436734368343693437034371343723437334374343753437634377343783437934380343813438234383343843438534386343873438834389343903439134392343933439434395343963439734398343993440034401344023440334404344053440634407344083440934410344113441234413344143441534416344173441834419344203442134422344233442434425344263442734428344293443034431344323443334434344353443634437344383443934440344413444234443344443444534446344473444834449344503445134452344533445434455344563445734458344593446034461344623446334464344653446634467344683446934470344713447234473344743447534476344773447834479344803448134482344833448434485344863448734488344893449034491344923449334494344953449634497344983449934500345013450234503345043450534506345073450834509345103451134512345133451434515345163451734518345193452034521345223452334524345253452634527345283452934530345313453234533345343453534536345373453834539345403454134542345433454434545345463454734548345493455034551345523455334554345553455634557345583455934560345613456234563345643456534566345673456834569345703457134572345733457434575345763457734578345793458034581345823458334584345853458634587345883458934590345913459234593345943459534596345973459834599346003460134602346033460434605346063460734608346093461034611346123461334614346153461634617346183461934620346213462234623346243462534626346273462834629346303463134632346333463434635346363463734638346393464034641346423464334644346453464634647346483464934650346513465234653346543465534656346573465834659346603466134662346633466434665346663466734668346693467034671346723467334674346753467634677346783467934680346813468234683346843468534686346873468834689346903469134692346933469434695346963469734698346993470034701347023470334704347053470634707347083470934710347113471234713347143471534716347173471834719347203472134722347233472434725347263472734728347293473034731347323473334734347353473634737347383473934740347413474234743347443474534746347473474834749347503475134752347533475434755347563475734758347593476034761347623476334764347653476634767347683476934770347713477234773347743477534776347773477834779347803478134782347833478434785347863478734788347893479034791347923479334794347953479634797347983479934800348013480234803348043480534806348073480834809348103481134812348133481434815348163481734818348193482034821348223482334824348253482634827348283482934830348313483234833348343483534836348373483834839348403484134842348433484434845348463484734848348493485034851348523485334854348553485634857348583485934860348613486234863348643486534866348673486834869348703487134872348733487434875348763487734878348793488034881348823488334884348853488634887348883488934890348913489234893348943489534896348973489834899349003490134902349033490434905349063490734908349093491034911349123491334914349153491634917349183491934920349213492234923349243492534926349273492834929349303493134932349333493434935349363493734938349393494034941349423494334944349453494634947349483494934950349513495234953349543495534956349573495834959349603496134962349633496434965349663496734968349693497034971349723497334974349753497634977349783497934980349813498234983349843498534986349873498834989349903499134992349933499434995349963499734998349993500035001350023500335004350053500635007350083500935010350113501235013350143501535016350173501835019350203502135022350233502435025350263502735028350293503035031350323503335034350353503635037350383503935040350413504235043350443504535046350473504835049350503505135052350533505435055350563505735058350593506035061350623506335064350653506635067350683506935070350713507235073350743507535076350773507835079350803508135082350833508435085350863508735088350893509035091350923509335094350953509635097350983509935100351013510235103351043510535106351073510835109351103511135112351133511435115351163511735118351193512035121351223512335124351253512635127351283512935130351313513235133351343513535136351373513835139351403514135142351433514435145351463514735148351493515035151351523515335154351553515635157351583515935160351613516235163351643516535166351673516835169351703517135172351733517435175351763517735178351793518035181351823518335184351853518635187351883518935190351913519235193351943519535196351973519835199352003520135202352033520435205352063520735208352093521035211352123521335214352153521635217352183521935220352213522235223352243522535226352273522835229352303523135232352333523435235352363523735238352393524035241352423524335244352453524635247352483524935250352513525235253352543525535256352573525835259352603526135262352633526435265352663526735268352693527035271352723527335274352753527635277352783527935280352813528235283352843528535286352873528835289352903529135292352933529435295352963529735298352993530035301353023530335304353053530635307353083530935310353113531235313353143531535316353173531835319353203532135322353233532435325353263532735328353293533035331353323533335334353353533635337353383533935340353413534235343353443534535346353473534835349353503535135352353533535435355353563535735358353593536035361353623536335364353653536635367353683536935370353713537235373353743537535376353773537835379353803538135382353833538435385353863538735388353893539035391353923539335394353953539635397353983539935400354013540235403354043540535406354073540835409354103541135412354133541435415354163541735418354193542035421354223542335424354253542635427354283542935430354313543235433354343543535436354373543835439354403544135442354433544435445354463544735448354493545035451354523545335454354553545635457354583545935460354613546235463354643546535466354673546835469354703547135472354733547435475354763547735478354793548035481354823548335484354853548635487354883548935490354913549235493354943549535496354973549835499355003550135502355033550435505355063550735508355093551035511355123551335514355153551635517355183551935520355213552235523355243552535526355273552835529355303553135532355333553435535355363553735538355393554035541355423554335544355453554635547355483554935550355513555235553355543555535556355573555835559355603556135562355633556435565355663556735568355693557035571355723557335574355753557635577355783557935580355813558235583355843558535586355873558835589355903559135592355933559435595355963559735598355993560035601356023560335604356053560635607356083560935610356113561235613356143561535616356173561835619356203562135622356233562435625356263562735628356293563035631356323563335634356353563635637356383563935640356413564235643356443564535646356473564835649356503565135652356533565435655356563565735658356593566035661356623566335664356653566635667356683566935670356713567235673356743567535676356773567835679356803568135682356833568435685356863568735688356893569035691356923569335694356953569635697356983569935700357013570235703357043570535706357073570835709357103571135712357133571435715357163571735718357193572035721357223572335724357253572635727357283572935730357313573235733357343573535736357373573835739357403574135742357433574435745357463574735748357493575035751357523575335754357553575635757357583575935760357613576235763357643576535766357673576835769357703577135772357733577435775357763577735778357793578035781357823578335784357853578635787357883578935790357913579235793357943579535796357973579835799358003580135802358033580435805358063580735808358093581035811358123581335814358153581635817358183581935820358213582235823358243582535826358273582835829358303583135832358333583435835358363583735838358393584035841358423584335844358453584635847358483584935850358513585235853358543585535856358573585835859358603586135862358633586435865358663586735868358693587035871358723587335874358753587635877358783587935880358813588235883358843588535886358873588835889358903589135892358933589435895358963589735898358993590035901359023590335904359053590635907359083590935910359113591235913359143591535916359173591835919359203592135922359233592435925359263592735928359293593035931359323593335934359353593635937359383593935940359413594235943359443594535946359473594835949359503595135952359533595435955359563595735958359593596035961359623596335964359653596635967359683596935970359713597235973359743597535976359773597835979359803598135982359833598435985359863598735988359893599035991359923599335994359953599635997359983599936000360013600236003360043600536006360073600836009360103601136012360133601436015360163601736018360193602036021360223602336024360253602636027360283602936030360313603236033360343603536036360373603836039360403604136042360433604436045360463604736048360493605036051360523605336054360553605636057360583605936060360613606236063360643606536066360673606836069360703607136072360733607436075360763607736078360793608036081360823608336084360853608636087360883608936090360913609236093360943609536096360973609836099361003610136102361033610436105361063610736108361093611036111361123611336114361153611636117361183611936120361213612236123361243612536126361273612836129361303613136132361333613436135361363613736138361393614036141361423614336144361453614636147361483614936150361513615236153361543615536156361573615836159361603616136162361633616436165361663616736168361693617036171361723617336174361753617636177361783617936180361813618236183361843618536186361873618836189361903619136192361933619436195361963619736198361993620036201362023620336204362053620636207362083620936210362113621236213362143621536216362173621836219362203622136222362233622436225362263622736228362293623036231362323623336234362353623636237362383623936240362413624236243362443624536246362473624836249362503625136252362533625436255362563625736258362593626036261362623626336264362653626636267362683626936270362713627236273362743627536276362773627836279362803628136282362833628436285362863628736288362893629036291362923629336294362953629636297362983629936300363013630236303363043630536306363073630836309363103631136312363133631436315363163631736318363193632036321363223632336324363253632636327363283632936330363313633236333363343633536336363373633836339363403634136342363433634436345363463634736348363493635036351363523635336354363553635636357363583635936360363613636236363363643636536366363673636836369363703637136372363733637436375363763637736378363793638036381363823638336384363853638636387363883638936390363913639236393363943639536396363973639836399364003640136402364033640436405364063640736408364093641036411364123641336414364153641636417364183641936420364213642236423364243642536426364273642836429364303643136432364333643436435364363643736438364393644036441364423644336444364453644636447364483644936450364513645236453364543645536456364573645836459364603646136462364633646436465364663646736468364693647036471364723647336474364753647636477364783647936480364813648236483364843648536486364873648836489364903649136492364933649436495364963649736498364993650036501365023650336504365053650636507365083650936510365113651236513365143651536516365173651836519365203652136522365233652436525365263652736528365293653036531365323653336534365353653636537365383653936540365413654236543365443654536546365473654836549365503655136552365533655436555365563655736558365593656036561365623656336564365653656636567365683656936570365713657236573365743657536576365773657836579365803658136582365833658436585365863658736588365893659036591365923659336594365953659636597365983659936600366013660236603366043660536606366073660836609366103661136612366133661436615366163661736618366193662036621366223662336624366253662636627366283662936630366313663236633366343663536636366373663836639366403664136642366433664436645366463664736648366493665036651366523665336654366553665636657366583665936660366613666236663366643666536666366673666836669366703667136672366733667436675366763667736678366793668036681366823668336684366853668636687366883668936690366913669236693366943669536696366973669836699367003670136702367033670436705367063670736708367093671036711367123671336714367153671636717367183671936720367213672236723367243672536726367273672836729367303673136732367333673436735367363673736738367393674036741367423674336744367453674636747367483674936750367513675236753367543675536756367573675836759367603676136762367633676436765367663676736768367693677036771367723677336774367753677636777367783677936780367813678236783367843678536786367873678836789367903679136792367933679436795367963679736798367993680036801368023680336804368053680636807368083680936810368113681236813368143681536816368173681836819368203682136822368233682436825368263682736828368293683036831368323683336834368353683636837368383683936840368413684236843368443684536846368473684836849368503685136852368533685436855368563685736858368593686036861368623686336864368653686636867368683686936870368713687236873368743687536876368773687836879368803688136882368833688436885368863688736888368893689036891368923689336894368953689636897368983689936900369013690236903369043690536906369073690836909369103691136912369133691436915369163691736918369193692036921369223692336924369253692636927369283692936930369313693236933369343693536936369373693836939369403694136942369433694436945369463694736948369493695036951369523695336954369553695636957369583695936960369613696236963369643696536966369673696836969369703697136972369733697436975369763697736978369793698036981369823698336984369853698636987369883698936990369913699236993369943699536996369973699836999370003700137002370033700437005370063700737008370093701037011370123701337014370153701637017370183701937020370213702237023370243702537026370273702837029370303703137032370333703437035370363703737038370393704037041370423704337044370453704637047370483704937050370513705237053370543705537056370573705837059370603706137062370633706437065370663706737068370693707037071370723707337074370753707637077370783707937080370813708237083370843708537086370873708837089370903709137092370933709437095370963709737098370993710037101371023710337104371053710637107371083710937110371113711237113371143711537116371173711837119371203712137122371233712437125371263712737128371293713037131371323713337134371353713637137371383713937140371413714237143371443714537146371473714837149371503715137152371533715437155371563715737158371593716037161371623716337164371653716637167371683716937170371713717237173371743717537176371773717837179371803718137182371833718437185371863718737188371893719037191371923719337194371953719637197371983719937200372013720237203372043720537206372073720837209372103721137212372133721437215372163721737218372193722037221372223722337224372253722637227372283722937230372313723237233372343723537236372373723837239372403724137242372433724437245372463724737248372493725037251372523725337254372553725637257372583725937260372613726237263372643726537266372673726837269372703727137272372733727437275372763727737278372793728037281372823728337284372853728637287372883728937290372913729237293372943729537296372973729837299373003730137302373033730437305373063730737308373093731037311373123731337314373153731637317373183731937320373213732237323373243732537326373273732837329373303733137332373333733437335373363733737338373393734037341373423734337344373453734637347373483734937350373513735237353373543735537356373573735837359373603736137362373633736437365373663736737368373693737037371373723737337374373753737637377373783737937380373813738237383373843738537386373873738837389373903739137392373933739437395373963739737398373993740037401374023740337404374053740637407374083740937410374113741237413374143741537416374173741837419374203742137422374233742437425374263742737428374293743037431374323743337434374353743637437374383743937440374413744237443374443744537446374473744837449374503745137452374533745437455374563745737458374593746037461374623746337464374653746637467374683746937470374713747237473374743747537476374773747837479374803748137482374833748437485374863748737488374893749037491374923749337494374953749637497374983749937500375013750237503375043750537506375073750837509375103751137512375133751437515375163751737518375193752037521375223752337524375253752637527375283752937530375313753237533375343753537536375373753837539375403754137542375433754437545375463754737548375493755037551375523755337554375553755637557375583755937560375613756237563375643756537566375673756837569375703757137572375733757437575375763757737578375793758037581375823758337584375853758637587375883758937590375913759237593375943759537596375973759837599376003760137602376033760437605376063760737608376093761037611376123761337614376153761637617376183761937620376213762237623376243762537626376273762837629376303763137632376333763437635376363763737638376393764037641376423764337644376453764637647376483764937650376513765237653376543765537656376573765837659376603766137662376633766437665376663766737668376693767037671376723767337674376753767637677376783767937680376813768237683376843768537686376873768837689376903769137692376933769437695376963769737698376993770037701377023770337704377053770637707377083770937710377113771237713377143771537716377173771837719377203772137722377233772437725377263772737728377293773037731377323773337734377353773637737377383773937740377413774237743377443774537746377473774837749377503775137752377533775437755377563775737758377593776037761377623776337764377653776637767377683776937770377713777237773377743777537776377773777837779377803778137782377833778437785377863778737788377893779037791377923779337794377953779637797377983779937800378013780237803378043780537806378073780837809378103781137812378133781437815378163781737818378193782037821378223782337824378253782637827378283782937830378313783237833378343783537836378373783837839378403784137842378433784437845378463784737848378493785037851378523785337854378553785637857378583785937860378613786237863378643786537866378673786837869378703787137872378733787437875378763787737878378793788037881378823788337884378853788637887378883788937890378913789237893378943789537896378973789837899379003790137902379033790437905379063790737908379093791037911379123791337914379153791637917379183791937920379213792237923379243792537926379273792837929379303793137932379333793437935379363793737938379393794037941379423794337944379453794637947379483794937950379513795237953379543795537956379573795837959379603796137962379633796437965379663796737968379693797037971379723797337974379753797637977379783797937980379813798237983379843798537986379873798837989379903799137992379933799437995379963799737998379993800038001380023800338004380053800638007380083800938010380113801238013380143801538016380173801838019380203802138022380233802438025380263802738028380293803038031380323803338034380353803638037380383803938040380413804238043380443804538046380473804838049380503805138052380533805438055380563805738058380593806038061380623806338064380653806638067380683806938070380713807238073380743807538076380773807838079380803808138082380833808438085380863808738088380893809038091380923809338094380953809638097380983809938100381013810238103381043810538106381073810838109381103811138112381133811438115381163811738118381193812038121381223812338124381253812638127381283812938130381313813238133381343813538136381373813838139381403814138142381433814438145381463814738148381493815038151381523815338154381553815638157381583815938160381613816238163381643816538166381673816838169381703817138172381733817438175381763817738178381793818038181381823818338184381853818638187381883818938190381913819238193381943819538196381973819838199382003820138202382033820438205382063820738208382093821038211382123821338214382153821638217382183821938220382213822238223382243822538226382273822838229382303823138232382333823438235382363823738238382393824038241382423824338244382453824638247382483824938250382513825238253382543825538256382573825838259382603826138262382633826438265382663826738268382693827038271382723827338274382753827638277382783827938280382813828238283382843828538286382873828838289382903829138292382933829438295382963829738298382993830038301383023830338304383053830638307383083830938310383113831238313383143831538316383173831838319383203832138322383233832438325383263832738328383293833038331383323833338334383353833638337383383833938340383413834238343383443834538346383473834838349383503835138352383533835438355383563835738358383593836038361383623836338364383653836638367383683836938370383713837238373383743837538376383773837838379383803838138382383833838438385383863838738388383893839038391383923839338394383953839638397383983839938400384013840238403384043840538406384073840838409384103841138412384133841438415384163841738418384193842038421384223842338424384253842638427384283842938430384313843238433384343843538436384373843838439384403844138442384433844438445384463844738448384493845038451384523845338454384553845638457384583845938460384613846238463384643846538466384673846838469384703847138472384733847438475384763847738478384793848038481384823848338484384853848638487384883848938490384913849238493384943849538496384973849838499385003850138502385033850438505385063850738508385093851038511385123851338514385153851638517385183851938520385213852238523385243852538526385273852838529385303853138532385333853438535385363853738538385393854038541385423854338544385453854638547385483854938550385513855238553385543855538556385573855838559385603856138562385633856438565385663856738568385693857038571385723857338574385753857638577385783857938580385813858238583385843858538586385873858838589385903859138592385933859438595385963859738598385993860038601386023860338604386053860638607386083860938610386113861238613386143861538616386173861838619386203862138622386233862438625386263862738628386293863038631386323863338634386353863638637386383863938640386413864238643386443864538646386473864838649386503865138652386533865438655386563865738658386593866038661386623866338664386653866638667386683866938670386713867238673386743867538676386773867838679386803868138682386833868438685386863868738688386893869038691386923869338694386953869638697386983869938700387013870238703387043870538706387073870838709387103871138712387133871438715387163871738718387193872038721387223872338724387253872638727387283872938730387313873238733387343873538736387373873838739387403874138742387433874438745387463874738748387493875038751387523875338754387553875638757387583875938760387613876238763387643876538766387673876838769387703877138772387733877438775387763877738778387793878038781387823878338784387853878638787387883878938790387913879238793387943879538796387973879838799388003880138802388033880438805388063880738808388093881038811388123881338814388153881638817388183881938820388213882238823388243882538826388273882838829388303883138832388333883438835388363883738838388393884038841388423884338844388453884638847388483884938850388513885238853388543885538856388573885838859388603886138862388633886438865388663886738868388693887038871388723887338874388753887638877388783887938880388813888238883388843888538886388873888838889388903889138892388933889438895388963889738898388993890038901389023890338904389053890638907389083890938910389113891238913389143891538916389173891838919389203892138922389233892438925389263892738928389293893038931389323893338934389353893638937389383893938940389413894238943389443894538946389473894838949389503895138952389533895438955389563895738958389593896038961389623896338964389653896638967389683896938970389713897238973389743897538976389773897838979389803898138982389833898438985389863898738988389893899038991389923899338994389953899638997389983899939000390013900239003390043900539006390073900839009390103901139012390133901439015390163901739018390193902039021390223902339024390253902639027390283902939030390313903239033390343903539036390373903839039390403904139042390433904439045390463904739048390493905039051390523905339054390553905639057390583905939060390613906239063390643906539066390673906839069390703907139072390733907439075390763907739078390793908039081390823908339084390853908639087390883908939090390913909239093390943909539096390973909839099391003910139102391033910439105391063910739108391093911039111391123911339114391153911639117391183911939120391213912239123391243912539126391273912839129391303913139132391333913439135391363913739138391393914039141391423914339144391453914639147391483914939150391513915239153391543915539156391573915839159391603916139162391633916439165391663916739168391693917039171391723917339174391753917639177391783917939180391813918239183391843918539186391873918839189391903919139192391933919439195391963919739198391993920039201392023920339204392053920639207392083920939210392113921239213392143921539216392173921839219392203922139222392233922439225392263922739228392293923039231392323923339234392353923639237392383923939240392413924239243392443924539246392473924839249392503925139252392533925439255392563925739258392593926039261392623926339264392653926639267392683926939270392713927239273392743927539276392773927839279392803928139282392833928439285392863928739288392893929039291392923929339294392953929639297392983929939300393013930239303393043930539306393073930839309393103931139312393133931439315393163931739318393193932039321393223932339324393253932639327393283932939330393313933239333393343933539336393373933839339393403934139342393433934439345393463934739348393493935039351393523935339354393553935639357393583935939360393613936239363393643936539366393673936839369393703937139372393733937439375393763937739378393793938039381393823938339384393853938639387393883938939390393913939239393393943939539396393973939839399394003940139402394033940439405394063940739408394093941039411394123941339414394153941639417394183941939420394213942239423394243942539426394273942839429394303943139432394333943439435394363943739438394393944039441394423944339444394453944639447394483944939450394513945239453394543945539456394573945839459394603946139462394633946439465394663946739468394693947039471394723947339474394753947639477394783947939480394813948239483394843948539486394873948839489394903949139492394933949439495394963949739498394993950039501395023950339504395053950639507395083950939510395113951239513395143951539516395173951839519395203952139522395233952439525395263952739528395293953039531395323953339534395353953639537395383953939540395413954239543395443954539546395473954839549395503955139552395533955439555395563955739558395593956039561395623956339564395653956639567395683956939570395713957239573395743957539576395773957839579395803958139582395833958439585395863958739588395893959039591395923959339594395953959639597395983959939600396013960239603396043960539606396073960839609396103961139612396133961439615396163961739618396193962039621396223962339624396253962639627396283962939630396313963239633396343963539636396373963839639396403964139642396433964439645396463964739648396493965039651396523965339654396553965639657396583965939660396613966239663396643966539666396673966839669396703967139672396733967439675396763967739678396793968039681396823968339684396853968639687396883968939690396913969239693396943969539696396973969839699397003970139702397033970439705397063970739708397093971039711397123971339714397153971639717397183971939720397213972239723397243972539726397273972839729397303973139732397333973439735397363973739738397393974039741397423974339744397453974639747397483974939750397513975239753397543975539756397573975839759397603976139762397633976439765397663976739768397693977039771397723977339774397753977639777397783977939780397813978239783397843978539786397873978839789397903979139792397933979439795397963979739798397993980039801398023980339804398053980639807398083980939810398113981239813398143981539816398173981839819398203982139822398233982439825398263982739828398293983039831398323983339834398353983639837398383983939840398413984239843398443984539846398473984839849398503985139852398533985439855398563985739858398593986039861398623986339864398653986639867398683986939870398713987239873398743987539876398773987839879398803988139882398833988439885398863988739888398893989039891398923989339894398953989639897398983989939900399013990239903399043990539906399073990839909399103991139912399133991439915399163991739918399193992039921399223992339924399253992639927399283992939930399313993239933399343993539936399373993839939399403994139942399433994439945399463994739948399493995039951399523995339954399553995639957399583995939960399613996239963399643996539966399673996839969399703997139972399733997439975399763997739978399793998039981399823998339984399853998639987399883998939990399913999239993399943999539996399973999839999400004000140002400034000440005400064000740008400094001040011400124001340014400154001640017400184001940020400214002240023400244002540026400274002840029400304003140032400334003440035400364003740038400394004040041400424004340044400454004640047400484004940050400514005240053400544005540056400574005840059400604006140062400634006440065400664006740068400694007040071400724007340074400754007640077400784007940080400814008240083400844008540086400874008840089400904009140092400934009440095400964009740098400994010040101401024010340104401054010640107401084010940110401114011240113401144011540116401174011840119401204012140122401234012440125401264012740128401294013040131401324013340134401354013640137401384013940140401414014240143401444014540146401474014840149401504015140152401534015440155401564015740158401594016040161401624016340164401654016640167401684016940170401714017240173401744017540176401774017840179401804018140182401834018440185401864018740188401894019040191401924019340194401954019640197401984019940200402014020240203402044020540206402074020840209402104021140212402134021440215402164021740218402194022040221402224022340224402254022640227402284022940230402314023240233402344023540236402374023840239402404024140242402434024440245402464024740248402494025040251402524025340254402554025640257402584025940260402614026240263402644026540266402674026840269402704027140272402734027440275402764027740278402794028040281402824028340284402854028640287402884028940290402914029240293402944029540296402974029840299403004030140302403034030440305403064030740308403094031040311403124031340314403154031640317403184031940320403214032240323403244032540326403274032840329403304033140332403334033440335403364033740338403394034040341403424034340344403454034640347403484034940350403514035240353403544035540356403574035840359403604036140362403634036440365403664036740368403694037040371403724037340374403754037640377403784037940380403814038240383403844038540386403874038840389403904039140392403934039440395403964039740398403994040040401404024040340404404054040640407404084040940410404114041240413404144041540416404174041840419404204042140422404234042440425404264042740428404294043040431404324043340434404354043640437404384043940440404414044240443404444044540446404474044840449404504045140452404534045440455404564045740458404594046040461404624046340464404654046640467404684046940470404714047240473404744047540476404774047840479404804048140482404834048440485404864048740488404894049040491404924049340494404954049640497404984049940500405014050240503405044050540506405074050840509405104051140512405134051440515405164051740518405194052040521405224052340524405254052640527405284052940530405314053240533405344053540536405374053840539405404054140542405434054440545405464054740548405494055040551405524055340554405554055640557405584055940560405614056240563405644056540566405674056840569405704057140572405734057440575405764057740578405794058040581405824058340584405854058640587405884058940590405914059240593405944059540596405974059840599406004060140602406034060440605406064060740608406094061040611406124061340614406154061640617406184061940620406214062240623406244062540626406274062840629406304063140632406334063440635406364063740638406394064040641406424064340644406454064640647406484064940650406514065240653406544065540656406574065840659406604066140662406634066440665406664066740668406694067040671406724067340674406754067640677406784067940680406814068240683406844068540686406874068840689406904069140692406934069440695406964069740698406994070040701407024070340704407054070640707407084070940710407114071240713407144071540716407174071840719407204072140722407234072440725407264072740728407294073040731407324073340734407354073640737407384073940740407414074240743407444074540746407474074840749407504075140752407534075440755407564075740758407594076040761407624076340764407654076640767407684076940770407714077240773407744077540776407774077840779407804078140782407834078440785407864078740788407894079040791407924079340794407954079640797407984079940800408014080240803408044080540806408074080840809408104081140812408134081440815408164081740818408194082040821408224082340824408254082640827408284082940830408314083240833408344083540836408374083840839408404084140842408434084440845408464084740848408494085040851408524085340854408554085640857408584085940860408614086240863408644086540866408674086840869408704087140872408734087440875408764087740878408794088040881408824088340884408854088640887408884088940890408914089240893408944089540896408974089840899409004090140902409034090440905409064090740908409094091040911409124091340914409154091640917409184091940920409214092240923409244092540926409274092840929409304093140932409334093440935409364093740938409394094040941409424094340944409454094640947409484094940950409514095240953409544095540956409574095840959409604096140962409634096440965409664096740968409694097040971409724097340974409754097640977409784097940980409814098240983409844098540986409874098840989409904099140992409934099440995409964099740998409994100041001410024100341004410054100641007410084100941010410114101241013410144101541016410174101841019410204102141022410234102441025410264102741028410294103041031410324103341034410354103641037410384103941040410414104241043410444104541046410474104841049410504105141052410534105441055410564105741058410594106041061410624106341064410654106641067410684106941070410714107241073410744107541076410774107841079410804108141082410834108441085410864108741088410894109041091410924109341094410954109641097410984109941100411014110241103411044110541106411074110841109411104111141112411134111441115411164111741118411194112041121411224112341124411254112641127411284112941130411314113241133411344113541136411374113841139411404114141142411434114441145411464114741148411494115041151411524115341154411554115641157411584115941160411614116241163411644116541166411674116841169411704117141172411734117441175411764117741178411794118041181411824118341184411854118641187411884118941190411914119241193411944119541196411974119841199412004120141202412034120441205412064120741208412094121041211412124121341214412154121641217412184121941220412214122241223412244122541226412274122841229412304123141232412334123441235412364123741238412394124041241412424124341244412454124641247412484124941250412514125241253412544125541256412574125841259412604126141262412634126441265412664126741268412694127041271412724127341274412754127641277412784127941280412814128241283412844128541286412874128841289412904129141292412934129441295412964129741298412994130041301413024130341304413054130641307413084130941310413114131241313413144131541316413174131841319413204132141322413234132441325413264132741328413294133041331413324133341334413354133641337413384133941340413414134241343413444134541346413474134841349413504135141352413534135441355413564135741358413594136041361413624136341364413654136641367413684136941370413714137241373413744137541376413774137841379413804138141382413834138441385413864138741388413894139041391413924139341394413954139641397413984139941400414014140241403414044140541406414074140841409414104141141412414134141441415414164141741418414194142041421414224142341424414254142641427414284142941430414314143241433414344143541436414374143841439414404144141442414434144441445414464144741448414494145041451414524145341454414554145641457414584145941460414614146241463414644146541466414674146841469414704147141472414734147441475414764147741478414794148041481414824148341484414854148641487414884148941490414914149241493414944149541496414974149841499415004150141502415034150441505415064150741508415094151041511415124151341514415154151641517415184151941520415214152241523415244152541526415274152841529415304153141532415334153441535415364153741538415394154041541415424154341544415454154641547415484154941550415514155241553415544155541556415574155841559415604156141562415634156441565415664156741568415694157041571415724157341574415754157641577415784157941580415814158241583415844158541586415874158841589415904159141592415934159441595415964159741598415994160041601416024160341604416054160641607416084160941610416114161241613416144161541616416174161841619416204162141622416234162441625416264162741628416294163041631416324163341634416354163641637416384163941640416414164241643416444164541646416474164841649416504165141652416534165441655416564165741658416594166041661416624166341664416654166641667416684166941670416714167241673416744167541676416774167841679416804168141682416834168441685416864168741688416894169041691416924169341694416954169641697416984169941700417014170241703417044170541706417074170841709417104171141712417134171441715417164171741718417194172041721417224172341724417254172641727417284172941730417314173241733417344173541736417374173841739417404174141742417434174441745417464174741748417494175041751417524175341754417554175641757417584175941760417614176241763417644176541766417674176841769417704177141772417734177441775417764177741778417794178041781417824178341784417854178641787417884178941790417914179241793417944179541796417974179841799418004180141802418034180441805418064180741808418094181041811418124181341814418154181641817418184181941820418214182241823418244182541826418274182841829418304183141832418334183441835418364183741838418394184041841418424184341844418454184641847418484184941850418514185241853418544185541856418574185841859418604186141862418634186441865418664186741868418694187041871418724187341874418754187641877418784187941880418814188241883418844188541886418874188841889418904189141892418934189441895418964189741898418994190041901419024190341904419054190641907419084190941910419114191241913419144191541916419174191841919419204192141922419234192441925419264192741928419294193041931419324193341934419354193641937419384193941940419414194241943419444194541946419474194841949419504195141952419534195441955419564195741958419594196041961419624196341964419654196641967419684196941970419714197241973419744197541976419774197841979419804198141982419834198441985419864198741988419894199041991419924199341994419954199641997419984199942000420014200242003420044200542006420074200842009420104201142012420134201442015420164201742018420194202042021420224202342024420254202642027420284202942030420314203242033420344203542036420374203842039420404204142042420434204442045420464204742048420494205042051420524205342054420554205642057420584205942060420614206242063420644206542066420674206842069420704207142072420734207442075420764207742078420794208042081420824208342084420854208642087420884208942090420914209242093420944209542096420974209842099421004210142102421034210442105421064210742108421094211042111421124211342114421154211642117421184211942120421214212242123421244212542126421274212842129421304213142132421334213442135421364213742138421394214042141421424214342144421454214642147421484214942150421514215242153421544215542156421574215842159421604216142162421634216442165421664216742168421694217042171421724217342174421754217642177421784217942180421814218242183421844218542186421874218842189421904219142192421934219442195421964219742198421994220042201422024220342204422054220642207422084220942210422114221242213422144221542216422174221842219422204222142222422234222442225422264222742228422294223042231422324223342234422354223642237422384223942240422414224242243422444224542246422474224842249422504225142252422534225442255422564225742258422594226042261422624226342264422654226642267422684226942270422714227242273422744227542276422774227842279422804228142282422834228442285422864228742288422894229042291422924229342294422954229642297422984229942300423014230242303423044230542306423074230842309423104231142312423134231442315423164231742318423194232042321423224232342324423254232642327423284232942330423314233242333423344233542336423374233842339423404234142342423434234442345423464234742348423494235042351423524235342354423554235642357423584235942360423614236242363423644236542366423674236842369423704237142372423734237442375423764237742378423794238042381423824238342384423854238642387423884238942390423914239242393423944239542396423974239842399424004240142402424034240442405424064240742408424094241042411424124241342414424154241642417424184241942420424214242242423424244242542426424274242842429424304243142432424334243442435424364243742438424394244042441424424244342444424454244642447424484244942450424514245242453424544245542456424574245842459424604246142462424634246442465424664246742468424694247042471424724247342474424754247642477424784247942480424814248242483424844248542486424874248842489424904249142492424934249442495424964249742498424994250042501425024250342504425054250642507425084250942510425114251242513425144251542516425174251842519425204252142522425234252442525425264252742528425294253042531425324253342534425354253642537425384253942540425414254242543425444254542546425474254842549425504255142552425534255442555425564255742558425594256042561425624256342564425654256642567425684256942570425714257242573425744257542576425774257842579425804258142582425834258442585425864258742588425894259042591425924259342594425954259642597425984259942600426014260242603426044260542606426074260842609426104261142612426134261442615426164261742618426194262042621426224262342624426254262642627426284262942630426314263242633426344263542636426374263842639426404264142642426434264442645426464264742648426494265042651426524265342654426554265642657426584265942660426614266242663426644266542666426674266842669426704267142672426734267442675426764267742678426794268042681426824268342684426854268642687426884268942690426914269242693426944269542696426974269842699427004270142702427034270442705427064270742708427094271042711427124271342714427154271642717427184271942720427214272242723427244272542726427274272842729427304273142732427334273442735427364273742738427394274042741427424274342744427454274642747427484274942750427514275242753427544275542756427574275842759427604276142762427634276442765427664276742768427694277042771427724277342774427754277642777427784277942780427814278242783427844278542786427874278842789427904279142792427934279442795427964279742798427994280042801428024280342804428054280642807428084280942810428114281242813428144281542816428174281842819428204282142822428234282442825428264282742828428294283042831428324283342834428354283642837428384283942840428414284242843428444284542846428474284842849428504285142852428534285442855428564285742858428594286042861428624286342864428654286642867428684286942870428714287242873428744287542876428774287842879428804288142882428834288442885428864288742888428894289042891428924289342894428954289642897428984289942900429014290242903429044290542906429074290842909429104291142912429134291442915429164291742918429194292042921429224292342924429254292642927429284292942930429314293242933429344293542936429374293842939429404294142942429434294442945429464294742948429494295042951429524295342954429554295642957429584295942960429614296242963429644296542966429674296842969429704297142972429734297442975429764297742978429794298042981429824298342984429854298642987429884298942990429914299242993429944299542996429974299842999430004300143002430034300443005430064300743008430094301043011430124301343014430154301643017430184301943020430214302243023430244302543026430274302843029430304303143032430334303443035430364303743038430394304043041430424304343044430454304643047430484304943050430514305243053430544305543056430574305843059430604306143062430634306443065430664306743068430694307043071430724307343074430754307643077430784307943080430814308243083430844308543086430874308843089430904309143092430934309443095430964309743098430994310043101431024310343104431054310643107431084310943110431114311243113431144311543116431174311843119431204312143122431234312443125431264312743128431294313043131431324313343134431354313643137431384313943140431414314243143431444314543146431474314843149431504315143152431534315443155431564315743158431594316043161431624316343164431654316643167431684316943170431714317243173431744317543176431774317843179431804318143182431834318443185431864318743188431894319043191431924319343194431954319643197431984319943200432014320243203432044320543206432074320843209432104321143212432134321443215432164321743218432194322043221432224322343224432254322643227432284322943230432314323243233432344323543236432374323843239432404324143242432434324443245432464324743248432494325043251432524325343254432554325643257432584325943260432614326243263432644326543266432674326843269432704327143272432734327443275432764327743278432794328043281432824328343284432854328643287432884328943290432914329243293432944329543296432974329843299433004330143302433034330443305433064330743308433094331043311433124331343314433154331643317433184331943320433214332243323433244332543326433274332843329433304333143332433334333443335433364333743338433394334043341433424334343344433454334643347433484334943350433514335243353433544335543356433574335843359433604336143362433634336443365433664336743368433694337043371433724337343374433754337643377433784337943380433814338243383433844338543386433874338843389433904339143392433934339443395433964339743398433994340043401434024340343404434054340643407434084340943410434114341243413434144341543416434174341843419434204342143422434234342443425434264342743428434294343043431434324343343434434354343643437434384343943440434414344243443434444344543446434474344843449434504345143452434534345443455434564345743458434594346043461434624346343464434654346643467434684346943470434714347243473434744347543476434774347843479434804348143482434834348443485434864348743488434894349043491434924349343494434954349643497434984349943500435014350243503435044350543506435074350843509435104351143512435134351443515435164351743518435194352043521435224352343524435254352643527435284352943530435314353243533435344353543536435374353843539435404354143542435434354443545435464354743548435494355043551435524355343554435554355643557435584355943560435614356243563435644356543566435674356843569435704357143572435734357443575435764357743578435794358043581435824358343584435854358643587435884358943590435914359243593435944359543596435974359843599436004360143602436034360443605436064360743608436094361043611436124361343614436154361643617436184361943620436214362243623436244362543626436274362843629436304363143632436334363443635436364363743638436394364043641436424364343644436454364643647436484364943650436514365243653436544365543656436574365843659436604366143662436634366443665436664366743668436694367043671436724367343674436754367643677436784367943680436814368243683436844368543686436874368843689436904369143692436934369443695436964369743698436994370043701437024370343704437054370643707437084370943710437114371243713437144371543716437174371843719437204372143722437234372443725437264372743728437294373043731437324373343734437354373643737437384373943740437414374243743437444374543746437474374843749437504375143752437534375443755437564375743758437594376043761437624376343764437654376643767437684376943770437714377243773437744377543776437774377843779437804378143782437834378443785437864378743788437894379043791437924379343794437954379643797437984379943800438014380243803438044380543806438074380843809438104381143812438134381443815438164381743818438194382043821438224382343824438254382643827438284382943830438314383243833438344383543836438374383843839438404384143842438434384443845438464384743848438494385043851438524385343854438554385643857438584385943860438614386243863438644386543866438674386843869438704387143872438734387443875438764387743878438794388043881438824388343884438854388643887438884388943890438914389243893438944389543896438974389843899439004390143902439034390443905439064390743908439094391043911439124391343914439154391643917439184391943920439214392243923439244392543926439274392843929439304393143932439334393443935439364393743938439394394043941439424394343944439454394643947439484394943950439514395243953439544395543956439574395843959439604396143962439634396443965439664396743968439694397043971439724397343974439754397643977439784397943980439814398243983439844398543986439874398843989439904399143992439934399443995439964399743998439994400044001440024400344004440054400644007440084400944010440114401244013440144401544016440174401844019440204402144022440234402444025440264402744028440294403044031440324403344034440354403644037440384403944040440414404244043440444404544046440474404844049440504405144052440534405444055440564405744058440594406044061440624406344064440654406644067440684406944070440714407244073440744407544076440774407844079440804408144082440834408444085440864408744088440894409044091440924409344094440954409644097440984409944100441014410244103441044410544106441074410844109441104411144112441134411444115441164411744118441194412044121441224412344124441254412644127441284412944130441314413244133441344413544136441374413844139441404414144142441434414444145441464414744148441494415044151441524415344154441554415644157441584415944160441614416244163441644416544166441674416844169441704417144172441734417444175441764417744178441794418044181441824418344184441854418644187441884418944190441914419244193441944419544196441974419844199442004420144202442034420444205442064420744208442094421044211442124421344214442154421644217442184421944220442214422244223442244422544226442274422844229442304423144232442334423444235442364423744238442394424044241442424424344244442454424644247442484424944250442514425244253442544425544256442574425844259442604426144262442634426444265442664426744268442694427044271442724427344274442754427644277442784427944280442814428244283442844428544286442874428844289442904429144292442934429444295442964429744298442994430044301443024430344304443054430644307443084430944310443114431244313443144431544316443174431844319443204432144322443234432444325443264432744328443294433044331443324433344334443354433644337443384433944340443414434244343443444434544346443474434844349443504435144352443534435444355443564435744358443594436044361443624436344364443654436644367443684436944370443714437244373443744437544376443774437844379443804438144382443834438444385443864438744388443894439044391443924439344394443954439644397443984439944400444014440244403444044440544406444074440844409444104441144412444134441444415444164441744418444194442044421444224442344424444254442644427444284442944430444314443244433444344443544436444374443844439444404444144442444434444444445444464444744448444494445044451444524445344454444554445644457444584445944460444614446244463444644446544466444674446844469444704447144472444734447444475444764447744478444794448044481444824448344484444854448644487444884448944490444914449244493444944449544496444974449844499445004450144502445034450444505445064450744508445094451044511445124451344514445154451644517445184451944520445214452244523445244452544526445274452844529445304453144532445334453444535445364453744538445394454044541445424454344544445454454644547445484454944550445514455244553445544455544556445574455844559445604456144562445634456444565445664456744568445694457044571445724457344574445754457644577445784457944580445814458244583445844458544586445874458844589445904459144592445934459444595445964459744598445994460044601446024460344604446054460644607446084460944610446114461244613446144461544616446174461844619446204462144622446234462444625446264462744628446294463044631446324463344634446354463644637446384463944640446414464244643446444464544646446474464844649446504465144652446534465444655446564465744658446594466044661446624466344664446654466644667446684466944670446714467244673446744467544676446774467844679446804468144682446834468444685446864468744688446894469044691446924469344694446954469644697446984469944700447014470244703447044470544706447074470844709447104471144712447134471444715447164471744718447194472044721447224472344724447254472644727447284472944730447314473244733447344473544736447374473844739447404474144742447434474444745447464474744748447494475044751447524475344754447554475644757447584475944760447614476244763447644476544766447674476844769447704477144772447734477444775447764477744778447794478044781447824478344784447854478644787447884478944790447914479244793447944479544796447974479844799448004480144802448034480444805448064480744808448094481044811448124481344814448154481644817448184481944820448214482244823448244482544826448274482844829448304483144832448334483444835448364483744838448394484044841448424484344844448454484644847448484484944850448514485244853448544485544856448574485844859448604486144862448634486444865448664486744868448694487044871448724487344874448754487644877448784487944880448814488244883448844488544886448874488844889448904489144892448934489444895448964489744898448994490044901449024490344904449054490644907449084490944910449114491244913449144491544916449174491844919449204492144922449234492444925449264492744928449294493044931449324493344934449354493644937449384493944940449414494244943449444494544946449474494844949449504495144952449534495444955449564495744958449594496044961449624496344964449654496644967449684496944970449714497244973449744497544976449774497844979449804498144982449834498444985449864498744988449894499044991449924499344994449954499644997449984499945000450014500245003450044500545006450074500845009450104501145012450134501445015450164501745018450194502045021450224502345024450254502645027450284502945030450314503245033450344503545036450374503845039450404504145042450434504445045450464504745048450494505045051450524505345054450554505645057450584505945060450614506245063450644506545066450674506845069450704507145072450734507445075450764507745078450794508045081450824508345084450854508645087450884508945090450914509245093450944509545096450974509845099451004510145102451034510445105451064510745108451094511045111451124511345114451154511645117451184511945120451214512245123451244512545126451274512845129451304513145132451334513445135451364513745138451394514045141451424514345144451454514645147451484514945150451514515245153451544515545156451574515845159451604516145162451634516445165451664516745168451694517045171451724517345174451754517645177451784517945180451814518245183451844518545186451874518845189451904519145192451934519445195451964519745198451994520045201452024520345204452054520645207452084520945210452114521245213452144521545216452174521845219452204522145222452234522445225452264522745228452294523045231452324523345234452354523645237452384523945240452414524245243452444524545246452474524845249452504525145252452534525445255452564525745258452594526045261452624526345264452654526645267452684526945270452714527245273452744527545276452774527845279452804528145282452834528445285452864528745288452894529045291452924529345294452954529645297452984529945300453014530245303453044530545306453074530845309453104531145312453134531445315453164531745318453194532045321453224532345324453254532645327453284532945330453314533245333453344533545336453374533845339453404534145342453434534445345453464534745348453494535045351453524535345354453554535645357453584535945360453614536245363453644536545366453674536845369453704537145372453734537445375453764537745378453794538045381453824538345384453854538645387453884538945390453914539245393453944539545396453974539845399454004540145402454034540445405454064540745408454094541045411454124541345414454154541645417454184541945420454214542245423454244542545426454274542845429454304543145432454334543445435454364543745438454394544045441454424544345444454454544645447454484544945450454514545245453454544545545456454574545845459454604546145462454634546445465454664546745468454694547045471454724547345474454754547645477454784547945480454814548245483454844548545486454874548845489454904549145492454934549445495454964549745498454994550045501455024550345504455054550645507455084550945510455114551245513455144551545516455174551845519455204552145522455234552445525455264552745528455294553045531455324553345534455354553645537455384553945540455414554245543455444554545546455474554845549455504555145552455534555445555455564555745558455594556045561455624556345564455654556645567455684556945570455714557245573455744557545576455774557845579455804558145582455834558445585455864558745588455894559045591455924559345594455954559645597455984559945600456014560245603456044560545606456074560845609456104561145612456134561445615456164561745618456194562045621456224562345624456254562645627456284562945630456314563245633456344563545636456374563845639456404564145642456434564445645456464564745648456494565045651456524565345654456554565645657456584565945660456614566245663456644566545666456674566845669456704567145672456734567445675456764567745678456794568045681456824568345684456854568645687456884568945690456914569245693456944569545696456974569845699457004570145702457034570445705457064570745708457094571045711457124571345714457154571645717457184571945720457214572245723457244572545726457274572845729457304573145732457334573445735457364573745738457394574045741457424574345744457454574645747457484574945750457514575245753457544575545756457574575845759457604576145762457634576445765457664576745768457694577045771457724577345774457754577645777457784577945780457814578245783457844578545786457874578845789457904579145792457934579445795457964579745798457994580045801458024580345804458054580645807458084580945810458114581245813458144581545816458174581845819458204582145822458234582445825458264582745828458294583045831458324583345834458354583645837458384583945840458414584245843458444584545846458474584845849458504585145852458534585445855458564585745858458594586045861458624586345864458654586645867458684586945870458714587245873458744587545876458774587845879458804588145882458834588445885458864588745888458894589045891458924589345894458954589645897458984589945900459014590245903459044590545906459074590845909459104591145912459134591445915459164591745918459194592045921459224592345924459254592645927459284592945930459314593245933459344593545936459374593845939459404594145942459434594445945459464594745948459494595045951459524595345954459554595645957459584595945960459614596245963459644596545966459674596845969459704597145972459734597445975459764597745978459794598045981459824598345984459854598645987459884598945990459914599245993459944599545996459974599845999460004600146002460034600446005460064600746008460094601046011460124601346014460154601646017460184601946020460214602246023460244602546026460274602846029460304603146032460334603446035460364603746038460394604046041460424604346044460454604646047460484604946050460514605246053460544605546056460574605846059460604606146062460634606446065460664606746068460694607046071460724607346074460754607646077460784607946080460814608246083460844608546086460874608846089460904609146092460934609446095460964609746098460994610046101461024610346104461054610646107461084610946110461114611246113461144611546116461174611846119461204612146122461234612446125461264612746128461294613046131461324613346134461354613646137461384613946140461414614246143461444614546146461474614846149461504615146152461534615446155461564615746158461594616046161461624616346164461654616646167461684616946170461714617246173461744617546176461774617846179461804618146182461834618446185461864618746188461894619046191461924619346194461954619646197461984619946200462014620246203462044620546206462074620846209462104621146212462134621446215462164621746218462194622046221462224622346224462254622646227462284622946230462314623246233462344623546236462374623846239462404624146242462434624446245462464624746248462494625046251462524625346254462554625646257462584625946260462614626246263462644626546266462674626846269462704627146272462734627446275462764627746278462794628046281462824628346284462854628646287462884628946290462914629246293462944629546296462974629846299463004630146302463034630446305463064630746308463094631046311463124631346314463154631646317463184631946320463214632246323463244632546326463274632846329463304633146332463334633446335463364633746338463394634046341463424634346344463454634646347463484634946350463514635246353463544635546356463574635846359463604636146362463634636446365463664636746368463694637046371463724637346374463754637646377463784637946380463814638246383463844638546386463874638846389463904639146392463934639446395463964639746398463994640046401464024640346404464054640646407464084640946410464114641246413464144641546416464174641846419464204642146422464234642446425464264642746428464294643046431464324643346434464354643646437464384643946440464414644246443464444644546446464474644846449464504645146452464534645446455464564645746458464594646046461464624646346464464654646646467464684646946470464714647246473464744647546476464774647846479464804648146482464834648446485464864648746488464894649046491464924649346494464954649646497464984649946500465014650246503465044650546506465074650846509465104651146512465134651446515465164651746518465194652046521465224652346524465254652646527465284652946530465314653246533465344653546536465374653846539465404654146542465434654446545465464654746548465494655046551465524655346554465554655646557465584655946560465614656246563465644656546566465674656846569465704657146572465734657446575465764657746578465794658046581465824658346584465854658646587465884658946590465914659246593465944659546596465974659846599466004660146602466034660446605466064660746608466094661046611466124661346614466154661646617466184661946620466214662246623466244662546626466274662846629466304663146632466334663446635466364663746638466394664046641466424664346644466454664646647466484664946650466514665246653466544665546656466574665846659466604666146662466634666446665466664666746668466694667046671466724667346674466754667646677466784667946680466814668246683466844668546686466874668846689466904669146692466934669446695466964669746698466994670046701467024670346704467054670646707467084670946710467114671246713467144671546716467174671846719467204672146722467234672446725467264672746728467294673046731467324673346734467354673646737467384673946740467414674246743467444674546746467474674846749467504675146752467534675446755467564675746758467594676046761467624676346764467654676646767467684676946770467714677246773467744677546776467774677846779467804678146782467834678446785467864678746788467894679046791467924679346794467954679646797467984679946800468014680246803468044680546806468074680846809468104681146812468134681446815468164681746818468194682046821468224682346824468254682646827468284682946830468314683246833468344683546836468374683846839468404684146842468434684446845468464684746848468494685046851468524685346854468554685646857468584685946860468614686246863468644686546866468674686846869468704687146872468734687446875468764687746878468794688046881468824688346884468854688646887468884688946890468914689246893468944689546896468974689846899469004690146902469034690446905469064690746908469094691046911469124691346914469154691646917469184691946920469214692246923469244692546926469274692846929469304693146932469334693446935469364693746938469394694046941469424694346944469454694646947469484694946950469514695246953469544695546956469574695846959469604696146962469634696446965469664696746968469694697046971469724697346974469754697646977469784697946980469814698246983469844698546986469874698846989469904699146992469934699446995469964699746998469994700047001470024700347004470054700647007470084700947010470114701247013470144701547016470174701847019470204702147022470234702447025470264702747028470294703047031470324703347034470354703647037470384703947040470414704247043470444704547046470474704847049470504705147052470534705447055470564705747058470594706047061470624706347064470654706647067470684706947070470714707247073470744707547076470774707847079470804708147082470834708447085470864708747088470894709047091470924709347094470954709647097470984709947100471014710247103471044710547106471074710847109471104711147112471134711447115471164711747118471194712047121471224712347124471254712647127471284712947130471314713247133471344713547136471374713847139471404714147142471434714447145471464714747148471494715047151471524715347154471554715647157471584715947160471614716247163471644716547166471674716847169471704717147172471734717447175471764717747178471794718047181471824718347184471854718647187471884718947190471914719247193471944719547196471974719847199472004720147202472034720447205472064720747208472094721047211472124721347214472154721647217472184721947220472214722247223472244722547226472274722847229472304723147232472334723447235472364723747238472394724047241472424724347244472454724647247472484724947250472514725247253472544725547256472574725847259472604726147262472634726447265472664726747268472694727047271472724727347274472754727647277472784727947280472814728247283472844728547286472874728847289472904729147292472934729447295472964729747298472994730047301473024730347304473054730647307473084730947310473114731247313473144731547316473174731847319473204732147322473234732447325473264732747328473294733047331473324733347334473354733647337473384733947340473414734247343473444734547346473474734847349473504735147352473534735447355473564735747358473594736047361473624736347364473654736647367473684736947370473714737247373473744737547376473774737847379473804738147382473834738447385473864738747388473894739047391473924739347394473954739647397473984739947400474014740247403474044740547406474074740847409474104741147412474134741447415474164741747418474194742047421474224742347424474254742647427474284742947430474314743247433474344743547436474374743847439474404744147442474434744447445474464744747448474494745047451474524745347454474554745647457474584745947460474614746247463474644746547466474674746847469474704747147472474734747447475474764747747478474794748047481474824748347484474854748647487474884748947490474914749247493474944749547496474974749847499475004750147502475034750447505475064750747508475094751047511475124751347514475154751647517475184751947520475214752247523475244752547526475274752847529475304753147532475334753447535475364753747538475394754047541475424754347544475454754647547475484754947550475514755247553475544755547556475574755847559475604756147562475634756447565475664756747568475694757047571475724757347574475754757647577475784757947580475814758247583475844758547586475874758847589475904759147592475934759447595475964759747598475994760047601476024760347604476054760647607476084760947610476114761247613476144761547616476174761847619476204762147622476234762447625476264762747628476294763047631476324763347634476354763647637476384763947640476414764247643476444764547646476474764847649476504765147652476534765447655476564765747658476594766047661476624766347664476654766647667476684766947670476714767247673476744767547676476774767847679476804768147682476834768447685476864768747688476894769047691476924769347694476954769647697476984769947700477014770247703477044770547706477074770847709477104771147712477134771447715477164771747718477194772047721477224772347724477254772647727477284772947730477314773247733477344773547736477374773847739477404774147742477434774447745477464774747748477494775047751477524775347754477554775647757477584775947760477614776247763477644776547766477674776847769477704777147772477734777447775477764777747778477794778047781477824778347784477854778647787477884778947790477914779247793477944779547796477974779847799478004780147802478034780447805478064780747808478094781047811478124781347814478154781647817478184781947820478214782247823478244782547826478274782847829478304783147832478334783447835478364783747838478394784047841478424784347844478454784647847478484784947850478514785247853478544785547856478574785847859478604786147862478634786447865478664786747868478694787047871478724787347874478754787647877478784787947880478814788247883478844788547886478874788847889478904789147892478934789447895478964789747898478994790047901479024790347904479054790647907479084790947910479114791247913479144791547916479174791847919479204792147922479234792447925479264792747928479294793047931479324793347934479354793647937479384793947940479414794247943479444794547946479474794847949479504795147952479534795447955479564795747958479594796047961479624796347964479654796647967479684796947970479714797247973479744797547976479774797847979479804798147982479834798447985479864798747988479894799047991479924799347994479954799647997479984799948000480014800248003480044800548006480074800848009480104801148012480134801448015480164801748018480194802048021480224802348024480254802648027480284802948030480314803248033480344803548036480374803848039480404804148042480434804448045480464804748048480494805048051480524805348054480554805648057480584805948060480614806248063480644806548066480674806848069480704807148072480734807448075480764807748078480794808048081480824808348084480854808648087480884808948090480914809248093480944809548096480974809848099481004810148102481034810448105481064810748108481094811048111481124811348114481154811648117481184811948120481214812248123481244812548126481274812848129481304813148132481334813448135481364813748138481394814048141481424814348144481454814648147481484814948150481514815248153481544815548156481574815848159481604816148162481634816448165481664816748168481694817048171481724817348174481754817648177481784817948180481814818248183481844818548186481874818848189481904819148192481934819448195481964819748198481994820048201482024820348204482054820648207482084820948210482114821248213482144821548216482174821848219482204822148222482234822448225482264822748228482294823048231482324823348234482354823648237482384823948240482414824248243482444824548246482474824848249482504825148252482534825448255482564825748258482594826048261482624826348264482654826648267482684826948270482714827248273482744827548276482774827848279482804828148282482834828448285482864828748288482894829048291482924829348294482954829648297482984829948300483014830248303483044830548306483074830848309483104831148312483134831448315483164831748318483194832048321483224832348324483254832648327483284832948330483314833248333483344833548336483374833848339483404834148342483434834448345483464834748348483494835048351483524835348354483554835648357483584835948360483614836248363483644836548366483674836848369483704837148372483734837448375483764837748378483794838048381483824838348384483854838648387483884838948390483914839248393483944839548396483974839848399484004840148402484034840448405484064840748408484094841048411484124841348414484154841648417484184841948420484214842248423484244842548426484274842848429484304843148432484334843448435484364843748438484394844048441484424844348444484454844648447484484844948450484514845248453484544845548456484574845848459484604846148462484634846448465484664846748468484694847048471484724847348474484754847648477484784847948480484814848248483484844848548486484874848848489484904849148492484934849448495484964849748498484994850048501485024850348504485054850648507485084850948510485114851248513485144851548516485174851848519485204852148522485234852448525485264852748528485294853048531485324853348534485354853648537485384853948540485414854248543485444854548546485474854848549485504855148552485534855448555485564855748558485594856048561485624856348564485654856648567485684856948570485714857248573485744857548576485774857848579485804858148582485834858448585485864858748588485894859048591485924859348594485954859648597485984859948600486014860248603486044860548606486074860848609486104861148612486134861448615486164861748618486194862048621486224862348624486254862648627486284862948630486314863248633486344863548636486374863848639486404864148642486434864448645486464864748648486494865048651486524865348654486554865648657486584865948660486614866248663486644866548666486674866848669486704867148672486734867448675486764867748678486794868048681486824868348684486854868648687486884868948690486914869248693486944869548696486974869848699487004870148702487034870448705487064870748708487094871048711487124871348714487154871648717487184871948720487214872248723487244872548726487274872848729487304873148732487334873448735487364873748738487394874048741487424874348744487454874648747487484874948750487514875248753487544875548756487574875848759487604876148762487634876448765487664876748768487694877048771487724877348774487754877648777487784877948780487814878248783487844878548786487874878848789487904879148792487934879448795487964879748798487994880048801488024880348804488054880648807488084880948810488114881248813488144881548816488174881848819488204882148822488234882448825488264882748828488294883048831488324883348834488354883648837488384883948840488414884248843488444884548846488474884848849488504885148852488534885448855488564885748858488594886048861488624886348864488654886648867488684886948870488714887248873488744887548876488774887848879488804888148882488834888448885488864888748888488894889048891488924889348894488954889648897488984889948900489014890248903489044890548906489074890848909489104891148912489134891448915489164891748918489194892048921489224892348924489254892648927489284892948930489314893248933489344893548936489374893848939489404894148942489434894448945489464894748948489494895048951489524895348954489554895648957489584895948960489614896248963489644896548966489674896848969489704897148972489734897448975489764897748978489794898048981489824898348984489854898648987489884898948990489914899248993489944899548996489974899848999490004900149002490034900449005490064900749008490094901049011490124901349014490154901649017490184901949020490214902249023490244902549026490274902849029490304903149032490334903449035490364903749038490394904049041490424904349044490454904649047490484904949050490514905249053490544905549056490574905849059490604906149062490634906449065490664906749068490694907049071490724907349074490754907649077490784907949080490814908249083490844908549086490874908849089490904909149092490934909449095490964909749098490994910049101491024910349104491054910649107491084910949110491114911249113491144911549116491174911849119491204912149122491234912449125491264912749128491294913049131491324913349134491354913649137491384913949140491414914249143491444914549146491474914849149491504915149152491534915449155491564915749158491594916049161491624916349164491654916649167491684916949170491714917249173491744917549176491774917849179491804918149182491834918449185491864918749188491894919049191491924919349194491954919649197491984919949200492014920249203492044920549206492074920849209492104921149212492134921449215492164921749218492194922049221492224922349224492254922649227492284922949230492314923249233492344923549236492374923849239492404924149242492434924449245492464924749248492494925049251492524925349254492554925649257492584925949260492614926249263492644926549266492674926849269492704927149272492734927449275492764927749278492794928049281492824928349284492854928649287492884928949290492914929249293492944929549296492974929849299493004930149302493034930449305493064930749308493094931049311493124931349314493154931649317493184931949320493214932249323493244932549326493274932849329493304933149332493334933449335493364933749338493394934049341493424934349344493454934649347493484934949350493514935249353493544935549356493574935849359493604936149362493634936449365493664936749368493694937049371493724937349374493754937649377493784937949380493814938249383493844938549386493874938849389493904939149392493934939449395493964939749398493994940049401494024940349404494054940649407494084940949410494114941249413494144941549416494174941849419494204942149422494234942449425494264942749428494294943049431494324943349434494354943649437494384943949440494414944249443494444944549446494474944849449494504945149452494534945449455494564945749458494594946049461494624946349464494654946649467494684946949470494714947249473494744947549476494774947849479494804948149482494834948449485494864948749488494894949049491494924949349494494954949649497494984949949500495014950249503495044950549506495074950849509495104951149512495134951449515495164951749518495194952049521495224952349524495254952649527495284952949530495314953249533495344953549536495374953849539495404954149542495434954449545495464954749548495494955049551495524955349554495554955649557495584955949560495614956249563495644956549566495674956849569495704957149572495734957449575495764957749578495794958049581495824958349584495854958649587495884958949590495914959249593495944959549596495974959849599496004960149602496034960449605496064960749608496094961049611496124961349614496154961649617496184961949620496214962249623496244962549626496274962849629496304963149632496334963449635496364963749638496394964049641496424964349644496454964649647496484964949650496514965249653496544965549656496574965849659496604966149662496634966449665496664966749668496694967049671496724967349674496754967649677496784967949680496814968249683496844968549686496874968849689496904969149692496934969449695496964969749698496994970049701497024970349704497054970649707497084970949710497114971249713497144971549716497174971849719497204972149722497234972449725497264972749728497294973049731497324973349734497354973649737497384973949740497414974249743497444974549746497474974849749497504975149752497534975449755497564975749758497594976049761497624976349764497654976649767497684976949770497714977249773497744977549776497774977849779497804978149782497834978449785497864978749788497894979049791497924979349794497954979649797497984979949800498014980249803498044980549806498074980849809498104981149812498134981449815498164981749818498194982049821498224982349824498254982649827498284982949830498314983249833498344983549836498374983849839498404984149842498434984449845498464984749848498494985049851498524985349854498554985649857498584985949860498614986249863498644986549866498674986849869498704987149872498734987449875498764987749878498794988049881498824988349884498854988649887498884988949890498914989249893498944989549896498974989849899499004990149902499034990449905499064990749908499094991049911499124991349914499154991649917499184991949920499214992249923499244992549926499274992849929499304993149932499334993449935499364993749938499394994049941499424994349944499454994649947499484994949950499514995249953499544995549956499574995849959499604996149962499634996449965499664996749968499694997049971499724997349974499754997649977499784997949980499814998249983499844998549986499874998849989499904999149992499934999449995499964999749998499995000050001500025000350004500055000650007500085000950010500115001250013500145001550016500175001850019500205002150022500235002450025500265002750028500295003050031500325003350034500355003650037500385003950040500415004250043500445004550046500475004850049500505005150052500535005450055500565005750058500595006050061500625006350064500655006650067500685006950070500715007250073500745007550076500775007850079500805008150082500835008450085500865008750088500895009050091500925009350094500955009650097500985009950100501015010250103501045010550106501075010850109501105011150112501135011450115501165011750118501195012050121501225012350124501255012650127501285012950130501315013250133501345013550136501375013850139501405014150142501435014450145501465014750148501495015050151501525015350154501555015650157501585015950160501615016250163501645016550166501675016850169501705017150172501735017450175501765017750178501795018050181501825018350184501855018650187501885018950190501915019250193501945019550196501975019850199502005020150202502035020450205502065020750208502095021050211502125021350214502155021650217502185021950220502215022250223502245022550226502275022850229502305023150232502335023450235502365023750238502395024050241502425024350244502455024650247502485024950250502515025250253502545025550256502575025850259502605026150262502635026450265502665026750268502695027050271502725027350274502755027650277502785027950280502815028250283502845028550286502875028850289502905029150292502935029450295502965029750298502995030050301503025030350304503055030650307503085030950310503115031250313503145031550316503175031850319503205032150322503235032450325503265032750328503295033050331503325033350334503355033650337503385033950340503415034250343503445034550346503475034850349503505035150352503535035450355503565035750358503595036050361503625036350364503655036650367503685036950370503715037250373503745037550376503775037850379503805038150382503835038450385503865038750388503895039050391503925039350394503955039650397503985039950400504015040250403504045040550406504075040850409504105041150412504135041450415504165041750418504195042050421504225042350424504255042650427504285042950430504315043250433504345043550436504375043850439504405044150442504435044450445504465044750448504495045050451504525045350454504555045650457504585045950460504615046250463504645046550466504675046850469504705047150472504735047450475504765047750478504795048050481504825048350484504855048650487504885048950490504915049250493504945049550496504975049850499505005050150502505035050450505505065050750508505095051050511505125051350514505155051650517505185051950520505215052250523505245052550526505275052850529505305053150532505335053450535505365053750538505395054050541505425054350544505455054650547505485054950550505515055250553505545055550556505575055850559505605056150562505635056450565505665056750568505695057050571505725057350574505755057650577505785057950580505815058250583505845058550586505875058850589505905059150592505935059450595505965059750598505995060050601506025060350604506055060650607506085060950610506115061250613506145061550616506175061850619506205062150622506235062450625506265062750628506295063050631506325063350634506355063650637506385063950640506415064250643506445064550646506475064850649506505065150652506535065450655506565065750658506595066050661506625066350664506655066650667506685066950670506715067250673506745067550676506775067850679506805068150682506835068450685506865068750688506895069050691506925069350694506955069650697506985069950700507015070250703507045070550706507075070850709507105071150712507135071450715507165071750718507195072050721507225072350724507255072650727507285072950730507315073250733507345073550736507375073850739507405074150742507435074450745507465074750748507495075050751507525075350754507555075650757507585075950760507615076250763507645076550766507675076850769507705077150772507735077450775507765077750778507795078050781507825078350784507855078650787507885078950790507915079250793507945079550796507975079850799508005080150802508035080450805508065080750808508095081050811508125081350814508155081650817508185081950820508215082250823508245082550826508275082850829508305083150832508335083450835508365083750838508395084050841508425084350844508455084650847508485084950850508515085250853508545085550856508575085850859508605086150862508635086450865508665086750868508695087050871508725087350874508755087650877508785087950880508815088250883508845088550886508875088850889508905089150892508935089450895508965089750898508995090050901509025090350904509055090650907509085090950910509115091250913509145091550916509175091850919509205092150922509235092450925509265092750928509295093050931509325093350934509355093650937509385093950940509415094250943509445094550946509475094850949509505095150952509535095450955509565095750958509595096050961509625096350964509655096650967509685096950970509715097250973509745097550976509775097850979509805098150982509835098450985509865098750988509895099050991509925099350994509955099650997509985099951000510015100251003510045100551006510075100851009510105101151012510135101451015510165101751018510195102051021510225102351024510255102651027510285102951030510315103251033510345103551036510375103851039510405104151042510435104451045510465104751048510495105051051510525105351054510555105651057510585105951060510615106251063510645106551066510675106851069510705107151072510735107451075510765107751078510795108051081510825108351084510855108651087510885108951090510915109251093510945109551096510975109851099511005110151102511035110451105511065110751108511095111051111511125111351114511155111651117511185111951120511215112251123511245112551126511275112851129511305113151132511335113451135511365113751138511395114051141511425114351144511455114651147511485114951150511515115251153511545115551156511575115851159511605116151162511635116451165511665116751168511695117051171511725117351174511755117651177511785117951180511815118251183511845118551186511875118851189511905119151192511935119451195511965119751198511995120051201512025120351204512055120651207512085120951210512115121251213512145121551216512175121851219512205122151222512235122451225512265122751228512295123051231512325123351234512355123651237512385123951240512415124251243512445124551246512475124851249512505125151252512535125451255512565125751258512595126051261512625126351264512655126651267512685126951270512715127251273512745127551276512775127851279512805128151282512835128451285512865128751288512895129051291512925129351294512955129651297512985129951300513015130251303513045130551306513075130851309513105131151312513135131451315513165131751318513195132051321513225132351324513255132651327513285132951330513315133251333513345133551336513375133851339513405134151342513435134451345513465134751348513495135051351513525135351354513555135651357513585135951360513615136251363513645136551366513675136851369513705137151372513735137451375513765137751378513795138051381513825138351384513855138651387513885138951390513915139251393513945139551396513975139851399514005140151402514035140451405514065140751408514095141051411514125141351414514155141651417514185141951420514215142251423514245142551426514275142851429514305143151432514335143451435514365143751438514395144051441514425144351444514455144651447514485144951450514515145251453514545145551456514575145851459514605146151462514635146451465514665146751468514695147051471514725147351474514755147651477514785147951480514815148251483514845148551486514875148851489514905149151492514935149451495514965149751498514995150051501515025150351504515055150651507515085150951510515115151251513515145151551516515175151851519515205152151522515235152451525515265152751528515295153051531515325153351534515355153651537515385153951540515415154251543515445154551546515475154851549515505155151552515535155451555515565155751558515595156051561515625156351564515655156651567515685156951570515715157251573515745157551576515775157851579515805158151582515835158451585515865158751588515895159051591515925159351594515955159651597515985159951600516015160251603516045160551606516075160851609516105161151612516135161451615516165161751618516195162051621516225162351624516255162651627516285162951630516315163251633516345163551636516375163851639516405164151642516435164451645516465164751648516495165051651516525165351654516555165651657516585165951660516615166251663516645166551666516675166851669516705167151672516735167451675516765167751678516795168051681516825168351684516855168651687516885168951690516915169251693516945169551696516975169851699517005170151702517035170451705517065170751708517095171051711517125171351714517155171651717517185171951720517215172251723517245172551726517275172851729517305173151732517335173451735517365173751738517395174051741517425174351744517455174651747517485174951750517515175251753517545175551756517575175851759517605176151762517635176451765517665176751768517695177051771517725177351774517755177651777517785177951780517815178251783517845178551786517875178851789517905179151792517935179451795517965179751798517995180051801518025180351804518055180651807518085180951810518115181251813518145181551816518175181851819518205182151822518235182451825518265182751828518295183051831518325183351834518355183651837518385183951840518415184251843518445184551846518475184851849518505185151852518535185451855518565185751858518595186051861518625186351864518655186651867518685186951870518715187251873518745187551876518775187851879518805188151882518835188451885518865188751888518895189051891518925189351894518955189651897518985189951900519015190251903519045190551906519075190851909519105191151912519135191451915519165191751918519195192051921519225192351924519255192651927519285192951930519315193251933519345193551936519375193851939519405194151942519435194451945519465194751948519495195051951519525195351954519555195651957519585195951960519615196251963519645196551966519675196851969519705197151972519735197451975519765197751978519795198051981519825198351984519855198651987519885198951990519915199251993519945199551996519975199851999520005200152002520035200452005520065200752008520095201052011520125201352014520155201652017520185201952020520215202252023520245202552026520275202852029520305203152032520335203452035520365203752038520395204052041520425204352044520455204652047520485204952050520515205252053520545205552056520575205852059520605206152062520635206452065520665206752068520695207052071520725207352074520755207652077520785207952080520815208252083520845208552086520875208852089520905209152092520935209452095520965209752098520995210052101521025210352104521055210652107521085210952110521115211252113521145211552116521175211852119521205212152122521235212452125521265212752128521295213052131521325213352134521355213652137521385213952140521415214252143521445214552146521475214852149521505215152152521535215452155521565215752158521595216052161521625216352164521655216652167521685216952170521715217252173521745217552176521775217852179521805218152182521835218452185521865218752188521895219052191521925219352194521955219652197521985219952200522015220252203522045220552206522075220852209522105221152212522135221452215522165221752218522195222052221522225222352224522255222652227522285222952230522315223252233522345223552236522375223852239522405224152242522435224452245522465224752248522495225052251522525225352254522555225652257522585225952260522615226252263522645226552266522675226852269522705227152272522735227452275522765227752278522795228052281522825228352284522855228652287522885228952290522915229252293522945229552296522975229852299523005230152302523035230452305523065230752308523095231052311523125231352314523155231652317523185231952320523215232252323523245232552326523275232852329523305233152332523335233452335523365233752338523395234052341523425234352344523455234652347523485234952350523515235252353523545235552356523575235852359523605236152362523635236452365523665236752368523695237052371523725237352374523755237652377523785237952380523815238252383523845238552386523875238852389523905239152392523935239452395523965239752398523995240052401524025240352404524055240652407524085240952410524115241252413524145241552416524175241852419524205242152422524235242452425524265242752428524295243052431524325243352434524355243652437524385243952440524415244252443524445244552446524475244852449524505245152452524535245452455524565245752458524595246052461524625246352464524655246652467524685246952470524715247252473524745247552476524775247852479524805248152482524835248452485524865248752488524895249052491524925249352494524955249652497524985249952500525015250252503525045250552506525075250852509525105251152512525135251452515525165251752518525195252052521525225252352524525255252652527525285252952530525315253252533525345253552536525375253852539525405254152542525435254452545525465254752548525495255052551525525255352554525555255652557525585255952560525615256252563525645256552566525675256852569525705257152572525735257452575525765257752578525795258052581525825258352584525855258652587525885258952590525915259252593525945259552596525975259852599526005260152602526035260452605526065260752608526095261052611526125261352614526155261652617526185261952620526215262252623526245262552626526275262852629526305263152632526335263452635526365263752638526395264052641526425264352644526455264652647526485264952650526515265252653526545265552656526575265852659526605266152662526635266452665526665266752668526695267052671526725267352674526755267652677526785267952680526815268252683526845268552686526875268852689526905269152692526935269452695526965269752698526995270052701527025270352704527055270652707527085270952710527115271252713527145271552716527175271852719527205272152722527235272452725527265272752728527295273052731527325273352734527355273652737527385273952740527415274252743527445274552746527475274852749527505275152752527535275452755527565275752758527595276052761527625276352764527655276652767527685276952770527715277252773527745277552776527775277852779527805278152782527835278452785527865278752788527895279052791527925279352794527955279652797527985279952800528015280252803528045280552806528075280852809528105281152812528135281452815528165281752818528195282052821528225282352824528255282652827528285282952830528315283252833528345283552836528375283852839528405284152842528435284452845528465284752848528495285052851528525285352854528555285652857528585285952860528615286252863528645286552866528675286852869528705287152872528735287452875528765287752878528795288052881528825288352884528855288652887528885288952890528915289252893528945289552896528975289852899529005290152902529035290452905529065290752908529095291052911529125291352914529155291652917529185291952920529215292252923529245292552926529275292852929529305293152932529335293452935529365293752938529395294052941529425294352944529455294652947529485294952950529515295252953529545295552956529575295852959529605296152962529635296452965529665296752968529695297052971529725297352974529755297652977529785297952980529815298252983529845298552986529875298852989529905299152992529935299452995529965299752998529995300053001530025300353004530055300653007530085300953010530115301253013530145301553016530175301853019530205302153022530235302453025530265302753028530295303053031530325303353034530355303653037530385303953040530415304253043530445304553046530475304853049530505305153052530535305453055530565305753058530595306053061530625306353064530655306653067530685306953070530715307253073530745307553076530775307853079530805308153082530835308453085530865308753088530895309053091530925309353094530955309653097530985309953100531015310253103531045310553106531075310853109531105311153112531135311453115531165311753118531195312053121531225312353124531255312653127531285312953130531315313253133531345313553136531375313853139531405314153142531435314453145531465314753148531495315053151531525315353154531555315653157531585315953160531615316253163531645316553166531675316853169531705317153172531735317453175531765317753178531795318053181531825318353184531855318653187531885318953190531915319253193531945319553196531975319853199532005320153202532035320453205532065320753208532095321053211532125321353214532155321653217532185321953220532215322253223532245322553226532275322853229532305323153232532335323453235532365323753238532395324053241532425324353244532455324653247532485324953250532515325253253532545325553256532575325853259532605326153262532635326453265532665326753268532695327053271532725327353274532755327653277532785327953280532815328253283532845328553286532875328853289532905329153292532935329453295532965329753298532995330053301533025330353304533055330653307533085330953310533115331253313533145331553316533175331853319533205332153322533235332453325533265332753328533295333053331533325333353334533355333653337533385333953340533415334253343533445334553346533475334853349533505335153352533535335453355533565335753358533595336053361533625336353364533655336653367533685336953370533715337253373533745337553376533775337853379533805338153382533835338453385533865338753388533895339053391533925339353394533955339653397533985339953400534015340253403534045340553406534075340853409534105341153412534135341453415534165341753418534195342053421534225342353424534255342653427534285342953430534315343253433534345343553436534375343853439534405344153442534435344453445534465344753448534495345053451534525345353454534555345653457534585345953460534615346253463534645346553466534675346853469534705347153472534735347453475534765347753478534795348053481534825348353484534855348653487534885348953490534915349253493534945349553496534975349853499535005350153502535035350453505535065350753508535095351053511535125351353514535155351653517535185351953520535215352253523535245352553526535275352853529535305353153532535335353453535535365353753538535395354053541535425354353544535455354653547535485354953550535515355253553535545355553556535575355853559535605356153562535635356453565535665356753568535695357053571535725357353574535755357653577535785357953580535815358253583535845358553586535875358853589535905359153592535935359453595535965359753598535995360053601536025360353604536055360653607536085360953610536115361253613536145361553616536175361853619536205362153622536235362453625536265362753628536295363053631536325363353634536355363653637536385363953640536415364253643536445364553646536475364853649536505365153652536535365453655536565365753658536595366053661536625366353664536655366653667536685366953670536715367253673536745367553676536775367853679536805368153682536835368453685536865368753688536895369053691536925369353694536955369653697536985369953700537015370253703537045370553706537075370853709537105371153712537135371453715537165371753718537195372053721537225372353724537255372653727537285372953730537315373253733537345373553736537375373853739537405374153742537435374453745537465374753748537495375053751537525375353754537555375653757537585375953760537615376253763537645376553766537675376853769537705377153772537735377453775537765377753778537795378053781537825378353784537855378653787537885378953790537915379253793537945379553796537975379853799538005380153802538035380453805538065380753808538095381053811538125381353814538155381653817538185381953820538215382253823538245382553826538275382853829538305383153832538335383453835538365383753838538395384053841538425384353844538455384653847538485384953850538515385253853538545385553856538575385853859538605386153862538635386453865538665386753868538695387053871538725387353874538755387653877538785387953880538815388253883538845388553886538875388853889538905389153892538935389453895538965389753898538995390053901539025390353904539055390653907539085390953910539115391253913539145391553916539175391853919539205392153922539235392453925539265392753928539295393053931539325393353934539355393653937539385393953940539415394253943539445394553946539475394853949539505395153952539535395453955539565395753958539595396053961539625396353964539655396653967539685396953970539715397253973539745397553976539775397853979539805398153982539835398453985539865398753988539895399053991539925399353994539955399653997539985399954000540015400254003540045400554006540075400854009540105401154012540135401454015540165401754018540195402054021540225402354024540255402654027540285402954030540315403254033540345403554036540375403854039540405404154042540435404454045540465404754048540495405054051540525405354054540555405654057540585405954060540615406254063540645406554066540675406854069540705407154072540735407454075540765407754078540795408054081540825408354084540855408654087540885408954090540915409254093540945409554096540975409854099541005410154102541035410454105541065410754108541095411054111541125411354114541155411654117541185411954120541215412254123541245412554126541275412854129541305413154132541335413454135541365413754138541395414054141541425414354144541455414654147541485414954150541515415254153541545415554156541575415854159541605416154162541635416454165541665416754168541695417054171541725417354174541755417654177541785417954180541815418254183541845418554186541875418854189541905419154192541935419454195541965419754198541995420054201542025420354204542055420654207542085420954210542115421254213542145421554216542175421854219542205422154222542235422454225542265422754228542295423054231542325423354234542355423654237542385423954240542415424254243542445424554246542475424854249542505425154252542535425454255542565425754258542595426054261542625426354264542655426654267542685426954270542715427254273542745427554276542775427854279542805428154282542835428454285542865428754288542895429054291542925429354294542955429654297542985429954300543015430254303543045430554306543075430854309543105431154312543135431454315543165431754318543195432054321543225432354324543255432654327543285432954330543315433254333543345433554336543375433854339543405434154342543435434454345543465434754348543495435054351543525435354354543555435654357543585435954360543615436254363543645436554366543675436854369543705437154372543735437454375543765437754378543795438054381543825438354384543855438654387543885438954390543915439254393543945439554396543975439854399544005440154402544035440454405544065440754408544095441054411544125441354414544155441654417544185441954420544215442254423544245442554426544275442854429544305443154432544335443454435544365443754438544395444054441544425444354444544455444654447544485444954450544515445254453544545445554456544575445854459544605446154462544635446454465544665446754468544695447054471544725447354474544755447654477544785447954480544815448254483544845448554486544875448854489544905449154492544935449454495544965449754498544995450054501545025450354504545055450654507545085450954510545115451254513545145451554516545175451854519545205452154522545235452454525545265452754528545295453054531545325453354534545355453654537545385453954540545415454254543545445454554546545475454854549545505455154552545535455454555545565455754558545595456054561545625456354564545655456654567545685456954570545715457254573545745457554576545775457854579545805458154582545835458454585545865458754588545895459054591545925459354594545955459654597545985459954600546015460254603546045460554606546075460854609546105461154612546135461454615546165461754618546195462054621546225462354624546255462654627546285462954630546315463254633546345463554636546375463854639546405464154642546435464454645546465464754648546495465054651546525465354654546555465654657546585465954660546615466254663546645466554666546675466854669546705467154672546735467454675546765467754678546795468054681546825468354684546855468654687546885468954690546915469254693546945469554696546975469854699547005470154702547035470454705547065470754708547095471054711547125471354714547155471654717547185471954720547215472254723547245472554726547275472854729547305473154732547335473454735547365473754738547395474054741547425474354744547455474654747547485474954750547515475254753547545475554756547575475854759547605476154762547635476454765547665476754768547695477054771547725477354774547755477654777547785477954780547815478254783547845478554786547875478854789547905479154792547935479454795547965479754798547995480054801548025480354804548055480654807548085480954810548115481254813548145481554816548175481854819548205482154822548235482454825548265482754828548295483054831548325483354834548355483654837548385483954840548415484254843548445484554846548475484854849548505485154852548535485454855548565485754858548595486054861548625486354864548655486654867548685486954870548715487254873548745487554876548775487854879548805488154882548835488454885548865488754888548895489054891548925489354894548955489654897548985489954900549015490254903549045490554906549075490854909549105491154912549135491454915549165491754918549195492054921549225492354924549255492654927549285492954930549315493254933549345493554936549375493854939549405494154942549435494454945549465494754948549495495054951549525495354954549555495654957549585495954960549615496254963549645496554966549675496854969549705497154972549735497454975549765497754978549795498054981549825498354984549855498654987549885498954990549915499254993549945499554996549975499854999550005500155002550035500455005550065500755008550095501055011550125501355014550155501655017550185501955020550215502255023550245502555026550275502855029550305503155032550335503455035550365503755038550395504055041550425504355044550455504655047550485504955050550515505255053550545505555056550575505855059550605506155062550635506455065550665506755068550695507055071550725507355074550755507655077550785507955080550815508255083550845508555086550875508855089550905509155092550935509455095550965509755098550995510055101551025510355104551055510655107551085510955110551115511255113551145511555116551175511855119551205512155122551235512455125551265512755128551295513055131551325513355134551355513655137551385513955140551415514255143551445514555146551475514855149551505515155152551535515455155551565515755158551595516055161551625516355164551655516655167551685516955170551715517255173551745517555176551775517855179551805518155182551835518455185551865518755188551895519055191551925519355194551955519655197551985519955200552015520255203552045520555206552075520855209552105521155212552135521455215552165521755218552195522055221552225522355224552255522655227552285522955230552315523255233552345523555236552375523855239552405524155242552435524455245552465524755248552495525055251552525525355254552555525655257552585525955260552615526255263552645526555266552675526855269552705527155272552735527455275552765527755278552795528055281552825528355284552855528655287552885528955290552915529255293552945529555296552975529855299553005530155302553035530455305553065530755308553095531055311553125531355314553155531655317553185531955320553215532255323553245532555326553275532855329553305533155332553335533455335553365533755338553395534055341553425534355344553455534655347553485534955350553515535255353553545535555356553575535855359553605536155362553635536455365553665536755368553695537055371553725537355374553755537655377553785537955380553815538255383553845538555386553875538855389553905539155392553935539455395553965539755398553995540055401554025540355404554055540655407554085540955410554115541255413554145541555416554175541855419554205542155422554235542455425554265542755428554295543055431554325543355434554355543655437554385543955440554415544255443554445544555446554475544855449554505545155452554535545455455554565545755458554595546055461554625546355464554655546655467554685546955470554715547255473554745547555476554775547855479554805548155482554835548455485554865548755488554895549055491554925549355494554955549655497554985549955500555015550255503555045550555506555075550855509555105551155512555135551455515555165551755518555195552055521555225552355524555255552655527555285552955530555315553255533555345553555536555375553855539555405554155542555435554455545555465554755548555495555055551555525555355554555555555655557555585555955560555615556255563555645556555566555675556855569555705557155572555735557455575555765557755578555795558055581555825558355584555855558655587555885558955590555915559255593555945559555596555975559855599556005560155602556035560455605556065560755608556095561055611556125561355614556155561655617556185561955620556215562255623556245562555626556275562855629556305563155632556335563455635556365563755638556395564055641556425564355644556455564655647556485564955650556515565255653556545565555656556575565855659556605566155662556635566455665556665566755668556695567055671556725567355674556755567655677556785567955680556815568255683556845568555686556875568855689556905569155692556935569455695556965569755698556995570055701557025570355704557055570655707557085570955710557115571255713557145571555716557175571855719557205572155722557235572455725557265572755728557295573055731557325573355734557355573655737557385573955740557415574255743557445574555746557475574855749557505575155752557535575455755557565575755758557595576055761557625576355764557655576655767557685576955770557715577255773557745577555776557775577855779557805578155782557835578455785557865578755788557895579055791557925579355794557955579655797557985579955800558015580255803558045580555806558075580855809558105581155812558135581455815558165581755818558195582055821558225582355824558255582655827558285582955830558315583255833558345583555836558375583855839558405584155842558435584455845558465584755848558495585055851558525585355854558555585655857558585585955860558615586255863558645586555866558675586855869558705587155872558735587455875558765587755878558795588055881558825588355884558855588655887558885588955890558915589255893558945589555896558975589855899559005590155902559035590455905559065590755908559095591055911559125591355914559155591655917559185591955920559215592255923559245592555926559275592855929559305593155932559335593455935559365593755938559395594055941559425594355944559455594655947559485594955950559515595255953559545595555956559575595855959559605596155962559635596455965559665596755968559695597055971559725597355974559755597655977559785597955980559815598255983559845598555986559875598855989559905599155992559935599455995559965599755998559995600056001560025600356004560055600656007560085600956010560115601256013560145601556016560175601856019560205602156022560235602456025560265602756028560295603056031560325603356034560355603656037560385603956040560415604256043560445604556046560475604856049560505605156052560535605456055560565605756058560595606056061560625606356064560655606656067560685606956070560715607256073560745607556076560775607856079560805608156082560835608456085560865608756088560895609056091560925609356094560955609656097560985609956100561015610256103561045610556106561075610856109561105611156112561135611456115561165611756118561195612056121561225612356124561255612656127561285612956130561315613256133561345613556136561375613856139561405614156142561435614456145561465614756148561495615056151561525615356154561555615656157561585615956160561615616256163561645616556166561675616856169561705617156172561735617456175561765617756178561795618056181561825618356184561855618656187561885618956190561915619256193561945619556196561975619856199562005620156202562035620456205562065620756208562095621056211562125621356214562155621656217562185621956220562215622256223562245622556226562275622856229562305623156232562335623456235562365623756238562395624056241562425624356244562455624656247562485624956250562515625256253562545625556256562575625856259562605626156262562635626456265562665626756268562695627056271562725627356274562755627656277562785627956280562815628256283562845628556286562875628856289562905629156292562935629456295562965629756298562995630056301563025630356304563055630656307563085630956310563115631256313563145631556316563175631856319563205632156322563235632456325563265632756328563295633056331563325633356334563355633656337563385633956340563415634256343563445634556346563475634856349563505635156352563535635456355563565635756358563595636056361563625636356364563655636656367563685636956370563715637256373563745637556376563775637856379563805638156382563835638456385563865638756388563895639056391563925639356394563955639656397563985639956400564015640256403564045640556406564075640856409564105641156412564135641456415564165641756418564195642056421564225642356424564255642656427564285642956430564315643256433564345643556436564375643856439564405644156442564435644456445564465644756448564495645056451564525645356454564555645656457564585645956460564615646256463564645646556466564675646856469564705647156472564735647456475564765647756478564795648056481564825648356484564855648656487564885648956490564915649256493564945649556496564975649856499565005650156502565035650456505565065650756508565095651056511565125651356514565155651656517565185651956520565215652256523565245652556526565275652856529565305653156532565335653456535565365653756538565395654056541565425654356544565455654656547565485654956550565515655256553565545655556556565575655856559565605656156562565635656456565565665656756568565695657056571565725657356574565755657656577565785657956580565815658256583565845658556586565875658856589565905659156592565935659456595565965659756598565995660056601566025660356604566055660656607566085660956610566115661256613566145661556616566175661856619566205662156622566235662456625566265662756628566295663056631566325663356634566355663656637566385663956640566415664256643566445664556646566475664856649566505665156652566535665456655566565665756658566595666056661566625666356664566655666656667566685666956670566715667256673566745667556676566775667856679566805668156682566835668456685566865668756688566895669056691566925669356694566955669656697566985669956700567015670256703567045670556706567075670856709567105671156712567135671456715567165671756718567195672056721567225672356724567255672656727567285672956730567315673256733567345673556736567375673856739567405674156742567435674456745567465674756748567495675056751567525675356754567555675656757567585675956760567615676256763567645676556766567675676856769567705677156772567735677456775567765677756778567795678056781567825678356784567855678656787567885678956790567915679256793567945679556796567975679856799568005680156802568035680456805568065680756808568095681056811568125681356814568155681656817568185681956820568215682256823568245682556826568275682856829568305683156832568335683456835568365683756838568395684056841568425684356844568455684656847568485684956850568515685256853568545685556856568575685856859568605686156862568635686456865568665686756868568695687056871568725687356874568755687656877568785687956880568815688256883568845688556886568875688856889568905689156892568935689456895568965689756898568995690056901569025690356904569055690656907569085690956910569115691256913569145691556916569175691856919569205692156922569235692456925569265692756928569295693056931569325693356934569355693656937569385693956940569415694256943569445694556946569475694856949569505695156952569535695456955569565695756958569595696056961569625696356964569655696656967569685696956970569715697256973569745697556976569775697856979569805698156982569835698456985569865698756988569895699056991569925699356994569955699656997569985699957000570015700257003570045700557006570075700857009570105701157012570135701457015570165701757018570195702057021570225702357024570255702657027570285702957030570315703257033570345703557036570375703857039570405704157042570435704457045570465704757048570495705057051570525705357054570555705657057570585705957060570615706257063570645706557066570675706857069570705707157072570735707457075570765707757078570795708057081570825708357084570855708657087570885708957090570915709257093570945709557096570975709857099571005710157102571035710457105571065710757108571095711057111571125711357114571155711657117571185711957120571215712257123571245712557126571275712857129571305713157132571335713457135571365713757138571395714057141571425714357144571455714657147571485714957150571515715257153571545715557156571575715857159571605716157162571635716457165571665716757168571695717057171571725717357174571755717657177571785717957180571815718257183571845718557186571875718857189571905719157192571935719457195571965719757198571995720057201572025720357204572055720657207572085720957210572115721257213572145721557216572175721857219572205722157222572235722457225572265722757228572295723057231572325723357234572355723657237572385723957240572415724257243572445724557246572475724857249572505725157252572535725457255572565725757258572595726057261572625726357264572655726657267572685726957270572715727257273572745727557276572775727857279572805728157282572835728457285572865728757288572895729057291572925729357294572955729657297572985729957300573015730257303573045730557306573075730857309573105731157312573135731457315573165731757318573195732057321573225732357324573255732657327573285732957330573315733257333573345733557336573375733857339573405734157342573435734457345573465734757348573495735057351573525735357354573555735657357573585735957360573615736257363573645736557366573675736857369573705737157372573735737457375573765737757378573795738057381573825738357384573855738657387573885738957390573915739257393573945739557396573975739857399574005740157402574035740457405574065740757408574095741057411574125741357414574155741657417574185741957420574215742257423574245742557426574275742857429574305743157432574335743457435574365743757438574395744057441574425744357444574455744657447574485744957450574515745257453574545745557456574575745857459574605746157462574635746457465574665746757468574695747057471574725747357474574755747657477574785747957480574815748257483574845748557486574875748857489574905749157492574935749457495574965749757498574995750057501575025750357504575055750657507575085750957510575115751257513575145751557516575175751857519575205752157522575235752457525575265752757528575295753057531575325753357534575355753657537575385753957540575415754257543575445754557546575475754857549575505755157552575535755457555575565755757558575595756057561575625756357564575655756657567575685756957570575715757257573575745757557576575775757857579575805758157582575835758457585575865758757588575895759057591575925759357594575955759657597575985759957600576015760257603576045760557606576075760857609576105761157612576135761457615576165761757618576195762057621576225762357624576255762657627576285762957630576315763257633576345763557636576375763857639576405764157642576435764457645576465764757648576495765057651576525765357654576555765657657576585765957660576615766257663576645766557666576675766857669576705767157672576735767457675576765767757678576795768057681576825768357684576855768657687576885768957690576915769257693576945769557696576975769857699577005770157702577035770457705577065770757708577095771057711577125771357714577155771657717577185771957720577215772257723577245772557726577275772857729577305773157732577335773457735577365773757738577395774057741577425774357744577455774657747577485774957750577515775257753577545775557756577575775857759577605776157762577635776457765577665776757768577695777057771577725777357774577755777657777577785777957780577815778257783577845778557786577875778857789577905779157792577935779457795577965779757798577995780057801578025780357804578055780657807578085780957810578115781257813578145781557816578175781857819578205782157822578235782457825578265782757828578295783057831578325783357834578355783657837578385783957840578415784257843578445784557846578475784857849578505785157852578535785457855578565785757858578595786057861578625786357864578655786657867578685786957870578715787257873578745787557876578775787857879578805788157882578835788457885578865788757888578895789057891578925789357894578955789657897578985789957900579015790257903579045790557906579075790857909579105791157912579135791457915579165791757918579195792057921579225792357924579255792657927579285792957930579315793257933579345793557936579375793857939579405794157942579435794457945579465794757948579495795057951579525795357954579555795657957579585795957960579615796257963579645796557966579675796857969579705797157972579735797457975579765797757978579795798057981579825798357984579855798657987579885798957990579915799257993579945799557996579975799857999580005800158002580035800458005580065800758008580095801058011580125801358014580155801658017580185801958020580215802258023580245802558026580275802858029580305803158032580335803458035580365803758038580395804058041580425804358044580455804658047580485804958050580515805258053580545805558056580575805858059580605806158062580635806458065580665806758068580695807058071580725807358074580755807658077580785807958080580815808258083580845808558086580875808858089580905809158092580935809458095580965809758098580995810058101581025810358104581055810658107581085810958110581115811258113581145811558116581175811858119581205812158122581235812458125581265812758128581295813058131581325813358134581355813658137581385813958140581415814258143581445814558146581475814858149581505815158152581535815458155581565815758158581595816058161581625816358164581655816658167581685816958170581715817258173581745817558176581775817858179581805818158182581835818458185581865818758188581895819058191581925819358194581955819658197581985819958200582015820258203582045820558206582075820858209582105821158212582135821458215582165821758218582195822058221582225822358224582255822658227582285822958230582315823258233582345823558236582375823858239582405824158242582435824458245582465824758248582495825058251582525825358254582555825658257582585825958260582615826258263582645826558266582675826858269582705827158272582735827458275582765827758278582795828058281582825828358284582855828658287582885828958290582915829258293582945829558296582975829858299583005830158302583035830458305583065830758308583095831058311583125831358314583155831658317583185831958320583215832258323583245832558326583275832858329583305833158332583335833458335583365833758338583395834058341583425834358344583455834658347583485834958350583515835258353583545835558356583575835858359583605836158362583635836458365583665836758368583695837058371583725837358374583755837658377583785837958380583815838258383583845838558386583875838858389583905839158392583935839458395583965839758398583995840058401584025840358404584055840658407584085840958410584115841258413584145841558416584175841858419584205842158422584235842458425584265842758428584295843058431584325843358434584355843658437584385843958440584415844258443584445844558446584475844858449584505845158452584535845458455584565845758458584595846058461584625846358464584655846658467584685846958470584715847258473584745847558476584775847858479584805848158482584835848458485584865848758488584895849058491584925849358494584955849658497584985849958500585015850258503585045850558506585075850858509585105851158512585135851458515585165851758518585195852058521585225852358524585255852658527585285852958530585315853258533585345853558536585375853858539585405854158542585435854458545585465854758548585495855058551585525855358554585555855658557585585855958560585615856258563585645856558566585675856858569585705857158572585735857458575585765857758578585795858058581585825858358584585855858658587585885858958590585915859258593585945859558596585975859858599586005860158602586035860458605586065860758608586095861058611586125861358614586155861658617586185861958620586215862258623586245862558626586275862858629586305863158632586335863458635586365863758638586395864058641586425864358644586455864658647586485864958650586515865258653586545865558656586575865858659586605866158662586635866458665586665866758668586695867058671586725867358674586755867658677586785867958680586815868258683586845868558686586875868858689586905869158692586935869458695586965869758698586995870058701587025870358704587055870658707587085870958710587115871258713587145871558716587175871858719587205872158722587235872458725587265872758728587295873058731587325873358734587355873658737587385873958740587415874258743587445874558746587475874858749587505875158752587535875458755587565875758758587595876058761587625876358764587655876658767587685876958770587715877258773587745877558776587775877858779587805878158782587835878458785587865878758788587895879058791587925879358794587955879658797587985879958800588015880258803588045880558806588075880858809588105881158812588135881458815588165881758818588195882058821588225882358824588255882658827588285882958830588315883258833588345883558836588375883858839588405884158842588435884458845588465884758848588495885058851588525885358854588555885658857588585885958860588615886258863588645886558866588675886858869588705887158872588735887458875588765887758878588795888058881588825888358884588855888658887588885888958890588915889258893588945889558896588975889858899589005890158902589035890458905589065890758908589095891058911589125891358914589155891658917589185891958920589215892258923589245892558926589275892858929589305893158932589335893458935589365893758938589395894058941589425894358944589455894658947589485894958950589515895258953589545895558956589575895858959589605896158962589635896458965589665896758968589695897058971589725897358974589755897658977589785897958980589815898258983589845898558986589875898858989589905899158992589935899458995589965899758998589995900059001590025900359004590055900659007590085900959010590115901259013590145901559016590175901859019590205902159022590235902459025590265902759028590295903059031590325903359034590355903659037590385903959040590415904259043590445904559046590475904859049590505905159052590535905459055590565905759058590595906059061590625906359064590655906659067590685906959070590715907259073590745907559076590775907859079590805908159082590835908459085590865908759088590895909059091590925909359094590955909659097590985909959100591015910259103591045910559106591075910859109591105911159112591135911459115591165911759118591195912059121591225912359124591255912659127591285912959130591315913259133591345913559136591375913859139591405914159142591435914459145591465914759148591495915059151591525915359154591555915659157591585915959160591615916259163591645916559166591675916859169591705917159172591735917459175591765917759178591795918059181591825918359184591855918659187591885918959190591915919259193591945919559196591975919859199592005920159202592035920459205592065920759208592095921059211592125921359214592155921659217592185921959220592215922259223592245922559226592275922859229592305923159232592335923459235592365923759238592395924059241592425924359244592455924659247592485924959250592515925259253592545925559256592575925859259592605926159262592635926459265592665926759268592695927059271592725927359274592755927659277592785927959280592815928259283592845928559286592875928859289592905929159292592935929459295592965929759298592995930059301593025930359304593055930659307593085930959310593115931259313593145931559316593175931859319593205932159322593235932459325593265932759328593295933059331593325933359334593355933659337593385933959340593415934259343593445934559346593475934859349593505935159352593535935459355593565935759358593595936059361593625936359364593655936659367593685936959370593715937259373593745937559376593775937859379593805938159382593835938459385593865938759388593895939059391593925939359394593955939659397593985939959400594015940259403594045940559406594075940859409594105941159412594135941459415594165941759418594195942059421594225942359424594255942659427594285942959430594315943259433594345943559436594375943859439594405944159442594435944459445594465944759448594495945059451594525945359454594555945659457594585945959460594615946259463594645946559466594675946859469594705947159472594735947459475594765947759478594795948059481594825948359484594855948659487594885948959490594915949259493594945949559496594975949859499595005950159502595035950459505595065950759508595095951059511595125951359514595155951659517595185951959520595215952259523595245952559526595275952859529595305953159532595335953459535595365953759538595395954059541595425954359544595455954659547595485954959550595515955259553595545955559556595575955859559595605956159562595635956459565595665956759568595695957059571595725957359574595755957659577595785957959580595815958259583595845958559586595875958859589595905959159592595935959459595595965959759598595995960059601596025960359604596055960659607596085960959610596115961259613596145961559616596175961859619596205962159622596235962459625596265962759628596295963059631596325963359634596355963659637596385963959640596415964259643596445964559646596475964859649596505965159652596535965459655596565965759658596595966059661596625966359664596655966659667596685966959670596715967259673596745967559676596775967859679596805968159682596835968459685596865968759688596895969059691596925969359694596955969659697596985969959700597015970259703597045970559706597075970859709597105971159712597135971459715597165971759718597195972059721597225972359724597255972659727597285972959730597315973259733597345973559736597375973859739597405974159742597435974459745597465974759748597495975059751597525975359754597555975659757597585975959760597615976259763597645976559766597675976859769597705977159772597735977459775597765977759778597795978059781597825978359784597855978659787597885978959790597915979259793597945979559796597975979859799598005980159802598035980459805598065980759808598095981059811598125981359814598155981659817598185981959820598215982259823598245982559826598275982859829598305983159832598335983459835598365983759838598395984059841598425984359844598455984659847598485984959850598515985259853598545985559856598575985859859598605986159862598635986459865598665986759868598695987059871598725987359874598755987659877598785987959880598815988259883598845988559886598875988859889598905989159892598935989459895598965989759898598995990059901599025990359904599055990659907599085990959910599115991259913599145991559916599175991859919599205992159922599235992459925599265992759928599295993059931599325993359934599355993659937599385993959940599415994259943599445994559946599475994859949599505995159952599535995459955599565995759958599595996059961599625996359964599655996659967599685996959970599715997259973599745997559976599775997859979599805998159982599835998459985599865998759988599895999059991599925999359994599955999659997599985999960000600016000260003600046000560006600076000860009600106001160012600136001460015600166001760018600196002060021600226002360024600256002660027600286002960030600316003260033600346003560036600376003860039600406004160042600436004460045600466004760048600496005060051600526005360054600556005660057600586005960060600616006260063600646006560066600676006860069600706007160072600736007460075600766007760078600796008060081600826008360084600856008660087600886008960090600916009260093600946009560096600976009860099601006010160102601036010460105601066010760108601096011060111601126011360114601156011660117601186011960120601216012260123601246012560126601276012860129601306013160132601336013460135601366013760138601396014060141601426014360144601456014660147601486014960150601516015260153601546015560156601576015860159601606016160162601636016460165601666016760168601696017060171601726017360174601756017660177601786017960180601816018260183601846018560186601876018860189601906019160192601936019460195601966019760198601996020060201602026020360204602056020660207602086020960210602116021260213602146021560216602176021860219602206022160222602236022460225602266022760228602296023060231602326023360234602356023660237602386023960240602416024260243602446024560246602476024860249602506025160252602536025460255602566025760258602596026060261602626026360264602656026660267602686026960270602716027260273602746027560276602776027860279602806028160282602836028460285602866028760288602896029060291602926029360294602956029660297602986029960300603016030260303603046030560306603076030860309603106031160312603136031460315603166031760318603196032060321603226032360324603256032660327603286032960330603316033260333603346033560336603376033860339603406034160342603436034460345603466034760348603496035060351603526035360354603556035660357603586035960360603616036260363603646036560366603676036860369603706037160372603736037460375603766037760378603796038060381603826038360384603856038660387603886038960390603916039260393603946039560396603976039860399604006040160402604036040460405604066040760408604096041060411604126041360414604156041660417604186041960420604216042260423604246042560426604276042860429604306043160432604336043460435604366043760438604396044060441604426044360444604456044660447604486044960450604516045260453604546045560456604576045860459604606046160462604636046460465604666046760468604696047060471604726047360474604756047660477604786047960480604816048260483604846048560486604876048860489604906049160492604936049460495604966049760498604996050060501605026050360504605056050660507605086050960510605116051260513605146051560516605176051860519605206052160522605236052460525605266052760528605296053060531605326053360534605356053660537605386053960540605416054260543605446054560546605476054860549605506055160552605536055460555605566055760558605596056060561605626056360564605656056660567605686056960570605716057260573605746057560576605776057860579605806058160582605836058460585605866058760588605896059060591605926059360594605956059660597605986059960600606016060260603606046060560606606076060860609606106061160612606136061460615606166061760618606196062060621606226062360624606256062660627606286062960630606316063260633606346063560636606376063860639606406064160642606436064460645606466064760648606496065060651606526065360654606556065660657606586065960660606616066260663606646066560666606676066860669606706067160672606736067460675606766067760678606796068060681606826068360684606856068660687606886068960690606916069260693606946069560696606976069860699607006070160702607036070460705607066070760708607096071060711607126071360714607156071660717607186071960720607216072260723607246072560726607276072860729607306073160732607336073460735607366073760738607396074060741607426074360744607456074660747607486074960750607516075260753607546075560756607576075860759607606076160762607636076460765607666076760768607696077060771607726077360774607756077660777607786077960780607816078260783607846078560786607876078860789607906079160792607936079460795607966079760798607996080060801608026080360804608056080660807608086080960810608116081260813608146081560816608176081860819608206082160822608236082460825608266082760828608296083060831608326083360834608356083660837608386083960840608416084260843608446084560846608476084860849608506085160852608536085460855608566085760858608596086060861608626086360864608656086660867608686086960870608716087260873608746087560876608776087860879608806088160882608836088460885608866088760888608896089060891608926089360894608956089660897608986089960900609016090260903609046090560906609076090860909609106091160912609136091460915609166091760918609196092060921609226092360924609256092660927609286092960930609316093260933609346093560936609376093860939609406094160942609436094460945609466094760948609496095060951609526095360954609556095660957609586095960960609616096260963609646096560966609676096860969609706097160972609736097460975609766097760978609796098060981609826098360984609856098660987609886098960990609916099260993609946099560996609976099860999610006100161002610036100461005610066100761008610096101061011610126101361014610156101661017610186101961020610216102261023610246102561026610276102861029610306103161032610336103461035610366103761038610396104061041610426104361044610456104661047610486104961050610516105261053610546105561056610576105861059610606106161062610636106461065610666106761068610696107061071610726107361074610756107661077610786107961080610816108261083610846108561086610876108861089610906109161092610936109461095610966109761098610996110061101611026110361104611056110661107611086110961110611116111261113611146111561116611176111861119611206112161122611236112461125611266112761128611296113061131611326113361134611356113661137611386113961140611416114261143611446114561146611476114861149611506115161152611536115461155611566115761158611596116061161611626116361164611656116661167611686116961170611716117261173611746117561176611776117861179611806118161182611836118461185611866118761188611896119061191611926119361194611956119661197611986119961200612016120261203612046120561206612076120861209612106121161212612136121461215612166121761218612196122061221612226122361224612256122661227612286122961230612316123261233612346123561236612376123861239612406124161242612436124461245612466124761248612496125061251612526125361254612556125661257612586125961260612616126261263612646126561266612676126861269612706127161272612736127461275612766127761278612796128061281612826128361284612856128661287612886128961290612916129261293612946129561296612976129861299613006130161302613036130461305613066130761308613096131061311613126131361314613156131661317613186131961320613216132261323613246132561326613276132861329613306133161332613336133461335613366133761338613396134061341613426134361344613456134661347613486134961350613516135261353613546135561356613576135861359613606136161362613636136461365613666136761368613696137061371613726137361374613756137661377613786137961380613816138261383613846138561386613876138861389613906139161392613936139461395613966139761398613996140061401614026140361404614056140661407614086140961410614116141261413614146141561416614176141861419614206142161422614236142461425614266142761428614296143061431614326143361434614356143661437614386143961440614416144261443614446144561446614476144861449614506145161452614536145461455614566145761458614596146061461614626146361464614656146661467614686146961470614716147261473614746147561476614776147861479614806148161482614836148461485614866148761488614896149061491614926149361494614956149661497614986149961500615016150261503615046150561506615076150861509615106151161512615136151461515615166151761518615196152061521615226152361524615256152661527615286152961530615316153261533615346153561536615376153861539615406154161542615436154461545615466154761548615496155061551615526155361554615556155661557615586155961560615616156261563615646156561566615676156861569615706157161572615736157461575615766157761578615796158061581615826158361584615856158661587615886158961590615916159261593615946159561596615976159861599616006160161602616036160461605616066160761608616096161061611616126161361614616156161661617616186161961620616216162261623616246162561626616276162861629616306163161632616336163461635616366163761638616396164061641616426164361644616456164661647616486164961650616516165261653616546165561656616576165861659616606166161662616636166461665616666166761668616696167061671616726167361674616756167661677616786167961680616816168261683616846168561686616876168861689616906169161692616936169461695616966169761698616996170061701617026170361704617056170661707617086170961710617116171261713617146171561716617176171861719617206172161722617236172461725617266172761728617296173061731617326173361734617356173661737617386173961740617416174261743617446174561746617476174861749617506175161752617536175461755617566175761758617596176061761617626176361764617656176661767617686176961770617716177261773617746177561776617776177861779617806178161782617836178461785617866178761788617896179061791617926179361794617956179661797617986179961800618016180261803618046180561806618076180861809618106181161812618136181461815618166181761818618196182061821618226182361824618256182661827618286182961830618316183261833618346183561836618376183861839618406184161842618436184461845618466184761848618496185061851618526185361854618556185661857618586185961860618616186261863618646186561866618676186861869618706187161872618736187461875618766187761878618796188061881618826188361884618856188661887618886188961890618916189261893618946189561896618976189861899619006190161902619036190461905619066190761908619096191061911619126191361914619156191661917619186191961920619216192261923619246192561926619276192861929619306193161932619336193461935619366193761938619396194061941619426194361944619456194661947619486194961950619516195261953619546195561956619576195861959619606196161962619636196461965619666196761968619696197061971619726197361974619756197661977619786197961980619816198261983619846198561986619876198861989619906199161992619936199461995619966199761998619996200062001620026200362004620056200662007620086200962010620116201262013620146201562016620176201862019620206202162022620236202462025620266202762028620296203062031620326203362034620356203662037620386203962040620416204262043620446204562046620476204862049620506205162052620536205462055620566205762058620596206062061620626206362064620656206662067620686206962070620716207262073620746207562076620776207862079620806208162082620836208462085620866208762088620896209062091620926209362094620956209662097620986209962100621016210262103621046210562106621076210862109621106211162112621136211462115621166211762118621196212062121621226212362124621256212662127621286212962130621316213262133621346213562136621376213862139621406214162142621436214462145621466214762148621496215062151621526215362154621556215662157621586215962160621616216262163621646216562166621676216862169621706217162172621736217462175621766217762178621796218062181621826218362184621856218662187621886218962190621916219262193621946219562196621976219862199622006220162202622036220462205622066220762208622096221062211622126221362214622156221662217622186221962220622216222262223622246222562226622276222862229622306223162232622336223462235622366223762238622396224062241622426224362244622456224662247622486224962250622516225262253622546225562256622576225862259622606226162262622636226462265622666226762268622696227062271622726227362274622756227662277622786227962280622816228262283622846228562286622876228862289622906229162292622936229462295622966229762298622996230062301623026230362304623056230662307623086230962310623116231262313623146231562316623176231862319623206232162322623236232462325623266232762328623296233062331623326233362334623356233662337623386233962340623416234262343623446234562346623476234862349623506235162352623536235462355623566235762358623596236062361623626236362364623656236662367623686236962370623716237262373623746237562376623776237862379623806238162382623836238462385623866238762388623896239062391623926239362394623956239662397623986239962400624016240262403624046240562406624076240862409624106241162412624136241462415624166241762418624196242062421624226242362424624256242662427624286242962430624316243262433624346243562436624376243862439624406244162442624436244462445624466244762448624496245062451624526245362454624556245662457624586245962460624616246262463624646246562466624676246862469624706247162472624736247462475624766247762478624796248062481624826248362484624856248662487624886248962490624916249262493624946249562496624976249862499625006250162502625036250462505625066250762508625096251062511625126251362514625156251662517625186251962520625216252262523625246252562526625276252862529625306253162532625336253462535625366253762538625396254062541625426254362544625456254662547625486254962550625516255262553625546255562556625576255862559625606256162562625636256462565625666256762568625696257062571625726257362574625756257662577625786257962580625816258262583625846258562586625876258862589625906259162592625936259462595625966259762598625996260062601626026260362604626056260662607626086260962610626116261262613626146261562616626176261862619626206262162622626236262462625626266262762628626296263062631626326263362634626356263662637626386263962640626416264262643626446264562646626476264862649626506265162652626536265462655626566265762658626596266062661626626266362664626656266662667626686266962670626716267262673626746267562676626776267862679626806268162682626836268462685626866268762688626896269062691626926269362694626956269662697626986269962700627016270262703627046270562706627076270862709627106271162712627136271462715627166271762718627196272062721627226272362724627256272662727627286272962730627316273262733627346273562736627376273862739627406274162742627436274462745627466274762748627496275062751627526275362754627556275662757627586275962760627616276262763627646276562766627676276862769627706277162772627736277462775627766277762778627796278062781627826278362784627856278662787627886278962790627916279262793627946279562796627976279862799628006280162802628036280462805628066280762808628096281062811628126281362814628156281662817628186281962820628216282262823628246282562826628276282862829628306283162832628336283462835628366283762838628396284062841628426284362844628456284662847628486284962850628516285262853628546285562856628576285862859628606286162862628636286462865628666286762868628696287062871628726287362874628756287662877628786287962880628816288262883628846288562886628876288862889628906289162892628936289462895628966289762898628996290062901629026290362904629056290662907629086290962910629116291262913629146291562916629176291862919629206292162922629236292462925629266292762928629296293062931629326293362934629356293662937629386293962940629416294262943629446294562946629476294862949629506295162952629536295462955629566295762958629596296062961629626296362964629656296662967629686296962970629716297262973629746297562976629776297862979629806298162982629836298462985629866298762988629896299062991629926299362994629956299662997629986299963000630016300263003630046300563006630076300863009630106301163012630136301463015630166301763018630196302063021630226302363024630256302663027630286302963030630316303263033630346303563036630376303863039630406304163042630436304463045630466304763048630496305063051630526305363054630556305663057630586305963060630616306263063630646306563066630676306863069630706307163072630736307463075630766307763078630796308063081630826308363084630856308663087630886308963090630916309263093630946309563096630976309863099631006310163102631036310463105631066310763108631096311063111631126311363114631156311663117631186311963120631216312263123631246312563126631276312863129631306313163132631336313463135631366313763138631396314063141631426314363144631456314663147631486314963150631516315263153631546315563156631576315863159631606316163162631636316463165631666316763168631696317063171631726317363174631756317663177631786317963180631816318263183631846318563186631876318863189631906319163192631936319463195631966319763198631996320063201632026320363204632056320663207632086320963210632116321263213632146321563216632176321863219632206322163222632236322463225632266322763228632296323063231632326323363234632356323663237632386323963240632416324263243632446324563246632476324863249632506325163252632536325463255632566325763258632596326063261632626326363264632656326663267632686326963270632716327263273632746327563276632776327863279632806328163282632836328463285632866328763288632896329063291632926329363294632956329663297632986329963300633016330263303633046330563306633076330863309633106331163312633136331463315633166331763318633196332063321633226332363324633256332663327633286332963330633316333263333633346333563336633376333863339633406334163342633436334463345633466334763348633496335063351633526335363354633556335663357633586335963360633616336263363633646336563366633676336863369633706337163372633736337463375633766337763378633796338063381633826338363384633856338663387633886338963390633916339263393633946339563396633976339863399634006340163402634036340463405634066340763408634096341063411634126341363414634156341663417634186341963420634216342263423634246342563426634276342863429634306343163432634336343463435634366343763438634396344063441634426344363444634456344663447634486344963450634516345263453634546345563456634576345863459634606346163462634636346463465634666346763468634696347063471634726347363474634756347663477634786347963480634816348263483634846348563486634876348863489634906349163492634936349463495634966349763498634996350063501635026350363504635056350663507635086350963510635116351263513635146351563516635176351863519635206352163522635236352463525635266352763528635296353063531635326353363534635356353663537635386353963540635416354263543635446354563546635476354863549635506355163552635536355463555635566355763558635596356063561635626356363564635656356663567635686356963570635716357263573635746357563576635776357863579635806358163582635836358463585635866358763588635896359063591635926359363594635956359663597635986359963600636016360263603636046360563606636076360863609636106361163612636136361463615636166361763618636196362063621636226362363624636256362663627636286362963630636316363263633636346363563636636376363863639636406364163642636436364463645636466364763648636496365063651636526365363654636556365663657636586365963660636616366263663636646366563666636676366863669636706367163672636736367463675636766367763678636796368063681636826368363684636856368663687636886368963690636916369263693636946369563696636976369863699637006370163702637036370463705637066370763708637096371063711637126371363714637156371663717637186371963720637216372263723637246372563726637276372863729637306373163732637336373463735637366373763738637396374063741637426374363744637456374663747637486374963750637516375263753637546375563756637576375863759637606376163762637636376463765637666376763768637696377063771637726377363774637756377663777637786377963780637816378263783637846378563786637876378863789637906379163792637936379463795637966379763798637996380063801638026380363804638056380663807638086380963810638116381263813638146381563816638176381863819638206382163822638236382463825638266382763828638296383063831638326383363834638356383663837638386383963840638416384263843638446384563846638476384863849638506385163852638536385463855638566385763858638596386063861638626386363864638656386663867638686386963870638716387263873638746387563876638776387863879638806388163882638836388463885638866388763888638896389063891638926389363894638956389663897638986389963900639016390263903639046390563906639076390863909639106391163912639136391463915639166391763918639196392063921639226392363924639256392663927639286392963930639316393263933639346393563936639376393863939639406394163942639436394463945639466394763948639496395063951639526395363954639556395663957639586395963960639616396263963639646396563966639676396863969639706397163972639736397463975639766397763978639796398063981639826398363984639856398663987639886398963990639916399263993639946399563996639976399863999640006400164002640036400464005640066400764008640096401064011640126401364014640156401664017640186401964020640216402264023640246402564026640276402864029640306403164032640336403464035640366403764038640396404064041640426404364044640456404664047640486404964050640516405264053640546405564056640576405864059640606406164062640636406464065640666406764068640696407064071640726407364074640756407664077640786407964080640816408264083640846408564086640876408864089640906409164092640936409464095640966409764098640996410064101641026410364104641056410664107641086410964110641116411264113641146411564116641176411864119641206412164122641236412464125641266412764128641296413064131641326413364134641356413664137641386413964140641416414264143641446414564146641476414864149641506415164152641536415464155641566415764158641596416064161641626416364164641656416664167641686416964170641716417264173641746417564176641776417864179641806418164182641836418464185641866418764188641896419064191641926419364194641956419664197641986419964200642016420264203642046420564206642076420864209642106421164212642136421464215642166421764218642196422064221642226422364224642256422664227642286422964230642316423264233642346423564236642376423864239642406424164242642436424464245642466424764248642496425064251642526425364254642556425664257642586425964260642616426264263642646426564266642676426864269642706427164272642736427464275642766427764278642796428064281642826428364284642856428664287642886428964290642916429264293642946429564296642976429864299643006430164302643036430464305643066430764308643096431064311643126431364314643156431664317643186431964320643216432264323643246432564326643276432864329643306433164332643336433464335643366433764338643396434064341643426434364344643456434664347643486434964350643516435264353643546435564356643576435864359643606436164362643636436464365643666436764368643696437064371643726437364374643756437664377643786437964380643816438264383643846438564386643876438864389643906439164392643936439464395643966439764398643996440064401644026440364404644056440664407644086440964410644116441264413644146441564416644176441864419644206442164422644236442464425644266442764428644296443064431644326443364434644356443664437644386443964440644416444264443644446444564446644476444864449644506445164452644536445464455644566445764458644596446064461644626446364464644656446664467644686446964470644716447264473644746447564476644776447864479644806448164482644836448464485644866448764488644896449064491644926449364494644956449664497644986449964500645016450264503645046450564506645076450864509645106451164512645136451464515645166451764518645196452064521645226452364524645256452664527645286452964530645316453264533645346453564536645376453864539645406454164542645436454464545645466454764548645496455064551645526455364554645556455664557645586455964560645616456264563645646456564566645676456864569645706457164572645736457464575645766457764578645796458064581645826458364584645856458664587645886458964590645916459264593645946459564596645976459864599646006460164602646036460464605646066460764608646096461064611646126461364614646156461664617646186461964620646216462264623646246462564626646276462864629646306463164632646336463464635646366463764638646396464064641646426464364644646456464664647646486464964650646516465264653646546465564656646576465864659646606466164662646636466464665646666466764668646696467064671646726467364674646756467664677646786467964680646816468264683646846468564686646876468864689646906469164692646936469464695646966469764698646996470064701647026470364704647056470664707647086470964710647116471264713647146471564716647176471864719647206472164722647236472464725647266472764728647296473064731647326473364734647356473664737647386473964740647416474264743647446474564746647476474864749647506475164752647536475464755647566475764758647596476064761647626476364764647656476664767647686476964770647716477264773647746477564776647776477864779647806478164782647836478464785647866478764788647896479064791647926479364794647956479664797647986479964800648016480264803648046480564806648076480864809648106481164812648136481464815648166481764818648196482064821648226482364824648256482664827648286482964830648316483264833648346483564836648376483864839648406484164842648436484464845648466484764848648496485064851648526485364854648556485664857648586485964860648616486264863648646486564866648676486864869648706487164872648736487464875648766487764878648796488064881648826488364884648856488664887648886488964890648916489264893648946489564896648976489864899649006490164902649036490464905649066490764908649096491064911649126491364914649156491664917649186491964920649216492264923649246492564926649276492864929649306493164932649336493464935649366493764938649396494064941649426494364944649456494664947649486494964950649516495264953649546495564956649576495864959649606496164962649636496464965649666496764968649696497064971649726497364974649756497664977649786497964980649816498264983649846498564986649876498864989649906499164992649936499464995649966499764998649996500065001650026500365004650056500665007650086500965010650116501265013650146501565016650176501865019650206502165022650236502465025650266502765028650296503065031650326503365034650356503665037650386503965040650416504265043650446504565046650476504865049650506505165052650536505465055650566505765058650596506065061650626506365064650656506665067650686506965070650716507265073650746507565076650776507865079650806508165082650836508465085650866508765088650896509065091650926509365094650956509665097650986509965100651016510265103651046510565106651076510865109651106511165112651136511465115651166511765118651196512065121651226512365124651256512665127651286512965130651316513265133651346513565136651376513865139651406514165142651436514465145651466514765148651496515065151651526515365154651556515665157651586515965160651616516265163651646516565166651676516865169651706517165172651736517465175651766517765178651796518065181651826518365184651856518665187651886518965190651916519265193651946519565196651976519865199652006520165202652036520465205652066520765208652096521065211652126521365214652156521665217652186521965220652216522265223652246522565226652276522865229652306523165232652336523465235652366523765238652396524065241652426524365244652456524665247652486524965250652516525265253652546525565256652576525865259652606526165262652636526465265652666526765268652696527065271652726527365274652756527665277652786527965280652816528265283652846528565286652876528865289652906529165292652936529465295652966529765298652996530065301653026530365304653056530665307653086530965310653116531265313653146531565316653176531865319653206532165322653236532465325653266532765328653296533065331653326533365334653356533665337653386533965340653416534265343653446534565346653476534865349653506535165352653536535465355653566535765358653596536065361653626536365364653656536665367653686536965370653716537265373653746537565376653776537865379653806538165382653836538465385653866538765388653896539065391653926539365394653956539665397653986539965400654016540265403654046540565406654076540865409654106541165412654136541465415654166541765418654196542065421654226542365424654256542665427654286542965430654316543265433654346543565436654376543865439654406544165442654436544465445654466544765448654496545065451654526545365454654556545665457654586545965460654616546265463654646546565466654676546865469654706547165472654736547465475654766547765478654796548065481654826548365484654856548665487654886548965490654916549265493654946549565496654976549865499655006550165502655036550465505655066550765508655096551065511655126551365514655156551665517655186551965520655216552265523655246552565526655276552865529655306553165532655336553465535655366553765538655396554065541655426554365544655456554665547655486554965550655516555265553655546555565556655576555865559655606556165562655636556465565655666556765568655696557065571655726557365574655756557665577655786557965580655816558265583655846558565586655876558865589655906559165592655936559465595655966559765598655996560065601656026560365604656056560665607656086560965610656116561265613656146561565616656176561865619656206562165622656236562465625656266562765628656296563065631656326563365634656356563665637656386563965640656416564265643656446564565646656476564865649656506565165652656536565465655656566565765658656596566065661656626566365664656656566665667656686566965670656716567265673656746567565676656776567865679656806568165682656836568465685656866568765688656896569065691656926569365694656956569665697656986569965700657016570265703657046570565706657076570865709657106571165712657136571465715657166571765718657196572065721657226572365724657256572665727657286572965730657316573265733657346573565736657376573865739657406574165742657436574465745657466574765748657496575065751657526575365754657556575665757657586575965760657616576265763657646576565766657676576865769657706577165772657736577465775657766577765778657796578065781657826578365784657856578665787657886578965790657916579265793657946579565796657976579865799658006580165802658036580465805658066580765808658096581065811658126581365814658156581665817658186581965820658216582265823658246582565826658276582865829658306583165832658336583465835658366583765838658396584065841658426584365844658456584665847658486584965850658516585265853658546585565856658576585865859658606586165862658636586465865658666586765868658696587065871658726587365874658756587665877658786587965880658816588265883658846588565886658876588865889658906589165892658936589465895658966589765898658996590065901659026590365904659056590665907659086590965910659116591265913659146591565916659176591865919659206592165922659236592465925659266592765928659296593065931659326593365934659356593665937659386593965940659416594265943659446594565946659476594865949659506595165952659536595465955659566595765958659596596065961659626596365964659656596665967659686596965970659716597265973659746597565976659776597865979659806598165982659836598465985659866598765988659896599065991659926599365994659956599665997659986599966000660016600266003660046600566006660076600866009660106601166012660136601466015660166601766018660196602066021660226602366024660256602666027660286602966030660316603266033660346603566036660376603866039660406604166042660436604466045660466604766048660496605066051660526605366054660556605666057660586605966060660616606266063660646606566066660676606866069660706607166072660736607466075660766607766078660796608066081660826608366084660856608666087660886608966090660916609266093660946609566096660976609866099661006610166102661036610466105661066610766108661096611066111661126611366114661156611666117661186611966120661216612266123661246612566126661276612866129661306613166132661336613466135661366613766138661396614066141661426614366144661456614666147661486614966150661516615266153661546615566156661576615866159661606616166162661636616466165661666616766168661696617066171661726617366174661756617666177661786617966180661816618266183661846618566186661876618866189661906619166192661936619466195661966619766198661996620066201662026620366204662056620666207662086620966210662116621266213662146621566216662176621866219662206622166222662236622466225662266622766228662296623066231662326623366234662356623666237662386623966240662416624266243662446624566246662476624866249662506625166252662536625466255662566625766258662596626066261662626626366264662656626666267662686626966270662716627266273662746627566276662776627866279662806628166282662836628466285662866628766288662896629066291662926629366294662956629666297662986629966300663016630266303663046630566306663076630866309663106631166312663136631466315663166631766318663196632066321663226632366324663256632666327663286632966330663316633266333663346633566336663376633866339663406634166342663436634466345663466634766348663496635066351663526635366354663556635666357663586635966360663616636266363663646636566366663676636866369663706637166372663736637466375663766637766378663796638066381663826638366384663856638666387663886638966390663916639266393663946639566396663976639866399664006640166402664036640466405664066640766408664096641066411664126641366414664156641666417664186641966420664216642266423664246642566426664276642866429664306643166432664336643466435664366643766438664396644066441664426644366444664456644666447664486644966450664516645266453664546645566456664576645866459664606646166462664636646466465664666646766468664696647066471664726647366474664756647666477664786647966480664816648266483664846648566486664876648866489664906649166492664936649466495664966649766498664996650066501665026650366504665056650666507665086650966510665116651266513665146651566516665176651866519665206652166522665236652466525665266652766528665296653066531665326653366534665356653666537665386653966540665416654266543665446654566546665476654866549665506655166552665536655466555665566655766558665596656066561665626656366564665656656666567665686656966570665716657266573665746657566576665776657866579665806658166582665836658466585665866658766588665896659066591665926659366594665956659666597665986659966600666016660266603666046660566606666076660866609666106661166612666136661466615666166661766618666196662066621666226662366624666256662666627666286662966630666316663266633666346663566636666376663866639666406664166642666436664466645666466664766648666496665066651666526665366654666556665666657666586665966660666616666266663666646666566666666676666866669666706667166672666736667466675666766667766678666796668066681666826668366684666856668666687666886668966690666916669266693666946669566696666976669866699667006670166702667036670466705667066670766708667096671066711667126671366714667156671666717667186671966720667216672266723667246672566726667276672866729667306673166732667336673466735667366673766738667396674066741667426674366744667456674666747667486674966750667516675266753667546675566756667576675866759667606676166762667636676466765667666676766768667696677066771667726677366774667756677666777667786677966780667816678266783667846678566786667876678866789667906679166792667936679466795667966679766798667996680066801668026680366804668056680666807668086680966810668116681266813668146681566816668176681866819668206682166822668236682466825668266682766828668296683066831668326683366834668356683666837668386683966840668416684266843668446684566846668476684866849668506685166852668536685466855668566685766858668596686066861668626686366864668656686666867668686686966870668716687266873668746687566876668776687866879668806688166882668836688466885668866688766888668896689066891668926689366894668956689666897668986689966900669016690266903669046690566906669076690866909669106691166912669136691466915669166691766918669196692066921669226692366924669256692666927669286692966930669316693266933669346693566936669376693866939669406694166942669436694466945669466694766948669496695066951669526695366954669556695666957669586695966960669616696266963669646696566966669676696866969669706697166972669736697466975669766697766978669796698066981669826698366984669856698666987669886698966990669916699266993669946699566996669976699866999670006700167002670036700467005670066700767008670096701067011670126701367014670156701667017670186701967020670216702267023670246702567026670276702867029670306703167032670336703467035670366703767038670396704067041670426704367044670456704667047670486704967050670516705267053670546705567056670576705867059670606706167062670636706467065670666706767068670696707067071670726707367074670756707667077670786707967080670816708267083670846708567086670876708867089670906709167092670936709467095670966709767098670996710067101671026710367104671056710667107671086710967110671116711267113671146711567116671176711867119671206712167122671236712467125671266712767128671296713067131671326713367134671356713667137671386713967140671416714267143671446714567146671476714867149671506715167152671536715467155671566715767158671596716067161671626716367164671656716667167671686716967170671716717267173671746717567176671776717867179671806718167182671836718467185671866718767188671896719067191671926719367194671956719667197671986719967200672016720267203672046720567206672076720867209672106721167212672136721467215672166721767218672196722067221672226722367224672256722667227672286722967230672316723267233672346723567236672376723867239672406724167242672436724467245672466724767248672496725067251672526725367254672556725667257672586725967260672616726267263672646726567266672676726867269672706727167272672736727467275672766727767278672796728067281672826728367284672856728667287672886728967290672916729267293672946729567296672976729867299673006730167302673036730467305673066730767308673096731067311673126731367314673156731667317673186731967320673216732267323673246732567326673276732867329673306733167332673336733467335673366733767338673396734067341673426734367344673456734667347673486734967350673516735267353673546735567356673576735867359673606736167362673636736467365673666736767368673696737067371673726737367374673756737667377673786737967380673816738267383673846738567386673876738867389673906739167392673936739467395673966739767398673996740067401674026740367404674056740667407674086740967410674116741267413674146741567416674176741867419674206742167422674236742467425674266742767428674296743067431674326743367434674356743667437674386743967440674416744267443674446744567446674476744867449674506745167452674536745467455674566745767458674596746067461674626746367464674656746667467674686746967470674716747267473674746747567476674776747867479674806748167482674836748467485674866748767488674896749067491674926749367494674956749667497674986749967500675016750267503675046750567506675076750867509675106751167512675136751467515675166751767518675196752067521675226752367524675256752667527675286752967530675316753267533675346753567536675376753867539675406754167542675436754467545675466754767548675496755067551675526755367554675556755667557675586755967560675616756267563675646756567566675676756867569675706757167572675736757467575675766757767578675796758067581675826758367584675856758667587675886758967590675916759267593675946759567596675976759867599676006760167602676036760467605676066760767608676096761067611676126761367614676156761667617676186761967620676216762267623676246762567626676276762867629676306763167632676336763467635676366763767638676396764067641676426764367644676456764667647676486764967650676516765267653676546765567656676576765867659676606766167662676636766467665676666766767668676696767067671676726767367674676756767667677676786767967680676816768267683676846768567686676876768867689676906769167692676936769467695676966769767698676996770067701677026770367704677056770667707677086770967710677116771267713677146771567716677176771867719677206772167722677236772467725677266772767728677296773067731677326773367734677356773667737677386773967740677416774267743677446774567746677476774867749677506775167752677536775467755677566775767758677596776067761677626776367764677656776667767677686776967770677716777267773677746777567776677776777867779677806778167782677836778467785677866778767788677896779067791677926779367794677956779667797677986779967800678016780267803678046780567806678076780867809678106781167812678136781467815678166781767818678196782067821678226782367824678256782667827678286782967830678316783267833678346783567836678376783867839678406784167842678436784467845678466784767848678496785067851678526785367854678556785667857678586785967860678616786267863678646786567866678676786867869678706787167872678736787467875678766787767878678796788067881678826788367884678856788667887678886788967890678916789267893678946789567896678976789867899679006790167902679036790467905679066790767908679096791067911679126791367914679156791667917679186791967920679216792267923679246792567926679276792867929679306793167932679336793467935679366793767938679396794067941679426794367944679456794667947679486794967950679516795267953679546795567956679576795867959679606796167962679636796467965679666796767968679696797067971679726797367974679756797667977679786797967980679816798267983679846798567986679876798867989679906799167992679936799467995679966799767998679996800068001680026800368004680056800668007680086800968010680116801268013680146801568016680176801868019680206802168022680236802468025680266802768028680296803068031680326803368034680356803668037680386803968040680416804268043680446804568046680476804868049680506805168052680536805468055680566805768058680596806068061680626806368064680656806668067680686806968070680716807268073680746807568076680776807868079680806808168082680836808468085680866808768088680896809068091680926809368094680956809668097680986809968100681016810268103681046810568106681076810868109681106811168112681136811468115681166811768118681196812068121681226812368124681256812668127681286812968130681316813268133681346813568136681376813868139681406814168142681436814468145681466814768148681496815068151681526815368154681556815668157681586815968160681616816268163681646816568166681676816868169681706817168172681736817468175681766817768178681796818068181681826818368184681856818668187681886818968190681916819268193681946819568196681976819868199682006820168202682036820468205682066820768208682096821068211682126821368214682156821668217682186821968220682216822268223682246822568226682276822868229682306823168232682336823468235682366823768238682396824068241682426824368244682456824668247682486824968250682516825268253682546825568256682576825868259682606826168262682636826468265682666826768268682696827068271682726827368274682756827668277682786827968280682816828268283682846828568286682876828868289682906829168292682936829468295682966829768298682996830068301683026830368304683056830668307683086830968310683116831268313683146831568316683176831868319683206832168322683236832468325683266832768328683296833068331683326833368334683356833668337683386833968340683416834268343683446834568346683476834868349683506835168352683536835468355683566835768358683596836068361683626836368364683656836668367683686836968370683716837268373683746837568376683776837868379683806838168382683836838468385683866838768388683896839068391683926839368394683956839668397683986839968400684016840268403684046840568406684076840868409684106841168412684136841468415684166841768418684196842068421684226842368424684256842668427684286842968430684316843268433684346843568436684376843868439684406844168442684436844468445684466844768448684496845068451684526845368454684556845668457684586845968460684616846268463684646846568466684676846868469684706847168472684736847468475684766847768478684796848068481684826848368484684856848668487684886848968490684916849268493684946849568496684976849868499685006850168502685036850468505685066850768508685096851068511685126851368514685156851668517685186851968520685216852268523685246852568526685276852868529685306853168532685336853468535685366853768538685396854068541685426854368544685456854668547685486854968550685516855268553685546855568556685576855868559685606856168562685636856468565685666856768568685696857068571685726857368574685756857668577685786857968580685816858268583685846858568586685876858868589685906859168592685936859468595685966859768598685996860068601686026860368604686056860668607686086860968610686116861268613686146861568616686176861868619686206862168622686236862468625686266862768628686296863068631686326863368634686356863668637686386863968640686416864268643686446864568646686476864868649686506865168652686536865468655686566865768658686596866068661686626866368664686656866668667686686866968670686716867268673686746867568676686776867868679686806868168682686836868468685686866868768688686896869068691686926869368694686956869668697686986869968700687016870268703687046870568706687076870868709687106871168712687136871468715687166871768718687196872068721687226872368724687256872668727687286872968730687316873268733687346873568736687376873868739687406874168742687436874468745687466874768748687496875068751687526875368754687556875668757687586875968760687616876268763687646876568766687676876868769687706877168772687736877468775687766877768778687796878068781687826878368784687856878668787687886878968790687916879268793687946879568796687976879868799688006880168802688036880468805688066880768808688096881068811688126881368814688156881668817688186881968820688216882268823688246882568826688276882868829688306883168832688336883468835688366883768838688396884068841688426884368844688456884668847688486884968850688516885268853688546885568856688576885868859688606886168862688636886468865688666886768868688696887068871688726887368874688756887668877688786887968880688816888268883688846888568886688876888868889688906889168892688936889468895688966889768898688996890068901689026890368904689056890668907689086890968910689116891268913689146891568916689176891868919689206892168922689236892468925689266892768928689296893068931689326893368934689356893668937689386893968940689416894268943689446894568946689476894868949689506895168952689536895468955689566895768958689596896068961689626896368964689656896668967689686896968970689716897268973689746897568976689776897868979689806898168982689836898468985689866898768988689896899068991689926899368994689956899668997689986899969000690016900269003690046900569006690076900869009690106901169012690136901469015690166901769018690196902069021690226902369024690256902669027690286902969030690316903269033690346903569036690376903869039690406904169042690436904469045690466904769048690496905069051690526905369054690556905669057690586905969060690616906269063690646906569066690676906869069690706907169072690736907469075690766907769078690796908069081690826908369084690856908669087690886908969090690916909269093690946909569096690976909869099691006910169102691036910469105691066910769108691096911069111691126911369114691156911669117691186911969120691216912269123691246912569126691276912869129691306913169132691336913469135691366913769138691396914069141691426914369144691456914669147691486914969150691516915269153691546915569156691576915869159691606916169162691636916469165691666916769168691696917069171691726917369174691756917669177691786917969180691816918269183691846918569186691876918869189691906919169192691936919469195691966919769198691996920069201692026920369204692056920669207692086920969210692116921269213692146921569216692176921869219692206922169222692236922469225692266922769228692296923069231692326923369234692356923669237692386923969240692416924269243692446924569246692476924869249692506925169252692536925469255692566925769258692596926069261692626926369264692656926669267692686926969270692716927269273692746927569276692776927869279692806928169282692836928469285692866928769288692896929069291692926929369294692956929669297692986929969300693016930269303693046930569306693076930869309693106931169312693136931469315693166931769318693196932069321693226932369324693256932669327693286932969330693316933269333693346933569336693376933869339693406934169342693436934469345693466934769348693496935069351693526935369354693556935669357693586935969360693616936269363693646936569366693676936869369693706937169372693736937469375693766937769378693796938069381693826938369384693856938669387693886938969390693916939269393693946939569396693976939869399694006940169402694036940469405694066940769408694096941069411694126941369414694156941669417694186941969420694216942269423694246942569426694276942869429694306943169432694336943469435694366943769438694396944069441694426944369444694456944669447694486944969450694516945269453694546945569456694576945869459694606946169462694636946469465694666946769468694696947069471694726947369474694756947669477694786947969480694816948269483694846948569486694876948869489694906949169492694936949469495694966949769498694996950069501695026950369504695056950669507695086950969510695116951269513695146951569516695176951869519695206952169522695236952469525695266952769528695296953069531695326953369534695356953669537695386953969540695416954269543695446954569546695476954869549695506955169552695536955469555695566955769558695596956069561695626956369564695656956669567695686956969570695716957269573695746957569576695776957869579695806958169582695836958469585695866958769588695896959069591695926959369594695956959669597695986959969600696016960269603696046960569606696076960869609696106961169612696136961469615696166961769618696196962069621696226962369624696256962669627696286962969630696316963269633696346963569636696376963869639696406964169642696436964469645696466964769648696496965069651696526965369654696556965669657696586965969660696616966269663696646966569666696676966869669696706967169672696736967469675696766967769678696796968069681696826968369684696856968669687696886968969690696916969269693696946969569696696976969869699697006970169702697036970469705697066970769708697096971069711697126971369714697156971669717697186971969720697216972269723697246972569726697276972869729697306973169732697336973469735697366973769738697396974069741697426974369744697456974669747697486974969750697516975269753697546975569756697576975869759697606976169762697636976469765697666976769768697696977069771697726977369774697756977669777697786977969780697816978269783697846978569786697876978869789697906979169792697936979469795697966979769798697996980069801698026980369804698056980669807698086980969810698116981269813698146981569816698176981869819698206982169822698236982469825698266982769828698296983069831698326983369834698356983669837698386983969840698416984269843698446984569846698476984869849698506985169852698536985469855698566985769858698596986069861698626986369864698656986669867698686986969870698716987269873698746987569876698776987869879698806988169882698836988469885698866988769888698896989069891698926989369894698956989669897698986989969900699016990269903699046990569906699076990869909699106991169912699136991469915699166991769918699196992069921699226992369924699256992669927699286992969930699316993269933699346993569936699376993869939699406994169942699436994469945699466994769948699496995069951699526995369954699556995669957699586995969960699616996269963699646996569966699676996869969699706997169972699736997469975699766997769978699796998069981699826998369984699856998669987699886998969990699916999269993699946999569996699976999869999700007000170002700037000470005700067000770008700097001070011700127001370014700157001670017700187001970020700217002270023700247002570026700277002870029700307003170032700337003470035700367003770038700397004070041700427004370044700457004670047700487004970050700517005270053700547005570056700577005870059700607006170062700637006470065700667006770068700697007070071700727007370074700757007670077700787007970080700817008270083700847008570086700877008870089700907009170092700937009470095700967009770098700997010070101701027010370104701057010670107701087010970110701117011270113701147011570116701177011870119701207012170122701237012470125701267012770128701297013070131701327013370134701357013670137701387013970140701417014270143701447014570146701477014870149701507015170152701537015470155701567015770158701597016070161701627016370164701657016670167701687016970170701717017270173701747017570176701777017870179701807018170182701837018470185701867018770188701897019070191701927019370194701957019670197701987019970200702017020270203702047020570206702077020870209702107021170212702137021470215702167021770218702197022070221702227022370224702257022670227702287022970230702317023270233702347023570236702377023870239702407024170242702437024470245702467024770248702497025070251702527025370254702557025670257702587025970260702617026270263702647026570266702677026870269702707027170272702737027470275702767027770278702797028070281702827028370284702857028670287702887028970290702917029270293702947029570296702977029870299703007030170302703037030470305703067030770308703097031070311703127031370314703157031670317703187031970320703217032270323703247032570326703277032870329703307033170332703337033470335703367033770338703397034070341703427034370344703457034670347703487034970350703517035270353703547035570356703577035870359703607036170362703637036470365703667036770368703697037070371703727037370374703757037670377703787037970380703817038270383703847038570386703877038870389703907039170392703937039470395703967039770398703997040070401704027040370404704057040670407704087040970410704117041270413704147041570416704177041870419704207042170422704237042470425704267042770428704297043070431704327043370434704357043670437704387043970440704417044270443704447044570446704477044870449704507045170452704537045470455704567045770458704597046070461704627046370464704657046670467704687046970470704717047270473704747047570476704777047870479704807048170482704837048470485704867048770488704897049070491704927049370494704957049670497704987049970500705017050270503705047050570506705077050870509705107051170512705137051470515705167051770518705197052070521705227052370524705257052670527705287052970530705317053270533705347053570536705377053870539705407054170542705437054470545705467054770548705497055070551705527055370554705557055670557705587055970560705617056270563705647056570566705677056870569705707057170572705737057470575705767057770578705797058070581705827058370584705857058670587705887058970590705917059270593705947059570596705977059870599706007060170602706037060470605706067060770608706097061070611706127061370614706157061670617706187061970620706217062270623706247062570626706277062870629706307063170632706337063470635706367063770638706397064070641706427064370644706457064670647706487064970650706517065270653706547065570656706577065870659706607066170662706637066470665706667066770668706697067070671706727067370674706757067670677706787067970680706817068270683706847068570686706877068870689706907069170692706937069470695706967069770698706997070070701707027070370704707057070670707707087070970710707117071270713707147071570716707177071870719707207072170722707237072470725707267072770728707297073070731707327073370734707357073670737707387073970740707417074270743707447074570746707477074870749707507075170752707537075470755707567075770758707597076070761707627076370764707657076670767707687076970770707717077270773707747077570776707777077870779707807078170782707837078470785707867078770788707897079070791707927079370794707957079670797707987079970800708017080270803708047080570806708077080870809708107081170812708137081470815708167081770818708197082070821708227082370824708257082670827708287082970830708317083270833708347083570836708377083870839708407084170842708437084470845708467084770848708497085070851708527085370854708557085670857708587085970860708617086270863708647086570866708677086870869708707087170872708737087470875708767087770878708797088070881708827088370884708857088670887708887088970890708917089270893708947089570896708977089870899709007090170902709037090470905709067090770908709097091070911709127091370914709157091670917709187091970920709217092270923709247092570926709277092870929709307093170932709337093470935709367093770938709397094070941709427094370944709457094670947709487094970950709517095270953709547095570956709577095870959709607096170962709637096470965709667096770968709697097070971709727097370974709757097670977709787097970980709817098270983709847098570986709877098870989709907099170992709937099470995709967099770998709997100071001710027100371004710057100671007710087100971010710117101271013710147101571016710177101871019710207102171022710237102471025710267102771028710297103071031710327103371034710357103671037710387103971040710417104271043710447104571046710477104871049710507105171052710537105471055710567105771058710597106071061710627106371064710657106671067710687106971070710717107271073710747107571076710777107871079710807108171082710837108471085710867108771088710897109071091710927109371094710957109671097710987109971100711017110271103711047110571106711077110871109711107111171112711137111471115711167111771118711197112071121711227112371124711257112671127711287112971130711317113271133711347113571136711377113871139711407114171142711437114471145711467114771148711497115071151711527115371154711557115671157711587115971160711617116271163711647116571166711677116871169711707117171172711737117471175711767117771178711797118071181711827118371184711857118671187711887118971190711917119271193711947119571196711977119871199712007120171202712037120471205712067120771208712097121071211712127121371214712157121671217712187121971220712217122271223712247122571226712277122871229712307123171232712337123471235712367123771238712397124071241712427124371244712457124671247712487124971250712517125271253712547125571256712577125871259712607126171262712637126471265712667126771268712697127071271712727127371274712757127671277712787127971280712817128271283712847128571286712877128871289712907129171292712937129471295712967129771298712997130071301713027130371304713057130671307713087130971310713117131271313713147131571316713177131871319713207132171322713237132471325713267132771328713297133071331713327133371334713357133671337713387133971340713417134271343713447134571346713477134871349713507135171352713537135471355713567135771358713597136071361713627136371364713657136671367713687136971370713717137271373713747137571376713777137871379713807138171382713837138471385713867138771388713897139071391713927139371394713957139671397713987139971400714017140271403714047140571406714077140871409714107141171412714137141471415714167141771418714197142071421714227142371424714257142671427714287142971430714317143271433714347143571436714377143871439714407144171442714437144471445714467144771448714497145071451714527145371454714557145671457714587145971460714617146271463714647146571466714677146871469714707147171472714737147471475714767147771478714797148071481714827148371484714857148671487714887148971490714917149271493714947149571496714977149871499715007150171502715037150471505715067150771508715097151071511715127151371514715157151671517715187151971520715217152271523715247152571526715277152871529715307153171532715337153471535715367153771538715397154071541715427154371544715457154671547715487154971550715517155271553715547155571556715577155871559715607156171562715637156471565715667156771568715697157071571715727157371574715757157671577715787157971580715817158271583715847158571586715877158871589715907159171592715937159471595715967159771598715997160071601716027160371604716057160671607716087160971610716117161271613716147161571616716177161871619716207162171622716237162471625716267162771628716297163071631716327163371634716357163671637716387163971640716417164271643716447164571646716477164871649716507165171652716537165471655716567165771658716597166071661716627166371664716657166671667716687166971670716717167271673716747167571676716777167871679716807168171682716837168471685716867168771688716897169071691716927169371694716957169671697716987169971700717017170271703717047170571706717077170871709717107171171712717137171471715717167171771718717197172071721717227172371724717257172671727717287172971730717317173271733717347173571736717377173871739717407174171742717437174471745717467174771748717497175071751717527175371754717557175671757717587175971760717617176271763717647176571766717677176871769717707177171772717737177471775717767177771778717797178071781717827178371784717857178671787717887178971790717917179271793717947179571796717977179871799718007180171802718037180471805718067180771808718097181071811718127181371814718157181671817718187181971820718217182271823718247182571826718277182871829718307183171832718337183471835718367183771838718397184071841718427184371844718457184671847718487184971850718517185271853718547185571856718577185871859718607186171862718637186471865718667186771868718697187071871718727187371874718757187671877718787187971880718817188271883718847188571886718877188871889718907189171892718937189471895718967189771898718997190071901719027190371904719057190671907719087190971910719117191271913719147191571916719177191871919719207192171922719237192471925719267192771928719297193071931719327193371934719357193671937719387193971940719417194271943719447194571946719477194871949719507195171952719537195471955719567195771958719597196071961719627196371964719657196671967719687196971970719717197271973719747197571976719777197871979719807198171982719837198471985719867198771988719897199071991719927199371994719957199671997719987199972000720017200272003720047200572006720077200872009720107201172012720137201472015720167201772018720197202072021720227202372024720257202672027720287202972030720317203272033720347203572036720377203872039720407204172042720437204472045720467204772048720497205072051720527205372054720557205672057720587205972060720617206272063720647206572066720677206872069720707207172072720737207472075720767207772078720797208072081720827208372084720857208672087720887208972090720917209272093720947209572096720977209872099721007210172102721037210472105721067210772108721097211072111721127211372114721157211672117721187211972120721217212272123721247212572126721277212872129721307213172132721337213472135721367213772138721397214072141721427214372144721457214672147721487214972150721517215272153721547215572156721577215872159721607216172162721637216472165721667216772168721697217072171721727217372174721757217672177721787217972180721817218272183721847218572186721877218872189721907219172192721937219472195721967219772198721997220072201722027220372204722057220672207722087220972210722117221272213722147221572216722177221872219722207222172222722237222472225722267222772228722297223072231722327223372234722357223672237722387223972240722417224272243722447224572246722477224872249722507225172252722537225472255722567225772258722597226072261722627226372264722657226672267722687226972270722717227272273722747227572276722777227872279722807228172282722837228472285722867228772288722897229072291722927229372294722957229672297722987229972300723017230272303723047230572306723077230872309723107231172312723137231472315723167231772318723197232072321723227232372324723257232672327723287232972330723317233272333723347233572336723377233872339723407234172342723437234472345723467234772348723497235072351723527235372354723557235672357723587235972360723617236272363723647236572366723677236872369723707237172372723737237472375723767237772378723797238072381723827238372384723857238672387723887238972390723917239272393723947239572396723977239872399724007240172402724037240472405724067240772408724097241072411724127241372414724157241672417724187241972420724217242272423724247242572426724277242872429724307243172432724337243472435724367243772438724397244072441724427244372444724457244672447724487244972450724517245272453724547245572456724577245872459724607246172462724637246472465724667246772468724697247072471724727247372474724757247672477724787247972480724817248272483724847248572486724877248872489724907249172492724937249472495724967249772498724997250072501725027250372504725057250672507725087250972510725117251272513725147251572516725177251872519725207252172522725237252472525725267252772528725297253072531725327253372534725357253672537725387253972540725417254272543725447254572546725477254872549725507255172552725537255472555725567255772558725597256072561725627256372564725657256672567725687256972570725717257272573725747257572576725777257872579725807258172582725837258472585725867258772588725897259072591725927259372594725957259672597725987259972600726017260272603726047260572606726077260872609726107261172612726137261472615726167261772618726197262072621726227262372624726257262672627726287262972630726317263272633726347263572636726377263872639726407264172642726437264472645726467264772648726497265072651726527265372654726557265672657726587265972660726617266272663726647266572666726677266872669726707267172672726737267472675726767267772678726797268072681726827268372684726857268672687726887268972690726917269272693726947269572696726977269872699727007270172702727037270472705727067270772708727097271072711727127271372714727157271672717727187271972720727217272272723727247272572726727277272872729727307273172732727337273472735727367273772738727397274072741727427274372744727457274672747727487274972750727517275272753727547275572756727577275872759727607276172762727637276472765727667276772768727697277072771727727277372774727757277672777727787277972780727817278272783727847278572786727877278872789727907279172792727937279472795727967279772798727997280072801728027280372804728057280672807728087280972810728117281272813728147281572816728177281872819728207282172822728237282472825728267282772828728297283072831728327283372834728357283672837728387283972840728417284272843728447284572846728477284872849728507285172852728537285472855728567285772858728597286072861728627286372864728657286672867728687286972870728717287272873728747287572876728777287872879728807288172882728837288472885728867288772888728897289072891728927289372894728957289672897728987289972900729017290272903729047290572906729077290872909729107291172912729137291472915729167291772918729197292072921729227292372924729257292672927729287292972930729317293272933729347293572936729377293872939729407294172942729437294472945729467294772948729497295072951729527295372954729557295672957729587295972960729617296272963729647296572966729677296872969729707297172972729737297472975729767297772978729797298072981729827298372984729857298672987729887298972990729917299272993729947299572996729977299872999730007300173002730037300473005730067300773008730097301073011730127301373014730157301673017730187301973020730217302273023730247302573026730277302873029730307303173032730337303473035730367303773038730397304073041730427304373044730457304673047730487304973050730517305273053730547305573056730577305873059730607306173062730637306473065730667306773068730697307073071730727307373074730757307673077730787307973080730817308273083730847308573086730877308873089730907309173092730937309473095730967309773098730997310073101731027310373104731057310673107731087310973110731117311273113731147311573116731177311873119731207312173122731237312473125731267312773128731297313073131731327313373134731357313673137731387313973140731417314273143731447314573146731477314873149731507315173152731537315473155731567315773158731597316073161731627316373164731657316673167731687316973170731717317273173731747317573176731777317873179731807318173182731837318473185731867318773188731897319073191731927319373194731957319673197731987319973200732017320273203732047320573206732077320873209732107321173212732137321473215732167321773218732197322073221732227322373224732257322673227732287322973230732317323273233732347323573236732377323873239732407324173242732437324473245732467324773248732497325073251732527325373254732557325673257732587325973260732617326273263732647326573266732677326873269732707327173272732737327473275732767327773278732797328073281732827328373284732857328673287732887328973290732917329273293732947329573296732977329873299733007330173302733037330473305733067330773308733097331073311733127331373314733157331673317733187331973320733217332273323733247332573326733277332873329733307333173332733337333473335733367333773338733397334073341733427334373344733457334673347733487334973350733517335273353733547335573356733577335873359733607336173362733637336473365733667336773368733697337073371733727337373374733757337673377733787337973380733817338273383733847338573386733877338873389733907339173392733937339473395733967339773398733997340073401734027340373404734057340673407734087340973410734117341273413734147341573416734177341873419734207342173422734237342473425734267342773428734297343073431734327343373434734357343673437734387343973440734417344273443734447344573446734477344873449734507345173452734537345473455734567345773458734597346073461734627346373464734657346673467734687346973470734717347273473734747347573476734777347873479734807348173482734837348473485734867348773488734897349073491734927349373494734957349673497734987349973500735017350273503735047350573506735077350873509735107351173512735137351473515735167351773518735197352073521735227352373524735257352673527735287352973530735317353273533735347353573536735377353873539735407354173542735437354473545735467354773548735497355073551735527355373554735557355673557735587355973560735617356273563735647356573566735677356873569735707357173572735737357473575735767357773578735797358073581735827358373584735857358673587735887358973590735917359273593735947359573596735977359873599736007360173602736037360473605736067360773608736097361073611736127361373614736157361673617736187361973620736217362273623736247362573626736277362873629736307363173632736337363473635736367363773638736397364073641736427364373644736457364673647736487364973650736517365273653736547365573656736577365873659736607366173662736637366473665736667366773668736697367073671736727367373674736757367673677736787367973680736817368273683736847368573686736877368873689736907369173692736937369473695736967369773698736997370073701737027370373704737057370673707737087370973710737117371273713737147371573716737177371873719737207372173722737237372473725737267372773728737297373073731737327373373734737357373673737737387373973740737417374273743737447374573746737477374873749737507375173752737537375473755737567375773758737597376073761737627376373764737657376673767737687376973770737717377273773737747377573776737777377873779737807378173782737837378473785737867378773788737897379073791737927379373794737957379673797737987379973800738017380273803738047380573806738077380873809738107381173812738137381473815738167381773818738197382073821738227382373824738257382673827738287382973830738317383273833738347383573836738377383873839738407384173842738437384473845738467384773848738497385073851738527385373854738557385673857738587385973860738617386273863738647386573866738677386873869738707387173872738737387473875738767387773878738797388073881738827388373884738857388673887738887388973890738917389273893738947389573896738977389873899739007390173902739037390473905739067390773908739097391073911739127391373914739157391673917739187391973920739217392273923739247392573926739277392873929739307393173932739337393473935739367393773938739397394073941739427394373944739457394673947739487394973950739517395273953739547395573956739577395873959739607396173962739637396473965739667396773968739697397073971739727397373974739757397673977739787397973980739817398273983739847398573986739877398873989739907399173992739937399473995739967399773998739997400074001740027400374004740057400674007740087400974010740117401274013740147401574016740177401874019740207402174022740237402474025740267402774028740297403074031740327403374034740357403674037740387403974040740417404274043740447404574046740477404874049740507405174052740537405474055740567405774058740597406074061740627406374064740657406674067740687406974070740717407274073740747407574076740777407874079740807408174082740837408474085740867408774088740897409074091740927409374094740957409674097740987409974100741017410274103741047410574106741077410874109741107411174112741137411474115741167411774118741197412074121741227412374124741257412674127741287412974130741317413274133741347413574136741377413874139741407414174142741437414474145741467414774148741497415074151741527415374154741557415674157741587415974160741617416274163741647416574166741677416874169741707417174172741737417474175741767417774178741797418074181741827418374184741857418674187741887418974190741917419274193741947419574196741977419874199742007420174202742037420474205742067420774208742097421074211742127421374214742157421674217742187421974220742217422274223742247422574226742277422874229742307423174232742337423474235742367423774238742397424074241742427424374244742457424674247742487424974250742517425274253742547425574256742577425874259742607426174262742637426474265742667426774268742697427074271742727427374274742757427674277742787427974280742817428274283742847428574286742877428874289742907429174292742937429474295742967429774298742997430074301743027430374304743057430674307743087430974310743117431274313743147431574316743177431874319743207432174322743237432474325743267432774328743297433074331743327433374334743357433674337743387433974340743417434274343743447434574346743477434874349743507435174352743537435474355743567435774358743597436074361743627436374364743657436674367743687436974370743717437274373743747437574376743777437874379743807438174382743837438474385743867438774388743897439074391743927439374394743957439674397743987439974400744017440274403744047440574406744077440874409744107441174412744137441474415744167441774418744197442074421744227442374424744257442674427744287442974430
  1. /**
  2. * @licstart The following is the entire license notice for the
  3. * JavaScript code in this page
  4. *
  5. * Copyright 2022 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. (function webpackUniversalModuleDefinition(root, factory) {
  23. if(typeof exports === 'object' && typeof module === 'object')
  24. module.exports = factory();
  25. else if(typeof define === 'function' && define.amd)
  26. define("pdfjs-dist/build/pdf.worker", [], factory);
  27. else if(typeof exports === 'object')
  28. exports["pdfjs-dist/build/pdf.worker"] = factory();
  29. else
  30. root["pdfjs-dist/build/pdf.worker"] = root.pdfjsWorker = factory();
  31. })(this, () => {
  32. return /******/ (() => { // webpackBootstrap
  33. /******/ "use strict";
  34. /******/ var __webpack_modules__ = ([
  35. /* 0 */,
  36. /* 1 */
  37. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38. Object.defineProperty(exports, "__esModule", ({
  39. value: true
  40. }));
  41. exports.WorkerTask = exports.WorkerMessageHandler = void 0;
  42. var _util = __w_pdfjs_require__(2);
  43. var _primitives = __w_pdfjs_require__(5);
  44. var _pdf_manager = __w_pdfjs_require__(6);
  45. var _cleanup_helper = __w_pdfjs_require__(67);
  46. var _writer = __w_pdfjs_require__(73);
  47. var _is_node = __w_pdfjs_require__(4);
  48. var _message_handler = __w_pdfjs_require__(102);
  49. var _worker_stream = __w_pdfjs_require__(103);
  50. var _core_utils = __w_pdfjs_require__(8);
  51. class WorkerTask {
  52. constructor(name) {
  53. this.name = name;
  54. this.terminated = false;
  55. this._capability = (0, _util.createPromiseCapability)();
  56. }
  57. get finished() {
  58. return this._capability.promise;
  59. }
  60. finish() {
  61. this._capability.resolve();
  62. }
  63. terminate() {
  64. this.terminated = true;
  65. }
  66. ensureNotTerminated() {
  67. if (this.terminated) {
  68. throw new Error("Worker task was terminated");
  69. }
  70. }
  71. }
  72. exports.WorkerTask = WorkerTask;
  73. class WorkerMessageHandler {
  74. static setup(handler, port) {
  75. let testMessageProcessed = false;
  76. handler.on("test", function wphSetupTest(data) {
  77. if (testMessageProcessed) {
  78. return;
  79. }
  80. testMessageProcessed = true;
  81. handler.send("test", data instanceof Uint8Array);
  82. });
  83. handler.on("configure", function wphConfigure(data) {
  84. (0, _util.setVerbosityLevel)(data.verbosity);
  85. });
  86. handler.on("GetDocRequest", function wphSetupDoc(data) {
  87. return WorkerMessageHandler.createDocumentHandler(data, port);
  88. });
  89. }
  90. static createDocumentHandler(docParams, port) {
  91. let pdfManager;
  92. let terminated = false;
  93. let cancelXHRs = null;
  94. const WorkerTasks = [];
  95. const verbosity = (0, _util.getVerbosityLevel)();
  96. const apiVersion = docParams.apiVersion;
  97. const workerVersion = '2.14.305';
  98. if (apiVersion !== workerVersion) {
  99. throw new Error(`The API version "${apiVersion}" does not match ` + `the Worker version "${workerVersion}".`);
  100. }
  101. const enumerableProperties = [];
  102. for (const property in []) {
  103. enumerableProperties.push(property);
  104. }
  105. if (enumerableProperties.length) {
  106. throw new Error("The `Array.prototype` contains unexpected enumerable properties: " + enumerableProperties.join(", ") + "; thus breaking e.g. `for...in` iteration of `Array`s.");
  107. }
  108. if (typeof ReadableStream === "undefined") {
  109. const partialMsg = "The browser/environment lacks native support for critical " + "functionality used by the PDF.js library (e.g. `ReadableStream`); ";
  110. if (_is_node.isNodeJS) {
  111. throw new Error(partialMsg + "please use a `legacy`-build instead.");
  112. }
  113. throw new Error(partialMsg + "please update to a supported browser.");
  114. }
  115. const docId = docParams.docId;
  116. const docBaseUrl = docParams.docBaseUrl;
  117. const workerHandlerName = docParams.docId + "_worker";
  118. let handler = new _message_handler.MessageHandler(workerHandlerName, docId, port);
  119. function ensureNotTerminated() {
  120. if (terminated) {
  121. throw new Error("Worker was terminated");
  122. }
  123. }
  124. function startWorkerTask(task) {
  125. WorkerTasks.push(task);
  126. }
  127. function finishWorkerTask(task) {
  128. task.finish();
  129. const i = WorkerTasks.indexOf(task);
  130. WorkerTasks.splice(i, 1);
  131. }
  132. async function loadDocument(recoveryMode) {
  133. await pdfManager.ensureDoc("checkHeader");
  134. await pdfManager.ensureDoc("parseStartXRef");
  135. await pdfManager.ensureDoc("parse", [recoveryMode]);
  136. await pdfManager.ensureDoc("checkFirstPage", [recoveryMode]);
  137. await pdfManager.ensureDoc("checkLastPage", [recoveryMode]);
  138. const isPureXfa = await pdfManager.ensureDoc("isPureXfa");
  139. if (isPureXfa) {
  140. const task = new WorkerTask("loadXfaFonts");
  141. startWorkerTask(task);
  142. await Promise.all([pdfManager.loadXfaFonts(handler, task).catch(reason => {}).then(() => finishWorkerTask(task)), pdfManager.loadXfaImages()]);
  143. }
  144. const [numPages, fingerprints] = await Promise.all([pdfManager.ensureDoc("numPages"), pdfManager.ensureDoc("fingerprints")]);
  145. const htmlForXfa = isPureXfa ? await pdfManager.ensureDoc("htmlForXfa") : null;
  146. return {
  147. numPages,
  148. fingerprints,
  149. htmlForXfa
  150. };
  151. }
  152. function getPdfManager(data, evaluatorOptions, enableXfa) {
  153. const pdfManagerCapability = (0, _util.createPromiseCapability)();
  154. let newPdfManager;
  155. const source = data.source;
  156. if (source.data) {
  157. try {
  158. newPdfManager = new _pdf_manager.LocalPdfManager(docId, source.data, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  159. pdfManagerCapability.resolve(newPdfManager);
  160. } catch (ex) {
  161. pdfManagerCapability.reject(ex);
  162. }
  163. return pdfManagerCapability.promise;
  164. }
  165. let pdfStream,
  166. cachedChunks = [];
  167. try {
  168. pdfStream = new _worker_stream.PDFWorkerStream(handler);
  169. } catch (ex) {
  170. pdfManagerCapability.reject(ex);
  171. return pdfManagerCapability.promise;
  172. }
  173. const fullRequest = pdfStream.getFullReader();
  174. fullRequest.headersReady.then(function () {
  175. if (!fullRequest.isRangeSupported) {
  176. return;
  177. }
  178. const disableAutoFetch = source.disableAutoFetch || fullRequest.isStreamingSupported;
  179. newPdfManager = new _pdf_manager.NetworkPdfManager(docId, pdfStream, {
  180. msgHandler: handler,
  181. password: source.password,
  182. length: fullRequest.contentLength,
  183. disableAutoFetch,
  184. rangeChunkSize: source.rangeChunkSize
  185. }, evaluatorOptions, enableXfa, docBaseUrl);
  186. for (let i = 0; i < cachedChunks.length; i++) {
  187. newPdfManager.sendProgressiveData(cachedChunks[i]);
  188. }
  189. cachedChunks = [];
  190. pdfManagerCapability.resolve(newPdfManager);
  191. cancelXHRs = null;
  192. }).catch(function (reason) {
  193. pdfManagerCapability.reject(reason);
  194. cancelXHRs = null;
  195. });
  196. let loaded = 0;
  197. const flushChunks = function () {
  198. const pdfFile = (0, _util.arraysToBytes)(cachedChunks);
  199. if (source.length && pdfFile.length !== source.length) {
  200. (0, _util.warn)("reported HTTP length is different from actual");
  201. }
  202. try {
  203. newPdfManager = new _pdf_manager.LocalPdfManager(docId, pdfFile, source.password, handler, evaluatorOptions, enableXfa, docBaseUrl);
  204. pdfManagerCapability.resolve(newPdfManager);
  205. } catch (ex) {
  206. pdfManagerCapability.reject(ex);
  207. }
  208. cachedChunks = [];
  209. };
  210. const readPromise = new Promise(function (resolve, reject) {
  211. const readChunk = function ({
  212. value,
  213. done
  214. }) {
  215. try {
  216. ensureNotTerminated();
  217. if (done) {
  218. if (!newPdfManager) {
  219. flushChunks();
  220. }
  221. cancelXHRs = null;
  222. return;
  223. }
  224. loaded += (0, _util.arrayByteLength)(value);
  225. if (!fullRequest.isStreamingSupported) {
  226. handler.send("DocProgress", {
  227. loaded,
  228. total: Math.max(loaded, fullRequest.contentLength || 0)
  229. });
  230. }
  231. if (newPdfManager) {
  232. newPdfManager.sendProgressiveData(value);
  233. } else {
  234. cachedChunks.push(value);
  235. }
  236. fullRequest.read().then(readChunk, reject);
  237. } catch (e) {
  238. reject(e);
  239. }
  240. };
  241. fullRequest.read().then(readChunk, reject);
  242. });
  243. readPromise.catch(function (e) {
  244. pdfManagerCapability.reject(e);
  245. cancelXHRs = null;
  246. });
  247. cancelXHRs = function (reason) {
  248. pdfStream.cancelAllRequests(reason);
  249. };
  250. return pdfManagerCapability.promise;
  251. }
  252. function setupDoc(data) {
  253. function onSuccess(doc) {
  254. ensureNotTerminated();
  255. handler.send("GetDoc", {
  256. pdfInfo: doc
  257. });
  258. }
  259. function onFailure(ex) {
  260. ensureNotTerminated();
  261. if (ex instanceof _util.PasswordException) {
  262. const task = new WorkerTask(`PasswordException: response ${ex.code}`);
  263. startWorkerTask(task);
  264. handler.sendWithPromise("PasswordRequest", ex).then(function ({
  265. password
  266. }) {
  267. finishWorkerTask(task);
  268. pdfManager.updatePassword(password);
  269. pdfManagerReady();
  270. }).catch(function () {
  271. finishWorkerTask(task);
  272. handler.send("DocException", ex);
  273. });
  274. } else if (ex instanceof _util.InvalidPDFException || ex instanceof _util.MissingPDFException || ex instanceof _util.UnexpectedResponseException || ex instanceof _util.UnknownErrorException) {
  275. handler.send("DocException", ex);
  276. } else {
  277. handler.send("DocException", new _util.UnknownErrorException(ex.message, ex.toString()));
  278. }
  279. }
  280. function pdfManagerReady() {
  281. ensureNotTerminated();
  282. loadDocument(false).then(onSuccess, function (reason) {
  283. ensureNotTerminated();
  284. if (!(reason instanceof _core_utils.XRefParseException)) {
  285. onFailure(reason);
  286. return;
  287. }
  288. pdfManager.requestLoadedStream();
  289. pdfManager.onLoadedStream().then(function () {
  290. ensureNotTerminated();
  291. loadDocument(true).then(onSuccess, onFailure);
  292. });
  293. });
  294. }
  295. ensureNotTerminated();
  296. const evaluatorOptions = {
  297. maxImageSize: data.maxImageSize,
  298. disableFontFace: data.disableFontFace,
  299. ignoreErrors: data.ignoreErrors,
  300. isEvalSupported: data.isEvalSupported,
  301. fontExtraProperties: data.fontExtraProperties,
  302. useSystemFonts: data.useSystemFonts,
  303. cMapUrl: data.cMapUrl,
  304. standardFontDataUrl: data.standardFontDataUrl
  305. };
  306. getPdfManager(data, evaluatorOptions, data.enableXfa).then(function (newPdfManager) {
  307. if (terminated) {
  308. newPdfManager.terminate(new _util.AbortException("Worker was terminated."));
  309. throw new Error("Worker was terminated");
  310. }
  311. pdfManager = newPdfManager;
  312. pdfManager.onLoadedStream().then(function (stream) {
  313. handler.send("DataLoaded", {
  314. length: stream.bytes.byteLength
  315. });
  316. });
  317. }).then(pdfManagerReady, onFailure);
  318. }
  319. handler.on("GetPage", function wphSetupGetPage(data) {
  320. return pdfManager.getPage(data.pageIndex).then(function (page) {
  321. 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]) {
  322. return {
  323. rotate,
  324. ref,
  325. userUnit,
  326. view
  327. };
  328. });
  329. });
  330. });
  331. handler.on("GetPageIndex", function wphSetupGetPageIndex(data) {
  332. const pageRef = _primitives.Ref.get(data.num, data.gen);
  333. return pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  334. });
  335. handler.on("GetDestinations", function wphSetupGetDestinations(data) {
  336. return pdfManager.ensureCatalog("destinations");
  337. });
  338. handler.on("GetDestination", function wphSetupGetDestination(data) {
  339. return pdfManager.ensureCatalog("getDestination", [data.id]);
  340. });
  341. handler.on("GetPageLabels", function wphSetupGetPageLabels(data) {
  342. return pdfManager.ensureCatalog("pageLabels");
  343. });
  344. handler.on("GetPageLayout", function wphSetupGetPageLayout(data) {
  345. return pdfManager.ensureCatalog("pageLayout");
  346. });
  347. handler.on("GetPageMode", function wphSetupGetPageMode(data) {
  348. return pdfManager.ensureCatalog("pageMode");
  349. });
  350. handler.on("GetViewerPreferences", function (data) {
  351. return pdfManager.ensureCatalog("viewerPreferences");
  352. });
  353. handler.on("GetOpenAction", function (data) {
  354. return pdfManager.ensureCatalog("openAction");
  355. });
  356. handler.on("GetAttachments", function wphSetupGetAttachments(data) {
  357. return pdfManager.ensureCatalog("attachments");
  358. });
  359. handler.on("GetJavaScript", function wphSetupGetJavaScript(data) {
  360. return pdfManager.ensureCatalog("javaScript");
  361. });
  362. handler.on("GetDocJSActions", function wphSetupGetDocJSActions(data) {
  363. return pdfManager.ensureCatalog("jsActions");
  364. });
  365. handler.on("GetPageJSActions", function ({
  366. pageIndex
  367. }) {
  368. return pdfManager.getPage(pageIndex).then(function (page) {
  369. return pdfManager.ensure(page, "jsActions");
  370. });
  371. });
  372. handler.on("GetOutline", function wphSetupGetOutline(data) {
  373. return pdfManager.ensureCatalog("documentOutline");
  374. });
  375. handler.on("GetOptionalContentConfig", function (data) {
  376. return pdfManager.ensureCatalog("optionalContentConfig");
  377. });
  378. handler.on("GetPermissions", function (data) {
  379. return pdfManager.ensureCatalog("permissions");
  380. });
  381. handler.on("GetMetadata", function wphSetupGetMetadata(data) {
  382. return Promise.all([pdfManager.ensureDoc("documentInfo"), pdfManager.ensureCatalog("metadata")]);
  383. });
  384. handler.on("GetMarkInfo", function wphSetupGetMarkInfo(data) {
  385. return pdfManager.ensureCatalog("markInfo");
  386. });
  387. handler.on("GetData", function wphSetupGetData(data) {
  388. pdfManager.requestLoadedStream();
  389. return pdfManager.onLoadedStream().then(function (stream) {
  390. return stream.bytes;
  391. });
  392. });
  393. handler.on("GetAnnotations", function ({
  394. pageIndex,
  395. intent
  396. }) {
  397. return pdfManager.getPage(pageIndex).then(function (page) {
  398. return page.getAnnotationsData(intent);
  399. });
  400. });
  401. handler.on("GetFieldObjects", function (data) {
  402. return pdfManager.ensureDoc("fieldObjects");
  403. });
  404. handler.on("HasJSActions", function (data) {
  405. return pdfManager.ensureDoc("hasJSActions");
  406. });
  407. handler.on("GetCalculationOrderIds", function (data) {
  408. return pdfManager.ensureDoc("calculationOrderIds");
  409. });
  410. handler.on("SaveDocument", function ({
  411. isPureXfa,
  412. numPages,
  413. annotationStorage,
  414. filename
  415. }) {
  416. pdfManager.requestLoadedStream();
  417. const promises = [pdfManager.onLoadedStream(), pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("acroFormRef"), pdfManager.ensureDoc("xref"), pdfManager.ensureDoc("startXRef")];
  418. if (isPureXfa) {
  419. promises.push(pdfManager.serializeXfaData(annotationStorage));
  420. } else {
  421. for (let pageIndex = 0; pageIndex < numPages; pageIndex++) {
  422. promises.push(pdfManager.getPage(pageIndex).then(function (page) {
  423. const task = new WorkerTask(`Save: page ${pageIndex}`);
  424. return page.save(handler, task, annotationStorage).finally(function () {
  425. finishWorkerTask(task);
  426. });
  427. }));
  428. }
  429. }
  430. return Promise.all(promises).then(function ([stream, acroForm, acroFormRef, xref, startXRef, ...refs]) {
  431. let newRefs = [];
  432. let xfaData = null;
  433. if (isPureXfa) {
  434. xfaData = refs[0];
  435. if (!xfaData) {
  436. return stream.bytes;
  437. }
  438. } else {
  439. for (const ref of refs) {
  440. newRefs = ref.filter(x => x !== null).reduce((a, b) => a.concat(b), newRefs);
  441. }
  442. if (newRefs.length === 0) {
  443. return stream.bytes;
  444. }
  445. }
  446. const xfa = acroForm instanceof _primitives.Dict && acroForm.get("XFA") || null;
  447. let xfaDatasetsRef = null;
  448. let hasXfaDatasetsEntry = false;
  449. if (Array.isArray(xfa)) {
  450. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  451. if (xfa[i] === "datasets") {
  452. xfaDatasetsRef = xfa[i + 1];
  453. acroFormRef = null;
  454. hasXfaDatasetsEntry = true;
  455. }
  456. }
  457. if (xfaDatasetsRef === null) {
  458. xfaDatasetsRef = xref.getNewRef();
  459. }
  460. } else if (xfa) {
  461. acroFormRef = null;
  462. (0, _util.warn)("Unsupported XFA type.");
  463. }
  464. let newXrefInfo = Object.create(null);
  465. if (xref.trailer) {
  466. const infoObj = Object.create(null);
  467. const xrefInfo = xref.trailer.get("Info") || null;
  468. if (xrefInfo instanceof _primitives.Dict) {
  469. xrefInfo.forEach((key, value) => {
  470. if (typeof value === "string") {
  471. infoObj[key] = (0, _util.stringToPDFString)(value);
  472. }
  473. });
  474. }
  475. newXrefInfo = {
  476. rootRef: xref.trailer.getRaw("Root") || null,
  477. encryptRef: xref.trailer.getRaw("Encrypt") || null,
  478. newRef: xref.getNewRef(),
  479. infoRef: xref.trailer.getRaw("Info") || null,
  480. info: infoObj,
  481. fileIds: xref.trailer.get("ID") || null,
  482. startXRef,
  483. filename
  484. };
  485. }
  486. xref.resetNewRef();
  487. return (0, _writer.incrementalUpdate)({
  488. originalData: stream.bytes,
  489. xrefInfo: newXrefInfo,
  490. newRefs,
  491. xref,
  492. hasXfa: !!xfa,
  493. xfaDatasetsRef,
  494. hasXfaDatasetsEntry,
  495. acroFormRef,
  496. acroForm,
  497. xfaData
  498. });
  499. });
  500. });
  501. handler.on("GetOperatorList", function wphSetupRenderPage(data, sink) {
  502. const pageIndex = data.pageIndex;
  503. pdfManager.getPage(pageIndex).then(function (page) {
  504. const task = new WorkerTask(`GetOperatorList: page ${pageIndex}`);
  505. startWorkerTask(task);
  506. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  507. page.getOperatorList({
  508. handler,
  509. sink,
  510. task,
  511. intent: data.intent,
  512. cacheKey: data.cacheKey,
  513. annotationStorage: data.annotationStorage
  514. }).then(function (operatorListInfo) {
  515. finishWorkerTask(task);
  516. if (start) {
  517. (0, _util.info)(`page=${pageIndex + 1} - getOperatorList: time=` + `${Date.now() - start}ms, len=${operatorListInfo.length}`);
  518. }
  519. sink.close();
  520. }, function (reason) {
  521. finishWorkerTask(task);
  522. if (task.terminated) {
  523. return;
  524. }
  525. handler.send("UnsupportedFeature", {
  526. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  527. });
  528. sink.error(reason);
  529. });
  530. });
  531. });
  532. handler.on("GetTextContent", function wphExtractText(data, sink) {
  533. const pageIndex = data.pageIndex;
  534. pdfManager.getPage(pageIndex).then(function (page) {
  535. const task = new WorkerTask("GetTextContent: page " + pageIndex);
  536. startWorkerTask(task);
  537. const start = verbosity >= _util.VerbosityLevel.INFOS ? Date.now() : 0;
  538. page.extractTextContent({
  539. handler,
  540. task,
  541. sink,
  542. includeMarkedContent: data.includeMarkedContent,
  543. combineTextItems: data.combineTextItems
  544. }).then(function () {
  545. finishWorkerTask(task);
  546. if (start) {
  547. (0, _util.info)(`page=${pageIndex + 1} - getTextContent: time=` + `${Date.now() - start}ms`);
  548. }
  549. sink.close();
  550. }, function (reason) {
  551. finishWorkerTask(task);
  552. if (task.terminated) {
  553. return;
  554. }
  555. sink.error(reason);
  556. });
  557. });
  558. });
  559. handler.on("GetStructTree", function wphGetStructTree(data) {
  560. return pdfManager.getPage(data.pageIndex).then(function (page) {
  561. return pdfManager.ensure(page, "getStructTree");
  562. });
  563. });
  564. handler.on("FontFallback", function (data) {
  565. return pdfManager.fontFallback(data.id, handler);
  566. });
  567. handler.on("Cleanup", function wphCleanup(data) {
  568. return pdfManager.cleanup(true);
  569. });
  570. handler.on("Terminate", function wphTerminate(data) {
  571. terminated = true;
  572. const waitOn = [];
  573. if (pdfManager) {
  574. pdfManager.terminate(new _util.AbortException("Worker was terminated."));
  575. const cleanupPromise = pdfManager.cleanup();
  576. waitOn.push(cleanupPromise);
  577. pdfManager = null;
  578. } else {
  579. (0, _cleanup_helper.clearGlobalCaches)();
  580. }
  581. if (cancelXHRs) {
  582. cancelXHRs(new _util.AbortException("Worker was terminated."));
  583. }
  584. for (const task of WorkerTasks) {
  585. waitOn.push(task.finished);
  586. task.terminate();
  587. }
  588. return Promise.all(waitOn).then(function () {
  589. handler.destroy();
  590. handler = null;
  591. });
  592. });
  593. handler.on("Ready", function wphReady(data) {
  594. setupDoc(docParams);
  595. docParams = null;
  596. });
  597. return workerHandlerName;
  598. }
  599. static initializeFromPort(port) {
  600. const handler = new _message_handler.MessageHandler("worker", "main", port);
  601. WorkerMessageHandler.setup(handler, port);
  602. handler.send("ready", null);
  603. }
  604. }
  605. exports.WorkerMessageHandler = WorkerMessageHandler;
  606. function isMessagePort(maybePort) {
  607. return typeof maybePort.postMessage === "function" && "onmessage" in maybePort;
  608. }
  609. if (typeof window === "undefined" && !_is_node.isNodeJS && typeof self !== "undefined" && isMessagePort(self)) {
  610. WorkerMessageHandler.initializeFromPort(self);
  611. }
  612. /***/ }),
  613. /* 2 */
  614. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  615. Object.defineProperty(exports, "__esModule", ({
  616. value: true
  617. }));
  618. exports.VerbosityLevel = exports.Util = exports.UnknownErrorException = exports.UnexpectedResponseException = exports.UNSUPPORTED_FEATURES = exports.TextRenderingMode = exports.StreamType = exports.RenderingIntentFlag = exports.PermissionFlag = exports.PasswordResponses = exports.PasswordException = exports.PageActionEventType = exports.OPS = exports.MissingPDFException = exports.InvalidPDFException = exports.ImageKind = exports.IDENTITY_MATRIX = exports.FormatError = exports.FontType = exports.FeatureTest = exports.FONT_IDENTITY_MATRIX = exports.DocumentActionEventType = exports.CMapCompressionType = exports.BaseException = exports.AnnotationType = exports.AnnotationStateModelType = exports.AnnotationReviewState = exports.AnnotationReplyType = exports.AnnotationMode = exports.AnnotationMarkedState = exports.AnnotationFlag = exports.AnnotationFieldFlag = exports.AnnotationBorderStyleType = exports.AnnotationActionEventType = exports.AbortException = void 0;
  619. exports.arrayByteLength = arrayByteLength;
  620. exports.arraysToBytes = arraysToBytes;
  621. exports.assert = assert;
  622. exports.bytesToString = bytesToString;
  623. exports.createPromiseCapability = createPromiseCapability;
  624. exports.createValidAbsoluteUrl = createValidAbsoluteUrl;
  625. exports.escapeString = escapeString;
  626. exports.getModificationDate = getModificationDate;
  627. exports.getVerbosityLevel = getVerbosityLevel;
  628. exports.info = info;
  629. exports.isArrayBuffer = isArrayBuffer;
  630. exports.isArrayEqual = isArrayEqual;
  631. exports.isAscii = isAscii;
  632. exports.objectFromMap = objectFromMap;
  633. exports.objectSize = objectSize;
  634. exports.setVerbosityLevel = setVerbosityLevel;
  635. exports.shadow = shadow;
  636. exports.string32 = string32;
  637. exports.stringToBytes = stringToBytes;
  638. exports.stringToPDFString = stringToPDFString;
  639. exports.stringToUTF16BEString = stringToUTF16BEString;
  640. exports.stringToUTF8String = stringToUTF8String;
  641. exports.unreachable = unreachable;
  642. exports.utf8StringToString = utf8StringToString;
  643. exports.warn = warn;
  644. __w_pdfjs_require__(3);
  645. const IDENTITY_MATRIX = [1, 0, 0, 1, 0, 0];
  646. exports.IDENTITY_MATRIX = IDENTITY_MATRIX;
  647. const FONT_IDENTITY_MATRIX = [0.001, 0, 0, 0.001, 0, 0];
  648. exports.FONT_IDENTITY_MATRIX = FONT_IDENTITY_MATRIX;
  649. const RenderingIntentFlag = {
  650. ANY: 0x01,
  651. DISPLAY: 0x02,
  652. PRINT: 0x04,
  653. ANNOTATIONS_FORMS: 0x10,
  654. ANNOTATIONS_STORAGE: 0x20,
  655. ANNOTATIONS_DISABLE: 0x40,
  656. OPLIST: 0x100
  657. };
  658. exports.RenderingIntentFlag = RenderingIntentFlag;
  659. const AnnotationMode = {
  660. DISABLE: 0,
  661. ENABLE: 1,
  662. ENABLE_FORMS: 2,
  663. ENABLE_STORAGE: 3
  664. };
  665. exports.AnnotationMode = AnnotationMode;
  666. const PermissionFlag = {
  667. PRINT: 0x04,
  668. MODIFY_CONTENTS: 0x08,
  669. COPY: 0x10,
  670. MODIFY_ANNOTATIONS: 0x20,
  671. FILL_INTERACTIVE_FORMS: 0x100,
  672. COPY_FOR_ACCESSIBILITY: 0x200,
  673. ASSEMBLE: 0x400,
  674. PRINT_HIGH_QUALITY: 0x800
  675. };
  676. exports.PermissionFlag = PermissionFlag;
  677. const TextRenderingMode = {
  678. FILL: 0,
  679. STROKE: 1,
  680. FILL_STROKE: 2,
  681. INVISIBLE: 3,
  682. FILL_ADD_TO_PATH: 4,
  683. STROKE_ADD_TO_PATH: 5,
  684. FILL_STROKE_ADD_TO_PATH: 6,
  685. ADD_TO_PATH: 7,
  686. FILL_STROKE_MASK: 3,
  687. ADD_TO_PATH_FLAG: 4
  688. };
  689. exports.TextRenderingMode = TextRenderingMode;
  690. const ImageKind = {
  691. GRAYSCALE_1BPP: 1,
  692. RGB_24BPP: 2,
  693. RGBA_32BPP: 3
  694. };
  695. exports.ImageKind = ImageKind;
  696. const AnnotationType = {
  697. TEXT: 1,
  698. LINK: 2,
  699. FREETEXT: 3,
  700. LINE: 4,
  701. SQUARE: 5,
  702. CIRCLE: 6,
  703. POLYGON: 7,
  704. POLYLINE: 8,
  705. HIGHLIGHT: 9,
  706. UNDERLINE: 10,
  707. SQUIGGLY: 11,
  708. STRIKEOUT: 12,
  709. STAMP: 13,
  710. CARET: 14,
  711. INK: 15,
  712. POPUP: 16,
  713. FILEATTACHMENT: 17,
  714. SOUND: 18,
  715. MOVIE: 19,
  716. WIDGET: 20,
  717. SCREEN: 21,
  718. PRINTERMARK: 22,
  719. TRAPNET: 23,
  720. WATERMARK: 24,
  721. THREED: 25,
  722. REDACT: 26
  723. };
  724. exports.AnnotationType = AnnotationType;
  725. const AnnotationStateModelType = {
  726. MARKED: "Marked",
  727. REVIEW: "Review"
  728. };
  729. exports.AnnotationStateModelType = AnnotationStateModelType;
  730. const AnnotationMarkedState = {
  731. MARKED: "Marked",
  732. UNMARKED: "Unmarked"
  733. };
  734. exports.AnnotationMarkedState = AnnotationMarkedState;
  735. const AnnotationReviewState = {
  736. ACCEPTED: "Accepted",
  737. REJECTED: "Rejected",
  738. CANCELLED: "Cancelled",
  739. COMPLETED: "Completed",
  740. NONE: "None"
  741. };
  742. exports.AnnotationReviewState = AnnotationReviewState;
  743. const AnnotationReplyType = {
  744. GROUP: "Group",
  745. REPLY: "R"
  746. };
  747. exports.AnnotationReplyType = AnnotationReplyType;
  748. const AnnotationFlag = {
  749. INVISIBLE: 0x01,
  750. HIDDEN: 0x02,
  751. PRINT: 0x04,
  752. NOZOOM: 0x08,
  753. NOROTATE: 0x10,
  754. NOVIEW: 0x20,
  755. READONLY: 0x40,
  756. LOCKED: 0x80,
  757. TOGGLENOVIEW: 0x100,
  758. LOCKEDCONTENTS: 0x200
  759. };
  760. exports.AnnotationFlag = AnnotationFlag;
  761. const AnnotationFieldFlag = {
  762. READONLY: 0x0000001,
  763. REQUIRED: 0x0000002,
  764. NOEXPORT: 0x0000004,
  765. MULTILINE: 0x0001000,
  766. PASSWORD: 0x0002000,
  767. NOTOGGLETOOFF: 0x0004000,
  768. RADIO: 0x0008000,
  769. PUSHBUTTON: 0x0010000,
  770. COMBO: 0x0020000,
  771. EDIT: 0x0040000,
  772. SORT: 0x0080000,
  773. FILESELECT: 0x0100000,
  774. MULTISELECT: 0x0200000,
  775. DONOTSPELLCHECK: 0x0400000,
  776. DONOTSCROLL: 0x0800000,
  777. COMB: 0x1000000,
  778. RICHTEXT: 0x2000000,
  779. RADIOSINUNISON: 0x2000000,
  780. COMMITONSELCHANGE: 0x4000000
  781. };
  782. exports.AnnotationFieldFlag = AnnotationFieldFlag;
  783. const AnnotationBorderStyleType = {
  784. SOLID: 1,
  785. DASHED: 2,
  786. BEVELED: 3,
  787. INSET: 4,
  788. UNDERLINE: 5
  789. };
  790. exports.AnnotationBorderStyleType = AnnotationBorderStyleType;
  791. const AnnotationActionEventType = {
  792. E: "Mouse Enter",
  793. X: "Mouse Exit",
  794. D: "Mouse Down",
  795. U: "Mouse Up",
  796. Fo: "Focus",
  797. Bl: "Blur",
  798. PO: "PageOpen",
  799. PC: "PageClose",
  800. PV: "PageVisible",
  801. PI: "PageInvisible",
  802. K: "Keystroke",
  803. F: "Format",
  804. V: "Validate",
  805. C: "Calculate"
  806. };
  807. exports.AnnotationActionEventType = AnnotationActionEventType;
  808. const DocumentActionEventType = {
  809. WC: "WillClose",
  810. WS: "WillSave",
  811. DS: "DidSave",
  812. WP: "WillPrint",
  813. DP: "DidPrint"
  814. };
  815. exports.DocumentActionEventType = DocumentActionEventType;
  816. const PageActionEventType = {
  817. O: "PageOpen",
  818. C: "PageClose"
  819. };
  820. exports.PageActionEventType = PageActionEventType;
  821. const StreamType = {
  822. UNKNOWN: "UNKNOWN",
  823. FLATE: "FLATE",
  824. LZW: "LZW",
  825. DCT: "DCT",
  826. JPX: "JPX",
  827. JBIG: "JBIG",
  828. A85: "A85",
  829. AHX: "AHX",
  830. CCF: "CCF",
  831. RLX: "RLX"
  832. };
  833. exports.StreamType = StreamType;
  834. const FontType = {
  835. UNKNOWN: "UNKNOWN",
  836. TYPE1: "TYPE1",
  837. TYPE1STANDARD: "TYPE1STANDARD",
  838. TYPE1C: "TYPE1C",
  839. CIDFONTTYPE0: "CIDFONTTYPE0",
  840. CIDFONTTYPE0C: "CIDFONTTYPE0C",
  841. TRUETYPE: "TRUETYPE",
  842. CIDFONTTYPE2: "CIDFONTTYPE2",
  843. TYPE3: "TYPE3",
  844. OPENTYPE: "OPENTYPE",
  845. TYPE0: "TYPE0",
  846. MMTYPE1: "MMTYPE1"
  847. };
  848. exports.FontType = FontType;
  849. const VerbosityLevel = {
  850. ERRORS: 0,
  851. WARNINGS: 1,
  852. INFOS: 5
  853. };
  854. exports.VerbosityLevel = VerbosityLevel;
  855. const CMapCompressionType = {
  856. NONE: 0,
  857. BINARY: 1,
  858. STREAM: 2
  859. };
  860. exports.CMapCompressionType = CMapCompressionType;
  861. const OPS = {
  862. dependency: 1,
  863. setLineWidth: 2,
  864. setLineCap: 3,
  865. setLineJoin: 4,
  866. setMiterLimit: 5,
  867. setDash: 6,
  868. setRenderingIntent: 7,
  869. setFlatness: 8,
  870. setGState: 9,
  871. save: 10,
  872. restore: 11,
  873. transform: 12,
  874. moveTo: 13,
  875. lineTo: 14,
  876. curveTo: 15,
  877. curveTo2: 16,
  878. curveTo3: 17,
  879. closePath: 18,
  880. rectangle: 19,
  881. stroke: 20,
  882. closeStroke: 21,
  883. fill: 22,
  884. eoFill: 23,
  885. fillStroke: 24,
  886. eoFillStroke: 25,
  887. closeFillStroke: 26,
  888. closeEOFillStroke: 27,
  889. endPath: 28,
  890. clip: 29,
  891. eoClip: 30,
  892. beginText: 31,
  893. endText: 32,
  894. setCharSpacing: 33,
  895. setWordSpacing: 34,
  896. setHScale: 35,
  897. setLeading: 36,
  898. setFont: 37,
  899. setTextRenderingMode: 38,
  900. setTextRise: 39,
  901. moveText: 40,
  902. setLeadingMoveText: 41,
  903. setTextMatrix: 42,
  904. nextLine: 43,
  905. showText: 44,
  906. showSpacedText: 45,
  907. nextLineShowText: 46,
  908. nextLineSetSpacingShowText: 47,
  909. setCharWidth: 48,
  910. setCharWidthAndBounds: 49,
  911. setStrokeColorSpace: 50,
  912. setFillColorSpace: 51,
  913. setStrokeColor: 52,
  914. setStrokeColorN: 53,
  915. setFillColor: 54,
  916. setFillColorN: 55,
  917. setStrokeGray: 56,
  918. setFillGray: 57,
  919. setStrokeRGBColor: 58,
  920. setFillRGBColor: 59,
  921. setStrokeCMYKColor: 60,
  922. setFillCMYKColor: 61,
  923. shadingFill: 62,
  924. beginInlineImage: 63,
  925. beginImageData: 64,
  926. endInlineImage: 65,
  927. paintXObject: 66,
  928. markPoint: 67,
  929. markPointProps: 68,
  930. beginMarkedContent: 69,
  931. beginMarkedContentProps: 70,
  932. endMarkedContent: 71,
  933. beginCompat: 72,
  934. endCompat: 73,
  935. paintFormXObjectBegin: 74,
  936. paintFormXObjectEnd: 75,
  937. beginGroup: 76,
  938. endGroup: 77,
  939. beginAnnotations: 78,
  940. endAnnotations: 79,
  941. beginAnnotation: 80,
  942. endAnnotation: 81,
  943. paintJpegXObject: 82,
  944. paintImageMaskXObject: 83,
  945. paintImageMaskXObjectGroup: 84,
  946. paintImageXObject: 85,
  947. paintInlineImageXObject: 86,
  948. paintInlineImageXObjectGroup: 87,
  949. paintImageXObjectRepeat: 88,
  950. paintImageMaskXObjectRepeat: 89,
  951. paintSolidColorImageMask: 90,
  952. constructPath: 91
  953. };
  954. exports.OPS = OPS;
  955. const UNSUPPORTED_FEATURES = {
  956. unknown: "unknown",
  957. forms: "forms",
  958. javaScript: "javaScript",
  959. signatures: "signatures",
  960. smask: "smask",
  961. shadingPattern: "shadingPattern",
  962. font: "font",
  963. errorTilingPattern: "errorTilingPattern",
  964. errorExtGState: "errorExtGState",
  965. errorXObject: "errorXObject",
  966. errorFontLoadType3: "errorFontLoadType3",
  967. errorFontState: "errorFontState",
  968. errorFontMissing: "errorFontMissing",
  969. errorFontTranslate: "errorFontTranslate",
  970. errorColorSpace: "errorColorSpace",
  971. errorOperatorList: "errorOperatorList",
  972. errorFontToUnicode: "errorFontToUnicode",
  973. errorFontLoadNative: "errorFontLoadNative",
  974. errorFontBuildPath: "errorFontBuildPath",
  975. errorFontGetPath: "errorFontGetPath",
  976. errorMarkedContent: "errorMarkedContent",
  977. errorContentSubStream: "errorContentSubStream"
  978. };
  979. exports.UNSUPPORTED_FEATURES = UNSUPPORTED_FEATURES;
  980. const PasswordResponses = {
  981. NEED_PASSWORD: 1,
  982. INCORRECT_PASSWORD: 2
  983. };
  984. exports.PasswordResponses = PasswordResponses;
  985. let verbosity = VerbosityLevel.WARNINGS;
  986. function setVerbosityLevel(level) {
  987. if (Number.isInteger(level)) {
  988. verbosity = level;
  989. }
  990. }
  991. function getVerbosityLevel() {
  992. return verbosity;
  993. }
  994. function info(msg) {
  995. if (verbosity >= VerbosityLevel.INFOS) {
  996. console.log(`Info: ${msg}`);
  997. }
  998. }
  999. function warn(msg) {
  1000. if (verbosity >= VerbosityLevel.WARNINGS) {
  1001. console.log(`Warning: ${msg}`);
  1002. }
  1003. }
  1004. function unreachable(msg) {
  1005. throw new Error(msg);
  1006. }
  1007. function assert(cond, msg) {
  1008. if (!cond) {
  1009. unreachable(msg);
  1010. }
  1011. }
  1012. function _isValidProtocol(url) {
  1013. if (!url) {
  1014. return false;
  1015. }
  1016. switch (url.protocol) {
  1017. case "http:":
  1018. case "https:":
  1019. case "ftp:":
  1020. case "mailto:":
  1021. case "tel:":
  1022. return true;
  1023. default:
  1024. return false;
  1025. }
  1026. }
  1027. function createValidAbsoluteUrl(url, baseUrl = null, options = null) {
  1028. if (!url) {
  1029. return null;
  1030. }
  1031. try {
  1032. if (options && typeof url === "string") {
  1033. if (options.addDefaultProtocol && url.startsWith("www.")) {
  1034. const dots = url.match(/\./g);
  1035. if (dots && dots.length >= 2) {
  1036. url = `http://${url}`;
  1037. }
  1038. }
  1039. if (options.tryConvertEncoding) {
  1040. try {
  1041. url = stringToUTF8String(url);
  1042. } catch (ex) {}
  1043. }
  1044. }
  1045. const absoluteUrl = baseUrl ? new URL(url, baseUrl) : new URL(url);
  1046. if (_isValidProtocol(absoluteUrl)) {
  1047. return absoluteUrl;
  1048. }
  1049. } catch (ex) {}
  1050. return null;
  1051. }
  1052. function shadow(obj, prop, value) {
  1053. Object.defineProperty(obj, prop, {
  1054. value,
  1055. enumerable: true,
  1056. configurable: true,
  1057. writable: false
  1058. });
  1059. return value;
  1060. }
  1061. const BaseException = function BaseExceptionClosure() {
  1062. function BaseException(message, name) {
  1063. if (this.constructor === BaseException) {
  1064. unreachable("Cannot initialize BaseException.");
  1065. }
  1066. this.message = message;
  1067. this.name = name;
  1068. }
  1069. BaseException.prototype = new Error();
  1070. BaseException.constructor = BaseException;
  1071. return BaseException;
  1072. }();
  1073. exports.BaseException = BaseException;
  1074. class PasswordException extends BaseException {
  1075. constructor(msg, code) {
  1076. super(msg, "PasswordException");
  1077. this.code = code;
  1078. }
  1079. }
  1080. exports.PasswordException = PasswordException;
  1081. class UnknownErrorException extends BaseException {
  1082. constructor(msg, details) {
  1083. super(msg, "UnknownErrorException");
  1084. this.details = details;
  1085. }
  1086. }
  1087. exports.UnknownErrorException = UnknownErrorException;
  1088. class InvalidPDFException extends BaseException {
  1089. constructor(msg) {
  1090. super(msg, "InvalidPDFException");
  1091. }
  1092. }
  1093. exports.InvalidPDFException = InvalidPDFException;
  1094. class MissingPDFException extends BaseException {
  1095. constructor(msg) {
  1096. super(msg, "MissingPDFException");
  1097. }
  1098. }
  1099. exports.MissingPDFException = MissingPDFException;
  1100. class UnexpectedResponseException extends BaseException {
  1101. constructor(msg, status) {
  1102. super(msg, "UnexpectedResponseException");
  1103. this.status = status;
  1104. }
  1105. }
  1106. exports.UnexpectedResponseException = UnexpectedResponseException;
  1107. class FormatError extends BaseException {
  1108. constructor(msg) {
  1109. super(msg, "FormatError");
  1110. }
  1111. }
  1112. exports.FormatError = FormatError;
  1113. class AbortException extends BaseException {
  1114. constructor(msg) {
  1115. super(msg, "AbortException");
  1116. }
  1117. }
  1118. exports.AbortException = AbortException;
  1119. function bytesToString(bytes) {
  1120. if (typeof bytes !== "object" || bytes === null || bytes.length === undefined) {
  1121. unreachable("Invalid argument for bytesToString");
  1122. }
  1123. const length = bytes.length;
  1124. const MAX_ARGUMENT_COUNT = 8192;
  1125. if (length < MAX_ARGUMENT_COUNT) {
  1126. return String.fromCharCode.apply(null, bytes);
  1127. }
  1128. const strBuf = [];
  1129. for (let i = 0; i < length; i += MAX_ARGUMENT_COUNT) {
  1130. const chunkEnd = Math.min(i + MAX_ARGUMENT_COUNT, length);
  1131. const chunk = bytes.subarray(i, chunkEnd);
  1132. strBuf.push(String.fromCharCode.apply(null, chunk));
  1133. }
  1134. return strBuf.join("");
  1135. }
  1136. function stringToBytes(str) {
  1137. if (typeof str !== "string") {
  1138. unreachable("Invalid argument for stringToBytes");
  1139. }
  1140. const length = str.length;
  1141. const bytes = new Uint8Array(length);
  1142. for (let i = 0; i < length; ++i) {
  1143. bytes[i] = str.charCodeAt(i) & 0xff;
  1144. }
  1145. return bytes;
  1146. }
  1147. function arrayByteLength(arr) {
  1148. if (arr.length !== undefined) {
  1149. return arr.length;
  1150. }
  1151. if (arr.byteLength !== undefined) {
  1152. return arr.byteLength;
  1153. }
  1154. unreachable("Invalid argument for arrayByteLength");
  1155. }
  1156. function arraysToBytes(arr) {
  1157. const length = arr.length;
  1158. if (length === 1 && arr[0] instanceof Uint8Array) {
  1159. return arr[0];
  1160. }
  1161. let resultLength = 0;
  1162. for (let i = 0; i < length; i++) {
  1163. resultLength += arrayByteLength(arr[i]);
  1164. }
  1165. let pos = 0;
  1166. const data = new Uint8Array(resultLength);
  1167. for (let i = 0; i < length; i++) {
  1168. let item = arr[i];
  1169. if (!(item instanceof Uint8Array)) {
  1170. if (typeof item === "string") {
  1171. item = stringToBytes(item);
  1172. } else {
  1173. item = new Uint8Array(item);
  1174. }
  1175. }
  1176. const itemLength = item.byteLength;
  1177. data.set(item, pos);
  1178. pos += itemLength;
  1179. }
  1180. return data;
  1181. }
  1182. function string32(value) {
  1183. return String.fromCharCode(value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  1184. }
  1185. function objectSize(obj) {
  1186. return Object.keys(obj).length;
  1187. }
  1188. function objectFromMap(map) {
  1189. const obj = Object.create(null);
  1190. for (const [key, value] of map) {
  1191. obj[key] = value;
  1192. }
  1193. return obj;
  1194. }
  1195. function isLittleEndian() {
  1196. const buffer8 = new Uint8Array(4);
  1197. buffer8[0] = 1;
  1198. const view32 = new Uint32Array(buffer8.buffer, 0, 1);
  1199. return view32[0] === 1;
  1200. }
  1201. function isEvalSupported() {
  1202. try {
  1203. new Function("");
  1204. return true;
  1205. } catch (e) {
  1206. return false;
  1207. }
  1208. }
  1209. class FeatureTest {
  1210. static get isLittleEndian() {
  1211. return shadow(this, "isLittleEndian", isLittleEndian());
  1212. }
  1213. static get isEvalSupported() {
  1214. return shadow(this, "isEvalSupported", isEvalSupported());
  1215. }
  1216. static get isOffscreenCanvasSupported() {
  1217. return shadow(this, "isOffscreenCanvasSupported", typeof OffscreenCanvas !== "undefined");
  1218. }
  1219. }
  1220. exports.FeatureTest = FeatureTest;
  1221. const hexNumbers = [...Array(256).keys()].map(n => n.toString(16).padStart(2, "0"));
  1222. class Util {
  1223. static makeHexColor(r, g, b) {
  1224. return `#${hexNumbers[r]}${hexNumbers[g]}${hexNumbers[b]}`;
  1225. }
  1226. static scaleMinMax(transform, minMax) {
  1227. let temp;
  1228. if (transform[0]) {
  1229. if (transform[0] < 0) {
  1230. temp = minMax[0];
  1231. minMax[0] = minMax[1];
  1232. minMax[1] = temp;
  1233. }
  1234. minMax[0] *= transform[0];
  1235. minMax[1] *= transform[0];
  1236. if (transform[3] < 0) {
  1237. temp = minMax[2];
  1238. minMax[2] = minMax[3];
  1239. minMax[3] = temp;
  1240. }
  1241. minMax[2] *= transform[3];
  1242. minMax[3] *= transform[3];
  1243. } else {
  1244. temp = minMax[0];
  1245. minMax[0] = minMax[2];
  1246. minMax[2] = temp;
  1247. temp = minMax[1];
  1248. minMax[1] = minMax[3];
  1249. minMax[3] = temp;
  1250. if (transform[1] < 0) {
  1251. temp = minMax[2];
  1252. minMax[2] = minMax[3];
  1253. minMax[3] = temp;
  1254. }
  1255. minMax[2] *= transform[1];
  1256. minMax[3] *= transform[1];
  1257. if (transform[2] < 0) {
  1258. temp = minMax[0];
  1259. minMax[0] = minMax[1];
  1260. minMax[1] = temp;
  1261. }
  1262. minMax[0] *= transform[2];
  1263. minMax[1] *= transform[2];
  1264. }
  1265. minMax[0] += transform[4];
  1266. minMax[1] += transform[4];
  1267. minMax[2] += transform[5];
  1268. minMax[3] += transform[5];
  1269. }
  1270. static transform(m1, m2) {
  1271. 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]];
  1272. }
  1273. static applyTransform(p, m) {
  1274. const xt = p[0] * m[0] + p[1] * m[2] + m[4];
  1275. const yt = p[0] * m[1] + p[1] * m[3] + m[5];
  1276. return [xt, yt];
  1277. }
  1278. static applyInverseTransform(p, m) {
  1279. const d = m[0] * m[3] - m[1] * m[2];
  1280. const xt = (p[0] * m[3] - p[1] * m[2] + m[2] * m[5] - m[4] * m[3]) / d;
  1281. const yt = (-p[0] * m[1] + p[1] * m[0] + m[4] * m[1] - m[5] * m[0]) / d;
  1282. return [xt, yt];
  1283. }
  1284. static getAxialAlignedBoundingBox(r, m) {
  1285. const p1 = Util.applyTransform(r, m);
  1286. const p2 = Util.applyTransform(r.slice(2, 4), m);
  1287. const p3 = Util.applyTransform([r[0], r[3]], m);
  1288. const p4 = Util.applyTransform([r[2], r[1]], m);
  1289. 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])];
  1290. }
  1291. static inverseTransform(m) {
  1292. const d = m[0] * m[3] - m[1] * m[2];
  1293. 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];
  1294. }
  1295. static apply3dTransform(m, v) {
  1296. return [m[0] * v[0] + m[1] * v[1] + m[2] * v[2], m[3] * v[0] + m[4] * v[1] + m[5] * v[2], m[6] * v[0] + m[7] * v[1] + m[8] * v[2]];
  1297. }
  1298. static singularValueDecompose2dScale(m) {
  1299. const transpose = [m[0], m[2], m[1], m[3]];
  1300. const a = m[0] * transpose[0] + m[1] * transpose[2];
  1301. const b = m[0] * transpose[1] + m[1] * transpose[3];
  1302. const c = m[2] * transpose[0] + m[3] * transpose[2];
  1303. const d = m[2] * transpose[1] + m[3] * transpose[3];
  1304. const first = (a + d) / 2;
  1305. const second = Math.sqrt((a + d) ** 2 - 4 * (a * d - c * b)) / 2;
  1306. const sx = first + second || 1;
  1307. const sy = first - second || 1;
  1308. return [Math.sqrt(sx), Math.sqrt(sy)];
  1309. }
  1310. static normalizeRect(rect) {
  1311. const r = rect.slice(0);
  1312. if (rect[0] > rect[2]) {
  1313. r[0] = rect[2];
  1314. r[2] = rect[0];
  1315. }
  1316. if (rect[1] > rect[3]) {
  1317. r[1] = rect[3];
  1318. r[3] = rect[1];
  1319. }
  1320. return r;
  1321. }
  1322. static intersect(rect1, rect2) {
  1323. const xLow = Math.max(Math.min(rect1[0], rect1[2]), Math.min(rect2[0], rect2[2]));
  1324. const xHigh = Math.min(Math.max(rect1[0], rect1[2]), Math.max(rect2[0], rect2[2]));
  1325. if (xLow > xHigh) {
  1326. return null;
  1327. }
  1328. const yLow = Math.max(Math.min(rect1[1], rect1[3]), Math.min(rect2[1], rect2[3]));
  1329. const yHigh = Math.min(Math.max(rect1[1], rect1[3]), Math.max(rect2[1], rect2[3]));
  1330. if (yLow > yHigh) {
  1331. return null;
  1332. }
  1333. return [xLow, yLow, xHigh, yHigh];
  1334. }
  1335. static bezierBoundingBox(x0, y0, x1, y1, x2, y2, x3, y3) {
  1336. const tvalues = [],
  1337. bounds = [[], []];
  1338. let a, b, c, t, t1, t2, b2ac, sqrtb2ac;
  1339. for (let i = 0; i < 2; ++i) {
  1340. if (i === 0) {
  1341. b = 6 * x0 - 12 * x1 + 6 * x2;
  1342. a = -3 * x0 + 9 * x1 - 9 * x2 + 3 * x3;
  1343. c = 3 * x1 - 3 * x0;
  1344. } else {
  1345. b = 6 * y0 - 12 * y1 + 6 * y2;
  1346. a = -3 * y0 + 9 * y1 - 9 * y2 + 3 * y3;
  1347. c = 3 * y1 - 3 * y0;
  1348. }
  1349. if (Math.abs(a) < 1e-12) {
  1350. if (Math.abs(b) < 1e-12) {
  1351. continue;
  1352. }
  1353. t = -c / b;
  1354. if (0 < t && t < 1) {
  1355. tvalues.push(t);
  1356. }
  1357. continue;
  1358. }
  1359. b2ac = b * b - 4 * c * a;
  1360. sqrtb2ac = Math.sqrt(b2ac);
  1361. if (b2ac < 0) {
  1362. continue;
  1363. }
  1364. t1 = (-b + sqrtb2ac) / (2 * a);
  1365. if (0 < t1 && t1 < 1) {
  1366. tvalues.push(t1);
  1367. }
  1368. t2 = (-b - sqrtb2ac) / (2 * a);
  1369. if (0 < t2 && t2 < 1) {
  1370. tvalues.push(t2);
  1371. }
  1372. }
  1373. let j = tvalues.length,
  1374. mt;
  1375. const jlen = j;
  1376. while (j--) {
  1377. t = tvalues[j];
  1378. mt = 1 - t;
  1379. bounds[0][j] = mt * mt * mt * x0 + 3 * mt * mt * t * x1 + 3 * mt * t * t * x2 + t * t * t * x3;
  1380. bounds[1][j] = mt * mt * mt * y0 + 3 * mt * mt * t * y1 + 3 * mt * t * t * y2 + t * t * t * y3;
  1381. }
  1382. bounds[0][jlen] = x0;
  1383. bounds[1][jlen] = y0;
  1384. bounds[0][jlen + 1] = x3;
  1385. bounds[1][jlen + 1] = y3;
  1386. bounds[0].length = bounds[1].length = jlen + 2;
  1387. return [Math.min(...bounds[0]), Math.min(...bounds[1]), Math.max(...bounds[0]), Math.max(...bounds[1])];
  1388. }
  1389. }
  1390. exports.Util = Util;
  1391. 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];
  1392. function stringToPDFString(str) {
  1393. if (str[0] >= "\xEF") {
  1394. let encoding;
  1395. if (str[0] === "\xFE" && str[1] === "\xFF") {
  1396. encoding = "utf-16be";
  1397. } else if (str[0] === "\xFF" && str[1] === "\xFE") {
  1398. encoding = "utf-16le";
  1399. } else if (str[0] === "\xEF" && str[1] === "\xBB" && str[2] === "\xBF") {
  1400. encoding = "utf-8";
  1401. }
  1402. if (encoding) {
  1403. try {
  1404. const decoder = new TextDecoder(encoding, {
  1405. fatal: true
  1406. });
  1407. const buffer = stringToBytes(str);
  1408. return decoder.decode(buffer);
  1409. } catch (ex) {
  1410. warn(`stringToPDFString: "${ex}".`);
  1411. }
  1412. }
  1413. }
  1414. const strBuf = [];
  1415. for (let i = 0, ii = str.length; i < ii; i++) {
  1416. const code = PDFStringTranslateTable[str.charCodeAt(i)];
  1417. strBuf.push(code ? String.fromCharCode(code) : str.charAt(i));
  1418. }
  1419. return strBuf.join("");
  1420. }
  1421. function escapeString(str) {
  1422. return str.replace(/([()\\\n\r])/g, match => {
  1423. if (match === "\n") {
  1424. return "\\n";
  1425. } else if (match === "\r") {
  1426. return "\\r";
  1427. }
  1428. return `\\${match}`;
  1429. });
  1430. }
  1431. function isAscii(str) {
  1432. return /^[\x00-\x7F]*$/.test(str);
  1433. }
  1434. function stringToUTF16BEString(str) {
  1435. const buf = ["\xFE\xFF"];
  1436. for (let i = 0, ii = str.length; i < ii; i++) {
  1437. const char = str.charCodeAt(i);
  1438. buf.push(String.fromCharCode(char >> 8 & 0xff), String.fromCharCode(char & 0xff));
  1439. }
  1440. return buf.join("");
  1441. }
  1442. function stringToUTF8String(str) {
  1443. return decodeURIComponent(escape(str));
  1444. }
  1445. function utf8StringToString(str) {
  1446. return unescape(encodeURIComponent(str));
  1447. }
  1448. function isArrayBuffer(v) {
  1449. return typeof v === "object" && v !== null && v.byteLength !== undefined;
  1450. }
  1451. function isArrayEqual(arr1, arr2) {
  1452. if (arr1.length !== arr2.length) {
  1453. return false;
  1454. }
  1455. for (let i = 0, ii = arr1.length; i < ii; i++) {
  1456. if (arr1[i] !== arr2[i]) {
  1457. return false;
  1458. }
  1459. }
  1460. return true;
  1461. }
  1462. function getModificationDate(date = new Date()) {
  1463. 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")];
  1464. return buffer.join("");
  1465. }
  1466. function createPromiseCapability() {
  1467. const capability = Object.create(null);
  1468. let isSettled = false;
  1469. Object.defineProperty(capability, "settled", {
  1470. get() {
  1471. return isSettled;
  1472. }
  1473. });
  1474. capability.promise = new Promise(function (resolve, reject) {
  1475. capability.resolve = function (data) {
  1476. isSettled = true;
  1477. resolve(data);
  1478. };
  1479. capability.reject = function (reason) {
  1480. isSettled = true;
  1481. reject(reason);
  1482. };
  1483. });
  1484. return capability;
  1485. }
  1486. /***/ }),
  1487. /* 3 */
  1488. /***/ ((__unused_webpack_module, __unused_webpack_exports, __w_pdfjs_require__) => {
  1489. var _is_node = __w_pdfjs_require__(4);
  1490. ;
  1491. /***/ }),
  1492. /* 4 */
  1493. /***/ ((__unused_webpack_module, exports) => {
  1494. Object.defineProperty(exports, "__esModule", ({
  1495. value: true
  1496. }));
  1497. exports.isNodeJS = void 0;
  1498. const isNodeJS = typeof process === "object" && process + "" === "[object process]" && !process.versions.nw && !(process.versions.electron && process.type && process.type !== "browser");
  1499. exports.isNodeJS = isNodeJS;
  1500. /***/ }),
  1501. /* 5 */
  1502. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1503. Object.defineProperty(exports, "__esModule", ({
  1504. value: true
  1505. }));
  1506. exports.RefSetCache = exports.RefSet = exports.Ref = exports.Name = exports.EOF = exports.Dict = exports.Cmd = exports.CIRCULAR_REF = void 0;
  1507. exports.clearPrimitiveCaches = clearPrimitiveCaches;
  1508. exports.isCmd = isCmd;
  1509. exports.isDict = isDict;
  1510. exports.isName = isName;
  1511. exports.isRefsEqual = isRefsEqual;
  1512. var _util = __w_pdfjs_require__(2);
  1513. const CIRCULAR_REF = Symbol("CIRCULAR_REF");
  1514. exports.CIRCULAR_REF = CIRCULAR_REF;
  1515. const EOF = Symbol("EOF");
  1516. exports.EOF = EOF;
  1517. const Name = function NameClosure() {
  1518. let nameCache = Object.create(null);
  1519. class Name {
  1520. constructor(name) {
  1521. this.name = name;
  1522. }
  1523. static get(name) {
  1524. const nameValue = nameCache[name];
  1525. return nameValue ? nameValue : nameCache[name] = new Name(name);
  1526. }
  1527. static _clearCache() {
  1528. nameCache = Object.create(null);
  1529. }
  1530. }
  1531. return Name;
  1532. }();
  1533. exports.Name = Name;
  1534. const Cmd = function CmdClosure() {
  1535. let cmdCache = Object.create(null);
  1536. class Cmd {
  1537. constructor(cmd) {
  1538. this.cmd = cmd;
  1539. }
  1540. static get(cmd) {
  1541. const cmdValue = cmdCache[cmd];
  1542. return cmdValue ? cmdValue : cmdCache[cmd] = new Cmd(cmd);
  1543. }
  1544. static _clearCache() {
  1545. cmdCache = Object.create(null);
  1546. }
  1547. }
  1548. return Cmd;
  1549. }();
  1550. exports.Cmd = Cmd;
  1551. const nonSerializable = function nonSerializableClosure() {
  1552. return nonSerializable;
  1553. };
  1554. class Dict {
  1555. constructor(xref = null) {
  1556. this._map = Object.create(null);
  1557. this.xref = xref;
  1558. this.objId = null;
  1559. this.suppressEncryption = false;
  1560. this.__nonSerializable__ = nonSerializable;
  1561. }
  1562. assignXref(newXref) {
  1563. this.xref = newXref;
  1564. }
  1565. get size() {
  1566. return Object.keys(this._map).length;
  1567. }
  1568. get(key1, key2, key3) {
  1569. let value = this._map[key1];
  1570. if (value === undefined && key2 !== undefined) {
  1571. value = this._map[key2];
  1572. if (value === undefined && key3 !== undefined) {
  1573. value = this._map[key3];
  1574. }
  1575. }
  1576. if (value instanceof Ref && this.xref) {
  1577. return this.xref.fetch(value, this.suppressEncryption);
  1578. }
  1579. return value;
  1580. }
  1581. async getAsync(key1, key2, key3) {
  1582. let value = this._map[key1];
  1583. if (value === undefined && key2 !== undefined) {
  1584. value = this._map[key2];
  1585. if (value === undefined && key3 !== undefined) {
  1586. value = this._map[key3];
  1587. }
  1588. }
  1589. if (value instanceof Ref && this.xref) {
  1590. return this.xref.fetchAsync(value, this.suppressEncryption);
  1591. }
  1592. return value;
  1593. }
  1594. getArray(key1, key2, key3) {
  1595. let value = this._map[key1];
  1596. if (value === undefined && key2 !== undefined) {
  1597. value = this._map[key2];
  1598. if (value === undefined && key3 !== undefined) {
  1599. value = this._map[key3];
  1600. }
  1601. }
  1602. if (value instanceof Ref && this.xref) {
  1603. value = this.xref.fetch(value, this.suppressEncryption);
  1604. }
  1605. if (Array.isArray(value)) {
  1606. value = value.slice();
  1607. for (let i = 0, ii = value.length; i < ii; i++) {
  1608. if (value[i] instanceof Ref && this.xref) {
  1609. value[i] = this.xref.fetch(value[i], this.suppressEncryption);
  1610. }
  1611. }
  1612. }
  1613. return value;
  1614. }
  1615. getRaw(key) {
  1616. return this._map[key];
  1617. }
  1618. getKeys() {
  1619. return Object.keys(this._map);
  1620. }
  1621. getRawValues() {
  1622. return Object.values(this._map);
  1623. }
  1624. set(key, value) {
  1625. this._map[key] = value;
  1626. }
  1627. has(key) {
  1628. return this._map[key] !== undefined;
  1629. }
  1630. forEach(callback) {
  1631. for (const key in this._map) {
  1632. callback(key, this.get(key));
  1633. }
  1634. }
  1635. static get empty() {
  1636. const emptyDict = new Dict(null);
  1637. emptyDict.set = (key, value) => {
  1638. (0, _util.unreachable)("Should not call `set` on the empty dictionary.");
  1639. };
  1640. return (0, _util.shadow)(this, "empty", emptyDict);
  1641. }
  1642. static merge({
  1643. xref,
  1644. dictArray,
  1645. mergeSubDicts = false
  1646. }) {
  1647. const mergedDict = new Dict(xref),
  1648. properties = new Map();
  1649. for (const dict of dictArray) {
  1650. if (!(dict instanceof Dict)) {
  1651. continue;
  1652. }
  1653. for (const [key, value] of Object.entries(dict._map)) {
  1654. let property = properties.get(key);
  1655. if (property === undefined) {
  1656. property = [];
  1657. properties.set(key, property);
  1658. } else if (!mergeSubDicts || !(value instanceof Dict)) {
  1659. continue;
  1660. }
  1661. property.push(value);
  1662. }
  1663. }
  1664. for (const [name, values] of properties) {
  1665. if (values.length === 1 || !(values[0] instanceof Dict)) {
  1666. mergedDict._map[name] = values[0];
  1667. continue;
  1668. }
  1669. const subDict = new Dict(xref);
  1670. for (const dict of values) {
  1671. for (const [key, value] of Object.entries(dict._map)) {
  1672. if (subDict._map[key] === undefined) {
  1673. subDict._map[key] = value;
  1674. }
  1675. }
  1676. }
  1677. if (subDict.size > 0) {
  1678. mergedDict._map[name] = subDict;
  1679. }
  1680. }
  1681. properties.clear();
  1682. return mergedDict.size > 0 ? mergedDict : Dict.empty;
  1683. }
  1684. }
  1685. exports.Dict = Dict;
  1686. const Ref = function RefClosure() {
  1687. let refCache = Object.create(null);
  1688. class Ref {
  1689. constructor(num, gen) {
  1690. this.num = num;
  1691. this.gen = gen;
  1692. }
  1693. toString() {
  1694. if (this.gen === 0) {
  1695. return `${this.num}R`;
  1696. }
  1697. return `${this.num}R${this.gen}`;
  1698. }
  1699. static get(num, gen) {
  1700. const key = gen === 0 ? `${num}R` : `${num}R${gen}`;
  1701. const refValue = refCache[key];
  1702. return refValue ? refValue : refCache[key] = new Ref(num, gen);
  1703. }
  1704. static _clearCache() {
  1705. refCache = Object.create(null);
  1706. }
  1707. }
  1708. return Ref;
  1709. }();
  1710. exports.Ref = Ref;
  1711. class RefSet {
  1712. constructor(parent = null) {
  1713. this._set = new Set(parent && parent._set);
  1714. }
  1715. has(ref) {
  1716. return this._set.has(ref.toString());
  1717. }
  1718. put(ref) {
  1719. this._set.add(ref.toString());
  1720. }
  1721. remove(ref) {
  1722. this._set.delete(ref.toString());
  1723. }
  1724. [Symbol.iterator]() {
  1725. return this._set.values();
  1726. }
  1727. clear() {
  1728. this._set.clear();
  1729. }
  1730. }
  1731. exports.RefSet = RefSet;
  1732. class RefSetCache {
  1733. constructor() {
  1734. this._map = new Map();
  1735. }
  1736. get size() {
  1737. return this._map.size;
  1738. }
  1739. get(ref) {
  1740. return this._map.get(ref.toString());
  1741. }
  1742. has(ref) {
  1743. return this._map.has(ref.toString());
  1744. }
  1745. put(ref, obj) {
  1746. this._map.set(ref.toString(), obj);
  1747. }
  1748. putAlias(ref, aliasRef) {
  1749. this._map.set(ref.toString(), this.get(aliasRef));
  1750. }
  1751. [Symbol.iterator]() {
  1752. return this._map.values();
  1753. }
  1754. clear() {
  1755. this._map.clear();
  1756. }
  1757. }
  1758. exports.RefSetCache = RefSetCache;
  1759. function isName(v, name) {
  1760. return v instanceof Name && (name === undefined || v.name === name);
  1761. }
  1762. function isCmd(v, cmd) {
  1763. return v instanceof Cmd && (cmd === undefined || v.cmd === cmd);
  1764. }
  1765. function isDict(v, type) {
  1766. return v instanceof Dict && (type === undefined || isName(v.get("Type"), type));
  1767. }
  1768. function isRefsEqual(v1, v2) {
  1769. return v1.num === v2.num && v1.gen === v2.gen;
  1770. }
  1771. function clearPrimitiveCaches() {
  1772. Cmd._clearCache();
  1773. Name._clearCache();
  1774. Ref._clearCache();
  1775. }
  1776. /***/ }),
  1777. /* 6 */
  1778. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1779. Object.defineProperty(exports, "__esModule", ({
  1780. value: true
  1781. }));
  1782. exports.NetworkPdfManager = exports.LocalPdfManager = void 0;
  1783. var _util = __w_pdfjs_require__(2);
  1784. var _chunked_stream = __w_pdfjs_require__(7);
  1785. var _core_utils = __w_pdfjs_require__(8);
  1786. var _document = __w_pdfjs_require__(11);
  1787. var _stream = __w_pdfjs_require__(10);
  1788. function parseDocBaseUrl(url) {
  1789. if (url) {
  1790. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url);
  1791. if (absoluteUrl) {
  1792. return absoluteUrl.href;
  1793. }
  1794. (0, _util.warn)(`Invalid absolute docBaseUrl: "${url}".`);
  1795. }
  1796. return null;
  1797. }
  1798. class BasePdfManager {
  1799. constructor() {
  1800. if (this.constructor === BasePdfManager) {
  1801. (0, _util.unreachable)("Cannot initialize BasePdfManager.");
  1802. }
  1803. }
  1804. get docId() {
  1805. return this._docId;
  1806. }
  1807. get password() {
  1808. return this._password;
  1809. }
  1810. get docBaseUrl() {
  1811. const catalog = this.pdfDocument.catalog;
  1812. return (0, _util.shadow)(this, "docBaseUrl", catalog.baseUrl || this._docBaseUrl);
  1813. }
  1814. onLoadedStream() {
  1815. (0, _util.unreachable)("Abstract method `onLoadedStream` called");
  1816. }
  1817. ensureDoc(prop, args) {
  1818. return this.ensure(this.pdfDocument, prop, args);
  1819. }
  1820. ensureXRef(prop, args) {
  1821. return this.ensure(this.pdfDocument.xref, prop, args);
  1822. }
  1823. ensureCatalog(prop, args) {
  1824. return this.ensure(this.pdfDocument.catalog, prop, args);
  1825. }
  1826. getPage(pageIndex) {
  1827. return this.pdfDocument.getPage(pageIndex);
  1828. }
  1829. fontFallback(id, handler) {
  1830. return this.pdfDocument.fontFallback(id, handler);
  1831. }
  1832. loadXfaFonts(handler, task) {
  1833. return this.pdfDocument.loadXfaFonts(handler, task);
  1834. }
  1835. loadXfaImages() {
  1836. return this.pdfDocument.loadXfaImages();
  1837. }
  1838. serializeXfaData(annotationStorage) {
  1839. return this.pdfDocument.serializeXfaData(annotationStorage);
  1840. }
  1841. cleanup(manuallyTriggered = false) {
  1842. return this.pdfDocument.cleanup(manuallyTriggered);
  1843. }
  1844. async ensure(obj, prop, args) {
  1845. (0, _util.unreachable)("Abstract method `ensure` called");
  1846. }
  1847. requestRange(begin, end) {
  1848. (0, _util.unreachable)("Abstract method `requestRange` called");
  1849. }
  1850. requestLoadedStream() {
  1851. (0, _util.unreachable)("Abstract method `requestLoadedStream` called");
  1852. }
  1853. sendProgressiveData(chunk) {
  1854. (0, _util.unreachable)("Abstract method `sendProgressiveData` called");
  1855. }
  1856. updatePassword(password) {
  1857. this._password = password;
  1858. }
  1859. terminate(reason) {
  1860. (0, _util.unreachable)("Abstract method `terminate` called");
  1861. }
  1862. }
  1863. class LocalPdfManager extends BasePdfManager {
  1864. constructor(docId, data, password, msgHandler, evaluatorOptions, enableXfa, docBaseUrl) {
  1865. super();
  1866. this._docId = docId;
  1867. this._password = password;
  1868. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1869. this.msgHandler = msgHandler;
  1870. this.evaluatorOptions = evaluatorOptions;
  1871. this.enableXfa = enableXfa;
  1872. const stream = new _stream.Stream(data);
  1873. this.pdfDocument = new _document.PDFDocument(this, stream);
  1874. this._loadedStreamPromise = Promise.resolve(stream);
  1875. }
  1876. async ensure(obj, prop, args) {
  1877. const value = obj[prop];
  1878. if (typeof value === "function") {
  1879. return value.apply(obj, args);
  1880. }
  1881. return value;
  1882. }
  1883. requestRange(begin, end) {
  1884. return Promise.resolve();
  1885. }
  1886. requestLoadedStream() {}
  1887. onLoadedStream() {
  1888. return this._loadedStreamPromise;
  1889. }
  1890. terminate(reason) {}
  1891. }
  1892. exports.LocalPdfManager = LocalPdfManager;
  1893. class NetworkPdfManager extends BasePdfManager {
  1894. constructor(docId, pdfNetworkStream, args, evaluatorOptions, enableXfa, docBaseUrl) {
  1895. super();
  1896. this._docId = docId;
  1897. this._password = args.password;
  1898. this._docBaseUrl = parseDocBaseUrl(docBaseUrl);
  1899. this.msgHandler = args.msgHandler;
  1900. this.evaluatorOptions = evaluatorOptions;
  1901. this.enableXfa = enableXfa;
  1902. this.streamManager = new _chunked_stream.ChunkedStreamManager(pdfNetworkStream, {
  1903. msgHandler: args.msgHandler,
  1904. length: args.length,
  1905. disableAutoFetch: args.disableAutoFetch,
  1906. rangeChunkSize: args.rangeChunkSize
  1907. });
  1908. this.pdfDocument = new _document.PDFDocument(this, this.streamManager.getStream());
  1909. }
  1910. async ensure(obj, prop, args) {
  1911. try {
  1912. const value = obj[prop];
  1913. if (typeof value === "function") {
  1914. return value.apply(obj, args);
  1915. }
  1916. return value;
  1917. } catch (ex) {
  1918. if (!(ex instanceof _core_utils.MissingDataException)) {
  1919. throw ex;
  1920. }
  1921. await this.requestRange(ex.begin, ex.end);
  1922. return this.ensure(obj, prop, args);
  1923. }
  1924. }
  1925. requestRange(begin, end) {
  1926. return this.streamManager.requestRange(begin, end);
  1927. }
  1928. requestLoadedStream() {
  1929. this.streamManager.requestAllChunks();
  1930. }
  1931. sendProgressiveData(chunk) {
  1932. this.streamManager.onReceiveData({
  1933. chunk
  1934. });
  1935. }
  1936. onLoadedStream() {
  1937. return this.streamManager.onLoadedStream();
  1938. }
  1939. terminate(reason) {
  1940. this.streamManager.abort(reason);
  1941. }
  1942. }
  1943. exports.NetworkPdfManager = NetworkPdfManager;
  1944. /***/ }),
  1945. /* 7 */
  1946. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  1947. Object.defineProperty(exports, "__esModule", ({
  1948. value: true
  1949. }));
  1950. exports.ChunkedStreamManager = exports.ChunkedStream = void 0;
  1951. var _util = __w_pdfjs_require__(2);
  1952. var _core_utils = __w_pdfjs_require__(8);
  1953. var _stream = __w_pdfjs_require__(10);
  1954. class ChunkedStream extends _stream.Stream {
  1955. constructor(length, chunkSize, manager) {
  1956. super(new Uint8Array(length), 0, length, null);
  1957. this.chunkSize = chunkSize;
  1958. this._loadedChunks = new Set();
  1959. this.numChunks = Math.ceil(length / chunkSize);
  1960. this.manager = manager;
  1961. this.progressiveDataLength = 0;
  1962. this.lastSuccessfulEnsureByteChunk = -1;
  1963. }
  1964. getMissingChunks() {
  1965. const chunks = [];
  1966. for (let chunk = 0, n = this.numChunks; chunk < n; ++chunk) {
  1967. if (!this._loadedChunks.has(chunk)) {
  1968. chunks.push(chunk);
  1969. }
  1970. }
  1971. return chunks;
  1972. }
  1973. get numChunksLoaded() {
  1974. return this._loadedChunks.size;
  1975. }
  1976. get isDataLoaded() {
  1977. return this.numChunksLoaded === this.numChunks;
  1978. }
  1979. onReceiveData(begin, chunk) {
  1980. const chunkSize = this.chunkSize;
  1981. if (begin % chunkSize !== 0) {
  1982. throw new Error(`Bad begin offset: ${begin}`);
  1983. }
  1984. const end = begin + chunk.byteLength;
  1985. if (end % chunkSize !== 0 && end !== this.bytes.length) {
  1986. throw new Error(`Bad end offset: ${end}`);
  1987. }
  1988. this.bytes.set(new Uint8Array(chunk), begin);
  1989. const beginChunk = Math.floor(begin / chunkSize);
  1990. const endChunk = Math.floor((end - 1) / chunkSize) + 1;
  1991. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  1992. this._loadedChunks.add(curChunk);
  1993. }
  1994. }
  1995. onReceiveProgressiveData(data) {
  1996. let position = this.progressiveDataLength;
  1997. const beginChunk = Math.floor(position / this.chunkSize);
  1998. this.bytes.set(new Uint8Array(data), position);
  1999. position += data.byteLength;
  2000. this.progressiveDataLength = position;
  2001. const endChunk = position >= this.end ? this.numChunks : Math.floor(position / this.chunkSize);
  2002. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2003. this._loadedChunks.add(curChunk);
  2004. }
  2005. }
  2006. ensureByte(pos) {
  2007. if (pos < this.progressiveDataLength) {
  2008. return;
  2009. }
  2010. const chunk = Math.floor(pos / this.chunkSize);
  2011. if (chunk > this.numChunks) {
  2012. return;
  2013. }
  2014. if (chunk === this.lastSuccessfulEnsureByteChunk) {
  2015. return;
  2016. }
  2017. if (!this._loadedChunks.has(chunk)) {
  2018. throw new _core_utils.MissingDataException(pos, pos + 1);
  2019. }
  2020. this.lastSuccessfulEnsureByteChunk = chunk;
  2021. }
  2022. ensureRange(begin, end) {
  2023. if (begin >= end) {
  2024. return;
  2025. }
  2026. if (end <= this.progressiveDataLength) {
  2027. return;
  2028. }
  2029. const beginChunk = Math.floor(begin / this.chunkSize);
  2030. if (beginChunk > this.numChunks) {
  2031. return;
  2032. }
  2033. const endChunk = Math.min(Math.floor((end - 1) / this.chunkSize) + 1, this.numChunks);
  2034. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2035. if (!this._loadedChunks.has(chunk)) {
  2036. throw new _core_utils.MissingDataException(begin, end);
  2037. }
  2038. }
  2039. }
  2040. nextEmptyChunk(beginChunk) {
  2041. const numChunks = this.numChunks;
  2042. for (let i = 0; i < numChunks; ++i) {
  2043. const chunk = (beginChunk + i) % numChunks;
  2044. if (!this._loadedChunks.has(chunk)) {
  2045. return chunk;
  2046. }
  2047. }
  2048. return null;
  2049. }
  2050. hasChunk(chunk) {
  2051. return this._loadedChunks.has(chunk);
  2052. }
  2053. getByte() {
  2054. const pos = this.pos;
  2055. if (pos >= this.end) {
  2056. return -1;
  2057. }
  2058. if (pos >= this.progressiveDataLength) {
  2059. this.ensureByte(pos);
  2060. }
  2061. return this.bytes[this.pos++];
  2062. }
  2063. getBytes(length) {
  2064. const bytes = this.bytes;
  2065. const pos = this.pos;
  2066. const strEnd = this.end;
  2067. if (!length) {
  2068. if (strEnd > this.progressiveDataLength) {
  2069. this.ensureRange(pos, strEnd);
  2070. }
  2071. return bytes.subarray(pos, strEnd);
  2072. }
  2073. let end = pos + length;
  2074. if (end > strEnd) {
  2075. end = strEnd;
  2076. }
  2077. if (end > this.progressiveDataLength) {
  2078. this.ensureRange(pos, end);
  2079. }
  2080. this.pos = end;
  2081. return bytes.subarray(pos, end);
  2082. }
  2083. getByteRange(begin, end) {
  2084. if (begin < 0) {
  2085. begin = 0;
  2086. }
  2087. if (end > this.end) {
  2088. end = this.end;
  2089. }
  2090. if (end > this.progressiveDataLength) {
  2091. this.ensureRange(begin, end);
  2092. }
  2093. return this.bytes.subarray(begin, end);
  2094. }
  2095. makeSubStream(start, length, dict = null) {
  2096. if (length) {
  2097. if (start + length > this.progressiveDataLength) {
  2098. this.ensureRange(start, start + length);
  2099. }
  2100. } else {
  2101. if (start >= this.progressiveDataLength) {
  2102. this.ensureByte(start);
  2103. }
  2104. }
  2105. function ChunkedStreamSubstream() {}
  2106. ChunkedStreamSubstream.prototype = Object.create(this);
  2107. ChunkedStreamSubstream.prototype.getMissingChunks = function () {
  2108. const chunkSize = this.chunkSize;
  2109. const beginChunk = Math.floor(this.start / chunkSize);
  2110. const endChunk = Math.floor((this.end - 1) / chunkSize) + 1;
  2111. const missingChunks = [];
  2112. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2113. if (!this._loadedChunks.has(chunk)) {
  2114. missingChunks.push(chunk);
  2115. }
  2116. }
  2117. return missingChunks;
  2118. };
  2119. Object.defineProperty(ChunkedStreamSubstream.prototype, "isDataLoaded", {
  2120. get() {
  2121. if (this.numChunksLoaded === this.numChunks) {
  2122. return true;
  2123. }
  2124. return this.getMissingChunks().length === 0;
  2125. },
  2126. configurable: true
  2127. });
  2128. const subStream = new ChunkedStreamSubstream();
  2129. subStream.pos = subStream.start = start;
  2130. subStream.end = start + length || this.end;
  2131. subStream.dict = dict;
  2132. return subStream;
  2133. }
  2134. getBaseStreams() {
  2135. return [this];
  2136. }
  2137. }
  2138. exports.ChunkedStream = ChunkedStream;
  2139. class ChunkedStreamManager {
  2140. constructor(pdfNetworkStream, args) {
  2141. this.length = args.length;
  2142. this.chunkSize = args.rangeChunkSize;
  2143. this.stream = new ChunkedStream(this.length, this.chunkSize, this);
  2144. this.pdfNetworkStream = pdfNetworkStream;
  2145. this.disableAutoFetch = args.disableAutoFetch;
  2146. this.msgHandler = args.msgHandler;
  2147. this.currRequestId = 0;
  2148. this._chunksNeededByRequest = new Map();
  2149. this._requestsByChunk = new Map();
  2150. this._promisesByRequest = new Map();
  2151. this.progressiveDataLength = 0;
  2152. this.aborted = false;
  2153. this._loadedStreamCapability = (0, _util.createPromiseCapability)();
  2154. }
  2155. onLoadedStream() {
  2156. return this._loadedStreamCapability.promise;
  2157. }
  2158. sendRequest(begin, end) {
  2159. const rangeReader = this.pdfNetworkStream.getRangeReader(begin, end);
  2160. if (!rangeReader.isStreamingSupported) {
  2161. rangeReader.onProgress = this.onProgress.bind(this);
  2162. }
  2163. let chunks = [],
  2164. loaded = 0;
  2165. return new Promise((resolve, reject) => {
  2166. const readChunk = chunk => {
  2167. try {
  2168. if (!chunk.done) {
  2169. const data = chunk.value;
  2170. chunks.push(data);
  2171. loaded += (0, _util.arrayByteLength)(data);
  2172. if (rangeReader.isStreamingSupported) {
  2173. this.onProgress({
  2174. loaded
  2175. });
  2176. }
  2177. rangeReader.read().then(readChunk, reject);
  2178. return;
  2179. }
  2180. const chunkData = (0, _util.arraysToBytes)(chunks);
  2181. chunks = null;
  2182. resolve(chunkData);
  2183. } catch (e) {
  2184. reject(e);
  2185. }
  2186. };
  2187. rangeReader.read().then(readChunk, reject);
  2188. }).then(data => {
  2189. if (this.aborted) {
  2190. return;
  2191. }
  2192. this.onReceiveData({
  2193. chunk: data,
  2194. begin
  2195. });
  2196. });
  2197. }
  2198. requestAllChunks() {
  2199. const missingChunks = this.stream.getMissingChunks();
  2200. this._requestChunks(missingChunks);
  2201. return this._loadedStreamCapability.promise;
  2202. }
  2203. _requestChunks(chunks) {
  2204. const requestId = this.currRequestId++;
  2205. const chunksNeeded = new Set();
  2206. this._chunksNeededByRequest.set(requestId, chunksNeeded);
  2207. for (const chunk of chunks) {
  2208. if (!this.stream.hasChunk(chunk)) {
  2209. chunksNeeded.add(chunk);
  2210. }
  2211. }
  2212. if (chunksNeeded.size === 0) {
  2213. return Promise.resolve();
  2214. }
  2215. const capability = (0, _util.createPromiseCapability)();
  2216. this._promisesByRequest.set(requestId, capability);
  2217. const chunksToRequest = [];
  2218. for (const chunk of chunksNeeded) {
  2219. let requestIds = this._requestsByChunk.get(chunk);
  2220. if (!requestIds) {
  2221. requestIds = [];
  2222. this._requestsByChunk.set(chunk, requestIds);
  2223. chunksToRequest.push(chunk);
  2224. }
  2225. requestIds.push(requestId);
  2226. }
  2227. if (chunksToRequest.length > 0) {
  2228. const groupedChunksToRequest = this.groupChunks(chunksToRequest);
  2229. for (const groupedChunk of groupedChunksToRequest) {
  2230. const begin = groupedChunk.beginChunk * this.chunkSize;
  2231. const end = Math.min(groupedChunk.endChunk * this.chunkSize, this.length);
  2232. this.sendRequest(begin, end).catch(capability.reject);
  2233. }
  2234. }
  2235. return capability.promise.catch(reason => {
  2236. if (this.aborted) {
  2237. return;
  2238. }
  2239. throw reason;
  2240. });
  2241. }
  2242. getStream() {
  2243. return this.stream;
  2244. }
  2245. requestRange(begin, end) {
  2246. end = Math.min(end, this.length);
  2247. const beginChunk = this.getBeginChunk(begin);
  2248. const endChunk = this.getEndChunk(end);
  2249. const chunks = [];
  2250. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2251. chunks.push(chunk);
  2252. }
  2253. return this._requestChunks(chunks);
  2254. }
  2255. requestRanges(ranges = []) {
  2256. const chunksToRequest = [];
  2257. for (const range of ranges) {
  2258. const beginChunk = this.getBeginChunk(range.begin);
  2259. const endChunk = this.getEndChunk(range.end);
  2260. for (let chunk = beginChunk; chunk < endChunk; ++chunk) {
  2261. if (!chunksToRequest.includes(chunk)) {
  2262. chunksToRequest.push(chunk);
  2263. }
  2264. }
  2265. }
  2266. chunksToRequest.sort(function (a, b) {
  2267. return a - b;
  2268. });
  2269. return this._requestChunks(chunksToRequest);
  2270. }
  2271. groupChunks(chunks) {
  2272. const groupedChunks = [];
  2273. let beginChunk = -1;
  2274. let prevChunk = -1;
  2275. for (let i = 0, ii = chunks.length; i < ii; ++i) {
  2276. const chunk = chunks[i];
  2277. if (beginChunk < 0) {
  2278. beginChunk = chunk;
  2279. }
  2280. if (prevChunk >= 0 && prevChunk + 1 !== chunk) {
  2281. groupedChunks.push({
  2282. beginChunk,
  2283. endChunk: prevChunk + 1
  2284. });
  2285. beginChunk = chunk;
  2286. }
  2287. if (i + 1 === chunks.length) {
  2288. groupedChunks.push({
  2289. beginChunk,
  2290. endChunk: chunk + 1
  2291. });
  2292. }
  2293. prevChunk = chunk;
  2294. }
  2295. return groupedChunks;
  2296. }
  2297. onProgress(args) {
  2298. this.msgHandler.send("DocProgress", {
  2299. loaded: this.stream.numChunksLoaded * this.chunkSize + args.loaded,
  2300. total: this.length
  2301. });
  2302. }
  2303. onReceiveData(args) {
  2304. const chunk = args.chunk;
  2305. const isProgressive = args.begin === undefined;
  2306. const begin = isProgressive ? this.progressiveDataLength : args.begin;
  2307. const end = begin + chunk.byteLength;
  2308. const beginChunk = Math.floor(begin / this.chunkSize);
  2309. const endChunk = end < this.length ? Math.floor(end / this.chunkSize) : Math.ceil(end / this.chunkSize);
  2310. if (isProgressive) {
  2311. this.stream.onReceiveProgressiveData(chunk);
  2312. this.progressiveDataLength = end;
  2313. } else {
  2314. this.stream.onReceiveData(begin, chunk);
  2315. }
  2316. if (this.stream.isDataLoaded) {
  2317. this._loadedStreamCapability.resolve(this.stream);
  2318. }
  2319. const loadedRequests = [];
  2320. for (let curChunk = beginChunk; curChunk < endChunk; ++curChunk) {
  2321. const requestIds = this._requestsByChunk.get(curChunk);
  2322. if (!requestIds) {
  2323. continue;
  2324. }
  2325. this._requestsByChunk.delete(curChunk);
  2326. for (const requestId of requestIds) {
  2327. const chunksNeeded = this._chunksNeededByRequest.get(requestId);
  2328. if (chunksNeeded.has(curChunk)) {
  2329. chunksNeeded.delete(curChunk);
  2330. }
  2331. if (chunksNeeded.size > 0) {
  2332. continue;
  2333. }
  2334. loadedRequests.push(requestId);
  2335. }
  2336. }
  2337. if (!this.disableAutoFetch && this._requestsByChunk.size === 0) {
  2338. let nextEmptyChunk;
  2339. if (this.stream.numChunksLoaded === 1) {
  2340. const lastChunk = this.stream.numChunks - 1;
  2341. if (!this.stream.hasChunk(lastChunk)) {
  2342. nextEmptyChunk = lastChunk;
  2343. }
  2344. } else {
  2345. nextEmptyChunk = this.stream.nextEmptyChunk(endChunk);
  2346. }
  2347. if (Number.isInteger(nextEmptyChunk)) {
  2348. this._requestChunks([nextEmptyChunk]);
  2349. }
  2350. }
  2351. for (const requestId of loadedRequests) {
  2352. const capability = this._promisesByRequest.get(requestId);
  2353. this._promisesByRequest.delete(requestId);
  2354. capability.resolve();
  2355. }
  2356. this.msgHandler.send("DocProgress", {
  2357. loaded: this.stream.numChunksLoaded * this.chunkSize,
  2358. total: this.length
  2359. });
  2360. }
  2361. onError(err) {
  2362. this._loadedStreamCapability.reject(err);
  2363. }
  2364. getBeginChunk(begin) {
  2365. return Math.floor(begin / this.chunkSize);
  2366. }
  2367. getEndChunk(end) {
  2368. return Math.floor((end - 1) / this.chunkSize) + 1;
  2369. }
  2370. abort(reason) {
  2371. this.aborted = true;
  2372. if (this.pdfNetworkStream) {
  2373. this.pdfNetworkStream.cancelAllRequests(reason);
  2374. }
  2375. for (const capability of this._promisesByRequest.values()) {
  2376. capability.reject(reason);
  2377. }
  2378. }
  2379. }
  2380. exports.ChunkedStreamManager = ChunkedStreamManager;
  2381. /***/ }),
  2382. /* 8 */
  2383. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2384. Object.defineProperty(exports, "__esModule", ({
  2385. value: true
  2386. }));
  2387. exports.XRefParseException = exports.XRefEntryException = exports.ParserEOFException = exports.MissingDataException = exports.DocStats = void 0;
  2388. exports.collectActions = collectActions;
  2389. exports.encodeToXmlString = encodeToXmlString;
  2390. exports.escapePDFName = escapePDFName;
  2391. exports.getArrayLookupTableFactory = getArrayLookupTableFactory;
  2392. exports.getInheritableProperty = getInheritableProperty;
  2393. exports.getLookupTableFactory = getLookupTableFactory;
  2394. exports.isWhiteSpace = isWhiteSpace;
  2395. exports.log2 = log2;
  2396. exports.parseXFAPath = parseXFAPath;
  2397. exports.readInt8 = readInt8;
  2398. exports.readUint16 = readUint16;
  2399. exports.readUint32 = readUint32;
  2400. exports.recoverJsURL = recoverJsURL;
  2401. exports.toRomanNumerals = toRomanNumerals;
  2402. exports.validateCSSFont = validateCSSFont;
  2403. var _util = __w_pdfjs_require__(2);
  2404. var _primitives = __w_pdfjs_require__(5);
  2405. var _base_stream = __w_pdfjs_require__(9);
  2406. function getLookupTableFactory(initializer) {
  2407. let lookup;
  2408. return function () {
  2409. if (initializer) {
  2410. lookup = Object.create(null);
  2411. initializer(lookup);
  2412. initializer = null;
  2413. }
  2414. return lookup;
  2415. };
  2416. }
  2417. function getArrayLookupTableFactory(initializer) {
  2418. let lookup;
  2419. return function () {
  2420. if (initializer) {
  2421. let arr = initializer();
  2422. initializer = null;
  2423. lookup = Object.create(null);
  2424. for (let i = 0, ii = arr.length; i < ii; i += 2) {
  2425. lookup[arr[i]] = arr[i + 1];
  2426. }
  2427. arr = null;
  2428. }
  2429. return lookup;
  2430. };
  2431. }
  2432. class MissingDataException extends _util.BaseException {
  2433. constructor(begin, end) {
  2434. super(`Missing data [${begin}, ${end})`, "MissingDataException");
  2435. this.begin = begin;
  2436. this.end = end;
  2437. }
  2438. }
  2439. exports.MissingDataException = MissingDataException;
  2440. class ParserEOFException extends _util.BaseException {
  2441. constructor(msg) {
  2442. super(msg, "ParserEOFException");
  2443. }
  2444. }
  2445. exports.ParserEOFException = ParserEOFException;
  2446. class XRefEntryException extends _util.BaseException {
  2447. constructor(msg) {
  2448. super(msg, "XRefEntryException");
  2449. }
  2450. }
  2451. exports.XRefEntryException = XRefEntryException;
  2452. class XRefParseException extends _util.BaseException {
  2453. constructor(msg) {
  2454. super(msg, "XRefParseException");
  2455. }
  2456. }
  2457. exports.XRefParseException = XRefParseException;
  2458. class DocStats {
  2459. constructor(handler) {
  2460. this._handler = handler;
  2461. this._streamTypes = new Set();
  2462. this._fontTypes = new Set();
  2463. }
  2464. _send() {
  2465. const streamTypes = Object.create(null),
  2466. fontTypes = Object.create(null);
  2467. for (const type of this._streamTypes) {
  2468. streamTypes[type] = true;
  2469. }
  2470. for (const type of this._fontTypes) {
  2471. fontTypes[type] = true;
  2472. }
  2473. this._handler.send("DocStats", {
  2474. streamTypes,
  2475. fontTypes
  2476. });
  2477. }
  2478. addStreamType(type) {
  2479. if (this._streamTypes.has(type)) {
  2480. return;
  2481. }
  2482. this._streamTypes.add(type);
  2483. this._send();
  2484. }
  2485. addFontType(type) {
  2486. if (this._fontTypes.has(type)) {
  2487. return;
  2488. }
  2489. this._fontTypes.add(type);
  2490. this._send();
  2491. }
  2492. }
  2493. exports.DocStats = DocStats;
  2494. function getInheritableProperty({
  2495. dict,
  2496. key,
  2497. getArray = false,
  2498. stopWhenFound = true
  2499. }) {
  2500. let values;
  2501. const visited = new _primitives.RefSet();
  2502. while (dict instanceof _primitives.Dict && !(dict.objId && visited.has(dict.objId))) {
  2503. if (dict.objId) {
  2504. visited.put(dict.objId);
  2505. }
  2506. const value = getArray ? dict.getArray(key) : dict.get(key);
  2507. if (value !== undefined) {
  2508. if (stopWhenFound) {
  2509. return value;
  2510. }
  2511. if (!values) {
  2512. values = [];
  2513. }
  2514. values.push(value);
  2515. }
  2516. dict = dict.get("Parent");
  2517. }
  2518. return values;
  2519. }
  2520. 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"];
  2521. function toRomanNumerals(number, lowerCase = false) {
  2522. (0, _util.assert)(Number.isInteger(number) && number > 0, "The number should be a positive integer.");
  2523. const romanBuf = [];
  2524. let pos;
  2525. while (number >= 1000) {
  2526. number -= 1000;
  2527. romanBuf.push("M");
  2528. }
  2529. pos = number / 100 | 0;
  2530. number %= 100;
  2531. romanBuf.push(ROMAN_NUMBER_MAP[pos]);
  2532. pos = number / 10 | 0;
  2533. number %= 10;
  2534. romanBuf.push(ROMAN_NUMBER_MAP[10 + pos]);
  2535. romanBuf.push(ROMAN_NUMBER_MAP[20 + number]);
  2536. const romanStr = romanBuf.join("");
  2537. return lowerCase ? romanStr.toLowerCase() : romanStr;
  2538. }
  2539. function log2(x) {
  2540. if (x <= 0) {
  2541. return 0;
  2542. }
  2543. return Math.ceil(Math.log2(x));
  2544. }
  2545. function readInt8(data, offset) {
  2546. return data[offset] << 24 >> 24;
  2547. }
  2548. function readUint16(data, offset) {
  2549. return data[offset] << 8 | data[offset + 1];
  2550. }
  2551. function readUint32(data, offset) {
  2552. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  2553. }
  2554. function isWhiteSpace(ch) {
  2555. return ch === 0x20 || ch === 0x09 || ch === 0x0d || ch === 0x0a;
  2556. }
  2557. function parseXFAPath(path) {
  2558. const positionPattern = /(.+)\[(\d+)\]$/;
  2559. return path.split(".").map(component => {
  2560. const m = component.match(positionPattern);
  2561. if (m) {
  2562. return {
  2563. name: m[1],
  2564. pos: parseInt(m[2], 10)
  2565. };
  2566. }
  2567. return {
  2568. name: component,
  2569. pos: 0
  2570. };
  2571. });
  2572. }
  2573. function escapePDFName(str) {
  2574. const buffer = [];
  2575. let start = 0;
  2576. for (let i = 0, ii = str.length; i < ii; i++) {
  2577. const char = str.charCodeAt(i);
  2578. 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) {
  2579. if (start < i) {
  2580. buffer.push(str.substring(start, i));
  2581. }
  2582. buffer.push(`#${char.toString(16)}`);
  2583. start = i + 1;
  2584. }
  2585. }
  2586. if (buffer.length === 0) {
  2587. return str;
  2588. }
  2589. if (start < str.length) {
  2590. buffer.push(str.substring(start, str.length));
  2591. }
  2592. return buffer.join("");
  2593. }
  2594. function _collectJS(entry, xref, list, parents) {
  2595. if (!entry) {
  2596. return;
  2597. }
  2598. let parent = null;
  2599. if (entry instanceof _primitives.Ref) {
  2600. if (parents.has(entry)) {
  2601. return;
  2602. }
  2603. parent = entry;
  2604. parents.put(parent);
  2605. entry = xref.fetch(entry);
  2606. }
  2607. if (Array.isArray(entry)) {
  2608. for (const element of entry) {
  2609. _collectJS(element, xref, list, parents);
  2610. }
  2611. } else if (entry instanceof _primitives.Dict) {
  2612. if ((0, _primitives.isName)(entry.get("S"), "JavaScript")) {
  2613. const js = entry.get("JS");
  2614. let code;
  2615. if (js instanceof _base_stream.BaseStream) {
  2616. code = js.getString();
  2617. } else if (typeof js === "string") {
  2618. code = js;
  2619. }
  2620. code = code && (0, _util.stringToPDFString)(code);
  2621. if (code) {
  2622. list.push(code);
  2623. }
  2624. }
  2625. _collectJS(entry.getRaw("Next"), xref, list, parents);
  2626. }
  2627. if (parent) {
  2628. parents.remove(parent);
  2629. }
  2630. }
  2631. function collectActions(xref, dict, eventType) {
  2632. const actions = Object.create(null);
  2633. const additionalActionsDicts = getInheritableProperty({
  2634. dict,
  2635. key: "AA",
  2636. stopWhenFound: false
  2637. });
  2638. if (additionalActionsDicts) {
  2639. for (let i = additionalActionsDicts.length - 1; i >= 0; i--) {
  2640. const additionalActions = additionalActionsDicts[i];
  2641. if (!(additionalActions instanceof _primitives.Dict)) {
  2642. continue;
  2643. }
  2644. for (const key of additionalActions.getKeys()) {
  2645. const action = eventType[key];
  2646. if (!action) {
  2647. continue;
  2648. }
  2649. const actionDict = additionalActions.getRaw(key);
  2650. const parents = new _primitives.RefSet();
  2651. const list = [];
  2652. _collectJS(actionDict, xref, list, parents);
  2653. if (list.length > 0) {
  2654. actions[action] = list;
  2655. }
  2656. }
  2657. }
  2658. }
  2659. if (dict.has("A")) {
  2660. const actionDict = dict.get("A");
  2661. const parents = new _primitives.RefSet();
  2662. const list = [];
  2663. _collectJS(actionDict, xref, list, parents);
  2664. if (list.length > 0) {
  2665. actions.Action = list;
  2666. }
  2667. }
  2668. return (0, _util.objectSize)(actions) > 0 ? actions : null;
  2669. }
  2670. const XMLEntities = {
  2671. 0x3c: "&lt;",
  2672. 0x3e: "&gt;",
  2673. 0x26: "&amp;",
  2674. 0x22: "&quot;",
  2675. 0x27: "&apos;"
  2676. };
  2677. function encodeToXmlString(str) {
  2678. const buffer = [];
  2679. let start = 0;
  2680. for (let i = 0, ii = str.length; i < ii; i++) {
  2681. const char = str.codePointAt(i);
  2682. if (0x20 <= char && char <= 0x7e) {
  2683. const entity = XMLEntities[char];
  2684. if (entity) {
  2685. if (start < i) {
  2686. buffer.push(str.substring(start, i));
  2687. }
  2688. buffer.push(entity);
  2689. start = i + 1;
  2690. }
  2691. } else {
  2692. if (start < i) {
  2693. buffer.push(str.substring(start, i));
  2694. }
  2695. buffer.push(`&#x${char.toString(16).toUpperCase()};`);
  2696. if (char > 0xd7ff && (char < 0xe000 || char > 0xfffd)) {
  2697. i++;
  2698. }
  2699. start = i + 1;
  2700. }
  2701. }
  2702. if (buffer.length === 0) {
  2703. return str;
  2704. }
  2705. if (start < str.length) {
  2706. buffer.push(str.substring(start, str.length));
  2707. }
  2708. return buffer.join("");
  2709. }
  2710. function validateCSSFont(cssFontInfo) {
  2711. const DEFAULT_CSS_FONT_OBLIQUE = "14";
  2712. const DEFAULT_CSS_FONT_WEIGHT = "400";
  2713. const CSS_FONT_WEIGHT_VALUES = new Set(["100", "200", "300", "400", "500", "600", "700", "800", "900", "1000", "normal", "bold", "bolder", "lighter"]);
  2714. const {
  2715. fontFamily,
  2716. fontWeight,
  2717. italicAngle
  2718. } = cssFontInfo;
  2719. if (/^".*"$/.test(fontFamily)) {
  2720. if (/[^\\]"/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2721. (0, _util.warn)(`XFA - FontFamily contains some unescaped ": ${fontFamily}.`);
  2722. return false;
  2723. }
  2724. } else if (/^'.*'$/.test(fontFamily)) {
  2725. if (/[^\\]'/.test(fontFamily.slice(1, fontFamily.length - 1))) {
  2726. (0, _util.warn)(`XFA - FontFamily contains some unescaped ': ${fontFamily}.`);
  2727. return false;
  2728. }
  2729. } else {
  2730. for (const ident of fontFamily.split(/[ \t]+/)) {
  2731. if (/^(\d|(-(\d|-)))/.test(ident) || !/^[\w-\\]+$/.test(ident)) {
  2732. (0, _util.warn)(`XFA - FontFamily contains some invalid <custom-ident>: ${fontFamily}.`);
  2733. return false;
  2734. }
  2735. }
  2736. }
  2737. const weight = fontWeight ? fontWeight.toString() : "";
  2738. cssFontInfo.fontWeight = CSS_FONT_WEIGHT_VALUES.has(weight) ? weight : DEFAULT_CSS_FONT_WEIGHT;
  2739. const angle = parseFloat(italicAngle);
  2740. cssFontInfo.italicAngle = isNaN(angle) || angle < -90 || angle > 90 ? DEFAULT_CSS_FONT_OBLIQUE : italicAngle.toString();
  2741. return true;
  2742. }
  2743. function recoverJsURL(str) {
  2744. const URL_OPEN_METHODS = ["app.launchURL", "window.open", "xfa.host.gotoURL"];
  2745. const regex = new RegExp("^\\s*(" + URL_OPEN_METHODS.join("|").split(".").join("\\.") + ")\\((?:'|\")([^'\"]*)(?:'|\")(?:,\\s*(\\w+)\\)|\\))", "i");
  2746. const jsUrl = regex.exec(str);
  2747. if (jsUrl && jsUrl[2]) {
  2748. const url = jsUrl[2];
  2749. let newWindow = false;
  2750. if (jsUrl[3] === "true" && jsUrl[1] === "app.launchURL") {
  2751. newWindow = true;
  2752. }
  2753. return {
  2754. url,
  2755. newWindow
  2756. };
  2757. }
  2758. return null;
  2759. }
  2760. /***/ }),
  2761. /* 9 */
  2762. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2763. Object.defineProperty(exports, "__esModule", ({
  2764. value: true
  2765. }));
  2766. exports.BaseStream = void 0;
  2767. var _util = __w_pdfjs_require__(2);
  2768. class BaseStream {
  2769. constructor() {
  2770. if (this.constructor === BaseStream) {
  2771. (0, _util.unreachable)("Cannot initialize BaseStream.");
  2772. }
  2773. }
  2774. get length() {
  2775. (0, _util.unreachable)("Abstract getter `length` accessed");
  2776. }
  2777. get isEmpty() {
  2778. (0, _util.unreachable)("Abstract getter `isEmpty` accessed");
  2779. }
  2780. get isDataLoaded() {
  2781. return (0, _util.shadow)(this, "isDataLoaded", true);
  2782. }
  2783. getByte() {
  2784. (0, _util.unreachable)("Abstract method `getByte` called");
  2785. }
  2786. getBytes(length) {
  2787. (0, _util.unreachable)("Abstract method `getBytes` called");
  2788. }
  2789. peekByte() {
  2790. const peekedByte = this.getByte();
  2791. if (peekedByte !== -1) {
  2792. this.pos--;
  2793. }
  2794. return peekedByte;
  2795. }
  2796. peekBytes(length) {
  2797. const bytes = this.getBytes(length);
  2798. this.pos -= bytes.length;
  2799. return bytes;
  2800. }
  2801. getUint16() {
  2802. const b0 = this.getByte();
  2803. const b1 = this.getByte();
  2804. if (b0 === -1 || b1 === -1) {
  2805. return -1;
  2806. }
  2807. return (b0 << 8) + b1;
  2808. }
  2809. getInt32() {
  2810. const b0 = this.getByte();
  2811. const b1 = this.getByte();
  2812. const b2 = this.getByte();
  2813. const b3 = this.getByte();
  2814. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  2815. }
  2816. getByteRange(begin, end) {
  2817. (0, _util.unreachable)("Abstract method `getByteRange` called");
  2818. }
  2819. getString(length) {
  2820. return (0, _util.bytesToString)(this.getBytes(length));
  2821. }
  2822. skip(n) {
  2823. this.pos += n || 1;
  2824. }
  2825. reset() {
  2826. (0, _util.unreachable)("Abstract method `reset` called");
  2827. }
  2828. moveStart() {
  2829. (0, _util.unreachable)("Abstract method `moveStart` called");
  2830. }
  2831. makeSubStream(start, length, dict = null) {
  2832. (0, _util.unreachable)("Abstract method `makeSubStream` called");
  2833. }
  2834. getBaseStreams() {
  2835. return null;
  2836. }
  2837. }
  2838. exports.BaseStream = BaseStream;
  2839. /***/ }),
  2840. /* 10 */
  2841. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2842. Object.defineProperty(exports, "__esModule", ({
  2843. value: true
  2844. }));
  2845. exports.StringStream = exports.Stream = exports.NullStream = void 0;
  2846. var _base_stream = __w_pdfjs_require__(9);
  2847. var _util = __w_pdfjs_require__(2);
  2848. class Stream extends _base_stream.BaseStream {
  2849. constructor(arrayBuffer, start, length, dict) {
  2850. super();
  2851. this.bytes = arrayBuffer instanceof Uint8Array ? arrayBuffer : new Uint8Array(arrayBuffer);
  2852. this.start = start || 0;
  2853. this.pos = this.start;
  2854. this.end = start + length || this.bytes.length;
  2855. this.dict = dict;
  2856. }
  2857. get length() {
  2858. return this.end - this.start;
  2859. }
  2860. get isEmpty() {
  2861. return this.length === 0;
  2862. }
  2863. getByte() {
  2864. if (this.pos >= this.end) {
  2865. return -1;
  2866. }
  2867. return this.bytes[this.pos++];
  2868. }
  2869. getBytes(length) {
  2870. const bytes = this.bytes;
  2871. const pos = this.pos;
  2872. const strEnd = this.end;
  2873. if (!length) {
  2874. return bytes.subarray(pos, strEnd);
  2875. }
  2876. let end = pos + length;
  2877. if (end > strEnd) {
  2878. end = strEnd;
  2879. }
  2880. this.pos = end;
  2881. return bytes.subarray(pos, end);
  2882. }
  2883. getByteRange(begin, end) {
  2884. if (begin < 0) {
  2885. begin = 0;
  2886. }
  2887. if (end > this.end) {
  2888. end = this.end;
  2889. }
  2890. return this.bytes.subarray(begin, end);
  2891. }
  2892. reset() {
  2893. this.pos = this.start;
  2894. }
  2895. moveStart() {
  2896. this.start = this.pos;
  2897. }
  2898. makeSubStream(start, length, dict = null) {
  2899. return new Stream(this.bytes.buffer, start, length, dict);
  2900. }
  2901. }
  2902. exports.Stream = Stream;
  2903. class StringStream extends Stream {
  2904. constructor(str) {
  2905. super((0, _util.stringToBytes)(str));
  2906. }
  2907. }
  2908. exports.StringStream = StringStream;
  2909. class NullStream extends Stream {
  2910. constructor() {
  2911. super(new Uint8Array(0));
  2912. }
  2913. }
  2914. exports.NullStream = NullStream;
  2915. /***/ }),
  2916. /* 11 */
  2917. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  2918. Object.defineProperty(exports, "__esModule", ({
  2919. value: true
  2920. }));
  2921. exports.Page = exports.PDFDocument = void 0;
  2922. var _util = __w_pdfjs_require__(2);
  2923. var _core_utils = __w_pdfjs_require__(8);
  2924. var _primitives = __w_pdfjs_require__(5);
  2925. var _xfa_fonts = __w_pdfjs_require__(12);
  2926. var _annotation = __w_pdfjs_require__(22);
  2927. var _base_stream = __w_pdfjs_require__(9);
  2928. var _crypto = __w_pdfjs_require__(74);
  2929. var _catalog = __w_pdfjs_require__(65);
  2930. var _cleanup_helper = __w_pdfjs_require__(67);
  2931. var _dataset_reader = __w_pdfjs_require__(100);
  2932. var _parser = __w_pdfjs_require__(27);
  2933. var _stream = __w_pdfjs_require__(10);
  2934. var _object_loader = __w_pdfjs_require__(72);
  2935. var _operator_list = __w_pdfjs_require__(62);
  2936. var _evaluator = __w_pdfjs_require__(25);
  2937. var _decode_stream = __w_pdfjs_require__(29);
  2938. var _struct_tree = __w_pdfjs_require__(71);
  2939. var _factory = __w_pdfjs_require__(76);
  2940. var _xref = __w_pdfjs_require__(101);
  2941. const DEFAULT_USER_UNIT = 1.0;
  2942. const LETTER_SIZE_MEDIABOX = [0, 0, 612, 792];
  2943. class Page {
  2944. constructor({
  2945. pdfManager,
  2946. xref,
  2947. pageIndex,
  2948. pageDict,
  2949. ref,
  2950. globalIdFactory,
  2951. fontCache,
  2952. builtInCMapCache,
  2953. standardFontDataCache,
  2954. globalImageCache,
  2955. nonBlendModesSet,
  2956. xfaFactory
  2957. }) {
  2958. this.pdfManager = pdfManager;
  2959. this.pageIndex = pageIndex;
  2960. this.pageDict = pageDict;
  2961. this.xref = xref;
  2962. this.ref = ref;
  2963. this.fontCache = fontCache;
  2964. this.builtInCMapCache = builtInCMapCache;
  2965. this.standardFontDataCache = standardFontDataCache;
  2966. this.globalImageCache = globalImageCache;
  2967. this.nonBlendModesSet = nonBlendModesSet;
  2968. this.evaluatorOptions = pdfManager.evaluatorOptions;
  2969. this.resourcesPromise = null;
  2970. this.xfaFactory = xfaFactory;
  2971. const idCounters = {
  2972. obj: 0
  2973. };
  2974. this._localIdFactory = class extends globalIdFactory {
  2975. static createObjId() {
  2976. return `p${pageIndex}_${++idCounters.obj}`;
  2977. }
  2978. static getPageObjId() {
  2979. return `page${ref.toString()}`;
  2980. }
  2981. };
  2982. }
  2983. _getInheritableProperty(key, getArray = false) {
  2984. const value = (0, _core_utils.getInheritableProperty)({
  2985. dict: this.pageDict,
  2986. key,
  2987. getArray,
  2988. stopWhenFound: false
  2989. });
  2990. if (!Array.isArray(value)) {
  2991. return value;
  2992. }
  2993. if (value.length === 1 || !(value[0] instanceof _primitives.Dict)) {
  2994. return value[0];
  2995. }
  2996. return _primitives.Dict.merge({
  2997. xref: this.xref,
  2998. dictArray: value
  2999. });
  3000. }
  3001. get content() {
  3002. return this.pageDict.getArray("Contents");
  3003. }
  3004. get resources() {
  3005. return (0, _util.shadow)(this, "resources", this._getInheritableProperty("Resources") || _primitives.Dict.empty);
  3006. }
  3007. _getBoundingBox(name) {
  3008. if (this.xfaData) {
  3009. return this.xfaData.bbox;
  3010. }
  3011. const box = this._getInheritableProperty(name, true);
  3012. if (Array.isArray(box) && box.length === 4) {
  3013. if (box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3014. return box;
  3015. }
  3016. (0, _util.warn)(`Empty /${name} entry.`);
  3017. }
  3018. return null;
  3019. }
  3020. get mediaBox() {
  3021. return (0, _util.shadow)(this, "mediaBox", this._getBoundingBox("MediaBox") || LETTER_SIZE_MEDIABOX);
  3022. }
  3023. get cropBox() {
  3024. return (0, _util.shadow)(this, "cropBox", this._getBoundingBox("CropBox") || this.mediaBox);
  3025. }
  3026. get userUnit() {
  3027. let obj = this.pageDict.get("UserUnit");
  3028. if (typeof obj !== "number" || obj <= 0) {
  3029. obj = DEFAULT_USER_UNIT;
  3030. }
  3031. return (0, _util.shadow)(this, "userUnit", obj);
  3032. }
  3033. get view() {
  3034. const {
  3035. cropBox,
  3036. mediaBox
  3037. } = this;
  3038. let view;
  3039. if (cropBox === mediaBox || (0, _util.isArrayEqual)(cropBox, mediaBox)) {
  3040. view = mediaBox;
  3041. } else {
  3042. const box = _util.Util.intersect(cropBox, mediaBox);
  3043. if (box && box[2] - box[0] !== 0 && box[3] - box[1] !== 0) {
  3044. view = box;
  3045. } else {
  3046. (0, _util.warn)("Empty /CropBox and /MediaBox intersection.");
  3047. }
  3048. }
  3049. return (0, _util.shadow)(this, "view", view || mediaBox);
  3050. }
  3051. get rotate() {
  3052. let rotate = this._getInheritableProperty("Rotate") || 0;
  3053. if (rotate % 90 !== 0) {
  3054. rotate = 0;
  3055. } else if (rotate >= 360) {
  3056. rotate %= 360;
  3057. } else if (rotate < 0) {
  3058. rotate = (rotate % 360 + 360) % 360;
  3059. }
  3060. return (0, _util.shadow)(this, "rotate", rotate);
  3061. }
  3062. _onSubStreamError(handler, reason, objId) {
  3063. if (this.evaluatorOptions.ignoreErrors) {
  3064. handler.send("UnsupportedFeature", {
  3065. featureId: _util.UNSUPPORTED_FEATURES.errorContentSubStream
  3066. });
  3067. (0, _util.warn)(`getContentStream - ignoring sub-stream (${objId}): "${reason}".`);
  3068. return;
  3069. }
  3070. throw reason;
  3071. }
  3072. getContentStream(handler) {
  3073. return this.pdfManager.ensure(this, "content").then(content => {
  3074. if (content instanceof _base_stream.BaseStream) {
  3075. return content;
  3076. }
  3077. if (Array.isArray(content)) {
  3078. return new _decode_stream.StreamsSequenceStream(content, this._onSubStreamError.bind(this, handler));
  3079. }
  3080. return new _stream.NullStream();
  3081. });
  3082. }
  3083. get xfaData() {
  3084. return (0, _util.shadow)(this, "xfaData", this.xfaFactory ? {
  3085. bbox: this.xfaFactory.getBoundingBox(this.pageIndex)
  3086. } : null);
  3087. }
  3088. save(handler, task, annotationStorage) {
  3089. const partialEvaluator = new _evaluator.PartialEvaluator({
  3090. xref: this.xref,
  3091. handler,
  3092. pageIndex: this.pageIndex,
  3093. idFactory: this._localIdFactory,
  3094. fontCache: this.fontCache,
  3095. builtInCMapCache: this.builtInCMapCache,
  3096. standardFontDataCache: this.standardFontDataCache,
  3097. globalImageCache: this.globalImageCache,
  3098. options: this.evaluatorOptions
  3099. });
  3100. return this._parsedAnnotations.then(function (annotations) {
  3101. const newRefsPromises = [];
  3102. for (const annotation of annotations) {
  3103. if (!annotation.mustBePrinted(annotationStorage)) {
  3104. continue;
  3105. }
  3106. newRefsPromises.push(annotation.save(partialEvaluator, task, annotationStorage).catch(function (reason) {
  3107. (0, _util.warn)("save - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3108. return null;
  3109. }));
  3110. }
  3111. return Promise.all(newRefsPromises);
  3112. });
  3113. }
  3114. loadResources(keys) {
  3115. if (!this.resourcesPromise) {
  3116. this.resourcesPromise = this.pdfManager.ensure(this, "resources");
  3117. }
  3118. return this.resourcesPromise.then(() => {
  3119. const objectLoader = new _object_loader.ObjectLoader(this.resources, keys, this.xref);
  3120. return objectLoader.load();
  3121. });
  3122. }
  3123. getOperatorList({
  3124. handler,
  3125. sink,
  3126. task,
  3127. intent,
  3128. cacheKey,
  3129. annotationStorage = null
  3130. }) {
  3131. const contentStreamPromise = this.getContentStream(handler);
  3132. const resourcesPromise = this.loadResources(["ColorSpace", "ExtGState", "Font", "Pattern", "Properties", "Shading", "XObject"]);
  3133. const partialEvaluator = new _evaluator.PartialEvaluator({
  3134. xref: this.xref,
  3135. handler,
  3136. pageIndex: this.pageIndex,
  3137. idFactory: this._localIdFactory,
  3138. fontCache: this.fontCache,
  3139. builtInCMapCache: this.builtInCMapCache,
  3140. standardFontDataCache: this.standardFontDataCache,
  3141. globalImageCache: this.globalImageCache,
  3142. options: this.evaluatorOptions
  3143. });
  3144. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3145. const pageListPromise = dataPromises.then(([contentStream]) => {
  3146. const opList = new _operator_list.OperatorList(intent, sink);
  3147. handler.send("StartRenderPage", {
  3148. transparency: partialEvaluator.hasBlendModes(this.resources, this.nonBlendModesSet),
  3149. pageIndex: this.pageIndex,
  3150. cacheKey
  3151. });
  3152. return partialEvaluator.getOperatorList({
  3153. stream: contentStream,
  3154. task,
  3155. resources: this.resources,
  3156. operatorList: opList
  3157. }).then(function () {
  3158. return opList;
  3159. });
  3160. });
  3161. return Promise.all([pageListPromise, this._parsedAnnotations]).then(function ([pageOpList, annotations]) {
  3162. if (annotations.length === 0 || intent & _util.RenderingIntentFlag.ANNOTATIONS_DISABLE) {
  3163. pageOpList.flush(true);
  3164. return {
  3165. length: pageOpList.totalLength
  3166. };
  3167. }
  3168. const renderForms = !!(intent & _util.RenderingIntentFlag.ANNOTATIONS_FORMS),
  3169. intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3170. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3171. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3172. const opListPromises = [];
  3173. for (const annotation of annotations) {
  3174. if (intentAny || intentDisplay && annotation.mustBeViewed(annotationStorage) || intentPrint && annotation.mustBePrinted(annotationStorage)) {
  3175. opListPromises.push(annotation.getOperatorList(partialEvaluator, task, intent, renderForms, annotationStorage).catch(function (reason) {
  3176. (0, _util.warn)("getOperatorList - ignoring annotation data during " + `"${task.name}" task: "${reason}".`);
  3177. return null;
  3178. }));
  3179. }
  3180. }
  3181. return Promise.all(opListPromises).then(function (opLists) {
  3182. pageOpList.addOp(_util.OPS.beginAnnotations, []);
  3183. for (const opList of opLists) {
  3184. pageOpList.addOpList(opList);
  3185. }
  3186. pageOpList.addOp(_util.OPS.endAnnotations, []);
  3187. pageOpList.flush(true);
  3188. return {
  3189. length: pageOpList.totalLength
  3190. };
  3191. });
  3192. });
  3193. }
  3194. extractTextContent({
  3195. handler,
  3196. task,
  3197. includeMarkedContent,
  3198. sink,
  3199. combineTextItems
  3200. }) {
  3201. const contentStreamPromise = this.getContentStream(handler);
  3202. const resourcesPromise = this.loadResources(["ExtGState", "Font", "Properties", "XObject"]);
  3203. const dataPromises = Promise.all([contentStreamPromise, resourcesPromise]);
  3204. return dataPromises.then(([contentStream]) => {
  3205. const partialEvaluator = new _evaluator.PartialEvaluator({
  3206. xref: this.xref,
  3207. handler,
  3208. pageIndex: this.pageIndex,
  3209. idFactory: this._localIdFactory,
  3210. fontCache: this.fontCache,
  3211. builtInCMapCache: this.builtInCMapCache,
  3212. standardFontDataCache: this.standardFontDataCache,
  3213. globalImageCache: this.globalImageCache,
  3214. options: this.evaluatorOptions
  3215. });
  3216. return partialEvaluator.getTextContent({
  3217. stream: contentStream,
  3218. task,
  3219. resources: this.resources,
  3220. includeMarkedContent,
  3221. combineTextItems,
  3222. sink,
  3223. viewBox: this.view
  3224. });
  3225. });
  3226. }
  3227. async getStructTree() {
  3228. const structTreeRoot = await this.pdfManager.ensureCatalog("structTreeRoot");
  3229. if (!structTreeRoot) {
  3230. return null;
  3231. }
  3232. const structTree = await this.pdfManager.ensure(this, "_parseStructTree", [structTreeRoot]);
  3233. return structTree.serializable;
  3234. }
  3235. _parseStructTree(structTreeRoot) {
  3236. const tree = new _struct_tree.StructTreePage(structTreeRoot, this.pageDict);
  3237. tree.parse();
  3238. return tree;
  3239. }
  3240. getAnnotationsData(intent) {
  3241. return this._parsedAnnotations.then(function (annotations) {
  3242. const annotationsData = [];
  3243. if (annotations.length === 0) {
  3244. return annotationsData;
  3245. }
  3246. const intentAny = !!(intent & _util.RenderingIntentFlag.ANY),
  3247. intentDisplay = !!(intent & _util.RenderingIntentFlag.DISPLAY),
  3248. intentPrint = !!(intent & _util.RenderingIntentFlag.PRINT);
  3249. for (const annotation of annotations) {
  3250. if (intentAny || intentDisplay && annotation.viewable || intentPrint && annotation.printable) {
  3251. annotationsData.push(annotation.data);
  3252. }
  3253. }
  3254. return annotationsData;
  3255. });
  3256. }
  3257. get annotations() {
  3258. const annots = this._getInheritableProperty("Annots");
  3259. return (0, _util.shadow)(this, "annotations", Array.isArray(annots) ? annots : []);
  3260. }
  3261. get _parsedAnnotations() {
  3262. const parsedAnnotations = this.pdfManager.ensure(this, "annotations").then(() => {
  3263. const annotationPromises = [];
  3264. for (const annotationRef of this.annotations) {
  3265. annotationPromises.push(_annotation.AnnotationFactory.create(this.xref, annotationRef, this.pdfManager, this._localIdFactory, false).catch(function (reason) {
  3266. (0, _util.warn)(`_parsedAnnotations: "${reason}".`);
  3267. return null;
  3268. }));
  3269. }
  3270. return Promise.all(annotationPromises).then(function (annotations) {
  3271. return annotations.filter(annotation => !!annotation);
  3272. });
  3273. });
  3274. return (0, _util.shadow)(this, "_parsedAnnotations", parsedAnnotations);
  3275. }
  3276. get jsActions() {
  3277. const actions = (0, _core_utils.collectActions)(this.xref, this.pageDict, _util.PageActionEventType);
  3278. return (0, _util.shadow)(this, "jsActions", actions);
  3279. }
  3280. }
  3281. exports.Page = Page;
  3282. const PDF_HEADER_SIGNATURE = new Uint8Array([0x25, 0x50, 0x44, 0x46, 0x2d]);
  3283. const STARTXREF_SIGNATURE = new Uint8Array([0x73, 0x74, 0x61, 0x72, 0x74, 0x78, 0x72, 0x65, 0x66]);
  3284. const ENDOBJ_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x6f, 0x62, 0x6a]);
  3285. const FINGERPRINT_FIRST_BYTES = 1024;
  3286. const EMPTY_FINGERPRINT = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00";
  3287. const PDF_HEADER_VERSION_REGEXP = /^[1-9]\.\d$/;
  3288. function find(stream, signature, limit = 1024, backwards = false) {
  3289. const signatureLength = signature.length;
  3290. const scanBytes = stream.peekBytes(limit);
  3291. const scanLength = scanBytes.length - signatureLength;
  3292. if (scanLength <= 0) {
  3293. return false;
  3294. }
  3295. if (backwards) {
  3296. const signatureEnd = signatureLength - 1;
  3297. let pos = scanBytes.length - 1;
  3298. while (pos >= signatureEnd) {
  3299. let j = 0;
  3300. while (j < signatureLength && scanBytes[pos - j] === signature[signatureEnd - j]) {
  3301. j++;
  3302. }
  3303. if (j >= signatureLength) {
  3304. stream.pos += pos - signatureEnd;
  3305. return true;
  3306. }
  3307. pos--;
  3308. }
  3309. } else {
  3310. let pos = 0;
  3311. while (pos <= scanLength) {
  3312. let j = 0;
  3313. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  3314. j++;
  3315. }
  3316. if (j >= signatureLength) {
  3317. stream.pos += pos;
  3318. return true;
  3319. }
  3320. pos++;
  3321. }
  3322. }
  3323. return false;
  3324. }
  3325. class PDFDocument {
  3326. constructor(pdfManager, stream) {
  3327. if (stream.length <= 0) {
  3328. throw new _util.InvalidPDFException("The PDF file is empty, i.e. its size is zero bytes.");
  3329. }
  3330. this.pdfManager = pdfManager;
  3331. this.stream = stream;
  3332. this.xref = new _xref.XRef(stream, pdfManager);
  3333. this._pagePromises = new Map();
  3334. this._version = null;
  3335. const idCounters = {
  3336. font: 0
  3337. };
  3338. this._globalIdFactory = class {
  3339. static getDocId() {
  3340. return `g_${pdfManager.docId}`;
  3341. }
  3342. static createFontId() {
  3343. return `f${++idCounters.font}`;
  3344. }
  3345. static createObjId() {
  3346. (0, _util.unreachable)("Abstract method `createObjId` called.");
  3347. }
  3348. static getPageObjId() {
  3349. (0, _util.unreachable)("Abstract method `getPageObjId` called.");
  3350. }
  3351. };
  3352. }
  3353. parse(recoveryMode) {
  3354. this.xref.parse(recoveryMode);
  3355. this.catalog = new _catalog.Catalog(this.pdfManager, this.xref);
  3356. if (this.catalog.version) {
  3357. this._version = this.catalog.version;
  3358. }
  3359. }
  3360. get linearization() {
  3361. let linearization = null;
  3362. try {
  3363. linearization = _parser.Linearization.create(this.stream);
  3364. } catch (err) {
  3365. if (err instanceof _core_utils.MissingDataException) {
  3366. throw err;
  3367. }
  3368. (0, _util.info)(err);
  3369. }
  3370. return (0, _util.shadow)(this, "linearization", linearization);
  3371. }
  3372. get startXRef() {
  3373. const stream = this.stream;
  3374. let startXRef = 0;
  3375. if (this.linearization) {
  3376. stream.reset();
  3377. if (find(stream, ENDOBJ_SIGNATURE)) {
  3378. startXRef = stream.pos + 6 - stream.start;
  3379. }
  3380. } else {
  3381. const step = 1024;
  3382. const startXRefLength = STARTXREF_SIGNATURE.length;
  3383. let found = false,
  3384. pos = stream.end;
  3385. while (!found && pos > 0) {
  3386. pos -= step - startXRefLength;
  3387. if (pos < 0) {
  3388. pos = 0;
  3389. }
  3390. stream.pos = pos;
  3391. found = find(stream, STARTXREF_SIGNATURE, step, true);
  3392. }
  3393. if (found) {
  3394. stream.skip(9);
  3395. let ch;
  3396. do {
  3397. ch = stream.getByte();
  3398. } while ((0, _core_utils.isWhiteSpace)(ch));
  3399. let str = "";
  3400. while (ch >= 0x20 && ch <= 0x39) {
  3401. str += String.fromCharCode(ch);
  3402. ch = stream.getByte();
  3403. }
  3404. startXRef = parseInt(str, 10);
  3405. if (isNaN(startXRef)) {
  3406. startXRef = 0;
  3407. }
  3408. }
  3409. }
  3410. return (0, _util.shadow)(this, "startXRef", startXRef);
  3411. }
  3412. checkHeader() {
  3413. const stream = this.stream;
  3414. stream.reset();
  3415. if (!find(stream, PDF_HEADER_SIGNATURE)) {
  3416. return;
  3417. }
  3418. stream.moveStart();
  3419. const MAX_PDF_VERSION_LENGTH = 12;
  3420. let version = "",
  3421. ch;
  3422. while ((ch = stream.getByte()) > 0x20) {
  3423. if (version.length >= MAX_PDF_VERSION_LENGTH) {
  3424. break;
  3425. }
  3426. version += String.fromCharCode(ch);
  3427. }
  3428. if (!this._version) {
  3429. this._version = version.substring(5);
  3430. }
  3431. }
  3432. parseStartXRef() {
  3433. this.xref.setStartXRef(this.startXRef);
  3434. }
  3435. get numPages() {
  3436. let num = 0;
  3437. if (this.catalog.hasActualNumPages) {
  3438. num = this.catalog.numPages;
  3439. } else if (this.xfaFactory) {
  3440. num = this.xfaFactory.getNumPages();
  3441. } else if (this.linearization) {
  3442. num = this.linearization.numPages;
  3443. } else {
  3444. num = this.catalog.numPages;
  3445. }
  3446. return (0, _util.shadow)(this, "numPages", num);
  3447. }
  3448. _hasOnlyDocumentSignatures(fields, recursionDepth = 0) {
  3449. const RECURSION_LIMIT = 10;
  3450. if (!Array.isArray(fields)) {
  3451. return false;
  3452. }
  3453. return fields.every(field => {
  3454. field = this.xref.fetchIfRef(field);
  3455. if (!(field instanceof _primitives.Dict)) {
  3456. return false;
  3457. }
  3458. if (field.has("Kids")) {
  3459. if (++recursionDepth > RECURSION_LIMIT) {
  3460. (0, _util.warn)("_hasOnlyDocumentSignatures: maximum recursion depth reached");
  3461. return false;
  3462. }
  3463. return this._hasOnlyDocumentSignatures(field.get("Kids"), recursionDepth);
  3464. }
  3465. const isSignature = (0, _primitives.isName)(field.get("FT"), "Sig");
  3466. const rectangle = field.get("Rect");
  3467. const isInvisible = Array.isArray(rectangle) && rectangle.every(value => value === 0);
  3468. return isSignature && isInvisible;
  3469. });
  3470. }
  3471. get _xfaStreams() {
  3472. const acroForm = this.catalog.acroForm;
  3473. if (!acroForm) {
  3474. return null;
  3475. }
  3476. const xfa = acroForm.get("XFA");
  3477. const entries = {
  3478. "xdp:xdp": "",
  3479. template: "",
  3480. datasets: "",
  3481. config: "",
  3482. connectionSet: "",
  3483. localeSet: "",
  3484. stylesheet: "",
  3485. "/xdp:xdp": ""
  3486. };
  3487. if (xfa instanceof _base_stream.BaseStream && !xfa.isEmpty) {
  3488. entries["xdp:xdp"] = xfa;
  3489. return entries;
  3490. }
  3491. if (!Array.isArray(xfa) || xfa.length === 0) {
  3492. return null;
  3493. }
  3494. for (let i = 0, ii = xfa.length; i < ii; i += 2) {
  3495. let name;
  3496. if (i === 0) {
  3497. name = "xdp:xdp";
  3498. } else if (i === ii - 2) {
  3499. name = "/xdp:xdp";
  3500. } else {
  3501. name = xfa[i];
  3502. }
  3503. if (!entries.hasOwnProperty(name)) {
  3504. continue;
  3505. }
  3506. const data = this.xref.fetchIfRef(xfa[i + 1]);
  3507. if (!(data instanceof _base_stream.BaseStream) || data.isEmpty) {
  3508. continue;
  3509. }
  3510. entries[name] = data;
  3511. }
  3512. return entries;
  3513. }
  3514. get xfaDatasets() {
  3515. const streams = this._xfaStreams;
  3516. if (!streams) {
  3517. return (0, _util.shadow)(this, "xfaDatasets", null);
  3518. }
  3519. for (const key of ["datasets", "xdp:xdp"]) {
  3520. const stream = streams[key];
  3521. if (!stream) {
  3522. continue;
  3523. }
  3524. try {
  3525. const str = (0, _util.stringToUTF8String)(stream.getString());
  3526. const data = {
  3527. [key]: str
  3528. };
  3529. return (0, _util.shadow)(this, "xfaDatasets", new _dataset_reader.DatasetReader(data));
  3530. } catch (_) {
  3531. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3532. break;
  3533. }
  3534. }
  3535. return (0, _util.shadow)(this, "xfaDatasets", null);
  3536. }
  3537. get xfaData() {
  3538. const streams = this._xfaStreams;
  3539. if (!streams) {
  3540. return null;
  3541. }
  3542. const data = Object.create(null);
  3543. for (const [key, stream] of Object.entries(streams)) {
  3544. if (!stream) {
  3545. continue;
  3546. }
  3547. try {
  3548. data[key] = (0, _util.stringToUTF8String)(stream.getString());
  3549. } catch (_) {
  3550. (0, _util.warn)("XFA - Invalid utf-8 string.");
  3551. return null;
  3552. }
  3553. }
  3554. return data;
  3555. }
  3556. get xfaFactory() {
  3557. let data;
  3558. if (this.pdfManager.enableXfa && this.catalog.needsRendering && this.formInfo.hasXfa && !this.formInfo.hasAcroForm) {
  3559. data = this.xfaData;
  3560. }
  3561. return (0, _util.shadow)(this, "xfaFactory", data ? new _factory.XFAFactory(data) : null);
  3562. }
  3563. get isPureXfa() {
  3564. return this.xfaFactory ? this.xfaFactory.isValid() : false;
  3565. }
  3566. get htmlForXfa() {
  3567. return this.xfaFactory ? this.xfaFactory.getPages() : null;
  3568. }
  3569. async loadXfaImages() {
  3570. const xfaImagesDict = await this.pdfManager.ensureCatalog("xfaImages");
  3571. if (!xfaImagesDict) {
  3572. return;
  3573. }
  3574. const keys = xfaImagesDict.getKeys();
  3575. const objectLoader = new _object_loader.ObjectLoader(xfaImagesDict, keys, this.xref);
  3576. await objectLoader.load();
  3577. const xfaImages = new Map();
  3578. for (const key of keys) {
  3579. const stream = xfaImagesDict.get(key);
  3580. if (stream instanceof _base_stream.BaseStream) {
  3581. xfaImages.set(key, stream.getBytes());
  3582. }
  3583. }
  3584. this.xfaFactory.setImages(xfaImages);
  3585. }
  3586. async loadXfaFonts(handler, task) {
  3587. const acroForm = await this.pdfManager.ensureCatalog("acroForm");
  3588. if (!acroForm) {
  3589. return;
  3590. }
  3591. const resources = await acroForm.getAsync("DR");
  3592. if (!(resources instanceof _primitives.Dict)) {
  3593. return;
  3594. }
  3595. const objectLoader = new _object_loader.ObjectLoader(resources, ["Font"], this.xref);
  3596. await objectLoader.load();
  3597. const fontRes = resources.get("Font");
  3598. if (!(fontRes instanceof _primitives.Dict)) {
  3599. return;
  3600. }
  3601. const options = Object.assign(Object.create(null), this.pdfManager.evaluatorOptions);
  3602. options.useSystemFonts = false;
  3603. const partialEvaluator = new _evaluator.PartialEvaluator({
  3604. xref: this.xref,
  3605. handler,
  3606. pageIndex: -1,
  3607. idFactory: this._globalIdFactory,
  3608. fontCache: this.catalog.fontCache,
  3609. builtInCMapCache: this.catalog.builtInCMapCache,
  3610. standardFontDataCache: this.catalog.standardFontDataCache,
  3611. options
  3612. });
  3613. const operatorList = new _operator_list.OperatorList();
  3614. const pdfFonts = [];
  3615. const initialState = {
  3616. get font() {
  3617. return pdfFonts[pdfFonts.length - 1];
  3618. },
  3619. set font(font) {
  3620. pdfFonts.push(font);
  3621. },
  3622. clone() {
  3623. return this;
  3624. }
  3625. };
  3626. const fonts = new Map();
  3627. fontRes.forEach((fontName, font) => {
  3628. fonts.set(fontName, font);
  3629. });
  3630. const promises = [];
  3631. for (const [fontName, font] of fonts) {
  3632. const descriptor = font.get("FontDescriptor");
  3633. if (!(descriptor instanceof _primitives.Dict)) {
  3634. continue;
  3635. }
  3636. let fontFamily = descriptor.get("FontFamily");
  3637. fontFamily = fontFamily.replace(/[ ]+(\d)/g, "$1");
  3638. const fontWeight = descriptor.get("FontWeight");
  3639. const italicAngle = -descriptor.get("ItalicAngle");
  3640. const cssFontInfo = {
  3641. fontFamily,
  3642. fontWeight,
  3643. italicAngle
  3644. };
  3645. if (!(0, _core_utils.validateCSSFont)(cssFontInfo)) {
  3646. continue;
  3647. }
  3648. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(fontName), 1], null, operatorList, task, initialState, null, cssFontInfo).catch(function (reason) {
  3649. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3650. return null;
  3651. }));
  3652. }
  3653. await Promise.all(promises);
  3654. const missingFonts = this.xfaFactory.setFonts(pdfFonts);
  3655. if (!missingFonts) {
  3656. return;
  3657. }
  3658. options.ignoreErrors = true;
  3659. promises.length = 0;
  3660. pdfFonts.length = 0;
  3661. const reallyMissingFonts = new Set();
  3662. for (const missing of missingFonts) {
  3663. if (!(0, _xfa_fonts.getXfaFontName)(`${missing}-Regular`)) {
  3664. reallyMissingFonts.add(missing);
  3665. }
  3666. }
  3667. if (reallyMissingFonts.size) {
  3668. missingFonts.push("PdfJS-Fallback");
  3669. }
  3670. for (const missing of missingFonts) {
  3671. if (reallyMissingFonts.has(missing)) {
  3672. continue;
  3673. }
  3674. for (const fontInfo of [{
  3675. name: "Regular",
  3676. fontWeight: 400,
  3677. italicAngle: 0
  3678. }, {
  3679. name: "Bold",
  3680. fontWeight: 700,
  3681. italicAngle: 0
  3682. }, {
  3683. name: "Italic",
  3684. fontWeight: 400,
  3685. italicAngle: 12
  3686. }, {
  3687. name: "BoldItalic",
  3688. fontWeight: 700,
  3689. italicAngle: 12
  3690. }]) {
  3691. const name = `${missing}-${fontInfo.name}`;
  3692. const dict = (0, _xfa_fonts.getXfaFontDict)(name);
  3693. promises.push(partialEvaluator.handleSetFont(resources, [_primitives.Name.get(name), 1], null, operatorList, task, initialState, dict, {
  3694. fontFamily: missing,
  3695. fontWeight: fontInfo.fontWeight,
  3696. italicAngle: fontInfo.italicAngle
  3697. }).catch(function (reason) {
  3698. (0, _util.warn)(`loadXfaFonts: "${reason}".`);
  3699. return null;
  3700. }));
  3701. }
  3702. }
  3703. await Promise.all(promises);
  3704. this.xfaFactory.appendFonts(pdfFonts, reallyMissingFonts);
  3705. }
  3706. async serializeXfaData(annotationStorage) {
  3707. return this.xfaFactory ? this.xfaFactory.serializeData(annotationStorage) : null;
  3708. }
  3709. get formInfo() {
  3710. const formInfo = {
  3711. hasFields: false,
  3712. hasAcroForm: false,
  3713. hasXfa: false,
  3714. hasSignatures: false
  3715. };
  3716. const acroForm = this.catalog.acroForm;
  3717. if (!acroForm) {
  3718. return (0, _util.shadow)(this, "formInfo", formInfo);
  3719. }
  3720. try {
  3721. const fields = acroForm.get("Fields");
  3722. const hasFields = Array.isArray(fields) && fields.length > 0;
  3723. formInfo.hasFields = hasFields;
  3724. const xfa = acroForm.get("XFA");
  3725. formInfo.hasXfa = Array.isArray(xfa) && xfa.length > 0 || xfa instanceof _base_stream.BaseStream && !xfa.isEmpty;
  3726. const sigFlags = acroForm.get("SigFlags");
  3727. const hasSignatures = !!(sigFlags & 0x1);
  3728. const hasOnlyDocumentSignatures = hasSignatures && this._hasOnlyDocumentSignatures(fields);
  3729. formInfo.hasAcroForm = hasFields && !hasOnlyDocumentSignatures;
  3730. formInfo.hasSignatures = hasSignatures;
  3731. } catch (ex) {
  3732. if (ex instanceof _core_utils.MissingDataException) {
  3733. throw ex;
  3734. }
  3735. (0, _util.warn)(`Cannot fetch form information: "${ex}".`);
  3736. }
  3737. return (0, _util.shadow)(this, "formInfo", formInfo);
  3738. }
  3739. get documentInfo() {
  3740. let version = this._version;
  3741. if (typeof version !== "string" || !PDF_HEADER_VERSION_REGEXP.test(version)) {
  3742. (0, _util.warn)(`Invalid PDF header version number: ${version}`);
  3743. version = null;
  3744. }
  3745. const docInfo = {
  3746. PDFFormatVersion: version,
  3747. Language: this.catalog.lang,
  3748. EncryptFilterName: this.xref.encrypt ? this.xref.encrypt.filterName : null,
  3749. IsLinearized: !!this.linearization,
  3750. IsAcroFormPresent: this.formInfo.hasAcroForm,
  3751. IsXFAPresent: this.formInfo.hasXfa,
  3752. IsCollectionPresent: !!this.catalog.collection,
  3753. IsSignaturesPresent: this.formInfo.hasSignatures
  3754. };
  3755. let infoDict;
  3756. try {
  3757. infoDict = this.xref.trailer.get("Info");
  3758. } catch (err) {
  3759. if (err instanceof _core_utils.MissingDataException) {
  3760. throw err;
  3761. }
  3762. (0, _util.info)("The document information dictionary is invalid.");
  3763. }
  3764. if (!(infoDict instanceof _primitives.Dict)) {
  3765. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3766. }
  3767. for (const key of infoDict.getKeys()) {
  3768. const value = infoDict.get(key);
  3769. switch (key) {
  3770. case "Title":
  3771. case "Author":
  3772. case "Subject":
  3773. case "Keywords":
  3774. case "Creator":
  3775. case "Producer":
  3776. case "CreationDate":
  3777. case "ModDate":
  3778. if (typeof value === "string") {
  3779. docInfo[key] = (0, _util.stringToPDFString)(value);
  3780. continue;
  3781. }
  3782. break;
  3783. case "Trapped":
  3784. if (value instanceof _primitives.Name) {
  3785. docInfo[key] = value;
  3786. continue;
  3787. }
  3788. break;
  3789. default:
  3790. let customValue;
  3791. switch (typeof value) {
  3792. case "string":
  3793. customValue = (0, _util.stringToPDFString)(value);
  3794. break;
  3795. case "number":
  3796. case "boolean":
  3797. customValue = value;
  3798. break;
  3799. default:
  3800. if (value instanceof _primitives.Name) {
  3801. customValue = value;
  3802. }
  3803. break;
  3804. }
  3805. if (customValue === undefined) {
  3806. (0, _util.warn)(`Bad value, for custom key "${key}", in Info: ${value}.`);
  3807. continue;
  3808. }
  3809. if (!docInfo.Custom) {
  3810. docInfo.Custom = Object.create(null);
  3811. }
  3812. docInfo.Custom[key] = customValue;
  3813. continue;
  3814. }
  3815. (0, _util.warn)(`Bad value, for key "${key}", in Info: ${value}.`);
  3816. }
  3817. return (0, _util.shadow)(this, "documentInfo", docInfo);
  3818. }
  3819. get fingerprints() {
  3820. function validate(data) {
  3821. return typeof data === "string" && data.length > 0 && data !== EMPTY_FINGERPRINT;
  3822. }
  3823. function hexString(hash) {
  3824. const buf = [];
  3825. for (let i = 0, ii = hash.length; i < ii; i++) {
  3826. const hex = hash[i].toString(16);
  3827. buf.push(hex.padStart(2, "0"));
  3828. }
  3829. return buf.join("");
  3830. }
  3831. const idArray = this.xref.trailer.get("ID");
  3832. let hashOriginal, hashModified;
  3833. if (Array.isArray(idArray) && validate(idArray[0])) {
  3834. hashOriginal = (0, _util.stringToBytes)(idArray[0]);
  3835. if (idArray[1] !== idArray[0] && validate(idArray[1])) {
  3836. hashModified = (0, _util.stringToBytes)(idArray[1]);
  3837. }
  3838. } else {
  3839. hashOriginal = (0, _crypto.calculateMD5)(this.stream.getByteRange(0, FINGERPRINT_FIRST_BYTES), 0, FINGERPRINT_FIRST_BYTES);
  3840. }
  3841. return (0, _util.shadow)(this, "fingerprints", [hexString(hashOriginal), hashModified ? hexString(hashModified) : null]);
  3842. }
  3843. async _getLinearizationPage(pageIndex) {
  3844. const {
  3845. catalog,
  3846. linearization,
  3847. xref
  3848. } = this;
  3849. const ref = _primitives.Ref.get(linearization.objectNumberFirst, 0);
  3850. try {
  3851. const obj = await xref.fetchAsync(ref);
  3852. if (obj instanceof _primitives.Dict) {
  3853. let type = obj.getRaw("Type");
  3854. if (type instanceof _primitives.Ref) {
  3855. type = await xref.fetchAsync(type);
  3856. }
  3857. if ((0, _primitives.isName)(type, "Page") || !obj.has("Type") && !obj.has("Kids")) {
  3858. if (!catalog.pageKidsCountCache.has(ref)) {
  3859. catalog.pageKidsCountCache.put(ref, 1);
  3860. }
  3861. if (!catalog.pageIndexCache.has(ref)) {
  3862. catalog.pageIndexCache.put(ref, 0);
  3863. }
  3864. return [obj, ref];
  3865. }
  3866. }
  3867. throw new _util.FormatError("The Linearization dictionary doesn't point to a valid Page dictionary.");
  3868. } catch (reason) {
  3869. (0, _util.warn)(`_getLinearizationPage: "${reason.message}".`);
  3870. return catalog.getPageDict(pageIndex);
  3871. }
  3872. }
  3873. getPage(pageIndex) {
  3874. const cachedPromise = this._pagePromises.get(pageIndex);
  3875. if (cachedPromise) {
  3876. return cachedPromise;
  3877. }
  3878. const {
  3879. catalog,
  3880. linearization,
  3881. xfaFactory
  3882. } = this;
  3883. let promise;
  3884. if (xfaFactory) {
  3885. promise = Promise.resolve([_primitives.Dict.empty, null]);
  3886. } else if (linearization && linearization.pageFirst === pageIndex) {
  3887. promise = this._getLinearizationPage(pageIndex);
  3888. } else {
  3889. promise = catalog.getPageDict(pageIndex);
  3890. }
  3891. promise = promise.then(([pageDict, ref]) => {
  3892. return new Page({
  3893. pdfManager: this.pdfManager,
  3894. xref: this.xref,
  3895. pageIndex,
  3896. pageDict,
  3897. ref,
  3898. globalIdFactory: this._globalIdFactory,
  3899. fontCache: catalog.fontCache,
  3900. builtInCMapCache: catalog.builtInCMapCache,
  3901. standardFontDataCache: catalog.standardFontDataCache,
  3902. globalImageCache: catalog.globalImageCache,
  3903. nonBlendModesSet: catalog.nonBlendModesSet,
  3904. xfaFactory
  3905. });
  3906. });
  3907. this._pagePromises.set(pageIndex, promise);
  3908. return promise;
  3909. }
  3910. async checkFirstPage(recoveryMode = false) {
  3911. if (recoveryMode) {
  3912. return;
  3913. }
  3914. try {
  3915. await this.getPage(0);
  3916. } catch (reason) {
  3917. if (reason instanceof _core_utils.XRefEntryException) {
  3918. this._pagePromises.delete(0);
  3919. await this.cleanup();
  3920. throw new _core_utils.XRefParseException();
  3921. }
  3922. }
  3923. }
  3924. async checkLastPage(recoveryMode = false) {
  3925. const {
  3926. catalog,
  3927. pdfManager
  3928. } = this;
  3929. catalog.setActualNumPages();
  3930. let numPages;
  3931. try {
  3932. await Promise.all([pdfManager.ensureDoc("xfaFactory"), pdfManager.ensureDoc("linearization"), pdfManager.ensureCatalog("numPages")]);
  3933. if (this.xfaFactory) {
  3934. return;
  3935. } else if (this.linearization) {
  3936. numPages = this.linearization.numPages;
  3937. } else {
  3938. numPages = catalog.numPages;
  3939. }
  3940. if (!Number.isInteger(numPages)) {
  3941. throw new _util.FormatError("Page count is not an integer.");
  3942. } else if (numPages <= 1) {
  3943. return;
  3944. }
  3945. await this.getPage(numPages - 1);
  3946. } catch (reason) {
  3947. this._pagePromises.delete(numPages - 1);
  3948. await this.cleanup();
  3949. if (reason instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3950. throw new _core_utils.XRefParseException();
  3951. }
  3952. (0, _util.warn)(`checkLastPage - invalid /Pages tree /Count: ${numPages}.`);
  3953. let pagesTree;
  3954. try {
  3955. pagesTree = await catalog.getAllPageDicts(recoveryMode);
  3956. } catch (reasonAll) {
  3957. if (reasonAll instanceof _core_utils.XRefEntryException && !recoveryMode) {
  3958. throw new _core_utils.XRefParseException();
  3959. }
  3960. catalog.setActualNumPages(1);
  3961. return;
  3962. }
  3963. for (const [pageIndex, [pageDict, ref]] of pagesTree) {
  3964. let promise;
  3965. if (pageDict instanceof Error) {
  3966. promise = Promise.reject(pageDict);
  3967. promise.catch(() => {});
  3968. } else {
  3969. promise = Promise.resolve(new Page({
  3970. pdfManager,
  3971. xref: this.xref,
  3972. pageIndex,
  3973. pageDict,
  3974. ref,
  3975. globalIdFactory: this._globalIdFactory,
  3976. fontCache: catalog.fontCache,
  3977. builtInCMapCache: catalog.builtInCMapCache,
  3978. standardFontDataCache: catalog.standardFontDataCache,
  3979. globalImageCache: catalog.globalImageCache,
  3980. nonBlendModesSet: catalog.nonBlendModesSet,
  3981. xfaFactory: null
  3982. }));
  3983. }
  3984. this._pagePromises.set(pageIndex, promise);
  3985. }
  3986. catalog.setActualNumPages(pagesTree.size);
  3987. }
  3988. }
  3989. fontFallback(id, handler) {
  3990. return this.catalog.fontFallback(id, handler);
  3991. }
  3992. async cleanup(manuallyTriggered = false) {
  3993. return this.catalog ? this.catalog.cleanup(manuallyTriggered) : (0, _cleanup_helper.clearGlobalCaches)();
  3994. }
  3995. _collectFieldObjects(name, fieldRef, promises) {
  3996. const field = this.xref.fetchIfRef(fieldRef);
  3997. if (field.has("T")) {
  3998. const partName = (0, _util.stringToPDFString)(field.get("T"));
  3999. if (name === "") {
  4000. name = partName;
  4001. } else {
  4002. name = `${name}.${partName}`;
  4003. }
  4004. }
  4005. if (!promises.has(name)) {
  4006. promises.set(name, []);
  4007. }
  4008. promises.get(name).push(_annotation.AnnotationFactory.create(this.xref, fieldRef, this.pdfManager, this._localIdFactory, true).then(annotation => annotation && annotation.getFieldObject()).catch(function (reason) {
  4009. (0, _util.warn)(`_collectFieldObjects: "${reason}".`);
  4010. return null;
  4011. }));
  4012. if (field.has("Kids")) {
  4013. const kids = field.get("Kids");
  4014. for (const kid of kids) {
  4015. this._collectFieldObjects(name, kid, promises);
  4016. }
  4017. }
  4018. }
  4019. get fieldObjects() {
  4020. if (!this.formInfo.hasFields) {
  4021. return (0, _util.shadow)(this, "fieldObjects", Promise.resolve(null));
  4022. }
  4023. const allFields = Object.create(null);
  4024. const fieldPromises = new Map();
  4025. for (const fieldRef of this.catalog.acroForm.get("Fields")) {
  4026. this._collectFieldObjects("", fieldRef, fieldPromises);
  4027. }
  4028. const allPromises = [];
  4029. for (const [name, promises] of fieldPromises) {
  4030. allPromises.push(Promise.all(promises).then(fields => {
  4031. fields = fields.filter(field => !!field);
  4032. if (fields.length > 0) {
  4033. allFields[name] = fields;
  4034. }
  4035. }));
  4036. }
  4037. return (0, _util.shadow)(this, "fieldObjects", Promise.all(allPromises).then(() => allFields));
  4038. }
  4039. get hasJSActions() {
  4040. const promise = this.pdfManager.ensureDoc("_parseHasJSActions");
  4041. return (0, _util.shadow)(this, "hasJSActions", promise);
  4042. }
  4043. async _parseHasJSActions() {
  4044. const [catalogJsActions, fieldObjects] = await Promise.all([this.pdfManager.ensureCatalog("jsActions"), this.pdfManager.ensureDoc("fieldObjects")]);
  4045. if (catalogJsActions) {
  4046. return true;
  4047. }
  4048. if (fieldObjects) {
  4049. return Object.values(fieldObjects).some(fieldObject => fieldObject.some(object => object.actions !== null));
  4050. }
  4051. return false;
  4052. }
  4053. get calculationOrderIds() {
  4054. const acroForm = this.catalog.acroForm;
  4055. if (!acroForm || !acroForm.has("CO")) {
  4056. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4057. }
  4058. const calculationOrder = acroForm.get("CO");
  4059. if (!Array.isArray(calculationOrder) || calculationOrder.length === 0) {
  4060. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4061. }
  4062. const ids = [];
  4063. for (const id of calculationOrder) {
  4064. if (id instanceof _primitives.Ref) {
  4065. ids.push(id.toString());
  4066. }
  4067. }
  4068. if (ids.length === 0) {
  4069. return (0, _util.shadow)(this, "calculationOrderIds", null);
  4070. }
  4071. return (0, _util.shadow)(this, "calculationOrderIds", ids);
  4072. }
  4073. }
  4074. exports.PDFDocument = PDFDocument;
  4075. /***/ }),
  4076. /* 12 */
  4077. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4078. Object.defineProperty(exports, "__esModule", ({
  4079. value: true
  4080. }));
  4081. exports.getXfaFontDict = getXfaFontDict;
  4082. exports.getXfaFontName = getXfaFontName;
  4083. var _calibri_factors = __w_pdfjs_require__(13);
  4084. var _primitives = __w_pdfjs_require__(5);
  4085. var _helvetica_factors = __w_pdfjs_require__(14);
  4086. var _liberationsans_widths = __w_pdfjs_require__(15);
  4087. var _myriadpro_factors = __w_pdfjs_require__(16);
  4088. var _segoeui_factors = __w_pdfjs_require__(17);
  4089. var _core_utils = __w_pdfjs_require__(8);
  4090. var _fonts_utils = __w_pdfjs_require__(18);
  4091. const getXFAFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  4092. t["MyriadPro-Regular"] = t["PdfJS-Fallback-Regular"] = {
  4093. name: "LiberationSans-Regular",
  4094. factors: _myriadpro_factors.MyriadProRegularFactors,
  4095. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4096. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4097. metrics: _myriadpro_factors.MyriadProRegularMetrics
  4098. };
  4099. t["MyriadPro-Bold"] = t["PdfJS-Fallback-Bold"] = {
  4100. name: "LiberationSans-Bold",
  4101. factors: _myriadpro_factors.MyriadProBoldFactors,
  4102. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4103. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4104. metrics: _myriadpro_factors.MyriadProBoldMetrics
  4105. };
  4106. t["MyriadPro-It"] = t["MyriadPro-Italic"] = t["PdfJS-Fallback-Italic"] = {
  4107. name: "LiberationSans-Italic",
  4108. factors: _myriadpro_factors.MyriadProItalicFactors,
  4109. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4110. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4111. metrics: _myriadpro_factors.MyriadProItalicMetrics
  4112. };
  4113. t["MyriadPro-BoldIt"] = t["MyriadPro-BoldItalic"] = t["PdfJS-Fallback-BoldItalic"] = {
  4114. name: "LiberationSans-BoldItalic",
  4115. factors: _myriadpro_factors.MyriadProBoldItalicFactors,
  4116. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4117. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4118. metrics: _myriadpro_factors.MyriadProBoldItalicMetrics
  4119. };
  4120. t.ArialMT = t.Arial = t["Arial-Regular"] = {
  4121. name: "LiberationSans-Regular",
  4122. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4123. baseMapping: _liberationsans_widths.LiberationSansRegularMapping
  4124. };
  4125. t["Arial-BoldMT"] = t["Arial-Bold"] = {
  4126. name: "LiberationSans-Bold",
  4127. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4128. baseMapping: _liberationsans_widths.LiberationSansBoldMapping
  4129. };
  4130. t["Arial-ItalicMT"] = t["Arial-Italic"] = {
  4131. name: "LiberationSans-Italic",
  4132. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4133. baseMapping: _liberationsans_widths.LiberationSansItalicMapping
  4134. };
  4135. t["Arial-BoldItalicMT"] = t["Arial-BoldItalic"] = {
  4136. name: "LiberationSans-BoldItalic",
  4137. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4138. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping
  4139. };
  4140. t["Calibri-Regular"] = {
  4141. name: "LiberationSans-Regular",
  4142. factors: _calibri_factors.CalibriRegularFactors,
  4143. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4144. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4145. metrics: _calibri_factors.CalibriRegularMetrics
  4146. };
  4147. t["Calibri-Bold"] = {
  4148. name: "LiberationSans-Bold",
  4149. factors: _calibri_factors.CalibriBoldFactors,
  4150. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4151. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4152. metrics: _calibri_factors.CalibriBoldMetrics
  4153. };
  4154. t["Calibri-Italic"] = {
  4155. name: "LiberationSans-Italic",
  4156. factors: _calibri_factors.CalibriItalicFactors,
  4157. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4158. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4159. metrics: _calibri_factors.CalibriItalicMetrics
  4160. };
  4161. t["Calibri-BoldItalic"] = {
  4162. name: "LiberationSans-BoldItalic",
  4163. factors: _calibri_factors.CalibriBoldItalicFactors,
  4164. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4165. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4166. metrics: _calibri_factors.CalibriBoldItalicMetrics
  4167. };
  4168. t["Segoeui-Regular"] = {
  4169. name: "LiberationSans-Regular",
  4170. factors: _segoeui_factors.SegoeuiRegularFactors,
  4171. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4172. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4173. metrics: _segoeui_factors.SegoeuiRegularMetrics
  4174. };
  4175. t["Segoeui-Bold"] = {
  4176. name: "LiberationSans-Bold",
  4177. factors: _segoeui_factors.SegoeuiBoldFactors,
  4178. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4179. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4180. metrics: _segoeui_factors.SegoeuiBoldMetrics
  4181. };
  4182. t["Segoeui-Italic"] = {
  4183. name: "LiberationSans-Italic",
  4184. factors: _segoeui_factors.SegoeuiItalicFactors,
  4185. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4186. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4187. metrics: _segoeui_factors.SegoeuiItalicMetrics
  4188. };
  4189. t["Segoeui-BoldItalic"] = {
  4190. name: "LiberationSans-BoldItalic",
  4191. factors: _segoeui_factors.SegoeuiBoldItalicFactors,
  4192. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4193. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4194. metrics: _segoeui_factors.SegoeuiBoldItalicMetrics
  4195. };
  4196. t["Helvetica-Regular"] = t.Helvetica = {
  4197. name: "LiberationSans-Regular",
  4198. factors: _helvetica_factors.HelveticaRegularFactors,
  4199. baseWidths: _liberationsans_widths.LiberationSansRegularWidths,
  4200. baseMapping: _liberationsans_widths.LiberationSansRegularMapping,
  4201. metrics: _helvetica_factors.HelveticaRegularMetrics
  4202. };
  4203. t["Helvetica-Bold"] = {
  4204. name: "LiberationSans-Bold",
  4205. factors: _helvetica_factors.HelveticaBoldFactors,
  4206. baseWidths: _liberationsans_widths.LiberationSansBoldWidths,
  4207. baseMapping: _liberationsans_widths.LiberationSansBoldMapping,
  4208. metrics: _helvetica_factors.HelveticaBoldMetrics
  4209. };
  4210. t["Helvetica-Italic"] = {
  4211. name: "LiberationSans-Italic",
  4212. factors: _helvetica_factors.HelveticaItalicFactors,
  4213. baseWidths: _liberationsans_widths.LiberationSansItalicWidths,
  4214. baseMapping: _liberationsans_widths.LiberationSansItalicMapping,
  4215. metrics: _helvetica_factors.HelveticaItalicMetrics
  4216. };
  4217. t["Helvetica-BoldItalic"] = {
  4218. name: "LiberationSans-BoldItalic",
  4219. factors: _helvetica_factors.HelveticaBoldItalicFactors,
  4220. baseWidths: _liberationsans_widths.LiberationSansBoldItalicWidths,
  4221. baseMapping: _liberationsans_widths.LiberationSansBoldItalicMapping,
  4222. metrics: _helvetica_factors.HelveticaBoldItalicMetrics
  4223. };
  4224. });
  4225. function getXfaFontName(name) {
  4226. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  4227. const fontMap = getXFAFontMap();
  4228. return fontMap[fontName];
  4229. }
  4230. function getXfaFontWidths(name) {
  4231. const info = getXfaFontName(name);
  4232. if (!info) {
  4233. return null;
  4234. }
  4235. const {
  4236. baseWidths,
  4237. baseMapping,
  4238. factors
  4239. } = info;
  4240. let rescaledBaseWidths;
  4241. if (!factors) {
  4242. rescaledBaseWidths = baseWidths;
  4243. } else {
  4244. rescaledBaseWidths = baseWidths.map((w, i) => w * factors[i]);
  4245. }
  4246. let currentCode = -2;
  4247. let currentArray;
  4248. const newWidths = [];
  4249. for (const [unicode, glyphIndex] of baseMapping.map((charUnicode, index) => [charUnicode, index]).sort(([unicode1], [unicode2]) => unicode1 - unicode2)) {
  4250. if (unicode === -1) {
  4251. continue;
  4252. }
  4253. if (unicode === currentCode + 1) {
  4254. currentArray.push(rescaledBaseWidths[glyphIndex]);
  4255. currentCode += 1;
  4256. } else {
  4257. currentCode = unicode;
  4258. currentArray = [rescaledBaseWidths[glyphIndex]];
  4259. newWidths.push(unicode, currentArray);
  4260. }
  4261. }
  4262. return newWidths;
  4263. }
  4264. function getXfaFontDict(name) {
  4265. const widths = getXfaFontWidths(name);
  4266. const dict = new _primitives.Dict(null);
  4267. dict.set("BaseFont", _primitives.Name.get(name));
  4268. dict.set("Type", _primitives.Name.get("Font"));
  4269. dict.set("Subtype", _primitives.Name.get("CIDFontType2"));
  4270. dict.set("Encoding", _primitives.Name.get("Identity-H"));
  4271. dict.set("CIDToGIDMap", _primitives.Name.get("Identity"));
  4272. dict.set("W", widths);
  4273. dict.set("FirstChar", widths[0]);
  4274. dict.set("LastChar", widths[widths.length - 2] + widths[widths.length - 1].length - 1);
  4275. const descriptor = new _primitives.Dict(null);
  4276. dict.set("FontDescriptor", descriptor);
  4277. const systemInfo = new _primitives.Dict(null);
  4278. systemInfo.set("Ordering", "Identity");
  4279. systemInfo.set("Registry", "Adobe");
  4280. systemInfo.set("Supplement", 0);
  4281. dict.set("CIDSystemInfo", systemInfo);
  4282. return dict;
  4283. }
  4284. /***/ }),
  4285. /* 13 */
  4286. /***/ ((__unused_webpack_module, exports) => {
  4287. Object.defineProperty(exports, "__esModule", ({
  4288. value: true
  4289. }));
  4290. exports.CalibriRegularMetrics = exports.CalibriRegularFactors = exports.CalibriItalicMetrics = exports.CalibriItalicFactors = exports.CalibriBoldMetrics = exports.CalibriBoldItalicMetrics = exports.CalibriBoldItalicFactors = exports.CalibriBoldFactors = void 0;
  4291. 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];
  4292. exports.CalibriBoldFactors = CalibriBoldFactors;
  4293. const CalibriBoldMetrics = {
  4294. lineHeight: 1.2207,
  4295. lineGap: 0.2207
  4296. };
  4297. exports.CalibriBoldMetrics = CalibriBoldMetrics;
  4298. 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];
  4299. exports.CalibriBoldItalicFactors = CalibriBoldItalicFactors;
  4300. const CalibriBoldItalicMetrics = {
  4301. lineHeight: 1.2207,
  4302. lineGap: 0.2207
  4303. };
  4304. exports.CalibriBoldItalicMetrics = CalibriBoldItalicMetrics;
  4305. 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];
  4306. exports.CalibriItalicFactors = CalibriItalicFactors;
  4307. const CalibriItalicMetrics = {
  4308. lineHeight: 1.2207,
  4309. lineGap: 0.2207
  4310. };
  4311. exports.CalibriItalicMetrics = CalibriItalicMetrics;
  4312. 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];
  4313. exports.CalibriRegularFactors = CalibriRegularFactors;
  4314. const CalibriRegularMetrics = {
  4315. lineHeight: 1.2207,
  4316. lineGap: 0.2207
  4317. };
  4318. exports.CalibriRegularMetrics = CalibriRegularMetrics;
  4319. /***/ }),
  4320. /* 14 */
  4321. /***/ ((__unused_webpack_module, exports) => {
  4322. Object.defineProperty(exports, "__esModule", ({
  4323. value: true
  4324. }));
  4325. exports.HelveticaRegularMetrics = exports.HelveticaRegularFactors = exports.HelveticaItalicMetrics = exports.HelveticaItalicFactors = exports.HelveticaBoldMetrics = exports.HelveticaBoldItalicMetrics = exports.HelveticaBoldItalicFactors = exports.HelveticaBoldFactors = void 0;
  4326. 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];
  4327. exports.HelveticaBoldFactors = HelveticaBoldFactors;
  4328. const HelveticaBoldMetrics = {
  4329. lineHeight: 1.2,
  4330. lineGap: 0.2
  4331. };
  4332. exports.HelveticaBoldMetrics = HelveticaBoldMetrics;
  4333. 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];
  4334. exports.HelveticaBoldItalicFactors = HelveticaBoldItalicFactors;
  4335. const HelveticaBoldItalicMetrics = {
  4336. lineHeight: 1.35,
  4337. lineGap: 0.2
  4338. };
  4339. exports.HelveticaBoldItalicMetrics = HelveticaBoldItalicMetrics;
  4340. 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];
  4341. exports.HelveticaItalicFactors = HelveticaItalicFactors;
  4342. const HelveticaItalicMetrics = {
  4343. lineHeight: 1.35,
  4344. lineGap: 0.2
  4345. };
  4346. exports.HelveticaItalicMetrics = HelveticaItalicMetrics;
  4347. 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];
  4348. exports.HelveticaRegularFactors = HelveticaRegularFactors;
  4349. const HelveticaRegularMetrics = {
  4350. lineHeight: 1.2,
  4351. lineGap: 0.2
  4352. };
  4353. exports.HelveticaRegularMetrics = HelveticaRegularMetrics;
  4354. /***/ }),
  4355. /* 15 */
  4356. /***/ ((__unused_webpack_module, exports) => {
  4357. Object.defineProperty(exports, "__esModule", ({
  4358. value: true
  4359. }));
  4360. exports.LiberationSansRegularWidths = exports.LiberationSansRegularMapping = exports.LiberationSansItalicWidths = exports.LiberationSansItalicMapping = exports.LiberationSansBoldWidths = exports.LiberationSansBoldMapping = exports.LiberationSansBoldItalicWidths = exports.LiberationSansBoldItalicMapping = void 0;
  4361. 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];
  4362. exports.LiberationSansBoldWidths = LiberationSansBoldWidths;
  4363. 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];
  4364. exports.LiberationSansBoldMapping = LiberationSansBoldMapping;
  4365. 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];
  4366. exports.LiberationSansBoldItalicWidths = LiberationSansBoldItalicWidths;
  4367. 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];
  4368. exports.LiberationSansBoldItalicMapping = LiberationSansBoldItalicMapping;
  4369. 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];
  4370. exports.LiberationSansItalicWidths = LiberationSansItalicWidths;
  4371. 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];
  4372. exports.LiberationSansItalicMapping = LiberationSansItalicMapping;
  4373. 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];
  4374. exports.LiberationSansRegularWidths = LiberationSansRegularWidths;
  4375. 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];
  4376. exports.LiberationSansRegularMapping = LiberationSansRegularMapping;
  4377. /***/ }),
  4378. /* 16 */
  4379. /***/ ((__unused_webpack_module, exports) => {
  4380. Object.defineProperty(exports, "__esModule", ({
  4381. value: true
  4382. }));
  4383. exports.MyriadProRegularMetrics = exports.MyriadProRegularFactors = exports.MyriadProItalicMetrics = exports.MyriadProItalicFactors = exports.MyriadProBoldMetrics = exports.MyriadProBoldItalicMetrics = exports.MyriadProBoldItalicFactors = exports.MyriadProBoldFactors = void 0;
  4384. 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];
  4385. exports.MyriadProBoldFactors = MyriadProBoldFactors;
  4386. const MyriadProBoldMetrics = {
  4387. lineHeight: 1.2,
  4388. lineGap: 0.2
  4389. };
  4390. exports.MyriadProBoldMetrics = MyriadProBoldMetrics;
  4391. 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];
  4392. exports.MyriadProBoldItalicFactors = MyriadProBoldItalicFactors;
  4393. const MyriadProBoldItalicMetrics = {
  4394. lineHeight: 1.2,
  4395. lineGap: 0.2
  4396. };
  4397. exports.MyriadProBoldItalicMetrics = MyriadProBoldItalicMetrics;
  4398. 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];
  4399. exports.MyriadProItalicFactors = MyriadProItalicFactors;
  4400. const MyriadProItalicMetrics = {
  4401. lineHeight: 1.2,
  4402. lineGap: 0.2
  4403. };
  4404. exports.MyriadProItalicMetrics = MyriadProItalicMetrics;
  4405. 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];
  4406. exports.MyriadProRegularFactors = MyriadProRegularFactors;
  4407. const MyriadProRegularMetrics = {
  4408. lineHeight: 1.2,
  4409. lineGap: 0.2
  4410. };
  4411. exports.MyriadProRegularMetrics = MyriadProRegularMetrics;
  4412. /***/ }),
  4413. /* 17 */
  4414. /***/ ((__unused_webpack_module, exports) => {
  4415. Object.defineProperty(exports, "__esModule", ({
  4416. value: true
  4417. }));
  4418. exports.SegoeuiRegularMetrics = exports.SegoeuiRegularFactors = exports.SegoeuiItalicMetrics = exports.SegoeuiItalicFactors = exports.SegoeuiBoldMetrics = exports.SegoeuiBoldItalicMetrics = exports.SegoeuiBoldItalicFactors = exports.SegoeuiBoldFactors = void 0;
  4419. 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];
  4420. exports.SegoeuiBoldFactors = SegoeuiBoldFactors;
  4421. const SegoeuiBoldMetrics = {
  4422. lineHeight: 1.33008,
  4423. lineGap: 0
  4424. };
  4425. exports.SegoeuiBoldMetrics = SegoeuiBoldMetrics;
  4426. 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];
  4427. exports.SegoeuiBoldItalicFactors = SegoeuiBoldItalicFactors;
  4428. const SegoeuiBoldItalicMetrics = {
  4429. lineHeight: 1.33008,
  4430. lineGap: 0
  4431. };
  4432. exports.SegoeuiBoldItalicMetrics = SegoeuiBoldItalicMetrics;
  4433. 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];
  4434. exports.SegoeuiItalicFactors = SegoeuiItalicFactors;
  4435. const SegoeuiItalicMetrics = {
  4436. lineHeight: 1.33008,
  4437. lineGap: 0
  4438. };
  4439. exports.SegoeuiItalicMetrics = SegoeuiItalicMetrics;
  4440. 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];
  4441. exports.SegoeuiRegularFactors = SegoeuiRegularFactors;
  4442. const SegoeuiRegularMetrics = {
  4443. lineHeight: 1.33008,
  4444. lineGap: 0
  4445. };
  4446. exports.SegoeuiRegularMetrics = SegoeuiRegularMetrics;
  4447. /***/ }),
  4448. /* 18 */
  4449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  4450. Object.defineProperty(exports, "__esModule", ({
  4451. value: true
  4452. }));
  4453. exports.SEAC_ANALYSIS_ENABLED = exports.MacStandardGlyphOrdering = exports.FontFlags = void 0;
  4454. exports.getFontType = getFontType;
  4455. exports.normalizeFontName = normalizeFontName;
  4456. exports.recoverGlyphName = recoverGlyphName;
  4457. exports.type1FontGlyphMapping = type1FontGlyphMapping;
  4458. var _util = __w_pdfjs_require__(2);
  4459. var _encodings = __w_pdfjs_require__(19);
  4460. var _glyphlist = __w_pdfjs_require__(20);
  4461. var _unicode = __w_pdfjs_require__(21);
  4462. const SEAC_ANALYSIS_ENABLED = true;
  4463. exports.SEAC_ANALYSIS_ENABLED = SEAC_ANALYSIS_ENABLED;
  4464. const FontFlags = {
  4465. FixedPitch: 1,
  4466. Serif: 2,
  4467. Symbolic: 4,
  4468. Script: 8,
  4469. Nonsymbolic: 32,
  4470. Italic: 64,
  4471. AllCap: 65536,
  4472. SmallCap: 131072,
  4473. ForceBold: 262144
  4474. };
  4475. exports.FontFlags = FontFlags;
  4476. 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"];
  4477. exports.MacStandardGlyphOrdering = MacStandardGlyphOrdering;
  4478. function getFontType(type, subtype, isStandardFont = false) {
  4479. switch (type) {
  4480. case "Type1":
  4481. if (isStandardFont) {
  4482. return _util.FontType.TYPE1STANDARD;
  4483. }
  4484. return subtype === "Type1C" ? _util.FontType.TYPE1C : _util.FontType.TYPE1;
  4485. case "CIDFontType0":
  4486. return subtype === "CIDFontType0C" ? _util.FontType.CIDFONTTYPE0C : _util.FontType.CIDFONTTYPE0;
  4487. case "OpenType":
  4488. return _util.FontType.OPENTYPE;
  4489. case "TrueType":
  4490. return _util.FontType.TRUETYPE;
  4491. case "CIDFontType2":
  4492. return _util.FontType.CIDFONTTYPE2;
  4493. case "MMType1":
  4494. return _util.FontType.MMTYPE1;
  4495. case "Type0":
  4496. return _util.FontType.TYPE0;
  4497. default:
  4498. return _util.FontType.UNKNOWN;
  4499. }
  4500. }
  4501. function recoverGlyphName(name, glyphsUnicodeMap) {
  4502. if (glyphsUnicodeMap[name] !== undefined) {
  4503. return name;
  4504. }
  4505. const unicode = (0, _unicode.getUnicodeForGlyph)(name, glyphsUnicodeMap);
  4506. if (unicode !== -1) {
  4507. for (const key in glyphsUnicodeMap) {
  4508. if (glyphsUnicodeMap[key] === unicode) {
  4509. return key;
  4510. }
  4511. }
  4512. }
  4513. (0, _util.info)("Unable to recover a standard glyph name for: " + name);
  4514. return name;
  4515. }
  4516. function type1FontGlyphMapping(properties, builtInEncoding, glyphNames) {
  4517. const charCodeToGlyphId = Object.create(null);
  4518. let glyphId, charCode, baseEncoding;
  4519. const isSymbolicFont = !!(properties.flags & FontFlags.Symbolic);
  4520. if (properties.isInternalFont) {
  4521. baseEncoding = builtInEncoding;
  4522. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4523. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4524. if (glyphId >= 0) {
  4525. charCodeToGlyphId[charCode] = glyphId;
  4526. } else {
  4527. charCodeToGlyphId[charCode] = 0;
  4528. }
  4529. }
  4530. } else if (properties.baseEncodingName) {
  4531. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  4532. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4533. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4534. if (glyphId >= 0) {
  4535. charCodeToGlyphId[charCode] = glyphId;
  4536. } else {
  4537. charCodeToGlyphId[charCode] = 0;
  4538. }
  4539. }
  4540. } else if (isSymbolicFont) {
  4541. for (charCode in builtInEncoding) {
  4542. charCodeToGlyphId[charCode] = builtInEncoding[charCode];
  4543. }
  4544. } else {
  4545. baseEncoding = _encodings.StandardEncoding;
  4546. for (charCode = 0; charCode < baseEncoding.length; charCode++) {
  4547. glyphId = glyphNames.indexOf(baseEncoding[charCode]);
  4548. if (glyphId >= 0) {
  4549. charCodeToGlyphId[charCode] = glyphId;
  4550. } else {
  4551. charCodeToGlyphId[charCode] = 0;
  4552. }
  4553. }
  4554. }
  4555. const differences = properties.differences;
  4556. let glyphsUnicodeMap;
  4557. if (differences) {
  4558. for (charCode in differences) {
  4559. const glyphName = differences[charCode];
  4560. glyphId = glyphNames.indexOf(glyphName);
  4561. if (glyphId === -1) {
  4562. if (!glyphsUnicodeMap) {
  4563. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  4564. }
  4565. const standardGlyphName = recoverGlyphName(glyphName, glyphsUnicodeMap);
  4566. if (standardGlyphName !== glyphName) {
  4567. glyphId = glyphNames.indexOf(standardGlyphName);
  4568. }
  4569. }
  4570. if (glyphId >= 0) {
  4571. charCodeToGlyphId[charCode] = glyphId;
  4572. } else {
  4573. charCodeToGlyphId[charCode] = 0;
  4574. }
  4575. }
  4576. }
  4577. return charCodeToGlyphId;
  4578. }
  4579. function normalizeFontName(name) {
  4580. return name.replace(/[,_]/g, "-").replace(/\s/g, "");
  4581. }
  4582. /***/ }),
  4583. /* 19 */
  4584. /***/ ((__unused_webpack_module, exports) => {
  4585. Object.defineProperty(exports, "__esModule", ({
  4586. value: true
  4587. }));
  4588. exports.ZapfDingbatsEncoding = exports.WinAnsiEncoding = exports.SymbolSetEncoding = exports.StandardEncoding = exports.MacRomanEncoding = exports.ExpertEncoding = void 0;
  4589. exports.getEncoding = getEncoding;
  4590. 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"];
  4591. exports.ExpertEncoding = ExpertEncoding;
  4592. 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", "", "", "", ""];
  4593. 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"];
  4594. exports.MacRomanEncoding = MacRomanEncoding;
  4595. 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", "", "", "", ""];
  4596. exports.StandardEncoding = StandardEncoding;
  4597. 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"];
  4598. exports.WinAnsiEncoding = WinAnsiEncoding;
  4599. 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", ""];
  4600. exports.SymbolSetEncoding = SymbolSetEncoding;
  4601. 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", ""];
  4602. exports.ZapfDingbatsEncoding = ZapfDingbatsEncoding;
  4603. function getEncoding(encodingName) {
  4604. switch (encodingName) {
  4605. case "WinAnsiEncoding":
  4606. return WinAnsiEncoding;
  4607. case "StandardEncoding":
  4608. return StandardEncoding;
  4609. case "MacRomanEncoding":
  4610. return MacRomanEncoding;
  4611. case "SymbolSetEncoding":
  4612. return SymbolSetEncoding;
  4613. case "ZapfDingbatsEncoding":
  4614. return ZapfDingbatsEncoding;
  4615. case "ExpertEncoding":
  4616. return ExpertEncoding;
  4617. case "MacExpertEncoding":
  4618. return MacExpertEncoding;
  4619. default:
  4620. return null;
  4621. }
  4622. }
  4623. /***/ }),
  4624. /* 20 */
  4625. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  4626. __w_pdfjs_require__.r(__webpack_exports__);
  4627. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  4628. /* harmony export */ "getDingbatsGlyphsUnicode": () => (/* binding */ getDingbatsGlyphsUnicode),
  4629. /* harmony export */ "getGlyphsUnicode": () => (/* binding */ getGlyphsUnicode)
  4630. /* harmony export */ });
  4631. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  4632. const getGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  4633. return [
  4634. "A",
  4635. 0x0041,
  4636. "AE",
  4637. 0x00c6,
  4638. "AEacute",
  4639. 0x01fc,
  4640. "AEmacron",
  4641. 0x01e2,
  4642. "AEsmall",
  4643. 0xf7e6,
  4644. "Aacute",
  4645. 0x00c1,
  4646. "Aacutesmall",
  4647. 0xf7e1,
  4648. "Abreve",
  4649. 0x0102,
  4650. "Abreveacute",
  4651. 0x1eae,
  4652. "Abrevecyrillic",
  4653. 0x04d0,
  4654. "Abrevedotbelow",
  4655. 0x1eb6,
  4656. "Abrevegrave",
  4657. 0x1eb0,
  4658. "Abrevehookabove",
  4659. 0x1eb2,
  4660. "Abrevetilde",
  4661. 0x1eb4,
  4662. "Acaron",
  4663. 0x01cd,
  4664. "Acircle",
  4665. 0x24b6,
  4666. "Acircumflex",
  4667. 0x00c2,
  4668. "Acircumflexacute",
  4669. 0x1ea4,
  4670. "Acircumflexdotbelow",
  4671. 0x1eac,
  4672. "Acircumflexgrave",
  4673. 0x1ea6,
  4674. "Acircumflexhookabove",
  4675. 0x1ea8,
  4676. "Acircumflexsmall",
  4677. 0xf7e2,
  4678. "Acircumflextilde",
  4679. 0x1eaa,
  4680. "Acute",
  4681. 0xf6c9,
  4682. "Acutesmall",
  4683. 0xf7b4,
  4684. "Acyrillic",
  4685. 0x0410,
  4686. "Adblgrave",
  4687. 0x0200,
  4688. "Adieresis",
  4689. 0x00c4,
  4690. "Adieresiscyrillic",
  4691. 0x04d2,
  4692. "Adieresismacron",
  4693. 0x01de,
  4694. "Adieresissmall",
  4695. 0xf7e4,
  4696. "Adotbelow",
  4697. 0x1ea0,
  4698. "Adotmacron",
  4699. 0x01e0,
  4700. "Agrave",
  4701. 0x00c0,
  4702. "Agravesmall",
  4703. 0xf7e0,
  4704. "Ahookabove",
  4705. 0x1ea2,
  4706. "Aiecyrillic",
  4707. 0x04d4,
  4708. "Ainvertedbreve",
  4709. 0x0202,
  4710. "Alpha",
  4711. 0x0391,
  4712. "Alphatonos",
  4713. 0x0386,
  4714. "Amacron",
  4715. 0x0100,
  4716. "Amonospace",
  4717. 0xff21,
  4718. "Aogonek",
  4719. 0x0104,
  4720. "Aring",
  4721. 0x00c5,
  4722. "Aringacute",
  4723. 0x01fa,
  4724. "Aringbelow",
  4725. 0x1e00,
  4726. "Aringsmall",
  4727. 0xf7e5,
  4728. "Asmall",
  4729. 0xf761,
  4730. "Atilde",
  4731. 0x00c3,
  4732. "Atildesmall",
  4733. 0xf7e3,
  4734. "Aybarmenian",
  4735. 0x0531,
  4736. "B",
  4737. 0x0042,
  4738. "Bcircle",
  4739. 0x24b7,
  4740. "Bdotaccent",
  4741. 0x1e02,
  4742. "Bdotbelow",
  4743. 0x1e04,
  4744. "Becyrillic",
  4745. 0x0411,
  4746. "Benarmenian",
  4747. 0x0532,
  4748. "Beta",
  4749. 0x0392,
  4750. "Bhook",
  4751. 0x0181,
  4752. "Blinebelow",
  4753. 0x1e06,
  4754. "Bmonospace",
  4755. 0xff22,
  4756. "Brevesmall",
  4757. 0xf6f4,
  4758. "Bsmall",
  4759. 0xf762,
  4760. "Btopbar",
  4761. 0x0182,
  4762. "C",
  4763. 0x0043,
  4764. "Caarmenian",
  4765. 0x053e,
  4766. "Cacute",
  4767. 0x0106,
  4768. "Caron",
  4769. 0xf6ca,
  4770. "Caronsmall",
  4771. 0xf6f5,
  4772. "Ccaron",
  4773. 0x010c,
  4774. "Ccedilla",
  4775. 0x00c7,
  4776. "Ccedillaacute",
  4777. 0x1e08,
  4778. "Ccedillasmall",
  4779. 0xf7e7,
  4780. "Ccircle",
  4781. 0x24b8,
  4782. "Ccircumflex",
  4783. 0x0108,
  4784. "Cdot",
  4785. 0x010a,
  4786. "Cdotaccent",
  4787. 0x010a,
  4788. "Cedillasmall",
  4789. 0xf7b8,
  4790. "Chaarmenian",
  4791. 0x0549,
  4792. "Cheabkhasiancyrillic",
  4793. 0x04bc,
  4794. "Checyrillic",
  4795. 0x0427,
  4796. "Chedescenderabkhasiancyrillic",
  4797. 0x04be,
  4798. "Chedescendercyrillic",
  4799. 0x04b6,
  4800. "Chedieresiscyrillic",
  4801. 0x04f4,
  4802. "Cheharmenian",
  4803. 0x0543,
  4804. "Chekhakassiancyrillic",
  4805. 0x04cb,
  4806. "Cheverticalstrokecyrillic",
  4807. 0x04b8,
  4808. "Chi",
  4809. 0x03a7,
  4810. "Chook",
  4811. 0x0187,
  4812. "Circumflexsmall",
  4813. 0xf6f6,
  4814. "Cmonospace",
  4815. 0xff23,
  4816. "Coarmenian",
  4817. 0x0551,
  4818. "Csmall",
  4819. 0xf763,
  4820. "D",
  4821. 0x0044,
  4822. "DZ",
  4823. 0x01f1,
  4824. "DZcaron",
  4825. 0x01c4,
  4826. "Daarmenian",
  4827. 0x0534,
  4828. "Dafrican",
  4829. 0x0189,
  4830. "Dcaron",
  4831. 0x010e,
  4832. "Dcedilla",
  4833. 0x1e10,
  4834. "Dcircle",
  4835. 0x24b9,
  4836. "Dcircumflexbelow",
  4837. 0x1e12,
  4838. "Dcroat",
  4839. 0x0110,
  4840. "Ddotaccent",
  4841. 0x1e0a,
  4842. "Ddotbelow",
  4843. 0x1e0c,
  4844. "Decyrillic",
  4845. 0x0414,
  4846. "Deicoptic",
  4847. 0x03ee,
  4848. "Delta",
  4849. 0x2206,
  4850. "Deltagreek",
  4851. 0x0394,
  4852. "Dhook",
  4853. 0x018a,
  4854. "Dieresis",
  4855. 0xf6cb,
  4856. "DieresisAcute",
  4857. 0xf6cc,
  4858. "DieresisGrave",
  4859. 0xf6cd,
  4860. "Dieresissmall",
  4861. 0xf7a8,
  4862. "Digammagreek",
  4863. 0x03dc,
  4864. "Djecyrillic",
  4865. 0x0402,
  4866. "Dlinebelow",
  4867. 0x1e0e,
  4868. "Dmonospace",
  4869. 0xff24,
  4870. "Dotaccentsmall",
  4871. 0xf6f7,
  4872. "Dslash",
  4873. 0x0110,
  4874. "Dsmall",
  4875. 0xf764,
  4876. "Dtopbar",
  4877. 0x018b,
  4878. "Dz",
  4879. 0x01f2,
  4880. "Dzcaron",
  4881. 0x01c5,
  4882. "Dzeabkhasiancyrillic",
  4883. 0x04e0,
  4884. "Dzecyrillic",
  4885. 0x0405,
  4886. "Dzhecyrillic",
  4887. 0x040f,
  4888. "E",
  4889. 0x0045,
  4890. "Eacute",
  4891. 0x00c9,
  4892. "Eacutesmall",
  4893. 0xf7e9,
  4894. "Ebreve",
  4895. 0x0114,
  4896. "Ecaron",
  4897. 0x011a,
  4898. "Ecedillabreve",
  4899. 0x1e1c,
  4900. "Echarmenian",
  4901. 0x0535,
  4902. "Ecircle",
  4903. 0x24ba,
  4904. "Ecircumflex",
  4905. 0x00ca,
  4906. "Ecircumflexacute",
  4907. 0x1ebe,
  4908. "Ecircumflexbelow",
  4909. 0x1e18,
  4910. "Ecircumflexdotbelow",
  4911. 0x1ec6,
  4912. "Ecircumflexgrave",
  4913. 0x1ec0,
  4914. "Ecircumflexhookabove",
  4915. 0x1ec2,
  4916. "Ecircumflexsmall",
  4917. 0xf7ea,
  4918. "Ecircumflextilde",
  4919. 0x1ec4,
  4920. "Ecyrillic",
  4921. 0x0404,
  4922. "Edblgrave",
  4923. 0x0204,
  4924. "Edieresis",
  4925. 0x00cb,
  4926. "Edieresissmall",
  4927. 0xf7eb,
  4928. "Edot",
  4929. 0x0116,
  4930. "Edotaccent",
  4931. 0x0116,
  4932. "Edotbelow",
  4933. 0x1eb8,
  4934. "Efcyrillic",
  4935. 0x0424,
  4936. "Egrave",
  4937. 0x00c8,
  4938. "Egravesmall",
  4939. 0xf7e8,
  4940. "Eharmenian",
  4941. 0x0537,
  4942. "Ehookabove",
  4943. 0x1eba,
  4944. "Eightroman",
  4945. 0x2167,
  4946. "Einvertedbreve",
  4947. 0x0206,
  4948. "Eiotifiedcyrillic",
  4949. 0x0464,
  4950. "Elcyrillic",
  4951. 0x041b,
  4952. "Elevenroman",
  4953. 0x216a,
  4954. "Emacron",
  4955. 0x0112,
  4956. "Emacronacute",
  4957. 0x1e16,
  4958. "Emacrongrave",
  4959. 0x1e14,
  4960. "Emcyrillic",
  4961. 0x041c,
  4962. "Emonospace",
  4963. 0xff25,
  4964. "Encyrillic",
  4965. 0x041d,
  4966. "Endescendercyrillic",
  4967. 0x04a2,
  4968. "Eng",
  4969. 0x014a,
  4970. "Enghecyrillic",
  4971. 0x04a4,
  4972. "Enhookcyrillic",
  4973. 0x04c7,
  4974. "Eogonek",
  4975. 0x0118,
  4976. "Eopen",
  4977. 0x0190,
  4978. "Epsilon",
  4979. 0x0395,
  4980. "Epsilontonos",
  4981. 0x0388,
  4982. "Ercyrillic",
  4983. 0x0420,
  4984. "Ereversed",
  4985. 0x018e,
  4986. "Ereversedcyrillic",
  4987. 0x042d,
  4988. "Escyrillic",
  4989. 0x0421,
  4990. "Esdescendercyrillic",
  4991. 0x04aa,
  4992. "Esh",
  4993. 0x01a9,
  4994. "Esmall",
  4995. 0xf765,
  4996. "Eta",
  4997. 0x0397,
  4998. "Etarmenian",
  4999. 0x0538,
  5000. "Etatonos",
  5001. 0x0389,
  5002. "Eth",
  5003. 0x00d0,
  5004. "Ethsmall",
  5005. 0xf7f0,
  5006. "Etilde",
  5007. 0x1ebc,
  5008. "Etildebelow",
  5009. 0x1e1a,
  5010. "Euro",
  5011. 0x20ac,
  5012. "Ezh",
  5013. 0x01b7,
  5014. "Ezhcaron",
  5015. 0x01ee,
  5016. "Ezhreversed",
  5017. 0x01b8,
  5018. "F",
  5019. 0x0046,
  5020. "Fcircle",
  5021. 0x24bb,
  5022. "Fdotaccent",
  5023. 0x1e1e,
  5024. "Feharmenian",
  5025. 0x0556,
  5026. "Feicoptic",
  5027. 0x03e4,
  5028. "Fhook",
  5029. 0x0191,
  5030. "Fitacyrillic",
  5031. 0x0472,
  5032. "Fiveroman",
  5033. 0x2164,
  5034. "Fmonospace",
  5035. 0xff26,
  5036. "Fourroman",
  5037. 0x2163,
  5038. "Fsmall",
  5039. 0xf766,
  5040. "G",
  5041. 0x0047,
  5042. "GBsquare",
  5043. 0x3387,
  5044. "Gacute",
  5045. 0x01f4,
  5046. "Gamma",
  5047. 0x0393,
  5048. "Gammaafrican",
  5049. 0x0194,
  5050. "Gangiacoptic",
  5051. 0x03ea,
  5052. "Gbreve",
  5053. 0x011e,
  5054. "Gcaron",
  5055. 0x01e6,
  5056. "Gcedilla",
  5057. 0x0122,
  5058. "Gcircle",
  5059. 0x24bc,
  5060. "Gcircumflex",
  5061. 0x011c,
  5062. "Gcommaaccent",
  5063. 0x0122,
  5064. "Gdot",
  5065. 0x0120,
  5066. "Gdotaccent",
  5067. 0x0120,
  5068. "Gecyrillic",
  5069. 0x0413,
  5070. "Ghadarmenian",
  5071. 0x0542,
  5072. "Ghemiddlehookcyrillic",
  5073. 0x0494,
  5074. "Ghestrokecyrillic",
  5075. 0x0492,
  5076. "Gheupturncyrillic",
  5077. 0x0490,
  5078. "Ghook",
  5079. 0x0193,
  5080. "Gimarmenian",
  5081. 0x0533,
  5082. "Gjecyrillic",
  5083. 0x0403,
  5084. "Gmacron",
  5085. 0x1e20,
  5086. "Gmonospace",
  5087. 0xff27,
  5088. "Grave",
  5089. 0xf6ce,
  5090. "Gravesmall",
  5091. 0xf760,
  5092. "Gsmall",
  5093. 0xf767,
  5094. "Gsmallhook",
  5095. 0x029b,
  5096. "Gstroke",
  5097. 0x01e4,
  5098. "H",
  5099. 0x0048,
  5100. "H18533",
  5101. 0x25cf,
  5102. "H18543",
  5103. 0x25aa,
  5104. "H18551",
  5105. 0x25ab,
  5106. "H22073",
  5107. 0x25a1,
  5108. "HPsquare",
  5109. 0x33cb,
  5110. "Haabkhasiancyrillic",
  5111. 0x04a8,
  5112. "Hadescendercyrillic",
  5113. 0x04b2,
  5114. "Hardsigncyrillic",
  5115. 0x042a,
  5116. "Hbar",
  5117. 0x0126,
  5118. "Hbrevebelow",
  5119. 0x1e2a,
  5120. "Hcedilla",
  5121. 0x1e28,
  5122. "Hcircle",
  5123. 0x24bd,
  5124. "Hcircumflex",
  5125. 0x0124,
  5126. "Hdieresis",
  5127. 0x1e26,
  5128. "Hdotaccent",
  5129. 0x1e22,
  5130. "Hdotbelow",
  5131. 0x1e24,
  5132. "Hmonospace",
  5133. 0xff28,
  5134. "Hoarmenian",
  5135. 0x0540,
  5136. "Horicoptic",
  5137. 0x03e8,
  5138. "Hsmall",
  5139. 0xf768,
  5140. "Hungarumlaut",
  5141. 0xf6cf,
  5142. "Hungarumlautsmall",
  5143. 0xf6f8,
  5144. "Hzsquare",
  5145. 0x3390,
  5146. "I",
  5147. 0x0049,
  5148. "IAcyrillic",
  5149. 0x042f,
  5150. "IJ",
  5151. 0x0132,
  5152. "IUcyrillic",
  5153. 0x042e,
  5154. "Iacute",
  5155. 0x00cd,
  5156. "Iacutesmall",
  5157. 0xf7ed,
  5158. "Ibreve",
  5159. 0x012c,
  5160. "Icaron",
  5161. 0x01cf,
  5162. "Icircle",
  5163. 0x24be,
  5164. "Icircumflex",
  5165. 0x00ce,
  5166. "Icircumflexsmall",
  5167. 0xf7ee,
  5168. "Icyrillic",
  5169. 0x0406,
  5170. "Idblgrave",
  5171. 0x0208,
  5172. "Idieresis",
  5173. 0x00cf,
  5174. "Idieresisacute",
  5175. 0x1e2e,
  5176. "Idieresiscyrillic",
  5177. 0x04e4,
  5178. "Idieresissmall",
  5179. 0xf7ef,
  5180. "Idot",
  5181. 0x0130,
  5182. "Idotaccent",
  5183. 0x0130,
  5184. "Idotbelow",
  5185. 0x1eca,
  5186. "Iebrevecyrillic",
  5187. 0x04d6,
  5188. "Iecyrillic",
  5189. 0x0415,
  5190. "Ifraktur",
  5191. 0x2111,
  5192. "Igrave",
  5193. 0x00cc,
  5194. "Igravesmall",
  5195. 0xf7ec,
  5196. "Ihookabove",
  5197. 0x1ec8,
  5198. "Iicyrillic",
  5199. 0x0418,
  5200. "Iinvertedbreve",
  5201. 0x020a,
  5202. "Iishortcyrillic",
  5203. 0x0419,
  5204. "Imacron",
  5205. 0x012a,
  5206. "Imacroncyrillic",
  5207. 0x04e2,
  5208. "Imonospace",
  5209. 0xff29,
  5210. "Iniarmenian",
  5211. 0x053b,
  5212. "Iocyrillic",
  5213. 0x0401,
  5214. "Iogonek",
  5215. 0x012e,
  5216. "Iota",
  5217. 0x0399,
  5218. "Iotaafrican",
  5219. 0x0196,
  5220. "Iotadieresis",
  5221. 0x03aa,
  5222. "Iotatonos",
  5223. 0x038a,
  5224. "Ismall",
  5225. 0xf769,
  5226. "Istroke",
  5227. 0x0197,
  5228. "Itilde",
  5229. 0x0128,
  5230. "Itildebelow",
  5231. 0x1e2c,
  5232. "Izhitsacyrillic",
  5233. 0x0474,
  5234. "Izhitsadblgravecyrillic",
  5235. 0x0476,
  5236. "J",
  5237. 0x004a,
  5238. "Jaarmenian",
  5239. 0x0541,
  5240. "Jcircle",
  5241. 0x24bf,
  5242. "Jcircumflex",
  5243. 0x0134,
  5244. "Jecyrillic",
  5245. 0x0408,
  5246. "Jheharmenian",
  5247. 0x054b,
  5248. "Jmonospace",
  5249. 0xff2a,
  5250. "Jsmall",
  5251. 0xf76a,
  5252. "K",
  5253. 0x004b,
  5254. "KBsquare",
  5255. 0x3385,
  5256. "KKsquare",
  5257. 0x33cd,
  5258. "Kabashkircyrillic",
  5259. 0x04a0,
  5260. "Kacute",
  5261. 0x1e30,
  5262. "Kacyrillic",
  5263. 0x041a,
  5264. "Kadescendercyrillic",
  5265. 0x049a,
  5266. "Kahookcyrillic",
  5267. 0x04c3,
  5268. "Kappa",
  5269. 0x039a,
  5270. "Kastrokecyrillic",
  5271. 0x049e,
  5272. "Kaverticalstrokecyrillic",
  5273. 0x049c,
  5274. "Kcaron",
  5275. 0x01e8,
  5276. "Kcedilla",
  5277. 0x0136,
  5278. "Kcircle",
  5279. 0x24c0,
  5280. "Kcommaaccent",
  5281. 0x0136,
  5282. "Kdotbelow",
  5283. 0x1e32,
  5284. "Keharmenian",
  5285. 0x0554,
  5286. "Kenarmenian",
  5287. 0x053f,
  5288. "Khacyrillic",
  5289. 0x0425,
  5290. "Kheicoptic",
  5291. 0x03e6,
  5292. "Khook",
  5293. 0x0198,
  5294. "Kjecyrillic",
  5295. 0x040c,
  5296. "Klinebelow",
  5297. 0x1e34,
  5298. "Kmonospace",
  5299. 0xff2b,
  5300. "Koppacyrillic",
  5301. 0x0480,
  5302. "Koppagreek",
  5303. 0x03de,
  5304. "Ksicyrillic",
  5305. 0x046e,
  5306. "Ksmall",
  5307. 0xf76b,
  5308. "L",
  5309. 0x004c,
  5310. "LJ",
  5311. 0x01c7,
  5312. "LL",
  5313. 0xf6bf,
  5314. "Lacute",
  5315. 0x0139,
  5316. "Lambda",
  5317. 0x039b,
  5318. "Lcaron",
  5319. 0x013d,
  5320. "Lcedilla",
  5321. 0x013b,
  5322. "Lcircle",
  5323. 0x24c1,
  5324. "Lcircumflexbelow",
  5325. 0x1e3c,
  5326. "Lcommaaccent",
  5327. 0x013b,
  5328. "Ldot",
  5329. 0x013f,
  5330. "Ldotaccent",
  5331. 0x013f,
  5332. "Ldotbelow",
  5333. 0x1e36,
  5334. "Ldotbelowmacron",
  5335. 0x1e38,
  5336. "Liwnarmenian",
  5337. 0x053c,
  5338. "Lj",
  5339. 0x01c8,
  5340. "Ljecyrillic",
  5341. 0x0409,
  5342. "Llinebelow",
  5343. 0x1e3a,
  5344. "Lmonospace",
  5345. 0xff2c,
  5346. "Lslash",
  5347. 0x0141,
  5348. "Lslashsmall",
  5349. 0xf6f9,
  5350. "Lsmall",
  5351. 0xf76c,
  5352. "M",
  5353. 0x004d,
  5354. "MBsquare",
  5355. 0x3386,
  5356. "Macron",
  5357. 0xf6d0,
  5358. "Macronsmall",
  5359. 0xf7af,
  5360. "Macute",
  5361. 0x1e3e,
  5362. "Mcircle",
  5363. 0x24c2,
  5364. "Mdotaccent",
  5365. 0x1e40,
  5366. "Mdotbelow",
  5367. 0x1e42,
  5368. "Menarmenian",
  5369. 0x0544,
  5370. "Mmonospace",
  5371. 0xff2d,
  5372. "Msmall",
  5373. 0xf76d,
  5374. "Mturned",
  5375. 0x019c,
  5376. "Mu",
  5377. 0x039c,
  5378. "N",
  5379. 0x004e,
  5380. "NJ",
  5381. 0x01ca,
  5382. "Nacute",
  5383. 0x0143,
  5384. "Ncaron",
  5385. 0x0147,
  5386. "Ncedilla",
  5387. 0x0145,
  5388. "Ncircle",
  5389. 0x24c3,
  5390. "Ncircumflexbelow",
  5391. 0x1e4a,
  5392. "Ncommaaccent",
  5393. 0x0145,
  5394. "Ndotaccent",
  5395. 0x1e44,
  5396. "Ndotbelow",
  5397. 0x1e46,
  5398. "Nhookleft",
  5399. 0x019d,
  5400. "Nineroman",
  5401. 0x2168,
  5402. "Nj",
  5403. 0x01cb,
  5404. "Njecyrillic",
  5405. 0x040a,
  5406. "Nlinebelow",
  5407. 0x1e48,
  5408. "Nmonospace",
  5409. 0xff2e,
  5410. "Nowarmenian",
  5411. 0x0546,
  5412. "Nsmall",
  5413. 0xf76e,
  5414. "Ntilde",
  5415. 0x00d1,
  5416. "Ntildesmall",
  5417. 0xf7f1,
  5418. "Nu",
  5419. 0x039d,
  5420. "O",
  5421. 0x004f,
  5422. "OE",
  5423. 0x0152,
  5424. "OEsmall",
  5425. 0xf6fa,
  5426. "Oacute",
  5427. 0x00d3,
  5428. "Oacutesmall",
  5429. 0xf7f3,
  5430. "Obarredcyrillic",
  5431. 0x04e8,
  5432. "Obarreddieresiscyrillic",
  5433. 0x04ea,
  5434. "Obreve",
  5435. 0x014e,
  5436. "Ocaron",
  5437. 0x01d1,
  5438. "Ocenteredtilde",
  5439. 0x019f,
  5440. "Ocircle",
  5441. 0x24c4,
  5442. "Ocircumflex",
  5443. 0x00d4,
  5444. "Ocircumflexacute",
  5445. 0x1ed0,
  5446. "Ocircumflexdotbelow",
  5447. 0x1ed8,
  5448. "Ocircumflexgrave",
  5449. 0x1ed2,
  5450. "Ocircumflexhookabove",
  5451. 0x1ed4,
  5452. "Ocircumflexsmall",
  5453. 0xf7f4,
  5454. "Ocircumflextilde",
  5455. 0x1ed6,
  5456. "Ocyrillic",
  5457. 0x041e,
  5458. "Odblacute",
  5459. 0x0150,
  5460. "Odblgrave",
  5461. 0x020c,
  5462. "Odieresis",
  5463. 0x00d6,
  5464. "Odieresiscyrillic",
  5465. 0x04e6,
  5466. "Odieresissmall",
  5467. 0xf7f6,
  5468. "Odotbelow",
  5469. 0x1ecc,
  5470. "Ogoneksmall",
  5471. 0xf6fb,
  5472. "Ograve",
  5473. 0x00d2,
  5474. "Ogravesmall",
  5475. 0xf7f2,
  5476. "Oharmenian",
  5477. 0x0555,
  5478. "Ohm",
  5479. 0x2126,
  5480. "Ohookabove",
  5481. 0x1ece,
  5482. "Ohorn",
  5483. 0x01a0,
  5484. "Ohornacute",
  5485. 0x1eda,
  5486. "Ohorndotbelow",
  5487. 0x1ee2,
  5488. "Ohorngrave",
  5489. 0x1edc,
  5490. "Ohornhookabove",
  5491. 0x1ede,
  5492. "Ohorntilde",
  5493. 0x1ee0,
  5494. "Ohungarumlaut",
  5495. 0x0150,
  5496. "Oi",
  5497. 0x01a2,
  5498. "Oinvertedbreve",
  5499. 0x020e,
  5500. "Omacron",
  5501. 0x014c,
  5502. "Omacronacute",
  5503. 0x1e52,
  5504. "Omacrongrave",
  5505. 0x1e50,
  5506. "Omega",
  5507. 0x2126,
  5508. "Omegacyrillic",
  5509. 0x0460,
  5510. "Omegagreek",
  5511. 0x03a9,
  5512. "Omegaroundcyrillic",
  5513. 0x047a,
  5514. "Omegatitlocyrillic",
  5515. 0x047c,
  5516. "Omegatonos",
  5517. 0x038f,
  5518. "Omicron",
  5519. 0x039f,
  5520. "Omicrontonos",
  5521. 0x038c,
  5522. "Omonospace",
  5523. 0xff2f,
  5524. "Oneroman",
  5525. 0x2160,
  5526. "Oogonek",
  5527. 0x01ea,
  5528. "Oogonekmacron",
  5529. 0x01ec,
  5530. "Oopen",
  5531. 0x0186,
  5532. "Oslash",
  5533. 0x00d8,
  5534. "Oslashacute",
  5535. 0x01fe,
  5536. "Oslashsmall",
  5537. 0xf7f8,
  5538. "Osmall",
  5539. 0xf76f,
  5540. "Ostrokeacute",
  5541. 0x01fe,
  5542. "Otcyrillic",
  5543. 0x047e,
  5544. "Otilde",
  5545. 0x00d5,
  5546. "Otildeacute",
  5547. 0x1e4c,
  5548. "Otildedieresis",
  5549. 0x1e4e,
  5550. "Otildesmall",
  5551. 0xf7f5,
  5552. "P",
  5553. 0x0050,
  5554. "Pacute",
  5555. 0x1e54,
  5556. "Pcircle",
  5557. 0x24c5,
  5558. "Pdotaccent",
  5559. 0x1e56,
  5560. "Pecyrillic",
  5561. 0x041f,
  5562. "Peharmenian",
  5563. 0x054a,
  5564. "Pemiddlehookcyrillic",
  5565. 0x04a6,
  5566. "Phi",
  5567. 0x03a6,
  5568. "Phook",
  5569. 0x01a4,
  5570. "Pi",
  5571. 0x03a0,
  5572. "Piwrarmenian",
  5573. 0x0553,
  5574. "Pmonospace",
  5575. 0xff30,
  5576. "Psi",
  5577. 0x03a8,
  5578. "Psicyrillic",
  5579. 0x0470,
  5580. "Psmall",
  5581. 0xf770,
  5582. "Q",
  5583. 0x0051,
  5584. "Qcircle",
  5585. 0x24c6,
  5586. "Qmonospace",
  5587. 0xff31,
  5588. "Qsmall",
  5589. 0xf771,
  5590. "R",
  5591. 0x0052,
  5592. "Raarmenian",
  5593. 0x054c,
  5594. "Racute",
  5595. 0x0154,
  5596. "Rcaron",
  5597. 0x0158,
  5598. "Rcedilla",
  5599. 0x0156,
  5600. "Rcircle",
  5601. 0x24c7,
  5602. "Rcommaaccent",
  5603. 0x0156,
  5604. "Rdblgrave",
  5605. 0x0210,
  5606. "Rdotaccent",
  5607. 0x1e58,
  5608. "Rdotbelow",
  5609. 0x1e5a,
  5610. "Rdotbelowmacron",
  5611. 0x1e5c,
  5612. "Reharmenian",
  5613. 0x0550,
  5614. "Rfraktur",
  5615. 0x211c,
  5616. "Rho",
  5617. 0x03a1,
  5618. "Ringsmall",
  5619. 0xf6fc,
  5620. "Rinvertedbreve",
  5621. 0x0212,
  5622. "Rlinebelow",
  5623. 0x1e5e,
  5624. "Rmonospace",
  5625. 0xff32,
  5626. "Rsmall",
  5627. 0xf772,
  5628. "Rsmallinverted",
  5629. 0x0281,
  5630. "Rsmallinvertedsuperior",
  5631. 0x02b6,
  5632. "S",
  5633. 0x0053,
  5634. "SF010000",
  5635. 0x250c,
  5636. "SF020000",
  5637. 0x2514,
  5638. "SF030000",
  5639. 0x2510,
  5640. "SF040000",
  5641. 0x2518,
  5642. "SF050000",
  5643. 0x253c,
  5644. "SF060000",
  5645. 0x252c,
  5646. "SF070000",
  5647. 0x2534,
  5648. "SF080000",
  5649. 0x251c,
  5650. "SF090000",
  5651. 0x2524,
  5652. "SF100000",
  5653. 0x2500,
  5654. "SF110000",
  5655. 0x2502,
  5656. "SF190000",
  5657. 0x2561,
  5658. "SF200000",
  5659. 0x2562,
  5660. "SF210000",
  5661. 0x2556,
  5662. "SF220000",
  5663. 0x2555,
  5664. "SF230000",
  5665. 0x2563,
  5666. "SF240000",
  5667. 0x2551,
  5668. "SF250000",
  5669. 0x2557,
  5670. "SF260000",
  5671. 0x255d,
  5672. "SF270000",
  5673. 0x255c,
  5674. "SF280000",
  5675. 0x255b,
  5676. "SF360000",
  5677. 0x255e,
  5678. "SF370000",
  5679. 0x255f,
  5680. "SF380000",
  5681. 0x255a,
  5682. "SF390000",
  5683. 0x2554,
  5684. "SF400000",
  5685. 0x2569,
  5686. "SF410000",
  5687. 0x2566,
  5688. "SF420000",
  5689. 0x2560,
  5690. "SF430000",
  5691. 0x2550,
  5692. "SF440000",
  5693. 0x256c,
  5694. "SF450000",
  5695. 0x2567,
  5696. "SF460000",
  5697. 0x2568,
  5698. "SF470000",
  5699. 0x2564,
  5700. "SF480000",
  5701. 0x2565,
  5702. "SF490000",
  5703. 0x2559,
  5704. "SF500000",
  5705. 0x2558,
  5706. "SF510000",
  5707. 0x2552,
  5708. "SF520000",
  5709. 0x2553,
  5710. "SF530000",
  5711. 0x256b,
  5712. "SF540000",
  5713. 0x256a,
  5714. "Sacute",
  5715. 0x015a,
  5716. "Sacutedotaccent",
  5717. 0x1e64,
  5718. "Sampigreek",
  5719. 0x03e0,
  5720. "Scaron",
  5721. 0x0160,
  5722. "Scarondotaccent",
  5723. 0x1e66,
  5724. "Scaronsmall",
  5725. 0xf6fd,
  5726. "Scedilla",
  5727. 0x015e,
  5728. "Schwa",
  5729. 0x018f,
  5730. "Schwacyrillic",
  5731. 0x04d8,
  5732. "Schwadieresiscyrillic",
  5733. 0x04da,
  5734. "Scircle",
  5735. 0x24c8,
  5736. "Scircumflex",
  5737. 0x015c,
  5738. "Scommaaccent",
  5739. 0x0218,
  5740. "Sdotaccent",
  5741. 0x1e60,
  5742. "Sdotbelow",
  5743. 0x1e62,
  5744. "Sdotbelowdotaccent",
  5745. 0x1e68,
  5746. "Seharmenian",
  5747. 0x054d,
  5748. "Sevenroman",
  5749. 0x2166,
  5750. "Shaarmenian",
  5751. 0x0547,
  5752. "Shacyrillic",
  5753. 0x0428,
  5754. "Shchacyrillic",
  5755. 0x0429,
  5756. "Sheicoptic",
  5757. 0x03e2,
  5758. "Shhacyrillic",
  5759. 0x04ba,
  5760. "Shimacoptic",
  5761. 0x03ec,
  5762. "Sigma",
  5763. 0x03a3,
  5764. "Sixroman",
  5765. 0x2165,
  5766. "Smonospace",
  5767. 0xff33,
  5768. "Softsigncyrillic",
  5769. 0x042c,
  5770. "Ssmall",
  5771. 0xf773,
  5772. "Stigmagreek",
  5773. 0x03da,
  5774. "T",
  5775. 0x0054,
  5776. "Tau",
  5777. 0x03a4,
  5778. "Tbar",
  5779. 0x0166,
  5780. "Tcaron",
  5781. 0x0164,
  5782. "Tcedilla",
  5783. 0x0162,
  5784. "Tcircle",
  5785. 0x24c9,
  5786. "Tcircumflexbelow",
  5787. 0x1e70,
  5788. "Tcommaaccent",
  5789. 0x0162,
  5790. "Tdotaccent",
  5791. 0x1e6a,
  5792. "Tdotbelow",
  5793. 0x1e6c,
  5794. "Tecyrillic",
  5795. 0x0422,
  5796. "Tedescendercyrillic",
  5797. 0x04ac,
  5798. "Tenroman",
  5799. 0x2169,
  5800. "Tetsecyrillic",
  5801. 0x04b4,
  5802. "Theta",
  5803. 0x0398,
  5804. "Thook",
  5805. 0x01ac,
  5806. "Thorn",
  5807. 0x00de,
  5808. "Thornsmall",
  5809. 0xf7fe,
  5810. "Threeroman",
  5811. 0x2162,
  5812. "Tildesmall",
  5813. 0xf6fe,
  5814. "Tiwnarmenian",
  5815. 0x054f,
  5816. "Tlinebelow",
  5817. 0x1e6e,
  5818. "Tmonospace",
  5819. 0xff34,
  5820. "Toarmenian",
  5821. 0x0539,
  5822. "Tonefive",
  5823. 0x01bc,
  5824. "Tonesix",
  5825. 0x0184,
  5826. "Tonetwo",
  5827. 0x01a7,
  5828. "Tretroflexhook",
  5829. 0x01ae,
  5830. "Tsecyrillic",
  5831. 0x0426,
  5832. "Tshecyrillic",
  5833. 0x040b,
  5834. "Tsmall",
  5835. 0xf774,
  5836. "Twelveroman",
  5837. 0x216b,
  5838. "Tworoman",
  5839. 0x2161,
  5840. "U",
  5841. 0x0055,
  5842. "Uacute",
  5843. 0x00da,
  5844. "Uacutesmall",
  5845. 0xf7fa,
  5846. "Ubreve",
  5847. 0x016c,
  5848. "Ucaron",
  5849. 0x01d3,
  5850. "Ucircle",
  5851. 0x24ca,
  5852. "Ucircumflex",
  5853. 0x00db,
  5854. "Ucircumflexbelow",
  5855. 0x1e76,
  5856. "Ucircumflexsmall",
  5857. 0xf7fb,
  5858. "Ucyrillic",
  5859. 0x0423,
  5860. "Udblacute",
  5861. 0x0170,
  5862. "Udblgrave",
  5863. 0x0214,
  5864. "Udieresis",
  5865. 0x00dc,
  5866. "Udieresisacute",
  5867. 0x01d7,
  5868. "Udieresisbelow",
  5869. 0x1e72,
  5870. "Udieresiscaron",
  5871. 0x01d9,
  5872. "Udieresiscyrillic",
  5873. 0x04f0,
  5874. "Udieresisgrave",
  5875. 0x01db,
  5876. "Udieresismacron",
  5877. 0x01d5,
  5878. "Udieresissmall",
  5879. 0xf7fc,
  5880. "Udotbelow",
  5881. 0x1ee4,
  5882. "Ugrave",
  5883. 0x00d9,
  5884. "Ugravesmall",
  5885. 0xf7f9,
  5886. "Uhookabove",
  5887. 0x1ee6,
  5888. "Uhorn",
  5889. 0x01af,
  5890. "Uhornacute",
  5891. 0x1ee8,
  5892. "Uhorndotbelow",
  5893. 0x1ef0,
  5894. "Uhorngrave",
  5895. 0x1eea,
  5896. "Uhornhookabove",
  5897. 0x1eec,
  5898. "Uhorntilde",
  5899. 0x1eee,
  5900. "Uhungarumlaut",
  5901. 0x0170,
  5902. "Uhungarumlautcyrillic",
  5903. 0x04f2,
  5904. "Uinvertedbreve",
  5905. 0x0216,
  5906. "Ukcyrillic",
  5907. 0x0478,
  5908. "Umacron",
  5909. 0x016a,
  5910. "Umacroncyrillic",
  5911. 0x04ee,
  5912. "Umacrondieresis",
  5913. 0x1e7a,
  5914. "Umonospace",
  5915. 0xff35,
  5916. "Uogonek",
  5917. 0x0172,
  5918. "Upsilon",
  5919. 0x03a5,
  5920. "Upsilon1",
  5921. 0x03d2,
  5922. "Upsilonacutehooksymbolgreek",
  5923. 0x03d3,
  5924. "Upsilonafrican",
  5925. 0x01b1,
  5926. "Upsilondieresis",
  5927. 0x03ab,
  5928. "Upsilondieresishooksymbolgreek",
  5929. 0x03d4,
  5930. "Upsilonhooksymbol",
  5931. 0x03d2,
  5932. "Upsilontonos",
  5933. 0x038e,
  5934. "Uring",
  5935. 0x016e,
  5936. "Ushortcyrillic",
  5937. 0x040e,
  5938. "Usmall",
  5939. 0xf775,
  5940. "Ustraightcyrillic",
  5941. 0x04ae,
  5942. "Ustraightstrokecyrillic",
  5943. 0x04b0,
  5944. "Utilde",
  5945. 0x0168,
  5946. "Utildeacute",
  5947. 0x1e78,
  5948. "Utildebelow",
  5949. 0x1e74,
  5950. "V",
  5951. 0x0056,
  5952. "Vcircle",
  5953. 0x24cb,
  5954. "Vdotbelow",
  5955. 0x1e7e,
  5956. "Vecyrillic",
  5957. 0x0412,
  5958. "Vewarmenian",
  5959. 0x054e,
  5960. "Vhook",
  5961. 0x01b2,
  5962. "Vmonospace",
  5963. 0xff36,
  5964. "Voarmenian",
  5965. 0x0548,
  5966. "Vsmall",
  5967. 0xf776,
  5968. "Vtilde",
  5969. 0x1e7c,
  5970. "W",
  5971. 0x0057,
  5972. "Wacute",
  5973. 0x1e82,
  5974. "Wcircle",
  5975. 0x24cc,
  5976. "Wcircumflex",
  5977. 0x0174,
  5978. "Wdieresis",
  5979. 0x1e84,
  5980. "Wdotaccent",
  5981. 0x1e86,
  5982. "Wdotbelow",
  5983. 0x1e88,
  5984. "Wgrave",
  5985. 0x1e80,
  5986. "Wmonospace",
  5987. 0xff37,
  5988. "Wsmall",
  5989. 0xf777,
  5990. "X",
  5991. 0x0058,
  5992. "Xcircle",
  5993. 0x24cd,
  5994. "Xdieresis",
  5995. 0x1e8c,
  5996. "Xdotaccent",
  5997. 0x1e8a,
  5998. "Xeharmenian",
  5999. 0x053d,
  6000. "Xi",
  6001. 0x039e,
  6002. "Xmonospace",
  6003. 0xff38,
  6004. "Xsmall",
  6005. 0xf778,
  6006. "Y",
  6007. 0x0059,
  6008. "Yacute",
  6009. 0x00dd,
  6010. "Yacutesmall",
  6011. 0xf7fd,
  6012. "Yatcyrillic",
  6013. 0x0462,
  6014. "Ycircle",
  6015. 0x24ce,
  6016. "Ycircumflex",
  6017. 0x0176,
  6018. "Ydieresis",
  6019. 0x0178,
  6020. "Ydieresissmall",
  6021. 0xf7ff,
  6022. "Ydotaccent",
  6023. 0x1e8e,
  6024. "Ydotbelow",
  6025. 0x1ef4,
  6026. "Yericyrillic",
  6027. 0x042b,
  6028. "Yerudieresiscyrillic",
  6029. 0x04f8,
  6030. "Ygrave",
  6031. 0x1ef2,
  6032. "Yhook",
  6033. 0x01b3,
  6034. "Yhookabove",
  6035. 0x1ef6,
  6036. "Yiarmenian",
  6037. 0x0545,
  6038. "Yicyrillic",
  6039. 0x0407,
  6040. "Yiwnarmenian",
  6041. 0x0552,
  6042. "Ymonospace",
  6043. 0xff39,
  6044. "Ysmall",
  6045. 0xf779,
  6046. "Ytilde",
  6047. 0x1ef8,
  6048. "Yusbigcyrillic",
  6049. 0x046a,
  6050. "Yusbigiotifiedcyrillic",
  6051. 0x046c,
  6052. "Yuslittlecyrillic",
  6053. 0x0466,
  6054. "Yuslittleiotifiedcyrillic",
  6055. 0x0468,
  6056. "Z",
  6057. 0x005a,
  6058. "Zaarmenian",
  6059. 0x0536,
  6060. "Zacute",
  6061. 0x0179,
  6062. "Zcaron",
  6063. 0x017d,
  6064. "Zcaronsmall",
  6065. 0xf6ff,
  6066. "Zcircle",
  6067. 0x24cf,
  6068. "Zcircumflex",
  6069. 0x1e90,
  6070. "Zdot",
  6071. 0x017b,
  6072. "Zdotaccent",
  6073. 0x017b,
  6074. "Zdotbelow",
  6075. 0x1e92,
  6076. "Zecyrillic",
  6077. 0x0417,
  6078. "Zedescendercyrillic",
  6079. 0x0498,
  6080. "Zedieresiscyrillic",
  6081. 0x04de,
  6082. "Zeta",
  6083. 0x0396,
  6084. "Zhearmenian",
  6085. 0x053a,
  6086. "Zhebrevecyrillic",
  6087. 0x04c1,
  6088. "Zhecyrillic",
  6089. 0x0416,
  6090. "Zhedescendercyrillic",
  6091. 0x0496,
  6092. "Zhedieresiscyrillic",
  6093. 0x04dc,
  6094. "Zlinebelow",
  6095. 0x1e94,
  6096. "Zmonospace",
  6097. 0xff3a,
  6098. "Zsmall",
  6099. 0xf77a,
  6100. "Zstroke",
  6101. 0x01b5,
  6102. "a",
  6103. 0x0061,
  6104. "aabengali",
  6105. 0x0986,
  6106. "aacute",
  6107. 0x00e1,
  6108. "aadeva",
  6109. 0x0906,
  6110. "aagujarati",
  6111. 0x0a86,
  6112. "aagurmukhi",
  6113. 0x0a06,
  6114. "aamatragurmukhi",
  6115. 0x0a3e,
  6116. "aarusquare",
  6117. 0x3303,
  6118. "aavowelsignbengali",
  6119. 0x09be,
  6120. "aavowelsigndeva",
  6121. 0x093e,
  6122. "aavowelsigngujarati",
  6123. 0x0abe,
  6124. "abbreviationmarkarmenian",
  6125. 0x055f,
  6126. "abbreviationsigndeva",
  6127. 0x0970,
  6128. "abengali",
  6129. 0x0985,
  6130. "abopomofo",
  6131. 0x311a,
  6132. "abreve",
  6133. 0x0103,
  6134. "abreveacute",
  6135. 0x1eaf,
  6136. "abrevecyrillic",
  6137. 0x04d1,
  6138. "abrevedotbelow",
  6139. 0x1eb7,
  6140. "abrevegrave",
  6141. 0x1eb1,
  6142. "abrevehookabove",
  6143. 0x1eb3,
  6144. "abrevetilde",
  6145. 0x1eb5,
  6146. "acaron",
  6147. 0x01ce,
  6148. "acircle",
  6149. 0x24d0,
  6150. "acircumflex",
  6151. 0x00e2,
  6152. "acircumflexacute",
  6153. 0x1ea5,
  6154. "acircumflexdotbelow",
  6155. 0x1ead,
  6156. "acircumflexgrave",
  6157. 0x1ea7,
  6158. "acircumflexhookabove",
  6159. 0x1ea9,
  6160. "acircumflextilde",
  6161. 0x1eab,
  6162. "acute",
  6163. 0x00b4,
  6164. "acutebelowcmb",
  6165. 0x0317,
  6166. "acutecmb",
  6167. 0x0301,
  6168. "acutecomb",
  6169. 0x0301,
  6170. "acutedeva",
  6171. 0x0954,
  6172. "acutelowmod",
  6173. 0x02cf,
  6174. "acutetonecmb",
  6175. 0x0341,
  6176. "acyrillic",
  6177. 0x0430,
  6178. "adblgrave",
  6179. 0x0201,
  6180. "addakgurmukhi",
  6181. 0x0a71,
  6182. "adeva",
  6183. 0x0905,
  6184. "adieresis",
  6185. 0x00e4,
  6186. "adieresiscyrillic",
  6187. 0x04d3,
  6188. "adieresismacron",
  6189. 0x01df,
  6190. "adotbelow",
  6191. 0x1ea1,
  6192. "adotmacron",
  6193. 0x01e1,
  6194. "ae",
  6195. 0x00e6,
  6196. "aeacute",
  6197. 0x01fd,
  6198. "aekorean",
  6199. 0x3150,
  6200. "aemacron",
  6201. 0x01e3,
  6202. "afii00208",
  6203. 0x2015,
  6204. "afii08941",
  6205. 0x20a4,
  6206. "afii10017",
  6207. 0x0410,
  6208. "afii10018",
  6209. 0x0411,
  6210. "afii10019",
  6211. 0x0412,
  6212. "afii10020",
  6213. 0x0413,
  6214. "afii10021",
  6215. 0x0414,
  6216. "afii10022",
  6217. 0x0415,
  6218. "afii10023",
  6219. 0x0401,
  6220. "afii10024",
  6221. 0x0416,
  6222. "afii10025",
  6223. 0x0417,
  6224. "afii10026",
  6225. 0x0418,
  6226. "afii10027",
  6227. 0x0419,
  6228. "afii10028",
  6229. 0x041a,
  6230. "afii10029",
  6231. 0x041b,
  6232. "afii10030",
  6233. 0x041c,
  6234. "afii10031",
  6235. 0x041d,
  6236. "afii10032",
  6237. 0x041e,
  6238. "afii10033",
  6239. 0x041f,
  6240. "afii10034",
  6241. 0x0420,
  6242. "afii10035",
  6243. 0x0421,
  6244. "afii10036",
  6245. 0x0422,
  6246. "afii10037",
  6247. 0x0423,
  6248. "afii10038",
  6249. 0x0424,
  6250. "afii10039",
  6251. 0x0425,
  6252. "afii10040",
  6253. 0x0426,
  6254. "afii10041",
  6255. 0x0427,
  6256. "afii10042",
  6257. 0x0428,
  6258. "afii10043",
  6259. 0x0429,
  6260. "afii10044",
  6261. 0x042a,
  6262. "afii10045",
  6263. 0x042b,
  6264. "afii10046",
  6265. 0x042c,
  6266. "afii10047",
  6267. 0x042d,
  6268. "afii10048",
  6269. 0x042e,
  6270. "afii10049",
  6271. 0x042f,
  6272. "afii10050",
  6273. 0x0490,
  6274. "afii10051",
  6275. 0x0402,
  6276. "afii10052",
  6277. 0x0403,
  6278. "afii10053",
  6279. 0x0404,
  6280. "afii10054",
  6281. 0x0405,
  6282. "afii10055",
  6283. 0x0406,
  6284. "afii10056",
  6285. 0x0407,
  6286. "afii10057",
  6287. 0x0408,
  6288. "afii10058",
  6289. 0x0409,
  6290. "afii10059",
  6291. 0x040a,
  6292. "afii10060",
  6293. 0x040b,
  6294. "afii10061",
  6295. 0x040c,
  6296. "afii10062",
  6297. 0x040e,
  6298. "afii10063",
  6299. 0xf6c4,
  6300. "afii10064",
  6301. 0xf6c5,
  6302. "afii10065",
  6303. 0x0430,
  6304. "afii10066",
  6305. 0x0431,
  6306. "afii10067",
  6307. 0x0432,
  6308. "afii10068",
  6309. 0x0433,
  6310. "afii10069",
  6311. 0x0434,
  6312. "afii10070",
  6313. 0x0435,
  6314. "afii10071",
  6315. 0x0451,
  6316. "afii10072",
  6317. 0x0436,
  6318. "afii10073",
  6319. 0x0437,
  6320. "afii10074",
  6321. 0x0438,
  6322. "afii10075",
  6323. 0x0439,
  6324. "afii10076",
  6325. 0x043a,
  6326. "afii10077",
  6327. 0x043b,
  6328. "afii10078",
  6329. 0x043c,
  6330. "afii10079",
  6331. 0x043d,
  6332. "afii10080",
  6333. 0x043e,
  6334. "afii10081",
  6335. 0x043f,
  6336. "afii10082",
  6337. 0x0440,
  6338. "afii10083",
  6339. 0x0441,
  6340. "afii10084",
  6341. 0x0442,
  6342. "afii10085",
  6343. 0x0443,
  6344. "afii10086",
  6345. 0x0444,
  6346. "afii10087",
  6347. 0x0445,
  6348. "afii10088",
  6349. 0x0446,
  6350. "afii10089",
  6351. 0x0447,
  6352. "afii10090",
  6353. 0x0448,
  6354. "afii10091",
  6355. 0x0449,
  6356. "afii10092",
  6357. 0x044a,
  6358. "afii10093",
  6359. 0x044b,
  6360. "afii10094",
  6361. 0x044c,
  6362. "afii10095",
  6363. 0x044d,
  6364. "afii10096",
  6365. 0x044e,
  6366. "afii10097",
  6367. 0x044f,
  6368. "afii10098",
  6369. 0x0491,
  6370. "afii10099",
  6371. 0x0452,
  6372. "afii10100",
  6373. 0x0453,
  6374. "afii10101",
  6375. 0x0454,
  6376. "afii10102",
  6377. 0x0455,
  6378. "afii10103",
  6379. 0x0456,
  6380. "afii10104",
  6381. 0x0457,
  6382. "afii10105",
  6383. 0x0458,
  6384. "afii10106",
  6385. 0x0459,
  6386. "afii10107",
  6387. 0x045a,
  6388. "afii10108",
  6389. 0x045b,
  6390. "afii10109",
  6391. 0x045c,
  6392. "afii10110",
  6393. 0x045e,
  6394. "afii10145",
  6395. 0x040f,
  6396. "afii10146",
  6397. 0x0462,
  6398. "afii10147",
  6399. 0x0472,
  6400. "afii10148",
  6401. 0x0474,
  6402. "afii10192",
  6403. 0xf6c6,
  6404. "afii10193",
  6405. 0x045f,
  6406. "afii10194",
  6407. 0x0463,
  6408. "afii10195",
  6409. 0x0473,
  6410. "afii10196",
  6411. 0x0475,
  6412. "afii10831",
  6413. 0xf6c7,
  6414. "afii10832",
  6415. 0xf6c8,
  6416. "afii10846",
  6417. 0x04d9,
  6418. "afii299",
  6419. 0x200e,
  6420. "afii300",
  6421. 0x200f,
  6422. "afii301",
  6423. 0x200d,
  6424. "afii57381",
  6425. 0x066a,
  6426. "afii57388",
  6427. 0x060c,
  6428. "afii57392",
  6429. 0x0660,
  6430. "afii57393",
  6431. 0x0661,
  6432. "afii57394",
  6433. 0x0662,
  6434. "afii57395",
  6435. 0x0663,
  6436. "afii57396",
  6437. 0x0664,
  6438. "afii57397",
  6439. 0x0665,
  6440. "afii57398",
  6441. 0x0666,
  6442. "afii57399",
  6443. 0x0667,
  6444. "afii57400",
  6445. 0x0668,
  6446. "afii57401",
  6447. 0x0669,
  6448. "afii57403",
  6449. 0x061b,
  6450. "afii57407",
  6451. 0x061f,
  6452. "afii57409",
  6453. 0x0621,
  6454. "afii57410",
  6455. 0x0622,
  6456. "afii57411",
  6457. 0x0623,
  6458. "afii57412",
  6459. 0x0624,
  6460. "afii57413",
  6461. 0x0625,
  6462. "afii57414",
  6463. 0x0626,
  6464. "afii57415",
  6465. 0x0627,
  6466. "afii57416",
  6467. 0x0628,
  6468. "afii57417",
  6469. 0x0629,
  6470. "afii57418",
  6471. 0x062a,
  6472. "afii57419",
  6473. 0x062b,
  6474. "afii57420",
  6475. 0x062c,
  6476. "afii57421",
  6477. 0x062d,
  6478. "afii57422",
  6479. 0x062e,
  6480. "afii57423",
  6481. 0x062f,
  6482. "afii57424",
  6483. 0x0630,
  6484. "afii57425",
  6485. 0x0631,
  6486. "afii57426",
  6487. 0x0632,
  6488. "afii57427",
  6489. 0x0633,
  6490. "afii57428",
  6491. 0x0634,
  6492. "afii57429",
  6493. 0x0635,
  6494. "afii57430",
  6495. 0x0636,
  6496. "afii57431",
  6497. 0x0637,
  6498. "afii57432",
  6499. 0x0638,
  6500. "afii57433",
  6501. 0x0639,
  6502. "afii57434",
  6503. 0x063a,
  6504. "afii57440",
  6505. 0x0640,
  6506. "afii57441",
  6507. 0x0641,
  6508. "afii57442",
  6509. 0x0642,
  6510. "afii57443",
  6511. 0x0643,
  6512. "afii57444",
  6513. 0x0644,
  6514. "afii57445",
  6515. 0x0645,
  6516. "afii57446",
  6517. 0x0646,
  6518. "afii57448",
  6519. 0x0648,
  6520. "afii57449",
  6521. 0x0649,
  6522. "afii57450",
  6523. 0x064a,
  6524. "afii57451",
  6525. 0x064b,
  6526. "afii57452",
  6527. 0x064c,
  6528. "afii57453",
  6529. 0x064d,
  6530. "afii57454",
  6531. 0x064e,
  6532. "afii57455",
  6533. 0x064f,
  6534. "afii57456",
  6535. 0x0650,
  6536. "afii57457",
  6537. 0x0651,
  6538. "afii57458",
  6539. 0x0652,
  6540. "afii57470",
  6541. 0x0647,
  6542. "afii57505",
  6543. 0x06a4,
  6544. "afii57506",
  6545. 0x067e,
  6546. "afii57507",
  6547. 0x0686,
  6548. "afii57508",
  6549. 0x0698,
  6550. "afii57509",
  6551. 0x06af,
  6552. "afii57511",
  6553. 0x0679,
  6554. "afii57512",
  6555. 0x0688,
  6556. "afii57513",
  6557. 0x0691,
  6558. "afii57514",
  6559. 0x06ba,
  6560. "afii57519",
  6561. 0x06d2,
  6562. "afii57534",
  6563. 0x06d5,
  6564. "afii57636",
  6565. 0x20aa,
  6566. "afii57645",
  6567. 0x05be,
  6568. "afii57658",
  6569. 0x05c3,
  6570. "afii57664",
  6571. 0x05d0,
  6572. "afii57665",
  6573. 0x05d1,
  6574. "afii57666",
  6575. 0x05d2,
  6576. "afii57667",
  6577. 0x05d3,
  6578. "afii57668",
  6579. 0x05d4,
  6580. "afii57669",
  6581. 0x05d5,
  6582. "afii57670",
  6583. 0x05d6,
  6584. "afii57671",
  6585. 0x05d7,
  6586. "afii57672",
  6587. 0x05d8,
  6588. "afii57673",
  6589. 0x05d9,
  6590. "afii57674",
  6591. 0x05da,
  6592. "afii57675",
  6593. 0x05db,
  6594. "afii57676",
  6595. 0x05dc,
  6596. "afii57677",
  6597. 0x05dd,
  6598. "afii57678",
  6599. 0x05de,
  6600. "afii57679",
  6601. 0x05df,
  6602. "afii57680",
  6603. 0x05e0,
  6604. "afii57681",
  6605. 0x05e1,
  6606. "afii57682",
  6607. 0x05e2,
  6608. "afii57683",
  6609. 0x05e3,
  6610. "afii57684",
  6611. 0x05e4,
  6612. "afii57685",
  6613. 0x05e5,
  6614. "afii57686",
  6615. 0x05e6,
  6616. "afii57687",
  6617. 0x05e7,
  6618. "afii57688",
  6619. 0x05e8,
  6620. "afii57689",
  6621. 0x05e9,
  6622. "afii57690",
  6623. 0x05ea,
  6624. "afii57694",
  6625. 0xfb2a,
  6626. "afii57695",
  6627. 0xfb2b,
  6628. "afii57700",
  6629. 0xfb4b,
  6630. "afii57705",
  6631. 0xfb1f,
  6632. "afii57716",
  6633. 0x05f0,
  6634. "afii57717",
  6635. 0x05f1,
  6636. "afii57718",
  6637. 0x05f2,
  6638. "afii57723",
  6639. 0xfb35,
  6640. "afii57793",
  6641. 0x05b4,
  6642. "afii57794",
  6643. 0x05b5,
  6644. "afii57795",
  6645. 0x05b6,
  6646. "afii57796",
  6647. 0x05bb,
  6648. "afii57797",
  6649. 0x05b8,
  6650. "afii57798",
  6651. 0x05b7,
  6652. "afii57799",
  6653. 0x05b0,
  6654. "afii57800",
  6655. 0x05b2,
  6656. "afii57801",
  6657. 0x05b1,
  6658. "afii57802",
  6659. 0x05b3,
  6660. "afii57803",
  6661. 0x05c2,
  6662. "afii57804",
  6663. 0x05c1,
  6664. "afii57806",
  6665. 0x05b9,
  6666. "afii57807",
  6667. 0x05bc,
  6668. "afii57839",
  6669. 0x05bd,
  6670. "afii57841",
  6671. 0x05bf,
  6672. "afii57842",
  6673. 0x05c0,
  6674. "afii57929",
  6675. 0x02bc,
  6676. "afii61248",
  6677. 0x2105,
  6678. "afii61289",
  6679. 0x2113,
  6680. "afii61352",
  6681. 0x2116,
  6682. "afii61573",
  6683. 0x202c,
  6684. "afii61574",
  6685. 0x202d,
  6686. "afii61575",
  6687. 0x202e,
  6688. "afii61664",
  6689. 0x200c,
  6690. "afii63167",
  6691. 0x066d,
  6692. "afii64937",
  6693. 0x02bd,
  6694. "agrave",
  6695. 0x00e0,
  6696. "agujarati",
  6697. 0x0a85,
  6698. "agurmukhi",
  6699. 0x0a05,
  6700. "ahiragana",
  6701. 0x3042,
  6702. "ahookabove",
  6703. 0x1ea3,
  6704. "aibengali",
  6705. 0x0990,
  6706. "aibopomofo",
  6707. 0x311e,
  6708. "aideva",
  6709. 0x0910,
  6710. "aiecyrillic",
  6711. 0x04d5,
  6712. "aigujarati",
  6713. 0x0a90,
  6714. "aigurmukhi",
  6715. 0x0a10,
  6716. "aimatragurmukhi",
  6717. 0x0a48,
  6718. "ainarabic",
  6719. 0x0639,
  6720. "ainfinalarabic",
  6721. 0xfeca,
  6722. "aininitialarabic",
  6723. 0xfecb,
  6724. "ainmedialarabic",
  6725. 0xfecc,
  6726. "ainvertedbreve",
  6727. 0x0203,
  6728. "aivowelsignbengali",
  6729. 0x09c8,
  6730. "aivowelsigndeva",
  6731. 0x0948,
  6732. "aivowelsigngujarati",
  6733. 0x0ac8,
  6734. "akatakana",
  6735. 0x30a2,
  6736. "akatakanahalfwidth",
  6737. 0xff71,
  6738. "akorean",
  6739. 0x314f,
  6740. "alef",
  6741. 0x05d0,
  6742. "alefarabic",
  6743. 0x0627,
  6744. "alefdageshhebrew",
  6745. 0xfb30,
  6746. "aleffinalarabic",
  6747. 0xfe8e,
  6748. "alefhamzaabovearabic",
  6749. 0x0623,
  6750. "alefhamzaabovefinalarabic",
  6751. 0xfe84,
  6752. "alefhamzabelowarabic",
  6753. 0x0625,
  6754. "alefhamzabelowfinalarabic",
  6755. 0xfe88,
  6756. "alefhebrew",
  6757. 0x05d0,
  6758. "aleflamedhebrew",
  6759. 0xfb4f,
  6760. "alefmaddaabovearabic",
  6761. 0x0622,
  6762. "alefmaddaabovefinalarabic",
  6763. 0xfe82,
  6764. "alefmaksuraarabic",
  6765. 0x0649,
  6766. "alefmaksurafinalarabic",
  6767. 0xfef0,
  6768. "alefmaksurainitialarabic",
  6769. 0xfef3,
  6770. "alefmaksuramedialarabic",
  6771. 0xfef4,
  6772. "alefpatahhebrew",
  6773. 0xfb2e,
  6774. "alefqamatshebrew",
  6775. 0xfb2f,
  6776. "aleph",
  6777. 0x2135,
  6778. "allequal",
  6779. 0x224c,
  6780. "alpha",
  6781. 0x03b1,
  6782. "alphatonos",
  6783. 0x03ac,
  6784. "amacron",
  6785. 0x0101,
  6786. "amonospace",
  6787. 0xff41,
  6788. "ampersand",
  6789. 0x0026,
  6790. "ampersandmonospace",
  6791. 0xff06,
  6792. "ampersandsmall",
  6793. 0xf726,
  6794. "amsquare",
  6795. 0x33c2,
  6796. "anbopomofo",
  6797. 0x3122,
  6798. "angbopomofo",
  6799. 0x3124,
  6800. "angbracketleft",
  6801. 0x3008,
  6802. "angbracketright",
  6803. 0x3009,
  6804. "angkhankhuthai",
  6805. 0x0e5a,
  6806. "angle",
  6807. 0x2220,
  6808. "anglebracketleft",
  6809. 0x3008,
  6810. "anglebracketleftvertical",
  6811. 0xfe3f,
  6812. "anglebracketright",
  6813. 0x3009,
  6814. "anglebracketrightvertical",
  6815. 0xfe40,
  6816. "angleleft",
  6817. 0x2329,
  6818. "angleright",
  6819. 0x232a,
  6820. "angstrom",
  6821. 0x212b,
  6822. "anoteleia",
  6823. 0x0387,
  6824. "anudattadeva",
  6825. 0x0952,
  6826. "anusvarabengali",
  6827. 0x0982,
  6828. "anusvaradeva",
  6829. 0x0902,
  6830. "anusvaragujarati",
  6831. 0x0a82,
  6832. "aogonek",
  6833. 0x0105,
  6834. "apaatosquare",
  6835. 0x3300,
  6836. "aparen",
  6837. 0x249c,
  6838. "apostrophearmenian",
  6839. 0x055a,
  6840. "apostrophemod",
  6841. 0x02bc,
  6842. "apple",
  6843. 0xf8ff,
  6844. "approaches",
  6845. 0x2250,
  6846. "approxequal",
  6847. 0x2248,
  6848. "approxequalorimage",
  6849. 0x2252,
  6850. "approximatelyequal",
  6851. 0x2245,
  6852. "araeaekorean",
  6853. 0x318e,
  6854. "araeakorean",
  6855. 0x318d,
  6856. "arc",
  6857. 0x2312,
  6858. "arighthalfring",
  6859. 0x1e9a,
  6860. "aring",
  6861. 0x00e5,
  6862. "aringacute",
  6863. 0x01fb,
  6864. "aringbelow",
  6865. 0x1e01,
  6866. "arrowboth",
  6867. 0x2194,
  6868. "arrowdashdown",
  6869. 0x21e3,
  6870. "arrowdashleft",
  6871. 0x21e0,
  6872. "arrowdashright",
  6873. 0x21e2,
  6874. "arrowdashup",
  6875. 0x21e1,
  6876. "arrowdblboth",
  6877. 0x21d4,
  6878. "arrowdbldown",
  6879. 0x21d3,
  6880. "arrowdblleft",
  6881. 0x21d0,
  6882. "arrowdblright",
  6883. 0x21d2,
  6884. "arrowdblup",
  6885. 0x21d1,
  6886. "arrowdown",
  6887. 0x2193,
  6888. "arrowdownleft",
  6889. 0x2199,
  6890. "arrowdownright",
  6891. 0x2198,
  6892. "arrowdownwhite",
  6893. 0x21e9,
  6894. "arrowheaddownmod",
  6895. 0x02c5,
  6896. "arrowheadleftmod",
  6897. 0x02c2,
  6898. "arrowheadrightmod",
  6899. 0x02c3,
  6900. "arrowheadupmod",
  6901. 0x02c4,
  6902. "arrowhorizex",
  6903. 0xf8e7,
  6904. "arrowleft",
  6905. 0x2190,
  6906. "arrowleftdbl",
  6907. 0x21d0,
  6908. "arrowleftdblstroke",
  6909. 0x21cd,
  6910. "arrowleftoverright",
  6911. 0x21c6,
  6912. "arrowleftwhite",
  6913. 0x21e6,
  6914. "arrowright",
  6915. 0x2192,
  6916. "arrowrightdblstroke",
  6917. 0x21cf,
  6918. "arrowrightheavy",
  6919. 0x279e,
  6920. "arrowrightoverleft",
  6921. 0x21c4,
  6922. "arrowrightwhite",
  6923. 0x21e8,
  6924. "arrowtableft",
  6925. 0x21e4,
  6926. "arrowtabright",
  6927. 0x21e5,
  6928. "arrowup",
  6929. 0x2191,
  6930. "arrowupdn",
  6931. 0x2195,
  6932. "arrowupdnbse",
  6933. 0x21a8,
  6934. "arrowupdownbase",
  6935. 0x21a8,
  6936. "arrowupleft",
  6937. 0x2196,
  6938. "arrowupleftofdown",
  6939. 0x21c5,
  6940. "arrowupright",
  6941. 0x2197,
  6942. "arrowupwhite",
  6943. 0x21e7,
  6944. "arrowvertex",
  6945. 0xf8e6,
  6946. "asciicircum",
  6947. 0x005e,
  6948. "asciicircummonospace",
  6949. 0xff3e,
  6950. "asciitilde",
  6951. 0x007e,
  6952. "asciitildemonospace",
  6953. 0xff5e,
  6954. "ascript",
  6955. 0x0251,
  6956. "ascriptturned",
  6957. 0x0252,
  6958. "asmallhiragana",
  6959. 0x3041,
  6960. "asmallkatakana",
  6961. 0x30a1,
  6962. "asmallkatakanahalfwidth",
  6963. 0xff67,
  6964. "asterisk",
  6965. 0x002a,
  6966. "asteriskaltonearabic",
  6967. 0x066d,
  6968. "asteriskarabic",
  6969. 0x066d,
  6970. "asteriskmath",
  6971. 0x2217,
  6972. "asteriskmonospace",
  6973. 0xff0a,
  6974. "asterisksmall",
  6975. 0xfe61,
  6976. "asterism",
  6977. 0x2042,
  6978. "asuperior",
  6979. 0xf6e9,
  6980. "asymptoticallyequal",
  6981. 0x2243,
  6982. "at",
  6983. 0x0040,
  6984. "atilde",
  6985. 0x00e3,
  6986. "atmonospace",
  6987. 0xff20,
  6988. "atsmall",
  6989. 0xfe6b,
  6990. "aturned",
  6991. 0x0250,
  6992. "aubengali",
  6993. 0x0994,
  6994. "aubopomofo",
  6995. 0x3120,
  6996. "audeva",
  6997. 0x0914,
  6998. "augujarati",
  6999. 0x0a94,
  7000. "augurmukhi",
  7001. 0x0a14,
  7002. "aulengthmarkbengali",
  7003. 0x09d7,
  7004. "aumatragurmukhi",
  7005. 0x0a4c,
  7006. "auvowelsignbengali",
  7007. 0x09cc,
  7008. "auvowelsigndeva",
  7009. 0x094c,
  7010. "auvowelsigngujarati",
  7011. 0x0acc,
  7012. "avagrahadeva",
  7013. 0x093d,
  7014. "aybarmenian",
  7015. 0x0561,
  7016. "ayin",
  7017. 0x05e2,
  7018. "ayinaltonehebrew",
  7019. 0xfb20,
  7020. "ayinhebrew",
  7021. 0x05e2,
  7022. "b",
  7023. 0x0062,
  7024. "babengali",
  7025. 0x09ac,
  7026. "backslash",
  7027. 0x005c,
  7028. "backslashmonospace",
  7029. 0xff3c,
  7030. "badeva",
  7031. 0x092c,
  7032. "bagujarati",
  7033. 0x0aac,
  7034. "bagurmukhi",
  7035. 0x0a2c,
  7036. "bahiragana",
  7037. 0x3070,
  7038. "bahtthai",
  7039. 0x0e3f,
  7040. "bakatakana",
  7041. 0x30d0,
  7042. "bar",
  7043. 0x007c,
  7044. "barmonospace",
  7045. 0xff5c,
  7046. "bbopomofo",
  7047. 0x3105,
  7048. "bcircle",
  7049. 0x24d1,
  7050. "bdotaccent",
  7051. 0x1e03,
  7052. "bdotbelow",
  7053. 0x1e05,
  7054. "beamedsixteenthnotes",
  7055. 0x266c,
  7056. "because",
  7057. 0x2235,
  7058. "becyrillic",
  7059. 0x0431,
  7060. "beharabic",
  7061. 0x0628,
  7062. "behfinalarabic",
  7063. 0xfe90,
  7064. "behinitialarabic",
  7065. 0xfe91,
  7066. "behiragana",
  7067. 0x3079,
  7068. "behmedialarabic",
  7069. 0xfe92,
  7070. "behmeeminitialarabic",
  7071. 0xfc9f,
  7072. "behmeemisolatedarabic",
  7073. 0xfc08,
  7074. "behnoonfinalarabic",
  7075. 0xfc6d,
  7076. "bekatakana",
  7077. 0x30d9,
  7078. "benarmenian",
  7079. 0x0562,
  7080. "bet",
  7081. 0x05d1,
  7082. "beta",
  7083. 0x03b2,
  7084. "betasymbolgreek",
  7085. 0x03d0,
  7086. "betdagesh",
  7087. 0xfb31,
  7088. "betdageshhebrew",
  7089. 0xfb31,
  7090. "bethebrew",
  7091. 0x05d1,
  7092. "betrafehebrew",
  7093. 0xfb4c,
  7094. "bhabengali",
  7095. 0x09ad,
  7096. "bhadeva",
  7097. 0x092d,
  7098. "bhagujarati",
  7099. 0x0aad,
  7100. "bhagurmukhi",
  7101. 0x0a2d,
  7102. "bhook",
  7103. 0x0253,
  7104. "bihiragana",
  7105. 0x3073,
  7106. "bikatakana",
  7107. 0x30d3,
  7108. "bilabialclick",
  7109. 0x0298,
  7110. "bindigurmukhi",
  7111. 0x0a02,
  7112. "birusquare",
  7113. 0x3331,
  7114. "blackcircle",
  7115. 0x25cf,
  7116. "blackdiamond",
  7117. 0x25c6,
  7118. "blackdownpointingtriangle",
  7119. 0x25bc,
  7120. "blackleftpointingpointer",
  7121. 0x25c4,
  7122. "blackleftpointingtriangle",
  7123. 0x25c0,
  7124. "blacklenticularbracketleft",
  7125. 0x3010,
  7126. "blacklenticularbracketleftvertical",
  7127. 0xfe3b,
  7128. "blacklenticularbracketright",
  7129. 0x3011,
  7130. "blacklenticularbracketrightvertical",
  7131. 0xfe3c,
  7132. "blacklowerlefttriangle",
  7133. 0x25e3,
  7134. "blacklowerrighttriangle",
  7135. 0x25e2,
  7136. "blackrectangle",
  7137. 0x25ac,
  7138. "blackrightpointingpointer",
  7139. 0x25ba,
  7140. "blackrightpointingtriangle",
  7141. 0x25b6,
  7142. "blacksmallsquare",
  7143. 0x25aa,
  7144. "blacksmilingface",
  7145. 0x263b,
  7146. "blacksquare",
  7147. 0x25a0,
  7148. "blackstar",
  7149. 0x2605,
  7150. "blackupperlefttriangle",
  7151. 0x25e4,
  7152. "blackupperrighttriangle",
  7153. 0x25e5,
  7154. "blackuppointingsmalltriangle",
  7155. 0x25b4,
  7156. "blackuppointingtriangle",
  7157. 0x25b2,
  7158. "blank",
  7159. 0x2423,
  7160. "blinebelow",
  7161. 0x1e07,
  7162. "block",
  7163. 0x2588,
  7164. "bmonospace",
  7165. 0xff42,
  7166. "bobaimaithai",
  7167. 0x0e1a,
  7168. "bohiragana",
  7169. 0x307c,
  7170. "bokatakana",
  7171. 0x30dc,
  7172. "bparen",
  7173. 0x249d,
  7174. "bqsquare",
  7175. 0x33c3,
  7176. "braceex",
  7177. 0xf8f4,
  7178. "braceleft",
  7179. 0x007b,
  7180. "braceleftbt",
  7181. 0xf8f3,
  7182. "braceleftmid",
  7183. 0xf8f2,
  7184. "braceleftmonospace",
  7185. 0xff5b,
  7186. "braceleftsmall",
  7187. 0xfe5b,
  7188. "bracelefttp",
  7189. 0xf8f1,
  7190. "braceleftvertical",
  7191. 0xfe37,
  7192. "braceright",
  7193. 0x007d,
  7194. "bracerightbt",
  7195. 0xf8fe,
  7196. "bracerightmid",
  7197. 0xf8fd,
  7198. "bracerightmonospace",
  7199. 0xff5d,
  7200. "bracerightsmall",
  7201. 0xfe5c,
  7202. "bracerighttp",
  7203. 0xf8fc,
  7204. "bracerightvertical",
  7205. 0xfe38,
  7206. "bracketleft",
  7207. 0x005b,
  7208. "bracketleftbt",
  7209. 0xf8f0,
  7210. "bracketleftex",
  7211. 0xf8ef,
  7212. "bracketleftmonospace",
  7213. 0xff3b,
  7214. "bracketlefttp",
  7215. 0xf8ee,
  7216. "bracketright",
  7217. 0x005d,
  7218. "bracketrightbt",
  7219. 0xf8fb,
  7220. "bracketrightex",
  7221. 0xf8fa,
  7222. "bracketrightmonospace",
  7223. 0xff3d,
  7224. "bracketrighttp",
  7225. 0xf8f9,
  7226. "breve",
  7227. 0x02d8,
  7228. "brevebelowcmb",
  7229. 0x032e,
  7230. "brevecmb",
  7231. 0x0306,
  7232. "breveinvertedbelowcmb",
  7233. 0x032f,
  7234. "breveinvertedcmb",
  7235. 0x0311,
  7236. "breveinverteddoublecmb",
  7237. 0x0361,
  7238. "bridgebelowcmb",
  7239. 0x032a,
  7240. "bridgeinvertedbelowcmb",
  7241. 0x033a,
  7242. "brokenbar",
  7243. 0x00a6,
  7244. "bstroke",
  7245. 0x0180,
  7246. "bsuperior",
  7247. 0xf6ea,
  7248. "btopbar",
  7249. 0x0183,
  7250. "buhiragana",
  7251. 0x3076,
  7252. "bukatakana",
  7253. 0x30d6,
  7254. "bullet",
  7255. 0x2022,
  7256. "bulletinverse",
  7257. 0x25d8,
  7258. "bulletoperator",
  7259. 0x2219,
  7260. "bullseye",
  7261. 0x25ce,
  7262. "c",
  7263. 0x0063,
  7264. "caarmenian",
  7265. 0x056e,
  7266. "cabengali",
  7267. 0x099a,
  7268. "cacute",
  7269. 0x0107,
  7270. "cadeva",
  7271. 0x091a,
  7272. "cagujarati",
  7273. 0x0a9a,
  7274. "cagurmukhi",
  7275. 0x0a1a,
  7276. "calsquare",
  7277. 0x3388,
  7278. "candrabindubengali",
  7279. 0x0981,
  7280. "candrabinducmb",
  7281. 0x0310,
  7282. "candrabindudeva",
  7283. 0x0901,
  7284. "candrabindugujarati",
  7285. 0x0a81,
  7286. "capslock",
  7287. 0x21ea,
  7288. "careof",
  7289. 0x2105,
  7290. "caron",
  7291. 0x02c7,
  7292. "caronbelowcmb",
  7293. 0x032c,
  7294. "caroncmb",
  7295. 0x030c,
  7296. "carriagereturn",
  7297. 0x21b5,
  7298. "cbopomofo",
  7299. 0x3118,
  7300. "ccaron",
  7301. 0x010d,
  7302. "ccedilla",
  7303. 0x00e7,
  7304. "ccedillaacute",
  7305. 0x1e09,
  7306. "ccircle",
  7307. 0x24d2,
  7308. "ccircumflex",
  7309. 0x0109,
  7310. "ccurl",
  7311. 0x0255,
  7312. "cdot",
  7313. 0x010b,
  7314. "cdotaccent",
  7315. 0x010b,
  7316. "cdsquare",
  7317. 0x33c5,
  7318. "cedilla",
  7319. 0x00b8,
  7320. "cedillacmb",
  7321. 0x0327,
  7322. "cent",
  7323. 0x00a2,
  7324. "centigrade",
  7325. 0x2103,
  7326. "centinferior",
  7327. 0xf6df,
  7328. "centmonospace",
  7329. 0xffe0,
  7330. "centoldstyle",
  7331. 0xf7a2,
  7332. "centsuperior",
  7333. 0xf6e0,
  7334. "chaarmenian",
  7335. 0x0579,
  7336. "chabengali",
  7337. 0x099b,
  7338. "chadeva",
  7339. 0x091b,
  7340. "chagujarati",
  7341. 0x0a9b,
  7342. "chagurmukhi",
  7343. 0x0a1b,
  7344. "chbopomofo",
  7345. 0x3114,
  7346. "cheabkhasiancyrillic",
  7347. 0x04bd,
  7348. "checkmark",
  7349. 0x2713,
  7350. "checyrillic",
  7351. 0x0447,
  7352. "chedescenderabkhasiancyrillic",
  7353. 0x04bf,
  7354. "chedescendercyrillic",
  7355. 0x04b7,
  7356. "chedieresiscyrillic",
  7357. 0x04f5,
  7358. "cheharmenian",
  7359. 0x0573,
  7360. "chekhakassiancyrillic",
  7361. 0x04cc,
  7362. "cheverticalstrokecyrillic",
  7363. 0x04b9,
  7364. "chi",
  7365. 0x03c7,
  7366. "chieuchacirclekorean",
  7367. 0x3277,
  7368. "chieuchaparenkorean",
  7369. 0x3217,
  7370. "chieuchcirclekorean",
  7371. 0x3269,
  7372. "chieuchkorean",
  7373. 0x314a,
  7374. "chieuchparenkorean",
  7375. 0x3209,
  7376. "chochangthai",
  7377. 0x0e0a,
  7378. "chochanthai",
  7379. 0x0e08,
  7380. "chochingthai",
  7381. 0x0e09,
  7382. "chochoethai",
  7383. 0x0e0c,
  7384. "chook",
  7385. 0x0188,
  7386. "cieucacirclekorean",
  7387. 0x3276,
  7388. "cieucaparenkorean",
  7389. 0x3216,
  7390. "cieuccirclekorean",
  7391. 0x3268,
  7392. "cieuckorean",
  7393. 0x3148,
  7394. "cieucparenkorean",
  7395. 0x3208,
  7396. "cieucuparenkorean",
  7397. 0x321c,
  7398. "circle",
  7399. 0x25cb,
  7400. "circlecopyrt",
  7401. 0x00a9,
  7402. "circlemultiply",
  7403. 0x2297,
  7404. "circleot",
  7405. 0x2299,
  7406. "circleplus",
  7407. 0x2295,
  7408. "circlepostalmark",
  7409. 0x3036,
  7410. "circlewithlefthalfblack",
  7411. 0x25d0,
  7412. "circlewithrighthalfblack",
  7413. 0x25d1,
  7414. "circumflex",
  7415. 0x02c6,
  7416. "circumflexbelowcmb",
  7417. 0x032d,
  7418. "circumflexcmb",
  7419. 0x0302,
  7420. "clear",
  7421. 0x2327,
  7422. "clickalveolar",
  7423. 0x01c2,
  7424. "clickdental",
  7425. 0x01c0,
  7426. "clicklateral",
  7427. 0x01c1,
  7428. "clickretroflex",
  7429. 0x01c3,
  7430. "club",
  7431. 0x2663,
  7432. "clubsuitblack",
  7433. 0x2663,
  7434. "clubsuitwhite",
  7435. 0x2667,
  7436. "cmcubedsquare",
  7437. 0x33a4,
  7438. "cmonospace",
  7439. 0xff43,
  7440. "cmsquaredsquare",
  7441. 0x33a0,
  7442. "coarmenian",
  7443. 0x0581,
  7444. "colon",
  7445. 0x003a,
  7446. "colonmonetary",
  7447. 0x20a1,
  7448. "colonmonospace",
  7449. 0xff1a,
  7450. "colonsign",
  7451. 0x20a1,
  7452. "colonsmall",
  7453. 0xfe55,
  7454. "colontriangularhalfmod",
  7455. 0x02d1,
  7456. "colontriangularmod",
  7457. 0x02d0,
  7458. "comma",
  7459. 0x002c,
  7460. "commaabovecmb",
  7461. 0x0313,
  7462. "commaaboverightcmb",
  7463. 0x0315,
  7464. "commaaccent",
  7465. 0xf6c3,
  7466. "commaarabic",
  7467. 0x060c,
  7468. "commaarmenian",
  7469. 0x055d,
  7470. "commainferior",
  7471. 0xf6e1,
  7472. "commamonospace",
  7473. 0xff0c,
  7474. "commareversedabovecmb",
  7475. 0x0314,
  7476. "commareversedmod",
  7477. 0x02bd,
  7478. "commasmall",
  7479. 0xfe50,
  7480. "commasuperior",
  7481. 0xf6e2,
  7482. "commaturnedabovecmb",
  7483. 0x0312,
  7484. "commaturnedmod",
  7485. 0x02bb,
  7486. "compass",
  7487. 0x263c,
  7488. "congruent",
  7489. 0x2245,
  7490. "contourintegral",
  7491. 0x222e,
  7492. "control",
  7493. 0x2303,
  7494. "controlACK",
  7495. 0x0006,
  7496. "controlBEL",
  7497. 0x0007,
  7498. "controlBS",
  7499. 0x0008,
  7500. "controlCAN",
  7501. 0x0018,
  7502. "controlCR",
  7503. 0x000d,
  7504. "controlDC1",
  7505. 0x0011,
  7506. "controlDC2",
  7507. 0x0012,
  7508. "controlDC3",
  7509. 0x0013,
  7510. "controlDC4",
  7511. 0x0014,
  7512. "controlDEL",
  7513. 0x007f,
  7514. "controlDLE",
  7515. 0x0010,
  7516. "controlEM",
  7517. 0x0019,
  7518. "controlENQ",
  7519. 0x0005,
  7520. "controlEOT",
  7521. 0x0004,
  7522. "controlESC",
  7523. 0x001b,
  7524. "controlETB",
  7525. 0x0017,
  7526. "controlETX",
  7527. 0x0003,
  7528. "controlFF",
  7529. 0x000c,
  7530. "controlFS",
  7531. 0x001c,
  7532. "controlGS",
  7533. 0x001d,
  7534. "controlHT",
  7535. 0x0009,
  7536. "controlLF",
  7537. 0x000a,
  7538. "controlNAK",
  7539. 0x0015,
  7540. "controlNULL",
  7541. 0x0000,
  7542. "controlRS",
  7543. 0x001e,
  7544. "controlSI",
  7545. 0x000f,
  7546. "controlSO",
  7547. 0x000e,
  7548. "controlSOT",
  7549. 0x0002,
  7550. "controlSTX",
  7551. 0x0001,
  7552. "controlSUB",
  7553. 0x001a,
  7554. "controlSYN",
  7555. 0x0016,
  7556. "controlUS",
  7557. 0x001f,
  7558. "controlVT",
  7559. 0x000b,
  7560. "copyright",
  7561. 0x00a9,
  7562. "copyrightsans",
  7563. 0xf8e9,
  7564. "copyrightserif",
  7565. 0xf6d9,
  7566. "cornerbracketleft",
  7567. 0x300c,
  7568. "cornerbracketlefthalfwidth",
  7569. 0xff62,
  7570. "cornerbracketleftvertical",
  7571. 0xfe41,
  7572. "cornerbracketright",
  7573. 0x300d,
  7574. "cornerbracketrighthalfwidth",
  7575. 0xff63,
  7576. "cornerbracketrightvertical",
  7577. 0xfe42,
  7578. "corporationsquare",
  7579. 0x337f,
  7580. "cosquare",
  7581. 0x33c7,
  7582. "coverkgsquare",
  7583. 0x33c6,
  7584. "cparen",
  7585. 0x249e,
  7586. "cruzeiro",
  7587. 0x20a2,
  7588. "cstretched",
  7589. 0x0297,
  7590. "curlyand",
  7591. 0x22cf,
  7592. "curlyor",
  7593. 0x22ce,
  7594. "currency",
  7595. 0x00a4,
  7596. "cyrBreve",
  7597. 0xf6d1,
  7598. "cyrFlex",
  7599. 0xf6d2,
  7600. "cyrbreve",
  7601. 0xf6d4,
  7602. "cyrflex",
  7603. 0xf6d5,
  7604. "d",
  7605. 0x0064,
  7606. "daarmenian",
  7607. 0x0564,
  7608. "dabengali",
  7609. 0x09a6,
  7610. "dadarabic",
  7611. 0x0636,
  7612. "dadeva",
  7613. 0x0926,
  7614. "dadfinalarabic",
  7615. 0xfebe,
  7616. "dadinitialarabic",
  7617. 0xfebf,
  7618. "dadmedialarabic",
  7619. 0xfec0,
  7620. "dagesh",
  7621. 0x05bc,
  7622. "dageshhebrew",
  7623. 0x05bc,
  7624. "dagger",
  7625. 0x2020,
  7626. "daggerdbl",
  7627. 0x2021,
  7628. "dagujarati",
  7629. 0x0aa6,
  7630. "dagurmukhi",
  7631. 0x0a26,
  7632. "dahiragana",
  7633. 0x3060,
  7634. "dakatakana",
  7635. 0x30c0,
  7636. "dalarabic",
  7637. 0x062f,
  7638. "dalet",
  7639. 0x05d3,
  7640. "daletdagesh",
  7641. 0xfb33,
  7642. "daletdageshhebrew",
  7643. 0xfb33,
  7644. "dalethebrew",
  7645. 0x05d3,
  7646. "dalfinalarabic",
  7647. 0xfeaa,
  7648. "dammaarabic",
  7649. 0x064f,
  7650. "dammalowarabic",
  7651. 0x064f,
  7652. "dammatanaltonearabic",
  7653. 0x064c,
  7654. "dammatanarabic",
  7655. 0x064c,
  7656. "danda",
  7657. 0x0964,
  7658. "dargahebrew",
  7659. 0x05a7,
  7660. "dargalefthebrew",
  7661. 0x05a7,
  7662. "dasiapneumatacyrilliccmb",
  7663. 0x0485,
  7664. "dblGrave",
  7665. 0xf6d3,
  7666. "dblanglebracketleft",
  7667. 0x300a,
  7668. "dblanglebracketleftvertical",
  7669. 0xfe3d,
  7670. "dblanglebracketright",
  7671. 0x300b,
  7672. "dblanglebracketrightvertical",
  7673. 0xfe3e,
  7674. "dblarchinvertedbelowcmb",
  7675. 0x032b,
  7676. "dblarrowleft",
  7677. 0x21d4,
  7678. "dblarrowright",
  7679. 0x21d2,
  7680. "dbldanda",
  7681. 0x0965,
  7682. "dblgrave",
  7683. 0xf6d6,
  7684. "dblgravecmb",
  7685. 0x030f,
  7686. "dblintegral",
  7687. 0x222c,
  7688. "dbllowline",
  7689. 0x2017,
  7690. "dbllowlinecmb",
  7691. 0x0333,
  7692. "dbloverlinecmb",
  7693. 0x033f,
  7694. "dblprimemod",
  7695. 0x02ba,
  7696. "dblverticalbar",
  7697. 0x2016,
  7698. "dblverticallineabovecmb",
  7699. 0x030e,
  7700. "dbopomofo",
  7701. 0x3109,
  7702. "dbsquare",
  7703. 0x33c8,
  7704. "dcaron",
  7705. 0x010f,
  7706. "dcedilla",
  7707. 0x1e11,
  7708. "dcircle",
  7709. 0x24d3,
  7710. "dcircumflexbelow",
  7711. 0x1e13,
  7712. "dcroat",
  7713. 0x0111,
  7714. "ddabengali",
  7715. 0x09a1,
  7716. "ddadeva",
  7717. 0x0921,
  7718. "ddagujarati",
  7719. 0x0aa1,
  7720. "ddagurmukhi",
  7721. 0x0a21,
  7722. "ddalarabic",
  7723. 0x0688,
  7724. "ddalfinalarabic",
  7725. 0xfb89,
  7726. "dddhadeva",
  7727. 0x095c,
  7728. "ddhabengali",
  7729. 0x09a2,
  7730. "ddhadeva",
  7731. 0x0922,
  7732. "ddhagujarati",
  7733. 0x0aa2,
  7734. "ddhagurmukhi",
  7735. 0x0a22,
  7736. "ddotaccent",
  7737. 0x1e0b,
  7738. "ddotbelow",
  7739. 0x1e0d,
  7740. "decimalseparatorarabic",
  7741. 0x066b,
  7742. "decimalseparatorpersian",
  7743. 0x066b,
  7744. "decyrillic",
  7745. 0x0434,
  7746. "degree",
  7747. 0x00b0,
  7748. "dehihebrew",
  7749. 0x05ad,
  7750. "dehiragana",
  7751. 0x3067,
  7752. "deicoptic",
  7753. 0x03ef,
  7754. "dekatakana",
  7755. 0x30c7,
  7756. "deleteleft",
  7757. 0x232b,
  7758. "deleteright",
  7759. 0x2326,
  7760. "delta",
  7761. 0x03b4,
  7762. "deltaturned",
  7763. 0x018d,
  7764. "denominatorminusonenumeratorbengali",
  7765. 0x09f8,
  7766. "dezh",
  7767. 0x02a4,
  7768. "dhabengali",
  7769. 0x09a7,
  7770. "dhadeva",
  7771. 0x0927,
  7772. "dhagujarati",
  7773. 0x0aa7,
  7774. "dhagurmukhi",
  7775. 0x0a27,
  7776. "dhook",
  7777. 0x0257,
  7778. "dialytikatonos",
  7779. 0x0385,
  7780. "dialytikatonoscmb",
  7781. 0x0344,
  7782. "diamond",
  7783. 0x2666,
  7784. "diamondsuitwhite",
  7785. 0x2662,
  7786. "dieresis",
  7787. 0x00a8,
  7788. "dieresisacute",
  7789. 0xf6d7,
  7790. "dieresisbelowcmb",
  7791. 0x0324,
  7792. "dieresiscmb",
  7793. 0x0308,
  7794. "dieresisgrave",
  7795. 0xf6d8,
  7796. "dieresistonos",
  7797. 0x0385,
  7798. "dihiragana",
  7799. 0x3062,
  7800. "dikatakana",
  7801. 0x30c2,
  7802. "dittomark",
  7803. 0x3003,
  7804. "divide",
  7805. 0x00f7,
  7806. "divides",
  7807. 0x2223,
  7808. "divisionslash",
  7809. 0x2215,
  7810. "djecyrillic",
  7811. 0x0452,
  7812. "dkshade",
  7813. 0x2593,
  7814. "dlinebelow",
  7815. 0x1e0f,
  7816. "dlsquare",
  7817. 0x3397,
  7818. "dmacron",
  7819. 0x0111,
  7820. "dmonospace",
  7821. 0xff44,
  7822. "dnblock",
  7823. 0x2584,
  7824. "dochadathai",
  7825. 0x0e0e,
  7826. "dodekthai",
  7827. 0x0e14,
  7828. "dohiragana",
  7829. 0x3069,
  7830. "dokatakana",
  7831. 0x30c9,
  7832. "dollar",
  7833. 0x0024,
  7834. "dollarinferior",
  7835. 0xf6e3,
  7836. "dollarmonospace",
  7837. 0xff04,
  7838. "dollaroldstyle",
  7839. 0xf724,
  7840. "dollarsmall",
  7841. 0xfe69,
  7842. "dollarsuperior",
  7843. 0xf6e4,
  7844. "dong",
  7845. 0x20ab,
  7846. "dorusquare",
  7847. 0x3326,
  7848. "dotaccent",
  7849. 0x02d9,
  7850. "dotaccentcmb",
  7851. 0x0307,
  7852. "dotbelowcmb",
  7853. 0x0323,
  7854. "dotbelowcomb",
  7855. 0x0323,
  7856. "dotkatakana",
  7857. 0x30fb,
  7858. "dotlessi",
  7859. 0x0131,
  7860. "dotlessj",
  7861. 0xf6be,
  7862. "dotlessjstrokehook",
  7863. 0x0284,
  7864. "dotmath",
  7865. 0x22c5,
  7866. "dottedcircle",
  7867. 0x25cc,
  7868. "doubleyodpatah",
  7869. 0xfb1f,
  7870. "doubleyodpatahhebrew",
  7871. 0xfb1f,
  7872. "downtackbelowcmb",
  7873. 0x031e,
  7874. "downtackmod",
  7875. 0x02d5,
  7876. "dparen",
  7877. 0x249f,
  7878. "dsuperior",
  7879. 0xf6eb,
  7880. "dtail",
  7881. 0x0256,
  7882. "dtopbar",
  7883. 0x018c,
  7884. "duhiragana",
  7885. 0x3065,
  7886. "dukatakana",
  7887. 0x30c5,
  7888. "dz",
  7889. 0x01f3,
  7890. "dzaltone",
  7891. 0x02a3,
  7892. "dzcaron",
  7893. 0x01c6,
  7894. "dzcurl",
  7895. 0x02a5,
  7896. "dzeabkhasiancyrillic",
  7897. 0x04e1,
  7898. "dzecyrillic",
  7899. 0x0455,
  7900. "dzhecyrillic",
  7901. 0x045f,
  7902. "e",
  7903. 0x0065,
  7904. "eacute",
  7905. 0x00e9,
  7906. "earth",
  7907. 0x2641,
  7908. "ebengali",
  7909. 0x098f,
  7910. "ebopomofo",
  7911. 0x311c,
  7912. "ebreve",
  7913. 0x0115,
  7914. "ecandradeva",
  7915. 0x090d,
  7916. "ecandragujarati",
  7917. 0x0a8d,
  7918. "ecandravowelsigndeva",
  7919. 0x0945,
  7920. "ecandravowelsigngujarati",
  7921. 0x0ac5,
  7922. "ecaron",
  7923. 0x011b,
  7924. "ecedillabreve",
  7925. 0x1e1d,
  7926. "echarmenian",
  7927. 0x0565,
  7928. "echyiwnarmenian",
  7929. 0x0587,
  7930. "ecircle",
  7931. 0x24d4,
  7932. "ecircumflex",
  7933. 0x00ea,
  7934. "ecircumflexacute",
  7935. 0x1ebf,
  7936. "ecircumflexbelow",
  7937. 0x1e19,
  7938. "ecircumflexdotbelow",
  7939. 0x1ec7,
  7940. "ecircumflexgrave",
  7941. 0x1ec1,
  7942. "ecircumflexhookabove",
  7943. 0x1ec3,
  7944. "ecircumflextilde",
  7945. 0x1ec5,
  7946. "ecyrillic",
  7947. 0x0454,
  7948. "edblgrave",
  7949. 0x0205,
  7950. "edeva",
  7951. 0x090f,
  7952. "edieresis",
  7953. 0x00eb,
  7954. "edot",
  7955. 0x0117,
  7956. "edotaccent",
  7957. 0x0117,
  7958. "edotbelow",
  7959. 0x1eb9,
  7960. "eegurmukhi",
  7961. 0x0a0f,
  7962. "eematragurmukhi",
  7963. 0x0a47,
  7964. "efcyrillic",
  7965. 0x0444,
  7966. "egrave",
  7967. 0x00e8,
  7968. "egujarati",
  7969. 0x0a8f,
  7970. "eharmenian",
  7971. 0x0567,
  7972. "ehbopomofo",
  7973. 0x311d,
  7974. "ehiragana",
  7975. 0x3048,
  7976. "ehookabove",
  7977. 0x1ebb,
  7978. "eibopomofo",
  7979. 0x311f,
  7980. "eight",
  7981. 0x0038,
  7982. "eightarabic",
  7983. 0x0668,
  7984. "eightbengali",
  7985. 0x09ee,
  7986. "eightcircle",
  7987. 0x2467,
  7988. "eightcircleinversesansserif",
  7989. 0x2791,
  7990. "eightdeva",
  7991. 0x096e,
  7992. "eighteencircle",
  7993. 0x2471,
  7994. "eighteenparen",
  7995. 0x2485,
  7996. "eighteenperiod",
  7997. 0x2499,
  7998. "eightgujarati",
  7999. 0x0aee,
  8000. "eightgurmukhi",
  8001. 0x0a6e,
  8002. "eighthackarabic",
  8003. 0x0668,
  8004. "eighthangzhou",
  8005. 0x3028,
  8006. "eighthnotebeamed",
  8007. 0x266b,
  8008. "eightideographicparen",
  8009. 0x3227,
  8010. "eightinferior",
  8011. 0x2088,
  8012. "eightmonospace",
  8013. 0xff18,
  8014. "eightoldstyle",
  8015. 0xf738,
  8016. "eightparen",
  8017. 0x247b,
  8018. "eightperiod",
  8019. 0x248f,
  8020. "eightpersian",
  8021. 0x06f8,
  8022. "eightroman",
  8023. 0x2177,
  8024. "eightsuperior",
  8025. 0x2078,
  8026. "eightthai",
  8027. 0x0e58,
  8028. "einvertedbreve",
  8029. 0x0207,
  8030. "eiotifiedcyrillic",
  8031. 0x0465,
  8032. "ekatakana",
  8033. 0x30a8,
  8034. "ekatakanahalfwidth",
  8035. 0xff74,
  8036. "ekonkargurmukhi",
  8037. 0x0a74,
  8038. "ekorean",
  8039. 0x3154,
  8040. "elcyrillic",
  8041. 0x043b,
  8042. "element",
  8043. 0x2208,
  8044. "elevencircle",
  8045. 0x246a,
  8046. "elevenparen",
  8047. 0x247e,
  8048. "elevenperiod",
  8049. 0x2492,
  8050. "elevenroman",
  8051. 0x217a,
  8052. "ellipsis",
  8053. 0x2026,
  8054. "ellipsisvertical",
  8055. 0x22ee,
  8056. "emacron",
  8057. 0x0113,
  8058. "emacronacute",
  8059. 0x1e17,
  8060. "emacrongrave",
  8061. 0x1e15,
  8062. "emcyrillic",
  8063. 0x043c,
  8064. "emdash",
  8065. 0x2014,
  8066. "emdashvertical",
  8067. 0xfe31,
  8068. "emonospace",
  8069. 0xff45,
  8070. "emphasismarkarmenian",
  8071. 0x055b,
  8072. "emptyset",
  8073. 0x2205,
  8074. "enbopomofo",
  8075. 0x3123,
  8076. "encyrillic",
  8077. 0x043d,
  8078. "endash",
  8079. 0x2013,
  8080. "endashvertical",
  8081. 0xfe32,
  8082. "endescendercyrillic",
  8083. 0x04a3,
  8084. "eng",
  8085. 0x014b,
  8086. "engbopomofo",
  8087. 0x3125,
  8088. "enghecyrillic",
  8089. 0x04a5,
  8090. "enhookcyrillic",
  8091. 0x04c8,
  8092. "enspace",
  8093. 0x2002,
  8094. "eogonek",
  8095. 0x0119,
  8096. "eokorean",
  8097. 0x3153,
  8098. "eopen",
  8099. 0x025b,
  8100. "eopenclosed",
  8101. 0x029a,
  8102. "eopenreversed",
  8103. 0x025c,
  8104. "eopenreversedclosed",
  8105. 0x025e,
  8106. "eopenreversedhook",
  8107. 0x025d,
  8108. "eparen",
  8109. 0x24a0,
  8110. "epsilon",
  8111. 0x03b5,
  8112. "epsilontonos",
  8113. 0x03ad,
  8114. "equal",
  8115. 0x003d,
  8116. "equalmonospace",
  8117. 0xff1d,
  8118. "equalsmall",
  8119. 0xfe66,
  8120. "equalsuperior",
  8121. 0x207c,
  8122. "equivalence",
  8123. 0x2261,
  8124. "erbopomofo",
  8125. 0x3126,
  8126. "ercyrillic",
  8127. 0x0440,
  8128. "ereversed",
  8129. 0x0258,
  8130. "ereversedcyrillic",
  8131. 0x044d,
  8132. "escyrillic",
  8133. 0x0441,
  8134. "esdescendercyrillic",
  8135. 0x04ab,
  8136. "esh",
  8137. 0x0283,
  8138. "eshcurl",
  8139. 0x0286,
  8140. "eshortdeva",
  8141. 0x090e,
  8142. "eshortvowelsigndeva",
  8143. 0x0946,
  8144. "eshreversedloop",
  8145. 0x01aa,
  8146. "eshsquatreversed",
  8147. 0x0285,
  8148. "esmallhiragana",
  8149. 0x3047,
  8150. "esmallkatakana",
  8151. 0x30a7,
  8152. "esmallkatakanahalfwidth",
  8153. 0xff6a,
  8154. "estimated",
  8155. 0x212e,
  8156. "esuperior",
  8157. 0xf6ec,
  8158. "eta",
  8159. 0x03b7,
  8160. "etarmenian",
  8161. 0x0568,
  8162. "etatonos",
  8163. 0x03ae,
  8164. "eth",
  8165. 0x00f0,
  8166. "etilde",
  8167. 0x1ebd,
  8168. "etildebelow",
  8169. 0x1e1b,
  8170. "etnahtafoukhhebrew",
  8171. 0x0591,
  8172. "etnahtafoukhlefthebrew",
  8173. 0x0591,
  8174. "etnahtahebrew",
  8175. 0x0591,
  8176. "etnahtalefthebrew",
  8177. 0x0591,
  8178. "eturned",
  8179. 0x01dd,
  8180. "eukorean",
  8181. 0x3161,
  8182. "euro",
  8183. 0x20ac,
  8184. "evowelsignbengali",
  8185. 0x09c7,
  8186. "evowelsigndeva",
  8187. 0x0947,
  8188. "evowelsigngujarati",
  8189. 0x0ac7,
  8190. "exclam",
  8191. 0x0021,
  8192. "exclamarmenian",
  8193. 0x055c,
  8194. "exclamdbl",
  8195. 0x203c,
  8196. "exclamdown",
  8197. 0x00a1,
  8198. "exclamdownsmall",
  8199. 0xf7a1,
  8200. "exclammonospace",
  8201. 0xff01,
  8202. "exclamsmall",
  8203. 0xf721,
  8204. "existential",
  8205. 0x2203,
  8206. "ezh",
  8207. 0x0292,
  8208. "ezhcaron",
  8209. 0x01ef,
  8210. "ezhcurl",
  8211. 0x0293,
  8212. "ezhreversed",
  8213. 0x01b9,
  8214. "ezhtail",
  8215. 0x01ba,
  8216. "f",
  8217. 0x0066,
  8218. "fadeva",
  8219. 0x095e,
  8220. "fagurmukhi",
  8221. 0x0a5e,
  8222. "fahrenheit",
  8223. 0x2109,
  8224. "fathaarabic",
  8225. 0x064e,
  8226. "fathalowarabic",
  8227. 0x064e,
  8228. "fathatanarabic",
  8229. 0x064b,
  8230. "fbopomofo",
  8231. 0x3108,
  8232. "fcircle",
  8233. 0x24d5,
  8234. "fdotaccent",
  8235. 0x1e1f,
  8236. "feharabic",
  8237. 0x0641,
  8238. "feharmenian",
  8239. 0x0586,
  8240. "fehfinalarabic",
  8241. 0xfed2,
  8242. "fehinitialarabic",
  8243. 0xfed3,
  8244. "fehmedialarabic",
  8245. 0xfed4,
  8246. "feicoptic",
  8247. 0x03e5,
  8248. "female",
  8249. 0x2640,
  8250. "ff",
  8251. 0xfb00,
  8252. "f_f",
  8253. 0xfb00,
  8254. "ffi",
  8255. 0xfb03,
  8256. "ffl",
  8257. 0xfb04,
  8258. "fi",
  8259. 0xfb01,
  8260. "fifteencircle",
  8261. 0x246e,
  8262. "fifteenparen",
  8263. 0x2482,
  8264. "fifteenperiod",
  8265. 0x2496,
  8266. "figuredash",
  8267. 0x2012,
  8268. "filledbox",
  8269. 0x25a0,
  8270. "filledrect",
  8271. 0x25ac,
  8272. "finalkaf",
  8273. 0x05da,
  8274. "finalkafdagesh",
  8275. 0xfb3a,
  8276. "finalkafdageshhebrew",
  8277. 0xfb3a,
  8278. "finalkafhebrew",
  8279. 0x05da,
  8280. "finalmem",
  8281. 0x05dd,
  8282. "finalmemhebrew",
  8283. 0x05dd,
  8284. "finalnun",
  8285. 0x05df,
  8286. "finalnunhebrew",
  8287. 0x05df,
  8288. "finalpe",
  8289. 0x05e3,
  8290. "finalpehebrew",
  8291. 0x05e3,
  8292. "finaltsadi",
  8293. 0x05e5,
  8294. "finaltsadihebrew",
  8295. 0x05e5,
  8296. "firsttonechinese",
  8297. 0x02c9,
  8298. "fisheye",
  8299. 0x25c9,
  8300. "fitacyrillic",
  8301. 0x0473,
  8302. "five",
  8303. 0x0035,
  8304. "fivearabic",
  8305. 0x0665,
  8306. "fivebengali",
  8307. 0x09eb,
  8308. "fivecircle",
  8309. 0x2464,
  8310. "fivecircleinversesansserif",
  8311. 0x278e,
  8312. "fivedeva",
  8313. 0x096b,
  8314. "fiveeighths",
  8315. 0x215d,
  8316. "fivegujarati",
  8317. 0x0aeb,
  8318. "fivegurmukhi",
  8319. 0x0a6b,
  8320. "fivehackarabic",
  8321. 0x0665,
  8322. "fivehangzhou",
  8323. 0x3025,
  8324. "fiveideographicparen",
  8325. 0x3224,
  8326. "fiveinferior",
  8327. 0x2085,
  8328. "fivemonospace",
  8329. 0xff15,
  8330. "fiveoldstyle",
  8331. 0xf735,
  8332. "fiveparen",
  8333. 0x2478,
  8334. "fiveperiod",
  8335. 0x248c,
  8336. "fivepersian",
  8337. 0x06f5,
  8338. "fiveroman",
  8339. 0x2174,
  8340. "fivesuperior",
  8341. 0x2075,
  8342. "fivethai",
  8343. 0x0e55,
  8344. "fl",
  8345. 0xfb02,
  8346. "florin",
  8347. 0x0192,
  8348. "fmonospace",
  8349. 0xff46,
  8350. "fmsquare",
  8351. 0x3399,
  8352. "fofanthai",
  8353. 0x0e1f,
  8354. "fofathai",
  8355. 0x0e1d,
  8356. "fongmanthai",
  8357. 0x0e4f,
  8358. "forall",
  8359. 0x2200,
  8360. "four",
  8361. 0x0034,
  8362. "fourarabic",
  8363. 0x0664,
  8364. "fourbengali",
  8365. 0x09ea,
  8366. "fourcircle",
  8367. 0x2463,
  8368. "fourcircleinversesansserif",
  8369. 0x278d,
  8370. "fourdeva",
  8371. 0x096a,
  8372. "fourgujarati",
  8373. 0x0aea,
  8374. "fourgurmukhi",
  8375. 0x0a6a,
  8376. "fourhackarabic",
  8377. 0x0664,
  8378. "fourhangzhou",
  8379. 0x3024,
  8380. "fourideographicparen",
  8381. 0x3223,
  8382. "fourinferior",
  8383. 0x2084,
  8384. "fourmonospace",
  8385. 0xff14,
  8386. "fournumeratorbengali",
  8387. 0x09f7,
  8388. "fouroldstyle",
  8389. 0xf734,
  8390. "fourparen",
  8391. 0x2477,
  8392. "fourperiod",
  8393. 0x248b,
  8394. "fourpersian",
  8395. 0x06f4,
  8396. "fourroman",
  8397. 0x2173,
  8398. "foursuperior",
  8399. 0x2074,
  8400. "fourteencircle",
  8401. 0x246d,
  8402. "fourteenparen",
  8403. 0x2481,
  8404. "fourteenperiod",
  8405. 0x2495,
  8406. "fourthai",
  8407. 0x0e54,
  8408. "fourthtonechinese",
  8409. 0x02cb,
  8410. "fparen",
  8411. 0x24a1,
  8412. "fraction",
  8413. 0x2044,
  8414. "franc",
  8415. 0x20a3,
  8416. "g",
  8417. 0x0067,
  8418. "gabengali",
  8419. 0x0997,
  8420. "gacute",
  8421. 0x01f5,
  8422. "gadeva",
  8423. 0x0917,
  8424. "gafarabic",
  8425. 0x06af,
  8426. "gaffinalarabic",
  8427. 0xfb93,
  8428. "gafinitialarabic",
  8429. 0xfb94,
  8430. "gafmedialarabic",
  8431. 0xfb95,
  8432. "gagujarati",
  8433. 0x0a97,
  8434. "gagurmukhi",
  8435. 0x0a17,
  8436. "gahiragana",
  8437. 0x304c,
  8438. "gakatakana",
  8439. 0x30ac,
  8440. "gamma",
  8441. 0x03b3,
  8442. "gammalatinsmall",
  8443. 0x0263,
  8444. "gammasuperior",
  8445. 0x02e0,
  8446. "gangiacoptic",
  8447. 0x03eb,
  8448. "gbopomofo",
  8449. 0x310d,
  8450. "gbreve",
  8451. 0x011f,
  8452. "gcaron",
  8453. 0x01e7,
  8454. "gcedilla",
  8455. 0x0123,
  8456. "gcircle",
  8457. 0x24d6,
  8458. "gcircumflex",
  8459. 0x011d,
  8460. "gcommaaccent",
  8461. 0x0123,
  8462. "gdot",
  8463. 0x0121,
  8464. "gdotaccent",
  8465. 0x0121,
  8466. "gecyrillic",
  8467. 0x0433,
  8468. "gehiragana",
  8469. 0x3052,
  8470. "gekatakana",
  8471. 0x30b2,
  8472. "geometricallyequal",
  8473. 0x2251,
  8474. "gereshaccenthebrew",
  8475. 0x059c,
  8476. "gereshhebrew",
  8477. 0x05f3,
  8478. "gereshmuqdamhebrew",
  8479. 0x059d,
  8480. "germandbls",
  8481. 0x00df,
  8482. "gershayimaccenthebrew",
  8483. 0x059e,
  8484. "gershayimhebrew",
  8485. 0x05f4,
  8486. "getamark",
  8487. 0x3013,
  8488. "ghabengali",
  8489. 0x0998,
  8490. "ghadarmenian",
  8491. 0x0572,
  8492. "ghadeva",
  8493. 0x0918,
  8494. "ghagujarati",
  8495. 0x0a98,
  8496. "ghagurmukhi",
  8497. 0x0a18,
  8498. "ghainarabic",
  8499. 0x063a,
  8500. "ghainfinalarabic",
  8501. 0xfece,
  8502. "ghaininitialarabic",
  8503. 0xfecf,
  8504. "ghainmedialarabic",
  8505. 0xfed0,
  8506. "ghemiddlehookcyrillic",
  8507. 0x0495,
  8508. "ghestrokecyrillic",
  8509. 0x0493,
  8510. "gheupturncyrillic",
  8511. 0x0491,
  8512. "ghhadeva",
  8513. 0x095a,
  8514. "ghhagurmukhi",
  8515. 0x0a5a,
  8516. "ghook",
  8517. 0x0260,
  8518. "ghzsquare",
  8519. 0x3393,
  8520. "gihiragana",
  8521. 0x304e,
  8522. "gikatakana",
  8523. 0x30ae,
  8524. "gimarmenian",
  8525. 0x0563,
  8526. "gimel",
  8527. 0x05d2,
  8528. "gimeldagesh",
  8529. 0xfb32,
  8530. "gimeldageshhebrew",
  8531. 0xfb32,
  8532. "gimelhebrew",
  8533. 0x05d2,
  8534. "gjecyrillic",
  8535. 0x0453,
  8536. "glottalinvertedstroke",
  8537. 0x01be,
  8538. "glottalstop",
  8539. 0x0294,
  8540. "glottalstopinverted",
  8541. 0x0296,
  8542. "glottalstopmod",
  8543. 0x02c0,
  8544. "glottalstopreversed",
  8545. 0x0295,
  8546. "glottalstopreversedmod",
  8547. 0x02c1,
  8548. "glottalstopreversedsuperior",
  8549. 0x02e4,
  8550. "glottalstopstroke",
  8551. 0x02a1,
  8552. "glottalstopstrokereversed",
  8553. 0x02a2,
  8554. "gmacron",
  8555. 0x1e21,
  8556. "gmonospace",
  8557. 0xff47,
  8558. "gohiragana",
  8559. 0x3054,
  8560. "gokatakana",
  8561. 0x30b4,
  8562. "gparen",
  8563. 0x24a2,
  8564. "gpasquare",
  8565. 0x33ac,
  8566. "gradient",
  8567. 0x2207,
  8568. "grave",
  8569. 0x0060,
  8570. "gravebelowcmb",
  8571. 0x0316,
  8572. "gravecmb",
  8573. 0x0300,
  8574. "gravecomb",
  8575. 0x0300,
  8576. "gravedeva",
  8577. 0x0953,
  8578. "gravelowmod",
  8579. 0x02ce,
  8580. "gravemonospace",
  8581. 0xff40,
  8582. "gravetonecmb",
  8583. 0x0340,
  8584. "greater",
  8585. 0x003e,
  8586. "greaterequal",
  8587. 0x2265,
  8588. "greaterequalorless",
  8589. 0x22db,
  8590. "greatermonospace",
  8591. 0xff1e,
  8592. "greaterorequivalent",
  8593. 0x2273,
  8594. "greaterorless",
  8595. 0x2277,
  8596. "greateroverequal",
  8597. 0x2267,
  8598. "greatersmall",
  8599. 0xfe65,
  8600. "gscript",
  8601. 0x0261,
  8602. "gstroke",
  8603. 0x01e5,
  8604. "guhiragana",
  8605. 0x3050,
  8606. "guillemotleft",
  8607. 0x00ab,
  8608. "guillemotright",
  8609. 0x00bb,
  8610. "guilsinglleft",
  8611. 0x2039,
  8612. "guilsinglright",
  8613. 0x203a,
  8614. "gukatakana",
  8615. 0x30b0,
  8616. "guramusquare",
  8617. 0x3318,
  8618. "gysquare",
  8619. 0x33c9,
  8620. "h",
  8621. 0x0068,
  8622. "haabkhasiancyrillic",
  8623. 0x04a9,
  8624. "haaltonearabic",
  8625. 0x06c1,
  8626. "habengali",
  8627. 0x09b9,
  8628. "hadescendercyrillic",
  8629. 0x04b3,
  8630. "hadeva",
  8631. 0x0939,
  8632. "hagujarati",
  8633. 0x0ab9,
  8634. "hagurmukhi",
  8635. 0x0a39,
  8636. "haharabic",
  8637. 0x062d,
  8638. "hahfinalarabic",
  8639. 0xfea2,
  8640. "hahinitialarabic",
  8641. 0xfea3,
  8642. "hahiragana",
  8643. 0x306f,
  8644. "hahmedialarabic",
  8645. 0xfea4,
  8646. "haitusquare",
  8647. 0x332a,
  8648. "hakatakana",
  8649. 0x30cf,
  8650. "hakatakanahalfwidth",
  8651. 0xff8a,
  8652. "halantgurmukhi",
  8653. 0x0a4d,
  8654. "hamzaarabic",
  8655. 0x0621,
  8656. "hamzalowarabic",
  8657. 0x0621,
  8658. "hangulfiller",
  8659. 0x3164,
  8660. "hardsigncyrillic",
  8661. 0x044a,
  8662. "harpoonleftbarbup",
  8663. 0x21bc,
  8664. "harpoonrightbarbup",
  8665. 0x21c0,
  8666. "hasquare",
  8667. 0x33ca,
  8668. "hatafpatah",
  8669. 0x05b2,
  8670. "hatafpatah16",
  8671. 0x05b2,
  8672. "hatafpatah23",
  8673. 0x05b2,
  8674. "hatafpatah2f",
  8675. 0x05b2,
  8676. "hatafpatahhebrew",
  8677. 0x05b2,
  8678. "hatafpatahnarrowhebrew",
  8679. 0x05b2,
  8680. "hatafpatahquarterhebrew",
  8681. 0x05b2,
  8682. "hatafpatahwidehebrew",
  8683. 0x05b2,
  8684. "hatafqamats",
  8685. 0x05b3,
  8686. "hatafqamats1b",
  8687. 0x05b3,
  8688. "hatafqamats28",
  8689. 0x05b3,
  8690. "hatafqamats34",
  8691. 0x05b3,
  8692. "hatafqamatshebrew",
  8693. 0x05b3,
  8694. "hatafqamatsnarrowhebrew",
  8695. 0x05b3,
  8696. "hatafqamatsquarterhebrew",
  8697. 0x05b3,
  8698. "hatafqamatswidehebrew",
  8699. 0x05b3,
  8700. "hatafsegol",
  8701. 0x05b1,
  8702. "hatafsegol17",
  8703. 0x05b1,
  8704. "hatafsegol24",
  8705. 0x05b1,
  8706. "hatafsegol30",
  8707. 0x05b1,
  8708. "hatafsegolhebrew",
  8709. 0x05b1,
  8710. "hatafsegolnarrowhebrew",
  8711. 0x05b1,
  8712. "hatafsegolquarterhebrew",
  8713. 0x05b1,
  8714. "hatafsegolwidehebrew",
  8715. 0x05b1,
  8716. "hbar",
  8717. 0x0127,
  8718. "hbopomofo",
  8719. 0x310f,
  8720. "hbrevebelow",
  8721. 0x1e2b,
  8722. "hcedilla",
  8723. 0x1e29,
  8724. "hcircle",
  8725. 0x24d7,
  8726. "hcircumflex",
  8727. 0x0125,
  8728. "hdieresis",
  8729. 0x1e27,
  8730. "hdotaccent",
  8731. 0x1e23,
  8732. "hdotbelow",
  8733. 0x1e25,
  8734. "he",
  8735. 0x05d4,
  8736. "heart",
  8737. 0x2665,
  8738. "heartsuitblack",
  8739. 0x2665,
  8740. "heartsuitwhite",
  8741. 0x2661,
  8742. "hedagesh",
  8743. 0xfb34,
  8744. "hedageshhebrew",
  8745. 0xfb34,
  8746. "hehaltonearabic",
  8747. 0x06c1,
  8748. "heharabic",
  8749. 0x0647,
  8750. "hehebrew",
  8751. 0x05d4,
  8752. "hehfinalaltonearabic",
  8753. 0xfba7,
  8754. "hehfinalalttwoarabic",
  8755. 0xfeea,
  8756. "hehfinalarabic",
  8757. 0xfeea,
  8758. "hehhamzaabovefinalarabic",
  8759. 0xfba5,
  8760. "hehhamzaaboveisolatedarabic",
  8761. 0xfba4,
  8762. "hehinitialaltonearabic",
  8763. 0xfba8,
  8764. "hehinitialarabic",
  8765. 0xfeeb,
  8766. "hehiragana",
  8767. 0x3078,
  8768. "hehmedialaltonearabic",
  8769. 0xfba9,
  8770. "hehmedialarabic",
  8771. 0xfeec,
  8772. "heiseierasquare",
  8773. 0x337b,
  8774. "hekatakana",
  8775. 0x30d8,
  8776. "hekatakanahalfwidth",
  8777. 0xff8d,
  8778. "hekutaarusquare",
  8779. 0x3336,
  8780. "henghook",
  8781. 0x0267,
  8782. "herutusquare",
  8783. 0x3339,
  8784. "het",
  8785. 0x05d7,
  8786. "hethebrew",
  8787. 0x05d7,
  8788. "hhook",
  8789. 0x0266,
  8790. "hhooksuperior",
  8791. 0x02b1,
  8792. "hieuhacirclekorean",
  8793. 0x327b,
  8794. "hieuhaparenkorean",
  8795. 0x321b,
  8796. "hieuhcirclekorean",
  8797. 0x326d,
  8798. "hieuhkorean",
  8799. 0x314e,
  8800. "hieuhparenkorean",
  8801. 0x320d,
  8802. "hihiragana",
  8803. 0x3072,
  8804. "hikatakana",
  8805. 0x30d2,
  8806. "hikatakanahalfwidth",
  8807. 0xff8b,
  8808. "hiriq",
  8809. 0x05b4,
  8810. "hiriq14",
  8811. 0x05b4,
  8812. "hiriq21",
  8813. 0x05b4,
  8814. "hiriq2d",
  8815. 0x05b4,
  8816. "hiriqhebrew",
  8817. 0x05b4,
  8818. "hiriqnarrowhebrew",
  8819. 0x05b4,
  8820. "hiriqquarterhebrew",
  8821. 0x05b4,
  8822. "hiriqwidehebrew",
  8823. 0x05b4,
  8824. "hlinebelow",
  8825. 0x1e96,
  8826. "hmonospace",
  8827. 0xff48,
  8828. "hoarmenian",
  8829. 0x0570,
  8830. "hohipthai",
  8831. 0x0e2b,
  8832. "hohiragana",
  8833. 0x307b,
  8834. "hokatakana",
  8835. 0x30db,
  8836. "hokatakanahalfwidth",
  8837. 0xff8e,
  8838. "holam",
  8839. 0x05b9,
  8840. "holam19",
  8841. 0x05b9,
  8842. "holam26",
  8843. 0x05b9,
  8844. "holam32",
  8845. 0x05b9,
  8846. "holamhebrew",
  8847. 0x05b9,
  8848. "holamnarrowhebrew",
  8849. 0x05b9,
  8850. "holamquarterhebrew",
  8851. 0x05b9,
  8852. "holamwidehebrew",
  8853. 0x05b9,
  8854. "honokhukthai",
  8855. 0x0e2e,
  8856. "hookabovecomb",
  8857. 0x0309,
  8858. "hookcmb",
  8859. 0x0309,
  8860. "hookpalatalizedbelowcmb",
  8861. 0x0321,
  8862. "hookretroflexbelowcmb",
  8863. 0x0322,
  8864. "hoonsquare",
  8865. 0x3342,
  8866. "horicoptic",
  8867. 0x03e9,
  8868. "horizontalbar",
  8869. 0x2015,
  8870. "horncmb",
  8871. 0x031b,
  8872. "hotsprings",
  8873. 0x2668,
  8874. "house",
  8875. 0x2302,
  8876. "hparen",
  8877. 0x24a3,
  8878. "hsuperior",
  8879. 0x02b0,
  8880. "hturned",
  8881. 0x0265,
  8882. "huhiragana",
  8883. 0x3075,
  8884. "huiitosquare",
  8885. 0x3333,
  8886. "hukatakana",
  8887. 0x30d5,
  8888. "hukatakanahalfwidth",
  8889. 0xff8c,
  8890. "hungarumlaut",
  8891. 0x02dd,
  8892. "hungarumlautcmb",
  8893. 0x030b,
  8894. "hv",
  8895. 0x0195,
  8896. "hyphen",
  8897. 0x002d,
  8898. "hypheninferior",
  8899. 0xf6e5,
  8900. "hyphenmonospace",
  8901. 0xff0d,
  8902. "hyphensmall",
  8903. 0xfe63,
  8904. "hyphensuperior",
  8905. 0xf6e6,
  8906. "hyphentwo",
  8907. 0x2010,
  8908. "i",
  8909. 0x0069,
  8910. "iacute",
  8911. 0x00ed,
  8912. "iacyrillic",
  8913. 0x044f,
  8914. "ibengali",
  8915. 0x0987,
  8916. "ibopomofo",
  8917. 0x3127,
  8918. "ibreve",
  8919. 0x012d,
  8920. "icaron",
  8921. 0x01d0,
  8922. "icircle",
  8923. 0x24d8,
  8924. "icircumflex",
  8925. 0x00ee,
  8926. "icyrillic",
  8927. 0x0456,
  8928. "idblgrave",
  8929. 0x0209,
  8930. "ideographearthcircle",
  8931. 0x328f,
  8932. "ideographfirecircle",
  8933. 0x328b,
  8934. "ideographicallianceparen",
  8935. 0x323f,
  8936. "ideographiccallparen",
  8937. 0x323a,
  8938. "ideographiccentrecircle",
  8939. 0x32a5,
  8940. "ideographicclose",
  8941. 0x3006,
  8942. "ideographiccomma",
  8943. 0x3001,
  8944. "ideographiccommaleft",
  8945. 0xff64,
  8946. "ideographiccongratulationparen",
  8947. 0x3237,
  8948. "ideographiccorrectcircle",
  8949. 0x32a3,
  8950. "ideographicearthparen",
  8951. 0x322f,
  8952. "ideographicenterpriseparen",
  8953. 0x323d,
  8954. "ideographicexcellentcircle",
  8955. 0x329d,
  8956. "ideographicfestivalparen",
  8957. 0x3240,
  8958. "ideographicfinancialcircle",
  8959. 0x3296,
  8960. "ideographicfinancialparen",
  8961. 0x3236,
  8962. "ideographicfireparen",
  8963. 0x322b,
  8964. "ideographichaveparen",
  8965. 0x3232,
  8966. "ideographichighcircle",
  8967. 0x32a4,
  8968. "ideographiciterationmark",
  8969. 0x3005,
  8970. "ideographiclaborcircle",
  8971. 0x3298,
  8972. "ideographiclaborparen",
  8973. 0x3238,
  8974. "ideographicleftcircle",
  8975. 0x32a7,
  8976. "ideographiclowcircle",
  8977. 0x32a6,
  8978. "ideographicmedicinecircle",
  8979. 0x32a9,
  8980. "ideographicmetalparen",
  8981. 0x322e,
  8982. "ideographicmoonparen",
  8983. 0x322a,
  8984. "ideographicnameparen",
  8985. 0x3234,
  8986. "ideographicperiod",
  8987. 0x3002,
  8988. "ideographicprintcircle",
  8989. 0x329e,
  8990. "ideographicreachparen",
  8991. 0x3243,
  8992. "ideographicrepresentparen",
  8993. 0x3239,
  8994. "ideographicresourceparen",
  8995. 0x323e,
  8996. "ideographicrightcircle",
  8997. 0x32a8,
  8998. "ideographicsecretcircle",
  8999. 0x3299,
  9000. "ideographicselfparen",
  9001. 0x3242,
  9002. "ideographicsocietyparen",
  9003. 0x3233,
  9004. "ideographicspace",
  9005. 0x3000,
  9006. "ideographicspecialparen",
  9007. 0x3235,
  9008. "ideographicstockparen",
  9009. 0x3231,
  9010. "ideographicstudyparen",
  9011. 0x323b,
  9012. "ideographicsunparen",
  9013. 0x3230,
  9014. "ideographicsuperviseparen",
  9015. 0x323c,
  9016. "ideographicwaterparen",
  9017. 0x322c,
  9018. "ideographicwoodparen",
  9019. 0x322d,
  9020. "ideographiczero",
  9021. 0x3007,
  9022. "ideographmetalcircle",
  9023. 0x328e,
  9024. "ideographmooncircle",
  9025. 0x328a,
  9026. "ideographnamecircle",
  9027. 0x3294,
  9028. "ideographsuncircle",
  9029. 0x3290,
  9030. "ideographwatercircle",
  9031. 0x328c,
  9032. "ideographwoodcircle",
  9033. 0x328d,
  9034. "ideva",
  9035. 0x0907,
  9036. "idieresis",
  9037. 0x00ef,
  9038. "idieresisacute",
  9039. 0x1e2f,
  9040. "idieresiscyrillic",
  9041. 0x04e5,
  9042. "idotbelow",
  9043. 0x1ecb,
  9044. "iebrevecyrillic",
  9045. 0x04d7,
  9046. "iecyrillic",
  9047. 0x0435,
  9048. "ieungacirclekorean",
  9049. 0x3275,
  9050. "ieungaparenkorean",
  9051. 0x3215,
  9052. "ieungcirclekorean",
  9053. 0x3267,
  9054. "ieungkorean",
  9055. 0x3147,
  9056. "ieungparenkorean",
  9057. 0x3207,
  9058. "igrave",
  9059. 0x00ec,
  9060. "igujarati",
  9061. 0x0a87,
  9062. "igurmukhi",
  9063. 0x0a07,
  9064. "ihiragana",
  9065. 0x3044,
  9066. "ihookabove",
  9067. 0x1ec9,
  9068. "iibengali",
  9069. 0x0988,
  9070. "iicyrillic",
  9071. 0x0438,
  9072. "iideva",
  9073. 0x0908,
  9074. "iigujarati",
  9075. 0x0a88,
  9076. "iigurmukhi",
  9077. 0x0a08,
  9078. "iimatragurmukhi",
  9079. 0x0a40,
  9080. "iinvertedbreve",
  9081. 0x020b,
  9082. "iishortcyrillic",
  9083. 0x0439,
  9084. "iivowelsignbengali",
  9085. 0x09c0,
  9086. "iivowelsigndeva",
  9087. 0x0940,
  9088. "iivowelsigngujarati",
  9089. 0x0ac0,
  9090. "ij",
  9091. 0x0133,
  9092. "ikatakana",
  9093. 0x30a4,
  9094. "ikatakanahalfwidth",
  9095. 0xff72,
  9096. "ikorean",
  9097. 0x3163,
  9098. "ilde",
  9099. 0x02dc,
  9100. "iluyhebrew",
  9101. 0x05ac,
  9102. "imacron",
  9103. 0x012b,
  9104. "imacroncyrillic",
  9105. 0x04e3,
  9106. "imageorapproximatelyequal",
  9107. 0x2253,
  9108. "imatragurmukhi",
  9109. 0x0a3f,
  9110. "imonospace",
  9111. 0xff49,
  9112. "increment",
  9113. 0x2206,
  9114. "infinity",
  9115. 0x221e,
  9116. "iniarmenian",
  9117. 0x056b,
  9118. "integral",
  9119. 0x222b,
  9120. "integralbottom",
  9121. 0x2321,
  9122. "integralbt",
  9123. 0x2321,
  9124. "integralex",
  9125. 0xf8f5,
  9126. "integraltop",
  9127. 0x2320,
  9128. "integraltp",
  9129. 0x2320,
  9130. "intersection",
  9131. 0x2229,
  9132. "intisquare",
  9133. 0x3305,
  9134. "invbullet",
  9135. 0x25d8,
  9136. "invcircle",
  9137. 0x25d9,
  9138. "invsmileface",
  9139. 0x263b,
  9140. "iocyrillic",
  9141. 0x0451,
  9142. "iogonek",
  9143. 0x012f,
  9144. "iota",
  9145. 0x03b9,
  9146. "iotadieresis",
  9147. 0x03ca,
  9148. "iotadieresistonos",
  9149. 0x0390,
  9150. "iotalatin",
  9151. 0x0269,
  9152. "iotatonos",
  9153. 0x03af,
  9154. "iparen",
  9155. 0x24a4,
  9156. "irigurmukhi",
  9157. 0x0a72,
  9158. "ismallhiragana",
  9159. 0x3043,
  9160. "ismallkatakana",
  9161. 0x30a3,
  9162. "ismallkatakanahalfwidth",
  9163. 0xff68,
  9164. "issharbengali",
  9165. 0x09fa,
  9166. "istroke",
  9167. 0x0268,
  9168. "isuperior",
  9169. 0xf6ed,
  9170. "iterationhiragana",
  9171. 0x309d,
  9172. "iterationkatakana",
  9173. 0x30fd,
  9174. "itilde",
  9175. 0x0129,
  9176. "itildebelow",
  9177. 0x1e2d,
  9178. "iubopomofo",
  9179. 0x3129,
  9180. "iucyrillic",
  9181. 0x044e,
  9182. "ivowelsignbengali",
  9183. 0x09bf,
  9184. "ivowelsigndeva",
  9185. 0x093f,
  9186. "ivowelsigngujarati",
  9187. 0x0abf,
  9188. "izhitsacyrillic",
  9189. 0x0475,
  9190. "izhitsadblgravecyrillic",
  9191. 0x0477,
  9192. "j",
  9193. 0x006a,
  9194. "jaarmenian",
  9195. 0x0571,
  9196. "jabengali",
  9197. 0x099c,
  9198. "jadeva",
  9199. 0x091c,
  9200. "jagujarati",
  9201. 0x0a9c,
  9202. "jagurmukhi",
  9203. 0x0a1c,
  9204. "jbopomofo",
  9205. 0x3110,
  9206. "jcaron",
  9207. 0x01f0,
  9208. "jcircle",
  9209. 0x24d9,
  9210. "jcircumflex",
  9211. 0x0135,
  9212. "jcrossedtail",
  9213. 0x029d,
  9214. "jdotlessstroke",
  9215. 0x025f,
  9216. "jecyrillic",
  9217. 0x0458,
  9218. "jeemarabic",
  9219. 0x062c,
  9220. "jeemfinalarabic",
  9221. 0xfe9e,
  9222. "jeeminitialarabic",
  9223. 0xfe9f,
  9224. "jeemmedialarabic",
  9225. 0xfea0,
  9226. "jeharabic",
  9227. 0x0698,
  9228. "jehfinalarabic",
  9229. 0xfb8b,
  9230. "jhabengali",
  9231. 0x099d,
  9232. "jhadeva",
  9233. 0x091d,
  9234. "jhagujarati",
  9235. 0x0a9d,
  9236. "jhagurmukhi",
  9237. 0x0a1d,
  9238. "jheharmenian",
  9239. 0x057b,
  9240. "jis",
  9241. 0x3004,
  9242. "jmonospace",
  9243. 0xff4a,
  9244. "jparen",
  9245. 0x24a5,
  9246. "jsuperior",
  9247. 0x02b2,
  9248. "k",
  9249. 0x006b,
  9250. "kabashkircyrillic",
  9251. 0x04a1,
  9252. "kabengali",
  9253. 0x0995,
  9254. "kacute",
  9255. 0x1e31,
  9256. "kacyrillic",
  9257. 0x043a,
  9258. "kadescendercyrillic",
  9259. 0x049b,
  9260. "kadeva",
  9261. 0x0915,
  9262. "kaf",
  9263. 0x05db,
  9264. "kafarabic",
  9265. 0x0643,
  9266. "kafdagesh",
  9267. 0xfb3b,
  9268. "kafdageshhebrew",
  9269. 0xfb3b,
  9270. "kaffinalarabic",
  9271. 0xfeda,
  9272. "kafhebrew",
  9273. 0x05db,
  9274. "kafinitialarabic",
  9275. 0xfedb,
  9276. "kafmedialarabic",
  9277. 0xfedc,
  9278. "kafrafehebrew",
  9279. 0xfb4d,
  9280. "kagujarati",
  9281. 0x0a95,
  9282. "kagurmukhi",
  9283. 0x0a15,
  9284. "kahiragana",
  9285. 0x304b,
  9286. "kahookcyrillic",
  9287. 0x04c4,
  9288. "kakatakana",
  9289. 0x30ab,
  9290. "kakatakanahalfwidth",
  9291. 0xff76,
  9292. "kappa",
  9293. 0x03ba,
  9294. "kappasymbolgreek",
  9295. 0x03f0,
  9296. "kapyeounmieumkorean",
  9297. 0x3171,
  9298. "kapyeounphieuphkorean",
  9299. 0x3184,
  9300. "kapyeounpieupkorean",
  9301. 0x3178,
  9302. "kapyeounssangpieupkorean",
  9303. 0x3179,
  9304. "karoriisquare",
  9305. 0x330d,
  9306. "kashidaautoarabic",
  9307. 0x0640,
  9308. "kashidaautonosidebearingarabic",
  9309. 0x0640,
  9310. "kasmallkatakana",
  9311. 0x30f5,
  9312. "kasquare",
  9313. 0x3384,
  9314. "kasraarabic",
  9315. 0x0650,
  9316. "kasratanarabic",
  9317. 0x064d,
  9318. "kastrokecyrillic",
  9319. 0x049f,
  9320. "katahiraprolongmarkhalfwidth",
  9321. 0xff70,
  9322. "kaverticalstrokecyrillic",
  9323. 0x049d,
  9324. "kbopomofo",
  9325. 0x310e,
  9326. "kcalsquare",
  9327. 0x3389,
  9328. "kcaron",
  9329. 0x01e9,
  9330. "kcedilla",
  9331. 0x0137,
  9332. "kcircle",
  9333. 0x24da,
  9334. "kcommaaccent",
  9335. 0x0137,
  9336. "kdotbelow",
  9337. 0x1e33,
  9338. "keharmenian",
  9339. 0x0584,
  9340. "kehiragana",
  9341. 0x3051,
  9342. "kekatakana",
  9343. 0x30b1,
  9344. "kekatakanahalfwidth",
  9345. 0xff79,
  9346. "kenarmenian",
  9347. 0x056f,
  9348. "kesmallkatakana",
  9349. 0x30f6,
  9350. "kgreenlandic",
  9351. 0x0138,
  9352. "khabengali",
  9353. 0x0996,
  9354. "khacyrillic",
  9355. 0x0445,
  9356. "khadeva",
  9357. 0x0916,
  9358. "khagujarati",
  9359. 0x0a96,
  9360. "khagurmukhi",
  9361. 0x0a16,
  9362. "khaharabic",
  9363. 0x062e,
  9364. "khahfinalarabic",
  9365. 0xfea6,
  9366. "khahinitialarabic",
  9367. 0xfea7,
  9368. "khahmedialarabic",
  9369. 0xfea8,
  9370. "kheicoptic",
  9371. 0x03e7,
  9372. "khhadeva",
  9373. 0x0959,
  9374. "khhagurmukhi",
  9375. 0x0a59,
  9376. "khieukhacirclekorean",
  9377. 0x3278,
  9378. "khieukhaparenkorean",
  9379. 0x3218,
  9380. "khieukhcirclekorean",
  9381. 0x326a,
  9382. "khieukhkorean",
  9383. 0x314b,
  9384. "khieukhparenkorean",
  9385. 0x320a,
  9386. "khokhaithai",
  9387. 0x0e02,
  9388. "khokhonthai",
  9389. 0x0e05,
  9390. "khokhuatthai",
  9391. 0x0e03,
  9392. "khokhwaithai",
  9393. 0x0e04,
  9394. "khomutthai",
  9395. 0x0e5b,
  9396. "khook",
  9397. 0x0199,
  9398. "khorakhangthai",
  9399. 0x0e06,
  9400. "khzsquare",
  9401. 0x3391,
  9402. "kihiragana",
  9403. 0x304d,
  9404. "kikatakana",
  9405. 0x30ad,
  9406. "kikatakanahalfwidth",
  9407. 0xff77,
  9408. "kiroguramusquare",
  9409. 0x3315,
  9410. "kiromeetorusquare",
  9411. 0x3316,
  9412. "kirosquare",
  9413. 0x3314,
  9414. "kiyeokacirclekorean",
  9415. 0x326e,
  9416. "kiyeokaparenkorean",
  9417. 0x320e,
  9418. "kiyeokcirclekorean",
  9419. 0x3260,
  9420. "kiyeokkorean",
  9421. 0x3131,
  9422. "kiyeokparenkorean",
  9423. 0x3200,
  9424. "kiyeoksioskorean",
  9425. 0x3133,
  9426. "kjecyrillic",
  9427. 0x045c,
  9428. "klinebelow",
  9429. 0x1e35,
  9430. "klsquare",
  9431. 0x3398,
  9432. "kmcubedsquare",
  9433. 0x33a6,
  9434. "kmonospace",
  9435. 0xff4b,
  9436. "kmsquaredsquare",
  9437. 0x33a2,
  9438. "kohiragana",
  9439. 0x3053,
  9440. "kohmsquare",
  9441. 0x33c0,
  9442. "kokaithai",
  9443. 0x0e01,
  9444. "kokatakana",
  9445. 0x30b3,
  9446. "kokatakanahalfwidth",
  9447. 0xff7a,
  9448. "kooposquare",
  9449. 0x331e,
  9450. "koppacyrillic",
  9451. 0x0481,
  9452. "koreanstandardsymbol",
  9453. 0x327f,
  9454. "koroniscmb",
  9455. 0x0343,
  9456. "kparen",
  9457. 0x24a6,
  9458. "kpasquare",
  9459. 0x33aa,
  9460. "ksicyrillic",
  9461. 0x046f,
  9462. "ktsquare",
  9463. 0x33cf,
  9464. "kturned",
  9465. 0x029e,
  9466. "kuhiragana",
  9467. 0x304f,
  9468. "kukatakana",
  9469. 0x30af,
  9470. "kukatakanahalfwidth",
  9471. 0xff78,
  9472. "kvsquare",
  9473. 0x33b8,
  9474. "kwsquare",
  9475. 0x33be,
  9476. "l",
  9477. 0x006c,
  9478. "labengali",
  9479. 0x09b2,
  9480. "lacute",
  9481. 0x013a,
  9482. "ladeva",
  9483. 0x0932,
  9484. "lagujarati",
  9485. 0x0ab2,
  9486. "lagurmukhi",
  9487. 0x0a32,
  9488. "lakkhangyaothai",
  9489. 0x0e45,
  9490. "lamaleffinalarabic",
  9491. 0xfefc,
  9492. "lamalefhamzaabovefinalarabic",
  9493. 0xfef8,
  9494. "lamalefhamzaaboveisolatedarabic",
  9495. 0xfef7,
  9496. "lamalefhamzabelowfinalarabic",
  9497. 0xfefa,
  9498. "lamalefhamzabelowisolatedarabic",
  9499. 0xfef9,
  9500. "lamalefisolatedarabic",
  9501. 0xfefb,
  9502. "lamalefmaddaabovefinalarabic",
  9503. 0xfef6,
  9504. "lamalefmaddaaboveisolatedarabic",
  9505. 0xfef5,
  9506. "lamarabic",
  9507. 0x0644,
  9508. "lambda",
  9509. 0x03bb,
  9510. "lambdastroke",
  9511. 0x019b,
  9512. "lamed",
  9513. 0x05dc,
  9514. "lameddagesh",
  9515. 0xfb3c,
  9516. "lameddageshhebrew",
  9517. 0xfb3c,
  9518. "lamedhebrew",
  9519. 0x05dc,
  9520. "lamfinalarabic",
  9521. 0xfede,
  9522. "lamhahinitialarabic",
  9523. 0xfcca,
  9524. "laminitialarabic",
  9525. 0xfedf,
  9526. "lamjeeminitialarabic",
  9527. 0xfcc9,
  9528. "lamkhahinitialarabic",
  9529. 0xfccb,
  9530. "lamlamhehisolatedarabic",
  9531. 0xfdf2,
  9532. "lammedialarabic",
  9533. 0xfee0,
  9534. "lammeemhahinitialarabic",
  9535. 0xfd88,
  9536. "lammeeminitialarabic",
  9537. 0xfccc,
  9538. "largecircle",
  9539. 0x25ef,
  9540. "lbar",
  9541. 0x019a,
  9542. "lbelt",
  9543. 0x026c,
  9544. "lbopomofo",
  9545. 0x310c,
  9546. "lcaron",
  9547. 0x013e,
  9548. "lcedilla",
  9549. 0x013c,
  9550. "lcircle",
  9551. 0x24db,
  9552. "lcircumflexbelow",
  9553. 0x1e3d,
  9554. "lcommaaccent",
  9555. 0x013c,
  9556. "ldot",
  9557. 0x0140,
  9558. "ldotaccent",
  9559. 0x0140,
  9560. "ldotbelow",
  9561. 0x1e37,
  9562. "ldotbelowmacron",
  9563. 0x1e39,
  9564. "leftangleabovecmb",
  9565. 0x031a,
  9566. "lefttackbelowcmb",
  9567. 0x0318,
  9568. "less",
  9569. 0x003c,
  9570. "lessequal",
  9571. 0x2264,
  9572. "lessequalorgreater",
  9573. 0x22da,
  9574. "lessmonospace",
  9575. 0xff1c,
  9576. "lessorequivalent",
  9577. 0x2272,
  9578. "lessorgreater",
  9579. 0x2276,
  9580. "lessoverequal",
  9581. 0x2266,
  9582. "lesssmall",
  9583. 0xfe64,
  9584. "lezh",
  9585. 0x026e,
  9586. "lfblock",
  9587. 0x258c,
  9588. "lhookretroflex",
  9589. 0x026d,
  9590. "lira",
  9591. 0x20a4,
  9592. "liwnarmenian",
  9593. 0x056c,
  9594. "lj",
  9595. 0x01c9,
  9596. "ljecyrillic",
  9597. 0x0459,
  9598. "ll",
  9599. 0xf6c0,
  9600. "lladeva",
  9601. 0x0933,
  9602. "llagujarati",
  9603. 0x0ab3,
  9604. "llinebelow",
  9605. 0x1e3b,
  9606. "llladeva",
  9607. 0x0934,
  9608. "llvocalicbengali",
  9609. 0x09e1,
  9610. "llvocalicdeva",
  9611. 0x0961,
  9612. "llvocalicvowelsignbengali",
  9613. 0x09e3,
  9614. "llvocalicvowelsigndeva",
  9615. 0x0963,
  9616. "lmiddletilde",
  9617. 0x026b,
  9618. "lmonospace",
  9619. 0xff4c,
  9620. "lmsquare",
  9621. 0x33d0,
  9622. "lochulathai",
  9623. 0x0e2c,
  9624. "logicaland",
  9625. 0x2227,
  9626. "logicalnot",
  9627. 0x00ac,
  9628. "logicalnotreversed",
  9629. 0x2310,
  9630. "logicalor",
  9631. 0x2228,
  9632. "lolingthai",
  9633. 0x0e25,
  9634. "longs",
  9635. 0x017f,
  9636. "lowlinecenterline",
  9637. 0xfe4e,
  9638. "lowlinecmb",
  9639. 0x0332,
  9640. "lowlinedashed",
  9641. 0xfe4d,
  9642. "lozenge",
  9643. 0x25ca,
  9644. "lparen",
  9645. 0x24a7,
  9646. "lslash",
  9647. 0x0142,
  9648. "lsquare",
  9649. 0x2113,
  9650. "lsuperior",
  9651. 0xf6ee,
  9652. "ltshade",
  9653. 0x2591,
  9654. "luthai",
  9655. 0x0e26,
  9656. "lvocalicbengali",
  9657. 0x098c,
  9658. "lvocalicdeva",
  9659. 0x090c,
  9660. "lvocalicvowelsignbengali",
  9661. 0x09e2,
  9662. "lvocalicvowelsigndeva",
  9663. 0x0962,
  9664. "lxsquare",
  9665. 0x33d3,
  9666. "m",
  9667. 0x006d,
  9668. "mabengali",
  9669. 0x09ae,
  9670. "macron",
  9671. 0x00af,
  9672. "macronbelowcmb",
  9673. 0x0331,
  9674. "macroncmb",
  9675. 0x0304,
  9676. "macronlowmod",
  9677. 0x02cd,
  9678. "macronmonospace",
  9679. 0xffe3,
  9680. "macute",
  9681. 0x1e3f,
  9682. "madeva",
  9683. 0x092e,
  9684. "magujarati",
  9685. 0x0aae,
  9686. "magurmukhi",
  9687. 0x0a2e,
  9688. "mahapakhhebrew",
  9689. 0x05a4,
  9690. "mahapakhlefthebrew",
  9691. 0x05a4,
  9692. "mahiragana",
  9693. 0x307e,
  9694. "maichattawalowleftthai",
  9695. 0xf895,
  9696. "maichattawalowrightthai",
  9697. 0xf894,
  9698. "maichattawathai",
  9699. 0x0e4b,
  9700. "maichattawaupperleftthai",
  9701. 0xf893,
  9702. "maieklowleftthai",
  9703. 0xf88c,
  9704. "maieklowrightthai",
  9705. 0xf88b,
  9706. "maiekthai",
  9707. 0x0e48,
  9708. "maiekupperleftthai",
  9709. 0xf88a,
  9710. "maihanakatleftthai",
  9711. 0xf884,
  9712. "maihanakatthai",
  9713. 0x0e31,
  9714. "maitaikhuleftthai",
  9715. 0xf889,
  9716. "maitaikhuthai",
  9717. 0x0e47,
  9718. "maitholowleftthai",
  9719. 0xf88f,
  9720. "maitholowrightthai",
  9721. 0xf88e,
  9722. "maithothai",
  9723. 0x0e49,
  9724. "maithoupperleftthai",
  9725. 0xf88d,
  9726. "maitrilowleftthai",
  9727. 0xf892,
  9728. "maitrilowrightthai",
  9729. 0xf891,
  9730. "maitrithai",
  9731. 0x0e4a,
  9732. "maitriupperleftthai",
  9733. 0xf890,
  9734. "maiyamokthai",
  9735. 0x0e46,
  9736. "makatakana",
  9737. 0x30de,
  9738. "makatakanahalfwidth",
  9739. 0xff8f,
  9740. "male",
  9741. 0x2642,
  9742. "mansyonsquare",
  9743. 0x3347,
  9744. "maqafhebrew",
  9745. 0x05be,
  9746. "mars",
  9747. 0x2642,
  9748. "masoracirclehebrew",
  9749. 0x05af,
  9750. "masquare",
  9751. 0x3383,
  9752. "mbopomofo",
  9753. 0x3107,
  9754. "mbsquare",
  9755. 0x33d4,
  9756. "mcircle",
  9757. 0x24dc,
  9758. "mcubedsquare",
  9759. 0x33a5,
  9760. "mdotaccent",
  9761. 0x1e41,
  9762. "mdotbelow",
  9763. 0x1e43,
  9764. "meemarabic",
  9765. 0x0645,
  9766. "meemfinalarabic",
  9767. 0xfee2,
  9768. "meeminitialarabic",
  9769. 0xfee3,
  9770. "meemmedialarabic",
  9771. 0xfee4,
  9772. "meemmeeminitialarabic",
  9773. 0xfcd1,
  9774. "meemmeemisolatedarabic",
  9775. 0xfc48,
  9776. "meetorusquare",
  9777. 0x334d,
  9778. "mehiragana",
  9779. 0x3081,
  9780. "meizierasquare",
  9781. 0x337e,
  9782. "mekatakana",
  9783. 0x30e1,
  9784. "mekatakanahalfwidth",
  9785. 0xff92,
  9786. "mem",
  9787. 0x05de,
  9788. "memdagesh",
  9789. 0xfb3e,
  9790. "memdageshhebrew",
  9791. 0xfb3e,
  9792. "memhebrew",
  9793. 0x05de,
  9794. "menarmenian",
  9795. 0x0574,
  9796. "merkhahebrew",
  9797. 0x05a5,
  9798. "merkhakefulahebrew",
  9799. 0x05a6,
  9800. "merkhakefulalefthebrew",
  9801. 0x05a6,
  9802. "merkhalefthebrew",
  9803. 0x05a5,
  9804. "mhook",
  9805. 0x0271,
  9806. "mhzsquare",
  9807. 0x3392,
  9808. "middledotkatakanahalfwidth",
  9809. 0xff65,
  9810. "middot",
  9811. 0x00b7,
  9812. "mieumacirclekorean",
  9813. 0x3272,
  9814. "mieumaparenkorean",
  9815. 0x3212,
  9816. "mieumcirclekorean",
  9817. 0x3264,
  9818. "mieumkorean",
  9819. 0x3141,
  9820. "mieumpansioskorean",
  9821. 0x3170,
  9822. "mieumparenkorean",
  9823. 0x3204,
  9824. "mieumpieupkorean",
  9825. 0x316e,
  9826. "mieumsioskorean",
  9827. 0x316f,
  9828. "mihiragana",
  9829. 0x307f,
  9830. "mikatakana",
  9831. 0x30df,
  9832. "mikatakanahalfwidth",
  9833. 0xff90,
  9834. "minus",
  9835. 0x2212,
  9836. "minusbelowcmb",
  9837. 0x0320,
  9838. "minuscircle",
  9839. 0x2296,
  9840. "minusmod",
  9841. 0x02d7,
  9842. "minusplus",
  9843. 0x2213,
  9844. "minute",
  9845. 0x2032,
  9846. "miribaarusquare",
  9847. 0x334a,
  9848. "mirisquare",
  9849. 0x3349,
  9850. "mlonglegturned",
  9851. 0x0270,
  9852. "mlsquare",
  9853. 0x3396,
  9854. "mmcubedsquare",
  9855. 0x33a3,
  9856. "mmonospace",
  9857. 0xff4d,
  9858. "mmsquaredsquare",
  9859. 0x339f,
  9860. "mohiragana",
  9861. 0x3082,
  9862. "mohmsquare",
  9863. 0x33c1,
  9864. "mokatakana",
  9865. 0x30e2,
  9866. "mokatakanahalfwidth",
  9867. 0xff93,
  9868. "molsquare",
  9869. 0x33d6,
  9870. "momathai",
  9871. 0x0e21,
  9872. "moverssquare",
  9873. 0x33a7,
  9874. "moverssquaredsquare",
  9875. 0x33a8,
  9876. "mparen",
  9877. 0x24a8,
  9878. "mpasquare",
  9879. 0x33ab,
  9880. "mssquare",
  9881. 0x33b3,
  9882. "msuperior",
  9883. 0xf6ef,
  9884. "mturned",
  9885. 0x026f,
  9886. "mu",
  9887. 0x00b5,
  9888. "mu1",
  9889. 0x00b5,
  9890. "muasquare",
  9891. 0x3382,
  9892. "muchgreater",
  9893. 0x226b,
  9894. "muchless",
  9895. 0x226a,
  9896. "mufsquare",
  9897. 0x338c,
  9898. "mugreek",
  9899. 0x03bc,
  9900. "mugsquare",
  9901. 0x338d,
  9902. "muhiragana",
  9903. 0x3080,
  9904. "mukatakana",
  9905. 0x30e0,
  9906. "mukatakanahalfwidth",
  9907. 0xff91,
  9908. "mulsquare",
  9909. 0x3395,
  9910. "multiply",
  9911. 0x00d7,
  9912. "mumsquare",
  9913. 0x339b,
  9914. "munahhebrew",
  9915. 0x05a3,
  9916. "munahlefthebrew",
  9917. 0x05a3,
  9918. "musicalnote",
  9919. 0x266a,
  9920. "musicalnotedbl",
  9921. 0x266b,
  9922. "musicflatsign",
  9923. 0x266d,
  9924. "musicsharpsign",
  9925. 0x266f,
  9926. "mussquare",
  9927. 0x33b2,
  9928. "muvsquare",
  9929. 0x33b6,
  9930. "muwsquare",
  9931. 0x33bc,
  9932. "mvmegasquare",
  9933. 0x33b9,
  9934. "mvsquare",
  9935. 0x33b7,
  9936. "mwmegasquare",
  9937. 0x33bf,
  9938. "mwsquare",
  9939. 0x33bd,
  9940. "n",
  9941. 0x006e,
  9942. "nabengali",
  9943. 0x09a8,
  9944. "nabla",
  9945. 0x2207,
  9946. "nacute",
  9947. 0x0144,
  9948. "nadeva",
  9949. 0x0928,
  9950. "nagujarati",
  9951. 0x0aa8,
  9952. "nagurmukhi",
  9953. 0x0a28,
  9954. "nahiragana",
  9955. 0x306a,
  9956. "nakatakana",
  9957. 0x30ca,
  9958. "nakatakanahalfwidth",
  9959. 0xff85,
  9960. "napostrophe",
  9961. 0x0149,
  9962. "nasquare",
  9963. 0x3381,
  9964. "nbopomofo",
  9965. 0x310b,
  9966. "nbspace",
  9967. 0x00a0,
  9968. "ncaron",
  9969. 0x0148,
  9970. "ncedilla",
  9971. 0x0146,
  9972. "ncircle",
  9973. 0x24dd,
  9974. "ncircumflexbelow",
  9975. 0x1e4b,
  9976. "ncommaaccent",
  9977. 0x0146,
  9978. "ndotaccent",
  9979. 0x1e45,
  9980. "ndotbelow",
  9981. 0x1e47,
  9982. "nehiragana",
  9983. 0x306d,
  9984. "nekatakana",
  9985. 0x30cd,
  9986. "nekatakanahalfwidth",
  9987. 0xff88,
  9988. "newsheqelsign",
  9989. 0x20aa,
  9990. "nfsquare",
  9991. 0x338b,
  9992. "ngabengali",
  9993. 0x0999,
  9994. "ngadeva",
  9995. 0x0919,
  9996. "ngagujarati",
  9997. 0x0a99,
  9998. "ngagurmukhi",
  9999. 0x0a19,
  10000. "ngonguthai",
  10001. 0x0e07,
  10002. "nhiragana",
  10003. 0x3093,
  10004. "nhookleft",
  10005. 0x0272,
  10006. "nhookretroflex",
  10007. 0x0273,
  10008. "nieunacirclekorean",
  10009. 0x326f,
  10010. "nieunaparenkorean",
  10011. 0x320f,
  10012. "nieuncieuckorean",
  10013. 0x3135,
  10014. "nieuncirclekorean",
  10015. 0x3261,
  10016. "nieunhieuhkorean",
  10017. 0x3136,
  10018. "nieunkorean",
  10019. 0x3134,
  10020. "nieunpansioskorean",
  10021. 0x3168,
  10022. "nieunparenkorean",
  10023. 0x3201,
  10024. "nieunsioskorean",
  10025. 0x3167,
  10026. "nieuntikeutkorean",
  10027. 0x3166,
  10028. "nihiragana",
  10029. 0x306b,
  10030. "nikatakana",
  10031. 0x30cb,
  10032. "nikatakanahalfwidth",
  10033. 0xff86,
  10034. "nikhahitleftthai",
  10035. 0xf899,
  10036. "nikhahitthai",
  10037. 0x0e4d,
  10038. "nine",
  10039. 0x0039,
  10040. "ninearabic",
  10041. 0x0669,
  10042. "ninebengali",
  10043. 0x09ef,
  10044. "ninecircle",
  10045. 0x2468,
  10046. "ninecircleinversesansserif",
  10047. 0x2792,
  10048. "ninedeva",
  10049. 0x096f,
  10050. "ninegujarati",
  10051. 0x0aef,
  10052. "ninegurmukhi",
  10053. 0x0a6f,
  10054. "ninehackarabic",
  10055. 0x0669,
  10056. "ninehangzhou",
  10057. 0x3029,
  10058. "nineideographicparen",
  10059. 0x3228,
  10060. "nineinferior",
  10061. 0x2089,
  10062. "ninemonospace",
  10063. 0xff19,
  10064. "nineoldstyle",
  10065. 0xf739,
  10066. "nineparen",
  10067. 0x247c,
  10068. "nineperiod",
  10069. 0x2490,
  10070. "ninepersian",
  10071. 0x06f9,
  10072. "nineroman",
  10073. 0x2178,
  10074. "ninesuperior",
  10075. 0x2079,
  10076. "nineteencircle",
  10077. 0x2472,
  10078. "nineteenparen",
  10079. 0x2486,
  10080. "nineteenperiod",
  10081. 0x249a,
  10082. "ninethai",
  10083. 0x0e59,
  10084. "nj",
  10085. 0x01cc,
  10086. "njecyrillic",
  10087. 0x045a,
  10088. "nkatakana",
  10089. 0x30f3,
  10090. "nkatakanahalfwidth",
  10091. 0xff9d,
  10092. "nlegrightlong",
  10093. 0x019e,
  10094. "nlinebelow",
  10095. 0x1e49,
  10096. "nmonospace",
  10097. 0xff4e,
  10098. "nmsquare",
  10099. 0x339a,
  10100. "nnabengali",
  10101. 0x09a3,
  10102. "nnadeva",
  10103. 0x0923,
  10104. "nnagujarati",
  10105. 0x0aa3,
  10106. "nnagurmukhi",
  10107. 0x0a23,
  10108. "nnnadeva",
  10109. 0x0929,
  10110. "nohiragana",
  10111. 0x306e,
  10112. "nokatakana",
  10113. 0x30ce,
  10114. "nokatakanahalfwidth",
  10115. 0xff89,
  10116. "nonbreakingspace",
  10117. 0x00a0,
  10118. "nonenthai",
  10119. 0x0e13,
  10120. "nonuthai",
  10121. 0x0e19,
  10122. "noonarabic",
  10123. 0x0646,
  10124. "noonfinalarabic",
  10125. 0xfee6,
  10126. "noonghunnaarabic",
  10127. 0x06ba,
  10128. "noonghunnafinalarabic",
  10129. 0xfb9f,
  10130. "nooninitialarabic",
  10131. 0xfee7,
  10132. "noonjeeminitialarabic",
  10133. 0xfcd2,
  10134. "noonjeemisolatedarabic",
  10135. 0xfc4b,
  10136. "noonmedialarabic",
  10137. 0xfee8,
  10138. "noonmeeminitialarabic",
  10139. 0xfcd5,
  10140. "noonmeemisolatedarabic",
  10141. 0xfc4e,
  10142. "noonnoonfinalarabic",
  10143. 0xfc8d,
  10144. "notcontains",
  10145. 0x220c,
  10146. "notelement",
  10147. 0x2209,
  10148. "notelementof",
  10149. 0x2209,
  10150. "notequal",
  10151. 0x2260,
  10152. "notgreater",
  10153. 0x226f,
  10154. "notgreaternorequal",
  10155. 0x2271,
  10156. "notgreaternorless",
  10157. 0x2279,
  10158. "notidentical",
  10159. 0x2262,
  10160. "notless",
  10161. 0x226e,
  10162. "notlessnorequal",
  10163. 0x2270,
  10164. "notparallel",
  10165. 0x2226,
  10166. "notprecedes",
  10167. 0x2280,
  10168. "notsubset",
  10169. 0x2284,
  10170. "notsucceeds",
  10171. 0x2281,
  10172. "notsuperset",
  10173. 0x2285,
  10174. "nowarmenian",
  10175. 0x0576,
  10176. "nparen",
  10177. 0x24a9,
  10178. "nssquare",
  10179. 0x33b1,
  10180. "nsuperior",
  10181. 0x207f,
  10182. "ntilde",
  10183. 0x00f1,
  10184. "nu",
  10185. 0x03bd,
  10186. "nuhiragana",
  10187. 0x306c,
  10188. "nukatakana",
  10189. 0x30cc,
  10190. "nukatakanahalfwidth",
  10191. 0xff87,
  10192. "nuktabengali",
  10193. 0x09bc,
  10194. "nuktadeva",
  10195. 0x093c,
  10196. "nuktagujarati",
  10197. 0x0abc,
  10198. "nuktagurmukhi",
  10199. 0x0a3c,
  10200. "numbersign",
  10201. 0x0023,
  10202. "numbersignmonospace",
  10203. 0xff03,
  10204. "numbersignsmall",
  10205. 0xfe5f,
  10206. "numeralsigngreek",
  10207. 0x0374,
  10208. "numeralsignlowergreek",
  10209. 0x0375,
  10210. "numero",
  10211. 0x2116,
  10212. "nun",
  10213. 0x05e0,
  10214. "nundagesh",
  10215. 0xfb40,
  10216. "nundageshhebrew",
  10217. 0xfb40,
  10218. "nunhebrew",
  10219. 0x05e0,
  10220. "nvsquare",
  10221. 0x33b5,
  10222. "nwsquare",
  10223. 0x33bb,
  10224. "nyabengali",
  10225. 0x099e,
  10226. "nyadeva",
  10227. 0x091e,
  10228. "nyagujarati",
  10229. 0x0a9e,
  10230. "nyagurmukhi",
  10231. 0x0a1e,
  10232. "o",
  10233. 0x006f,
  10234. "oacute",
  10235. 0x00f3,
  10236. "oangthai",
  10237. 0x0e2d,
  10238. "obarred",
  10239. 0x0275,
  10240. "obarredcyrillic",
  10241. 0x04e9,
  10242. "obarreddieresiscyrillic",
  10243. 0x04eb,
  10244. "obengali",
  10245. 0x0993,
  10246. "obopomofo",
  10247. 0x311b,
  10248. "obreve",
  10249. 0x014f,
  10250. "ocandradeva",
  10251. 0x0911,
  10252. "ocandragujarati",
  10253. 0x0a91,
  10254. "ocandravowelsigndeva",
  10255. 0x0949,
  10256. "ocandravowelsigngujarati",
  10257. 0x0ac9,
  10258. "ocaron",
  10259. 0x01d2,
  10260. "ocircle",
  10261. 0x24de,
  10262. "ocircumflex",
  10263. 0x00f4,
  10264. "ocircumflexacute",
  10265. 0x1ed1,
  10266. "ocircumflexdotbelow",
  10267. 0x1ed9,
  10268. "ocircumflexgrave",
  10269. 0x1ed3,
  10270. "ocircumflexhookabove",
  10271. 0x1ed5,
  10272. "ocircumflextilde",
  10273. 0x1ed7,
  10274. "ocyrillic",
  10275. 0x043e,
  10276. "odblacute",
  10277. 0x0151,
  10278. "odblgrave",
  10279. 0x020d,
  10280. "odeva",
  10281. 0x0913,
  10282. "odieresis",
  10283. 0x00f6,
  10284. "odieresiscyrillic",
  10285. 0x04e7,
  10286. "odotbelow",
  10287. 0x1ecd,
  10288. "oe",
  10289. 0x0153,
  10290. "oekorean",
  10291. 0x315a,
  10292. "ogonek",
  10293. 0x02db,
  10294. "ogonekcmb",
  10295. 0x0328,
  10296. "ograve",
  10297. 0x00f2,
  10298. "ogujarati",
  10299. 0x0a93,
  10300. "oharmenian",
  10301. 0x0585,
  10302. "ohiragana",
  10303. 0x304a,
  10304. "ohookabove",
  10305. 0x1ecf,
  10306. "ohorn",
  10307. 0x01a1,
  10308. "ohornacute",
  10309. 0x1edb,
  10310. "ohorndotbelow",
  10311. 0x1ee3,
  10312. "ohorngrave",
  10313. 0x1edd,
  10314. "ohornhookabove",
  10315. 0x1edf,
  10316. "ohorntilde",
  10317. 0x1ee1,
  10318. "ohungarumlaut",
  10319. 0x0151,
  10320. "oi",
  10321. 0x01a3,
  10322. "oinvertedbreve",
  10323. 0x020f,
  10324. "okatakana",
  10325. 0x30aa,
  10326. "okatakanahalfwidth",
  10327. 0xff75,
  10328. "okorean",
  10329. 0x3157,
  10330. "olehebrew",
  10331. 0x05ab,
  10332. "omacron",
  10333. 0x014d,
  10334. "omacronacute",
  10335. 0x1e53,
  10336. "omacrongrave",
  10337. 0x1e51,
  10338. "omdeva",
  10339. 0x0950,
  10340. "omega",
  10341. 0x03c9,
  10342. "omega1",
  10343. 0x03d6,
  10344. "omegacyrillic",
  10345. 0x0461,
  10346. "omegalatinclosed",
  10347. 0x0277,
  10348. "omegaroundcyrillic",
  10349. 0x047b,
  10350. "omegatitlocyrillic",
  10351. 0x047d,
  10352. "omegatonos",
  10353. 0x03ce,
  10354. "omgujarati",
  10355. 0x0ad0,
  10356. "omicron",
  10357. 0x03bf,
  10358. "omicrontonos",
  10359. 0x03cc,
  10360. "omonospace",
  10361. 0xff4f,
  10362. "one",
  10363. 0x0031,
  10364. "onearabic",
  10365. 0x0661,
  10366. "onebengali",
  10367. 0x09e7,
  10368. "onecircle",
  10369. 0x2460,
  10370. "onecircleinversesansserif",
  10371. 0x278a,
  10372. "onedeva",
  10373. 0x0967,
  10374. "onedotenleader",
  10375. 0x2024,
  10376. "oneeighth",
  10377. 0x215b,
  10378. "onefitted",
  10379. 0xf6dc,
  10380. "onegujarati",
  10381. 0x0ae7,
  10382. "onegurmukhi",
  10383. 0x0a67,
  10384. "onehackarabic",
  10385. 0x0661,
  10386. "onehalf",
  10387. 0x00bd,
  10388. "onehangzhou",
  10389. 0x3021,
  10390. "oneideographicparen",
  10391. 0x3220,
  10392. "oneinferior",
  10393. 0x2081,
  10394. "onemonospace",
  10395. 0xff11,
  10396. "onenumeratorbengali",
  10397. 0x09f4,
  10398. "oneoldstyle",
  10399. 0xf731,
  10400. "oneparen",
  10401. 0x2474,
  10402. "oneperiod",
  10403. 0x2488,
  10404. "onepersian",
  10405. 0x06f1,
  10406. "onequarter",
  10407. 0x00bc,
  10408. "oneroman",
  10409. 0x2170,
  10410. "onesuperior",
  10411. 0x00b9,
  10412. "onethai",
  10413. 0x0e51,
  10414. "onethird",
  10415. 0x2153,
  10416. "oogonek",
  10417. 0x01eb,
  10418. "oogonekmacron",
  10419. 0x01ed,
  10420. "oogurmukhi",
  10421. 0x0a13,
  10422. "oomatragurmukhi",
  10423. 0x0a4b,
  10424. "oopen",
  10425. 0x0254,
  10426. "oparen",
  10427. 0x24aa,
  10428. "openbullet",
  10429. 0x25e6,
  10430. "option",
  10431. 0x2325,
  10432. "ordfeminine",
  10433. 0x00aa,
  10434. "ordmasculine",
  10435. 0x00ba,
  10436. "orthogonal",
  10437. 0x221f,
  10438. "oshortdeva",
  10439. 0x0912,
  10440. "oshortvowelsigndeva",
  10441. 0x094a,
  10442. "oslash",
  10443. 0x00f8,
  10444. "oslashacute",
  10445. 0x01ff,
  10446. "osmallhiragana",
  10447. 0x3049,
  10448. "osmallkatakana",
  10449. 0x30a9,
  10450. "osmallkatakanahalfwidth",
  10451. 0xff6b,
  10452. "ostrokeacute",
  10453. 0x01ff,
  10454. "osuperior",
  10455. 0xf6f0,
  10456. "otcyrillic",
  10457. 0x047f,
  10458. "otilde",
  10459. 0x00f5,
  10460. "otildeacute",
  10461. 0x1e4d,
  10462. "otildedieresis",
  10463. 0x1e4f,
  10464. "oubopomofo",
  10465. 0x3121,
  10466. "overline",
  10467. 0x203e,
  10468. "overlinecenterline",
  10469. 0xfe4a,
  10470. "overlinecmb",
  10471. 0x0305,
  10472. "overlinedashed",
  10473. 0xfe49,
  10474. "overlinedblwavy",
  10475. 0xfe4c,
  10476. "overlinewavy",
  10477. 0xfe4b,
  10478. "overscore",
  10479. 0x00af,
  10480. "ovowelsignbengali",
  10481. 0x09cb,
  10482. "ovowelsigndeva",
  10483. 0x094b,
  10484. "ovowelsigngujarati",
  10485. 0x0acb,
  10486. "p",
  10487. 0x0070,
  10488. "paampssquare",
  10489. 0x3380,
  10490. "paasentosquare",
  10491. 0x332b,
  10492. "pabengali",
  10493. 0x09aa,
  10494. "pacute",
  10495. 0x1e55,
  10496. "padeva",
  10497. 0x092a,
  10498. "pagedown",
  10499. 0x21df,
  10500. "pageup",
  10501. 0x21de,
  10502. "pagujarati",
  10503. 0x0aaa,
  10504. "pagurmukhi",
  10505. 0x0a2a,
  10506. "pahiragana",
  10507. 0x3071,
  10508. "paiyannoithai",
  10509. 0x0e2f,
  10510. "pakatakana",
  10511. 0x30d1,
  10512. "palatalizationcyrilliccmb",
  10513. 0x0484,
  10514. "palochkacyrillic",
  10515. 0x04c0,
  10516. "pansioskorean",
  10517. 0x317f,
  10518. "paragraph",
  10519. 0x00b6,
  10520. "parallel",
  10521. 0x2225,
  10522. "parenleft",
  10523. 0x0028,
  10524. "parenleftaltonearabic",
  10525. 0xfd3e,
  10526. "parenleftbt",
  10527. 0xf8ed,
  10528. "parenleftex",
  10529. 0xf8ec,
  10530. "parenleftinferior",
  10531. 0x208d,
  10532. "parenleftmonospace",
  10533. 0xff08,
  10534. "parenleftsmall",
  10535. 0xfe59,
  10536. "parenleftsuperior",
  10537. 0x207d,
  10538. "parenlefttp",
  10539. 0xf8eb,
  10540. "parenleftvertical",
  10541. 0xfe35,
  10542. "parenright",
  10543. 0x0029,
  10544. "parenrightaltonearabic",
  10545. 0xfd3f,
  10546. "parenrightbt",
  10547. 0xf8f8,
  10548. "parenrightex",
  10549. 0xf8f7,
  10550. "parenrightinferior",
  10551. 0x208e,
  10552. "parenrightmonospace",
  10553. 0xff09,
  10554. "parenrightsmall",
  10555. 0xfe5a,
  10556. "parenrightsuperior",
  10557. 0x207e,
  10558. "parenrighttp",
  10559. 0xf8f6,
  10560. "parenrightvertical",
  10561. 0xfe36,
  10562. "partialdiff",
  10563. 0x2202,
  10564. "paseqhebrew",
  10565. 0x05c0,
  10566. "pashtahebrew",
  10567. 0x0599,
  10568. "pasquare",
  10569. 0x33a9,
  10570. "patah",
  10571. 0x05b7,
  10572. "patah11",
  10573. 0x05b7,
  10574. "patah1d",
  10575. 0x05b7,
  10576. "patah2a",
  10577. 0x05b7,
  10578. "patahhebrew",
  10579. 0x05b7,
  10580. "patahnarrowhebrew",
  10581. 0x05b7,
  10582. "patahquarterhebrew",
  10583. 0x05b7,
  10584. "patahwidehebrew",
  10585. 0x05b7,
  10586. "pazerhebrew",
  10587. 0x05a1,
  10588. "pbopomofo",
  10589. 0x3106,
  10590. "pcircle",
  10591. 0x24df,
  10592. "pdotaccent",
  10593. 0x1e57,
  10594. "pe",
  10595. 0x05e4,
  10596. "pecyrillic",
  10597. 0x043f,
  10598. "pedagesh",
  10599. 0xfb44,
  10600. "pedageshhebrew",
  10601. 0xfb44,
  10602. "peezisquare",
  10603. 0x333b,
  10604. "pefinaldageshhebrew",
  10605. 0xfb43,
  10606. "peharabic",
  10607. 0x067e,
  10608. "peharmenian",
  10609. 0x057a,
  10610. "pehebrew",
  10611. 0x05e4,
  10612. "pehfinalarabic",
  10613. 0xfb57,
  10614. "pehinitialarabic",
  10615. 0xfb58,
  10616. "pehiragana",
  10617. 0x307a,
  10618. "pehmedialarabic",
  10619. 0xfb59,
  10620. "pekatakana",
  10621. 0x30da,
  10622. "pemiddlehookcyrillic",
  10623. 0x04a7,
  10624. "perafehebrew",
  10625. 0xfb4e,
  10626. "percent",
  10627. 0x0025,
  10628. "percentarabic",
  10629. 0x066a,
  10630. "percentmonospace",
  10631. 0xff05,
  10632. "percentsmall",
  10633. 0xfe6a,
  10634. "period",
  10635. 0x002e,
  10636. "periodarmenian",
  10637. 0x0589,
  10638. "periodcentered",
  10639. 0x00b7,
  10640. "periodhalfwidth",
  10641. 0xff61,
  10642. "periodinferior",
  10643. 0xf6e7,
  10644. "periodmonospace",
  10645. 0xff0e,
  10646. "periodsmall",
  10647. 0xfe52,
  10648. "periodsuperior",
  10649. 0xf6e8,
  10650. "perispomenigreekcmb",
  10651. 0x0342,
  10652. "perpendicular",
  10653. 0x22a5,
  10654. "perthousand",
  10655. 0x2030,
  10656. "peseta",
  10657. 0x20a7,
  10658. "pfsquare",
  10659. 0x338a,
  10660. "phabengali",
  10661. 0x09ab,
  10662. "phadeva",
  10663. 0x092b,
  10664. "phagujarati",
  10665. 0x0aab,
  10666. "phagurmukhi",
  10667. 0x0a2b,
  10668. "phi",
  10669. 0x03c6,
  10670. "phi1",
  10671. 0x03d5,
  10672. "phieuphacirclekorean",
  10673. 0x327a,
  10674. "phieuphaparenkorean",
  10675. 0x321a,
  10676. "phieuphcirclekorean",
  10677. 0x326c,
  10678. "phieuphkorean",
  10679. 0x314d,
  10680. "phieuphparenkorean",
  10681. 0x320c,
  10682. "philatin",
  10683. 0x0278,
  10684. "phinthuthai",
  10685. 0x0e3a,
  10686. "phisymbolgreek",
  10687. 0x03d5,
  10688. "phook",
  10689. 0x01a5,
  10690. "phophanthai",
  10691. 0x0e1e,
  10692. "phophungthai",
  10693. 0x0e1c,
  10694. "phosamphaothai",
  10695. 0x0e20,
  10696. "pi",
  10697. 0x03c0,
  10698. "pieupacirclekorean",
  10699. 0x3273,
  10700. "pieupaparenkorean",
  10701. 0x3213,
  10702. "pieupcieuckorean",
  10703. 0x3176,
  10704. "pieupcirclekorean",
  10705. 0x3265,
  10706. "pieupkiyeokkorean",
  10707. 0x3172,
  10708. "pieupkorean",
  10709. 0x3142,
  10710. "pieupparenkorean",
  10711. 0x3205,
  10712. "pieupsioskiyeokkorean",
  10713. 0x3174,
  10714. "pieupsioskorean",
  10715. 0x3144,
  10716. "pieupsiostikeutkorean",
  10717. 0x3175,
  10718. "pieupthieuthkorean",
  10719. 0x3177,
  10720. "pieuptikeutkorean",
  10721. 0x3173,
  10722. "pihiragana",
  10723. 0x3074,
  10724. "pikatakana",
  10725. 0x30d4,
  10726. "pisymbolgreek",
  10727. 0x03d6,
  10728. "piwrarmenian",
  10729. 0x0583,
  10730. "plus",
  10731. 0x002b,
  10732. "plusbelowcmb",
  10733. 0x031f,
  10734. "pluscircle",
  10735. 0x2295,
  10736. "plusminus",
  10737. 0x00b1,
  10738. "plusmod",
  10739. 0x02d6,
  10740. "plusmonospace",
  10741. 0xff0b,
  10742. "plussmall",
  10743. 0xfe62,
  10744. "plussuperior",
  10745. 0x207a,
  10746. "pmonospace",
  10747. 0xff50,
  10748. "pmsquare",
  10749. 0x33d8,
  10750. "pohiragana",
  10751. 0x307d,
  10752. "pointingindexdownwhite",
  10753. 0x261f,
  10754. "pointingindexleftwhite",
  10755. 0x261c,
  10756. "pointingindexrightwhite",
  10757. 0x261e,
  10758. "pointingindexupwhite",
  10759. 0x261d,
  10760. "pokatakana",
  10761. 0x30dd,
  10762. "poplathai",
  10763. 0x0e1b,
  10764. "postalmark",
  10765. 0x3012,
  10766. "postalmarkface",
  10767. 0x3020,
  10768. "pparen",
  10769. 0x24ab,
  10770. "precedes",
  10771. 0x227a,
  10772. "prescription",
  10773. 0x211e,
  10774. "primemod",
  10775. 0x02b9,
  10776. "primereversed",
  10777. 0x2035,
  10778. "product",
  10779. 0x220f,
  10780. "projective",
  10781. 0x2305,
  10782. "prolongedkana",
  10783. 0x30fc,
  10784. "propellor",
  10785. 0x2318,
  10786. "propersubset",
  10787. 0x2282,
  10788. "propersuperset",
  10789. 0x2283,
  10790. "proportion",
  10791. 0x2237,
  10792. "proportional",
  10793. 0x221d,
  10794. "psi",
  10795. 0x03c8,
  10796. "psicyrillic",
  10797. 0x0471,
  10798. "psilipneumatacyrilliccmb",
  10799. 0x0486,
  10800. "pssquare",
  10801. 0x33b0,
  10802. "puhiragana",
  10803. 0x3077,
  10804. "pukatakana",
  10805. 0x30d7,
  10806. "pvsquare",
  10807. 0x33b4,
  10808. "pwsquare",
  10809. 0x33ba,
  10810. "q",
  10811. 0x0071,
  10812. "qadeva",
  10813. 0x0958,
  10814. "qadmahebrew",
  10815. 0x05a8,
  10816. "qafarabic",
  10817. 0x0642,
  10818. "qaffinalarabic",
  10819. 0xfed6,
  10820. "qafinitialarabic",
  10821. 0xfed7,
  10822. "qafmedialarabic",
  10823. 0xfed8,
  10824. "qamats",
  10825. 0x05b8,
  10826. "qamats10",
  10827. 0x05b8,
  10828. "qamats1a",
  10829. 0x05b8,
  10830. "qamats1c",
  10831. 0x05b8,
  10832. "qamats27",
  10833. 0x05b8,
  10834. "qamats29",
  10835. 0x05b8,
  10836. "qamats33",
  10837. 0x05b8,
  10838. "qamatsde",
  10839. 0x05b8,
  10840. "qamatshebrew",
  10841. 0x05b8,
  10842. "qamatsnarrowhebrew",
  10843. 0x05b8,
  10844. "qamatsqatanhebrew",
  10845. 0x05b8,
  10846. "qamatsqatannarrowhebrew",
  10847. 0x05b8,
  10848. "qamatsqatanquarterhebrew",
  10849. 0x05b8,
  10850. "qamatsqatanwidehebrew",
  10851. 0x05b8,
  10852. "qamatsquarterhebrew",
  10853. 0x05b8,
  10854. "qamatswidehebrew",
  10855. 0x05b8,
  10856. "qarneyparahebrew",
  10857. 0x059f,
  10858. "qbopomofo",
  10859. 0x3111,
  10860. "qcircle",
  10861. 0x24e0,
  10862. "qhook",
  10863. 0x02a0,
  10864. "qmonospace",
  10865. 0xff51,
  10866. "qof",
  10867. 0x05e7,
  10868. "qofdagesh",
  10869. 0xfb47,
  10870. "qofdageshhebrew",
  10871. 0xfb47,
  10872. "qofhebrew",
  10873. 0x05e7,
  10874. "qparen",
  10875. 0x24ac,
  10876. "quarternote",
  10877. 0x2669,
  10878. "qubuts",
  10879. 0x05bb,
  10880. "qubuts18",
  10881. 0x05bb,
  10882. "qubuts25",
  10883. 0x05bb,
  10884. "qubuts31",
  10885. 0x05bb,
  10886. "qubutshebrew",
  10887. 0x05bb,
  10888. "qubutsnarrowhebrew",
  10889. 0x05bb,
  10890. "qubutsquarterhebrew",
  10891. 0x05bb,
  10892. "qubutswidehebrew",
  10893. 0x05bb,
  10894. "question",
  10895. 0x003f,
  10896. "questionarabic",
  10897. 0x061f,
  10898. "questionarmenian",
  10899. 0x055e,
  10900. "questiondown",
  10901. 0x00bf,
  10902. "questiondownsmall",
  10903. 0xf7bf,
  10904. "questiongreek",
  10905. 0x037e,
  10906. "questionmonospace",
  10907. 0xff1f,
  10908. "questionsmall",
  10909. 0xf73f,
  10910. "quotedbl",
  10911. 0x0022,
  10912. "quotedblbase",
  10913. 0x201e,
  10914. "quotedblleft",
  10915. 0x201c,
  10916. "quotedblmonospace",
  10917. 0xff02,
  10918. "quotedblprime",
  10919. 0x301e,
  10920. "quotedblprimereversed",
  10921. 0x301d,
  10922. "quotedblright",
  10923. 0x201d,
  10924. "quoteleft",
  10925. 0x2018,
  10926. "quoteleftreversed",
  10927. 0x201b,
  10928. "quotereversed",
  10929. 0x201b,
  10930. "quoteright",
  10931. 0x2019,
  10932. "quoterightn",
  10933. 0x0149,
  10934. "quotesinglbase",
  10935. 0x201a,
  10936. "quotesingle",
  10937. 0x0027,
  10938. "quotesinglemonospace",
  10939. 0xff07,
  10940. "r",
  10941. 0x0072,
  10942. "raarmenian",
  10943. 0x057c,
  10944. "rabengali",
  10945. 0x09b0,
  10946. "racute",
  10947. 0x0155,
  10948. "radeva",
  10949. 0x0930,
  10950. "radical",
  10951. 0x221a,
  10952. "radicalex",
  10953. 0xf8e5,
  10954. "radoverssquare",
  10955. 0x33ae,
  10956. "radoverssquaredsquare",
  10957. 0x33af,
  10958. "radsquare",
  10959. 0x33ad,
  10960. "rafe",
  10961. 0x05bf,
  10962. "rafehebrew",
  10963. 0x05bf,
  10964. "ragujarati",
  10965. 0x0ab0,
  10966. "ragurmukhi",
  10967. 0x0a30,
  10968. "rahiragana",
  10969. 0x3089,
  10970. "rakatakana",
  10971. 0x30e9,
  10972. "rakatakanahalfwidth",
  10973. 0xff97,
  10974. "ralowerdiagonalbengali",
  10975. 0x09f1,
  10976. "ramiddlediagonalbengali",
  10977. 0x09f0,
  10978. "ramshorn",
  10979. 0x0264,
  10980. "ratio",
  10981. 0x2236,
  10982. "rbopomofo",
  10983. 0x3116,
  10984. "rcaron",
  10985. 0x0159,
  10986. "rcedilla",
  10987. 0x0157,
  10988. "rcircle",
  10989. 0x24e1,
  10990. "rcommaaccent",
  10991. 0x0157,
  10992. "rdblgrave",
  10993. 0x0211,
  10994. "rdotaccent",
  10995. 0x1e59,
  10996. "rdotbelow",
  10997. 0x1e5b,
  10998. "rdotbelowmacron",
  10999. 0x1e5d,
  11000. "referencemark",
  11001. 0x203b,
  11002. "reflexsubset",
  11003. 0x2286,
  11004. "reflexsuperset",
  11005. 0x2287,
  11006. "registered",
  11007. 0x00ae,
  11008. "registersans",
  11009. 0xf8e8,
  11010. "registerserif",
  11011. 0xf6da,
  11012. "reharabic",
  11013. 0x0631,
  11014. "reharmenian",
  11015. 0x0580,
  11016. "rehfinalarabic",
  11017. 0xfeae,
  11018. "rehiragana",
  11019. 0x308c,
  11020. "rekatakana",
  11021. 0x30ec,
  11022. "rekatakanahalfwidth",
  11023. 0xff9a,
  11024. "resh",
  11025. 0x05e8,
  11026. "reshdageshhebrew",
  11027. 0xfb48,
  11028. "reshhebrew",
  11029. 0x05e8,
  11030. "reversedtilde",
  11031. 0x223d,
  11032. "reviahebrew",
  11033. 0x0597,
  11034. "reviamugrashhebrew",
  11035. 0x0597,
  11036. "revlogicalnot",
  11037. 0x2310,
  11038. "rfishhook",
  11039. 0x027e,
  11040. "rfishhookreversed",
  11041. 0x027f,
  11042. "rhabengali",
  11043. 0x09dd,
  11044. "rhadeva",
  11045. 0x095d,
  11046. "rho",
  11047. 0x03c1,
  11048. "rhook",
  11049. 0x027d,
  11050. "rhookturned",
  11051. 0x027b,
  11052. "rhookturnedsuperior",
  11053. 0x02b5,
  11054. "rhosymbolgreek",
  11055. 0x03f1,
  11056. "rhotichookmod",
  11057. 0x02de,
  11058. "rieulacirclekorean",
  11059. 0x3271,
  11060. "rieulaparenkorean",
  11061. 0x3211,
  11062. "rieulcirclekorean",
  11063. 0x3263,
  11064. "rieulhieuhkorean",
  11065. 0x3140,
  11066. "rieulkiyeokkorean",
  11067. 0x313a,
  11068. "rieulkiyeoksioskorean",
  11069. 0x3169,
  11070. "rieulkorean",
  11071. 0x3139,
  11072. "rieulmieumkorean",
  11073. 0x313b,
  11074. "rieulpansioskorean",
  11075. 0x316c,
  11076. "rieulparenkorean",
  11077. 0x3203,
  11078. "rieulphieuphkorean",
  11079. 0x313f,
  11080. "rieulpieupkorean",
  11081. 0x313c,
  11082. "rieulpieupsioskorean",
  11083. 0x316b,
  11084. "rieulsioskorean",
  11085. 0x313d,
  11086. "rieulthieuthkorean",
  11087. 0x313e,
  11088. "rieultikeutkorean",
  11089. 0x316a,
  11090. "rieulyeorinhieuhkorean",
  11091. 0x316d,
  11092. "rightangle",
  11093. 0x221f,
  11094. "righttackbelowcmb",
  11095. 0x0319,
  11096. "righttriangle",
  11097. 0x22bf,
  11098. "rihiragana",
  11099. 0x308a,
  11100. "rikatakana",
  11101. 0x30ea,
  11102. "rikatakanahalfwidth",
  11103. 0xff98,
  11104. "ring",
  11105. 0x02da,
  11106. "ringbelowcmb",
  11107. 0x0325,
  11108. "ringcmb",
  11109. 0x030a,
  11110. "ringhalfleft",
  11111. 0x02bf,
  11112. "ringhalfleftarmenian",
  11113. 0x0559,
  11114. "ringhalfleftbelowcmb",
  11115. 0x031c,
  11116. "ringhalfleftcentered",
  11117. 0x02d3,
  11118. "ringhalfright",
  11119. 0x02be,
  11120. "ringhalfrightbelowcmb",
  11121. 0x0339,
  11122. "ringhalfrightcentered",
  11123. 0x02d2,
  11124. "rinvertedbreve",
  11125. 0x0213,
  11126. "rittorusquare",
  11127. 0x3351,
  11128. "rlinebelow",
  11129. 0x1e5f,
  11130. "rlongleg",
  11131. 0x027c,
  11132. "rlonglegturned",
  11133. 0x027a,
  11134. "rmonospace",
  11135. 0xff52,
  11136. "rohiragana",
  11137. 0x308d,
  11138. "rokatakana",
  11139. 0x30ed,
  11140. "rokatakanahalfwidth",
  11141. 0xff9b,
  11142. "roruathai",
  11143. 0x0e23,
  11144. "rparen",
  11145. 0x24ad,
  11146. "rrabengali",
  11147. 0x09dc,
  11148. "rradeva",
  11149. 0x0931,
  11150. "rragurmukhi",
  11151. 0x0a5c,
  11152. "rreharabic",
  11153. 0x0691,
  11154. "rrehfinalarabic",
  11155. 0xfb8d,
  11156. "rrvocalicbengali",
  11157. 0x09e0,
  11158. "rrvocalicdeva",
  11159. 0x0960,
  11160. "rrvocalicgujarati",
  11161. 0x0ae0,
  11162. "rrvocalicvowelsignbengali",
  11163. 0x09c4,
  11164. "rrvocalicvowelsigndeva",
  11165. 0x0944,
  11166. "rrvocalicvowelsigngujarati",
  11167. 0x0ac4,
  11168. "rsuperior",
  11169. 0xf6f1,
  11170. "rtblock",
  11171. 0x2590,
  11172. "rturned",
  11173. 0x0279,
  11174. "rturnedsuperior",
  11175. 0x02b4,
  11176. "ruhiragana",
  11177. 0x308b,
  11178. "rukatakana",
  11179. 0x30eb,
  11180. "rukatakanahalfwidth",
  11181. 0xff99,
  11182. "rupeemarkbengali",
  11183. 0x09f2,
  11184. "rupeesignbengali",
  11185. 0x09f3,
  11186. "rupiah",
  11187. 0xf6dd,
  11188. "ruthai",
  11189. 0x0e24,
  11190. "rvocalicbengali",
  11191. 0x098b,
  11192. "rvocalicdeva",
  11193. 0x090b,
  11194. "rvocalicgujarati",
  11195. 0x0a8b,
  11196. "rvocalicvowelsignbengali",
  11197. 0x09c3,
  11198. "rvocalicvowelsigndeva",
  11199. 0x0943,
  11200. "rvocalicvowelsigngujarati",
  11201. 0x0ac3,
  11202. "s",
  11203. 0x0073,
  11204. "sabengali",
  11205. 0x09b8,
  11206. "sacute",
  11207. 0x015b,
  11208. "sacutedotaccent",
  11209. 0x1e65,
  11210. "sadarabic",
  11211. 0x0635,
  11212. "sadeva",
  11213. 0x0938,
  11214. "sadfinalarabic",
  11215. 0xfeba,
  11216. "sadinitialarabic",
  11217. 0xfebb,
  11218. "sadmedialarabic",
  11219. 0xfebc,
  11220. "sagujarati",
  11221. 0x0ab8,
  11222. "sagurmukhi",
  11223. 0x0a38,
  11224. "sahiragana",
  11225. 0x3055,
  11226. "sakatakana",
  11227. 0x30b5,
  11228. "sakatakanahalfwidth",
  11229. 0xff7b,
  11230. "sallallahoualayhewasallamarabic",
  11231. 0xfdfa,
  11232. "samekh",
  11233. 0x05e1,
  11234. "samekhdagesh",
  11235. 0xfb41,
  11236. "samekhdageshhebrew",
  11237. 0xfb41,
  11238. "samekhhebrew",
  11239. 0x05e1,
  11240. "saraaathai",
  11241. 0x0e32,
  11242. "saraaethai",
  11243. 0x0e41,
  11244. "saraaimaimalaithai",
  11245. 0x0e44,
  11246. "saraaimaimuanthai",
  11247. 0x0e43,
  11248. "saraamthai",
  11249. 0x0e33,
  11250. "saraathai",
  11251. 0x0e30,
  11252. "saraethai",
  11253. 0x0e40,
  11254. "saraiileftthai",
  11255. 0xf886,
  11256. "saraiithai",
  11257. 0x0e35,
  11258. "saraileftthai",
  11259. 0xf885,
  11260. "saraithai",
  11261. 0x0e34,
  11262. "saraothai",
  11263. 0x0e42,
  11264. "saraueeleftthai",
  11265. 0xf888,
  11266. "saraueethai",
  11267. 0x0e37,
  11268. "saraueleftthai",
  11269. 0xf887,
  11270. "sarauethai",
  11271. 0x0e36,
  11272. "sarauthai",
  11273. 0x0e38,
  11274. "sarauuthai",
  11275. 0x0e39,
  11276. "sbopomofo",
  11277. 0x3119,
  11278. "scaron",
  11279. 0x0161,
  11280. "scarondotaccent",
  11281. 0x1e67,
  11282. "scedilla",
  11283. 0x015f,
  11284. "schwa",
  11285. 0x0259,
  11286. "schwacyrillic",
  11287. 0x04d9,
  11288. "schwadieresiscyrillic",
  11289. 0x04db,
  11290. "schwahook",
  11291. 0x025a,
  11292. "scircle",
  11293. 0x24e2,
  11294. "scircumflex",
  11295. 0x015d,
  11296. "scommaaccent",
  11297. 0x0219,
  11298. "sdotaccent",
  11299. 0x1e61,
  11300. "sdotbelow",
  11301. 0x1e63,
  11302. "sdotbelowdotaccent",
  11303. 0x1e69,
  11304. "seagullbelowcmb",
  11305. 0x033c,
  11306. "second",
  11307. 0x2033,
  11308. "secondtonechinese",
  11309. 0x02ca,
  11310. "section",
  11311. 0x00a7,
  11312. "seenarabic",
  11313. 0x0633,
  11314. "seenfinalarabic",
  11315. 0xfeb2,
  11316. "seeninitialarabic",
  11317. 0xfeb3,
  11318. "seenmedialarabic",
  11319. 0xfeb4,
  11320. "segol",
  11321. 0x05b6,
  11322. "segol13",
  11323. 0x05b6,
  11324. "segol1f",
  11325. 0x05b6,
  11326. "segol2c",
  11327. 0x05b6,
  11328. "segolhebrew",
  11329. 0x05b6,
  11330. "segolnarrowhebrew",
  11331. 0x05b6,
  11332. "segolquarterhebrew",
  11333. 0x05b6,
  11334. "segoltahebrew",
  11335. 0x0592,
  11336. "segolwidehebrew",
  11337. 0x05b6,
  11338. "seharmenian",
  11339. 0x057d,
  11340. "sehiragana",
  11341. 0x305b,
  11342. "sekatakana",
  11343. 0x30bb,
  11344. "sekatakanahalfwidth",
  11345. 0xff7e,
  11346. "semicolon",
  11347. 0x003b,
  11348. "semicolonarabic",
  11349. 0x061b,
  11350. "semicolonmonospace",
  11351. 0xff1b,
  11352. "semicolonsmall",
  11353. 0xfe54,
  11354. "semivoicedmarkkana",
  11355. 0x309c,
  11356. "semivoicedmarkkanahalfwidth",
  11357. 0xff9f,
  11358. "sentisquare",
  11359. 0x3322,
  11360. "sentosquare",
  11361. 0x3323,
  11362. "seven",
  11363. 0x0037,
  11364. "sevenarabic",
  11365. 0x0667,
  11366. "sevenbengali",
  11367. 0x09ed,
  11368. "sevencircle",
  11369. 0x2466,
  11370. "sevencircleinversesansserif",
  11371. 0x2790,
  11372. "sevendeva",
  11373. 0x096d,
  11374. "seveneighths",
  11375. 0x215e,
  11376. "sevengujarati",
  11377. 0x0aed,
  11378. "sevengurmukhi",
  11379. 0x0a6d,
  11380. "sevenhackarabic",
  11381. 0x0667,
  11382. "sevenhangzhou",
  11383. 0x3027,
  11384. "sevenideographicparen",
  11385. 0x3226,
  11386. "seveninferior",
  11387. 0x2087,
  11388. "sevenmonospace",
  11389. 0xff17,
  11390. "sevenoldstyle",
  11391. 0xf737,
  11392. "sevenparen",
  11393. 0x247a,
  11394. "sevenperiod",
  11395. 0x248e,
  11396. "sevenpersian",
  11397. 0x06f7,
  11398. "sevenroman",
  11399. 0x2176,
  11400. "sevensuperior",
  11401. 0x2077,
  11402. "seventeencircle",
  11403. 0x2470,
  11404. "seventeenparen",
  11405. 0x2484,
  11406. "seventeenperiod",
  11407. 0x2498,
  11408. "seventhai",
  11409. 0x0e57,
  11410. "sfthyphen",
  11411. 0x00ad,
  11412. "shaarmenian",
  11413. 0x0577,
  11414. "shabengali",
  11415. 0x09b6,
  11416. "shacyrillic",
  11417. 0x0448,
  11418. "shaddaarabic",
  11419. 0x0651,
  11420. "shaddadammaarabic",
  11421. 0xfc61,
  11422. "shaddadammatanarabic",
  11423. 0xfc5e,
  11424. "shaddafathaarabic",
  11425. 0xfc60,
  11426. "shaddakasraarabic",
  11427. 0xfc62,
  11428. "shaddakasratanarabic",
  11429. 0xfc5f,
  11430. "shade",
  11431. 0x2592,
  11432. "shadedark",
  11433. 0x2593,
  11434. "shadelight",
  11435. 0x2591,
  11436. "shademedium",
  11437. 0x2592,
  11438. "shadeva",
  11439. 0x0936,
  11440. "shagujarati",
  11441. 0x0ab6,
  11442. "shagurmukhi",
  11443. 0x0a36,
  11444. "shalshelethebrew",
  11445. 0x0593,
  11446. "shbopomofo",
  11447. 0x3115,
  11448. "shchacyrillic",
  11449. 0x0449,
  11450. "sheenarabic",
  11451. 0x0634,
  11452. "sheenfinalarabic",
  11453. 0xfeb6,
  11454. "sheeninitialarabic",
  11455. 0xfeb7,
  11456. "sheenmedialarabic",
  11457. 0xfeb8,
  11458. "sheicoptic",
  11459. 0x03e3,
  11460. "sheqel",
  11461. 0x20aa,
  11462. "sheqelhebrew",
  11463. 0x20aa,
  11464. "sheva",
  11465. 0x05b0,
  11466. "sheva115",
  11467. 0x05b0,
  11468. "sheva15",
  11469. 0x05b0,
  11470. "sheva22",
  11471. 0x05b0,
  11472. "sheva2e",
  11473. 0x05b0,
  11474. "shevahebrew",
  11475. 0x05b0,
  11476. "shevanarrowhebrew",
  11477. 0x05b0,
  11478. "shevaquarterhebrew",
  11479. 0x05b0,
  11480. "shevawidehebrew",
  11481. 0x05b0,
  11482. "shhacyrillic",
  11483. 0x04bb,
  11484. "shimacoptic",
  11485. 0x03ed,
  11486. "shin",
  11487. 0x05e9,
  11488. "shindagesh",
  11489. 0xfb49,
  11490. "shindageshhebrew",
  11491. 0xfb49,
  11492. "shindageshshindot",
  11493. 0xfb2c,
  11494. "shindageshshindothebrew",
  11495. 0xfb2c,
  11496. "shindageshsindot",
  11497. 0xfb2d,
  11498. "shindageshsindothebrew",
  11499. 0xfb2d,
  11500. "shindothebrew",
  11501. 0x05c1,
  11502. "shinhebrew",
  11503. 0x05e9,
  11504. "shinshindot",
  11505. 0xfb2a,
  11506. "shinshindothebrew",
  11507. 0xfb2a,
  11508. "shinsindot",
  11509. 0xfb2b,
  11510. "shinsindothebrew",
  11511. 0xfb2b,
  11512. "shook",
  11513. 0x0282,
  11514. "sigma",
  11515. 0x03c3,
  11516. "sigma1",
  11517. 0x03c2,
  11518. "sigmafinal",
  11519. 0x03c2,
  11520. "sigmalunatesymbolgreek",
  11521. 0x03f2,
  11522. "sihiragana",
  11523. 0x3057,
  11524. "sikatakana",
  11525. 0x30b7,
  11526. "sikatakanahalfwidth",
  11527. 0xff7c,
  11528. "siluqhebrew",
  11529. 0x05bd,
  11530. "siluqlefthebrew",
  11531. 0x05bd,
  11532. "similar",
  11533. 0x223c,
  11534. "sindothebrew",
  11535. 0x05c2,
  11536. "siosacirclekorean",
  11537. 0x3274,
  11538. "siosaparenkorean",
  11539. 0x3214,
  11540. "sioscieuckorean",
  11541. 0x317e,
  11542. "sioscirclekorean",
  11543. 0x3266,
  11544. "sioskiyeokkorean",
  11545. 0x317a,
  11546. "sioskorean",
  11547. 0x3145,
  11548. "siosnieunkorean",
  11549. 0x317b,
  11550. "siosparenkorean",
  11551. 0x3206,
  11552. "siospieupkorean",
  11553. 0x317d,
  11554. "siostikeutkorean",
  11555. 0x317c,
  11556. "six",
  11557. 0x0036,
  11558. "sixarabic",
  11559. 0x0666,
  11560. "sixbengali",
  11561. 0x09ec,
  11562. "sixcircle",
  11563. 0x2465,
  11564. "sixcircleinversesansserif",
  11565. 0x278f,
  11566. "sixdeva",
  11567. 0x096c,
  11568. "sixgujarati",
  11569. 0x0aec,
  11570. "sixgurmukhi",
  11571. 0x0a6c,
  11572. "sixhackarabic",
  11573. 0x0666,
  11574. "sixhangzhou",
  11575. 0x3026,
  11576. "sixideographicparen",
  11577. 0x3225,
  11578. "sixinferior",
  11579. 0x2086,
  11580. "sixmonospace",
  11581. 0xff16,
  11582. "sixoldstyle",
  11583. 0xf736,
  11584. "sixparen",
  11585. 0x2479,
  11586. "sixperiod",
  11587. 0x248d,
  11588. "sixpersian",
  11589. 0x06f6,
  11590. "sixroman",
  11591. 0x2175,
  11592. "sixsuperior",
  11593. 0x2076,
  11594. "sixteencircle",
  11595. 0x246f,
  11596. "sixteencurrencydenominatorbengali",
  11597. 0x09f9,
  11598. "sixteenparen",
  11599. 0x2483,
  11600. "sixteenperiod",
  11601. 0x2497,
  11602. "sixthai",
  11603. 0x0e56,
  11604. "slash",
  11605. 0x002f,
  11606. "slashmonospace",
  11607. 0xff0f,
  11608. "slong",
  11609. 0x017f,
  11610. "slongdotaccent",
  11611. 0x1e9b,
  11612. "smileface",
  11613. 0x263a,
  11614. "smonospace",
  11615. 0xff53,
  11616. "sofpasuqhebrew",
  11617. 0x05c3,
  11618. "softhyphen",
  11619. 0x00ad,
  11620. "softsigncyrillic",
  11621. 0x044c,
  11622. "sohiragana",
  11623. 0x305d,
  11624. "sokatakana",
  11625. 0x30bd,
  11626. "sokatakanahalfwidth",
  11627. 0xff7f,
  11628. "soliduslongoverlaycmb",
  11629. 0x0338,
  11630. "solidusshortoverlaycmb",
  11631. 0x0337,
  11632. "sorusithai",
  11633. 0x0e29,
  11634. "sosalathai",
  11635. 0x0e28,
  11636. "sosothai",
  11637. 0x0e0b,
  11638. "sosuathai",
  11639. 0x0e2a,
  11640. "space",
  11641. 0x0020,
  11642. "spacehackarabic",
  11643. 0x0020,
  11644. "spade",
  11645. 0x2660,
  11646. "spadesuitblack",
  11647. 0x2660,
  11648. "spadesuitwhite",
  11649. 0x2664,
  11650. "sparen",
  11651. 0x24ae,
  11652. "squarebelowcmb",
  11653. 0x033b,
  11654. "squarecc",
  11655. 0x33c4,
  11656. "squarecm",
  11657. 0x339d,
  11658. "squarediagonalcrosshatchfill",
  11659. 0x25a9,
  11660. "squarehorizontalfill",
  11661. 0x25a4,
  11662. "squarekg",
  11663. 0x338f,
  11664. "squarekm",
  11665. 0x339e,
  11666. "squarekmcapital",
  11667. 0x33ce,
  11668. "squareln",
  11669. 0x33d1,
  11670. "squarelog",
  11671. 0x33d2,
  11672. "squaremg",
  11673. 0x338e,
  11674. "squaremil",
  11675. 0x33d5,
  11676. "squaremm",
  11677. 0x339c,
  11678. "squaremsquared",
  11679. 0x33a1,
  11680. "squareorthogonalcrosshatchfill",
  11681. 0x25a6,
  11682. "squareupperlefttolowerrightfill",
  11683. 0x25a7,
  11684. "squareupperrighttolowerleftfill",
  11685. 0x25a8,
  11686. "squareverticalfill",
  11687. 0x25a5,
  11688. "squarewhitewithsmallblack",
  11689. 0x25a3,
  11690. "srsquare",
  11691. 0x33db,
  11692. "ssabengali",
  11693. 0x09b7,
  11694. "ssadeva",
  11695. 0x0937,
  11696. "ssagujarati",
  11697. 0x0ab7,
  11698. "ssangcieuckorean",
  11699. 0x3149,
  11700. "ssanghieuhkorean",
  11701. 0x3185,
  11702. "ssangieungkorean",
  11703. 0x3180,
  11704. "ssangkiyeokkorean",
  11705. 0x3132,
  11706. "ssangnieunkorean",
  11707. 0x3165,
  11708. "ssangpieupkorean",
  11709. 0x3143,
  11710. "ssangsioskorean",
  11711. 0x3146,
  11712. "ssangtikeutkorean",
  11713. 0x3138,
  11714. "ssuperior",
  11715. 0xf6f2,
  11716. "sterling",
  11717. 0x00a3,
  11718. "sterlingmonospace",
  11719. 0xffe1,
  11720. "strokelongoverlaycmb",
  11721. 0x0336,
  11722. "strokeshortoverlaycmb",
  11723. 0x0335,
  11724. "subset",
  11725. 0x2282,
  11726. "subsetnotequal",
  11727. 0x228a,
  11728. "subsetorequal",
  11729. 0x2286,
  11730. "succeeds",
  11731. 0x227b,
  11732. "suchthat",
  11733. 0x220b,
  11734. "suhiragana",
  11735. 0x3059,
  11736. "sukatakana",
  11737. 0x30b9,
  11738. "sukatakanahalfwidth",
  11739. 0xff7d,
  11740. "sukunarabic",
  11741. 0x0652,
  11742. "summation",
  11743. 0x2211,
  11744. "sun",
  11745. 0x263c,
  11746. "superset",
  11747. 0x2283,
  11748. "supersetnotequal",
  11749. 0x228b,
  11750. "supersetorequal",
  11751. 0x2287,
  11752. "svsquare",
  11753. 0x33dc,
  11754. "syouwaerasquare",
  11755. 0x337c,
  11756. "t",
  11757. 0x0074,
  11758. "tabengali",
  11759. 0x09a4,
  11760. "tackdown",
  11761. 0x22a4,
  11762. "tackleft",
  11763. 0x22a3,
  11764. "tadeva",
  11765. 0x0924,
  11766. "tagujarati",
  11767. 0x0aa4,
  11768. "tagurmukhi",
  11769. 0x0a24,
  11770. "taharabic",
  11771. 0x0637,
  11772. "tahfinalarabic",
  11773. 0xfec2,
  11774. "tahinitialarabic",
  11775. 0xfec3,
  11776. "tahiragana",
  11777. 0x305f,
  11778. "tahmedialarabic",
  11779. 0xfec4,
  11780. "taisyouerasquare",
  11781. 0x337d,
  11782. "takatakana",
  11783. 0x30bf,
  11784. "takatakanahalfwidth",
  11785. 0xff80,
  11786. "tatweelarabic",
  11787. 0x0640,
  11788. "tau",
  11789. 0x03c4,
  11790. "tav",
  11791. 0x05ea,
  11792. "tavdages",
  11793. 0xfb4a,
  11794. "tavdagesh",
  11795. 0xfb4a,
  11796. "tavdageshhebrew",
  11797. 0xfb4a,
  11798. "tavhebrew",
  11799. 0x05ea,
  11800. "tbar",
  11801. 0x0167,
  11802. "tbopomofo",
  11803. 0x310a,
  11804. "tcaron",
  11805. 0x0165,
  11806. "tccurl",
  11807. 0x02a8,
  11808. "tcedilla",
  11809. 0x0163,
  11810. "tcheharabic",
  11811. 0x0686,
  11812. "tchehfinalarabic",
  11813. 0xfb7b,
  11814. "tchehinitialarabic",
  11815. 0xfb7c,
  11816. "tchehmedialarabic",
  11817. 0xfb7d,
  11818. "tcircle",
  11819. 0x24e3,
  11820. "tcircumflexbelow",
  11821. 0x1e71,
  11822. "tcommaaccent",
  11823. 0x0163,
  11824. "tdieresis",
  11825. 0x1e97,
  11826. "tdotaccent",
  11827. 0x1e6b,
  11828. "tdotbelow",
  11829. 0x1e6d,
  11830. "tecyrillic",
  11831. 0x0442,
  11832. "tedescendercyrillic",
  11833. 0x04ad,
  11834. "teharabic",
  11835. 0x062a,
  11836. "tehfinalarabic",
  11837. 0xfe96,
  11838. "tehhahinitialarabic",
  11839. 0xfca2,
  11840. "tehhahisolatedarabic",
  11841. 0xfc0c,
  11842. "tehinitialarabic",
  11843. 0xfe97,
  11844. "tehiragana",
  11845. 0x3066,
  11846. "tehjeeminitialarabic",
  11847. 0xfca1,
  11848. "tehjeemisolatedarabic",
  11849. 0xfc0b,
  11850. "tehmarbutaarabic",
  11851. 0x0629,
  11852. "tehmarbutafinalarabic",
  11853. 0xfe94,
  11854. "tehmedialarabic",
  11855. 0xfe98,
  11856. "tehmeeminitialarabic",
  11857. 0xfca4,
  11858. "tehmeemisolatedarabic",
  11859. 0xfc0e,
  11860. "tehnoonfinalarabic",
  11861. 0xfc73,
  11862. "tekatakana",
  11863. 0x30c6,
  11864. "tekatakanahalfwidth",
  11865. 0xff83,
  11866. "telephone",
  11867. 0x2121,
  11868. "telephoneblack",
  11869. 0x260e,
  11870. "telishagedolahebrew",
  11871. 0x05a0,
  11872. "telishaqetanahebrew",
  11873. 0x05a9,
  11874. "tencircle",
  11875. 0x2469,
  11876. "tenideographicparen",
  11877. 0x3229,
  11878. "tenparen",
  11879. 0x247d,
  11880. "tenperiod",
  11881. 0x2491,
  11882. "tenroman",
  11883. 0x2179,
  11884. "tesh",
  11885. 0x02a7,
  11886. "tet",
  11887. 0x05d8,
  11888. "tetdagesh",
  11889. 0xfb38,
  11890. "tetdageshhebrew",
  11891. 0xfb38,
  11892. "tethebrew",
  11893. 0x05d8,
  11894. "tetsecyrillic",
  11895. 0x04b5,
  11896. "tevirhebrew",
  11897. 0x059b,
  11898. "tevirlefthebrew",
  11899. 0x059b,
  11900. "thabengali",
  11901. 0x09a5,
  11902. "thadeva",
  11903. 0x0925,
  11904. "thagujarati",
  11905. 0x0aa5,
  11906. "thagurmukhi",
  11907. 0x0a25,
  11908. "thalarabic",
  11909. 0x0630,
  11910. "thalfinalarabic",
  11911. 0xfeac,
  11912. "thanthakhatlowleftthai",
  11913. 0xf898,
  11914. "thanthakhatlowrightthai",
  11915. 0xf897,
  11916. "thanthakhatthai",
  11917. 0x0e4c,
  11918. "thanthakhatupperleftthai",
  11919. 0xf896,
  11920. "theharabic",
  11921. 0x062b,
  11922. "thehfinalarabic",
  11923. 0xfe9a,
  11924. "thehinitialarabic",
  11925. 0xfe9b,
  11926. "thehmedialarabic",
  11927. 0xfe9c,
  11928. "thereexists",
  11929. 0x2203,
  11930. "therefore",
  11931. 0x2234,
  11932. "theta",
  11933. 0x03b8,
  11934. "theta1",
  11935. 0x03d1,
  11936. "thetasymbolgreek",
  11937. 0x03d1,
  11938. "thieuthacirclekorean",
  11939. 0x3279,
  11940. "thieuthaparenkorean",
  11941. 0x3219,
  11942. "thieuthcirclekorean",
  11943. 0x326b,
  11944. "thieuthkorean",
  11945. 0x314c,
  11946. "thieuthparenkorean",
  11947. 0x320b,
  11948. "thirteencircle",
  11949. 0x246c,
  11950. "thirteenparen",
  11951. 0x2480,
  11952. "thirteenperiod",
  11953. 0x2494,
  11954. "thonangmonthothai",
  11955. 0x0e11,
  11956. "thook",
  11957. 0x01ad,
  11958. "thophuthaothai",
  11959. 0x0e12,
  11960. "thorn",
  11961. 0x00fe,
  11962. "thothahanthai",
  11963. 0x0e17,
  11964. "thothanthai",
  11965. 0x0e10,
  11966. "thothongthai",
  11967. 0x0e18,
  11968. "thothungthai",
  11969. 0x0e16,
  11970. "thousandcyrillic",
  11971. 0x0482,
  11972. "thousandsseparatorarabic",
  11973. 0x066c,
  11974. "thousandsseparatorpersian",
  11975. 0x066c,
  11976. "three",
  11977. 0x0033,
  11978. "threearabic",
  11979. 0x0663,
  11980. "threebengali",
  11981. 0x09e9,
  11982. "threecircle",
  11983. 0x2462,
  11984. "threecircleinversesansserif",
  11985. 0x278c,
  11986. "threedeva",
  11987. 0x0969,
  11988. "threeeighths",
  11989. 0x215c,
  11990. "threegujarati",
  11991. 0x0ae9,
  11992. "threegurmukhi",
  11993. 0x0a69,
  11994. "threehackarabic",
  11995. 0x0663,
  11996. "threehangzhou",
  11997. 0x3023,
  11998. "threeideographicparen",
  11999. 0x3222,
  12000. "threeinferior",
  12001. 0x2083,
  12002. "threemonospace",
  12003. 0xff13,
  12004. "threenumeratorbengali",
  12005. 0x09f6,
  12006. "threeoldstyle",
  12007. 0xf733,
  12008. "threeparen",
  12009. 0x2476,
  12010. "threeperiod",
  12011. 0x248a,
  12012. "threepersian",
  12013. 0x06f3,
  12014. "threequarters",
  12015. 0x00be,
  12016. "threequartersemdash",
  12017. 0xf6de,
  12018. "threeroman",
  12019. 0x2172,
  12020. "threesuperior",
  12021. 0x00b3,
  12022. "threethai",
  12023. 0x0e53,
  12024. "thzsquare",
  12025. 0x3394,
  12026. "tihiragana",
  12027. 0x3061,
  12028. "tikatakana",
  12029. 0x30c1,
  12030. "tikatakanahalfwidth",
  12031. 0xff81,
  12032. "tikeutacirclekorean",
  12033. 0x3270,
  12034. "tikeutaparenkorean",
  12035. 0x3210,
  12036. "tikeutcirclekorean",
  12037. 0x3262,
  12038. "tikeutkorean",
  12039. 0x3137,
  12040. "tikeutparenkorean",
  12041. 0x3202,
  12042. "tilde",
  12043. 0x02dc,
  12044. "tildebelowcmb",
  12045. 0x0330,
  12046. "tildecmb",
  12047. 0x0303,
  12048. "tildecomb",
  12049. 0x0303,
  12050. "tildedoublecmb",
  12051. 0x0360,
  12052. "tildeoperator",
  12053. 0x223c,
  12054. "tildeoverlaycmb",
  12055. 0x0334,
  12056. "tildeverticalcmb",
  12057. 0x033e,
  12058. "timescircle",
  12059. 0x2297,
  12060. "tipehahebrew",
  12061. 0x0596,
  12062. "tipehalefthebrew",
  12063. 0x0596,
  12064. "tippigurmukhi",
  12065. 0x0a70,
  12066. "titlocyrilliccmb",
  12067. 0x0483,
  12068. "tiwnarmenian",
  12069. 0x057f,
  12070. "tlinebelow",
  12071. 0x1e6f,
  12072. "tmonospace",
  12073. 0xff54,
  12074. "toarmenian",
  12075. 0x0569,
  12076. "tohiragana",
  12077. 0x3068,
  12078. "tokatakana",
  12079. 0x30c8,
  12080. "tokatakanahalfwidth",
  12081. 0xff84,
  12082. "tonebarextrahighmod",
  12083. 0x02e5,
  12084. "tonebarextralowmod",
  12085. 0x02e9,
  12086. "tonebarhighmod",
  12087. 0x02e6,
  12088. "tonebarlowmod",
  12089. 0x02e8,
  12090. "tonebarmidmod",
  12091. 0x02e7,
  12092. "tonefive",
  12093. 0x01bd,
  12094. "tonesix",
  12095. 0x0185,
  12096. "tonetwo",
  12097. 0x01a8,
  12098. "tonos",
  12099. 0x0384,
  12100. "tonsquare",
  12101. 0x3327,
  12102. "topatakthai",
  12103. 0x0e0f,
  12104. "tortoiseshellbracketleft",
  12105. 0x3014,
  12106. "tortoiseshellbracketleftsmall",
  12107. 0xfe5d,
  12108. "tortoiseshellbracketleftvertical",
  12109. 0xfe39,
  12110. "tortoiseshellbracketright",
  12111. 0x3015,
  12112. "tortoiseshellbracketrightsmall",
  12113. 0xfe5e,
  12114. "tortoiseshellbracketrightvertical",
  12115. 0xfe3a,
  12116. "totaothai",
  12117. 0x0e15,
  12118. "tpalatalhook",
  12119. 0x01ab,
  12120. "tparen",
  12121. 0x24af,
  12122. "trademark",
  12123. 0x2122,
  12124. "trademarksans",
  12125. 0xf8ea,
  12126. "trademarkserif",
  12127. 0xf6db,
  12128. "tretroflexhook",
  12129. 0x0288,
  12130. "triagdn",
  12131. 0x25bc,
  12132. "triaglf",
  12133. 0x25c4,
  12134. "triagrt",
  12135. 0x25ba,
  12136. "triagup",
  12137. 0x25b2,
  12138. "ts",
  12139. 0x02a6,
  12140. "tsadi",
  12141. 0x05e6,
  12142. "tsadidagesh",
  12143. 0xfb46,
  12144. "tsadidageshhebrew",
  12145. 0xfb46,
  12146. "tsadihebrew",
  12147. 0x05e6,
  12148. "tsecyrillic",
  12149. 0x0446,
  12150. "tsere",
  12151. 0x05b5,
  12152. "tsere12",
  12153. 0x05b5,
  12154. "tsere1e",
  12155. 0x05b5,
  12156. "tsere2b",
  12157. 0x05b5,
  12158. "tserehebrew",
  12159. 0x05b5,
  12160. "tserenarrowhebrew",
  12161. 0x05b5,
  12162. "tserequarterhebrew",
  12163. 0x05b5,
  12164. "tserewidehebrew",
  12165. 0x05b5,
  12166. "tshecyrillic",
  12167. 0x045b,
  12168. "tsuperior",
  12169. 0xf6f3,
  12170. "ttabengali",
  12171. 0x099f,
  12172. "ttadeva",
  12173. 0x091f,
  12174. "ttagujarati",
  12175. 0x0a9f,
  12176. "ttagurmukhi",
  12177. 0x0a1f,
  12178. "tteharabic",
  12179. 0x0679,
  12180. "ttehfinalarabic",
  12181. 0xfb67,
  12182. "ttehinitialarabic",
  12183. 0xfb68,
  12184. "ttehmedialarabic",
  12185. 0xfb69,
  12186. "tthabengali",
  12187. 0x09a0,
  12188. "tthadeva",
  12189. 0x0920,
  12190. "tthagujarati",
  12191. 0x0aa0,
  12192. "tthagurmukhi",
  12193. 0x0a20,
  12194. "tturned",
  12195. 0x0287,
  12196. "tuhiragana",
  12197. 0x3064,
  12198. "tukatakana",
  12199. 0x30c4,
  12200. "tukatakanahalfwidth",
  12201. 0xff82,
  12202. "tusmallhiragana",
  12203. 0x3063,
  12204. "tusmallkatakana",
  12205. 0x30c3,
  12206. "tusmallkatakanahalfwidth",
  12207. 0xff6f,
  12208. "twelvecircle",
  12209. 0x246b,
  12210. "twelveparen",
  12211. 0x247f,
  12212. "twelveperiod",
  12213. 0x2493,
  12214. "twelveroman",
  12215. 0x217b,
  12216. "twentycircle",
  12217. 0x2473,
  12218. "twentyhangzhou",
  12219. 0x5344,
  12220. "twentyparen",
  12221. 0x2487,
  12222. "twentyperiod",
  12223. 0x249b,
  12224. "two",
  12225. 0x0032,
  12226. "twoarabic",
  12227. 0x0662,
  12228. "twobengali",
  12229. 0x09e8,
  12230. "twocircle",
  12231. 0x2461,
  12232. "twocircleinversesansserif",
  12233. 0x278b,
  12234. "twodeva",
  12235. 0x0968,
  12236. "twodotenleader",
  12237. 0x2025,
  12238. "twodotleader",
  12239. 0x2025,
  12240. "twodotleadervertical",
  12241. 0xfe30,
  12242. "twogujarati",
  12243. 0x0ae8,
  12244. "twogurmukhi",
  12245. 0x0a68,
  12246. "twohackarabic",
  12247. 0x0662,
  12248. "twohangzhou",
  12249. 0x3022,
  12250. "twoideographicparen",
  12251. 0x3221,
  12252. "twoinferior",
  12253. 0x2082,
  12254. "twomonospace",
  12255. 0xff12,
  12256. "twonumeratorbengali",
  12257. 0x09f5,
  12258. "twooldstyle",
  12259. 0xf732,
  12260. "twoparen",
  12261. 0x2475,
  12262. "twoperiod",
  12263. 0x2489,
  12264. "twopersian",
  12265. 0x06f2,
  12266. "tworoman",
  12267. 0x2171,
  12268. "twostroke",
  12269. 0x01bb,
  12270. "twosuperior",
  12271. 0x00b2,
  12272. "twothai",
  12273. 0x0e52,
  12274. "twothirds",
  12275. 0x2154,
  12276. "u",
  12277. 0x0075,
  12278. "uacute",
  12279. 0x00fa,
  12280. "ubar",
  12281. 0x0289,
  12282. "ubengali",
  12283. 0x0989,
  12284. "ubopomofo",
  12285. 0x3128,
  12286. "ubreve",
  12287. 0x016d,
  12288. "ucaron",
  12289. 0x01d4,
  12290. "ucircle",
  12291. 0x24e4,
  12292. "ucircumflex",
  12293. 0x00fb,
  12294. "ucircumflexbelow",
  12295. 0x1e77,
  12296. "ucyrillic",
  12297. 0x0443,
  12298. "udattadeva",
  12299. 0x0951,
  12300. "udblacute",
  12301. 0x0171,
  12302. "udblgrave",
  12303. 0x0215,
  12304. "udeva",
  12305. 0x0909,
  12306. "udieresis",
  12307. 0x00fc,
  12308. "udieresisacute",
  12309. 0x01d8,
  12310. "udieresisbelow",
  12311. 0x1e73,
  12312. "udieresiscaron",
  12313. 0x01da,
  12314. "udieresiscyrillic",
  12315. 0x04f1,
  12316. "udieresisgrave",
  12317. 0x01dc,
  12318. "udieresismacron",
  12319. 0x01d6,
  12320. "udotbelow",
  12321. 0x1ee5,
  12322. "ugrave",
  12323. 0x00f9,
  12324. "ugujarati",
  12325. 0x0a89,
  12326. "ugurmukhi",
  12327. 0x0a09,
  12328. "uhiragana",
  12329. 0x3046,
  12330. "uhookabove",
  12331. 0x1ee7,
  12332. "uhorn",
  12333. 0x01b0,
  12334. "uhornacute",
  12335. 0x1ee9,
  12336. "uhorndotbelow",
  12337. 0x1ef1,
  12338. "uhorngrave",
  12339. 0x1eeb,
  12340. "uhornhookabove",
  12341. 0x1eed,
  12342. "uhorntilde",
  12343. 0x1eef,
  12344. "uhungarumlaut",
  12345. 0x0171,
  12346. "uhungarumlautcyrillic",
  12347. 0x04f3,
  12348. "uinvertedbreve",
  12349. 0x0217,
  12350. "ukatakana",
  12351. 0x30a6,
  12352. "ukatakanahalfwidth",
  12353. 0xff73,
  12354. "ukcyrillic",
  12355. 0x0479,
  12356. "ukorean",
  12357. 0x315c,
  12358. "umacron",
  12359. 0x016b,
  12360. "umacroncyrillic",
  12361. 0x04ef,
  12362. "umacrondieresis",
  12363. 0x1e7b,
  12364. "umatragurmukhi",
  12365. 0x0a41,
  12366. "umonospace",
  12367. 0xff55,
  12368. "underscore",
  12369. 0x005f,
  12370. "underscoredbl",
  12371. 0x2017,
  12372. "underscoremonospace",
  12373. 0xff3f,
  12374. "underscorevertical",
  12375. 0xfe33,
  12376. "underscorewavy",
  12377. 0xfe4f,
  12378. "union",
  12379. 0x222a,
  12380. "universal",
  12381. 0x2200,
  12382. "uogonek",
  12383. 0x0173,
  12384. "uparen",
  12385. 0x24b0,
  12386. "upblock",
  12387. 0x2580,
  12388. "upperdothebrew",
  12389. 0x05c4,
  12390. "upsilon",
  12391. 0x03c5,
  12392. "upsilondieresis",
  12393. 0x03cb,
  12394. "upsilondieresistonos",
  12395. 0x03b0,
  12396. "upsilonlatin",
  12397. 0x028a,
  12398. "upsilontonos",
  12399. 0x03cd,
  12400. "uptackbelowcmb",
  12401. 0x031d,
  12402. "uptackmod",
  12403. 0x02d4,
  12404. "uragurmukhi",
  12405. 0x0a73,
  12406. "uring",
  12407. 0x016f,
  12408. "ushortcyrillic",
  12409. 0x045e,
  12410. "usmallhiragana",
  12411. 0x3045,
  12412. "usmallkatakana",
  12413. 0x30a5,
  12414. "usmallkatakanahalfwidth",
  12415. 0xff69,
  12416. "ustraightcyrillic",
  12417. 0x04af,
  12418. "ustraightstrokecyrillic",
  12419. 0x04b1,
  12420. "utilde",
  12421. 0x0169,
  12422. "utildeacute",
  12423. 0x1e79,
  12424. "utildebelow",
  12425. 0x1e75,
  12426. "uubengali",
  12427. 0x098a,
  12428. "uudeva",
  12429. 0x090a,
  12430. "uugujarati",
  12431. 0x0a8a,
  12432. "uugurmukhi",
  12433. 0x0a0a,
  12434. "uumatragurmukhi",
  12435. 0x0a42,
  12436. "uuvowelsignbengali",
  12437. 0x09c2,
  12438. "uuvowelsigndeva",
  12439. 0x0942,
  12440. "uuvowelsigngujarati",
  12441. 0x0ac2,
  12442. "uvowelsignbengali",
  12443. 0x09c1,
  12444. "uvowelsigndeva",
  12445. 0x0941,
  12446. "uvowelsigngujarati",
  12447. 0x0ac1,
  12448. "v",
  12449. 0x0076,
  12450. "vadeva",
  12451. 0x0935,
  12452. "vagujarati",
  12453. 0x0ab5,
  12454. "vagurmukhi",
  12455. 0x0a35,
  12456. "vakatakana",
  12457. 0x30f7,
  12458. "vav",
  12459. 0x05d5,
  12460. "vavdagesh",
  12461. 0xfb35,
  12462. "vavdagesh65",
  12463. 0xfb35,
  12464. "vavdageshhebrew",
  12465. 0xfb35,
  12466. "vavhebrew",
  12467. 0x05d5,
  12468. "vavholam",
  12469. 0xfb4b,
  12470. "vavholamhebrew",
  12471. 0xfb4b,
  12472. "vavvavhebrew",
  12473. 0x05f0,
  12474. "vavyodhebrew",
  12475. 0x05f1,
  12476. "vcircle",
  12477. 0x24e5,
  12478. "vdotbelow",
  12479. 0x1e7f,
  12480. "vecyrillic",
  12481. 0x0432,
  12482. "veharabic",
  12483. 0x06a4,
  12484. "vehfinalarabic",
  12485. 0xfb6b,
  12486. "vehinitialarabic",
  12487. 0xfb6c,
  12488. "vehmedialarabic",
  12489. 0xfb6d,
  12490. "vekatakana",
  12491. 0x30f9,
  12492. "venus",
  12493. 0x2640,
  12494. "verticalbar",
  12495. 0x007c,
  12496. "verticallineabovecmb",
  12497. 0x030d,
  12498. "verticallinebelowcmb",
  12499. 0x0329,
  12500. "verticallinelowmod",
  12501. 0x02cc,
  12502. "verticallinemod",
  12503. 0x02c8,
  12504. "vewarmenian",
  12505. 0x057e,
  12506. "vhook",
  12507. 0x028b,
  12508. "vikatakana",
  12509. 0x30f8,
  12510. "viramabengali",
  12511. 0x09cd,
  12512. "viramadeva",
  12513. 0x094d,
  12514. "viramagujarati",
  12515. 0x0acd,
  12516. "visargabengali",
  12517. 0x0983,
  12518. "visargadeva",
  12519. 0x0903,
  12520. "visargagujarati",
  12521. 0x0a83,
  12522. "vmonospace",
  12523. 0xff56,
  12524. "voarmenian",
  12525. 0x0578,
  12526. "voicediterationhiragana",
  12527. 0x309e,
  12528. "voicediterationkatakana",
  12529. 0x30fe,
  12530. "voicedmarkkana",
  12531. 0x309b,
  12532. "voicedmarkkanahalfwidth",
  12533. 0xff9e,
  12534. "vokatakana",
  12535. 0x30fa,
  12536. "vparen",
  12537. 0x24b1,
  12538. "vtilde",
  12539. 0x1e7d,
  12540. "vturned",
  12541. 0x028c,
  12542. "vuhiragana",
  12543. 0x3094,
  12544. "vukatakana",
  12545. 0x30f4,
  12546. "w",
  12547. 0x0077,
  12548. "wacute",
  12549. 0x1e83,
  12550. "waekorean",
  12551. 0x3159,
  12552. "wahiragana",
  12553. 0x308f,
  12554. "wakatakana",
  12555. 0x30ef,
  12556. "wakatakanahalfwidth",
  12557. 0xff9c,
  12558. "wakorean",
  12559. 0x3158,
  12560. "wasmallhiragana",
  12561. 0x308e,
  12562. "wasmallkatakana",
  12563. 0x30ee,
  12564. "wattosquare",
  12565. 0x3357,
  12566. "wavedash",
  12567. 0x301c,
  12568. "wavyunderscorevertical",
  12569. 0xfe34,
  12570. "wawarabic",
  12571. 0x0648,
  12572. "wawfinalarabic",
  12573. 0xfeee,
  12574. "wawhamzaabovearabic",
  12575. 0x0624,
  12576. "wawhamzaabovefinalarabic",
  12577. 0xfe86,
  12578. "wbsquare",
  12579. 0x33dd,
  12580. "wcircle",
  12581. 0x24e6,
  12582. "wcircumflex",
  12583. 0x0175,
  12584. "wdieresis",
  12585. 0x1e85,
  12586. "wdotaccent",
  12587. 0x1e87,
  12588. "wdotbelow",
  12589. 0x1e89,
  12590. "wehiragana",
  12591. 0x3091,
  12592. "weierstrass",
  12593. 0x2118,
  12594. "wekatakana",
  12595. 0x30f1,
  12596. "wekorean",
  12597. 0x315e,
  12598. "weokorean",
  12599. 0x315d,
  12600. "wgrave",
  12601. 0x1e81,
  12602. "whitebullet",
  12603. 0x25e6,
  12604. "whitecircle",
  12605. 0x25cb,
  12606. "whitecircleinverse",
  12607. 0x25d9,
  12608. "whitecornerbracketleft",
  12609. 0x300e,
  12610. "whitecornerbracketleftvertical",
  12611. 0xfe43,
  12612. "whitecornerbracketright",
  12613. 0x300f,
  12614. "whitecornerbracketrightvertical",
  12615. 0xfe44,
  12616. "whitediamond",
  12617. 0x25c7,
  12618. "whitediamondcontainingblacksmalldiamond",
  12619. 0x25c8,
  12620. "whitedownpointingsmalltriangle",
  12621. 0x25bf,
  12622. "whitedownpointingtriangle",
  12623. 0x25bd,
  12624. "whiteleftpointingsmalltriangle",
  12625. 0x25c3,
  12626. "whiteleftpointingtriangle",
  12627. 0x25c1,
  12628. "whitelenticularbracketleft",
  12629. 0x3016,
  12630. "whitelenticularbracketright",
  12631. 0x3017,
  12632. "whiterightpointingsmalltriangle",
  12633. 0x25b9,
  12634. "whiterightpointingtriangle",
  12635. 0x25b7,
  12636. "whitesmallsquare",
  12637. 0x25ab,
  12638. "whitesmilingface",
  12639. 0x263a,
  12640. "whitesquare",
  12641. 0x25a1,
  12642. "whitestar",
  12643. 0x2606,
  12644. "whitetelephone",
  12645. 0x260f,
  12646. "whitetortoiseshellbracketleft",
  12647. 0x3018,
  12648. "whitetortoiseshellbracketright",
  12649. 0x3019,
  12650. "whiteuppointingsmalltriangle",
  12651. 0x25b5,
  12652. "whiteuppointingtriangle",
  12653. 0x25b3,
  12654. "wihiragana",
  12655. 0x3090,
  12656. "wikatakana",
  12657. 0x30f0,
  12658. "wikorean",
  12659. 0x315f,
  12660. "wmonospace",
  12661. 0xff57,
  12662. "wohiragana",
  12663. 0x3092,
  12664. "wokatakana",
  12665. 0x30f2,
  12666. "wokatakanahalfwidth",
  12667. 0xff66,
  12668. "won",
  12669. 0x20a9,
  12670. "wonmonospace",
  12671. 0xffe6,
  12672. "wowaenthai",
  12673. 0x0e27,
  12674. "wparen",
  12675. 0x24b2,
  12676. "wring",
  12677. 0x1e98,
  12678. "wsuperior",
  12679. 0x02b7,
  12680. "wturned",
  12681. 0x028d,
  12682. "wynn",
  12683. 0x01bf,
  12684. "x",
  12685. 0x0078,
  12686. "xabovecmb",
  12687. 0x033d,
  12688. "xbopomofo",
  12689. 0x3112,
  12690. "xcircle",
  12691. 0x24e7,
  12692. "xdieresis",
  12693. 0x1e8d,
  12694. "xdotaccent",
  12695. 0x1e8b,
  12696. "xeharmenian",
  12697. 0x056d,
  12698. "xi",
  12699. 0x03be,
  12700. "xmonospace",
  12701. 0xff58,
  12702. "xparen",
  12703. 0x24b3,
  12704. "xsuperior",
  12705. 0x02e3,
  12706. "y",
  12707. 0x0079,
  12708. "yaadosquare",
  12709. 0x334e,
  12710. "yabengali",
  12711. 0x09af,
  12712. "yacute",
  12713. 0x00fd,
  12714. "yadeva",
  12715. 0x092f,
  12716. "yaekorean",
  12717. 0x3152,
  12718. "yagujarati",
  12719. 0x0aaf,
  12720. "yagurmukhi",
  12721. 0x0a2f,
  12722. "yahiragana",
  12723. 0x3084,
  12724. "yakatakana",
  12725. 0x30e4,
  12726. "yakatakanahalfwidth",
  12727. 0xff94,
  12728. "yakorean",
  12729. 0x3151,
  12730. "yamakkanthai",
  12731. 0x0e4e,
  12732. "yasmallhiragana",
  12733. 0x3083,
  12734. "yasmallkatakana",
  12735. 0x30e3,
  12736. "yasmallkatakanahalfwidth",
  12737. 0xff6c,
  12738. "yatcyrillic",
  12739. 0x0463,
  12740. "ycircle",
  12741. 0x24e8,
  12742. "ycircumflex",
  12743. 0x0177,
  12744. "ydieresis",
  12745. 0x00ff,
  12746. "ydotaccent",
  12747. 0x1e8f,
  12748. "ydotbelow",
  12749. 0x1ef5,
  12750. "yeharabic",
  12751. 0x064a,
  12752. "yehbarreearabic",
  12753. 0x06d2,
  12754. "yehbarreefinalarabic",
  12755. 0xfbaf,
  12756. "yehfinalarabic",
  12757. 0xfef2,
  12758. "yehhamzaabovearabic",
  12759. 0x0626,
  12760. "yehhamzaabovefinalarabic",
  12761. 0xfe8a,
  12762. "yehhamzaaboveinitialarabic",
  12763. 0xfe8b,
  12764. "yehhamzaabovemedialarabic",
  12765. 0xfe8c,
  12766. "yehinitialarabic",
  12767. 0xfef3,
  12768. "yehmedialarabic",
  12769. 0xfef4,
  12770. "yehmeeminitialarabic",
  12771. 0xfcdd,
  12772. "yehmeemisolatedarabic",
  12773. 0xfc58,
  12774. "yehnoonfinalarabic",
  12775. 0xfc94,
  12776. "yehthreedotsbelowarabic",
  12777. 0x06d1,
  12778. "yekorean",
  12779. 0x3156,
  12780. "yen",
  12781. 0x00a5,
  12782. "yenmonospace",
  12783. 0xffe5,
  12784. "yeokorean",
  12785. 0x3155,
  12786. "yeorinhieuhkorean",
  12787. 0x3186,
  12788. "yerahbenyomohebrew",
  12789. 0x05aa,
  12790. "yerahbenyomolefthebrew",
  12791. 0x05aa,
  12792. "yericyrillic",
  12793. 0x044b,
  12794. "yerudieresiscyrillic",
  12795. 0x04f9,
  12796. "yesieungkorean",
  12797. 0x3181,
  12798. "yesieungpansioskorean",
  12799. 0x3183,
  12800. "yesieungsioskorean",
  12801. 0x3182,
  12802. "yetivhebrew",
  12803. 0x059a,
  12804. "ygrave",
  12805. 0x1ef3,
  12806. "yhook",
  12807. 0x01b4,
  12808. "yhookabove",
  12809. 0x1ef7,
  12810. "yiarmenian",
  12811. 0x0575,
  12812. "yicyrillic",
  12813. 0x0457,
  12814. "yikorean",
  12815. 0x3162,
  12816. "yinyang",
  12817. 0x262f,
  12818. "yiwnarmenian",
  12819. 0x0582,
  12820. "ymonospace",
  12821. 0xff59,
  12822. "yod",
  12823. 0x05d9,
  12824. "yoddagesh",
  12825. 0xfb39,
  12826. "yoddageshhebrew",
  12827. 0xfb39,
  12828. "yodhebrew",
  12829. 0x05d9,
  12830. "yodyodhebrew",
  12831. 0x05f2,
  12832. "yodyodpatahhebrew",
  12833. 0xfb1f,
  12834. "yohiragana",
  12835. 0x3088,
  12836. "yoikorean",
  12837. 0x3189,
  12838. "yokatakana",
  12839. 0x30e8,
  12840. "yokatakanahalfwidth",
  12841. 0xff96,
  12842. "yokorean",
  12843. 0x315b,
  12844. "yosmallhiragana",
  12845. 0x3087,
  12846. "yosmallkatakana",
  12847. 0x30e7,
  12848. "yosmallkatakanahalfwidth",
  12849. 0xff6e,
  12850. "yotgreek",
  12851. 0x03f3,
  12852. "yoyaekorean",
  12853. 0x3188,
  12854. "yoyakorean",
  12855. 0x3187,
  12856. "yoyakthai",
  12857. 0x0e22,
  12858. "yoyingthai",
  12859. 0x0e0d,
  12860. "yparen",
  12861. 0x24b4,
  12862. "ypogegrammeni",
  12863. 0x037a,
  12864. "ypogegrammenigreekcmb",
  12865. 0x0345,
  12866. "yr",
  12867. 0x01a6,
  12868. "yring",
  12869. 0x1e99,
  12870. "ysuperior",
  12871. 0x02b8,
  12872. "ytilde",
  12873. 0x1ef9,
  12874. "yturned",
  12875. 0x028e,
  12876. "yuhiragana",
  12877. 0x3086,
  12878. "yuikorean",
  12879. 0x318c,
  12880. "yukatakana",
  12881. 0x30e6,
  12882. "yukatakanahalfwidth",
  12883. 0xff95,
  12884. "yukorean",
  12885. 0x3160,
  12886. "yusbigcyrillic",
  12887. 0x046b,
  12888. "yusbigiotifiedcyrillic",
  12889. 0x046d,
  12890. "yuslittlecyrillic",
  12891. 0x0467,
  12892. "yuslittleiotifiedcyrillic",
  12893. 0x0469,
  12894. "yusmallhiragana",
  12895. 0x3085,
  12896. "yusmallkatakana",
  12897. 0x30e5,
  12898. "yusmallkatakanahalfwidth",
  12899. 0xff6d,
  12900. "yuyekorean",
  12901. 0x318b,
  12902. "yuyeokorean",
  12903. 0x318a,
  12904. "yyabengali",
  12905. 0x09df,
  12906. "yyadeva",
  12907. 0x095f,
  12908. "z",
  12909. 0x007a,
  12910. "zaarmenian",
  12911. 0x0566,
  12912. "zacute",
  12913. 0x017a,
  12914. "zadeva",
  12915. 0x095b,
  12916. "zagurmukhi",
  12917. 0x0a5b,
  12918. "zaharabic",
  12919. 0x0638,
  12920. "zahfinalarabic",
  12921. 0xfec6,
  12922. "zahinitialarabic",
  12923. 0xfec7,
  12924. "zahiragana",
  12925. 0x3056,
  12926. "zahmedialarabic",
  12927. 0xfec8,
  12928. "zainarabic",
  12929. 0x0632,
  12930. "zainfinalarabic",
  12931. 0xfeb0,
  12932. "zakatakana",
  12933. 0x30b6,
  12934. "zaqefgadolhebrew",
  12935. 0x0595,
  12936. "zaqefqatanhebrew",
  12937. 0x0594,
  12938. "zarqahebrew",
  12939. 0x0598,
  12940. "zayin",
  12941. 0x05d6,
  12942. "zayindagesh",
  12943. 0xfb36,
  12944. "zayindageshhebrew",
  12945. 0xfb36,
  12946. "zayinhebrew",
  12947. 0x05d6,
  12948. "zbopomofo",
  12949. 0x3117,
  12950. "zcaron",
  12951. 0x017e,
  12952. "zcircle",
  12953. 0x24e9,
  12954. "zcircumflex",
  12955. 0x1e91,
  12956. "zcurl",
  12957. 0x0291,
  12958. "zdot",
  12959. 0x017c,
  12960. "zdotaccent",
  12961. 0x017c,
  12962. "zdotbelow",
  12963. 0x1e93,
  12964. "zecyrillic",
  12965. 0x0437,
  12966. "zedescendercyrillic",
  12967. 0x0499,
  12968. "zedieresiscyrillic",
  12969. 0x04df,
  12970. "zehiragana",
  12971. 0x305c,
  12972. "zekatakana",
  12973. 0x30bc,
  12974. "zero",
  12975. 0x0030,
  12976. "zeroarabic",
  12977. 0x0660,
  12978. "zerobengali",
  12979. 0x09e6,
  12980. "zerodeva",
  12981. 0x0966,
  12982. "zerogujarati",
  12983. 0x0ae6,
  12984. "zerogurmukhi",
  12985. 0x0a66,
  12986. "zerohackarabic",
  12987. 0x0660,
  12988. "zeroinferior",
  12989. 0x2080,
  12990. "zeromonospace",
  12991. 0xff10,
  12992. "zerooldstyle",
  12993. 0xf730,
  12994. "zeropersian",
  12995. 0x06f0,
  12996. "zerosuperior",
  12997. 0x2070,
  12998. "zerothai",
  12999. 0x0e50,
  13000. "zerowidthjoiner",
  13001. 0xfeff,
  13002. "zerowidthnonjoiner",
  13003. 0x200c,
  13004. "zerowidthspace",
  13005. 0x200b,
  13006. "zeta",
  13007. 0x03b6,
  13008. "zhbopomofo",
  13009. 0x3113,
  13010. "zhearmenian",
  13011. 0x056a,
  13012. "zhebrevecyrillic",
  13013. 0x04c2,
  13014. "zhecyrillic",
  13015. 0x0436,
  13016. "zhedescendercyrillic",
  13017. 0x0497,
  13018. "zhedieresiscyrillic",
  13019. 0x04dd,
  13020. "zihiragana",
  13021. 0x3058,
  13022. "zikatakana",
  13023. 0x30b8,
  13024. "zinorhebrew",
  13025. 0x05ae,
  13026. "zlinebelow",
  13027. 0x1e95,
  13028. "zmonospace",
  13029. 0xff5a,
  13030. "zohiragana",
  13031. 0x305e,
  13032. "zokatakana",
  13033. 0x30be,
  13034. "zparen",
  13035. 0x24b5,
  13036. "zretroflexhook",
  13037. 0x0290,
  13038. "zstroke",
  13039. 0x01b6,
  13040. "zuhiragana",
  13041. 0x305a,
  13042. "zukatakana",
  13043. 0x30ba,
  13044. ".notdef",
  13045. 0x0000,
  13046. "angbracketleftbig",
  13047. 0x2329,
  13048. "angbracketleftBig",
  13049. 0x2329,
  13050. "angbracketleftbigg",
  13051. 0x2329,
  13052. "angbracketleftBigg",
  13053. 0x2329,
  13054. "angbracketrightBig",
  13055. 0x232a,
  13056. "angbracketrightbig",
  13057. 0x232a,
  13058. "angbracketrightBigg",
  13059. 0x232a,
  13060. "angbracketrightbigg",
  13061. 0x232a,
  13062. "arrowhookleft",
  13063. 0x21aa,
  13064. "arrowhookright",
  13065. 0x21a9,
  13066. "arrowlefttophalf",
  13067. 0x21bc,
  13068. "arrowleftbothalf",
  13069. 0x21bd,
  13070. "arrownortheast",
  13071. 0x2197,
  13072. "arrownorthwest",
  13073. 0x2196,
  13074. "arrowrighttophalf",
  13075. 0x21c0,
  13076. "arrowrightbothalf",
  13077. 0x21c1,
  13078. "arrowsoutheast",
  13079. 0x2198,
  13080. "arrowsouthwest",
  13081. 0x2199,
  13082. "backslashbig",
  13083. 0x2216,
  13084. "backslashBig",
  13085. 0x2216,
  13086. "backslashBigg",
  13087. 0x2216,
  13088. "backslashbigg",
  13089. 0x2216,
  13090. "bardbl",
  13091. 0x2016,
  13092. "bracehtipdownleft",
  13093. 0xfe37,
  13094. "bracehtipdownright",
  13095. 0xfe37,
  13096. "bracehtipupleft",
  13097. 0xfe38,
  13098. "bracehtipupright",
  13099. 0xfe38,
  13100. "braceleftBig",
  13101. 0x007b,
  13102. "braceleftbig",
  13103. 0x007b,
  13104. "braceleftbigg",
  13105. 0x007b,
  13106. "braceleftBigg",
  13107. 0x007b,
  13108. "bracerightBig",
  13109. 0x007d,
  13110. "bracerightbig",
  13111. 0x007d,
  13112. "bracerightbigg",
  13113. 0x007d,
  13114. "bracerightBigg",
  13115. 0x007d,
  13116. "bracketleftbig",
  13117. 0x005b,
  13118. "bracketleftBig",
  13119. 0x005b,
  13120. "bracketleftbigg",
  13121. 0x005b,
  13122. "bracketleftBigg",
  13123. 0x005b,
  13124. "bracketrightBig",
  13125. 0x005d,
  13126. "bracketrightbig",
  13127. 0x005d,
  13128. "bracketrightbigg",
  13129. 0x005d,
  13130. "bracketrightBigg",
  13131. 0x005d,
  13132. "ceilingleftbig",
  13133. 0x2308,
  13134. "ceilingleftBig",
  13135. 0x2308,
  13136. "ceilingleftBigg",
  13137. 0x2308,
  13138. "ceilingleftbigg",
  13139. 0x2308,
  13140. "ceilingrightbig",
  13141. 0x2309,
  13142. "ceilingrightBig",
  13143. 0x2309,
  13144. "ceilingrightbigg",
  13145. 0x2309,
  13146. "ceilingrightBigg",
  13147. 0x2309,
  13148. "circledotdisplay",
  13149. 0x2299,
  13150. "circledottext",
  13151. 0x2299,
  13152. "circlemultiplydisplay",
  13153. 0x2297,
  13154. "circlemultiplytext",
  13155. 0x2297,
  13156. "circleplusdisplay",
  13157. 0x2295,
  13158. "circleplustext",
  13159. 0x2295,
  13160. "contintegraldisplay",
  13161. 0x222e,
  13162. "contintegraltext",
  13163. 0x222e,
  13164. "coproductdisplay",
  13165. 0x2210,
  13166. "coproducttext",
  13167. 0x2210,
  13168. "floorleftBig",
  13169. 0x230a,
  13170. "floorleftbig",
  13171. 0x230a,
  13172. "floorleftbigg",
  13173. 0x230a,
  13174. "floorleftBigg",
  13175. 0x230a,
  13176. "floorrightbig",
  13177. 0x230b,
  13178. "floorrightBig",
  13179. 0x230b,
  13180. "floorrightBigg",
  13181. 0x230b,
  13182. "floorrightbigg",
  13183. 0x230b,
  13184. "hatwide",
  13185. 0x0302,
  13186. "hatwider",
  13187. 0x0302,
  13188. "hatwidest",
  13189. 0x0302,
  13190. "intercal",
  13191. 0x1d40,
  13192. "integraldisplay",
  13193. 0x222b,
  13194. "integraltext",
  13195. 0x222b,
  13196. "intersectiondisplay",
  13197. 0x22c2,
  13198. "intersectiontext",
  13199. 0x22c2,
  13200. "logicalanddisplay",
  13201. 0x2227,
  13202. "logicalandtext",
  13203. 0x2227,
  13204. "logicalordisplay",
  13205. 0x2228,
  13206. "logicalortext",
  13207. 0x2228,
  13208. "parenleftBig",
  13209. 0x0028,
  13210. "parenleftbig",
  13211. 0x0028,
  13212. "parenleftBigg",
  13213. 0x0028,
  13214. "parenleftbigg",
  13215. 0x0028,
  13216. "parenrightBig",
  13217. 0x0029,
  13218. "parenrightbig",
  13219. 0x0029,
  13220. "parenrightBigg",
  13221. 0x0029,
  13222. "parenrightbigg",
  13223. 0x0029,
  13224. "prime",
  13225. 0x2032,
  13226. "productdisplay",
  13227. 0x220f,
  13228. "producttext",
  13229. 0x220f,
  13230. "radicalbig",
  13231. 0x221a,
  13232. "radicalBig",
  13233. 0x221a,
  13234. "radicalBigg",
  13235. 0x221a,
  13236. "radicalbigg",
  13237. 0x221a,
  13238. "radicalbt",
  13239. 0x221a,
  13240. "radicaltp",
  13241. 0x221a,
  13242. "radicalvertex",
  13243. 0x221a,
  13244. "slashbig",
  13245. 0x002f,
  13246. "slashBig",
  13247. 0x002f,
  13248. "slashBigg",
  13249. 0x002f,
  13250. "slashbigg",
  13251. 0x002f,
  13252. "summationdisplay",
  13253. 0x2211,
  13254. "summationtext",
  13255. 0x2211,
  13256. "tildewide",
  13257. 0x02dc,
  13258. "tildewider",
  13259. 0x02dc,
  13260. "tildewidest",
  13261. 0x02dc,
  13262. "uniondisplay",
  13263. 0x22c3,
  13264. "unionmultidisplay",
  13265. 0x228e,
  13266. "unionmultitext",
  13267. 0x228e,
  13268. "unionsqdisplay",
  13269. 0x2294,
  13270. "unionsqtext",
  13271. 0x2294,
  13272. "uniontext",
  13273. 0x22c3,
  13274. "vextenddouble",
  13275. 0x2225,
  13276. "vextendsingle",
  13277. 0x2223
  13278. ];
  13279. });
  13280. const getDingbatsGlyphsUnicode = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  13281. return [
  13282. "space",
  13283. 0x0020,
  13284. "a1",
  13285. 0x2701,
  13286. "a2",
  13287. 0x2702,
  13288. "a202",
  13289. 0x2703,
  13290. "a3",
  13291. 0x2704,
  13292. "a4",
  13293. 0x260e,
  13294. "a5",
  13295. 0x2706,
  13296. "a119",
  13297. 0x2707,
  13298. "a118",
  13299. 0x2708,
  13300. "a117",
  13301. 0x2709,
  13302. "a11",
  13303. 0x261b,
  13304. "a12",
  13305. 0x261e,
  13306. "a13",
  13307. 0x270c,
  13308. "a14",
  13309. 0x270d,
  13310. "a15",
  13311. 0x270e,
  13312. "a16",
  13313. 0x270f,
  13314. "a105",
  13315. 0x2710,
  13316. "a17",
  13317. 0x2711,
  13318. "a18",
  13319. 0x2712,
  13320. "a19",
  13321. 0x2713,
  13322. "a20",
  13323. 0x2714,
  13324. "a21",
  13325. 0x2715,
  13326. "a22",
  13327. 0x2716,
  13328. "a23",
  13329. 0x2717,
  13330. "a24",
  13331. 0x2718,
  13332. "a25",
  13333. 0x2719,
  13334. "a26",
  13335. 0x271a,
  13336. "a27",
  13337. 0x271b,
  13338. "a28",
  13339. 0x271c,
  13340. "a6",
  13341. 0x271d,
  13342. "a7",
  13343. 0x271e,
  13344. "a8",
  13345. 0x271f,
  13346. "a9",
  13347. 0x2720,
  13348. "a10",
  13349. 0x2721,
  13350. "a29",
  13351. 0x2722,
  13352. "a30",
  13353. 0x2723,
  13354. "a31",
  13355. 0x2724,
  13356. "a32",
  13357. 0x2725,
  13358. "a33",
  13359. 0x2726,
  13360. "a34",
  13361. 0x2727,
  13362. "a35",
  13363. 0x2605,
  13364. "a36",
  13365. 0x2729,
  13366. "a37",
  13367. 0x272a,
  13368. "a38",
  13369. 0x272b,
  13370. "a39",
  13371. 0x272c,
  13372. "a40",
  13373. 0x272d,
  13374. "a41",
  13375. 0x272e,
  13376. "a42",
  13377. 0x272f,
  13378. "a43",
  13379. 0x2730,
  13380. "a44",
  13381. 0x2731,
  13382. "a45",
  13383. 0x2732,
  13384. "a46",
  13385. 0x2733,
  13386. "a47",
  13387. 0x2734,
  13388. "a48",
  13389. 0x2735,
  13390. "a49",
  13391. 0x2736,
  13392. "a50",
  13393. 0x2737,
  13394. "a51",
  13395. 0x2738,
  13396. "a52",
  13397. 0x2739,
  13398. "a53",
  13399. 0x273a,
  13400. "a54",
  13401. 0x273b,
  13402. "a55",
  13403. 0x273c,
  13404. "a56",
  13405. 0x273d,
  13406. "a57",
  13407. 0x273e,
  13408. "a58",
  13409. 0x273f,
  13410. "a59",
  13411. 0x2740,
  13412. "a60",
  13413. 0x2741,
  13414. "a61",
  13415. 0x2742,
  13416. "a62",
  13417. 0x2743,
  13418. "a63",
  13419. 0x2744,
  13420. "a64",
  13421. 0x2745,
  13422. "a65",
  13423. 0x2746,
  13424. "a66",
  13425. 0x2747,
  13426. "a67",
  13427. 0x2748,
  13428. "a68",
  13429. 0x2749,
  13430. "a69",
  13431. 0x274a,
  13432. "a70",
  13433. 0x274b,
  13434. "a71",
  13435. 0x25cf,
  13436. "a72",
  13437. 0x274d,
  13438. "a73",
  13439. 0x25a0,
  13440. "a74",
  13441. 0x274f,
  13442. "a203",
  13443. 0x2750,
  13444. "a75",
  13445. 0x2751,
  13446. "a204",
  13447. 0x2752,
  13448. "a76",
  13449. 0x25b2,
  13450. "a77",
  13451. 0x25bc,
  13452. "a78",
  13453. 0x25c6,
  13454. "a79",
  13455. 0x2756,
  13456. "a81",
  13457. 0x25d7,
  13458. "a82",
  13459. 0x2758,
  13460. "a83",
  13461. 0x2759,
  13462. "a84",
  13463. 0x275a,
  13464. "a97",
  13465. 0x275b,
  13466. "a98",
  13467. 0x275c,
  13468. "a99",
  13469. 0x275d,
  13470. "a100",
  13471. 0x275e,
  13472. "a101",
  13473. 0x2761,
  13474. "a102",
  13475. 0x2762,
  13476. "a103",
  13477. 0x2763,
  13478. "a104",
  13479. 0x2764,
  13480. "a106",
  13481. 0x2765,
  13482. "a107",
  13483. 0x2766,
  13484. "a108",
  13485. 0x2767,
  13486. "a112",
  13487. 0x2663,
  13488. "a111",
  13489. 0x2666,
  13490. "a110",
  13491. 0x2665,
  13492. "a109",
  13493. 0x2660,
  13494. "a120",
  13495. 0x2460,
  13496. "a121",
  13497. 0x2461,
  13498. "a122",
  13499. 0x2462,
  13500. "a123",
  13501. 0x2463,
  13502. "a124",
  13503. 0x2464,
  13504. "a125",
  13505. 0x2465,
  13506. "a126",
  13507. 0x2466,
  13508. "a127",
  13509. 0x2467,
  13510. "a128",
  13511. 0x2468,
  13512. "a129",
  13513. 0x2469,
  13514. "a130",
  13515. 0x2776,
  13516. "a131",
  13517. 0x2777,
  13518. "a132",
  13519. 0x2778,
  13520. "a133",
  13521. 0x2779,
  13522. "a134",
  13523. 0x277a,
  13524. "a135",
  13525. 0x277b,
  13526. "a136",
  13527. 0x277c,
  13528. "a137",
  13529. 0x277d,
  13530. "a138",
  13531. 0x277e,
  13532. "a139",
  13533. 0x277f,
  13534. "a140",
  13535. 0x2780,
  13536. "a141",
  13537. 0x2781,
  13538. "a142",
  13539. 0x2782,
  13540. "a143",
  13541. 0x2783,
  13542. "a144",
  13543. 0x2784,
  13544. "a145",
  13545. 0x2785,
  13546. "a146",
  13547. 0x2786,
  13548. "a147",
  13549. 0x2787,
  13550. "a148",
  13551. 0x2788,
  13552. "a149",
  13553. 0x2789,
  13554. "a150",
  13555. 0x278a,
  13556. "a151",
  13557. 0x278b,
  13558. "a152",
  13559. 0x278c,
  13560. "a153",
  13561. 0x278d,
  13562. "a154",
  13563. 0x278e,
  13564. "a155",
  13565. 0x278f,
  13566. "a156",
  13567. 0x2790,
  13568. "a157",
  13569. 0x2791,
  13570. "a158",
  13571. 0x2792,
  13572. "a159",
  13573. 0x2793,
  13574. "a160",
  13575. 0x2794,
  13576. "a161",
  13577. 0x2192,
  13578. "a163",
  13579. 0x2194,
  13580. "a164",
  13581. 0x2195,
  13582. "a196",
  13583. 0x2798,
  13584. "a165",
  13585. 0x2799,
  13586. "a192",
  13587. 0x279a,
  13588. "a166",
  13589. 0x279b,
  13590. "a167",
  13591. 0x279c,
  13592. "a168",
  13593. 0x279d,
  13594. "a169",
  13595. 0x279e,
  13596. "a170",
  13597. 0x279f,
  13598. "a171",
  13599. 0x27a0,
  13600. "a172",
  13601. 0x27a1,
  13602. "a173",
  13603. 0x27a2,
  13604. "a162",
  13605. 0x27a3,
  13606. "a174",
  13607. 0x27a4,
  13608. "a175",
  13609. 0x27a5,
  13610. "a176",
  13611. 0x27a6,
  13612. "a177",
  13613. 0x27a7,
  13614. "a178",
  13615. 0x27a8,
  13616. "a179",
  13617. 0x27a9,
  13618. "a193",
  13619. 0x27aa,
  13620. "a180",
  13621. 0x27ab,
  13622. "a199",
  13623. 0x27ac,
  13624. "a181",
  13625. 0x27ad,
  13626. "a200",
  13627. 0x27ae,
  13628. "a182",
  13629. 0x27af,
  13630. "a201",
  13631. 0x27b1,
  13632. "a183",
  13633. 0x27b2,
  13634. "a184",
  13635. 0x27b3,
  13636. "a197",
  13637. 0x27b4,
  13638. "a185",
  13639. 0x27b5,
  13640. "a194",
  13641. 0x27b6,
  13642. "a198",
  13643. 0x27b7,
  13644. "a186",
  13645. 0x27b8,
  13646. "a195",
  13647. 0x27b9,
  13648. "a187",
  13649. 0x27ba,
  13650. "a188",
  13651. 0x27bb,
  13652. "a189",
  13653. 0x27bc,
  13654. "a190",
  13655. 0x27bd,
  13656. "a191",
  13657. 0x27be,
  13658. "a89",
  13659. 0x2768,
  13660. "a90",
  13661. 0x2769,
  13662. "a93",
  13663. 0x276a,
  13664. "a94",
  13665. 0x276b,
  13666. "a91",
  13667. 0x276c,
  13668. "a92",
  13669. 0x276d,
  13670. "a205",
  13671. 0x276e,
  13672. "a85",
  13673. 0x276f,
  13674. "a206",
  13675. 0x2770,
  13676. "a86",
  13677. 0x2771,
  13678. "a87",
  13679. 0x2772,
  13680. "a88",
  13681. 0x2773,
  13682. "a95",
  13683. 0x2774,
  13684. "a96",
  13685. 0x2775,
  13686. ".notdef",
  13687. 0x0000
  13688. ];
  13689. });
  13690. /***/ }),
  13691. /* 21 */
  13692. /***/ ((__unused_webpack_module, __webpack_exports__, __w_pdfjs_require__) => {
  13693. __w_pdfjs_require__.r(__webpack_exports__);
  13694. /* harmony export */ __w_pdfjs_require__.d(__webpack_exports__, {
  13695. /* harmony export */ "clearUnicodeCaches": () => (/* binding */ clearUnicodeCaches),
  13696. /* harmony export */ "getCharUnicodeCategory": () => (/* binding */ getCharUnicodeCategory),
  13697. /* harmony export */ "getNormalizedUnicodes": () => (/* binding */ getNormalizedUnicodes),
  13698. /* harmony export */ "getUnicodeForGlyph": () => (/* binding */ getUnicodeForGlyph),
  13699. /* harmony export */ "getUnicodeRangeFor": () => (/* binding */ getUnicodeRangeFor),
  13700. /* harmony export */ "mapSpecialUnicodeValues": () => (/* binding */ mapSpecialUnicodeValues),
  13701. /* harmony export */ "reverseIfRtl": () => (/* binding */ reverseIfRtl)
  13702. /* harmony export */ });
  13703. /* harmony import */ var _core_utils_js__WEBPACK_IMPORTED_MODULE_0__ = __w_pdfjs_require__(8);
  13704. const getSpecialPUASymbols = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getLookupTableFactory)(function (t) {
  13705. t[63721] = 0x00a9;
  13706. t[63193] = 0x00a9;
  13707. t[63720] = 0x00ae;
  13708. t[63194] = 0x00ae;
  13709. t[63722] = 0x2122;
  13710. t[63195] = 0x2122;
  13711. t[63729] = 0x23a7;
  13712. t[63730] = 0x23a8;
  13713. t[63731] = 0x23a9;
  13714. t[63740] = 0x23ab;
  13715. t[63741] = 0x23ac;
  13716. t[63742] = 0x23ad;
  13717. t[63726] = 0x23a1;
  13718. t[63727] = 0x23a2;
  13719. t[63728] = 0x23a3;
  13720. t[63737] = 0x23a4;
  13721. t[63738] = 0x23a5;
  13722. t[63739] = 0x23a6;
  13723. t[63723] = 0x239b;
  13724. t[63724] = 0x239c;
  13725. t[63725] = 0x239d;
  13726. t[63734] = 0x239e;
  13727. t[63735] = 0x239f;
  13728. t[63736] = 0x23a0;
  13729. });
  13730. function mapSpecialUnicodeValues(code) {
  13731. if (code >= 0xfff0 && code <= 0xffff) {
  13732. return 0;
  13733. } else if (code >= 0xf600 && code <= 0xf8ff) {
  13734. return getSpecialPUASymbols()[code] || code;
  13735. } else if (code === 0x00ad) {
  13736. return 0x002d;
  13737. }
  13738. return code;
  13739. }
  13740. function getUnicodeForGlyph(name, glyphsUnicodeMap) {
  13741. let unicode = glyphsUnicodeMap[name];
  13742. if (unicode !== undefined) {
  13743. return unicode;
  13744. }
  13745. if (!name) {
  13746. return -1;
  13747. }
  13748. if (name[0] === "u") {
  13749. const nameLen = name.length;
  13750. let hexStr;
  13751. if (nameLen === 7 && name[1] === "n" && name[2] === "i") {
  13752. hexStr = name.substring(3);
  13753. } else if (nameLen >= 5 && nameLen <= 7) {
  13754. hexStr = name.substring(1);
  13755. } else {
  13756. return -1;
  13757. }
  13758. if (hexStr === hexStr.toUpperCase()) {
  13759. unicode = parseInt(hexStr, 16);
  13760. if (unicode >= 0) {
  13761. return unicode;
  13762. }
  13763. }
  13764. }
  13765. return -1;
  13766. }
  13767. const UnicodeRanges = [
  13768. {
  13769. begin: 0x0000,
  13770. end: 0x007f
  13771. },
  13772. {
  13773. begin: 0x0080,
  13774. end: 0x00ff
  13775. },
  13776. {
  13777. begin: 0x0100,
  13778. end: 0x017f
  13779. },
  13780. {
  13781. begin: 0x0180,
  13782. end: 0x024f
  13783. },
  13784. {
  13785. begin: 0x0250,
  13786. end: 0x02af
  13787. },
  13788. {
  13789. begin: 0x02b0,
  13790. end: 0x02ff
  13791. },
  13792. {
  13793. begin: 0x0300,
  13794. end: 0x036f
  13795. },
  13796. {
  13797. begin: 0x0370,
  13798. end: 0x03ff
  13799. },
  13800. {
  13801. begin: 0x2c80,
  13802. end: 0x2cff
  13803. },
  13804. {
  13805. begin: 0x0400,
  13806. end: 0x04ff
  13807. },
  13808. {
  13809. begin: 0x0530,
  13810. end: 0x058f
  13811. },
  13812. {
  13813. begin: 0x0590,
  13814. end: 0x05ff
  13815. },
  13816. {
  13817. begin: 0xa500,
  13818. end: 0xa63f
  13819. },
  13820. {
  13821. begin: 0x0600,
  13822. end: 0x06ff
  13823. },
  13824. {
  13825. begin: 0x07c0,
  13826. end: 0x07ff
  13827. },
  13828. {
  13829. begin: 0x0900,
  13830. end: 0x097f
  13831. },
  13832. {
  13833. begin: 0x0980,
  13834. end: 0x09ff
  13835. },
  13836. {
  13837. begin: 0x0a00,
  13838. end: 0x0a7f
  13839. },
  13840. {
  13841. begin: 0x0a80,
  13842. end: 0x0aff
  13843. },
  13844. {
  13845. begin: 0x0b00,
  13846. end: 0x0b7f
  13847. },
  13848. {
  13849. begin: 0x0b80,
  13850. end: 0x0bff
  13851. },
  13852. {
  13853. begin: 0x0c00,
  13854. end: 0x0c7f
  13855. },
  13856. {
  13857. begin: 0x0c80,
  13858. end: 0x0cff
  13859. },
  13860. {
  13861. begin: 0x0d00,
  13862. end: 0x0d7f
  13863. },
  13864. {
  13865. begin: 0x0e00,
  13866. end: 0x0e7f
  13867. },
  13868. {
  13869. begin: 0x0e80,
  13870. end: 0x0eff
  13871. },
  13872. {
  13873. begin: 0x10a0,
  13874. end: 0x10ff
  13875. },
  13876. {
  13877. begin: 0x1b00,
  13878. end: 0x1b7f
  13879. },
  13880. {
  13881. begin: 0x1100,
  13882. end: 0x11ff
  13883. },
  13884. {
  13885. begin: 0x1e00,
  13886. end: 0x1eff
  13887. },
  13888. {
  13889. begin: 0x1f00,
  13890. end: 0x1fff
  13891. },
  13892. {
  13893. begin: 0x2000,
  13894. end: 0x206f
  13895. },
  13896. {
  13897. begin: 0x2070,
  13898. end: 0x209f
  13899. },
  13900. {
  13901. begin: 0x20a0,
  13902. end: 0x20cf
  13903. },
  13904. {
  13905. begin: 0x20d0,
  13906. end: 0x20ff
  13907. },
  13908. {
  13909. begin: 0x2100,
  13910. end: 0x214f
  13911. },
  13912. {
  13913. begin: 0x2150,
  13914. end: 0x218f
  13915. },
  13916. {
  13917. begin: 0x2190,
  13918. end: 0x21ff
  13919. },
  13920. {
  13921. begin: 0x2200,
  13922. end: 0x22ff
  13923. },
  13924. {
  13925. begin: 0x2300,
  13926. end: 0x23ff
  13927. },
  13928. {
  13929. begin: 0x2400,
  13930. end: 0x243f
  13931. },
  13932. {
  13933. begin: 0x2440,
  13934. end: 0x245f
  13935. },
  13936. {
  13937. begin: 0x2460,
  13938. end: 0x24ff
  13939. },
  13940. {
  13941. begin: 0x2500,
  13942. end: 0x257f
  13943. },
  13944. {
  13945. begin: 0x2580,
  13946. end: 0x259f
  13947. },
  13948. {
  13949. begin: 0x25a0,
  13950. end: 0x25ff
  13951. },
  13952. {
  13953. begin: 0x2600,
  13954. end: 0x26ff
  13955. },
  13956. {
  13957. begin: 0x2700,
  13958. end: 0x27bf
  13959. },
  13960. {
  13961. begin: 0x3000,
  13962. end: 0x303f
  13963. },
  13964. {
  13965. begin: 0x3040,
  13966. end: 0x309f
  13967. },
  13968. {
  13969. begin: 0x30a0,
  13970. end: 0x30ff
  13971. },
  13972. {
  13973. begin: 0x3100,
  13974. end: 0x312f
  13975. },
  13976. {
  13977. begin: 0x3130,
  13978. end: 0x318f
  13979. },
  13980. {
  13981. begin: 0xa840,
  13982. end: 0xa87f
  13983. },
  13984. {
  13985. begin: 0x3200,
  13986. end: 0x32ff
  13987. },
  13988. {
  13989. begin: 0x3300,
  13990. end: 0x33ff
  13991. },
  13992. {
  13993. begin: 0xac00,
  13994. end: 0xd7af
  13995. },
  13996. {
  13997. begin: 0xd800,
  13998. end: 0xdfff
  13999. },
  14000. {
  14001. begin: 0x10900,
  14002. end: 0x1091f
  14003. },
  14004. {
  14005. begin: 0x4e00,
  14006. end: 0x9fff
  14007. },
  14008. {
  14009. begin: 0xe000,
  14010. end: 0xf8ff
  14011. },
  14012. {
  14013. begin: 0x31c0,
  14014. end: 0x31ef
  14015. },
  14016. {
  14017. begin: 0xfb00,
  14018. end: 0xfb4f
  14019. },
  14020. {
  14021. begin: 0xfb50,
  14022. end: 0xfdff
  14023. },
  14024. {
  14025. begin: 0xfe20,
  14026. end: 0xfe2f
  14027. },
  14028. {
  14029. begin: 0xfe10,
  14030. end: 0xfe1f
  14031. },
  14032. {
  14033. begin: 0xfe50,
  14034. end: 0xfe6f
  14035. },
  14036. {
  14037. begin: 0xfe70,
  14038. end: 0xfeff
  14039. },
  14040. {
  14041. begin: 0xff00,
  14042. end: 0xffef
  14043. },
  14044. {
  14045. begin: 0xfff0,
  14046. end: 0xffff
  14047. },
  14048. {
  14049. begin: 0x0f00,
  14050. end: 0x0fff
  14051. },
  14052. {
  14053. begin: 0x0700,
  14054. end: 0x074f
  14055. },
  14056. {
  14057. begin: 0x0780,
  14058. end: 0x07bf
  14059. },
  14060. {
  14061. begin: 0x0d80,
  14062. end: 0x0dff
  14063. },
  14064. {
  14065. begin: 0x1000,
  14066. end: 0x109f
  14067. },
  14068. {
  14069. begin: 0x1200,
  14070. end: 0x137f
  14071. },
  14072. {
  14073. begin: 0x13a0,
  14074. end: 0x13ff
  14075. },
  14076. {
  14077. begin: 0x1400,
  14078. end: 0x167f
  14079. },
  14080. {
  14081. begin: 0x1680,
  14082. end: 0x169f
  14083. },
  14084. {
  14085. begin: 0x16a0,
  14086. end: 0x16ff
  14087. },
  14088. {
  14089. begin: 0x1780,
  14090. end: 0x17ff
  14091. },
  14092. {
  14093. begin: 0x1800,
  14094. end: 0x18af
  14095. },
  14096. {
  14097. begin: 0x2800,
  14098. end: 0x28ff
  14099. },
  14100. {
  14101. begin: 0xa000,
  14102. end: 0xa48f
  14103. },
  14104. {
  14105. begin: 0x1700,
  14106. end: 0x171f
  14107. },
  14108. {
  14109. begin: 0x10300,
  14110. end: 0x1032f
  14111. },
  14112. {
  14113. begin: 0x10330,
  14114. end: 0x1034f
  14115. },
  14116. {
  14117. begin: 0x10400,
  14118. end: 0x1044f
  14119. },
  14120. {
  14121. begin: 0x1d000,
  14122. end: 0x1d0ff
  14123. },
  14124. {
  14125. begin: 0x1d400,
  14126. end: 0x1d7ff
  14127. },
  14128. {
  14129. begin: 0xff000,
  14130. end: 0xffffd
  14131. },
  14132. {
  14133. begin: 0xfe00,
  14134. end: 0xfe0f
  14135. },
  14136. {
  14137. begin: 0xe0000,
  14138. end: 0xe007f
  14139. },
  14140. {
  14141. begin: 0x1900,
  14142. end: 0x194f
  14143. },
  14144. {
  14145. begin: 0x1950,
  14146. end: 0x197f
  14147. },
  14148. {
  14149. begin: 0x1980,
  14150. end: 0x19df
  14151. },
  14152. {
  14153. begin: 0x1a00,
  14154. end: 0x1a1f
  14155. },
  14156. {
  14157. begin: 0x2c00,
  14158. end: 0x2c5f
  14159. },
  14160. {
  14161. begin: 0x2d30,
  14162. end: 0x2d7f
  14163. },
  14164. {
  14165. begin: 0x4dc0,
  14166. end: 0x4dff
  14167. },
  14168. {
  14169. begin: 0xa800,
  14170. end: 0xa82f
  14171. },
  14172. {
  14173. begin: 0x10000,
  14174. end: 0x1007f
  14175. },
  14176. {
  14177. begin: 0x10140,
  14178. end: 0x1018f
  14179. },
  14180. {
  14181. begin: 0x10380,
  14182. end: 0x1039f
  14183. },
  14184. {
  14185. begin: 0x103a0,
  14186. end: 0x103df
  14187. },
  14188. {
  14189. begin: 0x10450,
  14190. end: 0x1047f
  14191. },
  14192. {
  14193. begin: 0x10480,
  14194. end: 0x104af
  14195. },
  14196. {
  14197. begin: 0x10800,
  14198. end: 0x1083f
  14199. },
  14200. {
  14201. begin: 0x10a00,
  14202. end: 0x10a5f
  14203. },
  14204. {
  14205. begin: 0x1d300,
  14206. end: 0x1d35f
  14207. },
  14208. {
  14209. begin: 0x12000,
  14210. end: 0x123ff
  14211. },
  14212. {
  14213. begin: 0x1d360,
  14214. end: 0x1d37f
  14215. },
  14216. {
  14217. begin: 0x1b80,
  14218. end: 0x1bbf
  14219. },
  14220. {
  14221. begin: 0x1c00,
  14222. end: 0x1c4f
  14223. },
  14224. {
  14225. begin: 0x1c50,
  14226. end: 0x1c7f
  14227. },
  14228. {
  14229. begin: 0xa880,
  14230. end: 0xa8df
  14231. },
  14232. {
  14233. begin: 0xa900,
  14234. end: 0xa92f
  14235. },
  14236. {
  14237. begin: 0xa930,
  14238. end: 0xa95f
  14239. },
  14240. {
  14241. begin: 0xaa00,
  14242. end: 0xaa5f
  14243. },
  14244. {
  14245. begin: 0x10190,
  14246. end: 0x101cf
  14247. },
  14248. {
  14249. begin: 0x101d0,
  14250. end: 0x101ff
  14251. },
  14252. {
  14253. begin: 0x102a0,
  14254. end: 0x102df
  14255. },
  14256. {
  14257. begin: 0x1f030,
  14258. end: 0x1f09f
  14259. }
  14260. ];
  14261. function getUnicodeRangeFor(value) {
  14262. for (let i = 0, ii = UnicodeRanges.length; i < ii; i++) {
  14263. const range = UnicodeRanges[i];
  14264. if (value >= range.begin && value < range.end) {
  14265. return i;
  14266. }
  14267. }
  14268. return -1;
  14269. }
  14270. function isRTLRangeFor(value) {
  14271. let range = UnicodeRanges[13];
  14272. if (value >= range.begin && value < range.end) {
  14273. return true;
  14274. }
  14275. range = UnicodeRanges[11];
  14276. if (value >= range.begin && value < range.end) {
  14277. return true;
  14278. }
  14279. return false;
  14280. }
  14281. const getNormalizedUnicodes = (0,_core_utils_js__WEBPACK_IMPORTED_MODULE_0__.getArrayLookupTableFactory)(function () {
  14282. return [
  14283. "\u00A8",
  14284. "\u0020\u0308",
  14285. "\u00AF",
  14286. "\u0020\u0304",
  14287. "\u00B4",
  14288. "\u0020\u0301",
  14289. "\u00B5",
  14290. "\u03BC",
  14291. "\u00B8",
  14292. "\u0020\u0327",
  14293. "\u0132",
  14294. "\u0049\u004A",
  14295. "\u0133",
  14296. "\u0069\u006A",
  14297. "\u013F",
  14298. "\u004C\u00B7",
  14299. "\u0140",
  14300. "\u006C\u00B7",
  14301. "\u0149",
  14302. "\u02BC\u006E",
  14303. "\u017F",
  14304. "\u0073",
  14305. "\u01C4",
  14306. "\u0044\u017D",
  14307. "\u01C5",
  14308. "\u0044\u017E",
  14309. "\u01C6",
  14310. "\u0064\u017E",
  14311. "\u01C7",
  14312. "\u004C\u004A",
  14313. "\u01C8",
  14314. "\u004C\u006A",
  14315. "\u01C9",
  14316. "\u006C\u006A",
  14317. "\u01CA",
  14318. "\u004E\u004A",
  14319. "\u01CB",
  14320. "\u004E\u006A",
  14321. "\u01CC",
  14322. "\u006E\u006A",
  14323. "\u01F1",
  14324. "\u0044\u005A",
  14325. "\u01F2",
  14326. "\u0044\u007A",
  14327. "\u01F3",
  14328. "\u0064\u007A",
  14329. "\u02D8",
  14330. "\u0020\u0306",
  14331. "\u02D9",
  14332. "\u0020\u0307",
  14333. "\u02DA",
  14334. "\u0020\u030A",
  14335. "\u02DB",
  14336. "\u0020\u0328",
  14337. "\u02DC",
  14338. "\u0020\u0303",
  14339. "\u02DD",
  14340. "\u0020\u030B",
  14341. "\u037A",
  14342. "\u0020\u0345",
  14343. "\u0384",
  14344. "\u0020\u0301",
  14345. "\u03D0",
  14346. "\u03B2",
  14347. "\u03D1",
  14348. "\u03B8",
  14349. "\u03D2",
  14350. "\u03A5",
  14351. "\u03D5",
  14352. "\u03C6",
  14353. "\u03D6",
  14354. "\u03C0",
  14355. "\u03F0",
  14356. "\u03BA",
  14357. "\u03F1",
  14358. "\u03C1",
  14359. "\u03F2",
  14360. "\u03C2",
  14361. "\u03F4",
  14362. "\u0398",
  14363. "\u03F5",
  14364. "\u03B5",
  14365. "\u03F9",
  14366. "\u03A3",
  14367. "\u0587",
  14368. "\u0565\u0582",
  14369. "\u0675",
  14370. "\u0627\u0674",
  14371. "\u0676",
  14372. "\u0648\u0674",
  14373. "\u0677",
  14374. "\u06C7\u0674",
  14375. "\u0678",
  14376. "\u064A\u0674",
  14377. "\u0E33",
  14378. "\u0E4D\u0E32",
  14379. "\u0EB3",
  14380. "\u0ECD\u0EB2",
  14381. "\u0EDC",
  14382. "\u0EAB\u0E99",
  14383. "\u0EDD",
  14384. "\u0EAB\u0EA1",
  14385. "\u0F77",
  14386. "\u0FB2\u0F81",
  14387. "\u0F79",
  14388. "\u0FB3\u0F81",
  14389. "\u1E9A",
  14390. "\u0061\u02BE",
  14391. "\u1FBD",
  14392. "\u0020\u0313",
  14393. "\u1FBF",
  14394. "\u0020\u0313",
  14395. "\u1FC0",
  14396. "\u0020\u0342",
  14397. "\u1FFE",
  14398. "\u0020\u0314",
  14399. "\u2002",
  14400. "\u0020",
  14401. "\u2003",
  14402. "\u0020",
  14403. "\u2004",
  14404. "\u0020",
  14405. "\u2005",
  14406. "\u0020",
  14407. "\u2006",
  14408. "\u0020",
  14409. "\u2008",
  14410. "\u0020",
  14411. "\u2009",
  14412. "\u0020",
  14413. "\u200A",
  14414. "\u0020",
  14415. "\u2017",
  14416. "\u0020\u0333",
  14417. "\u2024",
  14418. "\u002E",
  14419. "\u2025",
  14420. "\u002E\u002E",
  14421. "\u2026",
  14422. "\u002E\u002E\u002E",
  14423. "\u2033",
  14424. "\u2032\u2032",
  14425. "\u2034",
  14426. "\u2032\u2032\u2032",
  14427. "\u2036",
  14428. "\u2035\u2035",
  14429. "\u2037",
  14430. "\u2035\u2035\u2035",
  14431. "\u203C",
  14432. "\u0021\u0021",
  14433. "\u203E",
  14434. "\u0020\u0305",
  14435. "\u2047",
  14436. "\u003F\u003F",
  14437. "\u2048",
  14438. "\u003F\u0021",
  14439. "\u2049",
  14440. "\u0021\u003F",
  14441. "\u2057",
  14442. "\u2032\u2032\u2032\u2032",
  14443. "\u205F",
  14444. "\u0020",
  14445. "\u20A8",
  14446. "\u0052\u0073",
  14447. "\u2100",
  14448. "\u0061\u002F\u0063",
  14449. "\u2101",
  14450. "\u0061\u002F\u0073",
  14451. "\u2103",
  14452. "\u00B0\u0043",
  14453. "\u2105",
  14454. "\u0063\u002F\u006F",
  14455. "\u2106",
  14456. "\u0063\u002F\u0075",
  14457. "\u2107",
  14458. "\u0190",
  14459. "\u2109",
  14460. "\u00B0\u0046",
  14461. "\u2116",
  14462. "\u004E\u006F",
  14463. "\u2121",
  14464. "\u0054\u0045\u004C",
  14465. "\u2135",
  14466. "\u05D0",
  14467. "\u2136",
  14468. "\u05D1",
  14469. "\u2137",
  14470. "\u05D2",
  14471. "\u2138",
  14472. "\u05D3",
  14473. "\u213B",
  14474. "\u0046\u0041\u0058",
  14475. "\u2160",
  14476. "\u0049",
  14477. "\u2161",
  14478. "\u0049\u0049",
  14479. "\u2162",
  14480. "\u0049\u0049\u0049",
  14481. "\u2163",
  14482. "\u0049\u0056",
  14483. "\u2164",
  14484. "\u0056",
  14485. "\u2165",
  14486. "\u0056\u0049",
  14487. "\u2166",
  14488. "\u0056\u0049\u0049",
  14489. "\u2167",
  14490. "\u0056\u0049\u0049\u0049",
  14491. "\u2168",
  14492. "\u0049\u0058",
  14493. "\u2169",
  14494. "\u0058",
  14495. "\u216A",
  14496. "\u0058\u0049",
  14497. "\u216B",
  14498. "\u0058\u0049\u0049",
  14499. "\u216C",
  14500. "\u004C",
  14501. "\u216D",
  14502. "\u0043",
  14503. "\u216E",
  14504. "\u0044",
  14505. "\u216F",
  14506. "\u004D",
  14507. "\u2170",
  14508. "\u0069",
  14509. "\u2171",
  14510. "\u0069\u0069",
  14511. "\u2172",
  14512. "\u0069\u0069\u0069",
  14513. "\u2173",
  14514. "\u0069\u0076",
  14515. "\u2174",
  14516. "\u0076",
  14517. "\u2175",
  14518. "\u0076\u0069",
  14519. "\u2176",
  14520. "\u0076\u0069\u0069",
  14521. "\u2177",
  14522. "\u0076\u0069\u0069\u0069",
  14523. "\u2178",
  14524. "\u0069\u0078",
  14525. "\u2179",
  14526. "\u0078",
  14527. "\u217A",
  14528. "\u0078\u0069",
  14529. "\u217B",
  14530. "\u0078\u0069\u0069",
  14531. "\u217C",
  14532. "\u006C",
  14533. "\u217D",
  14534. "\u0063",
  14535. "\u217E",
  14536. "\u0064",
  14537. "\u217F",
  14538. "\u006D",
  14539. "\u222C",
  14540. "\u222B\u222B",
  14541. "\u222D",
  14542. "\u222B\u222B\u222B",
  14543. "\u222F",
  14544. "\u222E\u222E",
  14545. "\u2230",
  14546. "\u222E\u222E\u222E",
  14547. "\u2474",
  14548. "\u0028\u0031\u0029",
  14549. "\u2475",
  14550. "\u0028\u0032\u0029",
  14551. "\u2476",
  14552. "\u0028\u0033\u0029",
  14553. "\u2477",
  14554. "\u0028\u0034\u0029",
  14555. "\u2478",
  14556. "\u0028\u0035\u0029",
  14557. "\u2479",
  14558. "\u0028\u0036\u0029",
  14559. "\u247A",
  14560. "\u0028\u0037\u0029",
  14561. "\u247B",
  14562. "\u0028\u0038\u0029",
  14563. "\u247C",
  14564. "\u0028\u0039\u0029",
  14565. "\u247D",
  14566. "\u0028\u0031\u0030\u0029",
  14567. "\u247E",
  14568. "\u0028\u0031\u0031\u0029",
  14569. "\u247F",
  14570. "\u0028\u0031\u0032\u0029",
  14571. "\u2480",
  14572. "\u0028\u0031\u0033\u0029",
  14573. "\u2481",
  14574. "\u0028\u0031\u0034\u0029",
  14575. "\u2482",
  14576. "\u0028\u0031\u0035\u0029",
  14577. "\u2483",
  14578. "\u0028\u0031\u0036\u0029",
  14579. "\u2484",
  14580. "\u0028\u0031\u0037\u0029",
  14581. "\u2485",
  14582. "\u0028\u0031\u0038\u0029",
  14583. "\u2486",
  14584. "\u0028\u0031\u0039\u0029",
  14585. "\u2487",
  14586. "\u0028\u0032\u0030\u0029",
  14587. "\u2488",
  14588. "\u0031\u002E",
  14589. "\u2489",
  14590. "\u0032\u002E",
  14591. "\u248A",
  14592. "\u0033\u002E",
  14593. "\u248B",
  14594. "\u0034\u002E",
  14595. "\u248C",
  14596. "\u0035\u002E",
  14597. "\u248D",
  14598. "\u0036\u002E",
  14599. "\u248E",
  14600. "\u0037\u002E",
  14601. "\u248F",
  14602. "\u0038\u002E",
  14603. "\u2490",
  14604. "\u0039\u002E",
  14605. "\u2491",
  14606. "\u0031\u0030\u002E",
  14607. "\u2492",
  14608. "\u0031\u0031\u002E",
  14609. "\u2493",
  14610. "\u0031\u0032\u002E",
  14611. "\u2494",
  14612. "\u0031\u0033\u002E",
  14613. "\u2495",
  14614. "\u0031\u0034\u002E",
  14615. "\u2496",
  14616. "\u0031\u0035\u002E",
  14617. "\u2497",
  14618. "\u0031\u0036\u002E",
  14619. "\u2498",
  14620. "\u0031\u0037\u002E",
  14621. "\u2499",
  14622. "\u0031\u0038\u002E",
  14623. "\u249A",
  14624. "\u0031\u0039\u002E",
  14625. "\u249B",
  14626. "\u0032\u0030\u002E",
  14627. "\u249C",
  14628. "\u0028\u0061\u0029",
  14629. "\u249D",
  14630. "\u0028\u0062\u0029",
  14631. "\u249E",
  14632. "\u0028\u0063\u0029",
  14633. "\u249F",
  14634. "\u0028\u0064\u0029",
  14635. "\u24A0",
  14636. "\u0028\u0065\u0029",
  14637. "\u24A1",
  14638. "\u0028\u0066\u0029",
  14639. "\u24A2",
  14640. "\u0028\u0067\u0029",
  14641. "\u24A3",
  14642. "\u0028\u0068\u0029",
  14643. "\u24A4",
  14644. "\u0028\u0069\u0029",
  14645. "\u24A5",
  14646. "\u0028\u006A\u0029",
  14647. "\u24A6",
  14648. "\u0028\u006B\u0029",
  14649. "\u24A7",
  14650. "\u0028\u006C\u0029",
  14651. "\u24A8",
  14652. "\u0028\u006D\u0029",
  14653. "\u24A9",
  14654. "\u0028\u006E\u0029",
  14655. "\u24AA",
  14656. "\u0028\u006F\u0029",
  14657. "\u24AB",
  14658. "\u0028\u0070\u0029",
  14659. "\u24AC",
  14660. "\u0028\u0071\u0029",
  14661. "\u24AD",
  14662. "\u0028\u0072\u0029",
  14663. "\u24AE",
  14664. "\u0028\u0073\u0029",
  14665. "\u24AF",
  14666. "\u0028\u0074\u0029",
  14667. "\u24B0",
  14668. "\u0028\u0075\u0029",
  14669. "\u24B1",
  14670. "\u0028\u0076\u0029",
  14671. "\u24B2",
  14672. "\u0028\u0077\u0029",
  14673. "\u24B3",
  14674. "\u0028\u0078\u0029",
  14675. "\u24B4",
  14676. "\u0028\u0079\u0029",
  14677. "\u24B5",
  14678. "\u0028\u007A\u0029",
  14679. "\u2A0C",
  14680. "\u222B\u222B\u222B\u222B",
  14681. "\u2A74",
  14682. "\u003A\u003A\u003D",
  14683. "\u2A75",
  14684. "\u003D\u003D",
  14685. "\u2A76",
  14686. "\u003D\u003D\u003D",
  14687. "\u2E9F",
  14688. "\u6BCD",
  14689. "\u2EF3",
  14690. "\u9F9F",
  14691. "\u2F00",
  14692. "\u4E00",
  14693. "\u2F01",
  14694. "\u4E28",
  14695. "\u2F02",
  14696. "\u4E36",
  14697. "\u2F03",
  14698. "\u4E3F",
  14699. "\u2F04",
  14700. "\u4E59",
  14701. "\u2F05",
  14702. "\u4E85",
  14703. "\u2F06",
  14704. "\u4E8C",
  14705. "\u2F07",
  14706. "\u4EA0",
  14707. "\u2F08",
  14708. "\u4EBA",
  14709. "\u2F09",
  14710. "\u513F",
  14711. "\u2F0A",
  14712. "\u5165",
  14713. "\u2F0B",
  14714. "\u516B",
  14715. "\u2F0C",
  14716. "\u5182",
  14717. "\u2F0D",
  14718. "\u5196",
  14719. "\u2F0E",
  14720. "\u51AB",
  14721. "\u2F0F",
  14722. "\u51E0",
  14723. "\u2F10",
  14724. "\u51F5",
  14725. "\u2F11",
  14726. "\u5200",
  14727. "\u2F12",
  14728. "\u529B",
  14729. "\u2F13",
  14730. "\u52F9",
  14731. "\u2F14",
  14732. "\u5315",
  14733. "\u2F15",
  14734. "\u531A",
  14735. "\u2F16",
  14736. "\u5338",
  14737. "\u2F17",
  14738. "\u5341",
  14739. "\u2F18",
  14740. "\u535C",
  14741. "\u2F19",
  14742. "\u5369",
  14743. "\u2F1A",
  14744. "\u5382",
  14745. "\u2F1B",
  14746. "\u53B6",
  14747. "\u2F1C",
  14748. "\u53C8",
  14749. "\u2F1D",
  14750. "\u53E3",
  14751. "\u2F1E",
  14752. "\u56D7",
  14753. "\u2F1F",
  14754. "\u571F",
  14755. "\u2F20",
  14756. "\u58EB",
  14757. "\u2F21",
  14758. "\u5902",
  14759. "\u2F22",
  14760. "\u590A",
  14761. "\u2F23",
  14762. "\u5915",
  14763. "\u2F24",
  14764. "\u5927",
  14765. "\u2F25",
  14766. "\u5973",
  14767. "\u2F26",
  14768. "\u5B50",
  14769. "\u2F27",
  14770. "\u5B80",
  14771. "\u2F28",
  14772. "\u5BF8",
  14773. "\u2F29",
  14774. "\u5C0F",
  14775. "\u2F2A",
  14776. "\u5C22",
  14777. "\u2F2B",
  14778. "\u5C38",
  14779. "\u2F2C",
  14780. "\u5C6E",
  14781. "\u2F2D",
  14782. "\u5C71",
  14783. "\u2F2E",
  14784. "\u5DDB",
  14785. "\u2F2F",
  14786. "\u5DE5",
  14787. "\u2F30",
  14788. "\u5DF1",
  14789. "\u2F31",
  14790. "\u5DFE",
  14791. "\u2F32",
  14792. "\u5E72",
  14793. "\u2F33",
  14794. "\u5E7A",
  14795. "\u2F34",
  14796. "\u5E7F",
  14797. "\u2F35",
  14798. "\u5EF4",
  14799. "\u2F36",
  14800. "\u5EFE",
  14801. "\u2F37",
  14802. "\u5F0B",
  14803. "\u2F38",
  14804. "\u5F13",
  14805. "\u2F39",
  14806. "\u5F50",
  14807. "\u2F3A",
  14808. "\u5F61",
  14809. "\u2F3B",
  14810. "\u5F73",
  14811. "\u2F3C",
  14812. "\u5FC3",
  14813. "\u2F3D",
  14814. "\u6208",
  14815. "\u2F3E",
  14816. "\u6236",
  14817. "\u2F3F",
  14818. "\u624B",
  14819. "\u2F40",
  14820. "\u652F",
  14821. "\u2F41",
  14822. "\u6534",
  14823. "\u2F42",
  14824. "\u6587",
  14825. "\u2F43",
  14826. "\u6597",
  14827. "\u2F44",
  14828. "\u65A4",
  14829. "\u2F45",
  14830. "\u65B9",
  14831. "\u2F46",
  14832. "\u65E0",
  14833. "\u2F47",
  14834. "\u65E5",
  14835. "\u2F48",
  14836. "\u66F0",
  14837. "\u2F49",
  14838. "\u6708",
  14839. "\u2F4A",
  14840. "\u6728",
  14841. "\u2F4B",
  14842. "\u6B20",
  14843. "\u2F4C",
  14844. "\u6B62",
  14845. "\u2F4D",
  14846. "\u6B79",
  14847. "\u2F4E",
  14848. "\u6BB3",
  14849. "\u2F4F",
  14850. "\u6BCB",
  14851. "\u2F50",
  14852. "\u6BD4",
  14853. "\u2F51",
  14854. "\u6BDB",
  14855. "\u2F52",
  14856. "\u6C0F",
  14857. "\u2F53",
  14858. "\u6C14",
  14859. "\u2F54",
  14860. "\u6C34",
  14861. "\u2F55",
  14862. "\u706B",
  14863. "\u2F56",
  14864. "\u722A",
  14865. "\u2F57",
  14866. "\u7236",
  14867. "\u2F58",
  14868. "\u723B",
  14869. "\u2F59",
  14870. "\u723F",
  14871. "\u2F5A",
  14872. "\u7247",
  14873. "\u2F5B",
  14874. "\u7259",
  14875. "\u2F5C",
  14876. "\u725B",
  14877. "\u2F5D",
  14878. "\u72AC",
  14879. "\u2F5E",
  14880. "\u7384",
  14881. "\u2F5F",
  14882. "\u7389",
  14883. "\u2F60",
  14884. "\u74DC",
  14885. "\u2F61",
  14886. "\u74E6",
  14887. "\u2F62",
  14888. "\u7518",
  14889. "\u2F63",
  14890. "\u751F",
  14891. "\u2F64",
  14892. "\u7528",
  14893. "\u2F65",
  14894. "\u7530",
  14895. "\u2F66",
  14896. "\u758B",
  14897. "\u2F67",
  14898. "\u7592",
  14899. "\u2F68",
  14900. "\u7676",
  14901. "\u2F69",
  14902. "\u767D",
  14903. "\u2F6A",
  14904. "\u76AE",
  14905. "\u2F6B",
  14906. "\u76BF",
  14907. "\u2F6C",
  14908. "\u76EE",
  14909. "\u2F6D",
  14910. "\u77DB",
  14911. "\u2F6E",
  14912. "\u77E2",
  14913. "\u2F6F",
  14914. "\u77F3",
  14915. "\u2F70",
  14916. "\u793A",
  14917. "\u2F71",
  14918. "\u79B8",
  14919. "\u2F72",
  14920. "\u79BE",
  14921. "\u2F73",
  14922. "\u7A74",
  14923. "\u2F74",
  14924. "\u7ACB",
  14925. "\u2F75",
  14926. "\u7AF9",
  14927. "\u2F76",
  14928. "\u7C73",
  14929. "\u2F77",
  14930. "\u7CF8",
  14931. "\u2F78",
  14932. "\u7F36",
  14933. "\u2F79",
  14934. "\u7F51",
  14935. "\u2F7A",
  14936. "\u7F8A",
  14937. "\u2F7B",
  14938. "\u7FBD",
  14939. "\u2F7C",
  14940. "\u8001",
  14941. "\u2F7D",
  14942. "\u800C",
  14943. "\u2F7E",
  14944. "\u8012",
  14945. "\u2F7F",
  14946. "\u8033",
  14947. "\u2F80",
  14948. "\u807F",
  14949. "\u2F81",
  14950. "\u8089",
  14951. "\u2F82",
  14952. "\u81E3",
  14953. "\u2F83",
  14954. "\u81EA",
  14955. "\u2F84",
  14956. "\u81F3",
  14957. "\u2F85",
  14958. "\u81FC",
  14959. "\u2F86",
  14960. "\u820C",
  14961. "\u2F87",
  14962. "\u821B",
  14963. "\u2F88",
  14964. "\u821F",
  14965. "\u2F89",
  14966. "\u826E",
  14967. "\u2F8A",
  14968. "\u8272",
  14969. "\u2F8B",
  14970. "\u8278",
  14971. "\u2F8C",
  14972. "\u864D",
  14973. "\u2F8D",
  14974. "\u866B",
  14975. "\u2F8E",
  14976. "\u8840",
  14977. "\u2F8F",
  14978. "\u884C",
  14979. "\u2F90",
  14980. "\u8863",
  14981. "\u2F91",
  14982. "\u897E",
  14983. "\u2F92",
  14984. "\u898B",
  14985. "\u2F93",
  14986. "\u89D2",
  14987. "\u2F94",
  14988. "\u8A00",
  14989. "\u2F95",
  14990. "\u8C37",
  14991. "\u2F96",
  14992. "\u8C46",
  14993. "\u2F97",
  14994. "\u8C55",
  14995. "\u2F98",
  14996. "\u8C78",
  14997. "\u2F99",
  14998. "\u8C9D",
  14999. "\u2F9A",
  15000. "\u8D64",
  15001. "\u2F9B",
  15002. "\u8D70",
  15003. "\u2F9C",
  15004. "\u8DB3",
  15005. "\u2F9D",
  15006. "\u8EAB",
  15007. "\u2F9E",
  15008. "\u8ECA",
  15009. "\u2F9F",
  15010. "\u8F9B",
  15011. "\u2FA0",
  15012. "\u8FB0",
  15013. "\u2FA1",
  15014. "\u8FB5",
  15015. "\u2FA2",
  15016. "\u9091",
  15017. "\u2FA3",
  15018. "\u9149",
  15019. "\u2FA4",
  15020. "\u91C6",
  15021. "\u2FA5",
  15022. "\u91CC",
  15023. "\u2FA6",
  15024. "\u91D1",
  15025. "\u2FA7",
  15026. "\u9577",
  15027. "\u2FA8",
  15028. "\u9580",
  15029. "\u2FA9",
  15030. "\u961C",
  15031. "\u2FAA",
  15032. "\u96B6",
  15033. "\u2FAB",
  15034. "\u96B9",
  15035. "\u2FAC",
  15036. "\u96E8",
  15037. "\u2FAD",
  15038. "\u9751",
  15039. "\u2FAE",
  15040. "\u975E",
  15041. "\u2FAF",
  15042. "\u9762",
  15043. "\u2FB0",
  15044. "\u9769",
  15045. "\u2FB1",
  15046. "\u97CB",
  15047. "\u2FB2",
  15048. "\u97ED",
  15049. "\u2FB3",
  15050. "\u97F3",
  15051. "\u2FB4",
  15052. "\u9801",
  15053. "\u2FB5",
  15054. "\u98A8",
  15055. "\u2FB6",
  15056. "\u98DB",
  15057. "\u2FB7",
  15058. "\u98DF",
  15059. "\u2FB8",
  15060. "\u9996",
  15061. "\u2FB9",
  15062. "\u9999",
  15063. "\u2FBA",
  15064. "\u99AC",
  15065. "\u2FBB",
  15066. "\u9AA8",
  15067. "\u2FBC",
  15068. "\u9AD8",
  15069. "\u2FBD",
  15070. "\u9ADF",
  15071. "\u2FBE",
  15072. "\u9B25",
  15073. "\u2FBF",
  15074. "\u9B2F",
  15075. "\u2FC0",
  15076. "\u9B32",
  15077. "\u2FC1",
  15078. "\u9B3C",
  15079. "\u2FC2",
  15080. "\u9B5A",
  15081. "\u2FC3",
  15082. "\u9CE5",
  15083. "\u2FC4",
  15084. "\u9E75",
  15085. "\u2FC5",
  15086. "\u9E7F",
  15087. "\u2FC6",
  15088. "\u9EA5",
  15089. "\u2FC7",
  15090. "\u9EBB",
  15091. "\u2FC8",
  15092. "\u9EC3",
  15093. "\u2FC9",
  15094. "\u9ECD",
  15095. "\u2FCA",
  15096. "\u9ED1",
  15097. "\u2FCB",
  15098. "\u9EF9",
  15099. "\u2FCC",
  15100. "\u9EFD",
  15101. "\u2FCD",
  15102. "\u9F0E",
  15103. "\u2FCE",
  15104. "\u9F13",
  15105. "\u2FCF",
  15106. "\u9F20",
  15107. "\u2FD0",
  15108. "\u9F3B",
  15109. "\u2FD1",
  15110. "\u9F4A",
  15111. "\u2FD2",
  15112. "\u9F52",
  15113. "\u2FD3",
  15114. "\u9F8D",
  15115. "\u2FD4",
  15116. "\u9F9C",
  15117. "\u2FD5",
  15118. "\u9FA0",
  15119. "\u3036",
  15120. "\u3012",
  15121. "\u3038",
  15122. "\u5341",
  15123. "\u3039",
  15124. "\u5344",
  15125. "\u303A",
  15126. "\u5345",
  15127. "\u309B",
  15128. "\u0020\u3099",
  15129. "\u309C",
  15130. "\u0020\u309A",
  15131. "\u3131",
  15132. "\u1100",
  15133. "\u3132",
  15134. "\u1101",
  15135. "\u3133",
  15136. "\u11AA",
  15137. "\u3134",
  15138. "\u1102",
  15139. "\u3135",
  15140. "\u11AC",
  15141. "\u3136",
  15142. "\u11AD",
  15143. "\u3137",
  15144. "\u1103",
  15145. "\u3138",
  15146. "\u1104",
  15147. "\u3139",
  15148. "\u1105",
  15149. "\u313A",
  15150. "\u11B0",
  15151. "\u313B",
  15152. "\u11B1",
  15153. "\u313C",
  15154. "\u11B2",
  15155. "\u313D",
  15156. "\u11B3",
  15157. "\u313E",
  15158. "\u11B4",
  15159. "\u313F",
  15160. "\u11B5",
  15161. "\u3140",
  15162. "\u111A",
  15163. "\u3141",
  15164. "\u1106",
  15165. "\u3142",
  15166. "\u1107",
  15167. "\u3143",
  15168. "\u1108",
  15169. "\u3144",
  15170. "\u1121",
  15171. "\u3145",
  15172. "\u1109",
  15173. "\u3146",
  15174. "\u110A",
  15175. "\u3147",
  15176. "\u110B",
  15177. "\u3148",
  15178. "\u110C",
  15179. "\u3149",
  15180. "\u110D",
  15181. "\u314A",
  15182. "\u110E",
  15183. "\u314B",
  15184. "\u110F",
  15185. "\u314C",
  15186. "\u1110",
  15187. "\u314D",
  15188. "\u1111",
  15189. "\u314E",
  15190. "\u1112",
  15191. "\u314F",
  15192. "\u1161",
  15193. "\u3150",
  15194. "\u1162",
  15195. "\u3151",
  15196. "\u1163",
  15197. "\u3152",
  15198. "\u1164",
  15199. "\u3153",
  15200. "\u1165",
  15201. "\u3154",
  15202. "\u1166",
  15203. "\u3155",
  15204. "\u1167",
  15205. "\u3156",
  15206. "\u1168",
  15207. "\u3157",
  15208. "\u1169",
  15209. "\u3158",
  15210. "\u116A",
  15211. "\u3159",
  15212. "\u116B",
  15213. "\u315A",
  15214. "\u116C",
  15215. "\u315B",
  15216. "\u116D",
  15217. "\u315C",
  15218. "\u116E",
  15219. "\u315D",
  15220. "\u116F",
  15221. "\u315E",
  15222. "\u1170",
  15223. "\u315F",
  15224. "\u1171",
  15225. "\u3160",
  15226. "\u1172",
  15227. "\u3161",
  15228. "\u1173",
  15229. "\u3162",
  15230. "\u1174",
  15231. "\u3163",
  15232. "\u1175",
  15233. "\u3164",
  15234. "\u1160",
  15235. "\u3165",
  15236. "\u1114",
  15237. "\u3166",
  15238. "\u1115",
  15239. "\u3167",
  15240. "\u11C7",
  15241. "\u3168",
  15242. "\u11C8",
  15243. "\u3169",
  15244. "\u11CC",
  15245. "\u316A",
  15246. "\u11CE",
  15247. "\u316B",
  15248. "\u11D3",
  15249. "\u316C",
  15250. "\u11D7",
  15251. "\u316D",
  15252. "\u11D9",
  15253. "\u316E",
  15254. "\u111C",
  15255. "\u316F",
  15256. "\u11DD",
  15257. "\u3170",
  15258. "\u11DF",
  15259. "\u3171",
  15260. "\u111D",
  15261. "\u3172",
  15262. "\u111E",
  15263. "\u3173",
  15264. "\u1120",
  15265. "\u3174",
  15266. "\u1122",
  15267. "\u3175",
  15268. "\u1123",
  15269. "\u3176",
  15270. "\u1127",
  15271. "\u3177",
  15272. "\u1129",
  15273. "\u3178",
  15274. "\u112B",
  15275. "\u3179",
  15276. "\u112C",
  15277. "\u317A",
  15278. "\u112D",
  15279. "\u317B",
  15280. "\u112E",
  15281. "\u317C",
  15282. "\u112F",
  15283. "\u317D",
  15284. "\u1132",
  15285. "\u317E",
  15286. "\u1136",
  15287. "\u317F",
  15288. "\u1140",
  15289. "\u3180",
  15290. "\u1147",
  15291. "\u3181",
  15292. "\u114C",
  15293. "\u3182",
  15294. "\u11F1",
  15295. "\u3183",
  15296. "\u11F2",
  15297. "\u3184",
  15298. "\u1157",
  15299. "\u3185",
  15300. "\u1158",
  15301. "\u3186",
  15302. "\u1159",
  15303. "\u3187",
  15304. "\u1184",
  15305. "\u3188",
  15306. "\u1185",
  15307. "\u3189",
  15308. "\u1188",
  15309. "\u318A",
  15310. "\u1191",
  15311. "\u318B",
  15312. "\u1192",
  15313. "\u318C",
  15314. "\u1194",
  15315. "\u318D",
  15316. "\u119E",
  15317. "\u318E",
  15318. "\u11A1",
  15319. "\u3200",
  15320. "\u0028\u1100\u0029",
  15321. "\u3201",
  15322. "\u0028\u1102\u0029",
  15323. "\u3202",
  15324. "\u0028\u1103\u0029",
  15325. "\u3203",
  15326. "\u0028\u1105\u0029",
  15327. "\u3204",
  15328. "\u0028\u1106\u0029",
  15329. "\u3205",
  15330. "\u0028\u1107\u0029",
  15331. "\u3206",
  15332. "\u0028\u1109\u0029",
  15333. "\u3207",
  15334. "\u0028\u110B\u0029",
  15335. "\u3208",
  15336. "\u0028\u110C\u0029",
  15337. "\u3209",
  15338. "\u0028\u110E\u0029",
  15339. "\u320A",
  15340. "\u0028\u110F\u0029",
  15341. "\u320B",
  15342. "\u0028\u1110\u0029",
  15343. "\u320C",
  15344. "\u0028\u1111\u0029",
  15345. "\u320D",
  15346. "\u0028\u1112\u0029",
  15347. "\u320E",
  15348. "\u0028\u1100\u1161\u0029",
  15349. "\u320F",
  15350. "\u0028\u1102\u1161\u0029",
  15351. "\u3210",
  15352. "\u0028\u1103\u1161\u0029",
  15353. "\u3211",
  15354. "\u0028\u1105\u1161\u0029",
  15355. "\u3212",
  15356. "\u0028\u1106\u1161\u0029",
  15357. "\u3213",
  15358. "\u0028\u1107\u1161\u0029",
  15359. "\u3214",
  15360. "\u0028\u1109\u1161\u0029",
  15361. "\u3215",
  15362. "\u0028\u110B\u1161\u0029",
  15363. "\u3216",
  15364. "\u0028\u110C\u1161\u0029",
  15365. "\u3217",
  15366. "\u0028\u110E\u1161\u0029",
  15367. "\u3218",
  15368. "\u0028\u110F\u1161\u0029",
  15369. "\u3219",
  15370. "\u0028\u1110\u1161\u0029",
  15371. "\u321A",
  15372. "\u0028\u1111\u1161\u0029",
  15373. "\u321B",
  15374. "\u0028\u1112\u1161\u0029",
  15375. "\u321C",
  15376. "\u0028\u110C\u116E\u0029",
  15377. "\u321D",
  15378. "\u0028\u110B\u1169\u110C\u1165\u11AB\u0029",
  15379. "\u321E",
  15380. "\u0028\u110B\u1169\u1112\u116E\u0029",
  15381. "\u3220",
  15382. "\u0028\u4E00\u0029",
  15383. "\u3221",
  15384. "\u0028\u4E8C\u0029",
  15385. "\u3222",
  15386. "\u0028\u4E09\u0029",
  15387. "\u3223",
  15388. "\u0028\u56DB\u0029",
  15389. "\u3224",
  15390. "\u0028\u4E94\u0029",
  15391. "\u3225",
  15392. "\u0028\u516D\u0029",
  15393. "\u3226",
  15394. "\u0028\u4E03\u0029",
  15395. "\u3227",
  15396. "\u0028\u516B\u0029",
  15397. "\u3228",
  15398. "\u0028\u4E5D\u0029",
  15399. "\u3229",
  15400. "\u0028\u5341\u0029",
  15401. "\u322A",
  15402. "\u0028\u6708\u0029",
  15403. "\u322B",
  15404. "\u0028\u706B\u0029",
  15405. "\u322C",
  15406. "\u0028\u6C34\u0029",
  15407. "\u322D",
  15408. "\u0028\u6728\u0029",
  15409. "\u322E",
  15410. "\u0028\u91D1\u0029",
  15411. "\u322F",
  15412. "\u0028\u571F\u0029",
  15413. "\u3230",
  15414. "\u0028\u65E5\u0029",
  15415. "\u3231",
  15416. "\u0028\u682A\u0029",
  15417. "\u3232",
  15418. "\u0028\u6709\u0029",
  15419. "\u3233",
  15420. "\u0028\u793E\u0029",
  15421. "\u3234",
  15422. "\u0028\u540D\u0029",
  15423. "\u3235",
  15424. "\u0028\u7279\u0029",
  15425. "\u3236",
  15426. "\u0028\u8CA1\u0029",
  15427. "\u3237",
  15428. "\u0028\u795D\u0029",
  15429. "\u3238",
  15430. "\u0028\u52B4\u0029",
  15431. "\u3239",
  15432. "\u0028\u4EE3\u0029",
  15433. "\u323A",
  15434. "\u0028\u547C\u0029",
  15435. "\u323B",
  15436. "\u0028\u5B66\u0029",
  15437. "\u323C",
  15438. "\u0028\u76E3\u0029",
  15439. "\u323D",
  15440. "\u0028\u4F01\u0029",
  15441. "\u323E",
  15442. "\u0028\u8CC7\u0029",
  15443. "\u323F",
  15444. "\u0028\u5354\u0029",
  15445. "\u3240",
  15446. "\u0028\u796D\u0029",
  15447. "\u3241",
  15448. "\u0028\u4F11\u0029",
  15449. "\u3242",
  15450. "\u0028\u81EA\u0029",
  15451. "\u3243",
  15452. "\u0028\u81F3\u0029",
  15453. "\u32C0",
  15454. "\u0031\u6708",
  15455. "\u32C1",
  15456. "\u0032\u6708",
  15457. "\u32C2",
  15458. "\u0033\u6708",
  15459. "\u32C3",
  15460. "\u0034\u6708",
  15461. "\u32C4",
  15462. "\u0035\u6708",
  15463. "\u32C5",
  15464. "\u0036\u6708",
  15465. "\u32C6",
  15466. "\u0037\u6708",
  15467. "\u32C7",
  15468. "\u0038\u6708",
  15469. "\u32C8",
  15470. "\u0039\u6708",
  15471. "\u32C9",
  15472. "\u0031\u0030\u6708",
  15473. "\u32CA",
  15474. "\u0031\u0031\u6708",
  15475. "\u32CB",
  15476. "\u0031\u0032\u6708",
  15477. "\u3358",
  15478. "\u0030\u70B9",
  15479. "\u3359",
  15480. "\u0031\u70B9",
  15481. "\u335A",
  15482. "\u0032\u70B9",
  15483. "\u335B",
  15484. "\u0033\u70B9",
  15485. "\u335C",
  15486. "\u0034\u70B9",
  15487. "\u335D",
  15488. "\u0035\u70B9",
  15489. "\u335E",
  15490. "\u0036\u70B9",
  15491. "\u335F",
  15492. "\u0037\u70B9",
  15493. "\u3360",
  15494. "\u0038\u70B9",
  15495. "\u3361",
  15496. "\u0039\u70B9",
  15497. "\u3362",
  15498. "\u0031\u0030\u70B9",
  15499. "\u3363",
  15500. "\u0031\u0031\u70B9",
  15501. "\u3364",
  15502. "\u0031\u0032\u70B9",
  15503. "\u3365",
  15504. "\u0031\u0033\u70B9",
  15505. "\u3366",
  15506. "\u0031\u0034\u70B9",
  15507. "\u3367",
  15508. "\u0031\u0035\u70B9",
  15509. "\u3368",
  15510. "\u0031\u0036\u70B9",
  15511. "\u3369",
  15512. "\u0031\u0037\u70B9",
  15513. "\u336A",
  15514. "\u0031\u0038\u70B9",
  15515. "\u336B",
  15516. "\u0031\u0039\u70B9",
  15517. "\u336C",
  15518. "\u0032\u0030\u70B9",
  15519. "\u336D",
  15520. "\u0032\u0031\u70B9",
  15521. "\u336E",
  15522. "\u0032\u0032\u70B9",
  15523. "\u336F",
  15524. "\u0032\u0033\u70B9",
  15525. "\u3370",
  15526. "\u0032\u0034\u70B9",
  15527. "\u33E0",
  15528. "\u0031\u65E5",
  15529. "\u33E1",
  15530. "\u0032\u65E5",
  15531. "\u33E2",
  15532. "\u0033\u65E5",
  15533. "\u33E3",
  15534. "\u0034\u65E5",
  15535. "\u33E4",
  15536. "\u0035\u65E5",
  15537. "\u33E5",
  15538. "\u0036\u65E5",
  15539. "\u33E6",
  15540. "\u0037\u65E5",
  15541. "\u33E7",
  15542. "\u0038\u65E5",
  15543. "\u33E8",
  15544. "\u0039\u65E5",
  15545. "\u33E9",
  15546. "\u0031\u0030\u65E5",
  15547. "\u33EA",
  15548. "\u0031\u0031\u65E5",
  15549. "\u33EB",
  15550. "\u0031\u0032\u65E5",
  15551. "\u33EC",
  15552. "\u0031\u0033\u65E5",
  15553. "\u33ED",
  15554. "\u0031\u0034\u65E5",
  15555. "\u33EE",
  15556. "\u0031\u0035\u65E5",
  15557. "\u33EF",
  15558. "\u0031\u0036\u65E5",
  15559. "\u33F0",
  15560. "\u0031\u0037\u65E5",
  15561. "\u33F1",
  15562. "\u0031\u0038\u65E5",
  15563. "\u33F2",
  15564. "\u0031\u0039\u65E5",
  15565. "\u33F3",
  15566. "\u0032\u0030\u65E5",
  15567. "\u33F4",
  15568. "\u0032\u0031\u65E5",
  15569. "\u33F5",
  15570. "\u0032\u0032\u65E5",
  15571. "\u33F6",
  15572. "\u0032\u0033\u65E5",
  15573. "\u33F7",
  15574. "\u0032\u0034\u65E5",
  15575. "\u33F8",
  15576. "\u0032\u0035\u65E5",
  15577. "\u33F9",
  15578. "\u0032\u0036\u65E5",
  15579. "\u33FA",
  15580. "\u0032\u0037\u65E5",
  15581. "\u33FB",
  15582. "\u0032\u0038\u65E5",
  15583. "\u33FC",
  15584. "\u0032\u0039\u65E5",
  15585. "\u33FD",
  15586. "\u0033\u0030\u65E5",
  15587. "\u33FE",
  15588. "\u0033\u0031\u65E5",
  15589. "\uFB00",
  15590. "\u0066\u0066",
  15591. "\uFB01",
  15592. "\u0066\u0069",
  15593. "\uFB02",
  15594. "\u0066\u006C",
  15595. "\uFB03",
  15596. "\u0066\u0066\u0069",
  15597. "\uFB04",
  15598. "\u0066\u0066\u006C",
  15599. "\uFB05",
  15600. "\u017F\u0074",
  15601. "\uFB06",
  15602. "\u0073\u0074",
  15603. "\uFB13",
  15604. "\u0574\u0576",
  15605. "\uFB14",
  15606. "\u0574\u0565",
  15607. "\uFB15",
  15608. "\u0574\u056B",
  15609. "\uFB16",
  15610. "\u057E\u0576",
  15611. "\uFB17",
  15612. "\u0574\u056D",
  15613. "\uFB4F",
  15614. "\u05D0\u05DC",
  15615. "\uFB50",
  15616. "\u0671",
  15617. "\uFB51",
  15618. "\u0671",
  15619. "\uFB52",
  15620. "\u067B",
  15621. "\uFB53",
  15622. "\u067B",
  15623. "\uFB54",
  15624. "\u067B",
  15625. "\uFB55",
  15626. "\u067B",
  15627. "\uFB56",
  15628. "\u067E",
  15629. "\uFB57",
  15630. "\u067E",
  15631. "\uFB58",
  15632. "\u067E",
  15633. "\uFB59",
  15634. "\u067E",
  15635. "\uFB5A",
  15636. "\u0680",
  15637. "\uFB5B",
  15638. "\u0680",
  15639. "\uFB5C",
  15640. "\u0680",
  15641. "\uFB5D",
  15642. "\u0680",
  15643. "\uFB5E",
  15644. "\u067A",
  15645. "\uFB5F",
  15646. "\u067A",
  15647. "\uFB60",
  15648. "\u067A",
  15649. "\uFB61",
  15650. "\u067A",
  15651. "\uFB62",
  15652. "\u067F",
  15653. "\uFB63",
  15654. "\u067F",
  15655. "\uFB64",
  15656. "\u067F",
  15657. "\uFB65",
  15658. "\u067F",
  15659. "\uFB66",
  15660. "\u0679",
  15661. "\uFB67",
  15662. "\u0679",
  15663. "\uFB68",
  15664. "\u0679",
  15665. "\uFB69",
  15666. "\u0679",
  15667. "\uFB6A",
  15668. "\u06A4",
  15669. "\uFB6B",
  15670. "\u06A4",
  15671. "\uFB6C",
  15672. "\u06A4",
  15673. "\uFB6D",
  15674. "\u06A4",
  15675. "\uFB6E",
  15676. "\u06A6",
  15677. "\uFB6F",
  15678. "\u06A6",
  15679. "\uFB70",
  15680. "\u06A6",
  15681. "\uFB71",
  15682. "\u06A6",
  15683. "\uFB72",
  15684. "\u0684",
  15685. "\uFB73",
  15686. "\u0684",
  15687. "\uFB74",
  15688. "\u0684",
  15689. "\uFB75",
  15690. "\u0684",
  15691. "\uFB76",
  15692. "\u0683",
  15693. "\uFB77",
  15694. "\u0683",
  15695. "\uFB78",
  15696. "\u0683",
  15697. "\uFB79",
  15698. "\u0683",
  15699. "\uFB7A",
  15700. "\u0686",
  15701. "\uFB7B",
  15702. "\u0686",
  15703. "\uFB7C",
  15704. "\u0686",
  15705. "\uFB7D",
  15706. "\u0686",
  15707. "\uFB7E",
  15708. "\u0687",
  15709. "\uFB7F",
  15710. "\u0687",
  15711. "\uFB80",
  15712. "\u0687",
  15713. "\uFB81",
  15714. "\u0687",
  15715. "\uFB82",
  15716. "\u068D",
  15717. "\uFB83",
  15718. "\u068D",
  15719. "\uFB84",
  15720. "\u068C",
  15721. "\uFB85",
  15722. "\u068C",
  15723. "\uFB86",
  15724. "\u068E",
  15725. "\uFB87",
  15726. "\u068E",
  15727. "\uFB88",
  15728. "\u0688",
  15729. "\uFB89",
  15730. "\u0688",
  15731. "\uFB8A",
  15732. "\u0698",
  15733. "\uFB8B",
  15734. "\u0698",
  15735. "\uFB8C",
  15736. "\u0691",
  15737. "\uFB8D",
  15738. "\u0691",
  15739. "\uFB8E",
  15740. "\u06A9",
  15741. "\uFB8F",
  15742. "\u06A9",
  15743. "\uFB90",
  15744. "\u06A9",
  15745. "\uFB91",
  15746. "\u06A9",
  15747. "\uFB92",
  15748. "\u06AF",
  15749. "\uFB93",
  15750. "\u06AF",
  15751. "\uFB94",
  15752. "\u06AF",
  15753. "\uFB95",
  15754. "\u06AF",
  15755. "\uFB96",
  15756. "\u06B3",
  15757. "\uFB97",
  15758. "\u06B3",
  15759. "\uFB98",
  15760. "\u06B3",
  15761. "\uFB99",
  15762. "\u06B3",
  15763. "\uFB9A",
  15764. "\u06B1",
  15765. "\uFB9B",
  15766. "\u06B1",
  15767. "\uFB9C",
  15768. "\u06B1",
  15769. "\uFB9D",
  15770. "\u06B1",
  15771. "\uFB9E",
  15772. "\u06BA",
  15773. "\uFB9F",
  15774. "\u06BA",
  15775. "\uFBA0",
  15776. "\u06BB",
  15777. "\uFBA1",
  15778. "\u06BB",
  15779. "\uFBA2",
  15780. "\u06BB",
  15781. "\uFBA3",
  15782. "\u06BB",
  15783. "\uFBA4",
  15784. "\u06C0",
  15785. "\uFBA5",
  15786. "\u06C0",
  15787. "\uFBA6",
  15788. "\u06C1",
  15789. "\uFBA7",
  15790. "\u06C1",
  15791. "\uFBA8",
  15792. "\u06C1",
  15793. "\uFBA9",
  15794. "\u06C1",
  15795. "\uFBAA",
  15796. "\u06BE",
  15797. "\uFBAB",
  15798. "\u06BE",
  15799. "\uFBAC",
  15800. "\u06BE",
  15801. "\uFBAD",
  15802. "\u06BE",
  15803. "\uFBAE",
  15804. "\u06D2",
  15805. "\uFBAF",
  15806. "\u06D2",
  15807. "\uFBB0",
  15808. "\u06D3",
  15809. "\uFBB1",
  15810. "\u06D3",
  15811. "\uFBD3",
  15812. "\u06AD",
  15813. "\uFBD4",
  15814. "\u06AD",
  15815. "\uFBD5",
  15816. "\u06AD",
  15817. "\uFBD6",
  15818. "\u06AD",
  15819. "\uFBD7",
  15820. "\u06C7",
  15821. "\uFBD8",
  15822. "\u06C7",
  15823. "\uFBD9",
  15824. "\u06C6",
  15825. "\uFBDA",
  15826. "\u06C6",
  15827. "\uFBDB",
  15828. "\u06C8",
  15829. "\uFBDC",
  15830. "\u06C8",
  15831. "\uFBDD",
  15832. "\u0677",
  15833. "\uFBDE",
  15834. "\u06CB",
  15835. "\uFBDF",
  15836. "\u06CB",
  15837. "\uFBE0",
  15838. "\u06C5",
  15839. "\uFBE1",
  15840. "\u06C5",
  15841. "\uFBE2",
  15842. "\u06C9",
  15843. "\uFBE3",
  15844. "\u06C9",
  15845. "\uFBE4",
  15846. "\u06D0",
  15847. "\uFBE5",
  15848. "\u06D0",
  15849. "\uFBE6",
  15850. "\u06D0",
  15851. "\uFBE7",
  15852. "\u06D0",
  15853. "\uFBE8",
  15854. "\u0649",
  15855. "\uFBE9",
  15856. "\u0649",
  15857. "\uFBEA",
  15858. "\u0626\u0627",
  15859. "\uFBEB",
  15860. "\u0626\u0627",
  15861. "\uFBEC",
  15862. "\u0626\u06D5",
  15863. "\uFBED",
  15864. "\u0626\u06D5",
  15865. "\uFBEE",
  15866. "\u0626\u0648",
  15867. "\uFBEF",
  15868. "\u0626\u0648",
  15869. "\uFBF0",
  15870. "\u0626\u06C7",
  15871. "\uFBF1",
  15872. "\u0626\u06C7",
  15873. "\uFBF2",
  15874. "\u0626\u06C6",
  15875. "\uFBF3",
  15876. "\u0626\u06C6",
  15877. "\uFBF4",
  15878. "\u0626\u06C8",
  15879. "\uFBF5",
  15880. "\u0626\u06C8",
  15881. "\uFBF6",
  15882. "\u0626\u06D0",
  15883. "\uFBF7",
  15884. "\u0626\u06D0",
  15885. "\uFBF8",
  15886. "\u0626\u06D0",
  15887. "\uFBF9",
  15888. "\u0626\u0649",
  15889. "\uFBFA",
  15890. "\u0626\u0649",
  15891. "\uFBFB",
  15892. "\u0626\u0649",
  15893. "\uFBFC",
  15894. "\u06CC",
  15895. "\uFBFD",
  15896. "\u06CC",
  15897. "\uFBFE",
  15898. "\u06CC",
  15899. "\uFBFF",
  15900. "\u06CC",
  15901. "\uFC00",
  15902. "\u0626\u062C",
  15903. "\uFC01",
  15904. "\u0626\u062D",
  15905. "\uFC02",
  15906. "\u0626\u0645",
  15907. "\uFC03",
  15908. "\u0626\u0649",
  15909. "\uFC04",
  15910. "\u0626\u064A",
  15911. "\uFC05",
  15912. "\u0628\u062C",
  15913. "\uFC06",
  15914. "\u0628\u062D",
  15915. "\uFC07",
  15916. "\u0628\u062E",
  15917. "\uFC08",
  15918. "\u0628\u0645",
  15919. "\uFC09",
  15920. "\u0628\u0649",
  15921. "\uFC0A",
  15922. "\u0628\u064A",
  15923. "\uFC0B",
  15924. "\u062A\u062C",
  15925. "\uFC0C",
  15926. "\u062A\u062D",
  15927. "\uFC0D",
  15928. "\u062A\u062E",
  15929. "\uFC0E",
  15930. "\u062A\u0645",
  15931. "\uFC0F",
  15932. "\u062A\u0649",
  15933. "\uFC10",
  15934. "\u062A\u064A",
  15935. "\uFC11",
  15936. "\u062B\u062C",
  15937. "\uFC12",
  15938. "\u062B\u0645",
  15939. "\uFC13",
  15940. "\u062B\u0649",
  15941. "\uFC14",
  15942. "\u062B\u064A",
  15943. "\uFC15",
  15944. "\u062C\u062D",
  15945. "\uFC16",
  15946. "\u062C\u0645",
  15947. "\uFC17",
  15948. "\u062D\u062C",
  15949. "\uFC18",
  15950. "\u062D\u0645",
  15951. "\uFC19",
  15952. "\u062E\u062C",
  15953. "\uFC1A",
  15954. "\u062E\u062D",
  15955. "\uFC1B",
  15956. "\u062E\u0645",
  15957. "\uFC1C",
  15958. "\u0633\u062C",
  15959. "\uFC1D",
  15960. "\u0633\u062D",
  15961. "\uFC1E",
  15962. "\u0633\u062E",
  15963. "\uFC1F",
  15964. "\u0633\u0645",
  15965. "\uFC20",
  15966. "\u0635\u062D",
  15967. "\uFC21",
  15968. "\u0635\u0645",
  15969. "\uFC22",
  15970. "\u0636\u062C",
  15971. "\uFC23",
  15972. "\u0636\u062D",
  15973. "\uFC24",
  15974. "\u0636\u062E",
  15975. "\uFC25",
  15976. "\u0636\u0645",
  15977. "\uFC26",
  15978. "\u0637\u062D",
  15979. "\uFC27",
  15980. "\u0637\u0645",
  15981. "\uFC28",
  15982. "\u0638\u0645",
  15983. "\uFC29",
  15984. "\u0639\u062C",
  15985. "\uFC2A",
  15986. "\u0639\u0645",
  15987. "\uFC2B",
  15988. "\u063A\u062C",
  15989. "\uFC2C",
  15990. "\u063A\u0645",
  15991. "\uFC2D",
  15992. "\u0641\u062C",
  15993. "\uFC2E",
  15994. "\u0641\u062D",
  15995. "\uFC2F",
  15996. "\u0641\u062E",
  15997. "\uFC30",
  15998. "\u0641\u0645",
  15999. "\uFC31",
  16000. "\u0641\u0649",
  16001. "\uFC32",
  16002. "\u0641\u064A",
  16003. "\uFC33",
  16004. "\u0642\u062D",
  16005. "\uFC34",
  16006. "\u0642\u0645",
  16007. "\uFC35",
  16008. "\u0642\u0649",
  16009. "\uFC36",
  16010. "\u0642\u064A",
  16011. "\uFC37",
  16012. "\u0643\u0627",
  16013. "\uFC38",
  16014. "\u0643\u062C",
  16015. "\uFC39",
  16016. "\u0643\u062D",
  16017. "\uFC3A",
  16018. "\u0643\u062E",
  16019. "\uFC3B",
  16020. "\u0643\u0644",
  16021. "\uFC3C",
  16022. "\u0643\u0645",
  16023. "\uFC3D",
  16024. "\u0643\u0649",
  16025. "\uFC3E",
  16026. "\u0643\u064A",
  16027. "\uFC3F",
  16028. "\u0644\u062C",
  16029. "\uFC40",
  16030. "\u0644\u062D",
  16031. "\uFC41",
  16032. "\u0644\u062E",
  16033. "\uFC42",
  16034. "\u0644\u0645",
  16035. "\uFC43",
  16036. "\u0644\u0649",
  16037. "\uFC44",
  16038. "\u0644\u064A",
  16039. "\uFC45",
  16040. "\u0645\u062C",
  16041. "\uFC46",
  16042. "\u0645\u062D",
  16043. "\uFC47",
  16044. "\u0645\u062E",
  16045. "\uFC48",
  16046. "\u0645\u0645",
  16047. "\uFC49",
  16048. "\u0645\u0649",
  16049. "\uFC4A",
  16050. "\u0645\u064A",
  16051. "\uFC4B",
  16052. "\u0646\u062C",
  16053. "\uFC4C",
  16054. "\u0646\u062D",
  16055. "\uFC4D",
  16056. "\u0646\u062E",
  16057. "\uFC4E",
  16058. "\u0646\u0645",
  16059. "\uFC4F",
  16060. "\u0646\u0649",
  16061. "\uFC50",
  16062. "\u0646\u064A",
  16063. "\uFC51",
  16064. "\u0647\u062C",
  16065. "\uFC52",
  16066. "\u0647\u0645",
  16067. "\uFC53",
  16068. "\u0647\u0649",
  16069. "\uFC54",
  16070. "\u0647\u064A",
  16071. "\uFC55",
  16072. "\u064A\u062C",
  16073. "\uFC56",
  16074. "\u064A\u062D",
  16075. "\uFC57",
  16076. "\u064A\u062E",
  16077. "\uFC58",
  16078. "\u064A\u0645",
  16079. "\uFC59",
  16080. "\u064A\u0649",
  16081. "\uFC5A",
  16082. "\u064A\u064A",
  16083. "\uFC5B",
  16084. "\u0630\u0670",
  16085. "\uFC5C",
  16086. "\u0631\u0670",
  16087. "\uFC5D",
  16088. "\u0649\u0670",
  16089. "\uFC5E",
  16090. "\u0020\u064C\u0651",
  16091. "\uFC5F",
  16092. "\u0020\u064D\u0651",
  16093. "\uFC60",
  16094. "\u0020\u064E\u0651",
  16095. "\uFC61",
  16096. "\u0020\u064F\u0651",
  16097. "\uFC62",
  16098. "\u0020\u0650\u0651",
  16099. "\uFC63",
  16100. "\u0020\u0651\u0670",
  16101. "\uFC64",
  16102. "\u0626\u0631",
  16103. "\uFC65",
  16104. "\u0626\u0632",
  16105. "\uFC66",
  16106. "\u0626\u0645",
  16107. "\uFC67",
  16108. "\u0626\u0646",
  16109. "\uFC68",
  16110. "\u0626\u0649",
  16111. "\uFC69",
  16112. "\u0626\u064A",
  16113. "\uFC6A",
  16114. "\u0628\u0631",
  16115. "\uFC6B",
  16116. "\u0628\u0632",
  16117. "\uFC6C",
  16118. "\u0628\u0645",
  16119. "\uFC6D",
  16120. "\u0628\u0646",
  16121. "\uFC6E",
  16122. "\u0628\u0649",
  16123. "\uFC6F",
  16124. "\u0628\u064A",
  16125. "\uFC70",
  16126. "\u062A\u0631",
  16127. "\uFC71",
  16128. "\u062A\u0632",
  16129. "\uFC72",
  16130. "\u062A\u0645",
  16131. "\uFC73",
  16132. "\u062A\u0646",
  16133. "\uFC74",
  16134. "\u062A\u0649",
  16135. "\uFC75",
  16136. "\u062A\u064A",
  16137. "\uFC76",
  16138. "\u062B\u0631",
  16139. "\uFC77",
  16140. "\u062B\u0632",
  16141. "\uFC78",
  16142. "\u062B\u0645",
  16143. "\uFC79",
  16144. "\u062B\u0646",
  16145. "\uFC7A",
  16146. "\u062B\u0649",
  16147. "\uFC7B",
  16148. "\u062B\u064A",
  16149. "\uFC7C",
  16150. "\u0641\u0649",
  16151. "\uFC7D",
  16152. "\u0641\u064A",
  16153. "\uFC7E",
  16154. "\u0642\u0649",
  16155. "\uFC7F",
  16156. "\u0642\u064A",
  16157. "\uFC80",
  16158. "\u0643\u0627",
  16159. "\uFC81",
  16160. "\u0643\u0644",
  16161. "\uFC82",
  16162. "\u0643\u0645",
  16163. "\uFC83",
  16164. "\u0643\u0649",
  16165. "\uFC84",
  16166. "\u0643\u064A",
  16167. "\uFC85",
  16168. "\u0644\u0645",
  16169. "\uFC86",
  16170. "\u0644\u0649",
  16171. "\uFC87",
  16172. "\u0644\u064A",
  16173. "\uFC88",
  16174. "\u0645\u0627",
  16175. "\uFC89",
  16176. "\u0645\u0645",
  16177. "\uFC8A",
  16178. "\u0646\u0631",
  16179. "\uFC8B",
  16180. "\u0646\u0632",
  16181. "\uFC8C",
  16182. "\u0646\u0645",
  16183. "\uFC8D",
  16184. "\u0646\u0646",
  16185. "\uFC8E",
  16186. "\u0646\u0649",
  16187. "\uFC8F",
  16188. "\u0646\u064A",
  16189. "\uFC90",
  16190. "\u0649\u0670",
  16191. "\uFC91",
  16192. "\u064A\u0631",
  16193. "\uFC92",
  16194. "\u064A\u0632",
  16195. "\uFC93",
  16196. "\u064A\u0645",
  16197. "\uFC94",
  16198. "\u064A\u0646",
  16199. "\uFC95",
  16200. "\u064A\u0649",
  16201. "\uFC96",
  16202. "\u064A\u064A",
  16203. "\uFC97",
  16204. "\u0626\u062C",
  16205. "\uFC98",
  16206. "\u0626\u062D",
  16207. "\uFC99",
  16208. "\u0626\u062E",
  16209. "\uFC9A",
  16210. "\u0626\u0645",
  16211. "\uFC9B",
  16212. "\u0626\u0647",
  16213. "\uFC9C",
  16214. "\u0628\u062C",
  16215. "\uFC9D",
  16216. "\u0628\u062D",
  16217. "\uFC9E",
  16218. "\u0628\u062E",
  16219. "\uFC9F",
  16220. "\u0628\u0645",
  16221. "\uFCA0",
  16222. "\u0628\u0647",
  16223. "\uFCA1",
  16224. "\u062A\u062C",
  16225. "\uFCA2",
  16226. "\u062A\u062D",
  16227. "\uFCA3",
  16228. "\u062A\u062E",
  16229. "\uFCA4",
  16230. "\u062A\u0645",
  16231. "\uFCA5",
  16232. "\u062A\u0647",
  16233. "\uFCA6",
  16234. "\u062B\u0645",
  16235. "\uFCA7",
  16236. "\u062C\u062D",
  16237. "\uFCA8",
  16238. "\u062C\u0645",
  16239. "\uFCA9",
  16240. "\u062D\u062C",
  16241. "\uFCAA",
  16242. "\u062D\u0645",
  16243. "\uFCAB",
  16244. "\u062E\u062C",
  16245. "\uFCAC",
  16246. "\u062E\u0645",
  16247. "\uFCAD",
  16248. "\u0633\u062C",
  16249. "\uFCAE",
  16250. "\u0633\u062D",
  16251. "\uFCAF",
  16252. "\u0633\u062E",
  16253. "\uFCB0",
  16254. "\u0633\u0645",
  16255. "\uFCB1",
  16256. "\u0635\u062D",
  16257. "\uFCB2",
  16258. "\u0635\u062E",
  16259. "\uFCB3",
  16260. "\u0635\u0645",
  16261. "\uFCB4",
  16262. "\u0636\u062C",
  16263. "\uFCB5",
  16264. "\u0636\u062D",
  16265. "\uFCB6",
  16266. "\u0636\u062E",
  16267. "\uFCB7",
  16268. "\u0636\u0645",
  16269. "\uFCB8",
  16270. "\u0637\u062D",
  16271. "\uFCB9",
  16272. "\u0638\u0645",
  16273. "\uFCBA",
  16274. "\u0639\u062C",
  16275. "\uFCBB",
  16276. "\u0639\u0645",
  16277. "\uFCBC",
  16278. "\u063A\u062C",
  16279. "\uFCBD",
  16280. "\u063A\u0645",
  16281. "\uFCBE",
  16282. "\u0641\u062C",
  16283. "\uFCBF",
  16284. "\u0641\u062D",
  16285. "\uFCC0",
  16286. "\u0641\u062E",
  16287. "\uFCC1",
  16288. "\u0641\u0645",
  16289. "\uFCC2",
  16290. "\u0642\u062D",
  16291. "\uFCC3",
  16292. "\u0642\u0645",
  16293. "\uFCC4",
  16294. "\u0643\u062C",
  16295. "\uFCC5",
  16296. "\u0643\u062D",
  16297. "\uFCC6",
  16298. "\u0643\u062E",
  16299. "\uFCC7",
  16300. "\u0643\u0644",
  16301. "\uFCC8",
  16302. "\u0643\u0645",
  16303. "\uFCC9",
  16304. "\u0644\u062C",
  16305. "\uFCCA",
  16306. "\u0644\u062D",
  16307. "\uFCCB",
  16308. "\u0644\u062E",
  16309. "\uFCCC",
  16310. "\u0644\u0645",
  16311. "\uFCCD",
  16312. "\u0644\u0647",
  16313. "\uFCCE",
  16314. "\u0645\u062C",
  16315. "\uFCCF",
  16316. "\u0645\u062D",
  16317. "\uFCD0",
  16318. "\u0645\u062E",
  16319. "\uFCD1",
  16320. "\u0645\u0645",
  16321. "\uFCD2",
  16322. "\u0646\u062C",
  16323. "\uFCD3",
  16324. "\u0646\u062D",
  16325. "\uFCD4",
  16326. "\u0646\u062E",
  16327. "\uFCD5",
  16328. "\u0646\u0645",
  16329. "\uFCD6",
  16330. "\u0646\u0647",
  16331. "\uFCD7",
  16332. "\u0647\u062C",
  16333. "\uFCD8",
  16334. "\u0647\u0645",
  16335. "\uFCD9",
  16336. "\u0647\u0670",
  16337. "\uFCDA",
  16338. "\u064A\u062C",
  16339. "\uFCDB",
  16340. "\u064A\u062D",
  16341. "\uFCDC",
  16342. "\u064A\u062E",
  16343. "\uFCDD",
  16344. "\u064A\u0645",
  16345. "\uFCDE",
  16346. "\u064A\u0647",
  16347. "\uFCDF",
  16348. "\u0626\u0645",
  16349. "\uFCE0",
  16350. "\u0626\u0647",
  16351. "\uFCE1",
  16352. "\u0628\u0645",
  16353. "\uFCE2",
  16354. "\u0628\u0647",
  16355. "\uFCE3",
  16356. "\u062A\u0645",
  16357. "\uFCE4",
  16358. "\u062A\u0647",
  16359. "\uFCE5",
  16360. "\u062B\u0645",
  16361. "\uFCE6",
  16362. "\u062B\u0647",
  16363. "\uFCE7",
  16364. "\u0633\u0645",
  16365. "\uFCE8",
  16366. "\u0633\u0647",
  16367. "\uFCE9",
  16368. "\u0634\u0645",
  16369. "\uFCEA",
  16370. "\u0634\u0647",
  16371. "\uFCEB",
  16372. "\u0643\u0644",
  16373. "\uFCEC",
  16374. "\u0643\u0645",
  16375. "\uFCED",
  16376. "\u0644\u0645",
  16377. "\uFCEE",
  16378. "\u0646\u0645",
  16379. "\uFCEF",
  16380. "\u0646\u0647",
  16381. "\uFCF0",
  16382. "\u064A\u0645",
  16383. "\uFCF1",
  16384. "\u064A\u0647",
  16385. "\uFCF2",
  16386. "\u0640\u064E\u0651",
  16387. "\uFCF3",
  16388. "\u0640\u064F\u0651",
  16389. "\uFCF4",
  16390. "\u0640\u0650\u0651",
  16391. "\uFCF5",
  16392. "\u0637\u0649",
  16393. "\uFCF6",
  16394. "\u0637\u064A",
  16395. "\uFCF7",
  16396. "\u0639\u0649",
  16397. "\uFCF8",
  16398. "\u0639\u064A",
  16399. "\uFCF9",
  16400. "\u063A\u0649",
  16401. "\uFCFA",
  16402. "\u063A\u064A",
  16403. "\uFCFB",
  16404. "\u0633\u0649",
  16405. "\uFCFC",
  16406. "\u0633\u064A",
  16407. "\uFCFD",
  16408. "\u0634\u0649",
  16409. "\uFCFE",
  16410. "\u0634\u064A",
  16411. "\uFCFF",
  16412. "\u062D\u0649",
  16413. "\uFD00",
  16414. "\u062D\u064A",
  16415. "\uFD01",
  16416. "\u062C\u0649",
  16417. "\uFD02",
  16418. "\u062C\u064A",
  16419. "\uFD03",
  16420. "\u062E\u0649",
  16421. "\uFD04",
  16422. "\u062E\u064A",
  16423. "\uFD05",
  16424. "\u0635\u0649",
  16425. "\uFD06",
  16426. "\u0635\u064A",
  16427. "\uFD07",
  16428. "\u0636\u0649",
  16429. "\uFD08",
  16430. "\u0636\u064A",
  16431. "\uFD09",
  16432. "\u0634\u062C",
  16433. "\uFD0A",
  16434. "\u0634\u062D",
  16435. "\uFD0B",
  16436. "\u0634\u062E",
  16437. "\uFD0C",
  16438. "\u0634\u0645",
  16439. "\uFD0D",
  16440. "\u0634\u0631",
  16441. "\uFD0E",
  16442. "\u0633\u0631",
  16443. "\uFD0F",
  16444. "\u0635\u0631",
  16445. "\uFD10",
  16446. "\u0636\u0631",
  16447. "\uFD11",
  16448. "\u0637\u0649",
  16449. "\uFD12",
  16450. "\u0637\u064A",
  16451. "\uFD13",
  16452. "\u0639\u0649",
  16453. "\uFD14",
  16454. "\u0639\u064A",
  16455. "\uFD15",
  16456. "\u063A\u0649",
  16457. "\uFD16",
  16458. "\u063A\u064A",
  16459. "\uFD17",
  16460. "\u0633\u0649",
  16461. "\uFD18",
  16462. "\u0633\u064A",
  16463. "\uFD19",
  16464. "\u0634\u0649",
  16465. "\uFD1A",
  16466. "\u0634\u064A",
  16467. "\uFD1B",
  16468. "\u062D\u0649",
  16469. "\uFD1C",
  16470. "\u062D\u064A",
  16471. "\uFD1D",
  16472. "\u062C\u0649",
  16473. "\uFD1E",
  16474. "\u062C\u064A",
  16475. "\uFD1F",
  16476. "\u062E\u0649",
  16477. "\uFD20",
  16478. "\u062E\u064A",
  16479. "\uFD21",
  16480. "\u0635\u0649",
  16481. "\uFD22",
  16482. "\u0635\u064A",
  16483. "\uFD23",
  16484. "\u0636\u0649",
  16485. "\uFD24",
  16486. "\u0636\u064A",
  16487. "\uFD25",
  16488. "\u0634\u062C",
  16489. "\uFD26",
  16490. "\u0634\u062D",
  16491. "\uFD27",
  16492. "\u0634\u062E",
  16493. "\uFD28",
  16494. "\u0634\u0645",
  16495. "\uFD29",
  16496. "\u0634\u0631",
  16497. "\uFD2A",
  16498. "\u0633\u0631",
  16499. "\uFD2B",
  16500. "\u0635\u0631",
  16501. "\uFD2C",
  16502. "\u0636\u0631",
  16503. "\uFD2D",
  16504. "\u0634\u062C",
  16505. "\uFD2E",
  16506. "\u0634\u062D",
  16507. "\uFD2F",
  16508. "\u0634\u062E",
  16509. "\uFD30",
  16510. "\u0634\u0645",
  16511. "\uFD31",
  16512. "\u0633\u0647",
  16513. "\uFD32",
  16514. "\u0634\u0647",
  16515. "\uFD33",
  16516. "\u0637\u0645",
  16517. "\uFD34",
  16518. "\u0633\u062C",
  16519. "\uFD35",
  16520. "\u0633\u062D",
  16521. "\uFD36",
  16522. "\u0633\u062E",
  16523. "\uFD37",
  16524. "\u0634\u062C",
  16525. "\uFD38",
  16526. "\u0634\u062D",
  16527. "\uFD39",
  16528. "\u0634\u062E",
  16529. "\uFD3A",
  16530. "\u0637\u0645",
  16531. "\uFD3B",
  16532. "\u0638\u0645",
  16533. "\uFD3C",
  16534. "\u0627\u064B",
  16535. "\uFD3D",
  16536. "\u0627\u064B",
  16537. "\uFD50",
  16538. "\u062A\u062C\u0645",
  16539. "\uFD51",
  16540. "\u062A\u062D\u062C",
  16541. "\uFD52",
  16542. "\u062A\u062D\u062C",
  16543. "\uFD53",
  16544. "\u062A\u062D\u0645",
  16545. "\uFD54",
  16546. "\u062A\u062E\u0645",
  16547. "\uFD55",
  16548. "\u062A\u0645\u062C",
  16549. "\uFD56",
  16550. "\u062A\u0645\u062D",
  16551. "\uFD57",
  16552. "\u062A\u0645\u062E",
  16553. "\uFD58",
  16554. "\u062C\u0645\u062D",
  16555. "\uFD59",
  16556. "\u062C\u0645\u062D",
  16557. "\uFD5A",
  16558. "\u062D\u0645\u064A",
  16559. "\uFD5B",
  16560. "\u062D\u0645\u0649",
  16561. "\uFD5C",
  16562. "\u0633\u062D\u062C",
  16563. "\uFD5D",
  16564. "\u0633\u062C\u062D",
  16565. "\uFD5E",
  16566. "\u0633\u062C\u0649",
  16567. "\uFD5F",
  16568. "\u0633\u0645\u062D",
  16569. "\uFD60",
  16570. "\u0633\u0645\u062D",
  16571. "\uFD61",
  16572. "\u0633\u0645\u062C",
  16573. "\uFD62",
  16574. "\u0633\u0645\u0645",
  16575. "\uFD63",
  16576. "\u0633\u0645\u0645",
  16577. "\uFD64",
  16578. "\u0635\u062D\u062D",
  16579. "\uFD65",
  16580. "\u0635\u062D\u062D",
  16581. "\uFD66",
  16582. "\u0635\u0645\u0645",
  16583. "\uFD67",
  16584. "\u0634\u062D\u0645",
  16585. "\uFD68",
  16586. "\u0634\u062D\u0645",
  16587. "\uFD69",
  16588. "\u0634\u062C\u064A",
  16589. "\uFD6A",
  16590. "\u0634\u0645\u062E",
  16591. "\uFD6B",
  16592. "\u0634\u0645\u062E",
  16593. "\uFD6C",
  16594. "\u0634\u0645\u0645",
  16595. "\uFD6D",
  16596. "\u0634\u0645\u0645",
  16597. "\uFD6E",
  16598. "\u0636\u062D\u0649",
  16599. "\uFD6F",
  16600. "\u0636\u062E\u0645",
  16601. "\uFD70",
  16602. "\u0636\u062E\u0645",
  16603. "\uFD71",
  16604. "\u0637\u0645\u062D",
  16605. "\uFD72",
  16606. "\u0637\u0645\u062D",
  16607. "\uFD73",
  16608. "\u0637\u0645\u0645",
  16609. "\uFD74",
  16610. "\u0637\u0645\u064A",
  16611. "\uFD75",
  16612. "\u0639\u062C\u0645",
  16613. "\uFD76",
  16614. "\u0639\u0645\u0645",
  16615. "\uFD77",
  16616. "\u0639\u0645\u0645",
  16617. "\uFD78",
  16618. "\u0639\u0645\u0649",
  16619. "\uFD79",
  16620. "\u063A\u0645\u0645",
  16621. "\uFD7A",
  16622. "\u063A\u0645\u064A",
  16623. "\uFD7B",
  16624. "\u063A\u0645\u0649",
  16625. "\uFD7C",
  16626. "\u0641\u062E\u0645",
  16627. "\uFD7D",
  16628. "\u0641\u062E\u0645",
  16629. "\uFD7E",
  16630. "\u0642\u0645\u062D",
  16631. "\uFD7F",
  16632. "\u0642\u0645\u0645",
  16633. "\uFD80",
  16634. "\u0644\u062D\u0645",
  16635. "\uFD81",
  16636. "\u0644\u062D\u064A",
  16637. "\uFD82",
  16638. "\u0644\u062D\u0649",
  16639. "\uFD83",
  16640. "\u0644\u062C\u062C",
  16641. "\uFD84",
  16642. "\u0644\u062C\u062C",
  16643. "\uFD85",
  16644. "\u0644\u062E\u0645",
  16645. "\uFD86",
  16646. "\u0644\u062E\u0645",
  16647. "\uFD87",
  16648. "\u0644\u0645\u062D",
  16649. "\uFD88",
  16650. "\u0644\u0645\u062D",
  16651. "\uFD89",
  16652. "\u0645\u062D\u062C",
  16653. "\uFD8A",
  16654. "\u0645\u062D\u0645",
  16655. "\uFD8B",
  16656. "\u0645\u062D\u064A",
  16657. "\uFD8C",
  16658. "\u0645\u062C\u062D",
  16659. "\uFD8D",
  16660. "\u0645\u062C\u0645",
  16661. "\uFD8E",
  16662. "\u0645\u062E\u062C",
  16663. "\uFD8F",
  16664. "\u0645\u062E\u0645",
  16665. "\uFD92",
  16666. "\u0645\u062C\u062E",
  16667. "\uFD93",
  16668. "\u0647\u0645\u062C",
  16669. "\uFD94",
  16670. "\u0647\u0645\u0645",
  16671. "\uFD95",
  16672. "\u0646\u062D\u0645",
  16673. "\uFD96",
  16674. "\u0646\u062D\u0649",
  16675. "\uFD97",
  16676. "\u0646\u062C\u0645",
  16677. "\uFD98",
  16678. "\u0646\u062C\u0645",
  16679. "\uFD99",
  16680. "\u0646\u062C\u0649",
  16681. "\uFD9A",
  16682. "\u0646\u0645\u064A",
  16683. "\uFD9B",
  16684. "\u0646\u0645\u0649",
  16685. "\uFD9C",
  16686. "\u064A\u0645\u0645",
  16687. "\uFD9D",
  16688. "\u064A\u0645\u0645",
  16689. "\uFD9E",
  16690. "\u0628\u062E\u064A",
  16691. "\uFD9F",
  16692. "\u062A\u062C\u064A",
  16693. "\uFDA0",
  16694. "\u062A\u062C\u0649",
  16695. "\uFDA1",
  16696. "\u062A\u062E\u064A",
  16697. "\uFDA2",
  16698. "\u062A\u062E\u0649",
  16699. "\uFDA3",
  16700. "\u062A\u0645\u064A",
  16701. "\uFDA4",
  16702. "\u062A\u0645\u0649",
  16703. "\uFDA5",
  16704. "\u062C\u0645\u064A",
  16705. "\uFDA6",
  16706. "\u062C\u062D\u0649",
  16707. "\uFDA7",
  16708. "\u062C\u0645\u0649",
  16709. "\uFDA8",
  16710. "\u0633\u062E\u0649",
  16711. "\uFDA9",
  16712. "\u0635\u062D\u064A",
  16713. "\uFDAA",
  16714. "\u0634\u062D\u064A",
  16715. "\uFDAB",
  16716. "\u0636\u062D\u064A",
  16717. "\uFDAC",
  16718. "\u0644\u062C\u064A",
  16719. "\uFDAD",
  16720. "\u0644\u0645\u064A",
  16721. "\uFDAE",
  16722. "\u064A\u062D\u064A",
  16723. "\uFDAF",
  16724. "\u064A\u062C\u064A",
  16725. "\uFDB0",
  16726. "\u064A\u0645\u064A",
  16727. "\uFDB1",
  16728. "\u0645\u0645\u064A",
  16729. "\uFDB2",
  16730. "\u0642\u0645\u064A",
  16731. "\uFDB3",
  16732. "\u0646\u062D\u064A",
  16733. "\uFDB4",
  16734. "\u0642\u0645\u062D",
  16735. "\uFDB5",
  16736. "\u0644\u062D\u0645",
  16737. "\uFDB6",
  16738. "\u0639\u0645\u064A",
  16739. "\uFDB7",
  16740. "\u0643\u0645\u064A",
  16741. "\uFDB8",
  16742. "\u0646\u062C\u062D",
  16743. "\uFDB9",
  16744. "\u0645\u062E\u064A",
  16745. "\uFDBA",
  16746. "\u0644\u062C\u0645",
  16747. "\uFDBB",
  16748. "\u0643\u0645\u0645",
  16749. "\uFDBC",
  16750. "\u0644\u062C\u0645",
  16751. "\uFDBD",
  16752. "\u0646\u062C\u062D",
  16753. "\uFDBE",
  16754. "\u062C\u062D\u064A",
  16755. "\uFDBF",
  16756. "\u062D\u062C\u064A",
  16757. "\uFDC0",
  16758. "\u0645\u062C\u064A",
  16759. "\uFDC1",
  16760. "\u0641\u0645\u064A",
  16761. "\uFDC2",
  16762. "\u0628\u062D\u064A",
  16763. "\uFDC3",
  16764. "\u0643\u0645\u0645",
  16765. "\uFDC4",
  16766. "\u0639\u062C\u0645",
  16767. "\uFDC5",
  16768. "\u0635\u0645\u0645",
  16769. "\uFDC6",
  16770. "\u0633\u062E\u064A",
  16771. "\uFDC7",
  16772. "\u0646\u062C\u064A",
  16773. "\uFE49",
  16774. "\u203E",
  16775. "\uFE4A",
  16776. "\u203E",
  16777. "\uFE4B",
  16778. "\u203E",
  16779. "\uFE4C",
  16780. "\u203E",
  16781. "\uFE4D",
  16782. "\u005F",
  16783. "\uFE4E",
  16784. "\u005F",
  16785. "\uFE4F",
  16786. "\u005F",
  16787. "\uFE80",
  16788. "\u0621",
  16789. "\uFE81",
  16790. "\u0622",
  16791. "\uFE82",
  16792. "\u0622",
  16793. "\uFE83",
  16794. "\u0623",
  16795. "\uFE84",
  16796. "\u0623",
  16797. "\uFE85",
  16798. "\u0624",
  16799. "\uFE86",
  16800. "\u0624",
  16801. "\uFE87",
  16802. "\u0625",
  16803. "\uFE88",
  16804. "\u0625",
  16805. "\uFE89",
  16806. "\u0626",
  16807. "\uFE8A",
  16808. "\u0626",
  16809. "\uFE8B",
  16810. "\u0626",
  16811. "\uFE8C",
  16812. "\u0626",
  16813. "\uFE8D",
  16814. "\u0627",
  16815. "\uFE8E",
  16816. "\u0627",
  16817. "\uFE8F",
  16818. "\u0628",
  16819. "\uFE90",
  16820. "\u0628",
  16821. "\uFE91",
  16822. "\u0628",
  16823. "\uFE92",
  16824. "\u0628",
  16825. "\uFE93",
  16826. "\u0629",
  16827. "\uFE94",
  16828. "\u0629",
  16829. "\uFE95",
  16830. "\u062A",
  16831. "\uFE96",
  16832. "\u062A",
  16833. "\uFE97",
  16834. "\u062A",
  16835. "\uFE98",
  16836. "\u062A",
  16837. "\uFE99",
  16838. "\u062B",
  16839. "\uFE9A",
  16840. "\u062B",
  16841. "\uFE9B",
  16842. "\u062B",
  16843. "\uFE9C",
  16844. "\u062B",
  16845. "\uFE9D",
  16846. "\u062C",
  16847. "\uFE9E",
  16848. "\u062C",
  16849. "\uFE9F",
  16850. "\u062C",
  16851. "\uFEA0",
  16852. "\u062C",
  16853. "\uFEA1",
  16854. "\u062D",
  16855. "\uFEA2",
  16856. "\u062D",
  16857. "\uFEA3",
  16858. "\u062D",
  16859. "\uFEA4",
  16860. "\u062D",
  16861. "\uFEA5",
  16862. "\u062E",
  16863. "\uFEA6",
  16864. "\u062E",
  16865. "\uFEA7",
  16866. "\u062E",
  16867. "\uFEA8",
  16868. "\u062E",
  16869. "\uFEA9",
  16870. "\u062F",
  16871. "\uFEAA",
  16872. "\u062F",
  16873. "\uFEAB",
  16874. "\u0630",
  16875. "\uFEAC",
  16876. "\u0630",
  16877. "\uFEAD",
  16878. "\u0631",
  16879. "\uFEAE",
  16880. "\u0631",
  16881. "\uFEAF",
  16882. "\u0632",
  16883. "\uFEB0",
  16884. "\u0632",
  16885. "\uFEB1",
  16886. "\u0633",
  16887. "\uFEB2",
  16888. "\u0633",
  16889. "\uFEB3",
  16890. "\u0633",
  16891. "\uFEB4",
  16892. "\u0633",
  16893. "\uFEB5",
  16894. "\u0634",
  16895. "\uFEB6",
  16896. "\u0634",
  16897. "\uFEB7",
  16898. "\u0634",
  16899. "\uFEB8",
  16900. "\u0634",
  16901. "\uFEB9",
  16902. "\u0635",
  16903. "\uFEBA",
  16904. "\u0635",
  16905. "\uFEBB",
  16906. "\u0635",
  16907. "\uFEBC",
  16908. "\u0635",
  16909. "\uFEBD",
  16910. "\u0636",
  16911. "\uFEBE",
  16912. "\u0636",
  16913. "\uFEBF",
  16914. "\u0636",
  16915. "\uFEC0",
  16916. "\u0636",
  16917. "\uFEC1",
  16918. "\u0637",
  16919. "\uFEC2",
  16920. "\u0637",
  16921. "\uFEC3",
  16922. "\u0637",
  16923. "\uFEC4",
  16924. "\u0637",
  16925. "\uFEC5",
  16926. "\u0638",
  16927. "\uFEC6",
  16928. "\u0638",
  16929. "\uFEC7",
  16930. "\u0638",
  16931. "\uFEC8",
  16932. "\u0638",
  16933. "\uFEC9",
  16934. "\u0639",
  16935. "\uFECA",
  16936. "\u0639",
  16937. "\uFECB",
  16938. "\u0639",
  16939. "\uFECC",
  16940. "\u0639",
  16941. "\uFECD",
  16942. "\u063A",
  16943. "\uFECE",
  16944. "\u063A",
  16945. "\uFECF",
  16946. "\u063A",
  16947. "\uFED0",
  16948. "\u063A",
  16949. "\uFED1",
  16950. "\u0641",
  16951. "\uFED2",
  16952. "\u0641",
  16953. "\uFED3",
  16954. "\u0641",
  16955. "\uFED4",
  16956. "\u0641",
  16957. "\uFED5",
  16958. "\u0642",
  16959. "\uFED6",
  16960. "\u0642",
  16961. "\uFED7",
  16962. "\u0642",
  16963. "\uFED8",
  16964. "\u0642",
  16965. "\uFED9",
  16966. "\u0643",
  16967. "\uFEDA",
  16968. "\u0643",
  16969. "\uFEDB",
  16970. "\u0643",
  16971. "\uFEDC",
  16972. "\u0643",
  16973. "\uFEDD",
  16974. "\u0644",
  16975. "\uFEDE",
  16976. "\u0644",
  16977. "\uFEDF",
  16978. "\u0644",
  16979. "\uFEE0",
  16980. "\u0644",
  16981. "\uFEE1",
  16982. "\u0645",
  16983. "\uFEE2",
  16984. "\u0645",
  16985. "\uFEE3",
  16986. "\u0645",
  16987. "\uFEE4",
  16988. "\u0645",
  16989. "\uFEE5",
  16990. "\u0646",
  16991. "\uFEE6",
  16992. "\u0646",
  16993. "\uFEE7",
  16994. "\u0646",
  16995. "\uFEE8",
  16996. "\u0646",
  16997. "\uFEE9",
  16998. "\u0647",
  16999. "\uFEEA",
  17000. "\u0647",
  17001. "\uFEEB",
  17002. "\u0647",
  17003. "\uFEEC",
  17004. "\u0647",
  17005. "\uFEED",
  17006. "\u0648",
  17007. "\uFEEE",
  17008. "\u0648",
  17009. "\uFEEF",
  17010. "\u0649",
  17011. "\uFEF0",
  17012. "\u0649",
  17013. "\uFEF1",
  17014. "\u064A",
  17015. "\uFEF2",
  17016. "\u064A",
  17017. "\uFEF3",
  17018. "\u064A",
  17019. "\uFEF4",
  17020. "\u064A",
  17021. "\uFEF5",
  17022. "\u0644\u0622",
  17023. "\uFEF6",
  17024. "\u0644\u0622",
  17025. "\uFEF7",
  17026. "\u0644\u0623",
  17027. "\uFEF8",
  17028. "\u0644\u0623",
  17029. "\uFEF9",
  17030. "\u0644\u0625",
  17031. "\uFEFA",
  17032. "\u0644\u0625",
  17033. "\uFEFB",
  17034. "\u0644\u0627",
  17035. "\uFEFC",
  17036. "\u0644\u0627"
  17037. ];
  17038. });
  17039. function reverseIfRtl(chars) {
  17040. const charsLength = chars.length;
  17041. if (charsLength <= 1 || !isRTLRangeFor(chars.charCodeAt(0))) {
  17042. return chars;
  17043. }
  17044. const buf = [];
  17045. for (let ii = charsLength - 1; ii >= 0; ii--) {
  17046. buf.push(chars[ii]);
  17047. }
  17048. return buf.join("");
  17049. }
  17050. const SpecialCharRegExp = new RegExp("^(\\s)|(\\p{Mn})|(\\p{Cf})$", "u");
  17051. const CategoryCache = new Map();
  17052. function getCharUnicodeCategory(char) {
  17053. const cachedCategory = CategoryCache.get(char);
  17054. if (cachedCategory) {
  17055. return cachedCategory;
  17056. }
  17057. const groups = char.match(SpecialCharRegExp);
  17058. const category = {
  17059. isWhitespace: !!(groups && groups[1]),
  17060. isZeroWidthDiacritic: !!(groups && groups[2]),
  17061. isInvisibleFormatMark: !!(groups && groups[3])
  17062. };
  17063. CategoryCache.set(char, category);
  17064. return category;
  17065. }
  17066. function clearUnicodeCaches() {
  17067. CategoryCache.clear();
  17068. }
  17069. /***/ }),
  17070. /* 22 */
  17071. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  17072. Object.defineProperty(exports, "__esModule", ({
  17073. value: true
  17074. }));
  17075. exports.MarkupAnnotation = exports.AnnotationFactory = exports.AnnotationBorderStyle = exports.Annotation = void 0;
  17076. exports.getQuadPoints = getQuadPoints;
  17077. var _util = __w_pdfjs_require__(2);
  17078. var _core_utils = __w_pdfjs_require__(8);
  17079. var _default_appearance = __w_pdfjs_require__(23);
  17080. var _primitives = __w_pdfjs_require__(5);
  17081. var _base_stream = __w_pdfjs_require__(9);
  17082. var _bidi = __w_pdfjs_require__(60);
  17083. var _catalog = __w_pdfjs_require__(65);
  17084. var _colorspace = __w_pdfjs_require__(24);
  17085. var _file_spec = __w_pdfjs_require__(68);
  17086. var _object_loader = __w_pdfjs_require__(72);
  17087. var _operator_list = __w_pdfjs_require__(62);
  17088. var _stream = __w_pdfjs_require__(10);
  17089. var _writer = __w_pdfjs_require__(73);
  17090. var _factory = __w_pdfjs_require__(76);
  17091. const LINE_FACTOR = 1.35;
  17092. class AnnotationFactory {
  17093. static create(xref, ref, pdfManager, idFactory, collectFields) {
  17094. return Promise.all([pdfManager.ensureCatalog("acroForm"), pdfManager.ensureCatalog("baseUrl"), pdfManager.ensureDoc("xfaDatasets"), collectFields ? this._getPageIndex(xref, ref, pdfManager) : -1]).then(([acroForm, baseUrl, xfaDatasets, pageIndex]) => pdfManager.ensure(this, "_create", [xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex]));
  17095. }
  17096. static _create(xref, ref, pdfManager, idFactory, acroForm, xfaDatasets, collectFields, pageIndex = -1) {
  17097. const dict = xref.fetchIfRef(ref);
  17098. if (!(dict instanceof _primitives.Dict)) {
  17099. return undefined;
  17100. }
  17101. const id = ref instanceof _primitives.Ref ? ref.toString() : `annot_${idFactory.createObjId()}`;
  17102. let subtype = dict.get("Subtype");
  17103. subtype = subtype instanceof _primitives.Name ? subtype.name : null;
  17104. const parameters = {
  17105. xref,
  17106. ref,
  17107. dict,
  17108. subtype,
  17109. id,
  17110. pdfManager,
  17111. acroForm: acroForm instanceof _primitives.Dict ? acroForm : _primitives.Dict.empty,
  17112. xfaDatasets,
  17113. collectFields,
  17114. pageIndex
  17115. };
  17116. switch (subtype) {
  17117. case "Link":
  17118. return new LinkAnnotation(parameters);
  17119. case "Text":
  17120. return new TextAnnotation(parameters);
  17121. case "Widget":
  17122. let fieldType = (0, _core_utils.getInheritableProperty)({
  17123. dict,
  17124. key: "FT"
  17125. });
  17126. fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17127. switch (fieldType) {
  17128. case "Tx":
  17129. return new TextWidgetAnnotation(parameters);
  17130. case "Btn":
  17131. return new ButtonWidgetAnnotation(parameters);
  17132. case "Ch":
  17133. return new ChoiceWidgetAnnotation(parameters);
  17134. case "Sig":
  17135. return new SignatureWidgetAnnotation(parameters);
  17136. }
  17137. (0, _util.warn)(`Unimplemented widget field type "${fieldType}", ` + "falling back to base field type.");
  17138. return new WidgetAnnotation(parameters);
  17139. case "Popup":
  17140. return new PopupAnnotation(parameters);
  17141. case "FreeText":
  17142. return new FreeTextAnnotation(parameters);
  17143. case "Line":
  17144. return new LineAnnotation(parameters);
  17145. case "Square":
  17146. return new SquareAnnotation(parameters);
  17147. case "Circle":
  17148. return new CircleAnnotation(parameters);
  17149. case "PolyLine":
  17150. return new PolylineAnnotation(parameters);
  17151. case "Polygon":
  17152. return new PolygonAnnotation(parameters);
  17153. case "Caret":
  17154. return new CaretAnnotation(parameters);
  17155. case "Ink":
  17156. return new InkAnnotation(parameters);
  17157. case "Highlight":
  17158. return new HighlightAnnotation(parameters);
  17159. case "Underline":
  17160. return new UnderlineAnnotation(parameters);
  17161. case "Squiggly":
  17162. return new SquigglyAnnotation(parameters);
  17163. case "StrikeOut":
  17164. return new StrikeOutAnnotation(parameters);
  17165. case "Stamp":
  17166. return new StampAnnotation(parameters);
  17167. case "FileAttachment":
  17168. return new FileAttachmentAnnotation(parameters);
  17169. default:
  17170. if (!collectFields) {
  17171. if (!subtype) {
  17172. (0, _util.warn)("Annotation is missing the required /Subtype.");
  17173. } else {
  17174. (0, _util.warn)(`Unimplemented annotation type "${subtype}", ` + "falling back to base annotation.");
  17175. }
  17176. }
  17177. return new Annotation(parameters);
  17178. }
  17179. }
  17180. static async _getPageIndex(xref, ref, pdfManager) {
  17181. try {
  17182. const annotDict = await xref.fetchIfRefAsync(ref);
  17183. if (!(annotDict instanceof _primitives.Dict)) {
  17184. return -1;
  17185. }
  17186. const pageRef = annotDict.getRaw("P");
  17187. if (!(pageRef instanceof _primitives.Ref)) {
  17188. return -1;
  17189. }
  17190. const pageIndex = await pdfManager.ensureCatalog("getPageIndex", [pageRef]);
  17191. return pageIndex;
  17192. } catch (ex) {
  17193. (0, _util.warn)(`_getPageIndex: "${ex}".`);
  17194. return -1;
  17195. }
  17196. }
  17197. }
  17198. exports.AnnotationFactory = AnnotationFactory;
  17199. function getRgbColor(color, defaultColor = new Uint8ClampedArray(3)) {
  17200. if (!Array.isArray(color)) {
  17201. return defaultColor;
  17202. }
  17203. const rgbColor = defaultColor || new Uint8ClampedArray(3);
  17204. switch (color.length) {
  17205. case 0:
  17206. return null;
  17207. case 1:
  17208. _colorspace.ColorSpace.singletons.gray.getRgbItem(color, 0, rgbColor, 0);
  17209. return rgbColor;
  17210. case 3:
  17211. _colorspace.ColorSpace.singletons.rgb.getRgbItem(color, 0, rgbColor, 0);
  17212. return rgbColor;
  17213. case 4:
  17214. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(color, 0, rgbColor, 0);
  17215. return rgbColor;
  17216. default:
  17217. return defaultColor;
  17218. }
  17219. }
  17220. function getQuadPoints(dict, rect) {
  17221. if (!dict.has("QuadPoints")) {
  17222. return null;
  17223. }
  17224. const quadPoints = dict.getArray("QuadPoints");
  17225. if (!Array.isArray(quadPoints) || quadPoints.length === 0 || quadPoints.length % 8 > 0) {
  17226. return null;
  17227. }
  17228. const quadPointsLists = [];
  17229. for (let i = 0, ii = quadPoints.length / 8; i < ii; i++) {
  17230. quadPointsLists.push([]);
  17231. for (let j = i * 8, jj = i * 8 + 8; j < jj; j += 2) {
  17232. const x = quadPoints[j];
  17233. const y = quadPoints[j + 1];
  17234. if (rect !== null && (x < rect[0] || x > rect[2] || y < rect[1] || y > rect[3])) {
  17235. return null;
  17236. }
  17237. quadPointsLists[i].push({
  17238. x,
  17239. y
  17240. });
  17241. }
  17242. }
  17243. return quadPointsLists.map(quadPointsList => {
  17244. const [minX, maxX, minY, maxY] = quadPointsList.reduce(([mX, MX, mY, MY], quadPoint) => [Math.min(mX, quadPoint.x), Math.max(MX, quadPoint.x), Math.min(mY, quadPoint.y), Math.max(MY, quadPoint.y)], [Number.MAX_VALUE, Number.MIN_VALUE, Number.MAX_VALUE, Number.MIN_VALUE]);
  17245. return [{
  17246. x: minX,
  17247. y: maxY
  17248. }, {
  17249. x: maxX,
  17250. y: maxY
  17251. }, {
  17252. x: minX,
  17253. y: minY
  17254. }, {
  17255. x: maxX,
  17256. y: minY
  17257. }];
  17258. });
  17259. }
  17260. function getTransformMatrix(rect, bbox, matrix) {
  17261. const [minX, minY, maxX, maxY] = _util.Util.getAxialAlignedBoundingBox(bbox, matrix);
  17262. if (minX === maxX || minY === maxY) {
  17263. return [1, 0, 0, 1, rect[0], rect[1]];
  17264. }
  17265. const xRatio = (rect[2] - rect[0]) / (maxX - minX);
  17266. const yRatio = (rect[3] - rect[1]) / (maxY - minY);
  17267. return [xRatio, 0, 0, yRatio, rect[0] - minX * xRatio, rect[1] - minY * yRatio];
  17268. }
  17269. class Annotation {
  17270. constructor(params) {
  17271. const dict = params.dict;
  17272. this.setTitle(dict.get("T"));
  17273. this.setContents(dict.get("Contents"));
  17274. this.setModificationDate(dict.get("M"));
  17275. this.setFlags(dict.get("F"));
  17276. this.setRectangle(dict.getArray("Rect"));
  17277. this.setColor(dict.getArray("C"));
  17278. this.setBorderStyle(dict);
  17279. this.setAppearance(dict);
  17280. this.setBorderAndBackgroundColors(dict.get("MK"));
  17281. this._streams = [];
  17282. if (this.appearance) {
  17283. this._streams.push(this.appearance);
  17284. }
  17285. this.data = {
  17286. annotationFlags: this.flags,
  17287. borderStyle: this.borderStyle,
  17288. color: this.color,
  17289. backgroundColor: this.backgroundColor,
  17290. borderColor: this.borderColor,
  17291. contentsObj: this._contents,
  17292. hasAppearance: !!this.appearance,
  17293. id: params.id,
  17294. modificationDate: this.modificationDate,
  17295. rect: this.rectangle,
  17296. subtype: params.subtype,
  17297. hasOwnCanvas: false
  17298. };
  17299. if (params.collectFields) {
  17300. const kids = dict.get("Kids");
  17301. if (Array.isArray(kids)) {
  17302. const kidIds = [];
  17303. for (const kid of kids) {
  17304. if (kid instanceof _primitives.Ref) {
  17305. kidIds.push(kid.toString());
  17306. }
  17307. }
  17308. if (kidIds.length !== 0) {
  17309. this.data.kidIds = kidIds;
  17310. }
  17311. }
  17312. this.data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17313. this.data.fieldName = this._constructFieldName(dict);
  17314. this.data.pageIndex = params.pageIndex;
  17315. }
  17316. this._fallbackFontDict = null;
  17317. }
  17318. _hasFlag(flags, flag) {
  17319. return !!(flags & flag);
  17320. }
  17321. _isViewable(flags) {
  17322. return !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE) && !this._hasFlag(flags, _util.AnnotationFlag.NOVIEW);
  17323. }
  17324. _isPrintable(flags) {
  17325. return this._hasFlag(flags, _util.AnnotationFlag.PRINT) && !this._hasFlag(flags, _util.AnnotationFlag.INVISIBLE);
  17326. }
  17327. mustBeViewed(annotationStorage) {
  17328. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17329. if (storageEntry && storageEntry.hidden !== undefined) {
  17330. return !storageEntry.hidden;
  17331. }
  17332. return this.viewable && !this._hasFlag(this.flags, _util.AnnotationFlag.HIDDEN);
  17333. }
  17334. mustBePrinted(annotationStorage) {
  17335. const storageEntry = annotationStorage && annotationStorage.get(this.data.id);
  17336. if (storageEntry && storageEntry.print !== undefined) {
  17337. return storageEntry.print;
  17338. }
  17339. return this.printable;
  17340. }
  17341. get viewable() {
  17342. if (this.data.quadPoints === null) {
  17343. return false;
  17344. }
  17345. if (this.flags === 0) {
  17346. return true;
  17347. }
  17348. return this._isViewable(this.flags);
  17349. }
  17350. get printable() {
  17351. if (this.data.quadPoints === null) {
  17352. return false;
  17353. }
  17354. if (this.flags === 0) {
  17355. return false;
  17356. }
  17357. return this._isPrintable(this.flags);
  17358. }
  17359. _parseStringHelper(data) {
  17360. const str = typeof data === "string" ? (0, _util.stringToPDFString)(data) : "";
  17361. const dir = str && (0, _bidi.bidi)(str).dir === "rtl" ? "rtl" : "ltr";
  17362. return {
  17363. str,
  17364. dir
  17365. };
  17366. }
  17367. setTitle(title) {
  17368. this._title = this._parseStringHelper(title);
  17369. }
  17370. setContents(contents) {
  17371. this._contents = this._parseStringHelper(contents);
  17372. }
  17373. setModificationDate(modificationDate) {
  17374. this.modificationDate = typeof modificationDate === "string" ? modificationDate : null;
  17375. }
  17376. setFlags(flags) {
  17377. this.flags = Number.isInteger(flags) && flags > 0 ? flags : 0;
  17378. }
  17379. hasFlag(flag) {
  17380. return this._hasFlag(this.flags, flag);
  17381. }
  17382. setRectangle(rectangle) {
  17383. if (Array.isArray(rectangle) && rectangle.length === 4) {
  17384. this.rectangle = _util.Util.normalizeRect(rectangle);
  17385. } else {
  17386. this.rectangle = [0, 0, 0, 0];
  17387. }
  17388. }
  17389. setColor(color) {
  17390. this.color = getRgbColor(color);
  17391. }
  17392. setLineEndings(lineEndings) {
  17393. this.lineEndings = ["None", "None"];
  17394. if (Array.isArray(lineEndings) && lineEndings.length === 2) {
  17395. for (let i = 0; i < 2; i++) {
  17396. const obj = lineEndings[i];
  17397. if (obj instanceof _primitives.Name) {
  17398. switch (obj.name) {
  17399. case "None":
  17400. continue;
  17401. case "Square":
  17402. case "Circle":
  17403. case "Diamond":
  17404. case "OpenArrow":
  17405. case "ClosedArrow":
  17406. case "Butt":
  17407. case "ROpenArrow":
  17408. case "RClosedArrow":
  17409. case "Slash":
  17410. this.lineEndings[i] = obj.name;
  17411. continue;
  17412. }
  17413. }
  17414. (0, _util.warn)(`Ignoring invalid lineEnding: ${obj}`);
  17415. }
  17416. }
  17417. }
  17418. setBorderAndBackgroundColors(mk) {
  17419. if (mk instanceof _primitives.Dict) {
  17420. this.borderColor = getRgbColor(mk.getArray("BC"), null);
  17421. this.backgroundColor = getRgbColor(mk.getArray("BG"), null);
  17422. } else {
  17423. this.borderColor = this.backgroundColor = null;
  17424. }
  17425. }
  17426. setBorderStyle(borderStyle) {
  17427. this.borderStyle = new AnnotationBorderStyle();
  17428. if (!(borderStyle instanceof _primitives.Dict)) {
  17429. return;
  17430. }
  17431. if (borderStyle.has("BS")) {
  17432. const dict = borderStyle.get("BS");
  17433. const dictType = dict.get("Type");
  17434. if (!dictType || (0, _primitives.isName)(dictType, "Border")) {
  17435. this.borderStyle.setWidth(dict.get("W"), this.rectangle);
  17436. this.borderStyle.setStyle(dict.get("S"));
  17437. this.borderStyle.setDashArray(dict.getArray("D"));
  17438. }
  17439. } else if (borderStyle.has("Border")) {
  17440. const array = borderStyle.getArray("Border");
  17441. if (Array.isArray(array) && array.length >= 3) {
  17442. this.borderStyle.setHorizontalCornerRadius(array[0]);
  17443. this.borderStyle.setVerticalCornerRadius(array[1]);
  17444. this.borderStyle.setWidth(array[2], this.rectangle);
  17445. if (array.length === 4) {
  17446. this.borderStyle.setDashArray(array[3], true);
  17447. }
  17448. }
  17449. } else {
  17450. this.borderStyle.setWidth(0);
  17451. }
  17452. }
  17453. setAppearance(dict) {
  17454. this.appearance = null;
  17455. const appearanceStates = dict.get("AP");
  17456. if (!(appearanceStates instanceof _primitives.Dict)) {
  17457. return;
  17458. }
  17459. const normalAppearanceState = appearanceStates.get("N");
  17460. if (normalAppearanceState instanceof _base_stream.BaseStream) {
  17461. this.appearance = normalAppearanceState;
  17462. return;
  17463. }
  17464. if (!(normalAppearanceState instanceof _primitives.Dict)) {
  17465. return;
  17466. }
  17467. const as = dict.get("AS");
  17468. if (!(as instanceof _primitives.Name) || !normalAppearanceState.has(as.name)) {
  17469. return;
  17470. }
  17471. this.appearance = normalAppearanceState.get(as.name);
  17472. }
  17473. loadResources(keys, appearance) {
  17474. return appearance.dict.getAsync("Resources").then(resources => {
  17475. if (!resources) {
  17476. return undefined;
  17477. }
  17478. const objectLoader = new _object_loader.ObjectLoader(resources, keys, resources.xref);
  17479. return objectLoader.load().then(function () {
  17480. return resources;
  17481. });
  17482. });
  17483. }
  17484. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17485. const data = this.data;
  17486. let appearance = this.appearance;
  17487. const isUsingOwnCanvas = data.hasOwnCanvas && intent & _util.RenderingIntentFlag.DISPLAY;
  17488. if (!appearance) {
  17489. if (!isUsingOwnCanvas) {
  17490. return Promise.resolve(new _operator_list.OperatorList());
  17491. }
  17492. appearance = new _stream.StringStream("");
  17493. appearance.dict = new _primitives.Dict();
  17494. }
  17495. const appearanceDict = appearance.dict;
  17496. const resourcesPromise = this.loadResources(["ExtGState", "ColorSpace", "Pattern", "Shading", "XObject", "Font"], appearance);
  17497. const bbox = appearanceDict.getArray("BBox") || [0, 0, 1, 1];
  17498. const matrix = appearanceDict.getArray("Matrix") || [1, 0, 0, 1, 0, 0];
  17499. const transform = getTransformMatrix(data.rect, bbox, matrix);
  17500. return resourcesPromise.then(resources => {
  17501. const opList = new _operator_list.OperatorList();
  17502. opList.addOp(_util.OPS.beginAnnotation, [data.id, data.rect, transform, matrix, isUsingOwnCanvas]);
  17503. return evaluator.getOperatorList({
  17504. stream: appearance,
  17505. task,
  17506. resources,
  17507. operatorList: opList,
  17508. fallbackFontDict: this._fallbackFontDict
  17509. }).then(() => {
  17510. opList.addOp(_util.OPS.endAnnotation, []);
  17511. this.reset();
  17512. return opList;
  17513. });
  17514. });
  17515. }
  17516. async save(evaluator, task, annotationStorage) {
  17517. return null;
  17518. }
  17519. getFieldObject() {
  17520. if (this.data.kidIds) {
  17521. return {
  17522. id: this.data.id,
  17523. actions: this.data.actions,
  17524. name: this.data.fieldName,
  17525. strokeColor: this.data.borderColor,
  17526. fillColor: this.data.backgroundColor,
  17527. type: "",
  17528. kidIds: this.data.kidIds,
  17529. page: this.data.pageIndex
  17530. };
  17531. }
  17532. return null;
  17533. }
  17534. reset() {
  17535. for (const stream of this._streams) {
  17536. stream.reset();
  17537. }
  17538. }
  17539. _constructFieldName(dict) {
  17540. if (!dict.has("T") && !dict.has("Parent")) {
  17541. (0, _util.warn)("Unknown field name, falling back to empty field name.");
  17542. return "";
  17543. }
  17544. if (!dict.has("Parent")) {
  17545. return (0, _util.stringToPDFString)(dict.get("T"));
  17546. }
  17547. const fieldName = [];
  17548. if (dict.has("T")) {
  17549. fieldName.unshift((0, _util.stringToPDFString)(dict.get("T")));
  17550. }
  17551. let loopDict = dict;
  17552. const visited = new _primitives.RefSet();
  17553. if (dict.objId) {
  17554. visited.put(dict.objId);
  17555. }
  17556. while (loopDict.has("Parent")) {
  17557. loopDict = loopDict.get("Parent");
  17558. if (!(loopDict instanceof _primitives.Dict) || loopDict.objId && visited.has(loopDict.objId)) {
  17559. break;
  17560. }
  17561. if (loopDict.objId) {
  17562. visited.put(loopDict.objId);
  17563. }
  17564. if (loopDict.has("T")) {
  17565. fieldName.unshift((0, _util.stringToPDFString)(loopDict.get("T")));
  17566. }
  17567. }
  17568. return fieldName.join(".");
  17569. }
  17570. }
  17571. exports.Annotation = Annotation;
  17572. class AnnotationBorderStyle {
  17573. constructor() {
  17574. this.width = 1;
  17575. this.style = _util.AnnotationBorderStyleType.SOLID;
  17576. this.dashArray = [3];
  17577. this.horizontalCornerRadius = 0;
  17578. this.verticalCornerRadius = 0;
  17579. }
  17580. setWidth(width, rect = [0, 0, 0, 0]) {
  17581. if (width instanceof _primitives.Name) {
  17582. this.width = 0;
  17583. return;
  17584. }
  17585. if (typeof width === "number") {
  17586. if (width > 0) {
  17587. const maxWidth = (rect[2] - rect[0]) / 2;
  17588. const maxHeight = (rect[3] - rect[1]) / 2;
  17589. if (maxWidth > 0 && maxHeight > 0 && (width > maxWidth || width > maxHeight)) {
  17590. (0, _util.warn)(`AnnotationBorderStyle.setWidth - ignoring width: ${width}`);
  17591. width = 1;
  17592. }
  17593. }
  17594. this.width = width;
  17595. }
  17596. }
  17597. setStyle(style) {
  17598. if (!(style instanceof _primitives.Name)) {
  17599. return;
  17600. }
  17601. switch (style.name) {
  17602. case "S":
  17603. this.style = _util.AnnotationBorderStyleType.SOLID;
  17604. break;
  17605. case "D":
  17606. this.style = _util.AnnotationBorderStyleType.DASHED;
  17607. break;
  17608. case "B":
  17609. this.style = _util.AnnotationBorderStyleType.BEVELED;
  17610. break;
  17611. case "I":
  17612. this.style = _util.AnnotationBorderStyleType.INSET;
  17613. break;
  17614. case "U":
  17615. this.style = _util.AnnotationBorderStyleType.UNDERLINE;
  17616. break;
  17617. default:
  17618. break;
  17619. }
  17620. }
  17621. setDashArray(dashArray, forceStyle = false) {
  17622. if (Array.isArray(dashArray) && dashArray.length > 0) {
  17623. let isValid = true;
  17624. let allZeros = true;
  17625. for (const element of dashArray) {
  17626. const validNumber = +element >= 0;
  17627. if (!validNumber) {
  17628. isValid = false;
  17629. break;
  17630. } else if (element > 0) {
  17631. allZeros = false;
  17632. }
  17633. }
  17634. if (isValid && !allZeros) {
  17635. this.dashArray = dashArray;
  17636. if (forceStyle) {
  17637. this.setStyle(_primitives.Name.get("D"));
  17638. }
  17639. } else {
  17640. this.width = 0;
  17641. }
  17642. } else if (dashArray) {
  17643. this.width = 0;
  17644. }
  17645. }
  17646. setHorizontalCornerRadius(radius) {
  17647. if (Number.isInteger(radius)) {
  17648. this.horizontalCornerRadius = radius;
  17649. }
  17650. }
  17651. setVerticalCornerRadius(radius) {
  17652. if (Number.isInteger(radius)) {
  17653. this.verticalCornerRadius = radius;
  17654. }
  17655. }
  17656. }
  17657. exports.AnnotationBorderStyle = AnnotationBorderStyle;
  17658. class MarkupAnnotation extends Annotation {
  17659. constructor(parameters) {
  17660. super(parameters);
  17661. const dict = parameters.dict;
  17662. if (dict.has("IRT")) {
  17663. const rawIRT = dict.getRaw("IRT");
  17664. this.data.inReplyTo = rawIRT instanceof _primitives.Ref ? rawIRT.toString() : null;
  17665. const rt = dict.get("RT");
  17666. this.data.replyType = rt instanceof _primitives.Name ? rt.name : _util.AnnotationReplyType.REPLY;
  17667. }
  17668. if (this.data.replyType === _util.AnnotationReplyType.GROUP) {
  17669. const parent = dict.get("IRT");
  17670. this.setTitle(parent.get("T"));
  17671. this.data.titleObj = this._title;
  17672. this.setContents(parent.get("Contents"));
  17673. this.data.contentsObj = this._contents;
  17674. if (!parent.has("CreationDate")) {
  17675. this.data.creationDate = null;
  17676. } else {
  17677. this.setCreationDate(parent.get("CreationDate"));
  17678. this.data.creationDate = this.creationDate;
  17679. }
  17680. if (!parent.has("M")) {
  17681. this.data.modificationDate = null;
  17682. } else {
  17683. this.setModificationDate(parent.get("M"));
  17684. this.data.modificationDate = this.modificationDate;
  17685. }
  17686. this.data.hasPopup = parent.has("Popup");
  17687. if (!parent.has("C")) {
  17688. this.data.color = null;
  17689. } else {
  17690. this.setColor(parent.getArray("C"));
  17691. this.data.color = this.color;
  17692. }
  17693. } else {
  17694. this.data.titleObj = this._title;
  17695. this.setCreationDate(dict.get("CreationDate"));
  17696. this.data.creationDate = this.creationDate;
  17697. this.data.hasPopup = dict.has("Popup");
  17698. if (!dict.has("C")) {
  17699. this.data.color = null;
  17700. }
  17701. }
  17702. if (dict.has("RC")) {
  17703. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(dict.get("RC"));
  17704. }
  17705. }
  17706. setCreationDate(creationDate) {
  17707. this.creationDate = typeof creationDate === "string" ? creationDate : null;
  17708. }
  17709. _setDefaultAppearance({
  17710. xref,
  17711. extra,
  17712. strokeColor,
  17713. fillColor,
  17714. blendMode,
  17715. strokeAlpha,
  17716. fillAlpha,
  17717. pointsCallback
  17718. }) {
  17719. let minX = Number.MAX_VALUE;
  17720. let minY = Number.MAX_VALUE;
  17721. let maxX = Number.MIN_VALUE;
  17722. let maxY = Number.MIN_VALUE;
  17723. const buffer = ["q"];
  17724. if (extra) {
  17725. buffer.push(extra);
  17726. }
  17727. if (strokeColor) {
  17728. buffer.push(`${strokeColor[0]} ${strokeColor[1]} ${strokeColor[2]} RG`);
  17729. }
  17730. if (fillColor) {
  17731. buffer.push(`${fillColor[0]} ${fillColor[1]} ${fillColor[2]} rg`);
  17732. }
  17733. let pointsArray = this.data.quadPoints;
  17734. if (!pointsArray) {
  17735. pointsArray = [[{
  17736. x: this.rectangle[0],
  17737. y: this.rectangle[3]
  17738. }, {
  17739. x: this.rectangle[2],
  17740. y: this.rectangle[3]
  17741. }, {
  17742. x: this.rectangle[0],
  17743. y: this.rectangle[1]
  17744. }, {
  17745. x: this.rectangle[2],
  17746. y: this.rectangle[1]
  17747. }]];
  17748. }
  17749. for (const points of pointsArray) {
  17750. const [mX, MX, mY, MY] = pointsCallback(buffer, points);
  17751. minX = Math.min(minX, mX);
  17752. maxX = Math.max(maxX, MX);
  17753. minY = Math.min(minY, mY);
  17754. maxY = Math.max(maxY, MY);
  17755. }
  17756. buffer.push("Q");
  17757. const formDict = new _primitives.Dict(xref);
  17758. const appearanceStreamDict = new _primitives.Dict(xref);
  17759. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  17760. const appearanceStream = new _stream.StringStream(buffer.join(" "));
  17761. appearanceStream.dict = appearanceStreamDict;
  17762. formDict.set("Fm0", appearanceStream);
  17763. const gsDict = new _primitives.Dict(xref);
  17764. if (blendMode) {
  17765. gsDict.set("BM", _primitives.Name.get(blendMode));
  17766. }
  17767. if (typeof strokeAlpha === "number") {
  17768. gsDict.set("CA", strokeAlpha);
  17769. }
  17770. if (typeof fillAlpha === "number") {
  17771. gsDict.set("ca", fillAlpha);
  17772. }
  17773. const stateDict = new _primitives.Dict(xref);
  17774. stateDict.set("GS0", gsDict);
  17775. const resources = new _primitives.Dict(xref);
  17776. resources.set("ExtGState", stateDict);
  17777. resources.set("XObject", formDict);
  17778. const appearanceDict = new _primitives.Dict(xref);
  17779. appearanceDict.set("Resources", resources);
  17780. const bbox = this.data.rect = [minX, minY, maxX, maxY];
  17781. appearanceDict.set("BBox", bbox);
  17782. this.appearance = new _stream.StringStream("/GS0 gs /Fm0 Do");
  17783. this.appearance.dict = appearanceDict;
  17784. this._streams.push(this.appearance, appearanceStream);
  17785. }
  17786. }
  17787. exports.MarkupAnnotation = MarkupAnnotation;
  17788. class WidgetAnnotation extends Annotation {
  17789. constructor(params) {
  17790. super(params);
  17791. const dict = params.dict;
  17792. const data = this.data;
  17793. this.ref = params.ref;
  17794. data.annotationType = _util.AnnotationType.WIDGET;
  17795. if (data.fieldName === undefined) {
  17796. data.fieldName = this._constructFieldName(dict);
  17797. }
  17798. if (data.actions === undefined) {
  17799. data.actions = (0, _core_utils.collectActions)(params.xref, dict, _util.AnnotationActionEventType);
  17800. }
  17801. let fieldValue = (0, _core_utils.getInheritableProperty)({
  17802. dict,
  17803. key: "V",
  17804. getArray: true
  17805. });
  17806. data.fieldValue = this._decodeFormValue(fieldValue);
  17807. const defaultFieldValue = (0, _core_utils.getInheritableProperty)({
  17808. dict,
  17809. key: "DV",
  17810. getArray: true
  17811. });
  17812. data.defaultFieldValue = this._decodeFormValue(defaultFieldValue);
  17813. if (fieldValue === undefined && params.xfaDatasets) {
  17814. const path = this._title.str;
  17815. if (path) {
  17816. this._hasValueFromXFA = true;
  17817. data.fieldValue = fieldValue = params.xfaDatasets.getValue(path);
  17818. }
  17819. }
  17820. if (fieldValue === undefined && data.defaultFieldValue !== null) {
  17821. data.fieldValue = data.defaultFieldValue;
  17822. }
  17823. data.alternativeText = (0, _util.stringToPDFString)(dict.get("TU") || "");
  17824. const defaultAppearance = (0, _core_utils.getInheritableProperty)({
  17825. dict,
  17826. key: "DA"
  17827. }) || params.acroForm.get("DA");
  17828. this._defaultAppearance = typeof defaultAppearance === "string" ? defaultAppearance : "";
  17829. data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance);
  17830. const fieldType = (0, _core_utils.getInheritableProperty)({
  17831. dict,
  17832. key: "FT"
  17833. });
  17834. data.fieldType = fieldType instanceof _primitives.Name ? fieldType.name : null;
  17835. const localResources = (0, _core_utils.getInheritableProperty)({
  17836. dict,
  17837. key: "DR"
  17838. });
  17839. const acroFormResources = params.acroForm.get("DR");
  17840. const appearanceResources = this.appearance && this.appearance.dict.get("Resources");
  17841. this._fieldResources = {
  17842. localResources,
  17843. acroFormResources,
  17844. appearanceResources,
  17845. mergedResources: _primitives.Dict.merge({
  17846. xref: params.xref,
  17847. dictArray: [localResources, appearanceResources, acroFormResources],
  17848. mergeSubDicts: true
  17849. })
  17850. };
  17851. data.fieldFlags = (0, _core_utils.getInheritableProperty)({
  17852. dict,
  17853. key: "Ff"
  17854. });
  17855. if (!Number.isInteger(data.fieldFlags) || data.fieldFlags < 0) {
  17856. data.fieldFlags = 0;
  17857. }
  17858. data.readOnly = this.hasFieldFlag(_util.AnnotationFieldFlag.READONLY);
  17859. data.hidden = this._hasFlag(data.annotationFlags, _util.AnnotationFlag.HIDDEN);
  17860. }
  17861. _decodeFormValue(formValue) {
  17862. if (Array.isArray(formValue)) {
  17863. return formValue.filter(item => typeof item === "string").map(item => (0, _util.stringToPDFString)(item));
  17864. } else if (formValue instanceof _primitives.Name) {
  17865. return (0, _util.stringToPDFString)(formValue.name);
  17866. } else if (typeof formValue === "string") {
  17867. return (0, _util.stringToPDFString)(formValue);
  17868. }
  17869. return null;
  17870. }
  17871. hasFieldFlag(flag) {
  17872. return !!(this.data.fieldFlags & flag);
  17873. }
  17874. getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  17875. if (renderForms && !(this instanceof SignatureWidgetAnnotation)) {
  17876. return Promise.resolve(new _operator_list.OperatorList());
  17877. }
  17878. if (!this._hasText) {
  17879. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17880. }
  17881. return this._getAppearance(evaluator, task, annotationStorage).then(content => {
  17882. if (this.appearance && content === null) {
  17883. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  17884. }
  17885. const operatorList = new _operator_list.OperatorList();
  17886. if (!this._defaultAppearance || content === null) {
  17887. return operatorList;
  17888. }
  17889. const matrix = [1, 0, 0, 1, 0, 0];
  17890. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17891. const transform = getTransformMatrix(this.data.rect, bbox, matrix);
  17892. operatorList.addOp(_util.OPS.beginAnnotation, [this.data.id, this.data.rect, transform, matrix]);
  17893. const stream = new _stream.StringStream(content);
  17894. return evaluator.getOperatorList({
  17895. stream,
  17896. task,
  17897. resources: this._fieldResources.mergedResources,
  17898. operatorList
  17899. }).then(function () {
  17900. operatorList.addOp(_util.OPS.endAnnotation, []);
  17901. return operatorList;
  17902. });
  17903. });
  17904. }
  17905. async save(evaluator, task, annotationStorage) {
  17906. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  17907. let value = storageEntry && storageEntry.value;
  17908. if (value === this.data.fieldValue || value === undefined) {
  17909. if (!this._hasValueFromXFA) {
  17910. return null;
  17911. }
  17912. value = value || this.data.fieldValue;
  17913. }
  17914. if (!this._hasValueFromXFA && Array.isArray(value) && Array.isArray(this.data.fieldValue) && value.length === this.data.fieldValue.length && value.every((x, i) => x === this.data.fieldValue[i])) {
  17915. return null;
  17916. }
  17917. let appearance = await this._getAppearance(evaluator, task, annotationStorage);
  17918. if (appearance === null) {
  17919. return null;
  17920. }
  17921. const {
  17922. xref
  17923. } = evaluator;
  17924. const dict = xref.fetchIfRef(this.ref);
  17925. if (!(dict instanceof _primitives.Dict)) {
  17926. return null;
  17927. }
  17928. const bbox = [0, 0, this.data.rect[2] - this.data.rect[0], this.data.rect[3] - this.data.rect[1]];
  17929. const xfa = {
  17930. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  17931. value
  17932. };
  17933. const newRef = xref.getNewRef();
  17934. const AP = new _primitives.Dict(xref);
  17935. AP.set("N", newRef);
  17936. const encrypt = xref.encrypt;
  17937. let originalTransform = null;
  17938. let newTransform = null;
  17939. if (encrypt) {
  17940. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  17941. newTransform = encrypt.createCipherTransform(newRef.num, newRef.gen);
  17942. appearance = newTransform.encryptString(appearance);
  17943. }
  17944. const encoder = val => (0, _util.isAscii)(val) ? val : (0, _util.stringToUTF16BEString)(val);
  17945. dict.set("V", Array.isArray(value) ? value.map(encoder) : encoder(value));
  17946. dict.set("AP", AP);
  17947. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  17948. const appearanceDict = new _primitives.Dict(xref);
  17949. appearanceDict.set("Length", appearance.length);
  17950. appearanceDict.set("Subtype", _primitives.Name.get("Form"));
  17951. appearanceDict.set("Resources", this._getSaveFieldResources(xref));
  17952. appearanceDict.set("BBox", bbox);
  17953. const bufferOriginal = [`${this.ref.num} ${this.ref.gen} obj\n`];
  17954. (0, _writer.writeDict)(dict, bufferOriginal, originalTransform);
  17955. bufferOriginal.push("\nendobj\n");
  17956. const bufferNew = [`${newRef.num} ${newRef.gen} obj\n`];
  17957. (0, _writer.writeDict)(appearanceDict, bufferNew, newTransform);
  17958. bufferNew.push(" stream\n", appearance, "\nendstream\nendobj\n");
  17959. return [{
  17960. ref: this.ref,
  17961. data: bufferOriginal.join(""),
  17962. xfa
  17963. }, {
  17964. ref: newRef,
  17965. data: bufferNew.join(""),
  17966. xfa: null
  17967. }];
  17968. }
  17969. async _getAppearance(evaluator, task, annotationStorage) {
  17970. const isPassword = this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD);
  17971. if (isPassword) {
  17972. return null;
  17973. }
  17974. const storageEntry = annotationStorage ? annotationStorage.get(this.data.id) : undefined;
  17975. let value = storageEntry && (storageEntry.formattedValue || storageEntry.value);
  17976. if (value === undefined) {
  17977. if (!this._hasValueFromXFA || this.appearance) {
  17978. return null;
  17979. }
  17980. value = this.data.fieldValue;
  17981. if (!value) {
  17982. return "";
  17983. }
  17984. }
  17985. (0, _util.assert)(typeof value === "string", "Expected `value` to be a string.");
  17986. value = value.trim();
  17987. if (value === "") {
  17988. return "";
  17989. }
  17990. let lineCount = -1;
  17991. if (this.data.multiLine) {
  17992. lineCount = value.split(/\r\n|\r|\n/).length;
  17993. }
  17994. const defaultPadding = 2;
  17995. const hPadding = defaultPadding;
  17996. const totalHeight = this.data.rect[3] - this.data.rect[1];
  17997. const totalWidth = this.data.rect[2] - this.data.rect[0];
  17998. if (!this._defaultAppearance) {
  17999. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  18000. }
  18001. const font = await this._getFontData(evaluator, task);
  18002. const [defaultAppearance, fontSize] = this._computeFontSize(totalHeight - defaultPadding, totalWidth - 2 * hPadding, value, font, lineCount);
  18003. let descent = font.descent;
  18004. if (isNaN(descent)) {
  18005. descent = 0;
  18006. }
  18007. const vPadding = defaultPadding + Math.abs(descent) * fontSize;
  18008. const alignment = this.data.textAlignment;
  18009. if (this.data.multiLine) {
  18010. return this._getMultilineAppearance(defaultAppearance, value, font, fontSize, totalWidth, totalHeight, alignment, hPadding, vPadding);
  18011. }
  18012. const encodedString = font.encodeString(value).join("");
  18013. if (this.data.comb) {
  18014. return this._getCombAppearance(defaultAppearance, font, encodedString, totalWidth, hPadding, vPadding);
  18015. }
  18016. if (alignment === 0 || alignment > 2) {
  18017. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm (${(0, _util.escapeString)(encodedString)}) Tj` + " ET Q EMC";
  18018. }
  18019. const renderedText = this._renderText(encodedString, font, fontSize, totalWidth, alignment, hPadding, vPadding);
  18020. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 0 Tm ${renderedText}` + " ET Q EMC";
  18021. }
  18022. async _getFontData(evaluator, task) {
  18023. const operatorList = new _operator_list.OperatorList();
  18024. const initialState = {
  18025. font: null,
  18026. clone() {
  18027. return this;
  18028. }
  18029. };
  18030. const {
  18031. fontName,
  18032. fontSize
  18033. } = this.data.defaultAppearanceData;
  18034. await evaluator.handleSetFont(this._fieldResources.mergedResources, [fontName && _primitives.Name.get(fontName), fontSize], null, operatorList, task, initialState, null);
  18035. return initialState.font;
  18036. }
  18037. _getTextWidth(text, font) {
  18038. return font.charsToGlyphs(text).reduce((width, glyph) => width + glyph.width, 0) / 1000;
  18039. }
  18040. _computeFontSize(height, width, text, font, lineCount) {
  18041. let {
  18042. fontSize
  18043. } = this.data.defaultAppearanceData;
  18044. if (!fontSize) {
  18045. const roundWithTwoDigits = x => Math.floor(x * 100) / 100;
  18046. if (lineCount === -1) {
  18047. const textWidth = this._getTextWidth(text, font);
  18048. fontSize = roundWithTwoDigits(Math.min(height / LINE_FACTOR, width / textWidth));
  18049. } else {
  18050. const lines = text.split(/\r\n?|\n/);
  18051. const cachedLines = [];
  18052. for (const line of lines) {
  18053. const encoded = font.encodeString(line).join("");
  18054. const glyphs = font.charsToGlyphs(encoded);
  18055. const positions = font.getCharPositions(encoded);
  18056. cachedLines.push({
  18057. line: encoded,
  18058. glyphs,
  18059. positions
  18060. });
  18061. }
  18062. const isTooBig = fsize => {
  18063. let totalHeight = 0;
  18064. for (const cache of cachedLines) {
  18065. const chunks = this._splitLine(null, font, fsize, width, cache);
  18066. totalHeight += chunks.length * fsize;
  18067. if (totalHeight > height) {
  18068. return true;
  18069. }
  18070. }
  18071. return false;
  18072. };
  18073. fontSize = 12;
  18074. let lineHeight = fontSize * LINE_FACTOR;
  18075. let numberOfLines = Math.round(height / lineHeight);
  18076. numberOfLines = Math.max(numberOfLines, lineCount);
  18077. while (true) {
  18078. lineHeight = height / numberOfLines;
  18079. fontSize = roundWithTwoDigits(lineHeight / LINE_FACTOR);
  18080. if (isTooBig(fontSize)) {
  18081. numberOfLines++;
  18082. continue;
  18083. }
  18084. break;
  18085. }
  18086. }
  18087. const {
  18088. fontName,
  18089. fontColor
  18090. } = this.data.defaultAppearanceData;
  18091. this._defaultAppearance = (0, _default_appearance.createDefaultAppearance)({
  18092. fontSize,
  18093. fontName,
  18094. fontColor
  18095. });
  18096. }
  18097. return [this._defaultAppearance, fontSize];
  18098. }
  18099. _renderText(text, font, fontSize, totalWidth, alignment, hPadding, vPadding) {
  18100. let shift;
  18101. if (alignment === 1) {
  18102. const width = this._getTextWidth(text, font) * fontSize;
  18103. shift = (totalWidth - width) / 2;
  18104. } else if (alignment === 2) {
  18105. const width = this._getTextWidth(text, font) * fontSize;
  18106. shift = totalWidth - width - hPadding;
  18107. } else {
  18108. shift = hPadding;
  18109. }
  18110. shift = shift.toFixed(2);
  18111. vPadding = vPadding.toFixed(2);
  18112. return `${shift} ${vPadding} Td (${(0, _util.escapeString)(text)}) Tj`;
  18113. }
  18114. _getSaveFieldResources(xref) {
  18115. const {
  18116. localResources,
  18117. appearanceResources,
  18118. acroFormResources
  18119. } = this._fieldResources;
  18120. const fontName = this.data.defaultAppearanceData && this.data.defaultAppearanceData.fontName;
  18121. if (!fontName) {
  18122. return localResources || _primitives.Dict.empty;
  18123. }
  18124. for (const resources of [localResources, appearanceResources]) {
  18125. if (resources instanceof _primitives.Dict) {
  18126. const localFont = resources.get("Font");
  18127. if (localFont instanceof _primitives.Dict && localFont.has(fontName)) {
  18128. return resources;
  18129. }
  18130. }
  18131. }
  18132. if (acroFormResources instanceof _primitives.Dict) {
  18133. const acroFormFont = acroFormResources.get("Font");
  18134. if (acroFormFont instanceof _primitives.Dict && acroFormFont.has(fontName)) {
  18135. const subFontDict = new _primitives.Dict(xref);
  18136. subFontDict.set(fontName, acroFormFont.getRaw(fontName));
  18137. const subResourcesDict = new _primitives.Dict(xref);
  18138. subResourcesDict.set("Font", subFontDict);
  18139. return _primitives.Dict.merge({
  18140. xref,
  18141. dictArray: [subResourcesDict, localResources],
  18142. mergeSubDicts: true
  18143. });
  18144. }
  18145. }
  18146. return localResources || _primitives.Dict.empty;
  18147. }
  18148. getFieldObject() {
  18149. return null;
  18150. }
  18151. }
  18152. class TextWidgetAnnotation extends WidgetAnnotation {
  18153. constructor(params) {
  18154. super(params);
  18155. this._hasText = true;
  18156. const dict = params.dict;
  18157. if (typeof this.data.fieldValue !== "string") {
  18158. this.data.fieldValue = "";
  18159. }
  18160. let alignment = (0, _core_utils.getInheritableProperty)({
  18161. dict,
  18162. key: "Q"
  18163. });
  18164. if (!Number.isInteger(alignment) || alignment < 0 || alignment > 2) {
  18165. alignment = null;
  18166. }
  18167. this.data.textAlignment = alignment;
  18168. let maximumLength = (0, _core_utils.getInheritableProperty)({
  18169. dict,
  18170. key: "MaxLen"
  18171. });
  18172. if (!Number.isInteger(maximumLength) || maximumLength < 0) {
  18173. maximumLength = null;
  18174. }
  18175. this.data.maxLen = maximumLength;
  18176. this.data.multiLine = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE);
  18177. this.data.comb = this.hasFieldFlag(_util.AnnotationFieldFlag.COMB) && !this.hasFieldFlag(_util.AnnotationFieldFlag.MULTILINE) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD) && !this.hasFieldFlag(_util.AnnotationFieldFlag.FILESELECT) && this.data.maxLen !== null;
  18178. }
  18179. _getCombAppearance(defaultAppearance, font, text, width, hPadding, vPadding) {
  18180. const combWidth = (width / this.data.maxLen).toFixed(2);
  18181. const buf = [];
  18182. const positions = font.getCharPositions(text);
  18183. for (const [start, end] of positions) {
  18184. buf.push(`(${(0, _util.escapeString)(text.substring(start, end))}) Tj`);
  18185. }
  18186. const renderedComb = buf.join(` ${combWidth} 0 Td `);
  18187. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 ${hPadding} ${vPadding} Tm ${renderedComb}` + " ET Q EMC";
  18188. }
  18189. _getMultilineAppearance(defaultAppearance, text, font, fontSize, width, height, alignment, hPadding, vPadding) {
  18190. const lines = text.split(/\r\n?|\n/);
  18191. const buf = [];
  18192. const totalWidth = width - 2 * hPadding;
  18193. for (const line of lines) {
  18194. const chunks = this._splitLine(line, font, fontSize, totalWidth);
  18195. for (const chunk of chunks) {
  18196. const padding = buf.length === 0 ? hPadding : 0;
  18197. buf.push(this._renderText(chunk, font, fontSize, width, alignment, padding, -fontSize));
  18198. }
  18199. }
  18200. const renderedText = buf.join("\n");
  18201. return "/Tx BMC q BT " + defaultAppearance + ` 1 0 0 1 0 ${height} Tm ${renderedText}` + " ET Q EMC";
  18202. }
  18203. _splitLine(line, font, fontSize, width, cache = {}) {
  18204. line = cache.line || font.encodeString(line).join("");
  18205. const glyphs = cache.glyphs || font.charsToGlyphs(line);
  18206. if (glyphs.length <= 1) {
  18207. return [line];
  18208. }
  18209. const positions = cache.positions || font.getCharPositions(line);
  18210. const scale = fontSize / 1000;
  18211. const chunks = [];
  18212. let lastSpacePosInStringStart = -1,
  18213. lastSpacePosInStringEnd = -1,
  18214. lastSpacePos = -1,
  18215. startChunk = 0,
  18216. currentWidth = 0;
  18217. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  18218. const [start, end] = positions[i];
  18219. const glyph = glyphs[i];
  18220. const glyphWidth = glyph.width * scale;
  18221. if (glyph.unicode === " ") {
  18222. if (currentWidth + glyphWidth > width) {
  18223. chunks.push(line.substring(startChunk, start));
  18224. startChunk = start;
  18225. currentWidth = glyphWidth;
  18226. lastSpacePosInStringStart = -1;
  18227. lastSpacePos = -1;
  18228. } else {
  18229. currentWidth += glyphWidth;
  18230. lastSpacePosInStringStart = start;
  18231. lastSpacePosInStringEnd = end;
  18232. lastSpacePos = i;
  18233. }
  18234. } else {
  18235. if (currentWidth + glyphWidth > width) {
  18236. if (lastSpacePosInStringStart !== -1) {
  18237. chunks.push(line.substring(startChunk, lastSpacePosInStringEnd));
  18238. startChunk = lastSpacePosInStringEnd;
  18239. i = lastSpacePos + 1;
  18240. lastSpacePosInStringStart = -1;
  18241. currentWidth = 0;
  18242. } else {
  18243. chunks.push(line.substring(startChunk, start));
  18244. startChunk = start;
  18245. currentWidth = glyphWidth;
  18246. }
  18247. } else {
  18248. currentWidth += glyphWidth;
  18249. }
  18250. }
  18251. }
  18252. if (startChunk < line.length) {
  18253. chunks.push(line.substring(startChunk, line.length));
  18254. }
  18255. return chunks;
  18256. }
  18257. getFieldObject() {
  18258. return {
  18259. id: this.data.id,
  18260. value: this.data.fieldValue,
  18261. defaultValue: this.data.defaultFieldValue || "",
  18262. multiline: this.data.multiLine,
  18263. password: this.hasFieldFlag(_util.AnnotationFieldFlag.PASSWORD),
  18264. charLimit: this.data.maxLen,
  18265. comb: this.data.comb,
  18266. editable: !this.data.readOnly,
  18267. hidden: this.data.hidden,
  18268. name: this.data.fieldName,
  18269. rect: this.data.rect,
  18270. actions: this.data.actions,
  18271. page: this.data.pageIndex,
  18272. strokeColor: this.data.borderColor,
  18273. fillColor: this.data.backgroundColor,
  18274. type: "text"
  18275. };
  18276. }
  18277. }
  18278. class ButtonWidgetAnnotation extends WidgetAnnotation {
  18279. constructor(params) {
  18280. super(params);
  18281. this.checkedAppearance = null;
  18282. this.uncheckedAppearance = null;
  18283. this.data.checkBox = !this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18284. this.data.radioButton = this.hasFieldFlag(_util.AnnotationFieldFlag.RADIO) && !this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18285. this.data.pushButton = this.hasFieldFlag(_util.AnnotationFieldFlag.PUSHBUTTON);
  18286. this.data.isTooltipOnly = false;
  18287. if (this.data.checkBox) {
  18288. this._processCheckBox(params);
  18289. } else if (this.data.radioButton) {
  18290. this._processRadioButton(params);
  18291. } else if (this.data.pushButton) {
  18292. this.data.hasOwnCanvas = true;
  18293. this._processPushButton(params);
  18294. } else {
  18295. (0, _util.warn)("Invalid field flags for button widget annotation");
  18296. }
  18297. }
  18298. async getOperatorList(evaluator, task, intent, renderForms, annotationStorage) {
  18299. if (this.data.pushButton) {
  18300. return super.getOperatorList(evaluator, task, intent, false, annotationStorage);
  18301. }
  18302. let value = null;
  18303. if (annotationStorage) {
  18304. const storageEntry = annotationStorage.get(this.data.id);
  18305. value = storageEntry ? storageEntry.value : null;
  18306. }
  18307. if (value === null) {
  18308. if (this.appearance) {
  18309. return super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18310. }
  18311. if (this.data.checkBox) {
  18312. value = this.data.fieldValue === this.data.exportValue;
  18313. } else {
  18314. value = this.data.fieldValue === this.data.buttonValue;
  18315. }
  18316. }
  18317. const appearance = value ? this.checkedAppearance : this.uncheckedAppearance;
  18318. if (appearance) {
  18319. const savedAppearance = this.appearance;
  18320. this.appearance = appearance;
  18321. const operatorList = super.getOperatorList(evaluator, task, intent, renderForms, annotationStorage);
  18322. this.appearance = savedAppearance;
  18323. return operatorList;
  18324. }
  18325. return new _operator_list.OperatorList();
  18326. }
  18327. async save(evaluator, task, annotationStorage) {
  18328. if (this.data.checkBox) {
  18329. return this._saveCheckbox(evaluator, task, annotationStorage);
  18330. }
  18331. if (this.data.radioButton) {
  18332. return this._saveRadioButton(evaluator, task, annotationStorage);
  18333. }
  18334. return null;
  18335. }
  18336. async _saveCheckbox(evaluator, task, annotationStorage) {
  18337. if (!annotationStorage) {
  18338. return null;
  18339. }
  18340. const storageEntry = annotationStorage.get(this.data.id);
  18341. const value = storageEntry && storageEntry.value;
  18342. if (value === undefined) {
  18343. return null;
  18344. }
  18345. const defaultValue = this.data.fieldValue === this.data.exportValue;
  18346. if (defaultValue === value) {
  18347. return null;
  18348. }
  18349. const dict = evaluator.xref.fetchIfRef(this.ref);
  18350. if (!(dict instanceof _primitives.Dict)) {
  18351. return null;
  18352. }
  18353. const xfa = {
  18354. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18355. value: value ? this.data.exportValue : ""
  18356. };
  18357. const name = _primitives.Name.get(value ? this.data.exportValue : "Off");
  18358. dict.set("V", name);
  18359. dict.set("AS", name);
  18360. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18361. const encrypt = evaluator.xref.encrypt;
  18362. let originalTransform = null;
  18363. if (encrypt) {
  18364. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18365. }
  18366. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18367. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18368. buffer.push("\nendobj\n");
  18369. return [{
  18370. ref: this.ref,
  18371. data: buffer.join(""),
  18372. xfa
  18373. }];
  18374. }
  18375. async _saveRadioButton(evaluator, task, annotationStorage) {
  18376. if (!annotationStorage) {
  18377. return null;
  18378. }
  18379. const storageEntry = annotationStorage.get(this.data.id);
  18380. const value = storageEntry && storageEntry.value;
  18381. if (value === undefined) {
  18382. return null;
  18383. }
  18384. const defaultValue = this.data.fieldValue === this.data.buttonValue;
  18385. if (defaultValue === value) {
  18386. return null;
  18387. }
  18388. const dict = evaluator.xref.fetchIfRef(this.ref);
  18389. if (!(dict instanceof _primitives.Dict)) {
  18390. return null;
  18391. }
  18392. const xfa = {
  18393. path: (0, _util.stringToPDFString)(dict.get("T") || ""),
  18394. value: value ? this.data.buttonValue : ""
  18395. };
  18396. const name = _primitives.Name.get(value ? this.data.buttonValue : "Off");
  18397. let parentBuffer = null;
  18398. const encrypt = evaluator.xref.encrypt;
  18399. if (value) {
  18400. if (this.parent instanceof _primitives.Ref) {
  18401. const parent = evaluator.xref.fetch(this.parent);
  18402. let parentTransform = null;
  18403. if (encrypt) {
  18404. parentTransform = encrypt.createCipherTransform(this.parent.num, this.parent.gen);
  18405. }
  18406. parent.set("V", name);
  18407. parentBuffer = [`${this.parent.num} ${this.parent.gen} obj\n`];
  18408. (0, _writer.writeDict)(parent, parentBuffer, parentTransform);
  18409. parentBuffer.push("\nendobj\n");
  18410. } else if (this.parent instanceof _primitives.Dict) {
  18411. this.parent.set("V", name);
  18412. }
  18413. }
  18414. dict.set("AS", name);
  18415. dict.set("M", `D:${(0, _util.getModificationDate)()}`);
  18416. let originalTransform = null;
  18417. if (encrypt) {
  18418. originalTransform = encrypt.createCipherTransform(this.ref.num, this.ref.gen);
  18419. }
  18420. const buffer = [`${this.ref.num} ${this.ref.gen} obj\n`];
  18421. (0, _writer.writeDict)(dict, buffer, originalTransform);
  18422. buffer.push("\nendobj\n");
  18423. const newRefs = [{
  18424. ref: this.ref,
  18425. data: buffer.join(""),
  18426. xfa
  18427. }];
  18428. if (parentBuffer !== null) {
  18429. newRefs.push({
  18430. ref: this.parent,
  18431. data: parentBuffer.join(""),
  18432. xfa: null
  18433. });
  18434. }
  18435. return newRefs;
  18436. }
  18437. _getDefaultCheckedAppearance(params, type) {
  18438. const width = this.data.rect[2] - this.data.rect[0];
  18439. const height = this.data.rect[3] - this.data.rect[1];
  18440. const bbox = [0, 0, width, height];
  18441. const FONT_RATIO = 0.8;
  18442. const fontSize = Math.min(width, height) * FONT_RATIO;
  18443. let metrics, char;
  18444. if (type === "check") {
  18445. metrics = {
  18446. width: 0.755 * fontSize,
  18447. height: 0.705 * fontSize
  18448. };
  18449. char = "\x33";
  18450. } else if (type === "disc") {
  18451. metrics = {
  18452. width: 0.791 * fontSize,
  18453. height: 0.705 * fontSize
  18454. };
  18455. char = "\x6C";
  18456. } else {
  18457. (0, _util.unreachable)(`_getDefaultCheckedAppearance - unsupported type: ${type}`);
  18458. }
  18459. const xShift = (width - metrics.width) / 2;
  18460. const yShift = (height - metrics.height) / 2;
  18461. const appearance = `q BT /PdfJsZaDb ${fontSize} Tf 0 g ${xShift} ${yShift} Td (${char}) Tj ET Q`;
  18462. const appearanceStreamDict = new _primitives.Dict(params.xref);
  18463. appearanceStreamDict.set("FormType", 1);
  18464. appearanceStreamDict.set("Subtype", _primitives.Name.get("Form"));
  18465. appearanceStreamDict.set("Type", _primitives.Name.get("XObject"));
  18466. appearanceStreamDict.set("BBox", bbox);
  18467. appearanceStreamDict.set("Matrix", [1, 0, 0, 1, 0, 0]);
  18468. appearanceStreamDict.set("Length", appearance.length);
  18469. const resources = new _primitives.Dict(params.xref);
  18470. const font = new _primitives.Dict(params.xref);
  18471. font.set("PdfJsZaDb", this.fallbackFontDict);
  18472. resources.set("Font", font);
  18473. appearanceStreamDict.set("Resources", resources);
  18474. this.checkedAppearance = new _stream.StringStream(appearance);
  18475. this.checkedAppearance.dict = appearanceStreamDict;
  18476. this._streams.push(this.checkedAppearance);
  18477. }
  18478. _processCheckBox(params) {
  18479. const customAppearance = params.dict.get("AP");
  18480. if (!(customAppearance instanceof _primitives.Dict)) {
  18481. return;
  18482. }
  18483. const normalAppearance = customAppearance.get("N");
  18484. if (!(normalAppearance instanceof _primitives.Dict)) {
  18485. return;
  18486. }
  18487. const asValue = this._decodeFormValue(params.dict.get("AS"));
  18488. if (typeof asValue === "string") {
  18489. this.data.fieldValue = asValue;
  18490. }
  18491. const yes = this.data.fieldValue !== null && this.data.fieldValue !== "Off" ? this.data.fieldValue : "Yes";
  18492. const exportValues = normalAppearance.getKeys();
  18493. if (exportValues.length === 0) {
  18494. exportValues.push("Off", yes);
  18495. } else if (exportValues.length === 1) {
  18496. if (exportValues[0] === "Off") {
  18497. exportValues.push(yes);
  18498. } else {
  18499. exportValues.unshift("Off");
  18500. }
  18501. } else if (exportValues.includes(yes)) {
  18502. exportValues.length = 0;
  18503. exportValues.push("Off", yes);
  18504. } else {
  18505. const otherYes = exportValues.find(v => v !== "Off");
  18506. exportValues.length = 0;
  18507. exportValues.push("Off", otherYes);
  18508. }
  18509. if (!exportValues.includes(this.data.fieldValue)) {
  18510. this.data.fieldValue = "Off";
  18511. }
  18512. this.data.exportValue = exportValues[1];
  18513. this.checkedAppearance = normalAppearance.get(this.data.exportValue) || null;
  18514. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18515. if (this.checkedAppearance) {
  18516. this._streams.push(this.checkedAppearance);
  18517. } else {
  18518. this._getDefaultCheckedAppearance(params, "check");
  18519. }
  18520. if (this.uncheckedAppearance) {
  18521. this._streams.push(this.uncheckedAppearance);
  18522. }
  18523. this._fallbackFontDict = this.fallbackFontDict;
  18524. }
  18525. _processRadioButton(params) {
  18526. this.data.fieldValue = this.data.buttonValue = null;
  18527. const fieldParent = params.dict.get("Parent");
  18528. if (fieldParent instanceof _primitives.Dict) {
  18529. this.parent = params.dict.getRaw("Parent");
  18530. const fieldParentValue = fieldParent.get("V");
  18531. if (fieldParentValue instanceof _primitives.Name) {
  18532. this.data.fieldValue = this._decodeFormValue(fieldParentValue);
  18533. }
  18534. }
  18535. const appearanceStates = params.dict.get("AP");
  18536. if (!(appearanceStates instanceof _primitives.Dict)) {
  18537. return;
  18538. }
  18539. const normalAppearance = appearanceStates.get("N");
  18540. if (!(normalAppearance instanceof _primitives.Dict)) {
  18541. return;
  18542. }
  18543. for (const key of normalAppearance.getKeys()) {
  18544. if (key !== "Off") {
  18545. this.data.buttonValue = this._decodeFormValue(key);
  18546. break;
  18547. }
  18548. }
  18549. this.checkedAppearance = normalAppearance.get(this.data.buttonValue) || null;
  18550. this.uncheckedAppearance = normalAppearance.get("Off") || null;
  18551. if (this.checkedAppearance) {
  18552. this._streams.push(this.checkedAppearance);
  18553. } else {
  18554. this._getDefaultCheckedAppearance(params, "disc");
  18555. }
  18556. if (this.uncheckedAppearance) {
  18557. this._streams.push(this.uncheckedAppearance);
  18558. }
  18559. this._fallbackFontDict = this.fallbackFontDict;
  18560. }
  18561. _processPushButton(params) {
  18562. if (!params.dict.has("A") && !params.dict.has("AA") && !this.data.alternativeText) {
  18563. (0, _util.warn)("Push buttons without action dictionaries are not supported");
  18564. return;
  18565. }
  18566. this.data.isTooltipOnly = !params.dict.has("A") && !params.dict.has("AA");
  18567. _catalog.Catalog.parseDestDictionary({
  18568. destDict: params.dict,
  18569. resultObj: this.data,
  18570. docBaseUrl: params.pdfManager.docBaseUrl
  18571. });
  18572. }
  18573. getFieldObject() {
  18574. let type = "button";
  18575. let exportValues;
  18576. if (this.data.checkBox) {
  18577. type = "checkbox";
  18578. exportValues = this.data.exportValue;
  18579. } else if (this.data.radioButton) {
  18580. type = "radiobutton";
  18581. exportValues = this.data.buttonValue;
  18582. }
  18583. return {
  18584. id: this.data.id,
  18585. value: this.data.fieldValue || "Off",
  18586. defaultValue: this.data.defaultFieldValue,
  18587. exportValues,
  18588. editable: !this.data.readOnly,
  18589. name: this.data.fieldName,
  18590. rect: this.data.rect,
  18591. hidden: this.data.hidden,
  18592. actions: this.data.actions,
  18593. page: this.data.pageIndex,
  18594. strokeColor: this.data.borderColor,
  18595. fillColor: this.data.backgroundColor,
  18596. type
  18597. };
  18598. }
  18599. get fallbackFontDict() {
  18600. const dict = new _primitives.Dict();
  18601. dict.set("BaseFont", _primitives.Name.get("ZapfDingbats"));
  18602. dict.set("Type", _primitives.Name.get("FallbackType"));
  18603. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  18604. dict.set("Encoding", _primitives.Name.get("ZapfDingbatsEncoding"));
  18605. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  18606. }
  18607. }
  18608. class ChoiceWidgetAnnotation extends WidgetAnnotation {
  18609. constructor(params) {
  18610. super(params);
  18611. this.data.options = [];
  18612. const options = (0, _core_utils.getInheritableProperty)({
  18613. dict: params.dict,
  18614. key: "Opt"
  18615. });
  18616. if (Array.isArray(options)) {
  18617. const xref = params.xref;
  18618. for (let i = 0, ii = options.length; i < ii; i++) {
  18619. const option = xref.fetchIfRef(options[i]);
  18620. const isOptionArray = Array.isArray(option);
  18621. this.data.options[i] = {
  18622. exportValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[0]) : option),
  18623. displayValue: this._decodeFormValue(isOptionArray ? xref.fetchIfRef(option[1]) : option)
  18624. };
  18625. }
  18626. }
  18627. if (typeof this.data.fieldValue === "string") {
  18628. this.data.fieldValue = [this.data.fieldValue];
  18629. } else if (!this.data.fieldValue) {
  18630. this.data.fieldValue = [];
  18631. }
  18632. this.data.combo = this.hasFieldFlag(_util.AnnotationFieldFlag.COMBO);
  18633. this.data.multiSelect = this.hasFieldFlag(_util.AnnotationFieldFlag.MULTISELECT);
  18634. this._hasText = true;
  18635. }
  18636. getFieldObject() {
  18637. const type = this.data.combo ? "combobox" : "listbox";
  18638. const value = this.data.fieldValue.length > 0 ? this.data.fieldValue[0] : null;
  18639. return {
  18640. id: this.data.id,
  18641. value,
  18642. defaultValue: this.data.defaultFieldValue,
  18643. editable: !this.data.readOnly,
  18644. name: this.data.fieldName,
  18645. rect: this.data.rect,
  18646. numItems: this.data.fieldValue.length,
  18647. multipleSelection: this.data.multiSelect,
  18648. hidden: this.data.hidden,
  18649. actions: this.data.actions,
  18650. items: this.data.options,
  18651. page: this.data.pageIndex,
  18652. strokeColor: this.data.borderColor,
  18653. fillColor: this.data.backgroundColor,
  18654. type
  18655. };
  18656. }
  18657. async _getAppearance(evaluator, task, annotationStorage) {
  18658. if (this.data.combo) {
  18659. return super._getAppearance(evaluator, task, annotationStorage);
  18660. }
  18661. if (!annotationStorage) {
  18662. return null;
  18663. }
  18664. const storageEntry = annotationStorage.get(this.data.id);
  18665. let exportedValue = storageEntry && storageEntry.value;
  18666. if (exportedValue === undefined) {
  18667. return null;
  18668. }
  18669. if (!Array.isArray(exportedValue)) {
  18670. exportedValue = [exportedValue];
  18671. }
  18672. const defaultPadding = 2;
  18673. const hPadding = defaultPadding;
  18674. const totalHeight = this.data.rect[3] - this.data.rect[1];
  18675. const totalWidth = this.data.rect[2] - this.data.rect[0];
  18676. const lineCount = this.data.options.length;
  18677. const valueIndices = [];
  18678. for (let i = 0; i < lineCount; i++) {
  18679. const {
  18680. exportValue
  18681. } = this.data.options[i];
  18682. if (exportedValue.includes(exportValue)) {
  18683. valueIndices.push(i);
  18684. }
  18685. }
  18686. if (!this._defaultAppearance) {
  18687. this.data.defaultAppearanceData = (0, _default_appearance.parseDefaultAppearance)(this._defaultAppearance = "/Helvetica 0 Tf 0 g");
  18688. }
  18689. const font = await this._getFontData(evaluator, task);
  18690. let defaultAppearance;
  18691. let {
  18692. fontSize
  18693. } = this.data.defaultAppearanceData;
  18694. if (!fontSize) {
  18695. const lineHeight = (totalHeight - defaultPadding) / lineCount;
  18696. let lineWidth = -1;
  18697. let value;
  18698. for (const {
  18699. displayValue
  18700. } of this.data.options) {
  18701. const width = this._getTextWidth(displayValue);
  18702. if (width > lineWidth) {
  18703. lineWidth = width;
  18704. value = displayValue;
  18705. }
  18706. }
  18707. [defaultAppearance, fontSize] = this._computeFontSize(lineHeight, totalWidth - 2 * hPadding, value, font, -1);
  18708. } else {
  18709. defaultAppearance = this._defaultAppearance;
  18710. }
  18711. const lineHeight = fontSize * LINE_FACTOR;
  18712. const vPadding = (lineHeight - fontSize) / 2;
  18713. const numberOfVisibleLines = Math.floor(totalHeight / lineHeight);
  18714. let firstIndex;
  18715. if (valueIndices.length === 1) {
  18716. const valuePosition = valueIndices[0];
  18717. const indexInPage = valuePosition % numberOfVisibleLines;
  18718. firstIndex = valuePosition - indexInPage;
  18719. } else {
  18720. firstIndex = valueIndices.length ? valueIndices[0] : 0;
  18721. }
  18722. const end = Math.min(firstIndex + numberOfVisibleLines + 1, lineCount);
  18723. const buf = ["/Tx BMC q", `1 1 ${totalWidth} ${totalHeight} re W n`];
  18724. if (valueIndices.length) {
  18725. buf.push("0.600006 0.756866 0.854904 rg");
  18726. for (const index of valueIndices) {
  18727. if (firstIndex <= index && index < end) {
  18728. buf.push(`1 ${totalHeight - (index - firstIndex + 1) * lineHeight} ${totalWidth} ${lineHeight} re f`);
  18729. }
  18730. }
  18731. }
  18732. buf.push("BT", defaultAppearance, `1 0 0 1 0 ${totalHeight} Tm`);
  18733. for (let i = firstIndex; i < end; i++) {
  18734. const {
  18735. displayValue
  18736. } = this.data.options[i];
  18737. const hpadding = i === firstIndex ? hPadding : 0;
  18738. const vpadding = i === firstIndex ? vPadding : 0;
  18739. buf.push(this._renderText(displayValue, font, fontSize, totalWidth, 0, hpadding, -lineHeight + vpadding));
  18740. }
  18741. buf.push("ET Q EMC");
  18742. return buf.join("\n");
  18743. }
  18744. }
  18745. class SignatureWidgetAnnotation extends WidgetAnnotation {
  18746. constructor(params) {
  18747. super(params);
  18748. this.data.fieldValue = null;
  18749. }
  18750. getFieldObject() {
  18751. return {
  18752. id: this.data.id,
  18753. value: null,
  18754. page: this.data.pageIndex,
  18755. type: "signature"
  18756. };
  18757. }
  18758. }
  18759. class TextAnnotation extends MarkupAnnotation {
  18760. constructor(parameters) {
  18761. const DEFAULT_ICON_SIZE = 22;
  18762. super(parameters);
  18763. const dict = parameters.dict;
  18764. this.data.annotationType = _util.AnnotationType.TEXT;
  18765. if (this.data.hasAppearance) {
  18766. this.data.name = "NoIcon";
  18767. } else {
  18768. this.data.rect[1] = this.data.rect[3] - DEFAULT_ICON_SIZE;
  18769. this.data.rect[2] = this.data.rect[0] + DEFAULT_ICON_SIZE;
  18770. this.data.name = dict.has("Name") ? dict.get("Name").name : "Note";
  18771. }
  18772. if (dict.has("State")) {
  18773. this.data.state = dict.get("State") || null;
  18774. this.data.stateModel = dict.get("StateModel") || null;
  18775. } else {
  18776. this.data.state = null;
  18777. this.data.stateModel = null;
  18778. }
  18779. }
  18780. }
  18781. class LinkAnnotation extends Annotation {
  18782. constructor(params) {
  18783. super(params);
  18784. this.data.annotationType = _util.AnnotationType.LINK;
  18785. const quadPoints = getQuadPoints(params.dict, this.rectangle);
  18786. if (quadPoints) {
  18787. this.data.quadPoints = quadPoints;
  18788. }
  18789. _catalog.Catalog.parseDestDictionary({
  18790. destDict: params.dict,
  18791. resultObj: this.data,
  18792. docBaseUrl: params.pdfManager.docBaseUrl
  18793. });
  18794. }
  18795. }
  18796. class PopupAnnotation extends Annotation {
  18797. constructor(parameters) {
  18798. super(parameters);
  18799. this.data.annotationType = _util.AnnotationType.POPUP;
  18800. let parentItem = parameters.dict.get("Parent");
  18801. if (!parentItem) {
  18802. (0, _util.warn)("Popup annotation has a missing or invalid parent annotation.");
  18803. return;
  18804. }
  18805. const parentSubtype = parentItem.get("Subtype");
  18806. this.data.parentType = parentSubtype instanceof _primitives.Name ? parentSubtype.name : null;
  18807. const rawParent = parameters.dict.getRaw("Parent");
  18808. this.data.parentId = rawParent instanceof _primitives.Ref ? rawParent.toString() : null;
  18809. const parentRect = parentItem.getArray("Rect");
  18810. if (Array.isArray(parentRect) && parentRect.length === 4) {
  18811. this.data.parentRect = _util.Util.normalizeRect(parentRect);
  18812. } else {
  18813. this.data.parentRect = [0, 0, 0, 0];
  18814. }
  18815. const rt = parentItem.get("RT");
  18816. if ((0, _primitives.isName)(rt, _util.AnnotationReplyType.GROUP)) {
  18817. parentItem = parentItem.get("IRT");
  18818. }
  18819. if (!parentItem.has("M")) {
  18820. this.data.modificationDate = null;
  18821. } else {
  18822. this.setModificationDate(parentItem.get("M"));
  18823. this.data.modificationDate = this.modificationDate;
  18824. }
  18825. if (!parentItem.has("C")) {
  18826. this.data.color = null;
  18827. } else {
  18828. this.setColor(parentItem.getArray("C"));
  18829. this.data.color = this.color;
  18830. }
  18831. if (!this.viewable) {
  18832. const parentFlags = parentItem.get("F");
  18833. if (this._isViewable(parentFlags)) {
  18834. this.setFlags(parentFlags);
  18835. }
  18836. }
  18837. this.setTitle(parentItem.get("T"));
  18838. this.data.titleObj = this._title;
  18839. this.setContents(parentItem.get("Contents"));
  18840. this.data.contentsObj = this._contents;
  18841. if (parentItem.has("RC")) {
  18842. this.data.richText = _factory.XFAFactory.getRichTextAsHtml(parentItem.get("RC"));
  18843. }
  18844. }
  18845. }
  18846. class FreeTextAnnotation extends MarkupAnnotation {
  18847. constructor(parameters) {
  18848. super(parameters);
  18849. this.data.annotationType = _util.AnnotationType.FREETEXT;
  18850. }
  18851. }
  18852. class LineAnnotation extends MarkupAnnotation {
  18853. constructor(parameters) {
  18854. super(parameters);
  18855. const {
  18856. dict
  18857. } = parameters;
  18858. this.data.annotationType = _util.AnnotationType.LINE;
  18859. const lineCoordinates = dict.getArray("L");
  18860. this.data.lineCoordinates = _util.Util.normalizeRect(lineCoordinates);
  18861. this.setLineEndings(dict.getArray("LE"));
  18862. this.data.lineEndings = this.lineEndings;
  18863. if (!this.appearance) {
  18864. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18865. const strokeAlpha = dict.get("CA");
  18866. let fillColor = null,
  18867. interiorColor = dict.getArray("IC");
  18868. if (interiorColor) {
  18869. interiorColor = getRgbColor(interiorColor, null);
  18870. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18871. }
  18872. const fillAlpha = fillColor ? strokeAlpha : null;
  18873. const borderWidth = this.borderStyle.width || 1,
  18874. borderAdjust = 2 * borderWidth;
  18875. const bbox = [this.data.lineCoordinates[0] - borderAdjust, this.data.lineCoordinates[1] - borderAdjust, this.data.lineCoordinates[2] + borderAdjust, this.data.lineCoordinates[3] + borderAdjust];
  18876. if (!_util.Util.intersect(this.rectangle, bbox)) {
  18877. this.rectangle = bbox;
  18878. }
  18879. this._setDefaultAppearance({
  18880. xref: parameters.xref,
  18881. extra: `${borderWidth} w`,
  18882. strokeColor,
  18883. fillColor,
  18884. strokeAlpha,
  18885. fillAlpha,
  18886. pointsCallback: (buffer, points) => {
  18887. buffer.push(`${lineCoordinates[0]} ${lineCoordinates[1]} m`, `${lineCoordinates[2]} ${lineCoordinates[3]} l`, "S");
  18888. return [points[0].x - borderWidth, points[1].x + borderWidth, points[3].y - borderWidth, points[1].y + borderWidth];
  18889. }
  18890. });
  18891. }
  18892. }
  18893. }
  18894. class SquareAnnotation extends MarkupAnnotation {
  18895. constructor(parameters) {
  18896. super(parameters);
  18897. this.data.annotationType = _util.AnnotationType.SQUARE;
  18898. if (!this.appearance) {
  18899. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18900. const strokeAlpha = parameters.dict.get("CA");
  18901. let fillColor = null,
  18902. interiorColor = parameters.dict.getArray("IC");
  18903. if (interiorColor) {
  18904. interiorColor = getRgbColor(interiorColor, null);
  18905. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18906. }
  18907. const fillAlpha = fillColor ? strokeAlpha : null;
  18908. if (this.borderStyle.width === 0 && !fillColor) {
  18909. return;
  18910. }
  18911. this._setDefaultAppearance({
  18912. xref: parameters.xref,
  18913. extra: `${this.borderStyle.width} w`,
  18914. strokeColor,
  18915. fillColor,
  18916. strokeAlpha,
  18917. fillAlpha,
  18918. pointsCallback: (buffer, points) => {
  18919. const x = points[2].x + this.borderStyle.width / 2;
  18920. const y = points[2].y + this.borderStyle.width / 2;
  18921. const width = points[3].x - points[2].x - this.borderStyle.width;
  18922. const height = points[1].y - points[3].y - this.borderStyle.width;
  18923. buffer.push(`${x} ${y} ${width} ${height} re`);
  18924. if (fillColor) {
  18925. buffer.push("B");
  18926. } else {
  18927. buffer.push("S");
  18928. }
  18929. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18930. }
  18931. });
  18932. }
  18933. }
  18934. }
  18935. class CircleAnnotation extends MarkupAnnotation {
  18936. constructor(parameters) {
  18937. super(parameters);
  18938. this.data.annotationType = _util.AnnotationType.CIRCLE;
  18939. if (!this.appearance) {
  18940. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  18941. const strokeAlpha = parameters.dict.get("CA");
  18942. let fillColor = null;
  18943. let interiorColor = parameters.dict.getArray("IC");
  18944. if (interiorColor) {
  18945. interiorColor = getRgbColor(interiorColor, null);
  18946. fillColor = interiorColor ? Array.from(interiorColor).map(c => c / 255) : null;
  18947. }
  18948. const fillAlpha = fillColor ? strokeAlpha : null;
  18949. if (this.borderStyle.width === 0 && !fillColor) {
  18950. return;
  18951. }
  18952. const controlPointsDistance = 4 / 3 * Math.tan(Math.PI / (2 * 4));
  18953. this._setDefaultAppearance({
  18954. xref: parameters.xref,
  18955. extra: `${this.borderStyle.width} w`,
  18956. strokeColor,
  18957. fillColor,
  18958. strokeAlpha,
  18959. fillAlpha,
  18960. pointsCallback: (buffer, points) => {
  18961. const x0 = points[0].x + this.borderStyle.width / 2;
  18962. const y0 = points[0].y - this.borderStyle.width / 2;
  18963. const x1 = points[3].x - this.borderStyle.width / 2;
  18964. const y1 = points[3].y + this.borderStyle.width / 2;
  18965. const xMid = x0 + (x1 - x0) / 2;
  18966. const yMid = y0 + (y1 - y0) / 2;
  18967. const xOffset = (x1 - x0) / 2 * controlPointsDistance;
  18968. const yOffset = (y1 - y0) / 2 * controlPointsDistance;
  18969. 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");
  18970. if (fillColor) {
  18971. buffer.push("B");
  18972. } else {
  18973. buffer.push("S");
  18974. }
  18975. return [points[0].x, points[1].x, points[3].y, points[1].y];
  18976. }
  18977. });
  18978. }
  18979. }
  18980. }
  18981. class PolylineAnnotation extends MarkupAnnotation {
  18982. constructor(parameters) {
  18983. super(parameters);
  18984. const {
  18985. dict
  18986. } = parameters;
  18987. this.data.annotationType = _util.AnnotationType.POLYLINE;
  18988. this.data.vertices = [];
  18989. if (!(this instanceof PolygonAnnotation)) {
  18990. this.setLineEndings(dict.getArray("LE"));
  18991. this.data.lineEndings = this.lineEndings;
  18992. }
  18993. const rawVertices = dict.getArray("Vertices");
  18994. if (!Array.isArray(rawVertices)) {
  18995. return;
  18996. }
  18997. for (let i = 0, ii = rawVertices.length; i < ii; i += 2) {
  18998. this.data.vertices.push({
  18999. x: rawVertices[i],
  19000. y: rawVertices[i + 1]
  19001. });
  19002. }
  19003. if (!this.appearance) {
  19004. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19005. const strokeAlpha = dict.get("CA");
  19006. const borderWidth = this.borderStyle.width || 1,
  19007. borderAdjust = 2 * borderWidth;
  19008. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  19009. for (const vertex of this.data.vertices) {
  19010. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  19011. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  19012. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  19013. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  19014. }
  19015. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19016. this.rectangle = bbox;
  19017. }
  19018. this._setDefaultAppearance({
  19019. xref: parameters.xref,
  19020. extra: `${borderWidth} w`,
  19021. strokeColor,
  19022. strokeAlpha,
  19023. pointsCallback: (buffer, points) => {
  19024. const vertices = this.data.vertices;
  19025. for (let i = 0, ii = vertices.length; i < ii; i++) {
  19026. buffer.push(`${vertices[i].x} ${vertices[i].y} ${i === 0 ? "m" : "l"}`);
  19027. }
  19028. buffer.push("S");
  19029. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19030. }
  19031. });
  19032. }
  19033. }
  19034. }
  19035. class PolygonAnnotation extends PolylineAnnotation {
  19036. constructor(parameters) {
  19037. super(parameters);
  19038. this.data.annotationType = _util.AnnotationType.POLYGON;
  19039. }
  19040. }
  19041. class CaretAnnotation extends MarkupAnnotation {
  19042. constructor(parameters) {
  19043. super(parameters);
  19044. this.data.annotationType = _util.AnnotationType.CARET;
  19045. }
  19046. }
  19047. class InkAnnotation extends MarkupAnnotation {
  19048. constructor(parameters) {
  19049. super(parameters);
  19050. this.data.annotationType = _util.AnnotationType.INK;
  19051. this.data.inkLists = [];
  19052. const rawInkLists = parameters.dict.getArray("InkList");
  19053. if (!Array.isArray(rawInkLists)) {
  19054. return;
  19055. }
  19056. const xref = parameters.xref;
  19057. for (let i = 0, ii = rawInkLists.length; i < ii; ++i) {
  19058. this.data.inkLists.push([]);
  19059. for (let j = 0, jj = rawInkLists[i].length; j < jj; j += 2) {
  19060. this.data.inkLists[i].push({
  19061. x: xref.fetchIfRef(rawInkLists[i][j]),
  19062. y: xref.fetchIfRef(rawInkLists[i][j + 1])
  19063. });
  19064. }
  19065. }
  19066. if (!this.appearance) {
  19067. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19068. const strokeAlpha = parameters.dict.get("CA");
  19069. const borderWidth = this.borderStyle.width || 1,
  19070. borderAdjust = 2 * borderWidth;
  19071. const bbox = [Infinity, Infinity, -Infinity, -Infinity];
  19072. for (const inkLists of this.data.inkLists) {
  19073. for (const vertex of inkLists) {
  19074. bbox[0] = Math.min(bbox[0], vertex.x - borderAdjust);
  19075. bbox[1] = Math.min(bbox[1], vertex.y - borderAdjust);
  19076. bbox[2] = Math.max(bbox[2], vertex.x + borderAdjust);
  19077. bbox[3] = Math.max(bbox[3], vertex.y + borderAdjust);
  19078. }
  19079. }
  19080. if (!_util.Util.intersect(this.rectangle, bbox)) {
  19081. this.rectangle = bbox;
  19082. }
  19083. this._setDefaultAppearance({
  19084. xref: parameters.xref,
  19085. extra: `${borderWidth} w`,
  19086. strokeColor,
  19087. strokeAlpha,
  19088. pointsCallback: (buffer, points) => {
  19089. for (const inkList of this.data.inkLists) {
  19090. for (let i = 0, ii = inkList.length; i < ii; i++) {
  19091. buffer.push(`${inkList[i].x} ${inkList[i].y} ${i === 0 ? "m" : "l"}`);
  19092. }
  19093. buffer.push("S");
  19094. }
  19095. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19096. }
  19097. });
  19098. }
  19099. }
  19100. }
  19101. class HighlightAnnotation extends MarkupAnnotation {
  19102. constructor(parameters) {
  19103. super(parameters);
  19104. this.data.annotationType = _util.AnnotationType.HIGHLIGHT;
  19105. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19106. if (quadPoints) {
  19107. const resources = this.appearance && this.appearance.dict.get("Resources");
  19108. if (!this.appearance || !(resources && resources.has("ExtGState"))) {
  19109. if (this.appearance) {
  19110. (0, _util.warn)("HighlightAnnotation - ignoring built-in appearance stream.");
  19111. }
  19112. const fillColor = this.color ? Array.from(this.color).map(c => c / 255) : [1, 1, 0];
  19113. const fillAlpha = parameters.dict.get("CA");
  19114. this._setDefaultAppearance({
  19115. xref: parameters.xref,
  19116. fillColor,
  19117. blendMode: "Multiply",
  19118. fillAlpha,
  19119. pointsCallback: (buffer, points) => {
  19120. buffer.push(`${points[0].x} ${points[0].y} m`, `${points[1].x} ${points[1].y} l`, `${points[3].x} ${points[3].y} l`, `${points[2].x} ${points[2].y} l`, "f");
  19121. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19122. }
  19123. });
  19124. }
  19125. } else {
  19126. this.data.hasPopup = false;
  19127. }
  19128. }
  19129. }
  19130. class UnderlineAnnotation extends MarkupAnnotation {
  19131. constructor(parameters) {
  19132. super(parameters);
  19133. this.data.annotationType = _util.AnnotationType.UNDERLINE;
  19134. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19135. if (quadPoints) {
  19136. if (!this.appearance) {
  19137. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19138. const strokeAlpha = parameters.dict.get("CA");
  19139. this._setDefaultAppearance({
  19140. xref: parameters.xref,
  19141. extra: "[] 0 d 1 w",
  19142. strokeColor,
  19143. strokeAlpha,
  19144. pointsCallback: (buffer, points) => {
  19145. buffer.push(`${points[2].x} ${points[2].y} m`, `${points[3].x} ${points[3].y} l`, "S");
  19146. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19147. }
  19148. });
  19149. }
  19150. } else {
  19151. this.data.hasPopup = false;
  19152. }
  19153. }
  19154. }
  19155. class SquigglyAnnotation extends MarkupAnnotation {
  19156. constructor(parameters) {
  19157. super(parameters);
  19158. this.data.annotationType = _util.AnnotationType.SQUIGGLY;
  19159. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19160. if (quadPoints) {
  19161. if (!this.appearance) {
  19162. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19163. const strokeAlpha = parameters.dict.get("CA");
  19164. this._setDefaultAppearance({
  19165. xref: parameters.xref,
  19166. extra: "[] 0 d 1 w",
  19167. strokeColor,
  19168. strokeAlpha,
  19169. pointsCallback: (buffer, points) => {
  19170. const dy = (points[0].y - points[2].y) / 6;
  19171. let shift = dy;
  19172. let x = points[2].x;
  19173. const y = points[2].y;
  19174. const xEnd = points[3].x;
  19175. buffer.push(`${x} ${y + shift} m`);
  19176. do {
  19177. x += 2;
  19178. shift = shift === 0 ? dy : 0;
  19179. buffer.push(`${x} ${y + shift} l`);
  19180. } while (x < xEnd);
  19181. buffer.push("S");
  19182. return [points[2].x, xEnd, y - 2 * dy, y + 2 * dy];
  19183. }
  19184. });
  19185. }
  19186. } else {
  19187. this.data.hasPopup = false;
  19188. }
  19189. }
  19190. }
  19191. class StrikeOutAnnotation extends MarkupAnnotation {
  19192. constructor(parameters) {
  19193. super(parameters);
  19194. this.data.annotationType = _util.AnnotationType.STRIKEOUT;
  19195. const quadPoints = this.data.quadPoints = getQuadPoints(parameters.dict, null);
  19196. if (quadPoints) {
  19197. if (!this.appearance) {
  19198. const strokeColor = this.color ? Array.from(this.color).map(c => c / 255) : [0, 0, 0];
  19199. const strokeAlpha = parameters.dict.get("CA");
  19200. this._setDefaultAppearance({
  19201. xref: parameters.xref,
  19202. extra: "[] 0 d 1 w",
  19203. strokeColor,
  19204. strokeAlpha,
  19205. pointsCallback: (buffer, points) => {
  19206. buffer.push(`${(points[0].x + points[2].x) / 2} ` + `${(points[0].y + points[2].y) / 2} m`, `${(points[1].x + points[3].x) / 2} ` + `${(points[1].y + points[3].y) / 2} l`, "S");
  19207. return [points[0].x, points[1].x, points[3].y, points[1].y];
  19208. }
  19209. });
  19210. }
  19211. } else {
  19212. this.data.hasPopup = false;
  19213. }
  19214. }
  19215. }
  19216. class StampAnnotation extends MarkupAnnotation {
  19217. constructor(parameters) {
  19218. super(parameters);
  19219. this.data.annotationType = _util.AnnotationType.STAMP;
  19220. }
  19221. }
  19222. class FileAttachmentAnnotation extends MarkupAnnotation {
  19223. constructor(parameters) {
  19224. super(parameters);
  19225. const file = new _file_spec.FileSpec(parameters.dict.get("FS"), parameters.xref);
  19226. this.data.annotationType = _util.AnnotationType.FILEATTACHMENT;
  19227. this.data.file = file.serializable;
  19228. }
  19229. }
  19230. /***/ }),
  19231. /* 23 */
  19232. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19233. Object.defineProperty(exports, "__esModule", ({
  19234. value: true
  19235. }));
  19236. exports.createDefaultAppearance = createDefaultAppearance;
  19237. exports.parseDefaultAppearance = parseDefaultAppearance;
  19238. var _util = __w_pdfjs_require__(2);
  19239. var _colorspace = __w_pdfjs_require__(24);
  19240. var _core_utils = __w_pdfjs_require__(8);
  19241. var _evaluator = __w_pdfjs_require__(25);
  19242. var _primitives = __w_pdfjs_require__(5);
  19243. var _stream = __w_pdfjs_require__(10);
  19244. class DefaultAppearanceEvaluator extends _evaluator.EvaluatorPreprocessor {
  19245. constructor(str) {
  19246. super(new _stream.StringStream(str));
  19247. }
  19248. parse() {
  19249. const operation = {
  19250. fn: 0,
  19251. args: []
  19252. };
  19253. const result = {
  19254. fontSize: 0,
  19255. fontName: "",
  19256. fontColor: new Uint8ClampedArray(3)
  19257. };
  19258. try {
  19259. while (true) {
  19260. operation.args.length = 0;
  19261. if (!this.read(operation)) {
  19262. break;
  19263. }
  19264. if (this.savedStatesDepth !== 0) {
  19265. continue;
  19266. }
  19267. const {
  19268. fn,
  19269. args
  19270. } = operation;
  19271. switch (fn | 0) {
  19272. case _util.OPS.setFont:
  19273. const [fontName, fontSize] = args;
  19274. if (fontName instanceof _primitives.Name) {
  19275. result.fontName = fontName.name;
  19276. }
  19277. if (typeof fontSize === "number" && fontSize > 0) {
  19278. result.fontSize = fontSize;
  19279. }
  19280. break;
  19281. case _util.OPS.setFillRGBColor:
  19282. _colorspace.ColorSpace.singletons.rgb.getRgbItem(args, 0, result.fontColor, 0);
  19283. break;
  19284. case _util.OPS.setFillGray:
  19285. _colorspace.ColorSpace.singletons.gray.getRgbItem(args, 0, result.fontColor, 0);
  19286. break;
  19287. case _util.OPS.setFillColorSpace:
  19288. _colorspace.ColorSpace.singletons.cmyk.getRgbItem(args, 0, result.fontColor, 0);
  19289. break;
  19290. }
  19291. }
  19292. } catch (reason) {
  19293. (0, _util.warn)(`parseDefaultAppearance - ignoring errors: "${reason}".`);
  19294. }
  19295. return result;
  19296. }
  19297. }
  19298. function parseDefaultAppearance(str) {
  19299. return new DefaultAppearanceEvaluator(str).parse();
  19300. }
  19301. function createDefaultAppearance({
  19302. fontSize,
  19303. fontName,
  19304. fontColor
  19305. }) {
  19306. let colorCmd;
  19307. if (fontColor.every(c => c === 0)) {
  19308. colorCmd = "0 g";
  19309. } else {
  19310. colorCmd = Array.from(fontColor).map(c => (c / 255).toFixed(2)).join(" ") + " rg";
  19311. }
  19312. return `/${(0, _core_utils.escapePDFName)(fontName)} ${fontSize} Tf ${colorCmd}`;
  19313. }
  19314. /***/ }),
  19315. /* 24 */
  19316. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  19317. Object.defineProperty(exports, "__esModule", ({
  19318. value: true
  19319. }));
  19320. exports.ColorSpace = void 0;
  19321. var _util = __w_pdfjs_require__(2);
  19322. var _primitives = __w_pdfjs_require__(5);
  19323. var _base_stream = __w_pdfjs_require__(9);
  19324. var _core_utils = __w_pdfjs_require__(8);
  19325. function resizeRgbImage(src, dest, w1, h1, w2, h2, alpha01) {
  19326. const COMPONENTS = 3;
  19327. alpha01 = alpha01 !== 1 ? 0 : alpha01;
  19328. const xRatio = w1 / w2;
  19329. const yRatio = h1 / h2;
  19330. let newIndex = 0,
  19331. oldIndex;
  19332. const xScaled = new Uint16Array(w2);
  19333. const w1Scanline = w1 * COMPONENTS;
  19334. for (let i = 0; i < w2; i++) {
  19335. xScaled[i] = Math.floor(i * xRatio) * COMPONENTS;
  19336. }
  19337. for (let i = 0; i < h2; i++) {
  19338. const py = Math.floor(i * yRatio) * w1Scanline;
  19339. for (let j = 0; j < w2; j++) {
  19340. oldIndex = py + xScaled[j];
  19341. dest[newIndex++] = src[oldIndex++];
  19342. dest[newIndex++] = src[oldIndex++];
  19343. dest[newIndex++] = src[oldIndex++];
  19344. newIndex += alpha01;
  19345. }
  19346. }
  19347. }
  19348. class ColorSpace {
  19349. constructor(name, numComps) {
  19350. if (this.constructor === ColorSpace) {
  19351. (0, _util.unreachable)("Cannot initialize ColorSpace.");
  19352. }
  19353. this.name = name;
  19354. this.numComps = numComps;
  19355. }
  19356. getRgb(src, srcOffset) {
  19357. const rgb = new Uint8ClampedArray(3);
  19358. this.getRgbItem(src, srcOffset, rgb, 0);
  19359. return rgb;
  19360. }
  19361. getRgbItem(src, srcOffset, dest, destOffset) {
  19362. (0, _util.unreachable)("Should not call ColorSpace.getRgbItem");
  19363. }
  19364. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19365. (0, _util.unreachable)("Should not call ColorSpace.getRgbBuffer");
  19366. }
  19367. getOutputLength(inputLength, alpha01) {
  19368. (0, _util.unreachable)("Should not call ColorSpace.getOutputLength");
  19369. }
  19370. isPassthrough(bits) {
  19371. return false;
  19372. }
  19373. isDefaultDecode(decodeMap, bpc) {
  19374. return ColorSpace.isDefaultDecode(decodeMap, this.numComps);
  19375. }
  19376. fillRgb(dest, originalWidth, originalHeight, width, height, actualHeight, bpc, comps, alpha01) {
  19377. const count = originalWidth * originalHeight;
  19378. let rgbBuf = null;
  19379. const numComponentColors = 1 << bpc;
  19380. const needsResizing = originalHeight !== height || originalWidth !== width;
  19381. if (this.isPassthrough(bpc)) {
  19382. rgbBuf = comps;
  19383. } else if (this.numComps === 1 && count > numComponentColors && this.name !== "DeviceGray" && this.name !== "DeviceRGB") {
  19384. const allColors = bpc <= 8 ? new Uint8Array(numComponentColors) : new Uint16Array(numComponentColors);
  19385. for (let i = 0; i < numComponentColors; i++) {
  19386. allColors[i] = i;
  19387. }
  19388. const colorMap = new Uint8ClampedArray(numComponentColors * 3);
  19389. this.getRgbBuffer(allColors, 0, numComponentColors, colorMap, 0, bpc, 0);
  19390. if (!needsResizing) {
  19391. let destPos = 0;
  19392. for (let i = 0; i < count; ++i) {
  19393. const key = comps[i] * 3;
  19394. dest[destPos++] = colorMap[key];
  19395. dest[destPos++] = colorMap[key + 1];
  19396. dest[destPos++] = colorMap[key + 2];
  19397. destPos += alpha01;
  19398. }
  19399. } else {
  19400. rgbBuf = new Uint8Array(count * 3);
  19401. let rgbPos = 0;
  19402. for (let i = 0; i < count; ++i) {
  19403. const key = comps[i] * 3;
  19404. rgbBuf[rgbPos++] = colorMap[key];
  19405. rgbBuf[rgbPos++] = colorMap[key + 1];
  19406. rgbBuf[rgbPos++] = colorMap[key + 2];
  19407. }
  19408. }
  19409. } else {
  19410. if (!needsResizing) {
  19411. this.getRgbBuffer(comps, 0, width * actualHeight, dest, 0, bpc, alpha01);
  19412. } else {
  19413. rgbBuf = new Uint8ClampedArray(count * 3);
  19414. this.getRgbBuffer(comps, 0, count, rgbBuf, 0, bpc, 0);
  19415. }
  19416. }
  19417. if (rgbBuf) {
  19418. if (needsResizing) {
  19419. resizeRgbImage(rgbBuf, dest, originalWidth, originalHeight, width, height, alpha01);
  19420. } else {
  19421. let destPos = 0,
  19422. rgbPos = 0;
  19423. for (let i = 0, ii = width * actualHeight; i < ii; i++) {
  19424. dest[destPos++] = rgbBuf[rgbPos++];
  19425. dest[destPos++] = rgbBuf[rgbPos++];
  19426. dest[destPos++] = rgbBuf[rgbPos++];
  19427. destPos += alpha01;
  19428. }
  19429. }
  19430. }
  19431. }
  19432. get usesZeroToOneRange() {
  19433. return (0, _util.shadow)(this, "usesZeroToOneRange", true);
  19434. }
  19435. static _cache(cacheKey, xref, localColorSpaceCache, parsedColorSpace) {
  19436. if (!localColorSpaceCache) {
  19437. throw new Error('ColorSpace._cache - expected "localColorSpaceCache" argument.');
  19438. }
  19439. if (!parsedColorSpace) {
  19440. throw new Error('ColorSpace._cache - expected "parsedColorSpace" argument.');
  19441. }
  19442. let csName, csRef;
  19443. if (cacheKey instanceof _primitives.Ref) {
  19444. csRef = cacheKey;
  19445. cacheKey = xref.fetch(cacheKey);
  19446. }
  19447. if (cacheKey instanceof _primitives.Name) {
  19448. csName = cacheKey.name;
  19449. }
  19450. if (csName || csRef) {
  19451. localColorSpaceCache.set(csName, csRef, parsedColorSpace);
  19452. }
  19453. }
  19454. static getCached(cacheKey, xref, localColorSpaceCache) {
  19455. if (!localColorSpaceCache) {
  19456. throw new Error('ColorSpace.getCached - expected "localColorSpaceCache" argument.');
  19457. }
  19458. if (cacheKey instanceof _primitives.Ref) {
  19459. const localColorSpace = localColorSpaceCache.getByRef(cacheKey);
  19460. if (localColorSpace) {
  19461. return localColorSpace;
  19462. }
  19463. try {
  19464. cacheKey = xref.fetch(cacheKey);
  19465. } catch (ex) {
  19466. if (ex instanceof _core_utils.MissingDataException) {
  19467. throw ex;
  19468. }
  19469. }
  19470. }
  19471. if (cacheKey instanceof _primitives.Name) {
  19472. const localColorSpace = localColorSpaceCache.getByName(cacheKey.name);
  19473. if (localColorSpace) {
  19474. return localColorSpace;
  19475. }
  19476. }
  19477. return null;
  19478. }
  19479. static async parseAsync({
  19480. cs,
  19481. xref,
  19482. resources = null,
  19483. pdfFunctionFactory,
  19484. localColorSpaceCache
  19485. }) {
  19486. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19487. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19488. return parsedColorSpace;
  19489. }
  19490. static parse({
  19491. cs,
  19492. xref,
  19493. resources = null,
  19494. pdfFunctionFactory,
  19495. localColorSpaceCache
  19496. }) {
  19497. const cachedColorSpace = this.getCached(cs, xref, localColorSpaceCache);
  19498. if (cachedColorSpace) {
  19499. return cachedColorSpace;
  19500. }
  19501. const parsedColorSpace = this._parse(cs, xref, resources, pdfFunctionFactory);
  19502. this._cache(cs, xref, localColorSpaceCache, parsedColorSpace);
  19503. return parsedColorSpace;
  19504. }
  19505. static _parse(cs, xref, resources = null, pdfFunctionFactory) {
  19506. cs = xref.fetchIfRef(cs);
  19507. if (cs instanceof _primitives.Name) {
  19508. switch (cs.name) {
  19509. case "G":
  19510. case "DeviceGray":
  19511. return this.singletons.gray;
  19512. case "RGB":
  19513. case "DeviceRGB":
  19514. return this.singletons.rgb;
  19515. case "CMYK":
  19516. case "DeviceCMYK":
  19517. return this.singletons.cmyk;
  19518. case "Pattern":
  19519. return new PatternCS(null);
  19520. default:
  19521. if (resources instanceof _primitives.Dict) {
  19522. const colorSpaces = resources.get("ColorSpace");
  19523. if (colorSpaces instanceof _primitives.Dict) {
  19524. const resourcesCS = colorSpaces.get(cs.name);
  19525. if (resourcesCS) {
  19526. if (resourcesCS instanceof _primitives.Name) {
  19527. return this._parse(resourcesCS, xref, resources, pdfFunctionFactory);
  19528. }
  19529. cs = resourcesCS;
  19530. break;
  19531. }
  19532. }
  19533. }
  19534. throw new _util.FormatError(`Unrecognized ColorSpace: ${cs.name}`);
  19535. }
  19536. }
  19537. if (Array.isArray(cs)) {
  19538. const mode = xref.fetchIfRef(cs[0]).name;
  19539. let params, numComps, baseCS, whitePoint, blackPoint, gamma;
  19540. switch (mode) {
  19541. case "G":
  19542. case "DeviceGray":
  19543. return this.singletons.gray;
  19544. case "RGB":
  19545. case "DeviceRGB":
  19546. return this.singletons.rgb;
  19547. case "CMYK":
  19548. case "DeviceCMYK":
  19549. return this.singletons.cmyk;
  19550. case "CalGray":
  19551. params = xref.fetchIfRef(cs[1]);
  19552. whitePoint = params.getArray("WhitePoint");
  19553. blackPoint = params.getArray("BlackPoint");
  19554. gamma = params.get("Gamma");
  19555. return new CalGrayCS(whitePoint, blackPoint, gamma);
  19556. case "CalRGB":
  19557. params = xref.fetchIfRef(cs[1]);
  19558. whitePoint = params.getArray("WhitePoint");
  19559. blackPoint = params.getArray("BlackPoint");
  19560. gamma = params.getArray("Gamma");
  19561. const matrix = params.getArray("Matrix");
  19562. return new CalRGBCS(whitePoint, blackPoint, gamma, matrix);
  19563. case "ICCBased":
  19564. const stream = xref.fetchIfRef(cs[1]);
  19565. const dict = stream.dict;
  19566. numComps = dict.get("N");
  19567. const alt = dict.get("Alternate");
  19568. if (alt) {
  19569. const altCS = this._parse(alt, xref, resources, pdfFunctionFactory);
  19570. if (altCS.numComps === numComps) {
  19571. return altCS;
  19572. }
  19573. (0, _util.warn)("ICCBased color space: Ignoring incorrect /Alternate entry.");
  19574. }
  19575. if (numComps === 1) {
  19576. return this.singletons.gray;
  19577. } else if (numComps === 3) {
  19578. return this.singletons.rgb;
  19579. } else if (numComps === 4) {
  19580. return this.singletons.cmyk;
  19581. }
  19582. break;
  19583. case "Pattern":
  19584. baseCS = cs[1] || null;
  19585. if (baseCS) {
  19586. baseCS = this._parse(baseCS, xref, resources, pdfFunctionFactory);
  19587. }
  19588. return new PatternCS(baseCS);
  19589. case "I":
  19590. case "Indexed":
  19591. baseCS = this._parse(cs[1], xref, resources, pdfFunctionFactory);
  19592. const hiVal = xref.fetchIfRef(cs[2]) + 1;
  19593. const lookup = xref.fetchIfRef(cs[3]);
  19594. return new IndexedCS(baseCS, hiVal, lookup);
  19595. case "Separation":
  19596. case "DeviceN":
  19597. const name = xref.fetchIfRef(cs[1]);
  19598. numComps = Array.isArray(name) ? name.length : 1;
  19599. baseCS = this._parse(cs[2], xref, resources, pdfFunctionFactory);
  19600. const tintFn = pdfFunctionFactory.create(cs[3]);
  19601. return new AlternateCS(numComps, baseCS, tintFn);
  19602. case "Lab":
  19603. params = xref.fetchIfRef(cs[1]);
  19604. whitePoint = params.getArray("WhitePoint");
  19605. blackPoint = params.getArray("BlackPoint");
  19606. const range = params.getArray("Range");
  19607. return new LabCS(whitePoint, blackPoint, range);
  19608. default:
  19609. throw new _util.FormatError(`Unimplemented ColorSpace object: ${mode}`);
  19610. }
  19611. }
  19612. throw new _util.FormatError(`Unrecognized ColorSpace object: ${cs}`);
  19613. }
  19614. static isDefaultDecode(decode, numComps) {
  19615. if (!Array.isArray(decode)) {
  19616. return true;
  19617. }
  19618. if (numComps * 2 !== decode.length) {
  19619. (0, _util.warn)("The decode map is not the correct length");
  19620. return true;
  19621. }
  19622. for (let i = 0, ii = decode.length; i < ii; i += 2) {
  19623. if (decode[i] !== 0 || decode[i + 1] !== 1) {
  19624. return false;
  19625. }
  19626. }
  19627. return true;
  19628. }
  19629. static get singletons() {
  19630. return (0, _util.shadow)(this, "singletons", {
  19631. get gray() {
  19632. return (0, _util.shadow)(this, "gray", new DeviceGrayCS());
  19633. },
  19634. get rgb() {
  19635. return (0, _util.shadow)(this, "rgb", new DeviceRgbCS());
  19636. },
  19637. get cmyk() {
  19638. return (0, _util.shadow)(this, "cmyk", new DeviceCmykCS());
  19639. }
  19640. });
  19641. }
  19642. }
  19643. exports.ColorSpace = ColorSpace;
  19644. class AlternateCS extends ColorSpace {
  19645. constructor(numComps, base, tintFn) {
  19646. super("Alternate", numComps);
  19647. this.base = base;
  19648. this.tintFn = tintFn;
  19649. this.tmpBuf = new Float32Array(base.numComps);
  19650. }
  19651. getRgbItem(src, srcOffset, dest, destOffset) {
  19652. const tmpBuf = this.tmpBuf;
  19653. this.tintFn(src, srcOffset, tmpBuf, 0);
  19654. this.base.getRgbItem(tmpBuf, 0, dest, destOffset);
  19655. }
  19656. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19657. const tintFn = this.tintFn;
  19658. const base = this.base;
  19659. const scale = 1 / ((1 << bits) - 1);
  19660. const baseNumComps = base.numComps;
  19661. const usesZeroToOneRange = base.usesZeroToOneRange;
  19662. const isPassthrough = (base.isPassthrough(8) || !usesZeroToOneRange) && alpha01 === 0;
  19663. let pos = isPassthrough ? destOffset : 0;
  19664. const baseBuf = isPassthrough ? dest : new Uint8ClampedArray(baseNumComps * count);
  19665. const numComps = this.numComps;
  19666. const scaled = new Float32Array(numComps);
  19667. const tinted = new Float32Array(baseNumComps);
  19668. let i, j;
  19669. for (i = 0; i < count; i++) {
  19670. for (j = 0; j < numComps; j++) {
  19671. scaled[j] = src[srcOffset++] * scale;
  19672. }
  19673. tintFn(scaled, 0, tinted, 0);
  19674. if (usesZeroToOneRange) {
  19675. for (j = 0; j < baseNumComps; j++) {
  19676. baseBuf[pos++] = tinted[j] * 255;
  19677. }
  19678. } else {
  19679. base.getRgbItem(tinted, 0, baseBuf, pos);
  19680. pos += baseNumComps;
  19681. }
  19682. }
  19683. if (!isPassthrough) {
  19684. base.getRgbBuffer(baseBuf, 0, count, dest, destOffset, 8, alpha01);
  19685. }
  19686. }
  19687. getOutputLength(inputLength, alpha01) {
  19688. return this.base.getOutputLength(inputLength * this.base.numComps / this.numComps, alpha01);
  19689. }
  19690. }
  19691. class PatternCS extends ColorSpace {
  19692. constructor(baseCS) {
  19693. super("Pattern", null);
  19694. this.base = baseCS;
  19695. }
  19696. isDefaultDecode(decodeMap, bpc) {
  19697. (0, _util.unreachable)("Should not call PatternCS.isDefaultDecode");
  19698. }
  19699. }
  19700. class IndexedCS extends ColorSpace {
  19701. constructor(base, highVal, lookup) {
  19702. super("Indexed", 1);
  19703. this.base = base;
  19704. this.highVal = highVal;
  19705. const length = base.numComps * highVal;
  19706. this.lookup = new Uint8Array(length);
  19707. if (lookup instanceof _base_stream.BaseStream) {
  19708. const bytes = lookup.getBytes(length);
  19709. this.lookup.set(bytes);
  19710. } else if (typeof lookup === "string") {
  19711. for (let i = 0; i < length; ++i) {
  19712. this.lookup[i] = lookup.charCodeAt(i) & 0xff;
  19713. }
  19714. } else {
  19715. throw new _util.FormatError(`IndexedCS - unrecognized lookup table: ${lookup}`);
  19716. }
  19717. }
  19718. getRgbItem(src, srcOffset, dest, destOffset) {
  19719. const numComps = this.base.numComps;
  19720. const start = src[srcOffset] * numComps;
  19721. this.base.getRgbBuffer(this.lookup, start, 1, dest, destOffset, 8, 0);
  19722. }
  19723. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19724. const base = this.base;
  19725. const numComps = base.numComps;
  19726. const outputDelta = base.getOutputLength(numComps, alpha01);
  19727. const lookup = this.lookup;
  19728. for (let i = 0; i < count; ++i) {
  19729. const lookupPos = src[srcOffset++] * numComps;
  19730. base.getRgbBuffer(lookup, lookupPos, 1, dest, destOffset, 8, alpha01);
  19731. destOffset += outputDelta;
  19732. }
  19733. }
  19734. getOutputLength(inputLength, alpha01) {
  19735. return this.base.getOutputLength(inputLength * this.base.numComps, alpha01);
  19736. }
  19737. isDefaultDecode(decodeMap, bpc) {
  19738. if (!Array.isArray(decodeMap)) {
  19739. return true;
  19740. }
  19741. if (decodeMap.length !== 2) {
  19742. (0, _util.warn)("Decode map length is not correct");
  19743. return true;
  19744. }
  19745. if (!Number.isInteger(bpc) || bpc < 1) {
  19746. (0, _util.warn)("Bits per component is not correct");
  19747. return true;
  19748. }
  19749. return decodeMap[0] === 0 && decodeMap[1] === (1 << bpc) - 1;
  19750. }
  19751. }
  19752. class DeviceGrayCS extends ColorSpace {
  19753. constructor() {
  19754. super("DeviceGray", 1);
  19755. }
  19756. getRgbItem(src, srcOffset, dest, destOffset) {
  19757. const c = src[srcOffset] * 255;
  19758. dest[destOffset] = dest[destOffset + 1] = dest[destOffset + 2] = c;
  19759. }
  19760. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19761. const scale = 255 / ((1 << bits) - 1);
  19762. let j = srcOffset,
  19763. q = destOffset;
  19764. for (let i = 0; i < count; ++i) {
  19765. const c = scale * src[j++];
  19766. dest[q++] = c;
  19767. dest[q++] = c;
  19768. dest[q++] = c;
  19769. q += alpha01;
  19770. }
  19771. }
  19772. getOutputLength(inputLength, alpha01) {
  19773. return inputLength * (3 + alpha01);
  19774. }
  19775. }
  19776. class DeviceRgbCS extends ColorSpace {
  19777. constructor() {
  19778. super("DeviceRGB", 3);
  19779. }
  19780. getRgbItem(src, srcOffset, dest, destOffset) {
  19781. dest[destOffset] = src[srcOffset] * 255;
  19782. dest[destOffset + 1] = src[srcOffset + 1] * 255;
  19783. dest[destOffset + 2] = src[srcOffset + 2] * 255;
  19784. }
  19785. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19786. if (bits === 8 && alpha01 === 0) {
  19787. dest.set(src.subarray(srcOffset, srcOffset + count * 3), destOffset);
  19788. return;
  19789. }
  19790. const scale = 255 / ((1 << bits) - 1);
  19791. let j = srcOffset,
  19792. q = destOffset;
  19793. for (let i = 0; i < count; ++i) {
  19794. dest[q++] = scale * src[j++];
  19795. dest[q++] = scale * src[j++];
  19796. dest[q++] = scale * src[j++];
  19797. q += alpha01;
  19798. }
  19799. }
  19800. getOutputLength(inputLength, alpha01) {
  19801. return inputLength * (3 + alpha01) / 3 | 0;
  19802. }
  19803. isPassthrough(bits) {
  19804. return bits === 8;
  19805. }
  19806. }
  19807. const DeviceCmykCS = function DeviceCmykCSClosure() {
  19808. function convertToRgb(src, srcOffset, srcScale, dest, destOffset) {
  19809. const c = src[srcOffset] * srcScale;
  19810. const m = src[srcOffset + 1] * srcScale;
  19811. const y = src[srcOffset + 2] * srcScale;
  19812. const k = src[srcOffset + 3] * srcScale;
  19813. 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);
  19814. 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);
  19815. 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);
  19816. }
  19817. class DeviceCmykCS extends ColorSpace {
  19818. constructor() {
  19819. super("DeviceCMYK", 4);
  19820. }
  19821. getRgbItem(src, srcOffset, dest, destOffset) {
  19822. convertToRgb(src, srcOffset, 1, dest, destOffset);
  19823. }
  19824. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19825. const scale = 1 / ((1 << bits) - 1);
  19826. for (let i = 0; i < count; i++) {
  19827. convertToRgb(src, srcOffset, scale, dest, destOffset);
  19828. srcOffset += 4;
  19829. destOffset += 3 + alpha01;
  19830. }
  19831. }
  19832. getOutputLength(inputLength, alpha01) {
  19833. return inputLength / 4 * (3 + alpha01) | 0;
  19834. }
  19835. }
  19836. return DeviceCmykCS;
  19837. }();
  19838. const CalGrayCS = function CalGrayCSClosure() {
  19839. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19840. const A = src[srcOffset] * scale;
  19841. const AG = A ** cs.G;
  19842. const L = cs.YW * AG;
  19843. const val = Math.max(295.8 * L ** 0.3333333333333333 - 40.8, 0);
  19844. dest[destOffset] = val;
  19845. dest[destOffset + 1] = val;
  19846. dest[destOffset + 2] = val;
  19847. }
  19848. class CalGrayCS extends ColorSpace {
  19849. constructor(whitePoint, blackPoint, gamma) {
  19850. super("CalGray", 1);
  19851. if (!whitePoint) {
  19852. throw new _util.FormatError("WhitePoint missing - required for color space CalGray");
  19853. }
  19854. blackPoint = blackPoint || [0, 0, 0];
  19855. gamma = gamma || 1;
  19856. this.XW = whitePoint[0];
  19857. this.YW = whitePoint[1];
  19858. this.ZW = whitePoint[2];
  19859. this.XB = blackPoint[0];
  19860. this.YB = blackPoint[1];
  19861. this.ZB = blackPoint[2];
  19862. this.G = gamma;
  19863. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  19864. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  19865. }
  19866. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  19867. (0, _util.info)(`Invalid BlackPoint for ${this.name}, falling back to default.`);
  19868. this.XB = this.YB = this.ZB = 0;
  19869. }
  19870. if (this.XB !== 0 || this.YB !== 0 || this.ZB !== 0) {
  19871. (0, _util.warn)(`${this.name}, BlackPoint: XB: ${this.XB}, YB: ${this.YB}, ` + `ZB: ${this.ZB}, only default values are supported.`);
  19872. }
  19873. if (this.G < 1) {
  19874. (0, _util.info)(`Invalid Gamma: ${this.G} for ${this.name}, ` + "falling back to default.");
  19875. this.G = 1;
  19876. }
  19877. }
  19878. getRgbItem(src, srcOffset, dest, destOffset) {
  19879. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  19880. }
  19881. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  19882. const scale = 1 / ((1 << bits) - 1);
  19883. for (let i = 0; i < count; ++i) {
  19884. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  19885. srcOffset += 1;
  19886. destOffset += 3 + alpha01;
  19887. }
  19888. }
  19889. getOutputLength(inputLength, alpha01) {
  19890. return inputLength * (3 + alpha01);
  19891. }
  19892. }
  19893. return CalGrayCS;
  19894. }();
  19895. const CalRGBCS = function CalRGBCSClosure() {
  19896. const BRADFORD_SCALE_MATRIX = new Float32Array([0.8951, 0.2664, -0.1614, -0.7502, 1.7135, 0.0367, 0.0389, -0.0685, 1.0296]);
  19897. const BRADFORD_SCALE_INVERSE_MATRIX = new Float32Array([0.9869929, -0.1470543, 0.1599627, 0.4323053, 0.5183603, 0.0492912, -0.0085287, 0.0400428, 0.9684867]);
  19898. const 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]);
  19899. const FLAT_WHITEPOINT_MATRIX = new Float32Array([1, 1, 1]);
  19900. const tempNormalizeMatrix = new Float32Array(3);
  19901. const tempConvertMatrix1 = new Float32Array(3);
  19902. const tempConvertMatrix2 = new Float32Array(3);
  19903. const DECODE_L_CONSTANT = ((8 + 16) / 116) ** 3 / 8.0;
  19904. function matrixProduct(a, b, result) {
  19905. result[0] = a[0] * b[0] + a[1] * b[1] + a[2] * b[2];
  19906. result[1] = a[3] * b[0] + a[4] * b[1] + a[5] * b[2];
  19907. result[2] = a[6] * b[0] + a[7] * b[1] + a[8] * b[2];
  19908. }
  19909. function convertToFlat(sourceWhitePoint, LMS, result) {
  19910. result[0] = LMS[0] * 1 / sourceWhitePoint[0];
  19911. result[1] = LMS[1] * 1 / sourceWhitePoint[1];
  19912. result[2] = LMS[2] * 1 / sourceWhitePoint[2];
  19913. }
  19914. function convertToD65(sourceWhitePoint, LMS, result) {
  19915. const D65X = 0.95047;
  19916. const D65Y = 1;
  19917. const D65Z = 1.08883;
  19918. result[0] = LMS[0] * D65X / sourceWhitePoint[0];
  19919. result[1] = LMS[1] * D65Y / sourceWhitePoint[1];
  19920. result[2] = LMS[2] * D65Z / sourceWhitePoint[2];
  19921. }
  19922. function sRGBTransferFunction(color) {
  19923. if (color <= 0.0031308) {
  19924. return adjustToRange(0, 1, 12.92 * color);
  19925. }
  19926. if (color >= 0.99554525) {
  19927. return 1;
  19928. }
  19929. return adjustToRange(0, 1, (1 + 0.055) * color ** (1 / 2.4) - 0.055);
  19930. }
  19931. function adjustToRange(min, max, value) {
  19932. return Math.max(min, Math.min(max, value));
  19933. }
  19934. function decodeL(L) {
  19935. if (L < 0) {
  19936. return -decodeL(-L);
  19937. }
  19938. if (L > 8.0) {
  19939. return ((L + 16) / 116) ** 3;
  19940. }
  19941. return L * DECODE_L_CONSTANT;
  19942. }
  19943. function compensateBlackPoint(sourceBlackPoint, XYZ_Flat, result) {
  19944. if (sourceBlackPoint[0] === 0 && sourceBlackPoint[1] === 0 && sourceBlackPoint[2] === 0) {
  19945. result[0] = XYZ_Flat[0];
  19946. result[1] = XYZ_Flat[1];
  19947. result[2] = XYZ_Flat[2];
  19948. return;
  19949. }
  19950. const zeroDecodeL = decodeL(0);
  19951. const X_DST = zeroDecodeL;
  19952. const X_SRC = decodeL(sourceBlackPoint[0]);
  19953. const Y_DST = zeroDecodeL;
  19954. const Y_SRC = decodeL(sourceBlackPoint[1]);
  19955. const Z_DST = zeroDecodeL;
  19956. const Z_SRC = decodeL(sourceBlackPoint[2]);
  19957. const X_Scale = (1 - X_DST) / (1 - X_SRC);
  19958. const X_Offset = 1 - X_Scale;
  19959. const Y_Scale = (1 - Y_DST) / (1 - Y_SRC);
  19960. const Y_Offset = 1 - Y_Scale;
  19961. const Z_Scale = (1 - Z_DST) / (1 - Z_SRC);
  19962. const Z_Offset = 1 - Z_Scale;
  19963. result[0] = XYZ_Flat[0] * X_Scale + X_Offset;
  19964. result[1] = XYZ_Flat[1] * Y_Scale + Y_Offset;
  19965. result[2] = XYZ_Flat[2] * Z_Scale + Z_Offset;
  19966. }
  19967. function normalizeWhitePointToFlat(sourceWhitePoint, XYZ_In, result) {
  19968. if (sourceWhitePoint[0] === 1 && sourceWhitePoint[2] === 1) {
  19969. result[0] = XYZ_In[0];
  19970. result[1] = XYZ_In[1];
  19971. result[2] = XYZ_In[2];
  19972. return;
  19973. }
  19974. const LMS = result;
  19975. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19976. const LMS_Flat = tempNormalizeMatrix;
  19977. convertToFlat(sourceWhitePoint, LMS, LMS_Flat);
  19978. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_Flat, result);
  19979. }
  19980. function normalizeWhitePointToD65(sourceWhitePoint, XYZ_In, result) {
  19981. const LMS = result;
  19982. matrixProduct(BRADFORD_SCALE_MATRIX, XYZ_In, LMS);
  19983. const LMS_D65 = tempNormalizeMatrix;
  19984. convertToD65(sourceWhitePoint, LMS, LMS_D65);
  19985. matrixProduct(BRADFORD_SCALE_INVERSE_MATRIX, LMS_D65, result);
  19986. }
  19987. function convertToRgb(cs, src, srcOffset, dest, destOffset, scale) {
  19988. const A = adjustToRange(0, 1, src[srcOffset] * scale);
  19989. const B = adjustToRange(0, 1, src[srcOffset + 1] * scale);
  19990. const C = adjustToRange(0, 1, src[srcOffset + 2] * scale);
  19991. const AGR = A === 1 ? 1 : A ** cs.GR;
  19992. const BGG = B === 1 ? 1 : B ** cs.GG;
  19993. const CGB = C === 1 ? 1 : C ** cs.GB;
  19994. const X = cs.MXA * AGR + cs.MXB * BGG + cs.MXC * CGB;
  19995. const Y = cs.MYA * AGR + cs.MYB * BGG + cs.MYC * CGB;
  19996. const Z = cs.MZA * AGR + cs.MZB * BGG + cs.MZC * CGB;
  19997. const XYZ = tempConvertMatrix1;
  19998. XYZ[0] = X;
  19999. XYZ[1] = Y;
  20000. XYZ[2] = Z;
  20001. const XYZ_Flat = tempConvertMatrix2;
  20002. normalizeWhitePointToFlat(cs.whitePoint, XYZ, XYZ_Flat);
  20003. const XYZ_Black = tempConvertMatrix1;
  20004. compensateBlackPoint(cs.blackPoint, XYZ_Flat, XYZ_Black);
  20005. const XYZ_D65 = tempConvertMatrix2;
  20006. normalizeWhitePointToD65(FLAT_WHITEPOINT_MATRIX, XYZ_Black, XYZ_D65);
  20007. const SRGB = tempConvertMatrix1;
  20008. matrixProduct(SRGB_D65_XYZ_TO_RGB_MATRIX, XYZ_D65, SRGB);
  20009. dest[destOffset] = sRGBTransferFunction(SRGB[0]) * 255;
  20010. dest[destOffset + 1] = sRGBTransferFunction(SRGB[1]) * 255;
  20011. dest[destOffset + 2] = sRGBTransferFunction(SRGB[2]) * 255;
  20012. }
  20013. class CalRGBCS extends ColorSpace {
  20014. constructor(whitePoint, blackPoint, gamma, matrix) {
  20015. super("CalRGB", 3);
  20016. if (!whitePoint) {
  20017. throw new _util.FormatError("WhitePoint missing - required for color space CalRGB");
  20018. }
  20019. blackPoint = blackPoint || new Float32Array(3);
  20020. gamma = gamma || new Float32Array([1, 1, 1]);
  20021. matrix = matrix || new Float32Array([1, 0, 0, 0, 1, 0, 0, 0, 1]);
  20022. const XW = whitePoint[0];
  20023. const YW = whitePoint[1];
  20024. const ZW = whitePoint[2];
  20025. this.whitePoint = whitePoint;
  20026. const XB = blackPoint[0];
  20027. const YB = blackPoint[1];
  20028. const ZB = blackPoint[2];
  20029. this.blackPoint = blackPoint;
  20030. this.GR = gamma[0];
  20031. this.GG = gamma[1];
  20032. this.GB = gamma[2];
  20033. this.MXA = matrix[0];
  20034. this.MYA = matrix[1];
  20035. this.MZA = matrix[2];
  20036. this.MXB = matrix[3];
  20037. this.MYB = matrix[4];
  20038. this.MZB = matrix[5];
  20039. this.MXC = matrix[6];
  20040. this.MYC = matrix[7];
  20041. this.MZC = matrix[8];
  20042. if (XW < 0 || ZW < 0 || YW !== 1) {
  20043. throw new _util.FormatError(`Invalid WhitePoint components for ${this.name}` + ", no fallback available");
  20044. }
  20045. if (XB < 0 || YB < 0 || ZB < 0) {
  20046. (0, _util.info)(`Invalid BlackPoint for ${this.name} [${XB}, ${YB}, ${ZB}], ` + "falling back to default.");
  20047. this.blackPoint = new Float32Array(3);
  20048. }
  20049. if (this.GR < 0 || this.GG < 0 || this.GB < 0) {
  20050. (0, _util.info)(`Invalid Gamma [${this.GR}, ${this.GG}, ${this.GB}] for ` + `${this.name}, falling back to default.`);
  20051. this.GR = this.GG = this.GB = 1;
  20052. }
  20053. }
  20054. getRgbItem(src, srcOffset, dest, destOffset) {
  20055. convertToRgb(this, src, srcOffset, dest, destOffset, 1);
  20056. }
  20057. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20058. const scale = 1 / ((1 << bits) - 1);
  20059. for (let i = 0; i < count; ++i) {
  20060. convertToRgb(this, src, srcOffset, dest, destOffset, scale);
  20061. srcOffset += 3;
  20062. destOffset += 3 + alpha01;
  20063. }
  20064. }
  20065. getOutputLength(inputLength, alpha01) {
  20066. return inputLength * (3 + alpha01) / 3 | 0;
  20067. }
  20068. }
  20069. return CalRGBCS;
  20070. }();
  20071. const LabCS = function LabCSClosure() {
  20072. function fn_g(x) {
  20073. let result;
  20074. if (x >= 6 / 29) {
  20075. result = x ** 3;
  20076. } else {
  20077. result = 108 / 841 * (x - 4 / 29);
  20078. }
  20079. return result;
  20080. }
  20081. function decode(value, high1, low2, high2) {
  20082. return low2 + value * (high2 - low2) / high1;
  20083. }
  20084. function convertToRgb(cs, src, srcOffset, maxVal, dest, destOffset) {
  20085. let Ls = src[srcOffset];
  20086. let as = src[srcOffset + 1];
  20087. let bs = src[srcOffset + 2];
  20088. if (maxVal !== false) {
  20089. Ls = decode(Ls, maxVal, 0, 100);
  20090. as = decode(as, maxVal, cs.amin, cs.amax);
  20091. bs = decode(bs, maxVal, cs.bmin, cs.bmax);
  20092. }
  20093. if (as > cs.amax) {
  20094. as = cs.amax;
  20095. } else if (as < cs.amin) {
  20096. as = cs.amin;
  20097. }
  20098. if (bs > cs.bmax) {
  20099. bs = cs.bmax;
  20100. } else if (bs < cs.bmin) {
  20101. bs = cs.bmin;
  20102. }
  20103. const M = (Ls + 16) / 116;
  20104. const L = M + as / 500;
  20105. const N = M - bs / 200;
  20106. const X = cs.XW * fn_g(L);
  20107. const Y = cs.YW * fn_g(M);
  20108. const Z = cs.ZW * fn_g(N);
  20109. let r, g, b;
  20110. if (cs.ZW < 1) {
  20111. r = X * 3.1339 + Y * -1.617 + Z * -0.4906;
  20112. g = X * -0.9785 + Y * 1.916 + Z * 0.0333;
  20113. b = X * 0.072 + Y * -0.229 + Z * 1.4057;
  20114. } else {
  20115. r = X * 3.2406 + Y * -1.5372 + Z * -0.4986;
  20116. g = X * -0.9689 + Y * 1.8758 + Z * 0.0415;
  20117. b = X * 0.0557 + Y * -0.204 + Z * 1.057;
  20118. }
  20119. dest[destOffset] = Math.sqrt(r) * 255;
  20120. dest[destOffset + 1] = Math.sqrt(g) * 255;
  20121. dest[destOffset + 2] = Math.sqrt(b) * 255;
  20122. }
  20123. class LabCS extends ColorSpace {
  20124. constructor(whitePoint, blackPoint, range) {
  20125. super("Lab", 3);
  20126. if (!whitePoint) {
  20127. throw new _util.FormatError("WhitePoint missing - required for color space Lab");
  20128. }
  20129. blackPoint = blackPoint || [0, 0, 0];
  20130. range = range || [-100, 100, -100, 100];
  20131. this.XW = whitePoint[0];
  20132. this.YW = whitePoint[1];
  20133. this.ZW = whitePoint[2];
  20134. this.amin = range[0];
  20135. this.amax = range[1];
  20136. this.bmin = range[2];
  20137. this.bmax = range[3];
  20138. this.XB = blackPoint[0];
  20139. this.YB = blackPoint[1];
  20140. this.ZB = blackPoint[2];
  20141. if (this.XW < 0 || this.ZW < 0 || this.YW !== 1) {
  20142. throw new _util.FormatError("Invalid WhitePoint components, no fallback available");
  20143. }
  20144. if (this.XB < 0 || this.YB < 0 || this.ZB < 0) {
  20145. (0, _util.info)("Invalid BlackPoint, falling back to default");
  20146. this.XB = this.YB = this.ZB = 0;
  20147. }
  20148. if (this.amin > this.amax || this.bmin > this.bmax) {
  20149. (0, _util.info)("Invalid Range, falling back to defaults");
  20150. this.amin = -100;
  20151. this.amax = 100;
  20152. this.bmin = -100;
  20153. this.bmax = 100;
  20154. }
  20155. }
  20156. getRgbItem(src, srcOffset, dest, destOffset) {
  20157. convertToRgb(this, src, srcOffset, false, dest, destOffset);
  20158. }
  20159. getRgbBuffer(src, srcOffset, count, dest, destOffset, bits, alpha01) {
  20160. const maxVal = (1 << bits) - 1;
  20161. for (let i = 0; i < count; i++) {
  20162. convertToRgb(this, src, srcOffset, maxVal, dest, destOffset);
  20163. srcOffset += 3;
  20164. destOffset += 3 + alpha01;
  20165. }
  20166. }
  20167. getOutputLength(inputLength, alpha01) {
  20168. return inputLength * (3 + alpha01) / 3 | 0;
  20169. }
  20170. isDefaultDecode(decodeMap, bpc) {
  20171. return true;
  20172. }
  20173. get usesZeroToOneRange() {
  20174. return (0, _util.shadow)(this, "usesZeroToOneRange", false);
  20175. }
  20176. }
  20177. return LabCS;
  20178. }();
  20179. /***/ }),
  20180. /* 25 */
  20181. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  20182. Object.defineProperty(exports, "__esModule", ({
  20183. value: true
  20184. }));
  20185. exports.PartialEvaluator = exports.EvaluatorPreprocessor = void 0;
  20186. var _util = __w_pdfjs_require__(2);
  20187. var _cmap = __w_pdfjs_require__(26);
  20188. var _primitives = __w_pdfjs_require__(5);
  20189. var _fonts = __w_pdfjs_require__(44);
  20190. var _fonts_utils = __w_pdfjs_require__(18);
  20191. var _encodings = __w_pdfjs_require__(19);
  20192. var _standard_fonts = __w_pdfjs_require__(47);
  20193. var _unicode = __w_pdfjs_require__(21);
  20194. var _pattern = __w_pdfjs_require__(56);
  20195. var _xfa_fonts = __w_pdfjs_require__(12);
  20196. var _to_unicode_map = __w_pdfjs_require__(48);
  20197. var _function = __w_pdfjs_require__(57);
  20198. var _parser = __w_pdfjs_require__(27);
  20199. var _image_utils = __w_pdfjs_require__(59);
  20200. var _stream = __w_pdfjs_require__(10);
  20201. var _base_stream = __w_pdfjs_require__(9);
  20202. var _bidi = __w_pdfjs_require__(60);
  20203. var _colorspace = __w_pdfjs_require__(24);
  20204. var _decode_stream = __w_pdfjs_require__(29);
  20205. var _glyphlist = __w_pdfjs_require__(20);
  20206. var _core_utils = __w_pdfjs_require__(8);
  20207. var _metrics = __w_pdfjs_require__(51);
  20208. var _murmurhash = __w_pdfjs_require__(61);
  20209. var _operator_list = __w_pdfjs_require__(62);
  20210. var _image = __w_pdfjs_require__(63);
  20211. const DefaultPartialEvaluatorOptions = Object.freeze({
  20212. maxImageSize: -1,
  20213. disableFontFace: false,
  20214. ignoreErrors: false,
  20215. isEvalSupported: true,
  20216. fontExtraProperties: false,
  20217. useSystemFonts: true,
  20218. cMapUrl: null,
  20219. standardFontDataUrl: null
  20220. });
  20221. const PatternType = {
  20222. TILING: 1,
  20223. SHADING: 2
  20224. };
  20225. const TEXT_CHUNK_BATCH_SIZE = 10;
  20226. const deferred = Promise.resolve();
  20227. function normalizeBlendMode(value, parsingArray = false) {
  20228. if (Array.isArray(value)) {
  20229. for (let i = 0, ii = value.length; i < ii; i++) {
  20230. const maybeBM = normalizeBlendMode(value[i], true);
  20231. if (maybeBM) {
  20232. return maybeBM;
  20233. }
  20234. }
  20235. (0, _util.warn)(`Unsupported blend mode Array: ${value}`);
  20236. return "source-over";
  20237. }
  20238. if (!(value instanceof _primitives.Name)) {
  20239. if (parsingArray) {
  20240. return null;
  20241. }
  20242. return "source-over";
  20243. }
  20244. switch (value.name) {
  20245. case "Normal":
  20246. case "Compatible":
  20247. return "source-over";
  20248. case "Multiply":
  20249. return "multiply";
  20250. case "Screen":
  20251. return "screen";
  20252. case "Overlay":
  20253. return "overlay";
  20254. case "Darken":
  20255. return "darken";
  20256. case "Lighten":
  20257. return "lighten";
  20258. case "ColorDodge":
  20259. return "color-dodge";
  20260. case "ColorBurn":
  20261. return "color-burn";
  20262. case "HardLight":
  20263. return "hard-light";
  20264. case "SoftLight":
  20265. return "soft-light";
  20266. case "Difference":
  20267. return "difference";
  20268. case "Exclusion":
  20269. return "exclusion";
  20270. case "Hue":
  20271. return "hue";
  20272. case "Saturation":
  20273. return "saturation";
  20274. case "Color":
  20275. return "color";
  20276. case "Luminosity":
  20277. return "luminosity";
  20278. }
  20279. if (parsingArray) {
  20280. return null;
  20281. }
  20282. (0, _util.warn)(`Unsupported blend mode: ${value.name}`);
  20283. return "source-over";
  20284. }
  20285. function incrementCachedImageMaskCount(data) {
  20286. if (data.fn === _util.OPS.paintImageMaskXObject && data.args[0] && data.args[0].count > 0) {
  20287. data.args[0].count++;
  20288. }
  20289. }
  20290. class TimeSlotManager {
  20291. static get TIME_SLOT_DURATION_MS() {
  20292. return (0, _util.shadow)(this, "TIME_SLOT_DURATION_MS", 20);
  20293. }
  20294. static get CHECK_TIME_EVERY() {
  20295. return (0, _util.shadow)(this, "CHECK_TIME_EVERY", 100);
  20296. }
  20297. constructor() {
  20298. this.reset();
  20299. }
  20300. check() {
  20301. if (++this.checked < TimeSlotManager.CHECK_TIME_EVERY) {
  20302. return false;
  20303. }
  20304. this.checked = 0;
  20305. return this.endTime <= Date.now();
  20306. }
  20307. reset() {
  20308. this.endTime = Date.now() + TimeSlotManager.TIME_SLOT_DURATION_MS;
  20309. this.checked = 0;
  20310. }
  20311. }
  20312. class PartialEvaluator {
  20313. constructor({
  20314. xref,
  20315. handler,
  20316. pageIndex,
  20317. idFactory,
  20318. fontCache,
  20319. builtInCMapCache,
  20320. standardFontDataCache,
  20321. globalImageCache,
  20322. options = null
  20323. }) {
  20324. this.xref = xref;
  20325. this.handler = handler;
  20326. this.pageIndex = pageIndex;
  20327. this.idFactory = idFactory;
  20328. this.fontCache = fontCache;
  20329. this.builtInCMapCache = builtInCMapCache;
  20330. this.standardFontDataCache = standardFontDataCache;
  20331. this.globalImageCache = globalImageCache;
  20332. this.options = options || DefaultPartialEvaluatorOptions;
  20333. this.parsingType3Font = false;
  20334. this._fetchBuiltInCMapBound = this.fetchBuiltInCMap.bind(this);
  20335. }
  20336. get _pdfFunctionFactory() {
  20337. const pdfFunctionFactory = new _function.PDFFunctionFactory({
  20338. xref: this.xref,
  20339. isEvalSupported: this.options.isEvalSupported
  20340. });
  20341. return (0, _util.shadow)(this, "_pdfFunctionFactory", pdfFunctionFactory);
  20342. }
  20343. clone(newOptions = null) {
  20344. const newEvaluator = Object.create(this);
  20345. newEvaluator.options = Object.assign(Object.create(null), this.options, newOptions);
  20346. return newEvaluator;
  20347. }
  20348. hasBlendModes(resources, nonBlendModesSet) {
  20349. if (!(resources instanceof _primitives.Dict)) {
  20350. return false;
  20351. }
  20352. if (resources.objId && nonBlendModesSet.has(resources.objId)) {
  20353. return false;
  20354. }
  20355. const processed = new _primitives.RefSet(nonBlendModesSet);
  20356. if (resources.objId) {
  20357. processed.put(resources.objId);
  20358. }
  20359. const nodes = [resources],
  20360. xref = this.xref;
  20361. while (nodes.length) {
  20362. const node = nodes.shift();
  20363. const graphicStates = node.get("ExtGState");
  20364. if (graphicStates instanceof _primitives.Dict) {
  20365. for (let graphicState of graphicStates.getRawValues()) {
  20366. if (graphicState instanceof _primitives.Ref) {
  20367. if (processed.has(graphicState)) {
  20368. continue;
  20369. }
  20370. try {
  20371. graphicState = xref.fetch(graphicState);
  20372. } catch (ex) {
  20373. processed.put(graphicState);
  20374. (0, _util.info)(`hasBlendModes - ignoring ExtGState: "${ex}".`);
  20375. continue;
  20376. }
  20377. }
  20378. if (!(graphicState instanceof _primitives.Dict)) {
  20379. continue;
  20380. }
  20381. if (graphicState.objId) {
  20382. processed.put(graphicState.objId);
  20383. }
  20384. const bm = graphicState.get("BM");
  20385. if (bm instanceof _primitives.Name) {
  20386. if (bm.name !== "Normal") {
  20387. return true;
  20388. }
  20389. continue;
  20390. }
  20391. if (bm !== undefined && Array.isArray(bm)) {
  20392. for (const element of bm) {
  20393. if (element instanceof _primitives.Name && element.name !== "Normal") {
  20394. return true;
  20395. }
  20396. }
  20397. }
  20398. }
  20399. }
  20400. const xObjects = node.get("XObject");
  20401. if (!(xObjects instanceof _primitives.Dict)) {
  20402. continue;
  20403. }
  20404. for (let xObject of xObjects.getRawValues()) {
  20405. if (xObject instanceof _primitives.Ref) {
  20406. if (processed.has(xObject)) {
  20407. continue;
  20408. }
  20409. try {
  20410. xObject = xref.fetch(xObject);
  20411. } catch (ex) {
  20412. processed.put(xObject);
  20413. (0, _util.info)(`hasBlendModes - ignoring XObject: "${ex}".`);
  20414. continue;
  20415. }
  20416. }
  20417. if (!(xObject instanceof _base_stream.BaseStream)) {
  20418. continue;
  20419. }
  20420. if (xObject.dict.objId) {
  20421. processed.put(xObject.dict.objId);
  20422. }
  20423. const xResources = xObject.dict.get("Resources");
  20424. if (!(xResources instanceof _primitives.Dict)) {
  20425. continue;
  20426. }
  20427. if (xResources.objId && processed.has(xResources.objId)) {
  20428. continue;
  20429. }
  20430. nodes.push(xResources);
  20431. if (xResources.objId) {
  20432. processed.put(xResources.objId);
  20433. }
  20434. }
  20435. }
  20436. for (const ref of processed) {
  20437. nonBlendModesSet.put(ref);
  20438. }
  20439. return false;
  20440. }
  20441. async fetchBuiltInCMap(name) {
  20442. const cachedData = this.builtInCMapCache.get(name);
  20443. if (cachedData) {
  20444. return cachedData;
  20445. }
  20446. let data;
  20447. if (this.options.cMapUrl !== null) {
  20448. const url = `${this.options.cMapUrl}${name}.bcmap`;
  20449. const response = await fetch(url);
  20450. if (!response.ok) {
  20451. throw new Error(`fetchBuiltInCMap: failed to fetch file "${url}" with "${response.statusText}".`);
  20452. }
  20453. data = {
  20454. cMapData: new Uint8Array(await response.arrayBuffer()),
  20455. compressionType: _util.CMapCompressionType.BINARY
  20456. };
  20457. } else {
  20458. data = await this.handler.sendWithPromise("FetchBuiltInCMap", {
  20459. name
  20460. });
  20461. }
  20462. if (data.compressionType !== _util.CMapCompressionType.NONE) {
  20463. this.builtInCMapCache.set(name, data);
  20464. }
  20465. return data;
  20466. }
  20467. async fetchStandardFontData(name) {
  20468. const cachedData = this.standardFontDataCache.get(name);
  20469. if (cachedData) {
  20470. return new _stream.Stream(cachedData);
  20471. }
  20472. if (this.options.useSystemFonts && name !== "Symbol" && name !== "ZapfDingbats") {
  20473. return null;
  20474. }
  20475. const standardFontNameToFileName = (0, _standard_fonts.getFontNameToFileMap)(),
  20476. filename = standardFontNameToFileName[name];
  20477. let data;
  20478. if (this.options.standardFontDataUrl !== null) {
  20479. const url = `${this.options.standardFontDataUrl}${filename}`;
  20480. const response = await fetch(url);
  20481. if (!response.ok) {
  20482. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${url}" with "${response.statusText}".`);
  20483. } else {
  20484. data = await response.arrayBuffer();
  20485. }
  20486. } else {
  20487. try {
  20488. data = await this.handler.sendWithPromise("FetchStandardFontData", {
  20489. filename
  20490. });
  20491. } catch (e) {
  20492. (0, _util.warn)(`fetchStandardFontData: failed to fetch file "${filename}" with "${e}".`);
  20493. }
  20494. }
  20495. if (!data) {
  20496. return null;
  20497. }
  20498. this.standardFontDataCache.set(name, data);
  20499. return new _stream.Stream(data);
  20500. }
  20501. async buildFormXObject(resources, xobj, smask, operatorList, task, initialState, localColorSpaceCache) {
  20502. const dict = xobj.dict;
  20503. const matrix = dict.getArray("Matrix");
  20504. let bbox = dict.getArray("BBox");
  20505. if (Array.isArray(bbox) && bbox.length === 4) {
  20506. bbox = _util.Util.normalizeRect(bbox);
  20507. } else {
  20508. bbox = null;
  20509. }
  20510. let optionalContent, groupOptions;
  20511. if (dict.has("OC")) {
  20512. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20513. }
  20514. if (optionalContent !== undefined) {
  20515. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  20516. }
  20517. const group = dict.get("Group");
  20518. if (group) {
  20519. groupOptions = {
  20520. matrix,
  20521. bbox,
  20522. smask,
  20523. isolated: false,
  20524. knockout: false
  20525. };
  20526. const groupSubtype = group.get("S");
  20527. let colorSpace = null;
  20528. if ((0, _primitives.isName)(groupSubtype, "Transparency")) {
  20529. groupOptions.isolated = group.get("I") || false;
  20530. groupOptions.knockout = group.get("K") || false;
  20531. if (group.has("CS")) {
  20532. const cs = group.getRaw("CS");
  20533. const cachedColorSpace = _colorspace.ColorSpace.getCached(cs, this.xref, localColorSpaceCache);
  20534. if (cachedColorSpace) {
  20535. colorSpace = cachedColorSpace;
  20536. } else {
  20537. colorSpace = await this.parseColorSpace({
  20538. cs,
  20539. resources,
  20540. localColorSpaceCache
  20541. });
  20542. }
  20543. }
  20544. }
  20545. if (smask && smask.backdrop) {
  20546. colorSpace = colorSpace || _colorspace.ColorSpace.singletons.rgb;
  20547. smask.backdrop = colorSpace.getRgb(smask.backdrop, 0);
  20548. }
  20549. operatorList.addOp(_util.OPS.beginGroup, [groupOptions]);
  20550. }
  20551. const args = group ? [matrix, null] : [matrix, bbox];
  20552. operatorList.addOp(_util.OPS.paintFormXObjectBegin, args);
  20553. return this.getOperatorList({
  20554. stream: xobj,
  20555. task,
  20556. resources: dict.get("Resources") || resources,
  20557. operatorList,
  20558. initialState
  20559. }).then(function () {
  20560. operatorList.addOp(_util.OPS.paintFormXObjectEnd, []);
  20561. if (group) {
  20562. operatorList.addOp(_util.OPS.endGroup, [groupOptions]);
  20563. }
  20564. if (optionalContent !== undefined) {
  20565. operatorList.addOp(_util.OPS.endMarkedContent, []);
  20566. }
  20567. });
  20568. }
  20569. _sendImgData(objId, imgData, cacheGlobally = false) {
  20570. const transfers = imgData ? [imgData.bitmap || imgData.data.buffer] : null;
  20571. if (this.parsingType3Font || cacheGlobally) {
  20572. return this.handler.send("commonobj", [objId, "Image", imgData], transfers);
  20573. }
  20574. return this.handler.send("obj", [objId, this.pageIndex, "Image", imgData], transfers);
  20575. }
  20576. async buildPaintImageXObject({
  20577. resources,
  20578. image,
  20579. isInline = false,
  20580. operatorList,
  20581. cacheKey,
  20582. localImageCache,
  20583. localColorSpaceCache
  20584. }) {
  20585. const dict = image.dict;
  20586. const imageRef = dict.objId;
  20587. const w = dict.get("W", "Width");
  20588. const h = dict.get("H", "Height");
  20589. if (!(w && typeof w === "number") || !(h && typeof h === "number")) {
  20590. (0, _util.warn)("Image dimensions are missing, or not numbers.");
  20591. return;
  20592. }
  20593. const maxImageSize = this.options.maxImageSize;
  20594. if (maxImageSize !== -1 && w * h > maxImageSize) {
  20595. const msg = "Image exceeded maximum allowed size and was removed.";
  20596. if (this.options.ignoreErrors) {
  20597. (0, _util.warn)(msg);
  20598. return;
  20599. }
  20600. throw new Error(msg);
  20601. }
  20602. let optionalContent;
  20603. if (dict.has("OC")) {
  20604. optionalContent = await this.parseMarkedContentProps(dict.get("OC"), resources);
  20605. }
  20606. const imageMask = dict.get("IM", "ImageMask") || false;
  20607. let imgData, args;
  20608. if (imageMask) {
  20609. const interpolate = dict.get("I", "Interpolate");
  20610. const bitStrideLength = w + 7 >> 3;
  20611. const imgArray = image.getBytes(bitStrideLength * h);
  20612. const decode = dict.getArray("D", "Decode");
  20613. if (this.parsingType3Font) {
  20614. imgData = _image.PDFImage.createRawMask({
  20615. imgArray,
  20616. width: w,
  20617. height: h,
  20618. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20619. inverseDecode: !!decode && decode[0] > 0,
  20620. interpolate
  20621. });
  20622. imgData.cached = !!cacheKey;
  20623. args = [imgData];
  20624. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  20625. if (cacheKey) {
  20626. localImageCache.set(cacheKey, imageRef, {
  20627. fn: _util.OPS.paintImageMaskXObject,
  20628. args,
  20629. optionalContent
  20630. });
  20631. }
  20632. return;
  20633. }
  20634. imgData = _image.PDFImage.createMask({
  20635. imgArray,
  20636. width: w,
  20637. height: h,
  20638. imageIsFromDecodeStream: image instanceof _decode_stream.DecodeStream,
  20639. inverseDecode: !!decode && decode[0] > 0,
  20640. interpolate
  20641. });
  20642. if (imgData.isSingleOpaquePixel) {
  20643. operatorList.addImageOps(_util.OPS.paintSolidColorImageMask, [], optionalContent);
  20644. if (cacheKey) {
  20645. localImageCache.set(cacheKey, imageRef, {
  20646. fn: _util.OPS.paintSolidColorImageMask,
  20647. args: [],
  20648. optionalContent
  20649. });
  20650. }
  20651. return;
  20652. }
  20653. const objId = `mask_${this.idFactory.createObjId()}`;
  20654. operatorList.addDependency(objId);
  20655. this._sendImgData(objId, imgData);
  20656. args = [{
  20657. data: objId,
  20658. width: imgData.width,
  20659. height: imgData.height,
  20660. interpolate: imgData.interpolate,
  20661. count: 1
  20662. }];
  20663. operatorList.addImageOps(_util.OPS.paintImageMaskXObject, args, optionalContent);
  20664. if (cacheKey) {
  20665. localImageCache.set(cacheKey, imageRef, {
  20666. fn: _util.OPS.paintImageMaskXObject,
  20667. args,
  20668. optionalContent
  20669. });
  20670. }
  20671. return;
  20672. }
  20673. const softMask = dict.get("SM", "SMask") || false;
  20674. const mask = dict.get("Mask") || false;
  20675. const SMALL_IMAGE_DIMENSIONS = 200;
  20676. if (isInline && !softMask && !mask && w + h < SMALL_IMAGE_DIMENSIONS) {
  20677. const imageObj = new _image.PDFImage({
  20678. xref: this.xref,
  20679. res: resources,
  20680. image,
  20681. isInline,
  20682. pdfFunctionFactory: this._pdfFunctionFactory,
  20683. localColorSpaceCache
  20684. });
  20685. imgData = imageObj.createImageData(true);
  20686. operatorList.addImageOps(_util.OPS.paintInlineImageXObject, [imgData], optionalContent);
  20687. return;
  20688. }
  20689. let objId = `img_${this.idFactory.createObjId()}`,
  20690. cacheGlobally = false;
  20691. if (this.parsingType3Font) {
  20692. objId = `${this.idFactory.getDocId()}_type3_${objId}`;
  20693. } else if (imageRef) {
  20694. cacheGlobally = this.globalImageCache.shouldCache(imageRef, this.pageIndex);
  20695. if (cacheGlobally) {
  20696. objId = `${this.idFactory.getDocId()}_${objId}`;
  20697. }
  20698. }
  20699. operatorList.addDependency(objId);
  20700. args = [objId, w, h];
  20701. _image.PDFImage.buildImage({
  20702. xref: this.xref,
  20703. res: resources,
  20704. image,
  20705. isInline,
  20706. pdfFunctionFactory: this._pdfFunctionFactory,
  20707. localColorSpaceCache
  20708. }).then(imageObj => {
  20709. imgData = imageObj.createImageData(false);
  20710. if (cacheKey && imageRef && cacheGlobally) {
  20711. this.globalImageCache.addByteSize(imageRef, imgData.data.length);
  20712. }
  20713. return this._sendImgData(objId, imgData, cacheGlobally);
  20714. }).catch(reason => {
  20715. (0, _util.warn)(`Unable to decode image "${objId}": "${reason}".`);
  20716. return this._sendImgData(objId, null, cacheGlobally);
  20717. });
  20718. operatorList.addImageOps(_util.OPS.paintImageXObject, args, optionalContent);
  20719. if (cacheKey) {
  20720. localImageCache.set(cacheKey, imageRef, {
  20721. fn: _util.OPS.paintImageXObject,
  20722. args,
  20723. optionalContent
  20724. });
  20725. if (imageRef) {
  20726. (0, _util.assert)(!isInline, "Cannot cache an inline image globally.");
  20727. this.globalImageCache.addPageIndex(imageRef, this.pageIndex);
  20728. if (cacheGlobally) {
  20729. this.globalImageCache.setData(imageRef, {
  20730. objId,
  20731. fn: _util.OPS.paintImageXObject,
  20732. args,
  20733. optionalContent,
  20734. byteSize: 0
  20735. });
  20736. }
  20737. }
  20738. }
  20739. }
  20740. handleSMask(smask, resources, operatorList, task, stateManager, localColorSpaceCache) {
  20741. const smaskContent = smask.get("G");
  20742. const smaskOptions = {
  20743. subtype: smask.get("S").name,
  20744. backdrop: smask.get("BC")
  20745. };
  20746. const transferObj = smask.get("TR");
  20747. if ((0, _function.isPDFFunction)(transferObj)) {
  20748. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20749. const transferMap = new Uint8Array(256);
  20750. const tmp = new Float32Array(1);
  20751. for (let i = 0; i < 256; i++) {
  20752. tmp[0] = i / 255;
  20753. transferFn(tmp, 0, tmp, 0);
  20754. transferMap[i] = tmp[0] * 255 | 0;
  20755. }
  20756. smaskOptions.transferMap = transferMap;
  20757. }
  20758. return this.buildFormXObject(resources, smaskContent, smaskOptions, operatorList, task, stateManager.state.clone(), localColorSpaceCache);
  20759. }
  20760. handleTransferFunction(tr) {
  20761. let transferArray;
  20762. if (Array.isArray(tr)) {
  20763. transferArray = tr;
  20764. } else if ((0, _function.isPDFFunction)(tr)) {
  20765. transferArray = [tr];
  20766. } else {
  20767. return null;
  20768. }
  20769. const transferMaps = [];
  20770. let numFns = 0,
  20771. numEffectfulFns = 0;
  20772. for (const entry of transferArray) {
  20773. const transferObj = this.xref.fetchIfRef(entry);
  20774. numFns++;
  20775. if ((0, _primitives.isName)(transferObj, "Identity")) {
  20776. transferMaps.push(null);
  20777. continue;
  20778. } else if (!(0, _function.isPDFFunction)(transferObj)) {
  20779. return null;
  20780. }
  20781. const transferFn = this._pdfFunctionFactory.create(transferObj);
  20782. const transferMap = new Uint8Array(256),
  20783. tmp = new Float32Array(1);
  20784. for (let j = 0; j < 256; j++) {
  20785. tmp[0] = j / 255;
  20786. transferFn(tmp, 0, tmp, 0);
  20787. transferMap[j] = tmp[0] * 255 | 0;
  20788. }
  20789. transferMaps.push(transferMap);
  20790. numEffectfulFns++;
  20791. }
  20792. if (!(numFns === 1 || numFns === 4)) {
  20793. return null;
  20794. }
  20795. if (numEffectfulFns === 0) {
  20796. return null;
  20797. }
  20798. return transferMaps;
  20799. }
  20800. handleTilingType(fn, color, resources, pattern, patternDict, operatorList, task, localTilingPatternCache) {
  20801. const tilingOpList = new _operator_list.OperatorList();
  20802. const patternResources = _primitives.Dict.merge({
  20803. xref: this.xref,
  20804. dictArray: [patternDict.get("Resources"), resources]
  20805. });
  20806. return this.getOperatorList({
  20807. stream: pattern,
  20808. task,
  20809. resources: patternResources,
  20810. operatorList: tilingOpList
  20811. }).then(function () {
  20812. const operatorListIR = tilingOpList.getIR();
  20813. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(operatorListIR, patternDict, color);
  20814. operatorList.addDependencies(tilingOpList.dependencies);
  20815. operatorList.addOp(fn, tilingPatternIR);
  20816. if (patternDict.objId) {
  20817. localTilingPatternCache.set(null, patternDict.objId, {
  20818. operatorListIR,
  20819. dict: patternDict
  20820. });
  20821. }
  20822. }).catch(reason => {
  20823. if (reason instanceof _util.AbortException) {
  20824. return;
  20825. }
  20826. if (this.options.ignoreErrors) {
  20827. this.handler.send("UnsupportedFeature", {
  20828. featureId: _util.UNSUPPORTED_FEATURES.errorTilingPattern
  20829. });
  20830. (0, _util.warn)(`handleTilingType - ignoring pattern: "${reason}".`);
  20831. return;
  20832. }
  20833. throw reason;
  20834. });
  20835. }
  20836. handleSetFont(resources, fontArgs, fontRef, operatorList, task, state, fallbackFontDict = null, cssFontInfo = null) {
  20837. const fontName = fontArgs && fontArgs[0] instanceof _primitives.Name ? fontArgs[0].name : null;
  20838. return this.loadFont(fontName, fontRef, resources, fallbackFontDict, cssFontInfo).then(translated => {
  20839. if (!translated.font.isType3Font) {
  20840. return translated;
  20841. }
  20842. return translated.loadType3Data(this, resources, task).then(function () {
  20843. operatorList.addDependencies(translated.type3Dependencies);
  20844. return translated;
  20845. }).catch(reason => {
  20846. this.handler.send("UnsupportedFeature", {
  20847. featureId: _util.UNSUPPORTED_FEATURES.errorFontLoadType3
  20848. });
  20849. return new TranslatedFont({
  20850. loadedName: "g_font_error",
  20851. font: new _fonts.ErrorFont(`Type3 font load error: ${reason}`),
  20852. dict: translated.font,
  20853. evaluatorOptions: this.options
  20854. });
  20855. });
  20856. }).then(translated => {
  20857. state.font = translated.font;
  20858. translated.send(this.handler);
  20859. return translated.loadedName;
  20860. });
  20861. }
  20862. handleText(chars, state) {
  20863. const font = state.font;
  20864. const glyphs = font.charsToGlyphs(chars);
  20865. if (font.data) {
  20866. const isAddToPathSet = !!(state.textRenderingMode & _util.TextRenderingMode.ADD_TO_PATH_FLAG);
  20867. if (isAddToPathSet || state.fillColorSpace.name === "Pattern" || font.disableFontFace || this.options.disableFontFace) {
  20868. PartialEvaluator.buildFontPaths(font, glyphs, this.handler, this.options);
  20869. }
  20870. }
  20871. return glyphs;
  20872. }
  20873. ensureStateFont(state) {
  20874. if (state.font) {
  20875. return;
  20876. }
  20877. const reason = new _util.FormatError("Missing setFont (Tf) operator before text rendering operator.");
  20878. if (this.options.ignoreErrors) {
  20879. this.handler.send("UnsupportedFeature", {
  20880. featureId: _util.UNSUPPORTED_FEATURES.errorFontState
  20881. });
  20882. (0, _util.warn)(`ensureStateFont: "${reason}".`);
  20883. return;
  20884. }
  20885. throw reason;
  20886. }
  20887. async setGState({
  20888. resources,
  20889. gState,
  20890. operatorList,
  20891. cacheKey,
  20892. task,
  20893. stateManager,
  20894. localGStateCache,
  20895. localColorSpaceCache
  20896. }) {
  20897. const gStateRef = gState.objId;
  20898. let isSimpleGState = true;
  20899. const gStateObj = [];
  20900. const gStateKeys = gState.getKeys();
  20901. let promise = Promise.resolve();
  20902. for (let i = 0, ii = gStateKeys.length; i < ii; i++) {
  20903. const key = gStateKeys[i];
  20904. const value = gState.get(key);
  20905. switch (key) {
  20906. case "Type":
  20907. break;
  20908. case "LW":
  20909. case "LC":
  20910. case "LJ":
  20911. case "ML":
  20912. case "D":
  20913. case "RI":
  20914. case "FL":
  20915. case "CA":
  20916. case "ca":
  20917. gStateObj.push([key, value]);
  20918. break;
  20919. case "Font":
  20920. isSimpleGState = false;
  20921. promise = promise.then(() => {
  20922. return this.handleSetFont(resources, null, value[0], operatorList, task, stateManager.state).then(function (loadedName) {
  20923. operatorList.addDependency(loadedName);
  20924. gStateObj.push([key, [loadedName, value[1]]]);
  20925. });
  20926. });
  20927. break;
  20928. case "BM":
  20929. gStateObj.push([key, normalizeBlendMode(value)]);
  20930. break;
  20931. case "SMask":
  20932. if ((0, _primitives.isName)(value, "None")) {
  20933. gStateObj.push([key, false]);
  20934. break;
  20935. }
  20936. if (value instanceof _primitives.Dict) {
  20937. isSimpleGState = false;
  20938. promise = promise.then(() => {
  20939. return this.handleSMask(value, resources, operatorList, task, stateManager, localColorSpaceCache);
  20940. });
  20941. gStateObj.push([key, true]);
  20942. } else {
  20943. (0, _util.warn)("Unsupported SMask type");
  20944. }
  20945. break;
  20946. case "TR":
  20947. const transferMaps = this.handleTransferFunction(value);
  20948. gStateObj.push([key, transferMaps]);
  20949. break;
  20950. case "OP":
  20951. case "op":
  20952. case "OPM":
  20953. case "BG":
  20954. case "BG2":
  20955. case "UCR":
  20956. case "UCR2":
  20957. case "TR2":
  20958. case "HT":
  20959. case "SM":
  20960. case "SA":
  20961. case "AIS":
  20962. case "TK":
  20963. (0, _util.info)("graphic state operator " + key);
  20964. break;
  20965. default:
  20966. (0, _util.info)("Unknown graphic state operator " + key);
  20967. break;
  20968. }
  20969. }
  20970. return promise.then(function () {
  20971. if (gStateObj.length > 0) {
  20972. operatorList.addOp(_util.OPS.setGState, [gStateObj]);
  20973. }
  20974. if (isSimpleGState) {
  20975. localGStateCache.set(cacheKey, gStateRef, gStateObj);
  20976. }
  20977. });
  20978. }
  20979. loadFont(fontName, font, resources, fallbackFontDict = null, cssFontInfo = null) {
  20980. const errorFont = async () => {
  20981. return new TranslatedFont({
  20982. loadedName: "g_font_error",
  20983. font: new _fonts.ErrorFont(`Font "${fontName}" is not available.`),
  20984. dict: font,
  20985. evaluatorOptions: this.options
  20986. });
  20987. };
  20988. const xref = this.xref;
  20989. let fontRef;
  20990. if (font) {
  20991. if (!(font instanceof _primitives.Ref)) {
  20992. throw new _util.FormatError('The "font" object should be a reference.');
  20993. }
  20994. fontRef = font;
  20995. } else {
  20996. const fontRes = resources.get("Font");
  20997. if (fontRes) {
  20998. fontRef = fontRes.getRaw(fontName);
  20999. }
  21000. }
  21001. if (!fontRef) {
  21002. const partialMsg = `Font "${fontName || font && font.toString()}" is not available`;
  21003. if (!this.options.ignoreErrors && !this.parsingType3Font) {
  21004. (0, _util.warn)(`${partialMsg}.`);
  21005. return errorFont();
  21006. }
  21007. this.handler.send("UnsupportedFeature", {
  21008. featureId: _util.UNSUPPORTED_FEATURES.errorFontMissing
  21009. });
  21010. (0, _util.warn)(`${partialMsg} -- attempting to fallback to a default font.`);
  21011. if (fallbackFontDict) {
  21012. fontRef = fallbackFontDict;
  21013. } else {
  21014. fontRef = PartialEvaluator.fallbackFontDict;
  21015. }
  21016. }
  21017. if (this.parsingType3Font && this.type3FontRefs.has(fontRef)) {
  21018. return errorFont();
  21019. }
  21020. if (this.fontCache.has(fontRef)) {
  21021. return this.fontCache.get(fontRef);
  21022. }
  21023. font = xref.fetchIfRef(fontRef);
  21024. if (!(font instanceof _primitives.Dict)) {
  21025. return errorFont();
  21026. }
  21027. if (font.cacheKey && this.fontCache.has(font.cacheKey)) {
  21028. return this.fontCache.get(font.cacheKey);
  21029. }
  21030. const fontCapability = (0, _util.createPromiseCapability)();
  21031. let preEvaluatedFont;
  21032. try {
  21033. preEvaluatedFont = this.preEvaluateFont(font);
  21034. preEvaluatedFont.cssFontInfo = cssFontInfo;
  21035. } catch (reason) {
  21036. (0, _util.warn)(`loadFont - preEvaluateFont failed: "${reason}".`);
  21037. return errorFont();
  21038. }
  21039. const {
  21040. descriptor,
  21041. hash
  21042. } = preEvaluatedFont;
  21043. const fontRefIsRef = fontRef instanceof _primitives.Ref;
  21044. let fontID;
  21045. if (fontRefIsRef) {
  21046. fontID = `f${fontRef.toString()}`;
  21047. }
  21048. if (hash && descriptor instanceof _primitives.Dict) {
  21049. if (!descriptor.fontAliases) {
  21050. descriptor.fontAliases = Object.create(null);
  21051. }
  21052. const fontAliases = descriptor.fontAliases;
  21053. if (fontAliases[hash]) {
  21054. const aliasFontRef = fontAliases[hash].aliasRef;
  21055. if (fontRefIsRef && aliasFontRef && this.fontCache.has(aliasFontRef)) {
  21056. this.fontCache.putAlias(fontRef, aliasFontRef);
  21057. return this.fontCache.get(fontRef);
  21058. }
  21059. } else {
  21060. fontAliases[hash] = {
  21061. fontID: this.idFactory.createFontId()
  21062. };
  21063. }
  21064. if (fontRefIsRef) {
  21065. fontAliases[hash].aliasRef = fontRef;
  21066. }
  21067. fontID = fontAliases[hash].fontID;
  21068. }
  21069. if (fontRefIsRef) {
  21070. this.fontCache.put(fontRef, fontCapability.promise);
  21071. } else {
  21072. if (!fontID) {
  21073. fontID = this.idFactory.createFontId();
  21074. }
  21075. font.cacheKey = `cacheKey_${fontID}`;
  21076. this.fontCache.put(font.cacheKey, fontCapability.promise);
  21077. }
  21078. (0, _util.assert)(fontID && fontID.startsWith("f"), 'The "fontID" must be (correctly) defined.');
  21079. font.loadedName = `${this.idFactory.getDocId()}_${fontID}`;
  21080. this.translateFont(preEvaluatedFont).then(translatedFont => {
  21081. if (translatedFont.fontType !== undefined) {
  21082. xref.stats.addFontType(translatedFont.fontType);
  21083. }
  21084. fontCapability.resolve(new TranslatedFont({
  21085. loadedName: font.loadedName,
  21086. font: translatedFont,
  21087. dict: font,
  21088. evaluatorOptions: this.options
  21089. }));
  21090. }).catch(reason => {
  21091. this.handler.send("UnsupportedFeature", {
  21092. featureId: _util.UNSUPPORTED_FEATURES.errorFontTranslate
  21093. });
  21094. (0, _util.warn)(`loadFont - translateFont failed: "${reason}".`);
  21095. try {
  21096. const fontFile3 = descriptor && descriptor.get("FontFile3");
  21097. const subtype = fontFile3 && fontFile3.get("Subtype");
  21098. const fontType = (0, _fonts_utils.getFontType)(preEvaluatedFont.type, subtype && subtype.name);
  21099. if (fontType !== undefined) {
  21100. xref.stats.addFontType(fontType);
  21101. }
  21102. } catch (ex) {}
  21103. fontCapability.resolve(new TranslatedFont({
  21104. loadedName: font.loadedName,
  21105. font: new _fonts.ErrorFont(reason instanceof Error ? reason.message : reason),
  21106. dict: font,
  21107. evaluatorOptions: this.options
  21108. }));
  21109. });
  21110. return fontCapability.promise;
  21111. }
  21112. buildPath(operatorList, fn, args, parsingText = false) {
  21113. const lastIndex = operatorList.length - 1;
  21114. if (!args) {
  21115. args = [];
  21116. }
  21117. let minMax;
  21118. if (lastIndex < 0 || operatorList.fnArray[lastIndex] !== _util.OPS.constructPath) {
  21119. if (parsingText) {
  21120. (0, _util.warn)(`Encountered path operator "${fn}" inside of a text object.`);
  21121. operatorList.addOp(_util.OPS.save, null);
  21122. }
  21123. minMax = [Infinity, -Infinity, Infinity, -Infinity];
  21124. operatorList.addOp(_util.OPS.constructPath, [[fn], args, minMax]);
  21125. if (parsingText) {
  21126. operatorList.addOp(_util.OPS.restore, null);
  21127. }
  21128. } else {
  21129. const opArgs = operatorList.argsArray[lastIndex];
  21130. opArgs[0].push(fn);
  21131. Array.prototype.push.apply(opArgs[1], args);
  21132. minMax = opArgs[2];
  21133. }
  21134. switch (fn) {
  21135. case _util.OPS.rectangle:
  21136. minMax[0] = Math.min(minMax[0], args[0], args[0] + args[2]);
  21137. minMax[1] = Math.max(minMax[1], args[0], args[0] + args[2]);
  21138. minMax[2] = Math.min(minMax[2], args[1], args[1] + args[3]);
  21139. minMax[3] = Math.max(minMax[3], args[1], args[1] + args[3]);
  21140. break;
  21141. case _util.OPS.moveTo:
  21142. case _util.OPS.lineTo:
  21143. minMax[0] = Math.min(minMax[0], args[0]);
  21144. minMax[1] = Math.max(minMax[1], args[0]);
  21145. minMax[2] = Math.min(minMax[2], args[1]);
  21146. minMax[3] = Math.max(minMax[3], args[1]);
  21147. break;
  21148. }
  21149. }
  21150. parseColorSpace({
  21151. cs,
  21152. resources,
  21153. localColorSpaceCache
  21154. }) {
  21155. return _colorspace.ColorSpace.parseAsync({
  21156. cs,
  21157. xref: this.xref,
  21158. resources,
  21159. pdfFunctionFactory: this._pdfFunctionFactory,
  21160. localColorSpaceCache
  21161. }).catch(reason => {
  21162. if (reason instanceof _util.AbortException) {
  21163. return null;
  21164. }
  21165. if (this.options.ignoreErrors) {
  21166. this.handler.send("UnsupportedFeature", {
  21167. featureId: _util.UNSUPPORTED_FEATURES.errorColorSpace
  21168. });
  21169. (0, _util.warn)(`parseColorSpace - ignoring ColorSpace: "${reason}".`);
  21170. return null;
  21171. }
  21172. throw reason;
  21173. });
  21174. }
  21175. parseShading({
  21176. shading,
  21177. resources,
  21178. localColorSpaceCache,
  21179. localShadingPatternCache
  21180. }) {
  21181. let id = localShadingPatternCache.get(shading);
  21182. if (!id) {
  21183. var shadingFill = _pattern.Pattern.parseShading(shading, this.xref, resources, this.handler, this._pdfFunctionFactory, localColorSpaceCache);
  21184. const patternIR = shadingFill.getIR();
  21185. id = `pattern_${this.idFactory.createObjId()}`;
  21186. localShadingPatternCache.set(shading, id);
  21187. this.handler.send("obj", [id, this.pageIndex, "Pattern", patternIR]);
  21188. }
  21189. return id;
  21190. }
  21191. handleColorN(operatorList, fn, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache) {
  21192. const patternName = args.pop();
  21193. if (patternName instanceof _primitives.Name) {
  21194. const rawPattern = patterns.getRaw(patternName.name);
  21195. const localTilingPattern = rawPattern instanceof _primitives.Ref && localTilingPatternCache.getByRef(rawPattern);
  21196. if (localTilingPattern) {
  21197. try {
  21198. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  21199. const tilingPatternIR = (0, _pattern.getTilingPatternIR)(localTilingPattern.operatorListIR, localTilingPattern.dict, color);
  21200. operatorList.addOp(fn, tilingPatternIR);
  21201. return undefined;
  21202. } catch (ex) {}
  21203. }
  21204. const pattern = this.xref.fetchIfRef(rawPattern);
  21205. if (pattern) {
  21206. const dict = pattern instanceof _base_stream.BaseStream ? pattern.dict : pattern;
  21207. const typeNum = dict.get("PatternType");
  21208. if (typeNum === PatternType.TILING) {
  21209. const color = cs.base ? cs.base.getRgb(args, 0) : null;
  21210. return this.handleTilingType(fn, color, resources, pattern, dict, operatorList, task, localTilingPatternCache);
  21211. } else if (typeNum === PatternType.SHADING) {
  21212. const shading = dict.get("Shading");
  21213. const matrix = dict.getArray("Matrix");
  21214. const objId = this.parseShading({
  21215. shading,
  21216. resources,
  21217. localColorSpaceCache,
  21218. localShadingPatternCache
  21219. });
  21220. operatorList.addOp(fn, ["Shading", objId, matrix]);
  21221. return undefined;
  21222. }
  21223. throw new _util.FormatError(`Unknown PatternType: ${typeNum}`);
  21224. }
  21225. }
  21226. throw new _util.FormatError(`Unknown PatternName: ${patternName}`);
  21227. }
  21228. _parseVisibilityExpression(array, nestingCounter, currentResult) {
  21229. const MAX_NESTING = 10;
  21230. if (++nestingCounter > MAX_NESTING) {
  21231. (0, _util.warn)("Visibility expression is too deeply nested");
  21232. return;
  21233. }
  21234. const length = array.length;
  21235. const operator = this.xref.fetchIfRef(array[0]);
  21236. if (length < 2 || !(operator instanceof _primitives.Name)) {
  21237. (0, _util.warn)("Invalid visibility expression");
  21238. return;
  21239. }
  21240. switch (operator.name) {
  21241. case "And":
  21242. case "Or":
  21243. case "Not":
  21244. currentResult.push(operator.name);
  21245. break;
  21246. default:
  21247. (0, _util.warn)(`Invalid operator ${operator.name} in visibility expression`);
  21248. return;
  21249. }
  21250. for (let i = 1; i < length; i++) {
  21251. const raw = array[i];
  21252. const object = this.xref.fetchIfRef(raw);
  21253. if (Array.isArray(object)) {
  21254. const nestedResult = [];
  21255. currentResult.push(nestedResult);
  21256. this._parseVisibilityExpression(object, nestingCounter, nestedResult);
  21257. } else if (raw instanceof _primitives.Ref) {
  21258. currentResult.push(raw.toString());
  21259. }
  21260. }
  21261. }
  21262. async parseMarkedContentProps(contentProperties, resources) {
  21263. let optionalContent;
  21264. if (contentProperties instanceof _primitives.Name) {
  21265. const properties = resources.get("Properties");
  21266. optionalContent = properties.get(contentProperties.name);
  21267. } else if (contentProperties instanceof _primitives.Dict) {
  21268. optionalContent = contentProperties;
  21269. } else {
  21270. throw new _util.FormatError("Optional content properties malformed.");
  21271. }
  21272. const optionalContentType = optionalContent.get("Type").name;
  21273. if (optionalContentType === "OCG") {
  21274. return {
  21275. type: optionalContentType,
  21276. id: optionalContent.objId
  21277. };
  21278. } else if (optionalContentType === "OCMD") {
  21279. const expression = optionalContent.get("VE");
  21280. if (Array.isArray(expression)) {
  21281. const result = [];
  21282. this._parseVisibilityExpression(expression, 0, result);
  21283. if (result.length > 0) {
  21284. return {
  21285. type: "OCMD",
  21286. expression: result
  21287. };
  21288. }
  21289. }
  21290. const optionalContentGroups = optionalContent.get("OCGs");
  21291. if (Array.isArray(optionalContentGroups) || optionalContentGroups instanceof _primitives.Dict) {
  21292. const groupIds = [];
  21293. if (Array.isArray(optionalContentGroups)) {
  21294. for (const ocg of optionalContentGroups) {
  21295. groupIds.push(ocg.toString());
  21296. }
  21297. } else {
  21298. groupIds.push(optionalContentGroups.objId);
  21299. }
  21300. return {
  21301. type: optionalContentType,
  21302. ids: groupIds,
  21303. policy: optionalContent.get("P") instanceof _primitives.Name ? optionalContent.get("P").name : null,
  21304. expression: null
  21305. };
  21306. } else if (optionalContentGroups instanceof _primitives.Ref) {
  21307. return {
  21308. type: optionalContentType,
  21309. id: optionalContentGroups.toString()
  21310. };
  21311. }
  21312. }
  21313. return null;
  21314. }
  21315. getOperatorList({
  21316. stream,
  21317. task,
  21318. resources,
  21319. operatorList,
  21320. initialState = null,
  21321. fallbackFontDict = null
  21322. }) {
  21323. resources = resources || _primitives.Dict.empty;
  21324. initialState = initialState || new EvalState();
  21325. if (!operatorList) {
  21326. throw new Error('getOperatorList: missing "operatorList" parameter');
  21327. }
  21328. const self = this;
  21329. const xref = this.xref;
  21330. let parsingText = false;
  21331. const localImageCache = new _image_utils.LocalImageCache();
  21332. const localColorSpaceCache = new _image_utils.LocalColorSpaceCache();
  21333. const localGStateCache = new _image_utils.LocalGStateCache();
  21334. const localTilingPatternCache = new _image_utils.LocalTilingPatternCache();
  21335. const localShadingPatternCache = new Map();
  21336. const xobjs = resources.get("XObject") || _primitives.Dict.empty;
  21337. const patterns = resources.get("Pattern") || _primitives.Dict.empty;
  21338. const stateManager = new StateManager(initialState);
  21339. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21340. const timeSlotManager = new TimeSlotManager();
  21341. function closePendingRestoreOPS(argument) {
  21342. for (let i = 0, ii = preprocessor.savedStatesDepth; i < ii; i++) {
  21343. operatorList.addOp(_util.OPS.restore, []);
  21344. }
  21345. }
  21346. return new Promise(function promiseBody(resolve, reject) {
  21347. const next = function (promise) {
  21348. Promise.all([promise, operatorList.ready]).then(function () {
  21349. try {
  21350. promiseBody(resolve, reject);
  21351. } catch (ex) {
  21352. reject(ex);
  21353. }
  21354. }, reject);
  21355. };
  21356. task.ensureNotTerminated();
  21357. timeSlotManager.reset();
  21358. const operation = {};
  21359. let stop, i, ii, cs, name, isValidName;
  21360. while (!(stop = timeSlotManager.check())) {
  21361. operation.args = null;
  21362. if (!preprocessor.read(operation)) {
  21363. break;
  21364. }
  21365. let args = operation.args;
  21366. let fn = operation.fn;
  21367. switch (fn | 0) {
  21368. case _util.OPS.paintXObject:
  21369. isValidName = args[0] instanceof _primitives.Name;
  21370. name = args[0].name;
  21371. if (isValidName) {
  21372. const localImage = localImageCache.getByName(name);
  21373. if (localImage) {
  21374. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  21375. incrementCachedImageMaskCount(localImage);
  21376. args = null;
  21377. continue;
  21378. }
  21379. }
  21380. next(new Promise(function (resolveXObject, rejectXObject) {
  21381. if (!isValidName) {
  21382. throw new _util.FormatError("XObject must be referred to by name.");
  21383. }
  21384. let xobj = xobjs.getRaw(name);
  21385. if (xobj instanceof _primitives.Ref) {
  21386. const localImage = localImageCache.getByRef(xobj);
  21387. if (localImage) {
  21388. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  21389. incrementCachedImageMaskCount(localImage);
  21390. resolveXObject();
  21391. return;
  21392. }
  21393. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  21394. if (globalImage) {
  21395. operatorList.addDependency(globalImage.objId);
  21396. operatorList.addImageOps(globalImage.fn, globalImage.args, globalImage.optionalContent);
  21397. resolveXObject();
  21398. return;
  21399. }
  21400. xobj = xref.fetch(xobj);
  21401. }
  21402. if (!(xobj instanceof _base_stream.BaseStream)) {
  21403. throw new _util.FormatError("XObject should be a stream");
  21404. }
  21405. const type = xobj.dict.get("Subtype");
  21406. if (!(type instanceof _primitives.Name)) {
  21407. throw new _util.FormatError("XObject should have a Name subtype");
  21408. }
  21409. if (type.name === "Form") {
  21410. stateManager.save();
  21411. self.buildFormXObject(resources, xobj, null, operatorList, task, stateManager.state.clone(), localColorSpaceCache).then(function () {
  21412. stateManager.restore();
  21413. resolveXObject();
  21414. }, rejectXObject);
  21415. return;
  21416. } else if (type.name === "Image") {
  21417. self.buildPaintImageXObject({
  21418. resources,
  21419. image: xobj,
  21420. operatorList,
  21421. cacheKey: name,
  21422. localImageCache,
  21423. localColorSpaceCache
  21424. }).then(resolveXObject, rejectXObject);
  21425. return;
  21426. } else if (type.name === "PS") {
  21427. (0, _util.info)("Ignored XObject subtype PS");
  21428. } else {
  21429. throw new _util.FormatError(`Unhandled XObject subtype ${type.name}`);
  21430. }
  21431. resolveXObject();
  21432. }).catch(function (reason) {
  21433. if (reason instanceof _util.AbortException) {
  21434. return;
  21435. }
  21436. if (self.options.ignoreErrors) {
  21437. self.handler.send("UnsupportedFeature", {
  21438. featureId: _util.UNSUPPORTED_FEATURES.errorXObject
  21439. });
  21440. (0, _util.warn)(`getOperatorList - ignoring XObject: "${reason}".`);
  21441. return;
  21442. }
  21443. throw reason;
  21444. }));
  21445. return;
  21446. case _util.OPS.setFont:
  21447. var fontSize = args[1];
  21448. next(self.handleSetFont(resources, args, null, operatorList, task, stateManager.state, fallbackFontDict).then(function (loadedName) {
  21449. operatorList.addDependency(loadedName);
  21450. operatorList.addOp(_util.OPS.setFont, [loadedName, fontSize]);
  21451. }));
  21452. return;
  21453. case _util.OPS.beginText:
  21454. parsingText = true;
  21455. break;
  21456. case _util.OPS.endText:
  21457. parsingText = false;
  21458. break;
  21459. case _util.OPS.endInlineImage:
  21460. var cacheKey = args[0].cacheKey;
  21461. if (cacheKey) {
  21462. const localImage = localImageCache.getByName(cacheKey);
  21463. if (localImage) {
  21464. operatorList.addImageOps(localImage.fn, localImage.args, localImage.optionalContent);
  21465. incrementCachedImageMaskCount(localImage);
  21466. args = null;
  21467. continue;
  21468. }
  21469. }
  21470. next(self.buildPaintImageXObject({
  21471. resources,
  21472. image: args[0],
  21473. isInline: true,
  21474. operatorList,
  21475. cacheKey,
  21476. localImageCache,
  21477. localColorSpaceCache
  21478. }));
  21479. return;
  21480. case _util.OPS.showText:
  21481. if (!stateManager.state.font) {
  21482. self.ensureStateFont(stateManager.state);
  21483. continue;
  21484. }
  21485. args[0] = self.handleText(args[0], stateManager.state);
  21486. break;
  21487. case _util.OPS.showSpacedText:
  21488. if (!stateManager.state.font) {
  21489. self.ensureStateFont(stateManager.state);
  21490. continue;
  21491. }
  21492. var arr = args[0];
  21493. var combinedGlyphs = [];
  21494. var arrLength = arr.length;
  21495. var state = stateManager.state;
  21496. for (i = 0; i < arrLength; ++i) {
  21497. const arrItem = arr[i];
  21498. if (typeof arrItem === "string") {
  21499. Array.prototype.push.apply(combinedGlyphs, self.handleText(arrItem, state));
  21500. } else if (typeof arrItem === "number") {
  21501. combinedGlyphs.push(arrItem);
  21502. }
  21503. }
  21504. args[0] = combinedGlyphs;
  21505. fn = _util.OPS.showText;
  21506. break;
  21507. case _util.OPS.nextLineShowText:
  21508. if (!stateManager.state.font) {
  21509. self.ensureStateFont(stateManager.state);
  21510. continue;
  21511. }
  21512. operatorList.addOp(_util.OPS.nextLine);
  21513. args[0] = self.handleText(args[0], stateManager.state);
  21514. fn = _util.OPS.showText;
  21515. break;
  21516. case _util.OPS.nextLineSetSpacingShowText:
  21517. if (!stateManager.state.font) {
  21518. self.ensureStateFont(stateManager.state);
  21519. continue;
  21520. }
  21521. operatorList.addOp(_util.OPS.nextLine);
  21522. operatorList.addOp(_util.OPS.setWordSpacing, [args.shift()]);
  21523. operatorList.addOp(_util.OPS.setCharSpacing, [args.shift()]);
  21524. args[0] = self.handleText(args[0], stateManager.state);
  21525. fn = _util.OPS.showText;
  21526. break;
  21527. case _util.OPS.setTextRenderingMode:
  21528. stateManager.state.textRenderingMode = args[0];
  21529. break;
  21530. case _util.OPS.setFillColorSpace:
  21531. {
  21532. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21533. if (cachedColorSpace) {
  21534. stateManager.state.fillColorSpace = cachedColorSpace;
  21535. continue;
  21536. }
  21537. next(self.parseColorSpace({
  21538. cs: args[0],
  21539. resources,
  21540. localColorSpaceCache
  21541. }).then(function (colorSpace) {
  21542. if (colorSpace) {
  21543. stateManager.state.fillColorSpace = colorSpace;
  21544. }
  21545. }));
  21546. return;
  21547. }
  21548. case _util.OPS.setStrokeColorSpace:
  21549. {
  21550. const cachedColorSpace = _colorspace.ColorSpace.getCached(args[0], xref, localColorSpaceCache);
  21551. if (cachedColorSpace) {
  21552. stateManager.state.strokeColorSpace = cachedColorSpace;
  21553. continue;
  21554. }
  21555. next(self.parseColorSpace({
  21556. cs: args[0],
  21557. resources,
  21558. localColorSpaceCache
  21559. }).then(function (colorSpace) {
  21560. if (colorSpace) {
  21561. stateManager.state.strokeColorSpace = colorSpace;
  21562. }
  21563. }));
  21564. return;
  21565. }
  21566. case _util.OPS.setFillColor:
  21567. cs = stateManager.state.fillColorSpace;
  21568. args = cs.getRgb(args, 0);
  21569. fn = _util.OPS.setFillRGBColor;
  21570. break;
  21571. case _util.OPS.setStrokeColor:
  21572. cs = stateManager.state.strokeColorSpace;
  21573. args = cs.getRgb(args, 0);
  21574. fn = _util.OPS.setStrokeRGBColor;
  21575. break;
  21576. case _util.OPS.setFillGray:
  21577. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  21578. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21579. fn = _util.OPS.setFillRGBColor;
  21580. break;
  21581. case _util.OPS.setStrokeGray:
  21582. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  21583. args = _colorspace.ColorSpace.singletons.gray.getRgb(args, 0);
  21584. fn = _util.OPS.setStrokeRGBColor;
  21585. break;
  21586. case _util.OPS.setFillCMYKColor:
  21587. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21588. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21589. fn = _util.OPS.setFillRGBColor;
  21590. break;
  21591. case _util.OPS.setStrokeCMYKColor:
  21592. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.cmyk;
  21593. args = _colorspace.ColorSpace.singletons.cmyk.getRgb(args, 0);
  21594. fn = _util.OPS.setStrokeRGBColor;
  21595. break;
  21596. case _util.OPS.setFillRGBColor:
  21597. stateManager.state.fillColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21598. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21599. break;
  21600. case _util.OPS.setStrokeRGBColor:
  21601. stateManager.state.strokeColorSpace = _colorspace.ColorSpace.singletons.rgb;
  21602. args = _colorspace.ColorSpace.singletons.rgb.getRgb(args, 0);
  21603. break;
  21604. case _util.OPS.setFillColorN:
  21605. cs = stateManager.state.fillColorSpace;
  21606. if (cs.name === "Pattern") {
  21607. next(self.handleColorN(operatorList, _util.OPS.setFillColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21608. return;
  21609. }
  21610. args = cs.getRgb(args, 0);
  21611. fn = _util.OPS.setFillRGBColor;
  21612. break;
  21613. case _util.OPS.setStrokeColorN:
  21614. cs = stateManager.state.strokeColorSpace;
  21615. if (cs.name === "Pattern") {
  21616. next(self.handleColorN(operatorList, _util.OPS.setStrokeColorN, args, cs, patterns, resources, task, localColorSpaceCache, localTilingPatternCache, localShadingPatternCache));
  21617. return;
  21618. }
  21619. args = cs.getRgb(args, 0);
  21620. fn = _util.OPS.setStrokeRGBColor;
  21621. break;
  21622. case _util.OPS.shadingFill:
  21623. var shadingRes = resources.get("Shading");
  21624. if (!shadingRes) {
  21625. throw new _util.FormatError("No shading resource found");
  21626. }
  21627. var shading = shadingRes.get(args[0].name);
  21628. if (!shading) {
  21629. throw new _util.FormatError("No shading object found");
  21630. }
  21631. const patternId = self.parseShading({
  21632. shading,
  21633. resources,
  21634. localColorSpaceCache,
  21635. localShadingPatternCache
  21636. });
  21637. args = [patternId];
  21638. fn = _util.OPS.shadingFill;
  21639. break;
  21640. case _util.OPS.setGState:
  21641. isValidName = args[0] instanceof _primitives.Name;
  21642. name = args[0].name;
  21643. if (isValidName) {
  21644. const localGStateObj = localGStateCache.getByName(name);
  21645. if (localGStateObj) {
  21646. if (localGStateObj.length > 0) {
  21647. operatorList.addOp(_util.OPS.setGState, [localGStateObj]);
  21648. }
  21649. args = null;
  21650. continue;
  21651. }
  21652. }
  21653. next(new Promise(function (resolveGState, rejectGState) {
  21654. if (!isValidName) {
  21655. throw new _util.FormatError("GState must be referred to by name.");
  21656. }
  21657. const extGState = resources.get("ExtGState");
  21658. if (!(extGState instanceof _primitives.Dict)) {
  21659. throw new _util.FormatError("ExtGState should be a dictionary.");
  21660. }
  21661. const gState = extGState.get(name);
  21662. if (!(gState instanceof _primitives.Dict)) {
  21663. throw new _util.FormatError("GState should be a dictionary.");
  21664. }
  21665. self.setGState({
  21666. resources,
  21667. gState,
  21668. operatorList,
  21669. cacheKey: name,
  21670. task,
  21671. stateManager,
  21672. localGStateCache,
  21673. localColorSpaceCache
  21674. }).then(resolveGState, rejectGState);
  21675. }).catch(function (reason) {
  21676. if (reason instanceof _util.AbortException) {
  21677. return;
  21678. }
  21679. if (self.options.ignoreErrors) {
  21680. self.handler.send("UnsupportedFeature", {
  21681. featureId: _util.UNSUPPORTED_FEATURES.errorExtGState
  21682. });
  21683. (0, _util.warn)(`getOperatorList - ignoring ExtGState: "${reason}".`);
  21684. return;
  21685. }
  21686. throw reason;
  21687. }));
  21688. return;
  21689. case _util.OPS.moveTo:
  21690. case _util.OPS.lineTo:
  21691. case _util.OPS.curveTo:
  21692. case _util.OPS.curveTo2:
  21693. case _util.OPS.curveTo3:
  21694. case _util.OPS.closePath:
  21695. case _util.OPS.rectangle:
  21696. self.buildPath(operatorList, fn, args, parsingText);
  21697. continue;
  21698. case _util.OPS.markPoint:
  21699. case _util.OPS.markPointProps:
  21700. case _util.OPS.beginCompat:
  21701. case _util.OPS.endCompat:
  21702. continue;
  21703. case _util.OPS.beginMarkedContentProps:
  21704. if (!(args[0] instanceof _primitives.Name)) {
  21705. (0, _util.warn)(`Expected name for beginMarkedContentProps arg0=${args[0]}`);
  21706. continue;
  21707. }
  21708. if (args[0].name === "OC") {
  21709. next(self.parseMarkedContentProps(args[1], resources).then(data => {
  21710. operatorList.addOp(_util.OPS.beginMarkedContentProps, ["OC", data]);
  21711. }).catch(reason => {
  21712. if (reason instanceof _util.AbortException) {
  21713. return;
  21714. }
  21715. if (self.options.ignoreErrors) {
  21716. self.handler.send("UnsupportedFeature", {
  21717. featureId: _util.UNSUPPORTED_FEATURES.errorMarkedContent
  21718. });
  21719. (0, _util.warn)(`getOperatorList - ignoring beginMarkedContentProps: "${reason}".`);
  21720. return;
  21721. }
  21722. throw reason;
  21723. }));
  21724. return;
  21725. }
  21726. args = [args[0].name, args[1] instanceof _primitives.Dict ? args[1].get("MCID") : null];
  21727. break;
  21728. case _util.OPS.beginMarkedContent:
  21729. case _util.OPS.endMarkedContent:
  21730. default:
  21731. if (args !== null) {
  21732. for (i = 0, ii = args.length; i < ii; i++) {
  21733. if (args[i] instanceof _primitives.Dict) {
  21734. break;
  21735. }
  21736. }
  21737. if (i < ii) {
  21738. (0, _util.warn)("getOperatorList - ignoring operator: " + fn);
  21739. continue;
  21740. }
  21741. }
  21742. }
  21743. operatorList.addOp(fn, args);
  21744. }
  21745. if (stop) {
  21746. next(deferred);
  21747. return;
  21748. }
  21749. closePendingRestoreOPS();
  21750. resolve();
  21751. }).catch(reason => {
  21752. if (reason instanceof _util.AbortException) {
  21753. return;
  21754. }
  21755. if (this.options.ignoreErrors) {
  21756. this.handler.send("UnsupportedFeature", {
  21757. featureId: _util.UNSUPPORTED_FEATURES.errorOperatorList
  21758. });
  21759. (0, _util.warn)(`getOperatorList - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  21760. closePendingRestoreOPS();
  21761. return;
  21762. }
  21763. throw reason;
  21764. });
  21765. }
  21766. getTextContent({
  21767. stream,
  21768. task,
  21769. resources,
  21770. stateManager = null,
  21771. combineTextItems = false,
  21772. includeMarkedContent = false,
  21773. sink,
  21774. seenStyles = new Set(),
  21775. viewBox
  21776. }) {
  21777. resources = resources || _primitives.Dict.empty;
  21778. stateManager = stateManager || new StateManager(new TextState());
  21779. const NormalizedUnicodes = (0, _unicode.getNormalizedUnicodes)();
  21780. const textContent = {
  21781. items: [],
  21782. styles: Object.create(null)
  21783. };
  21784. const textContentItem = {
  21785. initialized: false,
  21786. str: [],
  21787. totalWidth: 0,
  21788. totalHeight: 0,
  21789. width: 0,
  21790. height: 0,
  21791. vertical: false,
  21792. prevTransform: null,
  21793. textAdvanceScale: 0,
  21794. spaceInFlowMin: 0,
  21795. spaceInFlowMax: 0,
  21796. trackingSpaceMin: Infinity,
  21797. negativeSpaceMax: -Infinity,
  21798. notASpace: -Infinity,
  21799. transform: null,
  21800. fontName: null,
  21801. hasEOL: false
  21802. };
  21803. const twoLastChars = [" ", " "];
  21804. let twoLastCharsPos = 0;
  21805. function saveLastChar(char) {
  21806. const nextPos = (twoLastCharsPos + 1) % 2;
  21807. const ret = twoLastChars[twoLastCharsPos] !== " " && twoLastChars[nextPos] === " ";
  21808. twoLastChars[twoLastCharsPos] = char;
  21809. twoLastCharsPos = nextPos;
  21810. return ret;
  21811. }
  21812. function resetLastChars() {
  21813. twoLastChars[0] = twoLastChars[1] = " ";
  21814. twoLastCharsPos = 0;
  21815. }
  21816. const TRACKING_SPACE_FACTOR = 0.1;
  21817. const NOT_A_SPACE_FACTOR = 0.03;
  21818. const NEGATIVE_SPACE_FACTOR = -0.2;
  21819. const SPACE_IN_FLOW_MIN_FACTOR = 0.1;
  21820. const SPACE_IN_FLOW_MAX_FACTOR = 0.6;
  21821. const self = this;
  21822. const xref = this.xref;
  21823. const showSpacedTextBuffer = [];
  21824. let xobjs = null;
  21825. const emptyXObjectCache = new _image_utils.LocalImageCache();
  21826. const emptyGStateCache = new _image_utils.LocalGStateCache();
  21827. const preprocessor = new EvaluatorPreprocessor(stream, xref, stateManager);
  21828. let textState;
  21829. function getCurrentTextTransform() {
  21830. const font = textState.font;
  21831. const tsm = [textState.fontSize * textState.textHScale, 0, 0, textState.fontSize, 0, textState.textRise];
  21832. if (font.isType3Font && (textState.fontSize <= 1 || font.isCharBBox) && !(0, _util.isArrayEqual)(textState.fontMatrix, _util.FONT_IDENTITY_MATRIX)) {
  21833. const glyphHeight = font.bbox[3] - font.bbox[1];
  21834. if (glyphHeight > 0) {
  21835. tsm[3] *= glyphHeight * textState.fontMatrix[3];
  21836. }
  21837. }
  21838. return _util.Util.transform(textState.ctm, _util.Util.transform(textState.textMatrix, tsm));
  21839. }
  21840. function ensureTextContentItem() {
  21841. if (textContentItem.initialized) {
  21842. return textContentItem;
  21843. }
  21844. const font = textState.font,
  21845. loadedName = font.loadedName;
  21846. if (!seenStyles.has(loadedName)) {
  21847. seenStyles.add(loadedName);
  21848. textContent.styles[loadedName] = {
  21849. fontFamily: font.fallbackName,
  21850. ascent: font.ascent,
  21851. descent: font.descent,
  21852. vertical: font.vertical
  21853. };
  21854. }
  21855. textContentItem.fontName = loadedName;
  21856. const trm = textContentItem.transform = getCurrentTextTransform();
  21857. if (!font.vertical) {
  21858. textContentItem.width = textContentItem.totalWidth = 0;
  21859. textContentItem.height = textContentItem.totalHeight = Math.hypot(trm[2], trm[3]);
  21860. textContentItem.vertical = false;
  21861. } else {
  21862. textContentItem.width = textContentItem.totalWidth = Math.hypot(trm[0], trm[1]);
  21863. textContentItem.height = textContentItem.totalHeight = 0;
  21864. textContentItem.vertical = true;
  21865. }
  21866. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21867. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21868. textContentItem.textAdvanceScale = scaleCtmX * scaleLineX;
  21869. textContentItem.trackingSpaceMin = textState.fontSize * TRACKING_SPACE_FACTOR;
  21870. textContentItem.notASpace = textState.fontSize * NOT_A_SPACE_FACTOR;
  21871. textContentItem.negativeSpaceMax = textState.fontSize * NEGATIVE_SPACE_FACTOR;
  21872. textContentItem.spaceInFlowMin = textState.fontSize * SPACE_IN_FLOW_MIN_FACTOR;
  21873. textContentItem.spaceInFlowMax = textState.fontSize * SPACE_IN_FLOW_MAX_FACTOR;
  21874. textContentItem.hasEOL = false;
  21875. textContentItem.initialized = true;
  21876. return textContentItem;
  21877. }
  21878. function updateAdvanceScale() {
  21879. if (!textContentItem.initialized) {
  21880. return;
  21881. }
  21882. const scaleLineX = Math.hypot(textState.textLineMatrix[0], textState.textLineMatrix[1]);
  21883. const scaleCtmX = Math.hypot(textState.ctm[0], textState.ctm[1]);
  21884. const scaleFactor = scaleCtmX * scaleLineX;
  21885. if (scaleFactor === textContentItem.textAdvanceScale) {
  21886. return;
  21887. }
  21888. if (!textContentItem.vertical) {
  21889. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  21890. textContentItem.width = 0;
  21891. } else {
  21892. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  21893. textContentItem.height = 0;
  21894. }
  21895. textContentItem.textAdvanceScale = scaleFactor;
  21896. }
  21897. function runBidiTransform(textChunk) {
  21898. const text = textChunk.str.join("");
  21899. const bidiResult = (0, _bidi.bidi)(text, -1, textChunk.vertical);
  21900. return {
  21901. str: bidiResult.str,
  21902. dir: bidiResult.dir,
  21903. width: Math.abs(textChunk.totalWidth),
  21904. height: Math.abs(textChunk.totalHeight),
  21905. transform: textChunk.transform,
  21906. fontName: textChunk.fontName,
  21907. hasEOL: textChunk.hasEOL
  21908. };
  21909. }
  21910. function handleSetFont(fontName, fontRef) {
  21911. return self.loadFont(fontName, fontRef, resources).then(function (translated) {
  21912. if (!translated.font.isType3Font) {
  21913. return translated;
  21914. }
  21915. return translated.loadType3Data(self, resources, task).catch(function () {}).then(function () {
  21916. return translated;
  21917. });
  21918. }).then(function (translated) {
  21919. textState.font = translated.font;
  21920. textState.fontMatrix = translated.font.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  21921. });
  21922. }
  21923. function applyInverseRotation(x, y, matrix) {
  21924. const scale = Math.hypot(matrix[0], matrix[1]);
  21925. return [(matrix[0] * x + matrix[1] * y) / scale, (matrix[2] * x + matrix[3] * y) / scale];
  21926. }
  21927. function compareWithLastPosition() {
  21928. const currentTransform = getCurrentTextTransform();
  21929. let posX = currentTransform[4];
  21930. let posY = currentTransform[5];
  21931. const shiftedX = posX - viewBox[0];
  21932. const shiftedY = posY - viewBox[1];
  21933. if (shiftedX < 0 || shiftedX > viewBox[2] || shiftedY < 0 || shiftedY > viewBox[3]) {
  21934. return false;
  21935. }
  21936. if (!combineTextItems || !textState.font || !textContentItem.prevTransform) {
  21937. return true;
  21938. }
  21939. let lastPosX = textContentItem.prevTransform[4];
  21940. let lastPosY = textContentItem.prevTransform[5];
  21941. if (lastPosX === posX && lastPosY === posY) {
  21942. return true;
  21943. }
  21944. let rotate = -1;
  21945. if (currentTransform[0] && currentTransform[1] === 0 && currentTransform[2] === 0) {
  21946. rotate = currentTransform[0] > 0 ? 0 : 180;
  21947. } else if (currentTransform[1] && currentTransform[0] === 0 && currentTransform[3] === 0) {
  21948. rotate = currentTransform[1] > 0 ? 90 : 270;
  21949. }
  21950. switch (rotate) {
  21951. case 0:
  21952. break;
  21953. case 90:
  21954. [posX, posY] = [posY, posX];
  21955. [lastPosX, lastPosY] = [lastPosY, lastPosX];
  21956. break;
  21957. case 180:
  21958. [posX, posY, lastPosX, lastPosY] = [-posX, -posY, -lastPosX, -lastPosY];
  21959. break;
  21960. case 270:
  21961. [posX, posY] = [-posY, -posX];
  21962. [lastPosX, lastPosY] = [-lastPosY, -lastPosX];
  21963. break;
  21964. default:
  21965. [posX, posY] = applyInverseRotation(posX, posY, currentTransform);
  21966. [lastPosX, lastPosY] = applyInverseRotation(lastPosX, lastPosY, textContentItem.prevTransform);
  21967. }
  21968. if (textState.font.vertical) {
  21969. const advanceY = (lastPosY - posY) / textContentItem.textAdvanceScale;
  21970. const advanceX = posX - lastPosX;
  21971. const textOrientation = Math.sign(textContentItem.height);
  21972. if (advanceY < textOrientation * textContentItem.negativeSpaceMax) {
  21973. if (Math.abs(advanceX) > 0.5 * textContentItem.width) {
  21974. appendEOL();
  21975. return true;
  21976. }
  21977. resetLastChars();
  21978. flushTextContentItem();
  21979. return true;
  21980. }
  21981. if (Math.abs(advanceX) > textContentItem.width) {
  21982. appendEOL();
  21983. return true;
  21984. }
  21985. if (advanceY <= textOrientation * textContentItem.notASpace) {
  21986. resetLastChars();
  21987. }
  21988. if (advanceY <= textOrientation * textContentItem.trackingSpaceMin) {
  21989. textContentItem.height += advanceY;
  21990. } else if (!addFakeSpaces(advanceY, textContentItem.prevTransform, textOrientation)) {
  21991. if (textContentItem.str.length === 0) {
  21992. resetLastChars();
  21993. textContent.items.push({
  21994. str: " ",
  21995. dir: "ltr",
  21996. width: 0,
  21997. height: Math.abs(advanceY),
  21998. transform: textContentItem.prevTransform,
  21999. fontName: textContentItem.fontName,
  22000. hasEOL: false
  22001. });
  22002. } else {
  22003. textContentItem.height += advanceY;
  22004. }
  22005. }
  22006. return true;
  22007. }
  22008. const advanceX = (posX - lastPosX) / textContentItem.textAdvanceScale;
  22009. const advanceY = posY - lastPosY;
  22010. const textOrientation = Math.sign(textContentItem.width);
  22011. if (advanceX < textOrientation * textContentItem.negativeSpaceMax) {
  22012. if (Math.abs(advanceY) > 0.5 * textContentItem.height) {
  22013. appendEOL();
  22014. return true;
  22015. }
  22016. resetLastChars();
  22017. flushTextContentItem();
  22018. return true;
  22019. }
  22020. if (Math.abs(advanceY) > textContentItem.height) {
  22021. appendEOL();
  22022. return true;
  22023. }
  22024. if (advanceX <= textOrientation * textContentItem.notASpace) {
  22025. resetLastChars();
  22026. }
  22027. if (advanceX <= textOrientation * textContentItem.trackingSpaceMin) {
  22028. textContentItem.width += advanceX;
  22029. } else if (!addFakeSpaces(advanceX, textContentItem.prevTransform, textOrientation)) {
  22030. if (textContentItem.str.length === 0) {
  22031. resetLastChars();
  22032. textContent.items.push({
  22033. str: " ",
  22034. dir: "ltr",
  22035. width: Math.abs(advanceX),
  22036. height: 0,
  22037. transform: textContentItem.prevTransform,
  22038. fontName: textContentItem.fontName,
  22039. hasEOL: false
  22040. });
  22041. } else {
  22042. textContentItem.width += advanceX;
  22043. }
  22044. }
  22045. return true;
  22046. }
  22047. function buildTextContentItem({
  22048. chars,
  22049. extraSpacing
  22050. }) {
  22051. const font = textState.font;
  22052. if (!chars) {
  22053. const charSpacing = textState.charSpacing + extraSpacing;
  22054. if (charSpacing) {
  22055. if (!font.vertical) {
  22056. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22057. } else {
  22058. textState.translateTextMatrix(0, -charSpacing);
  22059. }
  22060. }
  22061. return;
  22062. }
  22063. const glyphs = font.charsToGlyphs(chars);
  22064. const scale = textState.fontMatrix[0] * textState.fontSize;
  22065. for (let i = 0, ii = glyphs.length; i < ii; i++) {
  22066. const glyph = glyphs[i];
  22067. if (glyph.isInvisibleFormatMark) {
  22068. continue;
  22069. }
  22070. let charSpacing = textState.charSpacing + (i + 1 === ii ? extraSpacing : 0);
  22071. let glyphWidth = glyph.width;
  22072. if (font.vertical) {
  22073. glyphWidth = glyph.vmetric ? glyph.vmetric[0] : -glyphWidth;
  22074. }
  22075. let scaledDim = glyphWidth * scale;
  22076. if (glyph.isWhitespace) {
  22077. if (!font.vertical) {
  22078. charSpacing += scaledDim + textState.wordSpacing;
  22079. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22080. } else {
  22081. charSpacing += -scaledDim + textState.wordSpacing;
  22082. textState.translateTextMatrix(0, -charSpacing);
  22083. }
  22084. saveLastChar(" ");
  22085. continue;
  22086. }
  22087. if (!compareWithLastPosition()) {
  22088. continue;
  22089. }
  22090. const textChunk = ensureTextContentItem();
  22091. if (glyph.isZeroWidthDiacritic) {
  22092. scaledDim = 0;
  22093. }
  22094. if (!font.vertical) {
  22095. scaledDim *= textState.textHScale;
  22096. textState.translateTextMatrix(scaledDim, 0);
  22097. textChunk.width += scaledDim;
  22098. } else {
  22099. textState.translateTextMatrix(0, scaledDim);
  22100. scaledDim = Math.abs(scaledDim);
  22101. textChunk.height += scaledDim;
  22102. }
  22103. if (scaledDim) {
  22104. textChunk.prevTransform = getCurrentTextTransform();
  22105. }
  22106. let glyphUnicode = glyph.unicode;
  22107. glyphUnicode = NormalizedUnicodes[glyphUnicode] || glyphUnicode;
  22108. glyphUnicode = (0, _unicode.reverseIfRtl)(glyphUnicode);
  22109. if (saveLastChar(glyphUnicode)) {
  22110. textChunk.str.push(" ");
  22111. }
  22112. textChunk.str.push(glyphUnicode);
  22113. if (charSpacing) {
  22114. if (!font.vertical) {
  22115. textState.translateTextMatrix(charSpacing * textState.textHScale, 0);
  22116. } else {
  22117. textState.translateTextMatrix(0, -charSpacing);
  22118. }
  22119. }
  22120. }
  22121. }
  22122. function appendEOL() {
  22123. resetLastChars();
  22124. if (textContentItem.initialized) {
  22125. textContentItem.hasEOL = true;
  22126. flushTextContentItem();
  22127. } else {
  22128. textContent.items.push({
  22129. str: "",
  22130. dir: "ltr",
  22131. width: 0,
  22132. height: 0,
  22133. transform: getCurrentTextTransform(),
  22134. fontName: textState.font.loadedName,
  22135. hasEOL: true
  22136. });
  22137. }
  22138. }
  22139. function addFakeSpaces(width, transf, textOrientation) {
  22140. if (textOrientation * textContentItem.spaceInFlowMin <= width && width <= textOrientation * textContentItem.spaceInFlowMax) {
  22141. if (textContentItem.initialized) {
  22142. resetLastChars();
  22143. textContentItem.str.push(" ");
  22144. }
  22145. return false;
  22146. }
  22147. const fontName = textContentItem.fontName;
  22148. let height = 0;
  22149. if (textContentItem.vertical) {
  22150. height = width;
  22151. width = 0;
  22152. }
  22153. flushTextContentItem();
  22154. resetLastChars();
  22155. textContent.items.push({
  22156. str: " ",
  22157. dir: "ltr",
  22158. width: Math.abs(width),
  22159. height: Math.abs(height),
  22160. transform: transf || getCurrentTextTransform(),
  22161. fontName,
  22162. hasEOL: false
  22163. });
  22164. return true;
  22165. }
  22166. function flushTextContentItem() {
  22167. if (!textContentItem.initialized || !textContentItem.str) {
  22168. return;
  22169. }
  22170. if (!textContentItem.vertical) {
  22171. textContentItem.totalWidth += textContentItem.width * textContentItem.textAdvanceScale;
  22172. } else {
  22173. textContentItem.totalHeight += textContentItem.height * textContentItem.textAdvanceScale;
  22174. }
  22175. textContent.items.push(runBidiTransform(textContentItem));
  22176. textContentItem.initialized = false;
  22177. textContentItem.str.length = 0;
  22178. }
  22179. function enqueueChunk(batch = false) {
  22180. const length = textContent.items.length;
  22181. if (length === 0) {
  22182. return;
  22183. }
  22184. if (batch && length < TEXT_CHUNK_BATCH_SIZE) {
  22185. return;
  22186. }
  22187. sink.enqueue(textContent, length);
  22188. textContent.items = [];
  22189. textContent.styles = Object.create(null);
  22190. }
  22191. const timeSlotManager = new TimeSlotManager();
  22192. return new Promise(function promiseBody(resolve, reject) {
  22193. const next = function (promise) {
  22194. enqueueChunk(true);
  22195. Promise.all([promise, sink.ready]).then(function () {
  22196. try {
  22197. promiseBody(resolve, reject);
  22198. } catch (ex) {
  22199. reject(ex);
  22200. }
  22201. }, reject);
  22202. };
  22203. task.ensureNotTerminated();
  22204. timeSlotManager.reset();
  22205. const operation = {};
  22206. let stop,
  22207. args = [];
  22208. while (!(stop = timeSlotManager.check())) {
  22209. args.length = 0;
  22210. operation.args = args;
  22211. if (!preprocessor.read(operation)) {
  22212. break;
  22213. }
  22214. textState = stateManager.state;
  22215. const fn = operation.fn;
  22216. args = operation.args;
  22217. switch (fn | 0) {
  22218. case _util.OPS.setFont:
  22219. var fontNameArg = args[0].name,
  22220. fontSizeArg = args[1];
  22221. if (textState.font && fontNameArg === textState.fontName && fontSizeArg === textState.fontSize) {
  22222. break;
  22223. }
  22224. flushTextContentItem();
  22225. textState.fontName = fontNameArg;
  22226. textState.fontSize = fontSizeArg;
  22227. next(handleSetFont(fontNameArg, null));
  22228. return;
  22229. case _util.OPS.setTextRise:
  22230. textState.textRise = args[0];
  22231. break;
  22232. case _util.OPS.setHScale:
  22233. textState.textHScale = args[0] / 100;
  22234. break;
  22235. case _util.OPS.setLeading:
  22236. textState.leading = args[0];
  22237. break;
  22238. case _util.OPS.moveText:
  22239. textState.translateTextLineMatrix(args[0], args[1]);
  22240. textState.textMatrix = textState.textLineMatrix.slice();
  22241. break;
  22242. case _util.OPS.setLeadingMoveText:
  22243. textState.leading = -args[1];
  22244. textState.translateTextLineMatrix(args[0], args[1]);
  22245. textState.textMatrix = textState.textLineMatrix.slice();
  22246. break;
  22247. case _util.OPS.nextLine:
  22248. textState.carriageReturn();
  22249. break;
  22250. case _util.OPS.setTextMatrix:
  22251. textState.setTextMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  22252. textState.setTextLineMatrix(args[0], args[1], args[2], args[3], args[4], args[5]);
  22253. updateAdvanceScale();
  22254. break;
  22255. case _util.OPS.setCharSpacing:
  22256. textState.charSpacing = args[0];
  22257. break;
  22258. case _util.OPS.setWordSpacing:
  22259. textState.wordSpacing = args[0];
  22260. break;
  22261. case _util.OPS.beginText:
  22262. textState.textMatrix = _util.IDENTITY_MATRIX.slice();
  22263. textState.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  22264. break;
  22265. case _util.OPS.showSpacedText:
  22266. if (!stateManager.state.font) {
  22267. self.ensureStateFont(stateManager.state);
  22268. continue;
  22269. }
  22270. const spaceFactor = (textState.font.vertical ? 1 : -1) * textState.fontSize / 1000;
  22271. const elements = args[0];
  22272. for (let i = 0, ii = elements.length; i < ii - 1; i++) {
  22273. const item = elements[i];
  22274. if (typeof item === "string") {
  22275. showSpacedTextBuffer.push(item);
  22276. } else if (typeof item === "number" && item !== 0) {
  22277. const str = showSpacedTextBuffer.join("");
  22278. showSpacedTextBuffer.length = 0;
  22279. buildTextContentItem({
  22280. chars: str,
  22281. extraSpacing: item * spaceFactor
  22282. });
  22283. }
  22284. }
  22285. const item = elements[elements.length - 1];
  22286. if (typeof item === "string") {
  22287. showSpacedTextBuffer.push(item);
  22288. }
  22289. if (showSpacedTextBuffer.length > 0) {
  22290. const str = showSpacedTextBuffer.join("");
  22291. showSpacedTextBuffer.length = 0;
  22292. buildTextContentItem({
  22293. chars: str,
  22294. extraSpacing: 0
  22295. });
  22296. }
  22297. break;
  22298. case _util.OPS.showText:
  22299. if (!stateManager.state.font) {
  22300. self.ensureStateFont(stateManager.state);
  22301. continue;
  22302. }
  22303. buildTextContentItem({
  22304. chars: args[0],
  22305. extraSpacing: 0
  22306. });
  22307. break;
  22308. case _util.OPS.nextLineShowText:
  22309. if (!stateManager.state.font) {
  22310. self.ensureStateFont(stateManager.state);
  22311. continue;
  22312. }
  22313. textState.carriageReturn();
  22314. buildTextContentItem({
  22315. chars: args[0],
  22316. extraSpacing: 0
  22317. });
  22318. break;
  22319. case _util.OPS.nextLineSetSpacingShowText:
  22320. if (!stateManager.state.font) {
  22321. self.ensureStateFont(stateManager.state);
  22322. continue;
  22323. }
  22324. textState.wordSpacing = args[0];
  22325. textState.charSpacing = args[1];
  22326. textState.carriageReturn();
  22327. buildTextContentItem({
  22328. chars: args[2],
  22329. extraSpacing: 0
  22330. });
  22331. break;
  22332. case _util.OPS.paintXObject:
  22333. flushTextContentItem();
  22334. if (!xobjs) {
  22335. xobjs = resources.get("XObject") || _primitives.Dict.empty;
  22336. }
  22337. var isValidName = args[0] instanceof _primitives.Name;
  22338. var name = args[0].name;
  22339. if (isValidName && emptyXObjectCache.getByName(name)) {
  22340. break;
  22341. }
  22342. next(new Promise(function (resolveXObject, rejectXObject) {
  22343. if (!isValidName) {
  22344. throw new _util.FormatError("XObject must be referred to by name.");
  22345. }
  22346. let xobj = xobjs.getRaw(name);
  22347. if (xobj instanceof _primitives.Ref) {
  22348. if (emptyXObjectCache.getByRef(xobj)) {
  22349. resolveXObject();
  22350. return;
  22351. }
  22352. const globalImage = self.globalImageCache.getData(xobj, self.pageIndex);
  22353. if (globalImage) {
  22354. resolveXObject();
  22355. return;
  22356. }
  22357. xobj = xref.fetch(xobj);
  22358. }
  22359. if (!(xobj instanceof _base_stream.BaseStream)) {
  22360. throw new _util.FormatError("XObject should be a stream");
  22361. }
  22362. const type = xobj.dict.get("Subtype");
  22363. if (!(type instanceof _primitives.Name)) {
  22364. throw new _util.FormatError("XObject should have a Name subtype");
  22365. }
  22366. if (type.name !== "Form") {
  22367. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22368. resolveXObject();
  22369. return;
  22370. }
  22371. const currentState = stateManager.state.clone();
  22372. const xObjStateManager = new StateManager(currentState);
  22373. const matrix = xobj.dict.getArray("Matrix");
  22374. if (Array.isArray(matrix) && matrix.length === 6) {
  22375. xObjStateManager.transform(matrix);
  22376. }
  22377. enqueueChunk();
  22378. const sinkWrapper = {
  22379. enqueueInvoked: false,
  22380. enqueue(chunk, size) {
  22381. this.enqueueInvoked = true;
  22382. sink.enqueue(chunk, size);
  22383. },
  22384. get desiredSize() {
  22385. return sink.desiredSize;
  22386. },
  22387. get ready() {
  22388. return sink.ready;
  22389. }
  22390. };
  22391. self.getTextContent({
  22392. stream: xobj,
  22393. task,
  22394. resources: xobj.dict.get("Resources") || resources,
  22395. stateManager: xObjStateManager,
  22396. combineTextItems,
  22397. includeMarkedContent,
  22398. sink: sinkWrapper,
  22399. seenStyles,
  22400. viewBox
  22401. }).then(function () {
  22402. if (!sinkWrapper.enqueueInvoked) {
  22403. emptyXObjectCache.set(name, xobj.dict.objId, true);
  22404. }
  22405. resolveXObject();
  22406. }, rejectXObject);
  22407. }).catch(function (reason) {
  22408. if (reason instanceof _util.AbortException) {
  22409. return;
  22410. }
  22411. if (self.options.ignoreErrors) {
  22412. (0, _util.warn)(`getTextContent - ignoring XObject: "${reason}".`);
  22413. return;
  22414. }
  22415. throw reason;
  22416. }));
  22417. return;
  22418. case _util.OPS.setGState:
  22419. isValidName = args[0] instanceof _primitives.Name;
  22420. name = args[0].name;
  22421. if (isValidName && emptyGStateCache.getByName(name)) {
  22422. break;
  22423. }
  22424. next(new Promise(function (resolveGState, rejectGState) {
  22425. if (!isValidName) {
  22426. throw new _util.FormatError("GState must be referred to by name.");
  22427. }
  22428. const extGState = resources.get("ExtGState");
  22429. if (!(extGState instanceof _primitives.Dict)) {
  22430. throw new _util.FormatError("ExtGState should be a dictionary.");
  22431. }
  22432. const gState = extGState.get(name);
  22433. if (!(gState instanceof _primitives.Dict)) {
  22434. throw new _util.FormatError("GState should be a dictionary.");
  22435. }
  22436. const gStateFont = gState.get("Font");
  22437. if (!gStateFont) {
  22438. emptyGStateCache.set(name, gState.objId, true);
  22439. resolveGState();
  22440. return;
  22441. }
  22442. flushTextContentItem();
  22443. textState.fontName = null;
  22444. textState.fontSize = gStateFont[1];
  22445. handleSetFont(null, gStateFont[0]).then(resolveGState, rejectGState);
  22446. }).catch(function (reason) {
  22447. if (reason instanceof _util.AbortException) {
  22448. return;
  22449. }
  22450. if (self.options.ignoreErrors) {
  22451. (0, _util.warn)(`getTextContent - ignoring ExtGState: "${reason}".`);
  22452. return;
  22453. }
  22454. throw reason;
  22455. }));
  22456. return;
  22457. case _util.OPS.beginMarkedContent:
  22458. if (includeMarkedContent) {
  22459. textContent.items.push({
  22460. type: "beginMarkedContent",
  22461. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  22462. });
  22463. }
  22464. break;
  22465. case _util.OPS.beginMarkedContentProps:
  22466. if (includeMarkedContent) {
  22467. flushTextContentItem();
  22468. let mcid = null;
  22469. if (args[1] instanceof _primitives.Dict) {
  22470. mcid = args[1].get("MCID");
  22471. }
  22472. textContent.items.push({
  22473. type: "beginMarkedContentProps",
  22474. id: Number.isInteger(mcid) ? `${self.idFactory.getPageObjId()}_mcid${mcid}` : null,
  22475. tag: args[0] instanceof _primitives.Name ? args[0].name : null
  22476. });
  22477. }
  22478. break;
  22479. case _util.OPS.endMarkedContent:
  22480. if (includeMarkedContent) {
  22481. flushTextContentItem();
  22482. textContent.items.push({
  22483. type: "endMarkedContent"
  22484. });
  22485. }
  22486. break;
  22487. }
  22488. if (textContent.items.length >= sink.desiredSize) {
  22489. stop = true;
  22490. break;
  22491. }
  22492. }
  22493. if (stop) {
  22494. next(deferred);
  22495. return;
  22496. }
  22497. flushTextContentItem();
  22498. enqueueChunk();
  22499. resolve();
  22500. }).catch(reason => {
  22501. if (reason instanceof _util.AbortException) {
  22502. return;
  22503. }
  22504. if (this.options.ignoreErrors) {
  22505. (0, _util.warn)(`getTextContent - ignoring errors during "${task.name}" ` + `task: "${reason}".`);
  22506. flushTextContentItem();
  22507. enqueueChunk();
  22508. return;
  22509. }
  22510. throw reason;
  22511. });
  22512. }
  22513. extractDataStructures(dict, baseDict, properties) {
  22514. const xref = this.xref;
  22515. let cidToGidBytes;
  22516. const toUnicodePromise = this.readToUnicode(properties.toUnicode || dict.get("ToUnicode") || baseDict.get("ToUnicode"));
  22517. if (properties.composite) {
  22518. const cidSystemInfo = dict.get("CIDSystemInfo");
  22519. if (cidSystemInfo instanceof _primitives.Dict) {
  22520. properties.cidSystemInfo = {
  22521. registry: (0, _util.stringToPDFString)(cidSystemInfo.get("Registry")),
  22522. ordering: (0, _util.stringToPDFString)(cidSystemInfo.get("Ordering")),
  22523. supplement: cidSystemInfo.get("Supplement")
  22524. };
  22525. }
  22526. const cidToGidMap = dict.get("CIDToGIDMap");
  22527. if (cidToGidMap instanceof _base_stream.BaseStream) {
  22528. cidToGidBytes = cidToGidMap.getBytes();
  22529. }
  22530. }
  22531. const differences = [];
  22532. let baseEncodingName = null;
  22533. let encoding;
  22534. if (dict.has("Encoding")) {
  22535. encoding = dict.get("Encoding");
  22536. if (encoding instanceof _primitives.Dict) {
  22537. baseEncodingName = encoding.get("BaseEncoding");
  22538. baseEncodingName = baseEncodingName instanceof _primitives.Name ? baseEncodingName.name : null;
  22539. if (encoding.has("Differences")) {
  22540. const diffEncoding = encoding.get("Differences");
  22541. let index = 0;
  22542. for (let j = 0, jj = diffEncoding.length; j < jj; j++) {
  22543. const data = xref.fetchIfRef(diffEncoding[j]);
  22544. if (typeof data === "number") {
  22545. index = data;
  22546. } else if (data instanceof _primitives.Name) {
  22547. differences[index++] = data.name;
  22548. } else {
  22549. throw new _util.FormatError(`Invalid entry in 'Differences' array: ${data}`);
  22550. }
  22551. }
  22552. }
  22553. } else if (encoding instanceof _primitives.Name) {
  22554. baseEncodingName = encoding.name;
  22555. } else {
  22556. const msg = "Encoding is not a Name nor a Dict";
  22557. if (!this.options.ignoreErrors) {
  22558. throw new _util.FormatError(msg);
  22559. }
  22560. (0, _util.warn)(msg);
  22561. }
  22562. if (baseEncodingName !== "MacRomanEncoding" && baseEncodingName !== "MacExpertEncoding" && baseEncodingName !== "WinAnsiEncoding") {
  22563. baseEncodingName = null;
  22564. }
  22565. }
  22566. if (baseEncodingName) {
  22567. properties.defaultEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22568. } else {
  22569. const isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  22570. const isNonsymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Nonsymbolic);
  22571. encoding = _encodings.StandardEncoding;
  22572. if (properties.type === "TrueType" && !isNonsymbolicFont) {
  22573. encoding = _encodings.WinAnsiEncoding;
  22574. }
  22575. if (isSymbolicFont) {
  22576. encoding = _encodings.MacRomanEncoding;
  22577. if (!properties.file || properties.isInternalFont) {
  22578. if (/Symbol/i.test(properties.name)) {
  22579. encoding = _encodings.SymbolSetEncoding;
  22580. } else if (/Dingbats|Wingdings/i.test(properties.name)) {
  22581. encoding = _encodings.ZapfDingbatsEncoding;
  22582. }
  22583. }
  22584. }
  22585. properties.defaultEncoding = encoding;
  22586. }
  22587. properties.differences = differences;
  22588. properties.baseEncodingName = baseEncodingName;
  22589. properties.hasEncoding = !!baseEncodingName || differences.length > 0;
  22590. properties.dict = dict;
  22591. return toUnicodePromise.then(readToUnicode => {
  22592. properties.toUnicode = readToUnicode;
  22593. return this.buildToUnicode(properties);
  22594. }).then(builtToUnicode => {
  22595. properties.toUnicode = builtToUnicode;
  22596. if (cidToGidBytes) {
  22597. properties.cidToGidMap = this.readCidToGidMap(cidToGidBytes, builtToUnicode);
  22598. }
  22599. return properties;
  22600. });
  22601. }
  22602. _simpleFontToUnicode(properties, forceGlyphs = false) {
  22603. (0, _util.assert)(!properties.composite, "Must be a simple font.");
  22604. const toUnicode = [];
  22605. const encoding = properties.defaultEncoding.slice();
  22606. const baseEncodingName = properties.baseEncodingName;
  22607. const differences = properties.differences;
  22608. for (const charcode in differences) {
  22609. const glyphName = differences[charcode];
  22610. if (glyphName === ".notdef") {
  22611. continue;
  22612. }
  22613. encoding[charcode] = glyphName;
  22614. }
  22615. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  22616. for (const charcode in encoding) {
  22617. let glyphName = encoding[charcode];
  22618. if (glyphName === "") {
  22619. continue;
  22620. } else if (glyphsUnicodeMap[glyphName] === undefined) {
  22621. let code = 0;
  22622. switch (glyphName[0]) {
  22623. case "G":
  22624. if (glyphName.length === 3) {
  22625. code = parseInt(glyphName.substring(1), 16);
  22626. }
  22627. break;
  22628. case "g":
  22629. if (glyphName.length === 5) {
  22630. code = parseInt(glyphName.substring(1), 16);
  22631. }
  22632. break;
  22633. case "C":
  22634. case "c":
  22635. if (glyphName.length >= 3 && glyphName.length <= 4) {
  22636. const codeStr = glyphName.substring(1);
  22637. if (forceGlyphs) {
  22638. code = parseInt(codeStr, 16);
  22639. break;
  22640. }
  22641. code = +codeStr;
  22642. if (Number.isNaN(code) && Number.isInteger(parseInt(codeStr, 16))) {
  22643. return this._simpleFontToUnicode(properties, true);
  22644. }
  22645. }
  22646. break;
  22647. default:
  22648. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  22649. if (unicode !== -1) {
  22650. code = unicode;
  22651. }
  22652. }
  22653. if (code > 0 && code <= 0x10ffff && Number.isInteger(code)) {
  22654. if (baseEncodingName && code === +charcode) {
  22655. const baseEncoding = (0, _encodings.getEncoding)(baseEncodingName);
  22656. if (baseEncoding && (glyphName = baseEncoding[charcode])) {
  22657. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22658. continue;
  22659. }
  22660. }
  22661. toUnicode[charcode] = String.fromCodePoint(code);
  22662. }
  22663. continue;
  22664. }
  22665. toUnicode[charcode] = String.fromCharCode(glyphsUnicodeMap[glyphName]);
  22666. }
  22667. return toUnicode;
  22668. }
  22669. async buildToUnicode(properties) {
  22670. properties.hasIncludedToUnicodeMap = !!properties.toUnicode && properties.toUnicode.length > 0;
  22671. if (properties.hasIncludedToUnicodeMap) {
  22672. if (!properties.composite && properties.hasEncoding) {
  22673. properties.fallbackToUnicode = this._simpleFontToUnicode(properties);
  22674. }
  22675. return properties.toUnicode;
  22676. }
  22677. if (!properties.composite) {
  22678. return new _to_unicode_map.ToUnicodeMap(this._simpleFontToUnicode(properties));
  22679. }
  22680. if (properties.composite && (properties.cMap.builtInCMap && !(properties.cMap instanceof _cmap.IdentityCMap) || properties.cidSystemInfo.registry === "Adobe" && (properties.cidSystemInfo.ordering === "GB1" || properties.cidSystemInfo.ordering === "CNS1" || properties.cidSystemInfo.ordering === "Japan1" || properties.cidSystemInfo.ordering === "Korea1"))) {
  22681. const {
  22682. registry,
  22683. ordering
  22684. } = properties.cidSystemInfo;
  22685. const ucs2CMapName = _primitives.Name.get(`${registry}-${ordering}-UCS2`);
  22686. const ucs2CMap = await _cmap.CMapFactory.create({
  22687. encoding: ucs2CMapName,
  22688. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22689. useCMap: null
  22690. });
  22691. const toUnicode = [];
  22692. properties.cMap.forEach(function (charcode, cid) {
  22693. if (cid > 0xffff) {
  22694. throw new _util.FormatError("Max size of CID is 65,535");
  22695. }
  22696. const ucs2 = ucs2CMap.lookup(cid);
  22697. if (ucs2) {
  22698. toUnicode[charcode] = String.fromCharCode((ucs2.charCodeAt(0) << 8) + ucs2.charCodeAt(1));
  22699. }
  22700. });
  22701. return new _to_unicode_map.ToUnicodeMap(toUnicode);
  22702. }
  22703. return new _to_unicode_map.IdentityToUnicodeMap(properties.firstChar, properties.lastChar);
  22704. }
  22705. readToUnicode(cmapObj) {
  22706. if (!cmapObj) {
  22707. return Promise.resolve(null);
  22708. }
  22709. if (cmapObj instanceof _primitives.Name) {
  22710. return _cmap.CMapFactory.create({
  22711. encoding: cmapObj,
  22712. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22713. useCMap: null
  22714. }).then(function (cmap) {
  22715. if (cmap instanceof _cmap.IdentityCMap) {
  22716. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22717. }
  22718. return new _to_unicode_map.ToUnicodeMap(cmap.getMap());
  22719. });
  22720. } else if (cmapObj instanceof _base_stream.BaseStream) {
  22721. return _cmap.CMapFactory.create({
  22722. encoding: cmapObj,
  22723. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  22724. useCMap: null
  22725. }).then(function (cmap) {
  22726. if (cmap instanceof _cmap.IdentityCMap) {
  22727. return new _to_unicode_map.IdentityToUnicodeMap(0, 0xffff);
  22728. }
  22729. const map = new Array(cmap.length);
  22730. cmap.forEach(function (charCode, token) {
  22731. if (typeof token === "number") {
  22732. map[charCode] = String.fromCodePoint(token);
  22733. return;
  22734. }
  22735. const str = [];
  22736. for (let k = 0; k < token.length; k += 2) {
  22737. const w1 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22738. if ((w1 & 0xf800) !== 0xd800) {
  22739. str.push(w1);
  22740. continue;
  22741. }
  22742. k += 2;
  22743. const w2 = token.charCodeAt(k) << 8 | token.charCodeAt(k + 1);
  22744. str.push(((w1 & 0x3ff) << 10) + (w2 & 0x3ff) + 0x10000);
  22745. }
  22746. map[charCode] = String.fromCodePoint.apply(String, str);
  22747. });
  22748. return new _to_unicode_map.ToUnicodeMap(map);
  22749. }, reason => {
  22750. if (reason instanceof _util.AbortException) {
  22751. return null;
  22752. }
  22753. if (this.options.ignoreErrors) {
  22754. this.handler.send("UnsupportedFeature", {
  22755. featureId: _util.UNSUPPORTED_FEATURES.errorFontToUnicode
  22756. });
  22757. (0, _util.warn)(`readToUnicode - ignoring ToUnicode data: "${reason}".`);
  22758. return null;
  22759. }
  22760. throw reason;
  22761. });
  22762. }
  22763. return Promise.resolve(null);
  22764. }
  22765. readCidToGidMap(glyphsData, toUnicode) {
  22766. const result = [];
  22767. for (let j = 0, jj = glyphsData.length; j < jj; j++) {
  22768. const glyphID = glyphsData[j++] << 8 | glyphsData[j];
  22769. const code = j >> 1;
  22770. if (glyphID === 0 && !toUnicode.has(code)) {
  22771. continue;
  22772. }
  22773. result[code] = glyphID;
  22774. }
  22775. return result;
  22776. }
  22777. extractWidths(dict, descriptor, properties) {
  22778. const xref = this.xref;
  22779. let glyphsWidths = [];
  22780. let defaultWidth = 0;
  22781. const glyphsVMetrics = [];
  22782. let defaultVMetrics;
  22783. let i, ii, j, jj, start, code, widths;
  22784. if (properties.composite) {
  22785. defaultWidth = dict.has("DW") ? dict.get("DW") : 1000;
  22786. widths = dict.get("W");
  22787. if (widths) {
  22788. for (i = 0, ii = widths.length; i < ii; i++) {
  22789. start = xref.fetchIfRef(widths[i++]);
  22790. code = xref.fetchIfRef(widths[i]);
  22791. if (Array.isArray(code)) {
  22792. for (j = 0, jj = code.length; j < jj; j++) {
  22793. glyphsWidths[start++] = xref.fetchIfRef(code[j]);
  22794. }
  22795. } else {
  22796. const width = xref.fetchIfRef(widths[++i]);
  22797. for (j = start; j <= code; j++) {
  22798. glyphsWidths[j] = width;
  22799. }
  22800. }
  22801. }
  22802. }
  22803. if (properties.vertical) {
  22804. let vmetrics = dict.getArray("DW2") || [880, -1000];
  22805. defaultVMetrics = [vmetrics[1], defaultWidth * 0.5, vmetrics[0]];
  22806. vmetrics = dict.get("W2");
  22807. if (vmetrics) {
  22808. for (i = 0, ii = vmetrics.length; i < ii; i++) {
  22809. start = xref.fetchIfRef(vmetrics[i++]);
  22810. code = xref.fetchIfRef(vmetrics[i]);
  22811. if (Array.isArray(code)) {
  22812. for (j = 0, jj = code.length; j < jj; j++) {
  22813. glyphsVMetrics[start++] = [xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j++]), xref.fetchIfRef(code[j])];
  22814. }
  22815. } else {
  22816. const vmetric = [xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i]), xref.fetchIfRef(vmetrics[++i])];
  22817. for (j = start; j <= code; j++) {
  22818. glyphsVMetrics[j] = vmetric;
  22819. }
  22820. }
  22821. }
  22822. }
  22823. }
  22824. } else {
  22825. const firstChar = properties.firstChar;
  22826. widths = dict.get("Widths");
  22827. if (widths) {
  22828. j = firstChar;
  22829. for (i = 0, ii = widths.length; i < ii; i++) {
  22830. glyphsWidths[j++] = xref.fetchIfRef(widths[i]);
  22831. }
  22832. defaultWidth = parseFloat(descriptor.get("MissingWidth")) || 0;
  22833. } else {
  22834. const baseFontName = dict.get("BaseFont");
  22835. if (baseFontName instanceof _primitives.Name) {
  22836. const metrics = this.getBaseFontMetrics(baseFontName.name);
  22837. glyphsWidths = this.buildCharCodeToWidth(metrics.widths, properties);
  22838. defaultWidth = metrics.defaultWidth;
  22839. }
  22840. }
  22841. }
  22842. let isMonospace = true;
  22843. let firstWidth = defaultWidth;
  22844. for (const glyph in glyphsWidths) {
  22845. const glyphWidth = glyphsWidths[glyph];
  22846. if (!glyphWidth) {
  22847. continue;
  22848. }
  22849. if (!firstWidth) {
  22850. firstWidth = glyphWidth;
  22851. continue;
  22852. }
  22853. if (firstWidth !== glyphWidth) {
  22854. isMonospace = false;
  22855. break;
  22856. }
  22857. }
  22858. if (isMonospace) {
  22859. properties.flags |= _fonts_utils.FontFlags.FixedPitch;
  22860. }
  22861. properties.defaultWidth = defaultWidth;
  22862. properties.widths = glyphsWidths;
  22863. properties.defaultVMetrics = defaultVMetrics;
  22864. properties.vmetrics = glyphsVMetrics;
  22865. }
  22866. isSerifFont(baseFontName) {
  22867. const fontNameWoStyle = baseFontName.split("-")[0];
  22868. return fontNameWoStyle in (0, _standard_fonts.getSerifFonts)() || fontNameWoStyle.search(/serif/gi) !== -1;
  22869. }
  22870. getBaseFontMetrics(name) {
  22871. let defaultWidth = 0;
  22872. let widths = Object.create(null);
  22873. let monospace = false;
  22874. const stdFontMap = (0, _standard_fonts.getStdFontMap)();
  22875. let lookupName = stdFontMap[name] || name;
  22876. const Metrics = (0, _metrics.getMetrics)();
  22877. if (!(lookupName in Metrics)) {
  22878. if (this.isSerifFont(name)) {
  22879. lookupName = "Times-Roman";
  22880. } else {
  22881. lookupName = "Helvetica";
  22882. }
  22883. }
  22884. const glyphWidths = Metrics[lookupName];
  22885. if (typeof glyphWidths === "number") {
  22886. defaultWidth = glyphWidths;
  22887. monospace = true;
  22888. } else {
  22889. widths = glyphWidths();
  22890. }
  22891. return {
  22892. defaultWidth,
  22893. monospace,
  22894. widths
  22895. };
  22896. }
  22897. buildCharCodeToWidth(widthsByGlyphName, properties) {
  22898. const widths = Object.create(null);
  22899. const differences = properties.differences;
  22900. const encoding = properties.defaultEncoding;
  22901. for (let charCode = 0; charCode < 256; charCode++) {
  22902. if (charCode in differences && widthsByGlyphName[differences[charCode]]) {
  22903. widths[charCode] = widthsByGlyphName[differences[charCode]];
  22904. continue;
  22905. }
  22906. if (charCode in encoding && widthsByGlyphName[encoding[charCode]]) {
  22907. widths[charCode] = widthsByGlyphName[encoding[charCode]];
  22908. continue;
  22909. }
  22910. }
  22911. return widths;
  22912. }
  22913. preEvaluateFont(dict) {
  22914. const baseDict = dict;
  22915. let type = dict.get("Subtype");
  22916. if (!(type instanceof _primitives.Name)) {
  22917. throw new _util.FormatError("invalid font Subtype");
  22918. }
  22919. let composite = false;
  22920. let hash, toUnicode;
  22921. if (type.name === "Type0") {
  22922. const df = dict.get("DescendantFonts");
  22923. if (!df) {
  22924. throw new _util.FormatError("Descendant fonts are not specified");
  22925. }
  22926. dict = Array.isArray(df) ? this.xref.fetchIfRef(df[0]) : df;
  22927. if (!(dict instanceof _primitives.Dict)) {
  22928. throw new _util.FormatError("Descendant font is not a dictionary.");
  22929. }
  22930. type = dict.get("Subtype");
  22931. if (!(type instanceof _primitives.Name)) {
  22932. throw new _util.FormatError("invalid font Subtype");
  22933. }
  22934. composite = true;
  22935. }
  22936. const firstChar = dict.get("FirstChar") || 0,
  22937. lastChar = dict.get("LastChar") || (composite ? 0xffff : 0xff);
  22938. const descriptor = dict.get("FontDescriptor");
  22939. if (descriptor) {
  22940. hash = new _murmurhash.MurmurHash3_64();
  22941. const encoding = baseDict.getRaw("Encoding");
  22942. if (encoding instanceof _primitives.Name) {
  22943. hash.update(encoding.name);
  22944. } else if (encoding instanceof _primitives.Ref) {
  22945. hash.update(encoding.toString());
  22946. } else if (encoding instanceof _primitives.Dict) {
  22947. for (const entry of encoding.getRawValues()) {
  22948. if (entry instanceof _primitives.Name) {
  22949. hash.update(entry.name);
  22950. } else if (entry instanceof _primitives.Ref) {
  22951. hash.update(entry.toString());
  22952. } else if (Array.isArray(entry)) {
  22953. const diffLength = entry.length,
  22954. diffBuf = new Array(diffLength);
  22955. for (let j = 0; j < diffLength; j++) {
  22956. const diffEntry = entry[j];
  22957. if (diffEntry instanceof _primitives.Name) {
  22958. diffBuf[j] = diffEntry.name;
  22959. } else if (typeof diffEntry === "number" || diffEntry instanceof _primitives.Ref) {
  22960. diffBuf[j] = diffEntry.toString();
  22961. }
  22962. }
  22963. hash.update(diffBuf.join());
  22964. }
  22965. }
  22966. }
  22967. hash.update(`${firstChar}-${lastChar}`);
  22968. toUnicode = dict.get("ToUnicode") || baseDict.get("ToUnicode");
  22969. if (toUnicode instanceof _base_stream.BaseStream) {
  22970. const stream = toUnicode.str || toUnicode;
  22971. const uint8array = stream.buffer ? new Uint8Array(stream.buffer.buffer, 0, stream.bufferLength) : new Uint8Array(stream.bytes.buffer, stream.start, stream.end - stream.start);
  22972. hash.update(uint8array);
  22973. } else if (toUnicode instanceof _primitives.Name) {
  22974. hash.update(toUnicode.name);
  22975. }
  22976. const widths = dict.get("Widths") || baseDict.get("Widths");
  22977. if (Array.isArray(widths)) {
  22978. const widthsBuf = [];
  22979. for (const entry of widths) {
  22980. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  22981. widthsBuf.push(entry.toString());
  22982. }
  22983. }
  22984. hash.update(widthsBuf.join());
  22985. }
  22986. if (composite) {
  22987. hash.update("compositeFont");
  22988. const compositeWidths = dict.get("W") || baseDict.get("W");
  22989. if (Array.isArray(compositeWidths)) {
  22990. const widthsBuf = [];
  22991. for (const entry of compositeWidths) {
  22992. if (typeof entry === "number" || entry instanceof _primitives.Ref) {
  22993. widthsBuf.push(entry.toString());
  22994. } else if (Array.isArray(entry)) {
  22995. const subWidthsBuf = [];
  22996. for (const element of entry) {
  22997. if (typeof element === "number" || element instanceof _primitives.Ref) {
  22998. subWidthsBuf.push(element.toString());
  22999. }
  23000. }
  23001. widthsBuf.push(`[${subWidthsBuf.join()}]`);
  23002. }
  23003. }
  23004. hash.update(widthsBuf.join());
  23005. }
  23006. const cidToGidMap = dict.getRaw("CIDToGIDMap") || baseDict.getRaw("CIDToGIDMap");
  23007. if (cidToGidMap instanceof _primitives.Name) {
  23008. hash.update(cidToGidMap.name);
  23009. } else if (cidToGidMap instanceof _primitives.Ref) {
  23010. hash.update(cidToGidMap.toString());
  23011. } else if (cidToGidMap instanceof _base_stream.BaseStream) {
  23012. hash.update(cidToGidMap.peekBytes());
  23013. }
  23014. }
  23015. }
  23016. return {
  23017. descriptor,
  23018. dict,
  23019. baseDict,
  23020. composite,
  23021. type: type.name,
  23022. firstChar,
  23023. lastChar,
  23024. toUnicode,
  23025. hash: hash ? hash.hexdigest() : ""
  23026. };
  23027. }
  23028. async translateFont({
  23029. descriptor,
  23030. dict,
  23031. baseDict,
  23032. composite,
  23033. type,
  23034. firstChar,
  23035. lastChar,
  23036. toUnicode,
  23037. cssFontInfo
  23038. }) {
  23039. const isType3Font = type === "Type3";
  23040. let properties;
  23041. if (!descriptor) {
  23042. if (isType3Font) {
  23043. descriptor = new _primitives.Dict(null);
  23044. descriptor.set("FontName", _primitives.Name.get(type));
  23045. descriptor.set("FontBBox", dict.getArray("FontBBox") || [0, 0, 0, 0]);
  23046. } else {
  23047. let baseFontName = dict.get("BaseFont");
  23048. if (!(baseFontName instanceof _primitives.Name)) {
  23049. throw new _util.FormatError("Base font is not specified");
  23050. }
  23051. baseFontName = baseFontName.name.replace(/[,_]/g, "-");
  23052. const metrics = this.getBaseFontMetrics(baseFontName);
  23053. const fontNameWoStyle = baseFontName.split("-")[0];
  23054. const flags = (this.isSerifFont(fontNameWoStyle) ? _fonts_utils.FontFlags.Serif : 0) | (metrics.monospace ? _fonts_utils.FontFlags.FixedPitch : 0) | ((0, _standard_fonts.getSymbolsFonts)()[fontNameWoStyle] ? _fonts_utils.FontFlags.Symbolic : _fonts_utils.FontFlags.Nonsymbolic);
  23055. properties = {
  23056. type,
  23057. name: baseFontName,
  23058. loadedName: baseDict.loadedName,
  23059. widths: metrics.widths,
  23060. defaultWidth: metrics.defaultWidth,
  23061. isSimulatedFlags: true,
  23062. flags,
  23063. firstChar,
  23064. lastChar,
  23065. toUnicode,
  23066. xHeight: 0,
  23067. capHeight: 0,
  23068. italicAngle: 0,
  23069. isType3Font
  23070. };
  23071. const widths = dict.get("Widths");
  23072. const standardFontName = (0, _standard_fonts.getStandardFontName)(baseFontName);
  23073. let file = null;
  23074. if (standardFontName) {
  23075. properties.isStandardFont = true;
  23076. file = await this.fetchStandardFontData(standardFontName);
  23077. properties.isInternalFont = !!file;
  23078. }
  23079. return this.extractDataStructures(dict, dict, properties).then(newProperties => {
  23080. if (widths) {
  23081. const glyphWidths = [];
  23082. let j = firstChar;
  23083. for (let i = 0, ii = widths.length; i < ii; i++) {
  23084. glyphWidths[j++] = this.xref.fetchIfRef(widths[i]);
  23085. }
  23086. newProperties.widths = glyphWidths;
  23087. } else {
  23088. newProperties.widths = this.buildCharCodeToWidth(metrics.widths, newProperties);
  23089. }
  23090. return new _fonts.Font(baseFontName, file, newProperties);
  23091. });
  23092. }
  23093. }
  23094. let fontName = descriptor.get("FontName");
  23095. let baseFont = dict.get("BaseFont");
  23096. if (typeof fontName === "string") {
  23097. fontName = _primitives.Name.get(fontName);
  23098. }
  23099. if (typeof baseFont === "string") {
  23100. baseFont = _primitives.Name.get(baseFont);
  23101. }
  23102. if (!isType3Font) {
  23103. const fontNameStr = fontName && fontName.name;
  23104. const baseFontStr = baseFont && baseFont.name;
  23105. if (fontNameStr !== baseFontStr) {
  23106. (0, _util.info)(`The FontDescriptor's FontName is "${fontNameStr}" but ` + `should be the same as the Font's BaseFont "${baseFontStr}".`);
  23107. if (fontNameStr && baseFontStr && baseFontStr.startsWith(fontNameStr)) {
  23108. fontName = baseFont;
  23109. }
  23110. }
  23111. }
  23112. fontName = fontName || baseFont;
  23113. if (!(fontName instanceof _primitives.Name)) {
  23114. throw new _util.FormatError("invalid font name");
  23115. }
  23116. let fontFile, subtype, length1, length2, length3;
  23117. try {
  23118. fontFile = descriptor.get("FontFile", "FontFile2", "FontFile3");
  23119. } catch (ex) {
  23120. if (!this.options.ignoreErrors) {
  23121. throw ex;
  23122. }
  23123. (0, _util.warn)(`translateFont - fetching "${fontName.name}" font file: "${ex}".`);
  23124. fontFile = new _stream.NullStream();
  23125. }
  23126. let isStandardFont = false;
  23127. let isInternalFont = false;
  23128. let glyphScaleFactors = null;
  23129. if (fontFile) {
  23130. if (fontFile.dict) {
  23131. const subtypeEntry = fontFile.dict.get("Subtype");
  23132. if (subtypeEntry instanceof _primitives.Name) {
  23133. subtype = subtypeEntry.name;
  23134. }
  23135. length1 = fontFile.dict.get("Length1");
  23136. length2 = fontFile.dict.get("Length2");
  23137. length3 = fontFile.dict.get("Length3");
  23138. }
  23139. } else if (cssFontInfo) {
  23140. const standardFontName = (0, _xfa_fonts.getXfaFontName)(fontName.name);
  23141. if (standardFontName) {
  23142. cssFontInfo.fontFamily = `${cssFontInfo.fontFamily}-PdfJS-XFA`;
  23143. cssFontInfo.metrics = standardFontName.metrics || null;
  23144. glyphScaleFactors = standardFontName.factors || null;
  23145. fontFile = await this.fetchStandardFontData(standardFontName.name);
  23146. isInternalFont = !!fontFile;
  23147. baseDict = dict = (0, _xfa_fonts.getXfaFontDict)(fontName.name);
  23148. composite = true;
  23149. }
  23150. } else if (!isType3Font) {
  23151. const standardFontName = (0, _standard_fonts.getStandardFontName)(fontName.name);
  23152. if (standardFontName) {
  23153. isStandardFont = true;
  23154. fontFile = await this.fetchStandardFontData(standardFontName);
  23155. isInternalFont = !!fontFile;
  23156. }
  23157. }
  23158. properties = {
  23159. type,
  23160. name: fontName.name,
  23161. subtype,
  23162. file: fontFile,
  23163. length1,
  23164. length2,
  23165. length3,
  23166. isStandardFont,
  23167. isInternalFont,
  23168. loadedName: baseDict.loadedName,
  23169. composite,
  23170. fixedPitch: false,
  23171. fontMatrix: dict.getArray("FontMatrix") || _util.FONT_IDENTITY_MATRIX,
  23172. firstChar,
  23173. lastChar,
  23174. toUnicode,
  23175. bbox: descriptor.getArray("FontBBox") || dict.getArray("FontBBox"),
  23176. ascent: descriptor.get("Ascent"),
  23177. descent: descriptor.get("Descent"),
  23178. xHeight: descriptor.get("XHeight") || 0,
  23179. capHeight: descriptor.get("CapHeight") || 0,
  23180. flags: descriptor.get("Flags"),
  23181. italicAngle: descriptor.get("ItalicAngle") || 0,
  23182. isType3Font,
  23183. cssFontInfo,
  23184. scaleFactors: glyphScaleFactors
  23185. };
  23186. if (composite) {
  23187. const cidEncoding = baseDict.get("Encoding");
  23188. if (cidEncoding instanceof _primitives.Name) {
  23189. properties.cidEncoding = cidEncoding.name;
  23190. }
  23191. const cMap = await _cmap.CMapFactory.create({
  23192. encoding: cidEncoding,
  23193. fetchBuiltInCMap: this._fetchBuiltInCMapBound,
  23194. useCMap: null
  23195. });
  23196. properties.cMap = cMap;
  23197. properties.vertical = properties.cMap.vertical;
  23198. }
  23199. return this.extractDataStructures(dict, baseDict, properties).then(newProperties => {
  23200. this.extractWidths(dict, descriptor, newProperties);
  23201. return new _fonts.Font(fontName.name, fontFile, newProperties);
  23202. });
  23203. }
  23204. static buildFontPaths(font, glyphs, handler, evaluatorOptions) {
  23205. function buildPath(fontChar) {
  23206. const glyphName = `${font.loadedName}_path_${fontChar}`;
  23207. try {
  23208. if (font.renderer.hasBuiltPath(fontChar)) {
  23209. return;
  23210. }
  23211. handler.send("commonobj", [glyphName, "FontPath", font.renderer.getPathJs(fontChar)]);
  23212. } catch (reason) {
  23213. if (evaluatorOptions.ignoreErrors) {
  23214. handler.send("UnsupportedFeature", {
  23215. featureId: _util.UNSUPPORTED_FEATURES.errorFontBuildPath
  23216. });
  23217. (0, _util.warn)(`buildFontPaths - ignoring ${glyphName} glyph: "${reason}".`);
  23218. return;
  23219. }
  23220. throw reason;
  23221. }
  23222. }
  23223. for (const glyph of glyphs) {
  23224. buildPath(glyph.fontChar);
  23225. const accent = glyph.accent;
  23226. if (accent && accent.fontChar) {
  23227. buildPath(accent.fontChar);
  23228. }
  23229. }
  23230. }
  23231. static get fallbackFontDict() {
  23232. const dict = new _primitives.Dict();
  23233. dict.set("BaseFont", _primitives.Name.get("PDFJS-FallbackFont"));
  23234. dict.set("Type", _primitives.Name.get("FallbackType"));
  23235. dict.set("Subtype", _primitives.Name.get("FallbackType"));
  23236. dict.set("Encoding", _primitives.Name.get("WinAnsiEncoding"));
  23237. return (0, _util.shadow)(this, "fallbackFontDict", dict);
  23238. }
  23239. }
  23240. exports.PartialEvaluator = PartialEvaluator;
  23241. class TranslatedFont {
  23242. constructor({
  23243. loadedName,
  23244. font,
  23245. dict,
  23246. evaluatorOptions
  23247. }) {
  23248. this.loadedName = loadedName;
  23249. this.font = font;
  23250. this.dict = dict;
  23251. this._evaluatorOptions = evaluatorOptions || DefaultPartialEvaluatorOptions;
  23252. this.type3Loaded = null;
  23253. this.type3Dependencies = font.isType3Font ? new Set() : null;
  23254. this.sent = false;
  23255. }
  23256. send(handler) {
  23257. if (this.sent) {
  23258. return;
  23259. }
  23260. this.sent = true;
  23261. handler.send("commonobj", [this.loadedName, "Font", this.font.exportData(this._evaluatorOptions.fontExtraProperties)]);
  23262. }
  23263. fallback(handler) {
  23264. if (!this.font.data) {
  23265. return;
  23266. }
  23267. this.font.disableFontFace = true;
  23268. PartialEvaluator.buildFontPaths(this.font, this.font.glyphCacheValues, handler, this._evaluatorOptions);
  23269. }
  23270. loadType3Data(evaluator, resources, task) {
  23271. if (this.type3Loaded) {
  23272. return this.type3Loaded;
  23273. }
  23274. if (!this.font.isType3Font) {
  23275. throw new Error("Must be a Type3 font.");
  23276. }
  23277. const type3Evaluator = evaluator.clone({
  23278. ignoreErrors: false
  23279. });
  23280. type3Evaluator.parsingType3Font = true;
  23281. const type3FontRefs = new _primitives.RefSet(evaluator.type3FontRefs);
  23282. if (this.dict.objId && !type3FontRefs.has(this.dict.objId)) {
  23283. type3FontRefs.put(this.dict.objId);
  23284. }
  23285. type3Evaluator.type3FontRefs = type3FontRefs;
  23286. const translatedFont = this.font,
  23287. type3Dependencies = this.type3Dependencies;
  23288. let loadCharProcsPromise = Promise.resolve();
  23289. const charProcs = this.dict.get("CharProcs");
  23290. const fontResources = this.dict.get("Resources") || resources;
  23291. const charProcOperatorList = Object.create(null);
  23292. const isEmptyBBox = !translatedFont.bbox || (0, _util.isArrayEqual)(translatedFont.bbox, [0, 0, 0, 0]);
  23293. for (const key of charProcs.getKeys()) {
  23294. loadCharProcsPromise = loadCharProcsPromise.then(() => {
  23295. const glyphStream = charProcs.get(key);
  23296. const operatorList = new _operator_list.OperatorList();
  23297. return type3Evaluator.getOperatorList({
  23298. stream: glyphStream,
  23299. task,
  23300. resources: fontResources,
  23301. operatorList
  23302. }).then(() => {
  23303. if (operatorList.fnArray[0] === _util.OPS.setCharWidthAndBounds) {
  23304. this._removeType3ColorOperators(operatorList, isEmptyBBox);
  23305. }
  23306. charProcOperatorList[key] = operatorList.getIR();
  23307. for (const dependency of operatorList.dependencies) {
  23308. type3Dependencies.add(dependency);
  23309. }
  23310. }).catch(function (reason) {
  23311. (0, _util.warn)(`Type3 font resource "${key}" is not available.`);
  23312. const dummyOperatorList = new _operator_list.OperatorList();
  23313. charProcOperatorList[key] = dummyOperatorList.getIR();
  23314. });
  23315. });
  23316. }
  23317. this.type3Loaded = loadCharProcsPromise.then(() => {
  23318. translatedFont.charProcOperatorList = charProcOperatorList;
  23319. if (this._bbox) {
  23320. translatedFont.isCharBBox = true;
  23321. translatedFont.bbox = this._bbox;
  23322. }
  23323. });
  23324. return this.type3Loaded;
  23325. }
  23326. _removeType3ColorOperators(operatorList, isEmptyBBox = false) {
  23327. if (isEmptyBBox) {
  23328. if (!this._bbox) {
  23329. this._bbox = [Infinity, Infinity, -Infinity, -Infinity];
  23330. }
  23331. const charBBox = _util.Util.normalizeRect(operatorList.argsArray[0].slice(2));
  23332. this._bbox[0] = Math.min(this._bbox[0], charBBox[0]);
  23333. this._bbox[1] = Math.min(this._bbox[1], charBBox[1]);
  23334. this._bbox[2] = Math.max(this._bbox[2], charBBox[2]);
  23335. this._bbox[3] = Math.max(this._bbox[3], charBBox[3]);
  23336. }
  23337. let i = 1,
  23338. ii = operatorList.length;
  23339. while (i < ii) {
  23340. switch (operatorList.fnArray[i]) {
  23341. case _util.OPS.setStrokeColorSpace:
  23342. case _util.OPS.setFillColorSpace:
  23343. case _util.OPS.setStrokeColor:
  23344. case _util.OPS.setStrokeColorN:
  23345. case _util.OPS.setFillColor:
  23346. case _util.OPS.setFillColorN:
  23347. case _util.OPS.setStrokeGray:
  23348. case _util.OPS.setFillGray:
  23349. case _util.OPS.setStrokeRGBColor:
  23350. case _util.OPS.setFillRGBColor:
  23351. case _util.OPS.setStrokeCMYKColor:
  23352. case _util.OPS.setFillCMYKColor:
  23353. case _util.OPS.shadingFill:
  23354. case _util.OPS.setRenderingIntent:
  23355. operatorList.fnArray.splice(i, 1);
  23356. operatorList.argsArray.splice(i, 1);
  23357. ii--;
  23358. continue;
  23359. case _util.OPS.setGState:
  23360. const [gStateObj] = operatorList.argsArray[i];
  23361. let j = 0,
  23362. jj = gStateObj.length;
  23363. while (j < jj) {
  23364. const [gStateKey] = gStateObj[j];
  23365. switch (gStateKey) {
  23366. case "TR":
  23367. case "TR2":
  23368. case "HT":
  23369. case "BG":
  23370. case "BG2":
  23371. case "UCR":
  23372. case "UCR2":
  23373. gStateObj.splice(j, 1);
  23374. jj--;
  23375. continue;
  23376. }
  23377. j++;
  23378. }
  23379. break;
  23380. }
  23381. i++;
  23382. }
  23383. }
  23384. }
  23385. class StateManager {
  23386. constructor(initialState = new EvalState()) {
  23387. this.state = initialState;
  23388. this.stateStack = [];
  23389. }
  23390. save() {
  23391. const old = this.state;
  23392. this.stateStack.push(this.state);
  23393. this.state = old.clone();
  23394. }
  23395. restore() {
  23396. const prev = this.stateStack.pop();
  23397. if (prev) {
  23398. this.state = prev;
  23399. }
  23400. }
  23401. transform(args) {
  23402. this.state.ctm = _util.Util.transform(this.state.ctm, args);
  23403. }
  23404. }
  23405. class TextState {
  23406. constructor() {
  23407. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23408. this.fontName = null;
  23409. this.fontSize = 0;
  23410. this.font = null;
  23411. this.fontMatrix = _util.FONT_IDENTITY_MATRIX;
  23412. this.textMatrix = _util.IDENTITY_MATRIX.slice();
  23413. this.textLineMatrix = _util.IDENTITY_MATRIX.slice();
  23414. this.charSpacing = 0;
  23415. this.wordSpacing = 0;
  23416. this.leading = 0;
  23417. this.textHScale = 1;
  23418. this.textRise = 0;
  23419. }
  23420. setTextMatrix(a, b, c, d, e, f) {
  23421. const m = this.textMatrix;
  23422. m[0] = a;
  23423. m[1] = b;
  23424. m[2] = c;
  23425. m[3] = d;
  23426. m[4] = e;
  23427. m[5] = f;
  23428. }
  23429. setTextLineMatrix(a, b, c, d, e, f) {
  23430. const m = this.textLineMatrix;
  23431. m[0] = a;
  23432. m[1] = b;
  23433. m[2] = c;
  23434. m[3] = d;
  23435. m[4] = e;
  23436. m[5] = f;
  23437. }
  23438. translateTextMatrix(x, y) {
  23439. const m = this.textMatrix;
  23440. m[4] = m[0] * x + m[2] * y + m[4];
  23441. m[5] = m[1] * x + m[3] * y + m[5];
  23442. }
  23443. translateTextLineMatrix(x, y) {
  23444. const m = this.textLineMatrix;
  23445. m[4] = m[0] * x + m[2] * y + m[4];
  23446. m[5] = m[1] * x + m[3] * y + m[5];
  23447. }
  23448. carriageReturn() {
  23449. this.translateTextLineMatrix(0, -this.leading);
  23450. this.textMatrix = this.textLineMatrix.slice();
  23451. }
  23452. clone() {
  23453. const clone = Object.create(this);
  23454. clone.textMatrix = this.textMatrix.slice();
  23455. clone.textLineMatrix = this.textLineMatrix.slice();
  23456. clone.fontMatrix = this.fontMatrix.slice();
  23457. return clone;
  23458. }
  23459. }
  23460. class EvalState {
  23461. constructor() {
  23462. this.ctm = new Float32Array(_util.IDENTITY_MATRIX);
  23463. this.font = null;
  23464. this.textRenderingMode = _util.TextRenderingMode.FILL;
  23465. this.fillColorSpace = _colorspace.ColorSpace.singletons.gray;
  23466. this.strokeColorSpace = _colorspace.ColorSpace.singletons.gray;
  23467. }
  23468. clone() {
  23469. return Object.create(this);
  23470. }
  23471. }
  23472. class EvaluatorPreprocessor {
  23473. static get opMap() {
  23474. const getOPMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  23475. t.w = {
  23476. id: _util.OPS.setLineWidth,
  23477. numArgs: 1,
  23478. variableArgs: false
  23479. };
  23480. t.J = {
  23481. id: _util.OPS.setLineCap,
  23482. numArgs: 1,
  23483. variableArgs: false
  23484. };
  23485. t.j = {
  23486. id: _util.OPS.setLineJoin,
  23487. numArgs: 1,
  23488. variableArgs: false
  23489. };
  23490. t.M = {
  23491. id: _util.OPS.setMiterLimit,
  23492. numArgs: 1,
  23493. variableArgs: false
  23494. };
  23495. t.d = {
  23496. id: _util.OPS.setDash,
  23497. numArgs: 2,
  23498. variableArgs: false
  23499. };
  23500. t.ri = {
  23501. id: _util.OPS.setRenderingIntent,
  23502. numArgs: 1,
  23503. variableArgs: false
  23504. };
  23505. t.i = {
  23506. id: _util.OPS.setFlatness,
  23507. numArgs: 1,
  23508. variableArgs: false
  23509. };
  23510. t.gs = {
  23511. id: _util.OPS.setGState,
  23512. numArgs: 1,
  23513. variableArgs: false
  23514. };
  23515. t.q = {
  23516. id: _util.OPS.save,
  23517. numArgs: 0,
  23518. variableArgs: false
  23519. };
  23520. t.Q = {
  23521. id: _util.OPS.restore,
  23522. numArgs: 0,
  23523. variableArgs: false
  23524. };
  23525. t.cm = {
  23526. id: _util.OPS.transform,
  23527. numArgs: 6,
  23528. variableArgs: false
  23529. };
  23530. t.m = {
  23531. id: _util.OPS.moveTo,
  23532. numArgs: 2,
  23533. variableArgs: false
  23534. };
  23535. t.l = {
  23536. id: _util.OPS.lineTo,
  23537. numArgs: 2,
  23538. variableArgs: false
  23539. };
  23540. t.c = {
  23541. id: _util.OPS.curveTo,
  23542. numArgs: 6,
  23543. variableArgs: false
  23544. };
  23545. t.v = {
  23546. id: _util.OPS.curveTo2,
  23547. numArgs: 4,
  23548. variableArgs: false
  23549. };
  23550. t.y = {
  23551. id: _util.OPS.curveTo3,
  23552. numArgs: 4,
  23553. variableArgs: false
  23554. };
  23555. t.h = {
  23556. id: _util.OPS.closePath,
  23557. numArgs: 0,
  23558. variableArgs: false
  23559. };
  23560. t.re = {
  23561. id: _util.OPS.rectangle,
  23562. numArgs: 4,
  23563. variableArgs: false
  23564. };
  23565. t.S = {
  23566. id: _util.OPS.stroke,
  23567. numArgs: 0,
  23568. variableArgs: false
  23569. };
  23570. t.s = {
  23571. id: _util.OPS.closeStroke,
  23572. numArgs: 0,
  23573. variableArgs: false
  23574. };
  23575. t.f = {
  23576. id: _util.OPS.fill,
  23577. numArgs: 0,
  23578. variableArgs: false
  23579. };
  23580. t.F = {
  23581. id: _util.OPS.fill,
  23582. numArgs: 0,
  23583. variableArgs: false
  23584. };
  23585. t["f*"] = {
  23586. id: _util.OPS.eoFill,
  23587. numArgs: 0,
  23588. variableArgs: false
  23589. };
  23590. t.B = {
  23591. id: _util.OPS.fillStroke,
  23592. numArgs: 0,
  23593. variableArgs: false
  23594. };
  23595. t["B*"] = {
  23596. id: _util.OPS.eoFillStroke,
  23597. numArgs: 0,
  23598. variableArgs: false
  23599. };
  23600. t.b = {
  23601. id: _util.OPS.closeFillStroke,
  23602. numArgs: 0,
  23603. variableArgs: false
  23604. };
  23605. t["b*"] = {
  23606. id: _util.OPS.closeEOFillStroke,
  23607. numArgs: 0,
  23608. variableArgs: false
  23609. };
  23610. t.n = {
  23611. id: _util.OPS.endPath,
  23612. numArgs: 0,
  23613. variableArgs: false
  23614. };
  23615. t.W = {
  23616. id: _util.OPS.clip,
  23617. numArgs: 0,
  23618. variableArgs: false
  23619. };
  23620. t["W*"] = {
  23621. id: _util.OPS.eoClip,
  23622. numArgs: 0,
  23623. variableArgs: false
  23624. };
  23625. t.BT = {
  23626. id: _util.OPS.beginText,
  23627. numArgs: 0,
  23628. variableArgs: false
  23629. };
  23630. t.ET = {
  23631. id: _util.OPS.endText,
  23632. numArgs: 0,
  23633. variableArgs: false
  23634. };
  23635. t.Tc = {
  23636. id: _util.OPS.setCharSpacing,
  23637. numArgs: 1,
  23638. variableArgs: false
  23639. };
  23640. t.Tw = {
  23641. id: _util.OPS.setWordSpacing,
  23642. numArgs: 1,
  23643. variableArgs: false
  23644. };
  23645. t.Tz = {
  23646. id: _util.OPS.setHScale,
  23647. numArgs: 1,
  23648. variableArgs: false
  23649. };
  23650. t.TL = {
  23651. id: _util.OPS.setLeading,
  23652. numArgs: 1,
  23653. variableArgs: false
  23654. };
  23655. t.Tf = {
  23656. id: _util.OPS.setFont,
  23657. numArgs: 2,
  23658. variableArgs: false
  23659. };
  23660. t.Tr = {
  23661. id: _util.OPS.setTextRenderingMode,
  23662. numArgs: 1,
  23663. variableArgs: false
  23664. };
  23665. t.Ts = {
  23666. id: _util.OPS.setTextRise,
  23667. numArgs: 1,
  23668. variableArgs: false
  23669. };
  23670. t.Td = {
  23671. id: _util.OPS.moveText,
  23672. numArgs: 2,
  23673. variableArgs: false
  23674. };
  23675. t.TD = {
  23676. id: _util.OPS.setLeadingMoveText,
  23677. numArgs: 2,
  23678. variableArgs: false
  23679. };
  23680. t.Tm = {
  23681. id: _util.OPS.setTextMatrix,
  23682. numArgs: 6,
  23683. variableArgs: false
  23684. };
  23685. t["T*"] = {
  23686. id: _util.OPS.nextLine,
  23687. numArgs: 0,
  23688. variableArgs: false
  23689. };
  23690. t.Tj = {
  23691. id: _util.OPS.showText,
  23692. numArgs: 1,
  23693. variableArgs: false
  23694. };
  23695. t.TJ = {
  23696. id: _util.OPS.showSpacedText,
  23697. numArgs: 1,
  23698. variableArgs: false
  23699. };
  23700. t["'"] = {
  23701. id: _util.OPS.nextLineShowText,
  23702. numArgs: 1,
  23703. variableArgs: false
  23704. };
  23705. t['"'] = {
  23706. id: _util.OPS.nextLineSetSpacingShowText,
  23707. numArgs: 3,
  23708. variableArgs: false
  23709. };
  23710. t.d0 = {
  23711. id: _util.OPS.setCharWidth,
  23712. numArgs: 2,
  23713. variableArgs: false
  23714. };
  23715. t.d1 = {
  23716. id: _util.OPS.setCharWidthAndBounds,
  23717. numArgs: 6,
  23718. variableArgs: false
  23719. };
  23720. t.CS = {
  23721. id: _util.OPS.setStrokeColorSpace,
  23722. numArgs: 1,
  23723. variableArgs: false
  23724. };
  23725. t.cs = {
  23726. id: _util.OPS.setFillColorSpace,
  23727. numArgs: 1,
  23728. variableArgs: false
  23729. };
  23730. t.SC = {
  23731. id: _util.OPS.setStrokeColor,
  23732. numArgs: 4,
  23733. variableArgs: true
  23734. };
  23735. t.SCN = {
  23736. id: _util.OPS.setStrokeColorN,
  23737. numArgs: 33,
  23738. variableArgs: true
  23739. };
  23740. t.sc = {
  23741. id: _util.OPS.setFillColor,
  23742. numArgs: 4,
  23743. variableArgs: true
  23744. };
  23745. t.scn = {
  23746. id: _util.OPS.setFillColorN,
  23747. numArgs: 33,
  23748. variableArgs: true
  23749. };
  23750. t.G = {
  23751. id: _util.OPS.setStrokeGray,
  23752. numArgs: 1,
  23753. variableArgs: false
  23754. };
  23755. t.g = {
  23756. id: _util.OPS.setFillGray,
  23757. numArgs: 1,
  23758. variableArgs: false
  23759. };
  23760. t.RG = {
  23761. id: _util.OPS.setStrokeRGBColor,
  23762. numArgs: 3,
  23763. variableArgs: false
  23764. };
  23765. t.rg = {
  23766. id: _util.OPS.setFillRGBColor,
  23767. numArgs: 3,
  23768. variableArgs: false
  23769. };
  23770. t.K = {
  23771. id: _util.OPS.setStrokeCMYKColor,
  23772. numArgs: 4,
  23773. variableArgs: false
  23774. };
  23775. t.k = {
  23776. id: _util.OPS.setFillCMYKColor,
  23777. numArgs: 4,
  23778. variableArgs: false
  23779. };
  23780. t.sh = {
  23781. id: _util.OPS.shadingFill,
  23782. numArgs: 1,
  23783. variableArgs: false
  23784. };
  23785. t.BI = {
  23786. id: _util.OPS.beginInlineImage,
  23787. numArgs: 0,
  23788. variableArgs: false
  23789. };
  23790. t.ID = {
  23791. id: _util.OPS.beginImageData,
  23792. numArgs: 0,
  23793. variableArgs: false
  23794. };
  23795. t.EI = {
  23796. id: _util.OPS.endInlineImage,
  23797. numArgs: 1,
  23798. variableArgs: false
  23799. };
  23800. t.Do = {
  23801. id: _util.OPS.paintXObject,
  23802. numArgs: 1,
  23803. variableArgs: false
  23804. };
  23805. t.MP = {
  23806. id: _util.OPS.markPoint,
  23807. numArgs: 1,
  23808. variableArgs: false
  23809. };
  23810. t.DP = {
  23811. id: _util.OPS.markPointProps,
  23812. numArgs: 2,
  23813. variableArgs: false
  23814. };
  23815. t.BMC = {
  23816. id: _util.OPS.beginMarkedContent,
  23817. numArgs: 1,
  23818. variableArgs: false
  23819. };
  23820. t.BDC = {
  23821. id: _util.OPS.beginMarkedContentProps,
  23822. numArgs: 2,
  23823. variableArgs: false
  23824. };
  23825. t.EMC = {
  23826. id: _util.OPS.endMarkedContent,
  23827. numArgs: 0,
  23828. variableArgs: false
  23829. };
  23830. t.BX = {
  23831. id: _util.OPS.beginCompat,
  23832. numArgs: 0,
  23833. variableArgs: false
  23834. };
  23835. t.EX = {
  23836. id: _util.OPS.endCompat,
  23837. numArgs: 0,
  23838. variableArgs: false
  23839. };
  23840. t.BM = null;
  23841. t.BD = null;
  23842. t.true = null;
  23843. t.fa = null;
  23844. t.fal = null;
  23845. t.fals = null;
  23846. t.false = null;
  23847. t.nu = null;
  23848. t.nul = null;
  23849. t.null = null;
  23850. });
  23851. return (0, _util.shadow)(this, "opMap", getOPMap());
  23852. }
  23853. static get MAX_INVALID_PATH_OPS() {
  23854. return (0, _util.shadow)(this, "MAX_INVALID_PATH_OPS", 10);
  23855. }
  23856. constructor(stream, xref, stateManager = new StateManager()) {
  23857. this.parser = new _parser.Parser({
  23858. lexer: new _parser.Lexer(stream, EvaluatorPreprocessor.opMap),
  23859. xref
  23860. });
  23861. this.stateManager = stateManager;
  23862. this.nonProcessedArgs = [];
  23863. this._numInvalidPathOPS = 0;
  23864. }
  23865. get savedStatesDepth() {
  23866. return this.stateManager.stateStack.length;
  23867. }
  23868. read(operation) {
  23869. let args = operation.args;
  23870. while (true) {
  23871. const obj = this.parser.getObj();
  23872. if (obj instanceof _primitives.Cmd) {
  23873. const cmd = obj.cmd;
  23874. const opSpec = EvaluatorPreprocessor.opMap[cmd];
  23875. if (!opSpec) {
  23876. (0, _util.warn)(`Unknown command "${cmd}".`);
  23877. continue;
  23878. }
  23879. const fn = opSpec.id;
  23880. const numArgs = opSpec.numArgs;
  23881. let argsLength = args !== null ? args.length : 0;
  23882. if (!opSpec.variableArgs) {
  23883. if (argsLength !== numArgs) {
  23884. const nonProcessedArgs = this.nonProcessedArgs;
  23885. while (argsLength > numArgs) {
  23886. nonProcessedArgs.push(args.shift());
  23887. argsLength--;
  23888. }
  23889. while (argsLength < numArgs && nonProcessedArgs.length !== 0) {
  23890. if (args === null) {
  23891. args = [];
  23892. }
  23893. args.unshift(nonProcessedArgs.pop());
  23894. argsLength++;
  23895. }
  23896. }
  23897. if (argsLength < numArgs) {
  23898. const partialMsg = `command ${cmd}: expected ${numArgs} args, ` + `but received ${argsLength} args.`;
  23899. if (fn >= _util.OPS.moveTo && fn <= _util.OPS.endPath && ++this._numInvalidPathOPS > EvaluatorPreprocessor.MAX_INVALID_PATH_OPS) {
  23900. throw new _util.FormatError(`Invalid ${partialMsg}`);
  23901. }
  23902. (0, _util.warn)(`Skipping ${partialMsg}`);
  23903. if (args !== null) {
  23904. args.length = 0;
  23905. }
  23906. continue;
  23907. }
  23908. } else if (argsLength > numArgs) {
  23909. (0, _util.info)(`Command ${cmd}: expected [0, ${numArgs}] args, ` + `but received ${argsLength} args.`);
  23910. }
  23911. this.preprocessCommand(fn, args);
  23912. operation.fn = fn;
  23913. operation.args = args;
  23914. return true;
  23915. }
  23916. if (obj === _primitives.EOF) {
  23917. return false;
  23918. }
  23919. if (obj !== null) {
  23920. if (args === null) {
  23921. args = [];
  23922. }
  23923. args.push(obj);
  23924. if (args.length > 33) {
  23925. throw new _util.FormatError("Too many arguments");
  23926. }
  23927. }
  23928. }
  23929. }
  23930. preprocessCommand(fn, args) {
  23931. switch (fn | 0) {
  23932. case _util.OPS.save:
  23933. this.stateManager.save();
  23934. break;
  23935. case _util.OPS.restore:
  23936. this.stateManager.restore();
  23937. break;
  23938. case _util.OPS.transform:
  23939. this.stateManager.transform(args);
  23940. break;
  23941. }
  23942. }
  23943. }
  23944. exports.EvaluatorPreprocessor = EvaluatorPreprocessor;
  23945. /***/ }),
  23946. /* 26 */
  23947. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  23948. Object.defineProperty(exports, "__esModule", ({
  23949. value: true
  23950. }));
  23951. exports.IdentityCMap = exports.CMapFactory = exports.CMap = void 0;
  23952. var _util = __w_pdfjs_require__(2);
  23953. var _primitives = __w_pdfjs_require__(5);
  23954. var _base_stream = __w_pdfjs_require__(9);
  23955. var _parser = __w_pdfjs_require__(27);
  23956. var _core_utils = __w_pdfjs_require__(8);
  23957. var _stream = __w_pdfjs_require__(10);
  23958. 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"];
  23959. const MAX_MAP_RANGE = 2 ** 24 - 1;
  23960. class CMap {
  23961. constructor(builtInCMap = false) {
  23962. this.codespaceRanges = [[], [], [], []];
  23963. this.numCodespaceRanges = 0;
  23964. this._map = [];
  23965. this.name = "";
  23966. this.vertical = false;
  23967. this.useCMap = null;
  23968. this.builtInCMap = builtInCMap;
  23969. }
  23970. addCodespaceRange(n, low, high) {
  23971. this.codespaceRanges[n - 1].push(low, high);
  23972. this.numCodespaceRanges++;
  23973. }
  23974. mapCidRange(low, high, dstLow) {
  23975. if (high - low > MAX_MAP_RANGE) {
  23976. throw new Error("mapCidRange - ignoring data above MAX_MAP_RANGE.");
  23977. }
  23978. while (low <= high) {
  23979. this._map[low++] = dstLow++;
  23980. }
  23981. }
  23982. mapBfRange(low, high, dstLow) {
  23983. if (high - low > MAX_MAP_RANGE) {
  23984. throw new Error("mapBfRange - ignoring data above MAX_MAP_RANGE.");
  23985. }
  23986. const lastByte = dstLow.length - 1;
  23987. while (low <= high) {
  23988. this._map[low++] = dstLow;
  23989. const nextCharCode = dstLow.charCodeAt(lastByte) + 1;
  23990. if (nextCharCode > 0xff) {
  23991. dstLow = dstLow.substring(0, lastByte - 1) + String.fromCharCode(dstLow.charCodeAt(lastByte - 1) + 1) + "\x00";
  23992. continue;
  23993. }
  23994. dstLow = dstLow.substring(0, lastByte) + String.fromCharCode(nextCharCode);
  23995. }
  23996. }
  23997. mapBfRangeToArray(low, high, array) {
  23998. if (high - low > MAX_MAP_RANGE) {
  23999. throw new Error("mapBfRangeToArray - ignoring data above MAX_MAP_RANGE.");
  24000. }
  24001. const ii = array.length;
  24002. let i = 0;
  24003. while (low <= high && i < ii) {
  24004. this._map[low] = array[i++];
  24005. ++low;
  24006. }
  24007. }
  24008. mapOne(src, dst) {
  24009. this._map[src] = dst;
  24010. }
  24011. lookup(code) {
  24012. return this._map[code];
  24013. }
  24014. contains(code) {
  24015. return this._map[code] !== undefined;
  24016. }
  24017. forEach(callback) {
  24018. const map = this._map;
  24019. const length = map.length;
  24020. if (length <= 0x10000) {
  24021. for (let i = 0; i < length; i++) {
  24022. if (map[i] !== undefined) {
  24023. callback(i, map[i]);
  24024. }
  24025. }
  24026. } else {
  24027. for (const i in map) {
  24028. callback(i, map[i]);
  24029. }
  24030. }
  24031. }
  24032. charCodeOf(value) {
  24033. const map = this._map;
  24034. if (map.length <= 0x10000) {
  24035. return map.indexOf(value);
  24036. }
  24037. for (const charCode in map) {
  24038. if (map[charCode] === value) {
  24039. return charCode | 0;
  24040. }
  24041. }
  24042. return -1;
  24043. }
  24044. getMap() {
  24045. return this._map;
  24046. }
  24047. readCharCode(str, offset, out) {
  24048. let c = 0;
  24049. const codespaceRanges = this.codespaceRanges;
  24050. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  24051. c = (c << 8 | str.charCodeAt(offset + n)) >>> 0;
  24052. const codespaceRange = codespaceRanges[n];
  24053. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  24054. const low = codespaceRange[k++];
  24055. const high = codespaceRange[k++];
  24056. if (c >= low && c <= high) {
  24057. out.charcode = c;
  24058. out.length = n + 1;
  24059. return;
  24060. }
  24061. }
  24062. }
  24063. out.charcode = 0;
  24064. out.length = 1;
  24065. }
  24066. getCharCodeLength(charCode) {
  24067. const codespaceRanges = this.codespaceRanges;
  24068. for (let n = 0, nn = codespaceRanges.length; n < nn; n++) {
  24069. const codespaceRange = codespaceRanges[n];
  24070. for (let k = 0, kk = codespaceRange.length; k < kk;) {
  24071. const low = codespaceRange[k++];
  24072. const high = codespaceRange[k++];
  24073. if (charCode >= low && charCode <= high) {
  24074. return n + 1;
  24075. }
  24076. }
  24077. }
  24078. return 1;
  24079. }
  24080. get length() {
  24081. return this._map.length;
  24082. }
  24083. get isIdentityCMap() {
  24084. if (!(this.name === "Identity-H" || this.name === "Identity-V")) {
  24085. return false;
  24086. }
  24087. if (this._map.length !== 0x10000) {
  24088. return false;
  24089. }
  24090. for (let i = 0; i < 0x10000; i++) {
  24091. if (this._map[i] !== i) {
  24092. return false;
  24093. }
  24094. }
  24095. return true;
  24096. }
  24097. }
  24098. exports.CMap = CMap;
  24099. class IdentityCMap extends CMap {
  24100. constructor(vertical, n) {
  24101. super();
  24102. this.vertical = vertical;
  24103. this.addCodespaceRange(n, 0, 0xffff);
  24104. }
  24105. mapCidRange(low, high, dstLow) {
  24106. (0, _util.unreachable)("should not call mapCidRange");
  24107. }
  24108. mapBfRange(low, high, dstLow) {
  24109. (0, _util.unreachable)("should not call mapBfRange");
  24110. }
  24111. mapBfRangeToArray(low, high, array) {
  24112. (0, _util.unreachable)("should not call mapBfRangeToArray");
  24113. }
  24114. mapOne(src, dst) {
  24115. (0, _util.unreachable)("should not call mapCidOne");
  24116. }
  24117. lookup(code) {
  24118. return Number.isInteger(code) && code <= 0xffff ? code : undefined;
  24119. }
  24120. contains(code) {
  24121. return Number.isInteger(code) && code <= 0xffff;
  24122. }
  24123. forEach(callback) {
  24124. for (let i = 0; i <= 0xffff; i++) {
  24125. callback(i, i);
  24126. }
  24127. }
  24128. charCodeOf(value) {
  24129. return Number.isInteger(value) && value <= 0xffff ? value : -1;
  24130. }
  24131. getMap() {
  24132. const map = new Array(0x10000);
  24133. for (let i = 0; i <= 0xffff; i++) {
  24134. map[i] = i;
  24135. }
  24136. return map;
  24137. }
  24138. get length() {
  24139. return 0x10000;
  24140. }
  24141. get isIdentityCMap() {
  24142. (0, _util.unreachable)("should not access .isIdentityCMap");
  24143. }
  24144. }
  24145. exports.IdentityCMap = IdentityCMap;
  24146. const BinaryCMapReader = function BinaryCMapReaderClosure() {
  24147. function hexToInt(a, size) {
  24148. let n = 0;
  24149. for (let i = 0; i <= size; i++) {
  24150. n = n << 8 | a[i];
  24151. }
  24152. return n >>> 0;
  24153. }
  24154. function hexToStr(a, size) {
  24155. if (size === 1) {
  24156. return String.fromCharCode(a[0], a[1]);
  24157. }
  24158. if (size === 3) {
  24159. return String.fromCharCode(a[0], a[1], a[2], a[3]);
  24160. }
  24161. return String.fromCharCode.apply(null, a.subarray(0, size + 1));
  24162. }
  24163. function addHex(a, b, size) {
  24164. let c = 0;
  24165. for (let i = size; i >= 0; i--) {
  24166. c += a[i] + b[i];
  24167. a[i] = c & 255;
  24168. c >>= 8;
  24169. }
  24170. }
  24171. function incHex(a, size) {
  24172. let c = 1;
  24173. for (let i = size; i >= 0 && c > 0; i--) {
  24174. c += a[i];
  24175. a[i] = c & 255;
  24176. c >>= 8;
  24177. }
  24178. }
  24179. const MAX_NUM_SIZE = 16;
  24180. const MAX_ENCODED_NUM_SIZE = 19;
  24181. class BinaryCMapStream {
  24182. constructor(data) {
  24183. this.buffer = data;
  24184. this.pos = 0;
  24185. this.end = data.length;
  24186. this.tmpBuf = new Uint8Array(MAX_ENCODED_NUM_SIZE);
  24187. }
  24188. readByte() {
  24189. if (this.pos >= this.end) {
  24190. return -1;
  24191. }
  24192. return this.buffer[this.pos++];
  24193. }
  24194. readNumber() {
  24195. let n = 0;
  24196. let last;
  24197. do {
  24198. const b = this.readByte();
  24199. if (b < 0) {
  24200. throw new _util.FormatError("unexpected EOF in bcmap");
  24201. }
  24202. last = !(b & 0x80);
  24203. n = n << 7 | b & 0x7f;
  24204. } while (!last);
  24205. return n;
  24206. }
  24207. readSigned() {
  24208. const n = this.readNumber();
  24209. return n & 1 ? ~(n >>> 1) : n >>> 1;
  24210. }
  24211. readHex(num, size) {
  24212. num.set(this.buffer.subarray(this.pos, this.pos + size + 1));
  24213. this.pos += size + 1;
  24214. }
  24215. readHexNumber(num, size) {
  24216. let last;
  24217. const stack = this.tmpBuf;
  24218. let sp = 0;
  24219. do {
  24220. const b = this.readByte();
  24221. if (b < 0) {
  24222. throw new _util.FormatError("unexpected EOF in bcmap");
  24223. }
  24224. last = !(b & 0x80);
  24225. stack[sp++] = b & 0x7f;
  24226. } while (!last);
  24227. let i = size,
  24228. buffer = 0,
  24229. bufferSize = 0;
  24230. while (i >= 0) {
  24231. while (bufferSize < 8 && stack.length > 0) {
  24232. buffer |= stack[--sp] << bufferSize;
  24233. bufferSize += 7;
  24234. }
  24235. num[i] = buffer & 255;
  24236. i--;
  24237. buffer >>= 8;
  24238. bufferSize -= 8;
  24239. }
  24240. }
  24241. readHexSigned(num, size) {
  24242. this.readHexNumber(num, size);
  24243. const sign = num[size] & 1 ? 255 : 0;
  24244. let c = 0;
  24245. for (let i = 0; i <= size; i++) {
  24246. c = (c & 1) << 8 | num[i];
  24247. num[i] = c >> 1 ^ sign;
  24248. }
  24249. }
  24250. readString() {
  24251. const len = this.readNumber();
  24252. let s = "";
  24253. for (let i = 0; i < len; i++) {
  24254. s += String.fromCharCode(this.readNumber());
  24255. }
  24256. return s;
  24257. }
  24258. }
  24259. class BinaryCMapReader {
  24260. async process(data, cMap, extend) {
  24261. const stream = new BinaryCMapStream(data);
  24262. const header = stream.readByte();
  24263. cMap.vertical = !!(header & 1);
  24264. let useCMap = null;
  24265. const start = new Uint8Array(MAX_NUM_SIZE);
  24266. const end = new Uint8Array(MAX_NUM_SIZE);
  24267. const char = new Uint8Array(MAX_NUM_SIZE);
  24268. const charCode = new Uint8Array(MAX_NUM_SIZE);
  24269. const tmp = new Uint8Array(MAX_NUM_SIZE);
  24270. let code;
  24271. let b;
  24272. while ((b = stream.readByte()) >= 0) {
  24273. const type = b >> 5;
  24274. if (type === 7) {
  24275. switch (b & 0x1f) {
  24276. case 0:
  24277. stream.readString();
  24278. break;
  24279. case 1:
  24280. useCMap = stream.readString();
  24281. break;
  24282. }
  24283. continue;
  24284. }
  24285. const sequence = !!(b & 0x10);
  24286. const dataSize = b & 15;
  24287. if (dataSize + 1 > MAX_NUM_SIZE) {
  24288. throw new Error("BinaryCMapReader.process: Invalid dataSize.");
  24289. }
  24290. const ucs2DataSize = 1;
  24291. const subitemsCount = stream.readNumber();
  24292. switch (type) {
  24293. case 0:
  24294. stream.readHex(start, dataSize);
  24295. stream.readHexNumber(end, dataSize);
  24296. addHex(end, start, dataSize);
  24297. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24298. for (let i = 1; i < subitemsCount; i++) {
  24299. incHex(end, dataSize);
  24300. stream.readHexNumber(start, dataSize);
  24301. addHex(start, end, dataSize);
  24302. stream.readHexNumber(end, dataSize);
  24303. addHex(end, start, dataSize);
  24304. cMap.addCodespaceRange(dataSize + 1, hexToInt(start, dataSize), hexToInt(end, dataSize));
  24305. }
  24306. break;
  24307. case 1:
  24308. stream.readHex(start, dataSize);
  24309. stream.readHexNumber(end, dataSize);
  24310. addHex(end, start, dataSize);
  24311. stream.readNumber();
  24312. for (let i = 1; i < subitemsCount; i++) {
  24313. incHex(end, dataSize);
  24314. stream.readHexNumber(start, dataSize);
  24315. addHex(start, end, dataSize);
  24316. stream.readHexNumber(end, dataSize);
  24317. addHex(end, start, dataSize);
  24318. stream.readNumber();
  24319. }
  24320. break;
  24321. case 2:
  24322. stream.readHex(char, dataSize);
  24323. code = stream.readNumber();
  24324. cMap.mapOne(hexToInt(char, dataSize), code);
  24325. for (let i = 1; i < subitemsCount; i++) {
  24326. incHex(char, dataSize);
  24327. if (!sequence) {
  24328. stream.readHexNumber(tmp, dataSize);
  24329. addHex(char, tmp, dataSize);
  24330. }
  24331. code = stream.readSigned() + (code + 1);
  24332. cMap.mapOne(hexToInt(char, dataSize), code);
  24333. }
  24334. break;
  24335. case 3:
  24336. stream.readHex(start, dataSize);
  24337. stream.readHexNumber(end, dataSize);
  24338. addHex(end, start, dataSize);
  24339. code = stream.readNumber();
  24340. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24341. for (let i = 1; i < subitemsCount; i++) {
  24342. incHex(end, dataSize);
  24343. if (!sequence) {
  24344. stream.readHexNumber(start, dataSize);
  24345. addHex(start, end, dataSize);
  24346. } else {
  24347. start.set(end);
  24348. }
  24349. stream.readHexNumber(end, dataSize);
  24350. addHex(end, start, dataSize);
  24351. code = stream.readNumber();
  24352. cMap.mapCidRange(hexToInt(start, dataSize), hexToInt(end, dataSize), code);
  24353. }
  24354. break;
  24355. case 4:
  24356. stream.readHex(char, ucs2DataSize);
  24357. stream.readHex(charCode, dataSize);
  24358. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24359. for (let i = 1; i < subitemsCount; i++) {
  24360. incHex(char, ucs2DataSize);
  24361. if (!sequence) {
  24362. stream.readHexNumber(tmp, ucs2DataSize);
  24363. addHex(char, tmp, ucs2DataSize);
  24364. }
  24365. incHex(charCode, dataSize);
  24366. stream.readHexSigned(tmp, dataSize);
  24367. addHex(charCode, tmp, dataSize);
  24368. cMap.mapOne(hexToInt(char, ucs2DataSize), hexToStr(charCode, dataSize));
  24369. }
  24370. break;
  24371. case 5:
  24372. stream.readHex(start, ucs2DataSize);
  24373. stream.readHexNumber(end, ucs2DataSize);
  24374. addHex(end, start, ucs2DataSize);
  24375. stream.readHex(charCode, dataSize);
  24376. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24377. for (let i = 1; i < subitemsCount; i++) {
  24378. incHex(end, ucs2DataSize);
  24379. if (!sequence) {
  24380. stream.readHexNumber(start, ucs2DataSize);
  24381. addHex(start, end, ucs2DataSize);
  24382. } else {
  24383. start.set(end);
  24384. }
  24385. stream.readHexNumber(end, ucs2DataSize);
  24386. addHex(end, start, ucs2DataSize);
  24387. stream.readHex(charCode, dataSize);
  24388. cMap.mapBfRange(hexToInt(start, ucs2DataSize), hexToInt(end, ucs2DataSize), hexToStr(charCode, dataSize));
  24389. }
  24390. break;
  24391. default:
  24392. throw new Error(`BinaryCMapReader.process - unknown type: ${type}`);
  24393. }
  24394. }
  24395. if (useCMap) {
  24396. return extend(useCMap);
  24397. }
  24398. return cMap;
  24399. }
  24400. }
  24401. return BinaryCMapReader;
  24402. }();
  24403. const CMapFactory = function CMapFactoryClosure() {
  24404. function strToInt(str) {
  24405. let a = 0;
  24406. for (let i = 0; i < str.length; i++) {
  24407. a = a << 8 | str.charCodeAt(i);
  24408. }
  24409. return a >>> 0;
  24410. }
  24411. function expectString(obj) {
  24412. if (typeof obj !== "string") {
  24413. throw new _util.FormatError("Malformed CMap: expected string.");
  24414. }
  24415. }
  24416. function expectInt(obj) {
  24417. if (!Number.isInteger(obj)) {
  24418. throw new _util.FormatError("Malformed CMap: expected int.");
  24419. }
  24420. }
  24421. function parseBfChar(cMap, lexer) {
  24422. while (true) {
  24423. let obj = lexer.getObj();
  24424. if (obj === _primitives.EOF) {
  24425. break;
  24426. }
  24427. if ((0, _primitives.isCmd)(obj, "endbfchar")) {
  24428. return;
  24429. }
  24430. expectString(obj);
  24431. const src = strToInt(obj);
  24432. obj = lexer.getObj();
  24433. expectString(obj);
  24434. const dst = obj;
  24435. cMap.mapOne(src, dst);
  24436. }
  24437. }
  24438. function parseBfRange(cMap, lexer) {
  24439. while (true) {
  24440. let obj = lexer.getObj();
  24441. if (obj === _primitives.EOF) {
  24442. break;
  24443. }
  24444. if ((0, _primitives.isCmd)(obj, "endbfrange")) {
  24445. return;
  24446. }
  24447. expectString(obj);
  24448. const low = strToInt(obj);
  24449. obj = lexer.getObj();
  24450. expectString(obj);
  24451. const high = strToInt(obj);
  24452. obj = lexer.getObj();
  24453. if (Number.isInteger(obj) || typeof obj === "string") {
  24454. const dstLow = Number.isInteger(obj) ? String.fromCharCode(obj) : obj;
  24455. cMap.mapBfRange(low, high, dstLow);
  24456. } else if ((0, _primitives.isCmd)(obj, "[")) {
  24457. obj = lexer.getObj();
  24458. const array = [];
  24459. while (!(0, _primitives.isCmd)(obj, "]") && obj !== _primitives.EOF) {
  24460. array.push(obj);
  24461. obj = lexer.getObj();
  24462. }
  24463. cMap.mapBfRangeToArray(low, high, array);
  24464. } else {
  24465. break;
  24466. }
  24467. }
  24468. throw new _util.FormatError("Invalid bf range.");
  24469. }
  24470. function parseCidChar(cMap, lexer) {
  24471. while (true) {
  24472. let obj = lexer.getObj();
  24473. if (obj === _primitives.EOF) {
  24474. break;
  24475. }
  24476. if ((0, _primitives.isCmd)(obj, "endcidchar")) {
  24477. return;
  24478. }
  24479. expectString(obj);
  24480. const src = strToInt(obj);
  24481. obj = lexer.getObj();
  24482. expectInt(obj);
  24483. const dst = obj;
  24484. cMap.mapOne(src, dst);
  24485. }
  24486. }
  24487. function parseCidRange(cMap, lexer) {
  24488. while (true) {
  24489. let obj = lexer.getObj();
  24490. if (obj === _primitives.EOF) {
  24491. break;
  24492. }
  24493. if ((0, _primitives.isCmd)(obj, "endcidrange")) {
  24494. return;
  24495. }
  24496. expectString(obj);
  24497. const low = strToInt(obj);
  24498. obj = lexer.getObj();
  24499. expectString(obj);
  24500. const high = strToInt(obj);
  24501. obj = lexer.getObj();
  24502. expectInt(obj);
  24503. const dstLow = obj;
  24504. cMap.mapCidRange(low, high, dstLow);
  24505. }
  24506. }
  24507. function parseCodespaceRange(cMap, lexer) {
  24508. while (true) {
  24509. let obj = lexer.getObj();
  24510. if (obj === _primitives.EOF) {
  24511. break;
  24512. }
  24513. if ((0, _primitives.isCmd)(obj, "endcodespacerange")) {
  24514. return;
  24515. }
  24516. if (typeof obj !== "string") {
  24517. break;
  24518. }
  24519. const low = strToInt(obj);
  24520. obj = lexer.getObj();
  24521. if (typeof obj !== "string") {
  24522. break;
  24523. }
  24524. const high = strToInt(obj);
  24525. cMap.addCodespaceRange(obj.length, low, high);
  24526. }
  24527. throw new _util.FormatError("Invalid codespace range.");
  24528. }
  24529. function parseWMode(cMap, lexer) {
  24530. const obj = lexer.getObj();
  24531. if (Number.isInteger(obj)) {
  24532. cMap.vertical = !!obj;
  24533. }
  24534. }
  24535. function parseCMapName(cMap, lexer) {
  24536. const obj = lexer.getObj();
  24537. if (obj instanceof _primitives.Name) {
  24538. cMap.name = obj.name;
  24539. }
  24540. }
  24541. async function parseCMap(cMap, lexer, fetchBuiltInCMap, useCMap) {
  24542. let previous, embeddedUseCMap;
  24543. objLoop: while (true) {
  24544. try {
  24545. const obj = lexer.getObj();
  24546. if (obj === _primitives.EOF) {
  24547. break;
  24548. } else if (obj instanceof _primitives.Name) {
  24549. if (obj.name === "WMode") {
  24550. parseWMode(cMap, lexer);
  24551. } else if (obj.name === "CMapName") {
  24552. parseCMapName(cMap, lexer);
  24553. }
  24554. previous = obj;
  24555. } else if (obj instanceof _primitives.Cmd) {
  24556. switch (obj.cmd) {
  24557. case "endcmap":
  24558. break objLoop;
  24559. case "usecmap":
  24560. if (previous instanceof _primitives.Name) {
  24561. embeddedUseCMap = previous.name;
  24562. }
  24563. break;
  24564. case "begincodespacerange":
  24565. parseCodespaceRange(cMap, lexer);
  24566. break;
  24567. case "beginbfchar":
  24568. parseBfChar(cMap, lexer);
  24569. break;
  24570. case "begincidchar":
  24571. parseCidChar(cMap, lexer);
  24572. break;
  24573. case "beginbfrange":
  24574. parseBfRange(cMap, lexer);
  24575. break;
  24576. case "begincidrange":
  24577. parseCidRange(cMap, lexer);
  24578. break;
  24579. }
  24580. }
  24581. } catch (ex) {
  24582. if (ex instanceof _core_utils.MissingDataException) {
  24583. throw ex;
  24584. }
  24585. (0, _util.warn)("Invalid cMap data: " + ex);
  24586. continue;
  24587. }
  24588. }
  24589. if (!useCMap && embeddedUseCMap) {
  24590. useCMap = embeddedUseCMap;
  24591. }
  24592. if (useCMap) {
  24593. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24594. }
  24595. return cMap;
  24596. }
  24597. async function extendCMap(cMap, fetchBuiltInCMap, useCMap) {
  24598. cMap.useCMap = await createBuiltInCMap(useCMap, fetchBuiltInCMap);
  24599. if (cMap.numCodespaceRanges === 0) {
  24600. const useCodespaceRanges = cMap.useCMap.codespaceRanges;
  24601. for (let i = 0; i < useCodespaceRanges.length; i++) {
  24602. cMap.codespaceRanges[i] = useCodespaceRanges[i].slice();
  24603. }
  24604. cMap.numCodespaceRanges = cMap.useCMap.numCodespaceRanges;
  24605. }
  24606. cMap.useCMap.forEach(function (key, value) {
  24607. if (!cMap.contains(key)) {
  24608. cMap.mapOne(key, cMap.useCMap.lookup(key));
  24609. }
  24610. });
  24611. return cMap;
  24612. }
  24613. async function createBuiltInCMap(name, fetchBuiltInCMap) {
  24614. if (name === "Identity-H") {
  24615. return new IdentityCMap(false, 2);
  24616. } else if (name === "Identity-V") {
  24617. return new IdentityCMap(true, 2);
  24618. }
  24619. if (!BUILT_IN_CMAPS.includes(name)) {
  24620. throw new Error("Unknown CMap name: " + name);
  24621. }
  24622. if (!fetchBuiltInCMap) {
  24623. throw new Error("Built-in CMap parameters are not provided.");
  24624. }
  24625. const {
  24626. cMapData,
  24627. compressionType
  24628. } = await fetchBuiltInCMap(name);
  24629. const cMap = new CMap(true);
  24630. if (compressionType === _util.CMapCompressionType.BINARY) {
  24631. return new BinaryCMapReader().process(cMapData, cMap, useCMap => {
  24632. return extendCMap(cMap, fetchBuiltInCMap, useCMap);
  24633. });
  24634. }
  24635. if (compressionType === _util.CMapCompressionType.NONE) {
  24636. const lexer = new _parser.Lexer(new _stream.Stream(cMapData));
  24637. return parseCMap(cMap, lexer, fetchBuiltInCMap, null);
  24638. }
  24639. throw new Error("TODO: Only BINARY/NONE CMap compression is currently supported.");
  24640. }
  24641. return {
  24642. async create(params) {
  24643. const encoding = params.encoding;
  24644. const fetchBuiltInCMap = params.fetchBuiltInCMap;
  24645. const useCMap = params.useCMap;
  24646. if (encoding instanceof _primitives.Name) {
  24647. return createBuiltInCMap(encoding.name, fetchBuiltInCMap);
  24648. } else if (encoding instanceof _base_stream.BaseStream) {
  24649. const parsedCMap = await parseCMap(new CMap(), new _parser.Lexer(encoding), fetchBuiltInCMap, useCMap);
  24650. if (parsedCMap.isIdentityCMap) {
  24651. return createBuiltInCMap(parsedCMap.name, fetchBuiltInCMap);
  24652. }
  24653. return parsedCMap;
  24654. }
  24655. throw new Error("Encoding required.");
  24656. }
  24657. };
  24658. }();
  24659. exports.CMapFactory = CMapFactory;
  24660. /***/ }),
  24661. /* 27 */
  24662. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  24663. Object.defineProperty(exports, "__esModule", ({
  24664. value: true
  24665. }));
  24666. exports.Parser = exports.Linearization = exports.Lexer = void 0;
  24667. var _util = __w_pdfjs_require__(2);
  24668. var _primitives = __w_pdfjs_require__(5);
  24669. var _core_utils = __w_pdfjs_require__(8);
  24670. var _ascii_85_stream = __w_pdfjs_require__(28);
  24671. var _ascii_hex_stream = __w_pdfjs_require__(30);
  24672. var _ccitt_stream = __w_pdfjs_require__(31);
  24673. var _flate_stream = __w_pdfjs_require__(33);
  24674. var _jbig2_stream = __w_pdfjs_require__(34);
  24675. var _jpeg_stream = __w_pdfjs_require__(37);
  24676. var _jpx_stream = __w_pdfjs_require__(39);
  24677. var _lzw_stream = __w_pdfjs_require__(41);
  24678. var _stream = __w_pdfjs_require__(10);
  24679. var _predictor_stream = __w_pdfjs_require__(42);
  24680. var _run_length_stream = __w_pdfjs_require__(43);
  24681. const MAX_LENGTH_TO_CACHE = 1000;
  24682. const MAX_ADLER32_LENGTH = 5552;
  24683. function computeAdler32(bytes) {
  24684. const bytesLength = bytes.length;
  24685. let a = 1,
  24686. b = 0;
  24687. for (let i = 0; i < bytesLength; ++i) {
  24688. a += bytes[i] & 0xff;
  24689. b += a;
  24690. }
  24691. return b % 65521 << 16 | a % 65521;
  24692. }
  24693. class Parser {
  24694. constructor({
  24695. lexer,
  24696. xref,
  24697. allowStreams = false,
  24698. recoveryMode = false
  24699. }) {
  24700. this.lexer = lexer;
  24701. this.xref = xref;
  24702. this.allowStreams = allowStreams;
  24703. this.recoveryMode = recoveryMode;
  24704. this.imageCache = Object.create(null);
  24705. this.refill();
  24706. }
  24707. refill() {
  24708. this.buf1 = this.lexer.getObj();
  24709. this.buf2 = this.lexer.getObj();
  24710. }
  24711. shift() {
  24712. if (this.buf2 instanceof _primitives.Cmd && this.buf2.cmd === "ID") {
  24713. this.buf1 = this.buf2;
  24714. this.buf2 = null;
  24715. } else {
  24716. this.buf1 = this.buf2;
  24717. this.buf2 = this.lexer.getObj();
  24718. }
  24719. }
  24720. tryShift() {
  24721. try {
  24722. this.shift();
  24723. return true;
  24724. } catch (e) {
  24725. if (e instanceof _core_utils.MissingDataException) {
  24726. throw e;
  24727. }
  24728. return false;
  24729. }
  24730. }
  24731. getObj(cipherTransform = null) {
  24732. const buf1 = this.buf1;
  24733. this.shift();
  24734. if (buf1 instanceof _primitives.Cmd) {
  24735. switch (buf1.cmd) {
  24736. case "BI":
  24737. return this.makeInlineImage(cipherTransform);
  24738. case "[":
  24739. const array = [];
  24740. while (!(0, _primitives.isCmd)(this.buf1, "]") && this.buf1 !== _primitives.EOF) {
  24741. array.push(this.getObj(cipherTransform));
  24742. }
  24743. if (this.buf1 === _primitives.EOF) {
  24744. if (this.recoveryMode) {
  24745. return array;
  24746. }
  24747. throw new _core_utils.ParserEOFException("End of file inside array.");
  24748. }
  24749. this.shift();
  24750. return array;
  24751. case "<<":
  24752. const dict = new _primitives.Dict(this.xref);
  24753. while (!(0, _primitives.isCmd)(this.buf1, ">>") && this.buf1 !== _primitives.EOF) {
  24754. if (!(this.buf1 instanceof _primitives.Name)) {
  24755. (0, _util.info)("Malformed dictionary: key must be a name object");
  24756. this.shift();
  24757. continue;
  24758. }
  24759. const key = this.buf1.name;
  24760. this.shift();
  24761. if (this.buf1 === _primitives.EOF) {
  24762. break;
  24763. }
  24764. dict.set(key, this.getObj(cipherTransform));
  24765. }
  24766. if (this.buf1 === _primitives.EOF) {
  24767. if (this.recoveryMode) {
  24768. return dict;
  24769. }
  24770. throw new _core_utils.ParserEOFException("End of file inside dictionary.");
  24771. }
  24772. if ((0, _primitives.isCmd)(this.buf2, "stream")) {
  24773. return this.allowStreams ? this.makeStream(dict, cipherTransform) : dict;
  24774. }
  24775. this.shift();
  24776. return dict;
  24777. default:
  24778. return buf1;
  24779. }
  24780. }
  24781. if (Number.isInteger(buf1)) {
  24782. if (Number.isInteger(this.buf1) && (0, _primitives.isCmd)(this.buf2, "R")) {
  24783. const ref = _primitives.Ref.get(buf1, this.buf1);
  24784. this.shift();
  24785. this.shift();
  24786. return ref;
  24787. }
  24788. return buf1;
  24789. }
  24790. if (typeof buf1 === "string") {
  24791. if (cipherTransform) {
  24792. return cipherTransform.decryptString(buf1);
  24793. }
  24794. return buf1;
  24795. }
  24796. return buf1;
  24797. }
  24798. findDefaultInlineStreamEnd(stream) {
  24799. const E = 0x45,
  24800. I = 0x49,
  24801. SPACE = 0x20,
  24802. LF = 0xa,
  24803. CR = 0xd,
  24804. NUL = 0x0;
  24805. const lexer = this.lexer,
  24806. startPos = stream.pos,
  24807. n = 10;
  24808. let state = 0,
  24809. ch,
  24810. maybeEIPos;
  24811. while ((ch = stream.getByte()) !== -1) {
  24812. if (state === 0) {
  24813. state = ch === E ? 1 : 0;
  24814. } else if (state === 1) {
  24815. state = ch === I ? 2 : 0;
  24816. } else {
  24817. (0, _util.assert)(state === 2, "findDefaultInlineStreamEnd - invalid state.");
  24818. if (ch === SPACE || ch === LF || ch === CR) {
  24819. maybeEIPos = stream.pos;
  24820. const followingBytes = stream.peekBytes(n);
  24821. for (let i = 0, ii = followingBytes.length; i < ii; i++) {
  24822. ch = followingBytes[i];
  24823. if (ch === NUL && followingBytes[i + 1] !== NUL) {
  24824. continue;
  24825. }
  24826. if (ch !== LF && ch !== CR && (ch < SPACE || ch > 0x7f)) {
  24827. state = 0;
  24828. break;
  24829. }
  24830. }
  24831. if (state !== 2) {
  24832. continue;
  24833. }
  24834. if (lexer.knownCommands) {
  24835. const nextObj = lexer.peekObj();
  24836. if (nextObj instanceof _primitives.Cmd && !lexer.knownCommands[nextObj.cmd]) {
  24837. state = 0;
  24838. }
  24839. } else {
  24840. (0, _util.warn)("findDefaultInlineStreamEnd - `lexer.knownCommands` is undefined.");
  24841. }
  24842. if (state === 2) {
  24843. break;
  24844. }
  24845. } else {
  24846. state = 0;
  24847. }
  24848. }
  24849. }
  24850. if (ch === -1) {
  24851. (0, _util.warn)("findDefaultInlineStreamEnd: " + "Reached the end of the stream without finding a valid EI marker");
  24852. if (maybeEIPos) {
  24853. (0, _util.warn)('... trying to recover by using the last "EI" occurrence.');
  24854. stream.skip(-(stream.pos - maybeEIPos));
  24855. }
  24856. }
  24857. let endOffset = 4;
  24858. stream.skip(-endOffset);
  24859. ch = stream.peekByte();
  24860. stream.skip(endOffset);
  24861. if (!(0, _core_utils.isWhiteSpace)(ch)) {
  24862. endOffset--;
  24863. }
  24864. return stream.pos - endOffset - startPos;
  24865. }
  24866. findDCTDecodeInlineStreamEnd(stream) {
  24867. const startPos = stream.pos;
  24868. let foundEOI = false,
  24869. b,
  24870. markerLength;
  24871. while ((b = stream.getByte()) !== -1) {
  24872. if (b !== 0xff) {
  24873. continue;
  24874. }
  24875. switch (stream.getByte()) {
  24876. case 0x00:
  24877. break;
  24878. case 0xff:
  24879. stream.skip(-1);
  24880. break;
  24881. case 0xd9:
  24882. foundEOI = true;
  24883. break;
  24884. case 0xc0:
  24885. case 0xc1:
  24886. case 0xc2:
  24887. case 0xc3:
  24888. case 0xc5:
  24889. case 0xc6:
  24890. case 0xc7:
  24891. case 0xc9:
  24892. case 0xca:
  24893. case 0xcb:
  24894. case 0xcd:
  24895. case 0xce:
  24896. case 0xcf:
  24897. case 0xc4:
  24898. case 0xcc:
  24899. case 0xda:
  24900. case 0xdb:
  24901. case 0xdc:
  24902. case 0xdd:
  24903. case 0xde:
  24904. case 0xdf:
  24905. case 0xe0:
  24906. case 0xe1:
  24907. case 0xe2:
  24908. case 0xe3:
  24909. case 0xe4:
  24910. case 0xe5:
  24911. case 0xe6:
  24912. case 0xe7:
  24913. case 0xe8:
  24914. case 0xe9:
  24915. case 0xea:
  24916. case 0xeb:
  24917. case 0xec:
  24918. case 0xed:
  24919. case 0xee:
  24920. case 0xef:
  24921. case 0xfe:
  24922. markerLength = stream.getUint16();
  24923. if (markerLength > 2) {
  24924. stream.skip(markerLength - 2);
  24925. } else {
  24926. stream.skip(-2);
  24927. }
  24928. break;
  24929. }
  24930. if (foundEOI) {
  24931. break;
  24932. }
  24933. }
  24934. const length = stream.pos - startPos;
  24935. if (b === -1) {
  24936. (0, _util.warn)("Inline DCTDecode image stream: " + "EOI marker not found, searching for /EI/ instead.");
  24937. stream.skip(-length);
  24938. return this.findDefaultInlineStreamEnd(stream);
  24939. }
  24940. this.inlineStreamSkipEI(stream);
  24941. return length;
  24942. }
  24943. findASCII85DecodeInlineStreamEnd(stream) {
  24944. const TILDE = 0x7e,
  24945. GT = 0x3e;
  24946. const startPos = stream.pos;
  24947. let ch;
  24948. while ((ch = stream.getByte()) !== -1) {
  24949. if (ch === TILDE) {
  24950. const tildePos = stream.pos;
  24951. ch = stream.peekByte();
  24952. while ((0, _core_utils.isWhiteSpace)(ch)) {
  24953. stream.skip();
  24954. ch = stream.peekByte();
  24955. }
  24956. if (ch === GT) {
  24957. stream.skip();
  24958. break;
  24959. }
  24960. if (stream.pos > tildePos) {
  24961. const maybeEI = stream.peekBytes(2);
  24962. if (maybeEI[0] === 0x45 && maybeEI[1] === 0x49) {
  24963. break;
  24964. }
  24965. }
  24966. }
  24967. }
  24968. const length = stream.pos - startPos;
  24969. if (ch === -1) {
  24970. (0, _util.warn)("Inline ASCII85Decode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24971. stream.skip(-length);
  24972. return this.findDefaultInlineStreamEnd(stream);
  24973. }
  24974. this.inlineStreamSkipEI(stream);
  24975. return length;
  24976. }
  24977. findASCIIHexDecodeInlineStreamEnd(stream) {
  24978. const GT = 0x3e;
  24979. const startPos = stream.pos;
  24980. let ch;
  24981. while ((ch = stream.getByte()) !== -1) {
  24982. if (ch === GT) {
  24983. break;
  24984. }
  24985. }
  24986. const length = stream.pos - startPos;
  24987. if (ch === -1) {
  24988. (0, _util.warn)("Inline ASCIIHexDecode image stream: " + "EOD marker not found, searching for /EI/ instead.");
  24989. stream.skip(-length);
  24990. return this.findDefaultInlineStreamEnd(stream);
  24991. }
  24992. this.inlineStreamSkipEI(stream);
  24993. return length;
  24994. }
  24995. inlineStreamSkipEI(stream) {
  24996. const E = 0x45,
  24997. I = 0x49;
  24998. let state = 0,
  24999. ch;
  25000. while ((ch = stream.getByte()) !== -1) {
  25001. if (state === 0) {
  25002. state = ch === E ? 1 : 0;
  25003. } else if (state === 1) {
  25004. state = ch === I ? 2 : 0;
  25005. } else if (state === 2) {
  25006. break;
  25007. }
  25008. }
  25009. }
  25010. makeInlineImage(cipherTransform) {
  25011. const lexer = this.lexer;
  25012. const stream = lexer.stream;
  25013. const dict = new _primitives.Dict(this.xref);
  25014. let dictLength;
  25015. while (!(0, _primitives.isCmd)(this.buf1, "ID") && this.buf1 !== _primitives.EOF) {
  25016. if (!(this.buf1 instanceof _primitives.Name)) {
  25017. throw new _util.FormatError("Dictionary key must be a name object");
  25018. }
  25019. const key = this.buf1.name;
  25020. this.shift();
  25021. if (this.buf1 === _primitives.EOF) {
  25022. break;
  25023. }
  25024. dict.set(key, this.getObj(cipherTransform));
  25025. }
  25026. if (lexer.beginInlineImagePos !== -1) {
  25027. dictLength = stream.pos - lexer.beginInlineImagePos;
  25028. }
  25029. const filter = dict.get("F", "Filter");
  25030. let filterName;
  25031. if (filter instanceof _primitives.Name) {
  25032. filterName = filter.name;
  25033. } else if (Array.isArray(filter)) {
  25034. const filterZero = this.xref.fetchIfRef(filter[0]);
  25035. if (filterZero instanceof _primitives.Name) {
  25036. filterName = filterZero.name;
  25037. }
  25038. }
  25039. const startPos = stream.pos;
  25040. let length;
  25041. switch (filterName) {
  25042. case "DCT":
  25043. case "DCTDecode":
  25044. length = this.findDCTDecodeInlineStreamEnd(stream);
  25045. break;
  25046. case "A85":
  25047. case "ASCII85Decode":
  25048. length = this.findASCII85DecodeInlineStreamEnd(stream);
  25049. break;
  25050. case "AHx":
  25051. case "ASCIIHexDecode":
  25052. length = this.findASCIIHexDecodeInlineStreamEnd(stream);
  25053. break;
  25054. default:
  25055. length = this.findDefaultInlineStreamEnd(stream);
  25056. }
  25057. let imageStream = stream.makeSubStream(startPos, length, dict);
  25058. let cacheKey;
  25059. if (length < MAX_LENGTH_TO_CACHE && dictLength < MAX_ADLER32_LENGTH) {
  25060. const imageBytes = imageStream.getBytes();
  25061. imageStream.reset();
  25062. const initialStreamPos = stream.pos;
  25063. stream.pos = lexer.beginInlineImagePos;
  25064. const dictBytes = stream.getBytes(dictLength);
  25065. stream.pos = initialStreamPos;
  25066. cacheKey = computeAdler32(imageBytes) + "_" + computeAdler32(dictBytes);
  25067. const cacheEntry = this.imageCache[cacheKey];
  25068. if (cacheEntry !== undefined) {
  25069. this.buf2 = _primitives.Cmd.get("EI");
  25070. this.shift();
  25071. cacheEntry.reset();
  25072. return cacheEntry;
  25073. }
  25074. }
  25075. if (cipherTransform) {
  25076. imageStream = cipherTransform.createStream(imageStream, length);
  25077. }
  25078. imageStream = this.filter(imageStream, dict, length);
  25079. imageStream.dict = dict;
  25080. if (cacheKey !== undefined) {
  25081. imageStream.cacheKey = `inline_${length}_${cacheKey}`;
  25082. this.imageCache[cacheKey] = imageStream;
  25083. }
  25084. this.buf2 = _primitives.Cmd.get("EI");
  25085. this.shift();
  25086. return imageStream;
  25087. }
  25088. _findStreamLength(startPos, signature) {
  25089. const {
  25090. stream
  25091. } = this.lexer;
  25092. stream.pos = startPos;
  25093. const SCAN_BLOCK_LENGTH = 2048;
  25094. const signatureLength = signature.length;
  25095. while (stream.pos < stream.end) {
  25096. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  25097. const scanLength = scanBytes.length - signatureLength;
  25098. if (scanLength <= 0) {
  25099. break;
  25100. }
  25101. let pos = 0;
  25102. while (pos < scanLength) {
  25103. let j = 0;
  25104. while (j < signatureLength && scanBytes[pos + j] === signature[j]) {
  25105. j++;
  25106. }
  25107. if (j >= signatureLength) {
  25108. stream.pos += pos;
  25109. return stream.pos - startPos;
  25110. }
  25111. pos++;
  25112. }
  25113. stream.pos += scanLength;
  25114. }
  25115. return -1;
  25116. }
  25117. makeStream(dict, cipherTransform) {
  25118. const lexer = this.lexer;
  25119. let stream = lexer.stream;
  25120. lexer.skipToNextLine();
  25121. const startPos = stream.pos - 1;
  25122. let length = dict.get("Length");
  25123. if (!Number.isInteger(length)) {
  25124. (0, _util.info)(`Bad length "${length && length.toString()}" in stream.`);
  25125. length = 0;
  25126. }
  25127. stream.pos = startPos + length;
  25128. lexer.nextChar();
  25129. if (this.tryShift() && (0, _primitives.isCmd)(this.buf2, "endstream")) {
  25130. this.shift();
  25131. } else {
  25132. const ENDSTREAM_SIGNATURE = new Uint8Array([0x65, 0x6e, 0x64, 0x73, 0x74, 0x72, 0x65, 0x61, 0x6d]);
  25133. let actualLength = this._findStreamLength(startPos, ENDSTREAM_SIGNATURE);
  25134. if (actualLength < 0) {
  25135. const MAX_TRUNCATION = 1;
  25136. for (let i = 1; i <= MAX_TRUNCATION; i++) {
  25137. const end = ENDSTREAM_SIGNATURE.length - i;
  25138. const TRUNCATED_SIGNATURE = ENDSTREAM_SIGNATURE.slice(0, end);
  25139. const maybeLength = this._findStreamLength(startPos, TRUNCATED_SIGNATURE);
  25140. if (maybeLength >= 0) {
  25141. const lastByte = stream.peekBytes(end + 1)[end];
  25142. if (!(0, _core_utils.isWhiteSpace)(lastByte)) {
  25143. break;
  25144. }
  25145. (0, _util.info)(`Found "${(0, _util.bytesToString)(TRUNCATED_SIGNATURE)}" when ` + "searching for endstream command.");
  25146. actualLength = maybeLength;
  25147. break;
  25148. }
  25149. }
  25150. if (actualLength < 0) {
  25151. throw new _util.FormatError("Missing endstream command.");
  25152. }
  25153. }
  25154. length = actualLength;
  25155. lexer.nextChar();
  25156. this.shift();
  25157. this.shift();
  25158. }
  25159. this.shift();
  25160. stream = stream.makeSubStream(startPos, length, dict);
  25161. if (cipherTransform) {
  25162. stream = cipherTransform.createStream(stream, length);
  25163. }
  25164. stream = this.filter(stream, dict, length);
  25165. stream.dict = dict;
  25166. return stream;
  25167. }
  25168. filter(stream, dict, length) {
  25169. let filter = dict.get("F", "Filter");
  25170. let params = dict.get("DP", "DecodeParms");
  25171. if (filter instanceof _primitives.Name) {
  25172. if (Array.isArray(params)) {
  25173. (0, _util.warn)("/DecodeParms should not be an Array, when /Filter is a Name.");
  25174. }
  25175. return this.makeFilter(stream, filter.name, length, params);
  25176. }
  25177. let maybeLength = length;
  25178. if (Array.isArray(filter)) {
  25179. const filterArray = filter;
  25180. const paramsArray = params;
  25181. for (let i = 0, ii = filterArray.length; i < ii; ++i) {
  25182. filter = this.xref.fetchIfRef(filterArray[i]);
  25183. if (!(filter instanceof _primitives.Name)) {
  25184. throw new _util.FormatError(`Bad filter name "${filter}"`);
  25185. }
  25186. params = null;
  25187. if (Array.isArray(paramsArray) && i in paramsArray) {
  25188. params = this.xref.fetchIfRef(paramsArray[i]);
  25189. }
  25190. stream = this.makeFilter(stream, filter.name, maybeLength, params);
  25191. maybeLength = null;
  25192. }
  25193. }
  25194. return stream;
  25195. }
  25196. makeFilter(stream, name, maybeLength, params) {
  25197. if (maybeLength === 0) {
  25198. (0, _util.warn)(`Empty "${name}" stream.`);
  25199. return new _stream.NullStream();
  25200. }
  25201. const xrefStats = this.xref.stats;
  25202. try {
  25203. switch (name) {
  25204. case "Fl":
  25205. case "FlateDecode":
  25206. xrefStats.addStreamType(_util.StreamType.FLATE);
  25207. if (params) {
  25208. return new _predictor_stream.PredictorStream(new _flate_stream.FlateStream(stream, maybeLength), maybeLength, params);
  25209. }
  25210. return new _flate_stream.FlateStream(stream, maybeLength);
  25211. case "LZW":
  25212. case "LZWDecode":
  25213. xrefStats.addStreamType(_util.StreamType.LZW);
  25214. let earlyChange = 1;
  25215. if (params) {
  25216. if (params.has("EarlyChange")) {
  25217. earlyChange = params.get("EarlyChange");
  25218. }
  25219. return new _predictor_stream.PredictorStream(new _lzw_stream.LZWStream(stream, maybeLength, earlyChange), maybeLength, params);
  25220. }
  25221. return new _lzw_stream.LZWStream(stream, maybeLength, earlyChange);
  25222. case "DCT":
  25223. case "DCTDecode":
  25224. xrefStats.addStreamType(_util.StreamType.DCT);
  25225. return new _jpeg_stream.JpegStream(stream, maybeLength, params);
  25226. case "JPX":
  25227. case "JPXDecode":
  25228. xrefStats.addStreamType(_util.StreamType.JPX);
  25229. return new _jpx_stream.JpxStream(stream, maybeLength, params);
  25230. case "A85":
  25231. case "ASCII85Decode":
  25232. xrefStats.addStreamType(_util.StreamType.A85);
  25233. return new _ascii_85_stream.Ascii85Stream(stream, maybeLength);
  25234. case "AHx":
  25235. case "ASCIIHexDecode":
  25236. xrefStats.addStreamType(_util.StreamType.AHX);
  25237. return new _ascii_hex_stream.AsciiHexStream(stream, maybeLength);
  25238. case "CCF":
  25239. case "CCITTFaxDecode":
  25240. xrefStats.addStreamType(_util.StreamType.CCF);
  25241. return new _ccitt_stream.CCITTFaxStream(stream, maybeLength, params);
  25242. case "RL":
  25243. case "RunLengthDecode":
  25244. xrefStats.addStreamType(_util.StreamType.RLX);
  25245. return new _run_length_stream.RunLengthStream(stream, maybeLength);
  25246. case "JBIG2Decode":
  25247. xrefStats.addStreamType(_util.StreamType.JBIG);
  25248. return new _jbig2_stream.Jbig2Stream(stream, maybeLength, params);
  25249. }
  25250. (0, _util.warn)(`Filter "${name}" is not supported.`);
  25251. return stream;
  25252. } catch (ex) {
  25253. if (ex instanceof _core_utils.MissingDataException) {
  25254. throw ex;
  25255. }
  25256. (0, _util.warn)(`Invalid stream: "${ex}"`);
  25257. return new _stream.NullStream();
  25258. }
  25259. }
  25260. }
  25261. exports.Parser = Parser;
  25262. 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];
  25263. function toHexDigit(ch) {
  25264. if (ch >= 0x30 && ch <= 0x39) {
  25265. return ch & 0x0f;
  25266. }
  25267. if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25268. return (ch & 0x0f) + 9;
  25269. }
  25270. return -1;
  25271. }
  25272. class Lexer {
  25273. constructor(stream, knownCommands = null) {
  25274. this.stream = stream;
  25275. this.nextChar();
  25276. this.strBuf = [];
  25277. this.knownCommands = knownCommands;
  25278. this._hexStringNumWarn = 0;
  25279. this.beginInlineImagePos = -1;
  25280. }
  25281. nextChar() {
  25282. return this.currentChar = this.stream.getByte();
  25283. }
  25284. peekChar() {
  25285. return this.stream.peekByte();
  25286. }
  25287. getNumber() {
  25288. let ch = this.currentChar;
  25289. let eNotation = false;
  25290. let divideBy = 0;
  25291. let sign = 0;
  25292. if (ch === 0x2d) {
  25293. sign = -1;
  25294. ch = this.nextChar();
  25295. if (ch === 0x2d) {
  25296. ch = this.nextChar();
  25297. }
  25298. } else if (ch === 0x2b) {
  25299. sign = 1;
  25300. ch = this.nextChar();
  25301. }
  25302. if (ch === 0x0a || ch === 0x0d) {
  25303. do {
  25304. ch = this.nextChar();
  25305. } while (ch === 0x0a || ch === 0x0d);
  25306. }
  25307. if (ch === 0x2e) {
  25308. divideBy = 10;
  25309. ch = this.nextChar();
  25310. }
  25311. if (ch < 0x30 || ch > 0x39) {
  25312. if ((0, _core_utils.isWhiteSpace)(ch) || ch === -1) {
  25313. if (divideBy === 10 && sign === 0) {
  25314. (0, _util.warn)("Lexer.getNumber - treating a single decimal point as zero.");
  25315. return 0;
  25316. }
  25317. if (divideBy === 0 && sign === -1) {
  25318. (0, _util.warn)("Lexer.getNumber - treating a single minus sign as zero.");
  25319. return 0;
  25320. }
  25321. }
  25322. throw new _util.FormatError(`Invalid number: ${String.fromCharCode(ch)} (charCode ${ch})`);
  25323. }
  25324. sign = sign || 1;
  25325. let baseValue = ch - 0x30;
  25326. let powerValue = 0;
  25327. let powerValueSign = 1;
  25328. while ((ch = this.nextChar()) >= 0) {
  25329. if (ch >= 0x30 && ch <= 0x39) {
  25330. const currentDigit = ch - 0x30;
  25331. if (eNotation) {
  25332. powerValue = powerValue * 10 + currentDigit;
  25333. } else {
  25334. if (divideBy !== 0) {
  25335. divideBy *= 10;
  25336. }
  25337. baseValue = baseValue * 10 + currentDigit;
  25338. }
  25339. } else if (ch === 0x2e) {
  25340. if (divideBy === 0) {
  25341. divideBy = 1;
  25342. } else {
  25343. break;
  25344. }
  25345. } else if (ch === 0x2d) {
  25346. (0, _util.warn)("Badly formatted number: minus sign in the middle");
  25347. } else if (ch === 0x45 || ch === 0x65) {
  25348. ch = this.peekChar();
  25349. if (ch === 0x2b || ch === 0x2d) {
  25350. powerValueSign = ch === 0x2d ? -1 : 1;
  25351. this.nextChar();
  25352. } else if (ch < 0x30 || ch > 0x39) {
  25353. break;
  25354. }
  25355. eNotation = true;
  25356. } else {
  25357. break;
  25358. }
  25359. }
  25360. if (divideBy !== 0) {
  25361. baseValue /= divideBy;
  25362. }
  25363. if (eNotation) {
  25364. baseValue *= 10 ** (powerValueSign * powerValue);
  25365. }
  25366. return sign * baseValue;
  25367. }
  25368. getString() {
  25369. let numParen = 1;
  25370. let done = false;
  25371. const strBuf = this.strBuf;
  25372. strBuf.length = 0;
  25373. let ch = this.nextChar();
  25374. while (true) {
  25375. let charBuffered = false;
  25376. switch (ch | 0) {
  25377. case -1:
  25378. (0, _util.warn)("Unterminated string");
  25379. done = true;
  25380. break;
  25381. case 0x28:
  25382. ++numParen;
  25383. strBuf.push("(");
  25384. break;
  25385. case 0x29:
  25386. if (--numParen === 0) {
  25387. this.nextChar();
  25388. done = true;
  25389. } else {
  25390. strBuf.push(")");
  25391. }
  25392. break;
  25393. case 0x5c:
  25394. ch = this.nextChar();
  25395. switch (ch) {
  25396. case -1:
  25397. (0, _util.warn)("Unterminated string");
  25398. done = true;
  25399. break;
  25400. case 0x6e:
  25401. strBuf.push("\n");
  25402. break;
  25403. case 0x72:
  25404. strBuf.push("\r");
  25405. break;
  25406. case 0x74:
  25407. strBuf.push("\t");
  25408. break;
  25409. case 0x62:
  25410. strBuf.push("\b");
  25411. break;
  25412. case 0x66:
  25413. strBuf.push("\f");
  25414. break;
  25415. case 0x5c:
  25416. case 0x28:
  25417. case 0x29:
  25418. strBuf.push(String.fromCharCode(ch));
  25419. break;
  25420. case 0x30:
  25421. case 0x31:
  25422. case 0x32:
  25423. case 0x33:
  25424. case 0x34:
  25425. case 0x35:
  25426. case 0x36:
  25427. case 0x37:
  25428. let x = ch & 0x0f;
  25429. ch = this.nextChar();
  25430. charBuffered = true;
  25431. if (ch >= 0x30 && ch <= 0x37) {
  25432. x = (x << 3) + (ch & 0x0f);
  25433. ch = this.nextChar();
  25434. if (ch >= 0x30 && ch <= 0x37) {
  25435. charBuffered = false;
  25436. x = (x << 3) + (ch & 0x0f);
  25437. }
  25438. }
  25439. strBuf.push(String.fromCharCode(x));
  25440. break;
  25441. case 0x0d:
  25442. if (this.peekChar() === 0x0a) {
  25443. this.nextChar();
  25444. }
  25445. break;
  25446. case 0x0a:
  25447. break;
  25448. default:
  25449. strBuf.push(String.fromCharCode(ch));
  25450. break;
  25451. }
  25452. break;
  25453. default:
  25454. strBuf.push(String.fromCharCode(ch));
  25455. break;
  25456. }
  25457. if (done) {
  25458. break;
  25459. }
  25460. if (!charBuffered) {
  25461. ch = this.nextChar();
  25462. }
  25463. }
  25464. return strBuf.join("");
  25465. }
  25466. getName() {
  25467. let ch, previousCh;
  25468. const strBuf = this.strBuf;
  25469. strBuf.length = 0;
  25470. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25471. if (ch === 0x23) {
  25472. ch = this.nextChar();
  25473. if (specialChars[ch]) {
  25474. (0, _util.warn)("Lexer_getName: " + "NUMBER SIGN (#) should be followed by a hexadecimal number.");
  25475. strBuf.push("#");
  25476. break;
  25477. }
  25478. const x = toHexDigit(ch);
  25479. if (x !== -1) {
  25480. previousCh = ch;
  25481. ch = this.nextChar();
  25482. const x2 = toHexDigit(ch);
  25483. if (x2 === -1) {
  25484. (0, _util.warn)(`Lexer_getName: Illegal digit (${String.fromCharCode(ch)}) ` + "in hexadecimal number.");
  25485. strBuf.push("#", String.fromCharCode(previousCh));
  25486. if (specialChars[ch]) {
  25487. break;
  25488. }
  25489. strBuf.push(String.fromCharCode(ch));
  25490. continue;
  25491. }
  25492. strBuf.push(String.fromCharCode(x << 4 | x2));
  25493. } else {
  25494. strBuf.push("#", String.fromCharCode(ch));
  25495. }
  25496. } else {
  25497. strBuf.push(String.fromCharCode(ch));
  25498. }
  25499. }
  25500. if (strBuf.length > 127) {
  25501. (0, _util.warn)(`Name token is longer than allowed by the spec: ${strBuf.length}`);
  25502. }
  25503. return _primitives.Name.get(strBuf.join(""));
  25504. }
  25505. _hexStringWarn(ch) {
  25506. const MAX_HEX_STRING_NUM_WARN = 5;
  25507. if (this._hexStringNumWarn++ === MAX_HEX_STRING_NUM_WARN) {
  25508. (0, _util.warn)("getHexString - ignoring additional invalid characters.");
  25509. return;
  25510. }
  25511. if (this._hexStringNumWarn > MAX_HEX_STRING_NUM_WARN) {
  25512. return;
  25513. }
  25514. (0, _util.warn)(`getHexString - ignoring invalid character: ${ch}`);
  25515. }
  25516. getHexString() {
  25517. const strBuf = this.strBuf;
  25518. strBuf.length = 0;
  25519. let ch = this.currentChar;
  25520. let isFirstHex = true;
  25521. let firstDigit, secondDigit;
  25522. this._hexStringNumWarn = 0;
  25523. while (true) {
  25524. if (ch < 0) {
  25525. (0, _util.warn)("Unterminated hex string");
  25526. break;
  25527. } else if (ch === 0x3e) {
  25528. this.nextChar();
  25529. break;
  25530. } else if (specialChars[ch] === 1) {
  25531. ch = this.nextChar();
  25532. continue;
  25533. } else {
  25534. if (isFirstHex) {
  25535. firstDigit = toHexDigit(ch);
  25536. if (firstDigit === -1) {
  25537. this._hexStringWarn(ch);
  25538. ch = this.nextChar();
  25539. continue;
  25540. }
  25541. } else {
  25542. secondDigit = toHexDigit(ch);
  25543. if (secondDigit === -1) {
  25544. this._hexStringWarn(ch);
  25545. ch = this.nextChar();
  25546. continue;
  25547. }
  25548. strBuf.push(String.fromCharCode(firstDigit << 4 | secondDigit));
  25549. }
  25550. isFirstHex = !isFirstHex;
  25551. ch = this.nextChar();
  25552. }
  25553. }
  25554. return strBuf.join("");
  25555. }
  25556. getObj() {
  25557. let comment = false;
  25558. let ch = this.currentChar;
  25559. while (true) {
  25560. if (ch < 0) {
  25561. return _primitives.EOF;
  25562. }
  25563. if (comment) {
  25564. if (ch === 0x0a || ch === 0x0d) {
  25565. comment = false;
  25566. }
  25567. } else if (ch === 0x25) {
  25568. comment = true;
  25569. } else if (specialChars[ch] !== 1) {
  25570. break;
  25571. }
  25572. ch = this.nextChar();
  25573. }
  25574. switch (ch | 0) {
  25575. case 0x30:
  25576. case 0x31:
  25577. case 0x32:
  25578. case 0x33:
  25579. case 0x34:
  25580. case 0x35:
  25581. case 0x36:
  25582. case 0x37:
  25583. case 0x38:
  25584. case 0x39:
  25585. case 0x2b:
  25586. case 0x2d:
  25587. case 0x2e:
  25588. return this.getNumber();
  25589. case 0x28:
  25590. return this.getString();
  25591. case 0x2f:
  25592. return this.getName();
  25593. case 0x5b:
  25594. this.nextChar();
  25595. return _primitives.Cmd.get("[");
  25596. case 0x5d:
  25597. this.nextChar();
  25598. return _primitives.Cmd.get("]");
  25599. case 0x3c:
  25600. ch = this.nextChar();
  25601. if (ch === 0x3c) {
  25602. this.nextChar();
  25603. return _primitives.Cmd.get("<<");
  25604. }
  25605. return this.getHexString();
  25606. case 0x3e:
  25607. ch = this.nextChar();
  25608. if (ch === 0x3e) {
  25609. this.nextChar();
  25610. return _primitives.Cmd.get(">>");
  25611. }
  25612. return _primitives.Cmd.get(">");
  25613. case 0x7b:
  25614. this.nextChar();
  25615. return _primitives.Cmd.get("{");
  25616. case 0x7d:
  25617. this.nextChar();
  25618. return _primitives.Cmd.get("}");
  25619. case 0x29:
  25620. this.nextChar();
  25621. throw new _util.FormatError(`Illegal character: ${ch}`);
  25622. }
  25623. let str = String.fromCharCode(ch);
  25624. if (ch < 0x20 || ch > 0x7f) {
  25625. const nextCh = this.peekChar();
  25626. if (nextCh >= 0x20 && nextCh <= 0x7f) {
  25627. this.nextChar();
  25628. return _primitives.Cmd.get(str);
  25629. }
  25630. }
  25631. const knownCommands = this.knownCommands;
  25632. let knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25633. while ((ch = this.nextChar()) >= 0 && !specialChars[ch]) {
  25634. const possibleCommand = str + String.fromCharCode(ch);
  25635. if (knownCommandFound && knownCommands[possibleCommand] === undefined) {
  25636. break;
  25637. }
  25638. if (str.length === 128) {
  25639. throw new _util.FormatError(`Command token too long: ${str.length}`);
  25640. }
  25641. str = possibleCommand;
  25642. knownCommandFound = knownCommands && knownCommands[str] !== undefined;
  25643. }
  25644. if (str === "true") {
  25645. return true;
  25646. }
  25647. if (str === "false") {
  25648. return false;
  25649. }
  25650. if (str === "null") {
  25651. return null;
  25652. }
  25653. if (str === "BI") {
  25654. this.beginInlineImagePos = this.stream.pos;
  25655. }
  25656. return _primitives.Cmd.get(str);
  25657. }
  25658. peekObj() {
  25659. const streamPos = this.stream.pos,
  25660. currentChar = this.currentChar,
  25661. beginInlineImagePos = this.beginInlineImagePos;
  25662. let nextObj;
  25663. try {
  25664. nextObj = this.getObj();
  25665. } catch (ex) {
  25666. if (ex instanceof _core_utils.MissingDataException) {
  25667. throw ex;
  25668. }
  25669. (0, _util.warn)(`peekObj: ${ex}`);
  25670. }
  25671. this.stream.pos = streamPos;
  25672. this.currentChar = currentChar;
  25673. this.beginInlineImagePos = beginInlineImagePos;
  25674. return nextObj;
  25675. }
  25676. skipToNextLine() {
  25677. let ch = this.currentChar;
  25678. while (ch >= 0) {
  25679. if (ch === 0x0d) {
  25680. ch = this.nextChar();
  25681. if (ch === 0x0a) {
  25682. this.nextChar();
  25683. }
  25684. break;
  25685. } else if (ch === 0x0a) {
  25686. this.nextChar();
  25687. break;
  25688. }
  25689. ch = this.nextChar();
  25690. }
  25691. }
  25692. }
  25693. exports.Lexer = Lexer;
  25694. class Linearization {
  25695. static create(stream) {
  25696. function getInt(linDict, name, allowZeroValue = false) {
  25697. const obj = linDict.get(name);
  25698. if (Number.isInteger(obj) && (allowZeroValue ? obj >= 0 : obj > 0)) {
  25699. return obj;
  25700. }
  25701. throw new Error(`The "${name}" parameter in the linearization ` + "dictionary is invalid.");
  25702. }
  25703. function getHints(linDict) {
  25704. const hints = linDict.get("H");
  25705. let hintsLength;
  25706. if (Array.isArray(hints) && ((hintsLength = hints.length) === 2 || hintsLength === 4)) {
  25707. for (let index = 0; index < hintsLength; index++) {
  25708. const hint = hints[index];
  25709. if (!(Number.isInteger(hint) && hint > 0)) {
  25710. throw new Error(`Hint (${index}) in the linearization dictionary is invalid.`);
  25711. }
  25712. }
  25713. return hints;
  25714. }
  25715. throw new Error("Hint array in the linearization dictionary is invalid.");
  25716. }
  25717. const parser = new Parser({
  25718. lexer: new Lexer(stream),
  25719. xref: null
  25720. });
  25721. const obj1 = parser.getObj();
  25722. const obj2 = parser.getObj();
  25723. const obj3 = parser.getObj();
  25724. const linDict = parser.getObj();
  25725. let obj, length;
  25726. if (!(Number.isInteger(obj1) && Number.isInteger(obj2) && (0, _primitives.isCmd)(obj3, "obj") && linDict instanceof _primitives.Dict && typeof (obj = linDict.get("Linearized")) === "number" && obj > 0)) {
  25727. return null;
  25728. } else if ((length = getInt(linDict, "L")) !== stream.length) {
  25729. throw new Error('The "L" parameter in the linearization dictionary ' + "does not equal the stream length.");
  25730. }
  25731. return {
  25732. length,
  25733. hints: getHints(linDict),
  25734. objectNumberFirst: getInt(linDict, "O"),
  25735. endFirst: getInt(linDict, "E"),
  25736. numPages: getInt(linDict, "N"),
  25737. mainXRefEntriesOffset: getInt(linDict, "T"),
  25738. pageFirst: linDict.has("P") ? getInt(linDict, "P", true) : 0
  25739. };
  25740. }
  25741. }
  25742. exports.Linearization = Linearization;
  25743. /***/ }),
  25744. /* 28 */
  25745. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25746. Object.defineProperty(exports, "__esModule", ({
  25747. value: true
  25748. }));
  25749. exports.Ascii85Stream = void 0;
  25750. var _decode_stream = __w_pdfjs_require__(29);
  25751. var _core_utils = __w_pdfjs_require__(8);
  25752. class Ascii85Stream extends _decode_stream.DecodeStream {
  25753. constructor(str, maybeLength) {
  25754. if (maybeLength) {
  25755. maybeLength *= 0.8;
  25756. }
  25757. super(maybeLength);
  25758. this.str = str;
  25759. this.dict = str.dict;
  25760. this.input = new Uint8Array(5);
  25761. }
  25762. readBlock() {
  25763. const TILDA_CHAR = 0x7e;
  25764. const Z_LOWER_CHAR = 0x7a;
  25765. const EOF = -1;
  25766. const str = this.str;
  25767. let c = str.getByte();
  25768. while ((0, _core_utils.isWhiteSpace)(c)) {
  25769. c = str.getByte();
  25770. }
  25771. if (c === EOF || c === TILDA_CHAR) {
  25772. this.eof = true;
  25773. return;
  25774. }
  25775. const bufferLength = this.bufferLength;
  25776. let buffer, i;
  25777. if (c === Z_LOWER_CHAR) {
  25778. buffer = this.ensureBuffer(bufferLength + 4);
  25779. for (i = 0; i < 4; ++i) {
  25780. buffer[bufferLength + i] = 0;
  25781. }
  25782. this.bufferLength += 4;
  25783. } else {
  25784. const input = this.input;
  25785. input[0] = c;
  25786. for (i = 1; i < 5; ++i) {
  25787. c = str.getByte();
  25788. while ((0, _core_utils.isWhiteSpace)(c)) {
  25789. c = str.getByte();
  25790. }
  25791. input[i] = c;
  25792. if (c === EOF || c === TILDA_CHAR) {
  25793. break;
  25794. }
  25795. }
  25796. buffer = this.ensureBuffer(bufferLength + i - 1);
  25797. this.bufferLength += i - 1;
  25798. if (i < 5) {
  25799. for (; i < 5; ++i) {
  25800. input[i] = 0x21 + 84;
  25801. }
  25802. this.eof = true;
  25803. }
  25804. let t = 0;
  25805. for (i = 0; i < 5; ++i) {
  25806. t = t * 85 + (input[i] - 0x21);
  25807. }
  25808. for (i = 3; i >= 0; --i) {
  25809. buffer[bufferLength + i] = t & 0xff;
  25810. t >>= 8;
  25811. }
  25812. }
  25813. }
  25814. }
  25815. exports.Ascii85Stream = Ascii85Stream;
  25816. /***/ }),
  25817. /* 29 */
  25818. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25819. Object.defineProperty(exports, "__esModule", ({
  25820. value: true
  25821. }));
  25822. exports.StreamsSequenceStream = exports.DecodeStream = void 0;
  25823. var _base_stream = __w_pdfjs_require__(9);
  25824. var _stream = __w_pdfjs_require__(10);
  25825. const emptyBuffer = new Uint8Array(0);
  25826. class DecodeStream extends _base_stream.BaseStream {
  25827. constructor(maybeMinBufferLength) {
  25828. super();
  25829. this._rawMinBufferLength = maybeMinBufferLength || 0;
  25830. this.pos = 0;
  25831. this.bufferLength = 0;
  25832. this.eof = false;
  25833. this.buffer = emptyBuffer;
  25834. this.minBufferLength = 512;
  25835. if (maybeMinBufferLength) {
  25836. while (this.minBufferLength < maybeMinBufferLength) {
  25837. this.minBufferLength *= 2;
  25838. }
  25839. }
  25840. }
  25841. get isEmpty() {
  25842. while (!this.eof && this.bufferLength === 0) {
  25843. this.readBlock();
  25844. }
  25845. return this.bufferLength === 0;
  25846. }
  25847. ensureBuffer(requested) {
  25848. const buffer = this.buffer;
  25849. if (requested <= buffer.byteLength) {
  25850. return buffer;
  25851. }
  25852. let size = this.minBufferLength;
  25853. while (size < requested) {
  25854. size *= 2;
  25855. }
  25856. const buffer2 = new Uint8Array(size);
  25857. buffer2.set(buffer);
  25858. return this.buffer = buffer2;
  25859. }
  25860. getByte() {
  25861. const pos = this.pos;
  25862. while (this.bufferLength <= pos) {
  25863. if (this.eof) {
  25864. return -1;
  25865. }
  25866. this.readBlock();
  25867. }
  25868. return this.buffer[this.pos++];
  25869. }
  25870. getBytes(length) {
  25871. const pos = this.pos;
  25872. let end;
  25873. if (length) {
  25874. this.ensureBuffer(pos + length);
  25875. end = pos + length;
  25876. while (!this.eof && this.bufferLength < end) {
  25877. this.readBlock();
  25878. }
  25879. const bufEnd = this.bufferLength;
  25880. if (end > bufEnd) {
  25881. end = bufEnd;
  25882. }
  25883. } else {
  25884. while (!this.eof) {
  25885. this.readBlock();
  25886. }
  25887. end = this.bufferLength;
  25888. }
  25889. this.pos = end;
  25890. return this.buffer.subarray(pos, end);
  25891. }
  25892. reset() {
  25893. this.pos = 0;
  25894. }
  25895. makeSubStream(start, length, dict = null) {
  25896. if (length === undefined) {
  25897. while (!this.eof) {
  25898. this.readBlock();
  25899. }
  25900. } else {
  25901. const end = start + length;
  25902. while (this.bufferLength <= end && !this.eof) {
  25903. this.readBlock();
  25904. }
  25905. }
  25906. return new _stream.Stream(this.buffer, start, length, dict);
  25907. }
  25908. getBaseStreams() {
  25909. return this.str ? this.str.getBaseStreams() : null;
  25910. }
  25911. }
  25912. exports.DecodeStream = DecodeStream;
  25913. class StreamsSequenceStream extends DecodeStream {
  25914. constructor(streams, onError = null) {
  25915. let maybeLength = 0;
  25916. for (const stream of streams) {
  25917. maybeLength += stream instanceof DecodeStream ? stream._rawMinBufferLength : stream.length;
  25918. }
  25919. super(maybeLength);
  25920. this.streams = streams;
  25921. this._onError = onError;
  25922. }
  25923. readBlock() {
  25924. const streams = this.streams;
  25925. if (streams.length === 0) {
  25926. this.eof = true;
  25927. return;
  25928. }
  25929. const stream = streams.shift();
  25930. let chunk;
  25931. try {
  25932. chunk = stream.getBytes();
  25933. } catch (reason) {
  25934. if (this._onError) {
  25935. this._onError(reason, stream.dict && stream.dict.objId);
  25936. return;
  25937. }
  25938. throw reason;
  25939. }
  25940. const bufferLength = this.bufferLength;
  25941. const newLength = bufferLength + chunk.length;
  25942. const buffer = this.ensureBuffer(newLength);
  25943. buffer.set(chunk, bufferLength);
  25944. this.bufferLength = newLength;
  25945. }
  25946. getBaseStreams() {
  25947. const baseStreamsBuf = [];
  25948. for (const stream of this.streams) {
  25949. const baseStreams = stream.getBaseStreams();
  25950. if (baseStreams) {
  25951. baseStreamsBuf.push(...baseStreams);
  25952. }
  25953. }
  25954. return baseStreamsBuf.length > 0 ? baseStreamsBuf : null;
  25955. }
  25956. }
  25957. exports.StreamsSequenceStream = StreamsSequenceStream;
  25958. /***/ }),
  25959. /* 30 */
  25960. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  25961. Object.defineProperty(exports, "__esModule", ({
  25962. value: true
  25963. }));
  25964. exports.AsciiHexStream = void 0;
  25965. var _decode_stream = __w_pdfjs_require__(29);
  25966. class AsciiHexStream extends _decode_stream.DecodeStream {
  25967. constructor(str, maybeLength) {
  25968. if (maybeLength) {
  25969. maybeLength *= 0.5;
  25970. }
  25971. super(maybeLength);
  25972. this.str = str;
  25973. this.dict = str.dict;
  25974. this.firstDigit = -1;
  25975. }
  25976. readBlock() {
  25977. const UPSTREAM_BLOCK_SIZE = 8000;
  25978. const bytes = this.str.getBytes(UPSTREAM_BLOCK_SIZE);
  25979. if (!bytes.length) {
  25980. this.eof = true;
  25981. return;
  25982. }
  25983. const maxDecodeLength = bytes.length + 1 >> 1;
  25984. const buffer = this.ensureBuffer(this.bufferLength + maxDecodeLength);
  25985. let bufferLength = this.bufferLength;
  25986. let firstDigit = this.firstDigit;
  25987. for (const ch of bytes) {
  25988. let digit;
  25989. if (ch >= 0x30 && ch <= 0x39) {
  25990. digit = ch & 0x0f;
  25991. } else if (ch >= 0x41 && ch <= 0x46 || ch >= 0x61 && ch <= 0x66) {
  25992. digit = (ch & 0x0f) + 9;
  25993. } else if (ch === 0x3e) {
  25994. this.eof = true;
  25995. break;
  25996. } else {
  25997. continue;
  25998. }
  25999. if (firstDigit < 0) {
  26000. firstDigit = digit;
  26001. } else {
  26002. buffer[bufferLength++] = firstDigit << 4 | digit;
  26003. firstDigit = -1;
  26004. }
  26005. }
  26006. if (firstDigit >= 0 && this.eof) {
  26007. buffer[bufferLength++] = firstDigit << 4;
  26008. firstDigit = -1;
  26009. }
  26010. this.firstDigit = firstDigit;
  26011. this.bufferLength = bufferLength;
  26012. }
  26013. }
  26014. exports.AsciiHexStream = AsciiHexStream;
  26015. /***/ }),
  26016. /* 31 */
  26017. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26018. Object.defineProperty(exports, "__esModule", ({
  26019. value: true
  26020. }));
  26021. exports.CCITTFaxStream = void 0;
  26022. var _ccitt = __w_pdfjs_require__(32);
  26023. var _decode_stream = __w_pdfjs_require__(29);
  26024. var _primitives = __w_pdfjs_require__(5);
  26025. class CCITTFaxStream extends _decode_stream.DecodeStream {
  26026. constructor(str, maybeLength, params) {
  26027. super(maybeLength);
  26028. this.str = str;
  26029. this.dict = str.dict;
  26030. if (!(params instanceof _primitives.Dict)) {
  26031. params = _primitives.Dict.empty;
  26032. }
  26033. const source = {
  26034. next() {
  26035. return str.getByte();
  26036. }
  26037. };
  26038. this.ccittFaxDecoder = new _ccitt.CCITTFaxDecoder(source, {
  26039. K: params.get("K"),
  26040. EndOfLine: params.get("EndOfLine"),
  26041. EncodedByteAlign: params.get("EncodedByteAlign"),
  26042. Columns: params.get("Columns"),
  26043. Rows: params.get("Rows"),
  26044. EndOfBlock: params.get("EndOfBlock"),
  26045. BlackIs1: params.get("BlackIs1")
  26046. });
  26047. }
  26048. readBlock() {
  26049. while (!this.eof) {
  26050. const c = this.ccittFaxDecoder.readNextChar();
  26051. if (c === -1) {
  26052. this.eof = true;
  26053. return;
  26054. }
  26055. this.ensureBuffer(this.bufferLength + 1);
  26056. this.buffer[this.bufferLength++] = c;
  26057. }
  26058. }
  26059. }
  26060. exports.CCITTFaxStream = CCITTFaxStream;
  26061. /***/ }),
  26062. /* 32 */
  26063. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26064. Object.defineProperty(exports, "__esModule", ({
  26065. value: true
  26066. }));
  26067. exports.CCITTFaxDecoder = void 0;
  26068. var _util = __w_pdfjs_require__(2);
  26069. const ccittEOL = -2;
  26070. const ccittEOF = -1;
  26071. const twoDimPass = 0;
  26072. const twoDimHoriz = 1;
  26073. const twoDimVert0 = 2;
  26074. const twoDimVertR1 = 3;
  26075. const twoDimVertL1 = 4;
  26076. const twoDimVertR2 = 5;
  26077. const twoDimVertL2 = 6;
  26078. const twoDimVertR3 = 7;
  26079. const twoDimVertL3 = 8;
  26080. 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]];
  26081. 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]];
  26082. 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]];
  26083. 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]];
  26084. 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]];
  26085. 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]];
  26086. class CCITTFaxDecoder {
  26087. constructor(source, options = {}) {
  26088. if (!source || typeof source.next !== "function") {
  26089. throw new Error('CCITTFaxDecoder - invalid "source" parameter.');
  26090. }
  26091. this.source = source;
  26092. this.eof = false;
  26093. this.encoding = options.K || 0;
  26094. this.eoline = options.EndOfLine || false;
  26095. this.byteAlign = options.EncodedByteAlign || false;
  26096. this.columns = options.Columns || 1728;
  26097. this.rows = options.Rows || 0;
  26098. let eoblock = options.EndOfBlock;
  26099. if (eoblock === null || eoblock === undefined) {
  26100. eoblock = true;
  26101. }
  26102. this.eoblock = eoblock;
  26103. this.black = options.BlackIs1 || false;
  26104. this.codingLine = new Uint32Array(this.columns + 1);
  26105. this.refLine = new Uint32Array(this.columns + 2);
  26106. this.codingLine[0] = this.columns;
  26107. this.codingPos = 0;
  26108. this.row = 0;
  26109. this.nextLine2D = this.encoding < 0;
  26110. this.inputBits = 0;
  26111. this.inputBuf = 0;
  26112. this.outputBits = 0;
  26113. this.rowsDone = false;
  26114. let code1;
  26115. while ((code1 = this._lookBits(12)) === 0) {
  26116. this._eatBits(1);
  26117. }
  26118. if (code1 === 1) {
  26119. this._eatBits(12);
  26120. }
  26121. if (this.encoding > 0) {
  26122. this.nextLine2D = !this._lookBits(1);
  26123. this._eatBits(1);
  26124. }
  26125. }
  26126. readNextChar() {
  26127. if (this.eof) {
  26128. return -1;
  26129. }
  26130. const refLine = this.refLine;
  26131. const codingLine = this.codingLine;
  26132. const columns = this.columns;
  26133. let refPos, blackPixels, bits, i;
  26134. if (this.outputBits === 0) {
  26135. if (this.rowsDone) {
  26136. this.eof = true;
  26137. }
  26138. if (this.eof) {
  26139. return -1;
  26140. }
  26141. this.err = false;
  26142. let code1, code2, code3;
  26143. if (this.nextLine2D) {
  26144. for (i = 0; codingLine[i] < columns; ++i) {
  26145. refLine[i] = codingLine[i];
  26146. }
  26147. refLine[i++] = columns;
  26148. refLine[i] = columns;
  26149. codingLine[0] = 0;
  26150. this.codingPos = 0;
  26151. refPos = 0;
  26152. blackPixels = 0;
  26153. while (codingLine[this.codingPos] < columns) {
  26154. code1 = this._getTwoDimCode();
  26155. switch (code1) {
  26156. case twoDimPass:
  26157. this._addPixels(refLine[refPos + 1], blackPixels);
  26158. if (refLine[refPos + 1] < columns) {
  26159. refPos += 2;
  26160. }
  26161. break;
  26162. case twoDimHoriz:
  26163. code1 = code2 = 0;
  26164. if (blackPixels) {
  26165. do {
  26166. code1 += code3 = this._getBlackCode();
  26167. } while (code3 >= 64);
  26168. do {
  26169. code2 += code3 = this._getWhiteCode();
  26170. } while (code3 >= 64);
  26171. } else {
  26172. do {
  26173. code1 += code3 = this._getWhiteCode();
  26174. } while (code3 >= 64);
  26175. do {
  26176. code2 += code3 = this._getBlackCode();
  26177. } while (code3 >= 64);
  26178. }
  26179. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26180. if (codingLine[this.codingPos] < columns) {
  26181. this._addPixels(codingLine[this.codingPos] + code2, blackPixels ^ 1);
  26182. }
  26183. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26184. refPos += 2;
  26185. }
  26186. break;
  26187. case twoDimVertR3:
  26188. this._addPixels(refLine[refPos] + 3, blackPixels);
  26189. blackPixels ^= 1;
  26190. if (codingLine[this.codingPos] < columns) {
  26191. ++refPos;
  26192. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26193. refPos += 2;
  26194. }
  26195. }
  26196. break;
  26197. case twoDimVertR2:
  26198. this._addPixels(refLine[refPos] + 2, blackPixels);
  26199. blackPixels ^= 1;
  26200. if (codingLine[this.codingPos] < columns) {
  26201. ++refPos;
  26202. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26203. refPos += 2;
  26204. }
  26205. }
  26206. break;
  26207. case twoDimVertR1:
  26208. this._addPixels(refLine[refPos] + 1, blackPixels);
  26209. blackPixels ^= 1;
  26210. if (codingLine[this.codingPos] < columns) {
  26211. ++refPos;
  26212. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26213. refPos += 2;
  26214. }
  26215. }
  26216. break;
  26217. case twoDimVert0:
  26218. this._addPixels(refLine[refPos], blackPixels);
  26219. blackPixels ^= 1;
  26220. if (codingLine[this.codingPos] < columns) {
  26221. ++refPos;
  26222. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26223. refPos += 2;
  26224. }
  26225. }
  26226. break;
  26227. case twoDimVertL3:
  26228. this._addPixelsNeg(refLine[refPos] - 3, blackPixels);
  26229. blackPixels ^= 1;
  26230. if (codingLine[this.codingPos] < columns) {
  26231. if (refPos > 0) {
  26232. --refPos;
  26233. } else {
  26234. ++refPos;
  26235. }
  26236. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26237. refPos += 2;
  26238. }
  26239. }
  26240. break;
  26241. case twoDimVertL2:
  26242. this._addPixelsNeg(refLine[refPos] - 2, blackPixels);
  26243. blackPixels ^= 1;
  26244. if (codingLine[this.codingPos] < columns) {
  26245. if (refPos > 0) {
  26246. --refPos;
  26247. } else {
  26248. ++refPos;
  26249. }
  26250. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26251. refPos += 2;
  26252. }
  26253. }
  26254. break;
  26255. case twoDimVertL1:
  26256. this._addPixelsNeg(refLine[refPos] - 1, blackPixels);
  26257. blackPixels ^= 1;
  26258. if (codingLine[this.codingPos] < columns) {
  26259. if (refPos > 0) {
  26260. --refPos;
  26261. } else {
  26262. ++refPos;
  26263. }
  26264. while (refLine[refPos] <= codingLine[this.codingPos] && refLine[refPos] < columns) {
  26265. refPos += 2;
  26266. }
  26267. }
  26268. break;
  26269. case ccittEOF:
  26270. this._addPixels(columns, 0);
  26271. this.eof = true;
  26272. break;
  26273. default:
  26274. (0, _util.info)("bad 2d code");
  26275. this._addPixels(columns, 0);
  26276. this.err = true;
  26277. }
  26278. }
  26279. } else {
  26280. codingLine[0] = 0;
  26281. this.codingPos = 0;
  26282. blackPixels = 0;
  26283. while (codingLine[this.codingPos] < columns) {
  26284. code1 = 0;
  26285. if (blackPixels) {
  26286. do {
  26287. code1 += code3 = this._getBlackCode();
  26288. } while (code3 >= 64);
  26289. } else {
  26290. do {
  26291. code1 += code3 = this._getWhiteCode();
  26292. } while (code3 >= 64);
  26293. }
  26294. this._addPixels(codingLine[this.codingPos] + code1, blackPixels);
  26295. blackPixels ^= 1;
  26296. }
  26297. }
  26298. let gotEOL = false;
  26299. if (this.byteAlign) {
  26300. this.inputBits &= ~7;
  26301. }
  26302. if (!this.eoblock && this.row === this.rows - 1) {
  26303. this.rowsDone = true;
  26304. } else {
  26305. code1 = this._lookBits(12);
  26306. if (this.eoline) {
  26307. while (code1 !== ccittEOF && code1 !== 1) {
  26308. this._eatBits(1);
  26309. code1 = this._lookBits(12);
  26310. }
  26311. } else {
  26312. while (code1 === 0) {
  26313. this._eatBits(1);
  26314. code1 = this._lookBits(12);
  26315. }
  26316. }
  26317. if (code1 === 1) {
  26318. this._eatBits(12);
  26319. gotEOL = true;
  26320. } else if (code1 === ccittEOF) {
  26321. this.eof = true;
  26322. }
  26323. }
  26324. if (!this.eof && this.encoding > 0 && !this.rowsDone) {
  26325. this.nextLine2D = !this._lookBits(1);
  26326. this._eatBits(1);
  26327. }
  26328. if (this.eoblock && gotEOL && this.byteAlign) {
  26329. code1 = this._lookBits(12);
  26330. if (code1 === 1) {
  26331. this._eatBits(12);
  26332. if (this.encoding > 0) {
  26333. this._lookBits(1);
  26334. this._eatBits(1);
  26335. }
  26336. if (this.encoding >= 0) {
  26337. for (i = 0; i < 4; ++i) {
  26338. code1 = this._lookBits(12);
  26339. if (code1 !== 1) {
  26340. (0, _util.info)("bad rtc code: " + code1);
  26341. }
  26342. this._eatBits(12);
  26343. if (this.encoding > 0) {
  26344. this._lookBits(1);
  26345. this._eatBits(1);
  26346. }
  26347. }
  26348. }
  26349. this.eof = true;
  26350. }
  26351. } else if (this.err && this.eoline) {
  26352. while (true) {
  26353. code1 = this._lookBits(13);
  26354. if (code1 === ccittEOF) {
  26355. this.eof = true;
  26356. return -1;
  26357. }
  26358. if (code1 >> 1 === 1) {
  26359. break;
  26360. }
  26361. this._eatBits(1);
  26362. }
  26363. this._eatBits(12);
  26364. if (this.encoding > 0) {
  26365. this._eatBits(1);
  26366. this.nextLine2D = !(code1 & 1);
  26367. }
  26368. }
  26369. if (codingLine[0] > 0) {
  26370. this.outputBits = codingLine[this.codingPos = 0];
  26371. } else {
  26372. this.outputBits = codingLine[this.codingPos = 1];
  26373. }
  26374. this.row++;
  26375. }
  26376. let c;
  26377. if (this.outputBits >= 8) {
  26378. c = this.codingPos & 1 ? 0 : 0xff;
  26379. this.outputBits -= 8;
  26380. if (this.outputBits === 0 && codingLine[this.codingPos] < columns) {
  26381. this.codingPos++;
  26382. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26383. }
  26384. } else {
  26385. bits = 8;
  26386. c = 0;
  26387. do {
  26388. if (typeof this.outputBits !== "number") {
  26389. throw new _util.FormatError('Invalid /CCITTFaxDecode data, "outputBits" must be a number.');
  26390. }
  26391. if (this.outputBits > bits) {
  26392. c <<= bits;
  26393. if (!(this.codingPos & 1)) {
  26394. c |= 0xff >> 8 - bits;
  26395. }
  26396. this.outputBits -= bits;
  26397. bits = 0;
  26398. } else {
  26399. c <<= this.outputBits;
  26400. if (!(this.codingPos & 1)) {
  26401. c |= 0xff >> 8 - this.outputBits;
  26402. }
  26403. bits -= this.outputBits;
  26404. this.outputBits = 0;
  26405. if (codingLine[this.codingPos] < columns) {
  26406. this.codingPos++;
  26407. this.outputBits = codingLine[this.codingPos] - codingLine[this.codingPos - 1];
  26408. } else if (bits > 0) {
  26409. c <<= bits;
  26410. bits = 0;
  26411. }
  26412. }
  26413. } while (bits);
  26414. }
  26415. if (this.black) {
  26416. c ^= 0xff;
  26417. }
  26418. return c;
  26419. }
  26420. _addPixels(a1, blackPixels) {
  26421. const codingLine = this.codingLine;
  26422. let codingPos = this.codingPos;
  26423. if (a1 > codingLine[codingPos]) {
  26424. if (a1 > this.columns) {
  26425. (0, _util.info)("row is wrong length");
  26426. this.err = true;
  26427. a1 = this.columns;
  26428. }
  26429. if (codingPos & 1 ^ blackPixels) {
  26430. ++codingPos;
  26431. }
  26432. codingLine[codingPos] = a1;
  26433. }
  26434. this.codingPos = codingPos;
  26435. }
  26436. _addPixelsNeg(a1, blackPixels) {
  26437. const codingLine = this.codingLine;
  26438. let codingPos = this.codingPos;
  26439. if (a1 > codingLine[codingPos]) {
  26440. if (a1 > this.columns) {
  26441. (0, _util.info)("row is wrong length");
  26442. this.err = true;
  26443. a1 = this.columns;
  26444. }
  26445. if (codingPos & 1 ^ blackPixels) {
  26446. ++codingPos;
  26447. }
  26448. codingLine[codingPos] = a1;
  26449. } else if (a1 < codingLine[codingPos]) {
  26450. if (a1 < 0) {
  26451. (0, _util.info)("invalid code");
  26452. this.err = true;
  26453. a1 = 0;
  26454. }
  26455. while (codingPos > 0 && a1 < codingLine[codingPos - 1]) {
  26456. --codingPos;
  26457. }
  26458. codingLine[codingPos] = a1;
  26459. }
  26460. this.codingPos = codingPos;
  26461. }
  26462. _findTableCode(start, end, table, limit) {
  26463. const limitValue = limit || 0;
  26464. for (let i = start; i <= end; ++i) {
  26465. let code = this._lookBits(i);
  26466. if (code === ccittEOF) {
  26467. return [true, 1, false];
  26468. }
  26469. if (i < end) {
  26470. code <<= end - i;
  26471. }
  26472. if (!limitValue || code >= limitValue) {
  26473. const p = table[code - limitValue];
  26474. if (p[0] === i) {
  26475. this._eatBits(i);
  26476. return [true, p[1], true];
  26477. }
  26478. }
  26479. }
  26480. return [false, 0, false];
  26481. }
  26482. _getTwoDimCode() {
  26483. let code = 0;
  26484. let p;
  26485. if (this.eoblock) {
  26486. code = this._lookBits(7);
  26487. p = twoDimTable[code];
  26488. if (p && p[0] > 0) {
  26489. this._eatBits(p[0]);
  26490. return p[1];
  26491. }
  26492. } else {
  26493. const result = this._findTableCode(1, 7, twoDimTable);
  26494. if (result[0] && result[2]) {
  26495. return result[1];
  26496. }
  26497. }
  26498. (0, _util.info)("Bad two dim code");
  26499. return ccittEOF;
  26500. }
  26501. _getWhiteCode() {
  26502. let code = 0;
  26503. let p;
  26504. if (this.eoblock) {
  26505. code = this._lookBits(12);
  26506. if (code === ccittEOF) {
  26507. return 1;
  26508. }
  26509. if (code >> 5 === 0) {
  26510. p = whiteTable1[code];
  26511. } else {
  26512. p = whiteTable2[code >> 3];
  26513. }
  26514. if (p[0] > 0) {
  26515. this._eatBits(p[0]);
  26516. return p[1];
  26517. }
  26518. } else {
  26519. let result = this._findTableCode(1, 9, whiteTable2);
  26520. if (result[0]) {
  26521. return result[1];
  26522. }
  26523. result = this._findTableCode(11, 12, whiteTable1);
  26524. if (result[0]) {
  26525. return result[1];
  26526. }
  26527. }
  26528. (0, _util.info)("bad white code");
  26529. this._eatBits(1);
  26530. return 1;
  26531. }
  26532. _getBlackCode() {
  26533. let code, p;
  26534. if (this.eoblock) {
  26535. code = this._lookBits(13);
  26536. if (code === ccittEOF) {
  26537. return 1;
  26538. }
  26539. if (code >> 7 === 0) {
  26540. p = blackTable1[code];
  26541. } else if (code >> 9 === 0 && code >> 7 !== 0) {
  26542. p = blackTable2[(code >> 1) - 64];
  26543. } else {
  26544. p = blackTable3[code >> 7];
  26545. }
  26546. if (p[0] > 0) {
  26547. this._eatBits(p[0]);
  26548. return p[1];
  26549. }
  26550. } else {
  26551. let result = this._findTableCode(2, 6, blackTable3);
  26552. if (result[0]) {
  26553. return result[1];
  26554. }
  26555. result = this._findTableCode(7, 12, blackTable2, 64);
  26556. if (result[0]) {
  26557. return result[1];
  26558. }
  26559. result = this._findTableCode(10, 13, blackTable1);
  26560. if (result[0]) {
  26561. return result[1];
  26562. }
  26563. }
  26564. (0, _util.info)("bad black code");
  26565. this._eatBits(1);
  26566. return 1;
  26567. }
  26568. _lookBits(n) {
  26569. let c;
  26570. while (this.inputBits < n) {
  26571. if ((c = this.source.next()) === -1) {
  26572. if (this.inputBits === 0) {
  26573. return ccittEOF;
  26574. }
  26575. return this.inputBuf << n - this.inputBits & 0xffff >> 16 - n;
  26576. }
  26577. this.inputBuf = this.inputBuf << 8 | c;
  26578. this.inputBits += 8;
  26579. }
  26580. return this.inputBuf >> this.inputBits - n & 0xffff >> 16 - n;
  26581. }
  26582. _eatBits(n) {
  26583. if ((this.inputBits -= n) < 0) {
  26584. this.inputBits = 0;
  26585. }
  26586. }
  26587. }
  26588. exports.CCITTFaxDecoder = CCITTFaxDecoder;
  26589. /***/ }),
  26590. /* 33 */
  26591. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26592. Object.defineProperty(exports, "__esModule", ({
  26593. value: true
  26594. }));
  26595. exports.FlateStream = void 0;
  26596. var _decode_stream = __w_pdfjs_require__(29);
  26597. var _util = __w_pdfjs_require__(2);
  26598. const codeLenCodeMap = new Int32Array([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
  26599. 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]);
  26600. 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]);
  26601. 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];
  26602. 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];
  26603. class FlateStream extends _decode_stream.DecodeStream {
  26604. constructor(str, maybeLength) {
  26605. super(maybeLength);
  26606. this.str = str;
  26607. this.dict = str.dict;
  26608. const cmf = str.getByte();
  26609. const flg = str.getByte();
  26610. if (cmf === -1 || flg === -1) {
  26611. throw new _util.FormatError(`Invalid header in flate stream: ${cmf}, ${flg}`);
  26612. }
  26613. if ((cmf & 0x0f) !== 0x08) {
  26614. throw new _util.FormatError(`Unknown compression method in flate stream: ${cmf}, ${flg}`);
  26615. }
  26616. if (((cmf << 8) + flg) % 31 !== 0) {
  26617. throw new _util.FormatError(`Bad FCHECK in flate stream: ${cmf}, ${flg}`);
  26618. }
  26619. if (flg & 0x20) {
  26620. throw new _util.FormatError(`FDICT bit set in flate stream: ${cmf}, ${flg}`);
  26621. }
  26622. this.codeSize = 0;
  26623. this.codeBuf = 0;
  26624. }
  26625. getBits(bits) {
  26626. const str = this.str;
  26627. let codeSize = this.codeSize;
  26628. let codeBuf = this.codeBuf;
  26629. let b;
  26630. while (codeSize < bits) {
  26631. if ((b = str.getByte()) === -1) {
  26632. throw new _util.FormatError("Bad encoding in flate stream");
  26633. }
  26634. codeBuf |= b << codeSize;
  26635. codeSize += 8;
  26636. }
  26637. b = codeBuf & (1 << bits) - 1;
  26638. this.codeBuf = codeBuf >> bits;
  26639. this.codeSize = codeSize -= bits;
  26640. return b;
  26641. }
  26642. getCode(table) {
  26643. const str = this.str;
  26644. const codes = table[0];
  26645. const maxLen = table[1];
  26646. let codeSize = this.codeSize;
  26647. let codeBuf = this.codeBuf;
  26648. let b;
  26649. while (codeSize < maxLen) {
  26650. if ((b = str.getByte()) === -1) {
  26651. break;
  26652. }
  26653. codeBuf |= b << codeSize;
  26654. codeSize += 8;
  26655. }
  26656. const code = codes[codeBuf & (1 << maxLen) - 1];
  26657. const codeLen = code >> 16;
  26658. const codeVal = code & 0xffff;
  26659. if (codeLen < 1 || codeSize < codeLen) {
  26660. throw new _util.FormatError("Bad encoding in flate stream");
  26661. }
  26662. this.codeBuf = codeBuf >> codeLen;
  26663. this.codeSize = codeSize - codeLen;
  26664. return codeVal;
  26665. }
  26666. generateHuffmanTable(lengths) {
  26667. const n = lengths.length;
  26668. let maxLen = 0;
  26669. let i;
  26670. for (i = 0; i < n; ++i) {
  26671. if (lengths[i] > maxLen) {
  26672. maxLen = lengths[i];
  26673. }
  26674. }
  26675. const size = 1 << maxLen;
  26676. const codes = new Int32Array(size);
  26677. for (let len = 1, code = 0, skip = 2; len <= maxLen; ++len, code <<= 1, skip <<= 1) {
  26678. for (let val = 0; val < n; ++val) {
  26679. if (lengths[val] === len) {
  26680. let code2 = 0;
  26681. let t = code;
  26682. for (i = 0; i < len; ++i) {
  26683. code2 = code2 << 1 | t & 1;
  26684. t >>= 1;
  26685. }
  26686. for (i = code2; i < size; i += skip) {
  26687. codes[i] = len << 16 | val;
  26688. }
  26689. ++code;
  26690. }
  26691. }
  26692. }
  26693. return [codes, maxLen];
  26694. }
  26695. readBlock() {
  26696. let buffer, len;
  26697. const str = this.str;
  26698. let hdr = this.getBits(3);
  26699. if (hdr & 1) {
  26700. this.eof = true;
  26701. }
  26702. hdr >>= 1;
  26703. if (hdr === 0) {
  26704. let b;
  26705. if ((b = str.getByte()) === -1) {
  26706. throw new _util.FormatError("Bad block header in flate stream");
  26707. }
  26708. let blockLen = b;
  26709. if ((b = str.getByte()) === -1) {
  26710. throw new _util.FormatError("Bad block header in flate stream");
  26711. }
  26712. blockLen |= b << 8;
  26713. if ((b = str.getByte()) === -1) {
  26714. throw new _util.FormatError("Bad block header in flate stream");
  26715. }
  26716. let check = b;
  26717. if ((b = str.getByte()) === -1) {
  26718. throw new _util.FormatError("Bad block header in flate stream");
  26719. }
  26720. check |= b << 8;
  26721. if (check !== (~blockLen & 0xffff) && (blockLen !== 0 || check !== 0)) {
  26722. throw new _util.FormatError("Bad uncompressed block length in flate stream");
  26723. }
  26724. this.codeBuf = 0;
  26725. this.codeSize = 0;
  26726. const bufferLength = this.bufferLength,
  26727. end = bufferLength + blockLen;
  26728. buffer = this.ensureBuffer(end);
  26729. this.bufferLength = end;
  26730. if (blockLen === 0) {
  26731. if (str.peekByte() === -1) {
  26732. this.eof = true;
  26733. }
  26734. } else {
  26735. const block = str.getBytes(blockLen);
  26736. buffer.set(block, bufferLength);
  26737. if (block.length < blockLen) {
  26738. this.eof = true;
  26739. }
  26740. }
  26741. return;
  26742. }
  26743. let litCodeTable;
  26744. let distCodeTable;
  26745. if (hdr === 1) {
  26746. litCodeTable = fixedLitCodeTab;
  26747. distCodeTable = fixedDistCodeTab;
  26748. } else if (hdr === 2) {
  26749. const numLitCodes = this.getBits(5) + 257;
  26750. const numDistCodes = this.getBits(5) + 1;
  26751. const numCodeLenCodes = this.getBits(4) + 4;
  26752. const codeLenCodeLengths = new Uint8Array(codeLenCodeMap.length);
  26753. let i;
  26754. for (i = 0; i < numCodeLenCodes; ++i) {
  26755. codeLenCodeLengths[codeLenCodeMap[i]] = this.getBits(3);
  26756. }
  26757. const codeLenCodeTab = this.generateHuffmanTable(codeLenCodeLengths);
  26758. len = 0;
  26759. i = 0;
  26760. const codes = numLitCodes + numDistCodes;
  26761. const codeLengths = new Uint8Array(codes);
  26762. let bitsLength, bitsOffset, what;
  26763. while (i < codes) {
  26764. const code = this.getCode(codeLenCodeTab);
  26765. if (code === 16) {
  26766. bitsLength = 2;
  26767. bitsOffset = 3;
  26768. what = len;
  26769. } else if (code === 17) {
  26770. bitsLength = 3;
  26771. bitsOffset = 3;
  26772. what = len = 0;
  26773. } else if (code === 18) {
  26774. bitsLength = 7;
  26775. bitsOffset = 11;
  26776. what = len = 0;
  26777. } else {
  26778. codeLengths[i++] = len = code;
  26779. continue;
  26780. }
  26781. let repeatLength = this.getBits(bitsLength) + bitsOffset;
  26782. while (repeatLength-- > 0) {
  26783. codeLengths[i++] = what;
  26784. }
  26785. }
  26786. litCodeTable = this.generateHuffmanTable(codeLengths.subarray(0, numLitCodes));
  26787. distCodeTable = this.generateHuffmanTable(codeLengths.subarray(numLitCodes, codes));
  26788. } else {
  26789. throw new _util.FormatError("Unknown block type in flate stream");
  26790. }
  26791. buffer = this.buffer;
  26792. let limit = buffer ? buffer.length : 0;
  26793. let pos = this.bufferLength;
  26794. while (true) {
  26795. let code1 = this.getCode(litCodeTable);
  26796. if (code1 < 256) {
  26797. if (pos + 1 >= limit) {
  26798. buffer = this.ensureBuffer(pos + 1);
  26799. limit = buffer.length;
  26800. }
  26801. buffer[pos++] = code1;
  26802. continue;
  26803. }
  26804. if (code1 === 256) {
  26805. this.bufferLength = pos;
  26806. return;
  26807. }
  26808. code1 -= 257;
  26809. code1 = lengthDecode[code1];
  26810. let code2 = code1 >> 16;
  26811. if (code2 > 0) {
  26812. code2 = this.getBits(code2);
  26813. }
  26814. len = (code1 & 0xffff) + code2;
  26815. code1 = this.getCode(distCodeTable);
  26816. code1 = distDecode[code1];
  26817. code2 = code1 >> 16;
  26818. if (code2 > 0) {
  26819. code2 = this.getBits(code2);
  26820. }
  26821. const dist = (code1 & 0xffff) + code2;
  26822. if (pos + len >= limit) {
  26823. buffer = this.ensureBuffer(pos + len);
  26824. limit = buffer.length;
  26825. }
  26826. for (let k = 0; k < len; ++k, ++pos) {
  26827. buffer[pos] = buffer[pos - dist];
  26828. }
  26829. }
  26830. }
  26831. }
  26832. exports.FlateStream = FlateStream;
  26833. /***/ }),
  26834. /* 34 */
  26835. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26836. Object.defineProperty(exports, "__esModule", ({
  26837. value: true
  26838. }));
  26839. exports.Jbig2Stream = void 0;
  26840. var _base_stream = __w_pdfjs_require__(9);
  26841. var _decode_stream = __w_pdfjs_require__(29);
  26842. var _primitives = __w_pdfjs_require__(5);
  26843. var _jbig = __w_pdfjs_require__(35);
  26844. var _util = __w_pdfjs_require__(2);
  26845. class Jbig2Stream extends _decode_stream.DecodeStream {
  26846. constructor(stream, maybeLength, params) {
  26847. super(maybeLength);
  26848. this.stream = stream;
  26849. this.dict = stream.dict;
  26850. this.maybeLength = maybeLength;
  26851. this.params = params;
  26852. }
  26853. get bytes() {
  26854. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  26855. }
  26856. ensureBuffer(requested) {}
  26857. readBlock() {
  26858. if (this.eof) {
  26859. return;
  26860. }
  26861. const jbig2Image = new _jbig.Jbig2Image();
  26862. const chunks = [];
  26863. if (this.params instanceof _primitives.Dict) {
  26864. const globalsStream = this.params.get("JBIG2Globals");
  26865. if (globalsStream instanceof _base_stream.BaseStream) {
  26866. const globals = globalsStream.getBytes();
  26867. chunks.push({
  26868. data: globals,
  26869. start: 0,
  26870. end: globals.length
  26871. });
  26872. }
  26873. }
  26874. chunks.push({
  26875. data: this.bytes,
  26876. start: 0,
  26877. end: this.bytes.length
  26878. });
  26879. const data = jbig2Image.parseChunks(chunks);
  26880. const dataLength = data.length;
  26881. for (let i = 0; i < dataLength; i++) {
  26882. data[i] ^= 0xff;
  26883. }
  26884. this.buffer = data;
  26885. this.bufferLength = dataLength;
  26886. this.eof = true;
  26887. }
  26888. }
  26889. exports.Jbig2Stream = Jbig2Stream;
  26890. /***/ }),
  26891. /* 35 */
  26892. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  26893. Object.defineProperty(exports, "__esModule", ({
  26894. value: true
  26895. }));
  26896. exports.Jbig2Image = void 0;
  26897. var _util = __w_pdfjs_require__(2);
  26898. var _core_utils = __w_pdfjs_require__(8);
  26899. var _arithmetic_decoder = __w_pdfjs_require__(36);
  26900. var _ccitt = __w_pdfjs_require__(32);
  26901. class Jbig2Error extends _util.BaseException {
  26902. constructor(msg) {
  26903. super(`JBIG2 error: ${msg}`, "Jbig2Error");
  26904. }
  26905. }
  26906. class ContextCache {
  26907. getContexts(id) {
  26908. if (id in this) {
  26909. return this[id];
  26910. }
  26911. return this[id] = new Int8Array(1 << 16);
  26912. }
  26913. }
  26914. class DecodingContext {
  26915. constructor(data, start, end) {
  26916. this.data = data;
  26917. this.start = start;
  26918. this.end = end;
  26919. }
  26920. get decoder() {
  26921. const decoder = new _arithmetic_decoder.ArithmeticDecoder(this.data, this.start, this.end);
  26922. return (0, _util.shadow)(this, "decoder", decoder);
  26923. }
  26924. get contextCache() {
  26925. const cache = new ContextCache();
  26926. return (0, _util.shadow)(this, "contextCache", cache);
  26927. }
  26928. }
  26929. function decodeInteger(contextCache, procedure, decoder) {
  26930. const contexts = contextCache.getContexts(procedure);
  26931. let prev = 1;
  26932. function readBits(length) {
  26933. let v = 0;
  26934. for (let i = 0; i < length; i++) {
  26935. const bit = decoder.readBit(contexts, prev);
  26936. prev = prev < 256 ? prev << 1 | bit : (prev << 1 | bit) & 511 | 256;
  26937. v = v << 1 | bit;
  26938. }
  26939. return v >>> 0;
  26940. }
  26941. const sign = readBits(1);
  26942. 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);
  26943. if (sign === 0) {
  26944. return value;
  26945. } else if (value > 0) {
  26946. return -value;
  26947. }
  26948. return null;
  26949. }
  26950. function decodeIAID(contextCache, decoder, codeLength) {
  26951. const contexts = contextCache.getContexts("IAID");
  26952. let prev = 1;
  26953. for (let i = 0; i < codeLength; i++) {
  26954. const bit = decoder.readBit(contexts, prev);
  26955. prev = prev << 1 | bit;
  26956. }
  26957. if (codeLength < 31) {
  26958. return prev & (1 << codeLength) - 1;
  26959. }
  26960. return prev & 0x7fffffff;
  26961. }
  26962. 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"];
  26963. const CodingTemplates = [[{
  26964. x: -1,
  26965. y: -2
  26966. }, {
  26967. x: 0,
  26968. y: -2
  26969. }, {
  26970. x: 1,
  26971. y: -2
  26972. }, {
  26973. x: -2,
  26974. y: -1
  26975. }, {
  26976. x: -1,
  26977. y: -1
  26978. }, {
  26979. x: 0,
  26980. y: -1
  26981. }, {
  26982. x: 1,
  26983. y: -1
  26984. }, {
  26985. x: 2,
  26986. y: -1
  26987. }, {
  26988. x: -4,
  26989. y: 0
  26990. }, {
  26991. x: -3,
  26992. y: 0
  26993. }, {
  26994. x: -2,
  26995. y: 0
  26996. }, {
  26997. x: -1,
  26998. y: 0
  26999. }], [{
  27000. x: -1,
  27001. y: -2
  27002. }, {
  27003. x: 0,
  27004. y: -2
  27005. }, {
  27006. x: 1,
  27007. y: -2
  27008. }, {
  27009. x: 2,
  27010. y: -2
  27011. }, {
  27012. x: -2,
  27013. y: -1
  27014. }, {
  27015. x: -1,
  27016. y: -1
  27017. }, {
  27018. x: 0,
  27019. y: -1
  27020. }, {
  27021. x: 1,
  27022. y: -1
  27023. }, {
  27024. x: 2,
  27025. y: -1
  27026. }, {
  27027. x: -3,
  27028. y: 0
  27029. }, {
  27030. x: -2,
  27031. y: 0
  27032. }, {
  27033. x: -1,
  27034. y: 0
  27035. }], [{
  27036. x: -1,
  27037. y: -2
  27038. }, {
  27039. x: 0,
  27040. y: -2
  27041. }, {
  27042. x: 1,
  27043. y: -2
  27044. }, {
  27045. x: -2,
  27046. y: -1
  27047. }, {
  27048. x: -1,
  27049. y: -1
  27050. }, {
  27051. x: 0,
  27052. y: -1
  27053. }, {
  27054. x: 1,
  27055. y: -1
  27056. }, {
  27057. x: -2,
  27058. y: 0
  27059. }, {
  27060. x: -1,
  27061. y: 0
  27062. }], [{
  27063. x: -3,
  27064. y: -1
  27065. }, {
  27066. x: -2,
  27067. y: -1
  27068. }, {
  27069. x: -1,
  27070. y: -1
  27071. }, {
  27072. x: 0,
  27073. y: -1
  27074. }, {
  27075. x: 1,
  27076. y: -1
  27077. }, {
  27078. x: -4,
  27079. y: 0
  27080. }, {
  27081. x: -3,
  27082. y: 0
  27083. }, {
  27084. x: -2,
  27085. y: 0
  27086. }, {
  27087. x: -1,
  27088. y: 0
  27089. }]];
  27090. const RefinementTemplates = [{
  27091. coding: [{
  27092. x: 0,
  27093. y: -1
  27094. }, {
  27095. x: 1,
  27096. y: -1
  27097. }, {
  27098. x: -1,
  27099. y: 0
  27100. }],
  27101. reference: [{
  27102. x: 0,
  27103. y: -1
  27104. }, {
  27105. x: 1,
  27106. y: -1
  27107. }, {
  27108. x: -1,
  27109. y: 0
  27110. }, {
  27111. x: 0,
  27112. y: 0
  27113. }, {
  27114. x: 1,
  27115. y: 0
  27116. }, {
  27117. x: -1,
  27118. y: 1
  27119. }, {
  27120. x: 0,
  27121. y: 1
  27122. }, {
  27123. x: 1,
  27124. y: 1
  27125. }]
  27126. }, {
  27127. coding: [{
  27128. x: -1,
  27129. y: -1
  27130. }, {
  27131. x: 0,
  27132. y: -1
  27133. }, {
  27134. x: 1,
  27135. y: -1
  27136. }, {
  27137. x: -1,
  27138. y: 0
  27139. }],
  27140. reference: [{
  27141. x: 0,
  27142. y: -1
  27143. }, {
  27144. x: -1,
  27145. y: 0
  27146. }, {
  27147. x: 0,
  27148. y: 0
  27149. }, {
  27150. x: 1,
  27151. y: 0
  27152. }, {
  27153. x: 0,
  27154. y: 1
  27155. }, {
  27156. x: 1,
  27157. y: 1
  27158. }]
  27159. }];
  27160. const ReusedContexts = [0x9b25, 0x0795, 0x00e5, 0x0195];
  27161. const RefinementReusedContexts = [0x0020, 0x0008];
  27162. function decodeBitmapTemplate0(width, height, decodingContext) {
  27163. const decoder = decodingContext.decoder;
  27164. const contexts = decodingContext.contextCache.getContexts("GB");
  27165. const bitmap = [];
  27166. let contextLabel, i, j, pixel, row, row1, row2;
  27167. const OLD_PIXEL_MASK = 0x7bf7;
  27168. for (i = 0; i < height; i++) {
  27169. row = bitmap[i] = new Uint8Array(width);
  27170. row1 = i < 1 ? row : bitmap[i - 1];
  27171. row2 = i < 2 ? row : bitmap[i - 2];
  27172. contextLabel = row2[0] << 13 | row2[1] << 12 | row2[2] << 11 | row1[0] << 7 | row1[1] << 6 | row1[2] << 5 | row1[3] << 4;
  27173. for (j = 0; j < width; j++) {
  27174. row[j] = pixel = decoder.readBit(contexts, contextLabel);
  27175. contextLabel = (contextLabel & OLD_PIXEL_MASK) << 1 | (j + 3 < width ? row2[j + 3] << 11 : 0) | (j + 4 < width ? row1[j + 4] << 4 : 0) | pixel;
  27176. }
  27177. }
  27178. return bitmap;
  27179. }
  27180. function decodeBitmap(mmr, width, height, templateIndex, prediction, skip, at, decodingContext) {
  27181. if (mmr) {
  27182. const input = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27183. return decodeMMRBitmap(input, width, height, false);
  27184. }
  27185. 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) {
  27186. return decodeBitmapTemplate0(width, height, decodingContext);
  27187. }
  27188. const useskip = !!skip;
  27189. const template = CodingTemplates[templateIndex].concat(at);
  27190. template.sort(function (a, b) {
  27191. return a.y - b.y || a.x - b.x;
  27192. });
  27193. const templateLength = template.length;
  27194. const templateX = new Int8Array(templateLength);
  27195. const templateY = new Int8Array(templateLength);
  27196. const changingTemplateEntries = [];
  27197. let reuseMask = 0,
  27198. minX = 0,
  27199. maxX = 0,
  27200. minY = 0;
  27201. let c, k;
  27202. for (k = 0; k < templateLength; k++) {
  27203. templateX[k] = template[k].x;
  27204. templateY[k] = template[k].y;
  27205. minX = Math.min(minX, template[k].x);
  27206. maxX = Math.max(maxX, template[k].x);
  27207. minY = Math.min(minY, template[k].y);
  27208. if (k < templateLength - 1 && template[k].y === template[k + 1].y && template[k].x === template[k + 1].x - 1) {
  27209. reuseMask |= 1 << templateLength - 1 - k;
  27210. } else {
  27211. changingTemplateEntries.push(k);
  27212. }
  27213. }
  27214. const changingEntriesLength = changingTemplateEntries.length;
  27215. const changingTemplateX = new Int8Array(changingEntriesLength);
  27216. const changingTemplateY = new Int8Array(changingEntriesLength);
  27217. const changingTemplateBit = new Uint16Array(changingEntriesLength);
  27218. for (c = 0; c < changingEntriesLength; c++) {
  27219. k = changingTemplateEntries[c];
  27220. changingTemplateX[c] = template[k].x;
  27221. changingTemplateY[c] = template[k].y;
  27222. changingTemplateBit[c] = 1 << templateLength - 1 - k;
  27223. }
  27224. const sbb_left = -minX;
  27225. const sbb_top = -minY;
  27226. const sbb_right = width - maxX;
  27227. const pseudoPixelContext = ReusedContexts[templateIndex];
  27228. let row = new Uint8Array(width);
  27229. const bitmap = [];
  27230. const decoder = decodingContext.decoder;
  27231. const contexts = decodingContext.contextCache.getContexts("GB");
  27232. let ltp = 0,
  27233. j,
  27234. i0,
  27235. j0,
  27236. contextLabel = 0,
  27237. bit,
  27238. shift;
  27239. for (let i = 0; i < height; i++) {
  27240. if (prediction) {
  27241. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27242. ltp ^= sltp;
  27243. if (ltp) {
  27244. bitmap.push(row);
  27245. continue;
  27246. }
  27247. }
  27248. row = new Uint8Array(row);
  27249. bitmap.push(row);
  27250. for (j = 0; j < width; j++) {
  27251. if (useskip && skip[i][j]) {
  27252. row[j] = 0;
  27253. continue;
  27254. }
  27255. if (j >= sbb_left && j < sbb_right && i >= sbb_top) {
  27256. contextLabel = contextLabel << 1 & reuseMask;
  27257. for (k = 0; k < changingEntriesLength; k++) {
  27258. i0 = i + changingTemplateY[k];
  27259. j0 = j + changingTemplateX[k];
  27260. bit = bitmap[i0][j0];
  27261. if (bit) {
  27262. bit = changingTemplateBit[k];
  27263. contextLabel |= bit;
  27264. }
  27265. }
  27266. } else {
  27267. contextLabel = 0;
  27268. shift = templateLength - 1;
  27269. for (k = 0; k < templateLength; k++, shift--) {
  27270. j0 = j + templateX[k];
  27271. if (j0 >= 0 && j0 < width) {
  27272. i0 = i + templateY[k];
  27273. if (i0 >= 0) {
  27274. bit = bitmap[i0][j0];
  27275. if (bit) {
  27276. contextLabel |= bit << shift;
  27277. }
  27278. }
  27279. }
  27280. }
  27281. }
  27282. const pixel = decoder.readBit(contexts, contextLabel);
  27283. row[j] = pixel;
  27284. }
  27285. }
  27286. return bitmap;
  27287. }
  27288. function decodeRefinement(width, height, templateIndex, referenceBitmap, offsetX, offsetY, prediction, at, decodingContext) {
  27289. let codingTemplate = RefinementTemplates[templateIndex].coding;
  27290. if (templateIndex === 0) {
  27291. codingTemplate = codingTemplate.concat([at[0]]);
  27292. }
  27293. const codingTemplateLength = codingTemplate.length;
  27294. const codingTemplateX = new Int32Array(codingTemplateLength);
  27295. const codingTemplateY = new Int32Array(codingTemplateLength);
  27296. let k;
  27297. for (k = 0; k < codingTemplateLength; k++) {
  27298. codingTemplateX[k] = codingTemplate[k].x;
  27299. codingTemplateY[k] = codingTemplate[k].y;
  27300. }
  27301. let referenceTemplate = RefinementTemplates[templateIndex].reference;
  27302. if (templateIndex === 0) {
  27303. referenceTemplate = referenceTemplate.concat([at[1]]);
  27304. }
  27305. const referenceTemplateLength = referenceTemplate.length;
  27306. const referenceTemplateX = new Int32Array(referenceTemplateLength);
  27307. const referenceTemplateY = new Int32Array(referenceTemplateLength);
  27308. for (k = 0; k < referenceTemplateLength; k++) {
  27309. referenceTemplateX[k] = referenceTemplate[k].x;
  27310. referenceTemplateY[k] = referenceTemplate[k].y;
  27311. }
  27312. const referenceWidth = referenceBitmap[0].length;
  27313. const referenceHeight = referenceBitmap.length;
  27314. const pseudoPixelContext = RefinementReusedContexts[templateIndex];
  27315. const bitmap = [];
  27316. const decoder = decodingContext.decoder;
  27317. const contexts = decodingContext.contextCache.getContexts("GR");
  27318. let ltp = 0;
  27319. for (let i = 0; i < height; i++) {
  27320. if (prediction) {
  27321. const sltp = decoder.readBit(contexts, pseudoPixelContext);
  27322. ltp ^= sltp;
  27323. if (ltp) {
  27324. throw new Jbig2Error("prediction is not supported");
  27325. }
  27326. }
  27327. const row = new Uint8Array(width);
  27328. bitmap.push(row);
  27329. for (let j = 0; j < width; j++) {
  27330. let i0, j0;
  27331. let contextLabel = 0;
  27332. for (k = 0; k < codingTemplateLength; k++) {
  27333. i0 = i + codingTemplateY[k];
  27334. j0 = j + codingTemplateX[k];
  27335. if (i0 < 0 || j0 < 0 || j0 >= width) {
  27336. contextLabel <<= 1;
  27337. } else {
  27338. contextLabel = contextLabel << 1 | bitmap[i0][j0];
  27339. }
  27340. }
  27341. for (k = 0; k < referenceTemplateLength; k++) {
  27342. i0 = i + referenceTemplateY[k] - offsetY;
  27343. j0 = j + referenceTemplateX[k] - offsetX;
  27344. if (i0 < 0 || i0 >= referenceHeight || j0 < 0 || j0 >= referenceWidth) {
  27345. contextLabel <<= 1;
  27346. } else {
  27347. contextLabel = contextLabel << 1 | referenceBitmap[i0][j0];
  27348. }
  27349. }
  27350. const pixel = decoder.readBit(contexts, contextLabel);
  27351. row[j] = pixel;
  27352. }
  27353. }
  27354. return bitmap;
  27355. }
  27356. function decodeSymbolDictionary(huffman, refinement, symbols, numberOfNewSymbols, numberOfExportedSymbols, huffmanTables, templateIndex, at, refinementTemplateIndex, refinementAt, decodingContext, huffmanInput) {
  27357. if (huffman && refinement) {
  27358. throw new Jbig2Error("symbol refinement with Huffman is not supported");
  27359. }
  27360. const newSymbols = [];
  27361. let currentHeight = 0;
  27362. let symbolCodeLength = (0, _core_utils.log2)(symbols.length + numberOfNewSymbols);
  27363. const decoder = decodingContext.decoder;
  27364. const contextCache = decodingContext.contextCache;
  27365. let tableB1, symbolWidths;
  27366. if (huffman) {
  27367. tableB1 = getStandardTable(1);
  27368. symbolWidths = [];
  27369. symbolCodeLength = Math.max(symbolCodeLength, 1);
  27370. }
  27371. while (newSymbols.length < numberOfNewSymbols) {
  27372. const deltaHeight = huffman ? huffmanTables.tableDeltaHeight.decode(huffmanInput) : decodeInteger(contextCache, "IADH", decoder);
  27373. currentHeight += deltaHeight;
  27374. let currentWidth = 0,
  27375. totalWidth = 0;
  27376. const firstSymbol = huffman ? symbolWidths.length : 0;
  27377. while (true) {
  27378. const deltaWidth = huffman ? huffmanTables.tableDeltaWidth.decode(huffmanInput) : decodeInteger(contextCache, "IADW", decoder);
  27379. if (deltaWidth === null) {
  27380. break;
  27381. }
  27382. currentWidth += deltaWidth;
  27383. totalWidth += currentWidth;
  27384. let bitmap;
  27385. if (refinement) {
  27386. const numberOfInstances = decodeInteger(contextCache, "IAAI", decoder);
  27387. if (numberOfInstances > 1) {
  27388. bitmap = decodeTextRegion(huffman, refinement, currentWidth, currentHeight, 0, numberOfInstances, 1, symbols.concat(newSymbols), symbolCodeLength, 0, 0, 1, 0, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, 0, huffmanInput);
  27389. } else {
  27390. const symbolId = decodeIAID(contextCache, decoder, symbolCodeLength);
  27391. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27392. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27393. const symbol = symbolId < symbols.length ? symbols[symbolId] : newSymbols[symbolId - symbols.length];
  27394. bitmap = decodeRefinement(currentWidth, currentHeight, refinementTemplateIndex, symbol, rdx, rdy, false, refinementAt, decodingContext);
  27395. }
  27396. newSymbols.push(bitmap);
  27397. } else if (huffman) {
  27398. symbolWidths.push(currentWidth);
  27399. } else {
  27400. bitmap = decodeBitmap(false, currentWidth, currentHeight, templateIndex, false, null, at, decodingContext);
  27401. newSymbols.push(bitmap);
  27402. }
  27403. }
  27404. if (huffman && !refinement) {
  27405. const bitmapSize = huffmanTables.tableBitmapSize.decode(huffmanInput);
  27406. huffmanInput.byteAlign();
  27407. let collectiveBitmap;
  27408. if (bitmapSize === 0) {
  27409. collectiveBitmap = readUncompressedBitmap(huffmanInput, totalWidth, currentHeight);
  27410. } else {
  27411. const originalEnd = huffmanInput.end;
  27412. const bitmapEnd = huffmanInput.position + bitmapSize;
  27413. huffmanInput.end = bitmapEnd;
  27414. collectiveBitmap = decodeMMRBitmap(huffmanInput, totalWidth, currentHeight, false);
  27415. huffmanInput.end = originalEnd;
  27416. huffmanInput.position = bitmapEnd;
  27417. }
  27418. const numberOfSymbolsDecoded = symbolWidths.length;
  27419. if (firstSymbol === numberOfSymbolsDecoded - 1) {
  27420. newSymbols.push(collectiveBitmap);
  27421. } else {
  27422. let i,
  27423. y,
  27424. xMin = 0,
  27425. xMax,
  27426. bitmapWidth,
  27427. symbolBitmap;
  27428. for (i = firstSymbol; i < numberOfSymbolsDecoded; i++) {
  27429. bitmapWidth = symbolWidths[i];
  27430. xMax = xMin + bitmapWidth;
  27431. symbolBitmap = [];
  27432. for (y = 0; y < currentHeight; y++) {
  27433. symbolBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27434. }
  27435. newSymbols.push(symbolBitmap);
  27436. xMin = xMax;
  27437. }
  27438. }
  27439. }
  27440. }
  27441. const exportedSymbols = [],
  27442. flags = [];
  27443. let currentFlag = false,
  27444. i,
  27445. ii;
  27446. const totalSymbolsLength = symbols.length + numberOfNewSymbols;
  27447. while (flags.length < totalSymbolsLength) {
  27448. let runLength = huffman ? tableB1.decode(huffmanInput) : decodeInteger(contextCache, "IAEX", decoder);
  27449. while (runLength--) {
  27450. flags.push(currentFlag);
  27451. }
  27452. currentFlag = !currentFlag;
  27453. }
  27454. for (i = 0, ii = symbols.length; i < ii; i++) {
  27455. if (flags[i]) {
  27456. exportedSymbols.push(symbols[i]);
  27457. }
  27458. }
  27459. for (let j = 0; j < numberOfNewSymbols; i++, j++) {
  27460. if (flags[i]) {
  27461. exportedSymbols.push(newSymbols[j]);
  27462. }
  27463. }
  27464. return exportedSymbols;
  27465. }
  27466. function decodeTextRegion(huffman, refinement, width, height, defaultPixelValue, numberOfSymbolInstances, stripSize, inputSymbols, symbolCodeLength, transposed, dsOffset, referenceCorner, combinationOperator, huffmanTables, refinementTemplateIndex, refinementAt, decodingContext, logStripSize, huffmanInput) {
  27467. if (huffman && refinement) {
  27468. throw new Jbig2Error("refinement with Huffman is not supported");
  27469. }
  27470. const bitmap = [];
  27471. let i, row;
  27472. for (i = 0; i < height; i++) {
  27473. row = new Uint8Array(width);
  27474. if (defaultPixelValue) {
  27475. for (let j = 0; j < width; j++) {
  27476. row[j] = defaultPixelValue;
  27477. }
  27478. }
  27479. bitmap.push(row);
  27480. }
  27481. const decoder = decodingContext.decoder;
  27482. const contextCache = decodingContext.contextCache;
  27483. let stripT = huffman ? -huffmanTables.tableDeltaT.decode(huffmanInput) : -decodeInteger(contextCache, "IADT", decoder);
  27484. let firstS = 0;
  27485. i = 0;
  27486. while (i < numberOfSymbolInstances) {
  27487. const deltaT = huffman ? huffmanTables.tableDeltaT.decode(huffmanInput) : decodeInteger(contextCache, "IADT", decoder);
  27488. stripT += deltaT;
  27489. const deltaFirstS = huffman ? huffmanTables.tableFirstS.decode(huffmanInput) : decodeInteger(contextCache, "IAFS", decoder);
  27490. firstS += deltaFirstS;
  27491. let currentS = firstS;
  27492. do {
  27493. let currentT = 0;
  27494. if (stripSize > 1) {
  27495. currentT = huffman ? huffmanInput.readBits(logStripSize) : decodeInteger(contextCache, "IAIT", decoder);
  27496. }
  27497. const t = stripSize * stripT + currentT;
  27498. const symbolId = huffman ? huffmanTables.symbolIDTable.decode(huffmanInput) : decodeIAID(contextCache, decoder, symbolCodeLength);
  27499. const applyRefinement = refinement && (huffman ? huffmanInput.readBit() : decodeInteger(contextCache, "IARI", decoder));
  27500. let symbolBitmap = inputSymbols[symbolId];
  27501. let symbolWidth = symbolBitmap[0].length;
  27502. let symbolHeight = symbolBitmap.length;
  27503. if (applyRefinement) {
  27504. const rdw = decodeInteger(contextCache, "IARDW", decoder);
  27505. const rdh = decodeInteger(contextCache, "IARDH", decoder);
  27506. const rdx = decodeInteger(contextCache, "IARDX", decoder);
  27507. const rdy = decodeInteger(contextCache, "IARDY", decoder);
  27508. symbolWidth += rdw;
  27509. symbolHeight += rdh;
  27510. symbolBitmap = decodeRefinement(symbolWidth, symbolHeight, refinementTemplateIndex, symbolBitmap, (rdw >> 1) + rdx, (rdh >> 1) + rdy, false, refinementAt, decodingContext);
  27511. }
  27512. const offsetT = t - (referenceCorner & 1 ? 0 : symbolHeight - 1);
  27513. const offsetS = currentS - (referenceCorner & 2 ? symbolWidth - 1 : 0);
  27514. let s2, t2, symbolRow;
  27515. if (transposed) {
  27516. for (s2 = 0; s2 < symbolHeight; s2++) {
  27517. row = bitmap[offsetS + s2];
  27518. if (!row) {
  27519. continue;
  27520. }
  27521. symbolRow = symbolBitmap[s2];
  27522. const maxWidth = Math.min(width - offsetT, symbolWidth);
  27523. switch (combinationOperator) {
  27524. case 0:
  27525. for (t2 = 0; t2 < maxWidth; t2++) {
  27526. row[offsetT + t2] |= symbolRow[t2];
  27527. }
  27528. break;
  27529. case 2:
  27530. for (t2 = 0; t2 < maxWidth; t2++) {
  27531. row[offsetT + t2] ^= symbolRow[t2];
  27532. }
  27533. break;
  27534. default:
  27535. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27536. }
  27537. }
  27538. currentS += symbolHeight - 1;
  27539. } else {
  27540. for (t2 = 0; t2 < symbolHeight; t2++) {
  27541. row = bitmap[offsetT + t2];
  27542. if (!row) {
  27543. continue;
  27544. }
  27545. symbolRow = symbolBitmap[t2];
  27546. switch (combinationOperator) {
  27547. case 0:
  27548. for (s2 = 0; s2 < symbolWidth; s2++) {
  27549. row[offsetS + s2] |= symbolRow[s2];
  27550. }
  27551. break;
  27552. case 2:
  27553. for (s2 = 0; s2 < symbolWidth; s2++) {
  27554. row[offsetS + s2] ^= symbolRow[s2];
  27555. }
  27556. break;
  27557. default:
  27558. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  27559. }
  27560. }
  27561. currentS += symbolWidth - 1;
  27562. }
  27563. i++;
  27564. const deltaS = huffman ? huffmanTables.tableDeltaS.decode(huffmanInput) : decodeInteger(contextCache, "IADS", decoder);
  27565. if (deltaS === null) {
  27566. break;
  27567. }
  27568. currentS += deltaS + dsOffset;
  27569. } while (true);
  27570. }
  27571. return bitmap;
  27572. }
  27573. function decodePatternDictionary(mmr, patternWidth, patternHeight, maxPatternIndex, template, decodingContext) {
  27574. const at = [];
  27575. if (!mmr) {
  27576. at.push({
  27577. x: -patternWidth,
  27578. y: 0
  27579. });
  27580. if (template === 0) {
  27581. at.push({
  27582. x: -3,
  27583. y: -1
  27584. }, {
  27585. x: 2,
  27586. y: -2
  27587. }, {
  27588. x: -2,
  27589. y: -2
  27590. });
  27591. }
  27592. }
  27593. const collectiveWidth = (maxPatternIndex + 1) * patternWidth;
  27594. const collectiveBitmap = decodeBitmap(mmr, collectiveWidth, patternHeight, template, false, null, at, decodingContext);
  27595. const patterns = [];
  27596. for (let i = 0; i <= maxPatternIndex; i++) {
  27597. const patternBitmap = [];
  27598. const xMin = patternWidth * i;
  27599. const xMax = xMin + patternWidth;
  27600. for (let y = 0; y < patternHeight; y++) {
  27601. patternBitmap.push(collectiveBitmap[y].subarray(xMin, xMax));
  27602. }
  27603. patterns.push(patternBitmap);
  27604. }
  27605. return patterns;
  27606. }
  27607. function decodeHalftoneRegion(mmr, patterns, template, regionWidth, regionHeight, defaultPixelValue, enableSkip, combinationOperator, gridWidth, gridHeight, gridOffsetX, gridOffsetY, gridVectorX, gridVectorY, decodingContext) {
  27608. const skip = null;
  27609. if (enableSkip) {
  27610. throw new Jbig2Error("skip is not supported");
  27611. }
  27612. if (combinationOperator !== 0) {
  27613. throw new Jbig2Error(`operator "${combinationOperator}" is not supported in halftone region`);
  27614. }
  27615. const regionBitmap = [];
  27616. let i, j, row;
  27617. for (i = 0; i < regionHeight; i++) {
  27618. row = new Uint8Array(regionWidth);
  27619. if (defaultPixelValue) {
  27620. for (j = 0; j < regionWidth; j++) {
  27621. row[j] = defaultPixelValue;
  27622. }
  27623. }
  27624. regionBitmap.push(row);
  27625. }
  27626. const numberOfPatterns = patterns.length;
  27627. const pattern0 = patterns[0];
  27628. const patternWidth = pattern0[0].length,
  27629. patternHeight = pattern0.length;
  27630. const bitsPerValue = (0, _core_utils.log2)(numberOfPatterns);
  27631. const at = [];
  27632. if (!mmr) {
  27633. at.push({
  27634. x: template <= 1 ? 3 : 2,
  27635. y: -1
  27636. });
  27637. if (template === 0) {
  27638. at.push({
  27639. x: -3,
  27640. y: -1
  27641. }, {
  27642. x: 2,
  27643. y: -2
  27644. }, {
  27645. x: -2,
  27646. y: -2
  27647. });
  27648. }
  27649. }
  27650. const grayScaleBitPlanes = [];
  27651. let mmrInput, bitmap;
  27652. if (mmr) {
  27653. mmrInput = new Reader(decodingContext.data, decodingContext.start, decodingContext.end);
  27654. }
  27655. for (i = bitsPerValue - 1; i >= 0; i--) {
  27656. if (mmr) {
  27657. bitmap = decodeMMRBitmap(mmrInput, gridWidth, gridHeight, true);
  27658. } else {
  27659. bitmap = decodeBitmap(false, gridWidth, gridHeight, template, false, skip, at, decodingContext);
  27660. }
  27661. grayScaleBitPlanes[i] = bitmap;
  27662. }
  27663. let mg, ng, bit, patternIndex, patternBitmap, x, y, patternRow, regionRow;
  27664. for (mg = 0; mg < gridHeight; mg++) {
  27665. for (ng = 0; ng < gridWidth; ng++) {
  27666. bit = 0;
  27667. patternIndex = 0;
  27668. for (j = bitsPerValue - 1; j >= 0; j--) {
  27669. bit ^= grayScaleBitPlanes[j][mg][ng];
  27670. patternIndex |= bit << j;
  27671. }
  27672. patternBitmap = patterns[patternIndex];
  27673. x = gridOffsetX + mg * gridVectorY + ng * gridVectorX >> 8;
  27674. y = gridOffsetY + mg * gridVectorX - ng * gridVectorY >> 8;
  27675. if (x >= 0 && x + patternWidth <= regionWidth && y >= 0 && y + patternHeight <= regionHeight) {
  27676. for (i = 0; i < patternHeight; i++) {
  27677. regionRow = regionBitmap[y + i];
  27678. patternRow = patternBitmap[i];
  27679. for (j = 0; j < patternWidth; j++) {
  27680. regionRow[x + j] |= patternRow[j];
  27681. }
  27682. }
  27683. } else {
  27684. let regionX, regionY;
  27685. for (i = 0; i < patternHeight; i++) {
  27686. regionY = y + i;
  27687. if (regionY < 0 || regionY >= regionHeight) {
  27688. continue;
  27689. }
  27690. regionRow = regionBitmap[regionY];
  27691. patternRow = patternBitmap[i];
  27692. for (j = 0; j < patternWidth; j++) {
  27693. regionX = x + j;
  27694. if (regionX >= 0 && regionX < regionWidth) {
  27695. regionRow[regionX] |= patternRow[j];
  27696. }
  27697. }
  27698. }
  27699. }
  27700. }
  27701. }
  27702. return regionBitmap;
  27703. }
  27704. function readSegmentHeader(data, start) {
  27705. const segmentHeader = {};
  27706. segmentHeader.number = (0, _core_utils.readUint32)(data, start);
  27707. const flags = data[start + 4];
  27708. const segmentType = flags & 0x3f;
  27709. if (!SegmentTypes[segmentType]) {
  27710. throw new Jbig2Error("invalid segment type: " + segmentType);
  27711. }
  27712. segmentHeader.type = segmentType;
  27713. segmentHeader.typeName = SegmentTypes[segmentType];
  27714. segmentHeader.deferredNonRetain = !!(flags & 0x80);
  27715. const pageAssociationFieldSize = !!(flags & 0x40);
  27716. const referredFlags = data[start + 5];
  27717. let referredToCount = referredFlags >> 5 & 7;
  27718. const retainBits = [referredFlags & 31];
  27719. let position = start + 6;
  27720. if (referredFlags === 7) {
  27721. referredToCount = (0, _core_utils.readUint32)(data, position - 1) & 0x1fffffff;
  27722. position += 3;
  27723. let bytes = referredToCount + 7 >> 3;
  27724. retainBits[0] = data[position++];
  27725. while (--bytes > 0) {
  27726. retainBits.push(data[position++]);
  27727. }
  27728. } else if (referredFlags === 5 || referredFlags === 6) {
  27729. throw new Jbig2Error("invalid referred-to flags");
  27730. }
  27731. segmentHeader.retainBits = retainBits;
  27732. let referredToSegmentNumberSize = 4;
  27733. if (segmentHeader.number <= 256) {
  27734. referredToSegmentNumberSize = 1;
  27735. } else if (segmentHeader.number <= 65536) {
  27736. referredToSegmentNumberSize = 2;
  27737. }
  27738. const referredTo = [];
  27739. let i, ii;
  27740. for (i = 0; i < referredToCount; i++) {
  27741. let number;
  27742. if (referredToSegmentNumberSize === 1) {
  27743. number = data[position];
  27744. } else if (referredToSegmentNumberSize === 2) {
  27745. number = (0, _core_utils.readUint16)(data, position);
  27746. } else {
  27747. number = (0, _core_utils.readUint32)(data, position);
  27748. }
  27749. referredTo.push(number);
  27750. position += referredToSegmentNumberSize;
  27751. }
  27752. segmentHeader.referredTo = referredTo;
  27753. if (!pageAssociationFieldSize) {
  27754. segmentHeader.pageAssociation = data[position++];
  27755. } else {
  27756. segmentHeader.pageAssociation = (0, _core_utils.readUint32)(data, position);
  27757. position += 4;
  27758. }
  27759. segmentHeader.length = (0, _core_utils.readUint32)(data, position);
  27760. position += 4;
  27761. if (segmentHeader.length === 0xffffffff) {
  27762. if (segmentType === 38) {
  27763. const genericRegionInfo = readRegionSegmentInformation(data, position);
  27764. const genericRegionSegmentFlags = data[position + RegionSegmentInformationFieldLength];
  27765. const genericRegionMmr = !!(genericRegionSegmentFlags & 1);
  27766. const searchPatternLength = 6;
  27767. const searchPattern = new Uint8Array(searchPatternLength);
  27768. if (!genericRegionMmr) {
  27769. searchPattern[0] = 0xff;
  27770. searchPattern[1] = 0xac;
  27771. }
  27772. searchPattern[2] = genericRegionInfo.height >>> 24 & 0xff;
  27773. searchPattern[3] = genericRegionInfo.height >> 16 & 0xff;
  27774. searchPattern[4] = genericRegionInfo.height >> 8 & 0xff;
  27775. searchPattern[5] = genericRegionInfo.height & 0xff;
  27776. for (i = position, ii = data.length; i < ii; i++) {
  27777. let j = 0;
  27778. while (j < searchPatternLength && searchPattern[j] === data[i + j]) {
  27779. j++;
  27780. }
  27781. if (j === searchPatternLength) {
  27782. segmentHeader.length = i + searchPatternLength;
  27783. break;
  27784. }
  27785. }
  27786. if (segmentHeader.length === 0xffffffff) {
  27787. throw new Jbig2Error("segment end was not found");
  27788. }
  27789. } else {
  27790. throw new Jbig2Error("invalid unknown segment length");
  27791. }
  27792. }
  27793. segmentHeader.headerEnd = position;
  27794. return segmentHeader;
  27795. }
  27796. function readSegments(header, data, start, end) {
  27797. const segments = [];
  27798. let position = start;
  27799. while (position < end) {
  27800. const segmentHeader = readSegmentHeader(data, position);
  27801. position = segmentHeader.headerEnd;
  27802. const segment = {
  27803. header: segmentHeader,
  27804. data
  27805. };
  27806. if (!header.randomAccess) {
  27807. segment.start = position;
  27808. position += segmentHeader.length;
  27809. segment.end = position;
  27810. }
  27811. segments.push(segment);
  27812. if (segmentHeader.type === 51) {
  27813. break;
  27814. }
  27815. }
  27816. if (header.randomAccess) {
  27817. for (let i = 0, ii = segments.length; i < ii; i++) {
  27818. segments[i].start = position;
  27819. position += segments[i].header.length;
  27820. segments[i].end = position;
  27821. }
  27822. }
  27823. return segments;
  27824. }
  27825. function readRegionSegmentInformation(data, start) {
  27826. return {
  27827. width: (0, _core_utils.readUint32)(data, start),
  27828. height: (0, _core_utils.readUint32)(data, start + 4),
  27829. x: (0, _core_utils.readUint32)(data, start + 8),
  27830. y: (0, _core_utils.readUint32)(data, start + 12),
  27831. combinationOperator: data[start + 16] & 7
  27832. };
  27833. }
  27834. const RegionSegmentInformationFieldLength = 17;
  27835. function processSegment(segment, visitor) {
  27836. const header = segment.header;
  27837. const data = segment.data,
  27838. end = segment.end;
  27839. let position = segment.start;
  27840. let args, at, i, atLength;
  27841. switch (header.type) {
  27842. case 0:
  27843. const dictionary = {};
  27844. const dictionaryFlags = (0, _core_utils.readUint16)(data, position);
  27845. dictionary.huffman = !!(dictionaryFlags & 1);
  27846. dictionary.refinement = !!(dictionaryFlags & 2);
  27847. dictionary.huffmanDHSelector = dictionaryFlags >> 2 & 3;
  27848. dictionary.huffmanDWSelector = dictionaryFlags >> 4 & 3;
  27849. dictionary.bitmapSizeSelector = dictionaryFlags >> 6 & 1;
  27850. dictionary.aggregationInstancesSelector = dictionaryFlags >> 7 & 1;
  27851. dictionary.bitmapCodingContextUsed = !!(dictionaryFlags & 256);
  27852. dictionary.bitmapCodingContextRetained = !!(dictionaryFlags & 512);
  27853. dictionary.template = dictionaryFlags >> 10 & 3;
  27854. dictionary.refinementTemplate = dictionaryFlags >> 12 & 1;
  27855. position += 2;
  27856. if (!dictionary.huffman) {
  27857. atLength = dictionary.template === 0 ? 4 : 1;
  27858. at = [];
  27859. for (i = 0; i < atLength; i++) {
  27860. at.push({
  27861. x: (0, _core_utils.readInt8)(data, position),
  27862. y: (0, _core_utils.readInt8)(data, position + 1)
  27863. });
  27864. position += 2;
  27865. }
  27866. dictionary.at = at;
  27867. }
  27868. if (dictionary.refinement && !dictionary.refinementTemplate) {
  27869. at = [];
  27870. for (i = 0; i < 2; i++) {
  27871. at.push({
  27872. x: (0, _core_utils.readInt8)(data, position),
  27873. y: (0, _core_utils.readInt8)(data, position + 1)
  27874. });
  27875. position += 2;
  27876. }
  27877. dictionary.refinementAt = at;
  27878. }
  27879. dictionary.numberOfExportedSymbols = (0, _core_utils.readUint32)(data, position);
  27880. position += 4;
  27881. dictionary.numberOfNewSymbols = (0, _core_utils.readUint32)(data, position);
  27882. position += 4;
  27883. args = [dictionary, header.number, header.referredTo, data, position, end];
  27884. break;
  27885. case 6:
  27886. case 7:
  27887. const textRegion = {};
  27888. textRegion.info = readRegionSegmentInformation(data, position);
  27889. position += RegionSegmentInformationFieldLength;
  27890. const textRegionSegmentFlags = (0, _core_utils.readUint16)(data, position);
  27891. position += 2;
  27892. textRegion.huffman = !!(textRegionSegmentFlags & 1);
  27893. textRegion.refinement = !!(textRegionSegmentFlags & 2);
  27894. textRegion.logStripSize = textRegionSegmentFlags >> 2 & 3;
  27895. textRegion.stripSize = 1 << textRegion.logStripSize;
  27896. textRegion.referenceCorner = textRegionSegmentFlags >> 4 & 3;
  27897. textRegion.transposed = !!(textRegionSegmentFlags & 64);
  27898. textRegion.combinationOperator = textRegionSegmentFlags >> 7 & 3;
  27899. textRegion.defaultPixelValue = textRegionSegmentFlags >> 9 & 1;
  27900. textRegion.dsOffset = textRegionSegmentFlags << 17 >> 27;
  27901. textRegion.refinementTemplate = textRegionSegmentFlags >> 15 & 1;
  27902. if (textRegion.huffman) {
  27903. const textRegionHuffmanFlags = (0, _core_utils.readUint16)(data, position);
  27904. position += 2;
  27905. textRegion.huffmanFS = textRegionHuffmanFlags & 3;
  27906. textRegion.huffmanDS = textRegionHuffmanFlags >> 2 & 3;
  27907. textRegion.huffmanDT = textRegionHuffmanFlags >> 4 & 3;
  27908. textRegion.huffmanRefinementDW = textRegionHuffmanFlags >> 6 & 3;
  27909. textRegion.huffmanRefinementDH = textRegionHuffmanFlags >> 8 & 3;
  27910. textRegion.huffmanRefinementDX = textRegionHuffmanFlags >> 10 & 3;
  27911. textRegion.huffmanRefinementDY = textRegionHuffmanFlags >> 12 & 3;
  27912. textRegion.huffmanRefinementSizeSelector = !!(textRegionHuffmanFlags & 0x4000);
  27913. }
  27914. if (textRegion.refinement && !textRegion.refinementTemplate) {
  27915. at = [];
  27916. for (i = 0; i < 2; i++) {
  27917. at.push({
  27918. x: (0, _core_utils.readInt8)(data, position),
  27919. y: (0, _core_utils.readInt8)(data, position + 1)
  27920. });
  27921. position += 2;
  27922. }
  27923. textRegion.refinementAt = at;
  27924. }
  27925. textRegion.numberOfSymbolInstances = (0, _core_utils.readUint32)(data, position);
  27926. position += 4;
  27927. args = [textRegion, header.referredTo, data, position, end];
  27928. break;
  27929. case 16:
  27930. const patternDictionary = {};
  27931. const patternDictionaryFlags = data[position++];
  27932. patternDictionary.mmr = !!(patternDictionaryFlags & 1);
  27933. patternDictionary.template = patternDictionaryFlags >> 1 & 3;
  27934. patternDictionary.patternWidth = data[position++];
  27935. patternDictionary.patternHeight = data[position++];
  27936. patternDictionary.maxPatternIndex = (0, _core_utils.readUint32)(data, position);
  27937. position += 4;
  27938. args = [patternDictionary, header.number, data, position, end];
  27939. break;
  27940. case 22:
  27941. case 23:
  27942. const halftoneRegion = {};
  27943. halftoneRegion.info = readRegionSegmentInformation(data, position);
  27944. position += RegionSegmentInformationFieldLength;
  27945. const halftoneRegionFlags = data[position++];
  27946. halftoneRegion.mmr = !!(halftoneRegionFlags & 1);
  27947. halftoneRegion.template = halftoneRegionFlags >> 1 & 3;
  27948. halftoneRegion.enableSkip = !!(halftoneRegionFlags & 8);
  27949. halftoneRegion.combinationOperator = halftoneRegionFlags >> 4 & 7;
  27950. halftoneRegion.defaultPixelValue = halftoneRegionFlags >> 7 & 1;
  27951. halftoneRegion.gridWidth = (0, _core_utils.readUint32)(data, position);
  27952. position += 4;
  27953. halftoneRegion.gridHeight = (0, _core_utils.readUint32)(data, position);
  27954. position += 4;
  27955. halftoneRegion.gridOffsetX = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27956. position += 4;
  27957. halftoneRegion.gridOffsetY = (0, _core_utils.readUint32)(data, position) & 0xffffffff;
  27958. position += 4;
  27959. halftoneRegion.gridVectorX = (0, _core_utils.readUint16)(data, position);
  27960. position += 2;
  27961. halftoneRegion.gridVectorY = (0, _core_utils.readUint16)(data, position);
  27962. position += 2;
  27963. args = [halftoneRegion, header.referredTo, data, position, end];
  27964. break;
  27965. case 38:
  27966. case 39:
  27967. const genericRegion = {};
  27968. genericRegion.info = readRegionSegmentInformation(data, position);
  27969. position += RegionSegmentInformationFieldLength;
  27970. const genericRegionSegmentFlags = data[position++];
  27971. genericRegion.mmr = !!(genericRegionSegmentFlags & 1);
  27972. genericRegion.template = genericRegionSegmentFlags >> 1 & 3;
  27973. genericRegion.prediction = !!(genericRegionSegmentFlags & 8);
  27974. if (!genericRegion.mmr) {
  27975. atLength = genericRegion.template === 0 ? 4 : 1;
  27976. at = [];
  27977. for (i = 0; i < atLength; i++) {
  27978. at.push({
  27979. x: (0, _core_utils.readInt8)(data, position),
  27980. y: (0, _core_utils.readInt8)(data, position + 1)
  27981. });
  27982. position += 2;
  27983. }
  27984. genericRegion.at = at;
  27985. }
  27986. args = [genericRegion, data, position, end];
  27987. break;
  27988. case 48:
  27989. const pageInfo = {
  27990. width: (0, _core_utils.readUint32)(data, position),
  27991. height: (0, _core_utils.readUint32)(data, position + 4),
  27992. resolutionX: (0, _core_utils.readUint32)(data, position + 8),
  27993. resolutionY: (0, _core_utils.readUint32)(data, position + 12)
  27994. };
  27995. if (pageInfo.height === 0xffffffff) {
  27996. delete pageInfo.height;
  27997. }
  27998. const pageSegmentFlags = data[position + 16];
  27999. (0, _core_utils.readUint16)(data, position + 17);
  28000. pageInfo.lossless = !!(pageSegmentFlags & 1);
  28001. pageInfo.refinement = !!(pageSegmentFlags & 2);
  28002. pageInfo.defaultPixelValue = pageSegmentFlags >> 2 & 1;
  28003. pageInfo.combinationOperator = pageSegmentFlags >> 3 & 3;
  28004. pageInfo.requiresBuffer = !!(pageSegmentFlags & 32);
  28005. pageInfo.combinationOperatorOverride = !!(pageSegmentFlags & 64);
  28006. args = [pageInfo];
  28007. break;
  28008. case 49:
  28009. break;
  28010. case 50:
  28011. break;
  28012. case 51:
  28013. break;
  28014. case 53:
  28015. args = [header.number, data, position, end];
  28016. break;
  28017. case 62:
  28018. break;
  28019. default:
  28020. throw new Jbig2Error(`segment type ${header.typeName}(${header.type})` + " is not implemented");
  28021. }
  28022. const callbackName = "on" + header.typeName;
  28023. if (callbackName in visitor) {
  28024. visitor[callbackName].apply(visitor, args);
  28025. }
  28026. }
  28027. function processSegments(segments, visitor) {
  28028. for (let i = 0, ii = segments.length; i < ii; i++) {
  28029. processSegment(segments[i], visitor);
  28030. }
  28031. }
  28032. function parseJbig2Chunks(chunks) {
  28033. const visitor = new SimpleSegmentVisitor();
  28034. for (let i = 0, ii = chunks.length; i < ii; i++) {
  28035. const chunk = chunks[i];
  28036. const segments = readSegments({}, chunk.data, chunk.start, chunk.end);
  28037. processSegments(segments, visitor);
  28038. }
  28039. return visitor.buffer;
  28040. }
  28041. function parseJbig2(data) {
  28042. const end = data.length;
  28043. let position = 0;
  28044. if (data[position] !== 0x97 || data[position + 1] !== 0x4a || data[position + 2] !== 0x42 || data[position + 3] !== 0x32 || data[position + 4] !== 0x0d || data[position + 5] !== 0x0a || data[position + 6] !== 0x1a || data[position + 7] !== 0x0a) {
  28045. throw new Jbig2Error("parseJbig2 - invalid header.");
  28046. }
  28047. const header = Object.create(null);
  28048. position += 8;
  28049. const flags = data[position++];
  28050. header.randomAccess = !(flags & 1);
  28051. if (!(flags & 2)) {
  28052. header.numberOfPages = (0, _core_utils.readUint32)(data, position);
  28053. position += 4;
  28054. }
  28055. const segments = readSegments(header, data, position, end);
  28056. const visitor = new SimpleSegmentVisitor();
  28057. processSegments(segments, visitor);
  28058. const {
  28059. width,
  28060. height
  28061. } = visitor.currentPageInfo;
  28062. const bitPacked = visitor.buffer;
  28063. const imgData = new Uint8ClampedArray(width * height);
  28064. let q = 0,
  28065. k = 0;
  28066. for (let i = 0; i < height; i++) {
  28067. let mask = 0,
  28068. buffer;
  28069. for (let j = 0; j < width; j++) {
  28070. if (!mask) {
  28071. mask = 128;
  28072. buffer = bitPacked[k++];
  28073. }
  28074. imgData[q++] = buffer & mask ? 0 : 255;
  28075. mask >>= 1;
  28076. }
  28077. }
  28078. return {
  28079. imgData,
  28080. width,
  28081. height
  28082. };
  28083. }
  28084. class SimpleSegmentVisitor {
  28085. onPageInformation(info) {
  28086. this.currentPageInfo = info;
  28087. const rowSize = info.width + 7 >> 3;
  28088. const buffer = new Uint8ClampedArray(rowSize * info.height);
  28089. if (info.defaultPixelValue) {
  28090. buffer.fill(0xff);
  28091. }
  28092. this.buffer = buffer;
  28093. }
  28094. drawBitmap(regionInfo, bitmap) {
  28095. const pageInfo = this.currentPageInfo;
  28096. const width = regionInfo.width,
  28097. height = regionInfo.height;
  28098. const rowSize = pageInfo.width + 7 >> 3;
  28099. const combinationOperator = pageInfo.combinationOperatorOverride ? regionInfo.combinationOperator : pageInfo.combinationOperator;
  28100. const buffer = this.buffer;
  28101. const mask0 = 128 >> (regionInfo.x & 7);
  28102. let offset0 = regionInfo.y * rowSize + (regionInfo.x >> 3);
  28103. let i, j, mask, offset;
  28104. switch (combinationOperator) {
  28105. case 0:
  28106. for (i = 0; i < height; i++) {
  28107. mask = mask0;
  28108. offset = offset0;
  28109. for (j = 0; j < width; j++) {
  28110. if (bitmap[i][j]) {
  28111. buffer[offset] |= mask;
  28112. }
  28113. mask >>= 1;
  28114. if (!mask) {
  28115. mask = 128;
  28116. offset++;
  28117. }
  28118. }
  28119. offset0 += rowSize;
  28120. }
  28121. break;
  28122. case 2:
  28123. for (i = 0; i < height; i++) {
  28124. mask = mask0;
  28125. offset = offset0;
  28126. for (j = 0; j < width; j++) {
  28127. if (bitmap[i][j]) {
  28128. buffer[offset] ^= mask;
  28129. }
  28130. mask >>= 1;
  28131. if (!mask) {
  28132. mask = 128;
  28133. offset++;
  28134. }
  28135. }
  28136. offset0 += rowSize;
  28137. }
  28138. break;
  28139. default:
  28140. throw new Jbig2Error(`operator ${combinationOperator} is not supported`);
  28141. }
  28142. }
  28143. onImmediateGenericRegion(region, data, start, end) {
  28144. const regionInfo = region.info;
  28145. const decodingContext = new DecodingContext(data, start, end);
  28146. const bitmap = decodeBitmap(region.mmr, regionInfo.width, regionInfo.height, region.template, region.prediction, null, region.at, decodingContext);
  28147. this.drawBitmap(regionInfo, bitmap);
  28148. }
  28149. onImmediateLosslessGenericRegion() {
  28150. this.onImmediateGenericRegion.apply(this, arguments);
  28151. }
  28152. onSymbolDictionary(dictionary, currentSegment, referredSegments, data, start, end) {
  28153. let huffmanTables, huffmanInput;
  28154. if (dictionary.huffman) {
  28155. huffmanTables = getSymbolDictionaryHuffmanTables(dictionary, referredSegments, this.customTables);
  28156. huffmanInput = new Reader(data, start, end);
  28157. }
  28158. let symbols = this.symbols;
  28159. if (!symbols) {
  28160. this.symbols = symbols = {};
  28161. }
  28162. let inputSymbols = [];
  28163. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  28164. const referredSymbols = symbols[referredSegments[i]];
  28165. if (referredSymbols) {
  28166. inputSymbols = inputSymbols.concat(referredSymbols);
  28167. }
  28168. }
  28169. const decodingContext = new DecodingContext(data, start, end);
  28170. symbols[currentSegment] = decodeSymbolDictionary(dictionary.huffman, dictionary.refinement, inputSymbols, dictionary.numberOfNewSymbols, dictionary.numberOfExportedSymbols, huffmanTables, dictionary.template, dictionary.at, dictionary.refinementTemplate, dictionary.refinementAt, decodingContext, huffmanInput);
  28171. }
  28172. onImmediateTextRegion(region, referredSegments, data, start, end) {
  28173. const regionInfo = region.info;
  28174. let huffmanTables, huffmanInput;
  28175. const symbols = this.symbols;
  28176. let inputSymbols = [];
  28177. for (let i = 0, ii = referredSegments.length; i < ii; i++) {
  28178. const referredSymbols = symbols[referredSegments[i]];
  28179. if (referredSymbols) {
  28180. inputSymbols = inputSymbols.concat(referredSymbols);
  28181. }
  28182. }
  28183. const symbolCodeLength = (0, _core_utils.log2)(inputSymbols.length);
  28184. if (region.huffman) {
  28185. huffmanInput = new Reader(data, start, end);
  28186. huffmanTables = getTextRegionHuffmanTables(region, referredSegments, this.customTables, inputSymbols.length, huffmanInput);
  28187. }
  28188. const decodingContext = new DecodingContext(data, start, end);
  28189. 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);
  28190. this.drawBitmap(regionInfo, bitmap);
  28191. }
  28192. onImmediateLosslessTextRegion() {
  28193. this.onImmediateTextRegion.apply(this, arguments);
  28194. }
  28195. onPatternDictionary(dictionary, currentSegment, data, start, end) {
  28196. let patterns = this.patterns;
  28197. if (!patterns) {
  28198. this.patterns = patterns = {};
  28199. }
  28200. const decodingContext = new DecodingContext(data, start, end);
  28201. patterns[currentSegment] = decodePatternDictionary(dictionary.mmr, dictionary.patternWidth, dictionary.patternHeight, dictionary.maxPatternIndex, dictionary.template, decodingContext);
  28202. }
  28203. onImmediateHalftoneRegion(region, referredSegments, data, start, end) {
  28204. const patterns = this.patterns[referredSegments[0]];
  28205. const regionInfo = region.info;
  28206. const decodingContext = new DecodingContext(data, start, end);
  28207. 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);
  28208. this.drawBitmap(regionInfo, bitmap);
  28209. }
  28210. onImmediateLosslessHalftoneRegion() {
  28211. this.onImmediateHalftoneRegion.apply(this, arguments);
  28212. }
  28213. onTables(currentSegment, data, start, end) {
  28214. let customTables = this.customTables;
  28215. if (!customTables) {
  28216. this.customTables = customTables = {};
  28217. }
  28218. customTables[currentSegment] = decodeTablesSegment(data, start, end);
  28219. }
  28220. }
  28221. class HuffmanLine {
  28222. constructor(lineData) {
  28223. if (lineData.length === 2) {
  28224. this.isOOB = true;
  28225. this.rangeLow = 0;
  28226. this.prefixLength = lineData[0];
  28227. this.rangeLength = 0;
  28228. this.prefixCode = lineData[1];
  28229. this.isLowerRange = false;
  28230. } else {
  28231. this.isOOB = false;
  28232. this.rangeLow = lineData[0];
  28233. this.prefixLength = lineData[1];
  28234. this.rangeLength = lineData[2];
  28235. this.prefixCode = lineData[3];
  28236. this.isLowerRange = lineData[4] === "lower";
  28237. }
  28238. }
  28239. }
  28240. class HuffmanTreeNode {
  28241. constructor(line) {
  28242. this.children = [];
  28243. if (line) {
  28244. this.isLeaf = true;
  28245. this.rangeLength = line.rangeLength;
  28246. this.rangeLow = line.rangeLow;
  28247. this.isLowerRange = line.isLowerRange;
  28248. this.isOOB = line.isOOB;
  28249. } else {
  28250. this.isLeaf = false;
  28251. }
  28252. }
  28253. buildTree(line, shift) {
  28254. const bit = line.prefixCode >> shift & 1;
  28255. if (shift <= 0) {
  28256. this.children[bit] = new HuffmanTreeNode(line);
  28257. } else {
  28258. let node = this.children[bit];
  28259. if (!node) {
  28260. this.children[bit] = node = new HuffmanTreeNode(null);
  28261. }
  28262. node.buildTree(line, shift - 1);
  28263. }
  28264. }
  28265. decodeNode(reader) {
  28266. if (this.isLeaf) {
  28267. if (this.isOOB) {
  28268. return null;
  28269. }
  28270. const htOffset = reader.readBits(this.rangeLength);
  28271. return this.rangeLow + (this.isLowerRange ? -htOffset : htOffset);
  28272. }
  28273. const node = this.children[reader.readBit()];
  28274. if (!node) {
  28275. throw new Jbig2Error("invalid Huffman data");
  28276. }
  28277. return node.decodeNode(reader);
  28278. }
  28279. }
  28280. class HuffmanTable {
  28281. constructor(lines, prefixCodesDone) {
  28282. if (!prefixCodesDone) {
  28283. this.assignPrefixCodes(lines);
  28284. }
  28285. this.rootNode = new HuffmanTreeNode(null);
  28286. for (let i = 0, ii = lines.length; i < ii; i++) {
  28287. const line = lines[i];
  28288. if (line.prefixLength > 0) {
  28289. this.rootNode.buildTree(line, line.prefixLength - 1);
  28290. }
  28291. }
  28292. }
  28293. decode(reader) {
  28294. return this.rootNode.decodeNode(reader);
  28295. }
  28296. assignPrefixCodes(lines) {
  28297. const linesLength = lines.length;
  28298. let prefixLengthMax = 0;
  28299. for (let i = 0; i < linesLength; i++) {
  28300. prefixLengthMax = Math.max(prefixLengthMax, lines[i].prefixLength);
  28301. }
  28302. const histogram = new Uint32Array(prefixLengthMax + 1);
  28303. for (let i = 0; i < linesLength; i++) {
  28304. histogram[lines[i].prefixLength]++;
  28305. }
  28306. let currentLength = 1,
  28307. firstCode = 0,
  28308. currentCode,
  28309. currentTemp,
  28310. line;
  28311. histogram[0] = 0;
  28312. while (currentLength <= prefixLengthMax) {
  28313. firstCode = firstCode + histogram[currentLength - 1] << 1;
  28314. currentCode = firstCode;
  28315. currentTemp = 0;
  28316. while (currentTemp < linesLength) {
  28317. line = lines[currentTemp];
  28318. if (line.prefixLength === currentLength) {
  28319. line.prefixCode = currentCode;
  28320. currentCode++;
  28321. }
  28322. currentTemp++;
  28323. }
  28324. currentLength++;
  28325. }
  28326. }
  28327. }
  28328. function decodeTablesSegment(data, start, end) {
  28329. const flags = data[start];
  28330. const lowestValue = (0, _core_utils.readUint32)(data, start + 1) & 0xffffffff;
  28331. const highestValue = (0, _core_utils.readUint32)(data, start + 5) & 0xffffffff;
  28332. const reader = new Reader(data, start + 9, end);
  28333. const prefixSizeBits = (flags >> 1 & 7) + 1;
  28334. const rangeSizeBits = (flags >> 4 & 7) + 1;
  28335. const lines = [];
  28336. let prefixLength,
  28337. rangeLength,
  28338. currentRangeLow = lowestValue;
  28339. do {
  28340. prefixLength = reader.readBits(prefixSizeBits);
  28341. rangeLength = reader.readBits(rangeSizeBits);
  28342. lines.push(new HuffmanLine([currentRangeLow, prefixLength, rangeLength, 0]));
  28343. currentRangeLow += 1 << rangeLength;
  28344. } while (currentRangeLow < highestValue);
  28345. prefixLength = reader.readBits(prefixSizeBits);
  28346. lines.push(new HuffmanLine([lowestValue - 1, prefixLength, 32, 0, "lower"]));
  28347. prefixLength = reader.readBits(prefixSizeBits);
  28348. lines.push(new HuffmanLine([highestValue, prefixLength, 32, 0]));
  28349. if (flags & 1) {
  28350. prefixLength = reader.readBits(prefixSizeBits);
  28351. lines.push(new HuffmanLine([prefixLength, 0]));
  28352. }
  28353. return new HuffmanTable(lines, false);
  28354. }
  28355. const standardTablesCache = {};
  28356. function getStandardTable(number) {
  28357. let table = standardTablesCache[number];
  28358. if (table) {
  28359. return table;
  28360. }
  28361. let lines;
  28362. switch (number) {
  28363. case 1:
  28364. lines = [[0, 1, 4, 0x0], [16, 2, 8, 0x2], [272, 3, 16, 0x6], [65808, 3, 32, 0x7]];
  28365. break;
  28366. case 2:
  28367. 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]];
  28368. break;
  28369. case 3:
  28370. 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]];
  28371. break;
  28372. case 4:
  28373. 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]];
  28374. break;
  28375. case 5:
  28376. 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]];
  28377. break;
  28378. case 6:
  28379. 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]];
  28380. break;
  28381. case 7:
  28382. 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]];
  28383. break;
  28384. case 8:
  28385. 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]];
  28386. break;
  28387. case 9:
  28388. 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]];
  28389. break;
  28390. case 10:
  28391. 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]];
  28392. break;
  28393. case 11:
  28394. 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]];
  28395. break;
  28396. case 12:
  28397. 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]];
  28398. break;
  28399. case 13:
  28400. 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]];
  28401. break;
  28402. case 14:
  28403. lines = [[-2, 3, 0, 0x4], [-1, 3, 0, 0x5], [0, 1, 0, 0x0], [1, 3, 0, 0x6], [2, 3, 0, 0x7]];
  28404. break;
  28405. case 15:
  28406. 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]];
  28407. break;
  28408. default:
  28409. throw new Jbig2Error(`standard table B.${number} does not exist`);
  28410. }
  28411. for (let i = 0, ii = lines.length; i < ii; i++) {
  28412. lines[i] = new HuffmanLine(lines[i]);
  28413. }
  28414. table = new HuffmanTable(lines, true);
  28415. standardTablesCache[number] = table;
  28416. return table;
  28417. }
  28418. class Reader {
  28419. constructor(data, start, end) {
  28420. this.data = data;
  28421. this.start = start;
  28422. this.end = end;
  28423. this.position = start;
  28424. this.shift = -1;
  28425. this.currentByte = 0;
  28426. }
  28427. readBit() {
  28428. if (this.shift < 0) {
  28429. if (this.position >= this.end) {
  28430. throw new Jbig2Error("end of data while reading bit");
  28431. }
  28432. this.currentByte = this.data[this.position++];
  28433. this.shift = 7;
  28434. }
  28435. const bit = this.currentByte >> this.shift & 1;
  28436. this.shift--;
  28437. return bit;
  28438. }
  28439. readBits(numBits) {
  28440. let result = 0,
  28441. i;
  28442. for (i = numBits - 1; i >= 0; i--) {
  28443. result |= this.readBit() << i;
  28444. }
  28445. return result;
  28446. }
  28447. byteAlign() {
  28448. this.shift = -1;
  28449. }
  28450. next() {
  28451. if (this.position >= this.end) {
  28452. return -1;
  28453. }
  28454. return this.data[this.position++];
  28455. }
  28456. }
  28457. function getCustomHuffmanTable(index, referredTo, customTables) {
  28458. let currentIndex = 0;
  28459. for (let i = 0, ii = referredTo.length; i < ii; i++) {
  28460. const table = customTables[referredTo[i]];
  28461. if (table) {
  28462. if (index === currentIndex) {
  28463. return table;
  28464. }
  28465. currentIndex++;
  28466. }
  28467. }
  28468. throw new Jbig2Error("can't find custom Huffman table");
  28469. }
  28470. function getTextRegionHuffmanTables(textRegion, referredTo, customTables, numberOfSymbols, reader) {
  28471. const codes = [];
  28472. for (let i = 0; i <= 34; i++) {
  28473. const codeLength = reader.readBits(4);
  28474. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28475. }
  28476. const runCodesTable = new HuffmanTable(codes, false);
  28477. codes.length = 0;
  28478. for (let i = 0; i < numberOfSymbols;) {
  28479. const codeLength = runCodesTable.decode(reader);
  28480. if (codeLength >= 32) {
  28481. let repeatedLength, numberOfRepeats, j;
  28482. switch (codeLength) {
  28483. case 32:
  28484. if (i === 0) {
  28485. throw new Jbig2Error("no previous value in symbol ID table");
  28486. }
  28487. numberOfRepeats = reader.readBits(2) + 3;
  28488. repeatedLength = codes[i - 1].prefixLength;
  28489. break;
  28490. case 33:
  28491. numberOfRepeats = reader.readBits(3) + 3;
  28492. repeatedLength = 0;
  28493. break;
  28494. case 34:
  28495. numberOfRepeats = reader.readBits(7) + 11;
  28496. repeatedLength = 0;
  28497. break;
  28498. default:
  28499. throw new Jbig2Error("invalid code length in symbol ID table");
  28500. }
  28501. for (j = 0; j < numberOfRepeats; j++) {
  28502. codes.push(new HuffmanLine([i, repeatedLength, 0, 0]));
  28503. i++;
  28504. }
  28505. } else {
  28506. codes.push(new HuffmanLine([i, codeLength, 0, 0]));
  28507. i++;
  28508. }
  28509. }
  28510. reader.byteAlign();
  28511. const symbolIDTable = new HuffmanTable(codes, false);
  28512. let customIndex = 0,
  28513. tableFirstS,
  28514. tableDeltaS,
  28515. tableDeltaT;
  28516. switch (textRegion.huffmanFS) {
  28517. case 0:
  28518. case 1:
  28519. tableFirstS = getStandardTable(textRegion.huffmanFS + 6);
  28520. break;
  28521. case 3:
  28522. tableFirstS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28523. customIndex++;
  28524. break;
  28525. default:
  28526. throw new Jbig2Error("invalid Huffman FS selector");
  28527. }
  28528. switch (textRegion.huffmanDS) {
  28529. case 0:
  28530. case 1:
  28531. case 2:
  28532. tableDeltaS = getStandardTable(textRegion.huffmanDS + 8);
  28533. break;
  28534. case 3:
  28535. tableDeltaS = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28536. customIndex++;
  28537. break;
  28538. default:
  28539. throw new Jbig2Error("invalid Huffman DS selector");
  28540. }
  28541. switch (textRegion.huffmanDT) {
  28542. case 0:
  28543. case 1:
  28544. case 2:
  28545. tableDeltaT = getStandardTable(textRegion.huffmanDT + 11);
  28546. break;
  28547. case 3:
  28548. tableDeltaT = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28549. customIndex++;
  28550. break;
  28551. default:
  28552. throw new Jbig2Error("invalid Huffman DT selector");
  28553. }
  28554. if (textRegion.refinement) {
  28555. throw new Jbig2Error("refinement with Huffman is not supported");
  28556. }
  28557. return {
  28558. symbolIDTable,
  28559. tableFirstS,
  28560. tableDeltaS,
  28561. tableDeltaT
  28562. };
  28563. }
  28564. function getSymbolDictionaryHuffmanTables(dictionary, referredTo, customTables) {
  28565. let customIndex = 0,
  28566. tableDeltaHeight,
  28567. tableDeltaWidth;
  28568. switch (dictionary.huffmanDHSelector) {
  28569. case 0:
  28570. case 1:
  28571. tableDeltaHeight = getStandardTable(dictionary.huffmanDHSelector + 4);
  28572. break;
  28573. case 3:
  28574. tableDeltaHeight = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28575. customIndex++;
  28576. break;
  28577. default:
  28578. throw new Jbig2Error("invalid Huffman DH selector");
  28579. }
  28580. switch (dictionary.huffmanDWSelector) {
  28581. case 0:
  28582. case 1:
  28583. tableDeltaWidth = getStandardTable(dictionary.huffmanDWSelector + 2);
  28584. break;
  28585. case 3:
  28586. tableDeltaWidth = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28587. customIndex++;
  28588. break;
  28589. default:
  28590. throw new Jbig2Error("invalid Huffman DW selector");
  28591. }
  28592. let tableBitmapSize, tableAggregateInstances;
  28593. if (dictionary.bitmapSizeSelector) {
  28594. tableBitmapSize = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28595. customIndex++;
  28596. } else {
  28597. tableBitmapSize = getStandardTable(1);
  28598. }
  28599. if (dictionary.aggregationInstancesSelector) {
  28600. tableAggregateInstances = getCustomHuffmanTable(customIndex, referredTo, customTables);
  28601. } else {
  28602. tableAggregateInstances = getStandardTable(1);
  28603. }
  28604. return {
  28605. tableDeltaHeight,
  28606. tableDeltaWidth,
  28607. tableBitmapSize,
  28608. tableAggregateInstances
  28609. };
  28610. }
  28611. function readUncompressedBitmap(reader, width, height) {
  28612. const bitmap = [];
  28613. for (let y = 0; y < height; y++) {
  28614. const row = new Uint8Array(width);
  28615. bitmap.push(row);
  28616. for (let x = 0; x < width; x++) {
  28617. row[x] = reader.readBit();
  28618. }
  28619. reader.byteAlign();
  28620. }
  28621. return bitmap;
  28622. }
  28623. function decodeMMRBitmap(input, width, height, endOfBlock) {
  28624. const params = {
  28625. K: -1,
  28626. Columns: width,
  28627. Rows: height,
  28628. BlackIs1: true,
  28629. EndOfBlock: endOfBlock
  28630. };
  28631. const decoder = new _ccitt.CCITTFaxDecoder(input, params);
  28632. const bitmap = [];
  28633. let currentByte,
  28634. eof = false;
  28635. for (let y = 0; y < height; y++) {
  28636. const row = new Uint8Array(width);
  28637. bitmap.push(row);
  28638. let shift = -1;
  28639. for (let x = 0; x < width; x++) {
  28640. if (shift < 0) {
  28641. currentByte = decoder.readNextChar();
  28642. if (currentByte === -1) {
  28643. currentByte = 0;
  28644. eof = true;
  28645. }
  28646. shift = 7;
  28647. }
  28648. row[x] = currentByte >> shift & 1;
  28649. shift--;
  28650. }
  28651. }
  28652. if (endOfBlock && !eof) {
  28653. const lookForEOFLimit = 5;
  28654. for (let i = 0; i < lookForEOFLimit; i++) {
  28655. if (decoder.readNextChar() === -1) {
  28656. break;
  28657. }
  28658. }
  28659. }
  28660. return bitmap;
  28661. }
  28662. class Jbig2Image {
  28663. parseChunks(chunks) {
  28664. return parseJbig2Chunks(chunks);
  28665. }
  28666. parse(data) {
  28667. const {
  28668. imgData,
  28669. width,
  28670. height
  28671. } = parseJbig2(data);
  28672. this.width = width;
  28673. this.height = height;
  28674. return imgData;
  28675. }
  28676. }
  28677. exports.Jbig2Image = Jbig2Image;
  28678. /***/ }),
  28679. /* 36 */
  28680. /***/ ((__unused_webpack_module, exports) => {
  28681. Object.defineProperty(exports, "__esModule", ({
  28682. value: true
  28683. }));
  28684. exports.ArithmeticDecoder = void 0;
  28685. const QeTable = [{
  28686. qe: 0x5601,
  28687. nmps: 1,
  28688. nlps: 1,
  28689. switchFlag: 1
  28690. }, {
  28691. qe: 0x3401,
  28692. nmps: 2,
  28693. nlps: 6,
  28694. switchFlag: 0
  28695. }, {
  28696. qe: 0x1801,
  28697. nmps: 3,
  28698. nlps: 9,
  28699. switchFlag: 0
  28700. }, {
  28701. qe: 0x0ac1,
  28702. nmps: 4,
  28703. nlps: 12,
  28704. switchFlag: 0
  28705. }, {
  28706. qe: 0x0521,
  28707. nmps: 5,
  28708. nlps: 29,
  28709. switchFlag: 0
  28710. }, {
  28711. qe: 0x0221,
  28712. nmps: 38,
  28713. nlps: 33,
  28714. switchFlag: 0
  28715. }, {
  28716. qe: 0x5601,
  28717. nmps: 7,
  28718. nlps: 6,
  28719. switchFlag: 1
  28720. }, {
  28721. qe: 0x5401,
  28722. nmps: 8,
  28723. nlps: 14,
  28724. switchFlag: 0
  28725. }, {
  28726. qe: 0x4801,
  28727. nmps: 9,
  28728. nlps: 14,
  28729. switchFlag: 0
  28730. }, {
  28731. qe: 0x3801,
  28732. nmps: 10,
  28733. nlps: 14,
  28734. switchFlag: 0
  28735. }, {
  28736. qe: 0x3001,
  28737. nmps: 11,
  28738. nlps: 17,
  28739. switchFlag: 0
  28740. }, {
  28741. qe: 0x2401,
  28742. nmps: 12,
  28743. nlps: 18,
  28744. switchFlag: 0
  28745. }, {
  28746. qe: 0x1c01,
  28747. nmps: 13,
  28748. nlps: 20,
  28749. switchFlag: 0
  28750. }, {
  28751. qe: 0x1601,
  28752. nmps: 29,
  28753. nlps: 21,
  28754. switchFlag: 0
  28755. }, {
  28756. qe: 0x5601,
  28757. nmps: 15,
  28758. nlps: 14,
  28759. switchFlag: 1
  28760. }, {
  28761. qe: 0x5401,
  28762. nmps: 16,
  28763. nlps: 14,
  28764. switchFlag: 0
  28765. }, {
  28766. qe: 0x5101,
  28767. nmps: 17,
  28768. nlps: 15,
  28769. switchFlag: 0
  28770. }, {
  28771. qe: 0x4801,
  28772. nmps: 18,
  28773. nlps: 16,
  28774. switchFlag: 0
  28775. }, {
  28776. qe: 0x3801,
  28777. nmps: 19,
  28778. nlps: 17,
  28779. switchFlag: 0
  28780. }, {
  28781. qe: 0x3401,
  28782. nmps: 20,
  28783. nlps: 18,
  28784. switchFlag: 0
  28785. }, {
  28786. qe: 0x3001,
  28787. nmps: 21,
  28788. nlps: 19,
  28789. switchFlag: 0
  28790. }, {
  28791. qe: 0x2801,
  28792. nmps: 22,
  28793. nlps: 19,
  28794. switchFlag: 0
  28795. }, {
  28796. qe: 0x2401,
  28797. nmps: 23,
  28798. nlps: 20,
  28799. switchFlag: 0
  28800. }, {
  28801. qe: 0x2201,
  28802. nmps: 24,
  28803. nlps: 21,
  28804. switchFlag: 0
  28805. }, {
  28806. qe: 0x1c01,
  28807. nmps: 25,
  28808. nlps: 22,
  28809. switchFlag: 0
  28810. }, {
  28811. qe: 0x1801,
  28812. nmps: 26,
  28813. nlps: 23,
  28814. switchFlag: 0
  28815. }, {
  28816. qe: 0x1601,
  28817. nmps: 27,
  28818. nlps: 24,
  28819. switchFlag: 0
  28820. }, {
  28821. qe: 0x1401,
  28822. nmps: 28,
  28823. nlps: 25,
  28824. switchFlag: 0
  28825. }, {
  28826. qe: 0x1201,
  28827. nmps: 29,
  28828. nlps: 26,
  28829. switchFlag: 0
  28830. }, {
  28831. qe: 0x1101,
  28832. nmps: 30,
  28833. nlps: 27,
  28834. switchFlag: 0
  28835. }, {
  28836. qe: 0x0ac1,
  28837. nmps: 31,
  28838. nlps: 28,
  28839. switchFlag: 0
  28840. }, {
  28841. qe: 0x09c1,
  28842. nmps: 32,
  28843. nlps: 29,
  28844. switchFlag: 0
  28845. }, {
  28846. qe: 0x08a1,
  28847. nmps: 33,
  28848. nlps: 30,
  28849. switchFlag: 0
  28850. }, {
  28851. qe: 0x0521,
  28852. nmps: 34,
  28853. nlps: 31,
  28854. switchFlag: 0
  28855. }, {
  28856. qe: 0x0441,
  28857. nmps: 35,
  28858. nlps: 32,
  28859. switchFlag: 0
  28860. }, {
  28861. qe: 0x02a1,
  28862. nmps: 36,
  28863. nlps: 33,
  28864. switchFlag: 0
  28865. }, {
  28866. qe: 0x0221,
  28867. nmps: 37,
  28868. nlps: 34,
  28869. switchFlag: 0
  28870. }, {
  28871. qe: 0x0141,
  28872. nmps: 38,
  28873. nlps: 35,
  28874. switchFlag: 0
  28875. }, {
  28876. qe: 0x0111,
  28877. nmps: 39,
  28878. nlps: 36,
  28879. switchFlag: 0
  28880. }, {
  28881. qe: 0x0085,
  28882. nmps: 40,
  28883. nlps: 37,
  28884. switchFlag: 0
  28885. }, {
  28886. qe: 0x0049,
  28887. nmps: 41,
  28888. nlps: 38,
  28889. switchFlag: 0
  28890. }, {
  28891. qe: 0x0025,
  28892. nmps: 42,
  28893. nlps: 39,
  28894. switchFlag: 0
  28895. }, {
  28896. qe: 0x0015,
  28897. nmps: 43,
  28898. nlps: 40,
  28899. switchFlag: 0
  28900. }, {
  28901. qe: 0x0009,
  28902. nmps: 44,
  28903. nlps: 41,
  28904. switchFlag: 0
  28905. }, {
  28906. qe: 0x0005,
  28907. nmps: 45,
  28908. nlps: 42,
  28909. switchFlag: 0
  28910. }, {
  28911. qe: 0x0001,
  28912. nmps: 45,
  28913. nlps: 43,
  28914. switchFlag: 0
  28915. }, {
  28916. qe: 0x5601,
  28917. nmps: 46,
  28918. nlps: 46,
  28919. switchFlag: 0
  28920. }];
  28921. class ArithmeticDecoder {
  28922. constructor(data, start, end) {
  28923. this.data = data;
  28924. this.bp = start;
  28925. this.dataEnd = end;
  28926. this.chigh = data[start];
  28927. this.clow = 0;
  28928. this.byteIn();
  28929. this.chigh = this.chigh << 7 & 0xffff | this.clow >> 9 & 0x7f;
  28930. this.clow = this.clow << 7 & 0xffff;
  28931. this.ct -= 7;
  28932. this.a = 0x8000;
  28933. }
  28934. byteIn() {
  28935. const data = this.data;
  28936. let bp = this.bp;
  28937. if (data[bp] === 0xff) {
  28938. if (data[bp + 1] > 0x8f) {
  28939. this.clow += 0xff00;
  28940. this.ct = 8;
  28941. } else {
  28942. bp++;
  28943. this.clow += data[bp] << 9;
  28944. this.ct = 7;
  28945. this.bp = bp;
  28946. }
  28947. } else {
  28948. bp++;
  28949. this.clow += bp < this.dataEnd ? data[bp] << 8 : 0xff00;
  28950. this.ct = 8;
  28951. this.bp = bp;
  28952. }
  28953. if (this.clow > 0xffff) {
  28954. this.chigh += this.clow >> 16;
  28955. this.clow &= 0xffff;
  28956. }
  28957. }
  28958. readBit(contexts, pos) {
  28959. let cx_index = contexts[pos] >> 1,
  28960. cx_mps = contexts[pos] & 1;
  28961. const qeTableIcx = QeTable[cx_index];
  28962. const qeIcx = qeTableIcx.qe;
  28963. let d;
  28964. let a = this.a - qeIcx;
  28965. if (this.chigh < qeIcx) {
  28966. if (a < qeIcx) {
  28967. a = qeIcx;
  28968. d = cx_mps;
  28969. cx_index = qeTableIcx.nmps;
  28970. } else {
  28971. a = qeIcx;
  28972. d = 1 ^ cx_mps;
  28973. if (qeTableIcx.switchFlag === 1) {
  28974. cx_mps = d;
  28975. }
  28976. cx_index = qeTableIcx.nlps;
  28977. }
  28978. } else {
  28979. this.chigh -= qeIcx;
  28980. if ((a & 0x8000) !== 0) {
  28981. this.a = a;
  28982. return cx_mps;
  28983. }
  28984. if (a < qeIcx) {
  28985. d = 1 ^ cx_mps;
  28986. if (qeTableIcx.switchFlag === 1) {
  28987. cx_mps = d;
  28988. }
  28989. cx_index = qeTableIcx.nlps;
  28990. } else {
  28991. d = cx_mps;
  28992. cx_index = qeTableIcx.nmps;
  28993. }
  28994. }
  28995. do {
  28996. if (this.ct === 0) {
  28997. this.byteIn();
  28998. }
  28999. a <<= 1;
  29000. this.chigh = this.chigh << 1 & 0xffff | this.clow >> 15 & 1;
  29001. this.clow = this.clow << 1 & 0xffff;
  29002. this.ct--;
  29003. } while ((a & 0x8000) === 0);
  29004. this.a = a;
  29005. contexts[pos] = cx_index << 1 | cx_mps;
  29006. return d;
  29007. }
  29008. }
  29009. exports.ArithmeticDecoder = ArithmeticDecoder;
  29010. /***/ }),
  29011. /* 37 */
  29012. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29013. Object.defineProperty(exports, "__esModule", ({
  29014. value: true
  29015. }));
  29016. exports.JpegStream = void 0;
  29017. var _decode_stream = __w_pdfjs_require__(29);
  29018. var _primitives = __w_pdfjs_require__(5);
  29019. var _jpg = __w_pdfjs_require__(38);
  29020. var _util = __w_pdfjs_require__(2);
  29021. class JpegStream extends _decode_stream.DecodeStream {
  29022. constructor(stream, maybeLength, params) {
  29023. let ch;
  29024. while ((ch = stream.getByte()) !== -1) {
  29025. if (ch === 0xff) {
  29026. stream.skip(-1);
  29027. break;
  29028. }
  29029. }
  29030. super(maybeLength);
  29031. this.stream = stream;
  29032. this.dict = stream.dict;
  29033. this.maybeLength = maybeLength;
  29034. this.params = params;
  29035. }
  29036. get bytes() {
  29037. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  29038. }
  29039. ensureBuffer(requested) {}
  29040. readBlock() {
  29041. if (this.eof) {
  29042. return;
  29043. }
  29044. const jpegOptions = {
  29045. decodeTransform: undefined,
  29046. colorTransform: undefined
  29047. };
  29048. const decodeArr = this.dict.getArray("D", "Decode");
  29049. if (this.forceRGB && Array.isArray(decodeArr)) {
  29050. const bitsPerComponent = this.dict.get("BPC", "BitsPerComponent") || 8;
  29051. const decodeArrLength = decodeArr.length;
  29052. const transform = new Int32Array(decodeArrLength);
  29053. let transformNeeded = false;
  29054. const maxValue = (1 << bitsPerComponent) - 1;
  29055. for (let i = 0; i < decodeArrLength; i += 2) {
  29056. transform[i] = (decodeArr[i + 1] - decodeArr[i]) * 256 | 0;
  29057. transform[i + 1] = decodeArr[i] * maxValue | 0;
  29058. if (transform[i] !== 256 || transform[i + 1] !== 0) {
  29059. transformNeeded = true;
  29060. }
  29061. }
  29062. if (transformNeeded) {
  29063. jpegOptions.decodeTransform = transform;
  29064. }
  29065. }
  29066. if (this.params instanceof _primitives.Dict) {
  29067. const colorTransform = this.params.get("ColorTransform");
  29068. if (Number.isInteger(colorTransform)) {
  29069. jpegOptions.colorTransform = colorTransform;
  29070. }
  29071. }
  29072. const jpegImage = new _jpg.JpegImage(jpegOptions);
  29073. jpegImage.parse(this.bytes);
  29074. const data = jpegImage.getData({
  29075. width: this.drawWidth,
  29076. height: this.drawHeight,
  29077. forceRGB: this.forceRGB,
  29078. isSourcePDF: true
  29079. });
  29080. this.buffer = data;
  29081. this.bufferLength = data.length;
  29082. this.eof = true;
  29083. }
  29084. }
  29085. exports.JpegStream = JpegStream;
  29086. /***/ }),
  29087. /* 38 */
  29088. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  29089. Object.defineProperty(exports, "__esModule", ({
  29090. value: true
  29091. }));
  29092. exports.JpegImage = void 0;
  29093. var _util = __w_pdfjs_require__(2);
  29094. var _core_utils = __w_pdfjs_require__(8);
  29095. class JpegError extends _util.BaseException {
  29096. constructor(msg) {
  29097. super(`JPEG error: ${msg}`, "JpegError");
  29098. }
  29099. }
  29100. class DNLMarkerError extends _util.BaseException {
  29101. constructor(message, scanLines) {
  29102. super(message, "DNLMarkerError");
  29103. this.scanLines = scanLines;
  29104. }
  29105. }
  29106. class EOIMarkerError extends _util.BaseException {
  29107. constructor(msg) {
  29108. super(msg, "EOIMarkerError");
  29109. }
  29110. }
  29111. 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]);
  29112. const dctCos1 = 4017;
  29113. const dctSin1 = 799;
  29114. const dctCos3 = 3406;
  29115. const dctSin3 = 2276;
  29116. const dctCos6 = 1567;
  29117. const dctSin6 = 3784;
  29118. const dctSqrt2 = 5793;
  29119. const dctSqrt1d2 = 2896;
  29120. function buildHuffmanTable(codeLengths, values) {
  29121. let k = 0,
  29122. i,
  29123. j,
  29124. length = 16;
  29125. while (length > 0 && !codeLengths[length - 1]) {
  29126. length--;
  29127. }
  29128. const code = [{
  29129. children: [],
  29130. index: 0
  29131. }];
  29132. let p = code[0],
  29133. q;
  29134. for (i = 0; i < length; i++) {
  29135. for (j = 0; j < codeLengths[i]; j++) {
  29136. p = code.pop();
  29137. p.children[p.index] = values[k];
  29138. while (p.index > 0) {
  29139. p = code.pop();
  29140. }
  29141. p.index++;
  29142. code.push(p);
  29143. while (code.length <= i) {
  29144. code.push(q = {
  29145. children: [],
  29146. index: 0
  29147. });
  29148. p.children[p.index] = q.children;
  29149. p = q;
  29150. }
  29151. k++;
  29152. }
  29153. if (i + 1 < length) {
  29154. code.push(q = {
  29155. children: [],
  29156. index: 0
  29157. });
  29158. p.children[p.index] = q.children;
  29159. p = q;
  29160. }
  29161. }
  29162. return code[0].children;
  29163. }
  29164. function getBlockBufferOffset(component, row, col) {
  29165. return 64 * ((component.blocksPerLine + 1) * row + col);
  29166. }
  29167. function decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successivePrev, successive, parseDNLMarker = false) {
  29168. const mcusPerLine = frame.mcusPerLine;
  29169. const progressive = frame.progressive;
  29170. const startOffset = offset;
  29171. let bitsData = 0,
  29172. bitsCount = 0;
  29173. function readBit() {
  29174. if (bitsCount > 0) {
  29175. bitsCount--;
  29176. return bitsData >> bitsCount & 1;
  29177. }
  29178. bitsData = data[offset++];
  29179. if (bitsData === 0xff) {
  29180. const nextByte = data[offset++];
  29181. if (nextByte) {
  29182. if (nextByte === 0xdc && parseDNLMarker) {
  29183. offset += 2;
  29184. const scanLines = (0, _core_utils.readUint16)(data, offset);
  29185. offset += 2;
  29186. if (scanLines > 0 && scanLines !== frame.scanLines) {
  29187. throw new DNLMarkerError("Found DNL marker (0xFFDC) while parsing scan data", scanLines);
  29188. }
  29189. } else if (nextByte === 0xd9) {
  29190. if (parseDNLMarker) {
  29191. const maybeScanLines = blockRow * (frame.precision === 8 ? 8 : 0);
  29192. if (maybeScanLines > 0 && Math.round(frame.scanLines / maybeScanLines) >= 10) {
  29193. throw new DNLMarkerError("Found EOI marker (0xFFD9) while parsing scan data, " + "possibly caused by incorrect `scanLines` parameter", maybeScanLines);
  29194. }
  29195. }
  29196. throw new EOIMarkerError("Found EOI marker (0xFFD9) while parsing scan data");
  29197. }
  29198. throw new JpegError(`unexpected marker ${(bitsData << 8 | nextByte).toString(16)}`);
  29199. }
  29200. }
  29201. bitsCount = 7;
  29202. return bitsData >>> 7;
  29203. }
  29204. function decodeHuffman(tree) {
  29205. let node = tree;
  29206. while (true) {
  29207. node = node[readBit()];
  29208. switch (typeof node) {
  29209. case "number":
  29210. return node;
  29211. case "object":
  29212. continue;
  29213. }
  29214. throw new JpegError("invalid huffman sequence");
  29215. }
  29216. }
  29217. function receive(length) {
  29218. let n = 0;
  29219. while (length > 0) {
  29220. n = n << 1 | readBit();
  29221. length--;
  29222. }
  29223. return n;
  29224. }
  29225. function receiveAndExtend(length) {
  29226. if (length === 1) {
  29227. return readBit() === 1 ? 1 : -1;
  29228. }
  29229. const n = receive(length);
  29230. if (n >= 1 << length - 1) {
  29231. return n;
  29232. }
  29233. return n + (-1 << length) + 1;
  29234. }
  29235. function decodeBaseline(component, blockOffset) {
  29236. const t = decodeHuffman(component.huffmanTableDC);
  29237. const diff = t === 0 ? 0 : receiveAndExtend(t);
  29238. component.blockData[blockOffset] = component.pred += diff;
  29239. let k = 1;
  29240. while (k < 64) {
  29241. const rs = decodeHuffman(component.huffmanTableAC);
  29242. const s = rs & 15,
  29243. r = rs >> 4;
  29244. if (s === 0) {
  29245. if (r < 15) {
  29246. break;
  29247. }
  29248. k += 16;
  29249. continue;
  29250. }
  29251. k += r;
  29252. const z = dctZigZag[k];
  29253. component.blockData[blockOffset + z] = receiveAndExtend(s);
  29254. k++;
  29255. }
  29256. }
  29257. function decodeDCFirst(component, blockOffset) {
  29258. const t = decodeHuffman(component.huffmanTableDC);
  29259. const diff = t === 0 ? 0 : receiveAndExtend(t) << successive;
  29260. component.blockData[blockOffset] = component.pred += diff;
  29261. }
  29262. function decodeDCSuccessive(component, blockOffset) {
  29263. component.blockData[blockOffset] |= readBit() << successive;
  29264. }
  29265. let eobrun = 0;
  29266. function decodeACFirst(component, blockOffset) {
  29267. if (eobrun > 0) {
  29268. eobrun--;
  29269. return;
  29270. }
  29271. let k = spectralStart;
  29272. const e = spectralEnd;
  29273. while (k <= e) {
  29274. const rs = decodeHuffman(component.huffmanTableAC);
  29275. const s = rs & 15,
  29276. r = rs >> 4;
  29277. if (s === 0) {
  29278. if (r < 15) {
  29279. eobrun = receive(r) + (1 << r) - 1;
  29280. break;
  29281. }
  29282. k += 16;
  29283. continue;
  29284. }
  29285. k += r;
  29286. const z = dctZigZag[k];
  29287. component.blockData[blockOffset + z] = receiveAndExtend(s) * (1 << successive);
  29288. k++;
  29289. }
  29290. }
  29291. let successiveACState = 0,
  29292. successiveACNextValue;
  29293. function decodeACSuccessive(component, blockOffset) {
  29294. let k = spectralStart;
  29295. const e = spectralEnd;
  29296. let r = 0;
  29297. let s;
  29298. let rs;
  29299. while (k <= e) {
  29300. const offsetZ = blockOffset + dctZigZag[k];
  29301. const sign = component.blockData[offsetZ] < 0 ? -1 : 1;
  29302. switch (successiveACState) {
  29303. case 0:
  29304. rs = decodeHuffman(component.huffmanTableAC);
  29305. s = rs & 15;
  29306. r = rs >> 4;
  29307. if (s === 0) {
  29308. if (r < 15) {
  29309. eobrun = receive(r) + (1 << r);
  29310. successiveACState = 4;
  29311. } else {
  29312. r = 16;
  29313. successiveACState = 1;
  29314. }
  29315. } else {
  29316. if (s !== 1) {
  29317. throw new JpegError("invalid ACn encoding");
  29318. }
  29319. successiveACNextValue = receiveAndExtend(s);
  29320. successiveACState = r ? 2 : 3;
  29321. }
  29322. continue;
  29323. case 1:
  29324. case 2:
  29325. if (component.blockData[offsetZ]) {
  29326. component.blockData[offsetZ] += sign * (readBit() << successive);
  29327. } else {
  29328. r--;
  29329. if (r === 0) {
  29330. successiveACState = successiveACState === 2 ? 3 : 0;
  29331. }
  29332. }
  29333. break;
  29334. case 3:
  29335. if (component.blockData[offsetZ]) {
  29336. component.blockData[offsetZ] += sign * (readBit() << successive);
  29337. } else {
  29338. component.blockData[offsetZ] = successiveACNextValue << successive;
  29339. successiveACState = 0;
  29340. }
  29341. break;
  29342. case 4:
  29343. if (component.blockData[offsetZ]) {
  29344. component.blockData[offsetZ] += sign * (readBit() << successive);
  29345. }
  29346. break;
  29347. }
  29348. k++;
  29349. }
  29350. if (successiveACState === 4) {
  29351. eobrun--;
  29352. if (eobrun === 0) {
  29353. successiveACState = 0;
  29354. }
  29355. }
  29356. }
  29357. let blockRow = 0;
  29358. function decodeMcu(component, decode, mcu, row, col) {
  29359. const mcuRow = mcu / mcusPerLine | 0;
  29360. const mcuCol = mcu % mcusPerLine;
  29361. blockRow = mcuRow * component.v + row;
  29362. const blockCol = mcuCol * component.h + col;
  29363. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29364. decode(component, blockOffset);
  29365. }
  29366. function decodeBlock(component, decode, mcu) {
  29367. blockRow = mcu / component.blocksPerLine | 0;
  29368. const blockCol = mcu % component.blocksPerLine;
  29369. const blockOffset = getBlockBufferOffset(component, blockRow, blockCol);
  29370. decode(component, blockOffset);
  29371. }
  29372. const componentsLength = components.length;
  29373. let component, i, j, k, n;
  29374. let decodeFn;
  29375. if (progressive) {
  29376. if (spectralStart === 0) {
  29377. decodeFn = successivePrev === 0 ? decodeDCFirst : decodeDCSuccessive;
  29378. } else {
  29379. decodeFn = successivePrev === 0 ? decodeACFirst : decodeACSuccessive;
  29380. }
  29381. } else {
  29382. decodeFn = decodeBaseline;
  29383. }
  29384. let mcu = 0,
  29385. fileMarker;
  29386. let mcuExpected;
  29387. if (componentsLength === 1) {
  29388. mcuExpected = components[0].blocksPerLine * components[0].blocksPerColumn;
  29389. } else {
  29390. mcuExpected = mcusPerLine * frame.mcusPerColumn;
  29391. }
  29392. let h, v;
  29393. while (mcu <= mcuExpected) {
  29394. const mcuToRead = resetInterval ? Math.min(mcuExpected - mcu, resetInterval) : mcuExpected;
  29395. if (mcuToRead > 0) {
  29396. for (i = 0; i < componentsLength; i++) {
  29397. components[i].pred = 0;
  29398. }
  29399. eobrun = 0;
  29400. if (componentsLength === 1) {
  29401. component = components[0];
  29402. for (n = 0; n < mcuToRead; n++) {
  29403. decodeBlock(component, decodeFn, mcu);
  29404. mcu++;
  29405. }
  29406. } else {
  29407. for (n = 0; n < mcuToRead; n++) {
  29408. for (i = 0; i < componentsLength; i++) {
  29409. component = components[i];
  29410. h = component.h;
  29411. v = component.v;
  29412. for (j = 0; j < v; j++) {
  29413. for (k = 0; k < h; k++) {
  29414. decodeMcu(component, decodeFn, mcu, j, k);
  29415. }
  29416. }
  29417. }
  29418. mcu++;
  29419. }
  29420. }
  29421. }
  29422. bitsCount = 0;
  29423. fileMarker = findNextFileMarker(data, offset);
  29424. if (!fileMarker) {
  29425. break;
  29426. }
  29427. if (fileMarker.invalid) {
  29428. const partialMsg = mcuToRead > 0 ? "unexpected" : "excessive";
  29429. (0, _util.warn)(`decodeScan - ${partialMsg} MCU data, current marker is: ${fileMarker.invalid}`);
  29430. offset = fileMarker.offset;
  29431. }
  29432. if (fileMarker.marker >= 0xffd0 && fileMarker.marker <= 0xffd7) {
  29433. offset += 2;
  29434. } else {
  29435. break;
  29436. }
  29437. }
  29438. return offset - startOffset;
  29439. }
  29440. function quantizeAndInverse(component, blockBufferOffset, p) {
  29441. const qt = component.quantizationTable,
  29442. blockData = component.blockData;
  29443. let v0, v1, v2, v3, v4, v5, v6, v7;
  29444. let p0, p1, p2, p3, p4, p5, p6, p7;
  29445. let t;
  29446. if (!qt) {
  29447. throw new JpegError("missing required Quantization Table.");
  29448. }
  29449. for (let row = 0; row < 64; row += 8) {
  29450. p0 = blockData[blockBufferOffset + row];
  29451. p1 = blockData[blockBufferOffset + row + 1];
  29452. p2 = blockData[blockBufferOffset + row + 2];
  29453. p3 = blockData[blockBufferOffset + row + 3];
  29454. p4 = blockData[blockBufferOffset + row + 4];
  29455. p5 = blockData[blockBufferOffset + row + 5];
  29456. p6 = blockData[blockBufferOffset + row + 6];
  29457. p7 = blockData[blockBufferOffset + row + 7];
  29458. p0 *= qt[row];
  29459. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29460. t = dctSqrt2 * p0 + 512 >> 10;
  29461. p[row] = t;
  29462. p[row + 1] = t;
  29463. p[row + 2] = t;
  29464. p[row + 3] = t;
  29465. p[row + 4] = t;
  29466. p[row + 5] = t;
  29467. p[row + 6] = t;
  29468. p[row + 7] = t;
  29469. continue;
  29470. }
  29471. p1 *= qt[row + 1];
  29472. p2 *= qt[row + 2];
  29473. p3 *= qt[row + 3];
  29474. p4 *= qt[row + 4];
  29475. p5 *= qt[row + 5];
  29476. p6 *= qt[row + 6];
  29477. p7 *= qt[row + 7];
  29478. v0 = dctSqrt2 * p0 + 128 >> 8;
  29479. v1 = dctSqrt2 * p4 + 128 >> 8;
  29480. v2 = p2;
  29481. v3 = p6;
  29482. v4 = dctSqrt1d2 * (p1 - p7) + 128 >> 8;
  29483. v7 = dctSqrt1d2 * (p1 + p7) + 128 >> 8;
  29484. v5 = p3 << 4;
  29485. v6 = p5 << 4;
  29486. v0 = v0 + v1 + 1 >> 1;
  29487. v1 = v0 - v1;
  29488. t = v2 * dctSin6 + v3 * dctCos6 + 128 >> 8;
  29489. v2 = v2 * dctCos6 - v3 * dctSin6 + 128 >> 8;
  29490. v3 = t;
  29491. v4 = v4 + v6 + 1 >> 1;
  29492. v6 = v4 - v6;
  29493. v7 = v7 + v5 + 1 >> 1;
  29494. v5 = v7 - v5;
  29495. v0 = v0 + v3 + 1 >> 1;
  29496. v3 = v0 - v3;
  29497. v1 = v1 + v2 + 1 >> 1;
  29498. v2 = v1 - v2;
  29499. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29500. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29501. v7 = t;
  29502. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29503. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29504. v6 = t;
  29505. p[row] = v0 + v7;
  29506. p[row + 7] = v0 - v7;
  29507. p[row + 1] = v1 + v6;
  29508. p[row + 6] = v1 - v6;
  29509. p[row + 2] = v2 + v5;
  29510. p[row + 5] = v2 - v5;
  29511. p[row + 3] = v3 + v4;
  29512. p[row + 4] = v3 - v4;
  29513. }
  29514. for (let col = 0; col < 8; ++col) {
  29515. p0 = p[col];
  29516. p1 = p[col + 8];
  29517. p2 = p[col + 16];
  29518. p3 = p[col + 24];
  29519. p4 = p[col + 32];
  29520. p5 = p[col + 40];
  29521. p6 = p[col + 48];
  29522. p7 = p[col + 56];
  29523. if ((p1 | p2 | p3 | p4 | p5 | p6 | p7) === 0) {
  29524. t = dctSqrt2 * p0 + 8192 >> 14;
  29525. if (t < -2040) {
  29526. t = 0;
  29527. } else if (t >= 2024) {
  29528. t = 255;
  29529. } else {
  29530. t = t + 2056 >> 4;
  29531. }
  29532. blockData[blockBufferOffset + col] = t;
  29533. blockData[blockBufferOffset + col + 8] = t;
  29534. blockData[blockBufferOffset + col + 16] = t;
  29535. blockData[blockBufferOffset + col + 24] = t;
  29536. blockData[blockBufferOffset + col + 32] = t;
  29537. blockData[blockBufferOffset + col + 40] = t;
  29538. blockData[blockBufferOffset + col + 48] = t;
  29539. blockData[blockBufferOffset + col + 56] = t;
  29540. continue;
  29541. }
  29542. v0 = dctSqrt2 * p0 + 2048 >> 12;
  29543. v1 = dctSqrt2 * p4 + 2048 >> 12;
  29544. v2 = p2;
  29545. v3 = p6;
  29546. v4 = dctSqrt1d2 * (p1 - p7) + 2048 >> 12;
  29547. v7 = dctSqrt1d2 * (p1 + p7) + 2048 >> 12;
  29548. v5 = p3;
  29549. v6 = p5;
  29550. v0 = (v0 + v1 + 1 >> 1) + 4112;
  29551. v1 = v0 - v1;
  29552. t = v2 * dctSin6 + v3 * dctCos6 + 2048 >> 12;
  29553. v2 = v2 * dctCos6 - v3 * dctSin6 + 2048 >> 12;
  29554. v3 = t;
  29555. v4 = v4 + v6 + 1 >> 1;
  29556. v6 = v4 - v6;
  29557. v7 = v7 + v5 + 1 >> 1;
  29558. v5 = v7 - v5;
  29559. v0 = v0 + v3 + 1 >> 1;
  29560. v3 = v0 - v3;
  29561. v1 = v1 + v2 + 1 >> 1;
  29562. v2 = v1 - v2;
  29563. t = v4 * dctSin3 + v7 * dctCos3 + 2048 >> 12;
  29564. v4 = v4 * dctCos3 - v7 * dctSin3 + 2048 >> 12;
  29565. v7 = t;
  29566. t = v5 * dctSin1 + v6 * dctCos1 + 2048 >> 12;
  29567. v5 = v5 * dctCos1 - v6 * dctSin1 + 2048 >> 12;
  29568. v6 = t;
  29569. p0 = v0 + v7;
  29570. p7 = v0 - v7;
  29571. p1 = v1 + v6;
  29572. p6 = v1 - v6;
  29573. p2 = v2 + v5;
  29574. p5 = v2 - v5;
  29575. p3 = v3 + v4;
  29576. p4 = v3 - v4;
  29577. if (p0 < 16) {
  29578. p0 = 0;
  29579. } else if (p0 >= 4080) {
  29580. p0 = 255;
  29581. } else {
  29582. p0 >>= 4;
  29583. }
  29584. if (p1 < 16) {
  29585. p1 = 0;
  29586. } else if (p1 >= 4080) {
  29587. p1 = 255;
  29588. } else {
  29589. p1 >>= 4;
  29590. }
  29591. if (p2 < 16) {
  29592. p2 = 0;
  29593. } else if (p2 >= 4080) {
  29594. p2 = 255;
  29595. } else {
  29596. p2 >>= 4;
  29597. }
  29598. if (p3 < 16) {
  29599. p3 = 0;
  29600. } else if (p3 >= 4080) {
  29601. p3 = 255;
  29602. } else {
  29603. p3 >>= 4;
  29604. }
  29605. if (p4 < 16) {
  29606. p4 = 0;
  29607. } else if (p4 >= 4080) {
  29608. p4 = 255;
  29609. } else {
  29610. p4 >>= 4;
  29611. }
  29612. if (p5 < 16) {
  29613. p5 = 0;
  29614. } else if (p5 >= 4080) {
  29615. p5 = 255;
  29616. } else {
  29617. p5 >>= 4;
  29618. }
  29619. if (p6 < 16) {
  29620. p6 = 0;
  29621. } else if (p6 >= 4080) {
  29622. p6 = 255;
  29623. } else {
  29624. p6 >>= 4;
  29625. }
  29626. if (p7 < 16) {
  29627. p7 = 0;
  29628. } else if (p7 >= 4080) {
  29629. p7 = 255;
  29630. } else {
  29631. p7 >>= 4;
  29632. }
  29633. blockData[blockBufferOffset + col] = p0;
  29634. blockData[blockBufferOffset + col + 8] = p1;
  29635. blockData[blockBufferOffset + col + 16] = p2;
  29636. blockData[blockBufferOffset + col + 24] = p3;
  29637. blockData[blockBufferOffset + col + 32] = p4;
  29638. blockData[blockBufferOffset + col + 40] = p5;
  29639. blockData[blockBufferOffset + col + 48] = p6;
  29640. blockData[blockBufferOffset + col + 56] = p7;
  29641. }
  29642. }
  29643. function buildComponentData(frame, component) {
  29644. const blocksPerLine = component.blocksPerLine;
  29645. const blocksPerColumn = component.blocksPerColumn;
  29646. const computationBuffer = new Int16Array(64);
  29647. for (let blockRow = 0; blockRow < blocksPerColumn; blockRow++) {
  29648. for (let blockCol = 0; blockCol < blocksPerLine; blockCol++) {
  29649. const offset = getBlockBufferOffset(component, blockRow, blockCol);
  29650. quantizeAndInverse(component, offset, computationBuffer);
  29651. }
  29652. }
  29653. return component.blockData;
  29654. }
  29655. function findNextFileMarker(data, currentPos, startPos = currentPos) {
  29656. const maxPos = data.length - 1;
  29657. let newPos = startPos < currentPos ? startPos : currentPos;
  29658. if (currentPos >= maxPos) {
  29659. return null;
  29660. }
  29661. const currentMarker = (0, _core_utils.readUint16)(data, currentPos);
  29662. if (currentMarker >= 0xffc0 && currentMarker <= 0xfffe) {
  29663. return {
  29664. invalid: null,
  29665. marker: currentMarker,
  29666. offset: currentPos
  29667. };
  29668. }
  29669. let newMarker = (0, _core_utils.readUint16)(data, newPos);
  29670. while (!(newMarker >= 0xffc0 && newMarker <= 0xfffe)) {
  29671. if (++newPos >= maxPos) {
  29672. return null;
  29673. }
  29674. newMarker = (0, _core_utils.readUint16)(data, newPos);
  29675. }
  29676. return {
  29677. invalid: currentMarker.toString(16),
  29678. marker: newMarker,
  29679. offset: newPos
  29680. };
  29681. }
  29682. class JpegImage {
  29683. constructor({
  29684. decodeTransform = null,
  29685. colorTransform = -1
  29686. } = {}) {
  29687. this._decodeTransform = decodeTransform;
  29688. this._colorTransform = colorTransform;
  29689. }
  29690. parse(data, {
  29691. dnlScanLines = null
  29692. } = {}) {
  29693. function readDataBlock() {
  29694. const length = (0, _core_utils.readUint16)(data, offset);
  29695. offset += 2;
  29696. let endOffset = offset + length - 2;
  29697. const fileMarker = findNextFileMarker(data, endOffset, offset);
  29698. if (fileMarker && fileMarker.invalid) {
  29699. (0, _util.warn)("readDataBlock - incorrect length, current marker is: " + fileMarker.invalid);
  29700. endOffset = fileMarker.offset;
  29701. }
  29702. const array = data.subarray(offset, endOffset);
  29703. offset += array.length;
  29704. return array;
  29705. }
  29706. function prepareComponents(frame) {
  29707. const mcusPerLine = Math.ceil(frame.samplesPerLine / 8 / frame.maxH);
  29708. const mcusPerColumn = Math.ceil(frame.scanLines / 8 / frame.maxV);
  29709. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29710. const component = frame.components[i];
  29711. const blocksPerLine = Math.ceil(Math.ceil(frame.samplesPerLine / 8) * component.h / frame.maxH);
  29712. const blocksPerColumn = Math.ceil(Math.ceil(frame.scanLines / 8) * component.v / frame.maxV);
  29713. const blocksPerLineForMcu = mcusPerLine * component.h;
  29714. const blocksPerColumnForMcu = mcusPerColumn * component.v;
  29715. const blocksBufferSize = 64 * blocksPerColumnForMcu * (blocksPerLineForMcu + 1);
  29716. component.blockData = new Int16Array(blocksBufferSize);
  29717. component.blocksPerLine = blocksPerLine;
  29718. component.blocksPerColumn = blocksPerColumn;
  29719. }
  29720. frame.mcusPerLine = mcusPerLine;
  29721. frame.mcusPerColumn = mcusPerColumn;
  29722. }
  29723. let offset = 0;
  29724. let jfif = null;
  29725. let adobe = null;
  29726. let frame, resetInterval;
  29727. let numSOSMarkers = 0;
  29728. const quantizationTables = [];
  29729. const huffmanTablesAC = [],
  29730. huffmanTablesDC = [];
  29731. let fileMarker = (0, _core_utils.readUint16)(data, offset);
  29732. offset += 2;
  29733. if (fileMarker !== 0xffd8) {
  29734. throw new JpegError("SOI not found");
  29735. }
  29736. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29737. offset += 2;
  29738. markerLoop: while (fileMarker !== 0xffd9) {
  29739. let i, j, l;
  29740. switch (fileMarker) {
  29741. case 0xffe0:
  29742. case 0xffe1:
  29743. case 0xffe2:
  29744. case 0xffe3:
  29745. case 0xffe4:
  29746. case 0xffe5:
  29747. case 0xffe6:
  29748. case 0xffe7:
  29749. case 0xffe8:
  29750. case 0xffe9:
  29751. case 0xffea:
  29752. case 0xffeb:
  29753. case 0xffec:
  29754. case 0xffed:
  29755. case 0xffee:
  29756. case 0xffef:
  29757. case 0xfffe:
  29758. const appData = readDataBlock();
  29759. if (fileMarker === 0xffe0) {
  29760. if (appData[0] === 0x4a && appData[1] === 0x46 && appData[2] === 0x49 && appData[3] === 0x46 && appData[4] === 0) {
  29761. jfif = {
  29762. version: {
  29763. major: appData[5],
  29764. minor: appData[6]
  29765. },
  29766. densityUnits: appData[7],
  29767. xDensity: appData[8] << 8 | appData[9],
  29768. yDensity: appData[10] << 8 | appData[11],
  29769. thumbWidth: appData[12],
  29770. thumbHeight: appData[13],
  29771. thumbData: appData.subarray(14, 14 + 3 * appData[12] * appData[13])
  29772. };
  29773. }
  29774. }
  29775. if (fileMarker === 0xffee) {
  29776. if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6f && appData[3] === 0x62 && appData[4] === 0x65) {
  29777. adobe = {
  29778. version: appData[5] << 8 | appData[6],
  29779. flags0: appData[7] << 8 | appData[8],
  29780. flags1: appData[9] << 8 | appData[10],
  29781. transformCode: appData[11]
  29782. };
  29783. }
  29784. }
  29785. break;
  29786. case 0xffdb:
  29787. const quantizationTablesLength = (0, _core_utils.readUint16)(data, offset);
  29788. offset += 2;
  29789. const quantizationTablesEnd = quantizationTablesLength + offset - 2;
  29790. let z;
  29791. while (offset < quantizationTablesEnd) {
  29792. const quantizationTableSpec = data[offset++];
  29793. const tableData = new Uint16Array(64);
  29794. if (quantizationTableSpec >> 4 === 0) {
  29795. for (j = 0; j < 64; j++) {
  29796. z = dctZigZag[j];
  29797. tableData[z] = data[offset++];
  29798. }
  29799. } else if (quantizationTableSpec >> 4 === 1) {
  29800. for (j = 0; j < 64; j++) {
  29801. z = dctZigZag[j];
  29802. tableData[z] = (0, _core_utils.readUint16)(data, offset);
  29803. offset += 2;
  29804. }
  29805. } else {
  29806. throw new JpegError("DQT - invalid table spec");
  29807. }
  29808. quantizationTables[quantizationTableSpec & 15] = tableData;
  29809. }
  29810. break;
  29811. case 0xffc0:
  29812. case 0xffc1:
  29813. case 0xffc2:
  29814. if (frame) {
  29815. throw new JpegError("Only single frame JPEGs supported");
  29816. }
  29817. offset += 2;
  29818. frame = {};
  29819. frame.extended = fileMarker === 0xffc1;
  29820. frame.progressive = fileMarker === 0xffc2;
  29821. frame.precision = data[offset++];
  29822. const sofScanLines = (0, _core_utils.readUint16)(data, offset);
  29823. offset += 2;
  29824. frame.scanLines = dnlScanLines || sofScanLines;
  29825. frame.samplesPerLine = (0, _core_utils.readUint16)(data, offset);
  29826. offset += 2;
  29827. frame.components = [];
  29828. frame.componentIds = {};
  29829. const componentsCount = data[offset++];
  29830. let maxH = 0,
  29831. maxV = 0;
  29832. for (i = 0; i < componentsCount; i++) {
  29833. const componentId = data[offset];
  29834. const h = data[offset + 1] >> 4;
  29835. const v = data[offset + 1] & 15;
  29836. if (maxH < h) {
  29837. maxH = h;
  29838. }
  29839. if (maxV < v) {
  29840. maxV = v;
  29841. }
  29842. const qId = data[offset + 2];
  29843. l = frame.components.push({
  29844. h,
  29845. v,
  29846. quantizationId: qId,
  29847. quantizationTable: null
  29848. });
  29849. frame.componentIds[componentId] = l - 1;
  29850. offset += 3;
  29851. }
  29852. frame.maxH = maxH;
  29853. frame.maxV = maxV;
  29854. prepareComponents(frame);
  29855. break;
  29856. case 0xffc4:
  29857. const huffmanLength = (0, _core_utils.readUint16)(data, offset);
  29858. offset += 2;
  29859. for (i = 2; i < huffmanLength;) {
  29860. const huffmanTableSpec = data[offset++];
  29861. const codeLengths = new Uint8Array(16);
  29862. let codeLengthSum = 0;
  29863. for (j = 0; j < 16; j++, offset++) {
  29864. codeLengthSum += codeLengths[j] = data[offset];
  29865. }
  29866. const huffmanValues = new Uint8Array(codeLengthSum);
  29867. for (j = 0; j < codeLengthSum; j++, offset++) {
  29868. huffmanValues[j] = data[offset];
  29869. }
  29870. i += 17 + codeLengthSum;
  29871. (huffmanTableSpec >> 4 === 0 ? huffmanTablesDC : huffmanTablesAC)[huffmanTableSpec & 15] = buildHuffmanTable(codeLengths, huffmanValues);
  29872. }
  29873. break;
  29874. case 0xffdd:
  29875. offset += 2;
  29876. resetInterval = (0, _core_utils.readUint16)(data, offset);
  29877. offset += 2;
  29878. break;
  29879. case 0xffda:
  29880. const parseDNLMarker = ++numSOSMarkers === 1 && !dnlScanLines;
  29881. offset += 2;
  29882. const selectorsCount = data[offset++],
  29883. components = [];
  29884. for (i = 0; i < selectorsCount; i++) {
  29885. const index = data[offset++];
  29886. const componentIndex = frame.componentIds[index];
  29887. const component = frame.components[componentIndex];
  29888. component.index = index;
  29889. const tableSpec = data[offset++];
  29890. component.huffmanTableDC = huffmanTablesDC[tableSpec >> 4];
  29891. component.huffmanTableAC = huffmanTablesAC[tableSpec & 15];
  29892. components.push(component);
  29893. }
  29894. const spectralStart = data[offset++],
  29895. spectralEnd = data[offset++],
  29896. successiveApproximation = data[offset++];
  29897. try {
  29898. const processed = decodeScan(data, offset, frame, components, resetInterval, spectralStart, spectralEnd, successiveApproximation >> 4, successiveApproximation & 15, parseDNLMarker);
  29899. offset += processed;
  29900. } catch (ex) {
  29901. if (ex instanceof DNLMarkerError) {
  29902. (0, _util.warn)(`${ex.message} -- attempting to re-parse the JPEG image.`);
  29903. return this.parse(data, {
  29904. dnlScanLines: ex.scanLines
  29905. });
  29906. } else if (ex instanceof EOIMarkerError) {
  29907. (0, _util.warn)(`${ex.message} -- ignoring the rest of the image data.`);
  29908. break markerLoop;
  29909. }
  29910. throw ex;
  29911. }
  29912. break;
  29913. case 0xffdc:
  29914. offset += 4;
  29915. break;
  29916. case 0xffff:
  29917. if (data[offset] !== 0xff) {
  29918. offset--;
  29919. }
  29920. break;
  29921. default:
  29922. const nextFileMarker = findNextFileMarker(data, offset - 2, offset - 3);
  29923. if (nextFileMarker && nextFileMarker.invalid) {
  29924. (0, _util.warn)("JpegImage.parse - unexpected data, current marker is: " + nextFileMarker.invalid);
  29925. offset = nextFileMarker.offset;
  29926. break;
  29927. }
  29928. if (!nextFileMarker || offset >= data.length - 1) {
  29929. (0, _util.warn)("JpegImage.parse - reached the end of the image data " + "without finding an EOI marker (0xFFD9).");
  29930. break markerLoop;
  29931. }
  29932. throw new JpegError("JpegImage.parse - unknown marker: " + fileMarker.toString(16));
  29933. }
  29934. fileMarker = (0, _core_utils.readUint16)(data, offset);
  29935. offset += 2;
  29936. }
  29937. this.width = frame.samplesPerLine;
  29938. this.height = frame.scanLines;
  29939. this.jfif = jfif;
  29940. this.adobe = adobe;
  29941. this.components = [];
  29942. for (let i = 0, ii = frame.components.length; i < ii; i++) {
  29943. const component = frame.components[i];
  29944. const quantizationTable = quantizationTables[component.quantizationId];
  29945. if (quantizationTable) {
  29946. component.quantizationTable = quantizationTable;
  29947. }
  29948. this.components.push({
  29949. index: component.index,
  29950. output: buildComponentData(frame, component),
  29951. scaleX: component.h / frame.maxH,
  29952. scaleY: component.v / frame.maxV,
  29953. blocksPerLine: component.blocksPerLine,
  29954. blocksPerColumn: component.blocksPerColumn
  29955. });
  29956. }
  29957. this.numComponents = this.components.length;
  29958. return undefined;
  29959. }
  29960. _getLinearizedBlockData(width, height, isSourcePDF = false) {
  29961. const scaleX = this.width / width,
  29962. scaleY = this.height / height;
  29963. let component, componentScaleX, componentScaleY, blocksPerScanline;
  29964. let x, y, i, j, k;
  29965. let index;
  29966. let offset = 0;
  29967. let output;
  29968. const numComponents = this.components.length;
  29969. const dataLength = width * height * numComponents;
  29970. const data = new Uint8ClampedArray(dataLength);
  29971. const xScaleBlockOffset = new Uint32Array(width);
  29972. const mask3LSB = 0xfffffff8;
  29973. let lastComponentScaleX;
  29974. for (i = 0; i < numComponents; i++) {
  29975. component = this.components[i];
  29976. componentScaleX = component.scaleX * scaleX;
  29977. componentScaleY = component.scaleY * scaleY;
  29978. offset = i;
  29979. output = component.output;
  29980. blocksPerScanline = component.blocksPerLine + 1 << 3;
  29981. if (componentScaleX !== lastComponentScaleX) {
  29982. for (x = 0; x < width; x++) {
  29983. j = 0 | x * componentScaleX;
  29984. xScaleBlockOffset[x] = (j & mask3LSB) << 3 | j & 7;
  29985. }
  29986. lastComponentScaleX = componentScaleX;
  29987. }
  29988. for (y = 0; y < height; y++) {
  29989. j = 0 | y * componentScaleY;
  29990. index = blocksPerScanline * (j & mask3LSB) | (j & 7) << 3;
  29991. for (x = 0; x < width; x++) {
  29992. data[offset] = output[index + xScaleBlockOffset[x]];
  29993. offset += numComponents;
  29994. }
  29995. }
  29996. }
  29997. let transform = this._decodeTransform;
  29998. if (!isSourcePDF && numComponents === 4 && !transform) {
  29999. transform = new Int32Array([-256, 255, -256, 255, -256, 255, -256, 255]);
  30000. }
  30001. if (transform) {
  30002. for (i = 0; i < dataLength;) {
  30003. for (j = 0, k = 0; j < numComponents; j++, i++, k += 2) {
  30004. data[i] = (data[i] * transform[k] >> 8) + transform[k + 1];
  30005. }
  30006. }
  30007. }
  30008. return data;
  30009. }
  30010. get _isColorConversionNeeded() {
  30011. if (this.adobe) {
  30012. return !!this.adobe.transformCode;
  30013. }
  30014. if (this.numComponents === 3) {
  30015. if (this._colorTransform === 0) {
  30016. return false;
  30017. } else if (this.components[0].index === 0x52 && this.components[1].index === 0x47 && this.components[2].index === 0x42) {
  30018. return false;
  30019. }
  30020. return true;
  30021. }
  30022. if (this._colorTransform === 1) {
  30023. return true;
  30024. }
  30025. return false;
  30026. }
  30027. _convertYccToRgb(data) {
  30028. let Y, Cb, Cr;
  30029. for (let i = 0, length = data.length; i < length; i += 3) {
  30030. Y = data[i];
  30031. Cb = data[i + 1];
  30032. Cr = data[i + 2];
  30033. data[i] = Y - 179.456 + 1.402 * Cr;
  30034. data[i + 1] = Y + 135.459 - 0.344 * Cb - 0.714 * Cr;
  30035. data[i + 2] = Y - 226.816 + 1.772 * Cb;
  30036. }
  30037. return data;
  30038. }
  30039. _convertYcckToRgb(data) {
  30040. let Y, Cb, Cr, k;
  30041. let offset = 0;
  30042. for (let i = 0, length = data.length; i < length; i += 4) {
  30043. Y = data[i];
  30044. Cb = data[i + 1];
  30045. Cr = data[i + 2];
  30046. k = data[i + 3];
  30047. 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);
  30048. 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);
  30049. 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);
  30050. }
  30051. return data.subarray(0, offset);
  30052. }
  30053. _convertYcckToCmyk(data) {
  30054. let Y, Cb, Cr;
  30055. for (let i = 0, length = data.length; i < length; i += 4) {
  30056. Y = data[i];
  30057. Cb = data[i + 1];
  30058. Cr = data[i + 2];
  30059. data[i] = 434.456 - Y - 1.402 * Cr;
  30060. data[i + 1] = 119.541 - Y + 0.344 * Cb + 0.714 * Cr;
  30061. data[i + 2] = 481.816 - Y - 1.772 * Cb;
  30062. }
  30063. return data;
  30064. }
  30065. _convertCmykToRgb(data) {
  30066. let c, m, y, k;
  30067. let offset = 0;
  30068. for (let i = 0, length = data.length; i < length; i += 4) {
  30069. c = data[i];
  30070. m = data[i + 1];
  30071. y = data[i + 2];
  30072. k = data[i + 3];
  30073. 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);
  30074. 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);
  30075. 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);
  30076. }
  30077. return data.subarray(0, offset);
  30078. }
  30079. getData({
  30080. width,
  30081. height,
  30082. forceRGB = false,
  30083. isSourcePDF = false
  30084. }) {
  30085. if (this.numComponents > 4) {
  30086. throw new JpegError("Unsupported color mode");
  30087. }
  30088. const data = this._getLinearizedBlockData(width, height, isSourcePDF);
  30089. if (this.numComponents === 1 && forceRGB) {
  30090. const dataLength = data.length;
  30091. const rgbData = new Uint8ClampedArray(dataLength * 3);
  30092. let offset = 0;
  30093. for (let i = 0; i < dataLength; i++) {
  30094. const grayColor = data[i];
  30095. rgbData[offset++] = grayColor;
  30096. rgbData[offset++] = grayColor;
  30097. rgbData[offset++] = grayColor;
  30098. }
  30099. return rgbData;
  30100. } else if (this.numComponents === 3 && this._isColorConversionNeeded) {
  30101. return this._convertYccToRgb(data);
  30102. } else if (this.numComponents === 4) {
  30103. if (this._isColorConversionNeeded) {
  30104. if (forceRGB) {
  30105. return this._convertYcckToRgb(data);
  30106. }
  30107. return this._convertYcckToCmyk(data);
  30108. } else if (forceRGB) {
  30109. return this._convertCmykToRgb(data);
  30110. }
  30111. }
  30112. return data;
  30113. }
  30114. }
  30115. exports.JpegImage = JpegImage;
  30116. /***/ }),
  30117. /* 39 */
  30118. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  30119. Object.defineProperty(exports, "__esModule", ({
  30120. value: true
  30121. }));
  30122. exports.JpxStream = void 0;
  30123. var _decode_stream = __w_pdfjs_require__(29);
  30124. var _jpx = __w_pdfjs_require__(40);
  30125. var _util = __w_pdfjs_require__(2);
  30126. class JpxStream extends _decode_stream.DecodeStream {
  30127. constructor(stream, maybeLength, params) {
  30128. super(maybeLength);
  30129. this.stream = stream;
  30130. this.dict = stream.dict;
  30131. this.maybeLength = maybeLength;
  30132. this.params = params;
  30133. }
  30134. get bytes() {
  30135. return (0, _util.shadow)(this, "bytes", this.stream.getBytes(this.maybeLength));
  30136. }
  30137. ensureBuffer(requested) {}
  30138. readBlock() {
  30139. if (this.eof) {
  30140. return;
  30141. }
  30142. const jpxImage = new _jpx.JpxImage();
  30143. jpxImage.parse(this.bytes);
  30144. const width = jpxImage.width;
  30145. const height = jpxImage.height;
  30146. const componentsCount = jpxImage.componentsCount;
  30147. const tileCount = jpxImage.tiles.length;
  30148. if (tileCount === 1) {
  30149. this.buffer = jpxImage.tiles[0].items;
  30150. } else {
  30151. const data = new Uint8ClampedArray(width * height * componentsCount);
  30152. for (let k = 0; k < tileCount; k++) {
  30153. const tileComponents = jpxImage.tiles[k];
  30154. const tileWidth = tileComponents.width;
  30155. const tileHeight = tileComponents.height;
  30156. const tileLeft = tileComponents.left;
  30157. const tileTop = tileComponents.top;
  30158. const src = tileComponents.items;
  30159. let srcPosition = 0;
  30160. let dataPosition = (width * tileTop + tileLeft) * componentsCount;
  30161. const imgRowSize = width * componentsCount;
  30162. const tileRowSize = tileWidth * componentsCount;
  30163. for (let j = 0; j < tileHeight; j++) {
  30164. const rowBytes = src.subarray(srcPosition, srcPosition + tileRowSize);
  30165. data.set(rowBytes, dataPosition);
  30166. srcPosition += tileRowSize;
  30167. dataPosition += imgRowSize;
  30168. }
  30169. }
  30170. this.buffer = data;
  30171. }
  30172. this.bufferLength = this.buffer.length;
  30173. this.eof = true;
  30174. }
  30175. }
  30176. exports.JpxStream = JpxStream;
  30177. /***/ }),
  30178. /* 40 */
  30179. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  30180. Object.defineProperty(exports, "__esModule", ({
  30181. value: true
  30182. }));
  30183. exports.JpxImage = void 0;
  30184. var _util = __w_pdfjs_require__(2);
  30185. var _core_utils = __w_pdfjs_require__(8);
  30186. var _arithmetic_decoder = __w_pdfjs_require__(36);
  30187. class JpxError extends _util.BaseException {
  30188. constructor(msg) {
  30189. super(`JPX error: ${msg}`, "JpxError");
  30190. }
  30191. }
  30192. const SubbandsGainLog2 = {
  30193. LL: 0,
  30194. LH: 1,
  30195. HL: 1,
  30196. HH: 2
  30197. };
  30198. class JpxImage {
  30199. constructor() {
  30200. this.failOnCorruptedImage = false;
  30201. }
  30202. parse(data) {
  30203. const head = (0, _core_utils.readUint16)(data, 0);
  30204. if (head === 0xff4f) {
  30205. this.parseCodestream(data, 0, data.length);
  30206. return;
  30207. }
  30208. const length = data.length;
  30209. let position = 0;
  30210. while (position < length) {
  30211. let headerSize = 8;
  30212. let lbox = (0, _core_utils.readUint32)(data, position);
  30213. const tbox = (0, _core_utils.readUint32)(data, position + 4);
  30214. position += headerSize;
  30215. if (lbox === 1) {
  30216. lbox = (0, _core_utils.readUint32)(data, position) * 4294967296 + (0, _core_utils.readUint32)(data, position + 4);
  30217. position += 8;
  30218. headerSize += 8;
  30219. }
  30220. if (lbox === 0) {
  30221. lbox = length - position + headerSize;
  30222. }
  30223. if (lbox < headerSize) {
  30224. throw new JpxError("Invalid box field size");
  30225. }
  30226. const dataLength = lbox - headerSize;
  30227. let jumpDataLength = true;
  30228. switch (tbox) {
  30229. case 0x6a703268:
  30230. jumpDataLength = false;
  30231. break;
  30232. case 0x636f6c72:
  30233. const method = data[position];
  30234. if (method === 1) {
  30235. const colorspace = (0, _core_utils.readUint32)(data, position + 3);
  30236. switch (colorspace) {
  30237. case 16:
  30238. case 17:
  30239. case 18:
  30240. break;
  30241. default:
  30242. (0, _util.warn)("Unknown colorspace " + colorspace);
  30243. break;
  30244. }
  30245. } else if (method === 2) {
  30246. (0, _util.info)("ICC profile not supported");
  30247. }
  30248. break;
  30249. case 0x6a703263:
  30250. this.parseCodestream(data, position, position + dataLength);
  30251. break;
  30252. case 0x6a502020:
  30253. if ((0, _core_utils.readUint32)(data, position) !== 0x0d0a870a) {
  30254. (0, _util.warn)("Invalid JP2 signature");
  30255. }
  30256. break;
  30257. case 0x6a501a1a:
  30258. case 0x66747970:
  30259. case 0x72726571:
  30260. case 0x72657320:
  30261. case 0x69686472:
  30262. break;
  30263. default:
  30264. const headerType = String.fromCharCode(tbox >> 24 & 0xff, tbox >> 16 & 0xff, tbox >> 8 & 0xff, tbox & 0xff);
  30265. (0, _util.warn)(`Unsupported header type ${tbox} (${headerType}).`);
  30266. break;
  30267. }
  30268. if (jumpDataLength) {
  30269. position += dataLength;
  30270. }
  30271. }
  30272. }
  30273. parseImageProperties(stream) {
  30274. let newByte = stream.getByte();
  30275. while (newByte >= 0) {
  30276. const oldByte = newByte;
  30277. newByte = stream.getByte();
  30278. const code = oldByte << 8 | newByte;
  30279. if (code === 0xff51) {
  30280. stream.skip(4);
  30281. const Xsiz = stream.getInt32() >>> 0;
  30282. const Ysiz = stream.getInt32() >>> 0;
  30283. const XOsiz = stream.getInt32() >>> 0;
  30284. const YOsiz = stream.getInt32() >>> 0;
  30285. stream.skip(16);
  30286. const Csiz = stream.getUint16();
  30287. this.width = Xsiz - XOsiz;
  30288. this.height = Ysiz - YOsiz;
  30289. this.componentsCount = Csiz;
  30290. this.bitsPerComponent = 8;
  30291. return;
  30292. }
  30293. }
  30294. throw new JpxError("No size marker found in JPX stream");
  30295. }
  30296. parseCodestream(data, start, end) {
  30297. const context = {};
  30298. let doNotRecover = false;
  30299. try {
  30300. let position = start;
  30301. while (position + 1 < end) {
  30302. const code = (0, _core_utils.readUint16)(data, position);
  30303. position += 2;
  30304. let length = 0,
  30305. j,
  30306. sqcd,
  30307. spqcds,
  30308. spqcdSize,
  30309. scalarExpounded,
  30310. tile;
  30311. switch (code) {
  30312. case 0xff4f:
  30313. context.mainHeader = true;
  30314. break;
  30315. case 0xffd9:
  30316. break;
  30317. case 0xff51:
  30318. length = (0, _core_utils.readUint16)(data, position);
  30319. const siz = {};
  30320. siz.Xsiz = (0, _core_utils.readUint32)(data, position + 4);
  30321. siz.Ysiz = (0, _core_utils.readUint32)(data, position + 8);
  30322. siz.XOsiz = (0, _core_utils.readUint32)(data, position + 12);
  30323. siz.YOsiz = (0, _core_utils.readUint32)(data, position + 16);
  30324. siz.XTsiz = (0, _core_utils.readUint32)(data, position + 20);
  30325. siz.YTsiz = (0, _core_utils.readUint32)(data, position + 24);
  30326. siz.XTOsiz = (0, _core_utils.readUint32)(data, position + 28);
  30327. siz.YTOsiz = (0, _core_utils.readUint32)(data, position + 32);
  30328. const componentsCount = (0, _core_utils.readUint16)(data, position + 36);
  30329. siz.Csiz = componentsCount;
  30330. const components = [];
  30331. j = position + 38;
  30332. for (let i = 0; i < componentsCount; i++) {
  30333. const component = {
  30334. precision: (data[j] & 0x7f) + 1,
  30335. isSigned: !!(data[j] & 0x80),
  30336. XRsiz: data[j + 1],
  30337. YRsiz: data[j + 2]
  30338. };
  30339. j += 3;
  30340. calculateComponentDimensions(component, siz);
  30341. components.push(component);
  30342. }
  30343. context.SIZ = siz;
  30344. context.components = components;
  30345. calculateTileGrids(context, components);
  30346. context.QCC = [];
  30347. context.COC = [];
  30348. break;
  30349. case 0xff5c:
  30350. length = (0, _core_utils.readUint16)(data, position);
  30351. const qcd = {};
  30352. j = position + 2;
  30353. sqcd = data[j++];
  30354. switch (sqcd & 0x1f) {
  30355. case 0:
  30356. spqcdSize = 8;
  30357. scalarExpounded = true;
  30358. break;
  30359. case 1:
  30360. spqcdSize = 16;
  30361. scalarExpounded = false;
  30362. break;
  30363. case 2:
  30364. spqcdSize = 16;
  30365. scalarExpounded = true;
  30366. break;
  30367. default:
  30368. throw new Error("Invalid SQcd value " + sqcd);
  30369. }
  30370. qcd.noQuantization = spqcdSize === 8;
  30371. qcd.scalarExpounded = scalarExpounded;
  30372. qcd.guardBits = sqcd >> 5;
  30373. spqcds = [];
  30374. while (j < length + position) {
  30375. const spqcd = {};
  30376. if (spqcdSize === 8) {
  30377. spqcd.epsilon = data[j++] >> 3;
  30378. spqcd.mu = 0;
  30379. } else {
  30380. spqcd.epsilon = data[j] >> 3;
  30381. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30382. j += 2;
  30383. }
  30384. spqcds.push(spqcd);
  30385. }
  30386. qcd.SPqcds = spqcds;
  30387. if (context.mainHeader) {
  30388. context.QCD = qcd;
  30389. } else {
  30390. context.currentTile.QCD = qcd;
  30391. context.currentTile.QCC = [];
  30392. }
  30393. break;
  30394. case 0xff5d:
  30395. length = (0, _core_utils.readUint16)(data, position);
  30396. const qcc = {};
  30397. j = position + 2;
  30398. let cqcc;
  30399. if (context.SIZ.Csiz < 257) {
  30400. cqcc = data[j++];
  30401. } else {
  30402. cqcc = (0, _core_utils.readUint16)(data, j);
  30403. j += 2;
  30404. }
  30405. sqcd = data[j++];
  30406. switch (sqcd & 0x1f) {
  30407. case 0:
  30408. spqcdSize = 8;
  30409. scalarExpounded = true;
  30410. break;
  30411. case 1:
  30412. spqcdSize = 16;
  30413. scalarExpounded = false;
  30414. break;
  30415. case 2:
  30416. spqcdSize = 16;
  30417. scalarExpounded = true;
  30418. break;
  30419. default:
  30420. throw new Error("Invalid SQcd value " + sqcd);
  30421. }
  30422. qcc.noQuantization = spqcdSize === 8;
  30423. qcc.scalarExpounded = scalarExpounded;
  30424. qcc.guardBits = sqcd >> 5;
  30425. spqcds = [];
  30426. while (j < length + position) {
  30427. const spqcd = {};
  30428. if (spqcdSize === 8) {
  30429. spqcd.epsilon = data[j++] >> 3;
  30430. spqcd.mu = 0;
  30431. } else {
  30432. spqcd.epsilon = data[j] >> 3;
  30433. spqcd.mu = (data[j] & 0x7) << 8 | data[j + 1];
  30434. j += 2;
  30435. }
  30436. spqcds.push(spqcd);
  30437. }
  30438. qcc.SPqcds = spqcds;
  30439. if (context.mainHeader) {
  30440. context.QCC[cqcc] = qcc;
  30441. } else {
  30442. context.currentTile.QCC[cqcc] = qcc;
  30443. }
  30444. break;
  30445. case 0xff52:
  30446. length = (0, _core_utils.readUint16)(data, position);
  30447. const cod = {};
  30448. j = position + 2;
  30449. const scod = data[j++];
  30450. cod.entropyCoderWithCustomPrecincts = !!(scod & 1);
  30451. cod.sopMarkerUsed = !!(scod & 2);
  30452. cod.ephMarkerUsed = !!(scod & 4);
  30453. cod.progressionOrder = data[j++];
  30454. cod.layersCount = (0, _core_utils.readUint16)(data, j);
  30455. j += 2;
  30456. cod.multipleComponentTransform = data[j++];
  30457. cod.decompositionLevelsCount = data[j++];
  30458. cod.xcb = (data[j++] & 0xf) + 2;
  30459. cod.ycb = (data[j++] & 0xf) + 2;
  30460. const blockStyle = data[j++];
  30461. cod.selectiveArithmeticCodingBypass = !!(blockStyle & 1);
  30462. cod.resetContextProbabilities = !!(blockStyle & 2);
  30463. cod.terminationOnEachCodingPass = !!(blockStyle & 4);
  30464. cod.verticallyStripe = !!(blockStyle & 8);
  30465. cod.predictableTermination = !!(blockStyle & 16);
  30466. cod.segmentationSymbolUsed = !!(blockStyle & 32);
  30467. cod.reversibleTransformation = data[j++];
  30468. if (cod.entropyCoderWithCustomPrecincts) {
  30469. const precinctsSizes = [];
  30470. while (j < length + position) {
  30471. const precinctsSize = data[j++];
  30472. precinctsSizes.push({
  30473. PPx: precinctsSize & 0xf,
  30474. PPy: precinctsSize >> 4
  30475. });
  30476. }
  30477. cod.precinctsSizes = precinctsSizes;
  30478. }
  30479. const unsupported = [];
  30480. if (cod.selectiveArithmeticCodingBypass) {
  30481. unsupported.push("selectiveArithmeticCodingBypass");
  30482. }
  30483. if (cod.terminationOnEachCodingPass) {
  30484. unsupported.push("terminationOnEachCodingPass");
  30485. }
  30486. if (cod.verticallyStripe) {
  30487. unsupported.push("verticallyStripe");
  30488. }
  30489. if (cod.predictableTermination) {
  30490. unsupported.push("predictableTermination");
  30491. }
  30492. if (unsupported.length > 0) {
  30493. doNotRecover = true;
  30494. (0, _util.warn)(`JPX: Unsupported COD options (${unsupported.join(", ")}).`);
  30495. }
  30496. if (context.mainHeader) {
  30497. context.COD = cod;
  30498. } else {
  30499. context.currentTile.COD = cod;
  30500. context.currentTile.COC = [];
  30501. }
  30502. break;
  30503. case 0xff90:
  30504. length = (0, _core_utils.readUint16)(data, position);
  30505. tile = {};
  30506. tile.index = (0, _core_utils.readUint16)(data, position + 2);
  30507. tile.length = (0, _core_utils.readUint32)(data, position + 4);
  30508. tile.dataEnd = tile.length + position - 2;
  30509. tile.partIndex = data[position + 8];
  30510. tile.partsCount = data[position + 9];
  30511. context.mainHeader = false;
  30512. if (tile.partIndex === 0) {
  30513. tile.COD = context.COD;
  30514. tile.COC = context.COC.slice(0);
  30515. tile.QCD = context.QCD;
  30516. tile.QCC = context.QCC.slice(0);
  30517. }
  30518. context.currentTile = tile;
  30519. break;
  30520. case 0xff93:
  30521. tile = context.currentTile;
  30522. if (tile.partIndex === 0) {
  30523. initializeTile(context, tile.index);
  30524. buildPackets(context);
  30525. }
  30526. length = tile.dataEnd - position;
  30527. parseTilePackets(context, data, position, length);
  30528. break;
  30529. case 0xff53:
  30530. (0, _util.warn)("JPX: Codestream code 0xFF53 (COC) is not implemented.");
  30531. case 0xff55:
  30532. case 0xff57:
  30533. case 0xff58:
  30534. case 0xff64:
  30535. length = (0, _core_utils.readUint16)(data, position);
  30536. break;
  30537. default:
  30538. throw new Error("Unknown codestream code: " + code.toString(16));
  30539. }
  30540. position += length;
  30541. }
  30542. } catch (e) {
  30543. if (doNotRecover || this.failOnCorruptedImage) {
  30544. throw new JpxError(e.message);
  30545. } else {
  30546. (0, _util.warn)(`JPX: Trying to recover from: "${e.message}".`);
  30547. }
  30548. }
  30549. this.tiles = transformComponents(context);
  30550. this.width = context.SIZ.Xsiz - context.SIZ.XOsiz;
  30551. this.height = context.SIZ.Ysiz - context.SIZ.YOsiz;
  30552. this.componentsCount = context.SIZ.Csiz;
  30553. }
  30554. }
  30555. exports.JpxImage = JpxImage;
  30556. function calculateComponentDimensions(component, siz) {
  30557. component.x0 = Math.ceil(siz.XOsiz / component.XRsiz);
  30558. component.x1 = Math.ceil(siz.Xsiz / component.XRsiz);
  30559. component.y0 = Math.ceil(siz.YOsiz / component.YRsiz);
  30560. component.y1 = Math.ceil(siz.Ysiz / component.YRsiz);
  30561. component.width = component.x1 - component.x0;
  30562. component.height = component.y1 - component.y0;
  30563. }
  30564. function calculateTileGrids(context, components) {
  30565. const siz = context.SIZ;
  30566. const tiles = [];
  30567. let tile;
  30568. const numXtiles = Math.ceil((siz.Xsiz - siz.XTOsiz) / siz.XTsiz);
  30569. const numYtiles = Math.ceil((siz.Ysiz - siz.YTOsiz) / siz.YTsiz);
  30570. for (let q = 0; q < numYtiles; q++) {
  30571. for (let p = 0; p < numXtiles; p++) {
  30572. tile = {};
  30573. tile.tx0 = Math.max(siz.XTOsiz + p * siz.XTsiz, siz.XOsiz);
  30574. tile.ty0 = Math.max(siz.YTOsiz + q * siz.YTsiz, siz.YOsiz);
  30575. tile.tx1 = Math.min(siz.XTOsiz + (p + 1) * siz.XTsiz, siz.Xsiz);
  30576. tile.ty1 = Math.min(siz.YTOsiz + (q + 1) * siz.YTsiz, siz.Ysiz);
  30577. tile.width = tile.tx1 - tile.tx0;
  30578. tile.height = tile.ty1 - tile.ty0;
  30579. tile.components = [];
  30580. tiles.push(tile);
  30581. }
  30582. }
  30583. context.tiles = tiles;
  30584. const componentsCount = siz.Csiz;
  30585. for (let i = 0, ii = componentsCount; i < ii; i++) {
  30586. const component = components[i];
  30587. for (let j = 0, jj = tiles.length; j < jj; j++) {
  30588. const tileComponent = {};
  30589. tile = tiles[j];
  30590. tileComponent.tcx0 = Math.ceil(tile.tx0 / component.XRsiz);
  30591. tileComponent.tcy0 = Math.ceil(tile.ty0 / component.YRsiz);
  30592. tileComponent.tcx1 = Math.ceil(tile.tx1 / component.XRsiz);
  30593. tileComponent.tcy1 = Math.ceil(tile.ty1 / component.YRsiz);
  30594. tileComponent.width = tileComponent.tcx1 - tileComponent.tcx0;
  30595. tileComponent.height = tileComponent.tcy1 - tileComponent.tcy0;
  30596. tile.components[i] = tileComponent;
  30597. }
  30598. }
  30599. }
  30600. function getBlocksDimensions(context, component, r) {
  30601. const codOrCoc = component.codingStyleParameters;
  30602. const result = {};
  30603. if (!codOrCoc.entropyCoderWithCustomPrecincts) {
  30604. result.PPx = 15;
  30605. result.PPy = 15;
  30606. } else {
  30607. result.PPx = codOrCoc.precinctsSizes[r].PPx;
  30608. result.PPy = codOrCoc.precinctsSizes[r].PPy;
  30609. }
  30610. result.xcb_ = r > 0 ? Math.min(codOrCoc.xcb, result.PPx - 1) : Math.min(codOrCoc.xcb, result.PPx);
  30611. result.ycb_ = r > 0 ? Math.min(codOrCoc.ycb, result.PPy - 1) : Math.min(codOrCoc.ycb, result.PPy);
  30612. return result;
  30613. }
  30614. function buildPrecincts(context, resolution, dimensions) {
  30615. const precinctWidth = 1 << dimensions.PPx;
  30616. const precinctHeight = 1 << dimensions.PPy;
  30617. const isZeroRes = resolution.resLevel === 0;
  30618. const precinctWidthInSubband = 1 << dimensions.PPx + (isZeroRes ? 0 : -1);
  30619. const precinctHeightInSubband = 1 << dimensions.PPy + (isZeroRes ? 0 : -1);
  30620. const numprecinctswide = resolution.trx1 > resolution.trx0 ? Math.ceil(resolution.trx1 / precinctWidth) - Math.floor(resolution.trx0 / precinctWidth) : 0;
  30621. const numprecinctshigh = resolution.try1 > resolution.try0 ? Math.ceil(resolution.try1 / precinctHeight) - Math.floor(resolution.try0 / precinctHeight) : 0;
  30622. const numprecincts = numprecinctswide * numprecinctshigh;
  30623. resolution.precinctParameters = {
  30624. precinctWidth,
  30625. precinctHeight,
  30626. numprecinctswide,
  30627. numprecinctshigh,
  30628. numprecincts,
  30629. precinctWidthInSubband,
  30630. precinctHeightInSubband
  30631. };
  30632. }
  30633. function buildCodeblocks(context, subband, dimensions) {
  30634. const xcb_ = dimensions.xcb_;
  30635. const ycb_ = dimensions.ycb_;
  30636. const codeblockWidth = 1 << xcb_;
  30637. const codeblockHeight = 1 << ycb_;
  30638. const cbx0 = subband.tbx0 >> xcb_;
  30639. const cby0 = subband.tby0 >> ycb_;
  30640. const cbx1 = subband.tbx1 + codeblockWidth - 1 >> xcb_;
  30641. const cby1 = subband.tby1 + codeblockHeight - 1 >> ycb_;
  30642. const precinctParameters = subband.resolution.precinctParameters;
  30643. const codeblocks = [];
  30644. const precincts = [];
  30645. let i, j, codeblock, precinctNumber;
  30646. for (j = cby0; j < cby1; j++) {
  30647. for (i = cbx0; i < cbx1; i++) {
  30648. codeblock = {
  30649. cbx: i,
  30650. cby: j,
  30651. tbx0: codeblockWidth * i,
  30652. tby0: codeblockHeight * j,
  30653. tbx1: codeblockWidth * (i + 1),
  30654. tby1: codeblockHeight * (j + 1)
  30655. };
  30656. codeblock.tbx0_ = Math.max(subband.tbx0, codeblock.tbx0);
  30657. codeblock.tby0_ = Math.max(subband.tby0, codeblock.tby0);
  30658. codeblock.tbx1_ = Math.min(subband.tbx1, codeblock.tbx1);
  30659. codeblock.tby1_ = Math.min(subband.tby1, codeblock.tby1);
  30660. const pi = Math.floor((codeblock.tbx0_ - subband.tbx0) / precinctParameters.precinctWidthInSubband);
  30661. const pj = Math.floor((codeblock.tby0_ - subband.tby0) / precinctParameters.precinctHeightInSubband);
  30662. precinctNumber = pi + pj * precinctParameters.numprecinctswide;
  30663. codeblock.precinctNumber = precinctNumber;
  30664. codeblock.subbandType = subband.type;
  30665. codeblock.Lblock = 3;
  30666. if (codeblock.tbx1_ <= codeblock.tbx0_ || codeblock.tby1_ <= codeblock.tby0_) {
  30667. continue;
  30668. }
  30669. codeblocks.push(codeblock);
  30670. let precinct = precincts[precinctNumber];
  30671. if (precinct !== undefined) {
  30672. if (i < precinct.cbxMin) {
  30673. precinct.cbxMin = i;
  30674. } else if (i > precinct.cbxMax) {
  30675. precinct.cbxMax = i;
  30676. }
  30677. if (j < precinct.cbyMin) {
  30678. precinct.cbxMin = j;
  30679. } else if (j > precinct.cbyMax) {
  30680. precinct.cbyMax = j;
  30681. }
  30682. } else {
  30683. precincts[precinctNumber] = precinct = {
  30684. cbxMin: i,
  30685. cbyMin: j,
  30686. cbxMax: i,
  30687. cbyMax: j
  30688. };
  30689. }
  30690. codeblock.precinct = precinct;
  30691. }
  30692. }
  30693. subband.codeblockParameters = {
  30694. codeblockWidth: xcb_,
  30695. codeblockHeight: ycb_,
  30696. numcodeblockwide: cbx1 - cbx0 + 1,
  30697. numcodeblockhigh: cby1 - cby0 + 1
  30698. };
  30699. subband.codeblocks = codeblocks;
  30700. subband.precincts = precincts;
  30701. }
  30702. function createPacket(resolution, precinctNumber, layerNumber) {
  30703. const precinctCodeblocks = [];
  30704. const subbands = resolution.subbands;
  30705. for (let i = 0, ii = subbands.length; i < ii; i++) {
  30706. const subband = subbands[i];
  30707. const codeblocks = subband.codeblocks;
  30708. for (let j = 0, jj = codeblocks.length; j < jj; j++) {
  30709. const codeblock = codeblocks[j];
  30710. if (codeblock.precinctNumber !== precinctNumber) {
  30711. continue;
  30712. }
  30713. precinctCodeblocks.push(codeblock);
  30714. }
  30715. }
  30716. return {
  30717. layerNumber,
  30718. codeblocks: precinctCodeblocks
  30719. };
  30720. }
  30721. function LayerResolutionComponentPositionIterator(context) {
  30722. const siz = context.SIZ;
  30723. const tileIndex = context.currentTile.index;
  30724. const tile = context.tiles[tileIndex];
  30725. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30726. const componentsCount = siz.Csiz;
  30727. let maxDecompositionLevelsCount = 0;
  30728. for (let q = 0; q < componentsCount; q++) {
  30729. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30730. }
  30731. let l = 0,
  30732. r = 0,
  30733. i = 0,
  30734. k = 0;
  30735. this.nextPacket = function JpxImage_nextPacket() {
  30736. for (; l < layersCount; l++) {
  30737. for (; r <= maxDecompositionLevelsCount; r++) {
  30738. for (; i < componentsCount; i++) {
  30739. const component = tile.components[i];
  30740. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30741. continue;
  30742. }
  30743. const resolution = component.resolutions[r];
  30744. const numprecincts = resolution.precinctParameters.numprecincts;
  30745. for (; k < numprecincts;) {
  30746. const packet = createPacket(resolution, k, l);
  30747. k++;
  30748. return packet;
  30749. }
  30750. k = 0;
  30751. }
  30752. i = 0;
  30753. }
  30754. r = 0;
  30755. }
  30756. throw new JpxError("Out of packets");
  30757. };
  30758. }
  30759. function ResolutionLayerComponentPositionIterator(context) {
  30760. const siz = context.SIZ;
  30761. const tileIndex = context.currentTile.index;
  30762. const tile = context.tiles[tileIndex];
  30763. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30764. const componentsCount = siz.Csiz;
  30765. let maxDecompositionLevelsCount = 0;
  30766. for (let q = 0; q < componentsCount; q++) {
  30767. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, tile.components[q].codingStyleParameters.decompositionLevelsCount);
  30768. }
  30769. let r = 0,
  30770. l = 0,
  30771. i = 0,
  30772. k = 0;
  30773. this.nextPacket = function JpxImage_nextPacket() {
  30774. for (; r <= maxDecompositionLevelsCount; r++) {
  30775. for (; l < layersCount; l++) {
  30776. for (; i < componentsCount; i++) {
  30777. const component = tile.components[i];
  30778. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30779. continue;
  30780. }
  30781. const resolution = component.resolutions[r];
  30782. const numprecincts = resolution.precinctParameters.numprecincts;
  30783. for (; k < numprecincts;) {
  30784. const packet = createPacket(resolution, k, l);
  30785. k++;
  30786. return packet;
  30787. }
  30788. k = 0;
  30789. }
  30790. i = 0;
  30791. }
  30792. l = 0;
  30793. }
  30794. throw new JpxError("Out of packets");
  30795. };
  30796. }
  30797. function ResolutionPositionComponentLayerIterator(context) {
  30798. const siz = context.SIZ;
  30799. const tileIndex = context.currentTile.index;
  30800. const tile = context.tiles[tileIndex];
  30801. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30802. const componentsCount = siz.Csiz;
  30803. let l, r, c, p;
  30804. let maxDecompositionLevelsCount = 0;
  30805. for (c = 0; c < componentsCount; c++) {
  30806. const component = tile.components[c];
  30807. maxDecompositionLevelsCount = Math.max(maxDecompositionLevelsCount, component.codingStyleParameters.decompositionLevelsCount);
  30808. }
  30809. const maxNumPrecinctsInLevel = new Int32Array(maxDecompositionLevelsCount + 1);
  30810. for (r = 0; r <= maxDecompositionLevelsCount; ++r) {
  30811. let maxNumPrecincts = 0;
  30812. for (c = 0; c < componentsCount; ++c) {
  30813. const resolutions = tile.components[c].resolutions;
  30814. if (r < resolutions.length) {
  30815. maxNumPrecincts = Math.max(maxNumPrecincts, resolutions[r].precinctParameters.numprecincts);
  30816. }
  30817. }
  30818. maxNumPrecinctsInLevel[r] = maxNumPrecincts;
  30819. }
  30820. l = 0;
  30821. r = 0;
  30822. c = 0;
  30823. p = 0;
  30824. this.nextPacket = function JpxImage_nextPacket() {
  30825. for (; r <= maxDecompositionLevelsCount; r++) {
  30826. for (; p < maxNumPrecinctsInLevel[r]; p++) {
  30827. for (; c < componentsCount; c++) {
  30828. const component = tile.components[c];
  30829. if (r > component.codingStyleParameters.decompositionLevelsCount) {
  30830. continue;
  30831. }
  30832. const resolution = component.resolutions[r];
  30833. const numprecincts = resolution.precinctParameters.numprecincts;
  30834. if (p >= numprecincts) {
  30835. continue;
  30836. }
  30837. for (; l < layersCount;) {
  30838. const packet = createPacket(resolution, p, l);
  30839. l++;
  30840. return packet;
  30841. }
  30842. l = 0;
  30843. }
  30844. c = 0;
  30845. }
  30846. p = 0;
  30847. }
  30848. throw new JpxError("Out of packets");
  30849. };
  30850. }
  30851. function PositionComponentResolutionLayerIterator(context) {
  30852. const siz = context.SIZ;
  30853. const tileIndex = context.currentTile.index;
  30854. const tile = context.tiles[tileIndex];
  30855. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30856. const componentsCount = siz.Csiz;
  30857. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30858. const precinctsIterationSizes = precinctsSizes;
  30859. let l = 0,
  30860. r = 0,
  30861. c = 0,
  30862. px = 0,
  30863. py = 0;
  30864. this.nextPacket = function JpxImage_nextPacket() {
  30865. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30866. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30867. for (; c < componentsCount; c++) {
  30868. const component = tile.components[c];
  30869. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30870. for (; r <= decompositionLevelsCount; r++) {
  30871. const resolution = component.resolutions[r];
  30872. const sizeInImageScale = precinctsSizes.components[c].resolutions[r];
  30873. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30874. if (k === null) {
  30875. continue;
  30876. }
  30877. for (; l < layersCount;) {
  30878. const packet = createPacket(resolution, k, l);
  30879. l++;
  30880. return packet;
  30881. }
  30882. l = 0;
  30883. }
  30884. r = 0;
  30885. }
  30886. c = 0;
  30887. }
  30888. px = 0;
  30889. }
  30890. throw new JpxError("Out of packets");
  30891. };
  30892. }
  30893. function ComponentPositionResolutionLayerIterator(context) {
  30894. const siz = context.SIZ;
  30895. const tileIndex = context.currentTile.index;
  30896. const tile = context.tiles[tileIndex];
  30897. const layersCount = tile.codingStyleDefaultParameters.layersCount;
  30898. const componentsCount = siz.Csiz;
  30899. const precinctsSizes = getPrecinctSizesInImageScale(tile);
  30900. let l = 0,
  30901. r = 0,
  30902. c = 0,
  30903. px = 0,
  30904. py = 0;
  30905. this.nextPacket = function JpxImage_nextPacket() {
  30906. for (; c < componentsCount; ++c) {
  30907. const component = tile.components[c];
  30908. const precinctsIterationSizes = precinctsSizes.components[c];
  30909. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30910. for (; py < precinctsIterationSizes.maxNumHigh; py++) {
  30911. for (; px < precinctsIterationSizes.maxNumWide; px++) {
  30912. for (; r <= decompositionLevelsCount; r++) {
  30913. const resolution = component.resolutions[r];
  30914. const sizeInImageScale = precinctsIterationSizes.resolutions[r];
  30915. const k = getPrecinctIndexIfExist(px, py, sizeInImageScale, precinctsIterationSizes, resolution);
  30916. if (k === null) {
  30917. continue;
  30918. }
  30919. for (; l < layersCount;) {
  30920. const packet = createPacket(resolution, k, l);
  30921. l++;
  30922. return packet;
  30923. }
  30924. l = 0;
  30925. }
  30926. r = 0;
  30927. }
  30928. px = 0;
  30929. }
  30930. py = 0;
  30931. }
  30932. throw new JpxError("Out of packets");
  30933. };
  30934. }
  30935. function getPrecinctIndexIfExist(pxIndex, pyIndex, sizeInImageScale, precinctIterationSizes, resolution) {
  30936. const posX = pxIndex * precinctIterationSizes.minWidth;
  30937. const posY = pyIndex * precinctIterationSizes.minHeight;
  30938. if (posX % sizeInImageScale.width !== 0 || posY % sizeInImageScale.height !== 0) {
  30939. return null;
  30940. }
  30941. const startPrecinctRowIndex = posY / sizeInImageScale.width * resolution.precinctParameters.numprecinctswide;
  30942. return posX / sizeInImageScale.height + startPrecinctRowIndex;
  30943. }
  30944. function getPrecinctSizesInImageScale(tile) {
  30945. const componentsCount = tile.components.length;
  30946. let minWidth = Number.MAX_VALUE;
  30947. let minHeight = Number.MAX_VALUE;
  30948. let maxNumWide = 0;
  30949. let maxNumHigh = 0;
  30950. const sizePerComponent = new Array(componentsCount);
  30951. for (let c = 0; c < componentsCount; c++) {
  30952. const component = tile.components[c];
  30953. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  30954. const sizePerResolution = new Array(decompositionLevelsCount + 1);
  30955. let minWidthCurrentComponent = Number.MAX_VALUE;
  30956. let minHeightCurrentComponent = Number.MAX_VALUE;
  30957. let maxNumWideCurrentComponent = 0;
  30958. let maxNumHighCurrentComponent = 0;
  30959. let scale = 1;
  30960. for (let r = decompositionLevelsCount; r >= 0; --r) {
  30961. const resolution = component.resolutions[r];
  30962. const widthCurrentResolution = scale * resolution.precinctParameters.precinctWidth;
  30963. const heightCurrentResolution = scale * resolution.precinctParameters.precinctHeight;
  30964. minWidthCurrentComponent = Math.min(minWidthCurrentComponent, widthCurrentResolution);
  30965. minHeightCurrentComponent = Math.min(minHeightCurrentComponent, heightCurrentResolution);
  30966. maxNumWideCurrentComponent = Math.max(maxNumWideCurrentComponent, resolution.precinctParameters.numprecinctswide);
  30967. maxNumHighCurrentComponent = Math.max(maxNumHighCurrentComponent, resolution.precinctParameters.numprecinctshigh);
  30968. sizePerResolution[r] = {
  30969. width: widthCurrentResolution,
  30970. height: heightCurrentResolution
  30971. };
  30972. scale <<= 1;
  30973. }
  30974. minWidth = Math.min(minWidth, minWidthCurrentComponent);
  30975. minHeight = Math.min(minHeight, minHeightCurrentComponent);
  30976. maxNumWide = Math.max(maxNumWide, maxNumWideCurrentComponent);
  30977. maxNumHigh = Math.max(maxNumHigh, maxNumHighCurrentComponent);
  30978. sizePerComponent[c] = {
  30979. resolutions: sizePerResolution,
  30980. minWidth: minWidthCurrentComponent,
  30981. minHeight: minHeightCurrentComponent,
  30982. maxNumWide: maxNumWideCurrentComponent,
  30983. maxNumHigh: maxNumHighCurrentComponent
  30984. };
  30985. }
  30986. return {
  30987. components: sizePerComponent,
  30988. minWidth,
  30989. minHeight,
  30990. maxNumWide,
  30991. maxNumHigh
  30992. };
  30993. }
  30994. function buildPackets(context) {
  30995. const siz = context.SIZ;
  30996. const tileIndex = context.currentTile.index;
  30997. const tile = context.tiles[tileIndex];
  30998. const componentsCount = siz.Csiz;
  30999. for (let c = 0; c < componentsCount; c++) {
  31000. const component = tile.components[c];
  31001. const decompositionLevelsCount = component.codingStyleParameters.decompositionLevelsCount;
  31002. const resolutions = [];
  31003. const subbands = [];
  31004. for (let r = 0; r <= decompositionLevelsCount; r++) {
  31005. const blocksDimensions = getBlocksDimensions(context, component, r);
  31006. const resolution = {};
  31007. const scale = 1 << decompositionLevelsCount - r;
  31008. resolution.trx0 = Math.ceil(component.tcx0 / scale);
  31009. resolution.try0 = Math.ceil(component.tcy0 / scale);
  31010. resolution.trx1 = Math.ceil(component.tcx1 / scale);
  31011. resolution.try1 = Math.ceil(component.tcy1 / scale);
  31012. resolution.resLevel = r;
  31013. buildPrecincts(context, resolution, blocksDimensions);
  31014. resolutions.push(resolution);
  31015. let subband;
  31016. if (r === 0) {
  31017. subband = {};
  31018. subband.type = "LL";
  31019. subband.tbx0 = Math.ceil(component.tcx0 / scale);
  31020. subband.tby0 = Math.ceil(component.tcy0 / scale);
  31021. subband.tbx1 = Math.ceil(component.tcx1 / scale);
  31022. subband.tby1 = Math.ceil(component.tcy1 / scale);
  31023. subband.resolution = resolution;
  31024. buildCodeblocks(context, subband, blocksDimensions);
  31025. subbands.push(subband);
  31026. resolution.subbands = [subband];
  31027. } else {
  31028. const bscale = 1 << decompositionLevelsCount - r + 1;
  31029. const resolutionSubbands = [];
  31030. subband = {};
  31031. subband.type = "HL";
  31032. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  31033. subband.tby0 = Math.ceil(component.tcy0 / bscale);
  31034. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  31035. subband.tby1 = Math.ceil(component.tcy1 / bscale);
  31036. subband.resolution = resolution;
  31037. buildCodeblocks(context, subband, blocksDimensions);
  31038. subbands.push(subband);
  31039. resolutionSubbands.push(subband);
  31040. subband = {};
  31041. subband.type = "LH";
  31042. subband.tbx0 = Math.ceil(component.tcx0 / bscale);
  31043. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  31044. subband.tbx1 = Math.ceil(component.tcx1 / bscale);
  31045. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  31046. subband.resolution = resolution;
  31047. buildCodeblocks(context, subband, blocksDimensions);
  31048. subbands.push(subband);
  31049. resolutionSubbands.push(subband);
  31050. subband = {};
  31051. subband.type = "HH";
  31052. subband.tbx0 = Math.ceil(component.tcx0 / bscale - 0.5);
  31053. subband.tby0 = Math.ceil(component.tcy0 / bscale - 0.5);
  31054. subband.tbx1 = Math.ceil(component.tcx1 / bscale - 0.5);
  31055. subband.tby1 = Math.ceil(component.tcy1 / bscale - 0.5);
  31056. subband.resolution = resolution;
  31057. buildCodeblocks(context, subband, blocksDimensions);
  31058. subbands.push(subband);
  31059. resolutionSubbands.push(subband);
  31060. resolution.subbands = resolutionSubbands;
  31061. }
  31062. }
  31063. component.resolutions = resolutions;
  31064. component.subbands = subbands;
  31065. }
  31066. const progressionOrder = tile.codingStyleDefaultParameters.progressionOrder;
  31067. switch (progressionOrder) {
  31068. case 0:
  31069. tile.packetsIterator = new LayerResolutionComponentPositionIterator(context);
  31070. break;
  31071. case 1:
  31072. tile.packetsIterator = new ResolutionLayerComponentPositionIterator(context);
  31073. break;
  31074. case 2:
  31075. tile.packetsIterator = new ResolutionPositionComponentLayerIterator(context);
  31076. break;
  31077. case 3:
  31078. tile.packetsIterator = new PositionComponentResolutionLayerIterator(context);
  31079. break;
  31080. case 4:
  31081. tile.packetsIterator = new ComponentPositionResolutionLayerIterator(context);
  31082. break;
  31083. default:
  31084. throw new JpxError(`Unsupported progression order ${progressionOrder}`);
  31085. }
  31086. }
  31087. function parseTilePackets(context, data, offset, dataLength) {
  31088. let position = 0;
  31089. let buffer,
  31090. bufferSize = 0,
  31091. skipNextBit = false;
  31092. function readBits(count) {
  31093. while (bufferSize < count) {
  31094. const b = data[offset + position];
  31095. position++;
  31096. if (skipNextBit) {
  31097. buffer = buffer << 7 | b;
  31098. bufferSize += 7;
  31099. skipNextBit = false;
  31100. } else {
  31101. buffer = buffer << 8 | b;
  31102. bufferSize += 8;
  31103. }
  31104. if (b === 0xff) {
  31105. skipNextBit = true;
  31106. }
  31107. }
  31108. bufferSize -= count;
  31109. return buffer >>> bufferSize & (1 << count) - 1;
  31110. }
  31111. function skipMarkerIfEqual(value) {
  31112. if (data[offset + position - 1] === 0xff && data[offset + position] === value) {
  31113. skipBytes(1);
  31114. return true;
  31115. } else if (data[offset + position] === 0xff && data[offset + position + 1] === value) {
  31116. skipBytes(2);
  31117. return true;
  31118. }
  31119. return false;
  31120. }
  31121. function skipBytes(count) {
  31122. position += count;
  31123. }
  31124. function alignToByte() {
  31125. bufferSize = 0;
  31126. if (skipNextBit) {
  31127. position++;
  31128. skipNextBit = false;
  31129. }
  31130. }
  31131. function readCodingpasses() {
  31132. if (readBits(1) === 0) {
  31133. return 1;
  31134. }
  31135. if (readBits(1) === 0) {
  31136. return 2;
  31137. }
  31138. let value = readBits(2);
  31139. if (value < 3) {
  31140. return value + 3;
  31141. }
  31142. value = readBits(5);
  31143. if (value < 31) {
  31144. return value + 6;
  31145. }
  31146. value = readBits(7);
  31147. return value + 37;
  31148. }
  31149. const tileIndex = context.currentTile.index;
  31150. const tile = context.tiles[tileIndex];
  31151. const sopMarkerUsed = context.COD.sopMarkerUsed;
  31152. const ephMarkerUsed = context.COD.ephMarkerUsed;
  31153. const packetsIterator = tile.packetsIterator;
  31154. while (position < dataLength) {
  31155. alignToByte();
  31156. if (sopMarkerUsed && skipMarkerIfEqual(0x91)) {
  31157. skipBytes(4);
  31158. }
  31159. const packet = packetsIterator.nextPacket();
  31160. if (!readBits(1)) {
  31161. continue;
  31162. }
  31163. const layerNumber = packet.layerNumber,
  31164. queue = [];
  31165. let codeblock;
  31166. for (let i = 0, ii = packet.codeblocks.length; i < ii; i++) {
  31167. codeblock = packet.codeblocks[i];
  31168. let precinct = codeblock.precinct;
  31169. const codeblockColumn = codeblock.cbx - precinct.cbxMin;
  31170. const codeblockRow = codeblock.cby - precinct.cbyMin;
  31171. let codeblockIncluded = false;
  31172. let firstTimeInclusion = false;
  31173. let valueReady, zeroBitPlanesTree;
  31174. if (codeblock.included !== undefined) {
  31175. codeblockIncluded = !!readBits(1);
  31176. } else {
  31177. precinct = codeblock.precinct;
  31178. let inclusionTree;
  31179. if (precinct.inclusionTree !== undefined) {
  31180. inclusionTree = precinct.inclusionTree;
  31181. } else {
  31182. const width = precinct.cbxMax - precinct.cbxMin + 1;
  31183. const height = precinct.cbyMax - precinct.cbyMin + 1;
  31184. inclusionTree = new InclusionTree(width, height, layerNumber);
  31185. zeroBitPlanesTree = new TagTree(width, height);
  31186. precinct.inclusionTree = inclusionTree;
  31187. precinct.zeroBitPlanesTree = zeroBitPlanesTree;
  31188. for (let l = 0; l < layerNumber; l++) {
  31189. if (readBits(1) !== 0) {
  31190. throw new JpxError("Invalid tag tree");
  31191. }
  31192. }
  31193. }
  31194. if (inclusionTree.reset(codeblockColumn, codeblockRow, layerNumber)) {
  31195. while (true) {
  31196. if (readBits(1)) {
  31197. valueReady = !inclusionTree.nextLevel();
  31198. if (valueReady) {
  31199. codeblock.included = true;
  31200. codeblockIncluded = firstTimeInclusion = true;
  31201. break;
  31202. }
  31203. } else {
  31204. inclusionTree.incrementValue(layerNumber);
  31205. break;
  31206. }
  31207. }
  31208. }
  31209. }
  31210. if (!codeblockIncluded) {
  31211. continue;
  31212. }
  31213. if (firstTimeInclusion) {
  31214. zeroBitPlanesTree = precinct.zeroBitPlanesTree;
  31215. zeroBitPlanesTree.reset(codeblockColumn, codeblockRow);
  31216. while (true) {
  31217. if (readBits(1)) {
  31218. valueReady = !zeroBitPlanesTree.nextLevel();
  31219. if (valueReady) {
  31220. break;
  31221. }
  31222. } else {
  31223. zeroBitPlanesTree.incrementValue();
  31224. }
  31225. }
  31226. codeblock.zeroBitPlanes = zeroBitPlanesTree.value;
  31227. }
  31228. const codingpasses = readCodingpasses();
  31229. while (readBits(1)) {
  31230. codeblock.Lblock++;
  31231. }
  31232. const codingpassesLog2 = (0, _core_utils.log2)(codingpasses);
  31233. const bits = (codingpasses < 1 << codingpassesLog2 ? codingpassesLog2 - 1 : codingpassesLog2) + codeblock.Lblock;
  31234. const codedDataLength = readBits(bits);
  31235. queue.push({
  31236. codeblock,
  31237. codingpasses,
  31238. dataLength: codedDataLength
  31239. });
  31240. }
  31241. alignToByte();
  31242. if (ephMarkerUsed) {
  31243. skipMarkerIfEqual(0x92);
  31244. }
  31245. while (queue.length > 0) {
  31246. const packetItem = queue.shift();
  31247. codeblock = packetItem.codeblock;
  31248. if (codeblock.data === undefined) {
  31249. codeblock.data = [];
  31250. }
  31251. codeblock.data.push({
  31252. data,
  31253. start: offset + position,
  31254. end: offset + position + packetItem.dataLength,
  31255. codingpasses: packetItem.codingpasses
  31256. });
  31257. position += packetItem.dataLength;
  31258. }
  31259. }
  31260. return position;
  31261. }
  31262. function copyCoefficients(coefficients, levelWidth, levelHeight, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities) {
  31263. const x0 = subband.tbx0;
  31264. const y0 = subband.tby0;
  31265. const width = subband.tbx1 - subband.tbx0;
  31266. const codeblocks = subband.codeblocks;
  31267. const right = subband.type.charAt(0) === "H" ? 1 : 0;
  31268. const bottom = subband.type.charAt(1) === "H" ? levelWidth : 0;
  31269. for (let i = 0, ii = codeblocks.length; i < ii; ++i) {
  31270. const codeblock = codeblocks[i];
  31271. const blockWidth = codeblock.tbx1_ - codeblock.tbx0_;
  31272. const blockHeight = codeblock.tby1_ - codeblock.tby0_;
  31273. if (blockWidth === 0 || blockHeight === 0) {
  31274. continue;
  31275. }
  31276. if (codeblock.data === undefined) {
  31277. continue;
  31278. }
  31279. const bitModel = new BitModel(blockWidth, blockHeight, codeblock.subbandType, codeblock.zeroBitPlanes, mb);
  31280. let currentCodingpassType = 2;
  31281. const data = codeblock.data;
  31282. let totalLength = 0,
  31283. codingpasses = 0;
  31284. let j, jj, dataItem;
  31285. for (j = 0, jj = data.length; j < jj; j++) {
  31286. dataItem = data[j];
  31287. totalLength += dataItem.end - dataItem.start;
  31288. codingpasses += dataItem.codingpasses;
  31289. }
  31290. const encodedData = new Uint8Array(totalLength);
  31291. let position = 0;
  31292. for (j = 0, jj = data.length; j < jj; j++) {
  31293. dataItem = data[j];
  31294. const chunk = dataItem.data.subarray(dataItem.start, dataItem.end);
  31295. encodedData.set(chunk, position);
  31296. position += chunk.length;
  31297. }
  31298. const decoder = new _arithmetic_decoder.ArithmeticDecoder(encodedData, 0, totalLength);
  31299. bitModel.setDecoder(decoder);
  31300. for (j = 0; j < codingpasses; j++) {
  31301. switch (currentCodingpassType) {
  31302. case 0:
  31303. bitModel.runSignificancePropagationPass();
  31304. break;
  31305. case 1:
  31306. bitModel.runMagnitudeRefinementPass();
  31307. break;
  31308. case 2:
  31309. bitModel.runCleanupPass();
  31310. if (segmentationSymbolUsed) {
  31311. bitModel.checkSegmentationSymbol();
  31312. }
  31313. break;
  31314. }
  31315. if (resetContextProbabilities) {
  31316. bitModel.reset();
  31317. }
  31318. currentCodingpassType = (currentCodingpassType + 1) % 3;
  31319. }
  31320. let offset = codeblock.tbx0_ - x0 + (codeblock.tby0_ - y0) * width;
  31321. const sign = bitModel.coefficentsSign;
  31322. const magnitude = bitModel.coefficentsMagnitude;
  31323. const bitsDecoded = bitModel.bitsDecoded;
  31324. const magnitudeCorrection = reversible ? 0 : 0.5;
  31325. let k, n, nb;
  31326. position = 0;
  31327. const interleave = subband.type !== "LL";
  31328. for (j = 0; j < blockHeight; j++) {
  31329. const row = offset / width | 0;
  31330. const levelOffset = 2 * row * (levelWidth - width) + right + bottom;
  31331. for (k = 0; k < blockWidth; k++) {
  31332. n = magnitude[position];
  31333. if (n !== 0) {
  31334. n = (n + magnitudeCorrection) * delta;
  31335. if (sign[position] !== 0) {
  31336. n = -n;
  31337. }
  31338. nb = bitsDecoded[position];
  31339. const pos = interleave ? levelOffset + (offset << 1) : offset;
  31340. if (reversible && nb >= mb) {
  31341. coefficients[pos] = n;
  31342. } else {
  31343. coefficients[pos] = n * (1 << mb - nb);
  31344. }
  31345. }
  31346. offset++;
  31347. position++;
  31348. }
  31349. offset += width - blockWidth;
  31350. }
  31351. }
  31352. }
  31353. function transformTile(context, tile, c) {
  31354. const component = tile.components[c];
  31355. const codingStyleParameters = component.codingStyleParameters;
  31356. const quantizationParameters = component.quantizationParameters;
  31357. const decompositionLevelsCount = codingStyleParameters.decompositionLevelsCount;
  31358. const spqcds = quantizationParameters.SPqcds;
  31359. const scalarExpounded = quantizationParameters.scalarExpounded;
  31360. const guardBits = quantizationParameters.guardBits;
  31361. const segmentationSymbolUsed = codingStyleParameters.segmentationSymbolUsed;
  31362. const resetContextProbabilities = codingStyleParameters.resetContextProbabilities;
  31363. const precision = context.components[c].precision;
  31364. const reversible = codingStyleParameters.reversibleTransformation;
  31365. const transform = reversible ? new ReversibleTransform() : new IrreversibleTransform();
  31366. const subbandCoefficients = [];
  31367. let b = 0;
  31368. for (let i = 0; i <= decompositionLevelsCount; i++) {
  31369. const resolution = component.resolutions[i];
  31370. const width = resolution.trx1 - resolution.trx0;
  31371. const height = resolution.try1 - resolution.try0;
  31372. const coefficients = new Float32Array(width * height);
  31373. for (let j = 0, jj = resolution.subbands.length; j < jj; j++) {
  31374. let mu, epsilon;
  31375. if (!scalarExpounded) {
  31376. mu = spqcds[0].mu;
  31377. epsilon = spqcds[0].epsilon + (i > 0 ? 1 - i : 0);
  31378. } else {
  31379. mu = spqcds[b].mu;
  31380. epsilon = spqcds[b].epsilon;
  31381. b++;
  31382. }
  31383. const subband = resolution.subbands[j];
  31384. const gainLog2 = SubbandsGainLog2[subband.type];
  31385. const delta = reversible ? 1 : 2 ** (precision + gainLog2 - epsilon) * (1 + mu / 2048);
  31386. const mb = guardBits + epsilon - 1;
  31387. copyCoefficients(coefficients, width, height, subband, delta, mb, reversible, segmentationSymbolUsed, resetContextProbabilities);
  31388. }
  31389. subbandCoefficients.push({
  31390. width,
  31391. height,
  31392. items: coefficients
  31393. });
  31394. }
  31395. const result = transform.calculate(subbandCoefficients, component.tcx0, component.tcy0);
  31396. return {
  31397. left: component.tcx0,
  31398. top: component.tcy0,
  31399. width: result.width,
  31400. height: result.height,
  31401. items: result.items
  31402. };
  31403. }
  31404. function transformComponents(context) {
  31405. const siz = context.SIZ;
  31406. const components = context.components;
  31407. const componentsCount = siz.Csiz;
  31408. const resultImages = [];
  31409. for (let i = 0, ii = context.tiles.length; i < ii; i++) {
  31410. const tile = context.tiles[i];
  31411. const transformedTiles = [];
  31412. for (let c = 0; c < componentsCount; c++) {
  31413. transformedTiles[c] = transformTile(context, tile, c);
  31414. }
  31415. const tile0 = transformedTiles[0];
  31416. const out = new Uint8ClampedArray(tile0.items.length * componentsCount);
  31417. const result = {
  31418. left: tile0.left,
  31419. top: tile0.top,
  31420. width: tile0.width,
  31421. height: tile0.height,
  31422. items: out
  31423. };
  31424. let shift, offset;
  31425. let pos = 0,
  31426. j,
  31427. jj,
  31428. y0,
  31429. y1,
  31430. y2;
  31431. if (tile.codingStyleDefaultParameters.multipleComponentTransform) {
  31432. const fourComponents = componentsCount === 4;
  31433. const y0items = transformedTiles[0].items;
  31434. const y1items = transformedTiles[1].items;
  31435. const y2items = transformedTiles[2].items;
  31436. const y3items = fourComponents ? transformedTiles[3].items : null;
  31437. shift = components[0].precision - 8;
  31438. offset = (128 << shift) + 0.5;
  31439. const component0 = tile.components[0];
  31440. const alpha01 = componentsCount - 3;
  31441. jj = y0items.length;
  31442. if (!component0.codingStyleParameters.reversibleTransformation) {
  31443. for (j = 0; j < jj; j++, pos += alpha01) {
  31444. y0 = y0items[j] + offset;
  31445. y1 = y1items[j];
  31446. y2 = y2items[j];
  31447. out[pos++] = y0 + 1.402 * y2 >> shift;
  31448. out[pos++] = y0 - 0.34413 * y1 - 0.71414 * y2 >> shift;
  31449. out[pos++] = y0 + 1.772 * y1 >> shift;
  31450. }
  31451. } else {
  31452. for (j = 0; j < jj; j++, pos += alpha01) {
  31453. y0 = y0items[j] + offset;
  31454. y1 = y1items[j];
  31455. y2 = y2items[j];
  31456. const g = y0 - (y2 + y1 >> 2);
  31457. out[pos++] = g + y2 >> shift;
  31458. out[pos++] = g >> shift;
  31459. out[pos++] = g + y1 >> shift;
  31460. }
  31461. }
  31462. if (fourComponents) {
  31463. for (j = 0, pos = 3; j < jj; j++, pos += 4) {
  31464. out[pos] = y3items[j] + offset >> shift;
  31465. }
  31466. }
  31467. } else {
  31468. for (let c = 0; c < componentsCount; c++) {
  31469. const items = transformedTiles[c].items;
  31470. shift = components[c].precision - 8;
  31471. offset = (128 << shift) + 0.5;
  31472. for (pos = c, j = 0, jj = items.length; j < jj; j++) {
  31473. out[pos] = items[j] + offset >> shift;
  31474. pos += componentsCount;
  31475. }
  31476. }
  31477. }
  31478. resultImages.push(result);
  31479. }
  31480. return resultImages;
  31481. }
  31482. function initializeTile(context, tileIndex) {
  31483. const siz = context.SIZ;
  31484. const componentsCount = siz.Csiz;
  31485. const tile = context.tiles[tileIndex];
  31486. for (let c = 0; c < componentsCount; c++) {
  31487. const component = tile.components[c];
  31488. const qcdOrQcc = context.currentTile.QCC[c] !== undefined ? context.currentTile.QCC[c] : context.currentTile.QCD;
  31489. component.quantizationParameters = qcdOrQcc;
  31490. const codOrCoc = context.currentTile.COC[c] !== undefined ? context.currentTile.COC[c] : context.currentTile.COD;
  31491. component.codingStyleParameters = codOrCoc;
  31492. }
  31493. tile.codingStyleDefaultParameters = context.currentTile.COD;
  31494. }
  31495. class TagTree {
  31496. constructor(width, height) {
  31497. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31498. this.levels = [];
  31499. for (let i = 0; i < levelsLength; i++) {
  31500. const level = {
  31501. width,
  31502. height,
  31503. items: []
  31504. };
  31505. this.levels.push(level);
  31506. width = Math.ceil(width / 2);
  31507. height = Math.ceil(height / 2);
  31508. }
  31509. }
  31510. reset(i, j) {
  31511. let currentLevel = 0,
  31512. value = 0,
  31513. level;
  31514. while (currentLevel < this.levels.length) {
  31515. level = this.levels[currentLevel];
  31516. const index = i + j * level.width;
  31517. if (level.items[index] !== undefined) {
  31518. value = level.items[index];
  31519. break;
  31520. }
  31521. level.index = index;
  31522. i >>= 1;
  31523. j >>= 1;
  31524. currentLevel++;
  31525. }
  31526. currentLevel--;
  31527. level = this.levels[currentLevel];
  31528. level.items[level.index] = value;
  31529. this.currentLevel = currentLevel;
  31530. delete this.value;
  31531. }
  31532. incrementValue() {
  31533. const level = this.levels[this.currentLevel];
  31534. level.items[level.index]++;
  31535. }
  31536. nextLevel() {
  31537. let currentLevel = this.currentLevel;
  31538. let level = this.levels[currentLevel];
  31539. const value = level.items[level.index];
  31540. currentLevel--;
  31541. if (currentLevel < 0) {
  31542. this.value = value;
  31543. return false;
  31544. }
  31545. this.currentLevel = currentLevel;
  31546. level = this.levels[currentLevel];
  31547. level.items[level.index] = value;
  31548. return true;
  31549. }
  31550. }
  31551. class InclusionTree {
  31552. constructor(width, height, defaultValue) {
  31553. const levelsLength = (0, _core_utils.log2)(Math.max(width, height)) + 1;
  31554. this.levels = [];
  31555. for (let i = 0; i < levelsLength; i++) {
  31556. const items = new Uint8Array(width * height);
  31557. for (let j = 0, jj = items.length; j < jj; j++) {
  31558. items[j] = defaultValue;
  31559. }
  31560. const level = {
  31561. width,
  31562. height,
  31563. items
  31564. };
  31565. this.levels.push(level);
  31566. width = Math.ceil(width / 2);
  31567. height = Math.ceil(height / 2);
  31568. }
  31569. }
  31570. reset(i, j, stopValue) {
  31571. let currentLevel = 0;
  31572. while (currentLevel < this.levels.length) {
  31573. const level = this.levels[currentLevel];
  31574. const index = i + j * level.width;
  31575. level.index = index;
  31576. const value = level.items[index];
  31577. if (value === 0xff) {
  31578. break;
  31579. }
  31580. if (value > stopValue) {
  31581. this.currentLevel = currentLevel;
  31582. this.propagateValues();
  31583. return false;
  31584. }
  31585. i >>= 1;
  31586. j >>= 1;
  31587. currentLevel++;
  31588. }
  31589. this.currentLevel = currentLevel - 1;
  31590. return true;
  31591. }
  31592. incrementValue(stopValue) {
  31593. const level = this.levels[this.currentLevel];
  31594. level.items[level.index] = stopValue + 1;
  31595. this.propagateValues();
  31596. }
  31597. propagateValues() {
  31598. let levelIndex = this.currentLevel;
  31599. let level = this.levels[levelIndex];
  31600. const currentValue = level.items[level.index];
  31601. while (--levelIndex >= 0) {
  31602. level = this.levels[levelIndex];
  31603. level.items[level.index] = currentValue;
  31604. }
  31605. }
  31606. nextLevel() {
  31607. let currentLevel = this.currentLevel;
  31608. let level = this.levels[currentLevel];
  31609. const value = level.items[level.index];
  31610. level.items[level.index] = 0xff;
  31611. currentLevel--;
  31612. if (currentLevel < 0) {
  31613. return false;
  31614. }
  31615. this.currentLevel = currentLevel;
  31616. level = this.levels[currentLevel];
  31617. level.items[level.index] = value;
  31618. return true;
  31619. }
  31620. }
  31621. const BitModel = function BitModelClosure() {
  31622. const UNIFORM_CONTEXT = 17;
  31623. const RUNLENGTH_CONTEXT = 18;
  31624. const LLAndLHContextsLabel = new Uint8Array([0, 5, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 1, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8, 0, 0, 0, 0, 0, 2, 6, 8, 0, 3, 7, 8, 0, 4, 7, 8]);
  31625. const HLContextLabel = new Uint8Array([0, 3, 4, 0, 5, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 1, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8, 0, 0, 0, 0, 0, 2, 3, 4, 0, 6, 7, 7, 0, 8, 8, 8]);
  31626. const HHContextLabel = new Uint8Array([0, 1, 2, 0, 1, 2, 2, 0, 2, 2, 2, 0, 0, 0, 0, 0, 3, 4, 5, 0, 4, 5, 5, 0, 5, 5, 5, 0, 0, 0, 0, 0, 6, 7, 7, 0, 7, 7, 7, 0, 7, 7, 7, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8, 0, 0, 0, 0, 0, 8, 8, 8, 0, 8, 8, 8, 0, 8, 8, 8]);
  31627. class BitModel {
  31628. constructor(width, height, subband, zeroBitPlanes, mb) {
  31629. this.width = width;
  31630. this.height = height;
  31631. let contextLabelTable;
  31632. if (subband === "HH") {
  31633. contextLabelTable = HHContextLabel;
  31634. } else if (subband === "HL") {
  31635. contextLabelTable = HLContextLabel;
  31636. } else {
  31637. contextLabelTable = LLAndLHContextsLabel;
  31638. }
  31639. this.contextLabelTable = contextLabelTable;
  31640. const coefficientCount = width * height;
  31641. this.neighborsSignificance = new Uint8Array(coefficientCount);
  31642. this.coefficentsSign = new Uint8Array(coefficientCount);
  31643. let coefficentsMagnitude;
  31644. if (mb > 14) {
  31645. coefficentsMagnitude = new Uint32Array(coefficientCount);
  31646. } else if (mb > 6) {
  31647. coefficentsMagnitude = new Uint16Array(coefficientCount);
  31648. } else {
  31649. coefficentsMagnitude = new Uint8Array(coefficientCount);
  31650. }
  31651. this.coefficentsMagnitude = coefficentsMagnitude;
  31652. this.processingFlags = new Uint8Array(coefficientCount);
  31653. const bitsDecoded = new Uint8Array(coefficientCount);
  31654. if (zeroBitPlanes !== 0) {
  31655. for (let i = 0; i < coefficientCount; i++) {
  31656. bitsDecoded[i] = zeroBitPlanes;
  31657. }
  31658. }
  31659. this.bitsDecoded = bitsDecoded;
  31660. this.reset();
  31661. }
  31662. setDecoder(decoder) {
  31663. this.decoder = decoder;
  31664. }
  31665. reset() {
  31666. this.contexts = new Int8Array(19);
  31667. this.contexts[0] = 4 << 1 | 0;
  31668. this.contexts[UNIFORM_CONTEXT] = 46 << 1 | 0;
  31669. this.contexts[RUNLENGTH_CONTEXT] = 3 << 1 | 0;
  31670. }
  31671. setNeighborsSignificance(row, column, index) {
  31672. const neighborsSignificance = this.neighborsSignificance;
  31673. const width = this.width,
  31674. height = this.height;
  31675. const left = column > 0;
  31676. const right = column + 1 < width;
  31677. let i;
  31678. if (row > 0) {
  31679. i = index - width;
  31680. if (left) {
  31681. neighborsSignificance[i - 1] += 0x10;
  31682. }
  31683. if (right) {
  31684. neighborsSignificance[i + 1] += 0x10;
  31685. }
  31686. neighborsSignificance[i] += 0x04;
  31687. }
  31688. if (row + 1 < height) {
  31689. i = index + width;
  31690. if (left) {
  31691. neighborsSignificance[i - 1] += 0x10;
  31692. }
  31693. if (right) {
  31694. neighborsSignificance[i + 1] += 0x10;
  31695. }
  31696. neighborsSignificance[i] += 0x04;
  31697. }
  31698. if (left) {
  31699. neighborsSignificance[index - 1] += 0x01;
  31700. }
  31701. if (right) {
  31702. neighborsSignificance[index + 1] += 0x01;
  31703. }
  31704. neighborsSignificance[index] |= 0x80;
  31705. }
  31706. runSignificancePropagationPass() {
  31707. const decoder = this.decoder;
  31708. const width = this.width,
  31709. height = this.height;
  31710. const coefficentsMagnitude = this.coefficentsMagnitude;
  31711. const coefficentsSign = this.coefficentsSign;
  31712. const neighborsSignificance = this.neighborsSignificance;
  31713. const processingFlags = this.processingFlags;
  31714. const contexts = this.contexts;
  31715. const labels = this.contextLabelTable;
  31716. const bitsDecoded = this.bitsDecoded;
  31717. const processedInverseMask = ~1;
  31718. const processedMask = 1;
  31719. const firstMagnitudeBitMask = 2;
  31720. for (let i0 = 0; i0 < height; i0 += 4) {
  31721. for (let j = 0; j < width; j++) {
  31722. let index = i0 * width + j;
  31723. for (let i1 = 0; i1 < 4; i1++, index += width) {
  31724. const i = i0 + i1;
  31725. if (i >= height) {
  31726. break;
  31727. }
  31728. processingFlags[index] &= processedInverseMask;
  31729. if (coefficentsMagnitude[index] || !neighborsSignificance[index]) {
  31730. continue;
  31731. }
  31732. const contextLabel = labels[neighborsSignificance[index]];
  31733. const decision = decoder.readBit(contexts, contextLabel);
  31734. if (decision) {
  31735. const sign = this.decodeSignBit(i, j, index);
  31736. coefficentsSign[index] = sign;
  31737. coefficentsMagnitude[index] = 1;
  31738. this.setNeighborsSignificance(i, j, index);
  31739. processingFlags[index] |= firstMagnitudeBitMask;
  31740. }
  31741. bitsDecoded[index]++;
  31742. processingFlags[index] |= processedMask;
  31743. }
  31744. }
  31745. }
  31746. }
  31747. decodeSignBit(row, column, index) {
  31748. const width = this.width,
  31749. height = this.height;
  31750. const coefficentsMagnitude = this.coefficentsMagnitude;
  31751. const coefficentsSign = this.coefficentsSign;
  31752. let contribution, sign0, sign1, significance1;
  31753. let contextLabel, decoded;
  31754. significance1 = column > 0 && coefficentsMagnitude[index - 1] !== 0;
  31755. if (column + 1 < width && coefficentsMagnitude[index + 1] !== 0) {
  31756. sign1 = coefficentsSign[index + 1];
  31757. if (significance1) {
  31758. sign0 = coefficentsSign[index - 1];
  31759. contribution = 1 - sign1 - sign0;
  31760. } else {
  31761. contribution = 1 - sign1 - sign1;
  31762. }
  31763. } else if (significance1) {
  31764. sign0 = coefficentsSign[index - 1];
  31765. contribution = 1 - sign0 - sign0;
  31766. } else {
  31767. contribution = 0;
  31768. }
  31769. const horizontalContribution = 3 * contribution;
  31770. significance1 = row > 0 && coefficentsMagnitude[index - width] !== 0;
  31771. if (row + 1 < height && coefficentsMagnitude[index + width] !== 0) {
  31772. sign1 = coefficentsSign[index + width];
  31773. if (significance1) {
  31774. sign0 = coefficentsSign[index - width];
  31775. contribution = 1 - sign1 - sign0 + horizontalContribution;
  31776. } else {
  31777. contribution = 1 - sign1 - sign1 + horizontalContribution;
  31778. }
  31779. } else if (significance1) {
  31780. sign0 = coefficentsSign[index - width];
  31781. contribution = 1 - sign0 - sign0 + horizontalContribution;
  31782. } else {
  31783. contribution = horizontalContribution;
  31784. }
  31785. if (contribution >= 0) {
  31786. contextLabel = 9 + contribution;
  31787. decoded = this.decoder.readBit(this.contexts, contextLabel);
  31788. } else {
  31789. contextLabel = 9 - contribution;
  31790. decoded = this.decoder.readBit(this.contexts, contextLabel) ^ 1;
  31791. }
  31792. return decoded;
  31793. }
  31794. runMagnitudeRefinementPass() {
  31795. const decoder = this.decoder;
  31796. const width = this.width,
  31797. height = this.height;
  31798. const coefficentsMagnitude = this.coefficentsMagnitude;
  31799. const neighborsSignificance = this.neighborsSignificance;
  31800. const contexts = this.contexts;
  31801. const bitsDecoded = this.bitsDecoded;
  31802. const processingFlags = this.processingFlags;
  31803. const processedMask = 1;
  31804. const firstMagnitudeBitMask = 2;
  31805. const length = width * height;
  31806. const width4 = width * 4;
  31807. for (let index0 = 0, indexNext; index0 < length; index0 = indexNext) {
  31808. indexNext = Math.min(length, index0 + width4);
  31809. for (let j = 0; j < width; j++) {
  31810. for (let index = index0 + j; index < indexNext; index += width) {
  31811. if (!coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31812. continue;
  31813. }
  31814. let contextLabel = 16;
  31815. if ((processingFlags[index] & firstMagnitudeBitMask) !== 0) {
  31816. processingFlags[index] ^= firstMagnitudeBitMask;
  31817. const significance = neighborsSignificance[index] & 127;
  31818. contextLabel = significance === 0 ? 15 : 14;
  31819. }
  31820. const bit = decoder.readBit(contexts, contextLabel);
  31821. coefficentsMagnitude[index] = coefficentsMagnitude[index] << 1 | bit;
  31822. bitsDecoded[index]++;
  31823. processingFlags[index] |= processedMask;
  31824. }
  31825. }
  31826. }
  31827. }
  31828. runCleanupPass() {
  31829. const decoder = this.decoder;
  31830. const width = this.width,
  31831. height = this.height;
  31832. const neighborsSignificance = this.neighborsSignificance;
  31833. const coefficentsMagnitude = this.coefficentsMagnitude;
  31834. const coefficentsSign = this.coefficentsSign;
  31835. const contexts = this.contexts;
  31836. const labels = this.contextLabelTable;
  31837. const bitsDecoded = this.bitsDecoded;
  31838. const processingFlags = this.processingFlags;
  31839. const processedMask = 1;
  31840. const firstMagnitudeBitMask = 2;
  31841. const oneRowDown = width;
  31842. const twoRowsDown = width * 2;
  31843. const threeRowsDown = width * 3;
  31844. let iNext;
  31845. for (let i0 = 0; i0 < height; i0 = iNext) {
  31846. iNext = Math.min(i0 + 4, height);
  31847. const indexBase = i0 * width;
  31848. const checkAllEmpty = i0 + 3 < height;
  31849. for (let j = 0; j < width; j++) {
  31850. const index0 = indexBase + j;
  31851. const allEmpty = checkAllEmpty && processingFlags[index0] === 0 && processingFlags[index0 + oneRowDown] === 0 && processingFlags[index0 + twoRowsDown] === 0 && processingFlags[index0 + threeRowsDown] === 0 && neighborsSignificance[index0] === 0 && neighborsSignificance[index0 + oneRowDown] === 0 && neighborsSignificance[index0 + twoRowsDown] === 0 && neighborsSignificance[index0 + threeRowsDown] === 0;
  31852. let i1 = 0,
  31853. index = index0;
  31854. let i = i0,
  31855. sign;
  31856. if (allEmpty) {
  31857. const hasSignificantCoefficent = decoder.readBit(contexts, RUNLENGTH_CONTEXT);
  31858. if (!hasSignificantCoefficent) {
  31859. bitsDecoded[index0]++;
  31860. bitsDecoded[index0 + oneRowDown]++;
  31861. bitsDecoded[index0 + twoRowsDown]++;
  31862. bitsDecoded[index0 + threeRowsDown]++;
  31863. continue;
  31864. }
  31865. i1 = decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31866. if (i1 !== 0) {
  31867. i = i0 + i1;
  31868. index += i1 * width;
  31869. }
  31870. sign = this.decodeSignBit(i, j, index);
  31871. coefficentsSign[index] = sign;
  31872. coefficentsMagnitude[index] = 1;
  31873. this.setNeighborsSignificance(i, j, index);
  31874. processingFlags[index] |= firstMagnitudeBitMask;
  31875. index = index0;
  31876. for (let i2 = i0; i2 <= i; i2++, index += width) {
  31877. bitsDecoded[index]++;
  31878. }
  31879. i1++;
  31880. }
  31881. for (i = i0 + i1; i < iNext; i++, index += width) {
  31882. if (coefficentsMagnitude[index] || (processingFlags[index] & processedMask) !== 0) {
  31883. continue;
  31884. }
  31885. const contextLabel = labels[neighborsSignificance[index]];
  31886. const decision = decoder.readBit(contexts, contextLabel);
  31887. if (decision === 1) {
  31888. sign = this.decodeSignBit(i, j, index);
  31889. coefficentsSign[index] = sign;
  31890. coefficentsMagnitude[index] = 1;
  31891. this.setNeighborsSignificance(i, j, index);
  31892. processingFlags[index] |= firstMagnitudeBitMask;
  31893. }
  31894. bitsDecoded[index]++;
  31895. }
  31896. }
  31897. }
  31898. }
  31899. checkSegmentationSymbol() {
  31900. const decoder = this.decoder;
  31901. const contexts = this.contexts;
  31902. const symbol = decoder.readBit(contexts, UNIFORM_CONTEXT) << 3 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 2 | decoder.readBit(contexts, UNIFORM_CONTEXT) << 1 | decoder.readBit(contexts, UNIFORM_CONTEXT);
  31903. if (symbol !== 0xa) {
  31904. throw new JpxError("Invalid segmentation symbol");
  31905. }
  31906. }
  31907. }
  31908. return BitModel;
  31909. }();
  31910. class Transform {
  31911. constructor() {
  31912. if (this.constructor === Transform) {
  31913. (0, _util.unreachable)("Cannot initialize Transform.");
  31914. }
  31915. }
  31916. calculate(subbands, u0, v0) {
  31917. let ll = subbands[0];
  31918. for (let i = 1, ii = subbands.length; i < ii; i++) {
  31919. ll = this.iterate(ll, subbands[i], u0, v0);
  31920. }
  31921. return ll;
  31922. }
  31923. extend(buffer, offset, size) {
  31924. let i1 = offset - 1,
  31925. j1 = offset + 1;
  31926. let i2 = offset + size - 2,
  31927. j2 = offset + size;
  31928. buffer[i1--] = buffer[j1++];
  31929. buffer[j2++] = buffer[i2--];
  31930. buffer[i1--] = buffer[j1++];
  31931. buffer[j2++] = buffer[i2--];
  31932. buffer[i1--] = buffer[j1++];
  31933. buffer[j2++] = buffer[i2--];
  31934. buffer[i1] = buffer[j1];
  31935. buffer[j2] = buffer[i2];
  31936. }
  31937. filter(x, offset, length) {
  31938. (0, _util.unreachable)("Abstract method `filter` called");
  31939. }
  31940. iterate(ll, hl_lh_hh, u0, v0) {
  31941. const llWidth = ll.width,
  31942. llHeight = ll.height;
  31943. let llItems = ll.items;
  31944. const width = hl_lh_hh.width;
  31945. const height = hl_lh_hh.height;
  31946. const items = hl_lh_hh.items;
  31947. let i, j, k, l, u, v;
  31948. for (k = 0, i = 0; i < llHeight; i++) {
  31949. l = i * 2 * width;
  31950. for (j = 0; j < llWidth; j++, k++, l += 2) {
  31951. items[l] = llItems[k];
  31952. }
  31953. }
  31954. llItems = ll.items = null;
  31955. const bufferPadding = 4;
  31956. const rowBuffer = new Float32Array(width + 2 * bufferPadding);
  31957. if (width === 1) {
  31958. if ((u0 & 1) !== 0) {
  31959. for (v = 0, k = 0; v < height; v++, k += width) {
  31960. items[k] *= 0.5;
  31961. }
  31962. }
  31963. } else {
  31964. for (v = 0, k = 0; v < height; v++, k += width) {
  31965. rowBuffer.set(items.subarray(k, k + width), bufferPadding);
  31966. this.extend(rowBuffer, bufferPadding, width);
  31967. this.filter(rowBuffer, bufferPadding, width);
  31968. items.set(rowBuffer.subarray(bufferPadding, bufferPadding + width), k);
  31969. }
  31970. }
  31971. let numBuffers = 16;
  31972. const colBuffers = [];
  31973. for (i = 0; i < numBuffers; i++) {
  31974. colBuffers.push(new Float32Array(height + 2 * bufferPadding));
  31975. }
  31976. let b,
  31977. currentBuffer = 0;
  31978. ll = bufferPadding + height;
  31979. if (height === 1) {
  31980. if ((v0 & 1) !== 0) {
  31981. for (u = 0; u < width; u++) {
  31982. items[u] *= 0.5;
  31983. }
  31984. }
  31985. } else {
  31986. for (u = 0; u < width; u++) {
  31987. if (currentBuffer === 0) {
  31988. numBuffers = Math.min(width - u, numBuffers);
  31989. for (k = u, l = bufferPadding; l < ll; k += width, l++) {
  31990. for (b = 0; b < numBuffers; b++) {
  31991. colBuffers[b][l] = items[k + b];
  31992. }
  31993. }
  31994. currentBuffer = numBuffers;
  31995. }
  31996. currentBuffer--;
  31997. const buffer = colBuffers[currentBuffer];
  31998. this.extend(buffer, bufferPadding, height);
  31999. this.filter(buffer, bufferPadding, height);
  32000. if (currentBuffer === 0) {
  32001. k = u - numBuffers + 1;
  32002. for (l = bufferPadding; l < ll; k += width, l++) {
  32003. for (b = 0; b < numBuffers; b++) {
  32004. items[k + b] = colBuffers[b][l];
  32005. }
  32006. }
  32007. }
  32008. }
  32009. }
  32010. return {
  32011. width,
  32012. height,
  32013. items
  32014. };
  32015. }
  32016. }
  32017. class IrreversibleTransform extends Transform {
  32018. filter(x, offset, length) {
  32019. const len = length >> 1;
  32020. offset |= 0;
  32021. let j, n, current, next;
  32022. const alpha = -1.586134342059924;
  32023. const beta = -0.052980118572961;
  32024. const gamma = 0.882911075530934;
  32025. const delta = 0.443506852043971;
  32026. const K = 1.230174104914001;
  32027. const K_ = 1 / K;
  32028. j = offset - 3;
  32029. for (n = len + 4; n--; j += 2) {
  32030. x[j] *= K_;
  32031. }
  32032. j = offset - 2;
  32033. current = delta * x[j - 1];
  32034. for (n = len + 3; n--; j += 2) {
  32035. next = delta * x[j + 1];
  32036. x[j] = K * x[j] - current - next;
  32037. if (n--) {
  32038. j += 2;
  32039. current = delta * x[j + 1];
  32040. x[j] = K * x[j] - current - next;
  32041. } else {
  32042. break;
  32043. }
  32044. }
  32045. j = offset - 1;
  32046. current = gamma * x[j - 1];
  32047. for (n = len + 2; n--; j += 2) {
  32048. next = gamma * x[j + 1];
  32049. x[j] -= current + next;
  32050. if (n--) {
  32051. j += 2;
  32052. current = gamma * x[j + 1];
  32053. x[j] -= current + next;
  32054. } else {
  32055. break;
  32056. }
  32057. }
  32058. j = offset;
  32059. current = beta * x[j - 1];
  32060. for (n = len + 1; n--; j += 2) {
  32061. next = beta * x[j + 1];
  32062. x[j] -= current + next;
  32063. if (n--) {
  32064. j += 2;
  32065. current = beta * x[j + 1];
  32066. x[j] -= current + next;
  32067. } else {
  32068. break;
  32069. }
  32070. }
  32071. if (len !== 0) {
  32072. j = offset + 1;
  32073. current = alpha * x[j - 1];
  32074. for (n = len; n--; j += 2) {
  32075. next = alpha * x[j + 1];
  32076. x[j] -= current + next;
  32077. if (n--) {
  32078. j += 2;
  32079. current = alpha * x[j + 1];
  32080. x[j] -= current + next;
  32081. } else {
  32082. break;
  32083. }
  32084. }
  32085. }
  32086. }
  32087. }
  32088. class ReversibleTransform extends Transform {
  32089. filter(x, offset, length) {
  32090. const len = length >> 1;
  32091. offset |= 0;
  32092. let j, n;
  32093. for (j = offset, n = len + 1; n--; j += 2) {
  32094. x[j] -= x[j - 1] + x[j + 1] + 2 >> 2;
  32095. }
  32096. for (j = offset + 1, n = len; n--; j += 2) {
  32097. x[j] += x[j - 1] + x[j + 1] >> 1;
  32098. }
  32099. }
  32100. }
  32101. /***/ }),
  32102. /* 41 */
  32103. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32104. Object.defineProperty(exports, "__esModule", ({
  32105. value: true
  32106. }));
  32107. exports.LZWStream = void 0;
  32108. var _decode_stream = __w_pdfjs_require__(29);
  32109. class LZWStream extends _decode_stream.DecodeStream {
  32110. constructor(str, maybeLength, earlyChange) {
  32111. super(maybeLength);
  32112. this.str = str;
  32113. this.dict = str.dict;
  32114. this.cachedData = 0;
  32115. this.bitsCached = 0;
  32116. const maxLzwDictionarySize = 4096;
  32117. const lzwState = {
  32118. earlyChange,
  32119. codeLength: 9,
  32120. nextCode: 258,
  32121. dictionaryValues: new Uint8Array(maxLzwDictionarySize),
  32122. dictionaryLengths: new Uint16Array(maxLzwDictionarySize),
  32123. dictionaryPrevCodes: new Uint16Array(maxLzwDictionarySize),
  32124. currentSequence: new Uint8Array(maxLzwDictionarySize),
  32125. currentSequenceLength: 0
  32126. };
  32127. for (let i = 0; i < 256; ++i) {
  32128. lzwState.dictionaryValues[i] = i;
  32129. lzwState.dictionaryLengths[i] = 1;
  32130. }
  32131. this.lzwState = lzwState;
  32132. }
  32133. readBits(n) {
  32134. let bitsCached = this.bitsCached;
  32135. let cachedData = this.cachedData;
  32136. while (bitsCached < n) {
  32137. const c = this.str.getByte();
  32138. if (c === -1) {
  32139. this.eof = true;
  32140. return null;
  32141. }
  32142. cachedData = cachedData << 8 | c;
  32143. bitsCached += 8;
  32144. }
  32145. this.bitsCached = bitsCached -= n;
  32146. this.cachedData = cachedData;
  32147. this.lastCode = null;
  32148. return cachedData >>> bitsCached & (1 << n) - 1;
  32149. }
  32150. readBlock() {
  32151. const blockSize = 512,
  32152. decodedSizeDelta = blockSize;
  32153. let estimatedDecodedSize = blockSize * 2;
  32154. let i, j, q;
  32155. const lzwState = this.lzwState;
  32156. if (!lzwState) {
  32157. return;
  32158. }
  32159. const earlyChange = lzwState.earlyChange;
  32160. let nextCode = lzwState.nextCode;
  32161. const dictionaryValues = lzwState.dictionaryValues;
  32162. const dictionaryLengths = lzwState.dictionaryLengths;
  32163. const dictionaryPrevCodes = lzwState.dictionaryPrevCodes;
  32164. let codeLength = lzwState.codeLength;
  32165. let prevCode = lzwState.prevCode;
  32166. const currentSequence = lzwState.currentSequence;
  32167. let currentSequenceLength = lzwState.currentSequenceLength;
  32168. let decodedLength = 0;
  32169. let currentBufferLength = this.bufferLength;
  32170. let buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  32171. for (i = 0; i < blockSize; i++) {
  32172. const code = this.readBits(codeLength);
  32173. const hasPrev = currentSequenceLength > 0;
  32174. if (code < 256) {
  32175. currentSequence[0] = code;
  32176. currentSequenceLength = 1;
  32177. } else if (code >= 258) {
  32178. if (code < nextCode) {
  32179. currentSequenceLength = dictionaryLengths[code];
  32180. for (j = currentSequenceLength - 1, q = code; j >= 0; j--) {
  32181. currentSequence[j] = dictionaryValues[q];
  32182. q = dictionaryPrevCodes[q];
  32183. }
  32184. } else {
  32185. currentSequence[currentSequenceLength++] = currentSequence[0];
  32186. }
  32187. } else if (code === 256) {
  32188. codeLength = 9;
  32189. nextCode = 258;
  32190. currentSequenceLength = 0;
  32191. continue;
  32192. } else {
  32193. this.eof = true;
  32194. delete this.lzwState;
  32195. break;
  32196. }
  32197. if (hasPrev) {
  32198. dictionaryPrevCodes[nextCode] = prevCode;
  32199. dictionaryLengths[nextCode] = dictionaryLengths[prevCode] + 1;
  32200. dictionaryValues[nextCode] = currentSequence[0];
  32201. nextCode++;
  32202. codeLength = nextCode + earlyChange & nextCode + earlyChange - 1 ? codeLength : Math.min(Math.log(nextCode + earlyChange) / 0.6931471805599453 + 1, 12) | 0;
  32203. }
  32204. prevCode = code;
  32205. decodedLength += currentSequenceLength;
  32206. if (estimatedDecodedSize < decodedLength) {
  32207. do {
  32208. estimatedDecodedSize += decodedSizeDelta;
  32209. } while (estimatedDecodedSize < decodedLength);
  32210. buffer = this.ensureBuffer(this.bufferLength + estimatedDecodedSize);
  32211. }
  32212. for (j = 0; j < currentSequenceLength; j++) {
  32213. buffer[currentBufferLength++] = currentSequence[j];
  32214. }
  32215. }
  32216. lzwState.nextCode = nextCode;
  32217. lzwState.codeLength = codeLength;
  32218. lzwState.prevCode = prevCode;
  32219. lzwState.currentSequenceLength = currentSequenceLength;
  32220. this.bufferLength = currentBufferLength;
  32221. }
  32222. }
  32223. exports.LZWStream = LZWStream;
  32224. /***/ }),
  32225. /* 42 */
  32226. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32227. Object.defineProperty(exports, "__esModule", ({
  32228. value: true
  32229. }));
  32230. exports.PredictorStream = void 0;
  32231. var _decode_stream = __w_pdfjs_require__(29);
  32232. var _primitives = __w_pdfjs_require__(5);
  32233. var _util = __w_pdfjs_require__(2);
  32234. class PredictorStream extends _decode_stream.DecodeStream {
  32235. constructor(str, maybeLength, params) {
  32236. super(maybeLength);
  32237. if (!(params instanceof _primitives.Dict)) {
  32238. return str;
  32239. }
  32240. const predictor = this.predictor = params.get("Predictor") || 1;
  32241. if (predictor <= 1) {
  32242. return str;
  32243. }
  32244. if (predictor !== 2 && (predictor < 10 || predictor > 15)) {
  32245. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32246. }
  32247. if (predictor === 2) {
  32248. this.readBlock = this.readBlockTiff;
  32249. } else {
  32250. this.readBlock = this.readBlockPng;
  32251. }
  32252. this.str = str;
  32253. this.dict = str.dict;
  32254. const colors = this.colors = params.get("Colors") || 1;
  32255. const bits = this.bits = params.get("BPC", "BitsPerComponent") || 8;
  32256. const columns = this.columns = params.get("Columns") || 1;
  32257. this.pixBytes = colors * bits + 7 >> 3;
  32258. this.rowBytes = columns * colors * bits + 7 >> 3;
  32259. return this;
  32260. }
  32261. readBlockTiff() {
  32262. const rowBytes = this.rowBytes;
  32263. const bufferLength = this.bufferLength;
  32264. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32265. const bits = this.bits;
  32266. const colors = this.colors;
  32267. const rawBytes = this.str.getBytes(rowBytes);
  32268. this.eof = !rawBytes.length;
  32269. if (this.eof) {
  32270. return;
  32271. }
  32272. let inbuf = 0,
  32273. outbuf = 0;
  32274. let inbits = 0,
  32275. outbits = 0;
  32276. let pos = bufferLength;
  32277. let i;
  32278. if (bits === 1 && colors === 1) {
  32279. for (i = 0; i < rowBytes; ++i) {
  32280. let c = rawBytes[i] ^ inbuf;
  32281. c ^= c >> 1;
  32282. c ^= c >> 2;
  32283. c ^= c >> 4;
  32284. inbuf = (c & 1) << 7;
  32285. buffer[pos++] = c;
  32286. }
  32287. } else if (bits === 8) {
  32288. for (i = 0; i < colors; ++i) {
  32289. buffer[pos++] = rawBytes[i];
  32290. }
  32291. for (; i < rowBytes; ++i) {
  32292. buffer[pos] = buffer[pos - colors] + rawBytes[i];
  32293. pos++;
  32294. }
  32295. } else if (bits === 16) {
  32296. const bytesPerPixel = colors * 2;
  32297. for (i = 0; i < bytesPerPixel; ++i) {
  32298. buffer[pos++] = rawBytes[i];
  32299. }
  32300. for (; i < rowBytes; i += 2) {
  32301. const sum = ((rawBytes[i] & 0xff) << 8) + (rawBytes[i + 1] & 0xff) + ((buffer[pos - bytesPerPixel] & 0xff) << 8) + (buffer[pos - bytesPerPixel + 1] & 0xff);
  32302. buffer[pos++] = sum >> 8 & 0xff;
  32303. buffer[pos++] = sum & 0xff;
  32304. }
  32305. } else {
  32306. const compArray = new Uint8Array(colors + 1);
  32307. const bitMask = (1 << bits) - 1;
  32308. let j = 0,
  32309. k = bufferLength;
  32310. const columns = this.columns;
  32311. for (i = 0; i < columns; ++i) {
  32312. for (let kk = 0; kk < colors; ++kk) {
  32313. if (inbits < bits) {
  32314. inbuf = inbuf << 8 | rawBytes[j++] & 0xff;
  32315. inbits += 8;
  32316. }
  32317. compArray[kk] = compArray[kk] + (inbuf >> inbits - bits) & bitMask;
  32318. inbits -= bits;
  32319. outbuf = outbuf << bits | compArray[kk];
  32320. outbits += bits;
  32321. if (outbits >= 8) {
  32322. buffer[k++] = outbuf >> outbits - 8 & 0xff;
  32323. outbits -= 8;
  32324. }
  32325. }
  32326. }
  32327. if (outbits > 0) {
  32328. buffer[k++] = (outbuf << 8 - outbits) + (inbuf & (1 << 8 - outbits) - 1);
  32329. }
  32330. }
  32331. this.bufferLength += rowBytes;
  32332. }
  32333. readBlockPng() {
  32334. const rowBytes = this.rowBytes;
  32335. const pixBytes = this.pixBytes;
  32336. const predictor = this.str.getByte();
  32337. const rawBytes = this.str.getBytes(rowBytes);
  32338. this.eof = !rawBytes.length;
  32339. if (this.eof) {
  32340. return;
  32341. }
  32342. const bufferLength = this.bufferLength;
  32343. const buffer = this.ensureBuffer(bufferLength + rowBytes);
  32344. let prevRow = buffer.subarray(bufferLength - rowBytes, bufferLength);
  32345. if (prevRow.length === 0) {
  32346. prevRow = new Uint8Array(rowBytes);
  32347. }
  32348. let i,
  32349. j = bufferLength,
  32350. up,
  32351. c;
  32352. switch (predictor) {
  32353. case 0:
  32354. for (i = 0; i < rowBytes; ++i) {
  32355. buffer[j++] = rawBytes[i];
  32356. }
  32357. break;
  32358. case 1:
  32359. for (i = 0; i < pixBytes; ++i) {
  32360. buffer[j++] = rawBytes[i];
  32361. }
  32362. for (; i < rowBytes; ++i) {
  32363. buffer[j] = buffer[j - pixBytes] + rawBytes[i] & 0xff;
  32364. j++;
  32365. }
  32366. break;
  32367. case 2:
  32368. for (i = 0; i < rowBytes; ++i) {
  32369. buffer[j++] = prevRow[i] + rawBytes[i] & 0xff;
  32370. }
  32371. break;
  32372. case 3:
  32373. for (i = 0; i < pixBytes; ++i) {
  32374. buffer[j++] = (prevRow[i] >> 1) + rawBytes[i];
  32375. }
  32376. for (; i < rowBytes; ++i) {
  32377. buffer[j] = (prevRow[i] + buffer[j - pixBytes] >> 1) + rawBytes[i] & 0xff;
  32378. j++;
  32379. }
  32380. break;
  32381. case 4:
  32382. for (i = 0; i < pixBytes; ++i) {
  32383. up = prevRow[i];
  32384. c = rawBytes[i];
  32385. buffer[j++] = up + c;
  32386. }
  32387. for (; i < rowBytes; ++i) {
  32388. up = prevRow[i];
  32389. const upLeft = prevRow[i - pixBytes];
  32390. const left = buffer[j - pixBytes];
  32391. const p = left + up - upLeft;
  32392. let pa = p - left;
  32393. if (pa < 0) {
  32394. pa = -pa;
  32395. }
  32396. let pb = p - up;
  32397. if (pb < 0) {
  32398. pb = -pb;
  32399. }
  32400. let pc = p - upLeft;
  32401. if (pc < 0) {
  32402. pc = -pc;
  32403. }
  32404. c = rawBytes[i];
  32405. if (pa <= pb && pa <= pc) {
  32406. buffer[j++] = left + c;
  32407. } else if (pb <= pc) {
  32408. buffer[j++] = up + c;
  32409. } else {
  32410. buffer[j++] = upLeft + c;
  32411. }
  32412. }
  32413. break;
  32414. default:
  32415. throw new _util.FormatError(`Unsupported predictor: ${predictor}`);
  32416. }
  32417. this.bufferLength += rowBytes;
  32418. }
  32419. }
  32420. exports.PredictorStream = PredictorStream;
  32421. /***/ }),
  32422. /* 43 */
  32423. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32424. Object.defineProperty(exports, "__esModule", ({
  32425. value: true
  32426. }));
  32427. exports.RunLengthStream = void 0;
  32428. var _decode_stream = __w_pdfjs_require__(29);
  32429. class RunLengthStream extends _decode_stream.DecodeStream {
  32430. constructor(str, maybeLength) {
  32431. super(maybeLength);
  32432. this.str = str;
  32433. this.dict = str.dict;
  32434. }
  32435. readBlock() {
  32436. const repeatHeader = this.str.getBytes(2);
  32437. if (!repeatHeader || repeatHeader.length < 2 || repeatHeader[0] === 128) {
  32438. this.eof = true;
  32439. return;
  32440. }
  32441. let buffer;
  32442. let bufferLength = this.bufferLength;
  32443. let n = repeatHeader[0];
  32444. if (n < 128) {
  32445. buffer = this.ensureBuffer(bufferLength + n + 1);
  32446. buffer[bufferLength++] = repeatHeader[1];
  32447. if (n > 0) {
  32448. const source = this.str.getBytes(n);
  32449. buffer.set(source, bufferLength);
  32450. bufferLength += n;
  32451. }
  32452. } else {
  32453. n = 257 - n;
  32454. const b = repeatHeader[1];
  32455. buffer = this.ensureBuffer(bufferLength + n + 1);
  32456. for (let i = 0; i < n; i++) {
  32457. buffer[bufferLength++] = b;
  32458. }
  32459. }
  32460. this.bufferLength = bufferLength;
  32461. }
  32462. }
  32463. exports.RunLengthStream = RunLengthStream;
  32464. /***/ }),
  32465. /* 44 */
  32466. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  32467. Object.defineProperty(exports, "__esModule", ({
  32468. value: true
  32469. }));
  32470. exports.Font = exports.ErrorFont = void 0;
  32471. var _util = __w_pdfjs_require__(2);
  32472. var _cff_parser = __w_pdfjs_require__(45);
  32473. var _fonts_utils = __w_pdfjs_require__(18);
  32474. var _unicode = __w_pdfjs_require__(21);
  32475. var _glyphlist = __w_pdfjs_require__(20);
  32476. var _encodings = __w_pdfjs_require__(19);
  32477. var _standard_fonts = __w_pdfjs_require__(47);
  32478. var _to_unicode_map = __w_pdfjs_require__(48);
  32479. var _cff_font = __w_pdfjs_require__(49);
  32480. var _font_renderer = __w_pdfjs_require__(50);
  32481. var _metrics = __w_pdfjs_require__(51);
  32482. var _glyf = __w_pdfjs_require__(52);
  32483. var _cmap = __w_pdfjs_require__(26);
  32484. var _opentype_file_builder = __w_pdfjs_require__(53);
  32485. var _core_utils = __w_pdfjs_require__(8);
  32486. var _stream = __w_pdfjs_require__(10);
  32487. var _type1_font = __w_pdfjs_require__(54);
  32488. const PRIVATE_USE_AREAS = [[0xe000, 0xf8ff], [0x100000, 0x10fffd]];
  32489. const PDF_GLYPH_SPACE_UNITS = 1000;
  32490. const EXPORT_DATA_PROPERTIES = ["ascent", "bbox", "black", "bold", "charProcOperatorList", "composite", "cssFontInfo", "data", "defaultVMetrics", "defaultWidth", "descent", "fallbackName", "fontMatrix", "fontType", "isType3Font", "italic", "loadedName", "mimetype", "missingFile", "name", "remeasure", "subtype", "type", "vertical"];
  32491. const EXPORT_DATA_EXTRA_PROPERTIES = ["cMap", "defaultEncoding", "differences", "isMonospace", "isSerifFont", "isSymbolicFont", "seacMap", "toFontChar", "toUnicode", "vmetrics", "widths"];
  32492. function adjustWidths(properties) {
  32493. if (!properties.fontMatrix) {
  32494. return;
  32495. }
  32496. if (properties.fontMatrix[0] === _util.FONT_IDENTITY_MATRIX[0]) {
  32497. return;
  32498. }
  32499. const scale = 0.001 / properties.fontMatrix[0];
  32500. const glyphsWidths = properties.widths;
  32501. for (const glyph in glyphsWidths) {
  32502. glyphsWidths[glyph] *= scale;
  32503. }
  32504. properties.defaultWidth *= scale;
  32505. }
  32506. function adjustToUnicode(properties, builtInEncoding) {
  32507. if (properties.isInternalFont) {
  32508. return;
  32509. }
  32510. if (builtInEncoding === properties.defaultEncoding) {
  32511. return;
  32512. }
  32513. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32514. return;
  32515. }
  32516. const toUnicode = [],
  32517. glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  32518. for (const charCode in builtInEncoding) {
  32519. if (properties.hasIncludedToUnicodeMap) {
  32520. if (properties.toUnicode.has(charCode)) {
  32521. continue;
  32522. }
  32523. } else if (properties.hasEncoding) {
  32524. if (properties.differences.length === 0 || properties.differences[charCode] !== undefined) {
  32525. continue;
  32526. }
  32527. }
  32528. const glyphName = builtInEncoding[charCode];
  32529. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  32530. if (unicode !== -1) {
  32531. toUnicode[charCode] = String.fromCharCode(unicode);
  32532. }
  32533. }
  32534. if (toUnicode.length > 0) {
  32535. properties.toUnicode.amend(toUnicode);
  32536. }
  32537. }
  32538. function amendFallbackToUnicode(properties) {
  32539. if (!properties.fallbackToUnicode) {
  32540. return;
  32541. }
  32542. if (properties.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  32543. return;
  32544. }
  32545. const toUnicode = [];
  32546. for (const charCode in properties.fallbackToUnicode) {
  32547. if (properties.toUnicode.has(charCode)) {
  32548. continue;
  32549. }
  32550. toUnicode[charCode] = properties.fallbackToUnicode[charCode];
  32551. }
  32552. if (toUnicode.length > 0) {
  32553. properties.toUnicode.amend(toUnicode);
  32554. }
  32555. }
  32556. class Glyph {
  32557. constructor(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32558. this.originalCharCode = originalCharCode;
  32559. this.fontChar = fontChar;
  32560. this.unicode = unicode;
  32561. this.accent = accent;
  32562. this.width = width;
  32563. this.vmetric = vmetric;
  32564. this.operatorListId = operatorListId;
  32565. this.isSpace = isSpace;
  32566. this.isInFont = isInFont;
  32567. const category = (0, _unicode.getCharUnicodeCategory)(unicode);
  32568. this.isWhitespace = category.isWhitespace;
  32569. this.isZeroWidthDiacritic = category.isZeroWidthDiacritic;
  32570. this.isInvisibleFormatMark = category.isInvisibleFormatMark;
  32571. }
  32572. matchesForCache(originalCharCode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont) {
  32573. return this.originalCharCode === originalCharCode && this.fontChar === fontChar && this.unicode === unicode && this.accent === accent && this.width === width && this.vmetric === vmetric && this.operatorListId === operatorListId && this.isSpace === isSpace && this.isInFont === isInFont;
  32574. }
  32575. }
  32576. function int16(b0, b1) {
  32577. return (b0 << 8) + b1;
  32578. }
  32579. function writeSignedInt16(bytes, index, value) {
  32580. bytes[index + 1] = value;
  32581. bytes[index] = value >>> 8;
  32582. }
  32583. function signedInt16(b0, b1) {
  32584. const value = (b0 << 8) + b1;
  32585. return value & 1 << 15 ? value - 0x10000 : value;
  32586. }
  32587. function int32(b0, b1, b2, b3) {
  32588. return (b0 << 24) + (b1 << 16) + (b2 << 8) + b3;
  32589. }
  32590. function string16(value) {
  32591. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32592. }
  32593. function safeString16(value) {
  32594. if (value > 0x7fff) {
  32595. value = 0x7fff;
  32596. } else if (value < -0x8000) {
  32597. value = -0x8000;
  32598. }
  32599. return String.fromCharCode(value >> 8 & 0xff, value & 0xff);
  32600. }
  32601. function isTrueTypeFile(file) {
  32602. const header = file.peekBytes(4);
  32603. return (0, _core_utils.readUint32)(header, 0) === 0x00010000 || (0, _util.bytesToString)(header) === "true";
  32604. }
  32605. function isTrueTypeCollectionFile(file) {
  32606. const header = file.peekBytes(4);
  32607. return (0, _util.bytesToString)(header) === "ttcf";
  32608. }
  32609. function isOpenTypeFile(file) {
  32610. const header = file.peekBytes(4);
  32611. return (0, _util.bytesToString)(header) === "OTTO";
  32612. }
  32613. function isType1File(file) {
  32614. const header = file.peekBytes(2);
  32615. if (header[0] === 0x25 && header[1] === 0x21) {
  32616. return true;
  32617. }
  32618. if (header[0] === 0x80 && header[1] === 0x01) {
  32619. return true;
  32620. }
  32621. return false;
  32622. }
  32623. function isCFFFile(file) {
  32624. const header = file.peekBytes(4);
  32625. if (header[0] >= 1 && header[3] >= 1 && header[3] <= 4) {
  32626. return true;
  32627. }
  32628. return false;
  32629. }
  32630. function getFontFileType(file, {
  32631. type,
  32632. subtype,
  32633. composite
  32634. }) {
  32635. let fileType, fileSubtype;
  32636. if (isTrueTypeFile(file) || isTrueTypeCollectionFile(file)) {
  32637. if (composite) {
  32638. fileType = "CIDFontType2";
  32639. } else {
  32640. fileType = "TrueType";
  32641. }
  32642. } else if (isOpenTypeFile(file)) {
  32643. if (composite) {
  32644. fileType = "CIDFontType2";
  32645. } else {
  32646. fileType = "OpenType";
  32647. }
  32648. } else if (isType1File(file)) {
  32649. if (composite) {
  32650. fileType = "CIDFontType0";
  32651. } else {
  32652. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32653. }
  32654. } else if (isCFFFile(file)) {
  32655. if (composite) {
  32656. fileType = "CIDFontType0";
  32657. fileSubtype = "CIDFontType0C";
  32658. } else {
  32659. fileType = type === "MMType1" ? "MMType1" : "Type1";
  32660. fileSubtype = "Type1C";
  32661. }
  32662. } else {
  32663. (0, _util.warn)("getFontFileType: Unable to detect correct font file Type/Subtype.");
  32664. fileType = type;
  32665. fileSubtype = subtype;
  32666. }
  32667. return [fileType, fileSubtype];
  32668. }
  32669. function applyStandardFontGlyphMap(map, glyphMap) {
  32670. for (const charCode in glyphMap) {
  32671. map[+charCode] = glyphMap[charCode];
  32672. }
  32673. }
  32674. function buildToFontChar(encoding, glyphsUnicodeMap, differences) {
  32675. const toFontChar = [];
  32676. let unicode;
  32677. for (let i = 0, ii = encoding.length; i < ii; i++) {
  32678. unicode = (0, _unicode.getUnicodeForGlyph)(encoding[i], glyphsUnicodeMap);
  32679. if (unicode !== -1) {
  32680. toFontChar[i] = unicode;
  32681. }
  32682. }
  32683. for (const charCode in differences) {
  32684. unicode = (0, _unicode.getUnicodeForGlyph)(differences[charCode], glyphsUnicodeMap);
  32685. if (unicode !== -1) {
  32686. toFontChar[+charCode] = unicode;
  32687. }
  32688. }
  32689. return toFontChar;
  32690. }
  32691. function convertCidString(charCode, cid, shouldThrow = false) {
  32692. switch (cid.length) {
  32693. case 1:
  32694. return cid.charCodeAt(0);
  32695. case 2:
  32696. return cid.charCodeAt(0) << 8 | cid.charCodeAt(1);
  32697. }
  32698. const msg = `Unsupported CID string (charCode ${charCode}): "${cid}".`;
  32699. if (shouldThrow) {
  32700. throw new _util.FormatError(msg);
  32701. }
  32702. (0, _util.warn)(msg);
  32703. return cid;
  32704. }
  32705. function adjustMapping(charCodeToGlyphId, hasGlyph, newGlyphZeroId) {
  32706. const newMap = Object.create(null);
  32707. const toFontChar = [];
  32708. let privateUseAreaIndex = 0;
  32709. let nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32710. let privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32711. for (let originalCharCode in charCodeToGlyphId) {
  32712. originalCharCode |= 0;
  32713. let glyphId = charCodeToGlyphId[originalCharCode];
  32714. if (!hasGlyph(glyphId)) {
  32715. continue;
  32716. }
  32717. if (nextAvailableFontCharCode > privateUseOffetEnd) {
  32718. privateUseAreaIndex++;
  32719. if (privateUseAreaIndex >= PRIVATE_USE_AREAS.length) {
  32720. (0, _util.warn)("Ran out of space in font private use area.");
  32721. break;
  32722. }
  32723. nextAvailableFontCharCode = PRIVATE_USE_AREAS[privateUseAreaIndex][0];
  32724. privateUseOffetEnd = PRIVATE_USE_AREAS[privateUseAreaIndex][1];
  32725. }
  32726. const fontCharCode = nextAvailableFontCharCode++;
  32727. if (glyphId === 0) {
  32728. glyphId = newGlyphZeroId;
  32729. }
  32730. newMap[fontCharCode] = glyphId;
  32731. toFontChar[originalCharCode] = fontCharCode;
  32732. }
  32733. return {
  32734. toFontChar,
  32735. charCodeToGlyphId: newMap,
  32736. nextAvailableFontCharCode
  32737. };
  32738. }
  32739. function getRanges(glyphs, numGlyphs) {
  32740. const codes = [];
  32741. for (const charCode in glyphs) {
  32742. if (glyphs[charCode] >= numGlyphs) {
  32743. continue;
  32744. }
  32745. codes.push({
  32746. fontCharCode: charCode | 0,
  32747. glyphId: glyphs[charCode]
  32748. });
  32749. }
  32750. if (codes.length === 0) {
  32751. codes.push({
  32752. fontCharCode: 0,
  32753. glyphId: 0
  32754. });
  32755. }
  32756. codes.sort(function fontGetRangesSort(a, b) {
  32757. return a.fontCharCode - b.fontCharCode;
  32758. });
  32759. const ranges = [];
  32760. const length = codes.length;
  32761. for (let n = 0; n < length;) {
  32762. const start = codes[n].fontCharCode;
  32763. const codeIndices = [codes[n].glyphId];
  32764. ++n;
  32765. let end = start;
  32766. while (n < length && end + 1 === codes[n].fontCharCode) {
  32767. codeIndices.push(codes[n].glyphId);
  32768. ++end;
  32769. ++n;
  32770. if (end === 0xffff) {
  32771. break;
  32772. }
  32773. }
  32774. ranges.push([start, end, codeIndices]);
  32775. }
  32776. return ranges;
  32777. }
  32778. function createCmapTable(glyphs, numGlyphs) {
  32779. const ranges = getRanges(glyphs, numGlyphs);
  32780. const numTables = ranges[ranges.length - 1][1] > 0xffff ? 2 : 1;
  32781. let cmap = "\x00\x00" + string16(numTables) + "\x00\x03" + "\x00\x01" + (0, _util.string32)(4 + numTables * 8);
  32782. let i, ii, j, jj;
  32783. for (i = ranges.length - 1; i >= 0; --i) {
  32784. if (ranges[i][0] <= 0xffff) {
  32785. break;
  32786. }
  32787. }
  32788. const bmpLength = i + 1;
  32789. if (ranges[i][0] < 0xffff && ranges[i][1] === 0xffff) {
  32790. ranges[i][1] = 0xfffe;
  32791. }
  32792. const trailingRangesCount = ranges[i][1] < 0xffff ? 1 : 0;
  32793. const segCount = bmpLength + trailingRangesCount;
  32794. const searchParams = _opentype_file_builder.OpenTypeFileBuilder.getSearchParams(segCount, 2);
  32795. let startCount = "";
  32796. let endCount = "";
  32797. let idDeltas = "";
  32798. let idRangeOffsets = "";
  32799. let glyphsIds = "";
  32800. let bias = 0;
  32801. let range, start, end, codes;
  32802. for (i = 0, ii = bmpLength; i < ii; i++) {
  32803. range = ranges[i];
  32804. start = range[0];
  32805. end = range[1];
  32806. startCount += string16(start);
  32807. endCount += string16(end);
  32808. codes = range[2];
  32809. let contiguous = true;
  32810. for (j = 1, jj = codes.length; j < jj; ++j) {
  32811. if (codes[j] !== codes[j - 1] + 1) {
  32812. contiguous = false;
  32813. break;
  32814. }
  32815. }
  32816. if (!contiguous) {
  32817. const offset = (segCount - i) * 2 + bias * 2;
  32818. bias += end - start + 1;
  32819. idDeltas += string16(0);
  32820. idRangeOffsets += string16(offset);
  32821. for (j = 0, jj = codes.length; j < jj; ++j) {
  32822. glyphsIds += string16(codes[j]);
  32823. }
  32824. } else {
  32825. const startCode = codes[0];
  32826. idDeltas += string16(startCode - start & 0xffff);
  32827. idRangeOffsets += string16(0);
  32828. }
  32829. }
  32830. if (trailingRangesCount > 0) {
  32831. endCount += "\xFF\xFF";
  32832. startCount += "\xFF\xFF";
  32833. idDeltas += "\x00\x01";
  32834. idRangeOffsets += "\x00\x00";
  32835. }
  32836. const format314 = "\x00\x00" + string16(2 * segCount) + string16(searchParams.range) + string16(searchParams.entry) + string16(searchParams.rangeShift) + endCount + "\x00\x00" + startCount + idDeltas + idRangeOffsets + glyphsIds;
  32837. let format31012 = "";
  32838. let header31012 = "";
  32839. if (numTables > 1) {
  32840. cmap += "\x00\x03" + "\x00\x0A" + (0, _util.string32)(4 + numTables * 8 + 4 + format314.length);
  32841. format31012 = "";
  32842. for (i = 0, ii = ranges.length; i < ii; i++) {
  32843. range = ranges[i];
  32844. start = range[0];
  32845. codes = range[2];
  32846. let code = codes[0];
  32847. for (j = 1, jj = codes.length; j < jj; ++j) {
  32848. if (codes[j] !== codes[j - 1] + 1) {
  32849. end = range[0] + j - 1;
  32850. format31012 += (0, _util.string32)(start) + (0, _util.string32)(end) + (0, _util.string32)(code);
  32851. start = end + 1;
  32852. code = codes[j];
  32853. }
  32854. }
  32855. format31012 += (0, _util.string32)(start) + (0, _util.string32)(range[1]) + (0, _util.string32)(code);
  32856. }
  32857. header31012 = "\x00\x0C" + "\x00\x00" + (0, _util.string32)(format31012.length + 16) + "\x00\x00\x00\x00" + (0, _util.string32)(format31012.length / 12);
  32858. }
  32859. return cmap + "\x00\x04" + string16(format314.length + 4) + format314 + header31012 + format31012;
  32860. }
  32861. function validateOS2Table(os2, file) {
  32862. file.pos = (file.start || 0) + os2.offset;
  32863. const version = file.getUint16();
  32864. file.skip(60);
  32865. const selection = file.getUint16();
  32866. if (version < 4 && selection & 0x0300) {
  32867. return false;
  32868. }
  32869. const firstChar = file.getUint16();
  32870. const lastChar = file.getUint16();
  32871. if (firstChar > lastChar) {
  32872. return false;
  32873. }
  32874. file.skip(6);
  32875. const usWinAscent = file.getUint16();
  32876. if (usWinAscent === 0) {
  32877. return false;
  32878. }
  32879. os2.data[8] = os2.data[9] = 0;
  32880. return true;
  32881. }
  32882. function createOS2Table(properties, charstrings, override) {
  32883. override = override || {
  32884. unitsPerEm: 0,
  32885. yMax: 0,
  32886. yMin: 0,
  32887. ascent: 0,
  32888. descent: 0
  32889. };
  32890. let ulUnicodeRange1 = 0;
  32891. let ulUnicodeRange2 = 0;
  32892. let ulUnicodeRange3 = 0;
  32893. let ulUnicodeRange4 = 0;
  32894. let firstCharIndex = null;
  32895. let lastCharIndex = 0;
  32896. if (charstrings) {
  32897. for (let code in charstrings) {
  32898. code |= 0;
  32899. if (firstCharIndex > code || !firstCharIndex) {
  32900. firstCharIndex = code;
  32901. }
  32902. if (lastCharIndex < code) {
  32903. lastCharIndex = code;
  32904. }
  32905. const position = (0, _unicode.getUnicodeRangeFor)(code);
  32906. if (position < 32) {
  32907. ulUnicodeRange1 |= 1 << position;
  32908. } else if (position < 64) {
  32909. ulUnicodeRange2 |= 1 << position - 32;
  32910. } else if (position < 96) {
  32911. ulUnicodeRange3 |= 1 << position - 64;
  32912. } else if (position < 123) {
  32913. ulUnicodeRange4 |= 1 << position - 96;
  32914. } else {
  32915. throw new _util.FormatError("Unicode ranges Bits > 123 are reserved for internal usage");
  32916. }
  32917. }
  32918. if (lastCharIndex > 0xffff) {
  32919. lastCharIndex = 0xffff;
  32920. }
  32921. } else {
  32922. firstCharIndex = 0;
  32923. lastCharIndex = 255;
  32924. }
  32925. const bbox = properties.bbox || [0, 0, 0, 0];
  32926. const unitsPerEm = override.unitsPerEm || 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  32927. const scale = properties.ascentScaled ? 1.0 : unitsPerEm / PDF_GLYPH_SPACE_UNITS;
  32928. const typoAscent = override.ascent || Math.round(scale * (properties.ascent || bbox[3]));
  32929. let typoDescent = override.descent || Math.round(scale * (properties.descent || bbox[1]));
  32930. if (typoDescent > 0 && properties.descent > 0 && bbox[1] < 0) {
  32931. typoDescent = -typoDescent;
  32932. }
  32933. const winAscent = override.yMax || typoAscent;
  32934. const winDescent = -override.yMin || -typoDescent;
  32935. 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" + (0, _util.string32)(ulUnicodeRange1) + (0, _util.string32)(ulUnicodeRange2) + (0, _util.string32)(ulUnicodeRange3) + (0, _util.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";
  32936. }
  32937. function createPostTable(properties) {
  32938. const angle = Math.floor(properties.italicAngle * 2 ** 16);
  32939. return "\x00\x03\x00\x00" + (0, _util.string32)(angle) + "\x00\x00" + "\x00\x00" + (0, _util.string32)(properties.fixedPitch ? 1 : 0) + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00" + "\x00\x00\x00\x00";
  32940. }
  32941. function createPostscriptName(name) {
  32942. return name.replace(/[^\x21-\x7E]|[[\](){}<>/%]/g, "").slice(0, 63);
  32943. }
  32944. function createNameTable(name, proto) {
  32945. if (!proto) {
  32946. proto = [[], []];
  32947. }
  32948. 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"];
  32949. const stringsUnicode = [];
  32950. let i, ii, j, jj, str;
  32951. for (i = 0, ii = strings.length; i < ii; i++) {
  32952. str = proto[1][i] || strings[i];
  32953. const strBufUnicode = [];
  32954. for (j = 0, jj = str.length; j < jj; j++) {
  32955. strBufUnicode.push(string16(str.charCodeAt(j)));
  32956. }
  32957. stringsUnicode.push(strBufUnicode.join(""));
  32958. }
  32959. const names = [strings, stringsUnicode];
  32960. const platforms = ["\x00\x01", "\x00\x03"];
  32961. const encodings = ["\x00\x00", "\x00\x01"];
  32962. const languages = ["\x00\x00", "\x04\x09"];
  32963. const namesRecordCount = strings.length * platforms.length;
  32964. let nameTable = "\x00\x00" + string16(namesRecordCount) + string16(namesRecordCount * 12 + 6);
  32965. let strOffset = 0;
  32966. for (i = 0, ii = platforms.length; i < ii; i++) {
  32967. const strs = names[i];
  32968. for (j = 0, jj = strs.length; j < jj; j++) {
  32969. str = strs[j];
  32970. const nameRecord = platforms[i] + encodings[i] + languages[i] + string16(j) + string16(str.length) + string16(strOffset);
  32971. nameTable += nameRecord;
  32972. strOffset += str.length;
  32973. }
  32974. }
  32975. nameTable += strings.join("") + stringsUnicode.join("");
  32976. return nameTable;
  32977. }
  32978. class Font {
  32979. constructor(name, file, properties) {
  32980. this.name = name;
  32981. this.psName = null;
  32982. this.mimetype = null;
  32983. this.disableFontFace = false;
  32984. this.loadedName = properties.loadedName;
  32985. this.isType3Font = properties.isType3Font;
  32986. this.missingFile = false;
  32987. this.cssFontInfo = properties.cssFontInfo;
  32988. this._charsCache = Object.create(null);
  32989. this._glyphCache = Object.create(null);
  32990. let isSerifFont = !!(properties.flags & _fonts_utils.FontFlags.Serif);
  32991. if (!isSerifFont && !properties.isSimulatedFlags) {
  32992. const baseName = name.replace(/[,_]/g, "-").split("-")[0],
  32993. serifFonts = (0, _standard_fonts.getSerifFonts)();
  32994. for (const namePart of baseName.split("+")) {
  32995. if (serifFonts[namePart]) {
  32996. isSerifFont = true;
  32997. break;
  32998. }
  32999. }
  33000. }
  33001. this.isSerifFont = isSerifFont;
  33002. this.isSymbolicFont = !!(properties.flags & _fonts_utils.FontFlags.Symbolic);
  33003. this.isMonospace = !!(properties.flags & _fonts_utils.FontFlags.FixedPitch);
  33004. let type = properties.type;
  33005. let subtype = properties.subtype;
  33006. this.type = type;
  33007. this.subtype = subtype;
  33008. let fallbackName = "sans-serif";
  33009. if (this.isMonospace) {
  33010. fallbackName = "monospace";
  33011. } else if (this.isSerifFont) {
  33012. fallbackName = "serif";
  33013. }
  33014. this.fallbackName = fallbackName;
  33015. this.differences = properties.differences;
  33016. this.widths = properties.widths;
  33017. this.defaultWidth = properties.defaultWidth;
  33018. this.composite = properties.composite;
  33019. this.cMap = properties.cMap;
  33020. this.capHeight = properties.capHeight / PDF_GLYPH_SPACE_UNITS;
  33021. this.ascent = properties.ascent / PDF_GLYPH_SPACE_UNITS;
  33022. this.descent = properties.descent / PDF_GLYPH_SPACE_UNITS;
  33023. this.lineHeight = this.ascent - this.descent;
  33024. this.fontMatrix = properties.fontMatrix;
  33025. this.bbox = properties.bbox;
  33026. this.defaultEncoding = properties.defaultEncoding;
  33027. this.toUnicode = properties.toUnicode;
  33028. this.toFontChar = [];
  33029. if (properties.type === "Type3") {
  33030. for (let charCode = 0; charCode < 256; charCode++) {
  33031. this.toFontChar[charCode] = this.differences[charCode] || properties.defaultEncoding[charCode];
  33032. }
  33033. this.fontType = _util.FontType.TYPE3;
  33034. return;
  33035. }
  33036. this.cidEncoding = properties.cidEncoding || "";
  33037. this.vertical = !!properties.vertical;
  33038. if (this.vertical) {
  33039. this.vmetrics = properties.vmetrics;
  33040. this.defaultVMetrics = properties.defaultVMetrics;
  33041. }
  33042. if (!file || file.isEmpty) {
  33043. if (file) {
  33044. (0, _util.warn)('Font file is empty in "' + name + '" (' + this.loadedName + ")");
  33045. }
  33046. this.fallbackToSystemFont(properties);
  33047. return;
  33048. }
  33049. [type, subtype] = getFontFileType(file, properties);
  33050. if (type !== this.type || subtype !== this.subtype) {
  33051. (0, _util.info)("Inconsistent font file Type/SubType, expected: " + `${this.type}/${this.subtype} but found: ${type}/${subtype}.`);
  33052. }
  33053. let data;
  33054. try {
  33055. switch (type) {
  33056. case "MMType1":
  33057. (0, _util.info)("MMType1 font (" + name + "), falling back to Type1.");
  33058. case "Type1":
  33059. case "CIDFontType0":
  33060. this.mimetype = "font/opentype";
  33061. const cff = subtype === "Type1C" || subtype === "CIDFontType0C" ? new _cff_font.CFFFont(file, properties) : new _type1_font.Type1Font(name, file, properties);
  33062. adjustWidths(properties);
  33063. data = this.convert(name, cff, properties);
  33064. break;
  33065. case "OpenType":
  33066. case "TrueType":
  33067. case "CIDFontType2":
  33068. this.mimetype = "font/opentype";
  33069. data = this.checkAndRepair(name, file, properties);
  33070. if (this.isOpenType) {
  33071. adjustWidths(properties);
  33072. type = "OpenType";
  33073. }
  33074. break;
  33075. default:
  33076. throw new _util.FormatError(`Font ${type} is not supported`);
  33077. }
  33078. } catch (e) {
  33079. (0, _util.warn)(e);
  33080. this.fallbackToSystemFont(properties);
  33081. return;
  33082. }
  33083. amendFallbackToUnicode(properties);
  33084. this.data = data;
  33085. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  33086. this.fontMatrix = properties.fontMatrix;
  33087. this.widths = properties.widths;
  33088. this.defaultWidth = properties.defaultWidth;
  33089. this.toUnicode = properties.toUnicode;
  33090. this.seacMap = properties.seacMap;
  33091. }
  33092. get renderer() {
  33093. const renderer = _font_renderer.FontRendererFactory.create(this, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  33094. return (0, _util.shadow)(this, "renderer", renderer);
  33095. }
  33096. exportData(extraProperties = false) {
  33097. const exportDataProperties = extraProperties ? [...EXPORT_DATA_PROPERTIES, ...EXPORT_DATA_EXTRA_PROPERTIES] : EXPORT_DATA_PROPERTIES;
  33098. const data = Object.create(null);
  33099. let property, value;
  33100. for (property of exportDataProperties) {
  33101. value = this[property];
  33102. if (value !== undefined) {
  33103. data[property] = value;
  33104. }
  33105. }
  33106. return data;
  33107. }
  33108. fallbackToSystemFont(properties) {
  33109. this.missingFile = true;
  33110. const name = this.name;
  33111. const type = this.type;
  33112. const subtype = this.subtype;
  33113. let fontName = (0, _fonts_utils.normalizeFontName)(name);
  33114. const stdFontMap = (0, _standard_fonts.getStdFontMap)(),
  33115. nonStdFontMap = (0, _standard_fonts.getNonStdFontMap)();
  33116. const isStandardFont = !!stdFontMap[fontName];
  33117. const isMappedToStandardFont = !!(nonStdFontMap[fontName] && stdFontMap[nonStdFontMap[fontName]]);
  33118. fontName = stdFontMap[fontName] || nonStdFontMap[fontName] || fontName;
  33119. const fontBasicMetricsMap = (0, _metrics.getFontBasicMetrics)();
  33120. const metrics = fontBasicMetricsMap[fontName];
  33121. if (metrics) {
  33122. if (isNaN(this.ascent)) {
  33123. this.ascent = metrics.ascent / PDF_GLYPH_SPACE_UNITS;
  33124. }
  33125. if (isNaN(this.descent)) {
  33126. this.descent = metrics.descent / PDF_GLYPH_SPACE_UNITS;
  33127. }
  33128. if (isNaN(this.capHeight)) {
  33129. this.capHeight = metrics.capHeight / PDF_GLYPH_SPACE_UNITS;
  33130. }
  33131. }
  33132. this.bold = fontName.search(/bold/gi) !== -1;
  33133. this.italic = fontName.search(/oblique/gi) !== -1 || fontName.search(/italic/gi) !== -1;
  33134. this.black = name.search(/Black/g) !== -1;
  33135. const isNarrow = name.search(/Narrow/g) !== -1;
  33136. this.remeasure = (!isStandardFont || isNarrow) && Object.keys(this.widths).length > 0;
  33137. if ((isStandardFont || isMappedToStandardFont) && type === "CIDFontType2" && this.cidEncoding.startsWith("Identity-")) {
  33138. const cidToGidMap = properties.cidToGidMap;
  33139. const map = [];
  33140. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  33141. if (/Arial-?Black/i.test(name)) {
  33142. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForArialBlack)());
  33143. } else if (/Calibri/i.test(name)) {
  33144. applyStandardFontGlyphMap(map, (0, _standard_fonts.getSupplementalGlyphMapForCalibri)());
  33145. }
  33146. if (cidToGidMap) {
  33147. for (const charCode in map) {
  33148. const cid = map[charCode];
  33149. if (cidToGidMap[cid] !== undefined) {
  33150. map[+charCode] = cidToGidMap[cid];
  33151. }
  33152. }
  33153. if (cidToGidMap.length !== this.toUnicode.length && properties.hasIncludedToUnicodeMap && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33154. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33155. const cid = map[charCode];
  33156. if (cidToGidMap[cid] === undefined) {
  33157. map[+charCode] = unicodeCharCode;
  33158. }
  33159. });
  33160. }
  33161. }
  33162. if (!(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33163. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33164. map[+charCode] = unicodeCharCode;
  33165. });
  33166. }
  33167. this.toFontChar = map;
  33168. this.toUnicode = new _to_unicode_map.ToUnicodeMap(map);
  33169. } else if (/Symbol/i.test(fontName)) {
  33170. this.toFontChar = buildToFontChar(_encodings.SymbolSetEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  33171. } else if (/Dingbats/i.test(fontName)) {
  33172. if (/Wingdings/i.test(name)) {
  33173. (0, _util.warn)("Non-embedded Wingdings font, falling back to ZapfDingbats.");
  33174. }
  33175. this.toFontChar = buildToFontChar(_encodings.ZapfDingbatsEncoding, (0, _glyphlist.getDingbatsGlyphsUnicode)(), this.differences);
  33176. } else if (isStandardFont) {
  33177. const map = buildToFontChar(this.defaultEncoding, (0, _glyphlist.getGlyphsUnicode)(), this.differences);
  33178. if (type === "CIDFontType2" && !this.cidEncoding.startsWith("Identity-") && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  33179. this.toUnicode.forEach(function (charCode, unicodeCharCode) {
  33180. map[+charCode] = unicodeCharCode;
  33181. });
  33182. }
  33183. this.toFontChar = map;
  33184. } else {
  33185. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  33186. const map = [];
  33187. this.toUnicode.forEach((charCode, unicodeCharCode) => {
  33188. if (!this.composite) {
  33189. const glyphName = this.differences[charCode] || this.defaultEncoding[charCode];
  33190. const unicode = (0, _unicode.getUnicodeForGlyph)(glyphName, glyphsUnicodeMap);
  33191. if (unicode !== -1) {
  33192. unicodeCharCode = unicode;
  33193. }
  33194. }
  33195. map[+charCode] = unicodeCharCode;
  33196. });
  33197. if (this.composite && this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap) {
  33198. if (/Verdana/i.test(name)) {
  33199. applyStandardFontGlyphMap(map, (0, _standard_fonts.getGlyphMapForStandardFonts)());
  33200. }
  33201. }
  33202. this.toFontChar = map;
  33203. }
  33204. amendFallbackToUnicode(properties);
  33205. this.loadedName = fontName.split("-")[0];
  33206. this.fontType = (0, _fonts_utils.getFontType)(type, subtype, properties.isStandardFont);
  33207. }
  33208. checkAndRepair(name, font, properties) {
  33209. const VALID_TABLES = ["OS/2", "cmap", "head", "hhea", "hmtx", "maxp", "name", "post", "loca", "glyf", "fpgm", "prep", "cvt ", "CFF "];
  33210. function readTables(file, numTables) {
  33211. const tables = Object.create(null);
  33212. tables["OS/2"] = null;
  33213. tables.cmap = null;
  33214. tables.head = null;
  33215. tables.hhea = null;
  33216. tables.hmtx = null;
  33217. tables.maxp = null;
  33218. tables.name = null;
  33219. tables.post = null;
  33220. for (let i = 0; i < numTables; i++) {
  33221. const table = readTableEntry(file);
  33222. if (!VALID_TABLES.includes(table.tag)) {
  33223. continue;
  33224. }
  33225. if (table.length === 0) {
  33226. continue;
  33227. }
  33228. tables[table.tag] = table;
  33229. }
  33230. return tables;
  33231. }
  33232. function readTableEntry(file) {
  33233. const tag = file.getString(4);
  33234. const checksum = file.getInt32() >>> 0;
  33235. const offset = file.getInt32() >>> 0;
  33236. const length = file.getInt32() >>> 0;
  33237. const previousPosition = file.pos;
  33238. file.pos = file.start ? file.start : 0;
  33239. file.skip(offset);
  33240. const data = file.getBytes(length);
  33241. file.pos = previousPosition;
  33242. if (tag === "head") {
  33243. data[8] = data[9] = data[10] = data[11] = 0;
  33244. data[17] |= 0x20;
  33245. }
  33246. return {
  33247. tag,
  33248. checksum,
  33249. length,
  33250. offset,
  33251. data
  33252. };
  33253. }
  33254. function readOpenTypeHeader(ttf) {
  33255. return {
  33256. version: ttf.getString(4),
  33257. numTables: ttf.getUint16(),
  33258. searchRange: ttf.getUint16(),
  33259. entrySelector: ttf.getUint16(),
  33260. rangeShift: ttf.getUint16()
  33261. };
  33262. }
  33263. function readTrueTypeCollectionHeader(ttc) {
  33264. const ttcTag = ttc.getString(4);
  33265. (0, _util.assert)(ttcTag === "ttcf", "Must be a TrueType Collection font.");
  33266. const majorVersion = ttc.getUint16();
  33267. const minorVersion = ttc.getUint16();
  33268. const numFonts = ttc.getInt32() >>> 0;
  33269. const offsetTable = [];
  33270. for (let i = 0; i < numFonts; i++) {
  33271. offsetTable.push(ttc.getInt32() >>> 0);
  33272. }
  33273. const header = {
  33274. ttcTag,
  33275. majorVersion,
  33276. minorVersion,
  33277. numFonts,
  33278. offsetTable
  33279. };
  33280. switch (majorVersion) {
  33281. case 1:
  33282. return header;
  33283. case 2:
  33284. header.dsigTag = ttc.getInt32() >>> 0;
  33285. header.dsigLength = ttc.getInt32() >>> 0;
  33286. header.dsigOffset = ttc.getInt32() >>> 0;
  33287. return header;
  33288. }
  33289. throw new _util.FormatError(`Invalid TrueType Collection majorVersion: ${majorVersion}.`);
  33290. }
  33291. function readTrueTypeCollectionData(ttc, fontName) {
  33292. const {
  33293. numFonts,
  33294. offsetTable
  33295. } = readTrueTypeCollectionHeader(ttc);
  33296. const fontNameParts = fontName.split("+");
  33297. let fallbackData;
  33298. for (let i = 0; i < numFonts; i++) {
  33299. ttc.pos = (ttc.start || 0) + offsetTable[i];
  33300. const potentialHeader = readOpenTypeHeader(ttc);
  33301. const potentialTables = readTables(ttc, potentialHeader.numTables);
  33302. if (!potentialTables.name) {
  33303. throw new _util.FormatError('TrueType Collection font must contain a "name" table.');
  33304. }
  33305. const nameTable = readNameTable(potentialTables.name);
  33306. for (let j = 0, jj = nameTable.length; j < jj; j++) {
  33307. for (let k = 0, kk = nameTable[j].length; k < kk; k++) {
  33308. const nameEntry = nameTable[j][k] && nameTable[j][k].replace(/\s/g, "");
  33309. if (!nameEntry) {
  33310. continue;
  33311. }
  33312. if (nameEntry === fontName) {
  33313. return {
  33314. header: potentialHeader,
  33315. tables: potentialTables
  33316. };
  33317. }
  33318. if (fontNameParts.length < 2) {
  33319. continue;
  33320. }
  33321. for (const part of fontNameParts) {
  33322. if (nameEntry === part) {
  33323. fallbackData = {
  33324. name: part,
  33325. header: potentialHeader,
  33326. tables: potentialTables
  33327. };
  33328. }
  33329. }
  33330. }
  33331. }
  33332. }
  33333. if (fallbackData) {
  33334. (0, _util.warn)(`TrueType Collection does not contain "${fontName}" font, ` + `falling back to "${fallbackData.name}" font instead.`);
  33335. return {
  33336. header: fallbackData.header,
  33337. tables: fallbackData.tables
  33338. };
  33339. }
  33340. throw new _util.FormatError(`TrueType Collection does not contain "${fontName}" font.`);
  33341. }
  33342. function readCmapTable(cmap, file, isSymbolicFont, hasEncoding) {
  33343. if (!cmap) {
  33344. (0, _util.warn)("No cmap table available.");
  33345. return {
  33346. platformId: -1,
  33347. encodingId: -1,
  33348. mappings: [],
  33349. hasShortCmap: false
  33350. };
  33351. }
  33352. let segment;
  33353. let start = (file.start ? file.start : 0) + cmap.offset;
  33354. file.pos = start;
  33355. file.skip(2);
  33356. const numTables = file.getUint16();
  33357. let potentialTable;
  33358. let canBreak = false;
  33359. for (let i = 0; i < numTables; i++) {
  33360. const platformId = file.getUint16();
  33361. const encodingId = file.getUint16();
  33362. const offset = file.getInt32() >>> 0;
  33363. let useTable = false;
  33364. if (potentialTable && potentialTable.platformId === platformId && potentialTable.encodingId === encodingId) {
  33365. continue;
  33366. }
  33367. if (platformId === 0 && (encodingId === 0 || encodingId === 1 || encodingId === 3)) {
  33368. useTable = true;
  33369. } else if (platformId === 1 && encodingId === 0) {
  33370. useTable = true;
  33371. } else if (platformId === 3 && encodingId === 1 && (hasEncoding || !potentialTable)) {
  33372. useTable = true;
  33373. if (!isSymbolicFont) {
  33374. canBreak = true;
  33375. }
  33376. } else if (isSymbolicFont && platformId === 3 && encodingId === 0) {
  33377. useTable = true;
  33378. let correctlySorted = true;
  33379. if (i < numTables - 1) {
  33380. const nextBytes = file.peekBytes(2),
  33381. nextPlatformId = int16(nextBytes[0], nextBytes[1]);
  33382. if (nextPlatformId < platformId) {
  33383. correctlySorted = false;
  33384. }
  33385. }
  33386. if (correctlySorted) {
  33387. canBreak = true;
  33388. }
  33389. }
  33390. if (useTable) {
  33391. potentialTable = {
  33392. platformId,
  33393. encodingId,
  33394. offset
  33395. };
  33396. }
  33397. if (canBreak) {
  33398. break;
  33399. }
  33400. }
  33401. if (potentialTable) {
  33402. file.pos = start + potentialTable.offset;
  33403. }
  33404. if (!potentialTable || file.peekByte() === -1) {
  33405. (0, _util.warn)("Could not find a preferred cmap table.");
  33406. return {
  33407. platformId: -1,
  33408. encodingId: -1,
  33409. mappings: [],
  33410. hasShortCmap: false
  33411. };
  33412. }
  33413. const format = file.getUint16();
  33414. let hasShortCmap = false;
  33415. const mappings = [];
  33416. let j, glyphId;
  33417. if (format === 0) {
  33418. file.skip(2 + 2);
  33419. for (j = 0; j < 256; j++) {
  33420. const index = file.getByte();
  33421. if (!index) {
  33422. continue;
  33423. }
  33424. mappings.push({
  33425. charCode: j,
  33426. glyphId: index
  33427. });
  33428. }
  33429. hasShortCmap = true;
  33430. } else if (format === 2) {
  33431. file.skip(2 + 2);
  33432. const subHeaderKeys = [];
  33433. let maxSubHeaderKey = 0;
  33434. for (let i = 0; i < 256; i++) {
  33435. const subHeaderKey = file.getUint16() >> 3;
  33436. subHeaderKeys.push(subHeaderKey);
  33437. maxSubHeaderKey = Math.max(subHeaderKey, maxSubHeaderKey);
  33438. }
  33439. const subHeaders = [];
  33440. for (let i = 0; i <= maxSubHeaderKey; i++) {
  33441. subHeaders.push({
  33442. firstCode: file.getUint16(),
  33443. entryCount: file.getUint16(),
  33444. idDelta: signedInt16(file.getByte(), file.getByte()),
  33445. idRangePos: file.pos + file.getUint16()
  33446. });
  33447. }
  33448. for (let i = 0; i < 256; i++) {
  33449. if (subHeaderKeys[i] === 0) {
  33450. file.pos = subHeaders[0].idRangePos + 2 * i;
  33451. glyphId = file.getUint16();
  33452. mappings.push({
  33453. charCode: i,
  33454. glyphId
  33455. });
  33456. } else {
  33457. const s = subHeaders[subHeaderKeys[i]];
  33458. for (j = 0; j < s.entryCount; j++) {
  33459. const charCode = (i << 8) + j + s.firstCode;
  33460. file.pos = s.idRangePos + 2 * j;
  33461. glyphId = file.getUint16();
  33462. if (glyphId !== 0) {
  33463. glyphId = (glyphId + s.idDelta) % 65536;
  33464. }
  33465. mappings.push({
  33466. charCode,
  33467. glyphId
  33468. });
  33469. }
  33470. }
  33471. }
  33472. } else if (format === 4) {
  33473. file.skip(2 + 2);
  33474. const segCount = file.getUint16() >> 1;
  33475. file.skip(6);
  33476. const segments = [];
  33477. let segIndex;
  33478. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33479. segments.push({
  33480. end: file.getUint16()
  33481. });
  33482. }
  33483. file.skip(2);
  33484. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33485. segments[segIndex].start = file.getUint16();
  33486. }
  33487. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33488. segments[segIndex].delta = file.getUint16();
  33489. }
  33490. let offsetsCount = 0,
  33491. offsetIndex;
  33492. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33493. segment = segments[segIndex];
  33494. const rangeOffset = file.getUint16();
  33495. if (!rangeOffset) {
  33496. segment.offsetIndex = -1;
  33497. continue;
  33498. }
  33499. offsetIndex = (rangeOffset >> 1) - (segCount - segIndex);
  33500. segment.offsetIndex = offsetIndex;
  33501. offsetsCount = Math.max(offsetsCount, offsetIndex + segment.end - segment.start + 1);
  33502. }
  33503. const offsets = [];
  33504. for (j = 0; j < offsetsCount; j++) {
  33505. offsets.push(file.getUint16());
  33506. }
  33507. for (segIndex = 0; segIndex < segCount; segIndex++) {
  33508. segment = segments[segIndex];
  33509. start = segment.start;
  33510. const end = segment.end;
  33511. const delta = segment.delta;
  33512. offsetIndex = segment.offsetIndex;
  33513. for (j = start; j <= end; j++) {
  33514. if (j === 0xffff) {
  33515. continue;
  33516. }
  33517. glyphId = offsetIndex < 0 ? j : offsets[offsetIndex + j - start];
  33518. glyphId = glyphId + delta & 0xffff;
  33519. mappings.push({
  33520. charCode: j,
  33521. glyphId
  33522. });
  33523. }
  33524. }
  33525. } else if (format === 6) {
  33526. file.skip(2 + 2);
  33527. const firstCode = file.getUint16();
  33528. const entryCount = file.getUint16();
  33529. for (j = 0; j < entryCount; j++) {
  33530. glyphId = file.getUint16();
  33531. const charCode = firstCode + j;
  33532. mappings.push({
  33533. charCode,
  33534. glyphId
  33535. });
  33536. }
  33537. } else if (format === 12) {
  33538. file.skip(2 + 4 + 4);
  33539. const nGroups = file.getInt32() >>> 0;
  33540. for (j = 0; j < nGroups; j++) {
  33541. const startCharCode = file.getInt32() >>> 0;
  33542. const endCharCode = file.getInt32() >>> 0;
  33543. let glyphCode = file.getInt32() >>> 0;
  33544. for (let charCode = startCharCode; charCode <= endCharCode; charCode++) {
  33545. mappings.push({
  33546. charCode,
  33547. glyphId: glyphCode++
  33548. });
  33549. }
  33550. }
  33551. } else {
  33552. (0, _util.warn)("cmap table has unsupported format: " + format);
  33553. return {
  33554. platformId: -1,
  33555. encodingId: -1,
  33556. mappings: [],
  33557. hasShortCmap: false
  33558. };
  33559. }
  33560. mappings.sort(function (a, b) {
  33561. return a.charCode - b.charCode;
  33562. });
  33563. for (let i = 1; i < mappings.length; i++) {
  33564. if (mappings[i - 1].charCode === mappings[i].charCode) {
  33565. mappings.splice(i, 1);
  33566. i--;
  33567. }
  33568. }
  33569. return {
  33570. platformId: potentialTable.platformId,
  33571. encodingId: potentialTable.encodingId,
  33572. mappings,
  33573. hasShortCmap
  33574. };
  33575. }
  33576. function sanitizeMetrics(file, header, metrics, headTable, numGlyphs, dupFirstEntry) {
  33577. if (!header) {
  33578. if (metrics) {
  33579. metrics.data = null;
  33580. }
  33581. return;
  33582. }
  33583. file.pos = (file.start ? file.start : 0) + header.offset;
  33584. file.pos += 4;
  33585. file.pos += 2;
  33586. file.pos += 2;
  33587. file.pos += 2;
  33588. file.pos += 2;
  33589. file.pos += 2;
  33590. file.pos += 2;
  33591. file.pos += 2;
  33592. file.pos += 2;
  33593. file.pos += 2;
  33594. const caretOffset = file.getUint16();
  33595. file.pos += 8;
  33596. file.pos += 2;
  33597. let numOfMetrics = file.getUint16();
  33598. if (caretOffset !== 0) {
  33599. const macStyle = int16(headTable.data[44], headTable.data[45]);
  33600. if (!(macStyle & 2)) {
  33601. header.data[22] = 0;
  33602. header.data[23] = 0;
  33603. }
  33604. }
  33605. if (numOfMetrics > numGlyphs) {
  33606. (0, _util.info)(`The numOfMetrics (${numOfMetrics}) should not be ` + `greater than the numGlyphs (${numGlyphs}).`);
  33607. numOfMetrics = numGlyphs;
  33608. header.data[34] = (numOfMetrics & 0xff00) >> 8;
  33609. header.data[35] = numOfMetrics & 0x00ff;
  33610. }
  33611. const numOfSidebearings = numGlyphs - numOfMetrics;
  33612. const numMissing = numOfSidebearings - (metrics.length - numOfMetrics * 4 >> 1);
  33613. if (numMissing > 0) {
  33614. const entries = new Uint8Array(metrics.length + numMissing * 2);
  33615. entries.set(metrics.data);
  33616. if (dupFirstEntry) {
  33617. entries[metrics.length] = metrics.data[2];
  33618. entries[metrics.length + 1] = metrics.data[3];
  33619. }
  33620. metrics.data = entries;
  33621. }
  33622. }
  33623. function sanitizeGlyph(source, sourceStart, sourceEnd, dest, destStart, hintsValid) {
  33624. const glyphProfile = {
  33625. length: 0,
  33626. sizeOfInstructions: 0
  33627. };
  33628. if (sourceEnd - sourceStart <= 12) {
  33629. return glyphProfile;
  33630. }
  33631. const glyf = source.subarray(sourceStart, sourceEnd);
  33632. let contoursCount = signedInt16(glyf[0], glyf[1]);
  33633. if (contoursCount < 0) {
  33634. contoursCount = -1;
  33635. writeSignedInt16(glyf, 0, contoursCount);
  33636. dest.set(glyf, destStart);
  33637. glyphProfile.length = glyf.length;
  33638. return glyphProfile;
  33639. }
  33640. let i,
  33641. j = 10,
  33642. flagsCount = 0;
  33643. for (i = 0; i < contoursCount; i++) {
  33644. const endPoint = glyf[j] << 8 | glyf[j + 1];
  33645. flagsCount = endPoint + 1;
  33646. j += 2;
  33647. }
  33648. const instructionsStart = j;
  33649. const instructionsLength = glyf[j] << 8 | glyf[j + 1];
  33650. glyphProfile.sizeOfInstructions = instructionsLength;
  33651. j += 2 + instructionsLength;
  33652. const instructionsEnd = j;
  33653. let coordinatesLength = 0;
  33654. for (i = 0; i < flagsCount; i++) {
  33655. const flag = glyf[j++];
  33656. if (flag & 0xc0) {
  33657. glyf[j - 1] = flag & 0x3f;
  33658. }
  33659. let xLength = 2;
  33660. if (flag & 2) {
  33661. xLength = 1;
  33662. } else if (flag & 16) {
  33663. xLength = 0;
  33664. }
  33665. let yLength = 2;
  33666. if (flag & 4) {
  33667. yLength = 1;
  33668. } else if (flag & 32) {
  33669. yLength = 0;
  33670. }
  33671. const xyLength = xLength + yLength;
  33672. coordinatesLength += xyLength;
  33673. if (flag & 8) {
  33674. const repeat = glyf[j++];
  33675. i += repeat;
  33676. coordinatesLength += repeat * xyLength;
  33677. }
  33678. }
  33679. if (coordinatesLength === 0) {
  33680. return glyphProfile;
  33681. }
  33682. let glyphDataLength = j + coordinatesLength;
  33683. if (glyphDataLength > glyf.length) {
  33684. return glyphProfile;
  33685. }
  33686. if (!hintsValid && instructionsLength > 0) {
  33687. dest.set(glyf.subarray(0, instructionsStart), destStart);
  33688. dest.set([0, 0], destStart + instructionsStart);
  33689. dest.set(glyf.subarray(instructionsEnd, glyphDataLength), destStart + instructionsStart + 2);
  33690. glyphDataLength -= instructionsLength;
  33691. if (glyf.length - glyphDataLength > 3) {
  33692. glyphDataLength = glyphDataLength + 3 & ~3;
  33693. }
  33694. glyphProfile.length = glyphDataLength;
  33695. return glyphProfile;
  33696. }
  33697. if (glyf.length - glyphDataLength > 3) {
  33698. glyphDataLength = glyphDataLength + 3 & ~3;
  33699. dest.set(glyf.subarray(0, glyphDataLength), destStart);
  33700. glyphProfile.length = glyphDataLength;
  33701. return glyphProfile;
  33702. }
  33703. dest.set(glyf, destStart);
  33704. glyphProfile.length = glyf.length;
  33705. return glyphProfile;
  33706. }
  33707. function sanitizeHead(head, numGlyphs, locaLength) {
  33708. const data = head.data;
  33709. const version = int32(data[0], data[1], data[2], data[3]);
  33710. if (version >> 16 !== 1) {
  33711. (0, _util.info)("Attempting to fix invalid version in head table: " + version);
  33712. data[0] = 0;
  33713. data[1] = 1;
  33714. data[2] = 0;
  33715. data[3] = 0;
  33716. }
  33717. const indexToLocFormat = int16(data[50], data[51]);
  33718. if (indexToLocFormat < 0 || indexToLocFormat > 1) {
  33719. (0, _util.info)("Attempting to fix invalid indexToLocFormat in head table: " + indexToLocFormat);
  33720. const numGlyphsPlusOne = numGlyphs + 1;
  33721. if (locaLength === numGlyphsPlusOne << 1) {
  33722. data[50] = 0;
  33723. data[51] = 0;
  33724. } else if (locaLength === numGlyphsPlusOne << 2) {
  33725. data[50] = 0;
  33726. data[51] = 1;
  33727. } else {
  33728. throw new _util.FormatError("Could not fix indexToLocFormat: " + indexToLocFormat);
  33729. }
  33730. }
  33731. }
  33732. function sanitizeGlyphLocations(loca, glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions) {
  33733. let itemSize, itemDecode, itemEncode;
  33734. if (isGlyphLocationsLong) {
  33735. itemSize = 4;
  33736. itemDecode = function fontItemDecodeLong(data, offset) {
  33737. return data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3];
  33738. };
  33739. itemEncode = function fontItemEncodeLong(data, offset, value) {
  33740. data[offset] = value >>> 24 & 0xff;
  33741. data[offset + 1] = value >> 16 & 0xff;
  33742. data[offset + 2] = value >> 8 & 0xff;
  33743. data[offset + 3] = value & 0xff;
  33744. };
  33745. } else {
  33746. itemSize = 2;
  33747. itemDecode = function fontItemDecode(data, offset) {
  33748. return data[offset] << 9 | data[offset + 1] << 1;
  33749. };
  33750. itemEncode = function fontItemEncode(data, offset, value) {
  33751. data[offset] = value >> 9 & 0xff;
  33752. data[offset + 1] = value >> 1 & 0xff;
  33753. };
  33754. }
  33755. const numGlyphsOut = dupFirstEntry ? numGlyphs + 1 : numGlyphs;
  33756. const locaDataSize = itemSize * (1 + numGlyphsOut);
  33757. const locaData = new Uint8Array(locaDataSize);
  33758. locaData.set(loca.data.subarray(0, locaDataSize));
  33759. loca.data = locaData;
  33760. const oldGlyfData = glyf.data;
  33761. const oldGlyfDataLength = oldGlyfData.length;
  33762. const newGlyfData = new Uint8Array(oldGlyfDataLength);
  33763. let i, j;
  33764. const locaEntries = [];
  33765. for (i = 0, j = 0; i < numGlyphs + 1; i++, j += itemSize) {
  33766. let offset = itemDecode(locaData, j);
  33767. if (offset > oldGlyfDataLength) {
  33768. offset = oldGlyfDataLength;
  33769. }
  33770. locaEntries.push({
  33771. index: i,
  33772. offset,
  33773. endOffset: 0
  33774. });
  33775. }
  33776. locaEntries.sort((a, b) => {
  33777. return a.offset - b.offset;
  33778. });
  33779. for (i = 0; i < numGlyphs; i++) {
  33780. locaEntries[i].endOffset = locaEntries[i + 1].offset;
  33781. }
  33782. locaEntries.sort((a, b) => {
  33783. return a.index - b.index;
  33784. });
  33785. for (i = 0; i < numGlyphs; i++) {
  33786. const {
  33787. offset,
  33788. endOffset
  33789. } = locaEntries[i];
  33790. if (offset !== 0 || endOffset !== 0) {
  33791. break;
  33792. }
  33793. const nextOffset = locaEntries[i + 1].offset;
  33794. if (nextOffset === 0) {
  33795. continue;
  33796. }
  33797. locaEntries[i].endOffset = nextOffset;
  33798. break;
  33799. }
  33800. const missingGlyphs = Object.create(null);
  33801. let writeOffset = 0;
  33802. itemEncode(locaData, 0, writeOffset);
  33803. for (i = 0, j = itemSize; i < numGlyphs; i++, j += itemSize) {
  33804. const glyphProfile = sanitizeGlyph(oldGlyfData, locaEntries[i].offset, locaEntries[i].endOffset, newGlyfData, writeOffset, hintsValid);
  33805. const newLength = glyphProfile.length;
  33806. if (newLength === 0) {
  33807. missingGlyphs[i] = true;
  33808. }
  33809. if (glyphProfile.sizeOfInstructions > maxSizeOfInstructions) {
  33810. maxSizeOfInstructions = glyphProfile.sizeOfInstructions;
  33811. }
  33812. writeOffset += newLength;
  33813. itemEncode(locaData, j, writeOffset);
  33814. }
  33815. if (writeOffset === 0) {
  33816. const simpleGlyph = new Uint8Array([0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 49, 0]);
  33817. for (i = 0, j = itemSize; i < numGlyphsOut; i++, j += itemSize) {
  33818. itemEncode(locaData, j, simpleGlyph.length);
  33819. }
  33820. glyf.data = simpleGlyph;
  33821. } else if (dupFirstEntry) {
  33822. const firstEntryLength = itemDecode(locaData, itemSize);
  33823. if (newGlyfData.length > firstEntryLength + writeOffset) {
  33824. glyf.data = newGlyfData.subarray(0, firstEntryLength + writeOffset);
  33825. } else {
  33826. glyf.data = new Uint8Array(firstEntryLength + writeOffset);
  33827. glyf.data.set(newGlyfData.subarray(0, writeOffset));
  33828. }
  33829. glyf.data.set(newGlyfData.subarray(0, firstEntryLength), writeOffset);
  33830. itemEncode(loca.data, locaData.length - itemSize, writeOffset + firstEntryLength);
  33831. } else {
  33832. glyf.data = newGlyfData.subarray(0, writeOffset);
  33833. }
  33834. return {
  33835. missingGlyphs,
  33836. maxSizeOfInstructions
  33837. };
  33838. }
  33839. function readPostScriptTable(post, propertiesObj, maxpNumGlyphs) {
  33840. const start = (font.start ? font.start : 0) + post.offset;
  33841. font.pos = start;
  33842. const length = post.length,
  33843. end = start + length;
  33844. const version = font.getInt32();
  33845. font.skip(28);
  33846. let glyphNames;
  33847. let valid = true;
  33848. let i;
  33849. switch (version) {
  33850. case 0x00010000:
  33851. glyphNames = _fonts_utils.MacStandardGlyphOrdering;
  33852. break;
  33853. case 0x00020000:
  33854. const numGlyphs = font.getUint16();
  33855. if (numGlyphs !== maxpNumGlyphs) {
  33856. valid = false;
  33857. break;
  33858. }
  33859. const glyphNameIndexes = [];
  33860. for (i = 0; i < numGlyphs; ++i) {
  33861. const index = font.getUint16();
  33862. if (index >= 32768) {
  33863. valid = false;
  33864. break;
  33865. }
  33866. glyphNameIndexes.push(index);
  33867. }
  33868. if (!valid) {
  33869. break;
  33870. }
  33871. const customNames = [],
  33872. strBuf = [];
  33873. while (font.pos < end) {
  33874. const stringLength = font.getByte();
  33875. strBuf.length = stringLength;
  33876. for (i = 0; i < stringLength; ++i) {
  33877. strBuf[i] = String.fromCharCode(font.getByte());
  33878. }
  33879. customNames.push(strBuf.join(""));
  33880. }
  33881. glyphNames = [];
  33882. for (i = 0; i < numGlyphs; ++i) {
  33883. const j = glyphNameIndexes[i];
  33884. if (j < 258) {
  33885. glyphNames.push(_fonts_utils.MacStandardGlyphOrdering[j]);
  33886. continue;
  33887. }
  33888. glyphNames.push(customNames[j - 258]);
  33889. }
  33890. break;
  33891. case 0x00030000:
  33892. break;
  33893. default:
  33894. (0, _util.warn)("Unknown/unsupported post table version " + version);
  33895. valid = false;
  33896. if (propertiesObj.defaultEncoding) {
  33897. glyphNames = propertiesObj.defaultEncoding;
  33898. }
  33899. break;
  33900. }
  33901. propertiesObj.glyphNames = glyphNames;
  33902. return valid;
  33903. }
  33904. function readNameTable(nameTable) {
  33905. const start = (font.start ? font.start : 0) + nameTable.offset;
  33906. font.pos = start;
  33907. const names = [[], []];
  33908. const length = nameTable.length,
  33909. end = start + length;
  33910. const format = font.getUint16();
  33911. const FORMAT_0_HEADER_LENGTH = 6;
  33912. if (format !== 0 || length < FORMAT_0_HEADER_LENGTH) {
  33913. return names;
  33914. }
  33915. const numRecords = font.getUint16();
  33916. const stringsStart = font.getUint16();
  33917. const records = [];
  33918. const NAME_RECORD_LENGTH = 12;
  33919. let i, ii;
  33920. for (i = 0; i < numRecords && font.pos + NAME_RECORD_LENGTH <= end; i++) {
  33921. const r = {
  33922. platform: font.getUint16(),
  33923. encoding: font.getUint16(),
  33924. language: font.getUint16(),
  33925. name: font.getUint16(),
  33926. length: font.getUint16(),
  33927. offset: font.getUint16()
  33928. };
  33929. if (r.platform === 1 && r.encoding === 0 && r.language === 0 || r.platform === 3 && r.encoding === 1 && r.language === 0x409) {
  33930. records.push(r);
  33931. }
  33932. }
  33933. for (i = 0, ii = records.length; i < ii; i++) {
  33934. const record = records[i];
  33935. if (record.length <= 0) {
  33936. continue;
  33937. }
  33938. const pos = start + stringsStart + record.offset;
  33939. if (pos + record.length > end) {
  33940. continue;
  33941. }
  33942. font.pos = pos;
  33943. const nameIndex = record.name;
  33944. if (record.encoding) {
  33945. let str = "";
  33946. for (let j = 0, jj = record.length; j < jj; j += 2) {
  33947. str += String.fromCharCode(font.getUint16());
  33948. }
  33949. names[1][nameIndex] = str;
  33950. } else {
  33951. names[0][nameIndex] = font.getString(record.length);
  33952. }
  33953. }
  33954. return names;
  33955. }
  33956. 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];
  33957. function sanitizeTTProgram(table, ttContext) {
  33958. let data = table.data;
  33959. let i = 0,
  33960. j,
  33961. n,
  33962. b,
  33963. funcId,
  33964. pc,
  33965. lastEndf = 0,
  33966. lastDeff = 0;
  33967. const stack = [];
  33968. const callstack = [];
  33969. const functionsCalled = [];
  33970. let tooComplexToFollowFunctions = ttContext.tooComplexToFollowFunctions;
  33971. let inFDEF = false,
  33972. ifLevel = 0,
  33973. inELSE = 0;
  33974. for (let ii = data.length; i < ii;) {
  33975. const op = data[i++];
  33976. if (op === 0x40) {
  33977. n = data[i++];
  33978. if (inFDEF || inELSE) {
  33979. i += n;
  33980. } else {
  33981. for (j = 0; j < n; j++) {
  33982. stack.push(data[i++]);
  33983. }
  33984. }
  33985. } else if (op === 0x41) {
  33986. n = data[i++];
  33987. if (inFDEF || inELSE) {
  33988. i += n * 2;
  33989. } else {
  33990. for (j = 0; j < n; j++) {
  33991. b = data[i++];
  33992. stack.push(b << 8 | data[i++]);
  33993. }
  33994. }
  33995. } else if ((op & 0xf8) === 0xb0) {
  33996. n = op - 0xb0 + 1;
  33997. if (inFDEF || inELSE) {
  33998. i += n;
  33999. } else {
  34000. for (j = 0; j < n; j++) {
  34001. stack.push(data[i++]);
  34002. }
  34003. }
  34004. } else if ((op & 0xf8) === 0xb8) {
  34005. n = op - 0xb8 + 1;
  34006. if (inFDEF || inELSE) {
  34007. i += n * 2;
  34008. } else {
  34009. for (j = 0; j < n; j++) {
  34010. b = data[i++];
  34011. stack.push(b << 8 | data[i++]);
  34012. }
  34013. }
  34014. } else if (op === 0x2b && !tooComplexToFollowFunctions) {
  34015. if (!inFDEF && !inELSE) {
  34016. funcId = stack[stack.length - 1];
  34017. if (isNaN(funcId)) {
  34018. (0, _util.info)("TT: CALL empty stack (or invalid entry).");
  34019. } else {
  34020. ttContext.functionsUsed[funcId] = true;
  34021. if (funcId in ttContext.functionsStackDeltas) {
  34022. const newStackLength = stack.length + ttContext.functionsStackDeltas[funcId];
  34023. if (newStackLength < 0) {
  34024. (0, _util.warn)("TT: CALL invalid functions stack delta.");
  34025. ttContext.hintsValid = false;
  34026. return;
  34027. }
  34028. stack.length = newStackLength;
  34029. } else if (funcId in ttContext.functionsDefined && !functionsCalled.includes(funcId)) {
  34030. callstack.push({
  34031. data,
  34032. i,
  34033. stackTop: stack.length - 1
  34034. });
  34035. functionsCalled.push(funcId);
  34036. pc = ttContext.functionsDefined[funcId];
  34037. if (!pc) {
  34038. (0, _util.warn)("TT: CALL non-existent function");
  34039. ttContext.hintsValid = false;
  34040. return;
  34041. }
  34042. data = pc.data;
  34043. i = pc.i;
  34044. }
  34045. }
  34046. }
  34047. } else if (op === 0x2c && !tooComplexToFollowFunctions) {
  34048. if (inFDEF || inELSE) {
  34049. (0, _util.warn)("TT: nested FDEFs not allowed");
  34050. tooComplexToFollowFunctions = true;
  34051. }
  34052. inFDEF = true;
  34053. lastDeff = i;
  34054. funcId = stack.pop();
  34055. ttContext.functionsDefined[funcId] = {
  34056. data,
  34057. i
  34058. };
  34059. } else if (op === 0x2d) {
  34060. if (inFDEF) {
  34061. inFDEF = false;
  34062. lastEndf = i;
  34063. } else {
  34064. pc = callstack.pop();
  34065. if (!pc) {
  34066. (0, _util.warn)("TT: ENDF bad stack");
  34067. ttContext.hintsValid = false;
  34068. return;
  34069. }
  34070. funcId = functionsCalled.pop();
  34071. data = pc.data;
  34072. i = pc.i;
  34073. ttContext.functionsStackDeltas[funcId] = stack.length - pc.stackTop;
  34074. }
  34075. } else if (op === 0x89) {
  34076. if (inFDEF || inELSE) {
  34077. (0, _util.warn)("TT: nested IDEFs not allowed");
  34078. tooComplexToFollowFunctions = true;
  34079. }
  34080. inFDEF = true;
  34081. lastDeff = i;
  34082. } else if (op === 0x58) {
  34083. ++ifLevel;
  34084. } else if (op === 0x1b) {
  34085. inELSE = ifLevel;
  34086. } else if (op === 0x59) {
  34087. if (inELSE === ifLevel) {
  34088. inELSE = 0;
  34089. }
  34090. --ifLevel;
  34091. } else if (op === 0x1c) {
  34092. if (!inFDEF && !inELSE) {
  34093. const offset = stack[stack.length - 1];
  34094. if (offset > 0) {
  34095. i += offset - 1;
  34096. }
  34097. }
  34098. }
  34099. if (!inFDEF && !inELSE) {
  34100. let stackDelta = 0;
  34101. if (op <= 0x8e) {
  34102. stackDelta = TTOpsStackDeltas[op];
  34103. } else if (op >= 0xc0 && op <= 0xdf) {
  34104. stackDelta = -1;
  34105. } else if (op >= 0xe0) {
  34106. stackDelta = -2;
  34107. }
  34108. if (op >= 0x71 && op <= 0x75) {
  34109. n = stack.pop();
  34110. if (!isNaN(n)) {
  34111. stackDelta = -n * 2;
  34112. }
  34113. }
  34114. while (stackDelta < 0 && stack.length > 0) {
  34115. stack.pop();
  34116. stackDelta++;
  34117. }
  34118. while (stackDelta > 0) {
  34119. stack.push(NaN);
  34120. stackDelta--;
  34121. }
  34122. }
  34123. }
  34124. ttContext.tooComplexToFollowFunctions = tooComplexToFollowFunctions;
  34125. const content = [data];
  34126. if (i > data.length) {
  34127. content.push(new Uint8Array(i - data.length));
  34128. }
  34129. if (lastDeff > lastEndf) {
  34130. (0, _util.warn)("TT: complementing a missing function tail");
  34131. content.push(new Uint8Array([0x22, 0x2d]));
  34132. }
  34133. foldTTTable(table, content);
  34134. }
  34135. function checkInvalidFunctions(ttContext, maxFunctionDefs) {
  34136. if (ttContext.tooComplexToFollowFunctions) {
  34137. return;
  34138. }
  34139. if (ttContext.functionsDefined.length > maxFunctionDefs) {
  34140. (0, _util.warn)("TT: more functions defined than expected");
  34141. ttContext.hintsValid = false;
  34142. return;
  34143. }
  34144. for (let j = 0, jj = ttContext.functionsUsed.length; j < jj; j++) {
  34145. if (j > maxFunctionDefs) {
  34146. (0, _util.warn)("TT: invalid function id: " + j);
  34147. ttContext.hintsValid = false;
  34148. return;
  34149. }
  34150. if (ttContext.functionsUsed[j] && !ttContext.functionsDefined[j]) {
  34151. (0, _util.warn)("TT: undefined function: " + j);
  34152. ttContext.hintsValid = false;
  34153. return;
  34154. }
  34155. }
  34156. }
  34157. function foldTTTable(table, content) {
  34158. if (content.length > 1) {
  34159. let newLength = 0;
  34160. let j, jj;
  34161. for (j = 0, jj = content.length; j < jj; j++) {
  34162. newLength += content[j].length;
  34163. }
  34164. newLength = newLength + 3 & ~3;
  34165. const result = new Uint8Array(newLength);
  34166. let pos = 0;
  34167. for (j = 0, jj = content.length; j < jj; j++) {
  34168. result.set(content[j], pos);
  34169. pos += content[j].length;
  34170. }
  34171. table.data = result;
  34172. table.length = newLength;
  34173. }
  34174. }
  34175. function sanitizeTTPrograms(fpgm, prep, cvt, maxFunctionDefs) {
  34176. const ttContext = {
  34177. functionsDefined: [],
  34178. functionsUsed: [],
  34179. functionsStackDeltas: [],
  34180. tooComplexToFollowFunctions: false,
  34181. hintsValid: true
  34182. };
  34183. if (fpgm) {
  34184. sanitizeTTProgram(fpgm, ttContext);
  34185. }
  34186. if (prep) {
  34187. sanitizeTTProgram(prep, ttContext);
  34188. }
  34189. if (fpgm) {
  34190. checkInvalidFunctions(ttContext, maxFunctionDefs);
  34191. }
  34192. if (cvt && cvt.length & 1) {
  34193. const cvtData = new Uint8Array(cvt.length + 1);
  34194. cvtData.set(cvt.data);
  34195. cvt.data = cvtData;
  34196. }
  34197. return ttContext.hintsValid;
  34198. }
  34199. font = new _stream.Stream(new Uint8Array(font.getBytes()));
  34200. let header, tables;
  34201. if (isTrueTypeCollectionFile(font)) {
  34202. const ttcData = readTrueTypeCollectionData(font, this.name);
  34203. header = ttcData.header;
  34204. tables = ttcData.tables;
  34205. } else {
  34206. header = readOpenTypeHeader(font);
  34207. tables = readTables(font, header.numTables);
  34208. }
  34209. let cff, cffFile;
  34210. const isTrueType = !tables["CFF "];
  34211. if (!isTrueType) {
  34212. const isComposite = properties.composite && ((properties.cidToGidMap || []).length > 0 || !(properties.cMap instanceof _cmap.IdentityCMap));
  34213. if (header.version === "OTTO" && !isComposite || !tables.head || !tables.hhea || !tables.maxp || !tables.post) {
  34214. cffFile = new _stream.Stream(tables["CFF "].data);
  34215. cff = new _cff_font.CFFFont(cffFile, properties);
  34216. adjustWidths(properties);
  34217. return this.convert(name, cff, properties);
  34218. }
  34219. delete tables.glyf;
  34220. delete tables.loca;
  34221. delete tables.fpgm;
  34222. delete tables.prep;
  34223. delete tables["cvt "];
  34224. this.isOpenType = true;
  34225. } else {
  34226. if (!tables.loca) {
  34227. throw new _util.FormatError('Required "loca" table is not found');
  34228. }
  34229. if (!tables.glyf) {
  34230. (0, _util.warn)('Required "glyf" table is not found -- trying to recover.');
  34231. tables.glyf = {
  34232. tag: "glyf",
  34233. data: new Uint8Array(0)
  34234. };
  34235. }
  34236. this.isOpenType = false;
  34237. }
  34238. if (!tables.maxp) {
  34239. throw new _util.FormatError('Required "maxp" table is not found');
  34240. }
  34241. font.pos = (font.start || 0) + tables.maxp.offset;
  34242. const version = font.getInt32();
  34243. const numGlyphs = font.getUint16();
  34244. if (properties.scaleFactors && properties.scaleFactors.length === numGlyphs && isTrueType) {
  34245. const {
  34246. scaleFactors
  34247. } = properties;
  34248. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34249. const glyphs = new _glyf.GlyfTable({
  34250. glyfTable: tables.glyf.data,
  34251. isGlyphLocationsLong,
  34252. locaTable: tables.loca.data,
  34253. numGlyphs
  34254. });
  34255. glyphs.scale(scaleFactors);
  34256. const {
  34257. glyf,
  34258. loca,
  34259. isLocationLong
  34260. } = glyphs.write();
  34261. tables.glyf.data = glyf;
  34262. tables.loca.data = loca;
  34263. if (isLocationLong !== !!isGlyphLocationsLong) {
  34264. tables.head.data[50] = 0;
  34265. tables.head.data[51] = isLocationLong ? 1 : 0;
  34266. }
  34267. const metrics = tables.hmtx.data;
  34268. for (let i = 0; i < numGlyphs; i++) {
  34269. const j = 4 * i;
  34270. const advanceWidth = Math.round(scaleFactors[i] * int16(metrics[j], metrics[j + 1]));
  34271. metrics[j] = advanceWidth >> 8 & 0xff;
  34272. metrics[j + 1] = advanceWidth & 0xff;
  34273. const lsb = Math.round(scaleFactors[i] * signedInt16(metrics[j + 2], metrics[j + 3]));
  34274. writeSignedInt16(metrics, j + 2, lsb);
  34275. }
  34276. }
  34277. let numGlyphsOut = numGlyphs + 1;
  34278. let dupFirstEntry = true;
  34279. if (numGlyphsOut > 0xffff) {
  34280. dupFirstEntry = false;
  34281. numGlyphsOut = numGlyphs;
  34282. (0, _util.warn)("Not enough space in glyfs to duplicate first glyph.");
  34283. }
  34284. let maxFunctionDefs = 0;
  34285. let maxSizeOfInstructions = 0;
  34286. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34287. font.pos += 8;
  34288. const maxZones = font.getUint16();
  34289. if (maxZones > 2) {
  34290. tables.maxp.data[14] = 0;
  34291. tables.maxp.data[15] = 2;
  34292. }
  34293. font.pos += 4;
  34294. maxFunctionDefs = font.getUint16();
  34295. font.pos += 4;
  34296. maxSizeOfInstructions = font.getUint16();
  34297. }
  34298. tables.maxp.data[4] = numGlyphsOut >> 8;
  34299. tables.maxp.data[5] = numGlyphsOut & 255;
  34300. const hintsValid = sanitizeTTPrograms(tables.fpgm, tables.prep, tables["cvt "], maxFunctionDefs);
  34301. if (!hintsValid) {
  34302. delete tables.fpgm;
  34303. delete tables.prep;
  34304. delete tables["cvt "];
  34305. }
  34306. sanitizeMetrics(font, tables.hhea, tables.hmtx, tables.head, numGlyphsOut, dupFirstEntry);
  34307. if (!tables.head) {
  34308. throw new _util.FormatError('Required "head" table is not found');
  34309. }
  34310. sanitizeHead(tables.head, numGlyphs, isTrueType ? tables.loca.length : 0);
  34311. let missingGlyphs = Object.create(null);
  34312. if (isTrueType) {
  34313. const isGlyphLocationsLong = int16(tables.head.data[50], tables.head.data[51]);
  34314. const glyphsInfo = sanitizeGlyphLocations(tables.loca, tables.glyf, numGlyphs, isGlyphLocationsLong, hintsValid, dupFirstEntry, maxSizeOfInstructions);
  34315. missingGlyphs = glyphsInfo.missingGlyphs;
  34316. if (version >= 0x00010000 && tables.maxp.length >= 22) {
  34317. tables.maxp.data[26] = glyphsInfo.maxSizeOfInstructions >> 8;
  34318. tables.maxp.data[27] = glyphsInfo.maxSizeOfInstructions & 255;
  34319. }
  34320. }
  34321. if (!tables.hhea) {
  34322. throw new _util.FormatError('Required "hhea" table is not found');
  34323. }
  34324. if (tables.hhea.data[10] === 0 && tables.hhea.data[11] === 0) {
  34325. tables.hhea.data[10] = 0xff;
  34326. tables.hhea.data[11] = 0xff;
  34327. }
  34328. const metricsOverride = {
  34329. unitsPerEm: int16(tables.head.data[18], tables.head.data[19]),
  34330. yMax: int16(tables.head.data[42], tables.head.data[43]),
  34331. yMin: signedInt16(tables.head.data[38], tables.head.data[39]),
  34332. ascent: signedInt16(tables.hhea.data[4], tables.hhea.data[5]),
  34333. descent: signedInt16(tables.hhea.data[6], tables.hhea.data[7]),
  34334. lineGap: signedInt16(tables.hhea.data[8], tables.hhea.data[9])
  34335. };
  34336. this.ascent = metricsOverride.ascent / metricsOverride.unitsPerEm;
  34337. this.descent = metricsOverride.descent / metricsOverride.unitsPerEm;
  34338. this.lineGap = metricsOverride.lineGap / metricsOverride.unitsPerEm;
  34339. if (this.cssFontInfo && this.cssFontInfo.lineHeight) {
  34340. this.lineHeight = this.cssFontInfo.metrics.lineHeight;
  34341. this.lineGap = this.cssFontInfo.metrics.lineGap;
  34342. } else {
  34343. this.lineHeight = this.ascent - this.descent + this.lineGap;
  34344. }
  34345. if (tables.post) {
  34346. readPostScriptTable(tables.post, properties, numGlyphs);
  34347. }
  34348. tables.post = {
  34349. tag: "post",
  34350. data: createPostTable(properties)
  34351. };
  34352. const charCodeToGlyphId = [];
  34353. function hasGlyph(glyphId) {
  34354. return !missingGlyphs[glyphId];
  34355. }
  34356. if (properties.composite) {
  34357. const cidToGidMap = properties.cidToGidMap || [];
  34358. const isCidToGidMapEmpty = cidToGidMap.length === 0;
  34359. properties.cMap.forEach(function (charCode, cid) {
  34360. if (typeof cid === "string") {
  34361. cid = convertCidString(charCode, cid, true);
  34362. }
  34363. if (cid > 0xffff) {
  34364. throw new _util.FormatError("Max size of CID is 65,535");
  34365. }
  34366. let glyphId = -1;
  34367. if (isCidToGidMapEmpty) {
  34368. glyphId = cid;
  34369. } else if (cidToGidMap[cid] !== undefined) {
  34370. glyphId = cidToGidMap[cid];
  34371. }
  34372. if (glyphId >= 0 && glyphId < numGlyphs && hasGlyph(glyphId)) {
  34373. charCodeToGlyphId[charCode] = glyphId;
  34374. }
  34375. });
  34376. } else {
  34377. const cmapTable = readCmapTable(tables.cmap, font, this.isSymbolicFont, properties.hasEncoding);
  34378. const cmapPlatformId = cmapTable.platformId;
  34379. const cmapEncodingId = cmapTable.encodingId;
  34380. const cmapMappings = cmapTable.mappings;
  34381. const cmapMappingsLength = cmapMappings.length;
  34382. let baseEncoding = [],
  34383. forcePostTable = false;
  34384. if (properties.hasEncoding && (properties.baseEncodingName === "MacRomanEncoding" || properties.baseEncodingName === "WinAnsiEncoding")) {
  34385. baseEncoding = (0, _encodings.getEncoding)(properties.baseEncodingName);
  34386. }
  34387. if (properties.hasEncoding && !this.isSymbolicFont && (cmapPlatformId === 3 && cmapEncodingId === 1 || cmapPlatformId === 1 && cmapEncodingId === 0)) {
  34388. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34389. for (let charCode = 0; charCode < 256; charCode++) {
  34390. let glyphName;
  34391. if (this.differences[charCode] !== undefined) {
  34392. glyphName = this.differences[charCode];
  34393. } else if (baseEncoding.length && baseEncoding[charCode] !== "") {
  34394. glyphName = baseEncoding[charCode];
  34395. } else {
  34396. glyphName = _encodings.StandardEncoding[charCode];
  34397. }
  34398. if (!glyphName) {
  34399. continue;
  34400. }
  34401. const standardGlyphName = (0, _fonts_utils.recoverGlyphName)(glyphName, glyphsUnicodeMap);
  34402. let unicodeOrCharCode;
  34403. if (cmapPlatformId === 3 && cmapEncodingId === 1) {
  34404. unicodeOrCharCode = glyphsUnicodeMap[standardGlyphName];
  34405. } else if (cmapPlatformId === 1 && cmapEncodingId === 0) {
  34406. unicodeOrCharCode = _encodings.MacRomanEncoding.indexOf(standardGlyphName);
  34407. }
  34408. if (unicodeOrCharCode === undefined) {
  34409. if (!properties.glyphNames && properties.hasIncludedToUnicodeMap && !(this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap)) {
  34410. const unicode = this.toUnicode.get(charCode);
  34411. if (unicode) {
  34412. unicodeOrCharCode = unicode.codePointAt(0);
  34413. }
  34414. }
  34415. if (unicodeOrCharCode === undefined) {
  34416. continue;
  34417. }
  34418. }
  34419. for (let i = 0; i < cmapMappingsLength; ++i) {
  34420. if (cmapMappings[i].charCode !== unicodeOrCharCode) {
  34421. continue;
  34422. }
  34423. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34424. break;
  34425. }
  34426. }
  34427. } else if (cmapPlatformId === 0) {
  34428. for (let i = 0; i < cmapMappingsLength; ++i) {
  34429. charCodeToGlyphId[cmapMappings[i].charCode] = cmapMappings[i].glyphId;
  34430. }
  34431. forcePostTable = true;
  34432. } else {
  34433. for (let i = 0; i < cmapMappingsLength; ++i) {
  34434. let charCode = cmapMappings[i].charCode;
  34435. if (cmapPlatformId === 3 && charCode >= 0xf000 && charCode <= 0xf0ff) {
  34436. charCode &= 0xff;
  34437. }
  34438. charCodeToGlyphId[charCode] = cmapMappings[i].glyphId;
  34439. }
  34440. }
  34441. if (properties.glyphNames && (baseEncoding.length || this.differences.length)) {
  34442. for (let i = 0; i < 256; ++i) {
  34443. if (!forcePostTable && charCodeToGlyphId[i] !== undefined) {
  34444. continue;
  34445. }
  34446. const glyphName = this.differences[i] || baseEncoding[i];
  34447. if (!glyphName) {
  34448. continue;
  34449. }
  34450. const glyphId = properties.glyphNames.indexOf(glyphName);
  34451. if (glyphId > 0 && hasGlyph(glyphId)) {
  34452. charCodeToGlyphId[i] = glyphId;
  34453. }
  34454. }
  34455. }
  34456. }
  34457. if (charCodeToGlyphId.length === 0) {
  34458. charCodeToGlyphId[0] = 0;
  34459. }
  34460. let glyphZeroId = numGlyphsOut - 1;
  34461. if (!dupFirstEntry) {
  34462. glyphZeroId = 0;
  34463. }
  34464. if (!properties.cssFontInfo) {
  34465. const newMapping = adjustMapping(charCodeToGlyphId, hasGlyph, glyphZeroId);
  34466. this.toFontChar = newMapping.toFontChar;
  34467. tables.cmap = {
  34468. tag: "cmap",
  34469. data: createCmapTable(newMapping.charCodeToGlyphId, numGlyphsOut)
  34470. };
  34471. if (!tables["OS/2"] || !validateOS2Table(tables["OS/2"], font)) {
  34472. tables["OS/2"] = {
  34473. tag: "OS/2",
  34474. data: createOS2Table(properties, newMapping.charCodeToGlyphId, metricsOverride)
  34475. };
  34476. }
  34477. }
  34478. if (!isTrueType) {
  34479. try {
  34480. cffFile = new _stream.Stream(tables["CFF "].data);
  34481. const parser = new _cff_parser.CFFParser(cffFile, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  34482. cff = parser.parse();
  34483. cff.duplicateFirstGlyph();
  34484. const compiler = new _cff_parser.CFFCompiler(cff);
  34485. tables["CFF "].data = compiler.compile();
  34486. } catch (e) {
  34487. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  34488. }
  34489. }
  34490. if (!tables.name) {
  34491. tables.name = {
  34492. tag: "name",
  34493. data: createNameTable(this.name)
  34494. };
  34495. } else {
  34496. const namePrototype = readNameTable(tables.name);
  34497. tables.name.data = createNameTable(name, namePrototype);
  34498. this.psName = namePrototype[0][6] || null;
  34499. }
  34500. const builder = new _opentype_file_builder.OpenTypeFileBuilder(header.version);
  34501. for (const tableTag in tables) {
  34502. builder.addTable(tableTag, tables[tableTag].data);
  34503. }
  34504. return builder.toArray();
  34505. }
  34506. convert(fontName, font, properties) {
  34507. properties.fixedPitch = false;
  34508. if (properties.builtInEncoding) {
  34509. adjustToUnicode(properties, properties.builtInEncoding);
  34510. }
  34511. let glyphZeroId = 1;
  34512. if (font instanceof _cff_font.CFFFont) {
  34513. glyphZeroId = font.numGlyphs - 1;
  34514. }
  34515. const mapping = font.getGlyphMapping(properties);
  34516. let newMapping = null;
  34517. let newCharCodeToGlyphId = mapping;
  34518. if (!properties.cssFontInfo) {
  34519. newMapping = adjustMapping(mapping, font.hasGlyphId.bind(font), glyphZeroId);
  34520. this.toFontChar = newMapping.toFontChar;
  34521. newCharCodeToGlyphId = newMapping.charCodeToGlyphId;
  34522. }
  34523. const numGlyphs = font.numGlyphs;
  34524. function getCharCodes(charCodeToGlyphId, glyphId) {
  34525. let charCodes = null;
  34526. for (const charCode in charCodeToGlyphId) {
  34527. if (glyphId === charCodeToGlyphId[charCode]) {
  34528. if (!charCodes) {
  34529. charCodes = [];
  34530. }
  34531. charCodes.push(charCode | 0);
  34532. }
  34533. }
  34534. return charCodes;
  34535. }
  34536. function createCharCode(charCodeToGlyphId, glyphId) {
  34537. for (const charCode in charCodeToGlyphId) {
  34538. if (glyphId === charCodeToGlyphId[charCode]) {
  34539. return charCode | 0;
  34540. }
  34541. }
  34542. newMapping.charCodeToGlyphId[newMapping.nextAvailableFontCharCode] = glyphId;
  34543. return newMapping.nextAvailableFontCharCode++;
  34544. }
  34545. const seacs = font.seacs;
  34546. if (newMapping && _fonts_utils.SEAC_ANALYSIS_ENABLED && seacs && seacs.length) {
  34547. const matrix = properties.fontMatrix || _util.FONT_IDENTITY_MATRIX;
  34548. const charset = font.getCharset();
  34549. const seacMap = Object.create(null);
  34550. for (let glyphId in seacs) {
  34551. glyphId |= 0;
  34552. const seac = seacs[glyphId];
  34553. const baseGlyphName = _encodings.StandardEncoding[seac[2]];
  34554. const accentGlyphName = _encodings.StandardEncoding[seac[3]];
  34555. const baseGlyphId = charset.indexOf(baseGlyphName);
  34556. const accentGlyphId = charset.indexOf(accentGlyphName);
  34557. if (baseGlyphId < 0 || accentGlyphId < 0) {
  34558. continue;
  34559. }
  34560. const accentOffset = {
  34561. x: seac[0] * matrix[0] + seac[1] * matrix[2] + matrix[4],
  34562. y: seac[0] * matrix[1] + seac[1] * matrix[3] + matrix[5]
  34563. };
  34564. const charCodes = getCharCodes(mapping, glyphId);
  34565. if (!charCodes) {
  34566. continue;
  34567. }
  34568. for (let i = 0, ii = charCodes.length; i < ii; i++) {
  34569. const charCode = charCodes[i];
  34570. const charCodeToGlyphId = newMapping.charCodeToGlyphId;
  34571. const baseFontCharCode = createCharCode(charCodeToGlyphId, baseGlyphId);
  34572. const accentFontCharCode = createCharCode(charCodeToGlyphId, accentGlyphId);
  34573. seacMap[charCode] = {
  34574. baseFontCharCode,
  34575. accentFontCharCode,
  34576. accentOffset
  34577. };
  34578. }
  34579. }
  34580. properties.seacMap = seacMap;
  34581. }
  34582. const unitsPerEm = 1 / (properties.fontMatrix || _util.FONT_IDENTITY_MATRIX)[0];
  34583. const builder = new _opentype_file_builder.OpenTypeFileBuilder("\x4F\x54\x54\x4F");
  34584. builder.addTable("CFF ", font.data);
  34585. builder.addTable("OS/2", createOS2Table(properties, newCharCodeToGlyphId));
  34586. builder.addTable("cmap", createCmapTable(newCharCodeToGlyphId, numGlyphs));
  34587. 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");
  34588. 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));
  34589. builder.addTable("hmtx", function fontFieldsHmtx() {
  34590. const charstrings = font.charstrings;
  34591. const cffWidths = font.cff ? font.cff.widths : null;
  34592. let hmtx = "\x00\x00\x00\x00";
  34593. for (let i = 1, ii = numGlyphs; i < ii; i++) {
  34594. let width = 0;
  34595. if (charstrings) {
  34596. const charstring = charstrings[i - 1];
  34597. width = "width" in charstring ? charstring.width : 0;
  34598. } else if (cffWidths) {
  34599. width = Math.ceil(cffWidths[i] || 0);
  34600. }
  34601. hmtx += string16(width) + string16(0);
  34602. }
  34603. return hmtx;
  34604. }());
  34605. builder.addTable("maxp", "\x00\x00\x50\x00" + string16(numGlyphs));
  34606. builder.addTable("name", createNameTable(fontName));
  34607. builder.addTable("post", createPostTable(properties));
  34608. return builder.toArray();
  34609. }
  34610. get spaceWidth() {
  34611. const possibleSpaceReplacements = ["space", "minus", "one", "i", "I"];
  34612. let width;
  34613. for (let i = 0, ii = possibleSpaceReplacements.length; i < ii; i++) {
  34614. const glyphName = possibleSpaceReplacements[i];
  34615. if (glyphName in this.widths) {
  34616. width = this.widths[glyphName];
  34617. break;
  34618. }
  34619. const glyphsUnicodeMap = (0, _glyphlist.getGlyphsUnicode)();
  34620. const glyphUnicode = glyphsUnicodeMap[glyphName];
  34621. let charcode = 0;
  34622. if (this.composite && this.cMap.contains(glyphUnicode)) {
  34623. charcode = this.cMap.lookup(glyphUnicode);
  34624. if (typeof charcode === "string") {
  34625. charcode = convertCidString(glyphUnicode, charcode);
  34626. }
  34627. }
  34628. if (!charcode && this.toUnicode) {
  34629. charcode = this.toUnicode.charCodeOf(glyphUnicode);
  34630. }
  34631. if (charcode <= 0) {
  34632. charcode = glyphUnicode;
  34633. }
  34634. width = this.widths[charcode];
  34635. if (width) {
  34636. break;
  34637. }
  34638. }
  34639. width = width || this.defaultWidth;
  34640. return (0, _util.shadow)(this, "spaceWidth", width);
  34641. }
  34642. _charToGlyph(charcode, isSpace = false) {
  34643. let fontCharCode, width, operatorListId;
  34644. let widthCode = charcode;
  34645. if (this.cMap && this.cMap.contains(charcode)) {
  34646. widthCode = this.cMap.lookup(charcode);
  34647. if (typeof widthCode === "string") {
  34648. widthCode = convertCidString(charcode, widthCode);
  34649. }
  34650. }
  34651. width = this.widths[widthCode];
  34652. if (typeof width !== "number") {
  34653. width = this.defaultWidth;
  34654. }
  34655. const vmetric = this.vmetrics && this.vmetrics[widthCode];
  34656. let unicode = this.toUnicode.get(charcode) || charcode;
  34657. if (typeof unicode === "number") {
  34658. unicode = String.fromCharCode(unicode);
  34659. }
  34660. let isInFont = this.toFontChar[charcode] !== undefined;
  34661. fontCharCode = this.toFontChar[charcode] || charcode;
  34662. if (this.missingFile) {
  34663. const glyphName = this.differences[charcode] || this.defaultEncoding[charcode];
  34664. if ((glyphName === ".notdef" || glyphName === "") && this.type === "Type1") {
  34665. fontCharCode = 0x20;
  34666. }
  34667. fontCharCode = (0, _unicode.mapSpecialUnicodeValues)(fontCharCode);
  34668. }
  34669. if (this.isType3Font) {
  34670. operatorListId = fontCharCode;
  34671. }
  34672. let accent = null;
  34673. if (this.seacMap && this.seacMap[charcode]) {
  34674. isInFont = true;
  34675. const seac = this.seacMap[charcode];
  34676. fontCharCode = seac.baseFontCharCode;
  34677. accent = {
  34678. fontChar: String.fromCodePoint(seac.accentFontCharCode),
  34679. offset: seac.accentOffset
  34680. };
  34681. }
  34682. let fontChar = "";
  34683. if (typeof fontCharCode === "number") {
  34684. if (fontCharCode <= 0x10ffff) {
  34685. fontChar = String.fromCodePoint(fontCharCode);
  34686. } else {
  34687. (0, _util.warn)(`charToGlyph - invalid fontCharCode: ${fontCharCode}`);
  34688. }
  34689. }
  34690. let glyph = this._glyphCache[charcode];
  34691. if (!glyph || !glyph.matchesForCache(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont)) {
  34692. glyph = new Glyph(charcode, fontChar, unicode, accent, width, vmetric, operatorListId, isSpace, isInFont);
  34693. this._glyphCache[charcode] = glyph;
  34694. }
  34695. return glyph;
  34696. }
  34697. charsToGlyphs(chars) {
  34698. let glyphs = this._charsCache[chars];
  34699. if (glyphs) {
  34700. return glyphs;
  34701. }
  34702. glyphs = [];
  34703. if (this.cMap) {
  34704. const c = Object.create(null),
  34705. ii = chars.length;
  34706. let i = 0;
  34707. while (i < ii) {
  34708. this.cMap.readCharCode(chars, i, c);
  34709. const {
  34710. charcode,
  34711. length
  34712. } = c;
  34713. i += length;
  34714. const glyph = this._charToGlyph(charcode, length === 1 && chars.charCodeAt(i - 1) === 0x20);
  34715. glyphs.push(glyph);
  34716. }
  34717. } else {
  34718. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34719. const charcode = chars.charCodeAt(i);
  34720. const glyph = this._charToGlyph(charcode, charcode === 0x20);
  34721. glyphs.push(glyph);
  34722. }
  34723. }
  34724. return this._charsCache[chars] = glyphs;
  34725. }
  34726. getCharPositions(chars) {
  34727. const positions = [];
  34728. if (this.cMap) {
  34729. const c = Object.create(null);
  34730. let i = 0;
  34731. while (i < chars.length) {
  34732. this.cMap.readCharCode(chars, i, c);
  34733. const length = c.length;
  34734. positions.push([i, i + length]);
  34735. i += length;
  34736. }
  34737. } else {
  34738. for (let i = 0, ii = chars.length; i < ii; ++i) {
  34739. positions.push([i, i + 1]);
  34740. }
  34741. }
  34742. return positions;
  34743. }
  34744. get glyphCacheValues() {
  34745. return Object.values(this._glyphCache);
  34746. }
  34747. encodeString(str) {
  34748. const buffers = [];
  34749. const currentBuf = [];
  34750. const hasCurrentBufErrors = () => buffers.length % 2 === 1;
  34751. const getCharCode = this.toUnicode instanceof _to_unicode_map.IdentityToUnicodeMap ? unicode => this.toUnicode.charCodeOf(unicode) : unicode => this.toUnicode.charCodeOf(String.fromCodePoint(unicode));
  34752. for (let i = 0, ii = str.length; i < ii; i++) {
  34753. const unicode = str.codePointAt(i);
  34754. if (unicode > 0xd7ff && (unicode < 0xe000 || unicode > 0xfffd)) {
  34755. i++;
  34756. }
  34757. if (this.toUnicode) {
  34758. const charCode = getCharCode(unicode);
  34759. if (charCode !== -1) {
  34760. if (hasCurrentBufErrors()) {
  34761. buffers.push(currentBuf.join(""));
  34762. currentBuf.length = 0;
  34763. }
  34764. const charCodeLength = this.cMap ? this.cMap.getCharCodeLength(charCode) : 1;
  34765. for (let j = charCodeLength - 1; j >= 0; j--) {
  34766. currentBuf.push(String.fromCharCode(charCode >> 8 * j & 0xff));
  34767. }
  34768. continue;
  34769. }
  34770. }
  34771. if (!hasCurrentBufErrors()) {
  34772. buffers.push(currentBuf.join(""));
  34773. currentBuf.length = 0;
  34774. }
  34775. currentBuf.push(String.fromCodePoint(unicode));
  34776. }
  34777. buffers.push(currentBuf.join(""));
  34778. return buffers;
  34779. }
  34780. }
  34781. exports.Font = Font;
  34782. class ErrorFont {
  34783. constructor(error) {
  34784. this.error = error;
  34785. this.loadedName = "g_font_error";
  34786. this.missingFile = true;
  34787. }
  34788. charsToGlyphs() {
  34789. return [];
  34790. }
  34791. encodeString(chars) {
  34792. return [chars];
  34793. }
  34794. exportData(extraProperties = false) {
  34795. return {
  34796. error: this.error
  34797. };
  34798. }
  34799. }
  34800. exports.ErrorFont = ErrorFont;
  34801. /***/ }),
  34802. /* 45 */
  34803. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  34804. Object.defineProperty(exports, "__esModule", ({
  34805. value: true
  34806. }));
  34807. exports.CFFTopDict = exports.CFFStrings = exports.CFFStandardStrings = exports.CFFPrivateDict = exports.CFFParser = exports.CFFIndex = exports.CFFHeader = exports.CFFFDSelect = exports.CFFCompiler = exports.CFFCharset = exports.CFF = void 0;
  34808. var _util = __w_pdfjs_require__(2);
  34809. var _charsets = __w_pdfjs_require__(46);
  34810. var _encodings = __w_pdfjs_require__(19);
  34811. const MAX_SUBR_NESTING = 10;
  34812. 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"];
  34813. exports.CFFStandardStrings = CFFStandardStrings;
  34814. const NUM_STANDARD_CFF_STRINGS = 391;
  34815. const CFFParser = function CFFParserClosure() {
  34816. const CharstringValidationData = [null, {
  34817. id: "hstem",
  34818. min: 2,
  34819. stackClearing: true,
  34820. stem: true
  34821. }, null, {
  34822. id: "vstem",
  34823. min: 2,
  34824. stackClearing: true,
  34825. stem: true
  34826. }, {
  34827. id: "vmoveto",
  34828. min: 1,
  34829. stackClearing: true
  34830. }, {
  34831. id: "rlineto",
  34832. min: 2,
  34833. resetStack: true
  34834. }, {
  34835. id: "hlineto",
  34836. min: 1,
  34837. resetStack: true
  34838. }, {
  34839. id: "vlineto",
  34840. min: 1,
  34841. resetStack: true
  34842. }, {
  34843. id: "rrcurveto",
  34844. min: 6,
  34845. resetStack: true
  34846. }, null, {
  34847. id: "callsubr",
  34848. min: 1,
  34849. undefStack: true
  34850. }, {
  34851. id: "return",
  34852. min: 0,
  34853. undefStack: true
  34854. }, null, null, {
  34855. id: "endchar",
  34856. min: 0,
  34857. stackClearing: true
  34858. }, null, null, null, {
  34859. id: "hstemhm",
  34860. min: 2,
  34861. stackClearing: true,
  34862. stem: true
  34863. }, {
  34864. id: "hintmask",
  34865. min: 0,
  34866. stackClearing: true
  34867. }, {
  34868. id: "cntrmask",
  34869. min: 0,
  34870. stackClearing: true
  34871. }, {
  34872. id: "rmoveto",
  34873. min: 2,
  34874. stackClearing: true
  34875. }, {
  34876. id: "hmoveto",
  34877. min: 1,
  34878. stackClearing: true
  34879. }, {
  34880. id: "vstemhm",
  34881. min: 2,
  34882. stackClearing: true,
  34883. stem: true
  34884. }, {
  34885. id: "rcurveline",
  34886. min: 8,
  34887. resetStack: true
  34888. }, {
  34889. id: "rlinecurve",
  34890. min: 8,
  34891. resetStack: true
  34892. }, {
  34893. id: "vvcurveto",
  34894. min: 4,
  34895. resetStack: true
  34896. }, {
  34897. id: "hhcurveto",
  34898. min: 4,
  34899. resetStack: true
  34900. }, null, {
  34901. id: "callgsubr",
  34902. min: 1,
  34903. undefStack: true
  34904. }, {
  34905. id: "vhcurveto",
  34906. min: 4,
  34907. resetStack: true
  34908. }, {
  34909. id: "hvcurveto",
  34910. min: 4,
  34911. resetStack: true
  34912. }];
  34913. const CharstringValidationData12 = [null, null, null, {
  34914. id: "and",
  34915. min: 2,
  34916. stackDelta: -1
  34917. }, {
  34918. id: "or",
  34919. min: 2,
  34920. stackDelta: -1
  34921. }, {
  34922. id: "not",
  34923. min: 1,
  34924. stackDelta: 0
  34925. }, null, null, null, {
  34926. id: "abs",
  34927. min: 1,
  34928. stackDelta: 0
  34929. }, {
  34930. id: "add",
  34931. min: 2,
  34932. stackDelta: -1,
  34933. stackFn: function stack_div(stack, index) {
  34934. stack[index - 2] = stack[index - 2] + stack[index - 1];
  34935. }
  34936. }, {
  34937. id: "sub",
  34938. min: 2,
  34939. stackDelta: -1,
  34940. stackFn: function stack_div(stack, index) {
  34941. stack[index - 2] = stack[index - 2] - stack[index - 1];
  34942. }
  34943. }, {
  34944. id: "div",
  34945. min: 2,
  34946. stackDelta: -1,
  34947. stackFn: function stack_div(stack, index) {
  34948. stack[index - 2] = stack[index - 2] / stack[index - 1];
  34949. }
  34950. }, null, {
  34951. id: "neg",
  34952. min: 1,
  34953. stackDelta: 0,
  34954. stackFn: function stack_div(stack, index) {
  34955. stack[index - 1] = -stack[index - 1];
  34956. }
  34957. }, {
  34958. id: "eq",
  34959. min: 2,
  34960. stackDelta: -1
  34961. }, null, null, {
  34962. id: "drop",
  34963. min: 1,
  34964. stackDelta: -1
  34965. }, null, {
  34966. id: "put",
  34967. min: 2,
  34968. stackDelta: -2
  34969. }, {
  34970. id: "get",
  34971. min: 1,
  34972. stackDelta: 0
  34973. }, {
  34974. id: "ifelse",
  34975. min: 4,
  34976. stackDelta: -3
  34977. }, {
  34978. id: "random",
  34979. min: 0,
  34980. stackDelta: 1
  34981. }, {
  34982. id: "mul",
  34983. min: 2,
  34984. stackDelta: -1,
  34985. stackFn: function stack_div(stack, index) {
  34986. stack[index - 2] = stack[index - 2] * stack[index - 1];
  34987. }
  34988. }, null, {
  34989. id: "sqrt",
  34990. min: 1,
  34991. stackDelta: 0
  34992. }, {
  34993. id: "dup",
  34994. min: 1,
  34995. stackDelta: 1
  34996. }, {
  34997. id: "exch",
  34998. min: 2,
  34999. stackDelta: 0
  35000. }, {
  35001. id: "index",
  35002. min: 2,
  35003. stackDelta: 0
  35004. }, {
  35005. id: "roll",
  35006. min: 3,
  35007. stackDelta: -2
  35008. }, null, null, null, {
  35009. id: "hflex",
  35010. min: 7,
  35011. resetStack: true
  35012. }, {
  35013. id: "flex",
  35014. min: 13,
  35015. resetStack: true
  35016. }, {
  35017. id: "hflex1",
  35018. min: 9,
  35019. resetStack: true
  35020. }, {
  35021. id: "flex1",
  35022. min: 11,
  35023. resetStack: true
  35024. }];
  35025. class CFFParser {
  35026. constructor(file, properties, seacAnalysisEnabled) {
  35027. this.bytes = file.getBytes();
  35028. this.properties = properties;
  35029. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  35030. }
  35031. parse() {
  35032. const properties = this.properties;
  35033. const cff = new CFF();
  35034. this.cff = cff;
  35035. const header = this.parseHeader();
  35036. const nameIndex = this.parseIndex(header.endPos);
  35037. const topDictIndex = this.parseIndex(nameIndex.endPos);
  35038. const stringIndex = this.parseIndex(topDictIndex.endPos);
  35039. const globalSubrIndex = this.parseIndex(stringIndex.endPos);
  35040. const topDictParsed = this.parseDict(topDictIndex.obj.get(0));
  35041. const topDict = this.createDict(CFFTopDict, topDictParsed, cff.strings);
  35042. cff.header = header.obj;
  35043. cff.names = this.parseNameIndex(nameIndex.obj);
  35044. cff.strings = this.parseStringIndex(stringIndex.obj);
  35045. cff.topDict = topDict;
  35046. cff.globalSubrIndex = globalSubrIndex.obj;
  35047. this.parsePrivateDict(cff.topDict);
  35048. cff.isCIDFont = topDict.hasName("ROS");
  35049. const charStringOffset = topDict.getByName("CharStrings");
  35050. const charStringIndex = this.parseIndex(charStringOffset).obj;
  35051. const fontMatrix = topDict.getByName("FontMatrix");
  35052. if (fontMatrix) {
  35053. properties.fontMatrix = fontMatrix;
  35054. }
  35055. const fontBBox = topDict.getByName("FontBBox");
  35056. if (fontBBox) {
  35057. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  35058. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  35059. properties.ascentScaled = true;
  35060. }
  35061. let charset, encoding;
  35062. if (cff.isCIDFont) {
  35063. const fdArrayIndex = this.parseIndex(topDict.getByName("FDArray")).obj;
  35064. for (let i = 0, ii = fdArrayIndex.count; i < ii; ++i) {
  35065. const dictRaw = fdArrayIndex.get(i);
  35066. const fontDict = this.createDict(CFFTopDict, this.parseDict(dictRaw), cff.strings);
  35067. this.parsePrivateDict(fontDict);
  35068. cff.fdArray.push(fontDict);
  35069. }
  35070. encoding = null;
  35071. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, true);
  35072. cff.fdSelect = this.parseFDSelect(topDict.getByName("FDSelect"), charStringIndex.count);
  35073. } else {
  35074. charset = this.parseCharsets(topDict.getByName("charset"), charStringIndex.count, cff.strings, false);
  35075. encoding = this.parseEncoding(topDict.getByName("Encoding"), properties, cff.strings, charset.charset);
  35076. }
  35077. cff.charset = charset;
  35078. cff.encoding = encoding;
  35079. const charStringsAndSeacs = this.parseCharStrings({
  35080. charStrings: charStringIndex,
  35081. localSubrIndex: topDict.privateDict.subrsIndex,
  35082. globalSubrIndex: globalSubrIndex.obj,
  35083. fdSelect: cff.fdSelect,
  35084. fdArray: cff.fdArray,
  35085. privateDict: topDict.privateDict
  35086. });
  35087. cff.charStrings = charStringsAndSeacs.charStrings;
  35088. cff.seacs = charStringsAndSeacs.seacs;
  35089. cff.widths = charStringsAndSeacs.widths;
  35090. return cff;
  35091. }
  35092. parseHeader() {
  35093. let bytes = this.bytes;
  35094. const bytesLength = bytes.length;
  35095. let offset = 0;
  35096. while (offset < bytesLength && bytes[offset] !== 1) {
  35097. ++offset;
  35098. }
  35099. if (offset >= bytesLength) {
  35100. throw new _util.FormatError("Invalid CFF header");
  35101. }
  35102. if (offset !== 0) {
  35103. (0, _util.info)("cff data is shifted");
  35104. bytes = bytes.subarray(offset);
  35105. this.bytes = bytes;
  35106. }
  35107. const major = bytes[0];
  35108. const minor = bytes[1];
  35109. const hdrSize = bytes[2];
  35110. const offSize = bytes[3];
  35111. const header = new CFFHeader(major, minor, hdrSize, offSize);
  35112. return {
  35113. obj: header,
  35114. endPos: hdrSize
  35115. };
  35116. }
  35117. parseDict(dict) {
  35118. let pos = 0;
  35119. function parseOperand() {
  35120. let value = dict[pos++];
  35121. if (value === 30) {
  35122. return parseFloatOperand();
  35123. } else if (value === 28) {
  35124. value = dict[pos++];
  35125. value = (value << 24 | dict[pos++] << 16) >> 16;
  35126. return value;
  35127. } else if (value === 29) {
  35128. value = dict[pos++];
  35129. value = value << 8 | dict[pos++];
  35130. value = value << 8 | dict[pos++];
  35131. value = value << 8 | dict[pos++];
  35132. return value;
  35133. } else if (value >= 32 && value <= 246) {
  35134. return value - 139;
  35135. } else if (value >= 247 && value <= 250) {
  35136. return (value - 247) * 256 + dict[pos++] + 108;
  35137. } else if (value >= 251 && value <= 254) {
  35138. return -((value - 251) * 256) - dict[pos++] - 108;
  35139. }
  35140. (0, _util.warn)('CFFParser_parseDict: "' + value + '" is a reserved command.');
  35141. return NaN;
  35142. }
  35143. function parseFloatOperand() {
  35144. let str = "";
  35145. const eof = 15;
  35146. const lookup = ["0", "1", "2", "3", "4", "5", "6", "7", "8", "9", ".", "E", "E-", null, "-"];
  35147. const length = dict.length;
  35148. while (pos < length) {
  35149. const b = dict[pos++];
  35150. const b1 = b >> 4;
  35151. const b2 = b & 15;
  35152. if (b1 === eof) {
  35153. break;
  35154. }
  35155. str += lookup[b1];
  35156. if (b2 === eof) {
  35157. break;
  35158. }
  35159. str += lookup[b2];
  35160. }
  35161. return parseFloat(str);
  35162. }
  35163. let operands = [];
  35164. const entries = [];
  35165. pos = 0;
  35166. const end = dict.length;
  35167. while (pos < end) {
  35168. let b = dict[pos];
  35169. if (b <= 21) {
  35170. if (b === 12) {
  35171. b = b << 8 | dict[++pos];
  35172. }
  35173. entries.push([b, operands]);
  35174. operands = [];
  35175. ++pos;
  35176. } else {
  35177. operands.push(parseOperand());
  35178. }
  35179. }
  35180. return entries;
  35181. }
  35182. parseIndex(pos) {
  35183. const cffIndex = new CFFIndex();
  35184. const bytes = this.bytes;
  35185. const count = bytes[pos++] << 8 | bytes[pos++];
  35186. const offsets = [];
  35187. let end = pos;
  35188. let i, ii;
  35189. if (count !== 0) {
  35190. const offsetSize = bytes[pos++];
  35191. const startPos = pos + (count + 1) * offsetSize - 1;
  35192. for (i = 0, ii = count + 1; i < ii; ++i) {
  35193. let offset = 0;
  35194. for (let j = 0; j < offsetSize; ++j) {
  35195. offset <<= 8;
  35196. offset += bytes[pos++];
  35197. }
  35198. offsets.push(startPos + offset);
  35199. }
  35200. end = offsets[count];
  35201. }
  35202. for (i = 0, ii = offsets.length - 1; i < ii; ++i) {
  35203. const offsetStart = offsets[i];
  35204. const offsetEnd = offsets[i + 1];
  35205. cffIndex.add(bytes.subarray(offsetStart, offsetEnd));
  35206. }
  35207. return {
  35208. obj: cffIndex,
  35209. endPos: end
  35210. };
  35211. }
  35212. parseNameIndex(index) {
  35213. const names = [];
  35214. for (let i = 0, ii = index.count; i < ii; ++i) {
  35215. const name = index.get(i);
  35216. names.push((0, _util.bytesToString)(name));
  35217. }
  35218. return names;
  35219. }
  35220. parseStringIndex(index) {
  35221. const strings = new CFFStrings();
  35222. for (let i = 0, ii = index.count; i < ii; ++i) {
  35223. const data = index.get(i);
  35224. strings.add((0, _util.bytesToString)(data));
  35225. }
  35226. return strings;
  35227. }
  35228. createDict(Type, dict, strings) {
  35229. const cffDict = new Type(strings);
  35230. for (let i = 0, ii = dict.length; i < ii; ++i) {
  35231. const pair = dict[i];
  35232. const key = pair[0];
  35233. const value = pair[1];
  35234. cffDict.setByKey(key, value);
  35235. }
  35236. return cffDict;
  35237. }
  35238. parseCharString(state, data, localSubrIndex, globalSubrIndex) {
  35239. if (!data || state.callDepth > MAX_SUBR_NESTING) {
  35240. return false;
  35241. }
  35242. let stackSize = state.stackSize;
  35243. const stack = state.stack;
  35244. const length = data.length;
  35245. for (let j = 0; j < length;) {
  35246. const value = data[j++];
  35247. let validationCommand = null;
  35248. if (value === 12) {
  35249. const q = data[j++];
  35250. if (q === 0) {
  35251. data[j - 2] = 139;
  35252. data[j - 1] = 22;
  35253. stackSize = 0;
  35254. } else {
  35255. validationCommand = CharstringValidationData12[q];
  35256. }
  35257. } else if (value === 28) {
  35258. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16) >> 16;
  35259. j += 2;
  35260. stackSize++;
  35261. } else if (value === 14) {
  35262. if (stackSize >= 4) {
  35263. stackSize -= 4;
  35264. if (this.seacAnalysisEnabled) {
  35265. state.seac = stack.slice(stackSize, stackSize + 4);
  35266. return false;
  35267. }
  35268. }
  35269. validationCommand = CharstringValidationData[value];
  35270. } else if (value >= 32 && value <= 246) {
  35271. stack[stackSize] = value - 139;
  35272. stackSize++;
  35273. } else if (value >= 247 && value <= 254) {
  35274. stack[stackSize] = value < 251 ? (value - 247 << 8) + data[j] + 108 : -(value - 251 << 8) - data[j] - 108;
  35275. j++;
  35276. stackSize++;
  35277. } else if (value === 255) {
  35278. stack[stackSize] = (data[j] << 24 | data[j + 1] << 16 | data[j + 2] << 8 | data[j + 3]) / 65536;
  35279. j += 4;
  35280. stackSize++;
  35281. } else if (value === 19 || value === 20) {
  35282. state.hints += stackSize >> 1;
  35283. j += state.hints + 7 >> 3;
  35284. stackSize %= 2;
  35285. validationCommand = CharstringValidationData[value];
  35286. } else if (value === 10 || value === 29) {
  35287. let subrsIndex;
  35288. if (value === 10) {
  35289. subrsIndex = localSubrIndex;
  35290. } else {
  35291. subrsIndex = globalSubrIndex;
  35292. }
  35293. if (!subrsIndex) {
  35294. validationCommand = CharstringValidationData[value];
  35295. (0, _util.warn)("Missing subrsIndex for " + validationCommand.id);
  35296. return false;
  35297. }
  35298. let bias = 32768;
  35299. if (subrsIndex.count < 1240) {
  35300. bias = 107;
  35301. } else if (subrsIndex.count < 33900) {
  35302. bias = 1131;
  35303. }
  35304. const subrNumber = stack[--stackSize] + bias;
  35305. if (subrNumber < 0 || subrNumber >= subrsIndex.count || isNaN(subrNumber)) {
  35306. validationCommand = CharstringValidationData[value];
  35307. (0, _util.warn)("Out of bounds subrIndex for " + validationCommand.id);
  35308. return false;
  35309. }
  35310. state.stackSize = stackSize;
  35311. state.callDepth++;
  35312. const valid = this.parseCharString(state, subrsIndex.get(subrNumber), localSubrIndex, globalSubrIndex);
  35313. if (!valid) {
  35314. return false;
  35315. }
  35316. state.callDepth--;
  35317. stackSize = state.stackSize;
  35318. continue;
  35319. } else if (value === 11) {
  35320. state.stackSize = stackSize;
  35321. return true;
  35322. } else if (value === 0 && j === data.length) {
  35323. data[j - 1] = 14;
  35324. validationCommand = CharstringValidationData[14];
  35325. } else {
  35326. validationCommand = CharstringValidationData[value];
  35327. }
  35328. if (validationCommand) {
  35329. if (validationCommand.stem) {
  35330. state.hints += stackSize >> 1;
  35331. if (value === 3 || value === 23) {
  35332. state.hasVStems = true;
  35333. } else if (state.hasVStems && (value === 1 || value === 18)) {
  35334. (0, _util.warn)("CFF stem hints are in wrong order");
  35335. data[j - 1] = value === 1 ? 3 : 23;
  35336. }
  35337. }
  35338. if ("min" in validationCommand) {
  35339. if (!state.undefStack && stackSize < validationCommand.min) {
  35340. (0, _util.warn)("Not enough parameters for " + validationCommand.id + "; actual: " + stackSize + ", expected: " + validationCommand.min);
  35341. if (stackSize === 0) {
  35342. data[j - 1] = 14;
  35343. return true;
  35344. }
  35345. return false;
  35346. }
  35347. }
  35348. if (state.firstStackClearing && validationCommand.stackClearing) {
  35349. state.firstStackClearing = false;
  35350. stackSize -= validationCommand.min;
  35351. if (stackSize >= 2 && validationCommand.stem) {
  35352. stackSize %= 2;
  35353. } else if (stackSize > 1) {
  35354. (0, _util.warn)("Found too many parameters for stack-clearing command");
  35355. }
  35356. if (stackSize > 0) {
  35357. state.width = stack[stackSize - 1];
  35358. }
  35359. }
  35360. if ("stackDelta" in validationCommand) {
  35361. if ("stackFn" in validationCommand) {
  35362. validationCommand.stackFn(stack, stackSize);
  35363. }
  35364. stackSize += validationCommand.stackDelta;
  35365. } else if (validationCommand.stackClearing) {
  35366. stackSize = 0;
  35367. } else if (validationCommand.resetStack) {
  35368. stackSize = 0;
  35369. state.undefStack = false;
  35370. } else if (validationCommand.undefStack) {
  35371. stackSize = 0;
  35372. state.undefStack = true;
  35373. state.firstStackClearing = false;
  35374. }
  35375. }
  35376. }
  35377. state.stackSize = stackSize;
  35378. return true;
  35379. }
  35380. parseCharStrings({
  35381. charStrings,
  35382. localSubrIndex,
  35383. globalSubrIndex,
  35384. fdSelect,
  35385. fdArray,
  35386. privateDict
  35387. }) {
  35388. const seacs = [];
  35389. const widths = [];
  35390. const count = charStrings.count;
  35391. for (let i = 0; i < count; i++) {
  35392. const charstring = charStrings.get(i);
  35393. const state = {
  35394. callDepth: 0,
  35395. stackSize: 0,
  35396. stack: [],
  35397. undefStack: true,
  35398. hints: 0,
  35399. firstStackClearing: true,
  35400. seac: null,
  35401. width: null,
  35402. hasVStems: false
  35403. };
  35404. let valid = true;
  35405. let localSubrToUse = null;
  35406. let privateDictToUse = privateDict;
  35407. if (fdSelect && fdArray.length) {
  35408. const fdIndex = fdSelect.getFDIndex(i);
  35409. if (fdIndex === -1) {
  35410. (0, _util.warn)("Glyph index is not in fd select.");
  35411. valid = false;
  35412. }
  35413. if (fdIndex >= fdArray.length) {
  35414. (0, _util.warn)("Invalid fd index for glyph index.");
  35415. valid = false;
  35416. }
  35417. if (valid) {
  35418. privateDictToUse = fdArray[fdIndex].privateDict;
  35419. localSubrToUse = privateDictToUse.subrsIndex;
  35420. }
  35421. } else if (localSubrIndex) {
  35422. localSubrToUse = localSubrIndex;
  35423. }
  35424. if (valid) {
  35425. valid = this.parseCharString(state, charstring, localSubrToUse, globalSubrIndex);
  35426. }
  35427. if (state.width !== null) {
  35428. const nominalWidth = privateDictToUse.getByName("nominalWidthX");
  35429. widths[i] = nominalWidth + state.width;
  35430. } else {
  35431. const defaultWidth = privateDictToUse.getByName("defaultWidthX");
  35432. widths[i] = defaultWidth;
  35433. }
  35434. if (state.seac !== null) {
  35435. seacs[i] = state.seac;
  35436. }
  35437. if (!valid) {
  35438. charStrings.set(i, new Uint8Array([14]));
  35439. }
  35440. }
  35441. return {
  35442. charStrings,
  35443. seacs,
  35444. widths
  35445. };
  35446. }
  35447. emptyPrivateDictionary(parentDict) {
  35448. const privateDict = this.createDict(CFFPrivateDict, [], parentDict.strings);
  35449. parentDict.setByKey(18, [0, 0]);
  35450. parentDict.privateDict = privateDict;
  35451. }
  35452. parsePrivateDict(parentDict) {
  35453. if (!parentDict.hasName("Private")) {
  35454. this.emptyPrivateDictionary(parentDict);
  35455. return;
  35456. }
  35457. const privateOffset = parentDict.getByName("Private");
  35458. if (!Array.isArray(privateOffset) || privateOffset.length !== 2) {
  35459. parentDict.removeByName("Private");
  35460. return;
  35461. }
  35462. const size = privateOffset[0];
  35463. const offset = privateOffset[1];
  35464. if (size === 0 || offset >= this.bytes.length) {
  35465. this.emptyPrivateDictionary(parentDict);
  35466. return;
  35467. }
  35468. const privateDictEnd = offset + size;
  35469. const dictData = this.bytes.subarray(offset, privateDictEnd);
  35470. const dict = this.parseDict(dictData);
  35471. const privateDict = this.createDict(CFFPrivateDict, dict, parentDict.strings);
  35472. parentDict.privateDict = privateDict;
  35473. if (!privateDict.getByName("Subrs")) {
  35474. return;
  35475. }
  35476. const subrsOffset = privateDict.getByName("Subrs");
  35477. const relativeOffset = offset + subrsOffset;
  35478. if (subrsOffset === 0 || relativeOffset >= this.bytes.length) {
  35479. this.emptyPrivateDictionary(parentDict);
  35480. return;
  35481. }
  35482. const subrsIndex = this.parseIndex(relativeOffset);
  35483. privateDict.subrsIndex = subrsIndex.obj;
  35484. }
  35485. parseCharsets(pos, length, strings, cid) {
  35486. if (pos === 0) {
  35487. return new CFFCharset(true, CFFCharsetPredefinedTypes.ISO_ADOBE, _charsets.ISOAdobeCharset);
  35488. } else if (pos === 1) {
  35489. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT, _charsets.ExpertCharset);
  35490. } else if (pos === 2) {
  35491. return new CFFCharset(true, CFFCharsetPredefinedTypes.EXPERT_SUBSET, _charsets.ExpertSubsetCharset);
  35492. }
  35493. const bytes = this.bytes;
  35494. const start = pos;
  35495. const format = bytes[pos++];
  35496. const charset = [cid ? 0 : ".notdef"];
  35497. let id, count, i;
  35498. length -= 1;
  35499. switch (format) {
  35500. case 0:
  35501. for (i = 0; i < length; i++) {
  35502. id = bytes[pos++] << 8 | bytes[pos++];
  35503. charset.push(cid ? id : strings.get(id));
  35504. }
  35505. break;
  35506. case 1:
  35507. while (charset.length <= length) {
  35508. id = bytes[pos++] << 8 | bytes[pos++];
  35509. count = bytes[pos++];
  35510. for (i = 0; i <= count; i++) {
  35511. charset.push(cid ? id++ : strings.get(id++));
  35512. }
  35513. }
  35514. break;
  35515. case 2:
  35516. while (charset.length <= length) {
  35517. id = bytes[pos++] << 8 | bytes[pos++];
  35518. count = bytes[pos++] << 8 | bytes[pos++];
  35519. for (i = 0; i <= count; i++) {
  35520. charset.push(cid ? id++ : strings.get(id++));
  35521. }
  35522. }
  35523. break;
  35524. default:
  35525. throw new _util.FormatError("Unknown charset format");
  35526. }
  35527. const end = pos;
  35528. const raw = bytes.subarray(start, end);
  35529. return new CFFCharset(false, format, charset, raw);
  35530. }
  35531. parseEncoding(pos, properties, strings, charset) {
  35532. const encoding = Object.create(null);
  35533. const bytes = this.bytes;
  35534. let predefined = false;
  35535. let format, i, ii;
  35536. let raw = null;
  35537. function readSupplement() {
  35538. const supplementsCount = bytes[pos++];
  35539. for (i = 0; i < supplementsCount; i++) {
  35540. const code = bytes[pos++];
  35541. const sid = (bytes[pos++] << 8) + (bytes[pos++] & 0xff);
  35542. encoding[code] = charset.indexOf(strings.get(sid));
  35543. }
  35544. }
  35545. if (pos === 0 || pos === 1) {
  35546. predefined = true;
  35547. format = pos;
  35548. const baseEncoding = pos ? _encodings.ExpertEncoding : _encodings.StandardEncoding;
  35549. for (i = 0, ii = charset.length; i < ii; i++) {
  35550. const index = baseEncoding.indexOf(charset[i]);
  35551. if (index !== -1) {
  35552. encoding[index] = i;
  35553. }
  35554. }
  35555. } else {
  35556. const dataStart = pos;
  35557. format = bytes[pos++];
  35558. switch (format & 0x7f) {
  35559. case 0:
  35560. const glyphsCount = bytes[pos++];
  35561. for (i = 1; i <= glyphsCount; i++) {
  35562. encoding[bytes[pos++]] = i;
  35563. }
  35564. break;
  35565. case 1:
  35566. const rangesCount = bytes[pos++];
  35567. let gid = 1;
  35568. for (i = 0; i < rangesCount; i++) {
  35569. const start = bytes[pos++];
  35570. const left = bytes[pos++];
  35571. for (let j = start; j <= start + left; j++) {
  35572. encoding[j] = gid++;
  35573. }
  35574. }
  35575. break;
  35576. default:
  35577. throw new _util.FormatError(`Unknown encoding format: ${format} in CFF`);
  35578. }
  35579. const dataEnd = pos;
  35580. if (format & 0x80) {
  35581. bytes[dataStart] &= 0x7f;
  35582. readSupplement();
  35583. }
  35584. raw = bytes.subarray(dataStart, dataEnd);
  35585. }
  35586. format &= 0x7f;
  35587. return new CFFEncoding(predefined, format, encoding, raw);
  35588. }
  35589. parseFDSelect(pos, length) {
  35590. const bytes = this.bytes;
  35591. const format = bytes[pos++];
  35592. const fdSelect = [];
  35593. let i;
  35594. switch (format) {
  35595. case 0:
  35596. for (i = 0; i < length; ++i) {
  35597. const id = bytes[pos++];
  35598. fdSelect.push(id);
  35599. }
  35600. break;
  35601. case 3:
  35602. const rangesCount = bytes[pos++] << 8 | bytes[pos++];
  35603. for (i = 0; i < rangesCount; ++i) {
  35604. let first = bytes[pos++] << 8 | bytes[pos++];
  35605. if (i === 0 && first !== 0) {
  35606. (0, _util.warn)("parseFDSelect: The first range must have a first GID of 0" + " -- trying to recover.");
  35607. first = 0;
  35608. }
  35609. const fdIndex = bytes[pos++];
  35610. const next = bytes[pos] << 8 | bytes[pos + 1];
  35611. for (let j = first; j < next; ++j) {
  35612. fdSelect.push(fdIndex);
  35613. }
  35614. }
  35615. pos += 2;
  35616. break;
  35617. default:
  35618. throw new _util.FormatError(`parseFDSelect: Unknown format "${format}".`);
  35619. }
  35620. if (fdSelect.length !== length) {
  35621. throw new _util.FormatError("parseFDSelect: Invalid font data.");
  35622. }
  35623. return new CFFFDSelect(format, fdSelect);
  35624. }
  35625. }
  35626. return CFFParser;
  35627. }();
  35628. exports.CFFParser = CFFParser;
  35629. class CFF {
  35630. constructor() {
  35631. this.header = null;
  35632. this.names = [];
  35633. this.topDict = null;
  35634. this.strings = new CFFStrings();
  35635. this.globalSubrIndex = null;
  35636. this.encoding = null;
  35637. this.charset = null;
  35638. this.charStrings = null;
  35639. this.fdArray = [];
  35640. this.fdSelect = null;
  35641. this.isCIDFont = false;
  35642. }
  35643. duplicateFirstGlyph() {
  35644. if (this.charStrings.count >= 65535) {
  35645. (0, _util.warn)("Not enough space in charstrings to duplicate first glyph.");
  35646. return;
  35647. }
  35648. const glyphZero = this.charStrings.get(0);
  35649. this.charStrings.add(glyphZero);
  35650. if (this.isCIDFont) {
  35651. this.fdSelect.fdSelect.push(this.fdSelect.fdSelect[0]);
  35652. }
  35653. }
  35654. hasGlyphId(id) {
  35655. if (id < 0 || id >= this.charStrings.count) {
  35656. return false;
  35657. }
  35658. const glyph = this.charStrings.get(id);
  35659. return glyph.length > 0;
  35660. }
  35661. }
  35662. exports.CFF = CFF;
  35663. class CFFHeader {
  35664. constructor(major, minor, hdrSize, offSize) {
  35665. this.major = major;
  35666. this.minor = minor;
  35667. this.hdrSize = hdrSize;
  35668. this.offSize = offSize;
  35669. }
  35670. }
  35671. exports.CFFHeader = CFFHeader;
  35672. class CFFStrings {
  35673. constructor() {
  35674. this.strings = [];
  35675. }
  35676. get(index) {
  35677. if (index >= 0 && index <= NUM_STANDARD_CFF_STRINGS - 1) {
  35678. return CFFStandardStrings[index];
  35679. }
  35680. if (index - NUM_STANDARD_CFF_STRINGS <= this.strings.length) {
  35681. return this.strings[index - NUM_STANDARD_CFF_STRINGS];
  35682. }
  35683. return CFFStandardStrings[0];
  35684. }
  35685. getSID(str) {
  35686. let index = CFFStandardStrings.indexOf(str);
  35687. if (index !== -1) {
  35688. return index;
  35689. }
  35690. index = this.strings.indexOf(str);
  35691. if (index !== -1) {
  35692. return index + NUM_STANDARD_CFF_STRINGS;
  35693. }
  35694. return -1;
  35695. }
  35696. add(value) {
  35697. this.strings.push(value);
  35698. }
  35699. get count() {
  35700. return this.strings.length;
  35701. }
  35702. }
  35703. exports.CFFStrings = CFFStrings;
  35704. class CFFIndex {
  35705. constructor() {
  35706. this.objects = [];
  35707. this.length = 0;
  35708. }
  35709. add(data) {
  35710. this.length += data.length;
  35711. this.objects.push(data);
  35712. }
  35713. set(index, data) {
  35714. this.length += data.length - this.objects[index].length;
  35715. this.objects[index] = data;
  35716. }
  35717. get(index) {
  35718. return this.objects[index];
  35719. }
  35720. get count() {
  35721. return this.objects.length;
  35722. }
  35723. }
  35724. exports.CFFIndex = CFFIndex;
  35725. class CFFDict {
  35726. constructor(tables, strings) {
  35727. this.keyToNameMap = tables.keyToNameMap;
  35728. this.nameToKeyMap = tables.nameToKeyMap;
  35729. this.defaults = tables.defaults;
  35730. this.types = tables.types;
  35731. this.opcodes = tables.opcodes;
  35732. this.order = tables.order;
  35733. this.strings = strings;
  35734. this.values = Object.create(null);
  35735. }
  35736. setByKey(key, value) {
  35737. if (!(key in this.keyToNameMap)) {
  35738. return false;
  35739. }
  35740. const valueLength = value.length;
  35741. if (valueLength === 0) {
  35742. return true;
  35743. }
  35744. for (let i = 0; i < valueLength; i++) {
  35745. if (isNaN(value[i])) {
  35746. (0, _util.warn)('Invalid CFFDict value: "' + value + '" for key "' + key + '".');
  35747. return true;
  35748. }
  35749. }
  35750. const type = this.types[key];
  35751. if (type === "num" || type === "sid" || type === "offset") {
  35752. value = value[0];
  35753. }
  35754. this.values[key] = value;
  35755. return true;
  35756. }
  35757. setByName(name, value) {
  35758. if (!(name in this.nameToKeyMap)) {
  35759. throw new _util.FormatError(`Invalid dictionary name "${name}"`);
  35760. }
  35761. this.values[this.nameToKeyMap[name]] = value;
  35762. }
  35763. hasName(name) {
  35764. return this.nameToKeyMap[name] in this.values;
  35765. }
  35766. getByName(name) {
  35767. if (!(name in this.nameToKeyMap)) {
  35768. throw new _util.FormatError(`Invalid dictionary name ${name}"`);
  35769. }
  35770. const key = this.nameToKeyMap[name];
  35771. if (!(key in this.values)) {
  35772. return this.defaults[key];
  35773. }
  35774. return this.values[key];
  35775. }
  35776. removeByName(name) {
  35777. delete this.values[this.nameToKeyMap[name]];
  35778. }
  35779. static createTables(layout) {
  35780. const tables = {
  35781. keyToNameMap: {},
  35782. nameToKeyMap: {},
  35783. defaults: {},
  35784. types: {},
  35785. opcodes: {},
  35786. order: []
  35787. };
  35788. for (let i = 0, ii = layout.length; i < ii; ++i) {
  35789. const entry = layout[i];
  35790. const key = Array.isArray(entry[0]) ? (entry[0][0] << 8) + entry[0][1] : entry[0];
  35791. tables.keyToNameMap[key] = entry[1];
  35792. tables.nameToKeyMap[entry[1]] = key;
  35793. tables.types[key] = entry[2];
  35794. tables.defaults[key] = entry[3];
  35795. tables.opcodes[key] = Array.isArray(entry[0]) ? entry[0] : [entry[0]];
  35796. tables.order.push(key);
  35797. }
  35798. return tables;
  35799. }
  35800. }
  35801. const CFFTopDict = function CFFTopDictClosure() {
  35802. const layout = [[[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]];
  35803. let tables = null;
  35804. class CFFTopDict extends CFFDict {
  35805. constructor(strings) {
  35806. if (tables === null) {
  35807. tables = CFFDict.createTables(layout);
  35808. }
  35809. super(tables, strings);
  35810. this.privateDict = null;
  35811. }
  35812. }
  35813. return CFFTopDict;
  35814. }();
  35815. exports.CFFTopDict = CFFTopDict;
  35816. const CFFPrivateDict = function CFFPrivateDictClosure() {
  35817. const layout = [[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]];
  35818. let tables = null;
  35819. class CFFPrivateDict extends CFFDict {
  35820. constructor(strings) {
  35821. if (tables === null) {
  35822. tables = CFFDict.createTables(layout);
  35823. }
  35824. super(tables, strings);
  35825. this.subrsIndex = null;
  35826. }
  35827. }
  35828. return CFFPrivateDict;
  35829. }();
  35830. exports.CFFPrivateDict = CFFPrivateDict;
  35831. const CFFCharsetPredefinedTypes = {
  35832. ISO_ADOBE: 0,
  35833. EXPERT: 1,
  35834. EXPERT_SUBSET: 2
  35835. };
  35836. class CFFCharset {
  35837. constructor(predefined, format, charset, raw) {
  35838. this.predefined = predefined;
  35839. this.format = format;
  35840. this.charset = charset;
  35841. this.raw = raw;
  35842. }
  35843. }
  35844. exports.CFFCharset = CFFCharset;
  35845. class CFFEncoding {
  35846. constructor(predefined, format, encoding, raw) {
  35847. this.predefined = predefined;
  35848. this.format = format;
  35849. this.encoding = encoding;
  35850. this.raw = raw;
  35851. }
  35852. }
  35853. class CFFFDSelect {
  35854. constructor(format, fdSelect) {
  35855. this.format = format;
  35856. this.fdSelect = fdSelect;
  35857. }
  35858. getFDIndex(glyphIndex) {
  35859. if (glyphIndex < 0 || glyphIndex >= this.fdSelect.length) {
  35860. return -1;
  35861. }
  35862. return this.fdSelect[glyphIndex];
  35863. }
  35864. }
  35865. exports.CFFFDSelect = CFFFDSelect;
  35866. class CFFOffsetTracker {
  35867. constructor() {
  35868. this.offsets = Object.create(null);
  35869. }
  35870. isTracking(key) {
  35871. return key in this.offsets;
  35872. }
  35873. track(key, location) {
  35874. if (key in this.offsets) {
  35875. throw new _util.FormatError(`Already tracking location of ${key}`);
  35876. }
  35877. this.offsets[key] = location;
  35878. }
  35879. offset(value) {
  35880. for (const key in this.offsets) {
  35881. this.offsets[key] += value;
  35882. }
  35883. }
  35884. setEntryLocation(key, values, output) {
  35885. if (!(key in this.offsets)) {
  35886. throw new _util.FormatError(`Not tracking location of ${key}`);
  35887. }
  35888. const data = output.data;
  35889. const dataOffset = this.offsets[key];
  35890. const size = 5;
  35891. for (let i = 0, ii = values.length; i < ii; ++i) {
  35892. const offset0 = i * size + dataOffset;
  35893. const offset1 = offset0 + 1;
  35894. const offset2 = offset0 + 2;
  35895. const offset3 = offset0 + 3;
  35896. const offset4 = offset0 + 4;
  35897. if (data[offset0] !== 0x1d || data[offset1] !== 0 || data[offset2] !== 0 || data[offset3] !== 0 || data[offset4] !== 0) {
  35898. throw new _util.FormatError("writing to an offset that is not empty");
  35899. }
  35900. const value = values[i];
  35901. data[offset0] = 0x1d;
  35902. data[offset1] = value >> 24 & 0xff;
  35903. data[offset2] = value >> 16 & 0xff;
  35904. data[offset3] = value >> 8 & 0xff;
  35905. data[offset4] = value & 0xff;
  35906. }
  35907. }
  35908. }
  35909. class CFFCompiler {
  35910. constructor(cff) {
  35911. this.cff = cff;
  35912. }
  35913. compile() {
  35914. const cff = this.cff;
  35915. const output = {
  35916. data: [],
  35917. length: 0,
  35918. add: function CFFCompiler_add(data) {
  35919. this.data = this.data.concat(data);
  35920. this.length = this.data.length;
  35921. }
  35922. };
  35923. const header = this.compileHeader(cff.header);
  35924. output.add(header);
  35925. const nameIndex = this.compileNameIndex(cff.names);
  35926. output.add(nameIndex);
  35927. if (cff.isCIDFont) {
  35928. if (cff.topDict.hasName("FontMatrix")) {
  35929. const base = cff.topDict.getByName("FontMatrix");
  35930. cff.topDict.removeByName("FontMatrix");
  35931. for (let i = 0, ii = cff.fdArray.length; i < ii; i++) {
  35932. const subDict = cff.fdArray[i];
  35933. let matrix = base.slice(0);
  35934. if (subDict.hasName("FontMatrix")) {
  35935. matrix = _util.Util.transform(matrix, subDict.getByName("FontMatrix"));
  35936. }
  35937. subDict.setByName("FontMatrix", matrix);
  35938. }
  35939. }
  35940. }
  35941. const xuid = cff.topDict.getByName("XUID");
  35942. if (xuid && xuid.length > 16) {
  35943. cff.topDict.removeByName("XUID");
  35944. }
  35945. cff.topDict.setByName("charset", 0);
  35946. let compiled = this.compileTopDicts([cff.topDict], output.length, cff.isCIDFont);
  35947. output.add(compiled.output);
  35948. const topDictTracker = compiled.trackers[0];
  35949. const stringIndex = this.compileStringIndex(cff.strings.strings);
  35950. output.add(stringIndex);
  35951. const globalSubrIndex = this.compileIndex(cff.globalSubrIndex);
  35952. output.add(globalSubrIndex);
  35953. if (cff.encoding && cff.topDict.hasName("Encoding")) {
  35954. if (cff.encoding.predefined) {
  35955. topDictTracker.setEntryLocation("Encoding", [cff.encoding.format], output);
  35956. } else {
  35957. const encoding = this.compileEncoding(cff.encoding);
  35958. topDictTracker.setEntryLocation("Encoding", [output.length], output);
  35959. output.add(encoding);
  35960. }
  35961. }
  35962. const charset = this.compileCharset(cff.charset, cff.charStrings.count, cff.strings, cff.isCIDFont);
  35963. topDictTracker.setEntryLocation("charset", [output.length], output);
  35964. output.add(charset);
  35965. const charStrings = this.compileCharStrings(cff.charStrings);
  35966. topDictTracker.setEntryLocation("CharStrings", [output.length], output);
  35967. output.add(charStrings);
  35968. if (cff.isCIDFont) {
  35969. topDictTracker.setEntryLocation("FDSelect", [output.length], output);
  35970. const fdSelect = this.compileFDSelect(cff.fdSelect);
  35971. output.add(fdSelect);
  35972. compiled = this.compileTopDicts(cff.fdArray, output.length, true);
  35973. topDictTracker.setEntryLocation("FDArray", [output.length], output);
  35974. output.add(compiled.output);
  35975. const fontDictTrackers = compiled.trackers;
  35976. this.compilePrivateDicts(cff.fdArray, fontDictTrackers, output);
  35977. }
  35978. this.compilePrivateDicts([cff.topDict], [topDictTracker], output);
  35979. output.add([0]);
  35980. return output.data;
  35981. }
  35982. encodeNumber(value) {
  35983. if (Number.isInteger(value)) {
  35984. return this.encodeInteger(value);
  35985. }
  35986. return this.encodeFloat(value);
  35987. }
  35988. static get EncodeFloatRegExp() {
  35989. return (0, _util.shadow)(this, "EncodeFloatRegExp", /\.(\d*?)(?:9{5,20}|0{5,20})\d{0,2}(?:e(.+)|$)/);
  35990. }
  35991. encodeFloat(num) {
  35992. let value = num.toString();
  35993. const m = CFFCompiler.EncodeFloatRegExp.exec(value);
  35994. if (m) {
  35995. const epsilon = parseFloat("1e" + ((m[2] ? +m[2] : 0) + m[1].length));
  35996. value = (Math.round(num * epsilon) / epsilon).toString();
  35997. }
  35998. let nibbles = "";
  35999. let i, ii;
  36000. for (i = 0, ii = value.length; i < ii; ++i) {
  36001. const a = value[i];
  36002. if (a === "e") {
  36003. nibbles += value[++i] === "-" ? "c" : "b";
  36004. } else if (a === ".") {
  36005. nibbles += "a";
  36006. } else if (a === "-") {
  36007. nibbles += "e";
  36008. } else {
  36009. nibbles += a;
  36010. }
  36011. }
  36012. nibbles += nibbles.length & 1 ? "f" : "ff";
  36013. const out = [30];
  36014. for (i = 0, ii = nibbles.length; i < ii; i += 2) {
  36015. out.push(parseInt(nibbles.substring(i, i + 2), 16));
  36016. }
  36017. return out;
  36018. }
  36019. encodeInteger(value) {
  36020. let code;
  36021. if (value >= -107 && value <= 107) {
  36022. code = [value + 139];
  36023. } else if (value >= 108 && value <= 1131) {
  36024. value -= 108;
  36025. code = [(value >> 8) + 247, value & 0xff];
  36026. } else if (value >= -1131 && value <= -108) {
  36027. value = -value - 108;
  36028. code = [(value >> 8) + 251, value & 0xff];
  36029. } else if (value >= -32768 && value <= 32767) {
  36030. code = [0x1c, value >> 8 & 0xff, value & 0xff];
  36031. } else {
  36032. code = [0x1d, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff];
  36033. }
  36034. return code;
  36035. }
  36036. compileHeader(header) {
  36037. return [header.major, header.minor, 4, header.offSize];
  36038. }
  36039. compileNameIndex(names) {
  36040. const nameIndex = new CFFIndex();
  36041. for (let i = 0, ii = names.length; i < ii; ++i) {
  36042. const name = names[i];
  36043. const length = Math.min(name.length, 127);
  36044. let sanitizedName = new Array(length);
  36045. for (let j = 0; j < length; j++) {
  36046. let char = name[j];
  36047. if (char < "!" || char > "~" || char === "[" || char === "]" || char === "(" || char === ")" || char === "{" || char === "}" || char === "<" || char === ">" || char === "/" || char === "%") {
  36048. char = "_";
  36049. }
  36050. sanitizedName[j] = char;
  36051. }
  36052. sanitizedName = sanitizedName.join("");
  36053. if (sanitizedName === "") {
  36054. sanitizedName = "Bad_Font_Name";
  36055. }
  36056. nameIndex.add((0, _util.stringToBytes)(sanitizedName));
  36057. }
  36058. return this.compileIndex(nameIndex);
  36059. }
  36060. compileTopDicts(dicts, length, removeCidKeys) {
  36061. const fontDictTrackers = [];
  36062. let fdArrayIndex = new CFFIndex();
  36063. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  36064. const fontDict = dicts[i];
  36065. if (removeCidKeys) {
  36066. fontDict.removeByName("CIDFontVersion");
  36067. fontDict.removeByName("CIDFontRevision");
  36068. fontDict.removeByName("CIDFontType");
  36069. fontDict.removeByName("CIDCount");
  36070. fontDict.removeByName("UIDBase");
  36071. }
  36072. const fontDictTracker = new CFFOffsetTracker();
  36073. const fontDictData = this.compileDict(fontDict, fontDictTracker);
  36074. fontDictTrackers.push(fontDictTracker);
  36075. fdArrayIndex.add(fontDictData);
  36076. fontDictTracker.offset(length);
  36077. }
  36078. fdArrayIndex = this.compileIndex(fdArrayIndex, fontDictTrackers);
  36079. return {
  36080. trackers: fontDictTrackers,
  36081. output: fdArrayIndex
  36082. };
  36083. }
  36084. compilePrivateDicts(dicts, trackers, output) {
  36085. for (let i = 0, ii = dicts.length; i < ii; ++i) {
  36086. const fontDict = dicts[i];
  36087. const privateDict = fontDict.privateDict;
  36088. if (!privateDict || !fontDict.hasName("Private")) {
  36089. throw new _util.FormatError("There must be a private dictionary.");
  36090. }
  36091. const privateDictTracker = new CFFOffsetTracker();
  36092. const privateDictData = this.compileDict(privateDict, privateDictTracker);
  36093. let outputLength = output.length;
  36094. privateDictTracker.offset(outputLength);
  36095. if (!privateDictData.length) {
  36096. outputLength = 0;
  36097. }
  36098. trackers[i].setEntryLocation("Private", [privateDictData.length, outputLength], output);
  36099. output.add(privateDictData);
  36100. if (privateDict.subrsIndex && privateDict.hasName("Subrs")) {
  36101. const subrs = this.compileIndex(privateDict.subrsIndex);
  36102. privateDictTracker.setEntryLocation("Subrs", [privateDictData.length], output);
  36103. output.add(subrs);
  36104. }
  36105. }
  36106. }
  36107. compileDict(dict, offsetTracker) {
  36108. let out = [];
  36109. const order = dict.order;
  36110. for (let i = 0; i < order.length; ++i) {
  36111. const key = order[i];
  36112. if (!(key in dict.values)) {
  36113. continue;
  36114. }
  36115. let values = dict.values[key];
  36116. let types = dict.types[key];
  36117. if (!Array.isArray(types)) {
  36118. types = [types];
  36119. }
  36120. if (!Array.isArray(values)) {
  36121. values = [values];
  36122. }
  36123. if (values.length === 0) {
  36124. continue;
  36125. }
  36126. for (let j = 0, jj = types.length; j < jj; ++j) {
  36127. const type = types[j];
  36128. const value = values[j];
  36129. switch (type) {
  36130. case "num":
  36131. case "sid":
  36132. out = out.concat(this.encodeNumber(value));
  36133. break;
  36134. case "offset":
  36135. const name = dict.keyToNameMap[key];
  36136. if (!offsetTracker.isTracking(name)) {
  36137. offsetTracker.track(name, out.length);
  36138. }
  36139. out = out.concat([0x1d, 0, 0, 0, 0]);
  36140. break;
  36141. case "array":
  36142. case "delta":
  36143. out = out.concat(this.encodeNumber(value));
  36144. for (let k = 1, kk = values.length; k < kk; ++k) {
  36145. out = out.concat(this.encodeNumber(values[k]));
  36146. }
  36147. break;
  36148. default:
  36149. throw new _util.FormatError(`Unknown data type of ${type}`);
  36150. }
  36151. }
  36152. out = out.concat(dict.opcodes[key]);
  36153. }
  36154. return out;
  36155. }
  36156. compileStringIndex(strings) {
  36157. const stringIndex = new CFFIndex();
  36158. for (let i = 0, ii = strings.length; i < ii; ++i) {
  36159. stringIndex.add((0, _util.stringToBytes)(strings[i]));
  36160. }
  36161. return this.compileIndex(stringIndex);
  36162. }
  36163. compileGlobalSubrIndex() {
  36164. const globalSubrIndex = this.cff.globalSubrIndex;
  36165. this.out.writeByteArray(this.compileIndex(globalSubrIndex));
  36166. }
  36167. compileCharStrings(charStrings) {
  36168. const charStringsIndex = new CFFIndex();
  36169. for (let i = 0; i < charStrings.count; i++) {
  36170. const glyph = charStrings.get(i);
  36171. if (glyph.length === 0) {
  36172. charStringsIndex.add(new Uint8Array([0x8b, 0x0e]));
  36173. continue;
  36174. }
  36175. charStringsIndex.add(glyph);
  36176. }
  36177. return this.compileIndex(charStringsIndex);
  36178. }
  36179. compileCharset(charset, numGlyphs, strings, isCIDFont) {
  36180. let out;
  36181. const numGlyphsLessNotDef = numGlyphs - 1;
  36182. if (isCIDFont) {
  36183. out = new Uint8Array([2, 0, 0, numGlyphsLessNotDef >> 8 & 0xff, numGlyphsLessNotDef & 0xff]);
  36184. } else {
  36185. const length = 1 + numGlyphsLessNotDef * 2;
  36186. out = new Uint8Array(length);
  36187. out[0] = 0;
  36188. let charsetIndex = 0;
  36189. const numCharsets = charset.charset.length;
  36190. let warned = false;
  36191. for (let i = 1; i < out.length; i += 2) {
  36192. let sid = 0;
  36193. if (charsetIndex < numCharsets) {
  36194. const name = charset.charset[charsetIndex++];
  36195. sid = strings.getSID(name);
  36196. if (sid === -1) {
  36197. sid = 0;
  36198. if (!warned) {
  36199. warned = true;
  36200. (0, _util.warn)(`Couldn't find ${name} in CFF strings`);
  36201. }
  36202. }
  36203. }
  36204. out[i] = sid >> 8 & 0xff;
  36205. out[i + 1] = sid & 0xff;
  36206. }
  36207. }
  36208. return this.compileTypedArray(out);
  36209. }
  36210. compileEncoding(encoding) {
  36211. return this.compileTypedArray(encoding.raw);
  36212. }
  36213. compileFDSelect(fdSelect) {
  36214. const format = fdSelect.format;
  36215. let out, i;
  36216. switch (format) {
  36217. case 0:
  36218. out = new Uint8Array(1 + fdSelect.fdSelect.length);
  36219. out[0] = format;
  36220. for (i = 0; i < fdSelect.fdSelect.length; i++) {
  36221. out[i + 1] = fdSelect.fdSelect[i];
  36222. }
  36223. break;
  36224. case 3:
  36225. const start = 0;
  36226. let lastFD = fdSelect.fdSelect[0];
  36227. const ranges = [format, 0, 0, start >> 8 & 0xff, start & 0xff, lastFD];
  36228. for (i = 1; i < fdSelect.fdSelect.length; i++) {
  36229. const currentFD = fdSelect.fdSelect[i];
  36230. if (currentFD !== lastFD) {
  36231. ranges.push(i >> 8 & 0xff, i & 0xff, currentFD);
  36232. lastFD = currentFD;
  36233. }
  36234. }
  36235. const numRanges = (ranges.length - 3) / 3;
  36236. ranges[1] = numRanges >> 8 & 0xff;
  36237. ranges[2] = numRanges & 0xff;
  36238. ranges.push(i >> 8 & 0xff, i & 0xff);
  36239. out = new Uint8Array(ranges);
  36240. break;
  36241. }
  36242. return this.compileTypedArray(out);
  36243. }
  36244. compileTypedArray(data) {
  36245. const out = [];
  36246. for (let i = 0, ii = data.length; i < ii; ++i) {
  36247. out[i] = data[i];
  36248. }
  36249. return out;
  36250. }
  36251. compileIndex(index, trackers = []) {
  36252. const objects = index.objects;
  36253. const count = objects.length;
  36254. if (count === 0) {
  36255. return [0, 0, 0];
  36256. }
  36257. const data = [count >> 8 & 0xff, count & 0xff];
  36258. let lastOffset = 1,
  36259. i;
  36260. for (i = 0; i < count; ++i) {
  36261. lastOffset += objects[i].length;
  36262. }
  36263. let offsetSize;
  36264. if (lastOffset < 0x100) {
  36265. offsetSize = 1;
  36266. } else if (lastOffset < 0x10000) {
  36267. offsetSize = 2;
  36268. } else if (lastOffset < 0x1000000) {
  36269. offsetSize = 3;
  36270. } else {
  36271. offsetSize = 4;
  36272. }
  36273. data.push(offsetSize);
  36274. let relativeOffset = 1;
  36275. for (i = 0; i < count + 1; i++) {
  36276. if (offsetSize === 1) {
  36277. data.push(relativeOffset & 0xff);
  36278. } else if (offsetSize === 2) {
  36279. data.push(relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36280. } else if (offsetSize === 3) {
  36281. data.push(relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36282. } else {
  36283. data.push(relativeOffset >>> 24 & 0xff, relativeOffset >> 16 & 0xff, relativeOffset >> 8 & 0xff, relativeOffset & 0xff);
  36284. }
  36285. if (objects[i]) {
  36286. relativeOffset += objects[i].length;
  36287. }
  36288. }
  36289. for (i = 0; i < count; i++) {
  36290. if (trackers[i]) {
  36291. trackers[i].offset(data.length);
  36292. }
  36293. for (let j = 0, jj = objects[i].length; j < jj; j++) {
  36294. data.push(objects[i][j]);
  36295. }
  36296. }
  36297. return data;
  36298. }
  36299. }
  36300. exports.CFFCompiler = CFFCompiler;
  36301. /***/ }),
  36302. /* 46 */
  36303. /***/ ((__unused_webpack_module, exports) => {
  36304. Object.defineProperty(exports, "__esModule", ({
  36305. value: true
  36306. }));
  36307. exports.ISOAdobeCharset = exports.ExpertSubsetCharset = exports.ExpertCharset = void 0;
  36308. 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"];
  36309. exports.ISOAdobeCharset = ISOAdobeCharset;
  36310. 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"];
  36311. exports.ExpertCharset = ExpertCharset;
  36312. 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"];
  36313. exports.ExpertSubsetCharset = ExpertSubsetCharset;
  36314. /***/ }),
  36315. /* 47 */
  36316. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  36317. Object.defineProperty(exports, "__esModule", ({
  36318. value: true
  36319. }));
  36320. exports.getSerifFonts = exports.getNonStdFontMap = exports.getGlyphMapForStandardFonts = exports.getFontNameToFileMap = void 0;
  36321. exports.getStandardFontName = getStandardFontName;
  36322. exports.getSymbolsFonts = exports.getSupplementalGlyphMapForCalibri = exports.getSupplementalGlyphMapForArialBlack = exports.getStdFontMap = void 0;
  36323. var _core_utils = __w_pdfjs_require__(8);
  36324. var _fonts_utils = __w_pdfjs_require__(18);
  36325. const getStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36326. t["Times-Roman"] = "Times-Roman";
  36327. t.Helvetica = "Helvetica";
  36328. t.Courier = "Courier";
  36329. t.Symbol = "Symbol";
  36330. t["Times-Bold"] = "Times-Bold";
  36331. t["Helvetica-Bold"] = "Helvetica-Bold";
  36332. t["Courier-Bold"] = "Courier-Bold";
  36333. t.ZapfDingbats = "ZapfDingbats";
  36334. t["Times-Italic"] = "Times-Italic";
  36335. t["Helvetica-Oblique"] = "Helvetica-Oblique";
  36336. t["Courier-Oblique"] = "Courier-Oblique";
  36337. t["Times-BoldItalic"] = "Times-BoldItalic";
  36338. t["Helvetica-BoldOblique"] = "Helvetica-BoldOblique";
  36339. t["Courier-BoldOblique"] = "Courier-BoldOblique";
  36340. t.ArialNarrow = "Helvetica";
  36341. t["ArialNarrow-Bold"] = "Helvetica-Bold";
  36342. t["ArialNarrow-BoldItalic"] = "Helvetica-BoldOblique";
  36343. t["ArialNarrow-Italic"] = "Helvetica-Oblique";
  36344. t.ArialBlack = "Helvetica";
  36345. t["ArialBlack-Bold"] = "Helvetica-Bold";
  36346. t["ArialBlack-BoldItalic"] = "Helvetica-BoldOblique";
  36347. t["ArialBlack-Italic"] = "Helvetica-Oblique";
  36348. t["Arial-Black"] = "Helvetica";
  36349. t["Arial-Black-Bold"] = "Helvetica-Bold";
  36350. t["Arial-Black-BoldItalic"] = "Helvetica-BoldOblique";
  36351. t["Arial-Black-Italic"] = "Helvetica-Oblique";
  36352. t.Arial = "Helvetica";
  36353. t["Arial-Bold"] = "Helvetica-Bold";
  36354. t["Arial-BoldItalic"] = "Helvetica-BoldOblique";
  36355. t["Arial-Italic"] = "Helvetica-Oblique";
  36356. t["Arial-BoldItalicMT"] = "Helvetica-BoldOblique";
  36357. t["Arial-BoldMT"] = "Helvetica-Bold";
  36358. t["Arial-ItalicMT"] = "Helvetica-Oblique";
  36359. t.ArialMT = "Helvetica";
  36360. t["Courier-BoldItalic"] = "Courier-BoldOblique";
  36361. t["Courier-Italic"] = "Courier-Oblique";
  36362. t.CourierNew = "Courier";
  36363. t["CourierNew-Bold"] = "Courier-Bold";
  36364. t["CourierNew-BoldItalic"] = "Courier-BoldOblique";
  36365. t["CourierNew-Italic"] = "Courier-Oblique";
  36366. t["CourierNewPS-BoldItalicMT"] = "Courier-BoldOblique";
  36367. t["CourierNewPS-BoldMT"] = "Courier-Bold";
  36368. t["CourierNewPS-ItalicMT"] = "Courier-Oblique";
  36369. t.CourierNewPSMT = "Courier";
  36370. t["Helvetica-BoldItalic"] = "Helvetica-BoldOblique";
  36371. t["Helvetica-Italic"] = "Helvetica-Oblique";
  36372. t["Symbol-Bold"] = "Symbol";
  36373. t["Symbol-BoldItalic"] = "Symbol";
  36374. t["Symbol-Italic"] = "Symbol";
  36375. t.TimesNewRoman = "Times-Roman";
  36376. t["TimesNewRoman-Bold"] = "Times-Bold";
  36377. t["TimesNewRoman-BoldItalic"] = "Times-BoldItalic";
  36378. t["TimesNewRoman-Italic"] = "Times-Italic";
  36379. t.TimesNewRomanPS = "Times-Roman";
  36380. t["TimesNewRomanPS-Bold"] = "Times-Bold";
  36381. t["TimesNewRomanPS-BoldItalic"] = "Times-BoldItalic";
  36382. t["TimesNewRomanPS-BoldItalicMT"] = "Times-BoldItalic";
  36383. t["TimesNewRomanPS-BoldMT"] = "Times-Bold";
  36384. t["TimesNewRomanPS-Italic"] = "Times-Italic";
  36385. t["TimesNewRomanPS-ItalicMT"] = "Times-Italic";
  36386. t.TimesNewRomanPSMT = "Times-Roman";
  36387. t["TimesNewRomanPSMT-Bold"] = "Times-Bold";
  36388. t["TimesNewRomanPSMT-BoldItalic"] = "Times-BoldItalic";
  36389. t["TimesNewRomanPSMT-Italic"] = "Times-Italic";
  36390. });
  36391. exports.getStdFontMap = getStdFontMap;
  36392. const getFontNameToFileMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36393. t.Courier = "FoxitFixed.pfb";
  36394. t["Courier-Bold"] = "FoxitFixedBold.pfb";
  36395. t["Courier-BoldOblique"] = "FoxitFixedBoldItalic.pfb";
  36396. t["Courier-Oblique"] = "FoxitFixedItalic.pfb";
  36397. t.Helvetica = "FoxitSans.pfb";
  36398. t["Helvetica-Bold"] = "FoxitSansBold.pfb";
  36399. t["Helvetica-BoldOblique"] = "FoxitSansBoldItalic.pfb";
  36400. t["Helvetica-Oblique"] = "FoxitSansItalic.pfb";
  36401. t["Times-Roman"] = "FoxitSerif.pfb";
  36402. t["Times-Bold"] = "FoxitSerifBold.pfb";
  36403. t["Times-BoldItalic"] = "FoxitSerifBoldItalic.pfb";
  36404. t["Times-Italic"] = "FoxitSerifItalic.pfb";
  36405. t.Symbol = "FoxitSymbol.pfb";
  36406. t.ZapfDingbats = "FoxitDingbats.pfb";
  36407. t["LiberationSans-Regular"] = "LiberationSans-Regular.ttf";
  36408. t["LiberationSans-Bold"] = "LiberationSans-Bold.ttf";
  36409. t["LiberationSans-Italic"] = "LiberationSans-Italic.ttf";
  36410. t["LiberationSans-BoldItalic"] = "LiberationSans-BoldItalic.ttf";
  36411. });
  36412. exports.getFontNameToFileMap = getFontNameToFileMap;
  36413. const getNonStdFontMap = (0, _core_utils.getLookupTableFactory)(function (t) {
  36414. t.Calibri = "Helvetica";
  36415. t["Calibri-Bold"] = "Helvetica-Bold";
  36416. t["Calibri-BoldItalic"] = "Helvetica-BoldOblique";
  36417. t["Calibri-Italic"] = "Helvetica-Oblique";
  36418. t.CenturyGothic = "Helvetica";
  36419. t["CenturyGothic-Bold"] = "Helvetica-Bold";
  36420. t["CenturyGothic-BoldItalic"] = "Helvetica-BoldOblique";
  36421. t["CenturyGothic-Italic"] = "Helvetica-Oblique";
  36422. t.ComicSansMS = "Comic Sans MS";
  36423. t["ComicSansMS-Bold"] = "Comic Sans MS-Bold";
  36424. t["ComicSansMS-BoldItalic"] = "Comic Sans MS-BoldItalic";
  36425. t["ComicSansMS-Italic"] = "Comic Sans MS-Italic";
  36426. t["ItcSymbol-Bold"] = "Helvetica-Bold";
  36427. t["ItcSymbol-BoldItalic"] = "Helvetica-BoldOblique";
  36428. t["ItcSymbol-Book"] = "Helvetica";
  36429. t["ItcSymbol-BookItalic"] = "Helvetica-Oblique";
  36430. t["ItcSymbol-Medium"] = "Helvetica";
  36431. t["ItcSymbol-MediumItalic"] = "Helvetica-Oblique";
  36432. t.LucidaConsole = "Courier";
  36433. t["LucidaConsole-Bold"] = "Courier-Bold";
  36434. t["LucidaConsole-BoldItalic"] = "Courier-BoldOblique";
  36435. t["LucidaConsole-Italic"] = "Courier-Oblique";
  36436. t["LucidaSans-Demi"] = "Helvetica-Bold";
  36437. t["MS-Gothic"] = "MS Gothic";
  36438. t["MS-Gothic-Bold"] = "MS Gothic-Bold";
  36439. t["MS-Gothic-BoldItalic"] = "MS Gothic-BoldItalic";
  36440. t["MS-Gothic-Italic"] = "MS Gothic-Italic";
  36441. t["MS-Mincho"] = "MS Mincho";
  36442. t["MS-Mincho-Bold"] = "MS Mincho-Bold";
  36443. t["MS-Mincho-BoldItalic"] = "MS Mincho-BoldItalic";
  36444. t["MS-Mincho-Italic"] = "MS Mincho-Italic";
  36445. t["MS-PGothic"] = "MS PGothic";
  36446. t["MS-PGothic-Bold"] = "MS PGothic-Bold";
  36447. t["MS-PGothic-BoldItalic"] = "MS PGothic-BoldItalic";
  36448. t["MS-PGothic-Italic"] = "MS PGothic-Italic";
  36449. t["MS-PMincho"] = "MS PMincho";
  36450. t["MS-PMincho-Bold"] = "MS PMincho-Bold";
  36451. t["MS-PMincho-BoldItalic"] = "MS PMincho-BoldItalic";
  36452. t["MS-PMincho-Italic"] = "MS PMincho-Italic";
  36453. t.NuptialScript = "Times-Italic";
  36454. t.SegoeUISymbol = "Helvetica";
  36455. t.Wingdings = "ZapfDingbats";
  36456. t["Wingdings-Regular"] = "ZapfDingbats";
  36457. });
  36458. exports.getNonStdFontMap = getNonStdFontMap;
  36459. const getSerifFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36460. t["Adobe Jenson"] = true;
  36461. t["Adobe Text"] = true;
  36462. t.Albertus = true;
  36463. t.Aldus = true;
  36464. t.Alexandria = true;
  36465. t.Algerian = true;
  36466. t["American Typewriter"] = true;
  36467. t.Antiqua = true;
  36468. t.Apex = true;
  36469. t.Arno = true;
  36470. t.Aster = true;
  36471. t.Aurora = true;
  36472. t.Baskerville = true;
  36473. t.Bell = true;
  36474. t.Bembo = true;
  36475. t["Bembo Schoolbook"] = true;
  36476. t.Benguiat = true;
  36477. t["Berkeley Old Style"] = true;
  36478. t["Bernhard Modern"] = true;
  36479. t["Berthold City"] = true;
  36480. t.Bodoni = true;
  36481. t["Bauer Bodoni"] = true;
  36482. t["Book Antiqua"] = true;
  36483. t.Bookman = true;
  36484. t["Bordeaux Roman"] = true;
  36485. t["Californian FB"] = true;
  36486. t.Calisto = true;
  36487. t.Calvert = true;
  36488. t.Capitals = true;
  36489. t.Cambria = true;
  36490. t.Cartier = true;
  36491. t.Caslon = true;
  36492. t.Catull = true;
  36493. t.Centaur = true;
  36494. t["Century Old Style"] = true;
  36495. t["Century Schoolbook"] = true;
  36496. t.Chaparral = true;
  36497. t["Charis SIL"] = true;
  36498. t.Cheltenham = true;
  36499. t["Cholla Slab"] = true;
  36500. t.Clarendon = true;
  36501. t.Clearface = true;
  36502. t.Cochin = true;
  36503. t.Colonna = true;
  36504. t["Computer Modern"] = true;
  36505. t["Concrete Roman"] = true;
  36506. t.Constantia = true;
  36507. t["Cooper Black"] = true;
  36508. t.Corona = true;
  36509. t.Ecotype = true;
  36510. t.Egyptienne = true;
  36511. t.Elephant = true;
  36512. t.Excelsior = true;
  36513. t.Fairfield = true;
  36514. t["FF Scala"] = true;
  36515. t.Folkard = true;
  36516. t.Footlight = true;
  36517. t.FreeSerif = true;
  36518. t["Friz Quadrata"] = true;
  36519. t.Garamond = true;
  36520. t.Gentium = true;
  36521. t.Georgia = true;
  36522. t.Gloucester = true;
  36523. t["Goudy Old Style"] = true;
  36524. t["Goudy Schoolbook"] = true;
  36525. t["Goudy Pro Font"] = true;
  36526. t.Granjon = true;
  36527. t["Guardian Egyptian"] = true;
  36528. t.Heather = true;
  36529. t.Hercules = true;
  36530. t["High Tower Text"] = true;
  36531. t.Hiroshige = true;
  36532. t["Hoefler Text"] = true;
  36533. t["Humana Serif"] = true;
  36534. t.Imprint = true;
  36535. t["Ionic No. 5"] = true;
  36536. t.Janson = true;
  36537. t.Joanna = true;
  36538. t.Korinna = true;
  36539. t.Lexicon = true;
  36540. t.LiberationSerif = true;
  36541. t["Liberation Serif"] = true;
  36542. t["Linux Libertine"] = true;
  36543. t.Literaturnaya = true;
  36544. t.Lucida = true;
  36545. t["Lucida Bright"] = true;
  36546. t.Melior = true;
  36547. t.Memphis = true;
  36548. t.Miller = true;
  36549. t.Minion = true;
  36550. t.Modern = true;
  36551. t["Mona Lisa"] = true;
  36552. t["Mrs Eaves"] = true;
  36553. t["MS Serif"] = true;
  36554. t["Museo Slab"] = true;
  36555. t["New York"] = true;
  36556. t["Nimbus Roman"] = true;
  36557. t["NPS Rawlinson Roadway"] = true;
  36558. t.NuptialScript = true;
  36559. t.Palatino = true;
  36560. t.Perpetua = true;
  36561. t.Plantin = true;
  36562. t["Plantin Schoolbook"] = true;
  36563. t.Playbill = true;
  36564. t["Poor Richard"] = true;
  36565. t["Rawlinson Roadway"] = true;
  36566. t.Renault = true;
  36567. t.Requiem = true;
  36568. t.Rockwell = true;
  36569. t.Roman = true;
  36570. t["Rotis Serif"] = true;
  36571. t.Sabon = true;
  36572. t.Scala = true;
  36573. t.Seagull = true;
  36574. t.Sistina = true;
  36575. t.Souvenir = true;
  36576. t.STIX = true;
  36577. t["Stone Informal"] = true;
  36578. t["Stone Serif"] = true;
  36579. t.Sylfaen = true;
  36580. t.Times = true;
  36581. t.Trajan = true;
  36582. t["Trinité"] = true;
  36583. t["Trump Mediaeval"] = true;
  36584. t.Utopia = true;
  36585. t["Vale Type"] = true;
  36586. t["Bitstream Vera"] = true;
  36587. t["Vera Serif"] = true;
  36588. t.Versailles = true;
  36589. t.Wanted = true;
  36590. t.Weiss = true;
  36591. t["Wide Latin"] = true;
  36592. t.Windsor = true;
  36593. t.XITS = true;
  36594. });
  36595. exports.getSerifFonts = getSerifFonts;
  36596. const getSymbolsFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36597. t.Dingbats = true;
  36598. t.Symbol = true;
  36599. t.ZapfDingbats = true;
  36600. });
  36601. exports.getSymbolsFonts = getSymbolsFonts;
  36602. const getGlyphMapForStandardFonts = (0, _core_utils.getLookupTableFactory)(function (t) {
  36603. t[2] = 10;
  36604. t[3] = 32;
  36605. t[4] = 33;
  36606. t[5] = 34;
  36607. t[6] = 35;
  36608. t[7] = 36;
  36609. t[8] = 37;
  36610. t[9] = 38;
  36611. t[10] = 39;
  36612. t[11] = 40;
  36613. t[12] = 41;
  36614. t[13] = 42;
  36615. t[14] = 43;
  36616. t[15] = 44;
  36617. t[16] = 45;
  36618. t[17] = 46;
  36619. t[18] = 47;
  36620. t[19] = 48;
  36621. t[20] = 49;
  36622. t[21] = 50;
  36623. t[22] = 51;
  36624. t[23] = 52;
  36625. t[24] = 53;
  36626. t[25] = 54;
  36627. t[26] = 55;
  36628. t[27] = 56;
  36629. t[28] = 57;
  36630. t[29] = 58;
  36631. t[30] = 894;
  36632. t[31] = 60;
  36633. t[32] = 61;
  36634. t[33] = 62;
  36635. t[34] = 63;
  36636. t[35] = 64;
  36637. t[36] = 65;
  36638. t[37] = 66;
  36639. t[38] = 67;
  36640. t[39] = 68;
  36641. t[40] = 69;
  36642. t[41] = 70;
  36643. t[42] = 71;
  36644. t[43] = 72;
  36645. t[44] = 73;
  36646. t[45] = 74;
  36647. t[46] = 75;
  36648. t[47] = 76;
  36649. t[48] = 77;
  36650. t[49] = 78;
  36651. t[50] = 79;
  36652. t[51] = 80;
  36653. t[52] = 81;
  36654. t[53] = 82;
  36655. t[54] = 83;
  36656. t[55] = 84;
  36657. t[56] = 85;
  36658. t[57] = 86;
  36659. t[58] = 87;
  36660. t[59] = 88;
  36661. t[60] = 89;
  36662. t[61] = 90;
  36663. t[62] = 91;
  36664. t[63] = 92;
  36665. t[64] = 93;
  36666. t[65] = 94;
  36667. t[66] = 95;
  36668. t[67] = 96;
  36669. t[68] = 97;
  36670. t[69] = 98;
  36671. t[70] = 99;
  36672. t[71] = 100;
  36673. t[72] = 101;
  36674. t[73] = 102;
  36675. t[74] = 103;
  36676. t[75] = 104;
  36677. t[76] = 105;
  36678. t[77] = 106;
  36679. t[78] = 107;
  36680. t[79] = 108;
  36681. t[80] = 109;
  36682. t[81] = 110;
  36683. t[82] = 111;
  36684. t[83] = 112;
  36685. t[84] = 113;
  36686. t[85] = 114;
  36687. t[86] = 115;
  36688. t[87] = 116;
  36689. t[88] = 117;
  36690. t[89] = 118;
  36691. t[90] = 119;
  36692. t[91] = 120;
  36693. t[92] = 121;
  36694. t[93] = 122;
  36695. t[94] = 123;
  36696. t[95] = 124;
  36697. t[96] = 125;
  36698. t[97] = 126;
  36699. t[98] = 196;
  36700. t[99] = 197;
  36701. t[100] = 199;
  36702. t[101] = 201;
  36703. t[102] = 209;
  36704. t[103] = 214;
  36705. t[104] = 220;
  36706. t[105] = 225;
  36707. t[106] = 224;
  36708. t[107] = 226;
  36709. t[108] = 228;
  36710. t[109] = 227;
  36711. t[110] = 229;
  36712. t[111] = 231;
  36713. t[112] = 233;
  36714. t[113] = 232;
  36715. t[114] = 234;
  36716. t[115] = 235;
  36717. t[116] = 237;
  36718. t[117] = 236;
  36719. t[118] = 238;
  36720. t[119] = 239;
  36721. t[120] = 241;
  36722. t[121] = 243;
  36723. t[122] = 242;
  36724. t[123] = 244;
  36725. t[124] = 246;
  36726. t[125] = 245;
  36727. t[126] = 250;
  36728. t[127] = 249;
  36729. t[128] = 251;
  36730. t[129] = 252;
  36731. t[130] = 8224;
  36732. t[131] = 176;
  36733. t[132] = 162;
  36734. t[133] = 163;
  36735. t[134] = 167;
  36736. t[135] = 8226;
  36737. t[136] = 182;
  36738. t[137] = 223;
  36739. t[138] = 174;
  36740. t[139] = 169;
  36741. t[140] = 8482;
  36742. t[141] = 180;
  36743. t[142] = 168;
  36744. t[143] = 8800;
  36745. t[144] = 198;
  36746. t[145] = 216;
  36747. t[146] = 8734;
  36748. t[147] = 177;
  36749. t[148] = 8804;
  36750. t[149] = 8805;
  36751. t[150] = 165;
  36752. t[151] = 181;
  36753. t[152] = 8706;
  36754. t[153] = 8721;
  36755. t[154] = 8719;
  36756. t[156] = 8747;
  36757. t[157] = 170;
  36758. t[158] = 186;
  36759. t[159] = 8486;
  36760. t[160] = 230;
  36761. t[161] = 248;
  36762. t[162] = 191;
  36763. t[163] = 161;
  36764. t[164] = 172;
  36765. t[165] = 8730;
  36766. t[166] = 402;
  36767. t[167] = 8776;
  36768. t[168] = 8710;
  36769. t[169] = 171;
  36770. t[170] = 187;
  36771. t[171] = 8230;
  36772. t[200] = 193;
  36773. t[203] = 205;
  36774. t[210] = 218;
  36775. t[223] = 711;
  36776. t[224] = 321;
  36777. t[225] = 322;
  36778. t[226] = 352;
  36779. t[227] = 353;
  36780. t[228] = 381;
  36781. t[229] = 382;
  36782. t[233] = 221;
  36783. t[234] = 253;
  36784. t[252] = 263;
  36785. t[253] = 268;
  36786. t[254] = 269;
  36787. t[258] = 258;
  36788. t[260] = 260;
  36789. t[261] = 261;
  36790. t[265] = 280;
  36791. t[266] = 281;
  36792. t[267] = 282;
  36793. t[268] = 283;
  36794. t[269] = 313;
  36795. t[275] = 323;
  36796. t[276] = 324;
  36797. t[278] = 328;
  36798. t[283] = 344;
  36799. t[284] = 345;
  36800. t[285] = 346;
  36801. t[286] = 347;
  36802. t[292] = 367;
  36803. t[295] = 377;
  36804. t[296] = 378;
  36805. t[298] = 380;
  36806. t[305] = 963;
  36807. t[306] = 964;
  36808. t[307] = 966;
  36809. t[308] = 8215;
  36810. t[309] = 8252;
  36811. t[310] = 8319;
  36812. t[311] = 8359;
  36813. t[312] = 8592;
  36814. t[313] = 8593;
  36815. t[337] = 9552;
  36816. t[493] = 1039;
  36817. t[494] = 1040;
  36818. t[705] = 1524;
  36819. t[706] = 8362;
  36820. t[710] = 64288;
  36821. t[711] = 64298;
  36822. t[759] = 1617;
  36823. t[761] = 1776;
  36824. t[763] = 1778;
  36825. t[775] = 1652;
  36826. t[777] = 1764;
  36827. t[778] = 1780;
  36828. t[779] = 1781;
  36829. t[780] = 1782;
  36830. t[782] = 771;
  36831. t[783] = 64726;
  36832. t[786] = 8363;
  36833. t[788] = 8532;
  36834. t[790] = 768;
  36835. t[791] = 769;
  36836. t[792] = 768;
  36837. t[795] = 803;
  36838. t[797] = 64336;
  36839. t[798] = 64337;
  36840. t[799] = 64342;
  36841. t[800] = 64343;
  36842. t[801] = 64344;
  36843. t[802] = 64345;
  36844. t[803] = 64362;
  36845. t[804] = 64363;
  36846. t[805] = 64364;
  36847. t[2424] = 7821;
  36848. t[2425] = 7822;
  36849. t[2426] = 7823;
  36850. t[2427] = 7824;
  36851. t[2428] = 7825;
  36852. t[2429] = 7826;
  36853. t[2430] = 7827;
  36854. t[2433] = 7682;
  36855. t[2678] = 8045;
  36856. t[2679] = 8046;
  36857. t[2830] = 1552;
  36858. t[2838] = 686;
  36859. t[2840] = 751;
  36860. t[2842] = 753;
  36861. t[2843] = 754;
  36862. t[2844] = 755;
  36863. t[2846] = 757;
  36864. t[2856] = 767;
  36865. t[2857] = 848;
  36866. t[2858] = 849;
  36867. t[2862] = 853;
  36868. t[2863] = 854;
  36869. t[2864] = 855;
  36870. t[2865] = 861;
  36871. t[2866] = 862;
  36872. t[2906] = 7460;
  36873. t[2908] = 7462;
  36874. t[2909] = 7463;
  36875. t[2910] = 7464;
  36876. t[2912] = 7466;
  36877. t[2913] = 7467;
  36878. t[2914] = 7468;
  36879. t[2916] = 7470;
  36880. t[2917] = 7471;
  36881. t[2918] = 7472;
  36882. t[2920] = 7474;
  36883. t[2921] = 7475;
  36884. t[2922] = 7476;
  36885. t[2924] = 7478;
  36886. t[2925] = 7479;
  36887. t[2926] = 7480;
  36888. t[2928] = 7482;
  36889. t[2929] = 7483;
  36890. t[2930] = 7484;
  36891. t[2932] = 7486;
  36892. t[2933] = 7487;
  36893. t[2934] = 7488;
  36894. t[2936] = 7490;
  36895. t[2937] = 7491;
  36896. t[2938] = 7492;
  36897. t[2940] = 7494;
  36898. t[2941] = 7495;
  36899. t[2942] = 7496;
  36900. t[2944] = 7498;
  36901. t[2946] = 7500;
  36902. t[2948] = 7502;
  36903. t[2950] = 7504;
  36904. t[2951] = 7505;
  36905. t[2952] = 7506;
  36906. t[2954] = 7508;
  36907. t[2955] = 7509;
  36908. t[2956] = 7510;
  36909. t[2958] = 7512;
  36910. t[2959] = 7513;
  36911. t[2960] = 7514;
  36912. t[2962] = 7516;
  36913. t[2963] = 7517;
  36914. t[2964] = 7518;
  36915. t[2966] = 7520;
  36916. t[2967] = 7521;
  36917. t[2968] = 7522;
  36918. t[2970] = 7524;
  36919. t[2971] = 7525;
  36920. t[2972] = 7526;
  36921. t[2974] = 7528;
  36922. t[2975] = 7529;
  36923. t[2976] = 7530;
  36924. t[2978] = 1537;
  36925. t[2979] = 1538;
  36926. t[2980] = 1539;
  36927. t[2982] = 1549;
  36928. t[2983] = 1551;
  36929. t[2984] = 1552;
  36930. t[2986] = 1554;
  36931. t[2987] = 1555;
  36932. t[2988] = 1556;
  36933. t[2990] = 1623;
  36934. t[2991] = 1624;
  36935. t[2995] = 1775;
  36936. t[2999] = 1791;
  36937. t[3002] = 64290;
  36938. t[3003] = 64291;
  36939. t[3004] = 64292;
  36940. t[3006] = 64294;
  36941. t[3007] = 64295;
  36942. t[3008] = 64296;
  36943. t[3011] = 1900;
  36944. t[3014] = 8223;
  36945. t[3015] = 8244;
  36946. t[3017] = 7532;
  36947. t[3018] = 7533;
  36948. t[3019] = 7534;
  36949. t[3075] = 7590;
  36950. t[3076] = 7591;
  36951. t[3079] = 7594;
  36952. t[3080] = 7595;
  36953. t[3083] = 7598;
  36954. t[3084] = 7599;
  36955. t[3087] = 7602;
  36956. t[3088] = 7603;
  36957. t[3091] = 7606;
  36958. t[3092] = 7607;
  36959. t[3095] = 7610;
  36960. t[3096] = 7611;
  36961. t[3099] = 7614;
  36962. t[3100] = 7615;
  36963. t[3103] = 7618;
  36964. t[3104] = 7619;
  36965. t[3107] = 8337;
  36966. t[3108] = 8338;
  36967. t[3116] = 1884;
  36968. t[3119] = 1885;
  36969. t[3120] = 1885;
  36970. t[3123] = 1886;
  36971. t[3124] = 1886;
  36972. t[3127] = 1887;
  36973. t[3128] = 1887;
  36974. t[3131] = 1888;
  36975. t[3132] = 1888;
  36976. t[3135] = 1889;
  36977. t[3136] = 1889;
  36978. t[3139] = 1890;
  36979. t[3140] = 1890;
  36980. t[3143] = 1891;
  36981. t[3144] = 1891;
  36982. t[3147] = 1892;
  36983. t[3148] = 1892;
  36984. t[3153] = 580;
  36985. t[3154] = 581;
  36986. t[3157] = 584;
  36987. t[3158] = 585;
  36988. t[3161] = 588;
  36989. t[3162] = 589;
  36990. t[3165] = 891;
  36991. t[3166] = 892;
  36992. t[3169] = 1274;
  36993. t[3170] = 1275;
  36994. t[3173] = 1278;
  36995. t[3174] = 1279;
  36996. t[3181] = 7622;
  36997. t[3182] = 7623;
  36998. t[3282] = 11799;
  36999. t[3316] = 578;
  37000. t[3379] = 42785;
  37001. t[3393] = 1159;
  37002. t[3416] = 8377;
  37003. });
  37004. exports.getGlyphMapForStandardFonts = getGlyphMapForStandardFonts;
  37005. const getSupplementalGlyphMapForArialBlack = (0, _core_utils.getLookupTableFactory)(function (t) {
  37006. t[227] = 322;
  37007. t[264] = 261;
  37008. t[291] = 346;
  37009. });
  37010. exports.getSupplementalGlyphMapForArialBlack = getSupplementalGlyphMapForArialBlack;
  37011. const getSupplementalGlyphMapForCalibri = (0, _core_utils.getLookupTableFactory)(function (t) {
  37012. t[1] = 32;
  37013. t[4] = 65;
  37014. t[6] = 193;
  37015. t[17] = 66;
  37016. t[18] = 67;
  37017. t[21] = 268;
  37018. t[24] = 68;
  37019. t[28] = 69;
  37020. t[30] = 201;
  37021. t[32] = 282;
  37022. t[38] = 70;
  37023. t[39] = 71;
  37024. t[44] = 72;
  37025. t[47] = 73;
  37026. t[49] = 205;
  37027. t[58] = 74;
  37028. t[60] = 75;
  37029. t[62] = 76;
  37030. t[68] = 77;
  37031. t[69] = 78;
  37032. t[75] = 79;
  37033. t[87] = 80;
  37034. t[89] = 81;
  37035. t[90] = 82;
  37036. t[92] = 344;
  37037. t[94] = 83;
  37038. t[97] = 352;
  37039. t[100] = 84;
  37040. t[104] = 85;
  37041. t[115] = 86;
  37042. t[116] = 87;
  37043. t[121] = 88;
  37044. t[122] = 89;
  37045. t[124] = 221;
  37046. t[127] = 90;
  37047. t[129] = 381;
  37048. t[258] = 97;
  37049. t[260] = 225;
  37050. t[268] = 261;
  37051. t[271] = 98;
  37052. t[272] = 99;
  37053. t[273] = 263;
  37054. t[275] = 269;
  37055. t[282] = 100;
  37056. t[286] = 101;
  37057. t[288] = 233;
  37058. t[290] = 283;
  37059. t[295] = 281;
  37060. t[296] = 102;
  37061. t[336] = 103;
  37062. t[346] = 104;
  37063. t[349] = 105;
  37064. t[351] = 237;
  37065. t[361] = 106;
  37066. t[364] = 107;
  37067. t[367] = 108;
  37068. t[371] = 322;
  37069. t[373] = 109;
  37070. t[374] = 110;
  37071. t[381] = 111;
  37072. t[383] = 243;
  37073. t[393] = 112;
  37074. t[395] = 113;
  37075. t[396] = 114;
  37076. t[398] = 345;
  37077. t[400] = 115;
  37078. t[401] = 347;
  37079. t[403] = 353;
  37080. t[410] = 116;
  37081. t[437] = 117;
  37082. t[448] = 118;
  37083. t[449] = 119;
  37084. t[454] = 120;
  37085. t[455] = 121;
  37086. t[457] = 253;
  37087. t[460] = 122;
  37088. t[462] = 382;
  37089. t[463] = 380;
  37090. t[853] = 44;
  37091. t[855] = 58;
  37092. t[856] = 46;
  37093. t[876] = 47;
  37094. t[878] = 45;
  37095. t[882] = 45;
  37096. t[894] = 40;
  37097. t[895] = 41;
  37098. t[896] = 91;
  37099. t[897] = 93;
  37100. t[923] = 64;
  37101. t[1004] = 48;
  37102. t[1005] = 49;
  37103. t[1006] = 50;
  37104. t[1007] = 51;
  37105. t[1008] = 52;
  37106. t[1009] = 53;
  37107. t[1010] = 54;
  37108. t[1011] = 55;
  37109. t[1012] = 56;
  37110. t[1013] = 57;
  37111. t[1081] = 37;
  37112. t[1085] = 43;
  37113. t[1086] = 45;
  37114. });
  37115. exports.getSupplementalGlyphMapForCalibri = getSupplementalGlyphMapForCalibri;
  37116. function getStandardFontName(name) {
  37117. const fontName = (0, _fonts_utils.normalizeFontName)(name);
  37118. const stdFontMap = getStdFontMap();
  37119. return stdFontMap[fontName];
  37120. }
  37121. /***/ }),
  37122. /* 48 */
  37123. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37124. Object.defineProperty(exports, "__esModule", ({
  37125. value: true
  37126. }));
  37127. exports.ToUnicodeMap = exports.IdentityToUnicodeMap = void 0;
  37128. var _util = __w_pdfjs_require__(2);
  37129. class ToUnicodeMap {
  37130. constructor(cmap = []) {
  37131. this._map = cmap;
  37132. }
  37133. get length() {
  37134. return this._map.length;
  37135. }
  37136. forEach(callback) {
  37137. for (const charCode in this._map) {
  37138. callback(charCode, this._map[charCode].charCodeAt(0));
  37139. }
  37140. }
  37141. has(i) {
  37142. return this._map[i] !== undefined;
  37143. }
  37144. get(i) {
  37145. return this._map[i];
  37146. }
  37147. charCodeOf(value) {
  37148. const map = this._map;
  37149. if (map.length <= 0x10000) {
  37150. return map.indexOf(value);
  37151. }
  37152. for (const charCode in map) {
  37153. if (map[charCode] === value) {
  37154. return charCode | 0;
  37155. }
  37156. }
  37157. return -1;
  37158. }
  37159. amend(map) {
  37160. for (const charCode in map) {
  37161. this._map[charCode] = map[charCode];
  37162. }
  37163. }
  37164. }
  37165. exports.ToUnicodeMap = ToUnicodeMap;
  37166. class IdentityToUnicodeMap {
  37167. constructor(firstChar, lastChar) {
  37168. this.firstChar = firstChar;
  37169. this.lastChar = lastChar;
  37170. }
  37171. get length() {
  37172. return this.lastChar + 1 - this.firstChar;
  37173. }
  37174. forEach(callback) {
  37175. for (let i = this.firstChar, ii = this.lastChar; i <= ii; i++) {
  37176. callback(i, i);
  37177. }
  37178. }
  37179. has(i) {
  37180. return this.firstChar <= i && i <= this.lastChar;
  37181. }
  37182. get(i) {
  37183. if (this.firstChar <= i && i <= this.lastChar) {
  37184. return String.fromCharCode(i);
  37185. }
  37186. return undefined;
  37187. }
  37188. charCodeOf(v) {
  37189. return Number.isInteger(v) && v >= this.firstChar && v <= this.lastChar ? v : -1;
  37190. }
  37191. amend(map) {
  37192. (0, _util.unreachable)("Should not call amend()");
  37193. }
  37194. }
  37195. exports.IdentityToUnicodeMap = IdentityToUnicodeMap;
  37196. /***/ }),
  37197. /* 49 */
  37198. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37199. Object.defineProperty(exports, "__esModule", ({
  37200. value: true
  37201. }));
  37202. exports.CFFFont = void 0;
  37203. var _cff_parser = __w_pdfjs_require__(45);
  37204. var _fonts_utils = __w_pdfjs_require__(18);
  37205. var _util = __w_pdfjs_require__(2);
  37206. class CFFFont {
  37207. constructor(file, properties) {
  37208. this.properties = properties;
  37209. const parser = new _cff_parser.CFFParser(file, properties, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  37210. this.cff = parser.parse();
  37211. this.cff.duplicateFirstGlyph();
  37212. const compiler = new _cff_parser.CFFCompiler(this.cff);
  37213. this.seacs = this.cff.seacs;
  37214. try {
  37215. this.data = compiler.compile();
  37216. } catch (e) {
  37217. (0, _util.warn)("Failed to compile font " + properties.loadedName);
  37218. this.data = file;
  37219. }
  37220. this._createBuiltInEncoding();
  37221. }
  37222. get numGlyphs() {
  37223. return this.cff.charStrings.count;
  37224. }
  37225. getCharset() {
  37226. return this.cff.charset.charset;
  37227. }
  37228. getGlyphMapping() {
  37229. const cff = this.cff;
  37230. const properties = this.properties;
  37231. const charsets = cff.charset.charset;
  37232. let charCodeToGlyphId;
  37233. let glyphId;
  37234. if (properties.composite) {
  37235. charCodeToGlyphId = Object.create(null);
  37236. let charCode;
  37237. if (cff.isCIDFont) {
  37238. for (glyphId = 0; glyphId < charsets.length; glyphId++) {
  37239. const cid = charsets[glyphId];
  37240. charCode = properties.cMap.charCodeOf(cid);
  37241. charCodeToGlyphId[charCode] = glyphId;
  37242. }
  37243. } else {
  37244. for (glyphId = 0; glyphId < cff.charStrings.count; glyphId++) {
  37245. charCode = properties.cMap.charCodeOf(glyphId);
  37246. charCodeToGlyphId[charCode] = glyphId;
  37247. }
  37248. }
  37249. return charCodeToGlyphId;
  37250. }
  37251. let encoding = cff.encoding ? cff.encoding.encoding : null;
  37252. if (properties.isInternalFont) {
  37253. encoding = properties.defaultEncoding;
  37254. }
  37255. charCodeToGlyphId = (0, _fonts_utils.type1FontGlyphMapping)(properties, encoding, charsets);
  37256. return charCodeToGlyphId;
  37257. }
  37258. hasGlyphId(id) {
  37259. return this.cff.hasGlyphId(id);
  37260. }
  37261. _createBuiltInEncoding() {
  37262. const {
  37263. charset,
  37264. encoding
  37265. } = this.cff;
  37266. if (!charset || !encoding) {
  37267. return;
  37268. }
  37269. const charsets = charset.charset,
  37270. encodings = encoding.encoding;
  37271. const map = [];
  37272. for (const charCode in encodings) {
  37273. const glyphId = encodings[charCode];
  37274. if (glyphId >= 0) {
  37275. const glyphName = charsets[glyphId];
  37276. if (glyphName) {
  37277. map[charCode] = glyphName;
  37278. }
  37279. }
  37280. }
  37281. if (map.length > 0) {
  37282. this.properties.builtInEncoding = map;
  37283. }
  37284. }
  37285. }
  37286. exports.CFFFont = CFFFont;
  37287. /***/ }),
  37288. /* 50 */
  37289. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  37290. Object.defineProperty(exports, "__esModule", ({
  37291. value: true
  37292. }));
  37293. exports.FontRendererFactory = void 0;
  37294. var _util = __w_pdfjs_require__(2);
  37295. var _cff_parser = __w_pdfjs_require__(45);
  37296. var _glyphlist = __w_pdfjs_require__(20);
  37297. var _encodings = __w_pdfjs_require__(19);
  37298. var _stream = __w_pdfjs_require__(10);
  37299. function getUint32(data, offset) {
  37300. return (data[offset] << 24 | data[offset + 1] << 16 | data[offset + 2] << 8 | data[offset + 3]) >>> 0;
  37301. }
  37302. function getUint16(data, offset) {
  37303. return data[offset] << 8 | data[offset + 1];
  37304. }
  37305. function getInt16(data, offset) {
  37306. return (data[offset] << 24 | data[offset + 1] << 16) >> 16;
  37307. }
  37308. function getInt8(data, offset) {
  37309. return data[offset] << 24 >> 24;
  37310. }
  37311. function getFloat214(data, offset) {
  37312. return getInt16(data, offset) / 16384;
  37313. }
  37314. function getSubroutineBias(subrs) {
  37315. const numSubrs = subrs.length;
  37316. let bias = 32768;
  37317. if (numSubrs < 1240) {
  37318. bias = 107;
  37319. } else if (numSubrs < 33900) {
  37320. bias = 1131;
  37321. }
  37322. return bias;
  37323. }
  37324. function parseCmap(data, start, end) {
  37325. const offset = getUint16(data, start + 2) === 1 ? getUint32(data, start + 8) : getUint32(data, start + 16);
  37326. const format = getUint16(data, start + offset);
  37327. let ranges, p, i;
  37328. if (format === 4) {
  37329. getUint16(data, start + offset + 2);
  37330. const segCount = getUint16(data, start + offset + 6) >> 1;
  37331. p = start + offset + 14;
  37332. ranges = [];
  37333. for (i = 0; i < segCount; i++, p += 2) {
  37334. ranges[i] = {
  37335. end: getUint16(data, p)
  37336. };
  37337. }
  37338. p += 2;
  37339. for (i = 0; i < segCount; i++, p += 2) {
  37340. ranges[i].start = getUint16(data, p);
  37341. }
  37342. for (i = 0; i < segCount; i++, p += 2) {
  37343. ranges[i].idDelta = getUint16(data, p);
  37344. }
  37345. for (i = 0; i < segCount; i++, p += 2) {
  37346. let idOffset = getUint16(data, p);
  37347. if (idOffset === 0) {
  37348. continue;
  37349. }
  37350. ranges[i].ids = [];
  37351. for (let j = 0, jj = ranges[i].end - ranges[i].start + 1; j < jj; j++) {
  37352. ranges[i].ids[j] = getUint16(data, p + idOffset);
  37353. idOffset += 2;
  37354. }
  37355. }
  37356. return ranges;
  37357. } else if (format === 12) {
  37358. const groups = getUint32(data, start + offset + 12);
  37359. p = start + offset + 16;
  37360. ranges = [];
  37361. for (i = 0; i < groups; i++) {
  37362. start = getUint32(data, p);
  37363. ranges.push({
  37364. start,
  37365. end: getUint32(data, p + 4),
  37366. idDelta: getUint32(data, p + 8) - start
  37367. });
  37368. p += 12;
  37369. }
  37370. return ranges;
  37371. }
  37372. throw new _util.FormatError(`unsupported cmap: ${format}`);
  37373. }
  37374. function parseCff(data, start, end, seacAnalysisEnabled) {
  37375. const properties = {};
  37376. const parser = new _cff_parser.CFFParser(new _stream.Stream(data, start, end - start), properties, seacAnalysisEnabled);
  37377. const cff = parser.parse();
  37378. return {
  37379. glyphs: cff.charStrings.objects,
  37380. subrs: cff.topDict.privateDict && cff.topDict.privateDict.subrsIndex && cff.topDict.privateDict.subrsIndex.objects,
  37381. gsubrs: cff.globalSubrIndex && cff.globalSubrIndex.objects,
  37382. isCFFCIDFont: cff.isCIDFont,
  37383. fdSelect: cff.fdSelect,
  37384. fdArray: cff.fdArray
  37385. };
  37386. }
  37387. function parseGlyfTable(glyf, loca, isGlyphLocationsLong) {
  37388. let itemSize, itemDecode;
  37389. if (isGlyphLocationsLong) {
  37390. itemSize = 4;
  37391. itemDecode = getUint32;
  37392. } else {
  37393. itemSize = 2;
  37394. itemDecode = (data, offset) => 2 * getUint16(data, offset);
  37395. }
  37396. const glyphs = [];
  37397. let startOffset = itemDecode(loca, 0);
  37398. for (let j = itemSize; j < loca.length; j += itemSize) {
  37399. const endOffset = itemDecode(loca, j);
  37400. glyphs.push(glyf.subarray(startOffset, endOffset));
  37401. startOffset = endOffset;
  37402. }
  37403. return glyphs;
  37404. }
  37405. function lookupCmap(ranges, unicode) {
  37406. const code = unicode.codePointAt(0);
  37407. let gid = 0,
  37408. l = 0,
  37409. r = ranges.length - 1;
  37410. while (l < r) {
  37411. const c = l + r + 1 >> 1;
  37412. if (code < ranges[c].start) {
  37413. r = c - 1;
  37414. } else {
  37415. l = c;
  37416. }
  37417. }
  37418. if (ranges[l].start <= code && code <= ranges[l].end) {
  37419. gid = ranges[l].idDelta + (ranges[l].ids ? ranges[l].ids[code - ranges[l].start] : code) & 0xffff;
  37420. }
  37421. return {
  37422. charCode: code,
  37423. glyphId: gid
  37424. };
  37425. }
  37426. function compileGlyf(code, cmds, font) {
  37427. function moveTo(x, y) {
  37428. cmds.push({
  37429. cmd: "moveTo",
  37430. args: [x, y]
  37431. });
  37432. }
  37433. function lineTo(x, y) {
  37434. cmds.push({
  37435. cmd: "lineTo",
  37436. args: [x, y]
  37437. });
  37438. }
  37439. function quadraticCurveTo(xa, ya, x, y) {
  37440. cmds.push({
  37441. cmd: "quadraticCurveTo",
  37442. args: [xa, ya, x, y]
  37443. });
  37444. }
  37445. let i = 0;
  37446. const numberOfContours = getInt16(code, i);
  37447. let flags;
  37448. let x = 0,
  37449. y = 0;
  37450. i += 10;
  37451. if (numberOfContours < 0) {
  37452. do {
  37453. flags = getUint16(code, i);
  37454. const glyphIndex = getUint16(code, i + 2);
  37455. i += 4;
  37456. let arg1, arg2;
  37457. if (flags & 0x01) {
  37458. if (flags & 0x02) {
  37459. arg1 = getInt16(code, i);
  37460. arg2 = getInt16(code, i + 2);
  37461. } else {
  37462. arg1 = getUint16(code, i);
  37463. arg2 = getUint16(code, i + 2);
  37464. }
  37465. i += 4;
  37466. } else {
  37467. if (flags & 0x02) {
  37468. arg1 = getInt8(code, i++);
  37469. arg2 = getInt8(code, i++);
  37470. } else {
  37471. arg1 = code[i++];
  37472. arg2 = code[i++];
  37473. }
  37474. }
  37475. if (flags & 0x02) {
  37476. x = arg1;
  37477. y = arg2;
  37478. } else {
  37479. x = 0;
  37480. y = 0;
  37481. }
  37482. let scaleX = 1,
  37483. scaleY = 1,
  37484. scale01 = 0,
  37485. scale10 = 0;
  37486. if (flags & 0x08) {
  37487. scaleX = scaleY = getFloat214(code, i);
  37488. i += 2;
  37489. } else if (flags & 0x40) {
  37490. scaleX = getFloat214(code, i);
  37491. scaleY = getFloat214(code, i + 2);
  37492. i += 4;
  37493. } else if (flags & 0x80) {
  37494. scaleX = getFloat214(code, i);
  37495. scale01 = getFloat214(code, i + 2);
  37496. scale10 = getFloat214(code, i + 4);
  37497. scaleY = getFloat214(code, i + 6);
  37498. i += 8;
  37499. }
  37500. const subglyph = font.glyphs[glyphIndex];
  37501. if (subglyph) {
  37502. cmds.push({
  37503. cmd: "save"
  37504. }, {
  37505. cmd: "transform",
  37506. args: [scaleX, scale01, scale10, scaleY, x, y]
  37507. });
  37508. if (!(flags & 0x02)) {}
  37509. compileGlyf(subglyph, cmds, font);
  37510. cmds.push({
  37511. cmd: "restore"
  37512. });
  37513. }
  37514. } while (flags & 0x20);
  37515. } else {
  37516. const endPtsOfContours = [];
  37517. let j, jj;
  37518. for (j = 0; j < numberOfContours; j++) {
  37519. endPtsOfContours.push(getUint16(code, i));
  37520. i += 2;
  37521. }
  37522. const instructionLength = getUint16(code, i);
  37523. i += 2 + instructionLength;
  37524. const numberOfPoints = endPtsOfContours[endPtsOfContours.length - 1] + 1;
  37525. const points = [];
  37526. while (points.length < numberOfPoints) {
  37527. flags = code[i++];
  37528. let repeat = 1;
  37529. if (flags & 0x08) {
  37530. repeat += code[i++];
  37531. }
  37532. while (repeat-- > 0) {
  37533. points.push({
  37534. flags
  37535. });
  37536. }
  37537. }
  37538. for (j = 0; j < numberOfPoints; j++) {
  37539. switch (points[j].flags & 0x12) {
  37540. case 0x00:
  37541. x += getInt16(code, i);
  37542. i += 2;
  37543. break;
  37544. case 0x02:
  37545. x -= code[i++];
  37546. break;
  37547. case 0x12:
  37548. x += code[i++];
  37549. break;
  37550. }
  37551. points[j].x = x;
  37552. }
  37553. for (j = 0; j < numberOfPoints; j++) {
  37554. switch (points[j].flags & 0x24) {
  37555. case 0x00:
  37556. y += getInt16(code, i);
  37557. i += 2;
  37558. break;
  37559. case 0x04:
  37560. y -= code[i++];
  37561. break;
  37562. case 0x24:
  37563. y += code[i++];
  37564. break;
  37565. }
  37566. points[j].y = y;
  37567. }
  37568. let startPoint = 0;
  37569. for (i = 0; i < numberOfContours; i++) {
  37570. const endPoint = endPtsOfContours[i];
  37571. const contour = points.slice(startPoint, endPoint + 1);
  37572. if (contour[0].flags & 1) {
  37573. contour.push(contour[0]);
  37574. } else if (contour[contour.length - 1].flags & 1) {
  37575. contour.unshift(contour[contour.length - 1]);
  37576. } else {
  37577. const p = {
  37578. flags: 1,
  37579. x: (contour[0].x + contour[contour.length - 1].x) / 2,
  37580. y: (contour[0].y + contour[contour.length - 1].y) / 2
  37581. };
  37582. contour.unshift(p);
  37583. contour.push(p);
  37584. }
  37585. moveTo(contour[0].x, contour[0].y);
  37586. for (j = 1, jj = contour.length; j < jj; j++) {
  37587. if (contour[j].flags & 1) {
  37588. lineTo(contour[j].x, contour[j].y);
  37589. } else if (contour[j + 1].flags & 1) {
  37590. quadraticCurveTo(contour[j].x, contour[j].y, contour[j + 1].x, contour[j + 1].y);
  37591. j++;
  37592. } else {
  37593. quadraticCurveTo(contour[j].x, contour[j].y, (contour[j].x + contour[j + 1].x) / 2, (contour[j].y + contour[j + 1].y) / 2);
  37594. }
  37595. }
  37596. startPoint = endPoint + 1;
  37597. }
  37598. }
  37599. }
  37600. function compileCharString(charStringCode, cmds, font, glyphId) {
  37601. function moveTo(x, y) {
  37602. cmds.push({
  37603. cmd: "moveTo",
  37604. args: [x, y]
  37605. });
  37606. }
  37607. function lineTo(x, y) {
  37608. cmds.push({
  37609. cmd: "lineTo",
  37610. args: [x, y]
  37611. });
  37612. }
  37613. function bezierCurveTo(x1, y1, x2, y2, x, y) {
  37614. cmds.push({
  37615. cmd: "bezierCurveTo",
  37616. args: [x1, y1, x2, y2, x, y]
  37617. });
  37618. }
  37619. const stack = [];
  37620. let x = 0,
  37621. y = 0;
  37622. let stems = 0;
  37623. function parse(code) {
  37624. let i = 0;
  37625. while (i < code.length) {
  37626. let stackClean = false;
  37627. let v = code[i++];
  37628. let xa, xb, ya, yb, y1, y2, y3, n, subrCode;
  37629. switch (v) {
  37630. case 1:
  37631. stems += stack.length >> 1;
  37632. stackClean = true;
  37633. break;
  37634. case 3:
  37635. stems += stack.length >> 1;
  37636. stackClean = true;
  37637. break;
  37638. case 4:
  37639. y += stack.pop();
  37640. moveTo(x, y);
  37641. stackClean = true;
  37642. break;
  37643. case 5:
  37644. while (stack.length > 0) {
  37645. x += stack.shift();
  37646. y += stack.shift();
  37647. lineTo(x, y);
  37648. }
  37649. break;
  37650. case 6:
  37651. while (stack.length > 0) {
  37652. x += stack.shift();
  37653. lineTo(x, y);
  37654. if (stack.length === 0) {
  37655. break;
  37656. }
  37657. y += stack.shift();
  37658. lineTo(x, y);
  37659. }
  37660. break;
  37661. case 7:
  37662. while (stack.length > 0) {
  37663. y += stack.shift();
  37664. lineTo(x, y);
  37665. if (stack.length === 0) {
  37666. break;
  37667. }
  37668. x += stack.shift();
  37669. lineTo(x, y);
  37670. }
  37671. break;
  37672. case 8:
  37673. while (stack.length > 0) {
  37674. xa = x + stack.shift();
  37675. ya = y + stack.shift();
  37676. xb = xa + stack.shift();
  37677. yb = ya + stack.shift();
  37678. x = xb + stack.shift();
  37679. y = yb + stack.shift();
  37680. bezierCurveTo(xa, ya, xb, yb, x, y);
  37681. }
  37682. break;
  37683. case 10:
  37684. n = stack.pop();
  37685. subrCode = null;
  37686. if (font.isCFFCIDFont) {
  37687. const fdIndex = font.fdSelect.getFDIndex(glyphId);
  37688. if (fdIndex >= 0 && fdIndex < font.fdArray.length) {
  37689. const fontDict = font.fdArray[fdIndex];
  37690. let subrs;
  37691. if (fontDict.privateDict && fontDict.privateDict.subrsIndex) {
  37692. subrs = fontDict.privateDict.subrsIndex.objects;
  37693. }
  37694. if (subrs) {
  37695. n += getSubroutineBias(subrs);
  37696. subrCode = subrs[n];
  37697. }
  37698. } else {
  37699. (0, _util.warn)("Invalid fd index for glyph index.");
  37700. }
  37701. } else {
  37702. subrCode = font.subrs[n + font.subrsBias];
  37703. }
  37704. if (subrCode) {
  37705. parse(subrCode);
  37706. }
  37707. break;
  37708. case 11:
  37709. return;
  37710. case 12:
  37711. v = code[i++];
  37712. switch (v) {
  37713. case 34:
  37714. xa = x + stack.shift();
  37715. xb = xa + stack.shift();
  37716. y1 = y + stack.shift();
  37717. x = xb + stack.shift();
  37718. bezierCurveTo(xa, y, xb, y1, x, y1);
  37719. xa = x + stack.shift();
  37720. xb = xa + stack.shift();
  37721. x = xb + stack.shift();
  37722. bezierCurveTo(xa, y1, xb, y, x, y);
  37723. break;
  37724. case 35:
  37725. xa = x + stack.shift();
  37726. ya = y + stack.shift();
  37727. xb = xa + stack.shift();
  37728. yb = ya + stack.shift();
  37729. x = xb + stack.shift();
  37730. y = yb + stack.shift();
  37731. bezierCurveTo(xa, ya, xb, yb, x, y);
  37732. xa = x + stack.shift();
  37733. ya = y + stack.shift();
  37734. xb = xa + stack.shift();
  37735. yb = ya + stack.shift();
  37736. x = xb + stack.shift();
  37737. y = yb + stack.shift();
  37738. bezierCurveTo(xa, ya, xb, yb, x, y);
  37739. stack.pop();
  37740. break;
  37741. case 36:
  37742. xa = x + stack.shift();
  37743. y1 = y + stack.shift();
  37744. xb = xa + stack.shift();
  37745. y2 = y1 + stack.shift();
  37746. x = xb + stack.shift();
  37747. bezierCurveTo(xa, y1, xb, y2, x, y2);
  37748. xa = x + stack.shift();
  37749. xb = xa + stack.shift();
  37750. y3 = y2 + stack.shift();
  37751. x = xb + stack.shift();
  37752. bezierCurveTo(xa, y2, xb, y3, x, y);
  37753. break;
  37754. case 37:
  37755. const x0 = x,
  37756. y0 = y;
  37757. xa = x + stack.shift();
  37758. ya = y + stack.shift();
  37759. xb = xa + stack.shift();
  37760. yb = ya + stack.shift();
  37761. x = xb + stack.shift();
  37762. y = yb + stack.shift();
  37763. bezierCurveTo(xa, ya, xb, yb, x, y);
  37764. xa = x + stack.shift();
  37765. ya = y + stack.shift();
  37766. xb = xa + stack.shift();
  37767. yb = ya + stack.shift();
  37768. x = xb;
  37769. y = yb;
  37770. if (Math.abs(x - x0) > Math.abs(y - y0)) {
  37771. x += stack.shift();
  37772. } else {
  37773. y += stack.shift();
  37774. }
  37775. bezierCurveTo(xa, ya, xb, yb, x, y);
  37776. break;
  37777. default:
  37778. throw new _util.FormatError(`unknown operator: 12 ${v}`);
  37779. }
  37780. break;
  37781. case 14:
  37782. if (stack.length >= 4) {
  37783. const achar = stack.pop();
  37784. const bchar = stack.pop();
  37785. y = stack.pop();
  37786. x = stack.pop();
  37787. cmds.push({
  37788. cmd: "save"
  37789. }, {
  37790. cmd: "translate",
  37791. args: [x, y]
  37792. });
  37793. let cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[achar]]));
  37794. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37795. cmds.push({
  37796. cmd: "restore"
  37797. });
  37798. cmap = lookupCmap(font.cmap, String.fromCharCode(font.glyphNameMap[_encodings.StandardEncoding[bchar]]));
  37799. compileCharString(font.glyphs[cmap.glyphId], cmds, font, cmap.glyphId);
  37800. }
  37801. return;
  37802. case 18:
  37803. stems += stack.length >> 1;
  37804. stackClean = true;
  37805. break;
  37806. case 19:
  37807. stems += stack.length >> 1;
  37808. i += stems + 7 >> 3;
  37809. stackClean = true;
  37810. break;
  37811. case 20:
  37812. stems += stack.length >> 1;
  37813. i += stems + 7 >> 3;
  37814. stackClean = true;
  37815. break;
  37816. case 21:
  37817. y += stack.pop();
  37818. x += stack.pop();
  37819. moveTo(x, y);
  37820. stackClean = true;
  37821. break;
  37822. case 22:
  37823. x += stack.pop();
  37824. moveTo(x, y);
  37825. stackClean = true;
  37826. break;
  37827. case 23:
  37828. stems += stack.length >> 1;
  37829. stackClean = true;
  37830. break;
  37831. case 24:
  37832. while (stack.length > 2) {
  37833. xa = x + stack.shift();
  37834. ya = y + stack.shift();
  37835. xb = xa + stack.shift();
  37836. yb = ya + stack.shift();
  37837. x = xb + stack.shift();
  37838. y = yb + stack.shift();
  37839. bezierCurveTo(xa, ya, xb, yb, x, y);
  37840. }
  37841. x += stack.shift();
  37842. y += stack.shift();
  37843. lineTo(x, y);
  37844. break;
  37845. case 25:
  37846. while (stack.length > 6) {
  37847. x += stack.shift();
  37848. y += stack.shift();
  37849. lineTo(x, y);
  37850. }
  37851. xa = x + stack.shift();
  37852. ya = y + stack.shift();
  37853. xb = xa + stack.shift();
  37854. yb = ya + stack.shift();
  37855. x = xb + stack.shift();
  37856. y = yb + stack.shift();
  37857. bezierCurveTo(xa, ya, xb, yb, x, y);
  37858. break;
  37859. case 26:
  37860. if (stack.length % 2) {
  37861. x += stack.shift();
  37862. }
  37863. while (stack.length > 0) {
  37864. xa = x;
  37865. ya = y + stack.shift();
  37866. xb = xa + stack.shift();
  37867. yb = ya + stack.shift();
  37868. x = xb;
  37869. y = yb + stack.shift();
  37870. bezierCurveTo(xa, ya, xb, yb, x, y);
  37871. }
  37872. break;
  37873. case 27:
  37874. if (stack.length % 2) {
  37875. y += stack.shift();
  37876. }
  37877. while (stack.length > 0) {
  37878. xa = x + stack.shift();
  37879. ya = y;
  37880. xb = xa + stack.shift();
  37881. yb = ya + stack.shift();
  37882. x = xb + stack.shift();
  37883. y = yb;
  37884. bezierCurveTo(xa, ya, xb, yb, x, y);
  37885. }
  37886. break;
  37887. case 28:
  37888. stack.push((code[i] << 24 | code[i + 1] << 16) >> 16);
  37889. i += 2;
  37890. break;
  37891. case 29:
  37892. n = stack.pop() + font.gsubrsBias;
  37893. subrCode = font.gsubrs[n];
  37894. if (subrCode) {
  37895. parse(subrCode);
  37896. }
  37897. break;
  37898. case 30:
  37899. while (stack.length > 0) {
  37900. xa = x;
  37901. ya = y + stack.shift();
  37902. xb = xa + stack.shift();
  37903. yb = ya + stack.shift();
  37904. x = xb + stack.shift();
  37905. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37906. bezierCurveTo(xa, ya, xb, yb, x, y);
  37907. if (stack.length === 0) {
  37908. break;
  37909. }
  37910. xa = x + stack.shift();
  37911. ya = y;
  37912. xb = xa + stack.shift();
  37913. yb = ya + stack.shift();
  37914. y = yb + stack.shift();
  37915. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37916. bezierCurveTo(xa, ya, xb, yb, x, y);
  37917. }
  37918. break;
  37919. case 31:
  37920. while (stack.length > 0) {
  37921. xa = x + stack.shift();
  37922. ya = y;
  37923. xb = xa + stack.shift();
  37924. yb = ya + stack.shift();
  37925. y = yb + stack.shift();
  37926. x = xb + (stack.length === 1 ? stack.shift() : 0);
  37927. bezierCurveTo(xa, ya, xb, yb, x, y);
  37928. if (stack.length === 0) {
  37929. break;
  37930. }
  37931. xa = x;
  37932. ya = y + stack.shift();
  37933. xb = xa + stack.shift();
  37934. yb = ya + stack.shift();
  37935. x = xb + stack.shift();
  37936. y = yb + (stack.length === 1 ? stack.shift() : 0);
  37937. bezierCurveTo(xa, ya, xb, yb, x, y);
  37938. }
  37939. break;
  37940. default:
  37941. if (v < 32) {
  37942. throw new _util.FormatError(`unknown operator: ${v}`);
  37943. }
  37944. if (v < 247) {
  37945. stack.push(v - 139);
  37946. } else if (v < 251) {
  37947. stack.push((v - 247) * 256 + code[i++] + 108);
  37948. } else if (v < 255) {
  37949. stack.push(-(v - 251) * 256 - code[i++] - 108);
  37950. } else {
  37951. stack.push((code[i] << 24 | code[i + 1] << 16 | code[i + 2] << 8 | code[i + 3]) / 65536);
  37952. i += 4;
  37953. }
  37954. break;
  37955. }
  37956. if (stackClean) {
  37957. stack.length = 0;
  37958. }
  37959. }
  37960. }
  37961. parse(charStringCode);
  37962. }
  37963. const NOOP = [];
  37964. class CompiledFont {
  37965. constructor(fontMatrix) {
  37966. if (this.constructor === CompiledFont) {
  37967. (0, _util.unreachable)("Cannot initialize CompiledFont.");
  37968. }
  37969. this.fontMatrix = fontMatrix;
  37970. this.compiledGlyphs = Object.create(null);
  37971. this.compiledCharCodeToGlyphId = Object.create(null);
  37972. }
  37973. getPathJs(unicode) {
  37974. const {
  37975. charCode,
  37976. glyphId
  37977. } = lookupCmap(this.cmap, unicode);
  37978. let fn = this.compiledGlyphs[glyphId];
  37979. if (!fn) {
  37980. try {
  37981. fn = this.compileGlyph(this.glyphs[glyphId], glyphId);
  37982. this.compiledGlyphs[glyphId] = fn;
  37983. } catch (ex) {
  37984. this.compiledGlyphs[glyphId] = NOOP;
  37985. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37986. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37987. }
  37988. throw ex;
  37989. }
  37990. }
  37991. if (this.compiledCharCodeToGlyphId[charCode] === undefined) {
  37992. this.compiledCharCodeToGlyphId[charCode] = glyphId;
  37993. }
  37994. return fn;
  37995. }
  37996. compileGlyph(code, glyphId) {
  37997. if (!code || code.length === 0 || code[0] === 14) {
  37998. return NOOP;
  37999. }
  38000. let fontMatrix = this.fontMatrix;
  38001. if (this.isCFFCIDFont) {
  38002. const fdIndex = this.fdSelect.getFDIndex(glyphId);
  38003. if (fdIndex >= 0 && fdIndex < this.fdArray.length) {
  38004. const fontDict = this.fdArray[fdIndex];
  38005. fontMatrix = fontDict.getByName("FontMatrix") || _util.FONT_IDENTITY_MATRIX;
  38006. } else {
  38007. (0, _util.warn)("Invalid fd index for glyph index.");
  38008. }
  38009. }
  38010. const cmds = [{
  38011. cmd: "save"
  38012. }, {
  38013. cmd: "transform",
  38014. args: fontMatrix.slice()
  38015. }, {
  38016. cmd: "scale",
  38017. args: ["size", "-size"]
  38018. }];
  38019. this.compileGlyphImpl(code, cmds, glyphId);
  38020. cmds.push({
  38021. cmd: "restore"
  38022. });
  38023. return cmds;
  38024. }
  38025. compileGlyphImpl() {
  38026. (0, _util.unreachable)("Children classes should implement this.");
  38027. }
  38028. hasBuiltPath(unicode) {
  38029. const {
  38030. charCode,
  38031. glyphId
  38032. } = lookupCmap(this.cmap, unicode);
  38033. return this.compiledGlyphs[glyphId] !== undefined && this.compiledCharCodeToGlyphId[charCode] !== undefined;
  38034. }
  38035. }
  38036. class TrueTypeCompiled extends CompiledFont {
  38037. constructor(glyphs, cmap, fontMatrix) {
  38038. super(fontMatrix || [0.000488, 0, 0, 0.000488, 0, 0]);
  38039. this.glyphs = glyphs;
  38040. this.cmap = cmap;
  38041. }
  38042. compileGlyphImpl(code, cmds) {
  38043. compileGlyf(code, cmds, this);
  38044. }
  38045. }
  38046. class Type2Compiled extends CompiledFont {
  38047. constructor(cffInfo, cmap, fontMatrix, glyphNameMap) {
  38048. super(fontMatrix || [0.001, 0, 0, 0.001, 0, 0]);
  38049. this.glyphs = cffInfo.glyphs;
  38050. this.gsubrs = cffInfo.gsubrs || [];
  38051. this.subrs = cffInfo.subrs || [];
  38052. this.cmap = cmap;
  38053. this.glyphNameMap = glyphNameMap || (0, _glyphlist.getGlyphsUnicode)();
  38054. this.gsubrsBias = getSubroutineBias(this.gsubrs);
  38055. this.subrsBias = getSubroutineBias(this.subrs);
  38056. this.isCFFCIDFont = cffInfo.isCFFCIDFont;
  38057. this.fdSelect = cffInfo.fdSelect;
  38058. this.fdArray = cffInfo.fdArray;
  38059. }
  38060. compileGlyphImpl(code, cmds, glyphId) {
  38061. compileCharString(code, cmds, this, glyphId);
  38062. }
  38063. }
  38064. class FontRendererFactory {
  38065. static create(font, seacAnalysisEnabled) {
  38066. const data = new Uint8Array(font.data);
  38067. let cmap, glyf, loca, cff, indexToLocFormat, unitsPerEm;
  38068. const numTables = getUint16(data, 4);
  38069. for (let i = 0, p = 12; i < numTables; i++, p += 16) {
  38070. const tag = (0, _util.bytesToString)(data.subarray(p, p + 4));
  38071. const offset = getUint32(data, p + 8);
  38072. const length = getUint32(data, p + 12);
  38073. switch (tag) {
  38074. case "cmap":
  38075. cmap = parseCmap(data, offset, offset + length);
  38076. break;
  38077. case "glyf":
  38078. glyf = data.subarray(offset, offset + length);
  38079. break;
  38080. case "loca":
  38081. loca = data.subarray(offset, offset + length);
  38082. break;
  38083. case "head":
  38084. unitsPerEm = getUint16(data, offset + 18);
  38085. indexToLocFormat = getUint16(data, offset + 50);
  38086. break;
  38087. case "CFF ":
  38088. cff = parseCff(data, offset, offset + length, seacAnalysisEnabled);
  38089. break;
  38090. }
  38091. }
  38092. if (glyf) {
  38093. const fontMatrix = !unitsPerEm ? font.fontMatrix : [1 / unitsPerEm, 0, 0, 1 / unitsPerEm, 0, 0];
  38094. return new TrueTypeCompiled(parseGlyfTable(glyf, loca, indexToLocFormat), cmap, fontMatrix);
  38095. }
  38096. return new Type2Compiled(cff, cmap, font.fontMatrix, font.glyphNameMap);
  38097. }
  38098. }
  38099. exports.FontRendererFactory = FontRendererFactory;
  38100. /***/ }),
  38101. /* 51 */
  38102. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  38103. Object.defineProperty(exports, "__esModule", ({
  38104. value: true
  38105. }));
  38106. exports.getMetrics = exports.getFontBasicMetrics = void 0;
  38107. var _core_utils = __w_pdfjs_require__(8);
  38108. const getMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  38109. t.Courier = 600;
  38110. t["Courier-Bold"] = 600;
  38111. t["Courier-BoldOblique"] = 600;
  38112. t["Courier-Oblique"] = 600;
  38113. t.Helvetica = (0, _core_utils.getLookupTableFactory)(function (t) {
  38114. t.space = 278;
  38115. t.exclam = 278;
  38116. t.quotedbl = 355;
  38117. t.numbersign = 556;
  38118. t.dollar = 556;
  38119. t.percent = 889;
  38120. t.ampersand = 667;
  38121. t.quoteright = 222;
  38122. t.parenleft = 333;
  38123. t.parenright = 333;
  38124. t.asterisk = 389;
  38125. t.plus = 584;
  38126. t.comma = 278;
  38127. t.hyphen = 333;
  38128. t.period = 278;
  38129. t.slash = 278;
  38130. t.zero = 556;
  38131. t.one = 556;
  38132. t.two = 556;
  38133. t.three = 556;
  38134. t.four = 556;
  38135. t.five = 556;
  38136. t.six = 556;
  38137. t.seven = 556;
  38138. t.eight = 556;
  38139. t.nine = 556;
  38140. t.colon = 278;
  38141. t.semicolon = 278;
  38142. t.less = 584;
  38143. t.equal = 584;
  38144. t.greater = 584;
  38145. t.question = 556;
  38146. t.at = 1015;
  38147. t.A = 667;
  38148. t.B = 667;
  38149. t.C = 722;
  38150. t.D = 722;
  38151. t.E = 667;
  38152. t.F = 611;
  38153. t.G = 778;
  38154. t.H = 722;
  38155. t.I = 278;
  38156. t.J = 500;
  38157. t.K = 667;
  38158. t.L = 556;
  38159. t.M = 833;
  38160. t.N = 722;
  38161. t.O = 778;
  38162. t.P = 667;
  38163. t.Q = 778;
  38164. t.R = 722;
  38165. t.S = 667;
  38166. t.T = 611;
  38167. t.U = 722;
  38168. t.V = 667;
  38169. t.W = 944;
  38170. t.X = 667;
  38171. t.Y = 667;
  38172. t.Z = 611;
  38173. t.bracketleft = 278;
  38174. t.backslash = 278;
  38175. t.bracketright = 278;
  38176. t.asciicircum = 469;
  38177. t.underscore = 556;
  38178. t.quoteleft = 222;
  38179. t.a = 556;
  38180. t.b = 556;
  38181. t.c = 500;
  38182. t.d = 556;
  38183. t.e = 556;
  38184. t.f = 278;
  38185. t.g = 556;
  38186. t.h = 556;
  38187. t.i = 222;
  38188. t.j = 222;
  38189. t.k = 500;
  38190. t.l = 222;
  38191. t.m = 833;
  38192. t.n = 556;
  38193. t.o = 556;
  38194. t.p = 556;
  38195. t.q = 556;
  38196. t.r = 333;
  38197. t.s = 500;
  38198. t.t = 278;
  38199. t.u = 556;
  38200. t.v = 500;
  38201. t.w = 722;
  38202. t.x = 500;
  38203. t.y = 500;
  38204. t.z = 500;
  38205. t.braceleft = 334;
  38206. t.bar = 260;
  38207. t.braceright = 334;
  38208. t.asciitilde = 584;
  38209. t.exclamdown = 333;
  38210. t.cent = 556;
  38211. t.sterling = 556;
  38212. t.fraction = 167;
  38213. t.yen = 556;
  38214. t.florin = 556;
  38215. t.section = 556;
  38216. t.currency = 556;
  38217. t.quotesingle = 191;
  38218. t.quotedblleft = 333;
  38219. t.guillemotleft = 556;
  38220. t.guilsinglleft = 333;
  38221. t.guilsinglright = 333;
  38222. t.fi = 500;
  38223. t.fl = 500;
  38224. t.endash = 556;
  38225. t.dagger = 556;
  38226. t.daggerdbl = 556;
  38227. t.periodcentered = 278;
  38228. t.paragraph = 537;
  38229. t.bullet = 350;
  38230. t.quotesinglbase = 222;
  38231. t.quotedblbase = 333;
  38232. t.quotedblright = 333;
  38233. t.guillemotright = 556;
  38234. t.ellipsis = 1000;
  38235. t.perthousand = 1000;
  38236. t.questiondown = 611;
  38237. t.grave = 333;
  38238. t.acute = 333;
  38239. t.circumflex = 333;
  38240. t.tilde = 333;
  38241. t.macron = 333;
  38242. t.breve = 333;
  38243. t.dotaccent = 333;
  38244. t.dieresis = 333;
  38245. t.ring = 333;
  38246. t.cedilla = 333;
  38247. t.hungarumlaut = 333;
  38248. t.ogonek = 333;
  38249. t.caron = 333;
  38250. t.emdash = 1000;
  38251. t.AE = 1000;
  38252. t.ordfeminine = 370;
  38253. t.Lslash = 556;
  38254. t.Oslash = 778;
  38255. t.OE = 1000;
  38256. t.ordmasculine = 365;
  38257. t.ae = 889;
  38258. t.dotlessi = 278;
  38259. t.lslash = 222;
  38260. t.oslash = 611;
  38261. t.oe = 944;
  38262. t.germandbls = 611;
  38263. t.Idieresis = 278;
  38264. t.eacute = 556;
  38265. t.abreve = 556;
  38266. t.uhungarumlaut = 556;
  38267. t.ecaron = 556;
  38268. t.Ydieresis = 667;
  38269. t.divide = 584;
  38270. t.Yacute = 667;
  38271. t.Acircumflex = 667;
  38272. t.aacute = 556;
  38273. t.Ucircumflex = 722;
  38274. t.yacute = 500;
  38275. t.scommaaccent = 500;
  38276. t.ecircumflex = 556;
  38277. t.Uring = 722;
  38278. t.Udieresis = 722;
  38279. t.aogonek = 556;
  38280. t.Uacute = 722;
  38281. t.uogonek = 556;
  38282. t.Edieresis = 667;
  38283. t.Dcroat = 722;
  38284. t.commaaccent = 250;
  38285. t.copyright = 737;
  38286. t.Emacron = 667;
  38287. t.ccaron = 500;
  38288. t.aring = 556;
  38289. t.Ncommaaccent = 722;
  38290. t.lacute = 222;
  38291. t.agrave = 556;
  38292. t.Tcommaaccent = 611;
  38293. t.Cacute = 722;
  38294. t.atilde = 556;
  38295. t.Edotaccent = 667;
  38296. t.scaron = 500;
  38297. t.scedilla = 500;
  38298. t.iacute = 278;
  38299. t.lozenge = 471;
  38300. t.Rcaron = 722;
  38301. t.Gcommaaccent = 778;
  38302. t.ucircumflex = 556;
  38303. t.acircumflex = 556;
  38304. t.Amacron = 667;
  38305. t.rcaron = 333;
  38306. t.ccedilla = 500;
  38307. t.Zdotaccent = 611;
  38308. t.Thorn = 667;
  38309. t.Omacron = 778;
  38310. t.Racute = 722;
  38311. t.Sacute = 667;
  38312. t.dcaron = 643;
  38313. t.Umacron = 722;
  38314. t.uring = 556;
  38315. t.threesuperior = 333;
  38316. t.Ograve = 778;
  38317. t.Agrave = 667;
  38318. t.Abreve = 667;
  38319. t.multiply = 584;
  38320. t.uacute = 556;
  38321. t.Tcaron = 611;
  38322. t.partialdiff = 476;
  38323. t.ydieresis = 500;
  38324. t.Nacute = 722;
  38325. t.icircumflex = 278;
  38326. t.Ecircumflex = 667;
  38327. t.adieresis = 556;
  38328. t.edieresis = 556;
  38329. t.cacute = 500;
  38330. t.nacute = 556;
  38331. t.umacron = 556;
  38332. t.Ncaron = 722;
  38333. t.Iacute = 278;
  38334. t.plusminus = 584;
  38335. t.brokenbar = 260;
  38336. t.registered = 737;
  38337. t.Gbreve = 778;
  38338. t.Idotaccent = 278;
  38339. t.summation = 600;
  38340. t.Egrave = 667;
  38341. t.racute = 333;
  38342. t.omacron = 556;
  38343. t.Zacute = 611;
  38344. t.Zcaron = 611;
  38345. t.greaterequal = 549;
  38346. t.Eth = 722;
  38347. t.Ccedilla = 722;
  38348. t.lcommaaccent = 222;
  38349. t.tcaron = 317;
  38350. t.eogonek = 556;
  38351. t.Uogonek = 722;
  38352. t.Aacute = 667;
  38353. t.Adieresis = 667;
  38354. t.egrave = 556;
  38355. t.zacute = 500;
  38356. t.iogonek = 222;
  38357. t.Oacute = 778;
  38358. t.oacute = 556;
  38359. t.amacron = 556;
  38360. t.sacute = 500;
  38361. t.idieresis = 278;
  38362. t.Ocircumflex = 778;
  38363. t.Ugrave = 722;
  38364. t.Delta = 612;
  38365. t.thorn = 556;
  38366. t.twosuperior = 333;
  38367. t.Odieresis = 778;
  38368. t.mu = 556;
  38369. t.igrave = 278;
  38370. t.ohungarumlaut = 556;
  38371. t.Eogonek = 667;
  38372. t.dcroat = 556;
  38373. t.threequarters = 834;
  38374. t.Scedilla = 667;
  38375. t.lcaron = 299;
  38376. t.Kcommaaccent = 667;
  38377. t.Lacute = 556;
  38378. t.trademark = 1000;
  38379. t.edotaccent = 556;
  38380. t.Igrave = 278;
  38381. t.Imacron = 278;
  38382. t.Lcaron = 556;
  38383. t.onehalf = 834;
  38384. t.lessequal = 549;
  38385. t.ocircumflex = 556;
  38386. t.ntilde = 556;
  38387. t.Uhungarumlaut = 722;
  38388. t.Eacute = 667;
  38389. t.emacron = 556;
  38390. t.gbreve = 556;
  38391. t.onequarter = 834;
  38392. t.Scaron = 667;
  38393. t.Scommaaccent = 667;
  38394. t.Ohungarumlaut = 778;
  38395. t.degree = 400;
  38396. t.ograve = 556;
  38397. t.Ccaron = 722;
  38398. t.ugrave = 556;
  38399. t.radical = 453;
  38400. t.Dcaron = 722;
  38401. t.rcommaaccent = 333;
  38402. t.Ntilde = 722;
  38403. t.otilde = 556;
  38404. t.Rcommaaccent = 722;
  38405. t.Lcommaaccent = 556;
  38406. t.Atilde = 667;
  38407. t.Aogonek = 667;
  38408. t.Aring = 667;
  38409. t.Otilde = 778;
  38410. t.zdotaccent = 500;
  38411. t.Ecaron = 667;
  38412. t.Iogonek = 278;
  38413. t.kcommaaccent = 500;
  38414. t.minus = 584;
  38415. t.Icircumflex = 278;
  38416. t.ncaron = 556;
  38417. t.tcommaaccent = 278;
  38418. t.logicalnot = 584;
  38419. t.odieresis = 556;
  38420. t.udieresis = 556;
  38421. t.notequal = 549;
  38422. t.gcommaaccent = 556;
  38423. t.eth = 556;
  38424. t.zcaron = 500;
  38425. t.ncommaaccent = 556;
  38426. t.onesuperior = 333;
  38427. t.imacron = 278;
  38428. t.Euro = 556;
  38429. });
  38430. t["Helvetica-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38431. t.space = 278;
  38432. t.exclam = 333;
  38433. t.quotedbl = 474;
  38434. t.numbersign = 556;
  38435. t.dollar = 556;
  38436. t.percent = 889;
  38437. t.ampersand = 722;
  38438. t.quoteright = 278;
  38439. t.parenleft = 333;
  38440. t.parenright = 333;
  38441. t.asterisk = 389;
  38442. t.plus = 584;
  38443. t.comma = 278;
  38444. t.hyphen = 333;
  38445. t.period = 278;
  38446. t.slash = 278;
  38447. t.zero = 556;
  38448. t.one = 556;
  38449. t.two = 556;
  38450. t.three = 556;
  38451. t.four = 556;
  38452. t.five = 556;
  38453. t.six = 556;
  38454. t.seven = 556;
  38455. t.eight = 556;
  38456. t.nine = 556;
  38457. t.colon = 333;
  38458. t.semicolon = 333;
  38459. t.less = 584;
  38460. t.equal = 584;
  38461. t.greater = 584;
  38462. t.question = 611;
  38463. t.at = 975;
  38464. t.A = 722;
  38465. t.B = 722;
  38466. t.C = 722;
  38467. t.D = 722;
  38468. t.E = 667;
  38469. t.F = 611;
  38470. t.G = 778;
  38471. t.H = 722;
  38472. t.I = 278;
  38473. t.J = 556;
  38474. t.K = 722;
  38475. t.L = 611;
  38476. t.M = 833;
  38477. t.N = 722;
  38478. t.O = 778;
  38479. t.P = 667;
  38480. t.Q = 778;
  38481. t.R = 722;
  38482. t.S = 667;
  38483. t.T = 611;
  38484. t.U = 722;
  38485. t.V = 667;
  38486. t.W = 944;
  38487. t.X = 667;
  38488. t.Y = 667;
  38489. t.Z = 611;
  38490. t.bracketleft = 333;
  38491. t.backslash = 278;
  38492. t.bracketright = 333;
  38493. t.asciicircum = 584;
  38494. t.underscore = 556;
  38495. t.quoteleft = 278;
  38496. t.a = 556;
  38497. t.b = 611;
  38498. t.c = 556;
  38499. t.d = 611;
  38500. t.e = 556;
  38501. t.f = 333;
  38502. t.g = 611;
  38503. t.h = 611;
  38504. t.i = 278;
  38505. t.j = 278;
  38506. t.k = 556;
  38507. t.l = 278;
  38508. t.m = 889;
  38509. t.n = 611;
  38510. t.o = 611;
  38511. t.p = 611;
  38512. t.q = 611;
  38513. t.r = 389;
  38514. t.s = 556;
  38515. t.t = 333;
  38516. t.u = 611;
  38517. t.v = 556;
  38518. t.w = 778;
  38519. t.x = 556;
  38520. t.y = 556;
  38521. t.z = 500;
  38522. t.braceleft = 389;
  38523. t.bar = 280;
  38524. t.braceright = 389;
  38525. t.asciitilde = 584;
  38526. t.exclamdown = 333;
  38527. t.cent = 556;
  38528. t.sterling = 556;
  38529. t.fraction = 167;
  38530. t.yen = 556;
  38531. t.florin = 556;
  38532. t.section = 556;
  38533. t.currency = 556;
  38534. t.quotesingle = 238;
  38535. t.quotedblleft = 500;
  38536. t.guillemotleft = 556;
  38537. t.guilsinglleft = 333;
  38538. t.guilsinglright = 333;
  38539. t.fi = 611;
  38540. t.fl = 611;
  38541. t.endash = 556;
  38542. t.dagger = 556;
  38543. t.daggerdbl = 556;
  38544. t.periodcentered = 278;
  38545. t.paragraph = 556;
  38546. t.bullet = 350;
  38547. t.quotesinglbase = 278;
  38548. t.quotedblbase = 500;
  38549. t.quotedblright = 500;
  38550. t.guillemotright = 556;
  38551. t.ellipsis = 1000;
  38552. t.perthousand = 1000;
  38553. t.questiondown = 611;
  38554. t.grave = 333;
  38555. t.acute = 333;
  38556. t.circumflex = 333;
  38557. t.tilde = 333;
  38558. t.macron = 333;
  38559. t.breve = 333;
  38560. t.dotaccent = 333;
  38561. t.dieresis = 333;
  38562. t.ring = 333;
  38563. t.cedilla = 333;
  38564. t.hungarumlaut = 333;
  38565. t.ogonek = 333;
  38566. t.caron = 333;
  38567. t.emdash = 1000;
  38568. t.AE = 1000;
  38569. t.ordfeminine = 370;
  38570. t.Lslash = 611;
  38571. t.Oslash = 778;
  38572. t.OE = 1000;
  38573. t.ordmasculine = 365;
  38574. t.ae = 889;
  38575. t.dotlessi = 278;
  38576. t.lslash = 278;
  38577. t.oslash = 611;
  38578. t.oe = 944;
  38579. t.germandbls = 611;
  38580. t.Idieresis = 278;
  38581. t.eacute = 556;
  38582. t.abreve = 556;
  38583. t.uhungarumlaut = 611;
  38584. t.ecaron = 556;
  38585. t.Ydieresis = 667;
  38586. t.divide = 584;
  38587. t.Yacute = 667;
  38588. t.Acircumflex = 722;
  38589. t.aacute = 556;
  38590. t.Ucircumflex = 722;
  38591. t.yacute = 556;
  38592. t.scommaaccent = 556;
  38593. t.ecircumflex = 556;
  38594. t.Uring = 722;
  38595. t.Udieresis = 722;
  38596. t.aogonek = 556;
  38597. t.Uacute = 722;
  38598. t.uogonek = 611;
  38599. t.Edieresis = 667;
  38600. t.Dcroat = 722;
  38601. t.commaaccent = 250;
  38602. t.copyright = 737;
  38603. t.Emacron = 667;
  38604. t.ccaron = 556;
  38605. t.aring = 556;
  38606. t.Ncommaaccent = 722;
  38607. t.lacute = 278;
  38608. t.agrave = 556;
  38609. t.Tcommaaccent = 611;
  38610. t.Cacute = 722;
  38611. t.atilde = 556;
  38612. t.Edotaccent = 667;
  38613. t.scaron = 556;
  38614. t.scedilla = 556;
  38615. t.iacute = 278;
  38616. t.lozenge = 494;
  38617. t.Rcaron = 722;
  38618. t.Gcommaaccent = 778;
  38619. t.ucircumflex = 611;
  38620. t.acircumflex = 556;
  38621. t.Amacron = 722;
  38622. t.rcaron = 389;
  38623. t.ccedilla = 556;
  38624. t.Zdotaccent = 611;
  38625. t.Thorn = 667;
  38626. t.Omacron = 778;
  38627. t.Racute = 722;
  38628. t.Sacute = 667;
  38629. t.dcaron = 743;
  38630. t.Umacron = 722;
  38631. t.uring = 611;
  38632. t.threesuperior = 333;
  38633. t.Ograve = 778;
  38634. t.Agrave = 722;
  38635. t.Abreve = 722;
  38636. t.multiply = 584;
  38637. t.uacute = 611;
  38638. t.Tcaron = 611;
  38639. t.partialdiff = 494;
  38640. t.ydieresis = 556;
  38641. t.Nacute = 722;
  38642. t.icircumflex = 278;
  38643. t.Ecircumflex = 667;
  38644. t.adieresis = 556;
  38645. t.edieresis = 556;
  38646. t.cacute = 556;
  38647. t.nacute = 611;
  38648. t.umacron = 611;
  38649. t.Ncaron = 722;
  38650. t.Iacute = 278;
  38651. t.plusminus = 584;
  38652. t.brokenbar = 280;
  38653. t.registered = 737;
  38654. t.Gbreve = 778;
  38655. t.Idotaccent = 278;
  38656. t.summation = 600;
  38657. t.Egrave = 667;
  38658. t.racute = 389;
  38659. t.omacron = 611;
  38660. t.Zacute = 611;
  38661. t.Zcaron = 611;
  38662. t.greaterequal = 549;
  38663. t.Eth = 722;
  38664. t.Ccedilla = 722;
  38665. t.lcommaaccent = 278;
  38666. t.tcaron = 389;
  38667. t.eogonek = 556;
  38668. t.Uogonek = 722;
  38669. t.Aacute = 722;
  38670. t.Adieresis = 722;
  38671. t.egrave = 556;
  38672. t.zacute = 500;
  38673. t.iogonek = 278;
  38674. t.Oacute = 778;
  38675. t.oacute = 611;
  38676. t.amacron = 556;
  38677. t.sacute = 556;
  38678. t.idieresis = 278;
  38679. t.Ocircumflex = 778;
  38680. t.Ugrave = 722;
  38681. t.Delta = 612;
  38682. t.thorn = 611;
  38683. t.twosuperior = 333;
  38684. t.Odieresis = 778;
  38685. t.mu = 611;
  38686. t.igrave = 278;
  38687. t.ohungarumlaut = 611;
  38688. t.Eogonek = 667;
  38689. t.dcroat = 611;
  38690. t.threequarters = 834;
  38691. t.Scedilla = 667;
  38692. t.lcaron = 400;
  38693. t.Kcommaaccent = 722;
  38694. t.Lacute = 611;
  38695. t.trademark = 1000;
  38696. t.edotaccent = 556;
  38697. t.Igrave = 278;
  38698. t.Imacron = 278;
  38699. t.Lcaron = 611;
  38700. t.onehalf = 834;
  38701. t.lessequal = 549;
  38702. t.ocircumflex = 611;
  38703. t.ntilde = 611;
  38704. t.Uhungarumlaut = 722;
  38705. t.Eacute = 667;
  38706. t.emacron = 556;
  38707. t.gbreve = 611;
  38708. t.onequarter = 834;
  38709. t.Scaron = 667;
  38710. t.Scommaaccent = 667;
  38711. t.Ohungarumlaut = 778;
  38712. t.degree = 400;
  38713. t.ograve = 611;
  38714. t.Ccaron = 722;
  38715. t.ugrave = 611;
  38716. t.radical = 549;
  38717. t.Dcaron = 722;
  38718. t.rcommaaccent = 389;
  38719. t.Ntilde = 722;
  38720. t.otilde = 611;
  38721. t.Rcommaaccent = 722;
  38722. t.Lcommaaccent = 611;
  38723. t.Atilde = 722;
  38724. t.Aogonek = 722;
  38725. t.Aring = 722;
  38726. t.Otilde = 778;
  38727. t.zdotaccent = 500;
  38728. t.Ecaron = 667;
  38729. t.Iogonek = 278;
  38730. t.kcommaaccent = 556;
  38731. t.minus = 584;
  38732. t.Icircumflex = 278;
  38733. t.ncaron = 611;
  38734. t.tcommaaccent = 333;
  38735. t.logicalnot = 584;
  38736. t.odieresis = 611;
  38737. t.udieresis = 611;
  38738. t.notequal = 549;
  38739. t.gcommaaccent = 611;
  38740. t.eth = 611;
  38741. t.zcaron = 500;
  38742. t.ncommaaccent = 611;
  38743. t.onesuperior = 333;
  38744. t.imacron = 278;
  38745. t.Euro = 556;
  38746. });
  38747. t["Helvetica-BoldOblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  38748. t.space = 278;
  38749. t.exclam = 333;
  38750. t.quotedbl = 474;
  38751. t.numbersign = 556;
  38752. t.dollar = 556;
  38753. t.percent = 889;
  38754. t.ampersand = 722;
  38755. t.quoteright = 278;
  38756. t.parenleft = 333;
  38757. t.parenright = 333;
  38758. t.asterisk = 389;
  38759. t.plus = 584;
  38760. t.comma = 278;
  38761. t.hyphen = 333;
  38762. t.period = 278;
  38763. t.slash = 278;
  38764. t.zero = 556;
  38765. t.one = 556;
  38766. t.two = 556;
  38767. t.three = 556;
  38768. t.four = 556;
  38769. t.five = 556;
  38770. t.six = 556;
  38771. t.seven = 556;
  38772. t.eight = 556;
  38773. t.nine = 556;
  38774. t.colon = 333;
  38775. t.semicolon = 333;
  38776. t.less = 584;
  38777. t.equal = 584;
  38778. t.greater = 584;
  38779. t.question = 611;
  38780. t.at = 975;
  38781. t.A = 722;
  38782. t.B = 722;
  38783. t.C = 722;
  38784. t.D = 722;
  38785. t.E = 667;
  38786. t.F = 611;
  38787. t.G = 778;
  38788. t.H = 722;
  38789. t.I = 278;
  38790. t.J = 556;
  38791. t.K = 722;
  38792. t.L = 611;
  38793. t.M = 833;
  38794. t.N = 722;
  38795. t.O = 778;
  38796. t.P = 667;
  38797. t.Q = 778;
  38798. t.R = 722;
  38799. t.S = 667;
  38800. t.T = 611;
  38801. t.U = 722;
  38802. t.V = 667;
  38803. t.W = 944;
  38804. t.X = 667;
  38805. t.Y = 667;
  38806. t.Z = 611;
  38807. t.bracketleft = 333;
  38808. t.backslash = 278;
  38809. t.bracketright = 333;
  38810. t.asciicircum = 584;
  38811. t.underscore = 556;
  38812. t.quoteleft = 278;
  38813. t.a = 556;
  38814. t.b = 611;
  38815. t.c = 556;
  38816. t.d = 611;
  38817. t.e = 556;
  38818. t.f = 333;
  38819. t.g = 611;
  38820. t.h = 611;
  38821. t.i = 278;
  38822. t.j = 278;
  38823. t.k = 556;
  38824. t.l = 278;
  38825. t.m = 889;
  38826. t.n = 611;
  38827. t.o = 611;
  38828. t.p = 611;
  38829. t.q = 611;
  38830. t.r = 389;
  38831. t.s = 556;
  38832. t.t = 333;
  38833. t.u = 611;
  38834. t.v = 556;
  38835. t.w = 778;
  38836. t.x = 556;
  38837. t.y = 556;
  38838. t.z = 500;
  38839. t.braceleft = 389;
  38840. t.bar = 280;
  38841. t.braceright = 389;
  38842. t.asciitilde = 584;
  38843. t.exclamdown = 333;
  38844. t.cent = 556;
  38845. t.sterling = 556;
  38846. t.fraction = 167;
  38847. t.yen = 556;
  38848. t.florin = 556;
  38849. t.section = 556;
  38850. t.currency = 556;
  38851. t.quotesingle = 238;
  38852. t.quotedblleft = 500;
  38853. t.guillemotleft = 556;
  38854. t.guilsinglleft = 333;
  38855. t.guilsinglright = 333;
  38856. t.fi = 611;
  38857. t.fl = 611;
  38858. t.endash = 556;
  38859. t.dagger = 556;
  38860. t.daggerdbl = 556;
  38861. t.periodcentered = 278;
  38862. t.paragraph = 556;
  38863. t.bullet = 350;
  38864. t.quotesinglbase = 278;
  38865. t.quotedblbase = 500;
  38866. t.quotedblright = 500;
  38867. t.guillemotright = 556;
  38868. t.ellipsis = 1000;
  38869. t.perthousand = 1000;
  38870. t.questiondown = 611;
  38871. t.grave = 333;
  38872. t.acute = 333;
  38873. t.circumflex = 333;
  38874. t.tilde = 333;
  38875. t.macron = 333;
  38876. t.breve = 333;
  38877. t.dotaccent = 333;
  38878. t.dieresis = 333;
  38879. t.ring = 333;
  38880. t.cedilla = 333;
  38881. t.hungarumlaut = 333;
  38882. t.ogonek = 333;
  38883. t.caron = 333;
  38884. t.emdash = 1000;
  38885. t.AE = 1000;
  38886. t.ordfeminine = 370;
  38887. t.Lslash = 611;
  38888. t.Oslash = 778;
  38889. t.OE = 1000;
  38890. t.ordmasculine = 365;
  38891. t.ae = 889;
  38892. t.dotlessi = 278;
  38893. t.lslash = 278;
  38894. t.oslash = 611;
  38895. t.oe = 944;
  38896. t.germandbls = 611;
  38897. t.Idieresis = 278;
  38898. t.eacute = 556;
  38899. t.abreve = 556;
  38900. t.uhungarumlaut = 611;
  38901. t.ecaron = 556;
  38902. t.Ydieresis = 667;
  38903. t.divide = 584;
  38904. t.Yacute = 667;
  38905. t.Acircumflex = 722;
  38906. t.aacute = 556;
  38907. t.Ucircumflex = 722;
  38908. t.yacute = 556;
  38909. t.scommaaccent = 556;
  38910. t.ecircumflex = 556;
  38911. t.Uring = 722;
  38912. t.Udieresis = 722;
  38913. t.aogonek = 556;
  38914. t.Uacute = 722;
  38915. t.uogonek = 611;
  38916. t.Edieresis = 667;
  38917. t.Dcroat = 722;
  38918. t.commaaccent = 250;
  38919. t.copyright = 737;
  38920. t.Emacron = 667;
  38921. t.ccaron = 556;
  38922. t.aring = 556;
  38923. t.Ncommaaccent = 722;
  38924. t.lacute = 278;
  38925. t.agrave = 556;
  38926. t.Tcommaaccent = 611;
  38927. t.Cacute = 722;
  38928. t.atilde = 556;
  38929. t.Edotaccent = 667;
  38930. t.scaron = 556;
  38931. t.scedilla = 556;
  38932. t.iacute = 278;
  38933. t.lozenge = 494;
  38934. t.Rcaron = 722;
  38935. t.Gcommaaccent = 778;
  38936. t.ucircumflex = 611;
  38937. t.acircumflex = 556;
  38938. t.Amacron = 722;
  38939. t.rcaron = 389;
  38940. t.ccedilla = 556;
  38941. t.Zdotaccent = 611;
  38942. t.Thorn = 667;
  38943. t.Omacron = 778;
  38944. t.Racute = 722;
  38945. t.Sacute = 667;
  38946. t.dcaron = 743;
  38947. t.Umacron = 722;
  38948. t.uring = 611;
  38949. t.threesuperior = 333;
  38950. t.Ograve = 778;
  38951. t.Agrave = 722;
  38952. t.Abreve = 722;
  38953. t.multiply = 584;
  38954. t.uacute = 611;
  38955. t.Tcaron = 611;
  38956. t.partialdiff = 494;
  38957. t.ydieresis = 556;
  38958. t.Nacute = 722;
  38959. t.icircumflex = 278;
  38960. t.Ecircumflex = 667;
  38961. t.adieresis = 556;
  38962. t.edieresis = 556;
  38963. t.cacute = 556;
  38964. t.nacute = 611;
  38965. t.umacron = 611;
  38966. t.Ncaron = 722;
  38967. t.Iacute = 278;
  38968. t.plusminus = 584;
  38969. t.brokenbar = 280;
  38970. t.registered = 737;
  38971. t.Gbreve = 778;
  38972. t.Idotaccent = 278;
  38973. t.summation = 600;
  38974. t.Egrave = 667;
  38975. t.racute = 389;
  38976. t.omacron = 611;
  38977. t.Zacute = 611;
  38978. t.Zcaron = 611;
  38979. t.greaterequal = 549;
  38980. t.Eth = 722;
  38981. t.Ccedilla = 722;
  38982. t.lcommaaccent = 278;
  38983. t.tcaron = 389;
  38984. t.eogonek = 556;
  38985. t.Uogonek = 722;
  38986. t.Aacute = 722;
  38987. t.Adieresis = 722;
  38988. t.egrave = 556;
  38989. t.zacute = 500;
  38990. t.iogonek = 278;
  38991. t.Oacute = 778;
  38992. t.oacute = 611;
  38993. t.amacron = 556;
  38994. t.sacute = 556;
  38995. t.idieresis = 278;
  38996. t.Ocircumflex = 778;
  38997. t.Ugrave = 722;
  38998. t.Delta = 612;
  38999. t.thorn = 611;
  39000. t.twosuperior = 333;
  39001. t.Odieresis = 778;
  39002. t.mu = 611;
  39003. t.igrave = 278;
  39004. t.ohungarumlaut = 611;
  39005. t.Eogonek = 667;
  39006. t.dcroat = 611;
  39007. t.threequarters = 834;
  39008. t.Scedilla = 667;
  39009. t.lcaron = 400;
  39010. t.Kcommaaccent = 722;
  39011. t.Lacute = 611;
  39012. t.trademark = 1000;
  39013. t.edotaccent = 556;
  39014. t.Igrave = 278;
  39015. t.Imacron = 278;
  39016. t.Lcaron = 611;
  39017. t.onehalf = 834;
  39018. t.lessequal = 549;
  39019. t.ocircumflex = 611;
  39020. t.ntilde = 611;
  39021. t.Uhungarumlaut = 722;
  39022. t.Eacute = 667;
  39023. t.emacron = 556;
  39024. t.gbreve = 611;
  39025. t.onequarter = 834;
  39026. t.Scaron = 667;
  39027. t.Scommaaccent = 667;
  39028. t.Ohungarumlaut = 778;
  39029. t.degree = 400;
  39030. t.ograve = 611;
  39031. t.Ccaron = 722;
  39032. t.ugrave = 611;
  39033. t.radical = 549;
  39034. t.Dcaron = 722;
  39035. t.rcommaaccent = 389;
  39036. t.Ntilde = 722;
  39037. t.otilde = 611;
  39038. t.Rcommaaccent = 722;
  39039. t.Lcommaaccent = 611;
  39040. t.Atilde = 722;
  39041. t.Aogonek = 722;
  39042. t.Aring = 722;
  39043. t.Otilde = 778;
  39044. t.zdotaccent = 500;
  39045. t.Ecaron = 667;
  39046. t.Iogonek = 278;
  39047. t.kcommaaccent = 556;
  39048. t.minus = 584;
  39049. t.Icircumflex = 278;
  39050. t.ncaron = 611;
  39051. t.tcommaaccent = 333;
  39052. t.logicalnot = 584;
  39053. t.odieresis = 611;
  39054. t.udieresis = 611;
  39055. t.notequal = 549;
  39056. t.gcommaaccent = 611;
  39057. t.eth = 611;
  39058. t.zcaron = 500;
  39059. t.ncommaaccent = 611;
  39060. t.onesuperior = 333;
  39061. t.imacron = 278;
  39062. t.Euro = 556;
  39063. });
  39064. t["Helvetica-Oblique"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39065. t.space = 278;
  39066. t.exclam = 278;
  39067. t.quotedbl = 355;
  39068. t.numbersign = 556;
  39069. t.dollar = 556;
  39070. t.percent = 889;
  39071. t.ampersand = 667;
  39072. t.quoteright = 222;
  39073. t.parenleft = 333;
  39074. t.parenright = 333;
  39075. t.asterisk = 389;
  39076. t.plus = 584;
  39077. t.comma = 278;
  39078. t.hyphen = 333;
  39079. t.period = 278;
  39080. t.slash = 278;
  39081. t.zero = 556;
  39082. t.one = 556;
  39083. t.two = 556;
  39084. t.three = 556;
  39085. t.four = 556;
  39086. t.five = 556;
  39087. t.six = 556;
  39088. t.seven = 556;
  39089. t.eight = 556;
  39090. t.nine = 556;
  39091. t.colon = 278;
  39092. t.semicolon = 278;
  39093. t.less = 584;
  39094. t.equal = 584;
  39095. t.greater = 584;
  39096. t.question = 556;
  39097. t.at = 1015;
  39098. t.A = 667;
  39099. t.B = 667;
  39100. t.C = 722;
  39101. t.D = 722;
  39102. t.E = 667;
  39103. t.F = 611;
  39104. t.G = 778;
  39105. t.H = 722;
  39106. t.I = 278;
  39107. t.J = 500;
  39108. t.K = 667;
  39109. t.L = 556;
  39110. t.M = 833;
  39111. t.N = 722;
  39112. t.O = 778;
  39113. t.P = 667;
  39114. t.Q = 778;
  39115. t.R = 722;
  39116. t.S = 667;
  39117. t.T = 611;
  39118. t.U = 722;
  39119. t.V = 667;
  39120. t.W = 944;
  39121. t.X = 667;
  39122. t.Y = 667;
  39123. t.Z = 611;
  39124. t.bracketleft = 278;
  39125. t.backslash = 278;
  39126. t.bracketright = 278;
  39127. t.asciicircum = 469;
  39128. t.underscore = 556;
  39129. t.quoteleft = 222;
  39130. t.a = 556;
  39131. t.b = 556;
  39132. t.c = 500;
  39133. t.d = 556;
  39134. t.e = 556;
  39135. t.f = 278;
  39136. t.g = 556;
  39137. t.h = 556;
  39138. t.i = 222;
  39139. t.j = 222;
  39140. t.k = 500;
  39141. t.l = 222;
  39142. t.m = 833;
  39143. t.n = 556;
  39144. t.o = 556;
  39145. t.p = 556;
  39146. t.q = 556;
  39147. t.r = 333;
  39148. t.s = 500;
  39149. t.t = 278;
  39150. t.u = 556;
  39151. t.v = 500;
  39152. t.w = 722;
  39153. t.x = 500;
  39154. t.y = 500;
  39155. t.z = 500;
  39156. t.braceleft = 334;
  39157. t.bar = 260;
  39158. t.braceright = 334;
  39159. t.asciitilde = 584;
  39160. t.exclamdown = 333;
  39161. t.cent = 556;
  39162. t.sterling = 556;
  39163. t.fraction = 167;
  39164. t.yen = 556;
  39165. t.florin = 556;
  39166. t.section = 556;
  39167. t.currency = 556;
  39168. t.quotesingle = 191;
  39169. t.quotedblleft = 333;
  39170. t.guillemotleft = 556;
  39171. t.guilsinglleft = 333;
  39172. t.guilsinglright = 333;
  39173. t.fi = 500;
  39174. t.fl = 500;
  39175. t.endash = 556;
  39176. t.dagger = 556;
  39177. t.daggerdbl = 556;
  39178. t.periodcentered = 278;
  39179. t.paragraph = 537;
  39180. t.bullet = 350;
  39181. t.quotesinglbase = 222;
  39182. t.quotedblbase = 333;
  39183. t.quotedblright = 333;
  39184. t.guillemotright = 556;
  39185. t.ellipsis = 1000;
  39186. t.perthousand = 1000;
  39187. t.questiondown = 611;
  39188. t.grave = 333;
  39189. t.acute = 333;
  39190. t.circumflex = 333;
  39191. t.tilde = 333;
  39192. t.macron = 333;
  39193. t.breve = 333;
  39194. t.dotaccent = 333;
  39195. t.dieresis = 333;
  39196. t.ring = 333;
  39197. t.cedilla = 333;
  39198. t.hungarumlaut = 333;
  39199. t.ogonek = 333;
  39200. t.caron = 333;
  39201. t.emdash = 1000;
  39202. t.AE = 1000;
  39203. t.ordfeminine = 370;
  39204. t.Lslash = 556;
  39205. t.Oslash = 778;
  39206. t.OE = 1000;
  39207. t.ordmasculine = 365;
  39208. t.ae = 889;
  39209. t.dotlessi = 278;
  39210. t.lslash = 222;
  39211. t.oslash = 611;
  39212. t.oe = 944;
  39213. t.germandbls = 611;
  39214. t.Idieresis = 278;
  39215. t.eacute = 556;
  39216. t.abreve = 556;
  39217. t.uhungarumlaut = 556;
  39218. t.ecaron = 556;
  39219. t.Ydieresis = 667;
  39220. t.divide = 584;
  39221. t.Yacute = 667;
  39222. t.Acircumflex = 667;
  39223. t.aacute = 556;
  39224. t.Ucircumflex = 722;
  39225. t.yacute = 500;
  39226. t.scommaaccent = 500;
  39227. t.ecircumflex = 556;
  39228. t.Uring = 722;
  39229. t.Udieresis = 722;
  39230. t.aogonek = 556;
  39231. t.Uacute = 722;
  39232. t.uogonek = 556;
  39233. t.Edieresis = 667;
  39234. t.Dcroat = 722;
  39235. t.commaaccent = 250;
  39236. t.copyright = 737;
  39237. t.Emacron = 667;
  39238. t.ccaron = 500;
  39239. t.aring = 556;
  39240. t.Ncommaaccent = 722;
  39241. t.lacute = 222;
  39242. t.agrave = 556;
  39243. t.Tcommaaccent = 611;
  39244. t.Cacute = 722;
  39245. t.atilde = 556;
  39246. t.Edotaccent = 667;
  39247. t.scaron = 500;
  39248. t.scedilla = 500;
  39249. t.iacute = 278;
  39250. t.lozenge = 471;
  39251. t.Rcaron = 722;
  39252. t.Gcommaaccent = 778;
  39253. t.ucircumflex = 556;
  39254. t.acircumflex = 556;
  39255. t.Amacron = 667;
  39256. t.rcaron = 333;
  39257. t.ccedilla = 500;
  39258. t.Zdotaccent = 611;
  39259. t.Thorn = 667;
  39260. t.Omacron = 778;
  39261. t.Racute = 722;
  39262. t.Sacute = 667;
  39263. t.dcaron = 643;
  39264. t.Umacron = 722;
  39265. t.uring = 556;
  39266. t.threesuperior = 333;
  39267. t.Ograve = 778;
  39268. t.Agrave = 667;
  39269. t.Abreve = 667;
  39270. t.multiply = 584;
  39271. t.uacute = 556;
  39272. t.Tcaron = 611;
  39273. t.partialdiff = 476;
  39274. t.ydieresis = 500;
  39275. t.Nacute = 722;
  39276. t.icircumflex = 278;
  39277. t.Ecircumflex = 667;
  39278. t.adieresis = 556;
  39279. t.edieresis = 556;
  39280. t.cacute = 500;
  39281. t.nacute = 556;
  39282. t.umacron = 556;
  39283. t.Ncaron = 722;
  39284. t.Iacute = 278;
  39285. t.plusminus = 584;
  39286. t.brokenbar = 260;
  39287. t.registered = 737;
  39288. t.Gbreve = 778;
  39289. t.Idotaccent = 278;
  39290. t.summation = 600;
  39291. t.Egrave = 667;
  39292. t.racute = 333;
  39293. t.omacron = 556;
  39294. t.Zacute = 611;
  39295. t.Zcaron = 611;
  39296. t.greaterequal = 549;
  39297. t.Eth = 722;
  39298. t.Ccedilla = 722;
  39299. t.lcommaaccent = 222;
  39300. t.tcaron = 317;
  39301. t.eogonek = 556;
  39302. t.Uogonek = 722;
  39303. t.Aacute = 667;
  39304. t.Adieresis = 667;
  39305. t.egrave = 556;
  39306. t.zacute = 500;
  39307. t.iogonek = 222;
  39308. t.Oacute = 778;
  39309. t.oacute = 556;
  39310. t.amacron = 556;
  39311. t.sacute = 500;
  39312. t.idieresis = 278;
  39313. t.Ocircumflex = 778;
  39314. t.Ugrave = 722;
  39315. t.Delta = 612;
  39316. t.thorn = 556;
  39317. t.twosuperior = 333;
  39318. t.Odieresis = 778;
  39319. t.mu = 556;
  39320. t.igrave = 278;
  39321. t.ohungarumlaut = 556;
  39322. t.Eogonek = 667;
  39323. t.dcroat = 556;
  39324. t.threequarters = 834;
  39325. t.Scedilla = 667;
  39326. t.lcaron = 299;
  39327. t.Kcommaaccent = 667;
  39328. t.Lacute = 556;
  39329. t.trademark = 1000;
  39330. t.edotaccent = 556;
  39331. t.Igrave = 278;
  39332. t.Imacron = 278;
  39333. t.Lcaron = 556;
  39334. t.onehalf = 834;
  39335. t.lessequal = 549;
  39336. t.ocircumflex = 556;
  39337. t.ntilde = 556;
  39338. t.Uhungarumlaut = 722;
  39339. t.Eacute = 667;
  39340. t.emacron = 556;
  39341. t.gbreve = 556;
  39342. t.onequarter = 834;
  39343. t.Scaron = 667;
  39344. t.Scommaaccent = 667;
  39345. t.Ohungarumlaut = 778;
  39346. t.degree = 400;
  39347. t.ograve = 556;
  39348. t.Ccaron = 722;
  39349. t.ugrave = 556;
  39350. t.radical = 453;
  39351. t.Dcaron = 722;
  39352. t.rcommaaccent = 333;
  39353. t.Ntilde = 722;
  39354. t.otilde = 556;
  39355. t.Rcommaaccent = 722;
  39356. t.Lcommaaccent = 556;
  39357. t.Atilde = 667;
  39358. t.Aogonek = 667;
  39359. t.Aring = 667;
  39360. t.Otilde = 778;
  39361. t.zdotaccent = 500;
  39362. t.Ecaron = 667;
  39363. t.Iogonek = 278;
  39364. t.kcommaaccent = 500;
  39365. t.minus = 584;
  39366. t.Icircumflex = 278;
  39367. t.ncaron = 556;
  39368. t.tcommaaccent = 278;
  39369. t.logicalnot = 584;
  39370. t.odieresis = 556;
  39371. t.udieresis = 556;
  39372. t.notequal = 549;
  39373. t.gcommaaccent = 556;
  39374. t.eth = 556;
  39375. t.zcaron = 500;
  39376. t.ncommaaccent = 556;
  39377. t.onesuperior = 333;
  39378. t.imacron = 278;
  39379. t.Euro = 556;
  39380. });
  39381. t.Symbol = (0, _core_utils.getLookupTableFactory)(function (t) {
  39382. t.space = 250;
  39383. t.exclam = 333;
  39384. t.universal = 713;
  39385. t.numbersign = 500;
  39386. t.existential = 549;
  39387. t.percent = 833;
  39388. t.ampersand = 778;
  39389. t.suchthat = 439;
  39390. t.parenleft = 333;
  39391. t.parenright = 333;
  39392. t.asteriskmath = 500;
  39393. t.plus = 549;
  39394. t.comma = 250;
  39395. t.minus = 549;
  39396. t.period = 250;
  39397. t.slash = 278;
  39398. t.zero = 500;
  39399. t.one = 500;
  39400. t.two = 500;
  39401. t.three = 500;
  39402. t.four = 500;
  39403. t.five = 500;
  39404. t.six = 500;
  39405. t.seven = 500;
  39406. t.eight = 500;
  39407. t.nine = 500;
  39408. t.colon = 278;
  39409. t.semicolon = 278;
  39410. t.less = 549;
  39411. t.equal = 549;
  39412. t.greater = 549;
  39413. t.question = 444;
  39414. t.congruent = 549;
  39415. t.Alpha = 722;
  39416. t.Beta = 667;
  39417. t.Chi = 722;
  39418. t.Delta = 612;
  39419. t.Epsilon = 611;
  39420. t.Phi = 763;
  39421. t.Gamma = 603;
  39422. t.Eta = 722;
  39423. t.Iota = 333;
  39424. t.theta1 = 631;
  39425. t.Kappa = 722;
  39426. t.Lambda = 686;
  39427. t.Mu = 889;
  39428. t.Nu = 722;
  39429. t.Omicron = 722;
  39430. t.Pi = 768;
  39431. t.Theta = 741;
  39432. t.Rho = 556;
  39433. t.Sigma = 592;
  39434. t.Tau = 611;
  39435. t.Upsilon = 690;
  39436. t.sigma1 = 439;
  39437. t.Omega = 768;
  39438. t.Xi = 645;
  39439. t.Psi = 795;
  39440. t.Zeta = 611;
  39441. t.bracketleft = 333;
  39442. t.therefore = 863;
  39443. t.bracketright = 333;
  39444. t.perpendicular = 658;
  39445. t.underscore = 500;
  39446. t.radicalex = 500;
  39447. t.alpha = 631;
  39448. t.beta = 549;
  39449. t.chi = 549;
  39450. t.delta = 494;
  39451. t.epsilon = 439;
  39452. t.phi = 521;
  39453. t.gamma = 411;
  39454. t.eta = 603;
  39455. t.iota = 329;
  39456. t.phi1 = 603;
  39457. t.kappa = 549;
  39458. t.lambda = 549;
  39459. t.mu = 576;
  39460. t.nu = 521;
  39461. t.omicron = 549;
  39462. t.pi = 549;
  39463. t.theta = 521;
  39464. t.rho = 549;
  39465. t.sigma = 603;
  39466. t.tau = 439;
  39467. t.upsilon = 576;
  39468. t.omega1 = 713;
  39469. t.omega = 686;
  39470. t.xi = 493;
  39471. t.psi = 686;
  39472. t.zeta = 494;
  39473. t.braceleft = 480;
  39474. t.bar = 200;
  39475. t.braceright = 480;
  39476. t.similar = 549;
  39477. t.Euro = 750;
  39478. t.Upsilon1 = 620;
  39479. t.minute = 247;
  39480. t.lessequal = 549;
  39481. t.fraction = 167;
  39482. t.infinity = 713;
  39483. t.florin = 500;
  39484. t.club = 753;
  39485. t.diamond = 753;
  39486. t.heart = 753;
  39487. t.spade = 753;
  39488. t.arrowboth = 1042;
  39489. t.arrowleft = 987;
  39490. t.arrowup = 603;
  39491. t.arrowright = 987;
  39492. t.arrowdown = 603;
  39493. t.degree = 400;
  39494. t.plusminus = 549;
  39495. t.second = 411;
  39496. t.greaterequal = 549;
  39497. t.multiply = 549;
  39498. t.proportional = 713;
  39499. t.partialdiff = 494;
  39500. t.bullet = 460;
  39501. t.divide = 549;
  39502. t.notequal = 549;
  39503. t.equivalence = 549;
  39504. t.approxequal = 549;
  39505. t.ellipsis = 1000;
  39506. t.arrowvertex = 603;
  39507. t.arrowhorizex = 1000;
  39508. t.carriagereturn = 658;
  39509. t.aleph = 823;
  39510. t.Ifraktur = 686;
  39511. t.Rfraktur = 795;
  39512. t.weierstrass = 987;
  39513. t.circlemultiply = 768;
  39514. t.circleplus = 768;
  39515. t.emptyset = 823;
  39516. t.intersection = 768;
  39517. t.union = 768;
  39518. t.propersuperset = 713;
  39519. t.reflexsuperset = 713;
  39520. t.notsubset = 713;
  39521. t.propersubset = 713;
  39522. t.reflexsubset = 713;
  39523. t.element = 713;
  39524. t.notelement = 713;
  39525. t.angle = 768;
  39526. t.gradient = 713;
  39527. t.registerserif = 790;
  39528. t.copyrightserif = 790;
  39529. t.trademarkserif = 890;
  39530. t.product = 823;
  39531. t.radical = 549;
  39532. t.dotmath = 250;
  39533. t.logicalnot = 713;
  39534. t.logicaland = 603;
  39535. t.logicalor = 603;
  39536. t.arrowdblboth = 1042;
  39537. t.arrowdblleft = 987;
  39538. t.arrowdblup = 603;
  39539. t.arrowdblright = 987;
  39540. t.arrowdbldown = 603;
  39541. t.lozenge = 494;
  39542. t.angleleft = 329;
  39543. t.registersans = 790;
  39544. t.copyrightsans = 790;
  39545. t.trademarksans = 786;
  39546. t.summation = 713;
  39547. t.parenlefttp = 384;
  39548. t.parenleftex = 384;
  39549. t.parenleftbt = 384;
  39550. t.bracketlefttp = 384;
  39551. t.bracketleftex = 384;
  39552. t.bracketleftbt = 384;
  39553. t.bracelefttp = 494;
  39554. t.braceleftmid = 494;
  39555. t.braceleftbt = 494;
  39556. t.braceex = 494;
  39557. t.angleright = 329;
  39558. t.integral = 274;
  39559. t.integraltp = 686;
  39560. t.integralex = 686;
  39561. t.integralbt = 686;
  39562. t.parenrighttp = 384;
  39563. t.parenrightex = 384;
  39564. t.parenrightbt = 384;
  39565. t.bracketrighttp = 384;
  39566. t.bracketrightex = 384;
  39567. t.bracketrightbt = 384;
  39568. t.bracerighttp = 494;
  39569. t.bracerightmid = 494;
  39570. t.bracerightbt = 494;
  39571. t.apple = 790;
  39572. });
  39573. t["Times-Roman"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39574. t.space = 250;
  39575. t.exclam = 333;
  39576. t.quotedbl = 408;
  39577. t.numbersign = 500;
  39578. t.dollar = 500;
  39579. t.percent = 833;
  39580. t.ampersand = 778;
  39581. t.quoteright = 333;
  39582. t.parenleft = 333;
  39583. t.parenright = 333;
  39584. t.asterisk = 500;
  39585. t.plus = 564;
  39586. t.comma = 250;
  39587. t.hyphen = 333;
  39588. t.period = 250;
  39589. t.slash = 278;
  39590. t.zero = 500;
  39591. t.one = 500;
  39592. t.two = 500;
  39593. t.three = 500;
  39594. t.four = 500;
  39595. t.five = 500;
  39596. t.six = 500;
  39597. t.seven = 500;
  39598. t.eight = 500;
  39599. t.nine = 500;
  39600. t.colon = 278;
  39601. t.semicolon = 278;
  39602. t.less = 564;
  39603. t.equal = 564;
  39604. t.greater = 564;
  39605. t.question = 444;
  39606. t.at = 921;
  39607. t.A = 722;
  39608. t.B = 667;
  39609. t.C = 667;
  39610. t.D = 722;
  39611. t.E = 611;
  39612. t.F = 556;
  39613. t.G = 722;
  39614. t.H = 722;
  39615. t.I = 333;
  39616. t.J = 389;
  39617. t.K = 722;
  39618. t.L = 611;
  39619. t.M = 889;
  39620. t.N = 722;
  39621. t.O = 722;
  39622. t.P = 556;
  39623. t.Q = 722;
  39624. t.R = 667;
  39625. t.S = 556;
  39626. t.T = 611;
  39627. t.U = 722;
  39628. t.V = 722;
  39629. t.W = 944;
  39630. t.X = 722;
  39631. t.Y = 722;
  39632. t.Z = 611;
  39633. t.bracketleft = 333;
  39634. t.backslash = 278;
  39635. t.bracketright = 333;
  39636. t.asciicircum = 469;
  39637. t.underscore = 500;
  39638. t.quoteleft = 333;
  39639. t.a = 444;
  39640. t.b = 500;
  39641. t.c = 444;
  39642. t.d = 500;
  39643. t.e = 444;
  39644. t.f = 333;
  39645. t.g = 500;
  39646. t.h = 500;
  39647. t.i = 278;
  39648. t.j = 278;
  39649. t.k = 500;
  39650. t.l = 278;
  39651. t.m = 778;
  39652. t.n = 500;
  39653. t.o = 500;
  39654. t.p = 500;
  39655. t.q = 500;
  39656. t.r = 333;
  39657. t.s = 389;
  39658. t.t = 278;
  39659. t.u = 500;
  39660. t.v = 500;
  39661. t.w = 722;
  39662. t.x = 500;
  39663. t.y = 500;
  39664. t.z = 444;
  39665. t.braceleft = 480;
  39666. t.bar = 200;
  39667. t.braceright = 480;
  39668. t.asciitilde = 541;
  39669. t.exclamdown = 333;
  39670. t.cent = 500;
  39671. t.sterling = 500;
  39672. t.fraction = 167;
  39673. t.yen = 500;
  39674. t.florin = 500;
  39675. t.section = 500;
  39676. t.currency = 500;
  39677. t.quotesingle = 180;
  39678. t.quotedblleft = 444;
  39679. t.guillemotleft = 500;
  39680. t.guilsinglleft = 333;
  39681. t.guilsinglright = 333;
  39682. t.fi = 556;
  39683. t.fl = 556;
  39684. t.endash = 500;
  39685. t.dagger = 500;
  39686. t.daggerdbl = 500;
  39687. t.periodcentered = 250;
  39688. t.paragraph = 453;
  39689. t.bullet = 350;
  39690. t.quotesinglbase = 333;
  39691. t.quotedblbase = 444;
  39692. t.quotedblright = 444;
  39693. t.guillemotright = 500;
  39694. t.ellipsis = 1000;
  39695. t.perthousand = 1000;
  39696. t.questiondown = 444;
  39697. t.grave = 333;
  39698. t.acute = 333;
  39699. t.circumflex = 333;
  39700. t.tilde = 333;
  39701. t.macron = 333;
  39702. t.breve = 333;
  39703. t.dotaccent = 333;
  39704. t.dieresis = 333;
  39705. t.ring = 333;
  39706. t.cedilla = 333;
  39707. t.hungarumlaut = 333;
  39708. t.ogonek = 333;
  39709. t.caron = 333;
  39710. t.emdash = 1000;
  39711. t.AE = 889;
  39712. t.ordfeminine = 276;
  39713. t.Lslash = 611;
  39714. t.Oslash = 722;
  39715. t.OE = 889;
  39716. t.ordmasculine = 310;
  39717. t.ae = 667;
  39718. t.dotlessi = 278;
  39719. t.lslash = 278;
  39720. t.oslash = 500;
  39721. t.oe = 722;
  39722. t.germandbls = 500;
  39723. t.Idieresis = 333;
  39724. t.eacute = 444;
  39725. t.abreve = 444;
  39726. t.uhungarumlaut = 500;
  39727. t.ecaron = 444;
  39728. t.Ydieresis = 722;
  39729. t.divide = 564;
  39730. t.Yacute = 722;
  39731. t.Acircumflex = 722;
  39732. t.aacute = 444;
  39733. t.Ucircumflex = 722;
  39734. t.yacute = 500;
  39735. t.scommaaccent = 389;
  39736. t.ecircumflex = 444;
  39737. t.Uring = 722;
  39738. t.Udieresis = 722;
  39739. t.aogonek = 444;
  39740. t.Uacute = 722;
  39741. t.uogonek = 500;
  39742. t.Edieresis = 611;
  39743. t.Dcroat = 722;
  39744. t.commaaccent = 250;
  39745. t.copyright = 760;
  39746. t.Emacron = 611;
  39747. t.ccaron = 444;
  39748. t.aring = 444;
  39749. t.Ncommaaccent = 722;
  39750. t.lacute = 278;
  39751. t.agrave = 444;
  39752. t.Tcommaaccent = 611;
  39753. t.Cacute = 667;
  39754. t.atilde = 444;
  39755. t.Edotaccent = 611;
  39756. t.scaron = 389;
  39757. t.scedilla = 389;
  39758. t.iacute = 278;
  39759. t.lozenge = 471;
  39760. t.Rcaron = 667;
  39761. t.Gcommaaccent = 722;
  39762. t.ucircumflex = 500;
  39763. t.acircumflex = 444;
  39764. t.Amacron = 722;
  39765. t.rcaron = 333;
  39766. t.ccedilla = 444;
  39767. t.Zdotaccent = 611;
  39768. t.Thorn = 556;
  39769. t.Omacron = 722;
  39770. t.Racute = 667;
  39771. t.Sacute = 556;
  39772. t.dcaron = 588;
  39773. t.Umacron = 722;
  39774. t.uring = 500;
  39775. t.threesuperior = 300;
  39776. t.Ograve = 722;
  39777. t.Agrave = 722;
  39778. t.Abreve = 722;
  39779. t.multiply = 564;
  39780. t.uacute = 500;
  39781. t.Tcaron = 611;
  39782. t.partialdiff = 476;
  39783. t.ydieresis = 500;
  39784. t.Nacute = 722;
  39785. t.icircumflex = 278;
  39786. t.Ecircumflex = 611;
  39787. t.adieresis = 444;
  39788. t.edieresis = 444;
  39789. t.cacute = 444;
  39790. t.nacute = 500;
  39791. t.umacron = 500;
  39792. t.Ncaron = 722;
  39793. t.Iacute = 333;
  39794. t.plusminus = 564;
  39795. t.brokenbar = 200;
  39796. t.registered = 760;
  39797. t.Gbreve = 722;
  39798. t.Idotaccent = 333;
  39799. t.summation = 600;
  39800. t.Egrave = 611;
  39801. t.racute = 333;
  39802. t.omacron = 500;
  39803. t.Zacute = 611;
  39804. t.Zcaron = 611;
  39805. t.greaterequal = 549;
  39806. t.Eth = 722;
  39807. t.Ccedilla = 667;
  39808. t.lcommaaccent = 278;
  39809. t.tcaron = 326;
  39810. t.eogonek = 444;
  39811. t.Uogonek = 722;
  39812. t.Aacute = 722;
  39813. t.Adieresis = 722;
  39814. t.egrave = 444;
  39815. t.zacute = 444;
  39816. t.iogonek = 278;
  39817. t.Oacute = 722;
  39818. t.oacute = 500;
  39819. t.amacron = 444;
  39820. t.sacute = 389;
  39821. t.idieresis = 278;
  39822. t.Ocircumflex = 722;
  39823. t.Ugrave = 722;
  39824. t.Delta = 612;
  39825. t.thorn = 500;
  39826. t.twosuperior = 300;
  39827. t.Odieresis = 722;
  39828. t.mu = 500;
  39829. t.igrave = 278;
  39830. t.ohungarumlaut = 500;
  39831. t.Eogonek = 611;
  39832. t.dcroat = 500;
  39833. t.threequarters = 750;
  39834. t.Scedilla = 556;
  39835. t.lcaron = 344;
  39836. t.Kcommaaccent = 722;
  39837. t.Lacute = 611;
  39838. t.trademark = 980;
  39839. t.edotaccent = 444;
  39840. t.Igrave = 333;
  39841. t.Imacron = 333;
  39842. t.Lcaron = 611;
  39843. t.onehalf = 750;
  39844. t.lessequal = 549;
  39845. t.ocircumflex = 500;
  39846. t.ntilde = 500;
  39847. t.Uhungarumlaut = 722;
  39848. t.Eacute = 611;
  39849. t.emacron = 444;
  39850. t.gbreve = 500;
  39851. t.onequarter = 750;
  39852. t.Scaron = 556;
  39853. t.Scommaaccent = 556;
  39854. t.Ohungarumlaut = 722;
  39855. t.degree = 400;
  39856. t.ograve = 500;
  39857. t.Ccaron = 667;
  39858. t.ugrave = 500;
  39859. t.radical = 453;
  39860. t.Dcaron = 722;
  39861. t.rcommaaccent = 333;
  39862. t.Ntilde = 722;
  39863. t.otilde = 500;
  39864. t.Rcommaaccent = 667;
  39865. t.Lcommaaccent = 611;
  39866. t.Atilde = 722;
  39867. t.Aogonek = 722;
  39868. t.Aring = 722;
  39869. t.Otilde = 722;
  39870. t.zdotaccent = 444;
  39871. t.Ecaron = 611;
  39872. t.Iogonek = 333;
  39873. t.kcommaaccent = 500;
  39874. t.minus = 564;
  39875. t.Icircumflex = 333;
  39876. t.ncaron = 500;
  39877. t.tcommaaccent = 278;
  39878. t.logicalnot = 564;
  39879. t.odieresis = 500;
  39880. t.udieresis = 500;
  39881. t.notequal = 549;
  39882. t.gcommaaccent = 500;
  39883. t.eth = 500;
  39884. t.zcaron = 444;
  39885. t.ncommaaccent = 500;
  39886. t.onesuperior = 300;
  39887. t.imacron = 278;
  39888. t.Euro = 500;
  39889. });
  39890. t["Times-Bold"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  39891. t.space = 250;
  39892. t.exclam = 333;
  39893. t.quotedbl = 555;
  39894. t.numbersign = 500;
  39895. t.dollar = 500;
  39896. t.percent = 1000;
  39897. t.ampersand = 833;
  39898. t.quoteright = 333;
  39899. t.parenleft = 333;
  39900. t.parenright = 333;
  39901. t.asterisk = 500;
  39902. t.plus = 570;
  39903. t.comma = 250;
  39904. t.hyphen = 333;
  39905. t.period = 250;
  39906. t.slash = 278;
  39907. t.zero = 500;
  39908. t.one = 500;
  39909. t.two = 500;
  39910. t.three = 500;
  39911. t.four = 500;
  39912. t.five = 500;
  39913. t.six = 500;
  39914. t.seven = 500;
  39915. t.eight = 500;
  39916. t.nine = 500;
  39917. t.colon = 333;
  39918. t.semicolon = 333;
  39919. t.less = 570;
  39920. t.equal = 570;
  39921. t.greater = 570;
  39922. t.question = 500;
  39923. t.at = 930;
  39924. t.A = 722;
  39925. t.B = 667;
  39926. t.C = 722;
  39927. t.D = 722;
  39928. t.E = 667;
  39929. t.F = 611;
  39930. t.G = 778;
  39931. t.H = 778;
  39932. t.I = 389;
  39933. t.J = 500;
  39934. t.K = 778;
  39935. t.L = 667;
  39936. t.M = 944;
  39937. t.N = 722;
  39938. t.O = 778;
  39939. t.P = 611;
  39940. t.Q = 778;
  39941. t.R = 722;
  39942. t.S = 556;
  39943. t.T = 667;
  39944. t.U = 722;
  39945. t.V = 722;
  39946. t.W = 1000;
  39947. t.X = 722;
  39948. t.Y = 722;
  39949. t.Z = 667;
  39950. t.bracketleft = 333;
  39951. t.backslash = 278;
  39952. t.bracketright = 333;
  39953. t.asciicircum = 581;
  39954. t.underscore = 500;
  39955. t.quoteleft = 333;
  39956. t.a = 500;
  39957. t.b = 556;
  39958. t.c = 444;
  39959. t.d = 556;
  39960. t.e = 444;
  39961. t.f = 333;
  39962. t.g = 500;
  39963. t.h = 556;
  39964. t.i = 278;
  39965. t.j = 333;
  39966. t.k = 556;
  39967. t.l = 278;
  39968. t.m = 833;
  39969. t.n = 556;
  39970. t.o = 500;
  39971. t.p = 556;
  39972. t.q = 556;
  39973. t.r = 444;
  39974. t.s = 389;
  39975. t.t = 333;
  39976. t.u = 556;
  39977. t.v = 500;
  39978. t.w = 722;
  39979. t.x = 500;
  39980. t.y = 500;
  39981. t.z = 444;
  39982. t.braceleft = 394;
  39983. t.bar = 220;
  39984. t.braceright = 394;
  39985. t.asciitilde = 520;
  39986. t.exclamdown = 333;
  39987. t.cent = 500;
  39988. t.sterling = 500;
  39989. t.fraction = 167;
  39990. t.yen = 500;
  39991. t.florin = 500;
  39992. t.section = 500;
  39993. t.currency = 500;
  39994. t.quotesingle = 278;
  39995. t.quotedblleft = 500;
  39996. t.guillemotleft = 500;
  39997. t.guilsinglleft = 333;
  39998. t.guilsinglright = 333;
  39999. t.fi = 556;
  40000. t.fl = 556;
  40001. t.endash = 500;
  40002. t.dagger = 500;
  40003. t.daggerdbl = 500;
  40004. t.periodcentered = 250;
  40005. t.paragraph = 540;
  40006. t.bullet = 350;
  40007. t.quotesinglbase = 333;
  40008. t.quotedblbase = 500;
  40009. t.quotedblright = 500;
  40010. t.guillemotright = 500;
  40011. t.ellipsis = 1000;
  40012. t.perthousand = 1000;
  40013. t.questiondown = 500;
  40014. t.grave = 333;
  40015. t.acute = 333;
  40016. t.circumflex = 333;
  40017. t.tilde = 333;
  40018. t.macron = 333;
  40019. t.breve = 333;
  40020. t.dotaccent = 333;
  40021. t.dieresis = 333;
  40022. t.ring = 333;
  40023. t.cedilla = 333;
  40024. t.hungarumlaut = 333;
  40025. t.ogonek = 333;
  40026. t.caron = 333;
  40027. t.emdash = 1000;
  40028. t.AE = 1000;
  40029. t.ordfeminine = 300;
  40030. t.Lslash = 667;
  40031. t.Oslash = 778;
  40032. t.OE = 1000;
  40033. t.ordmasculine = 330;
  40034. t.ae = 722;
  40035. t.dotlessi = 278;
  40036. t.lslash = 278;
  40037. t.oslash = 500;
  40038. t.oe = 722;
  40039. t.germandbls = 556;
  40040. t.Idieresis = 389;
  40041. t.eacute = 444;
  40042. t.abreve = 500;
  40043. t.uhungarumlaut = 556;
  40044. t.ecaron = 444;
  40045. t.Ydieresis = 722;
  40046. t.divide = 570;
  40047. t.Yacute = 722;
  40048. t.Acircumflex = 722;
  40049. t.aacute = 500;
  40050. t.Ucircumflex = 722;
  40051. t.yacute = 500;
  40052. t.scommaaccent = 389;
  40053. t.ecircumflex = 444;
  40054. t.Uring = 722;
  40055. t.Udieresis = 722;
  40056. t.aogonek = 500;
  40057. t.Uacute = 722;
  40058. t.uogonek = 556;
  40059. t.Edieresis = 667;
  40060. t.Dcroat = 722;
  40061. t.commaaccent = 250;
  40062. t.copyright = 747;
  40063. t.Emacron = 667;
  40064. t.ccaron = 444;
  40065. t.aring = 500;
  40066. t.Ncommaaccent = 722;
  40067. t.lacute = 278;
  40068. t.agrave = 500;
  40069. t.Tcommaaccent = 667;
  40070. t.Cacute = 722;
  40071. t.atilde = 500;
  40072. t.Edotaccent = 667;
  40073. t.scaron = 389;
  40074. t.scedilla = 389;
  40075. t.iacute = 278;
  40076. t.lozenge = 494;
  40077. t.Rcaron = 722;
  40078. t.Gcommaaccent = 778;
  40079. t.ucircumflex = 556;
  40080. t.acircumflex = 500;
  40081. t.Amacron = 722;
  40082. t.rcaron = 444;
  40083. t.ccedilla = 444;
  40084. t.Zdotaccent = 667;
  40085. t.Thorn = 611;
  40086. t.Omacron = 778;
  40087. t.Racute = 722;
  40088. t.Sacute = 556;
  40089. t.dcaron = 672;
  40090. t.Umacron = 722;
  40091. t.uring = 556;
  40092. t.threesuperior = 300;
  40093. t.Ograve = 778;
  40094. t.Agrave = 722;
  40095. t.Abreve = 722;
  40096. t.multiply = 570;
  40097. t.uacute = 556;
  40098. t.Tcaron = 667;
  40099. t.partialdiff = 494;
  40100. t.ydieresis = 500;
  40101. t.Nacute = 722;
  40102. t.icircumflex = 278;
  40103. t.Ecircumflex = 667;
  40104. t.adieresis = 500;
  40105. t.edieresis = 444;
  40106. t.cacute = 444;
  40107. t.nacute = 556;
  40108. t.umacron = 556;
  40109. t.Ncaron = 722;
  40110. t.Iacute = 389;
  40111. t.plusminus = 570;
  40112. t.brokenbar = 220;
  40113. t.registered = 747;
  40114. t.Gbreve = 778;
  40115. t.Idotaccent = 389;
  40116. t.summation = 600;
  40117. t.Egrave = 667;
  40118. t.racute = 444;
  40119. t.omacron = 500;
  40120. t.Zacute = 667;
  40121. t.Zcaron = 667;
  40122. t.greaterequal = 549;
  40123. t.Eth = 722;
  40124. t.Ccedilla = 722;
  40125. t.lcommaaccent = 278;
  40126. t.tcaron = 416;
  40127. t.eogonek = 444;
  40128. t.Uogonek = 722;
  40129. t.Aacute = 722;
  40130. t.Adieresis = 722;
  40131. t.egrave = 444;
  40132. t.zacute = 444;
  40133. t.iogonek = 278;
  40134. t.Oacute = 778;
  40135. t.oacute = 500;
  40136. t.amacron = 500;
  40137. t.sacute = 389;
  40138. t.idieresis = 278;
  40139. t.Ocircumflex = 778;
  40140. t.Ugrave = 722;
  40141. t.Delta = 612;
  40142. t.thorn = 556;
  40143. t.twosuperior = 300;
  40144. t.Odieresis = 778;
  40145. t.mu = 556;
  40146. t.igrave = 278;
  40147. t.ohungarumlaut = 500;
  40148. t.Eogonek = 667;
  40149. t.dcroat = 556;
  40150. t.threequarters = 750;
  40151. t.Scedilla = 556;
  40152. t.lcaron = 394;
  40153. t.Kcommaaccent = 778;
  40154. t.Lacute = 667;
  40155. t.trademark = 1000;
  40156. t.edotaccent = 444;
  40157. t.Igrave = 389;
  40158. t.Imacron = 389;
  40159. t.Lcaron = 667;
  40160. t.onehalf = 750;
  40161. t.lessequal = 549;
  40162. t.ocircumflex = 500;
  40163. t.ntilde = 556;
  40164. t.Uhungarumlaut = 722;
  40165. t.Eacute = 667;
  40166. t.emacron = 444;
  40167. t.gbreve = 500;
  40168. t.onequarter = 750;
  40169. t.Scaron = 556;
  40170. t.Scommaaccent = 556;
  40171. t.Ohungarumlaut = 778;
  40172. t.degree = 400;
  40173. t.ograve = 500;
  40174. t.Ccaron = 722;
  40175. t.ugrave = 556;
  40176. t.radical = 549;
  40177. t.Dcaron = 722;
  40178. t.rcommaaccent = 444;
  40179. t.Ntilde = 722;
  40180. t.otilde = 500;
  40181. t.Rcommaaccent = 722;
  40182. t.Lcommaaccent = 667;
  40183. t.Atilde = 722;
  40184. t.Aogonek = 722;
  40185. t.Aring = 722;
  40186. t.Otilde = 778;
  40187. t.zdotaccent = 444;
  40188. t.Ecaron = 667;
  40189. t.Iogonek = 389;
  40190. t.kcommaaccent = 556;
  40191. t.minus = 570;
  40192. t.Icircumflex = 389;
  40193. t.ncaron = 556;
  40194. t.tcommaaccent = 333;
  40195. t.logicalnot = 570;
  40196. t.odieresis = 500;
  40197. t.udieresis = 556;
  40198. t.notequal = 549;
  40199. t.gcommaaccent = 500;
  40200. t.eth = 500;
  40201. t.zcaron = 444;
  40202. t.ncommaaccent = 556;
  40203. t.onesuperior = 300;
  40204. t.imacron = 278;
  40205. t.Euro = 500;
  40206. });
  40207. t["Times-BoldItalic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40208. t.space = 250;
  40209. t.exclam = 389;
  40210. t.quotedbl = 555;
  40211. t.numbersign = 500;
  40212. t.dollar = 500;
  40213. t.percent = 833;
  40214. t.ampersand = 778;
  40215. t.quoteright = 333;
  40216. t.parenleft = 333;
  40217. t.parenright = 333;
  40218. t.asterisk = 500;
  40219. t.plus = 570;
  40220. t.comma = 250;
  40221. t.hyphen = 333;
  40222. t.period = 250;
  40223. t.slash = 278;
  40224. t.zero = 500;
  40225. t.one = 500;
  40226. t.two = 500;
  40227. t.three = 500;
  40228. t.four = 500;
  40229. t.five = 500;
  40230. t.six = 500;
  40231. t.seven = 500;
  40232. t.eight = 500;
  40233. t.nine = 500;
  40234. t.colon = 333;
  40235. t.semicolon = 333;
  40236. t.less = 570;
  40237. t.equal = 570;
  40238. t.greater = 570;
  40239. t.question = 500;
  40240. t.at = 832;
  40241. t.A = 667;
  40242. t.B = 667;
  40243. t.C = 667;
  40244. t.D = 722;
  40245. t.E = 667;
  40246. t.F = 667;
  40247. t.G = 722;
  40248. t.H = 778;
  40249. t.I = 389;
  40250. t.J = 500;
  40251. t.K = 667;
  40252. t.L = 611;
  40253. t.M = 889;
  40254. t.N = 722;
  40255. t.O = 722;
  40256. t.P = 611;
  40257. t.Q = 722;
  40258. t.R = 667;
  40259. t.S = 556;
  40260. t.T = 611;
  40261. t.U = 722;
  40262. t.V = 667;
  40263. t.W = 889;
  40264. t.X = 667;
  40265. t.Y = 611;
  40266. t.Z = 611;
  40267. t.bracketleft = 333;
  40268. t.backslash = 278;
  40269. t.bracketright = 333;
  40270. t.asciicircum = 570;
  40271. t.underscore = 500;
  40272. t.quoteleft = 333;
  40273. t.a = 500;
  40274. t.b = 500;
  40275. t.c = 444;
  40276. t.d = 500;
  40277. t.e = 444;
  40278. t.f = 333;
  40279. t.g = 500;
  40280. t.h = 556;
  40281. t.i = 278;
  40282. t.j = 278;
  40283. t.k = 500;
  40284. t.l = 278;
  40285. t.m = 778;
  40286. t.n = 556;
  40287. t.o = 500;
  40288. t.p = 500;
  40289. t.q = 500;
  40290. t.r = 389;
  40291. t.s = 389;
  40292. t.t = 278;
  40293. t.u = 556;
  40294. t.v = 444;
  40295. t.w = 667;
  40296. t.x = 500;
  40297. t.y = 444;
  40298. t.z = 389;
  40299. t.braceleft = 348;
  40300. t.bar = 220;
  40301. t.braceright = 348;
  40302. t.asciitilde = 570;
  40303. t.exclamdown = 389;
  40304. t.cent = 500;
  40305. t.sterling = 500;
  40306. t.fraction = 167;
  40307. t.yen = 500;
  40308. t.florin = 500;
  40309. t.section = 500;
  40310. t.currency = 500;
  40311. t.quotesingle = 278;
  40312. t.quotedblleft = 500;
  40313. t.guillemotleft = 500;
  40314. t.guilsinglleft = 333;
  40315. t.guilsinglright = 333;
  40316. t.fi = 556;
  40317. t.fl = 556;
  40318. t.endash = 500;
  40319. t.dagger = 500;
  40320. t.daggerdbl = 500;
  40321. t.periodcentered = 250;
  40322. t.paragraph = 500;
  40323. t.bullet = 350;
  40324. t.quotesinglbase = 333;
  40325. t.quotedblbase = 500;
  40326. t.quotedblright = 500;
  40327. t.guillemotright = 500;
  40328. t.ellipsis = 1000;
  40329. t.perthousand = 1000;
  40330. t.questiondown = 500;
  40331. t.grave = 333;
  40332. t.acute = 333;
  40333. t.circumflex = 333;
  40334. t.tilde = 333;
  40335. t.macron = 333;
  40336. t.breve = 333;
  40337. t.dotaccent = 333;
  40338. t.dieresis = 333;
  40339. t.ring = 333;
  40340. t.cedilla = 333;
  40341. t.hungarumlaut = 333;
  40342. t.ogonek = 333;
  40343. t.caron = 333;
  40344. t.emdash = 1000;
  40345. t.AE = 944;
  40346. t.ordfeminine = 266;
  40347. t.Lslash = 611;
  40348. t.Oslash = 722;
  40349. t.OE = 944;
  40350. t.ordmasculine = 300;
  40351. t.ae = 722;
  40352. t.dotlessi = 278;
  40353. t.lslash = 278;
  40354. t.oslash = 500;
  40355. t.oe = 722;
  40356. t.germandbls = 500;
  40357. t.Idieresis = 389;
  40358. t.eacute = 444;
  40359. t.abreve = 500;
  40360. t.uhungarumlaut = 556;
  40361. t.ecaron = 444;
  40362. t.Ydieresis = 611;
  40363. t.divide = 570;
  40364. t.Yacute = 611;
  40365. t.Acircumflex = 667;
  40366. t.aacute = 500;
  40367. t.Ucircumflex = 722;
  40368. t.yacute = 444;
  40369. t.scommaaccent = 389;
  40370. t.ecircumflex = 444;
  40371. t.Uring = 722;
  40372. t.Udieresis = 722;
  40373. t.aogonek = 500;
  40374. t.Uacute = 722;
  40375. t.uogonek = 556;
  40376. t.Edieresis = 667;
  40377. t.Dcroat = 722;
  40378. t.commaaccent = 250;
  40379. t.copyright = 747;
  40380. t.Emacron = 667;
  40381. t.ccaron = 444;
  40382. t.aring = 500;
  40383. t.Ncommaaccent = 722;
  40384. t.lacute = 278;
  40385. t.agrave = 500;
  40386. t.Tcommaaccent = 611;
  40387. t.Cacute = 667;
  40388. t.atilde = 500;
  40389. t.Edotaccent = 667;
  40390. t.scaron = 389;
  40391. t.scedilla = 389;
  40392. t.iacute = 278;
  40393. t.lozenge = 494;
  40394. t.Rcaron = 667;
  40395. t.Gcommaaccent = 722;
  40396. t.ucircumflex = 556;
  40397. t.acircumflex = 500;
  40398. t.Amacron = 667;
  40399. t.rcaron = 389;
  40400. t.ccedilla = 444;
  40401. t.Zdotaccent = 611;
  40402. t.Thorn = 611;
  40403. t.Omacron = 722;
  40404. t.Racute = 667;
  40405. t.Sacute = 556;
  40406. t.dcaron = 608;
  40407. t.Umacron = 722;
  40408. t.uring = 556;
  40409. t.threesuperior = 300;
  40410. t.Ograve = 722;
  40411. t.Agrave = 667;
  40412. t.Abreve = 667;
  40413. t.multiply = 570;
  40414. t.uacute = 556;
  40415. t.Tcaron = 611;
  40416. t.partialdiff = 494;
  40417. t.ydieresis = 444;
  40418. t.Nacute = 722;
  40419. t.icircumflex = 278;
  40420. t.Ecircumflex = 667;
  40421. t.adieresis = 500;
  40422. t.edieresis = 444;
  40423. t.cacute = 444;
  40424. t.nacute = 556;
  40425. t.umacron = 556;
  40426. t.Ncaron = 722;
  40427. t.Iacute = 389;
  40428. t.plusminus = 570;
  40429. t.brokenbar = 220;
  40430. t.registered = 747;
  40431. t.Gbreve = 722;
  40432. t.Idotaccent = 389;
  40433. t.summation = 600;
  40434. t.Egrave = 667;
  40435. t.racute = 389;
  40436. t.omacron = 500;
  40437. t.Zacute = 611;
  40438. t.Zcaron = 611;
  40439. t.greaterequal = 549;
  40440. t.Eth = 722;
  40441. t.Ccedilla = 667;
  40442. t.lcommaaccent = 278;
  40443. t.tcaron = 366;
  40444. t.eogonek = 444;
  40445. t.Uogonek = 722;
  40446. t.Aacute = 667;
  40447. t.Adieresis = 667;
  40448. t.egrave = 444;
  40449. t.zacute = 389;
  40450. t.iogonek = 278;
  40451. t.Oacute = 722;
  40452. t.oacute = 500;
  40453. t.amacron = 500;
  40454. t.sacute = 389;
  40455. t.idieresis = 278;
  40456. t.Ocircumflex = 722;
  40457. t.Ugrave = 722;
  40458. t.Delta = 612;
  40459. t.thorn = 500;
  40460. t.twosuperior = 300;
  40461. t.Odieresis = 722;
  40462. t.mu = 576;
  40463. t.igrave = 278;
  40464. t.ohungarumlaut = 500;
  40465. t.Eogonek = 667;
  40466. t.dcroat = 500;
  40467. t.threequarters = 750;
  40468. t.Scedilla = 556;
  40469. t.lcaron = 382;
  40470. t.Kcommaaccent = 667;
  40471. t.Lacute = 611;
  40472. t.trademark = 1000;
  40473. t.edotaccent = 444;
  40474. t.Igrave = 389;
  40475. t.Imacron = 389;
  40476. t.Lcaron = 611;
  40477. t.onehalf = 750;
  40478. t.lessequal = 549;
  40479. t.ocircumflex = 500;
  40480. t.ntilde = 556;
  40481. t.Uhungarumlaut = 722;
  40482. t.Eacute = 667;
  40483. t.emacron = 444;
  40484. t.gbreve = 500;
  40485. t.onequarter = 750;
  40486. t.Scaron = 556;
  40487. t.Scommaaccent = 556;
  40488. t.Ohungarumlaut = 722;
  40489. t.degree = 400;
  40490. t.ograve = 500;
  40491. t.Ccaron = 667;
  40492. t.ugrave = 556;
  40493. t.radical = 549;
  40494. t.Dcaron = 722;
  40495. t.rcommaaccent = 389;
  40496. t.Ntilde = 722;
  40497. t.otilde = 500;
  40498. t.Rcommaaccent = 667;
  40499. t.Lcommaaccent = 611;
  40500. t.Atilde = 667;
  40501. t.Aogonek = 667;
  40502. t.Aring = 667;
  40503. t.Otilde = 722;
  40504. t.zdotaccent = 389;
  40505. t.Ecaron = 667;
  40506. t.Iogonek = 389;
  40507. t.kcommaaccent = 500;
  40508. t.minus = 606;
  40509. t.Icircumflex = 389;
  40510. t.ncaron = 556;
  40511. t.tcommaaccent = 278;
  40512. t.logicalnot = 606;
  40513. t.odieresis = 500;
  40514. t.udieresis = 556;
  40515. t.notequal = 549;
  40516. t.gcommaaccent = 500;
  40517. t.eth = 500;
  40518. t.zcaron = 389;
  40519. t.ncommaaccent = 556;
  40520. t.onesuperior = 300;
  40521. t.imacron = 278;
  40522. t.Euro = 500;
  40523. });
  40524. t["Times-Italic"] = (0, _core_utils.getLookupTableFactory)(function (t) {
  40525. t.space = 250;
  40526. t.exclam = 333;
  40527. t.quotedbl = 420;
  40528. t.numbersign = 500;
  40529. t.dollar = 500;
  40530. t.percent = 833;
  40531. t.ampersand = 778;
  40532. t.quoteright = 333;
  40533. t.parenleft = 333;
  40534. t.parenright = 333;
  40535. t.asterisk = 500;
  40536. t.plus = 675;
  40537. t.comma = 250;
  40538. t.hyphen = 333;
  40539. t.period = 250;
  40540. t.slash = 278;
  40541. t.zero = 500;
  40542. t.one = 500;
  40543. t.two = 500;
  40544. t.three = 500;
  40545. t.four = 500;
  40546. t.five = 500;
  40547. t.six = 500;
  40548. t.seven = 500;
  40549. t.eight = 500;
  40550. t.nine = 500;
  40551. t.colon = 333;
  40552. t.semicolon = 333;
  40553. t.less = 675;
  40554. t.equal = 675;
  40555. t.greater = 675;
  40556. t.question = 500;
  40557. t.at = 920;
  40558. t.A = 611;
  40559. t.B = 611;
  40560. t.C = 667;
  40561. t.D = 722;
  40562. t.E = 611;
  40563. t.F = 611;
  40564. t.G = 722;
  40565. t.H = 722;
  40566. t.I = 333;
  40567. t.J = 444;
  40568. t.K = 667;
  40569. t.L = 556;
  40570. t.M = 833;
  40571. t.N = 667;
  40572. t.O = 722;
  40573. t.P = 611;
  40574. t.Q = 722;
  40575. t.R = 611;
  40576. t.S = 500;
  40577. t.T = 556;
  40578. t.U = 722;
  40579. t.V = 611;
  40580. t.W = 833;
  40581. t.X = 611;
  40582. t.Y = 556;
  40583. t.Z = 556;
  40584. t.bracketleft = 389;
  40585. t.backslash = 278;
  40586. t.bracketright = 389;
  40587. t.asciicircum = 422;
  40588. t.underscore = 500;
  40589. t.quoteleft = 333;
  40590. t.a = 500;
  40591. t.b = 500;
  40592. t.c = 444;
  40593. t.d = 500;
  40594. t.e = 444;
  40595. t.f = 278;
  40596. t.g = 500;
  40597. t.h = 500;
  40598. t.i = 278;
  40599. t.j = 278;
  40600. t.k = 444;
  40601. t.l = 278;
  40602. t.m = 722;
  40603. t.n = 500;
  40604. t.o = 500;
  40605. t.p = 500;
  40606. t.q = 500;
  40607. t.r = 389;
  40608. t.s = 389;
  40609. t.t = 278;
  40610. t.u = 500;
  40611. t.v = 444;
  40612. t.w = 667;
  40613. t.x = 444;
  40614. t.y = 444;
  40615. t.z = 389;
  40616. t.braceleft = 400;
  40617. t.bar = 275;
  40618. t.braceright = 400;
  40619. t.asciitilde = 541;
  40620. t.exclamdown = 389;
  40621. t.cent = 500;
  40622. t.sterling = 500;
  40623. t.fraction = 167;
  40624. t.yen = 500;
  40625. t.florin = 500;
  40626. t.section = 500;
  40627. t.currency = 500;
  40628. t.quotesingle = 214;
  40629. t.quotedblleft = 556;
  40630. t.guillemotleft = 500;
  40631. t.guilsinglleft = 333;
  40632. t.guilsinglright = 333;
  40633. t.fi = 500;
  40634. t.fl = 500;
  40635. t.endash = 500;
  40636. t.dagger = 500;
  40637. t.daggerdbl = 500;
  40638. t.periodcentered = 250;
  40639. t.paragraph = 523;
  40640. t.bullet = 350;
  40641. t.quotesinglbase = 333;
  40642. t.quotedblbase = 556;
  40643. t.quotedblright = 556;
  40644. t.guillemotright = 500;
  40645. t.ellipsis = 889;
  40646. t.perthousand = 1000;
  40647. t.questiondown = 500;
  40648. t.grave = 333;
  40649. t.acute = 333;
  40650. t.circumflex = 333;
  40651. t.tilde = 333;
  40652. t.macron = 333;
  40653. t.breve = 333;
  40654. t.dotaccent = 333;
  40655. t.dieresis = 333;
  40656. t.ring = 333;
  40657. t.cedilla = 333;
  40658. t.hungarumlaut = 333;
  40659. t.ogonek = 333;
  40660. t.caron = 333;
  40661. t.emdash = 889;
  40662. t.AE = 889;
  40663. t.ordfeminine = 276;
  40664. t.Lslash = 556;
  40665. t.Oslash = 722;
  40666. t.OE = 944;
  40667. t.ordmasculine = 310;
  40668. t.ae = 667;
  40669. t.dotlessi = 278;
  40670. t.lslash = 278;
  40671. t.oslash = 500;
  40672. t.oe = 667;
  40673. t.germandbls = 500;
  40674. t.Idieresis = 333;
  40675. t.eacute = 444;
  40676. t.abreve = 500;
  40677. t.uhungarumlaut = 500;
  40678. t.ecaron = 444;
  40679. t.Ydieresis = 556;
  40680. t.divide = 675;
  40681. t.Yacute = 556;
  40682. t.Acircumflex = 611;
  40683. t.aacute = 500;
  40684. t.Ucircumflex = 722;
  40685. t.yacute = 444;
  40686. t.scommaaccent = 389;
  40687. t.ecircumflex = 444;
  40688. t.Uring = 722;
  40689. t.Udieresis = 722;
  40690. t.aogonek = 500;
  40691. t.Uacute = 722;
  40692. t.uogonek = 500;
  40693. t.Edieresis = 611;
  40694. t.Dcroat = 722;
  40695. t.commaaccent = 250;
  40696. t.copyright = 760;
  40697. t.Emacron = 611;
  40698. t.ccaron = 444;
  40699. t.aring = 500;
  40700. t.Ncommaaccent = 667;
  40701. t.lacute = 278;
  40702. t.agrave = 500;
  40703. t.Tcommaaccent = 556;
  40704. t.Cacute = 667;
  40705. t.atilde = 500;
  40706. t.Edotaccent = 611;
  40707. t.scaron = 389;
  40708. t.scedilla = 389;
  40709. t.iacute = 278;
  40710. t.lozenge = 471;
  40711. t.Rcaron = 611;
  40712. t.Gcommaaccent = 722;
  40713. t.ucircumflex = 500;
  40714. t.acircumflex = 500;
  40715. t.Amacron = 611;
  40716. t.rcaron = 389;
  40717. t.ccedilla = 444;
  40718. t.Zdotaccent = 556;
  40719. t.Thorn = 611;
  40720. t.Omacron = 722;
  40721. t.Racute = 611;
  40722. t.Sacute = 500;
  40723. t.dcaron = 544;
  40724. t.Umacron = 722;
  40725. t.uring = 500;
  40726. t.threesuperior = 300;
  40727. t.Ograve = 722;
  40728. t.Agrave = 611;
  40729. t.Abreve = 611;
  40730. t.multiply = 675;
  40731. t.uacute = 500;
  40732. t.Tcaron = 556;
  40733. t.partialdiff = 476;
  40734. t.ydieresis = 444;
  40735. t.Nacute = 667;
  40736. t.icircumflex = 278;
  40737. t.Ecircumflex = 611;
  40738. t.adieresis = 500;
  40739. t.edieresis = 444;
  40740. t.cacute = 444;
  40741. t.nacute = 500;
  40742. t.umacron = 500;
  40743. t.Ncaron = 667;
  40744. t.Iacute = 333;
  40745. t.plusminus = 675;
  40746. t.brokenbar = 275;
  40747. t.registered = 760;
  40748. t.Gbreve = 722;
  40749. t.Idotaccent = 333;
  40750. t.summation = 600;
  40751. t.Egrave = 611;
  40752. t.racute = 389;
  40753. t.omacron = 500;
  40754. t.Zacute = 556;
  40755. t.Zcaron = 556;
  40756. t.greaterequal = 549;
  40757. t.Eth = 722;
  40758. t.Ccedilla = 667;
  40759. t.lcommaaccent = 278;
  40760. t.tcaron = 300;
  40761. t.eogonek = 444;
  40762. t.Uogonek = 722;
  40763. t.Aacute = 611;
  40764. t.Adieresis = 611;
  40765. t.egrave = 444;
  40766. t.zacute = 389;
  40767. t.iogonek = 278;
  40768. t.Oacute = 722;
  40769. t.oacute = 500;
  40770. t.amacron = 500;
  40771. t.sacute = 389;
  40772. t.idieresis = 278;
  40773. t.Ocircumflex = 722;
  40774. t.Ugrave = 722;
  40775. t.Delta = 612;
  40776. t.thorn = 500;
  40777. t.twosuperior = 300;
  40778. t.Odieresis = 722;
  40779. t.mu = 500;
  40780. t.igrave = 278;
  40781. t.ohungarumlaut = 500;
  40782. t.Eogonek = 611;
  40783. t.dcroat = 500;
  40784. t.threequarters = 750;
  40785. t.Scedilla = 500;
  40786. t.lcaron = 300;
  40787. t.Kcommaaccent = 667;
  40788. t.Lacute = 556;
  40789. t.trademark = 980;
  40790. t.edotaccent = 444;
  40791. t.Igrave = 333;
  40792. t.Imacron = 333;
  40793. t.Lcaron = 611;
  40794. t.onehalf = 750;
  40795. t.lessequal = 549;
  40796. t.ocircumflex = 500;
  40797. t.ntilde = 500;
  40798. t.Uhungarumlaut = 722;
  40799. t.Eacute = 611;
  40800. t.emacron = 444;
  40801. t.gbreve = 500;
  40802. t.onequarter = 750;
  40803. t.Scaron = 500;
  40804. t.Scommaaccent = 500;
  40805. t.Ohungarumlaut = 722;
  40806. t.degree = 400;
  40807. t.ograve = 500;
  40808. t.Ccaron = 667;
  40809. t.ugrave = 500;
  40810. t.radical = 453;
  40811. t.Dcaron = 722;
  40812. t.rcommaaccent = 389;
  40813. t.Ntilde = 667;
  40814. t.otilde = 500;
  40815. t.Rcommaaccent = 611;
  40816. t.Lcommaaccent = 556;
  40817. t.Atilde = 611;
  40818. t.Aogonek = 611;
  40819. t.Aring = 611;
  40820. t.Otilde = 722;
  40821. t.zdotaccent = 389;
  40822. t.Ecaron = 611;
  40823. t.Iogonek = 333;
  40824. t.kcommaaccent = 444;
  40825. t.minus = 675;
  40826. t.Icircumflex = 333;
  40827. t.ncaron = 500;
  40828. t.tcommaaccent = 278;
  40829. t.logicalnot = 675;
  40830. t.odieresis = 500;
  40831. t.udieresis = 500;
  40832. t.notequal = 549;
  40833. t.gcommaaccent = 500;
  40834. t.eth = 500;
  40835. t.zcaron = 389;
  40836. t.ncommaaccent = 500;
  40837. t.onesuperior = 300;
  40838. t.imacron = 278;
  40839. t.Euro = 500;
  40840. });
  40841. t.ZapfDingbats = (0, _core_utils.getLookupTableFactory)(function (t) {
  40842. t.space = 278;
  40843. t.a1 = 974;
  40844. t.a2 = 961;
  40845. t.a202 = 974;
  40846. t.a3 = 980;
  40847. t.a4 = 719;
  40848. t.a5 = 789;
  40849. t.a119 = 790;
  40850. t.a118 = 791;
  40851. t.a117 = 690;
  40852. t.a11 = 960;
  40853. t.a12 = 939;
  40854. t.a13 = 549;
  40855. t.a14 = 855;
  40856. t.a15 = 911;
  40857. t.a16 = 933;
  40858. t.a105 = 911;
  40859. t.a17 = 945;
  40860. t.a18 = 974;
  40861. t.a19 = 755;
  40862. t.a20 = 846;
  40863. t.a21 = 762;
  40864. t.a22 = 761;
  40865. t.a23 = 571;
  40866. t.a24 = 677;
  40867. t.a25 = 763;
  40868. t.a26 = 760;
  40869. t.a27 = 759;
  40870. t.a28 = 754;
  40871. t.a6 = 494;
  40872. t.a7 = 552;
  40873. t.a8 = 537;
  40874. t.a9 = 577;
  40875. t.a10 = 692;
  40876. t.a29 = 786;
  40877. t.a30 = 788;
  40878. t.a31 = 788;
  40879. t.a32 = 790;
  40880. t.a33 = 793;
  40881. t.a34 = 794;
  40882. t.a35 = 816;
  40883. t.a36 = 823;
  40884. t.a37 = 789;
  40885. t.a38 = 841;
  40886. t.a39 = 823;
  40887. t.a40 = 833;
  40888. t.a41 = 816;
  40889. t.a42 = 831;
  40890. t.a43 = 923;
  40891. t.a44 = 744;
  40892. t.a45 = 723;
  40893. t.a46 = 749;
  40894. t.a47 = 790;
  40895. t.a48 = 792;
  40896. t.a49 = 695;
  40897. t.a50 = 776;
  40898. t.a51 = 768;
  40899. t.a52 = 792;
  40900. t.a53 = 759;
  40901. t.a54 = 707;
  40902. t.a55 = 708;
  40903. t.a56 = 682;
  40904. t.a57 = 701;
  40905. t.a58 = 826;
  40906. t.a59 = 815;
  40907. t.a60 = 789;
  40908. t.a61 = 789;
  40909. t.a62 = 707;
  40910. t.a63 = 687;
  40911. t.a64 = 696;
  40912. t.a65 = 689;
  40913. t.a66 = 786;
  40914. t.a67 = 787;
  40915. t.a68 = 713;
  40916. t.a69 = 791;
  40917. t.a70 = 785;
  40918. t.a71 = 791;
  40919. t.a72 = 873;
  40920. t.a73 = 761;
  40921. t.a74 = 762;
  40922. t.a203 = 762;
  40923. t.a75 = 759;
  40924. t.a204 = 759;
  40925. t.a76 = 892;
  40926. t.a77 = 892;
  40927. t.a78 = 788;
  40928. t.a79 = 784;
  40929. t.a81 = 438;
  40930. t.a82 = 138;
  40931. t.a83 = 277;
  40932. t.a84 = 415;
  40933. t.a97 = 392;
  40934. t.a98 = 392;
  40935. t.a99 = 668;
  40936. t.a100 = 668;
  40937. t.a89 = 390;
  40938. t.a90 = 390;
  40939. t.a93 = 317;
  40940. t.a94 = 317;
  40941. t.a91 = 276;
  40942. t.a92 = 276;
  40943. t.a205 = 509;
  40944. t.a85 = 509;
  40945. t.a206 = 410;
  40946. t.a86 = 410;
  40947. t.a87 = 234;
  40948. t.a88 = 234;
  40949. t.a95 = 334;
  40950. t.a96 = 334;
  40951. t.a101 = 732;
  40952. t.a102 = 544;
  40953. t.a103 = 544;
  40954. t.a104 = 910;
  40955. t.a106 = 667;
  40956. t.a107 = 760;
  40957. t.a108 = 760;
  40958. t.a112 = 776;
  40959. t.a111 = 595;
  40960. t.a110 = 694;
  40961. t.a109 = 626;
  40962. t.a120 = 788;
  40963. t.a121 = 788;
  40964. t.a122 = 788;
  40965. t.a123 = 788;
  40966. t.a124 = 788;
  40967. t.a125 = 788;
  40968. t.a126 = 788;
  40969. t.a127 = 788;
  40970. t.a128 = 788;
  40971. t.a129 = 788;
  40972. t.a130 = 788;
  40973. t.a131 = 788;
  40974. t.a132 = 788;
  40975. t.a133 = 788;
  40976. t.a134 = 788;
  40977. t.a135 = 788;
  40978. t.a136 = 788;
  40979. t.a137 = 788;
  40980. t.a138 = 788;
  40981. t.a139 = 788;
  40982. t.a140 = 788;
  40983. t.a141 = 788;
  40984. t.a142 = 788;
  40985. t.a143 = 788;
  40986. t.a144 = 788;
  40987. t.a145 = 788;
  40988. t.a146 = 788;
  40989. t.a147 = 788;
  40990. t.a148 = 788;
  40991. t.a149 = 788;
  40992. t.a150 = 788;
  40993. t.a151 = 788;
  40994. t.a152 = 788;
  40995. t.a153 = 788;
  40996. t.a154 = 788;
  40997. t.a155 = 788;
  40998. t.a156 = 788;
  40999. t.a157 = 788;
  41000. t.a158 = 788;
  41001. t.a159 = 788;
  41002. t.a160 = 894;
  41003. t.a161 = 838;
  41004. t.a163 = 1016;
  41005. t.a164 = 458;
  41006. t.a196 = 748;
  41007. t.a165 = 924;
  41008. t.a192 = 748;
  41009. t.a166 = 918;
  41010. t.a167 = 927;
  41011. t.a168 = 928;
  41012. t.a169 = 928;
  41013. t.a170 = 834;
  41014. t.a171 = 873;
  41015. t.a172 = 828;
  41016. t.a173 = 924;
  41017. t.a162 = 924;
  41018. t.a174 = 917;
  41019. t.a175 = 930;
  41020. t.a176 = 931;
  41021. t.a177 = 463;
  41022. t.a178 = 883;
  41023. t.a179 = 836;
  41024. t.a193 = 836;
  41025. t.a180 = 867;
  41026. t.a199 = 867;
  41027. t.a181 = 696;
  41028. t.a200 = 696;
  41029. t.a182 = 874;
  41030. t.a201 = 874;
  41031. t.a183 = 760;
  41032. t.a184 = 946;
  41033. t.a197 = 771;
  41034. t.a185 = 865;
  41035. t.a194 = 771;
  41036. t.a198 = 888;
  41037. t.a186 = 967;
  41038. t.a195 = 888;
  41039. t.a187 = 831;
  41040. t.a188 = 873;
  41041. t.a189 = 927;
  41042. t.a190 = 970;
  41043. t.a191 = 918;
  41044. });
  41045. });
  41046. exports.getMetrics = getMetrics;
  41047. const getFontBasicMetrics = (0, _core_utils.getLookupTableFactory)(function (t) {
  41048. t.Courier = {
  41049. ascent: 629,
  41050. descent: -157,
  41051. capHeight: 562,
  41052. xHeight: -426
  41053. };
  41054. t["Courier-Bold"] = {
  41055. ascent: 629,
  41056. descent: -157,
  41057. capHeight: 562,
  41058. xHeight: 439
  41059. };
  41060. t["Courier-Oblique"] = {
  41061. ascent: 629,
  41062. descent: -157,
  41063. capHeight: 562,
  41064. xHeight: 426
  41065. };
  41066. t["Courier-BoldOblique"] = {
  41067. ascent: 629,
  41068. descent: -157,
  41069. capHeight: 562,
  41070. xHeight: 426
  41071. };
  41072. t.Helvetica = {
  41073. ascent: 718,
  41074. descent: -207,
  41075. capHeight: 718,
  41076. xHeight: 523
  41077. };
  41078. t["Helvetica-Bold"] = {
  41079. ascent: 718,
  41080. descent: -207,
  41081. capHeight: 718,
  41082. xHeight: 532
  41083. };
  41084. t["Helvetica-Oblique"] = {
  41085. ascent: 718,
  41086. descent: -207,
  41087. capHeight: 718,
  41088. xHeight: 523
  41089. };
  41090. t["Helvetica-BoldOblique"] = {
  41091. ascent: 718,
  41092. descent: -207,
  41093. capHeight: 718,
  41094. xHeight: 532
  41095. };
  41096. t["Times-Roman"] = {
  41097. ascent: 683,
  41098. descent: -217,
  41099. capHeight: 662,
  41100. xHeight: 450
  41101. };
  41102. t["Times-Bold"] = {
  41103. ascent: 683,
  41104. descent: -217,
  41105. capHeight: 676,
  41106. xHeight: 461
  41107. };
  41108. t["Times-Italic"] = {
  41109. ascent: 683,
  41110. descent: -217,
  41111. capHeight: 653,
  41112. xHeight: 441
  41113. };
  41114. t["Times-BoldItalic"] = {
  41115. ascent: 683,
  41116. descent: -217,
  41117. capHeight: 669,
  41118. xHeight: 462
  41119. };
  41120. t.Symbol = {
  41121. ascent: Math.NaN,
  41122. descent: Math.NaN,
  41123. capHeight: Math.NaN,
  41124. xHeight: Math.NaN
  41125. };
  41126. t.ZapfDingbats = {
  41127. ascent: Math.NaN,
  41128. descent: Math.NaN,
  41129. capHeight: Math.NaN,
  41130. xHeight: Math.NaN
  41131. };
  41132. });
  41133. exports.getFontBasicMetrics = getFontBasicMetrics;
  41134. /***/ }),
  41135. /* 52 */
  41136. /***/ ((__unused_webpack_module, exports) => {
  41137. Object.defineProperty(exports, "__esModule", ({
  41138. value: true
  41139. }));
  41140. exports.GlyfTable = void 0;
  41141. const ON_CURVE_POINT = 1 << 0;
  41142. const X_SHORT_VECTOR = 1 << 1;
  41143. const Y_SHORT_VECTOR = 1 << 2;
  41144. const REPEAT_FLAG = 1 << 3;
  41145. const X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR = 1 << 4;
  41146. const Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR = 1 << 5;
  41147. const OVERLAP_SIMPLE = 1 << 6;
  41148. const ARG_1_AND_2_ARE_WORDS = 1 << 0;
  41149. const ARGS_ARE_XY_VALUES = 1 << 1;
  41150. const WE_HAVE_A_SCALE = 1 << 3;
  41151. const MORE_COMPONENTS = 1 << 5;
  41152. const WE_HAVE_AN_X_AND_Y_SCALE = 1 << 6;
  41153. const WE_HAVE_A_TWO_BY_TWO = 1 << 7;
  41154. const WE_HAVE_INSTRUCTIONS = 1 << 8;
  41155. class GlyfTable {
  41156. constructor({
  41157. glyfTable,
  41158. isGlyphLocationsLong,
  41159. locaTable,
  41160. numGlyphs
  41161. }) {
  41162. this.glyphs = [];
  41163. const loca = new DataView(locaTable.buffer, locaTable.byteOffset, locaTable.byteLength);
  41164. const glyf = new DataView(glyfTable.buffer, glyfTable.byteOffset, glyfTable.byteLength);
  41165. const offsetSize = isGlyphLocationsLong ? 4 : 2;
  41166. let prev = isGlyphLocationsLong ? loca.getUint32(0) : 2 * loca.getUint16(0);
  41167. let pos = 0;
  41168. for (let i = 0; i < numGlyphs; i++) {
  41169. pos += offsetSize;
  41170. const next = isGlyphLocationsLong ? loca.getUint32(pos) : 2 * loca.getUint16(pos);
  41171. if (next === prev) {
  41172. this.glyphs.push(new Glyph({}));
  41173. continue;
  41174. }
  41175. const glyph = Glyph.parse(prev, glyf);
  41176. this.glyphs.push(glyph);
  41177. prev = next;
  41178. }
  41179. }
  41180. getSize() {
  41181. return this.glyphs.reduce((a, g) => {
  41182. const size = g.getSize();
  41183. return a + (size + 3 & ~3);
  41184. }, 0);
  41185. }
  41186. write() {
  41187. const totalSize = this.getSize();
  41188. const glyfTable = new DataView(new ArrayBuffer(totalSize));
  41189. const isLocationLong = totalSize > 0x1fffe;
  41190. const offsetSize = isLocationLong ? 4 : 2;
  41191. const locaTable = new DataView(new ArrayBuffer((this.glyphs.length + 1) * offsetSize));
  41192. if (isLocationLong) {
  41193. locaTable.setUint32(0, 0);
  41194. } else {
  41195. locaTable.setUint16(0, 0);
  41196. }
  41197. let pos = 0;
  41198. let locaIndex = 0;
  41199. for (const glyph of this.glyphs) {
  41200. pos += glyph.write(pos, glyfTable);
  41201. pos = pos + 3 & ~3;
  41202. locaIndex += offsetSize;
  41203. if (isLocationLong) {
  41204. locaTable.setUint32(locaIndex, pos);
  41205. } else {
  41206. locaTable.setUint16(locaIndex, pos >> 1);
  41207. }
  41208. }
  41209. return {
  41210. isLocationLong,
  41211. loca: new Uint8Array(locaTable.buffer),
  41212. glyf: new Uint8Array(glyfTable.buffer)
  41213. };
  41214. }
  41215. scale(factors) {
  41216. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  41217. this.glyphs[i].scale(factors[i]);
  41218. }
  41219. }
  41220. }
  41221. exports.GlyfTable = GlyfTable;
  41222. class Glyph {
  41223. constructor({
  41224. header = null,
  41225. simple = null,
  41226. composites = null
  41227. }) {
  41228. this.header = header;
  41229. this.simple = simple;
  41230. this.composites = composites;
  41231. }
  41232. static parse(pos, glyf) {
  41233. const [read, header] = GlyphHeader.parse(pos, glyf);
  41234. pos += read;
  41235. if (header.numberOfContours < 0) {
  41236. const composites = [];
  41237. while (true) {
  41238. const [n, composite] = CompositeGlyph.parse(pos, glyf);
  41239. pos += n;
  41240. composites.push(composite);
  41241. if (!(composite.flags & MORE_COMPONENTS)) {
  41242. break;
  41243. }
  41244. }
  41245. return new Glyph({
  41246. header,
  41247. composites
  41248. });
  41249. }
  41250. const simple = SimpleGlyph.parse(pos, glyf, header.numberOfContours);
  41251. return new Glyph({
  41252. header,
  41253. simple
  41254. });
  41255. }
  41256. getSize() {
  41257. if (!this.header) {
  41258. return 0;
  41259. }
  41260. const size = this.simple ? this.simple.getSize() : this.composites.reduce((a, c) => a + c.getSize(), 0);
  41261. return this.header.getSize() + size;
  41262. }
  41263. write(pos, buf) {
  41264. if (!this.header) {
  41265. return 0;
  41266. }
  41267. const spos = pos;
  41268. pos += this.header.write(pos, buf);
  41269. if (this.simple) {
  41270. pos += this.simple.write(pos, buf);
  41271. } else {
  41272. for (const composite of this.composites) {
  41273. pos += composite.write(pos, buf);
  41274. }
  41275. }
  41276. return pos - spos;
  41277. }
  41278. scale(factor) {
  41279. if (!this.header) {
  41280. return;
  41281. }
  41282. const xMiddle = (this.header.xMin + this.header.xMax) / 2;
  41283. this.header.scale(xMiddle, factor);
  41284. if (this.simple) {
  41285. this.simple.scale(xMiddle, factor);
  41286. } else {
  41287. for (const composite of this.composites) {
  41288. composite.scale(xMiddle, factor);
  41289. }
  41290. }
  41291. }
  41292. }
  41293. class GlyphHeader {
  41294. constructor({
  41295. numberOfContours,
  41296. xMin,
  41297. yMin,
  41298. xMax,
  41299. yMax
  41300. }) {
  41301. this.numberOfContours = numberOfContours;
  41302. this.xMin = xMin;
  41303. this.yMin = yMin;
  41304. this.xMax = xMax;
  41305. this.yMax = yMax;
  41306. }
  41307. static parse(pos, glyf) {
  41308. return [10, new GlyphHeader({
  41309. numberOfContours: glyf.getInt16(pos),
  41310. xMin: glyf.getInt16(pos + 2),
  41311. yMin: glyf.getInt16(pos + 4),
  41312. xMax: glyf.getInt16(pos + 6),
  41313. yMax: glyf.getInt16(pos + 8)
  41314. })];
  41315. }
  41316. getSize() {
  41317. return 10;
  41318. }
  41319. write(pos, buf) {
  41320. buf.setInt16(pos, this.numberOfContours);
  41321. buf.setInt16(pos + 2, this.xMin);
  41322. buf.setInt16(pos + 4, this.yMin);
  41323. buf.setInt16(pos + 6, this.xMax);
  41324. buf.setInt16(pos + 8, this.yMax);
  41325. return 10;
  41326. }
  41327. scale(x, factor) {
  41328. this.xMin = Math.round(x + (this.xMin - x) * factor);
  41329. this.xMax = Math.round(x + (this.xMax - x) * factor);
  41330. }
  41331. }
  41332. class Contour {
  41333. constructor({
  41334. flags,
  41335. xCoordinates,
  41336. yCoordinates
  41337. }) {
  41338. this.xCoordinates = xCoordinates;
  41339. this.yCoordinates = yCoordinates;
  41340. this.flags = flags;
  41341. }
  41342. }
  41343. class SimpleGlyph {
  41344. constructor({
  41345. contours,
  41346. instructions
  41347. }) {
  41348. this.contours = contours;
  41349. this.instructions = instructions;
  41350. }
  41351. static parse(pos, glyf, numberOfContours) {
  41352. const endPtsOfContours = [];
  41353. for (let i = 0; i < numberOfContours; i++) {
  41354. const endPt = glyf.getUint16(pos);
  41355. pos += 2;
  41356. endPtsOfContours.push(endPt);
  41357. }
  41358. const numberOfPt = endPtsOfContours[numberOfContours - 1] + 1;
  41359. const instructionLength = glyf.getUint16(pos);
  41360. pos += 2;
  41361. const instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41362. pos += instructionLength;
  41363. const flags = [];
  41364. for (let i = 0; i < numberOfPt; pos++, i++) {
  41365. let flag = glyf.getUint8(pos);
  41366. flags.push(flag);
  41367. if (flag & REPEAT_FLAG) {
  41368. const count = glyf.getUint8(++pos);
  41369. flag ^= REPEAT_FLAG;
  41370. for (let m = 0; m < count; m++) {
  41371. flags.push(flag);
  41372. }
  41373. i += count;
  41374. }
  41375. }
  41376. const allXCoordinates = [];
  41377. let xCoordinates = [];
  41378. let yCoordinates = [];
  41379. let pointFlags = [];
  41380. const contours = [];
  41381. let endPtsOfContoursIndex = 0;
  41382. let lastCoordinate = 0;
  41383. for (let i = 0; i < numberOfPt; i++) {
  41384. const flag = flags[i];
  41385. if (flag & X_SHORT_VECTOR) {
  41386. const x = glyf.getUint8(pos++);
  41387. lastCoordinate += flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR ? x : -x;
  41388. xCoordinates.push(lastCoordinate);
  41389. } else if (flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR) {
  41390. xCoordinates.push(lastCoordinate);
  41391. } else {
  41392. lastCoordinate += glyf.getInt16(pos);
  41393. pos += 2;
  41394. xCoordinates.push(lastCoordinate);
  41395. }
  41396. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41397. endPtsOfContoursIndex++;
  41398. allXCoordinates.push(xCoordinates);
  41399. xCoordinates = [];
  41400. }
  41401. }
  41402. lastCoordinate = 0;
  41403. endPtsOfContoursIndex = 0;
  41404. for (let i = 0; i < numberOfPt; i++) {
  41405. const flag = flags[i];
  41406. if (flag & Y_SHORT_VECTOR) {
  41407. const y = glyf.getUint8(pos++);
  41408. lastCoordinate += flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR ? y : -y;
  41409. yCoordinates.push(lastCoordinate);
  41410. } else if (flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR) {
  41411. yCoordinates.push(lastCoordinate);
  41412. } else {
  41413. lastCoordinate += glyf.getInt16(pos);
  41414. pos += 2;
  41415. yCoordinates.push(lastCoordinate);
  41416. }
  41417. pointFlags.push(flag & ON_CURVE_POINT | flag & OVERLAP_SIMPLE);
  41418. if (endPtsOfContours[endPtsOfContoursIndex] === i) {
  41419. xCoordinates = allXCoordinates[endPtsOfContoursIndex];
  41420. endPtsOfContoursIndex++;
  41421. contours.push(new Contour({
  41422. flags: pointFlags,
  41423. xCoordinates,
  41424. yCoordinates
  41425. }));
  41426. yCoordinates = [];
  41427. pointFlags = [];
  41428. }
  41429. }
  41430. return new SimpleGlyph({
  41431. contours,
  41432. instructions
  41433. });
  41434. }
  41435. getSize() {
  41436. let size = this.contours.length * 2 + 2 + this.instructions.length;
  41437. let lastX = 0;
  41438. let lastY = 0;
  41439. for (const contour of this.contours) {
  41440. size += contour.flags.length;
  41441. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41442. const x = contour.xCoordinates[i];
  41443. const y = contour.yCoordinates[i];
  41444. let abs = Math.abs(x - lastX);
  41445. if (abs > 255) {
  41446. size += 2;
  41447. } else if (abs > 0) {
  41448. size += 1;
  41449. }
  41450. lastX = x;
  41451. abs = Math.abs(y - lastY);
  41452. if (abs > 255) {
  41453. size += 2;
  41454. } else if (abs > 0) {
  41455. size += 1;
  41456. }
  41457. lastY = y;
  41458. }
  41459. }
  41460. return size;
  41461. }
  41462. write(pos, buf) {
  41463. const spos = pos;
  41464. const xCoordinates = [];
  41465. const yCoordinates = [];
  41466. const flags = [];
  41467. let lastX = 0;
  41468. let lastY = 0;
  41469. for (const contour of this.contours) {
  41470. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41471. let flag = contour.flags[i];
  41472. const x = contour.xCoordinates[i];
  41473. let delta = x - lastX;
  41474. if (delta === 0) {
  41475. flag |= X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR;
  41476. xCoordinates.push(0);
  41477. } else {
  41478. const abs = Math.abs(delta);
  41479. if (abs <= 255) {
  41480. flag |= delta >= 0 ? X_SHORT_VECTOR | X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR : X_SHORT_VECTOR;
  41481. xCoordinates.push(abs);
  41482. } else {
  41483. xCoordinates.push(delta);
  41484. }
  41485. }
  41486. lastX = x;
  41487. const y = contour.yCoordinates[i];
  41488. delta = y - lastY;
  41489. if (delta === 0) {
  41490. flag |= Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR;
  41491. yCoordinates.push(0);
  41492. } else {
  41493. const abs = Math.abs(delta);
  41494. if (abs <= 255) {
  41495. flag |= delta >= 0 ? Y_SHORT_VECTOR | Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR : Y_SHORT_VECTOR;
  41496. yCoordinates.push(abs);
  41497. } else {
  41498. yCoordinates.push(delta);
  41499. }
  41500. }
  41501. lastY = y;
  41502. flags.push(flag);
  41503. }
  41504. buf.setUint16(pos, xCoordinates.length - 1);
  41505. pos += 2;
  41506. }
  41507. buf.setUint16(pos, this.instructions.length);
  41508. pos += 2;
  41509. if (this.instructions.length) {
  41510. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41511. pos += this.instructions.length;
  41512. }
  41513. for (const flag of flags) {
  41514. buf.setUint8(pos++, flag);
  41515. }
  41516. for (let i = 0, ii = xCoordinates.length; i < ii; i++) {
  41517. const x = xCoordinates[i];
  41518. const flag = flags[i];
  41519. if (flag & X_SHORT_VECTOR) {
  41520. buf.setUint8(pos++, x);
  41521. } else if (!(flag & X_IS_SAME_OR_POSITIVE_X_SHORT_VECTOR)) {
  41522. buf.setInt16(pos, x);
  41523. pos += 2;
  41524. }
  41525. }
  41526. for (let i = 0, ii = yCoordinates.length; i < ii; i++) {
  41527. const y = yCoordinates[i];
  41528. const flag = flags[i];
  41529. if (flag & Y_SHORT_VECTOR) {
  41530. buf.setUint8(pos++, y);
  41531. } else if (!(flag & Y_IS_SAME_OR_POSITIVE_Y_SHORT_VECTOR)) {
  41532. buf.setInt16(pos, y);
  41533. pos += 2;
  41534. }
  41535. }
  41536. return pos - spos;
  41537. }
  41538. scale(x, factor) {
  41539. for (const contour of this.contours) {
  41540. if (contour.xCoordinates.length === 0) {
  41541. continue;
  41542. }
  41543. for (let i = 0, ii = contour.xCoordinates.length; i < ii; i++) {
  41544. contour.xCoordinates[i] = Math.round(x + (contour.xCoordinates[i] - x) * factor);
  41545. }
  41546. }
  41547. }
  41548. }
  41549. class CompositeGlyph {
  41550. constructor({
  41551. flags,
  41552. glyphIndex,
  41553. argument1,
  41554. argument2,
  41555. transf,
  41556. instructions
  41557. }) {
  41558. this.flags = flags;
  41559. this.glyphIndex = glyphIndex;
  41560. this.argument1 = argument1;
  41561. this.argument2 = argument2;
  41562. this.transf = transf;
  41563. this.instructions = instructions;
  41564. }
  41565. static parse(pos, glyf) {
  41566. const spos = pos;
  41567. const transf = [];
  41568. let flags = glyf.getUint16(pos);
  41569. const glyphIndex = glyf.getUint16(pos + 2);
  41570. pos += 4;
  41571. let argument1, argument2;
  41572. if (flags & ARG_1_AND_2_ARE_WORDS) {
  41573. if (flags & ARGS_ARE_XY_VALUES) {
  41574. argument1 = glyf.getInt16(pos);
  41575. argument2 = glyf.getInt16(pos + 2);
  41576. } else {
  41577. argument1 = glyf.getUint16(pos);
  41578. argument2 = glyf.getUint16(pos + 2);
  41579. }
  41580. pos += 4;
  41581. flags ^= ARG_1_AND_2_ARE_WORDS;
  41582. } else {
  41583. if (flags & ARGS_ARE_XY_VALUES) {
  41584. argument1 = glyf.getInt8(pos);
  41585. argument2 = glyf.getInt8(pos + 1);
  41586. } else {
  41587. argument1 = glyf.getUint8(pos);
  41588. argument2 = glyf.getUint8(pos + 1);
  41589. }
  41590. pos += 2;
  41591. }
  41592. if (flags & WE_HAVE_A_SCALE) {
  41593. transf.push(glyf.getUint16(pos));
  41594. pos += 2;
  41595. } else if (flags & WE_HAVE_AN_X_AND_Y_SCALE) {
  41596. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2));
  41597. pos += 4;
  41598. } else if (flags & WE_HAVE_A_TWO_BY_TWO) {
  41599. transf.push(glyf.getUint16(pos), glyf.getUint16(pos + 2), glyf.getUint16(pos + 4), glyf.getUint16(pos + 6));
  41600. pos += 8;
  41601. }
  41602. let instructions = null;
  41603. if (flags & WE_HAVE_INSTRUCTIONS) {
  41604. const instructionLength = glyf.getUint16(pos);
  41605. pos += 2;
  41606. instructions = new Uint8Array(glyf).slice(pos, pos + instructionLength);
  41607. pos += instructionLength;
  41608. }
  41609. return [pos - spos, new CompositeGlyph({
  41610. flags,
  41611. glyphIndex,
  41612. argument1,
  41613. argument2,
  41614. transf,
  41615. instructions
  41616. })];
  41617. }
  41618. getSize() {
  41619. let size = 2 + 2 + this.transf.length * 2;
  41620. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41621. size += 2 + this.instructions.length;
  41622. }
  41623. size += 2;
  41624. if (this.flags & 2) {
  41625. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41626. size += 2;
  41627. }
  41628. } else {
  41629. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  41630. size += 2;
  41631. }
  41632. }
  41633. return size;
  41634. }
  41635. write(pos, buf) {
  41636. const spos = pos;
  41637. if (this.flags & ARGS_ARE_XY_VALUES) {
  41638. if (!(this.argument1 >= -128 && this.argument1 <= 127 && this.argument2 >= -128 && this.argument2 <= 127)) {
  41639. this.flags |= ARG_1_AND_2_ARE_WORDS;
  41640. }
  41641. } else {
  41642. if (!(this.argument1 >= 0 && this.argument1 <= 255 && this.argument2 >= 0 && this.argument2 <= 255)) {
  41643. this.flags |= ARG_1_AND_2_ARE_WORDS;
  41644. }
  41645. }
  41646. buf.setUint16(pos, this.flags);
  41647. buf.setUint16(pos + 2, this.glyphIndex);
  41648. pos += 4;
  41649. if (this.flags & ARG_1_AND_2_ARE_WORDS) {
  41650. if (this.flags & ARGS_ARE_XY_VALUES) {
  41651. buf.setInt16(pos, this.argument1);
  41652. buf.setInt16(pos + 2, this.argument2);
  41653. } else {
  41654. buf.setUint16(pos, this.argument1);
  41655. buf.setUint16(pos + 2, this.argument2);
  41656. }
  41657. pos += 4;
  41658. } else {
  41659. buf.setUint8(pos, this.argument1);
  41660. buf.setUint8(pos + 1, this.argument2);
  41661. pos += 2;
  41662. }
  41663. if (this.flags & WE_HAVE_INSTRUCTIONS) {
  41664. buf.setUint16(pos, this.instructions.length);
  41665. pos += 2;
  41666. if (this.instructions.length) {
  41667. new Uint8Array(buf.buffer, 0, buf.buffer.byteLength).set(this.instructions, pos);
  41668. pos += this.instructions.length;
  41669. }
  41670. }
  41671. return pos - spos;
  41672. }
  41673. scale(x, factor) {}
  41674. }
  41675. /***/ }),
  41676. /* 53 */
  41677. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41678. Object.defineProperty(exports, "__esModule", ({
  41679. value: true
  41680. }));
  41681. exports.OpenTypeFileBuilder = void 0;
  41682. var _core_utils = __w_pdfjs_require__(8);
  41683. var _util = __w_pdfjs_require__(2);
  41684. function writeInt16(dest, offset, num) {
  41685. dest[offset] = num >> 8 & 0xff;
  41686. dest[offset + 1] = num & 0xff;
  41687. }
  41688. function writeInt32(dest, offset, num) {
  41689. dest[offset] = num >> 24 & 0xff;
  41690. dest[offset + 1] = num >> 16 & 0xff;
  41691. dest[offset + 2] = num >> 8 & 0xff;
  41692. dest[offset + 3] = num & 0xff;
  41693. }
  41694. function writeData(dest, offset, data) {
  41695. if (data instanceof Uint8Array) {
  41696. dest.set(data, offset);
  41697. } else if (typeof data === "string") {
  41698. for (let i = 0, ii = data.length; i < ii; i++) {
  41699. dest[offset++] = data.charCodeAt(i) & 0xff;
  41700. }
  41701. } else {
  41702. for (let i = 0, ii = data.length; i < ii; i++) {
  41703. dest[offset++] = data[i] & 0xff;
  41704. }
  41705. }
  41706. }
  41707. const OTF_HEADER_SIZE = 12;
  41708. const OTF_TABLE_ENTRY_SIZE = 16;
  41709. class OpenTypeFileBuilder {
  41710. constructor(sfnt) {
  41711. this.sfnt = sfnt;
  41712. this.tables = Object.create(null);
  41713. }
  41714. static getSearchParams(entriesCount, entrySize) {
  41715. let maxPower2 = 1,
  41716. log2 = 0;
  41717. while ((maxPower2 ^ entriesCount) > maxPower2) {
  41718. maxPower2 <<= 1;
  41719. log2++;
  41720. }
  41721. const searchRange = maxPower2 * entrySize;
  41722. return {
  41723. range: searchRange,
  41724. entry: log2,
  41725. rangeShift: entrySize * entriesCount - searchRange
  41726. };
  41727. }
  41728. toArray() {
  41729. let sfnt = this.sfnt;
  41730. const tables = this.tables;
  41731. const tablesNames = Object.keys(tables);
  41732. tablesNames.sort();
  41733. const numTables = tablesNames.length;
  41734. let i, j, jj, table, tableName;
  41735. let offset = OTF_HEADER_SIZE + numTables * OTF_TABLE_ENTRY_SIZE;
  41736. const tableOffsets = [offset];
  41737. for (i = 0; i < numTables; i++) {
  41738. table = tables[tablesNames[i]];
  41739. const paddedLength = (table.length + 3 & ~3) >>> 0;
  41740. offset += paddedLength;
  41741. tableOffsets.push(offset);
  41742. }
  41743. const file = new Uint8Array(offset);
  41744. for (i = 0; i < numTables; i++) {
  41745. table = tables[tablesNames[i]];
  41746. writeData(file, tableOffsets[i], table);
  41747. }
  41748. if (sfnt === "true") {
  41749. sfnt = (0, _util.string32)(0x00010000);
  41750. }
  41751. file[0] = sfnt.charCodeAt(0) & 0xff;
  41752. file[1] = sfnt.charCodeAt(1) & 0xff;
  41753. file[2] = sfnt.charCodeAt(2) & 0xff;
  41754. file[3] = sfnt.charCodeAt(3) & 0xff;
  41755. writeInt16(file, 4, numTables);
  41756. const searchParams = OpenTypeFileBuilder.getSearchParams(numTables, 16);
  41757. writeInt16(file, 6, searchParams.range);
  41758. writeInt16(file, 8, searchParams.entry);
  41759. writeInt16(file, 10, searchParams.rangeShift);
  41760. offset = OTF_HEADER_SIZE;
  41761. for (i = 0; i < numTables; i++) {
  41762. tableName = tablesNames[i];
  41763. file[offset] = tableName.charCodeAt(0) & 0xff;
  41764. file[offset + 1] = tableName.charCodeAt(1) & 0xff;
  41765. file[offset + 2] = tableName.charCodeAt(2) & 0xff;
  41766. file[offset + 3] = tableName.charCodeAt(3) & 0xff;
  41767. let checksum = 0;
  41768. for (j = tableOffsets[i], jj = tableOffsets[i + 1]; j < jj; j += 4) {
  41769. const quad = (0, _core_utils.readUint32)(file, j);
  41770. checksum = checksum + quad >>> 0;
  41771. }
  41772. writeInt32(file, offset + 4, checksum);
  41773. writeInt32(file, offset + 8, tableOffsets[i]);
  41774. writeInt32(file, offset + 12, tables[tableName].length);
  41775. offset += OTF_TABLE_ENTRY_SIZE;
  41776. }
  41777. return file;
  41778. }
  41779. addTable(tag, data) {
  41780. if (tag in this.tables) {
  41781. throw new Error("Table " + tag + " already exists");
  41782. }
  41783. this.tables[tag] = data;
  41784. }
  41785. }
  41786. exports.OpenTypeFileBuilder = OpenTypeFileBuilder;
  41787. /***/ }),
  41788. /* 54 */
  41789. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  41790. Object.defineProperty(exports, "__esModule", ({
  41791. value: true
  41792. }));
  41793. exports.Type1Font = void 0;
  41794. var _cff_parser = __w_pdfjs_require__(45);
  41795. var _fonts_utils = __w_pdfjs_require__(18);
  41796. var _core_utils = __w_pdfjs_require__(8);
  41797. var _stream = __w_pdfjs_require__(10);
  41798. var _type1_parser = __w_pdfjs_require__(55);
  41799. var _util = __w_pdfjs_require__(2);
  41800. function findBlock(streamBytes, signature, startIndex) {
  41801. const streamBytesLength = streamBytes.length;
  41802. const signatureLength = signature.length;
  41803. const scanLength = streamBytesLength - signatureLength;
  41804. let i = startIndex,
  41805. found = false;
  41806. while (i < scanLength) {
  41807. let j = 0;
  41808. while (j < signatureLength && streamBytes[i + j] === signature[j]) {
  41809. j++;
  41810. }
  41811. if (j >= signatureLength) {
  41812. i += j;
  41813. while (i < streamBytesLength && (0, _core_utils.isWhiteSpace)(streamBytes[i])) {
  41814. i++;
  41815. }
  41816. found = true;
  41817. break;
  41818. }
  41819. i++;
  41820. }
  41821. return {
  41822. found,
  41823. length: i
  41824. };
  41825. }
  41826. function getHeaderBlock(stream, suggestedLength) {
  41827. const EEXEC_SIGNATURE = [0x65, 0x65, 0x78, 0x65, 0x63];
  41828. const streamStartPos = stream.pos;
  41829. let headerBytes, headerBytesLength, block;
  41830. try {
  41831. headerBytes = stream.getBytes(suggestedLength);
  41832. headerBytesLength = headerBytes.length;
  41833. } catch (ex) {}
  41834. if (headerBytesLength === suggestedLength) {
  41835. block = findBlock(headerBytes, EEXEC_SIGNATURE, suggestedLength - 2 * EEXEC_SIGNATURE.length);
  41836. if (block.found && block.length === suggestedLength) {
  41837. return {
  41838. stream: new _stream.Stream(headerBytes),
  41839. length: suggestedLength
  41840. };
  41841. }
  41842. }
  41843. (0, _util.warn)('Invalid "Length1" property in Type1 font -- trying to recover.');
  41844. stream.pos = streamStartPos;
  41845. const SCAN_BLOCK_LENGTH = 2048;
  41846. let actualLength;
  41847. while (true) {
  41848. const scanBytes = stream.peekBytes(SCAN_BLOCK_LENGTH);
  41849. block = findBlock(scanBytes, EEXEC_SIGNATURE, 0);
  41850. if (block.length === 0) {
  41851. break;
  41852. }
  41853. stream.pos += block.length;
  41854. if (block.found) {
  41855. actualLength = stream.pos - streamStartPos;
  41856. break;
  41857. }
  41858. }
  41859. stream.pos = streamStartPos;
  41860. if (actualLength) {
  41861. return {
  41862. stream: new _stream.Stream(stream.getBytes(actualLength)),
  41863. length: actualLength
  41864. };
  41865. }
  41866. (0, _util.warn)('Unable to recover "Length1" property in Type1 font -- using as is.');
  41867. return {
  41868. stream: new _stream.Stream(stream.getBytes(suggestedLength)),
  41869. length: suggestedLength
  41870. };
  41871. }
  41872. function getEexecBlock(stream, suggestedLength) {
  41873. const eexecBytes = stream.getBytes();
  41874. return {
  41875. stream: new _stream.Stream(eexecBytes),
  41876. length: eexecBytes.length
  41877. };
  41878. }
  41879. class Type1Font {
  41880. constructor(name, file, properties) {
  41881. const PFB_HEADER_SIZE = 6;
  41882. let headerBlockLength = properties.length1;
  41883. let eexecBlockLength = properties.length2;
  41884. let pfbHeader = file.peekBytes(PFB_HEADER_SIZE);
  41885. const pfbHeaderPresent = pfbHeader[0] === 0x80 && pfbHeader[1] === 0x01;
  41886. if (pfbHeaderPresent) {
  41887. file.skip(PFB_HEADER_SIZE);
  41888. headerBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41889. }
  41890. const headerBlock = getHeaderBlock(file, headerBlockLength);
  41891. const headerBlockParser = new _type1_parser.Type1Parser(headerBlock.stream, false, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41892. headerBlockParser.extractFontHeader(properties);
  41893. if (pfbHeaderPresent) {
  41894. pfbHeader = file.getBytes(PFB_HEADER_SIZE);
  41895. eexecBlockLength = pfbHeader[5] << 24 | pfbHeader[4] << 16 | pfbHeader[3] << 8 | pfbHeader[2];
  41896. }
  41897. const eexecBlock = getEexecBlock(file, eexecBlockLength);
  41898. const eexecBlockParser = new _type1_parser.Type1Parser(eexecBlock.stream, true, _fonts_utils.SEAC_ANALYSIS_ENABLED);
  41899. const data = eexecBlockParser.extractFontProgram(properties);
  41900. for (const key in data.properties) {
  41901. properties[key] = data.properties[key];
  41902. }
  41903. const charstrings = data.charstrings;
  41904. const type2Charstrings = this.getType2Charstrings(charstrings);
  41905. const subrs = this.getType2Subrs(data.subrs);
  41906. this.charstrings = charstrings;
  41907. this.data = this.wrap(name, type2Charstrings, this.charstrings, subrs, properties);
  41908. this.seacs = this.getSeacs(data.charstrings);
  41909. }
  41910. get numGlyphs() {
  41911. return this.charstrings.length + 1;
  41912. }
  41913. getCharset() {
  41914. const charset = [".notdef"];
  41915. const charstrings = this.charstrings;
  41916. for (let glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41917. charset.push(charstrings[glyphId].glyphName);
  41918. }
  41919. return charset;
  41920. }
  41921. getGlyphMapping(properties) {
  41922. const charstrings = this.charstrings;
  41923. if (properties.composite) {
  41924. const charCodeToGlyphId = Object.create(null);
  41925. for (let glyphId = 0, charstringsLen = charstrings.length; glyphId < charstringsLen; glyphId++) {
  41926. const charCode = properties.cMap.charCodeOf(glyphId);
  41927. charCodeToGlyphId[charCode] = glyphId + 1;
  41928. }
  41929. return charCodeToGlyphId;
  41930. }
  41931. const glyphNames = [".notdef"];
  41932. let builtInEncoding, glyphId;
  41933. for (glyphId = 0; glyphId < charstrings.length; glyphId++) {
  41934. glyphNames.push(charstrings[glyphId].glyphName);
  41935. }
  41936. const encoding = properties.builtInEncoding;
  41937. if (encoding) {
  41938. builtInEncoding = Object.create(null);
  41939. for (const charCode in encoding) {
  41940. glyphId = glyphNames.indexOf(encoding[charCode]);
  41941. if (glyphId >= 0) {
  41942. builtInEncoding[charCode] = glyphId;
  41943. }
  41944. }
  41945. }
  41946. return (0, _fonts_utils.type1FontGlyphMapping)(properties, builtInEncoding, glyphNames);
  41947. }
  41948. hasGlyphId(id) {
  41949. if (id < 0 || id >= this.numGlyphs) {
  41950. return false;
  41951. }
  41952. if (id === 0) {
  41953. return true;
  41954. }
  41955. const glyph = this.charstrings[id - 1];
  41956. return glyph.charstring.length > 0;
  41957. }
  41958. getSeacs(charstrings) {
  41959. const seacMap = [];
  41960. for (let i = 0, ii = charstrings.length; i < ii; i++) {
  41961. const charstring = charstrings[i];
  41962. if (charstring.seac) {
  41963. seacMap[i + 1] = charstring.seac;
  41964. }
  41965. }
  41966. return seacMap;
  41967. }
  41968. getType2Charstrings(type1Charstrings) {
  41969. const type2Charstrings = [];
  41970. for (let i = 0, ii = type1Charstrings.length; i < ii; i++) {
  41971. type2Charstrings.push(type1Charstrings[i].charstring);
  41972. }
  41973. return type2Charstrings;
  41974. }
  41975. getType2Subrs(type1Subrs) {
  41976. let bias = 0;
  41977. const count = type1Subrs.length;
  41978. if (count < 1133) {
  41979. bias = 107;
  41980. } else if (count < 33769) {
  41981. bias = 1131;
  41982. } else {
  41983. bias = 32768;
  41984. }
  41985. const type2Subrs = [];
  41986. let i;
  41987. for (i = 0; i < bias; i++) {
  41988. type2Subrs.push([0x0b]);
  41989. }
  41990. for (i = 0; i < count; i++) {
  41991. type2Subrs.push(type1Subrs[i]);
  41992. }
  41993. return type2Subrs;
  41994. }
  41995. wrap(name, glyphs, charstrings, subrs, properties) {
  41996. const cff = new _cff_parser.CFF();
  41997. cff.header = new _cff_parser.CFFHeader(1, 0, 4, 4);
  41998. cff.names = [name];
  41999. const topDict = new _cff_parser.CFFTopDict();
  42000. topDict.setByName("version", 391);
  42001. topDict.setByName("Notice", 392);
  42002. topDict.setByName("FullName", 393);
  42003. topDict.setByName("FamilyName", 394);
  42004. topDict.setByName("Weight", 395);
  42005. topDict.setByName("Encoding", null);
  42006. topDict.setByName("FontMatrix", properties.fontMatrix);
  42007. topDict.setByName("FontBBox", properties.bbox);
  42008. topDict.setByName("charset", null);
  42009. topDict.setByName("CharStrings", null);
  42010. topDict.setByName("Private", null);
  42011. cff.topDict = topDict;
  42012. const strings = new _cff_parser.CFFStrings();
  42013. strings.add("Version 0.11");
  42014. strings.add("See original notice");
  42015. strings.add(name);
  42016. strings.add(name);
  42017. strings.add("Medium");
  42018. cff.strings = strings;
  42019. cff.globalSubrIndex = new _cff_parser.CFFIndex();
  42020. const count = glyphs.length;
  42021. const charsetArray = [".notdef"];
  42022. let i, ii;
  42023. for (i = 0; i < count; i++) {
  42024. const glyphName = charstrings[i].glyphName;
  42025. const index = _cff_parser.CFFStandardStrings.indexOf(glyphName);
  42026. if (index === -1) {
  42027. strings.add(glyphName);
  42028. }
  42029. charsetArray.push(glyphName);
  42030. }
  42031. cff.charset = new _cff_parser.CFFCharset(false, 0, charsetArray);
  42032. const charStringsIndex = new _cff_parser.CFFIndex();
  42033. charStringsIndex.add([0x8b, 0x0e]);
  42034. for (i = 0; i < count; i++) {
  42035. charStringsIndex.add(glyphs[i]);
  42036. }
  42037. cff.charStrings = charStringsIndex;
  42038. const privateDict = new _cff_parser.CFFPrivateDict();
  42039. privateDict.setByName("Subrs", null);
  42040. const fields = ["BlueValues", "OtherBlues", "FamilyBlues", "FamilyOtherBlues", "StemSnapH", "StemSnapV", "BlueShift", "BlueFuzz", "BlueScale", "LanguageGroup", "ExpansionFactor", "ForceBold", "StdHW", "StdVW"];
  42041. for (i = 0, ii = fields.length; i < ii; i++) {
  42042. const field = fields[i];
  42043. if (!(field in properties.privateData)) {
  42044. continue;
  42045. }
  42046. const value = properties.privateData[field];
  42047. if (Array.isArray(value)) {
  42048. for (let j = value.length - 1; j > 0; j--) {
  42049. value[j] -= value[j - 1];
  42050. }
  42051. }
  42052. privateDict.setByName(field, value);
  42053. }
  42054. cff.topDict.privateDict = privateDict;
  42055. const subrIndex = new _cff_parser.CFFIndex();
  42056. for (i = 0, ii = subrs.length; i < ii; i++) {
  42057. subrIndex.add(subrs[i]);
  42058. }
  42059. privateDict.subrsIndex = subrIndex;
  42060. const compiler = new _cff_parser.CFFCompiler(cff);
  42061. return compiler.compile();
  42062. }
  42063. }
  42064. exports.Type1Font = Type1Font;
  42065. /***/ }),
  42066. /* 55 */
  42067. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42068. Object.defineProperty(exports, "__esModule", ({
  42069. value: true
  42070. }));
  42071. exports.Type1Parser = void 0;
  42072. var _encodings = __w_pdfjs_require__(19);
  42073. var _core_utils = __w_pdfjs_require__(8);
  42074. var _stream = __w_pdfjs_require__(10);
  42075. var _util = __w_pdfjs_require__(2);
  42076. const HINTING_ENABLED = false;
  42077. const Type1CharString = function Type1CharStringClosure() {
  42078. const COMMAND_MAP = {
  42079. hstem: [1],
  42080. vstem: [3],
  42081. vmoveto: [4],
  42082. rlineto: [5],
  42083. hlineto: [6],
  42084. vlineto: [7],
  42085. rrcurveto: [8],
  42086. callsubr: [10],
  42087. flex: [12, 35],
  42088. drop: [12, 18],
  42089. endchar: [14],
  42090. rmoveto: [21],
  42091. hmoveto: [22],
  42092. vhcurveto: [30],
  42093. hvcurveto: [31]
  42094. };
  42095. class Type1CharString {
  42096. constructor() {
  42097. this.width = 0;
  42098. this.lsb = 0;
  42099. this.flexing = false;
  42100. this.output = [];
  42101. this.stack = [];
  42102. }
  42103. convert(encoded, subrs, seacAnalysisEnabled) {
  42104. const count = encoded.length;
  42105. let error = false;
  42106. let wx, sbx, subrNumber;
  42107. for (let i = 0; i < count; i++) {
  42108. let value = encoded[i];
  42109. if (value < 32) {
  42110. if (value === 12) {
  42111. value = (value << 8) + encoded[++i];
  42112. }
  42113. switch (value) {
  42114. case 1:
  42115. if (!HINTING_ENABLED) {
  42116. this.stack = [];
  42117. break;
  42118. }
  42119. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42120. break;
  42121. case 3:
  42122. if (!HINTING_ENABLED) {
  42123. this.stack = [];
  42124. break;
  42125. }
  42126. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42127. break;
  42128. case 4:
  42129. if (this.flexing) {
  42130. if (this.stack.length < 1) {
  42131. error = true;
  42132. break;
  42133. }
  42134. const dy = this.stack.pop();
  42135. this.stack.push(0, dy);
  42136. break;
  42137. }
  42138. error = this.executeCommand(1, COMMAND_MAP.vmoveto);
  42139. break;
  42140. case 5:
  42141. error = this.executeCommand(2, COMMAND_MAP.rlineto);
  42142. break;
  42143. case 6:
  42144. error = this.executeCommand(1, COMMAND_MAP.hlineto);
  42145. break;
  42146. case 7:
  42147. error = this.executeCommand(1, COMMAND_MAP.vlineto);
  42148. break;
  42149. case 8:
  42150. error = this.executeCommand(6, COMMAND_MAP.rrcurveto);
  42151. break;
  42152. case 9:
  42153. this.stack = [];
  42154. break;
  42155. case 10:
  42156. if (this.stack.length < 1) {
  42157. error = true;
  42158. break;
  42159. }
  42160. subrNumber = this.stack.pop();
  42161. if (!subrs[subrNumber]) {
  42162. error = true;
  42163. break;
  42164. }
  42165. error = this.convert(subrs[subrNumber], subrs, seacAnalysisEnabled);
  42166. break;
  42167. case 11:
  42168. return error;
  42169. case 13:
  42170. if (this.stack.length < 2) {
  42171. error = true;
  42172. break;
  42173. }
  42174. wx = this.stack.pop();
  42175. sbx = this.stack.pop();
  42176. this.lsb = sbx;
  42177. this.width = wx;
  42178. this.stack.push(wx, sbx);
  42179. error = this.executeCommand(2, COMMAND_MAP.hmoveto);
  42180. break;
  42181. case 14:
  42182. this.output.push(COMMAND_MAP.endchar[0]);
  42183. break;
  42184. case 21:
  42185. if (this.flexing) {
  42186. break;
  42187. }
  42188. error = this.executeCommand(2, COMMAND_MAP.rmoveto);
  42189. break;
  42190. case 22:
  42191. if (this.flexing) {
  42192. this.stack.push(0);
  42193. break;
  42194. }
  42195. error = this.executeCommand(1, COMMAND_MAP.hmoveto);
  42196. break;
  42197. case 30:
  42198. error = this.executeCommand(4, COMMAND_MAP.vhcurveto);
  42199. break;
  42200. case 31:
  42201. error = this.executeCommand(4, COMMAND_MAP.hvcurveto);
  42202. break;
  42203. case (12 << 8) + 0:
  42204. this.stack = [];
  42205. break;
  42206. case (12 << 8) + 1:
  42207. if (!HINTING_ENABLED) {
  42208. this.stack = [];
  42209. break;
  42210. }
  42211. error = this.executeCommand(2, COMMAND_MAP.vstem);
  42212. break;
  42213. case (12 << 8) + 2:
  42214. if (!HINTING_ENABLED) {
  42215. this.stack = [];
  42216. break;
  42217. }
  42218. error = this.executeCommand(2, COMMAND_MAP.hstem);
  42219. break;
  42220. case (12 << 8) + 6:
  42221. if (seacAnalysisEnabled) {
  42222. const asb = this.stack[this.stack.length - 5];
  42223. this.seac = this.stack.splice(-4, 4);
  42224. this.seac[0] += this.lsb - asb;
  42225. error = this.executeCommand(0, COMMAND_MAP.endchar);
  42226. } else {
  42227. error = this.executeCommand(4, COMMAND_MAP.endchar);
  42228. }
  42229. break;
  42230. case (12 << 8) + 7:
  42231. if (this.stack.length < 4) {
  42232. error = true;
  42233. break;
  42234. }
  42235. this.stack.pop();
  42236. wx = this.stack.pop();
  42237. const sby = this.stack.pop();
  42238. sbx = this.stack.pop();
  42239. this.lsb = sbx;
  42240. this.width = wx;
  42241. this.stack.push(wx, sbx, sby);
  42242. error = this.executeCommand(3, COMMAND_MAP.rmoveto);
  42243. break;
  42244. case (12 << 8) + 12:
  42245. if (this.stack.length < 2) {
  42246. error = true;
  42247. break;
  42248. }
  42249. const num2 = this.stack.pop();
  42250. const num1 = this.stack.pop();
  42251. this.stack.push(num1 / num2);
  42252. break;
  42253. case (12 << 8) + 16:
  42254. if (this.stack.length < 2) {
  42255. error = true;
  42256. break;
  42257. }
  42258. subrNumber = this.stack.pop();
  42259. const numArgs = this.stack.pop();
  42260. if (subrNumber === 0 && numArgs === 3) {
  42261. const flexArgs = this.stack.splice(this.stack.length - 17, 17);
  42262. 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]);
  42263. error = this.executeCommand(13, COMMAND_MAP.flex, true);
  42264. this.flexing = false;
  42265. this.stack.push(flexArgs[15], flexArgs[16]);
  42266. } else if (subrNumber === 1 && numArgs === 0) {
  42267. this.flexing = true;
  42268. }
  42269. break;
  42270. case (12 << 8) + 17:
  42271. break;
  42272. case (12 << 8) + 33:
  42273. this.stack = [];
  42274. break;
  42275. default:
  42276. (0, _util.warn)('Unknown type 1 charstring command of "' + value + '"');
  42277. break;
  42278. }
  42279. if (error) {
  42280. break;
  42281. }
  42282. continue;
  42283. } else if (value <= 246) {
  42284. value -= 139;
  42285. } else if (value <= 250) {
  42286. value = (value - 247) * 256 + encoded[++i] + 108;
  42287. } else if (value <= 254) {
  42288. value = -((value - 251) * 256) - encoded[++i] - 108;
  42289. } else {
  42290. value = (encoded[++i] & 0xff) << 24 | (encoded[++i] & 0xff) << 16 | (encoded[++i] & 0xff) << 8 | (encoded[++i] & 0xff) << 0;
  42291. }
  42292. this.stack.push(value);
  42293. }
  42294. return error;
  42295. }
  42296. executeCommand(howManyArgs, command, keepStack) {
  42297. const stackLength = this.stack.length;
  42298. if (howManyArgs > stackLength) {
  42299. return true;
  42300. }
  42301. const start = stackLength - howManyArgs;
  42302. for (let i = start; i < stackLength; i++) {
  42303. let value = this.stack[i];
  42304. if (Number.isInteger(value)) {
  42305. this.output.push(28, value >> 8 & 0xff, value & 0xff);
  42306. } else {
  42307. value = 65536 * value | 0;
  42308. this.output.push(255, value >> 24 & 0xff, value >> 16 & 0xff, value >> 8 & 0xff, value & 0xff);
  42309. }
  42310. }
  42311. this.output.push.apply(this.output, command);
  42312. if (keepStack) {
  42313. this.stack.splice(start, howManyArgs);
  42314. } else {
  42315. this.stack.length = 0;
  42316. }
  42317. return false;
  42318. }
  42319. }
  42320. return Type1CharString;
  42321. }();
  42322. const Type1Parser = function Type1ParserClosure() {
  42323. const EEXEC_ENCRYPT_KEY = 55665;
  42324. const CHAR_STRS_ENCRYPT_KEY = 4330;
  42325. function isHexDigit(code) {
  42326. return code >= 48 && code <= 57 || code >= 65 && code <= 70 || code >= 97 && code <= 102;
  42327. }
  42328. function decrypt(data, key, discardNumber) {
  42329. if (discardNumber >= data.length) {
  42330. return new Uint8Array(0);
  42331. }
  42332. const c1 = 52845,
  42333. c2 = 22719;
  42334. let r = key | 0,
  42335. i,
  42336. j;
  42337. for (i = 0; i < discardNumber; i++) {
  42338. r = (data[i] + r) * c1 + c2 & (1 << 16) - 1;
  42339. }
  42340. const count = data.length - discardNumber;
  42341. const decrypted = new Uint8Array(count);
  42342. for (i = discardNumber, j = 0; j < count; i++, j++) {
  42343. const value = data[i];
  42344. decrypted[j] = value ^ r >> 8;
  42345. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42346. }
  42347. return decrypted;
  42348. }
  42349. function decryptAscii(data, key, discardNumber) {
  42350. const c1 = 52845,
  42351. c2 = 22719;
  42352. let r = key | 0;
  42353. const count = data.length,
  42354. maybeLength = count >>> 1;
  42355. const decrypted = new Uint8Array(maybeLength);
  42356. let i, j;
  42357. for (i = 0, j = 0; i < count; i++) {
  42358. const digit1 = data[i];
  42359. if (!isHexDigit(digit1)) {
  42360. continue;
  42361. }
  42362. i++;
  42363. let digit2;
  42364. while (i < count && !isHexDigit(digit2 = data[i])) {
  42365. i++;
  42366. }
  42367. if (i < count) {
  42368. const value = parseInt(String.fromCharCode(digit1, digit2), 16);
  42369. decrypted[j++] = value ^ r >> 8;
  42370. r = (value + r) * c1 + c2 & (1 << 16) - 1;
  42371. }
  42372. }
  42373. return decrypted.slice(discardNumber, j);
  42374. }
  42375. function isSpecial(c) {
  42376. return c === 0x2f || c === 0x5b || c === 0x5d || c === 0x7b || c === 0x7d || c === 0x28 || c === 0x29;
  42377. }
  42378. class Type1Parser {
  42379. constructor(stream, encrypted, seacAnalysisEnabled) {
  42380. if (encrypted) {
  42381. const data = stream.getBytes();
  42382. const isBinary = !((isHexDigit(data[0]) || (0, _core_utils.isWhiteSpace)(data[0])) && isHexDigit(data[1]) && isHexDigit(data[2]) && isHexDigit(data[3]) && isHexDigit(data[4]) && isHexDigit(data[5]) && isHexDigit(data[6]) && isHexDigit(data[7]));
  42383. stream = new _stream.Stream(isBinary ? decrypt(data, EEXEC_ENCRYPT_KEY, 4) : decryptAscii(data, EEXEC_ENCRYPT_KEY, 4));
  42384. }
  42385. this.seacAnalysisEnabled = !!seacAnalysisEnabled;
  42386. this.stream = stream;
  42387. this.nextChar();
  42388. }
  42389. readNumberArray() {
  42390. this.getToken();
  42391. const array = [];
  42392. while (true) {
  42393. const token = this.getToken();
  42394. if (token === null || token === "]" || token === "}") {
  42395. break;
  42396. }
  42397. array.push(parseFloat(token || 0));
  42398. }
  42399. return array;
  42400. }
  42401. readNumber() {
  42402. const token = this.getToken();
  42403. return parseFloat(token || 0);
  42404. }
  42405. readInt() {
  42406. const token = this.getToken();
  42407. return parseInt(token || 0, 10) | 0;
  42408. }
  42409. readBoolean() {
  42410. const token = this.getToken();
  42411. return token === "true" ? 1 : 0;
  42412. }
  42413. nextChar() {
  42414. return this.currentChar = this.stream.getByte();
  42415. }
  42416. prevChar() {
  42417. this.stream.skip(-2);
  42418. return this.currentChar = this.stream.getByte();
  42419. }
  42420. getToken() {
  42421. let comment = false;
  42422. let ch = this.currentChar;
  42423. while (true) {
  42424. if (ch === -1) {
  42425. return null;
  42426. }
  42427. if (comment) {
  42428. if (ch === 0x0a || ch === 0x0d) {
  42429. comment = false;
  42430. }
  42431. } else if (ch === 0x25) {
  42432. comment = true;
  42433. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  42434. break;
  42435. }
  42436. ch = this.nextChar();
  42437. }
  42438. if (isSpecial(ch)) {
  42439. this.nextChar();
  42440. return String.fromCharCode(ch);
  42441. }
  42442. let token = "";
  42443. do {
  42444. token += String.fromCharCode(ch);
  42445. ch = this.nextChar();
  42446. } while (ch >= 0 && !(0, _core_utils.isWhiteSpace)(ch) && !isSpecial(ch));
  42447. return token;
  42448. }
  42449. readCharStrings(bytes, lenIV) {
  42450. if (lenIV === -1) {
  42451. return bytes;
  42452. }
  42453. return decrypt(bytes, CHAR_STRS_ENCRYPT_KEY, lenIV);
  42454. }
  42455. extractFontProgram(properties) {
  42456. const stream = this.stream;
  42457. const subrs = [],
  42458. charstrings = [];
  42459. const privateData = Object.create(null);
  42460. privateData.lenIV = 4;
  42461. const program = {
  42462. subrs: [],
  42463. charstrings: [],
  42464. properties: {
  42465. privateData
  42466. }
  42467. };
  42468. let token, length, data, lenIV, encoded;
  42469. while ((token = this.getToken()) !== null) {
  42470. if (token !== "/") {
  42471. continue;
  42472. }
  42473. token = this.getToken();
  42474. switch (token) {
  42475. case "CharStrings":
  42476. this.getToken();
  42477. this.getToken();
  42478. this.getToken();
  42479. this.getToken();
  42480. while (true) {
  42481. token = this.getToken();
  42482. if (token === null || token === "end") {
  42483. break;
  42484. }
  42485. if (token !== "/") {
  42486. continue;
  42487. }
  42488. const glyph = this.getToken();
  42489. length = this.readInt();
  42490. this.getToken();
  42491. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42492. lenIV = program.properties.privateData.lenIV;
  42493. encoded = this.readCharStrings(data, lenIV);
  42494. this.nextChar();
  42495. token = this.getToken();
  42496. if (token === "noaccess") {
  42497. this.getToken();
  42498. } else if (token === "/") {
  42499. this.prevChar();
  42500. }
  42501. charstrings.push({
  42502. glyph,
  42503. encoded
  42504. });
  42505. }
  42506. break;
  42507. case "Subrs":
  42508. this.readInt();
  42509. this.getToken();
  42510. while (this.getToken() === "dup") {
  42511. const index = this.readInt();
  42512. length = this.readInt();
  42513. this.getToken();
  42514. data = length > 0 ? stream.getBytes(length) : new Uint8Array(0);
  42515. lenIV = program.properties.privateData.lenIV;
  42516. encoded = this.readCharStrings(data, lenIV);
  42517. this.nextChar();
  42518. token = this.getToken();
  42519. if (token === "noaccess") {
  42520. this.getToken();
  42521. }
  42522. subrs[index] = encoded;
  42523. }
  42524. break;
  42525. case "BlueValues":
  42526. case "OtherBlues":
  42527. case "FamilyBlues":
  42528. case "FamilyOtherBlues":
  42529. const blueArray = this.readNumberArray();
  42530. if (blueArray.length > 0 && blueArray.length % 2 === 0 && HINTING_ENABLED) {
  42531. program.properties.privateData[token] = blueArray;
  42532. }
  42533. break;
  42534. case "StemSnapH":
  42535. case "StemSnapV":
  42536. program.properties.privateData[token] = this.readNumberArray();
  42537. break;
  42538. case "StdHW":
  42539. case "StdVW":
  42540. program.properties.privateData[token] = this.readNumberArray()[0];
  42541. break;
  42542. case "BlueShift":
  42543. case "lenIV":
  42544. case "BlueFuzz":
  42545. case "BlueScale":
  42546. case "LanguageGroup":
  42547. case "ExpansionFactor":
  42548. program.properties.privateData[token] = this.readNumber();
  42549. break;
  42550. case "ForceBold":
  42551. program.properties.privateData[token] = this.readBoolean();
  42552. break;
  42553. }
  42554. }
  42555. for (let i = 0; i < charstrings.length; i++) {
  42556. const glyph = charstrings[i].glyph;
  42557. encoded = charstrings[i].encoded;
  42558. const charString = new Type1CharString();
  42559. const error = charString.convert(encoded, subrs, this.seacAnalysisEnabled);
  42560. let output = charString.output;
  42561. if (error) {
  42562. output = [14];
  42563. }
  42564. const charStringObject = {
  42565. glyphName: glyph,
  42566. charstring: output,
  42567. width: charString.width,
  42568. lsb: charString.lsb,
  42569. seac: charString.seac
  42570. };
  42571. if (glyph === ".notdef") {
  42572. program.charstrings.unshift(charStringObject);
  42573. } else {
  42574. program.charstrings.push(charStringObject);
  42575. }
  42576. if (properties.builtInEncoding) {
  42577. const index = properties.builtInEncoding.indexOf(glyph);
  42578. if (index > -1 && properties.widths[index] === undefined && index >= properties.firstChar && index <= properties.lastChar) {
  42579. properties.widths[index] = charString.width;
  42580. }
  42581. }
  42582. }
  42583. return program;
  42584. }
  42585. extractFontHeader(properties) {
  42586. let token;
  42587. while ((token = this.getToken()) !== null) {
  42588. if (token !== "/") {
  42589. continue;
  42590. }
  42591. token = this.getToken();
  42592. switch (token) {
  42593. case "FontMatrix":
  42594. const matrix = this.readNumberArray();
  42595. properties.fontMatrix = matrix;
  42596. break;
  42597. case "Encoding":
  42598. const encodingArg = this.getToken();
  42599. let encoding;
  42600. if (!/^\d+$/.test(encodingArg)) {
  42601. encoding = (0, _encodings.getEncoding)(encodingArg);
  42602. } else {
  42603. encoding = [];
  42604. const size = parseInt(encodingArg, 10) | 0;
  42605. this.getToken();
  42606. for (let j = 0; j < size; j++) {
  42607. token = this.getToken();
  42608. while (token !== "dup" && token !== "def") {
  42609. token = this.getToken();
  42610. if (token === null) {
  42611. return;
  42612. }
  42613. }
  42614. if (token === "def") {
  42615. break;
  42616. }
  42617. const index = this.readInt();
  42618. this.getToken();
  42619. const glyph = this.getToken();
  42620. encoding[index] = glyph;
  42621. this.getToken();
  42622. }
  42623. }
  42624. properties.builtInEncoding = encoding;
  42625. break;
  42626. case "FontBBox":
  42627. const fontBBox = this.readNumberArray();
  42628. properties.ascent = Math.max(fontBBox[3], fontBBox[1]);
  42629. properties.descent = Math.min(fontBBox[1], fontBBox[3]);
  42630. properties.ascentScaled = true;
  42631. break;
  42632. }
  42633. }
  42634. }
  42635. }
  42636. return Type1Parser;
  42637. }();
  42638. exports.Type1Parser = Type1Parser;
  42639. /***/ }),
  42640. /* 56 */
  42641. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  42642. Object.defineProperty(exports, "__esModule", ({
  42643. value: true
  42644. }));
  42645. exports.Pattern = void 0;
  42646. exports.getTilingPatternIR = getTilingPatternIR;
  42647. var _util = __w_pdfjs_require__(2);
  42648. var _base_stream = __w_pdfjs_require__(9);
  42649. var _colorspace = __w_pdfjs_require__(24);
  42650. var _core_utils = __w_pdfjs_require__(8);
  42651. const ShadingType = {
  42652. FUNCTION_BASED: 1,
  42653. AXIAL: 2,
  42654. RADIAL: 3,
  42655. FREE_FORM_MESH: 4,
  42656. LATTICE_FORM_MESH: 5,
  42657. COONS_PATCH_MESH: 6,
  42658. TENSOR_PATCH_MESH: 7
  42659. };
  42660. class Pattern {
  42661. constructor() {
  42662. (0, _util.unreachable)("Cannot initialize Pattern.");
  42663. }
  42664. static parseShading(shading, xref, res, handler, pdfFunctionFactory, localColorSpaceCache) {
  42665. const dict = shading instanceof _base_stream.BaseStream ? shading.dict : shading;
  42666. const type = dict.get("ShadingType");
  42667. try {
  42668. switch (type) {
  42669. case ShadingType.AXIAL:
  42670. case ShadingType.RADIAL:
  42671. return new RadialAxialShading(dict, xref, res, pdfFunctionFactory, localColorSpaceCache);
  42672. case ShadingType.FREE_FORM_MESH:
  42673. case ShadingType.LATTICE_FORM_MESH:
  42674. case ShadingType.COONS_PATCH_MESH:
  42675. case ShadingType.TENSOR_PATCH_MESH:
  42676. return new MeshShading(shading, xref, res, pdfFunctionFactory, localColorSpaceCache);
  42677. default:
  42678. throw new _util.FormatError("Unsupported ShadingType: " + type);
  42679. }
  42680. } catch (ex) {
  42681. if (ex instanceof _core_utils.MissingDataException) {
  42682. throw ex;
  42683. }
  42684. handler.send("UnsupportedFeature", {
  42685. featureId: _util.UNSUPPORTED_FEATURES.shadingPattern
  42686. });
  42687. (0, _util.warn)(ex);
  42688. return new DummyShading();
  42689. }
  42690. }
  42691. }
  42692. exports.Pattern = Pattern;
  42693. class BaseShading {
  42694. static get SMALL_NUMBER() {
  42695. return (0, _util.shadow)(this, "SMALL_NUMBER", 1e-6);
  42696. }
  42697. constructor() {
  42698. if (this.constructor === BaseShading) {
  42699. (0, _util.unreachable)("Cannot initialize BaseShading.");
  42700. }
  42701. }
  42702. getIR() {
  42703. (0, _util.unreachable)("Abstract method `getIR` called.");
  42704. }
  42705. }
  42706. class RadialAxialShading extends BaseShading {
  42707. constructor(dict, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  42708. super();
  42709. this.coordsArr = dict.getArray("Coords");
  42710. this.shadingType = dict.get("ShadingType");
  42711. const cs = _colorspace.ColorSpace.parse({
  42712. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  42713. xref,
  42714. resources,
  42715. pdfFunctionFactory,
  42716. localColorSpaceCache
  42717. });
  42718. const bbox = dict.getArray("BBox");
  42719. if (Array.isArray(bbox) && bbox.length === 4) {
  42720. this.bbox = _util.Util.normalizeRect(bbox);
  42721. } else {
  42722. this.bbox = null;
  42723. }
  42724. let t0 = 0.0,
  42725. t1 = 1.0;
  42726. if (dict.has("Domain")) {
  42727. const domainArr = dict.getArray("Domain");
  42728. t0 = domainArr[0];
  42729. t1 = domainArr[1];
  42730. }
  42731. let extendStart = false,
  42732. extendEnd = false;
  42733. if (dict.has("Extend")) {
  42734. const extendArr = dict.getArray("Extend");
  42735. extendStart = extendArr[0];
  42736. extendEnd = extendArr[1];
  42737. }
  42738. if (this.shadingType === ShadingType.RADIAL && (!extendStart || !extendEnd)) {
  42739. const [x1, y1, r1, x2, y2, r2] = this.coordsArr;
  42740. const distance = Math.hypot(x1 - x2, y1 - y2);
  42741. if (r1 <= r2 + distance && r2 <= r1 + distance) {
  42742. (0, _util.warn)("Unsupported radial gradient.");
  42743. }
  42744. }
  42745. this.extendStart = extendStart;
  42746. this.extendEnd = extendEnd;
  42747. const fnObj = dict.getRaw("Function");
  42748. const fn = pdfFunctionFactory.createFromArray(fnObj);
  42749. const NUMBER_OF_SAMPLES = 10;
  42750. const step = (t1 - t0) / NUMBER_OF_SAMPLES;
  42751. const colorStops = this.colorStops = [];
  42752. if (t0 >= t1 || step <= 0) {
  42753. (0, _util.info)("Bad shading domain.");
  42754. return;
  42755. }
  42756. const color = new Float32Array(cs.numComps),
  42757. ratio = new Float32Array(1);
  42758. let rgbColor;
  42759. for (let i = 0; i <= NUMBER_OF_SAMPLES; i++) {
  42760. ratio[0] = t0 + i * step;
  42761. fn(ratio, 0, color, 0);
  42762. rgbColor = cs.getRgb(color, 0);
  42763. const cssColor = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  42764. colorStops.push([i / NUMBER_OF_SAMPLES, cssColor]);
  42765. }
  42766. let background = "transparent";
  42767. if (dict.has("Background")) {
  42768. rgbColor = cs.getRgb(dict.get("Background"), 0);
  42769. background = _util.Util.makeHexColor(rgbColor[0], rgbColor[1], rgbColor[2]);
  42770. }
  42771. if (!extendStart) {
  42772. colorStops.unshift([0, background]);
  42773. colorStops[1][0] += BaseShading.SMALL_NUMBER;
  42774. }
  42775. if (!extendEnd) {
  42776. colorStops[colorStops.length - 1][0] -= BaseShading.SMALL_NUMBER;
  42777. colorStops.push([1, background]);
  42778. }
  42779. this.colorStops = colorStops;
  42780. }
  42781. getIR() {
  42782. const coordsArr = this.coordsArr;
  42783. const shadingType = this.shadingType;
  42784. let type, p0, p1, r0, r1;
  42785. if (shadingType === ShadingType.AXIAL) {
  42786. p0 = [coordsArr[0], coordsArr[1]];
  42787. p1 = [coordsArr[2], coordsArr[3]];
  42788. r0 = null;
  42789. r1 = null;
  42790. type = "axial";
  42791. } else if (shadingType === ShadingType.RADIAL) {
  42792. p0 = [coordsArr[0], coordsArr[1]];
  42793. p1 = [coordsArr[3], coordsArr[4]];
  42794. r0 = coordsArr[2];
  42795. r1 = coordsArr[5];
  42796. type = "radial";
  42797. } else {
  42798. (0, _util.unreachable)(`getPattern type unknown: ${shadingType}`);
  42799. }
  42800. return ["RadialAxial", type, this.bbox, this.colorStops, p0, p1, r0, r1];
  42801. }
  42802. }
  42803. class MeshStreamReader {
  42804. constructor(stream, context) {
  42805. this.stream = stream;
  42806. this.context = context;
  42807. this.buffer = 0;
  42808. this.bufferLength = 0;
  42809. const numComps = context.numComps;
  42810. this.tmpCompsBuf = new Float32Array(numComps);
  42811. const csNumComps = context.colorSpace.numComps;
  42812. this.tmpCsCompsBuf = context.colorFn ? new Float32Array(csNumComps) : this.tmpCompsBuf;
  42813. }
  42814. get hasData() {
  42815. if (this.stream.end) {
  42816. return this.stream.pos < this.stream.end;
  42817. }
  42818. if (this.bufferLength > 0) {
  42819. return true;
  42820. }
  42821. const nextByte = this.stream.getByte();
  42822. if (nextByte < 0) {
  42823. return false;
  42824. }
  42825. this.buffer = nextByte;
  42826. this.bufferLength = 8;
  42827. return true;
  42828. }
  42829. readBits(n) {
  42830. let buffer = this.buffer;
  42831. let bufferLength = this.bufferLength;
  42832. if (n === 32) {
  42833. if (bufferLength === 0) {
  42834. return (this.stream.getByte() << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte()) >>> 0;
  42835. }
  42836. buffer = buffer << 24 | this.stream.getByte() << 16 | this.stream.getByte() << 8 | this.stream.getByte();
  42837. const nextByte = this.stream.getByte();
  42838. this.buffer = nextByte & (1 << bufferLength) - 1;
  42839. return (buffer << 8 - bufferLength | (nextByte & 0xff) >> bufferLength) >>> 0;
  42840. }
  42841. if (n === 8 && bufferLength === 0) {
  42842. return this.stream.getByte();
  42843. }
  42844. while (bufferLength < n) {
  42845. buffer = buffer << 8 | this.stream.getByte();
  42846. bufferLength += 8;
  42847. }
  42848. bufferLength -= n;
  42849. this.bufferLength = bufferLength;
  42850. this.buffer = buffer & (1 << bufferLength) - 1;
  42851. return buffer >> bufferLength;
  42852. }
  42853. align() {
  42854. this.buffer = 0;
  42855. this.bufferLength = 0;
  42856. }
  42857. readFlag() {
  42858. return this.readBits(this.context.bitsPerFlag);
  42859. }
  42860. readCoordinate() {
  42861. const bitsPerCoordinate = this.context.bitsPerCoordinate;
  42862. const xi = this.readBits(bitsPerCoordinate);
  42863. const yi = this.readBits(bitsPerCoordinate);
  42864. const decode = this.context.decode;
  42865. const scale = bitsPerCoordinate < 32 ? 1 / ((1 << bitsPerCoordinate) - 1) : 2.3283064365386963e-10;
  42866. return [xi * scale * (decode[1] - decode[0]) + decode[0], yi * scale * (decode[3] - decode[2]) + decode[2]];
  42867. }
  42868. readComponents() {
  42869. const numComps = this.context.numComps;
  42870. const bitsPerComponent = this.context.bitsPerComponent;
  42871. const scale = bitsPerComponent < 32 ? 1 / ((1 << bitsPerComponent) - 1) : 2.3283064365386963e-10;
  42872. const decode = this.context.decode;
  42873. const components = this.tmpCompsBuf;
  42874. for (let i = 0, j = 4; i < numComps; i++, j += 2) {
  42875. const ci = this.readBits(bitsPerComponent);
  42876. components[i] = ci * scale * (decode[j + 1] - decode[j]) + decode[j];
  42877. }
  42878. const color = this.tmpCsCompsBuf;
  42879. if (this.context.colorFn) {
  42880. this.context.colorFn(components, 0, color, 0);
  42881. }
  42882. return this.context.colorSpace.getRgb(color, 0);
  42883. }
  42884. }
  42885. const getB = function getBClosure() {
  42886. function buildB(count) {
  42887. const lut = [];
  42888. for (let i = 0; i <= count; i++) {
  42889. const t = i / count,
  42890. t_ = 1 - t;
  42891. lut.push(new Float32Array([t_ * t_ * t_, 3 * t * t_ * t_, 3 * t * t * t_, t * t * t]));
  42892. }
  42893. return lut;
  42894. }
  42895. const cache = [];
  42896. return function (count) {
  42897. if (!cache[count]) {
  42898. cache[count] = buildB(count);
  42899. }
  42900. return cache[count];
  42901. };
  42902. }();
  42903. class MeshShading extends BaseShading {
  42904. static get MIN_SPLIT_PATCH_CHUNKS_AMOUNT() {
  42905. return (0, _util.shadow)(this, "MIN_SPLIT_PATCH_CHUNKS_AMOUNT", 3);
  42906. }
  42907. static get MAX_SPLIT_PATCH_CHUNKS_AMOUNT() {
  42908. return (0, _util.shadow)(this, "MAX_SPLIT_PATCH_CHUNKS_AMOUNT", 20);
  42909. }
  42910. static get TRIANGLE_DENSITY() {
  42911. return (0, _util.shadow)(this, "TRIANGLE_DENSITY", 20);
  42912. }
  42913. constructor(stream, xref, resources, pdfFunctionFactory, localColorSpaceCache) {
  42914. super();
  42915. if (!(stream instanceof _base_stream.BaseStream)) {
  42916. throw new _util.FormatError("Mesh data is not a stream");
  42917. }
  42918. const dict = stream.dict;
  42919. this.shadingType = dict.get("ShadingType");
  42920. const bbox = dict.getArray("BBox");
  42921. if (Array.isArray(bbox) && bbox.length === 4) {
  42922. this.bbox = _util.Util.normalizeRect(bbox);
  42923. } else {
  42924. this.bbox = null;
  42925. }
  42926. const cs = _colorspace.ColorSpace.parse({
  42927. cs: dict.getRaw("CS") || dict.getRaw("ColorSpace"),
  42928. xref,
  42929. resources,
  42930. pdfFunctionFactory,
  42931. localColorSpaceCache
  42932. });
  42933. this.background = dict.has("Background") ? cs.getRgb(dict.get("Background"), 0) : null;
  42934. const fnObj = dict.getRaw("Function");
  42935. const fn = fnObj ? pdfFunctionFactory.createFromArray(fnObj) : null;
  42936. this.coords = [];
  42937. this.colors = [];
  42938. this.figures = [];
  42939. const decodeContext = {
  42940. bitsPerCoordinate: dict.get("BitsPerCoordinate"),
  42941. bitsPerComponent: dict.get("BitsPerComponent"),
  42942. bitsPerFlag: dict.get("BitsPerFlag"),
  42943. decode: dict.getArray("Decode"),
  42944. colorFn: fn,
  42945. colorSpace: cs,
  42946. numComps: fn ? 1 : cs.numComps
  42947. };
  42948. const reader = new MeshStreamReader(stream, decodeContext);
  42949. let patchMesh = false;
  42950. switch (this.shadingType) {
  42951. case ShadingType.FREE_FORM_MESH:
  42952. this._decodeType4Shading(reader);
  42953. break;
  42954. case ShadingType.LATTICE_FORM_MESH:
  42955. const verticesPerRow = dict.get("VerticesPerRow") | 0;
  42956. if (verticesPerRow < 2) {
  42957. throw new _util.FormatError("Invalid VerticesPerRow");
  42958. }
  42959. this._decodeType5Shading(reader, verticesPerRow);
  42960. break;
  42961. case ShadingType.COONS_PATCH_MESH:
  42962. this._decodeType6Shading(reader);
  42963. patchMesh = true;
  42964. break;
  42965. case ShadingType.TENSOR_PATCH_MESH:
  42966. this._decodeType7Shading(reader);
  42967. patchMesh = true;
  42968. break;
  42969. default:
  42970. (0, _util.unreachable)("Unsupported mesh type.");
  42971. break;
  42972. }
  42973. if (patchMesh) {
  42974. this._updateBounds();
  42975. for (let i = 0, ii = this.figures.length; i < ii; i++) {
  42976. this._buildFigureFromPatch(i);
  42977. }
  42978. }
  42979. this._updateBounds();
  42980. this._packData();
  42981. }
  42982. _decodeType4Shading(reader) {
  42983. const coords = this.coords;
  42984. const colors = this.colors;
  42985. const operators = [];
  42986. const ps = [];
  42987. let verticesLeft = 0;
  42988. while (reader.hasData) {
  42989. const f = reader.readFlag();
  42990. const coord = reader.readCoordinate();
  42991. const color = reader.readComponents();
  42992. if (verticesLeft === 0) {
  42993. if (!(0 <= f && f <= 2)) {
  42994. throw new _util.FormatError("Unknown type4 flag");
  42995. }
  42996. switch (f) {
  42997. case 0:
  42998. verticesLeft = 3;
  42999. break;
  43000. case 1:
  43001. ps.push(ps[ps.length - 2], ps[ps.length - 1]);
  43002. verticesLeft = 1;
  43003. break;
  43004. case 2:
  43005. ps.push(ps[ps.length - 3], ps[ps.length - 1]);
  43006. verticesLeft = 1;
  43007. break;
  43008. }
  43009. operators.push(f);
  43010. }
  43011. ps.push(coords.length);
  43012. coords.push(coord);
  43013. colors.push(color);
  43014. verticesLeft--;
  43015. reader.align();
  43016. }
  43017. this.figures.push({
  43018. type: "triangles",
  43019. coords: new Int32Array(ps),
  43020. colors: new Int32Array(ps)
  43021. });
  43022. }
  43023. _decodeType5Shading(reader, verticesPerRow) {
  43024. const coords = this.coords;
  43025. const colors = this.colors;
  43026. const ps = [];
  43027. while (reader.hasData) {
  43028. const coord = reader.readCoordinate();
  43029. const color = reader.readComponents();
  43030. ps.push(coords.length);
  43031. coords.push(coord);
  43032. colors.push(color);
  43033. }
  43034. this.figures.push({
  43035. type: "lattice",
  43036. coords: new Int32Array(ps),
  43037. colors: new Int32Array(ps),
  43038. verticesPerRow
  43039. });
  43040. }
  43041. _decodeType6Shading(reader) {
  43042. const coords = this.coords;
  43043. const colors = this.colors;
  43044. const ps = new Int32Array(16);
  43045. const cs = new Int32Array(4);
  43046. while (reader.hasData) {
  43047. const f = reader.readFlag();
  43048. if (!(0 <= f && f <= 3)) {
  43049. throw new _util.FormatError("Unknown type6 flag");
  43050. }
  43051. const pi = coords.length;
  43052. for (let i = 0, ii = f !== 0 ? 8 : 12; i < ii; i++) {
  43053. coords.push(reader.readCoordinate());
  43054. }
  43055. const ci = colors.length;
  43056. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43057. colors.push(reader.readComponents());
  43058. }
  43059. let tmp1, tmp2, tmp3, tmp4;
  43060. switch (f) {
  43061. case 0:
  43062. ps[12] = pi + 3;
  43063. ps[13] = pi + 4;
  43064. ps[14] = pi + 5;
  43065. ps[15] = pi + 6;
  43066. ps[8] = pi + 2;
  43067. ps[11] = pi + 7;
  43068. ps[4] = pi + 1;
  43069. ps[7] = pi + 8;
  43070. ps[0] = pi;
  43071. ps[1] = pi + 11;
  43072. ps[2] = pi + 10;
  43073. ps[3] = pi + 9;
  43074. cs[2] = ci + 1;
  43075. cs[3] = ci + 2;
  43076. cs[0] = ci;
  43077. cs[1] = ci + 3;
  43078. break;
  43079. case 1:
  43080. tmp1 = ps[12];
  43081. tmp2 = ps[13];
  43082. tmp3 = ps[14];
  43083. tmp4 = ps[15];
  43084. ps[12] = tmp4;
  43085. ps[13] = pi + 0;
  43086. ps[14] = pi + 1;
  43087. ps[15] = pi + 2;
  43088. ps[8] = tmp3;
  43089. ps[11] = pi + 3;
  43090. ps[4] = tmp2;
  43091. ps[7] = pi + 4;
  43092. ps[0] = tmp1;
  43093. ps[1] = pi + 7;
  43094. ps[2] = pi + 6;
  43095. ps[3] = pi + 5;
  43096. tmp1 = cs[2];
  43097. tmp2 = cs[3];
  43098. cs[2] = tmp2;
  43099. cs[3] = ci;
  43100. cs[0] = tmp1;
  43101. cs[1] = ci + 1;
  43102. break;
  43103. case 2:
  43104. tmp1 = ps[15];
  43105. tmp2 = ps[11];
  43106. ps[12] = ps[3];
  43107. ps[13] = pi + 0;
  43108. ps[14] = pi + 1;
  43109. ps[15] = pi + 2;
  43110. ps[8] = ps[7];
  43111. ps[11] = pi + 3;
  43112. ps[4] = tmp2;
  43113. ps[7] = pi + 4;
  43114. ps[0] = tmp1;
  43115. ps[1] = pi + 7;
  43116. ps[2] = pi + 6;
  43117. ps[3] = pi + 5;
  43118. tmp1 = cs[3];
  43119. cs[2] = cs[1];
  43120. cs[3] = ci;
  43121. cs[0] = tmp1;
  43122. cs[1] = ci + 1;
  43123. break;
  43124. case 3:
  43125. ps[12] = ps[0];
  43126. ps[13] = pi + 0;
  43127. ps[14] = pi + 1;
  43128. ps[15] = pi + 2;
  43129. ps[8] = ps[1];
  43130. ps[11] = pi + 3;
  43131. ps[4] = ps[2];
  43132. ps[7] = pi + 4;
  43133. ps[0] = ps[3];
  43134. ps[1] = pi + 7;
  43135. ps[2] = pi + 6;
  43136. ps[3] = pi + 5;
  43137. cs[2] = cs[0];
  43138. cs[3] = ci;
  43139. cs[0] = cs[1];
  43140. cs[1] = ci + 1;
  43141. break;
  43142. }
  43143. ps[5] = coords.length;
  43144. 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]);
  43145. ps[6] = coords.length;
  43146. 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]);
  43147. ps[9] = coords.length;
  43148. 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]);
  43149. ps[10] = coords.length;
  43150. 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]);
  43151. this.figures.push({
  43152. type: "patch",
  43153. coords: new Int32Array(ps),
  43154. colors: new Int32Array(cs)
  43155. });
  43156. }
  43157. }
  43158. _decodeType7Shading(reader) {
  43159. const coords = this.coords;
  43160. const colors = this.colors;
  43161. const ps = new Int32Array(16);
  43162. const cs = new Int32Array(4);
  43163. while (reader.hasData) {
  43164. const f = reader.readFlag();
  43165. if (!(0 <= f && f <= 3)) {
  43166. throw new _util.FormatError("Unknown type7 flag");
  43167. }
  43168. const pi = coords.length;
  43169. for (let i = 0, ii = f !== 0 ? 12 : 16; i < ii; i++) {
  43170. coords.push(reader.readCoordinate());
  43171. }
  43172. const ci = colors.length;
  43173. for (let i = 0, ii = f !== 0 ? 2 : 4; i < ii; i++) {
  43174. colors.push(reader.readComponents());
  43175. }
  43176. let tmp1, tmp2, tmp3, tmp4;
  43177. switch (f) {
  43178. case 0:
  43179. ps[12] = pi + 3;
  43180. ps[13] = pi + 4;
  43181. ps[14] = pi + 5;
  43182. ps[15] = pi + 6;
  43183. ps[8] = pi + 2;
  43184. ps[9] = pi + 13;
  43185. ps[10] = pi + 14;
  43186. ps[11] = pi + 7;
  43187. ps[4] = pi + 1;
  43188. ps[5] = pi + 12;
  43189. ps[6] = pi + 15;
  43190. ps[7] = pi + 8;
  43191. ps[0] = pi;
  43192. ps[1] = pi + 11;
  43193. ps[2] = pi + 10;
  43194. ps[3] = pi + 9;
  43195. cs[2] = ci + 1;
  43196. cs[3] = ci + 2;
  43197. cs[0] = ci;
  43198. cs[1] = ci + 3;
  43199. break;
  43200. case 1:
  43201. tmp1 = ps[12];
  43202. tmp2 = ps[13];
  43203. tmp3 = ps[14];
  43204. tmp4 = ps[15];
  43205. ps[12] = tmp4;
  43206. ps[13] = pi + 0;
  43207. ps[14] = pi + 1;
  43208. ps[15] = pi + 2;
  43209. ps[8] = tmp3;
  43210. ps[9] = pi + 9;
  43211. ps[10] = pi + 10;
  43212. ps[11] = pi + 3;
  43213. ps[4] = tmp2;
  43214. ps[5] = pi + 8;
  43215. ps[6] = pi + 11;
  43216. ps[7] = pi + 4;
  43217. ps[0] = tmp1;
  43218. ps[1] = pi + 7;
  43219. ps[2] = pi + 6;
  43220. ps[3] = pi + 5;
  43221. tmp1 = cs[2];
  43222. tmp2 = cs[3];
  43223. cs[2] = tmp2;
  43224. cs[3] = ci;
  43225. cs[0] = tmp1;
  43226. cs[1] = ci + 1;
  43227. break;
  43228. case 2:
  43229. tmp1 = ps[15];
  43230. tmp2 = ps[11];
  43231. ps[12] = ps[3];
  43232. ps[13] = pi + 0;
  43233. ps[14] = pi + 1;
  43234. ps[15] = pi + 2;
  43235. ps[8] = ps[7];
  43236. ps[9] = pi + 9;
  43237. ps[10] = pi + 10;
  43238. ps[11] = pi + 3;
  43239. ps[4] = tmp2;
  43240. ps[5] = pi + 8;
  43241. ps[6] = pi + 11;
  43242. ps[7] = pi + 4;
  43243. ps[0] = tmp1;
  43244. ps[1] = pi + 7;
  43245. ps[2] = pi + 6;
  43246. ps[3] = pi + 5;
  43247. tmp1 = cs[3];
  43248. cs[2] = cs[1];
  43249. cs[3] = ci;
  43250. cs[0] = tmp1;
  43251. cs[1] = ci + 1;
  43252. break;
  43253. case 3:
  43254. ps[12] = ps[0];
  43255. ps[13] = pi + 0;
  43256. ps[14] = pi + 1;
  43257. ps[15] = pi + 2;
  43258. ps[8] = ps[1];
  43259. ps[9] = pi + 9;
  43260. ps[10] = pi + 10;
  43261. ps[11] = pi + 3;
  43262. ps[4] = ps[2];
  43263. ps[5] = pi + 8;
  43264. ps[6] = pi + 11;
  43265. ps[7] = pi + 4;
  43266. ps[0] = ps[3];
  43267. ps[1] = pi + 7;
  43268. ps[2] = pi + 6;
  43269. ps[3] = pi + 5;
  43270. cs[2] = cs[0];
  43271. cs[3] = ci;
  43272. cs[0] = cs[1];
  43273. cs[1] = ci + 1;
  43274. break;
  43275. }
  43276. this.figures.push({
  43277. type: "patch",
  43278. coords: new Int32Array(ps),
  43279. colors: new Int32Array(cs)
  43280. });
  43281. }
  43282. }
  43283. _buildFigureFromPatch(index) {
  43284. const figure = this.figures[index];
  43285. (0, _util.assert)(figure.type === "patch", "Unexpected patch mesh figure");
  43286. const coords = this.coords,
  43287. colors = this.colors;
  43288. const pi = figure.coords;
  43289. const ci = figure.colors;
  43290. const figureMinX = Math.min(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43291. const figureMinY = Math.min(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43292. const figureMaxX = Math.max(coords[pi[0]][0], coords[pi[3]][0], coords[pi[12]][0], coords[pi[15]][0]);
  43293. const figureMaxY = Math.max(coords[pi[0]][1], coords[pi[3]][1], coords[pi[12]][1], coords[pi[15]][1]);
  43294. let splitXBy = Math.ceil((figureMaxX - figureMinX) * MeshShading.TRIANGLE_DENSITY / (this.bounds[2] - this.bounds[0]));
  43295. splitXBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitXBy));
  43296. let splitYBy = Math.ceil((figureMaxY - figureMinY) * MeshShading.TRIANGLE_DENSITY / (this.bounds[3] - this.bounds[1]));
  43297. splitYBy = Math.max(MeshShading.MIN_SPLIT_PATCH_CHUNKS_AMOUNT, Math.min(MeshShading.MAX_SPLIT_PATCH_CHUNKS_AMOUNT, splitYBy));
  43298. const verticesPerRow = splitXBy + 1;
  43299. const figureCoords = new Int32Array((splitYBy + 1) * verticesPerRow);
  43300. const figureColors = new Int32Array((splitYBy + 1) * verticesPerRow);
  43301. let k = 0;
  43302. const cl = new Uint8Array(3),
  43303. cr = new Uint8Array(3);
  43304. const c0 = colors[ci[0]],
  43305. c1 = colors[ci[1]],
  43306. c2 = colors[ci[2]],
  43307. c3 = colors[ci[3]];
  43308. const bRow = getB(splitYBy),
  43309. bCol = getB(splitXBy);
  43310. for (let row = 0; row <= splitYBy; row++) {
  43311. cl[0] = (c0[0] * (splitYBy - row) + c2[0] * row) / splitYBy | 0;
  43312. cl[1] = (c0[1] * (splitYBy - row) + c2[1] * row) / splitYBy | 0;
  43313. cl[2] = (c0[2] * (splitYBy - row) + c2[2] * row) / splitYBy | 0;
  43314. cr[0] = (c1[0] * (splitYBy - row) + c3[0] * row) / splitYBy | 0;
  43315. cr[1] = (c1[1] * (splitYBy - row) + c3[1] * row) / splitYBy | 0;
  43316. cr[2] = (c1[2] * (splitYBy - row) + c3[2] * row) / splitYBy | 0;
  43317. for (let col = 0; col <= splitXBy; col++, k++) {
  43318. if ((row === 0 || row === splitYBy) && (col === 0 || col === splitXBy)) {
  43319. continue;
  43320. }
  43321. let x = 0,
  43322. y = 0;
  43323. let q = 0;
  43324. for (let i = 0; i <= 3; i++) {
  43325. for (let j = 0; j <= 3; j++, q++) {
  43326. const m = bRow[row][i] * bCol[col][j];
  43327. x += coords[pi[q]][0] * m;
  43328. y += coords[pi[q]][1] * m;
  43329. }
  43330. }
  43331. figureCoords[k] = coords.length;
  43332. coords.push([x, y]);
  43333. figureColors[k] = colors.length;
  43334. const newColor = new Uint8Array(3);
  43335. newColor[0] = (cl[0] * (splitXBy - col) + cr[0] * col) / splitXBy | 0;
  43336. newColor[1] = (cl[1] * (splitXBy - col) + cr[1] * col) / splitXBy | 0;
  43337. newColor[2] = (cl[2] * (splitXBy - col) + cr[2] * col) / splitXBy | 0;
  43338. colors.push(newColor);
  43339. }
  43340. }
  43341. figureCoords[0] = pi[0];
  43342. figureColors[0] = ci[0];
  43343. figureCoords[splitXBy] = pi[3];
  43344. figureColors[splitXBy] = ci[1];
  43345. figureCoords[verticesPerRow * splitYBy] = pi[12];
  43346. figureColors[verticesPerRow * splitYBy] = ci[2];
  43347. figureCoords[verticesPerRow * splitYBy + splitXBy] = pi[15];
  43348. figureColors[verticesPerRow * splitYBy + splitXBy] = ci[3];
  43349. this.figures[index] = {
  43350. type: "lattice",
  43351. coords: figureCoords,
  43352. colors: figureColors,
  43353. verticesPerRow
  43354. };
  43355. }
  43356. _updateBounds() {
  43357. let minX = this.coords[0][0],
  43358. minY = this.coords[0][1],
  43359. maxX = minX,
  43360. maxY = minY;
  43361. for (let i = 1, ii = this.coords.length; i < ii; i++) {
  43362. const x = this.coords[i][0],
  43363. y = this.coords[i][1];
  43364. minX = minX > x ? x : minX;
  43365. minY = minY > y ? y : minY;
  43366. maxX = maxX < x ? x : maxX;
  43367. maxY = maxY < y ? y : maxY;
  43368. }
  43369. this.bounds = [minX, minY, maxX, maxY];
  43370. }
  43371. _packData() {
  43372. let i, ii, j, jj;
  43373. const coords = this.coords;
  43374. const coordsPacked = new Float32Array(coords.length * 2);
  43375. for (i = 0, j = 0, ii = coords.length; i < ii; i++) {
  43376. const xy = coords[i];
  43377. coordsPacked[j++] = xy[0];
  43378. coordsPacked[j++] = xy[1];
  43379. }
  43380. this.coords = coordsPacked;
  43381. const colors = this.colors;
  43382. const colorsPacked = new Uint8Array(colors.length * 3);
  43383. for (i = 0, j = 0, ii = colors.length; i < ii; i++) {
  43384. const c = colors[i];
  43385. colorsPacked[j++] = c[0];
  43386. colorsPacked[j++] = c[1];
  43387. colorsPacked[j++] = c[2];
  43388. }
  43389. this.colors = colorsPacked;
  43390. const figures = this.figures;
  43391. for (i = 0, ii = figures.length; i < ii; i++) {
  43392. const figure = figures[i],
  43393. ps = figure.coords,
  43394. cs = figure.colors;
  43395. for (j = 0, jj = ps.length; j < jj; j++) {
  43396. ps[j] *= 2;
  43397. cs[j] *= 3;
  43398. }
  43399. }
  43400. }
  43401. getIR() {
  43402. return ["Mesh", this.shadingType, this.coords, this.colors, this.figures, this.bounds, this.bbox, this.background];
  43403. }
  43404. }
  43405. class DummyShading extends BaseShading {
  43406. getIR() {
  43407. return ["Dummy"];
  43408. }
  43409. }
  43410. function getTilingPatternIR(operatorList, dict, color) {
  43411. const matrix = dict.getArray("Matrix");
  43412. const bbox = _util.Util.normalizeRect(dict.getArray("BBox"));
  43413. const xstep = dict.get("XStep");
  43414. const ystep = dict.get("YStep");
  43415. const paintType = dict.get("PaintType");
  43416. const tilingType = dict.get("TilingType");
  43417. if (bbox[2] - bbox[0] === 0 || bbox[3] - bbox[1] === 0) {
  43418. throw new _util.FormatError(`Invalid getTilingPatternIR /BBox array: [${bbox}].`);
  43419. }
  43420. return ["TilingPattern", color, operatorList, matrix, bbox, xstep, ystep, paintType, tilingType];
  43421. }
  43422. /***/ }),
  43423. /* 57 */
  43424. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  43425. Object.defineProperty(exports, "__esModule", ({
  43426. value: true
  43427. }));
  43428. exports.PostScriptEvaluator = exports.PostScriptCompiler = exports.PDFFunctionFactory = void 0;
  43429. exports.isPDFFunction = isPDFFunction;
  43430. var _primitives = __w_pdfjs_require__(5);
  43431. var _util = __w_pdfjs_require__(2);
  43432. var _ps_parser = __w_pdfjs_require__(58);
  43433. var _base_stream = __w_pdfjs_require__(9);
  43434. var _image_utils = __w_pdfjs_require__(59);
  43435. class PDFFunctionFactory {
  43436. constructor({
  43437. xref,
  43438. isEvalSupported = true
  43439. }) {
  43440. this.xref = xref;
  43441. this.isEvalSupported = isEvalSupported !== false;
  43442. }
  43443. create(fn) {
  43444. const cachedFunction = this.getCached(fn);
  43445. if (cachedFunction) {
  43446. return cachedFunction;
  43447. }
  43448. const parsedFunction = PDFFunction.parse({
  43449. xref: this.xref,
  43450. isEvalSupported: this.isEvalSupported,
  43451. fn: fn instanceof _primitives.Ref ? this.xref.fetch(fn) : fn
  43452. });
  43453. this._cache(fn, parsedFunction);
  43454. return parsedFunction;
  43455. }
  43456. createFromArray(fnObj) {
  43457. const cachedFunction = this.getCached(fnObj);
  43458. if (cachedFunction) {
  43459. return cachedFunction;
  43460. }
  43461. const parsedFunction = PDFFunction.parseArray({
  43462. xref: this.xref,
  43463. isEvalSupported: this.isEvalSupported,
  43464. fnObj: fnObj instanceof _primitives.Ref ? this.xref.fetch(fnObj) : fnObj
  43465. });
  43466. this._cache(fnObj, parsedFunction);
  43467. return parsedFunction;
  43468. }
  43469. getCached(cacheKey) {
  43470. let fnRef;
  43471. if (cacheKey instanceof _primitives.Ref) {
  43472. fnRef = cacheKey;
  43473. } else if (cacheKey instanceof _primitives.Dict) {
  43474. fnRef = cacheKey.objId;
  43475. } else if (cacheKey instanceof _base_stream.BaseStream) {
  43476. fnRef = cacheKey.dict && cacheKey.dict.objId;
  43477. }
  43478. if (fnRef) {
  43479. const localFunction = this._localFunctionCache.getByRef(fnRef);
  43480. if (localFunction) {
  43481. return localFunction;
  43482. }
  43483. }
  43484. return null;
  43485. }
  43486. _cache(cacheKey, parsedFunction) {
  43487. if (!parsedFunction) {
  43488. throw new Error('PDFFunctionFactory._cache - expected "parsedFunction" argument.');
  43489. }
  43490. let fnRef;
  43491. if (cacheKey instanceof _primitives.Ref) {
  43492. fnRef = cacheKey;
  43493. } else if (cacheKey instanceof _primitives.Dict) {
  43494. fnRef = cacheKey.objId;
  43495. } else if (cacheKey instanceof _base_stream.BaseStream) {
  43496. fnRef = cacheKey.dict && cacheKey.dict.objId;
  43497. }
  43498. if (fnRef) {
  43499. this._localFunctionCache.set(null, fnRef, parsedFunction);
  43500. }
  43501. }
  43502. get _localFunctionCache() {
  43503. return (0, _util.shadow)(this, "_localFunctionCache", new _image_utils.LocalFunctionCache());
  43504. }
  43505. }
  43506. exports.PDFFunctionFactory = PDFFunctionFactory;
  43507. function toNumberArray(arr) {
  43508. if (!Array.isArray(arr)) {
  43509. return null;
  43510. }
  43511. const length = arr.length;
  43512. for (let i = 0; i < length; i++) {
  43513. if (typeof arr[i] !== "number") {
  43514. const result = new Array(length);
  43515. for (let j = 0; j < length; j++) {
  43516. result[j] = +arr[j];
  43517. }
  43518. return result;
  43519. }
  43520. }
  43521. return arr;
  43522. }
  43523. class PDFFunction {
  43524. static getSampleArray(size, outputSize, bps, stream) {
  43525. let i, ii;
  43526. let length = 1;
  43527. for (i = 0, ii = size.length; i < ii; i++) {
  43528. length *= size[i];
  43529. }
  43530. length *= outputSize;
  43531. const array = new Array(length);
  43532. let codeSize = 0;
  43533. let codeBuf = 0;
  43534. const sampleMul = 1.0 / (2.0 ** bps - 1);
  43535. const strBytes = stream.getBytes((length * bps + 7) / 8);
  43536. let strIdx = 0;
  43537. for (i = 0; i < length; i++) {
  43538. while (codeSize < bps) {
  43539. codeBuf <<= 8;
  43540. codeBuf |= strBytes[strIdx++];
  43541. codeSize += 8;
  43542. }
  43543. codeSize -= bps;
  43544. array[i] = (codeBuf >> codeSize) * sampleMul;
  43545. codeBuf &= (1 << codeSize) - 1;
  43546. }
  43547. return array;
  43548. }
  43549. static parse({
  43550. xref,
  43551. isEvalSupported,
  43552. fn
  43553. }) {
  43554. const dict = fn.dict || fn;
  43555. const typeNum = dict.get("FunctionType");
  43556. switch (typeNum) {
  43557. case 0:
  43558. return this.constructSampled({
  43559. xref,
  43560. isEvalSupported,
  43561. fn,
  43562. dict
  43563. });
  43564. case 1:
  43565. break;
  43566. case 2:
  43567. return this.constructInterpolated({
  43568. xref,
  43569. isEvalSupported,
  43570. dict
  43571. });
  43572. case 3:
  43573. return this.constructStiched({
  43574. xref,
  43575. isEvalSupported,
  43576. dict
  43577. });
  43578. case 4:
  43579. return this.constructPostScript({
  43580. xref,
  43581. isEvalSupported,
  43582. fn,
  43583. dict
  43584. });
  43585. }
  43586. throw new _util.FormatError("Unknown type of function");
  43587. }
  43588. static parseArray({
  43589. xref,
  43590. isEvalSupported,
  43591. fnObj
  43592. }) {
  43593. if (!Array.isArray(fnObj)) {
  43594. return this.parse({
  43595. xref,
  43596. isEvalSupported,
  43597. fn: fnObj
  43598. });
  43599. }
  43600. const fnArray = [];
  43601. for (let j = 0, jj = fnObj.length; j < jj; j++) {
  43602. fnArray.push(this.parse({
  43603. xref,
  43604. isEvalSupported,
  43605. fn: xref.fetchIfRef(fnObj[j])
  43606. }));
  43607. }
  43608. return function (src, srcOffset, dest, destOffset) {
  43609. for (let i = 0, ii = fnArray.length; i < ii; i++) {
  43610. fnArray[i](src, srcOffset, dest, destOffset + i);
  43611. }
  43612. };
  43613. }
  43614. static constructSampled({
  43615. xref,
  43616. isEvalSupported,
  43617. fn,
  43618. dict
  43619. }) {
  43620. function toMultiArray(arr) {
  43621. const inputLength = arr.length;
  43622. const out = [];
  43623. let index = 0;
  43624. for (let i = 0; i < inputLength; i += 2) {
  43625. out[index++] = [arr[i], arr[i + 1]];
  43626. }
  43627. return out;
  43628. }
  43629. function interpolate(x, xmin, xmax, ymin, ymax) {
  43630. return ymin + (x - xmin) * ((ymax - ymin) / (xmax - xmin));
  43631. }
  43632. let domain = toNumberArray(dict.getArray("Domain"));
  43633. let range = toNumberArray(dict.getArray("Range"));
  43634. if (!domain || !range) {
  43635. throw new _util.FormatError("No domain or range");
  43636. }
  43637. const inputSize = domain.length / 2;
  43638. const outputSize = range.length / 2;
  43639. domain = toMultiArray(domain);
  43640. range = toMultiArray(range);
  43641. const size = toNumberArray(dict.getArray("Size"));
  43642. const bps = dict.get("BitsPerSample");
  43643. const order = dict.get("Order") || 1;
  43644. if (order !== 1) {
  43645. (0, _util.info)("No support for cubic spline interpolation: " + order);
  43646. }
  43647. let encode = toNumberArray(dict.getArray("Encode"));
  43648. if (!encode) {
  43649. encode = [];
  43650. for (let i = 0; i < inputSize; ++i) {
  43651. encode.push([0, size[i] - 1]);
  43652. }
  43653. } else {
  43654. encode = toMultiArray(encode);
  43655. }
  43656. let decode = toNumberArray(dict.getArray("Decode"));
  43657. if (!decode) {
  43658. decode = range;
  43659. } else {
  43660. decode = toMultiArray(decode);
  43661. }
  43662. const samples = this.getSampleArray(size, outputSize, bps, fn);
  43663. return function constructSampledFn(src, srcOffset, dest, destOffset) {
  43664. const cubeVertices = 1 << inputSize;
  43665. const cubeN = new Float64Array(cubeVertices);
  43666. const cubeVertex = new Uint32Array(cubeVertices);
  43667. let i, j;
  43668. for (j = 0; j < cubeVertices; j++) {
  43669. cubeN[j] = 1;
  43670. }
  43671. let k = outputSize,
  43672. pos = 1;
  43673. for (i = 0; i < inputSize; ++i) {
  43674. const domain_2i = domain[i][0];
  43675. const domain_2i_1 = domain[i][1];
  43676. const xi = Math.min(Math.max(src[srcOffset + i], domain_2i), domain_2i_1);
  43677. let e = interpolate(xi, domain_2i, domain_2i_1, encode[i][0], encode[i][1]);
  43678. const size_i = size[i];
  43679. e = Math.min(Math.max(e, 0), size_i - 1);
  43680. const e0 = e < size_i - 1 ? Math.floor(e) : e - 1;
  43681. const n0 = e0 + 1 - e;
  43682. const n1 = e - e0;
  43683. const offset0 = e0 * k;
  43684. const offset1 = offset0 + k;
  43685. for (j = 0; j < cubeVertices; j++) {
  43686. if (j & pos) {
  43687. cubeN[j] *= n1;
  43688. cubeVertex[j] += offset1;
  43689. } else {
  43690. cubeN[j] *= n0;
  43691. cubeVertex[j] += offset0;
  43692. }
  43693. }
  43694. k *= size_i;
  43695. pos <<= 1;
  43696. }
  43697. for (j = 0; j < outputSize; ++j) {
  43698. let rj = 0;
  43699. for (i = 0; i < cubeVertices; i++) {
  43700. rj += samples[cubeVertex[i] + j] * cubeN[i];
  43701. }
  43702. rj = interpolate(rj, 0, 1, decode[j][0], decode[j][1]);
  43703. dest[destOffset + j] = Math.min(Math.max(rj, range[j][0]), range[j][1]);
  43704. }
  43705. };
  43706. }
  43707. static constructInterpolated({
  43708. xref,
  43709. isEvalSupported,
  43710. dict
  43711. }) {
  43712. const c0 = toNumberArray(dict.getArray("C0")) || [0];
  43713. const c1 = toNumberArray(dict.getArray("C1")) || [1];
  43714. const n = dict.get("N");
  43715. const diff = [];
  43716. for (let i = 0, ii = c0.length; i < ii; ++i) {
  43717. diff.push(c1[i] - c0[i]);
  43718. }
  43719. const length = diff.length;
  43720. return function constructInterpolatedFn(src, srcOffset, dest, destOffset) {
  43721. const x = n === 1 ? src[srcOffset] : src[srcOffset] ** n;
  43722. for (let j = 0; j < length; ++j) {
  43723. dest[destOffset + j] = c0[j] + x * diff[j];
  43724. }
  43725. };
  43726. }
  43727. static constructStiched({
  43728. xref,
  43729. isEvalSupported,
  43730. dict
  43731. }) {
  43732. const domain = toNumberArray(dict.getArray("Domain"));
  43733. if (!domain) {
  43734. throw new _util.FormatError("No domain");
  43735. }
  43736. const inputSize = domain.length / 2;
  43737. if (inputSize !== 1) {
  43738. throw new _util.FormatError("Bad domain for stiched function");
  43739. }
  43740. const fnRefs = dict.get("Functions");
  43741. const fns = [];
  43742. for (let i = 0, ii = fnRefs.length; i < ii; ++i) {
  43743. fns.push(this.parse({
  43744. xref,
  43745. isEvalSupported,
  43746. fn: xref.fetchIfRef(fnRefs[i])
  43747. }));
  43748. }
  43749. const bounds = toNumberArray(dict.getArray("Bounds"));
  43750. const encode = toNumberArray(dict.getArray("Encode"));
  43751. const tmpBuf = new Float32Array(1);
  43752. return function constructStichedFn(src, srcOffset, dest, destOffset) {
  43753. const clip = function constructStichedFromIRClip(v, min, max) {
  43754. if (v > max) {
  43755. v = max;
  43756. } else if (v < min) {
  43757. v = min;
  43758. }
  43759. return v;
  43760. };
  43761. const v = clip(src[srcOffset], domain[0], domain[1]);
  43762. const length = bounds.length;
  43763. let i;
  43764. for (i = 0; i < length; ++i) {
  43765. if (v < bounds[i]) {
  43766. break;
  43767. }
  43768. }
  43769. let dmin = domain[0];
  43770. if (i > 0) {
  43771. dmin = bounds[i - 1];
  43772. }
  43773. let dmax = domain[1];
  43774. if (i < bounds.length) {
  43775. dmax = bounds[i];
  43776. }
  43777. const rmin = encode[2 * i];
  43778. const rmax = encode[2 * i + 1];
  43779. tmpBuf[0] = dmin === dmax ? rmin : rmin + (v - dmin) * (rmax - rmin) / (dmax - dmin);
  43780. fns[i](tmpBuf, 0, dest, destOffset);
  43781. };
  43782. }
  43783. static constructPostScript({
  43784. xref,
  43785. isEvalSupported,
  43786. fn,
  43787. dict
  43788. }) {
  43789. const domain = toNumberArray(dict.getArray("Domain"));
  43790. const range = toNumberArray(dict.getArray("Range"));
  43791. if (!domain) {
  43792. throw new _util.FormatError("No domain.");
  43793. }
  43794. if (!range) {
  43795. throw new _util.FormatError("No range.");
  43796. }
  43797. const lexer = new _ps_parser.PostScriptLexer(fn);
  43798. const parser = new _ps_parser.PostScriptParser(lexer);
  43799. const code = parser.parse();
  43800. if (isEvalSupported && _util.FeatureTest.isEvalSupported) {
  43801. const compiled = new PostScriptCompiler().compile(code, domain, range);
  43802. if (compiled) {
  43803. return new Function("src", "srcOffset", "dest", "destOffset", compiled);
  43804. }
  43805. }
  43806. (0, _util.info)("Unable to compile PS function");
  43807. const numOutputs = range.length >> 1;
  43808. const numInputs = domain.length >> 1;
  43809. const evaluator = new PostScriptEvaluator(code);
  43810. const cache = Object.create(null);
  43811. const MAX_CACHE_SIZE = 2048 * 4;
  43812. let cache_available = MAX_CACHE_SIZE;
  43813. const tmpBuf = new Float32Array(numInputs);
  43814. return function constructPostScriptFn(src, srcOffset, dest, destOffset) {
  43815. let i, value;
  43816. let key = "";
  43817. const input = tmpBuf;
  43818. for (i = 0; i < numInputs; i++) {
  43819. value = src[srcOffset + i];
  43820. input[i] = value;
  43821. key += value + "_";
  43822. }
  43823. const cachedValue = cache[key];
  43824. if (cachedValue !== undefined) {
  43825. dest.set(cachedValue, destOffset);
  43826. return;
  43827. }
  43828. const output = new Float32Array(numOutputs);
  43829. const stack = evaluator.execute(input);
  43830. const stackIndex = stack.length - numOutputs;
  43831. for (i = 0; i < numOutputs; i++) {
  43832. value = stack[stackIndex + i];
  43833. let bound = range[i * 2];
  43834. if (value < bound) {
  43835. value = bound;
  43836. } else {
  43837. bound = range[i * 2 + 1];
  43838. if (value > bound) {
  43839. value = bound;
  43840. }
  43841. }
  43842. output[i] = value;
  43843. }
  43844. if (cache_available > 0) {
  43845. cache_available--;
  43846. cache[key] = output;
  43847. }
  43848. dest.set(output, destOffset);
  43849. };
  43850. }
  43851. }
  43852. function isPDFFunction(v) {
  43853. let fnDict;
  43854. if (typeof v !== "object") {
  43855. return false;
  43856. } else if (v instanceof _primitives.Dict) {
  43857. fnDict = v;
  43858. } else if (v instanceof _base_stream.BaseStream) {
  43859. fnDict = v.dict;
  43860. } else {
  43861. return false;
  43862. }
  43863. return fnDict.has("FunctionType");
  43864. }
  43865. class PostScriptStack {
  43866. static get MAX_STACK_SIZE() {
  43867. return (0, _util.shadow)(this, "MAX_STACK_SIZE", 100);
  43868. }
  43869. constructor(initialStack) {
  43870. this.stack = !initialStack ? [] : Array.prototype.slice.call(initialStack, 0);
  43871. }
  43872. push(value) {
  43873. if (this.stack.length >= PostScriptStack.MAX_STACK_SIZE) {
  43874. throw new Error("PostScript function stack overflow.");
  43875. }
  43876. this.stack.push(value);
  43877. }
  43878. pop() {
  43879. if (this.stack.length <= 0) {
  43880. throw new Error("PostScript function stack underflow.");
  43881. }
  43882. return this.stack.pop();
  43883. }
  43884. copy(n) {
  43885. if (this.stack.length + n >= PostScriptStack.MAX_STACK_SIZE) {
  43886. throw new Error("PostScript function stack overflow.");
  43887. }
  43888. const stack = this.stack;
  43889. for (let i = stack.length - n, j = n - 1; j >= 0; j--, i++) {
  43890. stack.push(stack[i]);
  43891. }
  43892. }
  43893. index(n) {
  43894. this.push(this.stack[this.stack.length - n - 1]);
  43895. }
  43896. roll(n, p) {
  43897. const stack = this.stack;
  43898. const l = stack.length - n;
  43899. const r = stack.length - 1;
  43900. const c = l + (p - Math.floor(p / n) * n);
  43901. for (let i = l, j = r; i < j; i++, j--) {
  43902. const t = stack[i];
  43903. stack[i] = stack[j];
  43904. stack[j] = t;
  43905. }
  43906. for (let i = l, j = c - 1; i < j; i++, j--) {
  43907. const t = stack[i];
  43908. stack[i] = stack[j];
  43909. stack[j] = t;
  43910. }
  43911. for (let i = c, j = r; i < j; i++, j--) {
  43912. const t = stack[i];
  43913. stack[i] = stack[j];
  43914. stack[j] = t;
  43915. }
  43916. }
  43917. }
  43918. class PostScriptEvaluator {
  43919. constructor(operators) {
  43920. this.operators = operators;
  43921. }
  43922. execute(initialStack) {
  43923. const stack = new PostScriptStack(initialStack);
  43924. let counter = 0;
  43925. const operators = this.operators;
  43926. const length = operators.length;
  43927. let operator, a, b;
  43928. while (counter < length) {
  43929. operator = operators[counter++];
  43930. if (typeof operator === "number") {
  43931. stack.push(operator);
  43932. continue;
  43933. }
  43934. switch (operator) {
  43935. case "jz":
  43936. b = stack.pop();
  43937. a = stack.pop();
  43938. if (!a) {
  43939. counter = b;
  43940. }
  43941. break;
  43942. case "j":
  43943. a = stack.pop();
  43944. counter = a;
  43945. break;
  43946. case "abs":
  43947. a = stack.pop();
  43948. stack.push(Math.abs(a));
  43949. break;
  43950. case "add":
  43951. b = stack.pop();
  43952. a = stack.pop();
  43953. stack.push(a + b);
  43954. break;
  43955. case "and":
  43956. b = stack.pop();
  43957. a = stack.pop();
  43958. if (typeof a === "boolean" && typeof b === "boolean") {
  43959. stack.push(a && b);
  43960. } else {
  43961. stack.push(a & b);
  43962. }
  43963. break;
  43964. case "atan":
  43965. a = stack.pop();
  43966. stack.push(Math.atan(a));
  43967. break;
  43968. case "bitshift":
  43969. b = stack.pop();
  43970. a = stack.pop();
  43971. if (a > 0) {
  43972. stack.push(a << b);
  43973. } else {
  43974. stack.push(a >> b);
  43975. }
  43976. break;
  43977. case "ceiling":
  43978. a = stack.pop();
  43979. stack.push(Math.ceil(a));
  43980. break;
  43981. case "copy":
  43982. a = stack.pop();
  43983. stack.copy(a);
  43984. break;
  43985. case "cos":
  43986. a = stack.pop();
  43987. stack.push(Math.cos(a));
  43988. break;
  43989. case "cvi":
  43990. a = stack.pop() | 0;
  43991. stack.push(a);
  43992. break;
  43993. case "cvr":
  43994. break;
  43995. case "div":
  43996. b = stack.pop();
  43997. a = stack.pop();
  43998. stack.push(a / b);
  43999. break;
  44000. case "dup":
  44001. stack.copy(1);
  44002. break;
  44003. case "eq":
  44004. b = stack.pop();
  44005. a = stack.pop();
  44006. stack.push(a === b);
  44007. break;
  44008. case "exch":
  44009. stack.roll(2, 1);
  44010. break;
  44011. case "exp":
  44012. b = stack.pop();
  44013. a = stack.pop();
  44014. stack.push(a ** b);
  44015. break;
  44016. case "false":
  44017. stack.push(false);
  44018. break;
  44019. case "floor":
  44020. a = stack.pop();
  44021. stack.push(Math.floor(a));
  44022. break;
  44023. case "ge":
  44024. b = stack.pop();
  44025. a = stack.pop();
  44026. stack.push(a >= b);
  44027. break;
  44028. case "gt":
  44029. b = stack.pop();
  44030. a = stack.pop();
  44031. stack.push(a > b);
  44032. break;
  44033. case "idiv":
  44034. b = stack.pop();
  44035. a = stack.pop();
  44036. stack.push(a / b | 0);
  44037. break;
  44038. case "index":
  44039. a = stack.pop();
  44040. stack.index(a);
  44041. break;
  44042. case "le":
  44043. b = stack.pop();
  44044. a = stack.pop();
  44045. stack.push(a <= b);
  44046. break;
  44047. case "ln":
  44048. a = stack.pop();
  44049. stack.push(Math.log(a));
  44050. break;
  44051. case "log":
  44052. a = stack.pop();
  44053. stack.push(Math.log(a) / Math.LN10);
  44054. break;
  44055. case "lt":
  44056. b = stack.pop();
  44057. a = stack.pop();
  44058. stack.push(a < b);
  44059. break;
  44060. case "mod":
  44061. b = stack.pop();
  44062. a = stack.pop();
  44063. stack.push(a % b);
  44064. break;
  44065. case "mul":
  44066. b = stack.pop();
  44067. a = stack.pop();
  44068. stack.push(a * b);
  44069. break;
  44070. case "ne":
  44071. b = stack.pop();
  44072. a = stack.pop();
  44073. stack.push(a !== b);
  44074. break;
  44075. case "neg":
  44076. a = stack.pop();
  44077. stack.push(-a);
  44078. break;
  44079. case "not":
  44080. a = stack.pop();
  44081. if (typeof a === "boolean") {
  44082. stack.push(!a);
  44083. } else {
  44084. stack.push(~a);
  44085. }
  44086. break;
  44087. case "or":
  44088. b = stack.pop();
  44089. a = stack.pop();
  44090. if (typeof a === "boolean" && typeof b === "boolean") {
  44091. stack.push(a || b);
  44092. } else {
  44093. stack.push(a | b);
  44094. }
  44095. break;
  44096. case "pop":
  44097. stack.pop();
  44098. break;
  44099. case "roll":
  44100. b = stack.pop();
  44101. a = stack.pop();
  44102. stack.roll(a, b);
  44103. break;
  44104. case "round":
  44105. a = stack.pop();
  44106. stack.push(Math.round(a));
  44107. break;
  44108. case "sin":
  44109. a = stack.pop();
  44110. stack.push(Math.sin(a));
  44111. break;
  44112. case "sqrt":
  44113. a = stack.pop();
  44114. stack.push(Math.sqrt(a));
  44115. break;
  44116. case "sub":
  44117. b = stack.pop();
  44118. a = stack.pop();
  44119. stack.push(a - b);
  44120. break;
  44121. case "true":
  44122. stack.push(true);
  44123. break;
  44124. case "truncate":
  44125. a = stack.pop();
  44126. a = a < 0 ? Math.ceil(a) : Math.floor(a);
  44127. stack.push(a);
  44128. break;
  44129. case "xor":
  44130. b = stack.pop();
  44131. a = stack.pop();
  44132. if (typeof a === "boolean" && typeof b === "boolean") {
  44133. stack.push(a !== b);
  44134. } else {
  44135. stack.push(a ^ b);
  44136. }
  44137. break;
  44138. default:
  44139. throw new _util.FormatError(`Unknown operator ${operator}`);
  44140. }
  44141. }
  44142. return stack.stack;
  44143. }
  44144. }
  44145. exports.PostScriptEvaluator = PostScriptEvaluator;
  44146. const PostScriptCompiler = function PostScriptCompilerClosure() {
  44147. class AstNode {
  44148. constructor(type) {
  44149. this.type = type;
  44150. }
  44151. visit(visitor) {
  44152. (0, _util.unreachable)("abstract method");
  44153. }
  44154. }
  44155. class AstArgument extends AstNode {
  44156. constructor(index, min, max) {
  44157. super("args");
  44158. this.index = index;
  44159. this.min = min;
  44160. this.max = max;
  44161. }
  44162. visit(visitor) {
  44163. visitor.visitArgument(this);
  44164. }
  44165. }
  44166. class AstLiteral extends AstNode {
  44167. constructor(number) {
  44168. super("literal");
  44169. this.number = number;
  44170. this.min = number;
  44171. this.max = number;
  44172. }
  44173. visit(visitor) {
  44174. visitor.visitLiteral(this);
  44175. }
  44176. }
  44177. class AstBinaryOperation extends AstNode {
  44178. constructor(op, arg1, arg2, min, max) {
  44179. super("binary");
  44180. this.op = op;
  44181. this.arg1 = arg1;
  44182. this.arg2 = arg2;
  44183. this.min = min;
  44184. this.max = max;
  44185. }
  44186. visit(visitor) {
  44187. visitor.visitBinaryOperation(this);
  44188. }
  44189. }
  44190. class AstMin extends AstNode {
  44191. constructor(arg, max) {
  44192. super("max");
  44193. this.arg = arg;
  44194. this.min = arg.min;
  44195. this.max = max;
  44196. }
  44197. visit(visitor) {
  44198. visitor.visitMin(this);
  44199. }
  44200. }
  44201. class AstVariable extends AstNode {
  44202. constructor(index, min, max) {
  44203. super("var");
  44204. this.index = index;
  44205. this.min = min;
  44206. this.max = max;
  44207. }
  44208. visit(visitor) {
  44209. visitor.visitVariable(this);
  44210. }
  44211. }
  44212. class AstVariableDefinition extends AstNode {
  44213. constructor(variable, arg) {
  44214. super("definition");
  44215. this.variable = variable;
  44216. this.arg = arg;
  44217. }
  44218. visit(visitor) {
  44219. visitor.visitVariableDefinition(this);
  44220. }
  44221. }
  44222. class ExpressionBuilderVisitor {
  44223. constructor() {
  44224. this.parts = [];
  44225. }
  44226. visitArgument(arg) {
  44227. this.parts.push("Math.max(", arg.min, ", Math.min(", arg.max, ", src[srcOffset + ", arg.index, "]))");
  44228. }
  44229. visitVariable(variable) {
  44230. this.parts.push("v", variable.index);
  44231. }
  44232. visitLiteral(literal) {
  44233. this.parts.push(literal.number);
  44234. }
  44235. visitBinaryOperation(operation) {
  44236. this.parts.push("(");
  44237. operation.arg1.visit(this);
  44238. this.parts.push(" ", operation.op, " ");
  44239. operation.arg2.visit(this);
  44240. this.parts.push(")");
  44241. }
  44242. visitVariableDefinition(definition) {
  44243. this.parts.push("var ");
  44244. definition.variable.visit(this);
  44245. this.parts.push(" = ");
  44246. definition.arg.visit(this);
  44247. this.parts.push(";");
  44248. }
  44249. visitMin(max) {
  44250. this.parts.push("Math.min(");
  44251. max.arg.visit(this);
  44252. this.parts.push(", ", max.max, ")");
  44253. }
  44254. toString() {
  44255. return this.parts.join("");
  44256. }
  44257. }
  44258. function buildAddOperation(num1, num2) {
  44259. if (num2.type === "literal" && num2.number === 0) {
  44260. return num1;
  44261. }
  44262. if (num1.type === "literal" && num1.number === 0) {
  44263. return num2;
  44264. }
  44265. if (num2.type === "literal" && num1.type === "literal") {
  44266. return new AstLiteral(num1.number + num2.number);
  44267. }
  44268. return new AstBinaryOperation("+", num1, num2, num1.min + num2.min, num1.max + num2.max);
  44269. }
  44270. function buildMulOperation(num1, num2) {
  44271. if (num2.type === "literal") {
  44272. if (num2.number === 0) {
  44273. return new AstLiteral(0);
  44274. } else if (num2.number === 1) {
  44275. return num1;
  44276. } else if (num1.type === "literal") {
  44277. return new AstLiteral(num1.number * num2.number);
  44278. }
  44279. }
  44280. if (num1.type === "literal") {
  44281. if (num1.number === 0) {
  44282. return new AstLiteral(0);
  44283. } else if (num1.number === 1) {
  44284. return num2;
  44285. }
  44286. }
  44287. const min = Math.min(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  44288. const max = Math.max(num1.min * num2.min, num1.min * num2.max, num1.max * num2.min, num1.max * num2.max);
  44289. return new AstBinaryOperation("*", num1, num2, min, max);
  44290. }
  44291. function buildSubOperation(num1, num2) {
  44292. if (num2.type === "literal") {
  44293. if (num2.number === 0) {
  44294. return num1;
  44295. } else if (num1.type === "literal") {
  44296. return new AstLiteral(num1.number - num2.number);
  44297. }
  44298. }
  44299. if (num2.type === "binary" && num2.op === "-" && num1.type === "literal" && num1.number === 1 && num2.arg1.type === "literal" && num2.arg1.number === 1) {
  44300. return num2.arg2;
  44301. }
  44302. return new AstBinaryOperation("-", num1, num2, num1.min - num2.max, num1.max - num2.min);
  44303. }
  44304. function buildMinOperation(num1, max) {
  44305. if (num1.min >= max) {
  44306. return new AstLiteral(max);
  44307. } else if (num1.max <= max) {
  44308. return num1;
  44309. }
  44310. return new AstMin(num1, max);
  44311. }
  44312. class PostScriptCompiler {
  44313. compile(code, domain, range) {
  44314. const stack = [];
  44315. const instructions = [];
  44316. const inputSize = domain.length >> 1,
  44317. outputSize = range.length >> 1;
  44318. let lastRegister = 0;
  44319. let n, j;
  44320. let num1, num2, ast1, ast2, tmpVar, item;
  44321. for (let i = 0; i < inputSize; i++) {
  44322. stack.push(new AstArgument(i, domain[i * 2], domain[i * 2 + 1]));
  44323. }
  44324. for (let i = 0, ii = code.length; i < ii; i++) {
  44325. item = code[i];
  44326. if (typeof item === "number") {
  44327. stack.push(new AstLiteral(item));
  44328. continue;
  44329. }
  44330. switch (item) {
  44331. case "add":
  44332. if (stack.length < 2) {
  44333. return null;
  44334. }
  44335. num2 = stack.pop();
  44336. num1 = stack.pop();
  44337. stack.push(buildAddOperation(num1, num2));
  44338. break;
  44339. case "cvr":
  44340. if (stack.length < 1) {
  44341. return null;
  44342. }
  44343. break;
  44344. case "mul":
  44345. if (stack.length < 2) {
  44346. return null;
  44347. }
  44348. num2 = stack.pop();
  44349. num1 = stack.pop();
  44350. stack.push(buildMulOperation(num1, num2));
  44351. break;
  44352. case "sub":
  44353. if (stack.length < 2) {
  44354. return null;
  44355. }
  44356. num2 = stack.pop();
  44357. num1 = stack.pop();
  44358. stack.push(buildSubOperation(num1, num2));
  44359. break;
  44360. case "exch":
  44361. if (stack.length < 2) {
  44362. return null;
  44363. }
  44364. ast1 = stack.pop();
  44365. ast2 = stack.pop();
  44366. stack.push(ast1, ast2);
  44367. break;
  44368. case "pop":
  44369. if (stack.length < 1) {
  44370. return null;
  44371. }
  44372. stack.pop();
  44373. break;
  44374. case "index":
  44375. if (stack.length < 1) {
  44376. return null;
  44377. }
  44378. num1 = stack.pop();
  44379. if (num1.type !== "literal") {
  44380. return null;
  44381. }
  44382. n = num1.number;
  44383. if (n < 0 || !Number.isInteger(n) || stack.length < n) {
  44384. return null;
  44385. }
  44386. ast1 = stack[stack.length - n - 1];
  44387. if (ast1.type === "literal" || ast1.type === "var") {
  44388. stack.push(ast1);
  44389. break;
  44390. }
  44391. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  44392. stack[stack.length - n - 1] = tmpVar;
  44393. stack.push(tmpVar);
  44394. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  44395. break;
  44396. case "dup":
  44397. if (stack.length < 1) {
  44398. return null;
  44399. }
  44400. 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]) {
  44401. num1 = stack.pop();
  44402. stack.push(buildMinOperation(num1, code[i + 1]));
  44403. i += 6;
  44404. break;
  44405. }
  44406. ast1 = stack[stack.length - 1];
  44407. if (ast1.type === "literal" || ast1.type === "var") {
  44408. stack.push(ast1);
  44409. break;
  44410. }
  44411. tmpVar = new AstVariable(lastRegister++, ast1.min, ast1.max);
  44412. stack[stack.length - 1] = tmpVar;
  44413. stack.push(tmpVar);
  44414. instructions.push(new AstVariableDefinition(tmpVar, ast1));
  44415. break;
  44416. case "roll":
  44417. if (stack.length < 2) {
  44418. return null;
  44419. }
  44420. num2 = stack.pop();
  44421. num1 = stack.pop();
  44422. if (num2.type !== "literal" || num1.type !== "literal") {
  44423. return null;
  44424. }
  44425. j = num2.number;
  44426. n = num1.number;
  44427. if (n <= 0 || !Number.isInteger(n) || !Number.isInteger(j) || stack.length < n) {
  44428. return null;
  44429. }
  44430. j = (j % n + n) % n;
  44431. if (j === 0) {
  44432. break;
  44433. }
  44434. Array.prototype.push.apply(stack, stack.splice(stack.length - n, n - j));
  44435. break;
  44436. default:
  44437. return null;
  44438. }
  44439. }
  44440. if (stack.length !== outputSize) {
  44441. return null;
  44442. }
  44443. const result = [];
  44444. for (const instruction of instructions) {
  44445. const statementBuilder = new ExpressionBuilderVisitor();
  44446. instruction.visit(statementBuilder);
  44447. result.push(statementBuilder.toString());
  44448. }
  44449. for (let i = 0, ii = stack.length; i < ii; i++) {
  44450. const expr = stack[i],
  44451. statementBuilder = new ExpressionBuilderVisitor();
  44452. expr.visit(statementBuilder);
  44453. const min = range[i * 2],
  44454. max = range[i * 2 + 1];
  44455. const out = [statementBuilder.toString()];
  44456. if (min > expr.min) {
  44457. out.unshift("Math.max(", min, ", ");
  44458. out.push(")");
  44459. }
  44460. if (max < expr.max) {
  44461. out.unshift("Math.min(", max, ", ");
  44462. out.push(")");
  44463. }
  44464. out.unshift("dest[destOffset + ", i, "] = ");
  44465. out.push(";");
  44466. result.push(out.join(""));
  44467. }
  44468. return result.join("\n");
  44469. }
  44470. }
  44471. return PostScriptCompiler;
  44472. }();
  44473. exports.PostScriptCompiler = PostScriptCompiler;
  44474. /***/ }),
  44475. /* 58 */
  44476. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44477. Object.defineProperty(exports, "__esModule", ({
  44478. value: true
  44479. }));
  44480. exports.PostScriptParser = exports.PostScriptLexer = void 0;
  44481. var _util = __w_pdfjs_require__(2);
  44482. var _primitives = __w_pdfjs_require__(5);
  44483. var _core_utils = __w_pdfjs_require__(8);
  44484. class PostScriptParser {
  44485. constructor(lexer) {
  44486. this.lexer = lexer;
  44487. this.operators = [];
  44488. this.token = null;
  44489. this.prev = null;
  44490. }
  44491. nextToken() {
  44492. this.prev = this.token;
  44493. this.token = this.lexer.getToken();
  44494. }
  44495. accept(type) {
  44496. if (this.token.type === type) {
  44497. this.nextToken();
  44498. return true;
  44499. }
  44500. return false;
  44501. }
  44502. expect(type) {
  44503. if (this.accept(type)) {
  44504. return true;
  44505. }
  44506. throw new _util.FormatError(`Unexpected symbol: found ${this.token.type} expected ${type}.`);
  44507. }
  44508. parse() {
  44509. this.nextToken();
  44510. this.expect(PostScriptTokenTypes.LBRACE);
  44511. this.parseBlock();
  44512. this.expect(PostScriptTokenTypes.RBRACE);
  44513. return this.operators;
  44514. }
  44515. parseBlock() {
  44516. while (true) {
  44517. if (this.accept(PostScriptTokenTypes.NUMBER)) {
  44518. this.operators.push(this.prev.value);
  44519. } else if (this.accept(PostScriptTokenTypes.OPERATOR)) {
  44520. this.operators.push(this.prev.value);
  44521. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  44522. this.parseCondition();
  44523. } else {
  44524. return;
  44525. }
  44526. }
  44527. }
  44528. parseCondition() {
  44529. const conditionLocation = this.operators.length;
  44530. this.operators.push(null, null);
  44531. this.parseBlock();
  44532. this.expect(PostScriptTokenTypes.RBRACE);
  44533. if (this.accept(PostScriptTokenTypes.IF)) {
  44534. this.operators[conditionLocation] = this.operators.length;
  44535. this.operators[conditionLocation + 1] = "jz";
  44536. } else if (this.accept(PostScriptTokenTypes.LBRACE)) {
  44537. const jumpLocation = this.operators.length;
  44538. this.operators.push(null, null);
  44539. const endOfTrue = this.operators.length;
  44540. this.parseBlock();
  44541. this.expect(PostScriptTokenTypes.RBRACE);
  44542. this.expect(PostScriptTokenTypes.IFELSE);
  44543. this.operators[jumpLocation] = this.operators.length;
  44544. this.operators[jumpLocation + 1] = "j";
  44545. this.operators[conditionLocation] = endOfTrue;
  44546. this.operators[conditionLocation + 1] = "jz";
  44547. } else {
  44548. throw new _util.FormatError("PS Function: error parsing conditional.");
  44549. }
  44550. }
  44551. }
  44552. exports.PostScriptParser = PostScriptParser;
  44553. const PostScriptTokenTypes = {
  44554. LBRACE: 0,
  44555. RBRACE: 1,
  44556. NUMBER: 2,
  44557. OPERATOR: 3,
  44558. IF: 4,
  44559. IFELSE: 5
  44560. };
  44561. class PostScriptToken {
  44562. static get opCache() {
  44563. return (0, _util.shadow)(this, "opCache", Object.create(null));
  44564. }
  44565. constructor(type, value) {
  44566. this.type = type;
  44567. this.value = value;
  44568. }
  44569. static getOperator(op) {
  44570. const opValue = PostScriptToken.opCache[op];
  44571. if (opValue) {
  44572. return opValue;
  44573. }
  44574. return PostScriptToken.opCache[op] = new PostScriptToken(PostScriptTokenTypes.OPERATOR, op);
  44575. }
  44576. static get LBRACE() {
  44577. return (0, _util.shadow)(this, "LBRACE", new PostScriptToken(PostScriptTokenTypes.LBRACE, "{"));
  44578. }
  44579. static get RBRACE() {
  44580. return (0, _util.shadow)(this, "RBRACE", new PostScriptToken(PostScriptTokenTypes.RBRACE, "}"));
  44581. }
  44582. static get IF() {
  44583. return (0, _util.shadow)(this, "IF", new PostScriptToken(PostScriptTokenTypes.IF, "IF"));
  44584. }
  44585. static get IFELSE() {
  44586. return (0, _util.shadow)(this, "IFELSE", new PostScriptToken(PostScriptTokenTypes.IFELSE, "IFELSE"));
  44587. }
  44588. }
  44589. class PostScriptLexer {
  44590. constructor(stream) {
  44591. this.stream = stream;
  44592. this.nextChar();
  44593. this.strBuf = [];
  44594. }
  44595. nextChar() {
  44596. return this.currentChar = this.stream.getByte();
  44597. }
  44598. getToken() {
  44599. let comment = false;
  44600. let ch = this.currentChar;
  44601. while (true) {
  44602. if (ch < 0) {
  44603. return _primitives.EOF;
  44604. }
  44605. if (comment) {
  44606. if (ch === 0x0a || ch === 0x0d) {
  44607. comment = false;
  44608. }
  44609. } else if (ch === 0x25) {
  44610. comment = true;
  44611. } else if (!(0, _core_utils.isWhiteSpace)(ch)) {
  44612. break;
  44613. }
  44614. ch = this.nextChar();
  44615. }
  44616. switch (ch | 0) {
  44617. case 0x30:
  44618. case 0x31:
  44619. case 0x32:
  44620. case 0x33:
  44621. case 0x34:
  44622. case 0x35:
  44623. case 0x36:
  44624. case 0x37:
  44625. case 0x38:
  44626. case 0x39:
  44627. case 0x2b:
  44628. case 0x2d:
  44629. case 0x2e:
  44630. return new PostScriptToken(PostScriptTokenTypes.NUMBER, this.getNumber());
  44631. case 0x7b:
  44632. this.nextChar();
  44633. return PostScriptToken.LBRACE;
  44634. case 0x7d:
  44635. this.nextChar();
  44636. return PostScriptToken.RBRACE;
  44637. }
  44638. const strBuf = this.strBuf;
  44639. strBuf.length = 0;
  44640. strBuf[0] = String.fromCharCode(ch);
  44641. while ((ch = this.nextChar()) >= 0 && (ch >= 0x41 && ch <= 0x5a || ch >= 0x61 && ch <= 0x7a)) {
  44642. strBuf.push(String.fromCharCode(ch));
  44643. }
  44644. const str = strBuf.join("");
  44645. switch (str.toLowerCase()) {
  44646. case "if":
  44647. return PostScriptToken.IF;
  44648. case "ifelse":
  44649. return PostScriptToken.IFELSE;
  44650. default:
  44651. return PostScriptToken.getOperator(str);
  44652. }
  44653. }
  44654. getNumber() {
  44655. let ch = this.currentChar;
  44656. const strBuf = this.strBuf;
  44657. strBuf.length = 0;
  44658. strBuf[0] = String.fromCharCode(ch);
  44659. while ((ch = this.nextChar()) >= 0) {
  44660. if (ch >= 0x30 && ch <= 0x39 || ch === 0x2d || ch === 0x2e) {
  44661. strBuf.push(String.fromCharCode(ch));
  44662. } else {
  44663. break;
  44664. }
  44665. }
  44666. const value = parseFloat(strBuf.join(""));
  44667. if (isNaN(value)) {
  44668. throw new _util.FormatError(`Invalid floating point number: ${value}`);
  44669. }
  44670. return value;
  44671. }
  44672. }
  44673. exports.PostScriptLexer = PostScriptLexer;
  44674. /***/ }),
  44675. /* 59 */
  44676. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44677. Object.defineProperty(exports, "__esModule", ({
  44678. value: true
  44679. }));
  44680. exports.LocalTilingPatternCache = exports.LocalImageCache = exports.LocalGStateCache = exports.LocalFunctionCache = exports.LocalColorSpaceCache = exports.GlobalImageCache = void 0;
  44681. var _util = __w_pdfjs_require__(2);
  44682. var _primitives = __w_pdfjs_require__(5);
  44683. class BaseLocalCache {
  44684. constructor(options) {
  44685. if (this.constructor === BaseLocalCache) {
  44686. (0, _util.unreachable)("Cannot initialize BaseLocalCache.");
  44687. }
  44688. this._onlyRefs = (options && options.onlyRefs) === true;
  44689. if (!this._onlyRefs) {
  44690. this._nameRefMap = new Map();
  44691. this._imageMap = new Map();
  44692. }
  44693. this._imageCache = new _primitives.RefSetCache();
  44694. }
  44695. getByName(name) {
  44696. if (this._onlyRefs) {
  44697. (0, _util.unreachable)("Should not call `getByName` method.");
  44698. }
  44699. const ref = this._nameRefMap.get(name);
  44700. if (ref) {
  44701. return this.getByRef(ref);
  44702. }
  44703. return this._imageMap.get(name) || null;
  44704. }
  44705. getByRef(ref) {
  44706. return this._imageCache.get(ref) || null;
  44707. }
  44708. set(name, ref, data) {
  44709. (0, _util.unreachable)("Abstract method `set` called.");
  44710. }
  44711. }
  44712. class LocalImageCache extends BaseLocalCache {
  44713. set(name, ref = null, data) {
  44714. if (typeof name !== "string") {
  44715. throw new Error('LocalImageCache.set - expected "name" argument.');
  44716. }
  44717. if (ref) {
  44718. if (this._imageCache.has(ref)) {
  44719. return;
  44720. }
  44721. this._nameRefMap.set(name, ref);
  44722. this._imageCache.put(ref, data);
  44723. return;
  44724. }
  44725. if (this._imageMap.has(name)) {
  44726. return;
  44727. }
  44728. this._imageMap.set(name, data);
  44729. }
  44730. }
  44731. exports.LocalImageCache = LocalImageCache;
  44732. class LocalColorSpaceCache extends BaseLocalCache {
  44733. set(name = null, ref = null, data) {
  44734. if (typeof name !== "string" && !ref) {
  44735. throw new Error('LocalColorSpaceCache.set - expected "name" and/or "ref" argument.');
  44736. }
  44737. if (ref) {
  44738. if (this._imageCache.has(ref)) {
  44739. return;
  44740. }
  44741. if (name !== null) {
  44742. this._nameRefMap.set(name, ref);
  44743. }
  44744. this._imageCache.put(ref, data);
  44745. return;
  44746. }
  44747. if (this._imageMap.has(name)) {
  44748. return;
  44749. }
  44750. this._imageMap.set(name, data);
  44751. }
  44752. }
  44753. exports.LocalColorSpaceCache = LocalColorSpaceCache;
  44754. class LocalFunctionCache extends BaseLocalCache {
  44755. constructor(options) {
  44756. super({
  44757. onlyRefs: true
  44758. });
  44759. }
  44760. set(name = null, ref, data) {
  44761. if (!ref) {
  44762. throw new Error('LocalFunctionCache.set - expected "ref" argument.');
  44763. }
  44764. if (this._imageCache.has(ref)) {
  44765. return;
  44766. }
  44767. this._imageCache.put(ref, data);
  44768. }
  44769. }
  44770. exports.LocalFunctionCache = LocalFunctionCache;
  44771. class LocalGStateCache extends BaseLocalCache {
  44772. set(name, ref = null, data) {
  44773. if (typeof name !== "string") {
  44774. throw new Error('LocalGStateCache.set - expected "name" argument.');
  44775. }
  44776. if (ref) {
  44777. if (this._imageCache.has(ref)) {
  44778. return;
  44779. }
  44780. this._nameRefMap.set(name, ref);
  44781. this._imageCache.put(ref, data);
  44782. return;
  44783. }
  44784. if (this._imageMap.has(name)) {
  44785. return;
  44786. }
  44787. this._imageMap.set(name, data);
  44788. }
  44789. }
  44790. exports.LocalGStateCache = LocalGStateCache;
  44791. class LocalTilingPatternCache extends BaseLocalCache {
  44792. constructor(options) {
  44793. super({
  44794. onlyRefs: true
  44795. });
  44796. }
  44797. set(name = null, ref, data) {
  44798. if (!ref) {
  44799. throw new Error('LocalTilingPatternCache.set - expected "ref" argument.');
  44800. }
  44801. if (this._imageCache.has(ref)) {
  44802. return;
  44803. }
  44804. this._imageCache.put(ref, data);
  44805. }
  44806. }
  44807. exports.LocalTilingPatternCache = LocalTilingPatternCache;
  44808. class GlobalImageCache {
  44809. static get NUM_PAGES_THRESHOLD() {
  44810. return (0, _util.shadow)(this, "NUM_PAGES_THRESHOLD", 2);
  44811. }
  44812. static get MIN_IMAGES_TO_CACHE() {
  44813. return (0, _util.shadow)(this, "MIN_IMAGES_TO_CACHE", 10);
  44814. }
  44815. static get MAX_BYTE_SIZE() {
  44816. return (0, _util.shadow)(this, "MAX_BYTE_SIZE", 40e6);
  44817. }
  44818. constructor() {
  44819. this._refCache = new _primitives.RefSetCache();
  44820. this._imageCache = new _primitives.RefSetCache();
  44821. }
  44822. get _byteSize() {
  44823. let byteSize = 0;
  44824. for (const imageData of this._imageCache) {
  44825. byteSize += imageData.byteSize;
  44826. }
  44827. return byteSize;
  44828. }
  44829. get _cacheLimitReached() {
  44830. if (this._imageCache.size < GlobalImageCache.MIN_IMAGES_TO_CACHE) {
  44831. return false;
  44832. }
  44833. if (this._byteSize < GlobalImageCache.MAX_BYTE_SIZE) {
  44834. return false;
  44835. }
  44836. return true;
  44837. }
  44838. shouldCache(ref, pageIndex) {
  44839. const pageIndexSet = this._refCache.get(ref);
  44840. const numPages = pageIndexSet ? pageIndexSet.size + (pageIndexSet.has(pageIndex) ? 0 : 1) : 1;
  44841. if (numPages < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  44842. return false;
  44843. }
  44844. if (!this._imageCache.has(ref) && this._cacheLimitReached) {
  44845. return false;
  44846. }
  44847. return true;
  44848. }
  44849. addPageIndex(ref, pageIndex) {
  44850. let pageIndexSet = this._refCache.get(ref);
  44851. if (!pageIndexSet) {
  44852. pageIndexSet = new Set();
  44853. this._refCache.put(ref, pageIndexSet);
  44854. }
  44855. pageIndexSet.add(pageIndex);
  44856. }
  44857. addByteSize(ref, byteSize) {
  44858. const imageData = this._imageCache.get(ref);
  44859. if (!imageData) {
  44860. return;
  44861. }
  44862. if (imageData.byteSize) {
  44863. return;
  44864. }
  44865. imageData.byteSize = byteSize;
  44866. }
  44867. getData(ref, pageIndex) {
  44868. const pageIndexSet = this._refCache.get(ref);
  44869. if (!pageIndexSet) {
  44870. return null;
  44871. }
  44872. if (pageIndexSet.size < GlobalImageCache.NUM_PAGES_THRESHOLD) {
  44873. return null;
  44874. }
  44875. const imageData = this._imageCache.get(ref);
  44876. if (!imageData) {
  44877. return null;
  44878. }
  44879. pageIndexSet.add(pageIndex);
  44880. return imageData;
  44881. }
  44882. setData(ref, data) {
  44883. if (!this._refCache.has(ref)) {
  44884. throw new Error('GlobalImageCache.setData - expected "addPageIndex" to have been called.');
  44885. }
  44886. if (this._imageCache.has(ref)) {
  44887. return;
  44888. }
  44889. if (this._cacheLimitReached) {
  44890. (0, _util.warn)("GlobalImageCache.setData - cache limit reached.");
  44891. return;
  44892. }
  44893. this._imageCache.put(ref, data);
  44894. }
  44895. clear(onlyData = false) {
  44896. if (!onlyData) {
  44897. this._refCache.clear();
  44898. }
  44899. this._imageCache.clear();
  44900. }
  44901. }
  44902. exports.GlobalImageCache = GlobalImageCache;
  44903. /***/ }),
  44904. /* 60 */
  44905. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  44906. Object.defineProperty(exports, "__esModule", ({
  44907. value: true
  44908. }));
  44909. exports.bidi = bidi;
  44910. var _util = __w_pdfjs_require__(2);
  44911. 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"];
  44912. 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"];
  44913. function isOdd(i) {
  44914. return (i & 1) !== 0;
  44915. }
  44916. function isEven(i) {
  44917. return (i & 1) === 0;
  44918. }
  44919. function findUnequal(arr, start, value) {
  44920. let j, jj;
  44921. for (j = start, jj = arr.length; j < jj; ++j) {
  44922. if (arr[j] !== value) {
  44923. return j;
  44924. }
  44925. }
  44926. return j;
  44927. }
  44928. function setValues(arr, start, end, value) {
  44929. for (let j = start; j < end; ++j) {
  44930. arr[j] = value;
  44931. }
  44932. }
  44933. function reverseValues(arr, start, end) {
  44934. for (let i = start, j = end - 1; i < j; ++i, --j) {
  44935. const temp = arr[i];
  44936. arr[i] = arr[j];
  44937. arr[j] = temp;
  44938. }
  44939. }
  44940. function createBidiText(str, isLTR, vertical = false) {
  44941. let dir = "ltr";
  44942. if (vertical) {
  44943. dir = "ttb";
  44944. } else if (!isLTR) {
  44945. dir = "rtl";
  44946. }
  44947. return {
  44948. str,
  44949. dir
  44950. };
  44951. }
  44952. const chars = [];
  44953. const types = [];
  44954. function bidi(str, startLevel = -1, vertical = false) {
  44955. let isLTR = true;
  44956. const strLength = str.length;
  44957. if (strLength === 0 || vertical) {
  44958. return createBidiText(str, isLTR, vertical);
  44959. }
  44960. chars.length = strLength;
  44961. types.length = strLength;
  44962. let numBidi = 0;
  44963. let i, ii;
  44964. for (i = 0; i < strLength; ++i) {
  44965. chars[i] = str.charAt(i);
  44966. const charCode = str.charCodeAt(i);
  44967. let charType = "L";
  44968. if (charCode <= 0x00ff) {
  44969. charType = baseTypes[charCode];
  44970. } else if (0x0590 <= charCode && charCode <= 0x05f4) {
  44971. charType = "R";
  44972. } else if (0x0600 <= charCode && charCode <= 0x06ff) {
  44973. charType = arabicTypes[charCode & 0xff];
  44974. if (!charType) {
  44975. (0, _util.warn)("Bidi: invalid Unicode character " + charCode.toString(16));
  44976. }
  44977. } else if (0x0700 <= charCode && charCode <= 0x08ac) {
  44978. charType = "AL";
  44979. }
  44980. if (charType === "R" || charType === "AL" || charType === "AN") {
  44981. numBidi++;
  44982. }
  44983. types[i] = charType;
  44984. }
  44985. if (numBidi === 0) {
  44986. isLTR = true;
  44987. return createBidiText(str, isLTR);
  44988. }
  44989. if (startLevel === -1) {
  44990. if (numBidi / strLength < 0.3 && strLength > 4) {
  44991. isLTR = true;
  44992. startLevel = 0;
  44993. } else {
  44994. isLTR = false;
  44995. startLevel = 1;
  44996. }
  44997. }
  44998. const levels = [];
  44999. for (i = 0; i < strLength; ++i) {
  45000. levels[i] = startLevel;
  45001. }
  45002. const e = isOdd(startLevel) ? "R" : "L";
  45003. const sor = e;
  45004. const eor = sor;
  45005. let lastType = sor;
  45006. for (i = 0; i < strLength; ++i) {
  45007. if (types[i] === "NSM") {
  45008. types[i] = lastType;
  45009. } else {
  45010. lastType = types[i];
  45011. }
  45012. }
  45013. lastType = sor;
  45014. let t;
  45015. for (i = 0; i < strLength; ++i) {
  45016. t = types[i];
  45017. if (t === "EN") {
  45018. types[i] = lastType === "AL" ? "AN" : "EN";
  45019. } else if (t === "R" || t === "L" || t === "AL") {
  45020. lastType = t;
  45021. }
  45022. }
  45023. for (i = 0; i < strLength; ++i) {
  45024. t = types[i];
  45025. if (t === "AL") {
  45026. types[i] = "R";
  45027. }
  45028. }
  45029. for (i = 1; i < strLength - 1; ++i) {
  45030. if (types[i] === "ES" && types[i - 1] === "EN" && types[i + 1] === "EN") {
  45031. types[i] = "EN";
  45032. }
  45033. if (types[i] === "CS" && (types[i - 1] === "EN" || types[i - 1] === "AN") && types[i + 1] === types[i - 1]) {
  45034. types[i] = types[i - 1];
  45035. }
  45036. }
  45037. for (i = 0; i < strLength; ++i) {
  45038. if (types[i] === "EN") {
  45039. for (let j = i - 1; j >= 0; --j) {
  45040. if (types[j] !== "ET") {
  45041. break;
  45042. }
  45043. types[j] = "EN";
  45044. }
  45045. for (let j = i + 1; j < strLength; ++j) {
  45046. if (types[j] !== "ET") {
  45047. break;
  45048. }
  45049. types[j] = "EN";
  45050. }
  45051. }
  45052. }
  45053. for (i = 0; i < strLength; ++i) {
  45054. t = types[i];
  45055. if (t === "WS" || t === "ES" || t === "ET" || t === "CS") {
  45056. types[i] = "ON";
  45057. }
  45058. }
  45059. lastType = sor;
  45060. for (i = 0; i < strLength; ++i) {
  45061. t = types[i];
  45062. if (t === "EN") {
  45063. types[i] = lastType === "L" ? "L" : "EN";
  45064. } else if (t === "R" || t === "L") {
  45065. lastType = t;
  45066. }
  45067. }
  45068. for (i = 0; i < strLength; ++i) {
  45069. if (types[i] === "ON") {
  45070. const end = findUnequal(types, i + 1, "ON");
  45071. let before = sor;
  45072. if (i > 0) {
  45073. before = types[i - 1];
  45074. }
  45075. let after = eor;
  45076. if (end + 1 < strLength) {
  45077. after = types[end + 1];
  45078. }
  45079. if (before !== "L") {
  45080. before = "R";
  45081. }
  45082. if (after !== "L") {
  45083. after = "R";
  45084. }
  45085. if (before === after) {
  45086. setValues(types, i, end, before);
  45087. }
  45088. i = end - 1;
  45089. }
  45090. }
  45091. for (i = 0; i < strLength; ++i) {
  45092. if (types[i] === "ON") {
  45093. types[i] = e;
  45094. }
  45095. }
  45096. for (i = 0; i < strLength; ++i) {
  45097. t = types[i];
  45098. if (isEven(levels[i])) {
  45099. if (t === "R") {
  45100. levels[i] += 1;
  45101. } else if (t === "AN" || t === "EN") {
  45102. levels[i] += 2;
  45103. }
  45104. } else {
  45105. if (t === "L" || t === "AN" || t === "EN") {
  45106. levels[i] += 1;
  45107. }
  45108. }
  45109. }
  45110. let highestLevel = -1;
  45111. let lowestOddLevel = 99;
  45112. let level;
  45113. for (i = 0, ii = levels.length; i < ii; ++i) {
  45114. level = levels[i];
  45115. if (highestLevel < level) {
  45116. highestLevel = level;
  45117. }
  45118. if (lowestOddLevel > level && isOdd(level)) {
  45119. lowestOddLevel = level;
  45120. }
  45121. }
  45122. for (level = highestLevel; level >= lowestOddLevel; --level) {
  45123. let start = -1;
  45124. for (i = 0, ii = levels.length; i < ii; ++i) {
  45125. if (levels[i] < level) {
  45126. if (start >= 0) {
  45127. reverseValues(chars, start, i);
  45128. start = -1;
  45129. }
  45130. } else if (start < 0) {
  45131. start = i;
  45132. }
  45133. }
  45134. if (start >= 0) {
  45135. reverseValues(chars, start, levels.length);
  45136. }
  45137. }
  45138. for (i = 0, ii = chars.length; i < ii; ++i) {
  45139. const ch = chars[i];
  45140. if (ch === "<" || ch === ">") {
  45141. chars[i] = "";
  45142. }
  45143. }
  45144. return createBidiText(chars.join(""), isLTR);
  45145. }
  45146. /***/ }),
  45147. /* 61 */
  45148. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45149. Object.defineProperty(exports, "__esModule", ({
  45150. value: true
  45151. }));
  45152. exports.MurmurHash3_64 = void 0;
  45153. var _util = __w_pdfjs_require__(2);
  45154. const SEED = 0xc3d2e1f0;
  45155. const MASK_HIGH = 0xffff0000;
  45156. const MASK_LOW = 0xffff;
  45157. class MurmurHash3_64 {
  45158. constructor(seed) {
  45159. this.h1 = seed ? seed & 0xffffffff : SEED;
  45160. this.h2 = seed ? seed & 0xffffffff : SEED;
  45161. }
  45162. update(input) {
  45163. let data, length;
  45164. if (typeof input === "string") {
  45165. data = new Uint8Array(input.length * 2);
  45166. length = 0;
  45167. for (let i = 0, ii = input.length; i < ii; i++) {
  45168. const code = input.charCodeAt(i);
  45169. if (code <= 0xff) {
  45170. data[length++] = code;
  45171. } else {
  45172. data[length++] = code >>> 8;
  45173. data[length++] = code & 0xff;
  45174. }
  45175. }
  45176. } else if ((0, _util.isArrayBuffer)(input)) {
  45177. data = input.slice();
  45178. length = data.byteLength;
  45179. } else {
  45180. throw new Error("Wrong data format in MurmurHash3_64_update. " + "Input must be a string or array.");
  45181. }
  45182. const blockCounts = length >> 2;
  45183. const tailLength = length - blockCounts * 4;
  45184. const dataUint32 = new Uint32Array(data.buffer, 0, blockCounts);
  45185. let k1 = 0,
  45186. k2 = 0;
  45187. let h1 = this.h1,
  45188. h2 = this.h2;
  45189. const C1 = 0xcc9e2d51,
  45190. C2 = 0x1b873593;
  45191. const C1_LOW = C1 & MASK_LOW,
  45192. C2_LOW = C2 & MASK_LOW;
  45193. for (let i = 0; i < blockCounts; i++) {
  45194. if (i & 1) {
  45195. k1 = dataUint32[i];
  45196. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45197. k1 = k1 << 15 | k1 >>> 17;
  45198. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45199. h1 ^= k1;
  45200. h1 = h1 << 13 | h1 >>> 19;
  45201. h1 = h1 * 5 + 0xe6546b64;
  45202. } else {
  45203. k2 = dataUint32[i];
  45204. k2 = k2 * C1 & MASK_HIGH | k2 * C1_LOW & MASK_LOW;
  45205. k2 = k2 << 15 | k2 >>> 17;
  45206. k2 = k2 * C2 & MASK_HIGH | k2 * C2_LOW & MASK_LOW;
  45207. h2 ^= k2;
  45208. h2 = h2 << 13 | h2 >>> 19;
  45209. h2 = h2 * 5 + 0xe6546b64;
  45210. }
  45211. }
  45212. k1 = 0;
  45213. switch (tailLength) {
  45214. case 3:
  45215. k1 ^= data[blockCounts * 4 + 2] << 16;
  45216. case 2:
  45217. k1 ^= data[blockCounts * 4 + 1] << 8;
  45218. case 1:
  45219. k1 ^= data[blockCounts * 4];
  45220. k1 = k1 * C1 & MASK_HIGH | k1 * C1_LOW & MASK_LOW;
  45221. k1 = k1 << 15 | k1 >>> 17;
  45222. k1 = k1 * C2 & MASK_HIGH | k1 * C2_LOW & MASK_LOW;
  45223. if (blockCounts & 1) {
  45224. h1 ^= k1;
  45225. } else {
  45226. h2 ^= k1;
  45227. }
  45228. }
  45229. this.h1 = h1;
  45230. this.h2 = h2;
  45231. }
  45232. hexdigest() {
  45233. let h1 = this.h1,
  45234. h2 = this.h2;
  45235. h1 ^= h2 >>> 1;
  45236. h1 = h1 * 0xed558ccd & MASK_HIGH | h1 * 0x8ccd & MASK_LOW;
  45237. h2 = h2 * 0xff51afd7 & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xafd7ed55 & MASK_HIGH) >>> 16;
  45238. h1 ^= h2 >>> 1;
  45239. h1 = h1 * 0x1a85ec53 & MASK_HIGH | h1 * 0xec53 & MASK_LOW;
  45240. h2 = h2 * 0xc4ceb9fe & MASK_HIGH | ((h2 << 16 | h1 >>> 16) * 0xb9fe1a85 & MASK_HIGH) >>> 16;
  45241. h1 ^= h2 >>> 1;
  45242. const hex1 = (h1 >>> 0).toString(16),
  45243. hex2 = (h2 >>> 0).toString(16);
  45244. return hex1.padStart(8, "0") + hex2.padStart(8, "0");
  45245. }
  45246. }
  45247. exports.MurmurHash3_64 = MurmurHash3_64;
  45248. /***/ }),
  45249. /* 62 */
  45250. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45251. Object.defineProperty(exports, "__esModule", ({
  45252. value: true
  45253. }));
  45254. exports.OperatorList = void 0;
  45255. var _util = __w_pdfjs_require__(2);
  45256. function addState(parentState, pattern, checkFn, iterateFn, processFn) {
  45257. let state = parentState;
  45258. for (let i = 0, ii = pattern.length - 1; i < ii; i++) {
  45259. const item = pattern[i];
  45260. state = state[item] || (state[item] = []);
  45261. }
  45262. state[pattern[pattern.length - 1]] = {
  45263. checkFn,
  45264. iterateFn,
  45265. processFn
  45266. };
  45267. }
  45268. const InitialState = [];
  45269. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintInlineImageXObject, _util.OPS.restore], null, function iterateInlineImageGroup(context, i) {
  45270. const fnArray = context.fnArray;
  45271. const iFirstSave = context.iCurr - 3;
  45272. const pos = (i - iFirstSave) % 4;
  45273. switch (pos) {
  45274. case 0:
  45275. return fnArray[i] === _util.OPS.save;
  45276. case 1:
  45277. return fnArray[i] === _util.OPS.transform;
  45278. case 2:
  45279. return fnArray[i] === _util.OPS.paintInlineImageXObject;
  45280. case 3:
  45281. return fnArray[i] === _util.OPS.restore;
  45282. }
  45283. throw new Error(`iterateInlineImageGroup - invalid pos: ${pos}`);
  45284. }, function foundInlineImageGroup(context, i) {
  45285. const MIN_IMAGES_IN_INLINE_IMAGES_BLOCK = 10;
  45286. const MAX_IMAGES_IN_INLINE_IMAGES_BLOCK = 200;
  45287. const MAX_WIDTH = 1000;
  45288. const IMAGE_PADDING = 1;
  45289. const fnArray = context.fnArray,
  45290. argsArray = context.argsArray;
  45291. const curr = context.iCurr;
  45292. const iFirstSave = curr - 3;
  45293. const iFirstTransform = curr - 2;
  45294. const iFirstPIIXO = curr - 1;
  45295. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_INLINE_IMAGES_BLOCK);
  45296. if (count < MIN_IMAGES_IN_INLINE_IMAGES_BLOCK) {
  45297. return i - (i - iFirstSave) % 4;
  45298. }
  45299. let maxX = 0;
  45300. const map = [];
  45301. let maxLineHeight = 0;
  45302. let currentX = IMAGE_PADDING,
  45303. currentY = IMAGE_PADDING;
  45304. for (let q = 0; q < count; q++) {
  45305. const transform = argsArray[iFirstTransform + (q << 2)];
  45306. const img = argsArray[iFirstPIIXO + (q << 2)][0];
  45307. if (currentX + img.width > MAX_WIDTH) {
  45308. maxX = Math.max(maxX, currentX);
  45309. currentY += maxLineHeight + 2 * IMAGE_PADDING;
  45310. currentX = 0;
  45311. maxLineHeight = 0;
  45312. }
  45313. map.push({
  45314. transform,
  45315. x: currentX,
  45316. y: currentY,
  45317. w: img.width,
  45318. h: img.height
  45319. });
  45320. currentX += img.width + 2 * IMAGE_PADDING;
  45321. maxLineHeight = Math.max(maxLineHeight, img.height);
  45322. }
  45323. const imgWidth = Math.max(maxX, currentX) + IMAGE_PADDING;
  45324. const imgHeight = currentY + maxLineHeight + IMAGE_PADDING;
  45325. const imgData = new Uint8Array(imgWidth * imgHeight * 4);
  45326. const imgRowSize = imgWidth << 2;
  45327. for (let q = 0; q < count; q++) {
  45328. const data = argsArray[iFirstPIIXO + (q << 2)][0].data;
  45329. const rowSize = map[q].w << 2;
  45330. let dataOffset = 0;
  45331. let offset = map[q].x + map[q].y * imgWidth << 2;
  45332. imgData.set(data.subarray(0, rowSize), offset - imgRowSize);
  45333. for (let k = 0, kk = map[q].h; k < kk; k++) {
  45334. imgData.set(data.subarray(dataOffset, dataOffset + rowSize), offset);
  45335. dataOffset += rowSize;
  45336. offset += imgRowSize;
  45337. }
  45338. imgData.set(data.subarray(dataOffset - rowSize, dataOffset), offset);
  45339. while (offset >= 0) {
  45340. data[offset - 4] = data[offset];
  45341. data[offset - 3] = data[offset + 1];
  45342. data[offset - 2] = data[offset + 2];
  45343. data[offset - 1] = data[offset + 3];
  45344. data[offset + rowSize] = data[offset + rowSize - 4];
  45345. data[offset + rowSize + 1] = data[offset + rowSize - 3];
  45346. data[offset + rowSize + 2] = data[offset + rowSize - 2];
  45347. data[offset + rowSize + 3] = data[offset + rowSize - 1];
  45348. offset -= imgRowSize;
  45349. }
  45350. }
  45351. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintInlineImageXObjectGroup);
  45352. argsArray.splice(iFirstSave, count * 4, [{
  45353. width: imgWidth,
  45354. height: imgHeight,
  45355. kind: _util.ImageKind.RGBA_32BPP,
  45356. data: imgData
  45357. }, map]);
  45358. return iFirstSave + 1;
  45359. });
  45360. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageMaskXObject, _util.OPS.restore], null, function iterateImageMaskGroup(context, i) {
  45361. const fnArray = context.fnArray;
  45362. const iFirstSave = context.iCurr - 3;
  45363. const pos = (i - iFirstSave) % 4;
  45364. switch (pos) {
  45365. case 0:
  45366. return fnArray[i] === _util.OPS.save;
  45367. case 1:
  45368. return fnArray[i] === _util.OPS.transform;
  45369. case 2:
  45370. return fnArray[i] === _util.OPS.paintImageMaskXObject;
  45371. case 3:
  45372. return fnArray[i] === _util.OPS.restore;
  45373. }
  45374. throw new Error(`iterateImageMaskGroup - invalid pos: ${pos}`);
  45375. }, function foundImageMaskGroup(context, i) {
  45376. const MIN_IMAGES_IN_MASKS_BLOCK = 10;
  45377. const MAX_IMAGES_IN_MASKS_BLOCK = 100;
  45378. const MAX_SAME_IMAGES_IN_MASKS_BLOCK = 1000;
  45379. const fnArray = context.fnArray,
  45380. argsArray = context.argsArray;
  45381. const curr = context.iCurr;
  45382. const iFirstSave = curr - 3;
  45383. const iFirstTransform = curr - 2;
  45384. const iFirstPIMXO = curr - 1;
  45385. let count = Math.floor((i - iFirstSave) / 4);
  45386. if (count < MIN_IMAGES_IN_MASKS_BLOCK) {
  45387. return i - (i - iFirstSave) % 4;
  45388. }
  45389. let isSameImage = false;
  45390. let iTransform, transformArgs;
  45391. const firstPIMXOArg0 = argsArray[iFirstPIMXO][0];
  45392. const firstTransformArg0 = argsArray[iFirstTransform][0],
  45393. firstTransformArg1 = argsArray[iFirstTransform][1],
  45394. firstTransformArg2 = argsArray[iFirstTransform][2],
  45395. firstTransformArg3 = argsArray[iFirstTransform][3];
  45396. if (firstTransformArg1 === firstTransformArg2) {
  45397. isSameImage = true;
  45398. iTransform = iFirstTransform + 4;
  45399. let iPIMXO = iFirstPIMXO + 4;
  45400. for (let q = 1; q < count; q++, iTransform += 4, iPIMXO += 4) {
  45401. transformArgs = argsArray[iTransform];
  45402. if (argsArray[iPIMXO][0] !== firstPIMXOArg0 || transformArgs[0] !== firstTransformArg0 || transformArgs[1] !== firstTransformArg1 || transformArgs[2] !== firstTransformArg2 || transformArgs[3] !== firstTransformArg3) {
  45403. if (q < MIN_IMAGES_IN_MASKS_BLOCK) {
  45404. isSameImage = false;
  45405. } else {
  45406. count = q;
  45407. }
  45408. break;
  45409. }
  45410. }
  45411. }
  45412. if (isSameImage) {
  45413. count = Math.min(count, MAX_SAME_IMAGES_IN_MASKS_BLOCK);
  45414. const positions = new Float32Array(count * 2);
  45415. iTransform = iFirstTransform;
  45416. for (let q = 0; q < count; q++, iTransform += 4) {
  45417. transformArgs = argsArray[iTransform];
  45418. positions[q << 1] = transformArgs[4];
  45419. positions[(q << 1) + 1] = transformArgs[5];
  45420. }
  45421. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectRepeat);
  45422. argsArray.splice(iFirstSave, count * 4, [firstPIMXOArg0, firstTransformArg0, firstTransformArg1, firstTransformArg2, firstTransformArg3, positions]);
  45423. } else {
  45424. count = Math.min(count, MAX_IMAGES_IN_MASKS_BLOCK);
  45425. const images = [];
  45426. for (let q = 0; q < count; q++) {
  45427. transformArgs = argsArray[iFirstTransform + (q << 2)];
  45428. const maskParams = argsArray[iFirstPIMXO + (q << 2)][0];
  45429. images.push({
  45430. data: maskParams.data,
  45431. width: maskParams.width,
  45432. height: maskParams.height,
  45433. interpolate: maskParams.interpolate,
  45434. count: maskParams.count,
  45435. transform: transformArgs
  45436. });
  45437. }
  45438. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageMaskXObjectGroup);
  45439. argsArray.splice(iFirstSave, count * 4, [images]);
  45440. }
  45441. return iFirstSave + 1;
  45442. });
  45443. addState(InitialState, [_util.OPS.save, _util.OPS.transform, _util.OPS.paintImageXObject, _util.OPS.restore], function (context) {
  45444. const argsArray = context.argsArray;
  45445. const iFirstTransform = context.iCurr - 2;
  45446. return argsArray[iFirstTransform][1] === 0 && argsArray[iFirstTransform][2] === 0;
  45447. }, function iterateImageGroup(context, i) {
  45448. const fnArray = context.fnArray,
  45449. argsArray = context.argsArray;
  45450. const iFirstSave = context.iCurr - 3;
  45451. const pos = (i - iFirstSave) % 4;
  45452. switch (pos) {
  45453. case 0:
  45454. return fnArray[i] === _util.OPS.save;
  45455. case 1:
  45456. if (fnArray[i] !== _util.OPS.transform) {
  45457. return false;
  45458. }
  45459. const iFirstTransform = context.iCurr - 2;
  45460. const firstTransformArg0 = argsArray[iFirstTransform][0];
  45461. const firstTransformArg3 = argsArray[iFirstTransform][3];
  45462. if (argsArray[i][0] !== firstTransformArg0 || argsArray[i][1] !== 0 || argsArray[i][2] !== 0 || argsArray[i][3] !== firstTransformArg3) {
  45463. return false;
  45464. }
  45465. return true;
  45466. case 2:
  45467. if (fnArray[i] !== _util.OPS.paintImageXObject) {
  45468. return false;
  45469. }
  45470. const iFirstPIXO = context.iCurr - 1;
  45471. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45472. if (argsArray[i][0] !== firstPIXOArg0) {
  45473. return false;
  45474. }
  45475. return true;
  45476. case 3:
  45477. return fnArray[i] === _util.OPS.restore;
  45478. }
  45479. throw new Error(`iterateImageGroup - invalid pos: ${pos}`);
  45480. }, function (context, i) {
  45481. const MIN_IMAGES_IN_BLOCK = 3;
  45482. const MAX_IMAGES_IN_BLOCK = 1000;
  45483. const fnArray = context.fnArray,
  45484. argsArray = context.argsArray;
  45485. const curr = context.iCurr;
  45486. const iFirstSave = curr - 3;
  45487. const iFirstTransform = curr - 2;
  45488. const iFirstPIXO = curr - 1;
  45489. const firstPIXOArg0 = argsArray[iFirstPIXO][0];
  45490. const firstTransformArg0 = argsArray[iFirstTransform][0];
  45491. const firstTransformArg3 = argsArray[iFirstTransform][3];
  45492. const count = Math.min(Math.floor((i - iFirstSave) / 4), MAX_IMAGES_IN_BLOCK);
  45493. if (count < MIN_IMAGES_IN_BLOCK) {
  45494. return i - (i - iFirstSave) % 4;
  45495. }
  45496. const positions = new Float32Array(count * 2);
  45497. let iTransform = iFirstTransform;
  45498. for (let q = 0; q < count; q++, iTransform += 4) {
  45499. const transformArgs = argsArray[iTransform];
  45500. positions[q << 1] = transformArgs[4];
  45501. positions[(q << 1) + 1] = transformArgs[5];
  45502. }
  45503. const args = [firstPIXOArg0, firstTransformArg0, firstTransformArg3, positions];
  45504. fnArray.splice(iFirstSave, count * 4, _util.OPS.paintImageXObjectRepeat);
  45505. argsArray.splice(iFirstSave, count * 4, args);
  45506. return iFirstSave + 1;
  45507. });
  45508. addState(InitialState, [_util.OPS.beginText, _util.OPS.setFont, _util.OPS.setTextMatrix, _util.OPS.showText, _util.OPS.endText], null, function iterateShowTextGroup(context, i) {
  45509. const fnArray = context.fnArray,
  45510. argsArray = context.argsArray;
  45511. const iFirstSave = context.iCurr - 4;
  45512. const pos = (i - iFirstSave) % 5;
  45513. switch (pos) {
  45514. case 0:
  45515. return fnArray[i] === _util.OPS.beginText;
  45516. case 1:
  45517. return fnArray[i] === _util.OPS.setFont;
  45518. case 2:
  45519. return fnArray[i] === _util.OPS.setTextMatrix;
  45520. case 3:
  45521. if (fnArray[i] !== _util.OPS.showText) {
  45522. return false;
  45523. }
  45524. const iFirstSetFont = context.iCurr - 3;
  45525. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45526. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45527. if (argsArray[i][0] !== firstSetFontArg0 || argsArray[i][1] !== firstSetFontArg1) {
  45528. return false;
  45529. }
  45530. return true;
  45531. case 4:
  45532. return fnArray[i] === _util.OPS.endText;
  45533. }
  45534. throw new Error(`iterateShowTextGroup - invalid pos: ${pos}`);
  45535. }, function (context, i) {
  45536. const MIN_CHARS_IN_BLOCK = 3;
  45537. const MAX_CHARS_IN_BLOCK = 1000;
  45538. const fnArray = context.fnArray,
  45539. argsArray = context.argsArray;
  45540. const curr = context.iCurr;
  45541. const iFirstBeginText = curr - 4;
  45542. const iFirstSetFont = curr - 3;
  45543. const iFirstSetTextMatrix = curr - 2;
  45544. const iFirstShowText = curr - 1;
  45545. const iFirstEndText = curr;
  45546. const firstSetFontArg0 = argsArray[iFirstSetFont][0];
  45547. const firstSetFontArg1 = argsArray[iFirstSetFont][1];
  45548. let count = Math.min(Math.floor((i - iFirstBeginText) / 5), MAX_CHARS_IN_BLOCK);
  45549. if (count < MIN_CHARS_IN_BLOCK) {
  45550. return i - (i - iFirstBeginText) % 5;
  45551. }
  45552. let iFirst = iFirstBeginText;
  45553. 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) {
  45554. count++;
  45555. iFirst -= 5;
  45556. }
  45557. let iEndText = iFirst + 4;
  45558. for (let q = 1; q < count; q++) {
  45559. fnArray.splice(iEndText, 3);
  45560. argsArray.splice(iEndText, 3);
  45561. iEndText += 2;
  45562. }
  45563. return iEndText + 1;
  45564. });
  45565. class NullOptimizer {
  45566. constructor(queue) {
  45567. this.queue = queue;
  45568. }
  45569. _optimize() {}
  45570. push(fn, args) {
  45571. this.queue.fnArray.push(fn);
  45572. this.queue.argsArray.push(args);
  45573. this._optimize();
  45574. }
  45575. flush() {}
  45576. reset() {}
  45577. }
  45578. class QueueOptimizer extends NullOptimizer {
  45579. constructor(queue) {
  45580. super(queue);
  45581. this.state = null;
  45582. this.context = {
  45583. iCurr: 0,
  45584. fnArray: queue.fnArray,
  45585. argsArray: queue.argsArray
  45586. };
  45587. this.match = null;
  45588. this.lastProcessed = 0;
  45589. }
  45590. _optimize() {
  45591. const fnArray = this.queue.fnArray;
  45592. let i = this.lastProcessed,
  45593. ii = fnArray.length;
  45594. let state = this.state;
  45595. let match = this.match;
  45596. if (!state && !match && i + 1 === ii && !InitialState[fnArray[i]]) {
  45597. this.lastProcessed = ii;
  45598. return;
  45599. }
  45600. const context = this.context;
  45601. while (i < ii) {
  45602. if (match) {
  45603. const iterate = (0, match.iterateFn)(context, i);
  45604. if (iterate) {
  45605. i++;
  45606. continue;
  45607. }
  45608. i = (0, match.processFn)(context, i + 1);
  45609. ii = fnArray.length;
  45610. match = null;
  45611. state = null;
  45612. if (i >= ii) {
  45613. break;
  45614. }
  45615. }
  45616. state = (state || InitialState)[fnArray[i]];
  45617. if (!state || Array.isArray(state)) {
  45618. i++;
  45619. continue;
  45620. }
  45621. context.iCurr = i;
  45622. i++;
  45623. if (state.checkFn && !(0, state.checkFn)(context)) {
  45624. state = null;
  45625. continue;
  45626. }
  45627. match = state;
  45628. state = null;
  45629. }
  45630. this.state = state;
  45631. this.match = match;
  45632. this.lastProcessed = i;
  45633. }
  45634. flush() {
  45635. while (this.match) {
  45636. const length = this.queue.fnArray.length;
  45637. this.lastProcessed = (0, this.match.processFn)(this.context, length);
  45638. this.match = null;
  45639. this.state = null;
  45640. this._optimize();
  45641. }
  45642. }
  45643. reset() {
  45644. this.state = null;
  45645. this.match = null;
  45646. this.lastProcessed = 0;
  45647. }
  45648. }
  45649. class OperatorList {
  45650. static get CHUNK_SIZE() {
  45651. return (0, _util.shadow)(this, "CHUNK_SIZE", 1000);
  45652. }
  45653. static get CHUNK_SIZE_ABOUT() {
  45654. return (0, _util.shadow)(this, "CHUNK_SIZE_ABOUT", this.CHUNK_SIZE - 5);
  45655. }
  45656. constructor(intent = 0, streamSink) {
  45657. this._streamSink = streamSink;
  45658. this.fnArray = [];
  45659. this.argsArray = [];
  45660. if (streamSink && !(intent & _util.RenderingIntentFlag.OPLIST)) {
  45661. this.optimizer = new QueueOptimizer(this);
  45662. } else {
  45663. this.optimizer = new NullOptimizer(this);
  45664. }
  45665. this.dependencies = new Set();
  45666. this._totalLength = 0;
  45667. this.weight = 0;
  45668. this._resolved = streamSink ? null : Promise.resolve();
  45669. }
  45670. get length() {
  45671. return this.argsArray.length;
  45672. }
  45673. get ready() {
  45674. return this._resolved || this._streamSink.ready;
  45675. }
  45676. get totalLength() {
  45677. return this._totalLength + this.length;
  45678. }
  45679. addOp(fn, args) {
  45680. this.optimizer.push(fn, args);
  45681. this.weight++;
  45682. if (this._streamSink) {
  45683. if (this.weight >= OperatorList.CHUNK_SIZE) {
  45684. this.flush();
  45685. } else if (this.weight >= OperatorList.CHUNK_SIZE_ABOUT && (fn === _util.OPS.restore || fn === _util.OPS.endText)) {
  45686. this.flush();
  45687. }
  45688. }
  45689. }
  45690. addImageOps(fn, args, optionalContent) {
  45691. if (optionalContent !== undefined) {
  45692. this.addOp(_util.OPS.beginMarkedContentProps, ["OC", optionalContent]);
  45693. }
  45694. this.addOp(fn, args);
  45695. if (optionalContent !== undefined) {
  45696. this.addOp(_util.OPS.endMarkedContent, []);
  45697. }
  45698. }
  45699. addDependency(dependency) {
  45700. if (this.dependencies.has(dependency)) {
  45701. return;
  45702. }
  45703. this.dependencies.add(dependency);
  45704. this.addOp(_util.OPS.dependency, [dependency]);
  45705. }
  45706. addDependencies(dependencies) {
  45707. for (const dependency of dependencies) {
  45708. this.addDependency(dependency);
  45709. }
  45710. }
  45711. addOpList(opList) {
  45712. if (!(opList instanceof OperatorList)) {
  45713. (0, _util.warn)('addOpList - ignoring invalid "opList" parameter.');
  45714. return;
  45715. }
  45716. for (const dependency of opList.dependencies) {
  45717. this.dependencies.add(dependency);
  45718. }
  45719. for (let i = 0, ii = opList.length; i < ii; i++) {
  45720. this.addOp(opList.fnArray[i], opList.argsArray[i]);
  45721. }
  45722. }
  45723. getIR() {
  45724. return {
  45725. fnArray: this.fnArray,
  45726. argsArray: this.argsArray,
  45727. length: this.length
  45728. };
  45729. }
  45730. get _transfers() {
  45731. const transfers = [];
  45732. const {
  45733. fnArray,
  45734. argsArray,
  45735. length
  45736. } = this;
  45737. for (let i = 0; i < length; i++) {
  45738. switch (fnArray[i]) {
  45739. case _util.OPS.paintInlineImageXObject:
  45740. case _util.OPS.paintInlineImageXObjectGroup:
  45741. case _util.OPS.paintImageMaskXObject:
  45742. const arg = argsArray[i][0];
  45743. if (!arg.cached && arg.data && arg.data.buffer instanceof ArrayBuffer) {
  45744. transfers.push(arg.data.buffer);
  45745. }
  45746. break;
  45747. }
  45748. }
  45749. return transfers;
  45750. }
  45751. flush(lastChunk = false) {
  45752. this.optimizer.flush();
  45753. const length = this.length;
  45754. this._totalLength += length;
  45755. this._streamSink.enqueue({
  45756. fnArray: this.fnArray,
  45757. argsArray: this.argsArray,
  45758. lastChunk,
  45759. length
  45760. }, 1, this._transfers);
  45761. this.dependencies.clear();
  45762. this.fnArray.length = 0;
  45763. this.argsArray.length = 0;
  45764. this.weight = 0;
  45765. this.optimizer.reset();
  45766. }
  45767. }
  45768. exports.OperatorList = OperatorList;
  45769. /***/ }),
  45770. /* 63 */
  45771. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  45772. Object.defineProperty(exports, "__esModule", ({
  45773. value: true
  45774. }));
  45775. exports.PDFImage = void 0;
  45776. var _util = __w_pdfjs_require__(2);
  45777. var _image_utils = __w_pdfjs_require__(64);
  45778. var _base_stream = __w_pdfjs_require__(9);
  45779. var _colorspace = __w_pdfjs_require__(24);
  45780. var _decode_stream = __w_pdfjs_require__(29);
  45781. var _jpeg_stream = __w_pdfjs_require__(37);
  45782. var _jpx = __w_pdfjs_require__(40);
  45783. var _primitives = __w_pdfjs_require__(5);
  45784. function decodeAndClamp(value, addend, coefficient, max) {
  45785. value = addend + value * coefficient;
  45786. if (value < 0) {
  45787. value = 0;
  45788. } else if (value > max) {
  45789. value = max;
  45790. }
  45791. return value;
  45792. }
  45793. function resizeImageMask(src, bpc, w1, h1, w2, h2) {
  45794. const length = w2 * h2;
  45795. let dest;
  45796. if (bpc <= 8) {
  45797. dest = new Uint8Array(length);
  45798. } else if (bpc <= 16) {
  45799. dest = new Uint16Array(length);
  45800. } else {
  45801. dest = new Uint32Array(length);
  45802. }
  45803. const xRatio = w1 / w2;
  45804. const yRatio = h1 / h2;
  45805. let i,
  45806. j,
  45807. py,
  45808. newIndex = 0,
  45809. oldIndex;
  45810. const xScaled = new Uint16Array(w2);
  45811. const w1Scanline = w1;
  45812. for (i = 0; i < w2; i++) {
  45813. xScaled[i] = Math.floor(i * xRatio);
  45814. }
  45815. for (i = 0; i < h2; i++) {
  45816. py = Math.floor(i * yRatio) * w1Scanline;
  45817. for (j = 0; j < w2; j++) {
  45818. oldIndex = py + xScaled[j];
  45819. dest[newIndex++] = src[oldIndex];
  45820. }
  45821. }
  45822. return dest;
  45823. }
  45824. class PDFImage {
  45825. constructor({
  45826. xref,
  45827. res,
  45828. image,
  45829. isInline = false,
  45830. smask = null,
  45831. mask = null,
  45832. isMask = false,
  45833. pdfFunctionFactory,
  45834. localColorSpaceCache
  45835. }) {
  45836. this.image = image;
  45837. const dict = image.dict;
  45838. const filter = dict.get("F", "Filter");
  45839. if (filter instanceof _primitives.Name) {
  45840. switch (filter.name) {
  45841. case "JPXDecode":
  45842. const jpxImage = new _jpx.JpxImage();
  45843. jpxImage.parseImageProperties(image.stream);
  45844. image.stream.reset();
  45845. image.width = jpxImage.width;
  45846. image.height = jpxImage.height;
  45847. image.bitsPerComponent = jpxImage.bitsPerComponent;
  45848. image.numComps = jpxImage.componentsCount;
  45849. break;
  45850. case "JBIG2Decode":
  45851. image.bitsPerComponent = 1;
  45852. image.numComps = 1;
  45853. break;
  45854. }
  45855. }
  45856. let width = dict.get("W", "Width");
  45857. let height = dict.get("H", "Height");
  45858. if (Number.isInteger(image.width) && image.width > 0 && Number.isInteger(image.height) && image.height > 0 && (image.width !== width || image.height !== height)) {
  45859. (0, _util.warn)("PDFImage - using the Width/Height of the image data, " + "rather than the image dictionary.");
  45860. width = image.width;
  45861. height = image.height;
  45862. }
  45863. if (width < 1 || height < 1) {
  45864. throw new _util.FormatError(`Invalid image width: ${width} or height: ${height}`);
  45865. }
  45866. this.width = width;
  45867. this.height = height;
  45868. this.interpolate = dict.get("I", "Interpolate");
  45869. this.imageMask = dict.get("IM", "ImageMask") || false;
  45870. this.matte = dict.get("Matte") || false;
  45871. let bitsPerComponent = image.bitsPerComponent;
  45872. if (!bitsPerComponent) {
  45873. bitsPerComponent = dict.get("BPC", "BitsPerComponent");
  45874. if (!bitsPerComponent) {
  45875. if (this.imageMask) {
  45876. bitsPerComponent = 1;
  45877. } else {
  45878. throw new _util.FormatError(`Bits per component missing in image: ${this.imageMask}`);
  45879. }
  45880. }
  45881. }
  45882. this.bpc = bitsPerComponent;
  45883. if (!this.imageMask) {
  45884. let colorSpace = dict.getRaw("CS") || dict.getRaw("ColorSpace");
  45885. if (!colorSpace) {
  45886. (0, _util.info)("JPX images (which do not require color spaces)");
  45887. switch (image.numComps) {
  45888. case 1:
  45889. colorSpace = _primitives.Name.get("DeviceGray");
  45890. break;
  45891. case 3:
  45892. colorSpace = _primitives.Name.get("DeviceRGB");
  45893. break;
  45894. case 4:
  45895. colorSpace = _primitives.Name.get("DeviceCMYK");
  45896. break;
  45897. default:
  45898. throw new Error(`JPX images with ${image.numComps} color components not supported.`);
  45899. }
  45900. }
  45901. this.colorSpace = _colorspace.ColorSpace.parse({
  45902. cs: colorSpace,
  45903. xref,
  45904. resources: isInline ? res : null,
  45905. pdfFunctionFactory,
  45906. localColorSpaceCache
  45907. });
  45908. this.numComps = this.colorSpace.numComps;
  45909. }
  45910. this.decode = dict.getArray("D", "Decode");
  45911. this.needsDecode = false;
  45912. if (this.decode && (this.colorSpace && !this.colorSpace.isDefaultDecode(this.decode, bitsPerComponent) || isMask && !_colorspace.ColorSpace.isDefaultDecode(this.decode, 1))) {
  45913. this.needsDecode = true;
  45914. const max = (1 << bitsPerComponent) - 1;
  45915. this.decodeCoefficients = [];
  45916. this.decodeAddends = [];
  45917. const isIndexed = this.colorSpace && this.colorSpace.name === "Indexed";
  45918. for (let i = 0, j = 0; i < this.decode.length; i += 2, ++j) {
  45919. const dmin = this.decode[i];
  45920. const dmax = this.decode[i + 1];
  45921. this.decodeCoefficients[j] = isIndexed ? (dmax - dmin) / max : dmax - dmin;
  45922. this.decodeAddends[j] = isIndexed ? dmin : max * dmin;
  45923. }
  45924. }
  45925. if (smask) {
  45926. this.smask = new PDFImage({
  45927. xref,
  45928. res,
  45929. image: smask,
  45930. isInline,
  45931. pdfFunctionFactory,
  45932. localColorSpaceCache
  45933. });
  45934. } else if (mask) {
  45935. if (mask instanceof _base_stream.BaseStream) {
  45936. const maskDict = mask.dict,
  45937. imageMask = maskDict.get("IM", "ImageMask");
  45938. if (!imageMask) {
  45939. (0, _util.warn)("Ignoring /Mask in image without /ImageMask.");
  45940. } else {
  45941. this.mask = new PDFImage({
  45942. xref,
  45943. res,
  45944. image: mask,
  45945. isInline,
  45946. isMask: true,
  45947. pdfFunctionFactory,
  45948. localColorSpaceCache
  45949. });
  45950. }
  45951. } else {
  45952. this.mask = mask;
  45953. }
  45954. }
  45955. }
  45956. static async buildImage({
  45957. xref,
  45958. res,
  45959. image,
  45960. isInline = false,
  45961. pdfFunctionFactory,
  45962. localColorSpaceCache
  45963. }) {
  45964. const imageData = image;
  45965. let smaskData = null;
  45966. let maskData = null;
  45967. const smask = image.dict.get("SMask");
  45968. const mask = image.dict.get("Mask");
  45969. if (smask) {
  45970. if (smask instanceof _base_stream.BaseStream) {
  45971. smaskData = smask;
  45972. } else {
  45973. (0, _util.warn)("Unsupported /SMask format.");
  45974. }
  45975. } else if (mask) {
  45976. if (mask instanceof _base_stream.BaseStream || Array.isArray(mask)) {
  45977. maskData = mask;
  45978. } else {
  45979. (0, _util.warn)("Unsupported /Mask format.");
  45980. }
  45981. }
  45982. return new PDFImage({
  45983. xref,
  45984. res,
  45985. image: imageData,
  45986. isInline,
  45987. smask: smaskData,
  45988. mask: maskData,
  45989. pdfFunctionFactory,
  45990. localColorSpaceCache
  45991. });
  45992. }
  45993. static createRawMask({
  45994. imgArray,
  45995. width,
  45996. height,
  45997. imageIsFromDecodeStream,
  45998. inverseDecode,
  45999. interpolate
  46000. }) {
  46001. const computedLength = (width + 7 >> 3) * height;
  46002. const actualLength = imgArray.byteLength;
  46003. const haveFullData = computedLength === actualLength;
  46004. let data, i;
  46005. if (imageIsFromDecodeStream && (!inverseDecode || haveFullData)) {
  46006. data = imgArray;
  46007. } else if (!inverseDecode) {
  46008. data = new Uint8Array(imgArray);
  46009. } else {
  46010. data = new Uint8Array(computedLength);
  46011. data.set(imgArray);
  46012. data.fill(0xff, actualLength);
  46013. }
  46014. if (inverseDecode) {
  46015. for (i = 0; i < actualLength; i++) {
  46016. data[i] ^= 0xff;
  46017. }
  46018. }
  46019. return {
  46020. data,
  46021. width,
  46022. height,
  46023. interpolate
  46024. };
  46025. }
  46026. static createMask({
  46027. imgArray,
  46028. width,
  46029. height,
  46030. imageIsFromDecodeStream,
  46031. inverseDecode,
  46032. interpolate
  46033. }) {
  46034. const isSingleOpaquePixel = width === 1 && height === 1 && inverseDecode === (imgArray.length === 0 || !!(imgArray[0] & 128));
  46035. if (isSingleOpaquePixel) {
  46036. return {
  46037. isSingleOpaquePixel
  46038. };
  46039. }
  46040. if (_util.FeatureTest.isOffscreenCanvasSupported) {
  46041. const canvas = new OffscreenCanvas(width, height);
  46042. const ctx = canvas.getContext("2d");
  46043. const imgData = ctx.createImageData(width, height);
  46044. (0, _image_utils.applyMaskImageData)({
  46045. src: imgArray,
  46046. dest: imgData.data,
  46047. width,
  46048. height,
  46049. inverseDecode
  46050. });
  46051. ctx.putImageData(imgData, 0, 0);
  46052. const bitmap = canvas.transferToImageBitmap();
  46053. return {
  46054. data: null,
  46055. width,
  46056. height,
  46057. interpolate,
  46058. bitmap
  46059. };
  46060. }
  46061. return this.createRawMask({
  46062. imgArray,
  46063. width,
  46064. height,
  46065. inverseDecode,
  46066. imageIsFromDecodeStream,
  46067. interpolate
  46068. });
  46069. }
  46070. get drawWidth() {
  46071. return Math.max(this.width, this.smask && this.smask.width || 0, this.mask && this.mask.width || 0);
  46072. }
  46073. get drawHeight() {
  46074. return Math.max(this.height, this.smask && this.smask.height || 0, this.mask && this.mask.height || 0);
  46075. }
  46076. decodeBuffer(buffer) {
  46077. const bpc = this.bpc;
  46078. const numComps = this.numComps;
  46079. const decodeAddends = this.decodeAddends;
  46080. const decodeCoefficients = this.decodeCoefficients;
  46081. const max = (1 << bpc) - 1;
  46082. let i, ii;
  46083. if (bpc === 1) {
  46084. for (i = 0, ii = buffer.length; i < ii; i++) {
  46085. buffer[i] = +!buffer[i];
  46086. }
  46087. return;
  46088. }
  46089. let index = 0;
  46090. for (i = 0, ii = this.width * this.height; i < ii; i++) {
  46091. for (let j = 0; j < numComps; j++) {
  46092. buffer[index] = decodeAndClamp(buffer[index], decodeAddends[j], decodeCoefficients[j], max);
  46093. index++;
  46094. }
  46095. }
  46096. }
  46097. getComponents(buffer) {
  46098. const bpc = this.bpc;
  46099. if (bpc === 8) {
  46100. return buffer;
  46101. }
  46102. const width = this.width;
  46103. const height = this.height;
  46104. const numComps = this.numComps;
  46105. const length = width * height * numComps;
  46106. let bufferPos = 0;
  46107. let output;
  46108. if (bpc <= 8) {
  46109. output = new Uint8Array(length);
  46110. } else if (bpc <= 16) {
  46111. output = new Uint16Array(length);
  46112. } else {
  46113. output = new Uint32Array(length);
  46114. }
  46115. const rowComps = width * numComps;
  46116. const max = (1 << bpc) - 1;
  46117. let i = 0,
  46118. ii,
  46119. buf;
  46120. if (bpc === 1) {
  46121. let mask, loop1End, loop2End;
  46122. for (let j = 0; j < height; j++) {
  46123. loop1End = i + (rowComps & ~7);
  46124. loop2End = i + rowComps;
  46125. while (i < loop1End) {
  46126. buf = buffer[bufferPos++];
  46127. output[i] = buf >> 7 & 1;
  46128. output[i + 1] = buf >> 6 & 1;
  46129. output[i + 2] = buf >> 5 & 1;
  46130. output[i + 3] = buf >> 4 & 1;
  46131. output[i + 4] = buf >> 3 & 1;
  46132. output[i + 5] = buf >> 2 & 1;
  46133. output[i + 6] = buf >> 1 & 1;
  46134. output[i + 7] = buf & 1;
  46135. i += 8;
  46136. }
  46137. if (i < loop2End) {
  46138. buf = buffer[bufferPos++];
  46139. mask = 128;
  46140. while (i < loop2End) {
  46141. output[i++] = +!!(buf & mask);
  46142. mask >>= 1;
  46143. }
  46144. }
  46145. }
  46146. } else {
  46147. let bits = 0;
  46148. buf = 0;
  46149. for (i = 0, ii = length; i < ii; ++i) {
  46150. if (i % rowComps === 0) {
  46151. buf = 0;
  46152. bits = 0;
  46153. }
  46154. while (bits < bpc) {
  46155. buf = buf << 8 | buffer[bufferPos++];
  46156. bits += 8;
  46157. }
  46158. const remainingBits = bits - bpc;
  46159. let value = buf >> remainingBits;
  46160. if (value < 0) {
  46161. value = 0;
  46162. } else if (value > max) {
  46163. value = max;
  46164. }
  46165. output[i] = value;
  46166. buf &= (1 << remainingBits) - 1;
  46167. bits = remainingBits;
  46168. }
  46169. }
  46170. return output;
  46171. }
  46172. fillOpacity(rgbaBuf, width, height, actualHeight, image) {
  46173. const smask = this.smask;
  46174. const mask = this.mask;
  46175. let alphaBuf, sw, sh, i, ii, j;
  46176. if (smask) {
  46177. sw = smask.width;
  46178. sh = smask.height;
  46179. alphaBuf = new Uint8ClampedArray(sw * sh);
  46180. smask.fillGrayBuffer(alphaBuf);
  46181. if (sw !== width || sh !== height) {
  46182. alphaBuf = resizeImageMask(alphaBuf, smask.bpc, sw, sh, width, height);
  46183. }
  46184. } else if (mask) {
  46185. if (mask instanceof PDFImage) {
  46186. sw = mask.width;
  46187. sh = mask.height;
  46188. alphaBuf = new Uint8ClampedArray(sw * sh);
  46189. mask.numComps = 1;
  46190. mask.fillGrayBuffer(alphaBuf);
  46191. for (i = 0, ii = sw * sh; i < ii; ++i) {
  46192. alphaBuf[i] = 255 - alphaBuf[i];
  46193. }
  46194. if (sw !== width || sh !== height) {
  46195. alphaBuf = resizeImageMask(alphaBuf, mask.bpc, sw, sh, width, height);
  46196. }
  46197. } else if (Array.isArray(mask)) {
  46198. alphaBuf = new Uint8ClampedArray(width * height);
  46199. const numComps = this.numComps;
  46200. for (i = 0, ii = width * height; i < ii; ++i) {
  46201. let opacity = 0;
  46202. const imageOffset = i * numComps;
  46203. for (j = 0; j < numComps; ++j) {
  46204. const color = image[imageOffset + j];
  46205. const maskOffset = j * 2;
  46206. if (color < mask[maskOffset] || color > mask[maskOffset + 1]) {
  46207. opacity = 255;
  46208. break;
  46209. }
  46210. }
  46211. alphaBuf[i] = opacity;
  46212. }
  46213. } else {
  46214. throw new _util.FormatError("Unknown mask format.");
  46215. }
  46216. }
  46217. if (alphaBuf) {
  46218. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46219. rgbaBuf[j] = alphaBuf[i];
  46220. }
  46221. } else {
  46222. for (i = 0, j = 3, ii = width * actualHeight; i < ii; ++i, j += 4) {
  46223. rgbaBuf[j] = 255;
  46224. }
  46225. }
  46226. }
  46227. undoPreblend(buffer, width, height) {
  46228. const matte = this.smask && this.smask.matte;
  46229. if (!matte) {
  46230. return;
  46231. }
  46232. const matteRgb = this.colorSpace.getRgb(matte, 0);
  46233. const matteR = matteRgb[0];
  46234. const matteG = matteRgb[1];
  46235. const matteB = matteRgb[2];
  46236. const length = width * height * 4;
  46237. for (let i = 0; i < length; i += 4) {
  46238. const alpha = buffer[i + 3];
  46239. if (alpha === 0) {
  46240. buffer[i] = 255;
  46241. buffer[i + 1] = 255;
  46242. buffer[i + 2] = 255;
  46243. continue;
  46244. }
  46245. const k = 255 / alpha;
  46246. buffer[i] = (buffer[i] - matteR) * k + matteR;
  46247. buffer[i + 1] = (buffer[i + 1] - matteG) * k + matteG;
  46248. buffer[i + 2] = (buffer[i + 2] - matteB) * k + matteB;
  46249. }
  46250. }
  46251. createImageData(forceRGBA = false) {
  46252. const drawWidth = this.drawWidth;
  46253. const drawHeight = this.drawHeight;
  46254. const imgData = {
  46255. width: drawWidth,
  46256. height: drawHeight,
  46257. interpolate: this.interpolate,
  46258. kind: 0,
  46259. data: null
  46260. };
  46261. const numComps = this.numComps;
  46262. const originalWidth = this.width;
  46263. const originalHeight = this.height;
  46264. const bpc = this.bpc;
  46265. const rowBytes = originalWidth * numComps * bpc + 7 >> 3;
  46266. if (!forceRGBA) {
  46267. let kind;
  46268. if (this.colorSpace.name === "DeviceGray" && bpc === 1) {
  46269. kind = _util.ImageKind.GRAYSCALE_1BPP;
  46270. } else if (this.colorSpace.name === "DeviceRGB" && bpc === 8 && !this.needsDecode) {
  46271. kind = _util.ImageKind.RGB_24BPP;
  46272. }
  46273. if (kind && !this.smask && !this.mask && drawWidth === originalWidth && drawHeight === originalHeight) {
  46274. imgData.kind = kind;
  46275. imgData.data = this.getImageBytes(originalHeight * rowBytes, {});
  46276. if (this.needsDecode) {
  46277. (0, _util.assert)(kind === _util.ImageKind.GRAYSCALE_1BPP, "PDFImage.createImageData: The image must be grayscale.");
  46278. const buffer = imgData.data;
  46279. for (let i = 0, ii = buffer.length; i < ii; i++) {
  46280. buffer[i] ^= 0xff;
  46281. }
  46282. }
  46283. return imgData;
  46284. }
  46285. if (this.image instanceof _jpeg_stream.JpegStream && !this.smask && !this.mask) {
  46286. let imageLength = originalHeight * rowBytes;
  46287. switch (this.colorSpace.name) {
  46288. case "DeviceGray":
  46289. imageLength *= 3;
  46290. case "DeviceRGB":
  46291. case "DeviceCMYK":
  46292. imgData.kind = _util.ImageKind.RGB_24BPP;
  46293. imgData.data = this.getImageBytes(imageLength, {
  46294. drawWidth,
  46295. drawHeight,
  46296. forceRGB: true
  46297. });
  46298. return imgData;
  46299. }
  46300. }
  46301. }
  46302. const imgArray = this.getImageBytes(originalHeight * rowBytes, {
  46303. internal: true
  46304. });
  46305. const actualHeight = 0 | imgArray.length / rowBytes * drawHeight / originalHeight;
  46306. const comps = this.getComponents(imgArray);
  46307. let alpha01, maybeUndoPreblend;
  46308. if (!forceRGBA && !this.smask && !this.mask) {
  46309. imgData.kind = _util.ImageKind.RGB_24BPP;
  46310. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 3);
  46311. alpha01 = 0;
  46312. maybeUndoPreblend = false;
  46313. } else {
  46314. imgData.kind = _util.ImageKind.RGBA_32BPP;
  46315. imgData.data = new Uint8ClampedArray(drawWidth * drawHeight * 4);
  46316. alpha01 = 1;
  46317. maybeUndoPreblend = true;
  46318. this.fillOpacity(imgData.data, drawWidth, drawHeight, actualHeight, comps);
  46319. }
  46320. if (this.needsDecode) {
  46321. this.decodeBuffer(comps);
  46322. }
  46323. this.colorSpace.fillRgb(imgData.data, originalWidth, originalHeight, drawWidth, drawHeight, actualHeight, bpc, comps, alpha01);
  46324. if (maybeUndoPreblend) {
  46325. this.undoPreblend(imgData.data, drawWidth, actualHeight);
  46326. }
  46327. return imgData;
  46328. }
  46329. fillGrayBuffer(buffer) {
  46330. const numComps = this.numComps;
  46331. if (numComps !== 1) {
  46332. throw new _util.FormatError(`Reading gray scale from a color image: ${numComps}`);
  46333. }
  46334. const width = this.width;
  46335. const height = this.height;
  46336. const bpc = this.bpc;
  46337. const rowBytes = width * numComps * bpc + 7 >> 3;
  46338. const imgArray = this.getImageBytes(height * rowBytes, {
  46339. internal: true
  46340. });
  46341. const comps = this.getComponents(imgArray);
  46342. let i, length;
  46343. if (bpc === 1) {
  46344. length = width * height;
  46345. if (this.needsDecode) {
  46346. for (i = 0; i < length; ++i) {
  46347. buffer[i] = comps[i] - 1 & 255;
  46348. }
  46349. } else {
  46350. for (i = 0; i < length; ++i) {
  46351. buffer[i] = -comps[i] & 255;
  46352. }
  46353. }
  46354. return;
  46355. }
  46356. if (this.needsDecode) {
  46357. this.decodeBuffer(comps);
  46358. }
  46359. length = width * height;
  46360. const scale = 255 / ((1 << bpc) - 1);
  46361. for (i = 0; i < length; ++i) {
  46362. buffer[i] = scale * comps[i];
  46363. }
  46364. }
  46365. getImageBytes(length, {
  46366. drawWidth,
  46367. drawHeight,
  46368. forceRGB = false,
  46369. internal = false
  46370. }) {
  46371. this.image.reset();
  46372. this.image.drawWidth = drawWidth || this.width;
  46373. this.image.drawHeight = drawHeight || this.height;
  46374. this.image.forceRGB = !!forceRGB;
  46375. const imageBytes = this.image.getBytes(length);
  46376. if (internal || this.image instanceof _decode_stream.DecodeStream) {
  46377. return imageBytes;
  46378. }
  46379. (0, _util.assert)(imageBytes instanceof Uint8Array, 'PDFImage.getImageBytes: Unsupported "imageBytes" type.');
  46380. return new Uint8Array(imageBytes);
  46381. }
  46382. }
  46383. exports.PDFImage = PDFImage;
  46384. /***/ }),
  46385. /* 64 */
  46386. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46387. Object.defineProperty(exports, "__esModule", ({
  46388. value: true
  46389. }));
  46390. exports.applyMaskImageData = applyMaskImageData;
  46391. var _util = __w_pdfjs_require__(2);
  46392. function applyMaskImageData({
  46393. src,
  46394. srcPos = 0,
  46395. dest,
  46396. destPos = 0,
  46397. width,
  46398. height,
  46399. inverseDecode = false
  46400. }) {
  46401. const opaque = _util.FeatureTest.isLittleEndian ? 0xff000000 : 0x000000ff;
  46402. const [zeroMapping, oneMapping] = !inverseDecode ? [opaque, 0] : [0, opaque];
  46403. const widthInSource = width >> 3;
  46404. const widthRemainder = width & 7;
  46405. const srcLength = src.length;
  46406. dest = new Uint32Array(dest.buffer);
  46407. for (let i = 0; i < height; i++) {
  46408. for (const max = srcPos + widthInSource; srcPos < max; srcPos++) {
  46409. const elem = srcPos < srcLength ? src[srcPos] : 255;
  46410. dest[destPos++] = elem & 0b10000000 ? oneMapping : zeroMapping;
  46411. dest[destPos++] = elem & 0b1000000 ? oneMapping : zeroMapping;
  46412. dest[destPos++] = elem & 0b100000 ? oneMapping : zeroMapping;
  46413. dest[destPos++] = elem & 0b10000 ? oneMapping : zeroMapping;
  46414. dest[destPos++] = elem & 0b1000 ? oneMapping : zeroMapping;
  46415. dest[destPos++] = elem & 0b100 ? oneMapping : zeroMapping;
  46416. dest[destPos++] = elem & 0b10 ? oneMapping : zeroMapping;
  46417. dest[destPos++] = elem & 0b1 ? oneMapping : zeroMapping;
  46418. }
  46419. if (widthRemainder === 0) {
  46420. continue;
  46421. }
  46422. const elem = srcPos < srcLength ? src[srcPos++] : 255;
  46423. for (let j = 0; j < widthRemainder; j++) {
  46424. dest[destPos++] = elem & 1 << 7 - j ? oneMapping : zeroMapping;
  46425. }
  46426. }
  46427. return {
  46428. srcPos,
  46429. destPos
  46430. };
  46431. }
  46432. /***/ }),
  46433. /* 65 */
  46434. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  46435. Object.defineProperty(exports, "__esModule", ({
  46436. value: true
  46437. }));
  46438. exports.Catalog = void 0;
  46439. var _core_utils = __w_pdfjs_require__(8);
  46440. var _util = __w_pdfjs_require__(2);
  46441. var _primitives = __w_pdfjs_require__(5);
  46442. var _name_number_tree = __w_pdfjs_require__(66);
  46443. var _base_stream = __w_pdfjs_require__(9);
  46444. var _cleanup_helper = __w_pdfjs_require__(67);
  46445. var _colorspace = __w_pdfjs_require__(24);
  46446. var _file_spec = __w_pdfjs_require__(68);
  46447. var _image_utils = __w_pdfjs_require__(59);
  46448. var _metadata_parser = __w_pdfjs_require__(69);
  46449. var _struct_tree = __w_pdfjs_require__(71);
  46450. function fetchDestination(dest) {
  46451. if (dest instanceof _primitives.Dict) {
  46452. dest = dest.get("D");
  46453. }
  46454. return Array.isArray(dest) ? dest : null;
  46455. }
  46456. class Catalog {
  46457. constructor(pdfManager, xref) {
  46458. this.pdfManager = pdfManager;
  46459. this.xref = xref;
  46460. this._catDict = xref.getCatalogObj();
  46461. if (!(this._catDict instanceof _primitives.Dict)) {
  46462. throw new _util.FormatError("Catalog object is not a dictionary.");
  46463. }
  46464. this.toplevelPagesDict;
  46465. this._actualNumPages = null;
  46466. this.fontCache = new _primitives.RefSetCache();
  46467. this.builtInCMapCache = new Map();
  46468. this.standardFontDataCache = new Map();
  46469. this.globalImageCache = new _image_utils.GlobalImageCache();
  46470. this.pageKidsCountCache = new _primitives.RefSetCache();
  46471. this.pageIndexCache = new _primitives.RefSetCache();
  46472. this.nonBlendModesSet = new _primitives.RefSet();
  46473. }
  46474. get version() {
  46475. const version = this._catDict.get("Version");
  46476. return (0, _util.shadow)(this, "version", version instanceof _primitives.Name ? version.name : null);
  46477. }
  46478. get lang() {
  46479. const lang = this._catDict.get("Lang");
  46480. return (0, _util.shadow)(this, "lang", typeof lang === "string" ? (0, _util.stringToPDFString)(lang) : null);
  46481. }
  46482. get needsRendering() {
  46483. const needsRendering = this._catDict.get("NeedsRendering");
  46484. return (0, _util.shadow)(this, "needsRendering", typeof needsRendering === "boolean" ? needsRendering : false);
  46485. }
  46486. get collection() {
  46487. let collection = null;
  46488. try {
  46489. const obj = this._catDict.get("Collection");
  46490. if (obj instanceof _primitives.Dict && obj.size > 0) {
  46491. collection = obj;
  46492. }
  46493. } catch (ex) {
  46494. if (ex instanceof _core_utils.MissingDataException) {
  46495. throw ex;
  46496. }
  46497. (0, _util.info)("Cannot fetch Collection entry; assuming no collection is present.");
  46498. }
  46499. return (0, _util.shadow)(this, "collection", collection);
  46500. }
  46501. get acroForm() {
  46502. let acroForm = null;
  46503. try {
  46504. const obj = this._catDict.get("AcroForm");
  46505. if (obj instanceof _primitives.Dict && obj.size > 0) {
  46506. acroForm = obj;
  46507. }
  46508. } catch (ex) {
  46509. if (ex instanceof _core_utils.MissingDataException) {
  46510. throw ex;
  46511. }
  46512. (0, _util.info)("Cannot fetch AcroForm entry; assuming no forms are present.");
  46513. }
  46514. return (0, _util.shadow)(this, "acroForm", acroForm);
  46515. }
  46516. get acroFormRef() {
  46517. const value = this._catDict.getRaw("AcroForm");
  46518. return (0, _util.shadow)(this, "acroFormRef", value instanceof _primitives.Ref ? value : null);
  46519. }
  46520. get metadata() {
  46521. const streamRef = this._catDict.getRaw("Metadata");
  46522. if (!(streamRef instanceof _primitives.Ref)) {
  46523. return (0, _util.shadow)(this, "metadata", null);
  46524. }
  46525. let metadata = null;
  46526. try {
  46527. const suppressEncryption = !(this.xref.encrypt && this.xref.encrypt.encryptMetadata);
  46528. const stream = this.xref.fetch(streamRef, suppressEncryption);
  46529. if (stream instanceof _base_stream.BaseStream && stream.dict instanceof _primitives.Dict) {
  46530. const type = stream.dict.get("Type");
  46531. const subtype = stream.dict.get("Subtype");
  46532. if ((0, _primitives.isName)(type, "Metadata") && (0, _primitives.isName)(subtype, "XML")) {
  46533. const data = (0, _util.stringToUTF8String)(stream.getString());
  46534. if (data) {
  46535. metadata = new _metadata_parser.MetadataParser(data).serializable;
  46536. }
  46537. }
  46538. }
  46539. } catch (ex) {
  46540. if (ex instanceof _core_utils.MissingDataException) {
  46541. throw ex;
  46542. }
  46543. (0, _util.info)(`Skipping invalid Metadata: "${ex}".`);
  46544. }
  46545. return (0, _util.shadow)(this, "metadata", metadata);
  46546. }
  46547. get markInfo() {
  46548. let markInfo = null;
  46549. try {
  46550. markInfo = this._readMarkInfo();
  46551. } catch (ex) {
  46552. if (ex instanceof _core_utils.MissingDataException) {
  46553. throw ex;
  46554. }
  46555. (0, _util.warn)("Unable to read mark info.");
  46556. }
  46557. return (0, _util.shadow)(this, "markInfo", markInfo);
  46558. }
  46559. _readMarkInfo() {
  46560. const obj = this._catDict.get("MarkInfo");
  46561. if (!(obj instanceof _primitives.Dict)) {
  46562. return null;
  46563. }
  46564. const markInfo = {
  46565. Marked: false,
  46566. UserProperties: false,
  46567. Suspects: false
  46568. };
  46569. for (const key in markInfo) {
  46570. const value = obj.get(key);
  46571. if (typeof value === "boolean") {
  46572. markInfo[key] = value;
  46573. }
  46574. }
  46575. return markInfo;
  46576. }
  46577. get structTreeRoot() {
  46578. let structTree = null;
  46579. try {
  46580. structTree = this._readStructTreeRoot();
  46581. } catch (ex) {
  46582. if (ex instanceof _core_utils.MissingDataException) {
  46583. throw ex;
  46584. }
  46585. (0, _util.warn)("Unable read to structTreeRoot info.");
  46586. }
  46587. return (0, _util.shadow)(this, "structTreeRoot", structTree);
  46588. }
  46589. _readStructTreeRoot() {
  46590. const obj = this._catDict.get("StructTreeRoot");
  46591. if (!(obj instanceof _primitives.Dict)) {
  46592. return null;
  46593. }
  46594. const root = new _struct_tree.StructTreeRoot(obj);
  46595. root.init();
  46596. return root;
  46597. }
  46598. get toplevelPagesDict() {
  46599. const pagesObj = this._catDict.get("Pages");
  46600. if (!(pagesObj instanceof _primitives.Dict)) {
  46601. throw new _util.FormatError("Invalid top-level pages dictionary.");
  46602. }
  46603. return (0, _util.shadow)(this, "toplevelPagesDict", pagesObj);
  46604. }
  46605. get documentOutline() {
  46606. let obj = null;
  46607. try {
  46608. obj = this._readDocumentOutline();
  46609. } catch (ex) {
  46610. if (ex instanceof _core_utils.MissingDataException) {
  46611. throw ex;
  46612. }
  46613. (0, _util.warn)("Unable to read document outline.");
  46614. }
  46615. return (0, _util.shadow)(this, "documentOutline", obj);
  46616. }
  46617. _readDocumentOutline() {
  46618. let obj = this._catDict.get("Outlines");
  46619. if (!(obj instanceof _primitives.Dict)) {
  46620. return null;
  46621. }
  46622. obj = obj.getRaw("First");
  46623. if (!(obj instanceof _primitives.Ref)) {
  46624. return null;
  46625. }
  46626. const root = {
  46627. items: []
  46628. };
  46629. const queue = [{
  46630. obj,
  46631. parent: root
  46632. }];
  46633. const processed = new _primitives.RefSet();
  46634. processed.put(obj);
  46635. const xref = this.xref,
  46636. blackColor = new Uint8ClampedArray(3);
  46637. while (queue.length > 0) {
  46638. const i = queue.shift();
  46639. const outlineDict = xref.fetchIfRef(i.obj);
  46640. if (outlineDict === null) {
  46641. continue;
  46642. }
  46643. if (!outlineDict.has("Title")) {
  46644. throw new _util.FormatError("Invalid outline item encountered.");
  46645. }
  46646. const data = {
  46647. url: null,
  46648. dest: null
  46649. };
  46650. Catalog.parseDestDictionary({
  46651. destDict: outlineDict,
  46652. resultObj: data,
  46653. docBaseUrl: this.pdfManager.docBaseUrl
  46654. });
  46655. const title = outlineDict.get("Title");
  46656. const flags = outlineDict.get("F") || 0;
  46657. const color = outlineDict.getArray("C");
  46658. const count = outlineDict.get("Count");
  46659. let rgbColor = blackColor;
  46660. if (Array.isArray(color) && color.length === 3 && (color[0] !== 0 || color[1] !== 0 || color[2] !== 0)) {
  46661. rgbColor = _colorspace.ColorSpace.singletons.rgb.getRgb(color, 0);
  46662. }
  46663. const outlineItem = {
  46664. dest: data.dest,
  46665. url: data.url,
  46666. unsafeUrl: data.unsafeUrl,
  46667. newWindow: data.newWindow,
  46668. title: (0, _util.stringToPDFString)(title),
  46669. color: rgbColor,
  46670. count: Number.isInteger(count) ? count : undefined,
  46671. bold: !!(flags & 2),
  46672. italic: !!(flags & 1),
  46673. items: []
  46674. };
  46675. i.parent.items.push(outlineItem);
  46676. obj = outlineDict.getRaw("First");
  46677. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  46678. queue.push({
  46679. obj,
  46680. parent: outlineItem
  46681. });
  46682. processed.put(obj);
  46683. }
  46684. obj = outlineDict.getRaw("Next");
  46685. if (obj instanceof _primitives.Ref && !processed.has(obj)) {
  46686. queue.push({
  46687. obj,
  46688. parent: i.parent
  46689. });
  46690. processed.put(obj);
  46691. }
  46692. }
  46693. return root.items.length > 0 ? root.items : null;
  46694. }
  46695. get permissions() {
  46696. let permissions = null;
  46697. try {
  46698. permissions = this._readPermissions();
  46699. } catch (ex) {
  46700. if (ex instanceof _core_utils.MissingDataException) {
  46701. throw ex;
  46702. }
  46703. (0, _util.warn)("Unable to read permissions.");
  46704. }
  46705. return (0, _util.shadow)(this, "permissions", permissions);
  46706. }
  46707. _readPermissions() {
  46708. const encrypt = this.xref.trailer.get("Encrypt");
  46709. if (!(encrypt instanceof _primitives.Dict)) {
  46710. return null;
  46711. }
  46712. let flags = encrypt.get("P");
  46713. if (typeof flags !== "number") {
  46714. return null;
  46715. }
  46716. flags += 2 ** 32;
  46717. const permissions = [];
  46718. for (const key in _util.PermissionFlag) {
  46719. const value = _util.PermissionFlag[key];
  46720. if (flags & value) {
  46721. permissions.push(value);
  46722. }
  46723. }
  46724. return permissions;
  46725. }
  46726. get optionalContentConfig() {
  46727. let config = null;
  46728. try {
  46729. const properties = this._catDict.get("OCProperties");
  46730. if (!properties) {
  46731. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46732. }
  46733. const defaultConfig = properties.get("D");
  46734. if (!defaultConfig) {
  46735. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46736. }
  46737. const groupsData = properties.get("OCGs");
  46738. if (!Array.isArray(groupsData)) {
  46739. return (0, _util.shadow)(this, "optionalContentConfig", null);
  46740. }
  46741. const groups = [];
  46742. const groupRefs = [];
  46743. for (const groupRef of groupsData) {
  46744. if (!(groupRef instanceof _primitives.Ref)) {
  46745. continue;
  46746. }
  46747. groupRefs.push(groupRef);
  46748. const group = this.xref.fetchIfRef(groupRef);
  46749. groups.push({
  46750. id: groupRef.toString(),
  46751. name: typeof group.get("Name") === "string" ? (0, _util.stringToPDFString)(group.get("Name")) : null,
  46752. intent: typeof group.get("Intent") === "string" ? (0, _util.stringToPDFString)(group.get("Intent")) : null
  46753. });
  46754. }
  46755. config = this._readOptionalContentConfig(defaultConfig, groupRefs);
  46756. config.groups = groups;
  46757. } catch (ex) {
  46758. if (ex instanceof _core_utils.MissingDataException) {
  46759. throw ex;
  46760. }
  46761. (0, _util.warn)(`Unable to read optional content config: ${ex}`);
  46762. }
  46763. return (0, _util.shadow)(this, "optionalContentConfig", config);
  46764. }
  46765. _readOptionalContentConfig(config, contentGroupRefs) {
  46766. function parseOnOff(refs) {
  46767. const onParsed = [];
  46768. if (Array.isArray(refs)) {
  46769. for (const value of refs) {
  46770. if (!(value instanceof _primitives.Ref)) {
  46771. continue;
  46772. }
  46773. if (contentGroupRefs.includes(value)) {
  46774. onParsed.push(value.toString());
  46775. }
  46776. }
  46777. }
  46778. return onParsed;
  46779. }
  46780. function parseOrder(refs, nestedLevels = 0) {
  46781. if (!Array.isArray(refs)) {
  46782. return null;
  46783. }
  46784. const order = [];
  46785. for (const value of refs) {
  46786. if (value instanceof _primitives.Ref && contentGroupRefs.includes(value)) {
  46787. parsedOrderRefs.put(value);
  46788. order.push(value.toString());
  46789. continue;
  46790. }
  46791. const nestedOrder = parseNestedOrder(value, nestedLevels);
  46792. if (nestedOrder) {
  46793. order.push(nestedOrder);
  46794. }
  46795. }
  46796. if (nestedLevels > 0) {
  46797. return order;
  46798. }
  46799. const hiddenGroups = [];
  46800. for (const groupRef of contentGroupRefs) {
  46801. if (parsedOrderRefs.has(groupRef)) {
  46802. continue;
  46803. }
  46804. hiddenGroups.push(groupRef.toString());
  46805. }
  46806. if (hiddenGroups.length) {
  46807. order.push({
  46808. name: null,
  46809. order: hiddenGroups
  46810. });
  46811. }
  46812. return order;
  46813. }
  46814. function parseNestedOrder(ref, nestedLevels) {
  46815. if (++nestedLevels > MAX_NESTED_LEVELS) {
  46816. (0, _util.warn)("parseNestedOrder - reached MAX_NESTED_LEVELS.");
  46817. return null;
  46818. }
  46819. const value = xref.fetchIfRef(ref);
  46820. if (!Array.isArray(value)) {
  46821. return null;
  46822. }
  46823. const nestedName = xref.fetchIfRef(value[0]);
  46824. if (typeof nestedName !== "string") {
  46825. return null;
  46826. }
  46827. const nestedOrder = parseOrder(value.slice(1), nestedLevels);
  46828. if (!nestedOrder || !nestedOrder.length) {
  46829. return null;
  46830. }
  46831. return {
  46832. name: (0, _util.stringToPDFString)(nestedName),
  46833. order: nestedOrder
  46834. };
  46835. }
  46836. const xref = this.xref,
  46837. parsedOrderRefs = new _primitives.RefSet(),
  46838. MAX_NESTED_LEVELS = 10;
  46839. return {
  46840. name: typeof config.get("Name") === "string" ? (0, _util.stringToPDFString)(config.get("Name")) : null,
  46841. creator: typeof config.get("Creator") === "string" ? (0, _util.stringToPDFString)(config.get("Creator")) : null,
  46842. baseState: config.get("BaseState") instanceof _primitives.Name ? config.get("BaseState").name : null,
  46843. on: parseOnOff(config.get("ON")),
  46844. off: parseOnOff(config.get("OFF")),
  46845. order: parseOrder(config.get("Order")),
  46846. groups: null
  46847. };
  46848. }
  46849. setActualNumPages(num = null) {
  46850. this._actualNumPages = num;
  46851. }
  46852. get hasActualNumPages() {
  46853. return this._actualNumPages !== null;
  46854. }
  46855. get _pagesCount() {
  46856. const obj = this.toplevelPagesDict.get("Count");
  46857. if (!Number.isInteger(obj)) {
  46858. throw new _util.FormatError("Page count in top-level pages dictionary is not an integer.");
  46859. }
  46860. return (0, _util.shadow)(this, "_pagesCount", obj);
  46861. }
  46862. get numPages() {
  46863. return this.hasActualNumPages ? this._actualNumPages : this._pagesCount;
  46864. }
  46865. get destinations() {
  46866. const obj = this._readDests(),
  46867. dests = Object.create(null);
  46868. if (obj instanceof _name_number_tree.NameTree) {
  46869. for (const [key, value] of obj.getAll()) {
  46870. const dest = fetchDestination(value);
  46871. if (dest) {
  46872. dests[(0, _util.stringToPDFString)(key)] = dest;
  46873. }
  46874. }
  46875. } else if (obj instanceof _primitives.Dict) {
  46876. obj.forEach(function (key, value) {
  46877. const dest = fetchDestination(value);
  46878. if (dest) {
  46879. dests[key] = dest;
  46880. }
  46881. });
  46882. }
  46883. return (0, _util.shadow)(this, "destinations", dests);
  46884. }
  46885. getDestination(id) {
  46886. const obj = this._readDests();
  46887. if (obj instanceof _name_number_tree.NameTree) {
  46888. const dest = fetchDestination(obj.get(id));
  46889. if (dest) {
  46890. return dest;
  46891. }
  46892. const allDest = this.destinations[id];
  46893. if (allDest) {
  46894. (0, _util.warn)(`Found "${id}" at an incorrect position in the NameTree.`);
  46895. return allDest;
  46896. }
  46897. } else if (obj instanceof _primitives.Dict) {
  46898. const dest = fetchDestination(obj.get(id));
  46899. if (dest) {
  46900. return dest;
  46901. }
  46902. }
  46903. return null;
  46904. }
  46905. _readDests() {
  46906. const obj = this._catDict.get("Names");
  46907. if (obj && obj.has("Dests")) {
  46908. return new _name_number_tree.NameTree(obj.getRaw("Dests"), this.xref);
  46909. } else if (this._catDict.has("Dests")) {
  46910. return this._catDict.get("Dests");
  46911. }
  46912. return undefined;
  46913. }
  46914. get pageLabels() {
  46915. let obj = null;
  46916. try {
  46917. obj = this._readPageLabels();
  46918. } catch (ex) {
  46919. if (ex instanceof _core_utils.MissingDataException) {
  46920. throw ex;
  46921. }
  46922. (0, _util.warn)("Unable to read page labels.");
  46923. }
  46924. return (0, _util.shadow)(this, "pageLabels", obj);
  46925. }
  46926. _readPageLabels() {
  46927. const obj = this._catDict.getRaw("PageLabels");
  46928. if (!obj) {
  46929. return null;
  46930. }
  46931. const pageLabels = new Array(this.numPages);
  46932. let style = null,
  46933. prefix = "";
  46934. const numberTree = new _name_number_tree.NumberTree(obj, this.xref);
  46935. const nums = numberTree.getAll();
  46936. let currentLabel = "",
  46937. currentIndex = 1;
  46938. for (let i = 0, ii = this.numPages; i < ii; i++) {
  46939. const labelDict = nums.get(i);
  46940. if (labelDict !== undefined) {
  46941. if (!(labelDict instanceof _primitives.Dict)) {
  46942. throw new _util.FormatError("PageLabel is not a dictionary.");
  46943. }
  46944. if (labelDict.has("Type") && !(0, _primitives.isName)(labelDict.get("Type"), "PageLabel")) {
  46945. throw new _util.FormatError("Invalid type in PageLabel dictionary.");
  46946. }
  46947. if (labelDict.has("S")) {
  46948. const s = labelDict.get("S");
  46949. if (!(s instanceof _primitives.Name)) {
  46950. throw new _util.FormatError("Invalid style in PageLabel dictionary.");
  46951. }
  46952. style = s.name;
  46953. } else {
  46954. style = null;
  46955. }
  46956. if (labelDict.has("P")) {
  46957. const p = labelDict.get("P");
  46958. if (typeof p !== "string") {
  46959. throw new _util.FormatError("Invalid prefix in PageLabel dictionary.");
  46960. }
  46961. prefix = (0, _util.stringToPDFString)(p);
  46962. } else {
  46963. prefix = "";
  46964. }
  46965. if (labelDict.has("St")) {
  46966. const st = labelDict.get("St");
  46967. if (!(Number.isInteger(st) && st >= 1)) {
  46968. throw new _util.FormatError("Invalid start in PageLabel dictionary.");
  46969. }
  46970. currentIndex = st;
  46971. } else {
  46972. currentIndex = 1;
  46973. }
  46974. }
  46975. switch (style) {
  46976. case "D":
  46977. currentLabel = currentIndex;
  46978. break;
  46979. case "R":
  46980. case "r":
  46981. currentLabel = (0, _core_utils.toRomanNumerals)(currentIndex, style === "r");
  46982. break;
  46983. case "A":
  46984. case "a":
  46985. const LIMIT = 26;
  46986. const A_UPPER_CASE = 0x41,
  46987. A_LOWER_CASE = 0x61;
  46988. const baseCharCode = style === "a" ? A_LOWER_CASE : A_UPPER_CASE;
  46989. const letterIndex = currentIndex - 1;
  46990. const character = String.fromCharCode(baseCharCode + letterIndex % LIMIT);
  46991. currentLabel = character.repeat(Math.floor(letterIndex / LIMIT) + 1);
  46992. break;
  46993. default:
  46994. if (style) {
  46995. throw new _util.FormatError(`Invalid style "${style}" in PageLabel dictionary.`);
  46996. }
  46997. currentLabel = "";
  46998. }
  46999. pageLabels[i] = prefix + currentLabel;
  47000. currentIndex++;
  47001. }
  47002. return pageLabels;
  47003. }
  47004. get pageLayout() {
  47005. const obj = this._catDict.get("PageLayout");
  47006. let pageLayout = "";
  47007. if (obj instanceof _primitives.Name) {
  47008. switch (obj.name) {
  47009. case "SinglePage":
  47010. case "OneColumn":
  47011. case "TwoColumnLeft":
  47012. case "TwoColumnRight":
  47013. case "TwoPageLeft":
  47014. case "TwoPageRight":
  47015. pageLayout = obj.name;
  47016. }
  47017. }
  47018. return (0, _util.shadow)(this, "pageLayout", pageLayout);
  47019. }
  47020. get pageMode() {
  47021. const obj = this._catDict.get("PageMode");
  47022. let pageMode = "UseNone";
  47023. if (obj instanceof _primitives.Name) {
  47024. switch (obj.name) {
  47025. case "UseNone":
  47026. case "UseOutlines":
  47027. case "UseThumbs":
  47028. case "FullScreen":
  47029. case "UseOC":
  47030. case "UseAttachments":
  47031. pageMode = obj.name;
  47032. }
  47033. }
  47034. return (0, _util.shadow)(this, "pageMode", pageMode);
  47035. }
  47036. get viewerPreferences() {
  47037. const obj = this._catDict.get("ViewerPreferences");
  47038. if (!(obj instanceof _primitives.Dict)) {
  47039. return (0, _util.shadow)(this, "viewerPreferences", null);
  47040. }
  47041. let prefs = null;
  47042. for (const key of obj.getKeys()) {
  47043. const value = obj.get(key);
  47044. let prefValue;
  47045. switch (key) {
  47046. case "HideToolbar":
  47047. case "HideMenubar":
  47048. case "HideWindowUI":
  47049. case "FitWindow":
  47050. case "CenterWindow":
  47051. case "DisplayDocTitle":
  47052. case "PickTrayByPDFSize":
  47053. if (typeof value === "boolean") {
  47054. prefValue = value;
  47055. }
  47056. break;
  47057. case "NonFullScreenPageMode":
  47058. if (value instanceof _primitives.Name) {
  47059. switch (value.name) {
  47060. case "UseNone":
  47061. case "UseOutlines":
  47062. case "UseThumbs":
  47063. case "UseOC":
  47064. prefValue = value.name;
  47065. break;
  47066. default:
  47067. prefValue = "UseNone";
  47068. }
  47069. }
  47070. break;
  47071. case "Direction":
  47072. if (value instanceof _primitives.Name) {
  47073. switch (value.name) {
  47074. case "L2R":
  47075. case "R2L":
  47076. prefValue = value.name;
  47077. break;
  47078. default:
  47079. prefValue = "L2R";
  47080. }
  47081. }
  47082. break;
  47083. case "ViewArea":
  47084. case "ViewClip":
  47085. case "PrintArea":
  47086. case "PrintClip":
  47087. if (value instanceof _primitives.Name) {
  47088. switch (value.name) {
  47089. case "MediaBox":
  47090. case "CropBox":
  47091. case "BleedBox":
  47092. case "TrimBox":
  47093. case "ArtBox":
  47094. prefValue = value.name;
  47095. break;
  47096. default:
  47097. prefValue = "CropBox";
  47098. }
  47099. }
  47100. break;
  47101. case "PrintScaling":
  47102. if (value instanceof _primitives.Name) {
  47103. switch (value.name) {
  47104. case "None":
  47105. case "AppDefault":
  47106. prefValue = value.name;
  47107. break;
  47108. default:
  47109. prefValue = "AppDefault";
  47110. }
  47111. }
  47112. break;
  47113. case "Duplex":
  47114. if (value instanceof _primitives.Name) {
  47115. switch (value.name) {
  47116. case "Simplex":
  47117. case "DuplexFlipShortEdge":
  47118. case "DuplexFlipLongEdge":
  47119. prefValue = value.name;
  47120. break;
  47121. default:
  47122. prefValue = "None";
  47123. }
  47124. }
  47125. break;
  47126. case "PrintPageRange":
  47127. if (Array.isArray(value) && value.length % 2 === 0) {
  47128. const isValid = value.every((page, i, arr) => {
  47129. return Number.isInteger(page) && page > 0 && (i === 0 || page >= arr[i - 1]) && page <= this.numPages;
  47130. });
  47131. if (isValid) {
  47132. prefValue = value;
  47133. }
  47134. }
  47135. break;
  47136. case "NumCopies":
  47137. if (Number.isInteger(value) && value > 0) {
  47138. prefValue = value;
  47139. }
  47140. break;
  47141. default:
  47142. (0, _util.warn)(`Ignoring non-standard key in ViewerPreferences: ${key}.`);
  47143. continue;
  47144. }
  47145. if (prefValue === undefined) {
  47146. (0, _util.warn)(`Bad value, for key "${key}", in ViewerPreferences: ${value}.`);
  47147. continue;
  47148. }
  47149. if (!prefs) {
  47150. prefs = Object.create(null);
  47151. }
  47152. prefs[key] = prefValue;
  47153. }
  47154. return (0, _util.shadow)(this, "viewerPreferences", prefs);
  47155. }
  47156. get openAction() {
  47157. const obj = this._catDict.get("OpenAction");
  47158. const openAction = Object.create(null);
  47159. if (obj instanceof _primitives.Dict) {
  47160. const destDict = new _primitives.Dict(this.xref);
  47161. destDict.set("A", obj);
  47162. const resultObj = {
  47163. url: null,
  47164. dest: null,
  47165. action: null
  47166. };
  47167. Catalog.parseDestDictionary({
  47168. destDict,
  47169. resultObj
  47170. });
  47171. if (Array.isArray(resultObj.dest)) {
  47172. openAction.dest = resultObj.dest;
  47173. } else if (resultObj.action) {
  47174. openAction.action = resultObj.action;
  47175. }
  47176. } else if (Array.isArray(obj)) {
  47177. openAction.dest = obj;
  47178. }
  47179. return (0, _util.shadow)(this, "openAction", (0, _util.objectSize)(openAction) > 0 ? openAction : null);
  47180. }
  47181. get attachments() {
  47182. const obj = this._catDict.get("Names");
  47183. let attachments = null;
  47184. if (obj instanceof _primitives.Dict && obj.has("EmbeddedFiles")) {
  47185. const nameTree = new _name_number_tree.NameTree(obj.getRaw("EmbeddedFiles"), this.xref);
  47186. for (const [key, value] of nameTree.getAll()) {
  47187. const fs = new _file_spec.FileSpec(value, this.xref);
  47188. if (!attachments) {
  47189. attachments = Object.create(null);
  47190. }
  47191. attachments[(0, _util.stringToPDFString)(key)] = fs.serializable;
  47192. }
  47193. }
  47194. return (0, _util.shadow)(this, "attachments", attachments);
  47195. }
  47196. get xfaImages() {
  47197. const obj = this._catDict.get("Names");
  47198. let xfaImages = null;
  47199. if (obj instanceof _primitives.Dict && obj.has("XFAImages")) {
  47200. const nameTree = new _name_number_tree.NameTree(obj.getRaw("XFAImages"), this.xref);
  47201. for (const [key, value] of nameTree.getAll()) {
  47202. if (!xfaImages) {
  47203. xfaImages = new _primitives.Dict(this.xref);
  47204. }
  47205. xfaImages.set((0, _util.stringToPDFString)(key), value);
  47206. }
  47207. }
  47208. return (0, _util.shadow)(this, "xfaImages", xfaImages);
  47209. }
  47210. _collectJavaScript() {
  47211. const obj = this._catDict.get("Names");
  47212. let javaScript = null;
  47213. function appendIfJavaScriptDict(name, jsDict) {
  47214. if (!(jsDict instanceof _primitives.Dict)) {
  47215. return;
  47216. }
  47217. if (!(0, _primitives.isName)(jsDict.get("S"), "JavaScript")) {
  47218. return;
  47219. }
  47220. let js = jsDict.get("JS");
  47221. if (js instanceof _base_stream.BaseStream) {
  47222. js = js.getString();
  47223. } else if (typeof js !== "string") {
  47224. return;
  47225. }
  47226. if (javaScript === null) {
  47227. javaScript = new Map();
  47228. }
  47229. javaScript.set(name, (0, _util.stringToPDFString)(js));
  47230. }
  47231. if (obj instanceof _primitives.Dict && obj.has("JavaScript")) {
  47232. const nameTree = new _name_number_tree.NameTree(obj.getRaw("JavaScript"), this.xref);
  47233. for (const [key, value] of nameTree.getAll()) {
  47234. appendIfJavaScriptDict((0, _util.stringToPDFString)(key), value);
  47235. }
  47236. }
  47237. const openAction = this._catDict.get("OpenAction");
  47238. if (openAction) {
  47239. appendIfJavaScriptDict("OpenAction", openAction);
  47240. }
  47241. return javaScript;
  47242. }
  47243. get javaScript() {
  47244. const javaScript = this._collectJavaScript();
  47245. return (0, _util.shadow)(this, "javaScript", javaScript ? [...javaScript.values()] : null);
  47246. }
  47247. get jsActions() {
  47248. const javaScript = this._collectJavaScript();
  47249. let actions = (0, _core_utils.collectActions)(this.xref, this._catDict, _util.DocumentActionEventType);
  47250. if (javaScript) {
  47251. if (!actions) {
  47252. actions = Object.create(null);
  47253. }
  47254. for (const [key, val] of javaScript) {
  47255. if (key in actions) {
  47256. actions[key].push(val);
  47257. } else {
  47258. actions[key] = [val];
  47259. }
  47260. }
  47261. }
  47262. return (0, _util.shadow)(this, "jsActions", actions);
  47263. }
  47264. async fontFallback(id, handler) {
  47265. const translatedFonts = await Promise.all(this.fontCache);
  47266. for (const translatedFont of translatedFonts) {
  47267. if (translatedFont.loadedName === id) {
  47268. translatedFont.fallback(handler);
  47269. return;
  47270. }
  47271. }
  47272. }
  47273. async cleanup(manuallyTriggered = false) {
  47274. (0, _cleanup_helper.clearGlobalCaches)();
  47275. this.globalImageCache.clear(manuallyTriggered);
  47276. this.pageKidsCountCache.clear();
  47277. this.pageIndexCache.clear();
  47278. this.nonBlendModesSet.clear();
  47279. const translatedFonts = await Promise.all(this.fontCache);
  47280. for (const {
  47281. dict
  47282. } of translatedFonts) {
  47283. delete dict.cacheKey;
  47284. }
  47285. this.fontCache.clear();
  47286. this.builtInCMapCache.clear();
  47287. this.standardFontDataCache.clear();
  47288. }
  47289. async getPageDict(pageIndex) {
  47290. const nodesToVisit = [this.toplevelPagesDict];
  47291. const visitedNodes = new _primitives.RefSet();
  47292. const pagesRef = this._catDict.getRaw("Pages");
  47293. if (pagesRef instanceof _primitives.Ref) {
  47294. visitedNodes.put(pagesRef);
  47295. }
  47296. const xref = this.xref,
  47297. pageKidsCountCache = this.pageKidsCountCache,
  47298. pageIndexCache = this.pageIndexCache;
  47299. let currentPageIndex = 0;
  47300. while (nodesToVisit.length) {
  47301. const currentNode = nodesToVisit.pop();
  47302. if (currentNode instanceof _primitives.Ref) {
  47303. const count = pageKidsCountCache.get(currentNode);
  47304. if (count >= 0 && currentPageIndex + count <= pageIndex) {
  47305. currentPageIndex += count;
  47306. continue;
  47307. }
  47308. if (visitedNodes.has(currentNode)) {
  47309. throw new _util.FormatError("Pages tree contains circular reference.");
  47310. }
  47311. visitedNodes.put(currentNode);
  47312. const obj = await xref.fetchAsync(currentNode);
  47313. if (obj instanceof _primitives.Dict) {
  47314. let type = obj.getRaw("Type");
  47315. if (type instanceof _primitives.Ref) {
  47316. type = await xref.fetchAsync(type);
  47317. }
  47318. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  47319. if (!pageKidsCountCache.has(currentNode)) {
  47320. pageKidsCountCache.put(currentNode, 1);
  47321. }
  47322. if (!pageIndexCache.has(currentNode)) {
  47323. pageIndexCache.put(currentNode, currentPageIndex);
  47324. }
  47325. if (currentPageIndex === pageIndex) {
  47326. return [obj, currentNode];
  47327. }
  47328. currentPageIndex++;
  47329. continue;
  47330. }
  47331. }
  47332. nodesToVisit.push(obj);
  47333. continue;
  47334. }
  47335. if (!(currentNode instanceof _primitives.Dict)) {
  47336. throw new _util.FormatError("Page dictionary kid reference points to wrong type of object.");
  47337. }
  47338. const {
  47339. objId
  47340. } = currentNode;
  47341. let count = currentNode.getRaw("Count");
  47342. if (count instanceof _primitives.Ref) {
  47343. count = await xref.fetchAsync(count);
  47344. }
  47345. if (Number.isInteger(count) && count >= 0) {
  47346. if (objId && !pageKidsCountCache.has(objId)) {
  47347. pageKidsCountCache.put(objId, count);
  47348. }
  47349. if (currentPageIndex + count <= pageIndex) {
  47350. currentPageIndex += count;
  47351. continue;
  47352. }
  47353. }
  47354. let kids = currentNode.getRaw("Kids");
  47355. if (kids instanceof _primitives.Ref) {
  47356. kids = await xref.fetchAsync(kids);
  47357. }
  47358. if (!Array.isArray(kids)) {
  47359. let type = currentNode.getRaw("Type");
  47360. if (type instanceof _primitives.Ref) {
  47361. type = await xref.fetchAsync(type);
  47362. }
  47363. if ((0, _primitives.isName)(type, "Page") || !currentNode.has("Kids")) {
  47364. if (currentPageIndex === pageIndex) {
  47365. return [currentNode, null];
  47366. }
  47367. currentPageIndex++;
  47368. continue;
  47369. }
  47370. throw new _util.FormatError("Page dictionary kids object is not an array.");
  47371. }
  47372. for (let last = kids.length - 1; last >= 0; last--) {
  47373. nodesToVisit.push(kids[last]);
  47374. }
  47375. }
  47376. throw new Error(`Page index ${pageIndex} not found.`);
  47377. }
  47378. async getAllPageDicts(recoveryMode = false) {
  47379. const queue = [{
  47380. currentNode: this.toplevelPagesDict,
  47381. posInKids: 0
  47382. }];
  47383. const visitedNodes = new _primitives.RefSet();
  47384. const pagesRef = this._catDict.getRaw("Pages");
  47385. if (pagesRef instanceof _primitives.Ref) {
  47386. visitedNodes.put(pagesRef);
  47387. }
  47388. const map = new Map(),
  47389. xref = this.xref,
  47390. pageIndexCache = this.pageIndexCache;
  47391. let pageIndex = 0;
  47392. function addPageDict(pageDict, pageRef) {
  47393. if (pageRef && !pageIndexCache.has(pageRef)) {
  47394. pageIndexCache.put(pageRef, pageIndex);
  47395. }
  47396. map.set(pageIndex++, [pageDict, pageRef]);
  47397. }
  47398. function addPageError(error) {
  47399. if (error instanceof _core_utils.XRefEntryException && !recoveryMode) {
  47400. throw error;
  47401. }
  47402. map.set(pageIndex++, [error, null]);
  47403. }
  47404. while (queue.length > 0) {
  47405. const queueItem = queue[queue.length - 1];
  47406. const {
  47407. currentNode,
  47408. posInKids
  47409. } = queueItem;
  47410. let kids = currentNode.getRaw("Kids");
  47411. if (kids instanceof _primitives.Ref) {
  47412. try {
  47413. kids = await xref.fetchAsync(kids);
  47414. } catch (ex) {
  47415. addPageError(ex);
  47416. break;
  47417. }
  47418. }
  47419. if (!Array.isArray(kids)) {
  47420. addPageError(new _util.FormatError("Page dictionary kids object is not an array."));
  47421. break;
  47422. }
  47423. if (posInKids >= kids.length) {
  47424. queue.pop();
  47425. continue;
  47426. }
  47427. const kidObj = kids[posInKids];
  47428. let obj;
  47429. if (kidObj instanceof _primitives.Ref) {
  47430. if (visitedNodes.has(kidObj)) {
  47431. addPageError(new _util.FormatError("Pages tree contains circular reference."));
  47432. break;
  47433. }
  47434. visitedNodes.put(kidObj);
  47435. try {
  47436. obj = await xref.fetchAsync(kidObj);
  47437. } catch (ex) {
  47438. addPageError(ex);
  47439. break;
  47440. }
  47441. } else {
  47442. obj = kidObj;
  47443. }
  47444. if (!(obj instanceof _primitives.Dict)) {
  47445. addPageError(new _util.FormatError("Page dictionary kid reference points to wrong type of object."));
  47446. break;
  47447. }
  47448. let type = obj.getRaw("Type");
  47449. if (type instanceof _primitives.Ref) {
  47450. try {
  47451. type = await xref.fetchAsync(type);
  47452. } catch (ex) {
  47453. addPageError(ex);
  47454. break;
  47455. }
  47456. }
  47457. if ((0, _primitives.isName)(type, "Page") || !obj.has("Kids")) {
  47458. addPageDict(obj, kidObj instanceof _primitives.Ref ? kidObj : null);
  47459. } else {
  47460. queue.push({
  47461. currentNode: obj,
  47462. posInKids: 0
  47463. });
  47464. }
  47465. queueItem.posInKids++;
  47466. }
  47467. return map;
  47468. }
  47469. getPageIndex(pageRef) {
  47470. const cachedPageIndex = this.pageIndexCache.get(pageRef);
  47471. if (cachedPageIndex !== undefined) {
  47472. return Promise.resolve(cachedPageIndex);
  47473. }
  47474. const xref = this.xref;
  47475. function pagesBeforeRef(kidRef) {
  47476. let total = 0,
  47477. parentRef;
  47478. return xref.fetchAsync(kidRef).then(function (node) {
  47479. if ((0, _primitives.isRefsEqual)(kidRef, pageRef) && !(0, _primitives.isDict)(node, "Page") && !(node instanceof _primitives.Dict && !node.has("Type") && node.has("Contents"))) {
  47480. throw new _util.FormatError("The reference does not point to a /Page dictionary.");
  47481. }
  47482. if (!node) {
  47483. return null;
  47484. }
  47485. if (!(node instanceof _primitives.Dict)) {
  47486. throw new _util.FormatError("Node must be a dictionary.");
  47487. }
  47488. parentRef = node.getRaw("Parent");
  47489. return node.getAsync("Parent");
  47490. }).then(function (parent) {
  47491. if (!parent) {
  47492. return null;
  47493. }
  47494. if (!(parent instanceof _primitives.Dict)) {
  47495. throw new _util.FormatError("Parent must be a dictionary.");
  47496. }
  47497. return parent.getAsync("Kids");
  47498. }).then(function (kids) {
  47499. if (!kids) {
  47500. return null;
  47501. }
  47502. const kidPromises = [];
  47503. let found = false;
  47504. for (let i = 0, ii = kids.length; i < ii; i++) {
  47505. const kid = kids[i];
  47506. if (!(kid instanceof _primitives.Ref)) {
  47507. throw new _util.FormatError("Kid must be a reference.");
  47508. }
  47509. if ((0, _primitives.isRefsEqual)(kid, kidRef)) {
  47510. found = true;
  47511. break;
  47512. }
  47513. kidPromises.push(xref.fetchAsync(kid).then(function (obj) {
  47514. if (!(obj instanceof _primitives.Dict)) {
  47515. throw new _util.FormatError("Kid node must be a dictionary.");
  47516. }
  47517. if (obj.has("Count")) {
  47518. total += obj.get("Count");
  47519. } else {
  47520. total++;
  47521. }
  47522. }));
  47523. }
  47524. if (!found) {
  47525. throw new _util.FormatError("Kid reference not found in parent's kids.");
  47526. }
  47527. return Promise.all(kidPromises).then(function () {
  47528. return [total, parentRef];
  47529. });
  47530. });
  47531. }
  47532. let total = 0;
  47533. const next = ref => pagesBeforeRef(ref).then(args => {
  47534. if (!args) {
  47535. this.pageIndexCache.put(pageRef, total);
  47536. return total;
  47537. }
  47538. const [count, parentRef] = args;
  47539. total += count;
  47540. return next(parentRef);
  47541. });
  47542. return next(pageRef);
  47543. }
  47544. get baseUrl() {
  47545. const uri = this._catDict.get("URI");
  47546. if (uri instanceof _primitives.Dict) {
  47547. const base = uri.get("Base");
  47548. if (typeof base === "string") {
  47549. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(base, null, {
  47550. tryConvertEncoding: true
  47551. });
  47552. if (absoluteUrl) {
  47553. return (0, _util.shadow)(this, "baseUrl", absoluteUrl.href);
  47554. }
  47555. }
  47556. }
  47557. return (0, _util.shadow)(this, "baseUrl", null);
  47558. }
  47559. static parseDestDictionary(params) {
  47560. const destDict = params.destDict;
  47561. if (!(destDict instanceof _primitives.Dict)) {
  47562. (0, _util.warn)("parseDestDictionary: `destDict` must be a dictionary.");
  47563. return;
  47564. }
  47565. const resultObj = params.resultObj;
  47566. if (typeof resultObj !== "object") {
  47567. (0, _util.warn)("parseDestDictionary: `resultObj` must be an object.");
  47568. return;
  47569. }
  47570. const docBaseUrl = params.docBaseUrl || null;
  47571. let action = destDict.get("A"),
  47572. url,
  47573. dest;
  47574. if (!(action instanceof _primitives.Dict)) {
  47575. if (destDict.has("Dest")) {
  47576. action = destDict.get("Dest");
  47577. } else {
  47578. action = destDict.get("AA");
  47579. if (action instanceof _primitives.Dict) {
  47580. if (action.has("D")) {
  47581. action = action.get("D");
  47582. } else if (action.has("U")) {
  47583. action = action.get("U");
  47584. }
  47585. }
  47586. }
  47587. }
  47588. if (action instanceof _primitives.Dict) {
  47589. const actionType = action.get("S");
  47590. if (!(actionType instanceof _primitives.Name)) {
  47591. (0, _util.warn)("parseDestDictionary: Invalid type in Action dictionary.");
  47592. return;
  47593. }
  47594. const actionName = actionType.name;
  47595. switch (actionName) {
  47596. case "ResetForm":
  47597. const flags = action.get("Flags");
  47598. const include = ((typeof flags === "number" ? flags : 0) & 1) === 0;
  47599. const fields = [];
  47600. const refs = [];
  47601. for (const obj of action.get("Fields") || []) {
  47602. if (obj instanceof _primitives.Ref) {
  47603. refs.push(obj.toString());
  47604. } else if (typeof obj === "string") {
  47605. fields.push((0, _util.stringToPDFString)(obj));
  47606. }
  47607. }
  47608. resultObj.resetForm = {
  47609. fields,
  47610. refs,
  47611. include
  47612. };
  47613. break;
  47614. case "URI":
  47615. url = action.get("URI");
  47616. if (url instanceof _primitives.Name) {
  47617. url = "/" + url.name;
  47618. }
  47619. break;
  47620. case "GoTo":
  47621. dest = action.get("D");
  47622. break;
  47623. case "Launch":
  47624. case "GoToR":
  47625. const urlDict = action.get("F");
  47626. if (urlDict instanceof _primitives.Dict) {
  47627. url = urlDict.get("F") || null;
  47628. } else if (typeof urlDict === "string") {
  47629. url = urlDict;
  47630. }
  47631. let remoteDest = action.get("D");
  47632. if (remoteDest) {
  47633. if (remoteDest instanceof _primitives.Name) {
  47634. remoteDest = remoteDest.name;
  47635. }
  47636. if (typeof url === "string") {
  47637. const baseUrl = url.split("#")[0];
  47638. if (typeof remoteDest === "string") {
  47639. url = baseUrl + "#" + remoteDest;
  47640. } else if (Array.isArray(remoteDest)) {
  47641. url = baseUrl + "#" + JSON.stringify(remoteDest);
  47642. }
  47643. }
  47644. }
  47645. const newWindow = action.get("NewWindow");
  47646. if (typeof newWindow === "boolean") {
  47647. resultObj.newWindow = newWindow;
  47648. }
  47649. break;
  47650. case "Named":
  47651. const namedAction = action.get("N");
  47652. if (namedAction instanceof _primitives.Name) {
  47653. resultObj.action = namedAction.name;
  47654. }
  47655. break;
  47656. case "JavaScript":
  47657. const jsAction = action.get("JS");
  47658. let js;
  47659. if (jsAction instanceof _base_stream.BaseStream) {
  47660. js = jsAction.getString();
  47661. } else if (typeof jsAction === "string") {
  47662. js = jsAction;
  47663. }
  47664. const jsURL = js && (0, _core_utils.recoverJsURL)((0, _util.stringToPDFString)(js));
  47665. if (jsURL) {
  47666. url = jsURL.url;
  47667. resultObj.newWindow = jsURL.newWindow;
  47668. break;
  47669. }
  47670. default:
  47671. if (actionName === "JavaScript" || actionName === "SubmitForm") {
  47672. break;
  47673. }
  47674. (0, _util.warn)(`parseDestDictionary - unsupported action: "${actionName}".`);
  47675. break;
  47676. }
  47677. } else if (destDict.has("Dest")) {
  47678. dest = destDict.get("Dest");
  47679. }
  47680. if (typeof url === "string") {
  47681. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(url, docBaseUrl, {
  47682. addDefaultProtocol: true,
  47683. tryConvertEncoding: true
  47684. });
  47685. if (absoluteUrl) {
  47686. resultObj.url = absoluteUrl.href;
  47687. }
  47688. resultObj.unsafeUrl = url;
  47689. }
  47690. if (dest) {
  47691. if (dest instanceof _primitives.Name) {
  47692. dest = dest.name;
  47693. }
  47694. if (typeof dest === "string") {
  47695. resultObj.dest = (0, _util.stringToPDFString)(dest);
  47696. } else if (Array.isArray(dest)) {
  47697. resultObj.dest = dest;
  47698. }
  47699. }
  47700. }
  47701. }
  47702. exports.Catalog = Catalog;
  47703. /***/ }),
  47704. /* 66 */
  47705. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47706. Object.defineProperty(exports, "__esModule", ({
  47707. value: true
  47708. }));
  47709. exports.NumberTree = exports.NameTree = void 0;
  47710. var _primitives = __w_pdfjs_require__(5);
  47711. var _util = __w_pdfjs_require__(2);
  47712. class NameOrNumberTree {
  47713. constructor(root, xref, type) {
  47714. if (this.constructor === NameOrNumberTree) {
  47715. (0, _util.unreachable)("Cannot initialize NameOrNumberTree.");
  47716. }
  47717. this.root = root;
  47718. this.xref = xref;
  47719. this._type = type;
  47720. }
  47721. getAll() {
  47722. const map = new Map();
  47723. if (!this.root) {
  47724. return map;
  47725. }
  47726. const xref = this.xref;
  47727. const processed = new _primitives.RefSet();
  47728. processed.put(this.root);
  47729. const queue = [this.root];
  47730. while (queue.length > 0) {
  47731. const obj = xref.fetchIfRef(queue.shift());
  47732. if (!(obj instanceof _primitives.Dict)) {
  47733. continue;
  47734. }
  47735. if (obj.has("Kids")) {
  47736. const kids = obj.get("Kids");
  47737. if (!Array.isArray(kids)) {
  47738. continue;
  47739. }
  47740. for (const kid of kids) {
  47741. if (processed.has(kid)) {
  47742. throw new _util.FormatError(`Duplicate entry in "${this._type}" tree.`);
  47743. }
  47744. queue.push(kid);
  47745. processed.put(kid);
  47746. }
  47747. continue;
  47748. }
  47749. const entries = obj.get(this._type);
  47750. if (!Array.isArray(entries)) {
  47751. continue;
  47752. }
  47753. for (let i = 0, ii = entries.length; i < ii; i += 2) {
  47754. map.set(xref.fetchIfRef(entries[i]), xref.fetchIfRef(entries[i + 1]));
  47755. }
  47756. }
  47757. return map;
  47758. }
  47759. get(key) {
  47760. if (!this.root) {
  47761. return null;
  47762. }
  47763. const xref = this.xref;
  47764. let kidsOrEntries = xref.fetchIfRef(this.root);
  47765. let loopCount = 0;
  47766. const MAX_LEVELS = 10;
  47767. while (kidsOrEntries.has("Kids")) {
  47768. if (++loopCount > MAX_LEVELS) {
  47769. (0, _util.warn)(`Search depth limit reached for "${this._type}" tree.`);
  47770. return null;
  47771. }
  47772. const kids = kidsOrEntries.get("Kids");
  47773. if (!Array.isArray(kids)) {
  47774. return null;
  47775. }
  47776. let l = 0,
  47777. r = kids.length - 1;
  47778. while (l <= r) {
  47779. const m = l + r >> 1;
  47780. const kid = xref.fetchIfRef(kids[m]);
  47781. const limits = kid.get("Limits");
  47782. if (key < xref.fetchIfRef(limits[0])) {
  47783. r = m - 1;
  47784. } else if (key > xref.fetchIfRef(limits[1])) {
  47785. l = m + 1;
  47786. } else {
  47787. kidsOrEntries = kid;
  47788. break;
  47789. }
  47790. }
  47791. if (l > r) {
  47792. return null;
  47793. }
  47794. }
  47795. const entries = kidsOrEntries.get(this._type);
  47796. if (Array.isArray(entries)) {
  47797. let l = 0,
  47798. r = entries.length - 2;
  47799. while (l <= r) {
  47800. const tmp = l + r >> 1,
  47801. m = tmp + (tmp & 1);
  47802. const currentKey = xref.fetchIfRef(entries[m]);
  47803. if (key < currentKey) {
  47804. r = m - 2;
  47805. } else if (key > currentKey) {
  47806. l = m + 2;
  47807. } else {
  47808. return xref.fetchIfRef(entries[m + 1]);
  47809. }
  47810. }
  47811. }
  47812. return null;
  47813. }
  47814. }
  47815. class NameTree extends NameOrNumberTree {
  47816. constructor(root, xref) {
  47817. super(root, xref, "Names");
  47818. }
  47819. }
  47820. exports.NameTree = NameTree;
  47821. class NumberTree extends NameOrNumberTree {
  47822. constructor(root, xref) {
  47823. super(root, xref, "Nums");
  47824. }
  47825. }
  47826. exports.NumberTree = NumberTree;
  47827. /***/ }),
  47828. /* 67 */
  47829. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47830. Object.defineProperty(exports, "__esModule", ({
  47831. value: true
  47832. }));
  47833. exports.clearGlobalCaches = clearGlobalCaches;
  47834. var _primitives = __w_pdfjs_require__(5);
  47835. var _unicode = __w_pdfjs_require__(21);
  47836. function clearGlobalCaches() {
  47837. (0, _primitives.clearPrimitiveCaches)();
  47838. (0, _unicode.clearUnicodeCaches)();
  47839. }
  47840. /***/ }),
  47841. /* 68 */
  47842. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47843. Object.defineProperty(exports, "__esModule", ({
  47844. value: true
  47845. }));
  47846. exports.FileSpec = void 0;
  47847. var _util = __w_pdfjs_require__(2);
  47848. var _base_stream = __w_pdfjs_require__(9);
  47849. var _primitives = __w_pdfjs_require__(5);
  47850. function pickPlatformItem(dict) {
  47851. if (dict.has("UF")) {
  47852. return dict.get("UF");
  47853. } else if (dict.has("F")) {
  47854. return dict.get("F");
  47855. } else if (dict.has("Unix")) {
  47856. return dict.get("Unix");
  47857. } else if (dict.has("Mac")) {
  47858. return dict.get("Mac");
  47859. } else if (dict.has("DOS")) {
  47860. return dict.get("DOS");
  47861. }
  47862. return null;
  47863. }
  47864. class FileSpec {
  47865. constructor(root, xref) {
  47866. if (!(root instanceof _primitives.Dict)) {
  47867. return;
  47868. }
  47869. this.xref = xref;
  47870. this.root = root;
  47871. if (root.has("FS")) {
  47872. this.fs = root.get("FS");
  47873. }
  47874. this.description = root.has("Desc") ? (0, _util.stringToPDFString)(root.get("Desc")) : "";
  47875. if (root.has("RF")) {
  47876. (0, _util.warn)("Related file specifications are not supported");
  47877. }
  47878. this.contentAvailable = true;
  47879. if (!root.has("EF")) {
  47880. this.contentAvailable = false;
  47881. (0, _util.warn)("Non-embedded file specifications are not supported");
  47882. }
  47883. }
  47884. get filename() {
  47885. if (!this._filename && this.root) {
  47886. const filename = pickPlatformItem(this.root) || "unnamed";
  47887. this._filename = (0, _util.stringToPDFString)(filename).replace(/\\\\/g, "\\").replace(/\\\//g, "/").replace(/\\/g, "/");
  47888. }
  47889. return this._filename;
  47890. }
  47891. get content() {
  47892. if (!this.contentAvailable) {
  47893. return null;
  47894. }
  47895. if (!this.contentRef && this.root) {
  47896. this.contentRef = pickPlatformItem(this.root.get("EF"));
  47897. }
  47898. let content = null;
  47899. if (this.contentRef) {
  47900. const fileObj = this.xref.fetchIfRef(this.contentRef);
  47901. if (fileObj instanceof _base_stream.BaseStream) {
  47902. content = fileObj.getBytes();
  47903. } else {
  47904. (0, _util.warn)("Embedded file specification points to non-existing/invalid content");
  47905. }
  47906. } else {
  47907. (0, _util.warn)("Embedded file specification does not have a content");
  47908. }
  47909. return content;
  47910. }
  47911. get serializable() {
  47912. return {
  47913. filename: this.filename,
  47914. content: this.content
  47915. };
  47916. }
  47917. }
  47918. exports.FileSpec = FileSpec;
  47919. /***/ }),
  47920. /* 69 */
  47921. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  47922. Object.defineProperty(exports, "__esModule", ({
  47923. value: true
  47924. }));
  47925. exports.MetadataParser = void 0;
  47926. var _xml_parser = __w_pdfjs_require__(70);
  47927. class MetadataParser {
  47928. constructor(data) {
  47929. data = this._repair(data);
  47930. const parser = new _xml_parser.SimpleXMLParser({
  47931. lowerCaseName: true
  47932. });
  47933. const xmlDocument = parser.parseFromString(data);
  47934. this._metadataMap = new Map();
  47935. this._data = data;
  47936. if (xmlDocument) {
  47937. this._parse(xmlDocument);
  47938. }
  47939. }
  47940. _repair(data) {
  47941. return data.replace(/^[^<]+/, "").replace(/>\\376\\377([^<]+)/g, function (all, codes) {
  47942. const bytes = codes.replace(/\\([0-3])([0-7])([0-7])/g, function (code, d1, d2, d3) {
  47943. return String.fromCharCode(d1 * 64 + d2 * 8 + d3 * 1);
  47944. }).replace(/&(amp|apos|gt|lt|quot);/g, function (str, name) {
  47945. switch (name) {
  47946. case "amp":
  47947. return "&";
  47948. case "apos":
  47949. return "'";
  47950. case "gt":
  47951. return ">";
  47952. case "lt":
  47953. return "<";
  47954. case "quot":
  47955. return '"';
  47956. }
  47957. throw new Error(`_repair: ${name} isn't defined.`);
  47958. });
  47959. const charBuf = [];
  47960. for (let i = 0, ii = bytes.length; i < ii; i += 2) {
  47961. const code = bytes.charCodeAt(i) * 256 + bytes.charCodeAt(i + 1);
  47962. if (code >= 32 && code < 127 && code !== 60 && code !== 62 && code !== 38) {
  47963. charBuf.push(String.fromCharCode(code));
  47964. } else {
  47965. charBuf.push("&#x" + (0x10000 + code).toString(16).substring(1) + ";");
  47966. }
  47967. }
  47968. return ">" + charBuf.join("");
  47969. });
  47970. }
  47971. _getSequence(entry) {
  47972. const name = entry.nodeName;
  47973. if (name !== "rdf:bag" && name !== "rdf:seq" && name !== "rdf:alt") {
  47974. return null;
  47975. }
  47976. return entry.childNodes.filter(node => node.nodeName === "rdf:li");
  47977. }
  47978. _parseArray(entry) {
  47979. if (!entry.hasChildNodes()) {
  47980. return;
  47981. }
  47982. const [seqNode] = entry.childNodes;
  47983. const sequence = this._getSequence(seqNode) || [];
  47984. this._metadataMap.set(entry.nodeName, sequence.map(node => node.textContent.trim()));
  47985. }
  47986. _parse(xmlDocument) {
  47987. let rdf = xmlDocument.documentElement;
  47988. if (rdf.nodeName !== "rdf:rdf") {
  47989. rdf = rdf.firstChild;
  47990. while (rdf && rdf.nodeName !== "rdf:rdf") {
  47991. rdf = rdf.nextSibling;
  47992. }
  47993. }
  47994. if (!rdf || rdf.nodeName !== "rdf:rdf" || !rdf.hasChildNodes()) {
  47995. return;
  47996. }
  47997. for (const desc of rdf.childNodes) {
  47998. if (desc.nodeName !== "rdf:description") {
  47999. continue;
  48000. }
  48001. for (const entry of desc.childNodes) {
  48002. const name = entry.nodeName;
  48003. switch (name) {
  48004. case "#text":
  48005. continue;
  48006. case "dc:creator":
  48007. case "dc:subject":
  48008. this._parseArray(entry);
  48009. continue;
  48010. }
  48011. this._metadataMap.set(name, entry.textContent.trim());
  48012. }
  48013. }
  48014. }
  48015. get serializable() {
  48016. return {
  48017. parsedData: this._metadataMap,
  48018. rawData: this._data
  48019. };
  48020. }
  48021. }
  48022. exports.MetadataParser = MetadataParser;
  48023. /***/ }),
  48024. /* 70 */
  48025. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48026. Object.defineProperty(exports, "__esModule", ({
  48027. value: true
  48028. }));
  48029. exports.XMLParserErrorCode = exports.XMLParserBase = exports.SimpleXMLParser = exports.SimpleDOMNode = void 0;
  48030. var _core_utils = __w_pdfjs_require__(8);
  48031. const XMLParserErrorCode = {
  48032. NoError: 0,
  48033. EndOfDocument: -1,
  48034. UnterminatedCdat: -2,
  48035. UnterminatedXmlDeclaration: -3,
  48036. UnterminatedDoctypeDeclaration: -4,
  48037. UnterminatedComment: -5,
  48038. MalformedElement: -6,
  48039. OutOfMemory: -7,
  48040. UnterminatedAttributeValue: -8,
  48041. UnterminatedElement: -9,
  48042. ElementNeverBegun: -10
  48043. };
  48044. exports.XMLParserErrorCode = XMLParserErrorCode;
  48045. function isWhitespace(s, index) {
  48046. const ch = s[index];
  48047. return ch === " " || ch === "\n" || ch === "\r" || ch === "\t";
  48048. }
  48049. function isWhitespaceString(s) {
  48050. for (let i = 0, ii = s.length; i < ii; i++) {
  48051. if (!isWhitespace(s, i)) {
  48052. return false;
  48053. }
  48054. }
  48055. return true;
  48056. }
  48057. class XMLParserBase {
  48058. _resolveEntities(s) {
  48059. return s.replace(/&([^;]+);/g, (all, entity) => {
  48060. if (entity.substring(0, 2) === "#x") {
  48061. return String.fromCodePoint(parseInt(entity.substring(2), 16));
  48062. } else if (entity.substring(0, 1) === "#") {
  48063. return String.fromCodePoint(parseInt(entity.substring(1), 10));
  48064. }
  48065. switch (entity) {
  48066. case "lt":
  48067. return "<";
  48068. case "gt":
  48069. return ">";
  48070. case "amp":
  48071. return "&";
  48072. case "quot":
  48073. return '"';
  48074. case "apos":
  48075. return "'";
  48076. }
  48077. return this.onResolveEntity(entity);
  48078. });
  48079. }
  48080. _parseContent(s, start) {
  48081. const attributes = [];
  48082. let pos = start;
  48083. function skipWs() {
  48084. while (pos < s.length && isWhitespace(s, pos)) {
  48085. ++pos;
  48086. }
  48087. }
  48088. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "/") {
  48089. ++pos;
  48090. }
  48091. const name = s.substring(start, pos);
  48092. skipWs();
  48093. while (pos < s.length && s[pos] !== ">" && s[pos] !== "/" && s[pos] !== "?") {
  48094. skipWs();
  48095. let attrName = "",
  48096. attrValue = "";
  48097. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== "=") {
  48098. attrName += s[pos];
  48099. ++pos;
  48100. }
  48101. skipWs();
  48102. if (s[pos] !== "=") {
  48103. return null;
  48104. }
  48105. ++pos;
  48106. skipWs();
  48107. const attrEndChar = s[pos];
  48108. if (attrEndChar !== '"' && attrEndChar !== "'") {
  48109. return null;
  48110. }
  48111. const attrEndIndex = s.indexOf(attrEndChar, ++pos);
  48112. if (attrEndIndex < 0) {
  48113. return null;
  48114. }
  48115. attrValue = s.substring(pos, attrEndIndex);
  48116. attributes.push({
  48117. name: attrName,
  48118. value: this._resolveEntities(attrValue)
  48119. });
  48120. pos = attrEndIndex + 1;
  48121. skipWs();
  48122. }
  48123. return {
  48124. name,
  48125. attributes,
  48126. parsed: pos - start
  48127. };
  48128. }
  48129. _parseProcessingInstruction(s, start) {
  48130. let pos = start;
  48131. function skipWs() {
  48132. while (pos < s.length && isWhitespace(s, pos)) {
  48133. ++pos;
  48134. }
  48135. }
  48136. while (pos < s.length && !isWhitespace(s, pos) && s[pos] !== ">" && s[pos] !== "?" && s[pos] !== "/") {
  48137. ++pos;
  48138. }
  48139. const name = s.substring(start, pos);
  48140. skipWs();
  48141. const attrStart = pos;
  48142. while (pos < s.length && (s[pos] !== "?" || s[pos + 1] !== ">")) {
  48143. ++pos;
  48144. }
  48145. const value = s.substring(attrStart, pos);
  48146. return {
  48147. name,
  48148. value,
  48149. parsed: pos - start
  48150. };
  48151. }
  48152. parseXml(s) {
  48153. let i = 0;
  48154. while (i < s.length) {
  48155. const ch = s[i];
  48156. let j = i;
  48157. if (ch === "<") {
  48158. ++j;
  48159. const ch2 = s[j];
  48160. let q;
  48161. switch (ch2) {
  48162. case "/":
  48163. ++j;
  48164. q = s.indexOf(">", j);
  48165. if (q < 0) {
  48166. this.onError(XMLParserErrorCode.UnterminatedElement);
  48167. return;
  48168. }
  48169. this.onEndElement(s.substring(j, q));
  48170. j = q + 1;
  48171. break;
  48172. case "?":
  48173. ++j;
  48174. const pi = this._parseProcessingInstruction(s, j);
  48175. if (s.substring(j + pi.parsed, j + pi.parsed + 2) !== "?>") {
  48176. this.onError(XMLParserErrorCode.UnterminatedXmlDeclaration);
  48177. return;
  48178. }
  48179. this.onPi(pi.name, pi.value);
  48180. j += pi.parsed + 2;
  48181. break;
  48182. case "!":
  48183. if (s.substring(j + 1, j + 3) === "--") {
  48184. q = s.indexOf("-->", j + 3);
  48185. if (q < 0) {
  48186. this.onError(XMLParserErrorCode.UnterminatedComment);
  48187. return;
  48188. }
  48189. this.onComment(s.substring(j + 3, q));
  48190. j = q + 3;
  48191. } else if (s.substring(j + 1, j + 8) === "[CDATA[") {
  48192. q = s.indexOf("]]>", j + 8);
  48193. if (q < 0) {
  48194. this.onError(XMLParserErrorCode.UnterminatedCdat);
  48195. return;
  48196. }
  48197. this.onCdata(s.substring(j + 8, q));
  48198. j = q + 3;
  48199. } else if (s.substring(j + 1, j + 8) === "DOCTYPE") {
  48200. const q2 = s.indexOf("[", j + 8);
  48201. let complexDoctype = false;
  48202. q = s.indexOf(">", j + 8);
  48203. if (q < 0) {
  48204. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48205. return;
  48206. }
  48207. if (q2 > 0 && q > q2) {
  48208. q = s.indexOf("]>", j + 8);
  48209. if (q < 0) {
  48210. this.onError(XMLParserErrorCode.UnterminatedDoctypeDeclaration);
  48211. return;
  48212. }
  48213. complexDoctype = true;
  48214. }
  48215. const doctypeContent = s.substring(j + 8, q + (complexDoctype ? 1 : 0));
  48216. this.onDoctype(doctypeContent);
  48217. j = q + (complexDoctype ? 2 : 1);
  48218. } else {
  48219. this.onError(XMLParserErrorCode.MalformedElement);
  48220. return;
  48221. }
  48222. break;
  48223. default:
  48224. const content = this._parseContent(s, j);
  48225. if (content === null) {
  48226. this.onError(XMLParserErrorCode.MalformedElement);
  48227. return;
  48228. }
  48229. let isClosed = false;
  48230. if (s.substring(j + content.parsed, j + content.parsed + 2) === "/>") {
  48231. isClosed = true;
  48232. } else if (s.substring(j + content.parsed, j + content.parsed + 1) !== ">") {
  48233. this.onError(XMLParserErrorCode.UnterminatedElement);
  48234. return;
  48235. }
  48236. this.onBeginElement(content.name, content.attributes, isClosed);
  48237. j += content.parsed + (isClosed ? 2 : 1);
  48238. break;
  48239. }
  48240. } else {
  48241. while (j < s.length && s[j] !== "<") {
  48242. j++;
  48243. }
  48244. const text = s.substring(i, j);
  48245. this.onText(this._resolveEntities(text));
  48246. }
  48247. i = j;
  48248. }
  48249. }
  48250. onResolveEntity(name) {
  48251. return `&${name};`;
  48252. }
  48253. onPi(name, value) {}
  48254. onComment(text) {}
  48255. onCdata(text) {}
  48256. onDoctype(doctypeContent) {}
  48257. onText(text) {}
  48258. onBeginElement(name, attributes, isEmpty) {}
  48259. onEndElement(name) {}
  48260. onError(code) {}
  48261. }
  48262. exports.XMLParserBase = XMLParserBase;
  48263. class SimpleDOMNode {
  48264. constructor(nodeName, nodeValue) {
  48265. this.nodeName = nodeName;
  48266. this.nodeValue = nodeValue;
  48267. Object.defineProperty(this, "parentNode", {
  48268. value: null,
  48269. writable: true
  48270. });
  48271. }
  48272. get firstChild() {
  48273. return this.childNodes && this.childNodes[0];
  48274. }
  48275. get nextSibling() {
  48276. const childNodes = this.parentNode.childNodes;
  48277. if (!childNodes) {
  48278. return undefined;
  48279. }
  48280. const index = childNodes.indexOf(this);
  48281. if (index === -1) {
  48282. return undefined;
  48283. }
  48284. return childNodes[index + 1];
  48285. }
  48286. get textContent() {
  48287. if (!this.childNodes) {
  48288. return this.nodeValue || "";
  48289. }
  48290. return this.childNodes.map(function (child) {
  48291. return child.textContent;
  48292. }).join("");
  48293. }
  48294. get children() {
  48295. return this.childNodes || [];
  48296. }
  48297. hasChildNodes() {
  48298. return this.childNodes && this.childNodes.length > 0;
  48299. }
  48300. searchNode(paths, pos) {
  48301. if (pos >= paths.length) {
  48302. return this;
  48303. }
  48304. const component = paths[pos];
  48305. const stack = [];
  48306. let node = this;
  48307. while (true) {
  48308. if (component.name === node.nodeName) {
  48309. if (component.pos === 0) {
  48310. const res = node.searchNode(paths, pos + 1);
  48311. if (res !== null) {
  48312. return res;
  48313. }
  48314. } else if (stack.length === 0) {
  48315. return null;
  48316. } else {
  48317. const [parent] = stack.pop();
  48318. let siblingPos = 0;
  48319. for (const child of parent.childNodes) {
  48320. if (component.name === child.nodeName) {
  48321. if (siblingPos === component.pos) {
  48322. return child.searchNode(paths, pos + 1);
  48323. }
  48324. siblingPos++;
  48325. }
  48326. }
  48327. return node.searchNode(paths, pos + 1);
  48328. }
  48329. }
  48330. if (node.childNodes && node.childNodes.length !== 0) {
  48331. stack.push([node, 0]);
  48332. node = node.childNodes[0];
  48333. } else if (stack.length === 0) {
  48334. return null;
  48335. } else {
  48336. while (stack.length !== 0) {
  48337. const [parent, currentPos] = stack.pop();
  48338. const newPos = currentPos + 1;
  48339. if (newPos < parent.childNodes.length) {
  48340. stack.push([parent, newPos]);
  48341. node = parent.childNodes[newPos];
  48342. break;
  48343. }
  48344. }
  48345. if (stack.length === 0) {
  48346. return null;
  48347. }
  48348. }
  48349. }
  48350. }
  48351. dump(buffer) {
  48352. if (this.nodeName === "#text") {
  48353. buffer.push((0, _core_utils.encodeToXmlString)(this.nodeValue));
  48354. return;
  48355. }
  48356. buffer.push(`<${this.nodeName}`);
  48357. if (this.attributes) {
  48358. for (const attribute of this.attributes) {
  48359. buffer.push(` ${attribute.name}="${(0, _core_utils.encodeToXmlString)(attribute.value)}"`);
  48360. }
  48361. }
  48362. if (this.hasChildNodes()) {
  48363. buffer.push(">");
  48364. for (const child of this.childNodes) {
  48365. child.dump(buffer);
  48366. }
  48367. buffer.push(`</${this.nodeName}>`);
  48368. } else if (this.nodeValue) {
  48369. buffer.push(`>${(0, _core_utils.encodeToXmlString)(this.nodeValue)}</${this.nodeName}>`);
  48370. } else {
  48371. buffer.push("/>");
  48372. }
  48373. }
  48374. }
  48375. exports.SimpleDOMNode = SimpleDOMNode;
  48376. class SimpleXMLParser extends XMLParserBase {
  48377. constructor({
  48378. hasAttributes = false,
  48379. lowerCaseName = false
  48380. }) {
  48381. super();
  48382. this._currentFragment = null;
  48383. this._stack = null;
  48384. this._errorCode = XMLParserErrorCode.NoError;
  48385. this._hasAttributes = hasAttributes;
  48386. this._lowerCaseName = lowerCaseName;
  48387. }
  48388. parseFromString(data) {
  48389. this._currentFragment = [];
  48390. this._stack = [];
  48391. this._errorCode = XMLParserErrorCode.NoError;
  48392. this.parseXml(data);
  48393. if (this._errorCode !== XMLParserErrorCode.NoError) {
  48394. return undefined;
  48395. }
  48396. const [documentElement] = this._currentFragment;
  48397. if (!documentElement) {
  48398. return undefined;
  48399. }
  48400. return {
  48401. documentElement
  48402. };
  48403. }
  48404. onText(text) {
  48405. if (isWhitespaceString(text)) {
  48406. return;
  48407. }
  48408. const node = new SimpleDOMNode("#text", text);
  48409. this._currentFragment.push(node);
  48410. }
  48411. onCdata(text) {
  48412. const node = new SimpleDOMNode("#text", text);
  48413. this._currentFragment.push(node);
  48414. }
  48415. onBeginElement(name, attributes, isEmpty) {
  48416. if (this._lowerCaseName) {
  48417. name = name.toLowerCase();
  48418. }
  48419. const node = new SimpleDOMNode(name);
  48420. node.childNodes = [];
  48421. if (this._hasAttributes) {
  48422. node.attributes = attributes;
  48423. }
  48424. this._currentFragment.push(node);
  48425. if (isEmpty) {
  48426. return;
  48427. }
  48428. this._stack.push(this._currentFragment);
  48429. this._currentFragment = node.childNodes;
  48430. }
  48431. onEndElement(name) {
  48432. this._currentFragment = this._stack.pop() || [];
  48433. const lastElement = this._currentFragment[this._currentFragment.length - 1];
  48434. if (!lastElement) {
  48435. return null;
  48436. }
  48437. for (let i = 0, ii = lastElement.childNodes.length; i < ii; i++) {
  48438. lastElement.childNodes[i].parentNode = lastElement;
  48439. }
  48440. return lastElement;
  48441. }
  48442. onError(code) {
  48443. this._errorCode = code;
  48444. }
  48445. }
  48446. exports.SimpleXMLParser = SimpleXMLParser;
  48447. /***/ }),
  48448. /* 71 */
  48449. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48450. Object.defineProperty(exports, "__esModule", ({
  48451. value: true
  48452. }));
  48453. exports.StructTreeRoot = exports.StructTreePage = void 0;
  48454. var _primitives = __w_pdfjs_require__(5);
  48455. var _util = __w_pdfjs_require__(2);
  48456. var _name_number_tree = __w_pdfjs_require__(66);
  48457. const MAX_DEPTH = 40;
  48458. const StructElementType = {
  48459. PAGE_CONTENT: "PAGE_CONTENT",
  48460. STREAM_CONTENT: "STREAM_CONTENT",
  48461. OBJECT: "OBJECT",
  48462. ELEMENT: "ELEMENT"
  48463. };
  48464. class StructTreeRoot {
  48465. constructor(rootDict) {
  48466. this.dict = rootDict;
  48467. this.roleMap = new Map();
  48468. }
  48469. init() {
  48470. this.readRoleMap();
  48471. }
  48472. readRoleMap() {
  48473. const roleMapDict = this.dict.get("RoleMap");
  48474. if (!(roleMapDict instanceof _primitives.Dict)) {
  48475. return;
  48476. }
  48477. roleMapDict.forEach((key, value) => {
  48478. if (!(value instanceof _primitives.Name)) {
  48479. return;
  48480. }
  48481. this.roleMap.set(key, value.name);
  48482. });
  48483. }
  48484. }
  48485. exports.StructTreeRoot = StructTreeRoot;
  48486. class StructElementNode {
  48487. constructor(tree, dict) {
  48488. this.tree = tree;
  48489. this.dict = dict;
  48490. this.kids = [];
  48491. this.parseKids();
  48492. }
  48493. get role() {
  48494. const nameObj = this.dict.get("S");
  48495. const name = nameObj instanceof _primitives.Name ? nameObj.name : "";
  48496. const {
  48497. root
  48498. } = this.tree;
  48499. if (root.roleMap.has(name)) {
  48500. return root.roleMap.get(name);
  48501. }
  48502. return name;
  48503. }
  48504. parseKids() {
  48505. let pageObjId = null;
  48506. const objRef = this.dict.getRaw("Pg");
  48507. if (objRef instanceof _primitives.Ref) {
  48508. pageObjId = objRef.toString();
  48509. }
  48510. const kids = this.dict.get("K");
  48511. if (Array.isArray(kids)) {
  48512. for (const kid of kids) {
  48513. const element = this.parseKid(pageObjId, kid);
  48514. if (element) {
  48515. this.kids.push(element);
  48516. }
  48517. }
  48518. } else {
  48519. const element = this.parseKid(pageObjId, kids);
  48520. if (element) {
  48521. this.kids.push(element);
  48522. }
  48523. }
  48524. }
  48525. parseKid(pageObjId, kid) {
  48526. if (Number.isInteger(kid)) {
  48527. if (this.tree.pageDict.objId !== pageObjId) {
  48528. return null;
  48529. }
  48530. return new StructElement({
  48531. type: StructElementType.PAGE_CONTENT,
  48532. mcid: kid,
  48533. pageObjId
  48534. });
  48535. }
  48536. let kidDict = null;
  48537. if (kid instanceof _primitives.Ref) {
  48538. kidDict = this.dict.xref.fetch(kid);
  48539. } else if (kid instanceof _primitives.Dict) {
  48540. kidDict = kid;
  48541. }
  48542. if (!kidDict) {
  48543. return null;
  48544. }
  48545. const pageRef = kidDict.getRaw("Pg");
  48546. if (pageRef instanceof _primitives.Ref) {
  48547. pageObjId = pageRef.toString();
  48548. }
  48549. const type = kidDict.get("Type") instanceof _primitives.Name ? kidDict.get("Type").name : null;
  48550. if (type === "MCR") {
  48551. if (this.tree.pageDict.objId !== pageObjId) {
  48552. return null;
  48553. }
  48554. return new StructElement({
  48555. type: StructElementType.STREAM_CONTENT,
  48556. refObjId: kidDict.getRaw("Stm") instanceof _primitives.Ref ? kidDict.getRaw("Stm").toString() : null,
  48557. pageObjId,
  48558. mcid: kidDict.get("MCID")
  48559. });
  48560. }
  48561. if (type === "OBJR") {
  48562. if (this.tree.pageDict.objId !== pageObjId) {
  48563. return null;
  48564. }
  48565. return new StructElement({
  48566. type: StructElementType.OBJECT,
  48567. refObjId: kidDict.getRaw("Obj") instanceof _primitives.Ref ? kidDict.getRaw("Obj").toString() : null,
  48568. pageObjId
  48569. });
  48570. }
  48571. return new StructElement({
  48572. type: StructElementType.ELEMENT,
  48573. dict: kidDict
  48574. });
  48575. }
  48576. }
  48577. class StructElement {
  48578. constructor({
  48579. type,
  48580. dict = null,
  48581. mcid = null,
  48582. pageObjId = null,
  48583. refObjId = null
  48584. }) {
  48585. this.type = type;
  48586. this.dict = dict;
  48587. this.mcid = mcid;
  48588. this.pageObjId = pageObjId;
  48589. this.refObjId = refObjId;
  48590. this.parentNode = null;
  48591. }
  48592. }
  48593. class StructTreePage {
  48594. constructor(structTreeRoot, pageDict) {
  48595. this.root = structTreeRoot;
  48596. this.rootDict = structTreeRoot ? structTreeRoot.dict : null;
  48597. this.pageDict = pageDict;
  48598. this.nodes = [];
  48599. }
  48600. parse() {
  48601. if (!this.root || !this.rootDict) {
  48602. return;
  48603. }
  48604. const parentTree = this.rootDict.get("ParentTree");
  48605. if (!parentTree) {
  48606. return;
  48607. }
  48608. const id = this.pageDict.get("StructParents");
  48609. if (!Number.isInteger(id)) {
  48610. return;
  48611. }
  48612. const numberTree = new _name_number_tree.NumberTree(parentTree, this.rootDict.xref);
  48613. const parentArray = numberTree.get(id);
  48614. if (!Array.isArray(parentArray)) {
  48615. return;
  48616. }
  48617. const map = new Map();
  48618. for (const ref of parentArray) {
  48619. if (ref instanceof _primitives.Ref) {
  48620. this.addNode(this.rootDict.xref.fetch(ref), map);
  48621. }
  48622. }
  48623. }
  48624. addNode(dict, map, level = 0) {
  48625. if (level > MAX_DEPTH) {
  48626. (0, _util.warn)("StructTree MAX_DEPTH reached.");
  48627. return null;
  48628. }
  48629. if (map.has(dict)) {
  48630. return map.get(dict);
  48631. }
  48632. const element = new StructElementNode(this, dict);
  48633. map.set(dict, element);
  48634. const parent = dict.get("P");
  48635. if (!parent || (0, _primitives.isName)(parent.get("Type"), "StructTreeRoot")) {
  48636. if (!this.addTopLevelNode(dict, element)) {
  48637. map.delete(dict);
  48638. }
  48639. return element;
  48640. }
  48641. const parentNode = this.addNode(parent, map, level + 1);
  48642. if (!parentNode) {
  48643. return element;
  48644. }
  48645. let save = false;
  48646. for (const kid of parentNode.kids) {
  48647. if (kid.type === StructElementType.ELEMENT && kid.dict === dict) {
  48648. kid.parentNode = element;
  48649. save = true;
  48650. }
  48651. }
  48652. if (!save) {
  48653. map.delete(dict);
  48654. }
  48655. return element;
  48656. }
  48657. addTopLevelNode(dict, element) {
  48658. const obj = this.rootDict.get("K");
  48659. if (!obj) {
  48660. return false;
  48661. }
  48662. if (obj instanceof _primitives.Dict) {
  48663. if (obj.objId !== dict.objId) {
  48664. return false;
  48665. }
  48666. this.nodes[0] = element;
  48667. return true;
  48668. }
  48669. if (!Array.isArray(obj)) {
  48670. return true;
  48671. }
  48672. let save = false;
  48673. for (let i = 0; i < obj.length; i++) {
  48674. const kidRef = obj[i];
  48675. if (kidRef && kidRef.toString() === dict.objId) {
  48676. this.nodes[i] = element;
  48677. save = true;
  48678. }
  48679. }
  48680. return save;
  48681. }
  48682. get serializable() {
  48683. function nodeToSerializable(node, parent, level = 0) {
  48684. if (level > MAX_DEPTH) {
  48685. (0, _util.warn)("StructTree too deep to be fully serialized.");
  48686. return;
  48687. }
  48688. const obj = Object.create(null);
  48689. obj.role = node.role;
  48690. obj.children = [];
  48691. parent.children.push(obj);
  48692. const alt = node.dict.get("Alt");
  48693. if (typeof alt === "string") {
  48694. obj.alt = (0, _util.stringToPDFString)(alt);
  48695. }
  48696. const lang = node.dict.get("Lang");
  48697. if (typeof lang === "string") {
  48698. obj.lang = (0, _util.stringToPDFString)(lang);
  48699. }
  48700. for (const kid of node.kids) {
  48701. const kidElement = kid.type === StructElementType.ELEMENT ? kid.parentNode : null;
  48702. if (kidElement) {
  48703. nodeToSerializable(kidElement, obj, level + 1);
  48704. continue;
  48705. } else if (kid.type === StructElementType.PAGE_CONTENT || kid.type === StructElementType.STREAM_CONTENT) {
  48706. obj.children.push({
  48707. type: "content",
  48708. id: `page${kid.pageObjId}_mcid${kid.mcid}`
  48709. });
  48710. } else if (kid.type === StructElementType.OBJECT) {
  48711. obj.children.push({
  48712. type: "object",
  48713. id: kid.refObjId
  48714. });
  48715. }
  48716. }
  48717. }
  48718. const root = Object.create(null);
  48719. root.children = [];
  48720. root.role = "Root";
  48721. for (const child of this.nodes) {
  48722. if (!child) {
  48723. continue;
  48724. }
  48725. nodeToSerializable(child, root);
  48726. }
  48727. return root;
  48728. }
  48729. }
  48730. exports.StructTreePage = StructTreePage;
  48731. /***/ }),
  48732. /* 72 */
  48733. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48734. Object.defineProperty(exports, "__esModule", ({
  48735. value: true
  48736. }));
  48737. exports.ObjectLoader = void 0;
  48738. var _primitives = __w_pdfjs_require__(5);
  48739. var _base_stream = __w_pdfjs_require__(9);
  48740. var _core_utils = __w_pdfjs_require__(8);
  48741. var _util = __w_pdfjs_require__(2);
  48742. function mayHaveChildren(value) {
  48743. return value instanceof _primitives.Ref || value instanceof _primitives.Dict || value instanceof _base_stream.BaseStream || Array.isArray(value);
  48744. }
  48745. function addChildren(node, nodesToVisit) {
  48746. if (node instanceof _primitives.Dict) {
  48747. node = node.getRawValues();
  48748. } else if (node instanceof _base_stream.BaseStream) {
  48749. node = node.dict.getRawValues();
  48750. } else if (!Array.isArray(node)) {
  48751. return;
  48752. }
  48753. for (const rawValue of node) {
  48754. if (mayHaveChildren(rawValue)) {
  48755. nodesToVisit.push(rawValue);
  48756. }
  48757. }
  48758. }
  48759. class ObjectLoader {
  48760. constructor(dict, keys, xref) {
  48761. this.dict = dict;
  48762. this.keys = keys;
  48763. this.xref = xref;
  48764. this.refSet = null;
  48765. }
  48766. async load() {
  48767. if (this.xref.stream.isDataLoaded) {
  48768. return undefined;
  48769. }
  48770. const {
  48771. keys,
  48772. dict
  48773. } = this;
  48774. this.refSet = new _primitives.RefSet();
  48775. const nodesToVisit = [];
  48776. for (let i = 0, ii = keys.length; i < ii; i++) {
  48777. const rawValue = dict.getRaw(keys[i]);
  48778. if (rawValue !== undefined) {
  48779. nodesToVisit.push(rawValue);
  48780. }
  48781. }
  48782. return this._walk(nodesToVisit);
  48783. }
  48784. async _walk(nodesToVisit) {
  48785. const nodesToRevisit = [];
  48786. const pendingRequests = [];
  48787. while (nodesToVisit.length) {
  48788. let currentNode = nodesToVisit.pop();
  48789. if (currentNode instanceof _primitives.Ref) {
  48790. if (this.refSet.has(currentNode)) {
  48791. continue;
  48792. }
  48793. try {
  48794. this.refSet.put(currentNode);
  48795. currentNode = this.xref.fetch(currentNode);
  48796. } catch (ex) {
  48797. if (!(ex instanceof _core_utils.MissingDataException)) {
  48798. (0, _util.warn)(`ObjectLoader._walk - requesting all data: "${ex}".`);
  48799. this.refSet = null;
  48800. const {
  48801. manager
  48802. } = this.xref.stream;
  48803. return manager.requestAllChunks();
  48804. }
  48805. nodesToRevisit.push(currentNode);
  48806. pendingRequests.push({
  48807. begin: ex.begin,
  48808. end: ex.end
  48809. });
  48810. }
  48811. }
  48812. if (currentNode instanceof _base_stream.BaseStream) {
  48813. const baseStreams = currentNode.getBaseStreams();
  48814. if (baseStreams) {
  48815. let foundMissingData = false;
  48816. for (const stream of baseStreams) {
  48817. if (stream.isDataLoaded) {
  48818. continue;
  48819. }
  48820. foundMissingData = true;
  48821. pendingRequests.push({
  48822. begin: stream.start,
  48823. end: stream.end
  48824. });
  48825. }
  48826. if (foundMissingData) {
  48827. nodesToRevisit.push(currentNode);
  48828. }
  48829. }
  48830. }
  48831. addChildren(currentNode, nodesToVisit);
  48832. }
  48833. if (pendingRequests.length) {
  48834. await this.xref.stream.manager.requestRanges(pendingRequests);
  48835. for (const node of nodesToRevisit) {
  48836. if (node instanceof _primitives.Ref) {
  48837. this.refSet.remove(node);
  48838. }
  48839. }
  48840. return this._walk(nodesToRevisit);
  48841. }
  48842. this.refSet = null;
  48843. return undefined;
  48844. }
  48845. }
  48846. exports.ObjectLoader = ObjectLoader;
  48847. /***/ }),
  48848. /* 73 */
  48849. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  48850. Object.defineProperty(exports, "__esModule", ({
  48851. value: true
  48852. }));
  48853. exports.incrementalUpdate = incrementalUpdate;
  48854. exports.writeDict = writeDict;
  48855. var _util = __w_pdfjs_require__(2);
  48856. var _primitives = __w_pdfjs_require__(5);
  48857. var _core_utils = __w_pdfjs_require__(8);
  48858. var _xml_parser = __w_pdfjs_require__(70);
  48859. var _base_stream = __w_pdfjs_require__(9);
  48860. var _crypto = __w_pdfjs_require__(74);
  48861. function writeDict(dict, buffer, transform) {
  48862. buffer.push("<<");
  48863. for (const key of dict.getKeys()) {
  48864. buffer.push(` /${(0, _core_utils.escapePDFName)(key)} `);
  48865. writeValue(dict.getRaw(key), buffer, transform);
  48866. }
  48867. buffer.push(">>");
  48868. }
  48869. function writeStream(stream, buffer, transform) {
  48870. writeDict(stream.dict, buffer, transform);
  48871. buffer.push(" stream\n");
  48872. let string = stream.getString();
  48873. if (transform !== null) {
  48874. string = transform.encryptString(string);
  48875. }
  48876. buffer.push(string, "\nendstream\n");
  48877. }
  48878. function writeArray(array, buffer, transform) {
  48879. buffer.push("[");
  48880. let first = true;
  48881. for (const val of array) {
  48882. if (!first) {
  48883. buffer.push(" ");
  48884. } else {
  48885. first = false;
  48886. }
  48887. writeValue(val, buffer, transform);
  48888. }
  48889. buffer.push("]");
  48890. }
  48891. function numberToString(value) {
  48892. if (Number.isInteger(value)) {
  48893. return value.toString();
  48894. }
  48895. const roundedValue = Math.round(value * 100);
  48896. if (roundedValue % 100 === 0) {
  48897. return (roundedValue / 100).toString();
  48898. }
  48899. if (roundedValue % 10 === 0) {
  48900. return value.toFixed(1);
  48901. }
  48902. return value.toFixed(2);
  48903. }
  48904. function writeValue(value, buffer, transform) {
  48905. if (value instanceof _primitives.Name) {
  48906. buffer.push(`/${(0, _core_utils.escapePDFName)(value.name)}`);
  48907. } else if (value instanceof _primitives.Ref) {
  48908. buffer.push(`${value.num} ${value.gen} R`);
  48909. } else if (Array.isArray(value)) {
  48910. writeArray(value, buffer, transform);
  48911. } else if (typeof value === "string") {
  48912. if (transform !== null) {
  48913. value = transform.encryptString(value);
  48914. }
  48915. buffer.push(`(${(0, _util.escapeString)(value)})`);
  48916. } else if (typeof value === "number") {
  48917. buffer.push(numberToString(value));
  48918. } else if (typeof value === "boolean") {
  48919. buffer.push(value.toString());
  48920. } else if (value instanceof _primitives.Dict) {
  48921. writeDict(value, buffer, transform);
  48922. } else if (value instanceof _base_stream.BaseStream) {
  48923. writeStream(value, buffer, transform);
  48924. } else if (value === null) {
  48925. buffer.push("null");
  48926. } else {
  48927. (0, _util.warn)(`Unhandled value in writer: ${typeof value}, please file a bug.`);
  48928. }
  48929. }
  48930. function writeInt(number, size, offset, buffer) {
  48931. for (let i = size + offset - 1; i > offset - 1; i--) {
  48932. buffer[i] = number & 0xff;
  48933. number >>= 8;
  48934. }
  48935. return offset + size;
  48936. }
  48937. function writeString(string, offset, buffer) {
  48938. for (let i = 0, len = string.length; i < len; i++) {
  48939. buffer[offset + i] = string.charCodeAt(i) & 0xff;
  48940. }
  48941. }
  48942. function computeMD5(filesize, xrefInfo) {
  48943. const time = Math.floor(Date.now() / 1000);
  48944. const filename = xrefInfo.filename || "";
  48945. const md5Buffer = [time.toString(), filename, filesize.toString()];
  48946. let md5BufferLen = md5Buffer.reduce((a, str) => a + str.length, 0);
  48947. for (const value of Object.values(xrefInfo.info)) {
  48948. md5Buffer.push(value);
  48949. md5BufferLen += value.length;
  48950. }
  48951. const array = new Uint8Array(md5BufferLen);
  48952. let offset = 0;
  48953. for (const str of md5Buffer) {
  48954. writeString(str, offset, array);
  48955. offset += str.length;
  48956. }
  48957. return (0, _util.bytesToString)((0, _crypto.calculateMD5)(array));
  48958. }
  48959. function writeXFADataForAcroform(str, newRefs) {
  48960. const xml = new _xml_parser.SimpleXMLParser({
  48961. hasAttributes: true
  48962. }).parseFromString(str);
  48963. for (const {
  48964. xfa
  48965. } of newRefs) {
  48966. if (!xfa) {
  48967. continue;
  48968. }
  48969. const {
  48970. path,
  48971. value
  48972. } = xfa;
  48973. if (!path) {
  48974. continue;
  48975. }
  48976. const node = xml.documentElement.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  48977. if (node) {
  48978. if (Array.isArray(value)) {
  48979. node.childNodes = value.map(val => new _xml_parser.SimpleDOMNode("value", val));
  48980. } else {
  48981. node.childNodes = [new _xml_parser.SimpleDOMNode("#text", value)];
  48982. }
  48983. } else {
  48984. (0, _util.warn)(`Node not found for path: ${path}`);
  48985. }
  48986. }
  48987. const buffer = [];
  48988. xml.documentElement.dump(buffer);
  48989. return buffer.join("");
  48990. }
  48991. function updateXFA({
  48992. xfaData,
  48993. xfaDatasetsRef,
  48994. hasXfaDatasetsEntry,
  48995. acroFormRef,
  48996. acroForm,
  48997. newRefs,
  48998. xref,
  48999. xrefInfo
  49000. }) {
  49001. if (xref === null) {
  49002. return;
  49003. }
  49004. if (!hasXfaDatasetsEntry) {
  49005. if (!acroFormRef) {
  49006. (0, _util.warn)("XFA - Cannot save it");
  49007. return;
  49008. }
  49009. const oldXfa = acroForm.get("XFA");
  49010. const newXfa = oldXfa.slice();
  49011. newXfa.splice(2, 0, "datasets");
  49012. newXfa.splice(3, 0, xfaDatasetsRef);
  49013. acroForm.set("XFA", newXfa);
  49014. const encrypt = xref.encrypt;
  49015. let transform = null;
  49016. if (encrypt) {
  49017. transform = encrypt.createCipherTransform(acroFormRef.num, acroFormRef.gen);
  49018. }
  49019. const buffer = [`${acroFormRef.num} ${acroFormRef.gen} obj\n`];
  49020. writeDict(acroForm, buffer, transform);
  49021. buffer.push("\n");
  49022. acroForm.set("XFA", oldXfa);
  49023. newRefs.push({
  49024. ref: acroFormRef,
  49025. data: buffer.join("")
  49026. });
  49027. }
  49028. if (xfaData === null) {
  49029. const datasets = xref.fetchIfRef(xfaDatasetsRef);
  49030. xfaData = writeXFADataForAcroform(datasets.getString(), newRefs);
  49031. }
  49032. const encrypt = xref.encrypt;
  49033. if (encrypt) {
  49034. const transform = encrypt.createCipherTransform(xfaDatasetsRef.num, xfaDatasetsRef.gen);
  49035. xfaData = transform.encryptString(xfaData);
  49036. }
  49037. const data = `${xfaDatasetsRef.num} ${xfaDatasetsRef.gen} obj\n` + `<< /Type /EmbeddedFile /Length ${xfaData.length}>>\nstream\n` + xfaData + "\nendstream\nendobj\n";
  49038. newRefs.push({
  49039. ref: xfaDatasetsRef,
  49040. data
  49041. });
  49042. }
  49043. function incrementalUpdate({
  49044. originalData,
  49045. xrefInfo,
  49046. newRefs,
  49047. xref = null,
  49048. hasXfa = false,
  49049. xfaDatasetsRef = null,
  49050. hasXfaDatasetsEntry = false,
  49051. acroFormRef = null,
  49052. acroForm = null,
  49053. xfaData = null
  49054. }) {
  49055. if (hasXfa) {
  49056. updateXFA({
  49057. xfaData,
  49058. xfaDatasetsRef,
  49059. hasXfaDatasetsEntry,
  49060. acroFormRef,
  49061. acroForm,
  49062. newRefs,
  49063. xref,
  49064. xrefInfo
  49065. });
  49066. }
  49067. const newXref = new _primitives.Dict(null);
  49068. const refForXrefTable = xrefInfo.newRef;
  49069. let buffer, baseOffset;
  49070. const lastByte = originalData[originalData.length - 1];
  49071. if (lastByte === 0x0a || lastByte === 0x0d) {
  49072. buffer = [];
  49073. baseOffset = originalData.length;
  49074. } else {
  49075. buffer = ["\n"];
  49076. baseOffset = originalData.length + 1;
  49077. }
  49078. newXref.set("Size", refForXrefTable.num + 1);
  49079. newXref.set("Prev", xrefInfo.startXRef);
  49080. newXref.set("Type", _primitives.Name.get("XRef"));
  49081. if (xrefInfo.rootRef !== null) {
  49082. newXref.set("Root", xrefInfo.rootRef);
  49083. }
  49084. if (xrefInfo.infoRef !== null) {
  49085. newXref.set("Info", xrefInfo.infoRef);
  49086. }
  49087. if (xrefInfo.encryptRef !== null) {
  49088. newXref.set("Encrypt", xrefInfo.encryptRef);
  49089. }
  49090. newRefs.push({
  49091. ref: refForXrefTable,
  49092. data: ""
  49093. });
  49094. newRefs = newRefs.sort((a, b) => {
  49095. return a.ref.num - b.ref.num;
  49096. });
  49097. const xrefTableData = [[0, 1, 0xffff]];
  49098. const indexes = [0, 1];
  49099. let maxOffset = 0;
  49100. for (const {
  49101. ref,
  49102. data
  49103. } of newRefs) {
  49104. maxOffset = Math.max(maxOffset, baseOffset);
  49105. xrefTableData.push([1, baseOffset, Math.min(ref.gen, 0xffff)]);
  49106. baseOffset += data.length;
  49107. indexes.push(ref.num, 1);
  49108. buffer.push(data);
  49109. }
  49110. newXref.set("Index", indexes);
  49111. if (Array.isArray(xrefInfo.fileIds) && xrefInfo.fileIds.length > 0) {
  49112. const md5 = computeMD5(baseOffset, xrefInfo);
  49113. newXref.set("ID", [xrefInfo.fileIds[0], md5]);
  49114. }
  49115. const offsetSize = Math.ceil(Math.log2(maxOffset) / 8);
  49116. const sizes = [1, offsetSize, 2];
  49117. const structSize = sizes[0] + sizes[1] + sizes[2];
  49118. const tableLength = structSize * xrefTableData.length;
  49119. newXref.set("W", sizes);
  49120. newXref.set("Length", tableLength);
  49121. buffer.push(`${refForXrefTable.num} ${refForXrefTable.gen} obj\n`);
  49122. writeDict(newXref, buffer, null);
  49123. buffer.push(" stream\n");
  49124. const bufferLen = buffer.reduce((a, str) => a + str.length, 0);
  49125. const footer = `\nendstream\nendobj\nstartxref\n${baseOffset}\n%%EOF\n`;
  49126. const array = new Uint8Array(originalData.length + bufferLen + tableLength + footer.length);
  49127. array.set(originalData);
  49128. let offset = originalData.length;
  49129. for (const str of buffer) {
  49130. writeString(str, offset, array);
  49131. offset += str.length;
  49132. }
  49133. for (const [type, objOffset, gen] of xrefTableData) {
  49134. offset = writeInt(type, sizes[0], offset, array);
  49135. offset = writeInt(objOffset, sizes[1], offset, array);
  49136. offset = writeInt(gen, sizes[2], offset, array);
  49137. }
  49138. writeString(footer, offset, array);
  49139. return array;
  49140. }
  49141. /***/ }),
  49142. /* 74 */
  49143. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  49144. Object.defineProperty(exports, "__esModule", ({
  49145. value: true
  49146. }));
  49147. exports.calculateSHA256 = exports.calculateMD5 = exports.PDF20 = exports.PDF17 = exports.CipherTransformFactory = exports.ARCFourCipher = exports.AES256Cipher = exports.AES128Cipher = void 0;
  49148. exports.calculateSHA384 = calculateSHA384;
  49149. exports.calculateSHA512 = void 0;
  49150. var _util = __w_pdfjs_require__(2);
  49151. var _primitives = __w_pdfjs_require__(5);
  49152. var _decrypt_stream = __w_pdfjs_require__(75);
  49153. class ARCFourCipher {
  49154. constructor(key) {
  49155. this.a = 0;
  49156. this.b = 0;
  49157. const s = new Uint8Array(256);
  49158. const keyLength = key.length;
  49159. for (let i = 0; i < 256; ++i) {
  49160. s[i] = i;
  49161. }
  49162. for (let i = 0, j = 0; i < 256; ++i) {
  49163. const tmp = s[i];
  49164. j = j + tmp + key[i % keyLength] & 0xff;
  49165. s[i] = s[j];
  49166. s[j] = tmp;
  49167. }
  49168. this.s = s;
  49169. }
  49170. encryptBlock(data) {
  49171. let a = this.a,
  49172. b = this.b;
  49173. const s = this.s;
  49174. const n = data.length;
  49175. const output = new Uint8Array(n);
  49176. for (let i = 0; i < n; ++i) {
  49177. a = a + 1 & 0xff;
  49178. const tmp = s[a];
  49179. b = b + tmp & 0xff;
  49180. const tmp2 = s[b];
  49181. s[a] = tmp2;
  49182. s[b] = tmp;
  49183. output[i] = data[i] ^ s[tmp + tmp2 & 0xff];
  49184. }
  49185. this.a = a;
  49186. this.b = b;
  49187. return output;
  49188. }
  49189. decryptBlock(data) {
  49190. return this.encryptBlock(data);
  49191. }
  49192. encrypt(data) {
  49193. return this.encryptBlock(data);
  49194. }
  49195. }
  49196. exports.ARCFourCipher = ARCFourCipher;
  49197. const calculateMD5 = function calculateMD5Closure() {
  49198. 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]);
  49199. 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]);
  49200. function hash(data, offset, length) {
  49201. let h0 = 1732584193,
  49202. h1 = -271733879,
  49203. h2 = -1732584194,
  49204. h3 = 271733878;
  49205. const paddedLength = length + 72 & ~63;
  49206. const padded = new Uint8Array(paddedLength);
  49207. let i, j;
  49208. for (i = 0; i < length; ++i) {
  49209. padded[i] = data[offset++];
  49210. }
  49211. padded[i++] = 0x80;
  49212. const n = paddedLength - 8;
  49213. while (i < n) {
  49214. padded[i++] = 0;
  49215. }
  49216. padded[i++] = length << 3 & 0xff;
  49217. padded[i++] = length >> 5 & 0xff;
  49218. padded[i++] = length >> 13 & 0xff;
  49219. padded[i++] = length >> 21 & 0xff;
  49220. padded[i++] = length >>> 29 & 0xff;
  49221. padded[i++] = 0;
  49222. padded[i++] = 0;
  49223. padded[i++] = 0;
  49224. const w = new Int32Array(16);
  49225. for (i = 0; i < paddedLength;) {
  49226. for (j = 0; j < 16; ++j, i += 4) {
  49227. w[j] = padded[i] | padded[i + 1] << 8 | padded[i + 2] << 16 | padded[i + 3] << 24;
  49228. }
  49229. let a = h0,
  49230. b = h1,
  49231. c = h2,
  49232. d = h3,
  49233. f,
  49234. g;
  49235. for (j = 0; j < 64; ++j) {
  49236. if (j < 16) {
  49237. f = b & c | ~b & d;
  49238. g = j;
  49239. } else if (j < 32) {
  49240. f = d & b | ~d & c;
  49241. g = 5 * j + 1 & 15;
  49242. } else if (j < 48) {
  49243. f = b ^ c ^ d;
  49244. g = 3 * j + 5 & 15;
  49245. } else {
  49246. f = c ^ (b | ~d);
  49247. g = 7 * j & 15;
  49248. }
  49249. const tmp = d,
  49250. rotateArg = a + f + k[j] + w[g] | 0,
  49251. rotate = r[j];
  49252. d = c;
  49253. c = b;
  49254. b = b + (rotateArg << rotate | rotateArg >>> 32 - rotate) | 0;
  49255. a = tmp;
  49256. }
  49257. h0 = h0 + a | 0;
  49258. h1 = h1 + b | 0;
  49259. h2 = h2 + c | 0;
  49260. h3 = h3 + d | 0;
  49261. }
  49262. 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]);
  49263. }
  49264. return hash;
  49265. }();
  49266. exports.calculateMD5 = calculateMD5;
  49267. class Word64 {
  49268. constructor(highInteger, lowInteger) {
  49269. this.high = highInteger | 0;
  49270. this.low = lowInteger | 0;
  49271. }
  49272. and(word) {
  49273. this.high &= word.high;
  49274. this.low &= word.low;
  49275. }
  49276. xor(word) {
  49277. this.high ^= word.high;
  49278. this.low ^= word.low;
  49279. }
  49280. or(word) {
  49281. this.high |= word.high;
  49282. this.low |= word.low;
  49283. }
  49284. shiftRight(places) {
  49285. if (places >= 32) {
  49286. this.low = this.high >>> places - 32 | 0;
  49287. this.high = 0;
  49288. } else {
  49289. this.low = this.low >>> places | this.high << 32 - places;
  49290. this.high = this.high >>> places | 0;
  49291. }
  49292. }
  49293. shiftLeft(places) {
  49294. if (places >= 32) {
  49295. this.high = this.low << places - 32;
  49296. this.low = 0;
  49297. } else {
  49298. this.high = this.high << places | this.low >>> 32 - places;
  49299. this.low <<= places;
  49300. }
  49301. }
  49302. rotateRight(places) {
  49303. let low, high;
  49304. if (places & 32) {
  49305. high = this.low;
  49306. low = this.high;
  49307. } else {
  49308. low = this.low;
  49309. high = this.high;
  49310. }
  49311. places &= 31;
  49312. this.low = low >>> places | high << 32 - places;
  49313. this.high = high >>> places | low << 32 - places;
  49314. }
  49315. not() {
  49316. this.high = ~this.high;
  49317. this.low = ~this.low;
  49318. }
  49319. add(word) {
  49320. const lowAdd = (this.low >>> 0) + (word.low >>> 0);
  49321. let highAdd = (this.high >>> 0) + (word.high >>> 0);
  49322. if (lowAdd > 0xffffffff) {
  49323. highAdd += 1;
  49324. }
  49325. this.low = lowAdd | 0;
  49326. this.high = highAdd | 0;
  49327. }
  49328. copyTo(bytes, offset) {
  49329. bytes[offset] = this.high >>> 24 & 0xff;
  49330. bytes[offset + 1] = this.high >> 16 & 0xff;
  49331. bytes[offset + 2] = this.high >> 8 & 0xff;
  49332. bytes[offset + 3] = this.high & 0xff;
  49333. bytes[offset + 4] = this.low >>> 24 & 0xff;
  49334. bytes[offset + 5] = this.low >> 16 & 0xff;
  49335. bytes[offset + 6] = this.low >> 8 & 0xff;
  49336. bytes[offset + 7] = this.low & 0xff;
  49337. }
  49338. assign(word) {
  49339. this.high = word.high;
  49340. this.low = word.low;
  49341. }
  49342. }
  49343. const calculateSHA256 = function calculateSHA256Closure() {
  49344. function rotr(x, n) {
  49345. return x >>> n | x << 32 - n;
  49346. }
  49347. function ch(x, y, z) {
  49348. return x & y ^ ~x & z;
  49349. }
  49350. function maj(x, y, z) {
  49351. return x & y ^ x & z ^ y & z;
  49352. }
  49353. function sigma(x) {
  49354. return rotr(x, 2) ^ rotr(x, 13) ^ rotr(x, 22);
  49355. }
  49356. function sigmaPrime(x) {
  49357. return rotr(x, 6) ^ rotr(x, 11) ^ rotr(x, 25);
  49358. }
  49359. function littleSigma(x) {
  49360. return rotr(x, 7) ^ rotr(x, 18) ^ x >>> 3;
  49361. }
  49362. function littleSigmaPrime(x) {
  49363. return rotr(x, 17) ^ rotr(x, 19) ^ x >>> 10;
  49364. }
  49365. 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];
  49366. function hash(data, offset, length) {
  49367. let h0 = 0x6a09e667,
  49368. h1 = 0xbb67ae85,
  49369. h2 = 0x3c6ef372,
  49370. h3 = 0xa54ff53a,
  49371. h4 = 0x510e527f,
  49372. h5 = 0x9b05688c,
  49373. h6 = 0x1f83d9ab,
  49374. h7 = 0x5be0cd19;
  49375. const paddedLength = Math.ceil((length + 9) / 64) * 64;
  49376. const padded = new Uint8Array(paddedLength);
  49377. let i, j;
  49378. for (i = 0; i < length; ++i) {
  49379. padded[i] = data[offset++];
  49380. }
  49381. padded[i++] = 0x80;
  49382. const n = paddedLength - 8;
  49383. while (i < n) {
  49384. padded[i++] = 0;
  49385. }
  49386. padded[i++] = 0;
  49387. padded[i++] = 0;
  49388. padded[i++] = 0;
  49389. padded[i++] = length >>> 29 & 0xff;
  49390. padded[i++] = length >> 21 & 0xff;
  49391. padded[i++] = length >> 13 & 0xff;
  49392. padded[i++] = length >> 5 & 0xff;
  49393. padded[i++] = length << 3 & 0xff;
  49394. const w = new Uint32Array(64);
  49395. for (i = 0; i < paddedLength;) {
  49396. for (j = 0; j < 16; ++j) {
  49397. w[j] = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  49398. i += 4;
  49399. }
  49400. for (j = 16; j < 64; ++j) {
  49401. w[j] = littleSigmaPrime(w[j - 2]) + w[j - 7] + littleSigma(w[j - 15]) + w[j - 16] | 0;
  49402. }
  49403. let a = h0,
  49404. b = h1,
  49405. c = h2,
  49406. d = h3,
  49407. e = h4,
  49408. f = h5,
  49409. g = h6,
  49410. h = h7,
  49411. t1,
  49412. t2;
  49413. for (j = 0; j < 64; ++j) {
  49414. t1 = h + sigmaPrime(e) + ch(e, f, g) + k[j] + w[j];
  49415. t2 = sigma(a) + maj(a, b, c);
  49416. h = g;
  49417. g = f;
  49418. f = e;
  49419. e = d + t1 | 0;
  49420. d = c;
  49421. c = b;
  49422. b = a;
  49423. a = t1 + t2 | 0;
  49424. }
  49425. h0 = h0 + a | 0;
  49426. h1 = h1 + b | 0;
  49427. h2 = h2 + c | 0;
  49428. h3 = h3 + d | 0;
  49429. h4 = h4 + e | 0;
  49430. h5 = h5 + f | 0;
  49431. h6 = h6 + g | 0;
  49432. h7 = h7 + h | 0;
  49433. }
  49434. 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]);
  49435. }
  49436. return hash;
  49437. }();
  49438. exports.calculateSHA256 = calculateSHA256;
  49439. const calculateSHA512 = function calculateSHA512Closure() {
  49440. function ch(result, x, y, z, tmp) {
  49441. result.assign(x);
  49442. result.and(y);
  49443. tmp.assign(x);
  49444. tmp.not();
  49445. tmp.and(z);
  49446. result.xor(tmp);
  49447. }
  49448. function maj(result, x, y, z, tmp) {
  49449. result.assign(x);
  49450. result.and(y);
  49451. tmp.assign(x);
  49452. tmp.and(z);
  49453. result.xor(tmp);
  49454. tmp.assign(y);
  49455. tmp.and(z);
  49456. result.xor(tmp);
  49457. }
  49458. function sigma(result, x, tmp) {
  49459. result.assign(x);
  49460. result.rotateRight(28);
  49461. tmp.assign(x);
  49462. tmp.rotateRight(34);
  49463. result.xor(tmp);
  49464. tmp.assign(x);
  49465. tmp.rotateRight(39);
  49466. result.xor(tmp);
  49467. }
  49468. function sigmaPrime(result, x, tmp) {
  49469. result.assign(x);
  49470. result.rotateRight(14);
  49471. tmp.assign(x);
  49472. tmp.rotateRight(18);
  49473. result.xor(tmp);
  49474. tmp.assign(x);
  49475. tmp.rotateRight(41);
  49476. result.xor(tmp);
  49477. }
  49478. function littleSigma(result, x, tmp) {
  49479. result.assign(x);
  49480. result.rotateRight(1);
  49481. tmp.assign(x);
  49482. tmp.rotateRight(8);
  49483. result.xor(tmp);
  49484. tmp.assign(x);
  49485. tmp.shiftRight(7);
  49486. result.xor(tmp);
  49487. }
  49488. function littleSigmaPrime(result, x, tmp) {
  49489. result.assign(x);
  49490. result.rotateRight(19);
  49491. tmp.assign(x);
  49492. tmp.rotateRight(61);
  49493. result.xor(tmp);
  49494. tmp.assign(x);
  49495. tmp.shiftRight(6);
  49496. result.xor(tmp);
  49497. }
  49498. 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)];
  49499. function hash(data, offset, length, mode384 = false) {
  49500. let h0, h1, h2, h3, h4, h5, h6, h7;
  49501. if (!mode384) {
  49502. h0 = new Word64(0x6a09e667, 0xf3bcc908);
  49503. h1 = new Word64(0xbb67ae85, 0x84caa73b);
  49504. h2 = new Word64(0x3c6ef372, 0xfe94f82b);
  49505. h3 = new Word64(0xa54ff53a, 0x5f1d36f1);
  49506. h4 = new Word64(0x510e527f, 0xade682d1);
  49507. h5 = new Word64(0x9b05688c, 0x2b3e6c1f);
  49508. h6 = new Word64(0x1f83d9ab, 0xfb41bd6b);
  49509. h7 = new Word64(0x5be0cd19, 0x137e2179);
  49510. } else {
  49511. h0 = new Word64(0xcbbb9d5d, 0xc1059ed8);
  49512. h1 = new Word64(0x629a292a, 0x367cd507);
  49513. h2 = new Word64(0x9159015a, 0x3070dd17);
  49514. h3 = new Word64(0x152fecd8, 0xf70e5939);
  49515. h4 = new Word64(0x67332667, 0xffc00b31);
  49516. h5 = new Word64(0x8eb44a87, 0x68581511);
  49517. h6 = new Word64(0xdb0c2e0d, 0x64f98fa7);
  49518. h7 = new Word64(0x47b5481d, 0xbefa4fa4);
  49519. }
  49520. const paddedLength = Math.ceil((length + 17) / 128) * 128;
  49521. const padded = new Uint8Array(paddedLength);
  49522. let i, j;
  49523. for (i = 0; i < length; ++i) {
  49524. padded[i] = data[offset++];
  49525. }
  49526. padded[i++] = 0x80;
  49527. const n = paddedLength - 16;
  49528. while (i < n) {
  49529. padded[i++] = 0;
  49530. }
  49531. padded[i++] = 0;
  49532. padded[i++] = 0;
  49533. padded[i++] = 0;
  49534. padded[i++] = 0;
  49535. padded[i++] = 0;
  49536. padded[i++] = 0;
  49537. padded[i++] = 0;
  49538. padded[i++] = 0;
  49539. padded[i++] = 0;
  49540. padded[i++] = 0;
  49541. padded[i++] = 0;
  49542. padded[i++] = length >>> 29 & 0xff;
  49543. padded[i++] = length >> 21 & 0xff;
  49544. padded[i++] = length >> 13 & 0xff;
  49545. padded[i++] = length >> 5 & 0xff;
  49546. padded[i++] = length << 3 & 0xff;
  49547. const w = new Array(80);
  49548. for (i = 0; i < 80; i++) {
  49549. w[i] = new Word64(0, 0);
  49550. }
  49551. let a = new Word64(0, 0),
  49552. b = new Word64(0, 0),
  49553. c = new Word64(0, 0);
  49554. let d = new Word64(0, 0),
  49555. e = new Word64(0, 0),
  49556. f = new Word64(0, 0);
  49557. let g = new Word64(0, 0),
  49558. h = new Word64(0, 0);
  49559. const t1 = new Word64(0, 0),
  49560. t2 = new Word64(0, 0);
  49561. const tmp1 = new Word64(0, 0),
  49562. tmp2 = new Word64(0, 0);
  49563. let tmp3;
  49564. for (i = 0; i < paddedLength;) {
  49565. for (j = 0; j < 16; ++j) {
  49566. w[j].high = padded[i] << 24 | padded[i + 1] << 16 | padded[i + 2] << 8 | padded[i + 3];
  49567. w[j].low = padded[i + 4] << 24 | padded[i + 5] << 16 | padded[i + 6] << 8 | padded[i + 7];
  49568. i += 8;
  49569. }
  49570. for (j = 16; j < 80; ++j) {
  49571. tmp3 = w[j];
  49572. littleSigmaPrime(tmp3, w[j - 2], tmp2);
  49573. tmp3.add(w[j - 7]);
  49574. littleSigma(tmp1, w[j - 15], tmp2);
  49575. tmp3.add(tmp1);
  49576. tmp3.add(w[j - 16]);
  49577. }
  49578. a.assign(h0);
  49579. b.assign(h1);
  49580. c.assign(h2);
  49581. d.assign(h3);
  49582. e.assign(h4);
  49583. f.assign(h5);
  49584. g.assign(h6);
  49585. h.assign(h7);
  49586. for (j = 0; j < 80; ++j) {
  49587. t1.assign(h);
  49588. sigmaPrime(tmp1, e, tmp2);
  49589. t1.add(tmp1);
  49590. ch(tmp1, e, f, g, tmp2);
  49591. t1.add(tmp1);
  49592. t1.add(k[j]);
  49593. t1.add(w[j]);
  49594. sigma(t2, a, tmp2);
  49595. maj(tmp1, a, b, c, tmp2);
  49596. t2.add(tmp1);
  49597. tmp3 = h;
  49598. h = g;
  49599. g = f;
  49600. f = e;
  49601. d.add(t1);
  49602. e = d;
  49603. d = c;
  49604. c = b;
  49605. b = a;
  49606. tmp3.assign(t1);
  49607. tmp3.add(t2);
  49608. a = tmp3;
  49609. }
  49610. h0.add(a);
  49611. h1.add(b);
  49612. h2.add(c);
  49613. h3.add(d);
  49614. h4.add(e);
  49615. h5.add(f);
  49616. h6.add(g);
  49617. h7.add(h);
  49618. }
  49619. let result;
  49620. if (!mode384) {
  49621. result = new Uint8Array(64);
  49622. h0.copyTo(result, 0);
  49623. h1.copyTo(result, 8);
  49624. h2.copyTo(result, 16);
  49625. h3.copyTo(result, 24);
  49626. h4.copyTo(result, 32);
  49627. h5.copyTo(result, 40);
  49628. h6.copyTo(result, 48);
  49629. h7.copyTo(result, 56);
  49630. } else {
  49631. result = new Uint8Array(48);
  49632. h0.copyTo(result, 0);
  49633. h1.copyTo(result, 8);
  49634. h2.copyTo(result, 16);
  49635. h3.copyTo(result, 24);
  49636. h4.copyTo(result, 32);
  49637. h5.copyTo(result, 40);
  49638. }
  49639. return result;
  49640. }
  49641. return hash;
  49642. }();
  49643. exports.calculateSHA512 = calculateSHA512;
  49644. function calculateSHA384(data, offset, length) {
  49645. return calculateSHA512(data, offset, length, true);
  49646. }
  49647. class NullCipher {
  49648. decryptBlock(data) {
  49649. return data;
  49650. }
  49651. encrypt(data) {
  49652. return data;
  49653. }
  49654. }
  49655. class AESBaseCipher {
  49656. constructor() {
  49657. if (this.constructor === AESBaseCipher) {
  49658. (0, _util.unreachable)("Cannot initialize AESBaseCipher.");
  49659. }
  49660. this._s = new Uint8Array([0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, 0xc3, 0x18, 0x96, 0x05, 0x9a, 0x07, 0x12, 0x80, 0xe2, 0xeb, 0x27, 0xb2, 0x75, 0x09, 0x83, 0x2c, 0x1a, 0x1b, 0x6e, 0x5a, 0xa0, 0x52, 0x3b, 0xd6, 0xb3, 0x29, 0xe3, 0x2f, 0x84, 0x53, 0xd1, 0x00, 0xed, 0x20, 0xfc, 0xb1, 0x5b, 0x6a, 0xcb, 0xbe, 0x39, 0x4a, 0x4c, 0x58, 0xcf, 0xd0, 0xef, 0xaa, 0xfb, 0x43, 0x4d, 0x33, 0x85, 0x45, 0xf9, 0x02, 0x7f, 0x50, 0x3c, 0x9f, 0xa8, 0x51, 0xa3, 0x40, 0x8f, 0x92, 0x9d, 0x38, 0xf5, 0xbc, 0xb6, 0xda, 0x21, 0x10, 0xff, 0xf3, 0xd2, 0xcd, 0x0c, 0x13, 0xec, 0x5f, 0x97, 0x44, 0x17, 0xc4, 0xa7, 0x7e, 0x3d, 0x64, 0x5d, 0x19, 0x73, 0x60, 0x81, 0x4f, 0xdc, 0x22, 0x2a, 0x90, 0x88, 0x46, 0xee, 0xb8, 0x14, 0xde, 0x5e, 0x0b, 0xdb, 0xe0, 0x32, 0x3a, 0x0a, 0x49, 0x06, 0x24, 0x5c, 0xc2, 0xd3, 0xac, 0x62, 0x91, 0x95, 0xe4, 0x79, 0xe7, 0xc8, 0x37, 0x6d, 0x8d, 0xd5, 0x4e, 0xa9, 0x6c, 0x56, 0xf4, 0xea, 0x65, 0x7a, 0xae, 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]);
  49661. 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]);
  49662. 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]);
  49663. this._mixCol = new Uint8Array(256);
  49664. for (let i = 0; i < 256; i++) {
  49665. if (i < 128) {
  49666. this._mixCol[i] = i << 1;
  49667. } else {
  49668. this._mixCol[i] = i << 1 ^ 0x1b;
  49669. }
  49670. }
  49671. this.buffer = new Uint8Array(16);
  49672. this.bufferPosition = 0;
  49673. }
  49674. _expandKey(cipherKey) {
  49675. (0, _util.unreachable)("Cannot call `_expandKey` on the base class");
  49676. }
  49677. _decrypt(input, key) {
  49678. let t, u, v;
  49679. const state = new Uint8Array(16);
  49680. state.set(input);
  49681. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49682. state[j] ^= key[k];
  49683. }
  49684. for (let i = this._cyclesOfRepetition - 1; i >= 1; --i) {
  49685. t = state[13];
  49686. state[13] = state[9];
  49687. state[9] = state[5];
  49688. state[5] = state[1];
  49689. state[1] = t;
  49690. t = state[14];
  49691. u = state[10];
  49692. state[14] = state[6];
  49693. state[10] = state[2];
  49694. state[6] = t;
  49695. state[2] = u;
  49696. t = state[15];
  49697. u = state[11];
  49698. v = state[7];
  49699. state[15] = state[3];
  49700. state[11] = t;
  49701. state[7] = u;
  49702. state[3] = v;
  49703. for (let j = 0; j < 16; ++j) {
  49704. state[j] = this._inv_s[state[j]];
  49705. }
  49706. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49707. state[j] ^= key[k];
  49708. }
  49709. for (let j = 0; j < 16; j += 4) {
  49710. const s0 = this._mix[state[j]];
  49711. const s1 = this._mix[state[j + 1]];
  49712. const s2 = this._mix[state[j + 2]];
  49713. const s3 = this._mix[state[j + 3]];
  49714. t = s0 ^ s1 >>> 8 ^ s1 << 24 ^ s2 >>> 16 ^ s2 << 16 ^ s3 >>> 24 ^ s3 << 8;
  49715. state[j] = t >>> 24 & 0xff;
  49716. state[j + 1] = t >> 16 & 0xff;
  49717. state[j + 2] = t >> 8 & 0xff;
  49718. state[j + 3] = t & 0xff;
  49719. }
  49720. }
  49721. t = state[13];
  49722. state[13] = state[9];
  49723. state[9] = state[5];
  49724. state[5] = state[1];
  49725. state[1] = t;
  49726. t = state[14];
  49727. u = state[10];
  49728. state[14] = state[6];
  49729. state[10] = state[2];
  49730. state[6] = t;
  49731. state[2] = u;
  49732. t = state[15];
  49733. u = state[11];
  49734. v = state[7];
  49735. state[15] = state[3];
  49736. state[11] = t;
  49737. state[7] = u;
  49738. state[3] = v;
  49739. for (let j = 0; j < 16; ++j) {
  49740. state[j] = this._inv_s[state[j]];
  49741. state[j] ^= key[j];
  49742. }
  49743. return state;
  49744. }
  49745. _encrypt(input, key) {
  49746. const s = this._s;
  49747. let t, u, v;
  49748. const state = new Uint8Array(16);
  49749. state.set(input);
  49750. for (let j = 0; j < 16; ++j) {
  49751. state[j] ^= key[j];
  49752. }
  49753. for (let i = 1; i < this._cyclesOfRepetition; i++) {
  49754. for (let j = 0; j < 16; ++j) {
  49755. state[j] = s[state[j]];
  49756. }
  49757. v = state[1];
  49758. state[1] = state[5];
  49759. state[5] = state[9];
  49760. state[9] = state[13];
  49761. state[13] = v;
  49762. v = state[2];
  49763. u = state[6];
  49764. state[2] = state[10];
  49765. state[6] = state[14];
  49766. state[10] = v;
  49767. state[14] = u;
  49768. v = state[3];
  49769. u = state[7];
  49770. t = state[11];
  49771. state[3] = state[15];
  49772. state[7] = v;
  49773. state[11] = u;
  49774. state[15] = t;
  49775. for (let j = 0; j < 16; j += 4) {
  49776. const s0 = state[j + 0];
  49777. const s1 = state[j + 1];
  49778. const s2 = state[j + 2];
  49779. const s3 = state[j + 3];
  49780. t = s0 ^ s1 ^ s2 ^ s3;
  49781. state[j + 0] ^= t ^ this._mixCol[s0 ^ s1];
  49782. state[j + 1] ^= t ^ this._mixCol[s1 ^ s2];
  49783. state[j + 2] ^= t ^ this._mixCol[s2 ^ s3];
  49784. state[j + 3] ^= t ^ this._mixCol[s3 ^ s0];
  49785. }
  49786. for (let j = 0, k = i * 16; j < 16; ++j, ++k) {
  49787. state[j] ^= key[k];
  49788. }
  49789. }
  49790. for (let j = 0; j < 16; ++j) {
  49791. state[j] = s[state[j]];
  49792. }
  49793. v = state[1];
  49794. state[1] = state[5];
  49795. state[5] = state[9];
  49796. state[9] = state[13];
  49797. state[13] = v;
  49798. v = state[2];
  49799. u = state[6];
  49800. state[2] = state[10];
  49801. state[6] = state[14];
  49802. state[10] = v;
  49803. state[14] = u;
  49804. v = state[3];
  49805. u = state[7];
  49806. t = state[11];
  49807. state[3] = state[15];
  49808. state[7] = v;
  49809. state[11] = u;
  49810. state[15] = t;
  49811. for (let j = 0, k = this._keySize; j < 16; ++j, ++k) {
  49812. state[j] ^= key[k];
  49813. }
  49814. return state;
  49815. }
  49816. _decryptBlock2(data, finalize) {
  49817. const sourceLength = data.length;
  49818. let buffer = this.buffer,
  49819. bufferLength = this.bufferPosition;
  49820. const result = [];
  49821. let iv = this.iv;
  49822. for (let i = 0; i < sourceLength; ++i) {
  49823. buffer[bufferLength] = data[i];
  49824. ++bufferLength;
  49825. if (bufferLength < 16) {
  49826. continue;
  49827. }
  49828. const plain = this._decrypt(buffer, this._key);
  49829. for (let j = 0; j < 16; ++j) {
  49830. plain[j] ^= iv[j];
  49831. }
  49832. iv = buffer;
  49833. result.push(plain);
  49834. buffer = new Uint8Array(16);
  49835. bufferLength = 0;
  49836. }
  49837. this.buffer = buffer;
  49838. this.bufferLength = bufferLength;
  49839. this.iv = iv;
  49840. if (result.length === 0) {
  49841. return new Uint8Array(0);
  49842. }
  49843. let outputLength = 16 * result.length;
  49844. if (finalize) {
  49845. const lastBlock = result[result.length - 1];
  49846. let psLen = lastBlock[15];
  49847. if (psLen <= 16) {
  49848. for (let i = 15, ii = 16 - psLen; i >= ii; --i) {
  49849. if (lastBlock[i] !== psLen) {
  49850. psLen = 0;
  49851. break;
  49852. }
  49853. }
  49854. outputLength -= psLen;
  49855. result[result.length - 1] = lastBlock.subarray(0, 16 - psLen);
  49856. }
  49857. }
  49858. const output = new Uint8Array(outputLength);
  49859. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49860. output.set(result[i], j);
  49861. }
  49862. return output;
  49863. }
  49864. decryptBlock(data, finalize, iv = null) {
  49865. const sourceLength = data.length;
  49866. const buffer = this.buffer;
  49867. let bufferLength = this.bufferPosition;
  49868. if (iv) {
  49869. this.iv = iv;
  49870. } else {
  49871. for (let i = 0; bufferLength < 16 && i < sourceLength; ++i, ++bufferLength) {
  49872. buffer[bufferLength] = data[i];
  49873. }
  49874. if (bufferLength < 16) {
  49875. this.bufferLength = bufferLength;
  49876. return new Uint8Array(0);
  49877. }
  49878. this.iv = buffer;
  49879. data = data.subarray(16);
  49880. }
  49881. this.buffer = new Uint8Array(16);
  49882. this.bufferLength = 0;
  49883. this.decryptBlock = this._decryptBlock2;
  49884. return this.decryptBlock(data, finalize);
  49885. }
  49886. encrypt(data, iv) {
  49887. const sourceLength = data.length;
  49888. let buffer = this.buffer,
  49889. bufferLength = this.bufferPosition;
  49890. const result = [];
  49891. if (!iv) {
  49892. iv = new Uint8Array(16);
  49893. }
  49894. for (let i = 0; i < sourceLength; ++i) {
  49895. buffer[bufferLength] = data[i];
  49896. ++bufferLength;
  49897. if (bufferLength < 16) {
  49898. continue;
  49899. }
  49900. for (let j = 0; j < 16; ++j) {
  49901. buffer[j] ^= iv[j];
  49902. }
  49903. const cipher = this._encrypt(buffer, this._key);
  49904. iv = cipher;
  49905. result.push(cipher);
  49906. buffer = new Uint8Array(16);
  49907. bufferLength = 0;
  49908. }
  49909. this.buffer = buffer;
  49910. this.bufferLength = bufferLength;
  49911. this.iv = iv;
  49912. if (result.length === 0) {
  49913. return new Uint8Array(0);
  49914. }
  49915. const outputLength = 16 * result.length;
  49916. const output = new Uint8Array(outputLength);
  49917. for (let i = 0, j = 0, ii = result.length; i < ii; ++i, j += 16) {
  49918. output.set(result[i], j);
  49919. }
  49920. return output;
  49921. }
  49922. }
  49923. class AES128Cipher extends AESBaseCipher {
  49924. constructor(key) {
  49925. super();
  49926. this._cyclesOfRepetition = 10;
  49927. this._keySize = 160;
  49928. 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]);
  49929. this._key = this._expandKey(key);
  49930. }
  49931. _expandKey(cipherKey) {
  49932. const b = 176;
  49933. const s = this._s;
  49934. const rcon = this._rcon;
  49935. const result = new Uint8Array(b);
  49936. result.set(cipherKey);
  49937. for (let j = 16, i = 1; j < b; ++i) {
  49938. let t1 = result[j - 3];
  49939. let t2 = result[j - 2];
  49940. let t3 = result[j - 1];
  49941. let t4 = result[j - 4];
  49942. t1 = s[t1];
  49943. t2 = s[t2];
  49944. t3 = s[t3];
  49945. t4 = s[t4];
  49946. t1 ^= rcon[i];
  49947. for (let n = 0; n < 4; ++n) {
  49948. result[j] = t1 ^= result[j - 16];
  49949. j++;
  49950. result[j] = t2 ^= result[j - 16];
  49951. j++;
  49952. result[j] = t3 ^= result[j - 16];
  49953. j++;
  49954. result[j] = t4 ^= result[j - 16];
  49955. j++;
  49956. }
  49957. }
  49958. return result;
  49959. }
  49960. }
  49961. exports.AES128Cipher = AES128Cipher;
  49962. class AES256Cipher extends AESBaseCipher {
  49963. constructor(key) {
  49964. super();
  49965. this._cyclesOfRepetition = 14;
  49966. this._keySize = 224;
  49967. this._key = this._expandKey(key);
  49968. }
  49969. _expandKey(cipherKey) {
  49970. const b = 240;
  49971. const s = this._s;
  49972. const result = new Uint8Array(b);
  49973. result.set(cipherKey);
  49974. let r = 1;
  49975. let t1, t2, t3, t4;
  49976. for (let j = 32, i = 1; j < b; ++i) {
  49977. if (j % 32 === 16) {
  49978. t1 = s[t1];
  49979. t2 = s[t2];
  49980. t3 = s[t3];
  49981. t4 = s[t4];
  49982. } else if (j % 32 === 0) {
  49983. t1 = result[j - 3];
  49984. t2 = result[j - 2];
  49985. t3 = result[j - 1];
  49986. t4 = result[j - 4];
  49987. t1 = s[t1];
  49988. t2 = s[t2];
  49989. t3 = s[t3];
  49990. t4 = s[t4];
  49991. t1 ^= r;
  49992. if ((r <<= 1) >= 256) {
  49993. r = (r ^ 0x1b) & 0xff;
  49994. }
  49995. }
  49996. for (let n = 0; n < 4; ++n) {
  49997. result[j] = t1 ^= result[j - 32];
  49998. j++;
  49999. result[j] = t2 ^= result[j - 32];
  50000. j++;
  50001. result[j] = t3 ^= result[j - 32];
  50002. j++;
  50003. result[j] = t4 ^= result[j - 32];
  50004. j++;
  50005. }
  50006. }
  50007. return result;
  50008. }
  50009. }
  50010. exports.AES256Cipher = AES256Cipher;
  50011. class PDF17 {
  50012. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  50013. const hashData = new Uint8Array(password.length + 56);
  50014. hashData.set(password, 0);
  50015. hashData.set(ownerValidationSalt, password.length);
  50016. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  50017. const result = calculateSHA256(hashData, 0, hashData.length);
  50018. return (0, _util.isArrayEqual)(result, ownerPassword);
  50019. }
  50020. checkUserPassword(password, userValidationSalt, userPassword) {
  50021. const hashData = new Uint8Array(password.length + 8);
  50022. hashData.set(password, 0);
  50023. hashData.set(userValidationSalt, password.length);
  50024. const result = calculateSHA256(hashData, 0, hashData.length);
  50025. return (0, _util.isArrayEqual)(result, userPassword);
  50026. }
  50027. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  50028. const hashData = new Uint8Array(password.length + 56);
  50029. hashData.set(password, 0);
  50030. hashData.set(ownerKeySalt, password.length);
  50031. hashData.set(userBytes, password.length + ownerKeySalt.length);
  50032. const key = calculateSHA256(hashData, 0, hashData.length);
  50033. const cipher = new AES256Cipher(key);
  50034. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  50035. }
  50036. getUserKey(password, userKeySalt, userEncryption) {
  50037. const hashData = new Uint8Array(password.length + 8);
  50038. hashData.set(password, 0);
  50039. hashData.set(userKeySalt, password.length);
  50040. const key = calculateSHA256(hashData, 0, hashData.length);
  50041. const cipher = new AES256Cipher(key);
  50042. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  50043. }
  50044. }
  50045. exports.PDF17 = PDF17;
  50046. const PDF20 = function PDF20Closure() {
  50047. function calculatePDF20Hash(password, input, userBytes) {
  50048. let k = calculateSHA256(input, 0, input.length).subarray(0, 32);
  50049. let e = [0];
  50050. let i = 0;
  50051. while (i < 64 || e[e.length - 1] > i - 32) {
  50052. const combinedLength = password.length + k.length + userBytes.length,
  50053. combinedArray = new Uint8Array(combinedLength);
  50054. let writeOffset = 0;
  50055. combinedArray.set(password, writeOffset);
  50056. writeOffset += password.length;
  50057. combinedArray.set(k, writeOffset);
  50058. writeOffset += k.length;
  50059. combinedArray.set(userBytes, writeOffset);
  50060. const k1 = new Uint8Array(combinedLength * 64);
  50061. for (let j = 0, pos = 0; j < 64; j++, pos += combinedLength) {
  50062. k1.set(combinedArray, pos);
  50063. }
  50064. const cipher = new AES128Cipher(k.subarray(0, 16));
  50065. e = cipher.encrypt(k1, k.subarray(16, 32));
  50066. let remainder = 0;
  50067. for (let z = 0; z < 16; z++) {
  50068. remainder *= 256 % 3;
  50069. remainder %= 3;
  50070. remainder += (e[z] >>> 0) % 3;
  50071. remainder %= 3;
  50072. }
  50073. if (remainder === 0) {
  50074. k = calculateSHA256(e, 0, e.length);
  50075. } else if (remainder === 1) {
  50076. k = calculateSHA384(e, 0, e.length);
  50077. } else if (remainder === 2) {
  50078. k = calculateSHA512(e, 0, e.length);
  50079. }
  50080. i++;
  50081. }
  50082. return k.subarray(0, 32);
  50083. }
  50084. class PDF20 {
  50085. hash(password, concatBytes, userBytes) {
  50086. return calculatePDF20Hash(password, concatBytes, userBytes);
  50087. }
  50088. checkOwnerPassword(password, ownerValidationSalt, userBytes, ownerPassword) {
  50089. const hashData = new Uint8Array(password.length + 56);
  50090. hashData.set(password, 0);
  50091. hashData.set(ownerValidationSalt, password.length);
  50092. hashData.set(userBytes, password.length + ownerValidationSalt.length);
  50093. const result = calculatePDF20Hash(password, hashData, userBytes);
  50094. return (0, _util.isArrayEqual)(result, ownerPassword);
  50095. }
  50096. checkUserPassword(password, userValidationSalt, userPassword) {
  50097. const hashData = new Uint8Array(password.length + 8);
  50098. hashData.set(password, 0);
  50099. hashData.set(userValidationSalt, password.length);
  50100. const result = calculatePDF20Hash(password, hashData, []);
  50101. return (0, _util.isArrayEqual)(result, userPassword);
  50102. }
  50103. getOwnerKey(password, ownerKeySalt, userBytes, ownerEncryption) {
  50104. const hashData = new Uint8Array(password.length + 56);
  50105. hashData.set(password, 0);
  50106. hashData.set(ownerKeySalt, password.length);
  50107. hashData.set(userBytes, password.length + ownerKeySalt.length);
  50108. const key = calculatePDF20Hash(password, hashData, userBytes);
  50109. const cipher = new AES256Cipher(key);
  50110. return cipher.decryptBlock(ownerEncryption, false, new Uint8Array(16));
  50111. }
  50112. getUserKey(password, userKeySalt, userEncryption) {
  50113. const hashData = new Uint8Array(password.length + 8);
  50114. hashData.set(password, 0);
  50115. hashData.set(userKeySalt, password.length);
  50116. const key = calculatePDF20Hash(password, hashData, []);
  50117. const cipher = new AES256Cipher(key);
  50118. return cipher.decryptBlock(userEncryption, false, new Uint8Array(16));
  50119. }
  50120. }
  50121. return PDF20;
  50122. }();
  50123. exports.PDF20 = PDF20;
  50124. class CipherTransform {
  50125. constructor(stringCipherConstructor, streamCipherConstructor) {
  50126. this.StringCipherConstructor = stringCipherConstructor;
  50127. this.StreamCipherConstructor = streamCipherConstructor;
  50128. }
  50129. createStream(stream, length) {
  50130. const cipher = new this.StreamCipherConstructor();
  50131. return new _decrypt_stream.DecryptStream(stream, length, function cipherTransformDecryptStream(data, finalize) {
  50132. return cipher.decryptBlock(data, finalize);
  50133. });
  50134. }
  50135. decryptString(s) {
  50136. const cipher = new this.StringCipherConstructor();
  50137. let data = (0, _util.stringToBytes)(s);
  50138. data = cipher.decryptBlock(data, true);
  50139. return (0, _util.bytesToString)(data);
  50140. }
  50141. encryptString(s) {
  50142. const cipher = new this.StringCipherConstructor();
  50143. if (cipher instanceof AESBaseCipher) {
  50144. const strLen = s.length;
  50145. const pad = 16 - strLen % 16;
  50146. s += String.fromCharCode(pad).repeat(pad);
  50147. const iv = new Uint8Array(16);
  50148. if (typeof crypto !== "undefined") {
  50149. crypto.getRandomValues(iv);
  50150. } else {
  50151. for (let i = 0; i < 16; i++) {
  50152. iv[i] = Math.floor(256 * Math.random());
  50153. }
  50154. }
  50155. let data = (0, _util.stringToBytes)(s);
  50156. data = cipher.encrypt(data, iv);
  50157. const buf = new Uint8Array(16 + data.length);
  50158. buf.set(iv);
  50159. buf.set(data, 16);
  50160. return (0, _util.bytesToString)(buf);
  50161. }
  50162. let data = (0, _util.stringToBytes)(s);
  50163. data = cipher.encrypt(data);
  50164. return (0, _util.bytesToString)(data);
  50165. }
  50166. }
  50167. const CipherTransformFactory = function CipherTransformFactoryClosure() {
  50168. const 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]);
  50169. function createEncryptionKey20(revision, password, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms) {
  50170. if (password) {
  50171. const passwordLength = Math.min(127, password.length);
  50172. password = password.subarray(0, passwordLength);
  50173. } else {
  50174. password = [];
  50175. }
  50176. let pdfAlgorithm;
  50177. if (revision === 6) {
  50178. pdfAlgorithm = new PDF20();
  50179. } else {
  50180. pdfAlgorithm = new PDF17();
  50181. }
  50182. if (pdfAlgorithm.checkUserPassword(password, userValidationSalt, userPassword)) {
  50183. return pdfAlgorithm.getUserKey(password, userKeySalt, userEncryption);
  50184. } else if (password.length && pdfAlgorithm.checkOwnerPassword(password, ownerValidationSalt, uBytes, ownerPassword)) {
  50185. return pdfAlgorithm.getOwnerKey(password, ownerKeySalt, uBytes, ownerEncryption);
  50186. }
  50187. return null;
  50188. }
  50189. function prepareKeyData(fileId, password, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata) {
  50190. const hashDataSize = 40 + ownerPassword.length + fileId.length;
  50191. const hashData = new Uint8Array(hashDataSize);
  50192. let i = 0,
  50193. j,
  50194. n;
  50195. if (password) {
  50196. n = Math.min(32, password.length);
  50197. for (; i < n; ++i) {
  50198. hashData[i] = password[i];
  50199. }
  50200. }
  50201. j = 0;
  50202. while (i < 32) {
  50203. hashData[i++] = defaultPasswordBytes[j++];
  50204. }
  50205. for (j = 0, n = ownerPassword.length; j < n; ++j) {
  50206. hashData[i++] = ownerPassword[j];
  50207. }
  50208. hashData[i++] = flags & 0xff;
  50209. hashData[i++] = flags >> 8 & 0xff;
  50210. hashData[i++] = flags >> 16 & 0xff;
  50211. hashData[i++] = flags >>> 24 & 0xff;
  50212. for (j = 0, n = fileId.length; j < n; ++j) {
  50213. hashData[i++] = fileId[j];
  50214. }
  50215. if (revision >= 4 && !encryptMetadata) {
  50216. hashData[i++] = 0xff;
  50217. hashData[i++] = 0xff;
  50218. hashData[i++] = 0xff;
  50219. hashData[i++] = 0xff;
  50220. }
  50221. let hash = calculateMD5(hashData, 0, i);
  50222. const keyLengthInBytes = keyLength >> 3;
  50223. if (revision >= 3) {
  50224. for (j = 0; j < 50; ++j) {
  50225. hash = calculateMD5(hash, 0, keyLengthInBytes);
  50226. }
  50227. }
  50228. const encryptionKey = hash.subarray(0, keyLengthInBytes);
  50229. let cipher, checkData;
  50230. if (revision >= 3) {
  50231. for (i = 0; i < 32; ++i) {
  50232. hashData[i] = defaultPasswordBytes[i];
  50233. }
  50234. for (j = 0, n = fileId.length; j < n; ++j) {
  50235. hashData[i++] = fileId[j];
  50236. }
  50237. cipher = new ARCFourCipher(encryptionKey);
  50238. checkData = cipher.encryptBlock(calculateMD5(hashData, 0, i));
  50239. n = encryptionKey.length;
  50240. const derivedKey = new Uint8Array(n);
  50241. for (j = 1; j <= 19; ++j) {
  50242. for (let k = 0; k < n; ++k) {
  50243. derivedKey[k] = encryptionKey[k] ^ j;
  50244. }
  50245. cipher = new ARCFourCipher(derivedKey);
  50246. checkData = cipher.encryptBlock(checkData);
  50247. }
  50248. for (j = 0, n = checkData.length; j < n; ++j) {
  50249. if (userPassword[j] !== checkData[j]) {
  50250. return null;
  50251. }
  50252. }
  50253. } else {
  50254. cipher = new ARCFourCipher(encryptionKey);
  50255. checkData = cipher.encryptBlock(defaultPasswordBytes);
  50256. for (j = 0, n = checkData.length; j < n; ++j) {
  50257. if (userPassword[j] !== checkData[j]) {
  50258. return null;
  50259. }
  50260. }
  50261. }
  50262. return encryptionKey;
  50263. }
  50264. function decodeUserPassword(password, ownerPassword, revision, keyLength) {
  50265. const hashData = new Uint8Array(32);
  50266. let i = 0;
  50267. const n = Math.min(32, password.length);
  50268. for (; i < n; ++i) {
  50269. hashData[i] = password[i];
  50270. }
  50271. let j = 0;
  50272. while (i < 32) {
  50273. hashData[i++] = defaultPasswordBytes[j++];
  50274. }
  50275. let hash = calculateMD5(hashData, 0, i);
  50276. const keyLengthInBytes = keyLength >> 3;
  50277. if (revision >= 3) {
  50278. for (j = 0; j < 50; ++j) {
  50279. hash = calculateMD5(hash, 0, hash.length);
  50280. }
  50281. }
  50282. let cipher, userPassword;
  50283. if (revision >= 3) {
  50284. userPassword = ownerPassword;
  50285. const derivedKey = new Uint8Array(keyLengthInBytes);
  50286. for (j = 19; j >= 0; j--) {
  50287. for (let k = 0; k < keyLengthInBytes; ++k) {
  50288. derivedKey[k] = hash[k] ^ j;
  50289. }
  50290. cipher = new ARCFourCipher(derivedKey);
  50291. userPassword = cipher.encryptBlock(userPassword);
  50292. }
  50293. } else {
  50294. cipher = new ARCFourCipher(hash.subarray(0, keyLengthInBytes));
  50295. userPassword = cipher.encryptBlock(ownerPassword);
  50296. }
  50297. return userPassword;
  50298. }
  50299. const identityName = _primitives.Name.get("Identity");
  50300. function buildObjectKey(num, gen, encryptionKey, isAes = false) {
  50301. const key = new Uint8Array(encryptionKey.length + 9);
  50302. const n = encryptionKey.length;
  50303. let i;
  50304. for (i = 0; i < n; ++i) {
  50305. key[i] = encryptionKey[i];
  50306. }
  50307. key[i++] = num & 0xff;
  50308. key[i++] = num >> 8 & 0xff;
  50309. key[i++] = num >> 16 & 0xff;
  50310. key[i++] = gen & 0xff;
  50311. key[i++] = gen >> 8 & 0xff;
  50312. if (isAes) {
  50313. key[i++] = 0x73;
  50314. key[i++] = 0x41;
  50315. key[i++] = 0x6c;
  50316. key[i++] = 0x54;
  50317. }
  50318. const hash = calculateMD5(key, 0, i);
  50319. return hash.subarray(0, Math.min(encryptionKey.length + 5, 16));
  50320. }
  50321. function buildCipherConstructor(cf, name, num, gen, key) {
  50322. if (!(name instanceof _primitives.Name)) {
  50323. throw new _util.FormatError("Invalid crypt filter name.");
  50324. }
  50325. const cryptFilter = cf.get(name.name);
  50326. let cfm;
  50327. if (cryptFilter !== null && cryptFilter !== undefined) {
  50328. cfm = cryptFilter.get("CFM");
  50329. }
  50330. if (!cfm || cfm.name === "None") {
  50331. return function cipherTransformFactoryBuildCipherConstructorNone() {
  50332. return new NullCipher();
  50333. };
  50334. }
  50335. if (cfm.name === "V2") {
  50336. return function cipherTransformFactoryBuildCipherConstructorV2() {
  50337. return new ARCFourCipher(buildObjectKey(num, gen, key, false));
  50338. };
  50339. }
  50340. if (cfm.name === "AESV2") {
  50341. return function cipherTransformFactoryBuildCipherConstructorAESV2() {
  50342. return new AES128Cipher(buildObjectKey(num, gen, key, true));
  50343. };
  50344. }
  50345. if (cfm.name === "AESV3") {
  50346. return function cipherTransformFactoryBuildCipherConstructorAESV3() {
  50347. return new AES256Cipher(key);
  50348. };
  50349. }
  50350. throw new _util.FormatError("Unknown crypto method");
  50351. }
  50352. class CipherTransformFactory {
  50353. constructor(dict, fileId, password) {
  50354. const filter = dict.get("Filter");
  50355. if (!(0, _primitives.isName)(filter, "Standard")) {
  50356. throw new _util.FormatError("unknown encryption method");
  50357. }
  50358. this.filterName = filter.name;
  50359. this.dict = dict;
  50360. const algorithm = dict.get("V");
  50361. if (!Number.isInteger(algorithm) || algorithm !== 1 && algorithm !== 2 && algorithm !== 4 && algorithm !== 5) {
  50362. throw new _util.FormatError("unsupported encryption algorithm");
  50363. }
  50364. this.algorithm = algorithm;
  50365. let keyLength = dict.get("Length");
  50366. if (!keyLength) {
  50367. if (algorithm <= 3) {
  50368. keyLength = 40;
  50369. } else {
  50370. const cfDict = dict.get("CF");
  50371. const streamCryptoName = dict.get("StmF");
  50372. if (cfDict instanceof _primitives.Dict && streamCryptoName instanceof _primitives.Name) {
  50373. cfDict.suppressEncryption = true;
  50374. const handlerDict = cfDict.get(streamCryptoName.name);
  50375. keyLength = handlerDict && handlerDict.get("Length") || 128;
  50376. if (keyLength < 40) {
  50377. keyLength <<= 3;
  50378. }
  50379. }
  50380. }
  50381. }
  50382. if (!Number.isInteger(keyLength) || keyLength < 40 || keyLength % 8 !== 0) {
  50383. throw new _util.FormatError("invalid key length");
  50384. }
  50385. const ownerPassword = (0, _util.stringToBytes)(dict.get("O")).subarray(0, 32);
  50386. const userPassword = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 32);
  50387. const flags = dict.get("P");
  50388. const revision = dict.get("R");
  50389. const encryptMetadata = (algorithm === 4 || algorithm === 5) && dict.get("EncryptMetadata") !== false;
  50390. this.encryptMetadata = encryptMetadata;
  50391. const fileIdBytes = (0, _util.stringToBytes)(fileId);
  50392. let passwordBytes;
  50393. if (password) {
  50394. if (revision === 6) {
  50395. try {
  50396. password = (0, _util.utf8StringToString)(password);
  50397. } catch (ex) {
  50398. (0, _util.warn)("CipherTransformFactory: " + "Unable to convert UTF8 encoded password.");
  50399. }
  50400. }
  50401. passwordBytes = (0, _util.stringToBytes)(password);
  50402. }
  50403. let encryptionKey;
  50404. if (algorithm !== 5) {
  50405. encryptionKey = prepareKeyData(fileIdBytes, passwordBytes, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  50406. } else {
  50407. const ownerValidationSalt = (0, _util.stringToBytes)(dict.get("O")).subarray(32, 40);
  50408. const ownerKeySalt = (0, _util.stringToBytes)(dict.get("O")).subarray(40, 48);
  50409. const uBytes = (0, _util.stringToBytes)(dict.get("U")).subarray(0, 48);
  50410. const userValidationSalt = (0, _util.stringToBytes)(dict.get("U")).subarray(32, 40);
  50411. const userKeySalt = (0, _util.stringToBytes)(dict.get("U")).subarray(40, 48);
  50412. const ownerEncryption = (0, _util.stringToBytes)(dict.get("OE"));
  50413. const userEncryption = (0, _util.stringToBytes)(dict.get("UE"));
  50414. const perms = (0, _util.stringToBytes)(dict.get("Perms"));
  50415. encryptionKey = createEncryptionKey20(revision, passwordBytes, ownerPassword, ownerValidationSalt, ownerKeySalt, uBytes, userPassword, userValidationSalt, userKeySalt, ownerEncryption, userEncryption, perms);
  50416. }
  50417. if (!encryptionKey && !password) {
  50418. throw new _util.PasswordException("No password given", _util.PasswordResponses.NEED_PASSWORD);
  50419. } else if (!encryptionKey && password) {
  50420. const decodedPassword = decodeUserPassword(passwordBytes, ownerPassword, revision, keyLength);
  50421. encryptionKey = prepareKeyData(fileIdBytes, decodedPassword, ownerPassword, userPassword, flags, revision, keyLength, encryptMetadata);
  50422. }
  50423. if (!encryptionKey) {
  50424. throw new _util.PasswordException("Incorrect Password", _util.PasswordResponses.INCORRECT_PASSWORD);
  50425. }
  50426. this.encryptionKey = encryptionKey;
  50427. if (algorithm >= 4) {
  50428. const cf = dict.get("CF");
  50429. if (cf instanceof _primitives.Dict) {
  50430. cf.suppressEncryption = true;
  50431. }
  50432. this.cf = cf;
  50433. this.stmf = dict.get("StmF") || identityName;
  50434. this.strf = dict.get("StrF") || identityName;
  50435. this.eff = dict.get("EFF") || this.stmf;
  50436. }
  50437. }
  50438. createCipherTransform(num, gen) {
  50439. if (this.algorithm === 4 || this.algorithm === 5) {
  50440. return new CipherTransform(buildCipherConstructor(this.cf, this.stmf, num, gen, this.encryptionKey), buildCipherConstructor(this.cf, this.strf, num, gen, this.encryptionKey));
  50441. }
  50442. const key = buildObjectKey(num, gen, this.encryptionKey, false);
  50443. const cipherConstructor = function buildCipherCipherConstructor() {
  50444. return new ARCFourCipher(key);
  50445. };
  50446. return new CipherTransform(cipherConstructor, cipherConstructor);
  50447. }
  50448. }
  50449. return CipherTransformFactory;
  50450. }();
  50451. exports.CipherTransformFactory = CipherTransformFactory;
  50452. /***/ }),
  50453. /* 75 */
  50454. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50455. Object.defineProperty(exports, "__esModule", ({
  50456. value: true
  50457. }));
  50458. exports.DecryptStream = void 0;
  50459. var _decode_stream = __w_pdfjs_require__(29);
  50460. const chunkSize = 512;
  50461. class DecryptStream extends _decode_stream.DecodeStream {
  50462. constructor(str, maybeLength, decrypt) {
  50463. super(maybeLength);
  50464. this.str = str;
  50465. this.dict = str.dict;
  50466. this.decrypt = decrypt;
  50467. this.nextChunk = null;
  50468. this.initialized = false;
  50469. }
  50470. readBlock() {
  50471. let chunk;
  50472. if (this.initialized) {
  50473. chunk = this.nextChunk;
  50474. } else {
  50475. chunk = this.str.getBytes(chunkSize);
  50476. this.initialized = true;
  50477. }
  50478. if (!chunk || chunk.length === 0) {
  50479. this.eof = true;
  50480. return;
  50481. }
  50482. this.nextChunk = this.str.getBytes(chunkSize);
  50483. const hasMoreData = this.nextChunk && this.nextChunk.length > 0;
  50484. const decrypt = this.decrypt;
  50485. chunk = decrypt(chunk, !hasMoreData);
  50486. let bufferLength = this.bufferLength;
  50487. const n = chunk.length,
  50488. buffer = this.ensureBuffer(bufferLength + n);
  50489. for (let i = 0; i < n; i++) {
  50490. buffer[bufferLength++] = chunk[i];
  50491. }
  50492. this.bufferLength = bufferLength;
  50493. }
  50494. }
  50495. exports.DecryptStream = DecryptStream;
  50496. /***/ }),
  50497. /* 76 */
  50498. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50499. Object.defineProperty(exports, "__esModule", ({
  50500. value: true
  50501. }));
  50502. exports.XFAFactory = void 0;
  50503. var _xfa_object = __w_pdfjs_require__(77);
  50504. var _bind = __w_pdfjs_require__(81);
  50505. var _data = __w_pdfjs_require__(87);
  50506. var _fonts = __w_pdfjs_require__(85);
  50507. var _utils = __w_pdfjs_require__(78);
  50508. var _util = __w_pdfjs_require__(2);
  50509. var _parser = __w_pdfjs_require__(88);
  50510. var _xhtml = __w_pdfjs_require__(98);
  50511. class XFAFactory {
  50512. constructor(data) {
  50513. try {
  50514. this.root = new _parser.XFAParser().parse(XFAFactory._createDocument(data));
  50515. const binder = new _bind.Binder(this.root);
  50516. this.form = binder.bind();
  50517. this.dataHandler = new _data.DataHandler(this.root, binder.getData());
  50518. this.form[_xfa_object.$globalData].template = this.form;
  50519. } catch (e) {
  50520. (0, _util.warn)(`XFA - an error occurred during parsing and binding: ${e}`);
  50521. }
  50522. }
  50523. isValid() {
  50524. return this.root && this.form;
  50525. }
  50526. _createPagesHelper() {
  50527. const iterator = this.form[_xfa_object.$toPages]();
  50528. return new Promise((resolve, reject) => {
  50529. const nextIteration = () => {
  50530. try {
  50531. const value = iterator.next();
  50532. if (value.done) {
  50533. resolve(value.value);
  50534. } else {
  50535. setTimeout(nextIteration, 0);
  50536. }
  50537. } catch (e) {
  50538. reject(e);
  50539. }
  50540. };
  50541. setTimeout(nextIteration, 0);
  50542. });
  50543. }
  50544. async _createPages() {
  50545. try {
  50546. this.pages = await this._createPagesHelper();
  50547. this.dims = this.pages.children.map(c => {
  50548. const {
  50549. width,
  50550. height
  50551. } = c.attributes.style;
  50552. return [0, 0, parseInt(width), parseInt(height)];
  50553. });
  50554. } catch (e) {
  50555. (0, _util.warn)(`XFA - an error occurred during layout: ${e}`);
  50556. }
  50557. }
  50558. getBoundingBox(pageIndex) {
  50559. return this.dims[pageIndex];
  50560. }
  50561. async getNumPages() {
  50562. if (!this.pages) {
  50563. await this._createPages();
  50564. }
  50565. return this.dims.length;
  50566. }
  50567. setImages(images) {
  50568. this.form[_xfa_object.$globalData].images = images;
  50569. }
  50570. setFonts(fonts) {
  50571. this.form[_xfa_object.$globalData].fontFinder = new _fonts.FontFinder(fonts);
  50572. const missingFonts = [];
  50573. for (let typeface of this.form[_xfa_object.$globalData].usedTypefaces) {
  50574. typeface = (0, _utils.stripQuotes)(typeface);
  50575. const font = this.form[_xfa_object.$globalData].fontFinder.find(typeface);
  50576. if (!font) {
  50577. missingFonts.push(typeface);
  50578. }
  50579. }
  50580. if (missingFonts.length > 0) {
  50581. return missingFonts;
  50582. }
  50583. return null;
  50584. }
  50585. appendFonts(fonts, reallyMissingFonts) {
  50586. this.form[_xfa_object.$globalData].fontFinder.add(fonts, reallyMissingFonts);
  50587. }
  50588. async getPages() {
  50589. if (!this.pages) {
  50590. await this._createPages();
  50591. }
  50592. const pages = this.pages;
  50593. this.pages = null;
  50594. return pages;
  50595. }
  50596. serializeData(storage) {
  50597. return this.dataHandler.serialize(storage);
  50598. }
  50599. static _createDocument(data) {
  50600. if (!data["/xdp:xdp"]) {
  50601. return data["xdp:xdp"];
  50602. }
  50603. return Object.values(data).join("");
  50604. }
  50605. static getRichTextAsHtml(rc) {
  50606. if (!rc || typeof rc !== "string") {
  50607. return null;
  50608. }
  50609. try {
  50610. let root = new _parser.XFAParser(_xhtml.XhtmlNamespace, true).parse(rc);
  50611. if (!["body", "xhtml"].includes(root[_xfa_object.$nodeName])) {
  50612. const newRoot = _xhtml.XhtmlNamespace.body({});
  50613. newRoot[_xfa_object.$appendChild](root);
  50614. root = newRoot;
  50615. }
  50616. const result = root[_xfa_object.$toHTML]();
  50617. if (!result.success) {
  50618. return null;
  50619. }
  50620. const {
  50621. html
  50622. } = result;
  50623. const {
  50624. attributes
  50625. } = html;
  50626. if (attributes) {
  50627. if (attributes.class) {
  50628. attributes.class = attributes.class.filter(attr => !attr.startsWith("xfa"));
  50629. }
  50630. attributes.dir = "auto";
  50631. }
  50632. return {
  50633. html,
  50634. str: root[_xfa_object.$text]()
  50635. };
  50636. } catch (e) {
  50637. (0, _util.warn)(`XFA - an error occurred during parsing of rich text: ${e}`);
  50638. }
  50639. return null;
  50640. }
  50641. }
  50642. exports.XFAFactory = XFAFactory;
  50643. /***/ }),
  50644. /* 77 */
  50645. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  50646. Object.defineProperty(exports, "__esModule", ({
  50647. value: true
  50648. }));
  50649. exports.XmlObject = exports.XFAObjectArray = exports.XFAObject = exports.XFAAttribute = exports.StringObject = exports.OptionObject = exports.Option10 = exports.Option01 = exports.IntegerObject = exports.ContentObject = exports.$uid = exports.$toStyle = exports.$toString = exports.$toPages = exports.$toHTML = exports.$text = exports.$tabIndex = exports.$setValue = exports.$setSetAttributes = exports.$setId = exports.$searchNode = exports.$root = exports.$resolvePrototypes = exports.$removeChild = exports.$pushPara = exports.$pushGlyphs = exports.$popPara = exports.$onText = exports.$onChildCheck = exports.$onChild = exports.$nsAttributes = exports.$nodeName = exports.$namespaceId = exports.$isUsable = exports.$isTransparent = exports.$isThereMoreWidth = exports.$isSplittable = exports.$isNsAgnostic = exports.$isDescendent = exports.$isDataValue = exports.$isCDATAXml = exports.$isBindable = exports.$insertAt = exports.$indexOf = exports.$ids = exports.$hasSettableValue = exports.$globalData = exports.$getTemplateRoot = exports.$getSubformParent = exports.$getRealChildrenByNameIt = exports.$getParent = exports.$getNextPage = exports.$getExtra = exports.$getDataValue = exports.$getContainedChildren = exports.$getChildrenByNameIt = exports.$getChildrenByName = exports.$getChildrenByClass = exports.$getChildren = exports.$getAvailableSpace = exports.$getAttributes = exports.$getAttributeIt = exports.$flushHTML = exports.$finalize = exports.$extra = exports.$dump = exports.$data = exports.$content = exports.$consumed = exports.$clone = exports.$cleanup = exports.$cleanPage = exports.$clean = exports.$childrenToHTML = exports.$appendChild = exports.$addHTML = exports.$acceptWhitespace = void 0;
  50650. var _utils = __w_pdfjs_require__(78);
  50651. var _util = __w_pdfjs_require__(2);
  50652. var _core_utils = __w_pdfjs_require__(8);
  50653. var _namespaces = __w_pdfjs_require__(79);
  50654. var _som = __w_pdfjs_require__(80);
  50655. const $acceptWhitespace = Symbol();
  50656. exports.$acceptWhitespace = $acceptWhitespace;
  50657. const $addHTML = Symbol();
  50658. exports.$addHTML = $addHTML;
  50659. const $appendChild = Symbol();
  50660. exports.$appendChild = $appendChild;
  50661. const $childrenToHTML = Symbol();
  50662. exports.$childrenToHTML = $childrenToHTML;
  50663. const $clean = Symbol();
  50664. exports.$clean = $clean;
  50665. const $cleanPage = Symbol();
  50666. exports.$cleanPage = $cleanPage;
  50667. const $cleanup = Symbol();
  50668. exports.$cleanup = $cleanup;
  50669. const $clone = Symbol();
  50670. exports.$clone = $clone;
  50671. const $consumed = Symbol();
  50672. exports.$consumed = $consumed;
  50673. const $content = Symbol("content");
  50674. exports.$content = $content;
  50675. const $data = Symbol("data");
  50676. exports.$data = $data;
  50677. const $dump = Symbol();
  50678. exports.$dump = $dump;
  50679. const $extra = Symbol("extra");
  50680. exports.$extra = $extra;
  50681. const $finalize = Symbol();
  50682. exports.$finalize = $finalize;
  50683. const $flushHTML = Symbol();
  50684. exports.$flushHTML = $flushHTML;
  50685. const $getAttributeIt = Symbol();
  50686. exports.$getAttributeIt = $getAttributeIt;
  50687. const $getAttributes = Symbol();
  50688. exports.$getAttributes = $getAttributes;
  50689. const $getAvailableSpace = Symbol();
  50690. exports.$getAvailableSpace = $getAvailableSpace;
  50691. const $getChildrenByClass = Symbol();
  50692. exports.$getChildrenByClass = $getChildrenByClass;
  50693. const $getChildrenByName = Symbol();
  50694. exports.$getChildrenByName = $getChildrenByName;
  50695. const $getChildrenByNameIt = Symbol();
  50696. exports.$getChildrenByNameIt = $getChildrenByNameIt;
  50697. const $getDataValue = Symbol();
  50698. exports.$getDataValue = $getDataValue;
  50699. const $getExtra = Symbol();
  50700. exports.$getExtra = $getExtra;
  50701. const $getRealChildrenByNameIt = Symbol();
  50702. exports.$getRealChildrenByNameIt = $getRealChildrenByNameIt;
  50703. const $getChildren = Symbol();
  50704. exports.$getChildren = $getChildren;
  50705. const $getContainedChildren = Symbol();
  50706. exports.$getContainedChildren = $getContainedChildren;
  50707. const $getNextPage = Symbol();
  50708. exports.$getNextPage = $getNextPage;
  50709. const $getSubformParent = Symbol();
  50710. exports.$getSubformParent = $getSubformParent;
  50711. const $getParent = Symbol();
  50712. exports.$getParent = $getParent;
  50713. const $getTemplateRoot = Symbol();
  50714. exports.$getTemplateRoot = $getTemplateRoot;
  50715. const $globalData = Symbol();
  50716. exports.$globalData = $globalData;
  50717. const $hasSettableValue = Symbol();
  50718. exports.$hasSettableValue = $hasSettableValue;
  50719. const $ids = Symbol();
  50720. exports.$ids = $ids;
  50721. const $indexOf = Symbol();
  50722. exports.$indexOf = $indexOf;
  50723. const $insertAt = Symbol();
  50724. exports.$insertAt = $insertAt;
  50725. const $isCDATAXml = Symbol();
  50726. exports.$isCDATAXml = $isCDATAXml;
  50727. const $isBindable = Symbol();
  50728. exports.$isBindable = $isBindable;
  50729. const $isDataValue = Symbol();
  50730. exports.$isDataValue = $isDataValue;
  50731. const $isDescendent = Symbol();
  50732. exports.$isDescendent = $isDescendent;
  50733. const $isNsAgnostic = Symbol();
  50734. exports.$isNsAgnostic = $isNsAgnostic;
  50735. const $isSplittable = Symbol();
  50736. exports.$isSplittable = $isSplittable;
  50737. const $isThereMoreWidth = Symbol();
  50738. exports.$isThereMoreWidth = $isThereMoreWidth;
  50739. const $isTransparent = Symbol();
  50740. exports.$isTransparent = $isTransparent;
  50741. const $isUsable = Symbol();
  50742. exports.$isUsable = $isUsable;
  50743. const $lastAttribute = Symbol();
  50744. const $namespaceId = Symbol("namespaceId");
  50745. exports.$namespaceId = $namespaceId;
  50746. const $nodeName = Symbol("nodeName");
  50747. exports.$nodeName = $nodeName;
  50748. const $nsAttributes = Symbol();
  50749. exports.$nsAttributes = $nsAttributes;
  50750. const $onChild = Symbol();
  50751. exports.$onChild = $onChild;
  50752. const $onChildCheck = Symbol();
  50753. exports.$onChildCheck = $onChildCheck;
  50754. const $onText = Symbol();
  50755. exports.$onText = $onText;
  50756. const $pushGlyphs = Symbol();
  50757. exports.$pushGlyphs = $pushGlyphs;
  50758. const $popPara = Symbol();
  50759. exports.$popPara = $popPara;
  50760. const $pushPara = Symbol();
  50761. exports.$pushPara = $pushPara;
  50762. const $removeChild = Symbol();
  50763. exports.$removeChild = $removeChild;
  50764. const $root = Symbol("root");
  50765. exports.$root = $root;
  50766. const $resolvePrototypes = Symbol();
  50767. exports.$resolvePrototypes = $resolvePrototypes;
  50768. const $searchNode = Symbol();
  50769. exports.$searchNode = $searchNode;
  50770. const $setId = Symbol();
  50771. exports.$setId = $setId;
  50772. const $setSetAttributes = Symbol();
  50773. exports.$setSetAttributes = $setSetAttributes;
  50774. const $setValue = Symbol();
  50775. exports.$setValue = $setValue;
  50776. const $tabIndex = Symbol();
  50777. exports.$tabIndex = $tabIndex;
  50778. const $text = Symbol();
  50779. exports.$text = $text;
  50780. const $toPages = Symbol();
  50781. exports.$toPages = $toPages;
  50782. const $toHTML = Symbol();
  50783. exports.$toHTML = $toHTML;
  50784. const $toString = Symbol();
  50785. exports.$toString = $toString;
  50786. const $toStyle = Symbol();
  50787. exports.$toStyle = $toStyle;
  50788. const $uid = Symbol("uid");
  50789. exports.$uid = $uid;
  50790. const _applyPrototype = Symbol();
  50791. const _attributes = Symbol();
  50792. const _attributeNames = Symbol();
  50793. const _children = Symbol("_children");
  50794. const _cloneAttribute = Symbol();
  50795. const _dataValue = Symbol();
  50796. const _defaultValue = Symbol();
  50797. const _filteredChildrenGenerator = Symbol();
  50798. const _getPrototype = Symbol();
  50799. const _getUnsetAttributes = Symbol();
  50800. const _hasChildren = Symbol();
  50801. const _max = Symbol();
  50802. const _options = Symbol();
  50803. const _parent = Symbol("parent");
  50804. const _resolvePrototypesHelper = Symbol();
  50805. const _setAttributes = Symbol();
  50806. const _validator = Symbol();
  50807. let uid = 0;
  50808. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  50809. class XFAObject {
  50810. constructor(nsId, name, hasChildren = false) {
  50811. this[$namespaceId] = nsId;
  50812. this[$nodeName] = name;
  50813. this[_hasChildren] = hasChildren;
  50814. this[_parent] = null;
  50815. this[_children] = [];
  50816. this[$uid] = `${name}${uid++}`;
  50817. this[$globalData] = null;
  50818. }
  50819. [$onChild](child) {
  50820. if (!this[_hasChildren] || !this[$onChildCheck](child)) {
  50821. return false;
  50822. }
  50823. const name = child[$nodeName];
  50824. const node = this[name];
  50825. if (node instanceof XFAObjectArray) {
  50826. if (node.push(child)) {
  50827. this[$appendChild](child);
  50828. return true;
  50829. }
  50830. } else {
  50831. if (node !== null) {
  50832. this[$removeChild](node);
  50833. }
  50834. this[name] = child;
  50835. this[$appendChild](child);
  50836. return true;
  50837. }
  50838. let id = "";
  50839. if (this.id) {
  50840. id = ` (id: ${this.id})`;
  50841. } else if (this.name) {
  50842. id = ` (name: ${this.name} ${this.h.value})`;
  50843. }
  50844. (0, _util.warn)(`XFA - node "${this[$nodeName]}"${id} has already enough "${name}"!`);
  50845. return false;
  50846. }
  50847. [$onChildCheck](child) {
  50848. return this.hasOwnProperty(child[$nodeName]) && child[$namespaceId] === this[$namespaceId];
  50849. }
  50850. [$isNsAgnostic]() {
  50851. return false;
  50852. }
  50853. [$acceptWhitespace]() {
  50854. return false;
  50855. }
  50856. [$isCDATAXml]() {
  50857. return false;
  50858. }
  50859. [$isBindable]() {
  50860. return false;
  50861. }
  50862. [$popPara]() {
  50863. if (this.para) {
  50864. this[$getTemplateRoot]()[$extra].paraStack.pop();
  50865. }
  50866. }
  50867. [$pushPara]() {
  50868. this[$getTemplateRoot]()[$extra].paraStack.push(this.para);
  50869. }
  50870. [$setId](ids) {
  50871. if (this.id && this[$namespaceId] === _namespaces.NamespaceIds.template.id) {
  50872. ids.set(this.id, this);
  50873. }
  50874. }
  50875. [$getTemplateRoot]() {
  50876. return this[$globalData].template;
  50877. }
  50878. [$isSplittable]() {
  50879. return false;
  50880. }
  50881. [$isThereMoreWidth]() {
  50882. return false;
  50883. }
  50884. [$appendChild](child) {
  50885. child[_parent] = this;
  50886. this[_children].push(child);
  50887. if (!child[$globalData] && this[$globalData]) {
  50888. child[$globalData] = this[$globalData];
  50889. }
  50890. }
  50891. [$removeChild](child) {
  50892. const i = this[_children].indexOf(child);
  50893. this[_children].splice(i, 1);
  50894. }
  50895. [$hasSettableValue]() {
  50896. return this.hasOwnProperty("value");
  50897. }
  50898. [$setValue](_) {}
  50899. [$onText](_) {}
  50900. [$finalize]() {}
  50901. [$clean](builder) {
  50902. delete this[_hasChildren];
  50903. if (this[$cleanup]) {
  50904. builder.clean(this[$cleanup]);
  50905. delete this[$cleanup];
  50906. }
  50907. }
  50908. [$indexOf](child) {
  50909. return this[_children].indexOf(child);
  50910. }
  50911. [$insertAt](i, child) {
  50912. child[_parent] = this;
  50913. this[_children].splice(i, 0, child);
  50914. if (!child[$globalData] && this[$globalData]) {
  50915. child[$globalData] = this[$globalData];
  50916. }
  50917. }
  50918. [$isTransparent]() {
  50919. return !this.name;
  50920. }
  50921. [$lastAttribute]() {
  50922. return "";
  50923. }
  50924. [$text]() {
  50925. if (this[_children].length === 0) {
  50926. return this[$content];
  50927. }
  50928. return this[_children].map(c => c[$text]()).join("");
  50929. }
  50930. get [_attributeNames]() {
  50931. const proto = Object.getPrototypeOf(this);
  50932. if (!proto._attributes) {
  50933. const attributes = proto._attributes = new Set();
  50934. for (const name of Object.getOwnPropertyNames(this)) {
  50935. if (this[name] === null || this[name] instanceof XFAObject || this[name] instanceof XFAObjectArray) {
  50936. break;
  50937. }
  50938. attributes.add(name);
  50939. }
  50940. }
  50941. return (0, _util.shadow)(this, _attributeNames, proto._attributes);
  50942. }
  50943. [$isDescendent](parent) {
  50944. let node = this;
  50945. while (node) {
  50946. if (node === parent) {
  50947. return true;
  50948. }
  50949. node = node[$getParent]();
  50950. }
  50951. return false;
  50952. }
  50953. [$getParent]() {
  50954. return this[_parent];
  50955. }
  50956. [$getSubformParent]() {
  50957. return this[$getParent]();
  50958. }
  50959. [$getChildren](name = null) {
  50960. if (!name) {
  50961. return this[_children];
  50962. }
  50963. return this[name];
  50964. }
  50965. [$dump]() {
  50966. const dumped = Object.create(null);
  50967. if (this[$content]) {
  50968. dumped.$content = this[$content];
  50969. }
  50970. for (const name of Object.getOwnPropertyNames(this)) {
  50971. const value = this[name];
  50972. if (value === null) {
  50973. continue;
  50974. }
  50975. if (value instanceof XFAObject) {
  50976. dumped[name] = value[$dump]();
  50977. } else if (value instanceof XFAObjectArray) {
  50978. if (!value.isEmpty()) {
  50979. dumped[name] = value.dump();
  50980. }
  50981. } else {
  50982. dumped[name] = value;
  50983. }
  50984. }
  50985. return dumped;
  50986. }
  50987. [$toStyle]() {
  50988. return null;
  50989. }
  50990. [$toHTML]() {
  50991. return _utils.HTMLResult.EMPTY;
  50992. }
  50993. *[$getContainedChildren]() {
  50994. for (const node of this[$getChildren]()) {
  50995. yield node;
  50996. }
  50997. }
  50998. *[_filteredChildrenGenerator](filter, include) {
  50999. for (const node of this[$getContainedChildren]()) {
  51000. if (!filter || include === filter.has(node[$nodeName])) {
  51001. const availableSpace = this[$getAvailableSpace]();
  51002. const res = node[$toHTML](availableSpace);
  51003. if (!res.success) {
  51004. this[$extra].failingNode = node;
  51005. }
  51006. yield res;
  51007. }
  51008. }
  51009. }
  51010. [$flushHTML]() {
  51011. return null;
  51012. }
  51013. [$addHTML](html, bbox) {
  51014. this[$extra].children.push(html);
  51015. }
  51016. [$getAvailableSpace]() {}
  51017. [$childrenToHTML]({
  51018. filter = null,
  51019. include = true
  51020. }) {
  51021. if (!this[$extra].generator) {
  51022. this[$extra].generator = this[_filteredChildrenGenerator](filter, include);
  51023. } else {
  51024. const availableSpace = this[$getAvailableSpace]();
  51025. const res = this[$extra].failingNode[$toHTML](availableSpace);
  51026. if (!res.success) {
  51027. return res;
  51028. }
  51029. if (res.html) {
  51030. this[$addHTML](res.html, res.bbox);
  51031. }
  51032. delete this[$extra].failingNode;
  51033. }
  51034. while (true) {
  51035. const gen = this[$extra].generator.next();
  51036. if (gen.done) {
  51037. break;
  51038. }
  51039. const res = gen.value;
  51040. if (!res.success) {
  51041. return res;
  51042. }
  51043. if (res.html) {
  51044. this[$addHTML](res.html, res.bbox);
  51045. }
  51046. }
  51047. this[$extra].generator = null;
  51048. return _utils.HTMLResult.EMPTY;
  51049. }
  51050. [$setSetAttributes](attributes) {
  51051. this[_setAttributes] = new Set(Object.keys(attributes));
  51052. }
  51053. [_getUnsetAttributes](protoAttributes) {
  51054. const allAttr = this[_attributeNames];
  51055. const setAttr = this[_setAttributes];
  51056. return [...protoAttributes].filter(x => allAttr.has(x) && !setAttr.has(x));
  51057. }
  51058. [$resolvePrototypes](ids, ancestors = new Set()) {
  51059. for (const child of this[_children]) {
  51060. child[_resolvePrototypesHelper](ids, ancestors);
  51061. }
  51062. }
  51063. [_resolvePrototypesHelper](ids, ancestors) {
  51064. const proto = this[_getPrototype](ids, ancestors);
  51065. if (proto) {
  51066. this[_applyPrototype](proto, ids, ancestors);
  51067. } else {
  51068. this[$resolvePrototypes](ids, ancestors);
  51069. }
  51070. }
  51071. [_getPrototype](ids, ancestors) {
  51072. const {
  51073. use,
  51074. usehref
  51075. } = this;
  51076. if (!use && !usehref) {
  51077. return null;
  51078. }
  51079. let proto = null;
  51080. let somExpression = null;
  51081. let id = null;
  51082. let ref = use;
  51083. if (usehref) {
  51084. ref = usehref;
  51085. if (usehref.startsWith("#som(") && usehref.endsWith(")")) {
  51086. somExpression = usehref.slice("#som(".length, usehref.length - 1);
  51087. } else if (usehref.startsWith(".#som(") && usehref.endsWith(")")) {
  51088. somExpression = usehref.slice(".#som(".length, usehref.length - 1);
  51089. } else if (usehref.startsWith("#")) {
  51090. id = usehref.slice(1);
  51091. } else if (usehref.startsWith(".#")) {
  51092. id = usehref.slice(2);
  51093. }
  51094. } else if (use.startsWith("#")) {
  51095. id = use.slice(1);
  51096. } else {
  51097. somExpression = use;
  51098. }
  51099. this.use = this.usehref = "";
  51100. if (id) {
  51101. proto = ids.get(id);
  51102. } else {
  51103. proto = (0, _som.searchNode)(ids.get($root), this, somExpression, true, false);
  51104. if (proto) {
  51105. proto = proto[0];
  51106. }
  51107. }
  51108. if (!proto) {
  51109. (0, _util.warn)(`XFA - Invalid prototype reference: ${ref}.`);
  51110. return null;
  51111. }
  51112. if (proto[$nodeName] !== this[$nodeName]) {
  51113. (0, _util.warn)(`XFA - Incompatible prototype: ${proto[$nodeName]} !== ${this[$nodeName]}.`);
  51114. return null;
  51115. }
  51116. if (ancestors.has(proto)) {
  51117. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51118. return null;
  51119. }
  51120. ancestors.add(proto);
  51121. const protoProto = proto[_getPrototype](ids, ancestors);
  51122. if (protoProto) {
  51123. proto[_applyPrototype](protoProto, ids, ancestors);
  51124. }
  51125. proto[$resolvePrototypes](ids, ancestors);
  51126. ancestors.delete(proto);
  51127. return proto;
  51128. }
  51129. [_applyPrototype](proto, ids, ancestors) {
  51130. if (ancestors.has(proto)) {
  51131. (0, _util.warn)(`XFA - Cycle detected in prototypes use.`);
  51132. return;
  51133. }
  51134. if (!this[$content] && proto[$content]) {
  51135. this[$content] = proto[$content];
  51136. }
  51137. const newAncestors = new Set(ancestors);
  51138. newAncestors.add(proto);
  51139. for (const unsetAttrName of this[_getUnsetAttributes](proto[_setAttributes])) {
  51140. this[unsetAttrName] = proto[unsetAttrName];
  51141. if (this[_setAttributes]) {
  51142. this[_setAttributes].add(unsetAttrName);
  51143. }
  51144. }
  51145. for (const name of Object.getOwnPropertyNames(this)) {
  51146. if (this[_attributeNames].has(name)) {
  51147. continue;
  51148. }
  51149. const value = this[name];
  51150. const protoValue = proto[name];
  51151. if (value instanceof XFAObjectArray) {
  51152. for (const child of value[_children]) {
  51153. child[_resolvePrototypesHelper](ids, ancestors);
  51154. }
  51155. for (let i = value[_children].length, ii = protoValue[_children].length; i < ii; i++) {
  51156. const child = proto[_children][i][$clone]();
  51157. if (value.push(child)) {
  51158. child[_parent] = this;
  51159. this[_children].push(child);
  51160. child[_resolvePrototypesHelper](ids, ancestors);
  51161. } else {
  51162. break;
  51163. }
  51164. }
  51165. continue;
  51166. }
  51167. if (value !== null) {
  51168. value[$resolvePrototypes](ids, ancestors);
  51169. if (protoValue) {
  51170. value[_applyPrototype](protoValue, ids, ancestors);
  51171. }
  51172. continue;
  51173. }
  51174. if (protoValue !== null) {
  51175. const child = protoValue[$clone]();
  51176. child[_parent] = this;
  51177. this[name] = child;
  51178. this[_children].push(child);
  51179. child[_resolvePrototypesHelper](ids, ancestors);
  51180. }
  51181. }
  51182. }
  51183. static [_cloneAttribute](obj) {
  51184. if (Array.isArray(obj)) {
  51185. return obj.map(x => XFAObject[_cloneAttribute](x));
  51186. }
  51187. if (typeof obj === "object" && obj !== null) {
  51188. return Object.assign({}, obj);
  51189. }
  51190. return obj;
  51191. }
  51192. [$clone]() {
  51193. const clone = Object.create(Object.getPrototypeOf(this));
  51194. for (const $symbol of Object.getOwnPropertySymbols(this)) {
  51195. try {
  51196. clone[$symbol] = this[$symbol];
  51197. } catch (_) {
  51198. (0, _util.shadow)(clone, $symbol, this[$symbol]);
  51199. }
  51200. }
  51201. clone[$uid] = `${clone[$nodeName]}${uid++}`;
  51202. clone[_children] = [];
  51203. for (const name of Object.getOwnPropertyNames(this)) {
  51204. if (this[_attributeNames].has(name)) {
  51205. clone[name] = XFAObject[_cloneAttribute](this[name]);
  51206. continue;
  51207. }
  51208. const value = this[name];
  51209. if (value instanceof XFAObjectArray) {
  51210. clone[name] = new XFAObjectArray(value[_max]);
  51211. } else {
  51212. clone[name] = null;
  51213. }
  51214. }
  51215. for (const child of this[_children]) {
  51216. const name = child[$nodeName];
  51217. const clonedChild = child[$clone]();
  51218. clone[_children].push(clonedChild);
  51219. clonedChild[_parent] = clone;
  51220. if (clone[name] === null) {
  51221. clone[name] = clonedChild;
  51222. } else {
  51223. clone[name][_children].push(clonedChild);
  51224. }
  51225. }
  51226. return clone;
  51227. }
  51228. [$getChildren](name = null) {
  51229. if (!name) {
  51230. return this[_children];
  51231. }
  51232. return this[_children].filter(c => c[$nodeName] === name);
  51233. }
  51234. [$getChildrenByClass](name) {
  51235. return this[name];
  51236. }
  51237. [$getChildrenByName](name, allTransparent, first = true) {
  51238. return Array.from(this[$getChildrenByNameIt](name, allTransparent, first));
  51239. }
  51240. *[$getChildrenByNameIt](name, allTransparent, first = true) {
  51241. if (name === "parent") {
  51242. yield this[_parent];
  51243. return;
  51244. }
  51245. for (const child of this[_children]) {
  51246. if (child[$nodeName] === name) {
  51247. yield child;
  51248. }
  51249. if (child.name === name) {
  51250. yield child;
  51251. }
  51252. if (allTransparent || child[$isTransparent]()) {
  51253. yield* child[$getChildrenByNameIt](name, allTransparent, false);
  51254. }
  51255. }
  51256. if (first && this[_attributeNames].has(name)) {
  51257. yield new XFAAttribute(this, name, this[name]);
  51258. }
  51259. }
  51260. }
  51261. exports.XFAObject = XFAObject;
  51262. class XFAObjectArray {
  51263. constructor(max = Infinity) {
  51264. this[_max] = max;
  51265. this[_children] = [];
  51266. }
  51267. push(child) {
  51268. const len = this[_children].length;
  51269. if (len <= this[_max]) {
  51270. this[_children].push(child);
  51271. return true;
  51272. }
  51273. (0, _util.warn)(`XFA - node "${child[$nodeName]}" accepts no more than ${this[_max]} children`);
  51274. return false;
  51275. }
  51276. isEmpty() {
  51277. return this[_children].length === 0;
  51278. }
  51279. dump() {
  51280. return this[_children].length === 1 ? this[_children][0][$dump]() : this[_children].map(x => x[$dump]());
  51281. }
  51282. [$clone]() {
  51283. const clone = new XFAObjectArray(this[_max]);
  51284. clone[_children] = this[_children].map(c => c[$clone]());
  51285. return clone;
  51286. }
  51287. get children() {
  51288. return this[_children];
  51289. }
  51290. clear() {
  51291. this[_children].length = 0;
  51292. }
  51293. }
  51294. exports.XFAObjectArray = XFAObjectArray;
  51295. class XFAAttribute {
  51296. constructor(node, name, value) {
  51297. this[_parent] = node;
  51298. this[$nodeName] = name;
  51299. this[$content] = value;
  51300. this[$consumed] = false;
  51301. this[$uid] = `attribute${uid++}`;
  51302. }
  51303. [$getParent]() {
  51304. return this[_parent];
  51305. }
  51306. [$isDataValue]() {
  51307. return true;
  51308. }
  51309. [$getDataValue]() {
  51310. return this[$content].trim();
  51311. }
  51312. [$setValue](value) {
  51313. value = value.value || "";
  51314. this[$content] = value.toString();
  51315. }
  51316. [$text]() {
  51317. return this[$content];
  51318. }
  51319. [$isDescendent](parent) {
  51320. return this[_parent] === parent || this[_parent][$isDescendent](parent);
  51321. }
  51322. }
  51323. exports.XFAAttribute = XFAAttribute;
  51324. class XmlObject extends XFAObject {
  51325. constructor(nsId, name, attributes = {}) {
  51326. super(nsId, name);
  51327. this[$content] = "";
  51328. this[_dataValue] = null;
  51329. if (name !== "#text") {
  51330. const map = new Map();
  51331. this[_attributes] = map;
  51332. for (const [attrName, value] of Object.entries(attributes)) {
  51333. map.set(attrName, new XFAAttribute(this, attrName, value));
  51334. }
  51335. if (attributes.hasOwnProperty($nsAttributes)) {
  51336. const dataNode = attributes[$nsAttributes].xfa.dataNode;
  51337. if (dataNode !== undefined) {
  51338. if (dataNode === "dataGroup") {
  51339. this[_dataValue] = false;
  51340. } else if (dataNode === "dataValue") {
  51341. this[_dataValue] = true;
  51342. }
  51343. }
  51344. }
  51345. }
  51346. this[$consumed] = false;
  51347. }
  51348. [$toString](buf) {
  51349. const tagName = this[$nodeName];
  51350. if (tagName === "#text") {
  51351. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  51352. return;
  51353. }
  51354. const utf8TagName = (0, _util.utf8StringToString)(tagName);
  51355. const prefix = this[$namespaceId] === NS_DATASETS ? "xfa:" : "";
  51356. buf.push(`<${prefix}${utf8TagName}`);
  51357. for (const [name, value] of this[_attributes].entries()) {
  51358. const utf8Name = (0, _util.utf8StringToString)(name);
  51359. buf.push(` ${utf8Name}="${(0, _core_utils.encodeToXmlString)(value[$content])}"`);
  51360. }
  51361. if (this[_dataValue] !== null) {
  51362. if (this[_dataValue]) {
  51363. buf.push(` xfa:dataNode="dataValue"`);
  51364. } else {
  51365. buf.push(` xfa:dataNode="dataGroup"`);
  51366. }
  51367. }
  51368. if (!this[$content] && this[_children].length === 0) {
  51369. buf.push("/>");
  51370. return;
  51371. }
  51372. buf.push(">");
  51373. if (this[$content]) {
  51374. if (typeof this[$content] === "string") {
  51375. buf.push((0, _core_utils.encodeToXmlString)(this[$content]));
  51376. } else {
  51377. this[$content][$toString](buf);
  51378. }
  51379. } else {
  51380. for (const child of this[_children]) {
  51381. child[$toString](buf);
  51382. }
  51383. }
  51384. buf.push(`</${prefix}${utf8TagName}>`);
  51385. }
  51386. [$onChild](child) {
  51387. if (this[$content]) {
  51388. const node = new XmlObject(this[$namespaceId], "#text");
  51389. this[$appendChild](node);
  51390. node[$content] = this[$content];
  51391. this[$content] = "";
  51392. }
  51393. this[$appendChild](child);
  51394. return true;
  51395. }
  51396. [$onText](str) {
  51397. this[$content] += str;
  51398. }
  51399. [$finalize]() {
  51400. if (this[$content] && this[_children].length > 0) {
  51401. const node = new XmlObject(this[$namespaceId], "#text");
  51402. this[$appendChild](node);
  51403. node[$content] = this[$content];
  51404. delete this[$content];
  51405. }
  51406. }
  51407. [$toHTML]() {
  51408. if (this[$nodeName] === "#text") {
  51409. return _utils.HTMLResult.success({
  51410. name: "#text",
  51411. value: this[$content]
  51412. });
  51413. }
  51414. return _utils.HTMLResult.EMPTY;
  51415. }
  51416. [$getChildren](name = null) {
  51417. if (!name) {
  51418. return this[_children];
  51419. }
  51420. return this[_children].filter(c => c[$nodeName] === name);
  51421. }
  51422. [$getAttributes]() {
  51423. return this[_attributes];
  51424. }
  51425. [$getChildrenByClass](name) {
  51426. const value = this[_attributes].get(name);
  51427. if (value !== undefined) {
  51428. return value;
  51429. }
  51430. return this[$getChildren](name);
  51431. }
  51432. *[$getChildrenByNameIt](name, allTransparent) {
  51433. const value = this[_attributes].get(name);
  51434. if (value) {
  51435. yield value;
  51436. }
  51437. for (const child of this[_children]) {
  51438. if (child[$nodeName] === name) {
  51439. yield child;
  51440. }
  51441. if (allTransparent) {
  51442. yield* child[$getChildrenByNameIt](name, allTransparent);
  51443. }
  51444. }
  51445. }
  51446. *[$getAttributeIt](name, skipConsumed) {
  51447. const value = this[_attributes].get(name);
  51448. if (value && (!skipConsumed || !value[$consumed])) {
  51449. yield value;
  51450. }
  51451. for (const child of this[_children]) {
  51452. yield* child[$getAttributeIt](name, skipConsumed);
  51453. }
  51454. }
  51455. *[$getRealChildrenByNameIt](name, allTransparent, skipConsumed) {
  51456. for (const child of this[_children]) {
  51457. if (child[$nodeName] === name && (!skipConsumed || !child[$consumed])) {
  51458. yield child;
  51459. }
  51460. if (allTransparent) {
  51461. yield* child[$getRealChildrenByNameIt](name, allTransparent, skipConsumed);
  51462. }
  51463. }
  51464. }
  51465. [$isDataValue]() {
  51466. if (this[_dataValue] === null) {
  51467. return this[_children].length === 0 || this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id;
  51468. }
  51469. return this[_dataValue];
  51470. }
  51471. [$getDataValue]() {
  51472. if (this[_dataValue] === null) {
  51473. if (this[_children].length === 0) {
  51474. return this[$content].trim();
  51475. }
  51476. if (this[_children][0][$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  51477. return this[_children][0][$text]().trim();
  51478. }
  51479. return null;
  51480. }
  51481. return this[$content].trim();
  51482. }
  51483. [$setValue](value) {
  51484. value = value.value || "";
  51485. this[$content] = value.toString();
  51486. }
  51487. [$dump](hasNS = false) {
  51488. const dumped = Object.create(null);
  51489. if (hasNS) {
  51490. dumped.$ns = this[$namespaceId];
  51491. }
  51492. if (this[$content]) {
  51493. dumped.$content = this[$content];
  51494. }
  51495. dumped.$name = this[$nodeName];
  51496. dumped.children = [];
  51497. for (const child of this[_children]) {
  51498. dumped.children.push(child[$dump](hasNS));
  51499. }
  51500. dumped.attributes = Object.create(null);
  51501. for (const [name, value] of this[_attributes]) {
  51502. dumped.attributes[name] = value[$content];
  51503. }
  51504. return dumped;
  51505. }
  51506. }
  51507. exports.XmlObject = XmlObject;
  51508. class ContentObject extends XFAObject {
  51509. constructor(nsId, name) {
  51510. super(nsId, name);
  51511. this[$content] = "";
  51512. }
  51513. [$onText](text) {
  51514. this[$content] += text;
  51515. }
  51516. [$finalize]() {}
  51517. }
  51518. exports.ContentObject = ContentObject;
  51519. class OptionObject extends ContentObject {
  51520. constructor(nsId, name, options) {
  51521. super(nsId, name);
  51522. this[_options] = options;
  51523. }
  51524. [$finalize]() {
  51525. this[$content] = (0, _utils.getKeyword)({
  51526. data: this[$content],
  51527. defaultValue: this[_options][0],
  51528. validate: k => this[_options].includes(k)
  51529. });
  51530. }
  51531. [$clean](builder) {
  51532. super[$clean](builder);
  51533. delete this[_options];
  51534. }
  51535. }
  51536. exports.OptionObject = OptionObject;
  51537. class StringObject extends ContentObject {
  51538. [$finalize]() {
  51539. this[$content] = this[$content].trim();
  51540. }
  51541. }
  51542. exports.StringObject = StringObject;
  51543. class IntegerObject extends ContentObject {
  51544. constructor(nsId, name, defaultValue, validator) {
  51545. super(nsId, name);
  51546. this[_defaultValue] = defaultValue;
  51547. this[_validator] = validator;
  51548. }
  51549. [$finalize]() {
  51550. this[$content] = (0, _utils.getInteger)({
  51551. data: this[$content],
  51552. defaultValue: this[_defaultValue],
  51553. validate: this[_validator]
  51554. });
  51555. }
  51556. [$clean](builder) {
  51557. super[$clean](builder);
  51558. delete this[_defaultValue];
  51559. delete this[_validator];
  51560. }
  51561. }
  51562. exports.IntegerObject = IntegerObject;
  51563. class Option01 extends IntegerObject {
  51564. constructor(nsId, name) {
  51565. super(nsId, name, 0, n => n === 1);
  51566. }
  51567. }
  51568. exports.Option01 = Option01;
  51569. class Option10 extends IntegerObject {
  51570. constructor(nsId, name) {
  51571. super(nsId, name, 1, n => n === 0);
  51572. }
  51573. }
  51574. exports.Option10 = Option10;
  51575. /***/ }),
  51576. /* 78 */
  51577. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51578. Object.defineProperty(exports, "__esModule", ({
  51579. value: true
  51580. }));
  51581. exports.HTMLResult = void 0;
  51582. exports.getBBox = getBBox;
  51583. exports.getColor = getColor;
  51584. exports.getFloat = getFloat;
  51585. exports.getInteger = getInteger;
  51586. exports.getKeyword = getKeyword;
  51587. exports.getMeasurement = getMeasurement;
  51588. exports.getRatio = getRatio;
  51589. exports.getRelevant = getRelevant;
  51590. exports.getStringOption = getStringOption;
  51591. exports.stripQuotes = stripQuotes;
  51592. var _util = __w_pdfjs_require__(2);
  51593. const dimConverters = {
  51594. pt: x => x,
  51595. cm: x => x / 2.54 * 72,
  51596. mm: x => x / (10 * 2.54) * 72,
  51597. in: x => x * 72,
  51598. px: x => x
  51599. };
  51600. const measurementPattern = /([+-]?\d+\.?\d*)(.*)/;
  51601. function stripQuotes(str) {
  51602. if (str.startsWith("'") || str.startsWith('"')) {
  51603. return str.slice(1, str.length - 1);
  51604. }
  51605. return str;
  51606. }
  51607. function getInteger({
  51608. data,
  51609. defaultValue,
  51610. validate
  51611. }) {
  51612. if (!data) {
  51613. return defaultValue;
  51614. }
  51615. data = data.trim();
  51616. const n = parseInt(data, 10);
  51617. if (!isNaN(n) && validate(n)) {
  51618. return n;
  51619. }
  51620. return defaultValue;
  51621. }
  51622. function getFloat({
  51623. data,
  51624. defaultValue,
  51625. validate
  51626. }) {
  51627. if (!data) {
  51628. return defaultValue;
  51629. }
  51630. data = data.trim();
  51631. const n = parseFloat(data);
  51632. if (!isNaN(n) && validate(n)) {
  51633. return n;
  51634. }
  51635. return defaultValue;
  51636. }
  51637. function getKeyword({
  51638. data,
  51639. defaultValue,
  51640. validate
  51641. }) {
  51642. if (!data) {
  51643. return defaultValue;
  51644. }
  51645. data = data.trim();
  51646. if (validate(data)) {
  51647. return data;
  51648. }
  51649. return defaultValue;
  51650. }
  51651. function getStringOption(data, options) {
  51652. return getKeyword({
  51653. data,
  51654. defaultValue: options[0],
  51655. validate: k => options.includes(k)
  51656. });
  51657. }
  51658. function getMeasurement(str, def = "0") {
  51659. def = def || "0";
  51660. if (!str) {
  51661. return getMeasurement(def);
  51662. }
  51663. const match = str.trim().match(measurementPattern);
  51664. if (!match) {
  51665. return getMeasurement(def);
  51666. }
  51667. const [, valueStr, unit] = match;
  51668. const value = parseFloat(valueStr);
  51669. if (isNaN(value)) {
  51670. return getMeasurement(def);
  51671. }
  51672. if (value === 0) {
  51673. return 0;
  51674. }
  51675. const conv = dimConverters[unit];
  51676. if (conv) {
  51677. return conv(value);
  51678. }
  51679. return value;
  51680. }
  51681. function getRatio(data) {
  51682. if (!data) {
  51683. return {
  51684. num: 1,
  51685. den: 1
  51686. };
  51687. }
  51688. const ratio = data.trim().split(/\s*:\s*/).map(x => parseFloat(x)).filter(x => !isNaN(x));
  51689. if (ratio.length === 1) {
  51690. ratio.push(1);
  51691. }
  51692. if (ratio.length === 0) {
  51693. return {
  51694. num: 1,
  51695. den: 1
  51696. };
  51697. }
  51698. const [num, den] = ratio;
  51699. return {
  51700. num,
  51701. den
  51702. };
  51703. }
  51704. function getRelevant(data) {
  51705. if (!data) {
  51706. return [];
  51707. }
  51708. return data.trim().split(/\s+/).map(e => {
  51709. return {
  51710. excluded: e[0] === "-",
  51711. viewname: e.substring(1)
  51712. };
  51713. });
  51714. }
  51715. function getColor(data, def = [0, 0, 0]) {
  51716. let [r, g, b] = def;
  51717. if (!data) {
  51718. return {
  51719. r,
  51720. g,
  51721. b
  51722. };
  51723. }
  51724. 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);
  51725. if (color.length < 3) {
  51726. return {
  51727. r,
  51728. g,
  51729. b
  51730. };
  51731. }
  51732. [r, g, b] = color;
  51733. return {
  51734. r,
  51735. g,
  51736. b
  51737. };
  51738. }
  51739. function getBBox(data) {
  51740. const def = -1;
  51741. if (!data) {
  51742. return {
  51743. x: def,
  51744. y: def,
  51745. width: def,
  51746. height: def
  51747. };
  51748. }
  51749. const bbox = data.trim().split(/\s*,\s*/).map(m => getMeasurement(m, "-1"));
  51750. if (bbox.length < 4 || bbox[2] < 0 || bbox[3] < 0) {
  51751. return {
  51752. x: def,
  51753. y: def,
  51754. width: def,
  51755. height: def
  51756. };
  51757. }
  51758. const [x, y, width, height] = bbox;
  51759. return {
  51760. x,
  51761. y,
  51762. width,
  51763. height
  51764. };
  51765. }
  51766. class HTMLResult {
  51767. static get FAILURE() {
  51768. return (0, _util.shadow)(this, "FAILURE", new HTMLResult(false, null, null, null));
  51769. }
  51770. static get EMPTY() {
  51771. return (0, _util.shadow)(this, "EMPTY", new HTMLResult(true, null, null, null));
  51772. }
  51773. constructor(success, html, bbox, breakNode) {
  51774. this.success = success;
  51775. this.html = html;
  51776. this.bbox = bbox;
  51777. this.breakNode = breakNode;
  51778. }
  51779. isBreak() {
  51780. return !!this.breakNode;
  51781. }
  51782. static breakNode(node) {
  51783. return new HTMLResult(false, null, null, node);
  51784. }
  51785. static success(html, bbox = null) {
  51786. return new HTMLResult(true, html, bbox, null);
  51787. }
  51788. }
  51789. exports.HTMLResult = HTMLResult;
  51790. /***/ }),
  51791. /* 79 */
  51792. /***/ ((__unused_webpack_module, exports) => {
  51793. Object.defineProperty(exports, "__esModule", ({
  51794. value: true
  51795. }));
  51796. exports.NamespaceIds = exports.$buildXFAObject = void 0;
  51797. const $buildXFAObject = Symbol();
  51798. exports.$buildXFAObject = $buildXFAObject;
  51799. const NamespaceIds = {
  51800. config: {
  51801. id: 0,
  51802. check: ns => ns.startsWith("http://www.xfa.org/schema/xci/")
  51803. },
  51804. connectionSet: {
  51805. id: 1,
  51806. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-connection-set/")
  51807. },
  51808. datasets: {
  51809. id: 2,
  51810. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-data/")
  51811. },
  51812. form: {
  51813. id: 3,
  51814. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-form/")
  51815. },
  51816. localeSet: {
  51817. id: 4,
  51818. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-locale-set/")
  51819. },
  51820. pdf: {
  51821. id: 5,
  51822. check: ns => ns === "http://ns.adobe.com/xdp/pdf/"
  51823. },
  51824. signature: {
  51825. id: 6,
  51826. check: ns => ns === "http://www.w3.org/2000/09/xmldsig#"
  51827. },
  51828. sourceSet: {
  51829. id: 7,
  51830. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-source-set/")
  51831. },
  51832. stylesheet: {
  51833. id: 8,
  51834. check: ns => ns === "http://www.w3.org/1999/XSL/Transform"
  51835. },
  51836. template: {
  51837. id: 9,
  51838. check: ns => ns.startsWith("http://www.xfa.org/schema/xfa-template/")
  51839. },
  51840. xdc: {
  51841. id: 10,
  51842. check: ns => ns.startsWith("http://www.xfa.org/schema/xdc/")
  51843. },
  51844. xdp: {
  51845. id: 11,
  51846. check: ns => ns === "http://ns.adobe.com/xdp/"
  51847. },
  51848. xfdf: {
  51849. id: 12,
  51850. check: ns => ns === "http://ns.adobe.com/xfdf/"
  51851. },
  51852. xhtml: {
  51853. id: 13,
  51854. check: ns => ns === "http://www.w3.org/1999/xhtml"
  51855. },
  51856. xmpmeta: {
  51857. id: 14,
  51858. check: ns => ns === "http://ns.adobe.com/xmpmeta/"
  51859. }
  51860. };
  51861. exports.NamespaceIds = NamespaceIds;
  51862. /***/ }),
  51863. /* 80 */
  51864. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  51865. Object.defineProperty(exports, "__esModule", ({
  51866. value: true
  51867. }));
  51868. exports.createDataNode = createDataNode;
  51869. exports.searchNode = searchNode;
  51870. var _xfa_object = __w_pdfjs_require__(77);
  51871. var _namespaces = __w_pdfjs_require__(79);
  51872. var _util = __w_pdfjs_require__(2);
  51873. const namePattern = /^[^.[]+/;
  51874. const indexPattern = /^[^\]]+/;
  51875. const operators = {
  51876. dot: 0,
  51877. dotDot: 1,
  51878. dotHash: 2,
  51879. dotBracket: 3,
  51880. dotParen: 4
  51881. };
  51882. const shortcuts = new Map([["$data", (root, current) => root.datasets ? root.datasets.data : root], ["$record", (root, current) => (root.datasets ? root.datasets.data : root)[_xfa_object.$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]]);
  51883. const somCache = new WeakMap();
  51884. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  51885. function parseIndex(index) {
  51886. index = index.trim();
  51887. if (index === "*") {
  51888. return Infinity;
  51889. }
  51890. return parseInt(index, 10) || 0;
  51891. }
  51892. function parseExpression(expr, dotDotAllowed, noExpr = true) {
  51893. let match = expr.match(namePattern);
  51894. if (!match) {
  51895. return null;
  51896. }
  51897. let [name] = match;
  51898. const parsed = [{
  51899. name,
  51900. cacheName: "." + name,
  51901. index: 0,
  51902. js: null,
  51903. formCalc: null,
  51904. operator: operators.dot
  51905. }];
  51906. let pos = name.length;
  51907. while (pos < expr.length) {
  51908. const spos = pos;
  51909. const char = expr.charAt(pos++);
  51910. if (char === "[") {
  51911. match = expr.slice(pos).match(indexPattern);
  51912. if (!match) {
  51913. (0, _util.warn)("XFA - Invalid index in SOM expression");
  51914. return null;
  51915. }
  51916. parsed[parsed.length - 1].index = parseIndex(match[0]);
  51917. pos += match[0].length + 1;
  51918. continue;
  51919. }
  51920. let operator;
  51921. switch (expr.charAt(pos)) {
  51922. case ".":
  51923. if (!dotDotAllowed) {
  51924. return null;
  51925. }
  51926. pos++;
  51927. operator = operators.dotDot;
  51928. break;
  51929. case "#":
  51930. pos++;
  51931. operator = operators.dotHash;
  51932. break;
  51933. case "[":
  51934. if (noExpr) {
  51935. (0, _util.warn)("XFA - SOM expression contains a FormCalc subexpression which is not supported for now.");
  51936. return null;
  51937. }
  51938. operator = operators.dotBracket;
  51939. break;
  51940. case "(":
  51941. if (noExpr) {
  51942. (0, _util.warn)("XFA - SOM expression contains a JavaScript subexpression which is not supported for now.");
  51943. return null;
  51944. }
  51945. operator = operators.dotParen;
  51946. break;
  51947. default:
  51948. operator = operators.dot;
  51949. break;
  51950. }
  51951. match = expr.slice(pos).match(namePattern);
  51952. if (!match) {
  51953. break;
  51954. }
  51955. [name] = match;
  51956. pos += name.length;
  51957. parsed.push({
  51958. name,
  51959. cacheName: expr.slice(spos, pos),
  51960. operator,
  51961. index: 0,
  51962. js: null,
  51963. formCalc: null
  51964. });
  51965. }
  51966. return parsed;
  51967. }
  51968. function searchNode(root, container, expr, dotDotAllowed = true, useCache = true) {
  51969. const parsed = parseExpression(expr, dotDotAllowed);
  51970. if (!parsed) {
  51971. return null;
  51972. }
  51973. const fn = shortcuts.get(parsed[0].name);
  51974. let i = 0;
  51975. let isQualified;
  51976. if (fn) {
  51977. isQualified = true;
  51978. root = [fn(root, container)];
  51979. i = 1;
  51980. } else {
  51981. isQualified = container === null;
  51982. root = [container || root];
  51983. }
  51984. for (let ii = parsed.length; i < ii; i++) {
  51985. const {
  51986. name,
  51987. cacheName,
  51988. operator,
  51989. index
  51990. } = parsed[i];
  51991. const nodes = [];
  51992. for (const node of root) {
  51993. if (!(node instanceof _xfa_object.XFAObject)) {
  51994. continue;
  51995. }
  51996. let children, cached;
  51997. if (useCache) {
  51998. cached = somCache.get(node);
  51999. if (!cached) {
  52000. cached = new Map();
  52001. somCache.set(node, cached);
  52002. }
  52003. children = cached.get(cacheName);
  52004. }
  52005. if (!children) {
  52006. switch (operator) {
  52007. case operators.dot:
  52008. children = node[_xfa_object.$getChildrenByName](name, false);
  52009. break;
  52010. case operators.dotDot:
  52011. children = node[_xfa_object.$getChildrenByName](name, true);
  52012. break;
  52013. case operators.dotHash:
  52014. children = node[_xfa_object.$getChildrenByClass](name);
  52015. if (children instanceof _xfa_object.XFAObjectArray) {
  52016. children = children.children;
  52017. } else {
  52018. children = [children];
  52019. }
  52020. break;
  52021. default:
  52022. break;
  52023. }
  52024. if (useCache) {
  52025. cached.set(cacheName, children);
  52026. }
  52027. }
  52028. if (children.length > 0) {
  52029. nodes.push(children);
  52030. }
  52031. }
  52032. if (nodes.length === 0 && !isQualified && i === 0) {
  52033. const parent = container[_xfa_object.$getParent]();
  52034. container = parent;
  52035. if (!container) {
  52036. return null;
  52037. }
  52038. i = -1;
  52039. root = [container];
  52040. continue;
  52041. }
  52042. if (isFinite(index)) {
  52043. root = nodes.filter(node => index < node.length).map(node => node[index]);
  52044. } else {
  52045. root = nodes.reduce((acc, node) => acc.concat(node), []);
  52046. }
  52047. }
  52048. if (root.length === 0) {
  52049. return null;
  52050. }
  52051. return root;
  52052. }
  52053. function createNodes(root, path) {
  52054. let node = null;
  52055. for (const {
  52056. name,
  52057. index
  52058. } of path) {
  52059. for (let i = 0, ii = !isFinite(index) ? 0 : index; i <= ii; i++) {
  52060. const nsId = root[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : root[_xfa_object.$namespaceId];
  52061. node = new _xfa_object.XmlObject(nsId, name);
  52062. root[_xfa_object.$appendChild](node);
  52063. }
  52064. root = node;
  52065. }
  52066. return node;
  52067. }
  52068. function createDataNode(root, container, expr) {
  52069. const parsed = parseExpression(expr);
  52070. if (!parsed) {
  52071. return null;
  52072. }
  52073. if (parsed.some(x => x.operator === operators.dotDot)) {
  52074. return null;
  52075. }
  52076. const fn = shortcuts.get(parsed[0].name);
  52077. let i = 0;
  52078. if (fn) {
  52079. root = fn(root, container);
  52080. i = 1;
  52081. } else {
  52082. root = container || root;
  52083. }
  52084. for (let ii = parsed.length; i < ii; i++) {
  52085. const {
  52086. name,
  52087. operator,
  52088. index
  52089. } = parsed[i];
  52090. if (!isFinite(index)) {
  52091. parsed[i].index = 0;
  52092. return createNodes(root, parsed.slice(i));
  52093. }
  52094. let children;
  52095. switch (operator) {
  52096. case operators.dot:
  52097. children = root[_xfa_object.$getChildrenByName](name, false);
  52098. break;
  52099. case operators.dotDot:
  52100. children = root[_xfa_object.$getChildrenByName](name, true);
  52101. break;
  52102. case operators.dotHash:
  52103. children = root[_xfa_object.$getChildrenByClass](name);
  52104. if (children instanceof _xfa_object.XFAObjectArray) {
  52105. children = children.children;
  52106. } else {
  52107. children = [children];
  52108. }
  52109. break;
  52110. default:
  52111. break;
  52112. }
  52113. if (children.length === 0) {
  52114. return createNodes(root, parsed.slice(i));
  52115. }
  52116. if (index < children.length) {
  52117. const child = children[index];
  52118. if (!(child instanceof _xfa_object.XFAObject)) {
  52119. (0, _util.warn)(`XFA - Cannot create a node.`);
  52120. return null;
  52121. }
  52122. root = child;
  52123. } else {
  52124. parsed[i].index = index - children.length;
  52125. return createNodes(root, parsed.slice(i));
  52126. }
  52127. }
  52128. return null;
  52129. }
  52130. /***/ }),
  52131. /* 81 */
  52132. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52133. Object.defineProperty(exports, "__esModule", ({
  52134. value: true
  52135. }));
  52136. exports.Binder = void 0;
  52137. var _xfa_object = __w_pdfjs_require__(77);
  52138. var _template = __w_pdfjs_require__(82);
  52139. var _som = __w_pdfjs_require__(80);
  52140. var _namespaces = __w_pdfjs_require__(79);
  52141. var _util = __w_pdfjs_require__(2);
  52142. const NS_DATASETS = _namespaces.NamespaceIds.datasets.id;
  52143. function createText(content) {
  52144. const node = new _template.Text({});
  52145. node[_xfa_object.$content] = content;
  52146. return node;
  52147. }
  52148. class Binder {
  52149. constructor(root) {
  52150. this.root = root;
  52151. this.datasets = root.datasets;
  52152. if (root.datasets && root.datasets.data) {
  52153. this.data = root.datasets.data;
  52154. } else {
  52155. this.data = new _xfa_object.XmlObject(_namespaces.NamespaceIds.datasets.id, "data");
  52156. }
  52157. this.emptyMerge = this.data[_xfa_object.$getChildren]().length === 0;
  52158. this.root.form = this.form = root.template[_xfa_object.$clone]();
  52159. }
  52160. _isConsumeData() {
  52161. return !this.emptyMerge && this._mergeMode;
  52162. }
  52163. _isMatchTemplate() {
  52164. return !this._isConsumeData();
  52165. }
  52166. bind() {
  52167. this._bindElement(this.form, this.data);
  52168. return this.form;
  52169. }
  52170. getData() {
  52171. return this.data;
  52172. }
  52173. _bindValue(formNode, data, picture) {
  52174. formNode[_xfa_object.$data] = data;
  52175. if (formNode[_xfa_object.$hasSettableValue]()) {
  52176. if (data[_xfa_object.$isDataValue]()) {
  52177. const value = data[_xfa_object.$getDataValue]();
  52178. formNode[_xfa_object.$setValue](createText(value));
  52179. } else if (formNode instanceof _template.Field && formNode.ui && formNode.ui.choiceList && formNode.ui.choiceList.open === "multiSelect") {
  52180. const value = data[_xfa_object.$getChildren]().map(child => child[_xfa_object.$content].trim()).join("\n");
  52181. formNode[_xfa_object.$setValue](createText(value));
  52182. } else if (this._isConsumeData()) {
  52183. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52184. }
  52185. } else if (!data[_xfa_object.$isDataValue]() || this._isMatchTemplate()) {
  52186. this._bindElement(formNode, data);
  52187. } else {
  52188. (0, _util.warn)(`XFA - Nodes haven't the same type.`);
  52189. }
  52190. }
  52191. _findDataByNameToConsume(name, isValue, dataNode, global) {
  52192. if (!name) {
  52193. return null;
  52194. }
  52195. let generator, match;
  52196. for (let i = 0; i < 3; i++) {
  52197. generator = dataNode[_xfa_object.$getRealChildrenByNameIt](name, false, true);
  52198. while (true) {
  52199. match = generator.next().value;
  52200. if (!match) {
  52201. break;
  52202. }
  52203. if (isValue === match[_xfa_object.$isDataValue]()) {
  52204. return match;
  52205. }
  52206. }
  52207. if (dataNode[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.datasets.id && dataNode[_xfa_object.$nodeName] === "data") {
  52208. break;
  52209. }
  52210. dataNode = dataNode[_xfa_object.$getParent]();
  52211. }
  52212. if (!global) {
  52213. return null;
  52214. }
  52215. generator = this.data[_xfa_object.$getRealChildrenByNameIt](name, true, false);
  52216. match = generator.next().value;
  52217. if (match) {
  52218. return match;
  52219. }
  52220. generator = this.data[_xfa_object.$getAttributeIt](name, true);
  52221. match = generator.next().value;
  52222. if (match && match[_xfa_object.$isDataValue]()) {
  52223. return match;
  52224. }
  52225. return null;
  52226. }
  52227. _setProperties(formNode, dataNode) {
  52228. if (!formNode.hasOwnProperty("setProperty")) {
  52229. return;
  52230. }
  52231. for (const {
  52232. ref,
  52233. target,
  52234. connection
  52235. } of formNode.setProperty.children) {
  52236. if (connection) {
  52237. continue;
  52238. }
  52239. if (!ref) {
  52240. continue;
  52241. }
  52242. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52243. if (!nodes) {
  52244. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52245. continue;
  52246. }
  52247. const [node] = nodes;
  52248. if (!node[_xfa_object.$isDescendent](this.data)) {
  52249. (0, _util.warn)(`XFA - Invalid node: must be a data node.`);
  52250. continue;
  52251. }
  52252. const targetNodes = (0, _som.searchNode)(this.root, formNode, target, false, false);
  52253. if (!targetNodes) {
  52254. (0, _util.warn)(`XFA - Invalid target: ${target}.`);
  52255. continue;
  52256. }
  52257. const [targetNode] = targetNodes;
  52258. if (!targetNode[_xfa_object.$isDescendent](formNode)) {
  52259. (0, _util.warn)(`XFA - Invalid target: must be a property or subproperty.`);
  52260. continue;
  52261. }
  52262. const targetParent = targetNode[_xfa_object.$getParent]();
  52263. if (targetNode instanceof _template.SetProperty || targetParent instanceof _template.SetProperty) {
  52264. (0, _util.warn)(`XFA - Invalid target: cannot be a setProperty or one of its properties.`);
  52265. continue;
  52266. }
  52267. if (targetNode instanceof _template.BindItems || targetParent instanceof _template.BindItems) {
  52268. (0, _util.warn)(`XFA - Invalid target: cannot be a bindItems or one of its properties.`);
  52269. continue;
  52270. }
  52271. const content = node[_xfa_object.$text]();
  52272. const name = targetNode[_xfa_object.$nodeName];
  52273. if (targetNode instanceof _xfa_object.XFAAttribute) {
  52274. const attrs = Object.create(null);
  52275. attrs[name] = content;
  52276. const obj = Reflect.construct(Object.getPrototypeOf(targetParent).constructor, [attrs]);
  52277. targetParent[name] = obj[name];
  52278. continue;
  52279. }
  52280. if (!targetNode.hasOwnProperty(_xfa_object.$content)) {
  52281. (0, _util.warn)(`XFA - Invalid node to use in setProperty`);
  52282. continue;
  52283. }
  52284. targetNode[_xfa_object.$data] = node;
  52285. targetNode[_xfa_object.$content] = content;
  52286. targetNode[_xfa_object.$finalize]();
  52287. }
  52288. }
  52289. _bindItems(formNode, dataNode) {
  52290. if (!formNode.hasOwnProperty("items") || !formNode.hasOwnProperty("bindItems") || formNode.bindItems.isEmpty()) {
  52291. return;
  52292. }
  52293. for (const item of formNode.items.children) {
  52294. formNode[_xfa_object.$removeChild](item);
  52295. }
  52296. formNode.items.clear();
  52297. const labels = new _template.Items({});
  52298. const values = new _template.Items({});
  52299. formNode[_xfa_object.$appendChild](labels);
  52300. formNode.items.push(labels);
  52301. formNode[_xfa_object.$appendChild](values);
  52302. formNode.items.push(values);
  52303. for (const {
  52304. ref,
  52305. labelRef,
  52306. valueRef,
  52307. connection
  52308. } of formNode.bindItems.children) {
  52309. if (connection) {
  52310. continue;
  52311. }
  52312. if (!ref) {
  52313. continue;
  52314. }
  52315. const nodes = (0, _som.searchNode)(this.root, dataNode, ref, false, false);
  52316. if (!nodes) {
  52317. (0, _util.warn)(`XFA - Invalid reference: ${ref}.`);
  52318. continue;
  52319. }
  52320. for (const node of nodes) {
  52321. if (!node[_xfa_object.$isDescendent](this.datasets)) {
  52322. (0, _util.warn)(`XFA - Invalid ref (${ref}): must be a datasets child.`);
  52323. continue;
  52324. }
  52325. const labelNodes = (0, _som.searchNode)(this.root, node, labelRef, true, false);
  52326. if (!labelNodes) {
  52327. (0, _util.warn)(`XFA - Invalid label: ${labelRef}.`);
  52328. continue;
  52329. }
  52330. const [labelNode] = labelNodes;
  52331. if (!labelNode[_xfa_object.$isDescendent](this.datasets)) {
  52332. (0, _util.warn)(`XFA - Invalid label: must be a datasets child.`);
  52333. continue;
  52334. }
  52335. const valueNodes = (0, _som.searchNode)(this.root, node, valueRef, true, false);
  52336. if (!valueNodes) {
  52337. (0, _util.warn)(`XFA - Invalid value: ${valueRef}.`);
  52338. continue;
  52339. }
  52340. const [valueNode] = valueNodes;
  52341. if (!valueNode[_xfa_object.$isDescendent](this.datasets)) {
  52342. (0, _util.warn)(`XFA - Invalid value: must be a datasets child.`);
  52343. continue;
  52344. }
  52345. const label = createText(labelNode[_xfa_object.$text]());
  52346. const value = createText(valueNode[_xfa_object.$text]());
  52347. labels[_xfa_object.$appendChild](label);
  52348. labels.text.push(label);
  52349. values[_xfa_object.$appendChild](value);
  52350. values.text.push(value);
  52351. }
  52352. }
  52353. }
  52354. _bindOccurrences(formNode, matches, picture) {
  52355. let baseClone;
  52356. if (matches.length > 1) {
  52357. baseClone = formNode[_xfa_object.$clone]();
  52358. baseClone[_xfa_object.$removeChild](baseClone.occur);
  52359. baseClone.occur = null;
  52360. }
  52361. this._bindValue(formNode, matches[0], picture);
  52362. this._setProperties(formNode, matches[0]);
  52363. this._bindItems(formNode, matches[0]);
  52364. if (matches.length === 1) {
  52365. return;
  52366. }
  52367. const parent = formNode[_xfa_object.$getParent]();
  52368. const name = formNode[_xfa_object.$nodeName];
  52369. const pos = parent[_xfa_object.$indexOf](formNode);
  52370. for (let i = 1, ii = matches.length; i < ii; i++) {
  52371. const match = matches[i];
  52372. const clone = baseClone[_xfa_object.$clone]();
  52373. parent[name].push(clone);
  52374. parent[_xfa_object.$insertAt](pos + i, clone);
  52375. this._bindValue(clone, match, picture);
  52376. this._setProperties(clone, match);
  52377. this._bindItems(clone, match);
  52378. }
  52379. }
  52380. _createOccurrences(formNode) {
  52381. if (!this.emptyMerge) {
  52382. return;
  52383. }
  52384. const {
  52385. occur
  52386. } = formNode;
  52387. if (!occur || occur.initial <= 1) {
  52388. return;
  52389. }
  52390. const parent = formNode[_xfa_object.$getParent]();
  52391. const name = formNode[_xfa_object.$nodeName];
  52392. if (!(parent[name] instanceof _xfa_object.XFAObjectArray)) {
  52393. return;
  52394. }
  52395. let currentNumber;
  52396. if (formNode.name) {
  52397. currentNumber = parent[name].children.filter(e => e.name === formNode.name).length;
  52398. } else {
  52399. currentNumber = parent[name].children.length;
  52400. }
  52401. const pos = parent[_xfa_object.$indexOf](formNode) + 1;
  52402. const ii = occur.initial - currentNumber;
  52403. if (ii) {
  52404. const nodeClone = formNode[_xfa_object.$clone]();
  52405. nodeClone[_xfa_object.$removeChild](nodeClone.occur);
  52406. nodeClone.occur = null;
  52407. parent[name].push(nodeClone);
  52408. parent[_xfa_object.$insertAt](pos, nodeClone);
  52409. for (let i = 1; i < ii; i++) {
  52410. const clone = nodeClone[_xfa_object.$clone]();
  52411. parent[name].push(clone);
  52412. parent[_xfa_object.$insertAt](pos + i, clone);
  52413. }
  52414. }
  52415. }
  52416. _getOccurInfo(formNode) {
  52417. const {
  52418. name,
  52419. occur
  52420. } = formNode;
  52421. if (!occur || !name) {
  52422. return [1, 1];
  52423. }
  52424. const max = occur.max === -1 ? Infinity : occur.max;
  52425. return [occur.min, max];
  52426. }
  52427. _setAndBind(formNode, dataNode) {
  52428. this._setProperties(formNode, dataNode);
  52429. this._bindItems(formNode, dataNode);
  52430. this._bindElement(formNode, dataNode);
  52431. }
  52432. _bindElement(formNode, dataNode) {
  52433. const uselessNodes = [];
  52434. this._createOccurrences(formNode);
  52435. for (const child of formNode[_xfa_object.$getChildren]()) {
  52436. if (child[_xfa_object.$data]) {
  52437. continue;
  52438. }
  52439. if (this._mergeMode === undefined && child[_xfa_object.$nodeName] === "subform") {
  52440. this._mergeMode = child.mergeMode === "consumeData";
  52441. const dataChildren = dataNode[_xfa_object.$getChildren]();
  52442. if (dataChildren.length > 0) {
  52443. this._bindOccurrences(child, [dataChildren[0]], null);
  52444. } else if (this.emptyMerge) {
  52445. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  52446. const dataChild = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name || "root");
  52447. dataNode[_xfa_object.$appendChild](dataChild);
  52448. this._bindElement(child, dataChild);
  52449. }
  52450. continue;
  52451. }
  52452. if (!child[_xfa_object.$isBindable]()) {
  52453. continue;
  52454. }
  52455. let global = false;
  52456. let picture = null;
  52457. let ref = null;
  52458. let match = null;
  52459. if (child.bind) {
  52460. switch (child.bind.match) {
  52461. case "none":
  52462. this._setAndBind(child, dataNode);
  52463. continue;
  52464. case "global":
  52465. global = true;
  52466. break;
  52467. case "dataRef":
  52468. if (!child.bind.ref) {
  52469. (0, _util.warn)(`XFA - ref is empty in node ${child[_xfa_object.$nodeName]}.`);
  52470. this._setAndBind(child, dataNode);
  52471. continue;
  52472. }
  52473. ref = child.bind.ref;
  52474. break;
  52475. default:
  52476. break;
  52477. }
  52478. if (child.bind.picture) {
  52479. picture = child.bind.picture[_xfa_object.$content];
  52480. }
  52481. }
  52482. const [min, max] = this._getOccurInfo(child);
  52483. if (ref) {
  52484. match = (0, _som.searchNode)(this.root, dataNode, ref, true, false);
  52485. if (match === null) {
  52486. match = (0, _som.createDataNode)(this.data, dataNode, ref);
  52487. if (!match) {
  52488. continue;
  52489. }
  52490. if (this._isConsumeData()) {
  52491. match[_xfa_object.$consumed] = true;
  52492. }
  52493. this._setAndBind(child, match);
  52494. continue;
  52495. } else {
  52496. if (this._isConsumeData()) {
  52497. match = match.filter(node => !node[_xfa_object.$consumed]);
  52498. }
  52499. if (match.length > max) {
  52500. match = match.slice(0, max);
  52501. } else if (match.length === 0) {
  52502. match = null;
  52503. }
  52504. if (match && this._isConsumeData()) {
  52505. match.forEach(node => {
  52506. node[_xfa_object.$consumed] = true;
  52507. });
  52508. }
  52509. }
  52510. } else {
  52511. if (!child.name) {
  52512. this._setAndBind(child, dataNode);
  52513. continue;
  52514. }
  52515. if (this._isConsumeData()) {
  52516. const matches = [];
  52517. while (matches.length < max) {
  52518. const found = this._findDataByNameToConsume(child.name, child[_xfa_object.$hasSettableValue](), dataNode, global);
  52519. if (!found) {
  52520. break;
  52521. }
  52522. found[_xfa_object.$consumed] = true;
  52523. matches.push(found);
  52524. }
  52525. match = matches.length > 0 ? matches : null;
  52526. } else {
  52527. match = dataNode[_xfa_object.$getRealChildrenByNameIt](child.name, false, this.emptyMerge).next().value;
  52528. if (!match) {
  52529. if (min === 0) {
  52530. uselessNodes.push(child);
  52531. continue;
  52532. }
  52533. const nsId = dataNode[_xfa_object.$namespaceId] === NS_DATASETS ? -1 : dataNode[_xfa_object.$namespaceId];
  52534. match = child[_xfa_object.$data] = new _xfa_object.XmlObject(nsId, child.name);
  52535. if (this.emptyMerge) {
  52536. match[_xfa_object.$consumed] = true;
  52537. }
  52538. dataNode[_xfa_object.$appendChild](match);
  52539. this._setAndBind(child, match);
  52540. continue;
  52541. }
  52542. if (this.emptyMerge) {
  52543. match[_xfa_object.$consumed] = true;
  52544. }
  52545. match = [match];
  52546. }
  52547. }
  52548. if (match) {
  52549. this._bindOccurrences(child, match, picture);
  52550. } else if (min > 0) {
  52551. this._setAndBind(child, dataNode);
  52552. } else {
  52553. uselessNodes.push(child);
  52554. }
  52555. }
  52556. uselessNodes.forEach(node => node[_xfa_object.$getParent]()[_xfa_object.$removeChild](node));
  52557. }
  52558. }
  52559. exports.Binder = Binder;
  52560. /***/ }),
  52561. /* 82 */
  52562. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  52563. Object.defineProperty(exports, "__esModule", ({
  52564. value: true
  52565. }));
  52566. exports.Value = exports.Text = exports.TemplateNamespace = exports.Template = exports.SetProperty = exports.Items = exports.Field = exports.BindItems = void 0;
  52567. var _xfa_object = __w_pdfjs_require__(77);
  52568. var _namespaces = __w_pdfjs_require__(79);
  52569. var _layout = __w_pdfjs_require__(83);
  52570. var _html_utils = __w_pdfjs_require__(84);
  52571. var _utils = __w_pdfjs_require__(78);
  52572. var _util = __w_pdfjs_require__(2);
  52573. var _fonts = __w_pdfjs_require__(85);
  52574. var _core_utils = __w_pdfjs_require__(8);
  52575. var _som = __w_pdfjs_require__(80);
  52576. const TEMPLATE_NS_ID = _namespaces.NamespaceIds.template.id;
  52577. const SVG_NS = "http://www.w3.org/2000/svg";
  52578. const MAX_ATTEMPTS_FOR_LRTB_LAYOUT = 2;
  52579. const MAX_EMPTY_PAGES = 3;
  52580. const DEFAULT_TAB_INDEX = 5000;
  52581. const HEADING_PATTERN = /^H(\d+)$/;
  52582. 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"]);
  52583. 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"]];
  52584. function getBorderDims(node) {
  52585. if (!node || !node.border) {
  52586. return {
  52587. w: 0,
  52588. h: 0
  52589. };
  52590. }
  52591. const borderExtra = node.border[_xfa_object.$getExtra]();
  52592. if (!borderExtra) {
  52593. return {
  52594. w: 0,
  52595. h: 0
  52596. };
  52597. }
  52598. return {
  52599. w: borderExtra.widths[0] + borderExtra.widths[2] + borderExtra.insets[0] + borderExtra.insets[2],
  52600. h: borderExtra.widths[1] + borderExtra.widths[3] + borderExtra.insets[1] + borderExtra.insets[3]
  52601. };
  52602. }
  52603. function hasMargin(node) {
  52604. return node.margin && (node.margin.topInset || node.margin.rightInset || node.margin.bottomInset || node.margin.leftInset);
  52605. }
  52606. function _setValue(templateNode, value) {
  52607. if (!templateNode.value) {
  52608. const nodeValue = new Value({});
  52609. templateNode[_xfa_object.$appendChild](nodeValue);
  52610. templateNode.value = nodeValue;
  52611. }
  52612. templateNode.value[_xfa_object.$setValue](value);
  52613. }
  52614. function* getContainedChildren(node) {
  52615. for (const child of node[_xfa_object.$getChildren]()) {
  52616. if (child instanceof SubformSet) {
  52617. yield* child[_xfa_object.$getContainedChildren]();
  52618. continue;
  52619. }
  52620. yield child;
  52621. }
  52622. }
  52623. function setTabIndex(node) {
  52624. while (node) {
  52625. if (!node.traversal) {
  52626. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52627. return;
  52628. }
  52629. if (node[_xfa_object.$tabIndex]) {
  52630. return;
  52631. }
  52632. let next = null;
  52633. for (const child of node.traversal[_xfa_object.$getChildren]()) {
  52634. if (child.operation === "next") {
  52635. next = child;
  52636. break;
  52637. }
  52638. }
  52639. if (!next || !next.ref) {
  52640. node[_xfa_object.$tabIndex] = node[_xfa_object.$getParent]()[_xfa_object.$tabIndex];
  52641. return;
  52642. }
  52643. const root = node[_xfa_object.$getTemplateRoot]();
  52644. node[_xfa_object.$tabIndex] = ++root[_xfa_object.$tabIndex];
  52645. const ref = root[_xfa_object.$searchNode](next.ref, node);
  52646. if (!ref) {
  52647. return;
  52648. }
  52649. node = ref[0];
  52650. }
  52651. }
  52652. function applyAssist(obj, attributes) {
  52653. const assist = obj.assist;
  52654. if (assist) {
  52655. const assistTitle = assist[_xfa_object.$toHTML]();
  52656. if (assistTitle) {
  52657. attributes.title = assistTitle;
  52658. }
  52659. const role = assist.role;
  52660. const match = role.match(HEADING_PATTERN);
  52661. if (match) {
  52662. const ariaRole = "heading";
  52663. const ariaLevel = match[1];
  52664. attributes.role = ariaRole;
  52665. attributes["aria-level"] = ariaLevel;
  52666. }
  52667. }
  52668. if (obj.layout === "table") {
  52669. attributes.role = "table";
  52670. } else if (obj.layout === "row") {
  52671. attributes.role = "row";
  52672. } else {
  52673. const parent = obj[_xfa_object.$getParent]();
  52674. if (parent.layout === "row") {
  52675. if (parent.assist && parent.assist.role === "TH") {
  52676. attributes.role = "columnheader";
  52677. } else {
  52678. attributes.role = "cell";
  52679. }
  52680. }
  52681. }
  52682. }
  52683. function ariaLabel(obj) {
  52684. if (!obj.assist) {
  52685. return null;
  52686. }
  52687. const assist = obj.assist;
  52688. if (assist.speak && assist.speak[_xfa_object.$content] !== "") {
  52689. return assist.speak[_xfa_object.$content];
  52690. }
  52691. if (assist.toolTip) {
  52692. return assist.toolTip[_xfa_object.$content];
  52693. }
  52694. return null;
  52695. }
  52696. function valueToHtml(value) {
  52697. return _utils.HTMLResult.success({
  52698. name: "div",
  52699. attributes: {
  52700. class: ["xfaRich"],
  52701. style: Object.create(null)
  52702. },
  52703. children: [{
  52704. name: "span",
  52705. attributes: {
  52706. style: Object.create(null)
  52707. },
  52708. value
  52709. }]
  52710. });
  52711. }
  52712. function setFirstUnsplittable(node) {
  52713. const root = node[_xfa_object.$getTemplateRoot]();
  52714. if (root[_xfa_object.$extra].firstUnsplittable === null) {
  52715. root[_xfa_object.$extra].firstUnsplittable = node;
  52716. root[_xfa_object.$extra].noLayoutFailure = true;
  52717. }
  52718. }
  52719. function unsetFirstUnsplittable(node) {
  52720. const root = node[_xfa_object.$getTemplateRoot]();
  52721. if (root[_xfa_object.$extra].firstUnsplittable === node) {
  52722. root[_xfa_object.$extra].noLayoutFailure = false;
  52723. }
  52724. }
  52725. function handleBreak(node) {
  52726. if (node[_xfa_object.$extra]) {
  52727. return false;
  52728. }
  52729. node[_xfa_object.$extra] = Object.create(null);
  52730. if (node.targetType === "auto") {
  52731. return false;
  52732. }
  52733. const root = node[_xfa_object.$getTemplateRoot]();
  52734. let target = null;
  52735. if (node.target) {
  52736. target = root[_xfa_object.$searchNode](node.target, node[_xfa_object.$getParent]());
  52737. if (!target) {
  52738. return false;
  52739. }
  52740. target = target[0];
  52741. }
  52742. const {
  52743. currentPageArea,
  52744. currentContentArea
  52745. } = root[_xfa_object.$extra];
  52746. if (node.targetType === "pageArea") {
  52747. if (!(target instanceof PageArea)) {
  52748. target = null;
  52749. }
  52750. if (node.startNew) {
  52751. node[_xfa_object.$extra].target = target || currentPageArea;
  52752. return true;
  52753. } else if (target && target !== currentPageArea) {
  52754. node[_xfa_object.$extra].target = target;
  52755. return true;
  52756. }
  52757. return false;
  52758. }
  52759. if (!(target instanceof ContentArea)) {
  52760. target = null;
  52761. }
  52762. const pageArea = target && target[_xfa_object.$getParent]();
  52763. let index;
  52764. let nextPageArea = pageArea;
  52765. if (node.startNew) {
  52766. if (target) {
  52767. const contentAreas = pageArea.contentArea.children;
  52768. const indexForCurrent = contentAreas.indexOf(currentContentArea);
  52769. const indexForTarget = contentAreas.indexOf(target);
  52770. if (indexForCurrent !== -1 && indexForCurrent < indexForTarget) {
  52771. nextPageArea = null;
  52772. }
  52773. index = indexForTarget - 1;
  52774. } else {
  52775. index = currentPageArea.contentArea.children.indexOf(currentContentArea);
  52776. }
  52777. } else if (target && target !== currentContentArea) {
  52778. const contentAreas = pageArea.contentArea.children;
  52779. index = contentAreas.indexOf(target) - 1;
  52780. nextPageArea = pageArea === currentPageArea ? null : pageArea;
  52781. } else {
  52782. return false;
  52783. }
  52784. node[_xfa_object.$extra].target = nextPageArea;
  52785. node[_xfa_object.$extra].index = index;
  52786. return true;
  52787. }
  52788. function handleOverflow(node, extraNode, space) {
  52789. const root = node[_xfa_object.$getTemplateRoot]();
  52790. const saved = root[_xfa_object.$extra].noLayoutFailure;
  52791. const savedMethod = extraNode[_xfa_object.$getSubformParent];
  52792. extraNode[_xfa_object.$getSubformParent] = () => node;
  52793. root[_xfa_object.$extra].noLayoutFailure = true;
  52794. const res = extraNode[_xfa_object.$toHTML](space);
  52795. node[_xfa_object.$addHTML](res.html, res.bbox);
  52796. root[_xfa_object.$extra].noLayoutFailure = saved;
  52797. extraNode[_xfa_object.$getSubformParent] = savedMethod;
  52798. }
  52799. class AppearanceFilter extends _xfa_object.StringObject {
  52800. constructor(attributes) {
  52801. super(TEMPLATE_NS_ID, "appearanceFilter");
  52802. this.id = attributes.id || "";
  52803. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  52804. this.use = attributes.use || "";
  52805. this.usehref = attributes.usehref || "";
  52806. }
  52807. }
  52808. class Arc extends _xfa_object.XFAObject {
  52809. constructor(attributes) {
  52810. super(TEMPLATE_NS_ID, "arc", true);
  52811. this.circular = (0, _utils.getInteger)({
  52812. data: attributes.circular,
  52813. defaultValue: 0,
  52814. validate: x => x === 1
  52815. });
  52816. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  52817. this.id = attributes.id || "";
  52818. this.startAngle = (0, _utils.getFloat)({
  52819. data: attributes.startAngle,
  52820. defaultValue: 0,
  52821. validate: x => true
  52822. });
  52823. this.sweepAngle = (0, _utils.getFloat)({
  52824. data: attributes.sweepAngle,
  52825. defaultValue: 360,
  52826. validate: x => true
  52827. });
  52828. this.use = attributes.use || "";
  52829. this.usehref = attributes.usehref || "";
  52830. this.edge = null;
  52831. this.fill = null;
  52832. }
  52833. [_xfa_object.$toHTML]() {
  52834. const edge = this.edge ? this.edge : new Edge({});
  52835. const edgeStyle = edge[_xfa_object.$toStyle]();
  52836. const style = Object.create(null);
  52837. if (this.fill && this.fill.presence === "visible") {
  52838. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  52839. } else {
  52840. style.fill = "transparent";
  52841. }
  52842. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  52843. style.stroke = edgeStyle.color;
  52844. let arc;
  52845. const attributes = {
  52846. xmlns: SVG_NS,
  52847. style: {
  52848. width: "100%",
  52849. height: "100%",
  52850. overflow: "visible"
  52851. }
  52852. };
  52853. if (this.sweepAngle === 360) {
  52854. arc = {
  52855. name: "ellipse",
  52856. attributes: {
  52857. xmlns: SVG_NS,
  52858. cx: "50%",
  52859. cy: "50%",
  52860. rx: "50%",
  52861. ry: "50%",
  52862. style
  52863. }
  52864. };
  52865. } else {
  52866. const startAngle = this.startAngle * Math.PI / 180;
  52867. const sweepAngle = this.sweepAngle * Math.PI / 180;
  52868. const largeArc = this.sweepAngle > 180 ? 1 : 0;
  52869. 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))];
  52870. arc = {
  52871. name: "path",
  52872. attributes: {
  52873. xmlns: SVG_NS,
  52874. d: `M ${x1} ${y1} A 50 50 0 ${largeArc} 0 ${x2} ${y2}`,
  52875. vectorEffect: "non-scaling-stroke",
  52876. style
  52877. }
  52878. };
  52879. Object.assign(attributes, {
  52880. viewBox: "0 0 100 100",
  52881. preserveAspectRatio: "none"
  52882. });
  52883. }
  52884. const svg = {
  52885. name: "svg",
  52886. children: [arc],
  52887. attributes
  52888. };
  52889. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  52890. if (hasMargin(parent)) {
  52891. return _utils.HTMLResult.success({
  52892. name: "div",
  52893. attributes: {
  52894. style: {
  52895. display: "inline",
  52896. width: "100%",
  52897. height: "100%"
  52898. }
  52899. },
  52900. children: [svg]
  52901. });
  52902. }
  52903. svg.attributes.style.position = "absolute";
  52904. return _utils.HTMLResult.success(svg);
  52905. }
  52906. }
  52907. class Area extends _xfa_object.XFAObject {
  52908. constructor(attributes) {
  52909. super(TEMPLATE_NS_ID, "area", true);
  52910. this.colSpan = (0, _utils.getInteger)({
  52911. data: attributes.colSpan,
  52912. defaultValue: 1,
  52913. validate: n => n >= 1 || n === -1
  52914. });
  52915. this.id = attributes.id || "";
  52916. this.name = attributes.name || "";
  52917. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  52918. this.use = attributes.use || "";
  52919. this.usehref = attributes.usehref || "";
  52920. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  52921. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  52922. this.desc = null;
  52923. this.extras = null;
  52924. this.area = new _xfa_object.XFAObjectArray();
  52925. this.draw = new _xfa_object.XFAObjectArray();
  52926. this.exObject = new _xfa_object.XFAObjectArray();
  52927. this.exclGroup = new _xfa_object.XFAObjectArray();
  52928. this.field = new _xfa_object.XFAObjectArray();
  52929. this.subform = new _xfa_object.XFAObjectArray();
  52930. this.subformSet = new _xfa_object.XFAObjectArray();
  52931. }
  52932. *[_xfa_object.$getContainedChildren]() {
  52933. yield* getContainedChildren(this);
  52934. }
  52935. [_xfa_object.$isTransparent]() {
  52936. return true;
  52937. }
  52938. [_xfa_object.$isBindable]() {
  52939. return true;
  52940. }
  52941. [_xfa_object.$addHTML](html, bbox) {
  52942. const [x, y, w, h] = bbox;
  52943. this[_xfa_object.$extra].width = Math.max(this[_xfa_object.$extra].width, x + w);
  52944. this[_xfa_object.$extra].height = Math.max(this[_xfa_object.$extra].height, y + h);
  52945. this[_xfa_object.$extra].children.push(html);
  52946. }
  52947. [_xfa_object.$getAvailableSpace]() {
  52948. return this[_xfa_object.$extra].availableSpace;
  52949. }
  52950. [_xfa_object.$toHTML](availableSpace) {
  52951. const style = (0, _html_utils.toStyle)(this, "position");
  52952. const attributes = {
  52953. style,
  52954. id: this[_xfa_object.$uid],
  52955. class: ["xfaArea"]
  52956. };
  52957. if ((0, _html_utils.isPrintOnly)(this)) {
  52958. attributes.class.push("xfaPrintOnly");
  52959. }
  52960. if (this.name) {
  52961. attributes.xfaName = this.name;
  52962. }
  52963. const children = [];
  52964. this[_xfa_object.$extra] = {
  52965. children,
  52966. width: 0,
  52967. height: 0,
  52968. availableSpace
  52969. };
  52970. const result = this[_xfa_object.$childrenToHTML]({
  52971. filter: new Set(["area", "draw", "field", "exclGroup", "subform", "subformSet"]),
  52972. include: true
  52973. });
  52974. if (!result.success) {
  52975. if (result.isBreak()) {
  52976. return result;
  52977. }
  52978. delete this[_xfa_object.$extra];
  52979. return _utils.HTMLResult.FAILURE;
  52980. }
  52981. style.width = (0, _html_utils.measureToString)(this[_xfa_object.$extra].width);
  52982. style.height = (0, _html_utils.measureToString)(this[_xfa_object.$extra].height);
  52983. const html = {
  52984. name: "div",
  52985. attributes,
  52986. children
  52987. };
  52988. const bbox = [this.x, this.y, this[_xfa_object.$extra].width, this[_xfa_object.$extra].height];
  52989. delete this[_xfa_object.$extra];
  52990. return _utils.HTMLResult.success(html, bbox);
  52991. }
  52992. }
  52993. class Assist extends _xfa_object.XFAObject {
  52994. constructor(attributes) {
  52995. super(TEMPLATE_NS_ID, "assist", true);
  52996. this.id = attributes.id || "";
  52997. this.role = attributes.role || "";
  52998. this.use = attributes.use || "";
  52999. this.usehref = attributes.usehref || "";
  53000. this.speak = null;
  53001. this.toolTip = null;
  53002. }
  53003. [_xfa_object.$toHTML]() {
  53004. return this.toolTip && this.toolTip[_xfa_object.$content] ? this.toolTip[_xfa_object.$content] : null;
  53005. }
  53006. }
  53007. class Barcode extends _xfa_object.XFAObject {
  53008. constructor(attributes) {
  53009. super(TEMPLATE_NS_ID, "barcode", true);
  53010. this.charEncoding = (0, _utils.getKeyword)({
  53011. data: attributes.charEncoding ? attributes.charEncoding.toLowerCase() : "",
  53012. defaultValue: "",
  53013. 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}/)
  53014. });
  53015. this.checksum = (0, _utils.getStringOption)(attributes.checksum, ["none", "1mod10", "1mod10_1mod11", "2mod10", "auto"]);
  53016. this.dataColumnCount = (0, _utils.getInteger)({
  53017. data: attributes.dataColumnCount,
  53018. defaultValue: -1,
  53019. validate: x => x >= 0
  53020. });
  53021. this.dataLength = (0, _utils.getInteger)({
  53022. data: attributes.dataLength,
  53023. defaultValue: -1,
  53024. validate: x => x >= 0
  53025. });
  53026. this.dataPrep = (0, _utils.getStringOption)(attributes.dataPrep, ["none", "flateCompress"]);
  53027. this.dataRowCount = (0, _utils.getInteger)({
  53028. data: attributes.dataRowCount,
  53029. defaultValue: -1,
  53030. validate: x => x >= 0
  53031. });
  53032. this.endChar = attributes.endChar || "";
  53033. this.errorCorrectionLevel = (0, _utils.getInteger)({
  53034. data: attributes.errorCorrectionLevel,
  53035. defaultValue: -1,
  53036. validate: x => x >= 0 && x <= 8
  53037. });
  53038. this.id = attributes.id || "";
  53039. this.moduleHeight = (0, _utils.getMeasurement)(attributes.moduleHeight, "5mm");
  53040. this.moduleWidth = (0, _utils.getMeasurement)(attributes.moduleWidth, "0.25mm");
  53041. this.printCheckDigit = (0, _utils.getInteger)({
  53042. data: attributes.printCheckDigit,
  53043. defaultValue: 0,
  53044. validate: x => x === 1
  53045. });
  53046. this.rowColumnRatio = (0, _utils.getRatio)(attributes.rowColumnRatio);
  53047. this.startChar = attributes.startChar || "";
  53048. this.textLocation = (0, _utils.getStringOption)(attributes.textLocation, ["below", "above", "aboveEmbedded", "belowEmbedded", "none"]);
  53049. this.truncate = (0, _utils.getInteger)({
  53050. data: attributes.truncate,
  53051. defaultValue: 0,
  53052. validate: x => x === 1
  53053. });
  53054. this.type = (0, _utils.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"]);
  53055. this.upsMode = (0, _utils.getStringOption)(attributes.upsMode, ["usCarrier", "internationalCarrier", "secureSymbol", "standardSymbol"]);
  53056. this.use = attributes.use || "";
  53057. this.usehref = attributes.usehref || "";
  53058. this.wideNarrowRatio = (0, _utils.getRatio)(attributes.wideNarrowRatio);
  53059. this.encrypt = null;
  53060. this.extras = null;
  53061. }
  53062. }
  53063. class Bind extends _xfa_object.XFAObject {
  53064. constructor(attributes) {
  53065. super(TEMPLATE_NS_ID, "bind", true);
  53066. this.match = (0, _utils.getStringOption)(attributes.match, ["once", "dataRef", "global", "none"]);
  53067. this.ref = attributes.ref || "";
  53068. this.picture = null;
  53069. }
  53070. }
  53071. class BindItems extends _xfa_object.XFAObject {
  53072. constructor(attributes) {
  53073. super(TEMPLATE_NS_ID, "bindItems");
  53074. this.connection = attributes.connection || "";
  53075. this.labelRef = attributes.labelRef || "";
  53076. this.ref = attributes.ref || "";
  53077. this.valueRef = attributes.valueRef || "";
  53078. }
  53079. }
  53080. exports.BindItems = BindItems;
  53081. class Bookend extends _xfa_object.XFAObject {
  53082. constructor(attributes) {
  53083. super(TEMPLATE_NS_ID, "bookend");
  53084. this.id = attributes.id || "";
  53085. this.leader = attributes.leader || "";
  53086. this.trailer = attributes.trailer || "";
  53087. this.use = attributes.use || "";
  53088. this.usehref = attributes.usehref || "";
  53089. }
  53090. }
  53091. class BooleanElement extends _xfa_object.Option01 {
  53092. constructor(attributes) {
  53093. super(TEMPLATE_NS_ID, "boolean");
  53094. this.id = attributes.id || "";
  53095. this.name = attributes.name || "";
  53096. this.use = attributes.use || "";
  53097. this.usehref = attributes.usehref || "";
  53098. }
  53099. [_xfa_object.$toHTML](availableSpace) {
  53100. return valueToHtml(this[_xfa_object.$content] === 1 ? "1" : "0");
  53101. }
  53102. }
  53103. class Border extends _xfa_object.XFAObject {
  53104. constructor(attributes) {
  53105. super(TEMPLATE_NS_ID, "border", true);
  53106. this.break = (0, _utils.getStringOption)(attributes.break, ["close", "open"]);
  53107. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  53108. this.id = attributes.id || "";
  53109. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53110. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53111. this.use = attributes.use || "";
  53112. this.usehref = attributes.usehref || "";
  53113. this.corner = new _xfa_object.XFAObjectArray(4);
  53114. this.edge = new _xfa_object.XFAObjectArray(4);
  53115. this.extras = null;
  53116. this.fill = null;
  53117. this.margin = null;
  53118. }
  53119. [_xfa_object.$getExtra]() {
  53120. if (!this[_xfa_object.$extra]) {
  53121. const edges = this.edge.children.slice();
  53122. if (edges.length < 4) {
  53123. const defaultEdge = edges[edges.length - 1] || new Edge({});
  53124. for (let i = edges.length; i < 4; i++) {
  53125. edges.push(defaultEdge);
  53126. }
  53127. }
  53128. const widths = edges.map(edge => edge.thickness);
  53129. const insets = [0, 0, 0, 0];
  53130. if (this.margin) {
  53131. insets[0] = this.margin.topInset;
  53132. insets[1] = this.margin.rightInset;
  53133. insets[2] = this.margin.bottomInset;
  53134. insets[3] = this.margin.leftInset;
  53135. }
  53136. this[_xfa_object.$extra] = {
  53137. widths,
  53138. insets,
  53139. edges
  53140. };
  53141. }
  53142. return this[_xfa_object.$extra];
  53143. }
  53144. [_xfa_object.$toStyle]() {
  53145. const {
  53146. edges
  53147. } = this[_xfa_object.$getExtra]();
  53148. const edgeStyles = edges.map(node => {
  53149. const style = node[_xfa_object.$toStyle]();
  53150. style.color = style.color || "#000000";
  53151. return style;
  53152. });
  53153. const style = Object.create(null);
  53154. if (this.margin) {
  53155. Object.assign(style, this.margin[_xfa_object.$toStyle]());
  53156. }
  53157. if (this.fill && this.fill.presence === "visible") {
  53158. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  53159. }
  53160. if (this.corner.children.some(node => node.radius !== 0)) {
  53161. const cornerStyles = this.corner.children.map(node => node[_xfa_object.$toStyle]());
  53162. if (cornerStyles.length === 2 || cornerStyles.length === 3) {
  53163. const last = cornerStyles[cornerStyles.length - 1];
  53164. for (let i = cornerStyles.length; i < 4; i++) {
  53165. cornerStyles.push(last);
  53166. }
  53167. }
  53168. style.borderRadius = cornerStyles.map(s => s.radius).join(" ");
  53169. }
  53170. switch (this.presence) {
  53171. case "invisible":
  53172. case "hidden":
  53173. style.borderStyle = "";
  53174. break;
  53175. case "inactive":
  53176. style.borderStyle = "none";
  53177. break;
  53178. default:
  53179. style.borderStyle = edgeStyles.map(s => s.style).join(" ");
  53180. break;
  53181. }
  53182. style.borderWidth = edgeStyles.map(s => s.width).join(" ");
  53183. style.borderColor = edgeStyles.map(s => s.color).join(" ");
  53184. return style;
  53185. }
  53186. }
  53187. class Break extends _xfa_object.XFAObject {
  53188. constructor(attributes) {
  53189. super(TEMPLATE_NS_ID, "break", true);
  53190. this.after = (0, _utils.getStringOption)(attributes.after, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53191. this.afterTarget = attributes.afterTarget || "";
  53192. this.before = (0, _utils.getStringOption)(attributes.before, ["auto", "contentArea", "pageArea", "pageEven", "pageOdd"]);
  53193. this.beforeTarget = attributes.beforeTarget || "";
  53194. this.bookendLeader = attributes.bookendLeader || "";
  53195. this.bookendTrailer = attributes.bookendTrailer || "";
  53196. this.id = attributes.id || "";
  53197. this.overflowLeader = attributes.overflowLeader || "";
  53198. this.overflowTarget = attributes.overflowTarget || "";
  53199. this.overflowTrailer = attributes.overflowTrailer || "";
  53200. this.startNew = (0, _utils.getInteger)({
  53201. data: attributes.startNew,
  53202. defaultValue: 0,
  53203. validate: x => x === 1
  53204. });
  53205. this.use = attributes.use || "";
  53206. this.usehref = attributes.usehref || "";
  53207. this.extras = null;
  53208. }
  53209. }
  53210. class BreakAfter extends _xfa_object.XFAObject {
  53211. constructor(attributes) {
  53212. super(TEMPLATE_NS_ID, "breakAfter", true);
  53213. this.id = attributes.id || "";
  53214. this.leader = attributes.leader || "";
  53215. this.startNew = (0, _utils.getInteger)({
  53216. data: attributes.startNew,
  53217. defaultValue: 0,
  53218. validate: x => x === 1
  53219. });
  53220. this.target = attributes.target || "";
  53221. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53222. this.trailer = attributes.trailer || "";
  53223. this.use = attributes.use || "";
  53224. this.usehref = attributes.usehref || "";
  53225. this.script = null;
  53226. }
  53227. }
  53228. class BreakBefore extends _xfa_object.XFAObject {
  53229. constructor(attributes) {
  53230. super(TEMPLATE_NS_ID, "breakBefore", true);
  53231. this.id = attributes.id || "";
  53232. this.leader = attributes.leader || "";
  53233. this.startNew = (0, _utils.getInteger)({
  53234. data: attributes.startNew,
  53235. defaultValue: 0,
  53236. validate: x => x === 1
  53237. });
  53238. this.target = attributes.target || "";
  53239. this.targetType = (0, _utils.getStringOption)(attributes.targetType, ["auto", "contentArea", "pageArea"]);
  53240. this.trailer = attributes.trailer || "";
  53241. this.use = attributes.use || "";
  53242. this.usehref = attributes.usehref || "";
  53243. this.script = null;
  53244. }
  53245. [_xfa_object.$toHTML](availableSpace) {
  53246. this[_xfa_object.$extra] = {};
  53247. return _utils.HTMLResult.FAILURE;
  53248. }
  53249. }
  53250. class Button extends _xfa_object.XFAObject {
  53251. constructor(attributes) {
  53252. super(TEMPLATE_NS_ID, "button", true);
  53253. this.highlight = (0, _utils.getStringOption)(attributes.highlight, ["inverted", "none", "outline", "push"]);
  53254. this.id = attributes.id || "";
  53255. this.use = attributes.use || "";
  53256. this.usehref = attributes.usehref || "";
  53257. this.extras = null;
  53258. }
  53259. [_xfa_object.$toHTML](availableSpace) {
  53260. const parent = this[_xfa_object.$getParent]();
  53261. const grandpa = parent[_xfa_object.$getParent]();
  53262. const htmlButton = {
  53263. name: "button",
  53264. attributes: {
  53265. id: this[_xfa_object.$uid],
  53266. class: ["xfaButton"],
  53267. style: {}
  53268. },
  53269. children: []
  53270. };
  53271. for (const event of grandpa.event.children) {
  53272. if (event.activity !== "click" || !event.script) {
  53273. continue;
  53274. }
  53275. const jsURL = (0, _core_utils.recoverJsURL)(event.script[_xfa_object.$content]);
  53276. if (!jsURL) {
  53277. continue;
  53278. }
  53279. const href = (0, _html_utils.fixURL)(jsURL.url);
  53280. if (!href) {
  53281. continue;
  53282. }
  53283. htmlButton.children.push({
  53284. name: "a",
  53285. attributes: {
  53286. id: "link" + this[_xfa_object.$uid],
  53287. href,
  53288. newWindow: jsURL.newWindow,
  53289. class: ["xfaLink"],
  53290. style: {}
  53291. },
  53292. children: []
  53293. });
  53294. }
  53295. return _utils.HTMLResult.success(htmlButton);
  53296. }
  53297. }
  53298. class Calculate extends _xfa_object.XFAObject {
  53299. constructor(attributes) {
  53300. super(TEMPLATE_NS_ID, "calculate", true);
  53301. this.id = attributes.id || "";
  53302. this.override = (0, _utils.getStringOption)(attributes.override, ["disabled", "error", "ignore", "warning"]);
  53303. this.use = attributes.use || "";
  53304. this.usehref = attributes.usehref || "";
  53305. this.extras = null;
  53306. this.message = null;
  53307. this.script = null;
  53308. }
  53309. }
  53310. class Caption extends _xfa_object.XFAObject {
  53311. constructor(attributes) {
  53312. super(TEMPLATE_NS_ID, "caption", true);
  53313. this.id = attributes.id || "";
  53314. this.placement = (0, _utils.getStringOption)(attributes.placement, ["left", "bottom", "inline", "right", "top"]);
  53315. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53316. this.reserve = Math.ceil((0, _utils.getMeasurement)(attributes.reserve));
  53317. this.use = attributes.use || "";
  53318. this.usehref = attributes.usehref || "";
  53319. this.extras = null;
  53320. this.font = null;
  53321. this.margin = null;
  53322. this.para = null;
  53323. this.value = null;
  53324. }
  53325. [_xfa_object.$setValue](value) {
  53326. _setValue(this, value);
  53327. }
  53328. [_xfa_object.$getExtra](availableSpace) {
  53329. if (!this[_xfa_object.$extra]) {
  53330. let {
  53331. width,
  53332. height
  53333. } = availableSpace;
  53334. switch (this.placement) {
  53335. case "left":
  53336. case "right":
  53337. case "inline":
  53338. width = this.reserve <= 0 ? width : this.reserve;
  53339. break;
  53340. case "top":
  53341. case "bottom":
  53342. height = this.reserve <= 0 ? height : this.reserve;
  53343. break;
  53344. }
  53345. this[_xfa_object.$extra] = (0, _html_utils.layoutNode)(this, {
  53346. width,
  53347. height
  53348. });
  53349. }
  53350. return this[_xfa_object.$extra];
  53351. }
  53352. [_xfa_object.$toHTML](availableSpace) {
  53353. if (!this.value) {
  53354. return _utils.HTMLResult.EMPTY;
  53355. }
  53356. this[_xfa_object.$pushPara]();
  53357. const value = this.value[_xfa_object.$toHTML](availableSpace).html;
  53358. if (!value) {
  53359. this[_xfa_object.$popPara]();
  53360. return _utils.HTMLResult.EMPTY;
  53361. }
  53362. const savedReserve = this.reserve;
  53363. if (this.reserve <= 0) {
  53364. const {
  53365. w,
  53366. h
  53367. } = this[_xfa_object.$getExtra](availableSpace);
  53368. switch (this.placement) {
  53369. case "left":
  53370. case "right":
  53371. case "inline":
  53372. this.reserve = w;
  53373. break;
  53374. case "top":
  53375. case "bottom":
  53376. this.reserve = h;
  53377. break;
  53378. }
  53379. }
  53380. const children = [];
  53381. if (typeof value === "string") {
  53382. children.push({
  53383. name: "#text",
  53384. value
  53385. });
  53386. } else {
  53387. children.push(value);
  53388. }
  53389. const style = (0, _html_utils.toStyle)(this, "font", "margin", "visibility");
  53390. switch (this.placement) {
  53391. case "left":
  53392. case "right":
  53393. if (this.reserve > 0) {
  53394. style.width = (0, _html_utils.measureToString)(this.reserve);
  53395. }
  53396. break;
  53397. case "top":
  53398. case "bottom":
  53399. if (this.reserve > 0) {
  53400. style.height = (0, _html_utils.measureToString)(this.reserve);
  53401. }
  53402. break;
  53403. }
  53404. (0, _html_utils.setPara)(this, null, value);
  53405. this[_xfa_object.$popPara]();
  53406. this.reserve = savedReserve;
  53407. return _utils.HTMLResult.success({
  53408. name: "div",
  53409. attributes: {
  53410. style,
  53411. class: ["xfaCaption"]
  53412. },
  53413. children
  53414. });
  53415. }
  53416. }
  53417. class Certificate extends _xfa_object.StringObject {
  53418. constructor(attributes) {
  53419. super(TEMPLATE_NS_ID, "certificate");
  53420. this.id = attributes.id || "";
  53421. this.name = attributes.name || "";
  53422. this.use = attributes.use || "";
  53423. this.usehref = attributes.usehref || "";
  53424. }
  53425. }
  53426. class Certificates extends _xfa_object.XFAObject {
  53427. constructor(attributes) {
  53428. super(TEMPLATE_NS_ID, "certificates", true);
  53429. this.credentialServerPolicy = (0, _utils.getStringOption)(attributes.credentialServerPolicy, ["optional", "required"]);
  53430. this.id = attributes.id || "";
  53431. this.url = attributes.url || "";
  53432. this.urlPolicy = attributes.urlPolicy || "";
  53433. this.use = attributes.use || "";
  53434. this.usehref = attributes.usehref || "";
  53435. this.encryption = null;
  53436. this.issuers = null;
  53437. this.keyUsage = null;
  53438. this.oids = null;
  53439. this.signing = null;
  53440. this.subjectDNs = null;
  53441. }
  53442. }
  53443. class CheckButton extends _xfa_object.XFAObject {
  53444. constructor(attributes) {
  53445. super(TEMPLATE_NS_ID, "checkButton", true);
  53446. this.id = attributes.id || "";
  53447. this.mark = (0, _utils.getStringOption)(attributes.mark, ["default", "check", "circle", "cross", "diamond", "square", "star"]);
  53448. this.shape = (0, _utils.getStringOption)(attributes.shape, ["square", "round"]);
  53449. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  53450. this.use = attributes.use || "";
  53451. this.usehref = attributes.usehref || "";
  53452. this.border = null;
  53453. this.extras = null;
  53454. this.margin = null;
  53455. }
  53456. [_xfa_object.$toHTML](availableSpace) {
  53457. const style = (0, _html_utils.toStyle)("margin");
  53458. const size = (0, _html_utils.measureToString)(this.size);
  53459. style.width = style.height = size;
  53460. let type;
  53461. let className;
  53462. let groupId;
  53463. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53464. const items = field.items.children.length && field.items.children[0][_xfa_object.$toHTML]().html || [];
  53465. const exportedValue = {
  53466. on: (items[0] !== undefined ? items[0] : "on").toString(),
  53467. off: (items[1] !== undefined ? items[1] : "off").toString()
  53468. };
  53469. const value = field.value && field.value[_xfa_object.$text]() || "off";
  53470. const checked = value === exportedValue.on || undefined;
  53471. const container = field[_xfa_object.$getSubformParent]();
  53472. const fieldId = field[_xfa_object.$uid];
  53473. let dataId;
  53474. if (container instanceof ExclGroup) {
  53475. groupId = container[_xfa_object.$uid];
  53476. type = "radio";
  53477. className = "xfaRadio";
  53478. dataId = container[_xfa_object.$data] && container[_xfa_object.$data][_xfa_object.$uid] || container[_xfa_object.$uid];
  53479. } else {
  53480. type = "checkbox";
  53481. className = "xfaCheckbox";
  53482. dataId = field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid];
  53483. }
  53484. const input = {
  53485. name: "input",
  53486. attributes: {
  53487. class: [className],
  53488. style,
  53489. fieldId,
  53490. dataId,
  53491. type,
  53492. checked,
  53493. xfaOn: exportedValue.on,
  53494. xfaOff: exportedValue.off,
  53495. "aria-label": ariaLabel(field)
  53496. }
  53497. };
  53498. if (groupId) {
  53499. input.attributes.name = groupId;
  53500. }
  53501. return _utils.HTMLResult.success({
  53502. name: "label",
  53503. attributes: {
  53504. class: ["xfaLabel"]
  53505. },
  53506. children: [input]
  53507. });
  53508. }
  53509. }
  53510. class ChoiceList extends _xfa_object.XFAObject {
  53511. constructor(attributes) {
  53512. super(TEMPLATE_NS_ID, "choiceList", true);
  53513. this.commitOn = (0, _utils.getStringOption)(attributes.commitOn, ["select", "exit"]);
  53514. this.id = attributes.id || "";
  53515. this.open = (0, _utils.getStringOption)(attributes.open, ["userControl", "always", "multiSelect", "onEntry"]);
  53516. this.textEntry = (0, _utils.getInteger)({
  53517. data: attributes.textEntry,
  53518. defaultValue: 0,
  53519. validate: x => x === 1
  53520. });
  53521. this.use = attributes.use || "";
  53522. this.usehref = attributes.usehref || "";
  53523. this.border = null;
  53524. this.extras = null;
  53525. this.margin = null;
  53526. }
  53527. [_xfa_object.$toHTML](availableSpace) {
  53528. const style = (0, _html_utils.toStyle)(this, "border", "margin");
  53529. const ui = this[_xfa_object.$getParent]();
  53530. const field = ui[_xfa_object.$getParent]();
  53531. const fontSize = field.font && field.font.size || 10;
  53532. const optionStyle = {
  53533. fontSize: `calc(${fontSize}px * var(--zoom-factor))`
  53534. };
  53535. const children = [];
  53536. if (field.items.children.length > 0) {
  53537. const items = field.items;
  53538. let displayedIndex = 0;
  53539. let saveIndex = 0;
  53540. if (items.children.length === 2) {
  53541. displayedIndex = items.children[0].save;
  53542. saveIndex = 1 - displayedIndex;
  53543. }
  53544. const displayed = items.children[displayedIndex][_xfa_object.$toHTML]().html;
  53545. const values = items.children[saveIndex][_xfa_object.$toHTML]().html;
  53546. let selected = false;
  53547. const value = field.value && field.value[_xfa_object.$text]() || "";
  53548. for (let i = 0, ii = displayed.length; i < ii; i++) {
  53549. const option = {
  53550. name: "option",
  53551. attributes: {
  53552. value: values[i] || displayed[i],
  53553. style: optionStyle
  53554. },
  53555. value: displayed[i]
  53556. };
  53557. if (values[i] === value) {
  53558. option.attributes.selected = selected = true;
  53559. }
  53560. children.push(option);
  53561. }
  53562. if (!selected) {
  53563. children.splice(0, 0, {
  53564. name: "option",
  53565. attributes: {
  53566. hidden: true,
  53567. selected: true
  53568. },
  53569. value: " "
  53570. });
  53571. }
  53572. }
  53573. const selectAttributes = {
  53574. class: ["xfaSelect"],
  53575. fieldId: field[_xfa_object.$uid],
  53576. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53577. style,
  53578. "aria-label": ariaLabel(field)
  53579. };
  53580. if (this.open === "multiSelect") {
  53581. selectAttributes.multiple = true;
  53582. }
  53583. return _utils.HTMLResult.success({
  53584. name: "label",
  53585. attributes: {
  53586. class: ["xfaLabel"]
  53587. },
  53588. children: [{
  53589. name: "select",
  53590. children,
  53591. attributes: selectAttributes
  53592. }]
  53593. });
  53594. }
  53595. }
  53596. class Color extends _xfa_object.XFAObject {
  53597. constructor(attributes) {
  53598. super(TEMPLATE_NS_ID, "color", true);
  53599. this.cSpace = (0, _utils.getStringOption)(attributes.cSpace, ["SRGB"]);
  53600. this.id = attributes.id || "";
  53601. this.use = attributes.use || "";
  53602. this.usehref = attributes.usehref || "";
  53603. this.value = attributes.value ? (0, _utils.getColor)(attributes.value) : "";
  53604. this.extras = null;
  53605. }
  53606. [_xfa_object.$hasSettableValue]() {
  53607. return false;
  53608. }
  53609. [_xfa_object.$toStyle]() {
  53610. return this.value ? _util.Util.makeHexColor(this.value.r, this.value.g, this.value.b) : null;
  53611. }
  53612. }
  53613. class Comb extends _xfa_object.XFAObject {
  53614. constructor(attributes) {
  53615. super(TEMPLATE_NS_ID, "comb");
  53616. this.id = attributes.id || "";
  53617. this.numberOfCells = (0, _utils.getInteger)({
  53618. data: attributes.numberOfCells,
  53619. defaultValue: 0,
  53620. validate: x => x >= 0
  53621. });
  53622. this.use = attributes.use || "";
  53623. this.usehref = attributes.usehref || "";
  53624. }
  53625. }
  53626. class Connect extends _xfa_object.XFAObject {
  53627. constructor(attributes) {
  53628. super(TEMPLATE_NS_ID, "connect", true);
  53629. this.connection = attributes.connection || "";
  53630. this.id = attributes.id || "";
  53631. this.ref = attributes.ref || "";
  53632. this.usage = (0, _utils.getStringOption)(attributes.usage, ["exportAndImport", "exportOnly", "importOnly"]);
  53633. this.use = attributes.use || "";
  53634. this.usehref = attributes.usehref || "";
  53635. this.picture = null;
  53636. }
  53637. }
  53638. class ContentArea extends _xfa_object.XFAObject {
  53639. constructor(attributes) {
  53640. super(TEMPLATE_NS_ID, "contentArea", true);
  53641. this.h = (0, _utils.getMeasurement)(attributes.h);
  53642. this.id = attributes.id || "";
  53643. this.name = attributes.name || "";
  53644. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53645. this.use = attributes.use || "";
  53646. this.usehref = attributes.usehref || "";
  53647. this.w = (0, _utils.getMeasurement)(attributes.w);
  53648. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53649. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53650. this.desc = null;
  53651. this.extras = null;
  53652. }
  53653. [_xfa_object.$toHTML](availableSpace) {
  53654. const left = (0, _html_utils.measureToString)(this.x);
  53655. const top = (0, _html_utils.measureToString)(this.y);
  53656. const style = {
  53657. left,
  53658. top,
  53659. width: (0, _html_utils.measureToString)(this.w),
  53660. height: (0, _html_utils.measureToString)(this.h)
  53661. };
  53662. const classNames = ["xfaContentarea"];
  53663. if ((0, _html_utils.isPrintOnly)(this)) {
  53664. classNames.push("xfaPrintOnly");
  53665. }
  53666. return _utils.HTMLResult.success({
  53667. name: "div",
  53668. children: [],
  53669. attributes: {
  53670. style,
  53671. class: classNames,
  53672. id: this[_xfa_object.$uid]
  53673. }
  53674. });
  53675. }
  53676. }
  53677. class Corner extends _xfa_object.XFAObject {
  53678. constructor(attributes) {
  53679. super(TEMPLATE_NS_ID, "corner", true);
  53680. this.id = attributes.id || "";
  53681. this.inverted = (0, _utils.getInteger)({
  53682. data: attributes.inverted,
  53683. defaultValue: 0,
  53684. validate: x => x === 1
  53685. });
  53686. this.join = (0, _utils.getStringOption)(attributes.join, ["square", "round"]);
  53687. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53688. this.radius = (0, _utils.getMeasurement)(attributes.radius);
  53689. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53690. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53691. this.use = attributes.use || "";
  53692. this.usehref = attributes.usehref || "";
  53693. this.color = null;
  53694. this.extras = null;
  53695. }
  53696. [_xfa_object.$toStyle]() {
  53697. const style = (0, _html_utils.toStyle)(this, "visibility");
  53698. style.radius = (0, _html_utils.measureToString)(this.join === "square" ? 0 : this.radius);
  53699. return style;
  53700. }
  53701. }
  53702. class DateElement extends _xfa_object.ContentObject {
  53703. constructor(attributes) {
  53704. super(TEMPLATE_NS_ID, "date");
  53705. this.id = attributes.id || "";
  53706. this.name = attributes.name || "";
  53707. this.use = attributes.use || "";
  53708. this.usehref = attributes.usehref || "";
  53709. }
  53710. [_xfa_object.$finalize]() {
  53711. const date = this[_xfa_object.$content].trim();
  53712. this[_xfa_object.$content] = date ? new Date(date) : null;
  53713. }
  53714. [_xfa_object.$toHTML](availableSpace) {
  53715. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53716. }
  53717. }
  53718. class DateTime extends _xfa_object.ContentObject {
  53719. constructor(attributes) {
  53720. super(TEMPLATE_NS_ID, "dateTime");
  53721. this.id = attributes.id || "";
  53722. this.name = attributes.name || "";
  53723. this.use = attributes.use || "";
  53724. this.usehref = attributes.usehref || "";
  53725. }
  53726. [_xfa_object.$finalize]() {
  53727. const date = this[_xfa_object.$content].trim();
  53728. this[_xfa_object.$content] = date ? new Date(date) : null;
  53729. }
  53730. [_xfa_object.$toHTML](availableSpace) {
  53731. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  53732. }
  53733. }
  53734. class DateTimeEdit extends _xfa_object.XFAObject {
  53735. constructor(attributes) {
  53736. super(TEMPLATE_NS_ID, "dateTimeEdit", true);
  53737. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  53738. this.id = attributes.id || "";
  53739. this.picker = (0, _utils.getStringOption)(attributes.picker, ["host", "none"]);
  53740. this.use = attributes.use || "";
  53741. this.usehref = attributes.usehref || "";
  53742. this.border = null;
  53743. this.comb = null;
  53744. this.extras = null;
  53745. this.margin = null;
  53746. }
  53747. [_xfa_object.$toHTML](availableSpace) {
  53748. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  53749. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  53750. const html = {
  53751. name: "input",
  53752. attributes: {
  53753. type: "text",
  53754. fieldId: field[_xfa_object.$uid],
  53755. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  53756. class: ["xfaTextfield"],
  53757. style,
  53758. "aria-label": ariaLabel(field)
  53759. }
  53760. };
  53761. return _utils.HTMLResult.success({
  53762. name: "label",
  53763. attributes: {
  53764. class: ["xfaLabel"]
  53765. },
  53766. children: [html]
  53767. });
  53768. }
  53769. }
  53770. class Decimal extends _xfa_object.ContentObject {
  53771. constructor(attributes) {
  53772. super(TEMPLATE_NS_ID, "decimal");
  53773. this.fracDigits = (0, _utils.getInteger)({
  53774. data: attributes.fracDigits,
  53775. defaultValue: 2,
  53776. validate: x => true
  53777. });
  53778. this.id = attributes.id || "";
  53779. this.leadDigits = (0, _utils.getInteger)({
  53780. data: attributes.leadDigits,
  53781. defaultValue: -1,
  53782. validate: x => true
  53783. });
  53784. this.name = attributes.name || "";
  53785. this.use = attributes.use || "";
  53786. this.usehref = attributes.usehref || "";
  53787. }
  53788. [_xfa_object.$finalize]() {
  53789. const number = parseFloat(this[_xfa_object.$content].trim());
  53790. this[_xfa_object.$content] = isNaN(number) ? null : number;
  53791. }
  53792. [_xfa_object.$toHTML](availableSpace) {
  53793. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  53794. }
  53795. }
  53796. class DefaultUi extends _xfa_object.XFAObject {
  53797. constructor(attributes) {
  53798. super(TEMPLATE_NS_ID, "defaultUi", true);
  53799. this.id = attributes.id || "";
  53800. this.use = attributes.use || "";
  53801. this.usehref = attributes.usehref || "";
  53802. this.extras = null;
  53803. }
  53804. }
  53805. class Desc extends _xfa_object.XFAObject {
  53806. constructor(attributes) {
  53807. super(TEMPLATE_NS_ID, "desc", true);
  53808. this.id = attributes.id || "";
  53809. this.use = attributes.use || "";
  53810. this.usehref = attributes.usehref || "";
  53811. this.boolean = new _xfa_object.XFAObjectArray();
  53812. this.date = new _xfa_object.XFAObjectArray();
  53813. this.dateTime = new _xfa_object.XFAObjectArray();
  53814. this.decimal = new _xfa_object.XFAObjectArray();
  53815. this.exData = new _xfa_object.XFAObjectArray();
  53816. this.float = new _xfa_object.XFAObjectArray();
  53817. this.image = new _xfa_object.XFAObjectArray();
  53818. this.integer = new _xfa_object.XFAObjectArray();
  53819. this.text = new _xfa_object.XFAObjectArray();
  53820. this.time = new _xfa_object.XFAObjectArray();
  53821. }
  53822. }
  53823. class DigestMethod extends _xfa_object.OptionObject {
  53824. constructor(attributes) {
  53825. super(TEMPLATE_NS_ID, "digestMethod", ["", "SHA1", "SHA256", "SHA512", "RIPEMD160"]);
  53826. this.id = attributes.id || "";
  53827. this.use = attributes.use || "";
  53828. this.usehref = attributes.usehref || "";
  53829. }
  53830. }
  53831. class DigestMethods extends _xfa_object.XFAObject {
  53832. constructor(attributes) {
  53833. super(TEMPLATE_NS_ID, "digestMethods", true);
  53834. this.id = attributes.id || "";
  53835. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  53836. this.use = attributes.use || "";
  53837. this.usehref = attributes.usehref || "";
  53838. this.digestMethod = new _xfa_object.XFAObjectArray();
  53839. }
  53840. }
  53841. class Draw extends _xfa_object.XFAObject {
  53842. constructor(attributes) {
  53843. super(TEMPLATE_NS_ID, "draw", true);
  53844. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  53845. this.colSpan = (0, _utils.getInteger)({
  53846. data: attributes.colSpan,
  53847. defaultValue: 1,
  53848. validate: n => n >= 1 || n === -1
  53849. });
  53850. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  53851. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  53852. this.id = attributes.id || "";
  53853. this.locale = attributes.locale || "";
  53854. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  53855. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  53856. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  53857. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  53858. this.name = attributes.name || "";
  53859. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53860. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  53861. this.rotate = (0, _utils.getInteger)({
  53862. data: attributes.rotate,
  53863. defaultValue: 0,
  53864. validate: x => x % 90 === 0
  53865. });
  53866. this.use = attributes.use || "";
  53867. this.usehref = attributes.usehref || "";
  53868. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  53869. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  53870. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  53871. this.assist = null;
  53872. this.border = null;
  53873. this.caption = null;
  53874. this.desc = null;
  53875. this.extras = null;
  53876. this.font = null;
  53877. this.keep = null;
  53878. this.margin = null;
  53879. this.para = null;
  53880. this.traversal = null;
  53881. this.ui = null;
  53882. this.value = null;
  53883. this.setProperty = new _xfa_object.XFAObjectArray();
  53884. }
  53885. [_xfa_object.$setValue](value) {
  53886. _setValue(this, value);
  53887. }
  53888. [_xfa_object.$toHTML](availableSpace) {
  53889. setTabIndex(this);
  53890. if (this.presence === "hidden" || this.presence === "inactive") {
  53891. return _utils.HTMLResult.EMPTY;
  53892. }
  53893. (0, _html_utils.fixDimensions)(this);
  53894. this[_xfa_object.$pushPara]();
  53895. const savedW = this.w;
  53896. const savedH = this.h;
  53897. const {
  53898. w,
  53899. h,
  53900. isBroken
  53901. } = (0, _html_utils.layoutNode)(this, availableSpace);
  53902. if (w && this.w === "") {
  53903. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  53904. this[_xfa_object.$popPara]();
  53905. return _utils.HTMLResult.FAILURE;
  53906. }
  53907. this.w = w;
  53908. }
  53909. if (h && this.h === "") {
  53910. this.h = h;
  53911. }
  53912. setFirstUnsplittable(this);
  53913. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  53914. this.w = savedW;
  53915. this.h = savedH;
  53916. this[_xfa_object.$popPara]();
  53917. return _utils.HTMLResult.FAILURE;
  53918. }
  53919. unsetFirstUnsplittable(this);
  53920. const style = (0, _html_utils.toStyle)(this, "font", "hAlign", "dimensions", "position", "presence", "rotate", "anchorType", "border", "margin");
  53921. (0, _html_utils.setMinMaxDimensions)(this, style);
  53922. if (style.margin) {
  53923. style.padding = style.margin;
  53924. delete style.margin;
  53925. }
  53926. const classNames = ["xfaDraw"];
  53927. if (this.font) {
  53928. classNames.push("xfaFont");
  53929. }
  53930. if ((0, _html_utils.isPrintOnly)(this)) {
  53931. classNames.push("xfaPrintOnly");
  53932. }
  53933. const attributes = {
  53934. style,
  53935. id: this[_xfa_object.$uid],
  53936. class: classNames
  53937. };
  53938. if (this.name) {
  53939. attributes.xfaName = this.name;
  53940. }
  53941. const html = {
  53942. name: "div",
  53943. attributes,
  53944. children: []
  53945. };
  53946. applyAssist(this, attributes);
  53947. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  53948. const value = this.value ? this.value[_xfa_object.$toHTML](availableSpace).html : null;
  53949. if (value === null) {
  53950. this.w = savedW;
  53951. this.h = savedH;
  53952. this[_xfa_object.$popPara]();
  53953. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53954. }
  53955. html.children.push(value);
  53956. (0, _html_utils.setPara)(this, style, value);
  53957. this.w = savedW;
  53958. this.h = savedH;
  53959. this[_xfa_object.$popPara]();
  53960. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  53961. }
  53962. }
  53963. class Edge extends _xfa_object.XFAObject {
  53964. constructor(attributes) {
  53965. super(TEMPLATE_NS_ID, "edge", true);
  53966. this.cap = (0, _utils.getStringOption)(attributes.cap, ["square", "butt", "round"]);
  53967. this.id = attributes.id || "";
  53968. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  53969. this.stroke = (0, _utils.getStringOption)(attributes.stroke, ["solid", "dashDot", "dashDotDot", "dashed", "dotted", "embossed", "etched", "lowered", "raised"]);
  53970. this.thickness = (0, _utils.getMeasurement)(attributes.thickness, "0.5pt");
  53971. this.use = attributes.use || "";
  53972. this.usehref = attributes.usehref || "";
  53973. this.color = null;
  53974. this.extras = null;
  53975. }
  53976. [_xfa_object.$toStyle]() {
  53977. const style = (0, _html_utils.toStyle)(this, "visibility");
  53978. Object.assign(style, {
  53979. linecap: this.cap,
  53980. width: (0, _html_utils.measureToString)(this.thickness),
  53981. color: this.color ? this.color[_xfa_object.$toStyle]() : "#000000",
  53982. style: ""
  53983. });
  53984. if (this.presence !== "visible") {
  53985. style.style = "none";
  53986. } else {
  53987. switch (this.stroke) {
  53988. case "solid":
  53989. style.style = "solid";
  53990. break;
  53991. case "dashDot":
  53992. style.style = "dashed";
  53993. break;
  53994. case "dashDotDot":
  53995. style.style = "dashed";
  53996. break;
  53997. case "dashed":
  53998. style.style = "dashed";
  53999. break;
  54000. case "dotted":
  54001. style.style = "dotted";
  54002. break;
  54003. case "embossed":
  54004. style.style = "ridge";
  54005. break;
  54006. case "etched":
  54007. style.style = "groove";
  54008. break;
  54009. case "lowered":
  54010. style.style = "inset";
  54011. break;
  54012. case "raised":
  54013. style.style = "outset";
  54014. break;
  54015. }
  54016. }
  54017. return style;
  54018. }
  54019. }
  54020. class Encoding extends _xfa_object.OptionObject {
  54021. constructor(attributes) {
  54022. super(TEMPLATE_NS_ID, "encoding", ["adbe.x509.rsa_sha1", "adbe.pkcs7.detached", "adbe.pkcs7.sha1"]);
  54023. this.id = attributes.id || "";
  54024. this.use = attributes.use || "";
  54025. this.usehref = attributes.usehref || "";
  54026. }
  54027. }
  54028. class Encodings extends _xfa_object.XFAObject {
  54029. constructor(attributes) {
  54030. super(TEMPLATE_NS_ID, "encodings", true);
  54031. this.id = attributes.id || "";
  54032. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54033. this.use = attributes.use || "";
  54034. this.usehref = attributes.usehref || "";
  54035. this.encoding = new _xfa_object.XFAObjectArray();
  54036. }
  54037. }
  54038. class Encrypt extends _xfa_object.XFAObject {
  54039. constructor(attributes) {
  54040. super(TEMPLATE_NS_ID, "encrypt", true);
  54041. this.id = attributes.id || "";
  54042. this.use = attributes.use || "";
  54043. this.usehref = attributes.usehref || "";
  54044. this.certificate = null;
  54045. }
  54046. }
  54047. class EncryptData extends _xfa_object.XFAObject {
  54048. constructor(attributes) {
  54049. super(TEMPLATE_NS_ID, "encryptData", true);
  54050. this.id = attributes.id || "";
  54051. this.operation = (0, _utils.getStringOption)(attributes.operation, ["encrypt", "decrypt"]);
  54052. this.target = attributes.target || "";
  54053. this.use = attributes.use || "";
  54054. this.usehref = attributes.usehref || "";
  54055. this.filter = null;
  54056. this.manifest = null;
  54057. }
  54058. }
  54059. class Encryption extends _xfa_object.XFAObject {
  54060. constructor(attributes) {
  54061. super(TEMPLATE_NS_ID, "encryption", true);
  54062. this.id = attributes.id || "";
  54063. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54064. this.use = attributes.use || "";
  54065. this.usehref = attributes.usehref || "";
  54066. this.certificate = new _xfa_object.XFAObjectArray();
  54067. }
  54068. }
  54069. class EncryptionMethod extends _xfa_object.OptionObject {
  54070. constructor(attributes) {
  54071. super(TEMPLATE_NS_ID, "encryptionMethod", ["", "AES256-CBC", "TRIPLEDES-CBC", "AES128-CBC", "AES192-CBC"]);
  54072. this.id = attributes.id || "";
  54073. this.use = attributes.use || "";
  54074. this.usehref = attributes.usehref || "";
  54075. }
  54076. }
  54077. class EncryptionMethods extends _xfa_object.XFAObject {
  54078. constructor(attributes) {
  54079. super(TEMPLATE_NS_ID, "encryptionMethods", true);
  54080. this.id = attributes.id || "";
  54081. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54082. this.use = attributes.use || "";
  54083. this.usehref = attributes.usehref || "";
  54084. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  54085. }
  54086. }
  54087. class Event extends _xfa_object.XFAObject {
  54088. constructor(attributes) {
  54089. super(TEMPLATE_NS_ID, "event", true);
  54090. this.activity = (0, _utils.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"]);
  54091. this.id = attributes.id || "";
  54092. this.listen = (0, _utils.getStringOption)(attributes.listen, ["refOnly", "refAndDescendents"]);
  54093. this.name = attributes.name || "";
  54094. this.ref = attributes.ref || "";
  54095. this.use = attributes.use || "";
  54096. this.usehref = attributes.usehref || "";
  54097. this.extras = null;
  54098. this.encryptData = null;
  54099. this.execute = null;
  54100. this.script = null;
  54101. this.signData = null;
  54102. this.submit = null;
  54103. }
  54104. }
  54105. class ExData extends _xfa_object.ContentObject {
  54106. constructor(attributes) {
  54107. super(TEMPLATE_NS_ID, "exData");
  54108. this.contentType = attributes.contentType || "";
  54109. this.href = attributes.href || "";
  54110. this.id = attributes.id || "";
  54111. this.maxLength = (0, _utils.getInteger)({
  54112. data: attributes.maxLength,
  54113. defaultValue: -1,
  54114. validate: x => x >= -1
  54115. });
  54116. this.name = attributes.name || "";
  54117. this.rid = attributes.rid || "";
  54118. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["none", "base64", "package"]);
  54119. this.use = attributes.use || "";
  54120. this.usehref = attributes.usehref || "";
  54121. }
  54122. [_xfa_object.$isCDATAXml]() {
  54123. return this.contentType === "text/html";
  54124. }
  54125. [_xfa_object.$onChild](child) {
  54126. if (this.contentType === "text/html" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  54127. this[_xfa_object.$content] = child;
  54128. return true;
  54129. }
  54130. if (this.contentType === "text/xml") {
  54131. this[_xfa_object.$content] = child;
  54132. return true;
  54133. }
  54134. return false;
  54135. }
  54136. [_xfa_object.$toHTML](availableSpace) {
  54137. if (this.contentType !== "text/html" || !this[_xfa_object.$content]) {
  54138. return _utils.HTMLResult.EMPTY;
  54139. }
  54140. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  54141. }
  54142. }
  54143. class ExObject extends _xfa_object.XFAObject {
  54144. constructor(attributes) {
  54145. super(TEMPLATE_NS_ID, "exObject", true);
  54146. this.archive = attributes.archive || "";
  54147. this.classId = attributes.classId || "";
  54148. this.codeBase = attributes.codeBase || "";
  54149. this.codeType = attributes.codeType || "";
  54150. this.id = attributes.id || "";
  54151. this.name = attributes.name || "";
  54152. this.use = attributes.use || "";
  54153. this.usehref = attributes.usehref || "";
  54154. this.extras = null;
  54155. this.boolean = new _xfa_object.XFAObjectArray();
  54156. this.date = new _xfa_object.XFAObjectArray();
  54157. this.dateTime = new _xfa_object.XFAObjectArray();
  54158. this.decimal = new _xfa_object.XFAObjectArray();
  54159. this.exData = new _xfa_object.XFAObjectArray();
  54160. this.exObject = new _xfa_object.XFAObjectArray();
  54161. this.float = new _xfa_object.XFAObjectArray();
  54162. this.image = new _xfa_object.XFAObjectArray();
  54163. this.integer = new _xfa_object.XFAObjectArray();
  54164. this.text = new _xfa_object.XFAObjectArray();
  54165. this.time = new _xfa_object.XFAObjectArray();
  54166. }
  54167. }
  54168. class ExclGroup extends _xfa_object.XFAObject {
  54169. constructor(attributes) {
  54170. super(TEMPLATE_NS_ID, "exclGroup", true);
  54171. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54172. this.accessKey = attributes.accessKey || "";
  54173. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54174. this.colSpan = (0, _utils.getInteger)({
  54175. data: attributes.colSpan,
  54176. defaultValue: 1,
  54177. validate: n => n >= 1 || n === -1
  54178. });
  54179. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54180. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54181. this.id = attributes.id || "";
  54182. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  54183. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54184. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54185. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54186. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54187. this.name = attributes.name || "";
  54188. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54189. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54190. this.use = attributes.use || "";
  54191. this.usehref = attributes.usehref || "";
  54192. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54193. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54194. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54195. this.assist = null;
  54196. this.bind = null;
  54197. this.border = null;
  54198. this.calculate = null;
  54199. this.caption = null;
  54200. this.desc = null;
  54201. this.extras = null;
  54202. this.margin = null;
  54203. this.para = null;
  54204. this.traversal = null;
  54205. this.validate = null;
  54206. this.connect = new _xfa_object.XFAObjectArray();
  54207. this.event = new _xfa_object.XFAObjectArray();
  54208. this.field = new _xfa_object.XFAObjectArray();
  54209. this.setProperty = new _xfa_object.XFAObjectArray();
  54210. }
  54211. [_xfa_object.$isBindable]() {
  54212. return true;
  54213. }
  54214. [_xfa_object.$hasSettableValue]() {
  54215. return true;
  54216. }
  54217. [_xfa_object.$setValue](value) {
  54218. for (const field of this.field.children) {
  54219. if (!field.value) {
  54220. const nodeValue = new Value({});
  54221. field[_xfa_object.$appendChild](nodeValue);
  54222. field.value = nodeValue;
  54223. }
  54224. field.value[_xfa_object.$setValue](value);
  54225. }
  54226. }
  54227. [_xfa_object.$isThereMoreWidth]() {
  54228. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  54229. }
  54230. [_xfa_object.$isSplittable]() {
  54231. const parent = this[_xfa_object.$getSubformParent]();
  54232. if (!parent[_xfa_object.$isSplittable]()) {
  54233. return false;
  54234. }
  54235. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  54236. return this[_xfa_object.$extra]._isSplittable;
  54237. }
  54238. if (this.layout === "position" || this.layout.includes("row")) {
  54239. this[_xfa_object.$extra]._isSplittable = false;
  54240. return false;
  54241. }
  54242. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  54243. return false;
  54244. }
  54245. this[_xfa_object.$extra]._isSplittable = true;
  54246. return true;
  54247. }
  54248. [_xfa_object.$flushHTML]() {
  54249. return (0, _layout.flushHTML)(this);
  54250. }
  54251. [_xfa_object.$addHTML](html, bbox) {
  54252. (0, _layout.addHTML)(this, html, bbox);
  54253. }
  54254. [_xfa_object.$getAvailableSpace]() {
  54255. return (0, _layout.getAvailableSpace)(this);
  54256. }
  54257. [_xfa_object.$toHTML](availableSpace) {
  54258. setTabIndex(this);
  54259. if (this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  54260. return _utils.HTMLResult.EMPTY;
  54261. }
  54262. (0, _html_utils.fixDimensions)(this);
  54263. const children = [];
  54264. const attributes = {
  54265. id: this[_xfa_object.$uid],
  54266. class: []
  54267. };
  54268. (0, _html_utils.setAccess)(this, attributes.class);
  54269. if (!this[_xfa_object.$extra]) {
  54270. this[_xfa_object.$extra] = Object.create(null);
  54271. }
  54272. Object.assign(this[_xfa_object.$extra], {
  54273. children,
  54274. attributes,
  54275. attempt: 0,
  54276. line: null,
  54277. numberInLine: 0,
  54278. availableSpace: {
  54279. width: Math.min(this.w || Infinity, availableSpace.width),
  54280. height: Math.min(this.h || Infinity, availableSpace.height)
  54281. },
  54282. width: 0,
  54283. height: 0,
  54284. prevHeight: 0,
  54285. currentWidth: 0
  54286. });
  54287. const isSplittable = this[_xfa_object.$isSplittable]();
  54288. if (!isSplittable) {
  54289. setFirstUnsplittable(this);
  54290. }
  54291. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54292. return _utils.HTMLResult.FAILURE;
  54293. }
  54294. const filter = new Set(["field"]);
  54295. if (this.layout.includes("row")) {
  54296. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  54297. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  54298. this[_xfa_object.$extra].columnWidths = columnWidths;
  54299. this[_xfa_object.$extra].currentColumn = 0;
  54300. }
  54301. }
  54302. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  54303. const classNames = ["xfaExclgroup"];
  54304. const cl = (0, _html_utils.layoutClass)(this);
  54305. if (cl) {
  54306. classNames.push(cl);
  54307. }
  54308. if ((0, _html_utils.isPrintOnly)(this)) {
  54309. classNames.push("xfaPrintOnly");
  54310. }
  54311. attributes.style = style;
  54312. attributes.class = classNames;
  54313. if (this.name) {
  54314. attributes.xfaName = this.name;
  54315. }
  54316. this[_xfa_object.$pushPara]();
  54317. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  54318. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  54319. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  54320. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  54321. this[_xfa_object.$extra].numberInLine = 0;
  54322. }
  54323. const result = this[_xfa_object.$childrenToHTML]({
  54324. filter,
  54325. include: true
  54326. });
  54327. if (result.success) {
  54328. break;
  54329. }
  54330. if (result.isBreak()) {
  54331. this[_xfa_object.$popPara]();
  54332. return result;
  54333. }
  54334. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  54335. this[_xfa_object.$extra].attempt = maxRun;
  54336. break;
  54337. }
  54338. }
  54339. this[_xfa_object.$popPara]();
  54340. if (!isSplittable) {
  54341. unsetFirstUnsplittable(this);
  54342. }
  54343. if (this[_xfa_object.$extra].attempt === maxRun) {
  54344. if (!isSplittable) {
  54345. delete this[_xfa_object.$extra];
  54346. }
  54347. return _utils.HTMLResult.FAILURE;
  54348. }
  54349. let marginH = 0;
  54350. let marginV = 0;
  54351. if (this.margin) {
  54352. marginH = this.margin.leftInset + this.margin.rightInset;
  54353. marginV = this.margin.topInset + this.margin.bottomInset;
  54354. }
  54355. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  54356. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  54357. const bbox = [this.x, this.y, width, height];
  54358. if (this.w === "") {
  54359. style.width = (0, _html_utils.measureToString)(width);
  54360. }
  54361. if (this.h === "") {
  54362. style.height = (0, _html_utils.measureToString)(height);
  54363. }
  54364. const html = {
  54365. name: "div",
  54366. attributes,
  54367. children
  54368. };
  54369. applyAssist(this, attributes);
  54370. delete this[_xfa_object.$extra];
  54371. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54372. }
  54373. }
  54374. class Execute extends _xfa_object.XFAObject {
  54375. constructor(attributes) {
  54376. super(TEMPLATE_NS_ID, "execute");
  54377. this.connection = attributes.connection || "";
  54378. this.executeType = (0, _utils.getStringOption)(attributes.executeType, ["import", "remerge"]);
  54379. this.id = attributes.id || "";
  54380. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  54381. this.use = attributes.use || "";
  54382. this.usehref = attributes.usehref || "";
  54383. }
  54384. }
  54385. class Extras extends _xfa_object.XFAObject {
  54386. constructor(attributes) {
  54387. super(TEMPLATE_NS_ID, "extras", true);
  54388. this.id = attributes.id || "";
  54389. this.name = attributes.name || "";
  54390. this.use = attributes.use || "";
  54391. this.usehref = attributes.usehref || "";
  54392. this.boolean = new _xfa_object.XFAObjectArray();
  54393. this.date = new _xfa_object.XFAObjectArray();
  54394. this.dateTime = new _xfa_object.XFAObjectArray();
  54395. this.decimal = new _xfa_object.XFAObjectArray();
  54396. this.exData = new _xfa_object.XFAObjectArray();
  54397. this.extras = new _xfa_object.XFAObjectArray();
  54398. this.float = new _xfa_object.XFAObjectArray();
  54399. this.image = new _xfa_object.XFAObjectArray();
  54400. this.integer = new _xfa_object.XFAObjectArray();
  54401. this.text = new _xfa_object.XFAObjectArray();
  54402. this.time = new _xfa_object.XFAObjectArray();
  54403. }
  54404. }
  54405. class Field extends _xfa_object.XFAObject {
  54406. constructor(attributes) {
  54407. super(TEMPLATE_NS_ID, "field", true);
  54408. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  54409. this.accessKey = attributes.accessKey || "";
  54410. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  54411. this.colSpan = (0, _utils.getInteger)({
  54412. data: attributes.colSpan,
  54413. defaultValue: 1,
  54414. validate: n => n >= 1 || n === -1
  54415. });
  54416. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  54417. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  54418. this.id = attributes.id || "";
  54419. this.locale = attributes.locale || "";
  54420. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  54421. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  54422. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  54423. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  54424. this.name = attributes.name || "";
  54425. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54426. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  54427. this.rotate = (0, _utils.getInteger)({
  54428. data: attributes.rotate,
  54429. defaultValue: 0,
  54430. validate: x => x % 90 === 0
  54431. });
  54432. this.use = attributes.use || "";
  54433. this.usehref = attributes.usehref || "";
  54434. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  54435. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  54436. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  54437. this.assist = null;
  54438. this.bind = null;
  54439. this.border = null;
  54440. this.calculate = null;
  54441. this.caption = null;
  54442. this.desc = null;
  54443. this.extras = null;
  54444. this.font = null;
  54445. this.format = null;
  54446. this.items = new _xfa_object.XFAObjectArray(2);
  54447. this.keep = null;
  54448. this.margin = null;
  54449. this.para = null;
  54450. this.traversal = null;
  54451. this.ui = null;
  54452. this.validate = null;
  54453. this.value = null;
  54454. this.bindItems = new _xfa_object.XFAObjectArray();
  54455. this.connect = new _xfa_object.XFAObjectArray();
  54456. this.event = new _xfa_object.XFAObjectArray();
  54457. this.setProperty = new _xfa_object.XFAObjectArray();
  54458. }
  54459. [_xfa_object.$isBindable]() {
  54460. return true;
  54461. }
  54462. [_xfa_object.$setValue](value) {
  54463. _setValue(this, value);
  54464. }
  54465. [_xfa_object.$toHTML](availableSpace) {
  54466. setTabIndex(this);
  54467. if (!this.ui) {
  54468. this.ui = new Ui({});
  54469. this.ui[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  54470. this[_xfa_object.$appendChild](this.ui);
  54471. let node;
  54472. switch (this.items.children.length) {
  54473. case 0:
  54474. node = new TextEdit({});
  54475. this.ui.textEdit = node;
  54476. break;
  54477. case 1:
  54478. node = new CheckButton({});
  54479. this.ui.checkButton = node;
  54480. break;
  54481. case 2:
  54482. node = new ChoiceList({});
  54483. this.ui.choiceList = node;
  54484. break;
  54485. }
  54486. this.ui[_xfa_object.$appendChild](node);
  54487. }
  54488. if (!this.ui || this.presence === "hidden" || this.presence === "inactive" || this.h === 0 || this.w === 0) {
  54489. return _utils.HTMLResult.EMPTY;
  54490. }
  54491. if (this.caption) {
  54492. delete this.caption[_xfa_object.$extra];
  54493. }
  54494. this[_xfa_object.$pushPara]();
  54495. const caption = this.caption ? this.caption[_xfa_object.$toHTML](availableSpace).html : null;
  54496. const savedW = this.w;
  54497. const savedH = this.h;
  54498. let marginH = 0;
  54499. let marginV = 0;
  54500. if (this.margin) {
  54501. marginH = this.margin.leftInset + this.margin.rightInset;
  54502. marginV = this.margin.topInset + this.margin.bottomInset;
  54503. }
  54504. let borderDims = null;
  54505. if (this.w === "" || this.h === "") {
  54506. let width = null;
  54507. let height = null;
  54508. let uiW = 0;
  54509. let uiH = 0;
  54510. if (this.ui.checkButton) {
  54511. uiW = uiH = this.ui.checkButton.size;
  54512. } else {
  54513. const {
  54514. w,
  54515. h
  54516. } = (0, _html_utils.layoutNode)(this, availableSpace);
  54517. if (w !== null) {
  54518. uiW = w;
  54519. uiH = h;
  54520. } else {
  54521. uiH = (0, _fonts.getMetrics)(this.font, true).lineNoGap;
  54522. }
  54523. }
  54524. borderDims = getBorderDims(this.ui[_xfa_object.$getExtra]());
  54525. uiW += borderDims.w;
  54526. uiH += borderDims.h;
  54527. if (this.caption) {
  54528. const {
  54529. w,
  54530. h,
  54531. isBroken
  54532. } = this.caption[_xfa_object.$getExtra](availableSpace);
  54533. if (isBroken && this[_xfa_object.$getSubformParent]()[_xfa_object.$isThereMoreWidth]()) {
  54534. this[_xfa_object.$popPara]();
  54535. return _utils.HTMLResult.FAILURE;
  54536. }
  54537. width = w;
  54538. height = h;
  54539. switch (this.caption.placement) {
  54540. case "left":
  54541. case "right":
  54542. case "inline":
  54543. width += uiW;
  54544. break;
  54545. case "top":
  54546. case "bottom":
  54547. height += uiH;
  54548. break;
  54549. }
  54550. } else {
  54551. width = uiW;
  54552. height = uiH;
  54553. }
  54554. if (width && this.w === "") {
  54555. width += marginH;
  54556. this.w = Math.min(this.maxW <= 0 ? Infinity : this.maxW, this.minW + 1 < width ? width : this.minW);
  54557. }
  54558. if (height && this.h === "") {
  54559. height += marginV;
  54560. this.h = Math.min(this.maxH <= 0 ? Infinity : this.maxH, this.minH + 1 < height ? height : this.minH);
  54561. }
  54562. }
  54563. this[_xfa_object.$popPara]();
  54564. (0, _html_utils.fixDimensions)(this);
  54565. setFirstUnsplittable(this);
  54566. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  54567. this.w = savedW;
  54568. this.h = savedH;
  54569. this[_xfa_object.$popPara]();
  54570. return _utils.HTMLResult.FAILURE;
  54571. }
  54572. unsetFirstUnsplittable(this);
  54573. const style = (0, _html_utils.toStyle)(this, "font", "dimensions", "position", "rotate", "anchorType", "presence", "margin", "hAlign");
  54574. (0, _html_utils.setMinMaxDimensions)(this, style);
  54575. const classNames = ["xfaField"];
  54576. if (this.font) {
  54577. classNames.push("xfaFont");
  54578. }
  54579. if ((0, _html_utils.isPrintOnly)(this)) {
  54580. classNames.push("xfaPrintOnly");
  54581. }
  54582. const attributes = {
  54583. style,
  54584. id: this[_xfa_object.$uid],
  54585. class: classNames
  54586. };
  54587. if (style.margin) {
  54588. style.padding = style.margin;
  54589. delete style.margin;
  54590. }
  54591. (0, _html_utils.setAccess)(this, classNames);
  54592. if (this.name) {
  54593. attributes.xfaName = this.name;
  54594. }
  54595. const children = [];
  54596. const html = {
  54597. name: "div",
  54598. attributes,
  54599. children
  54600. };
  54601. applyAssist(this, attributes);
  54602. const borderStyle = this.border ? this.border[_xfa_object.$toStyle]() : null;
  54603. const bbox = (0, _html_utils.computeBbox)(this, html, availableSpace);
  54604. const ui = this.ui[_xfa_object.$toHTML]().html;
  54605. if (!ui) {
  54606. Object.assign(style, borderStyle);
  54607. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54608. }
  54609. if (this[_xfa_object.$tabIndex]) {
  54610. if (ui.children && ui.children[0]) {
  54611. ui.children[0].attributes.tabindex = this[_xfa_object.$tabIndex];
  54612. } else {
  54613. ui.attributes.tabindex = this[_xfa_object.$tabIndex];
  54614. }
  54615. }
  54616. if (!ui.attributes.style) {
  54617. ui.attributes.style = Object.create(null);
  54618. }
  54619. let aElement = null;
  54620. if (this.ui.button) {
  54621. if (ui.children.length === 1) {
  54622. [aElement] = ui.children.splice(0, 1);
  54623. }
  54624. Object.assign(ui.attributes.style, borderStyle);
  54625. } else {
  54626. Object.assign(style, borderStyle);
  54627. }
  54628. children.push(ui);
  54629. if (this.value) {
  54630. if (this.ui.imageEdit) {
  54631. ui.children.push(this.value[_xfa_object.$toHTML]().html);
  54632. } else if (!this.ui.button) {
  54633. let value = "";
  54634. if (this.value.exData) {
  54635. value = this.value.exData[_xfa_object.$text]();
  54636. } else if (this.value.text) {
  54637. value = this.value.text[_xfa_object.$getExtra]();
  54638. } else {
  54639. const htmlValue = this.value[_xfa_object.$toHTML]().html;
  54640. if (htmlValue !== null) {
  54641. value = htmlValue.children[0].value;
  54642. }
  54643. }
  54644. if (this.ui.textEdit && this.value.text && this.value.text.maxChars) {
  54645. ui.children[0].attributes.maxLength = this.value.text.maxChars;
  54646. }
  54647. if (value) {
  54648. if (this.ui.numericEdit) {
  54649. value = parseFloat(value);
  54650. value = isNaN(value) ? "" : value.toString();
  54651. }
  54652. if (ui.children[0].name === "textarea") {
  54653. ui.children[0].attributes.textContent = value;
  54654. } else {
  54655. ui.children[0].attributes.value = value;
  54656. }
  54657. }
  54658. }
  54659. }
  54660. if (!this.ui.imageEdit && ui.children && ui.children[0] && this.h) {
  54661. borderDims = borderDims || getBorderDims(this.ui[_xfa_object.$getExtra]());
  54662. let captionHeight = 0;
  54663. if (this.caption && ["top", "bottom"].includes(this.caption.placement)) {
  54664. captionHeight = this.caption.reserve;
  54665. if (captionHeight <= 0) {
  54666. captionHeight = this.caption[_xfa_object.$getExtra](availableSpace).h;
  54667. }
  54668. const inputHeight = this.h - captionHeight - marginV - borderDims.h;
  54669. ui.children[0].attributes.style.height = (0, _html_utils.measureToString)(inputHeight);
  54670. } else {
  54671. ui.children[0].attributes.style.height = "100%";
  54672. }
  54673. }
  54674. if (aElement) {
  54675. ui.children.push(aElement);
  54676. }
  54677. if (!caption) {
  54678. if (ui.attributes.class) {
  54679. ui.attributes.class.push("xfaLeft");
  54680. }
  54681. this.w = savedW;
  54682. this.h = savedH;
  54683. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54684. }
  54685. if (this.ui.button) {
  54686. if (style.padding) {
  54687. delete style.padding;
  54688. }
  54689. if (caption.name === "div") {
  54690. caption.name = "span";
  54691. }
  54692. ui.children.push(caption);
  54693. return _utils.HTMLResult.success(html, bbox);
  54694. } else if (this.ui.checkButton) {
  54695. caption.attributes.class[0] = "xfaCaptionForCheckButton";
  54696. }
  54697. if (!ui.attributes.class) {
  54698. ui.attributes.class = [];
  54699. }
  54700. ui.children.splice(0, 0, caption);
  54701. switch (this.caption.placement) {
  54702. case "left":
  54703. ui.attributes.class.push("xfaLeft");
  54704. break;
  54705. case "right":
  54706. ui.attributes.class.push("xfaRight");
  54707. break;
  54708. case "top":
  54709. ui.attributes.class.push("xfaTop");
  54710. break;
  54711. case "bottom":
  54712. ui.attributes.class.push("xfaBottom");
  54713. break;
  54714. case "inline":
  54715. ui.attributes.class.push("xfaLeft");
  54716. break;
  54717. }
  54718. this.w = savedW;
  54719. this.h = savedH;
  54720. return _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  54721. }
  54722. }
  54723. exports.Field = Field;
  54724. class Fill extends _xfa_object.XFAObject {
  54725. constructor(attributes) {
  54726. super(TEMPLATE_NS_ID, "fill", true);
  54727. this.id = attributes.id || "";
  54728. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  54729. this.use = attributes.use || "";
  54730. this.usehref = attributes.usehref || "";
  54731. this.color = null;
  54732. this.extras = null;
  54733. this.linear = null;
  54734. this.pattern = null;
  54735. this.radial = null;
  54736. this.solid = null;
  54737. this.stipple = null;
  54738. }
  54739. [_xfa_object.$toStyle]() {
  54740. const parent = this[_xfa_object.$getParent]();
  54741. const grandpa = parent[_xfa_object.$getParent]();
  54742. const ggrandpa = grandpa[_xfa_object.$getParent]();
  54743. const style = Object.create(null);
  54744. let propName = "color";
  54745. let altPropName = propName;
  54746. if (parent instanceof Border) {
  54747. propName = "background-color";
  54748. altPropName = "background";
  54749. if (ggrandpa instanceof Ui) {
  54750. style.backgroundColor = "white";
  54751. }
  54752. }
  54753. if (parent instanceof Rectangle || parent instanceof Arc) {
  54754. propName = altPropName = "fill";
  54755. style.fill = "white";
  54756. }
  54757. for (const name of Object.getOwnPropertyNames(this)) {
  54758. if (name === "extras" || name === "color") {
  54759. continue;
  54760. }
  54761. const obj = this[name];
  54762. if (!(obj instanceof _xfa_object.XFAObject)) {
  54763. continue;
  54764. }
  54765. const color = obj[_xfa_object.$toStyle](this.color);
  54766. if (color) {
  54767. style[color.startsWith("#") ? propName : altPropName] = color;
  54768. }
  54769. return style;
  54770. }
  54771. if (this.color && this.color.value) {
  54772. const color = this.color[_xfa_object.$toStyle]();
  54773. style[color.startsWith("#") ? propName : altPropName] = color;
  54774. }
  54775. return style;
  54776. }
  54777. }
  54778. class Filter extends _xfa_object.XFAObject {
  54779. constructor(attributes) {
  54780. super(TEMPLATE_NS_ID, "filter", true);
  54781. this.addRevocationInfo = (0, _utils.getStringOption)(attributes.addRevocationInfo, ["", "required", "optional", "none"]);
  54782. this.id = attributes.id || "";
  54783. this.name = attributes.name || "";
  54784. this.use = attributes.use || "";
  54785. this.usehref = attributes.usehref || "";
  54786. this.version = (0, _utils.getInteger)({
  54787. data: this.version,
  54788. defaultValue: 5,
  54789. validate: x => x >= 1 && x <= 5
  54790. });
  54791. this.appearanceFilter = null;
  54792. this.certificates = null;
  54793. this.digestMethods = null;
  54794. this.encodings = null;
  54795. this.encryptionMethods = null;
  54796. this.handler = null;
  54797. this.lockDocument = null;
  54798. this.mdp = null;
  54799. this.reasons = null;
  54800. this.timeStamp = null;
  54801. }
  54802. }
  54803. class Float extends _xfa_object.ContentObject {
  54804. constructor(attributes) {
  54805. super(TEMPLATE_NS_ID, "float");
  54806. this.id = attributes.id || "";
  54807. this.name = attributes.name || "";
  54808. this.use = attributes.use || "";
  54809. this.usehref = attributes.usehref || "";
  54810. }
  54811. [_xfa_object.$finalize]() {
  54812. const number = parseFloat(this[_xfa_object.$content].trim());
  54813. this[_xfa_object.$content] = isNaN(number) ? null : number;
  54814. }
  54815. [_xfa_object.$toHTML](availableSpace) {
  54816. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  54817. }
  54818. }
  54819. class Font extends _xfa_object.XFAObject {
  54820. constructor(attributes) {
  54821. super(TEMPLATE_NS_ID, "font", true);
  54822. this.baselineShift = (0, _utils.getMeasurement)(attributes.baselineShift);
  54823. this.fontHorizontalScale = (0, _utils.getFloat)({
  54824. data: attributes.fontHorizontalScale,
  54825. defaultValue: 100,
  54826. validate: x => x >= 0
  54827. });
  54828. this.fontVerticalScale = (0, _utils.getFloat)({
  54829. data: attributes.fontVerticalScale,
  54830. defaultValue: 100,
  54831. validate: x => x >= 0
  54832. });
  54833. this.id = attributes.id || "";
  54834. this.kerningMode = (0, _utils.getStringOption)(attributes.kerningMode, ["none", "pair"]);
  54835. this.letterSpacing = (0, _utils.getMeasurement)(attributes.letterSpacing, "0");
  54836. this.lineThrough = (0, _utils.getInteger)({
  54837. data: attributes.lineThrough,
  54838. defaultValue: 0,
  54839. validate: x => x === 1 || x === 2
  54840. });
  54841. this.lineThroughPeriod = (0, _utils.getStringOption)(attributes.lineThroughPeriod, ["all", "word"]);
  54842. this.overline = (0, _utils.getInteger)({
  54843. data: attributes.overline,
  54844. defaultValue: 0,
  54845. validate: x => x === 1 || x === 2
  54846. });
  54847. this.overlinePeriod = (0, _utils.getStringOption)(attributes.overlinePeriod, ["all", "word"]);
  54848. this.posture = (0, _utils.getStringOption)(attributes.posture, ["normal", "italic"]);
  54849. this.size = (0, _utils.getMeasurement)(attributes.size, "10pt");
  54850. this.typeface = attributes.typeface || "Courier";
  54851. this.underline = (0, _utils.getInteger)({
  54852. data: attributes.underline,
  54853. defaultValue: 0,
  54854. validate: x => x === 1 || x === 2
  54855. });
  54856. this.underlinePeriod = (0, _utils.getStringOption)(attributes.underlinePeriod, ["all", "word"]);
  54857. this.use = attributes.use || "";
  54858. this.usehref = attributes.usehref || "";
  54859. this.weight = (0, _utils.getStringOption)(attributes.weight, ["normal", "bold"]);
  54860. this.extras = null;
  54861. this.fill = null;
  54862. }
  54863. [_xfa_object.$clean](builder) {
  54864. super[_xfa_object.$clean](builder);
  54865. this[_xfa_object.$globalData].usedTypefaces.add(this.typeface);
  54866. }
  54867. [_xfa_object.$toStyle]() {
  54868. const style = (0, _html_utils.toStyle)(this, "fill");
  54869. const color = style.color;
  54870. if (color) {
  54871. if (color === "#000000") {
  54872. delete style.color;
  54873. } else if (!color.startsWith("#")) {
  54874. style.background = color;
  54875. style.backgroundClip = "text";
  54876. style.color = "transparent";
  54877. }
  54878. }
  54879. if (this.baselineShift) {
  54880. style.verticalAlign = (0, _html_utils.measureToString)(this.baselineShift);
  54881. }
  54882. style.fontKerning = this.kerningMode === "none" ? "none" : "normal";
  54883. style.letterSpacing = (0, _html_utils.measureToString)(this.letterSpacing);
  54884. if (this.lineThrough !== 0) {
  54885. style.textDecoration = "line-through";
  54886. if (this.lineThrough === 2) {
  54887. style.textDecorationStyle = "double";
  54888. }
  54889. }
  54890. if (this.overline !== 0) {
  54891. style.textDecoration = "overline";
  54892. if (this.overline === 2) {
  54893. style.textDecorationStyle = "double";
  54894. }
  54895. }
  54896. style.fontStyle = this.posture;
  54897. style.fontSize = (0, _html_utils.measureToString)(0.99 * this.size);
  54898. (0, _html_utils.setFontFamily)(this, this, this[_xfa_object.$globalData].fontFinder, style);
  54899. if (this.underline !== 0) {
  54900. style.textDecoration = "underline";
  54901. if (this.underline === 2) {
  54902. style.textDecorationStyle = "double";
  54903. }
  54904. }
  54905. style.fontWeight = this.weight;
  54906. return style;
  54907. }
  54908. }
  54909. class Format extends _xfa_object.XFAObject {
  54910. constructor(attributes) {
  54911. super(TEMPLATE_NS_ID, "format", true);
  54912. this.id = attributes.id || "";
  54913. this.use = attributes.use || "";
  54914. this.usehref = attributes.usehref || "";
  54915. this.extras = null;
  54916. this.picture = null;
  54917. }
  54918. }
  54919. class Handler extends _xfa_object.StringObject {
  54920. constructor(attributes) {
  54921. super(TEMPLATE_NS_ID, "handler");
  54922. this.id = attributes.id || "";
  54923. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  54924. this.use = attributes.use || "";
  54925. this.usehref = attributes.usehref || "";
  54926. }
  54927. }
  54928. class Hyphenation extends _xfa_object.XFAObject {
  54929. constructor(attributes) {
  54930. super(TEMPLATE_NS_ID, "hyphenation");
  54931. this.excludeAllCaps = (0, _utils.getInteger)({
  54932. data: attributes.excludeAllCaps,
  54933. defaultValue: 0,
  54934. validate: x => x === 1
  54935. });
  54936. this.excludeInitialCap = (0, _utils.getInteger)({
  54937. data: attributes.excludeInitialCap,
  54938. defaultValue: 0,
  54939. validate: x => x === 1
  54940. });
  54941. this.hyphenate = (0, _utils.getInteger)({
  54942. data: attributes.hyphenate,
  54943. defaultValue: 0,
  54944. validate: x => x === 1
  54945. });
  54946. this.id = attributes.id || "";
  54947. this.pushCharacterCount = (0, _utils.getInteger)({
  54948. data: attributes.pushCharacterCount,
  54949. defaultValue: 3,
  54950. validate: x => x >= 0
  54951. });
  54952. this.remainCharacterCount = (0, _utils.getInteger)({
  54953. data: attributes.remainCharacterCount,
  54954. defaultValue: 3,
  54955. validate: x => x >= 0
  54956. });
  54957. this.use = attributes.use || "";
  54958. this.usehref = attributes.usehref || "";
  54959. this.wordCharacterCount = (0, _utils.getInteger)({
  54960. data: attributes.wordCharacterCount,
  54961. defaultValue: 7,
  54962. validate: x => x >= 0
  54963. });
  54964. }
  54965. }
  54966. class Image extends _xfa_object.StringObject {
  54967. constructor(attributes) {
  54968. super(TEMPLATE_NS_ID, "image");
  54969. this.aspect = (0, _utils.getStringOption)(attributes.aspect, ["fit", "actual", "height", "none", "width"]);
  54970. this.contentType = attributes.contentType || "";
  54971. this.href = attributes.href || "";
  54972. this.id = attributes.id || "";
  54973. this.name = attributes.name || "";
  54974. this.transferEncoding = (0, _utils.getStringOption)(attributes.transferEncoding, ["base64", "none", "package"]);
  54975. this.use = attributes.use || "";
  54976. this.usehref = attributes.usehref || "";
  54977. }
  54978. [_xfa_object.$toHTML]() {
  54979. if (this.contentType && !MIMES.has(this.contentType.toLowerCase())) {
  54980. return _utils.HTMLResult.EMPTY;
  54981. }
  54982. let buffer = this[_xfa_object.$globalData].images && this[_xfa_object.$globalData].images.get(this.href);
  54983. if (!buffer && (this.href || !this[_xfa_object.$content])) {
  54984. return _utils.HTMLResult.EMPTY;
  54985. }
  54986. if (!buffer && this.transferEncoding === "base64") {
  54987. buffer = (0, _util.stringToBytes)(atob(this[_xfa_object.$content]));
  54988. }
  54989. if (!buffer) {
  54990. return _utils.HTMLResult.EMPTY;
  54991. }
  54992. if (!this.contentType) {
  54993. for (const [header, type] of IMAGES_HEADERS) {
  54994. if (buffer.length > header.length && header.every((x, i) => x === buffer[i])) {
  54995. this.contentType = type;
  54996. break;
  54997. }
  54998. }
  54999. if (!this.contentType) {
  55000. return _utils.HTMLResult.EMPTY;
  55001. }
  55002. }
  55003. const blob = new Blob([buffer], {
  55004. type: this.contentType
  55005. });
  55006. let style;
  55007. switch (this.aspect) {
  55008. case "fit":
  55009. case "actual":
  55010. break;
  55011. case "height":
  55012. style = {
  55013. height: "100%",
  55014. objectFit: "fill"
  55015. };
  55016. break;
  55017. case "none":
  55018. style = {
  55019. width: "100%",
  55020. height: "100%",
  55021. objectFit: "fill"
  55022. };
  55023. break;
  55024. case "width":
  55025. style = {
  55026. width: "100%",
  55027. objectFit: "fill"
  55028. };
  55029. break;
  55030. }
  55031. const parent = this[_xfa_object.$getParent]();
  55032. return _utils.HTMLResult.success({
  55033. name: "img",
  55034. attributes: {
  55035. class: ["xfaImage"],
  55036. style,
  55037. src: URL.createObjectURL(blob),
  55038. alt: parent ? ariaLabel(parent[_xfa_object.$getParent]()) : null
  55039. }
  55040. });
  55041. }
  55042. }
  55043. class ImageEdit extends _xfa_object.XFAObject {
  55044. constructor(attributes) {
  55045. super(TEMPLATE_NS_ID, "imageEdit", true);
  55046. this.data = (0, _utils.getStringOption)(attributes.data, ["link", "embed"]);
  55047. this.id = attributes.id || "";
  55048. this.use = attributes.use || "";
  55049. this.usehref = attributes.usehref || "";
  55050. this.border = null;
  55051. this.extras = null;
  55052. this.margin = null;
  55053. }
  55054. [_xfa_object.$toHTML](availableSpace) {
  55055. if (this.data === "embed") {
  55056. return _utils.HTMLResult.success({
  55057. name: "div",
  55058. children: [],
  55059. attributes: {}
  55060. });
  55061. }
  55062. return _utils.HTMLResult.EMPTY;
  55063. }
  55064. }
  55065. class Integer extends _xfa_object.ContentObject {
  55066. constructor(attributes) {
  55067. super(TEMPLATE_NS_ID, "integer");
  55068. this.id = attributes.id || "";
  55069. this.name = attributes.name || "";
  55070. this.use = attributes.use || "";
  55071. this.usehref = attributes.usehref || "";
  55072. }
  55073. [_xfa_object.$finalize]() {
  55074. const number = parseInt(this[_xfa_object.$content].trim(), 10);
  55075. this[_xfa_object.$content] = isNaN(number) ? null : number;
  55076. }
  55077. [_xfa_object.$toHTML](availableSpace) {
  55078. return valueToHtml(this[_xfa_object.$content] !== null ? this[_xfa_object.$content].toString() : "");
  55079. }
  55080. }
  55081. class Issuers extends _xfa_object.XFAObject {
  55082. constructor(attributes) {
  55083. super(TEMPLATE_NS_ID, "issuers", true);
  55084. this.id = attributes.id || "";
  55085. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55086. this.use = attributes.use || "";
  55087. this.usehref = attributes.usehref || "";
  55088. this.certificate = new _xfa_object.XFAObjectArray();
  55089. }
  55090. }
  55091. class Items extends _xfa_object.XFAObject {
  55092. constructor(attributes) {
  55093. super(TEMPLATE_NS_ID, "items", true);
  55094. this.id = attributes.id || "";
  55095. this.name = attributes.name || "";
  55096. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  55097. this.ref = attributes.ref || "";
  55098. this.save = (0, _utils.getInteger)({
  55099. data: attributes.save,
  55100. defaultValue: 0,
  55101. validate: x => x === 1
  55102. });
  55103. this.use = attributes.use || "";
  55104. this.usehref = attributes.usehref || "";
  55105. this.boolean = new _xfa_object.XFAObjectArray();
  55106. this.date = new _xfa_object.XFAObjectArray();
  55107. this.dateTime = new _xfa_object.XFAObjectArray();
  55108. this.decimal = new _xfa_object.XFAObjectArray();
  55109. this.exData = new _xfa_object.XFAObjectArray();
  55110. this.float = new _xfa_object.XFAObjectArray();
  55111. this.image = new _xfa_object.XFAObjectArray();
  55112. this.integer = new _xfa_object.XFAObjectArray();
  55113. this.text = new _xfa_object.XFAObjectArray();
  55114. this.time = new _xfa_object.XFAObjectArray();
  55115. }
  55116. [_xfa_object.$toHTML]() {
  55117. const output = [];
  55118. for (const child of this[_xfa_object.$getChildren]()) {
  55119. output.push(child[_xfa_object.$text]());
  55120. }
  55121. return _utils.HTMLResult.success(output);
  55122. }
  55123. }
  55124. exports.Items = Items;
  55125. class Keep extends _xfa_object.XFAObject {
  55126. constructor(attributes) {
  55127. super(TEMPLATE_NS_ID, "keep", true);
  55128. this.id = attributes.id || "";
  55129. const options = ["none", "contentArea", "pageArea"];
  55130. this.intact = (0, _utils.getStringOption)(attributes.intact, options);
  55131. this.next = (0, _utils.getStringOption)(attributes.next, options);
  55132. this.previous = (0, _utils.getStringOption)(attributes.previous, options);
  55133. this.use = attributes.use || "";
  55134. this.usehref = attributes.usehref || "";
  55135. this.extras = null;
  55136. }
  55137. }
  55138. class KeyUsage extends _xfa_object.XFAObject {
  55139. constructor(attributes) {
  55140. super(TEMPLATE_NS_ID, "keyUsage");
  55141. const options = ["", "yes", "no"];
  55142. this.crlSign = (0, _utils.getStringOption)(attributes.crlSign, options);
  55143. this.dataEncipherment = (0, _utils.getStringOption)(attributes.dataEncipherment, options);
  55144. this.decipherOnly = (0, _utils.getStringOption)(attributes.decipherOnly, options);
  55145. this.digitalSignature = (0, _utils.getStringOption)(attributes.digitalSignature, options);
  55146. this.encipherOnly = (0, _utils.getStringOption)(attributes.encipherOnly, options);
  55147. this.id = attributes.id || "";
  55148. this.keyAgreement = (0, _utils.getStringOption)(attributes.keyAgreement, options);
  55149. this.keyCertSign = (0, _utils.getStringOption)(attributes.keyCertSign, options);
  55150. this.keyEncipherment = (0, _utils.getStringOption)(attributes.keyEncipherment, options);
  55151. this.nonRepudiation = (0, _utils.getStringOption)(attributes.nonRepudiation, options);
  55152. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55153. this.use = attributes.use || "";
  55154. this.usehref = attributes.usehref || "";
  55155. }
  55156. }
  55157. class Line extends _xfa_object.XFAObject {
  55158. constructor(attributes) {
  55159. super(TEMPLATE_NS_ID, "line", true);
  55160. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55161. this.id = attributes.id || "";
  55162. this.slope = (0, _utils.getStringOption)(attributes.slope, ["\\", "/"]);
  55163. this.use = attributes.use || "";
  55164. this.usehref = attributes.usehref || "";
  55165. this.edge = null;
  55166. }
  55167. [_xfa_object.$toHTML]() {
  55168. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55169. const edge = this.edge ? this.edge : new Edge({});
  55170. const edgeStyle = edge[_xfa_object.$toStyle]();
  55171. const style = Object.create(null);
  55172. const thickness = edge.presence === "visible" ? edge.thickness : 0;
  55173. style.strokeWidth = (0, _html_utils.measureToString)(thickness);
  55174. style.stroke = edgeStyle.color;
  55175. let x1, y1, x2, y2;
  55176. let width = "100%";
  55177. let height = "100%";
  55178. if (parent.w <= thickness) {
  55179. [x1, y1, x2, y2] = ["50%", 0, "50%", "100%"];
  55180. width = style.strokeWidth;
  55181. } else if (parent.h <= thickness) {
  55182. [x1, y1, x2, y2] = [0, "50%", "100%", "50%"];
  55183. height = style.strokeWidth;
  55184. } else {
  55185. if (this.slope === "\\") {
  55186. [x1, y1, x2, y2] = [0, 0, "100%", "100%"];
  55187. } else {
  55188. [x1, y1, x2, y2] = [0, "100%", "100%", 0];
  55189. }
  55190. }
  55191. const line = {
  55192. name: "line",
  55193. attributes: {
  55194. xmlns: SVG_NS,
  55195. x1,
  55196. y1,
  55197. x2,
  55198. y2,
  55199. style
  55200. }
  55201. };
  55202. const svg = {
  55203. name: "svg",
  55204. children: [line],
  55205. attributes: {
  55206. xmlns: SVG_NS,
  55207. width,
  55208. height,
  55209. style: {
  55210. overflow: "visible"
  55211. }
  55212. }
  55213. };
  55214. if (hasMargin(parent)) {
  55215. return _utils.HTMLResult.success({
  55216. name: "div",
  55217. attributes: {
  55218. style: {
  55219. display: "inline",
  55220. width: "100%",
  55221. height: "100%"
  55222. }
  55223. },
  55224. children: [svg]
  55225. });
  55226. }
  55227. svg.attributes.style.position = "absolute";
  55228. return _utils.HTMLResult.success(svg);
  55229. }
  55230. }
  55231. class Linear extends _xfa_object.XFAObject {
  55232. constructor(attributes) {
  55233. super(TEMPLATE_NS_ID, "linear", true);
  55234. this.id = attributes.id || "";
  55235. this.type = (0, _utils.getStringOption)(attributes.type, ["toRight", "toBottom", "toLeft", "toTop"]);
  55236. this.use = attributes.use || "";
  55237. this.usehref = attributes.usehref || "";
  55238. this.color = null;
  55239. this.extras = null;
  55240. }
  55241. [_xfa_object.$toStyle](startColor) {
  55242. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55243. const transf = this.type.replace(/([RBLT])/, " $1").toLowerCase();
  55244. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55245. return `linear-gradient(${transf}, ${startColor}, ${endColor})`;
  55246. }
  55247. }
  55248. class LockDocument extends _xfa_object.ContentObject {
  55249. constructor(attributes) {
  55250. super(TEMPLATE_NS_ID, "lockDocument");
  55251. this.id = attributes.id || "";
  55252. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55253. this.use = attributes.use || "";
  55254. this.usehref = attributes.usehref || "";
  55255. }
  55256. [_xfa_object.$finalize]() {
  55257. this[_xfa_object.$content] = (0, _utils.getStringOption)(this[_xfa_object.$content], ["auto", "0", "1"]);
  55258. }
  55259. }
  55260. class Manifest extends _xfa_object.XFAObject {
  55261. constructor(attributes) {
  55262. super(TEMPLATE_NS_ID, "manifest", true);
  55263. this.action = (0, _utils.getStringOption)(attributes.action, ["include", "all", "exclude"]);
  55264. this.id = attributes.id || "";
  55265. this.name = attributes.name || "";
  55266. this.use = attributes.use || "";
  55267. this.usehref = attributes.usehref || "";
  55268. this.extras = null;
  55269. this.ref = new _xfa_object.XFAObjectArray();
  55270. }
  55271. }
  55272. class Margin extends _xfa_object.XFAObject {
  55273. constructor(attributes) {
  55274. super(TEMPLATE_NS_ID, "margin", true);
  55275. this.bottomInset = (0, _utils.getMeasurement)(attributes.bottomInset, "0");
  55276. this.id = attributes.id || "";
  55277. this.leftInset = (0, _utils.getMeasurement)(attributes.leftInset, "0");
  55278. this.rightInset = (0, _utils.getMeasurement)(attributes.rightInset, "0");
  55279. this.topInset = (0, _utils.getMeasurement)(attributes.topInset, "0");
  55280. this.use = attributes.use || "";
  55281. this.usehref = attributes.usehref || "";
  55282. this.extras = null;
  55283. }
  55284. [_xfa_object.$toStyle]() {
  55285. return {
  55286. margin: (0, _html_utils.measureToString)(this.topInset) + " " + (0, _html_utils.measureToString)(this.rightInset) + " " + (0, _html_utils.measureToString)(this.bottomInset) + " " + (0, _html_utils.measureToString)(this.leftInset)
  55287. };
  55288. }
  55289. }
  55290. class Mdp extends _xfa_object.XFAObject {
  55291. constructor(attributes) {
  55292. super(TEMPLATE_NS_ID, "mdp");
  55293. this.id = attributes.id || "";
  55294. this.permissions = (0, _utils.getInteger)({
  55295. data: attributes.permissions,
  55296. defaultValue: 2,
  55297. validate: x => x === 1 || x === 3
  55298. });
  55299. this.signatureType = (0, _utils.getStringOption)(attributes.signatureType, ["filler", "author"]);
  55300. this.use = attributes.use || "";
  55301. this.usehref = attributes.usehref || "";
  55302. }
  55303. }
  55304. class Medium extends _xfa_object.XFAObject {
  55305. constructor(attributes) {
  55306. super(TEMPLATE_NS_ID, "medium");
  55307. this.id = attributes.id || "";
  55308. this.imagingBBox = (0, _utils.getBBox)(attributes.imagingBBox);
  55309. this.long = (0, _utils.getMeasurement)(attributes.long);
  55310. this.orientation = (0, _utils.getStringOption)(attributes.orientation, ["portrait", "landscape"]);
  55311. this.short = (0, _utils.getMeasurement)(attributes.short);
  55312. this.stock = attributes.stock || "";
  55313. this.trayIn = (0, _utils.getStringOption)(attributes.trayIn, ["auto", "delegate", "pageFront"]);
  55314. this.trayOut = (0, _utils.getStringOption)(attributes.trayOut, ["auto", "delegate"]);
  55315. this.use = attributes.use || "";
  55316. this.usehref = attributes.usehref || "";
  55317. }
  55318. }
  55319. class Message extends _xfa_object.XFAObject {
  55320. constructor(attributes) {
  55321. super(TEMPLATE_NS_ID, "message", true);
  55322. this.id = attributes.id || "";
  55323. this.use = attributes.use || "";
  55324. this.usehref = attributes.usehref || "";
  55325. this.text = new _xfa_object.XFAObjectArray();
  55326. }
  55327. }
  55328. class NumericEdit extends _xfa_object.XFAObject {
  55329. constructor(attributes) {
  55330. super(TEMPLATE_NS_ID, "numericEdit", true);
  55331. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55332. this.id = attributes.id || "";
  55333. this.use = attributes.use || "";
  55334. this.usehref = attributes.usehref || "";
  55335. this.border = null;
  55336. this.comb = null;
  55337. this.extras = null;
  55338. this.margin = null;
  55339. }
  55340. [_xfa_object.$toHTML](availableSpace) {
  55341. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  55342. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55343. const html = {
  55344. name: "input",
  55345. attributes: {
  55346. type: "text",
  55347. fieldId: field[_xfa_object.$uid],
  55348. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  55349. class: ["xfaTextfield"],
  55350. style,
  55351. "aria-label": ariaLabel(field)
  55352. }
  55353. };
  55354. return _utils.HTMLResult.success({
  55355. name: "label",
  55356. attributes: {
  55357. class: ["xfaLabel"]
  55358. },
  55359. children: [html]
  55360. });
  55361. }
  55362. }
  55363. class Occur extends _xfa_object.XFAObject {
  55364. constructor(attributes) {
  55365. super(TEMPLATE_NS_ID, "occur", true);
  55366. this.id = attributes.id || "";
  55367. this.initial = attributes.initial !== "" ? (0, _utils.getInteger)({
  55368. data: attributes.initial,
  55369. defaultValue: "",
  55370. validate: x => true
  55371. }) : "";
  55372. this.max = attributes.max !== "" ? (0, _utils.getInteger)({
  55373. data: attributes.max,
  55374. defaultValue: 1,
  55375. validate: x => true
  55376. }) : "";
  55377. this.min = attributes.min !== "" ? (0, _utils.getInteger)({
  55378. data: attributes.min,
  55379. defaultValue: 1,
  55380. validate: x => true
  55381. }) : "";
  55382. this.use = attributes.use || "";
  55383. this.usehref = attributes.usehref || "";
  55384. this.extras = null;
  55385. }
  55386. [_xfa_object.$clean]() {
  55387. const parent = this[_xfa_object.$getParent]();
  55388. const originalMin = this.min;
  55389. if (this.min === "") {
  55390. this.min = parent instanceof PageArea || parent instanceof PageSet ? 0 : 1;
  55391. }
  55392. if (this.max === "") {
  55393. if (originalMin === "") {
  55394. this.max = parent instanceof PageArea || parent instanceof PageSet ? -1 : 1;
  55395. } else {
  55396. this.max = this.min;
  55397. }
  55398. }
  55399. if (this.max !== -1 && this.max < this.min) {
  55400. this.max = this.min;
  55401. }
  55402. if (this.initial === "") {
  55403. this.initial = parent instanceof Template ? 1 : this.min;
  55404. }
  55405. }
  55406. }
  55407. class Oid extends _xfa_object.StringObject {
  55408. constructor(attributes) {
  55409. super(TEMPLATE_NS_ID, "oid");
  55410. this.id = attributes.id || "";
  55411. this.name = attributes.name || "";
  55412. this.use = attributes.use || "";
  55413. this.usehref = attributes.usehref || "";
  55414. }
  55415. }
  55416. class Oids extends _xfa_object.XFAObject {
  55417. constructor(attributes) {
  55418. super(TEMPLATE_NS_ID, "oids", true);
  55419. this.id = attributes.id || "";
  55420. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55421. this.use = attributes.use || "";
  55422. this.usehref = attributes.usehref || "";
  55423. this.oid = new _xfa_object.XFAObjectArray();
  55424. }
  55425. }
  55426. class Overflow extends _xfa_object.XFAObject {
  55427. constructor(attributes) {
  55428. super(TEMPLATE_NS_ID, "overflow");
  55429. this.id = attributes.id || "";
  55430. this.leader = attributes.leader || "";
  55431. this.target = attributes.target || "";
  55432. this.trailer = attributes.trailer || "";
  55433. this.use = attributes.use || "";
  55434. this.usehref = attributes.usehref || "";
  55435. }
  55436. [_xfa_object.$getExtra]() {
  55437. if (!this[_xfa_object.$extra]) {
  55438. const parent = this[_xfa_object.$getParent]();
  55439. const root = this[_xfa_object.$getTemplateRoot]();
  55440. const target = root[_xfa_object.$searchNode](this.target, parent);
  55441. const leader = root[_xfa_object.$searchNode](this.leader, parent);
  55442. const trailer = root[_xfa_object.$searchNode](this.trailer, parent);
  55443. this[_xfa_object.$extra] = {
  55444. target: target && target[0] || null,
  55445. leader: leader && leader[0] || null,
  55446. trailer: trailer && trailer[0] || null,
  55447. addLeader: false,
  55448. addTrailer: false
  55449. };
  55450. }
  55451. return this[_xfa_object.$extra];
  55452. }
  55453. }
  55454. class PageArea extends _xfa_object.XFAObject {
  55455. constructor(attributes) {
  55456. super(TEMPLATE_NS_ID, "pageArea", true);
  55457. this.blankOrNotBlank = (0, _utils.getStringOption)(attributes.blankOrNotBlank, ["any", "blank", "notBlank"]);
  55458. this.id = attributes.id || "";
  55459. this.initialNumber = (0, _utils.getInteger)({
  55460. data: attributes.initialNumber,
  55461. defaultValue: 1,
  55462. validate: x => true
  55463. });
  55464. this.name = attributes.name || "";
  55465. this.numbered = (0, _utils.getInteger)({
  55466. data: attributes.numbered,
  55467. defaultValue: 1,
  55468. validate: x => true
  55469. });
  55470. this.oddOrEven = (0, _utils.getStringOption)(attributes.oddOrEven, ["any", "even", "odd"]);
  55471. this.pagePosition = (0, _utils.getStringOption)(attributes.pagePosition, ["any", "first", "last", "only", "rest"]);
  55472. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55473. this.use = attributes.use || "";
  55474. this.usehref = attributes.usehref || "";
  55475. this.desc = null;
  55476. this.extras = null;
  55477. this.medium = null;
  55478. this.occur = null;
  55479. this.area = new _xfa_object.XFAObjectArray();
  55480. this.contentArea = new _xfa_object.XFAObjectArray();
  55481. this.draw = new _xfa_object.XFAObjectArray();
  55482. this.exclGroup = new _xfa_object.XFAObjectArray();
  55483. this.field = new _xfa_object.XFAObjectArray();
  55484. this.subform = new _xfa_object.XFAObjectArray();
  55485. }
  55486. [_xfa_object.$isUsable]() {
  55487. if (!this[_xfa_object.$extra]) {
  55488. this[_xfa_object.$extra] = {
  55489. numberOfUse: 0
  55490. };
  55491. return true;
  55492. }
  55493. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  55494. }
  55495. [_xfa_object.$cleanPage]() {
  55496. delete this[_xfa_object.$extra];
  55497. }
  55498. [_xfa_object.$getNextPage]() {
  55499. if (!this[_xfa_object.$extra]) {
  55500. this[_xfa_object.$extra] = {
  55501. numberOfUse: 0
  55502. };
  55503. }
  55504. const parent = this[_xfa_object.$getParent]();
  55505. if (parent.relation === "orderedOccurrence") {
  55506. if (this[_xfa_object.$isUsable]()) {
  55507. this[_xfa_object.$extra].numberOfUse += 1;
  55508. return this;
  55509. }
  55510. }
  55511. return parent[_xfa_object.$getNextPage]();
  55512. }
  55513. [_xfa_object.$getAvailableSpace]() {
  55514. return this[_xfa_object.$extra].space || {
  55515. width: 0,
  55516. height: 0
  55517. };
  55518. }
  55519. [_xfa_object.$toHTML]() {
  55520. if (!this[_xfa_object.$extra]) {
  55521. this[_xfa_object.$extra] = {
  55522. numberOfUse: 1
  55523. };
  55524. }
  55525. const children = [];
  55526. this[_xfa_object.$extra].children = children;
  55527. const style = Object.create(null);
  55528. if (this.medium && this.medium.short && this.medium.long) {
  55529. style.width = (0, _html_utils.measureToString)(this.medium.short);
  55530. style.height = (0, _html_utils.measureToString)(this.medium.long);
  55531. this[_xfa_object.$extra].space = {
  55532. width: this.medium.short,
  55533. height: this.medium.long
  55534. };
  55535. if (this.medium.orientation === "landscape") {
  55536. const x = style.width;
  55537. style.width = style.height;
  55538. style.height = x;
  55539. this[_xfa_object.$extra].space = {
  55540. width: this.medium.long,
  55541. height: this.medium.short
  55542. };
  55543. }
  55544. } else {
  55545. (0, _util.warn)("XFA - No medium specified in pageArea: please file a bug.");
  55546. }
  55547. this[_xfa_object.$childrenToHTML]({
  55548. filter: new Set(["area", "draw", "field", "subform"]),
  55549. include: true
  55550. });
  55551. this[_xfa_object.$childrenToHTML]({
  55552. filter: new Set(["contentArea"]),
  55553. include: true
  55554. });
  55555. return _utils.HTMLResult.success({
  55556. name: "div",
  55557. children,
  55558. attributes: {
  55559. class: ["xfaPage"],
  55560. id: this[_xfa_object.$uid],
  55561. style,
  55562. xfaName: this.name
  55563. }
  55564. });
  55565. }
  55566. }
  55567. class PageSet extends _xfa_object.XFAObject {
  55568. constructor(attributes) {
  55569. super(TEMPLATE_NS_ID, "pageSet", true);
  55570. this.duplexImposition = (0, _utils.getStringOption)(attributes.duplexImposition, ["longEdge", "shortEdge"]);
  55571. this.id = attributes.id || "";
  55572. this.name = attributes.name || "";
  55573. this.relation = (0, _utils.getStringOption)(attributes.relation, ["orderedOccurrence", "duplexPaginated", "simplexPaginated"]);
  55574. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  55575. this.use = attributes.use || "";
  55576. this.usehref = attributes.usehref || "";
  55577. this.extras = null;
  55578. this.occur = null;
  55579. this.pageArea = new _xfa_object.XFAObjectArray();
  55580. this.pageSet = new _xfa_object.XFAObjectArray();
  55581. }
  55582. [_xfa_object.$cleanPage]() {
  55583. for (const page of this.pageArea.children) {
  55584. page[_xfa_object.$cleanPage]();
  55585. }
  55586. for (const page of this.pageSet.children) {
  55587. page[_xfa_object.$cleanPage]();
  55588. }
  55589. }
  55590. [_xfa_object.$isUsable]() {
  55591. return !this.occur || this.occur.max === -1 || this[_xfa_object.$extra].numberOfUse < this.occur.max;
  55592. }
  55593. [_xfa_object.$getNextPage]() {
  55594. if (!this[_xfa_object.$extra]) {
  55595. this[_xfa_object.$extra] = {
  55596. numberOfUse: 1,
  55597. pageIndex: -1,
  55598. pageSetIndex: -1
  55599. };
  55600. }
  55601. if (this.relation === "orderedOccurrence") {
  55602. if (this[_xfa_object.$extra].pageIndex + 1 < this.pageArea.children.length) {
  55603. this[_xfa_object.$extra].pageIndex += 1;
  55604. const pageArea = this.pageArea.children[this[_xfa_object.$extra].pageIndex];
  55605. return pageArea[_xfa_object.$getNextPage]();
  55606. }
  55607. if (this[_xfa_object.$extra].pageSetIndex + 1 < this.pageSet.children.length) {
  55608. this[_xfa_object.$extra].pageSetIndex += 1;
  55609. return this.pageSet.children[this[_xfa_object.$extra].pageSetIndex][_xfa_object.$getNextPage]();
  55610. }
  55611. if (this[_xfa_object.$isUsable]()) {
  55612. this[_xfa_object.$extra].numberOfUse += 1;
  55613. this[_xfa_object.$extra].pageIndex = -1;
  55614. this[_xfa_object.$extra].pageSetIndex = -1;
  55615. return this[_xfa_object.$getNextPage]();
  55616. }
  55617. const parent = this[_xfa_object.$getParent]();
  55618. if (parent instanceof PageSet) {
  55619. return parent[_xfa_object.$getNextPage]();
  55620. }
  55621. this[_xfa_object.$cleanPage]();
  55622. return this[_xfa_object.$getNextPage]();
  55623. }
  55624. const pageNumber = this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].pageNumber;
  55625. const parity = pageNumber % 2 === 0 ? "even" : "odd";
  55626. const position = pageNumber === 0 ? "first" : "rest";
  55627. let page = this.pageArea.children.find(p => p.oddOrEven === parity && p.pagePosition === position);
  55628. if (page) {
  55629. return page;
  55630. }
  55631. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === position);
  55632. if (page) {
  55633. return page;
  55634. }
  55635. page = this.pageArea.children.find(p => p.oddOrEven === "any" && p.pagePosition === "any");
  55636. if (page) {
  55637. return page;
  55638. }
  55639. return this.pageArea.children[0];
  55640. }
  55641. }
  55642. class Para extends _xfa_object.XFAObject {
  55643. constructor(attributes) {
  55644. super(TEMPLATE_NS_ID, "para", true);
  55645. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  55646. this.id = attributes.id || "";
  55647. this.lineHeight = attributes.lineHeight ? (0, _utils.getMeasurement)(attributes.lineHeight, "0pt") : "";
  55648. this.marginLeft = attributes.marginLeft ? (0, _utils.getMeasurement)(attributes.marginLeft, "0pt") : "";
  55649. this.marginRight = attributes.marginRight ? (0, _utils.getMeasurement)(attributes.marginRight, "0pt") : "";
  55650. this.orphans = (0, _utils.getInteger)({
  55651. data: attributes.orphans,
  55652. defaultValue: 0,
  55653. validate: x => x >= 0
  55654. });
  55655. this.preserve = attributes.preserve || "";
  55656. this.radixOffset = attributes.radixOffset ? (0, _utils.getMeasurement)(attributes.radixOffset, "0pt") : "";
  55657. this.spaceAbove = attributes.spaceAbove ? (0, _utils.getMeasurement)(attributes.spaceAbove, "0pt") : "";
  55658. this.spaceBelow = attributes.spaceBelow ? (0, _utils.getMeasurement)(attributes.spaceBelow, "0pt") : "";
  55659. this.tabDefault = attributes.tabDefault ? (0, _utils.getMeasurement)(this.tabDefault) : "";
  55660. this.tabStops = (attributes.tabStops || "").trim().split(/\s+/).map((x, i) => i % 2 === 1 ? (0, _utils.getMeasurement)(x) : x);
  55661. this.textIndent = attributes.textIndent ? (0, _utils.getMeasurement)(attributes.textIndent, "0pt") : "";
  55662. this.use = attributes.use || "";
  55663. this.usehref = attributes.usehref || "";
  55664. this.vAlign = (0, _utils.getStringOption)(attributes.vAlign, ["top", "bottom", "middle"]);
  55665. this.widows = (0, _utils.getInteger)({
  55666. data: attributes.widows,
  55667. defaultValue: 0,
  55668. validate: x => x >= 0
  55669. });
  55670. this.hyphenation = null;
  55671. }
  55672. [_xfa_object.$toStyle]() {
  55673. const style = (0, _html_utils.toStyle)(this, "hAlign");
  55674. if (this.marginLeft !== "") {
  55675. style.paddingLeft = (0, _html_utils.measureToString)(this.marginLeft);
  55676. }
  55677. if (this.marginRight !== "") {
  55678. style.paddingight = (0, _html_utils.measureToString)(this.marginRight);
  55679. }
  55680. if (this.spaceAbove !== "") {
  55681. style.paddingTop = (0, _html_utils.measureToString)(this.spaceAbove);
  55682. }
  55683. if (this.spaceBelow !== "") {
  55684. style.paddingBottom = (0, _html_utils.measureToString)(this.spaceBelow);
  55685. }
  55686. if (this.textIndent !== "") {
  55687. style.textIndent = (0, _html_utils.measureToString)(this.textIndent);
  55688. (0, _html_utils.fixTextIndent)(style);
  55689. }
  55690. if (this.lineHeight > 0) {
  55691. style.lineHeight = (0, _html_utils.measureToString)(this.lineHeight);
  55692. }
  55693. if (this.tabDefault !== "") {
  55694. style.tabSize = (0, _html_utils.measureToString)(this.tabDefault);
  55695. }
  55696. if (this.tabStops.length > 0) {}
  55697. if (this.hyphenatation) {
  55698. Object.assign(style, this.hyphenatation[_xfa_object.$toStyle]());
  55699. }
  55700. return style;
  55701. }
  55702. }
  55703. class PasswordEdit extends _xfa_object.XFAObject {
  55704. constructor(attributes) {
  55705. super(TEMPLATE_NS_ID, "passwordEdit", true);
  55706. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  55707. this.id = attributes.id || "";
  55708. this.passwordChar = attributes.passwordChar || "*";
  55709. this.use = attributes.use || "";
  55710. this.usehref = attributes.usehref || "";
  55711. this.border = null;
  55712. this.extras = null;
  55713. this.margin = null;
  55714. }
  55715. }
  55716. class Pattern extends _xfa_object.XFAObject {
  55717. constructor(attributes) {
  55718. super(TEMPLATE_NS_ID, "pattern", true);
  55719. this.id = attributes.id || "";
  55720. this.type = (0, _utils.getStringOption)(attributes.type, ["crossHatch", "crossDiagonal", "diagonalLeft", "diagonalRight", "horizontal", "vertical"]);
  55721. this.use = attributes.use || "";
  55722. this.usehref = attributes.usehref || "";
  55723. this.color = null;
  55724. this.extras = null;
  55725. }
  55726. [_xfa_object.$toStyle](startColor) {
  55727. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55728. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55729. const width = 5;
  55730. const cmd = "repeating-linear-gradient";
  55731. const colors = `${startColor},${startColor} ${width}px,${endColor} ${width}px,${endColor} ${2 * width}px`;
  55732. switch (this.type) {
  55733. case "crossHatch":
  55734. return `${cmd}(to top,${colors}) ${cmd}(to right,${colors})`;
  55735. case "crossDiagonal":
  55736. return `${cmd}(45deg,${colors}) ${cmd}(-45deg,${colors})`;
  55737. case "diagonalLeft":
  55738. return `${cmd}(45deg,${colors})`;
  55739. case "diagonalRight":
  55740. return `${cmd}(-45deg,${colors})`;
  55741. case "horizontal":
  55742. return `${cmd}(to top,${colors})`;
  55743. case "vertical":
  55744. return `${cmd}(to right,${colors})`;
  55745. }
  55746. return "";
  55747. }
  55748. }
  55749. class Picture extends _xfa_object.StringObject {
  55750. constructor(attributes) {
  55751. super(TEMPLATE_NS_ID, "picture");
  55752. this.id = attributes.id || "";
  55753. this.use = attributes.use || "";
  55754. this.usehref = attributes.usehref || "";
  55755. }
  55756. }
  55757. class Proto extends _xfa_object.XFAObject {
  55758. constructor(attributes) {
  55759. super(TEMPLATE_NS_ID, "proto", true);
  55760. this.appearanceFilter = new _xfa_object.XFAObjectArray();
  55761. this.arc = new _xfa_object.XFAObjectArray();
  55762. this.area = new _xfa_object.XFAObjectArray();
  55763. this.assist = new _xfa_object.XFAObjectArray();
  55764. this.barcode = new _xfa_object.XFAObjectArray();
  55765. this.bindItems = new _xfa_object.XFAObjectArray();
  55766. this.bookend = new _xfa_object.XFAObjectArray();
  55767. this.boolean = new _xfa_object.XFAObjectArray();
  55768. this.border = new _xfa_object.XFAObjectArray();
  55769. this.break = new _xfa_object.XFAObjectArray();
  55770. this.breakAfter = new _xfa_object.XFAObjectArray();
  55771. this.breakBefore = new _xfa_object.XFAObjectArray();
  55772. this.button = new _xfa_object.XFAObjectArray();
  55773. this.calculate = new _xfa_object.XFAObjectArray();
  55774. this.caption = new _xfa_object.XFAObjectArray();
  55775. this.certificate = new _xfa_object.XFAObjectArray();
  55776. this.certificates = new _xfa_object.XFAObjectArray();
  55777. this.checkButton = new _xfa_object.XFAObjectArray();
  55778. this.choiceList = new _xfa_object.XFAObjectArray();
  55779. this.color = new _xfa_object.XFAObjectArray();
  55780. this.comb = new _xfa_object.XFAObjectArray();
  55781. this.connect = new _xfa_object.XFAObjectArray();
  55782. this.contentArea = new _xfa_object.XFAObjectArray();
  55783. this.corner = new _xfa_object.XFAObjectArray();
  55784. this.date = new _xfa_object.XFAObjectArray();
  55785. this.dateTime = new _xfa_object.XFAObjectArray();
  55786. this.dateTimeEdit = new _xfa_object.XFAObjectArray();
  55787. this.decimal = new _xfa_object.XFAObjectArray();
  55788. this.defaultUi = new _xfa_object.XFAObjectArray();
  55789. this.desc = new _xfa_object.XFAObjectArray();
  55790. this.digestMethod = new _xfa_object.XFAObjectArray();
  55791. this.digestMethods = new _xfa_object.XFAObjectArray();
  55792. this.draw = new _xfa_object.XFAObjectArray();
  55793. this.edge = new _xfa_object.XFAObjectArray();
  55794. this.encoding = new _xfa_object.XFAObjectArray();
  55795. this.encodings = new _xfa_object.XFAObjectArray();
  55796. this.encrypt = new _xfa_object.XFAObjectArray();
  55797. this.encryptData = new _xfa_object.XFAObjectArray();
  55798. this.encryption = new _xfa_object.XFAObjectArray();
  55799. this.encryptionMethod = new _xfa_object.XFAObjectArray();
  55800. this.encryptionMethods = new _xfa_object.XFAObjectArray();
  55801. this.event = new _xfa_object.XFAObjectArray();
  55802. this.exData = new _xfa_object.XFAObjectArray();
  55803. this.exObject = new _xfa_object.XFAObjectArray();
  55804. this.exclGroup = new _xfa_object.XFAObjectArray();
  55805. this.execute = new _xfa_object.XFAObjectArray();
  55806. this.extras = new _xfa_object.XFAObjectArray();
  55807. this.field = new _xfa_object.XFAObjectArray();
  55808. this.fill = new _xfa_object.XFAObjectArray();
  55809. this.filter = new _xfa_object.XFAObjectArray();
  55810. this.float = new _xfa_object.XFAObjectArray();
  55811. this.font = new _xfa_object.XFAObjectArray();
  55812. this.format = new _xfa_object.XFAObjectArray();
  55813. this.handler = new _xfa_object.XFAObjectArray();
  55814. this.hyphenation = new _xfa_object.XFAObjectArray();
  55815. this.image = new _xfa_object.XFAObjectArray();
  55816. this.imageEdit = new _xfa_object.XFAObjectArray();
  55817. this.integer = new _xfa_object.XFAObjectArray();
  55818. this.issuers = new _xfa_object.XFAObjectArray();
  55819. this.items = new _xfa_object.XFAObjectArray();
  55820. this.keep = new _xfa_object.XFAObjectArray();
  55821. this.keyUsage = new _xfa_object.XFAObjectArray();
  55822. this.line = new _xfa_object.XFAObjectArray();
  55823. this.linear = new _xfa_object.XFAObjectArray();
  55824. this.lockDocument = new _xfa_object.XFAObjectArray();
  55825. this.manifest = new _xfa_object.XFAObjectArray();
  55826. this.margin = new _xfa_object.XFAObjectArray();
  55827. this.mdp = new _xfa_object.XFAObjectArray();
  55828. this.medium = new _xfa_object.XFAObjectArray();
  55829. this.message = new _xfa_object.XFAObjectArray();
  55830. this.numericEdit = new _xfa_object.XFAObjectArray();
  55831. this.occur = new _xfa_object.XFAObjectArray();
  55832. this.oid = new _xfa_object.XFAObjectArray();
  55833. this.oids = new _xfa_object.XFAObjectArray();
  55834. this.overflow = new _xfa_object.XFAObjectArray();
  55835. this.pageArea = new _xfa_object.XFAObjectArray();
  55836. this.pageSet = new _xfa_object.XFAObjectArray();
  55837. this.para = new _xfa_object.XFAObjectArray();
  55838. this.passwordEdit = new _xfa_object.XFAObjectArray();
  55839. this.pattern = new _xfa_object.XFAObjectArray();
  55840. this.picture = new _xfa_object.XFAObjectArray();
  55841. this.radial = new _xfa_object.XFAObjectArray();
  55842. this.reason = new _xfa_object.XFAObjectArray();
  55843. this.reasons = new _xfa_object.XFAObjectArray();
  55844. this.rectangle = new _xfa_object.XFAObjectArray();
  55845. this.ref = new _xfa_object.XFAObjectArray();
  55846. this.script = new _xfa_object.XFAObjectArray();
  55847. this.setProperty = new _xfa_object.XFAObjectArray();
  55848. this.signData = new _xfa_object.XFAObjectArray();
  55849. this.signature = new _xfa_object.XFAObjectArray();
  55850. this.signing = new _xfa_object.XFAObjectArray();
  55851. this.solid = new _xfa_object.XFAObjectArray();
  55852. this.speak = new _xfa_object.XFAObjectArray();
  55853. this.stipple = new _xfa_object.XFAObjectArray();
  55854. this.subform = new _xfa_object.XFAObjectArray();
  55855. this.subformSet = new _xfa_object.XFAObjectArray();
  55856. this.subjectDN = new _xfa_object.XFAObjectArray();
  55857. this.subjectDNs = new _xfa_object.XFAObjectArray();
  55858. this.submit = new _xfa_object.XFAObjectArray();
  55859. this.text = new _xfa_object.XFAObjectArray();
  55860. this.textEdit = new _xfa_object.XFAObjectArray();
  55861. this.time = new _xfa_object.XFAObjectArray();
  55862. this.timeStamp = new _xfa_object.XFAObjectArray();
  55863. this.toolTip = new _xfa_object.XFAObjectArray();
  55864. this.traversal = new _xfa_object.XFAObjectArray();
  55865. this.traverse = new _xfa_object.XFAObjectArray();
  55866. this.ui = new _xfa_object.XFAObjectArray();
  55867. this.validate = new _xfa_object.XFAObjectArray();
  55868. this.value = new _xfa_object.XFAObjectArray();
  55869. this.variables = new _xfa_object.XFAObjectArray();
  55870. }
  55871. }
  55872. class Radial extends _xfa_object.XFAObject {
  55873. constructor(attributes) {
  55874. super(TEMPLATE_NS_ID, "radial", true);
  55875. this.id = attributes.id || "";
  55876. this.type = (0, _utils.getStringOption)(attributes.type, ["toEdge", "toCenter"]);
  55877. this.use = attributes.use || "";
  55878. this.usehref = attributes.usehref || "";
  55879. this.color = null;
  55880. this.extras = null;
  55881. }
  55882. [_xfa_object.$toStyle](startColor) {
  55883. startColor = startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  55884. const endColor = this.color ? this.color[_xfa_object.$toStyle]() : "#000000";
  55885. const colors = this.type === "toEdge" ? `${startColor},${endColor}` : `${endColor},${startColor}`;
  55886. return `radial-gradient(circle at center, ${colors})`;
  55887. }
  55888. }
  55889. class Reason extends _xfa_object.StringObject {
  55890. constructor(attributes) {
  55891. super(TEMPLATE_NS_ID, "reason");
  55892. this.id = attributes.id || "";
  55893. this.name = attributes.name || "";
  55894. this.use = attributes.use || "";
  55895. this.usehref = attributes.usehref || "";
  55896. }
  55897. }
  55898. class Reasons extends _xfa_object.XFAObject {
  55899. constructor(attributes) {
  55900. super(TEMPLATE_NS_ID, "reasons", true);
  55901. this.id = attributes.id || "";
  55902. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  55903. this.use = attributes.use || "";
  55904. this.usehref = attributes.usehref || "";
  55905. this.reason = new _xfa_object.XFAObjectArray();
  55906. }
  55907. }
  55908. class Rectangle extends _xfa_object.XFAObject {
  55909. constructor(attributes) {
  55910. super(TEMPLATE_NS_ID, "rectangle", true);
  55911. this.hand = (0, _utils.getStringOption)(attributes.hand, ["even", "left", "right"]);
  55912. this.id = attributes.id || "";
  55913. this.use = attributes.use || "";
  55914. this.usehref = attributes.usehref || "";
  55915. this.corner = new _xfa_object.XFAObjectArray(4);
  55916. this.edge = new _xfa_object.XFAObjectArray(4);
  55917. this.fill = null;
  55918. }
  55919. [_xfa_object.$toHTML]() {
  55920. const edge = this.edge.children.length ? this.edge.children[0] : new Edge({});
  55921. const edgeStyle = edge[_xfa_object.$toStyle]();
  55922. const style = Object.create(null);
  55923. if (this.fill && this.fill.presence === "visible") {
  55924. Object.assign(style, this.fill[_xfa_object.$toStyle]());
  55925. } else {
  55926. style.fill = "transparent";
  55927. }
  55928. style.strokeWidth = (0, _html_utils.measureToString)(edge.presence === "visible" ? edge.thickness : 0);
  55929. style.stroke = edgeStyle.color;
  55930. const corner = this.corner.children.length ? this.corner.children[0] : new Corner({});
  55931. const cornerStyle = corner[_xfa_object.$toStyle]();
  55932. const rect = {
  55933. name: "rect",
  55934. attributes: {
  55935. xmlns: SVG_NS,
  55936. width: "100%",
  55937. height: "100%",
  55938. x: 0,
  55939. y: 0,
  55940. rx: cornerStyle.radius,
  55941. ry: cornerStyle.radius,
  55942. style
  55943. }
  55944. };
  55945. const svg = {
  55946. name: "svg",
  55947. children: [rect],
  55948. attributes: {
  55949. xmlns: SVG_NS,
  55950. style: {
  55951. overflow: "visible"
  55952. },
  55953. width: "100%",
  55954. height: "100%"
  55955. }
  55956. };
  55957. const parent = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  55958. if (hasMargin(parent)) {
  55959. return _utils.HTMLResult.success({
  55960. name: "div",
  55961. attributes: {
  55962. style: {
  55963. display: "inline",
  55964. width: "100%",
  55965. height: "100%"
  55966. }
  55967. },
  55968. children: [svg]
  55969. });
  55970. }
  55971. svg.attributes.style.position = "absolute";
  55972. return _utils.HTMLResult.success(svg);
  55973. }
  55974. }
  55975. class RefElement extends _xfa_object.StringObject {
  55976. constructor(attributes) {
  55977. super(TEMPLATE_NS_ID, "ref");
  55978. this.id = attributes.id || "";
  55979. this.use = attributes.use || "";
  55980. this.usehref = attributes.usehref || "";
  55981. }
  55982. }
  55983. class Script extends _xfa_object.StringObject {
  55984. constructor(attributes) {
  55985. super(TEMPLATE_NS_ID, "script");
  55986. this.binding = attributes.binding || "";
  55987. this.contentType = attributes.contentType || "";
  55988. this.id = attributes.id || "";
  55989. this.name = attributes.name || "";
  55990. this.runAt = (0, _utils.getStringOption)(attributes.runAt, ["client", "both", "server"]);
  55991. this.use = attributes.use || "";
  55992. this.usehref = attributes.usehref || "";
  55993. }
  55994. }
  55995. class SetProperty extends _xfa_object.XFAObject {
  55996. constructor(attributes) {
  55997. super(TEMPLATE_NS_ID, "setProperty");
  55998. this.connection = attributes.connection || "";
  55999. this.ref = attributes.ref || "";
  56000. this.target = attributes.target || "";
  56001. }
  56002. }
  56003. exports.SetProperty = SetProperty;
  56004. class SignData extends _xfa_object.XFAObject {
  56005. constructor(attributes) {
  56006. super(TEMPLATE_NS_ID, "signData", true);
  56007. this.id = attributes.id || "";
  56008. this.operation = (0, _utils.getStringOption)(attributes.operation, ["sign", "clear", "verify"]);
  56009. this.ref = attributes.ref || "";
  56010. this.target = attributes.target || "";
  56011. this.use = attributes.use || "";
  56012. this.usehref = attributes.usehref || "";
  56013. this.filter = null;
  56014. this.manifest = null;
  56015. }
  56016. }
  56017. class Signature extends _xfa_object.XFAObject {
  56018. constructor(attributes) {
  56019. super(TEMPLATE_NS_ID, "signature", true);
  56020. this.id = attributes.id || "";
  56021. this.type = (0, _utils.getStringOption)(attributes.type, ["PDF1.3", "PDF1.6"]);
  56022. this.use = attributes.use || "";
  56023. this.usehref = attributes.usehref || "";
  56024. this.border = null;
  56025. this.extras = null;
  56026. this.filter = null;
  56027. this.manifest = null;
  56028. this.margin = null;
  56029. }
  56030. }
  56031. class Signing extends _xfa_object.XFAObject {
  56032. constructor(attributes) {
  56033. super(TEMPLATE_NS_ID, "signing", true);
  56034. this.id = attributes.id || "";
  56035. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56036. this.use = attributes.use || "";
  56037. this.usehref = attributes.usehref || "";
  56038. this.certificate = new _xfa_object.XFAObjectArray();
  56039. }
  56040. }
  56041. class Solid extends _xfa_object.XFAObject {
  56042. constructor(attributes) {
  56043. super(TEMPLATE_NS_ID, "solid", true);
  56044. this.id = attributes.id || "";
  56045. this.use = attributes.use || "";
  56046. this.usehref = attributes.usehref || "";
  56047. this.extras = null;
  56048. }
  56049. [_xfa_object.$toStyle](startColor) {
  56050. return startColor ? startColor[_xfa_object.$toStyle]() : "#FFFFFF";
  56051. }
  56052. }
  56053. class Speak extends _xfa_object.StringObject {
  56054. constructor(attributes) {
  56055. super(TEMPLATE_NS_ID, "speak");
  56056. this.disable = (0, _utils.getInteger)({
  56057. data: attributes.disable,
  56058. defaultValue: 0,
  56059. validate: x => x === 1
  56060. });
  56061. this.id = attributes.id || "";
  56062. this.priority = (0, _utils.getStringOption)(attributes.priority, ["custom", "caption", "name", "toolTip"]);
  56063. this.rid = attributes.rid || "";
  56064. this.use = attributes.use || "";
  56065. this.usehref = attributes.usehref || "";
  56066. }
  56067. }
  56068. class Stipple extends _xfa_object.XFAObject {
  56069. constructor(attributes) {
  56070. super(TEMPLATE_NS_ID, "stipple", true);
  56071. this.id = attributes.id || "";
  56072. this.rate = (0, _utils.getInteger)({
  56073. data: attributes.rate,
  56074. defaultValue: 50,
  56075. validate: x => x >= 0 && x <= 100
  56076. });
  56077. this.use = attributes.use || "";
  56078. this.usehref = attributes.usehref || "";
  56079. this.color = null;
  56080. this.extras = null;
  56081. }
  56082. [_xfa_object.$toStyle](bgColor) {
  56083. const alpha = this.rate / 100;
  56084. return _util.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));
  56085. }
  56086. }
  56087. class Subform extends _xfa_object.XFAObject {
  56088. constructor(attributes) {
  56089. super(TEMPLATE_NS_ID, "subform", true);
  56090. this.access = (0, _utils.getStringOption)(attributes.access, ["open", "nonInteractive", "protected", "readOnly"]);
  56091. this.allowMacro = (0, _utils.getInteger)({
  56092. data: attributes.allowMacro,
  56093. defaultValue: 0,
  56094. validate: x => x === 1
  56095. });
  56096. this.anchorType = (0, _utils.getStringOption)(attributes.anchorType, ["topLeft", "bottomCenter", "bottomLeft", "bottomRight", "middleCenter", "middleLeft", "middleRight", "topCenter", "topRight"]);
  56097. this.colSpan = (0, _utils.getInteger)({
  56098. data: attributes.colSpan,
  56099. defaultValue: 1,
  56100. validate: n => n >= 1 || n === -1
  56101. });
  56102. this.columnWidths = (attributes.columnWidths || "").trim().split(/\s+/).map(x => x === "-1" ? -1 : (0, _utils.getMeasurement)(x));
  56103. this.h = attributes.h ? (0, _utils.getMeasurement)(attributes.h) : "";
  56104. this.hAlign = (0, _utils.getStringOption)(attributes.hAlign, ["left", "center", "justify", "justifyAll", "radix", "right"]);
  56105. this.id = attributes.id || "";
  56106. this.layout = (0, _utils.getStringOption)(attributes.layout, ["position", "lr-tb", "rl-row", "rl-tb", "row", "table", "tb"]);
  56107. this.locale = attributes.locale || "";
  56108. this.maxH = (0, _utils.getMeasurement)(attributes.maxH, "0pt");
  56109. this.maxW = (0, _utils.getMeasurement)(attributes.maxW, "0pt");
  56110. this.mergeMode = (0, _utils.getStringOption)(attributes.mergeMode, ["consumeData", "matchTemplate"]);
  56111. this.minH = (0, _utils.getMeasurement)(attributes.minH, "0pt");
  56112. this.minW = (0, _utils.getMeasurement)(attributes.minW, "0pt");
  56113. this.name = attributes.name || "";
  56114. this.presence = (0, _utils.getStringOption)(attributes.presence, ["visible", "hidden", "inactive", "invisible"]);
  56115. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56116. this.restoreState = (0, _utils.getStringOption)(attributes.restoreState, ["manual", "auto"]);
  56117. this.scope = (0, _utils.getStringOption)(attributes.scope, ["name", "none"]);
  56118. this.use = attributes.use || "";
  56119. this.usehref = attributes.usehref || "";
  56120. this.w = attributes.w ? (0, _utils.getMeasurement)(attributes.w) : "";
  56121. this.x = (0, _utils.getMeasurement)(attributes.x, "0pt");
  56122. this.y = (0, _utils.getMeasurement)(attributes.y, "0pt");
  56123. this.assist = null;
  56124. this.bind = null;
  56125. this.bookend = null;
  56126. this.border = null;
  56127. this.break = null;
  56128. this.calculate = null;
  56129. this.desc = null;
  56130. this.extras = null;
  56131. this.keep = null;
  56132. this.margin = null;
  56133. this.occur = null;
  56134. this.overflow = null;
  56135. this.pageSet = null;
  56136. this.para = null;
  56137. this.traversal = null;
  56138. this.validate = null;
  56139. this.variables = null;
  56140. this.area = new _xfa_object.XFAObjectArray();
  56141. this.breakAfter = new _xfa_object.XFAObjectArray();
  56142. this.breakBefore = new _xfa_object.XFAObjectArray();
  56143. this.connect = new _xfa_object.XFAObjectArray();
  56144. this.draw = new _xfa_object.XFAObjectArray();
  56145. this.event = new _xfa_object.XFAObjectArray();
  56146. this.exObject = new _xfa_object.XFAObjectArray();
  56147. this.exclGroup = new _xfa_object.XFAObjectArray();
  56148. this.field = new _xfa_object.XFAObjectArray();
  56149. this.proto = new _xfa_object.XFAObjectArray();
  56150. this.setProperty = new _xfa_object.XFAObjectArray();
  56151. this.subform = new _xfa_object.XFAObjectArray();
  56152. this.subformSet = new _xfa_object.XFAObjectArray();
  56153. }
  56154. [_xfa_object.$getSubformParent]() {
  56155. const parent = this[_xfa_object.$getParent]();
  56156. if (parent instanceof SubformSet) {
  56157. return parent[_xfa_object.$getSubformParent]();
  56158. }
  56159. return parent;
  56160. }
  56161. [_xfa_object.$isBindable]() {
  56162. return true;
  56163. }
  56164. [_xfa_object.$isThereMoreWidth]() {
  56165. return this.layout.endsWith("-tb") && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine > 0 || this[_xfa_object.$getParent]()[_xfa_object.$isThereMoreWidth]();
  56166. }
  56167. *[_xfa_object.$getContainedChildren]() {
  56168. yield* getContainedChildren(this);
  56169. }
  56170. [_xfa_object.$flushHTML]() {
  56171. return (0, _layout.flushHTML)(this);
  56172. }
  56173. [_xfa_object.$addHTML](html, bbox) {
  56174. (0, _layout.addHTML)(this, html, bbox);
  56175. }
  56176. [_xfa_object.$getAvailableSpace]() {
  56177. return (0, _layout.getAvailableSpace)(this);
  56178. }
  56179. [_xfa_object.$isSplittable]() {
  56180. const parent = this[_xfa_object.$getSubformParent]();
  56181. if (!parent[_xfa_object.$isSplittable]()) {
  56182. return false;
  56183. }
  56184. if (this[_xfa_object.$extra]._isSplittable !== undefined) {
  56185. return this[_xfa_object.$extra]._isSplittable;
  56186. }
  56187. if (this.layout === "position" || this.layout.includes("row")) {
  56188. this[_xfa_object.$extra]._isSplittable = false;
  56189. return false;
  56190. }
  56191. if (this.keep && this.keep.intact !== "none") {
  56192. this[_xfa_object.$extra]._isSplittable = false;
  56193. return false;
  56194. }
  56195. if (parent.layout && parent.layout.endsWith("-tb") && parent[_xfa_object.$extra].numberInLine !== 0) {
  56196. return false;
  56197. }
  56198. this[_xfa_object.$extra]._isSplittable = true;
  56199. return true;
  56200. }
  56201. [_xfa_object.$toHTML](availableSpace) {
  56202. setTabIndex(this);
  56203. if (this.break) {
  56204. if (this.break.after !== "auto" || this.break.afterTarget !== "") {
  56205. const node = new BreakAfter({
  56206. targetType: this.break.after,
  56207. target: this.break.afterTarget,
  56208. startNew: this.break.startNew.toString()
  56209. });
  56210. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56211. this[_xfa_object.$appendChild](node);
  56212. this.breakAfter.push(node);
  56213. }
  56214. if (this.break.before !== "auto" || this.break.beforeTarget !== "") {
  56215. const node = new BreakBefore({
  56216. targetType: this.break.before,
  56217. target: this.break.beforeTarget,
  56218. startNew: this.break.startNew.toString()
  56219. });
  56220. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56221. this[_xfa_object.$appendChild](node);
  56222. this.breakBefore.push(node);
  56223. }
  56224. if (this.break.overflowTarget !== "") {
  56225. const node = new Overflow({
  56226. target: this.break.overflowTarget,
  56227. leader: this.break.overflowLeader,
  56228. trailer: this.break.overflowTrailer
  56229. });
  56230. node[_xfa_object.$globalData] = this[_xfa_object.$globalData];
  56231. this[_xfa_object.$appendChild](node);
  56232. this.overflow.push(node);
  56233. }
  56234. this[_xfa_object.$removeChild](this.break);
  56235. this.break = null;
  56236. }
  56237. if (this.presence === "hidden" || this.presence === "inactive") {
  56238. return _utils.HTMLResult.EMPTY;
  56239. }
  56240. if (this.breakBefore.children.length > 1 || this.breakAfter.children.length > 1) {
  56241. (0, _util.warn)("XFA - Several breakBefore or breakAfter in subforms: please file a bug.");
  56242. }
  56243. if (this.breakBefore.children.length >= 1) {
  56244. const breakBefore = this.breakBefore.children[0];
  56245. if (handleBreak(breakBefore)) {
  56246. return _utils.HTMLResult.breakNode(breakBefore);
  56247. }
  56248. }
  56249. if (this[_xfa_object.$extra] && this[_xfa_object.$extra].afterBreakAfter) {
  56250. return _utils.HTMLResult.EMPTY;
  56251. }
  56252. (0, _html_utils.fixDimensions)(this);
  56253. const children = [];
  56254. const attributes = {
  56255. id: this[_xfa_object.$uid],
  56256. class: []
  56257. };
  56258. (0, _html_utils.setAccess)(this, attributes.class);
  56259. if (!this[_xfa_object.$extra]) {
  56260. this[_xfa_object.$extra] = Object.create(null);
  56261. }
  56262. Object.assign(this[_xfa_object.$extra], {
  56263. children,
  56264. line: null,
  56265. attributes,
  56266. attempt: 0,
  56267. numberInLine: 0,
  56268. availableSpace: {
  56269. width: Math.min(this.w || Infinity, availableSpace.width),
  56270. height: Math.min(this.h || Infinity, availableSpace.height)
  56271. },
  56272. width: 0,
  56273. height: 0,
  56274. prevHeight: 0,
  56275. currentWidth: 0
  56276. });
  56277. const root = this[_xfa_object.$getTemplateRoot]();
  56278. const savedNoLayoutFailure = root[_xfa_object.$extra].noLayoutFailure;
  56279. const isSplittable = this[_xfa_object.$isSplittable]();
  56280. if (!isSplittable) {
  56281. setFirstUnsplittable(this);
  56282. }
  56283. if (!(0, _layout.checkDimensions)(this, availableSpace)) {
  56284. return _utils.HTMLResult.FAILURE;
  56285. }
  56286. const filter = new Set(["area", "draw", "exclGroup", "field", "subform", "subformSet"]);
  56287. if (this.layout.includes("row")) {
  56288. const columnWidths = this[_xfa_object.$getSubformParent]().columnWidths;
  56289. if (Array.isArray(columnWidths) && columnWidths.length > 0) {
  56290. this[_xfa_object.$extra].columnWidths = columnWidths;
  56291. this[_xfa_object.$extra].currentColumn = 0;
  56292. }
  56293. }
  56294. const style = (0, _html_utils.toStyle)(this, "anchorType", "dimensions", "position", "presence", "border", "margin", "hAlign");
  56295. const classNames = ["xfaSubform"];
  56296. const cl = (0, _html_utils.layoutClass)(this);
  56297. if (cl) {
  56298. classNames.push(cl);
  56299. }
  56300. attributes.style = style;
  56301. attributes.class = classNames;
  56302. if (this.name) {
  56303. attributes.xfaName = this.name;
  56304. }
  56305. if (this.overflow) {
  56306. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  56307. if (overflowExtra.addLeader) {
  56308. overflowExtra.addLeader = false;
  56309. handleOverflow(this, overflowExtra.leader, availableSpace);
  56310. }
  56311. }
  56312. this[_xfa_object.$pushPara]();
  56313. const isLrTb = this.layout === "lr-tb" || this.layout === "rl-tb";
  56314. const maxRun = isLrTb ? MAX_ATTEMPTS_FOR_LRTB_LAYOUT : 1;
  56315. for (; this[_xfa_object.$extra].attempt < maxRun; this[_xfa_object.$extra].attempt++) {
  56316. if (isLrTb && this[_xfa_object.$extra].attempt === MAX_ATTEMPTS_FOR_LRTB_LAYOUT - 1) {
  56317. this[_xfa_object.$extra].numberInLine = 0;
  56318. }
  56319. const result = this[_xfa_object.$childrenToHTML]({
  56320. filter,
  56321. include: true
  56322. });
  56323. if (result.success) {
  56324. break;
  56325. }
  56326. if (result.isBreak()) {
  56327. this[_xfa_object.$popPara]();
  56328. return result;
  56329. }
  56330. if (isLrTb && this[_xfa_object.$extra].attempt === 0 && this[_xfa_object.$extra].numberInLine === 0 && !root[_xfa_object.$extra].noLayoutFailure) {
  56331. this[_xfa_object.$extra].attempt = maxRun;
  56332. break;
  56333. }
  56334. }
  56335. this[_xfa_object.$popPara]();
  56336. if (!isSplittable) {
  56337. unsetFirstUnsplittable(this);
  56338. }
  56339. root[_xfa_object.$extra].noLayoutFailure = savedNoLayoutFailure;
  56340. if (this[_xfa_object.$extra].attempt === maxRun) {
  56341. if (this.overflow) {
  56342. this[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].overflowNode = this.overflow;
  56343. }
  56344. if (!isSplittable) {
  56345. delete this[_xfa_object.$extra];
  56346. }
  56347. return _utils.HTMLResult.FAILURE;
  56348. }
  56349. if (this.overflow) {
  56350. const overflowExtra = this.overflow[_xfa_object.$getExtra]();
  56351. if (overflowExtra.addTrailer) {
  56352. overflowExtra.addTrailer = false;
  56353. handleOverflow(this, overflowExtra.trailer, availableSpace);
  56354. }
  56355. }
  56356. let marginH = 0;
  56357. let marginV = 0;
  56358. if (this.margin) {
  56359. marginH = this.margin.leftInset + this.margin.rightInset;
  56360. marginV = this.margin.topInset + this.margin.bottomInset;
  56361. }
  56362. const width = Math.max(this[_xfa_object.$extra].width + marginH, this.w || 0);
  56363. const height = Math.max(this[_xfa_object.$extra].height + marginV, this.h || 0);
  56364. const bbox = [this.x, this.y, width, height];
  56365. if (this.w === "") {
  56366. style.width = (0, _html_utils.measureToString)(width);
  56367. }
  56368. if (this.h === "") {
  56369. style.height = (0, _html_utils.measureToString)(height);
  56370. }
  56371. if ((style.width === "0px" || style.height === "0px") && children.length === 0) {
  56372. return _utils.HTMLResult.EMPTY;
  56373. }
  56374. const html = {
  56375. name: "div",
  56376. attributes,
  56377. children
  56378. };
  56379. applyAssist(this, attributes);
  56380. const result = _utils.HTMLResult.success((0, _html_utils.createWrapper)(this, html), bbox);
  56381. if (this.breakAfter.children.length >= 1) {
  56382. const breakAfter = this.breakAfter.children[0];
  56383. if (handleBreak(breakAfter)) {
  56384. this[_xfa_object.$extra].afterBreakAfter = result;
  56385. return _utils.HTMLResult.breakNode(breakAfter);
  56386. }
  56387. }
  56388. delete this[_xfa_object.$extra];
  56389. return result;
  56390. }
  56391. }
  56392. class SubformSet extends _xfa_object.XFAObject {
  56393. constructor(attributes) {
  56394. super(TEMPLATE_NS_ID, "subformSet", true);
  56395. this.id = attributes.id || "";
  56396. this.name = attributes.name || "";
  56397. this.relation = (0, _utils.getStringOption)(attributes.relation, ["ordered", "choice", "unordered"]);
  56398. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56399. this.use = attributes.use || "";
  56400. this.usehref = attributes.usehref || "";
  56401. this.bookend = null;
  56402. this.break = null;
  56403. this.desc = null;
  56404. this.extras = null;
  56405. this.occur = null;
  56406. this.overflow = null;
  56407. this.breakAfter = new _xfa_object.XFAObjectArray();
  56408. this.breakBefore = new _xfa_object.XFAObjectArray();
  56409. this.subform = new _xfa_object.XFAObjectArray();
  56410. this.subformSet = new _xfa_object.XFAObjectArray();
  56411. }
  56412. *[_xfa_object.$getContainedChildren]() {
  56413. yield* getContainedChildren(this);
  56414. }
  56415. [_xfa_object.$getSubformParent]() {
  56416. let parent = this[_xfa_object.$getParent]();
  56417. while (!(parent instanceof Subform)) {
  56418. parent = parent[_xfa_object.$getParent]();
  56419. }
  56420. return parent;
  56421. }
  56422. [_xfa_object.$isBindable]() {
  56423. return true;
  56424. }
  56425. }
  56426. class SubjectDN extends _xfa_object.ContentObject {
  56427. constructor(attributes) {
  56428. super(TEMPLATE_NS_ID, "subjectDN");
  56429. this.delimiter = attributes.delimiter || ",";
  56430. this.id = attributes.id || "";
  56431. this.name = attributes.name || "";
  56432. this.use = attributes.use || "";
  56433. this.usehref = attributes.usehref || "";
  56434. }
  56435. [_xfa_object.$finalize]() {
  56436. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].split(this.delimiter).map(kv => {
  56437. kv = kv.split("=", 2);
  56438. kv[0] = kv[0].trim();
  56439. return kv;
  56440. }));
  56441. }
  56442. }
  56443. class SubjectDNs extends _xfa_object.XFAObject {
  56444. constructor(attributes) {
  56445. super(TEMPLATE_NS_ID, "subjectDNs", true);
  56446. this.id = attributes.id || "";
  56447. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56448. this.use = attributes.use || "";
  56449. this.usehref = attributes.usehref || "";
  56450. this.subjectDN = new _xfa_object.XFAObjectArray();
  56451. }
  56452. }
  56453. class Submit extends _xfa_object.XFAObject {
  56454. constructor(attributes) {
  56455. super(TEMPLATE_NS_ID, "submit", true);
  56456. this.embedPDF = (0, _utils.getInteger)({
  56457. data: attributes.embedPDF,
  56458. defaultValue: 0,
  56459. validate: x => x === 1
  56460. });
  56461. this.format = (0, _utils.getStringOption)(attributes.format, ["xdp", "formdata", "pdf", "urlencoded", "xfd", "xml"]);
  56462. this.id = attributes.id || "";
  56463. this.target = attributes.target || "";
  56464. this.textEncoding = (0, _utils.getKeyword)({
  56465. data: attributes.textEncoding ? attributes.textEncoding.toLowerCase() : "",
  56466. defaultValue: "",
  56467. 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}/)
  56468. });
  56469. this.use = attributes.use || "";
  56470. this.usehref = attributes.usehref || "";
  56471. this.xdpContent = attributes.xdpContent || "";
  56472. this.encrypt = null;
  56473. this.encryptData = new _xfa_object.XFAObjectArray();
  56474. this.signData = new _xfa_object.XFAObjectArray();
  56475. }
  56476. }
  56477. class Template extends _xfa_object.XFAObject {
  56478. constructor(attributes) {
  56479. super(TEMPLATE_NS_ID, "template", true);
  56480. this.baseProfile = (0, _utils.getStringOption)(attributes.baseProfile, ["full", "interactiveForms"]);
  56481. this.extras = null;
  56482. this.subform = new _xfa_object.XFAObjectArray();
  56483. }
  56484. [_xfa_object.$finalize]() {
  56485. if (this.subform.children.length === 0) {
  56486. (0, _util.warn)("XFA - No subforms in template node.");
  56487. }
  56488. if (this.subform.children.length >= 2) {
  56489. (0, _util.warn)("XFA - Several subforms in template node: please file a bug.");
  56490. }
  56491. this[_xfa_object.$tabIndex] = DEFAULT_TAB_INDEX;
  56492. }
  56493. [_xfa_object.$isSplittable]() {
  56494. return true;
  56495. }
  56496. [_xfa_object.$searchNode](expr, container) {
  56497. if (expr.startsWith("#")) {
  56498. return [this[_xfa_object.$ids].get(expr.slice(1))];
  56499. }
  56500. return (0, _som.searchNode)(this, container, expr, true, true);
  56501. }
  56502. *[_xfa_object.$toPages]() {
  56503. if (!this.subform.children.length) {
  56504. return _utils.HTMLResult.success({
  56505. name: "div",
  56506. children: []
  56507. });
  56508. }
  56509. this[_xfa_object.$extra] = {
  56510. overflowNode: null,
  56511. firstUnsplittable: null,
  56512. currentContentArea: null,
  56513. currentPageArea: null,
  56514. noLayoutFailure: false,
  56515. pageNumber: 1,
  56516. pagePosition: "first",
  56517. oddOrEven: "odd",
  56518. blankOrNotBlank: "nonBlank",
  56519. paraStack: []
  56520. };
  56521. const root = this.subform.children[0];
  56522. root.pageSet[_xfa_object.$cleanPage]();
  56523. const pageAreas = root.pageSet.pageArea.children;
  56524. const mainHtml = {
  56525. name: "div",
  56526. children: []
  56527. };
  56528. let pageArea = null;
  56529. let breakBefore = null;
  56530. let breakBeforeTarget = null;
  56531. if (root.breakBefore.children.length >= 1) {
  56532. breakBefore = root.breakBefore.children[0];
  56533. breakBeforeTarget = breakBefore.target;
  56534. } else if (root.subform.children.length >= 1 && root.subform.children[0].breakBefore.children.length >= 1) {
  56535. breakBefore = root.subform.children[0].breakBefore.children[0];
  56536. breakBeforeTarget = breakBefore.target;
  56537. } else if (root.break && root.break.beforeTarget) {
  56538. breakBefore = root.break;
  56539. breakBeforeTarget = breakBefore.beforeTarget;
  56540. } else if (root.subform.children.length >= 1 && root.subform.children[0].break && root.subform.children[0].break.beforeTarget) {
  56541. breakBefore = root.subform.children[0].break;
  56542. breakBeforeTarget = breakBefore.beforeTarget;
  56543. }
  56544. if (breakBefore) {
  56545. const target = this[_xfa_object.$searchNode](breakBeforeTarget, breakBefore[_xfa_object.$getParent]());
  56546. if (target instanceof PageArea) {
  56547. pageArea = target;
  56548. breakBefore[_xfa_object.$extra] = {};
  56549. }
  56550. }
  56551. if (!pageArea) {
  56552. pageArea = pageAreas[0];
  56553. }
  56554. pageArea[_xfa_object.$extra] = {
  56555. numberOfUse: 1
  56556. };
  56557. const pageAreaParent = pageArea[_xfa_object.$getParent]();
  56558. pageAreaParent[_xfa_object.$extra] = {
  56559. numberOfUse: 1,
  56560. pageIndex: pageAreaParent.pageArea.children.indexOf(pageArea),
  56561. pageSetIndex: 0
  56562. };
  56563. let targetPageArea;
  56564. let leader = null;
  56565. let trailer = null;
  56566. let hasSomething = true;
  56567. let hasSomethingCounter = 0;
  56568. let startIndex = 0;
  56569. while (true) {
  56570. if (!hasSomething) {
  56571. mainHtml.children.pop();
  56572. if (++hasSomethingCounter === MAX_EMPTY_PAGES) {
  56573. (0, _util.warn)("XFA - Something goes wrong: please file a bug.");
  56574. return mainHtml;
  56575. }
  56576. } else {
  56577. hasSomethingCounter = 0;
  56578. }
  56579. targetPageArea = null;
  56580. this[_xfa_object.$extra].currentPageArea = pageArea;
  56581. const page = pageArea[_xfa_object.$toHTML]().html;
  56582. mainHtml.children.push(page);
  56583. if (leader) {
  56584. this[_xfa_object.$extra].noLayoutFailure = true;
  56585. page.children.push(leader[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  56586. leader = null;
  56587. }
  56588. if (trailer) {
  56589. this[_xfa_object.$extra].noLayoutFailure = true;
  56590. page.children.push(trailer[_xfa_object.$toHTML](pageArea[_xfa_object.$extra].space).html);
  56591. trailer = null;
  56592. }
  56593. const contentAreas = pageArea.contentArea.children;
  56594. const htmlContentAreas = page.children.filter(node => node.attributes.class.includes("xfaContentarea"));
  56595. hasSomething = false;
  56596. this[_xfa_object.$extra].firstUnsplittable = null;
  56597. this[_xfa_object.$extra].noLayoutFailure = false;
  56598. const flush = index => {
  56599. const html = root[_xfa_object.$flushHTML]();
  56600. if (html) {
  56601. hasSomething = hasSomething || html.children && html.children.length !== 0;
  56602. htmlContentAreas[index].children.push(html);
  56603. }
  56604. };
  56605. for (let i = startIndex, ii = contentAreas.length; i < ii; i++) {
  56606. const contentArea = this[_xfa_object.$extra].currentContentArea = contentAreas[i];
  56607. const space = {
  56608. width: contentArea.w,
  56609. height: contentArea.h
  56610. };
  56611. startIndex = 0;
  56612. if (leader) {
  56613. htmlContentAreas[i].children.push(leader[_xfa_object.$toHTML](space).html);
  56614. leader = null;
  56615. }
  56616. if (trailer) {
  56617. htmlContentAreas[i].children.push(trailer[_xfa_object.$toHTML](space).html);
  56618. trailer = null;
  56619. }
  56620. const html = root[_xfa_object.$toHTML](space);
  56621. if (html.success) {
  56622. if (html.html) {
  56623. hasSomething = hasSomething || html.html.children && html.html.children.length !== 0;
  56624. htmlContentAreas[i].children.push(html.html);
  56625. } else if (!hasSomething && mainHtml.children.length > 1) {
  56626. mainHtml.children.pop();
  56627. }
  56628. return mainHtml;
  56629. }
  56630. if (html.isBreak()) {
  56631. const node = html.breakNode;
  56632. flush(i);
  56633. if (node.targetType === "auto") {
  56634. continue;
  56635. }
  56636. if (node.leader) {
  56637. leader = this[_xfa_object.$searchNode](node.leader, node[_xfa_object.$getParent]());
  56638. leader = leader ? leader[0] : null;
  56639. }
  56640. if (node.trailer) {
  56641. trailer = this[_xfa_object.$searchNode](node.trailer, node[_xfa_object.$getParent]());
  56642. trailer = trailer ? trailer[0] : null;
  56643. }
  56644. if (node.targetType === "pageArea") {
  56645. targetPageArea = node[_xfa_object.$extra].target;
  56646. i = Infinity;
  56647. } else if (!node[_xfa_object.$extra].target) {
  56648. i = node[_xfa_object.$extra].index;
  56649. } else {
  56650. targetPageArea = node[_xfa_object.$extra].target;
  56651. startIndex = node[_xfa_object.$extra].index + 1;
  56652. i = Infinity;
  56653. }
  56654. continue;
  56655. }
  56656. if (this[_xfa_object.$extra].overflowNode) {
  56657. const node = this[_xfa_object.$extra].overflowNode;
  56658. this[_xfa_object.$extra].overflowNode = null;
  56659. const overflowExtra = node[_xfa_object.$getExtra]();
  56660. const target = overflowExtra.target;
  56661. overflowExtra.addLeader = overflowExtra.leader !== null;
  56662. overflowExtra.addTrailer = overflowExtra.trailer !== null;
  56663. flush(i);
  56664. const currentIndex = i;
  56665. i = Infinity;
  56666. if (target instanceof PageArea) {
  56667. targetPageArea = target;
  56668. } else if (target instanceof ContentArea) {
  56669. const index = contentAreas.findIndex(e => e === target);
  56670. if (index !== -1) {
  56671. if (index > currentIndex) {
  56672. i = index - 1;
  56673. } else {
  56674. startIndex = index;
  56675. }
  56676. } else {
  56677. targetPageArea = target[_xfa_object.$getParent]();
  56678. startIndex = targetPageArea.contentArea.children.findIndex(e => e === target);
  56679. }
  56680. }
  56681. continue;
  56682. }
  56683. flush(i);
  56684. }
  56685. this[_xfa_object.$extra].pageNumber += 1;
  56686. if (targetPageArea) {
  56687. if (targetPageArea[_xfa_object.$isUsable]()) {
  56688. targetPageArea[_xfa_object.$extra].numberOfUse += 1;
  56689. } else {
  56690. targetPageArea = null;
  56691. }
  56692. }
  56693. pageArea = targetPageArea || pageArea[_xfa_object.$getNextPage]();
  56694. yield null;
  56695. }
  56696. }
  56697. }
  56698. exports.Template = Template;
  56699. class Text extends _xfa_object.ContentObject {
  56700. constructor(attributes) {
  56701. super(TEMPLATE_NS_ID, "text");
  56702. this.id = attributes.id || "";
  56703. this.maxChars = (0, _utils.getInteger)({
  56704. data: attributes.maxChars,
  56705. defaultValue: 0,
  56706. validate: x => x >= 0
  56707. });
  56708. this.name = attributes.name || "";
  56709. this.rid = attributes.rid || "";
  56710. this.use = attributes.use || "";
  56711. this.usehref = attributes.usehref || "";
  56712. }
  56713. [_xfa_object.$acceptWhitespace]() {
  56714. return true;
  56715. }
  56716. [_xfa_object.$onChild](child) {
  56717. if (child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.xhtml.id) {
  56718. this[_xfa_object.$content] = child;
  56719. return true;
  56720. }
  56721. (0, _util.warn)(`XFA - Invalid content in Text: ${child[_xfa_object.$nodeName]}.`);
  56722. return false;
  56723. }
  56724. [_xfa_object.$onText](str) {
  56725. if (this[_xfa_object.$content] instanceof _xfa_object.XFAObject) {
  56726. return;
  56727. }
  56728. super[_xfa_object.$onText](str);
  56729. }
  56730. [_xfa_object.$finalize]() {
  56731. if (typeof this[_xfa_object.$content] === "string") {
  56732. this[_xfa_object.$content] = this[_xfa_object.$content].replace(/\r\n/g, "\n");
  56733. }
  56734. }
  56735. [_xfa_object.$getExtra]() {
  56736. if (typeof this[_xfa_object.$content] === "string") {
  56737. return this[_xfa_object.$content].split(/[\u2029\u2028\n]/).reduce((acc, line) => {
  56738. if (line) {
  56739. acc.push(line);
  56740. }
  56741. return acc;
  56742. }, []).join("\n");
  56743. }
  56744. return this[_xfa_object.$content][_xfa_object.$text]();
  56745. }
  56746. [_xfa_object.$toHTML](availableSpace) {
  56747. if (typeof this[_xfa_object.$content] === "string") {
  56748. const html = valueToHtml(this[_xfa_object.$content]).html;
  56749. if (this[_xfa_object.$content].includes("\u2029")) {
  56750. html.name = "div";
  56751. html.children = [];
  56752. this[_xfa_object.$content].split("\u2029").map(para => para.split(/[\u2028\n]/).reduce((acc, line) => {
  56753. acc.push({
  56754. name: "span",
  56755. value: line
  56756. }, {
  56757. name: "br"
  56758. });
  56759. return acc;
  56760. }, [])).forEach(lines => {
  56761. html.children.push({
  56762. name: "p",
  56763. children: lines
  56764. });
  56765. });
  56766. } else if (/[\u2028\n]/.test(this[_xfa_object.$content])) {
  56767. html.name = "div";
  56768. html.children = [];
  56769. this[_xfa_object.$content].split(/[\u2028\n]/).forEach(line => {
  56770. html.children.push({
  56771. name: "span",
  56772. value: line
  56773. }, {
  56774. name: "br"
  56775. });
  56776. });
  56777. }
  56778. return _utils.HTMLResult.success(html);
  56779. }
  56780. return this[_xfa_object.$content][_xfa_object.$toHTML](availableSpace);
  56781. }
  56782. }
  56783. exports.Text = Text;
  56784. class TextEdit extends _xfa_object.XFAObject {
  56785. constructor(attributes) {
  56786. super(TEMPLATE_NS_ID, "textEdit", true);
  56787. this.allowRichText = (0, _utils.getInteger)({
  56788. data: attributes.allowRichText,
  56789. defaultValue: 0,
  56790. validate: x => x === 1
  56791. });
  56792. this.hScrollPolicy = (0, _utils.getStringOption)(attributes.hScrollPolicy, ["auto", "off", "on"]);
  56793. this.id = attributes.id || "";
  56794. this.multiLine = (0, _utils.getInteger)({
  56795. data: attributes.multiLine,
  56796. defaultValue: "",
  56797. validate: x => x === 0 || x === 1
  56798. });
  56799. this.use = attributes.use || "";
  56800. this.usehref = attributes.usehref || "";
  56801. this.vScrollPolicy = (0, _utils.getStringOption)(attributes.vScrollPolicy, ["auto", "off", "on"]);
  56802. this.border = null;
  56803. this.comb = null;
  56804. this.extras = null;
  56805. this.margin = null;
  56806. }
  56807. [_xfa_object.$toHTML](availableSpace) {
  56808. const style = (0, _html_utils.toStyle)(this, "border", "font", "margin");
  56809. let html;
  56810. const field = this[_xfa_object.$getParent]()[_xfa_object.$getParent]();
  56811. if (this.multiLine === "") {
  56812. this.multiLine = field instanceof Draw ? 1 : 0;
  56813. }
  56814. if (this.multiLine === 1) {
  56815. html = {
  56816. name: "textarea",
  56817. attributes: {
  56818. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56819. fieldId: field[_xfa_object.$uid],
  56820. class: ["xfaTextfield"],
  56821. style,
  56822. "aria-label": ariaLabel(field)
  56823. }
  56824. };
  56825. } else {
  56826. html = {
  56827. name: "input",
  56828. attributes: {
  56829. type: "text",
  56830. dataId: field[_xfa_object.$data] && field[_xfa_object.$data][_xfa_object.$uid] || field[_xfa_object.$uid],
  56831. fieldId: field[_xfa_object.$uid],
  56832. class: ["xfaTextfield"],
  56833. style,
  56834. "aria-label": ariaLabel(field)
  56835. }
  56836. };
  56837. }
  56838. return _utils.HTMLResult.success({
  56839. name: "label",
  56840. attributes: {
  56841. class: ["xfaLabel"]
  56842. },
  56843. children: [html]
  56844. });
  56845. }
  56846. }
  56847. class Time extends _xfa_object.StringObject {
  56848. constructor(attributes) {
  56849. super(TEMPLATE_NS_ID, "time");
  56850. this.id = attributes.id || "";
  56851. this.name = attributes.name || "";
  56852. this.use = attributes.use || "";
  56853. this.usehref = attributes.usehref || "";
  56854. }
  56855. [_xfa_object.$finalize]() {
  56856. const date = this[_xfa_object.$content].trim();
  56857. this[_xfa_object.$content] = date ? new Date(date) : null;
  56858. }
  56859. [_xfa_object.$toHTML](availableSpace) {
  56860. return valueToHtml(this[_xfa_object.$content] ? this[_xfa_object.$content].toString() : "");
  56861. }
  56862. }
  56863. class TimeStamp extends _xfa_object.XFAObject {
  56864. constructor(attributes) {
  56865. super(TEMPLATE_NS_ID, "timeStamp");
  56866. this.id = attributes.id || "";
  56867. this.server = attributes.server || "";
  56868. this.type = (0, _utils.getStringOption)(attributes.type, ["optional", "required"]);
  56869. this.use = attributes.use || "";
  56870. this.usehref = attributes.usehref || "";
  56871. }
  56872. }
  56873. class ToolTip extends _xfa_object.StringObject {
  56874. constructor(attributes) {
  56875. super(TEMPLATE_NS_ID, "toolTip");
  56876. this.id = attributes.id || "";
  56877. this.rid = attributes.rid || "";
  56878. this.use = attributes.use || "";
  56879. this.usehref = attributes.usehref || "";
  56880. }
  56881. }
  56882. class Traversal extends _xfa_object.XFAObject {
  56883. constructor(attributes) {
  56884. super(TEMPLATE_NS_ID, "traversal", true);
  56885. this.id = attributes.id || "";
  56886. this.use = attributes.use || "";
  56887. this.usehref = attributes.usehref || "";
  56888. this.extras = null;
  56889. this.traverse = new _xfa_object.XFAObjectArray();
  56890. }
  56891. }
  56892. class Traverse extends _xfa_object.XFAObject {
  56893. constructor(attributes) {
  56894. super(TEMPLATE_NS_ID, "traverse", true);
  56895. this.id = attributes.id || "";
  56896. this.operation = (0, _utils.getStringOption)(attributes.operation, ["next", "back", "down", "first", "left", "right", "up"]);
  56897. this.ref = attributes.ref || "";
  56898. this.use = attributes.use || "";
  56899. this.usehref = attributes.usehref || "";
  56900. this.extras = null;
  56901. this.script = null;
  56902. }
  56903. get name() {
  56904. return this.operation;
  56905. }
  56906. [_xfa_object.$isTransparent]() {
  56907. return false;
  56908. }
  56909. }
  56910. class Ui extends _xfa_object.XFAObject {
  56911. constructor(attributes) {
  56912. super(TEMPLATE_NS_ID, "ui", true);
  56913. this.id = attributes.id || "";
  56914. this.use = attributes.use || "";
  56915. this.usehref = attributes.usehref || "";
  56916. this.extras = null;
  56917. this.picture = null;
  56918. this.barcode = null;
  56919. this.button = null;
  56920. this.checkButton = null;
  56921. this.choiceList = null;
  56922. this.dateTimeEdit = null;
  56923. this.defaultUi = null;
  56924. this.imageEdit = null;
  56925. this.numericEdit = null;
  56926. this.passwordEdit = null;
  56927. this.signature = null;
  56928. this.textEdit = null;
  56929. }
  56930. [_xfa_object.$getExtra]() {
  56931. if (this[_xfa_object.$extra] === undefined) {
  56932. for (const name of Object.getOwnPropertyNames(this)) {
  56933. if (name === "extras" || name === "picture") {
  56934. continue;
  56935. }
  56936. const obj = this[name];
  56937. if (!(obj instanceof _xfa_object.XFAObject)) {
  56938. continue;
  56939. }
  56940. this[_xfa_object.$extra] = obj;
  56941. return obj;
  56942. }
  56943. this[_xfa_object.$extra] = null;
  56944. }
  56945. return this[_xfa_object.$extra];
  56946. }
  56947. [_xfa_object.$toHTML](availableSpace) {
  56948. const obj = this[_xfa_object.$getExtra]();
  56949. if (obj) {
  56950. return obj[_xfa_object.$toHTML](availableSpace);
  56951. }
  56952. return _utils.HTMLResult.EMPTY;
  56953. }
  56954. }
  56955. class Validate extends _xfa_object.XFAObject {
  56956. constructor(attributes) {
  56957. super(TEMPLATE_NS_ID, "validate", true);
  56958. this.formatTest = (0, _utils.getStringOption)(attributes.formatTest, ["warning", "disabled", "error"]);
  56959. this.id = attributes.id || "";
  56960. this.nullTest = (0, _utils.getStringOption)(attributes.nullTest, ["disabled", "error", "warning"]);
  56961. this.scriptTest = (0, _utils.getStringOption)(attributes.scriptTest, ["error", "disabled", "warning"]);
  56962. this.use = attributes.use || "";
  56963. this.usehref = attributes.usehref || "";
  56964. this.extras = null;
  56965. this.message = null;
  56966. this.picture = null;
  56967. this.script = null;
  56968. }
  56969. }
  56970. class Value extends _xfa_object.XFAObject {
  56971. constructor(attributes) {
  56972. super(TEMPLATE_NS_ID, "value", true);
  56973. this.id = attributes.id || "";
  56974. this.override = (0, _utils.getInteger)({
  56975. data: attributes.override,
  56976. defaultValue: 0,
  56977. validate: x => x === 1
  56978. });
  56979. this.relevant = (0, _utils.getRelevant)(attributes.relevant);
  56980. this.use = attributes.use || "";
  56981. this.usehref = attributes.usehref || "";
  56982. this.arc = null;
  56983. this.boolean = null;
  56984. this.date = null;
  56985. this.dateTime = null;
  56986. this.decimal = null;
  56987. this.exData = null;
  56988. this.float = null;
  56989. this.image = null;
  56990. this.integer = null;
  56991. this.line = null;
  56992. this.rectangle = null;
  56993. this.text = null;
  56994. this.time = null;
  56995. }
  56996. [_xfa_object.$setValue](value) {
  56997. const parent = this[_xfa_object.$getParent]();
  56998. if (parent instanceof Field) {
  56999. if (parent.ui && parent.ui.imageEdit) {
  57000. if (!this.image) {
  57001. this.image = new Image({});
  57002. this[_xfa_object.$appendChild](this.image);
  57003. }
  57004. this.image[_xfa_object.$content] = value[_xfa_object.$content];
  57005. return;
  57006. }
  57007. }
  57008. const valueName = value[_xfa_object.$nodeName];
  57009. if (this[valueName] !== null) {
  57010. this[valueName][_xfa_object.$content] = value[_xfa_object.$content];
  57011. return;
  57012. }
  57013. for (const name of Object.getOwnPropertyNames(this)) {
  57014. const obj = this[name];
  57015. if (obj instanceof _xfa_object.XFAObject) {
  57016. this[name] = null;
  57017. this[_xfa_object.$removeChild](obj);
  57018. }
  57019. }
  57020. this[value[_xfa_object.$nodeName]] = value;
  57021. this[_xfa_object.$appendChild](value);
  57022. }
  57023. [_xfa_object.$text]() {
  57024. if (this.exData) {
  57025. if (typeof this.exData[_xfa_object.$content] === "string") {
  57026. return this.exData[_xfa_object.$content].trim();
  57027. }
  57028. return this.exData[_xfa_object.$content][_xfa_object.$text]().trim();
  57029. }
  57030. for (const name of Object.getOwnPropertyNames(this)) {
  57031. if (name === "image") {
  57032. continue;
  57033. }
  57034. const obj = this[name];
  57035. if (obj instanceof _xfa_object.XFAObject) {
  57036. return (obj[_xfa_object.$content] || "").toString().trim();
  57037. }
  57038. }
  57039. return null;
  57040. }
  57041. [_xfa_object.$toHTML](availableSpace) {
  57042. for (const name of Object.getOwnPropertyNames(this)) {
  57043. const obj = this[name];
  57044. if (!(obj instanceof _xfa_object.XFAObject)) {
  57045. continue;
  57046. }
  57047. return obj[_xfa_object.$toHTML](availableSpace);
  57048. }
  57049. return _utils.HTMLResult.EMPTY;
  57050. }
  57051. }
  57052. exports.Value = Value;
  57053. class Variables extends _xfa_object.XFAObject {
  57054. constructor(attributes) {
  57055. super(TEMPLATE_NS_ID, "variables", true);
  57056. this.id = attributes.id || "";
  57057. this.use = attributes.use || "";
  57058. this.usehref = attributes.usehref || "";
  57059. this.boolean = new _xfa_object.XFAObjectArray();
  57060. this.date = new _xfa_object.XFAObjectArray();
  57061. this.dateTime = new _xfa_object.XFAObjectArray();
  57062. this.decimal = new _xfa_object.XFAObjectArray();
  57063. this.exData = new _xfa_object.XFAObjectArray();
  57064. this.float = new _xfa_object.XFAObjectArray();
  57065. this.image = new _xfa_object.XFAObjectArray();
  57066. this.integer = new _xfa_object.XFAObjectArray();
  57067. this.manifest = new _xfa_object.XFAObjectArray();
  57068. this.script = new _xfa_object.XFAObjectArray();
  57069. this.text = new _xfa_object.XFAObjectArray();
  57070. this.time = new _xfa_object.XFAObjectArray();
  57071. }
  57072. [_xfa_object.$isTransparent]() {
  57073. return true;
  57074. }
  57075. }
  57076. class TemplateNamespace {
  57077. static [_namespaces.$buildXFAObject](name, attributes) {
  57078. if (TemplateNamespace.hasOwnProperty(name)) {
  57079. const node = TemplateNamespace[name](attributes);
  57080. node[_xfa_object.$setSetAttributes](attributes);
  57081. return node;
  57082. }
  57083. return undefined;
  57084. }
  57085. static appearanceFilter(attrs) {
  57086. return new AppearanceFilter(attrs);
  57087. }
  57088. static arc(attrs) {
  57089. return new Arc(attrs);
  57090. }
  57091. static area(attrs) {
  57092. return new Area(attrs);
  57093. }
  57094. static assist(attrs) {
  57095. return new Assist(attrs);
  57096. }
  57097. static barcode(attrs) {
  57098. return new Barcode(attrs);
  57099. }
  57100. static bind(attrs) {
  57101. return new Bind(attrs);
  57102. }
  57103. static bindItems(attrs) {
  57104. return new BindItems(attrs);
  57105. }
  57106. static bookend(attrs) {
  57107. return new Bookend(attrs);
  57108. }
  57109. static boolean(attrs) {
  57110. return new BooleanElement(attrs);
  57111. }
  57112. static border(attrs) {
  57113. return new Border(attrs);
  57114. }
  57115. static break(attrs) {
  57116. return new Break(attrs);
  57117. }
  57118. static breakAfter(attrs) {
  57119. return new BreakAfter(attrs);
  57120. }
  57121. static breakBefore(attrs) {
  57122. return new BreakBefore(attrs);
  57123. }
  57124. static button(attrs) {
  57125. return new Button(attrs);
  57126. }
  57127. static calculate(attrs) {
  57128. return new Calculate(attrs);
  57129. }
  57130. static caption(attrs) {
  57131. return new Caption(attrs);
  57132. }
  57133. static certificate(attrs) {
  57134. return new Certificate(attrs);
  57135. }
  57136. static certificates(attrs) {
  57137. return new Certificates(attrs);
  57138. }
  57139. static checkButton(attrs) {
  57140. return new CheckButton(attrs);
  57141. }
  57142. static choiceList(attrs) {
  57143. return new ChoiceList(attrs);
  57144. }
  57145. static color(attrs) {
  57146. return new Color(attrs);
  57147. }
  57148. static comb(attrs) {
  57149. return new Comb(attrs);
  57150. }
  57151. static connect(attrs) {
  57152. return new Connect(attrs);
  57153. }
  57154. static contentArea(attrs) {
  57155. return new ContentArea(attrs);
  57156. }
  57157. static corner(attrs) {
  57158. return new Corner(attrs);
  57159. }
  57160. static date(attrs) {
  57161. return new DateElement(attrs);
  57162. }
  57163. static dateTime(attrs) {
  57164. return new DateTime(attrs);
  57165. }
  57166. static dateTimeEdit(attrs) {
  57167. return new DateTimeEdit(attrs);
  57168. }
  57169. static decimal(attrs) {
  57170. return new Decimal(attrs);
  57171. }
  57172. static defaultUi(attrs) {
  57173. return new DefaultUi(attrs);
  57174. }
  57175. static desc(attrs) {
  57176. return new Desc(attrs);
  57177. }
  57178. static digestMethod(attrs) {
  57179. return new DigestMethod(attrs);
  57180. }
  57181. static digestMethods(attrs) {
  57182. return new DigestMethods(attrs);
  57183. }
  57184. static draw(attrs) {
  57185. return new Draw(attrs);
  57186. }
  57187. static edge(attrs) {
  57188. return new Edge(attrs);
  57189. }
  57190. static encoding(attrs) {
  57191. return new Encoding(attrs);
  57192. }
  57193. static encodings(attrs) {
  57194. return new Encodings(attrs);
  57195. }
  57196. static encrypt(attrs) {
  57197. return new Encrypt(attrs);
  57198. }
  57199. static encryptData(attrs) {
  57200. return new EncryptData(attrs);
  57201. }
  57202. static encryption(attrs) {
  57203. return new Encryption(attrs);
  57204. }
  57205. static encryptionMethod(attrs) {
  57206. return new EncryptionMethod(attrs);
  57207. }
  57208. static encryptionMethods(attrs) {
  57209. return new EncryptionMethods(attrs);
  57210. }
  57211. static event(attrs) {
  57212. return new Event(attrs);
  57213. }
  57214. static exData(attrs) {
  57215. return new ExData(attrs);
  57216. }
  57217. static exObject(attrs) {
  57218. return new ExObject(attrs);
  57219. }
  57220. static exclGroup(attrs) {
  57221. return new ExclGroup(attrs);
  57222. }
  57223. static execute(attrs) {
  57224. return new Execute(attrs);
  57225. }
  57226. static extras(attrs) {
  57227. return new Extras(attrs);
  57228. }
  57229. static field(attrs) {
  57230. return new Field(attrs);
  57231. }
  57232. static fill(attrs) {
  57233. return new Fill(attrs);
  57234. }
  57235. static filter(attrs) {
  57236. return new Filter(attrs);
  57237. }
  57238. static float(attrs) {
  57239. return new Float(attrs);
  57240. }
  57241. static font(attrs) {
  57242. return new Font(attrs);
  57243. }
  57244. static format(attrs) {
  57245. return new Format(attrs);
  57246. }
  57247. static handler(attrs) {
  57248. return new Handler(attrs);
  57249. }
  57250. static hyphenation(attrs) {
  57251. return new Hyphenation(attrs);
  57252. }
  57253. static image(attrs) {
  57254. return new Image(attrs);
  57255. }
  57256. static imageEdit(attrs) {
  57257. return new ImageEdit(attrs);
  57258. }
  57259. static integer(attrs) {
  57260. return new Integer(attrs);
  57261. }
  57262. static issuers(attrs) {
  57263. return new Issuers(attrs);
  57264. }
  57265. static items(attrs) {
  57266. return new Items(attrs);
  57267. }
  57268. static keep(attrs) {
  57269. return new Keep(attrs);
  57270. }
  57271. static keyUsage(attrs) {
  57272. return new KeyUsage(attrs);
  57273. }
  57274. static line(attrs) {
  57275. return new Line(attrs);
  57276. }
  57277. static linear(attrs) {
  57278. return new Linear(attrs);
  57279. }
  57280. static lockDocument(attrs) {
  57281. return new LockDocument(attrs);
  57282. }
  57283. static manifest(attrs) {
  57284. return new Manifest(attrs);
  57285. }
  57286. static margin(attrs) {
  57287. return new Margin(attrs);
  57288. }
  57289. static mdp(attrs) {
  57290. return new Mdp(attrs);
  57291. }
  57292. static medium(attrs) {
  57293. return new Medium(attrs);
  57294. }
  57295. static message(attrs) {
  57296. return new Message(attrs);
  57297. }
  57298. static numericEdit(attrs) {
  57299. return new NumericEdit(attrs);
  57300. }
  57301. static occur(attrs) {
  57302. return new Occur(attrs);
  57303. }
  57304. static oid(attrs) {
  57305. return new Oid(attrs);
  57306. }
  57307. static oids(attrs) {
  57308. return new Oids(attrs);
  57309. }
  57310. static overflow(attrs) {
  57311. return new Overflow(attrs);
  57312. }
  57313. static pageArea(attrs) {
  57314. return new PageArea(attrs);
  57315. }
  57316. static pageSet(attrs) {
  57317. return new PageSet(attrs);
  57318. }
  57319. static para(attrs) {
  57320. return new Para(attrs);
  57321. }
  57322. static passwordEdit(attrs) {
  57323. return new PasswordEdit(attrs);
  57324. }
  57325. static pattern(attrs) {
  57326. return new Pattern(attrs);
  57327. }
  57328. static picture(attrs) {
  57329. return new Picture(attrs);
  57330. }
  57331. static proto(attrs) {
  57332. return new Proto(attrs);
  57333. }
  57334. static radial(attrs) {
  57335. return new Radial(attrs);
  57336. }
  57337. static reason(attrs) {
  57338. return new Reason(attrs);
  57339. }
  57340. static reasons(attrs) {
  57341. return new Reasons(attrs);
  57342. }
  57343. static rectangle(attrs) {
  57344. return new Rectangle(attrs);
  57345. }
  57346. static ref(attrs) {
  57347. return new RefElement(attrs);
  57348. }
  57349. static script(attrs) {
  57350. return new Script(attrs);
  57351. }
  57352. static setProperty(attrs) {
  57353. return new SetProperty(attrs);
  57354. }
  57355. static signData(attrs) {
  57356. return new SignData(attrs);
  57357. }
  57358. static signature(attrs) {
  57359. return new Signature(attrs);
  57360. }
  57361. static signing(attrs) {
  57362. return new Signing(attrs);
  57363. }
  57364. static solid(attrs) {
  57365. return new Solid(attrs);
  57366. }
  57367. static speak(attrs) {
  57368. return new Speak(attrs);
  57369. }
  57370. static stipple(attrs) {
  57371. return new Stipple(attrs);
  57372. }
  57373. static subform(attrs) {
  57374. return new Subform(attrs);
  57375. }
  57376. static subformSet(attrs) {
  57377. return new SubformSet(attrs);
  57378. }
  57379. static subjectDN(attrs) {
  57380. return new SubjectDN(attrs);
  57381. }
  57382. static subjectDNs(attrs) {
  57383. return new SubjectDNs(attrs);
  57384. }
  57385. static submit(attrs) {
  57386. return new Submit(attrs);
  57387. }
  57388. static template(attrs) {
  57389. return new Template(attrs);
  57390. }
  57391. static text(attrs) {
  57392. return new Text(attrs);
  57393. }
  57394. static textEdit(attrs) {
  57395. return new TextEdit(attrs);
  57396. }
  57397. static time(attrs) {
  57398. return new Time(attrs);
  57399. }
  57400. static timeStamp(attrs) {
  57401. return new TimeStamp(attrs);
  57402. }
  57403. static toolTip(attrs) {
  57404. return new ToolTip(attrs);
  57405. }
  57406. static traversal(attrs) {
  57407. return new Traversal(attrs);
  57408. }
  57409. static traverse(attrs) {
  57410. return new Traverse(attrs);
  57411. }
  57412. static ui(attrs) {
  57413. return new Ui(attrs);
  57414. }
  57415. static validate(attrs) {
  57416. return new Validate(attrs);
  57417. }
  57418. static value(attrs) {
  57419. return new Value(attrs);
  57420. }
  57421. static variables(attrs) {
  57422. return new Variables(attrs);
  57423. }
  57424. }
  57425. exports.TemplateNamespace = TemplateNamespace;
  57426. /***/ }),
  57427. /* 83 */
  57428. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57429. Object.defineProperty(exports, "__esModule", ({
  57430. value: true
  57431. }));
  57432. exports.addHTML = addHTML;
  57433. exports.checkDimensions = checkDimensions;
  57434. exports.flushHTML = flushHTML;
  57435. exports.getAvailableSpace = getAvailableSpace;
  57436. var _xfa_object = __w_pdfjs_require__(77);
  57437. var _html_utils = __w_pdfjs_require__(84);
  57438. function createLine(node, children) {
  57439. return {
  57440. name: "div",
  57441. attributes: {
  57442. class: [node.layout === "lr-tb" ? "xfaLr" : "xfaRl"]
  57443. },
  57444. children
  57445. };
  57446. }
  57447. function flushHTML(node) {
  57448. if (!node[_xfa_object.$extra]) {
  57449. return null;
  57450. }
  57451. const attributes = node[_xfa_object.$extra].attributes;
  57452. const html = {
  57453. name: "div",
  57454. attributes,
  57455. children: node[_xfa_object.$extra].children
  57456. };
  57457. if (node[_xfa_object.$extra].failingNode) {
  57458. const htmlFromFailing = node[_xfa_object.$extra].failingNode[_xfa_object.$flushHTML]();
  57459. if (htmlFromFailing) {
  57460. if (node.layout.endsWith("-tb")) {
  57461. html.children.push(createLine(node, [htmlFromFailing]));
  57462. } else {
  57463. html.children.push(htmlFromFailing);
  57464. }
  57465. }
  57466. }
  57467. if (html.children.length === 0) {
  57468. return null;
  57469. }
  57470. return html;
  57471. }
  57472. function addHTML(node, html, bbox) {
  57473. const extra = node[_xfa_object.$extra];
  57474. const availableSpace = extra.availableSpace;
  57475. const [x, y, w, h] = bbox;
  57476. switch (node.layout) {
  57477. case "position":
  57478. {
  57479. extra.width = Math.max(extra.width, x + w);
  57480. extra.height = Math.max(extra.height, y + h);
  57481. extra.children.push(html);
  57482. break;
  57483. }
  57484. case "lr-tb":
  57485. case "rl-tb":
  57486. if (!extra.line || extra.attempt === 1) {
  57487. extra.line = createLine(node, []);
  57488. extra.children.push(extra.line);
  57489. extra.numberInLine = 0;
  57490. }
  57491. extra.numberInLine += 1;
  57492. extra.line.children.push(html);
  57493. if (extra.attempt === 0) {
  57494. extra.currentWidth += w;
  57495. extra.height = Math.max(extra.height, extra.prevHeight + h);
  57496. } else {
  57497. extra.currentWidth = w;
  57498. extra.prevHeight = extra.height;
  57499. extra.height += h;
  57500. extra.attempt = 0;
  57501. }
  57502. extra.width = Math.max(extra.width, extra.currentWidth);
  57503. break;
  57504. case "rl-row":
  57505. case "row":
  57506. {
  57507. extra.children.push(html);
  57508. extra.width += w;
  57509. extra.height = Math.max(extra.height, h);
  57510. const height = (0, _html_utils.measureToString)(extra.height);
  57511. for (const child of extra.children) {
  57512. child.attributes.style.height = height;
  57513. }
  57514. break;
  57515. }
  57516. case "table":
  57517. {
  57518. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  57519. extra.height += h;
  57520. extra.children.push(html);
  57521. break;
  57522. }
  57523. case "tb":
  57524. {
  57525. extra.width = Math.min(availableSpace.width, Math.max(extra.width, w));
  57526. extra.height += h;
  57527. extra.children.push(html);
  57528. break;
  57529. }
  57530. }
  57531. }
  57532. function getAvailableSpace(node) {
  57533. const availableSpace = node[_xfa_object.$extra].availableSpace;
  57534. const marginV = node.margin ? node.margin.topInset + node.margin.bottomInset : 0;
  57535. const marginH = node.margin ? node.margin.leftInset + node.margin.rightInset : 0;
  57536. switch (node.layout) {
  57537. case "lr-tb":
  57538. case "rl-tb":
  57539. if (node[_xfa_object.$extra].attempt === 0) {
  57540. return {
  57541. width: availableSpace.width - marginH - node[_xfa_object.$extra].currentWidth,
  57542. height: availableSpace.height - marginV - node[_xfa_object.$extra].prevHeight
  57543. };
  57544. }
  57545. return {
  57546. width: availableSpace.width - marginH,
  57547. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  57548. };
  57549. case "rl-row":
  57550. case "row":
  57551. const width = node[_xfa_object.$extra].columnWidths.slice(node[_xfa_object.$extra].currentColumn).reduce((a, x) => a + x);
  57552. return {
  57553. width,
  57554. height: availableSpace.height - marginH
  57555. };
  57556. case "table":
  57557. case "tb":
  57558. return {
  57559. width: availableSpace.width - marginH,
  57560. height: availableSpace.height - marginV - node[_xfa_object.$extra].height
  57561. };
  57562. case "position":
  57563. default:
  57564. return availableSpace;
  57565. }
  57566. }
  57567. function getTransformedBBox(node) {
  57568. let w = node.w === "" ? NaN : node.w;
  57569. let h = node.h === "" ? NaN : node.h;
  57570. let [centerX, centerY] = [0, 0];
  57571. switch (node.anchorType || "") {
  57572. case "bottomCenter":
  57573. [centerX, centerY] = [w / 2, h];
  57574. break;
  57575. case "bottomLeft":
  57576. [centerX, centerY] = [0, h];
  57577. break;
  57578. case "bottomRight":
  57579. [centerX, centerY] = [w, h];
  57580. break;
  57581. case "middleCenter":
  57582. [centerX, centerY] = [w / 2, h / 2];
  57583. break;
  57584. case "middleLeft":
  57585. [centerX, centerY] = [0, h / 2];
  57586. break;
  57587. case "middleRight":
  57588. [centerX, centerY] = [w, h / 2];
  57589. break;
  57590. case "topCenter":
  57591. [centerX, centerY] = [w / 2, 0];
  57592. break;
  57593. case "topRight":
  57594. [centerX, centerY] = [w, 0];
  57595. break;
  57596. }
  57597. let x, y;
  57598. switch (node.rotate || 0) {
  57599. case 0:
  57600. [x, y] = [-centerX, -centerY];
  57601. break;
  57602. case 90:
  57603. [x, y] = [-centerY, centerX];
  57604. [w, h] = [h, -w];
  57605. break;
  57606. case 180:
  57607. [x, y] = [centerX, centerY];
  57608. [w, h] = [-w, -h];
  57609. break;
  57610. case 270:
  57611. [x, y] = [centerY, -centerX];
  57612. [w, h] = [-h, w];
  57613. break;
  57614. }
  57615. return [node.x + x + Math.min(0, w), node.y + y + Math.min(0, h), Math.abs(w), Math.abs(h)];
  57616. }
  57617. function checkDimensions(node, space) {
  57618. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].firstUnsplittable === null) {
  57619. return true;
  57620. }
  57621. if (node.w === 0 || node.h === 0) {
  57622. return true;
  57623. }
  57624. const ERROR = 2;
  57625. const parent = node[_xfa_object.$getSubformParent]();
  57626. const attempt = parent[_xfa_object.$extra] && parent[_xfa_object.$extra].attempt || 0;
  57627. const [, y, w, h] = getTransformedBBox(node);
  57628. switch (parent.layout) {
  57629. case "lr-tb":
  57630. case "rl-tb":
  57631. if (attempt === 0) {
  57632. if (!node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57633. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57634. return false;
  57635. }
  57636. if (node.w !== "") {
  57637. if (Math.round(w - space.width) <= ERROR) {
  57638. return true;
  57639. }
  57640. if (parent[_xfa_object.$extra].numberInLine === 0) {
  57641. return space.height > ERROR;
  57642. }
  57643. return false;
  57644. }
  57645. return space.width > ERROR;
  57646. }
  57647. if (node.w !== "") {
  57648. return Math.round(w - space.width) <= ERROR;
  57649. }
  57650. return space.width > ERROR;
  57651. }
  57652. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57653. return true;
  57654. }
  57655. if (node.h !== "" && Math.round(h - space.height) > ERROR) {
  57656. return false;
  57657. }
  57658. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57659. return space.height > ERROR;
  57660. }
  57661. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57662. return false;
  57663. }
  57664. return space.height > ERROR;
  57665. case "table":
  57666. case "tb":
  57667. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57668. return true;
  57669. }
  57670. if (node.h !== "" && !node[_xfa_object.$isSplittable]()) {
  57671. return Math.round(h - space.height) <= ERROR;
  57672. }
  57673. if (node.w === "" || Math.round(w - space.width) <= ERROR) {
  57674. return space.height > ERROR;
  57675. }
  57676. if (parent[_xfa_object.$isThereMoreWidth]()) {
  57677. return false;
  57678. }
  57679. return space.height > ERROR;
  57680. case "position":
  57681. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57682. return true;
  57683. }
  57684. if (node.h === "" || Math.round(h + y - space.height) <= ERROR) {
  57685. return true;
  57686. }
  57687. const area = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].currentContentArea;
  57688. return h + y > area.h;
  57689. case "rl-row":
  57690. case "row":
  57691. if (node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].noLayoutFailure) {
  57692. return true;
  57693. }
  57694. if (node.h !== "") {
  57695. return Math.round(h - space.height) <= ERROR;
  57696. }
  57697. return true;
  57698. default:
  57699. return true;
  57700. }
  57701. }
  57702. /***/ }),
  57703. /* 84 */
  57704. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  57705. Object.defineProperty(exports, "__esModule", ({
  57706. value: true
  57707. }));
  57708. exports.computeBbox = computeBbox;
  57709. exports.createWrapper = createWrapper;
  57710. exports.fixDimensions = fixDimensions;
  57711. exports.fixTextIndent = fixTextIndent;
  57712. exports.fixURL = fixURL;
  57713. exports.isPrintOnly = isPrintOnly;
  57714. exports.layoutClass = layoutClass;
  57715. exports.layoutNode = layoutNode;
  57716. exports.measureToString = measureToString;
  57717. exports.setAccess = setAccess;
  57718. exports.setFontFamily = setFontFamily;
  57719. exports.setMinMaxDimensions = setMinMaxDimensions;
  57720. exports.setPara = setPara;
  57721. exports.toStyle = toStyle;
  57722. var _xfa_object = __w_pdfjs_require__(77);
  57723. var _util = __w_pdfjs_require__(2);
  57724. var _utils = __w_pdfjs_require__(78);
  57725. var _fonts = __w_pdfjs_require__(85);
  57726. var _text = __w_pdfjs_require__(86);
  57727. function measureToString(m) {
  57728. if (typeof m === "string") {
  57729. return "0px";
  57730. }
  57731. return Number.isInteger(m) ? `${m}px` : `${m.toFixed(2)}px`;
  57732. }
  57733. const converters = {
  57734. anchorType(node, style) {
  57735. const parent = node[_xfa_object.$getSubformParent]();
  57736. if (!parent || parent.layout && parent.layout !== "position") {
  57737. return;
  57738. }
  57739. if (!("transform" in style)) {
  57740. style.transform = "";
  57741. }
  57742. switch (node.anchorType) {
  57743. case "bottomCenter":
  57744. style.transform += "translate(-50%, -100%)";
  57745. break;
  57746. case "bottomLeft":
  57747. style.transform += "translate(0,-100%)";
  57748. break;
  57749. case "bottomRight":
  57750. style.transform += "translate(-100%,-100%)";
  57751. break;
  57752. case "middleCenter":
  57753. style.transform += "translate(-50%,-50%)";
  57754. break;
  57755. case "middleLeft":
  57756. style.transform += "translate(0,-50%)";
  57757. break;
  57758. case "middleRight":
  57759. style.transform += "translate(-100%,-50%)";
  57760. break;
  57761. case "topCenter":
  57762. style.transform += "translate(-50%,0)";
  57763. break;
  57764. case "topRight":
  57765. style.transform += "translate(-100%,0)";
  57766. break;
  57767. }
  57768. },
  57769. dimensions(node, style) {
  57770. const parent = node[_xfa_object.$getSubformParent]();
  57771. let width = node.w;
  57772. const height = node.h;
  57773. if (parent.layout && parent.layout.includes("row")) {
  57774. const extra = parent[_xfa_object.$extra];
  57775. const colSpan = node.colSpan;
  57776. let w;
  57777. if (colSpan === -1) {
  57778. w = extra.columnWidths.slice(extra.currentColumn).reduce((a, x) => a + x, 0);
  57779. extra.currentColumn = 0;
  57780. } else {
  57781. w = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, x) => a + x, 0);
  57782. extra.currentColumn = (extra.currentColumn + node.colSpan) % extra.columnWidths.length;
  57783. }
  57784. if (!isNaN(w)) {
  57785. width = node.w = w;
  57786. }
  57787. }
  57788. if (width !== "") {
  57789. style.width = measureToString(width);
  57790. } else {
  57791. style.width = "auto";
  57792. }
  57793. if (height !== "") {
  57794. style.height = measureToString(height);
  57795. } else {
  57796. style.height = "auto";
  57797. }
  57798. },
  57799. position(node, style) {
  57800. const parent = node[_xfa_object.$getSubformParent]();
  57801. if (parent && parent.layout && parent.layout !== "position") {
  57802. return;
  57803. }
  57804. style.position = "absolute";
  57805. style.left = measureToString(node.x);
  57806. style.top = measureToString(node.y);
  57807. },
  57808. rotate(node, style) {
  57809. if (node.rotate) {
  57810. if (!("transform" in style)) {
  57811. style.transform = "";
  57812. }
  57813. style.transform += `rotate(-${node.rotate}deg)`;
  57814. style.transformOrigin = "top left";
  57815. }
  57816. },
  57817. presence(node, style) {
  57818. switch (node.presence) {
  57819. case "invisible":
  57820. style.visibility = "hidden";
  57821. break;
  57822. case "hidden":
  57823. case "inactive":
  57824. style.display = "none";
  57825. break;
  57826. }
  57827. },
  57828. hAlign(node, style) {
  57829. if (node[_xfa_object.$nodeName] === "para") {
  57830. switch (node.hAlign) {
  57831. case "justifyAll":
  57832. style.textAlign = "justify-all";
  57833. break;
  57834. case "radix":
  57835. style.textAlign = "left";
  57836. break;
  57837. default:
  57838. style.textAlign = node.hAlign;
  57839. }
  57840. } else {
  57841. switch (node.hAlign) {
  57842. case "left":
  57843. style.alignSelf = "start";
  57844. break;
  57845. case "center":
  57846. style.alignSelf = "center";
  57847. break;
  57848. case "right":
  57849. style.alignSelf = "end";
  57850. break;
  57851. }
  57852. }
  57853. },
  57854. margin(node, style) {
  57855. if (node.margin) {
  57856. style.margin = node.margin[_xfa_object.$toStyle]().margin;
  57857. }
  57858. }
  57859. };
  57860. function setMinMaxDimensions(node, style) {
  57861. const parent = node[_xfa_object.$getSubformParent]();
  57862. if (parent.layout === "position") {
  57863. if (node.minW > 0) {
  57864. style.minWidth = measureToString(node.minW);
  57865. }
  57866. if (node.maxW > 0) {
  57867. style.maxWidth = measureToString(node.maxW);
  57868. }
  57869. if (node.minH > 0) {
  57870. style.minHeight = measureToString(node.minH);
  57871. }
  57872. if (node.maxH > 0) {
  57873. style.maxHeight = measureToString(node.maxH);
  57874. }
  57875. }
  57876. }
  57877. function layoutText(text, xfaFont, margin, lineHeight, fontFinder, width) {
  57878. const measure = new _text.TextMeasure(xfaFont, margin, lineHeight, fontFinder);
  57879. if (typeof text === "string") {
  57880. measure.addString(text);
  57881. } else {
  57882. text[_xfa_object.$pushGlyphs](measure);
  57883. }
  57884. return measure.compute(width);
  57885. }
  57886. function layoutNode(node, availableSpace) {
  57887. let height = null;
  57888. let width = null;
  57889. let isBroken = false;
  57890. if ((!node.w || !node.h) && node.value) {
  57891. let marginH = 0;
  57892. let marginV = 0;
  57893. if (node.margin) {
  57894. marginH = node.margin.leftInset + node.margin.rightInset;
  57895. marginV = node.margin.topInset + node.margin.bottomInset;
  57896. }
  57897. let lineHeight = null;
  57898. let margin = null;
  57899. if (node.para) {
  57900. margin = Object.create(null);
  57901. lineHeight = node.para.lineHeight === "" ? null : node.para.lineHeight;
  57902. margin.top = node.para.spaceAbove === "" ? 0 : node.para.spaceAbove;
  57903. margin.bottom = node.para.spaceBelow === "" ? 0 : node.para.spaceBelow;
  57904. margin.left = node.para.marginLeft === "" ? 0 : node.para.marginLeft;
  57905. margin.right = node.para.marginRight === "" ? 0 : node.para.marginRight;
  57906. }
  57907. let font = node.font;
  57908. if (!font) {
  57909. const root = node[_xfa_object.$getTemplateRoot]();
  57910. let parent = node[_xfa_object.$getParent]();
  57911. while (parent && parent !== root) {
  57912. if (parent.font) {
  57913. font = parent.font;
  57914. break;
  57915. }
  57916. parent = parent[_xfa_object.$getParent]();
  57917. }
  57918. }
  57919. const maxWidth = (!node.w ? availableSpace.width : node.w) - marginH;
  57920. const fontFinder = node[_xfa_object.$globalData].fontFinder;
  57921. if (node.value.exData && node.value.exData[_xfa_object.$content] && node.value.exData.contentType === "text/html") {
  57922. const res = layoutText(node.value.exData[_xfa_object.$content], font, margin, lineHeight, fontFinder, maxWidth);
  57923. width = res.width;
  57924. height = res.height;
  57925. isBroken = res.isBroken;
  57926. } else {
  57927. const text = node.value[_xfa_object.$text]();
  57928. if (text) {
  57929. const res = layoutText(text, font, margin, lineHeight, fontFinder, maxWidth);
  57930. width = res.width;
  57931. height = res.height;
  57932. isBroken = res.isBroken;
  57933. }
  57934. }
  57935. if (width !== null && !node.w) {
  57936. width += marginH;
  57937. }
  57938. if (height !== null && !node.h) {
  57939. height += marginV;
  57940. }
  57941. }
  57942. return {
  57943. w: width,
  57944. h: height,
  57945. isBroken
  57946. };
  57947. }
  57948. function computeBbox(node, html, availableSpace) {
  57949. let bbox;
  57950. if (node.w !== "" && node.h !== "") {
  57951. bbox = [node.x, node.y, node.w, node.h];
  57952. } else {
  57953. if (!availableSpace) {
  57954. return null;
  57955. }
  57956. let width = node.w;
  57957. if (width === "") {
  57958. if (node.maxW === 0) {
  57959. const parent = node[_xfa_object.$getSubformParent]();
  57960. if (parent.layout === "position" && parent.w !== "") {
  57961. width = 0;
  57962. } else {
  57963. width = node.minW;
  57964. }
  57965. } else {
  57966. width = Math.min(node.maxW, availableSpace.width);
  57967. }
  57968. html.attributes.style.width = measureToString(width);
  57969. }
  57970. let height = node.h;
  57971. if (height === "") {
  57972. if (node.maxH === 0) {
  57973. const parent = node[_xfa_object.$getSubformParent]();
  57974. if (parent.layout === "position" && parent.h !== "") {
  57975. height = 0;
  57976. } else {
  57977. height = node.minH;
  57978. }
  57979. } else {
  57980. height = Math.min(node.maxH, availableSpace.height);
  57981. }
  57982. html.attributes.style.height = measureToString(height);
  57983. }
  57984. bbox = [node.x, node.y, width, height];
  57985. }
  57986. return bbox;
  57987. }
  57988. function fixDimensions(node) {
  57989. const parent = node[_xfa_object.$getSubformParent]();
  57990. if (parent.layout && parent.layout.includes("row")) {
  57991. const extra = parent[_xfa_object.$extra];
  57992. const colSpan = node.colSpan;
  57993. let width;
  57994. if (colSpan === -1) {
  57995. width = extra.columnWidths.slice(extra.currentColumn).reduce((a, w) => a + w, 0);
  57996. } else {
  57997. width = extra.columnWidths.slice(extra.currentColumn, extra.currentColumn + colSpan).reduce((a, w) => a + w, 0);
  57998. }
  57999. if (!isNaN(width)) {
  58000. node.w = width;
  58001. }
  58002. }
  58003. if (parent.layout && parent.layout !== "position") {
  58004. node.x = node.y = 0;
  58005. }
  58006. if (node.layout === "table") {
  58007. if (node.w === "" && Array.isArray(node.columnWidths)) {
  58008. node.w = node.columnWidths.reduce((a, x) => a + x, 0);
  58009. }
  58010. }
  58011. }
  58012. function layoutClass(node) {
  58013. switch (node.layout) {
  58014. case "position":
  58015. return "xfaPosition";
  58016. case "lr-tb":
  58017. return "xfaLrTb";
  58018. case "rl-row":
  58019. return "xfaRlRow";
  58020. case "rl-tb":
  58021. return "xfaRlTb";
  58022. case "row":
  58023. return "xfaRow";
  58024. case "table":
  58025. return "xfaTable";
  58026. case "tb":
  58027. return "xfaTb";
  58028. default:
  58029. return "xfaPosition";
  58030. }
  58031. }
  58032. function toStyle(node, ...names) {
  58033. const style = Object.create(null);
  58034. for (const name of names) {
  58035. const value = node[name];
  58036. if (value === null) {
  58037. continue;
  58038. }
  58039. if (converters.hasOwnProperty(name)) {
  58040. converters[name](node, style);
  58041. continue;
  58042. }
  58043. if (value instanceof _xfa_object.XFAObject) {
  58044. const newStyle = value[_xfa_object.$toStyle]();
  58045. if (newStyle) {
  58046. Object.assign(style, newStyle);
  58047. } else {
  58048. (0, _util.warn)(`(DEBUG) - XFA - style for ${name} not implemented yet`);
  58049. }
  58050. }
  58051. }
  58052. return style;
  58053. }
  58054. function createWrapper(node, html) {
  58055. const {
  58056. attributes
  58057. } = html;
  58058. const {
  58059. style
  58060. } = attributes;
  58061. const wrapper = {
  58062. name: "div",
  58063. attributes: {
  58064. class: ["xfaWrapper"],
  58065. style: Object.create(null)
  58066. },
  58067. children: []
  58068. };
  58069. attributes.class.push("xfaWrapped");
  58070. if (node.border) {
  58071. const {
  58072. widths,
  58073. insets
  58074. } = node.border[_xfa_object.$extra];
  58075. let width, height;
  58076. let top = insets[0];
  58077. let left = insets[3];
  58078. const insetsH = insets[0] + insets[2];
  58079. const insetsW = insets[1] + insets[3];
  58080. switch (node.border.hand) {
  58081. case "even":
  58082. top -= widths[0] / 2;
  58083. left -= widths[3] / 2;
  58084. width = `calc(100% + ${(widths[1] + widths[3]) / 2 - insetsW}px)`;
  58085. height = `calc(100% + ${(widths[0] + widths[2]) / 2 - insetsH}px)`;
  58086. break;
  58087. case "left":
  58088. top -= widths[0];
  58089. left -= widths[3];
  58090. width = `calc(100% + ${widths[1] + widths[3] - insetsW}px)`;
  58091. height = `calc(100% + ${widths[0] + widths[2] - insetsH}px)`;
  58092. break;
  58093. case "right":
  58094. width = insetsW ? `calc(100% - ${insetsW}px)` : "100%";
  58095. height = insetsH ? `calc(100% - ${insetsH}px)` : "100%";
  58096. break;
  58097. }
  58098. const classNames = ["xfaBorder"];
  58099. if (isPrintOnly(node.border)) {
  58100. classNames.push("xfaPrintOnly");
  58101. }
  58102. const border = {
  58103. name: "div",
  58104. attributes: {
  58105. class: classNames,
  58106. style: {
  58107. top: `${top}px`,
  58108. left: `${left}px`,
  58109. width,
  58110. height
  58111. }
  58112. },
  58113. children: []
  58114. };
  58115. for (const key of ["border", "borderWidth", "borderColor", "borderRadius", "borderStyle"]) {
  58116. if (style[key] !== undefined) {
  58117. border.attributes.style[key] = style[key];
  58118. delete style[key];
  58119. }
  58120. }
  58121. wrapper.children.push(border, html);
  58122. } else {
  58123. wrapper.children.push(html);
  58124. }
  58125. for (const key of ["background", "backgroundClip", "top", "left", "width", "height", "minWidth", "minHeight", "maxWidth", "maxHeight", "transform", "transformOrigin", "visibility"]) {
  58126. if (style[key] !== undefined) {
  58127. wrapper.attributes.style[key] = style[key];
  58128. delete style[key];
  58129. }
  58130. }
  58131. if (style.position === "absolute") {
  58132. wrapper.attributes.style.position = "absolute";
  58133. } else {
  58134. wrapper.attributes.style.position = "relative";
  58135. }
  58136. delete style.position;
  58137. if (style.alignSelf) {
  58138. wrapper.attributes.style.alignSelf = style.alignSelf;
  58139. delete style.alignSelf;
  58140. }
  58141. return wrapper;
  58142. }
  58143. function fixTextIndent(styles) {
  58144. const indent = (0, _utils.getMeasurement)(styles.textIndent, "0px");
  58145. if (indent >= 0) {
  58146. return;
  58147. }
  58148. const align = styles.textAlign === "right" ? "right" : "left";
  58149. const name = "padding" + (align === "left" ? "Left" : "Right");
  58150. const padding = (0, _utils.getMeasurement)(styles[name], "0px");
  58151. styles[name] = `${padding - indent}px`;
  58152. }
  58153. function setAccess(node, classNames) {
  58154. switch (node.access) {
  58155. case "nonInteractive":
  58156. classNames.push("xfaNonInteractive");
  58157. break;
  58158. case "readOnly":
  58159. classNames.push("xfaReadOnly");
  58160. break;
  58161. case "protected":
  58162. classNames.push("xfaDisabled");
  58163. break;
  58164. }
  58165. }
  58166. function isPrintOnly(node) {
  58167. return node.relevant.length > 0 && !node.relevant[0].excluded && node.relevant[0].viewname === "print";
  58168. }
  58169. function getCurrentPara(node) {
  58170. const stack = node[_xfa_object.$getTemplateRoot]()[_xfa_object.$extra].paraStack;
  58171. return stack.length ? stack[stack.length - 1] : null;
  58172. }
  58173. function setPara(node, nodeStyle, value) {
  58174. if (value.attributes.class && value.attributes.class.includes("xfaRich")) {
  58175. if (nodeStyle) {
  58176. if (node.h === "") {
  58177. nodeStyle.height = "auto";
  58178. }
  58179. if (node.w === "") {
  58180. nodeStyle.width = "auto";
  58181. }
  58182. }
  58183. const para = getCurrentPara(node);
  58184. if (para) {
  58185. const valueStyle = value.attributes.style;
  58186. valueStyle.display = "flex";
  58187. valueStyle.flexDirection = "column";
  58188. switch (para.vAlign) {
  58189. case "top":
  58190. valueStyle.justifyContent = "start";
  58191. break;
  58192. case "bottom":
  58193. valueStyle.justifyContent = "end";
  58194. break;
  58195. case "middle":
  58196. valueStyle.justifyContent = "center";
  58197. break;
  58198. }
  58199. const paraStyle = para[_xfa_object.$toStyle]();
  58200. for (const [key, val] of Object.entries(paraStyle)) {
  58201. if (!(key in valueStyle)) {
  58202. valueStyle[key] = val;
  58203. }
  58204. }
  58205. }
  58206. }
  58207. }
  58208. function setFontFamily(xfaFont, node, fontFinder, style) {
  58209. if (!fontFinder) {
  58210. delete style.fontFamily;
  58211. return;
  58212. }
  58213. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  58214. style.fontFamily = `"${name}"`;
  58215. const typeface = fontFinder.find(name);
  58216. if (typeface) {
  58217. const {
  58218. fontFamily
  58219. } = typeface.regular.cssFontInfo;
  58220. if (fontFamily !== name) {
  58221. style.fontFamily = `"${fontFamily}"`;
  58222. }
  58223. const para = getCurrentPara(node);
  58224. if (para && para.lineHeight !== "") {
  58225. return;
  58226. }
  58227. if (style.lineHeight) {
  58228. return;
  58229. }
  58230. const pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  58231. if (pdfFont) {
  58232. style.lineHeight = Math.max(1.2, pdfFont.lineHeight);
  58233. }
  58234. }
  58235. }
  58236. function fixURL(str) {
  58237. const absoluteUrl = (0, _util.createValidAbsoluteUrl)(str, null, {
  58238. addDefaultProtocol: true,
  58239. tryConvertEncoding: true
  58240. });
  58241. return absoluteUrl ? absoluteUrl.href : null;
  58242. }
  58243. /***/ }),
  58244. /* 85 */
  58245. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58246. Object.defineProperty(exports, "__esModule", ({
  58247. value: true
  58248. }));
  58249. exports.FontFinder = void 0;
  58250. exports.getMetrics = getMetrics;
  58251. exports.selectFont = selectFont;
  58252. var _xfa_object = __w_pdfjs_require__(77);
  58253. var _utils = __w_pdfjs_require__(78);
  58254. var _util = __w_pdfjs_require__(2);
  58255. class FontFinder {
  58256. constructor(pdfFonts) {
  58257. this.fonts = new Map();
  58258. this.cache = new Map();
  58259. this.warned = new Set();
  58260. this.defaultFont = null;
  58261. this.add(pdfFonts);
  58262. }
  58263. add(pdfFonts, reallyMissingFonts = null) {
  58264. for (const pdfFont of pdfFonts) {
  58265. this.addPdfFont(pdfFont);
  58266. }
  58267. for (const pdfFont of this.fonts.values()) {
  58268. if (!pdfFont.regular) {
  58269. pdfFont.regular = pdfFont.italic || pdfFont.bold || pdfFont.bolditalic;
  58270. }
  58271. }
  58272. if (!reallyMissingFonts || reallyMissingFonts.size === 0) {
  58273. return;
  58274. }
  58275. const myriad = this.fonts.get("PdfJS-Fallback-PdfJS-XFA");
  58276. for (const missing of reallyMissingFonts) {
  58277. this.fonts.set(missing, myriad);
  58278. }
  58279. }
  58280. addPdfFont(pdfFont) {
  58281. const cssFontInfo = pdfFont.cssFontInfo;
  58282. const name = cssFontInfo.fontFamily;
  58283. let font = this.fonts.get(name);
  58284. if (!font) {
  58285. font = Object.create(null);
  58286. this.fonts.set(name, font);
  58287. if (!this.defaultFont) {
  58288. this.defaultFont = font;
  58289. }
  58290. }
  58291. let property = "";
  58292. const fontWeight = parseFloat(cssFontInfo.fontWeight);
  58293. if (parseFloat(cssFontInfo.italicAngle) !== 0) {
  58294. property = fontWeight >= 700 ? "bolditalic" : "italic";
  58295. } else if (fontWeight >= 700) {
  58296. property = "bold";
  58297. }
  58298. if (!property) {
  58299. if (pdfFont.name.includes("Bold") || pdfFont.psName && pdfFont.psName.includes("Bold")) {
  58300. property = "bold";
  58301. }
  58302. if (pdfFont.name.includes("Italic") || pdfFont.name.endsWith("It") || pdfFont.psName && (pdfFont.psName.includes("Italic") || pdfFont.psName.endsWith("It"))) {
  58303. property += "italic";
  58304. }
  58305. }
  58306. if (!property) {
  58307. property = "regular";
  58308. }
  58309. font[property] = pdfFont;
  58310. }
  58311. getDefault() {
  58312. return this.defaultFont;
  58313. }
  58314. find(fontName, mustWarn = true) {
  58315. let font = this.fonts.get(fontName) || this.cache.get(fontName);
  58316. if (font) {
  58317. return font;
  58318. }
  58319. const pattern = /,|-|_| |bolditalic|bold|italic|regular|it/gi;
  58320. let name = fontName.replace(pattern, "");
  58321. font = this.fonts.get(name);
  58322. if (font) {
  58323. this.cache.set(fontName, font);
  58324. return font;
  58325. }
  58326. name = name.toLowerCase();
  58327. const maybe = [];
  58328. for (const [family, pdfFont] of this.fonts.entries()) {
  58329. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  58330. maybe.push(pdfFont);
  58331. }
  58332. }
  58333. if (maybe.length === 0) {
  58334. for (const [, pdfFont] of this.fonts.entries()) {
  58335. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  58336. maybe.push(pdfFont);
  58337. }
  58338. }
  58339. }
  58340. if (maybe.length === 0) {
  58341. name = name.replace(/psmt|mt/gi, "");
  58342. for (const [family, pdfFont] of this.fonts.entries()) {
  58343. if (family.replace(pattern, "").toLowerCase().startsWith(name)) {
  58344. maybe.push(pdfFont);
  58345. }
  58346. }
  58347. }
  58348. if (maybe.length === 0) {
  58349. for (const pdfFont of this.fonts.values()) {
  58350. if (pdfFont.regular.name && pdfFont.regular.name.replace(pattern, "").toLowerCase().startsWith(name)) {
  58351. maybe.push(pdfFont);
  58352. }
  58353. }
  58354. }
  58355. if (maybe.length >= 1) {
  58356. if (maybe.length !== 1 && mustWarn) {
  58357. (0, _util.warn)(`XFA - Too many choices to guess the correct font: ${fontName}`);
  58358. }
  58359. this.cache.set(fontName, maybe[0]);
  58360. return maybe[0];
  58361. }
  58362. if (mustWarn && !this.warned.has(fontName)) {
  58363. this.warned.add(fontName);
  58364. (0, _util.warn)(`XFA - Cannot find the font: ${fontName}`);
  58365. }
  58366. return null;
  58367. }
  58368. }
  58369. exports.FontFinder = FontFinder;
  58370. function selectFont(xfaFont, typeface) {
  58371. if (xfaFont.posture === "italic") {
  58372. if (xfaFont.weight === "bold") {
  58373. return typeface.bolditalic;
  58374. }
  58375. return typeface.italic;
  58376. } else if (xfaFont.weight === "bold") {
  58377. return typeface.bold;
  58378. }
  58379. return typeface.regular;
  58380. }
  58381. function getMetrics(xfaFont, real = false) {
  58382. let pdfFont = null;
  58383. if (xfaFont) {
  58384. const name = (0, _utils.stripQuotes)(xfaFont.typeface);
  58385. const typeface = xfaFont[_xfa_object.$globalData].fontFinder.find(name);
  58386. pdfFont = selectFont(xfaFont, typeface);
  58387. }
  58388. if (!pdfFont) {
  58389. return {
  58390. lineHeight: 12,
  58391. lineGap: 2,
  58392. lineNoGap: 10
  58393. };
  58394. }
  58395. const size = xfaFont.size || 10;
  58396. const lineHeight = pdfFont.lineHeight ? Math.max(real ? 0 : 1.2, pdfFont.lineHeight) : 1.2;
  58397. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  58398. return {
  58399. lineHeight: lineHeight * size,
  58400. lineGap: lineGap * size,
  58401. lineNoGap: Math.max(1, lineHeight - lineGap) * size
  58402. };
  58403. }
  58404. /***/ }),
  58405. /* 86 */
  58406. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58407. Object.defineProperty(exports, "__esModule", ({
  58408. value: true
  58409. }));
  58410. exports.TextMeasure = void 0;
  58411. var _fonts = __w_pdfjs_require__(85);
  58412. const WIDTH_FACTOR = 1.02;
  58413. class FontInfo {
  58414. constructor(xfaFont, margin, lineHeight, fontFinder) {
  58415. this.lineHeight = lineHeight;
  58416. this.paraMargin = margin || {
  58417. top: 0,
  58418. bottom: 0,
  58419. left: 0,
  58420. right: 0
  58421. };
  58422. if (!xfaFont) {
  58423. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58424. return;
  58425. }
  58426. this.xfaFont = {
  58427. typeface: xfaFont.typeface,
  58428. posture: xfaFont.posture,
  58429. weight: xfaFont.weight,
  58430. size: xfaFont.size,
  58431. letterSpacing: xfaFont.letterSpacing
  58432. };
  58433. const typeface = fontFinder.find(xfaFont.typeface);
  58434. if (!typeface) {
  58435. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58436. return;
  58437. }
  58438. this.pdfFont = (0, _fonts.selectFont)(xfaFont, typeface);
  58439. if (!this.pdfFont) {
  58440. [this.pdfFont, this.xfaFont] = this.defaultFont(fontFinder);
  58441. }
  58442. }
  58443. defaultFont(fontFinder) {
  58444. const font = fontFinder.find("Helvetica", false) || fontFinder.find("Myriad Pro", false) || fontFinder.find("Arial", false) || fontFinder.getDefault();
  58445. if (font && font.regular) {
  58446. const pdfFont = font.regular;
  58447. const info = pdfFont.cssFontInfo;
  58448. const xfaFont = {
  58449. typeface: info.fontFamily,
  58450. posture: "normal",
  58451. weight: "normal",
  58452. size: 10,
  58453. letterSpacing: 0
  58454. };
  58455. return [pdfFont, xfaFont];
  58456. }
  58457. const xfaFont = {
  58458. typeface: "Courier",
  58459. posture: "normal",
  58460. weight: "normal",
  58461. size: 10,
  58462. letterSpacing: 0
  58463. };
  58464. return [null, xfaFont];
  58465. }
  58466. }
  58467. class FontSelector {
  58468. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder) {
  58469. this.fontFinder = fontFinder;
  58470. this.stack = [new FontInfo(defaultXfaFont, defaultParaMargin, defaultLineHeight, fontFinder)];
  58471. }
  58472. pushData(xfaFont, margin, lineHeight) {
  58473. const lastFont = this.stack[this.stack.length - 1];
  58474. for (const name of ["typeface", "posture", "weight", "size", "letterSpacing"]) {
  58475. if (!xfaFont[name]) {
  58476. xfaFont[name] = lastFont.xfaFont[name];
  58477. }
  58478. }
  58479. for (const name of ["top", "bottom", "left", "right"]) {
  58480. if (isNaN(margin[name])) {
  58481. margin[name] = lastFont.paraMargin[name];
  58482. }
  58483. }
  58484. const fontInfo = new FontInfo(xfaFont, margin, lineHeight || lastFont.lineHeight, this.fontFinder);
  58485. if (!fontInfo.pdfFont) {
  58486. fontInfo.pdfFont = lastFont.pdfFont;
  58487. }
  58488. this.stack.push(fontInfo);
  58489. }
  58490. popFont() {
  58491. this.stack.pop();
  58492. }
  58493. topFont() {
  58494. return this.stack[this.stack.length - 1];
  58495. }
  58496. }
  58497. class TextMeasure {
  58498. constructor(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts) {
  58499. this.glyphs = [];
  58500. this.fontSelector = new FontSelector(defaultXfaFont, defaultParaMargin, defaultLineHeight, fonts);
  58501. this.extraHeight = 0;
  58502. }
  58503. pushData(xfaFont, margin, lineHeight) {
  58504. this.fontSelector.pushData(xfaFont, margin, lineHeight);
  58505. }
  58506. popFont(xfaFont) {
  58507. return this.fontSelector.popFont();
  58508. }
  58509. addPara() {
  58510. const lastFont = this.fontSelector.topFont();
  58511. this.extraHeight += lastFont.paraMargin.top + lastFont.paraMargin.bottom;
  58512. }
  58513. addString(str) {
  58514. if (!str) {
  58515. return;
  58516. }
  58517. const lastFont = this.fontSelector.topFont();
  58518. const fontSize = lastFont.xfaFont.size;
  58519. if (lastFont.pdfFont) {
  58520. const letterSpacing = lastFont.xfaFont.letterSpacing;
  58521. const pdfFont = lastFont.pdfFont;
  58522. const fontLineHeight = pdfFont.lineHeight || 1.2;
  58523. const lineHeight = lastFont.lineHeight || Math.max(1.2, fontLineHeight) * fontSize;
  58524. const lineGap = pdfFont.lineGap === undefined ? 0.2 : pdfFont.lineGap;
  58525. const noGap = fontLineHeight - lineGap;
  58526. const firstLineHeight = Math.max(1, noGap) * fontSize;
  58527. const scale = fontSize / 1000;
  58528. const fallbackWidth = pdfFont.defaultWidth || pdfFont.charsToGlyphs(" ")[0].width;
  58529. for (const line of str.split(/[\u2029\n]/)) {
  58530. const encodedLine = pdfFont.encodeString(line).join("");
  58531. const glyphs = pdfFont.charsToGlyphs(encodedLine);
  58532. for (const glyph of glyphs) {
  58533. const width = glyph.width || fallbackWidth;
  58534. this.glyphs.push([width * scale + letterSpacing, lineHeight, firstLineHeight, glyph.unicode, false]);
  58535. }
  58536. this.glyphs.push([0, 0, 0, "\n", true]);
  58537. }
  58538. this.glyphs.pop();
  58539. return;
  58540. }
  58541. for (const line of str.split(/[\u2029\n]/)) {
  58542. for (const char of line.split("")) {
  58543. this.glyphs.push([fontSize, 1.2 * fontSize, fontSize, char, false]);
  58544. }
  58545. this.glyphs.push([0, 0, 0, "\n", true]);
  58546. }
  58547. this.glyphs.pop();
  58548. }
  58549. compute(maxWidth) {
  58550. let lastSpacePos = -1,
  58551. lastSpaceWidth = 0,
  58552. width = 0,
  58553. height = 0,
  58554. currentLineWidth = 0,
  58555. currentLineHeight = 0;
  58556. let isBroken = false;
  58557. let isFirstLine = true;
  58558. for (let i = 0, ii = this.glyphs.length; i < ii; i++) {
  58559. const [glyphWidth, lineHeight, firstLineHeight, char, isEOL] = this.glyphs[i];
  58560. const isSpace = char === " ";
  58561. const glyphHeight = isFirstLine ? firstLineHeight : lineHeight;
  58562. if (isEOL) {
  58563. width = Math.max(width, currentLineWidth);
  58564. currentLineWidth = 0;
  58565. height += currentLineHeight;
  58566. currentLineHeight = glyphHeight;
  58567. lastSpacePos = -1;
  58568. lastSpaceWidth = 0;
  58569. isFirstLine = false;
  58570. continue;
  58571. }
  58572. if (isSpace) {
  58573. if (currentLineWidth + glyphWidth > maxWidth) {
  58574. width = Math.max(width, currentLineWidth);
  58575. currentLineWidth = 0;
  58576. height += currentLineHeight;
  58577. currentLineHeight = glyphHeight;
  58578. lastSpacePos = -1;
  58579. lastSpaceWidth = 0;
  58580. isBroken = true;
  58581. isFirstLine = false;
  58582. } else {
  58583. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  58584. lastSpaceWidth = currentLineWidth;
  58585. currentLineWidth += glyphWidth;
  58586. lastSpacePos = i;
  58587. }
  58588. continue;
  58589. }
  58590. if (currentLineWidth + glyphWidth > maxWidth) {
  58591. height += currentLineHeight;
  58592. currentLineHeight = glyphHeight;
  58593. if (lastSpacePos !== -1) {
  58594. i = lastSpacePos;
  58595. width = Math.max(width, lastSpaceWidth);
  58596. currentLineWidth = 0;
  58597. lastSpacePos = -1;
  58598. lastSpaceWidth = 0;
  58599. } else {
  58600. width = Math.max(width, currentLineWidth);
  58601. currentLineWidth = glyphWidth;
  58602. }
  58603. isBroken = true;
  58604. isFirstLine = false;
  58605. continue;
  58606. }
  58607. currentLineWidth += glyphWidth;
  58608. currentLineHeight = Math.max(glyphHeight, currentLineHeight);
  58609. }
  58610. width = Math.max(width, currentLineWidth);
  58611. height += currentLineHeight + this.extraHeight;
  58612. return {
  58613. width: WIDTH_FACTOR * width,
  58614. height,
  58615. isBroken
  58616. };
  58617. }
  58618. }
  58619. exports.TextMeasure = TextMeasure;
  58620. /***/ }),
  58621. /* 87 */
  58622. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58623. Object.defineProperty(exports, "__esModule", ({
  58624. value: true
  58625. }));
  58626. exports.DataHandler = void 0;
  58627. var _xfa_object = __w_pdfjs_require__(77);
  58628. class DataHandler {
  58629. constructor(root, data) {
  58630. this.data = data;
  58631. this.dataset = root.datasets || null;
  58632. }
  58633. serialize(storage) {
  58634. const stack = [[-1, this.data[_xfa_object.$getChildren]()]];
  58635. while (stack.length > 0) {
  58636. const last = stack[stack.length - 1];
  58637. const [i, children] = last;
  58638. if (i + 1 === children.length) {
  58639. stack.pop();
  58640. continue;
  58641. }
  58642. const child = children[++last[0]];
  58643. const storageEntry = storage.get(child[_xfa_object.$uid]);
  58644. if (storageEntry) {
  58645. child[_xfa_object.$setValue](storageEntry);
  58646. } else {
  58647. const attributes = child[_xfa_object.$getAttributes]();
  58648. for (const value of attributes.values()) {
  58649. const entry = storage.get(value[_xfa_object.$uid]);
  58650. if (entry) {
  58651. value[_xfa_object.$setValue](entry);
  58652. break;
  58653. }
  58654. }
  58655. }
  58656. const nodes = child[_xfa_object.$getChildren]();
  58657. if (nodes.length > 0) {
  58658. stack.push([-1, nodes]);
  58659. }
  58660. }
  58661. const buf = [`<xfa:datasets xmlns:xfa="http://www.xfa.org/schema/xfa-data/1.0/">`];
  58662. if (this.dataset) {
  58663. for (const child of this.dataset[_xfa_object.$getChildren]()) {
  58664. if (child[_xfa_object.$nodeName] !== "data") {
  58665. child[_xfa_object.$toString](buf);
  58666. }
  58667. }
  58668. }
  58669. this.data[_xfa_object.$toString](buf);
  58670. buf.push("</xfa:datasets>");
  58671. return buf.join("");
  58672. }
  58673. }
  58674. exports.DataHandler = DataHandler;
  58675. /***/ }),
  58676. /* 88 */
  58677. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58678. Object.defineProperty(exports, "__esModule", ({
  58679. value: true
  58680. }));
  58681. exports.XFAParser = void 0;
  58682. var _xfa_object = __w_pdfjs_require__(77);
  58683. var _xml_parser = __w_pdfjs_require__(70);
  58684. var _builder = __w_pdfjs_require__(89);
  58685. var _util = __w_pdfjs_require__(2);
  58686. class XFAParser extends _xml_parser.XMLParserBase {
  58687. constructor(rootNameSpace = null, richText = false) {
  58688. super();
  58689. this._builder = new _builder.Builder(rootNameSpace);
  58690. this._stack = [];
  58691. this._globalData = {
  58692. usedTypefaces: new Set()
  58693. };
  58694. this._ids = new Map();
  58695. this._current = this._builder.buildRoot(this._ids);
  58696. this._errorCode = _xml_parser.XMLParserErrorCode.NoError;
  58697. this._whiteRegex = /^\s+$/;
  58698. this._nbsps = /\xa0+/g;
  58699. this._richText = richText;
  58700. }
  58701. parse(data) {
  58702. this.parseXml(data);
  58703. if (this._errorCode !== _xml_parser.XMLParserErrorCode.NoError) {
  58704. return undefined;
  58705. }
  58706. this._current[_xfa_object.$finalize]();
  58707. return this._current.element;
  58708. }
  58709. onText(text) {
  58710. text = text.replace(this._nbsps, match => match.slice(1) + " ");
  58711. if (this._richText || this._current[_xfa_object.$acceptWhitespace]()) {
  58712. this._current[_xfa_object.$onText](text, this._richText);
  58713. return;
  58714. }
  58715. if (this._whiteRegex.test(text)) {
  58716. return;
  58717. }
  58718. this._current[_xfa_object.$onText](text.trim());
  58719. }
  58720. onCdata(text) {
  58721. this._current[_xfa_object.$onText](text);
  58722. }
  58723. _mkAttributes(attributes, tagName) {
  58724. let namespace = null;
  58725. let prefixes = null;
  58726. const attributeObj = Object.create({});
  58727. for (const {
  58728. name,
  58729. value
  58730. } of attributes) {
  58731. if (name === "xmlns") {
  58732. if (!namespace) {
  58733. namespace = value;
  58734. } else {
  58735. (0, _util.warn)(`XFA - multiple namespace definition in <${tagName}>`);
  58736. }
  58737. } else if (name.startsWith("xmlns:")) {
  58738. const prefix = name.substring("xmlns:".length);
  58739. if (!prefixes) {
  58740. prefixes = [];
  58741. }
  58742. prefixes.push({
  58743. prefix,
  58744. value
  58745. });
  58746. } else {
  58747. const i = name.indexOf(":");
  58748. if (i === -1) {
  58749. attributeObj[name] = value;
  58750. } else {
  58751. let nsAttrs = attributeObj[_xfa_object.$nsAttributes];
  58752. if (!nsAttrs) {
  58753. nsAttrs = attributeObj[_xfa_object.$nsAttributes] = Object.create(null);
  58754. }
  58755. const [ns, attrName] = [name.slice(0, i), name.slice(i + 1)];
  58756. let attrs = nsAttrs[ns];
  58757. if (!attrs) {
  58758. attrs = nsAttrs[ns] = Object.create(null);
  58759. }
  58760. attrs[attrName] = value;
  58761. }
  58762. }
  58763. }
  58764. return [namespace, prefixes, attributeObj];
  58765. }
  58766. _getNameAndPrefix(name, nsAgnostic) {
  58767. const i = name.indexOf(":");
  58768. if (i === -1) {
  58769. return [name, null];
  58770. }
  58771. return [name.substring(i + 1), nsAgnostic ? "" : name.substring(0, i)];
  58772. }
  58773. onBeginElement(tagName, attributes, isEmpty) {
  58774. const [namespace, prefixes, attributesObj] = this._mkAttributes(attributes, tagName);
  58775. const [name, nsPrefix] = this._getNameAndPrefix(tagName, this._builder.isNsAgnostic());
  58776. const node = this._builder.build({
  58777. nsPrefix,
  58778. name,
  58779. attributes: attributesObj,
  58780. namespace,
  58781. prefixes
  58782. });
  58783. node[_xfa_object.$globalData] = this._globalData;
  58784. if (isEmpty) {
  58785. node[_xfa_object.$finalize]();
  58786. if (this._current[_xfa_object.$onChild](node)) {
  58787. node[_xfa_object.$setId](this._ids);
  58788. }
  58789. node[_xfa_object.$clean](this._builder);
  58790. return;
  58791. }
  58792. this._stack.push(this._current);
  58793. this._current = node;
  58794. }
  58795. onEndElement(name) {
  58796. const node = this._current;
  58797. if (node[_xfa_object.$isCDATAXml]() && typeof node[_xfa_object.$content] === "string") {
  58798. const parser = new XFAParser();
  58799. parser._globalData = this._globalData;
  58800. const root = parser.parse(node[_xfa_object.$content]);
  58801. node[_xfa_object.$content] = null;
  58802. node[_xfa_object.$onChild](root);
  58803. }
  58804. node[_xfa_object.$finalize]();
  58805. this._current = this._stack.pop();
  58806. if (this._current[_xfa_object.$onChild](node)) {
  58807. node[_xfa_object.$setId](this._ids);
  58808. }
  58809. node[_xfa_object.$clean](this._builder);
  58810. }
  58811. onError(code) {
  58812. this._errorCode = code;
  58813. }
  58814. }
  58815. exports.XFAParser = XFAParser;
  58816. /***/ }),
  58817. /* 89 */
  58818. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58819. Object.defineProperty(exports, "__esModule", ({
  58820. value: true
  58821. }));
  58822. exports.Builder = void 0;
  58823. var _namespaces = __w_pdfjs_require__(79);
  58824. var _xfa_object = __w_pdfjs_require__(77);
  58825. var _setup = __w_pdfjs_require__(90);
  58826. var _template = __w_pdfjs_require__(82);
  58827. var _unknown = __w_pdfjs_require__(99);
  58828. var _util = __w_pdfjs_require__(2);
  58829. class Root extends _xfa_object.XFAObject {
  58830. constructor(ids) {
  58831. super(-1, "root", Object.create(null));
  58832. this.element = null;
  58833. this[_xfa_object.$ids] = ids;
  58834. }
  58835. [_xfa_object.$onChild](child) {
  58836. this.element = child;
  58837. return true;
  58838. }
  58839. [_xfa_object.$finalize]() {
  58840. super[_xfa_object.$finalize]();
  58841. if (this.element.template instanceof _template.Template) {
  58842. this[_xfa_object.$ids].set(_xfa_object.$root, this.element);
  58843. this.element.template[_xfa_object.$resolvePrototypes](this[_xfa_object.$ids]);
  58844. this.element.template[_xfa_object.$ids] = this[_xfa_object.$ids];
  58845. }
  58846. }
  58847. }
  58848. class Empty extends _xfa_object.XFAObject {
  58849. constructor() {
  58850. super(-1, "", Object.create(null));
  58851. }
  58852. [_xfa_object.$onChild](_) {
  58853. return false;
  58854. }
  58855. }
  58856. class Builder {
  58857. constructor(rootNameSpace = null) {
  58858. this._namespaceStack = [];
  58859. this._nsAgnosticLevel = 0;
  58860. this._namespacePrefixes = new Map();
  58861. this._namespaces = new Map();
  58862. this._nextNsId = Math.max(...Object.values(_namespaces.NamespaceIds).map(({
  58863. id
  58864. }) => id));
  58865. this._currentNamespace = rootNameSpace || new _unknown.UnknownNamespace(++this._nextNsId);
  58866. }
  58867. buildRoot(ids) {
  58868. return new Root(ids);
  58869. }
  58870. build({
  58871. nsPrefix,
  58872. name,
  58873. attributes,
  58874. namespace,
  58875. prefixes
  58876. }) {
  58877. const hasNamespaceDef = namespace !== null;
  58878. if (hasNamespaceDef) {
  58879. this._namespaceStack.push(this._currentNamespace);
  58880. this._currentNamespace = this._searchNamespace(namespace);
  58881. }
  58882. if (prefixes) {
  58883. this._addNamespacePrefix(prefixes);
  58884. }
  58885. if (attributes.hasOwnProperty(_xfa_object.$nsAttributes)) {
  58886. const dataTemplate = _setup.NamespaceSetUp.datasets;
  58887. const nsAttrs = attributes[_xfa_object.$nsAttributes];
  58888. let xfaAttrs = null;
  58889. for (const [ns, attrs] of Object.entries(nsAttrs)) {
  58890. const nsToUse = this._getNamespaceToUse(ns);
  58891. if (nsToUse === dataTemplate) {
  58892. xfaAttrs = {
  58893. xfa: attrs
  58894. };
  58895. break;
  58896. }
  58897. }
  58898. if (xfaAttrs) {
  58899. attributes[_xfa_object.$nsAttributes] = xfaAttrs;
  58900. } else {
  58901. delete attributes[_xfa_object.$nsAttributes];
  58902. }
  58903. }
  58904. const namespaceToUse = this._getNamespaceToUse(nsPrefix);
  58905. const node = namespaceToUse && namespaceToUse[_namespaces.$buildXFAObject](name, attributes) || new Empty();
  58906. if (node[_xfa_object.$isNsAgnostic]()) {
  58907. this._nsAgnosticLevel++;
  58908. }
  58909. if (hasNamespaceDef || prefixes || node[_xfa_object.$isNsAgnostic]()) {
  58910. node[_xfa_object.$cleanup] = {
  58911. hasNamespace: hasNamespaceDef,
  58912. prefixes,
  58913. nsAgnostic: node[_xfa_object.$isNsAgnostic]()
  58914. };
  58915. }
  58916. return node;
  58917. }
  58918. isNsAgnostic() {
  58919. return this._nsAgnosticLevel > 0;
  58920. }
  58921. _searchNamespace(nsName) {
  58922. let ns = this._namespaces.get(nsName);
  58923. if (ns) {
  58924. return ns;
  58925. }
  58926. for (const [name, {
  58927. check
  58928. }] of Object.entries(_namespaces.NamespaceIds)) {
  58929. if (check(nsName)) {
  58930. ns = _setup.NamespaceSetUp[name];
  58931. if (ns) {
  58932. this._namespaces.set(nsName, ns);
  58933. return ns;
  58934. }
  58935. break;
  58936. }
  58937. }
  58938. ns = new _unknown.UnknownNamespace(++this._nextNsId);
  58939. this._namespaces.set(nsName, ns);
  58940. return ns;
  58941. }
  58942. _addNamespacePrefix(prefixes) {
  58943. for (const {
  58944. prefix,
  58945. value
  58946. } of prefixes) {
  58947. const namespace = this._searchNamespace(value);
  58948. let prefixStack = this._namespacePrefixes.get(prefix);
  58949. if (!prefixStack) {
  58950. prefixStack = [];
  58951. this._namespacePrefixes.set(prefix, prefixStack);
  58952. }
  58953. prefixStack.push(namespace);
  58954. }
  58955. }
  58956. _getNamespaceToUse(prefix) {
  58957. if (!prefix) {
  58958. return this._currentNamespace;
  58959. }
  58960. const prefixStack = this._namespacePrefixes.get(prefix);
  58961. if (prefixStack && prefixStack.length > 0) {
  58962. return prefixStack[prefixStack.length - 1];
  58963. }
  58964. (0, _util.warn)(`Unknown namespace prefix: ${prefix}.`);
  58965. return null;
  58966. }
  58967. clean(data) {
  58968. const {
  58969. hasNamespace,
  58970. prefixes,
  58971. nsAgnostic
  58972. } = data;
  58973. if (hasNamespace) {
  58974. this._currentNamespace = this._namespaceStack.pop();
  58975. }
  58976. if (prefixes) {
  58977. prefixes.forEach(({
  58978. prefix
  58979. }) => {
  58980. this._namespacePrefixes.get(prefix).pop();
  58981. });
  58982. }
  58983. if (nsAgnostic) {
  58984. this._nsAgnosticLevel--;
  58985. }
  58986. }
  58987. }
  58988. exports.Builder = Builder;
  58989. /***/ }),
  58990. /* 90 */
  58991. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  58992. Object.defineProperty(exports, "__esModule", ({
  58993. value: true
  58994. }));
  58995. exports.NamespaceSetUp = void 0;
  58996. var _config = __w_pdfjs_require__(91);
  58997. var _connection_set = __w_pdfjs_require__(92);
  58998. var _datasets = __w_pdfjs_require__(93);
  58999. var _locale_set = __w_pdfjs_require__(94);
  59000. var _signature = __w_pdfjs_require__(95);
  59001. var _stylesheet = __w_pdfjs_require__(96);
  59002. var _template = __w_pdfjs_require__(82);
  59003. var _xdp = __w_pdfjs_require__(97);
  59004. var _xhtml = __w_pdfjs_require__(98);
  59005. const NamespaceSetUp = {
  59006. config: _config.ConfigNamespace,
  59007. connection: _connection_set.ConnectionSetNamespace,
  59008. datasets: _datasets.DatasetsNamespace,
  59009. localeSet: _locale_set.LocaleSetNamespace,
  59010. signature: _signature.SignatureNamespace,
  59011. stylesheet: _stylesheet.StylesheetNamespace,
  59012. template: _template.TemplateNamespace,
  59013. xdp: _xdp.XdpNamespace,
  59014. xhtml: _xhtml.XhtmlNamespace
  59015. };
  59016. exports.NamespaceSetUp = NamespaceSetUp;
  59017. /***/ }),
  59018. /* 91 */
  59019. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  59020. Object.defineProperty(exports, "__esModule", ({
  59021. value: true
  59022. }));
  59023. exports.ConfigNamespace = void 0;
  59024. var _namespaces = __w_pdfjs_require__(79);
  59025. var _xfa_object = __w_pdfjs_require__(77);
  59026. var _utils = __w_pdfjs_require__(78);
  59027. var _util = __w_pdfjs_require__(2);
  59028. const CONFIG_NS_ID = _namespaces.NamespaceIds.config.id;
  59029. class Acrobat extends _xfa_object.XFAObject {
  59030. constructor(attributes) {
  59031. super(CONFIG_NS_ID, "acrobat", true);
  59032. this.acrobat7 = null;
  59033. this.autoSave = null;
  59034. this.common = null;
  59035. this.validate = null;
  59036. this.validateApprovalSignatures = null;
  59037. this.submitUrl = new _xfa_object.XFAObjectArray();
  59038. }
  59039. }
  59040. class Acrobat7 extends _xfa_object.XFAObject {
  59041. constructor(attributes) {
  59042. super(CONFIG_NS_ID, "acrobat7", true);
  59043. this.dynamicRender = null;
  59044. }
  59045. }
  59046. class ADBE_JSConsole extends _xfa_object.OptionObject {
  59047. constructor(attributes) {
  59048. super(CONFIG_NS_ID, "ADBE_JSConsole", ["delegate", "Enable", "Disable"]);
  59049. }
  59050. }
  59051. class ADBE_JSDebugger extends _xfa_object.OptionObject {
  59052. constructor(attributes) {
  59053. super(CONFIG_NS_ID, "ADBE_JSDebugger", ["delegate", "Enable", "Disable"]);
  59054. }
  59055. }
  59056. class AddSilentPrint extends _xfa_object.Option01 {
  59057. constructor(attributes) {
  59058. super(CONFIG_NS_ID, "addSilentPrint");
  59059. }
  59060. }
  59061. class AddViewerPreferences extends _xfa_object.Option01 {
  59062. constructor(attributes) {
  59063. super(CONFIG_NS_ID, "addViewerPreferences");
  59064. }
  59065. }
  59066. class AdjustData extends _xfa_object.Option10 {
  59067. constructor(attributes) {
  59068. super(CONFIG_NS_ID, "adjustData");
  59069. }
  59070. }
  59071. class AdobeExtensionLevel extends _xfa_object.IntegerObject {
  59072. constructor(attributes) {
  59073. super(CONFIG_NS_ID, "adobeExtensionLevel", 0, n => n >= 1 && n <= 8);
  59074. }
  59075. }
  59076. class Agent extends _xfa_object.XFAObject {
  59077. constructor(attributes) {
  59078. super(CONFIG_NS_ID, "agent", true);
  59079. this.name = attributes.name ? attributes.name.trim() : "";
  59080. this.common = new _xfa_object.XFAObjectArray();
  59081. }
  59082. }
  59083. class AlwaysEmbed extends _xfa_object.ContentObject {
  59084. constructor(attributes) {
  59085. super(CONFIG_NS_ID, "alwaysEmbed");
  59086. }
  59087. }
  59088. class Amd extends _xfa_object.StringObject {
  59089. constructor(attributes) {
  59090. super(CONFIG_NS_ID, "amd");
  59091. }
  59092. }
  59093. class Area extends _xfa_object.XFAObject {
  59094. constructor(attributes) {
  59095. super(CONFIG_NS_ID, "area");
  59096. this.level = (0, _utils.getInteger)({
  59097. data: attributes.level,
  59098. defaultValue: 0,
  59099. validate: n => n >= 1 && n <= 3
  59100. });
  59101. this.name = (0, _utils.getStringOption)(attributes.name, ["", "barcode", "coreinit", "deviceDriver", "font", "general", "layout", "merge", "script", "signature", "sourceSet", "templateCache"]);
  59102. }
  59103. }
  59104. class Attributes extends _xfa_object.OptionObject {
  59105. constructor(attributes) {
  59106. super(CONFIG_NS_ID, "attributes", ["preserve", "delegate", "ignore"]);
  59107. }
  59108. }
  59109. class AutoSave extends _xfa_object.OptionObject {
  59110. constructor(attributes) {
  59111. super(CONFIG_NS_ID, "autoSave", ["disabled", "enabled"]);
  59112. }
  59113. }
  59114. class Base extends _xfa_object.StringObject {
  59115. constructor(attributes) {
  59116. super(CONFIG_NS_ID, "base");
  59117. }
  59118. }
  59119. class BatchOutput extends _xfa_object.XFAObject {
  59120. constructor(attributes) {
  59121. super(CONFIG_NS_ID, "batchOutput");
  59122. this.format = (0, _utils.getStringOption)(attributes.format, ["none", "concat", "zip", "zipCompress"]);
  59123. }
  59124. }
  59125. class BehaviorOverride extends _xfa_object.ContentObject {
  59126. constructor(attributes) {
  59127. super(CONFIG_NS_ID, "behaviorOverride");
  59128. }
  59129. [_xfa_object.$finalize]() {
  59130. this[_xfa_object.$content] = new Map(this[_xfa_object.$content].trim().split(/\s+/).filter(x => x.includes(":")).map(x => x.split(":", 2)));
  59131. }
  59132. }
  59133. class Cache extends _xfa_object.XFAObject {
  59134. constructor(attributes) {
  59135. super(CONFIG_NS_ID, "cache", true);
  59136. this.templateCache = null;
  59137. }
  59138. }
  59139. class Change extends _xfa_object.Option01 {
  59140. constructor(attributes) {
  59141. super(CONFIG_NS_ID, "change");
  59142. }
  59143. }
  59144. class Common extends _xfa_object.XFAObject {
  59145. constructor(attributes) {
  59146. super(CONFIG_NS_ID, "common", true);
  59147. this.data = null;
  59148. this.locale = null;
  59149. this.localeSet = null;
  59150. this.messaging = null;
  59151. this.suppressBanner = null;
  59152. this.template = null;
  59153. this.validationMessaging = null;
  59154. this.versionControl = null;
  59155. this.log = new _xfa_object.XFAObjectArray();
  59156. }
  59157. }
  59158. class Compress extends _xfa_object.XFAObject {
  59159. constructor(attributes) {
  59160. super(CONFIG_NS_ID, "compress");
  59161. this.scope = (0, _utils.getStringOption)(attributes.scope, ["imageOnly", "document"]);
  59162. }
  59163. }
  59164. class CompressLogicalStructure extends _xfa_object.Option01 {
  59165. constructor(attributes) {
  59166. super(CONFIG_NS_ID, "compressLogicalStructure");
  59167. }
  59168. }
  59169. class CompressObjectStream extends _xfa_object.Option10 {
  59170. constructor(attributes) {
  59171. super(CONFIG_NS_ID, "compressObjectStream");
  59172. }
  59173. }
  59174. class Compression extends _xfa_object.XFAObject {
  59175. constructor(attributes) {
  59176. super(CONFIG_NS_ID, "compression", true);
  59177. this.compressLogicalStructure = null;
  59178. this.compressObjectStream = null;
  59179. this.level = null;
  59180. this.type = null;
  59181. }
  59182. }
  59183. class Config extends _xfa_object.XFAObject {
  59184. constructor(attributes) {
  59185. super(CONFIG_NS_ID, "config", true);
  59186. this.acrobat = null;
  59187. this.present = null;
  59188. this.trace = null;
  59189. this.agent = new _xfa_object.XFAObjectArray();
  59190. }
  59191. }
  59192. class Conformance extends _xfa_object.OptionObject {
  59193. constructor(attributes) {
  59194. super(CONFIG_NS_ID, "conformance", ["A", "B"]);
  59195. }
  59196. }
  59197. class ContentCopy extends _xfa_object.Option01 {
  59198. constructor(attributes) {
  59199. super(CONFIG_NS_ID, "contentCopy");
  59200. }
  59201. }
  59202. class Copies extends _xfa_object.IntegerObject {
  59203. constructor(attributes) {
  59204. super(CONFIG_NS_ID, "copies", 1, n => n >= 1);
  59205. }
  59206. }
  59207. class Creator extends _xfa_object.StringObject {
  59208. constructor(attributes) {
  59209. super(CONFIG_NS_ID, "creator");
  59210. }
  59211. }
  59212. class CurrentPage extends _xfa_object.IntegerObject {
  59213. constructor(attributes) {
  59214. super(CONFIG_NS_ID, "currentPage", 0, n => n >= 0);
  59215. }
  59216. }
  59217. class Data extends _xfa_object.XFAObject {
  59218. constructor(attributes) {
  59219. super(CONFIG_NS_ID, "data", true);
  59220. this.adjustData = null;
  59221. this.attributes = null;
  59222. this.incrementalLoad = null;
  59223. this.outputXSL = null;
  59224. this.range = null;
  59225. this.record = null;
  59226. this.startNode = null;
  59227. this.uri = null;
  59228. this.window = null;
  59229. this.xsl = null;
  59230. this.excludeNS = new _xfa_object.XFAObjectArray();
  59231. this.transform = new _xfa_object.XFAObjectArray();
  59232. }
  59233. }
  59234. class Debug extends _xfa_object.XFAObject {
  59235. constructor(attributes) {
  59236. super(CONFIG_NS_ID, "debug", true);
  59237. this.uri = null;
  59238. }
  59239. }
  59240. class DefaultTypeface extends _xfa_object.ContentObject {
  59241. constructor(attributes) {
  59242. super(CONFIG_NS_ID, "defaultTypeface");
  59243. this.writingScript = (0, _utils.getStringOption)(attributes.writingScript, ["*", "Arabic", "Cyrillic", "EastEuropeanRoman", "Greek", "Hebrew", "Japanese", "Korean", "Roman", "SimplifiedChinese", "Thai", "TraditionalChinese", "Vietnamese"]);
  59244. }
  59245. }
  59246. class Destination extends _xfa_object.OptionObject {
  59247. constructor(attributes) {
  59248. super(CONFIG_NS_ID, "destination", ["pdf", "pcl", "ps", "webClient", "zpl"]);
  59249. }
  59250. }
  59251. class DocumentAssembly extends _xfa_object.Option01 {
  59252. constructor(attributes) {
  59253. super(CONFIG_NS_ID, "documentAssembly");
  59254. }
  59255. }
  59256. class Driver extends _xfa_object.XFAObject {
  59257. constructor(attributes) {
  59258. super(CONFIG_NS_ID, "driver", true);
  59259. this.name = attributes.name ? attributes.name.trim() : "";
  59260. this.fontInfo = null;
  59261. this.xdc = null;
  59262. }
  59263. }
  59264. class DuplexOption extends _xfa_object.OptionObject {
  59265. constructor(attributes) {
  59266. super(CONFIG_NS_ID, "duplexOption", ["simplex", "duplexFlipLongEdge", "duplexFlipShortEdge"]);
  59267. }
  59268. }
  59269. class DynamicRender extends _xfa_object.OptionObject {
  59270. constructor(attributes) {
  59271. super(CONFIG_NS_ID, "dynamicRender", ["forbidden", "required"]);
  59272. }
  59273. }
  59274. class Embed extends _xfa_object.Option01 {
  59275. constructor(attributes) {
  59276. super(CONFIG_NS_ID, "embed");
  59277. }
  59278. }
  59279. class Encrypt extends _xfa_object.Option01 {
  59280. constructor(attributes) {
  59281. super(CONFIG_NS_ID, "encrypt");
  59282. }
  59283. }
  59284. class Encryption extends _xfa_object.XFAObject {
  59285. constructor(attributes) {
  59286. super(CONFIG_NS_ID, "encryption", true);
  59287. this.encrypt = null;
  59288. this.encryptionLevel = null;
  59289. this.permissions = null;
  59290. }
  59291. }
  59292. class EncryptionLevel extends _xfa_object.OptionObject {
  59293. constructor(attributes) {
  59294. super(CONFIG_NS_ID, "encryptionLevel", ["40bit", "128bit"]);
  59295. }
  59296. }
  59297. class Enforce extends _xfa_object.StringObject {
  59298. constructor(attributes) {
  59299. super(CONFIG_NS_ID, "enforce");
  59300. }
  59301. }
  59302. class Equate extends _xfa_object.XFAObject {
  59303. constructor(attributes) {
  59304. super(CONFIG_NS_ID, "equate");
  59305. this.force = (0, _utils.getInteger)({
  59306. data: attributes.force,
  59307. defaultValue: 1,
  59308. validate: n => n === 0
  59309. });
  59310. this.from = attributes.from || "";
  59311. this.to = attributes.to || "";
  59312. }
  59313. }
  59314. class EquateRange extends _xfa_object.XFAObject {
  59315. constructor(attributes) {
  59316. super(CONFIG_NS_ID, "equateRange");
  59317. this.from = attributes.from || "";
  59318. this.to = attributes.to || "";
  59319. this._unicodeRange = attributes.unicodeRange || "";
  59320. }
  59321. get unicodeRange() {
  59322. const ranges = [];
  59323. const unicodeRegex = /U\+([0-9a-fA-F]+)/;
  59324. const unicodeRange = this._unicodeRange;
  59325. for (let range of unicodeRange.split(",").map(x => x.trim()).filter(x => !!x)) {
  59326. range = range.split("-", 2).map(x => {
  59327. const found = x.match(unicodeRegex);
  59328. if (!found) {
  59329. return 0;
  59330. }
  59331. return parseInt(found[1], 16);
  59332. });
  59333. if (range.length === 1) {
  59334. range.push(range[0]);
  59335. }
  59336. ranges.push(range);
  59337. }
  59338. return (0, _util.shadow)(this, "unicodeRange", ranges);
  59339. }
  59340. }
  59341. class Exclude extends _xfa_object.ContentObject {
  59342. constructor(attributes) {
  59343. super(CONFIG_NS_ID, "exclude");
  59344. }
  59345. [_xfa_object.$finalize]() {
  59346. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => x && ["calculate", "close", "enter", "exit", "initialize", "ready", "validate"].includes(x));
  59347. }
  59348. }
  59349. class ExcludeNS extends _xfa_object.StringObject {
  59350. constructor(attributes) {
  59351. super(CONFIG_NS_ID, "excludeNS");
  59352. }
  59353. }
  59354. class FlipLabel extends _xfa_object.OptionObject {
  59355. constructor(attributes) {
  59356. super(CONFIG_NS_ID, "flipLabel", ["usePrinterSetting", "on", "off"]);
  59357. }
  59358. }
  59359. class FontInfo extends _xfa_object.XFAObject {
  59360. constructor(attributes) {
  59361. super(CONFIG_NS_ID, "fontInfo", true);
  59362. this.embed = null;
  59363. this.map = null;
  59364. this.subsetBelow = null;
  59365. this.alwaysEmbed = new _xfa_object.XFAObjectArray();
  59366. this.defaultTypeface = new _xfa_object.XFAObjectArray();
  59367. this.neverEmbed = new _xfa_object.XFAObjectArray();
  59368. }
  59369. }
  59370. class FormFieldFilling extends _xfa_object.Option01 {
  59371. constructor(attributes) {
  59372. super(CONFIG_NS_ID, "formFieldFilling");
  59373. }
  59374. }
  59375. class GroupParent extends _xfa_object.StringObject {
  59376. constructor(attributes) {
  59377. super(CONFIG_NS_ID, "groupParent");
  59378. }
  59379. }
  59380. class IfEmpty extends _xfa_object.OptionObject {
  59381. constructor(attributes) {
  59382. super(CONFIG_NS_ID, "ifEmpty", ["dataValue", "dataGroup", "ignore", "remove"]);
  59383. }
  59384. }
  59385. class IncludeXDPContent extends _xfa_object.StringObject {
  59386. constructor(attributes) {
  59387. super(CONFIG_NS_ID, "includeXDPContent");
  59388. }
  59389. }
  59390. class IncrementalLoad extends _xfa_object.OptionObject {
  59391. constructor(attributes) {
  59392. super(CONFIG_NS_ID, "incrementalLoad", ["none", "forwardOnly"]);
  59393. }
  59394. }
  59395. class IncrementalMerge extends _xfa_object.Option01 {
  59396. constructor(attributes) {
  59397. super(CONFIG_NS_ID, "incrementalMerge");
  59398. }
  59399. }
  59400. class Interactive extends _xfa_object.Option01 {
  59401. constructor(attributes) {
  59402. super(CONFIG_NS_ID, "interactive");
  59403. }
  59404. }
  59405. class Jog extends _xfa_object.OptionObject {
  59406. constructor(attributes) {
  59407. super(CONFIG_NS_ID, "jog", ["usePrinterSetting", "none", "pageSet"]);
  59408. }
  59409. }
  59410. class LabelPrinter extends _xfa_object.XFAObject {
  59411. constructor(attributes) {
  59412. super(CONFIG_NS_ID, "labelPrinter", true);
  59413. this.name = (0, _utils.getStringOption)(attributes.name, ["zpl", "dpl", "ipl", "tcpl"]);
  59414. this.batchOutput = null;
  59415. this.flipLabel = null;
  59416. this.fontInfo = null;
  59417. this.xdc = null;
  59418. }
  59419. }
  59420. class Layout extends _xfa_object.OptionObject {
  59421. constructor(attributes) {
  59422. super(CONFIG_NS_ID, "layout", ["paginate", "panel"]);
  59423. }
  59424. }
  59425. class Level extends _xfa_object.IntegerObject {
  59426. constructor(attributes) {
  59427. super(CONFIG_NS_ID, "level", 0, n => n > 0);
  59428. }
  59429. }
  59430. class Linearized extends _xfa_object.Option01 {
  59431. constructor(attributes) {
  59432. super(CONFIG_NS_ID, "linearized");
  59433. }
  59434. }
  59435. class Locale extends _xfa_object.StringObject {
  59436. constructor(attributes) {
  59437. super(CONFIG_NS_ID, "locale");
  59438. }
  59439. }
  59440. class LocaleSet extends _xfa_object.StringObject {
  59441. constructor(attributes) {
  59442. super(CONFIG_NS_ID, "localeSet");
  59443. }
  59444. }
  59445. class Log extends _xfa_object.XFAObject {
  59446. constructor(attributes) {
  59447. super(CONFIG_NS_ID, "log", true);
  59448. this.mode = null;
  59449. this.threshold = null;
  59450. this.to = null;
  59451. this.uri = null;
  59452. }
  59453. }
  59454. class MapElement extends _xfa_object.XFAObject {
  59455. constructor(attributes) {
  59456. super(CONFIG_NS_ID, "map", true);
  59457. this.equate = new _xfa_object.XFAObjectArray();
  59458. this.equateRange = new _xfa_object.XFAObjectArray();
  59459. }
  59460. }
  59461. class MediumInfo extends _xfa_object.XFAObject {
  59462. constructor(attributes) {
  59463. super(CONFIG_NS_ID, "mediumInfo", true);
  59464. this.map = null;
  59465. }
  59466. }
  59467. class Message extends _xfa_object.XFAObject {
  59468. constructor(attributes) {
  59469. super(CONFIG_NS_ID, "message", true);
  59470. this.msgId = null;
  59471. this.severity = null;
  59472. }
  59473. }
  59474. class Messaging extends _xfa_object.XFAObject {
  59475. constructor(attributes) {
  59476. super(CONFIG_NS_ID, "messaging", true);
  59477. this.message = new _xfa_object.XFAObjectArray();
  59478. }
  59479. }
  59480. class Mode extends _xfa_object.OptionObject {
  59481. constructor(attributes) {
  59482. super(CONFIG_NS_ID, "mode", ["append", "overwrite"]);
  59483. }
  59484. }
  59485. class ModifyAnnots extends _xfa_object.Option01 {
  59486. constructor(attributes) {
  59487. super(CONFIG_NS_ID, "modifyAnnots");
  59488. }
  59489. }
  59490. class MsgId extends _xfa_object.IntegerObject {
  59491. constructor(attributes) {
  59492. super(CONFIG_NS_ID, "msgId", 1, n => n >= 1);
  59493. }
  59494. }
  59495. class NameAttr extends _xfa_object.StringObject {
  59496. constructor(attributes) {
  59497. super(CONFIG_NS_ID, "nameAttr");
  59498. }
  59499. }
  59500. class NeverEmbed extends _xfa_object.ContentObject {
  59501. constructor(attributes) {
  59502. super(CONFIG_NS_ID, "neverEmbed");
  59503. }
  59504. }
  59505. class NumberOfCopies extends _xfa_object.IntegerObject {
  59506. constructor(attributes) {
  59507. super(CONFIG_NS_ID, "numberOfCopies", null, n => n >= 2 && n <= 5);
  59508. }
  59509. }
  59510. class OpenAction extends _xfa_object.XFAObject {
  59511. constructor(attributes) {
  59512. super(CONFIG_NS_ID, "openAction", true);
  59513. this.destination = null;
  59514. }
  59515. }
  59516. class Output extends _xfa_object.XFAObject {
  59517. constructor(attributes) {
  59518. super(CONFIG_NS_ID, "output", true);
  59519. this.to = null;
  59520. this.type = null;
  59521. this.uri = null;
  59522. }
  59523. }
  59524. class OutputBin extends _xfa_object.StringObject {
  59525. constructor(attributes) {
  59526. super(CONFIG_NS_ID, "outputBin");
  59527. }
  59528. }
  59529. class OutputXSL extends _xfa_object.XFAObject {
  59530. constructor(attributes) {
  59531. super(CONFIG_NS_ID, "outputXSL", true);
  59532. this.uri = null;
  59533. }
  59534. }
  59535. class Overprint extends _xfa_object.OptionObject {
  59536. constructor(attributes) {
  59537. super(CONFIG_NS_ID, "overprint", ["none", "both", "draw", "field"]);
  59538. }
  59539. }
  59540. class Packets extends _xfa_object.StringObject {
  59541. constructor(attributes) {
  59542. super(CONFIG_NS_ID, "packets");
  59543. }
  59544. [_xfa_object.$finalize]() {
  59545. if (this[_xfa_object.$content] === "*") {
  59546. return;
  59547. }
  59548. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["config", "datasets", "template", "xfdf", "xslt"].includes(x));
  59549. }
  59550. }
  59551. class PageOffset extends _xfa_object.XFAObject {
  59552. constructor(attributes) {
  59553. super(CONFIG_NS_ID, "pageOffset");
  59554. this.x = (0, _utils.getInteger)({
  59555. data: attributes.x,
  59556. defaultValue: "useXDCSetting",
  59557. validate: n => true
  59558. });
  59559. this.y = (0, _utils.getInteger)({
  59560. data: attributes.y,
  59561. defaultValue: "useXDCSetting",
  59562. validate: n => true
  59563. });
  59564. }
  59565. }
  59566. class PageRange extends _xfa_object.StringObject {
  59567. constructor(attributes) {
  59568. super(CONFIG_NS_ID, "pageRange");
  59569. }
  59570. [_xfa_object.$finalize]() {
  59571. const numbers = this[_xfa_object.$content].trim().split(/\s+/).map(x => parseInt(x, 10));
  59572. const ranges = [];
  59573. for (let i = 0, ii = numbers.length; i < ii; i += 2) {
  59574. ranges.push(numbers.slice(i, i + 2));
  59575. }
  59576. this[_xfa_object.$content] = ranges;
  59577. }
  59578. }
  59579. class Pagination extends _xfa_object.OptionObject {
  59580. constructor(attributes) {
  59581. super(CONFIG_NS_ID, "pagination", ["simplex", "duplexShortEdge", "duplexLongEdge"]);
  59582. }
  59583. }
  59584. class PaginationOverride extends _xfa_object.OptionObject {
  59585. constructor(attributes) {
  59586. super(CONFIG_NS_ID, "paginationOverride", ["none", "forceDuplex", "forceDuplexLongEdge", "forceDuplexShortEdge", "forceSimplex"]);
  59587. }
  59588. }
  59589. class Part extends _xfa_object.IntegerObject {
  59590. constructor(attributes) {
  59591. super(CONFIG_NS_ID, "part", 1, n => false);
  59592. }
  59593. }
  59594. class Pcl extends _xfa_object.XFAObject {
  59595. constructor(attributes) {
  59596. super(CONFIG_NS_ID, "pcl", true);
  59597. this.name = attributes.name || "";
  59598. this.batchOutput = null;
  59599. this.fontInfo = null;
  59600. this.jog = null;
  59601. this.mediumInfo = null;
  59602. this.outputBin = null;
  59603. this.pageOffset = null;
  59604. this.staple = null;
  59605. this.xdc = null;
  59606. }
  59607. }
  59608. class Pdf extends _xfa_object.XFAObject {
  59609. constructor(attributes) {
  59610. super(CONFIG_NS_ID, "pdf", true);
  59611. this.name = attributes.name || "";
  59612. this.adobeExtensionLevel = null;
  59613. this.batchOutput = null;
  59614. this.compression = null;
  59615. this.creator = null;
  59616. this.encryption = null;
  59617. this.fontInfo = null;
  59618. this.interactive = null;
  59619. this.linearized = null;
  59620. this.openAction = null;
  59621. this.pdfa = null;
  59622. this.producer = null;
  59623. this.renderPolicy = null;
  59624. this.scriptModel = null;
  59625. this.silentPrint = null;
  59626. this.submitFormat = null;
  59627. this.tagged = null;
  59628. this.version = null;
  59629. this.viewerPreferences = null;
  59630. this.xdc = null;
  59631. }
  59632. }
  59633. class Pdfa extends _xfa_object.XFAObject {
  59634. constructor(attributes) {
  59635. super(CONFIG_NS_ID, "pdfa", true);
  59636. this.amd = null;
  59637. this.conformance = null;
  59638. this.includeXDPContent = null;
  59639. this.part = null;
  59640. }
  59641. }
  59642. class Permissions extends _xfa_object.XFAObject {
  59643. constructor(attributes) {
  59644. super(CONFIG_NS_ID, "permissions", true);
  59645. this.accessibleContent = null;
  59646. this.change = null;
  59647. this.contentCopy = null;
  59648. this.documentAssembly = null;
  59649. this.formFieldFilling = null;
  59650. this.modifyAnnots = null;
  59651. this.plaintextMetadata = null;
  59652. this.print = null;
  59653. this.printHighQuality = null;
  59654. }
  59655. }
  59656. class PickTrayByPDFSize extends _xfa_object.Option01 {
  59657. constructor(attributes) {
  59658. super(CONFIG_NS_ID, "pickTrayByPDFSize");
  59659. }
  59660. }
  59661. class Picture extends _xfa_object.StringObject {
  59662. constructor(attributes) {
  59663. super(CONFIG_NS_ID, "picture");
  59664. }
  59665. }
  59666. class PlaintextMetadata extends _xfa_object.Option01 {
  59667. constructor(attributes) {
  59668. super(CONFIG_NS_ID, "plaintextMetadata");
  59669. }
  59670. }
  59671. class Presence extends _xfa_object.OptionObject {
  59672. constructor(attributes) {
  59673. super(CONFIG_NS_ID, "presence", ["preserve", "dissolve", "dissolveStructure", "ignore", "remove"]);
  59674. }
  59675. }
  59676. class Present extends _xfa_object.XFAObject {
  59677. constructor(attributes) {
  59678. super(CONFIG_NS_ID, "present", true);
  59679. this.behaviorOverride = null;
  59680. this.cache = null;
  59681. this.common = null;
  59682. this.copies = null;
  59683. this.destination = null;
  59684. this.incrementalMerge = null;
  59685. this.layout = null;
  59686. this.output = null;
  59687. this.overprint = null;
  59688. this.pagination = null;
  59689. this.paginationOverride = null;
  59690. this.script = null;
  59691. this.validate = null;
  59692. this.xdp = null;
  59693. this.driver = new _xfa_object.XFAObjectArray();
  59694. this.labelPrinter = new _xfa_object.XFAObjectArray();
  59695. this.pcl = new _xfa_object.XFAObjectArray();
  59696. this.pdf = new _xfa_object.XFAObjectArray();
  59697. this.ps = new _xfa_object.XFAObjectArray();
  59698. this.submitUrl = new _xfa_object.XFAObjectArray();
  59699. this.webClient = new _xfa_object.XFAObjectArray();
  59700. this.zpl = new _xfa_object.XFAObjectArray();
  59701. }
  59702. }
  59703. class Print extends _xfa_object.Option01 {
  59704. constructor(attributes) {
  59705. super(CONFIG_NS_ID, "print");
  59706. }
  59707. }
  59708. class PrintHighQuality extends _xfa_object.Option01 {
  59709. constructor(attributes) {
  59710. super(CONFIG_NS_ID, "printHighQuality");
  59711. }
  59712. }
  59713. class PrintScaling extends _xfa_object.OptionObject {
  59714. constructor(attributes) {
  59715. super(CONFIG_NS_ID, "printScaling", ["appdefault", "noScaling"]);
  59716. }
  59717. }
  59718. class PrinterName extends _xfa_object.StringObject {
  59719. constructor(attributes) {
  59720. super(CONFIG_NS_ID, "printerName");
  59721. }
  59722. }
  59723. class Producer extends _xfa_object.StringObject {
  59724. constructor(attributes) {
  59725. super(CONFIG_NS_ID, "producer");
  59726. }
  59727. }
  59728. class Ps extends _xfa_object.XFAObject {
  59729. constructor(attributes) {
  59730. super(CONFIG_NS_ID, "ps", true);
  59731. this.name = attributes.name || "";
  59732. this.batchOutput = null;
  59733. this.fontInfo = null;
  59734. this.jog = null;
  59735. this.mediumInfo = null;
  59736. this.outputBin = null;
  59737. this.staple = null;
  59738. this.xdc = null;
  59739. }
  59740. }
  59741. class Range extends _xfa_object.ContentObject {
  59742. constructor(attributes) {
  59743. super(CONFIG_NS_ID, "range");
  59744. }
  59745. [_xfa_object.$finalize]() {
  59746. this[_xfa_object.$content] = this[_xfa_object.$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 => {
  59747. if (range.length === 1) {
  59748. range.push(range[0]);
  59749. }
  59750. return range;
  59751. });
  59752. }
  59753. }
  59754. class Record extends _xfa_object.ContentObject {
  59755. constructor(attributes) {
  59756. super(CONFIG_NS_ID, "record");
  59757. }
  59758. [_xfa_object.$finalize]() {
  59759. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59760. const n = parseInt(this[_xfa_object.$content], 10);
  59761. if (!isNaN(n) && n >= 0) {
  59762. this[_xfa_object.$content] = n;
  59763. }
  59764. }
  59765. }
  59766. class Relevant extends _xfa_object.ContentObject {
  59767. constructor(attributes) {
  59768. super(CONFIG_NS_ID, "relevant");
  59769. }
  59770. [_xfa_object.$finalize]() {
  59771. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/);
  59772. }
  59773. }
  59774. class Rename extends _xfa_object.ContentObject {
  59775. constructor(attributes) {
  59776. super(CONFIG_NS_ID, "rename");
  59777. }
  59778. [_xfa_object.$finalize]() {
  59779. this[_xfa_object.$content] = this[_xfa_object.$content].trim();
  59780. if (this[_xfa_object.$content].toLowerCase().startsWith("xml") || this[_xfa_object.$content].match(new RegExp("[\\p{L}_][\\p{L}\\d._\\p{M}-]*", "u"))) {
  59781. (0, _util.warn)("XFA - Rename: invalid XFA name");
  59782. }
  59783. }
  59784. }
  59785. class RenderPolicy extends _xfa_object.OptionObject {
  59786. constructor(attributes) {
  59787. super(CONFIG_NS_ID, "renderPolicy", ["server", "client"]);
  59788. }
  59789. }
  59790. class RunScripts extends _xfa_object.OptionObject {
  59791. constructor(attributes) {
  59792. super(CONFIG_NS_ID, "runScripts", ["both", "client", "none", "server"]);
  59793. }
  59794. }
  59795. class Script extends _xfa_object.XFAObject {
  59796. constructor(attributes) {
  59797. super(CONFIG_NS_ID, "script", true);
  59798. this.currentPage = null;
  59799. this.exclude = null;
  59800. this.runScripts = null;
  59801. }
  59802. }
  59803. class ScriptModel extends _xfa_object.OptionObject {
  59804. constructor(attributes) {
  59805. super(CONFIG_NS_ID, "scriptModel", ["XFA", "none"]);
  59806. }
  59807. }
  59808. class Severity extends _xfa_object.OptionObject {
  59809. constructor(attributes) {
  59810. super(CONFIG_NS_ID, "severity", ["ignore", "error", "information", "trace", "warning"]);
  59811. }
  59812. }
  59813. class SilentPrint extends _xfa_object.XFAObject {
  59814. constructor(attributes) {
  59815. super(CONFIG_NS_ID, "silentPrint", true);
  59816. this.addSilentPrint = null;
  59817. this.printerName = null;
  59818. }
  59819. }
  59820. class Staple extends _xfa_object.XFAObject {
  59821. constructor(attributes) {
  59822. super(CONFIG_NS_ID, "staple");
  59823. this.mode = (0, _utils.getStringOption)(attributes.mode, ["usePrinterSetting", "on", "off"]);
  59824. }
  59825. }
  59826. class StartNode extends _xfa_object.StringObject {
  59827. constructor(attributes) {
  59828. super(CONFIG_NS_ID, "startNode");
  59829. }
  59830. }
  59831. class StartPage extends _xfa_object.IntegerObject {
  59832. constructor(attributes) {
  59833. super(CONFIG_NS_ID, "startPage", 0, n => true);
  59834. }
  59835. }
  59836. class SubmitFormat extends _xfa_object.OptionObject {
  59837. constructor(attributes) {
  59838. super(CONFIG_NS_ID, "submitFormat", ["html", "delegate", "fdf", "xml", "pdf"]);
  59839. }
  59840. }
  59841. class SubmitUrl extends _xfa_object.StringObject {
  59842. constructor(attributes) {
  59843. super(CONFIG_NS_ID, "submitUrl");
  59844. }
  59845. }
  59846. class SubsetBelow extends _xfa_object.IntegerObject {
  59847. constructor(attributes) {
  59848. super(CONFIG_NS_ID, "subsetBelow", 100, n => n >= 0 && n <= 100);
  59849. }
  59850. }
  59851. class SuppressBanner extends _xfa_object.Option01 {
  59852. constructor(attributes) {
  59853. super(CONFIG_NS_ID, "suppressBanner");
  59854. }
  59855. }
  59856. class Tagged extends _xfa_object.Option01 {
  59857. constructor(attributes) {
  59858. super(CONFIG_NS_ID, "tagged");
  59859. }
  59860. }
  59861. class Template extends _xfa_object.XFAObject {
  59862. constructor(attributes) {
  59863. super(CONFIG_NS_ID, "template", true);
  59864. this.base = null;
  59865. this.relevant = null;
  59866. this.startPage = null;
  59867. this.uri = null;
  59868. this.xsl = null;
  59869. }
  59870. }
  59871. class Threshold extends _xfa_object.OptionObject {
  59872. constructor(attributes) {
  59873. super(CONFIG_NS_ID, "threshold", ["trace", "error", "information", "warning"]);
  59874. }
  59875. }
  59876. class To extends _xfa_object.OptionObject {
  59877. constructor(attributes) {
  59878. super(CONFIG_NS_ID, "to", ["null", "memory", "stderr", "stdout", "system", "uri"]);
  59879. }
  59880. }
  59881. class TemplateCache extends _xfa_object.XFAObject {
  59882. constructor(attributes) {
  59883. super(CONFIG_NS_ID, "templateCache");
  59884. this.maxEntries = (0, _utils.getInteger)({
  59885. data: attributes.maxEntries,
  59886. defaultValue: 5,
  59887. validate: n => n >= 0
  59888. });
  59889. }
  59890. }
  59891. class Trace extends _xfa_object.XFAObject {
  59892. constructor(attributes) {
  59893. super(CONFIG_NS_ID, "trace", true);
  59894. this.area = new _xfa_object.XFAObjectArray();
  59895. }
  59896. }
  59897. class Transform extends _xfa_object.XFAObject {
  59898. constructor(attributes) {
  59899. super(CONFIG_NS_ID, "transform", true);
  59900. this.groupParent = null;
  59901. this.ifEmpty = null;
  59902. this.nameAttr = null;
  59903. this.picture = null;
  59904. this.presence = null;
  59905. this.rename = null;
  59906. this.whitespace = null;
  59907. }
  59908. }
  59909. class Type extends _xfa_object.OptionObject {
  59910. constructor(attributes) {
  59911. super(CONFIG_NS_ID, "type", ["none", "ascii85", "asciiHex", "ccittfax", "flate", "lzw", "runLength", "native", "xdp", "mergedXDP"]);
  59912. }
  59913. }
  59914. class Uri extends _xfa_object.StringObject {
  59915. constructor(attributes) {
  59916. super(CONFIG_NS_ID, "uri");
  59917. }
  59918. }
  59919. class Validate extends _xfa_object.OptionObject {
  59920. constructor(attributes) {
  59921. super(CONFIG_NS_ID, "validate", ["preSubmit", "prePrint", "preExecute", "preSave"]);
  59922. }
  59923. }
  59924. class ValidateApprovalSignatures extends _xfa_object.ContentObject {
  59925. constructor(attributes) {
  59926. super(CONFIG_NS_ID, "validateApprovalSignatures");
  59927. }
  59928. [_xfa_object.$finalize]() {
  59929. this[_xfa_object.$content] = this[_xfa_object.$content].trim().split(/\s+/).filter(x => ["docReady", "postSign"].includes(x));
  59930. }
  59931. }
  59932. class ValidationMessaging extends _xfa_object.OptionObject {
  59933. constructor(attributes) {
  59934. super(CONFIG_NS_ID, "validationMessaging", ["allMessagesIndividually", "allMessagesTogether", "firstMessageOnly", "noMessages"]);
  59935. }
  59936. }
  59937. class Version extends _xfa_object.OptionObject {
  59938. constructor(attributes) {
  59939. super(CONFIG_NS_ID, "version", ["1.7", "1.6", "1.5", "1.4", "1.3", "1.2"]);
  59940. }
  59941. }
  59942. class VersionControl extends _xfa_object.XFAObject {
  59943. constructor(attributes) {
  59944. super(CONFIG_NS_ID, "VersionControl");
  59945. this.outputBelow = (0, _utils.getStringOption)(attributes.outputBelow, ["warn", "error", "update"]);
  59946. this.sourceAbove = (0, _utils.getStringOption)(attributes.sourceAbove, ["warn", "error"]);
  59947. this.sourceBelow = (0, _utils.getStringOption)(attributes.sourceBelow, ["update", "maintain"]);
  59948. }
  59949. }
  59950. class ViewerPreferences extends _xfa_object.XFAObject {
  59951. constructor(attributes) {
  59952. super(CONFIG_NS_ID, "viewerPreferences", true);
  59953. this.ADBE_JSConsole = null;
  59954. this.ADBE_JSDebugger = null;
  59955. this.addViewerPreferences = null;
  59956. this.duplexOption = null;
  59957. this.enforce = null;
  59958. this.numberOfCopies = null;
  59959. this.pageRange = null;
  59960. this.pickTrayByPDFSize = null;
  59961. this.printScaling = null;
  59962. }
  59963. }
  59964. class WebClient extends _xfa_object.XFAObject {
  59965. constructor(attributes) {
  59966. super(CONFIG_NS_ID, "webClient", true);
  59967. this.name = attributes.name ? attributes.name.trim() : "";
  59968. this.fontInfo = null;
  59969. this.xdc = null;
  59970. }
  59971. }
  59972. class Whitespace extends _xfa_object.OptionObject {
  59973. constructor(attributes) {
  59974. super(CONFIG_NS_ID, "whitespace", ["preserve", "ltrim", "normalize", "rtrim", "trim"]);
  59975. }
  59976. }
  59977. class Window extends _xfa_object.ContentObject {
  59978. constructor(attributes) {
  59979. super(CONFIG_NS_ID, "window");
  59980. }
  59981. [_xfa_object.$finalize]() {
  59982. const pair = this[_xfa_object.$content].trim().split(/\s*,\s*/, 2).map(x => parseInt(x, 10));
  59983. if (pair.some(x => isNaN(x))) {
  59984. this[_xfa_object.$content] = [0, 0];
  59985. return;
  59986. }
  59987. if (pair.length === 1) {
  59988. pair.push(pair[0]);
  59989. }
  59990. this[_xfa_object.$content] = pair;
  59991. }
  59992. }
  59993. class Xdc extends _xfa_object.XFAObject {
  59994. constructor(attributes) {
  59995. super(CONFIG_NS_ID, "xdc", true);
  59996. this.uri = new _xfa_object.XFAObjectArray();
  59997. this.xsl = new _xfa_object.XFAObjectArray();
  59998. }
  59999. }
  60000. class Xdp extends _xfa_object.XFAObject {
  60001. constructor(attributes) {
  60002. super(CONFIG_NS_ID, "xdp", true);
  60003. this.packets = null;
  60004. }
  60005. }
  60006. class Xsl extends _xfa_object.XFAObject {
  60007. constructor(attributes) {
  60008. super(CONFIG_NS_ID, "xsl", true);
  60009. this.debug = null;
  60010. this.uri = null;
  60011. }
  60012. }
  60013. class Zpl extends _xfa_object.XFAObject {
  60014. constructor(attributes) {
  60015. super(CONFIG_NS_ID, "zpl", true);
  60016. this.name = attributes.name ? attributes.name.trim() : "";
  60017. this.batchOutput = null;
  60018. this.flipLabel = null;
  60019. this.fontInfo = null;
  60020. this.xdc = null;
  60021. }
  60022. }
  60023. class ConfigNamespace {
  60024. static [_namespaces.$buildXFAObject](name, attributes) {
  60025. if (ConfigNamespace.hasOwnProperty(name)) {
  60026. return ConfigNamespace[name](attributes);
  60027. }
  60028. return undefined;
  60029. }
  60030. static acrobat(attrs) {
  60031. return new Acrobat(attrs);
  60032. }
  60033. static acrobat7(attrs) {
  60034. return new Acrobat7(attrs);
  60035. }
  60036. static ADBE_JSConsole(attrs) {
  60037. return new ADBE_JSConsole(attrs);
  60038. }
  60039. static ADBE_JSDebugger(attrs) {
  60040. return new ADBE_JSDebugger(attrs);
  60041. }
  60042. static addSilentPrint(attrs) {
  60043. return new AddSilentPrint(attrs);
  60044. }
  60045. static addViewerPreferences(attrs) {
  60046. return new AddViewerPreferences(attrs);
  60047. }
  60048. static adjustData(attrs) {
  60049. return new AdjustData(attrs);
  60050. }
  60051. static adobeExtensionLevel(attrs) {
  60052. return new AdobeExtensionLevel(attrs);
  60053. }
  60054. static agent(attrs) {
  60055. return new Agent(attrs);
  60056. }
  60057. static alwaysEmbed(attrs) {
  60058. return new AlwaysEmbed(attrs);
  60059. }
  60060. static amd(attrs) {
  60061. return new Amd(attrs);
  60062. }
  60063. static area(attrs) {
  60064. return new Area(attrs);
  60065. }
  60066. static attributes(attrs) {
  60067. return new Attributes(attrs);
  60068. }
  60069. static autoSave(attrs) {
  60070. return new AutoSave(attrs);
  60071. }
  60072. static base(attrs) {
  60073. return new Base(attrs);
  60074. }
  60075. static batchOutput(attrs) {
  60076. return new BatchOutput(attrs);
  60077. }
  60078. static behaviorOverride(attrs) {
  60079. return new BehaviorOverride(attrs);
  60080. }
  60081. static cache(attrs) {
  60082. return new Cache(attrs);
  60083. }
  60084. static change(attrs) {
  60085. return new Change(attrs);
  60086. }
  60087. static common(attrs) {
  60088. return new Common(attrs);
  60089. }
  60090. static compress(attrs) {
  60091. return new Compress(attrs);
  60092. }
  60093. static compressLogicalStructure(attrs) {
  60094. return new CompressLogicalStructure(attrs);
  60095. }
  60096. static compressObjectStream(attrs) {
  60097. return new CompressObjectStream(attrs);
  60098. }
  60099. static compression(attrs) {
  60100. return new Compression(attrs);
  60101. }
  60102. static config(attrs) {
  60103. return new Config(attrs);
  60104. }
  60105. static conformance(attrs) {
  60106. return new Conformance(attrs);
  60107. }
  60108. static contentCopy(attrs) {
  60109. return new ContentCopy(attrs);
  60110. }
  60111. static copies(attrs) {
  60112. return new Copies(attrs);
  60113. }
  60114. static creator(attrs) {
  60115. return new Creator(attrs);
  60116. }
  60117. static currentPage(attrs) {
  60118. return new CurrentPage(attrs);
  60119. }
  60120. static data(attrs) {
  60121. return new Data(attrs);
  60122. }
  60123. static debug(attrs) {
  60124. return new Debug(attrs);
  60125. }
  60126. static defaultTypeface(attrs) {
  60127. return new DefaultTypeface(attrs);
  60128. }
  60129. static destination(attrs) {
  60130. return new Destination(attrs);
  60131. }
  60132. static documentAssembly(attrs) {
  60133. return new DocumentAssembly(attrs);
  60134. }
  60135. static driver(attrs) {
  60136. return new Driver(attrs);
  60137. }
  60138. static duplexOption(attrs) {
  60139. return new DuplexOption(attrs);
  60140. }
  60141. static dynamicRender(attrs) {
  60142. return new DynamicRender(attrs);
  60143. }
  60144. static embed(attrs) {
  60145. return new Embed(attrs);
  60146. }
  60147. static encrypt(attrs) {
  60148. return new Encrypt(attrs);
  60149. }
  60150. static encryption(attrs) {
  60151. return new Encryption(attrs);
  60152. }
  60153. static encryptionLevel(attrs) {
  60154. return new EncryptionLevel(attrs);
  60155. }
  60156. static enforce(attrs) {
  60157. return new Enforce(attrs);
  60158. }
  60159. static equate(attrs) {
  60160. return new Equate(attrs);
  60161. }
  60162. static equateRange(attrs) {
  60163. return new EquateRange(attrs);
  60164. }
  60165. static exclude(attrs) {
  60166. return new Exclude(attrs);
  60167. }
  60168. static excludeNS(attrs) {
  60169. return new ExcludeNS(attrs);
  60170. }
  60171. static flipLabel(attrs) {
  60172. return new FlipLabel(attrs);
  60173. }
  60174. static fontInfo(attrs) {
  60175. return new FontInfo(attrs);
  60176. }
  60177. static formFieldFilling(attrs) {
  60178. return new FormFieldFilling(attrs);
  60179. }
  60180. static groupParent(attrs) {
  60181. return new GroupParent(attrs);
  60182. }
  60183. static ifEmpty(attrs) {
  60184. return new IfEmpty(attrs);
  60185. }
  60186. static includeXDPContent(attrs) {
  60187. return new IncludeXDPContent(attrs);
  60188. }
  60189. static incrementalLoad(attrs) {
  60190. return new IncrementalLoad(attrs);
  60191. }
  60192. static incrementalMerge(attrs) {
  60193. return new IncrementalMerge(attrs);
  60194. }
  60195. static interactive(attrs) {
  60196. return new Interactive(attrs);
  60197. }
  60198. static jog(attrs) {
  60199. return new Jog(attrs);
  60200. }
  60201. static labelPrinter(attrs) {
  60202. return new LabelPrinter(attrs);
  60203. }
  60204. static layout(attrs) {
  60205. return new Layout(attrs);
  60206. }
  60207. static level(attrs) {
  60208. return new Level(attrs);
  60209. }
  60210. static linearized(attrs) {
  60211. return new Linearized(attrs);
  60212. }
  60213. static locale(attrs) {
  60214. return new Locale(attrs);
  60215. }
  60216. static localeSet(attrs) {
  60217. return new LocaleSet(attrs);
  60218. }
  60219. static log(attrs) {
  60220. return new Log(attrs);
  60221. }
  60222. static map(attrs) {
  60223. return new MapElement(attrs);
  60224. }
  60225. static mediumInfo(attrs) {
  60226. return new MediumInfo(attrs);
  60227. }
  60228. static message(attrs) {
  60229. return new Message(attrs);
  60230. }
  60231. static messaging(attrs) {
  60232. return new Messaging(attrs);
  60233. }
  60234. static mode(attrs) {
  60235. return new Mode(attrs);
  60236. }
  60237. static modifyAnnots(attrs) {
  60238. return new ModifyAnnots(attrs);
  60239. }
  60240. static msgId(attrs) {
  60241. return new MsgId(attrs);
  60242. }
  60243. static nameAttr(attrs) {
  60244. return new NameAttr(attrs);
  60245. }
  60246. static neverEmbed(attrs) {
  60247. return new NeverEmbed(attrs);
  60248. }
  60249. static numberOfCopies(attrs) {
  60250. return new NumberOfCopies(attrs);
  60251. }
  60252. static openAction(attrs) {
  60253. return new OpenAction(attrs);
  60254. }
  60255. static output(attrs) {
  60256. return new Output(attrs);
  60257. }
  60258. static outputBin(attrs) {
  60259. return new OutputBin(attrs);
  60260. }
  60261. static outputXSL(attrs) {
  60262. return new OutputXSL(attrs);
  60263. }
  60264. static overprint(attrs) {
  60265. return new Overprint(attrs);
  60266. }
  60267. static packets(attrs) {
  60268. return new Packets(attrs);
  60269. }
  60270. static pageOffset(attrs) {
  60271. return new PageOffset(attrs);
  60272. }
  60273. static pageRange(attrs) {
  60274. return new PageRange(attrs);
  60275. }
  60276. static pagination(attrs) {
  60277. return new Pagination(attrs);
  60278. }
  60279. static paginationOverride(attrs) {
  60280. return new PaginationOverride(attrs);
  60281. }
  60282. static part(attrs) {
  60283. return new Part(attrs);
  60284. }
  60285. static pcl(attrs) {
  60286. return new Pcl(attrs);
  60287. }
  60288. static pdf(attrs) {
  60289. return new Pdf(attrs);
  60290. }
  60291. static pdfa(attrs) {
  60292. return new Pdfa(attrs);
  60293. }
  60294. static permissions(attrs) {
  60295. return new Permissions(attrs);
  60296. }
  60297. static pickTrayByPDFSize(attrs) {
  60298. return new PickTrayByPDFSize(attrs);
  60299. }
  60300. static picture(attrs) {
  60301. return new Picture(attrs);
  60302. }
  60303. static plaintextMetadata(attrs) {
  60304. return new PlaintextMetadata(attrs);
  60305. }
  60306. static presence(attrs) {
  60307. return new Presence(attrs);
  60308. }
  60309. static present(attrs) {
  60310. return new Present(attrs);
  60311. }
  60312. static print(attrs) {
  60313. return new Print(attrs);
  60314. }
  60315. static printHighQuality(attrs) {
  60316. return new PrintHighQuality(attrs);
  60317. }
  60318. static printScaling(attrs) {
  60319. return new PrintScaling(attrs);
  60320. }
  60321. static printerName(attrs) {
  60322. return new PrinterName(attrs);
  60323. }
  60324. static producer(attrs) {
  60325. return new Producer(attrs);
  60326. }
  60327. static ps(attrs) {
  60328. return new Ps(attrs);
  60329. }
  60330. static range(attrs) {
  60331. return new Range(attrs);
  60332. }
  60333. static record(attrs) {
  60334. return new Record(attrs);
  60335. }
  60336. static relevant(attrs) {
  60337. return new Relevant(attrs);
  60338. }
  60339. static rename(attrs) {
  60340. return new Rename(attrs);
  60341. }
  60342. static renderPolicy(attrs) {
  60343. return new RenderPolicy(attrs);
  60344. }
  60345. static runScripts(attrs) {
  60346. return new RunScripts(attrs);
  60347. }
  60348. static script(attrs) {
  60349. return new Script(attrs);
  60350. }
  60351. static scriptModel(attrs) {
  60352. return new ScriptModel(attrs);
  60353. }
  60354. static severity(attrs) {
  60355. return new Severity(attrs);
  60356. }
  60357. static silentPrint(attrs) {
  60358. return new SilentPrint(attrs);
  60359. }
  60360. static staple(attrs) {
  60361. return new Staple(attrs);
  60362. }
  60363. static startNode(attrs) {
  60364. return new StartNode(attrs);
  60365. }
  60366. static startPage(attrs) {
  60367. return new StartPage(attrs);
  60368. }
  60369. static submitFormat(attrs) {
  60370. return new SubmitFormat(attrs);
  60371. }
  60372. static submitUrl(attrs) {
  60373. return new SubmitUrl(attrs);
  60374. }
  60375. static subsetBelow(attrs) {
  60376. return new SubsetBelow(attrs);
  60377. }
  60378. static suppressBanner(attrs) {
  60379. return new SuppressBanner(attrs);
  60380. }
  60381. static tagged(attrs) {
  60382. return new Tagged(attrs);
  60383. }
  60384. static template(attrs) {
  60385. return new Template(attrs);
  60386. }
  60387. static templateCache(attrs) {
  60388. return new TemplateCache(attrs);
  60389. }
  60390. static threshold(attrs) {
  60391. return new Threshold(attrs);
  60392. }
  60393. static to(attrs) {
  60394. return new To(attrs);
  60395. }
  60396. static trace(attrs) {
  60397. return new Trace(attrs);
  60398. }
  60399. static transform(attrs) {
  60400. return new Transform(attrs);
  60401. }
  60402. static type(attrs) {
  60403. return new Type(attrs);
  60404. }
  60405. static uri(attrs) {
  60406. return new Uri(attrs);
  60407. }
  60408. static validate(attrs) {
  60409. return new Validate(attrs);
  60410. }
  60411. static validateApprovalSignatures(attrs) {
  60412. return new ValidateApprovalSignatures(attrs);
  60413. }
  60414. static validationMessaging(attrs) {
  60415. return new ValidationMessaging(attrs);
  60416. }
  60417. static version(attrs) {
  60418. return new Version(attrs);
  60419. }
  60420. static versionControl(attrs) {
  60421. return new VersionControl(attrs);
  60422. }
  60423. static viewerPreferences(attrs) {
  60424. return new ViewerPreferences(attrs);
  60425. }
  60426. static webClient(attrs) {
  60427. return new WebClient(attrs);
  60428. }
  60429. static whitespace(attrs) {
  60430. return new Whitespace(attrs);
  60431. }
  60432. static window(attrs) {
  60433. return new Window(attrs);
  60434. }
  60435. static xdc(attrs) {
  60436. return new Xdc(attrs);
  60437. }
  60438. static xdp(attrs) {
  60439. return new Xdp(attrs);
  60440. }
  60441. static xsl(attrs) {
  60442. return new Xsl(attrs);
  60443. }
  60444. static zpl(attrs) {
  60445. return new Zpl(attrs);
  60446. }
  60447. }
  60448. exports.ConfigNamespace = ConfigNamespace;
  60449. /***/ }),
  60450. /* 92 */
  60451. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60452. Object.defineProperty(exports, "__esModule", ({
  60453. value: true
  60454. }));
  60455. exports.ConnectionSetNamespace = void 0;
  60456. var _namespaces = __w_pdfjs_require__(79);
  60457. var _xfa_object = __w_pdfjs_require__(77);
  60458. const CONNECTION_SET_NS_ID = _namespaces.NamespaceIds.connectionSet.id;
  60459. class ConnectionSet extends _xfa_object.XFAObject {
  60460. constructor(attributes) {
  60461. super(CONNECTION_SET_NS_ID, "connectionSet", true);
  60462. this.wsdlConnection = new _xfa_object.XFAObjectArray();
  60463. this.xmlConnection = new _xfa_object.XFAObjectArray();
  60464. this.xsdConnection = new _xfa_object.XFAObjectArray();
  60465. }
  60466. }
  60467. class EffectiveInputPolicy extends _xfa_object.XFAObject {
  60468. constructor(attributes) {
  60469. super(CONNECTION_SET_NS_ID, "effectiveInputPolicy");
  60470. this.id = attributes.id || "";
  60471. this.name = attributes.name || "";
  60472. this.use = attributes.use || "";
  60473. this.usehref = attributes.usehref || "";
  60474. }
  60475. }
  60476. class EffectiveOutputPolicy extends _xfa_object.XFAObject {
  60477. constructor(attributes) {
  60478. super(CONNECTION_SET_NS_ID, "effectiveOutputPolicy");
  60479. this.id = attributes.id || "";
  60480. this.name = attributes.name || "";
  60481. this.use = attributes.use || "";
  60482. this.usehref = attributes.usehref || "";
  60483. }
  60484. }
  60485. class Operation extends _xfa_object.StringObject {
  60486. constructor(attributes) {
  60487. super(CONNECTION_SET_NS_ID, "operation");
  60488. this.id = attributes.id || "";
  60489. this.input = attributes.input || "";
  60490. this.name = attributes.name || "";
  60491. this.output = attributes.output || "";
  60492. this.use = attributes.use || "";
  60493. this.usehref = attributes.usehref || "";
  60494. }
  60495. }
  60496. class RootElement extends _xfa_object.StringObject {
  60497. constructor(attributes) {
  60498. super(CONNECTION_SET_NS_ID, "rootElement");
  60499. this.id = attributes.id || "";
  60500. this.name = attributes.name || "";
  60501. this.use = attributes.use || "";
  60502. this.usehref = attributes.usehref || "";
  60503. }
  60504. }
  60505. class SoapAction extends _xfa_object.StringObject {
  60506. constructor(attributes) {
  60507. super(CONNECTION_SET_NS_ID, "soapAction");
  60508. this.id = attributes.id || "";
  60509. this.name = attributes.name || "";
  60510. this.use = attributes.use || "";
  60511. this.usehref = attributes.usehref || "";
  60512. }
  60513. }
  60514. class SoapAddress extends _xfa_object.StringObject {
  60515. constructor(attributes) {
  60516. super(CONNECTION_SET_NS_ID, "soapAddress");
  60517. this.id = attributes.id || "";
  60518. this.name = attributes.name || "";
  60519. this.use = attributes.use || "";
  60520. this.usehref = attributes.usehref || "";
  60521. }
  60522. }
  60523. class Uri extends _xfa_object.StringObject {
  60524. constructor(attributes) {
  60525. super(CONNECTION_SET_NS_ID, "uri");
  60526. this.id = attributes.id || "";
  60527. this.name = attributes.name || "";
  60528. this.use = attributes.use || "";
  60529. this.usehref = attributes.usehref || "";
  60530. }
  60531. }
  60532. class WsdlAddress extends _xfa_object.StringObject {
  60533. constructor(attributes) {
  60534. super(CONNECTION_SET_NS_ID, "wsdlAddress");
  60535. this.id = attributes.id || "";
  60536. this.name = attributes.name || "";
  60537. this.use = attributes.use || "";
  60538. this.usehref = attributes.usehref || "";
  60539. }
  60540. }
  60541. class WsdlConnection extends _xfa_object.XFAObject {
  60542. constructor(attributes) {
  60543. super(CONNECTION_SET_NS_ID, "wsdlConnection", true);
  60544. this.dataDescription = attributes.dataDescription || "";
  60545. this.name = attributes.name || "";
  60546. this.effectiveInputPolicy = null;
  60547. this.effectiveOutputPolicy = null;
  60548. this.operation = null;
  60549. this.soapAction = null;
  60550. this.soapAddress = null;
  60551. this.wsdlAddress = null;
  60552. }
  60553. }
  60554. class XmlConnection extends _xfa_object.XFAObject {
  60555. constructor(attributes) {
  60556. super(CONNECTION_SET_NS_ID, "xmlConnection", true);
  60557. this.dataDescription = attributes.dataDescription || "";
  60558. this.name = attributes.name || "";
  60559. this.uri = null;
  60560. }
  60561. }
  60562. class XsdConnection extends _xfa_object.XFAObject {
  60563. constructor(attributes) {
  60564. super(CONNECTION_SET_NS_ID, "xsdConnection", true);
  60565. this.dataDescription = attributes.dataDescription || "";
  60566. this.name = attributes.name || "";
  60567. this.rootElement = null;
  60568. this.uri = null;
  60569. }
  60570. }
  60571. class ConnectionSetNamespace {
  60572. static [_namespaces.$buildXFAObject](name, attributes) {
  60573. if (ConnectionSetNamespace.hasOwnProperty(name)) {
  60574. return ConnectionSetNamespace[name](attributes);
  60575. }
  60576. return undefined;
  60577. }
  60578. static connectionSet(attrs) {
  60579. return new ConnectionSet(attrs);
  60580. }
  60581. static effectiveInputPolicy(attrs) {
  60582. return new EffectiveInputPolicy(attrs);
  60583. }
  60584. static effectiveOutputPolicy(attrs) {
  60585. return new EffectiveOutputPolicy(attrs);
  60586. }
  60587. static operation(attrs) {
  60588. return new Operation(attrs);
  60589. }
  60590. static rootElement(attrs) {
  60591. return new RootElement(attrs);
  60592. }
  60593. static soapAction(attrs) {
  60594. return new SoapAction(attrs);
  60595. }
  60596. static soapAddress(attrs) {
  60597. return new SoapAddress(attrs);
  60598. }
  60599. static uri(attrs) {
  60600. return new Uri(attrs);
  60601. }
  60602. static wsdlAddress(attrs) {
  60603. return new WsdlAddress(attrs);
  60604. }
  60605. static wsdlConnection(attrs) {
  60606. return new WsdlConnection(attrs);
  60607. }
  60608. static xmlConnection(attrs) {
  60609. return new XmlConnection(attrs);
  60610. }
  60611. static xsdConnection(attrs) {
  60612. return new XsdConnection(attrs);
  60613. }
  60614. }
  60615. exports.ConnectionSetNamespace = ConnectionSetNamespace;
  60616. /***/ }),
  60617. /* 93 */
  60618. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60619. Object.defineProperty(exports, "__esModule", ({
  60620. value: true
  60621. }));
  60622. exports.DatasetsNamespace = void 0;
  60623. var _xfa_object = __w_pdfjs_require__(77);
  60624. var _namespaces = __w_pdfjs_require__(79);
  60625. const DATASETS_NS_ID = _namespaces.NamespaceIds.datasets.id;
  60626. class Data extends _xfa_object.XmlObject {
  60627. constructor(attributes) {
  60628. super(DATASETS_NS_ID, "data", attributes);
  60629. }
  60630. [_xfa_object.$isNsAgnostic]() {
  60631. return true;
  60632. }
  60633. }
  60634. class Datasets extends _xfa_object.XFAObject {
  60635. constructor(attributes) {
  60636. super(DATASETS_NS_ID, "datasets", true);
  60637. this.data = null;
  60638. this.Signature = null;
  60639. }
  60640. [_xfa_object.$onChild](child) {
  60641. const name = child[_xfa_object.$nodeName];
  60642. if (name === "data" && child[_xfa_object.$namespaceId] === DATASETS_NS_ID || name === "Signature" && child[_xfa_object.$namespaceId] === _namespaces.NamespaceIds.signature.id) {
  60643. this[name] = child;
  60644. }
  60645. this[_xfa_object.$appendChild](child);
  60646. }
  60647. }
  60648. class DatasetsNamespace {
  60649. static [_namespaces.$buildXFAObject](name, attributes) {
  60650. if (DatasetsNamespace.hasOwnProperty(name)) {
  60651. return DatasetsNamespace[name](attributes);
  60652. }
  60653. return undefined;
  60654. }
  60655. static datasets(attributes) {
  60656. return new Datasets(attributes);
  60657. }
  60658. static data(attributes) {
  60659. return new Data(attributes);
  60660. }
  60661. }
  60662. exports.DatasetsNamespace = DatasetsNamespace;
  60663. /***/ }),
  60664. /* 94 */
  60665. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60666. Object.defineProperty(exports, "__esModule", ({
  60667. value: true
  60668. }));
  60669. exports.LocaleSetNamespace = void 0;
  60670. var _namespaces = __w_pdfjs_require__(79);
  60671. var _xfa_object = __w_pdfjs_require__(77);
  60672. var _utils = __w_pdfjs_require__(78);
  60673. const LOCALE_SET_NS_ID = _namespaces.NamespaceIds.localeSet.id;
  60674. class CalendarSymbols extends _xfa_object.XFAObject {
  60675. constructor(attributes) {
  60676. super(LOCALE_SET_NS_ID, "calendarSymbols", true);
  60677. this.name = "gregorian";
  60678. this.dayNames = new _xfa_object.XFAObjectArray(2);
  60679. this.eraNames = null;
  60680. this.meridiemNames = null;
  60681. this.monthNames = new _xfa_object.XFAObjectArray(2);
  60682. }
  60683. }
  60684. class CurrencySymbol extends _xfa_object.StringObject {
  60685. constructor(attributes) {
  60686. super(LOCALE_SET_NS_ID, "currencySymbol");
  60687. this.name = (0, _utils.getStringOption)(attributes.name, ["symbol", "isoname", "decimal"]);
  60688. }
  60689. }
  60690. class CurrencySymbols extends _xfa_object.XFAObject {
  60691. constructor(attributes) {
  60692. super(LOCALE_SET_NS_ID, "currencySymbols", true);
  60693. this.currencySymbol = new _xfa_object.XFAObjectArray(3);
  60694. }
  60695. }
  60696. class DatePattern extends _xfa_object.StringObject {
  60697. constructor(attributes) {
  60698. super(LOCALE_SET_NS_ID, "datePattern");
  60699. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60700. }
  60701. }
  60702. class DatePatterns extends _xfa_object.XFAObject {
  60703. constructor(attributes) {
  60704. super(LOCALE_SET_NS_ID, "datePatterns", true);
  60705. this.datePattern = new _xfa_object.XFAObjectArray(4);
  60706. }
  60707. }
  60708. class DateTimeSymbols extends _xfa_object.ContentObject {
  60709. constructor(attributes) {
  60710. super(LOCALE_SET_NS_ID, "dateTimeSymbols");
  60711. }
  60712. }
  60713. class Day extends _xfa_object.StringObject {
  60714. constructor(attributes) {
  60715. super(LOCALE_SET_NS_ID, "day");
  60716. }
  60717. }
  60718. class DayNames extends _xfa_object.XFAObject {
  60719. constructor(attributes) {
  60720. super(LOCALE_SET_NS_ID, "dayNames", true);
  60721. this.abbr = (0, _utils.getInteger)({
  60722. data: attributes.abbr,
  60723. defaultValue: 0,
  60724. validate: x => x === 1
  60725. });
  60726. this.day = new _xfa_object.XFAObjectArray(7);
  60727. }
  60728. }
  60729. class Era extends _xfa_object.StringObject {
  60730. constructor(attributes) {
  60731. super(LOCALE_SET_NS_ID, "era");
  60732. }
  60733. }
  60734. class EraNames extends _xfa_object.XFAObject {
  60735. constructor(attributes) {
  60736. super(LOCALE_SET_NS_ID, "eraNames", true);
  60737. this.era = new _xfa_object.XFAObjectArray(2);
  60738. }
  60739. }
  60740. class Locale extends _xfa_object.XFAObject {
  60741. constructor(attributes) {
  60742. super(LOCALE_SET_NS_ID, "locale", true);
  60743. this.desc = attributes.desc || "";
  60744. this.name = "isoname";
  60745. this.calendarSymbols = null;
  60746. this.currencySymbols = null;
  60747. this.datePatterns = null;
  60748. this.dateTimeSymbols = null;
  60749. this.numberPatterns = null;
  60750. this.numberSymbols = null;
  60751. this.timePatterns = null;
  60752. this.typeFaces = null;
  60753. }
  60754. }
  60755. class LocaleSet extends _xfa_object.XFAObject {
  60756. constructor(attributes) {
  60757. super(LOCALE_SET_NS_ID, "localeSet", true);
  60758. this.locale = new _xfa_object.XFAObjectArray();
  60759. }
  60760. }
  60761. class Meridiem extends _xfa_object.StringObject {
  60762. constructor(attributes) {
  60763. super(LOCALE_SET_NS_ID, "meridiem");
  60764. }
  60765. }
  60766. class MeridiemNames extends _xfa_object.XFAObject {
  60767. constructor(attributes) {
  60768. super(LOCALE_SET_NS_ID, "meridiemNames", true);
  60769. this.meridiem = new _xfa_object.XFAObjectArray(2);
  60770. }
  60771. }
  60772. class Month extends _xfa_object.StringObject {
  60773. constructor(attributes) {
  60774. super(LOCALE_SET_NS_ID, "month");
  60775. }
  60776. }
  60777. class MonthNames extends _xfa_object.XFAObject {
  60778. constructor(attributes) {
  60779. super(LOCALE_SET_NS_ID, "monthNames", true);
  60780. this.abbr = (0, _utils.getInteger)({
  60781. data: attributes.abbr,
  60782. defaultValue: 0,
  60783. validate: x => x === 1
  60784. });
  60785. this.month = new _xfa_object.XFAObjectArray(12);
  60786. }
  60787. }
  60788. class NumberPattern extends _xfa_object.StringObject {
  60789. constructor(attributes) {
  60790. super(LOCALE_SET_NS_ID, "numberPattern");
  60791. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60792. }
  60793. }
  60794. class NumberPatterns extends _xfa_object.XFAObject {
  60795. constructor(attributes) {
  60796. super(LOCALE_SET_NS_ID, "numberPatterns", true);
  60797. this.numberPattern = new _xfa_object.XFAObjectArray(4);
  60798. }
  60799. }
  60800. class NumberSymbol extends _xfa_object.StringObject {
  60801. constructor(attributes) {
  60802. super(LOCALE_SET_NS_ID, "numberSymbol");
  60803. this.name = (0, _utils.getStringOption)(attributes.name, ["decimal", "grouping", "percent", "minus", "zero"]);
  60804. }
  60805. }
  60806. class NumberSymbols extends _xfa_object.XFAObject {
  60807. constructor(attributes) {
  60808. super(LOCALE_SET_NS_ID, "numberSymbols", true);
  60809. this.numberSymbol = new _xfa_object.XFAObjectArray(5);
  60810. }
  60811. }
  60812. class TimePattern extends _xfa_object.StringObject {
  60813. constructor(attributes) {
  60814. super(LOCALE_SET_NS_ID, "timePattern");
  60815. this.name = (0, _utils.getStringOption)(attributes.name, ["full", "long", "med", "short"]);
  60816. }
  60817. }
  60818. class TimePatterns extends _xfa_object.XFAObject {
  60819. constructor(attributes) {
  60820. super(LOCALE_SET_NS_ID, "timePatterns", true);
  60821. this.timePattern = new _xfa_object.XFAObjectArray(4);
  60822. }
  60823. }
  60824. class TypeFace extends _xfa_object.XFAObject {
  60825. constructor(attributes) {
  60826. super(LOCALE_SET_NS_ID, "typeFace", true);
  60827. this.name = attributes.name | "";
  60828. }
  60829. }
  60830. class TypeFaces extends _xfa_object.XFAObject {
  60831. constructor(attributes) {
  60832. super(LOCALE_SET_NS_ID, "typeFaces", true);
  60833. this.typeFace = new _xfa_object.XFAObjectArray();
  60834. }
  60835. }
  60836. class LocaleSetNamespace {
  60837. static [_namespaces.$buildXFAObject](name, attributes) {
  60838. if (LocaleSetNamespace.hasOwnProperty(name)) {
  60839. return LocaleSetNamespace[name](attributes);
  60840. }
  60841. return undefined;
  60842. }
  60843. static calendarSymbols(attrs) {
  60844. return new CalendarSymbols(attrs);
  60845. }
  60846. static currencySymbol(attrs) {
  60847. return new CurrencySymbol(attrs);
  60848. }
  60849. static currencySymbols(attrs) {
  60850. return new CurrencySymbols(attrs);
  60851. }
  60852. static datePattern(attrs) {
  60853. return new DatePattern(attrs);
  60854. }
  60855. static datePatterns(attrs) {
  60856. return new DatePatterns(attrs);
  60857. }
  60858. static dateTimeSymbols(attrs) {
  60859. return new DateTimeSymbols(attrs);
  60860. }
  60861. static day(attrs) {
  60862. return new Day(attrs);
  60863. }
  60864. static dayNames(attrs) {
  60865. return new DayNames(attrs);
  60866. }
  60867. static era(attrs) {
  60868. return new Era(attrs);
  60869. }
  60870. static eraNames(attrs) {
  60871. return new EraNames(attrs);
  60872. }
  60873. static locale(attrs) {
  60874. return new Locale(attrs);
  60875. }
  60876. static localeSet(attrs) {
  60877. return new LocaleSet(attrs);
  60878. }
  60879. static meridiem(attrs) {
  60880. return new Meridiem(attrs);
  60881. }
  60882. static meridiemNames(attrs) {
  60883. return new MeridiemNames(attrs);
  60884. }
  60885. static month(attrs) {
  60886. return new Month(attrs);
  60887. }
  60888. static monthNames(attrs) {
  60889. return new MonthNames(attrs);
  60890. }
  60891. static numberPattern(attrs) {
  60892. return new NumberPattern(attrs);
  60893. }
  60894. static numberPatterns(attrs) {
  60895. return new NumberPatterns(attrs);
  60896. }
  60897. static numberSymbol(attrs) {
  60898. return new NumberSymbol(attrs);
  60899. }
  60900. static numberSymbols(attrs) {
  60901. return new NumberSymbols(attrs);
  60902. }
  60903. static timePattern(attrs) {
  60904. return new TimePattern(attrs);
  60905. }
  60906. static timePatterns(attrs) {
  60907. return new TimePatterns(attrs);
  60908. }
  60909. static typeFace(attrs) {
  60910. return new TypeFace(attrs);
  60911. }
  60912. static typeFaces(attrs) {
  60913. return new TypeFaces(attrs);
  60914. }
  60915. }
  60916. exports.LocaleSetNamespace = LocaleSetNamespace;
  60917. /***/ }),
  60918. /* 95 */
  60919. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60920. Object.defineProperty(exports, "__esModule", ({
  60921. value: true
  60922. }));
  60923. exports.SignatureNamespace = void 0;
  60924. var _namespaces = __w_pdfjs_require__(79);
  60925. var _xfa_object = __w_pdfjs_require__(77);
  60926. const SIGNATURE_NS_ID = _namespaces.NamespaceIds.signature.id;
  60927. class Signature extends _xfa_object.XFAObject {
  60928. constructor(attributes) {
  60929. super(SIGNATURE_NS_ID, "signature", true);
  60930. }
  60931. }
  60932. class SignatureNamespace {
  60933. static [_namespaces.$buildXFAObject](name, attributes) {
  60934. if (SignatureNamespace.hasOwnProperty(name)) {
  60935. return SignatureNamespace[name](attributes);
  60936. }
  60937. return undefined;
  60938. }
  60939. static signature(attributes) {
  60940. return new Signature(attributes);
  60941. }
  60942. }
  60943. exports.SignatureNamespace = SignatureNamespace;
  60944. /***/ }),
  60945. /* 96 */
  60946. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60947. Object.defineProperty(exports, "__esModule", ({
  60948. value: true
  60949. }));
  60950. exports.StylesheetNamespace = void 0;
  60951. var _namespaces = __w_pdfjs_require__(79);
  60952. var _xfa_object = __w_pdfjs_require__(77);
  60953. const STYLESHEET_NS_ID = _namespaces.NamespaceIds.stylesheet.id;
  60954. class Stylesheet extends _xfa_object.XFAObject {
  60955. constructor(attributes) {
  60956. super(STYLESHEET_NS_ID, "stylesheet", true);
  60957. }
  60958. }
  60959. class StylesheetNamespace {
  60960. static [_namespaces.$buildXFAObject](name, attributes) {
  60961. if (StylesheetNamespace.hasOwnProperty(name)) {
  60962. return StylesheetNamespace[name](attributes);
  60963. }
  60964. return undefined;
  60965. }
  60966. static stylesheet(attributes) {
  60967. return new Stylesheet(attributes);
  60968. }
  60969. }
  60970. exports.StylesheetNamespace = StylesheetNamespace;
  60971. /***/ }),
  60972. /* 97 */
  60973. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  60974. Object.defineProperty(exports, "__esModule", ({
  60975. value: true
  60976. }));
  60977. exports.XdpNamespace = void 0;
  60978. var _namespaces = __w_pdfjs_require__(79);
  60979. var _xfa_object = __w_pdfjs_require__(77);
  60980. const XDP_NS_ID = _namespaces.NamespaceIds.xdp.id;
  60981. class Xdp extends _xfa_object.XFAObject {
  60982. constructor(attributes) {
  60983. super(XDP_NS_ID, "xdp", true);
  60984. this.uuid = attributes.uuid || "";
  60985. this.timeStamp = attributes.timeStamp || "";
  60986. this.config = null;
  60987. this.connectionSet = null;
  60988. this.datasets = null;
  60989. this.localeSet = null;
  60990. this.stylesheet = new _xfa_object.XFAObjectArray();
  60991. this.template = null;
  60992. }
  60993. [_xfa_object.$onChildCheck](child) {
  60994. const ns = _namespaces.NamespaceIds[child[_xfa_object.$nodeName]];
  60995. return ns && child[_xfa_object.$namespaceId] === ns.id;
  60996. }
  60997. }
  60998. class XdpNamespace {
  60999. static [_namespaces.$buildXFAObject](name, attributes) {
  61000. if (XdpNamespace.hasOwnProperty(name)) {
  61001. return XdpNamespace[name](attributes);
  61002. }
  61003. return undefined;
  61004. }
  61005. static xdp(attributes) {
  61006. return new Xdp(attributes);
  61007. }
  61008. }
  61009. exports.XdpNamespace = XdpNamespace;
  61010. /***/ }),
  61011. /* 98 */
  61012. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61013. Object.defineProperty(exports, "__esModule", ({
  61014. value: true
  61015. }));
  61016. exports.XhtmlNamespace = void 0;
  61017. var _xfa_object = __w_pdfjs_require__(77);
  61018. var _namespaces = __w_pdfjs_require__(79);
  61019. var _html_utils = __w_pdfjs_require__(84);
  61020. var _utils = __w_pdfjs_require__(78);
  61021. const XHTML_NS_ID = _namespaces.NamespaceIds.xhtml.id;
  61022. const $richText = Symbol();
  61023. 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"]);
  61024. 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) => {
  61025. value = original.fontSize = (0, _utils.getMeasurement)(value);
  61026. return (0, _html_utils.measureToString)(0.99 * value);
  61027. }], ["letter-spacing", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["line-height", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-bottom", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-left", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-right", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["margin-top", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["text-indent", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))], ["font-family", value => value], ["vertical-align", value => (0, _html_utils.measureToString)((0, _utils.getMeasurement)(value))]]);
  61028. const spacesRegExp = /\s+/g;
  61029. const crlfRegExp = /[\r\n]+/g;
  61030. const crlfForRichTextRegExp = /\r\n?/g;
  61031. function mapStyle(styleStr, node, richText) {
  61032. const style = Object.create(null);
  61033. if (!styleStr) {
  61034. return style;
  61035. }
  61036. const original = Object.create(null);
  61037. for (const [key, value] of styleStr.split(";").map(s => s.split(":", 2))) {
  61038. const mapping = StyleMapping.get(key);
  61039. if (mapping === "") {
  61040. continue;
  61041. }
  61042. let newValue = value;
  61043. if (mapping) {
  61044. if (typeof mapping === "string") {
  61045. newValue = mapping;
  61046. } else {
  61047. newValue = mapping(value, original);
  61048. }
  61049. }
  61050. if (key.endsWith("scale")) {
  61051. if (style.transform) {
  61052. style.transform = `${style[key]} ${newValue}`;
  61053. } else {
  61054. style.transform = newValue;
  61055. }
  61056. } else {
  61057. style[key.replaceAll(/-([a-zA-Z])/g, (_, x) => x.toUpperCase())] = newValue;
  61058. }
  61059. }
  61060. if (style.fontFamily) {
  61061. (0, _html_utils.setFontFamily)({
  61062. typeface: style.fontFamily,
  61063. weight: style.fontWeight || "normal",
  61064. posture: style.fontStyle || "normal",
  61065. size: original.fontSize || 0
  61066. }, node, node[_xfa_object.$globalData].fontFinder, style);
  61067. }
  61068. if (richText && style.verticalAlign && style.verticalAlign !== "0px" && style.fontSize) {
  61069. const SUB_SUPER_SCRIPT_FACTOR = 0.583;
  61070. const VERTICAL_FACTOR = 0.333;
  61071. const fontSize = (0, _utils.getMeasurement)(style.fontSize);
  61072. style.fontSize = (0, _html_utils.measureToString)(fontSize * SUB_SUPER_SCRIPT_FACTOR);
  61073. style.verticalAlign = (0, _html_utils.measureToString)(Math.sign((0, _utils.getMeasurement)(style.verticalAlign)) * fontSize * VERTICAL_FACTOR);
  61074. }
  61075. (0, _html_utils.fixTextIndent)(style);
  61076. return style;
  61077. }
  61078. function checkStyle(node) {
  61079. if (!node.style) {
  61080. return "";
  61081. }
  61082. return node.style.trim().split(/\s*;\s*/).filter(s => !!s).map(s => s.split(/\s*:\s*/, 2)).filter(([key, value]) => {
  61083. if (key === "font-family") {
  61084. node[_xfa_object.$globalData].usedTypefaces.add(value);
  61085. }
  61086. return VALID_STYLES.has(key);
  61087. }).map(kv => kv.join(":")).join(";");
  61088. }
  61089. const NoWhites = new Set(["body", "html"]);
  61090. class XhtmlObject extends _xfa_object.XmlObject {
  61091. constructor(attributes, name) {
  61092. super(XHTML_NS_ID, name);
  61093. this[$richText] = false;
  61094. this.style = attributes.style || "";
  61095. }
  61096. [_xfa_object.$clean](builder) {
  61097. super[_xfa_object.$clean](builder);
  61098. this.style = checkStyle(this);
  61099. }
  61100. [_xfa_object.$acceptWhitespace]() {
  61101. return !NoWhites.has(this[_xfa_object.$nodeName]);
  61102. }
  61103. [_xfa_object.$onText](str, richText = false) {
  61104. if (!richText) {
  61105. str = str.replace(crlfRegExp, "");
  61106. if (!this.style.includes("xfa-spacerun:yes")) {
  61107. str = str.replace(spacesRegExp, " ");
  61108. }
  61109. } else {
  61110. this[$richText] = true;
  61111. }
  61112. if (str) {
  61113. this[_xfa_object.$content] += str;
  61114. }
  61115. }
  61116. [_xfa_object.$pushGlyphs](measure, mustPop = true) {
  61117. const xfaFont = Object.create(null);
  61118. const margin = {
  61119. top: NaN,
  61120. bottom: NaN,
  61121. left: NaN,
  61122. right: NaN
  61123. };
  61124. let lineHeight = null;
  61125. for (const [key, value] of this.style.split(";").map(s => s.split(":", 2))) {
  61126. switch (key) {
  61127. case "font-family":
  61128. xfaFont.typeface = (0, _utils.stripQuotes)(value);
  61129. break;
  61130. case "font-size":
  61131. xfaFont.size = (0, _utils.getMeasurement)(value);
  61132. break;
  61133. case "font-weight":
  61134. xfaFont.weight = value;
  61135. break;
  61136. case "font-style":
  61137. xfaFont.posture = value;
  61138. break;
  61139. case "letter-spacing":
  61140. xfaFont.letterSpacing = (0, _utils.getMeasurement)(value);
  61141. break;
  61142. case "margin":
  61143. const values = value.split(/ \t/).map(x => (0, _utils.getMeasurement)(x));
  61144. switch (values.length) {
  61145. case 1:
  61146. margin.top = margin.bottom = margin.left = margin.right = values[0];
  61147. break;
  61148. case 2:
  61149. margin.top = margin.bottom = values[0];
  61150. margin.left = margin.right = values[1];
  61151. break;
  61152. case 3:
  61153. margin.top = values[0];
  61154. margin.bottom = values[2];
  61155. margin.left = margin.right = values[1];
  61156. break;
  61157. case 4:
  61158. margin.top = values[0];
  61159. margin.left = values[1];
  61160. margin.bottom = values[2];
  61161. margin.right = values[3];
  61162. break;
  61163. }
  61164. break;
  61165. case "margin-top":
  61166. margin.top = (0, _utils.getMeasurement)(value);
  61167. break;
  61168. case "margin-bottom":
  61169. margin.bottom = (0, _utils.getMeasurement)(value);
  61170. break;
  61171. case "margin-left":
  61172. margin.left = (0, _utils.getMeasurement)(value);
  61173. break;
  61174. case "margin-right":
  61175. margin.right = (0, _utils.getMeasurement)(value);
  61176. break;
  61177. case "line-height":
  61178. lineHeight = (0, _utils.getMeasurement)(value);
  61179. break;
  61180. }
  61181. }
  61182. measure.pushData(xfaFont, margin, lineHeight);
  61183. if (this[_xfa_object.$content]) {
  61184. measure.addString(this[_xfa_object.$content]);
  61185. } else {
  61186. for (const child of this[_xfa_object.$getChildren]()) {
  61187. if (child[_xfa_object.$nodeName] === "#text") {
  61188. measure.addString(child[_xfa_object.$content]);
  61189. continue;
  61190. }
  61191. child[_xfa_object.$pushGlyphs](measure);
  61192. }
  61193. }
  61194. if (mustPop) {
  61195. measure.popFont();
  61196. }
  61197. }
  61198. [_xfa_object.$toHTML](availableSpace) {
  61199. const children = [];
  61200. this[_xfa_object.$extra] = {
  61201. children
  61202. };
  61203. this[_xfa_object.$childrenToHTML]({});
  61204. if (children.length === 0 && !this[_xfa_object.$content]) {
  61205. return _utils.HTMLResult.EMPTY;
  61206. }
  61207. let value;
  61208. if (this[$richText]) {
  61209. value = this[_xfa_object.$content] ? this[_xfa_object.$content].replace(crlfForRichTextRegExp, "\n") : undefined;
  61210. } else {
  61211. value = this[_xfa_object.$content] || undefined;
  61212. }
  61213. return _utils.HTMLResult.success({
  61214. name: this[_xfa_object.$nodeName],
  61215. attributes: {
  61216. href: this.href,
  61217. style: mapStyle(this.style, this, this[$richText])
  61218. },
  61219. children,
  61220. value
  61221. });
  61222. }
  61223. }
  61224. class A extends XhtmlObject {
  61225. constructor(attributes) {
  61226. super(attributes, "a");
  61227. this.href = (0, _html_utils.fixURL)(attributes.href) || "";
  61228. }
  61229. }
  61230. class B extends XhtmlObject {
  61231. constructor(attributes) {
  61232. super(attributes, "b");
  61233. }
  61234. [_xfa_object.$pushGlyphs](measure) {
  61235. measure.pushFont({
  61236. weight: "bold"
  61237. });
  61238. super[_xfa_object.$pushGlyphs](measure);
  61239. measure.popFont();
  61240. }
  61241. }
  61242. class Body extends XhtmlObject {
  61243. constructor(attributes) {
  61244. super(attributes, "body");
  61245. }
  61246. [_xfa_object.$toHTML](availableSpace) {
  61247. const res = super[_xfa_object.$toHTML](availableSpace);
  61248. const {
  61249. html
  61250. } = res;
  61251. if (!html) {
  61252. return _utils.HTMLResult.EMPTY;
  61253. }
  61254. html.name = "div";
  61255. html.attributes.class = ["xfaRich"];
  61256. return res;
  61257. }
  61258. }
  61259. class Br extends XhtmlObject {
  61260. constructor(attributes) {
  61261. super(attributes, "br");
  61262. }
  61263. [_xfa_object.$text]() {
  61264. return "\n";
  61265. }
  61266. [_xfa_object.$pushGlyphs](measure) {
  61267. measure.addString("\n");
  61268. }
  61269. [_xfa_object.$toHTML](availableSpace) {
  61270. return _utils.HTMLResult.success({
  61271. name: "br"
  61272. });
  61273. }
  61274. }
  61275. class Html extends XhtmlObject {
  61276. constructor(attributes) {
  61277. super(attributes, "html");
  61278. }
  61279. [_xfa_object.$toHTML](availableSpace) {
  61280. const children = [];
  61281. this[_xfa_object.$extra] = {
  61282. children
  61283. };
  61284. this[_xfa_object.$childrenToHTML]({});
  61285. if (children.length === 0) {
  61286. return _utils.HTMLResult.success({
  61287. name: "div",
  61288. attributes: {
  61289. class: ["xfaRich"],
  61290. style: {}
  61291. },
  61292. value: this[_xfa_object.$content] || ""
  61293. });
  61294. }
  61295. if (children.length === 1) {
  61296. const child = children[0];
  61297. if (child.attributes && child.attributes.class.includes("xfaRich")) {
  61298. return _utils.HTMLResult.success(child);
  61299. }
  61300. }
  61301. return _utils.HTMLResult.success({
  61302. name: "div",
  61303. attributes: {
  61304. class: ["xfaRich"],
  61305. style: {}
  61306. },
  61307. children
  61308. });
  61309. }
  61310. }
  61311. class I extends XhtmlObject {
  61312. constructor(attributes) {
  61313. super(attributes, "i");
  61314. }
  61315. [_xfa_object.$pushGlyphs](measure) {
  61316. measure.pushFont({
  61317. posture: "italic"
  61318. });
  61319. super[_xfa_object.$pushGlyphs](measure);
  61320. measure.popFont();
  61321. }
  61322. }
  61323. class Li extends XhtmlObject {
  61324. constructor(attributes) {
  61325. super(attributes, "li");
  61326. }
  61327. }
  61328. class Ol extends XhtmlObject {
  61329. constructor(attributes) {
  61330. super(attributes, "ol");
  61331. }
  61332. }
  61333. class P extends XhtmlObject {
  61334. constructor(attributes) {
  61335. super(attributes, "p");
  61336. }
  61337. [_xfa_object.$pushGlyphs](measure) {
  61338. super[_xfa_object.$pushGlyphs](measure, false);
  61339. measure.addString("\n");
  61340. measure.addPara();
  61341. measure.popFont();
  61342. }
  61343. [_xfa_object.$text]() {
  61344. const siblings = this[_xfa_object.$getParent]()[_xfa_object.$getChildren]();
  61345. if (siblings[siblings.length - 1] === this) {
  61346. return super[_xfa_object.$text]();
  61347. }
  61348. return super[_xfa_object.$text]() + "\n";
  61349. }
  61350. }
  61351. class Span extends XhtmlObject {
  61352. constructor(attributes) {
  61353. super(attributes, "span");
  61354. }
  61355. }
  61356. class Sub extends XhtmlObject {
  61357. constructor(attributes) {
  61358. super(attributes, "sub");
  61359. }
  61360. }
  61361. class Sup extends XhtmlObject {
  61362. constructor(attributes) {
  61363. super(attributes, "sup");
  61364. }
  61365. }
  61366. class Ul extends XhtmlObject {
  61367. constructor(attributes) {
  61368. super(attributes, "ul");
  61369. }
  61370. }
  61371. class XhtmlNamespace {
  61372. static [_namespaces.$buildXFAObject](name, attributes) {
  61373. if (XhtmlNamespace.hasOwnProperty(name)) {
  61374. return XhtmlNamespace[name](attributes);
  61375. }
  61376. return undefined;
  61377. }
  61378. static a(attributes) {
  61379. return new A(attributes);
  61380. }
  61381. static b(attributes) {
  61382. return new B(attributes);
  61383. }
  61384. static body(attributes) {
  61385. return new Body(attributes);
  61386. }
  61387. static br(attributes) {
  61388. return new Br(attributes);
  61389. }
  61390. static html(attributes) {
  61391. return new Html(attributes);
  61392. }
  61393. static i(attributes) {
  61394. return new I(attributes);
  61395. }
  61396. static li(attributes) {
  61397. return new Li(attributes);
  61398. }
  61399. static ol(attributes) {
  61400. return new Ol(attributes);
  61401. }
  61402. static p(attributes) {
  61403. return new P(attributes);
  61404. }
  61405. static span(attributes) {
  61406. return new Span(attributes);
  61407. }
  61408. static sub(attributes) {
  61409. return new Sub(attributes);
  61410. }
  61411. static sup(attributes) {
  61412. return new Sup(attributes);
  61413. }
  61414. static ul(attributes) {
  61415. return new Ul(attributes);
  61416. }
  61417. }
  61418. exports.XhtmlNamespace = XhtmlNamespace;
  61419. /***/ }),
  61420. /* 99 */
  61421. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61422. Object.defineProperty(exports, "__esModule", ({
  61423. value: true
  61424. }));
  61425. exports.UnknownNamespace = void 0;
  61426. var _namespaces = __w_pdfjs_require__(79);
  61427. var _xfa_object = __w_pdfjs_require__(77);
  61428. class UnknownNamespace {
  61429. constructor(nsId) {
  61430. this.namespaceId = nsId;
  61431. }
  61432. [_namespaces.$buildXFAObject](name, attributes) {
  61433. return new _xfa_object.XmlObject(this.namespaceId, name, attributes);
  61434. }
  61435. }
  61436. exports.UnknownNamespace = UnknownNamespace;
  61437. /***/ }),
  61438. /* 100 */
  61439. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61440. Object.defineProperty(exports, "__esModule", ({
  61441. value: true
  61442. }));
  61443. exports.DatasetReader = void 0;
  61444. var _util = __w_pdfjs_require__(2);
  61445. var _core_utils = __w_pdfjs_require__(8);
  61446. var _xml_parser = __w_pdfjs_require__(70);
  61447. function decodeString(str) {
  61448. try {
  61449. return (0, _util.stringToUTF8String)(str);
  61450. } catch (ex) {
  61451. (0, _util.warn)(`UTF-8 decoding failed: "${ex}".`);
  61452. return str;
  61453. }
  61454. }
  61455. class DatasetXMLParser extends _xml_parser.SimpleXMLParser {
  61456. constructor(options) {
  61457. super(options);
  61458. this.node = null;
  61459. }
  61460. onEndElement(name) {
  61461. const node = super.onEndElement(name);
  61462. if (node && name === "xfa:datasets") {
  61463. this.node = node;
  61464. throw new Error("Aborting DatasetXMLParser.");
  61465. }
  61466. }
  61467. }
  61468. class DatasetReader {
  61469. constructor(data) {
  61470. if (data.datasets) {
  61471. this.node = new _xml_parser.SimpleXMLParser({
  61472. hasAttributes: true
  61473. }).parseFromString(data.datasets).documentElement;
  61474. } else {
  61475. const parser = new DatasetXMLParser({
  61476. hasAttributes: true
  61477. });
  61478. try {
  61479. parser.parseFromString(data["xdp:xdp"]);
  61480. } catch (_) {}
  61481. this.node = parser.node;
  61482. }
  61483. }
  61484. getValue(path) {
  61485. if (!this.node || !path) {
  61486. return "";
  61487. }
  61488. const node = this.node.searchNode((0, _core_utils.parseXFAPath)(path), 0);
  61489. if (!node) {
  61490. return "";
  61491. }
  61492. const first = node.firstChild;
  61493. if (first && first.nodeName === "value") {
  61494. return node.children.map(child => decodeString(child.textContent));
  61495. }
  61496. return decodeString(node.textContent);
  61497. }
  61498. }
  61499. exports.DatasetReader = DatasetReader;
  61500. /***/ }),
  61501. /* 101 */
  61502. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  61503. Object.defineProperty(exports, "__esModule", ({
  61504. value: true
  61505. }));
  61506. exports.XRef = void 0;
  61507. var _util = __w_pdfjs_require__(2);
  61508. var _primitives = __w_pdfjs_require__(5);
  61509. var _core_utils = __w_pdfjs_require__(8);
  61510. var _parser = __w_pdfjs_require__(27);
  61511. var _base_stream = __w_pdfjs_require__(9);
  61512. var _crypto = __w_pdfjs_require__(74);
  61513. class XRef {
  61514. constructor(stream, pdfManager) {
  61515. this.stream = stream;
  61516. this.pdfManager = pdfManager;
  61517. this.entries = [];
  61518. this.xrefstms = Object.create(null);
  61519. this._cacheMap = new Map();
  61520. this._pendingRefs = new _primitives.RefSet();
  61521. this.stats = new _core_utils.DocStats(pdfManager.msgHandler);
  61522. this._newRefNum = null;
  61523. }
  61524. getNewRef() {
  61525. if (this._newRefNum === null) {
  61526. this._newRefNum = this.entries.length;
  61527. }
  61528. return _primitives.Ref.get(this._newRefNum++, 0);
  61529. }
  61530. resetNewRef() {
  61531. this._newRefNum = null;
  61532. }
  61533. setStartXRef(startXRef) {
  61534. this.startXRefQueue = [startXRef];
  61535. }
  61536. parse(recoveryMode = false) {
  61537. let trailerDict;
  61538. if (!recoveryMode) {
  61539. trailerDict = this.readXRef();
  61540. } else {
  61541. (0, _util.warn)("Indexing all PDF objects");
  61542. trailerDict = this.indexObjects();
  61543. }
  61544. trailerDict.assignXref(this);
  61545. this.trailer = trailerDict;
  61546. let encrypt;
  61547. try {
  61548. encrypt = trailerDict.get("Encrypt");
  61549. } catch (ex) {
  61550. if (ex instanceof _core_utils.MissingDataException) {
  61551. throw ex;
  61552. }
  61553. (0, _util.warn)(`XRef.parse - Invalid "Encrypt" reference: "${ex}".`);
  61554. }
  61555. if (encrypt instanceof _primitives.Dict) {
  61556. const ids = trailerDict.get("ID");
  61557. const fileId = ids && ids.length ? ids[0] : "";
  61558. encrypt.suppressEncryption = true;
  61559. this.encrypt = new _crypto.CipherTransformFactory(encrypt, fileId, this.pdfManager.password);
  61560. }
  61561. let root;
  61562. try {
  61563. root = trailerDict.get("Root");
  61564. } catch (ex) {
  61565. if (ex instanceof _core_utils.MissingDataException) {
  61566. throw ex;
  61567. }
  61568. (0, _util.warn)(`XRef.parse - Invalid "Root" reference: "${ex}".`);
  61569. }
  61570. if (root instanceof _primitives.Dict) {
  61571. try {
  61572. const pages = root.get("Pages");
  61573. if (pages instanceof _primitives.Dict) {
  61574. this.root = root;
  61575. return;
  61576. }
  61577. } catch (ex) {
  61578. if (ex instanceof _core_utils.MissingDataException) {
  61579. throw ex;
  61580. }
  61581. (0, _util.warn)(`XRef.parse - Invalid "Pages" reference: "${ex}".`);
  61582. }
  61583. }
  61584. if (!recoveryMode) {
  61585. throw new _core_utils.XRefParseException();
  61586. }
  61587. throw new _util.InvalidPDFException("Invalid Root reference.");
  61588. }
  61589. processXRefTable(parser) {
  61590. if (!("tableState" in this)) {
  61591. this.tableState = {
  61592. entryNum: 0,
  61593. streamPos: parser.lexer.stream.pos,
  61594. parserBuf1: parser.buf1,
  61595. parserBuf2: parser.buf2
  61596. };
  61597. }
  61598. const obj = this.readXRefTable(parser);
  61599. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61600. throw new _util.FormatError("Invalid XRef table: could not find trailer dictionary");
  61601. }
  61602. let dict = parser.getObj();
  61603. if (!(dict instanceof _primitives.Dict) && dict.dict) {
  61604. dict = dict.dict;
  61605. }
  61606. if (!(dict instanceof _primitives.Dict)) {
  61607. throw new _util.FormatError("Invalid XRef table: could not parse trailer dictionary");
  61608. }
  61609. delete this.tableState;
  61610. return dict;
  61611. }
  61612. readXRefTable(parser) {
  61613. const stream = parser.lexer.stream;
  61614. const tableState = this.tableState;
  61615. stream.pos = tableState.streamPos;
  61616. parser.buf1 = tableState.parserBuf1;
  61617. parser.buf2 = tableState.parserBuf2;
  61618. let obj;
  61619. while (true) {
  61620. if (!("firstEntryNum" in tableState) || !("entryCount" in tableState)) {
  61621. if ((0, _primitives.isCmd)(obj = parser.getObj(), "trailer")) {
  61622. break;
  61623. }
  61624. tableState.firstEntryNum = obj;
  61625. tableState.entryCount = parser.getObj();
  61626. }
  61627. let first = tableState.firstEntryNum;
  61628. const count = tableState.entryCount;
  61629. if (!Number.isInteger(first) || !Number.isInteger(count)) {
  61630. throw new _util.FormatError("Invalid XRef table: wrong types in subsection header");
  61631. }
  61632. for (let i = tableState.entryNum; i < count; i++) {
  61633. tableState.streamPos = stream.pos;
  61634. tableState.entryNum = i;
  61635. tableState.parserBuf1 = parser.buf1;
  61636. tableState.parserBuf2 = parser.buf2;
  61637. const entry = {};
  61638. entry.offset = parser.getObj();
  61639. entry.gen = parser.getObj();
  61640. const type = parser.getObj();
  61641. if (type instanceof _primitives.Cmd) {
  61642. switch (type.cmd) {
  61643. case "f":
  61644. entry.free = true;
  61645. break;
  61646. case "n":
  61647. entry.uncompressed = true;
  61648. break;
  61649. }
  61650. }
  61651. if (!Number.isInteger(entry.offset) || !Number.isInteger(entry.gen) || !(entry.free || entry.uncompressed)) {
  61652. throw new _util.FormatError(`Invalid entry in XRef subsection: ${first}, ${count}`);
  61653. }
  61654. if (i === 0 && entry.free && first === 1) {
  61655. first = 0;
  61656. }
  61657. if (!this.entries[i + first]) {
  61658. this.entries[i + first] = entry;
  61659. }
  61660. }
  61661. tableState.entryNum = 0;
  61662. tableState.streamPos = stream.pos;
  61663. tableState.parserBuf1 = parser.buf1;
  61664. tableState.parserBuf2 = parser.buf2;
  61665. delete tableState.firstEntryNum;
  61666. delete tableState.entryCount;
  61667. }
  61668. if (this.entries[0] && !this.entries[0].free) {
  61669. throw new _util.FormatError("Invalid XRef table: unexpected first object");
  61670. }
  61671. return obj;
  61672. }
  61673. processXRefStream(stream) {
  61674. if (!("streamState" in this)) {
  61675. const streamParameters = stream.dict;
  61676. const byteWidths = streamParameters.get("W");
  61677. let range = streamParameters.get("Index");
  61678. if (!range) {
  61679. range = [0, streamParameters.get("Size")];
  61680. }
  61681. this.streamState = {
  61682. entryRanges: range,
  61683. byteWidths,
  61684. entryNum: 0,
  61685. streamPos: stream.pos
  61686. };
  61687. }
  61688. this.readXRefStream(stream);
  61689. delete this.streamState;
  61690. return stream.dict;
  61691. }
  61692. readXRefStream(stream) {
  61693. const streamState = this.streamState;
  61694. stream.pos = streamState.streamPos;
  61695. const [typeFieldWidth, offsetFieldWidth, generationFieldWidth] = streamState.byteWidths;
  61696. const entryRanges = streamState.entryRanges;
  61697. while (entryRanges.length > 0) {
  61698. const [first, n] = entryRanges;
  61699. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  61700. throw new _util.FormatError(`Invalid XRef range fields: ${first}, ${n}`);
  61701. }
  61702. if (!Number.isInteger(typeFieldWidth) || !Number.isInteger(offsetFieldWidth) || !Number.isInteger(generationFieldWidth)) {
  61703. throw new _util.FormatError(`Invalid XRef entry fields length: ${first}, ${n}`);
  61704. }
  61705. for (let i = streamState.entryNum; i < n; ++i) {
  61706. streamState.entryNum = i;
  61707. streamState.streamPos = stream.pos;
  61708. let type = 0,
  61709. offset = 0,
  61710. generation = 0;
  61711. for (let j = 0; j < typeFieldWidth; ++j) {
  61712. const typeByte = stream.getByte();
  61713. if (typeByte === -1) {
  61714. throw new _util.FormatError("Invalid XRef byteWidths 'type'.");
  61715. }
  61716. type = type << 8 | typeByte;
  61717. }
  61718. if (typeFieldWidth === 0) {
  61719. type = 1;
  61720. }
  61721. for (let j = 0; j < offsetFieldWidth; ++j) {
  61722. const offsetByte = stream.getByte();
  61723. if (offsetByte === -1) {
  61724. throw new _util.FormatError("Invalid XRef byteWidths 'offset'.");
  61725. }
  61726. offset = offset << 8 | offsetByte;
  61727. }
  61728. for (let j = 0; j < generationFieldWidth; ++j) {
  61729. const generationByte = stream.getByte();
  61730. if (generationByte === -1) {
  61731. throw new _util.FormatError("Invalid XRef byteWidths 'generation'.");
  61732. }
  61733. generation = generation << 8 | generationByte;
  61734. }
  61735. const entry = {};
  61736. entry.offset = offset;
  61737. entry.gen = generation;
  61738. switch (type) {
  61739. case 0:
  61740. entry.free = true;
  61741. break;
  61742. case 1:
  61743. entry.uncompressed = true;
  61744. break;
  61745. case 2:
  61746. break;
  61747. default:
  61748. throw new _util.FormatError(`Invalid XRef entry type: ${type}`);
  61749. }
  61750. if (!this.entries[first + i]) {
  61751. this.entries[first + i] = entry;
  61752. }
  61753. }
  61754. streamState.entryNum = 0;
  61755. streamState.streamPos = stream.pos;
  61756. entryRanges.splice(0, 2);
  61757. }
  61758. }
  61759. indexObjects() {
  61760. const TAB = 0x9,
  61761. LF = 0xa,
  61762. CR = 0xd,
  61763. SPACE = 0x20;
  61764. const PERCENT = 0x25,
  61765. LT = 0x3c;
  61766. function readToken(data, offset) {
  61767. let token = "",
  61768. ch = data[offset];
  61769. while (ch !== LF && ch !== CR && ch !== LT) {
  61770. if (++offset >= data.length) {
  61771. break;
  61772. }
  61773. token += String.fromCharCode(ch);
  61774. ch = data[offset];
  61775. }
  61776. return token;
  61777. }
  61778. function skipUntil(data, offset, what) {
  61779. const length = what.length,
  61780. dataLength = data.length;
  61781. let skipped = 0;
  61782. while (offset < dataLength) {
  61783. let i = 0;
  61784. while (i < length && data[offset + i] === what[i]) {
  61785. ++i;
  61786. }
  61787. if (i >= length) {
  61788. break;
  61789. }
  61790. offset++;
  61791. skipped++;
  61792. }
  61793. return skipped;
  61794. }
  61795. const objRegExp = /^(\d+)\s+(\d+)\s+obj\b/;
  61796. const endobjRegExp = /\bendobj[\b\s]$/;
  61797. const nestedObjRegExp = /\s+(\d+\s+\d+\s+obj[\b\s<])$/;
  61798. const CHECK_CONTENT_LENGTH = 25;
  61799. const trailerBytes = new Uint8Array([116, 114, 97, 105, 108, 101, 114]);
  61800. const startxrefBytes = new Uint8Array([115, 116, 97, 114, 116, 120, 114, 101, 102]);
  61801. const objBytes = new Uint8Array([111, 98, 106]);
  61802. const xrefBytes = new Uint8Array([47, 88, 82, 101, 102]);
  61803. this.entries.length = 0;
  61804. this._cacheMap.clear();
  61805. const stream = this.stream;
  61806. stream.pos = 0;
  61807. const buffer = stream.getBytes(),
  61808. length = buffer.length;
  61809. let position = stream.start;
  61810. const trailers = [],
  61811. xrefStms = [];
  61812. while (position < length) {
  61813. let ch = buffer[position];
  61814. if (ch === TAB || ch === LF || ch === CR || ch === SPACE) {
  61815. ++position;
  61816. continue;
  61817. }
  61818. if (ch === PERCENT) {
  61819. do {
  61820. ++position;
  61821. if (position >= length) {
  61822. break;
  61823. }
  61824. ch = buffer[position];
  61825. } while (ch !== LF && ch !== CR);
  61826. continue;
  61827. }
  61828. const token = readToken(buffer, position);
  61829. let m;
  61830. if (token.startsWith("xref") && (token.length === 4 || /\s/.test(token[4]))) {
  61831. position += skipUntil(buffer, position, trailerBytes);
  61832. trailers.push(position);
  61833. position += skipUntil(buffer, position, startxrefBytes);
  61834. } else if (m = objRegExp.exec(token)) {
  61835. const num = m[1] | 0,
  61836. gen = m[2] | 0;
  61837. let contentLength,
  61838. startPos = position + token.length,
  61839. updateEntries = false;
  61840. if (!this.entries[num]) {
  61841. updateEntries = true;
  61842. } else if (this.entries[num].gen === gen) {
  61843. try {
  61844. const parser = new _parser.Parser({
  61845. lexer: new _parser.Lexer(stream.makeSubStream(startPos))
  61846. });
  61847. parser.getObj();
  61848. updateEntries = true;
  61849. } catch (ex) {
  61850. if (ex instanceof _core_utils.ParserEOFException) {
  61851. (0, _util.warn)(`indexObjects -- checking object (${token}): "${ex}".`);
  61852. } else {
  61853. updateEntries = true;
  61854. }
  61855. }
  61856. }
  61857. if (updateEntries) {
  61858. this.entries[num] = {
  61859. offset: position - stream.start,
  61860. gen,
  61861. uncompressed: true
  61862. };
  61863. }
  61864. while (startPos < buffer.length) {
  61865. const endPos = startPos + skipUntil(buffer, startPos, objBytes) + 4;
  61866. contentLength = endPos - position;
  61867. const checkPos = Math.max(endPos - CHECK_CONTENT_LENGTH, startPos);
  61868. const tokenStr = (0, _util.bytesToString)(buffer.subarray(checkPos, endPos));
  61869. if (endobjRegExp.test(tokenStr)) {
  61870. break;
  61871. } else {
  61872. const objToken = nestedObjRegExp.exec(tokenStr);
  61873. if (objToken && objToken[1]) {
  61874. (0, _util.warn)('indexObjects: Found new "obj" inside of another "obj", ' + 'caused by missing "endobj" -- trying to recover.');
  61875. contentLength -= objToken[1].length;
  61876. break;
  61877. }
  61878. }
  61879. startPos = endPos;
  61880. }
  61881. const content = buffer.subarray(position, position + contentLength);
  61882. const xrefTagOffset = skipUntil(content, 0, xrefBytes);
  61883. if (xrefTagOffset < contentLength && content[xrefTagOffset + 5] < 64) {
  61884. xrefStms.push(position - stream.start);
  61885. this.xrefstms[position - stream.start] = 1;
  61886. }
  61887. position += contentLength;
  61888. } else if (token.startsWith("trailer") && (token.length === 7 || /\s/.test(token[7]))) {
  61889. trailers.push(position);
  61890. position += skipUntil(buffer, position, startxrefBytes);
  61891. } else {
  61892. position += token.length + 1;
  61893. }
  61894. }
  61895. for (let i = 0, ii = xrefStms.length; i < ii; ++i) {
  61896. this.startXRefQueue.push(xrefStms[i]);
  61897. this.readXRef(true);
  61898. }
  61899. let trailerDict;
  61900. for (let i = 0, ii = trailers.length; i < ii; ++i) {
  61901. stream.pos = trailers[i];
  61902. const parser = new _parser.Parser({
  61903. lexer: new _parser.Lexer(stream),
  61904. xref: this,
  61905. allowStreams: true,
  61906. recoveryMode: true
  61907. });
  61908. const obj = parser.getObj();
  61909. if (!(0, _primitives.isCmd)(obj, "trailer")) {
  61910. continue;
  61911. }
  61912. const dict = parser.getObj();
  61913. if (!(dict instanceof _primitives.Dict)) {
  61914. continue;
  61915. }
  61916. try {
  61917. const rootDict = dict.get("Root");
  61918. if (!(rootDict instanceof _primitives.Dict)) {
  61919. continue;
  61920. }
  61921. const pagesDict = rootDict.get("Pages");
  61922. if (!(pagesDict instanceof _primitives.Dict)) {
  61923. continue;
  61924. }
  61925. const pagesCount = pagesDict.get("Count");
  61926. if (!Number.isInteger(pagesCount)) {
  61927. continue;
  61928. }
  61929. } catch (ex) {
  61930. continue;
  61931. }
  61932. if (dict.has("ID")) {
  61933. return dict;
  61934. }
  61935. trailerDict = dict;
  61936. }
  61937. if (trailerDict) {
  61938. return trailerDict;
  61939. }
  61940. if (this.topDict) {
  61941. return this.topDict;
  61942. }
  61943. throw new _util.InvalidPDFException("Invalid PDF structure.");
  61944. }
  61945. readXRef(recoveryMode = false) {
  61946. const stream = this.stream;
  61947. const startXRefParsedCache = new Set();
  61948. try {
  61949. while (this.startXRefQueue.length) {
  61950. const startXRef = this.startXRefQueue[0];
  61951. if (startXRefParsedCache.has(startXRef)) {
  61952. (0, _util.warn)("readXRef - skipping XRef table since it was already parsed.");
  61953. this.startXRefQueue.shift();
  61954. continue;
  61955. }
  61956. startXRefParsedCache.add(startXRef);
  61957. stream.pos = startXRef + stream.start;
  61958. const parser = new _parser.Parser({
  61959. lexer: new _parser.Lexer(stream),
  61960. xref: this,
  61961. allowStreams: true
  61962. });
  61963. let obj = parser.getObj();
  61964. let dict;
  61965. if ((0, _primitives.isCmd)(obj, "xref")) {
  61966. dict = this.processXRefTable(parser);
  61967. if (!this.topDict) {
  61968. this.topDict = dict;
  61969. }
  61970. obj = dict.get("XRefStm");
  61971. if (Number.isInteger(obj)) {
  61972. const pos = obj;
  61973. if (!(pos in this.xrefstms)) {
  61974. this.xrefstms[pos] = 1;
  61975. this.startXRefQueue.push(pos);
  61976. }
  61977. }
  61978. } else if (Number.isInteger(obj)) {
  61979. if (!Number.isInteger(parser.getObj()) || !(0, _primitives.isCmd)(parser.getObj(), "obj") || !((obj = parser.getObj()) instanceof _base_stream.BaseStream)) {
  61980. throw new _util.FormatError("Invalid XRef stream");
  61981. }
  61982. dict = this.processXRefStream(obj);
  61983. if (!this.topDict) {
  61984. this.topDict = dict;
  61985. }
  61986. if (!dict) {
  61987. throw new _util.FormatError("Failed to read XRef stream");
  61988. }
  61989. } else {
  61990. throw new _util.FormatError("Invalid XRef stream header");
  61991. }
  61992. obj = dict.get("Prev");
  61993. if (Number.isInteger(obj)) {
  61994. this.startXRefQueue.push(obj);
  61995. } else if (obj instanceof _primitives.Ref) {
  61996. this.startXRefQueue.push(obj.num);
  61997. }
  61998. this.startXRefQueue.shift();
  61999. }
  62000. return this.topDict;
  62001. } catch (e) {
  62002. if (e instanceof _core_utils.MissingDataException) {
  62003. throw e;
  62004. }
  62005. (0, _util.info)("(while reading XRef): " + e);
  62006. this.startXRefQueue.shift();
  62007. }
  62008. if (recoveryMode) {
  62009. return undefined;
  62010. }
  62011. throw new _core_utils.XRefParseException();
  62012. }
  62013. getEntry(i) {
  62014. const xrefEntry = this.entries[i];
  62015. if (xrefEntry && !xrefEntry.free && xrefEntry.offset) {
  62016. return xrefEntry;
  62017. }
  62018. return null;
  62019. }
  62020. fetchIfRef(obj, suppressEncryption = false) {
  62021. if (obj instanceof _primitives.Ref) {
  62022. return this.fetch(obj, suppressEncryption);
  62023. }
  62024. return obj;
  62025. }
  62026. fetch(ref, suppressEncryption = false) {
  62027. if (!(ref instanceof _primitives.Ref)) {
  62028. throw new Error("ref object is not a reference");
  62029. }
  62030. const num = ref.num;
  62031. const cacheEntry = this._cacheMap.get(num);
  62032. if (cacheEntry !== undefined) {
  62033. if (cacheEntry instanceof _primitives.Dict && !cacheEntry.objId) {
  62034. cacheEntry.objId = ref.toString();
  62035. }
  62036. return cacheEntry;
  62037. }
  62038. let xrefEntry = this.getEntry(num);
  62039. if (xrefEntry === null) {
  62040. this._cacheMap.set(num, xrefEntry);
  62041. return xrefEntry;
  62042. }
  62043. if (this._pendingRefs.has(ref)) {
  62044. this._pendingRefs.remove(ref);
  62045. (0, _util.warn)(`Ignoring circular reference: ${ref}.`);
  62046. return _primitives.CIRCULAR_REF;
  62047. }
  62048. this._pendingRefs.put(ref);
  62049. try {
  62050. if (xrefEntry.uncompressed) {
  62051. xrefEntry = this.fetchUncompressed(ref, xrefEntry, suppressEncryption);
  62052. } else {
  62053. xrefEntry = this.fetchCompressed(ref, xrefEntry, suppressEncryption);
  62054. }
  62055. this._pendingRefs.remove(ref);
  62056. } catch (ex) {
  62057. this._pendingRefs.remove(ref);
  62058. throw ex;
  62059. }
  62060. if (xrefEntry instanceof _primitives.Dict) {
  62061. xrefEntry.objId = ref.toString();
  62062. } else if (xrefEntry instanceof _base_stream.BaseStream) {
  62063. xrefEntry.dict.objId = ref.toString();
  62064. }
  62065. return xrefEntry;
  62066. }
  62067. fetchUncompressed(ref, xrefEntry, suppressEncryption = false) {
  62068. const gen = ref.gen;
  62069. let num = ref.num;
  62070. if (xrefEntry.gen !== gen) {
  62071. throw new _core_utils.XRefEntryException(`Inconsistent generation in XRef: ${ref}`);
  62072. }
  62073. const stream = this.stream.makeSubStream(xrefEntry.offset + this.stream.start);
  62074. const parser = new _parser.Parser({
  62075. lexer: new _parser.Lexer(stream),
  62076. xref: this,
  62077. allowStreams: true
  62078. });
  62079. const obj1 = parser.getObj();
  62080. const obj2 = parser.getObj();
  62081. const obj3 = parser.getObj();
  62082. if (obj1 !== num || obj2 !== gen || !(obj3 instanceof _primitives.Cmd)) {
  62083. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62084. }
  62085. if (obj3.cmd !== "obj") {
  62086. if (obj3.cmd.startsWith("obj")) {
  62087. num = parseInt(obj3.cmd.substring(3), 10);
  62088. if (!Number.isNaN(num)) {
  62089. return num;
  62090. }
  62091. }
  62092. throw new _core_utils.XRefEntryException(`Bad (uncompressed) XRef entry: ${ref}`);
  62093. }
  62094. if (this.encrypt && !suppressEncryption) {
  62095. xrefEntry = parser.getObj(this.encrypt.createCipherTransform(num, gen));
  62096. } else {
  62097. xrefEntry = parser.getObj();
  62098. }
  62099. if (!(xrefEntry instanceof _base_stream.BaseStream)) {
  62100. this._cacheMap.set(num, xrefEntry);
  62101. }
  62102. return xrefEntry;
  62103. }
  62104. fetchCompressed(ref, xrefEntry, suppressEncryption = false) {
  62105. const tableOffset = xrefEntry.offset;
  62106. const stream = this.fetch(_primitives.Ref.get(tableOffset, 0));
  62107. if (!(stream instanceof _base_stream.BaseStream)) {
  62108. throw new _util.FormatError("bad ObjStm stream");
  62109. }
  62110. const first = stream.dict.get("First");
  62111. const n = stream.dict.get("N");
  62112. if (!Number.isInteger(first) || !Number.isInteger(n)) {
  62113. throw new _util.FormatError("invalid first and n parameters for ObjStm stream");
  62114. }
  62115. let parser = new _parser.Parser({
  62116. lexer: new _parser.Lexer(stream),
  62117. xref: this,
  62118. allowStreams: true
  62119. });
  62120. const nums = new Array(n);
  62121. const offsets = new Array(n);
  62122. for (let i = 0; i < n; ++i) {
  62123. const num = parser.getObj();
  62124. if (!Number.isInteger(num)) {
  62125. throw new _util.FormatError(`invalid object number in the ObjStm stream: ${num}`);
  62126. }
  62127. const offset = parser.getObj();
  62128. if (!Number.isInteger(offset)) {
  62129. throw new _util.FormatError(`invalid object offset in the ObjStm stream: ${offset}`);
  62130. }
  62131. nums[i] = num;
  62132. offsets[i] = offset;
  62133. }
  62134. const start = (stream.start || 0) + first;
  62135. const entries = new Array(n);
  62136. for (let i = 0; i < n; ++i) {
  62137. const length = i < n - 1 ? offsets[i + 1] - offsets[i] : undefined;
  62138. if (length < 0) {
  62139. throw new _util.FormatError("Invalid offset in the ObjStm stream.");
  62140. }
  62141. parser = new _parser.Parser({
  62142. lexer: new _parser.Lexer(stream.makeSubStream(start + offsets[i], length, stream.dict)),
  62143. xref: this,
  62144. allowStreams: true
  62145. });
  62146. const obj = parser.getObj();
  62147. entries[i] = obj;
  62148. if (obj instanceof _base_stream.BaseStream) {
  62149. continue;
  62150. }
  62151. const num = nums[i],
  62152. entry = this.entries[num];
  62153. if (entry && entry.offset === tableOffset && entry.gen === i) {
  62154. this._cacheMap.set(num, obj);
  62155. }
  62156. }
  62157. xrefEntry = entries[xrefEntry.gen];
  62158. if (xrefEntry === undefined) {
  62159. throw new _core_utils.XRefEntryException(`Bad (compressed) XRef entry: ${ref}`);
  62160. }
  62161. return xrefEntry;
  62162. }
  62163. async fetchIfRefAsync(obj, suppressEncryption) {
  62164. if (obj instanceof _primitives.Ref) {
  62165. return this.fetchAsync(obj, suppressEncryption);
  62166. }
  62167. return obj;
  62168. }
  62169. async fetchAsync(ref, suppressEncryption) {
  62170. try {
  62171. return this.fetch(ref, suppressEncryption);
  62172. } catch (ex) {
  62173. if (!(ex instanceof _core_utils.MissingDataException)) {
  62174. throw ex;
  62175. }
  62176. await this.pdfManager.requestRange(ex.begin, ex.end);
  62177. return this.fetchAsync(ref, suppressEncryption);
  62178. }
  62179. }
  62180. getCatalogObj() {
  62181. return this.root;
  62182. }
  62183. }
  62184. exports.XRef = XRef;
  62185. /***/ }),
  62186. /* 102 */
  62187. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62188. Object.defineProperty(exports, "__esModule", ({
  62189. value: true
  62190. }));
  62191. exports.MessageHandler = void 0;
  62192. var _util = __w_pdfjs_require__(2);
  62193. const CallbackKind = {
  62194. UNKNOWN: 0,
  62195. DATA: 1,
  62196. ERROR: 2
  62197. };
  62198. const StreamKind = {
  62199. UNKNOWN: 0,
  62200. CANCEL: 1,
  62201. CANCEL_COMPLETE: 2,
  62202. CLOSE: 3,
  62203. ENQUEUE: 4,
  62204. ERROR: 5,
  62205. PULL: 6,
  62206. PULL_COMPLETE: 7,
  62207. START_COMPLETE: 8
  62208. };
  62209. function wrapReason(reason) {
  62210. if (!(reason instanceof Error || typeof reason === "object" && reason !== null)) {
  62211. (0, _util.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.');
  62212. }
  62213. switch (reason.name) {
  62214. case "AbortException":
  62215. return new _util.AbortException(reason.message);
  62216. case "MissingPDFException":
  62217. return new _util.MissingPDFException(reason.message);
  62218. case "PasswordException":
  62219. return new _util.PasswordException(reason.message, reason.code);
  62220. case "UnexpectedResponseException":
  62221. return new _util.UnexpectedResponseException(reason.message, reason.status);
  62222. case "UnknownErrorException":
  62223. return new _util.UnknownErrorException(reason.message, reason.details);
  62224. default:
  62225. return new _util.UnknownErrorException(reason.message, reason.toString());
  62226. }
  62227. }
  62228. class MessageHandler {
  62229. constructor(sourceName, targetName, comObj) {
  62230. this.sourceName = sourceName;
  62231. this.targetName = targetName;
  62232. this.comObj = comObj;
  62233. this.callbackId = 1;
  62234. this.streamId = 1;
  62235. this.streamSinks = Object.create(null);
  62236. this.streamControllers = Object.create(null);
  62237. this.callbackCapabilities = Object.create(null);
  62238. this.actionHandler = Object.create(null);
  62239. this._onComObjOnMessage = event => {
  62240. const data = event.data;
  62241. if (data.targetName !== this.sourceName) {
  62242. return;
  62243. }
  62244. if (data.stream) {
  62245. this._processStreamMessage(data);
  62246. return;
  62247. }
  62248. if (data.callback) {
  62249. const callbackId = data.callbackId;
  62250. const capability = this.callbackCapabilities[callbackId];
  62251. if (!capability) {
  62252. throw new Error(`Cannot resolve callback ${callbackId}`);
  62253. }
  62254. delete this.callbackCapabilities[callbackId];
  62255. if (data.callback === CallbackKind.DATA) {
  62256. capability.resolve(data.data);
  62257. } else if (data.callback === CallbackKind.ERROR) {
  62258. capability.reject(wrapReason(data.reason));
  62259. } else {
  62260. throw new Error("Unexpected callback case");
  62261. }
  62262. return;
  62263. }
  62264. const action = this.actionHandler[data.action];
  62265. if (!action) {
  62266. throw new Error(`Unknown action from worker: ${data.action}`);
  62267. }
  62268. if (data.callbackId) {
  62269. const cbSourceName = this.sourceName;
  62270. const cbTargetName = data.sourceName;
  62271. new Promise(function (resolve) {
  62272. resolve(action(data.data));
  62273. }).then(function (result) {
  62274. comObj.postMessage({
  62275. sourceName: cbSourceName,
  62276. targetName: cbTargetName,
  62277. callback: CallbackKind.DATA,
  62278. callbackId: data.callbackId,
  62279. data: result
  62280. });
  62281. }, function (reason) {
  62282. comObj.postMessage({
  62283. sourceName: cbSourceName,
  62284. targetName: cbTargetName,
  62285. callback: CallbackKind.ERROR,
  62286. callbackId: data.callbackId,
  62287. reason: wrapReason(reason)
  62288. });
  62289. });
  62290. return;
  62291. }
  62292. if (data.streamId) {
  62293. this._createStreamSink(data);
  62294. return;
  62295. }
  62296. action(data.data);
  62297. };
  62298. comObj.addEventListener("message", this._onComObjOnMessage);
  62299. }
  62300. on(actionName, handler) {
  62301. const ah = this.actionHandler;
  62302. if (ah[actionName]) {
  62303. throw new Error(`There is already an actionName called "${actionName}"`);
  62304. }
  62305. ah[actionName] = handler;
  62306. }
  62307. send(actionName, data, transfers) {
  62308. this.comObj.postMessage({
  62309. sourceName: this.sourceName,
  62310. targetName: this.targetName,
  62311. action: actionName,
  62312. data
  62313. }, transfers);
  62314. }
  62315. sendWithPromise(actionName, data, transfers) {
  62316. const callbackId = this.callbackId++;
  62317. const capability = (0, _util.createPromiseCapability)();
  62318. this.callbackCapabilities[callbackId] = capability;
  62319. try {
  62320. this.comObj.postMessage({
  62321. sourceName: this.sourceName,
  62322. targetName: this.targetName,
  62323. action: actionName,
  62324. callbackId,
  62325. data
  62326. }, transfers);
  62327. } catch (ex) {
  62328. capability.reject(ex);
  62329. }
  62330. return capability.promise;
  62331. }
  62332. sendWithStream(actionName, data, queueingStrategy, transfers) {
  62333. const streamId = this.streamId++,
  62334. sourceName = this.sourceName,
  62335. targetName = this.targetName,
  62336. comObj = this.comObj;
  62337. return new ReadableStream({
  62338. start: controller => {
  62339. const startCapability = (0, _util.createPromiseCapability)();
  62340. this.streamControllers[streamId] = {
  62341. controller,
  62342. startCall: startCapability,
  62343. pullCall: null,
  62344. cancelCall: null,
  62345. isClosed: false
  62346. };
  62347. comObj.postMessage({
  62348. sourceName,
  62349. targetName,
  62350. action: actionName,
  62351. streamId,
  62352. data,
  62353. desiredSize: controller.desiredSize
  62354. }, transfers);
  62355. return startCapability.promise;
  62356. },
  62357. pull: controller => {
  62358. const pullCapability = (0, _util.createPromiseCapability)();
  62359. this.streamControllers[streamId].pullCall = pullCapability;
  62360. comObj.postMessage({
  62361. sourceName,
  62362. targetName,
  62363. stream: StreamKind.PULL,
  62364. streamId,
  62365. desiredSize: controller.desiredSize
  62366. });
  62367. return pullCapability.promise;
  62368. },
  62369. cancel: reason => {
  62370. (0, _util.assert)(reason instanceof Error, "cancel must have a valid reason");
  62371. const cancelCapability = (0, _util.createPromiseCapability)();
  62372. this.streamControllers[streamId].cancelCall = cancelCapability;
  62373. this.streamControllers[streamId].isClosed = true;
  62374. comObj.postMessage({
  62375. sourceName,
  62376. targetName,
  62377. stream: StreamKind.CANCEL,
  62378. streamId,
  62379. reason: wrapReason(reason)
  62380. });
  62381. return cancelCapability.promise;
  62382. }
  62383. }, queueingStrategy);
  62384. }
  62385. _createStreamSink(data) {
  62386. const streamId = data.streamId,
  62387. sourceName = this.sourceName,
  62388. targetName = data.sourceName,
  62389. comObj = this.comObj;
  62390. const self = this,
  62391. action = this.actionHandler[data.action];
  62392. const streamSink = {
  62393. enqueue(chunk, size = 1, transfers) {
  62394. if (this.isCancelled) {
  62395. return;
  62396. }
  62397. const lastDesiredSize = this.desiredSize;
  62398. this.desiredSize -= size;
  62399. if (lastDesiredSize > 0 && this.desiredSize <= 0) {
  62400. this.sinkCapability = (0, _util.createPromiseCapability)();
  62401. this.ready = this.sinkCapability.promise;
  62402. }
  62403. comObj.postMessage({
  62404. sourceName,
  62405. targetName,
  62406. stream: StreamKind.ENQUEUE,
  62407. streamId,
  62408. chunk
  62409. }, transfers);
  62410. },
  62411. close() {
  62412. if (this.isCancelled) {
  62413. return;
  62414. }
  62415. this.isCancelled = true;
  62416. comObj.postMessage({
  62417. sourceName,
  62418. targetName,
  62419. stream: StreamKind.CLOSE,
  62420. streamId
  62421. });
  62422. delete self.streamSinks[streamId];
  62423. },
  62424. error(reason) {
  62425. (0, _util.assert)(reason instanceof Error, "error must have a valid reason");
  62426. if (this.isCancelled) {
  62427. return;
  62428. }
  62429. this.isCancelled = true;
  62430. comObj.postMessage({
  62431. sourceName,
  62432. targetName,
  62433. stream: StreamKind.ERROR,
  62434. streamId,
  62435. reason: wrapReason(reason)
  62436. });
  62437. },
  62438. sinkCapability: (0, _util.createPromiseCapability)(),
  62439. onPull: null,
  62440. onCancel: null,
  62441. isCancelled: false,
  62442. desiredSize: data.desiredSize,
  62443. ready: null
  62444. };
  62445. streamSink.sinkCapability.resolve();
  62446. streamSink.ready = streamSink.sinkCapability.promise;
  62447. this.streamSinks[streamId] = streamSink;
  62448. new Promise(function (resolve) {
  62449. resolve(action(data.data, streamSink));
  62450. }).then(function () {
  62451. comObj.postMessage({
  62452. sourceName,
  62453. targetName,
  62454. stream: StreamKind.START_COMPLETE,
  62455. streamId,
  62456. success: true
  62457. });
  62458. }, function (reason) {
  62459. comObj.postMessage({
  62460. sourceName,
  62461. targetName,
  62462. stream: StreamKind.START_COMPLETE,
  62463. streamId,
  62464. reason: wrapReason(reason)
  62465. });
  62466. });
  62467. }
  62468. _processStreamMessage(data) {
  62469. const streamId = data.streamId,
  62470. sourceName = this.sourceName,
  62471. targetName = data.sourceName,
  62472. comObj = this.comObj;
  62473. const streamController = this.streamControllers[streamId],
  62474. streamSink = this.streamSinks[streamId];
  62475. switch (data.stream) {
  62476. case StreamKind.START_COMPLETE:
  62477. if (data.success) {
  62478. streamController.startCall.resolve();
  62479. } else {
  62480. streamController.startCall.reject(wrapReason(data.reason));
  62481. }
  62482. break;
  62483. case StreamKind.PULL_COMPLETE:
  62484. if (data.success) {
  62485. streamController.pullCall.resolve();
  62486. } else {
  62487. streamController.pullCall.reject(wrapReason(data.reason));
  62488. }
  62489. break;
  62490. case StreamKind.PULL:
  62491. if (!streamSink) {
  62492. comObj.postMessage({
  62493. sourceName,
  62494. targetName,
  62495. stream: StreamKind.PULL_COMPLETE,
  62496. streamId,
  62497. success: true
  62498. });
  62499. break;
  62500. }
  62501. if (streamSink.desiredSize <= 0 && data.desiredSize > 0) {
  62502. streamSink.sinkCapability.resolve();
  62503. }
  62504. streamSink.desiredSize = data.desiredSize;
  62505. new Promise(function (resolve) {
  62506. resolve(streamSink.onPull && streamSink.onPull());
  62507. }).then(function () {
  62508. comObj.postMessage({
  62509. sourceName,
  62510. targetName,
  62511. stream: StreamKind.PULL_COMPLETE,
  62512. streamId,
  62513. success: true
  62514. });
  62515. }, function (reason) {
  62516. comObj.postMessage({
  62517. sourceName,
  62518. targetName,
  62519. stream: StreamKind.PULL_COMPLETE,
  62520. streamId,
  62521. reason: wrapReason(reason)
  62522. });
  62523. });
  62524. break;
  62525. case StreamKind.ENQUEUE:
  62526. (0, _util.assert)(streamController, "enqueue should have stream controller");
  62527. if (streamController.isClosed) {
  62528. break;
  62529. }
  62530. streamController.controller.enqueue(data.chunk);
  62531. break;
  62532. case StreamKind.CLOSE:
  62533. (0, _util.assert)(streamController, "close should have stream controller");
  62534. if (streamController.isClosed) {
  62535. break;
  62536. }
  62537. streamController.isClosed = true;
  62538. streamController.controller.close();
  62539. this._deleteStreamController(streamController, streamId);
  62540. break;
  62541. case StreamKind.ERROR:
  62542. (0, _util.assert)(streamController, "error should have stream controller");
  62543. streamController.controller.error(wrapReason(data.reason));
  62544. this._deleteStreamController(streamController, streamId);
  62545. break;
  62546. case StreamKind.CANCEL_COMPLETE:
  62547. if (data.success) {
  62548. streamController.cancelCall.resolve();
  62549. } else {
  62550. streamController.cancelCall.reject(wrapReason(data.reason));
  62551. }
  62552. this._deleteStreamController(streamController, streamId);
  62553. break;
  62554. case StreamKind.CANCEL:
  62555. if (!streamSink) {
  62556. break;
  62557. }
  62558. new Promise(function (resolve) {
  62559. resolve(streamSink.onCancel && streamSink.onCancel(wrapReason(data.reason)));
  62560. }).then(function () {
  62561. comObj.postMessage({
  62562. sourceName,
  62563. targetName,
  62564. stream: StreamKind.CANCEL_COMPLETE,
  62565. streamId,
  62566. success: true
  62567. });
  62568. }, function (reason) {
  62569. comObj.postMessage({
  62570. sourceName,
  62571. targetName,
  62572. stream: StreamKind.CANCEL_COMPLETE,
  62573. streamId,
  62574. reason: wrapReason(reason)
  62575. });
  62576. });
  62577. streamSink.sinkCapability.reject(wrapReason(data.reason));
  62578. streamSink.isCancelled = true;
  62579. delete this.streamSinks[streamId];
  62580. break;
  62581. default:
  62582. throw new Error("Unexpected stream case");
  62583. }
  62584. }
  62585. async _deleteStreamController(streamController, streamId) {
  62586. await Promise.allSettled([streamController.startCall && streamController.startCall.promise, streamController.pullCall && streamController.pullCall.promise, streamController.cancelCall && streamController.cancelCall.promise]);
  62587. delete this.streamControllers[streamId];
  62588. }
  62589. destroy() {
  62590. this.comObj.removeEventListener("message", this._onComObjOnMessage);
  62591. }
  62592. }
  62593. exports.MessageHandler = MessageHandler;
  62594. /***/ }),
  62595. /* 103 */
  62596. /***/ ((__unused_webpack_module, exports, __w_pdfjs_require__) => {
  62597. Object.defineProperty(exports, "__esModule", ({
  62598. value: true
  62599. }));
  62600. exports.PDFWorkerStream = void 0;
  62601. var _util = __w_pdfjs_require__(2);
  62602. class PDFWorkerStream {
  62603. constructor(msgHandler) {
  62604. this._msgHandler = msgHandler;
  62605. this._contentLength = null;
  62606. this._fullRequestReader = null;
  62607. this._rangeRequestReaders = [];
  62608. }
  62609. getFullReader() {
  62610. (0, _util.assert)(!this._fullRequestReader, "PDFWorkerStream.getFullReader can only be called once.");
  62611. this._fullRequestReader = new PDFWorkerStreamReader(this._msgHandler);
  62612. return this._fullRequestReader;
  62613. }
  62614. getRangeReader(begin, end) {
  62615. const reader = new PDFWorkerStreamRangeReader(begin, end, this._msgHandler);
  62616. this._rangeRequestReaders.push(reader);
  62617. return reader;
  62618. }
  62619. cancelAllRequests(reason) {
  62620. if (this._fullRequestReader) {
  62621. this._fullRequestReader.cancel(reason);
  62622. }
  62623. for (const reader of this._rangeRequestReaders.slice(0)) {
  62624. reader.cancel(reason);
  62625. }
  62626. }
  62627. }
  62628. exports.PDFWorkerStream = PDFWorkerStream;
  62629. class PDFWorkerStreamReader {
  62630. constructor(msgHandler) {
  62631. this._msgHandler = msgHandler;
  62632. this.onProgress = null;
  62633. this._contentLength = null;
  62634. this._isRangeSupported = false;
  62635. this._isStreamingSupported = false;
  62636. const readableStream = this._msgHandler.sendWithStream("GetReader");
  62637. this._reader = readableStream.getReader();
  62638. this._headersReady = this._msgHandler.sendWithPromise("ReaderHeadersReady").then(data => {
  62639. this._isStreamingSupported = data.isStreamingSupported;
  62640. this._isRangeSupported = data.isRangeSupported;
  62641. this._contentLength = data.contentLength;
  62642. });
  62643. }
  62644. get headersReady() {
  62645. return this._headersReady;
  62646. }
  62647. get contentLength() {
  62648. return this._contentLength;
  62649. }
  62650. get isStreamingSupported() {
  62651. return this._isStreamingSupported;
  62652. }
  62653. get isRangeSupported() {
  62654. return this._isRangeSupported;
  62655. }
  62656. async read() {
  62657. const {
  62658. value,
  62659. done
  62660. } = await this._reader.read();
  62661. if (done) {
  62662. return {
  62663. value: undefined,
  62664. done: true
  62665. };
  62666. }
  62667. return {
  62668. value: value.buffer,
  62669. done: false
  62670. };
  62671. }
  62672. cancel(reason) {
  62673. this._reader.cancel(reason);
  62674. }
  62675. }
  62676. class PDFWorkerStreamRangeReader {
  62677. constructor(begin, end, msgHandler) {
  62678. this._msgHandler = msgHandler;
  62679. this.onProgress = null;
  62680. const readableStream = this._msgHandler.sendWithStream("GetRangeReader", {
  62681. begin,
  62682. end
  62683. });
  62684. this._reader = readableStream.getReader();
  62685. }
  62686. get isStreamingSupported() {
  62687. return false;
  62688. }
  62689. async read() {
  62690. const {
  62691. value,
  62692. done
  62693. } = await this._reader.read();
  62694. if (done) {
  62695. return {
  62696. value: undefined,
  62697. done: true
  62698. };
  62699. }
  62700. return {
  62701. value: value.buffer,
  62702. done: false
  62703. };
  62704. }
  62705. cancel(reason) {
  62706. this._reader.cancel(reason);
  62707. }
  62708. }
  62709. /***/ })
  62710. /******/ ]);
  62711. /************************************************************************/
  62712. /******/ // The module cache
  62713. /******/ var __webpack_module_cache__ = {};
  62714. /******/
  62715. /******/ // The require function
  62716. /******/ function __w_pdfjs_require__(moduleId) {
  62717. /******/ // Check if module is in cache
  62718. /******/ var cachedModule = __webpack_module_cache__[moduleId];
  62719. /******/ if (cachedModule !== undefined) {
  62720. /******/ return cachedModule.exports;
  62721. /******/ }
  62722. /******/ // Create a new module (and put it into the cache)
  62723. /******/ var module = __webpack_module_cache__[moduleId] = {
  62724. /******/ // no module.id needed
  62725. /******/ // no module.loaded needed
  62726. /******/ exports: {}
  62727. /******/ };
  62728. /******/
  62729. /******/ // Execute the module function
  62730. /******/ __webpack_modules__[moduleId](module, module.exports, __w_pdfjs_require__);
  62731. /******/
  62732. /******/ // Return the exports of the module
  62733. /******/ return module.exports;
  62734. /******/ }
  62735. /******/
  62736. /************************************************************************/
  62737. /******/ /* webpack/runtime/define property getters */
  62738. /******/ (() => {
  62739. /******/ // define getter functions for harmony exports
  62740. /******/ __w_pdfjs_require__.d = (exports, definition) => {
  62741. /******/ for(var key in definition) {
  62742. /******/ if(__w_pdfjs_require__.o(definition, key) && !__w_pdfjs_require__.o(exports, key)) {
  62743. /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
  62744. /******/ }
  62745. /******/ }
  62746. /******/ };
  62747. /******/ })();
  62748. /******/
  62749. /******/ /* webpack/runtime/hasOwnProperty shorthand */
  62750. /******/ (() => {
  62751. /******/ __w_pdfjs_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
  62752. /******/ })();
  62753. /******/
  62754. /******/ /* webpack/runtime/make namespace object */
  62755. /******/ (() => {
  62756. /******/ // define __esModule on exports
  62757. /******/ __w_pdfjs_require__.r = (exports) => {
  62758. /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
  62759. /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
  62760. /******/ }
  62761. /******/ Object.defineProperty(exports, '__esModule', { value: true });
  62762. /******/ };
  62763. /******/ })();
  62764. /******/
  62765. /************************************************************************/
  62766. var __webpack_exports__ = {};
  62767. // This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
  62768. (() => {
  62769. var exports = __webpack_exports__;
  62770. Object.defineProperty(exports, "__esModule", ({
  62771. value: true
  62772. }));
  62773. Object.defineProperty(exports, "WorkerMessageHandler", ({
  62774. enumerable: true,
  62775. get: function () {
  62776. return _worker.WorkerMessageHandler;
  62777. }
  62778. }));
  62779. var _worker = __w_pdfjs_require__(1);
  62780. const pdfjsVersion = '2.14.305';
  62781. const pdfjsBuild = 'eaaa8b4ad';
  62782. })();
  62783. /******/ return __webpack_exports__;
  62784. /******/ })()
  62785. ;
  62786. });